summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2002-06-15 16:43:33 +0000
committerAndrew Cagney <cagney@redhat.com>2002-06-15 16:43:33 +0000
commitab9dfe2ee9d249d88c30101d9ff52c6738ae829b (patch)
tree1ffb6a6a724b49932e112b48f3edb84bc7e2bd26
parentbc2a075a2db2365031bd85c4e9ca9ca260f5b155 (diff)
downloadgdb-ab9dfe2ee9d249d88c30101d9ff52c6738ae829b.tar.gz
merge from trunk
-rw-r--r--ChangeLog62
-rw-r--r--Makefile.in156
-rw-r--r--bfd/ChangeLog976
-rw-r--r--bfd/Makefile.am89
-rw-r--r--bfd/Makefile.in667
-rw-r--r--bfd/acinclude.m424
-rw-r--r--bfd/aclocal.m450
-rw-r--r--bfd/aix5ppc-core.c20
-rw-r--r--bfd/aout-adobe.c2
-rw-r--r--bfd/aout-target.h6
-rw-r--r--bfd/aout-tic30.c6
-rw-r--r--bfd/aoutx.h7
-rw-r--r--bfd/archures.c3
-rw-r--r--bfd/armnetbsd.c4
-rw-r--r--bfd/bfd-in.h28
-rw-r--r--bfd/bfd-in2.h129
-rw-r--r--bfd/bfd.c7
-rw-r--r--bfd/binary.c2
-rw-r--r--bfd/bout.c2
-rw-r--r--bfd/coff-alpha.c3
-rw-r--r--bfd/coff-arm.c28
-rw-r--r--bfd/coff-mips.c7
-rw-r--r--bfd/coff-rs6000.c53
-rw-r--r--bfd/coff-sh.c9
-rw-r--r--bfd/coff64-rs6000.c38
-rw-r--r--bfd/coffcode.h15
-rw-r--r--bfd/coffgen.c16
-rw-r--r--bfd/cofflink.c4
-rw-r--r--bfd/config.bfd87
-rw-r--r--bfd/config.in3
-rwxr-xr-xbfd/configure634
-rw-r--r--bfd/configure.in31
-rw-r--r--bfd/corefile.c4
-rw-r--r--bfd/cpu-dlx.c39
-rw-r--r--bfd/cpu-h8300.c41
-rw-r--r--bfd/cpu-mips.c7
-rw-r--r--bfd/doc/ChangeLog25
-rw-r--r--bfd/doc/Makefile.am12
-rw-r--r--bfd/doc/Makefile.in14
-rw-r--r--bfd/doc/bfdint.texi4
-rw-r--r--bfd/doc/chew.c2
-rw-r--r--bfd/ecoff.c3
-rw-r--r--bfd/ecofflink.c13
-rw-r--r--bfd/elf-bfd.h67
-rw-r--r--bfd/elf-eh-frame.c4
-rw-r--r--bfd/elf-m10200.c12
-rw-r--r--bfd/elf-m10300.c22
-rw-r--r--bfd/elf-strtab.c29
-rw-r--r--bfd/elf.c412
-rw-r--r--bfd/elf32-arc.c2
-rw-r--r--bfd/elf32-arm.h74
-rw-r--r--bfd/elf32-cris.c2
-rw-r--r--bfd/elf32-dlx.c659
-rw-r--r--bfd/elf32-h8300.c31
-rw-r--r--bfd/elf32-hppa.c5
-rw-r--r--bfd/elf32-i370.c4
-rw-r--r--bfd/elf32-i386.c712
-rw-r--r--bfd/elf32-i386qnx.c111
-rw-r--r--bfd/elf32-m68k.c5
-rw-r--r--bfd/elf32-mips.c209
-rw-r--r--bfd/elf32-openrisc.c8
-rw-r--r--bfd/elf32-or32.c20
-rw-r--r--bfd/elf32-ppc.c4
-rw-r--r--bfd/elf32-s390.c2
-rw-r--r--bfd/elf32-sh.c15
-rw-r--r--bfd/elf32-sh64-com.c264
-rw-r--r--bfd/elf32-sh64-nbsd.c29
-rw-r--r--bfd/elf32-sh64.c249
-rw-r--r--bfd/elf32-v850.c6
-rw-r--r--bfd/elf32-vax.c2214
-rw-r--r--bfd/elf32-xstormy16.c59
-rw-r--r--bfd/elf64-alpha.c2314
-rw-r--r--bfd/elf64-hppa.c45
-rw-r--r--bfd/elf64-mips.c5
-rw-r--r--bfd/elf64-mmix.c5
-rw-r--r--bfd/elf64-ppc.c225
-rw-r--r--bfd/elf64-s390.c3
-rw-r--r--bfd/elf64-sh64-nbsd.c29
-rw-r--r--bfd/elf64-sh64.c33
-rw-r--r--bfd/elf64-sparc.c3
-rw-r--r--bfd/elf64-x86-64.c75
-rw-r--r--bfd/elfarm-oabi.c17
-rw-r--r--bfd/elfcode.h16
-rw-r--r--bfd/elflink.h206
-rw-r--r--bfd/elfxx-ia64.c281
-rw-r--r--bfd/elfxx-mips.c100
-rw-r--r--bfd/elfxx-mips.h4
-rw-r--r--bfd/elfxx-target.h23
-rw-r--r--bfd/hash.c2
-rw-r--r--bfd/i386linux.c3
-rw-r--r--bfd/i386lynx.c5
-rw-r--r--bfd/i386msdos.c2
-rw-r--r--bfd/i386os9k.c2
-rw-r--r--bfd/ieee.c5
-rw-r--r--bfd/ihex.c2
-rw-r--r--bfd/libaout.h1
-rw-r--r--bfd/libbfd-in.h14
-rw-r--r--bfd/libbfd.h67
-rw-r--r--bfd/libcoff-in.h2
-rw-r--r--bfd/libcoff.h3
-rw-r--r--bfd/libecoff.h1
-rw-r--r--bfd/linker.c70
-rw-r--r--bfd/m68klinux.c3
-rw-r--r--bfd/merge.c38
-rw-r--r--bfd/mmo.c46
-rw-r--r--bfd/nlm-target.h2
-rw-r--r--bfd/ns32knetbsd.c4
-rw-r--r--bfd/oasys.c2
-rw-r--r--bfd/pdp11.c9
-rw-r--r--bfd/pe-i386.c32
-rw-r--r--bfd/peXXigen.c156
-rw-r--r--bfd/pei-i386.c32
-rw-r--r--bfd/po/SRC-POTFILES.in7
-rw-r--r--bfd/ppcboot.c2
-rw-r--r--bfd/reloc.c101
-rw-r--r--bfd/reloc16.c3
-rw-r--r--bfd/rs6000-core.c2
-rw-r--r--bfd/section.c29
-rw-r--r--bfd/som.c23
-rw-r--r--bfd/sparclinux.c3
-rw-r--r--bfd/srec.c2
-rw-r--r--bfd/stabs.c16
-rw-r--r--bfd/sunos.c3
-rw-r--r--bfd/syms.c10
-rw-r--r--bfd/targets.c23
-rw-r--r--bfd/tekhex.c10
-rw-r--r--bfd/vax1knetbsd.c37
-rw-r--r--bfd/vaxnetbsd.c8
-rw-r--r--bfd/versados.c2
-rw-r--r--bfd/version.h2
-rw-r--r--bfd/vms-gsd.c6
-rw-r--r--bfd/vms.c2
-rw-r--r--bfd/xcoff-target.h3
-rw-r--r--bfd/xcofflink.c13
-rw-r--r--config-ml.in17
-rwxr-xr-xconfig.guess8
-rwxr-xr-xconfig.sub10
-rw-r--r--config/ChangeLog10
-rwxr-xr-xconfig/acinclude.m4172
-rw-r--r--config/mh-apollo681
-rw-r--r--config/mh-dgux1
-rw-r--r--config/mh-dgux3864
-rwxr-xr-xconfigure62
-rw-r--r--configure.in137
-rw-r--r--etc/ChangeLog38
-rw-r--r--etc/texi2pod.pl132
-rw-r--r--gdb/29k-share/udi/udip2soc.c1250
-rw-r--r--gdb/ChangeLog1514
-rw-r--r--gdb/MAINTAINERS85
-rw-r--r--gdb/Makefile.in153
-rw-r--r--gdb/NEWS45
-rw-r--r--gdb/PROBLEMS12
-rw-r--r--gdb/ada-exp.tab.c2389
-rw-r--r--gdb/ada-exp.y962
-rw-r--r--gdb/ada-lang.c8626
-rw-r--r--gdb/ada-lang.h365
-rw-r--r--gdb/ada-lex.c3174
-rw-r--r--gdb/ada-lex.l928
-rw-r--r--gdb/ada-tasks.c806
-rw-r--r--gdb/ada-typeprint.c896
-rw-r--r--gdb/ada-valprint.c1058
-rw-r--r--gdb/alpha-linux-tdep.c3
-rw-r--r--gdb/alpha-osf1-tdep.c2
-rw-r--r--gdb/alpha-tdep.c262
-rw-r--r--gdb/alpha-tdep.h22
-rw-r--r--gdb/alphafbsd-tdep.c3
-rw-r--r--gdb/alphanbsd-tdep.c27
-rw-r--r--gdb/arch-utils.c30
-rw-r--r--gdb/arch-utils.h15
-rw-r--r--gdb/arm-linux-tdep.c4
-rw-r--r--gdb/arm-tdep.c576
-rw-r--r--gdb/arm-tdep.h29
-rw-r--r--gdb/armnbsd-tdep.c23
-rw-r--r--gdb/avr-tdep.c6
-rw-r--r--gdb/blockframe.c196
-rw-r--r--gdb/breakpoint.c23
-rw-r--r--gdb/breakpoint.h8
-rw-r--r--gdb/c-exp.y37
-rw-r--r--gdb/c-lang.c129
-rw-r--r--gdb/c-lang.h8
-rw-r--r--gdb/c-typeprint.c95
-rw-r--r--gdb/cli/cli-dump.c8
-rw-r--r--gdb/config/alpha/nm-linux.h2
-rw-r--r--gdb/config/alpha/nm-nbsd.h2
-rw-r--r--gdb/config/alpha/tm-alphalinux.h2
-rw-r--r--gdb/config/alpha/tm-nbsd.h1
-rw-r--r--gdb/config/arc/tm-arc.h4
-rw-r--r--gdb/config/arm/nbsd.mt2
-rw-r--r--gdb/config/arm/nbsdaout.mh5
-rw-r--r--gdb/config/arm/nbsdelf.mh (renamed from gdb/config/arm/nbsd.mh)0
-rw-r--r--gdb/config/arm/nm-linux.h2
-rw-r--r--gdb/config/arm/nm-nbsd.h2
-rw-r--r--gdb/config/arm/nm-nbsdaout.h29
-rw-r--r--gdb/config/arm/tm-linux.h2
-rw-r--r--gdb/config/arm/xm-nbsd.h2
-rw-r--r--gdb/config/d30v/tm-d30v.h4
-rw-r--r--gdb/config/djgpp/fnchange.lst27
-rw-r--r--gdb/config/fr30/tm-fr30.h4
-rw-r--r--gdb/config/h8300/tm-h8300.h11
-rw-r--r--gdb/config/h8500/tm-h8500.h4
-rw-r--r--gdb/config/i386/i386nw.mt2
-rw-r--r--gdb/config/i386/i386sol2.mh3
-rw-r--r--gdb/config/i386/i386sol2.mt4
-rw-r--r--gdb/config/i386/nbsdaout.mh (renamed from gdb/config/i386/nbsd.mh)2
-rw-r--r--gdb/config/i386/nbsdaout.mt (renamed from gdb/config/i386/nbsd.mt)2
-rw-r--r--gdb/config/i386/nbsdelf.mh2
-rw-r--r--gdb/config/i386/nbsdelf.mt2
-rw-r--r--gdb/config/i386/nm-cygwin.h4
-rw-r--r--gdb/config/i386/nm-gnu.h2
-rw-r--r--gdb/config/i386/nm-go32.h4
-rw-r--r--gdb/config/i386/nm-i386lynx.h2
-rw-r--r--gdb/config/i386/nm-i386sol2.h2
-rw-r--r--gdb/config/i386/nm-i386v4.h2
-rw-r--r--gdb/config/i386/nm-i386v42mp.h2
-rw-r--r--gdb/config/i386/nm-linux.h2
-rw-r--r--gdb/config/i386/nm-m3.h2
-rw-r--r--gdb/config/i386/nm-nbsd.h7
-rw-r--r--gdb/config/i386/nm-nbsdaout.h (renamed from gdb/config/i386/nm-nbsdelf.h)12
-rw-r--r--gdb/config/i386/nm-ptx4.h4
-rw-r--r--gdb/config/i386/nm-x86-64.h2
-rw-r--r--gdb/config/i386/tm-fbsd.h53
-rw-r--r--gdb/config/i386/tm-go32.h39
-rw-r--r--gdb/config/i386/tm-i386.h99
-rw-r--r--gdb/config/i386/tm-i386gnu.h4
-rw-r--r--gdb/config/i386/tm-i386lynx.h2
-rw-r--r--gdb/config/i386/tm-i386m3.h2
-rw-r--r--gdb/config/i386/tm-i386nw.h49
-rw-r--r--gdb/config/i386/tm-i386sco5.h2
-rw-r--r--gdb/config/i386/tm-i386sol2.h14
-rw-r--r--gdb/config/i386/tm-i386v4.h47
-rw-r--r--gdb/config/i386/tm-linux.h82
-rw-r--r--gdb/config/i386/tm-nbsd.h43
-rw-r--r--gdb/config/i386/tm-nbsdaout.h (renamed from gdb/config/tm-nbsd.h)13
-rw-r--r--gdb/config/i386/tm-ptx.h4
-rw-r--r--gdb/config/i386/tm-ptx4.h2
-rw-r--r--gdb/config/i386/tm-symmetry.h4
-rw-r--r--gdb/config/i386/tm-vxworks.h2
-rw-r--r--gdb/config/i386/x86-64linux.mt2
-rw-r--r--gdb/config/i386/xm-i386v4.h2
-rw-r--r--gdb/config/i386/xm-nbsd.h2
-rw-r--r--gdb/config/i386/xm-ptx.h2
-rw-r--r--gdb/config/i386/xm-ptx4.h4
-rw-r--r--gdb/config/i960/tm-i960.h4
-rw-r--r--gdb/config/i960/tm-vx960.h2
-rw-r--r--gdb/config/ia64/nm-aix.h2
-rw-r--r--gdb/config/ia64/nm-linux.h2
-rw-r--r--gdb/config/ia64/tm-aix.h2
-rw-r--r--gdb/config/ia64/tm-linux.h2
-rw-r--r--gdb/config/ia64/xm-aix.h2
-rw-r--r--gdb/config/m32r/tm-m32r.h6
-rw-r--r--gdb/config/m68k/nbsdaout.mh (renamed from gdb/config/m68k/nbsd.mh)2
-rw-r--r--gdb/config/m68k/nbsdaout.mt (renamed from gdb/config/m68k/nbsd.mt)0
-rw-r--r--gdb/config/m68k/nm-linux.h2
-rw-r--r--gdb/config/m68k/nm-m68klynx.h2
-rw-r--r--gdb/config/m68k/nm-nbsd.h7
-rw-r--r--gdb/config/m68k/nm-nbsdaout.h29
-rw-r--r--gdb/config/m68k/nm-sysv4.h2
-rw-r--r--gdb/config/m68k/tm-delta68.h6
-rw-r--r--gdb/config/m68k/tm-linux.h8
-rw-r--r--gdb/config/m68k/tm-m68k.h6
-rw-r--r--gdb/config/m68k/tm-m68klynx.h2
-rw-r--r--gdb/config/m68k/tm-m68kv4.h2
-rw-r--r--gdb/config/m68k/tm-nbsd.h5
-rw-r--r--gdb/config/m68k/tm-sun2os4.h2
-rw-r--r--gdb/config/m68k/tm-sun3os4.h2
-rw-r--r--gdb/config/m68k/tm-vx68.h2
-rw-r--r--gdb/config/m68k/xm-m68kv4.h2
-rw-r--r--gdb/config/m68k/xm-nbsd.h2
-rw-r--r--gdb/config/m88k/nm-delta88v4.h2
-rw-r--r--gdb/config/m88k/tm-delta88v4.h2
-rw-r--r--gdb/config/m88k/tm-m88k.h4
-rw-r--r--gdb/config/m88k/xm-delta88v4.h2
-rw-r--r--gdb/config/mcore/tm-mcore.h4
-rw-r--r--gdb/config/mips/nbsd.mh4
-rw-r--r--gdb/config/mips/nbsd.mt6
-rw-r--r--gdb/config/mips/nm-irix5.h2
-rw-r--r--gdb/config/mips/nm-linux.h2
-rw-r--r--gdb/config/mips/nm-nbsd.h28
-rw-r--r--gdb/config/mips/tm-irix5.h12
-rw-r--r--gdb/config/mips/tm-irix6.h12
-rw-r--r--gdb/config/mips/tm-linux.h2
-rw-r--r--gdb/config/mips/tm-mips.h18
-rw-r--r--gdb/config/mips/tm-mips64.h2
-rw-r--r--gdb/config/mips/tm-mipsm3.h2
-rw-r--r--gdb/config/mips/tm-mipsv4.h2
-rw-r--r--gdb/config/mips/tm-nbsd.h45
-rw-r--r--gdb/config/mips/tm-vxmips.h2
-rw-r--r--gdb/config/mips/xm-irix5.h2
-rw-r--r--gdb/config/mips/xm-mipsv4.h2
-rw-r--r--gdb/config/mn10200/tm-mn10200.h4
-rw-r--r--gdb/config/nm-nbsd.h60
-rw-r--r--gdb/config/nm-nbsdaout.h72
-rw-r--r--gdb/config/ns32k/nbsdaout.mh (renamed from gdb/config/ns32k/nbsd.mh)2
-rw-r--r--gdb/config/ns32k/nbsdaout.mt (renamed from gdb/config/ns32k/nbsd.mt)2
-rw-r--r--gdb/config/ns32k/nm-nbsd.h2
-rw-r--r--gdb/config/ns32k/nm-nbsdaout.h30
-rw-r--r--gdb/config/ns32k/tm-nbsd.h53
-rw-r--r--gdb/config/ns32k/tm-ns32k.h39
-rw-r--r--gdb/config/ns32k/tm-umax.h319
-rw-r--r--gdb/config/ns32k/xm-nbsd.h2
-rw-r--r--gdb/config/pa/hpux11w.mh2
-rw-r--r--gdb/config/pa/nm-hppao.h2
-rw-r--r--gdb/config/pa/tm-hppa.h23
-rw-r--r--gdb/config/pa/tm-hppa64.h4
-rw-r--r--gdb/config/powerpc/aix.mt2
-rw-r--r--gdb/config/powerpc/linux.mt3
-rw-r--r--gdb/config/powerpc/nbsd.mh3
-rw-r--r--gdb/config/powerpc/nbsd.mt3
-rw-r--r--gdb/config/powerpc/nm-linux.h2
-rw-r--r--gdb/config/powerpc/nm-nbsd.h6
-rw-r--r--gdb/config/powerpc/ppc-eabi.mt2
-rw-r--r--gdb/config/powerpc/ppc-sim.mt2
-rw-r--r--gdb/config/powerpc/ppcle-eabi.mt2
-rw-r--r--gdb/config/powerpc/ppcle-sim.mt2
-rw-r--r--gdb/config/powerpc/tm-linux.h2
-rw-r--r--gdb/config/powerpc/tm-nbsd.h1
-rw-r--r--gdb/config/powerpc/tm-vxworks.h2
-rw-r--r--gdb/config/powerpc/vxworks.mt2
-rw-r--r--gdb/config/powerpc/xm-aix.h2
-rw-r--r--gdb/config/rs6000/aix4.mt2
-rw-r--r--gdb/config/rs6000/nm-rs6000ly.h2
-rw-r--r--gdb/config/rs6000/rs6000.mt2
-rw-r--r--gdb/config/rs6000/rs6000lynx.mt2
-rw-r--r--gdb/config/rs6000/tm-rs6000ly.h2
-rw-r--r--gdb/config/rs6000/xm-aix4.h2
-rw-r--r--gdb/config/sh/tm-linux.h2
-rw-r--r--gdb/config/sh/tm-sh.h94
-rw-r--r--gdb/config/sparc/nbsd.mh6
-rw-r--r--gdb/config/sparc/nbsd.mt5
-rw-r--r--gdb/config/sparc/nbsd64.mh3
-rw-r--r--gdb/config/sparc/nbsd64.mt4
-rw-r--r--gdb/config/sparc/nbsdaout.mh4
-rw-r--r--gdb/config/sparc/nbsdelf.mh6
-rw-r--r--gdb/config/sparc/nm-linux.h4
-rw-r--r--gdb/config/sparc/nm-nbsd.h28
-rw-r--r--gdb/config/sparc/nm-nbsdaout.h (renamed from gdb/config/sparc/nm-nbsdelf.h)13
-rw-r--r--gdb/config/sparc/nm-sparclynx.h2
-rw-r--r--gdb/config/sparc/nm-sun4sol2.h2
-rw-r--r--gdb/config/sparc/tm-linux.h2
-rw-r--r--gdb/config/sparc/tm-nbsd.h7
-rw-r--r--gdb/config/sparc/tm-nbsd64.h (renamed from gdb/config/i386/tm-nbsdelf.h)15
-rw-r--r--gdb/config/sparc/tm-sp64.h4
-rw-r--r--gdb/config/sparc/tm-sp64linux.h2
-rw-r--r--gdb/config/sparc/tm-sp64sim.h2
-rw-r--r--gdb/config/sparc/tm-sparc.h4
-rw-r--r--gdb/config/sparc/tm-sparclet.h4
-rw-r--r--gdb/config/sparc/tm-sparclynx.h2
-rw-r--r--gdb/config/sparc/tm-sun4os4.h2
-rw-r--r--gdb/config/sparc/tm-sun4sol2.h2
-rw-r--r--gdb/config/sparc/tm-vxsparc.h2
-rw-r--r--gdb/config/sparc/xm-sun4sol2.h2
-rw-r--r--gdb/config/tm-linux.h2
-rw-r--r--gdb/config/v850/tm-v850.h176
-rw-r--r--gdb/config/v850/v850.mt2
-rw-r--r--gdb/config/z8k/tm-z8k.h4
-rw-r--r--gdb/configure.host17
-rw-r--r--gdb/configure.tgt9
-rw-r--r--gdb/corefile.c20
-rw-r--r--gdb/corelow.c7
-rw-r--r--gdb/cris-tdep.c10
-rw-r--r--gdb/d10v-tdep.c235
-rw-r--r--gdb/doc/ChangeLog47
-rw-r--r--gdb/doc/gdb.texinfo266
-rw-r--r--gdb/doc/gdbint.texinfo615
-rw-r--r--gdb/dwarf2cfi.c197
-rw-r--r--gdb/dwarf2read.c483
-rw-r--r--gdb/frame.c196
-rw-r--r--gdb/frame.h60
-rwxr-xr-xgdb/gdb_indent.sh1
-rw-r--r--gdb/gdbarch.c165
-rw-r--r--gdb/gdbarch.h98
-rwxr-xr-xgdb/gdbarch.sh88
-rw-r--r--gdb/gdbserver/Makefile.in6
-rw-r--r--gdb/gdbserver/acconfig.h15
-rw-r--r--gdb/gdbserver/acinclude.m441
-rw-r--r--gdb/gdbserver/aclocal.m4124
-rw-r--r--gdb/gdbserver/config.in33
-rwxr-xr-xgdb/gdbserver/configure422
-rw-r--r--gdb/gdbserver/configure.in63
-rw-r--r--gdb/gdbserver/configure.srv5
-rw-r--r--gdb/gdbserver/i387-fp.c6
-rw-r--r--gdb/gdbserver/i387-fp.h4
-rw-r--r--gdb/gdbserver/inferiors.c156
-rw-r--r--gdb/gdbserver/linux-arm-low.c40
-rw-r--r--gdb/gdbserver/linux-i386-low.c43
-rw-r--r--gdb/gdbserver/linux-low.c875
-rw-r--r--gdb/gdbserver/linux-low.h71
-rw-r--r--gdb/gdbserver/linux-mips-low.c51
-rw-r--r--gdb/gdbserver/linux-ppc-low.c44
-rw-r--r--gdb/gdbserver/linux-sh-low.c40
-rw-r--r--gdb/gdbserver/linux-x86-64-low.c4
-rw-r--r--gdb/gdbserver/proc-service.c256
-rw-r--r--gdb/gdbserver/regcache.c78
-rw-r--r--gdb/gdbserver/regcache.h15
-rw-r--r--gdb/gdbserver/remote-utils.c100
-rw-r--r--gdb/gdbserver/server.c71
-rw-r--r--gdb/gdbserver/server.h55
-rw-r--r--gdb/gdbserver/target.c69
-rw-r--r--gdb/gdbserver/target.h14
-rw-r--r--gdb/gdbserver/thread-db.c342
-rw-r--r--gdb/gdbtypes.c112
-rw-r--r--gdb/gdbtypes.h39
-rw-r--r--gdb/h8300-tdep.c42
-rw-r--r--gdb/hpread.c65
-rw-r--r--gdb/i386-linux-nat.c9
-rw-r--r--gdb/i386-linux-tdep.c67
-rw-r--r--gdb/i386-linux-tdep.h36
-rw-r--r--gdb/i386-sol2-tdep.c59
-rw-r--r--gdb/i386-tdep.c542
-rw-r--r--gdb/i386-tdep.h80
-rw-r--r--gdb/i386bsd-nat.c28
-rw-r--r--gdb/i386bsd-tdep.c201
-rw-r--r--gdb/i386fbsd-nat.c11
-rw-r--r--gdb/i386nbsd-tdep.c10
-rw-r--r--gdb/ia64-tdep.c8
-rw-r--r--gdb/infcmd.c2
-rw-r--r--gdb/infrun.c40
-rw-r--r--gdb/m68hc11-tdep.c7
-rw-r--r--gdb/macrocmd.c287
-rw-r--r--gdb/macroscope.c107
-rw-r--r--gdb/macroscope.h63
-rw-r--r--gdb/macrotab.c73
-rw-r--r--gdb/mi/ChangeLog11
-rw-r--r--gdb/mi/mi-main.c79
-rw-r--r--gdb/mips-tdep.c307
-rw-r--r--gdb/mipsnbsd-nat.c101
-rw-r--r--gdb/mipsnbsd-tdep.c367
-rw-r--r--gdb/mipsnbsd-tdep.h33
-rw-r--r--gdb/mn10300-tdep.c4
-rw-r--r--gdb/ns32k-tdep.c529
-rw-r--r--gdb/ns32k-tdep.h66
-rw-r--r--gdb/ns32knbsd-tdep.c70
-rw-r--r--gdb/objfiles.h2
-rw-r--r--gdb/osabi.c426
-rw-r--r--gdb/osabi.h80
-rw-r--r--gdb/p-exp.y182
-rw-r--r--gdb/pa64solib.c14
-rw-r--r--gdb/parse.c9
-rw-r--r--gdb/parser-defs.h6
-rw-r--r--gdb/ppc-linux-tdep.c328
-rw-r--r--gdb/ppc-sysv-tdep.c312
-rw-r--r--gdb/ppc-tdep.h4
-rw-r--r--gdb/ppcnbsd-nat.c186
-rw-r--r--gdb/ppcnbsd-tdep.c216
-rw-r--r--gdb/ppcnbsd-tdep.h30
-rw-r--r--gdb/rdi-share/devsw.c2
-rw-r--r--gdb/rdi-share/host.h10
-rw-r--r--gdb/rdi-share/hostchan.c2
-rw-r--r--gdb/rdi-share/hostchan.h10
-rw-r--r--gdb/rdi-share/serdrv.c2
-rw-r--r--gdb/rdi-share/serpardr.c2
-rw-r--r--gdb/rdi-share/unixcomm.c4
-rw-r--r--gdb/regbuf.c220
-rw-r--r--gdb/regbuf.h59
-rw-r--r--gdb/remote-rdp.c2
-rw-r--r--gdb/remote-sim.c96
-rw-r--r--gdb/remote-vx29k.c182
-rw-r--r--gdb/remote.c81
-rw-r--r--gdb/rs6000-tdep.c180
-rw-r--r--gdb/s390-tdep.c4
-rw-r--r--gdb/ser-e7kpc.c12
-rw-r--r--gdb/ser-tcp.c1
-rw-r--r--gdb/sh-tdep.c273
-rw-r--r--gdb/sh-tdep.h111
-rw-r--r--gdb/sh3-rom.c2
-rw-r--r--gdb/shnbsd-tdep.c5
-rw-r--r--gdb/signals/signals.c24
-rw-r--r--gdb/sim-regno.h45
-rw-r--r--gdb/solib-svr4.c22
-rw-r--r--gdb/somsolib.c8
-rw-r--r--gdb/source.c2
-rw-r--r--gdb/sparc-tdep.c68
-rw-r--r--gdb/sparc64nbsd-nat.c207
-rw-r--r--gdb/sparcl-tdep.c2
-rw-r--r--gdb/sparcnbsd-nat.c154
-rw-r--r--gdb/sparcnbsd-tdep.c531
-rw-r--r--gdb/sparcnbsd-tdep.h34
-rw-r--r--gdb/stabsread.c43
-rw-r--r--gdb/stack.c116
-rw-r--r--gdb/testsuite/ChangeLog86
-rwxr-xr-xgdb/testsuite/configure19
-rw-r--r--gdb/testsuite/configure.in3
-rw-r--r--gdb/testsuite/gdb.asm/asm-source.exp4
-rw-r--r--gdb/testsuite/gdb.asm/x86_64.inc39
-rw-r--r--gdb/testsuite/gdb.base/all-bin.exp8
-rw-r--r--gdb/testsuite/gdb.base/call-ar-st.exp18
-rw-r--r--gdb/testsuite/gdb.base/call-rt-st.exp4
-rw-r--r--gdb/testsuite/gdb.base/completion.exp6
-rw-r--r--gdb/testsuite/gdb.base/d10v.ld188
-rw-r--r--gdb/testsuite/gdb.base/long_long.exp19
-rw-r--r--gdb/testsuite/gdb.base/macscp.exp403
-rw-r--r--gdb/testsuite/gdb.base/macscp1.c80
-rw-r--r--gdb/testsuite/gdb.base/macscp2.h25
-rw-r--r--gdb/testsuite/gdb.base/macscp3.h25
-rw-r--r--gdb/testsuite/gdb.base/macscp4.h44
-rw-r--r--gdb/testsuite/gdb.base/overlays.exp60
-rw-r--r--gdb/testsuite/gdb.c++/inherit.exp2
-rw-r--r--gdb/testsuite/gdb.c++/local.exp10
-rw-r--r--gdb/testsuite/gdb.c++/m-data.cc53
-rw-r--r--gdb/testsuite/gdb.c++/m-data.exp112
-rw-r--r--gdb/testsuite/gdb.c++/m-static.cc72
-rw-r--r--gdb/testsuite/gdb.c++/m-static.exp112
-rw-r--r--gdb/testsuite/gdb.c++/try_catch.cc126
-rw-r--r--gdb/testsuite/gdb.c++/try_catch.exp84
-rw-r--r--gdb/testsuite/lib/gdb.exp11
-rw-r--r--gdb/v850-tdep.c722
-rw-r--r--gdb/valops.c101
-rw-r--r--gdb/values.c13
-rw-r--r--gdb/vax-tdep.c9
-rw-r--r--gdb/version.in2
-rw-r--r--gdb/x86-64-linux-nat.c69
-rw-r--r--gdb/x86-64-tdep.c64
-rw-r--r--gdb/x86-64-tdep.h3
-rw-r--r--gdb/xstormy16-tdep.c5
-rw-r--r--gdb/z8k-tdep.c21
-rw-r--r--include/ChangeLog65
-rw-r--r--include/bfdlink.h33
-rw-r--r--include/dis-asm.h3
-rw-r--r--include/elf/ChangeLog32
-rw-r--r--include/elf/alpha.h22
-rw-r--r--include/elf/common.h14
-rw-r--r--include/elf/dlx.h53
-rw-r--r--include/elf/dwarf2.h4
-rw-r--r--include/elf/i386.h23
-rw-r--r--include/elf/ia64.h2
-rw-r--r--include/elf/sh.h5
-rw-r--r--include/elf/vax.h51
-rw-r--r--include/gdb/ChangeLog18
-rw-r--r--include/gdb/callback.h270
-rw-r--r--include/gdb/remote-sim.h (renamed from include/remote-sim.h)0
-rw-r--r--include/gdb/sim-arm.h65
-rw-r--r--include/gdb/sim-d10v.h (renamed from include/sim-d10v.h)76
-rw-r--r--include/hashtab.h37
-rw-r--r--include/opcode/ChangeLog35
-rw-r--r--include/opcode/a29k.h10
-rw-r--r--include/opcode/convex.h62
-rw-r--r--include/opcode/dlx.h282
-rw-r--r--include/opcode/h8300.h86
-rw-r--r--include/opcode/ia64.h4
-rw-r--r--include/opcode/mips.h30
-rw-r--r--include/opcode/or32.h4
-rw-r--r--include/opcode/sparc.h4
-rw-r--r--libiberty/ChangeLog27
-rw-r--r--libiberty/config.table3
-rwxr-xr-xlibiberty/configure2
-rw-r--r--libiberty/configure.in2
-rw-r--r--libiberty/hashtab.c82
-rw-r--r--opcodes/ChangeLog131
-rw-r--r--opcodes/Makefile.am38
-rw-r--r--opcodes/Makefile.in111
-rw-r--r--opcodes/a29k-dis.c4
-rw-r--r--opcodes/acinclude.m47
-rw-r--r--opcodes/aclocal.m47
-rw-r--r--opcodes/arc-dis.c6
-rw-r--r--opcodes/arm-dis.c46
-rwxr-xr-xopcodes/configure390
-rw-r--r--opcodes/configure.in5
-rw-r--r--opcodes/d10v-opc.c4
-rw-r--r--opcodes/disassemble.c22
-rw-r--r--opcodes/dlx-dis.c544
-rw-r--r--opcodes/fr30-asm.c2
-rw-r--r--opcodes/fr30-desc.c33
-rw-r--r--opcodes/fr30-dis.c37
-rw-r--r--opcodes/h8300-dis.c11
-rw-r--r--opcodes/m32r-asm.c2
-rw-r--r--opcodes/m32r-desc.c33
-rw-r--r--opcodes/m32r-dis.c37
-rw-r--r--opcodes/m68k-dis.c8
-rw-r--r--opcodes/mips-dis.c59
-rw-r--r--opcodes/mips-opc.c117
-rw-r--r--opcodes/openrisc-asm.c2
-rw-r--r--opcodes/openrisc-desc.c33
-rw-r--r--opcodes/openrisc-dis.c37
-rw-r--r--opcodes/or32-dis.c2
-rw-r--r--opcodes/po/POTFILES.in1
-rw-r--r--opcodes/sh-dis.c52
-rw-r--r--opcodes/sh64-dis.c43
-rw-r--r--opcodes/sparc-dis.c8
-rw-r--r--opcodes/xstormy16-asm.c2
-rw-r--r--opcodes/xstormy16-desc.c33
-rw-r--r--opcodes/xstormy16-dis.c37
-rw-r--r--sim/ChangeLog13
-rw-r--r--sim/MAINTAINERS2
-rw-r--r--sim/Makefile.in14
-rw-r--r--sim/README-HACKING5
-rw-r--r--sim/arm/ChangeLog83
-rw-r--r--sim/arm/Makefile.in10
-rw-r--r--sim/arm/armcopro.c40
-rw-r--r--sim/arm/armemu.c2
-rw-r--r--sim/arm/armos.c549
-rw-r--r--sim/arm/armsupp.c2
-rw-r--r--sim/arm/armvirt.c6
-rw-r--r--sim/arm/dbg_rdi.h6
-rw-r--r--sim/arm/thumbemu.c17
-rw-r--r--sim/arm/wrapper.c214
-rw-r--r--sim/common/ChangeLog48
-rw-r--r--sim/common/Make-common.in41
-rw-r--r--sim/common/callback.c2
-rw-r--r--sim/common/gentmap.c2
-rw-r--r--sim/common/run-sim.h32
-rw-r--r--sim/common/run.c45
-rw-r--r--sim/common/sim-basics.h4
-rw-r--r--sim/common/sim-fpu.c4
-rw-r--r--sim/common/sim-load.c4
-rw-r--r--sim/common/sim-options.c11
-rw-r--r--sim/common/syscall.c2
-rw-r--r--sim/d10v/ChangeLog39
-rw-r--r--sim/d10v/Makefile.in3
-rw-r--r--sim/d10v/d10v_sim.h6
-rw-r--r--sim/d10v/gencode.c1
-rw-r--r--sim/d10v/interp.c182
-rw-r--r--sim/d10v/simops.c8
-rw-r--r--sim/erc32/ChangeLog5
-rw-r--r--sim/erc32/interf.c2
-rw-r--r--sim/erc32/sis.h4
-rw-r--r--sim/h8300/ChangeLog35
-rw-r--r--sim/h8300/compile.c291
-rw-r--r--sim/h8300/inst.h11
-rw-r--r--sim/h8500/ChangeLog4
-rw-r--r--sim/h8500/compile.c4
-rw-r--r--sim/igen/ChangeLog5
-rw-r--r--sim/igen/gen-engine.c46
-rw-r--r--sim/igen/lf.c42
-rw-r--r--sim/m68hc11/ChangeLog5
-rw-r--r--sim/m68hc11/Makefile.in2
-rw-r--r--sim/m68hc11/sim-main.h4
-rw-r--r--sim/mcore/ChangeLog4
-rw-r--r--sim/mcore/interp.c4
-rw-r--r--sim/mips/ChangeLog238
-rw-r--r--sim/mips/Makefile.in5
-rwxr-xr-xsim/mips/configure34
-rw-r--r--sim/mips/configure.in6
-rw-r--r--sim/mips/cp1.c1660
-rw-r--r--sim/mips/cp1.h82
-rw-r--r--sim/mips/interp.c34
-rw-r--r--sim/mips/mdmx.c1472
-rw-r--r--sim/mips/mdmx.igen592
-rw-r--r--sim/mips/mips.igen668
-rw-r--r--sim/mips/mips3d.igen176
-rw-r--r--sim/mips/sb1.igen191
-rw-r--r--sim/mips/sim-main.c36
-rw-r--r--sim/mips/sim-main.h307
-rw-r--r--sim/mn10200/ChangeLog5
-rw-r--r--sim/mn10200/Makefile.in2
-rw-r--r--sim/mn10200/mn10200_sim.h4
-rw-r--r--sim/mn10300/ChangeLog6
-rw-r--r--sim/mn10300/Makefile.in2
-rw-r--r--sim/mn10300/mn10300_sim.h4
-rw-r--r--sim/mn10300/tconfig.in4
-rw-r--r--sim/ppc/ChangeLog12
-rw-r--r--sim/ppc/gen-idecode.c42
-rw-r--r--sim/ppc/gen-model.c2
-rw-r--r--sim/ppc/lf.c44
-rw-r--r--sim/ppc/main.c4
-rw-r--r--sim/ppc/sim_calls.c4
-rw-r--r--sim/sh/ChangeLog4
-rw-r--r--sim/sh/interp.c4
-rw-r--r--sim/tic80/ChangeLog662
-rw-r--r--sim/tic80/Makefile.in140
-rw-r--r--sim/tic80/acconfig.h15
-rw-r--r--sim/tic80/alu.h75
-rw-r--r--sim/tic80/config.in168
-rwxr-xr-xsim/tic80/configure4459
-rw-r--r--sim/tic80/configure.in21
-rw-r--r--sim/tic80/cpu.h345
-rw-r--r--sim/tic80/interp.c127
-rw-r--r--sim/tic80/misc.c624
-rw-r--r--sim/tic80/sim-calls.c203
-rw-r--r--sim/tic80/sim-main.h81
-rw-r--r--sim/tic80/tic80.dc6
-rw-r--r--sim/tic80/tic80.ic52
-rw-r--r--sim/tic80/tic80.igen1615
-rw-r--r--sim/w65/ChangeLog4
-rw-r--r--sim/w65/interp.c4
-rw-r--r--sim/z8k/ChangeLog17
-rw-r--r--sim/z8k/Makefile.in7
-rw-r--r--sim/z8k/iface.c4
-rw-r--r--sim/z8k/support.c4
-rw-r--r--sim/z8k/writecode.c122
679 files changed, 53696 insertions, 20915 deletions
diff --git a/ChangeLog b/ChangeLog
index 1f914904c0a..27ac092f6d2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,65 @@
+2002-06-12 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * Makefile.in (CFLAGS_FOR_TARGET): Add -O2.
+
+2002-06-08 Jason Thorpe <thorpej@wasabisystems.com>
+
+ * configure.in (vax-*-netbsd*): Re-enable gas.
+
+2002-05-31 Nathanael Nerode <neroden@twcny.rr.com>
+
+ * Makefile.in: Replace HOST_PREFIX, HOST_PREFIX_1 with BUILD_PREFIX,
+ BUILD_PREFIX_1, to correct nomenclature.
+ * configure: Likewise.
+
+ * Makefile.in: Eliminate version-specific references to tcl8.1, tk8.1.
+ * configure.in: Eliminate version-specific references to tcl8.1, tk8.1.
+
+2002-05-31 Olaf Hering <olh@suse.de>
+
+ * config-ml.in: Propogate DESTDIR also.
+
+2002-05-29 Jason Thorpe <thorpej@wasabisystems.com>
+
+ * configure.in (vax-*-netbsd*): Don't build gas for this
+ platform.
+
+2002-05-28 Marek Michalkiewicz <marekm@amelek.gda.pl>
+
+ * configure.in (noconfigdirs): Don't compile libiberty, libstdcxx
+ and libgcj for AVR.
+
+2002-05-28 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * config.sub: Add DLX target.
+
+2002-05-22 Jason Thorpe <thorpej@wasabisystems.com>
+
+ * config.guess: Update to 2002-05-22 version.
+ * config.sub: Likewise.
+
+2002-05-16 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
+
+ * Makefile.in: Allow for PWDCMD to override hardcoded pwd.
+ * config-ml.in: Likewise.
+ * configure: Likewise.
+ * configure.in: Likewise.
+
+ config:
+ * acinclude.m4: Allow for PWDCMD to override hardcoded pwd.
+
+2002-05-13 Nathanael Nerode <neroden@twcny.rr.com>
+
+ * configure.in: Simplify makefile fragment collection.
+
+ * configure.in: Remove code to build emacs.
+
+ * configure.in : Remove --srcdir argument from targargs and buildargs
+ (it's always overridden in the Makefile anyway). Rearrange a bit.
+
+ * configure: Move some logic to configure.in.
+ * configure.in: Move some logic from configure.
+
2002-05-07 Jeff Johnston <jjohnstn@redhat.com>
* COPYING.LIBGLOSS: New file.
diff --git a/Makefile.in b/Makefile.in
index 12a69d3d3e6..4a761096539 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,7 +1,7 @@
#
# Makefile for directory with subdirs to build.
# Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
-# 1999, 2000, 2001 Free Software Foundation
+# 1999, 2000, 2001, 2002 Free Software Foundation
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -65,6 +65,12 @@ GDB_NLM_DEPS =
SHELL = /bin/sh
+# pwd command to use. Allow user to override default by setting PWDCMD in
+# the environment to account for automounters. The make variable must not
+# be called PWDCMD, otherwise the value set here is passed to make
+# subprocesses and overrides the setting from the user's environment.
+PWD = $${PWDCMD-pwd}
+
# INSTALL_PROGRAM_ARGS is changed by configure.in to use -x for a
# cygwin host.
INSTALL_PROGRAM_ARGS =
@@ -84,8 +90,8 @@ CC = cc
# Special variables passed down in EXTRA_GCC_FLAGS. They are defined
# here so that they can be overridden by Makefile fragments.
HOST_CC = $(CC_FOR_BUILD)
-HOST_PREFIX =
-HOST_PREFIX_1 = loser-
+BUILD_PREFIX =
+BUILD_PREFIX_1 = loser-
# These flag values are normally overridden by the configure script.
CFLAGS = -g
@@ -94,7 +100,11 @@ CXXFLAGS = -g -O2
LDFLAGS =
LIBCFLAGS = $(CFLAGS)
CFLAGS_FOR_BUILD = $(CFLAGS)
-CFLAGS_FOR_TARGET = $(CFLAGS)
+# During gcc bootstrap, if we use some random cc for stage1 then
+# CFLAGS will be just -g. We want to ensure that TARGET libraries
+# (which we know are built with gcc) are built with optimizations so
+# prepend -O2 when setting CFLAGS_FOR_TARGET.
+CFLAGS_FOR_TARGET = -O2 $(CFLAGS)
LDFLAGS_FOR_TARGET =
LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET)
PICFLAG =
@@ -480,8 +490,8 @@ EXTRA_GCC_FLAGS = \
'CXX=$(CXX)' \
'DLLTOOL=$$(DLLTOOL_FOR_TARGET)' \
'HOST_CC=$(CC_FOR_BUILD)' \
- 'HOST_PREFIX=$(HOST_PREFIX)' \
- 'HOST_PREFIX_1=$(HOST_PREFIX_1)' \
+ 'BUILD_PREFIX=$(BUILD_PREFIX)' \
+ 'BUILD_PREFIX_1=$(BUILD_PREFIX_1)' \
'NM=$(NM)' \
"`echo 'RANLIB=$(RANLIB)' | sed -e s/.*=$$/XFOO=/`" \
'WINDRES=$$(WINDRES_FOR_TARGET)' \
@@ -574,7 +584,6 @@ ALL_MODULES = \
all-snavigator \
all-tar \
all-tcl \
- all-tcl8.1 \
all-texinfo \
all-textutils \
all-tgas \
@@ -706,7 +715,6 @@ INSTALL_MODULES = \
install-intl \
install-ispell \
install-tcl \
- install-tcl8.1 \
install-itcl \
install-ld \
install-libgui \
@@ -746,7 +754,6 @@ ALL_X11_MODULES = \
all-guile \
all-tclX \
all-tk \
- all-tk8.1 \
all-tix
# This is a list of the check targets for all of the modules which are
@@ -770,7 +777,6 @@ INSTALL_X11_MODULES = \
install-expect \
install-tclX \
install-tk \
- install-tk8.1 \
install-tix
# This is a list of the targets for all of the modules which are compiled
@@ -984,8 +990,8 @@ DO_X = \
.PHONY: $(DO_X)
$(DO_X):
@target=`echo $@ | sed -e 's/^do-//'`; \
- r=`pwd`; export r; \
- s=`cd $(srcdir); pwd`; export s; \
+ r=`${PWD}`; export r; \
+ s=`cd $(srcdir); ${PWD}`; export s; \
$(SET_LIB_PATH) \
for i in $(SUBDIRS) -dummy-; do \
if [ -f ./$$i/Makefile ]; then \
@@ -1011,8 +1017,8 @@ $(DO_X):
else true; fi; \
done
@target=`echo $@ | sed -e 's/^do-//'`; \
- r=`pwd`; export r; \
- s=`cd $(srcdir); pwd`; export s; \
+ r=`${PWD}`; export r; \
+ s=`cd $(srcdir); ${PWD}`; export s; \
$(SET_LIB_PATH) \
for i in $(TARGET_CONFIGDIRS) -dummy-; do \
if [ -f $(TARGET_SUBDIR)/$$i/Makefile ]; then \
@@ -1042,7 +1048,7 @@ dvi: do-dvi
do-info: all-texinfo
install-info: do-install-info dir.info
- s=`cd $(srcdir); pwd`; export s; \
+ s=`cd $(srcdir); ${PWD}`; export s; \
if [ -f dir.info ] ; then \
$(INSTALL_DATA) dir.info $(infodir)/dir.info ; \
else true ; fi
@@ -1077,8 +1083,8 @@ realclean: maintainer-clean
$(CLEAN_MODULES) $(CLEAN_X11_MODULES) clean-gcc:
@dir=`echo $@ | sed -e 's/clean-//'`; \
if [ -f ./$${dir}/Makefile ] ; then \
- r=`pwd`; export r; \
- s=`cd $(srcdir); pwd`; export s; \
+ r=`${PWD}`; export r; \
+ s=`cd $(srcdir); ${PWD}`; export s; \
$(SET_LIB_PATH) \
(cd $${dir}; $(MAKE) $(FLAGS_TO_PASS) clean); \
else \
@@ -1090,8 +1096,8 @@ $(CLEAN_TARGET_MODULES):
@dir=`echo $@ | sed -e 's/clean-target-//'`; \
rm -f $(TARGET_SUBDIR)/$${dir}/multilib.out $(TARGET_SUBDIR)/$${dir}/tmpmulti.out; \
if [ -f $(TARGET_SUBDIR)/$${dir}/Makefile ] ; then \
- r=`pwd`; export r; \
- s=`cd $(srcdir); pwd`; export s; \
+ r=`${PWD}`; export r; \
+ s=`cd $(srcdir); ${PWD}`; export s; \
$(SET_LIB_PATH) \
(cd $(TARGET_SUBDIR)/$${dir}; $(MAKE) $(TARGET_FLAGS_TO_PASS) clean); \
else \
@@ -1164,7 +1170,7 @@ vault-install:
.PHONY: install.all
install.all: install-no-fixedincludes
@if [ -f ./gcc/Makefile ] ; then \
- r=`pwd` ; export r ; \
+ r=`${PWD}` ; export r ; \
$(SET_LIB_PATH) \
(cd ./gcc; \
$(MAKE) $(FLAGS_TO_PASS) install-headers) ; \
@@ -1199,8 +1205,8 @@ gcc-no-fixedincludes:
cp $(srcdir)/gcc/gsyslimits.h gcc/include/syslimits.h; \
touch gcc/stmp-fixinc gcc/include/fixed; \
rm -f gcc/stmp-headers gcc/stmp-int-hdrs; \
- r=`pwd`; export r; \
- s=`cd $(srcdir); pwd` ; export s; \
+ r=`${PWD}`; export r; \
+ s=`cd $(srcdir); ${PWD}` ; export s; \
$(SET_LIB_PATH) \
(cd ./gcc; \
$(MAKE) $(GCC_FLAGS_TO_PASS) install); \
@@ -1214,8 +1220,8 @@ gcc-no-fixedincludes:
$(ALL_BUILD_MODULES):
dir=`echo $@ | sed -e 's/all-build-//'`; \
if [ -f ./$${dir}/Makefile ] ; then \
- r=`pwd`; export r; \
- s=`cd $(srcdir); pwd`; export s; \
+ r=`${PWD}`; export r; \
+ s=`cd $(srcdir); ${PWD}`; export s; \
(cd $(BUILD_SUBDIR)/$${dir} && $(MAKE) all); \
else \
true; \
@@ -1233,8 +1239,8 @@ $(CONFIGURE_BUILD_MODULES):
elif echo " $(BUILD_CONFIGDIRS) " | grep " $${dir} " >/dev/null 2>&1; then \
if [ -d $(srcdir)/$${dir} ]; then \
[ -d $(BUILD_SUBDIR)/$${dir} ] || mkdir $(BUILD_SUBDIR)/$${dir};\
- r=`pwd`; export r; \
- s=`cd $(srcdir); pwd`; export s; \
+ r=`${PWD}`; export r; \
+ s=`cd $(srcdir); ${PWD}`; export s; \
AR="$(AR_FOR_BUILD)"; export AR; \
AS="$(AS_FOR_BUILD)"; export AS; \
CC="$(CC_FOR_BUILD)"; export CC; \
@@ -1318,8 +1324,8 @@ $(CONFIGURE_BUILD_MODULES):
$(ALL_MODULES) all-gui all-libproc:
@dir=`echo $@ | sed -e 's/all-//'`; \
if [ -f ./$${dir}/Makefile ] ; then \
- r=`pwd`; export r; \
- s=`cd $(srcdir); pwd`; export s; \
+ r=`${PWD}`; export r; \
+ s=`cd $(srcdir); ${PWD}`; export s; \
$(SET_LIB_PATH) \
(cd $${dir}; $(MAKE) $(FLAGS_TO_PASS) all); \
else \
@@ -1335,8 +1341,8 @@ $(NATIVE_CHECK_MODULES):
@if [ '$(host_canonical)' = '$(target_canonical)' ] ; then \
dir=`echo $@ | sed -e 's/check-//'`; \
if [ -f ./$${dir}/Makefile ] ; then \
- r=`pwd`; export r; \
- s=`cd $(srcdir); pwd`; export s; \
+ r=`${PWD}`; export r; \
+ s=`cd $(srcdir); ${PWD}`; export s; \
$(SET_LIB_PATH) \
(cd $${dir}; $(MAKE) $(FLAGS_TO_PASS) check); \
else \
@@ -1347,8 +1353,8 @@ $(NATIVE_CHECK_MODULES):
$(CROSS_CHECK_MODULES):
@dir=`echo $@ | sed -e 's/check-//'`; \
if [ -f ./$${dir}/Makefile ] ; then \
- r=`pwd`; export r; \
- s=`cd $(srcdir); pwd`; export s; \
+ r=`${PWD}`; export r; \
+ s=`cd $(srcdir); ${PWD}`; export s; \
$(SET_LIB_PATH) \
(cd $${dir}; $(MAKE) $(FLAGS_TO_PASS) check); \
else \
@@ -1361,8 +1367,8 @@ $(CROSS_CHECK_MODULES):
$(INSTALL_MODULES): installdirs
@dir=`echo $@ | sed -e 's/install-//'`; \
if [ -f ./$${dir}/Makefile ] ; then \
- r=`pwd`; export r; \
- s=`cd $(srcdir); pwd`; export s; \
+ r=`${PWD}`; export r; \
+ s=`cd $(srcdir); ${PWD}`; export s; \
$(SET_LIB_PATH) \
(cd $${dir}; $(MAKE) $(FLAGS_TO_PASS) install); \
else \
@@ -1375,7 +1381,7 @@ $(INSTALL_MODULES): installdirs
$(CONFIGURE_TARGET_MODULES):
@dir=`echo $@ | sed -e 's/configure-target-//'`; \
if [ -d $(TARGET_SUBDIR)/$${dir} ]; then \
- r=`pwd`; export r; \
+ r=`${PWD}`; export r; \
$(CC_FOR_TARGET) --print-multi-lib > $(TARGET_SUBDIR)/$${dir}/tmpmulti.out 2> /dev/null; \
if [ -s $(TARGET_SUBDIR)/$${dir}/tmpmulti.out ]; then \
if [ -f $(TARGET_SUBDIR)/$${dir}/multilib.out ]; then \
@@ -1399,8 +1405,8 @@ $(CONFIGURE_TARGET_MODULES):
elif echo " $(TARGET_CONFIGDIRS) " | grep " $${dir} " >/dev/null 2>&1; then \
if [ -d $(srcdir)/$${dir} ]; then \
[ -d $(TARGET_SUBDIR)/$${dir} ] || mkdir $(TARGET_SUBDIR)/$${dir};\
- r=`pwd`; export r; \
- s=`cd $(srcdir); pwd`; export s; \
+ r=`${PWD}`; export r; \
+ s=`cd $(srcdir); ${PWD}`; export s; \
$(SET_LIB_PATH) \
AR="$(AR_FOR_TARGET)"; export AR; \
AS="$(AS_FOR_TARGET)"; export AS; \
@@ -1481,8 +1487,8 @@ $(CONFIGURE_TARGET_MODULES):
$(ALL_TARGET_MODULES):
@dir=`echo $@ | sed -e 's/all-target-//'`; \
if [ -f $(TARGET_SUBDIR)/$${dir}/Makefile ] ; then \
- r=`pwd`; export r; \
- s=`cd $(srcdir); pwd`; export s; \
+ r=`${PWD}`; export r; \
+ s=`cd $(srcdir); ${PWD}`; export s; \
$(SET_LIB_PATH) \
(cd $(TARGET_SUBDIR)/$${dir}; \
$(MAKE) $(TARGET_FLAGS_TO_PASS) all); \
@@ -1496,8 +1502,8 @@ $(ALL_TARGET_MODULES):
$(CHECK_TARGET_MODULES):
@dir=`echo $@ | sed -e 's/check-target-//'`; \
if [ -f $(TARGET_SUBDIR)/$${dir}/Makefile ] ; then \
- r=`pwd`; export r; \
- s=`cd $(srcdir); pwd`; export s; \
+ r=`${PWD}`; export r; \
+ s=`cd $(srcdir); ${PWD}`; export s; \
$(SET_LIB_PATH) \
(cd $(TARGET_SUBDIR)/$${dir}; \
$(MAKE) $(TARGET_FLAGS_TO_PASS) check);\
@@ -1512,8 +1518,8 @@ $(CHECK_TARGET_MODULES):
$(INSTALL_TARGET_MODULES): installdirs
@dir=`echo $@ | sed -e 's/install-target-//'`; \
if [ -f $(TARGET_SUBDIR)/$${dir}/Makefile ] ; then \
- r=`pwd`; export r; \
- s=`cd $(srcdir); pwd`; export s; \
+ r=`${PWD}`; export r; \
+ s=`cd $(srcdir); ${PWD}`; export s; \
$(SET_LIB_PATH) \
(cd $(TARGET_SUBDIR)/$${dir}; \
$(MAKE) $(TARGET_FLAGS_TO_PASS) install); \
@@ -1527,8 +1533,8 @@ $(INSTALL_TARGET_MODULES): installdirs
$(ALL_X11_MODULES):
@dir=`echo $@ | sed -e 's/all-//'`; \
if [ -f ./$${dir}/Makefile ] ; then \
- r=`pwd`; export r; \
- s=`cd $(srcdir); pwd`; export s; \
+ r=`${PWD}`; export r; \
+ s=`cd $(srcdir); ${PWD}`; export s; \
$(SET_LIB_PATH) \
(cd $${dir}; \
$(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) all); \
@@ -1542,8 +1548,8 @@ $(ALL_X11_MODULES):
$(CHECK_X11_MODULES):
@dir=`echo $@ | sed -e 's/check-//'`; \
if [ -f ./$${dir}/Makefile ] ; then \
- r=`pwd`; export r; \
- s=`cd $(srcdir); pwd`; export s; \
+ r=`${PWD}`; export r; \
+ s=`cd $(srcdir); ${PWD}`; export s; \
$(SET_LIB_PATH) \
(cd $${dir}; \
$(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) check); \
@@ -1557,8 +1563,8 @@ $(CHECK_X11_MODULES):
$(INSTALL_X11_MODULES): installdirs
@dir=`echo $@ | sed -e 's/install-//'`; \
if [ -f ./$${dir}/Makefile ] ; then \
- r=`pwd`; export r; \
- s=`cd $(srcdir); pwd`; export s; \
+ r=`${PWD}`; export r; \
+ s=`cd $(srcdir); ${PWD}`; export s; \
$(SET_LIB_PATH) \
(cd $${dir}; \
$(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) install); \
@@ -1570,8 +1576,8 @@ $(INSTALL_X11_MODULES): installdirs
.PHONY: all-gcc
all-gcc:
@if [ -f ./gcc/Makefile ] ; then \
- r=`pwd`; export r; \
- s=`cd $(srcdir); pwd`; export s; \
+ r=`${PWD}`; export r; \
+ s=`cd $(srcdir); ${PWD}`; export s; \
$(SET_LIB_PATH) \
(cd gcc; $(MAKE) $(GCC_FLAGS_TO_PASS) all); \
else \
@@ -1590,13 +1596,13 @@ all-gcc:
#
.PHONY: bootstrap bootstrap-lean bootstrap2 bootstrap2-lean bootstrap3 bootstrap3-lean bootstrap4 bootstrap4-lean
bootstrap bootstrap-lean bootstrap2 bootstrap2-lean bootstrap3 bootstrap3-lean bootstrap4 bootstrap4-lean: all-bootstrap
- @r=`pwd`; export r; \
- s=`cd $(srcdir); pwd`; export s; \
+ @r=`${PWD}`; export r; \
+ s=`cd $(srcdir); ${PWD}`; export s; \
$(SET_LIB_PATH) \
echo "Bootstrapping the compiler"; \
cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) $@
- @r=`pwd`; export r; \
- s=`cd $(srcdir); pwd`; export s; \
+ @r=`${PWD}`; export r; \
+ s=`cd $(srcdir); ${PWD}`; export s; \
case "$@" in \
*bootstrap4-lean ) \
msg="Comparing stage3 and stage4 of the compiler"; \
@@ -1611,21 +1617,21 @@ bootstrap bootstrap-lean bootstrap2 bootstrap2-lean bootstrap3 bootstrap3-lean b
$(SET_LIB_PATH) \
echo "$$msg"; \
cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) $$compare
- @r=`pwd`; export r; \
- s=`cd $(srcdir); pwd` ; export s; \
+ @r=`${PWD}`; export r; \
+ s=`cd $(srcdir); ${PWD}` ; export s; \
$(SET_LIB_PATH) \
echo "Building runtime libraries"; \
$(MAKE) $(BASE_FLAGS_TO_PASS) $(RECURSE_FLAGS) all
.PHONY: cross
cross: all-texinfo all-bison all-byacc all-binutils all-gas all-ld
- @r=`pwd`; export r; \
- s=`cd $(srcdir); pwd`; export s; \
+ @r=`${PWD}`; export r; \
+ s=`cd $(srcdir); ${PWD}`; export s; \
$(SET_LIB_PATH) \
echo "Building the C and C++ compiler"; \
cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) LANGUAGES="c c++"
- @r=`pwd`; export r; \
- s=`cd $(srcdir); pwd` ; export s; \
+ @r=`${PWD}`; export r; \
+ s=`cd $(srcdir); ${PWD}` ; export s; \
$(SET_LIB_PATH) \
echo "Building runtime libraries"; \
$(MAKE) $(BASE_FLAGS_TO_PASS) $(RECURSE_FLAGS) \
@@ -1634,8 +1640,8 @@ cross: all-texinfo all-bison all-byacc all-binutils all-gas all-ld
.PHONY: check-gcc
check-gcc:
@if [ -f ./gcc/Makefile ] ; then \
- r=`pwd`; export r; \
- s=`cd $(srcdir); pwd`; export s; \
+ r=`${PWD}`; export r; \
+ s=`cd $(srcdir); ${PWD}`; export s; \
$(SET_LIB_PATH) \
(cd gcc; $(MAKE) $(GCC_FLAGS_TO_PASS) check); \
else \
@@ -1645,8 +1651,8 @@ check-gcc:
.PHONY: check-c++
check-c++:
@if [ -f ./gcc/Makefile ] ; then \
- r=`pwd`; export r; \
- s=`cd $(srcdir); pwd`; export s; \
+ r=`${PWD}`; export r; \
+ s=`cd $(srcdir); ${PWD}`; export s; \
$(SET_LIB_PATH) \
(cd gcc; $(MAKE) $(GCC_FLAGS_TO_PASS) check-c++); \
$(MAKE) check-target-libstdc++-v3; \
@@ -1657,8 +1663,8 @@ check-c++:
.PHONY: install-gcc
install-gcc:
@if [ -f ./gcc/Makefile ] ; then \
- r=`pwd`; export r; \
- s=`cd $(srcdir); pwd`; export s; \
+ r=`${PWD}`; export r; \
+ s=`cd $(srcdir); ${PWD}`; export s; \
$(SET_LIB_PATH) \
(cd gcc; $(MAKE) $(GCC_FLAGS_TO_PASS) install); \
else \
@@ -1668,8 +1674,8 @@ install-gcc:
.PHONY: install-gcc-cross
install-gcc-cross:
@if [ -f ./gcc/Makefile ] ; then \
- r=`pwd`; export r; \
- s=`cd $(srcdir); pwd`; export s; \
+ r=`${PWD}`; export r; \
+ s=`cd $(srcdir); ${PWD}`; export s; \
$(SET_LIB_PATH) \
(cd gcc; $(MAKE) $(GCC_FLAGS_TO_PASS) LANGUAGES="c c++" install); \
else \
@@ -1682,8 +1688,8 @@ install-gcc-cross:
install-dosrel: installdirs info
@dir=`echo $@ | sed -e 's/install-//'`; \
if [ -f ./$${dir}/Makefile ] ; then \
- r=`pwd`; export r; \
- s=`cd $(srcdir); pwd`; export s; \
+ r=`${PWD}`; export r; \
+ s=`cd $(srcdir); ${PWD}`; export s; \
$(SET_LIB_PATH) \
(cd $${dir}; $(MAKE) $(FLAGS_TO_PASS) install); \
else \
@@ -1749,11 +1755,11 @@ all-indent:
all-inet: all-tcl all-send-pr all-perl
all-intl:
all-ispell: all-emacs19
-all-itcl: all-tcl all-tk all-tcl8.1 all-tk8.1
+all-itcl: all-tcl all-tk
all-ld: all-libiberty all-bfd all-opcodes all-bison all-byacc all-flex all-intl
configure-target-libgloss: $(ALL_GCC)
all-target-libgloss: configure-target-libgloss configure-target-newlib
-all-libgui: all-tcl all-tk all-tcl8.1 all-tk8.1 all-itcl
+all-libgui: all-tcl all-tk all-itcl
all-libiberty:
all-build-libiberty: configure-build-libiberty
@@ -1797,15 +1803,13 @@ all-sim: all-libiberty all-bfd all-opcodes all-readline all-cgen
all-snavigator: all-tcl all-tk all-itcl all-tix all-db all-grep all-libgui
all-tar: all-libiberty
all-tcl:
-all-tcl8.1:
all-tclX: all-tcl all-tk
all-tk: all-tcl
-all-tk8.1: all-tcl8.1
all-texinfo: all-libiberty
all-textutils:
all-tgas: all-libiberty all-bfd all-opcodes
all-time:
-all-tix: all-tcl all-tk all-tcl8.1 all-tk8.1
+all-tix: all-tcl all-tk
all-wdiff:
configure-target-winsup: $(ALL_GCC_C)
all-target-winsup: all-target-libiberty all-target-libtermcap configure-target-winsup
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index a837ebec983..1a8b4b0fa22 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,6 +1,940 @@
+2002-06-14 Sergey Grigoriev <serge@leopold.Physik.Uni-Augsburg.DE>
+
+ * pei-i386.c (COFF_SECTION_ALIGNMENT_ENTRIES): Enable 16 byte
+ alignment for .bss, .data and .text sections so that sse and sse2
+ code will work.
+ * pe-i386.c (COFF_SECTION_ALIGNMENT_ENTRIES): Likewise.
+
+2002-06013 J"orn Rennecke <joern.rennecke@superh.com>
+
+ config.bfd: Add support for sh[1234]l*-*-elf* | sh3el*-*-elf*,
+ sh[1234]*-elf*.
+
+2002-06-12 John David Anglin <dave@hiauly1.hia.nrc.ca>
+
+ * elflink.h (elf_bfd_final_link): Improve error handling for missing
+ dynamic sections.
+
+ * elf64-hppa.c (allocate_global_data_opd): We don't need an opd entry
+ for a symbol that has no output section.
+ (allocate_dynrel_entries): Correct comment.
+ (elf64_hppa_finalize_dynreloc): Likewise. Don't create an opd entry
+ unless we want one.
+ (elf64_hppa_finalize_opd): Prevent segfault if dyn_h is NULL.
+ (elf64_hppa_finalize_dlt): Likewise. Prevent segfault for symbols
+ with no section. Remove unnecessary parentheses.
+
+2002-06-11 Tom Rix <trix@redhat.com>
+
+ * coffcode.h (coff_compute_section_file_positions): Add data
+ section to AIX loader alignment check.
+
+ * coff-rs6000.c (_bfd_xcoff_mkobject): Set default text section
+ alignment to 4 bytes.
+ (_bfd_xcoff_copy_private_bfd_data): Use text and data alignment
+ power accessor macro.
+ (do_shared_object_padding): Remove invalid assertion.
+
+2002-06-10 Richard Sandiford <rsandifo@redhat.com>
+
+ * section.c (_bfd_strip_section_from_output): Set SEC_EXCLUDE
+ for removed output sections.
+
+2002-06-10 Geoffrey Keating <geoffk@redhat.com>
+
+ * merge.c (merge_strings): Use htab_create_alloc with calloc, not
+ htab_alloc.
+ * elf-strtab.c (_bfd_elf_strtab_finalize): Likewise.
+
+2002-06-08 H.J. Lu <hjl@gnu.org>
+
+ * elf.c (copy_private_bfd_data): Don't cast to bfd_size_type to
+ work around a long long bug in gcc 2.96 on mips.
+
+2002-06-08 Jason Thorpe <thorpej@wasabisystems.com>
+
+ * Makefile.am (BFD32_BACKENDS): Add vax1knetbsd.lo.
+ (BFD32_BACKENDS_CFILES): Add vax1knetbsd.c.
+ Regenerate dependency lists.
+ * Makefile.in: Regenerate.
+ * config.bfd (vax-*-netbsdelf*, vax-*-netbsdaout*): Add
+ vax1knetbsd_vec to targ_selvecs.
+ * configure.in: Add vax1knetbsd_vec.
+ * configure: Regenerate.
+ * targets.c (_bfd_target_vector): Add vax1knetbsd_vec.
+ * vax1knetbsd.c: New file.
+ * vaxnetbsd.c: Update copyright years.
+ (TARGET_PAGE_SIZE): Set to 0x1000.
+ (DEFAULT_MID): Set to M_VAX4K_NETBSD.
+
+2002-06-08 Matt Thomas <matt@3am-software.com>
+
+ * libaout.h (enum machine_type): Add M_VAX4K_NETBSD.
+
+2002-06-08 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-sh64.c (sh64_elf64_link_output_symbol_hook): Make static.
+
+2002-06-08 Alan Modra <amodra@bigpond.net.au>
+
+ * Makefile.am: Run "make dep-am".
+ * Makefile.in: Regenerate.
+
+ * armnetbsd.c: Replace CONST with const.
+ * corefile.c: Likewise.
+ * elf32-dlx.c: Likewise.
+ * elf64-mips.c: Likewise.
+ * mmo.c: Likewise.
+ * ns32knetbsd.c: Likewise.
+
+ * elf64-sparc.c (sparc64_elf_add_symbol_hook): Check the hash
+ table is elf64-sparc.
+
+2002-06-08 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
+
+ * elfxx-mips.c (_bfd_mips_elf_relocate_section): Simplify code.
+ Fix RELA addends to get not shifted in the result. Don't do special
+ handling of R_MIPS_64 for NewABI.
+
+2002-06-07 Alan Modra <amodra@bigpond.net.au>
+
+ * aoutx.h (NAME(aout,slurp_symbol_table)): Use bfd_zmalloc.
+ (NAME(aout,slurp_reloc_table)): Likewise.
+ * coff-mips.c (mips_relax_section): Use bfd_zalloc.
+ * coff-rs6000.c (xcoff_write_armap_big): Use bfd_zmalloc.
+ (xcoff_write_archive_contents_big): Likewise.
+ (xcoff_generate_rtinit): Likewise.
+ (xcoff_generate_rtinit): Likewise, and check error return.
+ * coff64-rs6000.c (xcoff64_generate_rtinit): Likewise.
+ * coffgen.c (coff_section_symbol): Use bfd_zalloc.
+ (coff_get_normalized_symtab): Likewise.
+ (coff_make_empty_symbol): Likewise.
+ (bfd_coff_set_symbol_class): Likewise.
+ * cofflink.c (coff_link_add_symbols): Likewise.
+ * ecoff.c (_bfd_ecoff_make_empty_symbol): Likewise.
+ * ecofflink.c (ecoff_write_shuffle): Use bfd_zmalloc.
+ (bfd_ecoff_write_accumulated_debug): Likewise.
+ * elf64-alpha.c (get_got_entry): Use bfd_zalloc.
+ * i386linux.c (bfd_i386linux_size_dynamic_sections): Likewise.
+ * i386lynx.c (NAME(lynx,slurp_reloc_table)): Use bfd_zmalloc.
+ * ieee.c (do_with_relocs): Use bfd_zalloc.
+ * m68klinux.c (bfd_m68klinux_size_dynamic_sections): Likewise.
+ * pdp11.c (NAME(aout,slurp_symbol_table)): Use bfd_zmalloc.
+ (NAME(aout,slurp_reloc_table)): Likewise.
+ (NAME(aout,squirt_out_relocs)): Don't memset when zalloc'd.
+ * reloc16.c (bfd_coff_reloc16_relax_section): Use bfd_zmalloc.
+ * som.c (som_build_and_write_symbol_table): Likewise.
+ (som_slurp_string_table): Likewise.
+ (som_slurp_symbol_table): Likewise.
+ (som_bfd_ar_write_symbol_stuff): Likewise.
+ * sparclinux.c (bfd_sparclinux_size_dynamic_sections): Use bfd_zalloc.
+ * sunos.c (bfd_sunos_size_dynamic_sections): Likewise.
+ * tekhex.c (find_chunk): Likewise. Get rid of unused "sname".
+ * vms-gsd.c (_bfd_vms_slurp_gsd): Use bfd_zmalloc.
+ * xcofflink.c (xcoff_link_add_symbols): Use bfd_zalloc/bfd_zmalloc.
+
+2002-06-07 Alan Modra <amodra@bigpond.net.au>
+
+ * elf-bfd.h (struct bfd_elf_section_data <group_name>): Replace with
+ "group" union.
+ (elf_group_name): Update.
+ (elf_group_id): Define.
+ (bfd_elf_set_group_contents): Declare.
+ * elf.c (elf_fake_sections): Qualify use of elf_group_name.
+ (set_group_contents): Rename to bfd_elf_set_group_contents. Remove
+ ATTRIBUTE_UNUSED from failedptrarg. If elf_group_id is set, use
+ that sym for the signature.
+ (_bfd_elf_compute_section_file_positions): Don't call
+ set_group_contents for "ld -r" case.
+ (swap_out_syms): Use bfd_zalloc.
+ * elflink.h (elf_link_add_archive_symbols): Likewise.
+ (NAME(bfd_elf,size_dynamic_sections)): Likewise.
+ (elf_bfd_final_link): Call bfd_elf_set_group_contents.
+
+2002-06-07 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (ppc64_elf_relocate_section): Allow unresolved
+ relocs in opd for non-shared too.
+
+2002-06-06 Jeffrey Law <law@redhat.com
+
+ * elf32-h8300.c (elf32_h8_relax_section): Ignore uninteresting
+ relocations.
+
+2002-06-06 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * merge.c: Include libiberty.h.
+ * elf-strtab.c: Include libiberty.h.
+
+2002-06-06 Elias Athanasopoulos <eathan@otenet.gr>
+
+ * peXXigen.c (pe_print_idata): Remove unused variable.
+
+2002-06-06 David Heine <dlheine@tensilica.com>
+
+ * elf.c (assign_file_positions_for_segments): Remove unallocated
+ sections from the section to segment mapping for PT_LOAD segments.
+ Update comment about empty loadable segments.
+
+2002-06-06 Richard Sandiford <rsandifo@redhat.com>
+
+ * stabs.c (_bfd_link_section_stabs): Check that the symbol offset
+ is within the .stabstr section.
+
+2002-06-06 Alan Modra <amodra@bigpond.net.au>
+
+ * elf-bfd.h (struct elf_size_info <swap_symbol_in>): Function args
+ are "const PTR", not "const PTR *".
+ (bfd_elf32_swap_symbol_in): Likewise.
+ (bfd_elf64_swap_symbol_in): Likewise.
+ * elfcode.h (elf_swap_symbol_in): Change input args to const PTR.
+ (elf_slurp_symbol_table): Adjust call to elf_swap_symbol_in.
+ * elflink.h (elf_link_is_defined_archive_symbol): Likewise.
+ (elf_link_add_object_symbols): Likewise.
+ (elf_link_record_local_dynamic_symbol): Likewise.
+ (elf_link_input_bfd): Likewise.
+ (elf_gc_mark): Likewise.
+ (elf_reloc_symbol_deleted_p): Likewise.
+ * elf-m10200.c (mn10200_elf_relax_section): Likewise.
+ (mn10200_elf_relax_delete_bytes): Likewise.
+ (mn10200_elf_symbol_address_p): Likewise.
+ (mn10200_elf_get_relocated_section_contents): Likewise.
+ * elf-m10300.c (mn10300_elf_relax_section): Likewise.
+ (mn10300_elf_relax_section): Likewise.
+ (mn10300_elf_relax_delete_bytes): Likewise.
+ (mn10300_elf_symbol_address_p): Likewise.
+ (mn10300_elf_get_relocated_section_contents): Likewise.
+ * elf32-h8300.c (elf32_h8_relax_section): Likewise.
+ (elf32_h8_relax_delete_bytes): Likewise.
+ (elf32_h8_symbol_address_p): Likewise.
+ (elf32_h8_get_relocated_section_contents): Likewise.
+ * elf32-hppa.c (get_local_syms): Likewise.
+ * elf32-m68k.c (bfd_m68k_elf32_create_embedded_relocs): Likewise.
+ * elf32-mips.c (bfd_mips_elf32_create_embedded_relocs): Likewise.
+ * elf32-sh.c (sh_elf_relax_section): Likewise.
+ (sh_elf_relax_delete_bytes): Likewise.
+ (sh_elf_get_relocated_section_contents): Likewise.
+ * elf32-xstormy16.c (xstormy16_elf_relax_section): Likewise.
+ * elf64-alpha.c (elf64_alpha_relax_section): Likewise.
+ * elf64-hppa.c (elf64_hppa_check_relocs): Likewise.
+ * elf64-mmix.c (mmix_elf_relax_section): Likewise.
+ * elf64-ppc.c (get_local_syms): Likewise.
+ * elf64-sh64.c (sh_elf64_get_relocated_section_contents): Likewise.
+ * elfxx-ia64.c (elfNN_ia64_relax_section): Likewise.
+
+2002-06-05 J"orn Rennecke <joern.rennecke@superh.com>
+
+ * config.bfd (sh64l*-*-elf*, shl*-*-elf*): New configurations.
+
+2002-06-05 Alan Modra <amodra@bigpond.net.au>
+
+ * elf.c (group_signature): Swap in the whole symbol, and handle
+ extracting section symbol names.
+ (setup_group): Add comment.
+ (set_group_contents): When called from objcopy or ld, arrange for
+ section contents to be written. Write group member output section
+ indices to allow objcopy to reorganize sections.
+ (_bfd_elf_copy_private_section_data): Copy group info.
+
+ * elf-bfd.h (struct elf_size_info): Add swap_symbol_in field.
+ (bfd_elf32_swap_symbol_in): Update prototype.
+ (bfd_elf64_swap_symbol_in): Likewise.
+ * elfcode.h (elf_swap_symbol_in): Change input args to const PTR *.
+ (elf_slurp_symbol_table): Adjust call to elf_swap_symbol_in.
+ * elflink.h (elf_link_is_defined_archive_symbol): Likewise.
+ (elf_link_add_object_symbols): Likewise.
+ (elf_link_record_local_dynamic_symbol): Likewise.
+ (elf_link_input_bfd): Likewise.
+ (elf_gc_mark): Likewise.
+ (elf_reloc_symbol_deleted_p): Likewise.
+ * elf-m10200.c (mn10200_elf_relax_section): Likewise.
+ (mn10200_elf_relax_delete_bytes): Likewise.
+ (mn10200_elf_symbol_address_p): Likewise.
+ (mn10200_elf_get_relocated_section_contents): Likewise.
+ * elf-m10300.c (mn10300_elf_relax_section): Likewise.
+ (mn10300_elf_relax_section): Likewise.
+ (mn10300_elf_relax_delete_bytes): Likewise.
+ (mn10300_elf_symbol_address_p): Likewise.
+ (mn10300_elf_get_relocated_section_contents): Likewise.
+ * elf32-h8300.c (elf32_h8_relax_section): Likewise.
+ (elf32_h8_relax_delete_bytes): Likewise.
+ (elf32_h8_symbol_address_p): Likewise.
+ (elf32_h8_get_relocated_section_contents): Likewise.
+ * elf32-hppa.c (get_local_syms): Likewise.
+ * elf32-m68k.c (bfd_m68k_elf32_create_embedded_relocs): Likewise.
+ * elf32-mips.c (bfd_mips_elf32_create_embedded_relocs): Likewise.
+ * elf32-sh.c (sh_elf_relax_section): Likewise.
+ (sh_elf_relax_delete_bytes): Likewise.
+ (sh_elf_get_relocated_section_contents): Likewise.
+ * elf32-xstormy16.c (xstormy16_elf_relax_section): Likewise.
+ * elf64-alpha.c (elf64_alpha_relax_section): Likewise.
+ * elf64-hppa.c (elf64_hppa_check_relocs): Likewise.
+ * elf64-mmix.c (mmix_elf_relax_section): Likewise.
+ * elf64-ppc.c (get_local_syms): Likewise.
+ * elf64-sh64.c (sh_elf64_get_relocated_section_contents): Likewise.
+ * elfxx-ia64.c (elfNN_ia64_relax_section): Likewise.
+ * elfcode.h (NAME(_bfd_elf,size_info)): Update initialiser.
+ * elf64-alpha.c (alpha_elf_size_info): Likewise.
+ * elf64-hppa.c (hppa64_elf_size_info): Likewise.
+ * elf64-mips.c (mips_elf64_size_info): Likewise.
+ * elf64-s390.c (s390_elf64_size_info): Likewise.
+ * elf64-sparc.c (sparc64_elf_size_info): Likewise.
+
+2002-06-05 Maciej W. Rozycki <macro@ds2.pg.gda.pl>
+
+ * elf32-mips.c (elf32_mips_ignore_discarded_relocs): Move to...
+ elfxx-mips.c (_bfd_mips_elf_ignore_discarded_relocs): ... here.
+ elf64-mips.c (elf_backend_ignore_discarded_relocs): Use
+ _bfd_mips_elf_ignore_discarded_relocs.
+ elfxx-mips.h (_bfd_mips_elf_ignore_discarded_relocs): Declare.
+
+2002-06-05 H.J. Lu <hjl@gnu.org>
+
+ * elfxx-mips.c (mips_elf_calculate_relocation): Call
+ _bfd_elf_rel_local_sym for STT_SECTION relocations against
+ the SEC_MERGE section.
+
+2002-06-05 Alan Modra <amodra@bigpond.net.au>
+
+ * coff-alpha.c: Update copyright date.
+ * coff-mips.c: Likewise.
+ * xcoff-target.h: Likewise.
+
+ * bfd-in.h: Remove "taken from the source" comment.
+ * libbfd-in.h: Likewise.
+ * libcoff-in.h: Likewise.
+ * bfd-in2.h: Regenerate.
+ * libbfd.h: Regenerate.
+ * libcoff.h: Regenerate.
+
+ * elf.c (bfd_elf_discard_group): Return true.
+ * elf-bfd.h (bfd_elf_discard_group): Declare.
+ * bfd-in.h (bfd_elf_discard_group): Don't declare here.
+ * section.c (bfd_discard_group): Rename to bfd_generic_discard_group.
+ * bfd.c (bfd_discard_group): Define.
+ * targets.c (struct bfd_target): Add _bfd_discard_group.
+ (BFD_JUMP_TABLE_LINK): Here too.
+ * libbfd-in.h (_bfd_nolink_bfd_discard_group): Define.
+ * aout-adobe.c (aout_32_bfd_discard_group): Define.
+ * aout-target.h (MY_bfd_discard_group): Define.
+ * aout-tic30.c (MY_bfd_discard_group): Define.
+ * binary.c (binary_bfd_discard_group): Define.
+ * bout.c (b_out_bfd_discard_group): Define.
+ * coff-alpha.c (_bfd_ecoff_bfd_discard_group): Define.
+ * coffcode.h (coff_bfd_discard_group): Define.
+ * coff-mips.c (_bfd_ecoff_bfd_discard_group): Define.
+ * elfxx-target.h (bfd_elfNN_bfd_discard_group): Define.
+ * i386msdos.c (msdos_bfd_discard_group): Define.
+ * i386os9k.c (os9k_bfd_discard_group): Define.
+ * ieee.c (ieee_bfd_discard_group): Define.
+ * ihex.c (ihex_bfd_discard_group): Define.
+ * mmo.c (mmo_bfd_discard_group): Define.
+ * nlm-target.h (nlm_bfd_discard_group): Define.
+ * oasys.c (oasys_bfd_discard_group): Define.
+ * ppcboot.c (ppcboot_bfd_discard_group): Define.
+ * som.c (som_bfd_discard_group): Define.
+ * srec.c (srec_bfd_discard_group): Define.
+ * tekhex.c (tekhex_bfd_discard_group): Define.
+ * versados.c (versados_bfd_discard_group): Define.
+ * vms.c (vms_bfd_discard_group): Define.
+ * xcoff-target.h (_bfd_xcoff_bfd_discard_group): Define.
+ * coff64-rs6000.c (rs6000coff64_vec): Update initialiser.
+ (aix5coff64_vec): Likewise.
+ * coff-rs6000.c (rs6000coff_vec, pmac_xcoff_vec): Likewise.
+
+2002-06-04 Jason Thorpe <thorpej@wasabisystems.com>
+
+ * Makefile.am (BFD32_BACKENDS): Add elf32-sh64-com.lo.
+ (BFD32_BACKENDS_CFILES): Add elf32-sh64-com.c.
+ (elf32-sh64-com.lo): New dependency list.
+ * Makefile.in: Regenerate.
+ * configure.in (bfd_elf32_sh64_vec, bfd_elf32_sh64l_vec)
+ (bfd_elf32_sh64nbsd_vec, bfd_elf32_sh64lnbsd_vec): Add
+ elf32-sh64-com.lo.
+ * configure: Regenerate.
+ * elf32-sh64.c (sh64_address_in_cranges)
+ (sh64_get_contents_type, sh64_address_is_shmedia): Move to...
+ (crange_qsort_cmpb, crange_qsort_cmpl, crange_bsearch_cmpb):
+ (crange_bsearch_cmpl): Prepend _bfd_sh64_ to name and move to...
+ * elf32-sh64-com.c: ...here. New file.
+
+2002-06-04 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-openrisc.c (openrisc_elf_gc_mark_hook): Remove
+ ATTRIBUTE_UNUSED on used params.
+ * elf32-vax.c (elf_vax_gc_mark_hook): Remove unnecessary checks
+ before calling bfd_section_from_elf_index on local syms.
+ * elf64-sh64.c (sh_elf64_gc_mark_hook): Likewise.
+
+2002-06-04 Jason Thorpe <thorpej@wasabisystems.com>
+
+ * Makefile.am (BFD32_BACKENDS): Add elf32-sh64-nbsd.lo.
+ (BFD32_BACKENDS_CFILES): Add elf32-sh64-nbsd.c.
+ (BFD64_BACKENDS): Add elf64-sh64-nbsd.lo.
+ (BFD64_BACKENDS_CFILES): Add elf64-sh64-nbsd.c.
+ (elf32-sh64-nbsd.lo, elf64-sh64-nbsd.lo): New rules.
+ * Makefile.in: Regenerate.
+ * config.bfd (sh5le-*-netbsd*, sh5-*-netbsd*, sh64le-*-netbsd*)
+ (sh64-*-netbsd*): New targets.
+ * configure.in: Add bfd_elf32_sh64nbsd_vec, bfd_elf32_sh64lnbsd_vec,
+ bfd_elf64_sh64nbsd_vec, and bfd_elf64_sh64lnbsd_vec.
+ * configure: Regenerate.
+ * elf32-sh64-nbsd.c: New file.
+ * elf64-sh64-nbsd.c: New file.
+ * targets.c: Add extern decls for bfd_elf32_sh64nbsd_vec,
+ bfd_elf32_sh64lnbsd_vec, bfd_elf64_sh64nbsd_vec, and
+ bfd_elf64_sh64lnbsd_vec.
+
+2002-06-04 Alan Modra <amodra@bigpond.net.au>
+
+ * elf.c (setup_group): Set SEC_LINK_ONCE on GRP_COMDAT groups.
+ (bfd_section_from_shdr): Likewise. Set section name of group
+ sections from signature.
+ (group_signature): Split out from setup_group. Ensure symbol table
+ is available.
+ (bfd_elf_discard_group): New function.
+ (_bfd_elf_make_section_from_shdr): Don't set SEC_LINK_ONCE on
+ .gnu.linkonce* sections if they are members of a group.
+ (set_group_contents): Set GRP_COMDAT flag.
+ * section.c (bfd_discard_group): New function.
+ * bfd-in.h (bfd_elf_discard_group): Declare.
+ * bfd-in2.h: Regenerate.
+ * elf-bfd.h (struct bfd_elf_section_data): Add linkonce_p field.
+ (elf_linkonce_p): Define.
+
+2002-06-04 Alan Modra <amodra@bigpond.net.au>
+
+ * elf.c (bfd_section_from_shdr): Make "name" const.
+ * elf-bfd.h (elf_backend_section_from_shdr): Likewise.
+ * elf32-i370.c (i370_elf_section_from_shdr): Likewise.
+ * elf32-ppc.c (ppc_elf_section_from_shdr): Likewise.
+ * elf32-sh64.c (sh64_backend_section_from_shdr): Likewise.
+ * elf32-v850.c (v850_elf_section_from_shdr): Likewise.
+ * elf64-alpha.c (elf64_alpha_section_from_shdr): Likewise.
+ * elf64-hppa.c (elf64_hppa_section_from_shdr): Likewise.
+ * elf64-ppc.c (ppc64_elf_section_from_shdr): Likewise.
+ * elfxx-ia64.c (elfNN_ia64_section_from_shdr): Likewise.
+ * elfxx-mips.c (_bfd_mips_elf_section_from_shdr): Likewise.
+ * elfxx-mips.h (_bfd_mips_elf_section_from_shdr): Likewise.
+
+2002-06-03 Maciej W. Rozycki <macro@ds2.pg.gda.pl>
+
+ * elfxx-mips.c (ABI_64_P): Use backend's data to determine the
+ ABI.
+
+2002-06-02 Kazu Hirata <kazu@cs.umass.edu>
+
+ * elf32-arc.c: Fix formatting.
+ * elf32-arm.h: Likewise.
+ * elf32-cris.c: Likewise.
+ * elf32-dlx.c: Likewise.
+ * elf32-hppa.c: Likewise.
+ * elf32-i386.c: Likewise.
+ * elf32-i386qnx.c: Likewise.
+ * elf32-or32.c: Likewise.
+ * elf32-s390.c: Likewise.
+ * elf32-sh64.c: Likewise.
+ * elf32-vax.c: Likewise.
+ * elf32-xstormy16.c: Likewise.
+ * elf64-alpha.c: Likewise.
+ * elf64-mmix.c: Likewise.
+ * elf64-ppc.c: Likewise.
+ * elf64-s390.c: Likewise.
+ * elf64-sh64.c: Likewise.
+ * elf64-x86-64.c: Likewise.
+
+2002-06-02 Richard Henderson <rth@redhat.com>
+
+ * elf64-alpha.c (elf64_alpha_relocate_section): Don't dereference
+ null when there are no got entries for a symbol.
+ (elf64_alpha_relax_find_tls_segment): Rearrange to avoid
+ uninitialized variable warning.
+
+2002-06-01 Richard Henderson <rth@redhat.com>
+
+ * elf64-alpha.c (elf64_alpha_relax_with_lituse): Don't test for
+ undefined symbols here.
+ (elf64_alpha_relax_section): Do it here. Also test for not
+ defined in the current module.
+ (elf64_alpha_relocate_section_r): Split out of ...
+ (elf64_alpha_relocate_section): ... here. Don't dereference
+ NULL when looking up local got entries.
+
+2002-06-01 Richard Henderson <rth@redhat.com>
+
+ * elf64-alpha.c (elf64_alpha_relax_with_lituse): Reject undefined
+ symbols from JSR relaxation.
+ (elf64_alpha_size_plt_section_1): New.
+ (elf64_alpha_calc_dynrel_sizes): Split out .rela.got bits ...
+ (elf64_alpha_size_rela_got_1): ... here.
+ (elf64_alpha_size_dynamic_sections): Split out .rela.got bits ...
+ (elf64_alpha_size_rela_got_section): ... here.
+ (elf64_alpha_size_plt_section): New.
+ (elf64_alpha_relax_section): Call them.
+ (elf64_alpha_size_got_sections): Remove output_bfd arg.
+ (elf64_alpha_finish_dynamic_symbol): Check gotent use_count.
+
+2002-06-01 Richard Henderson <rth@redhat.com>
+
+ * elf64-alpha.c (alpha_get_dtprel_base, alpha_get_tprel_base): New.
+ (elf64_alpha_relocate_section): Use them. Reject LE TLS relocs
+ in shared libraries. Fix DTPRELHI and TPRELHI value.
+ (INSN_ADDQ, INSN_RDUNIQ): New.
+ (struct alpha_relax_info): Add symtab_hdr, tls_segment, first_gotent.
+ (elf64_alpha_relax_with_lituse): Return boolean. Remove irelend
+ argument. Reject dynamic symbols. Use LITUSE symbolic constants.
+ (elf64_alpha_relax_got_load): Rename from relax_without_lituse.
+ Handle GOTDTPREL and GOTTPREL relocations.
+ (elf64_alpha_relax_gprelhilo): New.
+ (elf64_alpha_relax_tls_get_addr): New.
+ (elf64_alpha_relax_find_tls_segment): New.
+ (elf64_alpha_relax_section): Handle TLS relocations.
+ (ALPHA_ELF_LINK_HASH_TLS_IE): New.
+ (elf64_alpha_check_relocs): Set it.
+
+2002-06-01 Richard Henderson <rth@redhat.com>
+
+ * elf64-alpha.c (elf64_alpha_relax_section): Don't store computed gp.
+
+ * elf64-alpha.c (elf64_alpha_check_relocs): Fix typo on maybe_dynamic
+ check; don't suppress dynamic relocs for non-allocated sections.
+
+ * elf64-alpha.c: Remove dead code.
+
+2002-05-31 Alan Modra <amodra@bigpond.net.au>
+
+ * bfd-in2.h: Regenerate.
+ * libbfd.h: Regenerate.
+ * po/SRC-POTFILES.in: Regenerate.
+
+ * elf64-ppc.c (ppc64_elf_size_dynamic_sections): Don't allocate
+ space for bss .plt.
+
+2002-05-31 Graeme Peterson <gp@qnx.com>
+
+ * Makefile.am (BFD32_BACKENDS): Add elf32-i386qnx.lo.
+ (BFD32_BACKENDS_CFILES): Add elf32-i386qnx.c.
+ Run "make dep-am".
+ * Makefile.in: Regenerate.
+ * config.bfd: Add i[3456]86-*-nto-qnx* support.
+ * configure.in: Add bfd_elf32_i386qnx_vec support.
+ * configure: Regenerate.
+ * elf-bfd.h (struct elf_backend_data): Add set_nonloadable_filepos,
+ is_contained_by_filepos, and copy_private_bfd_data_p.
+ * elf.c (assign_file_positions_for_segments): Call backend
+ set_nonloadable_filepos. Fix non-K&R call to _bfd_error_handler.
+ (IS_CONTAINED_BY_FILEPOS): Define.
+ (INCLUDE_SECTION_IN_SEGMENT): Also test IS_CONTAINED_BY_FILEPOS.
+ (copy_private_bfd_data): Use IS_CONTAINED_BY_FILEPOS. Typo fix.
+ Fix non-K&R call to _bfd_error_handler.
+ (_bfd_elf_copy_private_section_data): Use backend
+ copy_private_bfd_data_p.
+ * elf32-i386.c: Don't include elfxx-target.h when
+ ELF32_I386_C_INCLUDED is defined.
+ * elf32-i386qnx.c: New QNX elf backend file.
+ * elfxx-target.h: Add elf_backend_set_nonloadable_filepos,
+ elf_backend_is_contained_by_filepos, and
+ elf_backend_do_copy_private_bfd_data.
+ * targets.c: Add bfd_target bfd_elf32_i386qnx_vec.
+
+2002-05-31 Alan Modra <amodra@bigpond.net.au>
+
+ * elfarm-oabi.c (bfd_elf32_arm_add_glue_sections_to_bfd): Define.
+ Move other similar defines to start of file.
+
+2002-05-30 Tom Rix <trix@redhat.com>
+
+ * coff-rs6000.c (xcoff_rtype2howto): Handle 16 bit R_RBA.
+ * coff64-rs6000.c (xcoff64_rtype2howto): Same.
+
+2002-05-30 Richard Henderson <rth@redhat.com>
+
+ * elf64-alpha.c (ALPHA_ELF_LINK_HASH_LU_TLSGD,
+ ALPHA_ELF_LINK_HASH_LU_TLSLDM, ALPHA_ELF_LINK_HASH_LU_FUNC): New.
+ (ALPHA_ELF_GOT_ENTRY_RELOCS_DONE): Remove.
+ (ALPHA_ELF_GOT_ENTRY_RELOCS_XLATED): Remove.
+ (struct alpha_elf_got_entry): Add reloc_type, reloc_done, reloc_xlated.
+ (struct alpha_elf_obj_tdata): Rename total_got_entries and
+ n_local_got_entries to total_got_size and local_got_size.
+ (elf64_alpha_howto, elf64_alpha_reloc_map): Update for TLS relocs.
+ (alpha_got_entry_size): New.
+ (elf64_alpha_relax_with_lituse): Use it.
+ (elf64_alpha_relax_without_lituse): Likewise.
+ (MAX_GOT_SIZE): Rename from MAX_GOT_ENTRIES.
+ (get_got_entry): New.
+ (elf64_alpha_check_relocs): Handle TLS relocs. Reorganize.
+ (elf64_alpha_adjust_dynamic_symbol): Test LU_FUNC as a mask.
+ (elf64_alpha_merge_ind_symbols): Check gotent->reloc_type.
+ (elf64_alpha_can_merge_gots, elf64_alpha_merge_gots): Likewise.
+ (elf64_alpha_calc_got_offsets_for_symbol): Use alpha_got_entry_size.
+ (elf64_alpha_calc_got_offsets): Likewise.
+ (alpha_dynamic_entries_for_reloc): New.
+ (elf64_alpha_calc_dynrel_sizes): Use it.
+ (elf64_alpha_size_dynamic_sections): Likewise.
+ (elf64_alpha_relocate_section): Handle TLS relocations.
+ * reloc.c: Add Alpha TLS relocations.
+ * bfd-in2.h, libbfd.h: Rebuild.
+
+2002-05-29 Ralf Habacker <ralf.habacker@freenet.de>
+
+ * peXXigen.c (pe_print_idata): Remove double printed
+ import table lines; add Bound-To comment.
+
+2002-05-29 Matt Thomas <matt@3am-software.com>
+
+ * Makefile.am (BFD32_BACKENDS): Add elf32-vax.lo.
+ (BFD32_BACKENDS_CFILES): Add elf32-vax.c.
+ (elf32-vax.lo): New rule.
+ * Makefile.in: Regenerate.
+ * configure.in (bfd_elf32_vax_vec)
+ (vaxnetbsd_vec): New vectors.
+ * configure: Regenerate.
+ * config.bfd (vax-*-netbsdelf*)
+ (vax-*-netbsdaout*)
+ (vax-*-netbsd*): New targets.
+ * elf32-vax.c: New file.
+ * reloc.c: Add VAX relocations.
+ * bfd-in2.h: Regenerate.
+ * targets.c (_bfd_target_vector): Add bfd_elf32_vax_vec.
+
+2002-05-29 Jason Thorpe <thorpej@wasabisystems.com>
+
+ * config.bfd (arm-*-netbsd*): Add bfd_elf32_littlearm_vec
+ and bfd_elf32_bigarm_vec to targ_selvecs.
+
+2002-05-29 Ralf Habacker <ralf.habacker@freenet.de>
+
+ * peXXigen.c (pe_print_idata): Fix seg faults on printing import tables
+ with auto-imported symbols.
+
+2002-05-29 Adam Nemet <anemet@lnxw.com>
+
+ * elf32-arm.h (bfd_elf32_arm_get_bfd_for_interworking): Don't add glue
+ sections only record bfd.
+ (bfd_elf32_arm_add_glue_sections_to_bfd): New function.
+ * bfd-in.h (bfd_elf32_arm_add_glue_sections_to_bfd): Declare it.
+ * bfd-in2.h: Regenerate.
+
+2002-05-28 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * syms.c (_bfd_stab_section_find_nearest_line): Move
+ declaration and initialisation of saw_line and saw_func out of
+ for loop.
+
+2002-05-29 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (ppc64_elf_get_symbol_info): New function.
+ (bfd_elf64_get_symbol_info): Define.
+ * elfxx-target.h (bfd_elfNN_get_symbol_info): Only define if undef.
+
+2002-05-29 Andrey Volkov <avolkov@transas.com>
+
+ * cpu-h8300.c: Make default h8300 machine first in machine list.
+
+2002-05-28 Kuang Hwa Lin <kuang@sbcglobal.net>
+
+ * config.bfd: Added DLX configuraton.
+ * Makefile.am: Added DLX configuraton.
+ * configure.in: Added DLX configuraton.
+ * archures.c: Add DLX architecure.
+ * reloc.c: Add DLX relocs.
+ * targets.c: Added DLX target vector.
+ * configure: Regenerate.
+ * Makefile.in: Regenreate.
+ * bfd-in2.h: Regenreate.
+ * elf32-dlx.c: New file: Support DLX target.
+ * cpu-dlx.c: New file: Support DLX target.
+
+2002-05-25 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-m68k.c (elf32_m68k_print_private_bfd_data): Formatting.
+
+ * elf64-ppc.c (ppc64_elf_copy_indirect_symbol): Revert last change.
+ (ppc64_elf_check_relocs): Don't set up function descriptor symbol
+ strings to point inside function code sym string.
+ (func_desc_adjust): Likewise.
+ (ppc64_elf_hide_symbol): Rewrite code to look up function code sym.
+
+2002-05-24 Michal Ludvig <mludvig@suse.cz>
+
+ * elf64-x86-64.c (elf64_x86_64_grok_prstatus): Added.
+ (elf64_x86_64_grok_psinfo): Added.
+
+2002-05-24 TAMURA Kent <kent@netbsd.org>
+
+ * config.bfd: Add a target for i386-netbsdpe.
+
+2002-05-24 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (ppc64_elf_copy_indirect_symbol): Don't copy is_func
+ and is_func_descriptor.
+ (func_desc_adjust): Hide function code sym in shared libs unless
+ there is a matching exported function descriptor sym.
+
+2002-05-23 Jakub Jelinek <jakub@redhat.com>
+
+ * elf.c (_bfd_elf_make_section_from_shdr): Set SEC_THREAD_LOCAL
+ for symbols from SHF_TLS section.
+ (_bfd_elf_print_private_bfd_data): Add PT_TLS.
+ (elf_fake_sections): Set SHF_TLS for SEC_THREAD_LOCAL sections.
+ (map_sections_to_segments): Build PT_TLS segment if necessary.
+ (assign_file_positions_for_segments): Likewise.
+ (get_program_header_size): Account for PT_TLS segment.
+ (swap_out_syms): Set type of BSF_THREAD_LOCAL symbols and symbols from
+ SEC_THREAD_LOCAL sections to STT_TLS.
+ * reloc.c: Add 386 and IA-64 TLS relocs.
+ * section.c (SEC_THREAD_LOCAL): Define.
+ (SEC_CONSTRUCTOR_TEXT, SEC_CONSTRUCTOR_DATA, SEC_CONSTRUCTOR_BSS):
+ Remove.
+ * elflink.h (elf_link_add_object_symbols): Support .tcommon.
+ (size_dynamic_sections): If DF_STATIC_TLS, set DF_FLAGS
+ unconditionally.
+ (struct elf_final_link_info): Add first_tls_sec.
+ (elf_bfd_final_link): Set first_tls_sec.
+ Compute elf_hash_table (info)->tls_segment.
+ (elf_link_output_extsym): Handle STT_TLS symbols.
+ (elf_link_input_bfd): Likewise.
+ * syms.c (BSF_THREAD_LOCAL): Define.
+ * bfd-in2.h: Rebuilt.
+ * libbfd.h: Rebuilt.
+ * elf32-i386.c (elf_i386_tls_transition, dtpoff_base, tpoff,
+ elf_i386_mkobject, elf_i386_object_p): New functions.
+ (elf_howto_table): Add TLS relocs.
+ (elf_i386_reloc_type_lookup): Support TLS relocs.
+ (elf_i386_info_to_howto_rel): Likewise.
+ (struct elf_i386_link_hash_entry): Add tls_type.
+ (struct elf_i386_obj_tdata): New.
+ (elf_i386_hash_entry, elf_i386_tdata, elf_i386_local_got_tls_type):
+ New macros.
+ (struct elf_i386_link_hash_table): Add tls_ldm_got.
+ (link_hash_newfunc): Clear tls_type.
+ (elf_i386_check_relocs): Support TLS relocs.
+ (elf_i386_gc_sweep_hook): Likewise.
+ (allocate_dynrelocs): Likewise.
+ (elf_i386_size_dynamic_sections): Likewise.
+ (elf_i386_relocate_section): Likewise.
+ (elf_i386_finish_dynamic_symbol): Likewise.
+ (bfd_elf32_mkobject, elf_backend_object_p): Define.
+ * elfxx-ia64.c (struct elfNN_ia64_dyn_sym_info): Add tprel_offset,
+ dtpmod_offset, dtprel_offset, tprel_done, dtpmod_done, dtprel_done,
+ want_tprel, want_dtpmod, want_dtprel.
+ (elfNN_ia64_tprel_base, elfNN_ia64_dtprel_base): New functions.
+ (ia64_howto_table): Add TLS relocs, rename R_IA64_LTOFF_TP22 to
+ R_IA64_LTOFF_TPREL22.
+ (elf_code_to_howto_index): Add TLS relocs.
+ (elfNN_ia64_check_relocs): Support TLS relocs.
+ (allocate_global_data_got): Account for TLS .got data.
+ (allocate_dynrel_entries): Account for TLS dynamic relocations.
+ (elfNN_ia64_install_value): Supprt TLS relocs.
+ (set_got_entry): Support TLS relocs.
+ (elfNN_ia64_relocate_section): Likewise.
+
+2002-05-23 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * elf32-arm.h (elf32_arm_final_link_relocate): For the Thumb
+ BLX reloc round the relocation up rather than down.
+ * coff-arm.c (coff_arm_relocate_section): Likewise.
+
+2002-05-21 H.J. Lu (hjl@gnu.org)
+
+ * linker.c (_bfd_generic_link_add_one_symbol): Allow multiple
+ definition.
+
+2002-05-22 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (ppc64_elf_size_stubs): Don't strip .branch_lt.
+ (ppc64_elf_relocate_section): Handle unresolved relocs in opd.
+
+2002-05-22 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (ppc64_elf_relocate_section): Return false for
+ unresolved relocs.
+ (ppc64_elf_size_dynamic_sections): Check for splt NULL.
+
+2002-05-21 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
+
+ * bfd/bfd.c (bfd_get_arch_size): Remove bfd_set_error call for
+ non-ELF targets.
+
+2002-05-21 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
+
+ * elf-bfd.h (elf_backend_emit_relocs): Change prototype to return
+ an error value.
+ * elflink.h (elf_link_output_relocs): Likewise. Improve error message.
+ return with false on error.
+ (elf_link_input_bfd): Check reloc_emitter return value.
+
+2002-05-21 Jason Thorpe <thorpej@wasabisystems.com>
+
+ * config.bfd (armeb-*-netbsdelf*): New target.
+
+2002-05-20 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (ppc_build_one_stub): Point undefined function syms
+ at the plt call stub.
+
+2002-05-19 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
+
+ * cpu-mips.c (mips_compatible): Don't try to check machine
+ compatibility.
+
+2002-05-18 Tom Rix <trix@redhat.com>
+
+ * coff64-rs6000.c (_bfd_xcoff64_swap_aux_out): Fix C_FILE auxent.
+
+2002-05-17 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (ppc64_elf_info_to_howto): Formatting.
+ (ppc64_elf_relocate_section): Don't warn about reloc overflow when
+ we've already warned about an undefined symbol. Report more
+ detail on reloc errors.
+
+2002-05-17 Alan Modra <amodra@bigpond.net.au>
+
+ * acinclude.m4 (AM_INSTALL_LIBBFD): New.
+ * configure.in: Invoke AM_INSTALL_LIBBFD.
+ * Makefile.am (install-data-local): Revert 2002-05-13. Move to..
+ (install_libbfd): .. New target.
+ (uninstall_libbfd): Likewise.
+ (install-bfdlibLTLIBRARIES): Likewise.
+ (uninstall-bfdlibLTLIBRARIES): Likewise.
+ (bfdlibdir): New.
+ (bfdincludedir): New.
+ (lib_LTLIBRARIES): Rename to bfdlib_LTLIBRARIES.
+ * aclocal.m4: Regenerate.
+ * configure: Regenerate.
+ * Makefile.in: Regenerate.
+
+2002-05-17 Stuart Balfour <sbalfour@cisco.com>
+
+ * hash.c (bfd_hash_lookup): Remove computation of len from inside
+ hash loop.
+
+2002-05-16 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * config.bfd: Add targets for sh64-linux (little endian and
+ big endian).
+
+2002-05-15 Laurent Pinchart <laurent.pinchart@skynet.be>
+
+ * peXXigen.c (pe_print_idata): Do not assume that the first thunk
+ is located in the same section as the import table. Instead
+ check, and if necessary load the section containing the thunk.
+
+2002-05-15 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * aix5ppc-core.c (xcoff64_core_p): Replace bfd_read with
+ bfd_bread.
+ (xcoff64_core_file_matches_executable_p): Replace bfd_read
+ with bfd_bread.
+
+2002-05-15 Alan Modra <amodra@bigpond.net.au>
+
+ * aix5ppc-core.c: Warning fixes.
+ * aout-adobe.c (aout_32_bfd_link_just_syms): Define.
+ * aout-target.h (MY_bfd_link_just_syms): Define.
+ * aout-tic30.c (MY_bfd_link_just_syms): Define.
+ * bfd.c (bfd_link_just_syms): Define.
+ * binary.c (binary_bfd_link_just_syms): Define.
+ * bout.c (b_out_bfd_link_just_syms): Define.
+ * coff-rs6000.c (rs6000coff_vec, pmac_xcoff_vec): Update initializer.
+ * coff64-rs6000.c (rs6000coff64_vec, aix5coff64_vec): Likewise.
+ * coffcode.h (coff_bfd_link_just_syms): Define.
+ * elf-bfd.h (enum elf_link_info_type): Add ELF_INFO_TYPE_JUST_SYMS.
+ (elf_discarded_section): Check for ELF_INFO_TYPE_JUST_SYMS.
+ (_bfd_elf_link_just_syms): Declare.
+ * elf.c (_bfd_elf_link_just_syms): New function.
+ * elf-eh-frame.c (_bfd_elf_maybe_strip_eh_frame_hdr): Check that
+ sections haven't already been discarded by the linker.
+ * elflink.h (elf_link_add_object_symbols): Likewise for stab
+ sections and SEC_MERGE sections.
+ (elf_bfd_discard_info): Similarly here.
+ * elfxx-target.h (bfd_elfNN_bfd_link_just_syms): Define.
+ * i386msdos.c (msdos_bfd_link_just_syms): Define.
+ * i386os9k.c (os9k_bfd_link_just_syms): Define.
+ * ieee.c (ieee_bfd_link_just_syms): Define.
+ * ihex.c (ihex_bfd_link_just_syms): Define.
+ * libbfd-in.h (_bfd_nolink_bfd_link_just_syms): Define.
+ (_bfd_generic_link_just_syms): Declare.
+ * libecoff.h (_bfd_ecoff_bfd_link_just_syms): Define.
+ * linker.c (_bfd_generic_link_just_syms): New function.
+ * mmo.c (mmo_bfd_link_just_syms): Define.
+ * nlm-target.h (nlm_bfd_link_just_syms): Define.
+ * oasys.c (oasys_bfd_link_just_syms): Define.
+ * ppcboot.c (ppcboot_bfd_link_just_syms): Define.
+ * som.c (som_bfd_link_just_syms): Define.
+ * srec.c (srec_bfd_link_just_syms): Define.
+ * targets.c (struct bfd_target): Add _bfd_link_just_syms.
+ (BFD_JUMP_TABLE_LINK): And here.
+ * tekhex.c (tekhex_bfd_link_just_syms): Define.
+ * versados.c (versados_bfd_link_just_syms): Define.
+ * vms.c (vms_bfd_link_just_syms): Define.
+ * libbfd.h: Regenerate.
+ * bfd-in2.h: Regenerate.
+
+2002-05-15 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
+
+ * elf32-mips.c: Remove superfluous definitions copied from
+ elfxx-mips.c.
+ (bfd_elf32_bigmips_vec,bfd_elf32_littlemips_vec): Use the
+ SGIish vectors to check the special case.
+ (mips_elf_hi16_reloc): Fix comment.
+ (mips_elf_got16_reloc): Likewise.
+ (_bfd_mips_elf32_gprel16_reloc): Likewise.
+ (elf_reloc_map): Code cleanup.
+ (mips_reloc_map): Add comment.
+ (bfd_elf23_bfd_reloc_type_lookup): Code cleanup.
+ (mips_elf32_rtype_to_howto): Likewise.
+ (mips_elf32_discard_info): Likewise.
+ (elf32_mips_irix_compat): Invert logic: Only SGIish vectors
+ lead to IRIX compatibility now.
+
+2002-05-15 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
+
+ * elfxx-mips.c: Call it IRIX, not Irix in comments.
+
+2002-05-13 Jason Thorpe <thorpej@wasabisystems.com>
+
+ * config.bfd (shle-*-netbsdelf*): Add target which includes
+ sh64 support.
+
+2002-05-13 David Edelsohn <edelsohn@gnu.org>
+
+ * configure.in: Revert 2002-04-07. Instead, auto-configure
+ HAVE_ST_C_IMPL.
+ * configure: Regenerate.
+ * config.in: Regenerate.
+ * rs6000-core.c (CNEW_IMPL): Guard use of c_impl with HAVE_ST_C_IMPL
+ or AIX_5_CORE.
+
+2002-05-11 Federico G. Schwindt <fgsch@olimpo.com.br>
+
+ * configure.in (sparc*-*-openbsd*): Support sparc64-openbsd
+ corefiles as well.2
+ * configure: Regenerate.
+
+2002-05-13 Alan Modra <amodra@bigpond.net.au>
+
+ * Makefile.am (install-data-local): Install headers to
+ $(exec_prefix)/include.
+ * Makefile.in: Regenerate.
+
+2002-05-11 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
+ Daniel Jacobowitz <drow@mvista.com>
+
+ * coff-sh.c (sh_reloc_map): Map to R_SH_IMM32 for non-PE. Don't
+ map BFD_RELOC_RVA.
+
+2002-05-11 Federico G. Schwindt <fgsch@olimpo.com.br>
+
+ * config.bfd (alpha*-*-openbsd*, sparc64*-*-openbsd*,
+ hppa*-*-openbsd*): New targets.
+ * configure.in (alpha*-*-openbsd*): Set COREFILE.
+ * configure: Regenerate.
+
2002-05-10 Tom Rix <trix@redhat.com>
- * coff64-rs6000.c (xcoff64_reloc_type_br): New function for
+ * coff64-rs6000.c (xcoff64_reloc_type_br): New function for
xcoff64_ppc_relocate_section.
* coff-rs6000.c : Extern common xcoff_reloc_type functions.
* libxcoff.h: Common xcoff_reloc_type function declaration.
@@ -8,7 +942,7 @@
2002-05-10 Alan Modra <amodra@bigpond.net.au>
* elf32-i386.c (elf_i386_relocate_section): Remove overflow checks
- addend in 2002-05-09 commit.
+ added in 2002-05-09 commit.
* elf32-hppa.c (elf32_hppa_size_stubs): Revert part of 2002-05-04,
don't look for stubs on all undefined syms.
@@ -27,7 +961,7 @@
* elf32-ppc.c (ppc_elf_create_got): New function.
(ppc_elf_create_dynamic_sections): Call ppc_elf_create_got before
- _bfd_elf_create_dynamic_sections. Correct .plt flags.
+ _bfd_elf_create_dynamic_sections. Correct .plt flags.
(ppc_elf_check_relocs): Use ppc_elf_create_got in place of
_bfd_elf_create_got_section.
@@ -110,16 +1044,16 @@
(xcoff_rtype2howto): Renamed from _bfd_xcoff_rtype2howto. Special
case some 16 bit relocs. Add reloc value to output.
(xcoff_howto_table): Remove 64 bit R_POS, add 16 bit
- R_RBR. Improve names.
+ R_RBR. Improve names.
(_bfd_xcoff_reloc_type_lookup): Adjust for removal of 64 bit R_POS.
(bfd_xcoff_backend_data): Update with new reloc swap names.
(bfd_pmac_xcoff_backend_data) : Same.
* coff64-rs6000.c: (xcoff64_swap_reloc_in): Moved from coffswap.h.
(xcoff64_swap_reloc_out): Same.
- (xcoff64_rtype2howto): Special case some 16 bit relocs and 32 bit
+ (xcoff64_rtype2howto): Special case some 16 bit relocs and 32 bit
R_POS. Add reloc value to output.
- (xcoff64_howto_table): Move 64 bit R_POS to first entry. Add 16
- bit R_RBR. Improve names, masks.
+ (xcoff64_howto_table): Move 64 bit R_POS to first entry. Add 16
+ bit R_RBR. Improve names, masks.
(xcoff64_reloc_type_lookup): Adjust for move of 64 bit R_POS.
(bfd_xcoff_backend_data): Update with new reloc swap names.
(bfd_xcoff_aix5_backend_data) : Same.
@@ -152,7 +1086,7 @@
(mips_elf_record_global_got_symbol): Call _bfd_mips_elf_hide_symbol
to hide a global symbol.
(_bfd_mips_elf_hide_symbol): Return if forced_local is true. Set
- forced_local to true.
+ forced_local to true.
2002-05-02 Richard Henderson <rth@redhat.com>
@@ -199,7 +1133,7 @@
* elf64-ppc.h (ppc64_elf_set_toc): Delete.
(ppc64_elf_toc): Declare.
(ppc64_elf_next_input_section): Update.
-
+
2002-05-01 Alan Modra <amodra@bigpond.net.au>
* syms.c (_bfd_stab_section_find_nearest_line): Don't bomb on NULL
@@ -275,11 +1209,11 @@
2002-04-28 Tom Rix <trix@redhat.com>
* coff-rs6000.c (xcoff_calculate_relocation) : Function table for
- calulating relocations.
+ calulating relocations.
(xcoff_complain_overflow) : Function table for relocation errors.
- (xcoff_ppc_relocate_section): Use relocation and complain function
- tables.
- (xcoff_complain_overflow_unsigned_func): New complain function.
+ (xcoff_ppc_relocate_section): Use relocation and complain function
+ tables.
+ (xcoff_complain_overflow_unsigned_func): New complain function.
(xcoff_complain_overflow_signed_func): Same.
(xcoff_complain_overflow_bitfield_func): Same.
(xcoff_complain_overflow_dont_func): Same.
@@ -294,7 +1228,7 @@
(xcoff_reloc_type_noop): Same.
* libxcoff.h : Declare common parts for xcoff64.
* coff64-rs6000.c (xcoff64_ppc_relocate_section): Use relocation
- and complain function tables.
+ and complain function tables.
2002-04-28 Alan Modra <amodra@bigpond.net.au>
@@ -376,12 +1310,12 @@
insert_thumb_branch, record_thumb_to_arm_glue): Suppress
definition of these functions for ARM_WINCE builds as they are
not used.
- (SWAP_IN_RELOC_OFFSET, SWAP_OUT_RELOC_OFFSET): Do not define
+ (SWAP_IN_RELOC_OFFSET, SWAP_OUT_RELOC_OFFSET): Do not define
for ARM_WINCE builds.
2002-04-18 Nick Clifton <nickc@cambridge.redhat.com>
- * coff-arm.c (bfd_arm_process_before_allocation):
+ * coff-arm.c (bfd_arm_process_before_allocation):
2002-04-17 J"orn Rennecke <joern.rennecke@superh.com>
@@ -777,13 +1711,13 @@
2002-03-20 Tom Rix <trix@redhat.com>
- * coff-rs6000.c (_bfd_xcoff_stat_arch_elt): Renamed from
+ * coff-rs6000.c (_bfd_xcoff_stat_arch_elt): Renamed from
_bfd_xcoff_generic_stat_arch_elt. Fix format check.
- * coff64-rs6000.c : Use _bfd_xcoff_stat_arch_elt.
+ * coff64-rs6000.c : Use _bfd_xcoff_stat_arch_elt.
2002-03-19 Tom Rix <trix@redhat.com>
- * xcofflink.c (_bfd_xcoff_bfd_link_add_symbols): Look through all
+ * xcofflink.c (_bfd_xcoff_bfd_link_add_symbols): Look through all
dynamic objects in archives.
2002-03-19 Hans-Peter Nilsson <hp@bitrange.com>
@@ -808,14 +1742,14 @@
(xcoff_write_archive_contents_big) : Use do_shared_object_padding,
do_copy and do_pad.
* coff64-rs6000.c (xcoff64_write_ojbect_contents) : Use
- bfd_xcoff_magic_number.
+ bfd_xcoff_magic_number.
(xcoff64_bad_format_hook) : New function for _bfd_bad_format_hook
fop.
(xcoff_backend_data_r) : Use xcoff64_bad_format_hook.
(bfd_xcoff_aix5_backend_data) : New Aix 5 backend data.
(aix5coff64_vec) : New Aix 5 target aix5coff64-rs6000.
* rs6000-core.c : Update copyright date.
- * xcofflink.c (bfd_xcoff_size_dynamic_sections): Check for NULL
+ * xcofflink.c (bfd_xcoff_size_dynamic_sections): Check for NULL
csectpp.
* coffcode.h (coff_new_section_hook) : Use new accessor macros.
(coff_set_arch_mach_hook) : Add Aix 5 U64_TOCMAGIC magic #.
diff --git a/bfd/Makefile.am b/bfd/Makefile.am
index d6dd2e689f2..da399788af5 100644
--- a/bfd/Makefile.am
+++ b/bfd/Makefile.am
@@ -9,8 +9,10 @@ MKDEP = gcc -MM
SUBDIRS = doc po
docdir = doc
+bfdlibdir = @bfdlibdir@
+bfdincludedir = @bfdincludedir@
-lib_LTLIBRARIES = libbfd.la
+bfdlib_LTLIBRARIES = libbfd.la
WARN_CFLAGS = @WARN_CFLAGS@
AM_CFLAGS = $(WARN_CFLAGS)
@@ -54,6 +56,7 @@ ALL_MACHINES = \
cpu-cris.lo \
cpu-d10v.lo \
cpu-d30v.lo \
+ cpu-dlx.lo \
cpu-fr30.lo \
cpu-h8300.lo \
cpu-h8500.lo \
@@ -102,6 +105,7 @@ ALL_MACHINES_CFILES = \
cpu-cris.c \
cpu-d10v.c \
cpu-d30v.c \
+ cpu-dlx.c \
cpu-fr30.c \
cpu-h8300.c \
cpu-h8500.c \
@@ -196,12 +200,14 @@ BFD32_BACKENDS = \
elf32-cris.lo \
elf32-d10v.lo \
elf32-d30v.lo \
+ elf32-dlx.lo \
elf32-fr30.lo \
elf32-gen.lo \
elf32-h8300.lo \
elf32-hppa.lo \
elf32-i370.lo \
elf32-i386.lo \
+ elf32-i386qnx.lo \
elf32-i860.lo \
elf32-i960.lo \
elf32-ia64.lo \
@@ -223,9 +229,12 @@ BFD32_BACKENDS = \
elf32-sh.lo \
elf32-sh-lin.lo \
elf32-sh64.lo \
+ elf32-sh64-com.lo \
elf32-sh-nbsd.lo \
+ elf32-sh64-nbsd.lo \
elf32-sparc.lo \
elf32-v850.lo \
+ elf32-vax.lo \
elf32-xstormy16.lo \
elf32.lo \
elflink.lo \
@@ -284,6 +293,7 @@ BFD32_BACKENDS = \
sparcnetbsd.lo \
sunos.lo \
vaxnetbsd.lo \
+ vax1knetbsd.lo \
versados.lo \
vms.lo \
vms-gsd.lo \
@@ -345,12 +355,14 @@ BFD32_BACKENDS_CFILES = \
elf32-cris.c \
elf32-d10v.c \
elf32-d30v.c \
+ elf32-dlx.c \
elf32-fr30.c \
elf32-gen.c \
elf32-h8300.c \
elf32-hppa.c \
elf32-i370.c \
elf32-i386.c \
+ elf32-i386qnx.c \
elf32-i860.c \
elf32-i960.c \
elf32-m32r.c \
@@ -368,12 +380,15 @@ BFD32_BACKENDS_CFILES = \
elf32-pj.c \
elf32-ppc.c \
elf32-sh64.c \
+ elf32-sh64-com.c \
elf32-s390.c \
elf32-sh.c \
elf32-sh-lin.c \
elf32-sh-nbsd.c \
+ elf32-sh64-nbsd.c \
elf32-sparc.c \
elf32-v850.c \
+ elf32-vax.c \
elf32-xstormy16.c \
elf32.c \
elflink.c \
@@ -431,6 +446,7 @@ BFD32_BACKENDS_CFILES = \
sparcnetbsd.c \
sunos.c \
vaxnetbsd.c \
+ vax1knetbsd.c \
versados.c \
vms.c \
vms-gsd.c \
@@ -457,6 +473,7 @@ BFD64_BACKENDS = \
elf64-mips.lo \
elf64-mmix.lo \
elf64-sh64.lo \
+ elf64-sh64-nbsd.lo \
elf64-ppc.lo \
elf64-s390.lo \
elf64-sparc.lo \
@@ -482,6 +499,7 @@ BFD64_BACKENDS_CFILES = \
elf64-ppc.c \
elf64-s390.c \
elf64-sh64.c \
+ elf64-sh64-nbsd.c \
elf64-sparc.c \
elf64.c \
mmo.c \
@@ -672,14 +690,35 @@ $(BFD32_LIBS) \
$(BFD64_BACKENDS) \
$(OPTIONAL_BACKENDS): $(BFD_H) $(BFD_H_DEPS) $(LOCAL_H_DEPS)
-# Install BFD include file, and others that it needs.
-install-data-local: $(BFD_H)
+install-bfdlibLTLIBRARIES: @INSTALL_LIBBFD_TRUE@install_libbfd
@$(NORMAL_INSTALL)
- $(mkinstalldirs) $(DESTDIR)$(includedir)
- $(INSTALL_DATA) $(BFD_H) $(DESTDIR)$(includedir)/bfd.h
- $(INSTALL_DATA) $(INCDIR)/ansidecl.h $(DESTDIR)$(includedir)/ansidecl.h
- $(INSTALL_DATA) $(INCDIR)/symcat.h $(DESTDIR)$(includedir)/symcat.h
- $(INSTALL_DATA) $(INCDIR)/bfdlink.h $(DESTDIR)$(includedir)/bfdlink.h
+
+uninstall-bfdlibLTLIBRARIES: @INSTALL_LIBBFD_TRUE@uninstall_libbfd
+ @$(NORMAL_UNINSTALL)
+
+.PHONY: install_libbfd uninstall_libbfd
+install_libbfd: $(bfdlib_LTLIBRARIES) $(BFD_H)
+ $(mkinstalldirs) $(DESTDIR)$(bfdlibdir)
+ $(mkinstalldirs) $(DESTDIR)$(bfdincludedir)
+ @list='$(bfdlib_LTLIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ echo "$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(bfdlibdir)/$$p"; \
+ $(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(bfdlibdir)/$$p; \
+ else :; fi; \
+ done
+ $(INSTALL_DATA) $(BFD_H) $(DESTDIR)$(bfdincludedir)/bfd.h
+ $(INSTALL_DATA) $(INCDIR)/ansidecl.h $(DESTDIR)$(bfdincludedir)/ansidecl.h
+ $(INSTALL_DATA) $(INCDIR)/symcat.h $(DESTDIR)$(bfdincludedir)/symcat.h
+ $(INSTALL_DATA) $(INCDIR)/bfdlink.h $(DESTDIR)$(bfdincludedir)/bfdlink.h
+
+uninstall_libbfd:
+ list='$(bfdlib_LTLIBRARIES)'; for p in $$list; do \
+ $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(bfdlibdir)/$$p; \
+ done
+ rm -f $(DESTDIR)$(bfdincludedir)/bfd.h
+ rm -f $(DESTDIR)$(bfdincludedir)/ansidecl.h
+ rm -f $(DESTDIR)$(bfdincludedir)/symcat.h
+ rm -f $(DESTDIR)$(bfdincludedir)/bfdlink.h
Makefile: $(srcdir)/configure.in
@@ -831,7 +870,8 @@ stabs.lo: stabs.c $(INCDIR)/filenames.h $(INCDIR)/aout/stab_gnu.h \
$(INCDIR)/aout/stab.def $(INCDIR)/safe-ctype.h
stab-syms.lo: stab-syms.c libaout.h $(INCDIR)/bfdlink.h \
$(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab.def
-merge.lo: merge.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+merge.lo: merge.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
+ $(INCDIR)/libiberty.h
dwarf2.lo: dwarf2.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/dwarf2.h
@@ -844,6 +884,7 @@ cpu-avr.lo: cpu-avr.c $(INCDIR)/filenames.h
cpu-cris.lo: cpu-cris.c $(INCDIR)/filenames.h
cpu-d10v.lo: cpu-d10v.c $(INCDIR)/filenames.h
cpu-d30v.lo: cpu-d30v.c $(INCDIR)/filenames.h
+cpu-dlx.lo: cpu-dlx.c $(INCDIR)/filenames.h
cpu-fr30.lo: cpu-fr30.c $(INCDIR)/filenames.h
cpu-h8300.lo: cpu-h8300.c $(INCDIR)/filenames.h
cpu-h8500.lo: cpu-h8500.c $(INCDIR)/filenames.h
@@ -1060,6 +1101,10 @@ elf32-d30v.lo: elf32-d30v.c $(INCDIR)/filenames.h elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/bfdlink.h $(INCDIR)/elf/d30v.h $(INCDIR)/elf/reloc-macros.h \
elf32-target.h
+elf32-dlx.lo: elf32-dlx.c $(INCDIR)/filenames.h elf-bfd.h \
+ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
+ $(INCDIR)/bfdlink.h $(INCDIR)/elf/dlx.h $(INCDIR)/elf/reloc-macros.h \
+ elf32-target.h
elf32-fr30.lo: elf32-fr30.c $(INCDIR)/filenames.h elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/bfdlink.h $(INCDIR)/elf/fr30.h $(INCDIR)/elf/reloc-macros.h \
@@ -1082,6 +1127,10 @@ elf32-i386.lo: elf32-i386.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/elf/i386.h $(INCDIR)/elf/reloc-macros.h \
elf32-target.h
+elf32-i386qnx.lo: elf32-i386qnx.c elf32-i386.c $(INCDIR)/filenames.h \
+ $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
+ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/i386.h \
+ $(INCDIR)/elf/reloc-macros.h elf32-target.h
elf32-i860.lo: elf32-i860.c $(INCDIR)/filenames.h elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/bfdlink.h $(INCDIR)/elf/i860.h $(INCDIR)/elf/reloc-macros.h \
@@ -1153,6 +1202,10 @@ elf32-sh64.lo: elf32-sh64.c $(INCDIR)/filenames.h elf-bfd.h \
$(INCDIR)/bfdlink.h $(srcdir)/../opcodes/sh64-opc.h \
elf32-sh.c $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \
elf32-target.h
+elf32-sh64-com.lo: elf32-sh64-com.c $(INCDIR)/filenames.h \
+ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
+ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/sh.h \
+ $(INCDIR)/elf/reloc-macros.h $(srcdir)/../opcodes/sh64-opc.h
elf32-s390.lo: elf32-s390.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/elf/s390.h $(INCDIR)/elf/reloc-macros.h \
@@ -1169,6 +1222,11 @@ elf32-sh-nbsd.lo: elf32-sh-nbsd.c elf32-sh.c $(INCDIR)/filenames.h \
$(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h \
$(INCDIR)/elf/reloc-macros.h elf32-target.h
+elf32-sh64-nbsd.lo: elf32-sh64-nbsd.c elf32-sh64.c \
+ $(INCDIR)/filenames.h elf-bfd.h $(INCDIR)/elf/common.h \
+ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
+ $(srcdir)/../opcodes/sh64-opc.h elf32-sh.c $(INCDIR)/elf/sh.h \
+ $(INCDIR)/elf/reloc-macros.h elf32-target.h
elf32-sparc.lo: elf32-sparc.c $(INCDIR)/filenames.h \
$(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sparc.h \
@@ -1178,6 +1236,10 @@ elf32-v850.lo: elf32-v850.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/elf/v850.h $(INCDIR)/elf/reloc-macros.h \
$(INCDIR)/libiberty.h elf32-target.h
+elf32-vax.lo: elf32-vax.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
+ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
+ $(INCDIR)/elf/external.h $(INCDIR)/elf/vax.h $(INCDIR)/elf/reloc-macros.h \
+ elf32-target.h
elf32-xstormy16.lo: elf32-xstormy16.c $(INCDIR)/filenames.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/xstormy16.h \
@@ -1192,7 +1254,7 @@ elflink.lo: elflink.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
$(INCDIR)/elf/external.h
elf-strtab.lo: elf-strtab.c $(INCDIR)/filenames.h elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
- $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h
+ $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h $(INCDIR)/libiberty.h
elf-eh-frame.lo: elf-eh-frame.c $(INCDIR)/filenames.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/dwarf2.h
@@ -1362,6 +1424,9 @@ sunos.lo: sunos.c $(INCDIR)/bfdlink.h libaout.h aoutf1.h \
vaxnetbsd.lo: vaxnetbsd.c netbsd.h $(INCDIR)/filenames.h \
libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \
$(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
+vax1knetbsd.lo: vax1knetbsd.c netbsd.h $(INCDIR)/filenames.h \
+ libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \
+ $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
versados.lo: versados.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h
vms.lo: vms.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
vms.h
@@ -1438,6 +1503,10 @@ elf64-sh64.lo: elf64-sh64.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \
elf64-target.h
+elf64-sh64-nbsd.lo: elf64-sh64-nbsd.c elf64-sh64.c \
+ $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h elf-bfd.h \
+ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
+ $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h elf64-target.h
elf64-sparc.lo: elf64-sparc.c $(INCDIR)/filenames.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/opcode/sparc.h \
diff --git a/bfd/Makefile.in b/bfd/Makefile.in
index e3cc1268912..983ac2f47bc 100644
--- a/bfd/Makefile.in
+++ b/bfd/Makefile.in
@@ -133,8 +133,10 @@ MKDEP = gcc -MM
SUBDIRS = doc po
docdir = doc
+bfdlibdir = @bfdlibdir@
+bfdincludedir = @bfdincludedir@
-lib_LTLIBRARIES = libbfd.la
+bfdlib_LTLIBRARIES = libbfd.la
WARN_CFLAGS = @WARN_CFLAGS@
AM_CFLAGS = $(WARN_CFLAGS)
@@ -149,497 +151,45 @@ BFD_H = bfd.h
# for the debugger, so if you are downloading things as S-records you
# need two copies of the executable, one to download and one for the
# debugger).
-BFD32_LIBS = \
- archive.lo archures.lo bfd.lo cache.lo coffgen.lo corefile.lo \
- format.lo init.lo libbfd.lo opncls.lo reloc.lo \
- section.lo syms.lo targets.lo hash.lo linker.lo \
- srec.lo binary.lo tekhex.lo ihex.lo stabs.lo stab-syms.lo \
- merge.lo dwarf2.lo
+BFD32_LIBS = archive.lo archures.lo bfd.lo cache.lo coffgen.lo corefile.lo format.lo init.lo libbfd.lo opncls.lo reloc.lo section.lo syms.lo targets.lo hash.lo linker.lo srec.lo binary.lo tekhex.lo ihex.lo stabs.lo stab-syms.lo merge.lo dwarf2.lo
BFD64_LIBS = archive64.lo
-BFD32_LIBS_CFILES = \
- archive.c archures.c bfd.c cache.c coffgen.c corefile.c \
- format.c init.c libbfd.c opncls.c reloc.c \
- section.c syms.c targets.c hash.c linker.c \
- srec.c binary.c tekhex.c ihex.c stabs.c stab-syms.c \
- merge.c dwarf2.c
+BFD32_LIBS_CFILES = archive.c archures.c bfd.c cache.c coffgen.c corefile.c format.c init.c libbfd.c opncls.c reloc.c section.c syms.c targets.c hash.c linker.c srec.c binary.c tekhex.c ihex.c stabs.c stab-syms.c merge.c dwarf2.c
BFD64_LIBS_CFILES = archive64.c
# This list is alphabetized to make it easier to keep in sync
# with the decls and initializer in archures.c.
-ALL_MACHINES = \
- cpu-a29k.lo \
- cpu-alpha.lo \
- cpu-arc.lo \
- cpu-arm.lo \
- cpu-avr.lo \
- cpu-cris.lo \
- cpu-d10v.lo \
- cpu-d30v.lo \
- cpu-fr30.lo \
- cpu-h8300.lo \
- cpu-h8500.lo \
- cpu-hppa.lo \
- cpu-ia64.lo \
- cpu-i370.lo \
- cpu-i386.lo \
- cpu-i860.lo \
- cpu-i960.lo \
- cpu-m32r.lo \
- cpu-m68hc11.lo \
- cpu-m68hc12.lo \
- cpu-m68k.lo \
- cpu-m88k.lo \
- cpu-m10200.lo \
- cpu-m10300.lo \
- cpu-mcore.lo \
- cpu-mips.lo \
- cpu-mmix.lo \
- cpu-or32.lo \
- cpu-ns32k.lo \
- cpu-openrisc.lo \
- cpu-pdp11.lo \
- cpu-pj.lo \
- cpu-powerpc.lo \
- cpu-rs6000.lo \
- cpu-s390.lo \
- cpu-sh.lo \
- cpu-sparc.lo \
- cpu-tic30.lo \
- cpu-tic54x.lo \
- cpu-tic80.lo \
- cpu-v850.lo \
- cpu-vax.lo \
- cpu-we32k.lo \
- cpu-w65.lo \
- cpu-xstormy16.lo \
- cpu-z8k.lo
-
-
-ALL_MACHINES_CFILES = \
- cpu-a29k.c \
- cpu-alpha.c \
- cpu-arc.c \
- cpu-arm.c \
- cpu-avr.c \
- cpu-cris.c \
- cpu-d10v.c \
- cpu-d30v.c \
- cpu-fr30.c \
- cpu-h8300.c \
- cpu-h8500.c \
- cpu-hppa.c \
- cpu-ia64.c \
- cpu-i370.c \
- cpu-i386.c \
- cpu-i860.c \
- cpu-i960.c \
- cpu-m32r.c \
- cpu-m68hc11.c \
- cpu-m68hc12.c \
- cpu-m68k.c \
- cpu-m88k.c \
- cpu-m10200.c \
- cpu-m10300.c \
- cpu-mcore.c \
- cpu-mips.c \
- cpu-mmix.c \
- cpu-or32.c \
- cpu-ns32k.c \
- cpu-openrisc.c \
- cpu-pdp11.c \
- cpu-pj.c \
- cpu-powerpc.c \
- cpu-rs6000.c \
- cpu-s390.c \
- cpu-sh.c \
- cpu-sparc.c \
- cpu-tic30.c \
- cpu-tic54x.c \
- cpu-tic80.c \
- cpu-v850.c \
- cpu-vax.c \
- cpu-we32k.c \
- cpu-w65.c \
- cpu-xstormy16.c \
- cpu-z8k.c
+ALL_MACHINES = cpu-a29k.lo cpu-alpha.lo cpu-arc.lo cpu-arm.lo cpu-avr.lo cpu-cris.lo cpu-d10v.lo cpu-d30v.lo cpu-dlx.lo cpu-fr30.lo cpu-h8300.lo cpu-h8500.lo cpu-hppa.lo cpu-ia64.lo cpu-i370.lo cpu-i386.lo cpu-i860.lo cpu-i960.lo cpu-m32r.lo cpu-m68hc11.lo cpu-m68hc12.lo cpu-m68k.lo cpu-m88k.lo cpu-m10200.lo cpu-m10300.lo cpu-mcore.lo cpu-mips.lo cpu-mmix.lo cpu-or32.lo cpu-ns32k.lo cpu-openrisc.lo cpu-pdp11.lo cpu-pj.lo cpu-powerpc.lo cpu-rs6000.lo cpu-s390.lo cpu-sh.lo cpu-sparc.lo cpu-tic30.lo cpu-tic54x.lo cpu-tic80.lo cpu-v850.lo cpu-vax.lo cpu-we32k.lo cpu-w65.lo cpu-xstormy16.lo cpu-z8k.lo
+
+
+ALL_MACHINES_CFILES = cpu-a29k.c cpu-alpha.c cpu-arc.c cpu-arm.c cpu-avr.c cpu-cris.c cpu-d10v.c cpu-d30v.c cpu-dlx.c cpu-fr30.c cpu-h8300.c cpu-h8500.c cpu-hppa.c cpu-ia64.c cpu-i370.c cpu-i386.c cpu-i860.c cpu-i960.c cpu-m32r.c cpu-m68hc11.c cpu-m68hc12.c cpu-m68k.c cpu-m88k.c cpu-m10200.c cpu-m10300.c cpu-mcore.c cpu-mips.c cpu-mmix.c cpu-or32.c cpu-ns32k.c cpu-openrisc.c cpu-pdp11.c cpu-pj.c cpu-powerpc.c cpu-rs6000.c cpu-s390.c cpu-sh.c cpu-sparc.c cpu-tic30.c cpu-tic54x.c cpu-tic80.c cpu-v850.c cpu-vax.c cpu-we32k.c cpu-w65.c cpu-xstormy16.c cpu-z8k.c
# The .o files needed by all of the 32 bit vectors that are configured into
# target_vector in targets.c if configured with --enable-targets=all.
-BFD32_BACKENDS = \
- aout-adobe.lo \
- aout-arm.lo \
- aout-cris.lo \
- aout-ns32k.lo \
- aout-sparcle.lo \
- aout-tic30.lo \
- aout0.lo \
- aout32.lo \
- armnetbsd.lo \
- bout.lo \
- cf-i386lynx.lo \
- cf-m68klynx.lo \
- cf-sparclynx.lo \
- coff-a29k.lo \
- coff-apollo.lo \
- coff-arm.lo \
- coff-aux.lo \
- coff-h8300.lo \
- coff-h8500.lo \
- coff-i386.lo \
- coff-go32.lo \
- coff-i860.lo \
- coff-i960.lo \
- coff-m68k.lo \
- coff-m88k.lo \
- coff-mips.lo \
- coff-or32.lo \
- coff-rs6000.lo \
- coff-sh.lo \
- coff-sparc.lo \
- coff-stgo32.lo \
- coff-svm68k.lo \
- coff-tic30.lo \
- coff-tic54x.lo \
- coff-tic80.lo \
- coff-u68k.lo \
- coff-we32k.lo \
- coff-w65.lo \
- coff-z8k.lo \
- cofflink.lo \
- dwarf1.lo \
- ecoff.lo \
- ecofflink.lo \
- efi-app-ia32.lo \
- elf.lo \
- elf32-arc.lo \
- elfarm-oabi.lo \
- elfarm-nabi.lo \
- elf32-avr.lo \
- elf32-cris.lo \
- elf32-d10v.lo \
- elf32-d30v.lo \
- elf32-fr30.lo \
- elf32-gen.lo \
- elf32-h8300.lo \
- elf32-hppa.lo \
- elf32-i370.lo \
- elf32-i386.lo \
- elf32-i860.lo \
- elf32-i960.lo \
- elf32-ia64.lo \
- elf32-m32r.lo \
- elf32-m68hc11.lo \
- elf32-m68hc12.lo \
- elf32-m68k.lo \
- elf32-m88k.lo \
- elf-m10200.lo \
- elf-m10300.lo \
- elf32-mcore.lo \
- elfxx-mips.lo \
- elf32-mips.lo \
- elf32-openrisc.lo \
- elf32-or32.lo \
- elf32-pj.lo \
- elf32-ppc.lo \
- elf32-s390.lo \
- elf32-sh.lo \
- elf32-sh-lin.lo \
- elf32-sh64.lo \
- elf32-sh-nbsd.lo \
- elf32-sparc.lo \
- elf32-v850.lo \
- elf32-xstormy16.lo \
- elf32.lo \
- elflink.lo \
- elf-strtab.lo \
- elf-eh-frame.lo \
- epoc-pe-arm.lo \
- epoc-pei-arm.lo \
- hp300bsd.lo \
- hp300hpux.lo \
- som.lo \
- i386aout.lo \
- i386bsd.lo \
- i386dynix.lo \
- i386freebsd.lo \
- i386linux.lo \
- i386lynx.lo \
- i386msdos.lo \
- i386netbsd.lo \
- i386mach3.lo \
- i386os9k.lo \
- ieee.lo \
- m68k4knetbsd.lo \
- m68klinux.lo \
- m68klynx.lo \
- m68knetbsd.lo \
- m88kmach3.lo \
- mipsbsd.lo \
- newsos3.lo \
- nlm.lo \
- nlm32-i386.lo \
- nlm32-sparc.lo \
- nlm32-ppc.lo \
- nlm32.lo \
- ns32knetbsd.lo \
- oasys.lo \
- pc532-mach.lo \
- pdp11.lo \
- pe-arm.lo \
- pei-arm.lo \
- pe-i386.lo \
- pei-i386.lo \
- pe-mcore.lo \
- pei-mcore.lo \
- pe-ppc.lo \
- pei-ppc.lo \
- pe-sh.lo \
- pei-sh.lo \
- pe-mips.lo \
- pei-mips.lo \
- peigen.lo \
- ppcboot.lo \
- reloc16.lo \
- riscix.lo \
- sparclinux.lo \
- sparclynx.lo \
- sparcnetbsd.lo \
- sunos.lo \
- vaxnetbsd.lo \
- versados.lo \
- vms.lo \
- vms-gsd.lo \
- vms-hdr.lo \
- vms-misc.lo \
- vms-tir.lo \
- xcofflink.lo
-
-
-BFD32_BACKENDS_CFILES = \
- aout-adobe.c \
- aout-arm.c \
- aout-cris.c \
- aout-ns32k.c \
- aout-sparcle.c \
- aout-tic30.c \
- aout0.c \
- aout32.c \
- armnetbsd.c \
- bout.c \
- cf-i386lynx.c \
- cf-m68klynx.c \
- cf-sparclynx.c \
- coff-a29k.c \
- coff-apollo.c \
- coff-arm.c \
- coff-aux.c \
- coff-h8300.c \
- coff-h8500.c \
- coff-i386.c \
- coff-i860.c \
- coff-go32.c \
- coff-i960.c \
- coff-m68k.c \
- coff-m88k.c \
- coff-mips.c \
- coff-or32.c \
- coff-rs6000.c \
- coff-sh.c \
- coff-sparc.c \
- coff-stgo32.c \
- coff-svm68k.c \
- coff-tic30.c \
- coff-tic54x.c \
- coff-tic80.c \
- coff-u68k.c \
- coff-we32k.c \
- coff-w65.c \
- coff-z8k.c \
- cofflink.c \
- dwarf1.c \
- ecoff.c \
- ecofflink.c \
- efi-app-ia32.c \
- elf.c \
- elf32-arc.c \
- elfarm-oabi.c \
- elfarm-nabi.c \
- elf32-avr.c \
- elf32-cris.c \
- elf32-d10v.c \
- elf32-d30v.c \
- elf32-fr30.c \
- elf32-gen.c \
- elf32-h8300.c \
- elf32-hppa.c \
- elf32-i370.c \
- elf32-i386.c \
- elf32-i860.c \
- elf32-i960.c \
- elf32-m32r.c \
- elf32-m68k.c \
- elf32-m68hc11.c \
- elf32-m68hc12.c \
- elf32-m88k.c \
- elf-m10200.c \
- elf-m10300.c \
- elf32-mcore.c \
- elfxx-mips.c \
- elf32-mips.c \
- elf32-openrisc.c \
- elf32-or32.c \
- elf32-pj.c \
- elf32-ppc.c \
- elf32-sh64.c \
- elf32-s390.c \
- elf32-sh.c \
- elf32-sh-lin.c \
- elf32-sh-nbsd.c \
- elf32-sparc.c \
- elf32-v850.c \
- elf32-xstormy16.c \
- elf32.c \
- elflink.c \
- elf-strtab.c \
- elf-eh-frame.c \
- epoc-pe-arm.c \
- epoc-pei-arm.c \
- hp300bsd.c \
- hp300hpux.c \
- som.c \
- i386aout.c \
- i386bsd.c \
- i386dynix.c \
- i386freebsd.c \
- i386linux.c \
- i386lynx.c \
- i386msdos.c \
- i386netbsd.c \
- i386mach3.c \
- i386os9k.c \
- ieee.c \
- m68k4knetbsd.c \
- m68klinux.c \
- m68klynx.c \
- m68knetbsd.c \
- m88kmach3.c \
- mipsbsd.c \
- newsos3.c \
- nlm.c \
- nlm32-i386.c \
- nlm32-sparc.c \
- nlm32-ppc.c \
- nlm32.c \
- ns32knetbsd.c \
- oasys.c \
- pc532-mach.c \
- pdp11.c \
- pe-arm.c \
- pei-arm.c \
- pe-i386.c \
- pei-i386.c \
- pe-mcore.c \
- pei-mcore.c \
- pe-ppc.c \
- pei-ppc.c \
- pe-sh.c \
- pei-sh.c \
- pe-mips.c \
- pei-mips.c \
- ppcboot.c \
- reloc16.c \
- riscix.c \
- sparclinux.c \
- sparclynx.c \
- sparcnetbsd.c \
- sunos.c \
- vaxnetbsd.c \
- versados.c \
- vms.c \
- vms-gsd.c \
- vms-hdr.c \
- vms-misc.c \
- vms-tir.c \
- xcofflink.c
+BFD32_BACKENDS = aout-adobe.lo aout-arm.lo aout-cris.lo aout-ns32k.lo aout-sparcle.lo aout-tic30.lo aout0.lo aout32.lo armnetbsd.lo bout.lo cf-i386lynx.lo cf-m68klynx.lo cf-sparclynx.lo coff-a29k.lo coff-apollo.lo coff-arm.lo coff-aux.lo coff-h8300.lo coff-h8500.lo coff-i386.lo coff-go32.lo coff-i860.lo coff-i960.lo coff-m68k.lo coff-m88k.lo coff-mips.lo coff-or32.lo coff-rs6000.lo coff-sh.lo coff-sparc.lo coff-stgo32.lo coff-svm68k.lo coff-tic30.lo coff-tic54x.lo coff-tic80.lo coff-u68k.lo coff-we32k.lo coff-w65.lo coff-z8k.lo cofflink.lo dwarf1.lo ecoff.lo ecofflink.lo efi-app-ia32.lo elf.lo elf32-arc.lo elfarm-oabi.lo elfarm-nabi.lo elf32-avr.lo elf32-cris.lo elf32-d10v.lo elf32-d30v.lo elf32-dlx.lo elf32-fr30.lo elf32-gen.lo elf32-h8300.lo elf32-hppa.lo elf32-i370.lo elf32-i386.lo elf32-i386qnx.lo elf32-i860.lo elf32-i960.lo elf32-ia64.lo elf32-m32r.lo elf32-m68hc11.lo elf32-m68hc12.lo elf32-m68k.lo elf32-m88k.lo elf-m10200.lo elf-m10300.lo elf32-mcore.lo elfxx-mips.lo elf32-mips.lo elf32-openrisc.lo elf32-or32.lo elf32-pj.lo elf32-ppc.lo elf32-s390.lo elf32-sh.lo elf32-sh-lin.lo elf32-sh64.lo elf32-sh64-com.lo elf32-sh-nbsd.lo elf32-sh64-nbsd.lo elf32-sparc.lo elf32-v850.lo elf32-vax.lo elf32-xstormy16.lo elf32.lo elflink.lo elf-strtab.lo elf-eh-frame.lo epoc-pe-arm.lo epoc-pei-arm.lo hp300bsd.lo hp300hpux.lo som.lo i386aout.lo i386bsd.lo i386dynix.lo i386freebsd.lo i386linux.lo i386lynx.lo i386msdos.lo i386netbsd.lo i386mach3.lo i386os9k.lo ieee.lo m68k4knetbsd.lo m68klinux.lo m68klynx.lo m68knetbsd.lo m88kmach3.lo mipsbsd.lo newsos3.lo nlm.lo nlm32-i386.lo nlm32-sparc.lo nlm32-ppc.lo nlm32.lo ns32knetbsd.lo oasys.lo pc532-mach.lo pdp11.lo pe-arm.lo pei-arm.lo pe-i386.lo pei-i386.lo pe-mcore.lo pei-mcore.lo pe-ppc.lo pei-ppc.lo pe-sh.lo pei-sh.lo pe-mips.lo pei-mips.lo peigen.lo ppcboot.lo reloc16.lo riscix.lo sparclinux.lo sparclynx.lo sparcnetbsd.lo sunos.lo vaxnetbsd.lo vax1knetbsd.lo versados.lo vms.lo vms-gsd.lo vms-hdr.lo vms-misc.lo vms-tir.lo xcofflink.lo
+
+
+BFD32_BACKENDS_CFILES = aout-adobe.c aout-arm.c aout-cris.c aout-ns32k.c aout-sparcle.c aout-tic30.c aout0.c aout32.c armnetbsd.c bout.c cf-i386lynx.c cf-m68klynx.c cf-sparclynx.c coff-a29k.c coff-apollo.c coff-arm.c coff-aux.c coff-h8300.c coff-h8500.c coff-i386.c coff-i860.c coff-go32.c coff-i960.c coff-m68k.c coff-m88k.c coff-mips.c coff-or32.c coff-rs6000.c coff-sh.c coff-sparc.c coff-stgo32.c coff-svm68k.c coff-tic30.c coff-tic54x.c coff-tic80.c coff-u68k.c coff-we32k.c coff-w65.c coff-z8k.c cofflink.c dwarf1.c ecoff.c ecofflink.c efi-app-ia32.c elf.c elf32-arc.c elfarm-oabi.c elfarm-nabi.c elf32-avr.c elf32-cris.c elf32-d10v.c elf32-d30v.c elf32-dlx.c elf32-fr30.c elf32-gen.c elf32-h8300.c elf32-hppa.c elf32-i370.c elf32-i386.c elf32-i386qnx.c elf32-i860.c elf32-i960.c elf32-m32r.c elf32-m68k.c elf32-m68hc11.c elf32-m68hc12.c elf32-m88k.c elf-m10200.c elf-m10300.c elf32-mcore.c elfxx-mips.c elf32-mips.c elf32-openrisc.c elf32-or32.c elf32-pj.c elf32-ppc.c elf32-sh64.c elf32-sh64-com.c elf32-s390.c elf32-sh.c elf32-sh-lin.c elf32-sh-nbsd.c elf32-sh64-nbsd.c elf32-sparc.c elf32-v850.c elf32-vax.c elf32-xstormy16.c elf32.c elflink.c elf-strtab.c elf-eh-frame.c epoc-pe-arm.c epoc-pei-arm.c hp300bsd.c hp300hpux.c som.c i386aout.c i386bsd.c i386dynix.c i386freebsd.c i386linux.c i386lynx.c i386msdos.c i386netbsd.c i386mach3.c i386os9k.c ieee.c m68k4knetbsd.c m68klinux.c m68klynx.c m68knetbsd.c m88kmach3.c mipsbsd.c newsos3.c nlm.c nlm32-i386.c nlm32-sparc.c nlm32-ppc.c nlm32.c ns32knetbsd.c oasys.c pc532-mach.c pdp11.c pe-arm.c pei-arm.c pe-i386.c pei-i386.c pe-mcore.c pei-mcore.c pe-ppc.c pei-ppc.c pe-sh.c pei-sh.c pe-mips.c pei-mips.c ppcboot.c reloc16.c riscix.c sparclinux.c sparclynx.c sparcnetbsd.c sunos.c vaxnetbsd.c vax1knetbsd.c versados.c vms.c vms-gsd.c vms-hdr.c vms-misc.c vms-tir.c xcofflink.c
# The .o files needed by all of the 64 bit vectors that are configured into
# target_vector in targets.c if configured with --enable-targets=all
# and --enable-64-bit-bfd.
-BFD64_BACKENDS = \
- aix5ppc-core.lo \
- aout64.lo \
- coff-alpha.lo \
- coff64-rs6000.lo \
- demo64.lo \
- efi-app-ia64.lo \
- elf64-x86-64.lo \
- elf64-alpha.lo \
- elf64-hppa.lo \
- elf64-ia64.lo \
- elf64-gen.lo \
- elf64-mips.lo \
- elf64-mmix.lo \
- elf64-sh64.lo \
- elf64-ppc.lo \
- elf64-s390.lo \
- elf64-sparc.lo \
- elf64.lo \
- mmo.lo \
- nlm32-alpha.lo \
- nlm64.lo \
- pepigen.lo
-
-
-BFD64_BACKENDS_CFILES = \
- aix5ppc-core.c \
- aout64.c \
- coff-alpha.c \
- coff64-rs6000.c \
- demo64.c \
- efi-app-ia64.c \
- elf64-x86-64.c \
- elf64-alpha.c \
- elf64-hppa.c \
- elf64-gen.c \
- elf64-mips.c \
- elf64-mmix.c \
- elf64-ppc.c \
- elf64-s390.c \
- elf64-sh64.c \
- elf64-sparc.c \
- elf64.c \
- mmo.c \
- nlm32-alpha.c \
- nlm64.c
-
-
-OPTIONAL_BACKENDS = \
- aix386-core.lo \
- hpux-core.lo \
- irix-core.lo \
- lynx-core.lo \
- osf-core.lo \
- sco5-core.lo \
- trad-core.lo \
- cisco-core.lo
-
-
-OPTIONAL_BACKENDS_CFILES = \
- aix386-core.c \
- hpux-core.c \
- irix-core.c \
- lynx-core.c \
- osf-core.c \
- sco5-core.c \
- trad-core.c \
- cisco-core.c
+BFD64_BACKENDS = aix5ppc-core.lo aout64.lo coff-alpha.lo coff64-rs6000.lo demo64.lo efi-app-ia64.lo elf64-x86-64.lo elf64-alpha.lo elf64-hppa.lo elf64-ia64.lo elf64-gen.lo elf64-mips.lo elf64-mmix.lo elf64-sh64.lo elf64-sh64-nbsd.lo elf64-ppc.lo elf64-s390.lo elf64-sparc.lo elf64.lo mmo.lo nlm32-alpha.lo nlm64.lo pepigen.lo
+
+
+BFD64_BACKENDS_CFILES = aix5ppc-core.c aout64.c coff-alpha.c coff64-rs6000.c demo64.c efi-app-ia64.c elf64-x86-64.c elf64-alpha.c elf64-hppa.c elf64-gen.c elf64-mips.c elf64-mmix.c elf64-ppc.c elf64-s390.c elf64-sh64.c elf64-sh64-nbsd.c elf64-sparc.c elf64.c mmo.c nlm32-alpha.c nlm64.c
+
+
+OPTIONAL_BACKENDS = aix386-core.lo hpux-core.lo irix-core.lo lynx-core.lo osf-core.lo sco5-core.lo trad-core.lo cisco-core.lo
+
+
+OPTIONAL_BACKENDS_CFILES = aix386-core.c hpux-core.c irix-core.c lynx-core.c osf-core.c sco5-core.c trad-core.c cisco-core.c
# These are defined by configure.in:
@@ -653,33 +203,18 @@ TDEFAULTS = @tdefaults@
INCLUDES = -D_GNU_SOURCE @HDEFINES@ @COREFLAG@ @TDEFINES@ $(CSEARCH) $(CSWITCHES) -I$(srcdir)/../intl -I../intl
# C source files that correspond to .o's.
-SOURCE_CFILES = \
- $(BFD32_LIBS_CFILES) \
- $(BFD64_LIBS_CFILES) \
- $(ALL_MACHINES_CFILES) \
- $(BFD32_BACKENDS_CFILES) \
- $(BFD64_BACKENDS_CFILES) \
- $(OPTIONAL_BACKENDS_CFILES)
+SOURCE_CFILES = $(BFD32_LIBS_CFILES) $(BFD64_LIBS_CFILES) $(ALL_MACHINES_CFILES) $(BFD32_BACKENDS_CFILES) $(BFD64_BACKENDS_CFILES) $(OPTIONAL_BACKENDS_CFILES)
-BUILD_CFILES = \
- elf32-ia64.c elf64-ia64.c peigen.c pepigen.c
+BUILD_CFILES = elf32-ia64.c elf64-ia64.c peigen.c pepigen.c
CFILES = $(SOURCE_CFILES) $(BUILD_CFILES)
-SOURCE_HFILES = \
- aout-target.h aoutf1.h aoutx.h coffcode.h coffswap.h ecoffswap.h \
- elf-bfd.h elf-hppa.h elf32-arm.h elf32-hppa.h elf64-hppa.h \
- elfcode.h elfcore.h elflink.h freebsd.h genlink.h go32stub.h \
- libaout.h libbfd.h libcoff.h libecoff.h libhppa.h \
- libieee.h libnlm.h liboasys.h libpei.h netbsd.h nlm-target.h \
- nlmcode.h nlmswap.h ns32k.h peicode.h som.h vms.h libxcoff.h \
- xcoff-target.h version.h
+SOURCE_HFILES = aout-target.h aoutf1.h aoutx.h coffcode.h coffswap.h ecoffswap.h elf-bfd.h elf-hppa.h elf32-arm.h elf32-hppa.h elf64-hppa.h elfcode.h elfcore.h elflink.h freebsd.h genlink.h go32stub.h libaout.h libbfd.h libcoff.h libecoff.h libhppa.h libieee.h libnlm.h liboasys.h libpei.h netbsd.h nlm-target.h nlmcode.h nlmswap.h ns32k.h peicode.h som.h vms.h libxcoff.h xcoff-target.h version.h
-BUILD_HFILES = \
- elf32-target.h elf64-target.h targmatch.h
+BUILD_HFILES = elf32-target.h elf64-target.h targmatch.h
HFILES = $(SOURCE_HFILES) $(BUILD_HFILES)
@@ -709,8 +244,7 @@ libbfd_a_SOURCES =
BFD_H_DEPS = $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h
LOCAL_H_DEPS = libbfd.h sysdep.h config.h
-BFD_H_FILES = bfd-in.h init.c opncls.c libbfd.c section.c archures.c \
- reloc.c syms.c bfd.c archive.c corefile.c targets.c format.c version.h
+BFD_H_FILES = bfd-in.h init.c opncls.c libbfd.c section.c archures.c reloc.c syms.c bfd.c archive.c corefile.c targets.c format.c version.h
BFD64_H_FILES = archive64.c
LIBBFD_H_FILES = libbfd-in.h init.c libbfd.c cache.c reloc.c archures.c elf.c
@@ -718,8 +252,7 @@ LIBCOFF_H_FILES = libcoff-in.h coffcode.h
MOSTLYCLEANFILES = ofiles stamp-ofiles
-CLEANFILES = bfd.h dep.sed stmp-bfd-h DEP DEPA DEP1 DEP2 libbfd.a stamp-lib \
- stmp-bin2-h stmp-lbfd-h stmp-lcoff-h
+CLEANFILES = bfd.h dep.sed stmp-bfd-h DEP DEPA DEP1 DEP2 libbfd.a stamp-lib stmp-bin2-h stmp-lbfd-h stmp-lcoff-h
DISTCLEANFILES = $(BUILD_CFILES) $(BUILD_HFILES)
@@ -736,7 +269,7 @@ LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
libbfd_a_LIBADD =
libbfd_a_OBJECTS =
-LTLIBRARIES = $(lib_LTLIBRARIES)
+LTLIBRARIES = $(bfdlib_LTLIBRARIES)
libbfd_la_OBJECTS = archive.lo archures.lo bfd.lo cache.lo coffgen.lo \
corefile.lo format.lo init.lo libbfd.lo opncls.lo reloc.lo section.lo \
@@ -857,33 +390,17 @@ distclean-libtool:
maintainer-clean-libtool:
-mostlyclean-libLTLIBRARIES:
+mostlyclean-bfdlibLTLIBRARIES:
-clean-libLTLIBRARIES:
- -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
+clean-bfdlibLTLIBRARIES:
+ -test -z "$(bfdlib_LTLIBRARIES)" || rm -f $(bfdlib_LTLIBRARIES)
-distclean-libLTLIBRARIES:
+distclean-bfdlibLTLIBRARIES:
-maintainer-clean-libLTLIBRARIES:
-
-install-libLTLIBRARIES: $(lib_LTLIBRARIES)
- @$(NORMAL_INSTALL)
- $(mkinstalldirs) $(DESTDIR)$(libdir)
- @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
- if test -f $$p; then \
- echo "$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p"; \
- $(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p; \
- else :; fi; \
- done
-
-uninstall-libLTLIBRARIES:
- @$(NORMAL_UNINSTALL)
- list='$(lib_LTLIBRARIES)'; for p in $$list; do \
- $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \
- done
+maintainer-clean-bfdlibLTLIBRARIES:
libbfd.la: $(libbfd_la_OBJECTS) $(libbfd_la_DEPENDENCIES)
- $(LINK) -rpath $(libdir) $(libbfd_la_LDFLAGS) $(libbfd_la_OBJECTS) $(libbfd_la_LIBADD) $(LIBS)
+ $(LINK) -rpath $(bfdlibdir) $(libbfd_la_LDFLAGS) $(libbfd_la_OBJECTS) $(libbfd_la_LIBADD) $(LIBS)
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
@@ -1045,16 +562,16 @@ install-info: install-info-recursive
all-recursive-am: config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive
-install-exec-am: install-libLTLIBRARIES
+install-exec-am:
install-exec: install-exec-recursive
-install-data-am: install-data-local
+install-data-am: install-bfdlibLTLIBRARIES
install-data: install-data-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
install: install-recursive
-uninstall-am: uninstall-libLTLIBRARIES
+uninstall-am: uninstall-bfdlibLTLIBRARIES
uninstall: uninstall-recursive
all-am: Makefile $(LIBRARIES) $(LTLIBRARIES) config.h
all-redirect: all-recursive-am
@@ -1062,7 +579,7 @@ install-strip:
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
installdirs: installdirs-recursive
installdirs-am:
- $(mkinstalldirs) $(DESTDIR)$(libdir)
+ $(mkinstalldirs) $(DESTDIR)$(bfdlibdir)
mostlyclean-generic:
@@ -1079,19 +596,19 @@ distclean-generic:
maintainer-clean-generic:
mostlyclean-am: mostlyclean-hdr mostlyclean-noinstLIBRARIES \
mostlyclean-compile mostlyclean-libtool \
- mostlyclean-libLTLIBRARIES mostlyclean-tags \
+ mostlyclean-bfdlibLTLIBRARIES mostlyclean-tags \
mostlyclean-generic
mostlyclean: mostlyclean-recursive
clean-am: clean-hdr clean-noinstLIBRARIES clean-compile clean-libtool \
- clean-libLTLIBRARIES clean-tags clean-generic \
+ clean-bfdlibLTLIBRARIES clean-tags clean-generic \
mostlyclean-am
clean: clean-recursive
distclean-am: distclean-hdr distclean-noinstLIBRARIES distclean-compile \
- distclean-libtool distclean-libLTLIBRARIES \
+ distclean-libtool distclean-bfdlibLTLIBRARIES \
distclean-tags distclean-generic clean-am
-rm -f libtool
@@ -1101,8 +618,9 @@ distclean: distclean-recursive
maintainer-clean-am: maintainer-clean-hdr \
maintainer-clean-noinstLIBRARIES \
maintainer-clean-compile maintainer-clean-libtool \
- maintainer-clean-libLTLIBRARIES maintainer-clean-tags \
- maintainer-clean-generic distclean-am
+ maintainer-clean-bfdlibLTLIBRARIES \
+ maintainer-clean-tags maintainer-clean-generic \
+ distclean-am
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
@@ -1114,22 +632,22 @@ mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \
clean-noinstLIBRARIES maintainer-clean-noinstLIBRARIES \
mostlyclean-compile distclean-compile clean-compile \
maintainer-clean-compile mostlyclean-libtool distclean-libtool \
-clean-libtool maintainer-clean-libtool mostlyclean-libLTLIBRARIES \
-distclean-libLTLIBRARIES clean-libLTLIBRARIES \
-maintainer-clean-libLTLIBRARIES uninstall-libLTLIBRARIES \
-install-libLTLIBRARIES install-data-recursive uninstall-data-recursive \
-install-exec-recursive uninstall-exec-recursive installdirs-recursive \
-uninstalldirs-recursive all-recursive check-recursive \
-installcheck-recursive info-recursive dvi-recursive \
-mostlyclean-recursive distclean-recursive clean-recursive \
+clean-libtool maintainer-clean-libtool mostlyclean-bfdlibLTLIBRARIES \
+distclean-bfdlibLTLIBRARIES clean-bfdlibLTLIBRARIES \
+maintainer-clean-bfdlibLTLIBRARIES uninstall-bfdlibLTLIBRARIES \
+install-bfdlibLTLIBRARIES install-data-recursive \
+uninstall-data-recursive install-exec-recursive \
+uninstall-exec-recursive installdirs-recursive uninstalldirs-recursive \
+all-recursive check-recursive installcheck-recursive info-recursive \
+dvi-recursive mostlyclean-recursive distclean-recursive clean-recursive \
maintainer-clean-recursive tags tags-recursive mostlyclean-tags \
distclean-tags clean-tags maintainer-clean-tags distdir info-am info \
dvi-am dvi check check-am installcheck-am installcheck install-info-am \
install-info all-recursive-am install-exec-am install-exec \
-install-data-local install-data-am install-data install-am install \
-uninstall-am uninstall all-redirect all-am all installdirs-am \
-installdirs mostlyclean-generic distclean-generic clean-generic \
-maintainer-clean-generic clean mostlyclean distclean maintainer-clean
+install-data-am install-data install-am install uninstall-am uninstall \
+all-redirect all-am all installdirs-am installdirs mostlyclean-generic \
+distclean-generic clean-generic maintainer-clean-generic clean \
+mostlyclean distclean maintainer-clean
po/SRC-POTFILES.in: @MAINT@ Makefile $(SRC_POTFILES)
@@ -1230,14 +748,35 @@ $(BFD32_LIBS) \
$(BFD64_BACKENDS) \
$(OPTIONAL_BACKENDS): $(BFD_H) $(BFD_H_DEPS) $(LOCAL_H_DEPS)
-# Install BFD include file, and others that it needs.
-install-data-local: $(BFD_H)
+install-bfdlibLTLIBRARIES: @INSTALL_LIBBFD_TRUE@install_libbfd
@$(NORMAL_INSTALL)
- $(mkinstalldirs) $(DESTDIR)$(includedir)
- $(INSTALL_DATA) $(BFD_H) $(DESTDIR)$(includedir)/bfd.h
- $(INSTALL_DATA) $(INCDIR)/ansidecl.h $(DESTDIR)$(includedir)/ansidecl.h
- $(INSTALL_DATA) $(INCDIR)/symcat.h $(DESTDIR)$(includedir)/symcat.h
- $(INSTALL_DATA) $(INCDIR)/bfdlink.h $(DESTDIR)$(includedir)/bfdlink.h
+
+uninstall-bfdlibLTLIBRARIES: @INSTALL_LIBBFD_TRUE@uninstall_libbfd
+ @$(NORMAL_UNINSTALL)
+
+.PHONY: install_libbfd uninstall_libbfd
+install_libbfd: $(bfdlib_LTLIBRARIES) $(BFD_H)
+ $(mkinstalldirs) $(DESTDIR)$(bfdlibdir)
+ $(mkinstalldirs) $(DESTDIR)$(bfdincludedir)
+ @list='$(bfdlib_LTLIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ echo "$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(bfdlibdir)/$$p"; \
+ $(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(bfdlibdir)/$$p; \
+ else :; fi; \
+ done
+ $(INSTALL_DATA) $(BFD_H) $(DESTDIR)$(bfdincludedir)/bfd.h
+ $(INSTALL_DATA) $(INCDIR)/ansidecl.h $(DESTDIR)$(bfdincludedir)/ansidecl.h
+ $(INSTALL_DATA) $(INCDIR)/symcat.h $(DESTDIR)$(bfdincludedir)/symcat.h
+ $(INSTALL_DATA) $(INCDIR)/bfdlink.h $(DESTDIR)$(bfdincludedir)/bfdlink.h
+
+uninstall_libbfd:
+ list='$(bfdlib_LTLIBRARIES)'; for p in $$list; do \
+ $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(bfdlibdir)/$$p; \
+ done
+ rm -f $(DESTDIR)$(bfdincludedir)/bfd.h
+ rm -f $(DESTDIR)$(bfdincludedir)/ansidecl.h
+ rm -f $(DESTDIR)$(bfdincludedir)/symcat.h
+ rm -f $(DESTDIR)$(bfdincludedir)/bfdlink.h
Makefile: $(srcdir)/configure.in
@@ -1375,7 +914,8 @@ stabs.lo: stabs.c $(INCDIR)/filenames.h $(INCDIR)/aout/stab_gnu.h \
$(INCDIR)/aout/stab.def $(INCDIR)/safe-ctype.h
stab-syms.lo: stab-syms.c libaout.h $(INCDIR)/bfdlink.h \
$(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab.def
-merge.lo: merge.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
+merge.lo: merge.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
+ $(INCDIR)/libiberty.h
dwarf2.lo: dwarf2.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/dwarf2.h
@@ -1388,6 +928,7 @@ cpu-avr.lo: cpu-avr.c $(INCDIR)/filenames.h
cpu-cris.lo: cpu-cris.c $(INCDIR)/filenames.h
cpu-d10v.lo: cpu-d10v.c $(INCDIR)/filenames.h
cpu-d30v.lo: cpu-d30v.c $(INCDIR)/filenames.h
+cpu-dlx.lo: cpu-dlx.c $(INCDIR)/filenames.h
cpu-fr30.lo: cpu-fr30.c $(INCDIR)/filenames.h
cpu-h8300.lo: cpu-h8300.c $(INCDIR)/filenames.h
cpu-h8500.lo: cpu-h8500.c $(INCDIR)/filenames.h
@@ -1604,6 +1145,10 @@ elf32-d30v.lo: elf32-d30v.c $(INCDIR)/filenames.h elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/bfdlink.h $(INCDIR)/elf/d30v.h $(INCDIR)/elf/reloc-macros.h \
elf32-target.h
+elf32-dlx.lo: elf32-dlx.c $(INCDIR)/filenames.h elf-bfd.h \
+ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
+ $(INCDIR)/bfdlink.h $(INCDIR)/elf/dlx.h $(INCDIR)/elf/reloc-macros.h \
+ elf32-target.h
elf32-fr30.lo: elf32-fr30.c $(INCDIR)/filenames.h elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/bfdlink.h $(INCDIR)/elf/fr30.h $(INCDIR)/elf/reloc-macros.h \
@@ -1626,6 +1171,10 @@ elf32-i386.lo: elf32-i386.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/elf/i386.h $(INCDIR)/elf/reloc-macros.h \
elf32-target.h
+elf32-i386qnx.lo: elf32-i386qnx.c elf32-i386.c $(INCDIR)/filenames.h \
+ $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
+ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/i386.h \
+ $(INCDIR)/elf/reloc-macros.h elf32-target.h
elf32-i860.lo: elf32-i860.c $(INCDIR)/filenames.h elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/bfdlink.h $(INCDIR)/elf/i860.h $(INCDIR)/elf/reloc-macros.h \
@@ -1697,6 +1246,10 @@ elf32-sh64.lo: elf32-sh64.c $(INCDIR)/filenames.h elf-bfd.h \
$(INCDIR)/bfdlink.h $(srcdir)/../opcodes/sh64-opc.h \
elf32-sh.c $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \
elf32-target.h
+elf32-sh64-com.lo: elf32-sh64-com.c $(INCDIR)/filenames.h \
+ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
+ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/sh.h \
+ $(INCDIR)/elf/reloc-macros.h $(srcdir)/../opcodes/sh64-opc.h
elf32-s390.lo: elf32-s390.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/elf/s390.h $(INCDIR)/elf/reloc-macros.h \
@@ -1713,6 +1266,11 @@ elf32-sh-nbsd.lo: elf32-sh-nbsd.c elf32-sh.c $(INCDIR)/filenames.h \
$(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h \
$(INCDIR)/elf/reloc-macros.h elf32-target.h
+elf32-sh64-nbsd.lo: elf32-sh64-nbsd.c elf32-sh64.c \
+ $(INCDIR)/filenames.h elf-bfd.h $(INCDIR)/elf/common.h \
+ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
+ $(srcdir)/../opcodes/sh64-opc.h elf32-sh.c $(INCDIR)/elf/sh.h \
+ $(INCDIR)/elf/reloc-macros.h elf32-target.h
elf32-sparc.lo: elf32-sparc.c $(INCDIR)/filenames.h \
$(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sparc.h \
@@ -1722,6 +1280,10 @@ elf32-v850.lo: elf32-v850.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/elf/v850.h $(INCDIR)/elf/reloc-macros.h \
$(INCDIR)/libiberty.h elf32-target.h
+elf32-vax.lo: elf32-vax.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
+ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
+ $(INCDIR)/elf/external.h $(INCDIR)/elf/vax.h $(INCDIR)/elf/reloc-macros.h \
+ elf32-target.h
elf32-xstormy16.lo: elf32-xstormy16.c $(INCDIR)/filenames.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/xstormy16.h \
@@ -1736,7 +1298,7 @@ elflink.lo: elflink.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
$(INCDIR)/elf/external.h
elf-strtab.lo: elf-strtab.c $(INCDIR)/filenames.h elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
- $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h
+ $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h $(INCDIR)/libiberty.h
elf-eh-frame.lo: elf-eh-frame.c $(INCDIR)/filenames.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/dwarf2.h
@@ -1906,6 +1468,9 @@ sunos.lo: sunos.c $(INCDIR)/bfdlink.h libaout.h aoutf1.h \
vaxnetbsd.lo: vaxnetbsd.c netbsd.h $(INCDIR)/filenames.h \
libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \
$(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
+vax1knetbsd.lo: vax1knetbsd.c netbsd.h $(INCDIR)/filenames.h \
+ libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \
+ $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
versados.lo: versados.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h
vms.lo: vms.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
vms.h
@@ -1982,6 +1547,10 @@ elf64-sh64.lo: elf64-sh64.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \
elf64-target.h
+elf64-sh64-nbsd.lo: elf64-sh64-nbsd.c elf64-sh64.c \
+ $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h elf-bfd.h \
+ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
+ $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h elf64-target.h
elf64-sparc.lo: elf64-sparc.c $(INCDIR)/filenames.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/opcode/sparc.h \
diff --git a/bfd/acinclude.m4 b/bfd/acinclude.m4
index 53912943d2c..b3c6ccffb6c 100644
--- a/bfd/acinclude.m4
+++ b/bfd/acinclude.m4
@@ -123,3 +123,27 @@ ifelse(yes,no,[
AC_DEFUN([CY_WITH_NLS],)
AC_SUBST(INTLLIBS)
])
+
+AC_DEFUN([AM_INSTALL_LIBBFD],
+[AC_MSG_CHECKING([whether to install libbfd])
+ AC_ARG_ENABLE(install-libbfd,
+[ --install-libbfd controls installation of libbfd and related headers],
+ install_libbfd_p=$enableval,
+ if test "${host}" = "${target}" -o "$enable_shared" = "yes"; then
+ install_libbfd_p=yes
+ else
+ install_libbfd_p=no
+ fi)
+ AC_MSG_RESULT($install_libbfd_p)
+ AM_CONDITIONAL(INSTALL_LIBBFD, test $install_libbfd_p = yes)
+ # libbfd.a is a host library containing target dependent code
+ bfdlibdir='$(libdir)'
+ bfdincludedir='$(includedir)'
+ if test "${host}" != "${target}"; then
+ bfdlibdir='$(exec_prefix)/$(host_alias)/$(target_alias)/lib'
+ bfdincludedir='$(exec_prefix)/$(host_alias)/$(target_alias)/include'
+ fi
+ AC_SUBST(bfdlibdir)
+ AC_SUBST(bfdincludedir)
+]
+)
diff --git a/bfd/aclocal.m4 b/bfd/aclocal.m4
index 4446fc1569a..b6dfcbe31d0 100644
--- a/bfd/aclocal.m4
+++ b/bfd/aclocal.m4
@@ -136,6 +136,43 @@ AC_DEFUN([CY_WITH_NLS],)
AC_SUBST(INTLLIBS)
])
+AC_DEFUN([AM_INSTALL_LIBBFD],
+[AC_MSG_CHECKING([whether to install libbfd])
+ AC_ARG_ENABLE(install-libbfd,
+[ --install-libbfd controls installation of libbfd and related headers],
+ install_libbfd_p=$enableval,
+ if test "${host}" = "${target}" -o "$enable_shared" = "yes"; then
+ install_libbfd_p=yes
+ else
+ install_libbfd_p=no
+ fi)
+ AC_MSG_RESULT($install_libbfd_p)
+ AM_CONDITIONAL(INSTALL_LIBBFD, test $install_libbfd_p = yes)
+ # libbfd.a is a host library containing target dependent code
+ bfdlibdir='$(libdir)'
+ bfdincludedir='$(includedir)'
+ if test "${host}" != "${target}"; then
+ bfdlibdir='$(exec_prefix)/$(host_alias)/$(target_alias)/lib'
+ bfdincludedir='$(exec_prefix)/$(host_alias)/$(target_alias)/include'
+ fi
+ AC_SUBST(bfdlibdir)
+ AC_SUBST(bfdincludedir)
+]
+)
+
+# Define a conditional.
+
+AC_DEFUN([AM_CONDITIONAL],
+[AC_SUBST($1_TRUE)
+AC_SUBST($1_FALSE)
+if $2; then
+ $1_TRUE=
+ $1_FALSE='#'
+else
+ $1_TRUE='#'
+ $1_FALSE=
+fi])
+
# Do all the work for Automake. This macro actually does too much --
# some checks are only needed if your package does certain things.
# But this isn't really a big deal.
@@ -271,16 +308,3 @@ AC_DEFUN([AM_MAINTAINER_MODE],
]
)
-# Define a conditional.
-
-AC_DEFUN([AM_CONDITIONAL],
-[AC_SUBST($1_TRUE)
-AC_SUBST($1_FALSE)
-if $2; then
- $1_TRUE=
- $1_FALSE='#'
-else
- $1_TRUE='#'
- $1_FALSE=
-fi])
-
diff --git a/bfd/aix5ppc-core.c b/bfd/aix5ppc-core.c
index 5ba182f735b..9db4f5468c4 100644
--- a/bfd/aix5ppc-core.c
+++ b/bfd/aix5ppc-core.c
@@ -63,7 +63,7 @@ xcoff64_core_p (abfd)
goto xcoff64_core_p_error;
if (sizeof (struct core_dumpxx)
- != bfd_read (&core, sizeof (struct core_dumpxx), 1, abfd))
+ != bfd_bread (&core, sizeof (struct core_dumpxx), abfd))
goto xcoff64_core_p_error;
if (bfd_stat (abfd, &statbuf) < 0)
@@ -172,7 +172,7 @@ xcoff64_core_p (abfd)
return return_value;
if (sizeof (struct __ld_info64) !=
- bfd_read (&ldinfo, sizeof (struct __ld_info64), 1, abfd))
+ bfd_bread (&ldinfo, sizeof (struct __ld_info64), abfd))
return return_value;
if (ldinfo.ldinfo_core)
@@ -200,7 +200,7 @@ xcoff64_core_p (abfd)
for (i = 0; i < core.c_vmregions; i++)
if (sizeof (struct vm_infox) !=
- bfd_read (&vminfo, sizeof (struct vm_infox), 1, abfd))
+ bfd_bread (&vminfo, sizeof (struct vm_infox), abfd))
return return_value;
if (vminfo.vminfo_offset)
@@ -243,7 +243,7 @@ xcoff64_core_file_matches_executable_p (core_bfd, exec_bfd)
return return_value;
if (sizeof (struct core_dumpxx) !=
- bfd_read (&core, sizeof (struct core_dumpxx), 1, core_bfd))
+ bfd_bread (&core, sizeof (struct core_dumpxx), core_bfd))
return return_value;
if (bfd_seek (core_bfd, core.c_loader, SEEK_SET) != 0)
@@ -258,7 +258,7 @@ xcoff64_core_file_matches_executable_p (core_bfd, exec_bfd)
while (1)
{
- if (bfd_read (s, 1, 1, core_bfd) != 1)
+ if (bfd_bread (s, 1, core_bfd) != 1)
goto xcoff64_core_file_matches_executable_p_end_1;
if (*s == '\0')
@@ -328,7 +328,7 @@ int xcoff64_core_file_failing_signal PARAMS ((bfd *));
const bfd_target *
xcoff64_core_p (abfd)
- bfd *abfd;
+ bfd *abfd ATTRIBUTE_UNUSED;
{
bfd_set_error (bfd_error_wrong_format);
return 0;
@@ -336,22 +336,22 @@ xcoff64_core_p (abfd)
boolean
xcoff64_core_file_matches_executable_p (core_bfd, exec_bfd)
- bfd *core_bfd;
- bfd *exec_bfd;
+ bfd *core_bfd ATTRIBUTE_UNUSED;
+ bfd *exec_bfd ATTRIBUTE_UNUSED;
{
return false;
}
char *
xcoff64_core_file_failing_command (abfd)
- bfd *abfd;
+ bfd *abfd ATTRIBUTE_UNUSED;
{
return 0;
}
int
xcoff64_core_file_failing_signal (abfd)
- bfd *abfd;
+ bfd *abfd ATTRIBUTE_UNUSED;
{
return 0;
}
diff --git a/bfd/aout-adobe.c b/bfd/aout-adobe.c
index 01f26914d2e..83983398aa7 100644
--- a/bfd/aout-adobe.c
+++ b/bfd/aout-adobe.c
@@ -510,11 +510,13 @@ aout_adobe_sizeof_headers (ignore_abfd, ignore)
#define aout_32_bfd_relax_section bfd_generic_relax_section
#define aout_32_bfd_gc_sections bfd_generic_gc_sections
#define aout_32_bfd_merge_sections bfd_generic_merge_sections
+#define aout_32_bfd_discard_group bfd_generic_discard_group
#define aout_32_bfd_link_hash_table_create \
_bfd_generic_link_hash_table_create
#define aout_32_bfd_link_hash_table_free \
_bfd_generic_link_hash_table_free
#define aout_32_bfd_link_add_symbols _bfd_generic_link_add_symbols
+#define aout_32_bfd_link_just_syms _bfd_generic_link_just_syms
#define aout_32_bfd_final_link _bfd_generic_final_link
#define aout_32_bfd_link_split_section _bfd_generic_link_split_section
diff --git a/bfd/aout-target.h b/bfd/aout-target.h
index 30c735a3f8f..75299fa8180 100644
--- a/bfd/aout-target.h
+++ b/bfd/aout-target.h
@@ -513,6 +513,9 @@ MY_bfd_final_link (abfd, info)
#ifndef MY_bfd_merge_sections
#define MY_bfd_merge_sections bfd_generic_merge_sections
#endif
+#ifndef MY_bfd_discard_group
+#define MY_bfd_discard_group bfd_generic_discard_group
+#endif
#ifndef MY_bfd_reloc_type_lookup
#define MY_bfd_reloc_type_lookup NAME(aout,reloc_type_lookup)
#endif
@@ -534,6 +537,9 @@ MY_bfd_final_link (abfd, info)
#ifndef MY_bfd_link_add_symbols
#define MY_bfd_link_add_symbols NAME(aout,link_add_symbols)
#endif
+#ifndef MY_bfd_link_just_syms
+#define MY_bfd_link_just_syms _bfd_generic_link_just_syms
+#endif
#ifndef MY_bfd_link_split_section
#define MY_bfd_link_split_section _bfd_generic_link_split_section
#endif
diff --git a/bfd/aout-tic30.c b/bfd/aout-tic30.c
index 58ef3ea9f8a..a39a5b1fb88 100644
--- a/bfd/aout-tic30.c
+++ b/bfd/aout-tic30.c
@@ -965,6 +965,9 @@ tic30_aout_set_arch_mach (abfd, arch, machine)
#ifndef MY_bfd_merge_sections
#define MY_bfd_merge_sections bfd_generic_merge_sections
#endif
+#ifndef MY_bfd_discard_group
+#define MY_bfd_discard_group bfd_generic_discard_group
+#endif
#ifndef MY_bfd_reloc_type_lookup
#define MY_bfd_reloc_type_lookup tic30_aout_reloc_type_lookup
#endif
@@ -986,6 +989,9 @@ tic30_aout_set_arch_mach (abfd, arch, machine)
#ifndef MY_bfd_link_add_symbols
#define MY_bfd_link_add_symbols NAME(aout,link_add_symbols)
#endif
+#ifndef MY_bfd_link_just_syms
+#define MY_bfd_link_just_syms _bfd_generic_link_just_syms
+#endif
#ifndef MY_bfd_link_split_section
#define MY_bfd_link_split_section _bfd_generic_link_split_section
#endif
diff --git a/bfd/aoutx.h b/bfd/aoutx.h
index 3c9cd4fafc8..c2448f4a575 100644
--- a/bfd/aoutx.h
+++ b/bfd/aoutx.h
@@ -1837,11 +1837,9 @@ NAME(aout,slurp_symbol_table) (abfd)
cached_size = obj_aout_external_sym_count (abfd);
cached_size *= sizeof (aout_symbol_type);
- cached = (aout_symbol_type *) bfd_malloc (cached_size);
+ cached = (aout_symbol_type *) bfd_zmalloc (cached_size);
if (cached == NULL && cached_size != 0)
return false;
- if (cached_size != 0)
- memset (cached, 0, (size_t) cached_size);
/* Convert from external symbol information to internal. */
if (! (NAME(aout,translate_symbol_table)
@@ -2411,10 +2409,9 @@ NAME(aout,slurp_reloc_table) (abfd, asect, symbols)
count = reloc_size / each_size;
amt = count * sizeof (arelent);
- reloc_cache = (arelent *) bfd_malloc (amt);
+ reloc_cache = (arelent *) bfd_zmalloc (amt);
if (reloc_cache == NULL && count != 0)
return false;
- memset (reloc_cache, 0, (size_t) amt);
relocs = bfd_malloc (reloc_size);
if (relocs == NULL && reloc_size != 0)
diff --git a/bfd/archures.c b/bfd/archures.c
index 40102e8b0f1..36fc56873d5 100644
--- a/bfd/archures.c
+++ b/bfd/archures.c
@@ -193,6 +193,7 @@ DESCRIPTION
.#define bfd_mach_d10v_ts2 2
.#define bfd_mach_d10v_ts3 3
. bfd_arch_d30v, {* Mitsubishi D30V *}
+. bfd_arch_dlx, {* DLX *}
. bfd_arch_m68hc11, {* Motorola 68HC11 *}
. bfd_arch_m68hc12, {* Motorola 68HC12 *}
. bfd_arch_z8k, {* Zilog Z8000 *}
@@ -312,6 +313,7 @@ extern const bfd_arch_info_type bfd_avr_arch;
extern const bfd_arch_info_type bfd_cris_arch;
extern const bfd_arch_info_type bfd_d10v_arch;
extern const bfd_arch_info_type bfd_d30v_arch;
+extern const bfd_arch_info_type bfd_dlx_arch;
extern const bfd_arch_info_type bfd_fr30_arch;
extern const bfd_arch_info_type bfd_h8300_arch;
extern const bfd_arch_info_type bfd_h8500_arch;
@@ -365,6 +367,7 @@ static const bfd_arch_info_type * const bfd_archures_list[] =
&bfd_cris_arch,
&bfd_d10v_arch,
&bfd_d30v_arch,
+ &bfd_dlx_arch,
&bfd_fr30_arch,
&bfd_h8300_arch,
&bfd_h8500_arch,
diff --git a/bfd/armnetbsd.c b/bfd/armnetbsd.c
index e899adbdde5..d82e98f49eb 100644
--- a/bfd/armnetbsd.c
+++ b/bfd/armnetbsd.c
@@ -1,5 +1,5 @@
/* BFD back-end for NetBSD/ARM a.out-ish binaries.
- Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -44,7 +44,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfd.h" /* To ensure following declaration is OK */
-CONST struct reloc_howto_struct *
+const struct reloc_howto_struct *
MY_bfd_reloc_type_lookup
PARAMS ((bfd * abfd AND
bfd_reloc_code_real_type code));
diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h
index 8c36c67bd15..19fd1072084 100644
--- a/bfd/bfd-in.h
+++ b/bfd/bfd-in.h
@@ -4,21 +4,21 @@
Free Software Foundation, Inc.
Contributed 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. */
#ifndef __BFD_H_SEEN__
#define __BFD_H_SEEN__
@@ -803,6 +803,9 @@ extern boolean bfd_elf32_arm_process_before_allocation
extern boolean bfd_elf32_arm_get_bfd_for_interworking
PARAMS ((bfd *, struct bfd_link_info *));
+extern boolean bfd_elf32_arm_add_glue_sections_to_bfd
+ PARAMS ((bfd *, struct bfd_link_info *));
+
/* TI COFF load page support. */
extern void bfd_ticoff_set_section_load_page
PARAMS ((struct sec *, int));
@@ -810,4 +813,3 @@ extern void bfd_ticoff_set_section_load_page
extern int bfd_ticoff_get_section_load_page
PARAMS ((struct sec *));
-/* And more from the source. */
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index 774d4391557..e4319ff91d7 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -10,21 +10,21 @@
Free Software Foundation, Inc.
Contributed 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. */
#ifndef __BFD_H_SEEN__
#define __BFD_H_SEEN__
@@ -809,6 +809,9 @@ extern boolean bfd_elf32_arm_process_before_allocation
extern boolean bfd_elf32_arm_get_bfd_for_interworking
PARAMS ((bfd *, struct bfd_link_info *));
+extern boolean bfd_elf32_arm_add_glue_sections_to_bfd
+ PARAMS ((bfd *, struct bfd_link_info *));
+
/* TI COFF load page support. */
extern void bfd_ticoff_set_section_load_page
PARAMS ((struct sec *, int));
@@ -816,10 +819,11 @@ extern void bfd_ticoff_set_section_load_page
extern int bfd_ticoff_get_section_load_page
PARAMS ((struct sec *));
-/* And more from the source. */
+/* Extracted from init.c. */
void
bfd_init PARAMS ((void));
+/* Extracted from opncls.c. */
bfd *
bfd_openr PARAMS ((const char *filename, const char *target));
@@ -847,6 +851,7 @@ bfd_make_writable PARAMS ((bfd *abfd));
boolean
bfd_make_readable PARAMS ((bfd *abfd));
+/* Extracted from libbfd.c. */
/* Byte swapping macros for user section data. */
@@ -987,6 +992,7 @@ bfd_make_readable PARAMS ((bfd *abfd));
#define H_GET_S8 bfd_h_get_signed_8
+/* Extracted from section.c. */
/* This structure is used for a comdat section, as in PE. A comdat
section is associated with a particular symbol. When the linker
sees a comdat section, it keeps only one of the sections with a
@@ -1068,12 +1074,6 @@ typedef struct sec
standard data. */
#define SEC_CONSTRUCTOR 0x100
- /* The section is a constructor, and should be placed at the
- end of the text, data, or bss section(?). */
-#define SEC_CONSTRUCTOR_TEXT 0x1100
-#define SEC_CONSTRUCTOR_DATA 0x2100
-#define SEC_CONSTRUCTOR_BSS 0x3100
-
/* The section has contents - a data section could be
<<SEC_ALLOC>> | <<SEC_HAS_CONTENTS>>; a debug section could be
<<SEC_HAS_CONTENTS>> */
@@ -1094,6 +1094,9 @@ typedef struct sec
sections. */
#define SEC_COFF_SHARED_LIBRARY 0x800
+ /* The section contains thread local data. */
+#define SEC_THREAD_LOCAL 0x1000
+
/* The section has GOT references. This flag is only for the
linker, and is currently only used by the elf32-hppa back end.
It will be set if global offset table references were detected
@@ -1450,6 +1453,10 @@ bfd_copy_private_section_data PARAMS ((bfd *ibfd, asection *isec,
void
_bfd_strip_section_from_output PARAMS ((struct bfd_link_info *info, asection *section));
+boolean
+bfd_generic_discard_group PARAMS ((bfd *abfd, asection *group));
+
+/* Extracted from archures.c. */
enum bfd_architecture
{
bfd_arch_unknown, /* File arch not known. */
@@ -1576,6 +1583,7 @@ enum bfd_architecture
#define bfd_mach_d10v_ts2 2
#define bfd_mach_d10v_ts3 3
bfd_arch_d30v, /* Mitsubishi D30V */
+ bfd_arch_dlx, /* DLX */
bfd_arch_m68hc11, /* Motorola 68HC11 */
bfd_arch_m68hc12, /* Motorola 68HC12 */
bfd_arch_z8k, /* Zilog Z8000 */
@@ -1722,6 +1730,7 @@ unsigned int
bfd_arch_mach_octets_per_byte PARAMS ((enum bfd_architecture arch,
unsigned long machine));
+/* Extracted from reloc.c. */
typedef enum bfd_reloc_status
{
/* No errors detected. */
@@ -2147,6 +2156,21 @@ share a common GP, and the target address is adjusted for
STO_ALPHA_STD_GPLOAD. */
BFD_RELOC_ALPHA_BRSGP,
+/* Alpha thread-local storage relocations. */
+ BFD_RELOC_ALPHA_TLSGD,
+ BFD_RELOC_ALPHA_TLSLDM,
+ BFD_RELOC_ALPHA_DTPMOD64,
+ BFD_RELOC_ALPHA_GOTDTPREL16,
+ BFD_RELOC_ALPHA_DTPREL64,
+ BFD_RELOC_ALPHA_DTPREL_HI16,
+ BFD_RELOC_ALPHA_DTPREL_LO16,
+ BFD_RELOC_ALPHA_DTPREL16,
+ BFD_RELOC_ALPHA_GOTTPREL16,
+ BFD_RELOC_ALPHA_TPREL64,
+ BFD_RELOC_ALPHA_TPREL_HI16,
+ BFD_RELOC_ALPHA_TPREL_LO16,
+ BFD_RELOC_ALPHA_TPREL16,
+
/* Bits 27..2 of the relocation address shifted right 2 bits;
simple reloc otherwise. */
BFD_RELOC_MIPS_JMP,
@@ -2211,6 +2235,15 @@ to compensate for the borrow when the low bits are added. */
BFD_RELOC_386_RELATIVE,
BFD_RELOC_386_GOTOFF,
BFD_RELOC_386_GOTPC,
+ BFD_RELOC_386_TLS_LE,
+ BFD_RELOC_386_TLS_GD,
+ BFD_RELOC_386_TLS_LDM,
+ BFD_RELOC_386_TLS_LDO_32,
+ BFD_RELOC_386_TLS_IE_32,
+ BFD_RELOC_386_TLS_LE_32,
+ BFD_RELOC_386_TLS_DTPMOD32,
+ BFD_RELOC_386_TLS_DTPOFF32,
+ BFD_RELOC_386_TLS_TPOFF32,
/* x86-64/elf relocations */
BFD_RELOC_X86_64_GOT32,
@@ -2515,6 +2548,15 @@ of the container. */
/* This is a 32-bit pc-relative reloc. */
BFD_RELOC_D30V_32_PCREL,
+/* DLX relocs */
+ BFD_RELOC_DLX_HI16_S,
+
+/* DLX relocs */
+ BFD_RELOC_DLX_LO16,
+
+/* DLX relocs */
+ BFD_RELOC_DLX_JMP26,
+
/* Mitsubishi M32R relocs.
This is a 24 bit absolute address. */
BFD_RELOC_M32R_24,
@@ -2922,12 +2964,25 @@ this offset in the reloc's section offset. */
BFD_RELOC_IA64_IPLTMSB,
BFD_RELOC_IA64_IPLTLSB,
BFD_RELOC_IA64_COPY,
+ BFD_RELOC_IA64_LTOFF22X,
+ BFD_RELOC_IA64_LDXMOV,
+ BFD_RELOC_IA64_TPREL14,
BFD_RELOC_IA64_TPREL22,
+ BFD_RELOC_IA64_TPREL64I,
BFD_RELOC_IA64_TPREL64MSB,
BFD_RELOC_IA64_TPREL64LSB,
- BFD_RELOC_IA64_LTOFF_TP22,
- BFD_RELOC_IA64_LTOFF22X,
- BFD_RELOC_IA64_LDXMOV,
+ BFD_RELOC_IA64_LTOFF_TPREL22,
+ BFD_RELOC_IA64_DTPMOD64MSB,
+ BFD_RELOC_IA64_DTPMOD64LSB,
+ BFD_RELOC_IA64_LTOFF_DTPMOD22,
+ BFD_RELOC_IA64_DTPREL14,
+ BFD_RELOC_IA64_DTPREL22,
+ BFD_RELOC_IA64_DTPREL64I,
+ BFD_RELOC_IA64_DTPREL32MSB,
+ BFD_RELOC_IA64_DTPREL32LSB,
+ BFD_RELOC_IA64_DTPREL64MSB,
+ BFD_RELOC_IA64_DTPREL64LSB,
+ BFD_RELOC_IA64_LTOFF_DTPREL22,
/* Motorola 68HC11 reloc.
This is the 8 bits high part of an absolute address. */
@@ -3025,6 +3080,11 @@ This is the 3 bits of a value. */
BFD_RELOC_XSTORMY16_REL_12,
BFD_RELOC_XSTORMY16_24,
BFD_RELOC_XSTORMY16_FPTR16,
+
+/* Relocations used by VAX ELF. */
+ BFD_RELOC_VAX_GLOB_DAT,
+ BFD_RELOC_VAX_JMP_SLOT,
+ BFD_RELOC_VAX_RELATIVE,
BFD_RELOC_UNUSED };
typedef enum bfd_reloc_code_real bfd_reloc_code_real_type;
reloc_howto_type *
@@ -3033,6 +3093,7 @@ bfd_reloc_type_lookup PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
const char *
bfd_get_reloc_code_name PARAMS ((bfd_reloc_code_real_type code));
+/* Extracted from syms.c. */
typedef struct symbol_cache_entry
{
@@ -3138,6 +3199,9 @@ typedef struct symbol_cache_entry
as well. */
#define BSF_DEBUGGING_RELOC 0x20000
+ /* This symbol is thread local. Used in ELF. */
+#define BSF_THREAD_LOCAL 0x40000
+
flagword flags;
/* A pointer to the section to which this symbol is
@@ -3202,6 +3266,7 @@ bfd_copy_private_symbol_data PARAMS ((bfd *ibfd, asymbol *isym, bfd *obfd, asymb
BFD_SEND (obfd, _bfd_copy_private_symbol_data, \
(ibfd, isymbol, obfd, osymbol))
+/* Extracted from bfd.c. */
struct _bfd
{
/* The filename the application opened the BFD with. */
@@ -3501,6 +3566,9 @@ bfd_set_private_flags PARAMS ((bfd *abfd, flagword flags));
#define bfd_merge_sections(abfd, link_info) \
BFD_SEND (abfd, _bfd_merge_sections, (abfd, link_info))
+#define bfd_discard_group(abfd, sec) \
+ BFD_SEND (abfd, _bfd_discard_group, (abfd, sec))
+
#define bfd_link_hash_table_create(abfd) \
BFD_SEND (abfd, _bfd_link_hash_table_create, (abfd))
@@ -3510,6 +3578,9 @@ bfd_set_private_flags PARAMS ((bfd *abfd, flagword flags));
#define bfd_link_add_symbols(abfd, info) \
BFD_SEND (abfd, _bfd_link_add_symbols, (abfd, info))
+#define bfd_link_just_syms(sec, info) \
+ BFD_SEND (abfd, _bfd_link_just_syms, (sec, info))
+
#define bfd_final_link(abfd, info) \
BFD_SEND (abfd, _bfd_final_link, (abfd, info))
@@ -3539,6 +3610,7 @@ extern bfd_byte *bfd_get_relocated_section_contents
boolean
bfd_alt_mach_code PARAMS ((bfd *abfd, int index));
+/* Extracted from archive.c. */
symindex
bfd_get_next_mapent PARAMS ((bfd *abfd, symindex previous, carsym **sym));
@@ -3548,6 +3620,7 @@ bfd_set_archive_head PARAMS ((bfd *output, bfd *new_head));
bfd *
bfd_openr_next_archived_file PARAMS ((bfd *archive, bfd *previous));
+/* Extracted from corefile.c. */
const char *
bfd_core_file_failing_command PARAMS ((bfd *abfd));
@@ -3557,6 +3630,7 @@ bfd_core_file_failing_signal PARAMS ((bfd *abfd));
boolean
core_file_matches_executable_p PARAMS ((bfd *core_bfd, bfd *exec_bfd));
+/* Extracted from targets.c. */
#define BFD_SEND(bfd, message, arglist) \
((*((bfd)->xvec->message)) arglist)
@@ -3834,10 +3908,12 @@ CONCAT2 (NAME,_bfd_relax_section), \
CONCAT2 (NAME,_bfd_link_hash_table_create), \
CONCAT2 (NAME,_bfd_link_hash_table_free), \
CONCAT2 (NAME,_bfd_link_add_symbols), \
+CONCAT2 (NAME,_bfd_link_just_syms), \
CONCAT2 (NAME,_bfd_final_link), \
CONCAT2 (NAME,_bfd_link_split_section), \
CONCAT2 (NAME,_bfd_gc_sections), \
-CONCAT2 (NAME,_bfd_merge_sections)
+CONCAT2 (NAME,_bfd_merge_sections), \
+CONCAT2 (NAME,_bfd_discard_group)
int (*_bfd_sizeof_headers) PARAMS ((bfd *, boolean));
bfd_byte *(*_bfd_get_relocated_section_contents)
PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *,
@@ -3856,6 +3932,9 @@ CONCAT2 (NAME,_bfd_merge_sections)
/* Add symbols from this object file into the hash table. */
boolean (*_bfd_link_add_symbols) PARAMS ((bfd *, struct bfd_link_info *));
+ /* Indicate that we are only retrieving symbol values from this section. */
+ void (*_bfd_link_just_syms) PARAMS ((asection *, struct bfd_link_info *));
+
/* Do a link based on the link_order structures attached to each
section of the BFD. */
boolean (*_bfd_final_link) PARAMS ((bfd *, struct bfd_link_info *));
@@ -3869,6 +3948,9 @@ CONCAT2 (NAME,_bfd_merge_sections)
/* Attempt to merge SEC_MERGE sections. */
boolean (*_bfd_merge_sections) PARAMS ((bfd *, struct bfd_link_info *));
+ /* Discard members of a group. */
+ boolean (*_bfd_discard_group) PARAMS ((bfd *, struct sec *));
+
/* Routines to handle dynamic symbols and relocs. */
#define BFD_JUMP_TABLE_DYNAMIC(NAME) \
CONCAT2 (NAME,_get_dynamic_symtab_upper_bound), \
@@ -3907,6 +3989,7 @@ bfd_target_list PARAMS ((void));
const bfd_target *
bfd_search_for_target PARAMS ((int (* search_func) (const bfd_target *, void *), void *));
+/* Extracted from format.c. */
boolean
bfd_check_format PARAMS ((bfd *abfd, bfd_format format));
diff --git a/bfd/bfd.c b/bfd/bfd.c
index c1135c817dd..d230aac5af6 100644
--- a/bfd/bfd.c
+++ b/bfd/bfd.c
@@ -749,7 +749,6 @@ bfd_get_arch_size (abfd)
if (abfd->xvec->flavour == bfd_target_elf_flavour)
return (get_elf_backend_data (abfd))->s->arch_size;
- bfd_set_error (bfd_error_wrong_format);
return -1;
}
@@ -1186,6 +1185,9 @@ DESCRIPTION
.#define bfd_merge_sections(abfd, link_info) \
. BFD_SEND (abfd, _bfd_merge_sections, (abfd, link_info))
.
+.#define bfd_discard_group(abfd, sec) \
+. BFD_SEND (abfd, _bfd_discard_group, (abfd, sec))
+.
.#define bfd_link_hash_table_create(abfd) \
. BFD_SEND (abfd, _bfd_link_hash_table_create, (abfd))
.
@@ -1195,6 +1197,9 @@ DESCRIPTION
.#define bfd_link_add_symbols(abfd, info) \
. BFD_SEND (abfd, _bfd_link_add_symbols, (abfd, info))
.
+.#define bfd_link_just_syms(sec, info) \
+. BFD_SEND (abfd, _bfd_link_just_syms, (sec, info))
+.
.#define bfd_final_link(abfd, info) \
. BFD_SEND (abfd, _bfd_final_link, (abfd, info))
.
diff --git a/bfd/binary.c b/bfd/binary.c
index 3207e89fceb..fc972b22d13 100644
--- a/bfd/binary.c
+++ b/bfd/binary.c
@@ -337,8 +337,10 @@ binary_sizeof_headers (abfd, exec)
#define binary_bfd_relax_section bfd_generic_relax_section
#define binary_bfd_gc_sections bfd_generic_gc_sections
#define binary_bfd_merge_sections bfd_generic_merge_sections
+#define binary_bfd_discard_group bfd_generic_discard_group
#define binary_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
#define binary_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
+#define binary_bfd_link_just_syms _bfd_generic_link_just_syms
#define binary_bfd_link_add_symbols _bfd_generic_link_add_symbols
#define binary_bfd_final_link _bfd_generic_final_link
#define binary_bfd_link_split_section _bfd_generic_link_split_section
diff --git a/bfd/bout.c b/bfd/bout.c
index 0e070adcbf1..9550956e089 100644
--- a/bfd/bout.c
+++ b/bfd/bout.c
@@ -1451,10 +1451,12 @@ b_out_bfd_get_relocated_section_contents (output_bfd, link_info, link_order,
#define b_out_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
#define b_out_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
#define b_out_bfd_link_add_symbols _bfd_generic_link_add_symbols
+#define b_out_bfd_link_just_syms _bfd_generic_link_just_syms
#define b_out_bfd_final_link _bfd_generic_final_link
#define b_out_bfd_link_split_section _bfd_generic_link_split_section
#define b_out_bfd_gc_sections bfd_generic_gc_sections
#define b_out_bfd_merge_sections bfd_generic_merge_sections
+#define b_out_bfd_discard_group bfd_generic_discard_group
#define aout_32_get_section_contents_in_window \
_bfd_generic_get_section_contents_in_window
diff --git a/bfd/coff-alpha.c b/bfd/coff-alpha.c
index 4056e2ce6e7..4f3ab57ef6c 100644
--- a/bfd/coff-alpha.c
+++ b/bfd/coff-alpha.c
@@ -1,5 +1,5 @@
/* BFD back-end for ALPHA Extended-Coff files.
- Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+ Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
Free Software Foundation, Inc.
Modified from coff-mips.c by Steve Chamberlain <sac@cygnus.com> and
Ian Lance Taylor <ian@cygnus.com>.
@@ -2356,6 +2356,7 @@ static const struct ecoff_backend_data alpha_ecoff_backend_data =
#define _bfd_ecoff_bfd_relax_section bfd_generic_relax_section
#define _bfd_ecoff_bfd_gc_sections bfd_generic_gc_sections
#define _bfd_ecoff_bfd_merge_sections bfd_generic_merge_sections
+#define _bfd_ecoff_bfd_discard_group bfd_generic_discard_group
const bfd_target ecoffalpha_little_vec =
{
diff --git a/bfd/coff-arm.c b/bfd/coff-arm.c
index 1619e670c3d..5e7f907a959 100644
--- a/bfd/coff-arm.c
+++ b/bfd/coff-arm.c
@@ -1701,21 +1701,23 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section,
|| signed_check < reloc_signed_min)
overflow = true;
- /* For the BLX(1) instruction remove bit 0 of the adjusted offset.
- Bit 0 can only be set if the upper insn is at a half-word boundary,
- since the destination address, an ARM instruction, must always be
- on a word boundary. The semantics of the BLX (1) instruction,
- however, are that bit 0 in the offset must always be 0, and the
- corresponding bit 1 in the target address will be set from bit
- 1 of the source address. */
- if ((x & 0x18000000) == 0x08000000)
- relocation &= ~0x2;
-
- /* Put the relocation into the correct bits. */
+ /* Put the relocation into the correct bits.
+ For a BLX instruction, make sure that the relocation is rounded up
+ to a word boundary. This follows the semantics of the instruction
+ which specifies that bit 1 of the target address will come from bit
+ 1 of the base address. */
if (bfd_big_endian (input_bfd))
- relocation = (((relocation & 0xffe) >> 1) | ((relocation << 4) & 0x07ff0000));
+ {
+ if ((x & 0x1800) == 0x0800 && (relocation & 0x02))
+ relocation += 2;
+ relocation = (((relocation & 0xffe) >> 1) | ((relocation << 4) & 0x07ff0000));
+ }
else
- relocation = (((relocation & 0xffe) << 15) | ((relocation >> 12) & 0x7ff));
+ {
+ if ((x & 0x18000000) == 0x08000000 && (relocation & 0x02))
+ relocation += 2;
+ relocation = (((relocation & 0xffe) << 15) | ((relocation >> 12) & 0x7ff));
+ }
/* Add the relocation to the correct bits of X. */
x = ((x & ~howto->dst_mask) | relocation);
diff --git a/bfd/coff-mips.c b/bfd/coff-mips.c
index 672b07f7762..edccd5cbbee 100644
--- a/bfd/coff-mips.c
+++ b/bfd/coff-mips.c
@@ -1,6 +1,6 @@
/* BFD back-end for MIPS Extended-Coff files.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001
+ 2000, 2001, 2002
Free Software Foundation, Inc.
Original version by Per Bothner.
Full support added by Ian Lance Taylor, ian@cygnus.com.
@@ -2116,10 +2116,9 @@ mips_relax_section (abfd, sec, info, again)
bfd_size_type size;
size = (bfd_size_type) sec->reloc_count * sizeof (long);
- offsets = (long *) bfd_alloc (abfd, size);
+ offsets = (long *) bfd_zalloc (abfd, size);
if (offsets == (long *) NULL)
goto error_return;
- memset (offsets, 0, (size_t) size);
section_tdata->offsets = offsets;
}
@@ -2602,6 +2601,8 @@ static const struct ecoff_backend_data mips_ecoff_backend_data =
/* Merging of sections is not done. */
#define _bfd_ecoff_bfd_merge_sections bfd_generic_merge_sections
+#define _bfd_ecoff_bfd_discard_group bfd_generic_discard_group
+
extern const bfd_target ecoff_big_vec;
const bfd_target ecoff_little_vec =
diff --git a/bfd/coff-rs6000.c b/bfd/coff-rs6000.c
index 10ef5dfd777..a18aa5e9054 100644
--- a/bfd/coff-rs6000.c
+++ b/bfd/coff-rs6000.c
@@ -237,7 +237,7 @@ _bfd_xcoff_mkobject (abfd)
xcoff_data (abfd)->debug_indices = NULL;
/* text section alignment is different than the default */
- /* xcoff_data (abfd)->text_align_power = 5; */
+ bfd_xcoff_text_align_power (abfd) = 2;
return true;
}
@@ -278,8 +278,8 @@ _bfd_xcoff_copy_private_bfd_data (ibfd, obfd)
else
ox->snentry = sec->output_section->target_index;
}
- ox->text_align_power = ix->text_align_power;
- ox->data_align_power = ix->data_align_power;
+ bfd_xcoff_text_align_power (obfd) = bfd_xcoff_text_align_power (ibfd);
+ bfd_xcoff_data_align_power (obfd) = bfd_xcoff_data_align_power (ibfd);
ox->modtype = ix->modtype;
ox->cputype = ix->cputype;
ox->maxdata = ix->maxdata;
@@ -948,6 +948,21 @@ reloc_howto_type xcoff_howto_table[] =
0xffff, /* dst_mask */
false), /* pcrel_offset */
+ /* Modifiable branch relative. */
+ HOWTO (R_RBA, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ 0, /* special_function */
+ "R_RBA_16", /* name */
+ true, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ false), /* pcrel_offset */
+
};
void
@@ -968,6 +983,8 @@ xcoff_rtype2howto (relent, internal)
relent->howto = &xcoff_howto_table[0x1c];
else if (R_RBR == internal->r_type)
relent->howto = &xcoff_howto_table[0x1d];
+ else if (R_RBA == internal->r_type)
+ relent->howto = &xcoff_howto_table[0x1e];
}
/* The r_size field of an XCOFF reloc encodes the bitsize of the
@@ -1713,7 +1730,6 @@ do_shared_object_padding (out_bfd, in_bfd, offset, ar_header_size)
int text_align_power;
text_align_power = bfd_xcoff_text_align_power (in_bfd);
- BFD_ASSERT (2 < text_align_power);
pad = 1 << text_align_power;
pad -= (*offset + ar_header_size) & (pad - 1);
@@ -1822,10 +1838,9 @@ xcoff_write_armap_big (abfd, elength, map, orl_count, stridx)
+ str_32 + (str_32 & 1);
symbol_table = NULL;
- symbol_table = (bfd_byte *) bfd_malloc (symbol_table_size);
+ symbol_table = (bfd_byte *) bfd_zmalloc (symbol_table_size);
if (symbol_table == NULL)
return false;
- memset (symbol_table, 0, symbol_table_size);
hdr = (struct xcoff_ar_hdr_big *) symbol_table;
@@ -1926,10 +1941,9 @@ xcoff_write_armap_big (abfd, elength, map, orl_count, stridx)
+ str_64 + (str_64 & 1);
symbol_table = NULL;
- symbol_table = (bfd_byte *) bfd_malloc (symbol_table_size);
+ symbol_table = (bfd_byte *) bfd_zmalloc (symbol_table_size);
if (symbol_table == NULL)
return false;
- memset (symbol_table, 0, symbol_table_size);
hdr = (struct xcoff_ar_hdr_big *) symbol_table;
@@ -2440,10 +2454,9 @@ xcoff_write_archive_contents_big (abfd)
member_table_size += member_table_size & 1;
member_table = NULL;
- member_table = (bfd_byte *) bfd_malloc (member_table_size);
+ member_table = (bfd_byte *) bfd_zmalloc (member_table_size);
if (member_table == NULL)
return false;
- memset (member_table, 0, member_table_size);
hdr = (struct xcoff_ar_hdr_big *) member_table;
@@ -3702,11 +3715,9 @@ xcoff_generate_rtinit (abfd, init, fini, rtld)
data_buffer_size = 0x0040 + initsz + finisz;
data_buffer_size += (data_buffer_size & 7) ? 8 - (data_buffer_size & 7) : 0;
data_buffer = NULL;
- data_buffer = (bfd_byte *) bfd_malloc (data_buffer_size);
+ data_buffer = (bfd_byte *) bfd_zmalloc (data_buffer_size);
if (data_buffer == NULL)
return false;
-
- memset (data_buffer, 0, data_buffer_size);
if (initsz)
{
@@ -3740,8 +3751,10 @@ xcoff_generate_rtinit (abfd, init, fini, rtld)
if (string_table_size)
{
string_table_size += 4;
- string_table = (bfd_byte *)bfd_malloc (string_table_size);
- memset (string_table, 0, string_table_size);
+ string_table = (bfd_byte *) bfd_zmalloc (string_table_size);
+ if (string_table_size == NULL)
+ return false;
+
val = string_table_size;
bfd_h_put_32 (abfd, val, &string_table[0]);
st_tmp = string_table + 4;
@@ -4167,10 +4180,12 @@ const bfd_target rs6000coff_vec =
_bfd_xcoff_bfd_link_hash_table_create, /* _bfd_link_hash_table_create */
_bfd_generic_link_hash_table_free, /* _bfd_link_hash_table_free */
_bfd_xcoff_bfd_link_add_symbols, /* _bfd_link_add_symbols */
- _bfd_xcoff_bfd_final_link, /* _bfd_filnal_link */
+ _bfd_generic_link_just_syms, /* _bfd_link_just_syms */
+ _bfd_xcoff_bfd_final_link, /* _bfd_final_link */
_bfd_generic_link_split_section, /* _bfd_link_split_section */
bfd_generic_gc_sections, /* _bfd_gc_sections */
bfd_generic_merge_sections, /* _bfd_merge_sections */
+ bfd_generic_discard_group, /* _bfd_discard_group */
/* Dynamic */
/* _get_dynamic_symtab_upper_bound */
@@ -4428,10 +4443,12 @@ const bfd_target pmac_xcoff_vec =
_bfd_xcoff_bfd_link_hash_table_create, /* _bfd_link_hash_table_create */
_bfd_generic_link_hash_table_free, /* _bfd_link_hash_table_free */
_bfd_xcoff_bfd_link_add_symbols, /* _bfd_link_add_symbols */
- _bfd_xcoff_bfd_final_link, /* _bfd_filnal_link */
+ _bfd_generic_link_just_syms, /* _bfd_link_just_syms */
+ _bfd_xcoff_bfd_final_link, /* _bfd_final_link */
_bfd_generic_link_split_section, /* _bfd_link_split_section */
bfd_generic_gc_sections, /* _bfd_gc_sections */
- bfd_generic_merge_sections, /* _bfd_merge_sections */
+ bfd_generic_merge_sections, /* _bfd_merge_sections */
+ bfd_generic_discard_group, /* _bfd_discard_group */
/* Dynamic */
/* _get_dynamic_symtab_upper_bound */
diff --git a/bfd/coff-sh.c b/bfd/coff-sh.c
index ae739968f75..d1dc4fdbcf7 100644
--- a/bfd/coff-sh.c
+++ b/bfd/coff-sh.c
@@ -473,6 +473,7 @@ struct shcoff_reloc_map
unsigned char shcoff_reloc_val;
};
+#ifdef COFF_WITH_PE
/* An array mapping BFD reloc codes to SH PE relocs. */
static const struct shcoff_reloc_map sh_reloc_map[] =
{
@@ -480,6 +481,14 @@ static const struct shcoff_reloc_map sh_reloc_map[] =
{ BFD_RELOC_RVA, R_SH_IMAGEBASE },
{ BFD_RELOC_CTOR, R_SH_IMM32CE },
};
+#else
+/* An array mapping BFD reloc codes to SH PE relocs. */
+static const struct shcoff_reloc_map sh_reloc_map[] =
+{
+ { BFD_RELOC_32, R_SH_IMM32 },
+ { BFD_RELOC_CTOR, R_SH_IMM32 },
+};
+#endif
/* Given a BFD reloc code, return the howto structure for the
corresponding SH PE reloc. */
diff --git a/bfd/coff64-rs6000.c b/bfd/coff64-rs6000.c
index 931a914cbf6..c7fe5ac5e73 100644
--- a/bfd/coff64-rs6000.c
+++ b/bfd/coff64-rs6000.c
@@ -424,7 +424,7 @@ _bfd_xcoff64_swap_aux_out (abfd, inp, type, class, indx, numaux, extp)
switch (class)
{
case C_FILE:
- if (ext->x_file.x_n.x_zeroes == 0)
+ if (in->x_file.x_n.x_zeroes == 0)
{
H_PUT_32 (abfd, 0, ext->x_file.x_n.x_zeroes);
H_PUT_32 (abfd, in->x_file.x_n.x_offset, ext->x_file.x_n.x_offset);
@@ -1730,6 +1730,22 @@ reloc_howto_type xcoff64_howto_table[] =
0xffff, /* src_mask */
0xffff, /* dst_mask */
false), /* pcrel_offset */
+
+ /* Modifiable branch absolute. */
+ HOWTO (R_RBA, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ 0, /* special_function */
+ "R_RBA_16", /* name */
+ true, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ false), /* pcrel_offset */
+
};
void
@@ -1750,6 +1766,8 @@ xcoff64_rtype2howto (relent, internal)
relent->howto = &xcoff64_howto_table[0x1d];
else if (R_RBR == internal->r_type)
relent->howto = &xcoff64_howto_table[0x1e];
+ else if (R_RBA == internal->r_type)
+ relent->howto = &xcoff64_howto_table[0x1f];
}
/* Special case 32 bit */
else if (31 == (internal->r_size & 0x3f))
@@ -2246,12 +2264,10 @@ xcoff64_generate_rtinit (abfd, init, fini, rtld)
data_buffer_size = 0x0058 + initsz + finisz;
data_buffer_size += (data_buffer_size & 7) ? 8 - (data_buffer_size & 7) : 0;
data_buffer = NULL;
- data_buffer = (bfd_byte *)bfd_malloc (data_buffer_size);
+ data_buffer = (bfd_byte *) bfd_zmalloc (data_buffer_size);
if (data_buffer == NULL)
return false;
- memset (data_buffer, 0, data_buffer_size);
-
if (initsz)
{
val = 0x18;
@@ -2284,8 +2300,10 @@ xcoff64_generate_rtinit (abfd, init, fini, rtld)
if (true == rtld)
string_table_size += strlen (rtld_name) + 1;
- string_table = (bfd_byte *)bfd_malloc (string_table_size);
- memset (string_table, 0, string_table_size);
+ string_table = (bfd_byte *) bfd_zmalloc (string_table_size);
+ if (string_table == NULL)
+ return false;
+
val = string_table_size;
bfd_put_32 (abfd, val, &string_table[0]);
st_tmp = string_table + 4;
@@ -2712,10 +2730,12 @@ const bfd_target rs6000coff64_vec =
_bfd_xcoff_bfd_link_hash_table_create,/* _bfd_link_hash_table_create */
_bfd_generic_link_hash_table_free, /* _bfd_link_hash_table_free */
_bfd_xcoff_bfd_link_add_symbols, /* _bfd_link_add_symbols */
- _bfd_xcoff_bfd_final_link, /* _bfd_filnal_link */
+ _bfd_generic_link_just_syms, /* _bfd_link_just_syms */
+ _bfd_xcoff_bfd_final_link, /* _bfd_final_link */
_bfd_generic_link_split_section, /* _bfd_link_split_section */
bfd_generic_gc_sections, /* _bfd_gc_sections */
bfd_generic_merge_sections, /* _bfd_merge_sections */
+ bfd_generic_discard_group, /* _bfd_discard_group */
/* Dynamic */
/* _get_dynamic_symtab_upper_bound */
@@ -2964,10 +2984,12 @@ const bfd_target aix5coff64_vec =
_bfd_xcoff_bfd_link_hash_table_create,/* _bfd_link_hash_table_create */
_bfd_generic_link_hash_table_free, /* _bfd_link_hash_table_free */
_bfd_xcoff_bfd_link_add_symbols, /* _bfd_link_add_symbols */
- _bfd_xcoff_bfd_final_link, /* _bfd_filnal_link */
+ _bfd_generic_link_just_syms, /* _bfd_link_just_syms */
+ _bfd_xcoff_bfd_final_link, /* _bfd_final_link */
_bfd_generic_link_split_section, /* _bfd_link_split_section */
bfd_generic_gc_sections, /* _bfd_gc_sections */
bfd_generic_merge_sections, /* _bfd_merge_sections */
+ bfd_generic_discard_group, /* _bfd_discard_group */
/* Dynamic */
/* _get_dynamic_symtab_upper_bound */
diff --git a/bfd/coffcode.h b/bfd/coffcode.h
index eadb8984be8..0363bb7b364 100644
--- a/bfd/coffcode.h
+++ b/bfd/coffcode.h
@@ -1782,8 +1782,8 @@ coff_mkobject_hook (abfd, filehdr, aouthdr)
xcoff->toc = internal_a->o_toc;
xcoff->sntoc = internal_a->o_sntoc;
xcoff->snentry = internal_a->o_snentry;
- xcoff->text_align_power = internal_a->o_algntext;
- xcoff->data_align_power = internal_a->o_algndata;
+ bfd_xcoff_text_align_power (abfd) = internal_a->o_algntext;
+ bfd_xcoff_data_align_power (abfd) = internal_a->o_algndata;
xcoff->modtype = internal_a->o_modtype;
xcoff->cputype = internal_a->o_cputype;
xcoff->maxdata = internal_a->o_maxdata;
@@ -3084,8 +3084,10 @@ coff_compute_section_file_positions (abfd)
AIX executable is stripped with gnu strip because the default vma
of native is 0x10000150 but default for gnu is 0x10000140. Gnu
stripped gnu excutable passes this check because the filepos is
- 0x0140. */
- if (!strcmp (current->name, _TEXT))
+ 0x0140. This problem also show up with 64 bit shared objects. The
+ data section must also be aligned. */
+ if (!strcmp (current->name, _TEXT)
+ || !strcmp (current->name, _DATA))
{
bfd_vma pad;
bfd_vma align;
@@ -5175,6 +5177,7 @@ dummy_reloc16_extra_cases (abfd, link_info, link_order, reloc, data, src_ptr,
#define coff_bfd_final_link _bfd_generic_final_link
#endif /* ! defined (coff_relocate_section) */
+#define coff_bfd_link_just_syms _bfd_generic_link_just_syms
#define coff_bfd_link_split_section _bfd_generic_link_split_section
#ifndef coff_start_final_link
@@ -5371,6 +5374,10 @@ static const bfd_coff_backend_data bfd_coff_std_swap_table =
#define coff_bfd_merge_sections bfd_generic_merge_sections
#endif
+#ifndef coff_bfd_discard_group
+#define coff_bfd_discard_group bfd_generic_discard_group
+#endif
+
#define CREATE_BIG_COFF_TARGET_VEC(VAR, NAME, EXTRA_O_FLAGS, EXTRA_S_FLAGS, UNDER, ALTERNATIVE) \
const bfd_target VAR = \
{ \
diff --git a/bfd/coffgen.c b/bfd/coffgen.c
index 88591f1499d..71179fbb552 100644
--- a/bfd/coffgen.c
+++ b/bfd/coffgen.c
@@ -1,6 +1,6 @@
/* Support for the generic parts of COFF, for BFD.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001
+ 2000, 2001, 2002
Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -1438,13 +1438,13 @@ coff_section_symbol (abfd, name)
combined_entry_type e[10];
};
struct foo *f;
- f = (struct foo *) bfd_alloc (abfd, (bfd_size_type) sizeof (*f));
+
+ f = (struct foo *) bfd_zalloc (abfd, (bfd_size_type) sizeof (*f));
if (!f)
{
bfd_set_error (bfd_error_no_error);
return NULL;
}
- memset ((char *) f, 0, sizeof (*f));
coff_symbol_from (abfd, sym)->native = csym = f->e;
}
csym[0].u.syment.n_sclass = C_STAT;
@@ -1835,10 +1835,9 @@ coff_get_normalized_symtab (abfd)
if (internal_ptr->u.syment._n._n_name[i] == '\0')
break;
- newstring = (PTR) bfd_alloc (abfd, (bfd_size_type) (i + 1));
+ newstring = (PTR) bfd_zalloc (abfd, (bfd_size_type) (i + 1));
if (newstring == NULL)
return (NULL);
- memset (newstring, 0, i + 1);
strncpy (newstring, internal_ptr->u.syment._n._n_name, i);
internal_ptr->u.syment._n._n_n._n_offset = (long int) newstring;
internal_ptr->u.syment._n._n_n._n_zeroes = 0;
@@ -1897,10 +1896,9 @@ coff_make_empty_symbol (abfd)
bfd *abfd;
{
bfd_size_type amt = sizeof (coff_symbol_type);
- coff_symbol_type *new = (coff_symbol_type *) bfd_alloc (abfd, amt);
+ coff_symbol_type *new = (coff_symbol_type *) bfd_zalloc (abfd, amt);
if (new == NULL)
return (NULL);
- memset (new, 0, sizeof *new);
new->symbol.section = 0;
new->native = 0;
new->lineno = (alent *) NULL;
@@ -2453,12 +2451,10 @@ bfd_coff_set_symbol_class (abfd, symbol, class)
combined_entry_type * native;
bfd_size_type amt = sizeof (* native);
- native = (combined_entry_type *) bfd_alloc (abfd, amt);
+ native = (combined_entry_type *) bfd_zalloc (abfd, amt);
if (native == NULL)
return false;
- memset (native, 0, sizeof (* native));
-
native->u.syment.n_type = T_NULL;
native->u.syment.n_sclass = class;
diff --git a/bfd/cofflink.c b/bfd/cofflink.c
index 1eac3c58ce8..32200a83a63 100644
--- a/bfd/cofflink.c
+++ b/bfd/cofflink.c
@@ -342,12 +342,10 @@ coff_link_add_symbols (abfd, info)
/* We keep a list of the linker hash table entries that correspond
to particular symbols. */
amt = symcount * sizeof (struct coff_link_hash_entry *);
- sym_hash = (struct coff_link_hash_entry **) bfd_alloc (abfd, amt);
+ sym_hash = (struct coff_link_hash_entry **) bfd_zalloc (abfd, amt);
if (sym_hash == NULL && symcount != 0)
goto error_return;
obj_coff_sym_hashes (abfd) = sym_hash;
- memset (sym_hash, 0,
- (size_t) symcount * sizeof (struct coff_link_hash_entry *));
symesz = bfd_coff_symesz (abfd);
BFD_ASSERT (symesz == bfd_coff_auxesz (abfd));
diff --git a/bfd/config.bfd b/bfd/config.bfd
index 4cc12425a85..520c36bcb4e 100644
--- a/bfd/config.bfd
+++ b/bfd/config.bfd
@@ -35,6 +35,7 @@ alpha*) targ_archs=bfd_alpha_arch ;;
arm*) targ_archs=bfd_arm_arch ;;
c30*) targ_archs=bfd_tic30_arch ;;
c54x*) targ_archs=bfd_tic54x_arch ;;
+dlx*) targ_archs=bfd_dlx_arch ;;
hppa*) targ_archs=bfd_hppa_arch ;;
i[3456]86) targ_archs=bfd_i386_arch ;;
i370) targ_archs=bfd_i370_arch ;;
@@ -57,7 +58,6 @@ v850*) targ_archs=bfd_v850_arch ;;
x86_64) targ_archs=bfd_i386_arch ;;
xscale*) targ_archs=bfd_arm_arch ;;
z8k*) targ_archs=bfd_z8k_arch ;;
-sh*) targ_archs=bfd_sh_arch ;;
*) targ_archs=bfd_${targ_cpu}_arch ;;
esac
@@ -70,7 +70,7 @@ esac
case "${targ}" in
# START OF targmatch.h
#ifdef BFD64
- alpha*-*-netbsd* | alpha*-*-freebsd*)
+ alpha*-*-netbsd* | alpha*-*-freebsd* | alpha*-*-openbsd*)
targ_defvec=bfd_elf64_alpha_vec
targ_selvecs=ecoffalpha_little_vec
;;
@@ -104,7 +104,7 @@ case "${targ}" in
targ_defvec=bfd_elf32_ia64_hpux_big_vec
targ_selvecs="bfd_elf64_ia64_hpux_big_vec"
;;
- sparc64-*-freebsd* | sparc64-*-netbsd*)
+ sparc64-*-freebsd* | sparc64-*-netbsd* | sparc64-*-openbsd*)
targ_defvec=bfd_elf64_sparc_vec
targ_selvecs="bfd_elf32_sparc_vec sunos_big_vec"
;;
@@ -115,12 +115,17 @@ case "${targ}" in
targ_selvecs=bfd_elf32_bigarc_vec
;;
+ armeb-*-netbsdelf*)
+ targ_defvec=bfd_elf32_bigarm_vec
+ targ_selvecs="bfd_elf32_littlearm_vec armnetbsd_vec"
+ ;;
arm-*-netbsdelf*)
targ_defvec=bfd_elf32_littlearm_vec
targ_selvecs="bfd_elf32_bigarm_vec armnetbsd_vec"
;;
arm-*-netbsd* | arm-*-openbsd*)
targ_defvec=armnetbsd_vec
+ targ_selvecs="bfd_elf32_littlearm_vec bfd_elf32_bigarm_vec"
targ_underscore=yes
;;
arm-*-riscix*)
@@ -263,6 +268,11 @@ case "${targ}" in
targ_defvec=bfd_elf32_d10v_vec
;;
+ dlx-*-elf*)
+ targ_defvec=bfd_elf32_dlx_big_vec
+ targ_selvecs="bfd_elf32_dlx_big_vec"
+ ;;
+
d30v-*-*)
targ_defvec=bfd_elf32_d30v_vec
;;
@@ -303,7 +313,7 @@ case "${targ}" in
targ_defvec=bfd_elf32_hppa_linux_vec
targ_selvecs=bfd_elf32_hppa_vec
;;
- hppa*-*-*elf* | hppa*-*-lites* | hppa*-*-netbsd* | hppa*-*-sysv4* | hppa*-*-rtems*)
+ hppa*-*-*elf* | hppa*-*-lites* | hppa*-*-netbsd* | hppa*-*-sysv4* | hppa*-*-rtems* | hppa*-*-openbsd*)
targ_defvec=bfd_elf32_hppa_vec
targ_selvecs=bfd_elf32_hppa_linux_vec
;;
@@ -336,6 +346,10 @@ case "${targ}" in
targ_defvec=bfd_elf32_i386_vec
targ_selvecs=i386coff_vec
;;
+ i[3456]86-*-nto-qnx*)
+ targ_defvec=bfd_elf32_i386qnx_vec
+ targ_selvecs=i386coff_vec
+ ;;
i[3456]86-*-chorus*)
targ_defvec=bfd_elf32_i386_vec
;;
@@ -377,6 +391,10 @@ case "${targ}" in
targ_defvec=bfd_elf32_i386_vec
targ_selvecs=i386netbsd_vec
;;
+ i[3456]86-*-netbsdpe*)
+ targ_defvec=i386pe_vec
+ targ_selvecs="i386pe_vec i386pei_vec bfd_elf32_i386_vec"
+ ;;
i[3456]86-*-netbsdaout* | i[3456]86-*-netbsd* | i[3456]86-*-openbsd*)
targ_defvec=i386netbsd_vec
targ_selvecs="bfd_elf32_i386_vec i386bsd_vec"
@@ -858,11 +876,24 @@ case "${targ}" in
#endif
#ifdef BFD64
+ sh64l*-*-elf*)
+ targ_defvec=bfd_elf32_sh64l_vec
+ targ_selvecs="bfd_elf32_sh64_vec bfd_elf64_sh64l_vec bfd_elf64_sh64_vec bfd_elf32_shl_vec bfd_elf32_sh_vec"
+ targ_underscore=yes
+ ;;
sh64-*-elf*)
targ_defvec=bfd_elf32_sh64_vec
targ_selvecs="bfd_elf32_sh64l_vec bfd_elf64_sh64_vec bfd_elf64_sh64l_vec bfd_elf32_sh_vec bfd_elf32_shl_vec"
targ_underscore=yes
;;
+ sh64eb-*-linux*)
+ targ_defvec=bfd_elf32_shblin_vec
+ targ_selvecs="bfd_elf32_shblin_vec bfd_elf32_sh64_vec bfd_elf64_sh64_vec bfd_elf32_sh_vec"
+ ;;
+ sh64-*-linux*)
+ targ_defvec=bfd_elf32_shlin_vec
+ targ_selvecs="bfd_elf32_shlin_vec bfd_elf32_sh64l_vec bfd_elf64_sh64l_vec bfd_elf32_shl_vec"
+ ;;
#endif /* BFD64 */
sh-*-linux*)
@@ -879,6 +910,33 @@ case "${targ}" in
targ_defvec=bfd_elf32_shlin_vec
;;
+#ifdef BFD64
+ sh5le-*-netbsd*)
+ targ_defvec=bfd_elf32_sh64lnbsd_vec
+ targ_selvecs="bfd_elf32_sh64nbsd_vec bfd_elf64_sh64lnbsd_vec bfd_elf64_sh64nbsd_vec"
+ ;;
+ sh5-*-netbsd*)
+ targ_defvec=bfd_elf32_sh64nbsd_vec
+ targ_selvecs="bfd_elf32_sh64lnbsd_vec bfd_elf64_sh64lnbsd_vec bfd_elf64_sh64nbsd_vec"
+ ;;
+
+ sh64le-*-netbsd*)
+ targ_defvec=bfd_elf64_sh64lnbsd_vec
+ targ_selvecs="bfd_elf64_sh64nbsd_vec bfd_elf32_sh64lnbsd_vec bfd_elf32_sh64nbsd_vec"
+ ;;
+ sh64-*-netbsd*)
+ targ_defvec=bfd_elf64_sh64nbsd_vec
+ targ_selvecs="bfd_elf64_sh64lnbsd_vec bfd_elf32_sh64lnbsd_vec bfd_elf32_sh64nbsd_vec"
+ ;;
+#endif
+
+ shle-*-netbsdelf*)
+ targ_defvec=bfd_elf32_shlnbsd_vec
+ targ_selvecs="bfd_elf32_shnbsd_vec shcoff_vec shlcoff_vec"
+#ifdef BFD64
+ targ_selvecs="${targ_selvecs} bfd_elf32_sh64_vec bfd_elf32_sh64l_vec bfd_elf64_sh64_vec bfd_elf64_sh64l_vec"
+#endif
+ ;;
sh*le-*-netbsdelf*)
targ_defvec=bfd_elf32_shlnbsd_vec
targ_selvecs="bfd_elf32_shnbsd_vec shcoff_vec shlcoff_vec"
@@ -895,7 +953,15 @@ case "${targ}" in
targ_selvecs="bfd_elf32_shlnbsd_vec shcoff_vec shlcoff_vec"
;;
- sh-*-elf* | sh-*-rtemself*)
+ shl*-*-elf* | sh[1234]l*-*-elf* | sh3el*-*-elf*)
+ targ_defvec=bfd_elf32_shl_vec
+ targ_selvecs="bfd_elf32_sh_vec shlcoff_vec shcoff_vec shlcoff_small_vec shcoff_small_vec"
+#ifdef BFD64
+ targ_selvecs="${targ_selvecs} bfd_elf32_sh64_vec bfd_elf32_sh64l_vec bfd_elf64_sh64_vec bfd_elf64_sh64l_vec"
+#endif
+ targ_underscore=yes
+ ;;
+ sh-*-elf* | sh[1234]*-elf* | sh-*-rtemself*)
targ_defvec=bfd_elf32_sh_vec
targ_selvecs="bfd_elf32_shl_vec shcoff_vec shlcoff_vec shcoff_small_vec shlcoff_small_vec"
#ifdef BFD64
@@ -1032,6 +1098,17 @@ case "${targ}" in
;;
#endif
+ vax-*-netbsdelf*)
+ targ_defvec=bfd_elf32_vax_vec
+ targ_selvecs="vaxnetbsd_vec vax1knetbsd_vec"
+ ;;
+
+ vax-*-netbsdaout* | vax-*-netbsd*)
+ targ_defvec=vaxnetbsd_vec
+ targ_selvecs="bfd_elf32_vax_vec vax1knetbsd_vec"
+ targ_underscore=yes
+ ;;
+
vax*-*-*vms*)
targ_defvec=vms_vax_vec
;;
diff --git a/bfd/config.in b/bfd/config.in
index e0b0c20ccd2..222096e3c02 100644
--- a/bfd/config.in
+++ b/bfd/config.in
@@ -214,6 +214,9 @@
/* Define if getenv is not declared in system header files. */
#undef NEED_DECLARATION_GETENV
+/* Define if struct core_dumpx has member c_impl */
+#undef HAVE_ST_C_IMPL
+
/* Define if <sys/procfs.h> has prstatus_t. */
#undef HAVE_PRSTATUS_T
diff --git a/bfd/configure b/bfd/configure
index 47f3348d2d4..a17601132fa 100755
--- a/bfd/configure
+++ b/bfd/configure
@@ -37,6 +37,8 @@ ac_help="$ac_help
--enable-maintainer-mode enable make rules and dependencies not useful
(and sometimes confusing) to the casual installer"
ac_help="$ac_help
+ --install-libbfd controls installation of libbfd and related headers"
+ac_help="$ac_help
--disable-nls do not use Native Language Support"
ac_help="$ac_help
--with-included-gettext use the GNU gettext library included here"
@@ -57,7 +59,6 @@ program_suffix=NONE
program_transform_name=s,x,x,
silent=
site=
-sitefile=
srcdir=
target=NONE
verbose=
@@ -172,7 +173,6 @@ Configuration:
--help print this message
--no-create do not create output files
--quiet, --silent do not print \`checking...' messages
- --site-file=FILE use FILE as the site file
--version print the version of autoconf that created configure
Directory and file names:
--prefix=PREFIX install architecture-independent files in PREFIX
@@ -343,11 +343,6 @@ EOF
-site=* | --site=* | --sit=*)
site="$ac_optarg" ;;
- -site-file | --site-file | --site-fil | --site-fi | --site-f)
- ac_prev=sitefile ;;
- -site-file=* | --site-file=* | --site-fil=* | --site-fi=* | --site-f=*)
- sitefile="$ac_optarg" ;;
-
-srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
ac_prev=srcdir ;;
-srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
@@ -513,16 +508,12 @@ fi
srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
# Prefer explicitly selected file to automatically selected ones.
-if test -z "$sitefile"; then
- if test -z "$CONFIG_SITE"; then
- if test "x$prefix" != xNONE; then
- CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
- else
- CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
- fi
+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
-else
- CONFIG_SITE="$sitefile"
fi
for ac_site_file in $CONFIG_SITE; do
if test -r "$ac_site_file"; then
@@ -561,12 +552,12 @@ else
fi
echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6
-echo "configure:565: checking for Cygwin environment" >&5
+echo "configure:556: 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 570 "configure"
+#line 561 "configure"
#include "confdefs.h"
int main() {
@@ -577,7 +568,7 @@ int main() {
return __CYGWIN__;
; return 0; }
EOF
-if { (eval echo configure:581: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:572: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_cygwin=yes
else
@@ -594,19 +585,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:598: checking for mingw32 environment" >&5
+echo "configure:589: 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 603 "configure"
+#line 594 "configure"
#include "confdefs.h"
int main() {
return __MINGW32__;
; return 0; }
EOF
-if { (eval echo configure:610: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:601: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_mingw32=yes
else
@@ -671,7 +662,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:675: checking host system type" >&5
+echo "configure:666: checking host system type" >&5
host_alias=$host
case "$host_alias" in
@@ -692,7 +683,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:696: checking target system type" >&5
+echo "configure:687: checking target system type" >&5
target_alias=$target
case "$target_alias" in
@@ -710,7 +701,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:714: checking build system type" >&5
+echo "configure:705: checking build system type" >&5
build_alias=$build
case "$build_alias" in
@@ -735,7 +726,7 @@ test "$host_alias" != "$target_alias" &&
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:739: checking for $ac_word" >&5
+echo "configure:730: 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
@@ -765,7 +756,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:769: checking for $ac_word" >&5
+echo "configure:760: 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
@@ -816,7 +807,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:820: checking for $ac_word" >&5
+echo "configure:811: 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
@@ -848,7 +839,7 @@ fi
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:852: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:843: 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.
@@ -859,12 +850,12 @@ cross_compiling=$ac_cv_prog_cc_cross
cat > conftest.$ac_ext << EOF
-#line 863 "configure"
+#line 854 "configure"
#include "confdefs.h"
main(){return(0);}
EOF
-if { (eval echo configure:868: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:859: \"$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
@@ -890,12 +881,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:894: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:885: 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:899: checking whether we are using GNU C" >&5
+echo "configure:890: 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
@@ -904,7 +895,7 @@ else
yes;
#endif
EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:908: \"$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:899: \"$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
@@ -923,7 +914,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:927: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:918: 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
@@ -955,7 +946,7 @@ else
fi
echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6
-echo "configure:959: checking for POSIXized ISC" >&5
+echo "configure:950: 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
@@ -988,7 +979,7 @@ fi
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:992: checking for a BSD compatible install" >&5
+echo "configure:983: 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
@@ -1041,7 +1032,7 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6
-echo "configure:1045: checking whether build environment is sane" >&5
+echo "configure:1036: checking whether build environment is sane" >&5
# Just in case
sleep 1
echo timestamp > conftestfile
@@ -1098,7 +1089,7 @@ test "$program_suffix" != NONE &&
test "$program_transform_name" = "" && program_transform_name="s,x,x,"
echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:1102: checking whether ${MAKE-make} sets \${MAKE}" >&5
+echo "configure:1093: 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
@@ -1144,7 +1135,7 @@ EOF
missing_dir=`cd $ac_aux_dir && pwd`
echo $ac_n "checking for working aclocal""... $ac_c" 1>&6
-echo "configure:1148: checking for working aclocal" >&5
+echo "configure:1139: checking for working aclocal" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
@@ -1157,7 +1148,7 @@ else
fi
echo $ac_n "checking for working autoconf""... $ac_c" 1>&6
-echo "configure:1161: checking for working autoconf" >&5
+echo "configure:1152: checking for working autoconf" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
@@ -1170,7 +1161,7 @@ else
fi
echo $ac_n "checking for working automake""... $ac_c" 1>&6
-echo "configure:1174: checking for working automake" >&5
+echo "configure:1165: checking for working automake" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
@@ -1183,7 +1174,7 @@ else
fi
echo $ac_n "checking for working autoheader""... $ac_c" 1>&6
-echo "configure:1187: checking for working autoheader" >&5
+echo "configure:1178: checking for working autoheader" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
@@ -1196,7 +1187,7 @@ else
fi
echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6
-echo "configure:1200: checking for working makeinfo" >&5
+echo "configure:1191: checking for working makeinfo" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
@@ -1232,7 +1223,7 @@ fi
# Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
set dummy ${ac_tool_prefix}ar; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1236: checking for $ac_word" >&5
+echo "configure:1227: 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
@@ -1264,7 +1255,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:1268: checking for $ac_word" >&5
+echo "configure:1259: 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
@@ -1296,7 +1287,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:1300: checking for $ac_word" >&5
+echo "configure:1291: 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
@@ -1411,7 +1402,7 @@ ac_prog=ld
if test "$GCC" = yes; then
# Check if gcc -print-prog-name=ld gives a path.
echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6
-echo "configure:1415: checking for ld used by GCC" >&5
+echo "configure:1406: checking for ld used by GCC" >&5
case $host in
*-*-mingw*)
# gcc leaves a trailing carriage return which upsets mingw
@@ -1441,10 +1432,10 @@ echo "configure:1415: checking for ld used by GCC" >&5
esac
elif test "$with_gnu_ld" = yes; then
echo $ac_n "checking for GNU ld""... $ac_c" 1>&6
-echo "configure:1445: checking for GNU ld" >&5
+echo "configure:1436: checking for GNU ld" >&5
else
echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6
-echo "configure:1448: checking for non-GNU ld" >&5
+echo "configure:1439: checking for non-GNU ld" >&5
fi
if eval "test \"`echo '$''{'lt_cv_path_LD'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -1479,7 +1470,7 @@ else
fi
test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; }
echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6
-echo "configure:1483: checking if the linker ($LD) is GNU ld" >&5
+echo "configure:1474: checking if the linker ($LD) is GNU ld" >&5
if eval "test \"`echo '$''{'lt_cv_prog_gnu_ld'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1496,7 +1487,7 @@ with_gnu_ld=$lt_cv_prog_gnu_ld
echo $ac_n "checking for $LD option to reload object files""... $ac_c" 1>&6
-echo "configure:1500: checking for $LD option to reload object files" >&5
+echo "configure:1491: checking for $LD option to reload object files" >&5
if eval "test \"`echo '$''{'lt_cv_ld_reload_flag'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1508,7 +1499,7 @@ reload_flag=$lt_cv_ld_reload_flag
test -n "$reload_flag" && reload_flag=" $reload_flag"
echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6
-echo "configure:1512: checking for BSD-compatible nm" >&5
+echo "configure:1503: checking for BSD-compatible nm" >&5
if eval "test \"`echo '$''{'lt_cv_path_NM'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1546,7 +1537,7 @@ NM="$lt_cv_path_NM"
echo "$ac_t""$NM" 1>&6
echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
-echo "configure:1550: checking whether ln -s works" >&5
+echo "configure:1541: 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
@@ -1567,7 +1558,7 @@ else
fi
echo $ac_n "checking how to recognise dependant libraries""... $ac_c" 1>&6
-echo "configure:1571: checking how to recognise dependant libraries" >&5
+echo "configure:1562: checking how to recognise dependant libraries" >&5
if eval "test \"`echo '$''{'lt_cv_deplibs_check_method'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1740,13 +1731,13 @@ file_magic_cmd=$lt_cv_file_magic_cmd
deplibs_check_method=$lt_cv_deplibs_check_method
echo $ac_n "checking for object suffix""... $ac_c" 1>&6
-echo "configure:1744: checking for object suffix" >&5
+echo "configure:1735: checking for object suffix" >&5
if eval "test \"`echo '$''{'ac_cv_objext'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
rm -f conftest*
echo 'int i = 1;' > conftest.$ac_ext
-if { (eval echo configure:1750: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1741: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
for ac_file in conftest.*; do
case $ac_file in
*.c) ;;
@@ -1766,7 +1757,7 @@ ac_objext=$ac_cv_objext
echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
-echo "configure:1770: checking for executable suffix" >&5
+echo "configure:1761: checking for executable suffix" >&5
if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1776,10 +1767,10 @@ else
rm -f conftest*
echo 'int main () { return 0; }' > conftest.$ac_ext
ac_cv_exeext=
- if { (eval echo configure:1780: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+ if { (eval echo configure:1771: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
for file in conftest.*; do
case $file in
- *.c | *.o | *.obj | *.ilk | *.pdb) ;;
+ *.c | *.o | *.obj) ;;
*) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;;
esac
done
@@ -1803,7 +1794,7 @@ case $deplibs_check_method in
file_magic*)
if test "$file_magic_cmd" = '$MAGIC_CMD'; then
echo $ac_n "checking for ${ac_tool_prefix}file""... $ac_c" 1>&6
-echo "configure:1807: checking for ${ac_tool_prefix}file" >&5
+echo "configure:1798: checking for ${ac_tool_prefix}file" >&5
if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1865,7 +1856,7 @@ fi
if test -z "$lt_cv_path_MAGIC_CMD"; then
if test -n "$ac_tool_prefix"; then
echo $ac_n "checking for file""... $ac_c" 1>&6
-echo "configure:1869: checking for file" >&5
+echo "configure:1860: checking for file" >&5
if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1936,7 +1927,7 @@ esac
# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
set dummy ${ac_tool_prefix}ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1940: checking for $ac_word" >&5
+echo "configure:1931: 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
@@ -1968,7 +1959,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:1972: checking for $ac_word" >&5
+echo "configure:1963: 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
@@ -2003,7 +1994,7 @@ fi
# Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
set dummy ${ac_tool_prefix}strip; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2007: checking for $ac_word" >&5
+echo "configure:1998: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2035,7 +2026,7 @@ if test -n "$ac_tool_prefix"; then
# Extract the first word of "strip", so it can be a program name with args.
set dummy strip; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2039: checking for $ac_word" >&5
+echo "configure:2030: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2102,8 +2093,8 @@ test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic"
case $host in
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 2106 "configure"' > conftest.$ac_ext
- if { (eval echo configure:2107: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ echo '#line 2097 "configure"' > conftest.$ac_ext
+ if { (eval echo configure:2098: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
case `/usr/bin/file conftest.$ac_objext` in
*32-bit*)
LD="${LD-ld} -32"
@@ -2122,7 +2113,7 @@ case $host in
ia64-*-hpux*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
- if { (eval echo configure:2126: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ if { (eval echo configure:2117: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
case "`/usr/bin/file conftest.o`" in
*ELF-32*)
HPUX_IA64_MODE="32"
@@ -2140,7 +2131,7 @@ ia64-*-hpux*)
SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -belf"
echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6
-echo "configure:2144: checking whether the C compiler needs -belf" >&5
+echo "configure:2135: checking whether the C compiler needs -belf" >&5
if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2153,14 +2144,14 @@ ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$a
cross_compiling=$ac_cv_prog_cc_cross
cat > conftest.$ac_ext <<EOF
-#line 2157 "configure"
+#line 2148 "configure"
#include "confdefs.h"
int main() {
; return 0; }
EOF
-if { (eval echo configure:2164: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2155: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
lt_cv_cc_needs_belf=yes
else
@@ -2350,7 +2341,7 @@ if test -z "$target" ; then
fi
echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6
-echo "configure:2354: checking whether to enable maintainer-specific portions of Makefiles" >&5
+echo "configure:2345: 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"
@@ -2372,10 +2363,45 @@ fi
MAINT=$MAINTAINER_MODE_TRUE
+echo $ac_n "checking whether to install libbfd""... $ac_c" 1>&6
+echo "configure:2368: checking whether to install libbfd" >&5
+ # Check whether --enable-install-libbfd or --disable-install-libbfd was given.
+if test "${enable_install_libbfd+set}" = set; then
+ enableval="$enable_install_libbfd"
+ install_libbfd_p=$enableval
+else
+ if test "${host}" = "${target}" -o "$enable_shared" = "yes"; then
+ install_libbfd_p=yes
+ else
+ install_libbfd_p=no
+ fi
+fi
+
+ echo "$ac_t""$install_libbfd_p" 1>&6
+
+
+if test $install_libbfd_p = yes; then
+ INSTALL_LIBBFD_TRUE=
+ INSTALL_LIBBFD_FALSE='#'
+else
+ INSTALL_LIBBFD_TRUE='#'
+ INSTALL_LIBBFD_FALSE=
+fi
+ # libbfd.a is a host library containing target dependent code
+ bfdlibdir='$(libdir)'
+ bfdincludedir='$(includedir)'
+ if test "${host}" != "${target}"; then
+ bfdlibdir='$(exec_prefix)/$(host_alias)/$(target_alias)/lib'
+ bfdincludedir='$(exec_prefix)/$(host_alias)/$(target_alias)/include'
+ fi
+
+
+
+
echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
-echo "configure:2379: checking for executable suffix" >&5
+echo "configure:2405: checking for executable suffix" >&5
if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2385,10 +2411,10 @@ else
rm -f conftest*
echo 'int main () { return 0; }' > conftest.$ac_ext
ac_cv_exeext=
- if { (eval echo configure:2389: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+ if { (eval echo configure:2415: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
for file in conftest.*; do
case $file in
- *.c | *.o | *.obj | *.ilk | *.pdb) ;;
+ *.c | *.o | *.obj) ;;
*) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;;
esac
done
@@ -2415,7 +2441,7 @@ bfd_default_target_size=32
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2419: checking for $ac_word" >&5
+echo "configure:2445: 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
@@ -2445,7 +2471,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:2449: checking for $ac_word" >&5
+echo "configure:2475: 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
@@ -2496,7 +2522,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:2500: checking for $ac_word" >&5
+echo "configure:2526: 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
@@ -2528,7 +2554,7 @@ fi
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:2532: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:2558: 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.
@@ -2539,12 +2565,12 @@ cross_compiling=$ac_cv_prog_cc_cross
cat > conftest.$ac_ext << EOF
-#line 2543 "configure"
+#line 2569 "configure"
#include "confdefs.h"
main(){return(0);}
EOF
-if { (eval echo configure:2548: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2574: \"$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
@@ -2570,12 +2596,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:2574: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:2600: 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:2579: checking whether we are using GNU C" >&5
+echo "configure:2605: 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
@@ -2584,7 +2610,7 @@ else
yes;
#endif
EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2588: \"$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:2614: \"$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
@@ -2603,7 +2629,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:2607: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:2633: 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
@@ -2637,7 +2663,7 @@ fi
ALL_LINGUAS="fr tr ja es sv"
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:2641: checking how to run the C preprocessor" >&5
+echo "configure:2667: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
@@ -2652,13 +2678,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 2656 "configure"
+#line 2682 "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:2662: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2688: \"$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
:
@@ -2669,13 +2695,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
-#line 2673 "configure"
+#line 2699 "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:2679: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2705: \"$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
:
@@ -2686,13 +2712,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -nologo -E"
cat > conftest.$ac_ext <<EOF
-#line 2690 "configure"
+#line 2716 "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:2696: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2722: \"$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
:
@@ -2719,7 +2745,7 @@ echo "$ac_t""$CPP" 1>&6
# Extract the first word of "ranlib", so it can be a program name with args.
set dummy ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2723: checking for $ac_word" >&5
+echo "configure:2749: 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
@@ -2747,12 +2773,12 @@ else
fi
echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:2751: checking for ANSI C header files" >&5
+echo "configure:2777: 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 2756 "configure"
+#line 2782 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
@@ -2760,7 +2786,7 @@ else
#include <float.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2764: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2790: \"$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*
@@ -2777,7 +2803,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 2781 "configure"
+#line 2807 "configure"
#include "confdefs.h"
#include <string.h>
EOF
@@ -2795,7 +2821,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 2799 "configure"
+#line 2825 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
@@ -2816,7 +2842,7 @@ if test "$cross_compiling" = yes; then
:
else
cat > conftest.$ac_ext <<EOF
-#line 2820 "configure"
+#line 2846 "configure"
#include "confdefs.h"
#include <ctype.h>
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -2827,7 +2853,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
exit (0); }
EOF
-if { (eval echo configure:2831: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2857: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
:
else
@@ -2851,12 +2877,12 @@ EOF
fi
echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:2855: checking for working const" >&5
+echo "configure:2881: 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 2860 "configure"
+#line 2886 "configure"
#include "confdefs.h"
int main() {
@@ -2905,7 +2931,7 @@ ccp = (char const *const *) p;
; return 0; }
EOF
-if { (eval echo configure:2909: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2935: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_const=yes
else
@@ -2926,21 +2952,21 @@ EOF
fi
echo $ac_n "checking for inline""... $ac_c" 1>&6
-echo "configure:2930: checking for inline" >&5
+echo "configure:2956: 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 2937 "configure"
+#line 2963 "configure"
#include "confdefs.h"
int main() {
} $ac_kw foo() {
; return 0; }
EOF
-if { (eval echo configure:2944: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2970: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_inline=$ac_kw; break
else
@@ -2966,12 +2992,12 @@ EOF
esac
echo $ac_n "checking for off_t""... $ac_c" 1>&6
-echo "configure:2970: checking for off_t" >&5
+echo "configure:2996: 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 2975 "configure"
+#line 3001 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@@ -2999,12 +3025,12 @@ EOF
fi
echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:3003: checking for size_t" >&5
+echo "configure:3029: 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 3008 "configure"
+#line 3034 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@@ -3034,19 +3060,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:3038: checking for working alloca.h" >&5
+echo "configure:3064: 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 3043 "configure"
+#line 3069 "configure"
#include "confdefs.h"
#include <alloca.h>
int main() {
char *p = alloca(2 * sizeof(int));
; return 0; }
EOF
-if { (eval echo configure:3050: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3076: \"$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
@@ -3067,12 +3093,12 @@ EOF
fi
echo $ac_n "checking for alloca""... $ac_c" 1>&6
-echo "configure:3071: checking for alloca" >&5
+echo "configure:3097: 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 3076 "configure"
+#line 3102 "configure"
#include "confdefs.h"
#ifdef __GNUC__
@@ -3100,7 +3126,7 @@ int main() {
char *p = (char *) alloca(1);
; return 0; }
EOF
-if { (eval echo configure:3104: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3130: \"$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
@@ -3132,12 +3158,12 @@ EOF
echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
-echo "configure:3136: checking whether alloca needs Cray hooks" >&5
+echo "configure:3162: 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 3141 "configure"
+#line 3167 "configure"
#include "confdefs.h"
#if defined(CRAY) && ! defined(CRAY2)
webecray
@@ -3162,12 +3188,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:3166: checking for $ac_func" >&5
+echo "configure:3192: 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 3171 "configure"
+#line 3197 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3190,7 +3216,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3194: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3220: \"$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
@@ -3217,7 +3243,7 @@ done
fi
echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
-echo "configure:3221: checking stack direction for C alloca" >&5
+echo "configure:3247: 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
@@ -3225,7 +3251,7 @@ else
ac_cv_c_stack_direction=0
else
cat > conftest.$ac_ext <<EOF
-#line 3229 "configure"
+#line 3255 "configure"
#include "confdefs.h"
find_stack_direction ()
{
@@ -3244,7 +3270,7 @@ main ()
exit (find_stack_direction() < 0);
}
EOF
-if { (eval echo configure:3248: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3274: \"$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
@@ -3269,17 +3295,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:3273: checking for $ac_hdr" >&5
+echo "configure:3299: 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 3278 "configure"
+#line 3304 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3283: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3309: \"$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*
@@ -3308,12 +3334,12 @@ done
for ac_func in getpagesize
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3312: checking for $ac_func" >&5
+echo "configure:3338: 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 3317 "configure"
+#line 3343 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3336,7 +3362,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3340: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3366: \"$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
@@ -3361,7 +3387,7 @@ fi
done
echo $ac_n "checking for working mmap""... $ac_c" 1>&6
-echo "configure:3365: checking for working mmap" >&5
+echo "configure:3391: 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
@@ -3369,7 +3395,7 @@ else
ac_cv_func_mmap_fixed_mapped=no
else
cat > conftest.$ac_ext <<EOF
-#line 3373 "configure"
+#line 3399 "configure"
#include "confdefs.h"
/* Thanks to Mike Haertel and Jim Avera for this test.
@@ -3509,7 +3535,7 @@ main()
}
EOF
-if { (eval echo configure:3513: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3539: \"$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
@@ -3537,17 +3563,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:3541: checking for $ac_hdr" >&5
+echo "configure:3567: 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 3546 "configure"
+#line 3572 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3551: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3577: \"$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*
@@ -3577,12 +3603,12 @@ done
__argz_count __argz_stringify __argz_next
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3581: checking for $ac_func" >&5
+echo "configure:3607: 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 3586 "configure"
+#line 3612 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3605,7 +3631,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3609: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3635: \"$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
@@ -3634,12 +3660,12 @@ done
for ac_func in stpcpy
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3638: checking for $ac_func" >&5
+echo "configure:3664: 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 3643 "configure"
+#line 3669 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3662,7 +3688,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3666: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3692: \"$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
@@ -3696,19 +3722,19 @@ EOF
if test $ac_cv_header_locale_h = yes; then
echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6
-echo "configure:3700: checking for LC_MESSAGES" >&5
+echo "configure:3726: 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 3705 "configure"
+#line 3731 "configure"
#include "confdefs.h"
#include <locale.h>
int main() {
return LC_MESSAGES
; return 0; }
EOF
-if { (eval echo configure:3712: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3738: \"$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
@@ -3729,7 +3755,7 @@ EOF
fi
fi
echo $ac_n "checking whether NLS is requested""... $ac_c" 1>&6
-echo "configure:3733: checking whether NLS is requested" >&5
+echo "configure:3759: 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"
@@ -3749,7 +3775,7 @@ fi
EOF
echo $ac_n "checking whether included gettext is requested""... $ac_c" 1>&6
-echo "configure:3753: checking whether included gettext is requested" >&5
+echo "configure:3779: 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"
@@ -3768,17 +3794,17 @@ fi
ac_safe=`echo "libintl.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for libintl.h""... $ac_c" 1>&6
-echo "configure:3772: checking for libintl.h" >&5
+echo "configure:3798: 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 3777 "configure"
+#line 3803 "configure"
#include "confdefs.h"
#include <libintl.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3782: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3808: \"$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*
@@ -3795,19 +3821,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:3799: checking for gettext in libc" >&5
+echo "configure:3825: 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 3804 "configure"
+#line 3830 "configure"
#include "confdefs.h"
#include <libintl.h>
int main() {
return (int) gettext ("")
; return 0; }
EOF
-if { (eval echo configure:3811: \"$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*
gt_cv_func_gettext_libc=yes
else
@@ -3823,7 +3849,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:3827: checking for bindtextdomain in -lintl" >&5
+echo "configure:3853: 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
@@ -3831,7 +3857,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lintl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 3835 "configure"
+#line 3861 "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
@@ -3842,7 +3868,7 @@ int main() {
bindtextdomain()
; return 0; }
EOF
-if { (eval echo configure:3846: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3872: \"$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
@@ -3858,19 +3884,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:3862: checking for gettext in libintl" >&5
+echo "configure:3888: 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 3867 "configure"
+#line 3893 "configure"
#include "confdefs.h"
int main() {
return (int) gettext ("")
; return 0; }
EOF
-if { (eval echo configure:3874: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3900: \"$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
@@ -3898,7 +3924,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:3902: checking for $ac_word" >&5
+echo "configure:3928: 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
@@ -3932,12 +3958,12 @@ fi
for ac_func in dcgettext
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3936: checking for $ac_func" >&5
+echo "configure:3962: 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 3941 "configure"
+#line 3967 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3960,7 +3986,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3964: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3990: \"$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
@@ -3987,7 +4013,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:3991: checking for $ac_word" >&5
+echo "configure:4017: 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
@@ -4023,7 +4049,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:4027: checking for $ac_word" >&5
+echo "configure:4053: 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
@@ -4055,7 +4081,7 @@ else
fi
cat > conftest.$ac_ext <<EOF
-#line 4059 "configure"
+#line 4085 "configure"
#include "confdefs.h"
int main() {
@@ -4063,7 +4089,7 @@ extern int _nl_msg_cat_cntr;
return _nl_msg_cat_cntr
; return 0; }
EOF
-if { (eval echo configure:4067: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4093: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
CATOBJEXT=.gmo
DATADIRNAME=share
@@ -4095,7 +4121,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:4099: checking for $ac_word" >&5
+echo "configure:4125: 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
@@ -4129,7 +4155,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:4133: checking for $ac_word" >&5
+echo "configure:4159: 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
@@ -4165,7 +4191,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:4169: checking for $ac_word" >&5
+echo "configure:4195: 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
@@ -4255,7 +4281,7 @@ fi
LINGUAS=
else
echo $ac_n "checking for catalogs to be installed""... $ac_c" 1>&6
-echo "configure:4259: checking for catalogs to be installed" >&5
+echo "configure:4285: checking for catalogs to be installed" >&5
NEW_LINGUAS=
for lang in ${LINGUAS=$ALL_LINGUAS}; do
case "$ALL_LINGUAS" in
@@ -4283,17 +4309,17 @@ echo "configure:4259: 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:4287: checking for linux/version.h" >&5
+echo "configure:4313: 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 4292 "configure"
+#line 4318 "configure"
#include "confdefs.h"
#include <linux/version.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4297: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4323: \"$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*
@@ -4371,7 +4397,7 @@ fi
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:4375: checking for a BSD compatible install" >&5
+echo "configure:4401: 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
@@ -4454,7 +4480,7 @@ if test "x$cross_compiling" = "xno"; then
EXEEXT_FOR_BUILD='$(EXEEXT)'
else
echo $ac_n "checking for build system executable suffix""... $ac_c" 1>&6
-echo "configure:4458: checking for build system executable suffix" >&5
+echo "configure:4484: checking for build system executable suffix" >&5
if eval "test \"`echo '$''{'bfd_cv_build_exeext'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -4482,17 +4508,17 @@ for ac_hdr in stddef.h string.h strings.h stdlib.h time.h unistd.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4486: checking for $ac_hdr" >&5
+echo "configure:4512: 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 4491 "configure"
+#line 4517 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4496: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4522: \"$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*
@@ -4522,17 +4548,17 @@ for ac_hdr in fcntl.h sys/file.h sys/time.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4526: checking for $ac_hdr" >&5
+echo "configure:4552: 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 4531 "configure"
+#line 4557 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4536: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4562: \"$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*
@@ -4559,12 +4585,12 @@ fi
done
echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
-echo "configure:4563: checking whether time.h and sys/time.h may both be included" >&5
+echo "configure:4589: checking whether time.h and sys/time.h may both be included" >&5
if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4568 "configure"
+#line 4594 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/time.h>
@@ -4573,7 +4599,7 @@ int main() {
struct tm *tp;
; return 0; }
EOF
-if { (eval echo configure:4577: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4603: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_header_time=yes
else
@@ -4598,12 +4624,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:4602: checking for $ac_hdr that defines DIR" >&5
+echo "configure:4628: 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 4607 "configure"
+#line 4633 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <$ac_hdr>
@@ -4611,7 +4637,7 @@ int main() {
DIR *dirp = 0;
; return 0; }
EOF
-if { (eval echo configure:4615: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4641: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
eval "ac_cv_header_dirent_$ac_safe=yes"
else
@@ -4636,7 +4662,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:4640: checking for opendir in -ldir" >&5
+echo "configure:4666: 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
@@ -4644,7 +4670,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldir $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 4648 "configure"
+#line 4674 "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
@@ -4655,7 +4681,7 @@ int main() {
opendir()
; return 0; }
EOF
-if { (eval echo configure:4659: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4685: \"$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
@@ -4677,7 +4703,7 @@ fi
else
echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6
-echo "configure:4681: checking for opendir in -lx" >&5
+echo "configure:4707: 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
@@ -4685,7 +4711,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lx $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 4689 "configure"
+#line 4715 "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
@@ -4696,7 +4722,7 @@ int main() {
opendir()
; return 0; }
EOF
-if { (eval echo configure:4700: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4726: \"$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
@@ -4721,12 +4747,12 @@ fi
for ac_func in fcntl getpagesize setitimer sysconf fdopen getuid getgid
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4725: checking for $ac_func" >&5
+echo "configure:4751: 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 4730 "configure"
+#line 4756 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -4749,7 +4775,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:4753: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4779: \"$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
@@ -4784,12 +4810,12 @@ EOF
esac
echo $ac_n "checking whether strstr must be declared""... $ac_c" 1>&6
-echo "configure:4788: checking whether strstr must be declared" >&5
+echo "configure:4814: 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 4793 "configure"
+#line 4819 "configure"
#include "confdefs.h"
#include <stdio.h>
@@ -4810,7 +4836,7 @@ int main() {
char *(*pfn) = (char *(*)) strstr
; return 0; }
EOF
-if { (eval echo configure:4814: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4840: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_decl_needed_strstr=no
else
@@ -4831,12 +4857,12 @@ EOF
fi
echo $ac_n "checking whether malloc must be declared""... $ac_c" 1>&6
-echo "configure:4835: checking whether malloc must be declared" >&5
+echo "configure:4861: 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 4840 "configure"
+#line 4866 "configure"
#include "confdefs.h"
#include <stdio.h>
@@ -4857,7 +4883,7 @@ int main() {
char *(*pfn) = (char *(*)) malloc
; return 0; }
EOF
-if { (eval echo configure:4861: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4887: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_decl_needed_malloc=no
else
@@ -4878,12 +4904,12 @@ EOF
fi
echo $ac_n "checking whether realloc must be declared""... $ac_c" 1>&6
-echo "configure:4882: checking whether realloc must be declared" >&5
+echo "configure:4908: 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 4887 "configure"
+#line 4913 "configure"
#include "confdefs.h"
#include <stdio.h>
@@ -4904,7 +4930,7 @@ int main() {
char *(*pfn) = (char *(*)) realloc
; return 0; }
EOF
-if { (eval echo configure:4908: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4934: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_decl_needed_realloc=no
else
@@ -4925,12 +4951,12 @@ EOF
fi
echo $ac_n "checking whether free must be declared""... $ac_c" 1>&6
-echo "configure:4929: checking whether free must be declared" >&5
+echo "configure:4955: 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 4934 "configure"
+#line 4960 "configure"
#include "confdefs.h"
#include <stdio.h>
@@ -4951,7 +4977,7 @@ int main() {
char *(*pfn) = (char *(*)) free
; return 0; }
EOF
-if { (eval echo configure:4955: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4981: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_decl_needed_free=no
else
@@ -4972,12 +4998,12 @@ EOF
fi
echo $ac_n "checking whether getenv must be declared""... $ac_c" 1>&6
-echo "configure:4976: checking whether getenv must be declared" >&5
+echo "configure:5002: checking whether getenv must be declared" >&5
if eval "test \"`echo '$''{'bfd_cv_decl_needed_getenv'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4981 "configure"
+#line 5007 "configure"
#include "confdefs.h"
#include <stdio.h>
@@ -4998,7 +5024,7 @@ int main() {
char *(*pfn) = (char *(*)) getenv
; return 0; }
EOF
-if { (eval echo configure:5002: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5028: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_decl_needed_getenv=no
else
@@ -5032,7 +5058,9 @@ if test "${target}" = "${host}"; then
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/alphalinux.h"'
;;
- alpha*-*-netbsd*) COREFILE=netbsd-core.lo ;;
+ alpha*-*-netbsd* | alpha*-*-openbsd*)
+ COREFILE=netbsd-core.lo
+ ;;
alpha*-*-*) COREFILE=osf-core.lo ;;
arm-*-freebsd*) COREFILE='' ;;
arm-*-netbsd*) COREFILE=netbsd-core.lo ;;
@@ -5177,10 +5205,35 @@ if test "${target}" = "${host}"; then
COREFILE=rs6000-core.lo
COREFLAG="$COREFLAG -DAIX_5_CORE -DAIX_CORE_DUMPX_CORE"
;;
- rs6000-*-aix4.[4-9]* | powerpc-*-aix4.[4-9]* | \
- rs6000-*-aix4.3.[3-9]* | powerpc-*-aix4.3.[3-9]*)
+ rs6000-*-aix4.[3-9]* | powerpc-*-aix4.[3-9]*)
COREFILE=rs6000-core.lo
COREFLAG="$COREFLAG -DAIX_CORE_DUMPX_CORE"
+ # Not all versions of AIX with -DAIX_CORE_DUMPX_CORE
+ # have c_impl as a member of struct core_dumpx
+ echo $ac_n "checking for c_impl in struct core_dumpx""... $ac_c" 1>&6
+echo "configure:5215: checking for c_impl in struct core_dumpx" >&5
+ cat > conftest.$ac_ext <<EOF
+#line 5217 "configure"
+#include "confdefs.h"
+#include <core.h>
+int main() {
+struct core_dumpx c; c.c_impl = 0;
+; return 0; }
+EOF
+if { (eval echo configure:5224: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ cat >> confdefs.h <<\EOF
+#define HAVE_ST_C_IMPL 1
+EOF
+
+ echo "$ac_t""yes" 1>&6
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ echo "$ac_t""no" 1>&6
+fi
+rm -f conftest*
;;
rs6000-*-aix4*) COREFILE=rs6000-core.lo ;;
rs6000-*-*) COREFILE=rs6000-core.lo ;;
@@ -5192,7 +5245,7 @@ if test "${target}" = "${host}"; then
powerpc-*-*bsd*) COREFILE=netbsd-core.lo ;;
s390*-*-*) COREFILE=trad-core.lo ;;
sh*-*-netbsd*) COREFILE=netbsd-core.lo ;;
- sparc-*-netbsd* | sparc-*-openbsd*)
+ sparc-*-netbsd* | sparc*-*-openbsd*)
COREFILE=netbsd-core.lo
;;
tahoe-*-*)
@@ -5234,17 +5287,17 @@ if test "${target}" = "${host}"; then
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5238: checking for $ac_hdr" >&5
+echo "configure:5291: 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 5243 "configure"
+#line 5296 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5248: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5301: \"$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*
@@ -5272,12 +5325,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:5276: checking for prstatus_t in sys/procfs.h" >&5
+echo "configure:5329: 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 5281 "configure"
+#line 5334 "configure"
#include "confdefs.h"
#define _SYSCALL32
@@ -5286,7 +5339,7 @@ int main() {
prstatus_t avar
; return 0; }
EOF
-if { (eval echo configure:5290: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5343: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_have_sys_procfs_type_prstatus_t=yes
else
@@ -5308,12 +5361,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:5312: checking for prstatus32_t in sys/procfs.h" >&5
+echo "configure:5365: 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 5317 "configure"
+#line 5370 "configure"
#include "confdefs.h"
#define _SYSCALL32
@@ -5322,7 +5375,7 @@ int main() {
prstatus32_t avar
; return 0; }
EOF
-if { (eval echo configure:5326: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5379: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_have_sys_procfs_type_prstatus32_t=yes
else
@@ -5344,12 +5397,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:5348: checking for prstatus_t.pr_who in sys/procfs.h" >&5
+echo "configure:5401: 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 5353 "configure"
+#line 5406 "configure"
#include "confdefs.h"
#define _SYSCALL32
@@ -5358,7 +5411,7 @@ int main() {
prstatus_t avar; void* aref = (void*) &avar.pr_who
; return 0; }
EOF
-if { (eval echo configure:5362: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5415: \"$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
@@ -5380,12 +5433,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:5384: checking for prstatus32_t.pr_who in sys/procfs.h" >&5
+echo "configure:5437: 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 5389 "configure"
+#line 5442 "configure"
#include "confdefs.h"
#define _SYSCALL32
@@ -5394,7 +5447,7 @@ int main() {
prstatus32_t avar; void* aref = (void*) &avar.pr_who
; return 0; }
EOF
-if { (eval echo configure:5398: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5451: \"$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
@@ -5416,12 +5469,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:5420: checking for pstatus_t in sys/procfs.h" >&5
+echo "configure:5473: 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 5425 "configure"
+#line 5478 "configure"
#include "confdefs.h"
#define _SYSCALL32
@@ -5430,7 +5483,7 @@ int main() {
pstatus_t avar
; return 0; }
EOF
-if { (eval echo configure:5434: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5487: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_have_sys_procfs_type_pstatus_t=yes
else
@@ -5452,12 +5505,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:5456: checking for pxstatus_t in sys/procfs.h" >&5
+echo "configure:5509: 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 5461 "configure"
+#line 5514 "configure"
#include "confdefs.h"
#define _SYSCALL32
@@ -5466,7 +5519,7 @@ int main() {
pxstatus_t avar
; return 0; }
EOF
-if { (eval echo configure:5470: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5523: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_have_sys_procfs_type_pxstatus_t=yes
else
@@ -5488,12 +5541,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:5492: checking for pstatus32_t in sys/procfs.h" >&5
+echo "configure:5545: 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 5497 "configure"
+#line 5550 "configure"
#include "confdefs.h"
#define _SYSCALL32
@@ -5502,7 +5555,7 @@ int main() {
pstatus32_t avar
; return 0; }
EOF
-if { (eval echo configure:5506: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5559: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_have_sys_procfs_type_pstatus32_t=yes
else
@@ -5524,12 +5577,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:5528: checking for prpsinfo_t in sys/procfs.h" >&5
+echo "configure:5581: 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 5533 "configure"
+#line 5586 "configure"
#include "confdefs.h"
#define _SYSCALL32
@@ -5538,7 +5591,7 @@ int main() {
prpsinfo_t avar
; return 0; }
EOF
-if { (eval echo configure:5542: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5595: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_have_sys_procfs_type_prpsinfo_t=yes
else
@@ -5560,12 +5613,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:5564: checking for prpsinfo32_t in sys/procfs.h" >&5
+echo "configure:5617: 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 5569 "configure"
+#line 5622 "configure"
#include "confdefs.h"
#define _SYSCALL32
@@ -5574,7 +5627,7 @@ int main() {
prpsinfo32_t avar
; return 0; }
EOF
-if { (eval echo configure:5578: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5631: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_have_sys_procfs_type_prpsinfo32_t=yes
else
@@ -5596,12 +5649,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:5600: checking for psinfo_t in sys/procfs.h" >&5
+echo "configure:5653: 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 5605 "configure"
+#line 5658 "configure"
#include "confdefs.h"
#define _SYSCALL32
@@ -5610,7 +5663,7 @@ int main() {
psinfo_t avar
; return 0; }
EOF
-if { (eval echo configure:5614: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5667: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_have_sys_procfs_type_psinfo_t=yes
else
@@ -5632,12 +5685,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:5636: checking for psinfo32_t in sys/procfs.h" >&5
+echo "configure:5689: 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 5641 "configure"
+#line 5694 "configure"
#include "confdefs.h"
#define _SYSCALL32
@@ -5646,7 +5699,7 @@ int main() {
psinfo32_t avar
; return 0; }
EOF
-if { (eval echo configure:5650: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5703: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_have_sys_procfs_type_psinfo32_t=yes
else
@@ -5668,12 +5721,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:5672: checking for lwpstatus_t in sys/procfs.h" >&5
+echo "configure:5725: 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 5677 "configure"
+#line 5730 "configure"
#include "confdefs.h"
#define _SYSCALL32
@@ -5682,7 +5735,7 @@ int main() {
lwpstatus_t avar
; return 0; }
EOF
-if { (eval echo configure:5686: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5739: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_have_sys_procfs_type_lwpstatus_t=yes
else
@@ -5704,12 +5757,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:5708: checking for lwpxstatus_t in sys/procfs.h" >&5
+echo "configure:5761: 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 5713 "configure"
+#line 5766 "configure"
#include "confdefs.h"
#define _SYSCALL32
@@ -5718,7 +5771,7 @@ int main() {
lwpxstatus_t avar
; return 0; }
EOF
-if { (eval echo configure:5722: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5775: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_have_sys_procfs_type_lwpxstatus_t=yes
else
@@ -5740,12 +5793,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:5744: checking for lwpstatus_t.pr_context in sys/procfs.h" >&5
+echo "configure:5797: 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 5749 "configure"
+#line 5802 "configure"
#include "confdefs.h"
#define _SYSCALL32
@@ -5754,7 +5807,7 @@ int main() {
lwpstatus_t avar; void* aref = (void*) &avar.pr_context
; return 0; }
EOF
-if { (eval echo configure:5758: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5811: \"$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
@@ -5776,12 +5829,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:5780: checking for lwpstatus_t.pr_reg in sys/procfs.h" >&5
+echo "configure:5833: 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 5785 "configure"
+#line 5838 "configure"
#include "confdefs.h"
#define _SYSCALL32
@@ -5790,7 +5843,7 @@ int main() {
lwpstatus_t avar; void* aref = (void*) &avar.pr_reg
; return 0; }
EOF
-if { (eval echo configure:5794: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5847: \"$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
@@ -5812,12 +5865,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:5816: checking for win32_pstatus_t in sys/procfs.h" >&5
+echo "configure:5869: 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 5821 "configure"
+#line 5874 "configure"
#include "confdefs.h"
#define _SYSCALL32
@@ -5826,7 +5879,7 @@ int main() {
win32_pstatus_t avar
; return 0; }
EOF
-if { (eval echo configure:5830: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5883: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_have_sys_procfs_type_win32_pstatus_t=yes
else
@@ -5999,12 +6052,14 @@ do
bfd_elf32_cris_vec) tb="$tb elf32-cris.lo elf32.lo $elf" ;;
bfd_elf32_d10v_vec) tb="$tb elf32-d10v.lo elf32.lo $elf" ;;
bfd_elf32_d30v_vec) tb="$tb elf32-d30v.lo elf32.lo $elf" ;;
+ bfd_elf32_dlx_big_vec) tb="$tb elf32-dlx.lo elf32.lo $elf" ;;
bfd_elf32_fr30_vec) tb="$tb elf32-fr30.lo elf32.lo $elf" ;;
bfd_elf32_h8300_vec) tb="$tb elf32-h8300.lo elf32.lo $elf" ;;
bfd_elf32_hppa_linux_vec) tb="$tb elf32-hppa.lo elf32.lo $elf" ;;
bfd_elf32_hppa_vec) tb="$tb elf32-hppa.lo elf32.lo $elf" ;;
bfd_elf32_i370_vec) tb="$tb elf32-i370.lo elf32.lo $elf" ;;
bfd_elf32_i386_vec) tb="$tb elf32-i386.lo elf32.lo $elf" ;;
+ bfd_elf32_i386qnx_vec) tb="$tb elf32-i386qnx.lo elf32.lo $elf" ;;
bfd_elf32_i860_little_vec) tb="$tb elf32-i860.lo elf32.lo $elf" ;;
bfd_elf32_i860_vec) tb="$tb elf32-i860.lo elf32.lo $elf" ;;
bfd_elf32_i960_vec) tb="$tb elf32-i960.lo elf32.lo $elf" ;;
@@ -6040,15 +6095,20 @@ do
# FIXME: We include cofflink.lo not because it's needed for
# bfd_elf32_sh64[l]_vec, but because we include bfd_elf32_sh[l]_vec
# which needs it but does not list it. Should be fixed in right place.
- bfd_elf32_sh64_vec) tb="$tb elf32-sh64.lo elf32.lo $elf cofflink.lo" target_size=64 ;;
- bfd_elf32_sh64l_vec) tb="$tb elf32-sh64.lo elf32.lo $elf cofflink.lo" target_size=64 ;;
+ bfd_elf32_sh64_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" target_size=64 ;;
+ bfd_elf32_sh64l_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" target_size=64 ;;
bfd_elf64_sh64_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;;
bfd_elf64_sh64l_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;;
+ bfd_elf32_sh64nbsd_vec) tb="$tb elf32-sh64-nbsd.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" ;;
+ bfd_elf32_sh64lnbsd_vec) tb="$tb elf32-sh64-nbsd.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" ;;
+ bfd_elf64_sh64nbsd_vec) tb="$tb elf64-sh64-nbsd.lo elf64.lo $elf" target_size=64 ;;
+ bfd_elf64_sh64lnbsd_vec) tb="$tb elf64-sh64-nbsd.lo elf64.lo $elf" target_size=64 ;;
bfd_elf32_sparc_vec) tb="$tb elf32-sparc.lo elf32.lo $elf" ;;
bfd_elf32_tradbigmips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo" ;;
bfd_elf32_tradlittlemips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo" ;;
bfd_elf32_us_cris_vec) tb="$tb elf32-cris.lo elf32.lo $elf" ;;
bfd_elf32_v850_vec) tb="$tb elf32-v850.lo elf32.lo $elf" ;;
+ bfd_elf32_vax_vec) tb="$tb elf32-vax.lo elf32.lo $elf" ;;
bfd_elf32_xstormy16_vec) tb="$tb elf32-xstormy16.lo elf32.lo $elf" ;;
bfd_elf64_alpha_vec) tb="$tb elf64-alpha.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_big_generic_vec) tb="$tb elf64-gen.lo elf64.lo $elf"; target_size=64 ;;
@@ -6165,6 +6225,8 @@ do
tic54x_coff2_beh_vec) tb="$tb coff-tic54x.lo" ;;
tic54x_coff2_vec) tb="$tb coff-tic54x.lo" ;;
tic80coff_vec) tb="$tb coff-tic80.lo cofflink.lo" ;;
+ vaxnetbsd_vec) tb="$tb vaxnetbsd.lo aout32.lo" ;;
+ vax1knetbsd_vec) tb="$tb vax1knetbsd.lo aout32.lo" ;;
versados_vec) tb="$tb versados.lo" ;;
vms_alpha_vec) tb="$tb vms.lo vms-hdr.lo vms-gsd.lo vms-tir.lo vms-misc.lo"; target_size=64 ;;
vms_vax_vec) tb="$tb vms.lo vms-hdr.lo vms-gsd.lo vms-tir.lo vms-misc.lo" ;;
@@ -6240,10 +6302,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:6244: checking for gcc version with buggy 64-bit support" >&5
+echo "configure:6306: 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 6247 "configure"
+#line 6309 "configure"
#include "confdefs.h"
:__GNUC__:__GNUC_MINOR__:__i386__:
EOF
@@ -6288,17 +6350,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:6292: checking for $ac_hdr" >&5
+echo "configure:6354: 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 6297 "configure"
+#line 6359 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:6302: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:6364: \"$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*
@@ -6327,12 +6389,12 @@ done
for ac_func in getpagesize
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:6331: checking for $ac_func" >&5
+echo "configure:6393: 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 6336 "configure"
+#line 6398 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -6355,7 +6417,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:6359: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6421: \"$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
@@ -6380,7 +6442,7 @@ fi
done
echo $ac_n "checking for working mmap""... $ac_c" 1>&6
-echo "configure:6384: checking for working mmap" >&5
+echo "configure:6446: 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
@@ -6388,7 +6450,7 @@ else
ac_cv_func_mmap_fixed_mapped=no
else
cat > conftest.$ac_ext <<EOF
-#line 6392 "configure"
+#line 6454 "configure"
#include "confdefs.h"
/* Thanks to Mike Haertel and Jim Avera for this test.
@@ -6528,7 +6590,7 @@ main()
}
EOF
-if { (eval echo configure:6532: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:6594: \"$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
@@ -6553,12 +6615,12 @@ fi
for ac_func in madvise mprotect
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:6557: checking for $ac_func" >&5
+echo "configure:6619: 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 6562 "configure"
+#line 6624 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -6581,7 +6643,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:6585: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6647: \"$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
@@ -6787,6 +6849,10 @@ s%@WARN_CFLAGS@%$WARN_CFLAGS%g
s%@MAINTAINER_MODE_TRUE@%$MAINTAINER_MODE_TRUE%g
s%@MAINTAINER_MODE_FALSE@%$MAINTAINER_MODE_FALSE%g
s%@MAINT@%$MAINT%g
+s%@INSTALL_LIBBFD_TRUE@%$INSTALL_LIBBFD_TRUE%g
+s%@INSTALL_LIBBFD_FALSE@%$INSTALL_LIBBFD_FALSE%g
+s%@bfdlibdir@%$bfdlibdir%g
+s%@bfdincludedir@%$bfdincludedir%g
s%@CPP@%$CPP%g
s%@ALLOCA@%$ALLOCA%g
s%@USE_NLS@%$USE_NLS%g
diff --git a/bfd/configure.in b/bfd/configure.in
index 6659fd5d434..040a068a902 100644
--- a/bfd/configure.in
+++ b/bfd/configure.in
@@ -98,6 +98,7 @@ if test -z "$target" ; then
fi
AM_MAINTAINER_MODE
+AM_INSTALL_LIBBFD
AC_EXEEXT
host64=false
@@ -162,7 +163,9 @@ if test "${target}" = "${host}"; then
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/alphalinux.h"'
;;
- alpha*-*-netbsd*) COREFILE=netbsd-core.lo ;;
+ alpha*-*-netbsd* | alpha*-*-openbsd*)
+ COREFILE=netbsd-core.lo
+ ;;
alpha*-*-*) COREFILE=osf-core.lo ;;
arm-*-freebsd*) COREFILE='' ;;
arm-*-netbsd*) COREFILE=netbsd-core.lo ;;
@@ -332,11 +335,18 @@ changequote([,])dnl
COREFLAG="$COREFLAG -DAIX_5_CORE -DAIX_CORE_DUMPX_CORE"
;;
changequote(,)dnl
- rs6000-*-aix4.[4-9]* | powerpc-*-aix4.[4-9]* | \
- rs6000-*-aix4.3.[3-9]* | powerpc-*-aix4.3.[3-9]*)
+ rs6000-*-aix4.[3-9]* | powerpc-*-aix4.[3-9]*)
changequote([,])dnl
COREFILE=rs6000-core.lo
COREFLAG="$COREFLAG -DAIX_CORE_DUMPX_CORE"
+ # Not all versions of AIX with -DAIX_CORE_DUMPX_CORE
+ # have c_impl as a member of struct core_dumpx
+ AC_MSG_CHECKING([for c_impl in struct core_dumpx])
+ AC_TRY_COMPILE([#include <core.h>],
+ [struct core_dumpx c; c.c_impl = 0;],
+ [AC_DEFINE(HAVE_ST_C_IMPL, 1,
+ [Define if struct core_dumpx has member c_impl])
+ AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)])
;;
rs6000-*-aix4*) COREFILE=rs6000-core.lo ;;
rs6000-*-*) COREFILE=rs6000-core.lo ;;
@@ -348,7 +358,7 @@ changequote([,])dnl
powerpc-*-*bsd*) COREFILE=netbsd-core.lo ;;
s390*-*-*) COREFILE=trad-core.lo ;;
sh*-*-netbsd*) COREFILE=netbsd-core.lo ;;
- sparc-*-netbsd* | sparc-*-openbsd*)
+ sparc-*-netbsd* | sparc*-*-openbsd*)
COREFILE=netbsd-core.lo
;;
tahoe-*-*)
@@ -556,12 +566,14 @@ do
bfd_elf32_cris_vec) tb="$tb elf32-cris.lo elf32.lo $elf" ;;
bfd_elf32_d10v_vec) tb="$tb elf32-d10v.lo elf32.lo $elf" ;;
bfd_elf32_d30v_vec) tb="$tb elf32-d30v.lo elf32.lo $elf" ;;
+ bfd_elf32_dlx_big_vec) tb="$tb elf32-dlx.lo elf32.lo $elf" ;;
bfd_elf32_fr30_vec) tb="$tb elf32-fr30.lo elf32.lo $elf" ;;
bfd_elf32_h8300_vec) tb="$tb elf32-h8300.lo elf32.lo $elf" ;;
bfd_elf32_hppa_linux_vec) tb="$tb elf32-hppa.lo elf32.lo $elf" ;;
bfd_elf32_hppa_vec) tb="$tb elf32-hppa.lo elf32.lo $elf" ;;
bfd_elf32_i370_vec) tb="$tb elf32-i370.lo elf32.lo $elf" ;;
bfd_elf32_i386_vec) tb="$tb elf32-i386.lo elf32.lo $elf" ;;
+ bfd_elf32_i386qnx_vec) tb="$tb elf32-i386qnx.lo elf32.lo $elf" ;;
bfd_elf32_i860_little_vec) tb="$tb elf32-i860.lo elf32.lo $elf" ;;
bfd_elf32_i860_vec) tb="$tb elf32-i860.lo elf32.lo $elf" ;;
bfd_elf32_i960_vec) tb="$tb elf32-i960.lo elf32.lo $elf" ;;
@@ -597,15 +609,20 @@ do
# FIXME: We include cofflink.lo not because it's needed for
# bfd_elf32_sh64[l]_vec, but because we include bfd_elf32_sh[l]_vec
# which needs it but does not list it. Should be fixed in right place.
- bfd_elf32_sh64_vec) tb="$tb elf32-sh64.lo elf32.lo $elf cofflink.lo" target_size=64 ;;
- bfd_elf32_sh64l_vec) tb="$tb elf32-sh64.lo elf32.lo $elf cofflink.lo" target_size=64 ;;
+ bfd_elf32_sh64_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" target_size=64 ;;
+ bfd_elf32_sh64l_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" target_size=64 ;;
bfd_elf64_sh64_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;;
bfd_elf64_sh64l_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;;
+ bfd_elf32_sh64nbsd_vec) tb="$tb elf32-sh64-nbsd.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" ;;
+ bfd_elf32_sh64lnbsd_vec) tb="$tb elf32-sh64-nbsd.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" ;;
+ bfd_elf64_sh64nbsd_vec) tb="$tb elf64-sh64-nbsd.lo elf64.lo $elf" target_size=64 ;;
+ bfd_elf64_sh64lnbsd_vec) tb="$tb elf64-sh64-nbsd.lo elf64.lo $elf" target_size=64 ;;
bfd_elf32_sparc_vec) tb="$tb elf32-sparc.lo elf32.lo $elf" ;;
bfd_elf32_tradbigmips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo" ;;
bfd_elf32_tradlittlemips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo" ;;
bfd_elf32_us_cris_vec) tb="$tb elf32-cris.lo elf32.lo $elf" ;;
bfd_elf32_v850_vec) tb="$tb elf32-v850.lo elf32.lo $elf" ;;
+ bfd_elf32_vax_vec) tb="$tb elf32-vax.lo elf32.lo $elf" ;;
bfd_elf32_xstormy16_vec) tb="$tb elf32-xstormy16.lo elf32.lo $elf" ;;
bfd_elf64_alpha_vec) tb="$tb elf64-alpha.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_big_generic_vec) tb="$tb elf64-gen.lo elf64.lo $elf"; target_size=64 ;;
@@ -722,6 +739,8 @@ do
tic54x_coff2_beh_vec) tb="$tb coff-tic54x.lo" ;;
tic54x_coff2_vec) tb="$tb coff-tic54x.lo" ;;
tic80coff_vec) tb="$tb coff-tic80.lo cofflink.lo" ;;
+ vaxnetbsd_vec) tb="$tb vaxnetbsd.lo aout32.lo" ;;
+ vax1knetbsd_vec) tb="$tb vax1knetbsd.lo aout32.lo" ;;
versados_vec) tb="$tb versados.lo" ;;
vms_alpha_vec) tb="$tb vms.lo vms-hdr.lo vms-gsd.lo vms-tir.lo vms-misc.lo"; target_size=64 ;;
vms_vax_vec) tb="$tb vms.lo vms-hdr.lo vms-gsd.lo vms-tir.lo vms-misc.lo" ;;
diff --git a/bfd/corefile.c b/bfd/corefile.c
index 609c4e6f68e..24142254eed 100644
--- a/bfd/corefile.c
+++ b/bfd/corefile.c
@@ -1,5 +1,5 @@
/* Core file generic interface routines for BFD.
- Copyright 1990, 1991, 1992, 1993, 1994, 2000, 2001
+ Copyright 1990, 1991, 1992, 1993, 1994, 2000, 2001, 2002
Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -44,7 +44,7 @@ DESCRIPTION
*/
-CONST char *
+const char *
bfd_core_file_failing_command (abfd)
bfd *abfd;
{
diff --git a/bfd/cpu-dlx.c b/bfd/cpu-dlx.c
new file mode 100644
index 00000000000..2023ff53121
--- /dev/null
+++ b/bfd/cpu-dlx.c
@@ -0,0 +1,39 @@
+/* BFD support for the DLX Microprocessor architecture.
+ Copyright 2002 Free Software Foundation, Inc.
+ Hacked by Kuang Hwa Lin <kuang@sbcglobal.net>
+
+ 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 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 "bfd.h"
+#include "sysdep.h"
+#include "libbfd.h"
+
+const bfd_arch_info_type bfd_dlx_arch =
+ {
+ 32, /* 32 bits in a word. */
+ 32, /* 32 bits in an address. */
+ 8, /* 8 bits in a byte. */
+ bfd_arch_dlx,
+ 0, /* Only 1 machine. */
+ "dlx",
+ "dlx",
+ 4,
+ true, /* The one and only. */
+ bfd_default_compatible,
+ bfd_default_scan ,
+ 0,
+};
diff --git a/bfd/cpu-h8300.c b/bfd/cpu-h8300.c
index 07beae5c1b5..10ca3fdfc2b 100644
--- a/bfd/cpu-h8300.c
+++ b/bfd/cpu-h8300.c
@@ -97,23 +97,20 @@ compatible (in, out)
return in;
}
-static const bfd_arch_info_type h8300_info_struct =
+static const bfd_arch_info_type h8300s_info_struct =
{
- 16, /* 16 bits in a word */
- 16, /* 16 bits in an address */
+ 32, /* 32 bits in a word */
+ 32, /* 32 bits in an address */
8, /* 8 bits in a byte */
bfd_arch_h8300,
- bfd_mach_h8300,
- "h8300", /* arch_name */
- "h8300", /* printable name */
+ bfd_mach_h8300s,
+ "h8300s", /* arch_name */
+ "h8300s", /* printable name */
1,
- true, /* the default machine */
+ false, /* the default machine */
compatible,
h8300_scan,
-#if 0
- local_bfd_reloc_type_lookup,
-#endif
- 0,
+ 0
};
static const bfd_arch_info_type h8300h_info_struct =
@@ -129,27 +126,21 @@ static const bfd_arch_info_type h8300h_info_struct =
false, /* the default machine */
compatible,
h8300_scan,
-#if 0
- local_bfd_reloc_type_lookup,
-#endif
- &h8300_info_struct,
+ &h8300s_info_struct
};
const bfd_arch_info_type bfd_h8300_arch =
{
- 32, /* 32 bits in a word */
- 32, /* 32 bits in an address */
+ 16, /* 16 bits in a word */
+ 16, /* 16 bits in an address */
8, /* 8 bits in a byte */
bfd_arch_h8300,
- bfd_mach_h8300s,
- "h8300s", /* arch_name */
- "h8300s", /* printable name */
+ bfd_mach_h8300,
+ "h8300", /* arch_name */
+ "h8300", /* printable name */
1,
- false, /* the default machine */
+ true, /* the default machine */
compatible,
h8300_scan,
-#if 0
- local_bfd_reloc_type_lookup,
-#endif
- &h8300h_info_struct,
+ &h8300h_info_struct
};
diff --git a/bfd/cpu-mips.c b/bfd/cpu-mips.c
index d54b0a55891..d5343ff31ef 100644
--- a/bfd/cpu-mips.c
+++ b/bfd/cpu-mips.c
@@ -37,11 +37,8 @@ mips_compatible (a, b)
if (a->arch != b->arch)
return NULL;
- if (a->mach > b->mach)
- return a;
-
- if (b->mach > a->mach)
- return b;
+ /* Machine compatibility is checked in
+ _bfd_mips_elf_merge_private_bfd_data. */
return a;
}
diff --git a/bfd/doc/ChangeLog b/bfd/doc/ChangeLog
index b71ad5a1da9..2f212bf7b9e 100644
--- a/bfd/doc/ChangeLog
+++ b/bfd/doc/ChangeLog
@@ -1,3 +1,28 @@
+2002-06-08 Alan Modra <amodra@bigpond.net.au>
+
+ * Makefile.am: Fix quote style in last change.
+ * Makefile.in: Regenerate.
+
+2002-06-07 Alan Modra <amodra@bigpond.net.au>
+
+ * Makefile.am (libbfd.h): Don't use "echo -n".
+ (libcoff.h, bfd.h): Likewise.
+ * Makefile.in: Regenerate.
+
+2002-06-06 Lars Brinkhoff <lars@nocrew.org>
+
+ * bfdint.texi: Change registry@sco.com to registry@caldera.com.
+
+2002-06-05 Alan Modra <amodra@bigpond.net.au>
+
+ * Makefile.am (libbfd.h): Add "Extracted from.." comment.
+ (libcoff.h, bfd.h): Likewise.
+ * Makefile.in: Regenerate.
+
+2002-05-25 Alan Modra <amodra@bigpond.net.au>
+
+ * chew.c: Use #include "" instead of <> for local header files.
+
2002-04-20 Alan Modra <amodra@bigpond.net.au>
* Makefile.in: Regenerate.
diff --git a/bfd/doc/Makefile.am b/bfd/doc/Makefile.am
index cbfd3427e60..0787143fcd9 100644
--- a/bfd/doc/Makefile.am
+++ b/bfd/doc/Makefile.am
@@ -209,7 +209,9 @@ libbfd.h: $(LIBBFD_H_DEP)
case $$file in \
*-in.h) cat $$file >> $@ ;; \
*/header.sed) break ;; \
- *) ./$(MKDOC) -i -f $(srcdir)/proto.str < $$file >> $@ ;; \
+ *) echo $$file | sed -e 's,.*/,,' -e 's,^,/* Extracted from ,' \
+ -e 's,$$,. */,' >> $@ ; \
+ ./$(MKDOC) -i -f $(srcdir)/proto.str < $$file >> $@ ;; \
esac; \
done
@@ -226,7 +228,9 @@ libcoff.h: $(LIBCOFF_H_DEP)
case $$file in \
*-in.h) cat $$file >> $@ ;; \
*/header.sed) break ;; \
- *) ./$(MKDOC) -i -f $(srcdir)/proto.str < $$file >> $@ ;; \
+ *) echo $$file | sed -e 's,.*/,,' -e 's,^,/* Extracted from ,' \
+ -e 's,$$,. */,' >> $@ ; \
+ ./$(MKDOC) -i -f $(srcdir)/proto.str < $$file >> $@ ;; \
esac; \
done
@@ -255,7 +259,9 @@ bfd.h: $(BFD_H_DEP)
case $$file in \
*-in.h) cat $$file >> $@ ;; \
*/header.sed) break ;; \
- *) ./$(MKDOC) -f $(srcdir)/proto.str < $$file >> $@ ;; \
+ *) echo $$file | sed -e 's,.*/,,' -e 's,^,/* Extracted from ,' \
+ -e 's,$$,. */,' >> $@ ; \
+ ./$(MKDOC) -f $(srcdir)/proto.str < $$file >> $@ ;; \
esac; \
done
echo "#ifdef __cplusplus" >> $@
diff --git a/bfd/doc/Makefile.in b/bfd/doc/Makefile.in
index 0036c0be529..8daf5370af5 100644
--- a/bfd/doc/Makefile.in
+++ b/bfd/doc/Makefile.in
@@ -121,6 +121,8 @@ bfd_machines = @bfd_machines@
bfd_version = @bfd_version@
bfd_version_date = @bfd_version_date@
bfd_version_string = @bfd_version_string@
+bfdincludedir = @bfdincludedir@
+bfdlibdir = @bfdlibdir@
l = @l@
tdefaults = @tdefaults@
wordsize = @wordsize@
@@ -604,7 +606,9 @@ libbfd.h: $(LIBBFD_H_DEP)
case $$file in \
*-in.h) cat $$file >> $@ ;; \
*/header.sed) break ;; \
- *) ./$(MKDOC) -i -f $(srcdir)/proto.str < $$file >> $@ ;; \
+ *) echo $$file | sed -e 's,.*/,,' -e 's,^,/* Extracted from ,' \
+ -e 's,$$,. */,' >> $@ ; \
+ ./$(MKDOC) -i -f $(srcdir)/proto.str < $$file >> $@ ;; \
esac; \
done
@@ -614,7 +618,9 @@ libcoff.h: $(LIBCOFF_H_DEP)
case $$file in \
*-in.h) cat $$file >> $@ ;; \
*/header.sed) break ;; \
- *) ./$(MKDOC) -i -f $(srcdir)/proto.str < $$file >> $@ ;; \
+ *) echo $$file | sed -e 's,.*/,,' -e 's,^,/* Extracted from ,' \
+ -e 's,$$,. */,' >> $@ ; \
+ ./$(MKDOC) -i -f $(srcdir)/proto.str < $$file >> $@ ;; \
esac; \
done
@@ -624,7 +630,9 @@ bfd.h: $(BFD_H_DEP)
case $$file in \
*-in.h) cat $$file >> $@ ;; \
*/header.sed) break ;; \
- *) ./$(MKDOC) -f $(srcdir)/proto.str < $$file >> $@ ;; \
+ *) echo $$file | sed -e 's,.*/,,' -e 's,^,/* Extracted from ,' \
+ -e 's,$$,. */,' >> $@ ; \
+ ./$(MKDOC) -f $(srcdir)/proto.str < $$file >> $@ ;; \
esac; \
done
echo "#ifdef __cplusplus" >> $@
diff --git a/bfd/doc/bfdint.texi b/bfd/doc/bfdint.texi
index 76fd83245e7..d2996dcfcb3 100644
--- a/bfd/doc/bfdint.texi
+++ b/bfd/doc/bfdint.texi
@@ -1545,9 +1545,9 @@ Define @samp{ELF_ARCH} to the BFD architecture (an element of the
@item
Define @samp{ELF_MACHINE_CODE} to the magic number which should appear
in the @samp{e_machine} field of the ELF header. As of this writing,
-these magic numbers are assigned by SCO; if you want to get a magic
+these magic numbers are assigned by Caldera; if you want to get a magic
number for a particular processor, try sending a note to
-@email{registry@@sco.com}. In the BFD sources, the magic numbers are
+@email{registry@@caldera.com}. In the BFD sources, the magic numbers are
found in @file{include/elf/common.h}; they have names beginning with
@samp{EM_}.
@item
diff --git a/bfd/doc/chew.c b/bfd/doc/chew.c
index 11554ebd2f0..dc6f8110829 100644
--- a/bfd/doc/chew.c
+++ b/bfd/doc/chew.c
@@ -82,7 +82,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
Foo. */
-#include <ansidecl.h>
+#include "ansidecl.h"
#include "sysdep.h"
#include <assert.h>
#include <stdio.h>
diff --git a/bfd/ecoff.c b/bfd/ecoff.c
index c7230f6aaf8..56165a48cf8 100644
--- a/bfd/ecoff.c
+++ b/bfd/ecoff.c
@@ -661,10 +661,9 @@ _bfd_ecoff_make_empty_symbol (abfd)
ecoff_symbol_type *new;
bfd_size_type amt = sizeof (ecoff_symbol_type);
- new = (ecoff_symbol_type *) bfd_alloc (abfd, amt);
+ new = (ecoff_symbol_type *) bfd_zalloc (abfd, amt);
if (new == (ecoff_symbol_type *) NULL)
return (asymbol *) NULL;
- memset ((PTR) new, 0, sizeof *new);
new->symbol.section = (asection *) NULL;
new->fdr = (FDR *) NULL;
new->local = false;
diff --git a/bfd/ecofflink.c b/bfd/ecofflink.c
index 53d65441dbe..8044f3ab6e6 100644
--- a/bfd/ecofflink.c
+++ b/bfd/ecofflink.c
@@ -1,5 +1,5 @@
/* Routines to link ECOFF debugging information.
- Copyright 1993, 1994, 1995, 1996, 1997, 2000, 2001
+ Copyright 1993, 1994, 1995, 1996, 1997, 2000, 2001, 2002
Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support, <ian@cygnus.com>.
@@ -1650,11 +1650,10 @@ ecoff_write_shuffle (abfd, swap, shuffle, space)
bfd_byte *s;
i = swap->debug_align - (total & (swap->debug_align - 1));
- s = (bfd_byte *) bfd_malloc ((bfd_size_type) i);
+ s = (bfd_byte *) bfd_zmalloc ((bfd_size_type) i);
if (s == NULL && i != 0)
return false;
- memset ((PTR) s, 0, i);
if (bfd_bwrite ((PTR) s, (bfd_size_type) i, abfd) != i)
{
free (s);
@@ -1736,10 +1735,10 @@ bfd_ecoff_write_accumulated_debug (handle, abfd, debug, swap, info, where)
bfd_byte *s;
i = swap->debug_align - (total & (swap->debug_align - 1));
- s = (bfd_byte *) bfd_malloc ((bfd_size_type) i);
+ s = (bfd_byte *) bfd_zmalloc ((bfd_size_type) i);
if (s == NULL && i != 0)
goto error_return;
- memset ((PTR) s, 0, i);
+
if (bfd_bwrite ((PTR) s, (bfd_size_type) i, abfd) != i)
{
free (s);
@@ -1761,10 +1760,10 @@ bfd_ecoff_write_accumulated_debug (handle, abfd, debug, swap, info, where)
i = (swap->debug_align
- (debug->symbolic_header.issExtMax & (swap->debug_align - 1)));
- s = (bfd_byte *) bfd_malloc ((bfd_size_type) i);
+ s = (bfd_byte *) bfd_zmalloc ((bfd_size_type) i);
if (s == NULL && i != 0)
goto error_return;
- memset ((PTR) s, 0, i);
+
if (bfd_bwrite ((PTR) s, (bfd_size_type) i, abfd) != i)
{
free (s);
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
index 5959077d536..28dbe83c6a7 100644
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -230,9 +230,18 @@ enum elf_link_info_type
ELF_INFO_TYPE_MERGE,
ELF_INFO_TYPE_EH_FRAME,
ELF_INFO_TYPE_EH_FRAME_HDR,
+ ELF_INFO_TYPE_JUST_SYMS,
ELF_INFO_TYPE_LAST
};
+/* Cached start, size and alignment of PT_TLS segment. */
+struct elf_link_tls_segment
+{
+ bfd_vma start;
+ bfd_size_type size;
+ unsigned int align;
+};
+
/* ELF linker hash table. */
struct elf_link_hash_table
@@ -285,6 +294,9 @@ struct elf_link_hash_table
/* A linked list of DT_RPATH/DT_RUNPATH names found in dynamic
objects included in the link. */
struct bfd_link_needed_list *runpath;
+
+ /* Cached start, size and alignment of PT_TLS segment. */
+ struct elf_link_tls_segment *tls_segment;
};
/* Look up an entry in an ELF linker hash table. */
@@ -341,6 +353,8 @@ struct elf_size_info {
PARAMS ((bfd *));
void (*write_relocs)
PARAMS ((bfd *, asection *, PTR));
+ void (*swap_symbol_in)
+ PARAMS ((bfd *, const PTR, const PTR, Elf_Internal_Sym *));
void (*swap_symbol_out)
PARAMS ((bfd *, const Elf_Internal_Sym *, PTR, PTR));
boolean (*slurp_reloc_table)
@@ -478,7 +492,7 @@ struct elf_backend_data
/* A function to handle unusual section types when creating BFD
sections from ELF sections. */
boolean (*elf_backend_section_from_shdr)
- PARAMS ((bfd *, Elf32_Internal_Shdr *, char *));
+ PARAMS ((bfd *, Elf32_Internal_Shdr *, const char *));
/* A function to convert machine dependent section header flags to
BFD internal section header flags. */
@@ -705,7 +719,7 @@ struct elf_backend_data
/* Emit relocations. Overrides default routine for emitting relocs,
except during a relocatable link, or if all relocs are being emitted. */
- void (*elf_backend_emit_relocs)
+ boolean (*elf_backend_emit_relocs)
PARAMS ((bfd *, asection *, Elf_Internal_Shdr *, Elf_Internal_Rela *));
/* Count relocations. Not called for relocatable links
@@ -748,6 +762,22 @@ struct elf_backend_data
boolean (*elf_backend_write_section)
PARAMS ((bfd *, asection *, bfd_byte *));
+ /* This function, if defined, sets up the file positions for non PT_LOAD
+ segments, especially for segments containing non-allocated sections. */
+ void (*set_nonloadable_filepos)
+ PARAMS ((bfd *, Elf_Internal_Phdr *));
+
+ /* This function, if defined, returns true if the section is contained
+ within the segment. File positions are compared. */
+ boolean (*is_contained_by_filepos)
+ PARAMS ((asection *, Elf_Internal_Phdr *));
+
+ /* This function, if defined, returns true if copy_private_bfd_data
+ should be called. It provides a way of overriding default
+ test conditions in _bfd_elf_copy_private_section_data. */
+ boolean (*copy_private_bfd_data_p)
+ PARAMS ((bfd *, asection *, bfd *, asection *));
+
/* The level of IRIX compatibility we're striving for.
MIPS ELF specific function. */
irix_compat_t (*elf_backend_mips_irix_compat)
@@ -886,8 +916,13 @@ struct bfd_elf_section_data
/* Type of that information. */
enum elf_link_info_type sec_info_type;
- /* Group name, if this section is part of a group. */
- const char *group_name;
+ union {
+ /* Group name, if this section is a member of a group. */
+ const char *name;
+
+ /* Group signature sym, if this is the SHT_GROUP section. */
+ struct symbol_cache_entry *id;
+ } group;
/* A linked list of sections in the group. Circular when used by
the linker. */
@@ -898,17 +933,23 @@ struct bfd_elf_section_data
/* Nonzero if this section uses RELA relocations, rather than REL. */
unsigned int use_rela_p:1;
+
+ /* Nonzero when a group is COMDAT. */
+ unsigned int linkonce_p:1;
};
#define elf_section_data(sec) ((struct bfd_elf_section_data*)sec->used_by_bfd)
-#define elf_group_name(sec) (elf_section_data(sec)->group_name)
+#define elf_group_name(sec) (elf_section_data(sec)->group.name)
+#define elf_group_id(sec) (elf_section_data(sec)->group.id)
#define elf_next_in_group(sec) (elf_section_data(sec)->next_in_group)
+#define elf_linkonce_p(sec) (elf_section_data(sec)->linkonce_p)
/* Return true if section has been discarded. */
#define elf_discarded_section(sec) \
(!bfd_is_abs_section(sec) \
&& bfd_is_abs_section((sec)->output_section) \
- && elf_section_data (sec)->sec_info_type != ELF_INFO_TYPE_MERGE)
+ && elf_section_data (sec)->sec_info_type != ELF_INFO_TYPE_MERGE \
+ && elf_section_data (sec)->sec_info_type != ELF_INFO_TYPE_JUST_SYMS)
#define get_elf_backend_data(abfd) \
((struct elf_backend_data *) (abfd)->xvec->backend_data)
@@ -1226,10 +1267,14 @@ extern boolean _bfd_elf_link_hash_table_init
const char *)));
extern boolean _bfd_elf_slurp_version_tables
PARAMS ((bfd *));
-
extern boolean _bfd_elf_merge_sections
PARAMS ((bfd *, struct bfd_link_info *));
-
+extern boolean bfd_elf_discard_group
+ PARAMS ((bfd *, struct sec *));
+extern void bfd_elf_set_group_contents
+ PARAMS ((bfd *, asection *, PTR));
+extern void _bfd_elf_link_just_syms
+ PARAMS ((asection *, struct bfd_link_info *));
extern boolean _bfd_elf_copy_private_symbol_data
PARAMS ((bfd *, asymbol *, bfd *, asymbol *));
extern boolean _bfd_elf_copy_private_section_data
@@ -1406,8 +1451,7 @@ extern boolean bfd_elf32_bfd_final_link
PARAMS ((bfd *, struct bfd_link_info *));
extern void bfd_elf32_swap_symbol_in
- PARAMS ((bfd *, const Elf32_External_Sym *, const Elf_External_Sym_Shndx *,
- Elf_Internal_Sym *));
+ PARAMS ((bfd *, const PTR, const PTR, Elf_Internal_Sym *));
extern void bfd_elf32_swap_symbol_out
PARAMS ((bfd *, const Elf_Internal_Sym *, PTR, PTR));
extern void bfd_elf32_swap_reloc_in
@@ -1459,8 +1503,7 @@ extern boolean bfd_elf64_bfd_final_link
PARAMS ((bfd *, struct bfd_link_info *));
extern void bfd_elf64_swap_symbol_in
- PARAMS ((bfd *, const Elf64_External_Sym *, const Elf_External_Sym_Shndx *,
- Elf_Internal_Sym *));
+ PARAMS ((bfd *, const PTR, const PTR, Elf_Internal_Sym *));
extern void bfd_elf64_swap_symbol_out
PARAMS ((bfd *, const Elf_Internal_Sym *, PTR, PTR));
extern void bfd_elf64_swap_reloc_in
diff --git a/bfd/elf-eh-frame.c b/bfd/elf-eh-frame.c
index 6a23edb2c42..6f10cd7aabe 100644
--- a/bfd/elf-eh-frame.c
+++ b/bfd/elf-eh-frame.c
@@ -787,7 +787,7 @@ _bfd_elf_maybe_strip_eh_frame_hdr (info)
struct eh_frame_hdr_info *hdr_info;
sec = bfd_get_section_by_name (elf_hash_table (info)->dynobj, ".eh_frame_hdr");
- if (sec == NULL)
+ if (sec == NULL || bfd_is_abs_section (sec->output_section))
return true;
hdr_info
@@ -805,7 +805,7 @@ _bfd_elf_maybe_strip_eh_frame_hdr (info)
/* Count only sections which have at least a single CIE or FDE.
There cannot be any CIE or FDE <= 8 bytes. */
o = bfd_get_section_by_name (abfd, ".eh_frame");
- if (o && o->_raw_size > 8)
+ if (o && o->_raw_size > 8 && !bfd_is_abs_section (o->output_section))
break;
}
diff --git a/bfd/elf-m10200.c b/bfd/elf-m10200.c
index 4e8de60df94..e833af6037e 100644
--- a/bfd/elf-m10200.c
+++ b/bfd/elf-m10200.c
@@ -630,7 +630,8 @@ mn10200_elf_relax_section (abfd, sec, link_info, again)
esym = extsyms + ELF32_R_SYM (irel->r_info);
shndx = shndx_buf + (shndx_buf ? ELF32_R_SYM (irel->r_info) : 0);
- bfd_elf32_swap_symbol_in (abfd, esym, shndx, &isym);
+ bfd_elf32_swap_symbol_in (abfd, (const PTR) esym, (const PTR) shndx,
+ &isym);
if (isym.st_shndx == SHN_UNDEF)
sym_sec = bfd_und_section_ptr;
@@ -1317,7 +1318,8 @@ mn10200_elf_relax_delete_bytes (abfd, sec, addr, count)
Elf_Internal_Sym isym;
Elf_External_Sym_Shndx dummy;
- bfd_elf32_swap_symbol_in (abfd, esym, shndx, &isym);
+ bfd_elf32_swap_symbol_in (abfd, (const PTR) esym, (const PTR) shndx,
+ &isym);
if (isym.st_shndx == sec_shndx
&& isym.st_value > addr
@@ -1378,7 +1380,8 @@ mn10200_elf_symbol_address_p (abfd, sec, addr)
{
Elf_Internal_Sym isym;
- bfd_elf32_swap_symbol_in (abfd, esym, shndx, &isym);
+ bfd_elf32_swap_symbol_in (abfd, (const PTR) esym, (const PTR) shndx,
+ &isym);
if (isym.st_shndx == sec_shndx
&& isym.st_value == addr)
@@ -1500,7 +1503,8 @@ mn10200_elf_get_relocated_section_contents (output_bfd, link_info, link_order,
{
asection *isec;
- bfd_elf32_swap_symbol_in (input_bfd, esym, shndx, isymp);
+ bfd_elf32_swap_symbol_in (input_bfd, (const PTR) esym,
+ (const PTR) shndx, isymp);
if (isymp->st_shndx == SHN_UNDEF)
isec = bfd_und_section_ptr;
diff --git a/bfd/elf-m10300.c b/bfd/elf-m10300.c
index 40b4ad6368a..56350e59f8d 100644
--- a/bfd/elf-m10300.c
+++ b/bfd/elf-m10300.c
@@ -937,7 +937,9 @@ mn10300_elf_relax_section (abfd, sec, link_info, again)
esym = extsyms + r_index;
shndx = shndx_buf + (shndx_buf ? r_index : 0);
- bfd_elf32_swap_symbol_in (input_bfd, esym, shndx,
+ bfd_elf32_swap_symbol_in (input_bfd,
+ (const PTR) esym,
+ (const PTR) shndx,
&isym);
if (isym.st_shndx == SHN_UNDEF)
@@ -1028,7 +1030,8 @@ mn10300_elf_relax_section (abfd, sec, link_info, again)
{
Elf_Internal_Sym isym;
- bfd_elf32_swap_symbol_in (input_bfd, esym, shndx, &isym);
+ bfd_elf32_swap_symbol_in (input_bfd, (const PTR) esym,
+ (const PTR) shndx, &isym);
if (isym.st_shndx == sec_shndx
&& ELF_ST_TYPE (isym.st_info) == STT_FUNC)
{
@@ -1254,7 +1257,8 @@ mn10300_elf_relax_section (abfd, sec, link_info, again)
struct elf_link_hash_table *elftab;
bfd_size_type amt;
- bfd_elf32_swap_symbol_in (input_bfd, esym, shndx, &isym);
+ bfd_elf32_swap_symbol_in (input_bfd, (const PTR) esym,
+ (const PTR) shndx, &isym);
if (isym.st_shndx != sec_shndx)
continue;
@@ -1551,7 +1555,8 @@ mn10300_elf_relax_section (abfd, sec, link_info, again)
/* A local symbol. */
esym = extsyms + ELF32_R_SYM (irel->r_info);
shndx = shndx_buf + (shndx_buf ? ELF32_R_SYM (irel->r_info) : 0);
- bfd_elf32_swap_symbol_in (abfd, esym, shndx, &isym);
+ bfd_elf32_swap_symbol_in (abfd, (const PTR) esym,
+ (const PTR) shndx, &isym);
if (isym.st_shndx == SHN_UNDEF)
sym_sec = bfd_und_section_ptr;
@@ -2674,7 +2679,8 @@ mn10300_elf_relax_delete_bytes (abfd, sec, addr, count)
Elf_Internal_Sym isym;
Elf_External_Sym_Shndx dummy;
- bfd_elf32_swap_symbol_in (abfd, esym, shndx, &isym);
+ bfd_elf32_swap_symbol_in (abfd, (const PTR) esym, (const PTR) shndx,
+ &isym);
if (isym.st_shndx == sec_shndx
&& isym.st_value > addr
@@ -2735,7 +2741,8 @@ mn10300_elf_symbol_address_p (abfd, sec, addr)
{
Elf_Internal_Sym isym;
- bfd_elf32_swap_symbol_in (abfd, esym, shndx, &isym);
+ bfd_elf32_swap_symbol_in (abfd, (const PTR) esym, (const PTR) shndx,
+ &isym);
if (isym.st_shndx == sec_shndx
&& isym.st_value == addr)
@@ -2857,7 +2864,8 @@ mn10300_elf_get_relocated_section_contents (output_bfd, link_info, link_order,
{
asection *isec;
- bfd_elf32_swap_symbol_in (input_bfd, esym, shndx, isymp);
+ bfd_elf32_swap_symbol_in (input_bfd, (const PTR) esym,
+ (const PTR) shndx, isymp);
if (isymp->st_shndx == SHN_UNDEF)
isec = bfd_und_section_ptr;
diff --git a/bfd/elf-strtab.c b/bfd/elf-strtab.c
index ff7d9a4fafe..7a993c252f5 100644
--- a/bfd/elf-strtab.c
+++ b/bfd/elf-strtab.c
@@ -1,28 +1,29 @@
/* ELF strtab with GC and suffix merging support.
- Copyright 2001 Free Software Foundation, Inc.
+ Copyright 2001, 2002 Free Software Foundation, Inc.
Written by Jakub Jelinek <jakub@redhat.com>.
-This file is part of BFD, the Binary File Descriptor library.
+ This file is part of BFD, the Binary File Descriptor library.
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
#include "elf-bfd.h"
#include "hashtab.h"
+#include "libiberty.h"
/* An entry in the strtab hash table. */
@@ -351,7 +352,7 @@ _bfd_elf_strtab_finalize (tab)
qsort (array, size, sizeof (struct elf_strtab_hash_entry *), cmplengthentry);
- last4tab = htab_create (size * 4, NULL, last4_eq, NULL);
+ last4tab = htab_create_alloc (size * 4, NULL, last4_eq, NULL, calloc, free);
if (last4tab == NULL)
goto alloc_failure;
diff --git a/bfd/elf.c b/bfd/elf.c
index f8fdbd2a9fd..61b9f50b064 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -50,10 +50,10 @@ static boolean prep_headers PARAMS ((bfd *));
static boolean swap_out_syms PARAMS ((bfd *, struct bfd_strtab_hash **, int));
static boolean copy_private_bfd_data PARAMS ((bfd *, bfd *));
static char *elf_read PARAMS ((bfd *, file_ptr, bfd_size_type));
+static const char *group_signature PARAMS ((bfd *, Elf_Internal_Shdr *));
static boolean setup_group PARAMS ((bfd *, Elf_Internal_Shdr *, asection *));
static void merge_sections_remove_hook PARAMS ((bfd *, asection *));
static void elf_fake_sections PARAMS ((bfd *, asection *, PTR));
-static void set_group_contents PARAMS ((bfd *, asection *, PTR));
static boolean assign_section_numbers PARAMS ((bfd *));
static INLINE int sym_is_global PARAMS ((bfd *, asymbol *));
static boolean elf_map_symbols PARAMS ((bfd *));
@@ -361,6 +361,66 @@ typedef union elf_internal_group {
unsigned int flags;
} Elf_Internal_Group;
+/* Return the name of the group signature symbol. Why isn't the
+ signature just a string? */
+
+static const char *
+group_signature (abfd, ghdr)
+ bfd *abfd;
+ Elf_Internal_Shdr *ghdr;
+{
+ struct elf_backend_data *bed;
+ file_ptr pos;
+ bfd_size_type amt;
+ Elf_Internal_Shdr *hdr;
+ Elf_Internal_Shdr *shndx_hdr;
+ unsigned char esym[sizeof (Elf64_External_Sym)];
+ Elf_External_Sym_Shndx eshndx;
+ Elf_Internal_Sym isym;
+ unsigned int iname;
+ unsigned int shindex;
+
+ /* First we need to ensure the symbol table is available. */
+ if (! bfd_section_from_shdr (abfd, ghdr->sh_link))
+ return NULL;
+
+ /* Go read the symbol. */
+ hdr = &elf_tdata (abfd)->symtab_hdr;
+ bed = get_elf_backend_data (abfd);
+ amt = bed->s->sizeof_sym;
+ pos = hdr->sh_offset + ghdr->sh_info * amt;
+ if (bfd_seek (abfd, pos, SEEK_SET) != 0
+ || bfd_bread (esym, amt, abfd) != amt)
+ return NULL;
+
+ /* And possibly the symbol section index extension. */
+ shndx_hdr = &elf_tdata (abfd)->symtab_shndx_hdr;
+ if (elf_elfsections (abfd) != NULL
+ && elf_elfsections (abfd)[shndx_hdr->sh_link] == hdr)
+ {
+ amt = sizeof (Elf_External_Sym_Shndx);
+ pos = shndx_hdr->sh_offset + ghdr->sh_info * amt;
+ if (bfd_seek (abfd, pos, SEEK_SET) != 0
+ || bfd_bread ((PTR) &eshndx, amt, abfd) != amt)
+ return NULL;
+ }
+
+ /* Convert to internal format. */
+ (*bed->s->swap_symbol_in) (abfd, (const PTR *) &esym, (const PTR *) &eshndx,
+ &isym);
+
+ /* Look up the symbol name. */
+ iname = isym.st_name;
+ shindex = hdr->sh_link;
+ if (iname == 0 && ELF_ST_TYPE (isym.st_info) == STT_SECTION)
+ {
+ iname = elf_elfsections (abfd)[isym.st_shndx]->sh_name;
+ shindex = elf_elfheader (abfd)->e_shstrndx;
+ }
+
+ return bfd_elf_string_from_elf_section (abfd, shindex, iname);
+}
+
/* Set next_in_group list pointer, and group name for NEWSECT. */
static boolean
@@ -440,6 +500,9 @@ setup_group (abfd, hdr, newsect)
if (src == shdr->contents)
{
dest->flags = idx;
+ if (shdr->bfd_section != NULL && (idx & GRP_COMDAT))
+ shdr->bfd_section->flags
+ |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD;
break;
}
if (idx >= shnum)
@@ -492,32 +555,22 @@ setup_group (abfd, hdr, newsect)
}
else
{
- struct elf_backend_data *bed;
- file_ptr pos;
- unsigned char ename[4];
- unsigned long iname;
const char *gname;
- /* Humbug. Get the name from the group signature
- symbol. Why isn't the signature just a string?
- Fortunately, the name index is at the same
- place in the external symbol for both 32 and 64
- bit ELF. */
- bed = get_elf_backend_data (abfd);
- pos = elf_tdata (abfd)->symtab_hdr.sh_offset;
- pos += shdr->sh_info * bed->s->sizeof_sym;
- if (bfd_seek (abfd, pos, SEEK_SET) != 0
- || bfd_bread (ename, (bfd_size_type) 4, abfd) != 4)
+ gname = group_signature (abfd, shdr);
+ if (gname == NULL)
return false;
- iname = H_GET_32 (abfd, ename);
- gname = elf_string_from_elf_strtab (abfd, iname);
elf_group_name (newsect) = gname;
/* Start a circular list with one element. */
elf_next_in_group (newsect) = newsect;
}
+
+ /* If the group section has been created, point to the
+ new member. */
if (shdr->bfd_section != NULL)
elf_next_in_group (shdr->bfd_section) = newsect;
+
i = num_group - 1;
break;
}
@@ -532,6 +585,25 @@ setup_group (abfd, hdr, newsect)
return true;
}
+boolean
+bfd_elf_discard_group (abfd, group)
+ bfd *abfd ATTRIBUTE_UNUSED;
+ asection *group;
+{
+ asection *first = elf_next_in_group (group);
+ asection *s = first;
+
+ while (s != NULL)
+ {
+ s->output_section = bfd_abs_section_ptr;
+ s = elf_next_in_group (s);
+ /* These lists are circular. */
+ if (s == first)
+ break;
+ }
+ return true;
+}
+
/* Make a BFD section from an ELF section. We store a pointer to the
BFD section in the bfd_section field of the header. */
@@ -591,6 +663,8 @@ _bfd_elf_make_section_from_shdr (abfd, hdr, name)
if (hdr->sh_flags & SHF_GROUP)
if (!setup_group (abfd, hdr, newsect))
return false;
+ if ((hdr->sh_flags & SHF_TLS) != 0)
+ flags |= SEC_THREAD_LOCAL;
/* The debugging sections appear to be recognized only by name, not
any sort of flag. */
@@ -618,7 +692,8 @@ _bfd_elf_make_section_from_shdr (abfd, hdr, name)
The symbols will be defined as weak, so that multiple definitions
are permitted. The GNU linker extension is to actually discard
all but one of the sections. */
- if (strncmp (name, ".gnu.linkonce", sizeof ".gnu.linkonce" - 1) == 0)
+ if (strncmp (name, ".gnu.linkonce", sizeof ".gnu.linkonce" - 1) == 0
+ && elf_next_in_group (newsect) == NULL)
flags |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD;
bed = get_elf_backend_data (abfd);
@@ -814,6 +889,19 @@ _bfd_elf_merge_sections (abfd, info)
merge_sections_remove_hook);
return true;
}
+
+void
+_bfd_elf_link_just_syms (sec, info)
+ 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))
+ return;
+
+ elf_section_data (sec)->sec_info_type = ELF_INFO_TYPE_JUST_SYMS;
+}
/* Copy the program header and other data from one object module to
another. */
@@ -870,6 +958,7 @@ _bfd_elf_print_private_bfd_data (abfd, farg)
case PT_NOTE: pt = "NOTE"; break;
case PT_SHLIB: pt = "SHLIB"; break;
case PT_PHDR: pt = "PHDR"; break;
+ case PT_TLS: pt = "TLS"; break;
case PT_GNU_EH_FRAME: pt = "EH_FRAME"; break;
default: sprintf (buf, "0x%lx", p->p_type); pt = buf; break;
}
@@ -1560,7 +1649,7 @@ bfd_section_from_shdr (abfd, shindex)
Elf_Internal_Shdr *hdr = elf_elfsections (abfd)[shindex];
Elf_Internal_Ehdr *ehdr = elf_elfheader (abfd);
struct elf_backend_data *bed = get_elf_backend_data (abfd);
- char *name;
+ const char *name;
name = elf_string_from_elf_strtab (abfd, hdr->sh_name);
@@ -1804,7 +1893,12 @@ bfd_section_from_shdr (abfd, shindex)
return true;
case SHT_GROUP:
- /* Make a section for objcopy and relocatable links. */
+ /* We need a BFD section for objcopy and relocatable linking,
+ and it's handy to have the signature available as the section
+ name. */
+ name = group_signature (abfd, hdr);
+ if (name == NULL)
+ return false;
if (!_bfd_elf_make_section_from_shdr (abfd, hdr, name))
return false;
if (hdr->contents != NULL)
@@ -1813,6 +1907,10 @@ bfd_section_from_shdr (abfd, shindex)
unsigned int n_elt = hdr->sh_size / 4;
asection *s;
+ if (idx->flags & GRP_COMDAT)
+ hdr->bfd_section->flags
+ |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD;
+
while (--n_elt != 0)
if ((s = (++idx)->shdr->bfd_section) != NULL
&& elf_next_in_group (s) != NULL)
@@ -2259,8 +2357,10 @@ elf_fake_sections (abfd, asect, failedptrarg)
if ((asect->flags & SEC_STRINGS) != 0)
this_hdr->sh_flags |= SHF_STRINGS;
}
- if (elf_group_name (asect) != NULL)
+ if ((asect->flags & SEC_GROUP) == 0 && elf_group_name (asect) != NULL)
this_hdr->sh_flags |= SHF_GROUP;
+ if ((asect->flags & SEC_THREAD_LOCAL) != 0)
+ this_hdr->sh_flags |= SHF_TLS;
/* Check for processor-specific section types. */
if (bed->elf_backend_fake_sections
@@ -2281,35 +2381,47 @@ elf_fake_sections (abfd, asect, failedptrarg)
/* Fill in the contents of a SHT_GROUP section. */
-static void
-set_group_contents (abfd, sec, failedptrarg)
+void
+bfd_elf_set_group_contents (abfd, sec, failedptrarg)
bfd *abfd;
asection *sec;
- PTR failedptrarg ATTRIBUTE_UNUSED;
+ PTR failedptrarg;
{
boolean *failedptr = (boolean *) failedptrarg;
unsigned long symindx;
- asection *elt;
+ asection *elt, *first;
unsigned char *loc;
struct bfd_link_order *l;
+ boolean gas;
if (elf_section_data (sec)->this_hdr.sh_type != SHT_GROUP
|| *failedptr)
return;
- /* If called from the assembler, swap_out_syms will have set up
- elf_section_syms; If called for "ld -r", the symbols won't yet
- be mapped, so emulate elf_bfd_final_link. */
- if (elf_section_syms (abfd) != NULL)
- symindx = elf_section_syms (abfd)[sec->index]->udata.i;
- else
- symindx = elf_section_data (sec)->this_idx;
+ symindx = 0;
+ if (elf_group_id (sec) != NULL)
+ symindx = elf_group_id (sec)->udata.i;
+
+ if (symindx == 0)
+ {
+ /* If called from the assembler, swap_out_syms will have set up
+ elf_section_syms; If called for "ld -r", use target_index. */
+ if (elf_section_syms (abfd) != NULL)
+ symindx = elf_section_syms (abfd)[sec->index]->udata.i;
+ else
+ symindx = sec->target_index;
+ }
elf_section_data (sec)->this_hdr.sh_info = symindx;
- /* Nor will the contents be allocated for "ld -r". */
+ /* The contents won't be allocated for "ld -r" or objcopy. */
+ gas = true;
if (sec->contents == NULL)
{
+ gas = false;
sec->contents = bfd_alloc (abfd, sec->_raw_size);
+
+ /* Arrange for the section to be written out. */
+ elf_section_data (sec)->this_hdr.contents = sec->contents;
if (sec->contents == NULL)
{
*failedptr = true;
@@ -2319,9 +2431,10 @@ set_group_contents (abfd, sec, failedptrarg)
loc = sec->contents + sec->_raw_size;
- /* Get the pointer to the first section in the group that we
- squirreled away here. */
- elt = elf_next_in_group (sec);
+ /* Get the pointer to the first section in the group that gas
+ squirreled away here. objcopy arranges for this to be set to the
+ start of the input section group. */
+ first = elt = elf_next_in_group (sec);
/* First element is a flag word. Rest of section is elf section
indices for all the sections of the group. Write them backwards
@@ -2329,9 +2442,20 @@ set_group_contents (abfd, sec, failedptrarg)
directives, not that it matters. */
while (elt != NULL)
{
+ asection *s;
+ unsigned int idx;
+
loc -= 4;
- H_PUT_32 (abfd, elf_section_data (elt)->this_idx, loc);
+ s = elt;
+ if (!gas)
+ s = s->output_section;
+ idx = 0;
+ if (s != NULL)
+ idx = elf_section_data (s)->this_idx;
+ H_PUT_32 (abfd, idx, loc);
elt = elf_next_in_group (elt);
+ if (elt == first)
+ break;
}
/* If this is a relocatable link, then the above did nothing because
@@ -2350,10 +2474,16 @@ set_group_contents (abfd, sec, failedptrarg)
}
while (elt != elf_next_in_group (l->u.indirect.section));
- loc -= 4;
- H_PUT_32 (abfd, 0, loc);
+ /* With ld -r, merging SHT_GROUP sections results in wasted space
+ due to allowing for the flag word on each input. We may well
+ duplicate entries too. */
+ while ((loc -= 4) > sec->contents)
+ H_PUT_32 (abfd, 0, loc);
- BFD_ASSERT (loc == sec->contents);
+ if (loc != sec->contents)
+ abort ();
+
+ H_PUT_32 (abfd, sec->flags & SEC_LINK_ONCE ? GRP_COMDAT : 0, loc);
}
/* Assign all ELF section numbers. The dummy first section is handled here
@@ -2834,9 +2964,9 @@ _bfd_elf_compute_section_file_positions (abfd, link_info)
return false;
}
- if (link_info == NULL || link_info->relocateable)
+ if (link_info == NULL)
{
- bfd_map_over_sections (abfd, set_group_contents, &failed);
+ bfd_map_over_sections (abfd, bfd_elf_set_group_contents, &failed);
if (failed)
return false;
}
@@ -2943,6 +3073,8 @@ map_sections_to_segments (abfd)
asection **hdrpp;
boolean phdr_in_segment = true;
boolean writable;
+ int tls_count = 0;
+ asection *first_tls = NULL;
asection *dynsec, *eh_frame_hdr;
bfd_size_type amt;
@@ -3181,6 +3313,39 @@ map_sections_to_segments (abfd)
*pm = m;
pm = &m->next;
}
+ if (s->flags & SEC_THREAD_LOCAL)
+ {
+ if (! tls_count)
+ first_tls = s;
+ tls_count++;
+ }
+ }
+
+ /* If there are any SHF_TLS output sections, add PT_TLS segment. */
+ if (tls_count > 0)
+ {
+ int i;
+
+ amt = sizeof (struct elf_segment_map);
+ amt += (tls_count - 1) * sizeof (asection *);
+ m = (struct elf_segment_map *) bfd_zalloc (abfd, amt);
+ if (m == NULL)
+ goto error_return;
+ m->next = NULL;
+ m->p_type = PT_TLS;
+ m->count = tls_count;
+ /* Mandated PF_R. */
+ m->p_flags = PF_R;
+ m->p_flags_valid = 1;
+ for (i = 0; i < tls_count; ++i)
+ {
+ BFD_ASSERT (first_tls->flags & SEC_THREAD_LOCAL);
+ m->sections[i] = first_tls;
+ first_tls = first_tls->next;
+ }
+
+ *pm = m;
+ pm = &m->next;
}
/* If there is a .eh_frame_hdr section, throw in a PT_GNU_EH_FRAME
@@ -3295,6 +3460,37 @@ assign_file_positions_for_segments (abfd)
if (! map_sections_to_segments (abfd))
return false;
}
+ else
+ {
+ /* The placement algorithm assumes that non allocated sections are
+ not in PT_LOAD segments. We ensure this here by removing such
+ sections from the segment map. */
+ for (m = elf_tdata (abfd)->segment_map;
+ m != NULL;
+ m = m->next)
+ {
+ unsigned int new_count;
+ unsigned int i;
+
+ if (m->p_type != PT_LOAD)
+ continue;
+
+ new_count = 0;
+ for (i = 0; i < m->count; i ++)
+ {
+ if ((m->sections[i]->flags & SEC_ALLOC) != 0)
+ {
+ if (i != new_count)
+ m->sections[new_count] = m->sections[i];
+
+ new_count ++;
+ }
+ }
+
+ if (new_count != m->count)
+ m->count = new_count;
+ }
+ }
if (bed->elf_backend_modify_segment_map)
{
@@ -3424,8 +3620,9 @@ assign_file_positions_for_segments (abfd)
if (p->p_vaddr < (bfd_vma) off)
{
- _bfd_error_handler (_("%s: Not enough room for program headers, try linking with -N"),
- bfd_get_filename (abfd));
+ (*_bfd_error_handler)
+ (_("%s: Not enough room for program headers, try linking with -N"),
+ bfd_get_filename (abfd));
bfd_set_error (bfd_error_bad_value);
return false;
}
@@ -3605,6 +3802,20 @@ Error: First section in segment (%s) starts at 0x%x whereas the segment starts a
if ((flags & SEC_LOAD) != 0)
p->p_filesz += sec->_raw_size;
+ if (p->p_type == PT_TLS
+ && sec->_raw_size == 0
+ && (sec->flags & SEC_HAS_CONTENTS) == 0)
+ {
+ struct bfd_link_order *o;
+ bfd_vma tbss_size = 0;
+
+ for (o = sec->link_order_head; o != NULL; o = o->next)
+ if (tbss_size < o->offset + o->size)
+ tbss_size = o->offset + o->size;
+
+ p->p_memsz += tbss_size;
+ }
+
if (align > p->p_align
&& (p->p_type != PT_LOAD || (abfd->flags & D_PAGED) == 0))
p->p_align = align;
@@ -3649,6 +3860,11 @@ Error: First section in segment (%s) starts at 0x%x whereas the segment starts a
}
}
+ /* If additional nonloadable filepos adjustments are required,
+ do them now. */
+ if (bed->set_nonloadable_filepos)
+ (*bed->set_nonloadable_filepos) (abfd, phdrs);
+
/* Clear out any program headers we allocated but did not use. */
for (; count < alloc; count++, p++)
{
@@ -3739,6 +3955,16 @@ get_program_header_size (abfd)
}
}
+ for (s = abfd->sections; s != NULL; s = s->next)
+ {
+ if (s->flags & SEC_THREAD_LOCAL)
+ {
+ /* We need a PT_TLS segment. */
+ ++segs;
+ break;
+ }
+ }
+
/* Let the backend count up any program headers it might need. */
if (bed->elf_backend_additional_program_headers)
{
@@ -4197,6 +4423,7 @@ copy_private_bfd_data (ibfd, obfd)
bfd_vma maxpagesize;
struct elf_segment_map * phdr_adjust_seg = NULL;
unsigned int phdr_adjust_num = 0;
+ struct elf_backend_data * bed;
if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
|| bfd_get_flavour (obfd) != bfd_target_elf_flavour)
@@ -4205,6 +4432,7 @@ copy_private_bfd_data (ibfd, obfd)
if (elf_tdata (ibfd)->phdr == NULL)
return true;
+ bed = get_elf_backend_data (ibfd);
iehdr = elf_elfheader (ibfd);
map_first = NULL;
@@ -4232,6 +4460,13 @@ copy_private_bfd_data (ibfd, obfd)
&& (section->lma + section->_raw_size) \
<= SEGMENT_END (segment, base))
+ /* Returns true if the given section is contained within the
+ given segment. Filepos addresses are compared in an elf
+ backend function. */
+#define IS_CONTAINED_BY_FILEPOS(sec, seg, bed) \
+ (bed->is_contained_by_filepos \
+ && (*bed->is_contained_by_filepos) (sec, seg))
+
/* Special case: corefile "NOTE" section containing regs, prpsinfo etc. */
#define IS_COREFILE_NOTE(p, s) \
(p->p_type == PT_NOTE \
@@ -4260,13 +4495,15 @@ copy_private_bfd_data (ibfd, 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. */
-#define INCLUDE_SECTION_IN_SEGMENT(section, segment) \
+#define INCLUDE_SECTION_IN_SEGMENT(section, segment, bed) \
(((((segment->p_paddr \
? IS_CONTAINED_BY_LMA (section, segment, segment->p_paddr) \
: IS_CONTAINED_BY_VMA (section, segment)) \
|| IS_SOLARIS_PT_INTERP (segment, section)) \
&& (section->flags & SEC_ALLOC) != 0) \
- || IS_COREFILE_NOTE (segment, section)) \
+ || IS_COREFILE_NOTE (segment, section) \
+ || (IS_CONTAINED_BY_FILEPOS (section, segment, bed) \
+ && (section->flags & SEC_ALLOC) == 0)) \
&& section->output_section != NULL \
&& section->segment_mark == false)
@@ -4366,7 +4603,7 @@ copy_private_bfd_data (ibfd, obfd)
/* Compute how many sections might be placed into this segment. */
section_count = 0;
for (section = ibfd->sections; section != NULL; section = section->next)
- if (INCLUDE_SECTION_IN_SEGMENT (section, segment))
+ if (INCLUDE_SECTION_IN_SEGMENT (section, segment, bed))
++section_count;
/* Allocate a segment map big enough to contain all of the
@@ -4409,11 +4646,12 @@ copy_private_bfd_data (ibfd, obfd)
{
/* Special segments, such as the PT_PHDR segment, may contain
no sections, but ordinary, loadable segments should contain
- something. */
+ something. They are allowed by the ELF spec however, so only
+ a warning is produced. */
if (segment->p_type == PT_LOAD)
- _bfd_error_handler
- (_("%s: warning: Empty loadable segment detected\n"),
- bfd_archive_filename (ibfd));
+ (*_bfd_error_handler)
+ (_("%s: warning: Empty loadable segment detected, is this intentional ?\n"),
+ bfd_archive_filename (ibfd));
map->count = 0;
*pointer_to_map = map;
@@ -4450,7 +4688,9 @@ copy_private_bfd_data (ibfd, obfd)
pointers that we are interested in. As these sections get assigned
to a segment, they are removed from this array. */
- amt = (bfd_size_type) section_count * sizeof (asection *);
+ /* Gcc 2.96 miscompiles this code on mips. Don't do casting here
+ to work around this long long bug. */
+ amt = section_count * sizeof (asection *);
sections = (asection **) bfd_malloc (amt);
if (sections == NULL)
return false;
@@ -4469,7 +4709,7 @@ copy_private_bfd_data (ibfd, obfd)
section != NULL;
section = section->next)
{
- if (INCLUDE_SECTION_IN_SEGMENT (section, segment))
+ if (INCLUDE_SECTION_IN_SEGMENT (section, segment, bed))
{
output_section = section->output_section;
@@ -4495,6 +4735,7 @@ copy_private_bfd_data (ibfd, obfd)
/* Match up the physical address of the segment with the
LMA address of the output section. */
if (IS_CONTAINED_BY_LMA (output_section, segment, map->p_paddr)
+ || IS_CONTAINED_BY_FILEPOS (section, segment, bed)
|| IS_COREFILE_NOTE (segment, section))
{
if (matching_lma == 0)
@@ -4564,7 +4805,7 @@ copy_private_bfd_data (ibfd, obfd)
}
/* Step Three: Loop over the sections again, this time assigning
- those that fit to the current segment and remvoing them from the
+ those that fit to the current segment and removing them from the
sections array; but making sure not to leave large gaps. Once all
possible sections have been assigned to the current segment it is
added to the list of built segments and if sections still remain
@@ -4615,7 +4856,7 @@ copy_private_bfd_data (ibfd, obfd)
maxpagesize then we need to start a new segment. */
if ((BFD_ALIGN (prev_sec->lma + prev_sec->_raw_size,
maxpagesize)
- < BFD_ALIGN (output_section->lma, maxpagesize))
+ < BFD_ALIGN (output_section->lma, maxpagesize))
|| ((prev_sec->lma + prev_sec->_raw_size)
> output_section->lma))
{
@@ -4728,6 +4969,7 @@ copy_private_bfd_data (ibfd, obfd)
#undef SEGMENT_END
#undef IS_CONTAINED_BY_VMA
#undef IS_CONTAINED_BY_LMA
+#undef IS_CONTAINED_BY_FILEPOS
#undef IS_COREFILE_NOTE
#undef IS_SOLARIS_PT_INTERP
#undef INCLUDE_SECTION_IN_SEGMENT
@@ -4747,6 +4989,7 @@ _bfd_elf_copy_private_section_data (ibfd, isec, obfd, osec)
asection *osec;
{
Elf_Internal_Shdr *ihdr, *ohdr;
+ const struct elf_backend_data *bed = get_elf_backend_data (ibfd);
if (ibfd->xvec->flavour != bfd_target_elf_flavour
|| obfd->xvec->flavour != bfd_target_elf_flavour)
@@ -4756,24 +4999,31 @@ _bfd_elf_copy_private_section_data (ibfd, isec, obfd, osec)
This must be done here, rather than in the copy_private_bfd_data
entry point, because the latter is called after the section
contents have been set, which means that the program headers have
- already been worked out. */
- if (elf_tdata (obfd)->segment_map == NULL
- && elf_tdata (ibfd)->phdr != NULL)
- {
- asection *s;
-
- /* Only set up the segments if there are no more SEC_ALLOC
- sections. FIXME: This won't do the right thing if objcopy is
- used to remove the last SEC_ALLOC section, since objcopy
- won't call this routine in that case. */
- for (s = isec->next; s != NULL; s = s->next)
- if ((s->flags & SEC_ALLOC) != 0)
- break;
- if (s == NULL)
- {
- if (! copy_private_bfd_data (ibfd, obfd))
- return false;
- }
+ already been worked out. The backend function provides a way to
+ override the test conditions and code path for the call to
+ copy_private_bfd_data. */
+ if (bed->copy_private_bfd_data_p)
+ {
+ if ((*bed->copy_private_bfd_data_p) (ibfd, isec, obfd, osec))
+ if (! copy_private_bfd_data (ibfd, obfd))
+ return false;
+ }
+ else if (elf_tdata (obfd)->segment_map == NULL && elf_tdata (ibfd)->phdr != NULL)
+ {
+ asection *s;
+
+ /* Only set up the segments if there are no more SEC_ALLOC
+ sections. FIXME: This won't do the right thing if objcopy is
+ used to remove the last SEC_ALLOC section, since objcopy
+ won't call this routine in that case. */
+ for (s = isec->next; s != NULL; s = s->next)
+ if ((s->flags & SEC_ALLOC) != 0)
+ break;
+ if (s == NULL)
+ {
+ if (! copy_private_bfd_data (ibfd, obfd))
+ return false;
+ }
}
ihdr = &elf_section_data (isec)->this_hdr;
@@ -4787,6 +5037,12 @@ _bfd_elf_copy_private_section_data (ibfd, isec, obfd, osec)
|| ihdr->sh_type == SHT_GNU_verdef)
ohdr->sh_info = ihdr->sh_info;
+ /* Set things up for objcopy. The output SHT_GROUP section will
+ have its elf_next_in_group pointing back to the input group
+ members. */
+ elf_next_in_group (osec) = elf_next_in_group (isec);
+ elf_group_name (osec) = elf_group_name (isec);
+
elf_section_data (osec)->use_rela_p
= elf_section_data (isec)->use_rela_p;
@@ -4895,10 +5151,9 @@ swap_out_syms (abfd, sttp, relocatable_p)
if (symtab_shndx_hdr->sh_name != 0)
{
amt = (bfd_size_type) (1 + symcount) * sizeof (Elf_External_Sym_Shndx);
- outbound_shndx = bfd_alloc (abfd, amt);
+ outbound_shndx = bfd_zalloc (abfd, amt);
if (outbound_shndx == NULL)
return false;
- memset (outbound_shndx, 0, (unsigned long) amt);
symtab_shndx_hdr->contents = outbound_shndx;
symtab_shndx_hdr->sh_type = SHT_SYMTAB_SHNDX;
symtab_shndx_hdr->sh_size = amt;
@@ -5032,13 +5287,18 @@ swap_out_syms (abfd, sttp, relocatable_p)
sym.st_shndx = shndx;
}
- if ((flags & BSF_FUNCTION) != 0)
+ if ((flags & BSF_THREAD_LOCAL) != 0)
+ type = STT_TLS;
+ else if ((flags & BSF_FUNCTION) != 0)
type = STT_FUNC;
else if ((flags & BSF_OBJECT) != 0)
type = STT_OBJECT;
else
type = STT_NOTYPE;
+ if (syms[idx]->section->flags & SEC_THREAD_LOCAL)
+ type = STT_TLS;
+
/* Processor-specific types */
if (type_ptr != NULL
&& bed->elf_backend_get_symbol_type)
diff --git a/bfd/elf32-arc.c b/bfd/elf32-arc.c
index ad7247ac0ff..ff5c5f47189 100644
--- a/bfd/elf32-arc.c
+++ b/bfd/elf32-arc.c
@@ -235,7 +235,7 @@ arc_elf_b22_pcrel (abfd, reloc_entry, symbol, data, input_section,
return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data,
input_section, output_bfd, error_message);
}
-
+
#define TARGET_LITTLE_SYM bfd_elf32_littlearc_vec
#define TARGET_LITTLE_NAME "elf32-littlearc"
#define TARGET_BIG_SYM bfd_elf32_bigarc_vec
diff --git a/bfd/elf32-arm.h b/bfd/elf32-arm.h
index 91ea63b38b0..939eee5f482 100644
--- a/bfd/elf32-arm.h
+++ b/bfd/elf32-arm.h
@@ -547,31 +547,22 @@ record_thumb_to_arm_glue (link_info, h)
return;
}
-/* Select a BFD to be used to hold the sections used by the glue code.
- This function is called from the linker scripts in ld/emultempl/
- {armelf/pe}.em */
+/* Add the glue sections to ABFD. This function is called from the
+ linker scripts in ld/emultempl/{armelf}.em. */
boolean
-bfd_elf32_arm_get_bfd_for_interworking (abfd, info)
+bfd_elf32_arm_add_glue_sections_to_bfd (abfd, info)
bfd *abfd;
struct bfd_link_info *info;
{
- struct elf32_arm_link_hash_table *globals;
flagword flags;
asection *sec;
- /* If we are only performing a partial link do not bother
- getting a bfd to hold the glue. */
+ /* If we are only performing a partial
+ link do not bother adding the glue. */
if (info->relocateable)
return true;
- globals = elf32_arm_hash_table (info);
-
- BFD_ASSERT (globals != NULL);
-
- if (globals->bfd_of_glue_owner != NULL)
- return true;
-
sec = bfd_get_section_by_name (abfd, ARM2THUMB_GLUE_SECTION_NAME);
if (sec == NULL)
@@ -609,6 +600,32 @@ bfd_elf32_arm_get_bfd_for_interworking (abfd, info)
sec->gc_mark = 1;
}
+ return true;
+}
+
+/* Select a BFD to be used to hold the sections used by the glue code.
+ This function is called from the linker scripts in ld/emultempl/
+ {armelf/pe}.em */
+
+boolean
+bfd_elf32_arm_get_bfd_for_interworking (abfd, info)
+ bfd *abfd;
+ struct bfd_link_info *info;
+{
+ struct elf32_arm_link_hash_table *globals;
+
+ /* If we are only performing a partial link
+ do not bother getting a bfd to hold the glue. */
+ if (info->relocateable)
+ return true;
+
+ globals = elf32_arm_hash_table (info);
+
+ BFD_ASSERT (globals != NULL);
+
+ if (globals->bfd_of_glue_owner != NULL)
+ return true;
+
/* Save the bfd for later use. */
globals->bfd_of_glue_owner = abfd;
@@ -1471,22 +1488,19 @@ elf32_arm_final_link_relocate (howto, input_bfd, output_bfd,
if (signed_check > reloc_signed_max || signed_check < reloc_signed_min)
overflow = true;
- /* Put RELOCATION back into the insn. */
- upper_insn = (upper_insn & ~(bfd_vma) 0x7ff) | ((relocation >> 12) & 0x7ff);
- lower_insn = (lower_insn & ~(bfd_vma) 0x7ff) | ((relocation >> 1) & 0x7ff);
-
#ifndef OLD_ARM_ABI
if (r_type == R_ARM_THM_XPC22
&& ((lower_insn & 0x1800) == 0x0800))
- /* Remove bit zero of the adjusted offset. Bit zero can only be
- set if the upper insn is at a half-word boundary, since the
- destination address, an ARM instruction, must always be on a
- word boundary. The semantics of the BLX (1) instruction, however,
- are that bit zero in the offset must always be zero, and the
- corresponding bit one in the target address will be set from bit
- one of the source address. */
- lower_insn &= ~1;
+ /* For a BLX instruction, make sure that the relocation is rounded up
+ to a word boundary. This follows the semantics of the instruction
+ which specifies that bit 1 of the target address will come from bit
+ 1 of the base address. */
+ relocation = (relocation + 2) & ~ 3;
#endif
+ /* Put RELOCATION back into the insn. */
+ upper_insn = (upper_insn & ~(bfd_vma) 0x7ff) | ((relocation >> 12) & 0x7ff);
+ lower_insn = (lower_insn & ~(bfd_vma) 0x7ff) | ((relocation >> 1) & 0x7ff);
+
/* Put the relocated value back in the object file: */
bfd_put_16 (input_bfd, upper_insn, hit_data);
bfd_put_16 (input_bfd, lower_insn, hit_data + 2);
@@ -1526,7 +1540,7 @@ elf32_arm_final_link_relocate (howto, input_bfd, output_bfd,
signed_check = check | ~((bfd_vma) -1 >> howto->rightshift);
relocation |= (bfd_get_16 (input_bfd, hit_data) & (~ howto->dst_mask));
-
+
bfd_put_16 (input_bfd, relocation, hit_data);
/* Assumes two's complement. */
@@ -1535,7 +1549,7 @@ elf32_arm_final_link_relocate (howto, input_bfd, output_bfd,
return bfd_reloc_ok;
}
-
+
case R_ARM_GNU_VTINHERIT:
case R_ARM_GNU_VTENTRY:
return bfd_reloc_ok;
@@ -1560,7 +1574,7 @@ elf32_arm_final_link_relocate (howto, input_bfd, output_bfd,
if (sgot == NULL)
return bfd_reloc_notsupported;
- /* If we are addressing a Thumb function, we need to adjust the
+ /* If we are addressing a Thumb function, we need to adjust the
address by one, so that attempts to call the function pointer will
correctly interpret it as Thumb code. */
if (sym_flags == STT_ARM_TFUNC)
@@ -2360,7 +2374,7 @@ ERROR: %s uses hardware FP, whereas %s uses software FP"),
_bfd_error_handler (_("\
Warning: %s supports interworking, whereas %s does not"),
bfd_archive_filename (ibfd),
- bfd_get_filename (obfd));
+ bfd_get_filename (obfd));
}
else
{
diff --git a/bfd/elf32-cris.c b/bfd/elf32-cris.c
index ab72483304b..28fecf18aaf 100644
--- a/bfd/elf32-cris.c
+++ b/bfd/elf32-cris.c
@@ -547,7 +547,7 @@ cris_elf_grok_psinfo (abfd, note)
static const bfd_byte elf_cris_plt0_entry[PLT_ENTRY_SIZE] =
{
0xfc, 0xe1,
- 0x7e, 0x7e, /* push mof. */
+ 0x7e, 0x7e, /* push mof. */
0x7f, 0x0d, /* (dip [pc+]) */
0, 0, 0, 0, /* Replaced with address of .got + 4. */
0x30, 0x7a, /* move [...],mof */
diff --git a/bfd/elf32-dlx.c b/bfd/elf32-dlx.c
new file mode 100644
index 00000000000..91d75f3360a
--- /dev/null
+++ b/bfd/elf32-dlx.c
@@ -0,0 +1,659 @@
+/* DLX specific support for 32-bit ELF
+ Copyright 2002 Free Software Foundation, Inc.
+
+ 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 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 "bfd.h"
+#include "sysdep.h"
+#include "libbfd.h"
+#include "elf-bfd.h"
+#include "elf/dlx.h"
+
+int set_dlx_skip_hi16_flag PARAMS ((int));
+
+static boolean elf32_dlx_check_relocs
+ PARAMS ((bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *));
+static void elf32_dlx_info_to_howto
+ PARAMS ((bfd *, arelent *, Elf32_Internal_Rela *));
+static void elf32_dlx_info_to_howto_rel
+ PARAMS ((bfd *, arelent *, Elf32_Internal_Rel *));
+static bfd_reloc_status_type elf32_dlx_relocate16
+ PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
+static bfd_reloc_status_type elf32_dlx_relocate26
+ PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
+static reloc_howto_type *elf32_dlx_reloc_type_lookup
+ PARAMS ((bfd *, bfd_reloc_code_real_type));
+static bfd_reloc_status_type _bfd_dlx_elf_hi16_reloc
+ PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
+static reloc_howto_type * dlx_rtype_to_howto
+ PARAMS ((unsigned int));
+
+
+#define USE_REL 1
+
+#define bfd_elf32_bfd_reloc_type_lookup elf32_dlx_reloc_type_lookup
+#define elf_info_to_howto elf32_dlx_info_to_howto
+#define elf_info_to_howto_rel elf32_dlx_info_to_howto_rel
+#define elf_backend_check_relocs elf32_dlx_check_relocs
+
+static reloc_howto_type dlx_elf_howto_table[]=
+ {
+ /* No relocation. */
+ HOWTO (R_DLX_NONE, /* type */
+ 0, /* rightshift */
+ 0, /* size (0 = byte, 1 = short, 2 = long) */
+ 0, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_DLX_NONE", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* 8 bit relocation. */
+ HOWTO (R_DLX_RELOC_8, /* type */
+ 0, /* rightshift */
+ 0, /* size (0 = byte, 1 = short, 2 = long) */
+ 8, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_DLX_RELOC_8", /* name */
+ true, /* partial_inplace */
+ 0xff, /* src_mask */
+ 0xff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* 16 bit relocation. */
+ HOWTO (R_DLX_RELOC_16, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_DLX_RELOC_16", /* name */
+ true, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+#if 0
+ /* 26 bit jump address. */
+ HOWTO (R_DLX_RELOC_26, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 26, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ /* This needs complex overflow detection, because the upper four
+ bits must match the PC + 4. */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_DLX_RELOC_26", /* name */
+ true, /* partial_inplace */
+ 0x3ffffff, /* src_mask */
+ 0x3ffffff, /* dst_mask */
+ false), /* pcrel_offset */
+#endif
+
+ /* 32 bit relocation. */
+ HOWTO (R_DLX_RELOC_32, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_DLX_RELOC_32", /* name */
+ true, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* GNU extension to record C++ vtable hierarchy */
+ HOWTO (R_DLX_GNU_VTINHERIT, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 0, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ NULL, /* special_function */
+ "R_DLX_GNU_VTINHERIT", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* GNU extension to record C++ vtable member usage */
+ HOWTO (R_DLX_GNU_VTENTRY, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 0, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ _bfd_elf_rel_vtable_reloc_fn,/* special_function */
+ "R_DLX_GNU_VTENTRY", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
+ false) /* pcrel_offset */
+ };
+
+/* 16 bit offset for pc-relative branches. */
+static reloc_howto_type elf_dlx_gnu_rel16_s2 =
+HOWTO (R_DLX_RELOC_16_PCREL, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ true, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ elf32_dlx_relocate16, /* special_function */
+ "R_DLX_RELOC_16_PCREL",/* name */
+ true, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ true); /* pcrel_offset */
+
+/* 26 bit offset for pc-relative branches. */
+static reloc_howto_type elf_dlx_gnu_rel26_s2 =
+HOWTO (R_DLX_RELOC_26_PCREL, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 26, /* bitsize */
+ true, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ elf32_dlx_relocate26, /* special_function */
+ "R_DLX_RELOC_26_PCREL",/* name */
+ true, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ true); /* pcrel_offset */
+
+/* High 16 bits of symbol value. */
+static reloc_howto_type elf_dlx_reloc_16_hi =
+HOWTO (R_DLX_RELOC_16_HI, /* type */
+ 16, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ _bfd_dlx_elf_hi16_reloc,/* special_function */
+ "R_DLX_RELOC_16_HI", /* name */
+ true, /* partial_inplace */
+ 0xFFFF, /* src_mask */
+ 0xffff, /* dst_mask */
+ false); /* pcrel_offset */
+
+ /* Low 16 bits of symbol value. */
+static reloc_howto_type elf_dlx_reloc_16_lo =
+HOWTO (R_DLX_RELOC_16_LO, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_DLX_RELOC_16_LO", /* name */
+ true, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ false); /* pcrel_offset */
+
+
+/* The gas default beheaver 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
+ value that was placed there by gas. */
+
+static int skip_dlx_elf_hi16_reloc = 0;
+
+int
+set_dlx_skip_hi16_flag (flag)
+ int flag;
+{
+ skip_dlx_elf_hi16_reloc = flag;
+ return flag;
+}
+
+static bfd_reloc_status_type
+_bfd_dlx_elf_hi16_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_reloc_status_type ret;
+ bfd_vma relocation;
+
+ /* If the skip flag is set then we simply do the generic relocating, this
+ is more of a hack for dlx gas/gld, so we do not need to do the %hi/%lo
+ fixup like mips gld did. */
+#if 0
+ printf ("DEBUG: skip_dlx_elf_hi16_reloc = 0x%08x\n", skip_dlx_elf_hi16_reloc);
+#endif
+ if (skip_dlx_elf_hi16_reloc)
+ return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data,
+ input_section, output_bfd, error_message);
+
+ /* If we're relocating, and this an external symbol, we don't want
+ to change anything. */
+ if (output_bfd != (bfd *) NULL
+ && (symbol->flags & BSF_SECTION_SYM) == 0
+ && reloc_entry->addend == 0)
+ {
+ reloc_entry->address += input_section->output_offset;
+ return bfd_reloc_ok;
+ }
+
+ ret = bfd_reloc_ok;
+
+ if (bfd_is_und_section (symbol->section)
+ && output_bfd == (bfd *) NULL)
+ ret = bfd_reloc_undefined;
+
+#if 0
+ {
+ unsigned long vallo, val;
+
+ vallo = bfd_get_16 (abfd, (bfd_byte *) data + reloc_entry->address);
+ printf ("DEBUG: The relocation address = 0x%08x\n", reloc_entry->address);
+ printf ("DEBUG: The symbol = 0x%08x\n", vallo);
+ printf ("DEBUG: The symbol name = %s\n", bfd_asymbol_name (symbol));
+ printf ("DEBUG: The symbol->value = 0x%08x\n", symbol->value);
+ printf ("DEBUG: The vma = 0x%08x\n", symbol->section->output_section->vma);
+ printf ("DEBUG: The output_offset = 0x%08x\n", symbol->section->output_offset);
+ printf ("DEBUG: The input_offset = 0x%08x\n", input_section->output_offset);
+ printf ("DEBUG: The input_vma = 0x%08x\n", input_section->vma);
+ printf ("DEBUG: The addend = 0x%08x\n", reloc_entry->addend);
+ }
+#endif
+
+ relocation = (bfd_is_com_section (symbol->section)) ? 0 : symbol->value;
+ relocation += symbol->section->output_section->vma;
+ relocation += symbol->section->output_offset;
+ relocation += reloc_entry->addend;
+ relocation += bfd_get_16 (abfd, (bfd_byte *)data + reloc_entry->address);
+
+ if (reloc_entry->address > input_section->_cooked_size)
+ return bfd_reloc_outofrange;
+
+#if 0
+ printf ("DEBUG: The finial relocation value = 0x%08x\n", relocation);
+#endif
+
+ bfd_put_16 (abfd, (short)((relocation >> 16) & 0xFFFF),
+ (bfd_byte *)data + reloc_entry->address);
+
+ return ret;
+}
+
+/* ELF relocs are against symbols. If we are producing relocateable
+ output, and the reloc is against an external symbol, and nothing
+ has given us any additional addend, the resulting reloc will also
+ be against the same symbol. In such a case, we don't want to
+ change anything about the way the reloc is handled, since it will
+ all be done at final link time. Rather than put special case code
+ into bfd_perform_relocation, all the reloc types use this howto
+ function. It just short circuits the reloc if producing
+ relocateable output against an external symbol. */
+
+static bfd_reloc_status_type
+elf32_dlx_relocate16 (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 ATTRIBUTE_UNUSED;
+{
+ unsigned long insn, vallo, allignment;
+ int val;
+
+ /* HACK: I think this first condition is necessary when producing
+ relocatable output. After the end of HACK, the code is identical
+ to bfd_elf_generic_reloc(). I would _guess_ the first change
+ belongs there rather than here. martindo 1998-10-23. */
+
+ if (skip_dlx_elf_hi16_reloc)
+ return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data,
+ input_section, output_bfd, error_message);
+
+ /* Check undefined section and undefined symbols */
+ if (bfd_is_und_section (symbol->section)
+ && output_bfd == (bfd *) NULL)
+ return bfd_reloc_undefined;
+
+ /* Can not support a long jump to sections other then .text */
+ if (strcmp (input_section->name, symbol->section->output_section->name) != 0)
+ {
+ fprintf (stderr,
+ "BFD Link Error: branch (PC rel16) to section (%s) not supported\n",
+ symbol->section->output_section->name);
+ return bfd_reloc_undefined;
+ }
+
+ insn = bfd_get_32 (abfd, (bfd_byte *)data + reloc_entry->address);
+ allignment = 1 << (input_section->output_section->alignment_power - 1);
+ vallo = insn & 0x0000FFFF;
+
+ if (vallo & 0x8000)
+ vallo = ~(vallo | 0xFFFF0000) + 1;
+
+ /* vallo points to the vma of next instruction. */
+ vallo += (((unsigned long)(input_section->output_section->vma +
+ input_section->output_offset) +
+ allignment) & ~allignment);
+
+ /* val is the displacement (PC relative to next instruction). */
+ val = (symbol->section->output_offset +
+ symbol->section->output_section->vma +
+ symbol->value) - vallo;
+#if 0
+ printf ("DEBUG elf32_dlx_relocate: We are here\n");
+ printf ("DEBUG: The insn = 0x%08x\n", insn);
+ printf ("DEBUG: The vallo = 0x%08x\n", vallo);
+ printf ("DEBUG: The val = 0x%08x\n", val);
+ printf ("DEBUG: The symbol name = %s\n", bfd_asymbol_name (symbol));
+ printf ("DEBUG: The symbol->value = 0x%08x\n", symbol->value);
+ printf ("DEBUG: The vma = 0x%08x\n", symbol->section->output_section->vma);
+ printf ("DEBUG: The lma = 0x%08x\n", symbol->section->output_section->lma);
+ printf ("DEBUG: The alignment_power = 0x%08x\n", symbol->section->output_section->alignment_power);
+ printf ("DEBUG: The output_offset = 0x%08x\n", symbol->section->output_offset);
+ printf ("DEBUG: The addend = 0x%08x\n", reloc_entry->addend);
+#endif
+
+ if (abs ((int) val) > 0x00007FFF)
+ return bfd_reloc_outofrange;
+
+ insn = (insn & 0xFFFF0000) | (val & 0x0000FFFF);
+
+ bfd_put_32 (abfd, insn,
+ (bfd_byte *) data + reloc_entry->address);
+
+ return bfd_reloc_ok;
+}
+
+static bfd_reloc_status_type
+elf32_dlx_relocate26 (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 ATTRIBUTE_UNUSED;
+{
+ unsigned long insn, vallo, allignment;
+ int val;
+
+ /* HACK: I think this first condition is necessary when producing
+ relocatable output. After the end of HACK, the code is identical
+ to bfd_elf_generic_reloc(). I would _guess_ the first change
+ belongs there rather than here. martindo 1998-10-23. */
+
+ if (skip_dlx_elf_hi16_reloc)
+ return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data,
+ input_section, output_bfd, error_message);
+
+ /* Check undefined section and undefined symbols. */
+ if (bfd_is_und_section (symbol->section)
+ && output_bfd == (bfd *) NULL)
+ return bfd_reloc_undefined;
+
+ /* Can not support a long jump to sections other then .text */
+ if (strcmp (input_section->name, symbol->section->output_section->name) != 0)
+ {
+ fprintf (stderr,
+ "BFD Link Error: jump (PC rel26) to section (%s) not supported\n",
+ symbol->section->output_section->name);
+ return bfd_reloc_undefined;
+ }
+
+ insn = bfd_get_32 (abfd, (bfd_byte *)data + reloc_entry->address);
+ allignment = 1 << (input_section->output_section->alignment_power - 1);
+ vallo = insn & 0x03FFFFFF;
+
+ if (vallo & 0x03000000)
+ vallo = ~(vallo | 0xFC000000) + 1;
+
+ /* vallo is the vma for the next instruction. */
+ vallo += (((unsigned long) (input_section->output_section->vma +
+ input_section->output_offset) +
+ allignment) & ~allignment);
+
+ /* val is the displacement (PC relative to next instruction). */
+ val = (symbol->section->output_offset +
+ symbol->section->output_section->vma + symbol->value)
+ - vallo;
+#if 0
+ printf ("DEBUG elf32_dlx_relocate26: We are here\n");
+ printf ("DEBUG: The insn = 0x%08x\n", insn);
+ printf ("DEBUG: The vallo = 0x%08x\n", vallo);
+ printf ("DEBUG: The val = 0x%08x\n", val);
+ printf ("DEBUG: The abs(val) = 0x%08x\n", abs (val));
+ printf ("DEBUG: The symbol name = %s\n", bfd_asymbol_name (symbol));
+ printf ("DEBUG: The symbol->value = 0x%08x\n", symbol->value);
+ printf ("DEBUG: The vma = 0x%08x\n", symbol->section->output_section->vma);
+ printf ("DEBUG: The output_offset = 0x%08x\n", symbol->section->output_offset);
+ printf ("DEBUG: The input_vma = 0x%08x\n", input_section->output_section->vma);
+ printf ("DEBUG: The input_offset = 0x%08x\n", input_section->output_offset);
+ printf ("DEBUG: The input_name = %s\n", input_section->name);
+ printf ("DEBUG: The addend = 0x%08x\n", reloc_entry->addend);
+#endif
+
+ if (abs ((int) val) > 0x01FFFFFF)
+ return bfd_reloc_outofrange;
+
+ insn = (insn & 0xFC000000) | (val & 0x03FFFFFF);
+ bfd_put_32 (abfd, insn,
+ (bfd_byte *) data + reloc_entry->address);
+
+ return bfd_reloc_ok;
+}
+
+/* A mapping from BFD reloc types to DLX ELF reloc types.
+ Stolen from elf32-mips.c.
+
+ 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
+ is to remove those entries which may cause problem. */
+struct elf_reloc_map
+{
+ bfd_reloc_code_real_type bfd_reloc_val;
+ enum elf_dlx_reloc_type elf_reloc_val;
+};
+
+static const struct elf_reloc_map dlx_reloc_map[] =
+ {
+ { BFD_RELOC_NONE, R_DLX_NONE },
+ { BFD_RELOC_16, R_DLX_RELOC_16 },
+#if 0
+ { BFD_RELOC_DLX_JMP26, R_DLX_RELOC_26_PCREL },
+#endif
+ { BFD_RELOC_32, R_DLX_RELOC_32 },
+ { BFD_RELOC_DLX_HI16_S, R_DLX_RELOC_16_HI },
+ { BFD_RELOC_DLX_LO16, R_DLX_RELOC_16_LO },
+ { BFD_RELOC_VTABLE_INHERIT, R_DLX_GNU_VTINHERIT },
+ { BFD_RELOC_VTABLE_ENTRY, R_DLX_GNU_VTENTRY }
+ };
+
+
+/* Look through the relocs for a section during the first phase.
+ Since we don't do .gots or .plts, we just need to consider the
+ virtual table relocs for gc. */
+
+static boolean
+elf32_dlx_check_relocs (abfd, info, sec, relocs)
+ bfd *abfd;
+ struct bfd_link_info *info;
+ asection *sec;
+ const Elf_Internal_Rela *relocs;
+{
+ Elf_Internal_Shdr *symtab_hdr;
+ struct elf_link_hash_entry **sym_hashes, **sym_hashes_end;
+ const Elf_Internal_Rela *rel;
+ const Elf_Internal_Rela *rel_end;
+
+ if (info->relocateable)
+ return true;
+
+ symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
+ sym_hashes = elf_sym_hashes (abfd);
+ sym_hashes_end = sym_hashes + symtab_hdr->sh_size / sizeof (Elf32_External_Sym);
+ if (!elf_bad_symtab (abfd))
+ sym_hashes_end -= symtab_hdr->sh_info;
+
+ rel_end = relocs + sec->reloc_count;
+ for (rel = relocs; rel < rel_end; rel++)
+ {
+ struct elf_link_hash_entry *h;
+ unsigned long r_symndx;
+
+ r_symndx = ELF32_R_SYM (rel->r_info);
+ if (r_symndx < symtab_hdr->sh_info)
+ h = NULL;
+ else
+ h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+
+ switch (ELF32_R_TYPE (rel->r_info))
+ {
+ /* This relocation describes the C++ object vtable hierarchy.
+ Reconstruct it for later use during GC. */
+ case R_DLX_GNU_VTINHERIT:
+ if (!_bfd_elf32_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
+ return false;
+ break;
+
+ /* This relocation describes which C++ vtable entries are actually
+ used. Record for later use during GC. */
+ case R_DLX_GNU_VTENTRY:
+ if (!_bfd_elf32_gc_record_vtentry (abfd, sec, h, rel->r_addend))
+ return false;
+ break;
+ }
+ }
+
+ return true;
+}
+
+/* Given a BFD reloc type, return a howto structure. */
+
+static reloc_howto_type *
+elf32_dlx_reloc_type_lookup (abfd, code)
+ bfd *abfd ATTRIBUTE_UNUSED;
+ bfd_reloc_code_real_type code;
+{
+ unsigned int i;
+
+ for (i = 0; i < sizeof (dlx_reloc_map) / sizeof (struct elf_reloc_map); i++)
+ if (dlx_reloc_map[i].bfd_reloc_val == code)
+ return &dlx_elf_howto_table[(int) dlx_reloc_map[i].elf_reloc_val];
+
+ switch (code)
+ {
+ default:
+ bfd_set_error (bfd_error_bad_value);
+ return NULL;
+ case BFD_RELOC_16_PCREL_S2:
+ return &elf_dlx_gnu_rel16_s2;
+ case BFD_RELOC_DLX_JMP26:
+ return &elf_dlx_gnu_rel26_s2;
+ case BFD_RELOC_HI16_S:
+ return &elf_dlx_reloc_16_hi;
+ case BFD_RELOC_LO16:
+ return &elf_dlx_reloc_16_lo;
+ }
+}
+
+static reloc_howto_type *
+dlx_rtype_to_howto (r_type)
+ unsigned int r_type;
+{
+ switch (r_type)
+ {
+ case R_DLX_RELOC_16_PCREL:
+ return & elf_dlx_gnu_rel16_s2;
+ break;
+ case R_DLX_RELOC_26_PCREL:
+ return & elf_dlx_gnu_rel26_s2;
+ break;
+ case R_DLX_RELOC_16_HI:
+ return & elf_dlx_reloc_16_hi;
+ break;
+ case R_DLX_RELOC_16_LO:
+ return & elf_dlx_reloc_16_lo;
+ break;
+
+ default:
+ BFD_ASSERT (r_type < (unsigned int) R_DLX_max);
+ return & dlx_elf_howto_table[r_type];
+ break;
+ }
+}
+
+static void
+elf32_dlx_info_to_howto (abfd, cache_ptr, dst)
+ bfd * abfd ATTRIBUTE_UNUSED;
+ arelent * cache_ptr ATTRIBUTE_UNUSED;
+ Elf32_Internal_Rela * dst ATTRIBUTE_UNUSED;
+{
+ abort ();
+}
+
+static void
+elf32_dlx_info_to_howto_rel (abfd, cache_ptr, dst)
+ bfd *abfd ATTRIBUTE_UNUSED;
+ arelent *cache_ptr;
+ Elf32_Internal_Rel *dst;
+{
+ unsigned int r_type;
+
+ r_type = ELF32_R_TYPE (dst->r_info);
+ cache_ptr->howto = dlx_rtype_to_howto (r_type);
+ return;
+}
+
+#define TARGET_BIG_SYM bfd_elf32_dlx_big_vec
+#define TARGET_BIG_NAME "elf32-dlx"
+#define ELF_ARCH bfd_arch_dlx
+#define ELF_MACHINE_CODE EM_DLX
+#define ELF_MAXPAGESIZE 1 /* FIXME: This number is wrong, It should be the page size in bytes. */
+
+#include "elf32-target.h"
diff --git a/bfd/elf32-h8300.c b/bfd/elf32-h8300.c
index 52213ec84ec..1a841a7e74e 100644
--- a/bfd/elf32-h8300.c
+++ b/bfd/elf32-h8300.c
@@ -1,5 +1,6 @@
/* Generic support for 32-bit ELF
- Copyright 1993, 1995, 1998, 1999, 2001 Free Software Foundation, Inc.
+ Copyright 1993, 1995, 1998, 1999, 2001, 2002
+ Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -677,10 +678,7 @@ elf32_h8_merge_private_bfd_data (ibfd, obfd)
mov.b:16 -> mov.b:8 2 bytes
mov.b:24/32 -> mov.b:8 4 bytes
- mov.[bwl]:24/32 -> mov.[bwl]:16 2 bytes
-
-
-*/
+ mov.[bwl]:24/32 -> mov.[bwl]:16 2 bytes */
static boolean
elf32_h8_relax_section (abfd, sec, link_info, again)
@@ -747,6 +745,13 @@ elf32_h8_relax_section (abfd, sec, link_info, again)
if (irel != internal_relocs)
last_reloc = irel - 1;
+ if (ELF32_R_TYPE (irel->r_info) != R_H8_DIR24R8
+ && ELF32_R_TYPE (irel->r_info) != R_H8_PCREL16
+ && ELF32_R_TYPE (irel->r_info) != R_H8_DIR16A8
+ && ELF32_R_TYPE (irel->r_info) != R_H8_DIR24A8
+ && ELF32_R_TYPE (irel->r_info) != R_H8_DIR32A16)
+ continue;
+
/* Get the section contents if we haven't done so already. */
if (contents == NULL)
{
@@ -815,7 +820,8 @@ elf32_h8_relax_section (abfd, sec, link_info, again)
/* A local symbol. */
esym = extsyms + ELF32_R_SYM (irel->r_info);
shndx = shndx_buf + (shndx_buf ? ELF32_R_SYM (irel->r_info) : 0);
- bfd_elf32_swap_symbol_in (abfd, esym, shndx, &isym);
+ bfd_elf32_swap_symbol_in (abfd, (const PTR) esym, (const PTR) shndx,
+ &isym);
sym_sec = bfd_section_from_elf_index (abfd, isym.st_shndx);
symval = (isym.st_value
@@ -911,7 +917,9 @@ elf32_h8_relax_section (abfd, sec, link_info, again)
shndx = shndx_buf;
if (shndx != NULL)
shndx += ELF32_R_SYM (last_reloc->r_info);
- bfd_elf32_swap_symbol_in (abfd, esym, shndx, &last_symbol);
+ bfd_elf32_swap_symbol_in (abfd, (const PTR) esym,
+ (const PTR) shndx,
+ &last_symbol);
last_sym_sec
= bfd_section_from_elf_index (abfd, last_symbol.st_shndx);
@@ -1338,7 +1346,8 @@ elf32_h8_relax_delete_bytes (abfd, sec, addr, count)
Elf_Internal_Sym isym;
Elf_External_Sym_Shndx dummy;
- bfd_elf32_swap_symbol_in (abfd, esym, shndx, &isym);
+ bfd_elf32_swap_symbol_in (abfd, (const PTR) esym, (const PTR) shndx,
+ &isym);
if (isym.st_shndx == sec_shndx
&& isym.st_value > addr
@@ -1399,7 +1408,8 @@ elf32_h8_symbol_address_p (abfd, sec, addr)
{
Elf_Internal_Sym isym;
- bfd_elf32_swap_symbol_in (abfd, esym, shndx, &isym);
+ bfd_elf32_swap_symbol_in (abfd, (const PTR) esym, (const PTR) shndx,
+ &isym);
if (isym.st_shndx == sec_shndx
&& isym.st_value == addr)
@@ -1521,7 +1531,8 @@ elf32_h8_get_relocated_section_contents (output_bfd, link_info, link_order,
{
asection *isec;
- bfd_elf32_swap_symbol_in (input_bfd, esym, shndx, isymp);
+ bfd_elf32_swap_symbol_in (input_bfd, (const PTR) esym,
+ (const PTR) shndx, isymp);
if (isymp->st_shndx == SHN_UNDEF)
isec = bfd_und_section_ptr;
diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c
index 4dc7e9b16d9..684213514cd 100644
--- a/bfd/elf32-hppa.c
+++ b/bfd/elf32-hppa.c
@@ -2558,7 +2558,7 @@ elf32_hppa_size_dynamic_sections (output_bfd, info)
/* Set up various things so that we can make a list of input sections
for each output section included in the link. Returns -1 on error,
- 0 when no stubs will be needed, and 1 on success. */
+ 0 when no stubs will be needed, and 1 on success. */
int
elf32_hppa_setup_section_lists (output_bfd, info)
@@ -2827,7 +2827,8 @@ get_local_syms (output_bfd, input_bfd, info)
isym = local_syms, shndx = shndx_buf;
esym < end_sy;
esym++, isym++, shndx = (shndx ? shndx + 1 : NULL))
- bfd_elf32_swap_symbol_in (input_bfd, esym, shndx, isym);
+ bfd_elf32_swap_symbol_in (input_bfd, (const PTR) esym,
+ (const PTR) shndx, isym);
/* Now we can free the external symbols. */
free (shndx_buf);
diff --git a/bfd/elf32-i370.c b/bfd/elf32-i370.c
index fc82b47a080..e0ec33c2b8d 100644
--- a/bfd/elf32-i370.c
+++ b/bfd/elf32-i370.c
@@ -319,7 +319,7 @@ static boolean i370_elf_create_dynamic_sections PARAMS ((bfd *,
static boolean i370_elf_section_from_shdr PARAMS ((bfd *,
Elf32_Internal_Shdr *,
- char *));
+ const char *));
static boolean i370_elf_fake_sections PARAMS ((bfd *,
Elf32_Internal_Shdr *,
asection *));
@@ -429,7 +429,7 @@ static boolean
i370_elf_section_from_shdr (abfd, hdr, name)
bfd *abfd;
Elf32_Internal_Shdr *hdr;
- char *name;
+ const char *name;
{
asection *newsect;
flagword flags;
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
index 760762d1723..652fb1a776c 100644
--- a/bfd/elf32-i386.c
+++ b/bfd/elf32-i386.c
@@ -46,6 +46,13 @@ static boolean elf_i386_create_dynamic_sections
PARAMS((bfd *, struct bfd_link_info *));
static void elf_i386_copy_indirect_symbol
PARAMS ((struct elf_link_hash_entry *, struct elf_link_hash_entry *));
+static int elf_i386_tls_transition
+ PARAMS ((struct bfd_link_info *, int, int));
+
+static boolean elf_i386_mkobject
+ PARAMS((bfd *));
+static boolean elf_i386_object_p
+ PARAMS((bfd *));
static boolean elf_i386_check_relocs
PARAMS ((bfd *, struct bfd_link_info *, asection *,
const Elf_Internal_Rela *));
@@ -65,6 +72,10 @@ static boolean elf_i386_fake_sections
PARAMS ((bfd *, Elf32_Internal_Shdr *, asection *));
static boolean elf_i386_size_dynamic_sections
PARAMS ((bfd *, struct bfd_link_info *));
+static bfd_vma dtpoff_base
+ PARAMS ((struct bfd_link_info *));
+static bfd_vma tpoff
+ PARAMS ((struct bfd_link_info *, bfd_vma));
static boolean elf_i386_relocate_section
PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
@@ -121,9 +132,18 @@ static reloc_howto_type elf_howto_table[]=
R_386_ext_offset is the value to subtract from a reloc type of
R_386_16 thru R_386_PC8 to form an index into this table. */
#define R_386_standard ((unsigned int) R_386_GOTPC + 1)
-#define R_386_ext_offset ((unsigned int) R_386_16 - R_386_standard)
+#define R_386_ext_offset ((unsigned int) R_386_TLS_LE - R_386_standard)
/* The remaining relocs are a GNU extension. */
+ HOWTO(R_386_TLS_LE, 0, 2, 32, false, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_386_TLS_LE",
+ true, 0xffffffff, 0xffffffff, false),
+ HOWTO(R_386_TLS_GD, 0, 2, 32, false, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_386_TLS_GD",
+ true, 0xffffffff, 0xffffffff, false),
+ HOWTO(R_386_TLS_LDM, 0, 2, 32, false, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_386_TLS_LDM",
+ true, 0xffffffff, 0xffffffff, false),
HOWTO(R_386_16, 0, 1, 16, false, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_386_16",
true, 0xffff, 0xffff, false),
@@ -137,9 +157,31 @@ static reloc_howto_type elf_howto_table[]=
bfd_elf_generic_reloc, "R_386_PC8",
true, 0xff, 0xff, true),
- /* Another gap. */
#define R_386_ext ((unsigned int) R_386_PC8 + 1 - R_386_ext_offset)
-#define R_386_vt_offset ((unsigned int) R_386_GNU_VTINHERIT - R_386_ext)
+#define R_386_tls_offset ((unsigned int) R_386_TLS_LDO_32 - R_386_ext)
+ /* These are common with Solaris TLS implementation. */
+ HOWTO(R_386_TLS_LDO_32, 0, 2, 32, false, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_386_TLS_LDO_32",
+ true, 0xffffffff, 0xffffffff, false),
+ HOWTO(R_386_TLS_IE_32, 0, 2, 32, false, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_386_TLS_IE_32",
+ true, 0xffffffff, 0xffffffff, false),
+ HOWTO(R_386_TLS_LE_32, 0, 2, 32, false, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_386_TLS_LE_32",
+ true, 0xffffffff, 0xffffffff, false),
+ HOWTO(R_386_TLS_DTPMOD32, 0, 2, 32, false, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_386_TLS_DTPMOD32",
+ true, 0xffffffff, 0xffffffff, false),
+ HOWTO(R_386_TLS_DTPOFF32, 0, 2, 32, false, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_386_TLS_DTPOFF32",
+ true, 0xffffffff, 0xffffffff, false),
+ HOWTO(R_386_TLS_TPOFF32, 0, 2, 32, false, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_386_TLS_TPOFF32",
+ true, 0xffffffff, 0xffffffff, false),
+
+ /* Another gap. */
+#define R_386_tls ((unsigned int) R_386_TLS_TPOFF32 + 1 - R_386_tls_offset)
+#define R_386_vt_offset ((unsigned int) R_386_GNU_VTINHERIT - R_386_tls)
/* GNU extension to record C++ vtable hierarchy. */
HOWTO (R_386_GNU_VTINHERIT, /* type */
@@ -237,6 +279,18 @@ elf_i386_reloc_type_lookup (abfd, code)
return &elf_howto_table[(unsigned int) R_386_GOTPC ];
/* The remaining relocs are a GNU extension. */
+ case BFD_RELOC_386_TLS_LE:
+ TRACE ("BFD_RELOC_386_TLS_LE");
+ return &elf_howto_table[(unsigned int) R_386_TLS_LE - R_386_ext_offset];
+
+ case BFD_RELOC_386_TLS_GD:
+ TRACE ("BFD_RELOC_386_TLS_GD");
+ return &elf_howto_table[(unsigned int) R_386_TLS_GD - R_386_ext_offset];
+
+ case BFD_RELOC_386_TLS_LDM:
+ TRACE ("BFD_RELOC_386_TLS_LDM");
+ return &elf_howto_table[(unsigned int) R_386_TLS_LDM - R_386_ext_offset];
+
case BFD_RELOC_16:
TRACE ("BFD_RELOC_16");
return &elf_howto_table[(unsigned int) R_386_16 - R_386_ext_offset];
@@ -253,6 +307,31 @@ elf_i386_reloc_type_lookup (abfd, code)
TRACE ("BFD_RELOC_8_PCREL");
return &elf_howto_table[(unsigned int) R_386_PC8 - R_386_ext_offset];
+ /* Common with Sun TLS implementation. */
+ case BFD_RELOC_386_TLS_LDO_32:
+ TRACE ("BFD_RELOC_386_TLS_LDO_32");
+ return &elf_howto_table[(unsigned int) R_386_TLS_LDO_32 - R_386_tls_offset];
+
+ case BFD_RELOC_386_TLS_IE_32:
+ TRACE ("BFD_RELOC_386_TLS_IE_32");
+ return &elf_howto_table[(unsigned int) R_386_TLS_IE_32 - R_386_tls_offset];
+
+ case BFD_RELOC_386_TLS_LE_32:
+ TRACE ("BFD_RELOC_386_TLS_LE_32");
+ return &elf_howto_table[(unsigned int) R_386_TLS_LE_32 - R_386_tls_offset];
+
+ case BFD_RELOC_386_TLS_DTPMOD32:
+ TRACE ("BFD_RELOC_386_TLS_DTPMOD32");
+ return &elf_howto_table[(unsigned int) R_386_TLS_DTPMOD32 - R_386_tls_offset];
+
+ case BFD_RELOC_386_TLS_DTPOFF32:
+ TRACE ("BFD_RELOC_386_TLS_DTPOFF32");
+ return &elf_howto_table[(unsigned int) R_386_TLS_DTPOFF32 - R_386_tls_offset];
+
+ case BFD_RELOC_386_TLS_TPOFF32:
+ TRACE ("BFD_RELOC_386_TLS_TPOFF32");
+ return &elf_howto_table[(unsigned int) R_386_TLS_TPOFF32 - R_386_tls_offset];
+
case BFD_RELOC_VTABLE_INHERIT:
TRACE ("BFD_RELOC_VTABLE_INHERIT");
return &elf_howto_table[(unsigned int) R_386_GNU_VTINHERIT
@@ -292,8 +371,10 @@ elf_i386_info_to_howto_rel (abfd, cache_ptr, dst)
if ((indx = r_type) >= R_386_standard
&& ((indx = r_type - R_386_ext_offset) - R_386_standard
>= R_386_ext - R_386_standard)
- && ((indx = r_type - R_386_vt_offset) - R_386_ext
- >= R_386_vt - R_386_ext))
+ && ((indx = r_type - R_386_tls_offset) - R_386_ext
+ >= R_386_tls - R_386_ext)
+ && ((indx = r_type - R_386_vt_offset) - R_386_tls
+ >= R_386_vt - R_386_tls))
{
(*_bfd_error_handler) (_("%s: invalid relocation type %d"),
bfd_archive_filename (abfd), (int) r_type);
@@ -481,8 +562,54 @@ struct elf_i386_link_hash_entry
/* Track dynamic relocs copied for this symbol. */
struct elf_i386_dyn_relocs *dyn_relocs;
+
+ enum {
+ GOT_UNKNOWN = 0, GOT_NORMAL, GOT_TLS_GD, GOT_TLS_IE
+ } tls_type;
};
+#define elf_i386_hash_entry(ent) ((struct elf_i386_link_hash_entry *)(ent))
+
+struct elf_i386_obj_tdata
+{
+ struct elf_obj_tdata root;
+
+ /* tls_type for each local got entry. */
+ char *local_got_tls_type;
+};
+
+#define elf_i386_tdata(abfd) \
+ ((struct elf_i386_obj_tdata *) (abfd)->tdata.any)
+
+#define elf_i386_local_got_tls_type(abfd) \
+ (elf_i386_tdata (abfd)->local_got_tls_type)
+
+static boolean
+elf_i386_mkobject (abfd)
+ bfd *abfd;
+{
+ bfd_size_type amt = sizeof (struct elf_i386_obj_tdata);
+ abfd->tdata.any = bfd_zalloc (abfd, amt);
+ if (abfd->tdata.any == NULL)
+ return false;
+ return true;
+}
+
+static boolean
+elf_i386_object_p (abfd)
+ 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
@@ -498,6 +625,11 @@ struct elf_i386_link_hash_table
asection *sdynbss;
asection *srelbss;
+ union {
+ bfd_signed_vma refcount;
+ bfd_vma offset;
+ } tls_ldm_got;
+
/* Small local sym to section mapping cache. */
struct sym_sec_cache sym_sec;
};
@@ -533,6 +665,7 @@ link_hash_newfunc (entry, table, string)
eh = (struct elf_i386_link_hash_entry *) entry;
eh->dyn_relocs = NULL;
+ eh->tls_type = GOT_UNKNOWN;
}
return entry;
@@ -678,6 +811,29 @@ elf_i386_copy_indirect_symbol (dir, ind)
_bfd_elf_link_hash_copy_indirect (dir, ind);
}
+static int
+elf_i386_tls_transition (info, r_type, is_local)
+ struct bfd_link_info *info;
+ int r_type;
+ int is_local;
+{
+ if (info->shared)
+ return r_type;
+
+ switch (r_type)
+ {
+ case R_386_TLS_GD:
+ case R_386_TLS_IE_32:
+ if (is_local)
+ return R_386_TLS_LE_32;
+ return R_386_TLS_IE_32;
+ case R_386_TLS_LDM:
+ return R_386_TLS_LE_32;
+ }
+
+ return r_type;
+}
+
/* Look through the relocs for a section during the first phase, and
calculate needed space in the global offset table, procedure linkage
table, and dynamic reloc sections. */
@@ -708,10 +864,12 @@ elf_i386_check_relocs (abfd, info, sec, relocs)
rel_end = relocs + sec->reloc_count;
for (rel = relocs; rel < rel_end; rel++)
{
+ unsigned int r_type;
unsigned long r_symndx;
struct elf_link_hash_entry *h;
r_symndx = ELF32_R_SYM (rel->r_info);
+ r_type = ELF32_R_TYPE (rel->r_info);
if (r_symndx >= NUM_SHDR_ENTRIES (symtab_hdr))
{
@@ -726,38 +884,86 @@ elf_i386_check_relocs (abfd, info, sec, relocs)
else
h = sym_hashes[r_symndx - symtab_hdr->sh_info];
- switch (ELF32_R_TYPE (rel->r_info))
+ r_type = elf_i386_tls_transition (info, r_type, h == NULL);
+
+ switch (r_type)
{
+ case R_386_TLS_IE_32:
+ if (info->shared)
+ info->flags |= DF_STATIC_TLS;
+ /* FALLTHROUGH */
case R_386_GOT32:
+ case R_386_TLS_GD:
/* This symbol requires a global offset table entry. */
- if (h != NULL)
- {
- h->got.refcount += 1;
- }
- else
- {
- bfd_signed_vma *local_got_refcounts;
-
- /* This is a global offset table entry for a local symbol. */
- local_got_refcounts = elf_local_got_refcounts (abfd);
- if (local_got_refcounts == NULL)
- {
- bfd_size_type size;
-
- size = symtab_hdr->sh_info;
- size *= sizeof (bfd_signed_vma);
- local_got_refcounts = ((bfd_signed_vma *)
- bfd_zalloc (abfd, size));
- if (local_got_refcounts == NULL)
+ {
+ int tls_type, old_tls_type;
+
+ switch (r_type)
+ {
+ default:
+ case R_386_GOT32: tls_type = GOT_NORMAL; break;
+ case R_386_TLS_GD: tls_type = GOT_TLS_GD; break;
+ case R_386_TLS_IE_32: tls_type = GOT_TLS_IE; break;
+ }
+
+ if (h != NULL)
+ {
+ h->got.refcount += 1;
+ old_tls_type = elf_i386_hash_entry(h)->tls_type;
+ }
+ else
+ {
+ bfd_signed_vma *local_got_refcounts;
+
+ /* This is a global offset table entry for a local symbol. */
+ local_got_refcounts = elf_local_got_refcounts (abfd);
+ if (local_got_refcounts == NULL)
+ {
+ bfd_size_type size;
+
+ size = symtab_hdr->sh_info;
+ size *= (sizeof (bfd_signed_vma) + sizeof(char));
+ local_got_refcounts = ((bfd_signed_vma *)
+ bfd_zalloc (abfd, size));
+ if (local_got_refcounts == NULL)
+ return false;
+ elf_local_got_refcounts (abfd) = local_got_refcounts;
+ elf_i386_local_got_tls_type (abfd)
+ = (char *) (local_got_refcounts + symtab_hdr->sh_info);
+ }
+ local_got_refcounts[r_symndx] += 1;
+ old_tls_type = elf_i386_local_got_tls_type (abfd) [r_symndx];
+ }
+
+ /* If a TLS symbol is accessed using IE at least once,
+ there is no point to use dynamic model for it. */
+ if (old_tls_type != tls_type && old_tls_type != GOT_UNKNOWN
+ && (old_tls_type != GOT_TLS_GD || tls_type != GOT_TLS_IE))
+ {
+ if (old_tls_type == GOT_TLS_IE && tls_type == GOT_TLS_GD)
+ tls_type = GOT_TLS_IE;
+ else
+ {
+ (*_bfd_error_handler)
+ (_("%s: `%s' accessed both as normal and thread local symbol"),
+ bfd_archive_filename (abfd), h->root.root.string);
return false;
- elf_local_got_refcounts (abfd) = local_got_refcounts;
- }
- local_got_refcounts[r_symndx] += 1;
- }
+ }
+ }
+
+ if (old_tls_type != tls_type)
+ {
+ if (h != NULL)
+ elf_i386_hash_entry (h)->tls_type = tls_type;
+ else
+ elf_i386_local_got_tls_type (abfd) [r_symndx] = tls_type;
+ }
+ }
/* Fall through */
case R_386_GOTOFF:
case R_386_GOTPC:
+ create_got:
if (htab->sgot == NULL)
{
if (htab->elf.dynobj == NULL)
@@ -767,6 +973,10 @@ elf_i386_check_relocs (abfd, info, sec, relocs)
}
break;
+ case R_386_TLS_LDM:
+ htab->tls_ldm_got.refcount += 1;
+ goto create_got;
+
case R_386_PLT32:
/* This symbol requires a procedure linkage table entry. We
actually build the entry in adjust_dynamic_symbol,
@@ -824,7 +1034,7 @@ elf_i386_check_relocs (abfd, info, sec, relocs)
symbol. */
if ((info->shared
&& (sec->flags & SEC_ALLOC) != 0
- && (ELF32_R_TYPE (rel->r_info) != R_386_PC32
+ && (r_type != R_386_PC32
|| (h != NULL
&& (! info->symbolic
|| h->root.type == bfd_link_hash_defweak
@@ -923,7 +1133,7 @@ elf_i386_check_relocs (abfd, info, sec, relocs)
}
p->count += 1;
- if (ELF32_R_TYPE (rel->r_info) == R_386_PC32)
+ if (r_type == R_386_PC32)
p->pc_count += 1;
}
break;
@@ -942,6 +1152,16 @@ elf_i386_check_relocs (abfd, info, sec, relocs)
return false;
break;
+ case R_386_TLS_LE_32:
+ case R_386_TLS_LE:
+ if (info->shared)
+ {
+ (*_bfd_error_handler) (_("%s: TLS local exec code cannot be linked into shared objects"),
+ bfd_archive_filename (abfd));
+ return false;
+ }
+ break;
+
default:
break;
}
@@ -1016,11 +1236,18 @@ elf_i386_gc_sweep_hook (abfd, info, sec, relocs)
relend = relocs + sec->reloc_count;
for (rel = relocs; rel < relend; rel++)
- switch (ELF32_R_TYPE (rel->r_info))
+ switch (elf_i386_tls_transition (info, ELF32_R_TYPE (rel->r_info),
+ ELF32_R_SYM (rel->r_info)
+ >= symtab_hdr->sh_info))
{
+ case R_386_TLS_LDM:
+ if (elf_i386_hash_table (info)->tls_ldm_got.refcount > 0)
+ elf_i386_hash_table (info)->tls_ldm_got.refcount -= 1;
+ break;
+
+ case R_386_TLS_GD:
+ case R_386_TLS_IE_32:
case R_386_GOT32:
- case R_386_GOTOFF:
- case R_386_GOTPC:
r_symndx = ELF32_R_SYM (rel->r_info);
if (r_symndx >= symtab_hdr->sh_info)
{
@@ -1173,7 +1400,7 @@ elf_i386_adjust_dynamic_symbol (info, h)
}
/* If we didn't find any dynamic relocs in read-only sections, then
- we'll be keeping the dynamic relocs and avoiding the copy reloc. */
+ we'll be keeping the dynamic relocs and avoiding the copy reloc. */
if (p == NULL)
{
h->elf_link_hash_flags &= ~ELF_LINK_NON_GOT_REF;
@@ -1319,10 +1546,18 @@ allocate_dynrelocs (h, inf)
h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
}
- if (h->got.refcount > 0)
+ /* If R_386_TLS_IE_32 symbol is now local to the binary,
+ make it a R_386_TLS_LE_32 requiring no TLS entry. */
+ if (h->got.refcount > 0
+ && !info->shared
+ && h->dynindx == -1
+ && elf_i386_hash_entry(h)->tls_type == GOT_TLS_IE)
+ h->got.offset = (bfd_vma) -1;
+ else if (h->got.refcount > 0)
{
asection *s;
boolean dyn;
+ int tls_type = elf_i386_hash_entry(h)->tls_type;
/* Make sure this symbol is output as a dynamic symbol.
Undefined weak syms won't yet be marked as dynamic. */
@@ -1336,8 +1571,18 @@ allocate_dynrelocs (h, inf)
s = htab->sgot;
h->got.offset = s->_raw_size;
s->_raw_size += 4;
+ /* R_386_TLS_GD needs 2 consecutive GOT slots. */
+ if (tls_type == GOT_TLS_GD)
+ s->_raw_size += 4;
dyn = htab->elf.dynamic_sections_created;
- if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info, h))
+ /* R_386_TLS_IE_32 needs one dynamic relocation,
+ R_386_TLS_GD needs one if local symbol and two if global. */
+ if ((tls_type == GOT_TLS_GD && h->dynindx == -1)
+ || tls_type == GOT_TLS_IE)
+ htab->srelgot->_raw_size += sizeof (Elf32_External_Rel);
+ else if (tls_type == GOT_TLS_GD)
+ htab->srelgot->_raw_size += 2 * sizeof (Elf32_External_Rel);
+ else if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info, h))
htab->srelgot->_raw_size += sizeof (Elf32_External_Rel);
}
else
@@ -1483,6 +1728,7 @@ elf_i386_size_dynamic_sections (output_bfd, info)
{
bfd_signed_vma *local_got;
bfd_signed_vma *end_local_got;
+ char *local_tls_type;
bfd_size_type locsymcount;
Elf_Internal_Shdr *symtab_hdr;
asection *srel;
@@ -1524,15 +1770,20 @@ elf_i386_size_dynamic_sections (output_bfd, info)
symtab_hdr = &elf_tdata (ibfd)->symtab_hdr;
locsymcount = symtab_hdr->sh_info;
end_local_got = local_got + locsymcount;
+ local_tls_type = elf_i386_local_got_tls_type (ibfd);
s = htab->sgot;
srel = htab->srelgot;
- for (; local_got < end_local_got; ++local_got)
+ for (; local_got < end_local_got; ++local_got, ++local_tls_type)
{
if (*local_got > 0)
{
*local_got = s->_raw_size;
s->_raw_size += 4;
- if (info->shared)
+ if (*local_tls_type == GOT_TLS_GD)
+ s->_raw_size += 4;
+ if (info->shared
+ || *local_tls_type == GOT_TLS_GD
+ || *local_tls_type == GOT_TLS_IE)
srel->_raw_size += sizeof (Elf32_External_Rel);
}
else
@@ -1540,6 +1791,17 @@ elf_i386_size_dynamic_sections (output_bfd, info)
}
}
+ if (htab->tls_ldm_got.refcount > 0)
+ {
+ /* Allocate 2 got entries and 1 dynamic reloc for R_386_TLS_LDM
+ relocs. */
+ htab->tls_ldm_got.offset = htab->sgot->_raw_size;
+ htab->sgot->_raw_size += 8;
+ htab->srelgot->_raw_size += sizeof (Elf32_External_Rel);
+ }
+ else
+ htab->tls_ldm_got.offset = -1;
+
/* Allocate global sym .plt and .got entries, and space for global
sym dynamic relocs. */
elf_link_hash_traverse (&htab->elf, allocate_dynrelocs, (PTR) info);
@@ -1685,6 +1947,34 @@ elf_i386_fake_sections (abfd, hdr, sec)
return true;
}
+/* Return the base VMA address which should be subtracted from real addresses
+ when resolving @dtpoff relocation.
+ This is PT_TLS segment p_vaddr. */
+
+static bfd_vma
+dtpoff_base (info)
+ struct bfd_link_info *info;
+{
+ BFD_ASSERT (elf_hash_table (info)->tls_segment != NULL);
+ return elf_hash_table (info)->tls_segment->start;
+}
+
+/* Return the relocation value for @tpoff relocation
+ if STT_TLS virtual address is ADDRESS. */
+
+static bfd_vma
+tpoff (info, address)
+ struct bfd_link_info *info;
+ bfd_vma address;
+{
+ struct elf_link_tls_segment *tls_segment
+ = elf_hash_table (info)->tls_segment;
+
+ BFD_ASSERT (tls_segment != NULL);
+ return (align_power (tls_segment->size, tls_segment->align)
+ + tls_segment->start - address);
+}
+
/* Relocate an i386 ELF section. */
static boolean
@@ -1715,7 +2005,7 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
relend = relocs + input_section->reloc_count;
for (; rel < relend; rel++)
{
- int r_type;
+ unsigned int r_type;
reloc_howto_type *howto;
unsigned long r_symndx;
struct elf_link_hash_entry *h;
@@ -1726,6 +2016,7 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
boolean unresolved_reloc;
bfd_reloc_status_type r;
unsigned int indx;
+ int tls_type;
r_type = ELF32_R_TYPE (rel->r_info);
if (r_type == (int) R_386_GNU_VTINHERIT
@@ -1733,8 +2024,10 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
continue;
if ((indx = (unsigned) r_type) >= R_386_standard
- && ((indx = (unsigned) r_type - R_386_ext_offset) - R_386_standard
- >= R_386_ext - R_386_standard))
+ && ((indx = r_type - R_386_ext_offset) - R_386_standard
+ >= R_386_ext - R_386_standard)
+ && ((indx = r_type - R_386_tls_offset) - R_386_ext
+ >= R_386_tls - R_386_ext))
{
bfd_set_error (bfd_error_bad_value);
return false;
@@ -2118,6 +2411,330 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
}
break;
+ case R_386_TLS_GD:
+ case R_386_TLS_IE_32:
+ r_type = elf_i386_tls_transition (info, r_type, h == NULL);
+ tls_type = GOT_UNKNOWN;
+ if (h == NULL && local_got_offsets)
+ tls_type = elf_i386_local_got_tls_type (input_bfd) [r_symndx];
+ else if (h != NULL)
+ {
+ tls_type = elf_i386_hash_entry(h)->tls_type;
+ if (!info->shared && h->dynindx == -1 && tls_type == GOT_TLS_IE)
+ r_type = R_386_TLS_LE_32;
+ }
+ if (r_type == R_386_TLS_GD && tls_type == GOT_TLS_IE)
+ r_type = R_386_TLS_IE_32;
+
+ if (r_type == R_386_TLS_LE_32)
+ {
+ BFD_ASSERT (unresolved_reloc == false);
+ if (ELF32_R_TYPE (rel->r_info) == R_386_TLS_GD)
+ {
+ unsigned int val, type;
+ bfd_vma roff;
+
+ /* GD->LE transition. */
+ BFD_ASSERT (rel->r_offset >= 2);
+ type = bfd_get_8 (input_bfd, contents + rel->r_offset - 2);
+ BFD_ASSERT (type == 0x8d || type == 0x04);
+ BFD_ASSERT (rel->r_offset + 9 <= input_section->_raw_size);
+ BFD_ASSERT (bfd_get_8 (input_bfd,
+ contents + rel->r_offset + 4)
+ == 0xe8);
+ BFD_ASSERT (rel + 1 < relend);
+ BFD_ASSERT (ELF32_R_TYPE (rel[1].r_info) == R_386_PLT32);
+ roff = rel->r_offset + 5;
+ val = bfd_get_8 (input_bfd,
+ contents + rel->r_offset - 1);
+ if (type == 0x04)
+ {
+ /* leal foo(,%reg,1), %eax; call ___tls_get_addr
+ Change it into:
+ movl %gs:0, %eax; subl $foo@tpoff, %eax
+ (6 byte form of subl). */
+ BFD_ASSERT (rel->r_offset >= 3);
+ BFD_ASSERT (bfd_get_8 (input_bfd,
+ contents + rel->r_offset - 3)
+ == 0x8d);
+ BFD_ASSERT ((val & 0xc7) == 0x05 && val != (4 << 3));
+ memcpy (contents + rel->r_offset - 3,
+ "\x65\xa1\0\0\0\0\x81\xe8\0\0\0", 12);
+ }
+ else
+ {
+ BFD_ASSERT ((val & 0xf8) == 0x80 && (val & 7) != 4);
+ if (rel->r_offset + 10 <= input_section->_raw_size
+ && bfd_get_8 (input_bfd,
+ contents + rel->r_offset + 9) == 0x90)
+ {
+ /* leal foo(%reg), %eax; call ___tls_get_addr; nop
+ Change it into:
+ movl %gs:0, %eax; subl $foo@tpoff, %eax
+ (6 byte form of subl). */
+ memcpy (contents + rel->r_offset - 2,
+ "\x65\xa1\0\0\0\0\x81\xe8\0\0\0", 12);
+ roff = rel->r_offset + 6;
+ }
+ else
+ {
+ /* leal foo(%reg), %eax; call ___tls_get_addr
+ Change it into:
+ movl %gs:0, %eax; subl $foo@tpoff, %eax
+ (5 byte form of subl). */
+ memcpy (contents + rel->r_offset - 2,
+ "\x65\xa1\0\0\0\0\x2d\0\0\0", 11);
+ }
+ }
+ bfd_put_32 (output_bfd, tpoff (info, relocation),
+ contents + roff);
+ /* Skip R_386_PLT32. */
+ rel++;
+ continue;
+ }
+ else
+ {
+ unsigned int val, type;
+
+ /* IE->LE transition:
+ Originally it can be either:
+ subl foo(%reg1), %reg2
+ or
+ movl foo(%reg1), %reg2
+ We change it into:
+ subl $foo, %reg2
+ or
+ movl $foo, %reg2 (6 byte form) */
+ BFD_ASSERT (rel->r_offset >= 2);
+ type = bfd_get_8 (input_bfd, contents + rel->r_offset - 2);
+ val = bfd_get_8 (input_bfd, contents + rel->r_offset - 1);
+ BFD_ASSERT (rel->r_offset + 4 <= input_section->_raw_size);
+ if (type == 0x8b)
+ {
+ /* movl */
+ BFD_ASSERT ((val & 0xc0) == 0x80 && (val & 7) != 4);
+ bfd_put_8 (output_bfd, 0xc7,
+ contents + rel->r_offset - 2);
+ bfd_put_8 (output_bfd, 0xc0 | ((val >> 3) & 7),
+ contents + rel->r_offset - 1);
+ }
+ else if (type == 0x2b)
+ {
+ /* subl */
+ BFD_ASSERT ((val & 0xc0) == 0x80 && (val & 7) != 4);
+ bfd_put_8 (output_bfd, 0x81,
+ contents + rel->r_offset - 2);
+ bfd_put_8 (output_bfd, 0xe8 | ((val >> 3) & 7),
+ contents + rel->r_offset - 1);
+ }
+ else
+ BFD_FAIL ();
+ bfd_put_32 (output_bfd, tpoff (info, relocation),
+ contents + rel->r_offset);
+ continue;
+ }
+ }
+
+ if (htab->sgot == NULL)
+ abort ();
+
+ if (h != NULL)
+ off = h->got.offset;
+ else
+ {
+ if (local_got_offsets == NULL)
+ abort ();
+
+ off = local_got_offsets[r_symndx];
+ }
+
+ if ((off & 1) != 0)
+ off &= ~1;
+ else
+ {
+ Elf_Internal_Rel outrel;
+ Elf32_External_Rel *loc;
+ int dr_type, indx;
+
+ if (htab->srelgot == NULL)
+ abort ();
+
+ outrel.r_offset = (htab->sgot->output_section->vma
+ + htab->sgot->output_offset + off);
+
+ bfd_put_32 (output_bfd, 0,
+ htab->sgot->contents + off);
+ indx = h && h->dynindx != -1 ? h->dynindx : 0;
+ if (r_type == R_386_TLS_GD)
+ dr_type = R_386_TLS_DTPMOD32;
+ else
+ dr_type = R_386_TLS_TPOFF32;
+ outrel.r_info = ELF32_R_INFO (indx, dr_type);
+ loc = (Elf32_External_Rel *) htab->srelgot->contents;
+ loc += htab->srelgot->reloc_count++;
+ bfd_elf32_swap_reloc_out (output_bfd, &outrel, loc);
+
+ if (r_type == R_386_TLS_GD)
+ {
+ if (indx == 0)
+ {
+ BFD_ASSERT (unresolved_reloc == false);
+ bfd_put_32 (output_bfd,
+ relocation - dtpoff_base (info),
+ htab->sgot->contents + off + 4);
+ }
+ else
+ {
+ bfd_put_32 (output_bfd, 0,
+ htab->sgot->contents + off + 4);
+ outrel.r_info = ELF32_R_INFO (indx,
+ R_386_TLS_DTPOFF32);
+ outrel.r_offset += 4;
+ htab->srelgot->reloc_count++;
+ loc++;
+ bfd_elf32_swap_reloc_out (output_bfd, &outrel,
+ loc);
+ }
+ }
+
+ if (h != NULL)
+ h->got.offset |= 1;
+ else
+ local_got_offsets[r_symndx] |= 1;
+ }
+
+ if (off >= (bfd_vma) -2)
+ abort ();
+ if (r_type == ELF32_R_TYPE (rel->r_info))
+ {
+ relocation = htab->sgot->output_offset + off;
+ unresolved_reloc = false;
+ }
+ else
+ {
+ unsigned int val, type;
+ bfd_vma roff;
+
+ /* GD->IE transition. */
+ BFD_ASSERT (rel->r_offset >= 2);
+ type = bfd_get_8 (input_bfd, contents + rel->r_offset - 2);
+ BFD_ASSERT (type == 0x8d || type == 0x04);
+ BFD_ASSERT (rel->r_offset + 9 <= input_section->_raw_size);
+ BFD_ASSERT (bfd_get_8 (input_bfd, contents + rel->r_offset + 4)
+ == 0xe8);
+ BFD_ASSERT (rel + 1 < relend);
+ BFD_ASSERT (ELF32_R_TYPE (rel[1].r_info) == R_386_PLT32);
+ roff = rel->r_offset - 3;
+ val = bfd_get_8 (input_bfd, contents + rel->r_offset - 1);
+ if (type == 0x04)
+ {
+ /* leal foo(,%reg,1), %eax; call ___tls_get_addr
+ Change it into:
+ movl %gs:0, %eax; subl $foo@gottpoff(%reg), %eax. */
+ BFD_ASSERT (rel->r_offset >= 3);
+ BFD_ASSERT (bfd_get_8 (input_bfd,
+ contents + rel->r_offset - 3)
+ == 0x8d);
+ BFD_ASSERT ((val & 0xc7) == 0x05 && val != (4 << 3));
+ val >>= 3;
+ }
+ else
+ {
+ /* leal foo(%reg), %eax; call ___tls_get_addr; nop
+ Change it into:
+ movl %gs:0, %eax; subl $foo@gottpoff(%reg), %eax. */
+ BFD_ASSERT (rel->r_offset + 10 <= input_section->_raw_size);
+ BFD_ASSERT ((val & 0xf8) == 0x80 && (val & 7) != 4);
+ BFD_ASSERT (bfd_get_8 (input_bfd,
+ contents + rel->r_offset + 9)
+ == 0x90);
+ roff = rel->r_offset - 2;
+ }
+ memcpy (contents + roff,
+ "\x65\xa1\0\0\0\0\x2b\x80\0\0\0", 12);
+ contents[roff + 7] = 0x80 | (val & 7);
+ bfd_put_32 (output_bfd, htab->sgot->output_offset + off,
+ contents + roff + 8);
+ /* Skip R_386_PLT32. */
+ rel++;
+ continue;
+ }
+ break;
+
+ case R_386_TLS_LDM:
+ if (! info->shared)
+ {
+ unsigned int val;
+
+ /* LD->LE transition:
+ Ensure it is:
+ leal foo(%reg), %eax; call ___tls_get_addr.
+ We change it into:
+ movl %gs:0, %eax; nop; leal 0(%esi,1), %esi. */
+ BFD_ASSERT (rel->r_offset >= 2);
+ BFD_ASSERT (bfd_get_8 (input_bfd, contents + rel->r_offset - 2)
+ == 0x8d);
+ val = bfd_get_8 (input_bfd, contents + rel->r_offset - 1);
+ BFD_ASSERT ((val & 0xf8) == 0x80 && (val & 7) != 4);
+ BFD_ASSERT (rel->r_offset + 9 <= input_section->_raw_size);
+ BFD_ASSERT (bfd_get_8 (input_bfd, contents + rel->r_offset + 4)
+ == 0xe8);
+ BFD_ASSERT (rel + 1 < relend);
+ BFD_ASSERT (ELF32_R_TYPE (rel[1].r_info) == R_386_PLT32);
+ memcpy (contents + rel->r_offset - 2,
+ "\x65\xa1\0\0\0\0\x90\x8d\x74\x26", 11);
+ /* Skip R_386_PLT32. */
+ rel++;
+ continue;
+ }
+
+ if (htab->sgot == NULL)
+ abort ();
+
+ off = htab->tls_ldm_got.offset;
+ if (off & 1)
+ off &= ~1;
+ else
+ {
+ Elf_Internal_Rel outrel;
+ Elf32_External_Rel *loc;
+
+ if (htab->srelgot == NULL)
+ abort ();
+
+ outrel.r_offset = (htab->sgot->output_section->vma
+ + htab->sgot->output_offset + off);
+
+ bfd_put_32 (output_bfd, 0,
+ htab->sgot->contents + off);
+ bfd_put_32 (output_bfd, 0,
+ htab->sgot->contents + off + 4);
+ outrel.r_info = ELF32_R_INFO (0, R_386_TLS_DTPMOD32);
+ loc = (Elf32_External_Rel *) htab->srelgot->contents;
+ loc += htab->srelgot->reloc_count++;
+ bfd_elf32_swap_reloc_out (output_bfd, &outrel, loc);
+ htab->tls_ldm_got.offset |= 1;
+ }
+ relocation = htab->sgot->output_offset + off;
+ unresolved_reloc = false;
+ break;
+
+ case R_386_TLS_LDO_32:
+ if (info->shared)
+ relocation -= dtpoff_base (info);
+ else
+ /* When converting LDO to LE, we must negate. */
+ relocation = -tpoff (info, relocation);
+ break;
+
+ case R_386_TLS_LE_32:
+ relocation = tpoff (info, relocation);
+ break;
+
+ case R_386_TLS_LE:
+ relocation = -tpoff (info, relocation);
+ break;
+
default:
break;
}
@@ -2268,12 +2885,14 @@ elf_i386_finish_dynamic_symbol (output_bfd, info, h, sym)
the .plt section. Leave the value alone. This is a clue
for the dynamic linker, to make function pointer
comparisons work between an application and shared
- library. */
+ library. */
sym->st_shndx = SHN_UNDEF;
}
}
- if (h->got.offset != (bfd_vma) -1)
+ if (h->got.offset != (bfd_vma) -1
+ && elf_i386_hash_entry(h)->tls_type != GOT_TLS_GD
+ && elf_i386_hash_entry(h)->tls_type != GOT_TLS_IE)
{
Elf_Internal_Rel rel;
Elf32_External_Rel *loc;
@@ -2505,6 +3124,9 @@ elf_i386_finish_dynamic_sections (output_bfd, info)
#define elf_info_to_howto elf_i386_info_to_howto
#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
#define bfd_elf32_bfd_reloc_type_lookup elf_i386_reloc_type_lookup
@@ -2524,4 +3146,6 @@ elf_i386_finish_dynamic_sections (output_bfd, info)
#define elf_backend_relocate_section elf_i386_relocate_section
#define elf_backend_size_dynamic_sections elf_i386_size_dynamic_sections
+#ifndef ELF32_I386_C_INCLUDED
#include "elf32-target.h"
+#endif
diff --git a/bfd/elf32-i386qnx.c b/bfd/elf32-i386qnx.c
new file mode 100644
index 00000000000..5f2e1113f4c
--- /dev/null
+++ b/bfd/elf32-i386qnx.c
@@ -0,0 +1,111 @@
+/* Intel 80386/80486 QNX specific support for 32-bit ELF
+ Copyright 2002
+ Free Software Foundation, Inc.
+
+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 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 ELF32_I386_C_INCLUDED
+#include "elf32-i386.c"
+
+ /* Returns the end address of the segment + 1. */
+#define SEGMENT_END(segment, start) \
+ (start + (segment->p_memsz > segment->p_filesz \
+ ? segment->p_memsz : segment->p_filesz))
+
+static boolean elf_i386qnx_copy_private_bfd_data_p
+ PARAMS ((bfd *, asection *, bfd *, asection *));
+static boolean elf_i386qnx_is_contained_by_filepos
+ PARAMS ((asection *, Elf_Internal_Phdr *));
+static void elf_i386qnx_set_nonloadable_filepos
+ PARAMS ((bfd *, Elf_Internal_Phdr *));
+
+static boolean
+elf_i386qnx_copy_private_bfd_data_p (ibfd, isec, obfd, osec)
+ bfd *ibfd;
+ asection *isec;
+ bfd *obfd;
+ asection *osec;
+{
+ /* We don't use these parameters, but another target might. */
+ ibfd = ibfd;
+ obfd = obfd;
+ osec = osec;
+ return isec->next == NULL;
+}
+
+static boolean
+elf_i386qnx_is_contained_by_filepos (section, segment)
+ asection *section;
+ Elf_Internal_Phdr *segment;
+{
+ return ((bfd_vma) section->filepos >= segment->p_offset
+ && ((bfd_vma) section->filepos + section->_raw_size
+ <= SEGMENT_END (segment, segment->p_offset)));
+}
+
+static void
+elf_i386qnx_set_nonloadable_filepos (abfd, phdrs)
+ bfd *abfd;
+ Elf_Internal_Phdr *phdrs;
+{
+ struct elf_segment_map *m;
+ Elf_Internal_Phdr *p;
+ file_ptr off = 0;
+
+ for (m = elf_tdata (abfd)->segment_map, p = phdrs;
+ m != NULL;
+ m = m->next, p++)
+ {
+ unsigned int i;
+ asection **secpp;
+
+ for (i = 0, secpp = m->sections; i < m->count; i++, secpp++)
+ {
+ asection *sec;
+
+ sec = *secpp;
+
+ if (p->p_type == PT_LOAD)
+ off = sec->filepos;
+ else
+ {
+ if (i == 0)
+ {
+ if (sec->filepos)
+ p->p_offset = sec->filepos;
+ else
+ p->p_offset = off;
+ }
+ if (!sec->filepos)
+ {
+ off += sec->_raw_size;
+ p->p_filesz += sec->_raw_size;
+ }
+ }
+ }
+ }
+ return;
+}
+
+#undef TARGET_LITTLE_SYM
+#define TARGET_LITTLE_SYM bfd_elf32_i386qnx_vec
+
+#define elf_backend_set_nonloadable_filepos elf_i386qnx_set_nonloadable_filepos
+#define elf_backend_is_contained_by_filepos elf_i386qnx_is_contained_by_filepos
+#define elf_backend_copy_private_bfd_data_p elf_i386qnx_copy_private_bfd_data_p
+
+#include "elf32-target.h"
diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c
index 7d5b0166095..2006652cb3e 100644
--- a/bfd/elf32-m68k.c
+++ b/bfd/elf32-m68k.c
@@ -413,7 +413,7 @@ elf32_m68k_print_private_bfd_data (abfd, ptr)
fprintf (file, _(" [cpu32]"));
if (elf_elfheader (abfd)->e_flags & EF_M68000)
- fprintf (file, _ (" [m68000]"));
+ fprintf (file, _(" [m68000]"));
fputc ('\n', file);
@@ -2211,7 +2211,8 @@ bfd_m68k_elf32_create_embedded_relocs (abfd, info, datasec, relsec, errmsg)
/* A local symbol. */
esym = extsyms + ELF32_R_SYM (irel->r_info);
shndx = shndx_buf + (shndx_buf ? ELF32_R_SYM (irel->r_info) : 0);
- bfd_elf32_swap_symbol_in (abfd, esym, shndx, &isym);
+ bfd_elf32_swap_symbol_in (abfd, (const PTR) esym, (const PTR) shndx,
+ &isym);
targetsec = bfd_section_from_elf_index (abfd, isym.st_shndx);
}
diff --git a/bfd/elf32-mips.c b/bfd/elf32-mips.c
index 1e6cf6fe53d..92887385745 100644
--- a/bfd/elf32-mips.c
+++ b/bfd/elf32-mips.c
@@ -82,171 +82,25 @@ static boolean elf32_mips_grok_psinfo
PARAMS ((bfd *, Elf_Internal_Note *));
static boolean elf32_mips_discard_info
PARAMS ((bfd *, struct elf_reloc_cookie *, struct bfd_link_info *));
-static boolean elf32_mips_ignore_discarded_relocs
- PARAMS ((asection *));
static boolean elf32_mips_write_section
PARAMS ((bfd *, asection *, bfd_byte *));
static irix_compat_t elf32_mips_irix_compat
PARAMS ((bfd *));
-extern const bfd_target bfd_elf32_tradbigmips_vec;
-extern const bfd_target bfd_elf32_tradlittlemips_vec;
+extern const bfd_target bfd_elf32_bigmips_vec;
+extern const bfd_target bfd_elf32_littlemips_vec;
/* Nonzero if ABFD is using the N32 ABI. */
-
#define ABI_N32_P(abfd) \
((elf_elfheader (abfd)->e_flags & EF_MIPS_ABI2) != 0)
-/* Nonzero if ABFD is using the 64-bit ABI. */
-#define ABI_64_P(abfd) \
- ((elf_elfheader (abfd)->e_ident[EI_CLASS] == ELFCLASS64) != 0)
-
-#define NEWABI_P(abfd) (ABI_N32_P (abfd) || ABI_64_P (abfd))
-
/* Whether we are trying to be compatible with IRIX at all. */
#define SGI_COMPAT(abfd) \
(elf32_mips_irix_compat (abfd) != ict_none)
-/* The size of an external REL relocation. */
-#define MIPS_ELF_REL_SIZE(abfd) \
- (get_elf_backend_data (abfd)->s->sizeof_rel)
-
/* The number of local .got entries we reserve. */
#define MIPS_RESERVED_GOTNO (2)
-#if 0
-/* We no longer try to identify particular sections for the .dynsym
- section. When we do, we wind up crashing if there are other random
- sections with relocations. */
-
-/* Names of sections which appear in the .dynsym section in an Irix 5
- executable. */
-
-static const char * const mips_elf_dynsym_sec_names[] =
-{
- ".text",
- ".init",
- ".fini",
- ".data",
- ".rodata",
- ".sdata",
- ".sbss",
- ".bss",
- NULL
-};
-
-#define SIZEOF_MIPS_DYNSYM_SECNAMES \
- (sizeof mips_elf_dynsym_sec_names / sizeof mips_elf_dynsym_sec_names[0])
-
-/* The number of entries in mips_elf_dynsym_sec_names which go in the
- text segment. */
-
-#define MIPS_TEXT_DYNSYM_SECNO (3)
-
-#endif /* 0 */
-
-/* The names of the runtime procedure table symbols used on Irix 5. */
-
-static const char * const mips_elf_dynsym_rtproc_names[] =
-{
- "_procedure_table",
- "_procedure_string_table",
- "_procedure_table_size",
- NULL
-};
-
-/* These structures are used to generate the .compact_rel section on
- Irix 5. */
-
-typedef struct
-{
- unsigned long id1; /* Always one? */
- unsigned long num; /* Number of compact relocation entries. */
- unsigned long id2; /* Always two? */
- unsigned long offset; /* The file offset of the first relocation. */
- unsigned long reserved0; /* Zero? */
- unsigned long reserved1; /* Zero? */
-} Elf32_compact_rel;
-
-typedef struct
-{
- bfd_byte id1[4];
- bfd_byte num[4];
- bfd_byte id2[4];
- bfd_byte offset[4];
- bfd_byte reserved0[4];
- bfd_byte reserved1[4];
-} Elf32_External_compact_rel;
-
-typedef struct
-{
- unsigned int ctype : 1; /* 1: long 0: short format. See below. */
- unsigned int rtype : 4; /* Relocation types. See below. */
- unsigned int dist2to : 8;
- unsigned int relvaddr : 19; /* (VADDR - vaddr of the previous entry)/ 4 */
- unsigned long konst; /* KONST field. See below. */
- unsigned long vaddr; /* VADDR to be relocated. */
-} Elf32_crinfo;
-
-typedef struct
-{
- unsigned int ctype : 1; /* 1: long 0: short format. See below. */
- unsigned int rtype : 4; /* Relocation types. See below. */
- unsigned int dist2to : 8;
- unsigned int relvaddr : 19; /* (VADDR - vaddr of the previous entry)/ 4 */
- unsigned long konst; /* KONST field. See below. */
-} Elf32_crinfo2;
-
-typedef struct
-{
- bfd_byte info[4];
- bfd_byte konst[4];
- bfd_byte vaddr[4];
-} Elf32_External_crinfo;
-
-typedef struct
-{
- bfd_byte info[4];
- bfd_byte konst[4];
-} Elf32_External_crinfo2;
-
-/* These are the constants used to swap the bitfields in a crinfo. */
-
-#define CRINFO_CTYPE (0x1)
-#define CRINFO_CTYPE_SH (31)
-#define CRINFO_RTYPE (0xf)
-#define CRINFO_RTYPE_SH (27)
-#define CRINFO_DIST2TO (0xff)
-#define CRINFO_DIST2TO_SH (19)
-#define CRINFO_RELVADDR (0x7ffff)
-#define CRINFO_RELVADDR_SH (0)
-
-/* A compact relocation info has long (3 words) or short (2 words)
- formats. A short format doesn't have VADDR field and relvaddr
- fields contains ((VADDR - vaddr of the previous entry) >> 2). */
-#define CRF_MIPS_LONG 1
-#define CRF_MIPS_SHORT 0
-
-/* There are 4 types of compact relocation at least. The value KONST
- has different meaning for each type:
-
- (type) (konst)
- CT_MIPS_REL32 Address in data
- CT_MIPS_WORD Address in word (XXX)
- CT_MIPS_GPHI_LO GP - vaddr
- CT_MIPS_JMPAD Address to jump
- */
-
-#define CRT_MIPS_REL32 0xa
-#define CRT_MIPS_WORD 0xb
-#define CRT_MIPS_GPHI_LO 0xc
-#define CRT_MIPS_JMPAD 0xd
-
-#define mips_elf_set_cr_format(x,format) ((x).ctype = (format))
-#define mips_elf_set_cr_type(x,type) ((x).rtype = (type))
-#define mips_elf_set_cr_dist2to(x,v) ((x).dist2to = (v))
-#define mips_elf_set_cr_relvaddr(x,d) ((x).relvaddr = (d)<<2)
-
/* In case we're on a 32-bit machine, construct a 64-bit "-1" value
from smaller values. Start with zero, widen, *then* decrement. */
#define MINUS_ONE (((bfd_vma)0) - 1)
@@ -904,7 +758,7 @@ mips_elf_hi16_reloc (abfd, reloc_entry, symbol, data, input_section,
bfd_vma relocation;
struct mips_hi16 *n;
- /* If we're relocating, and this an external symbol, we don't want
+ /* If we're relocating, and this is an external symbol, we don't want
to change anything. */
if (output_bfd != (bfd *) NULL
&& (symbol->flags & BSF_SECTION_SYM) == 0
@@ -1099,7 +953,7 @@ mips_elf_got16_reloc (abfd, reloc_entry, symbol, data, input_section,
bfd *output_bfd;
char **error_message;
{
- /* If we're relocating, and this an external symbol, we don't want
+ /* If we're relocating, and this is an external symbol, we don't want
to change anything. */
if (output_bfd != (bfd *) NULL
&& (symbol->flags & BSF_SECTION_SYM) == 0
@@ -1264,8 +1118,8 @@ _bfd_mips_elf32_gprel16_reloc (abfd, reloc_entry, symbol, data, input_section,
data, gp);
}
-/* Do a R_MIPS_GPREL32 relocation. Is this 32 bit value the offset
- from the gp register? XXX */
+/* Do a R_MIPS_GPREL32 relocation. This is a 32 bit value which must
+ become the offset from the gp register. */
static bfd_reloc_status_type gprel32_with_gp PARAMS ((bfd *, asymbol *,
arelent *, asection *,
@@ -1531,8 +1385,8 @@ mips16_gprel_reloc (abfd, reloc_entry, symbol, data, input_section,
/* A mapping from BFD reloc types to MIPS ELF reloc types. */
struct elf_reloc_map {
- bfd_reloc_code_real_type bfd_reloc_val;
- enum elf_mips_reloc_type elf_reloc_val;
+ bfd_reloc_code_real_type bfd_val;
+ enum elf_mips_reloc_type elf_val;
};
static const struct elf_reloc_map mips_reloc_map[] =
@@ -1540,6 +1394,7 @@ static const struct elf_reloc_map mips_reloc_map[] =
{ BFD_RELOC_NONE, R_MIPS_NONE, },
{ BFD_RELOC_16, R_MIPS_16 },
{ BFD_RELOC_32, R_MIPS_32 },
+ /* There is no BFD reloc for R_MIPS_REL32. */
{ BFD_RELOC_64, R_MIPS_64 },
{ BFD_RELOC_MIPS_JMP, R_MIPS_26 },
{ BFD_RELOC_HI16_S, R_MIPS_HI16 },
@@ -1568,11 +1423,13 @@ bfd_elf32_bfd_reloc_type_lookup (abfd, code)
bfd_reloc_code_real_type code;
{
unsigned int i;
+ reloc_howto_type *howto_table = elf_mips_howto_table_rel;
- for (i = 0; i < sizeof (mips_reloc_map) / sizeof (struct elf_reloc_map); i++)
+ for (i = 0; i < sizeof (mips_reloc_map) / sizeof (struct elf_reloc_map);
+ i++)
{
- if (mips_reloc_map[i].bfd_reloc_val == code)
- return &elf_mips_howto_table_rel[(int) mips_reloc_map[i].elf_reloc_val];
+ if (mips_reloc_map[i].bfd_val == code)
+ return &howto_table[(int) mips_reloc_map[i].elf_val];
}
switch (code)
@@ -1586,7 +1443,7 @@ bfd_elf32_bfd_reloc_type_lookup (abfd, code)
Select the right relocation (R_MIPS_32 or R_MIPS_64) based on the
size of addresses on this architecture. */
if (bfd_arch_bits_per_address (abfd) == 32)
- return &elf_mips_howto_table_rel[(int) R_MIPS_32];
+ return &howto_table[(int) R_MIPS_32];
else
return &elf_mips_ctor64_howto;
@@ -1622,32 +1479,22 @@ mips_elf32_rtype_to_howto (r_type, rela_p)
{
case R_MIPS16_26:
return &elf_mips16_jump_howto;
- break;
case R_MIPS16_GPREL:
return &elf_mips16_gprel_howto;
- break;
case R_MIPS_GNU_VTINHERIT:
return &elf_mips_gnu_vtinherit_howto;
- break;
case R_MIPS_GNU_VTENTRY:
return &elf_mips_gnu_vtentry_howto;
- break;
case R_MIPS_GNU_REL_HI16:
return &elf_mips_gnu_rel_hi16;
- break;
case R_MIPS_GNU_REL_LO16:
return &elf_mips_gnu_rel_lo16;
- break;
case R_MIPS_GNU_REL16_S2:
return &elf_mips_gnu_rel16_s2;
- break;
case R_MIPS_PC64:
return &elf_mips_gnu_pcrel64;
- break;
case R_MIPS_PC32:
return &elf_mips_gnu_pcrel32;
- break;
-
default:
BFD_ASSERT (r_type < (unsigned int) R_MIPS_max);
return &elf_mips_howto_table_rel[r_type];
@@ -1822,7 +1669,6 @@ elf32_mips_discard_info (abfd, cookie, info)
struct bfd_link_info *info;
{
asection *o;
- struct elf_backend_data *bed = get_elf_backend_data (abfd);
boolean ret = false;
unsigned char *tdata;
size_t i, skip;
@@ -1852,8 +1698,7 @@ elf32_mips_discard_info (abfd, cookie, info)
}
cookie->rel = cookie->rels;
- cookie->relend =
- cookie->rels + o->reloc_count * bed->s->int_rels_per_ext_rel;
+ cookie->relend = cookie->rels + o->reloc_count;
for (i = 0, skip = 0; i < o->_raw_size; i ++)
{
@@ -1880,15 +1725,6 @@ elf32_mips_discard_info (abfd, cookie, info)
}
static boolean
-elf32_mips_ignore_discarded_relocs (sec)
- asection *sec;
-{
- if (strcmp (sec->name, ".pdr") == 0)
- return true;
- return false;
-}
-
-static boolean
elf32_mips_write_section (output_bfd, sec, contents)
bfd *output_bfd;
asection *sec;
@@ -1927,11 +1763,11 @@ static irix_compat_t
elf32_mips_irix_compat (abfd)
bfd *abfd;
{
- if ((abfd->xvec == &bfd_elf32_tradbigmips_vec)
- || (abfd->xvec == &bfd_elf32_tradlittlemips_vec))
- return ict_none;
- else
+ if ((abfd->xvec == &bfd_elf32_bigmips_vec)
+ || (abfd->xvec == &bfd_elf32_littlemips_vec))
return ict_irix5;
+ else
+ return ict_none;
}
/* Given a data section and an in-memory embedded reloc section, store
@@ -2050,7 +1886,8 @@ bfd_mips_elf32_create_embedded_relocs (abfd, info, datasec, relsec, errmsg)
/* A local symbol. */
esym = extsyms + ELF32_R_SYM (irel->r_info);
shndx = shndx_buf + (shndx_buf ? ELF32_R_SYM (irel->r_info) : 0);
- bfd_elf32_swap_symbol_in (abfd, esym, shndx, &isym);
+ bfd_elf32_swap_symbol_in (abfd, (const PTR) esym, (const PTR) shndx,
+ &isym);
targetsec = bfd_section_from_elf_index (abfd, isym.st_shndx);
}
@@ -2209,7 +2046,7 @@ static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap = {
#define elf_backend_discard_info elf32_mips_discard_info
#define elf_backend_ignore_discarded_relocs \
- elf32_mips_ignore_discarded_relocs
+ _bfd_mips_elf_ignore_discarded_relocs
#define elf_backend_write_section elf32_mips_write_section
#define elf_backend_mips_irix_compat elf32_mips_irix_compat
#define elf_backend_mips_rtype_to_howto mips_elf32_rtype_to_howto
diff --git a/bfd/elf32-openrisc.c b/bfd/elf32-openrisc.c
index 34d4d9facde..2dd7fb71da9 100644
--- a/bfd/elf32-openrisc.c
+++ b/bfd/elf32-openrisc.c
@@ -469,11 +469,11 @@ openrisc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
static asection *
openrisc_elf_gc_mark_hook (abfd, info, rel, h, sym)
- bfd *abfd ATTRIBUTE_UNUSED;
+ bfd *abfd;
struct bfd_link_info *info ATTRIBUTE_UNUSED;
- Elf_Internal_Rela *rel ATTRIBUTE_UNUSED;
- struct elf_link_hash_entry *h ATTRIBUTE_UNUSED;
- Elf_Internal_Sym *sym ATTRIBUTE_UNUSED;
+ Elf_Internal_Rela *rel;
+ struct elf_link_hash_entry *h;
+ Elf_Internal_Sym *sym;
{
if (h != NULL)
{
diff --git a/bfd/elf32-or32.c b/bfd/elf32-or32.c
index eed0b99168a..a61b09d4152 100644
--- a/bfd/elf32-or32.c
+++ b/bfd/elf32-or32.c
@@ -277,19 +277,19 @@ or32_elf_32_reloc (abfd, reloc_entry, symbol, data, input_section,
asection *input_section;
bfd *output_bfd;
char **error_message ATTRIBUTE_UNUSED;
-{
+{
if (output_bfd != (bfd *) NULL)
{
unsigned long insn;
bfd_size_type addr = reloc_entry->address;
reloc_entry->address += input_section->output_offset;
-
+
insn = bfd_get_32 (abfd, (bfd_byte *) data + addr);
insn += symbol->section->output_section->vma;
insn += symbol->section->output_offset;
insn += symbol->value;
- bfd_put_32 (abfd, insn, (bfd_byte *) data + addr);
+ bfd_put_32 (abfd, insn, (bfd_byte *) data + addr);
return bfd_reloc_ok;
}
@@ -307,7 +307,7 @@ or32_elf_16_reloc (abfd, reloc_entry, symbol, data, input_section,
asection *input_section;
bfd *output_bfd;
char **error_message ATTRIBUTE_UNUSED;
-{
+{
if (output_bfd != (bfd *) NULL)
{
unsigned short insn;
@@ -319,7 +319,7 @@ or32_elf_16_reloc (abfd, reloc_entry, symbol, data, input_section,
insn += symbol->section->output_section->vma;
insn += symbol->section->output_offset;
insn += symbol->value;
- bfd_put_16 (abfd, insn, (bfd_byte *) data + addr);
+ bfd_put_16 (abfd, insn, (bfd_byte *) data + addr);
return bfd_reloc_ok;
}
@@ -337,7 +337,7 @@ or32_elf_8_reloc (abfd, reloc_entry, symbol, data, input_section,
asection *input_section;
bfd *output_bfd;
char **error_message ATTRIBUTE_UNUSED;
-{
+{
if (output_bfd != (bfd *) NULL)
{
unsigned char insn;
@@ -349,7 +349,7 @@ or32_elf_8_reloc (abfd, reloc_entry, symbol, data, input_section,
insn += symbol->section->output_section->vma;
insn += symbol->section->output_offset;
insn += symbol->value;
- bfd_put_8 (abfd, insn, (bfd_byte *) data + addr);
+ bfd_put_8 (abfd, insn, (bfd_byte *) data + addr);
return bfd_reloc_ok;
}
@@ -391,7 +391,7 @@ or32_elf_consth_reloc (abfd, reloc_entry, symbol, data, input_section,
bfd_reloc_status_type ret;
bfd_vma relocation;
struct or32_consth *n;
-
+
ret = bfd_reloc_ok;
if (bfd_is_und_section (symbol->section)
@@ -505,7 +505,7 @@ or32_elf_jumptarg_reloc (abfd, reloc_entry, symbol, data, input_section,
asection *input_section;
bfd *output_bfd;
char **error_message ATTRIBUTE_UNUSED;
-{
+{
if (output_bfd != (bfd *) NULL)
{
unsigned long insn, tmp;
@@ -517,7 +517,7 @@ or32_elf_jumptarg_reloc (abfd, reloc_entry, symbol, data, input_section,
tmp = insn | 0xfc000000;
tmp -= (input_section->output_offset >> 2);
insn = (insn & 0xfc000000) | (tmp & 0x03ffffff);
- bfd_put_32 (abfd, insn, (bfd_byte *) data + addr);
+ bfd_put_32 (abfd, insn, (bfd_byte *) data + addr);
return bfd_reloc_ok;
}
diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c
index 31d9e0c3f3d..17c5d254a46 100644
--- a/bfd/elf32-ppc.c
+++ b/bfd/elf32-ppc.c
@@ -56,7 +56,7 @@ static boolean ppc_elf_create_dynamic_sections
static boolean ppc_elf_section_from_shdr PARAMS ((bfd *,
Elf32_Internal_Shdr *,
- char *));
+ const char *));
static boolean ppc_elf_fake_sections
PARAMS ((bfd *, Elf32_Internal_Shdr *, asection *));
@@ -1490,7 +1490,7 @@ static boolean
ppc_elf_section_from_shdr (abfd, hdr, name)
bfd *abfd;
Elf32_Internal_Shdr *hdr;
- char *name;
+ const char *name;
{
asection *newsect;
flagword flags;
diff --git a/bfd/elf32-s390.c b/bfd/elf32-s390.c
index 5032a5c52d4..cdbdcba03d4 100644
--- a/bfd/elf32-s390.c
+++ b/bfd/elf32-s390.c
@@ -1064,7 +1064,7 @@ elf_s390_adjust_dynamic_symbol (info, h)
/* If this is a function, put it in the procedure linkage table. We
will fill in the contents of the procedure linkage table later
- (although we could actually do it here). */
+ (although we could actually do it here). */
if (h->type == STT_FUNC
|| (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0)
{
diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c
index ef737b5132f..e37d0d14d9a 100644
--- a/bfd/elf32-sh.c
+++ b/bfd/elf32-sh.c
@@ -2067,7 +2067,8 @@ sh_elf_relax_section (abfd, sec, link_info, again)
esym = extsyms + ELF32_R_SYM (irelfn->r_info);
shndx = shndx_buf + (shndx_buf ? ELF32_R_SYM (irelfn->r_info) : 0);
- bfd_elf32_swap_symbol_in (abfd, esym, shndx, &isym);
+ bfd_elf32_swap_symbol_in (abfd, (const PTR) esym, (const PTR) shndx,
+ &isym);
if (isym.st_shndx
!= (unsigned int) _bfd_elf_section_from_bfd_section (abfd, sec))
@@ -2447,7 +2448,8 @@ sh_elf_relax_delete_bytes (abfd, sec, addr, count)
{
esym = extsyms + ELF32_R_SYM (irel->r_info);
shndx = shndx_buf + (shndx_buf ? ELF32_R_SYM (irel->r_info) : 0);
- bfd_elf32_swap_symbol_in (abfd, esym, shndx, &sym);
+ bfd_elf32_swap_symbol_in (abfd, (const PTR) esym,
+ (const PTR) shndx, &sym);
if (sym.st_shndx == sec_shndx
&& (sym.st_value <= addr
@@ -2710,7 +2712,8 @@ sh_elf_relax_delete_bytes (abfd, sec, addr, count)
esym = extsyms + ELF32_R_SYM (irelscan->r_info);
shndx = shndx_buf + (shndx_buf ? ELF32_R_SYM (irelscan->r_info) : 0);
- bfd_elf32_swap_symbol_in (abfd, esym, shndx, &sym);
+ bfd_elf32_swap_symbol_in (abfd, (const PTR) esym, (const PTR) shndx,
+ &sym);
if (sym.st_shndx == sec_shndx
&& (sym.st_value <= addr
@@ -2757,7 +2760,8 @@ sh_elf_relax_delete_bytes (abfd, sec, addr, count)
Elf_Internal_Sym isym;
Elf_External_Sym_Shndx dummy;
- bfd_elf32_swap_symbol_in (abfd, esym, shndx, &isym);
+ bfd_elf32_swap_symbol_in (abfd, (const PTR) esym, (const PTR) shndx,
+ &isym);
if (isym.st_shndx == sec_shndx
&& isym.st_value > addr
@@ -4924,7 +4928,8 @@ sh_elf_get_relocated_section_contents (output_bfd, link_info, link_order,
{
asection *isec;
- bfd_elf32_swap_symbol_in (input_bfd, esym, shndx, isymp);
+ bfd_elf32_swap_symbol_in (input_bfd, (const PTR) esym,
+ (const PTR) shndx, isymp);
if (isymp->st_shndx == SHN_UNDEF)
isec = bfd_und_section_ptr;
diff --git a/bfd/elf32-sh64-com.c b/bfd/elf32-sh64-com.c
new file mode 100644
index 00000000000..ae2cab4e690
--- /dev/null
+++ b/bfd/elf32-sh64-com.c
@@ -0,0 +1,264 @@
+/* Hitachi SH64-specific support for 32-bit ELF
+ Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
+
+ 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 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 SH64_ELF
+
+#include "bfd.h"
+#include "sysdep.h"
+#include "libbfd.h"
+#include "elf-bfd.h"
+#include "elf/sh.h"
+#include "../opcodes/sh64-opc.h"
+
+static boolean sh64_address_in_cranges
+ PARAMS ((asection *cranges, bfd_vma, sh64_elf_crange *));
+
+/* Ordering functions of a crange, for the qsort and bsearch calls and for
+ different endianness. */
+
+int
+_bfd_sh64_crange_qsort_cmpb (p1, p2)
+ const PTR p1;
+ const PTR p2;
+{
+ bfd_vma a1 = bfd_getb32 (p1);
+ bfd_vma a2 = bfd_getb32 (p2);
+
+ /* Preserve order if there's ambiguous contents. */
+ if (a1 == a2)
+ return (char *) p1 - (char *) p2;
+
+ return a1 - a2;
+}
+
+int
+_bfd_sh64_crange_qsort_cmpl (p1, p2)
+ const PTR p1;
+ const PTR p2;
+{
+ bfd_vma a1 = (bfd_vma) bfd_getl32 (p1);
+ bfd_vma a2 = (bfd_vma) bfd_getl32 (p2);
+
+ /* Preserve order if there's ambiguous contents. */
+ if (a1 == a2)
+ return (char *) p1 - (char *) p2;
+
+ return a1 - a2;
+}
+
+int
+_bfd_sh64_crange_bsearch_cmpb (p1, p2)
+ const PTR p1;
+ const PTR p2;
+{
+ bfd_vma a1 = *(bfd_vma *) p1;
+ bfd_vma a2 = (bfd_vma) bfd_getb32 (p2);
+ bfd_size_type size
+ = (bfd_size_type) bfd_getb32 (SH64_CRANGE_CR_SIZE_OFFSET + (char *) p2);
+
+ if (a1 >= a2 + size)
+ return 1;
+ if (a1 < a2)
+ return -1;
+ return 0;
+}
+
+int
+_bfd_sh64_crange_bsearch_cmpl (p1, p2)
+ const PTR p1;
+ const PTR p2;
+{
+ bfd_vma a1 = *(bfd_vma *) p1;
+ bfd_vma a2 = (bfd_vma) bfd_getl32 (p2);
+ bfd_size_type size
+ = (bfd_size_type) bfd_getl32 (SH64_CRANGE_CR_SIZE_OFFSET + (char *) p2);
+
+ if (a1 >= a2 + size)
+ return 1;
+ if (a1 < a2)
+ return -1;
+ return 0;
+}
+
+/* Check whether a specific address is specified within a .cranges
+ section. Return FALSE if not found, and TRUE if found, and the region
+ filled into RANGEP if non-NULL. */
+
+static boolean
+sh64_address_in_cranges (cranges, addr, rangep)
+ asection *cranges;
+ bfd_vma addr;
+ sh64_elf_crange *rangep;
+{
+ bfd_byte *cranges_contents;
+ bfd_byte *found_rangep;
+ bfd_size_type cranges_size = bfd_section_size (cranges->owner, cranges);
+
+ /* If the size is not a multiple of the cranges entry size, then
+ something is badly wrong. */
+ if ((cranges_size % SH64_CRANGE_SIZE) != 0)
+ return false;
+
+ /* If this section has relocations, then we can't do anything sane. */
+ if (bfd_get_section_flags (cranges->owner, cranges) & SEC_RELOC)
+ return false;
+
+ /* Has some kind soul (or previous call) left processed, sorted contents
+ for us? */
+ if ((bfd_get_section_flags (cranges->owner, cranges) & SEC_IN_MEMORY)
+ && elf_section_data (cranges)->this_hdr.sh_type == SHT_SH5_CR_SORTED)
+ cranges_contents = cranges->contents;
+ else
+ {
+ cranges_contents
+ = bfd_malloc (cranges->_cooked_size == 0
+ ? cranges->_cooked_size : cranges->_raw_size);
+ if (cranges_contents == NULL)
+ return false;
+
+ if (! bfd_get_section_contents (cranges->owner, cranges,
+ cranges_contents, (file_ptr) 0,
+ cranges_size))
+ goto error_return;
+
+ /* Is it sorted? */
+ if (elf_section_data (cranges)->this_hdr.sh_type
+ != SHT_SH5_CR_SORTED)
+ /* Nope. Lets sort it. */
+ qsort (cranges_contents, cranges_size / SH64_CRANGE_SIZE,
+ SH64_CRANGE_SIZE,
+ bfd_big_endian (cranges->owner)
+ ? _bfd_sh64_crange_qsort_cmpb : _bfd_sh64_crange_qsort_cmpl);
+
+ /* Let's keep it around. */
+ cranges->contents = cranges_contents;
+ bfd_set_section_flags (cranges->owner, cranges,
+ bfd_get_section_flags (cranges->owner, cranges)
+ | SEC_IN_MEMORY);
+
+ /* It's sorted now. */
+ elf_section_data (cranges)->this_hdr.sh_type = SHT_SH5_CR_SORTED;
+ }
+
+ /* Try and find a matching range. */
+ found_rangep
+ = bsearch (&addr, cranges_contents, cranges_size / SH64_CRANGE_SIZE,
+ SH64_CRANGE_SIZE,
+ bfd_big_endian (cranges->owner)
+ ? _bfd_sh64_crange_bsearch_cmpb
+ : _bfd_sh64_crange_bsearch_cmpl);
+
+ /* Fill in a few return values if we found a matching range. */
+ if (found_rangep)
+ {
+ enum sh64_elf_cr_type cr_type
+ = bfd_get_16 (cranges->owner,
+ SH64_CRANGE_CR_TYPE_OFFSET + found_rangep);
+ bfd_vma cr_addr
+ = bfd_get_32 (cranges->owner,
+ SH64_CRANGE_CR_ADDR_OFFSET
+ + (char *) found_rangep);
+ bfd_size_type cr_size
+ = bfd_get_32 (cranges->owner,
+ SH64_CRANGE_CR_SIZE_OFFSET
+ + (char *) found_rangep);
+
+ rangep->cr_addr = cr_addr;
+ rangep->cr_size = cr_size;
+ rangep->cr_type = cr_type;
+
+ return true;
+ }
+
+ /* There is a .cranges section, but it does not have a descriptor
+ matching this address. */
+ return false;
+
+error_return:
+ free (cranges_contents);
+ return false;
+}
+
+/* Determine what ADDR points to in SEC, and fill in a range descriptor in
+ *RANGEP if it's non-NULL. */
+
+enum sh64_elf_cr_type
+sh64_get_contents_type (sec, addr, rangep)
+ asection *sec;
+ bfd_vma addr;
+ sh64_elf_crange *rangep;
+{
+ asection *cranges;
+
+ /* Fill in the range with the boundaries of the section as a default. */
+ if (bfd_get_flavour (sec->owner) == bfd_target_elf_flavour
+ && elf_elfheader (sec->owner)->e_type == ET_EXEC)
+ {
+ rangep->cr_addr = bfd_get_section_vma (sec->owner, sec);
+ rangep->cr_size = bfd_section_size (sec->owner, sec);
+ rangep->cr_type = CRT_NONE;
+ }
+ else
+ return false;
+
+ /* If none of the pertinent bits are set, then it's a SHcompact (or at
+ least not SHmedia). */
+ if ((elf_section_data (sec)->this_hdr.sh_flags
+ & (SHF_SH5_ISA32 | SHF_SH5_ISA32_MIXED)) == 0)
+ {
+ enum sh64_elf_cr_type cr_type
+ = ((bfd_get_section_flags (sec->owner, sec) & SEC_CODE) != 0
+ ? CRT_SH5_ISA16 : CRT_DATA);
+ rangep->cr_type = cr_type;
+ return cr_type;
+ }
+
+ /* If only the SHF_SH5_ISA32 bit is set, then we have SHmedia. */
+ if ((elf_section_data (sec)->this_hdr.sh_flags
+ & (SHF_SH5_ISA32 | SHF_SH5_ISA32_MIXED)) == SHF_SH5_ISA32)
+ {
+ rangep->cr_type = CRT_SH5_ISA32;
+ return CRT_SH5_ISA32;
+ }
+
+ /* Otherwise, we have to look up the .cranges section. */
+ cranges = bfd_get_section_by_name (sec->owner, SH64_CRANGES_SECTION_NAME);
+
+ if (cranges == NULL)
+ /* A mixed section but there's no .cranges section. This is probably
+ bad input; it does not comply to specs. */
+ return CRT_NONE;
+
+ /* If this call fails, we will still have CRT_NONE in rangep->cr_type
+ and that will be suitable to return. */
+ sh64_address_in_cranges (cranges, addr, rangep);
+
+ return rangep->cr_type;
+}
+
+/* This is a simpler exported interface for the benefit of gdb et al. */
+
+boolean
+sh64_address_is_shmedia (sec, addr)
+ asection *sec;
+ bfd_vma addr;
+{
+ sh64_elf_crange dummy;
+ return sh64_get_contents_type (sec, addr, &dummy) == CRT_SH5_ISA32;
+}
diff --git a/bfd/elf32-sh64-nbsd.c b/bfd/elf32-sh64-nbsd.c
new file mode 100644
index 00000000000..2d3e3d99dbd
--- /dev/null
+++ b/bfd/elf32-sh64-nbsd.c
@@ -0,0 +1,29 @@
+/* SuperH SH64 specific support for 32-bit NetBSD
+ Copyright 2002 Free Software Foundation, Inc.
+
+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 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 TARGET_BIG_SYM bfd_elf32_sh64nbsd_vec
+#define TARGET_BIG_NAME "elf32-sh64-nbsd"
+#define TARGET_LITTLE_SYM bfd_elf32_sh64lnbsd_vec
+#define TARGET_LITTLE_NAME "elf32-sh64l-nbsd"
+#define ELF_ARCH bfd_arch_sh
+#define ELF_MACHINE_CODE EM_SH
+#define ELF_MAXPAGESIZE 0x10000
+#define elf_symbol_leading_char 0
+
+#include "elf32-sh64.c"
diff --git a/bfd/elf32-sh64.c b/bfd/elf32-sh64.c
index 5e7ccdd6822..a14b1ba04d3 100644
--- a/bfd/elf32-sh64.c
+++ b/bfd/elf32-sh64.c
@@ -54,7 +54,7 @@ static boolean sh64_elf_link_output_symbol_hook
PARAMS ((bfd *, struct bfd_link_info *, const char *, Elf_Internal_Sym *,
asection *));
static boolean sh64_backend_section_from_shdr
- PARAMS ((bfd *, Elf_Internal_Shdr *, char *));
+ PARAMS ((bfd *, Elf_Internal_Shdr *, const char *));
static void sh64_elf_final_write_processing PARAMS ((bfd *, boolean));
static boolean sh64_bfd_elf_copy_private_section_data
PARAMS ((bfd *, asection *, bfd *, asection *));
@@ -105,15 +105,6 @@ static void sh64_find_section_for_address PARAMS ((bfd *, asection *, PTR));
#define INCLUDE_SHMEDIA
#include "elf32-sh.c"
-/* The type sh64_elf_crange is defined in elf/sh.h which is included in
- elf32-sh.c, hence these prototypes located after including it. */
-static int crange_qsort_cmpb PARAMS ((const void *, const void *));
-static int crange_qsort_cmpl PARAMS ((const void *, const void *));
-static int crange_bsearch_cmpb PARAMS ((const void *, const void *));
-static int crange_bsearch_cmpl PARAMS ((const void *, const void *));
-static boolean sh64_address_in_cranges
- PARAMS ((asection *cranges, bfd_vma, sh64_elf_crange *));
-
/* Set the SHF_SH5_ISA32 flag for ISA SHmedia code sections, and pass
through SHT_SH5_CR_SORTED on a sorted .cranges section. */
@@ -255,7 +246,7 @@ boolean
sh64_backend_section_from_shdr (abfd, hdr, name)
bfd *abfd;
Elf_Internal_Shdr *hdr;
- char *name;
+ const char *name;
{
flagword flags = 0;
@@ -731,7 +722,8 @@ sh64_elf_final_write_processing (abfd, linker)
qsort (cranges->contents, cranges_size / SH64_CRANGE_SIZE,
SH64_CRANGE_SIZE,
bfd_big_endian (cranges->owner)
- ? crange_qsort_cmpb : crange_qsort_cmpl);
+ ? _bfd_sh64_crange_qsort_cmpb
+ : _bfd_sh64_crange_qsort_cmpl);
elf_section_data (cranges)->this_hdr.sh_type
= SHT_SH5_CR_SORTED;
}
@@ -750,236 +742,3 @@ sh64_elf_final_write_processing (abfd, linker)
}
}
}
-
-/* Ordering functions of a crange, for the qsort and bsearch calls and for
- different endianness. */
-
-static int
-crange_qsort_cmpb (p1, p2)
- const PTR p1;
- const PTR p2;
-{
- bfd_vma a1 = bfd_getb32 (p1);
- bfd_vma a2 = bfd_getb32 (p2);
-
- /* Preserve order if there's ambiguous contents. */
- if (a1 == a2)
- return (char *) p1 - (char *) p2;
-
- return a1 - a2;
-}
-
-static int
-crange_qsort_cmpl (p1, p2)
- const PTR p1;
- const PTR p2;
-{
- bfd_vma a1 = (bfd_vma) bfd_getl32 (p1);
- bfd_vma a2 = (bfd_vma) bfd_getl32 (p2);
-
- /* Preserve order if there's ambiguous contents. */
- if (a1 == a2)
- return (char *) p1 - (char *) p2;
-
- return a1 - a2;
-}
-
-static int
-crange_bsearch_cmpb (p1, p2)
- const PTR p1;
- const PTR p2;
-{
- bfd_vma a1 = *(bfd_vma *) p1;
- bfd_vma a2 = (bfd_vma) bfd_getb32 (p2);
- bfd_size_type size
- = (bfd_size_type) bfd_getb32 (SH64_CRANGE_CR_SIZE_OFFSET + (char *) p2);
-
- if (a1 >= a2 + size)
- return 1;
- if (a1 < a2)
- return -1;
- return 0;
-}
-
-static int
-crange_bsearch_cmpl (p1, p2)
- const PTR p1;
- const PTR p2;
-{
- bfd_vma a1 = *(bfd_vma *) p1;
- bfd_vma a2 = (bfd_vma) bfd_getl32 (p2);
- bfd_size_type size
- = (bfd_size_type) bfd_getl32 (SH64_CRANGE_CR_SIZE_OFFSET + (char *) p2);
-
- if (a1 >= a2 + size)
- return 1;
- if (a1 < a2)
- return -1;
- return 0;
-}
-
-/* Check whether a specific address is specified within a .cranges
- section. Return FALSE if not found, and TRUE if found, and the region
- filled into RANGEP if non-NULL. */
-
-static boolean
-sh64_address_in_cranges (cranges, addr, rangep)
- asection *cranges;
- bfd_vma addr;
- sh64_elf_crange *rangep;
-{
- bfd_byte *cranges_contents;
- bfd_byte *found_rangep;
- bfd_size_type cranges_size = bfd_section_size (cranges->owner, cranges);
-
- /* If the size is not a multiple of the cranges entry size, then
- something is badly wrong. */
- if ((cranges_size % SH64_CRANGE_SIZE) != 0)
- return false;
-
- /* If this section has relocations, then we can't do anything sane. */
- if (bfd_get_section_flags (cranges->owner, cranges) & SEC_RELOC)
- return false;
-
- /* Has some kind soul (or previous call) left processed, sorted contents
- for us? */
- if ((bfd_get_section_flags (cranges->owner, cranges) & SEC_IN_MEMORY)
- && elf_section_data (cranges)->this_hdr.sh_type == SHT_SH5_CR_SORTED)
- cranges_contents = cranges->contents;
- else
- {
- cranges_contents
- = bfd_malloc (cranges->_cooked_size == 0
- ? cranges->_cooked_size : cranges->_raw_size);
- if (cranges_contents == NULL)
- return false;
-
- if (! bfd_get_section_contents (cranges->owner, cranges,
- cranges_contents, (file_ptr) 0,
- cranges_size))
- goto error_return;
-
- /* Is it sorted? */
- if (elf_section_data (cranges)->this_hdr.sh_type
- != SHT_SH5_CR_SORTED)
- /* Nope. Lets sort it. */
- qsort (cranges_contents, cranges_size / SH64_CRANGE_SIZE,
- SH64_CRANGE_SIZE,
- bfd_big_endian (cranges->owner)
- ? crange_qsort_cmpb : crange_qsort_cmpl);
-
- /* Let's keep it around. */
- cranges->contents = cranges_contents;
- bfd_set_section_flags (cranges->owner, cranges,
- bfd_get_section_flags (cranges->owner, cranges)
- | SEC_IN_MEMORY);
-
- /* It's sorted now. */
- elf_section_data (cranges)->this_hdr.sh_type = SHT_SH5_CR_SORTED;
- }
-
- /* Try and find a matching range. */
- found_rangep
- = bsearch (&addr, cranges_contents, cranges_size / SH64_CRANGE_SIZE,
- SH64_CRANGE_SIZE,
- bfd_big_endian (cranges->owner)
- ? crange_bsearch_cmpb : crange_bsearch_cmpl);
-
- /* Fill in a few return values if we found a matching range. */
- if (found_rangep)
- {
- enum sh64_elf_cr_type cr_type
- = bfd_get_16 (cranges->owner,
- SH64_CRANGE_CR_TYPE_OFFSET + found_rangep);
- bfd_vma cr_addr
- = bfd_get_32 (cranges->owner,
- SH64_CRANGE_CR_ADDR_OFFSET
- + (char *) found_rangep);
- bfd_size_type cr_size
- = bfd_get_32 (cranges->owner,
- SH64_CRANGE_CR_SIZE_OFFSET
- + (char *) found_rangep);
-
- rangep->cr_addr = cr_addr;
- rangep->cr_size = cr_size;
- rangep->cr_type = cr_type;
-
- return true;
- }
-
- /* There is a .cranges section, but it does not have a descriptor
- matching this address. */
- return false;
-
-error_return:
- free (cranges_contents);
- return false;
-}
-
-/* Determine what ADDR points to in SEC, and fill in a range descriptor in
- *RANGEP if it's non-NULL. */
-
-enum sh64_elf_cr_type
-sh64_get_contents_type (sec, addr, rangep)
- asection *sec;
- bfd_vma addr;
- sh64_elf_crange *rangep;
-{
- asection *cranges;
-
- /* Fill in the range with the boundaries of the section as a default. */
- if (bfd_get_flavour (sec->owner) == bfd_target_elf_flavour
- && elf_elfheader (sec->owner)->e_type == ET_EXEC)
- {
- rangep->cr_addr = bfd_get_section_vma (sec->owner, sec);
- rangep->cr_size = bfd_section_size (sec->owner, sec);
- rangep->cr_type = CRT_NONE;
- }
- else
- return false;
-
- /* If none of the pertinent bits are set, then it's a SHcompact (or at
- least not SHmedia). */
- if ((elf_section_data (sec)->this_hdr.sh_flags
- & (SHF_SH5_ISA32 | SHF_SH5_ISA32_MIXED)) == 0)
- {
- enum sh64_elf_cr_type cr_type
- = ((bfd_get_section_flags (sec->owner, sec) & SEC_CODE) != 0
- ? CRT_SH5_ISA16 : CRT_DATA);
- rangep->cr_type = cr_type;
- return cr_type;
- }
-
- /* If only the SHF_SH5_ISA32 bit is set, then we have SHmedia. */
- if ((elf_section_data (sec)->this_hdr.sh_flags
- & (SHF_SH5_ISA32 | SHF_SH5_ISA32_MIXED)) == SHF_SH5_ISA32)
- {
- rangep->cr_type = CRT_SH5_ISA32;
- return CRT_SH5_ISA32;
- }
-
- /* Otherwise, we have to look up the .cranges section. */
- cranges = bfd_get_section_by_name (sec->owner, SH64_CRANGES_SECTION_NAME);
-
- if (cranges == NULL)
- /* A mixed section but there's no .cranges section. This is probably
- bad input; it does not comply to specs. */
- return CRT_NONE;
-
- /* If this call fails, we will still have CRT_NONE in rangep->cr_type
- and that will be suitable to return. */
- sh64_address_in_cranges (cranges, addr, rangep);
-
- return rangep->cr_type;
-}
-
-/* This is a simpler exported interface for the benefit of gdb et al. */
-
-boolean
-sh64_address_is_shmedia (sec, addr)
- asection *sec;
- bfd_vma addr;
-{
- sh64_elf_crange dummy;
- return sh64_get_contents_type (sec, addr, &dummy) == CRT_SH5_ISA32;
-}
diff --git a/bfd/elf32-v850.c b/bfd/elf32-v850.c
index ae0a0c4e88b..553cb4e0153 100644
--- a/bfd/elf32-v850.c
+++ b/bfd/elf32-v850.c
@@ -1,5 +1,5 @@
/* V850-specific support for 32-bit ELF
- Copyright 1996, 1997, 1998, 1999, 2000, 2001
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -79,7 +79,7 @@ static boolean v850_elf_link_output_symbol_hook
PARAMS ((bfd *, struct bfd_link_info *, const char *,
Elf_Internal_Sym *, asection *));
static boolean v850_elf_section_from_shdr
- PARAMS ((bfd *, Elf_Internal_Shdr *, char *));
+ PARAMS ((bfd *, Elf_Internal_Shdr *, const char *));
static boolean v850_elf_gc_sweep_hook
PARAMS ((bfd *, struct bfd_link_info *, asection *,
const Elf_Internal_Rela *));
@@ -2135,7 +2135,7 @@ static boolean
v850_elf_section_from_shdr (abfd, hdr, name)
bfd * abfd;
Elf_Internal_Shdr * hdr;
- char * name;
+ const char * name;
{
/* There ought to be a place to keep ELF backend specific flags, but
at the moment there isn't one. We just keep track of the
diff --git a/bfd/elf32-vax.c b/bfd/elf32-vax.c
new file mode 100644
index 00000000000..8901188b7c6
--- /dev/null
+++ b/bfd/elf32-vax.c
@@ -0,0 +1,2214 @@
+/* VAX series support for 32-bit ELF
+ Copyright 1993, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
+ Free Software Foundation, Inc.
+ Contributed by Matt Thomas <matt@3am-software.com>.
+
+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 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 "bfd.h"
+#include "sysdep.h"
+#include "bfdlink.h"
+#include "libbfd.h"
+#include "elf-bfd.h"
+#include "elf/vax.h"
+
+static reloc_howto_type *reloc_type_lookup
+ PARAMS ((bfd *, bfd_reloc_code_real_type));
+static void rtype_to_howto
+ PARAMS ((bfd *, arelent *, Elf32_Internal_Rela *));
+static struct bfd_hash_entry *elf_vax_link_hash_newfunc
+ PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
+static struct bfd_link_hash_table *elf_vax_link_hash_table_create
+ PARAMS ((bfd *));
+static boolean elf_vax_check_relocs
+ PARAMS ((bfd *, struct bfd_link_info *, asection *,
+ const Elf_Internal_Rela *));
+static asection *elf_vax_gc_mark_hook
+ PARAMS ((bfd *, struct bfd_link_info *, Elf_Internal_Rela *,
+ struct elf_link_hash_entry *, Elf_Internal_Sym *));
+static boolean elf_vax_gc_sweep_hook
+ PARAMS ((bfd *, struct bfd_link_info *, asection *,
+ const Elf_Internal_Rela *));
+static boolean elf_vax_adjust_dynamic_symbol
+ PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
+static boolean elf_vax_size_dynamic_sections
+ PARAMS ((bfd *, struct bfd_link_info *));
+static boolean elf_vax_relocate_section
+ PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
+ Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
+static boolean elf_vax_finish_dynamic_symbol
+ PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *,
+ Elf_Internal_Sym *));
+static boolean elf_vax_finish_dynamic_sections
+ PARAMS ((bfd *, struct bfd_link_info *));
+
+static boolean elf32_vax_set_private_flags
+ PARAMS ((bfd *, flagword));
+static boolean elf32_vax_merge_private_bfd_data
+ PARAMS ((bfd *, bfd *));
+static boolean elf32_vax_print_private_bfd_data
+ PARAMS ((bfd *, PTR));
+
+static reloc_howto_type howto_table[] = {
+ HOWTO (R_VAX_NONE, /* type */
+ 0, /* rightshift */
+ 0, /* size (0 = byte, 1 = short, 2 = long) */
+ 0, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_VAX_NONE", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0x00000000, /* dst_mask */
+ false), /* pcrel_offset */
+
+ HOWTO (R_VAX_32, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_VAX_32", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ HOWTO (R_VAX_16, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_VAX_16", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ HOWTO (R_VAX_8, /* type */
+ 0, /* rightshift */
+ 0, /* size (0 = byte, 1 = short, 2 = long) */
+ 8, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_VAX_8", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0x000000ff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ HOWTO (R_VAX_PC32, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ true, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_VAX_PC32", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ true), /* pcrel_offset */
+
+ HOWTO (R_VAX_PC16, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ true, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_VAX_PC16", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ true), /* pcrel_offset */
+
+ HOWTO (R_VAX_PC8, /* type */
+ 0, /* rightshift */
+ 0, /* size (0 = byte, 1 = short, 2 = long) */
+ 8, /* bitsize */
+ true, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_VAX_PC8", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0x000000ff, /* dst_mask */
+ true), /* pcrel_offset */
+
+ HOWTO (R_VAX_GOT32, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ true, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_VAX_GOT32", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ true), /* pcrel_offset */
+
+ EMPTY_HOWTO (-1),
+ EMPTY_HOWTO (-1),
+ EMPTY_HOWTO (-1),
+ EMPTY_HOWTO (-1),
+ EMPTY_HOWTO (-1),
+
+ HOWTO (R_VAX_PLT32, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ true, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_VAX_PLT32", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ true), /* pcrel_offset */
+
+ EMPTY_HOWTO (-1),
+ EMPTY_HOWTO (-1),
+ EMPTY_HOWTO (-1),
+ EMPTY_HOWTO (-1),
+ EMPTY_HOWTO (-1),
+
+ HOWTO (R_VAX_COPY, /* type */
+ 0, /* rightshift */
+ 0, /* size (0 = byte, 1 = short, 2 = long) */
+ 0, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_VAX_COPY", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ HOWTO (R_VAX_GLOB_DAT, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_VAX_GLOB_DAT", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ HOWTO (R_VAX_JMP_SLOT, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_VAX_JMP_SLOT", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ HOWTO (R_VAX_RELATIVE, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_VAX_RELATIVE", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* GNU extension to record C++ vtable hierarchy */
+ HOWTO (R_VAX_GNU_VTINHERIT, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 0, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ NULL, /* special_function */
+ "R_VAX_GNU_VTINHERIT", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* GNU extension to record C++ vtable member usage */
+ HOWTO (R_VAX_GNU_VTENTRY, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 0, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ _bfd_elf_rel_vtable_reloc_fn, /* special_function */
+ "R_VAX_GNU_VTENTRY", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
+ false), /* pcrel_offset */
+};
+
+static void
+rtype_to_howto (abfd, cache_ptr, dst)
+ bfd *abfd ATTRIBUTE_UNUSED;
+ arelent *cache_ptr;
+ Elf_Internal_Rela *dst;
+{
+ BFD_ASSERT (ELF32_R_TYPE(dst->r_info) < (unsigned int) R_VAX_max);
+ cache_ptr->howto = &howto_table[ELF32_R_TYPE(dst->r_info)];
+}
+
+#define elf_info_to_howto rtype_to_howto
+
+static const struct
+{
+ bfd_reloc_code_real_type bfd_val;
+ int elf_val;
+} reloc_map[] = {
+ { BFD_RELOC_NONE, R_VAX_NONE },
+ { BFD_RELOC_32, R_VAX_32 },
+ { BFD_RELOC_16, R_VAX_16 },
+ { BFD_RELOC_8, R_VAX_8 },
+ { BFD_RELOC_32_PCREL, R_VAX_PC32 },
+ { BFD_RELOC_16_PCREL, R_VAX_PC16 },
+ { BFD_RELOC_8_PCREL, R_VAX_PC8 },
+ { BFD_RELOC_32_GOT_PCREL, R_VAX_GOT32 },
+ { BFD_RELOC_32_PLT_PCREL, R_VAX_PLT32 },
+ { BFD_RELOC_NONE, R_VAX_COPY },
+ { BFD_RELOC_VAX_GLOB_DAT, R_VAX_GLOB_DAT },
+ { BFD_RELOC_VAX_JMP_SLOT, R_VAX_JMP_SLOT },
+ { BFD_RELOC_VAX_RELATIVE, R_VAX_RELATIVE },
+ { BFD_RELOC_CTOR, R_VAX_32 },
+ { BFD_RELOC_VTABLE_INHERIT, R_VAX_GNU_VTINHERIT },
+ { BFD_RELOC_VTABLE_ENTRY, R_VAX_GNU_VTENTRY },
+};
+
+static reloc_howto_type *
+reloc_type_lookup (abfd, code)
+ bfd *abfd ATTRIBUTE_UNUSED;
+ bfd_reloc_code_real_type code;
+{
+ unsigned int i;
+ for (i = 0; i < sizeof (reloc_map) / sizeof (reloc_map[0]); i++)
+ {
+ if (reloc_map[i].bfd_val == code)
+ return &howto_table[reloc_map[i].elf_val];
+ }
+ return 0;
+}
+
+#define bfd_elf32_bfd_reloc_type_lookup reloc_type_lookup
+#define ELF_ARCH bfd_arch_vax
+/* end code generated by elf.el */
+
+#define USE_RELA
+
+/* Functions for the VAX ELF linker. */
+
+/* The name of the dynamic interpreter. This is put in the .interp
+ section. */
+
+#define ELF_DYNAMIC_INTERPRETER "/usr/libexec/ld.elf_so"
+
+/* The size in bytes of an entry in the procedure linkage table. */
+
+#define PLT_ENTRY_SIZE 12
+
+/* The first entry in a procedure linkage table looks like this. See
+ the SVR4 ABI VAX supplement to see how this works. */
+
+static const bfd_byte elf_vax_plt0_entry[PLT_ENTRY_SIZE] =
+{
+ 0xdd, 0xef, /* pushl l^ */
+ 0, 0, 0, 0, /* offset to .plt.got + 4 */
+ 0x17, 0xff, /* jmp @L^(pc) */
+ 0, 0, 0, 0, /* offset to .plt.got + 8 */
+};
+
+/* Subsequent entries in a procedure linkage table look like this. */
+
+static const bfd_byte elf_vax_plt_entry[PLT_ENTRY_SIZE] =
+{
+ 0x40, 0x00, /* .word ^M<r6> */
+ 0x16, 0xef, /* jsb L^(pc) */
+ 0, 0, 0, 0, /* replaced with offset to start of .plt */
+ 0, 0, 0, 0, /* index into .rela.plt */
+};
+
+/* The VAX linker needs to keep track of the number of relocs that it
+ decides to copy in check_relocs for each symbol. This is so that it
+ can discard PC relative relocs if it doesn't need them when linking
+ with -Bsymbolic. We store the information in a field extending the
+ regular ELF linker hash table. */
+
+/* This structure keeps track of the number of PC relative relocs we have
+ copied for a given symbol. */
+
+struct elf_vax_pcrel_relocs_copied
+{
+ /* Next section. */
+ struct elf_vax_pcrel_relocs_copied *next;
+ /* A section in dynobj. */
+ asection *section;
+ /* Number of relocs copied in this section. */
+ bfd_size_type count;
+};
+
+/* VAX ELF linker hash entry. */
+
+struct elf_vax_link_hash_entry
+{
+ struct elf_link_hash_entry root;
+
+ /* Number of PC relative relocs copied for this symbol. */
+ struct elf_vax_pcrel_relocs_copied *pcrel_relocs_copied;
+
+ bfd_vma got_addend;
+};
+
+/* VAX ELF linker hash table. */
+
+struct elf_vax_link_hash_table
+{
+ struct elf_link_hash_table root;
+};
+
+/* Declare this now that the above structures are defined. */
+
+static boolean elf_vax_discard_copies
+ PARAMS ((struct elf_vax_link_hash_entry *, PTR));
+
+/* Traverse an VAX ELF linker hash table. */
+
+#define elf_vax_link_hash_traverse(table, func, info) \
+ (elf_link_hash_traverse \
+ (&(table)->root, \
+ (boolean (*) PARAMS ((struct elf_link_hash_entry *, PTR))) (func), \
+ (info)))
+
+/* Get the VAX ELF linker hash table from a link_info structure. */
+
+#define elf_vax_hash_table(p) \
+ ((struct elf_vax_link_hash_table *) (p)->hash)
+
+/* Create an entry in an VAX ELF linker hash table. */
+
+static struct bfd_hash_entry *
+elf_vax_link_hash_newfunc (entry, table, string)
+ struct bfd_hash_entry *entry;
+ struct bfd_hash_table *table;
+ const char *string;
+{
+ struct elf_vax_link_hash_entry *ret =
+ (struct elf_vax_link_hash_entry *) entry;
+
+ /* Allocate the structure if it has not already been allocated by a
+ subclass. */
+ if (ret == (struct elf_vax_link_hash_entry *) NULL)
+ ret = ((struct elf_vax_link_hash_entry *)
+ bfd_hash_allocate (table,
+ sizeof (struct elf_vax_link_hash_entry)));
+ if (ret == (struct elf_vax_link_hash_entry *) NULL)
+ return (struct bfd_hash_entry *) ret;
+
+ /* Call the allocation method of the superclass. */
+ ret = ((struct elf_vax_link_hash_entry *)
+ _bfd_elf_link_hash_newfunc ((struct bfd_hash_entry *) ret,
+ table, string));
+ if (ret != (struct elf_vax_link_hash_entry *) NULL)
+ {
+ ret->pcrel_relocs_copied = NULL;
+ }
+
+ return (struct bfd_hash_entry *) ret;
+}
+
+/* Create an VAX ELF linker hash table. */
+
+static struct bfd_link_hash_table *
+elf_vax_link_hash_table_create (abfd)
+ bfd *abfd;
+{
+ struct elf_vax_link_hash_table *ret;
+ bfd_size_type amt = sizeof (struct elf_vax_link_hash_table);
+
+ ret = (struct elf_vax_link_hash_table *) bfd_malloc (amt);
+ if (ret == (struct elf_vax_link_hash_table *) NULL)
+ return NULL;
+
+ if (! _bfd_elf_link_hash_table_init (&ret->root, abfd,
+ elf_vax_link_hash_newfunc))
+ {
+ free (ret);
+ return NULL;
+ }
+
+ return &ret->root.root;
+}
+
+/* Keep vax-specific flags in the ELF header */
+static boolean
+elf32_vax_set_private_flags (abfd, flags)
+ bfd *abfd;
+ flagword flags;
+{
+ elf_elfheader (abfd)->e_flags = flags;
+ elf_flags_init (abfd) = true;
+ return true;
+}
+
+/* Merge backend specific data from an object file to the output
+ object file when linking. */
+static boolean
+elf32_vax_merge_private_bfd_data (ibfd, obfd)
+ bfd *ibfd;
+ bfd *obfd;
+{
+ flagword out_flags;
+ flagword in_flags;
+
+ if ( bfd_get_flavour (ibfd) != bfd_target_elf_flavour
+ || bfd_get_flavour (obfd) != bfd_target_elf_flavour)
+ return true;
+
+ in_flags = elf_elfheader (ibfd)->e_flags;
+ out_flags = elf_elfheader (obfd)->e_flags;
+
+ if (!elf_flags_init (obfd))
+ {
+ elf_flags_init (obfd) = true;
+ elf_elfheader (obfd)->e_flags = in_flags;
+ }
+
+ return true;
+}
+
+/* Display the flags field */
+static boolean
+elf32_vax_print_private_bfd_data (abfd, ptr)
+ bfd *abfd;
+ PTR ptr;
+{
+ FILE *file = (FILE *) ptr;
+
+ BFD_ASSERT (abfd != NULL && ptr != NULL);
+
+ /* Print normal ELF private data. */
+ _bfd_elf_print_private_bfd_data (abfd, ptr);
+
+ /* Ignore init flag - it may not be set, despite the flags field containing valid data. */
+
+ /* xgettext:c-format */
+ fprintf (file, _("private flags = %lx:"), elf_elfheader (abfd)->e_flags);
+
+ if (elf_elfheader (abfd)->e_flags & EF_NONPIC)
+ fprintf (file, _(" [nonpic]"));
+
+ if (elf_elfheader (abfd)->e_flags & EF_DFLOAT)
+ fprintf (file, _(" [d-float]"));
+
+ if (elf_elfheader (abfd)->e_flags & EF_GFLOAT)
+ fprintf (file, _(" [g-float]"));
+
+ fputc ('\n', file);
+
+ return true;
+}
+/* Look through the relocs for a section during the first phase, and
+ allocate space in the global offset table or procedure linkage
+ table. */
+
+static boolean
+elf_vax_check_relocs (abfd, info, sec, relocs)
+ bfd *abfd;
+ struct bfd_link_info *info;
+ asection *sec;
+ const Elf_Internal_Rela *relocs;
+{
+ bfd *dynobj;
+ Elf_Internal_Shdr *symtab_hdr;
+ struct elf_link_hash_entry **sym_hashes;
+ bfd_signed_vma *local_got_refcounts;
+ const Elf_Internal_Rela *rel;
+ const Elf_Internal_Rela *rel_end;
+ asection *sgot;
+ asection *srelgot;
+ asection *sreloc;
+
+ if (info->relocateable)
+ return true;
+
+ dynobj = elf_hash_table (info)->dynobj;
+ symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
+ sym_hashes = elf_sym_hashes (abfd);
+ local_got_refcounts = elf_local_got_refcounts (abfd);
+
+ sgot = NULL;
+ srelgot = NULL;
+ sreloc = NULL;
+
+ rel_end = relocs + sec->reloc_count;
+ for (rel = relocs; rel < rel_end; rel++)
+ {
+ unsigned long r_symndx;
+ struct elf_link_hash_entry *h;
+
+ r_symndx = ELF32_R_SYM (rel->r_info);
+
+ if (r_symndx < symtab_hdr->sh_info)
+ h = NULL;
+ else
+ h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+
+ switch (ELF32_R_TYPE (rel->r_info))
+ {
+ case R_VAX_GOT32:
+ if (h != NULL
+ && strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)
+ break;
+
+ /* This symbol requires a global offset table entry. */
+
+ if (dynobj == NULL)
+ {
+ /* Create the .got section. */
+ elf_hash_table (info)->dynobj = dynobj = abfd;
+ if (!_bfd_elf_create_got_section (dynobj, info))
+ return false;
+ }
+
+ if (sgot == NULL)
+ {
+ sgot = bfd_get_section_by_name (dynobj, ".got");
+ BFD_ASSERT (sgot != NULL);
+ }
+
+ if (srelgot == NULL
+ && (h != NULL || info->shared))
+ {
+ srelgot = bfd_get_section_by_name (dynobj, ".rela.got");
+ if (srelgot == NULL)
+ {
+ srelgot = bfd_make_section (dynobj, ".rela.got");
+ if (srelgot == NULL
+ || !bfd_set_section_flags (dynobj, srelgot,
+ (SEC_ALLOC
+ | SEC_LOAD
+ | SEC_HAS_CONTENTS
+ | SEC_IN_MEMORY
+ | SEC_LINKER_CREATED
+ | SEC_READONLY))
+ || !bfd_set_section_alignment (dynobj, srelgot, 2))
+ return false;
+ }
+ }
+
+ if (h != NULL)
+ {
+ struct elf_vax_link_hash_entry *eh;
+
+ eh = (struct elf_vax_link_hash_entry *) h;
+ if (h->got.refcount == -1)
+ {
+ h->got.refcount = 1;
+ eh->got_addend = rel->r_addend;
+
+ /* Make sure this symbol is output as a dynamic symbol. */
+ if (h->dynindx == -1)
+ {
+ if (!bfd_elf32_link_record_dynamic_symbol (info, h))
+ return false;
+ }
+
+ /* Allocate space in the .got section. */
+ sgot->_raw_size += 4;
+ /* Allocate relocation space. */
+ srelgot->_raw_size += sizeof (Elf32_External_Rela);
+ }
+ else
+ {
+ h->got.refcount++;
+ if (eh->got_addend != (bfd_vma) rel->r_addend)
+ (*_bfd_error_handler)
+ (_("%s: warning: GOT addend of %ld to `%s' does not match previous GOT addend of %ld"),
+ bfd_get_filename (abfd), rel->r_addend,
+ h->root.root.string,
+ eh->got_addend);
+
+ }
+ }
+ break;
+
+ case R_VAX_PLT32:
+ /* This symbol requires a procedure linkage table entry. We
+ actually build the entry in adjust_dynamic_symbol,
+ because this might be a case of linking PIC code which is
+ never referenced by a dynamic object, in which case we
+ don't need to generate a procedure linkage table entry
+ after all. */
+
+ /* If this is a local symbol, we resolve it directly without
+ creating a procedure linkage table entry. */
+ if (h == NULL)
+ continue;
+
+ h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
+ if (h->plt.refcount == -1)
+ h->plt.refcount = 1;
+ else
+ h->plt.refcount++;
+ break;
+
+ case R_VAX_PC8:
+ case R_VAX_PC16:
+ case R_VAX_PC32:
+ /* If we are creating a shared library and this is not a local
+ symbol, we need to copy the reloc into the shared library.
+ However when linking with -Bsymbolic and this is a global
+ symbol which is defined in an object we are including in the
+ link (i.e., DEF_REGULAR is set), then we can resolve the
+ reloc directly. At this point we have not seen all the input
+ files, so it is possible that DEF_REGULAR is not set now but
+ will be set later (it is never cleared). We account for that
+ possibility below by storing information in the
+ pcrel_relocs_copied field of the hash table entry. */
+ if (!(info->shared
+ && (sec->flags & SEC_ALLOC) != 0
+ && h != NULL
+ && (!info->symbolic
+ || (h->elf_link_hash_flags
+ & ELF_LINK_HASH_DEF_REGULAR) == 0)))
+ {
+ if (h != NULL)
+ {
+ /* Make sure a plt entry is created for this symbol if
+ it turns out to be a function defined by a dynamic
+ object. */
+ if (h->plt.refcount == -1)
+ h->plt.refcount = 1;
+ else
+ h->plt.refcount++;
+ }
+ break;
+ }
+ /* Fall through. */
+ case R_VAX_8:
+ case R_VAX_16:
+ case R_VAX_32:
+ if (h != NULL)
+ {
+ /* Make sure a plt entry is created for this symbol if it
+ turns out to be a function defined by a dynamic object. */
+ if (h->plt.refcount == -1)
+ h->plt.refcount = 1;
+ else
+ h->plt.refcount++;
+ }
+
+ /* If we are creating a shared library, we need to copy the
+ reloc into the shared library. */
+ if (info->shared
+ && (sec->flags & SEC_ALLOC) != 0)
+ {
+ /* When creating a shared object, we must copy these
+ reloc types into the output file. We create a reloc
+ section in dynobj and make room for this reloc. */
+ if (sreloc == NULL)
+ {
+ const char *name;
+
+ name = (bfd_elf_string_from_elf_section
+ (abfd,
+ elf_elfheader (abfd)->e_shstrndx,
+ elf_section_data (sec)->rel_hdr.sh_name));
+ if (name == NULL)
+ return false;
+
+ BFD_ASSERT (strncmp (name, ".rela", 5) == 0
+ && strcmp (bfd_get_section_name (abfd, sec),
+ name + 5) == 0);
+
+ sreloc = bfd_get_section_by_name (dynobj, name);
+ if (sreloc == NULL)
+ {
+ sreloc = bfd_make_section (dynobj, name);
+ if (sreloc == NULL
+ || !bfd_set_section_flags (dynobj, sreloc,
+ (SEC_ALLOC
+ | SEC_LOAD
+ | SEC_HAS_CONTENTS
+ | SEC_IN_MEMORY
+ | SEC_LINKER_CREATED
+ | SEC_READONLY))
+ || !bfd_set_section_alignment (dynobj, sreloc, 2))
+ return false;
+ }
+ if (sec->flags & SEC_READONLY)
+ info->flags |= DF_TEXTREL;
+ }
+
+ sreloc->_raw_size += sizeof (Elf32_External_Rela);
+
+ /* If we are linking with -Bsymbolic, we count the number of
+ PC relative relocations we have entered for this symbol,
+ so that we can discard them again if the symbol is later
+ defined by a regular object. Note that this function is
+ only called if we are using an vaxelf linker hash table,
+ which means that h is really a pointer to an
+ elf_vax_link_hash_entry. */
+ if ((ELF32_R_TYPE (rel->r_info) == R_VAX_PC8
+ || ELF32_R_TYPE (rel->r_info) == R_VAX_PC16
+ || ELF32_R_TYPE (rel->r_info) == R_VAX_PC32)
+ && info->symbolic)
+ {
+ struct elf_vax_link_hash_entry *eh;
+ struct elf_vax_pcrel_relocs_copied *p;
+
+ eh = (struct elf_vax_link_hash_entry *) h;
+
+ for (p = eh->pcrel_relocs_copied; p != NULL; p = p->next)
+ if (p->section == sreloc)
+ break;
+
+ if (p == NULL)
+ {
+ p = ((struct elf_vax_pcrel_relocs_copied *)
+ bfd_alloc (dynobj, (bfd_size_type) sizeof *p));
+ if (p == NULL)
+ return false;
+ p->next = eh->pcrel_relocs_copied;
+ eh->pcrel_relocs_copied = p;
+ p->section = sreloc;
+ p->count = 0;
+ }
+
+ ++p->count;
+ }
+ }
+
+ break;
+
+ /* This relocation describes the C++ object vtable hierarchy.
+ Reconstruct it for later use during GC. */
+ case R_VAX_GNU_VTINHERIT:
+ if (!_bfd_elf32_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
+ return false;
+ break;
+
+ /* This relocation describes which C++ vtable entries are actually
+ used. Record for later use during GC. */
+ case R_VAX_GNU_VTENTRY:
+ if (!_bfd_elf32_gc_record_vtentry (abfd, sec, h, rel->r_addend))
+ return false;
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ return true;
+}
+
+/* Return the section that should be marked against GC for a given
+ relocation. */
+
+static asection *
+elf_vax_gc_mark_hook (abfd, info, rel, h, sym)
+ bfd *abfd;
+ struct bfd_link_info *info ATTRIBUTE_UNUSED;
+ Elf_Internal_Rela *rel;
+ struct elf_link_hash_entry *h;
+ Elf_Internal_Sym *sym;
+{
+ if (h != NULL)
+ {
+ switch (ELF32_R_TYPE (rel->r_info))
+ {
+ case R_VAX_GNU_VTINHERIT:
+ case R_VAX_GNU_VTENTRY:
+ break;
+
+ default:
+ switch (h->root.type)
+ {
+ default:
+ break;
+
+ case bfd_link_hash_defined:
+ case bfd_link_hash_defweak:
+ return h->root.u.def.section;
+
+ case bfd_link_hash_common:
+ return h->root.u.c.p->section;
+ }
+ }
+ }
+ else
+ {
+ return bfd_section_from_elf_index (abfd, sym->st_shndx);
+ }
+
+ return NULL;
+}
+
+/* Update the got entry reference counts for the section being removed. */
+
+static boolean
+elf_vax_gc_sweep_hook (abfd, info, sec, relocs)
+ bfd *abfd;
+ struct bfd_link_info *info;
+ asection *sec;
+ const Elf_Internal_Rela *relocs;
+{
+ Elf_Internal_Shdr *symtab_hdr;
+ struct elf_link_hash_entry **sym_hashes;
+ bfd_signed_vma *local_got_refcounts;
+ const Elf_Internal_Rela *rel, *relend;
+ unsigned long r_symndx;
+ struct elf_link_hash_entry *h;
+ bfd *dynobj;
+ asection *sgot;
+ asection *srelgot;
+
+ symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
+ sym_hashes = elf_sym_hashes (abfd);
+ local_got_refcounts = elf_local_got_refcounts (abfd);
+
+ dynobj = elf_hash_table (info)->dynobj;
+ if (dynobj == NULL)
+ return true;
+
+ sgot = bfd_get_section_by_name (dynobj, ".got");
+ srelgot = bfd_get_section_by_name (dynobj, ".rela.got");
+
+ relend = relocs + sec->reloc_count;
+ for (rel = relocs; rel < relend; rel++)
+ {
+ switch (ELF32_R_TYPE (rel->r_info))
+ {
+ case R_VAX_GOT32:
+ r_symndx = ELF32_R_SYM (rel->r_info);
+ if (r_symndx >= symtab_hdr->sh_info)
+ {
+ h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+ if (h->got.refcount > 0)
+ {
+ --h->got.refcount;
+ if (h->got.refcount == 0)
+ {
+ /* We don't need the .got entry any more. */
+ sgot->_raw_size -= 4;
+ srelgot->_raw_size -= sizeof (Elf32_External_Rela);
+ }
+ }
+ }
+ else if (local_got_refcounts != NULL)
+ {
+ if (local_got_refcounts[r_symndx] > 0)
+ {
+ --local_got_refcounts[r_symndx];
+ if (local_got_refcounts[r_symndx] == 0)
+ {
+ /* We don't need the .got entry any more. */
+ sgot->_raw_size -= 4;
+ if (info->shared)
+ srelgot->_raw_size -= sizeof (Elf32_External_Rela);
+ }
+ }
+ }
+ break;
+
+ case R_VAX_PLT32:
+ case R_VAX_PC8:
+ case R_VAX_PC16:
+ case R_VAX_PC32:
+ case R_VAX_8:
+ case R_VAX_16:
+ case R_VAX_32:
+ r_symndx = ELF32_R_SYM (rel->r_info);
+ if (r_symndx >= symtab_hdr->sh_info)
+ {
+ h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+ if (h->plt.refcount > 0)
+ --h->plt.refcount;
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ return true;
+}
+
+/* Adjust a symbol defined by a dynamic object and referenced by a
+ regular object. The current definition is in some section of the
+ dynamic object, but we're not including those sections. We have to
+ change the definition to something the rest of the link can
+ understand. */
+
+static boolean
+elf_vax_adjust_dynamic_symbol (info, h)
+ struct bfd_link_info *info;
+ struct elf_link_hash_entry *h;
+{
+ bfd *dynobj;
+ asection *s;
+ unsigned int power_of_two;
+
+ dynobj = elf_hash_table (info)->dynobj;
+
+ /* Make sure we know what is going on here. */
+ BFD_ASSERT (dynobj != NULL
+ && ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT)
+ || h->weakdef != NULL
+ || ((h->elf_link_hash_flags
+ & ELF_LINK_HASH_DEF_DYNAMIC) != 0
+ && (h->elf_link_hash_flags
+ & ELF_LINK_HASH_REF_REGULAR) != 0
+ && (h->elf_link_hash_flags
+ & ELF_LINK_HASH_DEF_REGULAR) == 0)));
+
+ /* If this is a function, put it in the procedure linkage table. We
+ will fill in the contents of the procedure linkage table later,
+ when we know the address of the .got section. */
+ if (h->type == STT_FUNC
+ || (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0)
+ {
+ if (! info->shared
+ && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0
+ && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) == 0
+ /* We must always create the plt entry if it was referenced
+ by a PLTxxO relocation. In this case we already recorded
+ it as a dynamic symbol. */
+ && h->dynindx == -1)
+ {
+ /* This case can occur if we saw a PLTxx reloc in an input
+ file, but the symbol was never referred to by a dynamic
+ object. In such a case, we don't actually need to build
+ a procedure linkage table, and we can just do a PCxx
+ reloc instead. */
+ BFD_ASSERT ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0);
+ h->plt.offset = (bfd_vma) -1;
+ return true;
+ }
+
+ /* GC may have rendered this entry unused. */
+ if (h->plt.refcount <= 0)
+ {
+ h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
+ h->plt.offset = (bfd_vma) -1;
+ return true;
+ }
+
+ /* Make sure this symbol is output as a dynamic symbol. */
+ if (h->dynindx == -1)
+ {
+ if (! bfd_elf32_link_record_dynamic_symbol (info, h))
+ return false;
+ }
+
+ s = bfd_get_section_by_name (dynobj, ".plt");
+ BFD_ASSERT (s != NULL);
+
+ /* If this is the first .plt entry, make room for the special
+ first entry. */
+ if (s->_raw_size == 0)
+ {
+ s->_raw_size += PLT_ENTRY_SIZE;
+ }
+
+ /* If this symbol is not defined in a regular file, and we are
+ not generating a shared library, then set the symbol to this
+ location in the .plt. This is required to make function
+ pointers compare as equal between the normal executable and
+ the shared library. */
+ if (!info->shared
+ && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
+ {
+ h->root.u.def.section = s;
+ h->root.u.def.value = s->_raw_size;
+ }
+
+ h->plt.offset = s->_raw_size;
+
+ /* Make room for this entry. */
+ s->_raw_size += PLT_ENTRY_SIZE;
+
+ /* We also need to make an entry in the .got.plt section, which
+ will be placed in the .got section by the linker script. */
+
+ s = bfd_get_section_by_name (dynobj, ".got.plt");
+ BFD_ASSERT (s != NULL);
+ s->_raw_size += 4;
+
+ /* We also need to make an entry in the .rela.plt section. */
+
+ s = bfd_get_section_by_name (dynobj, ".rela.plt");
+ BFD_ASSERT (s != NULL);
+ s->_raw_size += sizeof (Elf32_External_Rela);
+
+ return true;
+ }
+
+ /* Reinitialize the plt offset now that it is not used as a reference
+ count any more. */
+ h->plt.offset = (bfd_vma) -1;
+
+ /* If this is a weak symbol, and there is a real definition, the
+ processor independent code will have arranged for us to see the
+ real definition first, and we can just use the same value. */
+ if (h->weakdef != NULL)
+ {
+ BFD_ASSERT (h->weakdef->root.type == bfd_link_hash_defined
+ || h->weakdef->root.type == bfd_link_hash_defweak);
+ h->root.u.def.section = h->weakdef->root.u.def.section;
+ h->root.u.def.value = h->weakdef->root.u.def.value;
+ return true;
+ }
+
+ /* This is a reference to a symbol defined by a dynamic object which
+ is not a function. */
+
+ /* If we are creating a shared library, we must presume that the
+ only references to the symbol are via the global offset table.
+ For such cases we need not do anything here; the relocations will
+ be handled correctly by relocate_section. */
+ if (info->shared)
+ return true;
+
+ /* We must allocate the symbol in our .dynbss section, which will
+ become part of the .bss section of the executable. There will be
+ an entry for this symbol in the .dynsym section. The dynamic
+ object will contain position independent code, so all references
+ from the dynamic object to this symbol will go through the global
+ offset table. The dynamic linker will use the .dynsym entry to
+ determine the address it must put in the global offset table, so
+ both the dynamic object and the regular object will refer to the
+ same memory location for the variable. */
+
+ s = bfd_get_section_by_name (dynobj, ".dynbss");
+ BFD_ASSERT (s != NULL);
+
+ /* We must generate a R_VAX_COPY reloc to tell the dynamic linker to
+ copy the initial value out of the dynamic object and into the
+ runtime process image. We need to remember the offset into the
+ .rela.bss section we are going to use. */
+ if ((h->root.u.def.section->flags & SEC_ALLOC) != 0)
+ {
+ asection *srel;
+
+ srel = bfd_get_section_by_name (dynobj, ".rela.bss");
+ BFD_ASSERT (srel != NULL);
+ srel->_raw_size += sizeof (Elf32_External_Rela);
+ h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_COPY;
+ }
+
+ /* We need to figure out the alignment required for this symbol. I
+ have no idea how ELF linkers handle this. */
+ power_of_two = bfd_log2 (h->size);
+ if (power_of_two > 3)
+ power_of_two = 3;
+
+ /* Apply the required alignment. */
+ s->_raw_size = BFD_ALIGN (s->_raw_size,
+ (bfd_size_type) (1 << power_of_two));
+ if (power_of_two > bfd_get_section_alignment (dynobj, s))
+ {
+ if (!bfd_set_section_alignment (dynobj, s, power_of_two))
+ return false;
+ }
+
+ /* Define the symbol as being at this point in the section. */
+ h->root.u.def.section = s;
+ h->root.u.def.value = s->_raw_size;
+
+ /* Increment the section size to make room for the symbol. */
+ s->_raw_size += h->size;
+
+ return true;
+}
+
+/* Set the sizes of the dynamic sections. */
+
+static boolean
+elf_vax_size_dynamic_sections (output_bfd, info)
+ bfd *output_bfd;
+ struct bfd_link_info *info;
+{
+ bfd *dynobj;
+ asection *s;
+ boolean plt;
+ boolean relocs;
+ boolean reltext;
+
+ dynobj = elf_hash_table (info)->dynobj;
+ BFD_ASSERT (dynobj != NULL);
+
+ if (elf_hash_table (info)->dynamic_sections_created)
+ {
+ /* Set the contents of the .interp section to the interpreter. */
+ if (!info->shared)
+ {
+ s = bfd_get_section_by_name (dynobj, ".interp");
+ BFD_ASSERT (s != NULL);
+ s->_raw_size = sizeof ELF_DYNAMIC_INTERPRETER;
+ s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER;
+ }
+ }
+ else
+ {
+ /* We may have created entries in the .rela.got and .got sections.
+ However, if we are not creating the dynamic sections, we will
+ not actually use these entries. Reset the size of .rela.got
+ and .got, which will cause it to get stripped from the output
+ file below. */
+ s = bfd_get_section_by_name (dynobj, ".rela.got");
+ if (s != NULL)
+ s->_raw_size = 0;
+ s = bfd_get_section_by_name (dynobj, ".got.plt");
+ if (s != NULL)
+ s->_raw_size = 0;
+ s = bfd_get_section_by_name (dynobj, ".got");
+ if (s != NULL)
+ s->_raw_size = 0;
+ }
+
+ /* If this is a -Bsymbolic shared link, then we need to discard all PC
+ relative relocs against symbols defined in a regular object. We
+ allocated space for them in the check_relocs routine, but we will not
+ fill them in in the relocate_section routine. */
+ if (info->shared && info->symbolic)
+ elf_vax_link_hash_traverse (elf_vax_hash_table (info),
+ elf_vax_discard_copies,
+ (PTR) NULL);
+
+ /* The check_relocs and adjust_dynamic_symbol entry points have
+ determined the sizes of the various dynamic sections. Allocate
+ memory for them. */
+ plt = false;
+ relocs = false;
+ reltext = false;
+ for (s = dynobj->sections; s != NULL; s = s->next)
+ {
+ const char *name;
+ boolean strip;
+
+ if ((s->flags & SEC_LINKER_CREATED) == 0)
+ continue;
+
+ /* It's OK to base decisions on the section name, because none
+ of the dynobj section names depend upon the input files. */
+ name = bfd_get_section_name (dynobj, s);
+
+ strip = false;
+
+ if (strcmp (name, ".plt") == 0)
+ {
+ if (s->_raw_size == 0)
+ {
+ /* Strip this section if we don't need it; see the
+ comment below. */
+ strip = true;
+ }
+ else
+ {
+ /* Remember whether there is a PLT. */
+ plt = true;
+ }
+ }
+ else if (strncmp (name, ".rela", 5) == 0)
+ {
+ if (s->_raw_size == 0)
+ {
+ /* If we don't need this section, strip it from the
+ output file. This is mostly to handle .rela.bss and
+ .rela.plt. We must create both sections in
+ create_dynamic_sections, because they must be created
+ before the linker maps input sections to output
+ sections. The linker does that before
+ adjust_dynamic_symbol is called, and it is that
+ function which decides whether anything needs to go
+ into these sections. */
+ strip = true;
+ }
+ else
+ {
+ asection *target;
+
+ /* Remember whether there are any reloc sections other
+ than .rela.plt. */
+ if (strcmp (name, ".rela.plt") != 0)
+ {
+ const char *outname;
+
+ relocs = true;
+
+ /* If this relocation section applies to a read only
+ section, then we probably need a DT_TEXTREL
+ entry. .rela.plt is actually associated with
+ .got.plt, which is never readonly. */
+ outname = bfd_get_section_name (output_bfd,
+ s->output_section);
+ target = bfd_get_section_by_name (output_bfd, outname + 5);
+ if (target != NULL
+ && (target->flags & SEC_READONLY) != 0
+ && (target->flags & SEC_ALLOC) != 0)
+ reltext = true;
+ }
+
+ /* We use the reloc_count field as a counter if we need
+ to copy relocs into the output file. */
+ s->reloc_count = 0;
+ }
+ }
+ else if (strncmp (name, ".got", 4) != 0)
+ {
+ /* It's not one of our sections, so don't allocate space. */
+ continue;
+ }
+
+ if (strip)
+ {
+ _bfd_strip_section_from_output (info, s);
+ continue;
+ }
+
+ /* Allocate memory for the section contents. */
+ s->contents = (bfd_byte *) bfd_alloc (dynobj, s->_raw_size);
+ if (s->contents == NULL && s->_raw_size != 0)
+ return false;
+ }
+
+ if (elf_hash_table (info)->dynamic_sections_created)
+ {
+ /* Add some entries to the .dynamic section. We fill in the
+ values later, in elf_vax_finish_dynamic_sections, but we
+ must add the entries now so that we get the correct size for
+ the .dynamic section. The DT_DEBUG entry is filled in by the
+ dynamic linker and used by the debugger. */
+#define add_dynamic_entry(TAG, VAL) \
+ bfd_elf32_add_dynamic_entry (info, (bfd_vma) (TAG), (bfd_vma) (VAL))
+
+ if (!info->shared)
+ {
+ if (!add_dynamic_entry (DT_DEBUG, 0))
+ return false;
+ }
+
+ if (plt)
+ {
+ if (!add_dynamic_entry (DT_PLTGOT, 0)
+ || !add_dynamic_entry (DT_PLTRELSZ, 0)
+ || !add_dynamic_entry (DT_PLTREL, DT_RELA)
+ || !add_dynamic_entry (DT_JMPREL, 0))
+ return false;
+ }
+
+ if (relocs)
+ {
+ if (!add_dynamic_entry (DT_RELA, 0)
+ || !add_dynamic_entry (DT_RELASZ, 0)
+ || !add_dynamic_entry (DT_RELAENT, sizeof (Elf32_External_Rela)))
+ return false;
+ }
+
+ if (reltext || (info->flags & DF_TEXTREL) != 0)
+ {
+ if (!add_dynamic_entry (DT_TEXTREL, 0))
+ return false;
+ }
+ }
+#undef add_dynamic_entry
+
+ return true;
+}
+
+/* This function is called via elf_vax_link_hash_traverse if we are
+ creating a shared object with -Bsymbolic. It discards the space
+ allocated to copy PC relative relocs against symbols which are defined
+ 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 boolean
+elf_vax_discard_copies (h, ignore)
+ struct elf_vax_link_hash_entry *h;
+ PTR ignore ATTRIBUTE_UNUSED;
+{
+ struct elf_vax_pcrel_relocs_copied *s;
+
+ if (h->root.root.type == bfd_link_hash_warning)
+ h = (struct elf_vax_link_hash_entry *) h->root.root.u.i.link;
+
+ /* We only discard relocs for symbols defined in a regular object. */
+ if ((h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
+ return true;
+
+ for (s = h->pcrel_relocs_copied; s != NULL; s = s->next)
+ s->section->_raw_size -= s->count * sizeof (Elf32_External_Rela);
+
+ return true;
+}
+
+/* Relocate an VAX ELF section. */
+
+static boolean
+elf_vax_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 *dynobj;
+ Elf_Internal_Shdr *symtab_hdr;
+ struct elf_link_hash_entry **sym_hashes;
+ bfd_vma *local_got_offsets;
+ bfd_vma plt_index;
+ bfd_vma got_offset;
+ asection *sgot;
+ asection *splt;
+ asection *sgotplt;
+ asection *sreloc;
+ Elf_Internal_Rela *rel;
+ Elf_Internal_Rela *relend;
+
+ dynobj = elf_hash_table (info)->dynobj;
+ symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
+ sym_hashes = elf_sym_hashes (input_bfd);
+ local_got_offsets = elf_local_got_offsets (input_bfd);
+
+ sgot = NULL;
+ splt = NULL;
+ sgotplt = NULL;
+ sreloc = NULL;
+
+ rel = relocs;
+ relend = relocs + input_section->reloc_count;
+ for (; rel < relend; rel++)
+ {
+ int r_type;
+ reloc_howto_type *howto;
+ unsigned long r_symndx;
+ struct elf_link_hash_entry *h;
+ Elf_Internal_Sym *sym;
+ asection *sec;
+ bfd_vma relocation;
+ bfd_reloc_status_type r;
+
+ r_type = ELF32_R_TYPE (rel->r_info);
+ if (r_type < 0 || r_type >= (int) R_VAX_max)
+ {
+ bfd_set_error (bfd_error_bad_value);
+ return false;
+ }
+ howto = howto_table + r_type;
+
+ r_symndx = ELF32_R_SYM (rel->r_info);
+
+ if (info->relocateable)
+ {
+ /* This is a relocateable link. We don't have to change
+ anything, unless the reloc is against a section symbol,
+ in which case we have to adjust according to where the
+ section symbol winds up in the output section. */
+ if (r_symndx < symtab_hdr->sh_info)
+ {
+ sym = local_syms + r_symndx;
+ if (ELF_ST_TYPE (sym->st_info) == STT_SECTION)
+ {
+ sec = local_sections[r_symndx];
+ rel->r_addend += sec->output_offset + sym->st_value;
+ }
+ }
+
+ continue;
+ }
+
+ /* This is a final link. */
+ h = NULL;
+ sym = NULL;
+ sec = NULL;
+ if (r_symndx < symtab_hdr->sh_info)
+ {
+ sym = local_syms + r_symndx;
+ sec = local_sections[r_symndx];
+ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
+ }
+ else
+ {
+ h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+ while (h->root.type == bfd_link_hash_indirect
+ || h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+ if (h->root.type == bfd_link_hash_defined
+ || h->root.type == bfd_link_hash_defweak)
+ {
+ sec = h->root.u.def.section;
+ if ((r_type == R_VAX_PLT32
+ && h->plt.offset != (bfd_vma) -1
+ && elf_hash_table (info)->dynamic_sections_created)
+ || (r_type == R_VAX_GOT32
+ && strcmp (h->root.root.string,
+ "_GLOBAL_OFFSET_TABLE_") != 0
+ && elf_hash_table (info)->dynamic_sections_created
+ && (! info->shared
+ || (! info->symbolic && h->dynindx != -1)
+ || (h->elf_link_hash_flags
+ & ELF_LINK_HASH_DEF_REGULAR) == 0))
+ || (info->shared
+ && ((! info->symbolic && h->dynindx != -1)
+ || (h->elf_link_hash_flags
+ & ELF_LINK_HASH_DEF_REGULAR) == 0)
+ && ((input_section->flags & SEC_ALLOC) != 0
+ /* DWARF will emit R_VAX_32 relocations in its
+ sections against symbols defined externally
+ in shared libraries. We can't do anything
+ with them here. */
+
+ || ((input_section->flags & SEC_DEBUGGING) != 0
+ && (h->elf_link_hash_flags
+ & ELF_LINK_HASH_DEF_DYNAMIC) != 0))
+ && (r_type == R_VAX_8
+ || r_type == R_VAX_16
+ || r_type == R_VAX_32
+ || r_type == R_VAX_PC8
+ || r_type == R_VAX_PC16
+ || r_type == R_VAX_PC32)))
+ {
+ /* In these cases, we don't need the relocation
+ value. We check specially because in some
+ obscure cases sec->output_section will be NULL. */
+ relocation = 0;
+ }
+ else
+ relocation = (h->root.u.def.value
+ + sec->output_section->vma
+ + sec->output_offset);
+ }
+ else if (h->root.type == bfd_link_hash_undefweak)
+ relocation = 0;
+ else if (info->shared
+ && (!info->symbolic || info->allow_shlib_undefined)
+ && !info->no_undefined
+ && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
+ relocation = 0;
+ else
+ {
+ if (!(info->callbacks->undefined_symbol
+ (info, h->root.root.string, input_bfd,
+ input_section, rel->r_offset,
+ (!info->shared || info->no_undefined
+ || ELF_ST_VISIBILITY (h->other)))))
+ return false;
+ relocation = 0;
+ }
+ }
+
+ switch (r_type)
+ {
+ case R_VAX_GOT32:
+ /* Relocation is to the address of the entry for this symbol
+ in the global offset table. */
+ if (h != NULL
+ && strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)
+ break;
+
+ /* Relocation is the offset of the entry for this symbol in
+ the global offset table. */
+
+ {
+ bfd_vma off;
+
+ if (!elf_hash_table (info)->dynamic_sections_created
+ || (h == NULL)
+ || (info->shared
+ && info->symbolic
+ && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)))
+ {
+ /* This is actually a static link, or it is a -Bsymbolic link
+ and the symbol is defined locally or there is no symbol.
+ Change the GOT32 entry to a PC32 entry. */
+ break;
+ }
+
+ if (sgot == NULL)
+ {
+ sgot = bfd_get_section_by_name (dynobj, ".got");
+ BFD_ASSERT (sgot != NULL);
+ }
+
+ BFD_ASSERT (h != NULL);
+ off = h->got.offset;
+ BFD_ASSERT (off != (bfd_vma) -1);
+
+ if (info->shared
+ && h->dynindx == -1
+ && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))
+ {
+ /* The symbol was forced to be local
+ because of a version file.. We must initialize
+ this entry in the global offset table. Since
+ the offset must always be a multiple of 4, we
+ use the least significant bit to record whether
+ we have initialized it already.
+
+ When doing a dynamic link, we create a .rela.got
+ relocation entry to initialize the value. This
+ is done in the finish_dynamic_symbol routine. */
+ if ((off & 1) != 0)
+ off &= ~1;
+ else
+ {
+ bfd_put_32 (output_bfd, relocation + rel->r_addend,
+ sgot->contents + off);
+ h->got.offset |= 1;
+ }
+ } else {
+ bfd_put_32 (output_bfd, rel->r_addend, sgot->contents + off);
+ }
+
+ relocation = sgot->output_offset + off;
+ /* Neither GOT relocation uses the addend. */
+ rel->r_addend = 0;
+
+ if (r_type == R_VAX_GOT32)
+ {
+ /* Change the reference to be indirect */
+ contents[rel->r_offset - 1] |= 0x10;
+ relocation += sgot->output_section->vma;
+ }
+ }
+ break;
+
+ case R_VAX_PLT32:
+ /* Relocation is to the entry for this symbol in the
+ procedure linkage table. */
+
+ /* Resolve a PLTxx reloc against a local symbol directly,
+ without using the procedure linkage table. */
+ if (h == NULL)
+ break;
+
+ if (h->plt.offset == (bfd_vma) -1
+ || !elf_hash_table (info)->dynamic_sections_created)
+ {
+ /* We didn't make a PLT entry for this symbol. This
+ happens when statically linking PIC code, or when
+ using -Bsymbolic. */
+ break;
+ }
+
+ if (splt == NULL)
+ {
+ splt = bfd_get_section_by_name (dynobj, ".plt");
+ BFD_ASSERT (splt != NULL);
+ }
+
+ if (sgotplt == NULL)
+ {
+ sgotplt = bfd_get_section_by_name (dynobj, ".got.plt");
+ BFD_ASSERT (splt != NULL);
+ }
+
+ plt_index = h->plt.offset / PLT_ENTRY_SIZE - 1;
+
+ /* Get the offset into the .got table of the entry that
+ corresponds to this function. Each .got entry is 4 bytes.
+ The first two are reserved. */
+ got_offset = (plt_index + 3) * 4;
+
+ /* We want the relocate to point into the .got.plt instead
+ of the plt itself. */
+ relocation = (sgotplt->output_section->vma
+ + sgotplt->output_offset
+ + got_offset);
+ contents[rel->r_offset-1] |= 0x10; /* make indirect */
+ if (rel->r_addend == 2)
+ {
+ h->plt.offset |= 1;
+ }
+ else if (rel->r_addend != 0)
+ (*_bfd_error_handler)
+ (_("%s: warning: PLT addend of %d to `%s' from %s section ignored"),
+ bfd_get_filename (input_bfd), rel->r_addend,
+ h->root.root.string,
+ bfd_get_section_name (input_bfd, input_section));
+ rel->r_addend = 0;
+
+ break;
+
+ case R_VAX_PC8:
+ case R_VAX_PC16:
+ case R_VAX_PC32:
+ if (h == NULL)
+ break;
+ /* Fall through. */
+ case R_VAX_8:
+ case R_VAX_16:
+ case R_VAX_32:
+ if (info->shared
+ && r_symndx != 0
+ && (input_section->flags & SEC_ALLOC) != 0
+ && ((r_type != R_VAX_PC8
+ && r_type != R_VAX_PC16
+ && r_type != R_VAX_PC32)
+ || (!info->symbolic
+ || (h->elf_link_hash_flags
+ & ELF_LINK_HASH_DEF_REGULAR) == 0)))
+ {
+ Elf_Internal_Rela outrel;
+ boolean skip, relocate;
+
+ /* When generating a shared object, these relocations
+ are copied into the output file to be resolved at run
+ time. */
+
+ if (sreloc == NULL)
+ {
+ const char *name;
+
+ name = (bfd_elf_string_from_elf_section
+ (input_bfd,
+ elf_elfheader (input_bfd)->e_shstrndx,
+ elf_section_data (input_section)->rel_hdr.sh_name));
+ if (name == NULL)
+ return false;
+
+ BFD_ASSERT (strncmp (name, ".rela", 5) == 0
+ && strcmp (bfd_get_section_name (input_bfd,
+ input_section),
+ name + 5) == 0);
+
+ sreloc = bfd_get_section_by_name (dynobj, name);
+ BFD_ASSERT (sreloc != NULL);
+ }
+
+ skip = false;
+ relocate = false;
+
+ outrel.r_offset =
+ _bfd_elf_section_offset (output_bfd, info, input_section,
+ rel->r_offset);
+ if (outrel.r_offset == (bfd_vma) -1)
+ skip = true;
+ if (outrel.r_offset == (bfd_vma) -2)
+ skip = true, relocate = true;
+ outrel.r_offset += (input_section->output_section->vma
+ + input_section->output_offset);
+
+ if (skip)
+ memset (&outrel, 0, sizeof outrel);
+ /* h->dynindx may be -1 if the symbol was marked to
+ become local. */
+ else if (h != NULL
+ && ((! info->symbolic && h->dynindx != -1)
+ || (h->elf_link_hash_flags
+ & ELF_LINK_HASH_DEF_REGULAR) == 0))
+ {
+ BFD_ASSERT (h->dynindx != -1);
+ outrel.r_info = ELF32_R_INFO (h->dynindx, r_type);
+ outrel.r_addend = relocation + rel->r_addend;
+ }
+ else
+ {
+ if (r_type == R_VAX_32)
+ {
+ relocate = true;
+ outrel.r_info = ELF32_R_INFO (0, R_VAX_RELATIVE);
+ BFD_ASSERT (bfd_get_signed_32 (input_bfd,
+ &contents[rel->r_offset]) == 0);
+ outrel.r_addend = relocation + rel->r_addend;
+ }
+ else
+ {
+ long indx;
+
+ if (h == NULL)
+ sec = local_sections[r_symndx];
+ else
+ {
+ BFD_ASSERT (h->root.type == bfd_link_hash_defined
+ || (h->root.type
+ == bfd_link_hash_defweak));
+ sec = h->root.u.def.section;
+ }
+ if (sec != NULL && bfd_is_abs_section (sec))
+ indx = 0;
+ else if (sec == NULL || sec->owner == NULL)
+ {
+ bfd_set_error (bfd_error_bad_value);
+ return false;
+ }
+ else
+ {
+ asection *osec;
+
+ osec = sec->output_section;
+ indx = elf_section_data (osec)->dynindx;
+ BFD_ASSERT (indx > 0);
+ }
+
+ outrel.r_info = ELF32_R_INFO (indx, r_type);
+ outrel.r_addend = relocation + rel->r_addend;
+ }
+ }
+
+ if (!strcmp (bfd_get_section_name (input_bfd, input_section),
+ ".text") != 0 ||
+ (info->shared
+ && ELF32_R_TYPE(outrel.r_info) != R_VAX_32
+ && ELF32_R_TYPE(outrel.r_info) != R_VAX_RELATIVE
+ && ELF32_R_TYPE(outrel.r_info) != R_VAX_COPY
+ && ELF32_R_TYPE(outrel.r_info) != R_VAX_JMP_SLOT
+ && ELF32_R_TYPE(outrel.r_info) != R_VAX_GLOB_DAT))
+ {
+ if (h != NULL)
+ (*_bfd_error_handler)
+ (_("%s: warning: %s relocation against symbol `%s' from %s section"),
+ bfd_get_filename (input_bfd), howto->name,
+ h->root.root.string,
+ bfd_get_section_name (input_bfd, input_section));
+ else
+ (*_bfd_error_handler)
+ (_("%s: warning: %s relocation to 0x%x from %s section"),
+ bfd_get_filename (input_bfd), howto->name,
+ outrel.r_addend,
+ bfd_get_section_name (input_bfd, input_section));
+ }
+ bfd_elf32_swap_reloca_out (output_bfd, &outrel,
+ (((Elf32_External_Rela *)
+ sreloc->contents)
+ + sreloc->reloc_count));
+ ++sreloc->reloc_count;
+
+ /* This reloc will be computed at runtime, so there's no
+ need to do anything now, except for R_VAX_32
+ relocations that have been turned into
+ R_VAX_RELATIVE. */
+ if (!relocate)
+ continue;
+ }
+
+ break;
+
+ case R_VAX_GNU_VTINHERIT:
+ case R_VAX_GNU_VTENTRY:
+ /* These are no-ops in the end. */
+ continue;
+
+ default:
+ break;
+ }
+
+ /* VAX PCREL relocations are from the end of relocation, not the start */
+ if (howto->pc_relative && howto->pcrel_offset)
+ {
+ relocation -= bfd_get_reloc_size(howto);
+ }
+
+ r = _bfd_final_link_relocate (howto, input_bfd, input_section,
+ contents, rel->r_offset,
+ relocation, rel->r_addend);
+
+ if (r != bfd_reloc_ok)
+ {
+ switch (r)
+ {
+ default:
+ case bfd_reloc_outofrange:
+ abort ();
+ case bfd_reloc_overflow:
+ {
+ const char *name;
+
+ if (h != NULL)
+ name = h->root.root.string;
+ else
+ {
+ name = bfd_elf_string_from_elf_section (input_bfd,
+ symtab_hdr->sh_link,
+ sym->st_name);
+ if (name == NULL)
+ return false;
+ if (*name == '\0')
+ name = bfd_section_name (input_bfd, sec);
+ }
+ if (!(info->callbacks->reloc_overflow
+ (info, name, howto->name, (bfd_vma) 0,
+ input_bfd, input_section, rel->r_offset)))
+ return false;
+ }
+ break;
+ }
+ }
+ }
+
+ return true;
+}
+
+/* Finish up dynamic symbol handling. We set the contents of various
+ dynamic sections here. */
+
+static boolean
+elf_vax_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 *dynobj;
+
+ dynobj = elf_hash_table (info)->dynobj;
+
+ if (h->plt.offset != (bfd_vma) -1)
+ {
+ asection *splt;
+ asection *sgot;
+ asection *srela;
+ bfd_vma plt_index;
+ bfd_vma got_offset;
+ bfd_vma addend;
+ Elf_Internal_Rela rela;
+
+ /* This symbol has an entry in the procedure linkage table. Set
+ it up. */
+
+ BFD_ASSERT (h->dynindx != -1);
+
+ splt = bfd_get_section_by_name (dynobj, ".plt");
+ sgot = bfd_get_section_by_name (dynobj, ".got.plt");
+ srela = bfd_get_section_by_name (dynobj, ".rela.plt");
+ BFD_ASSERT (splt != NULL && sgot != NULL && srela != NULL);
+
+ addend = 2 * (h->plt.offset & 1);
+ h->plt.offset &= ~1;
+
+ /* Get the index in the procedure linkage table which
+ corresponds to this symbol. This is the index of this symbol
+ in all the symbols for which we are making plt entries. The
+ first entry in the procedure linkage table is reserved. */
+ plt_index = h->plt.offset / PLT_ENTRY_SIZE - 1;
+
+ /* Get the offset into the .got table of the entry that
+ corresponds to this function. Each .got entry is 4 bytes.
+ The first two are reserved. */
+ got_offset = (plt_index + 3) * 4;
+
+ /* Fill in the entry in the procedure linkage table. */
+ memcpy (splt->contents + h->plt.offset, elf_vax_plt_entry,
+ PLT_ENTRY_SIZE);
+
+ /* The offset is relative to the first extension word. */
+ bfd_put_32 (output_bfd,
+ -(h->plt.offset + 8),
+ splt->contents + h->plt.offset + 4);
+
+ bfd_put_32 (output_bfd, plt_index * sizeof (Elf32_External_Rela),
+ splt->contents + h->plt.offset + 8);
+
+ /* Fill in the entry in the global offset table. */
+ bfd_put_32 (output_bfd,
+ (splt->output_section->vma
+ + splt->output_offset
+ + h->plt.offset) + addend,
+ sgot->contents + got_offset);
+
+ /* Fill in the entry in the .rela.plt section. */
+ rela.r_offset = (sgot->output_section->vma
+ + sgot->output_offset
+ + got_offset);
+ rela.r_info = ELF32_R_INFO (h->dynindx, R_VAX_JMP_SLOT);
+ rela.r_addend = addend;
+ bfd_elf32_swap_reloca_out (output_bfd, &rela,
+ ((Elf32_External_Rela *) srela->contents
+ + plt_index));
+
+ 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. */
+ sym->st_shndx = SHN_UNDEF;
+ }
+ }
+
+ if (h->got.offset != (bfd_vma) -1)
+ {
+ asection *sgot;
+ asection *srela;
+ Elf_Internal_Rela rela;
+
+ /* This symbol has an entry in the global offset table. Set it
+ up. */
+
+ sgot = bfd_get_section_by_name (dynobj, ".got");
+ srela = bfd_get_section_by_name (dynobj, ".rela.got");
+ BFD_ASSERT (sgot != NULL && srela != NULL);
+
+ rela.r_offset = (sgot->output_section->vma
+ + sgot->output_offset
+ + (h->got.offset &~ 1));
+
+ /* If the symbol was forced to be local because of a version file
+ locally we just want to emit a RELATIVE reloc. The entry in
+ the global offset table will already have been initialized in
+ the relocate_section function. */
+ if (info->shared
+ && h->dynindx == -1
+ && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))
+ {
+ rela.r_info = ELF32_R_INFO (0, R_VAX_RELATIVE);
+ }
+ else
+ {
+ rela.r_info = ELF32_R_INFO (h->dynindx, R_VAX_GLOB_DAT);
+ }
+ rela.r_addend = bfd_get_signed_32 (output_bfd,
+ (sgot->contents
+ + (h->got.offset & ~1)));
+
+ bfd_elf32_swap_reloca_out (output_bfd, &rela,
+ ((Elf32_External_Rela *) srela->contents
+ + srela->reloc_count));
+ ++srela->reloc_count;
+ }
+
+ if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0)
+ {
+ asection *s;
+ Elf_Internal_Rela rela;
+
+ /* This symbol needs a copy reloc. Set it up. */
+
+ BFD_ASSERT (h->dynindx != -1
+ && (h->root.type == bfd_link_hash_defined
+ || h->root.type == bfd_link_hash_defweak));
+
+ s = bfd_get_section_by_name (h->root.u.def.section->owner,
+ ".rela.bss");
+ BFD_ASSERT (s != NULL);
+
+ rela.r_offset = (h->root.u.def.value
+ + h->root.u.def.section->output_section->vma
+ + h->root.u.def.section->output_offset);
+ rela.r_info = ELF32_R_INFO (h->dynindx, R_VAX_COPY);
+ rela.r_addend = 0;
+ bfd_elf32_swap_reloca_out (output_bfd, &rela,
+ ((Elf32_External_Rela *) s->contents
+ + s->reloc_count));
+ ++s->reloc_count;
+ }
+
+ /* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */
+ if (strcmp (h->root.root.string, "_DYNAMIC") == 0
+ || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)
+ sym->st_shndx = SHN_ABS;
+
+ return true;
+}
+
+/* Finish up the dynamic sections. */
+
+static boolean
+elf_vax_finish_dynamic_sections (output_bfd, info)
+ bfd *output_bfd;
+ struct bfd_link_info *info;
+{
+ bfd *dynobj;
+ asection *sgot;
+ asection *sdyn;
+
+ dynobj = elf_hash_table (info)->dynobj;
+
+ sgot = bfd_get_section_by_name (dynobj, ".got.plt");
+ BFD_ASSERT (sgot != NULL);
+ sdyn = bfd_get_section_by_name (dynobj, ".dynamic");
+
+ if (elf_hash_table (info)->dynamic_sections_created)
+ {
+ asection *splt;
+ Elf32_External_Dyn *dyncon, *dynconend;
+
+ splt = bfd_get_section_by_name (dynobj, ".plt");
+ BFD_ASSERT (splt != NULL && sdyn != NULL);
+
+ dyncon = (Elf32_External_Dyn *) sdyn->contents;
+ dynconend = (Elf32_External_Dyn *) (sdyn->contents + sdyn->_raw_size);
+ for (; dyncon < dynconend; dyncon++)
+ {
+ Elf_Internal_Dyn dyn;
+ const char *name;
+ asection *s;
+
+ bfd_elf32_swap_dyn_in (dynobj, dyncon, &dyn);
+
+ switch (dyn.d_tag)
+ {
+ default:
+ break;
+
+ case DT_PLTGOT:
+ name = ".got";
+ goto get_vma;
+ case DT_JMPREL:
+ name = ".rela.plt";
+ get_vma:
+ s = bfd_get_section_by_name (output_bfd, name);
+ BFD_ASSERT (s != NULL);
+ dyn.d_un.d_ptr = s->vma;
+ bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
+ break;
+
+ case DT_PLTRELSZ:
+ s = bfd_get_section_by_name (output_bfd, ".rela.plt");
+ BFD_ASSERT (s != NULL);
+ if (s->_cooked_size != 0)
+ dyn.d_un.d_val = s->_cooked_size;
+ else
+ dyn.d_un.d_val = s->_raw_size;
+ bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
+ break;
+
+ case DT_RELASZ:
+ /* The procedure linkage table relocs (DT_JMPREL) should
+ not be included in the overall relocs (DT_RELA).
+ Therefore, we override the DT_RELASZ entry here to
+ make it not include the JMPREL relocs. Since the
+ linker script arranges for .rela.plt to follow all
+ other relocation sections, we don't have to worry
+ about changing the DT_RELA entry. */
+ s = bfd_get_section_by_name (output_bfd, ".rela.plt");
+ if (s != NULL)
+ {
+ if (s->_cooked_size != 0)
+ dyn.d_un.d_val -= s->_cooked_size;
+ else
+ dyn.d_un.d_val -= s->_raw_size;
+ }
+ bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
+ break;
+ }
+ }
+
+ /* Fill in the first entry in the procedure linkage table. */
+ if (splt->_raw_size > 0)
+ {
+ memcpy (splt->contents, elf_vax_plt0_entry, PLT_ENTRY_SIZE);
+ bfd_put_32 (output_bfd,
+ (sgot->output_section->vma
+ + sgot->output_offset + 4
+ - (splt->output_section->vma + 6)),
+ splt->contents + 2);
+ bfd_put_32 (output_bfd,
+ (sgot->output_section->vma
+ + sgot->output_offset + 8
+ - (splt->output_section->vma + 12)),
+ splt->contents + 8);
+ elf_section_data (splt->output_section)->this_hdr.sh_entsize
+ = PLT_ENTRY_SIZE;
+ }
+ }
+
+ /* Fill in the first three entries in the global offset table. */
+ if (sgot->_raw_size > 0)
+ {
+ if (sdyn == NULL)
+ bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents);
+ else
+ bfd_put_32 (output_bfd,
+ sdyn->output_section->vma + sdyn->output_offset,
+ sgot->contents);
+ bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + 4);
+ bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + 8);
+ }
+
+ elf_section_data (sgot->output_section)->this_hdr.sh_entsize = 4;
+
+ return true;
+}
+
+#define TARGET_LITTLE_SYM bfd_elf32_vax_vec
+#define TARGET_LITTLE_NAME "elf32-vax"
+#define ELF_MACHINE_CODE EM_VAX
+#define ELF_MAXPAGESIZE 0x1000
+
+#define elf_backend_create_dynamic_sections \
+ _bfd_elf_create_dynamic_sections
+#define bfd_elf32_bfd_link_hash_table_create \
+ elf_vax_link_hash_table_create
+#define bfd_elf32_bfd_final_link _bfd_elf32_gc_common_final_link
+
+#define elf_backend_check_relocs elf_vax_check_relocs
+#define elf_backend_adjust_dynamic_symbol \
+ elf_vax_adjust_dynamic_symbol
+#define elf_backend_size_dynamic_sections \
+ elf_vax_size_dynamic_sections
+#define elf_backend_relocate_section elf_vax_relocate_section
+#define elf_backend_finish_dynamic_symbol \
+ elf_vax_finish_dynamic_symbol
+#define elf_backend_finish_dynamic_sections \
+ elf_vax_finish_dynamic_sections
+#define elf_backend_gc_mark_hook elf_vax_gc_mark_hook
+#define elf_backend_gc_sweep_hook elf_vax_gc_sweep_hook
+#define bfd_elf32_bfd_merge_private_bfd_data \
+ elf32_vax_merge_private_bfd_data
+#define bfd_elf32_bfd_set_private_flags \
+ elf32_vax_set_private_flags
+#define bfd_elf32_bfd_print_private_bfd_data \
+ elf32_vax_print_private_bfd_data
+
+#define elf_backend_can_gc_sections 1
+#define elf_backend_want_got_plt 1
+#define elf_backend_plt_readonly 1
+#define elf_backend_want_plt_sym 0
+#define elf_backend_got_header_size 16
+
+#include "elf32-target.h"
diff --git a/bfd/elf32-xstormy16.c b/bfd/elf32-xstormy16.c
index d6b8dd3c492..d58ea9cffc8 100644
--- a/bfd/elf32-xstormy16.c
+++ b/bfd/elf32-xstormy16.c
@@ -27,9 +27,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* Forward declarations. */
static reloc_howto_type * xstormy16_reloc_type_lookup
PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
-static void xstormy16_info_to_howto_rela
+static void xstormy16_info_to_howto_rela
PARAMS ((bfd *, arelent *, Elf32_Internal_Rela *));
-static bfd_reloc_status_type xstormy16_elf_24_reloc
+static bfd_reloc_status_type xstormy16_elf_24_reloc
PARAMS ((bfd *abfd, arelent *reloc_entry, asymbol *symbol,
PTR data, asection *input_section, bfd *output_bfd,
char **error_message));
@@ -45,7 +45,7 @@ static boolean xstormy16_elf_relax_section
boolean *again));
static boolean xstormy16_elf_always_size_sections
PARAMS ((bfd *, struct bfd_link_info *));
-static boolean xstormy16_elf_relocate_section
+static boolean xstormy16_elf_relocate_section
PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
static boolean xstormy16_elf_finish_dynamic_sections
@@ -88,7 +88,7 @@ static reloc_howto_type xstormy16_elf_howto_table [] =
0, /* src_mask */
0xffffffff, /* dst_mask */
false), /* pcrel_offset */
-
+
/* A 16 bit absolute relocation. */
HOWTO (R_XSTORMY16_16, /* type */
0, /* rightshift */
@@ -103,7 +103,7 @@ static reloc_howto_type xstormy16_elf_howto_table [] =
0, /* src_mask */
0xffffffff, /* dst_mask */
false), /* pcrel_offset */
-
+
/* An 8 bit absolute relocation. */
HOWTO (R_XSTORMY16_8, /* type */
0, /* rightshift */
@@ -118,7 +118,7 @@ static reloc_howto_type xstormy16_elf_howto_table [] =
0, /* src_mask */
0xffffffff, /* dst_mask */
false), /* pcrel_offset */
-
+
/* A 32 bit pc-relative relocation. */
HOWTO (R_XSTORMY16_PC32, /* type */
0, /* rightshift */
@@ -133,7 +133,7 @@ static reloc_howto_type xstormy16_elf_howto_table [] =
0, /* src_mask */
0xffffffff, /* dst_mask */
true), /* pcrel_offset */
-
+
/* A 16 bit pc-relative relocation. */
HOWTO (R_XSTORMY16_PC16, /* type */
0, /* rightshift */
@@ -148,7 +148,7 @@ static reloc_howto_type xstormy16_elf_howto_table [] =
0, /* src_mask */
0xffffffff, /* dst_mask */
true), /* pcrel_offset */
-
+
/* An 8 bit pc-relative relocation. */
HOWTO (R_XSTORMY16_PC8, /* type */
0, /* rightshift */
@@ -163,7 +163,7 @@ static reloc_howto_type xstormy16_elf_howto_table [] =
0, /* src_mask */
0xffffffff, /* dst_mask */
true), /* pcrel_offset */
-
+
/* A 12-bit pc-relative relocation suitable for the branch instructions. */
HOWTO (R_XSTORMY16_REL_12, /* type */
1, /* rightshift */
@@ -178,7 +178,7 @@ static reloc_howto_type xstormy16_elf_howto_table [] =
0, /* src_mask */
0x0fff, /* dst_mask */
true), /* pcrel_offset */
-
+
/* A 24-bit absolute relocation suitable for the jump instructions. */
HOWTO (R_XSTORMY16_24, /* type */
0, /* rightshift */
@@ -193,7 +193,7 @@ static reloc_howto_type xstormy16_elf_howto_table [] =
0, /* src_mask */
0xffff00ff, /* dst_mask */
true), /* pcrel_offset */
-
+
/* A 16 bit absolute relocation to a function pointer. */
HOWTO (R_XSTORMY16_FPTR16, /* type */
0, /* rightshift */
@@ -209,7 +209,7 @@ static reloc_howto_type xstormy16_elf_howto_table [] =
0xffffffff, /* dst_mask */
false), /* pcrel_offset */
};
-
+
static reloc_howto_type xstormy16_elf_howto_table2 [] =
{
/* GNU extension to record C++ vtable hierarchy */
@@ -241,7 +241,7 @@ static reloc_howto_type xstormy16_elf_howto_table2 [] =
0, /* src_mask */
0, /* dst_mask */
false), /* pcrel_offset */
-
+
};
/* Map BFD reloc types to XSTORMY16 ELF reloc types. */
@@ -286,7 +286,7 @@ xstormy16_reloc_type_lookup (abfd, code)
return entry->table + (entry->xstormy16_reloc_val
- entry->table[0].type);
}
-
+
return NULL;
}
@@ -451,7 +451,7 @@ xstormy16_elf_check_relocs (abfd, info, sec, relocs)
if (local_plt_offsets == NULL)
return false;
elf_local_got_offsets (abfd) = local_plt_offsets;
-
+
for (i = 0; i < symtab_hdr->sh_info; i++)
local_plt_offsets[i] = (bfd_vma) -1;
}
@@ -471,7 +471,7 @@ xstormy16_elf_check_relocs (abfd, info, sec, relocs)
if (!_bfd_elf32_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
return false;
break;
-
+
/* This relocation describes which C++ vtable entries are actually
used. Record for later use during GC. */
case R_XSTORMY16_GNU_VTENTRY:
@@ -578,7 +578,7 @@ xstormy16_elf_relax_section (dynobj, splt, info, again)
if (splt->_cooked_size == 0)
splt->_cooked_size = splt->_raw_size;
- /* Map across all global symbols; see which ones happen to
+ /* Map across all global symbols; see which ones happen to
fall in the low 64k. */
relax_plt_data.splt = splt;
relax_plt_data.again = again;
@@ -654,7 +654,8 @@ xstormy16_elf_relax_section (dynobj, splt, info, again)
shndx = shndx_buf;
if (shndx != NULL)
shndx += idx;
- bfd_elf32_swap_symbol_in (ibfd, extsyms + idx, shndx, &isym);
+ bfd_elf32_swap_symbol_in (ibfd, (const PTR) (extsyms + idx),
+ (const PTR) shndx, &isym);
if (isym.st_shndx == SHN_UNDEF)
continue;
else if (isym.st_shndx == SHN_ABS)
@@ -813,19 +814,19 @@ xstormy16_elf_relocate_section (output_bfd, info, input_bfd, input_section,
bfd_reloc_status_type r;
const char * name = NULL;
int r_type;
-
+
r_type = ELF32_R_TYPE (rel->r_info);
-
+
if ( r_type == R_XSTORMY16_GNU_VTINHERIT
|| r_type == R_XSTORMY16_GNU_VTENTRY)
continue;
-
+
r_symndx = ELF32_R_SYM (rel->r_info);
howto = xstormy16_elf_howto_table + ELF32_R_TYPE (rel->r_info);
h = NULL;
sym = NULL;
sec = NULL;
-
+
if (r_symndx < symtab_hdr->sh_info)
{
sym = local_syms + r_symndx;
@@ -833,7 +834,7 @@ xstormy16_elf_relocate_section (output_bfd, info, input_bfd, input_section,
relocation = (sec->output_section->vma
+ sec->output_offset
+ sym->st_value);
-
+
name = bfd_elf_string_from_elf_section
(input_bfd, symtab_hdr->sh_link, sym->st_name);
name = (name == NULL) ? bfd_section_name (input_bfd, sec) : name;
@@ -841,13 +842,13 @@ xstormy16_elf_relocate_section (output_bfd, info, input_bfd, input_section,
else
{
h = sym_hashes [r_symndx - symtab_hdr->sh_info];
-
+
while (h->root.type == bfd_link_hash_indirect
|| h->root.type == bfd_link_hash_warning)
h = (struct elf_link_hash_entry *) h->root.u.i.link;
name = h->root.root.string;
-
+
if (h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak)
{
@@ -869,14 +870,14 @@ xstormy16_elf_relocate_section (output_bfd, info, input_bfd, input_section,
relocation = 0;
}
}
-
+
switch (ELF32_R_TYPE (rel->r_info))
{
case R_XSTORMY16_24:
{
bfd_vma reloc = relocation + rel->r_addend;
unsigned int x;
-
+
x = bfd_get_32 (input_bfd, contents + rel->r_offset);
x &= 0x0000ff00;
x |= reloc & 0xff;
@@ -952,13 +953,13 @@ xstormy16_elf_relocate_section (output_bfd, info, input_bfd, input_section,
(info, name, howto->name, (bfd_vma) 0,
input_bfd, input_section, rel->r_offset);
break;
-
+
case bfd_reloc_undefined:
r = info->callbacks->undefined_symbol
(info, name, input_bfd, input_section, rel->r_offset,
true);
break;
-
+
case bfd_reloc_outofrange:
msg = _("internal error: out of range error");
break;
diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c
index 94b4ebe056e..a491ecad8c8 100644
--- a/bfd/elf64-alpha.c
+++ b/bfd/elf64-alpha.c
@@ -73,7 +73,7 @@ static boolean elf64_alpha_mkobject
static boolean elf64_alpha_object_p
PARAMS((bfd *));
static boolean elf64_alpha_section_from_shdr
- PARAMS((bfd *, Elf64_Internal_Shdr *, char *));
+ PARAMS((bfd *, Elf64_Internal_Shdr *, const char *));
static boolean elf64_alpha_section_flags
PARAMS((flagword *, Elf64_Internal_Shdr *));
static boolean elf64_alpha_fake_sections
@@ -106,14 +106,27 @@ static boolean elf64_alpha_calc_got_offsets_for_symbol
PARAMS ((struct alpha_elf_link_hash_entry *, PTR));
static void elf64_alpha_calc_got_offsets PARAMS ((struct bfd_link_info *));
static boolean elf64_alpha_size_got_sections
- PARAMS ((bfd *, struct bfd_link_info *));
+ PARAMS ((struct bfd_link_info *));
+static boolean elf64_alpha_size_plt_section
+ PARAMS ((struct bfd_link_info *));
+static boolean elf64_alpha_size_plt_section_1
+ PARAMS ((struct alpha_elf_link_hash_entry *, PTR));
static boolean elf64_alpha_always_size_sections
PARAMS ((bfd *, struct bfd_link_info *));
+static int alpha_dynamic_entries_for_reloc
+ PARAMS ((int, int, int));
static boolean elf64_alpha_calc_dynrel_sizes
PARAMS ((struct alpha_elf_link_hash_entry *, struct bfd_link_info *));
+static boolean elf64_alpha_size_rela_got_section
+ PARAMS ((struct bfd_link_info *));
+static boolean elf64_alpha_size_rela_got_1
+ PARAMS ((struct alpha_elf_link_hash_entry *, struct bfd_link_info *));
static boolean elf64_alpha_add_symbol_hook
PARAMS ((bfd *, struct bfd_link_info *, const Elf_Internal_Sym *,
const char **, flagword *, asection **, bfd_vma *));
+static struct alpha_elf_got_entry *get_got_entry
+ PARAMS ((bfd *, struct alpha_elf_link_hash_entry *, unsigned long,
+ unsigned long, bfd_vma));
static boolean elf64_alpha_check_relocs
PARAMS((bfd *, struct bfd_link_info *, asection *sec,
const Elf_Internal_Rela *));
@@ -121,6 +134,9 @@ static boolean elf64_alpha_adjust_dynamic_symbol
PARAMS((struct bfd_link_info *, struct elf_link_hash_entry *));
static boolean elf64_alpha_size_dynamic_sections
PARAMS((bfd *, struct bfd_link_info *));
+static boolean elf64_alpha_relocate_section_r
+ PARAMS((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
+ Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
static boolean elf64_alpha_relocate_section
PARAMS((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
@@ -148,11 +164,15 @@ struct alpha_elf_link_hash_entry
/* Cumulative flags for all the .got entries. */
int flags;
- /* Contexts (LITUSE) in which a literal was referenced. */
-#define ALPHA_ELF_LINK_HASH_LU_ADDR 0x01
-#define ALPHA_ELF_LINK_HASH_LU_MEM 0x02
-#define ALPHA_ELF_LINK_HASH_LU_BYTE 0x04
-#define ALPHA_ELF_LINK_HASH_LU_FUNC 0x08
+ /* Contexts in which a literal was referenced. */
+#define ALPHA_ELF_LINK_HASH_LU_ADDR 0x01
+#define ALPHA_ELF_LINK_HASH_LU_MEM 0x02
+#define ALPHA_ELF_LINK_HASH_LU_BYTE 0x04
+#define ALPHA_ELF_LINK_HASH_LU_JSR 0x08
+#define ALPHA_ELF_LINK_HASH_LU_TLSGD 0x10
+#define ALPHA_ELF_LINK_HASH_LU_TLSLDM 0x20
+#define ALPHA_ELF_LINK_HASH_LU_FUNC 0x38
+#define ALPHA_ELF_LINK_HASH_TLS_IE 0x40
/* Used to implement multiple .got subsections. */
struct alpha_elf_got_entry
@@ -168,13 +188,20 @@ struct alpha_elf_link_hash_entry
/* the .got offset for this entry. */
int got_offset;
- int flags;
+ /* How many references to this entry? */
+ int use_count;
- /* Additional flags. */
-#define ALPHA_ELF_GOT_ENTRY_RELOCS_DONE 0x10
-#define ALPHA_ELF_GOT_ENTRY_RELOCS_XLATED 0x20
+ /* The relocation type of this entry. */
+ unsigned char reloc_type;
- int use_count;
+ /* How a LITERAL is used. */
+ unsigned char flags;
+
+ /* Have we initialized the dynamic relocation for this entry? */
+ unsigned char reloc_done;
+
+ /* Have we adjusted this entry for SEC_MERGE? */
+ unsigned char reloc_xlated;
} *got_entries;
/* used to count non-got, non-plt relocations for delayed sizing
@@ -361,12 +388,12 @@ struct alpha_elf_obj_tdata
/* For every got, this is the section. */
asection *got;
- /* For every got, this is it's total number of *entries*. */
- int total_got_entries;
+ /* For every got, this is it's total number of words. */
+ int total_got_size;
- /* For every got, this is the sum of the number of *entries* required
+ /* For every got, this is the sum of the number of words required
to hold all of the member object's local got. */
- int n_local_got_entries;
+ int local_got_size;
};
#define alpha_elf_tdata(abfd) \
@@ -748,6 +775,203 @@ static reloc_howto_type elf64_alpha_howto_table[] =
0x1fffff, /* src_mask */
0x1fffff, /* dst_mask */
true), /* pcrel_offset */
+
+ /* Creates a tls_index for the symbol in the got. */
+ HOWTO (R_ALPHA_TLSGD, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ 0, /* special_function */
+ "TLSGD", /* name */
+ false, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* Creates a tls_index for the (current) module in the got. */
+ HOWTO (R_ALPHA_TLSLDM, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ 0, /* special_function */
+ "TLSLDM", /* name */
+ false, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* A dynamic relocation for a DTP module entry. */
+ HOWTO (R_ALPHA_DTPMOD64, /* type */
+ 0, /* rightshift */
+ 4, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ 0, /* special_function */
+ "DTPMOD64", /* name */
+ false, /* partial_inplace */
+ MINUS_ONE, /* src_mask */
+ MINUS_ONE, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* Creates a 64-bit offset in the got for the displacement
+ from DTP to the target. */
+ HOWTO (R_ALPHA_GOTDTPREL, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ 0, /* special_function */
+ "GOTDTPREL", /* name */
+ false, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* A dynamic relocation for a displacement from DTP to the target. */
+ HOWTO (R_ALPHA_DTPREL64, /* type */
+ 0, /* rightshift */
+ 4, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ 0, /* special_function */
+ "DTPREL64", /* name */
+ false, /* partial_inplace */
+ MINUS_ONE, /* src_mask */
+ MINUS_ONE, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* The high 16 bits of the displacement from DTP to the target. */
+ HOWTO (R_ALPHA_DTPRELHI, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ 0, /* special_function */
+ "DTPRELHI", /* name */
+ false, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* The low 16 bits of the displacement from DTP to the target. */
+ HOWTO (R_ALPHA_DTPRELLO, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ 0, /* special_function */
+ "DTPRELLO", /* name */
+ false, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* A 16-bit displacement from DTP to the target. */
+ HOWTO (R_ALPHA_DTPREL16, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ 0, /* special_function */
+ "DTPREL16", /* name */
+ false, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* Creates a 64-bit offset in the got for the displacement
+ from TP to the target. */
+ HOWTO (R_ALPHA_GOTTPREL, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ 0, /* special_function */
+ "GOTTPREL", /* name */
+ false, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* A dynamic relocation for a displacement from TP to the target. */
+ HOWTO (R_ALPHA_TPREL64, /* type */
+ 0, /* rightshift */
+ 4, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ 0, /* special_function */
+ "TPREL64", /* name */
+ false, /* partial_inplace */
+ MINUS_ONE, /* src_mask */
+ MINUS_ONE, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* The high 16 bits of the displacement from TP to the target. */
+ HOWTO (R_ALPHA_TPRELHI, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ 0, /* special_function */
+ "TPRELHI", /* name */
+ false, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* The low 16 bits of the displacement from TP to the target. */
+ HOWTO (R_ALPHA_TPRELLO, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ 0, /* special_function */
+ "TPRELLO", /* name */
+ false, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* A 16-bit displacement from TP to the target. */
+ HOWTO (R_ALPHA_TPREL16, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ 0, /* special_function */
+ "TPREL16", /* name */
+ false, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ false), /* pcrel_offset */
};
/* A relocation function which doesn't do anything. */
@@ -902,6 +1126,19 @@ static const struct elf_reloc_map elf64_alpha_reloc_map[] =
{BFD_RELOC_ALPHA_GPREL_LO16, R_ALPHA_GPRELLOW},
{BFD_RELOC_GPREL16, R_ALPHA_GPREL16},
{BFD_RELOC_ALPHA_BRSGP, R_ALPHA_BRSGP},
+ {BFD_RELOC_ALPHA_TLSGD, R_ALPHA_TLSGD},
+ {BFD_RELOC_ALPHA_TLSLDM, R_ALPHA_TLSLDM},
+ {BFD_RELOC_ALPHA_DTPMOD64, R_ALPHA_DTPMOD64},
+ {BFD_RELOC_ALPHA_GOTDTPREL16, R_ALPHA_GOTDTPREL},
+ {BFD_RELOC_ALPHA_DTPREL64, R_ALPHA_DTPREL64},
+ {BFD_RELOC_ALPHA_DTPREL_HI16, R_ALPHA_DTPRELHI},
+ {BFD_RELOC_ALPHA_DTPREL_LO16, R_ALPHA_DTPRELLO},
+ {BFD_RELOC_ALPHA_DTPREL16, R_ALPHA_DTPREL16},
+ {BFD_RELOC_ALPHA_GOTTPREL16, R_ALPHA_GOTTPREL},
+ {BFD_RELOC_ALPHA_TPREL64, R_ALPHA_TPREL64},
+ {BFD_RELOC_ALPHA_TPREL_HI16, R_ALPHA_TPRELHI},
+ {BFD_RELOC_ALPHA_TPREL_LO16, R_ALPHA_TPRELLO},
+ {BFD_RELOC_ALPHA_TPREL16, R_ALPHA_TPREL16},
};
/* Given a BFD reloc type, return a HOWTO structure. */
@@ -936,6 +1173,19 @@ elf64_alpha_info_to_howto (abfd, cache_ptr, dst)
BFD_ASSERT (r_type < (unsigned int) R_ALPHA_max);
cache_ptr->howto = &elf64_alpha_howto_table[r_type];
}
+
+/* These two relocations create a two-word entry in the got. */
+#define alpha_got_entry_size(r_type) \
+ (r_type == R_ALPHA_TLSGD || r_type == R_ALPHA_TLSLDM ? 16 : 8)
+
+/* This is PT_TLS segment p_vaddr. */
+#define alpha_get_dtprel_base(tlss) \
+ ((tlss)->start)
+
+/* Main program TLS (whose template starts at PT_TLS p_vaddr)
+ is assigned offset round(16, PT_TLS p_align). */
+#define alpha_get_tprel_base(tlss) \
+ ((tlss)->start - align_power ((bfd_vma) 16, (tlss)->align))
/* These functions do relaxation for Alpha ELF.
@@ -958,35 +1208,45 @@ elf64_alpha_info_to_howto (abfd, cache_ptr, dst)
#define OP_BR 0x30
#define OP_BSR 0x34
#define INSN_UNOP 0x2ffe0000
+#define INSN_ADDQ 0x40000400
+#define INSN_RDUNIQ 0x0000009e
struct alpha_relax_info
{
bfd *abfd;
asection *sec;
bfd_byte *contents;
+ Elf_Internal_Shdr *symtab_hdr;
Elf_Internal_Rela *relocs, *relend;
struct bfd_link_info *link_info;
- boolean changed_contents;
- boolean changed_relocs;
+ struct elf_link_tls_segment *tls_segment;
bfd_vma gp;
bfd *gotobj;
asection *tsec;
struct alpha_elf_link_hash_entry *h;
+ struct alpha_elf_got_entry **first_gotent;
struct alpha_elf_got_entry *gotent;
+ boolean changed_contents;
+ boolean changed_relocs;
unsigned char other;
};
-static Elf_Internal_Rela * elf64_alpha_relax_with_lituse
- PARAMS((struct alpha_relax_info *info, bfd_vma symval,
- Elf_Internal_Rela *irel, Elf_Internal_Rela *irelend));
-
-static boolean elf64_alpha_relax_without_lituse
+static boolean elf64_alpha_relax_with_lituse
PARAMS((struct alpha_relax_info *info, bfd_vma symval,
Elf_Internal_Rela *irel));
-
static bfd_vma elf64_alpha_relax_opt_call
PARAMS((struct alpha_relax_info *info, bfd_vma symval));
-
+static boolean elf64_alpha_relax_got_load
+ PARAMS((struct alpha_relax_info *info, bfd_vma symval,
+ Elf_Internal_Rela *irel, unsigned long));
+static boolean elf64_alpha_relax_gprelhilo
+ PARAMS((struct alpha_relax_info *info, bfd_vma symval,
+ Elf_Internal_Rela *irel, boolean));
+static boolean elf64_alpha_relax_tls_get_addr
+ PARAMS((struct alpha_relax_info *info, bfd_vma symval,
+ Elf_Internal_Rela *irel, boolean));
+static struct elf_link_tls_segment *elf64_alpha_relax_find_tls_segment
+ PARAMS((struct alpha_relax_info *, struct elf_link_tls_segment *));
static boolean elf64_alpha_relax_section
PARAMS((bfd *abfd, asection *sec, struct bfd_link_info *link_info,
boolean *again));
@@ -1007,13 +1267,13 @@ elf64_alpha_find_reloc_at_ofs (rel, relend, offset, type)
return NULL;
}
-static Elf_Internal_Rela *
-elf64_alpha_relax_with_lituse (info, symval, irel, irelend)
+static boolean
+elf64_alpha_relax_with_lituse (info, symval, irel)
struct alpha_relax_info *info;
bfd_vma symval;
- Elf_Internal_Rela *irel, *irelend;
+ Elf_Internal_Rela *irel;
{
- Elf_Internal_Rela *urel;
+ Elf_Internal_Rela *urel, *irelend = info->relend;
int flags, count, i;
bfd_signed_vma disp;
boolean fits16;
@@ -1029,9 +1289,13 @@ elf64_alpha_relax_with_lituse (info, symval, irel, irelend)
("%s: %s+0x%lx: warning: LITERAL relocation against unexpected insn",
bfd_archive_filename (info->abfd), info->sec->name,
(unsigned long) irel->r_offset));
- return irel;
+ return true;
}
+ /* Can't relax dynamic symbols. */
+ if (alpha_elf_dynamic_symbol_p (&info->h->root, info->link_info))
+ return true;
+
/* Summarize how this particular LITERAL is used. */
for (urel = irel+1, flags = count = 0; urel < irelend; ++urel, ++count)
{
@@ -1054,25 +1318,27 @@ elf64_alpha_relax_with_lituse (info, symval, irel, irelend)
switch (urel->r_addend)
{
- default: /* 0 = ADDRESS FORMAT */
+ case LITUSE_ALPHA_ADDR:
+ default:
/* This type is really just a placeholder to note that all
uses cannot be optimized, but to still allow some. */
all_optimized = false;
break;
- case 1: /* MEM FORMAT */
+ case LITUSE_ALPHA_BASE:
/* We can always optimize 16-bit displacements. */
/* Extract the displacement from the instruction, sign-extending
it if necessary, then test whether it is within 16 or 32 bits
displacement from GP. */
insn_disp = insn & 0x0000ffff;
- if (insn_disp & 0x00008000)
- insn_disp |= 0xffff0000; /* Negative: sign-extend. */
+ if (insn_disp & 0x8000)
+ insn_disp |= ~0xffff; /* Negative: sign-extend. */
xdisp = disp + insn_disp;
- fits16 = (xdisp >= - (bfd_signed_vma) 0x00008000 && xdisp < 0x00008000);
- fits32 = (xdisp >= - (bfd_signed_vma) 0x80000000 && xdisp < 0x7fff8000);
+ fits16 = (xdisp >= - (bfd_signed_vma) 0x8000 && xdisp < 0x8000);
+ fits32 = (xdisp >= - (bfd_signed_vma) 0x80000000
+ && xdisp < 0x7fff8000);
if (fits16)
{
@@ -1111,7 +1377,7 @@ elf64_alpha_relax_with_lituse (info, symval, irel, irelend)
all_optimized = false;
break;
- case 2: /* BYTE OFFSET FORMAT */
+ case LITUSE_ALPHA_BYTOFF:
/* We can always optimize byte instructions. */
/* FIXME: sanity check the insn for byte op. Check that the
@@ -1129,16 +1395,20 @@ elf64_alpha_relax_with_lituse (info, symval, irel, irelend)
info->changed_contents = true;
break;
- case 3: /* CALL FORMAT */
+ case LITUSE_ALPHA_JSR:
+ case LITUSE_ALPHA_TLSGD:
+ case LITUSE_ALPHA_TLSLDM:
{
- /* If not zero, place to jump without needing pv. */
- bfd_vma optdest = elf64_alpha_relax_opt_call (info, symval);
- bfd_vma org = (info->sec->output_section->vma
- + info->sec->output_offset
- + urel->r_offset + 4);
+ bfd_vma optdest, org;
bfd_signed_vma odisp;
+ /* If not zero, place to jump without needing pv. */
+ optdest = elf64_alpha_relax_opt_call (info, symval);
+ org = (info->sec->output_section->vma
+ + info->sec->output_offset
+ + urel->r_offset + 4);
odisp = (optdest ? optdest : symval) - org;
+
if (odisp >= -0x400000 && odisp < 0x400000)
{
Elf_Internal_Rela *xrel;
@@ -1180,10 +1450,11 @@ elf64_alpha_relax_with_lituse (info, symval, irel, irelend)
{
Elf_Internal_Rela *gpdisp
= (elf64_alpha_find_reloc_at_ofs
- (irel, irelend, urel->r_offset + 4, R_ALPHA_GPDISP));
+ (info->relocs, irelend, urel->r_offset + 4,
+ R_ALPHA_GPDISP));
if (gpdisp)
{
- bfd_byte *p_ldah = info->contents + gpdisp->r_offset;
+ bfd_byte *p_ldah = info->contents + gpdisp->r_offset;
bfd_byte *p_lda = p_ldah + gpdisp->r_addend;
unsigned int ldah = bfd_get_32 (info->abfd, p_ldah);
unsigned int lda = bfd_get_32 (info->abfd, p_lda);
@@ -1213,14 +1484,17 @@ elf64_alpha_relax_with_lituse (info, symval, irel, irelend)
got entry by one, possibly eliminating it. */
if (all_optimized)
{
- info->gotent->use_count -= 1;
- alpha_elf_tdata (info->gotent->gotobj)->total_got_entries -= 1;
- if (!info->h)
- alpha_elf_tdata (info->gotent->gotobj)->n_local_got_entries -= 1;
+ if (--info->gotent->use_count == 0)
+ {
+ int sz = alpha_got_entry_size (R_ALPHA_LITERAL);
+ alpha_elf_tdata (info->gotobj)->total_got_size -= sz;
+ if (!info->h)
+ alpha_elf_tdata (info->gotobj)->local_got_size -= sz;
+ }
/* If the literal instruction is no longer needed (it may have been
- reused. We can eliminate it.
- ??? For now, I don't want to deal with compacting the section,
+ reused. We can eliminate it. */
+ /* ??? For now, I don't want to deal with compacting the section,
so just nop it out. */
if (!lit_reused)
{
@@ -1233,7 +1507,7 @@ elf64_alpha_relax_with_lituse (info, symval, irel, irelend)
}
}
- return irel + count;
+ return true;
}
static bfd_vma
@@ -1309,10 +1583,11 @@ elf64_alpha_relax_opt_call (info, symval)
}
static boolean
-elf64_alpha_relax_without_lituse (info, symval, irel)
+elf64_alpha_relax_got_load (info, symval, irel, r_type)
struct alpha_relax_info *info;
bfd_vma symval;
Elf_Internal_Rela *irel;
+ unsigned long r_type;
{
unsigned int insn;
bfd_signed_vma disp;
@@ -1322,37 +1597,74 @@ elf64_alpha_relax_without_lituse (info, symval, irel)
if (insn >> 26 != OP_LDQ)
{
+ reloc_howto_type *howto = elf64_alpha_howto_table + r_type;
((*_bfd_error_handler)
- ("%s: %s+0x%lx: warning: LITERAL relocation against unexpected insn",
+ ("%s: %s+0x%lx: warning: %s relocation against unexpected insn",
bfd_archive_filename (info->abfd), info->sec->name,
- (unsigned long) irel->r_offset));
+ (unsigned long) irel->r_offset, howto->name));
return true;
}
- /* So we aren't told much. Do what we can with the address load and
- fake the rest. All of the optimizations here require that the
- offset from the GP fit in 16 bits. */
+ /* Can't relax dynamic symbols. */
+ if (alpha_elf_dynamic_symbol_p (&info->h->root, info->link_info))
+ return true;
- disp = symval - info->gp;
- if (disp < -0x8000 || disp >= 0x8000)
+ /* Can't use local-exec relocations in shared libraries. */
+ if (r_type == R_ALPHA_GOTTPREL && info->link_info->shared)
return true;
- /* On the LITERAL instruction itself, consider exchanging
- `ldq R,X(gp)' for `lda R,Y(gp)'. */
+ if (r_type == R_ALPHA_LITERAL)
+ disp = symval - info->gp;
+ else
+ {
+ bfd_vma dtp_base, tp_base;
+
+ BFD_ASSERT (info->tls_segment != NULL);
+ dtp_base = alpha_get_dtprel_base (info->tls_segment);
+ tp_base = alpha_get_tprel_base (info->tls_segment);
+ disp = symval - (r_type == R_ALPHA_GOTDTPREL ? dtp_base : tp_base);
+ }
- insn = (OP_LDA << 26) | (insn & 0x03ff0000);
+ if (disp < -0x8000 || disp >= 0x8000)
+ return true;
+
+ /* Exchange LDQ for LDA. In the case of the TLS relocs, we're loading
+ a constant, so force the base register to be $31. */
+ if (r_type == R_ALPHA_LITERAL)
+ insn = (OP_LDA << 26) | (insn & 0x03ff0000);
+ else
+ insn = (OP_LDA << 26) | (insn & (31 << 21)) | (31 << 16);
bfd_put_32 (info->abfd, (bfd_vma) insn, info->contents + irel->r_offset);
info->changed_contents = true;
- irel->r_info = ELF64_R_INFO (ELF64_R_SYM (irel->r_info), R_ALPHA_GPREL16);
+ switch (r_type)
+ {
+ case R_ALPHA_LITERAL:
+ r_type = R_ALPHA_GPREL16;
+ break;
+ case R_ALPHA_GOTDTPREL:
+ r_type = R_ALPHA_DTPREL16;
+ break;
+ case R_ALPHA_GOTTPREL:
+ r_type = R_ALPHA_TPREL16;
+ break;
+ default:
+ BFD_ASSERT (0);
+ return false;
+ }
+
+ irel->r_info = ELF64_R_INFO (ELF64_R_SYM (irel->r_info), r_type);
info->changed_relocs = true;
/* Reduce the use count on this got entry by one, possibly
eliminating it. */
- info->gotent->use_count -= 1;
- alpha_elf_tdata (info->gotent->gotobj)->total_got_entries -= 1;
- if (!info->h)
- alpha_elf_tdata (info->gotent->gotobj)->n_local_got_entries -= 1;
+ if (--info->gotent->use_count == 0)
+ {
+ int sz = alpha_got_entry_size (r_type);
+ alpha_elf_tdata (info->gotobj)->total_got_size -= sz;
+ if (!info->h)
+ alpha_elf_tdata (info->gotobj)->local_got_size -= sz;
+ }
/* ??? Search forward through this basic block looking for insns
that use the target register. Stop after an insn modifying the
@@ -1371,6 +1683,353 @@ elf64_alpha_relax_without_lituse (info, symval, irel)
}
static boolean
+elf64_alpha_relax_gprelhilo (info, symval, irel, hi)
+ struct alpha_relax_info *info;
+ bfd_vma symval;
+ Elf_Internal_Rela *irel;
+ boolean hi;
+{
+ unsigned int insn;
+ bfd_signed_vma disp;
+ bfd_byte *pos = info->contents + irel->r_offset;
+
+ /* ??? This assumes that the compiler doesn't render
+
+ array[i]
+ as
+ ldah t, array(gp) !gprelhigh
+ s8addl i, t, t
+ ldq r, array(t) !gprellow
+
+ which would indeed be the most efficient way to implement this. */
+
+ return true;
+
+ disp = symval - info->gp;
+ if (disp < -0x8000 || disp >= 0x8000)
+ return true;
+
+ if (hi)
+ {
+ /* Nop out the high instruction. */
+
+ bfd_put_32 (info->abfd, (bfd_vma) INSN_UNOP, pos);
+ info->changed_contents = true;
+
+ irel->r_info = ELF64_R_INFO (0, R_ALPHA_NONE);
+ irel->r_addend = 0;
+ info->changed_relocs = true;
+ }
+ else
+ {
+ /* Adjust the low instruction to reference GP directly. */
+
+ insn = bfd_get_32 (info->abfd, pos);
+ insn = (insn & 0xffe00000) | (29 << 16);
+ bfd_put_32 (info->abfd, (bfd_vma) insn, pos);
+ info->changed_contents = true;
+
+ irel->r_info = ELF64_R_INFO (ELF64_R_SYM (irel->r_info),
+ R_ALPHA_GPREL16);
+ info->changed_relocs = true;
+ }
+
+ return true;
+}
+
+static boolean
+elf64_alpha_relax_tls_get_addr (info, symval, irel, is_gd)
+ struct alpha_relax_info *info;
+ bfd_vma symval;
+ Elf_Internal_Rela *irel;
+ boolean is_gd;
+{
+ bfd_byte *pos[5];
+ unsigned int insn;
+ Elf_Internal_Rela *gpdisp, *hint;
+ boolean dynamic, use_gottprel;
+
+ dynamic = alpha_elf_dynamic_symbol_p (&info->h->root, info->link_info);
+
+ /* ??? For LD relaxation, we need a symbol referencing the beginning
+ of the TLS segment. */
+ if (!is_gd)
+ return true;
+
+ /* If a TLS symbol is accessed using IE at least once, there is no point
+ to use dynamic model for it. */
+ if (is_gd && info->h && (info->h->flags & ALPHA_ELF_LINK_HASH_TLS_IE))
+ ;
+
+ /* If the symbol is local, and we've already committed to DF_STATIC_TLS,
+ then we might as well relax to IE. */
+ else if (info->link_info->shared && !dynamic
+ && (info->link_info->flags & DF_STATIC_TLS))
+ ;
+
+ /* Otherwise we must be building an executable to do anything. */
+ else if (info->link_info->shared)
+ return true;
+
+ /* The TLSGD/TLSLDM relocation must be followed by a LITERAL and
+ the matching LITUSE_TLS relocations. */
+ if (irel + 2 >= info->relend)
+ return true;
+ if (ELF64_R_TYPE (irel[1].r_info) != R_ALPHA_LITERAL
+ || ELF64_R_TYPE (irel[2].r_info) != R_ALPHA_LITUSE
+ || irel[2].r_addend != (is_gd ? LITUSE_ALPHA_TLSGD : LITUSE_ALPHA_TLSLDM))
+ return true;
+
+ /* There must be a GPDISP relocation positioned immediately after the
+ LITUSE relocation. */
+ gpdisp = elf64_alpha_find_reloc_at_ofs (info->relocs, info->relend,
+ irel[2].r_offset + 4, R_ALPHA_GPDISP);
+ if (!gpdisp)
+ return true;
+
+ pos[0] = info->contents + irel[0].r_offset;
+ pos[1] = info->contents + irel[1].r_offset;
+ pos[2] = info->contents + irel[2].r_offset;
+ pos[3] = info->contents + gpdisp->r_offset;
+ pos[4] = pos[3] + gpdisp->r_addend;
+
+ /* Only positions 0 and 1 are allowed to be out of order. */
+ if (pos[1] < pos[0])
+ {
+ bfd_byte *tmp = pos[0];
+ pos[0] = pos[1];
+ pos[1] = tmp;
+ }
+ if (pos[1] >= pos[2] || pos[2] >= pos[3] || pos[3] >= pos[4])
+ return true;
+
+ /* Reduce the use count on the LITERAL relocation. Do this before we
+ smash the symndx when we adjust the relocations below. */
+ {
+ struct alpha_elf_got_entry *lit_gotent;
+ struct alpha_elf_link_hash_entry *lit_h;
+ unsigned long indx;
+
+ BFD_ASSERT (ELF64_R_SYM (irel[1].r_info) >= info->symtab_hdr->sh_info);
+ indx = ELF64_R_SYM (irel[1].r_info) - info->symtab_hdr->sh_info;
+ lit_h = alpha_elf_sym_hashes (info->abfd)[indx];
+
+ while (lit_h->root.root.type == bfd_link_hash_indirect
+ || lit_h->root.root.type == bfd_link_hash_warning)
+ lit_h = (struct alpha_elf_link_hash_entry *) lit_h->root.root.u.i.link;
+
+ for (lit_gotent = lit_h->got_entries; lit_gotent ;
+ lit_gotent = lit_gotent->next)
+ if (lit_gotent->gotobj == info->gotobj
+ && lit_gotent->reloc_type == R_ALPHA_LITERAL
+ && lit_gotent->addend == irel[1].r_addend)
+ break;
+ BFD_ASSERT (lit_gotent);
+
+ if (--lit_gotent->use_count == 0)
+ {
+ int sz = alpha_got_entry_size (R_ALPHA_LITERAL);
+ alpha_elf_tdata (info->gotobj)->total_got_size -= sz;
+ }
+ }
+
+ /* Change
+
+ lda $16,x($gp) !tlsgd!1
+ ldq $27,__tls_get_addr($gp) !literal!1
+ jsr $26,($27)__tls_get_addr !lituse_tlsgd!1
+ ldah $29,0($26) !gpdisp!2
+ lda $29,0($29) !gpdisp!2
+ to
+ ldq $16,x($gp) !gottprel
+ unop
+ call_pal rduniq
+ addq $16,$0,$0
+ unop
+ or the first pair to
+ lda $16,x($gp) !tprel
+ unop
+ or
+ ldah $16,x($gp) !tprelhi
+ lda $16,x($16) !tprello
+
+ as appropriate. */
+
+ use_gottprel = false;
+ switch (!dynamic && !info->link_info->shared)
+ {
+ case 1:
+ {
+ bfd_vma tp_base;
+ bfd_signed_vma disp;
+
+ BFD_ASSERT (info->tls_segment != NULL);
+ tp_base = alpha_get_tprel_base (info->tls_segment);
+ disp = symval - tp_base;
+
+ if (disp >= -0x8000 && disp < 0x8000)
+ {
+ insn = (OP_LDA << 26) | (16 << 21) | (31 << 16);
+ bfd_put_32 (info->abfd, (bfd_vma) insn, pos[0]);
+ bfd_put_32 (info->abfd, (bfd_vma) INSN_UNOP, pos[1]);
+
+ irel[0].r_offset = pos[0] - info->contents;
+ irel[0].r_info = ELF64_R_INFO (ELF64_R_SYM (irel->r_info),
+ R_ALPHA_TPREL16);
+ irel[1].r_info = ELF64_R_INFO (0, R_ALPHA_NONE);
+ break;
+ }
+ else if (disp >= -(bfd_signed_vma) 0x80000000
+ && disp < (bfd_signed_vma) 0x7fff8000)
+ {
+ insn = (OP_LDAH << 26) | (16 << 21) | (31 << 16);
+ bfd_put_32 (info->abfd, (bfd_vma) insn, pos[0]);
+ insn = (OP_LDA << 26) | (16 << 21) | (16 << 16);
+ bfd_put_32 (info->abfd, (bfd_vma) insn, pos[1]);
+
+ irel[0].r_offset = pos[0] - info->contents;
+ irel[0].r_info = ELF64_R_INFO (ELF64_R_SYM (irel->r_info),
+ R_ALPHA_TPRELHI);
+ irel[1].r_offset = pos[1] - info->contents;
+ irel[1].r_info = ELF64_R_INFO (ELF64_R_SYM (irel->r_info),
+ R_ALPHA_TPRELLO);
+ break;
+ }
+ }
+ /* FALLTHRU */
+
+ default:
+ use_gottprel = true;
+
+ insn = (OP_LDQ << 26) | (16 << 21) | (29 << 16);
+ bfd_put_32 (info->abfd, (bfd_vma) insn, pos[0]);
+ bfd_put_32 (info->abfd, (bfd_vma) INSN_UNOP, pos[1]);
+
+ irel[0].r_offset = pos[0] - info->contents;
+ irel[0].r_info = ELF64_R_INFO (ELF64_R_SYM (irel->r_info),
+ R_ALPHA_GOTTPREL);
+ irel[1].r_info = ELF64_R_INFO (0, R_ALPHA_NONE);
+ break;
+ }
+
+ bfd_put_32 (info->abfd, (bfd_vma) INSN_RDUNIQ, pos[2]);
+
+ insn = INSN_ADDQ | (16 << 21) | (0 << 16) | (0 << 0);
+ bfd_put_32 (info->abfd, (bfd_vma) insn, pos[3]);
+
+ bfd_put_32 (info->abfd, (bfd_vma) INSN_UNOP, pos[4]);
+
+ irel[2].r_info = ELF64_R_INFO (0, R_ALPHA_NONE);
+ gpdisp->r_info = ELF64_R_INFO (0, R_ALPHA_NONE);
+
+ hint = elf64_alpha_find_reloc_at_ofs (info->relocs, info->relend,
+ irel[2].r_offset, R_ALPHA_HINT);
+ if (hint)
+ hint->r_info = ELF64_R_INFO (0, R_ALPHA_NONE);
+
+ info->changed_contents = true;
+ info->changed_relocs = true;
+
+ /* Reduce the use count on the TLSGD/TLSLDM relocation. */
+ if (--info->gotent->use_count == 0)
+ {
+ int sz = alpha_got_entry_size (info->gotent->reloc_type);
+ alpha_elf_tdata (info->gotobj)->total_got_size -= sz;
+ if (!info->h)
+ alpha_elf_tdata (info->gotobj)->local_got_size -= sz;
+ }
+
+ /* If we've switched to a GOTTPREL relocation, increment the reference
+ count on that got entry. */
+ if (use_gottprel)
+ {
+ struct alpha_elf_got_entry *tprel_gotent;
+
+ for (tprel_gotent = *info->first_gotent; tprel_gotent ;
+ tprel_gotent = tprel_gotent->next)
+ if (tprel_gotent->gotobj == info->gotobj
+ && tprel_gotent->reloc_type == R_ALPHA_GOTTPREL
+ && tprel_gotent->addend == irel->r_addend)
+ break;
+ if (tprel_gotent)
+ tprel_gotent->use_count++;
+ else
+ {
+ if (info->gotent->use_count == 0)
+ tprel_gotent = info->gotent;
+ else
+ {
+ tprel_gotent = (struct alpha_elf_got_entry *)
+ bfd_alloc (info->abfd, sizeof (struct alpha_elf_got_entry));
+ if (!tprel_gotent)
+ return false;
+
+ tprel_gotent->next = *info->first_gotent;
+ *info->first_gotent = tprel_gotent;
+
+ tprel_gotent->gotobj = info->gotobj;
+ tprel_gotent->addend = irel->r_addend;
+ tprel_gotent->got_offset = -1;
+ tprel_gotent->reloc_done = 0;
+ tprel_gotent->reloc_xlated = 0;
+ }
+
+ tprel_gotent->use_count = 1;
+ tprel_gotent->reloc_type = R_ALPHA_GOTTPREL;
+ }
+ }
+
+ return true;
+}
+
+static struct elf_link_tls_segment *
+elf64_alpha_relax_find_tls_segment (info, seg)
+ struct alpha_relax_info *info;
+ struct elf_link_tls_segment *seg;
+{
+ bfd *output_bfd = info->sec->output_section->owner;
+ asection *o;
+ unsigned int align;
+ bfd_vma base, end;
+
+ for (o = output_bfd->sections; o ; o = o->next)
+ if ((o->flags & SEC_THREAD_LOCAL) != 0
+ && (o->flags & SEC_LOAD) != 0)
+ break;
+ if (!o)
+ return NULL;
+
+ base = o->vma;
+ align = 0;
+
+ do
+ {
+ bfd_vma size;
+
+ if (bfd_get_section_alignment (output_bfd, o) > align)
+ align = bfd_get_section_alignment (output_bfd, o);
+
+ size = o->_raw_size;
+ if (size == 0 && (o->flags & SEC_HAS_CONTENTS) == 0)
+ {
+ struct bfd_link_order *lo;
+ for (lo = o->link_order_head; lo ; lo = lo->next)
+ if (size < lo->offset + lo->size)
+ size = lo->offset + lo->size;
+ }
+ end = o->vma + size;
+ o = o->next;
+ }
+ while (o && (o->flags & SEC_THREAD_LOCAL));
+
+ seg->start = base;
+ seg->size = end - base;
+ seg->align = align;
+
+ return seg;
+}
+
+static boolean
elf64_alpha_relax_section (abfd, sec, link_info, again)
bfd *abfd;
asection *sec;
@@ -1383,11 +2042,12 @@ elf64_alpha_relax_section (abfd, sec, link_info, again)
Elf_Internal_Rela *free_relocs = NULL;
Elf_Internal_Rela *irel, *irelend;
bfd_byte *free_contents = NULL;
- Elf64_External_Sym *extsyms = NULL;
+ Elf64_External_Sym *extsyms;
Elf64_External_Sym *free_extsyms = NULL;
Elf_External_Sym_Shndx *shndx_buf = NULL;
struct alpha_elf_got_entry **local_got_entries;
struct alpha_relax_info info;
+ struct elf_link_tls_segment tls_segment;
/* We are not currently changing any sizes, so only one pass. */
*again = false;
@@ -1418,83 +2078,89 @@ elf64_alpha_relax_section (abfd, sec, link_info, again)
info.abfd = abfd;
info.sec = sec;
info.link_info = link_info;
+ info.symtab_hdr = symtab_hdr;
info.relocs = internal_relocs;
info.relend = irelend = internal_relocs + sec->reloc_count;
- /* Find the GP for this object. */
+ /* Find the GP for this object. Do not store the result back via
+ _bfd_set_gp_value, since this could change again before final. */
info.gotobj = alpha_elf_tdata (abfd)->gotobj;
if (info.gotobj)
{
asection *sgot = alpha_elf_tdata (info.gotobj)->got;
- info.gp = _bfd_get_gp_value (info.gotobj);
- if (info.gp == 0)
- {
- info.gp = (sgot->output_section->vma
- + sgot->output_offset
- + 0x8000);
- _bfd_set_gp_value (info.gotobj, info.gp);
- }
+ info.gp = (sgot->output_section->vma
+ + sgot->output_offset
+ + 0x8000);
}
- for (irel = internal_relocs; irel < irelend; irel++)
+ /* Get the section contents. */
+ if (elf_section_data (sec)->this_hdr.contents != NULL)
+ info.contents = elf_section_data (sec)->this_hdr.contents;
+ else
{
- bfd_vma symval;
- Elf_Internal_Sym isym;
- struct alpha_elf_got_entry *gotent;
-
- if (ELF64_R_TYPE (irel->r_info) != (int) R_ALPHA_LITERAL)
- continue;
-
- /* Get the section contents. */
+ info.contents = (bfd_byte *) bfd_malloc (sec->_raw_size);
if (info.contents == NULL)
- {
- if (elf_section_data (sec)->this_hdr.contents != NULL)
- info.contents = elf_section_data (sec)->this_hdr.contents;
- else
- {
- info.contents = (bfd_byte *) bfd_malloc (sec->_raw_size);
- if (info.contents == NULL)
- goto error_return;
- free_contents = info.contents;
+ goto error_return;
+ free_contents = info.contents;
- if (! bfd_get_section_contents (abfd, sec, info.contents,
- (file_ptr) 0, sec->_raw_size))
- goto error_return;
- }
- }
+ if (! bfd_get_section_contents (abfd, sec, info.contents,
+ (file_ptr) 0, sec->_raw_size))
+ goto error_return;
+ }
- /* Read this BFD's symbols if we haven't done so already. */
+ /* Read this BFD's symbols. */
+ if (symtab_hdr->contents != NULL)
+ extsyms = (Elf64_External_Sym *) symtab_hdr->contents;
+ else
+ {
+ bfd_size_type amt = symtab_hdr->sh_info * sizeof (Elf64_External_Sym);
+ extsyms = (Elf64_External_Sym *) bfd_malloc (amt);
if (extsyms == NULL)
- {
- bfd_size_type amt;
+ goto error_return;
+ free_extsyms = extsyms;
+ if (bfd_seek (abfd, symtab_hdr->sh_offset, SEEK_SET) != 0
+ || bfd_bread ((PTR) extsyms, amt, abfd) != amt)
+ goto error_return;
+ }
- if (symtab_hdr->contents != NULL)
- extsyms = (Elf64_External_Sym *) symtab_hdr->contents;
- else
- {
- amt = symtab_hdr->sh_info;
- amt *= sizeof (Elf64_External_Sym);
- extsyms = (Elf64_External_Sym *) bfd_malloc (amt);
- if (extsyms == NULL)
- goto error_return;
- free_extsyms = extsyms;
- if (bfd_seek (abfd, symtab_hdr->sh_offset, SEEK_SET) != 0
- || bfd_bread ((PTR) extsyms, amt, abfd) != amt)
- goto error_return;
- }
+ shndx_hdr = &elf_tdata (abfd)->symtab_shndx_hdr;
+ if (shndx_hdr->sh_size != 0)
+ {
+ bfd_size_type amt;
+ amt = symtab_hdr->sh_info * sizeof (Elf_External_Sym_Shndx);
+ shndx_buf = (Elf_External_Sym_Shndx *) bfd_malloc (amt);
+ if (shndx_buf == NULL)
+ goto error_return;
+ if (bfd_seek (abfd, shndx_hdr->sh_offset, SEEK_SET) != 0
+ || bfd_bread ((PTR) shndx_buf, amt, abfd) != amt)
+ goto error_return;
+ }
- shndx_hdr = &elf_tdata (abfd)->symtab_shndx_hdr;
- if (shndx_hdr->sh_size != 0)
- {
- amt = symtab_hdr->sh_info;
- amt *= sizeof (Elf_External_Sym_Shndx);
- shndx_buf = (Elf_External_Sym_Shndx *) bfd_malloc (amt);
- if (shndx_buf == NULL)
- goto error_return;
- if (bfd_seek (abfd, shndx_hdr->sh_offset, SEEK_SET) != 0
- || bfd_bread ((PTR) shndx_buf, amt, abfd) != amt)
- goto error_return;
- }
+ /* Compute the TLS segment information. The version normally found in
+ elf_hash_table (link_info)->tls_segment isn't built until final_link.
+ ??? Probably should look into extracting this into a common function. */
+ info.tls_segment = elf64_alpha_relax_find_tls_segment (&info, &tls_segment);
+
+ for (irel = internal_relocs; irel < irelend; irel++)
+ {
+ bfd_vma symval;
+ Elf_Internal_Sym isym;
+ struct alpha_elf_got_entry *gotent;
+ unsigned long r_type = ELF64_R_TYPE (irel->r_info);
+
+ /* Early exit for unhandled or unrelaxable relocations. */
+ switch (r_type)
+ {
+ case R_ALPHA_LITERAL:
+ case R_ALPHA_GPRELHIGH:
+ case R_ALPHA_GPRELLOW:
+ case R_ALPHA_GOTDTPREL:
+ case R_ALPHA_GOTTPREL:
+ case R_ALPHA_TLSGD:
+ case R_ALPHA_TLSLDM:
+ break;
+ default:
+ continue;
}
/* Get the value of the symbol referred to by the reloc. */
@@ -1506,9 +2172,10 @@ elf64_alpha_relax_section (abfd, sec, link_info, again)
esym = extsyms + ELF64_R_SYM (irel->r_info);
shndx = shndx_buf + (shndx_buf ? ELF64_R_SYM (irel->r_info) : 0);
- bfd_elf64_swap_symbol_in (abfd, esym, shndx, &isym);
+ bfd_elf64_swap_symbol_in (abfd, (const PTR) esym, (const PTR) shndx,
+ &isym);
if (isym.st_shndx == SHN_UNDEF)
- info.tsec = bfd_und_section_ptr;
+ continue;
else if (isym.st_shndx == SHN_ABS)
info.tsec = bfd_abs_section_ptr;
else if (isym.st_shndx == SHN_COMMON)
@@ -1518,7 +2185,7 @@ elf64_alpha_relax_section (abfd, sec, link_info, again)
info.h = NULL;
info.other = isym.st_other;
- gotent = local_got_entries[ELF64_R_SYM(irel->r_info)];
+ info.first_gotent = &local_got_entries[ELF64_R_SYM(irel->r_info)];
symval = isym.st_value;
}
else
@@ -1534,62 +2201,93 @@ elf64_alpha_relax_section (abfd, sec, link_info, again)
|| h->root.root.type == bfd_link_hash_warning)
h = (struct alpha_elf_link_hash_entry *)h->root.root.u.i.link;
- /* We can't do anthing with undefined or dynamic symbols. */
- if (h->root.root.type == bfd_link_hash_undefined
- || h->root.root.type == bfd_link_hash_undefweak
- || alpha_elf_dynamic_symbol_p (&h->root, link_info))
+ /* If the symbol is undefined, we can't do anything with it. */
+ if (h->root.root.type == bfd_link_hash_undefweak
+ || h->root.root.type == bfd_link_hash_undefined)
+ continue;
+
+ /* If the symbol isn't defined in the current module, again
+ we can't do anything. */
+ if (!(h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))
continue;
info.h = h;
info.tsec = h->root.root.u.def.section;
info.other = h->root.other;
- gotent = h->got_entries;
+ info.first_gotent = &h->got_entries;
symval = h->root.root.u.def.value;
}
/* Search for the got entry to be used by this relocation. */
- while (gotent->gotobj != info.gotobj || gotent->addend != irel->r_addend)
- gotent = gotent->next;
+ for (gotent = *info.first_gotent; gotent ; gotent = gotent->next)
+ if (gotent->gotobj == info.gotobj
+ && gotent->reloc_type == r_type
+ && gotent->addend == irel->r_addend)
+ break;
info.gotent = gotent;
symval += info.tsec->output_section->vma + info.tsec->output_offset;
symval += irel->r_addend;
- BFD_ASSERT(info.gotent != NULL);
+ switch (r_type)
+ {
+ case R_ALPHA_LITERAL:
+ BFD_ASSERT(info.gotent != NULL);
- /* If there exist LITUSE relocations immediately following, this
- opens up all sorts of interesting optimizations, because we
- now know every location that this address load is used. */
+ /* If there exist LITUSE relocations immediately following, this
+ opens up all sorts of interesting optimizations, because we
+ now know every location that this address load is used. */
+ if (irel+1 < irelend
+ && ELF64_R_TYPE (irel[1].r_info) == R_ALPHA_LITUSE)
+ {
+ if (!elf64_alpha_relax_with_lituse (&info, symval, irel))
+ goto error_return;
+ }
+ else
+ {
+ if (!elf64_alpha_relax_got_load (&info, symval, irel, r_type))
+ goto error_return;
+ }
+ break;
- if (irel+1 < irelend && ELF64_R_TYPE (irel[1].r_info) == R_ALPHA_LITUSE)
- {
- irel = elf64_alpha_relax_with_lituse (&info, symval, irel, irelend);
- if (irel == NULL)
+ case R_ALPHA_GPRELHIGH:
+ case R_ALPHA_GPRELLOW:
+ if (!elf64_alpha_relax_gprelhilo (&info, symval, irel,
+ r_type == R_ALPHA_GPRELHIGH))
goto error_return;
- }
- else
- {
- if (!elf64_alpha_relax_without_lituse (&info, symval, irel))
+ break;
+
+ case R_ALPHA_GOTDTPREL:
+ case R_ALPHA_GOTTPREL:
+ BFD_ASSERT(info.gotent != NULL);
+ if (!elf64_alpha_relax_got_load (&info, symval, irel, r_type))
+ goto error_return;
+ break;
+
+ case R_ALPHA_TLSGD:
+ case R_ALPHA_TLSLDM:
+ BFD_ASSERT(info.gotent != NULL);
+ if (!elf64_alpha_relax_tls_get_addr (&info, symval, irel,
+ r_type == R_ALPHA_TLSGD))
goto error_return;
+ break;
}
}
- if (!elf64_alpha_size_got_sections (abfd, link_info))
+ if (!elf64_alpha_size_plt_section (link_info))
+ return false;
+ if (!elf64_alpha_size_got_sections (link_info))
+ return false;
+ if (!elf64_alpha_size_rela_got_section (link_info))
return false;
if (info.changed_relocs)
- {
- elf_section_data (sec)->relocs = internal_relocs;
- }
+ elf_section_data (sec)->relocs = internal_relocs;
else if (free_relocs != NULL)
- {
- free (free_relocs);
- }
+ free (free_relocs);
if (info.changed_contents)
- {
- elf_section_data (sec)->this_hdr.contents = info.contents;
- }
+ elf_section_data (sec)->this_hdr.contents = info.contents;
else if (free_contents != NULL)
{
if (! link_info->keep_memory)
@@ -1643,7 +2341,7 @@ elf64_alpha_relax_section (abfd, sec, link_info, again)
#define PLT_ENTRY_WORD2 0
#define PLT_ENTRY_WORD3 0
-#define MAX_GOT_ENTRIES (64*1024 / 8)
+#define MAX_GOT_SIZE (64*1024)
#define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so"
@@ -1656,7 +2354,7 @@ static boolean
elf64_alpha_section_from_shdr (abfd, hdr, name)
bfd *abfd;
Elf64_Internal_Shdr *hdr;
- char *name;
+ const char *name;
{
asection *newsect;
@@ -2244,18 +2942,86 @@ elf64_alpha_output_extsym (h, data)
return true;
}
+
+/* Search for and possibly create a got entry. */
-/* FIXME: Create a runtime procedure table from the .mdebug section.
-
-static boolean
-mips_elf_create_procedure_table (handle, abfd, info, s, debug)
- PTR handle;
+static struct alpha_elf_got_entry *
+get_got_entry (abfd, h, r_type, r_symndx, r_addend)
bfd *abfd;
- struct bfd_link_info *info;
- asection *s;
- struct ecoff_debug_info *debug;
-*/
-
+ struct alpha_elf_link_hash_entry *h;
+ unsigned long r_type, r_symndx;
+ bfd_vma r_addend;
+{
+ struct alpha_elf_got_entry *gotent;
+ struct alpha_elf_got_entry **slot;
+
+ if (h)
+ slot = &h->got_entries;
+ else
+ {
+ /* This is a local .got entry -- record for merge. */
+
+ struct alpha_elf_got_entry **local_got_entries;
+
+ local_got_entries = alpha_elf_tdata(abfd)->local_got_entries;
+ if (!local_got_entries)
+ {
+ bfd_size_type size;
+ Elf_Internal_Shdr *symtab_hdr;
+
+ symtab_hdr = &elf_tdata(abfd)->symtab_hdr;
+ size = symtab_hdr->sh_info;
+ size *= sizeof (struct alpha_elf_got_entry *);
+
+ local_got_entries
+ = (struct alpha_elf_got_entry **) bfd_zalloc (abfd, size);
+ if (!local_got_entries)
+ return NULL;
+
+ alpha_elf_tdata (abfd)->local_got_entries = local_got_entries;
+ }
+
+ slot = &local_got_entries[r_symndx];
+ }
+
+ for (gotent = *slot; gotent ; gotent = gotent->next)
+ if (gotent->gotobj == abfd
+ && gotent->reloc_type == r_type
+ && gotent->addend == r_addend)
+ break;
+
+ if (!gotent)
+ {
+ int entry_size;
+ bfd_size_type amt;
+
+ amt = sizeof (struct alpha_elf_got_entry);
+ gotent = (struct alpha_elf_got_entry *) bfd_alloc (abfd, amt);
+ if (!gotent)
+ return NULL;
+
+ gotent->gotobj = abfd;
+ gotent->addend = r_addend;
+ gotent->got_offset = -1;
+ gotent->use_count = 1;
+ gotent->reloc_type = r_type;
+ gotent->reloc_done = 0;
+ gotent->reloc_xlated = 0;
+
+ gotent->next = *slot;
+ *slot = gotent;
+
+ entry_size = alpha_got_entry_size (r_type);
+ alpha_elf_tdata (abfd)->total_got_size += entry_size;
+ if (!h)
+ alpha_elf_tdata(abfd)->local_got_size += entry_size;
+ }
+ else
+ gotent->use_count += 1;
+
+ return gotent;
+}
+
/* Handle dynamic relocations when doing an Alpha ELF link. */
static boolean
@@ -2270,9 +3036,8 @@ elf64_alpha_check_relocs (abfd, info, sec, relocs)
const char *rel_sec_name;
Elf_Internal_Shdr *symtab_hdr;
struct alpha_elf_link_hash_entry **sym_hashes;
- struct alpha_elf_got_entry **local_got_entries;
const Elf_Internal_Rela *rel, *relend;
- int got_created;
+ boolean got_created;
bfd_size_type amt;
if (info->relocateable)
@@ -2286,14 +3051,23 @@ elf64_alpha_check_relocs (abfd, info, sec, relocs)
rel_sec_name = NULL;
symtab_hdr = &elf_tdata(abfd)->symtab_hdr;
sym_hashes = alpha_elf_sym_hashes(abfd);
- local_got_entries = alpha_elf_tdata(abfd)->local_got_entries;
- got_created = 0;
+ got_created = false;
relend = relocs + sec->reloc_count;
for (rel = relocs; rel < relend; ++rel)
{
+ enum {
+ NEED_GOT = 1,
+ NEED_GOT_ENTRY = 2,
+ NEED_DYNREL = 4
+ };
+
unsigned long r_symndx, r_type;
struct alpha_elf_link_hash_entry *h;
+ unsigned int gotent_flags;
+ boolean maybe_dynamic;
+ unsigned int need;
+ bfd_vma addend;
r_symndx = ELF64_R_SYM (rel->r_info);
if (r_symndx < symtab_hdr->sh_info)
@@ -2308,125 +3082,40 @@ elf64_alpha_check_relocs (abfd, info, sec, relocs)
h->root.elf_link_hash_flags |= ELF_LINK_HASH_REF_REGULAR;
}
+
+ /* We can only get preliminary data on whether a symbol is
+ locally or externally defined, as not all of the input files
+ have yet been processed. Do something with what we know, as
+ this may help reduce memory usage and processing time later. */
+ maybe_dynamic = false;
+ if (h && ((info->shared
+ && (!info->symbolic || info->allow_shlib_undefined))
+ || ! (h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)
+ || h->root.root.type == bfd_link_hash_defweak))
+ maybe_dynamic = true;
+
+ need = 0;
+ gotent_flags = 0;
r_type = ELF64_R_TYPE (rel->r_info);
+ addend = rel->r_addend;
switch (r_type)
{
case R_ALPHA_LITERAL:
- {
- struct alpha_elf_got_entry *gotent;
- int flags = 0;
-
- if (h)
- {
- /* Search for and possibly create a got entry. */
- for (gotent = h->got_entries; gotent ; gotent = gotent->next)
- if (gotent->gotobj == abfd &&
- gotent->addend == rel->r_addend)
- break;
-
- if (!gotent)
- {
- amt = sizeof (struct alpha_elf_got_entry);
- gotent = ((struct alpha_elf_got_entry *)
- bfd_alloc (abfd, amt));
- if (!gotent)
- return false;
-
- gotent->gotobj = abfd;
- gotent->addend = rel->r_addend;
- gotent->got_offset = -1;
- gotent->flags = 0;
- gotent->use_count = 1;
-
- gotent->next = h->got_entries;
- h->got_entries = gotent;
-
- alpha_elf_tdata (abfd)->total_got_entries++;
- }
- else
- gotent->use_count += 1;
- }
- else
- {
- /* This is a local .got entry -- record for merge. */
- if (!local_got_entries)
- {
- bfd_size_type size;
- size = symtab_hdr->sh_info;
- size *= sizeof (struct alpha_elf_got_entry *);
-
- local_got_entries = ((struct alpha_elf_got_entry **)
- bfd_alloc (abfd, size));
- if (!local_got_entries)
- return false;
-
- memset (local_got_entries, 0, (size_t) size);
- alpha_elf_tdata (abfd)->local_got_entries =
- local_got_entries;
- }
-
- for (gotent = local_got_entries[ELF64_R_SYM(rel->r_info)];
- gotent != NULL && gotent->addend != rel->r_addend;
- gotent = gotent->next)
- continue;
- if (!gotent)
- {
- amt = sizeof (struct alpha_elf_got_entry);
- gotent = ((struct alpha_elf_got_entry *)
- bfd_alloc (abfd, amt));
- if (!gotent)
- return false;
-
- gotent->gotobj = abfd;
- gotent->addend = rel->r_addend;
- gotent->got_offset = -1;
- gotent->flags = 0;
- gotent->use_count = 1;
-
- gotent->next = local_got_entries[ELF64_R_SYM(rel->r_info)];
- local_got_entries[ELF64_R_SYM(rel->r_info)] = gotent;
-
- alpha_elf_tdata(abfd)->total_got_entries++;
- alpha_elf_tdata(abfd)->n_local_got_entries++;
- }
- else
- gotent->use_count += 1;
- }
-
- /* Remember how this literal is used from its LITUSEs.
- This will be important when it comes to decide if we can
- create a .plt entry for a function symbol. */
- if (rel+1 < relend
- && ELF64_R_TYPE (rel[1].r_info) == R_ALPHA_LITUSE)
- {
- do
- {
- ++rel;
- if (rel->r_addend >= 1 && rel->r_addend <= 3)
- flags |= 1 << rel->r_addend;
- }
- while (rel+1 < relend &&
- ELF64_R_TYPE (rel[1].r_info) == R_ALPHA_LITUSE);
- }
- else
- {
- /* No LITUSEs -- presumably the address is not being
- loaded for nothing. */
- flags = ALPHA_ELF_LINK_HASH_LU_ADDR;
- }
-
- gotent->flags |= flags;
- if (h)
- {
- /* Make a guess as to whether a .plt entry will be needed. */
- if ((h->flags |= flags) == ALPHA_ELF_LINK_HASH_LU_FUNC)
- h->root.elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
- else
- h->root.elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
- }
- }
- /* FALLTHRU */
+ need = NEED_GOT | NEED_GOT_ENTRY;
+
+ /* Remember how this literal is used from its LITUSEs.
+ This will be important when it comes to decide if we can
+ create a .plt entry for a function symbol. */
+ while (++rel < relend && ELF64_R_TYPE (rel->r_info) == R_ALPHA_LITUSE)
+ if (rel->r_addend >= 1 && rel->r_addend <= 5)
+ gotent_flags |= 1 << rel->r_addend;
+ --rel;
+
+ /* No LITUSEs -- presumably the address is used somehow. */
+ if (gotent_flags == 0)
+ gotent_flags = ALPHA_ELF_LINK_HASH_LU_ADDR;
+ break;
case R_ALPHA_GPDISP:
case R_ALPHA_GPREL16:
@@ -2434,9 +3123,38 @@ elf64_alpha_check_relocs (abfd, info, sec, relocs)
case R_ALPHA_GPRELHIGH:
case R_ALPHA_GPRELLOW:
case R_ALPHA_BRSGP:
- /* We don't actually use the .got here, but the sections must
- be created before the linker maps input sections to output
- sections. */
+ need = NEED_GOT;
+ break;
+
+ case R_ALPHA_REFLONG:
+ case R_ALPHA_REFQUAD:
+ if (info->shared || maybe_dynamic)
+ need = NEED_DYNREL;
+ break;
+
+ case R_ALPHA_TLSGD:
+ case R_ALPHA_TLSLDM:
+ case R_ALPHA_GOTDTPREL:
+ need = NEED_GOT | NEED_GOT_ENTRY;
+ break;
+
+ case R_ALPHA_GOTTPREL:
+ need = NEED_GOT | NEED_GOT_ENTRY;
+ gotent_flags = ALPHA_ELF_LINK_HASH_TLS_IE;
+ if (info->shared)
+ info->flags |= DF_STATIC_TLS;
+ break;
+
+ case R_ALPHA_TPREL64:
+ if (info->shared || maybe_dynamic)
+ need = NEED_DYNREL;
+ if (info->shared)
+ info->flags |= DF_STATIC_TLS;
+ break;
+ }
+
+ if (need & NEED_GOT)
+ {
if (!got_created)
{
if (!elf64_alpha_create_got_section (abfd, info))
@@ -2450,17 +3168,36 @@ elf64_alpha_check_relocs (abfd, info, sec, relocs)
got_created = 1;
}
- break;
+ }
- case R_ALPHA_SREL16:
- case R_ALPHA_SREL32:
- case R_ALPHA_SREL64:
- if (h == NULL)
- break;
- /* FALLTHRU */
+ if (need & NEED_GOT_ENTRY)
+ {
+ struct alpha_elf_got_entry *gotent;
- case R_ALPHA_REFLONG:
- case R_ALPHA_REFQUAD:
+ gotent = get_got_entry (abfd, h, r_type, r_symndx, addend);
+ if (!gotent)
+ return false;
+
+ if (gotent_flags)
+ {
+ gotent->flags |= gotent_flags;
+ if (h)
+ {
+ gotent_flags |= h->flags;
+ h->flags = gotent_flags;
+
+ /* Make a guess as to whether a .plt entry is needed. */
+ if ((gotent_flags & ALPHA_ELF_LINK_HASH_LU_FUNC)
+ && !(gotent_flags & ~ALPHA_ELF_LINK_HASH_LU_FUNC))
+ h->root.elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
+ else
+ h->root.elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
+ }
+ }
+ }
+
+ if (need & NEED_DYNREL)
+ {
if (rel_sec_name == NULL)
{
rel_sec_name = (bfd_elf_string_from_elf_section
@@ -2530,15 +3267,15 @@ elf64_alpha_check_relocs (abfd, info, sec, relocs)
else
rent->count++;
}
- else if (info->shared && (sec->flags & SEC_ALLOC))
+ else if (info->shared)
{
/* If this is a shared library, and the section is to be
loaded into memory, we need a RELATIVE reloc. */
sreloc->_raw_size += sizeof (Elf64_External_Rela);
- if (sec->flags & SEC_READONLY)
+ if ((sec->flags & (SEC_READONLY | SEC_ALLOC))
+ == (SEC_READONLY | SEC_ALLOC))
info->flags |= DF_TEXTREL;
}
- break;
}
}
@@ -2570,7 +3307,8 @@ elf64_alpha_adjust_dynamic_symbol (info, h)
&& ((h->type == STT_FUNC
&& !(ah->flags & ALPHA_ELF_LINK_HASH_LU_ADDR))
|| (h->type == STT_NOTYPE
- && ah->flags == ALPHA_ELF_LINK_HASH_LU_FUNC))
+ && (ah->flags & ALPHA_ELF_LINK_HASH_LU_FUNC)
+ && !(ah->flags & ~ALPHA_ELF_LINK_HASH_LU_FUNC)))
/* Don't prevent otherwise valid programs from linking by attempting
to create a new .got entry somewhere. A Correct Solution would be
to add a new .got section to a new object file and let it be merged
@@ -2667,8 +3405,13 @@ elf64_alpha_merge_ind_symbols (hi, dummy)
{
gin = gi->next;
for (gs = gsh; gs ; gs = gs->next)
- if (gi->gotobj == gs->gotobj && gi->addend == gs->addend)
- goto got_found;
+ if (gi->gotobj == gs->gotobj
+ && gi->reloc_type == gs->reloc_type
+ && gi->addend == gs->addend)
+ {
+ gi->use_count += gs->use_count;
+ goto got_found;
+ }
gi->next = hs->got_entries;
hs->got_entries = gi;
got_found:;
@@ -2710,15 +3453,15 @@ static boolean
elf64_alpha_can_merge_gots (a, b)
bfd *a, *b;
{
- int total = alpha_elf_tdata (a)->total_got_entries;
+ int total = alpha_elf_tdata (a)->total_got_size;
bfd *bsub;
/* Trivial quick fallout test. */
- if (total + alpha_elf_tdata (b)->total_got_entries <= MAX_GOT_ENTRIES)
+ if (total + alpha_elf_tdata (b)->total_got_size <= MAX_GOT_SIZE)
return true;
/* By their nature, local .got entries cannot be merged. */
- if ((total += alpha_elf_tdata (b)->n_local_got_entries) > MAX_GOT_ENTRIES)
+ if ((total += alpha_elf_tdata (b)->local_got_size) > MAX_GOT_SIZE)
return false;
/* Failing the common trivial comparison, we must effectively
@@ -2749,10 +3492,13 @@ elf64_alpha_can_merge_gots (a, b)
continue;
for (ae = h->got_entries; ae ; ae = ae->next)
- if (ae->gotobj == a && ae->addend == be->addend)
+ if (ae->gotobj == a
+ && ae->reloc_type == be->reloc_type
+ && ae->addend == be->addend)
goto global_found;
- if (++total > MAX_GOT_ENTRIES)
+ total += alpha_got_entry_size (be->reloc_type);
+ if (total > MAX_GOT_SIZE)
return false;
global_found:;
}
@@ -2768,14 +3514,14 @@ static void
elf64_alpha_merge_gots (a, b)
bfd *a, *b;
{
- int total = alpha_elf_tdata (a)->total_got_entries;
+ int total = alpha_elf_tdata (a)->total_got_size;
bfd *bsub;
/* Remember local expansion. */
{
- int e = alpha_elf_tdata (b)->n_local_got_entries;
+ int e = alpha_elf_tdata (b)->local_got_size;
total += e;
- alpha_elf_tdata (a)->n_local_got_entries += e;
+ alpha_elf_tdata (a)->local_got_size += e;
}
for (bsub = b; bsub ; bsub = alpha_elf_tdata (bsub)->in_got_link_next)
@@ -2825,7 +3571,9 @@ elf64_alpha_merge_gots (a, b)
continue;
for (ae = *start; ae ; ae = ae->next)
- if (ae->gotobj == a && ae->addend == be->addend)
+ if (ae->gotobj == a
+ && ae->reloc_type == be->reloc_type
+ && ae->addend == be->addend)
{
ae->flags |= be->flags;
ae->use_count += be->use_count;
@@ -2833,7 +3581,7 @@ elf64_alpha_merge_gots (a, b)
goto global_found;
}
be->gotobj = a;
- total += 1;
+ total += alpha_got_entry_size (be->reloc_type);
global_found:;
}
@@ -2841,7 +3589,7 @@ elf64_alpha_merge_gots (a, b)
alpha_elf_tdata (bsub)->gotobj = a;
}
- alpha_elf_tdata (a)->total_got_entries = total;
+ alpha_elf_tdata (a)->total_got_size = total;
/* Merge the two in_got chains. */
{
@@ -2874,7 +3622,7 @@ elf64_alpha_calc_got_offsets_for_symbol (h, arg)
= &alpha_elf_tdata (gotent->gotobj)->got->_raw_size;
gotent->got_offset = *plge;
- *plge += 8;
+ *plge += alpha_got_entry_size (gotent->reloc_type);
}
return true;
@@ -2916,7 +3664,7 @@ elf64_alpha_calc_got_offsets (info)
if (gotent->use_count > 0)
{
gotent->got_offset = got_offset;
- got_offset += 8;
+ got_offset += alpha_got_entry_size (gotent->reloc_type);
}
}
@@ -2928,8 +3676,7 @@ elf64_alpha_calc_got_offsets (info)
/* Constructs the gots. */
static boolean
-elf64_alpha_size_got_sections (output_bfd, info)
- bfd *output_bfd ATTRIBUTE_UNUSED;
+elf64_alpha_size_got_sections (info)
struct bfd_link_info *info;
{
bfd *i, *got_list, *cur_got_obj = NULL;
@@ -2950,13 +3697,13 @@ elf64_alpha_size_got_sections (output_bfd, info)
/* We are assuming no merging has yet ocurred. */
BFD_ASSERT (this_got == i);
- if (alpha_elf_tdata (this_got)->total_got_entries > MAX_GOT_ENTRIES)
+ if (alpha_elf_tdata (this_got)->total_got_size > MAX_GOT_SIZE)
{
/* Yikes! A single object file has too many entries. */
(*_bfd_error_handler)
(_("%s: .got subsegment exceeds 64K (size %d)"),
bfd_archive_filename (i),
- alpha_elf_tdata (this_got)->total_got_entries * 8);
+ alpha_elf_tdata (this_got)->total_got_size);
return false;
}
@@ -3003,9 +3750,80 @@ elf64_alpha_size_got_sections (output_bfd, info)
return true;
}
+/* Called from relax_section to rebuild the PLT in light of
+ potential changes in the function's status. */
+
+static boolean
+elf64_alpha_size_plt_section (info)
+ struct bfd_link_info *info;
+{
+ asection *splt, *spltrel;
+ unsigned long entries;
+ bfd *dynobj;
+
+ dynobj = elf_hash_table(info)->dynobj;
+ splt = bfd_get_section_by_name(dynobj, ".plt");
+ if (splt == NULL)
+ return true;
+
+ splt->_raw_size = 0;
+
+ alpha_elf_link_hash_traverse (alpha_elf_hash_table (info),
+ elf64_alpha_size_plt_section_1, splt);
+
+ splt->_cooked_size = splt->_raw_size;
+
+ /* Every plt entry requires a JMP_SLOT relocation. */
+ spltrel = bfd_get_section_by_name (dynobj, ".rela.plt");
+ if (splt->_raw_size)
+ entries = (splt->_raw_size - PLT_HEADER_SIZE) / PLT_ENTRY_SIZE;
+ else
+ entries = 0;
+ spltrel->_raw_size = entries * sizeof (Elf64_External_Rela);
+ spltrel->_cooked_size = spltrel->_raw_size;
+
+ return true;
+}
+
+static boolean
+elf64_alpha_size_plt_section_1 (h, data)
+ struct alpha_elf_link_hash_entry *h;
+ PTR data;
+{
+ asection *splt = (asection *) data;
+ struct alpha_elf_got_entry *gotent;
+
+ /* If we didn't need an entry before, we still don't. */
+ if (!(h->root.elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT))
+ return true;
+
+ /* There must still be a LITERAL got entry for the function. */
+ for (gotent = h->got_entries; gotent ; gotent = gotent->next)
+ if (gotent->reloc_type == R_ALPHA_LITERAL
+ && gotent->use_count > 0)
+ break;
+
+ /* If there is, reset the PLT offset. If not, there's no longer
+ a need for the PLT entry. */
+ if (gotent)
+ {
+ if (splt->_raw_size == 0)
+ splt->_raw_size = PLT_HEADER_SIZE;
+ h->root.plt.offset = splt->_raw_size;
+ splt->_raw_size += PLT_ENTRY_SIZE;
+ }
+ else
+ {
+ h->root.elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
+ h->root.plt.offset = -1;
+ }
+
+ return true;
+}
+
static boolean
elf64_alpha_always_size_sections (output_bfd, info)
- bfd *output_bfd;
+ bfd *output_bfd ATTRIBUTE_UNUSED;
struct bfd_link_info *info;
{
bfd *i;
@@ -3018,7 +3836,7 @@ elf64_alpha_always_size_sections (output_bfd, info)
elf64_alpha_merge_ind_symbols,
NULL);
- if (!elf64_alpha_size_got_sections (output_bfd, info))
+ if (!elf64_alpha_size_got_sections (info))
return false;
/* Allocate space for all of the .got subsections. */
@@ -3037,6 +3855,40 @@ elf64_alpha_always_size_sections (output_bfd, info)
return true;
}
+/* The number of dynamic relocations required by a static relocation. */
+
+static int
+alpha_dynamic_entries_for_reloc (r_type, dynamic, shared)
+ int r_type, dynamic, shared;
+{
+ switch (r_type)
+ {
+ /* May appear in GOT entries. */
+ case R_ALPHA_TLSGD:
+ return (dynamic ? 2 : shared ? 1 : 0);
+ case R_ALPHA_TLSLDM:
+ return shared;
+ case R_ALPHA_LITERAL:
+ return dynamic || shared;
+ case R_ALPHA_GOTDTPREL:
+ case R_ALPHA_GOTTPREL:
+ return dynamic;
+
+ /* May appear in data sections. */
+ case R_ALPHA_REFLONG:
+ case R_ALPHA_REFQUAD:
+ return dynamic || shared;
+ case R_ALPHA_SREL64:
+ case R_ALPHA_TPREL64:
+ return dynamic;
+
+ /* Everything else is illegal. We'll issue an error during
+ relocate_section. */
+ default:
+ return 0;
+ }
+}
+
/* Work out the sizes of the dynamic relocation entries. */
static boolean
@@ -3044,6 +3896,10 @@ elf64_alpha_calc_dynrel_sizes (h, info)
struct alpha_elf_link_hash_entry *h;
struct bfd_link_info *info;
{
+ boolean dynamic;
+ struct alpha_elf_reloc_entry *relent;
+ unsigned long entries;
+
if (h->root.root.type == bfd_link_hash_warning)
h = (struct alpha_elf_link_hash_entry *) h->root.root.u.i.link;
@@ -3062,51 +3918,125 @@ elf64_alpha_calc_dynrel_sizes (h, info)
&& (h->root.root.type == bfd_link_hash_defined
|| h->root.root.type == bfd_link_hash_defweak)
&& !(h->root.root.u.def.section->owner->flags & DYNAMIC))
- {
- h->root.elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
- }
+ h->root.elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
/* If the symbol is dynamic, we'll need all the relocations in their
natural form. If this is a shared object, and it has been forced
local, we'll need the same number of RELATIVE relocations. */
- if (alpha_elf_dynamic_symbol_p (&h->root, info) || info->shared)
+ dynamic = alpha_elf_dynamic_symbol_p (&h->root, info);
+
+ for (relent = h->reloc_entries; relent; relent = relent->next)
{
- struct alpha_elf_reloc_entry *relent;
- bfd *dynobj;
- struct alpha_elf_got_entry *gotent;
- bfd_size_type count;
- asection *srel;
+ entries = alpha_dynamic_entries_for_reloc (relent->rtype, dynamic,
+ info->shared);
+ if (entries)
+ {
+ relent->srel->_raw_size +=
+ entries * sizeof (Elf64_External_Rela) * relent->count;
+ if (relent->reltext)
+ info->flags |= DT_TEXTREL;
+ }
+ }
- for (relent = h->reloc_entries; relent; relent = relent->next)
- if (relent->rtype == R_ALPHA_REFLONG
- || relent->rtype == R_ALPHA_REFQUAD)
- {
- relent->srel->_raw_size +=
- sizeof (Elf64_External_Rela) * relent->count;
- if (relent->reltext)
- info->flags |= DT_TEXTREL;
- }
+ return true;
+}
+
+/* Set the sizes of the dynamic relocation sections. */
- dynobj = elf_hash_table(info)->dynobj;
- count = 0;
+static boolean
+elf64_alpha_size_rela_got_section (info)
+ struct bfd_link_info *info;
+{
+ unsigned long entries;
+ bfd *i, *dynobj;
+ asection *srel;
- for (gotent = h->got_entries; gotent ; gotent = gotent->next)
- count++;
+ /* Shared libraries often require RELATIVE relocs, and some relocs
+ require attention for the main application as well. */
- /* If we are using a .plt entry, subtract one, as the first
- reference uses a .rela.plt entry instead. */
- if (h->root.plt.offset != MINUS_ONE)
- count--;
+ entries = 0;
+ for (i = alpha_elf_hash_table(info)->got_list;
+ i ; i = alpha_elf_tdata(i)->got_link_next)
+ {
+ bfd *j;
- if (count > 0)
+ for (j = i; j ; j = alpha_elf_tdata(j)->in_got_link_next)
{
- srel = bfd_get_section_by_name (dynobj, ".rela.got");
- BFD_ASSERT (srel != NULL);
- srel->_raw_size += sizeof (Elf64_External_Rela) * count;
+ struct alpha_elf_got_entry **local_got_entries, *gotent;
+ int k, n;
+
+ local_got_entries = alpha_elf_tdata(j)->local_got_entries;
+ if (!local_got_entries)
+ continue;
+
+ for (k = 0, n = elf_tdata(j)->symtab_hdr.sh_info; k < n; ++k)
+ for (gotent = local_got_entries[k];
+ gotent ; gotent = gotent->next)
+ if (gotent->use_count > 0)
+ entries += (alpha_dynamic_entries_for_reloc
+ (gotent->reloc_type, 0, info->shared));
}
}
+ dynobj = elf_hash_table(info)->dynobj;
+ srel = bfd_get_section_by_name (dynobj, ".rela.got");
+ if (!srel)
+ {
+ BFD_ASSERT (entries == 0);
+ return true;
+ }
+ srel->_raw_size = sizeof (Elf64_External_Rela) * entries;
+
+ /* Now do the non-local symbols. */
+ alpha_elf_link_hash_traverse (alpha_elf_hash_table (info),
+ elf64_alpha_size_rela_got_1, info);
+
+ srel->_cooked_size = srel->_raw_size;
+
+ return true;
+}
+
+/* Subroutine of elf64_alpha_size_rela_got_section for doing the
+ global symbols. */
+
+static boolean
+elf64_alpha_size_rela_got_1 (h, info)
+ struct alpha_elf_link_hash_entry *h;
+ struct bfd_link_info *info;
+{
+ boolean dynamic;
+ struct alpha_elf_got_entry *gotent;
+ unsigned long entries;
+
+ if (h->root.root.type == bfd_link_hash_warning)
+ h = (struct alpha_elf_link_hash_entry *) h->root.root.u.i.link;
+
+ /* If the symbol is dynamic, we'll need all the relocations in their
+ natural form. If this is a shared object, and it has been forced
+ local, we'll need the same number of RELATIVE relocations. */
+
+ dynamic = alpha_elf_dynamic_symbol_p (&h->root, info);
+
+ entries = 0;
+ for (gotent = h->got_entries; gotent ; gotent = gotent->next)
+ if (gotent->use_count > 0)
+ entries += alpha_dynamic_entries_for_reloc (gotent->reloc_type,
+ dynamic, info->shared);
+
+ /* If we are using a .plt entry, subtract one, as the first
+ reference uses a .rela.plt entry instead. */
+ if (h->root.plt.offset != MINUS_ONE)
+ entries--;
+
+ if (entries > 0)
+ {
+ bfd *dynobj = elf_hash_table(info)->dynobj;
+ asection *srel = bfd_get_section_by_name (dynobj, ".rela.got");
+ BFD_ASSERT (srel != NULL);
+ srel->_raw_size += sizeof (Elf64_External_Rela) * entries;
+ }
+
return true;
}
@@ -3140,27 +4070,9 @@ elf64_alpha_size_dynamic_sections (output_bfd, info)
collected information in check_relocs that we can now apply to
size the dynamic relocation sections. */
alpha_elf_link_hash_traverse (alpha_elf_hash_table (info),
- elf64_alpha_calc_dynrel_sizes,
- info);
-
- /* When building shared libraries, each local .got entry needs a
- RELATIVE reloc. */
- if (info->shared)
- {
- bfd *i;
- asection *srel;
- bfd_size_type count;
-
- srel = bfd_get_section_by_name (dynobj, ".rela.got");
- BFD_ASSERT (srel != NULL);
+ elf64_alpha_calc_dynrel_sizes, info);
- for (i = alpha_elf_hash_table(info)->got_list, count = 0;
- i != NULL;
- i = alpha_elf_tdata(i)->got_link_next)
- count += alpha_elf_tdata(i)->n_local_got_entries;
-
- srel->_raw_size += count * sizeof (Elf64_External_Rela);
- }
+ elf64_alpha_size_rela_got_section (info);
}
/* else we're not dynamic and by definition we don't need such things. */
@@ -3264,6 +4176,71 @@ elf64_alpha_size_dynamic_sections (output_bfd, info)
return true;
}
+/* Relocate an Alpha ELF section for a relocatable link.
+
+ We don't have to change anything unless the reloc is against a section
+ symbol, in which case we have to adjust according to where the section
+ symbol winds up in the output section. */
+
+static boolean
+elf64_alpha_relocate_section_r (output_bfd, info, input_bfd, input_section,
+ contents, relocs, local_syms, local_sections)
+ bfd *output_bfd ATTRIBUTE_UNUSED;
+ struct bfd_link_info *info ATTRIBUTE_UNUSED;
+ bfd *input_bfd;
+ asection *input_section;
+ bfd_byte *contents ATTRIBUTE_UNUSED;
+ Elf_Internal_Rela *relocs;
+ Elf_Internal_Sym *local_syms;
+ asection **local_sections;
+{
+ unsigned long symtab_hdr_sh_info;
+ Elf_Internal_Rela *rel;
+ Elf_Internal_Rela *relend;
+ boolean ret_val = true;
+
+ symtab_hdr_sh_info = elf_tdata (input_bfd)->symtab_hdr.sh_info;
+
+ relend = relocs + input_section->reloc_count;
+ for (rel = relocs; rel < relend; rel++)
+ {
+ unsigned long r_symndx;
+ Elf_Internal_Sym *sym;
+ asection *sec;
+ unsigned long r_type;
+
+ r_type = ELF64_R_TYPE(rel->r_info);
+ if (r_type >= R_ALPHA_max)
+ {
+ (*_bfd_error_handler)
+ (_("%s: unknown relocation type %d"),
+ bfd_archive_filename (input_bfd), (int)r_type);
+ bfd_set_error (bfd_error_bad_value);
+ ret_val = false;
+ continue;
+ }
+
+ r_symndx = ELF64_R_SYM(rel->r_info);
+
+ /* The symbol associated with GPDISP and LITUSE is
+ immaterial. Only the addend is significant. */
+ if (r_type == R_ALPHA_GPDISP || r_type == R_ALPHA_LITUSE)
+ continue;
+
+ if (r_symndx < symtab_hdr_sh_info)
+ {
+ sym = local_syms + r_symndx;
+ if (ELF_ST_TYPE(sym->st_info) == STT_SECTION)
+ {
+ sec = local_sections[r_symndx];
+ rel->r_addend += sec->output_offset + sym->st_value;
+ }
+ }
+ }
+
+ return ret_val;
+}
+
/* Relocate an Alpha ELF section. */
static boolean
@@ -3281,22 +4258,39 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
Elf_Internal_Shdr *symtab_hdr;
Elf_Internal_Rela *rel;
Elf_Internal_Rela *relend;
- asection *sec, *sgot, *srel, *srelgot;
+ struct elf_link_tls_segment *tls_segment;
+ asection *sgot, *srel, *srelgot;
bfd *dynobj, *gotobj;
- bfd_vma gp;
- boolean ret_val = true;
+ bfd_vma gp, tp_base, dtp_base;
+ struct alpha_elf_got_entry **local_got_entries;
+ boolean ret_val;
+ const char *section_name;
+
+ /* Handle relocatable links with a smaller loop. */
+ if (info->relocateable)
+ return elf64_alpha_relocate_section_r (output_bfd, info, input_bfd,
+ input_section, contents, relocs,
+ local_syms, local_sections);
+
+ /* This is a final link. */
+
+ ret_val = true;
- srelgot = srel = NULL;
symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
+
dynobj = elf_hash_table (info)->dynobj;
if (dynobj)
- {
- srelgot = bfd_get_section_by_name (dynobj, ".rela.got");
- }
+ srelgot = bfd_get_section_by_name (dynobj, ".rela.got");
+ else
+ srelgot = NULL;
+
+ section_name = (bfd_elf_string_from_elf_section
+ (input_bfd, elf_elfheader(input_bfd)->e_shstrndx,
+ elf_section_data(input_section)->rel_hdr.sh_name));
+ BFD_ASSERT(section_name != NULL);
+ srel = bfd_get_section_by_name (dynobj, section_name);
/* Find the gp value for this input bfd. */
- sgot = NULL;
- gp = 0;
gotobj = alpha_elf_tdata (input_bfd)->gotobj;
if (gotobj)
{
@@ -3310,66 +4304,97 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
_bfd_set_gp_value (gotobj, gp);
}
}
+ else
+ {
+ sgot = NULL;
+ gp = 0;
+ }
+
+ local_got_entries = alpha_elf_tdata(input_bfd)->local_got_entries;
+
+ tls_segment = elf_hash_table (info)->tls_segment;
+ if (tls_segment)
+ {
+ dtp_base = alpha_get_dtprel_base (tls_segment);
+ tp_base = alpha_get_tprel_base (tls_segment);
+ }
+ else
+ dtp_base = tp_base = 0;
- rel = relocs;
relend = relocs + input_section->reloc_count;
- for (; rel < relend; rel++)
+ for (rel = relocs; rel < relend; rel++)
{
- int r_type;
+ struct alpha_elf_link_hash_entry *h = NULL;
+ struct alpha_elf_got_entry *gotent;
+ bfd_reloc_status_type r;
reloc_howto_type *howto;
unsigned long r_symndx;
- struct alpha_elf_link_hash_entry *h;
- Elf_Internal_Sym *sym;
- bfd_vma relocation;
+ Elf_Internal_Sym *sym = NULL;
+ asection *sec = NULL;
+ bfd_vma value;
bfd_vma addend;
- bfd_reloc_status_type r;
+ boolean dynamic_symbol_p;
+ boolean undef_weak_ref = false;
+ unsigned long r_type;
r_type = ELF64_R_TYPE(rel->r_info);
- if (r_type < 0 || r_type >= (int) R_ALPHA_max)
+ if (r_type >= R_ALPHA_max)
{
+ (*_bfd_error_handler)
+ (_("%s: unknown relocation type %d"),
+ bfd_archive_filename (input_bfd), (int)r_type);
bfd_set_error (bfd_error_bad_value);
- return false;
+ ret_val = false;
+ continue;
}
- howto = elf64_alpha_howto_table + r_type;
+ howto = elf64_alpha_howto_table + r_type;
r_symndx = ELF64_R_SYM(rel->r_info);
- if (info->relocateable)
+ if (r_symndx < symtab_hdr->sh_info)
{
- /* This is a relocateable link. We don't have to change
- anything, unless the reloc is against a section symbol,
- in which case we have to adjust according to where the
- section symbol winds up in the output section. */
-
- /* The symbol associated with GPDISP and LITUSE is
- immaterial. Only the addend is significant. */
- if (r_type == R_ALPHA_GPDISP || r_type == R_ALPHA_LITUSE)
- continue;
+ sym = local_syms + r_symndx;
+ sec = local_sections[r_symndx];
+ value = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
- if (r_symndx < symtab_hdr->sh_info)
+ if (local_got_entries)
+ gotent = local_got_entries[r_symndx];
+ else
+ gotent = NULL;
+
+ /* Need to adjust local GOT entries' addends for SEC_MERGE
+ unless it has been done already. */
+ if ((sec->flags & SEC_MERGE)
+ && ELF_ST_TYPE (sym->st_info) == STT_SECTION
+ && (elf_section_data (sec)->sec_info_type
+ == ELF_INFO_TYPE_MERGE)
+ && gotent
+ && !gotent->reloc_xlated)
{
- sym = local_syms + r_symndx;
- if (ELF_ST_TYPE(sym->st_info) == STT_SECTION)
+ struct alpha_elf_got_entry *ent;
+ asection *msec;
+
+ for (ent = gotent; ent; ent = ent->next)
{
- sec = local_sections[r_symndx];
- rel->r_addend += sec->output_offset + sym->st_value;
+ ent->reloc_xlated = 1;
+ if (ent->use_count == 0)
+ continue;
+ msec = sec;
+ ent->addend =
+ _bfd_merged_section_offset (output_bfd, &msec,
+ elf_section_data (sec)->
+ sec_info,
+ sym->st_value + ent->addend,
+ (bfd_vma) 0);
+ ent->addend -= sym->st_value;
+ ent->addend += msec->output_section->vma
+ + msec->output_offset
+ - sec->output_section->vma
+ - sec->output_offset;
}
}
- continue;
- }
-
- /* This is a final link. */
-
- h = NULL;
- sym = NULL;
- sec = NULL;
-
- if (r_symndx < symtab_hdr->sh_info)
- {
- sym = local_syms + r_symndx;
- sec = local_sections[r_symndx];
- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
+ dynamic_symbol_p = false;
}
else
{
@@ -3379,27 +4404,32 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
|| h->root.root.type == bfd_link_hash_warning)
h = (struct alpha_elf_link_hash_entry *)h->root.root.u.i.link;
+ value = 0;
if (h->root.root.type == bfd_link_hash_defined
|| h->root.root.type == bfd_link_hash_defweak)
{
sec = h->root.root.u.def.section;
- if (sec->output_section == NULL)
- relocation = 0;
- else
- {
- relocation = (h->root.root.u.def.value
- + sec->output_section->vma
- + sec->output_offset);
- }
+ /* Detect the cases that sym_sec->output_section is
+ expected to be NULL -- all cases in which the symbol
+ is defined in another shared module. This includes
+ PLT relocs for which we've created a PLT entry and
+ other relocs for which we're prepared to create
+ dynamic relocations. */
+ /* ??? Just accept it NULL and continue. */
+
+ if (sec->output_section != NULL)
+ value = (h->root.root.u.def.value
+ + sec->output_section->vma
+ + sec->output_offset);
}
else if (h->root.root.type == bfd_link_hash_undefweak)
- relocation = 0;
+ undef_weak_ref = true;
else if (info->shared
&& (!info->symbolic || info->allow_shlib_undefined)
&& !info->no_undefined
&& ELF_ST_VISIBILITY (h->root.other) == STV_DEFAULT)
- relocation = 0;
+ ;
else
{
if (!((*info->callbacks->undefined_symbol)
@@ -3407,11 +4437,24 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
input_section, rel->r_offset,
(!info->shared || info->no_undefined
|| ELF_ST_VISIBILITY (h->root.other)))))
- ret_val = false;
- relocation = 0;
+ return false;
+ ret_val = false;
+ continue;
}
+
+ dynamic_symbol_p = alpha_elf_dynamic_symbol_p (&h->root, info);
+ gotent = h->got_entries;
}
+
addend = rel->r_addend;
+ value += addend;
+
+ /* Search for the proper got entry. */
+ for (; gotent ; gotent = gotent->next)
+ if (gotent->gotobj == gotobj
+ && gotent->reloc_type == r_type
+ && gotent->addend == addend)
+ break;
switch (r_type)
{
@@ -3421,124 +4464,66 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
BFD_ASSERT(gp != 0);
- relocation = (input_section->output_section->vma
- + input_section->output_offset
- + rel->r_offset);
+ value = (input_section->output_section->vma
+ + input_section->output_offset
+ + rel->r_offset);
- p_ldah = contents + rel->r_offset - input_section->vma;
+ p_ldah = contents + rel->r_offset;
p_lda = p_ldah + rel->r_addend;
- r = elf64_alpha_do_reloc_gpdisp (input_bfd, gp - relocation,
+ r = elf64_alpha_do_reloc_gpdisp (input_bfd, gp - value,
p_ldah, p_lda);
}
break;
case R_ALPHA_LITERAL:
- {
- struct alpha_elf_got_entry *gotent;
- boolean dynamic_symbol;
-
- BFD_ASSERT(sgot != NULL);
- BFD_ASSERT(gp != 0);
-
- if (h != NULL)
- {
- gotent = h->got_entries;
- dynamic_symbol = alpha_elf_dynamic_symbol_p (&h->root, info);
- }
- else
- {
- gotent = (alpha_elf_tdata(input_bfd)->
- local_got_entries[r_symndx]);
- dynamic_symbol = false;
-
- /* Need to adjust local GOT entries' addends for SEC_MERGE
- unless it has been done already. */
- if ((sec->flags & SEC_MERGE)
- && ELF_ST_TYPE (sym->st_info) == STT_SECTION
- && (elf_section_data (sec)->sec_info_type
- == ELF_INFO_TYPE_MERGE)
- && (gotent->flags & ALPHA_ELF_GOT_ENTRY_RELOCS_XLATED) == 0)
- {
- struct alpha_elf_got_entry *ent;
- asection *msec;
-
- for (ent = gotent; ent; ent = ent->next)
- {
- ent->flags |= ALPHA_ELF_GOT_ENTRY_RELOCS_XLATED;
- if (ent->use_count == 0)
- continue;
- msec = sec;
- ent->addend =
- _bfd_merged_section_offset (output_bfd, &msec,
- elf_section_data (sec)->
- sec_info,
- sym->st_value
- + ent->addend,
- (bfd_vma) 0);
- ent->addend -= sym->st_value;
- ent->addend += msec->output_section->vma
- + msec->output_offset
- - sec->output_section->vma
- - sec->output_offset;
- }
- }
- }
+ BFD_ASSERT(sgot != NULL);
+ BFD_ASSERT(gp != 0);
+ BFD_ASSERT(gotent != NULL);
+ BFD_ASSERT(gotent->use_count >= 1);
- BFD_ASSERT(gotent != NULL);
+ if (!gotent->reloc_done)
+ {
+ gotent->reloc_done = 1;
- while (gotent->gotobj != gotobj || gotent->addend != addend)
- gotent = gotent->next;
+ bfd_put_64 (output_bfd, value,
+ sgot->contents + gotent->got_offset);
- BFD_ASSERT(gotent->use_count >= 1);
+ /* If the symbol has been forced local, output a
+ RELATIVE reloc, otherwise it will be handled in
+ finish_dynamic_symbol. */
+ if (info->shared && !dynamic_symbol_p)
+ {
+ Elf_Internal_Rela outrel;
- /* Initialize the .got entry's value. */
- if (!(gotent->flags & ALPHA_ELF_GOT_ENTRY_RELOCS_DONE))
- {
- bfd_put_64 (output_bfd, relocation + addend,
- sgot->contents + gotent->got_offset);
+ BFD_ASSERT(srelgot != NULL);
- /* If the symbol has been forced local, output a
- RELATIVE reloc, otherwise it will be handled in
- finish_dynamic_symbol. */
- if (info->shared && !dynamic_symbol)
- {
- Elf_Internal_Rela outrel;
-
- BFD_ASSERT(srelgot != NULL);
-
- outrel.r_offset = (sgot->output_section->vma
- + sgot->output_offset
- + gotent->got_offset);
- outrel.r_info = ELF64_R_INFO(0, R_ALPHA_RELATIVE);
- outrel.r_addend = relocation + addend;
-
- bfd_elf64_swap_reloca_out (output_bfd, &outrel,
- ((Elf64_External_Rela *)
- srelgot->contents)
- + srelgot->reloc_count++);
- BFD_ASSERT (sizeof (Elf64_External_Rela)
- * srelgot->reloc_count
- <= srelgot->_cooked_size);
- }
+ outrel.r_offset = (sgot->output_section->vma
+ + sgot->output_offset
+ + gotent->got_offset);
+ outrel.r_info = ELF64_R_INFO (0, R_ALPHA_RELATIVE);
+ outrel.r_addend = value;
- gotent->flags |= ALPHA_ELF_GOT_ENTRY_RELOCS_DONE;
- }
+ bfd_elf64_swap_reloca_out (output_bfd, &outrel,
+ ((Elf64_External_Rela *)
+ srelgot->contents)
+ + srelgot->reloc_count++);
+ BFD_ASSERT (sizeof (Elf64_External_Rela)
+ * srelgot->reloc_count
+ <= srelgot->_cooked_size);
+ }
+ }
- /* Figure the gprel relocation. */
- addend = 0;
- relocation = (sgot->output_section->vma
- + sgot->output_offset
- + gotent->got_offset);
- relocation -= gp;
- }
- /* overflow handled by _bfd_final_link_relocate */
+ value = (sgot->output_section->vma
+ + sgot->output_offset
+ + gotent->got_offset);
+ value -= gp;
goto default_reloc;
case R_ALPHA_GPREL16:
case R_ALPHA_GPREL32:
case R_ALPHA_GPRELLOW:
- if (h && alpha_elf_dynamic_symbol_p (&h->root, info))
+ if (dynamic_symbol_p)
{
(*_bfd_error_handler)
(_("%s: gp-relative relocation against dynamic symbol %s"),
@@ -3546,11 +4531,11 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
ret_val = false;
}
BFD_ASSERT(gp != 0);
- relocation -= gp;
+ value -= gp;
goto default_reloc;
case R_ALPHA_GPRELHIGH:
- if (h && alpha_elf_dynamic_symbol_p (&h->root, info))
+ if (dynamic_symbol_p)
{
(*_bfd_error_handler)
(_("%s: gp-relative relocation against dynamic symbol %s"),
@@ -3558,27 +4543,34 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
ret_val = false;
}
BFD_ASSERT(gp != 0);
- relocation -= gp;
- relocation += addend;
- addend = 0;
- relocation = (((bfd_signed_vma) relocation >> 16)
- + ((relocation >> 15) & 1));
+ value -= gp;
+ value = ((bfd_signed_vma) value >> 16) + ((value >> 15) & 1);
goto default_reloc;
case R_ALPHA_HINT:
/* A call to a dynamic symbol is definitely out of range of
the 16-bit displacement. Don't bother writing anything. */
- if (h && alpha_elf_dynamic_symbol_p (&h->root, info))
+ if (dynamic_symbol_p)
{
r = bfd_reloc_ok;
break;
}
- /* FALLTHRU */
+ /* The regular PC-relative stuff measures from the start of
+ the instruction rather than the end. */
+ value -= 4;
+ goto default_reloc;
case R_ALPHA_BRADDR:
+ if (dynamic_symbol_p)
+ {
+ (*_bfd_error_handler)
+ (_("%s: pc-relative relocation against dynamic symbol %s"),
+ bfd_archive_filename (input_bfd), h->root.root.root.string);
+ ret_val = false;
+ }
/* The regular PC-relative stuff measures from the start of
the instruction rather than the end. */
- addend -= 4;
+ value -= 4;
goto default_reloc;
case R_ALPHA_BRSGP:
@@ -3588,12 +4580,12 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
/* The regular PC-relative stuff measures from the start of
the instruction rather than the end. */
- addend -= 4;
+ value -= 4;
/* The source and destination gp must be the same. Note that
the source will always have an assigned gp, since we forced
one in check_relocs, but that the destination may not, as
- it might not have had any relocations at all. Also take
+ it might not have had any relocations at all. Also take
care not to crash if H is an undefined symbol. */
if (h != NULL && sec != NULL
&& alpha_elf_tdata (sec->owner)->gotobj
@@ -3641,41 +4633,52 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
case R_ALPHA_REFLONG:
case R_ALPHA_REFQUAD:
+ case R_ALPHA_DTPREL64:
+ case R_ALPHA_TPREL64:
{
Elf_Internal_Rela outrel;
/* Careful here to remember RELATIVE relocations for global
variables for symbolic shared objects. */
- if (h && alpha_elf_dynamic_symbol_p (&h->root, info))
+ if (dynamic_symbol_p)
{
BFD_ASSERT(h->root.dynindx != -1);
- outrel.r_info = ELF64_R_INFO(h->root.dynindx, r_type);
+ outrel.r_info = ELF64_R_INFO (h->root.dynindx, r_type);
outrel.r_addend = addend;
- addend = 0, relocation = 0;
+ addend = 0, value = 0;
+ }
+ else if (r_type == R_ALPHA_DTPREL64)
+ {
+ BFD_ASSERT(tls_segment != NULL);
+ value -= dtp_base;
+ goto default_reloc;
+ }
+ else if (r_type == R_ALPHA_TPREL64)
+ {
+ BFD_ASSERT(tls_segment != NULL);
+ value -= dtp_base;
+ goto default_reloc;
}
else if (info->shared
&& r_symndx != 0
&& (input_section->flags & SEC_ALLOC))
{
- outrel.r_info = ELF64_R_INFO(0, R_ALPHA_RELATIVE);
- outrel.r_addend = relocation + addend;
+ if (r_type == R_ALPHA_REFLONG)
+ {
+ (*_bfd_error_handler)
+ (_("%s: unhandled dynamic relocation against %s"),
+ bfd_archive_filename (input_bfd),
+ h->root.root.root.string);
+ ret_val = false;
+ }
+ outrel.r_info = ELF64_R_INFO (0, R_ALPHA_RELATIVE);
+ outrel.r_addend = value;
}
else
goto default_reloc;
- if (!srel)
- {
- const char *name;
-
- name = (bfd_elf_string_from_elf_section
- (input_bfd, elf_elfheader(input_bfd)->e_shstrndx,
- elf_section_data(input_section)->rel_hdr.sh_name));
- BFD_ASSERT(name != NULL);
-
- srel = bfd_get_section_by_name (dynobj, name);
- BFD_ASSERT(srel != NULL);
- }
+ BFD_ASSERT(srel != NULL);
outrel.r_offset =
_bfd_elf_section_offset (output_bfd, info, input_section,
@@ -3695,8 +4698,17 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
}
goto default_reloc;
+ case R_ALPHA_SREL16:
case R_ALPHA_SREL32:
case R_ALPHA_SREL64:
+ if (dynamic_symbol_p)
+ {
+ (*_bfd_error_handler)
+ (_("%s: pc-relative relocation against dynamic symbol %s"),
+ bfd_archive_filename (input_bfd), h->root.root.root.string);
+ ret_val = false;
+ }
+
/* ??? .eh_frame references to discarded sections will be smashed
to relocations against SHN_UNDEF. The .eh_frame format allows
NULL to be encoded as 0 in any format, so this works here. */
@@ -3705,11 +4717,134 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
+ (r_type - R_ALPHA_SREL32 + R_ALPHA_REFLONG));
goto default_reloc;
+ case R_ALPHA_TLSLDM:
+ /* Ignore the symbol for the relocation. The result is always
+ the current module. */
+ dynamic_symbol_p = 0;
+ /* FALLTHRU */
+
+ case R_ALPHA_TLSGD:
+ if (!gotent->reloc_done)
+ {
+ gotent->reloc_done = 1;
+
+ /* Note that the module index for the main program is 1. */
+ bfd_put_64 (output_bfd, !info->shared && !dynamic_symbol_p,
+ sgot->contents + gotent->got_offset);
+
+ /* If the symbol has been forced local, output a
+ DTPMOD64 reloc, otherwise it will be handled in
+ finish_dynamic_symbol. */
+ if (info->shared && !dynamic_symbol_p)
+ {
+ Elf_Internal_Rela outrel;
+
+ BFD_ASSERT(srelgot != NULL);
+
+ outrel.r_offset = (sgot->output_section->vma
+ + sgot->output_offset
+ + gotent->got_offset);
+ /* ??? Proper dynindx here. */
+ outrel.r_info = ELF64_R_INFO (0, R_ALPHA_DTPMOD64);
+ outrel.r_addend = 0;
+
+ bfd_elf64_swap_reloca_out (output_bfd, &outrel,
+ ((Elf64_External_Rela *)
+ srelgot->contents)
+ + srelgot->reloc_count++);
+ BFD_ASSERT (sizeof (Elf64_External_Rela)
+ * srelgot->reloc_count
+ <= srelgot->_cooked_size);
+ }
+
+ if (dynamic_symbol_p || r_type == R_ALPHA_TLSLDM)
+ value = 0;
+ else
+ {
+ BFD_ASSERT(tls_segment != NULL);
+ value -= dtp_base;
+ }
+ bfd_put_64 (output_bfd, value,
+ sgot->contents + gotent->got_offset + 8);
+ }
+
+ value = (sgot->output_section->vma
+ + sgot->output_offset
+ + gotent->got_offset);
+ value -= gp;
+ goto default_reloc;
+
+ case R_ALPHA_DTPRELHI:
+ case R_ALPHA_DTPRELLO:
+ case R_ALPHA_DTPREL16:
+ if (dynamic_symbol_p)
+ {
+ (*_bfd_error_handler)
+ (_("%s: dtp-relative relocation against dynamic symbol %s"),
+ bfd_archive_filename (input_bfd), h->root.root.root.string);
+ ret_val = false;
+ }
+ BFD_ASSERT(tls_segment != NULL);
+ value -= dtp_base;
+ if (r_type == R_ALPHA_DTPRELHI)
+ value = ((bfd_signed_vma) value >> 16) + ((value >> 15) & 1);
+ goto default_reloc;
+
+ case R_ALPHA_TPRELHI:
+ case R_ALPHA_TPRELLO:
+ case R_ALPHA_TPREL16:
+ if (info->shared)
+ {
+ (*_bfd_error_handler)
+ (_("%s: TLS local exec code cannot be linked into shared objects"),
+ bfd_archive_filename (input_bfd));
+ ret_val = false;
+ }
+ else if (dynamic_symbol_p)
+ {
+ (*_bfd_error_handler)
+ (_("%s: tp-relative relocation against dynamic symbol %s"),
+ bfd_archive_filename (input_bfd), h->root.root.root.string);
+ ret_val = false;
+ }
+ BFD_ASSERT(tls_segment != NULL);
+ value -= tp_base;
+ if (r_type == R_ALPHA_TPRELHI)
+ value = ((bfd_signed_vma) value >> 16) + ((value >> 15) & 1);
+ goto default_reloc;
+
+ case R_ALPHA_GOTDTPREL:
+ case R_ALPHA_GOTTPREL:
+ BFD_ASSERT(sgot != NULL);
+ BFD_ASSERT(gp != 0);
+ BFD_ASSERT(gotent != NULL);
+ BFD_ASSERT(gotent->use_count >= 1);
+
+ if (!gotent->reloc_done)
+ {
+ gotent->reloc_done = 1;
+
+ if (dynamic_symbol_p)
+ value = 0;
+ else
+ {
+ BFD_ASSERT(tls_segment != NULL);
+ value -= (r_type == R_ALPHA_GOTDTPREL ? dtp_base : tp_base);
+ }
+ bfd_put_64 (output_bfd, value,
+ sgot->contents + gotent->got_offset);
+ }
+
+ value = (sgot->output_section->vma
+ + sgot->output_offset
+ + gotent->got_offset);
+ value -= gp;
+ goto default_reloc;
+
default:
default_reloc:
r = _bfd_final_link_relocate (howto, input_bfd, input_section,
- contents, rel->r_offset, relocation,
- addend);
+ contents, rel->r_offset, value, 0);
break;
}
@@ -3881,20 +5016,58 @@ elf64_alpha_finish_dynamic_symbol (output_bfd, info, h, sym)
srel = bfd_get_section_by_name (dynobj, ".rela.got");
BFD_ASSERT (srel != NULL);
- outrel.r_info = ELF64_R_INFO (h->dynindx, R_ALPHA_GLOB_DAT);
for (gotent = ((struct alpha_elf_link_hash_entry *) h)->got_entries;
gotent != NULL;
gotent = gotent->next)
{
- asection *sgot = alpha_elf_tdata (gotent->gotobj)->got;
+ asection *sgot;
+ int r_type;
+
+ if (gotent->use_count == 0)
+ continue;
+
+ sgot = alpha_elf_tdata (gotent->gotobj)->got;
outrel.r_offset = (sgot->output_section->vma
+ sgot->output_offset
+ gotent->got_offset);
+
+ r_type = gotent->reloc_type;
+ switch (r_type)
+ {
+ case R_ALPHA_LITERAL:
+ r_type = R_ALPHA_GLOB_DAT;
+ break;
+ case R_ALPHA_TLSGD:
+ r_type = R_ALPHA_DTPMOD64;
+ break;
+ case R_ALPHA_GOTDTPREL:
+ r_type = R_ALPHA_DTPREL64;
+ break;
+ case R_ALPHA_GOTTPREL:
+ r_type = R_ALPHA_TPREL64;
+ break;
+ case R_ALPHA_TLSLDM:
+ default:
+ abort ();
+ }
+
+ outrel.r_info = ELF64_R_INFO (h->dynindx, r_type);
outrel.r_addend = gotent->addend;
bfd_elf64_swap_reloca_out (output_bfd, &outrel,
((Elf64_External_Rela *)srel->contents
+ srel->reloc_count++));
+
+ if (gotent->reloc_type == R_ALPHA_TLSGD)
+ {
+ outrel.r_offset += 8;
+ outrel.r_info = ELF64_R_INFO (h->dynindx, R_ALPHA_DTPREL64);
+
+ bfd_elf64_swap_reloca_out (output_bfd, &outrel,
+ ((Elf64_External_Rela *)srel->contents
+ + srel->reloc_count++));
+ }
+
BFD_ASSERT (sizeof (Elf64_External_Rela) * srel->reloc_count
<= srel->_cooked_size);
}
@@ -4355,6 +5528,7 @@ const struct elf_size_info alpha_elf_size_info =
bfd_elf64_write_out_phdrs,
bfd_elf64_write_shdrs_and_ehdr,
bfd_elf64_write_relocs,
+ bfd_elf64_swap_symbol_in,
bfd_elf64_swap_symbol_out,
bfd_elf64_slurp_reloc_table,
bfd_elf64_slurp_symbol_table,
diff --git a/bfd/elf64-hppa.c b/bfd/elf64-hppa.c
index c6ea4f43764..cc4694348f2 100644
--- a/bfd/elf64-hppa.c
+++ b/bfd/elf64-hppa.c
@@ -184,7 +184,7 @@ static boolean elf64_hppa_object_p
PARAMS ((bfd *));
static boolean elf64_hppa_section_from_shdr
- PARAMS ((bfd *, Elf64_Internal_Shdr *, char *));
+ PARAMS ((bfd *, Elf64_Internal_Shdr *, const char *));
static void elf64_hppa_post_process_headers
PARAMS ((bfd *, struct bfd_link_info *));
@@ -403,7 +403,7 @@ static boolean
elf64_hppa_section_from_shdr (abfd, hdr, name)
bfd *abfd;
Elf64_Internal_Shdr *hdr;
- char *name;
+ const char *name;
{
asection *newsect;
@@ -682,7 +682,8 @@ elf64_hppa_check_relocs (abfd, info, sec, relocs)
i < symtab_hdr->sh_info;
i++, esym++, isym++, shndx = (shndx != NULL ? shndx + 1 : NULL))
{
- bfd_elf64_swap_symbol_in (abfd, esym, shndx, isym);
+ bfd_elf64_swap_symbol_in (abfd, (const PTR) esym, (const PTR) shndx,
+ isym);
if (isym->st_shndx > highest_shndx)
highest_shndx = isym->st_shndx;
}
@@ -1158,7 +1159,8 @@ allocate_global_data_opd (dyn_h, data)
/* We never need an opd entry for a symbol which is not
defined by this output file. */
- if (h && h->root.type == bfd_link_hash_undefined)
+ if (h && (h->root.type == bfd_link_hash_undefined
+ || h->root.u.def.section->output_section == NULL))
dyn_h->want_opd = 0;
/* If we are creating a shared library, took the address of a local
@@ -1167,9 +1169,8 @@ allocate_global_data_opd (dyn_h, data)
else if (x->info->shared
|| h == NULL
|| h->dynindx == -1
- || ((h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak)
- && h->root.u.def.section->output_section != NULL))
+ || (h->root.type == bfd_link_hash_defined
+ || h->root.type == bfd_link_hash_defweak))
{
/* If we are creating a shared library, then we will have to
create a runtime relocation for the symbol to properly
@@ -1534,9 +1535,8 @@ allocate_dynrel_entries (dyn_h, data)
switch (rent->type)
{
case R_PARISC_FPTR64:
- /* Allocate one iff we are not building a shared library and
- !want_opd, which by this point will be true only if we're
- actually allocating one statically in the main executable. */
+ /* Allocate one iff we are building a shared library and don't
+ want an opd entry. */
if (!x->info->shared && dyn_h->want_opd)
continue;
break;
@@ -2114,7 +2114,7 @@ elf64_hppa_finalize_opd (dyn_h, data)
{
struct bfd_link_info *info = (struct bfd_link_info *)data;
struct elf64_hppa_link_hash_table *hppa_info;
- struct elf_link_hash_entry *h = dyn_h->h;
+ struct elf_link_hash_entry *h = dyn_h ? dyn_h->h : NULL;
asection *sopd;
asection *sopdrel;
@@ -2122,7 +2122,7 @@ elf64_hppa_finalize_opd (dyn_h, data)
sopd = hppa_info->opd_sec;
sopdrel = hppa_info->opd_rel_sec;
- if (h && dyn_h && dyn_h->want_opd)
+ if (h && dyn_h->want_opd)
{
bfd_vma value;
@@ -2235,7 +2235,7 @@ elf64_hppa_finalize_dlt (dyn_h, data)
struct bfd_link_info *info = (struct bfd_link_info *)data;
struct elf64_hppa_link_hash_table *hppa_info;
asection *sdlt, *sdltrel;
- struct elf_link_hash_entry *h = dyn_h->h;
+ struct elf_link_hash_entry *h = dyn_h ? dyn_h->h : NULL;
hppa_info = elf64_hppa_hash_table (info);
@@ -2246,7 +2246,7 @@ elf64_hppa_finalize_dlt (dyn_h, data)
address, so there is no need to create a relocation. Just install
the proper value into the DLT, note this shortcut can not be
skipped when building a shared library. */
- if (! info->shared && h && dyn_h && dyn_h->want_dlt)
+ if (! info->shared && h && dyn_h->want_dlt)
{
bfd_vma value;
@@ -2262,16 +2262,17 @@ elf64_hppa_finalize_dlt (dyn_h, data)
+ hppa_info->opd_sec->output_offset
+ hppa_info->opd_sec->output_section->vma);
}
- else
+ else if (h->root.u.def.section)
{
- value = (h->root.u.def.value
- + h->root.u.def.section->output_offset);
-
+ value = h->root.u.def.value + h->root.u.def.section->output_offset;
if (h->root.u.def.section->output_section)
value += h->root.u.def.section->output_section->vma;
else
value += h->root.u.def.section->vma;
}
+ else
+ /* We have an undefined function reference. */
+ value = 0;
/* We do not need to include the output offset of the DLT section
here because we are modifying the in-memory contents. */
@@ -2359,9 +2360,8 @@ elf64_hppa_finalize_dynreloc (dyn_h, data)
switch (rent->type)
{
case R_PARISC_FPTR64:
- /* Allocate one iff we are not building a shared library and
- !want_opd, which by this point will be true only if we're
- actually allocating one statically in the main executable. */
+ /* Allocate one iff we are building a shared library and don't
+ want an opd entry. */
if (!info->shared && dyn_h->want_opd)
continue;
break;
@@ -2394,7 +2394,7 @@ elf64_hppa_finalize_dynreloc (dyn_h, data)
We use a section symbol recorded by check_relocs as the
base symbol for the relocation. The addend is the difference
between the section symbol and the address of the .opd entry. */
- if (info->shared && rent->type == R_PARISC_FPTR64)
+ if (info->shared && rent->type == R_PARISC_FPTR64 && dyn_h->want_opd)
{
bfd_vma value, value2;
@@ -2673,6 +2673,7 @@ const struct elf_size_info hppa64_elf_size_info =
bfd_elf64_write_out_phdrs,
bfd_elf64_write_shdrs_and_ehdr,
bfd_elf64_write_relocs,
+ bfd_elf64_swap_symbol_in,
bfd_elf64_swap_symbol_out,
bfd_elf64_slurp_reloc_table,
bfd_elf64_slurp_symbol_table,
diff --git a/bfd/elf64-mips.c b/bfd/elf64-mips.c
index 508c0ee0bca..ea8f64588f7 100644
--- a/bfd/elf64-mips.c
+++ b/bfd/elf64-mips.c
@@ -1548,7 +1548,7 @@ mips_elf64_assign_gp (output_bfd, pgp)
{
for (i = 0; i < count; i++, sym++)
{
- register CONST char *name;
+ register const char *name;
name = bfd_asymbol_name (*sym);
if (*name == '_' && strcmp (name, "_gp") == 0)
@@ -2666,6 +2666,7 @@ const struct elf_size_info mips_elf64_size_info =
bfd_elf64_write_out_phdrs,
bfd_elf64_write_shdrs_and_ehdr,
mips_elf64_write_relocs,
+ bfd_elf64_swap_symbol_in,
bfd_elf64_swap_symbol_out,
mips_elf64_slurp_reloc_table,
bfd_elf64_slurp_symbol_table,
@@ -2719,6 +2720,8 @@ const struct elf_size_info mips_elf64_size_info =
#define elf_backend_gc_mark_hook _bfd_mips_elf_gc_mark_hook
#define elf_backend_gc_sweep_hook _bfd_mips_elf_gc_sweep_hook
#define elf_backend_hide_symbol _bfd_mips_elf_hide_symbol
+#define elf_backend_ignore_discarded_relocs \
+ _bfd_mips_elf_ignore_discarded_relocs
#define elf_backend_mips_irix_compat elf64_mips_irix_compat
#define elf_backend_mips_rtype_to_howto mips_elf64_rtype_to_howto
#define elf_backend_ecoff_debug_swap &mips_elf64_ecoff_debug_swap
diff --git a/bfd/elf64-mmix.c b/bfd/elf64-mmix.c
index 96146ed016e..55ef061d645 100644
--- a/bfd/elf64-mmix.c
+++ b/bfd/elf64-mmix.c
@@ -943,7 +943,7 @@ mmix_elf_perform_relocation (isec, howto, datap, addr, value)
value += addr;
break;
}
- /* FALLTHROUGH. */
+ /* FALLTHROUGH. */
case R_MMIX_ADDR19:
case R_MMIX_ADDR27:
/* These must be in range, or else we emit an error. */
@@ -2419,7 +2419,8 @@ mmix_elf_relax_section (abfd, sec, link_info, again)
esym = extsyms + ELF64_R_SYM (irel->r_info);
shndx = shndx_buf + (shndx_buf
? ELF64_R_SYM (irel->r_info) : 0);
- bfd_elf64_swap_symbol_in (abfd, esym, shndx, &isym);
+ bfd_elf64_swap_symbol_in (abfd, (const PTR) esym, (const PTR) shndx,
+ &isym);
if (isym.st_shndx == SHN_UNDEF)
sym_sec = bfd_und_section_ptr;
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index 5ae3aefd767..106fafcd990 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -55,12 +55,14 @@ static bfd_reloc_status_type ppc64_elf_toc64_reloc
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
static bfd_reloc_status_type ppc64_elf_unhandled_reloc
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
+static void ppc64_elf_get_symbol_info
+ PARAMS ((bfd *, asymbol *, symbol_info *));
static boolean ppc64_elf_set_private_flags
PARAMS ((bfd *, flagword));
static boolean ppc64_elf_merge_private_bfd_data
PARAMS ((bfd *, bfd *));
static boolean ppc64_elf_section_from_shdr
- PARAMS ((bfd *, Elf64_Internal_Shdr *, char *));
+ PARAMS ((bfd *, Elf64_Internal_Shdr *, const char *));
/* The name of the dynamic interpreter. This is put in the .interp
@@ -106,7 +108,7 @@ static boolean ppc64_elf_section_from_shdr
#define CROR_151515 0x4def7b82
#define CROR_313131 0x4ffffb82
-/* .glink entries for the first 32k functions are two instructions. */
+/* .glink entries for the first 32k functions are two instructions. */
#define LI_R0_0 0x38000000 /* li %r0,0 */
#define B_DOT 0x48000000 /* b . */
@@ -523,7 +525,7 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
32, /* bitsize */
true, /* pc_relative */
0, /* bitpos */
- /* FIXME: Verify. Was complain_overflow_bitfield. */
+ /* FIXME: Verify. Was complain_overflow_bitfield. */
complain_overflow_signed, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_PPC64_REL32", /* name */
@@ -796,7 +798,7 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
0xffffffffffffffff, /* dst_mask */
true), /* pcrel_offset */
- /* 64-bit relocation to the symbol's procedure linkage table. */
+ /* 64-bit relocation to the symbol's procedure linkage table. */
HOWTO (R_PPC64_PLT64, /* type */
0, /* rightshift */
4, /* size (0=byte, 1=short, 2=long, 4=64 bits) */
@@ -1359,8 +1361,8 @@ ppc64_elf_info_to_howto (abfd, cache_ptr, dst)
{
unsigned int type;
+ /* Initialize howto table if needed. */
if (!ppc64_elf_howto_table[R_PPC64_ADDR32])
- /* Initialize howto table if needed. */
ppc_howto_init ();
type = ELF64_R_TYPE (dst->r_info);
@@ -1386,7 +1388,7 @@ ppc64_elf_ha_reloc (abfd, reloc_entry, symbol, data,
call the generic function. Any adjustment will be done at final
link time. */
if (output_bfd != NULL)
- return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data,
+ return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data,
input_section, output_bfd, error_message);
/* Adjust the addend for sign extension of the low 16 bits.
@@ -1417,7 +1419,7 @@ ppc64_elf_brtaken_reloc (abfd, reloc_entry, symbol, data,
call the generic function. Any adjustment will be done at final
link time. */
if (output_bfd != NULL)
- return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data,
+ return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data,
input_section, output_bfd, error_message);
octets = reloc_entry->address * bfd_octets_per_byte (abfd);
@@ -1426,7 +1428,7 @@ ppc64_elf_brtaken_reloc (abfd, reloc_entry, symbol, data,
r_type = (enum elf_ppc_reloc_type) reloc_entry->howto->type;
if (r_type == R_PPC64_ADDR14_BRTAKEN
|| r_type == R_PPC64_REL14_BRTAKEN)
- insn |= 0x01 << 21; /* 'y' or 't' bit, lowest bit of BO field. */
+ insn |= 0x01 << 21; /* 'y' or 't' bit, lowest bit of BO field. */
if (is_power4)
{
@@ -1478,7 +1480,7 @@ ppc64_elf_sectoff_reloc (abfd, reloc_entry, symbol, data,
call the generic function. Any adjustment will be done at final
link time. */
if (output_bfd != NULL)
- return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data,
+ return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data,
input_section, output_bfd, error_message);
/* Subtract the symbol section base address. */
@@ -1501,7 +1503,7 @@ ppc64_elf_sectoff_ha_reloc (abfd, reloc_entry, symbol, data,
call the generic function. Any adjustment will be done at final
link time. */
if (output_bfd != NULL)
- return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data,
+ return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data,
input_section, output_bfd, error_message);
/* Subtract the symbol section base address. */
@@ -1529,7 +1531,7 @@ ppc64_elf_toc_reloc (abfd, reloc_entry, symbol, data,
call the generic function. Any adjustment will be done at final
link time. */
if (output_bfd != NULL)
- return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data,
+ return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data,
input_section, output_bfd, error_message);
TOCstart = _bfd_get_gp_value (input_section->output_section->owner);
@@ -1558,7 +1560,7 @@ ppc64_elf_toc_ha_reloc (abfd, reloc_entry, symbol, data,
call the generic function. Any adjustment will be done at final
link time. */
if (output_bfd != NULL)
- return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data,
+ return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data,
input_section, output_bfd, error_message);
TOCstart = _bfd_get_gp_value (input_section->output_section->owner);
@@ -1591,7 +1593,7 @@ ppc64_elf_toc64_reloc (abfd, reloc_entry, symbol, data,
call the generic function. Any adjustment will be done at final
link time. */
if (output_bfd != NULL)
- return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data,
+ return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data,
input_section, output_bfd, error_message);
TOCstart = _bfd_get_gp_value (input_section->output_section->owner);
@@ -1618,7 +1620,7 @@ ppc64_elf_unhandled_reloc (abfd, reloc_entry, symbol, data,
call the generic function. Any adjustment will be done at final
link time. */
if (output_bfd != NULL)
- return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data,
+ return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data,
input_section, output_bfd, error_message);
if (error_message != NULL)
@@ -1631,6 +1633,22 @@ ppc64_elf_unhandled_reloc (abfd, reloc_entry, symbol, data,
return bfd_reloc_dangerous;
}
+/* Return symbol info as per usual for ELF targets, except that
+ symbols in .opd are given 'd' or 'D' for type. */
+
+static void
+ppc64_elf_get_symbol_info (abfd, symbol, ret)
+ bfd *abfd;
+ asymbol *symbol;
+ symbol_info *ret;
+{
+ _bfd_elf_get_symbol_info (abfd, symbol, ret);
+ if (ret->type == '?'
+ && (symbol->flags & (BSF_GLOBAL | BSF_LOCAL)) != 0
+ && strcmp (symbol->section->name, ".opd") == 0)
+ ret->type = (symbol->flags & BSF_GLOBAL) != 0 ? 'D' : 'd';
+}
+
/* Function to set whether a module needs the -mrelocatable bit set. */
static boolean
@@ -1718,7 +1736,7 @@ ppc64_elf_merge_private_bfd_data (ibfd, obfd)
elf_elfheader (obfd)->e_flags &= ~EF_PPC_RELOCATABLE_LIB;
/* The output is -mrelocatable iff it can't be -mrelocatable-lib,
- but each input file is either -mrelocatable or -mrelocatable-lib. */
+ but each input file is either -mrelocatable or -mrelocatable-lib. */
if (! (elf_elfheader (obfd)->e_flags & EF_PPC_RELOCATABLE_LIB)
&& (new_flags & (EF_PPC_RELOCATABLE_LIB | EF_PPC_RELOCATABLE))
&& (old_flags & (EF_PPC_RELOCATABLE_LIB | EF_PPC_RELOCATABLE)))
@@ -1757,7 +1775,7 @@ static boolean
ppc64_elf_section_from_shdr (abfd, hdr, name)
bfd *abfd;
Elf64_Internal_Shdr *hdr;
- char *name;
+ const char *name;
{
asection *newsect;
flagword flags;
@@ -2690,14 +2708,14 @@ ppc64_elf_check_relocs (abfd, info, sec, relocs)
case R_PPC64_PLT32:
case R_PPC64_PLT64:
/* This symbol requires a procedure linkage table entry. We
- actually build the entry in adjust_dynamic_symbol,
- because this might be a case of linking PIC code without
- linking in any dynamic objects, in which case we don't
- need to generate a procedure linkage table after all. */
+ actually build the entry in adjust_dynamic_symbol,
+ because this might be a case of linking PIC code without
+ linking in any dynamic objects, in which case we don't
+ need to generate a procedure linkage table after all. */
if (h == NULL)
{
/* It does not make sense to have a procedure linkage
- table entry for a local symbol. */
+ table entry for a local symbol. */
bfd_set_error (bfd_error_bad_value);
return false;
}
@@ -2769,11 +2787,6 @@ ppc64_elf_check_relocs (abfd, info, sec, relocs)
false, false, false);
if (fdh != NULL)
{
- /* Ensure the function descriptor symbol string is
- part of the code symbol string. We aren't
- changing the name here, just allowing some tricks
- in ppc64_elf_hide_symbol. */
- fdh->root.root.string = h->root.root.string + 1;
((struct ppc_link_hash_entry *) fdh)->is_func_descriptor = 1;
((struct ppc_link_hash_entry *) fdh)->oh = h;
((struct ppc_link_hash_entry *) h)->is_func = 1;
@@ -3225,7 +3238,6 @@ func_desc_adjust (h, inf)
}
((struct ppc_link_hash_entry *) fdh)->is_func_descriptor = 1;
((struct ppc_link_hash_entry *) fdh)->oh = h;
- fdh->root.root.string = h->root.root.string + 1;
((struct ppc_link_hash_entry *) h)->oh = fdh;
}
@@ -3236,8 +3248,14 @@ func_desc_adjust (h, inf)
been imported from another library. Function code syms that
are really in the library we must leave global to prevent the
linker dragging in a definition from a static library. */
- force_local = ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0
- && info->shared);
+ force_local = (info->shared
+ && ((h->elf_link_hash_flags
+ & ELF_LINK_HASH_DEF_REGULAR) == 0
+ || fdh == NULL
+ || (fdh->elf_link_hash_flags
+ & ELF_LINK_HASH_DEF_REGULAR) == 0
+ || (fdh->elf_link_hash_flags
+ & ELF_LINK_FORCED_LOCAL) != 0));
_bfd_elf_link_hash_hide_symbol (info, h, force_local);
}
@@ -3502,14 +3520,48 @@ ppc64_elf_hide_symbol (info, h, force_local)
if (((struct ppc_link_hash_entry *) h)->is_func_descriptor)
{
- const char *name;
struct elf_link_hash_entry *fh = ((struct ppc_link_hash_entry *) h)->oh;
- struct ppc_link_hash_table *htab;
- name = h->root.root.string - 1;
- htab = ppc_hash_table (info);
if (fh == NULL)
- fh = elf_link_hash_lookup (&htab->elf, name, false, false, false);
+ {
+ const char *p, *q;
+ struct ppc_link_hash_table *htab;
+ char save;
+
+ /* We aren't supposed to use alloca in BFD because on
+ systems which do not have alloca the version in libiberty
+ calls xmalloc, which might cause the program to crash
+ when it runs out of memory. This function doesn't have a
+ return status, so there's no way to gracefully return an
+ error. So cheat. We know that string[-1] can be safely
+ dereferenced; It's either a string in an ELF string
+ table, or allocated in an objalloc structure. */
+
+ p = h->root.root.string - 1;
+ save = *p;
+ *(char *) p = '.';
+ htab = ppc_hash_table (info);
+ fh = elf_link_hash_lookup (&htab->elf, p, false, false, false);
+ *(char *) p = save;
+
+ /* Unfortunately, if it so happens that the string we were
+ looking for was allocated immediately before this string,
+ then we overwrote the string terminator. That's the only
+ reason the lookup should fail. */
+ if (fh == NULL)
+ {
+ q = h->root.root.string + strlen (h->root.root.string);
+ while (q >= h->root.root.string && *q == *p)
+ --q, --p;
+ if (q < h->root.root.string && *p == '.')
+ fh = elf_link_hash_lookup (&htab->elf, p, false, false, false);
+ }
+ if (fh != NULL)
+ {
+ ((struct ppc_link_hash_entry *) h)->oh = fh;
+ ((struct ppc_link_hash_entry *) fh)->oh = h;
+ }
+ }
if (fh != NULL)
_bfd_elf_link_hash_hide_symbol (info, fh, force_local);
}
@@ -3871,6 +3923,10 @@ ppc64_elf_size_dynamic_sections (output_bfd, info)
continue;
}
+ /* .plt is in the bss section. We don't initialise it. */
+ if ((s->flags & SEC_LOAD) == 0)
+ continue;
+
/* Allocate memory for the section contents. We use bfd_zalloc
here in case unused entries are not reclaimed before the
section's contents are written out. This should not happen,
@@ -3897,7 +3953,7 @@ ppc64_elf_size_dynamic_sections (output_bfd, info)
return false;
}
- if (htab->splt->_raw_size != 0)
+ if (htab->splt != NULL && htab->splt->_raw_size != 0)
{
if (!add_dynamic_entry (DT_PLTGOT, 0)
|| !add_dynamic_entry (DT_PLTRELSZ, 0)
@@ -4153,6 +4209,20 @@ ppc_build_one_stub (gen_entry, in_arg)
htab->sglink->_cooked_size = p - htab->sglink->contents;
htab->sglink->reloc_count += 1;
+ /* Do the best we can for shared libraries built without
+ exporting ".foo" for each "foo". This can happen when symbol
+ versioning scripts strip all bar a subset of symbols. */
+ if (stub_entry->h->oh->root.type != bfd_link_hash_defined
+ && stub_entry->h->oh->root.type != bfd_link_hash_defweak)
+ {
+ /* Point the symbol at the stub. There may be multiple stubs,
+ we don't really care; The main thing is to make this sym
+ defined somewhere. */
+ stub_entry->h->oh->root.type = bfd_link_hash_defined;
+ stub_entry->h->oh->root.u.def.section = stub_entry->stub_sec;
+ stub_entry->h->oh->root.u.def.value = stub_entry->stub_offset;
+ }
+
/* Now build the stub. */
off = stub_entry->h->elf.plt.offset;
if (off >= (bfd_vma) -2)
@@ -4262,7 +4332,7 @@ ppc_size_one_stub (gen_entry, in_arg)
/* Set up various things so that we can make a list of input sections
for each output section included in the link. Returns -1 on error,
- 0 when no stubs will be needed, and 1 on success. */
+ 0 when no stubs will be needed, and 1 on success. */
int
ppc64_elf_setup_section_lists (output_bfd, info)
@@ -4524,7 +4594,8 @@ get_local_syms (input_bfd, htab)
isym = local_syms, shndx = shndx_buf;
esym < end_sy;
esym++, isym++, shndx = (shndx ? shndx + 1 : NULL))
- bfd_elf64_swap_symbol_in (input_bfd, esym, shndx, isym);
+ bfd_elf64_swap_symbol_in (input_bfd, (const PTR) esym,
+ (const PTR) shndx, isym);
/* Now we can free the external symbols. */
free (shndx_buf);
@@ -4820,12 +4891,10 @@ ppc64_elf_size_stubs (output_bfd, stub_bfd, info, group_size,
(*htab->layout_sections_again) ();
}
- if (htab->sbrlt->_raw_size == 0)
- {
- _bfd_strip_section_from_output (info, htab->sbrlt);
- if (htab->srelbrlt != NULL)
- _bfd_strip_section_from_output (info, htab->srelbrlt);
- }
+ /* It would be nice to strip .branch_lt from the output if the
+ section is empty, but it's too late. If we strip sections here,
+ the dynamic symbol table is corrupted since the section symbol
+ for the stripped section isn't written. */
ret = true;
@@ -5075,6 +5144,7 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
unsigned long r_symndx;
bfd_vma relocation;
boolean unresolved_reloc;
+ boolean warned;
long insn;
struct ppc_stub_hash_entry *stub_entry;
bfd_vma max_br_offset;
@@ -5090,6 +5160,7 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
h = (struct elf_link_hash_entry *) 0;
sym_name = (const char *) 0;
unresolved_reloc = false;
+ warned = false;
if (r_type == R_PPC64_TOC)
{
@@ -5146,6 +5217,7 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
|| info->no_undefined
|| ELF_ST_VISIBILITY (h->other)))))
return false;
+ warned = true;
}
}
@@ -5159,8 +5231,8 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
/* Branch taken prediction relocations. */
case R_PPC64_ADDR14_BRTAKEN:
case R_PPC64_REL14_BRTAKEN:
- insn = 0x01 << 21; /* 'y' or 't' bit, lowest bit of BO field. */
- /* Fall thru. */
+ insn = 0x01 << 21; /* 'y' or 't' bit, lowest bit of BO field. */
+ /* Fall thru. */
/* Branch not taken prediction relocations. */
case R_PPC64_ADDR14_BRNTAKEN:
@@ -5542,6 +5614,21 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
relocate = true;
if (r_type == R_PPC64_ADDR64 || r_type == R_PPC64_TOC)
{
+ if (is_opd && h != NULL)
+ {
+ /* Lie about opd entries. This case occurs
+ when building shared libraries and we
+ reference a function in another shared
+ lib. The same thing happens for a weak
+ definition in an application that's
+ overridden by a strong definition in a
+ shared lib. (I believe this is a generic
+ bug in binutils handling of weak syms.)
+ In these cases we won't use the opd
+ entry in this lib; We ought to edit the
+ opd section to remove unused entries. */
+ unresolved_reloc = false;
+ }
outrel.r_info = ELF64_R_INFO (0, R_PPC64_RELATIVE);
}
else
@@ -5699,12 +5786,15 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
&& !(info->shared
&& (input_section->flags & SEC_DEBUGGING) != 0
&& (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0))
- (*_bfd_error_handler)
- (_("%s(%s+0x%lx): unresolvable relocation against symbol `%s'"),
- bfd_archive_filename (input_bfd),
- bfd_get_section_name (input_bfd, input_section),
- (long) rel->r_offset,
- h->root.root.string);
+ {
+ (*_bfd_error_handler)
+ (_("%s(%s+0x%lx): unresolvable relocation against symbol `%s'"),
+ bfd_archive_filename (input_bfd),
+ bfd_get_section_name (input_bfd, input_section),
+ (long) rel->r_offset,
+ h->root.root.string);
+ ret = false;
+ }
r = _bfd_final_link_relocate (ppc64_elf_howto_table[(int) r_type],
input_bfd,
@@ -5714,9 +5804,7 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
relocation,
addend);
- if (r == bfd_reloc_ok)
- ;
- else if (r == bfd_reloc_overflow)
+ if (r != bfd_reloc_ok)
{
const char *name;
@@ -5747,13 +5835,25 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
name = bfd_section_name (input_bfd, sec);
}
- if (! ((*info->callbacks->reloc_overflow)
- (info, name, ppc64_elf_howto_table[(int) r_type]->name,
- (bfd_vma) 0, input_bfd, input_section, offset)))
- return false;
+ if (r == bfd_reloc_overflow)
+ {
+ if (warned)
+ continue;
+ if (!((*info->callbacks->reloc_overflow)
+ (info, name, ppc64_elf_howto_table[(int) r_type]->name,
+ rel->r_addend, input_bfd, input_section, offset)))
+ return false;
+ }
+ else
+ {
+ (*_bfd_error_handler)
+ (_("%s(%s+0x%lx): reloc against `%s': error %d"),
+ bfd_archive_filename (input_bfd),
+ bfd_get_section_name (input_bfd, input_section),
+ (long) rel->r_offset, name, (int) r);
+ ret = false;
+ }
}
- else
- ret = false;
}
return ret;
@@ -5782,7 +5882,7 @@ ppc64_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
Elf64_External_Rela *loc;
/* This symbol has an entry in the procedure linkage table. Set
- it up. */
+ it up. */
if (htab->splt == NULL
|| htab->srelplt == NULL
@@ -5809,7 +5909,7 @@ ppc64_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
Elf64_External_Rela *loc;
/* This symbol has an entry in the global offset table. Set it
- up. */
+ up. */
if (htab->sgot == NULL || htab->srelgot == NULL)
abort ();
@@ -6036,6 +6136,7 @@ ppc64_elf_finish_dynamic_sections (output_bfd, info)
#define bfd_elf64_bfd_merge_private_bfd_data ppc64_elf_merge_private_bfd_data
#define bfd_elf64_bfd_link_hash_table_create ppc64_elf_link_hash_table_create
#define bfd_elf64_bfd_link_hash_table_free ppc64_elf_link_hash_table_free
+#define bfd_elf64_get_symbol_info ppc64_elf_get_symbol_info
#define elf_backend_section_from_shdr ppc64_elf_section_from_shdr
#define elf_backend_create_dynamic_sections ppc64_elf_create_dynamic_sections
diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c
index ceb5efa0867..abbd4cce781 100644
--- a/bfd/elf64-s390.c
+++ b/bfd/elf64-s390.c
@@ -1019,7 +1019,7 @@ elf_s390_adjust_dynamic_symbol (info, h)
/* If this is a function, put it in the procedure linkage table. We
will fill in the contents of the procedure linkage table later
- (although we could actually do it here). */
+ (although we could actually do it here). */
if (h->type == STT_FUNC
|| (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0)
{
@@ -2339,6 +2339,7 @@ const struct elf_size_info s390_elf64_size_info =
bfd_elf64_write_out_phdrs,
bfd_elf64_write_shdrs_and_ehdr,
bfd_elf64_write_relocs,
+ bfd_elf64_swap_symbol_in,
bfd_elf64_swap_symbol_out,
bfd_elf64_slurp_reloc_table,
bfd_elf64_slurp_symbol_table,
diff --git a/bfd/elf64-sh64-nbsd.c b/bfd/elf64-sh64-nbsd.c
new file mode 100644
index 00000000000..43e4eaf42ed
--- /dev/null
+++ b/bfd/elf64-sh64-nbsd.c
@@ -0,0 +1,29 @@
+/* SuperH SH64 specific support for 64-bit NetBSD
+ Copyright 2002 Free Software Foundation, Inc.
+
+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 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 TARGET_BIG_SYM bfd_elf64_sh64nbsd_vec
+#define TARGET_BIG_NAME "elf64-sh64-nbsd"
+#define TARGET_LITTLE_SYM bfd_elf64_sh64lnbsd_vec
+#define TARGET_LITTLE_NAME "elf64-sh64l-nbsd"
+#define ELF_ARCH bfd_arch_sh
+#define ELF_MACHINE_CODE EM_SH
+#define ELF_MAXPAGESIZE 0x10000
+#define elf_symbol_leading_char 0
+
+#include "elf64-sh64.c"
diff --git a/bfd/elf64-sh64.c b/bfd/elf64-sh64.c
index b168934e963..ccb87e4a7f4 100644
--- a/bfd/elf64-sh64.c
+++ b/bfd/elf64-sh64.c
@@ -139,7 +139,7 @@ static int sh64_elf64_get_symbol_type PARAMS ((Elf_Internal_Sym *, int));
static boolean sh64_elf64_add_symbol_hook
PARAMS ((bfd *, struct bfd_link_info *, const Elf_Internal_Sym *,
const char **, flagword *, asection **, bfd_vma *));
-extern boolean sh64_elf64_link_output_symbol_hook
+static boolean sh64_elf64_link_output_symbol_hook
PARAMS ((bfd *, struct bfd_link_info *, const char *, Elf_Internal_Sym *,
asection *));
static boolean sh64_elf64_fake_sections
@@ -1342,8 +1342,8 @@ sh_elf64_reloc (abfd, reloc_entry, symbol_in, data, input_section, output_bfd,
return bfd_reloc_undefined;
if (bfd_is_com_section (symbol_in->section))
- sym_value = 0;
- else
+ sym_value = 0;
+ else
sym_value = (symbol_in->value +
symbol_in->section->output_section->vma +
symbol_in->section->output_offset);
@@ -1614,7 +1614,7 @@ sh_elf64_relocate_section (output_bfd, info, input_bfd, input_section,
sec = h->root.u.def.section;
/* In these cases, we don't need the relocation value.
We check specially because in some obscure cases
- sec->output_section will be NULL. */
+ sec->output_section will be NULL. */
if (r_type == R_SH_GOTPC_LOW16
|| r_type == R_SH_GOTPC_MEDLOW16
|| r_type == R_SH_GOTPC_MEDHI16
@@ -1756,7 +1756,7 @@ sh_elf64_relocate_section (output_bfd, info, input_bfd, input_section,
skip = true;
else if (outrel.r_offset == (bfd_vma) -2)
skip = true, relocate = true;
-
+
outrel.r_offset += (input_section->output_section->vma
+ input_section->output_offset);
@@ -2234,7 +2234,8 @@ sh_elf64_get_relocated_section_contents (output_bfd, link_info, link_order,
{
asection *isec;
- bfd_elf64_swap_symbol_in (input_bfd, esym, shndx, isymp);
+ bfd_elf64_swap_symbol_in (input_bfd, (const PTR) esym,
+ (const PTR) shndx, isymp);
if (isymp->st_shndx == SHN_UNDEF)
isec = bfd_und_section_ptr;
@@ -2481,11 +2482,7 @@ sh_elf64_gc_mark_hook (abfd, info, rel, h, sym)
}
else
{
- if (!(elf_bad_symtab (abfd)
- && ELF_ST_BIND (sym->st_info) != STB_LOCAL)
- && ! ((sym->st_shndx <= 0 || sym->st_shndx >= SHN_LORESERVE)
- && sym->st_shndx != SHN_COMMON))
- return bfd_section_from_elf_index (abfd, sym->st_shndx);
+ return bfd_section_from_elf_index (abfd, sym->st_shndx);
}
return NULL;
@@ -2507,7 +2504,7 @@ sh_elf64_gc_sweep_hook (abfd, info, sec, relocs)
/* Look through the relocs for a section during the first phase.
Since we don't do .gots or .plts, we just need to consider the
virtual table relocs for gc. */
-
+
static boolean
sh_elf64_check_relocs (abfd, info, sec, relocs)
bfd *abfd;
@@ -2537,7 +2534,7 @@ sh_elf64_check_relocs (abfd, info, sec, relocs)
sym_hashes_end = sym_hashes + symtab_hdr->sh_size/sizeof(Elf64_External_Sym);
if (!elf_bad_symtab (abfd))
sym_hashes_end -= symtab_hdr->sh_info;
-
+
dynobj = elf_hash_table (info)->dynobj;
local_got_offsets = elf_local_got_offsets (abfd);
@@ -2546,13 +2543,13 @@ sh_elf64_check_relocs (abfd, info, sec, relocs)
{
struct elf_link_hash_entry *h;
unsigned long r_symndx;
-
+
r_symndx = ELF64_R_SYM (rel->r_info);
if (r_symndx < symtab_hdr->sh_info)
h = NULL;
else
h = sym_hashes[r_symndx - symtab_hdr->sh_info];
-
+
/* Some relocs require a global offset table. */
if (dynobj == NULL)
{
@@ -2596,7 +2593,7 @@ sh_elf64_check_relocs (abfd, info, sec, relocs)
if (!_bfd_elf64_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
return false;
break;
-
+
/* This relocation describes which C++ vtable entries are actually
used. Record for later use during GC. */
case R_SH_GNU_VTENTRY:
@@ -2881,7 +2878,7 @@ sh_elf64_check_relocs (abfd, info, sec, relocs)
break;
}
}
-
+
return true;
}
@@ -3016,7 +3013,7 @@ sh64_elf64_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
we don't need to look up and make sure to emit the main symbol for each
DataLabel symbol. */
-boolean
+static boolean
sh64_elf64_link_output_symbol_hook (abfd, info, cname, sym, input_sec)
bfd *abfd ATTRIBUTE_UNUSED;
struct bfd_link_info *info;
diff --git a/bfd/elf64-sparc.c b/bfd/elf64-sparc.c
index 4933f8de801..590975d3c85 100644
--- a/bfd/elf64-sparc.c
+++ b/bfd/elf64-sparc.c
@@ -1386,7 +1386,7 @@ sparc64_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
return true;
}
else if (*namep && **namep
- && info->hash->creator->flavour == bfd_target_elf_flavour)
+ && info->hash->creator == abfd->xvec)
{
int i;
struct sparc64_elf_app_reg *p;
@@ -3067,6 +3067,7 @@ const struct elf_size_info sparc64_elf_size_info =
bfd_elf64_write_out_phdrs,
bfd_elf64_write_shdrs_and_ehdr,
sparc64_elf_write_relocs,
+ bfd_elf64_swap_symbol_in,
bfd_elf64_swap_symbol_out,
sparc64_elf_slurp_reloc_table,
bfd_elf64_slurp_symbol_table,
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index 30cc29a8d46..0ec6392dffa 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -125,6 +125,10 @@ static reloc_howto_type *elf64_x86_64_reloc_type_lookup
PARAMS ((bfd *, bfd_reloc_code_real_type));
static void elf64_x86_64_info_to_howto
PARAMS ((bfd *, arelent *, Elf64_Internal_Rela *));
+static boolean elf64_x86_64_grok_prstatus
+ PARAMS ((bfd *, Elf_Internal_Note *));
+static boolean elf64_x86_64_grok_psinfo
+ PARAMS ((bfd *, Elf_Internal_Note *));
static struct bfd_link_hash_table *elf64_x86_64_link_hash_table_create
PARAMS ((bfd *));
static boolean elf64_x86_64_elf_object_p PARAMS ((bfd *abfd));
@@ -208,6 +212,73 @@ elf64_x86_64_info_to_howto (abfd, cache_ptr, dst)
BFD_ASSERT (r_type == cache_ptr->howto->type);
}
+/* Support for core dump NOTE sections. */
+static boolean
+elf64_x86_64_grok_prstatus (abfd, note)
+ bfd *abfd;
+ Elf_Internal_Note *note;
+{
+ int offset;
+ size_t raw_size;
+
+ switch (note->descsz)
+ {
+ default:
+ return false;
+
+ case 336: /* sizeof(istruct elf_prstatus) on Linux/x86_64 */
+ /* pr_cursig */
+ elf_tdata (abfd)->core_signal
+ = bfd_get_16 (abfd, note->descdata + 12);
+
+ /* pr_pid */
+ elf_tdata (abfd)->core_pid
+ = bfd_get_32 (abfd, note->descdata + 32);
+
+ /* pr_reg */
+ offset = 112;
+ raw_size = 216;
+
+ break;
+ }
+
+ /* Make a ".reg/999" section. */
+ return _bfd_elfcore_make_pseudosection (abfd, ".reg",
+ raw_size, note->descpos + offset);
+}
+
+static boolean
+elf64_x86_64_grok_psinfo (abfd, note)
+ bfd *abfd;
+ Elf_Internal_Note *note;
+{
+ switch (note->descsz)
+ {
+ default:
+ return false;
+
+ case 136: /* sizeof(struct elf_prpsinfo) on Linux/x86_64 */
+ elf_tdata (abfd)->core_program
+ = _bfd_elfcore_strndup (abfd, note->descdata + 40, 16);
+ elf_tdata (abfd)->core_command
+ = _bfd_elfcore_strndup (abfd, note->descdata + 56, 80);
+ }
+
+ /* Note that for some reason, a spurious space is tacked
+ onto the end of the args in some (at least one anyway)
+ implementations, so strip it off if it exists. */
+
+ {
+ char *command = elf_tdata (abfd)->core_command;
+ int n = strlen (command);
+
+ if (0 < n && command[n - 1] == ' ')
+ command[n - 1] = '\0';
+ }
+
+ return true;
+}
+
/* Functions for the x86-64 ELF linker. */
/* The name of the dynamic interpreter. This is put in the .interp
@@ -1016,7 +1087,7 @@ elf64_x86_64_adjust_dynamic_symbol (info, h)
/* We must generate a R_X86_64_COPY reloc to tell the dynamic linker
to copy the initial value out of the dynamic object and into the
- runtime process image. */
+ runtime process image. */
if ((h->root.u.def.section->flags & SEC_ALLOC) != 0)
{
htab->srelbss->_raw_size += sizeof (Elf64_External_Rela);
@@ -2228,6 +2299,8 @@ elf64_x86_64_finish_dynamic_sections (output_bfd, info)
#define elf_backend_finish_dynamic_symbol elf64_x86_64_finish_dynamic_symbol
#define elf_backend_gc_mark_hook elf64_x86_64_gc_mark_hook
#define elf_backend_gc_sweep_hook elf64_x86_64_gc_sweep_hook
+#define elf_backend_grok_prstatus elf64_x86_64_grok_prstatus
+#define elf_backend_grok_psinfo elf64_x86_64_grok_psinfo
#define elf_backend_reloc_type_class elf64_x86_64_reloc_type_class
#define elf_backend_relocate_section elf64_x86_64_relocate_section
#define elf_backend_size_dynamic_sections elf64_x86_64_size_dynamic_sections
diff --git a/bfd/elfarm-oabi.c b/bfd/elfarm-oabi.c
index 25c4d894027..c8e3fe6248f 100644
--- a/bfd/elfarm-oabi.c
+++ b/bfd/elfarm-oabi.c
@@ -1,5 +1,5 @@
/* 32-bit ELF support for ARM old abi option.
- Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -18,6 +18,14 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define OLD_ARM_ABI
+#define bfd_elf32_arm_allocate_interworking_sections \
+ bfd_elf32_arm_oabi_allocate_interworking_sections
+#define bfd_elf32_arm_get_bfd_for_interworking \
+ bfd_elf32_arm_oabi_get_bfd_for_interworking
+#define bfd_elf32_arm_process_before_allocation \
+ bfd_elf32_arm_oabi_process_before_allocation
+#define bfd_elf32_arm_add_glue_sections_to_bfd \
+ bfd_elf32_arm_oabi_add_glue_sections_to_bfd
#include "elf/arm.h"
#include "bfd.h"
@@ -417,11 +425,4 @@ elf32_arm_reloc_type_lookup (abfd, code)
return NULL;
}
-#define bfd_elf32_arm_allocate_interworking_sections \
- bfd_elf32_arm_oabi_allocate_interworking_sections
-#define bfd_elf32_arm_get_bfd_for_interworking \
- bfd_elf32_arm_oabi_get_bfd_for_interworking
-#define bfd_elf32_arm_process_before_allocation \
- bfd_elf32_arm_oabi_process_before_allocation
-
#include "elf32-arm.h"
diff --git a/bfd/elfcode.h b/bfd/elfcode.h
index 203323cdb5e..3e29c0287b1 100644
--- a/bfd/elfcode.h
+++ b/bfd/elfcode.h
@@ -1,6 +1,6 @@
/* ELF executable support for BFD.
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
- 2001 Free Software Foundation, Inc.
+ 2001, 2002 Free Software Foundation, Inc.
Written by Fred Fish @ Cygnus Support, from information published
in "UNIX System V Release 4, Programmers Guide: ANSI C and
@@ -203,12 +203,14 @@ static char *elf_symbol_flags PARAMS ((flagword));
format. */
void
-elf_swap_symbol_in (abfd, src, shndx, dst)
+elf_swap_symbol_in (abfd, psrc, pshn, dst)
bfd *abfd;
- const Elf_External_Sym *src;
- const Elf_External_Sym_Shndx *shndx;
+ const PTR psrc;
+ const PTR pshn;
Elf_Internal_Sym *dst;
{
+ const Elf_External_Sym *src = (const Elf_External_Sym *) psrc;
+ const Elf_External_Sym_Shndx *shndx = (const Elf_External_Sym_Shndx *) pshn;
int signed_vma = get_elf_backend_data (abfd)->sign_extend_vma;
dst->st_name = H_GET_32 (abfd, src->st_name);
@@ -1242,8 +1244,9 @@ elf_slurp_symbol_table (abfd, symptrs, dynamic)
/* Skip first symbol, which is a null dummy. */
for (i = 1; i < symcount; i++)
{
- elf_swap_symbol_in (abfd, x_symp + i,
- x_shndx + (x_shndx != NULL ? i : 0), &i_sym);
+ elf_swap_symbol_in (abfd, (const PTR) (x_symp + i),
+ (const PTR) (x_shndx + (x_shndx ? i : 0)),
+ &i_sym);
memcpy (&sym->internal_elf_sym, &i_sym, sizeof (Elf_Internal_Sym));
#ifdef ELF_KEEP_EXTSYM
memcpy (&sym->native_elf_sym, x_symp + i, sizeof (Elf_External_Sym));
@@ -1695,6 +1698,7 @@ const struct elf_size_info NAME(_bfd_elf,size_info) = {
elf_write_out_phdrs,
elf_write_shdrs_and_ehdr,
elf_write_relocs,
+ elf_swap_symbol_in,
elf_swap_symbol_out,
elf_slurp_reloc_table,
elf_slurp_symbol_table,
diff --git a/bfd/elflink.h b/bfd/elflink.h
index bfe63742522..9ba13fd0a28 100644
--- a/bfd/elflink.h
+++ b/bfd/elflink.h
@@ -65,7 +65,7 @@ static boolean elf_link_read_relocs_from_section
PARAMS ((bfd *, Elf_Internal_Shdr *, PTR, Elf_Internal_Rela *));
static size_t compute_bucket_count
PARAMS ((struct bfd_link_info *));
-static void elf_link_output_relocs
+static boolean elf_link_output_relocs
PARAMS ((bfd *, asection *, Elf_Internal_Shdr *, Elf_Internal_Rela *));
static boolean elf_link_size_reloc_section
PARAMS ((bfd *, Elf_Internal_Shdr *, asection *));
@@ -237,7 +237,7 @@ elf_link_is_defined_archive_symbol (abfd, symdef)
Elf_Internal_Sym sym;
const char * name;
- elf_swap_symbol_in (abfd, esym, shndx, &sym);
+ elf_swap_symbol_in (abfd, (const PTR) esym, (const PTR) shndx, &sym);
name = bfd_elf_string_from_elf_section (abfd, hdr->sh_link, sym.st_name);
if (name == (const char *) NULL)
@@ -313,12 +313,10 @@ elf_link_add_archive_symbols (abfd, info)
return true;
amt = c;
amt *= sizeof (boolean);
- defined = (boolean *) bfd_malloc (amt);
- included = (boolean *) bfd_malloc (amt);
+ defined = (boolean *) bfd_zmalloc (amt);
+ included = (boolean *) bfd_zmalloc (amt);
if (defined == (boolean *) NULL || included == (boolean *) NULL)
goto error_return;
- memset (defined, 0, (size_t) amt);
- memset (included, 0, (size_t) amt);
symdefs = bfd_ardata (abfd)->symdefs;
@@ -1666,7 +1664,7 @@ elf_link_add_object_symbols (abfd, info)
override = false;
- elf_swap_symbol_in (abfd, esym, shndx, &sym);
+ elf_swap_symbol_in (abfd, (const PTR) esym, (const PTR) shndx, &sym);
flags = BSF_NO_FLAGS;
sec = NULL;
@@ -1723,7 +1721,23 @@ elf_link_add_object_symbols (abfd, info)
if (name == (const char *) NULL)
goto error_return;
- if (add_symbol_hook)
+ if (sym.st_shndx == SHN_COMMON && ELF_ST_TYPE (sym.st_info) == STT_TLS)
+ {
+ asection *tcomm = bfd_get_section_by_name (abfd, ".tcommon");
+
+ if (tcomm == NULL)
+ {
+ tcomm = bfd_make_section (abfd, ".tcommon");
+ if (tcomm == NULL
+ || !bfd_set_section_flags (abfd, tcomm, (SEC_ALLOC
+ | SEC_IS_COMMON
+ | SEC_LINKER_CREATED
+ | SEC_THREAD_LOCAL)))
+ goto error_return;
+ }
+ sec = tcomm;
+ }
+ else if (add_symbol_hook)
{
if (! (*add_symbol_hook) (abfd, info, &sym, &name, &flags, &sec,
&value))
@@ -2258,7 +2272,9 @@ elf_link_add_object_symbols (abfd, info)
asection *stab, *stabstr;
stab = bfd_get_section_by_name (abfd, ".stab");
- if (stab != NULL && !(stab->flags & SEC_MERGE))
+ if (stab != NULL
+ && (stab->flags & SEC_MERGE) == 0
+ && !bfd_is_abs_section (stab->output_section))
{
stabstr = bfd_get_section_by_name (abfd, ".stabstr");
@@ -2284,7 +2300,8 @@ elf_link_add_object_symbols (abfd, info)
asection *s;
for (s = abfd->sections; s != NULL; s = s->next)
- if (s->flags & SEC_MERGE)
+ if ((s->flags & SEC_MERGE) != 0
+ && !bfd_is_abs_section (s->output_section))
{
struct bfd_elf_section_data *secdata;
@@ -2537,7 +2554,8 @@ elf_link_record_local_dynamic_symbol (info, input_bfd, input_indx)
|| bfd_bread ((PTR) shndx, amt, input_bfd) != amt)
return false;
}
- elf_swap_symbol_in (input_bfd, &esym, shndx, &entry->isym);
+ elf_swap_symbol_in (input_bfd, (const PTR) &esym, (const PTR) shndx,
+ &entry->isym);
name = (bfd_elf_string_from_elf_section
(input_bfd, elf_tdata (input_bfd)->symtab_hdr.sh_link,
@@ -3454,7 +3472,7 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
elf_tdata (output_bfd)->cverdefs = cdefs;
}
- if (info->new_dtags && info->flags)
+ if ((info->new_dtags && info->flags) || (info->flags & DF_STATIC_TLS))
{
if (! elf_add_dynamic_entry (info, (bfd_vma) DT_FLAGS, info->flags))
return false;
@@ -3645,10 +3663,9 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
BFD_ASSERT (s != NULL);
hash_entry_size = elf_section_data (s)->this_hdr.sh_entsize;
s->_raw_size = ((2 + bucketcount + dynsymcount) * hash_entry_size);
- s->contents = (bfd_byte *) bfd_alloc (output_bfd, s->_raw_size);
+ s->contents = (bfd_byte *) bfd_zalloc (output_bfd, s->_raw_size);
if (s->contents == NULL)
return false;
- memset (s->contents, 0, (size_t) s->_raw_size);
bfd_put (8 * hash_entry_size, output_bfd, (bfd_vma) bucketcount,
s->contents);
@@ -4478,6 +4495,8 @@ struct elf_final_link_info
asection *hash_sec;
/* symbol version section (.gnu.version). */
asection *symver_sec;
+ /* first SHF_TLS section (if any). */
+ asection *first_tls_sec;
/* Buffer large enough to hold contents of any section. */
bfd_byte *contents;
/* Buffer large enough to hold external relocs of any section. */
@@ -4957,6 +4976,14 @@ elf_bfd_final_link (abfd, info)
finfo.symbuf = NULL;
finfo.symshndxbuf = NULL;
finfo.symbuf_count = 0;
+ finfo.first_tls_sec = NULL;
+ for (o = abfd->sections; o != (asection *) NULL; o = o->next)
+ if ((o->flags & SEC_THREAD_LOCAL) != 0
+ && (o->flags & SEC_LOAD) != 0)
+ {
+ finfo.first_tls_sec = o;
+ break;
+ }
/* Count up the number of relocations we will output for each output
section, so that we know the sizes of the reloc sections. We
@@ -5321,6 +5348,40 @@ elf_bfd_final_link (abfd, info)
goto error_return;
}
+ if (finfo.first_tls_sec)
+ {
+ unsigned int align = 0;
+ bfd_vma base = finfo.first_tls_sec->vma, end = 0;
+ asection *sec;
+
+ for (sec = finfo.first_tls_sec;
+ sec && (sec->flags & SEC_THREAD_LOCAL);
+ sec = sec->next)
+ {
+ bfd_vma size = sec->_raw_size;
+
+ if (bfd_get_section_alignment (abfd, sec) > align)
+ align = bfd_get_section_alignment (abfd, sec);
+ if (sec->_raw_size == 0 && (sec->flags & SEC_HAS_CONTENTS) == 0)
+ {
+ struct bfd_link_order *o;
+
+ size = 0;
+ for (o = sec->link_order_head; o != NULL; o = o->next)
+ if (size < o->offset + o->size)
+ size = o->offset + o->size;
+ }
+ end = sec->vma + size;
+ }
+ elf_hash_table (info)->tls_segment
+ = bfd_zalloc (abfd, sizeof (struct elf_link_tls_segment));
+ if (elf_hash_table (info)->tls_segment == NULL)
+ goto error_return;
+ elf_hash_table (info)->tls_segment->start = base;
+ elf_hash_table (info)->tls_segment->size = end - base;
+ elf_hash_table (info)->tls_segment->align = align;
+ }
+
/* Since ELF permits relocations to be against local symbols, we
must have the local symbols available when we do the relocations.
Since we would rather only read the local symbols once, and we
@@ -5631,7 +5692,13 @@ elf_bfd_final_link (abfd, info)
name = ".fini_array";
get_size:
o = bfd_get_section_by_name (abfd, name);
- BFD_ASSERT (o != NULL);
+ if (o == NULL)
+ {
+ (*_bfd_error_handler)
+ (_("%s: could not find output section %s"),
+ bfd_get_filename (abfd), name);
+ goto error_return;
+ }
if (o->_raw_size == 0)
(*_bfd_error_handler)
(_("warning: %s section has zero size"), name);
@@ -5668,7 +5735,13 @@ elf_bfd_final_link (abfd, info)
name = ".gnu.version";
get_vma:
o = bfd_get_section_by_name (abfd, name);
- BFD_ASSERT (o != NULL);
+ if (o == NULL)
+ {
+ (*_bfd_error_handler)
+ (_("%s: could not find output section %s"),
+ bfd_get_filename (abfd), name);
+ goto error_return;
+ }
dyn.d_un.d_ptr = o->vma;
elf_swap_dyn_out (dynobj, &dyn, dyncon);
break;
@@ -5747,6 +5820,15 @@ elf_bfd_final_link (abfd, info)
}
}
+ if (info->relocateable)
+ {
+ boolean failed = false;
+
+ bfd_map_over_sections (abfd, bfd_elf_set_group_contents, &failed);
+ if (failed)
+ goto error_return;
+ }
+
/* If we have optimized stabs strings, output them. */
if (elf_hash_table (info)->stab_info != NULL)
{
@@ -6097,7 +6179,16 @@ elf_link_output_extsym (h, data)
addresses. */
sym.st_value = h->root.u.def.value + input_sec->output_offset;
if (! finfo->info->relocateable)
- sym.st_value += input_sec->output_section->vma;
+ {
+ sym.st_value += input_sec->output_section->vma;
+ if (h->type == STT_TLS)
+ {
+ /* STT_TLS symbols are relative to PT_TLS segment
+ base. */
+ BFD_ASSERT (finfo->first_tls_sec != NULL);
+ sym.st_value -= finfo->first_tls_sec->vma;
+ }
+ }
}
else
{
@@ -6251,7 +6342,7 @@ elf_link_output_extsym (h, data)
originated from the section given by INPUT_REL_HDR) to the
OUTPUT_BFD. */
-static void
+static boolean
elf_link_output_relocs (output_bfd, input_section, input_rel_hdr,
internal_relocs)
bfd *output_bfd;
@@ -6283,8 +6374,16 @@ elf_link_output_relocs (output_bfd, input_section, input_rel_hdr,
output_rel_hdr = elf_section_data (output_section)->rel_hdr2;
rel_countp = &elf_section_data (output_section)->rel_count2;
}
-
- BFD_ASSERT (output_rel_hdr != NULL);
+ else
+ {
+ (*_bfd_error_handler) (
+ _("%s: relocation size mismatch in %s section %s"),
+ bfd_get_filename (output_bfd),
+ bfd_archive_filename (input_section->owner),
+ input_section->name);
+ bfd_set_error (bfd_error_wrong_object_format);
+ return false;
+ }
bed = get_elf_backend_data (output_bfd);
irela = internal_relocs;
@@ -6341,6 +6440,8 @@ elf_link_output_relocs (output_bfd, input_section, input_rel_hdr,
/* Bump the counter, so that we know where to add the next set of
relocations. */
*rel_countp += NUM_SHDR_ENTRIES (input_rel_hdr);
+
+ return true;
}
/* Link an input file into the linker output file. This function
@@ -6439,7 +6540,8 @@ elf_link_input_bfd (finfo, input_bfd)
const char *name;
Elf_Internal_Sym osym;
- elf_swap_symbol_in (input_bfd, esym, shndx, isym);
+ elf_swap_symbol_in (input_bfd, (const PTR) esym, (const PTR) shndx,
+ isym);
*pindex = -1;
if (elf_bad_symtab (input_bfd))
@@ -6551,7 +6653,15 @@ elf_link_input_bfd (finfo, input_bfd)
these requirements. */
osym.st_value += isec->output_offset;
if (! finfo->info->relocateable)
- osym.st_value += isec->output_section->vma;
+ {
+ osym.st_value += isec->output_section->vma;
+ if (ELF_ST_TYPE (osym.st_info) == STT_TLS)
+ {
+ /* STT_TLS symbols are relative to PT_TLS segment base. */
+ BFD_ASSERT (finfo->first_tls_sec != NULL);
+ osym.st_value -= finfo->first_tls_sec->vma;
+ }
+ }
if (! elf_link_output_sym (finfo, name, &osym, isec))
return false;
@@ -6751,9 +6861,9 @@ elf_link_input_bfd (finfo, input_bfd)
struct elf_link_hash_entry **rel_hash;
Elf_Internal_Shdr *input_rel_hdr;
unsigned int next_erel;
- void (*reloc_emitter) PARAMS ((bfd *, asection *,
- Elf_Internal_Shdr *,
- Elf_Internal_Rela *));
+ boolean (*reloc_emitter) PARAMS ((bfd *, asection *,
+ Elf_Internal_Shdr *,
+ Elf_Internal_Rela *));
boolean rela_normal;
input_rel_hdr = &elf_section_data (o)->rel_hdr;
@@ -6886,7 +6996,16 @@ elf_link_input_bfd (finfo, input_bfd)
isym->st_value += sec->output_offset;
if (! finfo->info->relocateable)
- isym->st_value += osec->vma;
+ {
+ isym->st_value += osec->vma;
+ if (ELF_ST_TYPE (isym->st_info) == STT_TLS)
+ {
+ /* STT_TLS symbols are relative to PT_TLS
+ segment base. */
+ BFD_ASSERT (finfo->first_tls_sec != NULL);
+ isym->st_value -= finfo->first_tls_sec->vma;
+ }
+ }
finfo->indices[r_symndx]
= bfd_get_symcount (output_bfd);
@@ -6910,15 +7029,18 @@ elf_link_input_bfd (finfo, input_bfd)
else
reloc_emitter = elf_link_output_relocs;
- (*reloc_emitter) (output_bfd, o, input_rel_hdr, internal_relocs);
+ if (! (*reloc_emitter) (output_bfd, o, input_rel_hdr,
+ internal_relocs))
+ return false;
input_rel_hdr = elf_section_data (o)->rel_hdr2;
if (input_rel_hdr)
{
internal_relocs += (NUM_SHDR_ENTRIES (input_rel_hdr)
* bed->s->int_rels_per_ext_rel);
- (*reloc_emitter) (output_bfd, o, input_rel_hdr,
- internal_relocs);
+ if (! (*reloc_emitter) (output_bfd, o, input_rel_hdr,
+ internal_relocs))
+ return false;
}
}
@@ -7558,6 +7680,7 @@ elf_gc_mark (info, sec, gc_mark_hook)
asection *rsec;
struct elf_link_hash_entry *h;
Elf_Internal_Sym s;
+ Elf_External_Sym_Shndx *locshndx;
r_symndx = ELF_R_SYM (rel->r_info);
if (r_symndx == 0)
@@ -7565,9 +7688,10 @@ elf_gc_mark (info, sec, gc_mark_hook)
if (elf_bad_symtab (sec->owner))
{
+ locshndx = locsym_shndx + (locsym_shndx ? r_symndx : 0);
elf_swap_symbol_in (input_bfd,
- locsyms + r_symndx,
- locsym_shndx + (locsym_shndx ? r_symndx : 0),
+ (const PTR) (locsyms + r_symndx),
+ (const PTR) locshndx,
&s);
if (ELF_ST_BIND (s.st_info) == STB_LOCAL)
rsec = (*gc_mark_hook) (sec->owner, info, rel, NULL, &s);
@@ -7584,9 +7708,10 @@ elf_gc_mark (info, sec, gc_mark_hook)
}
else
{
+ locshndx = locsym_shndx + (locsym_shndx ? r_symndx : 0);
elf_swap_symbol_in (input_bfd,
- locsyms + r_symndx,
- locsym_shndx + (locsym_shndx ? r_symndx : 0),
+ (const PTR) (locsyms + r_symndx),
+ (const PTR) locshndx,
&s);
rsec = (*gc_mark_hook) (sec->owner, info, rel, NULL, &s);
}
@@ -8180,7 +8305,8 @@ elf_reloc_symbol_deleted_p (offset, cookie)
lshndx = (Elf_External_Sym_Shndx *) rcookie->locsym_shndx;
if (lshndx != NULL)
lshndx += r_symndx;
- elf_swap_symbol_in (rcookie->abfd, lsym, lshndx, &isym);
+ elf_swap_symbol_in (rcookie->abfd, (const PTR) lsym,
+ (const PTR) lshndx, &isym);
}
if (r_symndx >= rcookie->locsymcount
@@ -8267,11 +8393,19 @@ elf_bfd_discard_info (output_bfd, info)
if (ehdr)
{
eh = bfd_get_section_by_name (abfd, ".eh_frame");
- if (eh && eh->_raw_size == 0)
+ if (eh && (eh->_raw_size == 0
+ || bfd_is_abs_section (eh->output_section)))
eh = NULL;
}
- stab = strip ? NULL : bfd_get_section_by_name (abfd, ".stab");
+ stab = NULL;
+ if (!strip)
+ {
+ stab = bfd_get_section_by_name (abfd, ".stab");
+ if (stab && (stab->_raw_size == 0
+ || bfd_is_abs_section (stab->output_section)))
+ stab = NULL;
+ }
if ((! stab
|| elf_section_data(stab)->sec_info_type != ELF_INFO_TYPE_STABS)
&& ! eh
diff --git a/bfd/elfxx-ia64.c b/bfd/elfxx-ia64.c
index f92ab6ae0d8..c86ad43ac85 100644
--- a/bfd/elfxx-ia64.c
+++ b/bfd/elfxx-ia64.c
@@ -79,6 +79,9 @@ struct elfNN_ia64_dyn_sym_info
bfd_vma pltoff_offset;
bfd_vma plt_offset;
bfd_vma plt2_offset;
+ bfd_vma tprel_offset;
+ bfd_vma dtpmod_offset;
+ bfd_vma dtprel_offset;
/* The symbol table entry, if any, that this was derrived from. */
struct elf_link_hash_entry *h;
@@ -97,6 +100,9 @@ struct elfNN_ia64_dyn_sym_info
unsigned got_done : 1;
unsigned fptr_done : 1;
unsigned pltoff_done : 1;
+ unsigned tprel_done : 1;
+ unsigned dtpmod_done : 1;
+ unsigned dtprel_done : 1;
/* True for the different kinds of linker data we want created. */
unsigned want_got : 1;
@@ -105,6 +111,9 @@ struct elfNN_ia64_dyn_sym_info
unsigned want_plt : 1;
unsigned want_plt2 : 1;
unsigned want_pltoff : 1;
+ unsigned want_tprel : 1;
+ unsigned want_dtpmod : 1;
+ unsigned want_dtprel : 1;
};
struct elfNN_ia64_local_hash_entry
@@ -165,7 +174,7 @@ static boolean elfNN_ia64_relax_section
static boolean is_unwind_section_name
PARAMS ((bfd *abfd, const char *));
static boolean elfNN_ia64_section_from_shdr
- PARAMS ((bfd *, ElfNN_Internal_Shdr *, char *));
+ PARAMS ((bfd *, ElfNN_Internal_Shdr *, const char *));
static boolean elfNN_ia64_section_flags
PARAMS ((flagword *, ElfNN_Internal_Shdr *));
static boolean elfNN_ia64_fake_sections
@@ -285,6 +294,10 @@ static bfd_vma set_pltoff_entry
PARAMS ((bfd *abfd, struct bfd_link_info *info,
struct elfNN_ia64_dyn_sym_info *dyn_i,
bfd_vma value, boolean));
+static bfd_vma elfNN_ia64_tprel_base
+ PARAMS ((struct bfd_link_info *info));
+static bfd_vma elfNN_ia64_dtprel_base
+ PARAMS ((struct bfd_link_info *info));
static int elfNN_ia64_unwind_entry_compare
PARAMS ((const PTR, const PTR));
static boolean elfNN_ia64_final_link
@@ -423,10 +436,25 @@ static reloc_howto_type ia64_howto_table[] =
IA64_HOWTO (R_IA64_LTOFF22X, "LTOFF22X", 0, false, true),
IA64_HOWTO (R_IA64_LDXMOV, "LDXMOV", 0, false, true),
+ IA64_HOWTO (R_IA64_TPREL14, "TPREL14", 0, false, false),
IA64_HOWTO (R_IA64_TPREL22, "TPREL22", 0, false, false),
+ IA64_HOWTO (R_IA64_TPREL64I, "TPREL64I", 0, false, false),
IA64_HOWTO (R_IA64_TPREL64MSB, "TPREL64MSB", 8, false, false),
IA64_HOWTO (R_IA64_TPREL64LSB, "TPREL64LSB", 8, false, false),
- IA64_HOWTO (R_IA64_LTOFF_TP22, "LTOFF_TP22", 0, false, false),
+ IA64_HOWTO (R_IA64_LTOFF_TPREL22, "LTOFF_TPREL22", 0, false, false),
+
+ IA64_HOWTO (R_IA64_DTPMOD64MSB, "TPREL64MSB", 8, false, false),
+ IA64_HOWTO (R_IA64_DTPMOD64LSB, "TPREL64LSB", 8, false, false),
+ IA64_HOWTO (R_IA64_LTOFF_DTPMOD22, "LTOFF_DTPMOD22", 0, false, false),
+
+ IA64_HOWTO (R_IA64_DTPREL14, "DTPREL14", 0, false, false),
+ IA64_HOWTO (R_IA64_DTPREL22, "DTPREL22", 0, false, false),
+ IA64_HOWTO (R_IA64_DTPREL64I, "DTPREL64I", 0, false, false),
+ IA64_HOWTO (R_IA64_DTPREL32MSB, "DTPREL32MSB", 4, false, false),
+ IA64_HOWTO (R_IA64_DTPREL32LSB, "DTPREL32LSB", 4, false, false),
+ IA64_HOWTO (R_IA64_DTPREL64MSB, "DTPREL64MSB", 8, false, false),
+ IA64_HOWTO (R_IA64_DTPREL64LSB, "DTPREL64LSB", 8, false, false),
+ IA64_HOWTO (R_IA64_LTOFF_DTPREL22, "LTOFF_DTPREL22", 0, false, false),
};
static unsigned char elf_code_to_howto_index[R_IA64_MAX_RELOC_CODE + 1];
@@ -541,10 +569,25 @@ elfNN_ia64_reloc_type_lookup (abfd, bfd_code)
case BFD_RELOC_IA64_LTOFF22X: rtype = R_IA64_LTOFF22X; break;
case BFD_RELOC_IA64_LDXMOV: rtype = R_IA64_LDXMOV; break;
+ case BFD_RELOC_IA64_TPREL14: rtype = R_IA64_TPREL14; break;
case BFD_RELOC_IA64_TPREL22: rtype = R_IA64_TPREL22; break;
+ case BFD_RELOC_IA64_TPREL64I: rtype = R_IA64_TPREL64I; break;
case BFD_RELOC_IA64_TPREL64MSB: rtype = R_IA64_TPREL64MSB; break;
case BFD_RELOC_IA64_TPREL64LSB: rtype = R_IA64_TPREL64LSB; break;
- case BFD_RELOC_IA64_LTOFF_TP22: rtype = R_IA64_LTOFF_TP22; break;
+ case BFD_RELOC_IA64_LTOFF_TPREL22: rtype = R_IA64_LTOFF_TPREL22; break;
+
+ case BFD_RELOC_IA64_DTPMOD64MSB: rtype = R_IA64_DTPMOD64MSB; break;
+ case BFD_RELOC_IA64_DTPMOD64LSB: rtype = R_IA64_DTPMOD64LSB; break;
+ case BFD_RELOC_IA64_LTOFF_DTPMOD22: rtype = R_IA64_LTOFF_DTPMOD22; break;
+
+ case BFD_RELOC_IA64_DTPREL14: rtype = R_IA64_DTPREL14; break;
+ case BFD_RELOC_IA64_DTPREL22: rtype = R_IA64_DTPREL22; break;
+ case BFD_RELOC_IA64_DTPREL64I: rtype = R_IA64_DTPREL64I; break;
+ case BFD_RELOC_IA64_DTPREL32MSB: rtype = R_IA64_DTPREL32MSB; break;
+ case BFD_RELOC_IA64_DTPREL32LSB: rtype = R_IA64_DTPREL32LSB; break;
+ case BFD_RELOC_IA64_DTPREL64MSB: rtype = R_IA64_DTPREL64MSB; break;
+ case BFD_RELOC_IA64_DTPREL64LSB: rtype = R_IA64_DTPREL64LSB; break;
+ case BFD_RELOC_IA64_LTOFF_DTPREL22: rtype = R_IA64_LTOFF_DTPREL22; break;
default: return 0;
}
@@ -769,7 +812,8 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again)
/* A local symbol. */
esym = extsyms + ELFNN_R_SYM (irel->r_info);
shndx = shndx_buf + (shndx_buf ? ELFNN_R_SYM (irel->r_info) : 0);
- bfd_elfNN_swap_symbol_in (abfd, esym, shndx, &isym);
+ bfd_elfNN_swap_symbol_in (abfd, (const PTR) esym, (const PTR) shndx,
+ &isym);
if (isym.st_shndx == SHN_UNDEF)
continue; /* We can't do anthing with undefined symbols. */
else if (isym.st_shndx == SHN_ABS)
@@ -1004,7 +1048,7 @@ static boolean
elfNN_ia64_section_from_shdr (abfd, hdr, name)
bfd *abfd;
ElfNN_Internal_Shdr *hdr;
- char *name;
+ const char *name;
{
asection *newsect;
@@ -2097,6 +2141,9 @@ elfNN_ia64_check_relocs (abfd, info, sec, relocs)
NEED_FULL_PLT = 16,
NEED_DYNREL = 32,
NEED_LTOFF_FPTR = 64,
+ NEED_TPREL = 128,
+ NEED_DTPMOD = 256,
+ NEED_DTPREL = 512
};
struct elf_link_hash_entry *h = NULL;
@@ -2134,11 +2181,42 @@ elfNN_ia64_check_relocs (abfd, info, sec, relocs)
need_entry = 0;
switch (ELFNN_R_TYPE (rel->r_info))
{
- case R_IA64_TPREL22:
case R_IA64_TPREL64MSB:
case R_IA64_TPREL64LSB:
- case R_IA64_LTOFF_TP22:
- return false;
+ if (info->shared || maybe_dynamic)
+ need_entry = NEED_DYNREL;
+ dynrel_type = R_IA64_TPREL64LSB;
+ if (info->shared)
+ info->flags |= DF_STATIC_TLS;
+ break;
+
+ case R_IA64_LTOFF_TPREL22:
+ need_entry = NEED_TPREL;
+ if (info->shared)
+ info->flags |= DF_STATIC_TLS;
+ break;
+
+ case R_IA64_DTPREL64MSB:
+ case R_IA64_DTPREL64LSB:
+ if (info->shared || maybe_dynamic)
+ need_entry = NEED_DYNREL;
+ dynrel_type = R_IA64_DTPREL64LSB;
+ break;
+
+ case R_IA64_LTOFF_DTPREL22:
+ need_entry = NEED_DTPREL;
+ break;
+
+ case R_IA64_DTPMOD64MSB:
+ case R_IA64_DTPMOD64LSB:
+ if (info->shared || maybe_dynamic)
+ need_entry = NEED_DYNREL;
+ dynrel_type = R_IA64_DTPMOD64LSB;
+ break;
+
+ case R_IA64_LTOFF_DTPMOD22:
+ need_entry = NEED_DTPMOD;
+ break;
case R_IA64_LTOFF_FPTR22:
case R_IA64_LTOFF_FPTR64I:
@@ -2248,7 +2326,7 @@ elfNN_ia64_check_relocs (abfd, info, sec, relocs)
dyn_i->h = h;
/* Create what's needed. */
- if (need_entry & NEED_GOT)
+ if (need_entry & (NEED_GOT | NEED_TPREL | NEED_DTPMOD | NEED_DTPREL))
{
if (!got)
{
@@ -2256,7 +2334,14 @@ elfNN_ia64_check_relocs (abfd, info, sec, relocs)
if (!got)
return false;
}
- dyn_i->want_got = 1;
+ if (need_entry & NEED_GOT)
+ dyn_i->want_got = 1;
+ if (need_entry & NEED_TPREL)
+ dyn_i->want_tprel = 1;
+ if (need_entry & NEED_DTPMOD)
+ dyn_i->want_dtpmod = 1;
+ if (need_entry & NEED_DTPREL)
+ dyn_i->want_dtprel = 1;
}
if (need_entry & NEED_FPTR)
{
@@ -2336,6 +2421,21 @@ allocate_global_data_got (dyn_i, data)
dyn_i->got_offset = x->ofs;
x->ofs += 8;
}
+ if (dyn_i->want_tprel)
+ {
+ dyn_i->tprel_offset = x->ofs;
+ x->ofs += 8;
+ }
+ if (dyn_i->want_dtpmod)
+ {
+ dyn_i->dtpmod_offset = x->ofs;
+ x->ofs += 8;
+ }
+ if (dyn_i->want_dtprel)
+ {
+ dyn_i->dtprel_offset = x->ofs;
+ x->ofs += 8;
+ }
return true;
}
@@ -2582,6 +2682,10 @@ allocate_dynrel_entries (dyn_i, data)
if (!dynamic_symbol)
count *= 2;
break;
+ case R_IA64_TPREL64LSB:
+ case R_IA64_DTPREL64LSB:
+ case R_IA64_DTPMOD64LSB:
+ break;
default:
abort ();
}
@@ -2593,6 +2697,12 @@ allocate_dynrel_entries (dyn_i, data)
if (((dynamic_symbol || shared) && dyn_i->want_got)
|| (dyn_i->want_ltoff_fptr && dyn_i->h && dyn_i->h->dynindx != -1))
ia64_info->rel_got_sec->_raw_size += sizeof (ElfNN_External_Rela);
+ if ((dynamic_symbol || shared) && dyn_i->want_tprel)
+ ia64_info->rel_got_sec->_raw_size += sizeof (ElfNN_External_Rela);
+ if ((dynamic_symbol || shared) && dyn_i->want_dtpmod)
+ ia64_info->rel_got_sec->_raw_size += sizeof (ElfNN_External_Rela);
+ if (dynamic_symbol && dyn_i->want_dtprel)
+ ia64_info->rel_got_sec->_raw_size += sizeof (ElfNN_External_Rela);
if (dyn_i->want_pltoff)
{
@@ -2903,7 +3013,11 @@ elfNN_ia64_install_value (abfd, hit_addr, v, r_type)
/* Instruction relocations. */
- case R_IA64_IMM14: opnd = IA64_OPND_IMM14; break;
+ case R_IA64_IMM14:
+ case R_IA64_TPREL14:
+ case R_IA64_DTPREL14:
+ opnd = IA64_OPND_IMM14;
+ break;
case R_IA64_PCREL21F: opnd = IA64_OPND_TGT25; break;
case R_IA64_PCREL21M: opnd = IA64_OPND_TGT25b; break;
@@ -2920,6 +3034,11 @@ elfNN_ia64_install_value (abfd, hit_addr, v, r_type)
case R_IA64_PLTOFF22:
case R_IA64_PCREL22:
case R_IA64_LTOFF_FPTR22:
+ case R_IA64_TPREL22:
+ case R_IA64_DTPREL22:
+ case R_IA64_LTOFF_TPREL22:
+ case R_IA64_LTOFF_DTPMOD22:
+ case R_IA64_LTOFF_DTPREL22:
opnd = IA64_OPND_IMM22;
break;
@@ -2930,6 +3049,8 @@ elfNN_ia64_install_value (abfd, hit_addr, v, r_type)
case R_IA64_PCREL64I:
case R_IA64_FPTR64I:
case R_IA64_LTOFF_FPTR64I:
+ case R_IA64_TPREL64I:
+ case R_IA64_DTPREL64I:
opnd = IA64_OPND_IMMU64;
break;
@@ -2943,6 +3064,7 @@ elfNN_ia64_install_value (abfd, hit_addr, v, r_type)
case R_IA64_SEGREL32MSB:
case R_IA64_SECREL32MSB:
case R_IA64_LTV32MSB:
+ case R_IA64_DTPREL32MSB:
size = 4; bigendian = 1;
break;
@@ -2954,6 +3076,7 @@ elfNN_ia64_install_value (abfd, hit_addr, v, r_type)
case R_IA64_SEGREL32LSB:
case R_IA64_SECREL32LSB:
case R_IA64_LTV32LSB:
+ case R_IA64_DTPREL32LSB:
size = 4; bigendian = 0;
break;
@@ -2966,6 +3089,9 @@ elfNN_ia64_install_value (abfd, hit_addr, v, r_type)
case R_IA64_SEGREL64MSB:
case R_IA64_SECREL64MSB:
case R_IA64_LTV64MSB:
+ case R_IA64_TPREL64MSB:
+ case R_IA64_DTPMOD64MSB:
+ case R_IA64_DTPREL64MSB:
size = 8; bigendian = 1;
break;
@@ -2978,6 +3104,9 @@ elfNN_ia64_install_value (abfd, hit_addr, v, r_type)
case R_IA64_SEGREL64LSB:
case R_IA64_SECREL64LSB:
case R_IA64_LTV64LSB:
+ case R_IA64_TPREL64LSB:
+ case R_IA64_DTPMOD64LSB:
+ case R_IA64_DTPREL64LSB:
size = 8; bigendian = 0;
break;
@@ -3132,26 +3261,53 @@ set_got_entry (abfd, info, dyn_i, dynindx, addend, value, dyn_r_type)
{
struct elfNN_ia64_link_hash_table *ia64_info;
asection *got_sec;
+ boolean done;
+ bfd_vma got_offset;
ia64_info = elfNN_ia64_hash_table (info);
got_sec = ia64_info->got_sec;
- BFD_ASSERT ((dyn_i->got_offset & 7) == 0);
-
- if (! dyn_i->got_done)
+ switch (dyn_r_type)
{
+ case R_IA64_TPREL64LSB:
+ done = dyn_i->tprel_done;
+ dyn_i->tprel_done = true;
+ got_offset = dyn_i->tprel_offset;
+ break;
+ case R_IA64_DTPMOD64LSB:
+ done = dyn_i->dtpmod_done;
+ dyn_i->dtpmod_done = true;
+ got_offset = dyn_i->dtpmod_offset;
+ break;
+ case R_IA64_DTPREL64LSB:
+ done = dyn_i->dtprel_done;
+ dyn_i->dtprel_done = true;
+ got_offset = dyn_i->dtprel_offset;
+ break;
+ default:
+ done = dyn_i->got_done;
dyn_i->got_done = true;
+ got_offset = dyn_i->got_offset;
+ break;
+ }
+ BFD_ASSERT ((got_offset & 7) == 0);
+
+ if (! done)
+ {
/* Store the target address in the linkage table entry. */
- bfd_put_64 (abfd, value, got_sec->contents + dyn_i->got_offset);
+ bfd_put_64 (abfd, value, got_sec->contents + got_offset);
/* Install a dynamic relocation if needed. */
- if (info->shared
+ if ((info->shared && dyn_r_type != R_IA64_DTPREL64LSB)
|| elfNN_ia64_dynamic_symbol_p (dyn_i->h, info)
|| elfNN_ia64_aix_vec (abfd->xvec)
|| (dynindx != -1 && dyn_r_type == R_IA64_FPTR64LSB))
{
- if (dynindx == -1)
+ if (dynindx == -1
+ && dyn_r_type != R_IA64_TPREL64LSB
+ && dyn_r_type != R_IA64_DTPMOD64LSB
+ && dyn_r_type != R_IA64_DTPREL64LSB)
{
dyn_r_type = R_IA64_REL64LSB;
dynindx = 0;
@@ -3171,6 +3327,15 @@ set_got_entry (abfd, info, dyn_i, dynindx, addend, value, dyn_r_type)
case R_IA64_FPTR64LSB:
dyn_r_type = R_IA64_FPTR64MSB;
break;
+ case R_IA64_TPREL64LSB:
+ dyn_r_type = R_IA64_TPREL64MSB;
+ break;
+ case R_IA64_DTPMOD64LSB:
+ dyn_r_type = R_IA64_DTPMOD64MSB;
+ break;
+ case R_IA64_DTPREL64LSB:
+ dyn_r_type = R_IA64_DTPREL64MSB;
+ break;
default:
BFD_ASSERT (false);
break;
@@ -3179,7 +3344,7 @@ set_got_entry (abfd, info, dyn_i, dynindx, addend, value, dyn_r_type)
elfNN_ia64_install_dyn_reloc (abfd, NULL, got_sec,
ia64_info->rel_got_sec,
- dyn_i->got_offset, dyn_r_type,
+ got_offset, dyn_r_type,
dynindx, addend);
}
}
@@ -3187,7 +3352,7 @@ set_got_entry (abfd, info, dyn_i, dynindx, addend, value, dyn_r_type)
/* Return the address of the linkage table entry. */
value = (got_sec->output_section->vma
+ got_sec->output_offset
- + dyn_i->got_offset);
+ + got_offset);
return value;
}
@@ -3285,6 +3450,35 @@ set_pltoff_entry (abfd, info, dyn_i, value, is_plt)
return value;
}
+/* Return the base VMA address which should be subtracted from real addresses
+ when resolving @tprel() relocation.
+ Main program TLS (whose template starts at PT_TLS p_vaddr)
+ is assigned offset round(16, PT_TLS p_align). */
+
+static bfd_vma
+elfNN_ia64_tprel_base (info)
+ struct bfd_link_info *info;
+{
+ struct elf_link_tls_segment *tls_segment
+ = elf_hash_table (info)->tls_segment;
+
+ BFD_ASSERT (tls_segment != NULL);
+ return (tls_segment->start
+ - align_power ((bfd_vma) 16, tls_segment->align));
+}
+
+/* Return the base VMA address which should be subtracted from real addresses
+ when resolving @dtprel() relocation.
+ This is PT_TLS segment p_vaddr. */
+
+static bfd_vma
+elfNN_ia64_dtprel_base (info)
+ struct bfd_link_info *info;
+{
+ BFD_ASSERT (elf_hash_table (info)->tls_segment != NULL);
+ return elf_hash_table (info)->tls_segment->start;
+}
+
/* Called through qsort to sort the .IA_64.unwind section during a
non-relocatable link. Set elfNN_ia64_unwind_entry_compare_bfd
to the output bfd so we can do proper endianness frobbing. */
@@ -4030,6 +4224,55 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
r_type);
break;
+ case R_IA64_TPREL14:
+ case R_IA64_TPREL22:
+ case R_IA64_TPREL64I:
+ value -= elfNN_ia64_tprel_base (info);
+ r = elfNN_ia64_install_value (output_bfd, hit_addr, value, r_type);
+ break;
+
+ case R_IA64_DTPREL14:
+ case R_IA64_DTPREL22:
+ case R_IA64_DTPREL64I:
+ value -= elfNN_ia64_dtprel_base (info);
+ r = elfNN_ia64_install_value (output_bfd, hit_addr, value, r_type);
+ break;
+
+ case R_IA64_LTOFF_TPREL22:
+ case R_IA64_LTOFF_DTPMOD22:
+ case R_IA64_LTOFF_DTPREL22:
+ {
+ int got_r_type;
+
+ switch (r_type)
+ {
+ default:
+ case R_IA64_LTOFF_TPREL22:
+ if (!dynamic_symbol_p && !info->shared)
+ value -= elfNN_ia64_tprel_base (info);
+ got_r_type = R_IA64_TPREL64LSB;
+ break;
+ case R_IA64_LTOFF_DTPMOD22:
+ if (!dynamic_symbol_p && !info->shared)
+ value = 1;
+ got_r_type = R_IA64_DTPMOD64LSB;
+ break;
+ case R_IA64_LTOFF_DTPREL22:
+ if (!dynamic_symbol_p)
+ value -= elfNN_ia64_dtprel_base (info);
+ got_r_type = R_IA64_DTPREL64LSB;
+ break;
+ }
+ dyn_i = get_dyn_sym_info (ia64_info, h, input_bfd, rel, false);
+ value = set_got_entry (input_bfd, info, dyn_i,
+ (h ? h->dynindx : -1), rel->r_addend,
+ value, got_r_type);
+ value -= gp_val;
+ r = elfNN_ia64_install_value (output_bfd, hit_addr, value,
+ r_type);
+ }
+ break;
+
default:
r = bfd_reloc_notsupported;
break;
diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c
index 8ec22b9aee3..a2200d50610 100644
--- a/bfd/elfxx-mips.c
+++ b/bfd/elfxx-mips.c
@@ -135,7 +135,7 @@ struct mips_elf_link_hash_table
/* The size of the .compact_rel section (if SGI_COMPAT). */
bfd_size_type compact_rel_size;
/* This flag indicates that the value of DT_MIPS_RLD_MAP dynamic
- entry is set to the address of __rld_obj_head as in Irix 5. */
+ entry is set to the address of __rld_obj_head as in IRIX5. */
boolean use_rld_obj_head;
/* This is the value of the __rld_map or __rld_obj_head symbol. */
bfd_vma rld_value;
@@ -154,7 +154,7 @@ struct extsym_info
boolean failed;
};
-/* The names of the runtime procedure table symbols used on Irix 5. */
+/* The names of the runtime procedure table symbols used on IRIX5. */
static const char * const mips_elf_dynsym_rtproc_names[] =
{
@@ -165,7 +165,7 @@ static const char * const mips_elf_dynsym_rtproc_names[] =
};
/* These structures are used to generate the .compact_rel section on
- Irix 5. */
+ IRIX5. */
typedef struct
{
@@ -375,7 +375,7 @@ static bfd *reldyn_sorting_bfd;
/* Nonzero if ABFD is using the 64-bit ABI. */
#define ABI_64_P(abfd) \
- ((elf_elfheader (abfd)->e_ident[EI_CLASS] == ELFCLASS64) != 0)
+ ((get_elf_backend_data (abfd)->s->elfclass == ELFCLASS64) != 0)
#define IRIX_COMPAT(abfd) \
(get_elf_backend_data (abfd)->elf_backend_mips_irix_compat (abfd))
@@ -2082,8 +2082,16 @@ mips_elf_calculate_relocation (abfd, input_bfd, input_section, info,
sec = local_sections[r_symndx];
symbol = sec->output_section->vma + sec->output_offset;
- if (ELF_ST_TYPE (sym->st_info) != STT_SECTION)
+ if (ELF_ST_TYPE (sym->st_info) != STT_SECTION
+ || (sec->flags & SEC_MERGE))
symbol += sym->st_value;
+ if ((sec->flags & SEC_MERGE)
+ && ELF_ST_TYPE (sym->st_info) == STT_SECTION)
+ {
+ addend = _bfd_elf_rel_local_sym (abfd, sym, &sec, addend);
+ addend -= symbol;
+ addend += sec->output_section->vma + sec->output_offset;
+ }
/* MIPS16 text labels should be treated as odd. */
if (sym->st_other == STO_MIPS16)
@@ -2411,7 +2419,7 @@ mips_elf_calculate_relocation (abfd, input_bfd, input_section, info,
{
value = addend + gp - p + 4;
/* The MIPS ABI requires checking the R_MIPS_LO16 relocation
- for overflow. But, on, say, Irix 5, relocations against
+ for overflow. But, on, say, IRIX5, relocations against
_gp_disp are normally generated from the .cpload
pseudo-op. It generates code that normally looks like
this:
@@ -3351,7 +3359,7 @@ boolean
_bfd_mips_elf_section_from_shdr (abfd, hdr, name)
bfd *abfd;
Elf_Internal_Shdr *hdr;
- char *name;
+ const char *name;
{
flagword flags = 0;
@@ -3542,7 +3550,7 @@ _bfd_mips_elf_fake_sections (abfd, hdr, sec)
else if (strcmp (name, ".mdebug") == 0)
{
hdr->sh_type = SHT_MIPS_DEBUG;
- /* In a shared object on Irix 5.3, the .mdebug section has an
+ /* In a shared object on IRIX 5.3, the .mdebug section has an
entsize of 0. FIXME: Does this matter? */
if (SGI_COMPAT (abfd) && (abfd->flags & DYNAMIC) != 0)
hdr->sh_entsize = 0;
@@ -3552,7 +3560,7 @@ _bfd_mips_elf_fake_sections (abfd, hdr, sec)
else if (strcmp (name, ".reginfo") == 0)
{
hdr->sh_type = SHT_MIPS_REGINFO;
- /* In a shared object on Irix 5.3, the .reginfo section has an
+ /* In a shared object on IRIX 5.3, the .reginfo section has an
entsize of 0x18. FIXME: Does this matter? */
if (SGI_COMPAT (abfd))
{
@@ -3572,7 +3580,7 @@ _bfd_mips_elf_fake_sections (abfd, hdr, sec)
if (SGI_COMPAT (abfd))
hdr->sh_entsize = 0;
#if 0
- /* This isn't how the Irix 6 linker behaves. */
+ /* This isn't how the IRIX6 linker behaves. */
hdr->sh_info = SIZEOF_MIPS_DYNSYM_SECNAMES;
#endif
}
@@ -3693,7 +3701,7 @@ _bfd_mips_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
&& (abfd->flags & DYNAMIC) != 0
&& strcmp (*namep, "_rld_new_interface") == 0)
{
- /* Skip Irix 5 rld entry name. */
+ /* Skip IRIX5 rld entry name. */
*namep = NULL;
return true;
}
@@ -4790,7 +4798,7 @@ _bfd_mips_elf_size_dynamic_sections (output_bfd, info)
}
else if (strcmp (name, MIPS_ELF_STUB_SECTION_NAME (output_bfd)) == 0)
{
- /* Irix rld assumes that the function stub isn't at the end
+ /* IRIX rld assumes that the function stub isn't at the end
of .text section. So put a dummy. XXX */
s->_raw_size += MIPS_FUNCTION_STUB_SIZE;
}
@@ -5005,8 +5013,7 @@ _bfd_mips_elf_relocate_section (output_bfd, info, input_bfd, input_section,
space. Thus, when they use an R_MIPS_64 they mean what is
usually meant by R_MIPS_32, with the exception that the
stored value is sign-extended to 64 bits. */
- howto = MIPS_ELF_RTYPE_TO_HOWTO (input_bfd, R_MIPS_32,
- NEWABI_P (input_bfd));
+ howto = MIPS_ELF_RTYPE_TO_HOWTO (input_bfd, R_MIPS_32, false);
/* On big-endian systems, we need to lie about the position
of the reloc. */
@@ -5041,6 +5048,7 @@ _bfd_mips_elf_relocate_section (output_bfd, info, input_bfd, input_section,
addend = mips_elf_obtain_contents (howto, rel, input_bfd,
contents);
addend &= howto->src_mask;
+ addend <<= howto->rightshift;
/* For some kinds of relocations, the ADDEND is a
combination of the addend stored in two different
@@ -5073,11 +5081,11 @@ _bfd_mips_elf_relocate_section (output_bfd, info, input_bfd, input_section,
return false;
/* Obtain the addend kept there. */
- lo16_howto = MIPS_ELF_RTYPE_TO_HOWTO (input_bfd, lo,
- rela_relocation_p);
+ lo16_howto = MIPS_ELF_RTYPE_TO_HOWTO (input_bfd, lo, false);
l = mips_elf_obtain_contents (lo16_howto, lo16_relocation,
input_bfd, contents);
l &= lo16_howto->src_mask;
+ l <<= lo16_howto->rightshift;
l = mips_elf_sign_extend (l, 16);
addend <<= 16;
@@ -5136,13 +5144,6 @@ _bfd_mips_elf_relocate_section (output_bfd, info, input_bfd, input_section,
|| r_type == R_MIPS_LITERAL)
addend -= (_bfd_get_gp_value (output_bfd)
- _bfd_get_gp_value (input_bfd));
- else if (r_type == R_MIPS_26 || r_type == R_MIPS16_26
- || r_type == R_MIPS_GNU_REL16_S2)
- /* The addend is stored without its two least
- significant bits (which are always zero.) In a
- non-relocateable link, calculate_relocation will do
- this shift; here, we must do it ourselves. */
- addend <<= 2;
r_symndx = ELF_R_SYM (output_bfd, rel->r_info);
sym = local_syms + r_symndx;
@@ -5150,23 +5151,20 @@ _bfd_mips_elf_relocate_section (output_bfd, info, input_bfd, input_section,
/* Adjust the addend appropriately. */
addend += local_sections[r_symndx]->output_offset;
- /* If the relocation is for a R_MIPS_HI16 or R_MIPS_GOT16,
- then we only want to write out the high-order 16 bits.
- The subsequent R_MIPS_LO16 will handle the low-order bits. */
- if (r_type == R_MIPS_HI16 || r_type == R_MIPS_GOT16
- || r_type == R_MIPS_GNU_REL_HI16)
- addend = mips_elf_high (addend);
- else if (r_type == R_MIPS_HIGHER)
- addend = mips_elf_higher (addend);
- else if (r_type == R_MIPS_HIGHEST)
- addend = mips_elf_highest (addend);
-
- /* If the relocation is for an R_MIPS_26 relocation, then
- the two low-order bits are not stored in the object file;
- they are implicitly zero. */
- else if (r_type == R_MIPS_26 || r_type == R_MIPS16_26
- || r_type == R_MIPS_GNU_REL16_S2)
- addend >>= 2;
+ if (howto->partial_inplace)
+ {
+ /* If the relocation is for a R_MIPS_HI16 or R_MIPS_GOT16,
+ then we only want to write out the high-order 16 bits.
+ The subsequent R_MIPS_LO16 will handle the low-order bits.
+ */
+ if (r_type == R_MIPS_HI16 || r_type == R_MIPS_GOT16
+ || r_type == R_MIPS_GNU_REL_HI16)
+ addend = mips_elf_high (addend);
+ else if (r_type == R_MIPS_HIGHER)
+ addend = mips_elf_higher (addend);
+ else if (r_type == R_MIPS_HIGHEST)
+ addend = mips_elf_highest (addend);
+ }
if (rela_relocation_p)
/* If this is a RELA relocation, just update the addend.
@@ -5179,9 +5177,10 @@ _bfd_mips_elf_relocate_section (output_bfd, info, input_bfd, input_section,
destination mask because the place to which we are
writing will be source of the addend in the final
link. */
+ addend >>= howto->rightshift;
addend &= howto->src_mask;
- if (r_type == R_MIPS_64 && !ABI_64_P (output_bfd))
+ if (r_type == R_MIPS_64 && ! NEWABI_P (output_bfd))
/* See the comment above about using R_MIPS_64 in the 32-bit
ABI. Here, we need to update the addend. It would be
possible to get away with just using the R_MIPS_32 reloc
@@ -5242,6 +5241,8 @@ _bfd_mips_elf_relocate_section (output_bfd, info, input_bfd, input_section,
else
use_saved_addend_p = false;
+ addend >>= howto->rightshift;
+
/* Figure out what value we are supposed to relocate. */
switch (mips_elf_calculate_relocation (output_bfd, input_bfd,
input_section, info, rel,
@@ -5785,7 +5786,7 @@ _bfd_mips_elf_finish_dynamic_sections (output_bfd, info)
/* The first entry of the global offset table will be filled at
runtime. The second entry will be used by some runtime loaders.
- This isn't the case of Irix rld. */
+ 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);
@@ -6030,7 +6031,7 @@ _bfd_mips_elf_final_write_processing (abfd, linker)
}
}
-/* When creating an Irix 5 executable, we need REGINFO and RTPROC
+/* When creating an IRIX5 executable, we need REGINFO and RTPROC
segments. */
int
@@ -6060,7 +6061,7 @@ _bfd_mips_elf_additional_program_headers (abfd)
return ret;
}
-/* Modify the segment map for an Irix 5 executable. */
+/* Modify the segment map for an IRIX5 executable. */
boolean
_bfd_mips_elf_modify_segment_map (abfd)
@@ -6183,7 +6184,7 @@ _bfd_mips_elf_modify_segment_map (abfd)
}
}
}
- /* On Irix 5, the PT_DYNAMIC segment includes the .dynamic,
+ /* On IRIX5, the PT_DYNAMIC segment includes the .dynamic,
.dynstr, .dynsym, and .hash sections, and everything in
between. */
for (pm = &elf_tdata (abfd)->segment_map; *pm != NULL;
@@ -6414,6 +6415,15 @@ _bfd_mips_elf_hide_symbol (info, entry, force_local)
got->_raw_size += MIPS_ELF_GOT_SIZE (dynobj);
}
+boolean
+_bfd_mips_elf_ignore_discarded_relocs (sec)
+ asection *sec;
+{
+ if (strcmp (sec->name, ".pdr") == 0)
+ return true;
+ return false;
+}
+
/* MIPS ELF uses a special find_nearest_line routine in order the
handle the ECOFF debugging information. */
diff --git a/bfd/elfxx-mips.h b/bfd/elfxx-mips.h
index 959bfa6c899..b0812652633 100644
--- a/bfd/elfxx-mips.h
+++ b/bfd/elfxx-mips.h
@@ -25,7 +25,7 @@ extern void _bfd_mips_elf_symbol_processing
extern boolean _bfd_mips_elf_section_processing
PARAMS ((bfd *, Elf_Internal_Shdr *));
extern boolean _bfd_mips_elf_section_from_shdr
- PARAMS ((bfd *, Elf_Internal_Shdr *, char *));
+ PARAMS ((bfd *, Elf_Internal_Shdr *, const char *));
extern boolean _bfd_mips_elf_fake_sections
PARAMS ((bfd *, Elf_Internal_Shdr *, asection *));
extern boolean _bfd_mips_elf_section_from_bfd_section
@@ -71,6 +71,8 @@ extern void _bfd_mips_elf_copy_indirect_symbol
PARAMS ((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 *, boolean));
+extern boolean _bfd_mips_elf_ignore_discarded_relocs
+ PARAMS ((asection *));
extern boolean _bfd_mips_elf_find_nearest_line
PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **,
const char **, unsigned int *));
diff --git a/bfd/elfxx-target.h b/bfd/elfxx-target.h
index 7d391d42e6e..369a44e0105 100644
--- a/bfd/elfxx-target.h
+++ b/bfd/elfxx-target.h
@@ -44,7 +44,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifndef bfd_elfNN_get_reloc_upper_bound
#define bfd_elfNN_get_reloc_upper_bound _bfd_elf_get_reloc_upper_bound
#endif
+#ifndef bfd_elfNN_get_symbol_info
#define bfd_elfNN_get_symbol_info _bfd_elf_get_symbol_info
+#endif
#define bfd_elfNN_get_symtab _bfd_elf_get_symtab
#define bfd_elfNN_get_symtab_upper_bound _bfd_elf_get_symtab_upper_bound
#if 0 /* done in elf-bfd.h */
@@ -126,6 +128,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
_bfd_elf_merge_sections
#endif
+#ifndef bfd_elfNN_bfd_discard_group
+#define bfd_elfNN_bfd_discard_group bfd_elf_discard_group
+#endif
+
#ifndef bfd_elfNN_bfd_make_debug_symbol
#define bfd_elfNN_bfd_make_debug_symbol \
((asymbol *(*) PARAMS ((bfd *, void *, unsigned long))) bfd_nullvoidptr)
@@ -194,6 +200,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define bfd_elfNN_bfd_final_link _bfd_generic_final_link
#endif
#endif /* ! defined (elf_backend_relocate_section) */
+
+#ifndef bfd_elfNN_bfd_link_just_syms
+#define bfd_elfNN_bfd_link_just_syms _bfd_elf_link_just_syms
+#endif
+
#ifndef bfd_elfNN_bfd_link_split_section
#define bfd_elfNN_bfd_link_split_section _bfd_generic_link_split_section
#endif
@@ -371,6 +382,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifndef elf_backend_write_section
#define elf_backend_write_section NULL
#endif
+#ifndef elf_backend_set_nonloadable_filepos
+#define elf_backend_set_nonloadable_filepos NULL
+#endif
+#ifndef elf_backend_is_contained_by_filepos
+#define elf_backend_is_contained_by_filepos NULL
+#endif
+#ifndef elf_backend_copy_private_bfd_data_p
+#define elf_backend_copy_private_bfd_data_p NULL
+#endif
#ifndef elf_backend_mips_irix_compat
#define elf_backend_mips_irix_compat NULL
#endif
@@ -472,6 +492,9 @@ static const struct elf_backend_data elfNN_bed =
elf_backend_discard_info,
elf_backend_ignore_discarded_relocs,
elf_backend_write_section,
+ elf_backend_set_nonloadable_filepos,
+ elf_backend_is_contained_by_filepos,
+ elf_backend_copy_private_bfd_data_p,
elf_backend_mips_irix_compat,
elf_backend_mips_rtype_to_howto,
elf_backend_ecoff_debug_swap,
diff --git a/bfd/hash.c b/bfd/hash.c
index 9766eaf0cf2..a498cce46c9 100644
--- a/bfd/hash.c
+++ b/bfd/hash.c
@@ -375,8 +375,8 @@ bfd_hash_lookup (table, string, create, copy)
{
hash += c + (c << 17);
hash ^= hash >> 2;
- ++len;
}
+ len = (s - (const unsigned char *) string) - 1;
hash += len + (len << 17);
hash ^= hash >> 2;
diff --git a/bfd/i386linux.c b/bfd/i386linux.c
index 755b456cfcd..c144822ac2a 100644
--- a/bfd/i386linux.c
+++ b/bfd/i386linux.c
@@ -597,10 +597,9 @@ bfd_i386linux_size_dynamic_sections (output_bfd, info)
{
s->_raw_size = linux_hash_table (info)->fixup_count + 1;
s->_raw_size *= 8;
- s->contents = (bfd_byte *) bfd_alloc (output_bfd, s->_raw_size);
+ s->contents = (bfd_byte *) bfd_zalloc (output_bfd, s->_raw_size);
if (s->contents == NULL)
return false;
- memset (s->contents, 0, (size_t) s->_raw_size);
}
return true;
diff --git a/bfd/i386lynx.c b/bfd/i386lynx.c
index f74854334b4..fc58767a97f 100644
--- a/bfd/i386lynx.c
+++ b/bfd/i386lynx.c
@@ -1,5 +1,5 @@
/* BFD back-end for i386 a.out binaries under LynxOS.
- Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 2001
+ Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 2001, 2002
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -429,10 +429,9 @@ doit:
count = reloc_size / each_size;
- reloc_cache = (arelent *) bfd_malloc (count * sizeof (arelent));
+ reloc_cache = (arelent *) bfd_zmalloc (count * sizeof (arelent));
if (!reloc_cache && count != 0)
return false;
- memset (reloc_cache, 0, (size_t) count * sizeof (arelent));
relocs = (PTR) bfd_alloc (abfd, reloc_size);
if (!relocs && reloc_size != 0)
diff --git a/bfd/i386msdos.c b/bfd/i386msdos.c
index 655ecfd65a4..5c060ecf58e 100644
--- a/bfd/i386msdos.c
+++ b/bfd/i386msdos.c
@@ -173,9 +173,11 @@ msdos_set_section_contents (abfd, section, location, offset, count)
#define msdos_bfd_relax_section bfd_generic_relax_section
#define msdos_bfd_gc_sections bfd_generic_gc_sections
#define msdos_bfd_merge_sections bfd_generic_merge_sections
+#define msdos_bfd_discard_group bfd_generic_discard_group
#define msdos_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
#define msdos_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
#define msdos_bfd_link_add_symbols _bfd_generic_link_add_symbols
+#define msdos_bfd_link_just_syms _bfd_generic_link_just_syms
#define msdos_bfd_final_link _bfd_generic_final_link
#define msdos_bfd_link_split_section _bfd_generic_link_split_section
#define msdos_set_arch_mach _bfd_generic_set_arch_mach
diff --git a/bfd/i386os9k.c b/bfd/i386os9k.c
index 099a7142fba..5ae994bfd6f 100644
--- a/bfd/i386os9k.c
+++ b/bfd/i386os9k.c
@@ -329,9 +329,11 @@ os9k_sizeof_headers (ignore_abfd, ignore)
#define os9k_bfd_relax_section bfd_generic_relax_section
#define os9k_bfd_gc_sections bfd_generic_gc_sections
#define os9k_bfd_merge_sections bfd_generic_merge_sections
+#define os9k_bfd_discard_group bfd_generic_discard_group
#define os9k_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
#define os9k_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
#define os9k_bfd_link_add_symbols _bfd_generic_link_add_symbols
+#define os9k_bfd_link_just_syms _bfd_generic_link_just_syms
#define os9k_bfd_final_link _bfd_generic_final_link
#define os9k_bfd_link_split_section _bfd_generic_link_split_section
diff --git a/bfd/ieee.c b/bfd/ieee.c
index cd56101aa13..2433cc432d6 100644
--- a/bfd/ieee.c
+++ b/bfd/ieee.c
@@ -2398,10 +2398,9 @@ do_with_relocs (abfd, s)
if ((PTR) stream == (PTR) NULL)
{
/* Outputting a section without data, fill it up */
- stream = (unsigned char *) (bfd_alloc (abfd, s->_raw_size));
+ stream = (unsigned char *) bfd_zalloc (abfd, s->_raw_size);
if (!stream)
return false;
- memset ((PTR) stream, 0, (size_t) s->_raw_size);
}
while (current_byte_index < s->_raw_size)
{
@@ -4010,9 +4009,11 @@ ieee_bfd_debug_info_accumulate (abfd, section)
#define ieee_bfd_relax_section bfd_generic_relax_section
#define ieee_bfd_gc_sections bfd_generic_gc_sections
#define ieee_bfd_merge_sections bfd_generic_merge_sections
+#define ieee_bfd_discard_group bfd_generic_discard_group
#define ieee_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
#define ieee_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
#define ieee_bfd_link_add_symbols _bfd_generic_link_add_symbols
+#define ieee_bfd_link_just_syms _bfd_generic_link_just_syms
#define ieee_bfd_final_link _bfd_generic_final_link
#define ieee_bfd_link_split_section _bfd_generic_link_split_section
diff --git a/bfd/ihex.c b/bfd/ihex.c
index 0aad1649d52..4cba29bf7bb 100644
--- a/bfd/ihex.c
+++ b/bfd/ihex.c
@@ -977,9 +977,11 @@ ihex_sizeof_headers (abfd, exec)
#define ihex_bfd_relax_section bfd_generic_relax_section
#define ihex_bfd_gc_sections bfd_generic_gc_sections
#define ihex_bfd_merge_sections bfd_generic_merge_sections
+#define ihex_bfd_discard_group bfd_generic_discard_group
#define ihex_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
#define ihex_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
#define ihex_bfd_link_add_symbols _bfd_generic_link_add_symbols
+#define ihex_bfd_link_just_syms _bfd_generic_link_just_syms
#define ihex_bfd_final_link _bfd_generic_final_link
#define ihex_bfd_link_split_section _bfd_generic_link_split_section
diff --git a/bfd/libaout.h b/bfd/libaout.h
index d7e5c7166ff..a76b935d394 100644
--- a/bfd/libaout.h
+++ b/bfd/libaout.h
@@ -302,6 +302,7 @@ enum machine_type {
M_ALPHA_NETBSD = 141, /* NetBSD/alpha binary */
M_ARM6_NETBSD = 143, /* NetBSD/arm32 binary */
M_SPARCLET_1 = 147, /* 0x93, reserved */
+ M_VAX4K_NETBSD = 150, /* NetBSD/vax 4K pages binary */
M_MIPS1 = 151, /* MIPS R2000/R3000 binary */
M_MIPS2 = 152, /* MIPS R4000/R6000 binary */
M_SPARCLET_2 = 163, /* 0xa3, reserved */
diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h
index 68006fa463f..776dcd62f91 100644
--- a/bfd/libbfd-in.h
+++ b/bfd/libbfd-in.h
@@ -322,12 +322,18 @@ extern boolean _bfd_generic_set_section_contents
((boolean (*) \
PARAMS ((bfd *, struct bfd_link_info *))) \
bfd_false)
+#define _bfd_nolink_bfd_discard_group \
+ ((boolean (*) \
+ PARAMS ((bfd *, struct sec *))) \
+ bfd_false)
#define _bfd_nolink_bfd_link_hash_table_create \
((struct bfd_link_hash_table *(*) PARAMS ((bfd *))) bfd_nullvoidptr)
#define _bfd_nolink_bfd_link_hash_table_free \
((void (*) PARAMS ((struct bfd_link_hash_table *))) bfd_void)
#define _bfd_nolink_bfd_link_add_symbols \
((boolean (*) PARAMS ((bfd *, struct bfd_link_info *))) bfd_false)
+#define _bfd_nolink_bfd_link_just_syms \
+ ((void (*) PARAMS ((asection *, struct bfd_link_info *))) bfd_void)
#define _bfd_nolink_bfd_final_link \
((boolean (*) PARAMS ((bfd *, struct bfd_link_info *))) bfd_false)
#define _bfd_nolink_bfd_link_split_section \
@@ -410,8 +416,6 @@ extern boolean _bfd_generic_link_add_archive_symbols
PARAMS ((bfd *, struct bfd_link_info *,
boolean (*checkfn) (bfd *, struct bfd_link_info *, boolean *)));
-
-
/* Forward declaration to avoid prototype errors. */
typedef struct bfd_link_hash_entry _bfd_link_hash_entry;
@@ -421,6 +425,10 @@ extern boolean _bfd_generic_link_add_one_symbol
asection *, bfd_vma, const char *, boolean copy,
boolean constructor, struct bfd_link_hash_entry **));
+/* Generic routine to mark section as supplying symbols only. */
+extern void _bfd_generic_link_just_syms
+ PARAMS ((asection *, struct bfd_link_info *));
+
/* Generic link routine. */
extern boolean _bfd_generic_final_link
PARAMS ((bfd *, struct bfd_link_info *));
@@ -585,5 +593,3 @@ extern boolean _bfd_sh_align_load_span
boolean (*) (bfd *, asection *, PTR, bfd_byte *, bfd_vma),
PTR, bfd_vma **, bfd_vma *, bfd_vma, bfd_vma, boolean *));
-/* And more follows */
-
diff --git a/bfd/libbfd.h b/bfd/libbfd.h
index cbe4973a669..fa9873f35bc 100644
--- a/bfd/libbfd.h
+++ b/bfd/libbfd.h
@@ -327,12 +327,18 @@ extern boolean _bfd_generic_set_section_contents
((boolean (*) \
PARAMS ((bfd *, struct bfd_link_info *))) \
bfd_false)
+#define _bfd_nolink_bfd_discard_group \
+ ((boolean (*) \
+ PARAMS ((bfd *, struct sec *))) \
+ bfd_false)
#define _bfd_nolink_bfd_link_hash_table_create \
((struct bfd_link_hash_table *(*) PARAMS ((bfd *))) bfd_nullvoidptr)
#define _bfd_nolink_bfd_link_hash_table_free \
((void (*) PARAMS ((struct bfd_link_hash_table *))) bfd_void)
#define _bfd_nolink_bfd_link_add_symbols \
((boolean (*) PARAMS ((bfd *, struct bfd_link_info *))) bfd_false)
+#define _bfd_nolink_bfd_link_just_syms \
+ ((void (*) PARAMS ((asection *, struct bfd_link_info *))) bfd_void)
#define _bfd_nolink_bfd_final_link \
((boolean (*) PARAMS ((bfd *, struct bfd_link_info *))) bfd_false)
#define _bfd_nolink_bfd_link_split_section \
@@ -415,8 +421,6 @@ extern boolean _bfd_generic_link_add_archive_symbols
PARAMS ((bfd *, struct bfd_link_info *,
boolean (*checkfn) (bfd *, struct bfd_link_info *, boolean *)));
-
-
/* Forward declaration to avoid prototype errors. */
typedef struct bfd_link_hash_entry _bfd_link_hash_entry;
@@ -426,6 +430,10 @@ extern boolean _bfd_generic_link_add_one_symbol
asection *, bfd_vma, const char *, boolean copy,
boolean constructor, struct bfd_link_hash_entry **));
+/* Generic routine to mark section as supplying symbols only. */
+extern void _bfd_generic_link_just_syms
+ PARAMS ((asection *, struct bfd_link_info *));
+
/* Generic link routine. */
extern boolean _bfd_generic_final_link
PARAMS ((bfd *, struct bfd_link_info *));
@@ -590,14 +598,15 @@ extern boolean _bfd_sh_align_load_span
boolean (*) (bfd *, asection *, PTR, bfd_byte *, bfd_vma),
PTR, bfd_vma **, bfd_vma *, bfd_vma, bfd_vma, boolean *));
-/* And more follows */
-
+/* Extracted from init.c. */
+/* Extracted from libbfd.c. */
boolean
bfd_write_bigendian_4byte_int PARAMS ((bfd *, unsigned int));
unsigned int
bfd_log2 PARAMS ((bfd_vma x));
+/* Extracted from cache.c. */
#define BFD_CACHE_MAX_OPEN 10
extern bfd *bfd_last_cache;
@@ -617,6 +626,7 @@ bfd_open_file PARAMS ((bfd *abfd));
FILE *
bfd_cache_lookup_worker PARAMS ((bfd *abfd));
+/* Extracted from reloc.c. */
#ifdef _BFD_MAKE_TABLE_bfd_reloc_code_real
static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
@@ -728,6 +738,19 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_ALPHA_GPREL_HI16",
"BFD_RELOC_ALPHA_GPREL_LO16",
"BFD_RELOC_ALPHA_BRSGP",
+ "BFD_RELOC_ALPHA_TLSGD",
+ "BFD_RELOC_ALPHA_TLSLDM",
+ "BFD_RELOC_ALPHA_DTPMOD64",
+ "BFD_RELOC_ALPHA_GOTDTPREL16",
+ "BFD_RELOC_ALPHA_DTPREL64",
+ "BFD_RELOC_ALPHA_DTPREL_HI16",
+ "BFD_RELOC_ALPHA_DTPREL_LO16",
+ "BFD_RELOC_ALPHA_DTPREL16",
+ "BFD_RELOC_ALPHA_GOTTPREL16",
+ "BFD_RELOC_ALPHA_TPREL64",
+ "BFD_RELOC_ALPHA_TPREL_HI16",
+ "BFD_RELOC_ALPHA_TPREL_LO16",
+ "BFD_RELOC_ALPHA_TPREL16",
"BFD_RELOC_MIPS_JMP",
"BFD_RELOC_MIPS16_JMP",
"BFD_RELOC_MIPS16_GPREL",
@@ -767,6 +790,15 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_386_RELATIVE",
"BFD_RELOC_386_GOTOFF",
"BFD_RELOC_386_GOTPC",
+ "BFD_RELOC_386_TLS_LE",
+ "BFD_RELOC_386_TLS_GD",
+ "BFD_RELOC_386_TLS_LDM",
+ "BFD_RELOC_386_TLS_LDO_32",
+ "BFD_RELOC_386_TLS_IE_32",
+ "BFD_RELOC_386_TLS_LE_32",
+ "BFD_RELOC_386_TLS_DTPMOD32",
+ "BFD_RELOC_386_TLS_DTPOFF32",
+ "BFD_RELOC_386_TLS_TPOFF32",
"BFD_RELOC_X86_64_GOT32",
"BFD_RELOC_X86_64_PLT32",
"BFD_RELOC_X86_64_COPY",
@@ -973,6 +1005,9 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_D30V_21_PCREL_R",
"BFD_RELOC_D30V_32",
"BFD_RELOC_D30V_32_PCREL",
+ "BFD_RELOC_DLX_HI16_S",
+ "BFD_RELOC_DLX_LO16",
+ "BFD_RELOC_DLX_JMP26",
"BFD_RELOC_M32R_24",
"BFD_RELOC_M32R_10_PCREL",
"BFD_RELOC_M32R_18_PCREL",
@@ -1138,12 +1173,25 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_IA64_IPLTMSB",
"BFD_RELOC_IA64_IPLTLSB",
"BFD_RELOC_IA64_COPY",
+ "BFD_RELOC_IA64_LTOFF22X",
+ "BFD_RELOC_IA64_LDXMOV",
+ "BFD_RELOC_IA64_TPREL14",
"BFD_RELOC_IA64_TPREL22",
+ "BFD_RELOC_IA64_TPREL64I",
"BFD_RELOC_IA64_TPREL64MSB",
"BFD_RELOC_IA64_TPREL64LSB",
- "BFD_RELOC_IA64_LTOFF_TP22",
- "BFD_RELOC_IA64_LTOFF22X",
- "BFD_RELOC_IA64_LDXMOV",
+ "BFD_RELOC_IA64_LTOFF_TPREL22",
+ "BFD_RELOC_IA64_DTPMOD64MSB",
+ "BFD_RELOC_IA64_DTPMOD64LSB",
+ "BFD_RELOC_IA64_LTOFF_DTPMOD22",
+ "BFD_RELOC_IA64_DTPREL14",
+ "BFD_RELOC_IA64_DTPREL22",
+ "BFD_RELOC_IA64_DTPREL64I",
+ "BFD_RELOC_IA64_DTPREL32MSB",
+ "BFD_RELOC_IA64_DTPREL32LSB",
+ "BFD_RELOC_IA64_DTPREL64MSB",
+ "BFD_RELOC_IA64_DTPREL64LSB",
+ "BFD_RELOC_IA64_LTOFF_DTPREL22",
"BFD_RELOC_M68HC11_HI8",
"BFD_RELOC_M68HC11_LO8",
"BFD_RELOC_M68HC11_3B",
@@ -1205,6 +1253,9 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_XSTORMY16_REL_12",
"BFD_RELOC_XSTORMY16_24",
"BFD_RELOC_XSTORMY16_FPTR16",
+ "BFD_RELOC_VAX_GLOB_DAT",
+ "BFD_RELOC_VAX_JMP_SLOT",
+ "BFD_RELOC_VAX_RELATIVE",
"@@overflow: BFD_RELOC_UNUSED@@",
};
#endif
@@ -1232,6 +1283,7 @@ bfd_generic_get_relocated_section_contents PARAMS ((bfd *abfd,
boolean relocateable,
asymbol **symbols));
+/* Extracted from archures.c. */
extern const bfd_arch_info_type bfd_default_arch_struct;
boolean
bfd_default_set_arch_mach PARAMS ((bfd *abfd,
@@ -1245,6 +1297,7 @@ bfd_default_compatible PARAMS ((const bfd_arch_info_type *a,
boolean
bfd_default_scan PARAMS ((const struct bfd_arch_info *info, const char *string));
+/* Extracted from elf.c. */
struct elf_internal_shdr *
bfd_elf_find_section PARAMS ((bfd *abfd, char *name));
diff --git a/bfd/libcoff-in.h b/bfd/libcoff-in.h
index 618dddaee45..efc2fee268b 100644
--- a/bfd/libcoff-in.h
+++ b/bfd/libcoff-in.h
@@ -598,5 +598,3 @@ extern boolean ppc_allocate_toc_section
extern boolean ppc_process_before_allocation
PARAMS ((bfd *, struct bfd_link_info *));
-/* And more taken from the source .. */
-
diff --git a/bfd/libcoff.h b/bfd/libcoff.h
index 2e9a7d8c2ee..88b09098296 100644
--- a/bfd/libcoff.h
+++ b/bfd/libcoff.h
@@ -602,8 +602,7 @@ extern boolean ppc_allocate_toc_section
extern boolean ppc_process_before_allocation
PARAMS ((bfd *, struct bfd_link_info *));
-/* And more taken from the source .. */
-
+/* Extracted from coffcode.h. */
typedef struct coff_ptr_struct
{
/* Remembers the offset from the first symbol in the file for
diff --git a/bfd/libecoff.h b/bfd/libecoff.h
index c900ee8ddfd..eb90a8cddb9 100644
--- a/bfd/libecoff.h
+++ b/bfd/libecoff.h
@@ -333,6 +333,7 @@ extern struct bfd_link_hash_table *_bfd_ecoff_bfd_link_hash_table_create
#define _bfd_ecoff_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
extern boolean _bfd_ecoff_bfd_link_add_symbols
PARAMS ((bfd *, struct bfd_link_info *));
+#define _bfd_ecoff_bfd_link_just_syms _bfd_generic_link_just_syms
extern boolean _bfd_ecoff_bfd_final_link
PARAMS ((bfd *, struct bfd_link_info *));
diff --git a/bfd/linker.c b/bfd/linker.c
index b4b9f292b87..228f088a017 100644
--- a/bfd/linker.c
+++ b/bfd/linker.c
@@ -757,6 +757,19 @@ _bfd_generic_link_add_symbols_collect (abfd, info)
return generic_link_add_symbols (abfd, info, true);
}
+/* Indicate that we are only retrieving symbol values from this
+ section. We want the symbols to act as though the values in the
+ file are absolute. */
+
+void
+_bfd_generic_link_just_syms (sec, info)
+ asection *sec;
+ struct bfd_link_info *info ATTRIBUTE_UNUSED;
+{
+ sec->output_section = bfd_abs_section_ptr;
+ sec->output_offset = sec->vma;
+}
+
/* Add symbols from an object file to the global hash table. */
static boolean
@@ -1800,37 +1813,38 @@ _bfd_generic_link_add_one_symbol (info, abfd, name, flags, section, value,
/* Fall through. */
case MDEF:
/* Handle a multiple definition. */
- {
- asection *msec = NULL;
- bfd_vma mval = 0;
+ if (!info->allow_multiple_definition)
+ {
+ asection *msec = NULL;
+ bfd_vma mval = 0;
- switch (h->type)
- {
- case bfd_link_hash_defined:
- msec = h->u.def.section;
- mval = h->u.def.value;
- break;
- case bfd_link_hash_indirect:
- msec = bfd_ind_section_ptr;
- mval = 0;
- break;
- default:
- abort ();
- }
+ switch (h->type)
+ {
+ case bfd_link_hash_defined:
+ msec = h->u.def.section;
+ mval = h->u.def.value;
+ break;
+ case bfd_link_hash_indirect:
+ msec = bfd_ind_section_ptr;
+ mval = 0;
+ break;
+ default:
+ abort ();
+ }
- /* Ignore a redefinition of an absolute symbol to the same
- value; it's harmless. */
- if (h->type == bfd_link_hash_defined
- && bfd_is_abs_section (msec)
- && bfd_is_abs_section (section)
- && value == mval)
- break;
+ /* Ignore a redefinition of an absolute symbol to the
+ same value; it's harmless. */
+ if (h->type == bfd_link_hash_defined
+ && bfd_is_abs_section (msec)
+ && bfd_is_abs_section (section)
+ && value == mval)
+ break;
- if (! ((*info->callbacks->multiple_definition)
- (info, h->root.string, msec->owner, msec, mval, abfd,
- section, value)))
- return false;
- }
+ if (! ((*info->callbacks->multiple_definition)
+ (info, h->root.string, msec->owner, msec, mval,
+ abfd, section, value)))
+ return false;
+ }
break;
case CIND:
diff --git a/bfd/m68klinux.c b/bfd/m68klinux.c
index 7dd0428947e..863a61d68f8 100644
--- a/bfd/m68klinux.c
+++ b/bfd/m68klinux.c
@@ -601,13 +601,12 @@ bfd_m68klinux_size_dynamic_sections (output_bfd, info)
{
s->_raw_size = linux_hash_table (info)->fixup_count + 1;
s->_raw_size *= 8;
- s->contents = (bfd_byte *) bfd_alloc (output_bfd, s->_raw_size);
+ s->contents = (bfd_byte *) bfd_zalloc (output_bfd, s->_raw_size);
if (s->contents == NULL)
{
bfd_set_error (bfd_error_no_memory);
return false;
}
- memset (s->contents, 0, (size_t) s->_raw_size);
}
return true;
diff --git a/bfd/merge.c b/bfd/merge.c
index e175efdf881..866b69ce730 100644
--- a/bfd/merge.c
+++ b/bfd/merge.c
@@ -1,22 +1,22 @@
/* SEC_MERGE support.
- Copyright 2001 Free Software Foundation, Inc.
+ Copyright 2001, 2002 Free Software Foundation, Inc.
Written by Jakub Jelinek <jakub@redhat.com>.
-This file is part of BFD, the Binary File Descriptor library.
+ This file is part of BFD, the Binary File Descriptor library.
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* This file contains support for merging duplicate entities within sections,
as used in ELF SHF_MERGE. */
@@ -25,6 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "sysdep.h"
#include "libbfd.h"
#include "hashtab.h"
+#include "libiberty.h"
struct sec_merge_sec_info;
@@ -38,7 +39,8 @@ struct sec_merge_hash_entry
/* Start of this string needs to be aligned to
alignment octets (not 1 << align). */
unsigned int alignment;
- union {
+ union
+ {
/* Index within the merged section. */
bfd_size_type index;
/* Entity size (if present in suffix hash tables). */
@@ -144,7 +146,7 @@ sec_merge_hash_newfunc (entry, table, string)
ret->next = NULL;
}
- return (struct bfd_hash_entry *)ret;
+ return (struct bfd_hash_entry *) ret;
}
/* Look up an entry in a section merge hash table. */
@@ -650,8 +652,10 @@ merge_strings (sinfo)
qsort (array, (size_t) sinfo->htab->size,
sizeof (struct sec_merge_hash_entry *), cmplengthentry);
- last4tab = htab_create ((size_t) sinfo->htab->size * 4, NULL, last4_eq, NULL);
- lasttab = htab_create ((size_t) sinfo->htab->size * 4, NULL, last_eq, NULL);
+ last4tab = htab_create_alloc ((size_t) sinfo->htab->size * 4,
+ NULL, last4_eq, NULL, calloc, free);
+ lasttab = htab_create_alloc ((size_t) sinfo->htab->size * 4,
+ NULL, last_eq, NULL, calloc, free);
if (lasttab == NULL || last4tab == NULL)
goto alloc_failure;
diff --git a/bfd/mmo.c b/bfd/mmo.c
index fe70a18407b..3238e2240b4 100644
--- a/bfd/mmo.c
+++ b/bfd/mmo.c
@@ -260,7 +260,7 @@ enum mmo_sym_type { mmo_reg_sym, mmo_undef_sym, mmo_data_sym, mmo_abs_sym};
struct mmo_symbol
{
struct mmo_symbol *next;
- CONST char *name;
+ const char *name;
bfd_vma value;
enum mmo_sym_type sym_type;
unsigned int serno;
@@ -357,7 +357,7 @@ static void mmo_write_section_unless_reg_contents
PARAMS ((bfd *, asection *, PTR));
static void mmo_find_sec_w_addr PARAMS ((bfd *, asection *, PTR));
static void mmo_find_sec_w_addr_grow PARAMS ((bfd *, asection *, PTR));
-static asection *mmo_make_section PARAMS ((bfd *, CONST char *));
+static asection *mmo_make_section PARAMS ((bfd *, const char *));
static void mmo_get_symbol_info PARAMS ((bfd *, asymbol *, symbol_info *));
static void mmo_print_symbol
PARAMS ((bfd *, PTR, asymbol *, bfd_print_symbol_type));
@@ -371,10 +371,10 @@ static INLINE bfd_byte *mmo_get_loc PARAMS ((asection *, bfd_vma, int));
static void mmo_xore_64 PARAMS ((asection *, bfd_vma vma, bfd_vma value));
static void mmo_xore_32 PARAMS ((asection *, bfd_vma vma, unsigned int));
static void mmo_xore_16 PARAMS ((asection *, bfd_vma vma, unsigned int));
-static CONST bfd_target *mmo_object_p PARAMS ((bfd *));
+static const bfd_target *mmo_object_p PARAMS ((bfd *));
static void mmo_map_set_sizes PARAMS ((bfd *, asection *, PTR));
static boolean mmo_get_symbols PARAMS ((bfd *));
-static boolean mmo_create_symbol PARAMS ((bfd *, CONST char *, bfd_vma,
+static boolean mmo_create_symbol PARAMS ((bfd *, const char *, bfd_vma,
enum mmo_sym_type, unsigned int));
static boolean mmo_get_section_contents
PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type));
@@ -391,7 +391,7 @@ static long mmo_get_reloc_upper_bound PARAMS ((bfd *, asection *));
static boolean mmo_internal_write_header PARAMS ((bfd *));
static boolean mmo_internal_write_post PARAMS ((bfd *, int, asection *));
static boolean mmo_internal_add_3_sym
- PARAMS ((bfd *, struct mmo_symbol_trie *, CONST struct mmo_symbol *));
+ PARAMS ((bfd *, struct mmo_symbol_trie *, const struct mmo_symbol *));
static unsigned int mmo_internal_3_length
PARAMS ((bfd *, struct mmo_symbol_trie *));
static void mmo_internal_3_dump
@@ -404,10 +404,10 @@ static void mmo_write_tetra_raw PARAMS ((bfd *, unsigned int));
static void mmo_write_octa PARAMS ((bfd *, bfd_vma));
static void mmo_write_octa_raw PARAMS ((bfd *, bfd_vma));
static boolean mmo_write_chunk
- PARAMS ((bfd *, CONST bfd_byte *, unsigned int));
+ PARAMS ((bfd *, const bfd_byte *, unsigned int));
static boolean mmo_flush_chunk PARAMS ((bfd *));
static boolean mmo_write_loc_chunk
- PARAMS ((bfd *, bfd_vma, CONST bfd_byte *, unsigned int, bfd_vma *));
+ PARAMS ((bfd *, bfd_vma, const bfd_byte *, unsigned int, bfd_vma *));
static boolean mmo_write_chunk_list PARAMS ((bfd *, mmo_data_list_type *));
static boolean mmo_write_loc_chunk_list
PARAMS ((bfd *, mmo_data_list_type *));
@@ -417,7 +417,7 @@ static flagword bfd_sec_flags_from_mmo_flags PARAMS ((flagword));
static bfd_byte mmo_get_byte PARAMS ((bfd *));
static void mmo_write_byte PARAMS ((bfd *, bfd_byte));
static boolean mmo_new_section_hook PARAMS ((bfd *, asection *));
-static int mmo_sort_mmo_symbols PARAMS ((CONST PTR, CONST PTR));
+static int mmo_sort_mmo_symbols PARAMS ((const PTR, const PTR));
static boolean mmo_write_object_contents PARAMS ((bfd *));
static long mmo_canonicalize_reloc
PARAMS ((bfd *, sec_ptr, arelent **, asymbol **));
@@ -446,7 +446,7 @@ char valid_mmo_symbol_character_set[/* A-Z a-z (we assume consecutive
static asection *
mmo_make_section (abfd, secname)
bfd *abfd;
- CONST char *secname;
+ const char *secname;
{
asection *sec = bfd_get_section_by_name (abfd, secname);
@@ -495,7 +495,7 @@ mmo_init ()
/* Check whether an existing file is an mmo file. */
-static CONST bfd_target *
+static const bfd_target *
mmo_object_p (abfd)
bfd *abfd;
{
@@ -819,7 +819,7 @@ mmo_write_octa_raw (abfd, value)
static INLINE boolean
mmo_write_chunk (abfd, loc, len)
bfd *abfd;
- CONST bfd_byte *loc;
+ const bfd_byte *loc;
unsigned int len;
{
boolean retval = true;
@@ -907,7 +907,7 @@ static boolean
mmo_write_loc_chunk (abfd, vma, loc, len, last_vmap)
bfd *abfd;
bfd_vma vma;
- CONST bfd_byte *loc;
+ const bfd_byte *loc;
unsigned int len;
bfd_vma *last_vmap;
{
@@ -1199,7 +1199,7 @@ mmo_write_byte (abfd, value)
static boolean
mmo_create_symbol (abfd, symname, addr, sym_type, serno)
bfd *abfd;
- CONST char *symname;
+ const char *symname;
bfd_vma addr;
enum mmo_sym_type sym_type;
unsigned int serno;
@@ -2135,11 +2135,11 @@ mmo_get_symtab_upper_bound (abfd)
static int
mmo_sort_mmo_symbols (arg1, arg2)
- CONST PTR arg1;
- CONST PTR arg2;
+ const PTR arg1;
+ const PTR arg2;
{
- CONST struct mmo_symbol *sym1 = *(CONST struct mmo_symbol **) arg1;
- CONST struct mmo_symbol *sym2 = *(CONST struct mmo_symbol **) arg2;
+ const struct mmo_symbol *sym1 = *(const struct mmo_symbol **) arg1;
+ const struct mmo_symbol *sym2 = *(const struct mmo_symbol **) arg2;
/* Sort by serial number first. */
if (sym1->serno < sym2->serno)
@@ -2148,7 +2148,7 @@ mmo_sort_mmo_symbols (arg1, arg2)
return 1;
/* Then sort by address of the table entries. */
- return ((CONST char *) arg1 - (CONST char *) arg2);
+ return ((const char *) arg1 - (const char *) arg2);
}
/* Translate the symbol table. */
@@ -2295,7 +2295,7 @@ static boolean
mmo_internal_write_header (abfd)
bfd *abfd;
{
- CONST char lop_pre_bfd[] = { LOP, LOP_PRE, 1, 1};
+ const char lop_pre_bfd[] = { LOP, LOP_PRE, 1, 1};
if (bfd_bwrite (lop_pre_bfd, 4, abfd) != 4)
return false;
@@ -2619,9 +2619,9 @@ static boolean
mmo_internal_add_3_sym (abfd, rootp, symp)
bfd *abfd;
struct mmo_symbol_trie *rootp;
- CONST struct mmo_symbol *symp;
+ const struct mmo_symbol *symp;
{
- CONST char *name = symp->name;
+ const char *name = symp->name;
struct mmo_symbol_trie *trie = rootp;
struct mmo_symbol_trie **triep = NULL;
@@ -3247,6 +3247,7 @@ mmo_canonicalize_reloc (abfd, section, relptr, symbols)
#define mmo_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
#define mmo_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
#define mmo_bfd_link_add_symbols _bfd_generic_link_add_symbols
+#define mmo_bfd_link_just_syms _bfd_generic_link_just_syms
#define mmo_bfd_final_link _bfd_generic_final_link
#define mmo_bfd_link_split_section _bfd_generic_link_split_section
@@ -3255,6 +3256,7 @@ mmo_canonicalize_reloc (abfd, section, relptr, symbols)
#define mmo_set_arch_mach bfd_default_set_arch_mach
#define mmo_bfd_relax_section bfd_generic_relax_section
#define mmo_bfd_merge_sections bfd_generic_merge_sections
+#define mmo_bfd_discard_group bfd_generic_discard_group
/* objcopy will be upset if we return -1 from bfd_get_reloc_upper_bound by
using BFD_JUMP_TABLE_RELOCS (_bfd_norelocs) rather than 0. FIXME: Most
@@ -3276,7 +3278,7 @@ mmo_canonicalize_reloc (abfd, section, relptr, symbols)
#define mmo_bfd_set_private_flags _bfd_generic_bfd_set_private_flags
#define mmo_bfd_print_private_bfd_data _bfd_generic_bfd_print_private_bfd_data
-CONST bfd_target bfd_mmo_vec =
+const bfd_target bfd_mmo_vec =
{
"mmo", /* name */
bfd_target_mmo_flavour,
diff --git a/bfd/nlm-target.h b/bfd/nlm-target.h
index 79877fe7cd0..e0a83044e91 100644
--- a/bfd/nlm-target.h
+++ b/bfd/nlm-target.h
@@ -44,9 +44,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define nlm_bfd_relax_section bfd_generic_relax_section
#define nlm_bfd_gc_sections bfd_generic_gc_sections
#define nlm_bfd_merge_sections bfd_generic_merge_sections
+#define nlm_bfd_discard_group bfd_generic_discard_group
#define nlm_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
#define nlm_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
#define nlm_bfd_link_add_symbols _bfd_generic_link_add_symbols
+#define nlm_bfd_link_just_syms _bfd_generic_link_just_syms
#define nlm_bfd_final_link _bfd_generic_final_link
#define nlm_bfd_link_split_section _bfd_generic_link_split_section
diff --git a/bfd/ns32knetbsd.c b/bfd/ns32knetbsd.c
index 032a96dd486..3c3b5a22d0e 100644
--- a/bfd/ns32knetbsd.c
+++ b/bfd/ns32knetbsd.c
@@ -1,5 +1,5 @@
/* BFD back-end for NetBSD/ns32k a.out-ish binaries.
- Copyright 1990, 1991, 1992, 1994, 1995, 1998, 2000, 2001
+ Copyright 1990, 1991, 1992, 1994, 1995, 1998, 2000, 2001, 2002
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -48,7 +48,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfd.h" /* To ensure following declaration is OK */
-CONST struct reloc_howto_struct *
+const struct reloc_howto_struct *
MY_bfd_reloc_type_lookup
PARAMS((bfd *abfd AND
bfd_reloc_code_real_type code));
diff --git a/bfd/oasys.c b/bfd/oasys.c
index 4cadb6900ed..17fc735d779 100644
--- a/bfd/oasys.c
+++ b/bfd/oasys.c
@@ -1490,9 +1490,11 @@ oasys_sizeof_headers (abfd, exec)
#define oasys_bfd_relax_section bfd_generic_relax_section
#define oasys_bfd_gc_sections bfd_generic_gc_sections
#define oasys_bfd_merge_sections bfd_generic_merge_sections
+#define oasys_bfd_discard_group bfd_generic_discard_group
#define oasys_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
#define oasys_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
#define oasys_bfd_link_add_symbols _bfd_generic_link_add_symbols
+#define oasys_bfd_link_just_syms _bfd_generic_link_just_syms
#define oasys_bfd_final_link _bfd_generic_final_link
#define oasys_bfd_link_split_section _bfd_generic_link_split_section
diff --git a/bfd/pdp11.c b/bfd/pdp11.c
index d4fe79eba65..90db56b9875 100644
--- a/bfd/pdp11.c
+++ b/bfd/pdp11.c
@@ -1841,11 +1841,9 @@ NAME(aout,slurp_symbol_table) (abfd)
cached_size = obj_aout_external_sym_count (abfd);
cached_size *= sizeof (aout_symbol_type);
- cached = (aout_symbol_type *) bfd_malloc (cached_size);
+ cached = (aout_symbol_type *) bfd_zmalloc (cached_size);
if (cached == NULL && cached_size != 0)
return false;
- if (cached_size != 0)
- memset (cached, 0, (size_t) cached_size);
/* Convert from external symbol information to internal. */
if (! (NAME(aout,translate_symbol_table)
@@ -2255,10 +2253,9 @@ NAME(aout,slurp_reloc_table) (abfd, asect, symbols)
count = real_count;
}
- reloc_cache = (arelent *) bfd_malloc (count * sizeof (arelent));
+ reloc_cache = (arelent *) bfd_zmalloc (count * sizeof (arelent));
if (reloc_cache == NULL && count != 0)
return false;
- memset (reloc_cache, 0, (size_t) count * sizeof (arelent));
cache_ptr = reloc_cache;
@@ -2319,8 +2316,6 @@ NAME(aout,squirt_out_relocs) (abfd, section)
if (!native)
return false;
- memset ((PTR)native, 0, (size_t) natsize);
-
generic = section->orelocation;
if (generic != NULL)
{
diff --git a/bfd/pe-i386.c b/bfd/pe-i386.c
index 7ced1471156..9c75f95e9fb 100644
--- a/bfd/pe-i386.c
+++ b/bfd/pe-i386.c
@@ -1,21 +1,21 @@
/* BFD back-end for Intel 386 PECOFF files.
- Copyright 1995, 1996, 1999, 2001 Free Software Foundation, Inc.
+ Copyright 1995, 1996, 1999, 2001, 2002 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"
@@ -29,6 +29,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define COFF_LONG_FILENAMES
#define COFF_SECTION_ALIGNMENT_ENTRIES \
+{ COFF_SECTION_NAME_EXACT_MATCH (".bss"), \
+ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \
+{ COFF_SECTION_NAME_EXACT_MATCH (".data"), \
+ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \
+{ COFF_SECTION_NAME_EXACT_MATCH (".text"), \
+ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \
{ COFF_SECTION_NAME_PARTIAL_MATCH (".idata"), \
COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \
{ COFF_SECTION_NAME_EXACT_MATCH (".pdata"), \
diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c
index 04b741979aa..69864334fbb 100644
--- a/bfd/peXXigen.c
+++ b/bfd/peXXigen.c
@@ -3,21 +3,21 @@
Free Software Foundation, Inc.
Written by Cygnus Solutions.
-This file is part of BFD, the Binary File Descriptor library.
+ This file is part of BFD, the Binary File Descriptor library.
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* Most of this hacked by Steve Chamberlain <sac@cygnus.com>.
@@ -1142,6 +1142,7 @@ pe_print_idata (abfd, vfile)
adj = section->vma - extra->ImageBase;
+ /* Print all image import descriptors. */
for (i = 0; i < datasize; i += onaline)
{
bfd_vma hint_addr;
@@ -1153,7 +1154,7 @@ pe_print_idata (abfd, vfile)
bfd_size_type j;
char *dll;
- /* print (i + extra->DataDirectory[1].VirtualAddress) */
+ /* Print (i + extra->DataDirectory[1].VirtualAddress). */
fprintf (file, " %08lx\t", (unsigned long) (i + adj + dataoff));
#if 0
if (i + 20 > datasize)
@@ -1181,19 +1182,83 @@ pe_print_idata (abfd, vfile)
if (hint_addr != 0)
{
- fprintf (file, _("\tvma: Hint/Ord Member-Name\n"));
+ bfd_byte *ft_data;
+ asection *ft_section;
+ bfd_vma ft_addr;
+ bfd_size_type ft_datasize;
+ int ft_idx;
+ int ft_allocated = 0;
+
+ fprintf (file, _("\tvma: Hint/Ord Member-Name Bound-To\n"));
idx = hint_addr - adj;
+
+ ft_addr = first_thunk + extra->ImageBase;
+ ft_data = data;
+ ft_idx = first_thunk - adj;
+ ft_allocated = 0;
+
+ if (first_thunk != hint_addr)
+ {
+ /* Find the section which contains the first thunk. */
+ for (ft_section = abfd->sections;
+ ft_section != NULL;
+ ft_section = ft_section->next)
+ {
+ ft_datasize = bfd_section_size (abfd, ft_section);
+ if (ft_addr >= ft_section->vma
+ && ft_addr < ft_section->vma + ft_datasize)
+ break;
+ }
+
+ if (ft_section == NULL)
+ {
+ fprintf (file,
+ _("\nThere is a first thunk, but the section containing it could not be found\n"));
+ continue;
+ }
+
+ /* Now check to see if this section is the same as our current
+ section. If it is not then we will have to load its data in. */
+ if (ft_section == section)
+ {
+ ft_data = data;
+ ft_idx = first_thunk - adj;
+ }
+ else
+ {
+ ft_idx = first_thunk - (ft_section->vma - extra->ImageBase);
+ ft_data = (bfd_byte *) bfd_malloc (datasize);
+ if (ft_data == NULL)
+ continue;
+
+ /* Read datasize bfd_bytes starting at offset ft_idx. */
+ if (! bfd_get_section_contents (abfd, ft_section,
+ (PTR) ft_data,
+ (bfd_vma) ft_idx,
+ datasize))
+ {
+ free (ft_data);
+ continue;
+ }
+
+ ft_idx = 0;
+ ft_allocated = 1;
+ }
+ }
+ /* Print HintName vector entries. */
for (j = 0; j < datasize; j += 4)
{
unsigned long member = bfd_get_32 (abfd, data + idx + j);
+ /* Print single IMAGE_IMPORT_BY_NAME vector. */
if (member == 0)
break;
+
if (member & 0x80000000)
- fprintf (file, "\t%04lx\t %4lu", member,
- member & 0x7fffffff);
+ fprintf (file, "\t%04lx\t %4lu <none>",
+ member, member & 0x7fffffff);
else
{
int ordinal;
@@ -1206,69 +1271,18 @@ pe_print_idata (abfd, vfile)
}
/* If the time stamp is not zero, the import address
- table holds actual addresses. */
+ table holds actual addresses. */
if (time_stamp != 0
&& first_thunk != 0
&& first_thunk != hint_addr)
fprintf (file, "\t%04lx",
- (long) bfd_get_32 (abfd, data + first_thunk - adj + j));
+ (long) bfd_get_32 (abfd, ft_data + ft_idx + j));
fprintf (file, "\n");
}
- }
-
- if (hint_addr != first_thunk && time_stamp == 0)
- {
- int differ = 0;
- int idx2;
-
- idx2 = first_thunk - adj;
-
- for (j = 0; j < datasize; j += 4)
- {
- int ordinal;
- char *member_name;
- bfd_vma hint_member = 0;
- bfd_vma iat_member;
-
- if (hint_addr != 0)
- hint_member = bfd_get_32 (abfd, data + idx + j);
- iat_member = bfd_get_32 (abfd, data + idx2 + j);
-
- if (hint_addr == 0 && iat_member == 0)
- break;
-
- if (hint_addr == 0 || hint_member != iat_member)
- {
- if (differ == 0)
- {
- fprintf (file,
- _("\tThe Import Address Table (difference found)\n"));
- fprintf (file, _("\tvma: Hint/Ord Member-Name\n"));
- differ = 1;
- }
-
- if (iat_member == 0)
- fprintf (file,
- _("\t>>> Ran out of IAT members!\n"));
- else
- {
- ordinal = bfd_get_16 (abfd, data + iat_member - adj);
- member_name = (char *) data + iat_member - adj + 2;
- fprintf (file, "\t%04lx\t %4d %s\n",
- (unsigned long) iat_member,
- ordinal,
- member_name);
- }
- }
-
- if (hint_addr != 0 && hint_member == 0)
- break;
- }
- if (differ == 0)
- fprintf (file,
- _("\tThe Import Address Table is identical\n"));
+ if (ft_allocated)
+ free (ft_data);
}
fprintf (file, "\n");
diff --git a/bfd/pei-i386.c b/bfd/pei-i386.c
index 8f0f77acb84..9f577e669f7 100644
--- a/bfd/pei-i386.c
+++ b/bfd/pei-i386.c
@@ -1,21 +1,21 @@
/* BFD back-end for Intel 386 PE IMAGE COFF files.
- Copyright 1995, 1996, 1999 Free Software Foundation, Inc.
+ Copyright 1995, 1996, 1999, 2002 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"
@@ -30,6 +30,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define COFF_LONG_FILENAMES
#define COFF_SECTION_ALIGNMENT_ENTRIES \
+{ COFF_SECTION_NAME_EXACT_MATCH (".bss"), \
+ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \
+{ COFF_SECTION_NAME_EXACT_MATCH (".data"), \
+ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \
+{ COFF_SECTION_NAME_EXACT_MATCH (".text"), \
+ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \
{ COFF_SECTION_NAME_PARTIAL_MATCH (".idata"), \
COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \
{ COFF_SECTION_NAME_EXACT_MATCH (".pdata"), \
diff --git a/bfd/po/SRC-POTFILES.in b/bfd/po/SRC-POTFILES.in
index 8f0199d8e53..086d8022d59 100644
--- a/bfd/po/SRC-POTFILES.in
+++ b/bfd/po/SRC-POTFILES.in
@@ -65,6 +65,7 @@ cpu-avr.c
cpu-cris.c
cpu-d10v.c
cpu-d30v.c
+cpu-dlx.c
cpu-fr30.c
cpu-h8300.c
cpu-h8500.c
@@ -124,6 +125,7 @@ elf32-avr.c
elf32-cris.c
elf32-d10v.c
elf32-d30v.c
+elf32-dlx.c
elf32-fr30.c
elf32-gen.c
elf32-h8300.c
@@ -131,6 +133,7 @@ elf32-hppa.c
elf32-hppa.h
elf32-i370.c
elf32-i386.c
+elf32-i386qnx.c
elf32-i860.c
elf32-i960.c
elf32-m32r.c
@@ -148,9 +151,12 @@ elf32-s390.c
elf32-sh-lin.c
elf32-sh-nbsd.c
elf32-sh.c
+elf32-sh64-com.c
+elf32-sh64-nbsd.c
elf32-sh64.c
elf32-sparc.c
elf32-v850.c
+elf32-vax.c
elf32-xstormy16.c
elf32.c
elf64-alpha.c
@@ -161,6 +167,7 @@ elf64-mips.c
elf64-mmix.c
elf64-ppc.c
elf64-s390.c
+elf64-sh64-nbsd.c
elf64-sh64.c
elf64-sparc.c
elf64-x86-64.c
diff --git a/bfd/ppcboot.c b/bfd/ppcboot.c
index d40590f702f..5b153bdff08 100644
--- a/bfd/ppcboot.c
+++ b/bfd/ppcboot.c
@@ -469,9 +469,11 @@ ppcboot_bfd_print_private_bfd_data (abfd, farg)
#define ppcboot_bfd_relax_section bfd_generic_relax_section
#define ppcboot_bfd_gc_sections bfd_generic_gc_sections
#define ppcboot_bfd_merge_sections bfd_generic_merge_sections
+#define ppcboot_bfd_discard_group bfd_generic_discard_group
#define ppcboot_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
#define ppcboot_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
#define ppcboot_bfd_link_add_symbols _bfd_generic_link_add_symbols
+#define ppcboot_bfd_link_just_syms _bfd_generic_link_just_syms
#define ppcboot_bfd_final_link _bfd_generic_final_link
#define ppcboot_bfd_link_split_section _bfd_generic_link_split_section
#define ppcboot_get_section_contents_in_window \
diff --git a/bfd/reloc.c b/bfd/reloc.c
index c701fe0d403..8af90fc796a 100644
--- a/bfd/reloc.c
+++ b/bfd/reloc.c
@@ -1963,6 +1963,35 @@ ENUMDOC
STO_ALPHA_STD_GPLOAD.
ENUM
+ BFD_RELOC_ALPHA_TLSGD
+ENUMX
+ BFD_RELOC_ALPHA_TLSLDM
+ENUMX
+ BFD_RELOC_ALPHA_DTPMOD64
+ENUMX
+ BFD_RELOC_ALPHA_GOTDTPREL16
+ENUMX
+ BFD_RELOC_ALPHA_DTPREL64
+ENUMX
+ BFD_RELOC_ALPHA_DTPREL_HI16
+ENUMX
+ BFD_RELOC_ALPHA_DTPREL_LO16
+ENUMX
+ BFD_RELOC_ALPHA_DTPREL16
+ENUMX
+ BFD_RELOC_ALPHA_GOTTPREL16
+ENUMX
+ BFD_RELOC_ALPHA_TPREL64
+ENUMX
+ BFD_RELOC_ALPHA_TPREL_HI16
+ENUMX
+ BFD_RELOC_ALPHA_TPREL_LO16
+ENUMX
+ BFD_RELOC_ALPHA_TPREL16
+ENUMDOC
+ Alpha thread-local storage relocations.
+
+ENUM
BFD_RELOC_MIPS_JMP
ENUMDOC
Bits 27..2 of the relocation address shifted right 2 bits;
@@ -2072,6 +2101,24 @@ ENUMX
BFD_RELOC_386_GOTOFF
ENUMX
BFD_RELOC_386_GOTPC
+ENUMX
+ BFD_RELOC_386_TLS_LE
+ENUMX
+ BFD_RELOC_386_TLS_GD
+ENUMX
+ BFD_RELOC_386_TLS_LDM
+ENUMX
+ BFD_RELOC_386_TLS_LDO_32
+ENUMX
+ BFD_RELOC_386_TLS_IE_32
+ENUMX
+ BFD_RELOC_386_TLS_LE_32
+ENUMX
+ BFD_RELOC_386_TLS_DTPMOD32
+ENUMX
+ BFD_RELOC_386_TLS_DTPOFF32
+ENUMX
+ BFD_RELOC_386_TLS_TPOFF32
ENUMDOC
i386/elf relocations
@@ -2598,6 +2645,19 @@ ENUMDOC
This is a 32-bit pc-relative reloc.
ENUM
+ BFD_RELOC_DLX_HI16_S
+ENUMDOC
+ DLX relocs
+ENUM
+ BFD_RELOC_DLX_LO16
+ENUMDOC
+ DLX relocs
+ENUM
+ BFD_RELOC_DLX_JMP26
+ENUMDOC
+ DLX relocs
+
+ENUM
BFD_RELOC_M32R_24
ENUMDOC
Mitsubishi M32R relocs.
@@ -3185,17 +3245,43 @@ ENUMX
ENUMX
BFD_RELOC_IA64_COPY
ENUMX
+ BFD_RELOC_IA64_LTOFF22X
+ENUMX
+ BFD_RELOC_IA64_LDXMOV
+ENUMX
+ BFD_RELOC_IA64_TPREL14
+ENUMX
BFD_RELOC_IA64_TPREL22
ENUMX
+ BFD_RELOC_IA64_TPREL64I
+ENUMX
BFD_RELOC_IA64_TPREL64MSB
ENUMX
BFD_RELOC_IA64_TPREL64LSB
ENUMX
- BFD_RELOC_IA64_LTOFF_TP22
+ BFD_RELOC_IA64_LTOFF_TPREL22
ENUMX
- BFD_RELOC_IA64_LTOFF22X
+ BFD_RELOC_IA64_DTPMOD64MSB
ENUMX
- BFD_RELOC_IA64_LDXMOV
+ BFD_RELOC_IA64_DTPMOD64LSB
+ENUMX
+ BFD_RELOC_IA64_LTOFF_DTPMOD22
+ENUMX
+ BFD_RELOC_IA64_DTPREL14
+ENUMX
+ BFD_RELOC_IA64_DTPREL22
+ENUMX
+ BFD_RELOC_IA64_DTPREL64I
+ENUMX
+ BFD_RELOC_IA64_DTPREL32MSB
+ENUMX
+ BFD_RELOC_IA64_DTPREL32LSB
+ENUMX
+ BFD_RELOC_IA64_DTPREL64MSB
+ENUMX
+ BFD_RELOC_IA64_DTPREL64LSB
+ENUMX
+ BFD_RELOC_IA64_LTOFF_DTPREL22
ENUMDOC
Intel IA64 Relocations.
@@ -3363,6 +3449,15 @@ ENUMX
ENUMDOC
Sony Xstormy16 Relocations.
+ENUM
+ BFD_RELOC_VAX_GLOB_DAT
+ENUMX
+ BFD_RELOC_VAX_JMP_SLOT
+ENUMX
+ BFD_RELOC_VAX_RELATIVE
+ENUMDOC
+ Relocations used by VAX ELF.
+
ENDSENUM
BFD_RELOC_UNUSED
CODE_FRAGMENT
diff --git a/bfd/reloc16.c b/bfd/reloc16.c
index 1d69a7f25d3..1db8daf2aa4 100644
--- a/bfd/reloc16.c
+++ b/bfd/reloc16.c
@@ -196,8 +196,7 @@ bfd_coff_reloc16_relax_section (abfd, input_section, link_info, again)
The last element is used as an accumlator of shrinks. */
amt = reloc_count + 1;
amt *= sizeof (unsigned);
- shrinks = (unsigned *) bfd_malloc (amt);
- memset (shrinks, 0, (size_t) amt);
+ shrinks = (unsigned *) bfd_zmalloc (amt);
/* Loop until nothing changes in this section. */
do {
diff --git a/bfd/rs6000-core.c b/bfd/rs6000-core.c
index 0edcdc43edb..a61f25caa22 100644
--- a/bfd/rs6000-core.c
+++ b/bfd/rs6000-core.c
@@ -182,7 +182,7 @@ typedef union {
/* Return the c_impl field from struct core_dumpx C. */
-#ifdef AIX_CORE_DUMPX_CORE
+#if defined (HAVE_ST_C_IMPL) || defined (AIX_5_CORE)
# define CNEW_IMPL(c) (c).c_impl
#else
# define CNEW_IMPL(c) 0
diff --git a/bfd/section.c b/bfd/section.c
index 076a0122be7..8bb85c890f3 100644
--- a/bfd/section.c
+++ b/bfd/section.c
@@ -230,12 +230,6 @@ CODE_FRAGMENT
. standard data. *}
.#define SEC_CONSTRUCTOR 0x100
.
-. {* The section is a constructor, and should be placed at the
-. end of the text, data, or bss section(?). *}
-.#define SEC_CONSTRUCTOR_TEXT 0x1100
-.#define SEC_CONSTRUCTOR_DATA 0x2100
-.#define SEC_CONSTRUCTOR_BSS 0x3100
-.
. {* The section has contents - a data section could be
. <<SEC_ALLOC>> | <<SEC_HAS_CONTENTS>>; a debug section could be
. <<SEC_HAS_CONTENTS>> *}
@@ -256,6 +250,9 @@ CODE_FRAGMENT
. sections. *}
.#define SEC_COFF_SHARED_LIBRARY 0x800
.
+. {* The section contains thread local data. *}
+.#define SEC_THREAD_LOCAL 0x1000
+.
. {* The section has GOT references. This flag is only for the
. linker, and is currently only used by the elf32-hppa back end.
. It will be set if global offset table references were detected
@@ -1371,6 +1368,7 @@ _bfd_strip_section_from_output (info, s)
if (*spp == os)
{
bfd_section_list_remove (os->owner, spp);
+ os->flags |= SEC_EXCLUDE;
os->owner->section_count--;
break;
}
@@ -1378,3 +1376,22 @@ _bfd_strip_section_from_output (info, s)
s->flags |= SEC_EXCLUDE;
}
+
+/*
+FUNCTION
+ bfd_generic_discard_group
+
+SYNOPSIS
+ boolean bfd_generic_discard_group (bfd *abfd, asection *group);
+
+DESCRIPTION
+ Remove all members of @var{group} from the output.
+*/
+
+boolean
+bfd_generic_discard_group (abfd, group)
+ bfd *abfd ATTRIBUTE_UNUSED;
+ asection *group ATTRIBUTE_UNUSED;
+{
+ return true;
+}
diff --git a/bfd/som.c b/bfd/som.c
index 4672379e934..68c561c9b36 100644
--- a/bfd/som.c
+++ b/bfd/som.c
@@ -4141,10 +4141,9 @@ som_build_and_write_symbol_table (abfd)
to hold the symbol table as we build it. */
symtab_size = num_syms;
symtab_size *= sizeof (struct symbol_dictionary_record);
- som_symtab = (struct symbol_dictionary_record *) bfd_malloc (symtab_size);
+ som_symtab = (struct symbol_dictionary_record *) bfd_zmalloc (symtab_size);
if (som_symtab == NULL && symtab_size != 0)
goto error_return;
- memset (som_symtab, 0, (size_t) symtab_size);
/* Walk over each symbol. */
for (i = 0; i < num_syms; i++)
@@ -4230,10 +4229,9 @@ som_slurp_string_table (abfd)
/* Allocate and read in the string table. */
amt = obj_som_stringtab_size (abfd);
- stringtab = bfd_malloc (amt);
+ stringtab = bfd_zmalloc (amt);
if (stringtab == NULL)
return false;
- memset (stringtab, 0, obj_som_stringtab_size (abfd));
if (bfd_seek (abfd, obj_som_str_filepos (abfd), SEEK_SET) != 0)
return false;
@@ -4336,10 +4334,9 @@ som_slurp_symbol_table (abfd)
amt = symbol_count;
amt *= sizeof (som_symbol_type);
- symbase = (som_symbol_type *) bfd_malloc (amt);
+ symbase = (som_symbol_type *) bfd_zmalloc (amt);
if (symbase == NULL)
goto error_return;
- memset (symbase, 0, symbol_count * sizeof (som_symbol_type));
/* Read in the external SOM representation. */
amt = symbol_count;
@@ -5899,19 +5896,19 @@ som_bfd_ar_write_symbol_stuff (abfd, nsyms, string_size, lst, elength)
amt = lst.hash_size;
amt *= sizeof (unsigned int);
- hash_table = (unsigned int *) bfd_malloc (amt);
+ hash_table = (unsigned int *) bfd_zmalloc (amt);
if (hash_table == NULL && lst.hash_size != 0)
goto error_return;
amt = lst.module_count;
amt *= sizeof (struct som_entry);
- som_dict = (struct som_entry *) bfd_malloc (amt);
+ som_dict = (struct som_entry *) bfd_zmalloc (amt);
if (som_dict == NULL && lst.module_count != 0)
goto error_return;
amt = lst.hash_size;
amt *= sizeof (struct lst_symbol_record *);
- last_hash_entry = ((struct lst_symbol_record **) bfd_malloc (amt));
+ last_hash_entry = ((struct lst_symbol_record **) bfd_zmalloc (amt));
if (last_hash_entry == NULL && lst.hash_size != 0)
goto error_return;
@@ -5919,12 +5916,6 @@ som_bfd_ar_write_symbol_stuff (abfd, nsyms, string_size, lst, elength)
of the lst record. So save its location. */
lst_filepos = bfd_tell (abfd) - sizeof (struct lst_header);
- /* Some initialization. */
- memset (hash_table, 0, 4 * lst.hash_size);
- memset (som_dict, 0, lst.module_count * sizeof (struct som_entry));
- memset (last_hash_entry, 0,
- lst.hash_size * sizeof (struct lst_symbol_record *));
-
/* Symbols have som_index fields, so we have to keep track of the
index of each SOM in the archive.
@@ -6335,10 +6326,12 @@ som_bfd_link_split_section (abfd, sec)
#define som_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
#define som_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
#define som_bfd_link_add_symbols _bfd_generic_link_add_symbols
+#define som_bfd_link_just_syms _bfd_generic_link_just_syms
#define som_bfd_final_link _bfd_generic_final_link
#define som_bfd_gc_sections bfd_generic_gc_sections
#define som_bfd_merge_sections bfd_generic_merge_sections
+#define som_bfd_discard_group bfd_generic_discard_group
const bfd_target som_vec = {
"som", /* name */
diff --git a/bfd/sparclinux.c b/bfd/sparclinux.c
index 7f1d270ea3a..e55a4ffc2b2 100644
--- a/bfd/sparclinux.c
+++ b/bfd/sparclinux.c
@@ -599,10 +599,9 @@ bfd_sparclinux_size_dynamic_sections (output_bfd, info)
{
s->_raw_size = linux_hash_table (info)->fixup_count + 1;
s->_raw_size *= 8;
- s->contents = (bfd_byte *) bfd_alloc (output_bfd, s->_raw_size);
+ s->contents = (bfd_byte *) bfd_zalloc (output_bfd, s->_raw_size);
if (s->contents == NULL)
return false;
- memset (s->contents, 0, (size_t) s->_raw_size);
}
return true;
diff --git a/bfd/srec.c b/bfd/srec.c
index f40af69bcdf..e7a27be2ce6 100644
--- a/bfd/srec.c
+++ b/bfd/srec.c
@@ -1270,9 +1270,11 @@ srec_print_symbol (abfd, afile, symbol, how)
#define srec_bfd_relax_section bfd_generic_relax_section
#define srec_bfd_gc_sections bfd_generic_gc_sections
#define srec_bfd_merge_sections bfd_generic_merge_sections
+#define srec_bfd_discard_group bfd_generic_discard_group
#define srec_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
#define srec_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
#define srec_bfd_link_add_symbols _bfd_generic_link_add_symbols
+#define srec_bfd_link_just_syms _bfd_generic_link_just_syms
#define srec_bfd_final_link _bfd_generic_final_link
#define srec_bfd_link_split_section _bfd_generic_link_split_section
diff --git a/bfd/stabs.c b/bfd/stabs.c
index bba4a6d61ed..e225d9cd60d 100644
--- a/bfd/stabs.c
+++ b/bfd/stabs.c
@@ -284,6 +284,7 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo)
sym < symend;
sym += STABSIZE, ++pstridx)
{
+ bfd_size_type symstroff;
int type;
const char *string;
@@ -311,9 +312,18 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo)
}
/* Store the string in the hash table, and record the index. */
- string = ((char *) stabstrbuf
- + stroff
- + bfd_get_32 (abfd, sym + STRDXOFF));
+ symstroff = stroff + bfd_get_32 (abfd, sym + STRDXOFF);
+ if (symstroff >= stabstrsec->_raw_size)
+ {
+ (*_bfd_error_handler)
+ (_("%s(%s+0x%lx): Stabs entry has invalid string index."),
+ bfd_archive_filename (abfd),
+ bfd_get_section_name (abfd, stabsec),
+ (long) (sym - stabbuf));
+ bfd_set_error (bfd_error_bad_value);
+ goto error_return;
+ }
+ string = (char *) stabstrbuf + symstroff;
*pstridx = _bfd_stringtab_add (sinfo->strings, string, true, true);
/* An N_BINCL symbol indicates the start of the stabs entries
diff --git a/bfd/sunos.c b/bfd/sunos.c
index 7825a821a05..5fec6f91d7d 100644
--- a/bfd/sunos.c
+++ b/bfd/sunos.c
@@ -1434,10 +1434,9 @@ bfd_sunos_size_dynamic_sections (output_bfd, info, sdynptr, sneedptr,
s = bfd_get_section_by_name (dynobj, ".hash");
BFD_ASSERT (s != NULL);
hashalloc = (dynsymcount + bucketcount - 1) * HASH_ENTRY_SIZE;
- s->contents = (bfd_byte *) bfd_alloc (dynobj, hashalloc);
+ s->contents = (bfd_byte *) bfd_zalloc (dynobj, hashalloc);
if (s->contents == NULL && dynsymcount > 0)
return false;
- memset (s->contents, 0, (size_t) hashalloc);
for (i = 0; i < bucketcount; i++)
PUT_WORD (output_bfd, (bfd_vma) -1, s->contents + i * HASH_ENTRY_SIZE);
s->_raw_size = bucketcount * HASH_ENTRY_SIZE;
diff --git a/bfd/syms.c b/bfd/syms.c
index 01f7eee2cce..1c4bf288a83 100644
--- a/bfd/syms.c
+++ b/bfd/syms.c
@@ -285,6 +285,9 @@ CODE_FRAGMENT
. as well. *}
.#define BSF_DEBUGGING_RELOC 0x20000
.
+. {* This symbol is thread local. Used in ELF. *}
+.#define BSF_THREAD_LOCAL 0x40000
+.
. flagword flags;
.
. {* A pointer to the section to which this symbol is
@@ -880,6 +883,7 @@ _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, pfound,
char *file_name;
char *directory_name;
int saw_fun;
+ boolean saw_line, saw_func;
*pfound = false;
*pfilename = bfd_get_filename (abfd);
@@ -1236,13 +1240,13 @@ _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, pfound,
directory_name = indexentry->directory_name;
str = indexentry->str;
+ saw_line = false;
+ saw_func = false;
for (; stab < (indexentry+1)->stab; stab += STABSIZE)
{
- boolean done, saw_line, saw_func;
+ boolean done;
bfd_vma val;
- saw_line = false;
- saw_func = false;
done = false;
switch (stab[TYPEOFF])
diff --git a/bfd/targets.c b/bfd/targets.c
index b9d3a93a6eb..7c6f4f3c94a 100644
--- a/bfd/targets.c
+++ b/bfd/targets.c
@@ -396,10 +396,12 @@ the tokens.
.CONCAT2 (NAME,_bfd_link_hash_table_create), \
.CONCAT2 (NAME,_bfd_link_hash_table_free), \
.CONCAT2 (NAME,_bfd_link_add_symbols), \
+.CONCAT2 (NAME,_bfd_link_just_syms), \
.CONCAT2 (NAME,_bfd_final_link), \
.CONCAT2 (NAME,_bfd_link_split_section), \
.CONCAT2 (NAME,_bfd_gc_sections), \
-.CONCAT2 (NAME,_bfd_merge_sections)
+.CONCAT2 (NAME,_bfd_merge_sections), \
+.CONCAT2 (NAME,_bfd_discard_group)
. int (*_bfd_sizeof_headers) PARAMS ((bfd *, boolean));
. bfd_byte *(*_bfd_get_relocated_section_contents)
. PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *,
@@ -418,6 +420,9 @@ the tokens.
. {* Add symbols from this object file into the hash table. *}
. boolean (*_bfd_link_add_symbols) PARAMS ((bfd *, struct bfd_link_info *));
.
+. {* Indicate that we are only retrieving symbol values from this section. *}
+. void (*_bfd_link_just_syms) PARAMS ((asection *, struct bfd_link_info *));
+.
. {* Do a link based on the link_order structures attached to each
. section of the BFD. *}
. boolean (*_bfd_final_link) PARAMS ((bfd *, struct bfd_link_info *));
@@ -431,6 +436,9 @@ the tokens.
. {* Attempt to merge SEC_MERGE sections. *}
. boolean (*_bfd_merge_sections) PARAMS ((bfd *, struct bfd_link_info *));
.
+. {* Discard members of a group. *}
+. boolean (*_bfd_discard_group) PARAMS ((bfd *, struct sec *));
+.
. {* Routines to handle dynamic symbols and relocs. *}
.#define BFD_JUMP_TABLE_DYNAMIC(NAME) \
.CONCAT2 (NAME,_get_dynamic_symtab_upper_bound), \
@@ -503,12 +511,14 @@ extern const bfd_target bfd_elf32_bigmips_vec;
extern const bfd_target bfd_elf32_cris_vec;
extern const bfd_target bfd_elf32_d10v_vec;
extern const bfd_target bfd_elf32_d30v_vec;
+extern const bfd_target bfd_elf32_dlx_big_vec;
extern const bfd_target bfd_elf32_fr30_vec;
extern const bfd_target bfd_elf32_h8300_vec;
extern const bfd_target bfd_elf32_hppa_linux_vec;
extern const bfd_target bfd_elf32_hppa_vec;
extern const bfd_target bfd_elf32_i370_vec;
extern const bfd_target bfd_elf32_i386_vec;
+extern const bfd_target bfd_elf32_i386qnx_vec;
extern const bfd_target bfd_elf32_i860_little_vec;
extern const bfd_target bfd_elf32_i860_vec;
extern const bfd_target bfd_elf32_i960_vec;
@@ -546,6 +556,7 @@ extern const bfd_target bfd_elf32_tradbigmips_vec;
extern const bfd_target bfd_elf32_tradlittlemips_vec;
extern const bfd_target bfd_elf32_us_cris_vec;
extern const bfd_target bfd_elf32_v850_vec;
+extern const bfd_target bfd_elf32_vax_vec;
extern const bfd_target bfd_elf32_xstormy16_vec;
extern const bfd_target bfd_elf64_alpha_vec;
extern const bfd_target bfd_elf64_big_generic_vec;
@@ -660,6 +671,7 @@ extern const bfd_target tic54x_coff2_beh_vec;
extern const bfd_target tic54x_coff2_vec;
extern const bfd_target tic80coff_vec;
extern const bfd_target vaxnetbsd_vec;
+extern const bfd_target vax1knetbsd_vec;
extern const bfd_target versados_vec;
extern const bfd_target vms_alpha_vec;
extern const bfd_target vms_vax_vec;
@@ -691,6 +703,11 @@ extern const bfd_target bfd_elf32_sh64_vec;
extern const bfd_target bfd_elf32_sh64l_vec;
extern const bfd_target bfd_elf64_sh64_vec;
extern const bfd_target bfd_elf64_sh64l_vec;
+
+extern const bfd_target bfd_elf32_sh64nbsd_vec;
+extern const bfd_target bfd_elf32_sh64lnbsd_vec;
+extern const bfd_target bfd_elf64_sh64nbsd_vec;
+extern const bfd_target bfd_elf64_sh64lnbsd_vec;
static const bfd_target * const _bfd_target_vector[] = {
#ifdef SELECT_VECS
@@ -753,12 +770,14 @@ static const bfd_target * const _bfd_target_vector[] = {
&bfd_elf32_cris_vec,
&bfd_elf32_d10v_vec,
&bfd_elf32_d30v_vec,
+ &bfd_elf32_dlx_big_vec,
&bfd_elf32_fr30_vec,
&bfd_elf32_h8300_vec,
&bfd_elf32_hppa_linux_vec,
&bfd_elf32_hppa_vec,
&bfd_elf32_i370_vec,
&bfd_elf32_i386_vec,
+ &bfd_elf32_i386qnx_vec,
&bfd_elf32_i860_little_vec,
&bfd_elf32_i860_vec,
&bfd_elf32_i960_vec,
@@ -798,6 +817,7 @@ static const bfd_target * const _bfd_target_vector[] = {
&bfd_elf32_tradlittlemips_vec,
&bfd_elf32_us_cris_vec,
&bfd_elf32_v850_vec,
+ &bfd_elf32_vax_vec,
&bfd_elf32_xstormy16_vec,
#ifdef BFD64
&bfd_elf64_alpha_vec,
@@ -960,6 +980,7 @@ static const bfd_target * const _bfd_target_vector[] = {
&tic54x_coff2_vec,
&tic80coff_vec,
&vaxnetbsd_vec,
+ &vax1knetbsd_vec,
&versados_vec,
#ifdef BFD64
&vms_alpha_vec,
diff --git a/bfd/tekhex.c b/bfd/tekhex.c
index 565568a27b4..034ef28b867 100644
--- a/bfd/tekhex.c
+++ b/bfd/tekhex.c
@@ -354,17 +354,13 @@ find_chunk (abfd, vma)
}
if (!d)
{
- char *sname = bfd_alloc (abfd, (bfd_size_type) 12);
-
/* No chunk for this address, so make one up */
d = ((struct data_struct *)
- bfd_alloc (abfd, (bfd_size_type) sizeof (struct data_struct)));
+ bfd_zalloc (abfd, (bfd_size_type) sizeof (struct data_struct)));
- if (!sname || !d)
+ if (!d)
return NULL;
- memset (d->chunk_init, 0, CHUNK_MASK + 1);
- memset (d->chunk_data, 0, CHUNK_MASK + 1);
d->next = abfd->tdata.tekhex_data->data;
d->vma = vma;
abfd->tdata.tekhex_data->data = d;
@@ -1005,9 +1001,11 @@ tekhex_print_symbol (abfd, filep, symbol, how)
#define tekhex_bfd_relax_section bfd_generic_relax_section
#define tekhex_bfd_gc_sections bfd_generic_gc_sections
#define tekhex_bfd_merge_sections bfd_generic_merge_sections
+#define tekhex_bfd_discard_group bfd_generic_discard_group
#define tekhex_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
#define tekhex_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
#define tekhex_bfd_link_add_symbols _bfd_generic_link_add_symbols
+#define tekhex_bfd_link_just_syms _bfd_generic_link_just_syms
#define tekhex_bfd_final_link _bfd_generic_final_link
#define tekhex_bfd_link_split_section _bfd_generic_link_split_section
diff --git a/bfd/vax1knetbsd.c b/bfd/vax1knetbsd.c
new file mode 100644
index 00000000000..e20cd171d86
--- /dev/null
+++ b/bfd/vax1knetbsd.c
@@ -0,0 +1,37 @@
+/* BFD back-end for NetBSD/VAX (1K page size) a.out-ish binaries.
+ Copyright 1998, 2000, 2001, 2002 Free Software Foundation, Inc.
+
+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 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 BYTES_IN_WORD 4
+#undef TARGET_IS_BIG_ENDIAN_P
+
+#define TARGET_PAGE_SIZE 1024
+#define SEGMENT_SIZE TARGET_PAGE_SIZE
+
+#define DEFAULT_ARCH bfd_arch_vax
+#define DEFAULT_MID M_VAX_NETBSD
+
+/* Do not "beautify" the CONCAT* macro args. Traditional C will not
+ remove whitespace added here, and thus will fail to concatenate
+ the tokens. */
+#define MY(OP) CONCAT2 (vax1knetbsd_,OP)
+
+/* This needs to start with a.out so GDB knows it is an a.out variant. */
+#define TARGETNAME "a.out-vax1k-netbsd"
+
+#include "netbsd.h"
diff --git a/bfd/vaxnetbsd.c b/bfd/vaxnetbsd.c
index 21a0b37aafc..48a1ed637a2 100644
--- a/bfd/vaxnetbsd.c
+++ b/bfd/vaxnetbsd.c
@@ -1,5 +1,5 @@
-/* BFD back-end for NetBSD/VAX a.out-ish binaries.
- Copyright 1998, 2000, 2001 Free Software Foundation, Inc.
+/* BFD back-end for NetBSD/VAX (4K page size) a.out-ish binaries.
+ Copyright 1998, 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -20,11 +20,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define BYTES_IN_WORD 4
#undef TARGET_IS_BIG_ENDIAN_P
-#define TARGET_PAGE_SIZE 1024
+#define TARGET_PAGE_SIZE 0x1000
#define SEGMENT_SIZE TARGET_PAGE_SIZE
#define DEFAULT_ARCH bfd_arch_vax
-#define DEFAULT_MID M_VAX_NETBSD
+#define DEFAULT_MID M_VAX4K_NETBSD
/* 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/versados.c b/bfd/versados.c
index 9a7bcc71a40..297bbe60a4a 100644
--- a/bfd/versados.c
+++ b/bfd/versados.c
@@ -867,9 +867,11 @@ versados_canonicalize_reloc (abfd, section, relptr, symbols)
#define versados_bfd_relax_section bfd_generic_relax_section
#define versados_bfd_gc_sections bfd_generic_gc_sections
#define versados_bfd_merge_sections bfd_generic_merge_sections
+#define versados_bfd_discard_group bfd_generic_discard_group
#define versados_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
#define versados_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
#define versados_bfd_link_add_symbols _bfd_generic_link_add_symbols
+#define versados_bfd_link_just_syms _bfd_generic_link_just_syms
#define versados_bfd_final_link _bfd_generic_final_link
#define versados_bfd_link_split_section _bfd_generic_link_split_section
diff --git a/bfd/version.h b/bfd/version.h
index 6ab3d30a800..e1448566304 100644
--- a/bfd/version.h
+++ b/bfd/version.h
@@ -1 +1 @@
-#define BFD_VERSION_DATE 20020511
+#define BFD_VERSION_DATE 20020615
diff --git a/bfd/vms-gsd.c b/bfd/vms-gsd.c
index d9dcd785789..002412232dc 100644
--- a/bfd/vms-gsd.c
+++ b/bfd/vms-gsd.c
@@ -426,13 +426,12 @@ _bfd_vms_slurp_gsd (abfd, objtype)
else
{
section->contents = ((unsigned char *)
- bfd_malloc (section->_raw_size));
+ bfd_zmalloc (section->_raw_size));
if (section->contents == NULL)
{
bfd_set_error (bfd_error_no_memory);
return -1;
}
- memset (section->contents, 0, (size_t) section->_raw_size);
}
section->_cooked_size = section->_raw_size;
#if VMS_DEBUG
@@ -618,10 +617,9 @@ _bfd_vms_slurp_gsd (abfd, objtype)
section->vma = (bfd_vma)base_addr;
base_addr += section->_raw_size;
section->contents = ((unsigned char *)
- bfd_malloc (section->_raw_size));
+ bfd_zmalloc (section->_raw_size));
if (section->contents == NULL)
return -1;
- memset (section->contents, 0, (size_t) section->_raw_size);
section->_cooked_size = section->_raw_size;
#if VMS_DEBUG
vms_debug(4, "egsd psc %d (%s, flags %04x=%s) ",
diff --git a/bfd/vms.c b/bfd/vms.c
index 7ca74591016..60326179b32 100644
--- a/bfd/vms.c
+++ b/bfd/vms.c
@@ -132,6 +132,8 @@ static boolean vms_bfd_merge_private_bfd_data PARAMS ((bfd *ibfd, bfd *obfd));
static boolean vms_bfd_set_private_flags PARAMS ((bfd *abfd, flagword flags));
#define vms_make_empty_symbol _bfd_generic_make_empty_symbol
+#define vms_bfd_link_just_syms _bfd_generic_link_just_syms
+#define vms_bfd_discard_group bfd_generic_discard_group
/*===========================================================================*/
diff --git a/bfd/xcoff-target.h b/bfd/xcoff-target.h
index 0787b8de3e2..413511b96e7 100644
--- a/bfd/xcoff-target.h
+++ b/bfd/xcoff-target.h
@@ -1,5 +1,5 @@
/* Common definitions for backends based on IBM RS/6000 "XCOFF64" files.
- Copyright 2000, 2001
+ Copyright 2000, 2001, 2002
Free Software Foundation, Inc.
Contributed by Cygnus Support.
@@ -98,6 +98,7 @@ extern int lynx_core_file_failing_signal PARAMS ((bfd *abfd));
#define _bfd_xcoff_bfd_relax_section coff_bfd_relax_section
#define _bfd_xcoff_bfd_gc_sections coff_bfd_gc_sections
#define _bfd_xcoff_bfd_merge_sections coff_bfd_merge_sections
+#define _bfd_xcoff_bfd_discard_group bfd_generic_discard_group
#define _bfd_xcoff_bfd_link_split_section coff_bfd_link_split_section
/* XCOFF archives do not have anything which corresponds to an
diff --git a/bfd/xcofflink.c b/bfd/xcofflink.c
index 9d66243478c..7215b1bc64a 100644
--- a/bfd/xcofflink.c
+++ b/bfd/xcofflink.c
@@ -1086,21 +1086,19 @@ xcoff_link_add_symbols (abfd, info)
/* We keep a list of the linker hash table entries that correspond
to each external symbol. */
amt = symcount * sizeof (struct xcoff_link_hash_entry *);
- sym_hash = (struct xcoff_link_hash_entry **) bfd_alloc (abfd, amt);
+ sym_hash = (struct xcoff_link_hash_entry **) bfd_zalloc (abfd, amt);
if (sym_hash == NULL && symcount != 0)
goto error_return;
coff_data (abfd)->sym_hashes = (struct coff_link_hash_entry **) sym_hash;
- memset (sym_hash, 0, (size_t) amt);
/* Because of the weird stuff we are doing with XCOFF csects, we can
not easily determine which section a symbol is in, so we store
the information in the tdata for the input file. */
amt = symcount * sizeof (asection *);
- csect_cache = (asection **) bfd_alloc (abfd, amt);
+ csect_cache = (asection **) bfd_zalloc (abfd, amt);
if (csect_cache == NULL && symcount != 0)
goto error_return;
xcoff_data (abfd)->csects = csect_cache;
- memset (csect_cache, 0, (size_t) amt);
/* While splitting sections into csects, we need to assign the
relocs correctly. The relocs and the csects must both be in
@@ -1109,10 +1107,9 @@ xcoff_link_add_symbols (abfd, info)
into reloc_info using the section target_index. */
amt = abfd->section_count + 1;
amt *= sizeof (struct reloc_info_struct);
- reloc_info = (struct reloc_info_struct *) bfd_malloc (amt);
+ reloc_info = (struct reloc_info_struct *) bfd_zmalloc (amt);
if (reloc_info == NULL)
goto error_return;
- memset ((PTR) reloc_info, 0, (size_t) amt);
/* Read in the relocs and line numbers for each section. */
linesz = bfd_coff_linesz (abfd);
@@ -1129,11 +1126,9 @@ xcoff_link_add_symbols (abfd, info)
false, (struct internal_reloc *) NULL);
amt = o->reloc_count;
amt *= sizeof (asection *);
- reloc_info[o->target_index].csects = (asection **) bfd_malloc (amt);
+ reloc_info[o->target_index].csects = (asection **) bfd_zmalloc (amt);
if (reloc_info[o->target_index].csects == NULL)
goto error_return;
- memset (reloc_info[o->target_index].csects, 0, (size_t) amt);
-
}
if ((info->strip == strip_none || info->strip == strip_some)
diff --git a/config-ml.in b/config-ml.in
index c968bf0d719..aae3f87fe74 100644
--- a/config-ml.in
+++ b/config-ml.in
@@ -510,14 +510,16 @@ multidirs=`echo "$multidirs" | sed -e 's/^[ ][ ]*//' -e 's/[ ][ ]*$//' -e 's/[ ]
cat > Multi.tem <<\EOF
+PWD=$${PWDCMD-pwd}
+
# FIXME: There should be an @-sign in front of the `if'.
# Leave out until this is tested a bit more.
multi-do:
if [ -z "$(MULTIDIRS)" ]; then \
true; \
else \
- rootpre=`pwd`/; export rootpre; \
- srcrootpre=`cd $(srcdir); pwd`/; export srcrootpre; \
+ rootpre=`${PWD}`/; export rootpre; \
+ srcrootpre=`cd $(srcdir); ${PWD}`/; export srcrootpre; \
lib=`echo $${rootpre} | sed -e 's,^.*/\([^/][^/]*\)/$$,\1,'`; \
compiler="$(CC)"; \
for i in `$${compiler} --print-multi-lib 2>/dev/null`; do \
@@ -535,6 +537,7 @@ multi-do:
LIBCFLAGS="$(LIBCFLAGS) $${flags}" \
LIBCXXFLAGS="$(LIBCXXFLAGS) $${flags}" \
LDFLAGS="$(LDFLAGS) $${flags}" \
+ DESTDIR="$(DESTDIR)" \
$(DO)); then \
true; \
else \
@@ -552,7 +555,7 @@ multi-clean:
if [ -z "$(MULTIDIRS)" ]; then \
true; \
else \
- lib=`pwd | sed -e 's,^.*/\([^/][^/]*\)$$,\1,'`; \
+ lib=`${PWD} | sed -e 's,^.*/\([^/][^/]*\)$$,\1,'`; \
for dir in Makefile $(MULTIDIRS); do \
if [ -f ../$${dir}/$${lib}/Makefile ]; then \
if (cd ../$${dir}/$${lib}; $(MAKE) $(FLAGS_TO_PASS) $(DO)); \
@@ -659,10 +662,10 @@ if [ -n "${multidirs}" ] && [ -z "${ml_norecursion}" ]; then
if [ "${ml_verbose}" = --verbose ]; then
echo "Running configure in multilib subdirs ${multidirs}"
- echo "pwd: `pwd`"
+ echo "pwd: `${PWDCMD-pwd}`"
fi
- ml_origdir=`pwd`
+ ml_origdir=`${PWDCMD-pwd}`
ml_libdir=`echo $ml_origdir | sed -e 's,^.*/,,'`
# cd to top-level-build-dir/${with_target_subdir}
cd ..
@@ -671,7 +674,7 @@ if [ -n "${multidirs}" ] && [ -z "${ml_norecursion}" ]; then
if [ "${ml_verbose}" = --verbose ]; then
echo "Running configure in multilib subdir ${ml_dir}"
- echo "pwd: `pwd`"
+ echo "pwd: `${PWDCMD-pwd}`"
fi
if [ -d ${ml_dir} ]; then true; else
@@ -699,7 +702,7 @@ if [ -n "${multidirs}" ] && [ -z "${ml_norecursion}" ]; then
case ${srcdir} in
".")
- echo Building symlink tree in `pwd`/${ml_dir}/${ml_libdir}
+ echo Building symlink tree in `${PWDCMD-pwd}`/${ml_dir}/${ml_libdir}
if [ "${with_target_subdir}" != "." ]; then
ml_unsubdir="../"
else
diff --git a/config.guess b/config.guess
index ed2e03b7f2b..fbad77f14ba 100755
--- a/config.guess
+++ b/config.guess
@@ -3,7 +3,7 @@
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002 Free Software Foundation, Inc.
-timestamp='2002-03-20'
+timestamp='2002-05-22'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@@ -142,6 +142,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
/usr/sbin/$sysctl 2>/dev/null || echo unknown)`
case "${UNAME_MACHINE_ARCH}" in
+ armeb) machine=armeb-unknown ;;
arm*) machine=arm-unknown ;;
sh3el) machine=shl-unknown ;;
sh3eb) machine=sh-unknown ;;
@@ -428,6 +429,9 @@ EOF
Motorola:PowerMAX_OS:*:*)
echo powerpc-motorola-powermax
exit 0 ;;
+ Night_Hawk:*:*:PowerMAX_OS)
+ echo powerpc-harris-powermax
+ exit 0 ;;
Night_Hawk:Power_UNIX:*:*)
echo powerpc-harris-powerunix
exit 0 ;;
@@ -958,7 +962,7 @@ EOF
exit 0 ;;
M68*:*:R3V[567]*:*)
test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
- 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0)
+ 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0)
OS_REL=''
test -r /etc/.relid \
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
diff --git a/config.sub b/config.sub
index 299f3f4c5ea..4693ac17f95 100755
--- a/config.sub
+++ b/config.sub
@@ -3,7 +3,7 @@
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002 Free Software Foundation, Inc.
-timestamp='2002-04-26'
+timestamp='2002-05-22'
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
@@ -230,7 +230,7 @@ case $basic_machine in
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
| c4x | clipper \
- | d10v | d30v | dsp16xx \
+ | d10v | d30v | dlx | dsp16xx \
| fr30 \
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
| i370 | i860 | i960 | ia64 \
@@ -281,12 +281,12 @@ case $basic_machine in
| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
- | arm-* | armbe-* | armle-* | armv*-* \
+ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \
| avr-* \
| bs2000-* \
| c[123]* | c30-* | [cjt]90-* | c54x-* \
| clipper-* | cydra-* \
- | d10v-* | d30v-* \
+ | d10v-* | d30v-* | dlx-* \
| elxsi-* \
| f30[01]-* | f700-* | fr30-* | fx80-* \
| h8300-* | h8500-* \
@@ -1090,7 +1090,7 @@ case $os in
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
- | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* )
+ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* | -powermax*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
-qnx*)
diff --git a/config/ChangeLog b/config/ChangeLog
index 06f7605dc78..129ce6168f3 100644
--- a/config/ChangeLog
+++ b/config/ChangeLog
@@ -1,3 +1,13 @@
+2002-05-16 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
+
+ * acinclude.m4: Allow for PWDCMD to override hardcoded pwd.
+
+2002-05-13 Nathanael Nerode <neroden@twcny.rr.com>
+
+ * mh-apollo68: remove unused HDEFINES setting.
+ * mh-dgux: remove unused HDEFINES setting.
+ * mh-dgux386: remove unused HDEFINES setting, duplicate RANLIB=true.
+
2002-04-29 Nathanael Nerode <neroden@twcny.rr.com>
* config/mh-cxux: remove dead code
diff --git a/config/acinclude.m4 b/config/acinclude.m4
index 9be62cb9a06..00887e0dd30 100755
--- a/config/acinclude.m4
+++ b/config/acinclude.m4
@@ -206,7 +206,7 @@ dnl Look for the header file
AC_CACHE_VAL(ac_cv_c_bfdh,[
for i in $dirlist; do
if test -f "$i/bfd/bfd.h" ; then
- ac_cv_c_bfdh=`(cd $i/bfd; pwd)`
+ ac_cv_c_bfdh=`(cd $i/bfd; ${PWDCMD-pwd})`
break
fi
done
@@ -224,7 +224,7 @@ AC_MSG_CHECKING(for the bfd library in the build tree)
AC_CACHE_VAL(ac_cv_c_bfdlib,[
for i in $dirlist; do
if test -f "$i/bfd/Makefile" ; then
- ac_cv_c_bfdlib=`(cd $i/bfd; pwd)`
+ ac_cv_c_bfdlib=`(cd $i/bfd; ${PWDCMD-pwd})`
fi
done
])
@@ -247,7 +247,7 @@ dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../
AC_CACHE_VAL(ac_cv_c_liberty,[
for i in $dirlist; do
if test -f "$i/libiberty/Makefile" ; then
- ac_cv_c_liberty=`(cd $i/libiberty; pwd)`
+ ac_cv_c_liberty=`(cd $i/libiberty; ${PWDCMD-pwd})`
fi
done
])
@@ -268,7 +268,7 @@ dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../
AC_CACHE_VAL(ac_cv_c_opc,[
for i in $dirlist; do
if test -f "$i/opcodes/Makefile" ; then
- ac_cv_c_opc=`(cd $i/opcodes; pwd)`
+ ac_cv_c_opc=`(cd $i/opcodes; ${PWDCMD-pwd})`
fi
done
])
@@ -290,7 +290,7 @@ dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../
AC_CACHE_VAL(ac_cv_c_dejagnu,[
for i in $dirlist; do
if test -f "$srcdir/$i/ecc/ecc/infra/testlib/current/include/dejagnu.h" ; then
- ac_cv_c_dejagnu=`(cd $srcdir/$i/ecc/ecc/infra/testlib/current/include; pwd)`
+ ac_cv_c_dejagnu=`(cd $srcdir/$i/ecc/ecc/infra/testlib/current/include; ${PWDCMD-pwd})`
fi
done
])
@@ -303,7 +303,7 @@ fi
AC_CACHE_VAL(ac_cv_c_dejagnulib,[
for i in $dirlist; do
if test -f "$srcdir/$i/infra/testlib/current/lib/hostutil.exp" ; then
- ac_cv_c_dejagnulib=`(cd $srcdir/$i/infra/testlib/current/lib; pwd)`
+ ac_cv_c_dejagnulib=`(cd $srcdir/$i/infra/testlib/current/lib; ${PWDCMD-pwd})`
fi
done
])
@@ -316,7 +316,7 @@ AC_MSG_CHECKING(for runtest in the source tree)
AC_CACHE_VAL(ac_cv_c_runtest,[
for i in $dirlist; do
if test -f "$srcdir/$i/dejagnu/runtest" ; then
- ac_cv_c_runtest=`(cd $srcdir/$i/dejagnu; pwd)`
+ ac_cv_c_runtest=`(cd $srcdir/$i/dejagnu; ${PWDCMD-pwd})`
fi
done
])
@@ -342,7 +342,7 @@ dnl Look for the header file
AC_CACHE_VAL(ac_cv_c_intlh,[
for i in $dirlist; do
if test -f "$i/intl/libintl.h" ; then
- ac_cv_c_intlh=`(cd $i/intl; pwd)`
+ ac_cv_c_intlh=`(cd $i/intl; ${PWDCMD-pwd})`
break
fi
done
@@ -360,7 +360,7 @@ AC_MSG_CHECKING(for the libintl library in the build tree)
AC_CACHE_VAL(ac_cv_c_intllib,[
for i in $dirlist; do
if test -f "$i/intl/Makefile" ; then
- ac_cv_c_intllib=`(cd $i/intl; pwd)`
+ ac_cv_c_intllib=`(cd $i/intl; ${PWDCMD-pwd})`
fi
done
])
@@ -388,7 +388,7 @@ AC_MSG_CHECKING(for the simulator header file)
AC_CACHE_VAL(ac_cv_c_simh,[
for i in $dirlist; do
if test -f "${srcdir}/$i/include/remote-sim.h" ; then
- ac_cv_c_simh=`(cd ${srcdir}/$i/include; pwd)`
+ ac_cv_c_simh=`(cd ${srcdir}/$i/include; ${PWDCMD-pwd})`
break
fi
done
@@ -420,7 +420,7 @@ AC_MSG_CHECKING(for the simulator library)
AC_CACHE_VAL(ac_cv_c_simlib,[
for i in $dirlist; do
if test -f "$i/sim/$target_dir/Makefile" ; then
- ac_cv_c_simlib=`(cd $i/sim/$target_dir; pwd)`
+ ac_cv_c_simlib=`(cd $i/sim/$target_dir; ${PWDCMD-pwd})`
fi
done
])
@@ -463,7 +463,7 @@ dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../
AC_CACHE_VAL(ac_cv_c_libib,[
for i in $dirlist; do
if test -f "$i/libiberty/Makefile" ; then
- ac_cv_c_libib=`(cd $i/libiberty/; pwd)`
+ ac_cv_c_libib=`(cd $i/libiberty/; ${PWDCMD-pwd})`
fi
done
])
@@ -483,7 +483,7 @@ dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../
AC_CACHE_VAL(ac_cv_c_devoh,[
for i in $dirlist; do
if test -f "${srcdir}/$i/include/remote-sim.h" ; then
- ac_cv_c_devoh=`(cd ${srcdir}/$i/include; pwd)`
+ ac_cv_c_devoh=`(cd ${srcdir}/$i/include; ${PWDCMD-pwd})`
fi
done
])
@@ -506,7 +506,7 @@ IDELIB=
AC_CACHE_VAL(ac_cv_c_ideh,[
for i in $dirlist; do
if test -f "${srcdir}/$i/libide/src/event.h" ; then
- ac_cv_c_ideh=`(cd ${srcdir}/$i/libide/src; pwd)`;
+ ac_cv_c_ideh=`(cd ${srcdir}/$i/libide/src; ${PWDCMD-pwd})`;
fi
done
])
@@ -521,7 +521,7 @@ AC_MSG_CHECKING(for LIBIDE TCL headers in the source tree)
AC_CACHE_VAL(ac_cv_c_idetclh,[
for i in $dirlist; do
if test -f "${srcdir}/$i/libidetcl/src/idetcl.h" ; then
- ac_cv_c_idetclh=`(cd ${srcdir}/$i/libidetcl/src; pwd)`;
+ ac_cv_c_idetclh=`(cd ${srcdir}/$i/libidetcl/src; ${PWDCMD-pwd})`;
fi
done
])
@@ -536,7 +536,7 @@ AC_MSG_CHECKING(for IDE headers in the build tree)
AC_CACHE_VAL(ac_cv_c_ideh2,[
for i in $dirlist; do
if test -f "$i/libide/src/Makefile" ; then
- ac_cv_c_ideh2=`(cd $i/libide/src; pwd)`;
+ ac_cv_c_ideh2=`(cd $i/libide/src; ${PWDCMD-pwd})`;
fi
done
])
@@ -553,7 +553,7 @@ AC_CACHE_VAL(ac_cv_c_idelib,[
if test x"${ac_cv_c_idelib}" = x ; then
for i in $dirlist; do
if test -f "$i/libide/src/Makefile" ; then
- ac_cv_c_idelib=`(cd $i/libide/src; pwd)`
+ ac_cv_c_idelib=`(cd $i/libide/src; ${PWDCMD-pwd})`
break
fi
done
@@ -571,7 +571,7 @@ AC_CACHE_VAL(ac_cv_c_idetcllib,[
if test x"${ac_cv_c_idetcllib}" = x ; then
for i in $dirlist; do
if test -f "$i/libidetcl/src/Makefile" ; then
- ac_cv_c_idetcllib=`(cd $i/libidetcl/src; pwd)`
+ ac_cv_c_idetcllib=`(cd $i/libidetcl/src; ${PWDCMD-pwd})`
break
fi
done
@@ -597,7 +597,7 @@ dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../
AC_CACHE_VAL(ac_cv_c_iluh,[
for i in $dirlist; do
if test -f "${srcdir}/$i/ilu/runtime/kernel/method.h" ; then
- ac_cv_c_iluh=`(cd ${srcdir}/$i/ilu/runtime/kernel; pwd)`
+ ac_cv_c_iluh=`(cd ${srcdir}/$i/ilu/runtime/kernel; ${PWDCMD-pwd})`
fi
done
])
@@ -613,7 +613,7 @@ dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../
AC_CACHE_VAL(ac_cv_c_iluh5,[
for i in $dirlist; do
if test -f "$i/ilu/runtime/kernel/iluconf.h" ; then
- ac_cv_c_iluh5=`(cd $i/ilu/runtime/kernel; pwd)`
+ ac_cv_c_iluh5=`(cd $i/ilu/runtime/kernel; ${PWDCMD-pwd})`
fi
done
])
@@ -628,7 +628,7 @@ AC_MSG_CHECKING(for ILU C++ headers in the source tree)
AC_CACHE_VAL(ac_cv_c_iluh2,[
for i in $dirlist; do
if test -f "${srcdir}/$i/ilu/stubbers/cpp/resource.h" ; then
- ac_cv_c_iluh2=`(cd ${srcdir}/$i/ilu/stubbers/cpp; pwd)`
+ ac_cv_c_iluh2=`(cd ${srcdir}/$i/ilu/stubbers/cpp; ${PWDCMD-pwd})`
fi
done
])
@@ -643,7 +643,7 @@ AC_MSG_CHECKING(for ILU C headers)
AC_CACHE_VAL(ac_cv_c_iluh3,[
for i in $dirlist; do
if test -f "${srcdir}/$i/ilu/stubbers/c/resource.h" ; then
- ac_cv_c_iluh3=`(cd ${srcdir}/$i/ilu/stubbers/c ; pwd)`
+ ac_cv_c_iluh3=`(cd ${srcdir}/$i/ilu/stubbers/c ; ${PWDCMD-pwd})`
fi
done
])
@@ -658,7 +658,7 @@ AC_MSG_CHECKING(for ILU C runtime headers)
AC_CACHE_VAL(ac_cv_c_iluh4,[
for i in $dirlist; do
if test -f "${srcdir}/$i/ilu/runtime/c/ilucstub.h" ; then
- ac_cv_c_iluh4=`(cd ${srcdir}/$i/ilu/runtime/c ; pwd)`
+ ac_cv_c_iluh4=`(cd ${srcdir}/$i/ilu/runtime/c ; ${PWDCMD-pwd})`
fi
done
])
@@ -672,7 +672,7 @@ fi
AC_CACHE_VAL(ac_cv_c_ilupath,[
for i in $dirlist; do
if test -f "$i/ilu/Makefile" ; then
- ac_cv_c_ilupath=`(cd $i/ilu; pwd)`
+ ac_cv_c_ilupath=`(cd $i/ilu; ${PWDCMD-pwd})`
break
fi
done
@@ -682,7 +682,7 @@ ILUTOP=${ac_cv_c_ilupath}
AC_MSG_CHECKING(for the ILU library in the build tree)
AC_CACHE_VAL(ac_cv_c_ilulib,[
if test -f "$ac_cv_c_ilupath/runtime/kernel/Makefile" ; then
- ac_cv_c_ilulib=`(cd $ac_cv_c_ilupath/runtime/kernel; pwd)`
+ ac_cv_c_ilulib=`(cd $ac_cv_c_ilupath/runtime/kernel; ${PWDCMD-pwd})`
AC_MSG_RESULT(found ${ac_cv_c_ilulib}/libilu.a)
else
AC_MSG_RESULT(no)
@@ -691,7 +691,7 @@ fi])
AC_MSG_CHECKING(for the ILU C++ bindings library in the build tree)
AC_CACHE_VAL(ac_cv_c_ilulib2,[
if test -f "$ac_cv_c_ilupath/runtime/cpp/Makefile" ; then
- ac_cv_c_ilulib2=`(cd $ac_cv_c_ilupath/runtime/cpp; pwd)`
+ ac_cv_c_ilulib2=`(cd $ac_cv_c_ilupath/runtime/cpp; ${PWDCMD-pwd})`
AC_MSG_RESULT(found ${ac_cv_c_ilulib2}/libilu-c++.a)
else
AC_MSG_RESULT(no)
@@ -700,7 +700,7 @@ fi])
AC_MSG_CHECKING(for the ILU C bindings library in the build tree)
AC_CACHE_VAL(ac_cv_c_ilulib3,[
if test -f "$ac_cv_c_ilupath/runtime/c/Makefile" ; then
- ac_cv_c_ilulib3=`(cd $ac_cv_c_ilupath/runtime/c; pwd)`
+ ac_cv_c_ilulib3=`(cd $ac_cv_c_ilupath/runtime/c; ${PWDCMD-pwd})`
AC_MSG_RESULT(found ${ac_cv_c_ilulib3}/libilu-c.a)
else
AC_MSG_RESULT(no)
@@ -709,7 +709,7 @@ fi])
AC_MSG_CHECKING(for the ILU Tk bindings library in the build tree)
AC_CACHE_VAL(ac_cv_c_ilulib4,[
if test -f "$ac_cv_c_ilupath/runtime/mainloop/Makefile" ; then
- ac_cv_c_ilulib4=`(cd $ac_cv_c_ilupath/runtime/mainloop; pwd)`
+ ac_cv_c_ilulib4=`(cd $ac_cv_c_ilupath/runtime/mainloop; ${PWDCMD-pwd})`
AC_MSG_RESULT(found ${ac_cv_c_ilulib4}/libilu-tk.a)
else
AC_MSG_RESULT(no)
@@ -858,9 +858,9 @@ AC_CACHE_VAL(ac_cv_c_tclh,[
dnl first check to see if --with-tclinclude was specified
if test x"${with_tclinclude}" != x ; then
if test -f ${with_tclinclude}/tcl.h ; then
- ac_cv_c_tclh=`(cd ${with_tclinclude}; pwd)`
+ ac_cv_c_tclh=`(cd ${with_tclinclude}; ${PWDCMD-pwd})`
elif test -f ${with_tclinclude}/generic/tcl.h ; then
- ac_cv_c_tclh=`(cd ${with_tclinclude}/generic; pwd)`
+ ac_cv_c_tclh=`(cd ${with_tclinclude}/generic; ${PWDCMD-pwd})`
else
AC_MSG_ERROR([${with_tclinclude} directory doesn't contain headers])
fi
@@ -870,7 +870,7 @@ dnl next check if it came with Tcl configuration file
if test x"${ac_cv_c_tclconfig}" != x ; then
for i in $dirlist; do
if test -f $ac_cv_c_tclconfig/$i/generic/tcl.h ; then
- ac_cv_c_tclh=`(cd $ac_cv_c_tclconfig/$i/generic; pwd)`
+ ac_cv_c_tclh=`(cd $ac_cv_c_tclconfig/$i/generic; ${PWDCMD-pwd})`
break
fi
done
@@ -891,7 +891,7 @@ if test x"${ac_cv_c_tclh}" = x ; then
dnl might be multiple version of Tcl, and we want the most recent one.
for i in `ls -dr $tclpath/tcl* 2>/dev/null ` ; do
if test -f $i/generic/tcl.h ; then
- ac_cv_c_tclh=`(cd $i/generic; pwd)`
+ ac_cv_c_tclh=`(cd $i/generic; ${PWDCMD-pwd})`
break
fi
done
@@ -950,7 +950,7 @@ if test x"${no_tcl}" = x ; then
dnl First check to see if --with-tclconfig was specified.
if test x"${with_tclconfig}" != x ; then
if test -f "${with_tclconfig}/tclConfig.sh" ; then
- ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)`
+ ac_cv_c_tclconfig=`(cd ${with_tclconfig}; ${PWDCMD-pwd})`
else
AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh])
fi
@@ -963,11 +963,11 @@ if test x"${no_tcl}" = x ; then
dnl cygwin's tkConfig.sh could be in either directory depending
dnl on the cygwin port of tcl.
if test -f $srcdir/$i/unix/tclConfig.sh ; then
- ac_cv_c_tclconfig=`(cd $srcdir/$i/unix; pwd)`
+ ac_cv_c_tclconfig=`(cd $srcdir/$i/unix; ${PWDCMD-pwd})`
break
fi
if test -f $srcdir/$i/win/tclConfig.sh ; then
- ac_cv_c_tclconfig=`(cd $srcdir/$i/win; pwd)`
+ ac_cv_c_tclconfig=`(cd $srcdir/$i/win; ${PWDCMD-pwd})`
break
fi
done
@@ -989,11 +989,11 @@ if test x"${no_tcl}" = x ; then
dnl cygwin's tclConfig.sh could be in either directory depending
dnl on the cygwin port of tcl.
if test -f $i/unix/tclConfig.sh ; then
- ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
+ ac_cv_c_tclconfig=`(cd $i/unix; ${PWDCMD-pwd})`
break
fi
if test -f $i/win/tclConfig.sh ; then
- ac_cv_c_tclconfig=`(cd $i/win; pwd)`
+ ac_cv_c_tclconfig=`(cd $i/win; ${PWDCMD-pwd})`
break
fi
done
@@ -1097,9 +1097,9 @@ AC_CACHE_VAL(ac_cv_c_tkh,[
dnl first check to see if --with-tkinclude was specified
if test x"${with_tkinclude}" != x ; then
if test -f ${with_tkinclude}/tk.h ; then
- ac_cv_c_tkh=`(cd ${with_tkinclude}; pwd)`
+ ac_cv_c_tkh=`(cd ${with_tkinclude}; ${PWDCMD-pwd})`
elif test -f ${with_tkinclude}/generic/tk.h ; then
- ac_cv_c_tkh=`(cd ${with_tkinclude}/generic; pwd)`
+ ac_cv_c_tkh=`(cd ${with_tkinclude}/generic; ${PWDCMD-pwd})`
else
AC_MSG_ERROR([${with_tkinclude} directory doesn't contain headers])
fi
@@ -1109,7 +1109,7 @@ dnl next check if it came with Tk configuration file
if test x"${ac_cv_c_tkconfig}" != x ; then
for i in $dirlist; do
if test -f $ac_cv_c_tkconfig/$i/generic/tk.h ; then
- ac_cv_c_tkh=`(cd $ac_cv_c_tkconfig/$i/generic; pwd)`
+ ac_cv_c_tkh=`(cd $ac_cv_c_tkconfig/$i/generic; ${PWDCMD-pwd})`
break
fi
done
@@ -1130,7 +1130,7 @@ if test x"${ac_cv_c_tkh}" = x ; then
dnl might be multiple version of Tk, and we want the most recent one.
for i in `ls -dr $tkpath/tk* 2>/dev/null ` ; do
if test -f $i/generic/tk.h ; then
- ac_cv_c_tkh=`(cd $i/generic; pwd)`
+ ac_cv_c_tkh=`(cd $i/generic; ${PWDCMD-pwd})`
break
fi
done
@@ -1183,7 +1183,7 @@ if test x"${no_tk}" = x ; then
dnl First check to see if --with-tkconfig was specified.
if test x"${with_tkconfig}" != x ; then
if test -f "${with_tkconfig}/tkConfig.sh" ; then
- ac_cv_c_tkconfig=`(cd ${with_tkconfig}; pwd)`
+ ac_cv_c_tkconfig=`(cd ${with_tkconfig}; ${PWDCMD-pwd})`
else
AC_MSG_ERROR([${with_tkconfig} directory doesn't contain tkConfig.sh])
fi
@@ -1196,11 +1196,11 @@ if test x"${no_tk}" = x ; then
dnl cygwin's tkConfig.sh could be in either directory depending
dnl on the cygwin port of tk.
if test -f $srcdir/$i/unix/tkConfig.sh ; then
- ac_cv_c_tkconfig=`(cd $srcdir/$i/unix; pwd)`
+ ac_cv_c_tkconfig=`(cd $srcdir/$i/unix; ${PWDCMD-pwd})`
break
fi
if test -f $srcdir/$i/win/tkConfig.sh ; then
- ac_cv_c_tkconfig=`(cd $srcdir/$i/unix; pwd)`
+ ac_cv_c_tkconfig=`(cd $srcdir/$i/unix; ${PWDCMD-pwd})`
break
fi
done
@@ -1222,11 +1222,11 @@ if test x"${no_tk}" = x ; then
dnl cygwin's tkConfig.sh could be in either directory depending
dnl on the cygwin port of tk.
if test -f $i/unix/tkConfig.sh ; then
- ac_cv_c_tkconfig=`(cd $i/unix; pwd)`
+ ac_cv_c_tkconfig=`(cd $i/unix; ${PWDCMD-pwd})`
break
fi
if test -f $i/win/tkConfig.sh ; then
- ac_cv_c_tkconfig=`(cd $i/win; pwd)`
+ ac_cv_c_tkconfig=`(cd $i/win; ${PWDCMD-pwd})`
break
fi
done
@@ -1302,9 +1302,9 @@ AC_CACHE_VAL(ac_cv_c_itclh,[
dnl first check to see if --with-itclinclude was specified
if test x"${with_itclinclude}" != x ; then
if test -f ${with_itclinclude}/itcl.h ; then
- ac_cv_c_itclh=`(cd ${with_itclinclude}; pwd)`
+ ac_cv_c_itclh=`(cd ${with_itclinclude}; ${PWDCMD-pwd})`
elif test -f ${with_itclinclude}/src/itcl.h ; then
- ac_cv_c_itclh=`(cd ${with_itclinclude}/src; pwd)`
+ ac_cv_c_itclh=`(cd ${with_itclinclude}/src; ${PWDCMD-pwd})`
else
AC_MSG_ERROR([${with_itclinclude} directory doesn't contain headers])
fi
@@ -1314,7 +1314,7 @@ dnl next check if it came with Itcl configuration file
if test x"${ac_cv_c_itclconfig}" != x ; then
for i in $dirlist; do
if test -f $ac_cv_c_itclconfig/$i/src/itcl.h ; then
- ac_cv_c_itclh=`(cd $ac_cv_c_itclconfig/$i/src; pwd)`
+ ac_cv_c_itclh=`(cd $ac_cv_c_itclconfig/$i/src; ${PWDCMD-pwd})`
break
fi
done
@@ -1335,7 +1335,7 @@ if test x"${ac_cv_c_itclh}" = x ; then
dnl might be multiple version of Itcl, and we want the most recent one.
for i in `ls -dr $itclpath/itcl* 2>/dev/null ` ; do
if test -f $i/src/itcl.h ; then
- ac_cv_c_itclh=`(cd $i/src; pwd)`
+ ac_cv_c_itclh=`(cd $i/src; ${PWDCMD-pwd})`
break
fi
done
@@ -1380,10 +1380,10 @@ if test x"${no_itcl}" = x ; then
dnl First check to see if --with-itcllib was specified.
if test x"${with_itcllib}" != x ; then
if test -f "${with_itcllib}/libitcl$TCL_SHARED_LIB_SUFFIX" ; then
- ac_cv_c_itcllib=`(cd ${with_itcllib}; pwd)`/libitcl$TCL_SHARED_LIB_SUFFIX
+ ac_cv_c_itcllib=`(cd ${with_itcllib}; ${PWDCMD-pwd})`/libitcl$TCL_SHARED_LIB_SUFFIX
else
if test -f "${with_itcllib}/libitcl$TCL_UNSHARED_LIB_SUFFIX"; then
- ac_cv_c_itcllib=`(cd ${with_itcllib}; pwd)`/libitcl$TCL_UNSHARED_LIB_SUFFIX
+ ac_cv_c_itcllib=`(cd ${with_itcllib}; ${PWDCMD-pwd})`/libitcl$TCL_UNSHARED_LIB_SUFFIX
fi
fi
fi
@@ -1399,9 +1399,9 @@ if test x"${no_itcl}" = x ; then
done
dnl Itcl 7.5 and greater puts library in subdir. Look there first.
if test -f "$itclpath/src/libitcl.$TCL_SHLIB_SUFFIX" ; then
- ac_cv_c_itcllib=`(cd $itclpath/src; pwd)`
+ ac_cv_c_itcllib=`(cd $itclpath/src; ${PWDCMD-pwd})`
elif test -f "$itclpath/src/libitcl.a"; then
- ac_cv_c_itcllib=`(cd $itclpath/src; pwd)`
+ ac_cv_c_itcllib=`(cd $itclpath/src; ${PWDCMD-pwd})`
fi
fi
dnl check in a few other private locations
@@ -1415,10 +1415,10 @@ if test x"${no_itcl}" = x ; then
for i in `ls -dr ${itclpath}/itcl* 2>/dev/null` ; do
dnl Itcl 7.5 and greater puts library in subdir. Look there first.
if test -f "$i/src/libitcl$TCL_SHLIB_SUFFIX" ; then
- ac_cv_c_itcllib=`(cd $i/src; pwd)`
+ ac_cv_c_itcllib=`(cd $i/src; ${PWDCMD-pwd})`
break
elif test -f "$i/src/libitcl.a"; then
- ac_cv_c_itcllib=`(cd $i/src; pwd)`
+ ac_cv_c_itcllib=`(cd $i/src; ${PWDCMD-pwd})`
break
fi
done
@@ -1430,9 +1430,9 @@ if test x"${no_itcl}" = x ; then
ccpath=`which ${CC} | sed -e 's:/bin/.*::'`/lib
dnl Itcl 7.5 and greater puts library in subdir. Look there first.
if test -f "${ccpath}/libitcl$TCL_SHLIB_SUFFIX" ; then
- ac_cv_c_itcllib=`(cd ${ccpath}; pwd)`
+ ac_cv_c_itcllib=`(cd ${ccpath}; ${PWDCMD-pwd})`
elif test -f "${ccpath}/libitcl.a"; then
- ac_cv_c_itcllib=`(cd ${ccpath}; pwd)`
+ ac_cv_c_itcllib=`(cd ${ccpath}; ${PWDCMD-pwd})`
fi
fi
])
@@ -1463,9 +1463,9 @@ AC_CACHE_VAL(ac_cv_c_itclsh,[
dnl first check to see if --with-itclinclude was specified
if test x"${with_itclinclude}" != x ; then
if test -f ${with_itclinclude}/itcl_sh ; then
- ac_cv_c_itclsh=`(cd ${with_itclinclude}; pwd)`
+ ac_cv_c_itclsh=`(cd ${with_itclinclude}; ${PWDCMD-pwd})`
elif test -f ${with_itclinclude}/src/itcl_sh ; then
- ac_cv_c_itclsh=`(cd ${with_itclinclude}/src; pwd)`
+ ac_cv_c_itclsh=`(cd ${with_itclinclude}/src; ${PWDCMD-pwd})`
else
AC_MSG_ERROR([${with_itclinclude} directory doesn't contain itcl_sh])
fi
@@ -1486,7 +1486,7 @@ if test x"${ac_cv_c_itclsh}" = x ; then
dnl might be multiple version of Itcl, and we want the most recent one.
for i in `ls -dr $itclpath/itcl* 2>/dev/null ` ; do
if test -f $i/src/itcl_sh ; then
- ac_cv_c_itclsh=`(cd $i/src; pwd)`/itcl_sh
+ ac_cv_c_itclsh=`(cd $i/src; ${PWDCMD-pwd})`/itcl_sh
break
fi
done
@@ -1525,9 +1525,9 @@ AC_CACHE_VAL(ac_cv_c_itclmkidx,[
dnl first check to see if --with-itclinclude was specified
if test x"${with_itclinclude}" != x ; then
if test -f ${with_itclinclude}/itcl_sh ; then
- ac_cv_c_itclmkidx=`(cd ${with_itclinclude}; pwd)`
+ ac_cv_c_itclmkidx=`(cd ${with_itclinclude}; ${PWDCMD-pwd})`
elif test -f ${with_itclinclude}/src/itcl_sh ; then
- ac_cv_c_itclmkidx=`(cd ${with_itclinclude}/src; pwd)`
+ ac_cv_c_itclmkidx=`(cd ${with_itclinclude}/src; ${PWDCMD-pwd})`
else
AC_MSG_ERROR([${with_itclinclude} directory doesn't contain itcl_sh])
fi
@@ -1548,7 +1548,7 @@ if test x"${ac_cv_c_itclmkidx}" = x ; then
dnl might be multiple version of Itcl, and we want the most recent one.
for i in `ls -dr $itclpath/itcl* 2>/dev/null ` ; do
if test -f $i/library/itcl_mkindex.tcl ; then
- ac_cv_c_itclmkidx=`(cd $i/library; pwd)`/itcl_mkindex.tcl
+ ac_cv_c_itclmkidx=`(cd $i/library; ${PWDCMD-pwd})`/itcl_mkindex.tcl
break
fi
done
@@ -1559,7 +1559,7 @@ if test x"${ac_cv_c_itclmkidx}" = x ; then
dnl Itcl 7.5 and greater puts library in subdir. Look there first.
for i in `ls -dr $ccpath/itcl* 2>/dev/null ` ; do
if test -f $i/itcl_mkindex.tcl ; then
- ac_cv_c_itclmkidx=`(cd $i; pwd)`/itcl_mkindex.tcl
+ ac_cv_c_itclmkidx=`(cd $i; ${PWDCMD-pwd})`/itcl_mkindex.tcl
break
fi
done
@@ -1595,9 +1595,9 @@ AC_CACHE_VAL(ac_cv_c_tixh,[
dnl first check to see if --with-tixinclude was specified
if test x"${with_tixinclude}" != x ; then
if test -f ${with_tixinclude}/tix.h ; then
- ac_cv_c_tixh=`(cd ${with_tixinclude}; pwd)`
+ ac_cv_c_tixh=`(cd ${with_tixinclude}; ${PWDCMD-pwd})`
elif test -f ${with_tixinclude}/generic/tix.h ; then
- ac_cv_c_tixh=`(cd ${with_tixinclude}/generic; pwd)`
+ ac_cv_c_tixh=`(cd ${with_tixinclude}/generic; ${PWDCMD-pwd})`
else
AC_MSG_ERROR([${with_tixinclude} directory doesn't contain headers])
fi
@@ -1607,7 +1607,7 @@ dnl next check if it came with Tix configuration file
if test x"${ac_cv_c_tixconfig}" != x ; then
for i in $dirlist; do
if test -f $ac_cv_c_tixconfig/$i/generic/tix.h ; then
- ac_cv_c_tixh=`(cd $ac_cv_c_tixconfig/$i/generic; pwd)`
+ ac_cv_c_tixh=`(cd $ac_cv_c_tixconfig/$i/generic; ${PWDCMD-pwd})`
break
fi
done
@@ -1628,7 +1628,7 @@ if test x"${ac_cv_c_tixh}" = x ; then
dnl might be multiple version of Tix, and we want the most recent one.
for i in `ls -dr $tixpath/tix* 2>/dev/null ` ; do
if test -f $i/generic/tix.h ; then
- ac_cv_c_tixh=`(cd $i/generic; pwd)`
+ ac_cv_c_tixh=`(cd $i/generic; ${PWDCMD-pwd})`
break
fi
done
@@ -1681,7 +1681,7 @@ if test x"${no_tix}" = x ; then
# First check to see if --with-tixconfig was specified.
if test x"${with_tixconfig}" != x ; then
if test -f "${with_tixconfig}/tixConfig.sh" ; then
- ac_cv_c_tixconfig=`(cd ${with_tixconfig}; pwd)`
+ ac_cv_c_tixconfig=`(cd ${with_tixconfig}; ${PWDCMD-pwd})`
else
AC_MSG_ERROR([${with_tixconfig} directory doesn't contain tixConfig.sh])
fi
@@ -1697,7 +1697,7 @@ if test x"${no_tix}" = x ; then
../../../tix \
`ls -dr ../../../tix[[4]]* 2>/dev/null` ; do
if test -f "$i/tixConfig.sh" ; then
- ac_cv_c_tixconfig=`(cd $i; pwd)`
+ ac_cv_c_tixconfig=`(cd $i; ${PWDCMD-pwd})`
break
fi
done
@@ -1706,7 +1706,7 @@ if test x"${no_tix}" = x ; then
if test x"${ac_cv_c_tixconfig}" = x ; then
for i in `ls -d ${prefix}/lib /usr/local/lib 2>/dev/null` ; do
if test -f "$i/tixConfig.sh" ; then
- ac_cv_c_tkconfig=`(cd $i; pwd)`
+ ac_cv_c_tkconfig=`(cd $i; ${PWDCMD-pwd})`
break
fi
done
@@ -1717,7 +1717,7 @@ if test x"${no_tix}" = x ; then
${srcdir}/../tix \
`ls -dr ${srcdir}/../tix[[4-9]]* 2>/dev/null` ; do
if test -f "$i/tixConfig.sh" ; then
- ac_cv_c_tixconfig=`(cd $i; pwd)`
+ ac_cv_c_tixconfig=`(cd $i; ${PWDCMD-pwd})`
break
fi
done
@@ -1764,7 +1764,7 @@ if test x"${no_itcl}" = x ; then
# First check to see if --with-itclconfig was specified.
if test x"${with_itclconfig}" != x ; then
if test -f "${with_itclconfig}/itclConfig.sh" ; then
- ac_cv_c_itclconfig=`(cd ${with_itclconfig}; pwd)`
+ ac_cv_c_itclconfig=`(cd ${with_itclconfig}; ${PWDCMD-pwd})`
else
AC_MSG_ERROR([${with_itclconfig} directory doesn't contain itclConfig.sh])
fi
@@ -1780,7 +1780,7 @@ if test x"${no_itcl}" = x ; then
../../../itcl/itcl \
`ls -dr ../../../itcl/itcl[[3]]* 2>/dev/null` ; do
if test -f "$i/itclConfig.sh" ; then
- ac_cv_c_itclconfig=`(cd $i; pwd)`
+ ac_cv_c_itclconfig=`(cd $i; ${PWDCMD-pwd})`
break
fi
done
@@ -1789,7 +1789,7 @@ if test x"${no_itcl}" = x ; then
if test x"${ac_cv_c_itclconfig}" = x ; then
for i in `ls -d ${prefix}/lib /usr/local/lib 2>/dev/null` ; do
if test -f "$i/itclConfig.sh" ; then
- ac_cv_c_itclconfig=`(cd $i; pwd)`
+ ac_cv_c_itclconfig=`(cd $i; ${PWDCMD-pwd})`
break
fi
done
@@ -1800,7 +1800,7 @@ if test x"${no_itcl}" = x ; then
${srcdir}/../itcl/itcl \
`ls -dr ${srcdir}/../itcl/itcl[[3]]* 2>/dev/null` ; do
if test -f "$i/itcl/itclConfig.sh" ; then
- ac_cv_c_itclconfig=`(cd $i; pwd)`
+ ac_cv_c_itclconfig=`(cd $i; ${PWDCMD-pwd})`
break
fi
done
@@ -1851,7 +1851,7 @@ if test x"${no_itk}" = x ; then
# First check to see if --with-itkconfig was specified.
if test x"${with_itkconfig}" != x ; then
if test -f "${with_itkconfig}/itkConfig.sh" ; then
- ac_cv_c_itkconfig=`(cd ${with_itkconfig}; pwd)`
+ ac_cv_c_itkconfig=`(cd ${with_itkconfig}; ${PWDCMD-pwd})`
else
AC_MSG_ERROR([${with_itkconfig} directory doesn't contain itkConfig.sh])
fi
@@ -1867,7 +1867,7 @@ if test x"${no_itk}" = x ; then
../../../itcl/itk \
`ls -dr ../../../itcl/itk[[3]]* 2>/dev/null` ; do
if test -f "$i/itkConfig.sh" ; then
- ac_cv_c_itkconfig=`(cd $i; pwd)`
+ ac_cv_c_itkconfig=`(cd $i; ${PWDCMD-pwd})`
break
fi
done
@@ -1876,7 +1876,7 @@ if test x"${no_itk}" = x ; then
if test x"${ac_cv_c_itkconfig}" = x ; then
for i in `ls -d ${prefix}/lib /usr/local/lib 2>/dev/null` ; do
if test -f "$i/itcl/itkConfig.sh" ; then
- ac_cv_c_itkconfig=`(cd $i; pwd)`
+ ac_cv_c_itkconfig=`(cd $i; ${PWDCMD-pwd})`
break
fi
done
@@ -1887,7 +1887,7 @@ if test x"${no_itk}" = x ; then
${srcdir}/../itcl/itk \
`ls -dr ${srcdir}/../itcl/itk[[3]]* 2>/dev/null` ; do
if test -f "$i/itkConfig.sh" ; then
- ac_cv_c_itkconfig=`(cd $i; pwd)`
+ ac_cv_c_itkconfig=`(cd $i; ${PWDCMD-pwd})`
break
fi
done
@@ -1934,9 +1934,9 @@ AC_CACHE_VAL(ac_cv_c_libguih,[
dnl first check to see if --with-libguiinclude was specified
if test x"${with_libguiinclude}" != x ; then
if test -f ${with_libguiinclude}/guitcl.h ; then
- ac_cv_c_libguih=`(cd ${with_libguiinclude}; pwd)`
+ ac_cv_c_libguih=`(cd ${with_libguiinclude}; ${PWDCMD-pwd})`
elif test -f ${with_libguiinclude}/src/guitcl.h ; then
- ac_cv_c_libguih=`(cd ${with_libguiinclude}/src; pwd)`
+ ac_cv_c_libguih=`(cd ${with_libguiinclude}/src; ${PWDCMD-pwd})`
else
AC_MSG_ERROR([${with_libguiinclude} directory doesn't contain headers])
fi
@@ -1946,7 +1946,7 @@ dnl next check if it came with Libgui configuration file
if test x"${ac_cv_c_libguiconfig}" != x ; then
for i in $dirlist; do
if test -f $ac_cv_c_libguiconfig/$i/src/guitcl.h ; then
- ac_cv_c_libguih=`(cd $ac_cv_c_libguiconfig/$i/src; pwd)`
+ ac_cv_c_libguih=`(cd $ac_cv_c_libguiconfig/$i/src; ${PWDCMD-pwd})`
break
fi
done
@@ -1967,7 +1967,7 @@ if test x"${ac_cv_c_libguih}" = x ; then
dnl might be multiple version of Libgui, and we want the most recent one.
for i in `ls -dr $libguipath/libgui* 2>/dev/null ` ; do
if test -f $i/src/guitcl.h ; then
- ac_cv_c_libguih=`(cd $i/src; pwd)`
+ ac_cv_c_libguih=`(cd $i/src; ${PWDCMD-pwd})`
break
fi
done
@@ -2004,7 +2004,7 @@ AC_CACHE_VAL(ac_cv_c_libguilib,[
if test x"${ac_cv_c_libguilib}" = x ; then
for i in $dirlist; do
if test -f "$i/libgui/src/Makefile" ; then
- ac_cv_c_libguilib=`(cd $i/libgui/src; pwd)`
+ ac_cv_c_libguilib=`(cd $i/libgui/src; ${PWDCMD-pwd})`
break
fi
done
diff --git a/config/mh-apollo68 b/config/mh-apollo68
index 4b4ffa54b8e..eb102d55010 100644
--- a/config/mh-apollo68
+++ b/config/mh-apollo68
@@ -1,2 +1 @@
-HDEFINES = -DUSG
RANLIB=true
diff --git a/config/mh-dgux b/config/mh-dgux
index 746ffdb2d6c..b55fb2fe0b5 100644
--- a/config/mh-dgux
+++ b/config/mh-dgux
@@ -1,3 +1,2 @@
-HDEFINES=-DHOST_SYS=DGUX_SYS
RANLIB=true
diff --git a/config/mh-dgux386 b/config/mh-dgux386
index f1e533a2e30..2fcd4bf09bb 100644
--- a/config/mh-dgux386
+++ b/config/mh-dgux386
@@ -1,7 +1,3 @@
-# from mh-dgux
-HDEFINES=-DHOST_SYS=DGUX_SYS
-RANLIB = true
-
# from mh-sysv4
RANLIB = true
diff --git a/configure b/configure
index 30446a209db..339b23d3e7e 100755
--- a/configure
+++ b/configure
@@ -3,8 +3,8 @@
### WARNING: this file contains embedded tabs. Do not run untabify on this file.
# Configuration script
-# Copyright (C) 1988, 90, 91, 92, 93, 94, 95, 96, 97, 98, 1999, 2000, 2001
-# Free Software Foundation, Inc.
+# Copyright (C) 1988, 90, 91, 92, 93, 94, 95, 96, 97, 98, 1999, 2000, 2001,
+# 2002 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
@@ -152,13 +152,13 @@ NO_EDIT="This file was generated automatically by configure. Do not edit."
progname=$0
# if PWD already has a value, it is probably wrong.
-if [ -n "$PWD" ]; then PWD=`pwd`; fi
+if [ -n "$PWD" ]; then PWD=`${PWDCMD-pwd}`; fi
case "${progname}" in
/* | [A-Za-z]:[\\/]* ) ;;
*/*) ;;
*)
- PATH=$PATH:${PWD=`pwd`} ; export PATH
+ PATH=$PATH:${PWD=`${PWDCMD-pwd}`} ; export PATH
;;
esac
@@ -526,7 +526,7 @@ fi
configsub=`echo ${progname} | sed 's/configure$/config.sub/'`
moveifchange=`echo ${progname} | sed 's/configure$/move-if-change/'`
## the sed command below emulates the dirname command
-topsrcdir=`cd \`echo ${progname} | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'\`; pwd`
+topsrcdir=`cd \`echo ${progname} | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'\`; ${PWDCMD-pwd}`
# this is a hack. sun4 must always be a valid host alias or this will fail.
@@ -566,8 +566,8 @@ case "${srcdir}" in
echo "Invalid source directory ${srcdir}" >&2
exit 1
fi
- pwd=`pwd`
- srcpwd=`cd ${srcdir} ; pwd`
+ pwd=`${PWDCMD-pwd}`
+ srcpwd=`cd ${srcdir} ; ${PWDCMD-pwd}`
if [ "${pwd}" = "${srcpwd}" ] ; then
srcdir=.
fi
@@ -579,7 +579,7 @@ case "${srcdir}" in
".") ;;
*)
if [ -f ${srcdir}/config.status ] ; then
- echo '***' Cannot configure here in \"${PWD=`pwd`}\" when \"${srcdir}\" is currently configured. 1>&2
+ echo '***' Cannot configure here in \"${PWD=`${PWDCMD-pwd}`}\" when \"${srcdir}\" is currently configured. 1>&2
exit 1
fi
esac
@@ -708,7 +708,7 @@ fi
# some sanity checks on configure.in
case "${srctrigger}" in
"")
- echo '***' srctrigger not set in ${PWD=`pwd`}/configure.in. 1>&2
+ echo '***' srctrigger not set in ${PWD=`${PWDCMD-pwd}`}/configure.in. 1>&2
exit 1
;;
*) ;;
@@ -778,8 +778,8 @@ esac
if [ ! -r ${srcdir}/${srctrigger} ] ; then
case "${srcdirdefaulted}" in
- "") echo '***' "${progname}: Can't find ${srcname} sources in ${PWD=`pwd`}/${srcdir}" 1>&2 ;;
- *) echo '***' "${progname}: Can't find ${srcname} sources in ${PWD=`pwd`}/. or ${PWD=`pwd`}/.." 1>&2 ;;
+ "") echo '***' "${progname}: Can't find ${srcname} sources in ${PWD=`${PWDCMD-pwd}`}/${srcdir}" 1>&2 ;;
+ *) echo '***' "${progname}: Can't find ${srcname} sources in ${PWD=`${PWDCMD-pwd}`}/. or ${PWD=`${PWDCMD-pwd}`}/.." 1>&2 ;;
esac
echo '***' \(At least ${srctrigger} is missing.\) 1>&2
@@ -917,8 +917,8 @@ if [ "${build}" != "${host}" ]; then
tools="AR AR_FOR_TARGET AS AS_FOR_TARGET BISON CC_FOR_BUILD"
tools="${tools} CC_FOR_TARGET CXX_FOR_TARGET GCJ_FOR_TARGET"
- tools="${tools} DLLTOOL DLLTOOL_FOR_TARGET GCC_FOR_TARGET HOST_PREFIX"
- tools="${tools} HOST_PREFIX_1 LD LD_FOR_TARGET LEX MAKEINFO NM"
+ tools="${tools} DLLTOOL DLLTOOL_FOR_TARGET GCC_FOR_TARGET BUILD_PREFIX"
+ tools="${tools} BUILD_PREFIX_1 LD LD_FOR_TARGET LEX MAKEINFO NM"
tools="${tools} NM_FOR_TARGET RANLIB RANLIB_FOR_TARGET"
tools="${tools} WINDRES WINDRES_FOR_TARGET YACC"
tools="${tools} OBJCOPY OBJDUMP"
@@ -955,8 +955,8 @@ t loop
DLLTOOL=${DLLTOOL-${host_alias}-dlltool}
DLLTOOL_FOR_TARGET=${DLLTOOL_FOR_TARGET-${target_alias}-dlltool}
GCC_FOR_TARGET=${GCC_FOR_TARGET-${CC_FOR_TARGET-${target_alias}-gcc}}
- HOST_PREFIX=${build_alias}-
- HOST_PREFIX_1=${build_alias}-
+ BUILD_PREFIX=${build_alias}-
+ BUILD_PREFIX_1=${build_alias}-
LD=${LD-${host_alias}-ld}
LD_FOR_TARGET=${LD_FOR_TARGET-${target_alias}-ld}
MAKEINFO=${MAKEINFO-makeinfo}
@@ -1072,22 +1072,6 @@ export CXX
export CFLAGS
export CXXFLAGS
-# FIXME: This should be in configure.in, not configure
-case "$host" in
- *go32*)
- enable_gdbtk=no ;;
- *msdosdjgpp*)
- enable_gdbtk=no ;;
-esac
-
-# FIXME: This should be in configure.in, not configure
-# Determine whether gdb needs tk/tcl or not.
-if [ "$enable_gdbtk" != "no" ]; then
- GDB_TK="all-tcl all-tk all-itcl all-tix all-libgui"
-else
- GDB_TK=""
-fi
-
all_build_modules=
if test x"${build_alias}" != x"${host_alias}"
then
@@ -1124,7 +1108,7 @@ for subdir in . ${subdirs} ; do
if mkdir ${subdir} ; then
true
else
- echo '***' "${progname}: could not make ${PWD=`pwd`}/${subdir}" 1>&2
+ echo '***' "${progname}: could not make ${PWD=`${PWDCMD-pwd}`}/${subdir}" 1>&2
exit 1
fi
fi
@@ -1223,7 +1207,7 @@ EOF
sed -e "/^####/ r ${package_makefile_rules_frag}" ${srcdir}/${subdir}/${Makefile_in} > ${Makefile}.tem
else
echo '***' Expected package makefile rules fragment \"${package_makefile_rules_frag}\" 1>&2
- echo '***' is missing in ${PWD=`pwd`}. 1>&2
+ echo '***' is missing in ${PWD=`${PWDCMD-pwd}`}. 1>&2
cp ${srcdir}/${subdir}/${Makefile_in} ${subdir}/Makefile.tem
fi
esac
@@ -1259,7 +1243,7 @@ EOF
sed -e "/^####/ r ${host_makefile_frag}" ${Makefile} > ${subdir}/Makefile.tem
else
echo '***' Expected host makefile fragment \"${host_makefile_frag}\" 1>&2
- echo '***' is missing in ${PWD=`pwd`}. 1>&2
+ echo '***' is missing in ${PWD=`${PWDCMD-pwd}`}. 1>&2
mv ${Makefile} ${subdir}/Makefile.tem
fi
esac
@@ -1295,7 +1279,7 @@ EOF
sed -e "/^####/ r ${package_makefile_frag}" ${Makefile} > ${subdir}/Makefile.tem
else
echo '***' Expected package makefile fragment \"${package_makefile_rules_frag}\" 1>&2
- echo '***' is missing in ${PWD=`pwd`}. 1>&2
+ echo '***' is missing in ${PWD=`${PWDCMD-pwd}`}. 1>&2
mv ${Makefile} ${subdir}/Makefile.tem
fi
esac
@@ -1481,7 +1465,7 @@ EOF
newusing=`echo "${using}" | sed 's/and/using/'`
using=${newusing}
- echo "Created \"${Makefile}\" in" ${PWD=`pwd`} ${using}
+ echo "Created \"${Makefile}\" in" ${PWD=`${PWDCMD-pwd}`} ${using}
. ${tmpfile}.pos
@@ -1547,14 +1531,14 @@ if [ -z "${norecursion}" ] && [ -n "${configdirs}" ] ; then
if mkdir ./${bld_dir} ; then
true
else
- echo '***' "${progname}: could not make ${PWD=`pwd`}/${bld_dir}" 1>&2
+ echo '***' "${progname}: could not make ${PWD=`${PWDCMD-pwd}`}/${bld_dir}" 1>&2
exit 1
fi
fi
;;
esac
- POPDIR=${PWD=`pwd`}
+ POPDIR=${PWD=`${PWDCMD-pwd}`}
cd ${bld_dir}
### figure out what to do with srcdir
@@ -1602,7 +1586,7 @@ if [ -z "${norecursion}" ] && [ -n "${configdirs}" ] ; then
${srcdiroption} ${diroptions} ${program_prefixoption} ${program_suffixoption} ${program_transform_nameoption} ${site_option} ${withoptions} ${withoutoptions} ${enableoptions} ${disableoptions} ${floating_pointoption} ${cache_file_option} ${removing} ${other_options} ${redirect} ; then
true
else
- echo Configure in `pwd` failed, exiting. 1>&2
+ echo Configure in `${PWDCMD-pwd}` failed, exiting. 1>&2
exit 1
fi
fi
diff --git a/configure.in b/configure.in
index 2569cc2ecfc..5962337875f 100644
--- a/configure.in
+++ b/configure.in
@@ -42,7 +42,7 @@
# these libraries are used by various programs built for the host environment
#
-host_libs="intl mmalloc libiberty opcodes bfd readline db tcl tk tcl8.1 tk8.1 tclX itcl tix libgui zlib"
+host_libs="intl mmalloc libiberty opcodes bfd readline db tcl tk tclX itcl tix libgui zlib"
libstdcxx_version="target-libstdc++-v3"
# Don't use libstdc++-v3's flags to configure/build itself.
@@ -51,7 +51,7 @@ libstdcxx_flags='`case $$dir in libstdc++-v3 | libjava) ;; *) test ! -f $$r/$(TA
# these tools are built for the host environment
# Note, the powerpc-eabi build depends on sim occurring before gdb in order to
# know that we are building the simulator.
-host_tools="texinfo byacc flex bison binutils ld gas gcc cgen sid sim gdb make patch prms send-pr gprof gdbtest tgas etc expect dejagnu ash bash bzip2 m4 autoconf automake libtool ispell grep diff rcs cvssrc fileutils shellutils time textutils wdiff find emacs emacs19 uudecode hello tar gzip indent recode release sed utils guile perl apache inet gawk findutils snavigator libtool gettext zip fastjar"
+host_tools="texinfo byacc flex bison binutils ld gas gcc cgen sid sim gdb make patch prms send-pr gprof gdbtest tgas etc expect dejagnu ash bash bzip2 m4 autoconf automake libtool ispell grep diff rcs cvssrc fileutils shellutils time textutils wdiff find uudecode hello tar gzip indent recode release sed utils guile perl apache inet gawk findutils snavigator libtool gettext zip fastjar"
# libgcj represents the runtime libraries only used by gcj.
libgcj="target-libffi \
@@ -93,7 +93,7 @@ target_tools="target-examples target-groff target-gperf"
#
# This must be a single line because of the way it is searched by grep in
# the code below.
-native_only="autoconf automake libtool cvssrc emacs emacs19 fileutils find gawk gettext grep gzip hello indent ispell m4 rcs recode sed shellutils tar textutils uudecode wdiff gprof target-groff guile perl apache inet time ash bash bzip2 prms snavigator gnuserv target-gperf"
+native_only="autoconf automake libtool cvssrc fileutils find gawk gettext grep gzip hello indent ispell m4 rcs recode sed shellutils tar textutils uudecode wdiff gprof target-groff guile perl apache inet time ash bash bzip2 prms snavigator gnuserv target-gperf"
# directories to be built in a cross environment only
#
@@ -125,11 +125,11 @@ case "${host}" in
m68k-hp-hpux*)
# Avoid "too much defining" errors from HPUX compiler.
tentative_cc="cc -Wp,-H256000"
- host_makefile_frag="${host_makefile_frag} config/mh-hp300"
+ host_makefile_frag="config/mh-hp300"
;;
m68k-apollo-sysv*)
tentative_cc="cc -A ansi -A runtype,any -A systype,any -U__STDC__ -DUSG"
- host_makefile_frag="${host_makefile_frag} config/mh-apollo68"
+ host_makefile_frag="config/mh-apollo68"
;;
m68k-apollo-bsd*)
#None of the Apollo compilers can compile gas or binutils. The preprocessor
@@ -139,34 +139,34 @@ case "${host}" in
# or whatever), but I'm not sure leaving CC as cc is any better...
#CC=cc -A ansi -A runtype,any -A systype,any -U__STDC__ -DNO_STDARG
tentative_cc=gcc
- host_makefile_frag="${host_makefile_frag} config/mh-a68bsd"
+ host_makefile_frag="config/mh-a68bsd"
;;
m88k-dg-dgux*)
tentative_cc="gcc -Wall -ansi -D__using_DGUX"
- host_makefile_frag="${host_makefile_frag} config/mh-dgux"
+ host_makefile_frag="config/mh-dgux"
;;
m88k-harris-cxux*)
# Under CX/UX, we want to tell the compiler to use ANSI mode.
tentative_cc="cc -Xa"
- host_makefile_frag="${host_makefile_frag} config/mh-cxux"
+ host_makefile_frag="config/mh-cxux"
;;
m88k-motorola-sysv*)
- host_makefile_frag="${host_makefile_frag} config/mh-delta88"
+ host_makefile_frag="config/mh-delta88"
;;
mips*-dec-ultrix*)
tentative_cc="cc -Wf,-XNg1000"
- host_makefile_frag="${host_makefile_frag} config/mh-decstation"
+ host_makefile_frag="config/mh-decstation"
;;
mips*-nec-sysv4*)
# The C compiler on NEC MIPS SVR4 needs bigger tables.
tentative_cc="cc -ZXNd=5000 -ZXNg=1000"
- host_makefile_frag="${host_makefile_frag} config/mh-necv4"
+ host_makefile_frag="config/mh-necv4"
;;
mips*-sgi-irix6*)
- host_makefile_frag="${host_makefile_frag} config/mh-irix6"
+ host_makefile_frag="config/mh-irix6"
;;
mips*-sgi-irix5*)
- host_makefile_frag="${host_makefile_frag} config/mh-irix5"
+ host_makefile_frag="config/mh-irix5"
;;
mips*-sgi-irix4*)
# Tell compiler to use K&R C. We can't compile under the SGI Ansi
@@ -175,10 +175,10 @@ case "${host}" in
tentative_cc="cc -cckr -Wf,-XNg1500 -Wf,-XNk1000 -Wf,-XNh2000 -Wf,-XNl8192"
;;
mips*-sgi-irix3*)
- host_makefile_frag="${host_makefile_frag} config/mh-sysv"
+ host_makefile_frag="config/mh-sysv"
;;
mips*-*-sysv4*)
- host_makefile_frag="${host_makefile_frag} config/mh-sysv4"
+ host_makefile_frag="config/mh-sysv4"
;;
mips*-*-sysv*)
# This is for a MIPS running RISC/os 4.52C.
@@ -194,24 +194,24 @@ case "${host}" in
# This is not part of CFLAGS because perhaps not all C compilers have this
# option.
tentative_cc="cc -systype sysv"
- host_makefile_frag="${host_makefile_frag} config/mh-riscos"
+ host_makefile_frag="config/mh-riscos"
;;
i370-ibm-opened*)
tentative_cc="c89"
- host_makefile_frag="${host_makefile_frag} config/mh-openedition"
+ host_makefile_frag="config/mh-openedition"
;;
i[3456]86-*-sysv5*)
- host_makefile_frag="${host_makefile_frag} config/mh-sysv5"
+ host_makefile_frag="config/mh-sysv5"
;;
i[3456]86-*-dgux*)
tentative_cc="gcc -Wall -ansi -D__using_DGUX"
- host_makefile_frag="${host_makefile_frag} config/mh-dgux386"
+ host_makefile_frag="config/mh-dgux386"
;;
i[3456]86-ncr-sysv4.3*)
# The MetaWare compiler will generate a copyright message unless you
# turn it off by adding the -Hnocopyr flag.
tentative_cc="cc -Hnocopyr"
- host_makefile_frag="${host_makefile_frag} config/mh-ncrsvr43"
+ host_makefile_frag="config/mh-ncrsvr43"
;;
i[3456]86-ncr-sysv4*)
# for an NCR 3000 (i486/SVR4) system.
@@ -220,47 +220,47 @@ case "${host}" in
# you run it, but it chokes and dies on a whole bunch of GNU source
# files. Default to using the AT&T compiler installed in /usr/ccs/ATT/cc.
tentative_cc="/usr/ccs/ATT/cc"
- host_makefile_frag="${host_makefile_frag} config/mh-ncr3000"
+ host_makefile_frag="config/mh-ncr3000"
;;
i[3456]86-*-sco3.2v5*)
- host_makefile_frag="${host_makefile_frag} config/mh-sysv"
+ host_makefile_frag="config/mh-sysv"
;;
i[3456]86-*-sco*)
# The native C compiler botches some simple uses of const. Unfortunately,
# it doesn't defined anything like "__sco__" for us to test for in ansidecl.h.
tentative_cc="cc -Dconst="
- host_makefile_frag="${host_makefile_frag} config/mh-sco"
+ host_makefile_frag="config/mh-sco"
;;
i[3456]86-*-udk*)
- host_makefile_frag="${host_makefile_frag} config/mh-sysv5"
+ host_makefile_frag="config/mh-sysv5"
;;
i[3456]86-*-isc*)
- host_makefile_frag="${host_makefile_frag} config/mh-sysv"
+ host_makefile_frag="config/mh-sysv"
;;
i[3456]86-*-solaris2*)
- host_makefile_frag="${host_makefile_frag} config/mh-sysv4"
+ host_makefile_frag="config/mh-sysv4"
;;
i[3456]86-*-aix*)
- host_makefile_frag="${host_makefile_frag} config/mh-aix386"
+ host_makefile_frag="config/mh-aix386"
;;
i[3456]86-*-msdosdjgpp*)
- host_makefile_frag="${host_makefile_frag} config/mh-djgpp"
+ host_makefile_frag="config/mh-djgpp"
;;
*-cygwin*)
- host_makefile_frag="${host_makefile_frag} config/mh-cygwin"
+ host_makefile_frag="config/mh-cygwin"
;;
*-mingw32*)
- host_makefile_frag="${host_makefile_frag} config/mh-mingw32"
+ host_makefile_frag="config/mh-mingw32"
;;
*-interix*)
- host_makefile_frag="${host_makefile_frag} config/mh-interix"
+ host_makefile_frag="config/mh-interix"
;;
vax-*-ultrix2*)
# The old BSD pcc isn't up to compiling parts of gdb so use gcc
tentative_cc=gcc
;;
*-*-solaris2*)
- host_makefile_frag="${host_makefile_frag} config/mh-solaris"
+ host_makefile_frag="config/mh-solaris"
;;
m68k-sun-sunos*)
# Sun's C compiler needs the -J flag to be able to compile cp-parse.c
@@ -269,30 +269,30 @@ case "${host}" in
;;
*-hp-hpux[78]*)
tentative_cc="cc -Wp,-H256000"
- host_makefile_frag="${host_makefile_frag} config/mh-hpux8"
+ host_makefile_frag="config/mh-hpux8"
;;
*-hp-hpux*)
tentative_cc="cc -Wp,-H256000"
- host_makefile_frag="${host_makefile_frag} config/mh-hpux"
+ host_makefile_frag="config/mh-hpux"
;;
*-*-hiux*)
tentative_cc="cc -Wp,-H256000"
- host_makefile_frag="${host_makefile_frag} config/mh-hpux"
+ host_makefile_frag="config/mh-hpux"
;;
rs6000-*-lynxos*)
# /bin/cc is less than useful for our purposes. Always use GCC
tentative_cc="/usr/cygnus/progressive/bin/gcc"
- host_makefile_frag="${host_makefile_frag} config/mh-lynxrs6k"
+ host_makefile_frag="config/mh-lynxrs6k"
;;
*-*-lynxos*)
# /bin/cc is less than useful for our purposes. Always use GCC
tentative_cc="/bin/gcc"
;;
*-*-sysv4*)
- host_makefile_frag="${host_makefile_frag} config/mh-sysv4"
+ host_makefile_frag="config/mh-sysv4"
;;
*-*-sysv*)
- host_makefile_frag="${host_makefile_frag} config/mh-sysv"
+ host_makefile_frag="config/mh-sysv"
;;
esac
fi
@@ -446,7 +446,7 @@ target_subdir=${target_alias}
if test ! -d ${target_subdir} ; then
if mkdir ${target_subdir} ; then true
else
- echo "'*** could not make ${PWD=`pwd`}/${target_subdir}" 1>&2
+ echo "'*** could not make ${PWD=`${PWDCMD-pwd}`}/${target_subdir}" 1>&2
exit 1
fi
fi
@@ -457,7 +457,7 @@ if test x"${build_alias}" != x"${host}" ; then
if test ! -d ${build_subdir} ; then
if mkdir ${build_subdir} ; then true
else
- echo "'*** could not make ${PWD=`pwd`}/${build_subdir}" 1>&2
+ echo "'*** could not make ${PWD=`${PWDCMD-pwd}`}/${build_subdir}" 1>&2
exit 1
fi
fi
@@ -654,10 +654,10 @@ case "${target}" in
noconfigdirs="$noconfigdirs target-newlib target-libgloss ${libgcj}"
;;
alpha*-dec-osf*)
- # ld works, but does not support shared libraries. emacs doesn't
- # work. newlib is not 64 bit ready. I'm not sure about fileutils.
+ # ld works, but does not support shared libraries.
+ # newlib is not 64 bit ready. I'm not sure about fileutils.
# gas doesn't generate exception information.
- noconfigdirs="$noconfigdirs gas ld emacs fileutils target-newlib target-libgloss"
+ noconfigdirs="$noconfigdirs gas ld fileutils target-newlib target-libgloss"
;;
alpha*-*-*vms*)
noconfigdirs="$noconfigdirs gdb ld target-newlib target-libgloss ${libgcj}"
@@ -731,6 +731,9 @@ case "${target}" in
arm-*-riscix*)
noconfigdirs="$noconfigdirs ld target-libgloss ${libgcj}"
;;
+ avr-*-*)
+ noconfigdirs="$noconfigdirs target-libiberty ${libstdcxx_version} ${libgcj}"
+ ;;
c4x-*-*)
noconfigdirs="$noconfigdirs ${libstdcxx_version} target-librx target-libgloss ${libgcj}"
;;
@@ -772,13 +775,6 @@ case "${target}" in
# Do configure ld/binutils/gas for this case.
;;
hppa*-*-*)
- # HP's C compiler doesn't handle Emacs correctly (but on BSD and Mach
- # cc is gcc, and on any system a user should be able to link cc to
- # whatever they want. FIXME, emacs emacs19).
- case "${CC}" in
- "" | cc*) noconfigdirs="$noconfigdirs emacs emacs19" ;;
- *) ;;
- esac
# According to Alexandre Oliva <aoliva@redhat.com>, libjava won't
# build on HP-UX 10.20.
noconfigdirs="$noconfigdirs ld shellutils ${libgcj}"
@@ -864,13 +860,7 @@ case "${target}" in
noconfigdirs="$noconfigdirs target-libgloss"
;;
i[3456]86-*-sysv4*)
- # The SYSV4 C compiler doesn't handle Emacs correctly
- case "${CC}" in
- "" | cc*) noconfigdirs="$noconfigdirs emacs emacs19" ;;
- *) ;;
- esac
- # but that's okay since emacs doesn't work anyway
- noconfigdirs="$noconfigdirs emacs emacs19 target-libgloss ${libgcj}"
+ noconfigdirs="$noconfigdirs target-libgloss ${libgcj}"
;;
i[3456]86-*-beos*)
noconfigdirs="$noconfigdirs gdb target-newlib target-libgloss ${libgcj}"
@@ -950,17 +940,15 @@ case "${target}" in
;;
mips*-*-irix5*)
# The GNU linker does not support shared libraries.
- # emacs is emacs 18, which does not work on Irix 5 (emacs19 does work)
- noconfigdirs="$noconfigdirs ld gprof emacs target-libgloss ${libgcj}"
+ noconfigdirs="$noconfigdirs ld gprof target-libgloss ${libgcj}"
;;
mips*-*-irix6*)
# The GNU assembler does not support IRIX 6.
- # emacs is emacs 18, which does not work on Irix 5 (emacs19 does work)
# Linking libjava exceeds command-line length limits on at least
# IRIX 6.2, but not on IRIX 6.5.
# Also, boehm-gc won't build on IRIX 6.5, according to Jeffrey Oldham
# <oldham@codesourcery.com>
- noconfigdirs="$noconfigdirs gas gprof emacs target-libgloss ${libgcj}"
+ noconfigdirs="$noconfigdirs gas gprof target-libgloss ${libgcj}"
;;
mips*-dec-bsd*)
noconfigdirs="$noconfigdirs gprof target-libgloss ${libgcj}"
@@ -1319,6 +1307,18 @@ if test -n "${target_makefile_frag}" ; then
target_makefile_frag=mt-frag
fi
+case "$host" in
+ *msdosdjgpp*)
+ enable_gdbtk=no ;;
+esac
+# Determine whether gdb needs tk/tcl or not.
+case "$enable_gdbtk" in
+ no)
+ GDB_TK="" ;;
+ *)
+ GDB_TK="all-tcl all-tk all-itcl all-tix all-libgui" ;;
+esac
+
# post-target:
# Make sure that the compiler is able to generate an executable. If it
@@ -1389,12 +1389,12 @@ if test "${shared}" = "yes" ; then
esac
fi
-# Record target_configdirs and the configure arguments for target and
-# build configuration in Makefile.
-target_configdirs=`echo "${target_configdirs}" | sed -e 's/target-//g'`
-targargs=`echo "${arguments}" | \
+# Base args. Strip norecursion, cache-file, srcdir, host, build, target.
+# These are the ones we might not want to pass down to subconfigures.
+baseargs=`echo "${arguments}" | \
sed -e 's/--no[^ ]*//' \
-e 's/--cache[a-z-]*=[^ ]*//' \
+ -e 's/--sr[a-z-]*=[^ ]*//' \
-e 's/--ho[a-z-]*=[^ ]*//' \
-e 's/--bu[a-z-]*=[^ ]*//' \
-e 's/--ta[a-z-]*=[^ ]*//'`
@@ -1402,7 +1402,12 @@ targargs=`echo "${arguments}" | \
# For the build-side libraries, we just need to pretend we're native,
# and not use the same cache file. Multilibs are neither needed nor
# desired.
-buildargs="--cache-file=../config.cache --build=${build_alias} --host=${build_alias} ${targargs}"
+buildargs="--cache-file=../config.cache --build=${build_alias} --host=${build_alias} ${baseargs}"
+
+# Record target_configdirs and the configure arguments for target and
+# build configuration in Makefile.
+target_configdirs=`echo "${target_configdirs}" | sed -e 's/target-//g'`
+targargs=${baseargs}
# Passing a --with-cross-host argument lets the target libraries know
# whether they are being built with a cross-compiler or being built
diff --git a/etc/ChangeLog b/etc/ChangeLog
index 6b13bfdb6c1..debe735ca99 100644
--- a/etc/ChangeLog
+++ b/etc/ChangeLog
@@ -1,3 +1,31 @@
+2002-06-11 Nick Clifton <nickc@cambridge.redhat.com>
+
+ Import the following patches from the FSF GCC sources:
+ 2002-03-25 Zack Weinberg <zack@codesourcery.com>
+
+ * texi2pod.pl: Handle @end ftable and @end vtable.
+
+ 2001-12-12 Matthias Klose <doko@debian.org>
+
+ * texi2pod.pl: Merge changes from binutils' texi2pod.pl. Allows
+ generation of more than one man page from one source.
+ Add '-' to set of valid chars for an identifier.
+ Let -D option accept flags of the form <flag>=<value>.
+ Use \s+ for whitespace detection in '@c man' lines.
+ Handle @set and @clear independent of $output.
+ Substitute all @value{}'s in a line.
+
+ 2001-11-14 Joseph S. Myers <jsm28@cam.ac.uk>
+
+ * texi2pod.pl: Handle @ifnottex, @iftex and @display. Handle @var
+ in verbatim blocks specially. Handle @unnumbered, @unnumberedsec
+ and @center. Allow [a-z] after @enumerate. Handle 0 and numbers
+ greater than 9 in enumerations.
+
+ 2001-07-03 Joseph S. Myers <jsm28@cam.ac.uk>
+
+ * texi2pod.pl: Handle @r inside @item.
+
2002-02-27 Andrew Cagney <ac131313@redhat.com>
* fdl.texi: New file.
@@ -19,7 +47,7 @@
* add-log.el, add-log.vi: New files.
-Wed Jan 20 01:33:50 1999 Angela Marie Thomas (angela@cygnus.com)
+1999-01-20 Angela Marie Thomas (angela@cygnus.com)
* comp-tools-verify: Remove some checks that are no longer valid.
@@ -27,16 +55,16 @@ Wed Jan 20 01:33:50 1999 Angela Marie Thomas (angela@cygnus.com)
* targetdoc/fr30.texi: New document.
-Thu Oct 1 21:15:59 1998 Angela Marie Thomas (angela@cygnus.com)
+1998-10-01 Angela Marie Thomas (angela@cygnus.com)
* comp-tools-fix, cross-tools-fix: Replace /usr/include
with ${FIXINCDIR}.
-Tue Aug 11 19:22:11 1998 Doug Evans <devans@canuck.cygnus.com>
+1998-08-11 Doug Evans <devans@canuck.cygnus.com>
* make-rel-sym-tree (version): Update calculation.
-Fri Jun 12 21:34:01 1998 Ian Lance Taylor <ian@cygnus.com>
+1998-06-12 Ian Lance Taylor <ian@cygnus.com>
* configure.texi: Various additions.
* Makefile.in (TEXI2HTML, DVIPS): New variables.
@@ -51,7 +79,7 @@ Fri Jun 12 21:34:01 1998 Ian Lance Taylor <ian@cygnus.com>
* configbuild.ein: New file (EPS version of configbuild.fig).
* configbuild.jin: New file (JPEG version of configbuild.fig).
-Wed Jun 10 14:41:25 1998 Ian Lance Taylor <ian@cygnus.com>
+1998-06-10 Ian Lance Taylor <ian@cygnus.com>
* configure.texi: New file.
* configdev.tin: New file.
diff --git a/etc/texi2pod.pl b/etc/texi2pod.pl
index e6ad9f92d50..bdc20e8118f 100644
--- a/etc/texi2pod.pl
+++ b/etc/texi2pod.pl
@@ -1,6 +1,6 @@
#! /usr/bin/perl -w
-# Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
+# Copyright (C) 1999, 2000, 2001, 200 Free Software Foundation, Inc.
# This file is part of GNU CC.
@@ -30,9 +30,12 @@ $section = "";
@icstack = ();
@endwstack = ();
@skstack = ();
+@instack = ();
$shift = "";
%defs = ();
$fnno = 1;
+$inf = "";
+$ibase = "";
while ($_ = shift) {
if (/^-D(.*)$/) {
@@ -41,15 +44,13 @@ while ($_ = shift) {
} else {
$flag = shift;
}
- $value=$flag;
- $value =~ s,^[a-zA-Z0-9_]+,,;
- $value =~ s,.*=,,;
- $flag =~ s,=.*$,,;
+ $value = "";
+ ($flag, $value) = ($flag =~ /^([^=]+)(?:=(.+))?/);
die "no flag specified for -D\n"
unless $flag ne "";
- #print STDERR "FL = $flag, V = $value\n";
+ die "flags may only contain letters, digits, hyphens, dashes and underscores\n"
+ unless $flag =~ /^[a-zA-Z0-9_-]+$/;
$defs{$flag} = $value;
-
} elsif (/^-/) {
usage();
} else {
@@ -60,14 +61,19 @@ while ($_ = shift) {
}
if (defined $in) {
- open(STDIN, $in) or die "opening \"$in\": $!\n";
+ $inf = gensym();
+ open($inf, "<$in") or die "opening \"$in\": $!\n";
+ $ibase = $1 if $in =~ m|^(.+)/[^/]+$|;
+} else {
+ $inf = \*STDIN;
}
+
if (defined $out) {
open(STDOUT, ">$out") or die "opening \"$out\": $!\n";
}
-while(<STDIN>)
-{
+while(defined $inf) {
+while(<$inf>) {
# Certain commands are discarded without further processing.
/^\@(?:
[a-z]+index # @*index: useful only in complete manual
@@ -75,8 +81,9 @@ while(<STDIN>)
|(?:end\s+)?group # @group .. @end group: ditto
|page # @page: ditto
|node # @node: useful only in .info file
+ |(?:end\s+)?ifnottex # @ifnottex .. @end ifnottex: use contents
)\b/x and next;
-
+
chomp;
# Look for filename and title markers.
@@ -84,7 +91,7 @@ while(<STDIN>)
/^\@settitle\s+([^.]+)/ and $tl = postprocess($1), next;
# Identify a man title but keep only the one we are interested in.
- /^\@c man title ([A-Za-z0-9]+) (.+)/ and do {
+ /^\@c\s+man\s+title\s+([A-Za-z0-9-]+)\s+(.+)/ and do {
if (exists $defs{$1}) {
$fn = $1;
$tl = postprocess($2);
@@ -95,19 +102,30 @@ while(<STDIN>)
# Look for blocks surrounded by @c man begin SECTION ... @c man end.
# This really oughta be @ifman ... @end ifman and the like, but such
# would require rev'ing all other Texinfo translators.
- /^\@c man begin ([A-Z]+) ([A-Za-z0-9]+)/ and do {
+ /^\@c\s+man\s+begin\s+([A-Z]+)\s+([A-Za-z0-9-]+)/ and do {
$output = 1 if exists $defs{$2};
$sect = $1;
next;
};
- /^\@c man begin ([A-Z]+)/ and $sect = $1, $output = 1, next;
- /^\@c man end/ and do {
+ /^\@c\s+man\s+begin\s+([A-Z]+)/ and $sect = $1, $output = 1, next;
+ /^\@c\s+man\s+end/ and do {
$sects{$sect} = "" unless exists $sects{$sect};
$sects{$sect} .= postprocess($section);
$section = "";
$output = 0;
next;
};
+
+ # handle variables
+ /^\@set\s+([a-zA-Z0-9_-]+)\s*(.*)$/ and do {
+ $defs{$1} = $2;
+ next;
+ };
+ /^\@clear\s+([a-zA-Z0-9_-]+)/ and do {
+ delete $defs{$1};
+ next;
+ };
+
next unless $output;
# Discard comments. (Can't do it above, because then we'd never see
@@ -120,20 +138,20 @@ while(<STDIN>)
# Ignore @end foo, where foo is not an operation which may
# cause us to skip, if we are presently skipping.
my $ended = $1;
- next if $skipping && $ended !~ /^(?:ifset|ifclear|ignore|menu)$/;
+ next if $skipping && $ended !~ /^(?:ifset|ifclear|ignore|menu|iftex)$/;
die "\@end $ended without \@$ended at line $.\n" unless defined $endw;
die "\@$endw ended by \@end $ended at line $.\n" unless $ended eq $endw;
$endw = pop @endwstack;
- if ($ended =~ /^(?:ifset|ifclear|ignore|menu)$/) {
+ if ($ended =~ /^(?:ifset|ifclear|ignore|menu|iftex)$/) {
$skipping = pop @skstack;
next;
- } elsif ($ended =~ /^(?:example|smallexample)$/) {
+ } elsif ($ended =~ /^(?:example|smallexample|display)$/) {
$shift = "";
$_ = ""; # need a paragraph break
- } elsif ($ended =~ /^(?:itemize|enumerate|table)$/) {
+ } elsif ($ended =~ /^(?:itemize|enumerate|[fv]?table)$/) {
$_ = "\n=back\n";
$ic = pop @icstack;
} else {
@@ -160,7 +178,7 @@ while(<STDIN>)
next;
};
- /^\@(ignore|menu)\b/ and do {
+ /^\@(ignore|menu|iftex)\b/ and do {
push @endwstack, $endw;
push @skstack, $skipping;
$endw = $1;
@@ -189,6 +207,12 @@ while(<STDIN>)
s/\@\{/&lbrace;/g;
s/\@\}/&rbrace;/g;
s/\@\@/&at;/g;
+
+ # Inside a verbatim block, handle @var specially.
+ if ($shift ne "") {
+ s/\@var\{([^\}]*)\}/<$1>/g;
+ }
+
# POD doesn't interpret E<> inside a verbatim block.
if ($shift eq "") {
s/</&lt;/g;
@@ -199,11 +223,22 @@ while(<STDIN>)
}
# Single line command handlers.
- /^\@set\s+([a-zA-Z0-9_-]+)\s*(.*)$/ and $defs{$1} = $2, next;
- /^\@clear\s+([a-zA-Z0-9_-]+)/ and delete $defs{$1}, next;
- /^\@section\s+(.+)$/ and $_ = "\n=head2 $1\n";
- /^\@subsection\s+(.+)$/ and $_ = "\n=head3 $1\n";
+ /^\@include\s+(.+)$/ and do {
+ push @instack, $inf;
+ $inf = gensym();
+
+ # Try cwd and $ibase.
+ open($inf, "<" . $1)
+ or open($inf, "<" . $ibase . "/" . $1)
+ or die "cannot open $1 or $ibase/$1: $!\n";
+ next;
+ };
+
+ /^\@(?:section|unnumbered|unnumberedsec|center)\s+(.+)$/
+ and $_ = "\n=head2 $1\n";
+ /^\@subsection\s+(.+)$/
+ and $_ = "\n=head3 $1\n";
# Block command handlers:
/^\@itemize\s+(\@[a-z]+|\*|-)/ and do {
@@ -214,7 +249,7 @@ while(<STDIN>)
$endw = "itemize";
};
- /^\@enumerate(?:\s+([A-Z0-9]+))?/ and do {
+ /^\@enumerate(?:\s+([a-zA-Z0-9]+))?/ and do {
push @endwstack, $endw;
push @icstack, $ic;
if (defined $1) {
@@ -226,19 +261,19 @@ while(<STDIN>)
$endw = "enumerate";
};
- /^\@table\s+(\@[a-z]+)/ and do {
+ /^\@([fv]?table)\s+(\@[a-z]+)/ and do {
push @endwstack, $endw;
push @icstack, $ic;
- $ic = $1;
+ $endw = $1;
+ $ic = $2;
$ic =~ s/\@(?:samp|strong|key|gcctabopt|env)/B/;
$ic =~ s/\@(?:code|kbd)/C/;
$ic =~ s/\@(?:dfn|var|emph|cite|i)/I/;
$ic =~ s/\@(?:file)/F/;
$_ = "\n=over 4\n";
- $endw = "table";
};
- /^\@((?:small)?example)/ and do {
+ /^\@((?:small)?example|display)/ and do {
push @endwstack, $endw;
$endw = $1;
$shift = "\t";
@@ -251,12 +286,17 @@ while(<STDIN>)
$_ = "\n=item $ic\&LT;$1\&GT;\n";
} else {
$_ = "\n=item $ic\n";
- $ic =~ y/A-Ya-y1-8/B-Zb-z2-9/;
+ $ic =~ y/A-Ya-y/B-Zb-z/;
+ $ic =~ s/(\d+)/$1 + 1/eg;
}
};
$section .= $shift.$_."\n";
}
+# End of current file.
+close($inf);
+$inf = pop @instack;
+}
die "No filename or title\n" unless defined $fn && defined $tl;
@@ -284,13 +324,15 @@ sub postprocess
local $_ = $_[0];
# @value{foo} is replaced by whatever 'foo' is defined as.
- if (/\@value\{([a-zA-Z0-9_-]+)\}/) {
- if (! exists $defs{$1}) {
- print STDERR "Option $1 not define\n";
+ while (m/(\@value\{([a-zA-Z0-9_-]+)\})/g) {
+ if (! exists $defs{$2}) {
+ print STDERR "Option $2 not defined\n";
+ s/\Q$1\E//;
+ } else {
+ $value = $defs{$2};
+ s/\Q$1\E/$value/;
}
-
}
- s/\@value\{([a-zA-Z0-9_-]+)\}/$defs{$1}/g;
# Formatting commands.
# Temporary escape for @r.
@@ -303,9 +345,6 @@ sub postprocess
s/\@w\{([^\}]*)\}/S<$1>/g;
s/\@(?:dmn|math)\{([^\}]*)\}/$1/g;
- # Handle @r inside bold.
- 1 while s/B<((?:[^<>]|I<[^<>]*>)*)R<([^>]*)>/B<$1>${2}B</g;
-
# Cross references are thrown away, as are @noindent and @refill.
# (@noindent is impossible in .pod, and @refill is unnecessary.)
# @* is also impossible in .pod; we discard it and any newline that
@@ -327,9 +366,11 @@ sub postprocess
s/\@uref\{([^\},]*),([^\},]*),([^\},]*)\}/$3/g;
# Turn B<blah I<blah> blah> into B<blah> I<blah> B<blah> to
- # match Texinfo semantics of @emph inside @samp.
+ # match Texinfo semantics of @emph inside @samp. Also handle @r
+ # inside bold.
s/&LT;/</g;
s/&GT;/>/g;
+ 1 while s/B<((?:[^<>]|I<[^<>]*>)*)R<([^>]*)>/B<$1>${2}B</g;
1 while (s/B<([^<>]*)I<([^>]+)>/B<$1>I<$2>B</g);
1 while (s/I<([^<>]*)B<([^>]+)>/I<$1>B<$2>I</g);
s/[BI]<>//g;
@@ -372,4 +413,15 @@ sub add_footnote
$sects{FOOTNOTES} .= $_[0];
$sects{FOOTNOTES} .= "\n\n";
}
-
+
+# stolen from Symbol.pm
+{
+ my $genseq = 0;
+ sub gensym
+ {
+ my $name = "GEN" . $genseq++;
+ my $ref = \*{$name};
+ delete $::{$name};
+ return $ref;
+ }
+}
diff --git a/gdb/29k-share/udi/udip2soc.c b/gdb/29k-share/udi/udip2soc.c
deleted file mode 100644
index c8af3fee285..00000000000
--- a/gdb/29k-share/udi/udip2soc.c
+++ /dev/null
@@ -1,1250 +0,0 @@
-/* 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. */
-
-static char udip2soc_c[]="@(#)udip2soc.c 2.11 Daniel Mann";
-static char udip2soc_c_AMD[]="@(#)udip2soc.c 2.8, AMD";
-/*
-* This module converts UDI Procedural calls into
-* UDI socket messages for UNIX.
-* It is used by DFE client processes
-********************************************************************** HISTORY
-*/
-/* This is all unneeded on DOS machines. */
-#ifndef __GO32__
-
-#include <stdio.h>
-#include <string.h>
-
-/* Before sys/file.h for Unixware. */
-#include <sys/types.h>
-
-#include <sys/file.h>
-
-/* This used to say sys/fcntl.h, but the only systems I know of that
- require that are old (pre-4.3, at least) BSD systems, which we
- probably don't need to worry about. */
-#include <fcntl.h>
-
-#include <sys/wait.h>
-#include <sys/time.h>
-#include <sys/resource.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#include <signal.h>
-#include <sys/errno.h>
-#include "udiproc.h"
-#include "udisoc.h"
-
-extern int errno;
-extern int sys_nerr;
-extern int udr_errno;
-extern char* getenv();
-
-/* local type decs. and macro defs. not in a .h file ************* MACRO/TYPE
-*/
-#define version_c 0x121 /* DFE-IPC version id */
-#define TRUE -1
-#define FALSE 0
-#define PORT_NUM 7000
-#define MAX_SESSIONS 5 /* maximum DFE-TIP connections */
-#define SOC_BUF_SIZE 4* 1024 /* size of socket comms buffer */
-#define SBUF_SIZE 500 /* size of string buffer */
-#define ERRMSG_SIZE 500 /* size of error message buffer */
-
-typedef struct connection_str /* record of connect session */
-{
- int in_use;
- char connect_id[20]; /* connection identifier */
- char domain_string[20]; /* dommaing for conection */
- char tip_string[30]; /* TIP host name for AF_INET */
- char tip_exe[80]; /* TIP exe name */
- int dfe_sd; /* associated DFE socket */
- int tip_pid; /* pid of TIP process */
- struct sockaddr_in dfe_sockaddr;
- struct sockaddr_in tip_sockaddr_in;
- struct sockaddr tip_sockaddr;
-} connection_t;
-
-typedef struct session_str
-{
- int in_use;
- connection_t* soc_con_p; /* associated connection */
- UDISessionId tip_id; /* associated TIP session ID */
-} session_t;
-
-/* global dec/defs. which are not in a .h file ************* EXPORT DEC/DEFS
-*/
-UDIError dfe_errno;
-char dfe_errmsg[ERRMSG_SIZE];/* error string */
-
-/* local dec/defs. which are not in a .h file *************** LOCAL DEC/DEFS
-*/
-LOCAL connection_t soc_con[MAX_SESSIONS];
-LOCAL session_t session[MAX_SESSIONS];
-LOCAL UDR udr;
-LOCAL UDR* udrs = &udr; /* UDR for current session */
-LOCAL int current; /* int-id for current session */
-LOCAL char sbuf[SBUF_SIZE]; /* String handler buffer */
-LOCAL char config_file[80]; /* path/name for config file */
-
-/***************************************************************** UDI_CONNECT
-* Establish a new FDE to TIP conection. The file "./udi_soc" or
-* "/etc/udi_soc" may be examined to obtain the conection information
-* if the "Config" parameter is not a completd "line entry".
-*
-* NOTE: the Session string must not start whith white-space characters.
-* Format of string is:
-* <session> <domain> <soc_name|host_name> <tip_exe|port> <pass to UDIconnect>
-* soc2cayman AF_INET cayman 7000 <not supported>
-* soc2tip AF_UNIX astring tip.exe ...
-*/
-UDIError
-UDIConnect(Config, Session)
- char *Config; /* in -- identification string */
- UDISessionId *Session; /* out -- session ID */
-{
- UDIInt32 service_id = UDIConnect_c;
- int domain;
- int cnt=0;
- int rcnt, pos, params_pos=0;
- char *tip_main_string;
- char *env_p;
- struct hostent *tip_info_p;
- FILE *fd;
-#if 0
- FILE *f_p;
-#endif
- UDIUInt32 TIPIPCId;
- UDIUInt32 DFEIPCId;
-
-#if 0 /* This is crap. It assumes that udi_soc is executable! */
- sprintf(sbuf, "which udi_soc");
- f_p = popen(sbuf, "r");
- if(f_p)
- { while( (sbuf[cnt++]=getc(f_p)) != EOF);
- sbuf[cnt-2]=0;
- }
- pclose(f_p);
-#endif
-
- for (rcnt=0;
- rcnt < MAX_SESSIONS && session[rcnt].in_use;
- rcnt++);
-
- if (rcnt >= MAX_SESSIONS)
- {
- sprintf(dfe_errmsg, "DFE-ipc ERROR: Too many sessions already open");
- return UDIErrorIPCLimitation;
- }
-
- /* One connection can be multiplexed between several sessions. */
-
- for (cnt=0;
- cnt < MAX_SESSIONS && soc_con[cnt].in_use;
- cnt++);
-
- if (cnt >= MAX_SESSIONS)
- {
- sprintf(dfe_errmsg,
- "DFE-ipc ERROR: Too many connections already open");
- return UDIErrorIPCLimitation;
- }
-
- *Session = rcnt;
- session[rcnt].soc_con_p = &soc_con[cnt];
-
- if (strchr(Config, ' ')) /* test if file entry given */
- {
- soc_con[cnt].in_use = TRUE;
- sscanf(Config, "%s %s %s %s %n",
- soc_con[cnt].connect_id,
- soc_con[cnt].domain_string,
- soc_con[cnt].tip_string,
- soc_con[cnt].tip_exe,
- &params_pos);
- tip_main_string = Config + params_pos;
- }
- else /* here if need to read udi_soc file */
- {
- strcpy(config_file, "udi_soc");
- env_p = getenv("UDICONF");
- if (env_p)
- strcpy(config_file, env_p);
-
- fd = fopen(config_file, "r");
-
- if (!fd)
- {
- sprintf(dfe_errmsg, "UDIConnect, can't open udi_soc file:\n%s ",
- strerror(errno));
- dfe_errno = UDIErrorCantOpenConfigFile;
- goto tip_failure;
- }
-
- while (1)
- {
- if (fscanf(fd, "%s %s %s %s %[^\n]\n",
- soc_con[cnt].connect_id,
- soc_con[cnt].domain_string,
- soc_con[cnt].tip_string,
- soc_con[cnt].tip_exe,
- sbuf) == EOF)
- break;
-
- if (strcmp(Config, soc_con[cnt].connect_id) != 0)
- continue;
-
- soc_con[cnt].in_use = TRUE; /* here if entry found */
-
- tip_main_string = sbuf;
- break;
- }
-
- fclose(fd);
- if (!soc_con[cnt].in_use)
- {
- sprintf(dfe_errmsg,
- "UDIConnect, can't find `%s' entry in udi_soc file",
- Config);
- dfe_errno = UDIErrorNoSuchConfiguration;
- goto tip_failure;
- }
- }
-/*----------------------------------------------------------- SELECT DOMAIN */
- if (strcmp(soc_con[cnt].domain_string, "AF_UNIX") == 0)
- domain = AF_UNIX;
- else if (strcmp(soc_con[cnt].domain_string, "AF_INET") == 0)
- domain = AF_INET;
- else
- {
- sprintf(dfe_errmsg, "DFE-ipc ERROR: socket address family not known");
- dfe_errno = UDIErrorBadConfigFileEntry;
- goto tip_failure;
- }
-
-/*---------------------------------------------------- MULTIPLEXED SOCKET ? */
-/* If the requested session requires communication with
- a TIP which already has a socket connection established,
- then we do not create a new socket but multiplex the
- existing one. A TIP is said to use the same socket if
- socket-name/host-name and the domain are the same.
- */
- for (rcnt=0; rcnt < MAX_SESSIONS; rcnt++)
- {
- if (soc_con[rcnt].in_use
- && rcnt != cnt
- && strcmp(soc_con[cnt].domain_string,
- soc_con[rcnt].domain_string) == 0
- && strcmp(soc_con[cnt].tip_string,
- soc_con[rcnt].tip_string) == 0)
- {
- session[*Session].soc_con_p = &soc_con[rcnt];
- soc_con[cnt].in_use = FALSE; /* don't need new connect */
- goto tip_connect;
- }
- }
-/*------------------------------------------------------------------ SOCKET */
- soc_con[cnt].dfe_sd = socket(domain, SOCK_STREAM, 0);
- if (soc_con[cnt].dfe_sd == -1)
- {
- sprintf(dfe_errmsg, "DFE-ipc ERROR, socket() call failed %s ",
- strerror (errno));
- dfe_errno = UDIErrorUnknownError;
- goto tip_failure;
- }
-
-/*--------------------------------------------------------- AF_UNIX CONNECT */
- if (domain == AF_UNIX)
- {
- if (strcmp(soc_con[cnt].tip_string, "*") == 0)
- {
- for (pos = 0; pos < 20; pos++)
- {
- int f;
-
- sprintf(soc_con[cnt].tip_string,"/tmp/U%d", getpid() + pos);
- f = open(soc_con[cnt].tip_string, O_CREAT);
- if (f == -1)
- continue;
-
- close(f);
- unlink(soc_con[cnt].tip_string);
- break;
- }
-
- if (pos >= 20)
- {
- sprintf(dfe_errmsg,
- "DFE-ipc ERROR, can't create random socket name");
- dfe_errno = UDIErrorCantConnect;
- goto tip_failure;
- }
- }
-
- soc_con[cnt].tip_sockaddr.sa_family = domain;
- memcpy(soc_con[cnt].tip_sockaddr.sa_data,
- soc_con[cnt].tip_string,
- sizeof(soc_con[cnt].tip_sockaddr.sa_data));
- if (connect(soc_con[cnt].dfe_sd,
- &soc_con[cnt].tip_sockaddr,
- sizeof(soc_con[cnt].tip_sockaddr)))
- { /* if connect() fails assume TIP not yet started */
-/*------------------------------------------------------------ AF_UNIX EXEC */
- int pid;
- int statusp;
- char *arg0;
-
- arg0 = strrchr(soc_con[cnt].tip_exe,'/');
-
- if (arg0)
- arg0++;
- else
- arg0 = soc_con[cnt].tip_exe;
-
- pid = vfork();
-
- if (pid == 0) /* Child */
- {
- execlp(soc_con[cnt].tip_exe,
- arg0,
- soc_con[cnt].domain_string,
- soc_con[cnt].tip_string,
- NULL);
- _exit(1);
- }
-
- if (waitpid(pid, &statusp, WNOHANG))
- {
- sprintf(dfe_errmsg, "DFE-ipc ERROR: can't exec the TIP");
- dfe_errno = UDIErrorCantStartTIP;
- goto tip_failure;
- }
-
- pos = 3;
- for (pos = 3; pos > 0; pos--)
- {
- if (!connect(soc_con[cnt].dfe_sd,
- &soc_con[cnt].tip_sockaddr,
- sizeof(soc_con[cnt].tip_sockaddr)))
- break;
- sleep(1);
- }
-
- if (pos == 0)
- {
- sprintf(dfe_errmsg, "DFE-ipc ERROR, connect() call failed: %s",
- strerror (errno));
- dfe_errno = UDIErrorCantConnect;
- goto tip_failure;
- }
- }
- }
-/*--------------------------------------------------------- AF_INET CONNECT */
- else if (domain == AF_INET)
- {
- fprintf(stderr,
- "DFE-ipc WARNING, need to have first started remote TIP");
-
- soc_con[cnt].tip_sockaddr_in.sin_family = domain;
- soc_con[cnt].tip_sockaddr_in.sin_addr.s_addr =
- inet_addr(soc_con[cnt].tip_string);
- if (soc_con[cnt].tip_sockaddr_in.sin_addr.s_addr == -1)
- {
- tip_info_p = gethostbyname(soc_con[cnt].tip_string);
- if (tip_info_p == NULL)
- {
- sprintf(dfe_errmsg,"DFE-ipc ERROR, No such host %s",
- soc_con[cnt].tip_string);
- dfe_errno = UDIErrorNoSuchConnection;
- goto tip_failure;
- }
- memcpy((char *)&soc_con[cnt].tip_sockaddr_in.sin_addr,
- tip_info_p->h_addr,
- tip_info_p->h_length);
- }
- soc_con[cnt].tip_sockaddr_in.sin_port
- = htons(atoi(soc_con[cnt].tip_exe));
-
- if (connect(soc_con[cnt].dfe_sd,
- (struct sockaddr *) &soc_con[cnt].tip_sockaddr_in,
- sizeof(soc_con[cnt].tip_sockaddr_in)))
- {
- sprintf(dfe_errmsg, "DFE-ipc ERROR, connect() call failed %s ",
- strerror (errno));
- dfe_errno = UDIErrorCantConnect;
- goto tip_failure;
- }
- }
-/*------------------------------------------------------------- TIP CONNECT */
- if (cnt == 0) udr_create(udrs, soc_con[cnt].dfe_sd, SOC_BUF_SIZE);
-
-tip_connect:
- current = cnt;
- session[*Session].in_use = TRUE; /* session id is now in use */
-
- udr_errno = 0;
- udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */
- udr_UDIInt32(udrs, &service_id);
-
- DFEIPCId = (company_c << 16) + (product_c << 12) + version_c;
- udr_UDIUInt32(udrs, &DFEIPCId);
-
- udr_string(udrs, tip_main_string);
-
- udr_sendnow(udrs);
-
- udrs->udr_op = UDR_DECODE; /* recv all "out" parameters */
- udr_UDIUInt32(udrs, &TIPIPCId);
- if ((TIPIPCId & 0xfff) < version_c)
- sprintf(dfe_errmsg, "DFE-ipc: Obsolete TIP Specified");
-
- udr_UDIInt32(udrs, &soc_con[cnt].tip_pid);
-
- udr_UDISessionId(udrs, &session[*Session].tip_id);
-
- udr_UDIError(udrs, &dfe_errno);
- if (dfe_errno > 0) UDIKill(*Session, 0);
-
- return dfe_errno;
-
-tip_failure:
-
- soc_con[cnt].in_use = FALSE;
- session[*Session].in_use = FALSE;
-/* XXX - Should also close dfe_sd, but not sure what to do if muxed */
- return dfe_errno;
-}
-
-/************************************************************** UDI_Disconnect
-* UDIDisconnect() should be called before exiting the
-* DFE to ensure proper shut down of the TIP.
-*/
-UDIError UDIDisconnect(Session, Terminate)
-UDISessionId Session;
-UDIBool Terminate;
-{
- int cnt;
- UDIInt32 service_id = UDIDisconnect_c;
- if(Session < 0 || Session > MAX_SESSIONS)
- {
- sprintf(dfe_errmsg," SessionId not valid (%d)", Session);
- return UDIErrorNoSuchConfiguration;
- }
- udr_errno = 0;
- udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */
- udr_UDIInt32(udrs, &service_id);
- udr_UDISessionId(udrs, &session[Session].tip_id);
- udr_UDIBool(udrs, &Terminate);
- udr_sendnow(udrs);
-
- session[Session].in_use = FALSE; /* session id is now free */
- for (cnt=0; cnt < MAX_SESSIONS; cnt++)
- if(session[cnt].in_use
- && session[cnt].soc_con_p == session[Session].soc_con_p
- ) break;
- if(cnt >= MAX_SESSIONS) /* test if socket not multiplexed */
- if(shutdown(session[Session].soc_con_p->dfe_sd, 2))
- {
- sprintf(dfe_errmsg, "DFE-ipc WARNING: socket shutdown failed");
- return UDIErrorIPCInternal;
- }
- else
- session[Session].soc_con_p->in_use = 0;
-
- udrs->udr_op = UDR_DECODE; /* receive all "out" parameters */
- udr_UDIError(udrs, &dfe_errno); /* get any TIP error */
- return dfe_errno;
-}
-
-/******************************************************************** UDI_KILL
-* UDIKill() is used to send a signal to the TIP.
-* This is a private IPC call.
-*/
-UDIError UDIKill(Session, Signal)
-UDISessionId Session;
-UDIInt32 Signal;
-{
- int cnt;
- UDIInt32 service_id = UDIKill_c;
- if(Session < 0 || Session > MAX_SESSIONS)
- {
- sprintf(dfe_errmsg," SessionId not valid (%d)", Session);
- return UDIErrorNoSuchConfiguration;
- }
- udr_errno = 0;
- udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */
- udr_UDIInt32(udrs, &service_id);
- udr_UDISessionId(udrs, &session[Session].tip_id);
- udr_UDIInt32(udrs, &Signal);
- udr_sendnow(udrs);
-
- session[Session].in_use = FALSE; /* session id is now free */
- for (cnt=0; cnt < MAX_SESSIONS; cnt++)
- if(session[cnt].in_use
- && session[cnt].soc_con_p == session[Session].soc_con_p
- ) break;
- if(cnt < MAX_SESSIONS) /* test if socket not multiplexed */
- if(shutdown(session[Session].soc_con_p->dfe_sd, 2))
- {
- sprintf(dfe_errmsg, "DFE-ipc WARNING: socket shutdown failed");
- return UDIErrorIPCInternal;
- }
- else
- session[Session].soc_con_p->in_use = 0;
-
- udrs->udr_op = UDR_DECODE; /* receive all "out" parameters */
- udr_UDIError(udrs, &dfe_errno); /* get any TIP error */
- return dfe_errno;
-}
-
-/************************************************** UDI_Set_Current_Connection
-* If you are connected to multiple TIPs, you can change
-* TIPs using UDISetCurrentConnection().
-*/
-UDIError UDISetCurrentConnection(Session)
-UDISessionId Session;
-{
- UDIInt32 service_id = UDISetCurrentConnection_c;
-
- if(Session < 0 || Session > MAX_SESSIONS)
- return UDIErrorNoSuchConfiguration;
- if(!session[Session].in_use) /* test if not in use yet */
- return UDIErrorNoSuchConnection;
-
- current = Session;
- /* change socket or multiplex the same socket */
- udrs->sd = session[Session].soc_con_p->dfe_sd;
-
- udr_errno = 0;
- udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */
- udr_UDIInt32(udrs, &service_id);
- udr_UDISessionId(udrs, &session[Session].tip_id);
- udr_sendnow(udrs);
- if(udr_errno) return udr_errno;
-
- udrs->udr_op = UDR_DECODE; /* receive all "out" parameters */
- udr_UDIError(udrs, &dfe_errno); /* get any TIP error */
- return dfe_errno;
-}
-
-/************************************************************ UDI_Capabilities
-* The DFE uses UDICapabilities() to both inform the TIP
-* of what services the DFE offers and to inquire of the
-* TIP what services the TIP offers.
-*/
-UDIError UDICapabilities(TIPId, TargetId, DFEId, DFE, TIP, DFEIPCId,
- TIPIPCId, TIPString)
-UDIUInt32 *TIPId; /* out */
-UDIUInt32 *TargetId; /* out */
-UDIUInt32 DFEId; /* in */
-UDIUInt32 DFE; /* in */
-UDIUInt32 *TIP; /* out */
-UDIUInt32 *DFEIPCId; /* out */
-UDIUInt32 *TIPIPCId; /* out */
-char *TIPString; /* out */
-{
- UDIInt32 service_id = UDICapabilities_c;
- int size;
-
- udr_errno = 0;
- udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */
- udr_UDIInt32(udrs, &service_id);
- udr_UDIInt32(udrs, &DFEId);
- udr_UDIInt32(udrs, &DFE);
- udr_sendnow(udrs);
- if(udr_errno) return udr_errno;
-
- udrs->udr_op = UDR_DECODE; /* receive all "out" paramters */
- udr_UDIInt32(udrs, TIPId);
- udr_UDIInt32(udrs, TargetId);
- udr_UDIInt32(udrs, TIP);
- udr_UDIInt32(udrs, DFEIPCId);
- *DFEIPCId = (company_c << 16) + (product_c << 12) + version_c;
- udr_UDIInt32(udrs, TIPIPCId);
- udr_string(udrs, sbuf);
- udr_UDIError(udrs, &dfe_errno); /* get any TIP error */
- size = strlen(sbuf);
- if(size +1 > 80) return -1; /* test if sufficient space */
- strcpy(TIPString, sbuf);
- return dfe_errno;
-}
-
-/********************************************************** UDI_Enumerate_TIPs
-* Used by the DFE to enquire about available TIP
-* connections.
-*/
-UDIError UDIEnumerateTIPs(UDIETCallback)
- int (*UDIETCallback)(); /* In -- function to callback */
-{
- FILE *fp;
-
- fp = fopen(config_file, "r");
- if(fp == NULL)
- return UDIErrorCantOpenConfigFile;
- while(fgets( sbuf, SBUF_SIZE, fp))
- if(UDIETCallback( sbuf) == UDITerminateEnumeration)
- break;
- fclose( fp);
- return UDINoError; /* return success */
-}
-
-/*********************************************************** UDI_GET_ERROR_MSG
-* Some errors are target specific. They are indicated
-* by a negative error return value. The DFE uses
-* UDIGetErrorMsg() to get the descriptive text for
-* the error message which can then be displayed to
-* the user.
-*/
-UDIError UDIGetErrorMsg(error_code, msg_len, msg, CountDone)
-UDIError error_code; /* In */
-UDISizeT msg_len; /* In -- allowed message space */
-char* msg; /* Out -- length of message*/
-UDISizeT *CountDone; /* Out -- number of characters */
-{
- UDIInt32 service_id = UDIGetErrorMsg_c;
- int size;
-
- udr_errno = 0;
- udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */
- udr_UDIInt32(udrs, &service_id);
- udr_UDIError(udrs, &error_code);
- udr_UDISizeT(udrs, &msg_len);
- udr_sendnow(udrs);
- if(udr_errno) return udr_errno;
-
- udrs->udr_op = UDR_DECODE; /* receive all "out" parameters */
- udr_string(udrs, sbuf);
- udr_UDISizeT(udrs, CountDone);
- udr_UDIError(udrs, &dfe_errno); /* get any TIP error */
- size = strlen(sbuf);
- if(size +1 > msg_len) return -1; /* test if sufficient space */
- strcpy(msg, sbuf);
- return dfe_errno;
-}
-
-/******************************************************* UDI_GET_TARGET_CONFIG
-* UDIGetTargetConfig() gets information about the target.
-*/
-UDIError UDIGetTargetConfig(KnownMemory, NumberOfRanges, ChipVersions,
- NumberOfChips)
-UDIMemoryRange KnownMemory[]; /* Out */
-UDIInt *NumberOfRanges; /* In and Out */
-UDIUInt32 ChipVersions[]; /* Out */
-UDIInt *NumberOfChips; /* In and Out */
-{
- UDIInt32 service_id = UDIGetTargetConfig_c;
- int cnt;
- int MaxOfRanges = *NumberOfRanges;
-
- udr_errno = 0;
- udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */
- udr_UDIInt32(udrs, &service_id);
- udr_UDIInt(udrs, NumberOfRanges);
- udr_UDIInt(udrs, NumberOfChips);
- udr_sendnow(udrs);
- if(udr_errno) return udr_errno;
-
- udrs->udr_op = UDR_DECODE; /* receive all "out" paramters */
- for(cnt=1; cnt <= MaxOfRanges; cnt++)
- udr_UDIMemoryRange(udrs, &KnownMemory[cnt-1]);
- udr_UDIInt(udrs, NumberOfRanges);
- udr_UDIInt(udrs, NumberOfChips);
- for(cnt=1; cnt <= *NumberOfChips; cnt++)
- udr_UDIUInt32(udrs, &ChipVersions[cnt -1]);
- udr_UDIError(udrs, &dfe_errno); /* get any TIP error */
- return dfe_errno;
-}
-
-/********************************************************** UDI_CREATE_PRCOESS
-* UDICreateProcess() tells the target OS that a
-* process is to be created and gets a PID back unless
-* there is some error.
-*/
-UDIError UDICreateProcess(pid)
-UDIPId *pid; /* out */
-{
- UDIInt32 service_id = UDICreateProcess_c;
-
- udr_errno = 0;
- udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */
- udr_UDIInt32(udrs, &service_id);
- udr_sendnow(udrs);
- if(udr_errno) return udr_errno;
-
- udrs->udr_op = UDR_DECODE; /* receive all "out" parameters */
- udr_UDIPId(udrs, pid);
- udr_UDIError(udrs, &dfe_errno); /* get any TIP error */
- return dfe_errno;
-}
-
-/***************************************************** UDI_Set_Current_Process
-* UDISetCurrentProcess uses a pid supplied by
-* UDICreateProcess and sets it as the default for all
-* udi calls until a new one is set. A user of a
-*/
-UDIError UDISetCurrentProcess (pid)
-UDIPId pid; /* In */
-{
- UDIInt32 service_id = UDISetCurrentProcess_c;
-
- udr_errno = 0;
- udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */
- udr_UDIInt32(udrs, &service_id);
- udr_UDIPId(udrs, &pid);
- udr_sendnow(udrs);
- if(udr_errno) return udr_errno;
-
- udrs->udr_op = UDR_DECODE; /* receive all "out" parameters */
- udr_UDIError(udrs, &dfe_errno); /* get any TIP error */
- return dfe_errno;
-}
-
-/****************************************************** UDI_INITIALISE_PROCESS
-* UDIInitializeProcess() prepare process for
-* execution. (Reset processor if process os processor).
-*/
-UDIError UDIInitializeProcess( ProcessMemory, NumberOfRanges, EntryPoint,
- StackSizes, NumberOfStacks, ArgString)
-UDIMemoryRange ProcessMemory[]; /* In */
-UDIInt NumberOfRanges; /* In */
-UDIResource EntryPoint; /* In */
-CPUSizeT *StackSizes; /* In */
-UDIInt NumberOfStacks; /* In */
-char *ArgString; /* In */
-{
- UDIInt32 service_id = UDIInitializeProcess_c;
- int cnt;
-
- udr_errno = 0;
- udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */
- udr_UDIInt32(udrs, &service_id);
- udr_UDIInt(udrs, &NumberOfRanges);
- for(cnt = 0; cnt < NumberOfRanges; cnt++)
- udr_UDIMemoryRange(udrs, &ProcessMemory[cnt] );
- udr_UDIResource(udrs, &EntryPoint);
- udr_UDIInt(udrs, &NumberOfStacks);
- for(cnt = 0; cnt < NumberOfStacks; cnt++)
- udr_CPUSizeT(udrs, &StackSizes[cnt]);
- udr_string(udrs, ArgString);
- udr_sendnow(udrs);
- if(udr_errno) return udr_errno;
-
- udrs->udr_op = UDR_DECODE; /* receive all "out" parameters */
- udr_UDIError(udrs, &dfe_errno); /* get any TIP error */
- return dfe_errno;
-}
-
-/********************************************************* UDI_DESTROY_PROCESS
-* UDIDestroyProcess() frees a process resource
-* previously created by UDICreateProcess().
-*/
-UDIError UDIDestroyProcess(pid)
-UDIPId pid; /* in */
-{
- UDIInt32 service_id = UDIDestroyProcess_c;
-
- udr_errno = 0;
- udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */
- udr_UDIInt32(udrs, &service_id);
- udr_UDIPId(udrs, &pid);
- udr_sendnow(udrs);
- if(udr_errno) return udr_errno;
-
- udrs->udr_op = UDR_DECODE; /* receive all "out" parameters */
- udr_UDIError(udrs, &dfe_errno); /* get any TIP error */
- return dfe_errno;
-}
-
-/****************************************************************** UDI_READ
-* UDIRead() reads a block of objects from a target
-* address space to host space.
-*/
-
-UDIError UDIRead (from, to, count, size, count_done, host_endian)
-UDIResource from; /* in - source address on target */
-UDIHostMemPtr to; /* out - destination address on host */
-UDICount count; /* in -- count of objects to be transferred */
-UDISizeT size; /* in -- size of each object */
-UDICount *count_done; /* out - count actually transferred */
-UDIBool host_endian; /* in -- flag for endian information */
-{
- UDIInt32 service_id = UDIRead_c;
- int byte_count;
-
- udr_errno = 0;
- udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */
- udr_UDIInt32(udrs, &service_id);
- udr_UDIResource(udrs, &from);
- udr_UDICount(udrs, &count);
- udr_UDISizeT(udrs, &size);
- udr_UDIBool(udrs, &host_endian);
- udr_sendnow(udrs);
- if(udr_errno) return udr_errno;
-
- udrs->udr_op = UDR_DECODE; /* receive all "out" paramters */
- udr_UDICount(udrs, count_done);
- byte_count = (*count_done) * size;
- if(*count_done > 0 && *count_done <= count)
- udr_bytes(udrs, to, byte_count);
- if(udr_errno) return udr_errno;
- udr_UDIError(udrs, &dfe_errno); /* get any TIP error */
- return dfe_errno;
-}
-
-/****************************************************************** UDI_WRITE
-* UDIWrite() writes a block of objects from host
-* space to a target address+space.
-*/
-UDIError UDIWrite( from, to, count, size, count_done, host_endian )
-UDIHostMemPtr from; /* in -- source address on host */
-UDIResource to; /* in -- destination address on target */
-UDICount count; /* in -- count of objects to be transferred */
-UDISizeT size; /* in -- size of each object */
-UDICount *count_done; /* out - count actually transferred */
-UDIBool host_endian; /* in -- flag for endian information */
-{
- UDIInt32 service_id = UDIWrite_c;
- int byte_count = count * size;
-
- udr_errno = 0;
- udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */
- udr_UDIInt32(udrs, &service_id);
- udr_UDIResource(udrs, &to);
- udr_UDICount(udrs, &count);
- udr_UDISizeT(udrs, &size);
- udr_UDIBool(udrs, &host_endian);
- udr_bytes(udrs, from, byte_count);
- udr_sendnow(udrs);
- if(udr_errno) return udr_errno;
-
- udrs->udr_op = UDR_DECODE; /* receive all "out" paramters */
- udr_UDICount(udrs, count_done);
- udr_UDIError(udrs, &dfe_errno); /* get any TIP error */
- return dfe_errno;
-}
-
-/******************************************************************** UDI_COPY
-* UDICopy() copies a block of objects from one target
-* get address/space to another target address/space.
-*/
-UDIError UDICopy(from, to, count, size, count_done, direction )
-UDIResource from; /* in -- destination address on target */
-UDIResource to; /* in -- source address on target */
-UDICount count; /* in -- count of objects to be transferred */
-UDISizeT size; /* in -- size of each object */
-UDICount *count_done; /* out - count actually transferred */
-UDIBool direction; /* in -- high-to-low or reverse */
-{
- UDIInt32 service_id = UDICopy_c;
-
- udr_errno = 0;
- udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */
- udr_UDIInt32(udrs, &service_id);
- udr_UDIResource(udrs, &from);
- udr_UDIResource(udrs, &to);
- udr_UDICount(udrs, &count);
- udr_UDISizeT(udrs, &size);
- udr_UDIBool(udrs, &direction);
- udr_sendnow(udrs);
- if(udr_errno) return udr_errno;
-
- udrs->udr_op = UDR_DECODE; /* receive all "out" parameters */
- udr_UDICount(udrs, count_done);
- udr_UDIError(udrs, &dfe_errno); /* get any TIP error */
- return dfe_errno;
-}
-
-/***************************************************************** UDI_EXECUTE
-* UDIExecute() continues execution of the default
-* process from the current PC.
-*/
-UDIError UDIExecute()
-{
- UDIInt32 service_id = UDIExecute_c;
-
- udr_errno = 0;
- udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */
- udr_UDIInt32(udrs, &service_id);
- udr_sendnow(udrs);
- if(udr_errno) return udr_errno;
-
- udrs->udr_op = UDR_DECODE; /* receive all "out" parameters */
- udr_UDIError(udrs, &dfe_errno); /* get any TIP error */
- return dfe_errno;
-}
-
-/******************************************************************** UDI_STEP
-* UDIStep() specifies a number of "instruction"
-* steps to make.
-*/
-UDIError UDIStep(steps, steptype, range)
-UDIUInt32 steps; /* in -- number of steps */
-UDIStepType steptype; /* in -- type of stepping to be done */
-UDIRange range; /* in -- range if StepInRange is TRUE */
-{
- UDIInt32 service_id = UDIStep_c;
-
- udr_errno = 0;
- udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */
- udr_UDIInt32(udrs, &service_id);
- udr_UDIInt32(udrs, &steps);
- udr_UDIStepType(udrs, &steptype);
- udr_UDIRange(udrs, &range);
- udr_sendnow(udrs);
- if(udr_errno) return udr_errno;
-
- udrs->udr_op = UDR_DECODE; /* receive all "out" parameters */
- udr_UDIError(udrs, &dfe_errno); /* get any TIP error */
- return dfe_errno;
-}
-
-/******************************************************************** UDI_STOP
-* UDIStop() stops the default process
-*/
-UDIVoid UDIStop()
-{
- if (strcmp(session[current].soc_con_p->domain_string, "AF_UNIX") == 0)
- kill(session[current].soc_con_p->tip_pid, SIGINT);
- else
- udr_signal(udrs);
-
-/* XXX - should clean up session[] and soc_con[] structs here as well... */
-
- return;
-}
-
-/******************************************************************** UDI_WAIT
-* UDIWait() returns the state of the target procesor.
-*/
-UDIError UDIWait(maxtime, pid, stop_reason)
-UDIInt32 maxtime; /* in -- maximum time to wait for completion */
-UDIPId *pid; /* out -- pid of process which stopped if any */
-UDIUInt32 *stop_reason; /* out -- PC where process stopped */
-{
- UDIInt32 service_id = UDIWait_c;
-
- udr_errno = 0;
- udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */
- udr_UDIInt32(udrs, &service_id);
- udr_UDIInt32(udrs, &maxtime);
- udr_sendnow(udrs);
- if(udr_errno) return udr_errno;
-
- udrs->udr_op = UDR_DECODE; /* receive all "out" parameters */
- udr_UDIPId(udrs, pid);
- udr_UDIUInt32(udrs, stop_reason);
- udr_UDIError(udrs, &dfe_errno); /* get any TIP error */
- return dfe_errno;
-}
-
-/********************************************************** UDI_SET_BREAKPOINT
-* UDISetBreakpoint() sets a breakpoint at an adress
-* and uses the passcount to state how many
-* times that instruction should be hit before the
-* break occurs.
-*/
-UDIError UDISetBreakpoint (addr, passcount, type, break_id)
-UDIResource addr; /* in -- where breakpoint gets set */
-UDIInt32 passcount; /* in -- passcount for breakpoint */
-UDIBreakType type; /* in -- breakpoint type */
-UDIBreakId *break_id; /* out - assigned break id */
-{
- UDIInt32 service_id = UDISetBreakpoint_c;
-
- udr_errno = 0;
- udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */
- udr_UDIInt32(udrs, &service_id);
- udr_UDIResource(udrs, &addr);
- udr_UDIInt32(udrs, &passcount);
- udr_UDIBreakType(udrs, &type);
- udr_sendnow(udrs);
- if(udr_errno) return udr_errno;
-
- udrs->udr_op = UDR_DECODE; /* receive all "out" parameters */
- udr_UDIBreakId(udrs, break_id);
- udr_UDIError(udrs, &dfe_errno); /* get any TIP error */
- return dfe_errno;
-}
-
-/******************************************************** UDI_QUERY_BREAKPOINT
-*/
-UDIError UDIQueryBreakpoint (break_id, addr, passcount, type, current_count)
-UDIBreakId break_id; /* in -- assigned break id */
-UDIResource *addr; /* out - where breakpoint was set */
-UDIInt32 *passcount; /* out - trigger passcount for breakpoint */
-UDIBreakType *type; /* out - breakpoint type */
-UDIInt32 *current_count; /* out - current count for breakpoint */
-{
- UDIInt32 service_id = UDIQueryBreakpoint_c;
-
- udr_errno = 0;
- udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */
- udr_UDIInt32(udrs, &service_id);
- udr_UDIBreakId(udrs, &break_id);
- udr_sendnow(udrs);
- if(udr_errno) return udr_errno;
-
- udrs->udr_op = UDR_DECODE; /* receive all "out" parameters */
- udr_UDIResource(udrs, addr);
- udr_UDIInt32(udrs, passcount);
- udr_UDIBreakType(udrs, type);
- udr_UDIInt32(udrs, current_count);
- udr_UDIError(udrs, &dfe_errno); /* get any TIP error */
- return dfe_errno;
-}
-
-/******************************************************** UDI_CLEAR_BREAKPOINT
-* UDIClearBreakpoint() is used to clear a breakpoint.
-*/
-UDIError UDIClearBreakpoint (break_id)
-UDIBreakId break_id; /* in -- assigned break id */
-{
- UDIInt32 service_id = UDIClearBreakpoint_c;
-
- udr_errno = 0;
- udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */
- udr_UDIInt32(udrs, &service_id);
- udr_UDIBreakId(udrs, &break_id);
- udr_sendnow(udrs);
- if(udr_errno) return udr_errno;
-
- udrs->udr_op = UDR_DECODE; /* receive all "out" parameters */
- udr_UDIError(udrs, &dfe_errno); /* get any TIP error */
- return dfe_errno;
-}
-
-/************************************************************** UDI_GET_STDOUT
-* UDIGetStdout() is called when a call to
-* UDIWait() indicates there is STD output data ready.
-*/
-UDIError UDIGetStdout(buf, bufsize, count_done)
-UDIHostMemPtr buf; /* out -- buffer to be filled */
-UDISizeT bufsize; /* in -- buffer size in bytes */
-UDISizeT *count_done; /* out -- number of bytes written to buf */
-{
- UDIInt32 service_id = UDIGetStdout_c;
-
- udr_errno = 0;
- udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */
- udr_UDIInt32(udrs, &service_id);
- udr_UDISizeT(udrs, &bufsize);
- udr_sendnow(udrs);
- if(udr_errno) return udr_errno;
-
- udrs->udr_op = UDR_DECODE; /* receive all "out" parameters */
- udr_UDISizeT(udrs, count_done);
- udr_bytes(udrs, buf, *count_done);
- udr_UDIError(udrs, &dfe_errno); /* get any TIP error */
- return dfe_errno;
-}
-
-/************************************************************** UDI_GET_STDERR
-* UDIGetStderr() is called when a call to
-* UDIWait() indicates there is STDERR output data ready
-*/
-UDIError UDIGetStderr(buf, bufsize, count_done)
-UDIHostMemPtr buf; /* out -- buffer to be filled */
-UDISizeT bufsize; /* in -- buffer size in bytes */
-UDISizeT *count_done; /* out -- number of bytes written to buf */
-{
- UDIInt32 service_id = UDIGetStderr_c;
-
- udr_errno = 0;
- udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */
- udr_UDIInt32(udrs, &service_id);
- udr_UDISizeT(udrs, &bufsize);
- udr_sendnow(udrs);
- if(udr_errno) return udr_errno;
-
- udrs->udr_op = UDR_DECODE; /* receive all "out" parameters */
- udr_UDISizeT(udrs, count_done);
- udr_bytes(udrs, buf, *count_done);
- udr_UDIError(udrs, &dfe_errno); /* get any TIP error */
- return dfe_errno;
-}
-
-/*************************************************************** UDI_PUT_STDIN
-* UDIPutStdin() is called whenever the DFE wants to
-* deliver an input character to the TIP.
-*/
-UDIError UDIPutStdin (buf, count, count_done)
-UDIHostMemPtr buf; /* in -- buffer to be filled */
-UDISizeT count; /* in -- buffer size in bytes */
-UDISizeT *count_done; /* out - number of bytes written to buf */
-{
- UDIInt32 service_id = UDIPutStdin_c;
-
- udr_errno = 0;
- udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */
- udr_UDIInt32(udrs, &service_id);
- udr_UDISizeT(udrs, &count);
- udr_bytes(udrs, buf, count);
- udr_sendnow(udrs);
- if(udr_errno) return udr_errno;
-
- udrs->udr_op = UDR_DECODE; /* receive all "out" parameters */
- udr_UDISizeT(udrs, count_done);
- udr_UDIError(udrs, &dfe_errno); /* get any TIP error */
- return dfe_errno;
-}
-
-/************************************************************** UDI_STDIN_MODE
-* UDIStdinMode() is used to change the mode that chazcters
-* are fetched from the user.
-*/
-UDIError UDIStdinMode(mode)
-UDIMode *mode; /* out - */
-{
- UDIInt32 service_id = UDIStdinMode_c;
-
- udr_errno = 0;
- udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */
- udr_UDIInt32(udrs, &service_id);
- udr_sendnow(udrs);
- if(udr_errno) return udr_errno;
-
- udrs->udr_op = UDR_DECODE; /* receive all "out" parameters */
- udr_UDIMode(udrs, mode);
- udr_UDIError(udrs, &dfe_errno); /* get any TIP error */
- return dfe_errno;
-}
-
-/*************************************************************** UDI_PUT_TRANS
-* UDIPutTrans() is used to feed input to the passthru mode.
-*/
-UDIError UDIPutTrans (buf, count, count_done)
-UDIHostMemPtr buf; /* in -- buffer address containing input data */
-UDISizeT count; /* in -- number of bytes in buf */
-UDISizeT *count_done; /* out-- number of bytes transfered */
-{
- UDIInt32 service_id = UDIPutTrans_c;
-
- udr_errno = 0;
- udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */
- udr_UDIInt32(udrs, &service_id);
- udr_UDISizeT(udrs, &count);
- udr_bytes(udrs, buf, count);
- udr_sendnow(udrs);
- if(udr_errno) return udr_errno;
-
- udrs->udr_op = UDR_DECODE; /* receive all "out" parameters */
- udr_UDISizeT(udrs, count_done);
- udr_UDIError(udrs, &dfe_errno); /* get any TIP error */
- return dfe_errno;
-}
-
-/*************************************************************** UDI_GET_TRANS
-* UDIGetTrans() is used to get output lines from the
-* passthru mode.
-*/
-UDIError UDIGetTrans (buf, bufsize, count_done)
-UDIHostMemPtr buf; /* out -- buffer to be filled */
-UDISizeT bufsize; /* in -- size of buf */
-UDISizeT *count_done; /* out -- number of bytes in buf */
-{
- UDIInt32 service_id = UDIGetTrans_c;
-
- udr_errno = 0;
- udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */
- udr_UDIInt32(udrs, &service_id);
- udr_UDISizeT(udrs, &bufsize);
- udr_sendnow(udrs);
- if(udr_errno) return udr_errno;
-
- udrs->udr_op = UDR_DECODE; /* receive all "out" parameters */
- udr_UDISizeT(udrs, count_done);
- udr_bytes(udrs, buf, *count_done);
- udr_UDIError(udrs, &dfe_errno); /* get any TIP error */
- return dfe_errno;
-}
-
-/************************************************************** UDI_Trans_Mode
-* UDITransMode() is used to change the mode that the
-* transparent routines operate in.
-*/
-UDIError UDITransMode(mode)
-UDIMode *mode; /* out -- selected mode */
-{
- UDIInt32 service_id = UDITransMode_c;
-
- udr_errno = 0;
- udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */
- udr_UDIInt32(udrs, &service_id);
- udr_UDIMode(udrs, mode);
- udr_sendnow(udrs);
- if(udr_errno) return udr_errno;
-
- udrs->udr_op = UDR_DECODE; /* receive all "out" parameters */
- udr_UDIError(udrs, &dfe_errno);
- return dfe_errno;
-}
-
-/******************************************************************** UDI_TEST
-*/
-UDIError UDITest( cnt, str_p, array)
-UDISizeT cnt;
-UDIHostMemPtr str_p;
-UDIInt32 array[];
-{
- UDIInt32 service_id = UDITest_c;
- UDIInt16 scnt = cnt;
- UDISizeT r_cnt;
- char buf[256];
-
- udr_errno = 0;
- udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */
- udr_UDIInt32(udrs, &service_id);
-
- printf("send cnt=%d scnt=%d\n", cnt, scnt);
- udr_UDISizeT(udrs, &cnt);
- udr_UDIInt16(udrs, &scnt);
- printf(" array[0]=0x%x array[1]=0x%x array[2]=0x%x array[3]=0x%x\n",
- array[0], array[1], array[2], array[3]);
- udr_bytes(udrs, (char*)array, 4*sizeof(UDIInt32));
- printf(" string=%s\n", str_p);
- udr_string(udrs, str_p);
- udr_sendnow(udrs);
- if(udr_errno)
- { fprintf(stderr, " DFE-ipc Send ERROR\n");
- return udr_errno;
- }
-
- udrs->udr_op = UDR_DECODE; /* receive all "out" parameters */
- printf("recv ");
- udr_UDISizeT(udrs, &r_cnt);
- udr_UDIInt16(udrs, &scnt);
- printf(" rcnt=%d scnt=%d\n", r_cnt, scnt);
- udr_bytes(udrs, (char*)array, 4*sizeof(UDIInt32));
-
- printf(" array[0]=0x%x array[1]=0x%x array[2]=0x%x array[3]=0x%x\n",
- array[0], array[1], array[2], array[3]);
- udr_string(udrs, str_p);
- printf(" string=%s\n", str_p);
-
- udr_UDIError(udrs, &dfe_errno);
- return dfe_errno;
-}
-
-
-
-UDIUInt32 UDIGetDFEIPCId()
-{
- return ((company_c << 16) + (product_c << 12) + version_c);
-}
-#endif /* __GO32__ */
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index a5e0502b82e..c1582ca06ba 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,9 @@
2002-05-23 Andrew Cagney <ac131313@redhat.com>
+ * regbuf.h, regbuf.c: Delete.
+
+2002-05-23 Andrew Cagney <ac131313@redhat.com>
+
* regcache.c (register_buffer): Add regcache parameter. Update
callers.
(struct regcache_descr): Add nr_raw_registers and
@@ -242,6 +246,1516 @@
(COMMON_OBS): Add regbuf.o.
(regbuf.o): Specify dependencies.
+2002-06-14 Andrew Cagney <cagney@redhat.com>
+
+ * gdbarch.sh (DEPRECATED_EXTRACT_RETURN_VALUE): Rename
+ EXTRACT_RETURN_VALUE.
+ (DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS): Rename
+ EXTRACT_STRUCT_VALUE_ADDRESS.
+ * gdbarch.h, gdbarch.c: Regenerate.
+
+ * values.c (value_being_returned): Handle
+ DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS.
+ (EXTRACT_RETURN_VALUE): Define as DEPRECATED_EXTRACT_RETURN_VALUE.
+
+ * arm-linux-tdep.c (arm_linux_init_abi): Update.
+ * arm-tdep.c (arm_gdbarch_init): Update.
+ * avr-tdep.c (avr_gdbarch_init): Update.
+ * cris-tdep.c (cris_gdbarch_init): Update.
+ * d10v-tdep.c (d10v_gdbarch_init): Update.
+ * ia64-tdep.c (ia64_gdbarch_init): Update.
+ * m68hc11-tdep.c (m68hc11_gdbarch_init): Update.
+ * rs6000-tdep.c (rs6000_gdbarch_init): Update.
+ * s390-tdep.c (s390_gdbarch_init): Update.
+ * sh-tdep.c (sh_gdbarch_init): Update.
+ * s390-tdep.c (s390_gdbarch_init): Update.
+ * sparc-tdep.c (sparc_gdbarch_init): Update.
+ * ns32k-tdep.c (ns32k_gdbarch_init): Update.
+ * v850-tdep.c (v850_gdbarch_init): Update.
+ * vax-tdep.c (vax_gdbarch_init): Update.
+ * x86-64-tdep.c (x86_64_gdbarch_init): Update.
+ * xstormy16-tdep.c (xstormy16_gdbarch_init): Update.
+
+ * config/arc/tm-arc.h: Update.
+ * config/d30v/tm-d30v.h: Update.
+ * config/fr30/tm-fr30.h: Update.
+ * config/h8300/tm-h8300.h: Update.
+ * config/h8500/tm-h8500.h: Update.
+ * config/i386/tm-i386.h: Update.
+ * config/i386/tm-ptx.h: Update.
+ * config/i386/tm-symmetry.h: Update.
+ * config/i960/tm-i960.h: Update.
+ * config/m32r/tm-m32r.h: Update.
+ * config/m68k/tm-delta68.h: Update.
+ * config/m68k/tm-linux.h: Update.
+ * config/m68k/tm-m68k.h: Update.
+ * config/m88k/tm-m88k.h: Update.
+ * config/mcore/tm-mcore.h: Update.
+ * config/mips/tm-mips.h: Update.
+ * config/mn10200/tm-mn10200.h: Update.
+ * config/pa/tm-hppa.h: Update.
+ * config/pa/tm-hppa64.h: Update.
+ * config/sparc/tm-sp64.h: Update.
+ * config/sparc/tm-sparc.h: Update.
+ * config/sparc/tm-sparclet.h: Update.
+ * config/z8k/tm-z8k.h: Update.
+
+2002-06-14 Andrew Cagney <cagney@redhat.com>
+
+ * Makefile.in (i386_linux_tdep_h): Define.
+ (i386_tdep_h, i387_tdep_h): Define.
+ (i386-linux-nat.o): Add $(i386_linux_tdep_h),
+ $(i386_tdep_h) and $(i387_tdep_h).
+ * i386-linux-nat.c: Include "i386-linux-tdep.h".
+
+2002-06-14 Mark Kettenis <kettenis@gnu.org>
+
+ * config/i386/tm-i386.h (START_INFERIOR_TRAPS_EXPECTED): Removed.
+ Already covered by the default.
+
+ * config/i386/tm-i386.h (TARGET_LONG_DOUBLE_FORMAT,
+ TARGET_LONG_DOUBLE_BIT): Remove. * i386-tdep.c
+ (i386_gdbarch_init): Initialize long_double_format and long_double
+ bit.
+
+ * config/i386/i386sol2.mt (TDEPFILES): Add i386-sol2-tdep.o and
+ i386bsd-tdep.o. Remove solib.o, solib-svr4.o and solib-legacy.o.
+ Move these to ...
+ * config/i386/i386sol2.mh: ... here.
+ * config/i386/tm-i386sol2.h (STAB_REG_TO_REGNUM): Remove define.
+ (sigtramp_saved_pc, I386V4_SIGTRAMP_SAVED_PC): Don't #undef.
+ (SIGCONTEXT_PC_OFFSET): Remove define.
+ (IN_SIGTRAMP): Remove define.
+ * i386-sol2-tdep.c: New file.
+
+ * config/i386/i386nw.mt (TM_FILE): Change to tm-i386.h.
+ * config/i386/tm-i386nw.h: Removed.
+
+ * config/i386/tm-fbsd.h (STAB_REG_TO_REGNUM,
+ USE_STRUCT_CONVENTION): Remove defines.
+ (JB_ELEMENT_SIZE, JB_PC, GET_LONGJMP_TARGET): Remove defines.
+ (get_longjmp_target): Remove prototype.
+ (IN_SIGTRAMP): Remove define.
+ (i386bsd_in_sigtramp): Remove prototype.
+ (i386bsd_sigtramp_start, i386bsd_sigtramp_end): Turn into a
+ function. Update comment accordingly
+ (SIGTRAMP_START, SIGTRAMP): Adjust definition accordingly.
+ (FRAME_SAVED_PC): Remove define.
+ (i386bsd_frame_saved_pc): Remove prototype.
+ * config/i386/tm-nbsd.h (JB_ELEMENT_SIZE, JB_PC,
+ GET_LONGJMP_TARGET): Remove defines.
+ (get_longjmp_target): Remove prototype.
+ (IN_SIGTRAMP): Remove define.
+ (i386bsd_in_sigtramp): Remove prototype.
+ (i386bsd_sigtramp_start, i386bsd_sigtramp_end): Turn into a
+ function. Update comment accordingly
+ (SIGTRAMP_START, SIGTRAMP): Adjust definition accordingly.
+ (FRAME_SAVED_PC): Remove define.
+ (i386bsd_frame_saved_pc): Remove prototype.
+ * config/i386/tm-nbsdaout.h (i386nbsd_aout_use_struct_convention):
+ Remove prototype.
+ (USE_STRUCT_CONVENTION): Remove prototype.
+ * i386bsd-nat.c (i386bsd_sigcontext_pc_offset): Remove
+ declaration.
+ (_initialize_i386bsd_nat): Revise logic to determine some
+ constants at compile time when compiling a native GDB. Warn if
+ things don't match up with what we expect.
+ * i386bsd-tdep.c (i386bsd_sigtramp_start, i386bsd_sigtramp_end):
+ Remove variables.
+ (i386bsd_in_sigtramp): Rename tp i386bsd_pc_in_sigtramp. Rewrite
+ to use date stored in `struct gdbarch_tdep'.
+ (i386bsd_sigcontext_offset): Remove varaible.
+ (i386bsd_sigtramp_saved_pc): Make public. Rewrite to use data
+ stored in `struct gdbarch_tdep'.
+ (i386bsd_frame_saved_pc): Make static.
+ (i386bsd_sigtramp_start, i386bsd_sigtramp_end): New functions.
+ (i386bsd_sc_pc_offset, i386nbsd_sc_pc_offset,
+ i386fbsd_sigtramp_start, i386fbsd_sigtramp_end,
+ i386fbsd4_sc_pc_offset): New variables.
+ (i386bsd_init_abi, i386nbsd_init_abi, i386nbsdelf_init_abi,
+ i386fbsdaout_init_abi, i386fbsd_init_abi, i386fbsd4_init_abi): New
+ functions.
+ (i386bsd_aout_osabi_sniffer, _initialize_i386bsd_tdep): New
+ functions.
+ * i386fbsd-nat.c (_initialize_i386fbsd_nat): Fix type in comment.
+ Modify the value of i386fbsd_sigtramp_start and
+ i386fbsd_sigtramp_end instead of i386bsd_sigtramp_start and
+ i386fbsd_sigtramp_end.
+ * i386nbsd-tdep.c: (i386nbsd_aout_use_struct_convention): Remove
+ function.
+
+ * config/i386/tm-linux.h (I386_LINUX_ORIG_EAX_REGNUM): Move
+ define to i386-linux-tdep.h.
+ (NUM_REGS, MAX_NUM_REGS, REGISTER_BYTES, REGISTER_NAME,
+ REGISTER_BYTE, REGISTER_RAW_SIZE, STAB_REG_TO_REGNUM): Remove
+ defines.
+ (i386_linux_register_name, i386_linux_register_byte,
+ i386_linux_register_raw_size): Remove prototypes.
+ (i386_linux_svr4_fetch_link_map_offsets): Remove prototype.
+ (SVR4_FETCH_LINK_MAP_OFFSETS): Remove define.
+ (IN_SIGTRAMP, FRAME_CHAIN, FRAME_SAVED_PC, SAVED_PC_AFTER_CALL,
+ TARGET_WRITE_PC): Remove defines.
+ (i386_linux_in_sigtramp, i386_linux_frame_chain,
+ i386_linux_frame_saved_pc, i386_linux_saved_pc_after_call,
+ i386_linux_write_pc): Remove prototypes.
+ (JB_ELEMENT_SIZE, JB_PC, GET_LONGJMP_TARGET): Remove defines.
+ (get_longjmp_target): Remove prototype.
+ * i386-linux-tdep.h: New file.
+ * i386-linux-nat.c: Include "i386-linux-tdep.h".
+ * i386-linux-tdep.c: Include "i386-tdep.h" and
+ "i386-linux-tdep.h".
+ (i386_linux_register_name, i386_linux_register_byte,
+ i386_linux_register_raw_size, i386_linux_in_sigtramp,
+ i386_linux_write_pc, i386_linux_svr4_fetch_link_map_offsets):
+ Make static.
+ (i386_linux_init_abi): New function.
+ (_initialize_i386_linux_tdep): New function.
+
+ * config/i386/tm-i386.h (SAVED_PC_AFTER_CALL): Remove define.
+ (i386_saved_pc_after_call): Remove prototype.
+ (MAX_NUM_REGS): Increase to deal with Linux's orig_eax "register".
+ (REGISTER_NAME, STAB_REG_TO_REGNUM, SDB_REG_TO_REGNUM,
+ DWARF_REG_TO_REGNUM, DWARF2_REG_TO_REGNUM): Remove defines.
+ (i386_register_name, i386_stab_reg_to_regnum,
+ i386_dwarf_reg_to_regnum): Remove prototypes.
+ (SIZEOF_GREGS, SIZEOF_FPU_REGS, SIZEOF_FPU_CTL_REGS,
+ SIZEOF_SSE_REGS): Remove defines.
+ (REGISTER_BYTES): Remove define.
+ (REGISTER_BYTE, REGISTER_RAW_SIZE): Remove defines.
+ (i386_register_byte, i386_register_raw_size): Remove prototypes.
+ (FRAME_CHAIN, FRAME_SAVED_PC): Remove defines.
+ (i386_frame_chain, i386_frame_saved_pc): Remove prototypes.
+ * config/i386/tm-i386v4.h (FRAME_CHAIN_VALID): Remove define.
+ (JB_ELEMENT_SIZE, JB_PC, JB_EBX, JB_ESI, JB_EDI, JB_EBP, JB_ESP,
+ JB_EDX, GET_LONGJMP_TARGET): Remove defines.
+ (get_longjmp_target): Remove prototype.
+ (I386V4_SIGTRAMP_SAVED_PC, IN_SIGTRAMP): Remove defines.
+ (sigtramp_saved_pc): Remove define.
+ (i386v4_sigtramp_saved_pc): Remove prototype.
+ * config/i386/tm-go32.h (FRAME_CHAIN,
+ FRAMELESS_FUNCTION_INVOCATION, FRAME_SAVED_PC): Remove defines.
+ (i386go32_frame_saved_pc): Remove prototype.
+ (JB_ELEMENT_SIZE, JB_PC, GET_LONGJMP_TARGET): Remove defines.
+ (get_longjmp_target): Remove prototype.
+ * i386-tdep.h: Include "osabi.h".
+ (enum i386_abi): Removed.
+ (enum struct_return): New enum.
+ (struct gdbarch_tdep): Remove abi member, add osabi, jb_pc_offset,
+ struct_return, sigtramp_saved_pc, sigtramp_start, sigtramp_end and
+ sc_pc_offset members.
+ (i386_gdbarch_register_os_abi): Remove prototype.
+ (I386_NUM_GREGS, I386_NUM_FREGS, I386_NUM_XREGS,
+ I386_SSE_NUM_REGS): New defines.
+ (I386_SIZEOF_GREGS, I386_SIZEOF_FREGS, I386_SIZEOF_XREGS,
+ I386_SSE_SIZEOF_REGS): New defines.
+ (i386_register_name, i386_register_byte, i386_register_raw_size):
+ New prototypes.
+ (i386_elf_init_abi, i386_svr4_init_abi): New prototypes.
+ (i386bsd_sigtramp_saved_pc): New prototype.
+ * i386-tdep.c: Don't include "elf-bfd.h".
+ (i386_stab_reg_to_regnum, i386_dwarf_reg_to_regnum,
+ i386_frame_chain, i386_saved_pc_after_call): Make static.
+ (i386_frame_saved_pc): Rewrite to call architecture dependent
+ function to deal with signal handlers. Make static.
+ (i386go32_frame_saved_pc): Removed.
+ [GET_LONGJMP_TARGET] (JB_PC, JB_ELEMENT_SIZE, get_longjmp_target):
+ Removed.
+ (i386_get_longjmp_target): New function.
+ (default_struct_convention, pcc_struct_convention,
+ reg_struct_convention, valid_conventions, struct_convention): New
+ variables.
+ (i386_use_struct_convention): New function.
+ (i386v4_sigtramp_saved_pc): Renamed to
+ i386_svr4_sigtramp_saved_pc. Made static. Moved.
+ (i386_pc_in_sigtramp): New function.
+ (i386_abi_names): Removed.
+ (ABI_TAG_OS_GNU_LINUX, ABI_TAG_OS_GNU_HURD,
+ ABI_TAG_OS_GNU_SOLARIS, ABI_TAG_OS_FREEBSD, ABI_TAG_OS_NETBSD):
+ Removed.
+ (process_note_sections, i386_elf_abi_from_note, i386_elf_abi,
+ i386_gdbarch_register_os_abi): Removed.
+ (struct i386_abi_handler): Removed.
+ (i386_abi_handler_list): Removed.
+ (i386_svr4_pc_in_sigtramp, i386_go32_pc_in_sigtramp): New
+ functions.
+ (i386_elf_init_abi, i386_svr4_init_abi, i386_go32_init_abi,
+ i386_nw_init_abi): New functions.
+ (i386_gdbarch_init): Rewritten to use generic OS ABI framework.
+ Use set_gdbarch_xxx() calls instead of relying on macros for a
+ number of calls.
+ (i386_coff_osabi_sniffer, i386_nlm_osabi_sniffer): New functions.
+ (_initialize_i386_tdep): Add new 'struct-convcention' command.
+ Register the various architecture variants defined in this file.
+
+2002-06-14 Daniel Jacobowitz <drow@mvista.com>
+
+ * gdbtypes.h (TYPE_FLAG_VARARGS): Update comment.
+ (struct main_type): Remove arg_types member. Update comments for
+ struct field.
+ (TYPE_ARG_TYPES): Remove.
+ (TYPE_FN_FIELD_ARGS): Update.
+ (smash_to_method_type): Update prototype.
+
+ * c-typeprint.c (cp_type_print_method_args): Take method type
+ instead of argument list. Use new argument layout. Simplify.
+ (c_type_print_args): Use new argument layout. Simplify.
+ (c_type_print_base): Update call to cp_type_print_method_args.
+ * dwarf2read.c (dwarf2_add_member_fn): Remove unneeded type
+ argument; use die->type instead. Update call to
+ smash_to_method_type.
+ (read_structure_scope): Update call to dwarf2_add_member_fn.
+ * gdbtypes.c (allocate_stub_method): Update comment.
+ (smash_to_method_type): Take new NARGS and VARARGS arguments.
+ Use new argument layout.
+ (check_stub_method): Use new argument layout. Don't count
+ void as an argument.
+ (print_arg_types): Update comments. Use new argument layout.
+ (recursive_dump_type): Don't print arg_types member.
+ * hpread.c (hpread_read_struct_type): Use new argument layout.
+ (fixup_class_method_type): Likewise.
+ (hpread_type_lookup): Likewise.
+ * stabsread.c (read_type): Update calls to read_args and
+ smash_to_method_type.
+ (read_args): Use new argument layout. Simplify.
+ * valops.c (typecmp): Use new argument layout. Update parameters
+ and comments. Simplify.
+ (hand_function_call): Use new argument layout.
+ (search_struct_method): Update call to typecmp.
+ (find_overload_match): Use new argument layout.
+
+2002-06-13 Daniel Jacobowitz <drow@mvista.com>
+
+ * NEWS: Mention multithreaded debug support for gdbserver.
+
+2002-06-13 Daniel Jacobowitz <drow@mvista.com>
+
+ * MAINTAINERS: Mention NEWS.
+
+2002-06-13 Daniel Jacobowitz <drow@mvista.com>
+
+ * gdbserver/regcache.c: Add comment.
+
+2002-06-13 Daniel Jacobowitz <drow@mvista.com>
+
+ * mips-tdep.c (PROC_SYMBOL): Add warning comment.
+ (struct mips_objfile_private, compare_pdr_entries): New.
+ (non_heuristic_proc_desc): Read the ".pdr" section if it
+ is present.
+
+2002-06-12 Andrew Cagney <ac131313@redhat.com>
+
+ * arm-tdep.c (arm_push_arguments): Rewrite using a two-pass loop.
+ (arm_debug): New static variable.
+ (_initialize_arm_tdep): Add ``set debug arm'' command.
+
+2002-06-12 Andrew Cagney <ac131313@redhat.com>
+
+ * Makefile.in (sim_arm_h): Define.
+ (arm-tdep.o): Add $(sim_arm_h) and $(gdb_assert_h).
+ * arm-tdep.c: Include "gdb/sim-arm.h" and "gdb_assert.h".
+ (arm_register_sim_regno): New function, map an internal REGNUM
+ onto a simulator register number.
+ (arm_gdbarch_init): Set register_sim_regno.
+
+2002-06-09 Aldy Hernandez <aldyh@redhat.com>
+
+ * MAINTAINERS: Add self.
+
+2002-06-11 Jim Blandy <jimb@redhat.com>
+
+ * source.c (source_info): Mention whether the symtab has
+ information about preprocessor macros.
+
+ Call the command `info macro', not `show macro'.
+ * macrocmd.c (info_macro_command): Renamed from `show_macro_command'.
+ Fix error message.
+ (_initialize_macrocmd): Register `info_macro_command' in
+ `infolist', not `showlist'.
+
+2002-06-11 Daniel Jacobowitz <drow@mvista.com>
+
+ * mips-tdep.c (MIPS_FPU_TYPE, FP_REGISTER_DOUBLE, MIPS_EABI)
+ (MIPS_LAST_FP_ARG_REGNUM, MIPS_LAST_ARG_REGNUM)
+ (MIPS_DEFAULT_SAVED_REGSIZE, MIPS_REGS_HAVE_HOME_P)
+ (MIPS_DEFAULT_STACK_ARGSIZE, GDB_TARGET_IS_MIPS64)
+ (MIPS_DEFAULT_MASK_ADDRESS_P): Remove obsolete definitions. Define
+ unconditionally.
+ (set_mipsfpu_single_command, set_mipsfpu_double_command)
+ (set_mipsfpu_none_command): Remove if (GDB_MULTI_ARCH).
+ (_initialize_mips_tdep): Remove dead code.
+ * config/mips/tm-irix5.h (MIPS_LAST_ARG_REGNUM)
+ (MIPS_DEFAULT_STACK_ARGSIZE, MIPS_REGS_HAVE_HOME_P): Remove.
+ * config/mips/tm-irix6.h (MIPS_LAST_ARG_REGNUM)
+ (MIPS_DEFAULT_STACK_ARGSIZE, MIPS_REGS_HAVE_HOME_P): Remove.
+ * config/mips/tm-mips.h (MIPS_EABI, MIPS_LAST_ARG_REGNUM,
+ MIPS_LAST_FP_ARG_REGNUM): Remove.
+
+2002-06-11 Daniel Jacobowitz <drow@mvista.com>
+
+ * gdbserver/thread-db.c: New file.
+ * gdbserver/proc-service.c: New file.
+ * gdbserver/acinclude.m4: New file.
+ * gdbserver/Makefile.in: Add GDBSERVER_LIBS, gdb_proc_service_h,
+ proc-service.o, and thread-db.o.
+ (linux-low.o): Add USE_THREAD_DB.
+ * gdbserver/acconfig.h: Add HAVE_PRGREGSET_T, HAVE_PRFPREGSET_T,
+ HAVE_LWPID_T, HAVE_PSADDR_T, and PRFPREGSET_T_BROKEN.
+ * gdbserver/aclocal.m4: Regenerated.
+ * gdbserver/config.in: Regenerated.
+ * gdbserver/configure: Regenerated.
+ * gdbserver/configure.in: Check for proc_service.h, sys/procfs.h,
+ thread_db.h, and linux/elf.h headrs.
+ Check for lwpid_t, psaddr_t, prgregset_t, prfpregset_t, and
+ PRFPREGSET_T_BROKEN. Introduce srv_thread_depfiles and USE_THREAD_DB.
+ Check for -lthread_db and thread support.
+ * gdbserver/configure.srv: Enable thread_db support for ARM, i386, MIPS,
+ PowerPC, and SuperH.
+ * gdbserver/i387-fp.c: Constify arguments.
+ * gdbserver/i387-fp.h: Likewise.
+ * gdbserver/inferiors.c: (struct thread_info): Renamed from
+ `struct inferior_info'. Remove PID member. Use generic inferior
+ list header. All uses updated.
+ (inferiors, signal_pid): Removed.
+ (all_threads): New variable.
+ (get_thread): Define.
+ (add_inferior_to_list): New function.
+ (for_each_inferior): New function.
+ (change_inferior_id): New function.
+ (add_inferior): Removed.
+ (remove_inferior): New function.
+ (add_thread): New function.
+ (free_one_thread): New function.
+ (remove_thread): New function.
+ (clear_inferiors): Use for_each_inferior and free_one_thread.
+ (find_inferior): New function.
+ (find_inferior_id): New function.
+ (inferior_target_data): Update argument type.
+ (set_inferior_target_data): Likewise.
+ (inferior_regcache_data): Likewise.
+ (set_inferior_regcache_data): Likewise.
+ * gdbserver/linux-low.c (linux_bp_reinsert): Remove.
+ (all_processes, stopping_threads, using_thrads)
+ (struct pending_signals, debug_threads, pid_of): New.
+ (inferior_pid): Replace with macro.
+ (struct inferior_linux_data): Remove.
+ (get_stop_pc, add_process): New functions.
+ (linux_create_inferior): Restore SIGRTMIN+1 before calling exec.
+ Use add_process and add_thread.
+ (linux_attach_lwp): New function, based on old linux_attach. Use
+ add_process and add_thread. Set stop_expected for new threads.
+ (linux_attach): New function.
+ (linux_kill_one_process): New function.
+ (linux_kill): Kill all LWPs.
+ (linux_thread_alive): Use find_inferior_id.
+ (check_removed_breakpoints, status_pending_p): New functions.
+ (linux_wait_for_process): Renamed from linux_wait_for_one_inferior.
+ Update. Use WNOHANG. Wait for cloned processes also. Update process
+ struct for the found process.
+ (linux_wait_for_event): New function.
+ (linux_wait): Use it. Support LWPs.
+ (send_sigstop, wait_for_sigstop, stop_all_processes)
+ (linux_resume_one_process, linux_continue_one_process): New functions.
+ (linux_resume): Support LWPs.
+ (REGISTER_RAW_SIZE): Remove.
+ (fetch_register): Use register_size instead. Call supply_register.
+ (usr_store_inferior_registers): Likewise. Call collect_register.
+ Fix recursive case.
+ (regsets_fetch_inferior_registers): Improve error message.
+ (regsets_store_inferior_registers): Add debugging.
+ (linux_look_up_symbols): Call thread_db_init if USE_THREAD_DB.
+ (unstopped_p, linux_signal_pid): New functions.
+ (linux_target_ops): Add linux_signal_pid.
+ (linux_init_signals): New function.
+ (initialize_low): Call it. Initialize using_threads.
+ * gdbserver/regcache.c (inferior_regcache_data): Add valid
+ flag.
+ (get_regcache): Fetch registers lazily. Add fetch argument
+ and update all callers.
+ (regcache_invalidate_one, regcache_invalidate): New
+ functions.
+ (new_register_cache): Renamed from create_register_cache.
+ Return the new regcache.
+ (free_register_cache): Change argument to a void *.
+ (registers_to_string, registers_from_string): Call get_regcache
+ with fetch flag set.
+ (register_data): Make static. Pass fetch flag to get_regcache.
+ (supply_register): Call get_regcache with fetch flag clear.
+ (collect_register): Call get_regcache with fetch flag set.
+ (collect_register_as_string): New function.
+ * gdbserver/regcache.h: Update.
+ * gdbserver/remote-utils.c (putpkt): Flush after debug output and use
+ stderr.
+ Handle input interrupts while waiting for an ACK.
+ (input_interrupt): Use signal_pid method.
+ (getpkt): Flush after debug output and use stderr.
+ (outreg): Use collect_register_as_string.
+ (new_thread_notify, dead_thread_notify): New functions.
+ (prepare_resume_reply): Check using_threads. Set thread_from_wait
+ and general_thread.
+ (look_up_one_symbol): Flush after debug output.
+ * gdbserver/server.c (step_thread, server_waiting): New variables.
+ (start_inferior): Don't use signal_pid. Update call to mywait.
+ (attach_inferior): Update call to mywait.
+ (handle_query): Handle qfThreadInfo and qsThreadInfo.
+ (main): Don't fetch/store registers explicitly. Use
+ set_desired_inferior. Support proposed ``Hs'' packet. Update
+ calls to mywait.
+ * gdbserver/server.h: Update.
+ (struct inferior_list, struct_inferior_list_entry): New.
+ * gdbserver/target.c (set_desired_inferior): New.
+ (write_inferior_memory): Constify.
+ (mywait): New function.
+ * gdbserver/target.h: Update.
+ (struct target_ops): New signal_pid method.
+ (mywait): Removed macro, added prototype.
+
+ * gdbserver/linux-low.h (regset_func): Removed.
+ (regset_fill_func, regset_store_func): New.
+ (enum regset_type): New.
+ (struct regset_info): Add type field. Use new operation types.
+ (struct linux_target_ops): stop_pc renamed to get_pc.
+ Add decr_pc_after_break and breakpoint_at.
+ (get_process, get_thread_proess, get_process_thread)
+ (strut process_info, all_processes, linux_attach_lwp)
+ (thread_db_init): New.
+
+ * gdbserver/linux-arm-low.c (arm_get_pc, arm_set_pc,
+ arm_breakpoint, arm_breakpoint_len, arm_breakpoint_at): New.
+ (the_low_target): Add new members.
+ * gdbserver/linux-i386-low.c (i386_store_gregset, i386_store_fpregset)
+ (i386_store_fpxregset): Constify.
+ (target_regsets): Add new kind identifier.
+ (i386_get_pc): Renamed from i386_stop_pc. Simplify.
+ (i386_set_pc): Add debugging.
+ (i386_breakpoint_at): New function.
+ (the_low_target): Add new members.
+ * gdbserver/linux-mips-low.c (mips_get_pc, mips_set_pc)
+ (mips_breakpoint, mips_breakpoint_len, mips_reinsert_addr)
+ (mips_breakpoint_at): New.
+ (the_low_target): Add new members.
+ * gdbserver/linux-ppc-low.c (ppc_get_pc, ppc_set_pc)
+ (ppc_breakpoint, ppc_breakpoint_len, ppc_breakpoint_at): New.
+ (the_low_target): Add new members.
+ * gdbserver/linux-sh-low.c (sh_get_pc, sh_set_pc)
+ (sh_breakpoint, sh_breakpoint_len, sh_breakpoint_at): New.
+ (the_low_target): Add new members.
+ * gdbserver/linux-x86-64-low.c (target_regsets): Add new kind
+ identifier.
+
+2002-06-11 Michal Ludvig <mludvig@suse.cz>
+
+ * dwarf2cfi.c (unwind_tmp_obstack_init): New.
+ (unwind_tmp_obstack_free, parse_frame_info)
+ (update_context, cfi_read_fp, cfi_write_fp)
+ (cfi_frame_chain, cfi_init_extra_frame_info)
+ (cfi_virtual_frame_pointer): Use the above function.
+ * dwarf2cfi.c: Reindented (using 'indent dwarf2cfi.c').
+
+2002-06-11 Corinna Vinschen <vinschen@redhat.com>
+
+ * v850-tdep.c (v850_type_is_scalar): New function.
+ (v850_use_struct_convention): Match current gcc implementation
+ as close as possible.
+ (v850_push_arguments): Fix stack_offset handling. Don't write
+ struct_addr into register. This is done by v850_store_struct_return.
+ (v850_extract_return_value): Care for structs.
+ (v850_store_return_value): Ditto.
+ (v850_store_struct_return): Actually write address.
+
+2002-06-11 Michal Ludvig <mludvig@suse.cz>
+
+ * x86-64-tdep.c (x86_64_skip_prologue): Fix to work on functions
+ without debug information too.
+
+2002-06-10 Andrew Cagney <ac131313@redhat.com>
+
+ * gdbarch.sh (PRINT_FLOAT_INFO): Add frame and ui_file parameters.
+ Make multi-arch pure.
+ * gdbarch.h, gdbarch.c: Re-generate.
+ * arm-tdep.c (arm_print_float_info): Update.
+ * arch-utils.h (default_print_float_info): Update.
+ * arch-utils.c (default_print_float_info): Update.
+ * infcmd.c (float_info): Update call.
+
+2002-06-10 Andrew Cagney <ac131313@redhat.com>
+
+ * Makefile.in (init.c): Move the call to _initialize_gdbtypes to
+ the front of the initialize list.
+
+2002-06-10 Andrew Cagney <ac131313@redhat.com>
+
+ * infrun.c (struct inferior_status): Replace fields
+ selected_frame_address and selected_level with field
+ selected_frame_id.
+ (save_inferior_status): Update. Use get_frame_id.
+ (struct restore_selected_frame_args): Delete.
+ (restore_selected_frame): Update. Use frame_find_by_id.
+ (restore_inferior_status): Update.
+
+ * breakpoint.h (struct breakpoint): Change type of
+ watchpoint_frame to frame_id.
+ * breakpoint.c (insert_breakpoints): Use frame_find_by_id. Remove
+ call to get_current_frame.
+ (do_enable_breakpoint): Use frame_find_by_id. Remove call to
+ get_current_frame.
+ (watchpoint_check): Use frame_find_by_id.
+
+ * frame.h (record_selected_frame): Delete declaration.
+ * stack.c (record_selected_frame): Delete function.
+
+ * frame.h (struct frame_id): Define.
+ (get_frame_id): Declare.
+ (frame_find_by_id): Declare.
+ * frame.c (frame_find_by_id): New function.
+ (get_frame_id): New function.
+
+2002-06-10 Andrey Volkov <avolkov@transas.com>
+
+ * ser-e7kpc.c: Fix duplicated define and call of
+ _initialize_ser_e7000pc
+
+2002-06-09 Daniel Jacobowitz <drow@mvista.com>
+
+ * signals/signals.c (target_signal_from_host): Fix #ifdef
+ SIGRTMIN case.
+ (do_target_signal_to_host): Likewise.
+
+2002-06-09 Daniel Jacobowitz <drow@mvista.com>
+
+ * mips-tdep.c (mips_find_abi_section): New function.
+ (mips_gdbarch_init): Call it.
+
+2002-06-09 Mark Kettenis <kettenis@gnu.org>
+
+ * solib-svr4.c (init_fetch_link_map_offsets): Simply return
+ legacy_fetch_link_map_offsets. Adjust comment to reflect reality
+ after Andrew's 2002-06-08 gdbarch change.
+
+2002-06-09 Mark Kettenis <kettenis@gnu.org>
+
+ * i386-linux-nat.c (suppy_gregset): Don't supply
+ I386_LINUX_ORIG_EAX_REGNUM if there isn't room for it in GDB's
+ register cache.
+ (fill_gregset): Don't fetch it under the same circumstances.
+
+2002-06-09 Andrew Cagney <cagney@redhat.com>
+
+ * Makefile.in (callback_h): Define.
+ (remote_sim_h): Update path to remote-sim.h.
+ (remote-rdp.o): Add $(callback_h).
+ (remote-sim.o): Use $(callback_h).
+ * remote-sim.c: Include "gdb/callback.h" and "gdb/remote-sim.h".
+ * remote-rdp.c: Include "gdb/callback.h".
+
+2002-06-09 Mark Kettenis <kettenis@gnu.org>
+
+ * osabi.h (gdb_osabi): Add GDB_OSABI_GO32 and GDB_OSABI_NETWARE.
+ * osabi.c (gdb_osabi_names): Add "DJGPP" and "NetWare".
+
+2002-06-08 Andrew Cagney <ac131313@redhat.com>
+
+ * sparcl-tdep.c: Use __CYGWIN__ instead of __CYGWIN32__.
+ * rdi-share/serpardr.c: Ditto.
+ * rdi-share/unixcomm.c: Ditto.
+ * rdi-share/serdrv.c: Ditto.
+ * rdi-share/hostchan.h: Ditto.
+ * rdi-share/hostchan.c: Ditto.
+ * rdi-share/host.h: Ditto.
+ * rdi-share/devsw.c: Ditto.
+
+ * objfiles.h: Change type of obj_private to void pointer.
+ * pa64solib.c: Update copyright. Don't include "assert.h", use
+ strcmp instead of STREQ, use LONGEST, do not use PTR
+ * somsolib.c: Ditto.
+
+ * config/djgpp/fnchange.lst: Fix problems with bfd/elf32-i386.c,
+ bfd/elf32-i386qnx.c, bfd/elf32-sh.c, bfd/elf32-sh64-nbsd.c,
+ bfd/elf64-sh64-nbsd.c bfd/elf64-sh64.c.
+
+2002-06-08 Andrew Cagney <ac131313@redhat.com>
+
+ * frame.c (GET_SAVED_REGISTER): Delete macro definition.
+ (default_get_saved_register): Delete function.
+ * gdbarch.sh (GET_SAVED_REGISTER): Set default to
+ generic_unwind_get_saved_register.
+ * gdbarch.h, gdbarch.c: Re-generate.
+
+2002-06-08 Andrew Cagney <ac131313@redhat.com>
+
+ * gdbarch.sh (FRAME_CHAIN_VALID): Set default to
+ generic_func_frame_chain_valid.
+ * gdbarch.h, gdbarch.c: Re-generate.
+ * blockframe.c (generic_func_frame_chain_valid): Only check
+ PC_IN_CALL_DUMMY when generic dummy frames. Don't worry about
+ passing FP to PC_IN_CALL_DUMMY.
+ Fix PR gdb/360.
+
+2002-06-08 Andrew Cagney <ac131313@redhat.com>
+
+ * gdbarch.sh (struct gdbarch_data): Add field init_p.
+ (register_gdbarch_data): Initialize init_p.
+ (gdbarch_data): Initialize data pointer using the init function.
+ (init_gdbarch_data): Delete function.
+ (gdbarch_update_p): Update.
+ (initialize_non_multiarch): Update.
+ (struct gdbarch): Add field initialized_p.
+ * gdbarch.h, gdbarch.c: Re-generate.
+
+2002-06-07 Michal Ludvig <mludvig@suse.cz>
+
+ * x86-64-linux-nat.c (x86_64_fxsave_offset): New.
+ (supply_fpregset, fill_fpregset): Don't call i387_*_fxsave,
+ better do the things actually here.
+ * x86-64-tdep.c (x86_64_register_name2nr): New.
+ (x86_64_register_name): Renamed to x86_64_register_nr2name.
+ (x86_64_gdbarch_init): Respect the above change.
+ * x86-64-tdep.h (x86_64_register_name2nr)
+ (x86_64_register_nr2name): Add prototypes.
+ * config/i386/x86-64linux.mt (TDEPFILES): Remove i387-tdep.o.
+
+2002-06-06 Michael Snyder <msnyder@redhat.com>
+
+ * d10v-tdep.c (d10v_push_arguments): Handle struct_return.
+ Delete extra braces and re-indent.
+ (d10v_store_return_value): Char return values
+ must be shifted over by one byte in R0.
+ (d10v_extract_return_value): Delete extra braces, re-indent.
+
+2002-06-06 Elena Zannoni <ezannoni@redhat.com>
+
+ * d10v-tdep.c (d10v_read_sp, d10v_read_fp): Add prototype.
+ (d10v_register_virtual_type): Make $fp and $sp be pointer to data.
+ (d10v_integer_to_address): Rewrite.
+ (d10v_frame_init_saved_regs): When reading fp and sp registers use
+ the d10v specific functions which take care of converting to the
+ correct space.
+
+2002-06-06 Elena Zannoni <ezannoni@redhat.com>
+
+ * config/djgpp/fnchange.lst: Add testsuite files altivec-abi.c,
+ altivec-abi.exp, altivec-regs.c, altivec-regs.exp.
+
+2002-06-02 Andrew Cagney <ac131313@redhat.com>
+
+ * config/alpha/nm-linux.h: Add "config/" prefix to tm, nm and xm
+ includes.
+ * config/tm-linux.h: Ditto.
+ * config/alpha/tm-alphalinux.h: Ditto.
+ * config/arm/nm-linux.h, config/arm/tm-linux.h: Ditto.
+ * config/arm/xm-nbsd.h, config/i386/nm-gnu.h: Ditto.
+ * config/i386/nm-i386lynx.h, config/i386/nm-i386sol2.h: Ditto.
+ * config/i386/nm-i386v4.h, config/i386/nm-i386v42mp.h: Ditto.
+ * config/i386/nm-linux.h, config/i386/nm-m3.h: Ditto.
+ * config/i386/nm-ptx4.h, config/i386/nm-x86-64.h: Ditto.
+ * config/i386/tm-i386gnu.h, config/i386/tm-i386lynx.h: Ditto.
+ * config/i386/tm-i386m3.h, config/i386/tm-i386sco5.h: Ditto.
+ * config/i386/tm-i386v4.h, config/i386/tm-linux.h: Ditto.
+ * config/i386/tm-ptx4.h, config/i386/tm-vxworks.h: Ditto.
+ * config/i386/xm-i386v4.h, config/i386/xm-nbsd.h: Ditto.
+ * config/i386/xm-ptx.h, config/i386/xm-ptx4.h: Ditto.
+ * config/i960/tm-vx960.h, config/ia64/nm-aix.h: Ditto.
+ * config/ia64/nm-linux.h, config/ia64/tm-aix.h: Ditto.
+ * config/ia64/tm-linux.h, config/ia64/xm-aix.h: Ditto.
+ * config/m68k/nm-linux.h, config/m68k/nm-m68klynx.h: Ditto.
+ * config/m68k/nm-sysv4.h, config/m68k/tm-linux.h: Ditto.
+ * config/m68k/tm-m68klynx.h, config/m68k/tm-m68kv4.h: Ditto.
+ * config/m68k/tm-sun2os4.h, config/m68k/tm-sun3os4.h: Ditto.
+ * config/m68k/tm-vx68.h, config/m68k/xm-m68kv4.h: Ditto.
+ * config/m68k/xm-nbsd.h, config/m88k/nm-delta88v4.h: Ditto.
+ * config/m88k/tm-delta88v4.h, config/m88k/xm-delta88v4.h: Ditto.
+ * config/mips/nm-irix5.h, config/mips/nm-linux.h: Ditto.
+ * config/mips/tm-linux.h, config/mips/tm-mips64.h: Ditto.
+ * config/mips/tm-mipsm3.h, config/mips/tm-mipsv4.h: Ditto.
+ * config/mips/tm-vxmips.h, config/mips/xm-irix5.h: Ditto.
+ * config/mips/xm-mipsv4.h, config/ns32k/xm-nbsd.h: Ditto.
+ * config/pa/nm-hppao.h, config/powerpc/nm-linux.h: Ditto.
+ * config/powerpc/tm-linux.h, config/powerpc/tm-vxworks.h: Ditto.
+ * config/powerpc/xm-aix.h, config/rs6000/nm-rs6000ly.h: Ditto.
+ * config/rs6000/tm-rs6000ly.h, config/rs6000/xm-aix4.h: Ditto.
+ * config/sh/tm-linux.h, config/sparc/nm-linux.h: Ditto.
+ * config/sparc/nm-sparclynx.h, config/sparc/nm-sun4sol2.h: Ditto.
+ * config/sparc/tm-linux.h, config/sparc/tm-sp64linux.h: Ditto.
+ * config/sparc/tm-sp64sim.h, config/sparc/tm-sparclynx.h: Ditto.
+ * config/sparc/tm-sun4os4.h, config/sparc/tm-sun4sol2.h: Ditto.
+ * config/sparc/tm-vxsparc.h, config/sparc/xm-sun4sol2.h: Ditto.
+
+2002-05-04 Aidan Skinner <aidan@velvet.net>
+
+ * ada-exp.tab.c: New file
+ * ada-exp.y: New file
+ * ada-lang.c: New file
+ * ada-lang.h: New file
+ * ada-lex.c: New file
+ * ada-lex.l: New file
+ * ada-tasks.c: New file
+ * ada-typeprint.c: New file
+ * ada-valprint.c: New file
+
+2002-06-02 Jason Thorpe <thorpej@wasabisystems.com>
+
+ * ppcnbsd-tdep.c (ppcnbsd_init_abi): Don't set
+ use_struct_convention to ppc_sysv_abi_broken_use_struct_convention.
+
+2002-06-02 Jason Thorpe <thorpej@wasabisystems.com>
+
+ * config/rs6000/aix4.mt (TDEPFILES): Use ppc-sysv-tdep.o
+ insetead of ppc-linux-tdep.o.
+ * config/rs6000/rs6000.mt (TDEPFILES): Likewise.
+ * config/rs6000/rs6000lynx.mt (TDEPFILES): Likewise.
+
+2002-06-02 Andrew Cagney <ac131313@redhat.com>
+
+ 2002-05-07 Christian Groessler <chris@groessler.org>
+ * z8k-tdep.c (z8k_print_register_hook): Fix display of 32 and 64
+ bit register contents for little endian hosts.
+
+2002-06-01 Andrew Cagney <ac131313@redhat.com>
+
+ * MAINTAINERS: Mention that any `HP/UX reader' can be changed by
+ any maintainer.
+
+2002-06-01 Andrew Cagney <ac131313@redhat.com>
+
+ * gdbarch.h: Regenerate.
+
+2002-06-01 Andrew Cagney <ac131313@redhat.com>
+
+ * MAINTAINERS: Add everyone to write-after-approval list.
+
+2002-06-01 Andrew Cagney <ac131313@redhat.com>
+
+ * stack.c (frame_info): Use frame_register_unwind instead of
+ saved_regs. Mention when the SP is on the stack or in a register.
+
+ * frame.h (frame_register_unwind_ftype): Define. Document.
+ (struct frame_info): Add field register_unwind and
+ register_unwind_cache.
+ (frame_register_unwind): Declare.
+ (generic_unwind_get_saved_register): Declare.
+
+ * frame.c (frame_register_unwind): New function.
+ (generic_unwind_get_saved_register): New function.
+
+ * blockframe.c (generic_call_dummy_register_unwind): New function.
+ (frame_saved_regs_register_unwind): New function.
+ (set_unwind_by_pc): New function.
+ (create_new_frame): New function.
+ (get_prev_frame): New function.
+
+2002-05-30 Andrew Cagney <ac131313@redhat.com>
+
+ * a29k-share/: Delete directory.
+ * remote-vx29k.c: Delete file.
+
+2002-05-30 Jason Thorpe <thorpej@wasabisystems.com>
+
+ * config/djgpp/fnchange.lst: Add ns32knbsd-nat.c, ns32knbsd-tdep.c,
+ ppcnbsd-nat.c, ppcnbsd-tdep.c, sparcnbsd-nat.c, and sparcnbsd-tdep.c.
+
+2002-05-30 Jason Thorpe <thorpej@wasabisystems.com>
+
+ * Makefile.in (ALLDEPFILES): Add sparc64nbsd-nat.c,
+ sparcnbsd-nat.c, and sparcnbsd-tdep.c.
+ (sparc64nbsd-nat.o)
+ (sparcnbsd-nat.o)
+ (sparcnbsd-tdep.o): New dependency lists.
+ * NEWS: Note new UltraSPARC NetBSD native configuration.
+ * configure.host (sparc64-*-netbsd*): New host.
+ * configure.tgt (sparc-*-netbsdelf*)
+ (sparc-*-netbsd*): Set gdb_target to nbsd.
+ (sparc64-*-netbsd*): New target.
+ * sparc64nbsd-nat.c: New file.
+ * sparcnbsd-nat.c: New file.
+ * sparcnbsd-tdep.c: New file.
+ * sparcnbsd-tdep.h: New file.
+ * config/sparc/nbsd.mt: New file.
+ * config/sparc/nbsd64.mh: New file.
+ * config/sparc/nbsd64.mt: New file.
+ * config/sparc/nbsdaout.mh (NATDEPFILES): Remove corelow.o,
+ sparc-nat.o, and solib.o. Add sparcnbsd-nat.o.
+ (HOST_IPC): Remove.
+ * config/sparc/nbsdaout.mt: Remove.
+ * config/sparc/nbsdelf.mh (NATDEPFILES): Remove corelow.o,
+ sparc-nat.o, and solib.o. Add sparcnbsd-nat.o.
+ (HOST_IPC): Remove.
+ * config/sparc/nbsdelf.mt: Remove.
+ * config/sparc/nm-nbsd.h: Update copyright years. Remove all
+ sparc-nat.c compatiblity defines.
+ * config/sparc/tm-nbsd.h: Update copyright years. Include solib.h.
+ (GDB_MULTI_ARCH): Set to GDB_MULTI_ARCH_PARTIAL.
+ * config/sparc/tm-nbsd64.h: New file.
+ * config/sparc/tm-nbsdaout.h: Remove.
+ * config/sparc/xm-nbsd.h: Remove.
+
+2002-05-30 Jason Thorpe <thorpej@wasabisystems.com>
+
+ * Makefile.in (sparc-tdep.o): Add osabi.h to dependency list.
+ * sparc-tdep.c: Include osabi.h.
+ (gdbarch_tdep): Add osabi member.
+ (_initialize_sparc_tdep): Use gdbarch_register.
+ (sparc_gdbarch_init): Use generic OS ABI framework.
+ (sparc_dump_tdep): New function.
+
+2002-05-30 Kevin Buettner <kevinb@redhat.com>
+
+ * corefile.c (do_captured_read_memory_integer): Return non-zero
+ result.
+ (safe_read_memory_integer): Copy result of memory read when
+ status is non-zero. Also, add comments.
+
+2002-05-20 Jason Thorpe <thorpej@wasabisystems.com>
+
+ * Makefile.in (ppc_tdep_h): Define.
+ (ppc-linux-nat.o)
+ (ppc-linux-tdep.o)
+ (rs6000-tdep.o): Use $(ppc_tdep_h).
+ (ppc-sysv-tdep.o)
+ (ppcnbsd-nat.o)
+ (ppcnbsd-tdep.o): New dependency lists.
+ * ppc-tdep.h: Use generic OS ABI framework.
+ * ppc-linux-tdep.c (_initialize_ppc_linux_tdep)
+ (ppc_linux_init_abi): New functions.
+ (ppc_sysv_abi_broken_use_struct_convention)
+ (ppc_sysv_abi_use_struct_convention)
+ (ppc_sysv_abi_push_arguments): Move to...
+ * ppc-sysv-tdep.c: ...here.
+ * ppcnbsd-nat.c: Don't include gdbcore.h and regcache.h.
+ * rs6000-tdep.c (process_note_abi_tag_sections)
+ (get_elfosabi): Remove.
+ (rs6000_gdbarch_init): Use generic OS ABI framework.
+ (rs6000_dump_tdep): New function.
+ (_initialize_rs6000_tdep): Use gdbarch_register.
+ * config/powerpc/linux.mt (TDEPFILES): Add ppc-sysv-tdep.o.
+ * config/powerpc/nbsd.mh (NATDEPFILES): Remove solib-legacy.o.
+ * config/powerpc/aix.mt (TDEPFILES): Use ppc-sysv-tdep.o instead
+ of ppc-linux-tdep.o.
+ * config/powerpc/nbsd.mt (TDEPFILES): Likewise.
+ * config/powerpc/ppc-eabi.mt (TDEPFILES): Likewise.
+ * config/powerpc/ppc-sim.mt (TDEPFILES): Likewise.
+ * config/powerpc/ppcle-eabi.mt (TDEPFILES): Likewise.
+ * config/powerpc/ppcle-sim.mt (TDEPFILES): Likewise.
+ * config/powerpc/vxworks.mt (TDEPFILES): Likewise.
+
+2002-05-29 Jim Blandy <jimb@redhat.com>
+
+ * macroscope.c (default_macro_scope): Put `void' in empty argument
+ list.
+
+2002-05-29 Andrew Cagney <ac131313@redhat.com>
+
+ * Makefile.in (arch-utils.o): Add $(sim_regno_h).
+ * arch-utils.c: Include "sim-regno.h".
+ * gdbarch.sh: Don't include "sim-regno.h".
+ * gdbarch.h, gdbarch.c: Regenerate.
+ * sim-regno.h (legacy_register_sim_regno): Move declaration from
+ here.
+ * arch-utils.h (legacy_register_sim_regno): To here.
+ * remote-sim.c (legacy_register_sim_regno): Move function from
+ here.
+ * arch-utils.c (legacy_register_sim_regno): To here.
+
+2002-05-28 Andrew Cagney <ac131313@redhat.com>
+
+ * sim-regno.h: New file.
+ * Makefile.in (sim_regno_h): Define.
+ (d10v-tdep.o, remote-sim.o): Add dependency on $(sim_regno_h).
+ * remote-sim.c: Include "sim-regno.h" and "gdb_assert.h".
+ (legacy_register_sim_regno): New function.
+ (one2one_register_sim_regno): New function.
+ (gdbsim_fetch_register): Rewrite.
+ (gdbsim_store_register): Only store a register when
+ REGISTER_SIM_REGNO is valid.
+ * d10v-tdep.c: Include "sim-regno.h".
+ (d10v_ts2_register_sim_regno): Add legacy_regiter_sim_regno check.
+ (d10v_ts3_register_sim_regno): Ditto.
+ * gdbarch.sh: Include "sim-regno.h".
+ (REGISTER_SIM_REGNO): Set default to legacy_register_sim_regno.
+ * gdbarch.h, gdbarch.c: Regenerate.
+ * arch-utils.h (default_register_sim_regno): Delete declaration.
+ * arch-utils.c (default_register_sim_regno): Delete function.
+
+2002-05-28 Jason Thorpe <thorpej@wasabisystems.com>
+
+ * ppcnbsd-nat.c: Rewrite.
+ * ppcnbsd-tdep.c: New file.
+ * ppcnbsd-tdep.h: New file.
+ * config/powerpc/nbsd.mh (NATDEPFILES): Remove corelow.o,
+ solib.o, and solib-svr4.o.
+ * config/powerpc/nbsd.mt (TDEPFILES): Add ppcnbsd-tdep.o,
+ nbsd-tdep.o, and corelow.o.
+
+2002-05-28 Andrew Cagney <ac131313@redhat.com>
+
+ * MAINTAINERS (--enable-gdb-build-warnings): Rewrite script to use
+ `tr' and `sed'. Mention that `broken' targets are not expected to
+ build.
+
+2002-05-27 Michal Ludvig <mludvig@suse.cz>
+
+ * x86-64-tdep.c (x86_64_skip_prologue): Remove obsolete note.
+ Let PC point right after the prologue before looking up symbols.
+
+2002-05-27 Martin M. Hunt <hunt@redhat.com>
+
+ * i386-tdep.c (i386_register_virtual_type): Return
+ builtin_type_vec128i for SSE registers.
+
+ * gdbtypes.h (builtin_type_vec128i): Declare.
+
+ * gdbtypes.c (build_builtin_type_vec128i): New function.
+ (builtin_type_v2_double, builtin_type_v4_int64): New types.
+ (builtin_type_vec128i): New type for SSE2 128-bit registers.
+ (build_gdbtypes): Initialize new builtin vector types.
+ (_initialize_gdbtypes): Register new vector types with gdbarch.
+
+2002-05-26 Jason Thorpe <thorpej@wasabisystems.com>
+
+ * MAINTAINERS: ns32k is not longer an obsolete candidate,
+ since it has been multi-arch'd.
+ * NEWS: Note that ns32k-*-* is now partial multi-arch.
+ Move Alpha and VAX multi-arch news entries to same section
+ as other multi-arch news.
+
+2002-05-26 Jason Thorpe <thorpej@wasabisystems.com>
+
+ * ns32k-tdep.c: include gdbtypes.h, inferior.h, regcache.h,
+ target.s, arch-utils.h, ns32k-tdep.h. Make many functions
+ static. Rename some register numbers to put them in ns32k-tdep
+ private namespace.
+ (ns32k_get_saved_register, ns32k_gdbarch_init_32082,
+ ns32k_gdbarch_init_32382, ns32k_gdbarch_init, ns32k_dump_tdep): New
+ functions.
+ (_initialize_ns32k_tdep): Use gdbarch_register.
+ * ns32k-tdep.h: New file.
+ * ns32knbsd-tdep.c: New file.
+ * config/ns32k/nbsdaout.mt (TDEPFILES): Add ns32knbsd-tdep.o.
+ * config/ns32k/tm-nbsd.h: Include "ns32k/tm-ns32k.h".
+ (IN_SOLIB_CALL_TRAMPOLINE, REGISTER_NAME, NUM_REGS,
+ REGISTER_BYTES, REGISTER_BYTE): Remove.
+ * config/ns32k/tm-ns32k.h: New file.
+ * config/ns32k/tm-umax.h: Remove.
+
+2002-05-26 Jason Thorpe <thorpej@wasabisystems.com>
+
+ * ns32k-tdep.c (ns32k_saved_pc_after_call,
+ ns32k_store_struct_return, ns32k_extract_return_value,
+ ns32k_store_return_value, ns32k_extract_struct_value_address): New
+ functions.
+ * config/ns32k/tm-umax.h (SAVED_PC_AFTER_CALL): Define as
+ ns32k_saved_pc_after_call.
+ (STORE_STRUCT_RETURN): Define as ns32k_store_struct_return.
+ (EXTRACT_RETURN_VALUE): Define as ns32k_extract_return_value.
+ (STORE_RETURN_VALUE): Define as ns32k_store_return_value.
+ (EXTRACT_STRUCT_VALUE_ADDRESS): Define as
+ ns32k_extract_struct_value_address.
+
+2002-05-26 Jason Thorpe <thorpej@wasabisystems.com>
+
+ * ns32k-tdep.c (ns32k_call_dummy_words, sizeof_ns32k_call_dummy_words,
+ ns32k_fix_call_dummy): New.
+ * config/ns32k/tm-umax.h (CALL_DUMMY_WORDS): Define as
+ ns32k_call_dummy_words.
+ (SIZEOF_CALL_DUMMY_WORDS): Define as sizeof_ns32k_call_dummy_words.
+ (CALL_DUMMY, CALL_DUMMY_LENGTH, CALL_DUMMY_ADDR,
+ CALL_DUMMY_NARGS): Remove.
+ (FIX_CALL_DUMMY): Define as ns32k_fix_call_dummy.
+
+2002-05-26 Jason Thorpe <thorpej@wasabisystems.com>
+
+ * ns32k-tdep.c (ns32k_breakpoint_from_pc, ns32k_frame_chain,
+ ns32k_frame_saved_pc, ns32k_frame_args_address,
+ ns32k_frame_locals_address, ns32k_frame_init_saved_regs,
+ ns32k_push_dummy_frame, ns32k_pop_frame): New functions.
+ * config/ns32k/tm-nbsd.h (FRAME_SAVED_PC): Remove.
+ * config/ns32k/tm-umax.h (INNER_THAN): Define as core_addr_lessthan.
+ (BREAKPOINT_FROM_PC): Define as ns32k_breakpoint_from_pc.
+ (BREAKPOINT): Remove..
+ (FRAME_CHAIN): Define as ns32k_frame_chain.
+ (FRAME_SAVED_PC): Define as ns32k_frame_saved_pc.
+ (FRAME_ARGS_ADDRESS): Define as ns32k_frame_args_address.
+ (FRAME_LOCALS_ADDRESS): Define as ns32k_frame_locals_address.
+ (FRAME_FIND_SAVED_REGS): Remove.
+ (FRAME_INIT_SAVED_REGS): Define as ns32k_frame_init_saved_regs.
+ (PUSH_DUMMY_FRAME): Define as ns32k_push_dummy_frame.
+ (POP_FRAME): Define as ns32k_pop_frame.
+
+2002-05-26 Jason Thorpe <thorpej@wasabisystems.com>
+
+ * ns32k-tdep.c (ns32k_register_byte_32082,
+ ns32k_register_byte_32382, ns32k_register_raw_size,
+ ns32k_register_virtual_size, ns32k_register_virtual_type): New
+ functions.
+ * config/ns32k/tm-nbsd.h (REGISTER_BYTE): Define as
+ ns32k_register_byte_32382.
+ * config/ns32k/tm-umax.h: Update copyright years.
+ (REGISTER_BYTE): Define as ns32k_register_byte_32082.
+ (REGISTER_RAW_SIZE): Define as ns32k_register_raw_size.
+ (REGISTER_VIRTUAL_SIZE): Define as ns32k_register_virtual_size.
+ (REGISTER_VIRTUAL_TYPE): Define as ns32k_register_virtual_type.
+ (ns32k_get_enter_addr): Fix prototype.
+
+2002-05-26 Jason Thorpe <thorpej@wasabisystems.com>
+
+ * ns32k-tdep.c: Update copyright years.
+ (ns32k_register_name_32082): New function.
+ (ns32k_register_name_32382): Ditto.
+ * config/ns32k/tm-nbsd.h (REGISTER_NAMES): Remove.
+ (REGISTER_NAME): Define as ns32k_register_name_32382.
+ * config/ns32k/tm-umax.h (REGISTER_NAMES): Remove.
+ (REGISTER_NAME): Define as ns32k_register_name_32082.
+
+2002-05-24 Jim Blandy <jimb@redhat.com>
+
+ * dwarf2read.c (free_line_header): Use xfree, not free.
+
+2002-05-24 Jason Thorpe <thorpej@wasabisystems.com>
+
+ * config/djgpp/fnchange.lst: Add alphabsd-nat.c,
+ alphabsd-tdep.c, mipsnbsd-nat.c, and mipsnbsd-tdep.c
+
+2002-05-23 Andrew Cagney <ac131313@redhat.com>
+
+ * PROBLEMS: Mention s390 and FreeBSD 4.4 build problems.
+
+2002-05-23 Andrew Cagney <ac131313@redhat.com>
+
+ From Ross Alexander at NEC Europe:
+ * config/pa/hpux11w.mh (NATDEPFILES): Add solib.o.
+
+2002-05-23 Michael Snyder <msnyder@redhat.com>
+
+ * cli/cli-dump.c (restore_command): Use parse_and_eval_long
+ for input, rather than parse_and_eval_address.
+
+2002-05-23 Andrew Cagney <ac131313@redhat.com>
+
+ * d10v-tdep.c: Include "gdb/sim-d10v.h" instead of "sim-d10v.h".
+ * Makefile.in (sim_d10v_h): Update definition.
+
+2002-05-24 Andrew Cagney <cagney@redhat.com>
+
+ * d10v-tdep.c (d10v_gdbarch_init): Revert old code included in
+ change `2002-05-22 Michael Snyder' below.
+ (d10v_push_arguments): Ditto.
+ (d10v_extract_return_value): Ditto.
+
+2002-05-23 Jim Blandy <jimb@redhat.com>
+
+ * macrotab.c (check_for_redefinition): Don't complain if the new
+ definition is the same as the previous one. Take more arguments
+ to allow the comparison.
+ (macro_define_object, macro_define_function): Pass more arguments
+ to check_for_redefinition.
+
+2002-05-22 Michael Snyder <msnyder@redhat.com>
+
+ * d10v-tdep.c: Change a few macros to enums for ease of debugging.
+ (d10v_frame_chain_valid): Add PC_IN_CALL_DUMMY clause.
+ (d10v_frame_saved_pc): Add PC_IN_CALL_DUMMY clause.
+ (d10v_frame_chain): Bail immediately if PC_IN_CALL_DUMMY.
+ Don't bail if return_pc is PC_IN_CALL_DUMMY.
+ Add a temp variable to save a call (and a memory read).
+ (d10v_init_extra_frame_info): Get fi->pc from callee's return_pc
+ if possible (so that PC_IN_CALL_DUMMY will work).
+
+2002-05-22 Corinna Vinschen <vinschen@redhat.com>
+
+ * MAINTAINERS: Remove status `OBSOLETE' from v850.
+
+2002-05-22 Michal Ludvig <mludvig@suse.cz>
+
+ * dwarf2cfi.c (frame_state_for): Added safety check for a valid
+ fde->cie_ptr.
+ (dwarf2_build_frame_info): Corrected handling of eh_frame.
+ (dwarf2_build_frame_info): Add offset to fde->initial_location
+ so that frames of shared libraries are mapped correctly.
+ (execute_stack_op): Change type of 'result' from ULONGEST to
+ CORE_ADDR.
+
+2002-05-22 Jason Thorpe <thorpej@wasabisystems.com>
+
+ * config/alpha/tm-nbsd.h: Include solib.h.
+
+2002-05-22 Jason Thorpe <thorpej@wasabisystems.com>
+
+ * alphanbsd-tdep.c (alphanbsd_sigtramp_offset): Don't make
+ assumptions about the host's byte order.
+
+2002-05-22 Jason Thorpe <thorpej@wasabisystems.com>
+
+ * Makefile.in (alphanbsd-tdep.o, shnbsd-tdep.o): Add solib-svr4.h
+ to dependency list.
+ * alphanbsd-tdep.c: Include solib-svr4.h.
+ * shnbsd-tdep.c: Ditto.
+
+2002-05-22 Jason Thorpe <thorpej@wasabisystems.com>
+
+ * Makefile.in (armnbsd-tdep.o): Add solib-svr4.h and
+ nbsd-tdep.h to dependency list.
+ * configure.host (arm*-*-netbsdelf*, arm*-*-netbsd*,
+ i[3456]86-*-netbsdaout*, i[3456]86-*-netbsd*, m68*-*-netbsd*,
+ ns32k-*-netbsd*, sparc-*-netbsdaout*, sparc-*-netbsd*): Use
+ nbsdaout.mh and nbsdelf.mh consistently.
+ * configure.tgt (i[3456]86-*-netbsd*, m68*-*-netbsd*,
+ ns32k-*-netbsd*, sparc-*-netbsdelf*, sparc-*-netbsd*) Use
+ nbsdaout.mt and nbsdelf.mh consistently.
+ * armnbsd-tdep.c: Include nbsd-tdep.h and solib-svr4.h.
+ (arm_netbsd_elf_init_abi): Use set_solib_svr4_fetch_link_map_offsets
+ to set nbsd_ilp32_solib_svr4_fetch_link_map_offsets.
+ * config/nm-nbsd.h: Garbage-collect SVR4_SHARED_LIBS. Move
+ a.out shared library stuff from here...
+ * config/nm-nbsdaout.h: ...to here.
+ * config/tm-nbsd.h: Remove.
+ * config/alpha/nm-nbsd.h (SVR4_SHARED_LIBS): Remove.
+ * config/arm/nbsd.mh: Remove.
+ * config/arm/nbsd.mt (TDEPFILES): Remove solib-sunos.o, add
+ nbsd-tdep.o.
+ * config/arm/nbsdaout.mh: New file.
+ * config/arm/nbsdelf.mh: New file.
+ * config/arm/nm-nbsdaout.h: New file.
+ * config/i386/nbsd.mh: Remove.
+ * config/i386/nbsd.mt: Remove.
+ * config/i386/nbsdaout.mh: New file.
+ * config/i386/nbsdaout.mt: New file.
+ * config/i386/nbsdelf.mh (NAT_FILE): Use nm-nbsd.h.
+ * config/i386/nbsdelf.mt (TM_FILE): Use tm-nbsd.h.
+ * config/i386/nm-nbsd.h (REGISTER_U_ADDR,
+ i386_register_u_addr): Remove.
+ * config/i386/nm-nbsdaout.h: New file.
+ * config/i386/nm-nbsdelf.h: Remove.
+ * config/i386/tm-nbsd.h: Don't include config/tm-nbsd.h.
+ (USE_STRUCT_CONVENTION): Remove.
+ * config/i386/tm-nbsdaout.h: New file.
+ * config/i386/tm-nbsdelf.h: Remove.
+ * config/m68k/nbsd.mh: Remove.
+ * config/m68k/nbsd.mt: Remove.
+ * config/m68k/nbsdaout.mh: New file.
+ * config/m68k/nbsdaout.mt: New file.
+ * config/m68k/nm-nbsd.h: Use config/nm-nbsd.h.
+ * config/m68k/nm-nbsdaout.h: New file.
+ * config/m68k/tm-nbsd.h: Don't include config/tm-nbsd.h.
+ (IN_SOLIB_CALL_TRAMPOLINE): Define.
+ * config/ns32k/nbsd.mh: Remove.
+ * config/ns32k/nbsd.mt: Remove.
+ * config/ns32k/nbsdaout.mh: New file.
+ * config/ns32k/nbsdaout.mt: New file.
+ * config/ns32k/nm-nbsd.h: Include config/nm-nbsd.h.
+ * config/ns32k/nm-nbsdaout.h: New file.
+ * config/ns32k/tm-nbsd.h: Don't include config/tm-nbsd.h.
+ (IN_SOLIB_CALL_TRAMPOLINE): Define.
+ * config/powerpc/nm-nbsd.h: Include config/nm-nbsd.h.
+ (SVR4_SHARED_LIBS): Remove.
+ * config/powerpc/tm-nbsd.h: Dont' include config/tm-nbsd.h.
+ * config/sparc/nbsd.mh: Remove.
+ * config/sparc/nbsd.mt: Remove.
+ * config/sparc/nbsdaout.mh: New file.
+ * config/sparc/nbsdaout.mt: New file.
+ * config/sparc/nbsdelf.mh (NAT_FILE): Use nm-nbsd.h.
+ * config/sparc/nbsdelf.mt: New file.
+ * config/sparc/nm-nbsdaout.h: New file.
+ * config/sparc/nm-nbsdelf.h: Remove.
+ * config/sparc/tm-nbsd.h: Don't include config/tm-nbsd.h.
+ * config/sparc/tm-nbsdaout.h: New file.
+
+2002-05-21 Jason Thorpe <thorpej@wasabisystems.com>
+
+ * Makefile.in (ALLDEPFILES): Add mipsnbsd-nat.c and
+ mipsnbsd-tdep.c
+ (mipsnbsd-nat.o, mipsnbsd-tdep.o): New dependency lists.
+
+2002-05-21 Jason Thorpe <thorpej@wasabisystems.com>
+
+ * Makefile.in (ALLDEPFILES): Add shnbsd-tdep.c and
+ shnbsd-nat.c.
+ (shnbsd-tdep.o, shnbsd-nat.o): New dependency lists.
+
+2002-05-21 Jason Thorpe <thorpej@wasabisystems.com>
+
+ * NEWS: Note new MIPS NetBSD native configuration.
+ * configure.host (mips*-*-netbsd*): New host.
+ * configure.tgt (mips*-*-netbsd*): New target.
+ * mipsnbsd-nat.c: New file.
+ * mipsnbsd-tdep.c: New file.
+ * mipsnbsd-tdep.h: New file.
+ * config/mips/nbsd.mh: New file.
+ * config/mips/nbsd.mt: New file.
+ * config/mips/nm-nbsd.h: New file.
+ * config/mips/tm-nbsd.h: New file.
+
+2002-05-21 Jason Thorpe <thorpej@wasabisystems.com>
+
+ * Makefile.in (SFILES): Add osabi.c.
+ (COMMON_OBS): Add osabi.o.
+ (osabi.o): New dependency list.
+ * osabi.c: New file.
+ * osabi.h: New file.
+ * doc/gdbint.texinfo: Document new generic OS ABI framework.
+
+ * Makefile.in (alpha_tdep_h): Define and use instead of
+ alpha-tdep.h.
+ * alpha-tdep.c (alpha_abi_names, process_note_abi_tag_sections,
+ get_elfosabi, alpha_abi_handler_list, alpha_gdbarch_register_os_abi):
+ Remove.
+ (alpha_gdbarch_init, alpha_dump_tdep): Use generic OS ABI framework.
+ * alpha-tdep.h: Include osabi.h.
+ (alpha_abi): Remove.
+ (gdbarch_tdep): Use generic OS ABI framework.
+ * alpha-linux-tdep.c (_initialize_alpha_linux_tdep): Use
+ gdbarch_register_osabi.
+ * alpha-osf1-tdep.c (_initialize_alpha_osf1_tdep): Likewise.
+ * alphafbsd-tdep.c (_initialize_alphafbsd_tdep): Likewise.
+ * alphanbsd-tdep.c (_initialize_alphanbsd_tdep): Likewise.
+
+ * Makefile.in (sh_tdep_h): Add osabi.h.
+ * sh-tdep.h (sh_osabi): Remove.
+ (gdbarch_tdep): Use generic OS ABI framework.
+ * sh-tdep.c (sh_osabi_names, process_note_abi_tag_sections,
+ sh_osabi_handler_list, sh_gdbarch_register_os_abi): Remove.
+ (sh_gdbarch_init, sh_dump_tdep): Use generic OS ABI framework.
+ * shnbsd-tdep.c (_initialize_shnbsd_tdep): Use gdbarch_register_osabi.
+
+ * Makefile.in (arm_tdep_h): Define and use instead of arm-tdep.h.
+ * arm-linux-tdep.c (_initialize_arm_linux_tdep): Use
+ gdbarch_register_osabi.
+ * arm-tdep.c (arm_abi_names, process_note_abi_tag_sections,
+ arm_abi_handler_list, arm_gdbarch_register_os_abi): Remove.
+ (get_elfosabi): Rename to...
+ (arm_elf_osabi_sniffer): ...this. Adjust to use generic OS
+ ABI framework support routines.
+ (arm_gdbarch_init): Use generic OS ABI framework.
+ (arm_dump_tdep): Likewise.
+ (_initialize_arm_tdep): Likewise.
+ * arm-tdep.h: Include osabi.h.
+ (arm_abi): Remove.
+ (gdbarch_tdep): Remove arm_abi and abi_name members. Add
+ osabi member.
+ (arm_gdbarch_register_os_abi): Remove prototype.
+ * armnbsd-tdep.c (arm_netbsd_aout_osabi_sniffer): New function.
+ (_initialize_arm_netbsd_tdep): Use gdbarch_register_osabi.
+
+ * Makefile.in (mips-tdep.o): Add osabi.h to dependency list.
+ * mips-tdep.c: Include osabi.h.
+ (gdbarch_tdep, mips_gdbarch_init, mips_dump_tdep): Use generic
+ OS ABI framework.
+
+2002-05-20 Kazu Hirata <kazu@cs.umass.edu>
+
+ * h8300-tdep.c: Fix formatting.
+
+2002-05-20 Elena Zannoni <ezannoni@redhat.com>
+
+ * rs6000-tdep.c (rs6000_do_registers_info): Simplify code for
+ printing vector registers.
+
+2002-05-19 Andrew Cagney <ac131313@redhat.com>
+
+ From Fernando Nasser:
+ * remote.c (remote_async_open_1): Re-throw the exception when the
+ connection fails.
+ (remote_cisco_open): Ditto.
+ (remote_open_1): Ditto.
+
+2002-05-19 Andrew Cagney <ac131313@redhat.com>
+
+ * remote.c (remote_start_remote_dummy): Add uiout parameter.
+ (remote_start_remote): Add uiout parameter. Pass through to
+ remote_start_remote_dummy.
+ (remote_open_1): Use catch_exception instead of catch_errors.
+ (remote_async_open_1): Ditto.
+ (remote_cisco_open): Ditto.
+
+2002-05-19 Andrew Cagney <ac131313@redhat.com>
+
+ * remote.c (remote_start_remote): Replace PTR with void pointer.
+ (sigint_remote_twice_token, sigint_remote_token): Ditto. Make
+ static.
+
+2002-05-18 Andrew Cagney <ac131313@redhat.com>
+
+ * gdb_indent.sh: Allow the script to be run in the sim directory.
+
+2002-05-18 Mark Kettenis <kettenis@gnu.org>
+
+ * config/i386/nm-cygwin.h (NO_PTRACE_H): Remove define.
+ * config/i386/nm-go32.h (NO_PTRACE_H): Remove define.
+
+ * corelow.c (core_open): Only call set_gdbarch_from_file if
+ exec_bfd is NULL.
+
+2002-05-17 Andrey Volkov <avolkov@transas.com>
+
+ * h8300-tdep.c: Add support of EXR register
+ * config/h8300/tm-h8300.h: Ditto.
+
+2002-05-17 Andrey Volkov <avolkov@transas.com>
+
+ * h8300-tdep.c: Add additional CCR flags (I,UI,H,U)
+
+2002-05-17 Andrey Volkov <avolkov@transas.com>
+
+ * h8300-tdep.c: Change literal regnums to REGNO.
+
+2002-05-17 Jim Blandy <jimb@redhat.com>
+
+ * NEWS: Note addition of macro support.
+
+ Expand preprocessor macros in C expressions.
+ * c-lang.h: #include "macroexp.h", for macro_lookup_ftype.
+ (scan_macro_expansion, scanning_macro_expansion,
+ finished_macro_expansion): New function declarations.
+ (expression_macro_lookup_func, expression_macro_lookup_baton): New
+ variable declarations.
+ * parser-defs.h (expression_context_pc): New declaration.
+ * parse.c (expression_context_pc): New variable.
+ (parse_exp_1): Set expression_context_pc, as well as
+ expression_context_block.
+ * c-exp.y (yylex): If we're not already reading the result of a
+ macro expansion, try to macro-expand the next token. When we're
+ done scanning a macro expansion, switch back to the mainline text.
+ Commas and `if's in a macro's expansion don't terminate the input.
+ * c-lang.c: #include "macroscope.h" and "gdb_assert.h".
+ (macro_original_text, macro_expanded_text,
+ expression_macro_lookup_func, expression_macro_lookup_baton): New
+ variables.
+ (scan_macro_expansion, scanning_macro_expansion,
+ finished_macro_expansion, scan_macro_cleanup, null_macro_lookup,
+ c_preprocess_and_parse): New functions.
+ (c_language_defn, cplus_language_defn, asm_language_defn): Call
+ c_preprocess_and_parse, instead of c_parse.
+ * Makefile.in (c_lang_h): Note that this #includes macroexp.h.
+ (c-lang.o): Note dependency on macroscope.h and gdb_assert.h.
+
+Fri May 17 14:26:19 2002 J"orn Rennecke <joern.rennecke@superh.com>
+
+ * sh-tdep.c (gdb_print_insn_sh64): Delete.
+ (gdb_print_insn_sh): Just set info->endian and use print_insn_sh.
+ (sh_gdbarch_init): Always use gdb_print_insn_sh.
+
+2002-05-17 Corinna Vinschen <vinschen@redhat.com>
+
+ * NEWS: Add section for multi-arched targets. Add v850 to that section.
+
+2002-05-17 Jason Thorpe <thorpej@wasabisystems.com>
+
+ * Makefile.in (sh_tdep_h): Define and use.
+ * config/sh/tm-sh.h (sh_osabi, sh_abi, gdbarch_tdep,
+ register enum): Move to...
+ * * sh-tdep.h: ...here.
+ * sh-tdep.c: Include sh-tdep.h.
+ * sh3-rom.c: Likewise.
+ * shnbsd-tdep.c: Likewise.
+
+2002-05-16 Michael Snyder <msnyder@redhat.com>
+
+ * arm-tdep.c: Spelling fix in comment.
+
+2002-05-16 Jim Blandy <jimb@redhat.com>
+
+ Add commands for manually expanding macros and showing their
+ definitions.
+ * macrocmd.c, macroscope.c, macroscope.h: New files.
+ * Makefile.in (SFILES): Add macrocmd.c, macroscope.c.
+ (macroscope_h): New variable.
+ (HFILES_NO_SRCDIR): Add macroscope.h.
+ (COMMON_OBS): Add macrocmd.o, macroscope.o.
+ (macroscope.o, macrocmd.o): New rules.
+
+ Teach the Dwarf 2 reader to read macro information.
+ * dwarf2read.c: #include "macrotab.h".
+ (dwarf_macinfo_buffer): New variable.
+ (struct dwarf2_pinfo): New members: dwarf_macinfo_buffer, and
+ dwarf_macinfo_size.
+ (DWARF_MACINFO_BUFFER, DWARF_MACINFO_SIZE): New macros.
+ (dwarf2_missing_macinfo_section, dwarf2_macros_too_long,
+ dwarf2_macros_not_terminated, dwarf2_macro_outside_file,
+ dwarf2_macro_unmatched_end_file, dwarf2_macro_malformed_definition,
+ dwarf2_macro_spaces_in_definition): New complaints.
+ (dwarf2_has_info): Initialize dwarf_macinfo_offset.
+ (dwarf2_build_psymtabs): Read the .dwarf_macinfo section.
+ (dwarf2_build_psymtabs_hard): Record the buffer and its size in
+ the partial symbol table.
+ (psymtab_to_symtab_1): Set the macinfo buffer and size globals
+ from what's recorded in the partial symbol table.
+ (read_file_scope): If the compilation unit has a
+ `DW_AT_macro_info' attribute, read its macro information.
+ * Makefile.in (dwarf2read.o): Depend on macrotab.h.
+
+2002-05-16 Daniel Jacobowitz <drow@mvista.com>
+
+ Fix PR gdb/546
+ * ser-tcp.c: Don't include <netinet/udp.h>.
+
+2002-05-16 Stephane Carrez <stcarrez@nerim.fr>
+
+ * MAINTAINERS: Update my email address.
+
+2002-05-16 Richard Earnshaw <rearnsha@arm.com>
+
+ * config/arm/nm-nbsd.h: Use "config/nm-nbsd.h" to include generic
+ include file of the same name.
+
+2002-05-16 Corinna Vinschen <vinschen@redhat.com>
+
+ * configure.tgt: Mark v850 as multi-arched.
+ * config/v850/tm-v850.h: Remove file.
+ * config/v850/v850.mt: Eliminate TM_FILE.
+
+2002-05-16 Corinna Vinschen <vinschen@redhat.com>
+
+ * v850-tdep.c: Full multi-arch.
+ * config/v850/tm-v850.h: Eliminate or move to v850-tdep.c everything.
+ Define GDB_MULTI_ARCH to 2.
+
+2002-05-16 Pierre Muller <muller@ics.u-strasbg.fr>
+
+ * p-exp.y (current_type): New static variable.
+ Carries the type of the expression at the position that is parsed.
+ (push_current_type, pop_current_type): Two new functions. Used
+ to store/restore current_type in expression on specific tokens.
+ (search_field): New static variable. Set to one after parsing a point
+ as at that point only a FIELDNAME token should be searched.
+ (FIELDNAME): New token. After a point only a token belonging to
+ current_type type definition is allowed.
+ (all over token rules): reset and change current_type according
+ to rules.
+ (exp '[' rule): insert implicit array index field if
+ exp is a pascal string type.
+
+2002-05-16 Corinna Vinschen <vinschen@redhat.com>
+
+ * v850-tdep.c: Fix comment for v850_scan_prologue. Remove extra
+ frame info. Use frame_info's saved_regs instead of matching member
+ in extra_frame_info throughout.
+ (v850_frame_init_saved_regs): New function.
+ (v850_init_extra_frame_info): Move most functionality into
+ v850_frame_init_saved_regs().
+ * config/v850/tm-v850.h (EXTRA_FRAME_INFO): Remove definition.
+ (v850_frame_find_saved_regs): Remove declaration.
+ (FRAME_FIND_SAVED_REGS): Remove definition.
+ (v850_frame_init_saved_regs): Add declaration.
+ (FRAME_INIT_SAVED_REGS): Add definition.
+
+2002-05-16 Corinna Vinschen <vinschen@redhat.com>
+
+ * v850-tdep.c: Begin multi-arch'ing v850.
+ (v850_target_architecture_hook): Remove function.
+ (v850_gdbarch_init): New function. Add code previously in
+ v850_target_architecture_hook().
+ (_initialize_v850_tdep): Don't set target_architecture_hook.
+ Call register_gdbarch_init() instead.
+
+2002-05-16 Daniel Jacobowitz <drow@mvista.com>
+
+ * gdbtypes.h (struct cplus_struct_type): Remove args field.
+ * hpread.c (hpread_read_struct_type): Remove assignments to args.
+ (fixup_class_method_type): Likewise.
+
+2002-05-15 Daniel Jacobowitz <drow@mvista.com>
+
+ From Martin Pool <mbp@samba.org>:
+ * gdbserver/server.c (gdbserver_usage): New function.
+ (main): Call it.
+
2002-05-15 Jim Blandy <jimb@redhat.com>
Add macro structures to GDB's symbol tables. Nobody puts anything
diff --git a/gdb/MAINTAINERS b/gdb/MAINTAINERS
index 0a4236c5ee5..f86c42c484f 100644
--- a/gdb/MAINTAINERS
+++ b/gdb/MAINTAINERS
@@ -112,7 +112,7 @@ maintainer works with the native maintainer when resolving API issues.
Not multi-arch
m68hc11 --target=m68hc11-elf ,-Werror
- Stephane Carrez Stephane.Carrez@worldnet.fr
+ Stephane Carrez stcarrez@nerim.fr
m68k --target=m68k-elf ,-Werror
Maintenance only
@@ -139,7 +139,6 @@ maintainer works with the native maintainer when resolving API issues.
ns32k --target=ns32k-netbsd ,-Werror
Maintenance only
- OBSOLETE candidate, not multi-arch
pa (--target=hppa1.1-hp-proelf broken)
Maintenance only
@@ -164,7 +163,6 @@ maintainer works with the native maintainer when resolving API issues.
v850 --target=v850-elf ,-Werror
Maintenance only
- OBSOLETE candidate, not multi-arch
vax --target=vax-dec-vms5.5 ,-Werror
Maintenance only
@@ -192,21 +190,36 @@ All recognized developers can make mechanical changes (by virtue of
the obvious fix rule) to ``maintenance only'' targets. The change
shall be sanity checked by compiling with one of the listed targets.
-The GAWK segment:
-
- awk < "${maintainers}" '
- $2 ~ /--target=.*/ {
- targets = gensub (/^.*--target=/, "", 1, $2)
- warnings = gensub (/[)]*$/, "", 1, $3)
- split (targets, targ, /,/)
- for (i in targ) {
- print targ[i], warnings
- }
- }'
-
-can be used to generate a full list of --target=
---enable-gdb-build-warnings= pairs.
-
+The Bourne shell script:
+
+cat MAINTAINERS | tr -s '[\t]' '[ ]' | sed -n '
+/^[ ]*[-a-z0-9\.]*[ ]*[(]*--target=.*/ !d
+s/^.*--target=//
+s/).*$//
+h
+:loop
+ g
+ /^[^ ]*,/ !b end
+ s/,[^ ]*//
+ p
+ g
+ s/^[^,]*,//
+ h
+b loop
+:end
+p
+'
+
+can be used to generate a complete list of --target=
+--enable-gdb-build-warnings= pairs of the form:
+
+ arc-elf ,-Werror
+ ...
+ hppa1.1-hp-proelf broken
+ ...
+
+While the ``broken'' targets are included in the listing, the are not
+expected to build.
Host/Native:
@@ -269,6 +282,8 @@ generic symtabs Jim Blandy jimb@redhat.com
linespec Jim Blandy jimb@redhat.com
Elena Zannoni ezannoni@redhat.com
Fernando Nasser fnasser@redhat.com
+ HP/UX readers Any [past] maintainer can modify this.
+ Please send tricky ones to the symtabs maintainers.
tracing bytecode stuff Jim Blandy jimb@redhat.com
tracing Michael Snyder msnyder@redhat.com
@@ -335,6 +350,8 @@ Makefile.in, configure* ALL
mmalloc/ ALL Host maintainers
+NEWS ALL
+
sim/ See sim/MAINTAINERS
readline/ Master version: ftp://ftp.cwru.edu/pub/bash/
@@ -351,16 +368,32 @@ To get recommended for the Write After Approval list you need a valid
FSF assignment and have submitted one good patch.
David Anderson davea@sgi.com
+Scott Bambrough scottb@netwinder.org
+Jim Blandy jimb@redhat.com
Philip Blundell philb@gnu.org
+Per Bothner per@bothner.com
Joel Brobecker brobecker@act-europe.fr
+Kevin Buettner kevinb@redhat.com
+Andrew Cagney ac131313@redhat.com
+Stephane Carrez stcarrez@nerim.fr
+Michael Chastain mec@shout.net
+Eric Christopher echristo@redhat.com
Nick Clifton nickc@redhat.com
+Philippe De Muyter phdm@macqel.be
Chris G. Demetriou cgd@broadcom.com
Klee Dienes kdienes@apple.com
+DJ Delorie dj@redhat.com
Richard Earnshaw rearnsha@arm.com
+Frank Ch. Eigler fche@redhat.com
+Ben Elliston bje@redhat.com
+Anthony Green green@redhat.com
Matthew Green mrg@eterna.com.au
+Chris Faylor cgf@redhat.com
+Fred Fish fnf@ninemoons.com
Orjan Friberg orjanf@axis.com
Ben Harris bjh21@netbsd.org
Richard Henderson rth@redhat.com
+Aldy Hernandez aldyh@redhat.com
Paul Hilfinger hilfinger@gnat.com
Matt Hiller hiller@redhat.com
Kazu Hirata kazu@hxi.com
@@ -371,33 +404,43 @@ Jim Ingham jingham@apple.com
Daniel Jacobowitz dan@debian.org
Andreas Jaeger aj@suse.de
Geoff Keating geoffk@redhat.com
+Mark Kettenis kettenis@gnu.org
Jim Kingdon jkingdon@engr.sgi.com ++
+Jeff Law law@redhat.com
Jonathan Larmour jlarmour@redhat.co.uk
+Robert Lipe rjl@sco.com
H.J. Lu hjl@lucon.org
+Michal Ludvig mludvig@suse.cz
Glen McCready gkm@redhat.com
Greg McGary greg@mcgary.org
Jason Merrill jason@redhat.com
+David S. Miller davem@redhat.com
Jason Molenda jmolenda@apple.com
Pierre Muller muller@sources.redhat.com
+Fernando Nasser fnasser@redhat.com
+David O'Brien obrien@freebsd.org
Alexandre Oliva aoliva@redhat.com
Tom Rix trix@redhat.com
Theodore A. Roth troth@verinet.com
+Ian Roxborough irox@redhat.com
Mark Salter msalter@redhat.com
+Peter Schauer Peter.Schauer@regent
Andreas Schwab schwab@suse.de
Keith Seitz keiths@redhat.com
Jiri Smid smid@suse.cz
David Smith dsmith@redhat.com
Stephen P. Smith ischis2@home.com
Jackie Smith Cashion jsmith@redhat.com
+Stan Shebs shebs@apple.com
+Michael Snyder msnyder@redhat.com
Petr Sorfa petrs@caldera.com
Gary Thomas gthomas@redhat.com
Jason Thorpe thorpej@wasabisystems.com
Tom Tromey tromey@redhat.com
Corinna Vinschen vinschen@redhat.com
Keith Walker keith.walker@arm.com
-Michal Ludvig mludvig@suse.cz
-David S. Miller davem@redhat.com
-Eric Christopher echristo@redhat.com
+Elena Zannoni ezannoni@redhat.com
+Eli Zaretskii eliz@gnu.org
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index e6d43ad25af..7b353bf74c6 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -530,7 +530,7 @@ SFILES = ax-general.c ax-gdb.c bcache.c blockframe.c breakpoint.c \
demangle.c dwarfread.c dwarf2read.c elfread.c environ.c eval.c \
event-loop.c event-top.c \
expprint.c f-exp.y f-lang.c f-typeprint.c f-valprint.c \
- findvar.c regcache.c gdbarch.c arch-utils.c gdbtypes.c \
+ findvar.c regcache.c gdbarch.c arch-utils.c gdbtypes.c osabi.c \
inf-loop.c infcmd.c inflow.c infrun.c language.c \
kod.c kod-cisco.c \
ui-out.c cli-out.c \
@@ -539,7 +539,7 @@ SFILES = ax-general.c ax-gdb.c bcache.c blockframe.c breakpoint.c \
m2-exp.y m2-lang.c m2-typeprint.c m2-valprint.c main.c maint.c \
memattr.c mem-break.c minsyms.c mipsread.c nlmread.c objfiles.c \
p-exp.y p-lang.c p-typeprint.c p-valprint.c parse.c \
- macrotab.c macroexp.c \
+ macrotab.c macroexp.c macrocmd.c macroscope.c \
printcmd.c remote.c remote-nrom.c scm-exp.c scm-lang.c \
scm-valprint.c source.c stabsread.c stack.c symfile.c \
symmisc.c symtab.c linespec.c target.c thread.c top.c tracepoint.c \
@@ -568,11 +568,13 @@ LINTFILES = $(SFILES) $(YYFILES) $(CONFIG_SRCS) init.c
getopt_h = $(INCLUDE_DIR)/getopt.h
floatformat_h = $(INCLUDE_DIR)/floatformat.h
bfd_h = $(BFD_DIR)/bfd.h
+callback_h = $(INCLUDE_DIR)/gdb/callback.h
dis_asm_h = $(INCLUDE_DIR)/dis-asm.h
-remote_sim_h = $(INCLUDE_DIR)/remote-sim.h
+remote_sim_h = $(INCLUDE_DIR)/gdb/remote-sim.h
demangle_h = $(INCLUDE_DIR)/demangle.h
obstack_h = $(INCLUDE_DIR)/obstack.h
-sim_d10v_h = $(INCLUDE_DIR)/sim-d10v.h
+sim_arm_h = $(INCLUDE_DIR)/gdb/sim-arm.h
+sim_d10v_h = $(INCLUDE_DIR)/gdb/sim-d10v.h
splay_tree_h = $(INCLUDE_DIR)/splay-tree.h
readline_headers = \
@@ -593,14 +595,16 @@ xm_h = @xm_h@
tm_h = @tm_h@
nm_h = @nm_h@
+alpha_tdep_h = alpha-tdep.h osabi.h
annotate_h = annotate.h $(symtab_h) $(gdbtypes_h)
arch_utils_h = arch-utils.h
+arm_tdep_h = arm-tdep.h osabi.h
ax_h = ax.h $(doublest_h)
bcache_h = bcache.h
builtin_regs_h = builtin-regs.h
breakpoint_h = breakpoint.h $(frame_h) $(value_h)
buildsym_h = buildsym.h
-c_lang_h = c-lang.h $(value_h)
+c_lang_h = c-lang.h $(value_h) $(macroexp_h)
call_cmds_h = call-cmds.h
cli_cmds_h = $(srcdir)/cli/cli-cmds.h
cli_decode_h = $(srcdir)/cli/cli-decode.h $(command_h)
@@ -633,21 +637,28 @@ gdbcmd_h = gdbcmd.h $(command_h) $(ui_out_h)
gdbcore_h = gdbcore.h $(bfd_h)
gdbthread_h = gdbthread.h $(breakpoint_h)
gdbtypes_h = gdbtypes.h
+i386_tdep_h = i386-tdep.h
+i386_linux_tdep_h = i386-linux-tdep.h
+i387_tdep_h = i387-tdep.h
inf_loop_h = inf-loop.h
inferior_h = inferior.h $(breakpoint_h)
language_h = language.h
linespec_h = linespec.h
macroexp_h = macroexp.h
macrotab_h = macrotab.h $(obstack_h) $(bcache_h)
+macroscope_h = macroscope.h $(macrotab_h) $(symtab_h)
memattr_h = memattr.h
monitor_h = monitor.h
objfiles_h = objfiles.h
parser_defs_h = parser-defs.h $(doublest_h)
+ppc_tdep_h = ppc-tdep.h osabi.h
regcache_h = regcache.h
remote_h = remote.h
remote_utils_h = remote-utils.h $(target_h)
ser_unix_h = ser-unix.h
serial_h = serial.h
+sh_tdep_h = sh-tdep.h osabi.h
+sim_regno_h = sim-regno.h
solist_h = solist.h
source_h = source.h
stabsread_h = stabsread.h
@@ -677,7 +688,7 @@ HFILES_NO_SRCDIR = bcache.h buildsym.h call-cmds.h coff-solib.h defs.h \
gdb-stabs.h $(inferior_h) language.h minimon.h monitor.h \
objfiles.h parser-defs.h serial.h solib.h \
symfile.h stabsread.h target.h terminal.h typeprint.h xcoffsolib.h \
- macrotab.h macroexp.h \
+ macrotab.h macroexp.h macroscope.h \
c-lang.h ch-lang.h f-lang.h \
jv-lang.h \
m2-lang.h p-lang.h \
@@ -720,9 +731,9 @@ COMMON_OBS = version.o blockframe.o breakpoint.o findvar.o regcache.o \
source.o values.o eval.o valops.o valarith.o valprint.o printcmd.o \
symtab.o symfile.o symmisc.o linespec.o infcmd.o infrun.o \
expprint.o environ.o stack.o thread.o \
- macrotab.o macroexp.o \
+ macrotab.o macrocmd.o macroexp.o macroscope.o \
event-loop.o event-top.o inf-loop.o completer.o \
- gdbarch.o arch-utils.o gdbtypes.o copying.o $(DEPFILES) \
+ gdbarch.o arch-utils.o gdbtypes.o osabi.o copying.o $(DEPFILES) \
memattr.o mem-break.o target.o parse.o language.o $(YYOBJ) buildsym.o \
builtin-regs.o std-regs.o \
signals.o \
@@ -837,7 +848,16 @@ uninstall: force $(CONFIG_UNINSTALL)
# list includes a file twice (because of some mistake somewhere else)
# the _initialize_* function will be included twice in init.c. Second,
# init.c may force unnecessary files to be linked in.
-#
+
+# FIXME: cagney/2002-06-09: gdb/564: gdb/563: Force the order so that
+# the first call is to _initialize_gdbtypes. This is a hack to ensure
+# that all the architecture dependant global builtin_type_* variables
+# are initialized before anything else (per-architecture code is
+# called in the same order that it is registered). The ``correct
+# fix'' is to have all the builtin types made part of the architecture
+# and initialize them on-demand (using gdbarch_data) just like
+# everything else. The catch is that other modules still take the
+# address of these builtin types forcing them to be variables, sigh!
INIT_FILES = $(OBS) $(TSOBS) $(CONFIG_OBS) $(CONFIG_INITS)
init.c: $(INIT_FILES)
@@ -862,7 +882,8 @@ init.c: $(INIT_FILES)
-e 's,signals\.c,signals/signals\.c,' \
-e 's|\([^ ][^ ]*\)|$(srcdir)/\1|g' | \
while read f; do grep '^_initialize_[a-z_0-9A-Z]* *(' $$f 2>/dev/null; done | \
- sed -e 's/^.*://' -e 's/^\([a-z_0-9A-Z]*\).*/\1/' > init.l-tmp
+ sed -e 's/^.*://' -e 's/^\([a-z_0-9A-Z]*\).*/\1/' | \
+ ( echo _initialize_gdbtypes ; grep -v -e '^_initialize_gdbtypes$$' ) > init.l-tmp
@echo '/* Do not modify this file. */' >>init.c-tmp
@echo '/* It is created automatically by the Makefile. */'>>init.c-tmp
@echo '#include "defs.h"' >>init.c-tmp
@@ -1215,12 +1236,14 @@ ALLDEPFILES = 29k-share/udi/udip2soc.c 29k-share/udi/udr.c \
mips-linux-nat.c mips-linux-tdep.c \
mips-nat.c \
mips-tdep.c mipsm3-nat.c mipsv4-nat.c \
+ mipsnbsd-nat.c mipsnbsd-tdep.c \
nbsd-tdep.c \
nindy-share/Onindy.c nindy-share/nindy.c \
nindy-share/ttyflush.c nindy-tdep.c \
ns32k-tdep.c solib-osf.c \
somread.c somsolib.c $(HPREAD_SOURCE) \
- ppc-linux-nat.c ppc-linux-tdep.c \
+ ppc-sysv-tdep.o ppc-linux-nat.c ppc-linux-tdep.c \
+ ppcnbsd-nat.o ppcnbsd-tdep.o \
procfs.c \
remote-adapt.c remote-array.c remote-bug.c remote-e7000.c remote-eb.c \
remote-es.c remote-hms.c remote-mips.c \
@@ -1230,8 +1253,10 @@ ALLDEPFILES = 29k-share/udi/udip2soc.c 29k-share/udi/udr.c \
rs6000-nat.c rs6000-tdep.c \
s390-tdep.c s390-nat.c \
ser-go32.c ser-pipe.c ser-tcp.c \
- sh-tdep.c solib.c solib-svr4.c solib-sunos.c sparc-linux-nat.c \
+ sh-tdep.c shnbsd-tdep.c shnbsd-nat.c \
+ solib.c solib-svr4.c solib-sunos.c sparc-linux-nat.c \
sparc-nat.c \
+ sparc64nbsd-nat.c sparcnbsd-nat.c sparcnbsd-tdep.c \
sparc-tdep.c sparcl-tdep.c sun3-nat.c \
symm-tdep.c symm-nat.c \
vax-tdep.c \
@@ -1254,44 +1279,45 @@ a68v-nat.o: a68v-nat.c $(defs_h) $(gdbcore_h) $(inferior_h) \
$(regcache_h)
alpha-nat.o: alpha-nat.c $(defs_h) $(gdbcore_h) $(inferior_h) $(target_h) \
- $(regcache_h) alpha-tdep.h
+ $(regcache_h) $(alpha_tdep_h)
alphabsd-nat.o: alphabsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) \
- alpha-tdep.h alphabsd-tdep.h
+ $(alpha_tdep_h) alphabsd-tdep.h
alpha-tdep.o: alpha-tdep.c $(defs_h) $(gdbcmd_h) $(gdbcore_h) \
$(inferior_h) $(symtab_h) $(dis_asm_h) $(gdb_string_h) $(linespec_h) \
- $(regcache_h) $(doublest_h) $(BFD_SRC)/elf-bfd.h alpha-tdep.h
+ $(regcache_h) $(doublest_h) $(BFD_SRC)/elf-bfd.h $(alpha_tdep_h)
-alpha-linux-tdep.o: alpha-linux-tdep.c $(defs_h) $(value_h) alpha-tdep.h
+alpha-linux-tdep.o: alpha-linux-tdep.c $(defs_h) $(value_h) $(alpha_tdep_h)
-alpha-osf1-tdep.o: alpha-osf1-tdep.c $(defs_h) $(value_h) alpha-tdep.h
+alpha-osf1-tdep.o: alpha-osf1-tdep.c $(defs_h) $(value_h) $(alpha_tdep_h)
alphabsd-tdep.o: alphabsd-tdep.c $(defs_h) $(regcache_h) alphabsd-tdep.h
-alphafbsd-tdep.o: alphafbsd-tdep.c $(defs_h) $(value_h) alpha-tdep.h
+alphafbsd-tdep.o: alphafbsd-tdep.c $(defs_h) $(value_h) $(alpha_tdep_h)
alphanbsd-tdep.o: alphanbsd-tdep.c $(defs_h) $(gdbcore_h) $(regcache_h) \
- $(value_h) alpha-tdep.h alphabsd-tdep.h nbsd-tdep.h
+ $(value_h) $(alpha_tdep_h) solib-svr4.h alphabsd-tdep.h nbsd-tdep.h
annotate.o: annotate.c $(defs_h) $(annotate_h) $(value_h) $(target_h) $(gdbtypes_h)
arm-linux-nat.o: arm-linux-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) \
- $(gdb_string_h) $(regcache_h) arm-tdep.h
+ $(gdb_string_h) $(regcache_h) $(arm_tdep_h)
arm-linux-tdep.o: arm-linux-tdep.c $(defs_h) $(target_h) $(value_h) \
- $(gdbtypes_h) $(floatformat_h) $(regcache_h) $(doublest_h) arm-tdep.h
+ $(gdbtypes_h) $(floatformat_h) $(regcache_h) $(doublest_h) $(arm_tdep_h)
arm-tdep.o: arm-tdep.c $(defs_h) $(frame_h) $(inferior_h) $(gdbcmd_h) \
$(gdbcore_h) $(gdb_string_h) $(dis_asm_h) $(regcache_h) $(doublest_h) \
- $(value_h) $(arch_utils_h) $(solib_svr4_h) arm-tdep.h \
+ $(value_h) $(arch_utils_h) $(solib_svr4_h) $(arm_tdep_h) \
$(BFD_SRC)/elf-bfd.h $(INCLUDE_DIR)/coff/internal.h \
- $(INCLUDE_DIR)/elf/arm.h
+ $(INCLUDE_DIR)/elf/arm.h $(sim_arm_h) $(gdb_assert_h)
-armnbsd-nat.o: armnbsd-nat.c $(defs_h) arm-tdep.h $(inferior_h) $(regcache_h) \
- $(gdbcore_h)
+armnbsd-nat.o: armnbsd-nat.c $(defs_h) $(arm_tdep_h) $(inferior_h) \
+ $(regcache_h) $(gdbcore_h)
-armnbsd-tdep.o: armnbsd-tdep.c $(defs_h) arm-tdep.h
+armnbsd-tdep.o: armnbsd-tdep.c $(defs_h) $(arm_tdep_h) solib-svr4.h \
+ nbsd-tdep.h
avr-tdep.o: avr-tdep.c $(defs_h) $(gdbcmd_h) $(gdbcore_h) $(inferior_h) \
$(symfile_h) $(regcache_h) $(arch_utils_h)
@@ -1316,7 +1342,8 @@ builtin-regs.o: builtin-regs.c $(defs.h) $(builtin_regs_h) $(gdbtypes_h) \
$(gdb_string_h) $(value_h) $(frame_h)
c-lang.o: c-lang.c $(c_lang_h) $(defs_h) $(expression_h) $(gdbtypes_h) \
- $(language_h) $(parser_defs_h) $(symtab_h)
+ $(language_h) $(parser_defs_h) $(symtab_h) $(macroscope_h) \
+ gdb_assert.h
c-typeprint.o: c-typeprint.c $(c_lang_h) $(defs_h) $(expression_h) \
$(gdbcmd_h) $(gdbcore_h) $(gdbtypes_h) $(language_h) $(symtab_h) \
@@ -1397,7 +1424,8 @@ dcache.o: dcache.c $(dcache_h) $(defs_h) $(gdbcmd_h) $(gdb_string_h) \
d10v-tdep.o: d10v-tdep.c $(defs_h) $(frame_h) $(obstack_h) $(symtab_h) \
$(gdbtypes_h) $(gdbcmd_h) $(gdbcore_h) $(gdb_string_h) $(value_h) \
$(inferior_h) $(dis-asm_h) $(symfile_h) $(objfiles_h) $(language_h) \
- $(arch_utils_h) $(regcache_h) $(floatformat_h) $(sim_d10v_h)
+ $(arch_utils_h) $(regcache_h) $(floatformat_h) $(sim_d10v_h) \
+ $(sim_regno_h)
dbxread.o: dbxread.c $(breakpoint_h) $(buildsym_h) $(command_h) \
$(complaints_h) $(defs_h) $(expression_h) $(gdb_stabs_h) $(gdbcore_h) \
@@ -1426,7 +1454,7 @@ dwarfread.o: dwarfread.c $(bfd_h) $(buildsym_h) $(complaints_h) $(defs_h) \
dwarf2read.o: dwarf2read.c $(bfd_h) $(buildsym_h) $(defs_h) \
$(expression_h) $(gdbtypes_h) $(language_h) $(objfiles_h) \
- $(symfile_h) $(symtab_h) $(gdb_string_h)
+ $(symfile_h) $(symtab_h) $(gdb_string_h) $(macrotab_h)
elfread.o: elfread.c $(bfd_h) $(buildsym_h) $(complaints_h) $(defs_h) \
$(gdb_stabs_h) $(objfiles_h) $(symfile_h) $(symtab_h) $(gdb_string_h) \
@@ -1576,12 +1604,14 @@ arch-utils.o: arch-utils.c $(defs_h) $(bfd_h) $(gdbcmd_h) \
$(arch_utils_h) $(gdb_assert_h) $(inferior_h) \
$(gdb_string_h) $(symtab.h) $(frame_h) $(breakpoint_h) $(gdb_wait_h) \
$(gdbcore_h) $(target_h) $(annotate_h) $(regcache_h) $(gdb_assert_h) \
- $(version_h) $(floatformat_h)
+ $(version_h) $(floatformat_h) $(sim_regno_h)
gdbtypes.o: gdbtypes.c $(bfd_h) $(complaints_h) $(defs_h) $(expression_h) \
$(gdbtypes_h) $(language_h) $(objfiles_h) $(symfile_h) $(symtab_h) \
$(target_h) $(value_h) $(gdb_string_h) $(wrapper_h) $(cp_abi_h)
+osabi.o: osabi.c $(defs_h) $(BFD_SRC)/elf-bfd.h
+
go32-nat.o: go32-nat.c $(defs_h) $(inferior_h) $(gdb_wait_h) $(gdbcore_h) \
$(command_h) $(floatformat_h) $(target_h) i387-tdep.h $(regcache_h)
@@ -1650,7 +1680,8 @@ i386v-nat.o: i386v-nat.c $(floatformat_h) $(defs_h) $(gdbcore_h) \
$(inferior_h) $(language_h) $(target_h)
i386-linux-nat.o: i386-linux-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) \
- $(symtab_h) $(symfile_h) $(objfiles_h) $(regcache_h)
+ $(symtab_h) $(symfile_h) $(objfiles_h) $(regcache_h) \
+ $(i386_linux_tdep_h) $(i386_tdep_h) $(i387_tdep_h)
i386-linux-tdep.o: i386-linux-tdep.c $(defs_h) $(gdbcore_h) $(frame_h) \
$(value_h) $(regcache_h)
@@ -1808,7 +1839,8 @@ mips-nat.o: mips-nat.c $(defs_h) $(gdbcore_h) $(inferior_h) $(regcache_h)
mips-tdep.o: mips-tdep.c $(defs_h) $(gdbcmd_h) $(gdbcore_h) \
$(arch_utils_h) $(regcache_h) \
- $(inferior_h) $(language_h) $(objfiles_h) $(symfile_h) $(gdb_string_h)
+ $(inferior_h) $(language_h) $(objfiles_h) $(symfile_h) \
+ $(gdb_string_h) osabi.h
mipsread.o: mipsread.c $(buildsym_h) $(complaints_h) $(bfd_h) $(defs_h) \
$(expression_h) $(gdb_stabs_h) $(gdbcore_h) $(gdbtypes_h) \
@@ -1818,6 +1850,12 @@ mipsread.o: mipsread.c $(buildsym_h) $(complaints_h) $(bfd_h) $(defs_h) \
mipsv4-nat.o: mipsv4-nat.c $(defs_h) $(gdbcore_h) $(inferior_h) $(target_h) \
$(regcache_h)
+mipsnbsd-nat.o: mipsnbsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) \
+ mipsnbsd-tdep.h
+
+mipsnbsd-tdep.o: mipsnbsd-tdep.c $(defs_h) $(gdbcore_h) $(regcache_h) \
+ $(target_h) $(value_h) osabi.h solib-svr4.h mipsnbsd-tdep.h
+
mn10300-tdep.o: mn10300-tdep.c $(defs_h) $(frame_h) $(inferior_h) \
$(obstack_h) $(target_h) $(value_h) $(bfd_h) $(gdb_string_h) \
$(gdbcore_h) $(symfile_h) $(regcache_h) $(arch-utils.h)
@@ -1882,10 +1920,20 @@ ppc-bdm.o: ppc-bdm.c $(defs_h) $(gdbcore_h) $(gdb_string_h) $(frame_h) \
$(objfiles_h) $(gdb_stabs_h) $(serial_h) ocd.h $(regcache_h)
ppc-linux-nat.o: ppc-linux-nat.c $(defs_h) $(gdbcore_h) $(frame_h) \
- $(inferior_h) $(target_h) $(regcache_h) ppc-tdep.h
+ $(inferior_h) $(target_h) $(regcache_h) $(ppc_tdep_h)
ppc-linux-tdep.o: ppc-linux-tdep.c $(defs_h) $(gdbcore_h) $(inferior_h) \
- $(target_h) ppc-tdep.h $(regcache_h) $(value_h)
+ $(target_h) $(ppc_tdep_h) $(regcache_h) $(value_h)
+
+ppc-sysv-tdep.o: ppc-sysv-tdep.c $(defs_h) $(gdbcore_h) $(inferior_h) \
+ $(value_h) $(regcache_h) $(ppc_tdep_h)
+
+ppcnbsd-nat.o: ppcnbsd-nat.c $(defs_h) $(inferior_h) $(ppc_tdep_h) \
+ ppcnbsd-tdep.h
+
+ppcnbsd-tdep.o: ppcnbsd-tdep.c $(defs_h) $(gdbcore_h) $(regcache_h) \
+ $(target_h) $(breakpoint_h) $(value_h) $(ppc_tdep_t) ppcnbsd-tdep.h \
+ nbsd-tdep.h
ppcbug-rom.o: ppcbug-rom.c $(monitor_h) $(bfd_h) $(gdb_wait_h) $(defs_h) \
$(gdbcmd_h) $(inferior_h) $(target_h) $(serial_h) $(terminal_h) \
@@ -1930,7 +1978,7 @@ remote-array.o: remote-array.c $(defs_h) $(gdbcore_h) $(target_h) \
$(version_h) $(regcache_h)
remote-rdi.o: remote-rdi.c $(defs_h) $(gdbcore_h) \
- $(inferior_h) $(gdb_string_h) $(completer_h) arm-tdep.h
+ $(inferior_h) $(gdb_string_h) $(completer_h) $(arm_tdep_h)
rdi-share/libangsd.a: force
@dir=rdi-share; \
@@ -1943,7 +1991,7 @@ rdi-share/libangsd.a: force
fi
remote-rdp.o: remote-rdp.c $(defs_h) $(gdbcore_h) \
- $(inferior_h) $(gdb_string_h) arm-tdep.h
+ $(inferior_h) $(gdb_string_h) $(arm_tdep_h) $(callback_h)
remote-bug.o: remote-bug.c $(defs_h) $(gdbcore_h) $(serial_h) \
$(inferior_h) $(target_h) $(terminal_h) $(remote_utils_h) \
@@ -1980,8 +2028,9 @@ remote-sds.o: remote-sds.c $(bfd_h) $(defs_h) $(gdbcmd_h) \
$(gdb_string_h) $(regcache_h)
remote-sim.o: remote-sim.c $(defs_h) $(inferior_h) $(value_h) $(gdb_string_h) \
- $(terminal_h) $(target_h) $(gdbcore_h) $(INCLUDE_DIR)/callback.h \
- $(remote_sim_h) $(remote_utils_h) $(command_h) $(regcache_h)
+ $(terminal_h) $(target_h) $(gdbcore_h) $(callback_h) \
+ $(remote_sim_h) $(remote_utils_h) $(command_h) $(regcache_h) \
+ $(sim_regno_h)
remote-st.o: remote-st.c $(defs_h) $(gdbcore_h) $(serial_h) \
$(target_h) $(gdb_string_h) $(regcache_h)
@@ -2021,7 +2070,7 @@ rs6000-nat.o: rs6000-nat.c $(bfd_h) $(defs_h) $(inferior_h) $(target_h) \
$(gdb_stabs_h) $(regcache_h) $(arch_utils_h)
rs6000-tdep.o: rs6000-tdep.c $(defs_h) $(gdbcore_h) $(inferior_h) \
- $(target_h) ppc-tdep.h $(regcache_h) $(value_h) $(parser_defs_h)
+ $(target_h) $(ppc_tdep_h) $(regcache_h) $(value_h) $(parser_defs_h)
s390-tdep.o: s390-tdep.c $(defs_h) $(arch_utils_h) $(frame_h) $(inferior_h) \
$(symtab_h) $(target_h) $(gdbcore_h) $(gdbcmd_h) $(symfile_h) \
@@ -2051,11 +2100,16 @@ serial.o: serial.c $(defs_h) $(serial_h) $(gdb_string_h)
sh-tdep.o: sh-tdep.c $(bfd_h) $(dis_asm_h) \
$(srcdir)/../opcodes/sh-opc.h $(defs_h) $(expression_h) $(frame_h) \
$(gdbcmd_h) $(gdbtypes_h) $(symtab_h) $(value_h) $(arch_utils_h) \
- $(regcache_h) $(doublest_h)
+ $(regcache_h) $(doublest_h) $(sh_tdep_h)
+
+shnbsd-tdep.o: shnbsd-tdep.c $(defs_h) $(gdbcore_h) $(regcache_h) \
+ $(value_h) $(sh_tdep_h) solib-svr4.h shnbsd-tdep.h nbsd-tdep.h
+
+shnbsd-nat.o: shnbsd-nat.c $(defs_h) $(inferior_h) shnbsd-tdep.h
sh3-rom.o: sh3-rom.c $(monitor_h) $(bfd_h) $(gdb_wait_h) $(defs_h) $(gdbcmd_h) \
$(inferior_h) $(target_h) $(serial_h) $(terminal_h) $(arch_utils_h) \
- $(regcache_h)
+ $(regcache_h) $(sh_tdep_h)
signals.o: signals/signals.c $(defs_h) $(target_h)
$(CC) -c $(INTERNAL_CFLAGS) $<
@@ -2087,10 +2141,20 @@ sparc-nat.o: sparc-nat.c $(bfd_h) $(defs_h) $(inferior_h) $(gdbcore_h) \
sparc-tdep.o: sparc-tdep.c $(floatformat_h) $(defs_h) $(gdbcore_h) \
$(inferior_h) $(objfiles_h) $(symfile_h) $(target_h) $(gdb_string_h) \
- $(arch_utils_h) $(regcache_h)
+ $(arch_utils_h) $(regcache_h) osabi.h
sparcl-tdep.o: sparcl-tdep.c $(defs_h) $(gdbcore_h) $(target_h) $(regcache_h)
+sparc64nbsd-nat.o: sparc64nbsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) \
+ sparcnbsd-tdep.h
+
+sparcnbsd-nat.o: sparcnbsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) \
+ sparcnbsd-tdep.h
+
+sparcnbsd-tdep.o: sparcnbsd-tdep.c $(defs_h) $(gdbcore_h) $(regcache_h) \
+ $(target_h) $(value_h) osabi.h sparcnbsd-tdep.h nbsd-tdep.h \
+ solib-svr4.h
+
xstormy16-tdep.o: xstormy16-tdep.c $(defs_h) $(value_h) $(inferior_h) \
$(symfile_h) $(arch_utils_h) $(regcache_h) $(gdbcore_h)
@@ -2142,6 +2206,11 @@ macroexp.o: macroexp.c $(defs_h) $(macrotab_h)
macrotab.o: macrotab.c $(defs_h) $(obstack_h) $(objfiles_h) $(symtab_h) \
$(macrotab_h) $(splay_tree_h) gdb_assert.h $(bcache_h)
+macroscope.o: macroscope.c $(defs_h) $(macroscope_h)
+
+macrocmd.o: macrocmd.c $(defs_h) $(macrotab_h) $(macroexp_h) \
+ $(macroscope_h) $(command_h) $(gdbcmd_h)
+
target.o: target.c $(bfd_h) $(defs_h) $(gdbcmd_h) $(inferior_h) \
$(objfiles_h) $(symfile_h) $(target_h) $(gdb_string_h) $(regcache_h)
diff --git a/gdb/NEWS b/gdb/NEWS
index 7e84b2f785a..95dcf3cab0f 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -3,6 +3,41 @@
*** Changes since GDB 5.2:
+* ``gdbserver'' now supports multithreaded applications on some targets
+
+Support for multithreaded applications using LinuxThreads has been added
+for arm*-*-linux*, i[3456]86-*-linux*, mips*-*-linux*, powerpc*-*-linux*,
+and sh*-*-linux*.
+
+* GDB now supports C/C++ preprocessor macros.
+
+GDB now expands preprocessor macro invocations in C/C++ expressions,
+and provides various commands for showing macro definitions and how
+they expand.
+
+Most compilers don't include information about macros in the debugging
+information by default. In GCC 3.1, for example, you need to compile
+your program with the options `-gdwarf-2 -g3'. If the macro
+information is present in the executable, GDB will read it.
+
+Here are the new commands for working with macros:
+
+** macro expand EXPRESSION
+
+Expand any macro invocations in expression, and show the result.
+
+** show macro MACRO-NAME
+
+Show the definition of the macro named MACRO-NAME, and where it was
+defined.
+
+* Multi-arched targets.
+
+DEC Alpha (partial) alpha*-*-*
+DEC VAX (partial) vax-*-*
+NEC V850 v850-*-*
+National Semiconductor NS32000 (partial) ns32k-*-*
+
* New targets.
Atmel AVR avr*-*-*
@@ -11,6 +46,8 @@ Atmel AVR avr*-*-*
Alpha NetBSD alpha*-*-netbsd*
SH NetBSD sh*-*-netbsdelf*
+MIPS NetBSD mips*-*-netbsd*
+UltraSPARC NetBSD sparc64-*-netbsd*
* OBSOLETE configurations and files
@@ -29,14 +66,6 @@ AMD 29000 embedded with a.out a29k-none-aout
testsuite/gdb.hp/gdb.threads-hp/ directory
-* Changes in VAX configurations.
-
-Multi-arch support is enabled for all VAX configurations.
-
-* Changes in Alpha configurations.
-
-Multi-arch support is enabled for all Alpha configurations.
-
* New command "set max-user-call-depth <nnn>"
This command allows the user to limit the call depth of user-defined
diff --git a/gdb/PROBLEMS b/gdb/PROBLEMS
index 09c62e1712f..49d27967daa 100644
--- a/gdb/PROBLEMS
+++ b/gdb/PROBLEMS
@@ -18,3 +18,15 @@ can be specified as part of the configuration vis:
$ 'CC=cc -Ae' ./configure
+s390*-*-*
+---------
+
+gdb/513: GDB does not build on s390 GNU/Linux. The problem should be
+fixed in more recent sources.
+
+
+i386-*-freebsd4.4*
+------------------
+
+gdb/455: GDB doesn't build on a FreeBSD 4.4-STABLE system. The
+problem is still being investigated.
diff --git a/gdb/ada-exp.tab.c b/gdb/ada-exp.tab.c
new file mode 100644
index 00000000000..bb6d29bf276
--- /dev/null
+++ b/gdb/ada-exp.tab.c
@@ -0,0 +1,2389 @@
+/* A Bison parser, made from ./ada-exp.y
+ by GNU bison 1.35. */
+
+#define YYBISON 1 /* Identify Bison output. */
+
+# define INT 257
+# define NULL_PTR 258
+# define CHARLIT 259
+# define FLOAT 260
+# define TYPENAME 261
+# define BLOCKNAME 262
+# define STRING 263
+# define NAME 264
+# define DOT_ID 265
+# define OBJECT_RENAMING 266
+# define DOT_ALL 267
+# define LAST 268
+# define REGNAME 269
+# define INTERNAL_VARIABLE 270
+# define ASSIGN 271
+# define _AND_ 272
+# define OR 273
+# define XOR 274
+# define THEN 275
+# define ELSE 276
+# define NOTEQUAL 277
+# define LEQ 278
+# define GEQ 279
+# define IN 280
+# define DOTDOT 281
+# define UNARY 282
+# define MOD 283
+# define REM 284
+# define STARSTAR 285
+# define ABS 286
+# define NOT 287
+# define TICK_ACCESS 288
+# define TICK_ADDRESS 289
+# define TICK_FIRST 290
+# define TICK_LAST 291
+# define TICK_LENGTH 292
+# define TICK_MAX 293
+# define TICK_MIN 294
+# define TICK_MODULUS 295
+# define TICK_POS 296
+# define TICK_RANGE 297
+# define TICK_SIZE 298
+# define TICK_TAG 299
+# define TICK_VAL 300
+# define ARROW 301
+# define NEW 302
+
+#line 38 "./ada-exp.y"
+
+
+#include "defs.h"
+#include <string.h>
+#include <ctype.h>
+#include "expression.h"
+#include "value.h"
+#include "parser-defs.h"
+#include "language.h"
+#include "ada-lang.h"
+#include "bfd.h" /* Required by objfiles.h. */
+#include "symfile.h" /* Required by objfiles.h. */
+#include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
+#include "frame.h"
+
+/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
+ as well as gratuitiously global symbol names, so we can have multiple
+ yacc generated parsers in gdb. These are only the variables
+ produced by yacc. If other parser generators (bison, byacc, etc) produce
+ additional global names that conflict at link time, then those parser
+ generators need to be fixed instead of adding those names to this list. */
+
+/* NOTE: This is clumsy, especially since BISON and FLEX provide --prefix
+ options. I presume we are maintaining it to accommodate systems
+ without BISON? (PNH) */
+
+#define yymaxdepth ada_maxdepth
+#define yyparse _ada_parse /* ada_parse calls this after initialization */
+#define yylex ada_lex
+#define yyerror ada_error
+#define yylval ada_lval
+#define yychar ada_char
+#define yydebug ada_debug
+#define yypact ada_pact
+#define yyr1 ada_r1
+#define yyr2 ada_r2
+#define yydef ada_def
+#define yychk ada_chk
+#define yypgo ada_pgo
+#define yyact ada_act
+#define yyexca ada_exca
+#define yyerrflag ada_errflag
+#define yynerrs ada_nerrs
+#define yyps ada_ps
+#define yypv ada_pv
+#define yys ada_s
+#define yy_yys ada_yys
+#define yystate ada_state
+#define yytmp ada_tmp
+#define yyv ada_v
+#define yy_yyv ada_yyv
+#define yyval ada_val
+#define yylloc ada_lloc
+#define yyreds ada_reds /* With YYDEBUG defined */
+#define yytoks ada_toks /* With YYDEBUG defined */
+
+#ifndef YYDEBUG
+#define YYDEBUG 0 /* Default to no yydebug support */
+#endif
+
+struct name_info {
+ struct symbol* sym;
+ struct minimal_symbol* msym;
+ struct block* block;
+ struct stoken stoken;
+};
+
+/* If expression is in the context of TYPE'(...), then TYPE, else
+ * NULL. */
+static struct type* type_qualifier;
+
+int yyparse (void);
+
+static int yylex (void);
+
+void yyerror (char *);
+
+static struct stoken string_to_operator (struct stoken);
+
+static void write_attribute_call0 (enum ada_attribute);
+
+static void write_attribute_call1 (enum ada_attribute, LONGEST);
+
+static void write_attribute_calln (enum ada_attribute, int);
+
+static void write_object_renaming (struct block*, struct symbol*);
+
+static void write_var_from_name (struct block*, struct name_info);
+
+static LONGEST
+convert_char_literal (struct type*, LONGEST);
+
+#line 131 "./ada-exp.y"
+#ifndef YYSTYPE
+typedef union
+ {
+ LONGEST lval;
+ struct {
+ LONGEST val;
+ struct type *type;
+ } typed_val;
+ struct {
+ DOUBLEST dval;
+ struct type *type;
+ } typed_val_float;
+ struct type *tval;
+ struct stoken sval;
+ struct name_info ssym;
+ int voidval;
+ struct block *bval;
+ struct internalvar *ivar;
+
+ } yystype;
+# define YYSTYPE yystype
+# define YYSTYPE_IS_TRIVIAL 1
+#endif
+#ifndef YYDEBUG
+# define YYDEBUG 0
+#endif
+
+
+
+#define YYFINAL 184
+#define YYFLAG -32768
+#define YYNTBASE 68
+
+/* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */
+#define YYTRANSLATE(x) ((unsigned)(x) <= 302 ? yytranslate[x] : 82)
+
+/* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */
+static const char yytranslate[] =
+{
+ 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 34, 63,
+ 57, 62, 36, 32, 64, 33, 56, 37, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 61,
+ 25, 23, 26, 2, 31, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 58, 2, 67, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 65, 2, 66, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 1, 3, 4, 5,
+ 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 16, 17, 18, 19, 20, 21, 22, 24, 27, 28,
+ 29, 30, 35, 38, 39, 40, 41, 42, 43, 44,
+ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
+ 55, 59, 60
+};
+
+#if YYDEBUG
+static const short yyprhs[] =
+{
+ 0, 0, 2, 4, 6, 10, 13, 16, 21, 26,
+ 27, 35, 36, 43, 47, 49, 51, 53, 55, 57,
+ 61, 64, 67, 70, 73, 74, 76, 80, 84, 90,
+ 95, 99, 103, 107, 111, 115, 119, 123, 127, 131,
+ 135, 139, 143, 149, 155, 159, 166, 173, 178, 182,
+ 186, 190, 194, 199, 203, 208, 212, 215, 218, 222,
+ 226, 230, 233, 236, 244, 252, 258, 262, 266, 270,
+ 276, 279, 280, 284, 286, 288, 289, 291, 293, 295,
+ 297, 299, 302, 304, 307, 309, 312, 314, 316, 318,
+ 320, 323, 325, 328, 331, 335, 338, 341
+};
+static const short yyrhs[] =
+{
+ 69, 0, 81, 0, 73, 0, 69, 61, 73, 0,
+ 70, 13, 0, 70, 11, 0, 70, 57, 74, 62,
+ 0, 81, 57, 73, 62, 0, 0, 81, 63, 72,
+ 71, 57, 73, 62, 0, 0, 70, 57, 73, 30,
+ 73, 62, 0, 57, 69, 62, 0, 78, 0, 15,
+ 0, 16, 0, 70, 0, 14, 0, 73, 17, 73,
+ 0, 33, 73, 0, 32, 73, 0, 42, 73, 0,
+ 41, 73, 0, 0, 73, 0, 79, 59, 73, 0,
+ 74, 64, 73, 0, 74, 64, 79, 59, 73, 0,
+ 65, 81, 66, 73, 0, 73, 40, 73, 0, 73,
+ 36, 73, 0, 73, 37, 73, 0, 73, 39, 73,
+ 0, 73, 38, 73, 0, 73, 31, 73, 0, 73,
+ 32, 73, 0, 73, 34, 73, 0, 73, 33, 73,
+ 0, 73, 23, 73, 0, 73, 24, 73, 0, 73,
+ 27, 73, 0, 73, 29, 73, 30, 73, 0, 73,
+ 29, 73, 52, 75, 0, 73, 29, 7, 0, 73,
+ 42, 29, 73, 30, 73, 0, 73, 42, 29, 73,
+ 52, 75, 0, 73, 42, 29, 7, 0, 73, 28,
+ 73, 0, 73, 25, 73, 0, 73, 26, 73, 0,
+ 73, 18, 73, 0, 73, 18, 21, 73, 0, 73,
+ 19, 73, 0, 73, 19, 22, 73, 0, 73, 20,
+ 73, 0, 70, 43, 0, 70, 44, 0, 70, 45,
+ 75, 0, 70, 46, 75, 0, 70, 47, 75, 0,
+ 70, 53, 0, 70, 54, 0, 77, 49, 57, 73,
+ 64, 73, 62, 0, 77, 48, 57, 73, 64, 73,
+ 62, 0, 77, 51, 57, 73, 62, 0, 76, 45,
+ 75, 0, 76, 46, 75, 0, 76, 47, 75, 0,
+ 76, 55, 57, 73, 62, 0, 76, 50, 0, 0,
+ 57, 3, 62, 0, 7, 0, 76, 0, 0, 3,
+ 0, 5, 0, 6, 0, 4, 0, 9, 0, 60,
+ 7, 0, 10, 0, 80, 10, 0, 12, 0, 80,
+ 12, 0, 10, 0, 7, 0, 12, 0, 8, 0,
+ 80, 8, 0, 7, 0, 80, 7, 0, 7, 43,
+ 0, 80, 7, 43, 0, 36, 73, 0, 34, 73,
+ 0, 73, 58, 73, 67, 0
+};
+
+#endif
+
+#if YYDEBUG
+/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
+static const short yyrline[] =
+{
+ 0, 203, 204, 210, 211, 216, 220, 227, 235, 243,
+ 243, 254, 256, 261, 264, 267, 274, 282, 285, 292,
+ 296, 300, 304, 308, 312, 315, 317, 319, 321, 325,
+ 335, 339, 343, 347, 351, 355, 359, 363, 367, 371,
+ 375, 379, 383, 387, 393, 400, 405, 413, 423, 427,
+ 431, 435, 439, 443, 447, 451, 455, 457, 463, 465,
+ 467, 469, 471, 473, 475, 477, 479, 481, 483, 485,
+ 487, 491, 493, 497, 504, 506, 513, 521, 533, 541,
+ 548, 575, 579, 580, 582, 583, 587, 588, 589, 592,
+ 594, 599, 600, 601, 603, 610, 612, 614
+};
+#endif
+
+
+#if (YYDEBUG) || defined YYERROR_VERBOSE
+
+/* YYTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */
+static const char *const yytname[] =
+{
+ "$", "error", "$undefined.", "INT", "NULL_PTR", "CHARLIT", "FLOAT",
+ "TYPENAME", "BLOCKNAME", "STRING", "NAME", "DOT_ID", "OBJECT_RENAMING",
+ "DOT_ALL", "LAST", "REGNAME", "INTERNAL_VARIABLE", "ASSIGN", "_AND_",
+ "OR", "XOR", "THEN", "ELSE", "'='", "NOTEQUAL", "'<'", "'>'", "LEQ",
+ "GEQ", "IN", "DOTDOT", "'@'", "'+'", "'-'", "'&'", "UNARY", "'*'",
+ "'/'", "MOD", "REM", "STARSTAR", "ABS", "NOT", "TICK_ACCESS",
+ "TICK_ADDRESS", "TICK_FIRST", "TICK_LAST", "TICK_LENGTH", "TICK_MAX",
+ "TICK_MIN", "TICK_MODULUS", "TICK_POS", "TICK_RANGE", "TICK_SIZE",
+ "TICK_TAG", "TICK_VAL", "'.'", "'('", "'['", "ARROW", "NEW", "';'",
+ "')'", "'\\''", "','", "'{'", "'}'", "']'", "start", "exp1",
+ "simple_exp", "@1", "save_qualifier", "exp", "arglist", "tick_arglist",
+ "type_prefix", "opt_type_prefix", "variable", "any_name", "block",
+ "type", 0
+};
+#endif
+
+/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
+static const short yyr1[] =
+{
+ 0, 68, 68, 69, 69, 70, 70, 70, 70, 71,
+ 70, 72, 70, 70, 70, 70, 70, 73, 70, 73,
+ 73, 73, 73, 73, 74, 74, 74, 74, 74, 73,
+ 73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
+ 73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
+ 73, 73, 73, 73, 73, 73, 70, 70, 70, 70,
+ 70, 70, 70, 70, 70, 70, 70, 70, 70, 70,
+ 70, 75, 75, 76, 77, 77, 73, 73, 73, 73,
+ 73, 73, 78, 78, 78, 78, 79, 79, 79, 80,
+ 80, 81, 81, 81, 81, 73, 73, 73
+};
+
+/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
+static const short yyr2[] =
+{
+ 0, 1, 1, 1, 3, 2, 2, 4, 4, 0,
+ 7, 0, 6, 3, 1, 1, 1, 1, 1, 3,
+ 2, 2, 2, 2, 0, 1, 3, 3, 5, 4,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 5, 5, 3, 6, 6, 4, 3, 3,
+ 3, 3, 4, 3, 4, 3, 2, 2, 3, 3,
+ 3, 2, 2, 7, 7, 5, 3, 3, 3, 5,
+ 2, 0, 3, 1, 1, 0, 1, 1, 1, 1,
+ 1, 2, 1, 2, 1, 2, 1, 1, 1, 1,
+ 2, 1, 2, 2, 3, 2, 2, 4
+};
+
+/* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
+ doesn't specify something else to do. Zero means the default is an
+ error. */
+static const short yydefact[] =
+{
+ 75, 76, 79, 77, 78, 73, 89, 80, 82, 84,
+ 18, 15, 16, 75, 75, 75, 75, 75, 75, 75,
+ 0, 0, 1, 17, 3, 74, 0, 14, 0, 2,
+ 93, 21, 0, 20, 96, 95, 23, 22, 0, 81,
+ 91, 0, 0, 75, 6, 5, 56, 57, 71, 71,
+ 71, 61, 62, 75, 75, 75, 75, 75, 75, 75,
+ 75, 75, 75, 75, 75, 75, 75, 75, 75, 75,
+ 75, 75, 75, 75, 0, 75, 71, 71, 71, 70,
+ 0, 0, 0, 0, 92, 90, 83, 85, 75, 11,
+ 13, 75, 4, 0, 58, 59, 60, 73, 82, 84,
+ 25, 0, 0, 19, 75, 51, 75, 53, 55, 39,
+ 40, 49, 50, 41, 48, 44, 0, 35, 36, 38,
+ 37, 31, 32, 34, 33, 30, 75, 0, 66, 67,
+ 68, 75, 75, 75, 75, 94, 0, 9, 29, 0,
+ 75, 7, 75, 75, 52, 54, 75, 71, 47, 0,
+ 97, 0, 0, 0, 0, 8, 0, 72, 0, 27,
+ 0, 26, 42, 43, 75, 71, 69, 75, 75, 65,
+ 75, 12, 75, 45, 46, 0, 0, 0, 28, 64,
+ 63, 10, 0, 0, 0
+};
+
+static const short yydefgoto[] =
+{
+ 182, 22, 23, 156, 137, 24, 101, 94, 25, 26,
+ 27, 102, 28, 32
+};
+
+static const short yypact[] =
+{
+ 251,-32768,-32768,-32768,-32768, 20,-32768,-32768,-32768,-32768,
+ -32768,-32768,-32768, 251, 251, 251, 251, 251, 251, 251,
+ 2, 79, -47, 53, 958, -23, 54,-32768, 104, -32,
+ -32768, 31, -32, 31, -22, -22, 31, 31, 33,-32768,
+ -5, 101, -27, 251,-32768,-32768,-32768,-32768, 4, 4,
+ 4,-32768,-32768, 131, 251, 171, 211, 251, 251, 251,
+ 251, 251, 251, 251, 291, 251, 251, 251, 251, 251,
+ 251, 251, 251, 251, 47, 251, 4, 4, 4,-32768,
+ 23, 25, 27, 35, 45,-32768,-32768,-32768, 251,-32768,
+ -32768, 251, 958, 98,-32768,-32768,-32768, 22, 56, 58,
+ 930, -36, 64, 986, 251, 1009, 251, 1009, 1009, -21,
+ -21, -21, -21, -21, -21, 534, 858, 387, 31, 31,
+ 31, 32, 32, 32, 32, 32, 331, 415,-32768,-32768,
+ -32768, 251, 251, 251, 251,-32768, 536,-32768, -22, 62,
+ 251,-32768, 371, 251, 1009, 1009, 251, 4, 534, 894,
+ -32768, 582, 452, 494, 628,-32768, 68,-32768, 674, 958,
+ 67, 958, -21,-32768, 251, 4,-32768, 251, 251,-32768,
+ 251,-32768, 251, -21,-32768, 720, 766, 812, 958,-32768,
+ -32768,-32768, 128, 132,-32768
+};
+
+static const short yypgoto[] =
+{
+ -32768, 112,-32768,-32768,-32768, -13,-32768, -43,-32768,-32768,
+ -32768, 0, 123, 8
+};
+
+
+#define YYLAST 1067
+
+
+static const short yytable[] =
+{
+ 31, 33, 34, 35, 36, 37, 95, 96, 29, 39,
+ 65, 66, 67, 68, 43, 69, 70, 71, 72, 73,
+ -91, 74, 76, 77, 78, 88, 141, 79, 142, 42,
+ 92, 89, 80, 128, 129, 130, 75, 75, 30, 91,
+ 100, 103, 105, 107, 108, 109, 110, 111, 112, 113,
+ 114, 116, 117, 118, 119, 120, 121, 122, 123, 124,
+ 125, 93, 127, 30, 44, 30, 45, 69, 70, 71,
+ 72, 73, 73, 74, 74, 136, 126, -91, 138, -91,
+ 131, -87, 132, -91, 133, -91, 40, 6, 135, 75,
+ 75, 144, 134, 145, 43, 90, 46, 47, 48, 49,
+ 50, 139, 81, 82, 163, 83, 51, 52, 84, 85,
+ 53, 84, 85, 149, 86, -86, 87, -88, 151, 152,
+ 153, 154, 174, 143, 157, 170, 172, 158, 183, 159,
+ 161, 38, 184, 162, 1, 2, 3, 4, 97, 6,
+ 7, 98, 160, 99, 41, 10, 11, 12, 0, 0,
+ 0, 173, 0, 0, 175, 176, 0, 177, 0, 178,
+ 0, 0, 0, 13, 14, 15, 0, 16, 0, 0,
+ 0, 0, 17, 18, 1, 2, 3, 4, 5, 6,
+ 7, 8, 0, 9, 0, 10, 11, 12, 19, 0,
+ 0, 20, 104, -24, 0, -24, 21, 0, 0, 0,
+ 0, 0, 0, 13, 14, 15, 0, 16, 0, 0,
+ 0, 0, 17, 18, 1, 2, 3, 4, 5, 6,
+ 7, 8, 0, 9, 0, 10, 11, 12, 19, 0,
+ 0, 20, 0, 106, 0, 0, 21, 0, 0, 0,
+ 0, 0, 0, 13, 14, 15, 0, 16, 0, 0,
+ 0, 0, 17, 18, 1, 2, 3, 4, 5, 6,
+ 7, 8, 0, 9, 0, 10, 11, 12, 19, 0,
+ 0, 20, 0, 0, 0, 0, 21, 0, 0, 0,
+ 0, 0, 0, 13, 14, 15, 0, 16, 0, 0,
+ 0, 0, 17, 18, 1, 2, 3, 4, 115, 6,
+ 7, 8, 0, 9, 0, 10, 11, 12, 19, 0,
+ 0, 20, 0, 0, 0, 0, 21, 0, 0, 0,
+ 0, 0, 0, 13, 14, 15, 0, 16, 0, 0,
+ 0, 0, 17, 18, 1, 2, 3, 4, 148, 6,
+ 7, 8, 0, 9, 0, 10, 11, 12, 19, 0,
+ 0, 20, 0, 0, 0, 0, 21, 0, 0, 0,
+ 0, 0, 0, 13, 14, 15, 0, 16, 0, 0,
+ 0, 0, 17, 18, 1, 2, 3, 4, 97, 6,
+ 7, 98, 0, 99, 0, 10, 11, 12, 19, 0,
+ 0, 20, 0, 0, 0, 0, 21, 0, 0, 0,
+ 0, 0, 0, 13, 14, 15, 0, 16, 0, 0,
+ 0, 0, 17, 18, 0, 0, 0, 0, 0, 66,
+ 67, 68, 0, 69, 70, 71, 72, 73, 19, 74,
+ 0, 20, 54, 55, 56, 57, 21, 0, 58, 59,
+ 60, 61, 62, 63, 64, 75, 65, 66, 67, 68,
+ 0, 69, 70, 71, 72, 73, 0, 74, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 54,
+ 55, 56, 57, 75, 0, 58, 59, 60, 61, 62,
+ 63, 64, 150, 65, 66, 67, 68, 0, 69, 70,
+ 71, 72, 73, 0, 74, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 75, 54, 55, 56, 57, 0, 167, 58, 59, 60,
+ 61, 62, 63, 64, 0, 65, 66, 67, 68, 0,
+ 69, 70, 71, 72, 73, 0, 74, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 75, 54, 55, 56, 57, 0, 168, 58,
+ 59, 60, 61, 62, 63, 64, 0, 65, 66, 67,
+ 68, 0, 69, 70, 71, 72, 73, 30, 74, -73,
+ -73, -73, -73, -73, -73, -73, 0, 0, 0, -73,
+ 0, -91, 0, 0, 75, 0, 0, -91, 155, 54,
+ 55, 56, 57, 0, 0, 58, 59, 60, 61, 62,
+ 63, 64, 0, 65, 66, 67, 68, 0, 69, 70,
+ 71, 72, 73, 0, 74, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 75, 0, 0, 0, 166, 54, 55, 56, 57, 0,
+ 0, 58, 59, 60, 61, 62, 63, 64, 0, 65,
+ 66, 67, 68, 0, 69, 70, 71, 72, 73, 0,
+ 74, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 75, 0, 0, 0,
+ 169, 54, 55, 56, 57, 0, 0, 58, 59, 60,
+ 61, 62, 63, 64, 0, 65, 66, 67, 68, 0,
+ 69, 70, 71, 72, 73, 0, 74, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 75, 0, 0, 0, 171, 54, 55, 56,
+ 57, 0, 0, 58, 59, 60, 61, 62, 63, 64,
+ 0, 65, 66, 67, 68, 0, 69, 70, 71, 72,
+ 73, 0, 74, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 75, 0,
+ 0, 0, 179, 54, 55, 56, 57, 0, 0, 58,
+ 59, 60, 61, 62, 63, 64, 0, 65, 66, 67,
+ 68, 0, 69, 70, 71, 72, 73, 0, 74, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 75, 0, 0, 0, 180, 54,
+ 55, 56, 57, 0, 0, 58, 59, 60, 61, 62,
+ 63, 64, 0, 65, 66, 67, 68, 0, 69, 70,
+ 71, 72, 73, 0, 74, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 75, 0, 0, 0, 181, 54, 55, 56, 57, 0,
+ 0, 58, 59, 60, 61, 62, 63, 64, 146, 65,
+ 66, 67, 68, 0, 69, 70, 71, 72, 73, 0,
+ 74, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 147, 54, 55, 56, 57, 0, 75, 58, 59, 60,
+ 61, 62, 63, 64, 164, 65, 66, 67, 68, 0,
+ 69, 70, 71, 72, 73, 0, 74, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 165, 54, 55, 56,
+ 57, 0, 75, 58, 59, 60, 61, 62, 63, 64,
+ 140, 65, 66, 67, 68, 0, 69, 70, 71, 72,
+ 73, 0, 74, 0, 0, 54, 55, 56, 57, 0,
+ 0, 58, 59, 60, 61, 62, 63, 64, 75, 65,
+ 66, 67, 68, 0, 69, 70, 71, 72, 73, 0,
+ 74, 0, 0,-32768, 55, 56, 57, 0, 0, 58,
+ 59, 60, 61, 62, 63, 64, 75, 65, 66, 67,
+ 68, 0, 69, 70, 71, 72, 73, 0, 74, 0,
+ 0, 0, 58, 59, 60, 61, 62, 63, 64, 0,
+ 65, 66, 67, 68, 75, 69, 70, 71, 72, 73,
+ 0, 74, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 75
+};
+
+static const short yycheck[] =
+{
+ 13, 14, 15, 16, 17, 18, 49, 50, 0, 7,
+ 31, 32, 33, 34, 61, 36, 37, 38, 39, 40,
+ 0, 42, 45, 46, 47, 57, 62, 50, 64, 21,
+ 43, 63, 55, 76, 77, 78, 58, 58, 43, 66,
+ 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
+ 63, 64, 65, 66, 67, 68, 69, 70, 71, 72,
+ 73, 57, 75, 43, 11, 43, 13, 36, 37, 38,
+ 39, 40, 40, 42, 42, 88, 29, 57, 91, 57,
+ 57, 59, 57, 63, 57, 63, 7, 8, 43, 58,
+ 58, 104, 57, 106, 61, 62, 43, 44, 45, 46,
+ 47, 3, 48, 49, 147, 51, 53, 54, 7, 8,
+ 57, 7, 8, 126, 10, 59, 12, 59, 131, 132,
+ 133, 134, 165, 59, 62, 57, 59, 140, 0, 142,
+ 143, 19, 0, 146, 3, 4, 5, 6, 7, 8,
+ 9, 10, 142, 12, 21, 14, 15, 16, -1, -1,
+ -1, 164, -1, -1, 167, 168, -1, 170, -1, 172,
+ -1, -1, -1, 32, 33, 34, -1, 36, -1, -1,
+ -1, -1, 41, 42, 3, 4, 5, 6, 7, 8,
+ 9, 10, -1, 12, -1, 14, 15, 16, 57, -1,
+ -1, 60, 21, 62, -1, 64, 65, -1, -1, -1,
+ -1, -1, -1, 32, 33, 34, -1, 36, -1, -1,
+ -1, -1, 41, 42, 3, 4, 5, 6, 7, 8,
+ 9, 10, -1, 12, -1, 14, 15, 16, 57, -1,
+ -1, 60, -1, 22, -1, -1, 65, -1, -1, -1,
+ -1, -1, -1, 32, 33, 34, -1, 36, -1, -1,
+ -1, -1, 41, 42, 3, 4, 5, 6, 7, 8,
+ 9, 10, -1, 12, -1, 14, 15, 16, 57, -1,
+ -1, 60, -1, -1, -1, -1, 65, -1, -1, -1,
+ -1, -1, -1, 32, 33, 34, -1, 36, -1, -1,
+ -1, -1, 41, 42, 3, 4, 5, 6, 7, 8,
+ 9, 10, -1, 12, -1, 14, 15, 16, 57, -1,
+ -1, 60, -1, -1, -1, -1, 65, -1, -1, -1,
+ -1, -1, -1, 32, 33, 34, -1, 36, -1, -1,
+ -1, -1, 41, 42, 3, 4, 5, 6, 7, 8,
+ 9, 10, -1, 12, -1, 14, 15, 16, 57, -1,
+ -1, 60, -1, -1, -1, -1, 65, -1, -1, -1,
+ -1, -1, -1, 32, 33, 34, -1, 36, -1, -1,
+ -1, -1, 41, 42, 3, 4, 5, 6, 7, 8,
+ 9, 10, -1, 12, -1, 14, 15, 16, 57, -1,
+ -1, 60, -1, -1, -1, -1, 65, -1, -1, -1,
+ -1, -1, -1, 32, 33, 34, -1, 36, -1, -1,
+ -1, -1, 41, 42, -1, -1, -1, -1, -1, 32,
+ 33, 34, -1, 36, 37, 38, 39, 40, 57, 42,
+ -1, 60, 17, 18, 19, 20, 65, -1, 23, 24,
+ 25, 26, 27, 28, 29, 58, 31, 32, 33, 34,
+ -1, 36, 37, 38, 39, 40, -1, 42, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, 17,
+ 18, 19, 20, 58, -1, 23, 24, 25, 26, 27,
+ 28, 29, 67, 31, 32, 33, 34, -1, 36, 37,
+ 38, 39, 40, -1, 42, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 58, 17, 18, 19, 20, -1, 64, 23, 24, 25,
+ 26, 27, 28, 29, -1, 31, 32, 33, 34, -1,
+ 36, 37, 38, 39, 40, -1, 42, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, 58, 17, 18, 19, 20, -1, 64, 23,
+ 24, 25, 26, 27, 28, 29, -1, 31, 32, 33,
+ 34, -1, 36, 37, 38, 39, 40, 43, 42, 45,
+ 46, 47, 48, 49, 50, 51, -1, -1, -1, 55,
+ -1, 57, -1, -1, 58, -1, -1, 63, 62, 17,
+ 18, 19, 20, -1, -1, 23, 24, 25, 26, 27,
+ 28, 29, -1, 31, 32, 33, 34, -1, 36, 37,
+ 38, 39, 40, -1, 42, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 58, -1, -1, -1, 62, 17, 18, 19, 20, -1,
+ -1, 23, 24, 25, 26, 27, 28, 29, -1, 31,
+ 32, 33, 34, -1, 36, 37, 38, 39, 40, -1,
+ 42, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 58, -1, -1, -1,
+ 62, 17, 18, 19, 20, -1, -1, 23, 24, 25,
+ 26, 27, 28, 29, -1, 31, 32, 33, 34, -1,
+ 36, 37, 38, 39, 40, -1, 42, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, 58, -1, -1, -1, 62, 17, 18, 19,
+ 20, -1, -1, 23, 24, 25, 26, 27, 28, 29,
+ -1, 31, 32, 33, 34, -1, 36, 37, 38, 39,
+ 40, -1, 42, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 58, -1,
+ -1, -1, 62, 17, 18, 19, 20, -1, -1, 23,
+ 24, 25, 26, 27, 28, 29, -1, 31, 32, 33,
+ 34, -1, 36, 37, 38, 39, 40, -1, 42, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 58, -1, -1, -1, 62, 17,
+ 18, 19, 20, -1, -1, 23, 24, 25, 26, 27,
+ 28, 29, -1, 31, 32, 33, 34, -1, 36, 37,
+ 38, 39, 40, -1, 42, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 58, -1, -1, -1, 62, 17, 18, 19, 20, -1,
+ -1, 23, 24, 25, 26, 27, 28, 29, 30, 31,
+ 32, 33, 34, -1, 36, 37, 38, 39, 40, -1,
+ 42, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 52, 17, 18, 19, 20, -1, 58, 23, 24, 25,
+ 26, 27, 28, 29, 30, 31, 32, 33, 34, -1,
+ 36, 37, 38, 39, 40, -1, 42, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 52, 17, 18, 19,
+ 20, -1, 58, 23, 24, 25, 26, 27, 28, 29,
+ 30, 31, 32, 33, 34, -1, 36, 37, 38, 39,
+ 40, -1, 42, -1, -1, 17, 18, 19, 20, -1,
+ -1, 23, 24, 25, 26, 27, 28, 29, 58, 31,
+ 32, 33, 34, -1, 36, 37, 38, 39, 40, -1,
+ 42, -1, -1, 17, 18, 19, 20, -1, -1, 23,
+ 24, 25, 26, 27, 28, 29, 58, 31, 32, 33,
+ 34, -1, 36, 37, 38, 39, 40, -1, 42, -1,
+ -1, -1, 23, 24, 25, 26, 27, 28, 29, -1,
+ 31, 32, 33, 34, 58, 36, 37, 38, 39, 40,
+ -1, 42, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 58
+};
+/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
+#line 3 "/usr/local/share/bison/bison.simple"
+
+/* Skeleton output parser for bison,
+
+ Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 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, 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. */
+
+/* As a special exception, when this file is copied by Bison into a
+ Bison output file, you may use that output file without restriction.
+ This special exception was added by the Free Software Foundation
+ in version 1.24 of Bison. */
+
+/* This is the parser code that is written into each bison parser when
+ the %semantic_parser declaration is not specified in the grammar.
+ It was written by Richard Stallman by simplifying the hairy parser
+ used when %semantic_parser is specified. */
+
+/* All symbols defined below should begin with yy or YY, to avoid
+ infringing on user name space. This should be done even for local
+ variables, as they might otherwise be expanded by user macros.
+ There are some unavoidable exceptions within include files to
+ define necessary library symbols; they are noted "INFRINGES ON
+ USER NAME SPACE" below. */
+
+#if ! defined (yyoverflow) || defined (YYERROR_VERBOSE)
+
+/* The parser invokes alloca or xmalloc; define the necessary symbols. */
+
+# if YYSTACK_USE_ALLOCA
+# define YYSTACK_ALLOC alloca
+# else
+# ifndef YYSTACK_USE_ALLOCA
+# if defined (alloca) || defined (_ALLOCA_H)
+# define YYSTACK_ALLOC alloca
+# else
+# ifdef __GNUC__
+# define YYSTACK_ALLOC __builtin_alloca
+# endif
+# endif
+# endif
+# endif
+
+# ifdef YYSTACK_ALLOC
+ /* Pacify GCC's `empty if-body' warning. */
+# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
+# else
+# if defined (__STDC__) || defined (__cplusplus)
+# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
+# define YYSIZE_T size_t
+# endif
+# define YYSTACK_ALLOC xmalloc
+# define YYSTACK_FREE free
+# endif
+#endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */
+
+
+#if (! defined (yyoverflow) \
+ && (! defined (__cplusplus) \
+ || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
+
+/* A type that is properly aligned for any stack member. */
+union yyalloc
+{
+ short yyss;
+ YYSTYPE yyvs;
+# if YYLSP_NEEDED
+ YYLTYPE yyls;
+# endif
+};
+
+/* The size of the maximum gap between one aligned stack and the next. */
+# define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
+
+/* The size of an array large to enough to hold all stacks, each with
+ N elements. */
+# if YYLSP_NEEDED
+# define YYSTACK_BYTES(N) \
+ ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
+ + 2 * YYSTACK_GAP_MAX)
+# else
+# define YYSTACK_BYTES(N) \
+ ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
+ + YYSTACK_GAP_MAX)
+# endif
+
+/* Copy COUNT objects from FROM to TO. The source and destination do
+ not overlap. */
+# ifndef YYCOPY
+# if 1 < __GNUC__
+# define YYCOPY(To, From, Count) \
+ __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
+# else
+# define YYCOPY(To, From, Count) \
+ do \
+ { \
+ register YYSIZE_T yyi; \
+ for (yyi = 0; yyi < (Count); yyi++) \
+ (To)[yyi] = (From)[yyi]; \
+ } \
+ while (0)
+# endif
+# endif
+
+/* Relocate STACK from its old location to the new one. The
+ local variables YYSIZE and YYSTACKSIZE give the old and new number of
+ elements in the stack, and YYPTR gives the new location of the
+ stack. Advance YYPTR to a properly aligned location for the next
+ stack. */
+# define YYSTACK_RELOCATE(Stack) \
+ do \
+ { \
+ YYSIZE_T yynewbytes; \
+ YYCOPY (&yyptr->Stack, Stack, yysize); \
+ Stack = &yyptr->Stack; \
+ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \
+ yyptr += yynewbytes / sizeof (*yyptr); \
+ } \
+ while (0)
+
+#endif
+
+
+#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
+# define YYSIZE_T __SIZE_TYPE__
+#endif
+#if ! defined (YYSIZE_T) && defined (size_t)
+# define YYSIZE_T size_t
+#endif
+#if ! defined (YYSIZE_T)
+# if defined (__STDC__) || defined (__cplusplus)
+# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
+# define YYSIZE_T size_t
+# endif
+#endif
+#if ! defined (YYSIZE_T)
+# define YYSIZE_T unsigned int
+#endif
+
+#define yyerrok (yyerrstatus = 0)
+#define yyclearin (yychar = YYEMPTY)
+#define YYEMPTY -2
+#define YYEOF 0
+#define YYACCEPT goto yyacceptlab
+#define YYABORT goto yyabortlab
+#define YYERROR goto yyerrlab1
+/* Like YYERROR except do call yyerror. This remains here temporarily
+ to ease the transition to the new meaning of YYERROR, for GCC.
+ Once GCC version 2 has supplanted version 1, this can go. */
+#define YYFAIL goto yyerrlab
+#define YYRECOVERING() (!!yyerrstatus)
+#define YYBACKUP(Token, Value) \
+do \
+ if (yychar == YYEMPTY && yylen == 1) \
+ { \
+ yychar = (Token); \
+ yylval = (Value); \
+ yychar1 = YYTRANSLATE (yychar); \
+ YYPOPSTACK; \
+ goto yybackup; \
+ } \
+ else \
+ { \
+ yyerror ("syntax error: cannot back up"); \
+ YYERROR; \
+ } \
+while (0)
+
+#define YYTERROR 1
+#define YYERRCODE 256
+
+
+/* YYLLOC_DEFAULT -- Compute the default location (before the actions
+ are run).
+
+ When YYLLOC_DEFAULT is run, CURRENT is set the location of the
+ first token. By default, to implement support for ranges, extend
+ its range to the last symbol. */
+
+#ifndef YYLLOC_DEFAULT
+# define YYLLOC_DEFAULT(Current, Rhs, N) \
+ Current.last_line = Rhs[N].last_line; \
+ Current.last_column = Rhs[N].last_column;
+#endif
+
+
+/* YYLEX -- calling `yylex' with the right arguments. */
+
+#if YYPURE
+# if YYLSP_NEEDED
+# ifdef YYLEX_PARAM
+# define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
+# else
+# define YYLEX yylex (&yylval, &yylloc)
+# endif
+# else /* !YYLSP_NEEDED */
+# ifdef YYLEX_PARAM
+# define YYLEX yylex (&yylval, YYLEX_PARAM)
+# else
+# define YYLEX yylex (&yylval)
+# endif
+# endif /* !YYLSP_NEEDED */
+#else /* !YYPURE */
+# define YYLEX yylex ()
+#endif /* !YYPURE */
+
+
+/* Enable debugging if requested. */
+#if YYDEBUG
+
+# ifndef YYFPRINTF
+# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
+# define YYFPRINTF fprintf
+# endif
+
+# define YYDPRINTF(Args) \
+do { \
+ if (yydebug) \
+ YYFPRINTF Args; \
+} while (0)
+/* Nonzero means print parse trace. It is left uninitialized so that
+ multiple parsers can coexist. */
+int yydebug;
+#else /* !YYDEBUG */
+# define YYDPRINTF(Args)
+#endif /* !YYDEBUG */
+
+/* YYINITDEPTH -- initial size of the parser's stacks. */
+#ifndef YYINITDEPTH
+# define YYINITDEPTH 200
+#endif
+
+/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
+ if the built-in stack extension method is used).
+
+ Do not make this value too large; the results are undefined if
+ SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
+ evaluated with infinite-precision integer arithmetic. */
+
+#if YYMAXDEPTH == 0
+# undef YYMAXDEPTH
+#endif
+
+#ifndef YYMAXDEPTH
+# define YYMAXDEPTH 10000
+#endif
+
+#ifdef YYERROR_VERBOSE
+
+# ifndef yystrlen
+# if defined (__GLIBC__) && defined (_STRING_H)
+# define yystrlen strlen
+# else
+/* Return the length of YYSTR. */
+static YYSIZE_T
+# if defined (__STDC__) || defined (__cplusplus)
+yystrlen (const char *yystr)
+# else
+yystrlen (yystr)
+ const char *yystr;
+# endif
+{
+ register const char *yys = yystr;
+
+ while (*yys++ != '\0')
+ continue;
+
+ return yys - yystr - 1;
+}
+# endif
+# endif
+
+# ifndef yystpcpy
+# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
+# define yystpcpy stpcpy
+# else
+/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
+ YYDEST. */
+static char *
+# if defined (__STDC__) || defined (__cplusplus)
+yystpcpy (char *yydest, const char *yysrc)
+# else
+yystpcpy (yydest, yysrc)
+ char *yydest;
+ const char *yysrc;
+# endif
+{
+ register char *yyd = yydest;
+ register const char *yys = yysrc;
+
+ while ((*yyd++ = *yys++) != '\0')
+ continue;
+
+ return yyd - 1;
+}
+# endif
+# endif
+#endif
+
+#line 315 "/usr/local/share/bison/bison.simple"
+
+
+/* The user can define YYPARSE_PARAM as the name of an argument to be passed
+ into yyparse. The argument should have type void *.
+ It should actually point to an object.
+ Grammar actions can access the variable by casting it
+ to the proper pointer type. */
+
+#ifdef YYPARSE_PARAM
+# if defined (__STDC__) || defined (__cplusplus)
+# define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
+# define YYPARSE_PARAM_DECL
+# else
+# define YYPARSE_PARAM_ARG YYPARSE_PARAM
+# define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
+# endif
+#else /* !YYPARSE_PARAM */
+# define YYPARSE_PARAM_ARG
+# define YYPARSE_PARAM_DECL
+#endif /* !YYPARSE_PARAM */
+
+/* Prevent warning if -Wstrict-prototypes. */
+#ifdef __GNUC__
+# ifdef YYPARSE_PARAM
+int yyparse (void *);
+# else
+int yyparse (void);
+# endif
+#endif
+
+/* YY_DECL_VARIABLES -- depending whether we use a pure parser,
+ variables are global, or local to YYPARSE. */
+
+#define YY_DECL_NON_LSP_VARIABLES \
+/* The lookahead symbol. */ \
+int yychar; \
+ \
+/* The semantic value of the lookahead symbol. */ \
+YYSTYPE yylval; \
+ \
+/* Number of parse errors so far. */ \
+int yynerrs;
+
+#if YYLSP_NEEDED
+# define YY_DECL_VARIABLES \
+YY_DECL_NON_LSP_VARIABLES \
+ \
+/* Location data for the lookahead symbol. */ \
+YYLTYPE yylloc;
+#else
+# define YY_DECL_VARIABLES \
+YY_DECL_NON_LSP_VARIABLES
+#endif
+
+
+/* If nonreentrant, generate the variables here. */
+
+#if !YYPURE
+YY_DECL_VARIABLES
+#endif /* !YYPURE */
+
+int
+yyparse (YYPARSE_PARAM_ARG)
+ YYPARSE_PARAM_DECL
+{
+ /* If reentrant, generate the variables here. */
+#if YYPURE
+ YY_DECL_VARIABLES
+#endif /* !YYPURE */
+
+ register int yystate;
+ register int yyn;
+ int yyresult;
+ /* Number of tokens to shift before error messages enabled. */
+ int yyerrstatus;
+ /* Lookahead token as an internal (translated) token number. */
+ int yychar1 = 0;
+
+ /* Three stacks and their tools:
+ `yyss': related to states,
+ `yyvs': related to semantic values,
+ `yyls': related to locations.
+
+ Refer to the stacks thru separate pointers, to allow yyoverflow
+ to xreallocate them elsewhere. */
+
+ /* The state stack. */
+ short yyssa[YYINITDEPTH];
+ short *yyss = yyssa;
+ register short *yyssp;
+
+ /* The semantic value stack. */
+ YYSTYPE yyvsa[YYINITDEPTH];
+ YYSTYPE *yyvs = yyvsa;
+ register YYSTYPE *yyvsp;
+
+#if YYLSP_NEEDED
+ /* The location stack. */
+ YYLTYPE yylsa[YYINITDEPTH];
+ YYLTYPE *yyls = yylsa;
+ YYLTYPE *yylsp;
+#endif
+
+#if YYLSP_NEEDED
+# define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
+#else
+# define YYPOPSTACK (yyvsp--, yyssp--)
+#endif
+
+ YYSIZE_T yystacksize = YYINITDEPTH;
+
+
+ /* The variables used to return semantic value and location from the
+ action routines. */
+ YYSTYPE yyval;
+#if YYLSP_NEEDED
+ YYLTYPE yyloc;
+#endif
+
+ /* When reducing, the number of symbols on the RHS of the reduced
+ rule. */
+ int yylen;
+
+ YYDPRINTF ((stderr, "Starting parse\n"));
+
+ yystate = 0;
+ yyerrstatus = 0;
+ yynerrs = 0;
+ yychar = YYEMPTY; /* Cause a token to be read. */
+
+ /* Initialize stack pointers.
+ Waste one element of value and location stack
+ so that they stay on the same level as the state stack.
+ The wasted elements are never initialized. */
+
+ yyssp = yyss;
+ yyvsp = yyvs;
+#if YYLSP_NEEDED
+ yylsp = yyls;
+#endif
+ goto yysetstate;
+
+/*------------------------------------------------------------.
+| yynewstate -- Push a new state, which is found in yystate. |
+`------------------------------------------------------------*/
+ yynewstate:
+ /* In all cases, when you get here, the value and location stacks
+ have just been pushed. so pushing a state here evens the stacks.
+ */
+ yyssp++;
+
+ yysetstate:
+ *yyssp = yystate;
+
+ if (yyssp >= yyss + yystacksize - 1)
+ {
+ /* Get the current used size of the three stacks, in elements. */
+ YYSIZE_T yysize = yyssp - yyss + 1;
+
+#ifdef yyoverflow
+ {
+ /* Give user a chance to xreallocate the stack. Use copies of
+ these so that the &'s don't force the real ones into
+ memory. */
+ YYSTYPE *yyvs1 = yyvs;
+ short *yyss1 = yyss;
+
+ /* Each stack pointer address is followed by the size of the
+ data in use in that stack, in bytes. */
+# if YYLSP_NEEDED
+ YYLTYPE *yyls1 = yyls;
+ /* This used to be a conditional around just the two extra args,
+ but that might be undefined if yyoverflow is a macro. */
+ yyoverflow ("parser stack overflow",
+ &yyss1, yysize * sizeof (*yyssp),
+ &yyvs1, yysize * sizeof (*yyvsp),
+ &yyls1, yysize * sizeof (*yylsp),
+ &yystacksize);
+ yyls = yyls1;
+# else
+ yyoverflow ("parser stack overflow",
+ &yyss1, yysize * sizeof (*yyssp),
+ &yyvs1, yysize * sizeof (*yyvsp),
+ &yystacksize);
+# endif
+ yyss = yyss1;
+ yyvs = yyvs1;
+ }
+#else /* no yyoverflow */
+# ifndef YYSTACK_RELOCATE
+ goto yyoverflowlab;
+# else
+ /* Extend the stack our own way. */
+ if (yystacksize >= YYMAXDEPTH)
+ goto yyoverflowlab;
+ yystacksize *= 2;
+ if (yystacksize > YYMAXDEPTH)
+ yystacksize = YYMAXDEPTH;
+
+ {
+ short *yyss1 = yyss;
+ union yyalloc *yyptr =
+ (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
+ if (! yyptr)
+ goto yyoverflowlab;
+ YYSTACK_RELOCATE (yyss);
+ YYSTACK_RELOCATE (yyvs);
+# if YYLSP_NEEDED
+ YYSTACK_RELOCATE (yyls);
+# endif
+# undef YYSTACK_RELOCATE
+ if (yyss1 != yyssa)
+ YYSTACK_FREE (yyss1);
+ }
+# endif
+#endif /* no yyoverflow */
+
+ yyssp = yyss + yysize - 1;
+ yyvsp = yyvs + yysize - 1;
+#if YYLSP_NEEDED
+ yylsp = yyls + yysize - 1;
+#endif
+
+ YYDPRINTF ((stderr, "Stack size increased to %lu\n",
+ (unsigned long int) yystacksize));
+
+ if (yyssp >= yyss + yystacksize - 1)
+ YYABORT;
+ }
+
+ YYDPRINTF ((stderr, "Entering state %d\n", yystate));
+
+ goto yybackup;
+
+
+/*-----------.
+| yybackup. |
+`-----------*/
+yybackup:
+
+/* Do appropriate processing given the current state. */
+/* Read a lookahead token if we need one and don't already have one. */
+/* yyresume: */
+
+ /* First try to decide what to do without reference to lookahead token. */
+
+ yyn = yypact[yystate];
+ if (yyn == YYFLAG)
+ goto yydefault;
+
+ /* Not known => get a lookahead token if don't already have one. */
+
+ /* yychar is either YYEMPTY or YYEOF
+ or a valid token in external form. */
+
+ if (yychar == YYEMPTY)
+ {
+ YYDPRINTF ((stderr, "Reading a token: "));
+ yychar = YYLEX;
+ }
+
+ /* Convert token to internal form (in yychar1) for indexing tables with */
+
+ if (yychar <= 0) /* This means end of input. */
+ {
+ yychar1 = 0;
+ yychar = YYEOF; /* Don't call YYLEX any more */
+
+ YYDPRINTF ((stderr, "Now at end of input.\n"));
+ }
+ else
+ {
+ yychar1 = YYTRANSLATE (yychar);
+
+#if YYDEBUG
+ /* We have to keep this `#if YYDEBUG', since we use variables
+ which are defined only if `YYDEBUG' is set. */
+ if (yydebug)
+ {
+ YYFPRINTF (stderr, "Next token is %d (%s",
+ yychar, yytname[yychar1]);
+ /* Give the individual parser a way to print the precise
+ meaning of a token, for further debugging info. */
+# ifdef YYPRINT
+ YYPRINT (stderr, yychar, yylval);
+# endif
+ YYFPRINTF (stderr, ")\n");
+ }
+#endif
+ }
+
+ yyn += yychar1;
+ if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
+ goto yydefault;
+
+ yyn = yytable[yyn];
+
+ /* yyn is what to do for this token type in this state.
+ Negative => reduce, -yyn is rule number.
+ Positive => shift, yyn is new state.
+ New state is final state => don't bother to shift,
+ just return success.
+ 0, or most negative number => error. */
+
+ if (yyn < 0)
+ {
+ if (yyn == YYFLAG)
+ goto yyerrlab;
+ yyn = -yyn;
+ goto yyreduce;
+ }
+ else if (yyn == 0)
+ goto yyerrlab;
+
+ if (yyn == YYFINAL)
+ YYACCEPT;
+
+ /* Shift the lookahead token. */
+ YYDPRINTF ((stderr, "Shifting token %d (%s), ",
+ yychar, yytname[yychar1]));
+
+ /* Discard the token being shifted unless it is eof. */
+ if (yychar != YYEOF)
+ yychar = YYEMPTY;
+
+ *++yyvsp = yylval;
+#if YYLSP_NEEDED
+ *++yylsp = yylloc;
+#endif
+
+ /* Count tokens shifted since error; after three, turn off error
+ status. */
+ if (yyerrstatus)
+ yyerrstatus--;
+
+ yystate = yyn;
+ goto yynewstate;
+
+
+/*-----------------------------------------------------------.
+| yydefault -- do the default action for the current state. |
+`-----------------------------------------------------------*/
+yydefault:
+ yyn = yydefact[yystate];
+ if (yyn == 0)
+ goto yyerrlab;
+ goto yyreduce;
+
+
+/*-----------------------------.
+| yyreduce -- Do a reduction. |
+`-----------------------------*/
+yyreduce:
+ /* yyn is the number of a rule to reduce with. */
+ yylen = yyr2[yyn];
+
+ /* If YYLEN is nonzero, implement the default value of the action:
+ `$$ = $1'.
+
+ Otherwise, the following line sets YYVAL to the semantic value of
+ the lookahead token. This behavior is undocumented and Bison
+ users should not rely upon it. Assigning to YYVAL
+ unconditionally makes the parser a bit smaller, and it avoids a
+ GCC warning that YYVAL may be used uninitialized. */
+ yyval = yyvsp[1-yylen];
+
+#if YYLSP_NEEDED
+ /* Similarly for the default location. Let the user run additional
+ commands if for instance locations are ranges. */
+ yyloc = yylsp[1-yylen];
+ YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
+#endif
+
+#if YYDEBUG
+ /* We have to keep this `#if YYDEBUG', since we use variables which
+ are defined only if `YYDEBUG' is set. */
+ if (yydebug)
+ {
+ int yyi;
+
+ YYFPRINTF (stderr, "Reducing via rule %d (line %d), ",
+ yyn, yyrline[yyn]);
+
+ /* Print the symbols being reduced, and their result. */
+ for (yyi = yyprhs[yyn]; yyrhs[yyi] > 0; yyi++)
+ YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
+ YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]);
+ }
+#endif
+
+ switch (yyn) {
+
+case 2:
+#line 204 "./ada-exp.y"
+{ write_exp_elt_opcode (OP_TYPE);
+ write_exp_elt_type (yyvsp[0].tval);
+ write_exp_elt_opcode (OP_TYPE); }
+ break;
+case 4:
+#line 212 "./ada-exp.y"
+{ write_exp_elt_opcode (BINOP_COMMA); }
+ break;
+case 5:
+#line 217 "./ada-exp.y"
+{ write_exp_elt_opcode (UNOP_IND); }
+ break;
+case 6:
+#line 221 "./ada-exp.y"
+{ write_exp_elt_opcode (STRUCTOP_STRUCT);
+ write_exp_string (yyvsp[0].ssym.stoken);
+ write_exp_elt_opcode (STRUCTOP_STRUCT);
+ }
+ break;
+case 7:
+#line 228 "./ada-exp.y"
+{
+ write_exp_elt_opcode (OP_FUNCALL);
+ write_exp_elt_longcst (yyvsp[-1].lval);
+ write_exp_elt_opcode (OP_FUNCALL);
+ }
+ break;
+case 8:
+#line 236 "./ada-exp.y"
+{
+ write_exp_elt_opcode (UNOP_CAST);
+ write_exp_elt_type (yyvsp[-3].tval);
+ write_exp_elt_opcode (UNOP_CAST);
+ }
+ break;
+case 9:
+#line 243 "./ada-exp.y"
+{ type_qualifier = yyvsp[-2].tval; }
+ break;
+case 10:
+#line 244 "./ada-exp.y"
+{
+ /* write_exp_elt_opcode (UNOP_QUAL); */
+ /* FIXME: UNOP_QUAL should be defined in expression.h */
+ write_exp_elt_type (yyvsp[-6].tval);
+ /* write_exp_elt_opcode (UNOP_QUAL); */
+ /* FIXME: UNOP_QUAL should be defined in expression.h */
+ type_qualifier = yyvsp[-4].tval;
+ }
+ break;
+case 11:
+#line 254 "./ada-exp.y"
+{ yyval.tval = type_qualifier; }
+ break;
+case 12:
+#line 258 "./ada-exp.y"
+{ write_exp_elt_opcode (TERNOP_SLICE); }
+ break;
+case 13:
+#line 261 "./ada-exp.y"
+{ }
+ break;
+case 15:
+#line 268 "./ada-exp.y"
+{ write_exp_elt_opcode (OP_REGISTER);
+ write_exp_elt_longcst ((LONGEST) yyvsp[0].lval);
+ write_exp_elt_opcode (OP_REGISTER);
+ }
+ break;
+case 16:
+#line 275 "./ada-exp.y"
+{ write_exp_elt_opcode (OP_INTERNALVAR);
+ write_exp_elt_intern (yyvsp[0].ivar);
+ write_exp_elt_opcode (OP_INTERNALVAR);
+ }
+ break;
+case 18:
+#line 286 "./ada-exp.y"
+{ write_exp_elt_opcode (OP_LAST);
+ write_exp_elt_longcst ((LONGEST) yyvsp[0].lval);
+ write_exp_elt_opcode (OP_LAST);
+ }
+ break;
+case 19:
+#line 293 "./ada-exp.y"
+{ write_exp_elt_opcode (BINOP_ASSIGN); }
+ break;
+case 20:
+#line 297 "./ada-exp.y"
+{ write_exp_elt_opcode (UNOP_NEG); }
+ break;
+case 21:
+#line 301 "./ada-exp.y"
+{ write_exp_elt_opcode (UNOP_PLUS); }
+ break;
+case 22:
+#line 305 "./ada-exp.y"
+{ write_exp_elt_opcode (UNOP_LOGICAL_NOT); }
+ break;
+case 23:
+#line 309 "./ada-exp.y"
+{ write_exp_elt_opcode (UNOP_ABS); }
+ break;
+case 24:
+#line 312 "./ada-exp.y"
+{ yyval.lval = 0; }
+ break;
+case 25:
+#line 316 "./ada-exp.y"
+{ yyval.lval = 1; }
+ break;
+case 26:
+#line 318 "./ada-exp.y"
+{ yyval.lval = 1; }
+ break;
+case 27:
+#line 320 "./ada-exp.y"
+{ yyval.lval = yyvsp[-2].lval + 1; }
+ break;
+case 28:
+#line 322 "./ada-exp.y"
+{ yyval.lval = yyvsp[-4].lval + 1; }
+ break;
+case 29:
+#line 327 "./ada-exp.y"
+{ write_exp_elt_opcode (UNOP_MEMVAL);
+ write_exp_elt_type (yyvsp[-2].tval);
+ write_exp_elt_opcode (UNOP_MEMVAL);
+ }
+ break;
+case 30:
+#line 336 "./ada-exp.y"
+{ write_exp_elt_opcode (BINOP_EXP); }
+ break;
+case 31:
+#line 340 "./ada-exp.y"
+{ write_exp_elt_opcode (BINOP_MUL); }
+ break;
+case 32:
+#line 344 "./ada-exp.y"
+{ write_exp_elt_opcode (BINOP_DIV); }
+ break;
+case 33:
+#line 348 "./ada-exp.y"
+{ write_exp_elt_opcode (BINOP_REM); }
+ break;
+case 34:
+#line 352 "./ada-exp.y"
+{ write_exp_elt_opcode (BINOP_MOD); }
+ break;
+case 35:
+#line 356 "./ada-exp.y"
+{ write_exp_elt_opcode (BINOP_REPEAT); }
+ break;
+case 36:
+#line 360 "./ada-exp.y"
+{ write_exp_elt_opcode (BINOP_ADD); }
+ break;
+case 37:
+#line 364 "./ada-exp.y"
+{ write_exp_elt_opcode (BINOP_CONCAT); }
+ break;
+case 38:
+#line 368 "./ada-exp.y"
+{ write_exp_elt_opcode (BINOP_SUB); }
+ break;
+case 39:
+#line 372 "./ada-exp.y"
+{ write_exp_elt_opcode (BINOP_EQUAL); }
+ break;
+case 40:
+#line 376 "./ada-exp.y"
+{ write_exp_elt_opcode (BINOP_NOTEQUAL); }
+ break;
+case 41:
+#line 380 "./ada-exp.y"
+{ write_exp_elt_opcode (BINOP_LEQ); }
+ break;
+case 42:
+#line 384 "./ada-exp.y"
+{ /*write_exp_elt_opcode (TERNOP_MBR); */ }
+ break;
+case 43:
+#line 388 "./ada-exp.y"
+{ /*write_exp_elt_opcode (BINOP_MBR); */
+ /* FIXME: BINOP_MBR should be defined in expression.h */
+ write_exp_elt_longcst ((LONGEST) yyvsp[0].lval);
+ /*write_exp_elt_opcode (BINOP_MBR); */
+ }
+ break;
+case 44:
+#line 394 "./ada-exp.y"
+{ /*write_exp_elt_opcode (UNOP_MBR); */
+ /* FIXME: UNOP_QUAL should be defined in expression.h */
+ write_exp_elt_type (yyvsp[0].tval);
+ /* write_exp_elt_opcode (UNOP_MBR); */
+ /* FIXME: UNOP_MBR should be defined in expression.h */
+ }
+ break;
+case 45:
+#line 401 "./ada-exp.y"
+{ /*write_exp_elt_opcode (TERNOP_MBR); */
+ /* FIXME: TERNOP_MBR should be defined in expression.h */
+ write_exp_elt_opcode (UNOP_LOGICAL_NOT);
+ }
+ break;
+case 46:
+#line 406 "./ada-exp.y"
+{ /* write_exp_elt_opcode (BINOP_MBR); */
+ /* FIXME: BINOP_MBR should be defined in expression.h */
+ write_exp_elt_longcst ((LONGEST) yyvsp[0].lval);
+ /*write_exp_elt_opcode (BINOP_MBR);*/
+ /* FIXME: BINOP_MBR should be defined in expression.h */
+ write_exp_elt_opcode (UNOP_LOGICAL_NOT);
+ }
+ break;
+case 47:
+#line 414 "./ada-exp.y"
+{ /*write_exp_elt_opcode (UNOP_MBR);*/
+ /* FIXME: UNOP_MBR should be defined in expression.h */
+ write_exp_elt_type (yyvsp[0].tval);
+ /* write_exp_elt_opcode (UNOP_MBR);*/
+ /* FIXME: UNOP_MBR should be defined in expression.h */
+ write_exp_elt_opcode (UNOP_LOGICAL_NOT);
+ }
+ break;
+case 48:
+#line 424 "./ada-exp.y"
+{ write_exp_elt_opcode (BINOP_GEQ); }
+ break;
+case 49:
+#line 428 "./ada-exp.y"
+{ write_exp_elt_opcode (BINOP_LESS); }
+ break;
+case 50:
+#line 432 "./ada-exp.y"
+{ write_exp_elt_opcode (BINOP_GTR); }
+ break;
+case 51:
+#line 436 "./ada-exp.y"
+{ write_exp_elt_opcode (BINOP_BITWISE_AND); }
+ break;
+case 52:
+#line 440 "./ada-exp.y"
+{ write_exp_elt_opcode (BINOP_LOGICAL_AND); }
+ break;
+case 53:
+#line 444 "./ada-exp.y"
+{ write_exp_elt_opcode (BINOP_BITWISE_IOR); }
+ break;
+case 54:
+#line 448 "./ada-exp.y"
+{ write_exp_elt_opcode (BINOP_LOGICAL_OR); }
+ break;
+case 55:
+#line 452 "./ada-exp.y"
+{ write_exp_elt_opcode (BINOP_BITWISE_XOR); }
+ break;
+case 56:
+#line 456 "./ada-exp.y"
+{ write_exp_elt_opcode (UNOP_ADDR); }
+ break;
+case 57:
+#line 458 "./ada-exp.y"
+{ write_exp_elt_opcode (UNOP_ADDR);
+ write_exp_elt_opcode (UNOP_CAST);
+ write_exp_elt_type (builtin_type_ada_system_address);
+ write_exp_elt_opcode (UNOP_CAST);
+ }
+ break;
+case 58:
+#line 464 "./ada-exp.y"
+{ write_attribute_call1 (ATR_FIRST, yyvsp[0].lval); }
+ break;
+case 59:
+#line 466 "./ada-exp.y"
+{ write_attribute_call1 (ATR_LAST, yyvsp[0].lval); }
+ break;
+case 60:
+#line 468 "./ada-exp.y"
+{ write_attribute_call1 (ATR_LENGTH, yyvsp[0].lval); }
+ break;
+case 61:
+#line 470 "./ada-exp.y"
+{ write_attribute_call0 (ATR_SIZE); }
+ break;
+case 62:
+#line 472 "./ada-exp.y"
+{ write_attribute_call0 (ATR_TAG); }
+ break;
+case 63:
+#line 474 "./ada-exp.y"
+{ write_attribute_calln (ATR_MIN, 2); }
+ break;
+case 64:
+#line 476 "./ada-exp.y"
+{ write_attribute_calln (ATR_MAX, 2); }
+ break;
+case 65:
+#line 478 "./ada-exp.y"
+{ write_attribute_calln (ATR_POS, 1); }
+ break;
+case 66:
+#line 480 "./ada-exp.y"
+{ write_attribute_call1 (ATR_FIRST, yyvsp[0].lval); }
+ break;
+case 67:
+#line 482 "./ada-exp.y"
+{ write_attribute_call1 (ATR_LAST, yyvsp[0].lval); }
+ break;
+case 68:
+#line 484 "./ada-exp.y"
+{ write_attribute_call1 (ATR_LENGTH, yyvsp[0].lval); }
+ break;
+case 69:
+#line 486 "./ada-exp.y"
+{ write_attribute_calln (ATR_VAL, 1); }
+ break;
+case 70:
+#line 488 "./ada-exp.y"
+{ write_attribute_call0 (ATR_MODULUS); }
+ break;
+case 71:
+#line 492 "./ada-exp.y"
+{ yyval.lval = 1; }
+ break;
+case 72:
+#line 494 "./ada-exp.y"
+{ yyval.lval = yyvsp[-1].typed_val.val; }
+ break;
+case 73:
+#line 499 "./ada-exp.y"
+{ write_exp_elt_opcode (OP_TYPE);
+ write_exp_elt_type (yyvsp[0].tval);
+ write_exp_elt_opcode (OP_TYPE); }
+ break;
+case 75:
+#line 507 "./ada-exp.y"
+{ write_exp_elt_opcode (OP_TYPE);
+ write_exp_elt_type (builtin_type_void);
+ write_exp_elt_opcode (OP_TYPE); }
+ break;
+case 76:
+#line 514 "./ada-exp.y"
+{ write_exp_elt_opcode (OP_LONG);
+ write_exp_elt_type (yyvsp[0].typed_val.type);
+ write_exp_elt_longcst ((LONGEST)(yyvsp[0].typed_val.val));
+ write_exp_elt_opcode (OP_LONG);
+ }
+ break;
+case 77:
+#line 522 "./ada-exp.y"
+{ write_exp_elt_opcode (OP_LONG);
+ if (type_qualifier == NULL)
+ write_exp_elt_type (yyvsp[0].typed_val.type);
+ else
+ write_exp_elt_type (type_qualifier);
+ write_exp_elt_longcst
+ (convert_char_literal (type_qualifier, yyvsp[0].typed_val.val));
+ write_exp_elt_opcode (OP_LONG);
+ }
+ break;
+case 78:
+#line 534 "./ada-exp.y"
+{ write_exp_elt_opcode (OP_DOUBLE);
+ write_exp_elt_type (yyvsp[0].typed_val_float.type);
+ write_exp_elt_dblcst (yyvsp[0].typed_val_float.dval);
+ write_exp_elt_opcode (OP_DOUBLE);
+ }
+ break;
+case 79:
+#line 542 "./ada-exp.y"
+{ write_exp_elt_opcode (OP_LONG);
+ write_exp_elt_type (builtin_type_int);
+ write_exp_elt_longcst ((LONGEST)(0));
+ write_exp_elt_opcode (OP_LONG);
+ }
+ break;
+case 80:
+#line 549 "./ada-exp.y"
+{ /* Ada strings are converted into array constants
+ a lower bound of 1. Thus, the array upper bound
+ is the string length. */
+ char *sp = yyvsp[0].sval.ptr; int count;
+ if (yyvsp[0].sval.length == 0)
+ { /* One dummy character for the type */
+ write_exp_elt_opcode (OP_LONG);
+ write_exp_elt_type (builtin_type_ada_char);
+ write_exp_elt_longcst ((LONGEST)(0));
+ write_exp_elt_opcode (OP_LONG);
+ }
+ for (count = yyvsp[0].sval.length; count > 0; count -= 1)
+ {
+ write_exp_elt_opcode (OP_LONG);
+ write_exp_elt_type (builtin_type_ada_char);
+ write_exp_elt_longcst ((LONGEST)(*sp));
+ sp += 1;
+ write_exp_elt_opcode (OP_LONG);
+ }
+ write_exp_elt_opcode (OP_ARRAY);
+ write_exp_elt_longcst ((LONGEST) 1);
+ write_exp_elt_longcst ((LONGEST) (yyvsp[0].sval.length));
+ write_exp_elt_opcode (OP_ARRAY);
+ }
+ break;
+case 81:
+#line 576 "./ada-exp.y"
+{ error ("NEW not implemented."); }
+ break;
+case 82:
+#line 579 "./ada-exp.y"
+{ write_var_from_name (NULL, yyvsp[0].ssym); }
+ break;
+case 83:
+#line 581 "./ada-exp.y"
+{ write_var_from_name (yyvsp[-1].bval, yyvsp[0].ssym); }
+ break;
+case 84:
+#line 582 "./ada-exp.y"
+{ write_object_renaming (NULL, yyvsp[0].ssym.sym); }
+ break;
+case 85:
+#line 584 "./ada-exp.y"
+{ write_object_renaming (yyvsp[-1].bval, yyvsp[0].ssym.sym); }
+ break;
+case 86:
+#line 587 "./ada-exp.y"
+{ }
+ break;
+case 87:
+#line 588 "./ada-exp.y"
+{ }
+ break;
+case 88:
+#line 589 "./ada-exp.y"
+{ }
+ break;
+case 89:
+#line 593 "./ada-exp.y"
+{ yyval.bval = yyvsp[0].bval; }
+ break;
+case 90:
+#line 595 "./ada-exp.y"
+{ yyval.bval = yyvsp[0].bval; }
+ break;
+case 91:
+#line 599 "./ada-exp.y"
+{ yyval.tval = yyvsp[0].tval; }
+ break;
+case 92:
+#line 600 "./ada-exp.y"
+{ yyval.tval = yyvsp[0].tval; }
+ break;
+case 93:
+#line 602 "./ada-exp.y"
+{ yyval.tval = lookup_pointer_type (yyvsp[-1].tval); }
+ break;
+case 94:
+#line 604 "./ada-exp.y"
+{ yyval.tval = lookup_pointer_type (yyvsp[-1].tval); }
+ break;
+case 95:
+#line 611 "./ada-exp.y"
+{ write_exp_elt_opcode (UNOP_IND); }
+ break;
+case 96:
+#line 613 "./ada-exp.y"
+{ write_exp_elt_opcode (UNOP_ADDR); }
+ break;
+case 97:
+#line 615 "./ada-exp.y"
+{ write_exp_elt_opcode (BINOP_SUBSCRIPT); }
+ break;
+}
+
+#line 705 "/usr/local/share/bison/bison.simple"
+
+
+ yyvsp -= yylen;
+ yyssp -= yylen;
+#if YYLSP_NEEDED
+ yylsp -= yylen;
+#endif
+
+#if YYDEBUG
+ if (yydebug)
+ {
+ short *yyssp1 = yyss - 1;
+ YYFPRINTF (stderr, "state stack now");
+ while (yyssp1 != yyssp)
+ YYFPRINTF (stderr, " %d", *++yyssp1);
+ YYFPRINTF (stderr, "\n");
+ }
+#endif
+
+ *++yyvsp = yyval;
+#if YYLSP_NEEDED
+ *++yylsp = yyloc;
+#endif
+
+ /* Now `shift' the result of the reduction. Determine what state
+ that goes to, based on the state we popped back to and the rule
+ number reduced by. */
+
+ yyn = yyr1[yyn];
+
+ yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
+ if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
+ yystate = yytable[yystate];
+ else
+ yystate = yydefgoto[yyn - YYNTBASE];
+
+ goto yynewstate;
+
+
+/*------------------------------------.
+| yyerrlab -- here on detecting error |
+`------------------------------------*/
+yyerrlab:
+ /* If not already recovering from an error, report this error. */
+ if (!yyerrstatus)
+ {
+ ++yynerrs;
+
+#ifdef YYERROR_VERBOSE
+ yyn = yypact[yystate];
+
+ if (yyn > YYFLAG && yyn < YYLAST)
+ {
+ YYSIZE_T yysize = 0;
+ char *yymsg;
+ int yyx, yycount;
+
+ yycount = 0;
+ /* Start YYX at -YYN if negative to avoid negative indexes in
+ YYCHECK. */
+ for (yyx = yyn < 0 ? -yyn : 0;
+ yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
+ if (yycheck[yyx + yyn] == yyx)
+ yysize += yystrlen (yytname[yyx]) + 15, yycount++;
+ yysize += yystrlen ("parse error, unexpected ") + 1;
+ yysize += yystrlen (yytname[YYTRANSLATE (yychar)]);
+ yymsg = (char *) YYSTACK_ALLOC (yysize);
+ if (yymsg != 0)
+ {
+ char *yyp = yystpcpy (yymsg, "parse error, unexpected ");
+ yyp = yystpcpy (yyp, yytname[YYTRANSLATE (yychar)]);
+
+ if (yycount < 5)
+ {
+ yycount = 0;
+ for (yyx = yyn < 0 ? -yyn : 0;
+ yyx < (int) (sizeof (yytname) / sizeof (char *));
+ yyx++)
+ if (yycheck[yyx + yyn] == yyx)
+ {
+ const char *yyq = ! yycount ? ", expecting " : " or ";
+ yyp = yystpcpy (yyp, yyq);
+ yyp = yystpcpy (yyp, yytname[yyx]);
+ yycount++;
+ }
+ }
+ yyerror (yymsg);
+ YYSTACK_FREE (yymsg);
+ }
+ else
+ yyerror ("parse error; also virtual memory exhausted");
+ }
+ else
+#endif /* defined (YYERROR_VERBOSE) */
+ yyerror ("parse error");
+ }
+ goto yyerrlab1;
+
+
+/*--------------------------------------------------.
+| yyerrlab1 -- error raised explicitly by an action |
+`--------------------------------------------------*/
+yyerrlab1:
+ if (yyerrstatus == 3)
+ {
+ /* If just tried and failed to reuse lookahead token after an
+ error, discard it. */
+
+ /* return failure if at end of input */
+ if (yychar == YYEOF)
+ YYABORT;
+ YYDPRINTF ((stderr, "Discarding token %d (%s).\n",
+ yychar, yytname[yychar1]));
+ yychar = YYEMPTY;
+ }
+
+ /* Else will try to reuse lookahead token after shifting the error
+ token. */
+
+ yyerrstatus = 3; /* Each real token shifted decrements this */
+
+ goto yyerrhandle;
+
+
+/*-------------------------------------------------------------------.
+| yyerrdefault -- current state does not do anything special for the |
+| error token. |
+`-------------------------------------------------------------------*/
+yyerrdefault:
+#if 0
+ /* This is wrong; only states that explicitly want error tokens
+ should shift them. */
+
+ /* If its default is to accept any token, ok. Otherwise pop it. */
+ yyn = yydefact[yystate];
+ if (yyn)
+ goto yydefault;
+#endif
+
+
+/*---------------------------------------------------------------.
+| yyerrpop -- pop the current state because it cannot handle the |
+| error token |
+`---------------------------------------------------------------*/
+yyerrpop:
+ if (yyssp == yyss)
+ YYABORT;
+ yyvsp--;
+ yystate = *--yyssp;
+#if YYLSP_NEEDED
+ yylsp--;
+#endif
+
+#if YYDEBUG
+ if (yydebug)
+ {
+ short *yyssp1 = yyss - 1;
+ YYFPRINTF (stderr, "Error: state stack now");
+ while (yyssp1 != yyssp)
+ YYFPRINTF (stderr, " %d", *++yyssp1);
+ YYFPRINTF (stderr, "\n");
+ }
+#endif
+
+/*--------------.
+| yyerrhandle. |
+`--------------*/
+yyerrhandle:
+ yyn = yypact[yystate];
+ if (yyn == YYFLAG)
+ goto yyerrdefault;
+
+ yyn += YYTERROR;
+ if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
+ goto yyerrdefault;
+
+ yyn = yytable[yyn];
+ if (yyn < 0)
+ {
+ if (yyn == YYFLAG)
+ goto yyerrpop;
+ yyn = -yyn;
+ goto yyreduce;
+ }
+ else if (yyn == 0)
+ goto yyerrpop;
+
+ if (yyn == YYFINAL)
+ YYACCEPT;
+
+ YYDPRINTF ((stderr, "Shifting error token, "));
+
+ *++yyvsp = yylval;
+#if YYLSP_NEEDED
+ *++yylsp = yylloc;
+#endif
+
+ yystate = yyn;
+ goto yynewstate;
+
+
+/*-------------------------------------.
+| yyacceptlab -- YYACCEPT comes here. |
+`-------------------------------------*/
+yyacceptlab:
+ yyresult = 0;
+ goto yyreturn;
+
+/*-----------------------------------.
+| yyabortlab -- YYABORT comes here. |
+`-----------------------------------*/
+yyabortlab:
+ yyresult = 1;
+ goto yyreturn;
+
+/*---------------------------------------------.
+| yyoverflowab -- parser overflow comes here. |
+`---------------------------------------------*/
+yyoverflowlab:
+ yyerror ("parser stack overflow");
+ yyresult = 2;
+ /* Fall through. */
+
+yyreturn:
+#ifndef yyoverflow
+ if (yyss != yyssa)
+ YYSTACK_FREE (yyss);
+#endif
+ return yyresult;
+}
+#line 618 "./ada-exp.y"
+
+
+/* yylex defined in ada-lex.c: Reads one token, getting characters */
+/* through lexptr. */
+
+/* Remap normal flex interface names (yylex) as well as gratuitiously */
+/* global symbol names, so we can have multiple flex-generated parsers */
+/* in gdb. */
+
+/* (See note above on previous definitions for YACC.) */
+
+#define yy_create_buffer ada_yy_create_buffer
+#define yy_delete_buffer ada_yy_delete_buffer
+#define yy_init_buffer ada_yy_init_buffer
+#define yy_load_buffer_state ada_yy_load_buffer_state
+#define yy_switch_to_buffer ada_yy_switch_to_buffer
+#define yyrestart ada_yyrestart
+#define yytext ada_yytext
+#define yywrap ada_yywrap
+
+/* The following kludge was found necessary to prevent conflicts between */
+/* defs.h and non-standard stdlib.h files. */
+#define qsort __qsort__dummy
+#include "ada-lex.c"
+
+int
+ada_parse ()
+{
+ lexer_init (yyin); /* (Re-)initialize lexer. */
+ left_block_context = NULL;
+ type_qualifier = NULL;
+
+ return _ada_parse ();
+}
+
+void
+yyerror (msg)
+ char *msg;
+{
+ error ("A %s in expression, near `%s'.", (msg ? msg : "error"), lexptr);
+}
+
+/* The operator name corresponding to operator symbol STRING (adds
+ quotes and maps to lower-case). Destroys the previous contents of
+ the array pointed to by STRING.ptr. Error if STRING does not match
+ a valid Ada operator. Assumes that STRING.ptr points to a
+ null-terminated string and that, if STRING is a valid operator
+ symbol, the array pointed to by STRING.ptr contains at least
+ STRING.length+3 characters. */
+
+static struct stoken
+string_to_operator (string)
+ struct stoken string;
+{
+ int i;
+
+ for (i = 0; ada_opname_table[i].mangled != NULL; i += 1)
+ {
+ if (string.length == strlen (ada_opname_table[i].demangled)-2
+ && strncasecmp (string.ptr, ada_opname_table[i].demangled+1,
+ string.length) == 0)
+ {
+ strncpy (string.ptr, ada_opname_table[i].demangled,
+ string.length+2);
+ string.length += 2;
+ return string;
+ }
+ }
+ error ("Invalid operator symbol `%s'", string.ptr);
+}
+
+/* Emit expression to access an instance of SYM, in block BLOCK (if
+ * non-NULL), and with :: qualification ORIG_LEFT_CONTEXT. */
+static void
+write_var_from_sym (orig_left_context, block, sym)
+ struct block* orig_left_context;
+ struct block* block;
+ struct symbol* sym;
+{
+ if (orig_left_context == NULL && symbol_read_needs_frame (sym))
+ {
+ if (innermost_block == 0 ||
+ contained_in (block, innermost_block))
+ innermost_block = block;
+ }
+
+ write_exp_elt_opcode (OP_VAR_VALUE);
+ /* We want to use the selected frame, not another more inner frame
+ which happens to be in the same block */
+ write_exp_elt_block (NULL);
+ write_exp_elt_sym (sym);
+ write_exp_elt_opcode (OP_VAR_VALUE);
+}
+
+/* Emit expression to access an instance of NAME. */
+static void
+write_var_from_name (orig_left_context, name)
+ struct block* orig_left_context;
+ struct name_info name;
+{
+ if (name.msym != NULL)
+ {
+ write_exp_msymbol (name.msym,
+ lookup_function_type (builtin_type_int),
+ builtin_type_int);
+ }
+ else if (name.sym == NULL)
+ {
+ /* Multiple matches: record name and starting block for later
+ resolution by ada_resolve. */
+ /* write_exp_elt_opcode (OP_UNRESOLVED_VALUE); */
+ /* FIXME: OP_UNRESOLVED_VALUE should be defined in expression.h */
+ write_exp_elt_block (name.block);
+ /* write_exp_elt_name (name.stoken.ptr); */
+ /* FIXME: write_exp_elt_name should be defined in defs.h, located in parse.c */
+ /* write_exp_elt_opcode (OP_UNRESOLVED_VALUE); */
+ /* FIXME: OP_UNRESOLVED_VALUE should be defined in expression.h */
+ }
+ else
+ write_var_from_sym (orig_left_context, name.block, name.sym);
+}
+
+/* Write a call on parameterless attribute ATR. */
+
+static void
+write_attribute_call0 (atr)
+ enum ada_attribute atr;
+{
+ /* write_exp_elt_opcode (OP_ATTRIBUTE); */
+ /* FIXME: OP_ATTRIBUTE should be defined in expression.h */
+ write_exp_elt_longcst ((LONGEST) 0);
+ write_exp_elt_longcst ((LONGEST) atr);
+ /* write_exp_elt_opcode (OP_ATTRIBUTE); */
+ /* FIXME: OP_ATTRIBUTE should be defined in expression.h */
+}
+
+/* Write a call on an attribute ATR with one constant integer
+ * parameter. */
+
+static void
+write_attribute_call1 (atr, arg)
+ enum ada_attribute atr;
+ LONGEST arg;
+{
+ write_exp_elt_opcode (OP_LONG);
+ write_exp_elt_type (builtin_type_int);
+ write_exp_elt_longcst (arg);
+ write_exp_elt_opcode (OP_LONG);
+ /*write_exp_elt_opcode (OP_ATTRIBUTE);*/
+ /* FIXME: OP_ATTRIBUTE should be defined in expression.h */
+ write_exp_elt_longcst ((LONGEST) 1);
+ write_exp_elt_longcst ((LONGEST) atr);
+ /*write_exp_elt_opcode (OP_ATTRIBUTE);*/
+ /* FIXME: OP_ATTRIBUTE should be defined in expression.h */
+}
+
+/* Write a call on an attribute ATR with N parameters, whose code must have
+ * been generated previously. */
+
+static void
+write_attribute_calln (atr, n)
+ enum ada_attribute atr;
+ int n;
+{
+ /*write_exp_elt_opcode (OP_ATTRIBUTE);*/
+ /* FIXME: OP_ATTRIBUTE should be defined in expression.h */
+ write_exp_elt_longcst ((LONGEST) n);
+ write_exp_elt_longcst ((LONGEST) atr);
+ /* write_exp_elt_opcode (OP_ATTRIBUTE);*/
+ /* FIXME: OP_ATTRIBUTE should be defined in expression.h */
+}
+
+/* Emit expression corresponding to the renamed object designated by
+ * the type RENAMING, which must be the referent of an object renaming
+ * type, in the context of ORIG_LEFT_CONTEXT (?). */
+static void
+write_object_renaming (orig_left_context, renaming)
+ struct block* orig_left_context;
+ struct symbol* renaming;
+{
+ const char* qualification = SYMBOL_NAME (renaming);
+ const char* simple_tail;
+ const char* expr = TYPE_FIELD_NAME (SYMBOL_TYPE (renaming), 0);
+ const char* suffix;
+ char* name;
+ struct symbol* sym;
+ enum { SIMPLE_INDEX, LOWER_BOUND, UPPER_BOUND } slice_state;
+
+ /* if orig_left_context is null, then use the currently selected
+ block, otherwise we might fail our symbol lookup below */
+ if (orig_left_context == NULL)
+ orig_left_context = get_selected_block (NULL);
+
+ for (simple_tail = qualification + strlen (qualification);
+ simple_tail != qualification; simple_tail -= 1)
+ {
+ if (*simple_tail == '.')
+ {
+ simple_tail += 1;
+ break;
+ }
+ else if (STREQN (simple_tail, "__", 2))
+ {
+ simple_tail += 2;
+ break;
+ }
+ }
+
+ suffix = strstr (expr, "___XE");
+ if (suffix == NULL)
+ goto BadEncoding;
+
+ name = (char*) xmalloc (suffix - expr + 1);
+ /* add_name_string_cleanup (name); */
+ /* FIXME: add_name_string_cleanup should be defined in
+ parser-defs.h, implemented in parse.c */
+ strncpy (name, expr, suffix-expr);
+ name[suffix-expr] = '\000';
+ sym = lookup_symbol (name, orig_left_context, VAR_NAMESPACE, 0, NULL);
+ /* if (sym == NULL)
+ error ("Could not find renamed variable: %s", ada_demangle (name));
+ */
+ /* FIXME: ada_demangle should be defined in defs.h, implemented in ada-lang.c */
+ write_var_from_sym (orig_left_context, block_found, sym);
+
+ suffix += 5;
+ slice_state = SIMPLE_INDEX;
+ while (*suffix == 'X')
+ {
+ suffix += 1;
+
+ switch (*suffix) {
+ case 'L':
+ slice_state = LOWER_BOUND;
+ case 'S':
+ suffix += 1;
+ if (isdigit (*suffix))
+ {
+ char* next;
+ long val = strtol (suffix, &next, 10);
+ if (next == suffix)
+ goto BadEncoding;
+ suffix = next;
+ write_exp_elt_opcode (OP_LONG);
+ write_exp_elt_type (builtin_type_ada_int);
+ write_exp_elt_longcst ((LONGEST) val);
+ write_exp_elt_opcode (OP_LONG);
+ }
+ else
+ {
+ const char* end;
+ char* index_name;
+ int index_len;
+ struct symbol* index_sym;
+
+ end = strchr (suffix, 'X');
+ if (end == NULL)
+ end = suffix + strlen (suffix);
+
+ index_len = simple_tail - qualification + 2 + (suffix - end) + 1;
+ index_name = (char*) xmalloc (index_len);
+ memset (index_name, '\000', index_len);
+ /* add_name_string_cleanup (index_name);*/
+ /* FIXME: add_name_string_cleanup should be defined in
+ parser-defs.h, implemented in parse.c */
+ strncpy (index_name, qualification, simple_tail - qualification);
+ index_name[simple_tail - qualification] = '\000';
+ strncat (index_name, suffix, suffix-end);
+ suffix = end;
+
+ index_sym =
+ lookup_symbol (index_name, NULL, VAR_NAMESPACE, 0, NULL);
+ if (index_sym == NULL)
+ error ("Could not find %s", index_name);
+ write_var_from_sym (NULL, block_found, sym);
+ }
+ if (slice_state == SIMPLE_INDEX)
+ {
+ write_exp_elt_opcode (OP_FUNCALL);
+ write_exp_elt_longcst ((LONGEST) 1);
+ write_exp_elt_opcode (OP_FUNCALL);
+ }
+ else if (slice_state == LOWER_BOUND)
+ slice_state = UPPER_BOUND;
+ else if (slice_state == UPPER_BOUND)
+ {
+ write_exp_elt_opcode (TERNOP_SLICE);
+ slice_state = SIMPLE_INDEX;
+ }
+ break;
+
+ case 'R':
+ {
+ struct stoken field_name;
+ const char* end;
+ suffix += 1;
+
+ if (slice_state != SIMPLE_INDEX)
+ goto BadEncoding;
+ end = strchr (suffix, 'X');
+ if (end == NULL)
+ end = suffix + strlen (suffix);
+ field_name.length = end - suffix;
+ field_name.ptr = (char*) xmalloc (end - suffix + 1);
+ strncpy (field_name.ptr, suffix, end - suffix);
+ field_name.ptr[end - suffix] = '\000';
+ suffix = end;
+ write_exp_elt_opcode (STRUCTOP_STRUCT);
+ write_exp_string (field_name);
+ write_exp_elt_opcode (STRUCTOP_STRUCT);
+ break;
+ }
+
+ default:
+ goto BadEncoding;
+ }
+ }
+ if (slice_state == SIMPLE_INDEX)
+ return;
+
+ BadEncoding:
+ error ("Internal error in encoding of renaming declaration: %s",
+ SYMBOL_NAME (renaming));
+}
+
+/* Convert the character literal whose ASCII value would be VAL to the
+ appropriate value of type TYPE, if there is a translation.
+ Otherwise return VAL. Hence, in an enumeration type ('A', 'B'),
+ the literal 'A' (VAL == 65), returns 0. */
+static LONGEST
+convert_char_literal (struct type* type, LONGEST val)
+{
+ char name[7];
+ int f;
+
+ if (type == NULL || TYPE_CODE (type) != TYPE_CODE_ENUM)
+ return val;
+ sprintf (name, "QU%02x", (int) val);
+ for (f = 0; f < TYPE_NFIELDS (type); f += 1)
+ {
+ if (STREQ (name, TYPE_FIELD_NAME (type, f)))
+ return TYPE_FIELD_BITPOS (type, f);
+ }
+ return val;
+}
diff --git a/gdb/ada-exp.y b/gdb/ada-exp.y
new file mode 100644
index 00000000000..7d46dd2cf8b
--- /dev/null
+++ b/gdb/ada-exp.y
@@ -0,0 +1,962 @@
+/* YACC parser for Ada expressions, for GDB.
+ Copyright (C) 1986, 1989, 1990, 1991, 1993, 1994, 1997, 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., 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+/* Parse an Ada expression from text in a string,
+ and return the result as a struct expression pointer.
+ That structure contains arithmetic operations in reverse polish,
+ with constants represented by operations that are followed by special data.
+ See expression.h for the details of the format.
+ What is important here is that it can be built up sequentially
+ during the process of parsing; the lower levels of the tree always
+ come first in the result.
+
+ malloc's and realloc's in this file are transformed to
+ xmalloc and xrealloc respectively by the same sed command in the
+ makefile that remaps any other malloc/realloc inserted by the parser
+ generator. Doing this with #defines and trying to control the interaction
+ with include files (<malloc.h> and <stdlib.h> for example) just became
+ too messy, particularly when such includes can be inserted at random
+ times by the parser generator. */
+
+%{
+
+#include "defs.h"
+#include <string.h>
+#include <ctype.h>
+#include "expression.h"
+#include "value.h"
+#include "parser-defs.h"
+#include "language.h"
+#include "ada-lang.h"
+#include "bfd.h" /* Required by objfiles.h. */
+#include "symfile.h" /* Required by objfiles.h. */
+#include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
+#include "frame.h"
+
+/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
+ as well as gratuitiously global symbol names, so we can have multiple
+ yacc generated parsers in gdb. These are only the variables
+ produced by yacc. If other parser generators (bison, byacc, etc) produce
+ additional global names that conflict at link time, then those parser
+ generators need to be fixed instead of adding those names to this list. */
+
+/* NOTE: This is clumsy, especially since BISON and FLEX provide --prefix
+ options. I presume we are maintaining it to accommodate systems
+ without BISON? (PNH) */
+
+#define yymaxdepth ada_maxdepth
+#define yyparse _ada_parse /* ada_parse calls this after initialization */
+#define yylex ada_lex
+#define yyerror ada_error
+#define yylval ada_lval
+#define yychar ada_char
+#define yydebug ada_debug
+#define yypact ada_pact
+#define yyr1 ada_r1
+#define yyr2 ada_r2
+#define yydef ada_def
+#define yychk ada_chk
+#define yypgo ada_pgo
+#define yyact ada_act
+#define yyexca ada_exca
+#define yyerrflag ada_errflag
+#define yynerrs ada_nerrs
+#define yyps ada_ps
+#define yypv ada_pv
+#define yys ada_s
+#define yy_yys ada_yys
+#define yystate ada_state
+#define yytmp ada_tmp
+#define yyv ada_v
+#define yy_yyv ada_yyv
+#define yyval ada_val
+#define yylloc ada_lloc
+#define yyreds ada_reds /* With YYDEBUG defined */
+#define yytoks ada_toks /* With YYDEBUG defined */
+
+#ifndef YYDEBUG
+#define YYDEBUG 0 /* Default to no yydebug support */
+#endif
+
+struct name_info {
+ struct symbol* sym;
+ struct minimal_symbol* msym;
+ struct block* block;
+ struct stoken stoken;
+};
+
+/* If expression is in the context of TYPE'(...), then TYPE, else
+ * NULL. */
+static struct type* type_qualifier;
+
+int yyparse (void);
+
+static int yylex (void);
+
+void yyerror (char *);
+
+static struct stoken string_to_operator (struct stoken);
+
+static void write_attribute_call0 (enum ada_attribute);
+
+static void write_attribute_call1 (enum ada_attribute, LONGEST);
+
+static void write_attribute_calln (enum ada_attribute, int);
+
+static void write_object_renaming (struct block*, struct symbol*);
+
+static void write_var_from_name (struct block*, struct name_info);
+
+static LONGEST
+convert_char_literal (struct type*, LONGEST);
+%}
+
+%union
+ {
+ LONGEST lval;
+ struct {
+ LONGEST val;
+ struct type *type;
+ } typed_val;
+ struct {
+ DOUBLEST dval;
+ struct type *type;
+ } typed_val_float;
+ struct type *tval;
+ struct stoken sval;
+ struct name_info ssym;
+ int voidval;
+ struct block *bval;
+ struct internalvar *ivar;
+
+ }
+
+%type <voidval> exp exp1 simple_exp start variable
+%type <tval> type
+
+%token <typed_val> INT NULL_PTR CHARLIT
+%token <typed_val_float> FLOAT
+%token <tval> TYPENAME
+%token <bval> BLOCKNAME
+
+/* Both NAME and TYPENAME tokens represent symbols in the input,
+ and both convey their data as strings.
+ But a TYPENAME is a string that happens to be defined as a typedef
+ or builtin type name (such as int or char)
+ and a NAME is any other symbol.
+ Contexts where this distinction is not important can use the
+ nonterminal "name", which matches either NAME or TYPENAME. */
+
+%token <sval> STRING
+%token <ssym> NAME DOT_ID OBJECT_RENAMING
+%type <bval> block
+%type <lval> arglist tick_arglist
+
+%type <tval> save_qualifier
+
+%token DOT_ALL
+
+/* Special type cases, put in to allow the parser to distinguish different
+ legal basetypes. */
+%token <lval> LAST REGNAME
+
+%token <ivar> INTERNAL_VARIABLE
+
+%nonassoc ASSIGN
+%left _AND_ OR XOR THEN ELSE
+%left '=' NOTEQUAL '<' '>' LEQ GEQ IN DOTDOT
+%left '@'
+%left '+' '-' '&'
+%left UNARY
+%left '*' '/' MOD REM
+%right STARSTAR ABS NOT
+ /* The following are right-associative only so that reductions at this
+ precedence have lower precedence than '.' and '('. The syntax still
+ forces a.b.c, e.g., to be LEFT-associated. */
+%right TICK_ACCESS TICK_ADDRESS TICK_FIRST TICK_LAST TICK_LENGTH
+%right TICK_MAX TICK_MIN TICK_MODULUS
+%right TICK_POS TICK_RANGE TICK_SIZE TICK_TAG TICK_VAL
+%right '.' '(' '[' DOT_ID DOT_ALL
+
+%token ARROW NEW
+
+
+%%
+
+start : exp1
+ | type { write_exp_elt_opcode (OP_TYPE);
+ write_exp_elt_type ($1);
+ write_exp_elt_opcode (OP_TYPE); }
+ ;
+
+/* Expressions, including the sequencing operator. */
+exp1 : exp
+ | exp1 ';' exp
+ { write_exp_elt_opcode (BINOP_COMMA); }
+ ;
+
+/* Expressions, not including the sequencing operator. */
+simple_exp : simple_exp DOT_ALL
+ { write_exp_elt_opcode (UNOP_IND); }
+ ;
+
+simple_exp : simple_exp DOT_ID
+ { write_exp_elt_opcode (STRUCTOP_STRUCT);
+ write_exp_string ($2.stoken);
+ write_exp_elt_opcode (STRUCTOP_STRUCT);
+ }
+ ;
+
+simple_exp : simple_exp '(' arglist ')'
+ {
+ write_exp_elt_opcode (OP_FUNCALL);
+ write_exp_elt_longcst ($3);
+ write_exp_elt_opcode (OP_FUNCALL);
+ }
+ ;
+
+simple_exp : type '(' exp ')'
+ {
+ write_exp_elt_opcode (UNOP_CAST);
+ write_exp_elt_type ($1);
+ write_exp_elt_opcode (UNOP_CAST);
+ }
+ ;
+
+simple_exp : type '\'' save_qualifier { type_qualifier = $1; } '(' exp ')'
+ {
+ /* write_exp_elt_opcode (UNOP_QUAL); */
+ /* FIXME: UNOP_QUAL should be defined in expression.h */
+ write_exp_elt_type ($1);
+ /* write_exp_elt_opcode (UNOP_QUAL); */
+ /* FIXME: UNOP_QUAL should be defined in expression.h */
+ type_qualifier = $3;
+ }
+ ;
+
+save_qualifier : { $$ = type_qualifier; }
+
+simple_exp :
+ simple_exp '(' exp DOTDOT exp ')'
+ { write_exp_elt_opcode (TERNOP_SLICE); }
+ ;
+
+simple_exp : '(' exp1 ')' { }
+ ;
+
+simple_exp : variable
+ ;
+
+simple_exp: REGNAME /* GDB extension */
+ { write_exp_elt_opcode (OP_REGISTER);
+ write_exp_elt_longcst ((LONGEST) $1);
+ write_exp_elt_opcode (OP_REGISTER);
+ }
+ ;
+
+simple_exp: INTERNAL_VARIABLE /* GDB extension */
+ { write_exp_elt_opcode (OP_INTERNALVAR);
+ write_exp_elt_intern ($1);
+ write_exp_elt_opcode (OP_INTERNALVAR);
+ }
+ ;
+
+
+exp : simple_exp
+ ;
+
+simple_exp: LAST
+ { write_exp_elt_opcode (OP_LAST);
+ write_exp_elt_longcst ((LONGEST) $1);
+ write_exp_elt_opcode (OP_LAST);
+ }
+ ;
+
+exp : exp ASSIGN exp /* Extension for convenience */
+ { write_exp_elt_opcode (BINOP_ASSIGN); }
+ ;
+
+exp : '-' exp %prec UNARY
+ { write_exp_elt_opcode (UNOP_NEG); }
+ ;
+
+exp : '+' exp %prec UNARY
+ { write_exp_elt_opcode (UNOP_PLUS); }
+ ;
+
+exp : NOT exp %prec UNARY
+ { write_exp_elt_opcode (UNOP_LOGICAL_NOT); }
+ ;
+
+exp : ABS exp %prec UNARY
+ { write_exp_elt_opcode (UNOP_ABS); }
+ ;
+
+arglist : { $$ = 0; }
+ ;
+
+arglist : exp
+ { $$ = 1; }
+ | any_name ARROW exp
+ { $$ = 1; }
+ | arglist ',' exp
+ { $$ = $1 + 1; }
+ | arglist ',' any_name ARROW exp
+ { $$ = $1 + 1; }
+ ;
+
+exp : '{' type '}' exp %prec '.'
+ /* GDB extension */
+ { write_exp_elt_opcode (UNOP_MEMVAL);
+ write_exp_elt_type ($2);
+ write_exp_elt_opcode (UNOP_MEMVAL);
+ }
+ ;
+
+/* Binary operators in order of decreasing precedence. */
+
+exp : exp STARSTAR exp
+ { write_exp_elt_opcode (BINOP_EXP); }
+ ;
+
+exp : exp '*' exp
+ { write_exp_elt_opcode (BINOP_MUL); }
+ ;
+
+exp : exp '/' exp
+ { write_exp_elt_opcode (BINOP_DIV); }
+ ;
+
+exp : exp REM exp /* May need to be fixed to give correct Ada REM */
+ { write_exp_elt_opcode (BINOP_REM); }
+ ;
+
+exp : exp MOD exp
+ { write_exp_elt_opcode (BINOP_MOD); }
+ ;
+
+exp : exp '@' exp /* GDB extension */
+ { write_exp_elt_opcode (BINOP_REPEAT); }
+ ;
+
+exp : exp '+' exp
+ { write_exp_elt_opcode (BINOP_ADD); }
+ ;
+
+exp : exp '&' exp
+ { write_exp_elt_opcode (BINOP_CONCAT); }
+ ;
+
+exp : exp '-' exp
+ { write_exp_elt_opcode (BINOP_SUB); }
+ ;
+
+exp : exp '=' exp
+ { write_exp_elt_opcode (BINOP_EQUAL); }
+ ;
+
+exp : exp NOTEQUAL exp
+ { write_exp_elt_opcode (BINOP_NOTEQUAL); }
+ ;
+
+exp : exp LEQ exp
+ { write_exp_elt_opcode (BINOP_LEQ); }
+ ;
+
+exp : exp IN exp DOTDOT exp
+ { /*write_exp_elt_opcode (TERNOP_MBR); */ }
+ /* FIXME: TERNOP_MBR should be defined in
+ expression.h */
+ | exp IN exp TICK_RANGE tick_arglist
+ { /*write_exp_elt_opcode (BINOP_MBR); */
+ /* FIXME: BINOP_MBR should be defined in expression.h */
+ write_exp_elt_longcst ((LONGEST) $5);
+ /*write_exp_elt_opcode (BINOP_MBR); */
+ }
+ | exp IN TYPENAME %prec TICK_ACCESS
+ { /*write_exp_elt_opcode (UNOP_MBR); */
+ /* FIXME: UNOP_QUAL should be defined in expression.h */
+ write_exp_elt_type ($3);
+ /* write_exp_elt_opcode (UNOP_MBR); */
+ /* FIXME: UNOP_MBR should be defined in expression.h */
+ }
+ | exp NOT IN exp DOTDOT exp
+ { /*write_exp_elt_opcode (TERNOP_MBR); */
+ /* FIXME: TERNOP_MBR should be defined in expression.h */
+ write_exp_elt_opcode (UNOP_LOGICAL_NOT);
+ }
+ | exp NOT IN exp TICK_RANGE tick_arglist
+ { /* write_exp_elt_opcode (BINOP_MBR); */
+ /* FIXME: BINOP_MBR should be defined in expression.h */
+ write_exp_elt_longcst ((LONGEST) $6);
+ /*write_exp_elt_opcode (BINOP_MBR);*/
+ /* FIXME: BINOP_MBR should be defined in expression.h */
+ write_exp_elt_opcode (UNOP_LOGICAL_NOT);
+ }
+ | exp NOT IN TYPENAME %prec TICK_ACCESS
+ { /*write_exp_elt_opcode (UNOP_MBR);*/
+ /* FIXME: UNOP_MBR should be defined in expression.h */
+ write_exp_elt_type ($4);
+ /* write_exp_elt_opcode (UNOP_MBR);*/
+ /* FIXME: UNOP_MBR should be defined in expression.h */
+ write_exp_elt_opcode (UNOP_LOGICAL_NOT);
+ }
+ ;
+
+exp : exp GEQ exp
+ { write_exp_elt_opcode (BINOP_GEQ); }
+ ;
+
+exp : exp '<' exp
+ { write_exp_elt_opcode (BINOP_LESS); }
+ ;
+
+exp : exp '>' exp
+ { write_exp_elt_opcode (BINOP_GTR); }
+ ;
+
+exp : exp _AND_ exp /* Fix for Ada elementwise AND. */
+ { write_exp_elt_opcode (BINOP_BITWISE_AND); }
+ ;
+
+exp : exp _AND_ THEN exp %prec _AND_
+ { write_exp_elt_opcode (BINOP_LOGICAL_AND); }
+ ;
+
+exp : exp OR exp /* Fix for Ada elementwise OR */
+ { write_exp_elt_opcode (BINOP_BITWISE_IOR); }
+ ;
+
+exp : exp OR ELSE exp
+ { write_exp_elt_opcode (BINOP_LOGICAL_OR); }
+ ;
+
+exp : exp XOR exp /* Fix for Ada elementwise XOR */
+ { write_exp_elt_opcode (BINOP_BITWISE_XOR); }
+ ;
+
+simple_exp : simple_exp TICK_ACCESS
+ { write_exp_elt_opcode (UNOP_ADDR); }
+ | simple_exp TICK_ADDRESS
+ { write_exp_elt_opcode (UNOP_ADDR);
+ write_exp_elt_opcode (UNOP_CAST);
+ write_exp_elt_type (builtin_type_ada_system_address);
+ write_exp_elt_opcode (UNOP_CAST);
+ }
+ | simple_exp TICK_FIRST tick_arglist
+ { write_attribute_call1 (ATR_FIRST, $3); }
+ | simple_exp TICK_LAST tick_arglist
+ { write_attribute_call1 (ATR_LAST, $3); }
+ | simple_exp TICK_LENGTH tick_arglist
+ { write_attribute_call1 (ATR_LENGTH, $3); }
+ | simple_exp TICK_SIZE
+ { write_attribute_call0 (ATR_SIZE); }
+ | simple_exp TICK_TAG
+ { write_attribute_call0 (ATR_TAG); }
+ | opt_type_prefix TICK_MIN '(' exp ',' exp ')'
+ { write_attribute_calln (ATR_MIN, 2); }
+ | opt_type_prefix TICK_MAX '(' exp ',' exp ')'
+ { write_attribute_calln (ATR_MAX, 2); }
+ | opt_type_prefix TICK_POS '(' exp ')'
+ { write_attribute_calln (ATR_POS, 1); }
+ | type_prefix TICK_FIRST tick_arglist
+ { write_attribute_call1 (ATR_FIRST, $3); }
+ | type_prefix TICK_LAST tick_arglist
+ { write_attribute_call1 (ATR_LAST, $3); }
+ | type_prefix TICK_LENGTH tick_arglist
+ { write_attribute_call1 (ATR_LENGTH, $3); }
+ | type_prefix TICK_VAL '(' exp ')'
+ { write_attribute_calln (ATR_VAL, 1); }
+ | type_prefix TICK_MODULUS
+ { write_attribute_call0 (ATR_MODULUS); }
+ ;
+
+tick_arglist : %prec '('
+ { $$ = 1; }
+ | '(' INT ')'
+ { $$ = $2.val; }
+ ;
+
+type_prefix :
+ TYPENAME
+ { write_exp_elt_opcode (OP_TYPE);
+ write_exp_elt_type ($1);
+ write_exp_elt_opcode (OP_TYPE); }
+ ;
+
+opt_type_prefix :
+ type_prefix
+ | /* EMPTY */
+ { write_exp_elt_opcode (OP_TYPE);
+ write_exp_elt_type (builtin_type_void);
+ write_exp_elt_opcode (OP_TYPE); }
+ ;
+
+
+exp : INT
+ { write_exp_elt_opcode (OP_LONG);
+ write_exp_elt_type ($1.type);
+ write_exp_elt_longcst ((LONGEST)($1.val));
+ write_exp_elt_opcode (OP_LONG);
+ }
+ ;
+
+exp : CHARLIT
+ { write_exp_elt_opcode (OP_LONG);
+ if (type_qualifier == NULL)
+ write_exp_elt_type ($1.type);
+ else
+ write_exp_elt_type (type_qualifier);
+ write_exp_elt_longcst
+ (convert_char_literal (type_qualifier, $1.val));
+ write_exp_elt_opcode (OP_LONG);
+ }
+
+
+exp : FLOAT
+ { write_exp_elt_opcode (OP_DOUBLE);
+ write_exp_elt_type ($1.type);
+ write_exp_elt_dblcst ($1.dval);
+ write_exp_elt_opcode (OP_DOUBLE);
+ }
+ ;
+
+exp : NULL_PTR
+ { write_exp_elt_opcode (OP_LONG);
+ write_exp_elt_type (builtin_type_int);
+ write_exp_elt_longcst ((LONGEST)(0));
+ write_exp_elt_opcode (OP_LONG);
+ }
+
+exp : STRING
+ { /* Ada strings are converted into array constants
+ a lower bound of 1. Thus, the array upper bound
+ is the string length. */
+ char *sp = $1.ptr; int count;
+ if ($1.length == 0)
+ { /* One dummy character for the type */
+ write_exp_elt_opcode (OP_LONG);
+ write_exp_elt_type (builtin_type_ada_char);
+ write_exp_elt_longcst ((LONGEST)(0));
+ write_exp_elt_opcode (OP_LONG);
+ }
+ for (count = $1.length; count > 0; count -= 1)
+ {
+ write_exp_elt_opcode (OP_LONG);
+ write_exp_elt_type (builtin_type_ada_char);
+ write_exp_elt_longcst ((LONGEST)(*sp));
+ sp += 1;
+ write_exp_elt_opcode (OP_LONG);
+ }
+ write_exp_elt_opcode (OP_ARRAY);
+ write_exp_elt_longcst ((LONGEST) 1);
+ write_exp_elt_longcst ((LONGEST) ($1.length));
+ write_exp_elt_opcode (OP_ARRAY);
+ }
+ ;
+
+exp : NEW TYPENAME
+ { error ("NEW not implemented."); }
+ ;
+
+variable: NAME { write_var_from_name (NULL, $1); }
+ | block NAME /* GDB extension */
+ { write_var_from_name ($1, $2); }
+ | OBJECT_RENAMING { write_object_renaming (NULL, $1.sym); }
+ | block OBJECT_RENAMING
+ { write_object_renaming ($1, $2.sym); }
+ ;
+
+any_name : NAME { }
+ | TYPENAME { }
+ | OBJECT_RENAMING { }
+ ;
+
+block : BLOCKNAME /* GDB extension */
+ { $$ = $1; }
+ | block BLOCKNAME /* GDB extension */
+ { $$ = $2; }
+ ;
+
+
+type : TYPENAME { $$ = $1; }
+ | block TYPENAME { $$ = $2; }
+ | TYPENAME TICK_ACCESS
+ { $$ = lookup_pointer_type ($1); }
+ | block TYPENAME TICK_ACCESS
+ { $$ = lookup_pointer_type ($2); }
+ ;
+
+/* Some extensions borrowed from C, for the benefit of those who find they
+ can't get used to Ada notation in GDB. */
+
+exp : '*' exp %prec '.'
+ { write_exp_elt_opcode (UNOP_IND); }
+ | '&' exp %prec '.'
+ { write_exp_elt_opcode (UNOP_ADDR); }
+ | exp '[' exp ']'
+ { write_exp_elt_opcode (BINOP_SUBSCRIPT); }
+ ;
+
+%%
+
+/* yylex defined in ada-lex.c: Reads one token, getting characters */
+/* through lexptr. */
+
+/* Remap normal flex interface names (yylex) as well as gratuitiously */
+/* global symbol names, so we can have multiple flex-generated parsers */
+/* in gdb. */
+
+/* (See note above on previous definitions for YACC.) */
+
+#define yy_create_buffer ada_yy_create_buffer
+#define yy_delete_buffer ada_yy_delete_buffer
+#define yy_init_buffer ada_yy_init_buffer
+#define yy_load_buffer_state ada_yy_load_buffer_state
+#define yy_switch_to_buffer ada_yy_switch_to_buffer
+#define yyrestart ada_yyrestart
+#define yytext ada_yytext
+#define yywrap ada_yywrap
+
+/* The following kludge was found necessary to prevent conflicts between */
+/* defs.h and non-standard stdlib.h files. */
+#define qsort __qsort__dummy
+#include "ada-lex.c"
+
+int
+ada_parse ()
+{
+ lexer_init (yyin); /* (Re-)initialize lexer. */
+ left_block_context = NULL;
+ type_qualifier = NULL;
+
+ return _ada_parse ();
+}
+
+void
+yyerror (msg)
+ char *msg;
+{
+ error ("A %s in expression, near `%s'.", (msg ? msg : "error"), lexptr);
+}
+
+/* The operator name corresponding to operator symbol STRING (adds
+ quotes and maps to lower-case). Destroys the previous contents of
+ the array pointed to by STRING.ptr. Error if STRING does not match
+ a valid Ada operator. Assumes that STRING.ptr points to a
+ null-terminated string and that, if STRING is a valid operator
+ symbol, the array pointed to by STRING.ptr contains at least
+ STRING.length+3 characters. */
+
+static struct stoken
+string_to_operator (string)
+ struct stoken string;
+{
+ int i;
+
+ for (i = 0; ada_opname_table[i].mangled != NULL; i += 1)
+ {
+ if (string.length == strlen (ada_opname_table[i].demangled)-2
+ && strncasecmp (string.ptr, ada_opname_table[i].demangled+1,
+ string.length) == 0)
+ {
+ strncpy (string.ptr, ada_opname_table[i].demangled,
+ string.length+2);
+ string.length += 2;
+ return string;
+ }
+ }
+ error ("Invalid operator symbol `%s'", string.ptr);
+}
+
+/* Emit expression to access an instance of SYM, in block BLOCK (if
+ * non-NULL), and with :: qualification ORIG_LEFT_CONTEXT. */
+static void
+write_var_from_sym (orig_left_context, block, sym)
+ struct block* orig_left_context;
+ struct block* block;
+ struct symbol* sym;
+{
+ if (orig_left_context == NULL && symbol_read_needs_frame (sym))
+ {
+ if (innermost_block == 0 ||
+ contained_in (block, innermost_block))
+ innermost_block = block;
+ }
+
+ write_exp_elt_opcode (OP_VAR_VALUE);
+ /* We want to use the selected frame, not another more inner frame
+ which happens to be in the same block */
+ write_exp_elt_block (NULL);
+ write_exp_elt_sym (sym);
+ write_exp_elt_opcode (OP_VAR_VALUE);
+}
+
+/* Emit expression to access an instance of NAME. */
+static void
+write_var_from_name (orig_left_context, name)
+ struct block* orig_left_context;
+ struct name_info name;
+{
+ if (name.msym != NULL)
+ {
+ write_exp_msymbol (name.msym,
+ lookup_function_type (builtin_type_int),
+ builtin_type_int);
+ }
+ else if (name.sym == NULL)
+ {
+ /* Multiple matches: record name and starting block for later
+ resolution by ada_resolve. */
+ /* write_exp_elt_opcode (OP_UNRESOLVED_VALUE); */
+ /* FIXME: OP_UNRESOLVED_VALUE should be defined in expression.h */
+ write_exp_elt_block (name.block);
+ /* write_exp_elt_name (name.stoken.ptr); */
+ /* FIXME: write_exp_elt_name should be defined in defs.h, located in parse.c */
+ /* write_exp_elt_opcode (OP_UNRESOLVED_VALUE); */
+ /* FIXME: OP_UNRESOLVED_VALUE should be defined in expression.h */
+ }
+ else
+ write_var_from_sym (orig_left_context, name.block, name.sym);
+}
+
+/* Write a call on parameterless attribute ATR. */
+
+static void
+write_attribute_call0 (atr)
+ enum ada_attribute atr;
+{
+ /* write_exp_elt_opcode (OP_ATTRIBUTE); */
+ /* FIXME: OP_ATTRIBUTE should be defined in expression.h */
+ write_exp_elt_longcst ((LONGEST) 0);
+ write_exp_elt_longcst ((LONGEST) atr);
+ /* write_exp_elt_opcode (OP_ATTRIBUTE); */
+ /* FIXME: OP_ATTRIBUTE should be defined in expression.h */
+}
+
+/* Write a call on an attribute ATR with one constant integer
+ * parameter. */
+
+static void
+write_attribute_call1 (atr, arg)
+ enum ada_attribute atr;
+ LONGEST arg;
+{
+ write_exp_elt_opcode (OP_LONG);
+ write_exp_elt_type (builtin_type_int);
+ write_exp_elt_longcst (arg);
+ write_exp_elt_opcode (OP_LONG);
+ /*write_exp_elt_opcode (OP_ATTRIBUTE);*/
+ /* FIXME: OP_ATTRIBUTE should be defined in expression.h */
+ write_exp_elt_longcst ((LONGEST) 1);
+ write_exp_elt_longcst ((LONGEST) atr);
+ /*write_exp_elt_opcode (OP_ATTRIBUTE);*/
+ /* FIXME: OP_ATTRIBUTE should be defined in expression.h */
+}
+
+/* Write a call on an attribute ATR with N parameters, whose code must have
+ * been generated previously. */
+
+static void
+write_attribute_calln (atr, n)
+ enum ada_attribute atr;
+ int n;
+{
+ /*write_exp_elt_opcode (OP_ATTRIBUTE);*/
+ /* FIXME: OP_ATTRIBUTE should be defined in expression.h */
+ write_exp_elt_longcst ((LONGEST) n);
+ write_exp_elt_longcst ((LONGEST) atr);
+ /* write_exp_elt_opcode (OP_ATTRIBUTE);*/
+ /* FIXME: OP_ATTRIBUTE should be defined in expression.h */
+}
+
+/* Emit expression corresponding to the renamed object designated by
+ * the type RENAMING, which must be the referent of an object renaming
+ * type, in the context of ORIG_LEFT_CONTEXT (?). */
+static void
+write_object_renaming (orig_left_context, renaming)
+ struct block* orig_left_context;
+ struct symbol* renaming;
+{
+ const char* qualification = SYMBOL_NAME (renaming);
+ const char* simple_tail;
+ const char* expr = TYPE_FIELD_NAME (SYMBOL_TYPE (renaming), 0);
+ const char* suffix;
+ char* name;
+ struct symbol* sym;
+ enum { SIMPLE_INDEX, LOWER_BOUND, UPPER_BOUND } slice_state;
+
+ /* if orig_left_context is null, then use the currently selected
+ block, otherwise we might fail our symbol lookup below */
+ if (orig_left_context == NULL)
+ orig_left_context = get_selected_block (NULL);
+
+ for (simple_tail = qualification + strlen (qualification);
+ simple_tail != qualification; simple_tail -= 1)
+ {
+ if (*simple_tail == '.')
+ {
+ simple_tail += 1;
+ break;
+ }
+ else if (STREQN (simple_tail, "__", 2))
+ {
+ simple_tail += 2;
+ break;
+ }
+ }
+
+ suffix = strstr (expr, "___XE");
+ if (suffix == NULL)
+ goto BadEncoding;
+
+ name = (char*) malloc (suffix - expr + 1);
+ /* add_name_string_cleanup (name); */
+ /* FIXME: add_name_string_cleanup should be defined in
+ parser-defs.h, implemented in parse.c */
+ strncpy (name, expr, suffix-expr);
+ name[suffix-expr] = '\000';
+ sym = lookup_symbol (name, orig_left_context, VAR_NAMESPACE, 0, NULL);
+ /* if (sym == NULL)
+ error ("Could not find renamed variable: %s", ada_demangle (name));
+ */
+ /* FIXME: ada_demangle should be defined in defs.h, implemented in ada-lang.c */
+ write_var_from_sym (orig_left_context, block_found, sym);
+
+ suffix += 5;
+ slice_state = SIMPLE_INDEX;
+ while (*suffix == 'X')
+ {
+ suffix += 1;
+
+ switch (*suffix) {
+ case 'L':
+ slice_state = LOWER_BOUND;
+ case 'S':
+ suffix += 1;
+ if (isdigit (*suffix))
+ {
+ char* next;
+ long val = strtol (suffix, &next, 10);
+ if (next == suffix)
+ goto BadEncoding;
+ suffix = next;
+ write_exp_elt_opcode (OP_LONG);
+ write_exp_elt_type (builtin_type_ada_int);
+ write_exp_elt_longcst ((LONGEST) val);
+ write_exp_elt_opcode (OP_LONG);
+ }
+ else
+ {
+ const char* end;
+ char* index_name;
+ int index_len;
+ struct symbol* index_sym;
+
+ end = strchr (suffix, 'X');
+ if (end == NULL)
+ end = suffix + strlen (suffix);
+
+ index_len = simple_tail - qualification + 2 + (suffix - end) + 1;
+ index_name = (char*) malloc (index_len);
+ memset (index_name, '\000', index_len);
+ /* add_name_string_cleanup (index_name);*/
+ /* FIXME: add_name_string_cleanup should be defined in
+ parser-defs.h, implemented in parse.c */
+ strncpy (index_name, qualification, simple_tail - qualification);
+ index_name[simple_tail - qualification] = '\000';
+ strncat (index_name, suffix, suffix-end);
+ suffix = end;
+
+ index_sym =
+ lookup_symbol (index_name, NULL, VAR_NAMESPACE, 0, NULL);
+ if (index_sym == NULL)
+ error ("Could not find %s", index_name);
+ write_var_from_sym (NULL, block_found, sym);
+ }
+ if (slice_state == SIMPLE_INDEX)
+ {
+ write_exp_elt_opcode (OP_FUNCALL);
+ write_exp_elt_longcst ((LONGEST) 1);
+ write_exp_elt_opcode (OP_FUNCALL);
+ }
+ else if (slice_state == LOWER_BOUND)
+ slice_state = UPPER_BOUND;
+ else if (slice_state == UPPER_BOUND)
+ {
+ write_exp_elt_opcode (TERNOP_SLICE);
+ slice_state = SIMPLE_INDEX;
+ }
+ break;
+
+ case 'R':
+ {
+ struct stoken field_name;
+ const char* end;
+ suffix += 1;
+
+ if (slice_state != SIMPLE_INDEX)
+ goto BadEncoding;
+ end = strchr (suffix, 'X');
+ if (end == NULL)
+ end = suffix + strlen (suffix);
+ field_name.length = end - suffix;
+ field_name.ptr = (char*) malloc (end - suffix + 1);
+ strncpy (field_name.ptr, suffix, end - suffix);
+ field_name.ptr[end - suffix] = '\000';
+ suffix = end;
+ write_exp_elt_opcode (STRUCTOP_STRUCT);
+ write_exp_string (field_name);
+ write_exp_elt_opcode (STRUCTOP_STRUCT);
+ break;
+ }
+
+ default:
+ goto BadEncoding;
+ }
+ }
+ if (slice_state == SIMPLE_INDEX)
+ return;
+
+ BadEncoding:
+ error ("Internal error in encoding of renaming declaration: %s",
+ SYMBOL_NAME (renaming));
+}
+
+/* Convert the character literal whose ASCII value would be VAL to the
+ appropriate value of type TYPE, if there is a translation.
+ Otherwise return VAL. Hence, in an enumeration type ('A', 'B'),
+ the literal 'A' (VAL == 65), returns 0. */
+static LONGEST
+convert_char_literal (struct type* type, LONGEST val)
+{
+ char name[7];
+ int f;
+
+ if (type == NULL || TYPE_CODE (type) != TYPE_CODE_ENUM)
+ return val;
+ sprintf (name, "QU%02x", (int) val);
+ for (f = 0; f < TYPE_NFIELDS (type); f += 1)
+ {
+ if (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
new file mode 100644
index 00000000000..2c4f1d94d41
--- /dev/null
+++ b/gdb/ada-lang.c
@@ -0,0 +1,8626 @@
+/* Ada language support routines for GDB, the GNU debugger. Copyright
+ 1992, 1993, 1994, 1997, 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., 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+#include <stdarg.h>
+#include "demangle.h"
+#include "defs.h"
+#include "symtab.h"
+#include "gdbtypes.h"
+#include "gdbcmd.h"
+#include "expression.h"
+#include "parser-defs.h"
+#include "language.h"
+#include "c-lang.h"
+#include "inferior.h"
+#include "symfile.h"
+#include "objfiles.h"
+#include "breakpoint.h"
+#include "gdbcore.h"
+#include "ada-lang.h"
+#ifdef UI_OUT
+#include "ui-out.h"
+#endif
+
+struct cleanup* unresolved_names;
+
+void extract_string (CORE_ADDR addr, char *buf);
+
+static struct type * ada_create_fundamental_type (struct objfile *, int);
+
+static void modify_general_field (char *, LONGEST, int, int);
+
+static struct type* desc_base_type (struct type*);
+
+static struct type* desc_bounds_type (struct type*);
+
+static struct value* desc_bounds (struct value*);
+
+static int fat_pntr_bounds_bitpos (struct type*);
+
+static int fat_pntr_bounds_bitsize (struct type*);
+
+static struct type* desc_data_type (struct type*);
+
+static struct value* desc_data (struct value*);
+
+static int fat_pntr_data_bitpos (struct type*);
+
+static int fat_pntr_data_bitsize (struct type*);
+
+static struct value* desc_one_bound (struct value*, int, int);
+
+static int desc_bound_bitpos (struct type*, int, int);
+
+static int desc_bound_bitsize (struct type*, int, int);
+
+static struct type* desc_index_type (struct type*, int);
+
+static int desc_arity (struct type*);
+
+static int ada_type_match (struct type*, struct type*, int);
+
+static int ada_args_match (struct symbol*, struct value**, int);
+
+static struct value* place_on_stack (struct value*, CORE_ADDR*);
+
+static struct value* convert_actual (struct value*, struct type*, CORE_ADDR*);
+
+static struct value* make_array_descriptor (struct type*, struct value*, CORE_ADDR*);
+
+static void ada_add_block_symbols (struct block*, const char*,
+ namespace_enum, struct objfile*, int);
+
+static void fill_in_ada_prototype (struct symbol*);
+
+static int is_nonfunction (struct symbol**, int);
+
+static void add_defn_to_vec (struct symbol*, struct block*);
+
+static struct partial_symbol*
+ada_lookup_partial_symbol (struct partial_symtab*, const char*,
+ int, namespace_enum, int);
+
+static struct symtab* symtab_for_sym (struct symbol*);
+
+static struct value* ada_resolve_subexp (struct expression**, int*, int, struct type*);
+
+static void replace_operator_with_call (struct expression**, int, int, int,
+ struct symbol*, struct block*);
+
+static int possible_user_operator_p (enum exp_opcode, struct value**);
+
+static const char* ada_op_name (enum exp_opcode);
+
+static int numeric_type_p (struct type*);
+
+static int integer_type_p (struct type*);
+
+static int scalar_type_p (struct type*);
+
+static int discrete_type_p (struct type*);
+
+static char* extended_canonical_line_spec (struct symtab_and_line, const char*);
+
+static struct value* evaluate_subexp (struct type*, struct expression*, int*, enum noside);
+
+static struct value* evaluate_subexp_type (struct expression*, int*);
+
+static struct type * ada_create_fundamental_type (struct objfile*, int);
+
+static int is_dynamic_field (struct type *, int);
+
+static struct type*
+to_fixed_variant_branch_type (struct type*, char*, CORE_ADDR, struct value*);
+
+static struct type* to_fixed_range_type (char*, struct value*, struct objfile*);
+
+static struct type* to_static_fixed_type (struct type*);
+
+static struct value* unwrap_value (struct value*);
+
+static struct type* packed_array_type (struct type*, long*);
+
+static struct type* decode_packed_array_type (struct type*);
+
+static struct value* decode_packed_array (struct value*);
+
+static struct value* value_subscript_packed (struct value*, int, struct value**);
+
+static struct value* coerce_unspec_val_to_type (struct value*, long, struct type*);
+
+static struct value* get_var_value (char*, char*);
+
+static int lesseq_defined_than (struct symbol*, struct symbol*);
+
+static int equiv_types (struct type*, struct type*);
+
+static int is_name_suffix (const char*);
+
+static int wild_match (const char*, int, const char*);
+
+static struct symtabs_and_lines find_sal_from_funcs_and_line (const char*, int, struct symbol**, int);
+
+static int
+find_line_in_linetable (struct linetable*, int, struct symbol**, int, int*);
+
+static int find_next_line_in_linetable (struct linetable*, int, int, int);
+
+static struct symtabs_and_lines all_sals_for_line (const char*, int, char***);
+
+static void read_all_symtabs (const char*);
+
+static int is_plausible_func_for_line (struct symbol*, int);
+
+static struct value* ada_coerce_ref (struct value*);
+
+static struct value* value_pos_atr (struct value*);
+
+static struct value* value_val_atr (struct type*, struct value*);
+
+static struct symbol* standard_lookup (const char*, namespace_enum);
+
+extern void markTimeStart (int index);
+extern void markTimeStop (int index);
+
+
+
+/* Maximum-sized dynamic type. */
+static unsigned int varsize_limit;
+
+static const char* ada_completer_word_break_characters =
+ " \t\n!@#$%^&*()+=|~`}{[]\";:?/,-";
+
+/* The name of the symbol to use to get the name of the main subprogram */
+#define ADA_MAIN_PROGRAM_SYMBOL_NAME "__gnat_ada_main_program_name"
+
+ /* Utilities */
+
+/* extract_string
+ *
+ * read the string located at ADDR from the inferior and store the
+ * result into BUF
+ */
+void
+extract_string (CORE_ADDR addr, char *buf)
+{
+ int char_index = 0;
+
+ /* Loop, reading one byte at a time, until we reach the '\000'
+ end-of-string marker */
+ do
+ {
+ target_read_memory (addr + char_index * sizeof (char),
+ buf + char_index * sizeof (char),
+ sizeof (char));
+ char_index++;
+ }
+ while (buf[char_index - 1] != '\000');
+}
+
+/* Assuming *OLD_VECT points to an array of *SIZE objects of size
+ ELEMENT_SIZE, grow it to contain at least MIN_SIZE objects,
+ updating *OLD_VECT and *SIZE as necessary. */
+
+void
+grow_vect (old_vect, size, min_size, element_size)
+ void** old_vect;
+ size_t* size;
+ size_t min_size;
+ int element_size;
+{
+ if (*size < min_size) {
+ *size *= 2;
+ if (*size < min_size)
+ *size = min_size;
+ *old_vect = xrealloc (*old_vect, *size * element_size);
+ }
+}
+
+/* True (non-zero) iff TARGET matches FIELD_NAME up to any trailing
+ suffix of FIELD_NAME beginning "___" */
+
+static int
+field_name_match (field_name, target)
+ const char *field_name;
+ const char *target;
+{
+ int len = strlen (target);
+ return
+ STREQN (field_name, target, len)
+ && (field_name[len] == '\0'
+ || (STREQN (field_name + len, "___", 3)
+ && ! STREQ (field_name + strlen (field_name) - 6, "___XVN")));
+}
+
+
+/* The length of the prefix of NAME prior to any "___" suffix. */
+
+int
+ada_name_prefix_len (name)
+ const char* name;
+{
+ if (name == NULL)
+ return 0;
+ else
+ {
+ const char* p = strstr (name, "___");
+ if (p == NULL)
+ return strlen (name);
+ else
+ return p - name;
+ }
+}
+
+/* SUFFIX is a suffix of STR. False if STR is null. */
+static int
+is_suffix (const char* str, const char* suffix)
+{
+ int len1, len2;
+ if (str == NULL)
+ return 0;
+ len1 = strlen (str);
+ len2 = strlen (suffix);
+ return (len1 >= len2 && STREQ (str + len1 - len2, suffix));
+}
+
+/* Create a value of type TYPE whose contents come from VALADDR, if it
+ * is non-null, and whose memory address (in the inferior) is
+ * ADDRESS. */
+struct value*
+value_from_contents_and_address (type, valaddr, address)
+ struct type* type;
+ char* valaddr;
+ CORE_ADDR address;
+{
+ struct value* v = allocate_value (type);
+ if (valaddr == NULL)
+ VALUE_LAZY (v) = 1;
+ else
+ memcpy (VALUE_CONTENTS_RAW (v), valaddr, TYPE_LENGTH (type));
+ VALUE_ADDRESS (v) = address;
+ if (address != 0)
+ VALUE_LVAL (v) = lval_memory;
+ return v;
+}
+
+/* The contents of value VAL, beginning at offset OFFSET, treated as a
+ value of type TYPE. The result is an lval in memory if VAL is. */
+
+static struct value*
+coerce_unspec_val_to_type (val, offset, type)
+ struct value* val;
+ long offset;
+ struct type *type;
+{
+ CHECK_TYPEDEF (type);
+ if (VALUE_LVAL (val) == lval_memory)
+ return value_at_lazy (type,
+ VALUE_ADDRESS (val) + VALUE_OFFSET (val) + offset, NULL);
+ else
+ {
+ struct value* result = allocate_value (type);
+ VALUE_LVAL (result) = not_lval;
+ if (VALUE_ADDRESS (val) == 0)
+ memcpy (VALUE_CONTENTS_RAW (result), VALUE_CONTENTS (val) + offset,
+ TYPE_LENGTH (type) > TYPE_LENGTH (VALUE_TYPE (val))
+ ? TYPE_LENGTH (VALUE_TYPE (val)) : TYPE_LENGTH (type));
+ else
+ {
+ VALUE_ADDRESS (result) =
+ VALUE_ADDRESS (val) + VALUE_OFFSET (val) + offset;
+ VALUE_LAZY (result) = 1;
+ }
+ return result;
+ }
+}
+
+static char*
+cond_offset_host (valaddr, offset)
+ char* valaddr;
+ long offset;
+{
+ if (valaddr == NULL)
+ return NULL;
+ else
+ return valaddr + offset;
+}
+
+static CORE_ADDR
+cond_offset_target (address, offset)
+ CORE_ADDR address;
+ long offset;
+{
+ if (address == 0)
+ return 0;
+ else
+ return address + offset;
+}
+
+/* Perform execute_command on the result of concatenating all
+ arguments up to NULL. */
+static void
+do_command (const char* arg, ...)
+{
+ int len;
+ char* cmd;
+ const char* s;
+ va_list ap;
+
+ va_start (ap, arg);
+ len = 0;
+ s = arg;
+ cmd = "";
+ for (; s != NULL; s = va_arg (ap, const char*))
+ {
+ char* cmd1;
+ len += strlen (s);
+ cmd1 = alloca (len+1);
+ strcpy (cmd1, cmd);
+ strcat (cmd1, s);
+ cmd = cmd1;
+ }
+ va_end (ap);
+ execute_command (cmd, 0);
+}
+
+
+ /* Language Selection */
+
+/* If the main program is in Ada, return language_ada, otherwise return LANG
+ (the main program is in Ada iif the adainit symbol is found).
+
+ MAIN_PST is not used. */
+
+enum language
+ada_update_initial_language (lang, main_pst)
+ enum language lang;
+ struct partial_symtab* main_pst;
+{
+ if (lookup_minimal_symbol ("adainit", (const char*) NULL,
+ (struct objfile*) NULL) != NULL)
+ /* return language_ada; */
+ /* FIXME: language_ada should be defined in defs.h */
+ return language_unknown;
+
+ return lang;
+}
+
+
+ /* Symbols */
+
+/* Table of Ada operators and their GNAT-mangled names. Last entry is pair
+ of NULLs. */
+
+const struct ada_opname_map ada_opname_table[] =
+{
+ { "Oadd", "\"+\"", BINOP_ADD },
+ { "Osubtract", "\"-\"", BINOP_SUB },
+ { "Omultiply", "\"*\"", BINOP_MUL },
+ { "Odivide", "\"/\"", BINOP_DIV },
+ { "Omod", "\"mod\"", BINOP_MOD },
+ { "Orem", "\"rem\"", BINOP_REM },
+ { "Oexpon", "\"**\"", BINOP_EXP },
+ { "Olt", "\"<\"", BINOP_LESS },
+ { "Ole", "\"<=\"", BINOP_LEQ },
+ { "Ogt", "\">\"", BINOP_GTR },
+ { "Oge", "\">=\"", BINOP_GEQ },
+ { "Oeq", "\"=\"", BINOP_EQUAL },
+ { "One", "\"/=\"", BINOP_NOTEQUAL },
+ { "Oand", "\"and\"", BINOP_BITWISE_AND },
+ { "Oor", "\"or\"", BINOP_BITWISE_IOR },
+ { "Oxor", "\"xor\"", BINOP_BITWISE_XOR },
+ { "Oconcat", "\"&\"", BINOP_CONCAT },
+ { "Oabs", "\"abs\"", UNOP_ABS },
+ { "Onot", "\"not\"", UNOP_LOGICAL_NOT },
+ { "Oadd", "\"+\"", UNOP_PLUS },
+ { "Osubtract", "\"-\"", UNOP_NEG },
+ { NULL, NULL }
+};
+
+/* True if STR should be suppressed in info listings. */
+static int
+is_suppressed_name (str)
+ const char* str;
+{
+ if (STREQN (str, "_ada_", 5))
+ str += 5;
+ if (str[0] == '_' || str[0] == '\000')
+ return 1;
+ else
+ {
+ const char* p;
+ const char* suffix = strstr (str, "___");
+ if (suffix != NULL && suffix[3] != 'X')
+ return 1;
+ if (suffix == NULL)
+ suffix = str + strlen (str);
+ for (p = suffix-1; p != str; p -= 1)
+ if (isupper (*p))
+ {
+ int i;
+ if (p[0] == 'X' && p[-1] != '_')
+ goto OK;
+ if (*p != 'O')
+ return 1;
+ for (i = 0; ada_opname_table[i].mangled != NULL; i += 1)
+ if (STREQN (ada_opname_table[i].mangled, p,
+ strlen (ada_opname_table[i].mangled)))
+ goto OK;
+ return 1;
+ OK: ;
+ }
+ return 0;
+ }
+}
+
+/* The "mangled" form of DEMANGLED, according to GNAT conventions.
+ * The result is valid until the next call to ada_mangle. */
+char *
+ada_mangle (demangled)
+ const char* demangled;
+{
+ static char* mangling_buffer = NULL;
+ static size_t mangling_buffer_size = 0;
+ const char* p;
+ int k;
+
+ if (demangled == NULL)
+ return NULL;
+
+ GROW_VECT (mangling_buffer, mangling_buffer_size, 2*strlen (demangled) + 10);
+
+ k = 0;
+ for (p = demangled; *p != '\0'; p += 1)
+ {
+ if (*p == '.')
+ {
+ mangling_buffer[k] = mangling_buffer[k+1] = '_';
+ k += 2;
+ }
+ else if (*p == '"')
+ {
+ const struct ada_opname_map* mapping;
+
+ for (mapping = ada_opname_table;
+ mapping->mangled != NULL &&
+ ! STREQN (mapping->demangled, p, strlen (mapping->demangled));
+ p += 1)
+ ;
+ if (mapping->mangled == NULL)
+ error ("invalid Ada operator name: %s", p);
+ strcpy (mangling_buffer+k, mapping->mangled);
+ k += strlen (mapping->mangled);
+ break;
+ }
+ else
+ {
+ mangling_buffer[k] = *p;
+ k += 1;
+ }
+ }
+
+ mangling_buffer[k] = '\0';
+ return mangling_buffer;
+}
+
+/* Return NAME folded to lower case, or, if surrounded by single
+ * quotes, unfolded, but with the quotes stripped away. Result good
+ * to next call. */
+char*
+ada_fold_name (const char* name)
+{
+ static char* fold_buffer = NULL;
+ static size_t fold_buffer_size = 0;
+
+ int len = strlen (name);
+ GROW_VECT (fold_buffer, fold_buffer_size, len+1);
+
+ if (name[0] == '\'')
+ {
+ strncpy (fold_buffer, name+1, len-2);
+ fold_buffer[len-2] = '\000';
+ }
+ else
+ {
+ int i;
+ for (i = 0; i <= len; i += 1)
+ fold_buffer[i] = tolower (name[i]);
+ }
+
+ return fold_buffer;
+}
+
+/* Demangle:
+ 1. Discard final __{DIGIT}+ or ${DIGIT}+
+ 2. Convert other instances of embedded "__" to `.'.
+ 3. Discard leading _ada_.
+ 4. Convert operator names to the appropriate quoted symbols.
+ 5. Remove everything after first ___ if it is followed by
+ 'X'.
+ 6. Replace TK__ with __, and a trailing B or TKB with nothing.
+ 7. Put symbols that should be suppressed in <...> brackets.
+ 8. Remove trailing X[bn]* suffix (indicating names in package bodies).
+ The resulting string is valid until the next call of ada_demangle.
+ */
+
+char *
+ada_demangle (mangled)
+ const char* mangled;
+{
+ int i, j;
+ int len0;
+ const char* p;
+ char* demangled;
+ int at_start_name;
+ static char* demangling_buffer = NULL;
+ static size_t demangling_buffer_size = 0;
+
+ if (STREQN (mangled, "_ada_", 5))
+ mangled += 5;
+
+ if (mangled[0] == '_' || mangled[0] == '<')
+ goto Suppress;
+
+ p = strstr (mangled, "___");
+ if (p == NULL)
+ len0 = strlen (mangled);
+ else
+ {
+ if (p[3] == 'X')
+ len0 = p - mangled;
+ else
+ goto Suppress;
+ }
+ if (len0 > 3 && STREQ (mangled + len0 - 3, "TKB"))
+ len0 -= 3;
+ if (len0 > 1 && STREQ (mangled + len0 - 1, "B"))
+ len0 -= 1;
+
+ /* Make demangled big enough for possible expansion by operator name. */
+ GROW_VECT (demangling_buffer, demangling_buffer_size, 2*len0+1);
+ demangled = demangling_buffer;
+
+ if (isdigit (mangled[len0 - 1])) {
+ for (i = len0-2; i >= 0 && isdigit (mangled[i]); i -= 1)
+ ;
+ if (i > 1 && mangled[i] == '_' && mangled[i-1] == '_')
+ len0 = i - 1;
+ else if (mangled[i] == '$')
+ len0 = i;
+ }
+
+ for (i = 0, j = 0; i < len0 && ! isalpha (mangled[i]); i += 1, j += 1)
+ demangled[j] = mangled[i];
+
+ at_start_name = 1;
+ while (i < len0)
+ {
+ if (at_start_name && mangled[i] == 'O')
+ {
+ int k;
+ for (k = 0; ada_opname_table[k].mangled != NULL; k += 1)
+ {
+ int op_len = strlen (ada_opname_table[k].mangled);
+ if (STREQN (ada_opname_table[k].mangled+1, mangled+i+1, op_len-1)
+ && ! isalnum (mangled[i + op_len]))
+ {
+ strcpy (demangled + j, ada_opname_table[k].demangled);
+ at_start_name = 0;
+ i += op_len;
+ j += strlen (ada_opname_table[k].demangled);
+ break;
+ }
+ }
+ if (ada_opname_table[k].mangled != NULL)
+ continue;
+ }
+ at_start_name = 0;
+
+ if (i < len0-4 && STREQN (mangled+i, "TK__", 4))
+ i += 2;
+ if (mangled[i] == 'X' && i != 0 && isalnum (mangled[i-1]))
+ {
+ do
+ i += 1;
+ while (i < len0 && (mangled[i] == 'b' || mangled[i] == 'n'));
+ if (i < len0)
+ goto Suppress;
+ }
+ else if (i < len0-2 && mangled[i] == '_' && mangled[i+1] == '_')
+ {
+ demangled[j] = '.';
+ at_start_name = 1;
+ i += 2; j += 1;
+ }
+ else
+ {
+ demangled[j] = mangled[i];
+ i += 1; j += 1;
+ }
+ }
+ demangled[j] = '\000';
+
+ for (i = 0; demangled[i] != '\0'; i += 1)
+ if (isupper (demangled[i]) || demangled[i] == ' ')
+ goto Suppress;
+
+ return demangled;
+
+Suppress:
+ GROW_VECT (demangling_buffer, demangling_buffer_size,
+ strlen (mangled) + 3);
+ demangled = demangling_buffer;
+ if (mangled[0] == '<')
+ strcpy (demangled, mangled);
+ else
+ sprintf (demangled, "<%s>", mangled);
+ return demangled;
+
+}
+
+/* Returns non-zero iff SYM_NAME matches NAME, ignoring any trailing
+ * suffixes that encode debugging information or leading _ada_ on
+ * SYM_NAME (see is_name_suffix commentary for the debugging
+ * information that is ignored). If WILD, then NAME need only match a
+ * suffix of SYM_NAME minus the same suffixes. Also returns 0 if
+ * either argument is NULL. */
+
+int
+ada_match_name (sym_name, name, wild)
+ const char* sym_name;
+ const char* name;
+ int wild;
+{
+ if (sym_name == NULL || name == NULL)
+ return 0;
+ else if (wild)
+ return wild_match (name, strlen (name), sym_name);
+ else {
+ int len_name = strlen (name);
+ return (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)
+ && is_name_suffix (sym_name+len_name+5));
+ }
+}
+
+/* True (non-zero) iff in Ada mode, the symbol SYM should be
+ suppressed in info listings. */
+
+int
+ada_suppress_symbol_printing (sym)
+ struct symbol *sym;
+{
+ if (SYMBOL_NAMESPACE (sym) == STRUCT_NAMESPACE)
+ return 1;
+ else
+ return is_suppressed_name (SYMBOL_NAME (sym));
+}
+
+
+ /* Arrays */
+
+/* Names of MAX_ADA_DIMENS bounds in P_BOUNDS fields of
+ array descriptors. */
+
+static char* bound_name[] = {
+ "LB0", "UB0", "LB1", "UB1", "LB2", "UB2", "LB3", "UB3",
+ "LB4", "UB4", "LB5", "UB5", "LB6", "UB6", "LB7", "UB7"
+};
+
+/* Maximum number of array dimensions we are prepared to handle. */
+
+#define MAX_ADA_DIMENS (sizeof(bound_name) / (2*sizeof(char*)))
+
+/* Like modify_field, but allows bitpos > wordlength. */
+
+static void
+modify_general_field (addr, fieldval, bitpos, bitsize)
+ char *addr;
+ LONGEST fieldval;
+ int bitpos, bitsize;
+{
+ modify_field (addr + sizeof (LONGEST) * bitpos / (8 * sizeof (LONGEST)),
+ fieldval, bitpos % (8 * sizeof (LONGEST)),
+ bitsize);
+}
+
+
+/* The desc_* routines return primitive portions of array descriptors
+ (fat pointers). */
+
+/* The descriptor or array type, if any, indicated by TYPE; removes
+ level of indirection, if needed. */
+static struct type*
+desc_base_type (type)
+ struct type* type;
+{
+ if (type == NULL)
+ return NULL;
+ CHECK_TYPEDEF (type);
+ if (type != NULL && TYPE_CODE (type) == TYPE_CODE_PTR)
+ return check_typedef (TYPE_TARGET_TYPE (type));
+ else
+ return type;
+}
+
+/* True iff TYPE indicates a "thin" array pointer type. */
+static int
+is_thin_pntr (struct type* type)
+{
+ return
+ is_suffix (ada_type_name (desc_base_type (type)), "___XUT")
+ || is_suffix (ada_type_name (desc_base_type (type)), "___XUT___XVE");
+}
+
+/* The descriptor type for thin pointer type TYPE. */
+static struct type*
+thin_descriptor_type (struct type* type)
+{
+ struct type* base_type = desc_base_type (type);
+ if (base_type == NULL)
+ return NULL;
+ if (is_suffix (ada_type_name (base_type), "___XVE"))
+ return base_type;
+ else
+ {
+ struct type* alt_type =
+ ada_find_parallel_type (base_type, "___XVE");
+ if (alt_type == NULL)
+ return base_type;
+ else
+ return alt_type;
+ }
+}
+
+/* A pointer to the array data for thin-pointer value VAL. */
+static struct value*
+thin_data_pntr (struct value* val)
+{
+ struct type* type = VALUE_TYPE (val);
+ if (TYPE_CODE (type) == TYPE_CODE_PTR)
+ return value_cast (desc_data_type (thin_descriptor_type (type)),
+ value_copy (val));
+ else
+ return value_from_longest (desc_data_type (thin_descriptor_type (type)),
+ VALUE_ADDRESS (val) + VALUE_OFFSET (val));
+}
+
+/* True iff TYPE indicates a "thick" array pointer type. */
+static int
+is_thick_pntr (struct type* type)
+{
+ type = desc_base_type (type);
+ return (type != NULL && TYPE_CODE (type) == TYPE_CODE_STRUCT
+ && lookup_struct_elt_type (type, "P_BOUNDS", 1) != NULL);
+}
+
+/* If TYPE is the type of an array descriptor (fat or thin pointer) or a
+ pointer to one, the type of its bounds data; otherwise, NULL. */
+static struct type*
+desc_bounds_type (type)
+ struct type* type;
+{
+ struct type* r;
+
+ type = desc_base_type (type);
+
+ if (type == NULL)
+ return NULL;
+ else if (is_thin_pntr (type))
+ {
+ type = thin_descriptor_type (type);
+ if (type == NULL)
+ return NULL;
+ r = lookup_struct_elt_type (type, "BOUNDS", 1);
+ if (r != NULL)
+ return check_typedef (r);
+ }
+ else if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
+ {
+ r = lookup_struct_elt_type (type, "P_BOUNDS", 1);
+ if (r != NULL)
+ return check_typedef (TYPE_TARGET_TYPE (check_typedef (r)));
+ }
+ return NULL;
+}
+
+/* If ARR is an array descriptor (fat or thin pointer), or pointer to
+ one, a pointer to its bounds data. Otherwise NULL. */
+static struct value*
+desc_bounds (arr)
+ struct value* arr;
+{
+ struct type* type = check_typedef (VALUE_TYPE (arr));
+ if (is_thin_pntr (type))
+ {
+ struct type* bounds_type = desc_bounds_type (thin_descriptor_type (type));
+ LONGEST addr;
+
+ if (desc_bounds_type == NULL)
+ error ("Bad GNAT array descriptor");
+
+ /* NOTE: The following calculation is not really kosher, but
+ since desc_type is an XVE-encoded type (and shouldn't be),
+ the correct calculation is a real pain. FIXME (and fix GCC). */
+ if (TYPE_CODE (type) == TYPE_CODE_PTR)
+ addr = value_as_long (arr);
+ else
+ addr = VALUE_ADDRESS (arr) + VALUE_OFFSET (arr);
+
+ return
+ value_from_longest (lookup_pointer_type (bounds_type),
+ addr - TYPE_LENGTH (bounds_type));
+ }
+
+ else if (is_thick_pntr (type))
+ return value_struct_elt (&arr, NULL, "P_BOUNDS", NULL,
+ "Bad GNAT array descriptor");
+ else
+ return NULL;
+}
+
+/* If TYPE is the type of an array-descriptor (fat pointer), the bit
+ position of the field containing the address of the bounds data. */
+static int
+fat_pntr_bounds_bitpos (type)
+ struct type* type;
+{
+ return TYPE_FIELD_BITPOS (desc_base_type (type), 1);
+}
+
+/* If TYPE is the type of an array-descriptor (fat pointer), the bit
+ size of the field containing the address of the bounds data. */
+static int
+fat_pntr_bounds_bitsize (type)
+ struct type* type;
+{
+ type = desc_base_type (type);
+
+ if (TYPE_FIELD_BITSIZE (type, 1) > 0)
+ return TYPE_FIELD_BITSIZE (type, 1);
+ else
+ return 8 * TYPE_LENGTH (check_typedef (TYPE_FIELD_TYPE (type, 1)));
+}
+
+/* If TYPE is the type of an array descriptor (fat or thin pointer) or a
+ pointer to one, the type of its array data (a
+ pointer-to-array-with-no-bounds type); otherwise, NULL. Use
+ ada_type_of_array to get an array type with bounds data. */
+static struct type*
+desc_data_type (type)
+ struct type* type;
+{
+ type = desc_base_type (type);
+
+ /* NOTE: The following is bogus; see comment in desc_bounds. */
+ if (is_thin_pntr (type))
+ return lookup_pointer_type
+ (desc_base_type (TYPE_FIELD_TYPE (thin_descriptor_type (type),1)));
+ else if (is_thick_pntr (type))
+ return lookup_struct_elt_type (type, "P_ARRAY", 1);
+ else
+ return NULL;
+}
+
+/* If ARR is an array descriptor (fat or thin pointer), a pointer to
+ its array data. */
+static struct value*
+desc_data (arr)
+ struct value* arr;
+{
+ struct type* type = VALUE_TYPE (arr);
+ if (is_thin_pntr (type))
+ return thin_data_pntr (arr);
+ else if (is_thick_pntr (type))
+ return value_struct_elt (&arr, NULL, "P_ARRAY", NULL,
+ "Bad GNAT array descriptor");
+ else
+ return NULL;
+}
+
+
+/* If TYPE is the type of an array-descriptor (fat pointer), the bit
+ position of the field containing the address of the data. */
+static int
+fat_pntr_data_bitpos (type)
+ struct type* type;
+{
+ return TYPE_FIELD_BITPOS (desc_base_type (type), 0);
+}
+
+/* If TYPE is the type of an array-descriptor (fat pointer), the bit
+ size of the field containing the address of the data. */
+static int
+fat_pntr_data_bitsize (type)
+ struct type* type;
+{
+ type = desc_base_type (type);
+
+ if (TYPE_FIELD_BITSIZE (type, 0) > 0)
+ return TYPE_FIELD_BITSIZE (type, 0);
+ else
+ return TARGET_CHAR_BIT * TYPE_LENGTH (TYPE_FIELD_TYPE (type, 0));
+}
+
+/* If BOUNDS is an array-bounds structure (or pointer to one), return
+ the Ith lower bound stored in it, if WHICH is 0, and the Ith upper
+ bound, if WHICH is 1. The first bound is I=1. */
+static struct value*
+desc_one_bound (bounds, i, which)
+ struct value* bounds;
+ int i;
+ int which;
+{
+ return value_struct_elt (&bounds, NULL, bound_name[2*i+which-2], NULL,
+ "Bad GNAT array descriptor bounds");
+}
+
+/* If BOUNDS is an array-bounds structure type, return the bit position
+ of the Ith lower bound stored in it, if WHICH is 0, and the Ith upper
+ bound, if WHICH is 1. The first bound is I=1. */
+static int
+desc_bound_bitpos (type, i, which)
+ struct type* type;
+ int i;
+ int which;
+{
+ return TYPE_FIELD_BITPOS (desc_base_type (type), 2*i+which-2);
+}
+
+/* If BOUNDS is an array-bounds structure type, return the bit field size
+ of the Ith lower bound stored in it, if WHICH is 0, and the Ith upper
+ bound, if WHICH is 1. The first bound is I=1. */
+static int
+desc_bound_bitsize (type, i, which)
+ struct type* type;
+ int i;
+ int which;
+{
+ type = desc_base_type (type);
+
+ if (TYPE_FIELD_BITSIZE (type, 2*i+which-2) > 0)
+ return TYPE_FIELD_BITSIZE (type, 2*i+which-2);
+ else
+ return 8 * TYPE_LENGTH (TYPE_FIELD_TYPE (type, 2*i+which-2));
+}
+
+/* If TYPE is the type of an array-bounds structure, the type of its
+ Ith bound (numbering from 1). Otherwise, NULL. */
+static struct type*
+desc_index_type (type, i)
+ struct type* type;
+ int i;
+{
+ type = desc_base_type (type);
+
+ if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
+ return lookup_struct_elt_type (type, bound_name[2*i-2], 1);
+ else
+ return NULL;
+}
+
+/* The number of index positions in the array-bounds type TYPE. 0
+ if TYPE is NULL. */
+static int
+desc_arity (type)
+ struct type* type;
+{
+ type = desc_base_type (type);
+
+ if (type != NULL)
+ return TYPE_NFIELDS (type) / 2;
+ return 0;
+}
+
+
+/* Non-zero iff type is a simple array type (or pointer to one). */
+int
+ada_is_simple_array (type)
+ struct type* type;
+{
+ if (type == NULL)
+ return 0;
+ CHECK_TYPEDEF (type);
+ return (TYPE_CODE (type) == TYPE_CODE_ARRAY
+ || (TYPE_CODE (type) == TYPE_CODE_PTR
+ && TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_ARRAY));
+}
+
+/* Non-zero iff type belongs to a GNAT array descriptor. */
+int
+ada_is_array_descriptor (type)
+ struct type* type;
+{
+ struct type* data_type = desc_data_type (type);
+
+ if (type == NULL)
+ return 0;
+ CHECK_TYPEDEF (type);
+ return
+ data_type != NULL
+ && ((TYPE_CODE (data_type) == TYPE_CODE_PTR
+ && TYPE_TARGET_TYPE (data_type) != NULL
+ && TYPE_CODE (TYPE_TARGET_TYPE (data_type)) == TYPE_CODE_ARRAY)
+ ||
+ TYPE_CODE (data_type) == TYPE_CODE_ARRAY)
+ && desc_arity (desc_bounds_type (type)) > 0;
+}
+
+/* Non-zero iff type is a partially mal-formed GNAT array
+ descriptor. (FIXME: This is to compensate for some problems with
+ debugging output from GNAT. Re-examine periodically to see if it
+ is still needed. */
+int
+ada_is_bogus_array_descriptor (type)
+ struct type *type;
+{
+ return
+ type != NULL
+ && TYPE_CODE (type) == TYPE_CODE_STRUCT
+ && (lookup_struct_elt_type (type, "P_BOUNDS", 1) != NULL
+ || lookup_struct_elt_type (type, "P_ARRAY", 1) != NULL)
+ && ! ada_is_array_descriptor (type);
+}
+
+
+/* If ARR has a record type in the form of a standard GNAT array descriptor,
+ (fat pointer) returns the type of the array data described---specifically,
+ a pointer-to-array type. If BOUNDS is non-zero, the bounds data are filled
+ in from the descriptor; otherwise, they are left unspecified. If
+ the ARR denotes a null array descriptor and BOUNDS is non-zero,
+ returns NULL. The result is simply the type of ARR if ARR is not
+ a descriptor. */
+struct type*
+ada_type_of_array (arr, bounds)
+ struct value* arr;
+ int bounds;
+{
+ if (ada_is_packed_array_type (VALUE_TYPE (arr)))
+ return decode_packed_array_type (VALUE_TYPE (arr));
+
+ if (! ada_is_array_descriptor (VALUE_TYPE (arr)))
+ return VALUE_TYPE (arr);
+
+ if (! bounds)
+ return check_typedef (TYPE_TARGET_TYPE (desc_data_type (VALUE_TYPE (arr))));
+ else
+ {
+ struct type* elt_type;
+ int arity;
+ struct value* descriptor;
+ struct objfile *objf = TYPE_OBJFILE (VALUE_TYPE (arr));
+
+ elt_type = ada_array_element_type (VALUE_TYPE (arr), -1);
+ arity = ada_array_arity (VALUE_TYPE (arr));
+
+ if (elt_type == NULL || arity == 0)
+ return check_typedef (VALUE_TYPE (arr));
+
+ descriptor = desc_bounds (arr);
+ if (value_as_long (descriptor) == 0)
+ return NULL;
+ while (arity > 0) {
+ struct type* range_type = alloc_type (objf);
+ struct type* array_type = alloc_type (objf);
+ struct value* low = desc_one_bound (descriptor, arity, 0);
+ struct value* high = desc_one_bound (descriptor, arity, 1);
+ arity -= 1;
+
+ create_range_type (range_type, VALUE_TYPE (low),
+ (int) value_as_long (low),
+ (int) value_as_long (high));
+ elt_type = create_array_type (array_type, elt_type, range_type);
+ }
+
+ return lookup_pointer_type (elt_type);
+ }
+}
+
+/* If ARR does not represent an array, returns ARR unchanged.
+ Otherwise, returns either a standard GDB array with bounds set
+ appropriately or, if ARR is a non-null fat pointer, a pointer to a standard
+ GDB array. Returns NULL if ARR is a null fat pointer. */
+struct value*
+ada_coerce_to_simple_array_ptr (arr)
+ struct value* arr;
+{
+ if (ada_is_array_descriptor (VALUE_TYPE (arr)))
+ {
+ struct type* arrType = ada_type_of_array (arr, 1);
+ if (arrType == NULL)
+ return NULL;
+ return value_cast (arrType, value_copy (desc_data (arr)));
+ }
+ else if (ada_is_packed_array_type (VALUE_TYPE (arr)))
+ return decode_packed_array (arr);
+ else
+ return arr;
+}
+
+/* If ARR does not represent an array, returns ARR unchanged.
+ Otherwise, returns a standard GDB array describing ARR (which may
+ be ARR itself if it already is in the proper form). */
+struct value*
+ada_coerce_to_simple_array (arr)
+ struct value* arr;
+{
+ if (ada_is_array_descriptor (VALUE_TYPE (arr)))
+ {
+ struct value* arrVal = ada_coerce_to_simple_array_ptr (arr);
+ if (arrVal == NULL)
+ error ("Bounds unavailable for null array pointer.");
+ return value_ind (arrVal);
+ }
+ else if (ada_is_packed_array_type (VALUE_TYPE (arr)))
+ return decode_packed_array (arr);
+ else
+ return arr;
+}
+
+/* If TYPE represents a GNAT array type, return it translated to an
+ ordinary GDB array type (possibly with BITSIZE fields indicating
+ packing). For other types, is the identity. */
+struct type*
+ada_coerce_to_simple_array_type (type)
+ struct type* type;
+{
+ struct value* mark = value_mark ();
+ struct value* dummy = value_from_longest (builtin_type_long, 0);
+ struct type* result;
+ VALUE_TYPE (dummy) = type;
+ result = ada_type_of_array (dummy, 0);
+ value_free_to_mark (dummy);
+ return result;
+}
+
+/* Non-zero iff TYPE represents a standard GNAT packed-array type. */
+int
+ada_is_packed_array_type (type)
+ struct type* type;
+{
+ if (type == NULL)
+ return 0;
+ CHECK_TYPEDEF (type);
+ return
+ ada_type_name (type) != NULL
+ && strstr (ada_type_name (type), "___XP") != NULL;
+}
+
+/* Given that TYPE is a standard GDB array type with all bounds filled
+ in, and that the element size of its ultimate scalar constituents
+ (that is, either its elements, or, if it is an array of arrays, its
+ elements' elements, etc.) is *ELT_BITS, return an identical type,
+ but with the bit sizes of its elements (and those of any
+ constituent arrays) recorded in the BITSIZE components of its
+ TYPE_FIELD_BITSIZE values, and with *ELT_BITS set to its total size
+ in bits. */
+static struct type*
+packed_array_type (type, elt_bits)
+ struct type* type;
+ long* elt_bits;
+{
+ struct type* new_elt_type;
+ struct type* new_type;
+ LONGEST low_bound, high_bound;
+
+ CHECK_TYPEDEF (type);
+ if (TYPE_CODE (type) != TYPE_CODE_ARRAY)
+ return type;
+
+ new_type = alloc_type (TYPE_OBJFILE (type));
+ new_elt_type = packed_array_type (check_typedef (TYPE_TARGET_TYPE (type)),
+ elt_bits);
+ create_array_type (new_type, new_elt_type, TYPE_FIELD_TYPE (type, 0));
+ TYPE_FIELD_BITSIZE (new_type, 0) = *elt_bits;
+ TYPE_NAME (new_type) = ada_type_name (type);
+
+ if (get_discrete_bounds (TYPE_FIELD_TYPE (type, 0),
+ &low_bound, &high_bound) < 0)
+ low_bound = high_bound = 0;
+ if (high_bound < low_bound)
+ *elt_bits = TYPE_LENGTH (new_type) = 0;
+ else
+ {
+ *elt_bits *= (high_bound - low_bound + 1);
+ TYPE_LENGTH (new_type) =
+ (*elt_bits + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT;
+ }
+
+ /* TYPE_FLAGS (new_type) |= TYPE_FLAG_FIXED_INSTANCE; */
+ /* FIXME: TYPE_FLAG_FIXED_INSTANCE should be defined in gdbtypes.h */
+ return new_type;
+}
+
+/* The array type encoded by TYPE, where ada_is_packed_array_type (TYPE).
+ */
+static struct type*
+decode_packed_array_type (type)
+ struct type* type;
+{
+ struct symbol** syms;
+ struct block** blocks;
+ const char* raw_name = ada_type_name (check_typedef (type));
+ char* name = (char*) alloca (strlen (raw_name) + 1);
+ char* tail = strstr (raw_name, "___XP");
+ struct type* shadow_type;
+ long bits;
+ int i, n;
+
+ memcpy (name, raw_name, tail - raw_name);
+ name[tail - raw_name] = '\000';
+
+ /* NOTE: Use ada_lookup_symbol_list because of bug in some versions
+ * of gcc (Solaris, e.g.). FIXME when compiler is fixed. */
+ n = ada_lookup_symbol_list (name, get_selected_block (NULL),
+ VAR_NAMESPACE, &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]))))
+ break;
+ if (i >= n)
+ {
+ warning ("could not find bounds information on packed array");
+ return NULL;
+ }
+ shadow_type = SYMBOL_TYPE (syms[i]);
+
+ if (TYPE_CODE (shadow_type) != TYPE_CODE_ARRAY)
+ {
+ warning ("could not understand bounds information on packed array");
+ return NULL;
+ }
+
+ if (sscanf (tail + sizeof ("___XP") - 1, "%ld", &bits) != 1)
+ {
+ warning ("could not understand bit size information on packed array");
+ return NULL;
+ }
+
+ return packed_array_type (shadow_type, &bits);
+}
+
+/* Given that ARR is a struct value* indicating a GNAT packed array,
+ returns a simple array that denotes that array. Its type is a
+ standard GDB array type except that the BITSIZEs of the array
+ target types are set to the number of bits in each element, and the
+ type length is set appropriately. */
+
+static struct value*
+decode_packed_array (arr)
+ struct value* arr;
+{
+ struct type* type = decode_packed_array_type (VALUE_TYPE (arr));
+
+ if (type == NULL)
+ {
+ error ("can't unpack array");
+ return NULL;
+ }
+ else
+ return coerce_unspec_val_to_type (arr, 0, type);
+}
+
+
+/* The value of the element of packed array ARR at the ARITY indices
+ given in IND. ARR must be a simple array. */
+
+static struct value*
+value_subscript_packed (arr, arity, ind)
+ struct value* arr;
+ int arity;
+ struct value** ind;
+{
+ int i;
+ int bits, elt_off, bit_off;
+ long elt_total_bit_offset;
+ struct type* elt_type;
+ struct value* v;
+
+ bits = 0;
+ elt_total_bit_offset = 0;
+ elt_type = check_typedef (VALUE_TYPE (arr));
+ for (i = 0; i < arity; i += 1)
+ {
+ if (TYPE_CODE (elt_type) != TYPE_CODE_ARRAY
+ || TYPE_FIELD_BITSIZE (elt_type, 0) == 0)
+ error ("attempt to do packed indexing of something other than a packed array");
+ else
+ {
+ struct type *range_type = TYPE_INDEX_TYPE (elt_type);
+ LONGEST lowerbound, upperbound;
+ LONGEST idx;
+
+ if (get_discrete_bounds (range_type, &lowerbound,
+ &upperbound) < 0)
+ {
+ warning ("don't know bounds of array");
+ lowerbound = upperbound = 0;
+ }
+
+ idx = value_as_long (value_pos_atr (ind[i]));
+ if (idx < lowerbound || idx > upperbound)
+ warning ("packed array index %ld out of bounds", (long) idx);
+ bits = TYPE_FIELD_BITSIZE (elt_type, 0);
+ elt_total_bit_offset += (idx - lowerbound) * bits;
+ elt_type = check_typedef (TYPE_TARGET_TYPE (elt_type));
+ }
+ }
+ elt_off = elt_total_bit_offset / HOST_CHAR_BIT;
+ bit_off = elt_total_bit_offset % HOST_CHAR_BIT;
+
+ v = ada_value_primitive_packed_val (arr, NULL, elt_off, bit_off,
+ bits, elt_type);
+ if (VALUE_LVAL (arr) == lval_internalvar)
+ VALUE_LVAL (v) = lval_internalvar_component;
+ else
+ VALUE_LVAL (v) = VALUE_LVAL (arr);
+ return v;
+}
+
+/* Non-zero iff TYPE includes negative integer values. */
+
+static int
+has_negatives (type)
+ struct type* type;
+{
+ switch (TYPE_CODE (type)) {
+ default:
+ return 0;
+ case TYPE_CODE_INT:
+ return ! TYPE_UNSIGNED (type);
+ case TYPE_CODE_RANGE:
+ return TYPE_LOW_BOUND (type) < 0;
+ }
+}
+
+
+/* Create a new value of type TYPE from the contents of OBJ starting
+ at byte OFFSET, and bit offset BIT_OFFSET within that byte,
+ proceeding for BIT_SIZE bits. If OBJ is an lval in memory, then
+ assigning through the result will set the field fetched from. OBJ
+ may also be NULL, in which case, VALADDR+OFFSET must address the
+ start of storage containing the packed value. The value returned
+ in this case is never an lval.
+ Assumes 0 <= BIT_OFFSET < HOST_CHAR_BIT. */
+
+struct value*
+ada_value_primitive_packed_val (obj, valaddr, offset, bit_offset,
+ bit_size, type)
+ struct value* obj;
+ char* valaddr;
+ long offset;
+ int bit_offset;
+ int bit_size;
+ struct type* type;
+{
+ struct value* v;
+ int src, /* Index into the source area. */
+ targ, /* Index into the target area. */
+ i,
+ srcBitsLeft, /* Number of source bits left to move. */
+ nsrc, ntarg, /* Number of source and target bytes. */
+ unusedLS, /* Number of bits in next significant
+ * byte of source that are unused. */
+ accumSize; /* Number of meaningful bits in accum */
+ unsigned char* bytes; /* First byte containing data to unpack. */
+ unsigned char* unpacked;
+ unsigned long accum; /* Staging area for bits being transferred */
+ unsigned char sign;
+ int len = (bit_size + bit_offset + HOST_CHAR_BIT - 1) / 8;
+ /* Transmit bytes from least to most significant; delta is the
+ * direction the indices move. */
+ int delta = BITS_BIG_ENDIAN ? -1 : 1;
+
+ CHECK_TYPEDEF (type);
+
+ if (obj == NULL)
+ {
+ v = allocate_value (type);
+ bytes = (unsigned char*) (valaddr + offset);
+ }
+ else if (VALUE_LAZY (obj))
+ {
+ v = value_at (type,
+ VALUE_ADDRESS (obj) + VALUE_OFFSET (obj) + offset, NULL);
+ bytes = (unsigned char*) alloca (len);
+ read_memory (VALUE_ADDRESS (v), bytes, len);
+ }
+ else
+ {
+ v = allocate_value (type);
+ bytes = (unsigned char*) VALUE_CONTENTS (obj) + offset;
+ }
+
+ if (obj != NULL)
+ {
+ VALUE_LVAL (v) = VALUE_LVAL (obj);
+ if (VALUE_LVAL (obj) == lval_internalvar)
+ VALUE_LVAL (v) = lval_internalvar_component;
+ VALUE_ADDRESS (v) = VALUE_ADDRESS (obj) + VALUE_OFFSET (obj) + offset;
+ VALUE_BITPOS (v) = bit_offset + VALUE_BITPOS (obj);
+ VALUE_BITSIZE (v) = bit_size;
+ if (VALUE_BITPOS (v) >= HOST_CHAR_BIT)
+ {
+ VALUE_ADDRESS (v) += 1;
+ VALUE_BITPOS (v) -= HOST_CHAR_BIT;
+ }
+ }
+ else
+ VALUE_BITSIZE (v) = bit_size;
+ unpacked = (unsigned char*) VALUE_CONTENTS (v);
+
+ srcBitsLeft = bit_size;
+ nsrc = len;
+ ntarg = TYPE_LENGTH (type);
+ sign = 0;
+ if (bit_size == 0)
+ {
+ memset (unpacked, 0, TYPE_LENGTH (type));
+ return v;
+ }
+ else if (BITS_BIG_ENDIAN)
+ {
+ src = len-1;
+ if (has_negatives (type) &&
+ ((bytes[0] << bit_offset) & (1 << (HOST_CHAR_BIT-1))))
+ sign = ~0;
+
+ unusedLS =
+ (HOST_CHAR_BIT - (bit_size + bit_offset) % HOST_CHAR_BIT)
+ % HOST_CHAR_BIT;
+
+ switch (TYPE_CODE (type))
+ {
+ case TYPE_CODE_ARRAY:
+ case TYPE_CODE_UNION:
+ case TYPE_CODE_STRUCT:
+ /* Non-scalar values must be aligned at a byte boundary. */
+ accumSize =
+ (HOST_CHAR_BIT - bit_size % HOST_CHAR_BIT) % HOST_CHAR_BIT;
+ /* And are placed at the beginning (most-significant) bytes
+ * of the target. */
+ targ = src;
+ break;
+ default:
+ accumSize = 0;
+ targ = TYPE_LENGTH (type) - 1;
+ break;
+ }
+ }
+ else
+ {
+ int sign_bit_offset = (bit_size + bit_offset - 1) % 8;
+
+ src = targ = 0;
+ unusedLS = bit_offset;
+ accumSize = 0;
+
+ if (has_negatives (type) && (bytes[len-1] & (1 << sign_bit_offset)))
+ sign = ~0;
+ }
+
+ accum = 0;
+ while (nsrc > 0)
+ {
+ /* Mask for removing bits of the next source byte that are not
+ * part of the value. */
+ unsigned int unusedMSMask =
+ (1 << (srcBitsLeft >= HOST_CHAR_BIT ? HOST_CHAR_BIT : srcBitsLeft))-1;
+ /* Sign-extend bits for this byte. */
+ unsigned int signMask = sign & ~unusedMSMask;
+ accum |=
+ (((bytes[src] >> unusedLS) & unusedMSMask) | signMask) << accumSize;
+ accumSize += HOST_CHAR_BIT - unusedLS;
+ if (accumSize >= HOST_CHAR_BIT)
+ {
+ unpacked[targ] = accum & ~(~0L << HOST_CHAR_BIT);
+ accumSize -= HOST_CHAR_BIT;
+ accum >>= HOST_CHAR_BIT;
+ ntarg -= 1;
+ targ += delta;
+ }
+ srcBitsLeft -= HOST_CHAR_BIT - unusedLS;
+ unusedLS = 0;
+ nsrc -= 1;
+ src += delta;
+ }
+ while (ntarg > 0)
+ {
+ accum |= sign << accumSize;
+ unpacked[targ] = accum & ~(~0L << HOST_CHAR_BIT);
+ accumSize -= HOST_CHAR_BIT;
+ accum >>= HOST_CHAR_BIT;
+ ntarg -= 1;
+ targ += delta;
+ }
+
+ return v;
+}
+
+/* Move N bits from SOURCE, starting at bit offset SRC_OFFSET to
+ TARGET, starting at bit offset TARG_OFFSET. SOURCE and TARGET must
+ not overlap. */
+static void
+move_bits (char* target, int targ_offset, char* source, int src_offset, int n)
+{
+ unsigned int accum, mask;
+ int accum_bits, chunk_size;
+
+ target += targ_offset / HOST_CHAR_BIT;
+ targ_offset %= HOST_CHAR_BIT;
+ source += src_offset / HOST_CHAR_BIT;
+ src_offset %= HOST_CHAR_BIT;
+ if (BITS_BIG_ENDIAN)
+ {
+ accum = (unsigned char) *source;
+ source += 1;
+ accum_bits = HOST_CHAR_BIT - src_offset;
+
+ while (n > 0)
+ {
+ int unused_right;
+ accum = (accum << HOST_CHAR_BIT) + (unsigned char) *source;
+ accum_bits += HOST_CHAR_BIT;
+ source += 1;
+ chunk_size = HOST_CHAR_BIT - targ_offset;
+ if (chunk_size > n)
+ chunk_size = n;
+ unused_right = HOST_CHAR_BIT - (chunk_size + targ_offset);
+ mask = ((1 << chunk_size) - 1) << unused_right;
+ *target =
+ (*target & ~mask)
+ | ((accum >> (accum_bits - chunk_size - unused_right)) & mask);
+ n -= chunk_size;
+ accum_bits -= chunk_size;
+ target += 1;
+ targ_offset = 0;
+ }
+ }
+ else
+ {
+ accum = (unsigned char) *source >> src_offset;
+ source += 1;
+ accum_bits = HOST_CHAR_BIT - src_offset;
+
+ while (n > 0)
+ {
+ accum = accum + ((unsigned char) *source << accum_bits);
+ accum_bits += HOST_CHAR_BIT;
+ source += 1;
+ chunk_size = HOST_CHAR_BIT - targ_offset;
+ if (chunk_size > n)
+ chunk_size = n;
+ mask = ((1 << chunk_size) - 1) << targ_offset;
+ *target =
+ (*target & ~mask) | ((accum << targ_offset) & mask);
+ n -= chunk_size;
+ accum_bits -= chunk_size;
+ accum >>= chunk_size;
+ target += 1;
+ targ_offset = 0;
+ }
+ }
+}
+
+
+/* Store the contents of FROMVAL into the location of TOVAL.
+ Return a new value with the location of TOVAL and contents of
+ FROMVAL. Handles assignment into packed fields that have
+ floating-point or non-scalar types. */
+
+static struct value*
+ada_value_assign (struct value* toval, struct value* fromval)
+{
+ struct type* type = VALUE_TYPE (toval);
+ int bits = VALUE_BITSIZE (toval);
+
+ if (!toval->modifiable)
+ error ("Left operand of assignment is not a modifiable lvalue.");
+
+ COERCE_REF (toval);
+
+ if (VALUE_LVAL (toval) == lval_memory
+ && bits > 0
+ && (TYPE_CODE (type) == TYPE_CODE_FLT
+ || TYPE_CODE (type) == TYPE_CODE_STRUCT))
+ {
+ int len =
+ (VALUE_BITPOS (toval) + bits + HOST_CHAR_BIT - 1)
+ / HOST_CHAR_BIT;
+ char* buffer = (char*) alloca (len);
+ struct value* val;
+
+ if (TYPE_CODE (type) == TYPE_CODE_FLT)
+ fromval = value_cast (type, fromval);
+
+ read_memory (VALUE_ADDRESS (toval) + VALUE_OFFSET (toval), buffer, len);
+ if (BITS_BIG_ENDIAN)
+ move_bits (buffer, VALUE_BITPOS (toval),
+ VALUE_CONTENTS (fromval),
+ TYPE_LENGTH (VALUE_TYPE (fromval)) * TARGET_CHAR_BIT - bits,
+ bits);
+ else
+ move_bits (buffer, VALUE_BITPOS (toval), VALUE_CONTENTS (fromval),
+ 0, bits);
+ write_memory (VALUE_ADDRESS (toval) + VALUE_OFFSET (toval), buffer, len);
+
+ val = value_copy (toval);
+ memcpy (VALUE_CONTENTS_RAW (val), VALUE_CONTENTS (fromval),
+ TYPE_LENGTH (type));
+ VALUE_TYPE (val) = type;
+
+ return val;
+ }
+
+ return value_assign (toval, fromval);
+}
+
+
+/* The value of the element of array ARR at the ARITY indices given in IND.
+ ARR may be either a simple array, GNAT array descriptor, or pointer
+ thereto. */
+
+struct value*
+ada_value_subscript (arr, arity, ind)
+ struct value* arr;
+ int arity;
+ struct value** ind;
+{
+ int k;
+ struct value* elt;
+ struct type* elt_type;
+
+ elt = ada_coerce_to_simple_array (arr);
+
+ elt_type = check_typedef (VALUE_TYPE (elt));
+ if (TYPE_CODE (elt_type) == TYPE_CODE_ARRAY
+ && TYPE_FIELD_BITSIZE (elt_type, 0) > 0)
+ return value_subscript_packed (elt, arity, ind);
+
+ for (k = 0; k < arity; k += 1)
+ {
+ if (TYPE_CODE (elt_type) != TYPE_CODE_ARRAY)
+ error("too many subscripts (%d expected)", k);
+ elt = value_subscript (elt, value_pos_atr (ind[k]));
+ }
+ return elt;
+}
+
+/* Assuming ARR is a pointer to a standard GDB array of type TYPE, the
+ value of the element of *ARR at the ARITY indices given in
+ IND. Does not read the entire array into memory. */
+
+struct value*
+ada_value_ptr_subscript (arr, type, arity, ind)
+ struct value* arr;
+ struct type* type;
+ int arity;
+ struct value** ind;
+{
+ int k;
+
+ for (k = 0; k < arity; k += 1)
+ {
+ LONGEST lwb, upb;
+ struct value* idx;
+
+ if (TYPE_CODE (type) != TYPE_CODE_ARRAY)
+ error("too many subscripts (%d expected)", k);
+ arr = value_cast (lookup_pointer_type (TYPE_TARGET_TYPE (type)),
+ value_copy (arr));
+ get_discrete_bounds (TYPE_INDEX_TYPE (type), &lwb, &upb);
+ if (lwb == 0)
+ idx = ind[k];
+ else
+ idx = value_sub (ind[k], value_from_longest (builtin_type_int, lwb));
+ arr = value_add (arr, idx);
+ type = TYPE_TARGET_TYPE (type);
+ }
+
+ return value_ind (arr);
+}
+
+/* If type is a record type in the form of a standard GNAT array
+ descriptor, returns the number of dimensions for type. If arr is a
+ simple array, returns the number of "array of"s that prefix its
+ type designation. Otherwise, returns 0. */
+
+int
+ada_array_arity (type)
+ struct type* type;
+{
+ int arity;
+
+ if (type == NULL)
+ return 0;
+
+ type = desc_base_type (type);
+
+ arity = 0;
+ if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
+ return desc_arity (desc_bounds_type (type));
+ else
+ while (TYPE_CODE (type) == TYPE_CODE_ARRAY)
+ {
+ arity += 1;
+ type = check_typedef (TYPE_TARGET_TYPE (type));
+ }
+
+ return arity;
+}
+
+/* If TYPE is a record type in the form of a standard GNAT array
+ descriptor or a simple array type, returns the element type for
+ TYPE after indexing by NINDICES indices, or by all indices if
+ NINDICES is -1. Otherwise, returns NULL. */
+
+struct type*
+ada_array_element_type (type, nindices)
+ struct type* type;
+ int nindices;
+{
+ type = desc_base_type (type);
+
+ if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
+ {
+ int k;
+ struct type* p_array_type;
+
+ p_array_type = desc_data_type (type);
+
+ k = ada_array_arity (type);
+ if (k == 0)
+ return NULL;
+
+ /* Initially p_array_type = elt_type(*)[]...(k times)...[] */
+ if (nindices >= 0 && k > nindices)
+ k = nindices;
+ p_array_type = TYPE_TARGET_TYPE (p_array_type);
+ while (k > 0 && p_array_type != NULL)
+ {
+ p_array_type = check_typedef (TYPE_TARGET_TYPE (p_array_type));
+ k -= 1;
+ }
+ return p_array_type;
+ }
+ else if (TYPE_CODE (type) == TYPE_CODE_ARRAY)
+ {
+ while (nindices != 0 && TYPE_CODE (type) == TYPE_CODE_ARRAY)
+ {
+ type = TYPE_TARGET_TYPE (type);
+ nindices -= 1;
+ }
+ return type;
+ }
+
+ return NULL;
+}
+
+/* The type of nth index in arrays of given type (n numbering from 1). Does
+ not examine memory. */
+
+struct type*
+ada_index_type (type, n)
+ struct type* type;
+ int n;
+{
+ type = desc_base_type (type);
+
+ if (n > ada_array_arity (type))
+ return NULL;
+
+ if (ada_is_simple_array (type))
+ {
+ int i;
+
+ for (i = 1; i < n; i += 1)
+ type = TYPE_TARGET_TYPE (type);
+
+ return TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (type, 0));
+ }
+ else
+ return desc_index_type (desc_bounds_type (type), n);
+}
+
+/* Given that arr is an array type, returns the lower bound of the
+ Nth index (numbering from 1) if WHICH is 0, and the upper bound if
+ WHICH is 1. This returns bounds 0 .. -1 if ARR_TYPE is an
+ array-descriptor type. If TYPEP is non-null, *TYPEP is set to the
+ bounds type. It works for other arrays with bounds supplied by
+ run-time quantities other than discriminants. */
+
+LONGEST
+ada_array_bound_from_type (arr_type, n, which, typep)
+ struct type* arr_type;
+ int n;
+ int which;
+ struct type** typep;
+{
+ struct type* type;
+ struct type* index_type_desc;
+
+ if (ada_is_packed_array_type (arr_type))
+ arr_type = decode_packed_array_type (arr_type);
+
+ if (arr_type == NULL || ! ada_is_simple_array (arr_type))
+ {
+ if (typep != NULL)
+ *typep = builtin_type_int;
+ return (LONGEST) -which;
+ }
+
+ if (TYPE_CODE (arr_type) == TYPE_CODE_PTR)
+ type = TYPE_TARGET_TYPE (arr_type);
+ else
+ type = arr_type;
+
+ index_type_desc = ada_find_parallel_type (type, "___XA");
+ if (index_type_desc == NULL)
+ {
+ struct type* range_type;
+ struct type* index_type;
+
+ while (n > 1)
+ {
+ type = TYPE_TARGET_TYPE (type);
+ n -= 1;
+ }
+
+ range_type = TYPE_INDEX_TYPE (type);
+ index_type = TYPE_TARGET_TYPE (range_type);
+ if (TYPE_CODE (index_type) == TYPE_CODE_UNDEF)
+ index_type = builtin_type_long;
+ if (typep != NULL)
+ *typep = index_type;
+ return
+ (LONGEST) (which == 0
+ ? TYPE_LOW_BOUND (range_type)
+ : TYPE_HIGH_BOUND (range_type));
+ }
+ else
+ {
+ struct type* index_type =
+ to_fixed_range_type (TYPE_FIELD_NAME (index_type_desc, n-1),
+ NULL, TYPE_OBJFILE (arr_type));
+ if (typep != NULL)
+ *typep = TYPE_TARGET_TYPE (index_type);
+ return
+ (LONGEST) (which == 0
+ ? TYPE_LOW_BOUND (index_type)
+ : TYPE_HIGH_BOUND (index_type));
+ }
+}
+
+/* Given that arr is an array value, returns the lower bound of the
+ nth index (numbering from 1) if which is 0, and the upper bound if
+ which is 1. This routine will also work for arrays with bounds
+ supplied by run-time quantities other than discriminants. */
+
+struct value*
+ada_array_bound (arr, n, which)
+ struct value* arr;
+ int n;
+ int which;
+{
+ struct type* arr_type = VALUE_TYPE (arr);
+
+ if (ada_is_packed_array_type (arr_type))
+ return ada_array_bound (decode_packed_array (arr), n, which);
+ else if (ada_is_simple_array (arr_type))
+ {
+ struct type* type;
+ LONGEST v = ada_array_bound_from_type (arr_type, n, which, &type);
+ return value_from_longest (type, v);
+ }
+ else
+ return desc_one_bound (desc_bounds (arr), n, which);
+}
+
+/* Given that arr is an array value, returns the length of the
+ nth index. This routine will also work for arrays with bounds
+ supplied by run-time quantities other than discriminants. Does not
+ work for arrays indexed by enumeration types with representation
+ clauses at the moment. */
+
+struct value*
+ada_array_length (arr, n)
+ struct value* arr;
+ int n;
+{
+ struct type* arr_type = check_typedef (VALUE_TYPE (arr));
+ struct type* index_type_desc;
+
+ if (ada_is_packed_array_type (arr_type))
+ return ada_array_length (decode_packed_array (arr), n);
+
+ if (ada_is_simple_array (arr_type))
+ {
+ struct type* type;
+ LONGEST v =
+ ada_array_bound_from_type (arr_type, n, 1, &type) -
+ ada_array_bound_from_type (arr_type, n, 0, NULL) + 1;
+ return value_from_longest (type, v);
+ }
+ else
+ return
+ value_from_longest (builtin_type_ada_int,
+ value_as_long (desc_one_bound (desc_bounds (arr),
+ n, 1))
+ - value_as_long (desc_one_bound (desc_bounds (arr),
+ n, 0))
+ + 1);
+}
+
+
+ /* Name resolution */
+
+/* The "demangled" name for the user-definable Ada operator corresponding
+ to op. */
+
+static const char*
+ada_op_name (op)
+ enum exp_opcode op;
+{
+ int i;
+
+ for (i = 0; ada_opname_table[i].mangled != NULL; i += 1)
+ {
+ if (ada_opname_table[i].op == op)
+ return ada_opname_table[i].demangled;
+ }
+ error ("Could not find operator name for opcode");
+}
+
+
+/* Same as evaluate_type (*EXP), but resolves ambiguous symbol
+ references (OP_UNRESOLVED_VALUES) and converts operators that are
+ user-defined into appropriate function calls. If CONTEXT_TYPE is
+ non-null, it provides a preferred result type [at the moment, only
+ type void has any effect---causing procedures to be preferred over
+ functions in calls]. A null CONTEXT_TYPE indicates that a non-void
+ return type is preferred. The variable unresolved_names contains a list
+ of character strings referenced by expout that should be freed.
+ May change (expand) *EXP. */
+
+void
+ada_resolve (expp, context_type)
+ struct expression** expp;
+ struct type* context_type;
+{
+ int pc;
+ pc = 0;
+ ada_resolve_subexp (expp, &pc, 1, context_type);
+}
+
+/* Resolve the operator of the subexpression beginning at
+ position *POS of *EXPP. "Resolving" consists of replacing
+ OP_UNRESOLVED_VALUE with an appropriate OP_VAR_VALUE, replacing
+ built-in operators with function calls to user-defined operators,
+ where appropriate, and (when DEPROCEDURE_P is non-zero), converting
+ function-valued variables into parameterless calls. May expand
+ EXP. The CONTEXT_TYPE functions as in ada_resolve, above. */
+
+static struct value*
+ada_resolve_subexp (expp, pos, deprocedure_p, context_type)
+ struct expression** expp;
+ int *pos;
+ int deprocedure_p;
+ struct type* context_type;
+{
+ int pc = *pos;
+ int i;
+ struct expression* exp; /* Convenience: == *expp */
+ enum exp_opcode op = (*expp)->elts[pc].opcode;
+ struct value** argvec; /* Vector of operand types (alloca'ed). */
+ int nargs; /* Number of operands */
+
+ argvec = NULL;
+ nargs = 0;
+ exp = *expp;
+
+ /* Pass one: resolve operands, saving their types and updating *pos. */
+ switch (op)
+ {
+ case OP_VAR_VALUE:
+ /* case OP_UNRESOLVED_VALUE:*/
+ /* FIXME: OP_UNRESOLVED_VALUE should be defined in expression.h */
+ *pos += 4;
+ break;
+
+ case OP_FUNCALL:
+ nargs = longest_to_int (exp->elts[pc + 1].longconst) + 1;
+ /* FIXME: OP_UNRESOLVED_VALUE should be defined in expression.h */
+ /* if (exp->elts[pc+3].opcode == OP_UNRESOLVED_VALUE)
+ {
+ *pos += 7;
+
+ argvec = (struct value* *) alloca (sizeof (struct value*) * (nargs + 1));
+ for (i = 0; i < nargs-1; i += 1)
+ argvec[i] = ada_resolve_subexp (expp, pos, 1, NULL);
+ argvec[i] = NULL;
+ }
+ else
+ {
+ *pos += 3;
+ ada_resolve_subexp (expp, pos, 0, NULL);
+ for (i = 1; i < nargs; i += 1)
+ ada_resolve_subexp (expp, pos, 1, NULL);
+ }
+ */
+ exp = *expp;
+ break;
+
+ /* FIXME: UNOP_QUAL should be defined in expression.h */
+ /* case UNOP_QUAL:
+ nargs = 1;
+ *pos += 3;
+ ada_resolve_subexp (expp, pos, 1, exp->elts[pc + 1].type);
+ exp = *expp;
+ break;
+ */
+ /* FIXME: OP_ATTRIBUTE should be defined in expression.h */
+ /* case OP_ATTRIBUTE:
+ nargs = longest_to_int (exp->elts[pc + 1].longconst) + 1;
+ *pos += 4;
+ for (i = 0; i < nargs; i += 1)
+ ada_resolve_subexp (expp, pos, 1, NULL);
+ exp = *expp;
+ break;
+ */
+ case UNOP_ADDR:
+ nargs = 1;
+ *pos += 1;
+ ada_resolve_subexp (expp, pos, 0, NULL);
+ exp = *expp;
+ break;
+
+ case BINOP_ASSIGN:
+ {
+ struct value* arg1;
+ nargs = 2;
+ *pos += 1;
+ arg1 = ada_resolve_subexp (expp, pos, 0, NULL);
+ if (arg1 == NULL)
+ ada_resolve_subexp (expp, pos, 1, NULL);
+ else
+ ada_resolve_subexp (expp, pos, 1, VALUE_TYPE (arg1));
+ break;
+ }
+
+ default:
+ switch (op)
+ {
+ default:
+ error ("Unexpected operator during name resolution");
+ case UNOP_CAST:
+ /* case UNOP_MBR:
+ nargs = 1;
+ *pos += 3;
+ break;
+ */
+ case BINOP_ADD:
+ case BINOP_SUB:
+ case BINOP_MUL:
+ case BINOP_DIV:
+ case BINOP_REM:
+ case BINOP_MOD:
+ case BINOP_EXP:
+ case BINOP_CONCAT:
+ case BINOP_LOGICAL_AND:
+ case BINOP_LOGICAL_OR:
+ case BINOP_BITWISE_AND:
+ case BINOP_BITWISE_IOR:
+ case BINOP_BITWISE_XOR:
+
+ case BINOP_EQUAL:
+ case BINOP_NOTEQUAL:
+ case BINOP_LESS:
+ case BINOP_GTR:
+ case BINOP_LEQ:
+ case BINOP_GEQ:
+
+ case BINOP_REPEAT:
+ case BINOP_SUBSCRIPT:
+ case BINOP_COMMA:
+ nargs = 2;
+ *pos += 1;
+ break;
+
+ case UNOP_NEG:
+ case UNOP_PLUS:
+ case UNOP_LOGICAL_NOT:
+ case UNOP_ABS:
+ case UNOP_IND:
+ nargs = 1;
+ *pos += 1;
+ break;
+
+ case OP_LONG:
+ case OP_DOUBLE:
+ case OP_VAR_VALUE:
+ *pos += 4;
+ break;
+
+ case OP_TYPE:
+ case OP_BOOL:
+ case OP_LAST:
+ case OP_REGISTER:
+ case OP_INTERNALVAR:
+ *pos += 3;
+ break;
+
+ case UNOP_MEMVAL:
+ *pos += 3;
+ nargs = 1;
+ break;
+
+ case STRUCTOP_STRUCT:
+ case STRUCTOP_PTR:
+ nargs = 1;
+ *pos += 4 + BYTES_TO_EXP_ELEM (exp->elts[pc + 1].longconst + 1);
+ break;
+
+ case OP_ARRAY:
+ *pos += 4;
+ nargs = longest_to_int (exp->elts[pc + 2].longconst) + 1;
+ nargs -= longest_to_int (exp->elts[pc + 1].longconst);
+ /* A null array contains one dummy element to give the type. */
+ /* if (nargs == 0)
+ nargs = 1;
+ break;*/
+
+ case TERNOP_SLICE:
+ /* FIXME: TERNOP_MBR should be defined in expression.h */
+ /* case TERNOP_MBR:
+ *pos += 1;
+ nargs = 3;
+ break;
+ */
+ /* FIXME: BINOP_MBR should be defined in expression.h */
+ /* case BINOP_MBR:
+ *pos += 3;
+ nargs = 2;
+ break;*/
+ }
+
+ argvec = (struct value* *) alloca (sizeof (struct value*) * (nargs + 1));
+ for (i = 0; i < nargs; i += 1)
+ argvec[i] = ada_resolve_subexp (expp, pos, 1, NULL);
+ argvec[i] = NULL;
+ exp = *expp;
+ break;
+ }
+
+ /* Pass two: perform any resolution on principal operator. */
+ switch (op)
+ {
+ default:
+ break;
+
+ /* FIXME: OP_UNRESOLVED_VALUE should be defined in expression.h */
+ /* case OP_UNRESOLVED_VALUE:
+ {
+ struct symbol** candidate_syms;
+ struct block** candidate_blocks;
+ int n_candidates;
+
+ n_candidates = ada_lookup_symbol_list (exp->elts[pc + 2].name,
+ exp->elts[pc + 1].block,
+ VAR_NAMESPACE,
+ &candidate_syms,
+ &candidate_blocks);
+
+ if (n_candidates > 1)
+ {*/
+ /* Types tend to get re-introduced locally, so if there
+ are any local symbols that are not types, first filter
+ out all types.*/ /*
+ int j;
+ for (j = 0; j < n_candidates; j += 1)
+ switch (SYMBOL_CLASS (candidate_syms[j]))
+ {
+ case LOC_REGISTER:
+ case LOC_ARG:
+ case LOC_REF_ARG:
+ case LOC_REGPARM:
+ case LOC_REGPARM_ADDR:
+ case LOC_LOCAL:
+ case LOC_LOCAL_ARG:
+ case LOC_BASEREG:
+ case LOC_BASEREG_ARG:
+ goto FoundNonType;
+ default:
+ break;
+ }
+ FoundNonType:
+ if (j < n_candidates)
+ {
+ j = 0;
+ while (j < n_candidates)
+ {
+ if (SYMBOL_CLASS (candidate_syms[j]) == LOC_TYPEDEF)
+ {
+ candidate_syms[j] = candidate_syms[n_candidates-1];
+ candidate_blocks[j] = candidate_blocks[n_candidates-1];
+ n_candidates -= 1;
+ }
+ else
+ j += 1;
+ }
+ }
+ }
+
+ if (n_candidates == 0)
+ error ("No definition found for %s",
+ ada_demangle (exp->elts[pc + 2].name));
+ else if (n_candidates == 1)
+ i = 0;
+ else if (deprocedure_p
+ && ! is_nonfunction (candidate_syms, n_candidates))
+ {
+ i = ada_resolve_function (candidate_syms, candidate_blocks,
+ n_candidates, NULL, 0,
+ exp->elts[pc + 2].name, context_type);
+ if (i < 0)
+ error ("Could not find a match for %s",
+ ada_demangle (exp->elts[pc + 2].name));
+ }
+ else
+ {
+ printf_filtered ("Multiple matches for %s\n",
+ ada_demangle (exp->elts[pc+2].name));
+ user_select_syms (candidate_syms, candidate_blocks,
+ n_candidates, 1);
+ i = 0;
+ }
+
+ exp->elts[pc].opcode = exp->elts[pc + 3].opcode = OP_VAR_VALUE;
+ exp->elts[pc + 1].block = candidate_blocks[i];
+ exp->elts[pc + 2].symbol = candidate_syms[i];
+ if (innermost_block == NULL ||
+ contained_in (candidate_blocks[i], innermost_block))
+ innermost_block = candidate_blocks[i];
+ }*/
+ /* FALL THROUGH */
+
+ case OP_VAR_VALUE:
+ if (deprocedure_p &&
+ TYPE_CODE (SYMBOL_TYPE (exp->elts[pc+2].symbol)) == TYPE_CODE_FUNC)
+ {
+ replace_operator_with_call (expp, pc, 0, 0,
+ exp->elts[pc+2].symbol,
+ exp->elts[pc+1].block);
+ exp = *expp;
+ }
+ break;
+
+ case OP_FUNCALL:
+ {
+ /* FIXME: OP_UNRESOLVED_VALUE should be defined in expression.h */
+ /* if (exp->elts[pc+3].opcode == OP_UNRESOLVED_VALUE)
+ {
+ struct symbol** candidate_syms;
+ struct block** candidate_blocks;
+ int n_candidates;
+
+ n_candidates = ada_lookup_symbol_list (exp->elts[pc + 5].name,
+ exp->elts[pc + 4].block,
+ VAR_NAMESPACE,
+ &candidate_syms,
+ &candidate_blocks);
+ if (n_candidates == 1)
+ i = 0;
+ else
+ {
+ i = ada_resolve_function (candidate_syms, candidate_blocks,
+ n_candidates, argvec, nargs-1,
+ exp->elts[pc + 5].name, context_type);
+ if (i < 0)
+ error ("Could not find a match for %s",
+ ada_demangle (exp->elts[pc + 5].name));
+ }
+
+ exp->elts[pc + 3].opcode = exp->elts[pc + 6].opcode = OP_VAR_VALUE;
+ exp->elts[pc + 4].block = candidate_blocks[i];
+ exp->elts[pc + 5].symbol = candidate_syms[i];
+ if (innermost_block == NULL ||
+ contained_in (candidate_blocks[i], innermost_block))
+ innermost_block = candidate_blocks[i];
+ }*/
+
+ }
+ break;
+ case BINOP_ADD:
+ case BINOP_SUB:
+ case BINOP_MUL:
+ case BINOP_DIV:
+ case BINOP_REM:
+ case BINOP_MOD:
+ case BINOP_CONCAT:
+ case BINOP_BITWISE_AND:
+ case BINOP_BITWISE_IOR:
+ case BINOP_BITWISE_XOR:
+ case BINOP_EQUAL:
+ case BINOP_NOTEQUAL:
+ case BINOP_LESS:
+ case BINOP_GTR:
+ case BINOP_LEQ:
+ case BINOP_GEQ:
+ case BINOP_EXP:
+ case UNOP_NEG:
+ case UNOP_PLUS:
+ case UNOP_LOGICAL_NOT:
+ case UNOP_ABS:
+ if (possible_user_operator_p (op, argvec))
+ {
+ struct symbol** candidate_syms;
+ struct block** candidate_blocks;
+ int n_candidates;
+
+ n_candidates = ada_lookup_symbol_list (ada_mangle (ada_op_name (op)),
+ (struct block*) NULL,
+ VAR_NAMESPACE,
+ &candidate_syms,
+ &candidate_blocks);
+ i = ada_resolve_function (candidate_syms, candidate_blocks,
+ n_candidates, argvec, nargs,
+ ada_op_name (op), NULL);
+ if (i < 0)
+ break;
+
+ replace_operator_with_call (expp, pc, nargs, 1,
+ candidate_syms[i], candidate_blocks[i]);
+ exp = *expp;
+ }
+ break;
+ }
+
+ *pos = pc;
+ return evaluate_subexp_type (exp, pos);
+}
+
+/* Return non-zero if formal type FTYPE matches actual type ATYPE. If
+ MAY_DEREF is non-zero, the formal may be a pointer and the actual
+ a non-pointer. */
+/* The term "match" here is rather loose. The match is heuristic and
+ liberal. FIXME: TOO liberal, in fact. */
+
+static int
+ada_type_match (ftype, atype, may_deref)
+ struct type* ftype;
+ struct type* atype;
+ int may_deref;
+{
+ CHECK_TYPEDEF (ftype);
+ CHECK_TYPEDEF (atype);
+
+ if (TYPE_CODE (ftype) == TYPE_CODE_REF)
+ ftype = TYPE_TARGET_TYPE (ftype);
+ if (TYPE_CODE (atype) == TYPE_CODE_REF)
+ atype = TYPE_TARGET_TYPE (atype);
+
+ if (TYPE_CODE (ftype) == TYPE_CODE_VOID
+ || TYPE_CODE (atype) == TYPE_CODE_VOID)
+ return 1;
+
+ switch (TYPE_CODE (ftype))
+ {
+ default:
+ return 1;
+ case TYPE_CODE_PTR:
+ if (TYPE_CODE (atype) == TYPE_CODE_PTR)
+ return ada_type_match (TYPE_TARGET_TYPE (ftype),
+ TYPE_TARGET_TYPE (atype), 0);
+ else return (may_deref &&
+ ada_type_match (TYPE_TARGET_TYPE (ftype), atype, 0));
+ case TYPE_CODE_INT:
+ case TYPE_CODE_ENUM:
+ case TYPE_CODE_RANGE:
+ switch (TYPE_CODE (atype))
+ {
+ case TYPE_CODE_INT:
+ case TYPE_CODE_ENUM:
+ case TYPE_CODE_RANGE:
+ return 1;
+ default:
+ return 0;
+ }
+
+ case TYPE_CODE_ARRAY:
+ return (TYPE_CODE (atype) == TYPE_CODE_ARRAY
+ || ada_is_array_descriptor (atype));
+
+ case TYPE_CODE_STRUCT:
+ if (ada_is_array_descriptor (ftype))
+ return (TYPE_CODE (atype) == TYPE_CODE_ARRAY
+ || ada_is_array_descriptor (atype));
+ else
+ return (TYPE_CODE (atype) == TYPE_CODE_STRUCT
+ && ! ada_is_array_descriptor (atype));
+
+ case TYPE_CODE_UNION:
+ case TYPE_CODE_FLT:
+ return (TYPE_CODE (atype) == TYPE_CODE (ftype));
+ }
+}
+
+/* Return non-zero if the formals of FUNC "sufficiently match" the
+ vector of actual argument types ACTUALS of size N_ACTUALS. FUNC
+ may also be an enumeral, in which case it is treated as a 0-
+ argument function. */
+
+static int
+ada_args_match (func, actuals, n_actuals)
+ struct symbol* func;
+ struct value** actuals;
+ int n_actuals;
+{
+ int i;
+ struct type* func_type = SYMBOL_TYPE (func);
+
+ if (SYMBOL_CLASS (func) == LOC_CONST &&
+ TYPE_CODE (func_type) == TYPE_CODE_ENUM)
+ return (n_actuals == 0);
+ else if (func_type == NULL || TYPE_CODE (func_type) != TYPE_CODE_FUNC)
+ return 0;
+
+ if (TYPE_NFIELDS (func_type) != n_actuals)
+ return 0;
+
+ for (i = 0; i < n_actuals; i += 1)
+ {
+ struct type* ftype = check_typedef (TYPE_FIELD_TYPE (func_type, i));
+ struct type* atype = check_typedef (VALUE_TYPE (actuals[i]));
+
+ if (! ada_type_match (TYPE_FIELD_TYPE (func_type, i),
+ VALUE_TYPE (actuals[i]), 1))
+ return 0;
+ }
+ return 1;
+}
+
+/* False iff function type FUNC_TYPE definitely does not produce a value
+ compatible with type CONTEXT_TYPE. Conservatively returns 1 if
+ FUNC_TYPE is not a valid function type with a non-null return type
+ or an enumerated type. A null CONTEXT_TYPE indicates any non-void type. */
+
+static int
+return_match (func_type, context_type)
+ struct type* func_type;
+ struct type* context_type;
+{
+ struct type* return_type;
+
+ if (func_type == NULL)
+ return 1;
+
+ /* FIXME: base_type should be declared in gdbtypes.h, implemented in valarith.c */
+ /* if (TYPE_CODE (func_type) == TYPE_CODE_FUNC)
+ return_type = base_type (TYPE_TARGET_TYPE (func_type));
+ else
+ return_type = base_type (func_type);*/
+ if (return_type == NULL)
+ return 1;
+
+ /* FIXME: base_type should be declared in gdbtypes.h, implemented in valarith.c */
+ /* context_type = base_type (context_type);*/
+
+ if (TYPE_CODE (return_type) == TYPE_CODE_ENUM)
+ return context_type == NULL || return_type == context_type;
+ else if (context_type == NULL)
+ return TYPE_CODE (return_type) != TYPE_CODE_VOID;
+ else
+ return TYPE_CODE (return_type) == TYPE_CODE (context_type);
+}
+
+
+/* Return the index in SYMS[0..NSYMS-1] of symbol for the
+ function (if any) that matches the types of the NARGS arguments in
+ ARGS. If CONTEXT_TYPE is non-null, and there is at least one match
+ that returns type CONTEXT_TYPE, then eliminate other matches. If
+ CONTEXT_TYPE is null, prefer a non-void-returning function.
+ Asks the user if there is more than one match remaining. Returns -1
+ if there is no such symbol or none is selected. NAME is used
+ solely for messages. May re-arrange and modify SYMS in
+ the process; the index returned is for the modified vector. BLOCKS
+ is modified in parallel to SYMS. */
+
+int
+ada_resolve_function (syms, blocks, nsyms, args, nargs, name, context_type)
+ struct symbol* syms[];
+ struct block* blocks[];
+ struct value** args;
+ int nsyms, nargs;
+ const char* name;
+ struct type* context_type;
+{
+ int k;
+ int m; /* Number of hits */
+ struct type* fallback;
+ struct type* return_type;
+
+ return_type = context_type;
+ if (context_type == NULL)
+ fallback = builtin_type_void;
+ else
+ fallback = NULL;
+
+ m = 0;
+ while (1)
+ {
+ for (k = 0; k < nsyms; k += 1)
+ {
+ struct type* type = check_typedef (SYMBOL_TYPE (syms[k]));
+
+ if (ada_args_match (syms[k], args, nargs)
+ && return_match (SYMBOL_TYPE (syms[k]), return_type))
+ {
+ syms[m] = syms[k];
+ if (blocks != NULL)
+ blocks[m] = blocks[k];
+ m += 1;
+ }
+ }
+ if (m > 0 || return_type == fallback)
+ break;
+ else
+ return_type = fallback;
+ }
+
+ if (m == 0)
+ return -1;
+ else if (m > 1)
+ {
+ printf_filtered ("Multiple matches for %s\n", name);
+ user_select_syms (syms, blocks, m, 1);
+ return 0;
+ }
+ return 0;
+}
+
+/* Returns true (non-zero) iff demangled name N0 should appear before N1 */
+/* in a listing of choices during disambiguation (see sort_choices, below). */
+/* The idea is that overloadings of a subprogram name from the */
+/* same package should sort in their source order. We settle for ordering */
+/* such symbols by their trailing number (__N or $N). */
+static int
+mangled_ordered_before (char* N0, char* N1)
+{
+ if (N1 == NULL)
+ return 0;
+ else if (N0 == NULL)
+ return 1;
+ else
+ {
+ int k0, k1;
+ for (k0 = strlen (N0)-1; k0 > 0 && isdigit (N0[k0]); k0 -= 1)
+ ;
+ for (k1 = strlen (N1)-1; k1 > 0 && isdigit (N1[k1]); k1 -= 1)
+ ;
+ if ((N0[k0] == '_' || N0[k0] == '$') && N0[k0+1] != '\000'
+ && (N1[k1] == '_' || N1[k1] == '$') && N1[k1+1] != '\000')
+ {
+ int n0, n1;
+ n0 = k0;
+ while (N0[n0] == '_' && n0 > 0 && N0[n0-1] == '_')
+ n0 -= 1;
+ n1 = k1;
+ while (N1[n1] == '_' && n1 > 0 && N1[n1-1] == '_')
+ n1 -= 1;
+ if (n0 == n1 && STREQN (N0, N1, n0))
+ return (atoi (N0+k0+1) < atoi (N1+k1+1));
+ }
+ return (strcmp (N0, N1) < 0);
+ }
+}
+
+/* Sort SYMS[0..NSYMS-1] to put the choices in a canonical order by their */
+/* mangled names, rearranging BLOCKS[0..NSYMS-1] according to the same */
+/* permutation. */
+static void
+sort_choices (syms, blocks, nsyms)
+ struct symbol* syms[];
+ struct block* blocks[];
+ int nsyms;
+{
+ int i, j;
+ for (i = 1; i < nsyms; i += 1)
+ {
+ struct symbol* sym = syms[i];
+ struct block* block = blocks[i];
+ int j;
+
+ for (j = i-1; j >= 0; j -= 1)
+ {
+ if (mangled_ordered_before (SYMBOL_NAME (syms[j]),
+ SYMBOL_NAME (sym)))
+ break;
+ syms[j+1] = syms[j];
+ blocks[j+1] = blocks[j];
+ }
+ syms[j+1] = sym;
+ blocks[j+1] = block;
+ }
+}
+
+/* Given a list of NSYMS symbols in SYMS and corresponding blocks in */
+/* BLOCKS, select up to MAX_RESULTS>0 by asking the user (if */
+/* necessary), returning the number selected, and setting the first */
+/* elements of SYMS and BLOCKS to the selected symbols and */
+/* corresponding blocks. Error if no symbols selected. BLOCKS may */
+/* be NULL, in which case it is ignored. */
+
+/* NOTE: Adapted from decode_line_2 in symtab.c, with which it ought
+ to be re-integrated one of these days. */
+
+int
+user_select_syms (syms, blocks, nsyms, max_results)
+ struct symbol* syms[];
+ struct block* blocks[];
+ int nsyms;
+ int max_results;
+{
+ int i;
+ int* chosen = (int*) alloca (sizeof(int) * nsyms);
+ int n_chosen;
+ int first_choice = (max_results == 1) ? 1 : 2;
+
+ if (max_results < 1)
+ error ("Request to select 0 symbols!");
+ if (nsyms <= 1)
+ return nsyms;
+
+ printf_unfiltered("[0] cancel\n");
+ if (max_results > 1)
+ printf_unfiltered("[1] all\n");
+
+ sort_choices (syms, blocks, nsyms);
+
+ for (i = 0; i < nsyms; i += 1)
+ {
+ if (syms[i] == NULL)
+ continue;
+
+ if (SYMBOL_CLASS (syms[i]) == LOC_BLOCK)
+ {
+ struct symtab_and_line sal = find_function_start_sal (syms[i], 1);
+ printf_unfiltered ("[%d] %s at %s:%d\n",
+ i + first_choice,
+ SYMBOL_SOURCE_NAME (syms[i]),
+ sal.symtab == NULL
+ ? "<no source file available>"
+ : sal.symtab->filename,
+ sal.line);
+ continue;
+ }
+ else
+ {
+ int is_enumeral =
+ (SYMBOL_CLASS (syms[i]) == LOC_CONST
+ && SYMBOL_TYPE (syms[i]) != NULL
+ && TYPE_CODE (SYMBOL_TYPE (syms[i]))
+ == TYPE_CODE_ENUM);
+ struct symtab* symtab = symtab_for_sym (syms[i]);
+
+ if (SYMBOL_LINE (syms[i]) != 0 && symtab != NULL)
+ printf_unfiltered ("[%d] %s at %s:%d\n",
+ i + first_choice,
+ SYMBOL_SOURCE_NAME (syms[i]),
+ symtab->filename, SYMBOL_LINE (syms[i]));
+ else if (is_enumeral &&
+ TYPE_NAME (SYMBOL_TYPE (syms[i])) != NULL)
+ {
+ printf_unfiltered ("[%d] ", i + first_choice);
+ ada_print_type (SYMBOL_TYPE (syms[i]), NULL, gdb_stdout, -1, 0);
+ printf_unfiltered ("'(%s) (enumeral)\n",
+ SYMBOL_SOURCE_NAME (syms[i]));
+ }
+ else if (symtab != NULL)
+ printf_unfiltered (is_enumeral
+ ? "[%d] %s in %s (enumeral)\n"
+ : "[%d] %s at %s:?\n",
+ i + first_choice,
+ SYMBOL_SOURCE_NAME (syms[i]),
+ symtab->filename);
+ else
+ printf_unfiltered (is_enumeral
+ ? "[%d] %s (enumeral)\n"
+ : "[%d] %s at ?\n",
+ i + first_choice, SYMBOL_SOURCE_NAME (syms[i]));
+ }
+ }
+
+ n_chosen = get_selections (chosen, nsyms, max_results, max_results > 1,
+ "overload-choice");
+
+ for (i = 0; i < n_chosen; i += 1)
+ {
+ syms[i] = syms[chosen[i]];
+ if (blocks != NULL)
+ blocks[i] = blocks[chosen[i]];
+ }
+
+ return n_chosen;
+}
+
+/* Read and validate a set of numeric choices from the user in the
+ range 0 .. N_CHOICES-1. Place the results in increasing
+ order in CHOICES[0 .. N-1], and return N.
+
+ The user types choices as a sequence of numbers on one line
+ separated by blanks, encoding them as follows:
+
+ + A choice of 0 means to cancel the selection, throwing an error.
+ + If IS_ALL_CHOICE, a choice of 1 selects the entire set 0 .. N_CHOICES-1.
+ + The user chooses k by typing k+IS_ALL_CHOICE+1.
+
+ The user is not allowed to choose more than MAX_RESULTS values.
+
+ ANNOTATION_SUFFIX, if present, is used to annotate the input
+ prompts (for use with the -f switch). */
+
+int
+get_selections (choices, n_choices, max_results, is_all_choice,
+ annotation_suffix)
+ int* choices;
+ int n_choices;
+ int max_results;
+ int is_all_choice;
+ char* annotation_suffix;
+{
+ int i;
+ char* args;
+ const char* prompt;
+ int n_chosen;
+ int first_choice = is_all_choice ? 2 : 1;
+
+ prompt = getenv ("PS2");
+ if (prompt == NULL)
+ prompt = ">";
+
+ printf_unfiltered ("%s ", prompt);
+ gdb_flush (gdb_stdout);
+
+ args = command_line_input ((char *) NULL, 0, annotation_suffix);
+
+ if (args == NULL)
+ error_no_arg ("one or more choice numbers");
+
+ n_chosen = 0;
+
+ /* Set choices[0 .. n_chosen-1] to the users' choices in ascending
+ order, as given in args. Choices are validated. */
+ while (1)
+ {
+ char* args2;
+ int choice, j;
+
+ while (isspace (*args))
+ args += 1;
+ if (*args == '\0' && n_chosen == 0)
+ error_no_arg ("one or more choice numbers");
+ else if (*args == '\0')
+ break;
+
+ choice = strtol (args, &args2, 10);
+ if (args == args2 || choice < 0 || choice > n_choices + first_choice - 1)
+ error ("Argument must be choice number");
+ args = args2;
+
+ if (choice == 0)
+ error ("cancelled");
+
+ if (choice < first_choice)
+ {
+ n_chosen = n_choices;
+ for (j = 0; j < n_choices; j += 1)
+ choices[j] = j;
+ break;
+ }
+ choice -= first_choice;
+
+ for (j = n_chosen-1; j >= 0 && choice < choices[j]; j -= 1)
+ {}
+
+ if (j < 0 || choice != choices[j])
+ {
+ int k;
+ for (k = n_chosen-1; k > j; k -= 1)
+ choices[k+1] = choices[k];
+ choices[j+1] = choice;
+ n_chosen += 1;
+ }
+ }
+
+ if (n_chosen > max_results)
+ error ("Select no more than %d of the above", max_results);
+
+ return n_chosen;
+}
+
+/* Replace the operator of length OPLEN at position PC in *EXPP with a call */
+/* on the function identified by SYM and BLOCK, and taking NARGS */
+/* arguments. Update *EXPP as needed to hold more space. */
+
+static void
+replace_operator_with_call (expp, pc, nargs, oplen, sym, block)
+ struct expression** expp;
+ int pc, nargs, oplen;
+ struct symbol* sym;
+ struct block* block;
+{
+ /* A new expression, with 6 more elements (3 for funcall, 4 for function
+ symbol, -oplen for operator being replaced). */
+ struct expression* newexp = (struct expression*)
+ xmalloc (sizeof (struct expression)
+ + EXP_ELEM_TO_BYTES ((*expp)->nelts + 7 - oplen));
+ struct expression* exp = *expp;
+
+ newexp->nelts = exp->nelts + 7 - oplen;
+ newexp->language_defn = exp->language_defn;
+ memcpy (newexp->elts, exp->elts, EXP_ELEM_TO_BYTES (pc));
+ memcpy (newexp->elts + pc + 7, exp->elts + pc + oplen,
+ EXP_ELEM_TO_BYTES (exp->nelts - pc - oplen));
+
+ newexp->elts[pc].opcode = newexp->elts[pc + 2].opcode = OP_FUNCALL;
+ newexp->elts[pc + 1].longconst = (LONGEST) nargs;
+
+ newexp->elts[pc + 3].opcode = newexp->elts[pc + 6].opcode = OP_VAR_VALUE;
+ newexp->elts[pc + 4].block = block;
+ newexp->elts[pc + 5].symbol = sym;
+
+ *expp = newexp;
+ free (exp);
+}
+
+/* Type-class predicates */
+
+/* True iff TYPE is numeric (i.e., an INT, RANGE (of numeric type), or */
+/* FLOAT.) */
+
+static int
+numeric_type_p (type)
+ struct type* type;
+{
+ if (type == NULL)
+ return 0;
+ else {
+ switch (TYPE_CODE (type))
+ {
+ case TYPE_CODE_INT:
+ case TYPE_CODE_FLT:
+ return 1;
+ case TYPE_CODE_RANGE:
+ return (type == TYPE_TARGET_TYPE (type)
+ || numeric_type_p (TYPE_TARGET_TYPE (type)));
+ default:
+ return 0;
+ }
+ }
+}
+
+/* True iff TYPE is integral (an INT or RANGE of INTs). */
+
+static int
+integer_type_p (type)
+ struct type* type;
+{
+ if (type == NULL)
+ return 0;
+ else {
+ switch (TYPE_CODE (type))
+ {
+ case TYPE_CODE_INT:
+ return 1;
+ case TYPE_CODE_RANGE:
+ return (type == TYPE_TARGET_TYPE (type)
+ || integer_type_p (TYPE_TARGET_TYPE (type)));
+ default:
+ return 0;
+ }
+ }
+}
+
+/* True iff TYPE is scalar (INT, RANGE, FLOAT, ENUM). */
+
+static int
+scalar_type_p (type)
+ struct type* type;
+{
+ if (type == NULL)
+ return 0;
+ else {
+ switch (TYPE_CODE (type))
+ {
+ case TYPE_CODE_INT:
+ case TYPE_CODE_RANGE:
+ case TYPE_CODE_ENUM:
+ case TYPE_CODE_FLT:
+ return 1;
+ default:
+ return 0;
+ }
+ }
+}
+
+/* True iff TYPE is discrete (INT, RANGE, ENUM). */
+
+static int
+discrete_type_p (type)
+ struct type* type;
+{
+ if (type == NULL)
+ return 0;
+ else {
+ switch (TYPE_CODE (type))
+ {
+ case TYPE_CODE_INT:
+ case TYPE_CODE_RANGE:
+ case TYPE_CODE_ENUM:
+ return 1;
+ default:
+ return 0;
+ }
+ }
+}
+
+/* Returns non-zero if OP with operatands in the vector ARGS could be
+ a user-defined function. Errs on the side of pre-defined operators
+ (i.e., result 0). */
+
+static int
+possible_user_operator_p (op, args)
+ enum exp_opcode op;
+ struct value* args[];
+{
+ struct type* type0 = check_typedef (VALUE_TYPE (args[0]));
+ struct type* type1 =
+ (args[1] == NULL) ? NULL : check_typedef (VALUE_TYPE (args[1]));
+
+ switch (op)
+ {
+ default:
+ return 0;
+
+ case BINOP_ADD:
+ case BINOP_SUB:
+ case BINOP_MUL:
+ case BINOP_DIV:
+ return (! (numeric_type_p (type0) && numeric_type_p (type1)));
+
+ case BINOP_REM:
+ case BINOP_MOD:
+ case BINOP_BITWISE_AND:
+ case BINOP_BITWISE_IOR:
+ case BINOP_BITWISE_XOR:
+ return (! (integer_type_p (type0) && integer_type_p (type1)));
+
+ case BINOP_EQUAL:
+ case BINOP_NOTEQUAL:
+ case BINOP_LESS:
+ case BINOP_GTR:
+ case BINOP_LEQ:
+ case BINOP_GEQ:
+ return (! (scalar_type_p (type0) && scalar_type_p (type1)));
+
+ case BINOP_CONCAT:
+ return ((TYPE_CODE (type0) != TYPE_CODE_ARRAY &&
+ (TYPE_CODE (type0) != TYPE_CODE_PTR ||
+ TYPE_CODE (TYPE_TARGET_TYPE (type0))
+ != TYPE_CODE_ARRAY))
+ || (TYPE_CODE (type1) != TYPE_CODE_ARRAY &&
+ (TYPE_CODE (type1) != TYPE_CODE_PTR ||
+ TYPE_CODE (TYPE_TARGET_TYPE (type1))
+ != TYPE_CODE_ARRAY)));
+
+ case BINOP_EXP:
+ return (! (numeric_type_p (type0) && integer_type_p (type1)));
+
+ case UNOP_NEG:
+ case UNOP_PLUS:
+ case UNOP_LOGICAL_NOT:
+ case UNOP_ABS:
+ return (! numeric_type_p (type0));
+
+ }
+}
+
+ /* Renaming */
+
+/** NOTE: In the following, we assume that a renaming type's name may
+ * have an ___XD suffix. It would be nice if this went away at some
+ * point. */
+
+/* If TYPE encodes a renaming, returns the renaming suffix, which
+ * is XR for an object renaming, XRP for a procedure renaming, XRE for
+ * an exception renaming, and XRS for a subprogram renaming. Returns
+ * NULL if NAME encodes none of these. */
+const char*
+ada_renaming_type (type)
+ struct type* type;
+{
+ if (type != NULL && TYPE_CODE (type) == TYPE_CODE_ENUM)
+ {
+ const char* name = type_name_no_tag (type);
+ const char* suffix = (name == NULL) ? NULL : strstr (name, "___XR");
+ if (suffix == NULL
+ || (suffix[5] != '\000' && strchr ("PES_", suffix[5]) == NULL))
+ return NULL;
+ else
+ return suffix + 3;
+ }
+ else
+ return NULL;
+}
+
+/* Return non-zero iff SYM encodes an object renaming. */
+int
+ada_is_object_renaming (sym)
+ struct symbol* sym;
+{
+ const char* renaming_type = ada_renaming_type (SYMBOL_TYPE (sym));
+ return renaming_type != NULL
+ && (renaming_type[2] == '\0' || renaming_type[2] == '_');
+}
+
+/* Assuming that SYM encodes a non-object renaming, returns the original
+ * name of the renamed entity. The name is good until the end of
+ * parsing. */
+const char*
+ada_simple_renamed_entity (sym)
+ struct symbol* sym;
+{
+ struct type* type;
+ const char* raw_name;
+ int len;
+ char* result;
+
+ type = SYMBOL_TYPE (sym);
+ if (type == NULL || TYPE_NFIELDS (type) < 1)
+ error ("Improperly encoded renaming.");
+
+ raw_name = TYPE_FIELD_NAME (type, 0);
+ len = (raw_name == NULL ? 0 : strlen (raw_name)) - 5;
+ if (len <= 0)
+ error ("Improperly encoded renaming.");
+
+ result = xmalloc (len + 1);
+ /* FIXME: add_name_string_cleanup should be defined in parse.c */
+ /* add_name_string_cleanup (result);*/
+ strncpy (result, raw_name, len);
+ result[len] = '\000';
+ return result;
+}
+
+
+ /* Evaluation: Function Calls */
+
+/* Copy VAL onto the stack, using and updating *SP as the stack
+ pointer. Return VAL as an lvalue. */
+
+static struct value*
+place_on_stack (val, sp)
+ struct value* val;
+ CORE_ADDR* sp;
+{
+ CORE_ADDR old_sp = *sp;
+
+#ifdef STACK_ALIGN
+ *sp = push_bytes (*sp, VALUE_CONTENTS_RAW (val),
+ STACK_ALIGN (TYPE_LENGTH (check_typedef (VALUE_TYPE (val)))));
+#else
+ *sp = push_bytes (*sp, VALUE_CONTENTS_RAW (val),
+ TYPE_LENGTH (check_typedef (VALUE_TYPE (val))));
+#endif
+
+ VALUE_LVAL (val) = lval_memory;
+ if (INNER_THAN (1, 2))
+ VALUE_ADDRESS (val) = *sp;
+ else
+ VALUE_ADDRESS (val) = old_sp;
+
+ return val;
+}
+
+/* Return the value ACTUAL, converted to be an appropriate value for a
+ formal of type FORMAL_TYPE. Use *SP as a stack pointer for
+ allocating any necessary descriptors (fat pointers), or copies of
+ values not residing in memory, updating it as needed. */
+
+static struct value*
+convert_actual (actual, formal_type0, sp)
+ struct value* actual;
+ struct type* formal_type0;
+ CORE_ADDR* sp;
+{
+ struct type* actual_type = check_typedef (VALUE_TYPE (actual));
+ struct type* formal_type = check_typedef (formal_type0);
+ struct type* formal_target =
+ TYPE_CODE (formal_type) == TYPE_CODE_PTR
+ ? check_typedef (TYPE_TARGET_TYPE (formal_type)) : formal_type;
+ struct type* actual_target =
+ TYPE_CODE (actual_type) == TYPE_CODE_PTR
+ ? check_typedef (TYPE_TARGET_TYPE (actual_type)) : actual_type;
+
+ if (ada_is_array_descriptor (formal_target)
+ && TYPE_CODE (actual_target) == TYPE_CODE_ARRAY)
+ return make_array_descriptor (formal_type, actual, sp);
+ else if (TYPE_CODE (formal_type) == TYPE_CODE_PTR)
+ {
+ if (TYPE_CODE (formal_target) == TYPE_CODE_ARRAY
+ && ada_is_array_descriptor (actual_target))
+ return desc_data (actual);
+ else if (TYPE_CODE (actual_type) != TYPE_CODE_PTR)
+ {
+ if (VALUE_LVAL (actual) != lval_memory)
+ {
+ struct value* val;
+ actual_type = check_typedef (VALUE_TYPE (actual));
+ val = allocate_value (actual_type);
+ memcpy ((char*) VALUE_CONTENTS_RAW (val),
+ (char*) VALUE_CONTENTS (actual),
+ TYPE_LENGTH (actual_type));
+ actual = place_on_stack (val, sp);
+ }
+ return value_addr (actual);
+ }
+ }
+ else if (TYPE_CODE (actual_type) == TYPE_CODE_PTR)
+ return ada_value_ind (actual);
+
+ return actual;
+}
+
+
+/* Push a descriptor of type TYPE for array value ARR on the stack at
+ *SP, updating *SP to reflect the new descriptor. Return either
+ an lvalue representing the new descriptor, or (if TYPE is a pointer-
+ to-descriptor type rather than a descriptor type), a struct value*
+ representing a pointer to this descriptor. */
+
+static struct value*
+make_array_descriptor (type, arr, sp)
+ struct type* type;
+ struct value* arr;
+ CORE_ADDR* sp;
+{
+ struct type* bounds_type = desc_bounds_type (type);
+ struct type* desc_type = desc_base_type (type);
+ struct value* descriptor = allocate_value (desc_type);
+ struct value* bounds = allocate_value (bounds_type);
+ CORE_ADDR bounds_addr;
+ int i;
+
+ for (i = ada_array_arity (check_typedef (VALUE_TYPE (arr))); i > 0; i -= 1)
+ {
+ modify_general_field (VALUE_CONTENTS (bounds),
+ value_as_long (ada_array_bound (arr, i, 0)),
+ desc_bound_bitpos (bounds_type, i, 0),
+ desc_bound_bitsize (bounds_type, i, 0));
+ modify_general_field (VALUE_CONTENTS (bounds),
+ value_as_long (ada_array_bound (arr, i, 1)),
+ desc_bound_bitpos (bounds_type, i, 1),
+ desc_bound_bitsize (bounds_type, i, 1));
+ }
+
+ bounds = place_on_stack (bounds, sp);
+
+ modify_general_field (VALUE_CONTENTS (descriptor),
+ arr,
+ fat_pntr_data_bitpos (desc_type),
+ fat_pntr_data_bitsize (desc_type));
+ modify_general_field (VALUE_CONTENTS (descriptor),
+ VALUE_ADDRESS (bounds),
+ fat_pntr_bounds_bitpos (desc_type),
+ fat_pntr_bounds_bitsize (desc_type));
+
+ descriptor = place_on_stack (descriptor, sp);
+
+ if (TYPE_CODE (type) == TYPE_CODE_PTR)
+ return value_addr (descriptor);
+ else
+ return descriptor;
+}
+
+
+/* Assuming a dummy frame has been established on the target, perform any
+ conversions needed for calling function FUNC on the NARGS actual
+ parameters in ARGS, other than standard C conversions. Does
+ nothing if FUNC does not have Ada-style prototype data, or if NARGS
+ does not match the number of arguments expected. Use *SP as a
+ stack pointer for additional data that must be pushed, updating its
+ value as needed. */
+
+void
+ada_convert_actuals (func, nargs, args, sp)
+ struct value* func;
+ int nargs;
+ struct value* args[];
+ CORE_ADDR* sp;
+{
+ int i;
+
+ if (TYPE_NFIELDS (VALUE_TYPE (func)) == 0
+ || nargs != TYPE_NFIELDS (VALUE_TYPE (func)))
+ return;
+
+ for (i = 0; i < nargs; i += 1)
+ args[i] =
+ convert_actual (args[i],
+ TYPE_FIELD_TYPE (VALUE_TYPE (func), i),
+ sp);
+}
+
+
+ /* Symbol Lookup */
+
+
+/* The vectors of symbols and blocks ultimately returned from */
+/* ada_lookup_symbol_list. */
+
+/* Current size of defn_symbols and defn_blocks */
+static size_t defn_vector_size = 0;
+
+/* Current number of symbols found. */
+static int ndefns = 0;
+
+static struct symbol** defn_symbols = NULL;
+static struct block** defn_blocks = NULL;
+
+/* Return the result of a standard (literal, C-like) lookup of NAME in
+ * given NAMESPACE. */
+
+static struct symbol*
+standard_lookup (name, namespace)
+ const char* name;
+ namespace_enum namespace;
+{
+ struct symbol* sym;
+ struct symtab* symtab;
+ sym = lookup_symbol (name, (struct block*) NULL, namespace, 0, &symtab);
+ return sym;
+}
+
+
+/* Non-zero iff there is at least one non-function/non-enumeral symbol */
+/* in SYMS[0..N-1]. We treat enumerals as functions, since they */
+/* contend in overloading in the same way. */
+static int
+is_nonfunction (syms, n)
+ struct symbol* syms[];
+ int n;
+{
+ int i;
+
+ for (i = 0; i < n; i += 1)
+ if (TYPE_CODE (SYMBOL_TYPE (syms[i])) != TYPE_CODE_FUNC
+ && TYPE_CODE (SYMBOL_TYPE (syms[i])) != TYPE_CODE_ENUM)
+ return 1;
+
+ return 0;
+}
+
+/* If true (non-zero), then TYPE0 and TYPE1 represent equivalent
+ struct types. Otherwise, they may not. */
+
+static int
+equiv_types (type0, type1)
+ struct type* type0;
+ struct type* type1;
+{
+ if (type0 == type1)
+ return 1;
+ if (type0 == NULL || type1 == NULL
+ || TYPE_CODE (type0) != TYPE_CODE (type1))
+ return 0;
+ 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)))
+ return 1;
+
+ return 0;
+}
+
+/* True iff SYM0 represents the same entity as SYM1, or one that is
+ no more defined than that of SYM1. */
+
+static int
+lesseq_defined_than (sym0, sym1)
+ struct symbol* sym0;
+ struct symbol* sym1;
+{
+ if (sym0 == sym1)
+ return 1;
+ if (SYMBOL_NAMESPACE (sym0) != SYMBOL_NAMESPACE (sym1)
+ || SYMBOL_CLASS (sym0) != SYMBOL_CLASS (sym1))
+ return 0;
+
+ switch (SYMBOL_CLASS (sym0))
+ {
+ case LOC_UNDEF:
+ return 1;
+ case LOC_TYPEDEF:
+ {
+ struct type* type0 = SYMBOL_TYPE (sym0);
+ struct type* type1 = SYMBOL_TYPE (sym1);
+ char* name0 = SYMBOL_NAME (sym0);
+ char* name1 = SYMBOL_NAME (sym1);
+ int len0 = strlen (name0);
+ return
+ TYPE_CODE (type0) == TYPE_CODE (type1)
+ && (equiv_types (type0, type1)
+ || (len0 < strlen (name1) && STREQN (name0, name1, len0)
+ && STREQN (name1 + len0, "___XV", 5)));
+ }
+ case LOC_CONST:
+ return SYMBOL_VALUE (sym0) == SYMBOL_VALUE (sym1)
+ && equiv_types (SYMBOL_TYPE (sym0), SYMBOL_TYPE (sym1));
+ default:
+ return 0;
+ }
+}
+
+/* Append SYM to the end of defn_symbols, and BLOCK to the end of
+ defn_blocks, updating ndefns, and expanding defn_symbols and
+ defn_blocks as needed. Do not include SYM if it is a duplicate. */
+
+static void
+add_defn_to_vec (sym, block)
+ struct symbol* sym;
+ struct block* block;
+{
+ int i;
+ size_t tmp;
+
+ if (SYMBOL_TYPE (sym) != NULL)
+ CHECK_TYPEDEF (SYMBOL_TYPE (sym));
+ for (i = 0; i < ndefns; i += 1)
+ {
+ if (lesseq_defined_than (sym, defn_symbols[i]))
+ return;
+ else if (lesseq_defined_than (defn_symbols[i], sym))
+ {
+ defn_symbols[i] = sym;
+ defn_blocks[i] = block;
+ return;
+ }
+ }
+
+ tmp = defn_vector_size;
+ GROW_VECT (defn_symbols, tmp, ndefns+2);
+ GROW_VECT (defn_blocks, defn_vector_size, ndefns+2);
+
+ defn_symbols[ndefns] = sym;
+ defn_blocks[ndefns] = block;
+ ndefns += 1;
+}
+
+/* Look, in partial_symtab PST, for symbol NAME in given namespace.
+ Check the global symbols if GLOBAL, the static symbols if not. Do
+ wild-card match if WILD. */
+
+static struct partial_symbol *
+ada_lookup_partial_symbol (pst, name, global, namespace, wild)
+ struct partial_symtab *pst;
+ const char *name;
+ int global;
+ namespace_enum namespace;
+ int wild;
+{
+ struct partial_symbol **start;
+ int name_len = strlen (name);
+ int length = (global ? pst->n_global_syms : pst->n_static_syms);
+ int i;
+
+ if (length == 0)
+ {
+ return (NULL);
+ }
+
+ start = (global ?
+ pst->objfile->global_psymbols.list + pst->globals_offset :
+ pst->objfile->static_psymbols.list + pst->statics_offset );
+
+ if (wild)
+ {
+ for (i = 0; i < length; i += 1)
+ {
+ struct partial_symbol* psym = start[i];
+
+ if (SYMBOL_NAMESPACE (psym) == namespace &&
+ wild_match (name, name_len, SYMBOL_NAME (psym)))
+ return psym;
+ }
+ return NULL;
+ }
+ else
+ {
+ if (global)
+ {
+ int U;
+ i = 0; U = length-1;
+ while (U - i > 4)
+ {
+ int M = (U+i) >> 1;
+ struct partial_symbol* psym = start[M];
+ if (SYMBOL_NAME (psym)[0] < name[0])
+ i = M+1;
+ else if (SYMBOL_NAME (psym)[0] > name[0])
+ U = M-1;
+ else if (strcmp (SYMBOL_NAME (psym), name) < 0)
+ i = M+1;
+ else
+ U = M;
+ }
+ }
+ else
+ i = 0;
+
+ while (i < length)
+ {
+ struct partial_symbol *psym = start[i];
+
+ if (SYMBOL_NAMESPACE (psym) == namespace)
+ {
+ int cmp = strncmp (name, SYMBOL_NAME (psym), name_len);
+
+ if (cmp < 0)
+ {
+ if (global)
+ break;
+ }
+ else if (cmp == 0
+ && is_name_suffix (SYMBOL_NAME (psym) + name_len))
+ return psym;
+ }
+ i += 1;
+ }
+
+ if (global)
+ {
+ int U;
+ i = 0; U = length-1;
+ while (U - i > 4)
+ {
+ int M = (U+i) >> 1;
+ struct partial_symbol *psym = start[M];
+ if (SYMBOL_NAME (psym)[0] < '_')
+ i = M+1;
+ else if (SYMBOL_NAME (psym)[0] > '_')
+ U = M-1;
+ else if (strcmp (SYMBOL_NAME (psym), "_ada_") < 0)
+ i = M+1;
+ else
+ U = M;
+ }
+ }
+ else
+ i = 0;
+
+ while (i < length)
+ {
+ struct partial_symbol* psym = start[i];
+
+ if (SYMBOL_NAMESPACE (psym) == namespace)
+ {
+ int cmp;
+
+ cmp = (int) '_' - (int) SYMBOL_NAME (psym)[0];
+ if (cmp == 0)
+ {
+ cmp = strncmp ("_ada_", SYMBOL_NAME (psym), 5);
+ if (cmp == 0)
+ cmp = strncmp (name, SYMBOL_NAME (psym) + 5, name_len);
+ }
+
+ if (cmp < 0)
+ {
+ if (global)
+ break;
+ }
+ else if (cmp == 0
+ && is_name_suffix (SYMBOL_NAME (psym) + name_len + 5))
+ return psym;
+ }
+ i += 1;
+ }
+
+ }
+ return NULL;
+}
+
+
+/* Find a symbol table containing symbol SYM or NULL if none. */
+static struct symtab*
+symtab_for_sym (sym)
+ struct symbol* sym;
+{
+ struct symtab* s;
+ struct objfile *objfile;
+ struct block *b;
+ int i, j;
+
+ ALL_SYMTABS (objfile, s)
+ {
+ switch (SYMBOL_CLASS (sym))
+ {
+ case LOC_CONST:
+ case LOC_STATIC:
+ case LOC_TYPEDEF:
+ case LOC_REGISTER:
+ case LOC_LABEL:
+ case LOC_BLOCK:
+ case LOC_CONST_BYTES:
+ b = BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), GLOBAL_BLOCK);
+ for (i = 0; i < BLOCK_NSYMS (b); i += 1)
+ if (sym == BLOCK_SYM (b, i))
+ return s;
+ b = BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), STATIC_BLOCK);
+ for (i = 0; i < BLOCK_NSYMS (b); i += 1)
+ if (sym == BLOCK_SYM (b, i))
+ return s;
+ break;
+ default:
+ break;
+ }
+ switch (SYMBOL_CLASS (sym))
+ {
+ case LOC_REGISTER:
+ case LOC_ARG:
+ case LOC_REF_ARG:
+ case LOC_REGPARM:
+ case LOC_REGPARM_ADDR:
+ case LOC_LOCAL:
+ case LOC_TYPEDEF:
+ case LOC_LOCAL_ARG:
+ case LOC_BASEREG:
+ case LOC_BASEREG_ARG:
+ for (j = FIRST_LOCAL_BLOCK;
+ j < BLOCKVECTOR_NBLOCKS (BLOCKVECTOR (s)); j += 1)
+ {
+ b = BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), j);
+ for (i = 0; i < BLOCK_NSYMS (b); i += 1)
+ if (sym == BLOCK_SYM (b, i))
+ return s;
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ return NULL;
+}
+
+/* Return a minimal symbol matching NAME according to Ada demangling
+ rules. Returns NULL if there is no such minimal symbol. */
+
+struct minimal_symbol*
+ada_lookup_minimal_symbol (name)
+ const char* name;
+{
+ struct objfile* objfile;
+ struct minimal_symbol* msymbol;
+ int wild_match = (strstr (name, "__") == NULL);
+
+ ALL_MSYMBOLS (objfile, msymbol)
+ {
+ if (ada_match_name (SYMBOL_NAME (msymbol), name, wild_match)
+ && MSYMBOL_TYPE (msymbol) != mst_solib_trampoline)
+ return msymbol;
+ }
+
+ return NULL;
+}
+
+/* For all subprograms that statically enclose the subprogram of the
+ * selected frame, add symbols matching identifier NAME in NAMESPACE
+ * and their blocks to vectors *defn_symbols and *defn_blocks, as for
+ * ada_add_block_symbols (q.v.). If WILD, treat as NAME with a
+ * wildcard prefix. At the moment, this function uses a heuristic to
+ * find the frames of enclosing subprograms: it treats the
+ * pointer-sized value at location 0 from the local-variable base of a
+ * frame as a static link, and then searches up the call stack for a
+ * frame with that same local-variable base. */
+static void
+add_symbols_from_enclosing_procs (name, namespace, wild_match)
+ const char* name;
+ namespace_enum namespace;
+ int wild_match;
+{
+#ifdef i386
+ static struct symbol static_link_sym;
+ static struct symbol *static_link;
+
+ struct cleanup* old_chain = make_cleanup (null_cleanup, NULL);
+ struct frame_info* frame;
+ struct frame_info* target_frame;
+
+ if (static_link == NULL)
+ {
+ /* Initialize the local variable symbol that stands for the
+ * static link (when it exists). */
+ static_link = &static_link_sym;
+ SYMBOL_NAME (static_link) = "";
+ SYMBOL_LANGUAGE (static_link) = language_unknown;
+ SYMBOL_CLASS (static_link) = LOC_LOCAL;
+ SYMBOL_NAMESPACE (static_link) = VAR_NAMESPACE;
+ SYMBOL_TYPE (static_link) = lookup_pointer_type (builtin_type_void);
+ SYMBOL_VALUE (static_link) =
+ - (long) TYPE_LENGTH (SYMBOL_TYPE (static_link));
+ }
+
+ frame = selected_frame;
+ while (frame != NULL && ndefns == 0)
+ {
+ struct block* block;
+ struct value* target_link_val = read_var_value (static_link, frame);
+ CORE_ADDR target_link;
+
+ if (target_link_val == NULL)
+ break;
+ QUIT;
+
+ target_link = target_link_val;
+ do {
+ QUIT;
+ frame = get_prev_frame (frame);
+ } while (frame != NULL && FRAME_LOCALS_ADDRESS (frame) != target_link);
+
+ if (frame == NULL)
+ break;
+
+ block = get_frame_block (frame, 0);
+ while (block != NULL && block_function (block) != NULL && ndefns == 0)
+ {
+ ada_add_block_symbols (block, name, namespace, NULL, wild_match);
+
+ block = BLOCK_SUPERBLOCK (block);
+ }
+ }
+
+ do_cleanups (old_chain);
+#endif
+}
+
+/* True if TYPE is definitely an artificial type supplied to a symbol
+ * for which no debugging information was given in the symbol file. */
+static int
+is_nondebugging_type (type)
+ struct type* type;
+{
+ char* name = ada_type_name (type);
+ return (name != NULL && STREQ (name, "<variable, no debug info>"));
+}
+
+/* Remove any non-debugging symbols in SYMS[0 .. NSYMS-1] that definitely
+ * duplicate other symbols in the list. (The only case I know of where
+ * this happens is when object files containing stabs-in-ecoff are
+ * linked with files containing ordinary ecoff debugging symbols (or no
+ * debugging symbols)). Modifies SYMS to squeeze out deleted symbols,
+ * and applies the same modification to BLOCKS to maintain the
+ * correspondence between SYMS[i] and BLOCKS[i]. Returns the number
+ * of symbols in the modified list. */
+static int
+remove_extra_symbols (syms, blocks, nsyms)
+ struct symbol** syms;
+ struct block** blocks;
+ int nsyms;
+{
+ int i, j;
+
+ i = 0;
+ while (i < nsyms)
+ {
+ if (SYMBOL_NAME (syms[i]) != NULL && SYMBOL_CLASS (syms[i]) == LOC_STATIC
+ && is_nondebugging_type (SYMBOL_TYPE (syms[i])))
+ {
+ for (j = 0; j < nsyms; j += 1)
+ {
+ if (i != j
+ && SYMBOL_NAME (syms[j]) != NULL
+ && STREQ (SYMBOL_NAME (syms[i]), SYMBOL_NAME (syms[j]))
+ && SYMBOL_CLASS (syms[i]) == SYMBOL_CLASS (syms[j])
+ && SYMBOL_VALUE_ADDRESS (syms[i])
+ == SYMBOL_VALUE_ADDRESS (syms[j]))
+ {
+ int k;
+ for (k = i+1; k < nsyms; k += 1)
+ {
+ syms[k-1] = syms[k];
+ blocks[k-1] = blocks[k];
+ }
+ nsyms -= 1;
+ goto NextSymbol;
+ }
+ }
+ }
+ i += 1;
+ NextSymbol:
+ ;
+ }
+ return nsyms;
+}
+
+/* Find symbols in NAMESPACE matching NAME, in BLOCK0 and enclosing
+ scope and in global scopes, returning the number of matches. Sets
+ *SYMS to point to a vector of matching symbols, with *BLOCKS
+ pointing to the vector of corresponding blocks in which those
+ symbols reside. These two vectors are transient---good only to the
+ next call of ada_lookup_symbol_list. Any non-function/non-enumeral symbol
+ match within the nest of blocks whose innermost member is BLOCK0,
+ is the outermost match returned (no other matches in that or
+ enclosing blocks is returned). If there are any matches in or
+ surrounding BLOCK0, then these alone are returned. */
+
+int
+ada_lookup_symbol_list (name, block0, namespace, syms, blocks)
+ const char *name;
+ struct block *block0;
+ namespace_enum namespace;
+ struct symbol*** syms;
+ struct block*** blocks;
+{
+ struct symbol *sym;
+ struct symtab *s;
+ struct partial_symtab *ps;
+ struct blockvector *bv;
+ struct objfile *objfile;
+ struct block *b;
+ struct block *block;
+ struct minimal_symbol *msymbol;
+ int wild_match = (strstr (name, "__") == NULL);
+ int cacheIfUnique;
+
+#ifdef TIMING
+ markTimeStart (0);
+#endif
+
+ ndefns = 0;
+ cacheIfUnique = 0;
+
+ /* Search specified block and its superiors. */
+
+ block = block0;
+ while (block != NULL)
+ {
+ ada_add_block_symbols (block, name, namespace, NULL, wild_match);
+
+ /* If we found a non-function match, assume that's the one. */
+ if (is_nonfunction (defn_symbols, ndefns))
+ goto done;
+
+ block = BLOCK_SUPERBLOCK (block);
+ }
+
+ /* If we found ANY matches in the specified BLOCK, we're done. */
+
+ if (ndefns > 0)
+ goto done;
+
+ cacheIfUnique = 1;
+
+ /* Now add symbols from all global blocks: symbol tables, minimal symbol
+ tables, and psymtab's */
+
+ ALL_SYMTABS (objfile, s)
+ {
+ QUIT;
+ if (! s->primary)
+ continue;
+ bv = BLOCKVECTOR (s);
+ block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
+ ada_add_block_symbols (block, name, namespace, objfile, wild_match);
+ }
+
+ if (namespace == VAR_NAMESPACE)
+ {
+ ALL_MSYMBOLS (objfile, msymbol)
+ {
+ if (ada_match_name (SYMBOL_NAME (msymbol), name, wild_match))
+ {
+ switch (MSYMBOL_TYPE (msymbol))
+ {
+ case mst_solib_trampoline:
+ break;
+ default:
+ s = find_pc_symtab (SYMBOL_VALUE_ADDRESS (msymbol));
+ if (s != NULL)
+ {
+ int old_ndefns = ndefns;
+ QUIT;
+ bv = BLOCKVECTOR (s);
+ block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
+ ada_add_block_symbols (block,
+ SYMBOL_NAME (msymbol),
+ namespace, objfile, wild_match);
+ if (ndefns == old_ndefns)
+ {
+ block = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
+ ada_add_block_symbols (block,
+ SYMBOL_NAME (msymbol),
+ namespace, objfile,
+ wild_match);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ ALL_PSYMTABS (objfile, ps)
+ {
+ QUIT;
+ if (!ps->readin
+ && ada_lookup_partial_symbol (ps, name, 1, namespace, wild_match))
+ {
+ s = PSYMTAB_TO_SYMTAB (ps);
+ if (! s->primary)
+ continue;
+ bv = BLOCKVECTOR (s);
+ block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
+ ada_add_block_symbols (block, name, namespace, objfile, wild_match);
+ }
+ }
+
+ /* Now add symbols from all per-file blocks if we've gotten no hits.
+ (Not strictly correct, but perhaps better than an error).
+ Do the symtabs first, then check the psymtabs */
+
+ if (ndefns == 0)
+ {
+
+ ALL_SYMTABS (objfile, s)
+ {
+ QUIT;
+ if (! s->primary)
+ continue;
+ bv = BLOCKVECTOR (s);
+ block = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
+ ada_add_block_symbols (block, name, namespace, objfile, wild_match);
+ }
+
+ ALL_PSYMTABS (objfile, ps)
+ {
+ QUIT;
+ if (!ps->readin
+ && ada_lookup_partial_symbol (ps, name, 0, namespace, wild_match))
+ {
+ s = PSYMTAB_TO_SYMTAB(ps);
+ bv = BLOCKVECTOR (s);
+ if (! s->primary)
+ continue;
+ block = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
+ ada_add_block_symbols (block, name, namespace,
+ objfile, wild_match);
+ }
+ }
+ }
+
+ /* Finally, we try to find NAME as a local symbol in some lexically
+ enclosing block. We do this last, expecting this case to be
+ rare. */
+ if (ndefns == 0)
+ {
+ add_symbols_from_enclosing_procs (name, namespace, wild_match);
+ if (ndefns > 0)
+ goto done;
+ }
+
+ done:
+ ndefns = remove_extra_symbols (defn_symbols, defn_blocks, ndefns);
+
+
+ *syms = defn_symbols;
+ *blocks = defn_blocks;
+#ifdef TIMING
+ markTimeStop (0);
+#endif
+ return ndefns;
+}
+
+/* Return a symbol in NAMESPACE matching NAME, in BLOCK0 and enclosing
+ * scope and in global scopes, or NULL if none. NAME is folded to
+ * lower case first, unless it is surrounded in single quotes.
+ * Otherwise, the result is as for ada_lookup_symbol_list, but is
+ * disambiguated by user query if needed. */
+
+struct symbol*
+ada_lookup_symbol (name, block0, namespace)
+ const char *name;
+ struct block *block0;
+ namespace_enum namespace;
+{
+ struct symbol** candidate_syms;
+ struct block** candidate_blocks;
+ int n_candidates;
+
+ n_candidates = ada_lookup_symbol_list (name,
+ block0, namespace,
+ &candidate_syms, &candidate_blocks);
+
+ if (n_candidates == 0)
+ return NULL;
+ else if (n_candidates != 1)
+ user_select_syms (candidate_syms, candidate_blocks, n_candidates, 1);
+
+ return candidate_syms[0];
+}
+
+
+/* True iff STR is a possible encoded suffix of a normal Ada name
+ * that is to be ignored for matching purposes. Suffixes of parallel
+ * names (e.g., XVE) are not included here. Currently, the possible suffixes
+ * are given by the regular expression:
+ * (X[nb]*)?(__[0-9]+|\$[0-9]+|___(LJM|X([FDBUP].*|R[^T]?)))?$
+ *
+ */
+static int
+is_name_suffix (str)
+ const char* str;
+{
+ int k;
+ if (str[0] == 'X')
+ {
+ str += 1;
+ while (str[0] != '_' && str[0] != '\0')
+ {
+ if (str[0] != 'n' && str[0] != 'b')
+ return 0;
+ str += 1;
+ }
+ }
+ if (str[0] == '\000')
+ return 1;
+ if (str[0] == '_')
+ {
+ if (str[1] != '_' || str[2] == '\000')
+ return 0;
+ if (str[2] == '_')
+ {
+ if (STREQ (str+3, "LJM"))
+ return 1;
+ if (str[3] != 'X')
+ return 0;
+ if (str[4] == 'F' || str[4] == 'D' || str[4] == 'B' ||
+ str[4] == 'U' || str[4] == 'P')
+ return 1;
+ if (str[4] == 'R' && str[5] != 'T')
+ return 1;
+ return 0;
+ }
+ for (k = 2; str[k] != '\0'; k += 1)
+ if (!isdigit (str[k]))
+ return 0;
+ return 1;
+ }
+ if (str[0] == '$' && str[1] != '\000')
+ {
+ for (k = 1; str[k] != '\0'; k += 1)
+ if (!isdigit (str[k]))
+ return 0;
+ return 1;
+ }
+ return 0;
+}
+
+/* True if NAME represents a name of the form A1.A2....An, n>=1 and
+ * PATN[0..PATN_LEN-1] = Ak.Ak+1.....An for some k >= 1. Ignores
+ * informational suffixes of NAME (i.e., for which is_name_suffix is
+ * true). */
+static int
+wild_match (patn, patn_len, name)
+ const char* patn;
+ int patn_len;
+ const char* name;
+{
+ int name_len;
+ int s, e;
+
+ name_len = strlen (name);
+ if (name_len >= patn_len+5 && STREQN (name, "_ada_", 5)
+ && 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))
+ return 1;
+ do {
+ name += 1; name_len -= 1;
+ } while (name_len > 0
+ && name[0] != '.' && (name[0] != '_' || name[1] != '_'));
+ if (name_len <= 0)
+ return 0;
+ if (name[0] == '_')
+ {
+ if (! islower (name[2]))
+ return 0;
+ name += 2; name_len -= 2;
+ }
+ else
+ {
+ if (! islower (name[1]))
+ return 0;
+ name += 1; name_len -= 1;
+ }
+ }
+
+ return 0;
+}
+
+
+/* Add symbols from BLOCK matching identifier NAME in NAMESPACE to
+ vector *defn_symbols, updating *defn_symbols (if necessary), *SZ (the size of
+ the vector *defn_symbols), and *ndefns (the number of symbols
+ currently stored in *defn_symbols). If WILD, treat as NAME with a
+ wildcard prefix. OBJFILE is the section containing BLOCK. */
+
+static void
+ada_add_block_symbols (block, name, namespace, objfile, wild)
+ struct block* block;
+ const char* name;
+ namespace_enum namespace;
+ struct objfile* objfile;
+ int wild;
+{
+ int i;
+ int name_len = strlen (name);
+ /* A matching argument symbol, if any. */
+ struct symbol *arg_sym;
+ /* Set true when we find a matching non-argument symbol */
+ int found_sym;
+ int is_sorted = BLOCK_SHOULD_SORT (block);
+
+ arg_sym = NULL; found_sym = 0;
+ if (wild)
+ {
+ for (i = 0; i < BLOCK_NSYMS (block); i += 1)
+ {
+ struct symbol *sym = BLOCK_SYM (block, i);
+
+ if (SYMBOL_NAMESPACE (sym) == namespace &&
+ wild_match (name, name_len, SYMBOL_NAME (sym)))
+ {
+ switch (SYMBOL_CLASS (sym))
+ {
+ case LOC_ARG:
+ case LOC_LOCAL_ARG:
+ case LOC_REF_ARG:
+ case LOC_REGPARM:
+ case LOC_REGPARM_ADDR:
+ case LOC_BASEREG_ARG:
+ arg_sym = sym;
+ break;
+ case LOC_UNRESOLVED:
+ continue;
+ default:
+ found_sym = 1;
+ fill_in_ada_prototype (sym);
+ add_defn_to_vec (fixup_symbol_section (sym, objfile), block);
+ break;
+ }
+ }
+ }
+ }
+ else
+ {
+ if (is_sorted)
+ {
+ int U;
+ i = 0; U = BLOCK_NSYMS (block)-1;
+ while (U - i > 4)
+ {
+ int M = (U+i) >> 1;
+ struct symbol *sym = BLOCK_SYM (block, M);
+ if (SYMBOL_NAME (sym)[0] < name[0])
+ i = M+1;
+ else if (SYMBOL_NAME (sym)[0] > name[0])
+ U = M-1;
+ else if (strcmp (SYMBOL_NAME (sym), name) < 0)
+ i = M+1;
+ else
+ U = M;
+ }
+ }
+ else
+ i = 0;
+
+ for (; i < BLOCK_NSYMS (block); i += 1)
+ {
+ struct symbol *sym = BLOCK_SYM (block, i);
+
+ if (SYMBOL_NAMESPACE (sym) == namespace)
+ {
+ int cmp = strncmp (name, SYMBOL_NAME (sym), name_len);
+
+ if (cmp < 0)
+ {
+ if (is_sorted)
+ break;
+ }
+ else if (cmp == 0
+ && is_name_suffix (SYMBOL_NAME (sym) + name_len))
+ {
+ switch (SYMBOL_CLASS (sym))
+ {
+ case LOC_ARG:
+ case LOC_LOCAL_ARG:
+ case LOC_REF_ARG:
+ case LOC_REGPARM:
+ case LOC_REGPARM_ADDR:
+ case LOC_BASEREG_ARG:
+ arg_sym = sym;
+ break;
+ case LOC_UNRESOLVED:
+ break;
+ default:
+ found_sym = 1;
+ fill_in_ada_prototype (sym);
+ add_defn_to_vec (fixup_symbol_section (sym, objfile),
+ block);
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ if (! found_sym && arg_sym != NULL)
+ {
+ fill_in_ada_prototype (arg_sym);
+ add_defn_to_vec (fixup_symbol_section (arg_sym, objfile), block);
+ }
+
+ if (! wild)
+ {
+ arg_sym = NULL; found_sym = 0;
+ if (is_sorted)
+ {
+ int U;
+ i = 0; U = BLOCK_NSYMS (block)-1;
+ while (U - i > 4)
+ {
+ int M = (U+i) >> 1;
+ struct symbol *sym = BLOCK_SYM (block, M);
+ if (SYMBOL_NAME (sym)[0] < '_')
+ i = M+1;
+ else if (SYMBOL_NAME (sym)[0] > '_')
+ U = M-1;
+ else if (strcmp (SYMBOL_NAME (sym), "_ada_") < 0)
+ i = M+1;
+ else
+ U = M;
+ }
+ }
+ else
+ i = 0;
+
+ for (; i < BLOCK_NSYMS (block); i += 1)
+ {
+ struct symbol *sym = BLOCK_SYM (block, i);
+
+ if (SYMBOL_NAMESPACE (sym) == namespace)
+ {
+ int cmp;
+
+ cmp = (int) '_' - (int) SYMBOL_NAME (sym)[0];
+ if (cmp == 0)
+ {
+ cmp = strncmp ("_ada_", SYMBOL_NAME (sym), 5);
+ if (cmp == 0)
+ cmp = strncmp (name, SYMBOL_NAME (sym) + 5, name_len);
+ }
+
+ if (cmp < 0)
+ {
+ if (is_sorted)
+ break;
+ }
+ else if (cmp == 0
+ && is_name_suffix (SYMBOL_NAME (sym) + name_len + 5))
+ {
+ switch (SYMBOL_CLASS (sym))
+ {
+ case LOC_ARG:
+ case LOC_LOCAL_ARG:
+ case LOC_REF_ARG:
+ case LOC_REGPARM:
+ case LOC_REGPARM_ADDR:
+ case LOC_BASEREG_ARG:
+ arg_sym = sym;
+ break;
+ case LOC_UNRESOLVED:
+ break;
+ default:
+ found_sym = 1;
+ fill_in_ada_prototype (sym);
+ add_defn_to_vec (fixup_symbol_section (sym, objfile),
+ block);
+ break;
+ }
+ }
+ }
+ }
+
+ /* NOTE: This really shouldn't be needed for _ada_ symbols.
+ They aren't parameters, right? */
+ if (! found_sym && arg_sym != NULL)
+ {
+ fill_in_ada_prototype (arg_sym);
+ add_defn_to_vec (fixup_symbol_section (arg_sym, objfile), block);
+ }
+ }
+}
+
+
+ /* Function Types */
+
+/* Assuming that SYM is the symbol for a function, fill in its type
+ with prototype information, if it is not already there.
+
+ Why is there provision in struct type for BOTH an array of argument
+ types (TYPE_ARG_TYPES) and for an array of typed fields, whose
+ comment suggests it may also represent argument types? I presume
+ this is some attempt to save space. The problem is that argument
+ names in Ada are significant. Therefore, for Ada we use the
+ (apparently older) TYPE_FIELD_* stuff to store argument types. */
+
+
+static void
+fill_in_ada_prototype (func)
+ struct symbol* func;
+{
+ struct block* b;
+ int nargs, nsyms;
+ int i;
+ struct type* ftype;
+ struct type* rtype;
+ size_t max_fields;
+
+ if (func == NULL
+ || TYPE_CODE (SYMBOL_TYPE (func)) != TYPE_CODE_FUNC
+ || TYPE_FIELDS (SYMBOL_TYPE (func)) != NULL)
+ return;
+
+ /* We make each function type unique, so that each may have its own */
+ /* parameter types. This particular way of doing so wastes space: */
+ /* it would be nicer to build the argument types while the original */
+ /* function type is being built (FIXME). */
+ rtype = check_typedef (TYPE_TARGET_TYPE (SYMBOL_TYPE (func)));
+ ftype = alloc_type (TYPE_OBJFILE (SYMBOL_TYPE (func)));
+ make_function_type (rtype, &ftype);
+ SYMBOL_TYPE (func) = ftype;
+
+ b = SYMBOL_BLOCK_VALUE (func);
+ nsyms = BLOCK_NSYMS (b);
+
+ nargs = 0;
+ max_fields = 8;
+ TYPE_FIELDS (ftype) =
+ (struct field*) xmalloc (sizeof (struct field) * max_fields);
+ for (i = 0; i < nsyms; i += 1)
+ {
+ struct symbol *sym = BLOCK_SYM (b, i);
+
+ GROW_VECT (TYPE_FIELDS (ftype), max_fields, nargs+1);
+
+ switch (SYMBOL_CLASS (sym))
+ {
+ case LOC_REF_ARG:
+ case LOC_REGPARM_ADDR:
+ TYPE_FIELD_BITPOS (ftype, nargs) = nargs;
+ TYPE_FIELD_BITSIZE (ftype, nargs) = 0;
+ TYPE_FIELD_TYPE (ftype, nargs) =
+ lookup_pointer_type (check_typedef (SYMBOL_TYPE (sym)));
+ TYPE_FIELD_NAME (ftype, nargs) = SYMBOL_NAME (sym);
+ nargs += 1;
+
+ break;
+
+ case LOC_ARG:
+ case LOC_REGPARM:
+ case LOC_LOCAL_ARG:
+ case LOC_BASEREG_ARG:
+ TYPE_FIELD_BITPOS (ftype, nargs) = nargs;
+ TYPE_FIELD_BITSIZE (ftype, nargs) = 0;
+ TYPE_FIELD_TYPE (ftype, nargs) = check_typedef (SYMBOL_TYPE (sym));
+ TYPE_FIELD_NAME (ftype, nargs) = SYMBOL_NAME (sym);
+ nargs += 1;
+
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ /* Re-allocate fields vector; if there are no fields, make the */
+ /* fields pointer non-null anyway, to mark that this function type */
+ /* has been filled in. */
+
+ TYPE_NFIELDS (ftype) = nargs;
+ if (nargs == 0)
+ {
+ static struct field dummy_field = {0, 0, 0, 0};
+ free (TYPE_FIELDS (ftype));
+ TYPE_FIELDS (ftype) = &dummy_field;
+ }
+ else
+ {
+ struct field* fields =
+ (struct field*) TYPE_ALLOC (ftype, nargs * sizeof (struct field));
+ memcpy ((char*) fields,
+ (char*) TYPE_FIELDS (ftype),
+ nargs * sizeof (struct field));
+ free (TYPE_FIELDS (ftype));
+ TYPE_FIELDS (ftype) = fields;
+ }
+}
+
+
+ /* Breakpoint-related */
+
+char no_symtab_msg[] = "No symbol table is loaded. Use the \"file\" command.";
+
+/* Assuming that LINE is pointing at the beginning of an argument to
+ 'break', return a pointer to the delimiter for the initial segment
+ of that name. This is the first ':', ' ', or end of LINE.
+*/
+char*
+ada_start_decode_line_1 (line)
+ char* line;
+{
+ /* [NOTE: strpbrk would be more elegant, but I am reluctant to be
+ the first to use such a library function in GDB code.] */
+ char* p;
+ for (p = line; *p != '\000' && *p != ' ' && *p != ':'; p += 1)
+ ;
+ return p;
+}
+
+/* *SPEC points to a function and line number spec (as in a break
+ command), following any initial file name specification.
+
+ Return all symbol table/line specfications (sals) consistent with the
+ information in *SPEC and FILE_TABLE in the
+ following sense:
+ + FILE_TABLE is null, or the sal refers to a line in the file
+ named by FILE_TABLE.
+ + If *SPEC points to an argument with a trailing ':LINENUM',
+ then the sal refers to that line (or one following it as closely as
+ possible).
+ + If *SPEC does not start with '*', the sal is in a function with
+ that name.
+
+ Returns with 0 elements if no matching non-minimal symbols found.
+
+ If *SPEC begins with a function name of the form <NAME>, then NAME
+ is taken as a literal name; otherwise the function name is subject
+ to the usual mangling.
+
+ *SPEC is updated to point after the function/line number specification.
+
+ FUNFIRSTLINE is non-zero if we desire the first line of real code
+ in each function (this is ignored in the presence of a LINENUM spec.).
+
+ If CANONICAL is non-NULL, and if any of the sals require a
+ 'canonical line spec', then *CANONICAL is set to point to an array
+ of strings, corresponding to and equal in length to the returned
+ list of sals, such that (*CANONICAL)[i] is non-null and contains a
+ canonical line spec for the ith returned sal, if needed. If no
+ canonical line specs are required and CANONICAL is non-null,
+ *CANONICAL is set to NULL.
+
+ A 'canonical line spec' is simply a name (in the format of the
+ breakpoint command) that uniquely identifies a breakpoint position,
+ with no further contextual information or user selection. It is
+ needed whenever the file name, function name, and line number
+ information supplied is insufficient for this unique
+ identification. Currently overloaded functions, the name '*',
+ or static functions without a filename yield a canonical line spec.
+ The array and the line spec strings are allocated on the heap; it
+ is the caller's responsibility to free them. */
+
+struct symtabs_and_lines
+ada_finish_decode_line_1 (spec, file_table, funfirstline, canonical)
+ char** spec;
+ struct symtab* file_table;
+ int funfirstline;
+ char*** canonical;
+{
+ struct symbol** symbols;
+ struct block** blocks;
+ struct block* block;
+ int n_matches, i, line_num;
+ struct symtabs_and_lines selected;
+ struct cleanup* old_chain = make_cleanup (null_cleanup, NULL);
+ char* name;
+
+ int len;
+ char* lower_name;
+ char* unquoted_name;
+
+ if (file_table == NULL)
+ block = get_selected_block (NULL);
+ else
+ block = BLOCKVECTOR_BLOCK (BLOCKVECTOR (file_table), STATIC_BLOCK);
+
+ if (canonical != NULL)
+ *canonical = (char**) NULL;
+
+ name = *spec;
+ if (**spec == '*')
+ *spec += 1;
+ else
+ {
+ while (**spec != '\000' &&
+ ! strchr (ada_completer_word_break_characters, **spec))
+ *spec += 1;
+ }
+ len = *spec - name;
+
+ line_num = -1;
+ if (file_table != NULL && (*spec)[0] == ':' && isdigit ((*spec)[1]))
+ {
+ line_num = strtol (*spec + 1, spec, 10);
+ while (**spec == ' ' || **spec == '\t')
+ *spec += 1;
+ }
+
+ if (name[0] == '*')
+ {
+ if (line_num == -1)
+ error ("Wild-card function with no line number or file name.");
+
+ return all_sals_for_line (file_table->filename, line_num, canonical);
+ }
+
+ if (name[0] == '\'')
+ {
+ name += 1;
+ len -= 2;
+ }
+
+ if (name[0] == '<')
+ {
+ unquoted_name = (char*) alloca (len-1);
+ memcpy (unquoted_name, name+1, len-2);
+ unquoted_name[len-2] = '\000';
+ lower_name = NULL;
+ }
+ else
+ {
+ unquoted_name = (char*) alloca (len+1);
+ memcpy (unquoted_name, name, len);
+ unquoted_name[len] = '\000';
+ lower_name = (char*) alloca (len + 1);
+ for (i = 0; i < len; i += 1)
+ lower_name[i] = tolower (name[i]);
+ lower_name[len] = '\000';
+ }
+
+ n_matches = 0;
+ if (lower_name != NULL)
+ n_matches = ada_lookup_symbol_list (ada_mangle (lower_name), block,
+ VAR_NAMESPACE, &symbols, &blocks);
+ if (n_matches == 0)
+ n_matches = ada_lookup_symbol_list (unquoted_name, block,
+ VAR_NAMESPACE, &symbols, &blocks);
+ if (n_matches == 0 && line_num >= 0)
+ error ("No line number information found for %s.", unquoted_name);
+ else if (n_matches == 0)
+ {
+#ifdef HPPA_COMPILER_BUG
+ /* FIXME: See comment in symtab.c::decode_line_1 */
+#undef volatile
+ volatile struct symtab_and_line val;
+#define volatile /*nothing*/
+#else
+ struct symtab_and_line val;
+#endif
+ struct minimal_symbol* msymbol;
+
+ INIT_SAL (&val);
+
+ msymbol = NULL;
+ if (lower_name != NULL)
+ msymbol = ada_lookup_minimal_symbol (ada_mangle (lower_name));
+ if (msymbol == NULL)
+ msymbol = ada_lookup_minimal_symbol (unquoted_name);
+ if (msymbol != NULL)
+ {
+ val.pc = SYMBOL_VALUE_ADDRESS (msymbol);
+ val.section = SYMBOL_BFD_SECTION (msymbol);
+ if (funfirstline)
+ {
+ val.pc += FUNCTION_START_OFFSET;
+ SKIP_PROLOGUE (val.pc);
+ }
+ selected.sals = (struct symtab_and_line *)
+ xmalloc (sizeof (struct symtab_and_line));
+ selected.sals[0] = val;
+ selected.nelts = 1;
+ return selected;
+ }
+
+ if (!have_full_symbols () &&
+ !have_partial_symbols () && !have_minimal_symbols ())
+ error (no_symtab_msg);
+
+ error ("Function \"%s\" not defined.", unquoted_name);
+ return selected; /* for lint */
+ }
+
+ if (line_num >= 0)
+ {
+ return
+ find_sal_from_funcs_and_line (file_table->filename, line_num,
+ symbols, n_matches);
+ }
+ else
+ {
+ selected.nelts = user_select_syms (symbols, blocks, n_matches, n_matches);
+ }
+
+ selected.sals = (struct symtab_and_line*)
+ xmalloc (sizeof (struct symtab_and_line) * selected.nelts);
+ memset (selected.sals, 0, selected.nelts * sizeof (selected.sals[i]));
+ make_cleanup (free, selected.sals);
+
+ i = 0;
+ while (i < selected.nelts)
+ {
+ if (SYMBOL_CLASS (symbols[i]) == LOC_BLOCK)
+ selected.sals[i] = find_function_start_sal (symbols[i], funfirstline);
+ else if (SYMBOL_LINE (symbols[i]) != 0)
+ {
+ selected.sals[i].symtab = symtab_for_sym (symbols[i]);
+ selected.sals[i].line = SYMBOL_LINE (symbols[i]);
+ }
+ else if (line_num >= 0)
+ {
+ /* Ignore this choice */
+ symbols[i] = symbols[selected.nelts-1];
+ blocks[i] = blocks[selected.nelts-1];
+ selected.nelts -= 1;
+ continue;
+ }
+ else
+ error ("Line number not known for symbol \"%s\"", unquoted_name);
+ i += 1;
+ }
+
+ if (canonical != NULL && (line_num >= 0 || n_matches > 1))
+ {
+ *canonical = (char**) xmalloc (sizeof(char*) * selected.nelts);
+ for (i = 0; i < selected.nelts; i += 1)
+ (*canonical)[i] =
+ extended_canonical_line_spec (selected.sals[i],
+ SYMBOL_SOURCE_NAME (symbols[i]));
+ }
+
+ discard_cleanups (old_chain);
+ return selected;
+}
+
+/* The (single) sal corresponding to line LINE_NUM in a symbol table
+ with file name FILENAME that occurs in one of the functions listed
+ in SYMBOLS[0 .. NSYMS-1]. */
+static struct symtabs_and_lines
+find_sal_from_funcs_and_line (filename, line_num, symbols, nsyms)
+ const char* filename;
+ int line_num;
+ struct symbol** symbols;
+ int nsyms;
+{
+ struct symtabs_and_lines sals;
+ int best_index, best;
+ struct linetable* best_linetable;
+ struct objfile* objfile;
+ struct symtab* s;
+ struct symtab* best_symtab;
+
+ read_all_symtabs (filename);
+
+ best_index = 0; best_linetable = NULL; best_symtab = NULL;
+ best = 0;
+ ALL_SYMTABS (objfile, s)
+ {
+ struct linetable *l;
+ int ind, exact;
+
+ QUIT;
+
+ if (!STREQ (filename, s->filename))
+ continue;
+ l = LINETABLE (s);
+ ind = find_line_in_linetable (l, line_num, symbols, nsyms, &exact);
+ if (ind >= 0)
+ {
+ if (exact)
+ {
+ best_index = ind;
+ best_linetable = l;
+ best_symtab = s;
+ goto done;
+ }
+ if (best == 0 || l->item[ind].line < best)
+ {
+ best = l->item[ind].line;
+ best_index = ind;
+ best_linetable = l;
+ best_symtab = s;
+ }
+ }
+ }
+
+ if (best == 0)
+ error ("Line number not found in designated function.");
+
+ done:
+
+ sals.nelts = 1;
+ sals.sals = (struct symtab_and_line*) xmalloc (sizeof (sals.sals[0]));
+
+ INIT_SAL (&sals.sals[0]);
+
+ sals.sals[0].line = best_linetable->item[best_index].line;
+ sals.sals[0].pc = best_linetable->item[best_index].pc;
+ sals.sals[0].symtab = best_symtab;
+
+ return sals;
+}
+
+/* Return the index in LINETABLE of the best match for LINE_NUM whose
+ pc falls within one of the functions denoted by SYMBOLS[0..NSYMS-1].
+ Set *EXACTP to the 1 if the match is exact, and 0 otherwise. */
+static int
+find_line_in_linetable (linetable, line_num, symbols, nsyms, exactp)
+ struct linetable* linetable;
+ int line_num;
+ struct symbol** symbols;
+ int nsyms;
+ int* exactp;
+{
+ int i, len, best_index, best;
+
+ if (line_num <= 0 || linetable == NULL)
+ return -1;
+
+ len = linetable->nitems;
+ for (i = 0, best_index = -1, best = 0; i < len; i += 1)
+ {
+ int k;
+ struct linetable_entry* item = &(linetable->item[i]);
+
+ for (k = 0; k < nsyms; k += 1)
+ {
+ if (symbols[k] != NULL && SYMBOL_CLASS (symbols[k]) == LOC_BLOCK
+ && item->pc >= BLOCK_START (SYMBOL_BLOCK_VALUE (symbols[k]))
+ && item->pc < BLOCK_END (SYMBOL_BLOCK_VALUE (symbols[k])))
+ goto candidate;
+ }
+ continue;
+
+ candidate:
+
+ if (item->line == line_num)
+ {
+ *exactp = 1;
+ return i;
+ }
+
+ if (item->line > line_num && (best == 0 || item->line < best))
+ {
+ best = item->line;
+ best_index = i;
+ }
+ }
+
+ *exactp = 0;
+ return best_index;
+}
+
+/* Find the smallest k >= LINE_NUM such that k is a line number in
+ LINETABLE, and k falls strictly within a named function that begins at
+ or before LINE_NUM. Return -1 if there is no such k. */
+static int
+nearest_line_number_in_linetable (linetable, line_num)
+ struct linetable* linetable;
+ int line_num;
+{
+ int i, len, best;
+
+ if (line_num <= 0 || linetable == NULL || linetable->nitems == 0)
+ return -1;
+ len = linetable->nitems;
+
+ i = 0; best = INT_MAX;
+ while (i < len)
+ {
+ int k;
+ struct linetable_entry* item = &(linetable->item[i]);
+
+ if (item->line >= line_num && item->line < best)
+ {
+ char* func_name;
+ CORE_ADDR start, end;
+
+ func_name = NULL;
+ find_pc_partial_function (item->pc, &func_name, &start, &end);
+
+ if (func_name != NULL && item->pc < end)
+ {
+ if (item->line == line_num)
+ return line_num;
+ else
+ {
+ struct symbol* sym =
+ standard_lookup (func_name, VAR_NAMESPACE);
+ if (is_plausible_func_for_line (sym, line_num))
+ best = item->line;
+ else
+ {
+ do
+ i += 1;
+ while (i < len && linetable->item[i].pc < end);
+ continue;
+ }
+ }
+ }
+ }
+
+ i += 1;
+ }
+
+ return (best == INT_MAX) ? -1 : best;
+}
+
+
+/* Return the next higher index, k, into LINETABLE such that k > IND,
+ entry k in LINETABLE has a line number equal to LINE_NUM, k
+ corresponds to a PC that is in a function different from that
+ corresponding to IND, and falls strictly within a named function
+ that begins at a line at or preceding STARTING_LINE.
+ Return -1 if there is no such k.
+ IND == -1 corresponds to no function. */
+
+static int
+find_next_line_in_linetable (linetable, line_num, starting_line, ind)
+ struct linetable* linetable;
+ int line_num;
+ int starting_line;
+ int ind;
+{
+ int i, len;
+
+ if (line_num <= 0 || linetable == NULL || ind >= linetable->nitems)
+ return -1;
+ len = linetable->nitems;
+
+ if (ind >= 0)
+ {
+ CORE_ADDR start, end;
+
+ if (find_pc_partial_function (linetable->item[ind].pc,
+ (char**) NULL, &start, &end))
+ {
+ while (ind < len && linetable->item[ind].pc < end)
+ ind += 1;
+ }
+ else
+ ind += 1;
+ }
+ else
+ ind = 0;
+
+ i = ind;
+ while (i < len)
+ {
+ int k;
+ struct linetable_entry* item = &(linetable->item[i]);
+
+ if (item->line >= line_num)
+ {
+ char* func_name;
+ CORE_ADDR start, end;
+
+ func_name = NULL;
+ find_pc_partial_function (item->pc, &func_name, &start, &end);
+
+ if (func_name != NULL && item->pc < end)
+ {
+ if (item->line == line_num)
+ {
+ struct symbol* sym =
+ standard_lookup (func_name, VAR_NAMESPACE);
+ if (is_plausible_func_for_line (sym, starting_line))
+ return i;
+ else
+ {
+ while ((i+1) < len && linetable->item[i+1].pc < end)
+ i += 1;
+ }
+ }
+ }
+ }
+ i += 1;
+ }
+
+ return -1;
+}
+
+/* True iff function symbol SYM starts somewhere at or before line #
+ LINE_NUM. */
+static int
+is_plausible_func_for_line (sym, line_num)
+ struct symbol* sym;
+ int line_num;
+{
+ struct symtab_and_line start_sal;
+
+ if (sym == NULL)
+ return 0;
+
+ start_sal = find_function_start_sal (sym, 0);
+
+ return (start_sal.line != 0 && line_num >= start_sal.line);
+}
+
+static void
+debug_print_lines (lt)
+ struct linetable* lt;
+{
+ int i;
+
+ if (lt == NULL)
+ return;
+
+ fprintf (stderr, "\t");
+ for (i = 0; i < lt->nitems; i += 1)
+ fprintf (stderr, "(%d->%p) ", lt->item[i].line, (void *) lt->item[i].pc);
+ fprintf (stderr, "\n");
+}
+
+static void
+debug_print_block (b)
+ struct block* b;
+{
+ int i;
+ fprintf (stderr, "Block: %p; [0x%lx, 0x%lx]",
+ b, BLOCK_START(b), BLOCK_END(b));
+ if (BLOCK_FUNCTION(b) != NULL)
+ fprintf (stderr, " Function: %s", SYMBOL_NAME (BLOCK_FUNCTION(b)));
+ fprintf (stderr, "\n");
+ fprintf (stderr, "\t Superblock: %p\n", BLOCK_SUPERBLOCK(b));
+ fprintf (stderr, "\t Symbols:");
+ for (i = 0; i < BLOCK_NSYMS (b); i += 1)
+ {
+ if (i > 0 && i % 4 == 0)
+ fprintf (stderr, "\n\t\t ");
+ fprintf (stderr, " %s", SYMBOL_NAME (BLOCK_SYM (b, i)));
+ }
+ fprintf (stderr, "\n");
+}
+
+static void
+debug_print_blocks (bv)
+ struct blockvector* bv;
+{
+ int i;
+
+ if (bv == NULL)
+ return;
+ for (i = 0; i < BLOCKVECTOR_NBLOCKS (bv); i += 1) {
+ fprintf (stderr, "%6d. ", i);
+ debug_print_block (BLOCKVECTOR_BLOCK (bv, i));
+ }
+}
+
+static void
+debug_print_symtab (s)
+ struct symtab* s;
+{
+ fprintf (stderr, "Symtab %p\n File: %s; Dir: %s\n", s,
+ s->filename, s->dirname);
+ fprintf (stderr, " Blockvector: %p, Primary: %d\n",
+ BLOCKVECTOR(s), s->primary);
+ debug_print_blocks (BLOCKVECTOR(s));
+ fprintf (stderr, " Line table: %p\n", LINETABLE (s));
+ debug_print_lines (LINETABLE(s));
+}
+
+/* Read in all symbol tables corresponding to partial symbol tables
+ with file name FILENAME. */
+static void
+read_all_symtabs (filename)
+ const char* filename;
+{
+ struct partial_symtab* ps;
+ struct objfile* objfile;
+
+ ALL_PSYMTABS (objfile, ps)
+ {
+ QUIT;
+
+ if (STREQ (filename, ps->filename))
+ PSYMTAB_TO_SYMTAB (ps);
+ }
+}
+
+/* All sals corresponding to line LINE_NUM in a symbol table from file
+ FILENAME, as filtered by the user. If CANONICAL is not null, set
+ it to a corresponding array of canonical line specs. */
+static struct symtabs_and_lines
+all_sals_for_line (filename, line_num, canonical)
+ const char* filename;
+ int line_num;
+ char*** canonical;
+{
+ struct symtabs_and_lines result;
+ struct objfile* objfile;
+ struct symtab* s;
+ struct cleanup* old_chain = make_cleanup (null_cleanup, NULL);
+ size_t len;
+
+ read_all_symtabs (filename);
+
+ result.sals = (struct symtab_and_line*) xmalloc (4 * sizeof (result.sals[0]));
+ result.nelts = 0;
+ len = 4;
+ make_cleanup (free_current_contents, &result.sals);
+
+ ALL_SYMTABS (objfile, s)
+ {
+ int ind, target_line_num;
+
+ QUIT;
+
+ if (!STREQ (s->filename, filename))
+ continue;
+
+ target_line_num =
+ nearest_line_number_in_linetable (LINETABLE (s), line_num);
+ if (target_line_num == -1)
+ continue;
+
+ ind = -1;
+ while (1)
+ {
+ ind =
+ find_next_line_in_linetable (LINETABLE (s),
+ target_line_num, line_num, ind);
+
+ if (ind < 0)
+ break;
+
+ GROW_VECT (result.sals, len, result.nelts+1);
+ INIT_SAL (&result.sals[result.nelts]);
+ result.sals[result.nelts].line = LINETABLE(s)->item[ind].line;
+ result.sals[result.nelts].pc = LINETABLE(s)->item[ind].pc;
+ result.sals[result.nelts].symtab = s;
+ result.nelts += 1;
+ }
+ }
+
+ if (canonical != NULL || result.nelts > 1)
+ {
+ int k;
+ char** func_names = (char**) alloca (result.nelts * sizeof (char*));
+ int first_choice = (result.nelts > 1) ? 2 : 1;
+ int n;
+ int* choices = (int*) alloca (result.nelts * sizeof (int));
+
+ for (k = 0; k < result.nelts; k += 1)
+ {
+ find_pc_partial_function (result.sals[k].pc, &func_names[k],
+ (CORE_ADDR*) NULL, (CORE_ADDR*) NULL);
+ if (func_names[k] == NULL)
+ error ("Could not find function for one or more breakpoints.");
+ }
+
+ if (result.nelts > 1)
+ {
+ printf_unfiltered("[0] cancel\n");
+ if (result.nelts > 1)
+ printf_unfiltered("[1] all\n");
+ for (k = 0; k < result.nelts; k += 1)
+ printf_unfiltered ("[%d] %s\n", k + first_choice,
+ ada_demangle (func_names[k]));
+
+ n = get_selections (choices, result.nelts, result.nelts,
+ result.nelts > 1, "instance-choice");
+
+ for (k = 0; k < n; k += 1)
+ {
+ result.sals[k] = result.sals[choices[k]];
+ func_names[k] = func_names[choices[k]];
+ }
+ result.nelts = n;
+ }
+
+ if (canonical != NULL)
+ {
+ *canonical = (char**) xmalloc (result.nelts * sizeof (char**));
+ make_cleanup (free, *canonical);
+ for (k = 0; k < result.nelts; k += 1)
+ {
+ (*canonical)[k] =
+ extended_canonical_line_spec (result.sals[k], func_names[k]);
+ if ((*canonical)[k] == NULL)
+ error ("Could not locate one or more breakpoints.");
+ make_cleanup (free, (*canonical)[k]);
+ }
+ }
+ }
+
+ discard_cleanups (old_chain);
+ return result;
+}
+
+
+/* A canonical line specification of the form FILE:NAME:LINENUM for
+ symbol table and line data SAL. NULL if insufficient
+ information. The caller is responsible for releasing any space
+ allocated. */
+
+static char*
+extended_canonical_line_spec (sal, name)
+ struct symtab_and_line sal;
+ const char* name;
+{
+ char* r;
+
+ if (sal.symtab == NULL || sal.symtab->filename == NULL ||
+ sal.line <= 0)
+ return NULL;
+
+ r = (char*) xmalloc (strlen (name) + strlen (sal.symtab->filename)
+ + sizeof(sal.line)*3 + 3);
+ sprintf (r, "%s:'%s':%d", sal.symtab->filename, name, sal.line);
+ return r;
+}
+
+#if 0
+int begin_bnum = -1;
+#endif
+int begin_annotate_level = 0;
+
+static void
+begin_cleanup (void* dummy)
+{
+ begin_annotate_level = 0;
+}
+
+static void
+begin_command (args, from_tty)
+ char *args;
+ int from_tty;
+{
+ struct minimal_symbol *msym;
+ CORE_ADDR main_program_name_addr;
+ char main_program_name[1024];
+ struct cleanup* old_chain = make_cleanup (begin_cleanup, NULL);
+ begin_annotate_level = 2;
+
+ /* Check that there is a program to debug */
+ if (!have_full_symbols () && !have_partial_symbols ())
+ error ("No symbol table is loaded. Use the \"file\" command.");
+
+ /* Check that we are debugging an Ada program */
+ /* if (ada_update_initial_language (language_unknown, NULL) != language_ada)
+ error ("Cannot find the Ada initialization procedure. Is this an Ada main program?");
+ */
+ /* FIXME: language_ada should be defined in defs.h */
+
+ /* Get the address of the name of the main procedure */
+ msym = lookup_minimal_symbol (ADA_MAIN_PROGRAM_SYMBOL_NAME, NULL, NULL);
+
+ if (msym != NULL)
+ {
+ main_program_name_addr = SYMBOL_VALUE_ADDRESS (msym);
+ if (main_program_name_addr == 0)
+ error ("Invalid address for Ada main program name.");
+
+ /* Read the name of the main procedure */
+ extract_string (main_program_name_addr, main_program_name);
+
+ /* Put a temporary breakpoint in the Ada main program and run */
+ do_command ("tbreak ", main_program_name, 0);
+ do_command ("run ", args, 0);
+ }
+ else
+ {
+ /* If we could not find the symbol containing the name of the
+ main program, that means that the compiler that was used to build
+ was not recent enough. In that case, we fallback to the previous
+ mechanism, which is a little bit less reliable, but has proved to work
+ in most cases. The only cases where it will fail is when the user
+ has set some breakpoints which will be hit before the end of the
+ begin command processing (eg in the initialization code).
+
+ The begining of the main Ada subprogram is located by breaking
+ on the adainit procedure. Since we know that the binder generates
+ the call to this procedure exactly 2 calls before the call to the
+ Ada main subprogram, it is then easy to put a breakpoint on this
+ Ada main subprogram once we hit adainit.
+ */
+ do_command ("tbreak adainit", 0);
+ do_command ("run ", args, 0);
+ do_command ("up", 0);
+ do_command ("tbreak +2", 0);
+ do_command ("continue", 0);
+ do_command ("step", 0);
+ }
+
+ do_cleanups (old_chain);
+}
+
+int
+is_ada_runtime_file (filename)
+ char *filename;
+{
+ return (STREQN (filename, "s-", 2) ||
+ STREQN (filename, "a-", 2) ||
+ STREQN (filename, "g-", 2) ||
+ STREQN (filename, "i-", 2));
+}
+
+/* find the first frame that contains debugging information and that is not
+ part of the Ada run-time, starting from fi and moving upward. */
+
+int
+find_printable_frame (fi, level)
+ struct frame_info *fi;
+ int level;
+{
+ struct symtab_and_line sal;
+
+ for (; fi != NULL; level += 1, fi = get_prev_frame (fi))
+ {
+ /* If fi is not the innermost frame, that normally means that fi->pc
+ points to *after* the call instruction, and we want to get the line
+ containing the call, never the next line. But if the next frame is
+ a signal_handler_caller or a dummy frame, then the next frame was
+ not entered as the result of a call, and we want to get the line
+ containing fi->pc. */
+ sal =
+ find_pc_line (fi->pc,
+ fi->next != NULL
+ && !fi->next->signal_handler_caller
+ && !frame_in_dummy (fi->next));
+ if (sal.symtab && !is_ada_runtime_file (sal.symtab->filename))
+ {
+#if defined(__alpha__) && defined(__osf__) && !defined(VXWORKS_TARGET)
+ /* libpthread.so contains some debugging information that prevents us
+ from finding the right frame */
+
+ if (sal.symtab->objfile &&
+ STREQ (sal.symtab->objfile->name, "/usr/shlib/libpthread.so"))
+ continue;
+#endif
+ selected_frame = fi;
+ break;
+ }
+ }
+
+ return level;
+}
+
+void
+ada_report_exception_break (b)
+ struct breakpoint *b;
+{
+#ifdef UI_OUT
+ /* FIXME: break_on_exception should be defined in breakpoint.h */
+ /* if (b->break_on_exception == 1)
+ {
+ /* Assume that cond has 16 elements, the 15th
+ being the exception */ /*
+ if (b->cond && b->cond->nelts == 16)
+ {
+ ui_out_text (uiout, "on ");
+ ui_out_field_string (uiout, "exception",
+ SYMBOL_NAME (b->cond->elts[14].symbol));
+ }
+ else
+ ui_out_text (uiout, "on all exceptions");
+ }
+ else if (b->break_on_exception == 2)
+ ui_out_text (uiout, "on unhandled exception");
+ else if (b->break_on_exception == 3)
+ ui_out_text (uiout, "on assert failure");
+#else
+ if (b->break_on_exception == 1)
+ {*/
+ /* Assume that cond has 16 elements, the 15th
+ being the exception */ /*
+ if (b->cond && b->cond->nelts == 16)
+ {
+ fputs_filtered ("on ", gdb_stdout);
+ fputs_filtered (SYMBOL_NAME
+ (b->cond->elts[14].symbol), gdb_stdout);
+ }
+ else
+ fputs_filtered ("on all exceptions", gdb_stdout);
+ }
+ else if (b->break_on_exception == 2)
+ fputs_filtered ("on unhandled exception", gdb_stdout);
+ else if (b->break_on_exception == 3)
+ fputs_filtered ("on assert failure", gdb_stdout);
+*/
+#endif
+}
+
+int
+ada_is_exception_sym (struct symbol* sym)
+{
+ char *type_name = type_name_no_tag (SYMBOL_TYPE (sym));
+
+ return (SYMBOL_CLASS (sym) != LOC_TYPEDEF
+ && SYMBOL_CLASS (sym) != LOC_BLOCK
+ && SYMBOL_CLASS (sym) != LOC_CONST
+ && type_name != NULL
+ && STREQ (type_name, "exception"));
+}
+
+int
+ada_maybe_exception_partial_symbol (struct partial_symbol* sym)
+{
+ return (SYMBOL_CLASS (sym) != LOC_TYPEDEF
+ && SYMBOL_CLASS (sym) != LOC_BLOCK
+ && SYMBOL_CLASS (sym) != LOC_CONST);
+}
+
+/* If ARG points to an Ada exception or assert breakpoint, rewrite
+ into equivalent form. Return resulting argument string. Set
+ *BREAK_ON_EXCEPTIONP to 1 for ordinary break on exception, 2 for
+ break on unhandled, 3 for assert, 0 otherwise. */
+char* ada_breakpoint_rewrite (char* arg, int* break_on_exceptionp)
+{
+ if (arg == NULL)
+ return arg;
+ *break_on_exceptionp = 0;
+ /* FIXME: language_ada should be defined in defs.h */
+ /* if (current_language->la_language == language_ada
+ && STREQN (arg, "exception", 9) &&
+ (arg[9] == ' ' || arg[9] == '\t' || arg[9] == '\0'))
+ {
+ char *tok, *end_tok;
+ int toklen;
+
+ *break_on_exceptionp = 1;
+
+ tok = arg+9;
+ while (*tok == ' ' || *tok == '\t')
+ tok += 1;
+
+ end_tok = tok;
+
+ while (*end_tok != ' ' && *end_tok != '\t' && *end_tok != '\000')
+ end_tok += 1;
+
+ toklen = end_tok - tok;
+
+ arg = (char*) xmalloc (sizeof ("__gnat_raise_nodefer_with_msg if "
+ "long_integer(e) = long_integer(&)")
+ + toklen + 1);
+ make_cleanup (free, arg);
+ if (toklen == 0)
+ strcpy (arg, "__gnat_raise_nodefer_with_msg");
+ else if (STREQN (tok, "unhandled", toklen))
+ {
+ *break_on_exceptionp = 2;
+ strcpy (arg, "__gnat_unhandled_exception");
+ }
+ else
+ {
+ sprintf (arg, "__gnat_raise_nodefer_with_msg if "
+ "long_integer(e) = long_integer(&%.*s)",
+ toklen, tok);
+ }
+ }
+ else if (current_language->la_language == language_ada
+ && STREQN (arg, "assert", 6) &&
+ (arg[6] == ' ' || arg[6] == '\t' || arg[6] == '\0'))
+ {
+ char *tok = arg + 6;
+
+ *break_on_exceptionp = 3;
+
+ arg = (char*)
+ xmalloc (sizeof ("system__assertions__raise_assert_failure")
+ + strlen (tok) + 1);
+ make_cleanup (free, arg);
+ sprintf (arg, "system__assertions__raise_assert_failure%s", tok);
+ }
+ */
+ return arg;
+}
+
+
+ /* Field Access */
+
+/* True if field number FIELD_NUM in struct or union type TYPE is supposed
+ to be invisible to users. */
+
+int
+ada_is_ignored_field (type, field_num)
+ struct type *type;
+ int field_num;
+{
+ if (field_num < 0 || field_num > TYPE_NFIELDS (type))
+ return 1;
+ else
+ {
+ const char* name = TYPE_FIELD_NAME (type, field_num);
+ return (name == NULL
+ || (name[0] == '_' && ! STREQN (name, "_parent", 7)));
+ }
+}
+
+/* True iff structure type TYPE has a tag field. */
+
+int
+ada_is_tagged_type (type)
+ struct type *type;
+{
+ if (type == NULL || TYPE_CODE (type) != TYPE_CODE_STRUCT)
+ return 0;
+
+ return (ada_lookup_struct_elt_type (type, "_tag", 1, NULL) != NULL);
+}
+
+/* The type of the tag on VAL. */
+
+struct type*
+ada_tag_type (val)
+ struct value* val;
+{
+ return ada_lookup_struct_elt_type (VALUE_TYPE (val), "_tag", 0, NULL);
+}
+
+/* The value of the tag on VAL. */
+
+struct value*
+ada_value_tag (val)
+ struct value* val;
+{
+ return ada_value_struct_elt (val, "_tag", "record");
+}
+
+/* The parent type of TYPE, or NULL if none. */
+
+struct type*
+ada_parent_type (type)
+ struct type *type;
+{
+ int i;
+
+ CHECK_TYPEDEF (type);
+
+ if (type == NULL || TYPE_CODE (type) != TYPE_CODE_STRUCT)
+ return NULL;
+
+ for (i = 0; i < TYPE_NFIELDS (type); i += 1)
+ if (ada_is_parent_field (type, i))
+ return check_typedef (TYPE_FIELD_TYPE (type, i));
+
+ return NULL;
+}
+
+/* True iff field number FIELD_NUM of structure type TYPE contains the
+ parent-type (inherited) fields of a derived type. Assumes TYPE is
+ a structure type with at least FIELD_NUM+1 fields. */
+
+int
+ada_is_parent_field (type, field_num)
+ 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)));
+}
+
+/* True iff field number FIELD_NUM of structure type TYPE is a
+ transparent wrapper field (which should be silently traversed when doing
+ field selection and flattened when printing). Assumes TYPE is a
+ structure type with at least FIELD_NUM+1 fields. Such fields are always
+ structures. */
+
+int
+ada_is_wrapper_field (type, field_num)
+ 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)
+ || name[0] == 'S' || name[0] == 'R' || name[0] == 'O'));
+}
+
+/* True iff field number FIELD_NUM of structure or union type TYPE
+ is a variant wrapper. Assumes TYPE is a structure type with at least
+ FIELD_NUM+1 fields. */
+
+int
+ada_is_variant_part (type, field_num)
+ struct type *type;
+ int field_num;
+{
+ struct type* field_type = TYPE_FIELD_TYPE (type, field_num);
+ return (TYPE_CODE (field_type) == TYPE_CODE_UNION
+ || (is_dynamic_field (type, field_num)
+ && TYPE_CODE (TYPE_TARGET_TYPE (field_type)) == TYPE_CODE_UNION));
+}
+
+/* Assuming that VAR_TYPE is a variant wrapper (type of the variant part)
+ whose discriminants are contained in the record type OUTER_TYPE,
+ returns the type of the controlling discriminant for the variant. */
+
+struct type*
+ada_variant_discrim_type (var_type, outer_type)
+ struct type *var_type;
+ struct type *outer_type;
+{
+ char* name = ada_variant_discrim_name (var_type);
+ struct type *type =
+ ada_lookup_struct_elt_type (outer_type, name, 1, NULL);
+ if (type == NULL)
+ return builtin_type_int;
+ else
+ return type;
+}
+
+/* Assuming that TYPE is the type of a variant wrapper, and FIELD_NUM is a
+ valid field number within it, returns 1 iff field FIELD_NUM of TYPE
+ represents a 'when others' clause; otherwise 0. */
+
+int
+ada_is_others_clause (type, field_num)
+ struct type *type;
+ int field_num;
+{
+ const char* name = TYPE_FIELD_NAME (type, field_num);
+ return (name != NULL && name[0] == 'O');
+}
+
+/* Assuming that TYPE0 is the type of the variant part of a record,
+ returns the name of the discriminant controlling the variant. The
+ value is valid until the next call to ada_variant_discrim_name. */
+
+char *
+ada_variant_discrim_name (type0)
+ struct type *type0;
+{
+ static char* result = NULL;
+ static size_t result_len = 0;
+ struct type* type;
+ const char* name;
+ const char* discrim_end;
+ const char* discrim_start;
+
+ if (TYPE_CODE (type0) == TYPE_CODE_PTR)
+ type = TYPE_TARGET_TYPE (type0);
+ else
+ type = type0;
+
+ name = ada_type_name (type);
+
+ if (name == NULL || name[0] == '\000')
+ return "";
+
+ for (discrim_end = name + strlen (name) - 6; discrim_end != name;
+ discrim_end -= 1)
+ {
+ if (STREQN (discrim_end, "___XVN", 6))
+ break;
+ }
+ if (discrim_end == name)
+ return "";
+
+ for (discrim_start = discrim_end; discrim_start != name+3;
+ discrim_start -= 1)
+ {
+ if (discrim_start == name+1)
+ return "";
+ if ((discrim_start > name+3 && STREQN (discrim_start-3, "___", 3))
+ || discrim_start[-1] == '.')
+ break;
+ }
+
+ GROW_VECT (result, result_len, discrim_end - discrim_start + 1);
+ strncpy (result, discrim_start, discrim_end - discrim_start);
+ result[discrim_end-discrim_start] = '\0';
+ return result;
+}
+
+/* Scan STR for a subtype-encoded number, beginning at position K. Put the
+ position of the character just past the number scanned in *NEW_K,
+ if NEW_K!=NULL. Put the scanned number in *R, if R!=NULL. Return 1
+ if there was a valid number at the given position, and 0 otherwise. A
+ "subtype-encoded" number consists of the absolute value in decimal,
+ followed by the letter 'm' to indicate a negative number. Assumes 0m
+ does not occur. */
+
+int
+ada_scan_number (str, k, R, new_k)
+ const char str[];
+ int k;
+ LONGEST *R;
+ int *new_k;
+{
+ ULONGEST RU;
+
+ if (! isdigit (str[k]))
+ return 0;
+
+ /* Do it the hard way so as not to make any assumption about
+ the relationship of unsigned long (%lu scan format code) and
+ LONGEST. */
+ RU = 0;
+ while (isdigit (str[k]))
+ {
+ RU = RU*10 + (str[k] - '0');
+ k += 1;
+ }
+
+ if (str[k] == 'm')
+ {
+ if (R != NULL)
+ *R = (- (LONGEST) (RU-1)) - 1;
+ k += 1;
+ }
+ else if (R != NULL)
+ *R = (LONGEST) RU;
+
+ /* NOTE on the above: Technically, C does not say what the results of
+ - (LONGEST) RU or (LONGEST) -RU are for RU == largest positive
+ number representable as a LONGEST (although either would probably work
+ in most implementations). When RU>0, the locution in the then branch
+ above is always equivalent to the negative of RU. */
+
+ if (new_k != NULL)
+ *new_k = k;
+ return 1;
+}
+
+/* Assuming that TYPE is a variant part wrapper type (a VARIANTS field),
+ and FIELD_NUM is a valid field number within it, returns 1 iff VAL is
+ in the range encoded by field FIELD_NUM of TYPE; otherwise 0. */
+
+int
+ada_in_variant (val, type, field_num)
+ LONGEST val;
+ struct type *type;
+ int field_num;
+{
+ const char* name = TYPE_FIELD_NAME (type, field_num);
+ int p;
+
+ p = 0;
+ while (1)
+ {
+ switch (name[p])
+ {
+ case '\0':
+ return 0;
+ case 'S':
+ {
+ LONGEST W;
+ if (! ada_scan_number (name, p + 1, &W, &p))
+ return 0;
+ if (val == W)
+ return 1;
+ break;
+ }
+ case 'R':
+ {
+ LONGEST L, U;
+ if (! ada_scan_number (name, p + 1, &L, &p)
+ || name[p] != 'T'
+ || ! ada_scan_number (name, p + 1, &U, &p))
+ return 0;
+ if (val >= L && val <= U)
+ return 1;
+ break;
+ }
+ case 'O':
+ return 1;
+ default:
+ return 0;
+ }
+ }
+}
+
+/* Given a value ARG1 (offset by OFFSET bytes)
+ of a struct or union type ARG_TYPE,
+ extract and return the value of one of its (non-static) fields.
+ FIELDNO says which field. Differs from value_primitive_field only
+ in that it can handle packed values of arbitrary type. */
+
+struct value*
+ada_value_primitive_field (arg1, offset, fieldno, arg_type)
+ struct value* arg1;
+ int offset;
+ int fieldno;
+ struct type *arg_type;
+{
+ struct value* v;
+ struct type *type;
+
+ CHECK_TYPEDEF (arg_type);
+ type = TYPE_FIELD_TYPE (arg_type, fieldno);
+
+ /* Handle packed fields */
+
+ if (TYPE_FIELD_BITSIZE (arg_type, fieldno) != 0)
+ {
+ int bit_pos = TYPE_FIELD_BITPOS (arg_type, fieldno);
+ int bit_size = TYPE_FIELD_BITSIZE (arg_type, fieldno);
+
+ return ada_value_primitive_packed_val (arg1, VALUE_CONTENTS (arg1),
+ offset + bit_pos/8, bit_pos % 8,
+ bit_size, type);
+ }
+ else
+ return value_primitive_field (arg1, offset, fieldno, arg_type);
+}
+
+
+/* Look for a field NAME in ARG. Adjust the address of ARG by OFFSET bytes,
+ and search in it assuming it has (class) type TYPE.
+ If found, return value, else return NULL.
+
+ Searches recursively through wrapper fields (e.g., '_parent'). */
+
+struct value*
+ada_search_struct_field (name, arg, offset, type)
+ char *name;
+ struct value* arg;
+ int offset;
+ struct type *type;
+{
+ int i;
+ CHECK_TYPEDEF (type);
+
+ for (i = TYPE_NFIELDS (type)-1; i >= 0; i -= 1)
+ {
+ char *t_field_name = TYPE_FIELD_NAME (type, i);
+
+ if (t_field_name == NULL)
+ continue;
+
+ else if (field_name_match (t_field_name, name))
+ return ada_value_primitive_field (arg, offset, i, type);
+
+ else if (ada_is_wrapper_field (type, i))
+ {
+ struct value* v =
+ ada_search_struct_field (name, arg,
+ offset + TYPE_FIELD_BITPOS (type, i) / 8,
+ TYPE_FIELD_TYPE (type, i));
+ if (v != NULL)
+ return v;
+ }
+
+ else if (ada_is_variant_part (type, i))
+ {
+ int j;
+ struct type *field_type = check_typedef (TYPE_FIELD_TYPE (type, i));
+ int var_offset = offset + TYPE_FIELD_BITPOS (type, i) / 8;
+
+ for (j = TYPE_NFIELDS (field_type) - 1; j >= 0; j -= 1)
+ {
+ struct value* v =
+ ada_search_struct_field (name, arg,
+ var_offset
+ + TYPE_FIELD_BITPOS (field_type, j)/8,
+ TYPE_FIELD_TYPE (field_type, j));
+ if (v != NULL)
+ return v;
+ }
+ }
+ }
+ return NULL;
+}
+
+/* Given ARG, a value of type (pointer to a)* structure/union,
+ extract the component named NAME from the ultimate target structure/union
+ and return it as a value with its appropriate type.
+
+ The routine searches for NAME among all members of the structure itself
+ and (recursively) among all members of any wrapper members
+ (e.g., '_parent').
+
+ ERR is a name (for use in error messages) that identifies the class
+ of entity that ARG is supposed to be. */
+
+struct value*
+ada_value_struct_elt (arg, name, err)
+ struct value* arg;
+ char *name;
+ char *err;
+{
+ struct type *t;
+ struct value* v;
+
+ arg = ada_coerce_ref (arg);
+ t = check_typedef (VALUE_TYPE (arg));
+
+ /* Follow pointers until we get to a non-pointer. */
+
+ while (TYPE_CODE (t) == TYPE_CODE_PTR || TYPE_CODE (t) == TYPE_CODE_REF)
+ {
+ arg = ada_value_ind (arg);
+ t = check_typedef (VALUE_TYPE (arg));
+ }
+
+ if ( TYPE_CODE (t) != TYPE_CODE_STRUCT
+ && TYPE_CODE (t) != TYPE_CODE_UNION)
+ error ("Attempt to extract a component of a value that is not a %s.", err);
+
+ v = ada_search_struct_field (name, arg, 0, t);
+ if (v == NULL)
+ error ("There is no member named %s.", name);
+
+ return v;
+}
+
+/* Given a type TYPE, look up the type of the component of type named NAME.
+ If DISPP is non-null, add its byte displacement from the beginning of a
+ structure (pointed to by a value) of type TYPE to *DISPP (does not
+ work for packed fields).
+
+ Matches any field whose name has NAME as a prefix, possibly
+ followed by "___".
+
+ TYPE can be either a struct or union, or a pointer or reference to
+ a struct or union. If it is a pointer or reference, its target
+ type is automatically used.
+
+ Looks recursively into variant clauses and parent types.
+
+ If NOERR is nonzero, return NULL if NAME is not suitably defined. */
+
+struct type *
+ada_lookup_struct_elt_type (type, name, noerr, dispp)
+ struct type *type;
+ char *name;
+ int noerr;
+ int *dispp;
+{
+ int i;
+
+ if (name == NULL)
+ goto BadName;
+
+ while (1)
+ {
+ CHECK_TYPEDEF (type);
+ if (TYPE_CODE (type) != TYPE_CODE_PTR
+ && TYPE_CODE (type) != TYPE_CODE_REF)
+ break;
+ type = TYPE_TARGET_TYPE (type);
+ }
+
+ if (TYPE_CODE (type) != TYPE_CODE_STRUCT &&
+ TYPE_CODE (type) != TYPE_CODE_UNION)
+ {
+ target_terminal_ours ();
+ gdb_flush (gdb_stdout);
+ fprintf_unfiltered (gdb_stderr, "Type ");
+ type_print (type, "", gdb_stderr, -1);
+ error (" is not a structure or union type");
+ }
+
+ type = to_static_fixed_type (type);
+
+ for (i = 0; i < TYPE_NFIELDS (type); i += 1)
+ {
+ char *t_field_name = TYPE_FIELD_NAME (type, i);
+ struct type *t;
+ int disp;
+
+ if (t_field_name == NULL)
+ continue;
+
+ else if (field_name_match (t_field_name, name))
+ {
+ if (dispp != NULL)
+ *dispp += TYPE_FIELD_BITPOS (type, i) / 8;
+ return check_typedef (TYPE_FIELD_TYPE (type, i));
+ }
+
+ else if (ada_is_wrapper_field (type, i))
+ {
+ disp = 0;
+ t = ada_lookup_struct_elt_type (TYPE_FIELD_TYPE (type, i), name,
+ 1, &disp);
+ if (t != NULL)
+ {
+ if (dispp != NULL)
+ *dispp += disp + TYPE_FIELD_BITPOS (type, i) / 8;
+ return t;
+ }
+ }
+
+ else if (ada_is_variant_part (type, i))
+ {
+ int j;
+ struct type *field_type = check_typedef (TYPE_FIELD_TYPE (type, i));
+
+ for (j = TYPE_NFIELDS (field_type) - 1; j >= 0; j -= 1)
+ {
+ disp = 0;
+ t = ada_lookup_struct_elt_type (TYPE_FIELD_TYPE (field_type, j),
+ name, 1, &disp);
+ if (t != NULL)
+ {
+ if (dispp != NULL)
+ *dispp += disp + TYPE_FIELD_BITPOS (type, i) / 8;
+ return t;
+ }
+ }
+ }
+
+ }
+
+BadName:
+ if (! noerr)
+ {
+ target_terminal_ours ();
+ gdb_flush (gdb_stdout);
+ fprintf_unfiltered (gdb_stderr, "Type ");
+ type_print (type, "", gdb_stderr, -1);
+ fprintf_unfiltered (gdb_stderr, " has no component named ");
+ error ("%s", name == NULL ? "<null>" : name);
+ }
+
+ return NULL;
+}
+
+/* Assuming that VAR_TYPE is the type of a variant part of a record (a union),
+ within a value of type OUTER_TYPE that is stored in GDB at
+ OUTER_VALADDR, determine which variant clause (field number in VAR_TYPE,
+ numbering from 0) is applicable. Returns -1 if none are. */
+
+int
+ada_which_variant_applies (var_type, outer_type, outer_valaddr)
+ struct type *var_type;
+ struct type *outer_type;
+ char* outer_valaddr;
+{
+ int others_clause;
+ int i;
+ int disp;
+ struct type* discrim_type;
+ char* discrim_name = ada_variant_discrim_name (var_type);
+ LONGEST discrim_val;
+
+ disp = 0;
+ discrim_type =
+ ada_lookup_struct_elt_type (outer_type, discrim_name, 1, &disp);
+ if (discrim_type == NULL)
+ return -1;
+ discrim_val = unpack_long (discrim_type, outer_valaddr + disp);
+
+ others_clause = -1;
+ for (i = 0; i < TYPE_NFIELDS (var_type); i += 1)
+ {
+ if (ada_is_others_clause (var_type, i))
+ others_clause = i;
+ else if (ada_in_variant (discrim_val, var_type, i))
+ return i;
+ }
+
+ return others_clause;
+}
+
+
+
+ /* Dynamic-Sized Records */
+
+/* Strategy: The type ostensibly attached to a value with dynamic size
+ (i.e., a size that is not statically recorded in the debugging
+ data) does not accurately reflect the size or layout of the value.
+ Our strategy is to convert these values to values with accurate,
+ conventional types that are constructed on the fly. */
+
+/* There is a subtle and tricky problem here. In general, we cannot
+ determine the size of dynamic records without its data. However,
+ the 'struct value' data structure, which GDB uses to represent
+ quantities in the inferior process (the target), requires the size
+ of the type at the time of its allocation in order to reserve space
+ for GDB's internal copy of the data. That's why the
+ 'to_fixed_xxx_type' routines take (target) addresses as parameters,
+ rather than struct value*s.
+
+ However, GDB's internal history variables ($1, $2, etc.) are
+ struct value*s containing internal copies of the data that are not, in
+ general, the same as the data at their corresponding addresses in
+ the target. Fortunately, the types we give to these values are all
+ conventional, fixed-size types (as per the strategy described
+ above), so that we don't usually have to perform the
+ 'to_fixed_xxx_type' conversions to look at their values.
+ Unfortunately, there is one exception: if one of the internal
+ history variables is an array whose elements are unconstrained
+ records, then we will need to create distinct fixed types for each
+ element selected. */
+
+/* The upshot of all of this is that many routines take a (type, host
+ address, target address) triple as arguments to represent a value.
+ The host address, if non-null, is supposed to contain an internal
+ copy of the relevant data; otherwise, the program is to consult the
+ target at the target address. */
+
+/* Assuming that VAL0 represents a pointer value, the result of
+ dereferencing it. Differs from value_ind in its treatment of
+ dynamic-sized types. */
+
+struct value*
+ada_value_ind (val0)
+ struct value* val0;
+{
+ struct value* val = unwrap_value (value_ind (val0));
+ return ada_to_fixed_value (VALUE_TYPE (val), 0,
+ VALUE_ADDRESS (val) + VALUE_OFFSET (val),
+ val);
+}
+
+/* The value resulting from dereferencing any "reference to"
+ * qualifiers on VAL0. */
+static struct value*
+ada_coerce_ref (val0)
+ struct value* val0;
+{
+ if (TYPE_CODE (VALUE_TYPE (val0)) == TYPE_CODE_REF) {
+ struct value* val = val0;
+ COERCE_REF (val);
+ val = unwrap_value (val);
+ return ada_to_fixed_value (VALUE_TYPE (val), 0,
+ VALUE_ADDRESS (val) + VALUE_OFFSET (val),
+ val);
+ } else
+ return val0;
+}
+
+/* Return OFF rounded upward if necessary to a multiple of
+ ALIGNMENT (a power of 2). */
+
+static unsigned int
+align_value (off, alignment)
+ unsigned int off;
+ unsigned int alignment;
+{
+ return (off + alignment - 1) & ~(alignment - 1);
+}
+
+/* Return the additional bit offset required by field F of template
+ type TYPE. */
+
+static unsigned int
+field_offset (type, f)
+ struct type *type;
+ int f;
+{
+ int n = TYPE_FIELD_BITPOS (type, f);
+ /* Kludge (temporary?) to fix problem with dwarf output. */
+ if (n < 0)
+ return (unsigned int) n & 0xffff;
+ else
+ return n;
+}
+
+
+/* Return the bit alignment required for field #F of template type TYPE. */
+
+static unsigned int
+field_alignment (type, f)
+ struct type *type;
+ int f;
+{
+ const char* name = TYPE_FIELD_NAME (type, f);
+ int len = (name == NULL) ? 0 : strlen (name);
+ int align_offset;
+
+ if (len < 8 || ! isdigit (name[len-1]))
+ return TARGET_CHAR_BIT;
+
+ if (isdigit (name[len-2]))
+ align_offset = len - 2;
+ else
+ align_offset = len - 1;
+
+ if (align_offset < 7 || ! STREQN ("___XV", name+align_offset-6, 5))
+ return TARGET_CHAR_BIT;
+
+ return atoi (name+align_offset) * TARGET_CHAR_BIT;
+}
+
+/* Find a type named NAME. Ignores ambiguity. */
+struct type*
+ada_find_any_type (name)
+ const char *name;
+{
+ struct symbol* sym;
+
+ sym = standard_lookup (name, VAR_NAMESPACE);
+ if (sym != NULL && SYMBOL_CLASS (sym) == LOC_TYPEDEF)
+ return SYMBOL_TYPE (sym);
+
+ sym = standard_lookup (name, STRUCT_NAMESPACE);
+ if (sym != NULL)
+ return SYMBOL_TYPE (sym);
+
+ return NULL;
+}
+
+/* Because of GNAT encoding conventions, several GDB symbols may match a
+ given type name. If the type denoted by TYPE0 is to be preferred to
+ that of TYPE1 for purposes of type printing, return non-zero;
+ otherwise return 0. */
+int
+ada_prefer_type (type0, type1)
+ struct type* type0;
+ struct type* type1;
+{
+ if (type1 == NULL)
+ return 1;
+ else if (type0 == NULL)
+ return 0;
+ else if (TYPE_CODE (type1) == TYPE_CODE_VOID)
+ return 1;
+ else if (TYPE_CODE (type0) == TYPE_CODE_VOID)
+ return 0;
+ else if (ada_is_packed_array_type (type0))
+ return 1;
+ else if (ada_is_array_descriptor (type0) && ! ada_is_array_descriptor (type1))
+ return 1;
+ else if (ada_renaming_type (type0) != NULL
+ && ada_renaming_type (type1) == NULL)
+ return 1;
+ return 0;
+}
+
+/* The name of TYPE, which is either its TYPE_NAME, or, if that is
+ null, its TYPE_TAG_NAME. Null if TYPE is null. */
+char*
+ada_type_name (type)
+ struct type* type;
+{
+ if (type == NULL)
+ return NULL;
+ else if (TYPE_NAME (type) != NULL)
+ return TYPE_NAME (type);
+ else
+ return TYPE_TAG_NAME (type);
+}
+
+/* Find a parallel type to TYPE whose name is formed by appending
+ SUFFIX to the name of TYPE. */
+
+struct type*
+ada_find_parallel_type (type, suffix)
+ struct type *type;
+ const char *suffix;
+{
+ static char* name;
+ static size_t name_len = 0;
+ struct symbol** syms;
+ struct block** blocks;
+ int nsyms;
+ int len;
+ char* typename = ada_type_name (type);
+
+ if (typename == NULL)
+ return NULL;
+
+ len = strlen (typename);
+
+ GROW_VECT (name, name_len, len+strlen (suffix)+1);
+
+ strcpy (name, typename);
+ strcpy (name + len, suffix);
+
+ return ada_find_any_type (name);
+}
+
+
+/* If TYPE is a variable-size record type, return the corresponding template
+ type describing its fields. Otherwise, return NULL. */
+
+static struct type*
+dynamic_template_type (type)
+ struct type* type;
+{
+ CHECK_TYPEDEF (type);
+
+ if (type == NULL || TYPE_CODE (type) != TYPE_CODE_STRUCT
+ || ada_type_name (type) == NULL)
+ return NULL;
+ else
+ {
+ int len = strlen (ada_type_name (type));
+ if (len > 6 && STREQ (ada_type_name (type) + len - 6, "___XVE"))
+ return type;
+ else
+ return ada_find_parallel_type (type, "___XVE");
+ }
+}
+
+/* Assuming that TEMPL_TYPE is a union or struct type, returns
+ non-zero iff field FIELD_NUM of TEMPL_TYPE has dynamic size. */
+
+static int
+is_dynamic_field (templ_type, field_num)
+ struct type* templ_type;
+ int field_num;
+{
+ const char *name = TYPE_FIELD_NAME (templ_type, field_num);
+ return name != NULL
+ && TYPE_CODE (TYPE_FIELD_TYPE (templ_type, field_num)) == TYPE_CODE_PTR
+ && strstr (name, "___XVL") != NULL;
+}
+
+/* Assuming that TYPE is a struct type, returns non-zero iff TYPE
+ contains a variant part. */
+
+static int
+contains_variant_part (type)
+ struct type* type;
+{
+ int f;
+
+ if (type == NULL || TYPE_CODE (type) != TYPE_CODE_STRUCT
+ || TYPE_NFIELDS (type) <= 0)
+ return 0;
+ return ada_is_variant_part (type, TYPE_NFIELDS (type) - 1);
+}
+
+/* A record type with no fields, . */
+static struct type*
+empty_record (objfile)
+ struct objfile* objfile;
+{
+ struct type* type = alloc_type (objfile);
+ TYPE_CODE (type) = TYPE_CODE_STRUCT;
+ TYPE_NFIELDS (type) = 0;
+ TYPE_FIELDS (type) = NULL;
+ TYPE_NAME (type) = "<empty>";
+ TYPE_TAG_NAME (type) = NULL;
+ TYPE_FLAGS (type) = 0;
+ TYPE_LENGTH (type) = 0;
+ return type;
+}
+
+/* An ordinary record type (with fixed-length fields) that describes
+ the value of type TYPE at VALADDR or ADDRESS (see comments at
+ the beginning of this section) VAL according to GNAT conventions.
+ DVAL0 should describe the (portion of a) record that contains any
+ necessary discriminants. It should be NULL if VALUE_TYPE (VAL) is
+ an outer-level type (i.e., as opposed to a branch of a variant.) A
+ variant field (unless unchecked) is replaced by a particular branch
+ of the variant. */
+/* NOTE: Limitations: For now, we assume that dynamic fields and
+ * variants occupy whole numbers of bytes. However, they need not be
+ * byte-aligned. */
+
+static struct type*
+template_to_fixed_record_type (type, valaddr, address, dval0)
+ struct type* type;
+ char* valaddr;
+ CORE_ADDR address;
+ struct value* dval0;
+
+{
+ struct value* mark = value_mark();
+ struct value* dval;
+ struct type* rtype;
+ int nfields, bit_len;
+ long off;
+ int f;
+
+ nfields = TYPE_NFIELDS (type);
+ rtype = alloc_type (TYPE_OBJFILE (type));
+ TYPE_CODE (rtype) = TYPE_CODE_STRUCT;
+ INIT_CPLUS_SPECIFIC (rtype);
+ TYPE_NFIELDS (rtype) = nfields;
+ TYPE_FIELDS (rtype) = (struct field*)
+ TYPE_ALLOC (rtype, nfields * sizeof (struct field));
+ memset (TYPE_FIELDS (rtype), 0, sizeof (struct field) * nfields);
+ TYPE_NAME (rtype) = ada_type_name (type);
+ TYPE_TAG_NAME (rtype) = NULL;
+ /* FIXME: TYPE_FLAG_FIXED_INSTANCE should be defined in
+ gdbtypes.h */
+ /* TYPE_FLAGS (rtype) |= TYPE_FLAG_FIXED_INSTANCE;*/
+
+ off = 0; bit_len = 0;
+ for (f = 0; f < nfields; f += 1)
+ {
+ int fld_bit_len, bit_incr;
+ off =
+ align_value (off, field_alignment (type, f))+TYPE_FIELD_BITPOS (type,f);
+ /* NOTE: used to use field_offset above, but that causes
+ * problems with really negative bit positions. So, let's
+ * rediscover why we needed field_offset and fix it properly. */
+ TYPE_FIELD_BITPOS (rtype, f) = off;
+ TYPE_FIELD_BITSIZE (rtype, f) = 0;
+
+ if (ada_is_variant_part (type, f))
+ {
+ struct type *branch_type;
+
+ if (dval0 == NULL)
+ dval =
+ value_from_contents_and_address (rtype, valaddr, address);
+ else
+ dval = dval0;
+
+ branch_type =
+ to_fixed_variant_branch_type
+ (TYPE_FIELD_TYPE (type, f),
+ cond_offset_host (valaddr, off / TARGET_CHAR_BIT),
+ cond_offset_target (address, off / TARGET_CHAR_BIT),
+ dval);
+ if (branch_type == NULL)
+ TYPE_NFIELDS (rtype) -= 1;
+ else
+ {
+ TYPE_FIELD_TYPE (rtype, f) = branch_type;
+ TYPE_FIELD_NAME (rtype, f) = "S";
+ }
+ bit_incr = 0;
+ fld_bit_len =
+ TYPE_LENGTH (TYPE_FIELD_TYPE (rtype, f)) * TARGET_CHAR_BIT;
+ }
+ else if (is_dynamic_field (type, f))
+ {
+ if (dval0 == NULL)
+ dval =
+ value_from_contents_and_address (rtype, valaddr, address);
+ else
+ dval = dval0;
+
+ TYPE_FIELD_TYPE (rtype, f) =
+ ada_to_fixed_type
+ (ada_get_base_type
+ (TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (type, f))),
+ cond_offset_host (valaddr, off / TARGET_CHAR_BIT),
+ cond_offset_target (address, off / TARGET_CHAR_BIT),
+ dval);
+ TYPE_FIELD_NAME (rtype, f) = TYPE_FIELD_NAME (type, f);
+ bit_incr = fld_bit_len =
+ TYPE_LENGTH (TYPE_FIELD_TYPE (rtype, f)) * TARGET_CHAR_BIT;
+ }
+ else
+ {
+ TYPE_FIELD_TYPE (rtype, f) = TYPE_FIELD_TYPE (type, f);
+ TYPE_FIELD_NAME (rtype, f) = TYPE_FIELD_NAME (type, f);
+ if (TYPE_FIELD_BITSIZE (type, f) > 0)
+ bit_incr = fld_bit_len =
+ TYPE_FIELD_BITSIZE (rtype, f) = TYPE_FIELD_BITSIZE (type, f);
+ else
+ bit_incr = fld_bit_len =
+ TYPE_LENGTH (TYPE_FIELD_TYPE (type, f)) * TARGET_CHAR_BIT;
+ }
+ if (off + fld_bit_len > bit_len)
+ bit_len = off + fld_bit_len;
+ off += bit_incr;
+ TYPE_LENGTH (rtype) = bit_len / TARGET_CHAR_BIT;
+ }
+ TYPE_LENGTH (rtype) = align_value (TYPE_LENGTH (rtype), TYPE_LENGTH (type));
+
+ value_free_to_mark (mark);
+ if (TYPE_LENGTH (rtype) > varsize_limit)
+ error ("record type with dynamic size is larger than varsize-limit");
+ return rtype;
+}
+
+/* As for template_to_fixed_record_type, but uses no run-time values.
+ As a result, this type can only be approximate, but that's OK,
+ since it is used only for type determinations. Works on both
+ structs and unions.
+ Representation note: to save space, we memoize the result of this
+ function in the TYPE_TARGET_TYPE of the template type. */
+
+static struct type*
+template_to_static_fixed_type (templ_type)
+ struct type* templ_type;
+{
+ struct type *type;
+ int nfields;
+ int f;
+
+ if (TYPE_TARGET_TYPE (templ_type) != NULL)
+ return TYPE_TARGET_TYPE (templ_type);
+
+ nfields = TYPE_NFIELDS (templ_type);
+ TYPE_TARGET_TYPE (templ_type) = type = alloc_type (TYPE_OBJFILE (templ_type));
+ TYPE_CODE (type) = TYPE_CODE (templ_type);
+ INIT_CPLUS_SPECIFIC (type);
+ TYPE_NFIELDS (type) = nfields;
+ TYPE_FIELDS (type) = (struct field*)
+ TYPE_ALLOC (type, nfields * sizeof (struct field));
+ memset (TYPE_FIELDS (type), 0, sizeof (struct field) * nfields);
+ TYPE_NAME (type) = ada_type_name (templ_type);
+ TYPE_TAG_NAME (type) = NULL;
+ /* FIXME: TYPE_FLAG_FIXED_INSTANCE should be defined in gdbtypes.h */
+ /* TYPE_FLAGS (type) |= TYPE_FLAG_FIXED_INSTANCE; */
+ TYPE_LENGTH (type) = 0;
+
+ for (f = 0; f < nfields; f += 1)
+ {
+ TYPE_FIELD_BITPOS (type, f) = 0;
+ TYPE_FIELD_BITSIZE (type, f) = 0;
+
+ if (is_dynamic_field (templ_type, f))
+ {
+ TYPE_FIELD_TYPE (type, f) =
+ to_static_fixed_type (TYPE_TARGET_TYPE
+ (TYPE_FIELD_TYPE (templ_type, f)));
+ TYPE_FIELD_NAME (type, f) = TYPE_FIELD_NAME (templ_type, f);
+ }
+ else
+ {
+ TYPE_FIELD_TYPE (type, f) =
+ check_typedef (TYPE_FIELD_TYPE (templ_type, f));
+ TYPE_FIELD_NAME (type, f) = TYPE_FIELD_NAME (templ_type, f);
+ }
+ }
+
+ return type;
+}
+
+/* A revision of TYPE0 -- a non-dynamic-sized record with a variant
+ part -- in which the variant part is replaced with the appropriate
+ branch. */
+static struct type*
+to_record_with_fixed_variant_part (type, valaddr, address, dval)
+ struct type* type;
+ char* valaddr;
+ CORE_ADDR address;
+ struct value* dval;
+{
+ struct value* mark = value_mark();
+ struct type* rtype;
+ struct type *branch_type;
+ int nfields = TYPE_NFIELDS (type);
+
+ if (dval == NULL)
+ return type;
+
+ rtype = alloc_type (TYPE_OBJFILE (type));
+ TYPE_CODE (rtype) = TYPE_CODE_STRUCT;
+ INIT_CPLUS_SPECIFIC (type);
+ TYPE_NFIELDS (rtype) = TYPE_NFIELDS (type);
+ TYPE_FIELDS (rtype) =
+ (struct field*) TYPE_ALLOC (rtype, nfields * sizeof (struct field));
+ memcpy (TYPE_FIELDS (rtype), TYPE_FIELDS (type),
+ sizeof (struct field) * nfields);
+ TYPE_NAME (rtype) = ada_type_name (type);
+ TYPE_TAG_NAME (rtype) = NULL;
+ /* FIXME: TYPE_FLAG_FIXED_INSTANCE should be defined in gdbtypes.h */
+ /* TYPE_FLAGS (rtype) |= TYPE_FLAG_FIXED_INSTANCE; */
+ TYPE_LENGTH (rtype) = TYPE_LENGTH (type);
+
+ branch_type =
+ to_fixed_variant_branch_type
+ (TYPE_FIELD_TYPE (type, nfields - 1),
+ cond_offset_host (valaddr,
+ TYPE_FIELD_BITPOS (type, nfields-1) / TARGET_CHAR_BIT),
+ cond_offset_target (address,
+ TYPE_FIELD_BITPOS (type, nfields-1) / TARGET_CHAR_BIT),
+ dval);
+ if (branch_type == NULL)
+ {
+ TYPE_NFIELDS (rtype) -= 1;
+ TYPE_LENGTH (rtype) -= TYPE_LENGTH (TYPE_FIELD_TYPE (type, nfields - 1));
+ }
+ else
+ {
+ TYPE_FIELD_TYPE (rtype, nfields-1) = branch_type;
+ TYPE_FIELD_NAME (rtype, nfields-1) = "S";
+ TYPE_FIELD_BITSIZE (rtype, nfields-1) = 0;
+ TYPE_LENGTH (rtype) += TYPE_LENGTH (branch_type);
+ - TYPE_LENGTH (TYPE_FIELD_TYPE (type, nfields - 1));
+ }
+
+ return rtype;
+}
+
+/* An ordinary record type (with fixed-length fields) that describes
+ the value at (TYPE0, VALADDR, ADDRESS) [see explanation at
+ beginning of this section]. Any necessary discriminants' values
+ should be in DVAL, a record value; it should be NULL if the object
+ at ADDR itself contains any necessary discriminant values. A
+ variant field (unless unchecked) is replaced by a particular branch
+ of the variant. */
+
+static struct type*
+to_fixed_record_type (type0, valaddr, address, dval)
+ struct type* type0;
+ char* valaddr;
+ CORE_ADDR address;
+ struct value* dval;
+{
+ struct type* templ_type;
+
+ /* FIXME: TYPE_FLAG_FIXED_INSTANCE should be defined in gdbtypes.h */
+ /* if (TYPE_FLAGS (type0) & TYPE_FLAG_FIXED_INSTANCE)
+ return type0;
+ */
+ templ_type = dynamic_template_type (type0);
+
+ if (templ_type != NULL)
+ return template_to_fixed_record_type (templ_type, valaddr, address, dval);
+ else if (contains_variant_part (type0))
+ return to_record_with_fixed_variant_part (type0, valaddr, address, dval);
+ else
+ {
+ /* FIXME: TYPE_FLAG_FIXED_INSTANCE should be defined in gdbtypes.h */
+ /* TYPE_FLAGS (type0) |= TYPE_FLAG_FIXED_INSTANCE; */
+ return type0;
+ }
+
+}
+
+/* An ordinary record type (with fixed-length fields) that describes
+ the value at (VAR_TYPE0, VALADDR, ADDRESS), where VAR_TYPE0 is a
+ union type. Any necessary discriminants' values should be in DVAL,
+ a record value. That is, this routine selects the appropriate
+ branch of the union at ADDR according to the discriminant value
+ indicated in the union's type name. */
+
+static struct type*
+to_fixed_variant_branch_type (var_type0, valaddr, address, dval)
+ struct type* var_type0;
+ char* valaddr;
+ CORE_ADDR address;
+ struct value* dval;
+{
+ int which;
+ struct type* templ_type;
+ struct type* var_type;
+
+ if (TYPE_CODE (var_type0) == TYPE_CODE_PTR)
+ var_type = TYPE_TARGET_TYPE (var_type0);
+ else
+ var_type = var_type0;
+
+ templ_type = ada_find_parallel_type (var_type, "___XVU");
+
+ if (templ_type != NULL)
+ var_type = templ_type;
+
+ which =
+ ada_which_variant_applies (var_type,
+ VALUE_TYPE (dval), VALUE_CONTENTS (dval));
+
+ if (which < 0)
+ return empty_record (TYPE_OBJFILE (var_type));
+ else if (is_dynamic_field (var_type, which))
+ return
+ to_fixed_record_type
+ (TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (var_type, which)),
+ valaddr, address, dval);
+ else if (contains_variant_part (TYPE_FIELD_TYPE (var_type, which)))
+ return
+ to_fixed_record_type
+ (TYPE_FIELD_TYPE (var_type, which), valaddr, address, dval);
+ else
+ return TYPE_FIELD_TYPE (var_type, which);
+}
+
+/* Assuming that TYPE0 is an array type describing the type of a value
+ at ADDR, and that DVAL describes a record containing any
+ discriminants used in TYPE0, returns a type for the value that
+ contains no dynamic components (that is, no components whose sizes
+ are determined by run-time quantities). Unless IGNORE_TOO_BIG is
+ true, gives an error message if the resulting type's size is over
+ varsize_limit.
+*/
+
+static struct type*
+to_fixed_array_type (type0, dval, ignore_too_big)
+ struct type* type0;
+ struct value* dval;
+ int ignore_too_big;
+{
+ struct type* index_type_desc;
+ struct type* result;
+
+ /* FIXME: TYPE_FLAG_FIXED_INSTANCE should be defined in gdbtypes.h */
+ /* if (ada_is_packed_array_type (type0) /* revisit? */ /*
+ || (TYPE_FLAGS (type0) & TYPE_FLAG_FIXED_INSTANCE))
+ return type0;*/
+
+ index_type_desc = ada_find_parallel_type (type0, "___XA");
+ if (index_type_desc == NULL)
+ {
+ struct type *elt_type0 = check_typedef (TYPE_TARGET_TYPE (type0));
+ /* NOTE: elt_type---the fixed version of elt_type0---should never
+ * depend on the contents of the array in properly constructed
+ * debugging data. */
+ struct type *elt_type =
+ ada_to_fixed_type (elt_type0, 0, 0, dval);
+
+ if (elt_type0 == elt_type)
+ result = type0;
+ else
+ result = create_array_type (alloc_type (TYPE_OBJFILE (type0)),
+ elt_type, TYPE_INDEX_TYPE (type0));
+ }
+ else
+ {
+ int i;
+ struct type *elt_type0;
+
+ elt_type0 = type0;
+ for (i = TYPE_NFIELDS (index_type_desc); i > 0; i -= 1)
+ elt_type0 = TYPE_TARGET_TYPE (elt_type0);
+
+ /* NOTE: result---the fixed version of elt_type0---should never
+ * depend on the contents of the array in properly constructed
+ * debugging data. */
+ result =
+ ada_to_fixed_type (check_typedef (elt_type0), 0, 0, dval);
+ for (i = TYPE_NFIELDS (index_type_desc) - 1; i >= 0; i -= 1)
+ {
+ struct type *range_type =
+ to_fixed_range_type (TYPE_FIELD_NAME (index_type_desc, i),
+ dval, TYPE_OBJFILE (type0));
+ result = create_array_type (alloc_type (TYPE_OBJFILE (type0)),
+ result, range_type);
+ }
+ if (! ignore_too_big && TYPE_LENGTH (result) > varsize_limit)
+ error ("array type with dynamic size is larger than varsize-limit");
+ }
+
+/* FIXME: TYPE_FLAG_FIXED_INSTANCE should be defined in gdbtypes.h */
+/* TYPE_FLAGS (result) |= TYPE_FLAG_FIXED_INSTANCE; */
+ return result;
+}
+
+
+/* A standard type (containing no dynamically sized components)
+ corresponding to TYPE for the value (TYPE, VALADDR, ADDRESS)
+ DVAL describes a record containing any discriminants used in TYPE0,
+ and may be NULL if there are none. */
+
+struct type*
+ada_to_fixed_type (type, valaddr, address, dval)
+ struct type* type;
+ char* valaddr;
+ CORE_ADDR address;
+ struct value* dval;
+{
+ CHECK_TYPEDEF (type);
+ switch (TYPE_CODE (type)) {
+ default:
+ return type;
+ case TYPE_CODE_STRUCT:
+ return to_fixed_record_type (type, valaddr, address, NULL);
+ case TYPE_CODE_ARRAY:
+ return to_fixed_array_type (type, dval, 0);
+ case TYPE_CODE_UNION:
+ if (dval == NULL)
+ return type;
+ else
+ return to_fixed_variant_branch_type (type, valaddr, address, dval);
+ }
+}
+
+/* A standard (static-sized) type corresponding as well as possible to
+ TYPE0, but based on no runtime data. */
+
+static struct type*
+to_static_fixed_type (type0)
+ struct type* type0;
+{
+ struct type* type;
+
+ if (type0 == NULL)
+ return NULL;
+
+ /* FIXME: TYPE_FLAG_FIXED_INSTANCE should be defined in gdbtypes.h */
+ /* if (TYPE_FLAGS (type0) & TYPE_FLAG_FIXED_INSTANCE)
+ return type0;
+ */
+ CHECK_TYPEDEF (type0);
+
+ switch (TYPE_CODE (type0))
+ {
+ default:
+ return type0;
+ case TYPE_CODE_STRUCT:
+ type = dynamic_template_type (type0);
+ if (type != NULL)
+ return template_to_static_fixed_type (type);
+ return type0;
+ case TYPE_CODE_UNION:
+ type = ada_find_parallel_type (type0, "___XVU");
+ if (type != NULL)
+ return template_to_static_fixed_type (type);
+ return type0;
+ }
+}
+
+/* A static approximation of TYPE with all type wrappers removed. */
+static struct type*
+static_unwrap_type (type)
+ struct type* type;
+{
+ if (ada_is_aligner_type (type))
+ {
+ struct type* type1 = TYPE_FIELD_TYPE (check_typedef (type), 0);
+ if (ada_type_name (type1) == NULL)
+ TYPE_NAME (type1) = ada_type_name (type);
+
+ return static_unwrap_type (type1);
+ }
+ else
+ {
+ struct type* raw_real_type = ada_get_base_type (type);
+ if (raw_real_type == type)
+ return type;
+ else
+ return to_static_fixed_type (raw_real_type);
+ }
+}
+
+/* In some cases, incomplete and private types require
+ cross-references that are not resolved as records (for example,
+ type Foo;
+ type FooP is access Foo;
+ V: FooP;
+ type Foo is array ...;
+ ). In these cases, since there is no mechanism for producing
+ cross-references to such types, we instead substitute for FooP a
+ stub enumeration type that is nowhere resolved, and whose tag is
+ the name of the actual type. Call these types "non-record stubs". */
+
+/* A type equivalent to TYPE that is not a non-record stub, if one
+ exists, otherwise TYPE. */
+struct type*
+ada_completed_type (type)
+ struct type* type;
+{
+ CHECK_TYPEDEF (type);
+ if (type == NULL || TYPE_CODE (type) != TYPE_CODE_ENUM
+ || (TYPE_FLAGS (type) & TYPE_FLAG_STUB) == 0
+ || TYPE_TAG_NAME (type) == NULL)
+ return type;
+ else
+ {
+ char* name = TYPE_TAG_NAME (type);
+ struct type* type1 = ada_find_any_type (name);
+ return (type1 == NULL) ? type : type1;
+ }
+}
+
+/* A value representing the data at VALADDR/ADDRESS as described by
+ type TYPE0, but with a standard (static-sized) type that correctly
+ describes it. If VAL0 is not NULL and TYPE0 already is a standard
+ type, then return VAL0 [this feature is simply to avoid redundant
+ creation of struct values]. */
+
+struct value*
+ada_to_fixed_value (type0, valaddr, address, val0)
+ struct type* type0;
+ char* valaddr;
+ CORE_ADDR address;
+ struct value* val0;
+{
+ struct type* type = ada_to_fixed_type (type0, valaddr, address, NULL);
+ if (type == type0 && val0 != NULL)
+ return val0;
+ else return value_from_contents_and_address (type, valaddr, address);
+}
+
+/* A value representing VAL, but with a standard (static-sized) type
+ chosen to approximate the real type of VAL as well as possible, but
+ without consulting any runtime values. For Ada dynamic-sized
+ types, therefore, the type of the result is likely to be inaccurate. */
+
+struct value*
+ada_to_static_fixed_value (val)
+ struct value* val;
+{
+ struct type *type =
+ to_static_fixed_type (static_unwrap_type (VALUE_TYPE (val)));
+ if (type == VALUE_TYPE (val))
+ return val;
+ else
+ return coerce_unspec_val_to_type (val, 0, type);
+}
+
+
+
+
+
+/* Attributes */
+
+/* Table mapping attribute numbers to names */
+/* NOTE: Keep up to date with enum ada_attribute definition in ada-lang.h */
+
+static const char* attribute_names[] = {
+ "<?>",
+
+ "first",
+ "last",
+ "length",
+ "image",
+ "img",
+ "max",
+ "min",
+ "pos"
+ "tag",
+ "val",
+
+ 0
+};
+
+const char*
+ada_attribute_name (n)
+ int n;
+{
+ if (n > 0 && n < (int) ATR_END)
+ return attribute_names[n];
+ else
+ return attribute_names[0];
+}
+
+/* Evaluate the 'POS attribute applied to ARG. */
+
+static struct value*
+value_pos_atr (arg)
+ struct value* arg;
+{
+ struct type *type = VALUE_TYPE (arg);
+
+ if (! discrete_type_p (type))
+ error ("'POS only defined on discrete types");
+
+ if (TYPE_CODE (type) == TYPE_CODE_ENUM)
+ {
+ int i;
+ LONGEST v = value_as_long (arg);
+
+ for (i = 0; i < TYPE_NFIELDS (type); i += 1)
+ {
+ if (v == TYPE_FIELD_BITPOS (type, i))
+ return value_from_longest (builtin_type_ada_int, i);
+ }
+ error ("enumeration value is invalid: can't find 'POS");
+ }
+ else
+ return value_from_longest (builtin_type_ada_int, value_as_long (arg));
+}
+
+/* Evaluate the TYPE'VAL attribute applied to ARG. */
+
+static struct value*
+value_val_atr (type, arg)
+ struct type *type;
+ struct value* arg;
+{
+ if (! discrete_type_p (type))
+ error ("'VAL only defined on discrete types");
+ if (! integer_type_p (VALUE_TYPE (arg)))
+ error ("'VAL requires integral argument");
+
+ if (TYPE_CODE (type) == TYPE_CODE_ENUM)
+ {
+ long pos = value_as_long (arg);
+ if (pos < 0 || pos >= TYPE_NFIELDS (type))
+ error ("argument to 'VAL out of range");
+ return
+ value_from_longest (type, TYPE_FIELD_BITPOS (type, pos));
+ }
+ else
+ return value_from_longest (type, value_as_long (arg));
+}
+
+
+ /* Evaluation */
+
+/* True if TYPE appears to be an Ada character type.
+ * [At the moment, this is true only for Character and Wide_Character;
+ * It is a heuristic test that could stand improvement]. */
+
+int
+ada_is_character_type (type)
+ struct type* type;
+{
+ const char* name = ada_type_name (type);
+ return
+ name != NULL
+ && (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"));
+}
+
+/* True if TYPE appears to be an Ada string type. */
+
+int
+ada_is_string_type (type)
+ struct type *type;
+{
+ CHECK_TYPEDEF (type);
+ if (type != NULL
+ && TYPE_CODE (type) != TYPE_CODE_PTR
+ && (ada_is_simple_array (type) || ada_is_array_descriptor (type))
+ && ada_array_arity (type) == 1)
+ {
+ struct type *elttype = ada_array_element_type (type, 1);
+
+ return ada_is_character_type (elttype);
+ }
+ else
+ return 0;
+}
+
+
+/* True if TYPE is a struct type introduced by the compiler to force the
+ alignment of a value. Such types have a single field with a
+ distinctive name. */
+
+int
+ada_is_aligner_type (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"));
+}
+
+/* If there is an ___XVS-convention type parallel to SUBTYPE, return
+ the parallel type. */
+
+struct type*
+ada_get_base_type (raw_type)
+ struct type* raw_type;
+{
+ struct type* real_type_namer;
+ struct type* raw_real_type;
+ struct type* real_type;
+
+ if (raw_type == NULL || TYPE_CODE (raw_type) != TYPE_CODE_STRUCT)
+ return raw_type;
+
+ real_type_namer = ada_find_parallel_type (raw_type, "___XVS");
+ if (real_type_namer == NULL
+ || TYPE_CODE (real_type_namer) != TYPE_CODE_STRUCT
+ || TYPE_NFIELDS (real_type_namer) != 1)
+ return raw_type;
+
+ raw_real_type = ada_find_any_type (TYPE_FIELD_NAME (real_type_namer, 0));
+ if (raw_real_type == NULL)
+ return raw_type;
+ else
+ return raw_real_type;
+}
+
+/* The type of value designated by TYPE, with all aligners removed. */
+
+struct type*
+ada_aligned_type (type)
+ struct type* type;
+{
+ if (ada_is_aligner_type (type))
+ return ada_aligned_type (TYPE_FIELD_TYPE (type, 0));
+ else
+ return ada_get_base_type (type);
+}
+
+
+/* The address of the aligned value in an object at address VALADDR
+ having type TYPE. Assumes ada_is_aligner_type (TYPE). */
+
+char*
+ada_aligned_value_addr (type, valaddr)
+ struct type *type;
+ char *valaddr;
+{
+ if (ada_is_aligner_type (type))
+ return ada_aligned_value_addr (TYPE_FIELD_TYPE (type, 0),
+ valaddr +
+ TYPE_FIELD_BITPOS (type, 0)/TARGET_CHAR_BIT);
+ else
+ return valaddr;
+}
+
+/* The printed representation of an enumeration literal with encoded
+ name NAME. The value is good to the next call of ada_enum_name. */
+const char*
+ada_enum_name (name)
+ const char* name;
+{
+ char* tmp;
+
+ while (1)
+ {
+ if ((tmp = strstr (name, "__")) != NULL)
+ name = tmp+2;
+ else if ((tmp = strchr (name, '.')) != NULL)
+ name = tmp+1;
+ else
+ break;
+ }
+
+ if (name[0] == 'Q')
+ {
+ static char result[16];
+ int v;
+ if (name[1] == 'U' || name[1] == 'W')
+ {
+ if (sscanf (name+2, "%x", &v) != 1)
+ return name;
+ }
+ else
+ return name;
+
+ if (isascii (v) && isprint (v))
+ sprintf (result, "'%c'", v);
+ else if (name[1] == 'U')
+ sprintf (result, "[\"%02x\"]", v);
+ else
+ sprintf (result, "[\"%04x\"]", v);
+
+ return result;
+ }
+ else
+ return name;
+}
+
+static struct value*
+evaluate_subexp (expect_type, exp, pos, noside)
+ struct type *expect_type;
+ struct expression *exp;
+ int *pos;
+ enum noside noside;
+{
+ return (*exp->language_defn->evaluate_exp) (expect_type, exp, pos, noside);
+}
+
+/* Evaluate the subexpression of EXP starting at *POS as for
+ evaluate_type, updating *POS to point just past the evaluated
+ expression. */
+
+static struct value*
+evaluate_subexp_type (exp, pos)
+ struct expression* exp;
+ int* pos;
+{
+ return (*exp->language_defn->evaluate_exp)
+ (NULL_TYPE, exp, pos, EVAL_AVOID_SIDE_EFFECTS);
+}
+
+/* If VAL is wrapped in an aligner or subtype wrapper, return the
+ value it wraps. */
+
+static struct value*
+unwrap_value (val)
+ struct value* val;
+{
+ struct type* type = check_typedef (VALUE_TYPE (val));
+ if (ada_is_aligner_type (type))
+ {
+ struct value* v = value_struct_elt (&val, NULL, "F",
+ NULL, "internal structure");
+ struct type* val_type = check_typedef (VALUE_TYPE (v));
+ if (ada_type_name (val_type) == NULL)
+ TYPE_NAME (val_type) = ada_type_name (type);
+
+ return unwrap_value (v);
+ }
+ else
+ {
+ struct type* raw_real_type =
+ ada_completed_type (ada_get_base_type (type));
+
+ if (type == raw_real_type)
+ return val;
+
+ return
+ coerce_unspec_val_to_type
+ (val, 0, ada_to_fixed_type (raw_real_type, 0,
+ VALUE_ADDRESS (val) + VALUE_OFFSET (val),
+ NULL));
+ }
+}
+
+static struct value*
+cast_to_fixed (type, arg)
+ struct type *type;
+ struct value* arg;
+{
+ LONGEST val;
+
+ if (type == VALUE_TYPE (arg))
+ return arg;
+ else if (ada_is_fixed_point_type (VALUE_TYPE (arg)))
+ val = ada_float_to_fixed (type,
+ ada_fixed_to_float (VALUE_TYPE (arg),
+ value_as_long (arg)));
+ else
+ {
+ DOUBLEST argd =
+ value_as_double (value_cast (builtin_type_double, value_copy (arg)));
+ val = ada_float_to_fixed (type, argd);
+ }
+
+ return value_from_longest (type, val);
+}
+
+static struct value*
+cast_from_fixed_to_double (arg)
+ struct value* arg;
+{
+ DOUBLEST val = ada_fixed_to_float (VALUE_TYPE (arg),
+ value_as_long (arg));
+ return value_from_double (builtin_type_double, val);
+}
+
+/* Coerce VAL as necessary for assignment to an lval of type TYPE, and
+ * return the converted value. */
+static struct value*
+coerce_for_assign (type, val)
+ struct type* type;
+ struct value* val;
+{
+ struct type* type2 = VALUE_TYPE (val);
+ if (type == type2)
+ return val;
+
+ CHECK_TYPEDEF (type2);
+ CHECK_TYPEDEF (type);
+
+ if (TYPE_CODE (type2) == TYPE_CODE_PTR && TYPE_CODE (type) == TYPE_CODE_ARRAY)
+ {
+ val = ada_value_ind (val);
+ type2 = VALUE_TYPE (val);
+ }
+
+ if (TYPE_CODE (type2) == TYPE_CODE_ARRAY
+ && TYPE_CODE (type) == TYPE_CODE_ARRAY)
+ {
+ if (TYPE_LENGTH (type2) != TYPE_LENGTH (type)
+ || TYPE_LENGTH (TYPE_TARGET_TYPE (type2))
+ != TYPE_LENGTH (TYPE_TARGET_TYPE (type2)))
+ error ("Incompatible types in assignment");
+ VALUE_TYPE (val) = type;
+ }
+ return val;
+}
+
+struct value*
+ada_evaluate_subexp (expect_type, exp, pos, noside)
+ struct type *expect_type;
+ struct expression *exp;
+ int *pos;
+ enum noside noside;
+{
+ enum exp_opcode op;
+ enum ada_attribute atr;
+ int tem, tem2, tem3;
+ int pc;
+ struct value *arg1 = NULL, *arg2 = NULL, *arg3;
+ struct type *type;
+ int nargs;
+ struct value* *argvec;
+
+ pc = *pos; *pos += 1;
+ op = exp->elts[pc].opcode;
+
+ switch (op)
+ {
+ default:
+ *pos -= 1;
+ return unwrap_value (evaluate_subexp_standard (expect_type, exp, pos, noside));
+
+ case UNOP_CAST:
+ (*pos) += 2;
+ type = exp->elts[pc + 1].type;
+ arg1 = evaluate_subexp (type, exp, pos, noside);
+ if (noside == EVAL_SKIP)
+ goto nosideret;
+ if (type != check_typedef (VALUE_TYPE (arg1)))
+ {
+ if (ada_is_fixed_point_type (type))
+ arg1 = cast_to_fixed (type, arg1);
+ else if (ada_is_fixed_point_type (VALUE_TYPE (arg1)))
+ arg1 = value_cast (type, cast_from_fixed_to_double (arg1));
+ else if (VALUE_LVAL (arg1) == lval_memory)
+ {
+ /* This is in case of the really obscure (and undocumented,
+ but apparently expected) case of (Foo) Bar.all, where Bar
+ is an integer constant and Foo is a dynamic-sized type.
+ If we don't do this, ARG1 will simply be relabeled with
+ TYPE. */
+ if (noside == EVAL_AVOID_SIDE_EFFECTS)
+ return value_zero (to_static_fixed_type (type), not_lval);
+ arg1 =
+ ada_to_fixed_value
+ (type, 0, VALUE_ADDRESS (arg1) + VALUE_OFFSET (arg1), 0);
+ }
+ else
+ arg1 = value_cast (type, arg1);
+ }
+ return arg1;
+
+ /* FIXME: UNOP_QUAL should be defined in expression.h */
+ /* case UNOP_QUAL:
+ (*pos) += 2;
+ type = exp->elts[pc + 1].type;
+ return ada_evaluate_subexp (type, exp, pos, noside);
+ */
+ case BINOP_ASSIGN:
+ arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
+ arg2 = evaluate_subexp (VALUE_TYPE (arg1), exp, pos, noside);
+ if (noside == EVAL_SKIP || noside == EVAL_AVOID_SIDE_EFFECTS)
+ return arg1;
+ if (binop_user_defined_p (op, arg1, arg2))
+ return value_x_binop (arg1, arg2, op, OP_NULL, EVAL_NORMAL);
+ else
+ {
+ if (ada_is_fixed_point_type (VALUE_TYPE (arg1)))
+ arg2 = cast_to_fixed (VALUE_TYPE (arg1), arg2);
+ else if (ada_is_fixed_point_type (VALUE_TYPE (arg2)))
+ error ("Fixed-point values must be assigned to fixed-point variables");
+ else
+ arg2 = coerce_for_assign (VALUE_TYPE (arg1), arg2);
+ return ada_value_assign (arg1, arg2);
+ }
+
+ case BINOP_ADD:
+ arg1 = evaluate_subexp_with_coercion (exp, pos, noside);
+ arg2 = evaluate_subexp_with_coercion (exp, pos, noside);
+ if (noside == EVAL_SKIP)
+ goto nosideret;
+ if (binop_user_defined_p (op, arg1, arg2))
+ return value_x_binop (arg1, arg2, op, OP_NULL, EVAL_NORMAL);
+ else
+ {
+ if ((ada_is_fixed_point_type (VALUE_TYPE (arg1))
+ || ada_is_fixed_point_type (VALUE_TYPE (arg2)))
+ && VALUE_TYPE (arg1) != VALUE_TYPE (arg2))
+ error ("Operands of fixed-point addition must have the same type");
+ return value_cast (VALUE_TYPE (arg1), value_add (arg1, arg2));
+ }
+
+ case BINOP_SUB:
+ arg1 = evaluate_subexp_with_coercion (exp, pos, noside);
+ arg2 = evaluate_subexp_with_coercion (exp, pos, noside);
+ if (noside == EVAL_SKIP)
+ goto nosideret;
+ if (binop_user_defined_p (op, arg1, arg2))
+ return value_x_binop (arg1, arg2, op, OP_NULL, EVAL_NORMAL);
+ else
+ {
+ if ((ada_is_fixed_point_type (VALUE_TYPE (arg1))
+ || ada_is_fixed_point_type (VALUE_TYPE (arg2)))
+ && VALUE_TYPE (arg1) != VALUE_TYPE (arg2))
+ error ("Operands of fixed-point subtraction must have the same type");
+ return value_cast (VALUE_TYPE (arg1), value_sub (arg1, arg2));
+ }
+
+ case BINOP_MUL:
+ case BINOP_DIV:
+ arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
+ arg2 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
+ if (noside == EVAL_SKIP)
+ goto nosideret;
+ if (binop_user_defined_p (op, arg1, arg2))
+ return value_x_binop (arg1, arg2, op, OP_NULL, EVAL_NORMAL);
+ else
+ if (noside == EVAL_AVOID_SIDE_EFFECTS
+ && (op == BINOP_DIV || op == BINOP_REM || op == BINOP_MOD))
+ return value_zero (VALUE_TYPE (arg1), not_lval);
+ else
+ {
+ if (ada_is_fixed_point_type (VALUE_TYPE (arg1)))
+ arg1 = cast_from_fixed_to_double (arg1);
+ if (ada_is_fixed_point_type (VALUE_TYPE (arg2)))
+ arg2 = cast_from_fixed_to_double (arg2);
+ return value_binop (arg1, arg2, op);
+ }
+
+ case UNOP_NEG:
+ arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
+ if (noside == EVAL_SKIP)
+ goto nosideret;
+ if (unop_user_defined_p (op, arg1))
+ return value_x_unop (arg1, op, EVAL_NORMAL);
+ else if (ada_is_fixed_point_type (VALUE_TYPE (arg1)))
+ return value_cast (VALUE_TYPE (arg1), value_neg (arg1));
+ else
+ return value_neg (arg1);
+
+ /* FIXME: OP_UNRESOLVED_VALUE should be defined in expression.h */
+ /* case OP_UNRESOLVED_VALUE:
+ /* Only encountered when an unresolved symbol occurs in a
+ context other than a function call, in which case, it is
+ illegal. *//*
+ (*pos) += 3;
+ if (noside == EVAL_SKIP)
+ goto nosideret;
+ else
+ error ("Unexpected unresolved symbol, %s, during evaluation",
+ ada_demangle (exp->elts[pc + 2].name));
+ */
+ case OP_VAR_VALUE:
+ *pos -= 1;
+ if (noside == EVAL_SKIP)
+ {
+ *pos += 4;
+ goto nosideret;
+ }
+ else if (noside == EVAL_AVOID_SIDE_EFFECTS)
+ {
+ *pos += 4;
+ return value_zero
+ (to_static_fixed_type
+ (static_unwrap_type (SYMBOL_TYPE (exp->elts[pc+2].symbol))),
+ not_lval);
+ }
+ else
+ {
+ arg1 = unwrap_value (evaluate_subexp_standard (expect_type, exp, pos,
+ noside));
+ return ada_to_fixed_value (VALUE_TYPE (arg1), 0,
+ VALUE_ADDRESS (arg1) + VALUE_OFFSET(arg1),
+ arg1);
+ }
+
+ case OP_ARRAY:
+ (*pos) += 3;
+ tem2 = longest_to_int (exp->elts[pc + 1].longconst);
+ tem3 = longest_to_int (exp->elts[pc + 2].longconst);
+ nargs = tem3 - tem2 + 1;
+ type = expect_type ? check_typedef (expect_type) : NULL_TYPE;
+
+ argvec = (struct value* *) alloca (sizeof (struct value*) * (nargs + 1));
+ for (tem = 0; tem == 0 || tem < nargs; tem += 1)
+ /* At least one element gets inserted for the type */
+ {
+ /* Ensure that array expressions are coerced into pointer objects. */
+ argvec[tem] = evaluate_subexp_with_coercion (exp, pos, noside);
+ }
+ if (noside == EVAL_SKIP)
+ goto nosideret;
+ return value_array (tem2, tem3, argvec);
+
+ case OP_FUNCALL:
+ (*pos) += 2;
+
+ /* Allocate arg vector, including space for the function to be
+ called in argvec[0] and a terminating NULL */
+ nargs = longest_to_int (exp->elts[pc + 1].longconst);
+ argvec = (struct value* *) alloca (sizeof (struct value*) * (nargs + 2));
+
+ /* FIXME: OP_UNRESOLVED_VALUE should be defined in expression.h */
+ /* FIXME: name should be defined in expresion.h */
+ /* if (exp->elts[*pos].opcode == OP_UNRESOLVED_VALUE)
+ error ("Unexpected unresolved symbol, %s, during evaluation",
+ ada_demangle (exp->elts[pc + 5].name));
+ */
+ if (0)
+ {
+ error ("unexpected code path, FIXME");
+ }
+ else
+ {
+ for (tem = 0; tem <= nargs; tem += 1)
+ argvec[tem] = evaluate_subexp (NULL_TYPE, exp, pos, noside);
+ argvec[tem] = 0;
+
+ if (noside == EVAL_SKIP)
+ goto nosideret;
+ }
+
+ if (TYPE_CODE (VALUE_TYPE (argvec[0])) == TYPE_CODE_REF)
+ argvec[0] = value_addr (argvec[0]);
+
+ if (ada_is_packed_array_type (VALUE_TYPE (argvec[0])))
+ argvec[0] = ada_coerce_to_simple_array (argvec[0]);
+
+ type = check_typedef (VALUE_TYPE (argvec[0]));
+ if (TYPE_CODE (type) == TYPE_CODE_PTR)
+ {
+ switch (TYPE_CODE (check_typedef (TYPE_TARGET_TYPE (type))))
+ {
+ case TYPE_CODE_FUNC:
+ type = check_typedef (TYPE_TARGET_TYPE (type));
+ break;
+ case TYPE_CODE_ARRAY:
+ break;
+ case TYPE_CODE_STRUCT:
+ if (noside != EVAL_AVOID_SIDE_EFFECTS)
+ argvec[0] = ada_value_ind (argvec[0]);
+ type = check_typedef (TYPE_TARGET_TYPE (type));
+ break;
+ default:
+ error ("cannot subscript or call something of type `%s'",
+ ada_type_name (VALUE_TYPE (argvec[0])));
+ break;
+ }
+ }
+
+ switch (TYPE_CODE (type))
+ {
+ case TYPE_CODE_FUNC:
+ if (noside == EVAL_AVOID_SIDE_EFFECTS)
+ return allocate_value (TYPE_TARGET_TYPE (type));
+ return call_function_by_hand (argvec[0], nargs, argvec + 1);
+ case TYPE_CODE_STRUCT:
+ {
+ int arity = ada_array_arity (type);
+ type = ada_array_element_type (type, nargs);
+ if (type == NULL)
+ error ("cannot subscript or call a record");
+ if (arity != nargs)
+ error ("wrong number of subscripts; expecting %d", arity);
+ if (noside == EVAL_AVOID_SIDE_EFFECTS)
+ return allocate_value (ada_aligned_type (type));
+ return unwrap_value (ada_value_subscript (argvec[0], nargs, argvec+1));
+ }
+ case TYPE_CODE_ARRAY:
+ if (noside == EVAL_AVOID_SIDE_EFFECTS)
+ {
+ type = ada_array_element_type (type, nargs);
+ if (type == NULL)
+ error ("element type of array unknown");
+ else
+ return allocate_value (ada_aligned_type (type));
+ }
+ return
+ unwrap_value (ada_value_subscript
+ (ada_coerce_to_simple_array (argvec[0]),
+ nargs, argvec+1));
+ case TYPE_CODE_PTR: /* Pointer to array */
+ type = to_fixed_array_type (TYPE_TARGET_TYPE (type), NULL, 1);
+ if (noside == EVAL_AVOID_SIDE_EFFECTS)
+ {
+ type = ada_array_element_type (type, nargs);
+ if (type == NULL)
+ error ("element type of array unknown");
+ else
+ return allocate_value (ada_aligned_type (type));
+ }
+ return
+ unwrap_value (ada_value_ptr_subscript (argvec[0], type,
+ nargs, argvec+1));
+
+ default:
+ error ("Internal error in evaluate_subexp");
+ }
+
+ case TERNOP_SLICE:
+ {
+ struct value* array = evaluate_subexp (NULL_TYPE, exp, pos, noside);
+ int lowbound
+ = value_as_long (evaluate_subexp (NULL_TYPE, exp, pos, noside));
+ int upper
+ = value_as_long (evaluate_subexp (NULL_TYPE, exp, pos, noside));
+ if (noside == EVAL_SKIP)
+ goto nosideret;
+
+ /* If this is a reference to an array, then dereference it */
+ if (TYPE_CODE (VALUE_TYPE (array)) == TYPE_CODE_REF
+ && TYPE_TARGET_TYPE (VALUE_TYPE (array)) != NULL
+ && TYPE_CODE (TYPE_TARGET_TYPE (VALUE_TYPE (array))) ==
+ TYPE_CODE_ARRAY
+ && !ada_is_array_descriptor (check_typedef (VALUE_TYPE
+ (array))))
+ {
+ array = ada_coerce_ref (array);
+ }
+
+ if (noside == EVAL_AVOID_SIDE_EFFECTS &&
+ ada_is_array_descriptor (check_typedef (VALUE_TYPE (array))))
+ {
+ /* Try to dereference the array, in case it is an access to array */
+ struct type * arrType = ada_type_of_array (array, 0);
+ if (arrType != NULL)
+ array = value_at_lazy (arrType, 0, NULL);
+ }
+ if (ada_is_array_descriptor (VALUE_TYPE (array)))
+ array = ada_coerce_to_simple_array (array);
+
+ /* If at this point we have a pointer to an array, it means that
+ it is a pointer to a simple (non-ada) array. We just then
+ dereference it */
+ if (TYPE_CODE (VALUE_TYPE (array)) == TYPE_CODE_PTR
+ && TYPE_TARGET_TYPE (VALUE_TYPE (array)) != NULL
+ && TYPE_CODE (TYPE_TARGET_TYPE (VALUE_TYPE (array))) ==
+ TYPE_CODE_ARRAY)
+ {
+ array = ada_value_ind (array);
+ }
+
+ if (noside == EVAL_AVOID_SIDE_EFFECTS)
+ /* The following will get the bounds wrong, but only in contexts
+ where the value is not being requested (FIXME?). */
+ return array;
+ else
+ return value_slice (array, lowbound, upper - lowbound + 1);
+ }
+
+ /* FIXME: UNOP_MBR should be defined in expression.h */
+ /* case UNOP_MBR:
+ (*pos) += 2;
+ arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
+ type = exp->elts[pc + 1].type;
+
+ if (noside == EVAL_SKIP)
+ goto nosideret;
+
+ switch (TYPE_CODE (type))
+ {
+ default:
+ warning ("Membership test incompletely implemented; always returns true");
+ return value_from_longest (builtin_type_int, (LONGEST) 1);
+
+ case TYPE_CODE_RANGE:
+ arg2 = value_from_longest (builtin_type_int,
+ (LONGEST) TYPE_LOW_BOUND (type));
+ arg3 = value_from_longest (builtin_type_int,
+ (LONGEST) TYPE_HIGH_BOUND (type));
+ return
+ value_from_longest (builtin_type_int,
+ (value_less (arg1,arg3)
+ || value_equal (arg1,arg3))
+ && (value_less (arg2,arg1)
+ || value_equal (arg2,arg1)));
+ }
+ */
+ /* FIXME: BINOP_MBR should be defined in expression.h */
+ /* case BINOP_MBR:
+ (*pos) += 2;
+ arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
+ arg2 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
+
+ if (noside == EVAL_SKIP)
+ goto nosideret;
+
+ if (noside == EVAL_AVOID_SIDE_EFFECTS)
+ return value_zero (builtin_type_int, not_lval);
+
+ tem = longest_to_int (exp->elts[pc + 1].longconst);
+
+ if (tem < 1 || tem > ada_array_arity (VALUE_TYPE (arg2)))
+ error ("invalid dimension number to '%s", "range");
+
+ arg3 = ada_array_bound (arg2, tem, 1);
+ arg2 = ada_array_bound (arg2, tem, 0);
+
+ return
+ value_from_longest (builtin_type_int,
+ (value_less (arg1,arg3)
+ || value_equal (arg1,arg3))
+ && (value_less (arg2,arg1)
+ || value_equal (arg2,arg1)));
+ */
+ /* FIXME: TERNOP_MBR should be defined in expression.h */
+ /* case TERNOP_MBR:
+ arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
+ arg2 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
+ arg3 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
+
+ if (noside == EVAL_SKIP)
+ goto nosideret;
+
+ return
+ value_from_longest (builtin_type_int,
+ (value_less (arg1,arg3)
+ || value_equal (arg1,arg3))
+ && (value_less (arg2,arg1)
+ || value_equal (arg2,arg1)));
+ */
+ /* FIXME: OP_ATTRIBUTE should be defined in expression.h */
+ /* case OP_ATTRIBUTE:
+ *pos += 3;
+ atr = (enum ada_attribute) longest_to_int (exp->elts[pc + 2].longconst);
+ switch (atr)
+ {
+ default:
+ error ("unexpected attribute encountered");
+
+ case ATR_FIRST:
+ case ATR_LAST:
+ case ATR_LENGTH:
+ {
+ struct type* type_arg;
+ if (exp->elts[*pos].opcode == OP_TYPE)
+ {
+ evaluate_subexp (NULL_TYPE, exp, pos, EVAL_SKIP);
+ arg1 = NULL;
+ type_arg = exp->elts[pc + 5].type;
+ }
+ else
+ {
+ arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
+ type_arg = NULL;
+ }
+
+ if (exp->elts[*pos].opcode != OP_LONG)
+ error ("illegal operand to '%s", ada_attribute_name (atr));
+ tem = longest_to_int (exp->elts[*pos+2].longconst);
+ *pos += 4;
+
+ if (noside == EVAL_SKIP)
+ goto nosideret;
+
+ if (type_arg == NULL)
+ {
+ arg1 = ada_coerce_ref (arg1);
+
+ if (ada_is_packed_array_type (VALUE_TYPE (arg1)))
+ arg1 = ada_coerce_to_simple_array (arg1);
+
+ if (tem < 1 || tem > ada_array_arity (VALUE_TYPE (arg1)))
+ error ("invalid dimension number to '%s",
+ ada_attribute_name (atr));
+
+ if (noside == EVAL_AVOID_SIDE_EFFECTS)
+ {
+ type = ada_index_type (VALUE_TYPE (arg1), tem);
+ if (type == NULL)
+ error ("attempt to take bound of something that is not an array");
+ return allocate_value (type);
+ }
+
+ switch (atr)
+ {
+ default:
+ error ("unexpected attribute encountered");
+ case ATR_FIRST:
+ return ada_array_bound (arg1, tem, 0);
+ case ATR_LAST:
+ return ada_array_bound (arg1, tem, 1);
+ case ATR_LENGTH:
+ return ada_array_length (arg1, tem);
+ }
+ }
+ else if (TYPE_CODE (type_arg) == TYPE_CODE_RANGE
+ || TYPE_CODE (type_arg) == TYPE_CODE_INT)
+ {
+ struct type* range_type;
+ char* name = ada_type_name (type_arg);
+ if (name == NULL)
+ {
+ if (TYPE_CODE (type_arg) == TYPE_CODE_RANGE)
+ range_type = type_arg;
+ else
+ error ("unimplemented type attribute");
+ }
+ else
+ range_type =
+ to_fixed_range_type (name, NULL, TYPE_OBJFILE (type_arg));
+ switch (atr)
+ {
+ default:
+ error ("unexpected attribute encountered");
+ case ATR_FIRST:
+ return value_from_longest (TYPE_TARGET_TYPE (range_type),
+ TYPE_LOW_BOUND (range_type));
+ case ATR_LAST:
+ return value_from_longest (TYPE_TARGET_TYPE (range_type),
+ TYPE_HIGH_BOUND (range_type));
+ }
+ }
+ else if (TYPE_CODE (type_arg) == TYPE_CODE_ENUM)
+ {
+ switch (atr)
+ {
+ default:
+ error ("unexpected attribute encountered");
+ case ATR_FIRST:
+ return value_from_longest
+ (type_arg, TYPE_FIELD_BITPOS (type_arg, 0));
+ case ATR_LAST:
+ return value_from_longest
+ (type_arg,
+ TYPE_FIELD_BITPOS (type_arg,
+ TYPE_NFIELDS (type_arg) - 1));
+ }
+ }
+ else if (TYPE_CODE (type_arg) == TYPE_CODE_FLT)
+ error ("unimplemented type attribute");
+ else
+ {
+ LONGEST low, high;
+
+ if (ada_is_packed_array_type (type_arg))
+ type_arg = decode_packed_array_type (type_arg);
+
+ if (tem < 1 || tem > ada_array_arity (type_arg))
+ error ("invalid dimension number to '%s",
+ ada_attribute_name (atr));
+
+ if (noside == EVAL_AVOID_SIDE_EFFECTS)
+ {
+ type = ada_index_type (type_arg, tem);
+ if (type == NULL)
+ error ("attempt to take bound of something that is not an array");
+ return allocate_value (type);
+ }
+
+ switch (atr)
+ {
+ default:
+ error ("unexpected attribute encountered");
+ case ATR_FIRST:
+ low = ada_array_bound_from_type (type_arg, tem, 0, &type);
+ return value_from_longest (type, low);
+ case ATR_LAST:
+ high = ada_array_bound_from_type (type_arg, tem, 1, &type);
+ return value_from_longest (type, high);
+ case ATR_LENGTH:
+ low = ada_array_bound_from_type (type_arg, tem, 0, &type);
+ high = ada_array_bound_from_type (type_arg, tem, 1, NULL);
+ return value_from_longest (type, high-low+1);
+ }
+ }
+ }
+
+ case ATR_TAG:
+ arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
+ if (noside == EVAL_SKIP)
+ goto nosideret;
+
+ if (noside == EVAL_AVOID_SIDE_EFFECTS)
+ return
+ value_zero (ada_tag_type (arg1), not_lval);
+
+ return ada_value_tag (arg1);
+
+ case ATR_MIN:
+ case ATR_MAX:
+ evaluate_subexp (NULL_TYPE, exp, pos, EVAL_SKIP);
+ arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
+ arg2 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
+ if (noside == EVAL_SKIP)
+ goto nosideret;
+ else if (noside == EVAL_AVOID_SIDE_EFFECTS)
+ return value_zero (VALUE_TYPE (arg1), not_lval);
+ else
+ return value_binop (arg1, arg2,
+ atr == ATR_MIN ? BINOP_MIN : BINOP_MAX);
+
+ case ATR_MODULUS:
+ {
+ struct type* type_arg = exp->elts[pc + 5].type;
+ evaluate_subexp (NULL_TYPE, exp, pos, EVAL_SKIP);
+ *pos += 4;
+
+ if (noside == EVAL_SKIP)
+ goto nosideret;
+
+ if (! ada_is_modular_type (type_arg))
+ error ("'modulus must be applied to modular type");
+
+ return value_from_longest (TYPE_TARGET_TYPE (type_arg),
+ ada_modulus (type_arg));
+ }
+
+
+ case ATR_POS:
+ evaluate_subexp (NULL_TYPE, exp, pos, EVAL_SKIP);
+ arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
+ if (noside == EVAL_SKIP)
+ goto nosideret;
+ else if (noside == EVAL_AVOID_SIDE_EFFECTS)
+ return value_zero (builtin_type_ada_int, not_lval);
+ else
+ return value_pos_atr (arg1);
+
+ case ATR_SIZE:
+ arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
+ if (noside == EVAL_SKIP)
+ goto nosideret;
+ else if (noside == EVAL_AVOID_SIDE_EFFECTS)
+ return value_zero (builtin_type_ada_int, not_lval);
+ else
+ return value_from_longest (builtin_type_ada_int,
+ TARGET_CHAR_BIT
+ * TYPE_LENGTH (VALUE_TYPE (arg1)));
+
+ case ATR_VAL:
+ evaluate_subexp (NULL_TYPE, exp, pos, EVAL_SKIP);
+ arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
+ type = exp->elts[pc + 5].type;
+ if (noside == EVAL_SKIP)
+ goto nosideret;
+ else if (noside == EVAL_AVOID_SIDE_EFFECTS)
+ return value_zero (type, not_lval);
+ else
+ return value_val_atr (type, arg1);
+ }*/
+ case BINOP_EXP:
+ arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
+ arg2 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
+ if (noside == EVAL_SKIP)
+ goto nosideret;
+ if (binop_user_defined_p (op, arg1, arg2))
+ return unwrap_value (value_x_binop (arg1, arg2, op, OP_NULL,
+ EVAL_NORMAL));
+ else
+ if (noside == EVAL_AVOID_SIDE_EFFECTS)
+ return value_zero (VALUE_TYPE (arg1), not_lval);
+ else
+ return value_binop (arg1, arg2, op);
+
+ case UNOP_PLUS:
+ arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
+ if (noside == EVAL_SKIP)
+ goto nosideret;
+ if (unop_user_defined_p (op, arg1))
+ return unwrap_value (value_x_unop (arg1, op, EVAL_NORMAL));
+ else
+ return arg1;
+
+ case UNOP_ABS:
+ arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
+ if (noside == EVAL_SKIP)
+ goto nosideret;
+ if (value_less (arg1, value_zero (VALUE_TYPE (arg1), not_lval)))
+ return value_neg (arg1);
+ else
+ return arg1;
+
+ case UNOP_IND:
+ if (expect_type && TYPE_CODE (expect_type) == TYPE_CODE_PTR)
+ expect_type = TYPE_TARGET_TYPE (check_typedef (expect_type));
+ arg1 = evaluate_subexp (expect_type, exp, pos, noside);
+ if (noside == EVAL_SKIP)
+ goto nosideret;
+ type = check_typedef (VALUE_TYPE (arg1));
+ if (noside == EVAL_AVOID_SIDE_EFFECTS)
+ {
+ if (ada_is_array_descriptor (type))
+ /* GDB allows dereferencing GNAT array descriptors. */
+ {
+ struct type* arrType = ada_type_of_array (arg1, 0);
+ if (arrType == NULL)
+ error ("Attempt to dereference null array pointer.");
+ return value_at_lazy (arrType, 0, NULL);
+ }
+ else if (TYPE_CODE (type) == TYPE_CODE_PTR
+ || TYPE_CODE (type) == TYPE_CODE_REF
+ /* In C you can dereference an array to get the 1st elt. */
+ || TYPE_CODE (type) == TYPE_CODE_ARRAY
+ )
+ return
+ value_zero
+ (to_static_fixed_type
+ (ada_aligned_type (check_typedef (TYPE_TARGET_TYPE (type)))),
+ lval_memory);
+ else if (TYPE_CODE (type) == TYPE_CODE_INT)
+ /* GDB allows dereferencing an int. */
+ return value_zero (builtin_type_int, lval_memory);
+ else
+ error ("Attempt to take contents of a non-pointer value.");
+ }
+ arg1 = ada_coerce_ref (arg1);
+ type = check_typedef (VALUE_TYPE (arg1));
+
+ if (ada_is_array_descriptor (type))
+ /* GDB allows dereferencing GNAT array descriptors. */
+ return ada_coerce_to_simple_array (arg1);
+ else
+ return ada_value_ind (arg1);
+
+ case STRUCTOP_STRUCT:
+ tem = longest_to_int (exp->elts[pc + 1].longconst);
+ (*pos) += 3 + BYTES_TO_EXP_ELEM (tem + 1);
+ arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
+ if (noside == EVAL_SKIP)
+ goto nosideret;
+ if (noside == EVAL_AVOID_SIDE_EFFECTS)
+ return value_zero (ada_aligned_type
+ (ada_lookup_struct_elt_type (VALUE_TYPE (arg1),
+ &exp->elts[pc + 2].string,
+ 0, NULL)),
+ lval_memory);
+ else
+ return unwrap_value (ada_value_struct_elt (arg1,
+ &exp->elts[pc + 2].string,
+ "record"));
+ case OP_TYPE:
+ /* The value is not supposed to be used. This is here to make it
+ easier to accommodate expressions that contain types. */
+ (*pos) += 2;
+ if (noside == EVAL_SKIP)
+ goto nosideret;
+ else if (noside == EVAL_AVOID_SIDE_EFFECTS)
+ return allocate_value (builtin_type_void);
+ else
+ error ("Attempt to use a type name as an expression");
+
+ case STRUCTOP_PTR:
+ tem = longest_to_int (exp->elts[pc + 1].longconst);
+ (*pos) += 3 + BYTES_TO_EXP_ELEM (tem + 1);
+ arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
+ if (noside == EVAL_SKIP)
+ goto nosideret;
+ if (noside == EVAL_AVOID_SIDE_EFFECTS)
+ return value_zero (ada_aligned_type
+ (ada_lookup_struct_elt_type (VALUE_TYPE (arg1),
+ &exp->elts[pc + 2].string,
+ 0, NULL)),
+ lval_memory);
+ else
+ return unwrap_value (ada_value_struct_elt (arg1,
+ &exp->elts[pc + 2].string,
+ "record access"));
+ }
+
+nosideret:
+ return value_from_longest (builtin_type_long, (LONGEST) 1);
+}
+
+
+ /* Fixed point */
+
+/* If TYPE encodes an Ada fixed-point type, return the suffix of the
+ type name that encodes the 'small and 'delta information.
+ Otherwise, return NULL. */
+
+static const char*
+fixed_type_info (type)
+ struct type *type;
+{
+ const char* name = ada_type_name (type);
+ enum type_code code = (type == NULL) ? TYPE_CODE_UNDEF : TYPE_CODE (type);
+
+ if ((code == TYPE_CODE_INT || code == TYPE_CODE_RANGE)
+ && name != NULL)
+ {
+ const char *tail = strstr (name, "___XF_");
+ if (tail == NULL)
+ return NULL;
+ else
+ return tail + 5;
+ }
+ else if (code == TYPE_CODE_RANGE && TYPE_TARGET_TYPE (type) != type)
+ return fixed_type_info (TYPE_TARGET_TYPE (type));
+ else
+ return NULL;
+}
+
+/* Returns non-zero iff TYPE represents an Ada fixed-point type. */
+
+int
+ada_is_fixed_point_type (type)
+ struct type *type;
+{
+ return fixed_type_info (type) != NULL;
+}
+
+/* Assuming that TYPE is the representation of an Ada fixed-point
+ type, return its delta, or -1 if the type is malformed and the
+ delta cannot be determined. */
+
+DOUBLEST
+ada_delta (type)
+ struct type *type;
+{
+ const char *encoding = fixed_type_info (type);
+ long num, den;
+
+ if (sscanf (encoding, "_%ld_%ld", &num, &den) < 2)
+ return -1.0;
+ else
+ return (DOUBLEST) num / (DOUBLEST) den;
+}
+
+/* Assuming that ada_is_fixed_point_type (TYPE), return the scaling
+ factor ('SMALL value) associated with the type. */
+
+static DOUBLEST
+scaling_factor (type)
+ struct type *type;
+{
+ const char *encoding = fixed_type_info (type);
+ unsigned long num0, den0, num1, den1;
+ int n;
+
+ n = sscanf (encoding, "_%lu_%lu_%lu_%lu", &num0, &den0, &num1, &den1);
+
+ if (n < 2)
+ return 1.0;
+ else if (n == 4)
+ return (DOUBLEST) num1 / (DOUBLEST) den1;
+ else
+ return (DOUBLEST) num0 / (DOUBLEST) den0;
+}
+
+
+/* Assuming that X is the representation of a value of fixed-point
+ type TYPE, return its floating-point equivalent. */
+
+DOUBLEST
+ada_fixed_to_float (type, x)
+ struct type *type;
+ LONGEST x;
+{
+ return (DOUBLEST) x * scaling_factor (type);
+}
+
+/* The representation of a fixed-point value of type TYPE
+ corresponding to the value X. */
+
+LONGEST
+ada_float_to_fixed (type, x)
+ struct type *type;
+ DOUBLEST x;
+{
+ return (LONGEST) (x / scaling_factor (type) + 0.5);
+}
+
+
+ /* VAX floating formats */
+
+/* Non-zero iff TYPE represents one of the special VAX floating-point
+ types. */
+int
+ada_is_vax_floating_type (type)
+ struct type* type;
+{
+ int name_len =
+ (ada_type_name (type) == NULL) ? 0 : strlen (ada_type_name (type));
+ return
+ 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);
+}
+
+/* The type of special VAX floating-point type this is, assuming
+ ada_is_vax_floating_point */
+int
+ada_vax_float_type_suffix (type)
+ struct type* type;
+{
+ return ada_type_name (type)[strlen (ada_type_name (type))-1];
+}
+
+/* A value representing the special debugging function that outputs
+ VAX floating-point values of the type represented by TYPE. Assumes
+ ada_is_vax_floating_type (TYPE). */
+struct value*
+ada_vax_float_print_function (type)
+
+ struct type* type;
+{
+ switch (ada_vax_float_type_suffix (type)) {
+ case 'F':
+ return
+ get_var_value ("DEBUG_STRING_F", 0);
+ case 'D':
+ return
+ get_var_value ("DEBUG_STRING_D", 0);
+ case 'G':
+ return
+ get_var_value ("DEBUG_STRING_G", 0);
+ default:
+ error ("invalid VAX floating-point type");
+ }
+}
+
+
+ /* Range types */
+
+/* Scan STR beginning at position K for a discriminant name, and
+ return the value of that discriminant field of DVAL in *PX. If
+ PNEW_K is not null, put the position of the character beyond the
+ name scanned in *PNEW_K. Return 1 if successful; return 0 and do
+ not alter *PX and *PNEW_K if unsuccessful. */
+
+static int
+scan_discrim_bound (str, k, dval, px, pnew_k)
+ char *str;
+ int k;
+ struct value* dval;
+ LONGEST *px;
+ int *pnew_k;
+{
+ static char *bound_buffer = NULL;
+ static size_t bound_buffer_len = 0;
+ char *bound;
+ char *pend;
+ struct value* bound_val;
+
+ if (dval == NULL || str == NULL || str[k] == '\0')
+ return 0;
+
+ pend = strstr (str+k, "__");
+ if (pend == NULL)
+ {
+ bound = str+k;
+ k += strlen (bound);
+ }
+ else
+ {
+ GROW_VECT (bound_buffer, bound_buffer_len, pend - (str+k) + 1);
+ bound = bound_buffer;
+ strncpy (bound_buffer, str+k, pend-(str+k));
+ bound[pend-(str+k)] = '\0';
+ k = pend-str;
+ }
+
+ bound_val =
+ ada_search_struct_field (bound, dval, 0, VALUE_TYPE (dval));
+ if (bound_val == NULL)
+ return 0;
+
+ *px = value_as_long (bound_val);
+ if (pnew_k != NULL)
+ *pnew_k = k;
+ return 1;
+}
+
+/* Value of variable named NAME in the current environment. If
+ no such variable found, then if ERR_MSG is null, returns 0, and
+ otherwise causes an error with message ERR_MSG. */
+static struct value*
+get_var_value (name, err_msg)
+ char* name;
+ char* err_msg;
+{
+ struct symbol** syms;
+ struct block** blocks;
+ int nsyms;
+
+ nsyms = ada_lookup_symbol_list (name, get_selected_block (NULL), VAR_NAMESPACE,
+ &syms, &blocks);
+
+ if (nsyms != 1)
+ {
+ if (err_msg == NULL)
+ return 0;
+ else
+ error ("%s", err_msg);
+ }
+
+ return value_of_variable (syms[0], blocks[0]);
+}
+
+/* Value of integer variable named NAME in the current environment. If
+ no such variable found, then if ERR_MSG is null, returns 0, and sets
+ *FLAG to 0. If successful, sets *FLAG to 1. */
+LONGEST
+get_int_var_value (name, err_msg, flag)
+ char* name;
+ char* err_msg;
+ int* flag;
+{
+ struct value* var_val = get_var_value (name, err_msg);
+
+ if (var_val == 0)
+ {
+ if (flag != NULL)
+ *flag = 0;
+ return 0;
+ }
+ else
+ {
+ if (flag != NULL)
+ *flag = 1;
+ return value_as_long (var_val);
+ }
+}
+
+
+/* Return a range type whose base type is that of the range type named
+ NAME in the current environment, and whose bounds are calculated
+ from NAME according to the GNAT range encoding conventions.
+ Extract discriminant values, if needed, from DVAL. If a new type
+ must be created, allocate in OBJFILE's space. The bounds
+ information, in general, is encoded in NAME, the base type given in
+ the named range type. */
+
+static struct type*
+to_fixed_range_type (name, dval, objfile)
+ char *name;
+ struct value *dval;
+ struct objfile *objfile;
+{
+ struct type *raw_type = ada_find_any_type (name);
+ struct type *base_type;
+ LONGEST low, high;
+ char* subtype_info;
+
+ if (raw_type == NULL)
+ base_type = builtin_type_int;
+ else if (TYPE_CODE (raw_type) == TYPE_CODE_RANGE)
+ base_type = TYPE_TARGET_TYPE (raw_type);
+ else
+ base_type = raw_type;
+
+ subtype_info = strstr (name, "___XD");
+ if (subtype_info == NULL)
+ return raw_type;
+ else
+ {
+ static char *name_buf = NULL;
+ static size_t name_len = 0;
+ int prefix_len = subtype_info - name;
+ LONGEST L, U;
+ struct type *type;
+ char *bounds_str;
+ int n;
+
+ GROW_VECT (name_buf, name_len, prefix_len + 5);
+ strncpy (name_buf, name, prefix_len);
+ name_buf[prefix_len] = '\0';
+
+ subtype_info += 5;
+ bounds_str = strchr (subtype_info, '_');
+ n = 1;
+
+ if (*subtype_info == 'L')
+ {
+ if (! ada_scan_number (bounds_str, n, &L, &n)
+ && ! scan_discrim_bound (bounds_str, n, dval, &L, &n))
+ return raw_type;
+ if (bounds_str[n] == '_')
+ n += 2;
+ else if (bounds_str[n] == '.') /* FIXME? SGI Workshop kludge. */
+ n += 1;
+ subtype_info += 1;
+ }
+ else
+ {
+ strcpy (name_buf+prefix_len, "___L");
+ L = get_int_var_value (name_buf, "Index bound unknown.", NULL);
+ }
+
+ if (*subtype_info == 'U')
+ {
+ if (! ada_scan_number (bounds_str, n, &U, &n)
+ && !scan_discrim_bound (bounds_str, n, dval, &U, &n))
+ return raw_type;
+ }
+ else
+ {
+ strcpy (name_buf+prefix_len, "___U");
+ U = get_int_var_value (name_buf, "Index bound unknown.", NULL);
+ }
+
+ if (objfile == NULL)
+ objfile = TYPE_OBJFILE (base_type);
+ type = create_range_type (alloc_type (objfile), base_type, L, U);
+ TYPE_NAME (type) = name;
+ return type;
+ }
+}
+
+/* True iff NAME is the name of a range type. */
+int
+ada_is_range_type_name (name)
+ const char* name;
+{
+ return (name != NULL && strstr (name, "___XD"));
+}
+
+
+ /* Modular types */
+
+/* True iff TYPE is an Ada modular type. */
+int
+ada_is_modular_type (type)
+ struct type* type;
+{
+ /* FIXME: base_type should be declared in gdbtypes.h, implemented in
+ valarith.c */
+ struct type* subranged_type; /* = base_type (type);*/
+
+ return (subranged_type != NULL && TYPE_CODE (type) == TYPE_CODE_RANGE
+ && TYPE_CODE (subranged_type) != TYPE_CODE_ENUM
+ && TYPE_UNSIGNED (subranged_type));
+}
+
+/* Assuming ada_is_modular_type (TYPE), the modulus of TYPE. */
+LONGEST
+ada_modulus (type)
+ struct type* type;
+{
+ return TYPE_HIGH_BOUND (type) + 1;
+}
+
+
+
+ /* Operators */
+
+/* Table mapping opcodes into strings for printing operators
+ and precedences of the operators. */
+
+static const struct op_print ada_op_print_tab[] =
+ {
+ {":=", BINOP_ASSIGN, PREC_ASSIGN, 1},
+ {"or else", BINOP_LOGICAL_OR, PREC_LOGICAL_OR, 0},
+ {"and then", BINOP_LOGICAL_AND, PREC_LOGICAL_AND, 0},
+ {"or", BINOP_BITWISE_IOR, PREC_BITWISE_IOR, 0},
+ {"xor", BINOP_BITWISE_XOR, PREC_BITWISE_XOR, 0},
+ {"and", BINOP_BITWISE_AND, PREC_BITWISE_AND, 0},
+ {"=", BINOP_EQUAL, PREC_EQUAL, 0},
+ {"/=", BINOP_NOTEQUAL, PREC_EQUAL, 0},
+ {"<=", BINOP_LEQ, PREC_ORDER, 0},
+ {">=", BINOP_GEQ, PREC_ORDER, 0},
+ {">", BINOP_GTR, PREC_ORDER, 0},
+ {"<", BINOP_LESS, PREC_ORDER, 0},
+ {">>", BINOP_RSH, PREC_SHIFT, 0},
+ {"<<", BINOP_LSH, PREC_SHIFT, 0},
+ {"+", BINOP_ADD, PREC_ADD, 0},
+ {"-", BINOP_SUB, PREC_ADD, 0},
+ {"&", BINOP_CONCAT, PREC_ADD, 0},
+ {"*", BINOP_MUL, PREC_MUL, 0},
+ {"/", BINOP_DIV, PREC_MUL, 0},
+ {"rem", BINOP_REM, PREC_MUL, 0},
+ {"mod", BINOP_MOD, PREC_MUL, 0},
+ {"**", BINOP_EXP, PREC_REPEAT, 0 },
+ {"@", BINOP_REPEAT, PREC_REPEAT, 0},
+ {"-", UNOP_NEG, PREC_PREFIX, 0},
+ {"+", UNOP_PLUS, PREC_PREFIX, 0},
+ {"not ", UNOP_LOGICAL_NOT, PREC_PREFIX, 0},
+ {"not ", UNOP_COMPLEMENT, PREC_PREFIX, 0},
+ {"abs ", UNOP_ABS, PREC_PREFIX, 0},
+ {".all", UNOP_IND, PREC_SUFFIX, 1}, /* FIXME: postfix .ALL */
+ {"'access", UNOP_ADDR, PREC_SUFFIX, 1}, /* FIXME: postfix 'ACCESS */
+ {NULL, 0, 0, 0}
+};
+
+ /* Assorted Types and Interfaces */
+
+struct type* builtin_type_ada_int;
+struct type* builtin_type_ada_short;
+struct type* builtin_type_ada_long;
+struct type* builtin_type_ada_long_long;
+struct type* builtin_type_ada_char;
+struct type* builtin_type_ada_float;
+struct type* builtin_type_ada_double;
+struct type* builtin_type_ada_long_double;
+struct type* builtin_type_ada_natural;
+struct type* builtin_type_ada_positive;
+struct type* builtin_type_ada_system_address;
+
+struct type ** const (ada_builtin_types[]) =
+{
+
+ &builtin_type_ada_int,
+ &builtin_type_ada_long,
+ &builtin_type_ada_short,
+ &builtin_type_ada_char,
+ &builtin_type_ada_float,
+ &builtin_type_ada_double,
+ &builtin_type_ada_long_long,
+ &builtin_type_ada_long_double,
+ &builtin_type_ada_natural,
+ &builtin_type_ada_positive,
+
+ /* The following types are carried over from C for convenience. */
+ &builtin_type_int,
+ &builtin_type_long,
+ &builtin_type_short,
+ &builtin_type_char,
+ &builtin_type_float,
+ &builtin_type_double,
+ &builtin_type_long_long,
+ &builtin_type_void,
+ &builtin_type_signed_char,
+ &builtin_type_unsigned_char,
+ &builtin_type_unsigned_short,
+ &builtin_type_unsigned_int,
+ &builtin_type_unsigned_long,
+ &builtin_type_unsigned_long_long,
+ &builtin_type_long_double,
+ &builtin_type_complex,
+ &builtin_type_double_complex,
+ 0
+};
+
+/* Not really used, but needed in the ada_language_defn. */
+static void emit_char (int c, struct ui_file* stream, int quoter)
+{
+ ada_emit_char (c, stream, quoter, 1);
+}
+
+const struct language_defn ada_language_defn = {
+ "ada", /* Language name */
+ /* language_ada, */
+ language_unknown,
+ /* FIXME: language_ada should be defined in defs.h */
+ ada_builtin_types,
+ range_check_off,
+ type_check_off,
+ case_sensitive_on, /* Yes, Ada is case-insensitive, but
+ * that's not quite what this means. */
+ ada_parse,
+ ada_error,
+ ada_evaluate_subexp,
+ ada_printchar, /* Print a character constant */
+ ada_printstr, /* Function to print string constant */
+ emit_char, /* Function to print single char (not used) */
+ ada_create_fundamental_type, /* Create fundamental type in this language */
+ ada_print_type, /* Print a type using appropriate syntax */
+ ada_val_print, /* Print a value using appropriate syntax */
+ ada_value_print, /* Print a top-level value */
+ {"", "", "", ""}, /* Binary format info */
+#if 0
+ {"8#%lo#", "8#", "o", "#"}, /* Octal format info */
+ {"%ld", "", "d", ""}, /* Decimal format info */
+ {"16#%lx#", "16#", "x", "#"}, /* Hex format info */
+#else
+ /* Copied from c-lang.c. */
+ {"0%lo", "0", "o", ""}, /* Octal format info */
+ {"%ld", "", "d", ""}, /* Decimal format info */
+ {"0x%lx", "0x", "x", ""}, /* Hex format info */
+#endif
+ ada_op_print_tab, /* expression operators for printing */
+ 1, /* c-style arrays (FIXME?) */
+ 0, /* String lower bound (FIXME?) */
+ &builtin_type_ada_char,
+ LANG_MAGIC
+};
+
+void
+_initialize_ada_language ()
+{
+ builtin_type_ada_int =
+ init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT,
+ 0,
+ "integer", (struct objfile *) NULL);
+ builtin_type_ada_long =
+ init_type (TYPE_CODE_INT, TARGET_LONG_BIT / TARGET_CHAR_BIT,
+ 0,
+ "long_integer", (struct objfile *) NULL);
+ builtin_type_ada_short =
+ init_type (TYPE_CODE_INT, TARGET_SHORT_BIT / TARGET_CHAR_BIT,
+ 0,
+ "short_integer", (struct objfile *) NULL);
+ builtin_type_ada_char =
+ init_type (TYPE_CODE_INT, TARGET_CHAR_BIT / TARGET_CHAR_BIT,
+ 0,
+ "character", (struct objfile *) NULL);
+ builtin_type_ada_float =
+ init_type (TYPE_CODE_FLT, TARGET_FLOAT_BIT / TARGET_CHAR_BIT,
+ 0,
+ "float", (struct objfile *) NULL);
+ builtin_type_ada_double =
+ init_type (TYPE_CODE_FLT, TARGET_DOUBLE_BIT / TARGET_CHAR_BIT,
+ 0,
+ "long_float", (struct objfile *) NULL);
+ builtin_type_ada_long_long =
+ init_type (TYPE_CODE_INT, TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
+ 0,
+ "long_long_integer", (struct objfile *) NULL);
+ builtin_type_ada_long_double =
+ init_type (TYPE_CODE_FLT, TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT,
+ 0,
+ "long_long_float", (struct objfile *) NULL);
+ builtin_type_ada_natural =
+ init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT,
+ 0,
+ "natural", (struct objfile *) NULL);
+ builtin_type_ada_positive =
+ init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT,
+ 0,
+ "positive", (struct objfile *) NULL);
+
+
+ builtin_type_ada_system_address =
+ lookup_pointer_type (init_type (TYPE_CODE_VOID, 1, 0, "void",
+ (struct objfile *) NULL));
+ TYPE_NAME (builtin_type_ada_system_address) = "system__address";
+
+ add_language (&ada_language_defn);
+
+ add_show_from_set
+ (add_set_cmd ("varsize-limit", class_support, var_uinteger,
+ (char*) &varsize_limit,
+ "Set maximum bytes in dynamic-sized object.",
+ &setlist),
+ &showlist);
+ varsize_limit = 65536;
+
+ add_com ("begin", class_breakpoint, begin_command,
+ "Start the debugged program, stopping at the beginning of the\n\
+main program. You may specify command-line arguments to give it, as for\n\
+the \"run\" command (q.v.).");
+}
+
+
+/* Create a fundamental Ada type using default reasonable for the current
+ target machine.
+
+ Some object/debugging file formats (DWARF version 1, COFF, etc) do not
+ define fundamental types such as "int" or "double". Others (stabs or
+ DWARF version 2, etc) do define fundamental types. For the formats which
+ don't provide fundamental types, gdb can create such types using this
+ function.
+
+ FIXME: Some compilers distinguish explicitly signed integral types
+ (signed short, signed int, signed long) from "regular" integral types
+ (short, int, long) in the debugging information. There is some dis-
+ agreement as to how useful this feature is. In particular, gcc does
+ not support this. Also, only some debugging formats allow the
+ distinction to be passed on to a debugger. For now, we always just
+ use "short", "int", or "long" as the type name, for both the implicit
+ and explicitly signed types. This also makes life easier for the
+ gdb test suite since we don't have to account for the differences
+ in output depending upon what the compiler and debugging format
+ support. We will probably have to re-examine the issue when gdb
+ starts taking it's fundamental type information directly from the
+ debugging information supplied by the compiler. fnf@cygnus.com */
+
+static struct type *
+ada_create_fundamental_type (objfile, typeid)
+ struct objfile *objfile;
+ int typeid;
+{
+ struct type *type = NULL;
+
+ switch (typeid)
+ {
+ default:
+ /* FIXME: For now, if we are asked to produce a type not in this
+ language, create the equivalent of a C integer type with the
+ name "<?type?>". When all the dust settles from the type
+ reconstruction work, this should probably become an error. */
+ type = init_type (TYPE_CODE_INT,
+ TARGET_INT_BIT / TARGET_CHAR_BIT,
+ 0, "<?type?>", objfile);
+ warning ("internal error: no Ada fundamental type %d", typeid);
+ break;
+ case FT_VOID:
+ type = init_type (TYPE_CODE_VOID,
+ TARGET_CHAR_BIT / TARGET_CHAR_BIT,
+ 0, "void", objfile);
+ break;
+ case FT_CHAR:
+ type = init_type (TYPE_CODE_INT,
+ TARGET_CHAR_BIT / TARGET_CHAR_BIT,
+ 0, "character", objfile);
+ break;
+ case FT_SIGNED_CHAR:
+ type = init_type (TYPE_CODE_INT,
+ TARGET_CHAR_BIT / TARGET_CHAR_BIT,
+ 0, "signed char", objfile);
+ break;
+ case FT_UNSIGNED_CHAR:
+ type = init_type (TYPE_CODE_INT,
+ TARGET_CHAR_BIT / TARGET_CHAR_BIT,
+ TYPE_FLAG_UNSIGNED, "unsigned char", objfile);
+ break;
+ case FT_SHORT:
+ type = init_type (TYPE_CODE_INT,
+ TARGET_SHORT_BIT / TARGET_CHAR_BIT,
+ 0, "short_integer", objfile);
+ break;
+ case FT_SIGNED_SHORT:
+ type = init_type (TYPE_CODE_INT,
+ TARGET_SHORT_BIT / TARGET_CHAR_BIT,
+ 0, "short_integer", objfile);
+ break;
+ case FT_UNSIGNED_SHORT:
+ type = init_type (TYPE_CODE_INT,
+ TARGET_SHORT_BIT / TARGET_CHAR_BIT,
+ TYPE_FLAG_UNSIGNED, "unsigned short", objfile);
+ break;
+ case FT_INTEGER:
+ type = init_type (TYPE_CODE_INT,
+ TARGET_INT_BIT / TARGET_CHAR_BIT,
+ 0, "integer", objfile);
+ break;
+ case FT_SIGNED_INTEGER:
+ type = init_type (TYPE_CODE_INT,
+ TARGET_INT_BIT / TARGET_CHAR_BIT,
+ 0, "integer", objfile); /* FIXME -fnf */
+ break;
+ case FT_UNSIGNED_INTEGER:
+ type = init_type (TYPE_CODE_INT,
+ TARGET_INT_BIT / TARGET_CHAR_BIT,
+ TYPE_FLAG_UNSIGNED, "unsigned int", objfile);
+ break;
+ case FT_LONG:
+ type = init_type (TYPE_CODE_INT,
+ TARGET_LONG_BIT / TARGET_CHAR_BIT,
+ 0, "long_integer", objfile);
+ break;
+ case FT_SIGNED_LONG:
+ type = init_type (TYPE_CODE_INT,
+ TARGET_LONG_BIT / TARGET_CHAR_BIT,
+ 0, "long_integer", objfile);
+ break;
+ case FT_UNSIGNED_LONG:
+ type = init_type (TYPE_CODE_INT,
+ TARGET_LONG_BIT / TARGET_CHAR_BIT,
+ TYPE_FLAG_UNSIGNED, "unsigned long", objfile);
+ break;
+ case FT_LONG_LONG:
+ type = init_type (TYPE_CODE_INT,
+ TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
+ 0, "long_long_integer", objfile);
+ break;
+ case FT_SIGNED_LONG_LONG:
+ type = init_type (TYPE_CODE_INT,
+ TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
+ 0, "long_long_integer", objfile);
+ break;
+ case FT_UNSIGNED_LONG_LONG:
+ type = init_type (TYPE_CODE_INT,
+ TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
+ TYPE_FLAG_UNSIGNED, "unsigned long long", objfile);
+ break;
+ case FT_FLOAT:
+ type = init_type (TYPE_CODE_FLT,
+ TARGET_FLOAT_BIT / TARGET_CHAR_BIT,
+ 0, "float", objfile);
+ break;
+ case FT_DBL_PREC_FLOAT:
+ type = init_type (TYPE_CODE_FLT,
+ TARGET_DOUBLE_BIT / TARGET_CHAR_BIT,
+ 0, "long_float", objfile);
+ break;
+ case FT_EXT_PREC_FLOAT:
+ type = init_type (TYPE_CODE_FLT,
+ TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT,
+ 0, "long_long_float", objfile);
+ break;
+ }
+ return (type);
+}
+
+void ada_dump_symtab (struct symtab* s)
+{
+ int i;
+ fprintf (stderr, "New symtab: [\n");
+ fprintf (stderr, " Name: %s/%s;\n",
+ s->dirname ? s->dirname : "?",
+ s->filename ? s->filename : "?");
+ fprintf (stderr, " Format: %s;\n", s->debugformat);
+ if (s->linetable != NULL)
+ {
+ fprintf (stderr, " Line table (section %d):\n", s->block_line_section);
+ for (i = 0; i < s->linetable->nitems; i += 1)
+ {
+ struct linetable_entry* e = s->linetable->item + i;
+ fprintf (stderr, " %4ld: %8lx\n", (long) e->line, (long) e->pc);
+ }
+ }
+ fprintf (stderr, "]\n");
+}
+
diff --git a/gdb/ada-lang.h b/gdb/ada-lang.h
new file mode 100644
index 00000000000..e5353f8524b
--- /dev/null
+++ b/gdb/ada-lang.h
@@ -0,0 +1,365 @@
+/* Ada language support definitions for GDB, the GNU debugger.
+ Copyright 1992, 1997 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., 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+#if !defined (ADA_LANG_H)
+#define ADA_LANG_H 1
+
+#include "value.h"
+#include "gdbtypes.h"
+
+/* A macro to reorder the bytes of an address depending on the endiannes
+ of the target */
+#define EXTRACT_ADDRESS(x) ((void *) extract_address (&(x), sizeof (x)))
+/* A macro to reorder the bytes of an int depending on the endiannes
+ of the target */
+#define EXTRACT_INT(x) ((int) extract_signed_integer (&(x), sizeof (x)))
+
+/* Chain of cleanups for arguments of OP_UNRESOLVED_VALUE names. Created in
+ yyparse and freed in ada_resolve. */
+extern struct cleanup* unresolved_names;
+
+/* Corresponding mangled/demangled names and opcodes for Ada user-definable
+ operators. */
+struct ada_opname_map {
+ const char* mangled;
+ const char* demangled;
+ enum exp_opcode op;
+};
+
+/* Table of Ada operators in mangled and demangled forms. */
+/* Defined in ada-lang.c */
+extern const struct ada_opname_map ada_opname_table[];
+
+/* The maximum number of tasks known to the Ada runtime */
+extern const int MAX_NUMBER_OF_KNOWN_TASKS;
+
+/* Identifiers for Ada attributes that need special processing. Be sure
+ to update the table attribute_names in ada-lang.c whenever you change this.
+ */
+
+enum ada_attribute {
+ /* Invalid attribute for error checking. */
+ ATR_INVALID,
+
+ ATR_FIRST,
+ ATR_LAST,
+ ATR_LENGTH,
+ ATR_IMAGE,
+ ATR_IMG,
+ ATR_MAX,
+ ATR_MIN,
+ ATR_MODULUS,
+ ATR_POS,
+ ATR_SIZE,
+ ATR_TAG,
+ ATR_VAL,
+
+ /* Dummy last attribute. */
+ ATR_END
+};
+
+enum task_states {
+ Unactivated,
+ Runnable,
+ Terminated,
+ Activator_Sleep,
+ Acceptor_Sleep,
+ Entry_Caller_Sleep,
+ Async_Select_Sleep,
+ Delay_Sleep,
+ Master_Completion_Sleep,
+ Master_Phase_2_Sleep
+};
+
+extern char *ada_task_states[];
+
+typedef struct {
+ char *P_ARRAY;
+ int *P_BOUNDS;
+} fat_string;
+
+typedef struct entry_call {
+ void *self;
+} *entry_call_link;
+
+struct task_fields
+{
+ int entry_num;
+#if (defined (VXWORKS_TARGET) || !defined (i386)) \
+ && !(defined (VXWORKS_TARGET) && defined (M68K_TARGET))
+ int pad1;
+#endif
+ char state;
+#if (defined (VXWORKS_TARGET) && defined (M68K_TARGET))
+ char pad_8bits;
+#endif
+ void *parent;
+ int priority;
+ int current_priority;
+ fat_string image;
+ entry_call_link call;
+#if (defined (sun) && defined (__SVR4)) && !defined (VXWORKS_TARGET)
+ int pad2;
+ unsigned thread;
+ unsigned lwp;
+#else
+ void *thread;
+ void *lwp;
+#endif
+}
+#if (defined (VXWORKS_TARGET) && defined (M68K_TARGET))
+__attribute__ ((packed))
+#endif
+;
+
+struct task_entry
+{
+ void *task_id;
+ int task_num;
+ int known_tasks_index;
+ struct task_entry *next_task;
+ void *thread;
+ void *lwp;
+ int stack_per;
+};
+
+extern struct type* builtin_type_ada_int;
+extern struct type* builtin_type_ada_short;
+extern struct type* builtin_type_ada_long;
+extern struct type* builtin_type_ada_long_long;
+extern struct type* builtin_type_ada_char;
+extern struct type* builtin_type_ada_float;
+extern struct type* builtin_type_ada_double;
+extern struct type* builtin_type_ada_long_double;
+extern struct type* builtin_type_ada_natural;
+extern struct type* builtin_type_ada_positive;
+extern struct type* builtin_type_ada_system_address;
+
+/* Assuming V points to an array of S objects, make sure that it contains at
+ least M objects, updating V and S as necessary. */
+
+#define GROW_VECT(v, s, m) \
+ if ((s) < (m)) grow_vect ((void**) &(v), &(s), (m), sizeof(*(v)));
+
+extern void grow_vect (void**, size_t*, size_t, int);
+
+extern int ada_parse (void); /* Defined in ada-exp.y */
+
+extern void ada_error (char *); /* Defined in ada-exp.y */
+
+ /* Defined in ada-typeprint.c */
+extern void ada_print_type (struct type*, char*, struct ui_file*, int, int);
+
+extern int ada_val_print (struct type*, char*, int, CORE_ADDR,
+ struct ui_file*, int, int, int, enum val_prettyprint);
+
+extern int ada_value_print (struct value*, struct ui_file*, int,
+ enum val_prettyprint);
+
+ /* Defined in ada-lang.c */
+
+extern struct value* value_from_contents_and_address (struct type*, char*, CORE_ADDR);
+
+extern void ada_emit_char (int, struct ui_file *, int, int);
+
+extern void ada_printchar (int, struct ui_file*);
+
+extern void ada_printstr (struct ui_file*, char *, unsigned int, int, int);
+
+extern void ada_convert_actuals (struct value*, int, struct value**, CORE_ADDR*);
+
+extern struct value* ada_value_subscript (struct value*, int, struct value**);
+
+extern struct type* ada_array_element_type (struct type*, int);
+
+extern int ada_array_arity (struct type*);
+
+struct type* ada_type_of_array (struct value*, int);
+
+extern struct value* ada_coerce_to_simple_array (struct value*);
+
+extern struct value* ada_coerce_to_simple_array_ptr (struct value*);
+
+extern int ada_is_simple_array (struct type*);
+
+extern int ada_is_array_descriptor (struct type*);
+
+extern int ada_is_bogus_array_descriptor (struct type*);
+
+extern struct type* ada_index_type (struct type*, int);
+
+extern struct value* ada_array_bound (struct value*, int, int);
+
+extern int ada_lookup_symbol_list (const char*, struct block*, namespace_enum,
+ struct symbol***, struct block***);
+
+extern char* ada_fold_name (const char*);
+
+extern struct symbol* ada_lookup_symbol (const char*, struct block*, namespace_enum);
+
+extern struct minimal_symbol* ada_lookup_minimal_symbol (const char*);
+
+extern void ada_resolve (struct expression**, struct type*);
+
+extern int ada_resolve_function (struct symbol**, struct block**, int,
+ struct value**, int, const char*, struct type*);
+
+extern void ada_fill_in_ada_prototype (struct symbol*);
+
+extern int user_select_syms (struct symbol**, struct block**, int, int);
+
+extern int get_selections (int*, int, int, int, char*);
+
+extern char* ada_start_decode_line_1 (char*);
+
+extern struct symtabs_and_lines ada_finish_decode_line_1 (char**, struct symtab*, int, char***);
+
+extern int ada_scan_number (const char*, int, LONGEST*, int*);
+
+extern struct type* ada_parent_type (struct type*);
+
+extern int ada_is_ignored_field (struct type*, int);
+
+extern int ada_is_packed_array_type (struct type*);
+
+extern struct value* ada_value_primitive_packed_val (struct value*, char*, long, int,
+ int, struct type*);
+
+extern struct type* ada_coerce_to_simple_array_type (struct type*);
+
+extern int ada_is_character_type (struct type*);
+
+extern int ada_is_string_type (struct type*);
+
+extern int ada_is_tagged_type (struct type*);
+
+extern struct type* ada_tag_type (struct value*);
+
+extern struct value* ada_value_tag (struct value*);
+
+extern int ada_is_parent_field (struct type*, int);
+
+extern int ada_is_wrapper_field (struct type*, int);
+
+extern int ada_is_variant_part (struct type*, int);
+
+extern struct type* ada_variant_discrim_type (struct type*, struct type*);
+
+extern int ada_is_others_clause (struct type*, int);
+
+extern int ada_in_variant (LONGEST, struct type*, int);
+
+extern char* ada_variant_discrim_name (struct type*);
+
+extern struct type* ada_lookup_struct_elt_type (struct type*, char*, int, int*);
+
+extern struct value* ada_value_struct_elt (struct value*, char*, char*);
+
+extern struct value* ada_search_struct_field (char*, struct value*, int, struct type*);
+
+extern int ada_is_aligner_type (struct type*);
+
+extern struct type* ada_aligned_type (struct type*);
+
+extern char* ada_aligned_value_addr (struct type*, char*);
+
+extern const char* ada_attribute_name (int);
+
+extern int ada_is_fixed_point_type (struct type*);
+
+extern DOUBLEST ada_delta (struct type*);
+
+extern DOUBLEST ada_fixed_to_float (struct type *, LONGEST);
+
+extern LONGEST ada_float_to_fixed (struct type*, DOUBLEST);
+
+extern int ada_is_vax_floating_type (struct type*);
+
+extern int ada_vax_float_type_suffix (struct type*);
+
+extern struct value* ada_vax_float_print_function (struct type*);
+
+extern struct type* ada_system_address_type (void);
+
+extern int ada_which_variant_applies (struct type*, struct type*, char*);
+
+extern struct value* ada_to_fixed_value (struct type*, char*, CORE_ADDR, struct value*);
+
+extern struct type* ada_to_fixed_type (struct type*, char*, CORE_ADDR, struct value*);
+
+extern int ada_name_prefix_len (const char*);
+
+extern char* ada_type_name (struct type*);
+
+extern struct type* ada_find_parallel_type (struct type*, const char *suffix);
+
+extern LONGEST get_int_var_value (char*, char*, int* );
+
+extern struct type* ada_find_any_type (const char *name);
+
+extern int ada_prefer_type (struct type*, struct type*);
+
+extern struct type* ada_get_base_type (struct type*);
+
+extern struct type* ada_completed_type (struct type*);
+
+extern char* ada_mangle (const char*);
+
+extern const char* ada_enum_name (const char*);
+
+extern int ada_is_modular_type (struct type*);
+
+extern LONGEST ada_modulus (struct type*);
+
+extern struct value* ada_value_ind (struct value*);
+
+extern void ada_print_scalar (struct type*, LONGEST, struct ui_file*);
+
+extern int ada_is_range_type_name (const char*);
+
+extern const char* ada_renaming_type (struct type*);
+
+extern int ada_is_object_renaming (struct symbol*);
+
+extern const char* ada_simple_renamed_entity (struct symbol*);
+
+extern char* ada_breakpoint_rewrite (char*, int*);
+
+/* Tasking-related: ada-tasks.c */
+
+extern int valid_task_id (int);
+
+extern int get_current_task (void);
+
+extern void init_task_list (void);
+
+extern void* get_self_id (void);
+
+extern int get_current_task (void);
+
+extern int get_entry_number (void*);
+
+extern void ada_report_exception_break (struct breakpoint *);
+
+extern int ada_maybe_exception_partial_symbol (struct partial_symbol* sym);
+
+extern int ada_is_exception_sym (struct symbol* sym);
+
+
+#endif
diff --git a/gdb/ada-lex.c b/gdb/ada-lex.c
new file mode 100644
index 00000000000..8f32fb0b020
--- /dev/null
+++ b/gdb/ada-lex.c
@@ -0,0 +1,3174 @@
+/* A lexical scanner generated by flex */
+
+/* Scanner skeleton version:
+ * $Header: /cvs/src/src/gdb/ada-lex.c,v 1.1 2002/06/04 15:28:47 aidan Exp $
+ * $FreeBSD: src/usr.bin/lex/flex.skl,v 1.4 1999/10/27 07:56:44 obrien Exp $
+ */
+
+#define FLEX_SCANNER
+#define YY_FLEX_MAJOR_VERSION 2
+#define YY_FLEX_MINOR_VERSION 5
+
+#include <stdio.h>
+
+
+/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
+#ifdef c_plusplus
+#ifndef __cplusplus
+#define __cplusplus
+#endif
+#endif
+
+
+#ifdef __cplusplus
+
+#include <stdlib.h>
+#include <unistd.h>
+
+/* Use prototypes in function declarations. */
+#define YY_USE_PROTOS
+
+/* The "const" storage-class-modifier is valid. */
+#define YY_USE_CONST
+
+#else /* ! __cplusplus */
+
+#if __STDC__
+
+#define YY_USE_PROTOS
+#define YY_USE_CONST
+
+#endif /* __STDC__ */
+#endif /* ! __cplusplus */
+
+#ifdef __TURBOC__
+ #pragma warn -rch
+ #pragma warn -use
+#include <io.h>
+#include <stdlib.h>
+#define YY_USE_CONST
+#define YY_USE_PROTOS
+#endif
+
+#ifdef YY_USE_CONST
+#define yyconst const
+#else
+#define yyconst
+#endif
+
+
+#ifdef YY_USE_PROTOS
+#define YY_PROTO(proto) proto
+#else
+#define YY_PROTO(proto) ()
+#endif
+
+/* Returned upon end-of-file. */
+#define YY_NULL 0
+
+/* Promotes a possibly negative, possibly signed char to an unsigned
+ * integer for use as an array index. If the signed char is negative,
+ * we want to instead treat it as an 8-bit unsigned char, hence the
+ * double cast.
+ */
+#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
+
+/* Enter a start condition. This macro really ought to take a parameter,
+ * but we do it the disgusting crufty way forced on us by the ()-less
+ * definition of BEGIN.
+ */
+#define BEGIN yy_start = 1 + 2 *
+
+/* Translate the current start state into a value that can be later handed
+ * to BEGIN to return to the state. The YYSTATE alias is for lex
+ * compatibility.
+ */
+#define YY_START ((yy_start - 1) / 2)
+#define YYSTATE YY_START
+
+/* Action number for EOF rule of a given start state. */
+#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
+
+/* Special action meaning "start processing a new file". */
+#define YY_NEW_FILE yyrestart( yyin )
+
+#define YY_END_OF_BUFFER_CHAR 0
+
+/* Size of default input buffer. */
+#define YY_BUF_SIZE 16384
+
+typedef struct yy_buffer_state *YY_BUFFER_STATE;
+
+extern int yyleng;
+extern FILE *yyin, *yyout;
+
+#define EOB_ACT_CONTINUE_SCAN 0
+#define EOB_ACT_END_OF_FILE 1
+#define EOB_ACT_LAST_MATCH 2
+
+/* The funky do-while in the following #define is used to turn the definition
+ * int a single C statement (which needs a semi-colon terminator). This
+ * avoids problems with code like:
+ *
+ * if ( condition_holds )
+ * yyless( 5 );
+ * else
+ * do_something_else();
+ *
+ * Prior to using the do-while the compiler would get upset at the
+ * "else" because it interpreted the "if" statement as being all
+ * done when it reached the ';' after the yyless() call.
+ */
+
+/* Return all but the first 'n' matched characters back to the input stream. */
+
+#define yyless(n) \
+ do \
+ { \
+ /* Undo effects of setting up yytext. */ \
+ *yy_cp = yy_hold_char; \
+ YY_RESTORE_YY_MORE_OFFSET \
+ yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
+ YY_DO_BEFORE_ACTION; /* set up yytext again */ \
+ } \
+ while ( 0 )
+
+#define unput(c) yyunput( c, yytext_ptr )
+
+/* The following is because we cannot portably get our hands on size_t
+ * (without autoconf's help, which isn't available because we want
+ * flex-generated scanners to compile on their own).
+ */
+typedef unsigned int yy_size_t;
+
+
+struct yy_buffer_state
+ {
+ FILE *yy_input_file;
+
+ char *yy_ch_buf; /* input buffer */
+ char *yy_buf_pos; /* current position in input buffer */
+
+ /* Size of input buffer in bytes, not including room for EOB
+ * characters.
+ */
+ yy_size_t yy_buf_size;
+
+ /* Number of characters read into yy_ch_buf, not including EOB
+ * characters.
+ */
+ int yy_n_chars;
+
+ /* Whether we "own" the buffer - i.e., we know we created it,
+ * and can realloc() it to grow it, and should free() it to
+ * delete it.
+ */
+ int yy_is_our_buffer;
+
+ /* Whether this is an "interactive" input source; if so, and
+ * if we're using stdio for input, then we want to use getc()
+ * instead of fread(), to make sure we stop fetching input after
+ * each newline.
+ */
+ int yy_is_interactive;
+
+ /* Whether we're considered to be at the beginning of a line.
+ * If so, '^' rules will be active on the next match, otherwise
+ * not.
+ */
+ int yy_at_bol;
+
+ /* Whether to try to fill the input buffer when we reach the
+ * end of it.
+ */
+ int yy_fill_buffer;
+
+ int yy_buffer_status;
+#define YY_BUFFER_NEW 0
+#define YY_BUFFER_NORMAL 1
+ /* When an EOF's been seen but there's still some text to process
+ * then we mark the buffer as YY_EOF_PENDING, to indicate that we
+ * shouldn't try reading from the input source any more. We might
+ * still have a bunch of tokens to match, though, because of
+ * possible backing-up.
+ *
+ * When we actually see the EOF, we change the status to "new"
+ * (via yyrestart()), so that the user can continue scanning by
+ * just pointing yyin at a new input file.
+ */
+#define YY_BUFFER_EOF_PENDING 2
+ };
+
+static YY_BUFFER_STATE yy_current_buffer = 0;
+
+/* We provide macros for accessing buffer states in case in the
+ * future we want to put the buffer states in a more general
+ * "scanner state".
+ */
+#define YY_CURRENT_BUFFER yy_current_buffer
+
+
+/* yy_hold_char holds the character lost when yytext is formed. */
+static char yy_hold_char;
+
+static int yy_n_chars; /* number of characters read into yy_ch_buf */
+
+
+int yyleng;
+
+/* Points to current character in buffer. */
+static char *yy_c_buf_p = (char *) 0;
+static int yy_init = 1; /* whether we need to initialize */
+static int yy_start = 0; /* start state number */
+
+/* Flag which is used to allow yywrap()'s to do buffer switches
+ * instead of setting up a fresh yyin. A bit of a hack ...
+ */
+static int yy_did_buffer_switch_on_eof;
+
+void yyrestart YY_PROTO(( FILE *input_file ));
+
+void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
+void yy_load_buffer_state YY_PROTO(( void ));
+YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
+void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
+void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
+void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
+#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
+
+YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
+YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str ));
+YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));
+
+static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
+static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ));
+static void yy_flex_free YY_PROTO(( void * ));
+
+#define yy_new_buffer yy_create_buffer
+
+#define yy_set_interactive(is_interactive) \
+ { \
+ if ( ! yy_current_buffer ) \
+ yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
+ yy_current_buffer->yy_is_interactive = is_interactive; \
+ }
+
+#define yy_set_bol(at_bol) \
+ { \
+ if ( ! yy_current_buffer ) \
+ yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
+ yy_current_buffer->yy_at_bol = at_bol; \
+ }
+
+#define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
+
+
+#define YY_USES_REJECT
+typedef unsigned char YY_CHAR;
+FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
+typedef int yy_state_type;
+extern char *yytext;
+#define yytext_ptr yytext
+
+static yy_state_type yy_get_previous_state YY_PROTO(( void ));
+static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
+static int yy_get_next_buffer YY_PROTO(( void ));
+static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
+
+/* Done after the current pattern has been matched and before the
+ * corresponding action - sets up yytext.
+ */
+#define YY_DO_BEFORE_ACTION \
+ yytext_ptr = yy_bp; \
+ yyleng = (int) (yy_cp - yy_bp); \
+ yy_hold_char = *yy_cp; \
+ *yy_cp = '\0'; \
+ yy_c_buf_p = yy_cp;
+
+#define YY_NUM_RULES 57
+#define YY_END_OF_BUFFER 58
+static yyconst short int yy_acclist[386] =
+ { 0,
+ 58, 56, 57, 1, 56, 57, 1, 57, 15, 56,
+ 57, 53, 56, 57, 41, 56, 57, 56, 57, 43,
+ 56, 57, 44, 56, 57, 41, 56, 57, 42, 56,
+ 57, 41, 56, 57, 41, 56, 57, 41, 56, 57,
+ 4, 56, 57, 4, 56, 57, 41, 56, 57, 41,
+ 56, 57, 41, 56, 57, 41, 56, 57, 50, 56,
+ 57, 47, 56, 57, 47, 56, 57, 47, 56, 57,
+ 47, 56, 57, 47, 56, 57, 47, 56, 57, 47,
+ 56, 57, 47, 56, 57, 47, 56, 57, 47, 56,
+ 57, 1, 56, 57, 56, 57, 16, 56, 57, 53,
+
+ 56, 57, 41, 56, 57, 56, 57, 43, 56, 57,
+ 44, 56, 57, 41, 56, 57, 42, 56, 57, 41,
+ 56, 57, 41, 56, 57, 41, 56, 57, 4, 56,
+ 57, 4, 56, 57, 41, 56, 57, 41, 56, 57,
+ 41, 56, 57, 41, 56, 57, 50, 56, 57, 41,
+ 56, 57, 47, 56, 57, 47, 56, 57, 47, 56,
+ 57, 47, 56, 57, 47, 56, 57, 47, 56, 57,
+ 47, 56, 57, 47, 56, 57, 47, 56, 57, 47,
+ 56, 57, 56, 57, 40, 56, 57, 51, 55, 54,
+ 55, 55, 35, 2, 34, 46, 46, 37, 4, 36,
+
+ 38, 33, 39, 47, 47, 47, 47, 47, 19, 47,
+ 23, 47, 47, 47, 47, 47, 28, 47, 47, 47,
+ 47, 16, 51, 55, 54, 55, 55, 16, 35, 2,
+ 34, 46, 46, 37, 4, 36, 38, 33, 39, 16,
+ 47, 47, 47, 47, 47, 19, 47, 23, 47, 47,
+ 47, 47, 47, 28, 47, 47, 47, 47,16398, 52,
+ 55, 12, 12, 32, 2, 46, 46, 9, 3, 7,
+ 47, 47, 49, 20, 47, 21, 47, 47, 24, 47,
+ 25, 47, 26, 47, 47, 29, 47, 47, 31, 47,
+ 52, 55, 16, 32, 2, 2, 16, 2, 46, 46,
+
+ 9, 3, 7, 47, 16, 47, 49, 20, 47, 21,
+ 47, 47, 24, 47, 25, 47, 26, 47, 47, 29,
+ 47, 47, 31, 47, 8206, 46, 45, 46, 6, 9,
+ 3, 47, 22, 47, 27, 47, 30, 47, 2, 16,
+ 46, 45, 46, 6, 9, 3, 47, 22, 47, 27,
+ 47, 30, 47, 48, 47, 48, 2, 2, 18, 47,
+ 5, 11, 8, 18, 2, 2, 5, 11, 8, 17,
+ 5, 8, 17, 2, 18, 2, 5, 8, 13, 2,
+ 17, 10, 10, 10, 10
+ } ;
+
+static yyconst short int yy_accept[364] =
+ { 0,
+ 1, 1, 1, 1, 1, 1, 1, 2, 4, 7,
+ 9, 12, 15, 18, 20, 23, 26, 29, 32, 35,
+ 38, 41, 44, 47, 50, 53, 56, 59, 62, 65,
+ 68, 71, 74, 77, 80, 83, 86, 89, 92, 95,
+ 97, 100, 103, 106, 108, 111, 114, 117, 120, 123,
+ 126, 129, 132, 135, 138, 141, 144, 147, 150, 153,
+ 156, 159, 162, 165, 168, 171, 174, 177, 180, 183,
+ 185, 188, 188, 188, 188, 188, 188, 188, 188, 188,
+ 188, 188, 188, 190, 192, 193, 193, 193, 193, 193,
+ 193, 193, 193, 194, 195, 195, 196, 196, 197, 198,
+
+ 199, 199, 199, 200, 200, 200, 201, 202, 202, 203,
+ 204, 204, 204, 205, 205, 206, 206, 207, 208, 209,
+ 211, 213, 214, 215, 216, 217, 219, 220, 221, 222,
+ 222, 223, 223, 225, 227, 228, 228, 228, 229, 229,
+ 229, 230, 231, 231, 232, 232, 233, 234, 235, 235,
+ 235, 236, 236, 236, 237, 238, 238, 239, 240, 241,
+ 241, 242, 242, 243, 243, 244, 245, 246, 248, 250,
+ 251, 252, 253, 254, 256, 257, 258, 259, 259, 260,
+ 260, 260, 260, 260, 260, 260, 262, 262, 263, 264,
+ 264, 265, 266, 266, 267, 268, 268, 269, 269, 270,
+
+ 271, 271, 272, 272, 272, 272, 273, 274, 276, 278,
+ 279, 281, 283, 285, 286, 288, 289, 291, 293, 293,
+ 294, 295, 296, 298, 299, 299, 300, 301, 301, 302,
+ 302, 303, 304, 304, 305, 305, 305, 305, 306, 306,
+ 307, 308, 310, 312, 313, 315, 317, 319, 320, 322,
+ 323, 325, 325, 326, 326, 326, 326, 326, 327, 329,
+ 330, 330, 330, 331, 331, 332, 332, 332, 332, 332,
+ 332, 332, 332, 332, 332, 332, 332, 332, 333, 335,
+ 337, 339, 339, 339, 339, 339, 341, 341, 342, 344,
+ 345, 345, 345, 346, 346, 347, 347, 347, 347, 348,
+
+ 350, 352, 354, 355, 355, 355, 355, 355, 356, 356,
+ 356, 356, 356, 356, 356, 356, 357, 357, 357, 358,
+ 359, 359, 359, 359, 360, 360, 360, 361, 361, 361,
+ 362, 363, 363, 364, 365, 365, 366, 367, 367, 368,
+ 369, 369, 370, 371, 371, 372, 372, 373, 374, 376,
+ 377, 378, 378, 379, 380, 380, 382, 382, 383, 384,
+ 385, 386, 386
+ } ;
+
+static yyconst int yy_ec[256] =
+ { 0,
+ 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 4, 5, 6, 7, 8, 5, 9, 10, 11,
+ 12, 13, 14, 15, 16, 17, 18, 19, 20, 20,
+ 20, 20, 20, 20, 20, 20, 20, 21, 22, 23,
+ 24, 25, 5, 26, 30, 31, 32, 33, 34, 35,
+ 36, 37, 38, 36, 36, 39, 40, 41, 42, 36,
+ 36, 43, 44, 45, 46, 36, 47, 48, 36, 36,
+ 27, 5, 28, 5, 29, 5, 30, 31, 32, 33,
+
+ 34, 35, 36, 37, 38, 36, 36, 39, 40, 41,
+ 42, 36, 36, 43, 44, 45, 46, 36, 47, 48,
+ 36, 36, 26, 22, 26, 5, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1
+ } ;
+
+static yyconst int yy_meta[49] =
+ { 0,
+ 1, 2, 3, 4, 5, 6, 7, 8, 5, 9,
+ 5, 5, 5, 5, 5, 5, 10, 5, 11, 11,
+ 9, 5, 12, 13, 14, 5, 5, 5, 15, 16,
+ 16, 16, 16, 16, 16, 17, 17, 17, 17, 17,
+ 17, 17, 17, 17, 17, 17, 17, 17
+ } ;
+
+static yyconst short int yy_base[385] =
+ { 0,
+ 0, 0, 48, 0, 91, 92, 1405, 1771, 1771, 1771,
+ 94, 96, 1771, 142, 1771, 1771, 1391, 1771, 1387, 189,
+ 1378, 188, 194, 1377, 1376, 1374, 1361, 1771, 222, 242,
+ 82, 91, 89, 196, 68, 163, 179, 97, 100, 194,
+ 0, 280, 223, 328, 227, 228, 234, 229, 235, 375,
+ 242, 418, 1335, 243, 463, 247, 251, 252, 254, 510,
+ 168, 1343, 161, 1333, 234, 1331, 1336, 1323, 1316, 0,
+ 558, 1340, 127, 258, 420, 422, 398, 1299, 1285, 1258,
+ 1266, 1257, 411, 413, 0, 605, 1288, 1287, 1286, 1285,
+ 119, 644, 1771, 0, 691, 1771, 0, 0, 1255, 1771,
+
+ 0, 421, 690, 429, 0, 1771, 1771, 1244, 1771, 1771,
+ 608, 696, 1771, 699, 419, 1247, 420, 422, 582, 583,
+ 586, 587, 624, 625, 591, 590, 627, 628, 684, 430,
+ 1771, 705, 653, 1256, 710, 1252, 731, 0, 1254, 750,
+ 710, 798, 1222, 717, 802, 832, 1199, 720, 875, 730,
+ 1189, 732, 892, 733, 795, 924, 796, 797, 1230, 971,
+ 800, 997, 0, 876, 1183, 1191, 1176, 0, 0, 1174,
+ 1151, 1150, 1097, 0, 1095, 1100, 1089, 1096, 805, 1043,
+ 1047, 1043, 1023, 1016, 1010, 439, 808, 883, 1771, 1027,
+ 1041, 0, 971, 0, 952, 736, 864, 614, 799, 0,
+
+ 965, 976, 1046, 1061, 0, 1061, 1771, 714, 717, 858,
+ 774, 789, 859, 1042, 860, 953, 954, 1047, 1086, 1108,
+ 0, 1092, 0, 1094, 1140, 0, 950, 1182, 1091, 1110,
+ 1199, 1210, 0, 1244, 981, 0, 0, 0, 1243, 1273,
+ 890, 0, 0, 949, 0, 0, 0, 943, 0, 935,
+ 0, 1120, 1771, 1188, 900, 1303, 895, 1771, 0, 882,
+ 0, 1098, 1174, 440, 1177, 909, 421, 1048, 1093, 1102,
+ 1169, 846, 818, 814, 822, 779, 792, 1249, 1190, 1191,
+ 1192, 1322, 1228, 750, 1331, 1361, 0, 1106, 0, 1229,
+ 1378, 0, 1325, 1326, 1349, 726, 725, 1410, 0, 0,
+
+ 0, 0, 1771, 722, 839, 713, 644, 1369, 668, 671,
+ 663, 615, 617, 576, 591, 1198, 540, 459, 456, 1440,
+ 1462, 1483, 1458, 1771, 414, 0, 1517, 249, 794, 1238,
+ 237, 258, 1310, 0, 203, 190, 209, 1460, 1477, 1350,
+ 0, 1480, 1771, 131, 1328, 726, 1472, 0, 0, 86,
+ 1516, 1523, 1522, 1385, 835, 0, 1505, 1511, 1527, 1533,
+ 1549, 1771, 1571, 1587, 1592, 1608, 1622, 1639, 1642, 1649,
+ 89, 187, 1656, 1672, 1689, 1701, 1707, 1718, 1720, 1736,
+ 902, 903, 1743, 1754
+ } ;
+
+static yyconst short int yy_def[385] =
+ { 0,
+ 362, 1, 362, 3, 1, 1, 362, 362, 362, 362,
+ 362, 363, 362, 362, 362, 362, 362, 362, 362, 364,
+ 362, 362, 362, 362, 365, 362, 362, 362, 366, 366,
+ 30, 30, 30, 30, 30, 30, 30, 30, 367, 367,
+ 11, 362, 367, 362, 367, 367, 367, 367, 367, 362,
+ 367, 367, 52, 367, 362, 367, 367, 367, 367, 362,
+ 60, 60, 60, 60, 60, 60, 60, 60, 60, 11,
+ 362, 362, 362, 362, 362, 362, 362, 362, 362, 362,
+ 362, 362, 363, 363, 363, 71, 71, 71, 86, 362,
+ 86, 86, 362, 368, 364, 362, 369, 370, 370, 362,
+
+ 371, 362, 362, 362, 372, 362, 362, 373, 362, 362,
+ 362, 362, 362, 374, 30, 362, 30, 30, 30, 30,
+ 30, 30, 30, 30, 30, 30, 30, 30, 30, 367,
+ 362, 367, 42, 42, 42, 44, 44, 86, 137, 137,
+ 367, 375, 50, 367, 55, 145, 146, 367, 367, 367,
+ 52, 367, 149, 367, 367, 362, 367, 367, 376, 367,
+ 367, 362, 60, 367, 60, 60, 60, 60, 60, 60,
+ 60, 60, 60, 60, 60, 60, 60, 92, 362, 362,
+ 362, 362, 362, 362, 362, 363, 362, 362, 362, 86,
+ 92, 368, 377, 370, 370, 378, 362, 362, 362, 372,
+
+ 373, 362, 374, 362, 379, 380, 362, 30, 30, 30,
+ 30, 30, 30, 30, 30, 30, 30, 42, 367, 86,
+ 140, 375, 368, 375, 362, 146, 146, 149, 367, 367,
+ 367, 149, 156, 367, 362, 381, 162, 204, 145, 60,
+ 367, 60, 60, 60, 60, 60, 60, 60, 60, 60,
+ 60, 362, 362, 362, 362, 86, 377, 362, 370, 362,
+ 382, 378, 362, 362, 362, 362, 362, 362, 362, 362,
+ 362, 362, 362, 362, 362, 362, 383, 380, 30, 30,
+ 30, 367, 367, 86, 86, 368, 225, 367, 146, 367,
+ 149, 228, 367, 367, 367, 362, 362, 362, 240, 60,
+
+ 60, 60, 362, 86, 362, 384, 362, 362, 362, 362,
+ 362, 362, 362, 362, 383, 367, 86, 86, 368, 368,
+ 367, 149, 367, 362, 362, 298, 367, 86, 362, 362,
+ 362, 384, 362, 86, 86, 368, 368, 367, 367, 367,
+ 322, 367, 362, 86, 362, 362, 362, 86, 368, 368,
+ 367, 367, 367, 362, 362, 368, 367, 362, 367, 362,
+ 367, 0, 362, 362, 362, 362, 362, 362, 362, 362,
+ 362, 362, 362, 362, 362, 362, 362, 362, 362, 362,
+ 362, 362, 362, 362
+ } ;
+
+static yyconst short int yy_nxt[1820] =
+ { 0,
+ 8, 9, 10, 9, 8, 11, 8, 12, 13, 14,
+ 15, 16, 17, 13, 18, 19, 20, 21, 22, 23,
+ 24, 13, 25, 26, 27, 28, 13, 13, 29, 30,
+ 29, 29, 29, 31, 29, 29, 29, 32, 29, 33,
+ 34, 35, 36, 29, 37, 29, 29, 38, 8, 9,
+ 10, 39, 40, 41, 40, 42, 43, 44, 45, 46,
+ 47, 43, 48, 49, 50, 51, 52, 53, 54, 43,
+ 55, 56, 57, 58, 59, 43, 60, 61, 60, 60,
+ 60, 62, 60, 60, 60, 63, 60, 64, 65, 66,
+ 67, 60, 68, 60, 60, 69, 70, 70, 115, 196,
+
+ 71, 71, 72, 83, 196, 131, 73, 72, 115, 72,
+ 126, 74, 115, 356, 84, 84, 75, 72, 76, 115,
+ 119, 115, 115, 77, 190, 120, 132, 115, 188, 115,
+ 122, 121, 179, 78, 79, 80, 81, 115, 129, 72,
+ 354, 82, 86, 87, 87, 88, 89, 89, 89, 89,
+ 89, 90, 89, 89, 89, 89, 89, 89, 89, 89,
+ 89, 89, 89, 89, 89, 89, 89, 89, 91, 89,
+ 89, 92, 92, 92, 92, 92, 92, 92, 92, 92,
+ 92, 92, 92, 92, 92, 92, 92, 92, 92, 92,
+ 95, 95, 95, 115, 101, 168, 127, 200, 165, 131,
+
+ 101, 169, 200, 115, 102, 96, 103, 103, 166, 115,
+ 102, 97, 103, 103, 350, 128, 103, 349, 99, 115,
+ 132, 104, 103, 111, 111, 112, 115, 104, 131, 123,
+ 348, 113, 131, 131, 131, 105, 115, 124, 114, 131,
+ 131, 125, 116, 111, 111, 112, 141, 131, 131, 132,
+ 142, 113, 131, 132, 132, 132, 131, 131, 114, 159,
+ 132, 132, 116, 179, 331, 148, 154, 171, 132, 132,
+ 346, 157, 117, 132, 158, 172, 344, 132, 132, 173,
+ 132, 72, 118, 130, 130, 131, 130, 133, 130, 130,
+ 130, 130, 130, 130, 130, 130, 130, 130, 134, 134,
+
+ 130, 130, 130, 130, 130, 130, 132, 130, 135, 135,
+ 135, 135, 135, 135, 135, 135, 135, 135, 135, 135,
+ 135, 135, 135, 135, 135, 135, 135, 135, 86, 87,
+ 87, 136, 137, 138, 137, 137, 137, 130, 137, 137,
+ 137, 137, 137, 137, 137, 137, 137, 137, 137, 137,
+ 137, 137, 137, 137, 139, 137, 137, 140, 140, 140,
+ 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
+ 140, 140, 140, 140, 140, 140, 95, 95, 143, 130,
+ 131, 130, 130, 130, 130, 130, 130, 130, 130, 130,
+ 130, 144, 130, 130, 130, 130, 130, 145, 130, 130,
+
+ 130, 132, 130, 146, 147, 146, 146, 146, 146, 146,
+ 146, 146, 146, 146, 146, 146, 146, 146, 146, 146,
+ 146, 146, 146, 131, 149, 179, 308, 179, 180, 186,
+ 186, 84, 84, 266, 150, 131, 151, 151, 181, 197,
+ 197, 343, 198, 72, 132, 72, 151, 199, 199, 115,
+ 115, 152, 115, 307, 209, 307, 132, 186, 186, 115,
+ 115, 336, 115, 208, 335, 153, 130, 130, 131, 130,
+ 130, 130, 130, 130, 130, 130, 130, 130, 130, 130,
+ 130, 130, 130, 130, 130, 130, 155, 130, 130, 132,
+ 130, 156, 156, 156, 156, 156, 156, 156, 156, 156,
+
+ 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
+ 156, 111, 111, 160, 130, 131, 130, 130, 130, 161,
+ 130, 130, 130, 130, 130, 130, 162, 130, 163, 163,
+ 164, 130, 130, 130, 130, 130, 132, 130, 163, 163,
+ 163, 163, 163, 163, 163, 163, 163, 163, 163, 163,
+ 163, 163, 163, 163, 163, 163, 163, 163, 86, 87,
+ 87, 87, 86, 86, 86, 86, 86, 334, 86, 86,
+ 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
+ 86, 86, 86, 86, 86, 86, 86, 178, 178, 178,
+ 178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
+
+ 178, 178, 178, 178, 178, 178, 86, 86, 86, 111,
+ 111, 111, 115, 115, 187, 308, 115, 115, 266, 211,
+ 115, 115, 115, 115, 114, 210, 115, 115, 116, 214,
+ 115, 115, 199, 199, 86, 86, 86, 86, 86, 86,
+ 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
+ 86, 86, 86, 188, 115, 115, 266, 115, 115, 266,
+ 135, 216, 333, 333, 115, 115, 215, 115, 115, 213,
+ 212, 218, 218, 191, 191, 191, 191, 191, 191, 191,
+ 191, 191, 191, 191, 191, 191, 191, 191, 191, 191,
+ 191, 191, 95, 95, 95, 266, 101, 111, 111, 112,
+
+ 203, 203, 203, 266, 204, 113, 102, 362, 103, 103,
+ 159, 266, 114, 97, 115, 131, 116, 135, 103, 331,
+ 99, 205, 131, 104, 115, 131, 217, 328, 135, 135,
+ 325, 132, 86, 86, 137, 131, 132, 131, 131, 355,
+ 219, 355, 260, 132, 115, 230, 132, 115, 229, 229,
+ 231, 231, 261, 324, 115, 317, 132, 115, 132, 132,
+ 137, 137, 137, 137, 137, 137, 137, 137, 137, 137,
+ 137, 137, 137, 137, 137, 137, 137, 137, 137, 221,
+ 221, 221, 221, 221, 221, 221, 221, 221, 221, 221,
+ 221, 221, 221, 221, 221, 221, 221, 221, 192, 192,
+
+ 131, 131, 131, 223, 115, 131, 252, 252, 252, 254,
+ 254, 254, 330, 330, 115, 253, 308, 265, 265, 115,
+ 314, 132, 132, 132, 224, 130, 132, 265, 255, 115,
+ 225, 225, 225, 225, 225, 225, 225, 225, 225, 225,
+ 225, 225, 225, 225, 225, 225, 225, 225, 225, 225,
+ 226, 226, 329, 358, 358, 313, 266, 330, 330, 312,
+ 226, 226, 226, 226, 226, 226, 226, 226, 226, 226,
+ 226, 226, 226, 226, 226, 226, 226, 226, 226, 226,
+ 131, 131, 263, 263, 254, 254, 254, 311, 115, 115,
+ 115, 279, 263, 228, 228, 131, 241, 264, 115, 115,
+
+ 115, 132, 132, 255, 228, 228, 228, 228, 228, 228,
+ 232, 232, 297, 306, 308, 305, 132, 297, 306, 258,
+ 303, 232, 232, 232, 232, 232, 232, 130, 130, 131,
+ 130, 130, 130, 130, 130, 130, 130, 130, 130, 130,
+ 130, 130, 233, 233, 130, 130, 130, 130, 234, 130,
+ 132, 130, 233, 233, 233, 233, 233, 233, 233, 233,
+ 233, 233, 233, 233, 233, 233, 233, 233, 233, 233,
+ 233, 233, 111, 111, 160, 302, 131, 111, 111, 112,
+ 161, 301, 300, 115, 115, 113, 296, 162, 289, 202,
+ 259, 164, 114, 281, 115, 258, 116, 132, 203, 203,
+
+ 237, 130, 238, 130, 130, 130, 130, 130, 130, 130,
+ 130, 130, 130, 130, 130, 130, 130, 130, 130, 239,
+ 130, 130, 130, 132, 130, 240, 240, 240, 240, 240,
+ 240, 240, 240, 240, 240, 240, 240, 240, 240, 240,
+ 240, 240, 240, 240, 240, 256, 256, 203, 203, 203,
+ 187, 204, 72, 308, 135, 72, 256, 256, 256, 256,
+ 256, 256, 111, 111, 112, 218, 218, 72, 205, 266,
+ 113, 266, 115, 267, 266, 72, 266, 114, 268, 72,
+ 280, 116, 115, 269, 266, 270, 72, 254, 254, 282,
+ 271, 131, 192, 192, 192, 192, 131, 223, 308, 286,
+
+ 272, 273, 274, 275, 260, 187, 283, 308, 276, 293,
+ 293, 131, 132, 284, 261, 131, 266, 132, 224, 293,
+ 224, 252, 252, 252, 294, 266, 285, 285, 231, 231,
+ 253, 251, 132, 250, 249, 248, 132, 285, 285, 285,
+ 285, 285, 285, 130, 130, 131, 130, 130, 130, 130,
+ 130, 130, 130, 130, 130, 130, 130, 130, 287, 287,
+ 130, 130, 130, 130, 288, 130, 132, 130, 287, 287,
+ 287, 287, 287, 287, 287, 287, 287, 287, 287, 287,
+ 287, 287, 287, 287, 287, 287, 287, 287, 290, 254,
+ 254, 254, 263, 263, 247, 265, 265, 246, 291, 309,
+
+ 292, 292, 263, 131, 131, 265, 245, 264, 255, 310,
+ 292, 292, 292, 292, 292, 292, 292, 295, 295, 244,
+ 115, 115, 115, 243, 132, 132, 242, 295, 232, 232,
+ 115, 115, 115, 131, 131, 235, 130, 227, 130, 232,
+ 232, 232, 232, 232, 232, 111, 111, 160, 316, 131,
+ 111, 111, 112, 161, 132, 132, 345, 345, 113, 220,
+ 162, 219, 321, 135, 164, 114, 345, 207, 202, 116,
+ 132, 298, 298, 298, 298, 298, 298, 298, 298, 298,
+ 298, 298, 298, 298, 298, 298, 298, 298, 298, 298,
+ 298, 299, 299, 195, 189, 188, 188, 187, 185, 184,
+
+ 72, 299, 299, 299, 299, 299, 299, 299, 299, 299,
+ 299, 299, 299, 299, 299, 299, 299, 299, 299, 299,
+ 299, 304, 304, 254, 254, 282, 183, 131, 347, 347,
+ 131, 131, 304, 304, 304, 304, 304, 304, 347, 323,
+ 182, 323, 283, 293, 293, 179, 345, 345, 132, 318,
+ 318, 132, 132, 293, 131, 131, 345, 177, 294, 176,
+ 318, 318, 318, 318, 318, 318, 319, 295, 295, 175,
+ 111, 111, 112, 174, 170, 132, 132, 295, 113, 320,
+ 320, 167, 130, 352, 110, 114, 254, 254, 254, 116,
+ 320, 320, 320, 320, 320, 320, 322, 322, 109, 107,
+
+ 106, 100, 94, 93, 362, 255, 362, 322, 322, 322,
+ 322, 322, 322, 130, 130, 131, 130, 130, 130, 130,
+ 130, 130, 130, 130, 130, 130, 130, 130, 326, 326,
+ 130, 130, 130, 130, 327, 130, 132, 130, 326, 326,
+ 326, 326, 326, 326, 326, 326, 326, 326, 326, 326,
+ 326, 326, 326, 326, 326, 326, 326, 326, 337, 337,
+ 362, 362, 362, 131, 362, 131, 362, 131, 362, 337,
+ 337, 337, 337, 337, 337, 338, 342, 342, 339, 339,
+ 339, 339, 131, 362, 132, 131, 132, 362, 132, 340,
+ 347, 347, 362, 362, 362, 351, 351, 362, 353, 353,
+
+ 347, 341, 341, 132, 362, 351, 132, 362, 353, 362,
+ 131, 341, 341, 341, 341, 341, 341, 341, 111, 111,
+ 160, 131, 131, 359, 359, 362, 161, 131, 131, 360,
+ 360, 132, 131, 162, 351, 351, 357, 164, 357, 360,
+ 353, 353, 132, 132, 351, 361, 361, 362, 132, 132,
+ 353, 360, 360, 132, 131, 361, 362, 362, 362, 362,
+ 362, 360, 362, 362, 362, 362, 362, 361, 361, 362,
+ 362, 362, 362, 362, 362, 132, 362, 361, 85, 362,
+ 362, 85, 362, 362, 362, 85, 85, 85, 98, 98,
+ 98, 362, 362, 362, 362, 362, 98, 362, 98, 362,
+
+ 362, 98, 98, 98, 108, 362, 108, 108, 108, 115,
+ 115, 115, 362, 362, 362, 362, 115, 115, 115, 362,
+ 362, 362, 115, 115, 115, 130, 130, 130, 130, 130,
+ 130, 130, 130, 130, 130, 130, 130, 130, 130, 192,
+ 192, 362, 192, 192, 192, 192, 192, 192, 192, 192,
+ 192, 192, 192, 192, 192, 192, 193, 193, 193, 194,
+ 362, 362, 362, 194, 194, 194, 201, 362, 362, 201,
+ 201, 201, 201, 206, 206, 206, 362, 206, 362, 362,
+ 362, 362, 362, 206, 362, 362, 206, 206, 206, 222,
+ 222, 362, 222, 222, 222, 222, 222, 222, 222, 222,
+
+ 222, 222, 222, 222, 222, 222, 236, 362, 362, 362,
+ 362, 236, 362, 362, 362, 362, 236, 257, 362, 362,
+ 257, 257, 257, 257, 262, 362, 362, 262, 262, 362,
+ 362, 362, 262, 262, 277, 277, 277, 278, 278, 278,
+ 362, 362, 362, 362, 278, 278, 278, 362, 362, 362,
+ 278, 278, 278, 315, 362, 362, 315, 315, 315, 315,
+ 332, 362, 362, 362, 332, 362, 362, 362, 332, 332,
+ 7, 362, 362, 362, 362, 362, 362, 362, 362, 362,
+ 362, 362, 362, 362, 362, 362, 362, 362, 362, 362,
+ 362, 362, 362, 362, 362, 362, 362, 362, 362, 362,
+
+ 362, 362, 362, 362, 362, 362, 362, 362, 362, 362,
+ 362, 362, 362, 362, 362, 362, 362, 362, 362
+ } ;
+
+static yyconst short int yy_chk[1820] =
+ { 0,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 5, 6, 35, 371,
+
+ 5, 6, 11, 12, 371, 39, 11, 11, 35, 11,
+ 35, 11, 31, 350, 12, 12, 11, 11, 11, 33,
+ 31, 32, 31, 11, 91, 32, 39, 38, 91, 33,
+ 33, 32, 73, 11, 11, 11, 11, 38, 38, 73,
+ 344, 11, 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
+ 20, 20, 20, 36, 22, 63, 36, 372, 61, 40,
+
+ 23, 63, 372, 36, 22, 20, 22, 22, 61, 37,
+ 23, 20, 23, 23, 337, 37, 22, 336, 20, 37,
+ 40, 22, 23, 29, 29, 29, 34, 23, 43, 34,
+ 335, 29, 45, 46, 48, 22, 34, 34, 29, 47,
+ 49, 34, 29, 30, 30, 30, 47, 51, 54, 43,
+ 49, 30, 56, 45, 46, 48, 57, 58, 30, 59,
+ 47, 49, 30, 74, 332, 51, 54, 65, 51, 54,
+ 331, 56, 30, 56, 57, 65, 328, 57, 58, 65,
+ 59, 74, 30, 42, 42, 42, 42, 42, 42, 42,
+ 42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
+
+ 42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
+ 42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
+ 42, 42, 42, 42, 42, 42, 42, 42, 44, 44,
+ 44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
+ 44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
+ 44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
+ 44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
+ 44, 44, 44, 44, 44, 44, 50, 50, 50, 50,
+ 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
+ 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
+
+ 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
+ 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
+ 50, 50, 50, 52, 52, 75, 267, 76, 77, 83,
+ 83, 84, 84, 267, 52, 130, 52, 52, 77, 102,
+ 102, 325, 104, 75, 52, 76, 52, 104, 104, 115,
+ 117, 52, 118, 264, 118, 264, 130, 186, 186, 115,
+ 117, 319, 118, 117, 318, 52, 55, 55, 55, 55,
+ 55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
+ 55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
+ 55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
+
+ 55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
+ 55, 60, 60, 60, 60, 60, 60, 60, 60, 60,
+ 60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
+ 60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
+ 60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
+ 60, 60, 60, 60, 60, 60, 60, 60, 71, 71,
+ 71, 71, 71, 71, 71, 71, 71, 317, 71, 71,
+ 71, 71, 71, 71, 71, 71, 71, 71, 71, 71,
+ 71, 71, 71, 71, 71, 71, 71, 71, 71, 71,
+ 71, 71, 71, 71, 71, 71, 71, 71, 71, 71,
+
+ 71, 71, 71, 71, 71, 71, 86, 86, 86, 111,
+ 111, 111, 119, 120, 86, 315, 121, 122, 314, 122,
+ 126, 125, 119, 120, 111, 119, 121, 122, 111, 125,
+ 126, 125, 198, 198, 86, 86, 86, 86, 86, 86,
+ 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
+ 86, 86, 86, 92, 123, 124, 313, 127, 128, 312,
+ 133, 128, 307, 307, 123, 124, 127, 127, 128, 124,
+ 123, 133, 133, 92, 92, 92, 92, 92, 92, 92,
+ 92, 92, 92, 92, 92, 92, 92, 92, 92, 92,
+ 92, 92, 95, 95, 95, 311, 103, 112, 112, 112,
+
+ 114, 114, 114, 310, 114, 112, 103, 95, 103, 103,
+ 132, 309, 112, 95, 129, 141, 112, 135, 103, 306,
+ 95, 114, 144, 103, 129, 148, 129, 304, 135, 135,
+ 297, 132, 137, 137, 137, 150, 141, 152, 154, 346,
+ 137, 346, 196, 144, 208, 152, 148, 209, 150, 150,
+ 152, 152, 196, 296, 208, 284, 150, 209, 152, 154,
+ 137, 137, 137, 137, 137, 137, 137, 137, 137, 137,
+ 137, 137, 137, 137, 137, 137, 137, 137, 137, 140,
+ 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
+ 140, 140, 140, 140, 140, 140, 140, 140, 142, 142,
+
+ 155, 157, 158, 142, 211, 161, 179, 179, 179, 187,
+ 187, 187, 329, 329, 211, 179, 277, 199, 199, 212,
+ 276, 155, 157, 158, 142, 145, 161, 199, 187, 212,
+ 145, 145, 145, 145, 145, 145, 145, 145, 145, 145,
+ 145, 145, 145, 145, 145, 145, 145, 145, 145, 145,
+ 146, 146, 305, 355, 355, 275, 274, 305, 305, 273,
+ 146, 146, 146, 146, 146, 146, 146, 146, 146, 146,
+ 146, 146, 146, 146, 146, 146, 146, 146, 146, 146,
+ 149, 164, 197, 197, 188, 188, 188, 272, 210, 213,
+ 215, 210, 197, 149, 149, 241, 164, 197, 210, 213,
+
+ 215, 149, 164, 188, 149, 149, 149, 149, 149, 149,
+ 153, 153, 381, 382, 266, 260, 241, 381, 382, 257,
+ 255, 153, 153, 153, 153, 153, 153, 156, 156, 156,
+ 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
+ 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
+ 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
+ 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
+ 156, 156, 160, 160, 160, 250, 160, 202, 202, 202,
+ 160, 248, 244, 216, 217, 202, 235, 160, 227, 201,
+ 195, 160, 202, 216, 217, 193, 202, 160, 162, 162,
+
+ 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
+ 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
+ 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
+ 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
+ 162, 162, 162, 162, 162, 190, 190, 203, 203, 203,
+ 191, 203, 185, 268, 218, 184, 190, 190, 190, 190,
+ 190, 190, 206, 206, 206, 218, 218, 183, 203, 204,
+ 206, 268, 214, 204, 204, 182, 204, 206, 204, 181,
+ 214, 206, 214, 204, 204, 204, 180, 219, 219, 219,
+ 204, 219, 222, 222, 224, 224, 229, 222, 269, 224,
+
+ 204, 204, 204, 204, 262, 178, 219, 270, 204, 229,
+ 229, 288, 219, 220, 262, 230, 269, 229, 222, 229,
+ 224, 252, 252, 252, 229, 270, 220, 220, 230, 230,
+ 252, 177, 288, 176, 175, 173, 230, 220, 220, 220,
+ 220, 220, 220, 225, 225, 225, 225, 225, 225, 225,
+ 225, 225, 225, 225, 225, 225, 225, 225, 225, 225,
+ 225, 225, 225, 225, 225, 225, 225, 225, 225, 225,
+ 225, 225, 225, 225, 225, 225, 225, 225, 225, 225,
+ 225, 225, 225, 225, 225, 225, 225, 225, 228, 254,
+ 254, 254, 263, 263, 172, 265, 265, 171, 228, 271,
+
+ 228, 228, 263, 316, 231, 265, 170, 263, 254, 271,
+ 228, 228, 228, 228, 228, 228, 228, 231, 231, 167,
+ 279, 280, 281, 166, 316, 231, 165, 231, 232, 232,
+ 279, 280, 281, 283, 290, 159, 151, 147, 143, 232,
+ 232, 232, 232, 232, 232, 234, 234, 234, 283, 234,
+ 278, 278, 278, 234, 283, 290, 330, 330, 278, 139,
+ 234, 136, 290, 134, 234, 278, 330, 116, 108, 278,
+ 234, 239, 239, 239, 239, 239, 239, 239, 239, 239,
+ 239, 239, 239, 239, 239, 239, 239, 239, 239, 239,
+ 239, 240, 240, 99, 90, 89, 88, 87, 82, 81,
+
+ 80, 240, 240, 240, 240, 240, 240, 240, 240, 240,
+ 240, 240, 240, 240, 240, 240, 240, 240, 240, 240,
+ 240, 256, 256, 282, 282, 282, 79, 282, 333, 333,
+ 293, 294, 256, 256, 256, 256, 256, 256, 333, 294,
+ 78, 294, 282, 293, 293, 72, 345, 345, 282, 285,
+ 285, 293, 294, 293, 295, 340, 345, 69, 293, 68,
+ 285, 285, 285, 285, 285, 285, 286, 295, 295, 67,
+ 308, 308, 308, 66, 64, 295, 340, 295, 308, 286,
+ 286, 62, 53, 340, 27, 308, 354, 354, 354, 308,
+ 286, 286, 286, 286, 286, 286, 291, 291, 26, 25,
+
+ 24, 21, 19, 17, 7, 354, 0, 291, 291, 291,
+ 291, 291, 291, 298, 298, 298, 298, 298, 298, 298,
+ 298, 298, 298, 298, 298, 298, 298, 298, 298, 298,
+ 298, 298, 298, 298, 298, 298, 298, 298, 298, 298,
+ 298, 298, 298, 298, 298, 298, 298, 298, 298, 298,
+ 298, 298, 298, 298, 298, 298, 298, 298, 320, 320,
+ 0, 0, 0, 323, 0, 338, 0, 321, 0, 320,
+ 320, 320, 320, 320, 320, 321, 323, 323, 338, 338,
+ 321, 321, 339, 0, 323, 342, 338, 0, 321, 322,
+ 347, 347, 0, 0, 0, 339, 339, 0, 342, 342,
+
+ 347, 322, 322, 339, 0, 339, 342, 0, 342, 0,
+ 357, 322, 322, 322, 322, 322, 322, 322, 327, 327,
+ 327, 351, 327, 357, 357, 0, 327, 353, 352, 358,
+ 358, 357, 359, 327, 351, 351, 352, 327, 352, 358,
+ 353, 353, 351, 327, 351, 359, 359, 0, 353, 352,
+ 353, 360, 360, 359, 361, 359, 0, 0, 0, 0,
+ 0, 360, 0, 0, 0, 0, 0, 361, 361, 0,
+ 0, 0, 0, 0, 0, 361, 0, 361, 363, 0,
+ 0, 363, 0, 0, 0, 363, 363, 363, 364, 364,
+ 364, 0, 0, 0, 0, 0, 364, 0, 364, 0,
+
+ 0, 364, 364, 364, 365, 0, 365, 365, 365, 366,
+ 366, 366, 0, 0, 0, 0, 366, 366, 366, 0,
+ 0, 0, 366, 366, 366, 367, 367, 367, 367, 367,
+ 367, 367, 367, 367, 367, 367, 367, 367, 367, 368,
+ 368, 0, 368, 368, 368, 368, 368, 368, 368, 368,
+ 368, 368, 368, 368, 368, 368, 369, 369, 369, 370,
+ 0, 0, 0, 370, 370, 370, 373, 0, 0, 373,
+ 373, 373, 373, 374, 374, 374, 0, 374, 0, 0,
+ 0, 0, 0, 374, 0, 0, 374, 374, 374, 375,
+ 375, 0, 375, 375, 375, 375, 375, 375, 375, 375,
+
+ 375, 375, 375, 375, 375, 375, 376, 0, 0, 0,
+ 0, 376, 0, 0, 0, 0, 376, 377, 0, 0,
+ 377, 377, 377, 377, 378, 0, 0, 378, 378, 0,
+ 0, 0, 378, 378, 379, 379, 379, 380, 380, 380,
+ 0, 0, 0, 0, 380, 380, 380, 0, 0, 0,
+ 380, 380, 380, 383, 0, 0, 383, 383, 383, 383,
+ 384, 0, 0, 0, 384, 0, 0, 0, 384, 384,
+ 362, 362, 362, 362, 362, 362, 362, 362, 362, 362,
+ 362, 362, 362, 362, 362, 362, 362, 362, 362, 362,
+ 362, 362, 362, 362, 362, 362, 362, 362, 362, 362,
+
+ 362, 362, 362, 362, 362, 362, 362, 362, 362, 362,
+ 362, 362, 362, 362, 362, 362, 362, 362, 362
+ } ;
+
+static yy_state_type yy_state_buf[YY_BUF_SIZE + 2], *yy_state_ptr;
+static char *yy_full_match;
+static int yy_lp;
+static int yy_looking_for_trail_begin = 0;
+static int yy_full_lp;
+static int *yy_full_state;
+#define YY_TRAILING_MASK 0x2000
+#define YY_TRAILING_HEAD_MASK 0x4000
+#define REJECT \
+{ \
+*yy_cp = yy_hold_char; /* undo effects of setting up yytext */ \
+yy_cp = yy_full_match; /* restore poss. backed-over text */ \
+yy_lp = yy_full_lp; /* restore orig. accepting pos. */ \
+yy_state_ptr = yy_full_state; /* restore orig. state */ \
+yy_current_state = *yy_state_ptr; /* restore curr. state */ \
+++yy_lp; \
+goto find_rule; \
+}
+#define yymore() yymore_used_but_not_detected
+#define YY_MORE_ADJ 0
+#define YY_RESTORE_YY_MORE_OFFSET
+char *yytext;
+#line 1 "./ada-lex.l"
+#define INITIAL 0
+/* FLEX lexer for Ada expressions, for GDB.
+ Copyright (C) 1994, 1997, 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., 675 Mass Ave, Cambridge, MA 02139, USA. */
+/*----------------------------------------------------------------------*/
+/* The converted version of this file is to be included in ada-exp.y, */
+/* the Ada parser for gdb. The function yylex obtains characters from */
+/* the global pointer lexptr. It returns a syntactic category for */
+/* each successive token and places a semantic value into yylval */
+/* (ada-lval), defined by the parser. */
+/* Run flex with (at least) the -i option (case-insensitive), and the -I */
+/* option (interactive---no unnecessary lookahead). */
+#line 48 "./ada-lex.l"
+#define NUMERAL_WIDTH 256
+#define LONGEST_SIGN ((ULONGEST) 1 << (sizeof(LONGEST) * HOST_CHAR_BIT - 1))
+
+/* Temporary staging for numeric literals. */
+static char numbuf[NUMERAL_WIDTH];
+ static void canonicalizeNumeral (char* s1, const char*);
+static int processInt (const char*, const char*, const char*);
+static int processReal (const char*);
+static int processId (const char*, int);
+static int processAttribute (const char*);
+static int find_dot_all (const char*);
+
+#undef YY_DECL
+#define YY_DECL static int yylex ( void )
+
+#undef YY_INPUT
+#define YY_INPUT(BUF, RESULT, MAX_SIZE) \
+ if ( *lexptr == '\000' ) \
+ (RESULT) = YY_NULL; \
+ else \
+ { \
+ *(BUF) = *lexptr; \
+ (RESULT) = 1; \
+ lexptr += 1; \
+ }
+
+static char *tempbuf = NULL;
+static int tempbufsize = 0;
+static int tempbuf_len;
+static struct block* left_block_context;
+
+static void resize_tempbuf (unsigned int);
+
+static void block_lookup (char*, char*);
+
+static int name_lookup (char*, char*, int*);
+
+static int find_dot_all (const char*);
+
+#define IN_STRING 1
+#define BEFORE_QUAL_QUOTE 2
+
+
+/* Macros after this point can all be overridden by user definitions in
+ * section 1.
+ */
+
+#ifndef YY_SKIP_YYWRAP
+#ifdef __cplusplus
+extern "C" int yywrap YY_PROTO(( void ));
+#else
+extern int yywrap YY_PROTO(( void ));
+#endif
+#endif
+
+#ifndef YY_NO_UNPUT
+static void yyunput YY_PROTO(( int c, char *buf_ptr ));
+#endif
+
+#ifndef yytext_ptr
+static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
+#endif
+
+#ifdef YY_NEED_STRLEN
+static int yy_flex_strlen YY_PROTO(( yyconst char * ));
+#endif
+
+#ifndef YY_NO_INPUT
+#ifdef __cplusplus
+static int yyinput YY_PROTO(( void ));
+#else
+static int input YY_PROTO(( void ));
+#endif
+#endif
+
+#if YY_STACK_USED
+static int yy_start_stack_ptr = 0;
+static int yy_start_stack_depth = 0;
+static int *yy_start_stack = 0;
+#ifndef YY_NO_PUSH_STATE
+static void yy_push_state YY_PROTO(( int new_state ));
+#endif
+#ifndef YY_NO_POP_STATE
+static void yy_pop_state YY_PROTO(( void ));
+#endif
+#ifndef YY_NO_TOP_STATE
+static int yy_top_state YY_PROTO(( void ));
+#endif
+
+#else
+#define YY_NO_PUSH_STATE 1
+#define YY_NO_POP_STATE 1
+#define YY_NO_TOP_STATE 1
+#endif
+
+#ifdef YY_MALLOC_DECL
+YY_MALLOC_DECL
+#else
+#if __STDC__
+#ifndef __cplusplus
+#include <stdlib.h>
+#endif
+#else
+/* Just try to get by without declaring the routines. This will fail
+ * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
+ * or sizeof(void*) != sizeof(int).
+ */
+#endif
+#endif
+
+/* Amount of stuff to slurp up with each read. */
+#ifndef YY_READ_BUF_SIZE
+#define YY_READ_BUF_SIZE 8192
+#endif
+
+/* Copy whatever the last rule matched to the standard output. */
+
+#ifndef ECHO
+/* This used to be an fputs(), but since the string might contain NUL's,
+ * we now use fwrite().
+ */
+#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
+#endif
+
+/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
+ * is returned in "result".
+ */
+#ifndef YY_INPUT
+#define YY_INPUT(buf,result,max_size) \
+ if ( yy_current_buffer->yy_is_interactive ) \
+ { \
+ int c = '*', n; \
+ for ( n = 0; n < max_size && \
+ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
+ buf[n] = (char) c; \
+ if ( c == '\n' ) \
+ buf[n++] = (char) c; \
+ if ( c == EOF && ferror( yyin ) ) \
+ YY_FATAL_ERROR( "input in flex scanner failed" ); \
+ result = n; \
+ } \
+ else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
+ && ferror( yyin ) ) \
+ YY_FATAL_ERROR( "input in flex scanner failed" );
+#endif
+
+/* No semi-colon after return; correct usage is to write "yyterminate();" -
+ * we don't want an extra ';' after the "return" because that will cause
+ * some compilers to complain about unreachable statements.
+ */
+#ifndef yyterminate
+#define yyterminate() return YY_NULL
+#endif
+
+/* Number of entries by which start-condition stack grows. */
+#ifndef YY_START_STACK_INCR
+#define YY_START_STACK_INCR 25
+#endif
+
+/* Report a fatal error. */
+#ifndef YY_FATAL_ERROR
+#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
+#endif
+
+/* Default declaration of generated scanner - a define so the user can
+ * easily add parameters.
+ */
+#ifndef YY_DECL
+#define YY_DECL int yylex YY_PROTO(( void ))
+#endif
+
+/* Code executed at the beginning of each rule, after yytext and yyleng
+ * have been set up.
+ */
+#ifndef YY_USER_ACTION
+#define YY_USER_ACTION
+#endif
+
+/* Code executed at the end of each rule. */
+#ifndef YY_BREAK
+#define YY_BREAK break;
+#endif
+
+#define YY_RULE_SETUP \
+ YY_USER_ACTION
+
+YY_DECL
+ {
+ register yy_state_type yy_current_state;
+ register char *yy_cp, *yy_bp;
+ register int yy_act;
+
+#line 91 "./ada-lex.l"
+
+
+
+ if ( yy_init )
+ {
+ yy_init = 0;
+
+#ifdef YY_USER_INIT
+ YY_USER_INIT;
+#endif
+
+ if ( ! yy_start )
+ yy_start = 1; /* first start state */
+
+ if ( ! yyin )
+ yyin = stdin;
+
+ if ( ! yyout )
+ yyout = stdout;
+
+ if ( ! yy_current_buffer )
+ yy_current_buffer =
+ yy_create_buffer( yyin, YY_BUF_SIZE );
+
+ yy_load_buffer_state();
+ }
+
+ while ( 1 ) /* loops until end-of-file is reached */
+ {
+ yy_cp = yy_c_buf_p;
+
+ /* Support of yytext. */
+ *yy_cp = yy_hold_char;
+
+ /* yy_bp points to the position in yy_ch_buf of the start of
+ * the current run.
+ */
+ yy_bp = yy_cp;
+
+ yy_current_state = yy_start;
+ yy_state_ptr = yy_state_buf;
+ *yy_state_ptr++ = yy_current_state;
+yy_match:
+ do
+ {
+ register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
+ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+ {
+ yy_current_state = (int) yy_def[yy_current_state];
+ if ( yy_current_state >= 363 )
+ yy_c = yy_meta[(unsigned int) yy_c];
+ }
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+ *yy_state_ptr++ = yy_current_state;
+ ++yy_cp;
+ }
+ while ( yy_base[yy_current_state] != 1771 );
+
+yy_find_action:
+ yy_current_state = *--yy_state_ptr;
+ yy_lp = yy_accept[yy_current_state];
+find_rule: /* we branch to this label when backing up */
+ for ( ; ; ) /* until we find what rule we matched */
+ {
+ if ( yy_lp && yy_lp < yy_accept[yy_current_state + 1] )
+ {
+ yy_act = yy_acclist[yy_lp];
+ if ( yy_act & YY_TRAILING_HEAD_MASK ||
+ yy_looking_for_trail_begin )
+ {
+ if ( yy_act == yy_looking_for_trail_begin )
+ {
+ yy_looking_for_trail_begin = 0;
+ yy_act &= ~YY_TRAILING_HEAD_MASK;
+ break;
+ }
+ }
+ else if ( yy_act & YY_TRAILING_MASK )
+ {
+ yy_looking_for_trail_begin = yy_act & ~YY_TRAILING_MASK;
+ yy_looking_for_trail_begin |= YY_TRAILING_HEAD_MASK;
+ }
+ else
+ {
+ yy_full_match = yy_cp;
+ yy_full_state = yy_state_ptr;
+ yy_full_lp = yy_lp;
+ break;
+ }
+ ++yy_lp;
+ goto find_rule;
+ }
+ --yy_cp;
+ yy_current_state = *--yy_state_ptr;
+ yy_lp = yy_accept[yy_current_state];
+ }
+
+ YY_DO_BEFORE_ACTION;
+
+
+do_action: /* This label is used only to access EOF actions. */
+
+
+ switch ( yy_act )
+ { /* beginning of action switch */
+case 1:
+YY_RULE_SETUP
+#line 93 "./ada-lex.l"
+{ }
+ YY_BREAK
+case 2:
+YY_RULE_SETUP
+#line 95 "./ada-lex.l"
+{ yyterminate(); }
+ YY_BREAK
+case 3:
+YY_RULE_SETUP
+#line 97 "./ada-lex.l"
+{
+ canonicalizeNumeral (numbuf, yytext);
+ return processInt (NULL, numbuf, strrchr(numbuf, 'e')+1);
+ }
+ YY_BREAK
+case 4:
+YY_RULE_SETUP
+#line 102 "./ada-lex.l"
+{
+ canonicalizeNumeral (numbuf, yytext);
+ return processInt (NULL, numbuf, NULL);
+ }
+ YY_BREAK
+case 5:
+YY_RULE_SETUP
+#line 107 "./ada-lex.l"
+{
+ canonicalizeNumeral (numbuf, yytext);
+ return processInt (numbuf,
+ strchr (numbuf, '#') + 1,
+ strrchr(numbuf, '#') + 1);
+ }
+ YY_BREAK
+case 6:
+YY_RULE_SETUP
+#line 114 "./ada-lex.l"
+{
+ canonicalizeNumeral (numbuf, yytext);
+ return processInt (numbuf, strchr (numbuf, '#') + 1, NULL);
+ }
+ YY_BREAK
+case 7:
+YY_RULE_SETUP
+#line 119 "./ada-lex.l"
+{
+ canonicalizeNumeral (numbuf, yytext+2);
+ return processInt ("16#", numbuf, NULL);
+ }
+ YY_BREAK
+case 8:
+YY_RULE_SETUP
+#line 125 "./ada-lex.l"
+{
+ canonicalizeNumeral (numbuf, yytext);
+ return processReal (numbuf);
+ }
+ YY_BREAK
+case 9:
+YY_RULE_SETUP
+#line 130 "./ada-lex.l"
+{
+ canonicalizeNumeral (numbuf, yytext);
+ return processReal (numbuf);
+ }
+ YY_BREAK
+case 10:
+YY_RULE_SETUP
+#line 135 "./ada-lex.l"
+{
+ error ("Based real literals not implemented yet.");
+ }
+ YY_BREAK
+case 11:
+YY_RULE_SETUP
+#line 139 "./ada-lex.l"
+{
+ error ("Based real literals not implemented yet.");
+ }
+ YY_BREAK
+case 12:
+YY_RULE_SETUP
+#line 143 "./ada-lex.l"
+{
+ yylval.typed_val.type = builtin_type_ada_char;
+ yylval.typed_val.val = yytext[1];
+ return CHARLIT;
+ }
+ YY_BREAK
+case 13:
+YY_RULE_SETUP
+#line 149 "./ada-lex.l"
+{
+ int v;
+ yylval.typed_val.type = builtin_type_ada_char;
+ sscanf (yytext+3, "%2x", &v);
+ yylval.typed_val.val = v;
+ return CHARLIT;
+ }
+ YY_BREAK
+case 14:
+YY_RULE_SETUP
+#line 157 "./ada-lex.l"
+{ return processId (yytext, yyleng); }
+ YY_BREAK
+case 15:
+YY_RULE_SETUP
+#line 159 "./ada-lex.l"
+{
+ tempbuf_len = 0;
+ BEGIN IN_STRING;
+ }
+ YY_BREAK
+case 16:
+YY_RULE_SETUP
+#line 164 "./ada-lex.l"
+{
+ resize_tempbuf (yyleng+tempbuf_len);
+ strncpy (tempbuf+tempbuf_len, yytext, yyleng-1);
+ tempbuf_len += yyleng-1;
+ yylval.sval.ptr = tempbuf;
+ yylval.sval.length = tempbuf_len;
+ BEGIN INITIAL;
+ return STRING;
+ }
+ YY_BREAK
+case 17:
+YY_RULE_SETUP
+#line 174 "./ada-lex.l"
+{
+ int n;
+ resize_tempbuf (yyleng-5+tempbuf_len+1);
+ strncpy (tempbuf+tempbuf_len, yytext, yyleng-6);
+ sscanf(yytext+yyleng-4, "%2x", &n);
+ tempbuf[yyleng-6+tempbuf_len] = (char) n;
+ tempbuf_len += yyleng-5;
+ }
+ YY_BREAK
+case 18:
+YY_RULE_SETUP
+#line 183 "./ada-lex.l"
+{
+ int n;
+ resize_tempbuf (yyleng-4+tempbuf_len+1);
+ strncpy (tempbuf+tempbuf_len, yytext, yyleng-6);
+ tempbuf[yyleng-5+tempbuf_len] = '"';
+ tempbuf_len += yyleng-4;
+ }
+ YY_BREAK
+case 19:
+YY_RULE_SETUP
+#line 191 "./ada-lex.l"
+{
+ while (*lexptr != 'i' && *lexptr != 'I')
+ lexptr -= 1;
+ yyrestart(NULL);
+ return 0;
+ }
+ YY_BREAK
+/* ADA KEYWORDS */
+case 20:
+YY_RULE_SETUP
+#line 200 "./ada-lex.l"
+{ return ABS; }
+ YY_BREAK
+case 21:
+YY_RULE_SETUP
+#line 201 "./ada-lex.l"
+{ return _AND_; }
+ YY_BREAK
+case 22:
+YY_RULE_SETUP
+#line 202 "./ada-lex.l"
+{ return ELSE; }
+ YY_BREAK
+case 23:
+YY_RULE_SETUP
+#line 203 "./ada-lex.l"
+{ return IN; }
+ YY_BREAK
+case 24:
+YY_RULE_SETUP
+#line 204 "./ada-lex.l"
+{ return MOD; }
+ YY_BREAK
+case 25:
+YY_RULE_SETUP
+#line 205 "./ada-lex.l"
+{ return NEW; }
+ YY_BREAK
+case 26:
+YY_RULE_SETUP
+#line 206 "./ada-lex.l"
+{ return NOT; }
+ YY_BREAK
+case 27:
+YY_RULE_SETUP
+#line 207 "./ada-lex.l"
+{ return NULL_PTR; }
+ YY_BREAK
+case 28:
+YY_RULE_SETUP
+#line 208 "./ada-lex.l"
+{ return OR; }
+ YY_BREAK
+case 29:
+YY_RULE_SETUP
+#line 209 "./ada-lex.l"
+{ return REM; }
+ YY_BREAK
+case 30:
+YY_RULE_SETUP
+#line 210 "./ada-lex.l"
+{ return THEN; }
+ YY_BREAK
+case 31:
+YY_RULE_SETUP
+#line 211 "./ada-lex.l"
+{ return XOR; }
+ YY_BREAK
+/* ATTRIBUTES */
+case 32:
+YY_RULE_SETUP
+#line 215 "./ada-lex.l"
+{ return processAttribute (yytext+1); }
+ YY_BREAK
+/* PUNCTUATION */
+case 33:
+YY_RULE_SETUP
+#line 219 "./ada-lex.l"
+{ return ARROW; }
+ YY_BREAK
+case 34:
+YY_RULE_SETUP
+#line 220 "./ada-lex.l"
+{ return DOTDOT; }
+ YY_BREAK
+case 35:
+YY_RULE_SETUP
+#line 221 "./ada-lex.l"
+{ return STARSTAR; }
+ YY_BREAK
+case 36:
+YY_RULE_SETUP
+#line 222 "./ada-lex.l"
+{ return ASSIGN; }
+ YY_BREAK
+case 37:
+YY_RULE_SETUP
+#line 223 "./ada-lex.l"
+{ return NOTEQUAL; }
+ YY_BREAK
+case 38:
+YY_RULE_SETUP
+#line 224 "./ada-lex.l"
+{ return LEQ; }
+ YY_BREAK
+case 39:
+YY_RULE_SETUP
+#line 225 "./ada-lex.l"
+{ return GEQ; }
+ YY_BREAK
+case 40:
+YY_RULE_SETUP
+#line 227 "./ada-lex.l"
+{ BEGIN INITIAL; return '\''; }
+ YY_BREAK
+case 41:
+YY_RULE_SETUP
+#line 229 "./ada-lex.l"
+{ return yytext[0]; }
+ YY_BREAK
+case 42:
+YY_RULE_SETUP
+#line 231 "./ada-lex.l"
+{ if (paren_depth == 0 && comma_terminates)
+ {
+ lexptr -= 1;
+ yyrestart(NULL);
+ return 0;
+ }
+ else
+ return ',';
+ }
+ YY_BREAK
+case 43:
+YY_RULE_SETUP
+#line 241 "./ada-lex.l"
+{ paren_depth += 1; return '('; }
+ YY_BREAK
+case 44:
+YY_RULE_SETUP
+#line 242 "./ada-lex.l"
+{ if (paren_depth == 0)
+ {
+ lexptr -= 1;
+ yyrestart(NULL);
+ return 0;
+ }
+ else
+ {
+ paren_depth -= 1;
+ return ')';
+ }
+ }
+ YY_BREAK
+case 45:
+YY_RULE_SETUP
+#line 255 "./ada-lex.l"
+{ return DOT_ALL; }
+ YY_BREAK
+case 46:
+YY_RULE_SETUP
+#line 257 "./ada-lex.l"
+{
+ processId (yytext+1, yyleng-1);
+ return DOT_ID;
+ }
+ YY_BREAK
+case 47:
+YY_RULE_SETUP
+#line 262 "./ada-lex.l"
+{
+ int all_posn = find_dot_all (yytext);
+ int token_type, segments, k;
+ int quote_follows;
+
+ if (all_posn == -1 && yytext[yyleng-1] == '\'')
+ {
+ quote_follows = 1;
+ do {
+ yyless (yyleng-1);
+ } while (yytext[yyleng-1] == ' ');
+ }
+ else
+ quote_follows = 0;
+
+ if (all_posn >= 0)
+ yyless (all_posn);
+ processId(yytext, yyleng);
+ segments = name_lookup (ada_mangle (yylval.ssym.stoken.ptr),
+ yylval.ssym.stoken.ptr, &token_type);
+ left_block_context = NULL;
+ for (k = yyleng; segments > 0 && k > 0; k -= 1)
+ {
+ if (yytext[k-1] == '.')
+ segments -= 1;
+ quote_follows = 0;
+ }
+ if (k <= 0)
+ error ("confused by name %s", yytext);
+ yyless (k);
+ if (quote_follows)
+ BEGIN BEFORE_QUAL_QUOTE;
+ return token_type;
+ }
+ YY_BREAK
+/* GDB EXPRESSION CONSTRUCTS */
+case 48:
+YY_RULE_SETUP
+#line 300 "./ada-lex.l"
+{
+ processId(yytext, yyleng-2);
+ block_lookup (yylval.ssym.stoken.ptr, yylval.ssym.stoken.ptr);
+ return BLOCKNAME;
+ }
+ YY_BREAK
+case 49:
+YY_RULE_SETUP
+#line 306 "./ada-lex.l"
+{
+ processId(yytext, yyleng-2);
+ block_lookup (ada_mangle (yylval.ssym.stoken.ptr),
+ yylval.ssym.stoken.ptr);
+ return BLOCKNAME;
+ }
+ YY_BREAK
+case 50:
+YY_RULE_SETUP
+#line 313 "./ada-lex.l"
+{ return yytext[0]; }
+ YY_BREAK
+case 51:
+YY_RULE_SETUP
+#line 315 "./ada-lex.l"
+{ yylval.lval = -1; return LAST; }
+ YY_BREAK
+case 52:
+YY_RULE_SETUP
+#line 316 "./ada-lex.l"
+{ yylval.lval = -atoi(yytext+2); return LAST; }
+ YY_BREAK
+case 53:
+YY_RULE_SETUP
+#line 317 "./ada-lex.l"
+{ yylval.lval = 0; return LAST; }
+ YY_BREAK
+case 54:
+YY_RULE_SETUP
+#line 318 "./ada-lex.l"
+{ yylval.lval = atoi(yytext+1); return LAST; }
+ YY_BREAK
+/* REGISTERS AND GDB CONVENIENCE VARIABLES */
+case 55:
+YY_RULE_SETUP
+#line 323 "./ada-lex.l"
+{
+ int c;
+ for (c = 0; c < NUM_REGS; c++)
+ if (REGISTER_NAME (c) &&
+ strcmp (yytext + 1, REGISTER_NAME (c)) == 0)
+ {
+ yylval.lval = c;
+ return REGNAME;
+ }
+ yylval.sval.ptr = yytext;
+ yylval.sval.length = yyleng;
+ yylval.ivar =
+ lookup_internalvar (copy_name (yylval.sval) + 1);
+ return INTERNAL_VARIABLE;
+ }
+ YY_BREAK
+/* CATCH-ALL ERROR CASE */
+case 56:
+YY_RULE_SETUP
+#line 341 "./ada-lex.l"
+{ error ("Invalid character '%s' in expression.", yytext); }
+ YY_BREAK
+case 57:
+YY_RULE_SETUP
+#line 342 "./ada-lex.l"
+YY_FATAL_ERROR( "flex scanner jammed" );
+ YY_BREAK
+ case YY_STATE_EOF(INITIAL):
+ case YY_STATE_EOF(IN_STRING):
+ case YY_STATE_EOF(BEFORE_QUAL_QUOTE):
+ yyterminate();
+
+ case YY_END_OF_BUFFER:
+ {
+ /* Amount of text matched not including the EOB char. */
+ int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
+
+ /* Undo the effects of YY_DO_BEFORE_ACTION. */
+ *yy_cp = yy_hold_char;
+ YY_RESTORE_YY_MORE_OFFSET
+
+ if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
+ {
+ /* We're scanning a new file or input source. It's
+ * possible that this happened because the user
+ * just pointed yyin at a new source and called
+ * yylex(). If so, then we have to assure
+ * consistency between yy_current_buffer and our
+ * globals. Here is the right place to do so, because
+ * this is the first action (other than possibly a
+ * back-up) that will match for the new input source.
+ */
+ yy_n_chars = yy_current_buffer->yy_n_chars;
+ yy_current_buffer->yy_input_file = yyin;
+ yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
+ }
+
+ /* Note that here we test for yy_c_buf_p "<=" to the position
+ * of the first EOB in the buffer, since yy_c_buf_p will
+ * already have been incremented past the NUL character
+ * (since all states make transitions on EOB to the
+ * end-of-buffer state). Contrast this with the test
+ * in input().
+ */
+ if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
+ { /* This was really a NUL. */
+ yy_state_type yy_next_state;
+
+ yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
+
+ yy_current_state = yy_get_previous_state();
+
+ /* Okay, we're now positioned to make the NUL
+ * transition. We couldn't have
+ * yy_get_previous_state() go ahead and do it
+ * for us because it doesn't know how to deal
+ * with the possibility of jamming (and we don't
+ * want to build jamming into it because then it
+ * will run more slowly).
+ */
+
+ yy_next_state = yy_try_NUL_trans( yy_current_state );
+
+ yy_bp = yytext_ptr + YY_MORE_ADJ;
+
+ if ( yy_next_state )
+ {
+ /* Consume the NUL. */
+ yy_cp = ++yy_c_buf_p;
+ yy_current_state = yy_next_state;
+ goto yy_match;
+ }
+
+ else
+ {
+ yy_cp = yy_c_buf_p;
+ goto yy_find_action;
+ }
+ }
+
+ else switch ( yy_get_next_buffer() )
+ {
+ case EOB_ACT_END_OF_FILE:
+ {
+ yy_did_buffer_switch_on_eof = 0;
+
+ if ( yywrap() )
+ {
+ /* Note: because we've taken care in
+ * yy_get_next_buffer() to have set up
+ * yytext, we can now set up
+ * yy_c_buf_p so that if some total
+ * hoser (like flex itself) wants to
+ * call the scanner after we return the
+ * YY_NULL, it'll still work - another
+ * YY_NULL will get returned.
+ */
+ yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
+
+ yy_act = YY_STATE_EOF(YY_START);
+ goto do_action;
+ }
+
+ else
+ {
+ if ( ! yy_did_buffer_switch_on_eof )
+ YY_NEW_FILE;
+ }
+ break;
+ }
+
+ case EOB_ACT_CONTINUE_SCAN:
+ yy_c_buf_p =
+ yytext_ptr + yy_amount_of_matched_text;
+
+ yy_current_state = yy_get_previous_state();
+
+ yy_cp = yy_c_buf_p;
+ yy_bp = yytext_ptr + YY_MORE_ADJ;
+ goto yy_match;
+
+ case EOB_ACT_LAST_MATCH:
+ yy_c_buf_p =
+ &yy_current_buffer->yy_ch_buf[yy_n_chars];
+
+ yy_current_state = yy_get_previous_state();
+
+ yy_cp = yy_c_buf_p;
+ yy_bp = yytext_ptr + YY_MORE_ADJ;
+ goto yy_find_action;
+ }
+ break;
+ }
+
+ default:
+ YY_FATAL_ERROR(
+ "fatal flex scanner internal error--no action found" );
+ } /* end of action switch */
+ } /* end of scanning one token */
+ } /* end of yylex */
+
+
+/* yy_get_next_buffer - try to read in a new buffer
+ *
+ * Returns a code representing an action:
+ * EOB_ACT_LAST_MATCH -
+ * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
+ * EOB_ACT_END_OF_FILE - end of file
+ */
+
+static int yy_get_next_buffer()
+ {
+ register char *dest = yy_current_buffer->yy_ch_buf;
+ register char *source = yytext_ptr;
+ register int number_to_move, i;
+ int ret_val;
+
+ if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
+ YY_FATAL_ERROR(
+ "fatal flex scanner internal error--end of buffer missed" );
+
+ if ( yy_current_buffer->yy_fill_buffer == 0 )
+ { /* Don't try to fill the buffer, so this is an EOF. */
+ if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
+ {
+ /* We matched a single character, the EOB, so
+ * treat this as a final EOF.
+ */
+ return EOB_ACT_END_OF_FILE;
+ }
+
+ else
+ {
+ /* We matched some text prior to the EOB, first
+ * process it.
+ */
+ return EOB_ACT_LAST_MATCH;
+ }
+ }
+
+ /* Try to read more data. */
+
+ /* First move last chars to start of buffer. */
+ number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
+
+ for ( i = 0; i < number_to_move; ++i )
+ *(dest++) = *(source++);
+
+ if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
+ /* don't do the read, it's not guaranteed to return an EOF,
+ * just force an EOF
+ */
+ yy_current_buffer->yy_n_chars = yy_n_chars = 0;
+
+ else
+ {
+ int num_to_read =
+ yy_current_buffer->yy_buf_size - number_to_move - 1;
+
+ while ( num_to_read <= 0 )
+ { /* Not enough room in the buffer - grow it. */
+#ifdef YY_USES_REJECT
+ YY_FATAL_ERROR(
+"input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
+#else
+
+ /* just a shorter name for the current buffer */
+ YY_BUFFER_STATE b = yy_current_buffer;
+
+ int yy_c_buf_p_offset =
+ (int) (yy_c_buf_p - b->yy_ch_buf);
+
+ if ( b->yy_is_our_buffer )
+ {
+ int new_size = b->yy_buf_size * 2;
+
+ if ( new_size <= 0 )
+ b->yy_buf_size += b->yy_buf_size / 8;
+ else
+ b->yy_buf_size *= 2;
+
+ b->yy_ch_buf = (char *)
+ /* Include room in for 2 EOB chars. */
+ yy_flex_realloc( (void *) b->yy_ch_buf,
+ b->yy_buf_size + 2 );
+ }
+ else
+ /* Can't grow it, we don't own it. */
+ b->yy_ch_buf = 0;
+
+ if ( ! b->yy_ch_buf )
+ YY_FATAL_ERROR(
+ "fatal error - scanner input buffer overflow" );
+
+ yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
+
+ num_to_read = yy_current_buffer->yy_buf_size -
+ number_to_move - 1;
+#endif
+ }
+
+ if ( num_to_read > YY_READ_BUF_SIZE )
+ num_to_read = YY_READ_BUF_SIZE;
+
+ /* Read in more data. */
+ YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
+ yy_n_chars, num_to_read );
+
+ yy_current_buffer->yy_n_chars = yy_n_chars;
+ }
+
+ if ( yy_n_chars == 0 )
+ {
+ if ( number_to_move == YY_MORE_ADJ )
+ {
+ ret_val = EOB_ACT_END_OF_FILE;
+ yyrestart( yyin );
+ }
+
+ else
+ {
+ ret_val = EOB_ACT_LAST_MATCH;
+ yy_current_buffer->yy_buffer_status =
+ YY_BUFFER_EOF_PENDING;
+ }
+ }
+
+ else
+ ret_val = EOB_ACT_CONTINUE_SCAN;
+
+ yy_n_chars += number_to_move;
+ yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
+ yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
+
+ yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
+
+ return ret_val;
+ }
+
+
+/* yy_get_previous_state - get the state just before the EOB char was reached */
+
+static yy_state_type yy_get_previous_state()
+ {
+ register yy_state_type yy_current_state;
+ register char *yy_cp;
+
+ yy_current_state = yy_start;
+ yy_state_ptr = yy_state_buf;
+ *yy_state_ptr++ = yy_current_state;
+
+ for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
+ {
+ register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
+ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+ {
+ yy_current_state = (int) yy_def[yy_current_state];
+ if ( yy_current_state >= 363 )
+ yy_c = yy_meta[(unsigned int) yy_c];
+ }
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+ *yy_state_ptr++ = yy_current_state;
+ }
+
+ return yy_current_state;
+ }
+
+
+/* yy_try_NUL_trans - try to make a transition on the NUL character
+ *
+ * synopsis
+ * next_state = yy_try_NUL_trans( current_state );
+ */
+
+#ifdef YY_USE_PROTOS
+static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
+#else
+static yy_state_type yy_try_NUL_trans( yy_current_state )
+yy_state_type yy_current_state;
+#endif
+ {
+ register int yy_is_jam;
+
+ register YY_CHAR yy_c = 1;
+ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+ {
+ yy_current_state = (int) yy_def[yy_current_state];
+ if ( yy_current_state >= 363 )
+ yy_c = yy_meta[(unsigned int) yy_c];
+ }
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+ yy_is_jam = (yy_current_state == 362);
+ if ( ! yy_is_jam )
+ *yy_state_ptr++ = yy_current_state;
+
+ return yy_is_jam ? 0 : yy_current_state;
+ }
+
+
+#ifndef YY_NO_UNPUT
+#ifdef YY_USE_PROTOS
+static void yyunput( int c, register char *yy_bp )
+#else
+static void yyunput( c, yy_bp )
+int c;
+register char *yy_bp;
+#endif
+ {
+ register char *yy_cp = yy_c_buf_p;
+
+ /* undo effects of setting up yytext */
+ *yy_cp = yy_hold_char;
+
+ if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
+ { /* need to shift things up to make room */
+ /* +2 for EOB chars. */
+ register int number_to_move = yy_n_chars + 2;
+ register char *dest = &yy_current_buffer->yy_ch_buf[
+ yy_current_buffer->yy_buf_size + 2];
+ register char *source =
+ &yy_current_buffer->yy_ch_buf[number_to_move];
+
+ while ( source > yy_current_buffer->yy_ch_buf )
+ *--dest = *--source;
+
+ yy_cp += (int) (dest - source);
+ yy_bp += (int) (dest - source);
+ yy_current_buffer->yy_n_chars =
+ yy_n_chars = yy_current_buffer->yy_buf_size;
+
+ if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
+ YY_FATAL_ERROR( "flex scanner push-back overflow" );
+ }
+
+ *--yy_cp = (char) c;
+
+
+ yytext_ptr = yy_bp;
+ yy_hold_char = *yy_cp;
+ yy_c_buf_p = yy_cp;
+ }
+#endif /* ifndef YY_NO_UNPUT */
+
+
+#ifdef __cplusplus
+static int yyinput()
+#else
+static int input()
+#endif
+ {
+ int c;
+
+ *yy_c_buf_p = yy_hold_char;
+
+ if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
+ {
+ /* yy_c_buf_p now points to the character we want to return.
+ * If this occurs *before* the EOB characters, then it's a
+ * valid NUL; if not, then we've hit the end of the buffer.
+ */
+ if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
+ /* This was really a NUL. */
+ *yy_c_buf_p = '\0';
+
+ else
+ { /* need more input */
+ int offset = yy_c_buf_p - yytext_ptr;
+ ++yy_c_buf_p;
+
+ switch ( yy_get_next_buffer() )
+ {
+ case EOB_ACT_LAST_MATCH:
+ /* This happens because yy_g_n_b()
+ * sees that we've accumulated a
+ * token and flags that we need to
+ * try matching the token before
+ * proceeding. But for input(),
+ * there's no matching to consider.
+ * So convert the EOB_ACT_LAST_MATCH
+ * to EOB_ACT_END_OF_FILE.
+ */
+
+ /* Reset buffer status. */
+ yyrestart( yyin );
+
+ /* fall through */
+
+ case EOB_ACT_END_OF_FILE:
+ {
+ if ( yywrap() )
+ return EOF;
+
+ if ( ! yy_did_buffer_switch_on_eof )
+ YY_NEW_FILE;
+#ifdef __cplusplus
+ return yyinput();
+#else
+ return input();
+#endif
+ }
+
+ case EOB_ACT_CONTINUE_SCAN:
+ yy_c_buf_p = yytext_ptr + offset;
+ break;
+ }
+ }
+ }
+
+ c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */
+ *yy_c_buf_p = '\0'; /* preserve yytext */
+ yy_hold_char = *++yy_c_buf_p;
+
+
+ return c;
+ }
+
+
+#ifdef YY_USE_PROTOS
+void yyrestart( FILE *input_file )
+#else
+void yyrestart( input_file )
+FILE *input_file;
+#endif
+ {
+ if ( ! yy_current_buffer )
+ yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
+
+ yy_init_buffer( yy_current_buffer, input_file );
+ yy_load_buffer_state();
+ }
+
+
+#ifdef YY_USE_PROTOS
+void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
+#else
+void yy_switch_to_buffer( new_buffer )
+YY_BUFFER_STATE new_buffer;
+#endif
+ {
+ if ( yy_current_buffer == new_buffer )
+ return;
+
+ if ( yy_current_buffer )
+ {
+ /* Flush out information for old buffer. */
+ *yy_c_buf_p = yy_hold_char;
+ yy_current_buffer->yy_buf_pos = yy_c_buf_p;
+ yy_current_buffer->yy_n_chars = yy_n_chars;
+ }
+
+ yy_current_buffer = new_buffer;
+ yy_load_buffer_state();
+
+ /* We don't actually know whether we did this switch during
+ * EOF (yywrap()) processing, but the only time this flag
+ * is looked at is after yywrap() is called, so it's safe
+ * to go ahead and always set it.
+ */
+ yy_did_buffer_switch_on_eof = 1;
+ }
+
+
+#ifdef YY_USE_PROTOS
+void yy_load_buffer_state( void )
+#else
+void yy_load_buffer_state()
+#endif
+ {
+ yy_n_chars = yy_current_buffer->yy_n_chars;
+ yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
+ yyin = yy_current_buffer->yy_input_file;
+ yy_hold_char = *yy_c_buf_p;
+ }
+
+
+#ifdef YY_USE_PROTOS
+YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
+#else
+YY_BUFFER_STATE yy_create_buffer( file, size )
+FILE *file;
+int size;
+#endif
+ {
+ YY_BUFFER_STATE b;
+
+ b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
+ if ( ! b )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
+
+ b->yy_buf_size = size;
+
+ /* yy_ch_buf has to be 2 characters longer than the size given because
+ * we need to put in 2 end-of-buffer characters.
+ */
+ b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
+ if ( ! b->yy_ch_buf )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
+
+ b->yy_is_our_buffer = 1;
+
+ yy_init_buffer( b, file );
+
+ return b;
+ }
+
+
+#ifdef YY_USE_PROTOS
+void yy_delete_buffer( YY_BUFFER_STATE b )
+#else
+void yy_delete_buffer( b )
+YY_BUFFER_STATE b;
+#endif
+ {
+ if ( ! b )
+ return;
+
+ if ( b == yy_current_buffer )
+ yy_current_buffer = (YY_BUFFER_STATE) 0;
+
+ if ( b->yy_is_our_buffer )
+ yy_flex_free( (void *) b->yy_ch_buf );
+
+ yy_flex_free( (void *) b );
+ }
+
+
+#ifndef YY_ALWAYS_INTERACTIVE
+#ifndef YY_NEVER_INTERACTIVE
+extern int isatty YY_PROTO(( int ));
+#endif
+#endif
+
+#ifdef YY_USE_PROTOS
+void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
+#else
+void yy_init_buffer( b, file )
+YY_BUFFER_STATE b;
+FILE *file;
+#endif
+
+
+ {
+ yy_flush_buffer( b );
+
+ b->yy_input_file = file;
+ b->yy_fill_buffer = 1;
+
+#if YY_ALWAYS_INTERACTIVE
+ b->yy_is_interactive = 1;
+#else
+#if YY_NEVER_INTERACTIVE
+ b->yy_is_interactive = 0;
+#else
+ b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
+#endif
+#endif
+ }
+
+
+#ifdef YY_USE_PROTOS
+void yy_flush_buffer( YY_BUFFER_STATE b )
+#else
+void yy_flush_buffer( b )
+YY_BUFFER_STATE b;
+#endif
+
+ {
+ if ( ! b )
+ return;
+
+ b->yy_n_chars = 0;
+
+ /* We always need two end-of-buffer characters. The first causes
+ * a transition to the end-of-buffer state. The second causes
+ * a jam in that state.
+ */
+ b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
+ b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
+
+ b->yy_buf_pos = &b->yy_ch_buf[0];
+
+ b->yy_at_bol = 1;
+ b->yy_buffer_status = YY_BUFFER_NEW;
+
+ if ( b == yy_current_buffer )
+ yy_load_buffer_state();
+ }
+
+
+#ifndef YY_NO_SCAN_BUFFER
+#ifdef YY_USE_PROTOS
+YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
+#else
+YY_BUFFER_STATE yy_scan_buffer( base, size )
+char *base;
+yy_size_t size;
+#endif
+ {
+ YY_BUFFER_STATE b;
+
+ if ( size < 2 ||
+ base[size-2] != YY_END_OF_BUFFER_CHAR ||
+ base[size-1] != YY_END_OF_BUFFER_CHAR )
+ /* They forgot to leave room for the EOB's. */
+ return 0;
+
+ b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
+ if ( ! b )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
+
+ b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
+ b->yy_buf_pos = b->yy_ch_buf = base;
+ b->yy_is_our_buffer = 0;
+ b->yy_input_file = 0;
+ b->yy_n_chars = b->yy_buf_size;
+ b->yy_is_interactive = 0;
+ b->yy_at_bol = 1;
+ b->yy_fill_buffer = 0;
+ b->yy_buffer_status = YY_BUFFER_NEW;
+
+ yy_switch_to_buffer( b );
+
+ return b;
+ }
+#endif
+
+
+#ifndef YY_NO_SCAN_STRING
+#ifdef YY_USE_PROTOS
+YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
+#else
+YY_BUFFER_STATE yy_scan_string( yy_str )
+yyconst char *yy_str;
+#endif
+ {
+ int len;
+ for ( len = 0; yy_str[len]; ++len )
+ ;
+
+ return yy_scan_bytes( yy_str, len );
+ }
+#endif
+
+
+#ifndef YY_NO_SCAN_BYTES
+#ifdef YY_USE_PROTOS
+YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
+#else
+YY_BUFFER_STATE yy_scan_bytes( bytes, len )
+yyconst char *bytes;
+int len;
+#endif
+ {
+ YY_BUFFER_STATE b;
+ char *buf;
+ yy_size_t n;
+ int i;
+
+ /* Get memory for full buffer, including space for trailing EOB's. */
+ n = len + 2;
+ buf = (char *) yy_flex_alloc( n );
+ if ( ! buf )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
+
+ for ( i = 0; i < len; ++i )
+ buf[i] = bytes[i];
+
+ buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
+
+ b = yy_scan_buffer( buf, n );
+ if ( ! b )
+ YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
+
+ /* It's okay to grow etc. this buffer, and we should throw it
+ * away when we're done.
+ */
+ b->yy_is_our_buffer = 1;
+
+ return b;
+ }
+#endif
+
+
+#ifndef YY_NO_PUSH_STATE
+#ifdef YY_USE_PROTOS
+static void yy_push_state( int new_state )
+#else
+static void yy_push_state( new_state )
+int new_state;
+#endif
+ {
+ if ( yy_start_stack_ptr >= yy_start_stack_depth )
+ {
+ yy_size_t new_size;
+
+ yy_start_stack_depth += YY_START_STACK_INCR;
+ new_size = yy_start_stack_depth * sizeof( int );
+
+ if ( ! yy_start_stack )
+ yy_start_stack = (int *) yy_flex_alloc( new_size );
+
+ else
+ yy_start_stack = (int *) yy_flex_realloc(
+ (void *) yy_start_stack, new_size );
+
+ if ( ! yy_start_stack )
+ YY_FATAL_ERROR(
+ "out of memory expanding start-condition stack" );
+ }
+
+ yy_start_stack[yy_start_stack_ptr++] = YY_START;
+
+ BEGIN(new_state);
+ }
+#endif
+
+
+#ifndef YY_NO_POP_STATE
+static void yy_pop_state()
+ {
+ if ( --yy_start_stack_ptr < 0 )
+ YY_FATAL_ERROR( "start-condition stack underflow" );
+
+ BEGIN(yy_start_stack[yy_start_stack_ptr]);
+ }
+#endif
+
+
+#ifndef YY_NO_TOP_STATE
+static int yy_top_state()
+ {
+ return yy_start_stack[yy_start_stack_ptr - 1];
+ }
+#endif
+
+#ifndef YY_EXIT_FAILURE
+#define YY_EXIT_FAILURE 2
+#endif
+
+#ifdef YY_USE_PROTOS
+static void yy_fatal_error( yyconst char msg[] )
+#else
+static void yy_fatal_error( msg )
+char msg[];
+#endif
+ {
+ (void) fprintf( stderr, "%s\n", msg );
+ exit( YY_EXIT_FAILURE );
+ }
+
+
+
+/* Redefine yyless() so it works in section 3 code. */
+
+#undef yyless
+#define yyless(n) \
+ do \
+ { \
+ /* Undo effects of setting up yytext. */ \
+ yytext[yyleng] = yy_hold_char; \
+ yy_c_buf_p = yytext + n; \
+ yy_hold_char = *yy_c_buf_p; \
+ *yy_c_buf_p = '\0'; \
+ yyleng = n; \
+ } \
+ while ( 0 )
+
+
+/* Internal utility routines. */
+
+#ifndef yytext_ptr
+#ifdef YY_USE_PROTOS
+static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
+#else
+static void yy_flex_strncpy( s1, s2, n )
+char *s1;
+yyconst char *s2;
+int n;
+#endif
+ {
+ register int i;
+ for ( i = 0; i < n; ++i )
+ s1[i] = s2[i];
+ }
+#endif
+
+#ifdef YY_NEED_STRLEN
+#ifdef YY_USE_PROTOS
+static int yy_flex_strlen( yyconst char *s )
+#else
+static int yy_flex_strlen( s )
+yyconst char *s;
+#endif
+ {
+ register int n;
+ for ( n = 0; s[n]; ++n )
+ ;
+
+ return n;
+ }
+#endif
+
+
+#ifdef YY_USE_PROTOS
+static void *yy_flex_alloc( yy_size_t size )
+#else
+static void *yy_flex_alloc( size )
+yy_size_t size;
+#endif
+ {
+ return (void *) malloc( size );
+ }
+
+#ifdef YY_USE_PROTOS
+static void *yy_flex_realloc( void *ptr, yy_size_t size )
+#else
+static void *yy_flex_realloc( ptr, size )
+void *ptr;
+yy_size_t size;
+#endif
+ {
+ /* The cast to (char *) in the following accommodates both
+ * implementations that use char* generic pointers, and those
+ * that use void* generic pointers. It works with the latter
+ * because both ANSI C and C++ allow castless assignment from
+ * any pointer type to void*, and deal with argument conversions
+ * as though doing an assignment.
+ */
+ return (void *) realloc( (char *) ptr, size );
+ }
+
+#ifdef YY_USE_PROTOS
+static void yy_flex_free( void *ptr )
+#else
+static void yy_flex_free( ptr )
+void *ptr;
+#endif
+ {
+ free( ptr );
+ }
+
+#if YY_MAIN
+int main()
+ {
+ yylex();
+ return 0;
+ }
+#endif
+#line 342 "./ada-lex.l"
+
+
+#include <ctype.h>
+#include <string.h>
+
+/* Initialize the lexer for processing new expression */
+void
+lexer_init (FILE* inp)
+{
+ BEGIN INITIAL;
+ yyrestart (inp);
+}
+
+
+/* Make sure that tempbuf points at an array at least N characters long. */
+
+static void
+resize_tempbuf (n)
+ unsigned int n;
+{
+ if (tempbufsize < n)
+ {
+ tempbufsize = (n+63) & ~63;
+ tempbuf = (char*) xrealloc (tempbuf, tempbufsize);
+ }
+}
+
+/* Copy S2 to S1, removing all underscores, and downcasing all letters. */
+
+static void
+canonicalizeNumeral (s1,s2)
+ char* s1;
+ const char* s2;
+{
+ for (; *s2 != '\000'; s2 += 1)
+ {
+ if (*s2 != '_')
+ {
+ *s1 = tolower(*s2);
+ s1 += 1;
+ }
+ }
+ s1[0] = '\000';
+}
+
+#define HIGH_BYTE_POSN ((sizeof (ULONGEST) - 1) * HOST_CHAR_BIT)
+
+/* True (non-zero) iff DIGIT is a valid digit in radix BASE,
+ where 2 <= BASE <= 16. */
+
+static int
+is_digit_in_base (digit, base)
+ unsigned char digit;
+ int base;
+{
+ if (!isxdigit (digit))
+ return 0;
+ if (base <= 10)
+ return (isdigit (digit) && digit < base + '0');
+ else
+ return (isdigit (digit) || tolower (digit) < base - 10 + 'a');
+}
+
+static int
+digit_to_int (c)
+ unsigned char c;
+{
+ if (isdigit (c))
+ return c - '0';
+ else
+ return tolower (c) - 'a' + 10;
+}
+
+/* As for strtoul, but for ULONGEST results. */
+ULONGEST
+strtoulst (num, trailer, base)
+ const char *num;
+ const char **trailer;
+ int base;
+{
+ unsigned int high_part;
+ ULONGEST result;
+ int i;
+ unsigned char lim;
+
+ if (base < 2 || base > 16)
+ {
+ errno = EINVAL;
+ return 0;
+ }
+ lim = base - 1 + '0';
+
+ result = high_part = 0;
+ for (i = 0; is_digit_in_base (num[i], base); i += 1)
+ {
+ result = result*base + digit_to_int (num[i]);
+ high_part = high_part*base + (unsigned int) (result >> HIGH_BYTE_POSN);
+ result &= ((ULONGEST) 1 << HIGH_BYTE_POSN) - 1;
+ if (high_part > 0xff)
+ {
+ errno = ERANGE;
+ result = high_part = 0;
+ break;
+ }
+ }
+
+ if (trailer != NULL)
+ *trailer = &num[i];
+
+ return result + ((ULONGEST) high_part << HIGH_BYTE_POSN);
+}
+
+
+
+/* Interprets the prefix of NUM that consists of digits of the given BASE
+ as an integer of that BASE, with the string EXP as an exponent.
+ Puts value in yylval, and returns INT, if the string is valid. Causes
+ an error if the number is improperly formated. BASE, if NULL, defaults
+ to "10", and EXP to "1". The EXP does not contain a leading 'e' or 'E'. */
+
+static int
+processInt (base0, num0, exp0)
+ const char* num0;
+ const char* base0;
+ const char* exp0;
+{
+ ULONGEST result;
+ long exp;
+ int base;
+
+ char* trailer;
+
+ if (base0 == NULL)
+ base = 10;
+ else
+ {
+ base = strtol (base0, (char**) NULL, 10);
+ if (base < 2 || base > 16)
+ error ("Invalid base: %d.", base);
+ }
+
+ if (exp0 == NULL)
+ exp = 0;
+ else
+ exp = strtol(exp0, (char**) NULL, 10);
+
+ errno = 0;
+ result = strtoulst (num0, &trailer, base);
+ if (errno == ERANGE)
+ error ("Integer literal out of range");
+ if (isxdigit(*trailer))
+ error ("Invalid digit `%c' in based literal", *trailer);
+
+ while (exp > 0)
+ {
+ if (result > (ULONG_MAX / base))
+ error ("Integer literal out of range");
+ result *= base;
+ exp -= 1;
+ }
+
+ if ((result >> (TARGET_INT_BIT-1)) == 0)
+ yylval.typed_val.type = builtin_type_ada_int;
+ else if ((result >> (TARGET_LONG_BIT-1)) == 0)
+ yylval.typed_val.type = builtin_type_ada_long;
+ else if (((result >> (TARGET_LONG_BIT-1)) >> 1) == 0)
+ {
+ /* We have a number representable as an unsigned integer quantity.
+ For consistency with the C treatment, we will treat it as an
+ anonymous modular (unsigned) quantity. Alas, the types are such
+ that we need to store .val as a signed quantity. Sorry
+ for the mess, but C doesn't officially guarantee that a simple
+ assignment does the trick (no, it doesn't; read the reference manual).
+ */
+ yylval.typed_val.type = builtin_type_unsigned_long;
+ if (result & LONGEST_SIGN)
+ yylval.typed_val.val =
+ (LONGEST) (result & ~LONGEST_SIGN)
+ - (LONGEST_SIGN>>1) - (LONGEST_SIGN>>1);
+ else
+ yylval.typed_val.val = (LONGEST) result;
+ return INT;
+ }
+ else
+ yylval.typed_val.type = builtin_type_ada_long_long;
+
+ yylval.typed_val.val = (LONGEST) result;
+ return INT;
+}
+
+static int
+processReal (num0)
+ const char* num0;
+{
+ if (sizeof (DOUBLEST) <= sizeof (float))
+ sscanf (num0, "%g", &yylval.typed_val_float.dval);
+ else if (sizeof (DOUBLEST) <= sizeof (double))
+ sscanf (num0, "%lg", &yylval.typed_val_float.dval);
+ else
+ {
+#ifdef PRINTF_HAS_LONG_DOUBLE
+ sscanf (num0, "%Lg", &yylval.typed_val_float.dval);
+#else
+ /* Scan it into a double, then convert and assign it to the
+ long double. This at least wins with values representable
+ in the range of doubles. */
+ double temp;
+ sscanf (num0, "%lg", &temp);
+ yylval.typed_val_float.dval = temp;
+#endif
+ }
+
+ yylval.typed_val_float.type = builtin_type_ada_float;
+ if (sizeof(DOUBLEST) >= TARGET_DOUBLE_BIT / TARGET_CHAR_BIT)
+ yylval.typed_val_float.type = builtin_type_ada_double;
+ if (sizeof(DOUBLEST) >= TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT)
+ yylval.typed_val_float.type = builtin_type_ada_long_double;
+
+ return FLOAT;
+}
+
+static int
+processId (name0, len)
+ const char *name0;
+ int len;
+{
+ char* name = xmalloc (len + 11);
+ int i0, i;
+
+/* add_name_string_cleanup (name); */
+/* FIXME: add_name_string_cleanup should be defined in parse.c */
+ while (len > 0 && isspace (name0[len-1]))
+ len -= 1;
+ i = i0 = 0;
+ while (i0 < len)
+ {
+ if (isalnum (name0[i0]))
+ {
+ name[i] = tolower (name0[i0]);
+ i += 1; i0 += 1;
+ }
+ else switch (name0[i0])
+ {
+ default:
+ name[i] = name0[i0];
+ i += 1; i0 += 1;
+ break;
+ case ' ': case '\t':
+ i0 += 1;
+ break;
+ case '\'':
+ i0 += 1;
+ while (i0 < len && name0[i0] != '\'')
+ {
+ name[i] = name0[i0];
+ i += 1; i0 += 1;
+ }
+ i0 += 1;
+ break;
+ case '<':
+ i0 += 1;
+ while (i0 < len && name0[i0] != '>')
+ {
+ name[i] = name0[i0];
+ i += 1; i0 += 1;
+ }
+ i0 += 1;
+ break;
+ }
+ }
+ name[i] = '\000';
+
+ yylval.ssym.sym = NULL;
+ yylval.ssym.stoken.ptr = name;
+ yylval.ssym.stoken.length = i;
+ return NAME;
+}
+
+static void
+block_lookup (name, err_name)
+ char* name;
+ char* err_name;
+{
+ struct symbol** syms;
+ struct block** blocks;
+ int nsyms;
+ struct symtab *symtab;
+ nsyms = ada_lookup_symbol_list (name, left_block_context,
+ VAR_NAMESPACE, &syms, &blocks);
+ if (left_block_context == NULL &&
+ (nsyms == 0 || SYMBOL_CLASS (syms[0]) != LOC_BLOCK))
+ symtab = lookup_symtab (name);
+ else
+ symtab = NULL;
+
+ if (symtab != NULL)
+ left_block_context = yylval.bval =
+ BLOCKVECTOR_BLOCK (BLOCKVECTOR (symtab), STATIC_BLOCK);
+ else if (nsyms == 0 || SYMBOL_CLASS (syms[0]) != LOC_BLOCK)
+ {
+ if (left_block_context == NULL)
+ error ("No file or function \"%s\".", err_name);
+ else
+ error ("No function \"%s\" in specified context.", err_name);
+ }
+ else
+ {
+ left_block_context = yylval.bval = SYMBOL_BLOCK_VALUE (syms[0]);
+ if (nsyms > 1)
+ warning ("Function name \"%s\" ambiguous here", err_name);
+ }
+}
+
+/* Look up NAME0 (assumed to be mangled) as a name in VAR_NAMESPACE,
+ setting *TOKEN_TYPE to NAME or TYPENAME, depending on what is
+ found. Try first the entire name, then the name without the last
+ segment (i.e., after the last .id), etc., and return the number of
+ segments that had to be removed to get a match. Calls error if no
+ matches are found, using ERR_NAME in any error message. When
+ exactly one symbol match is found, it is placed in yylval. */
+
+static int
+name_lookup (name0, err_name, token_type)
+ char* name0;
+ char* err_name;
+ int* token_type;
+{
+ struct symbol** syms;
+ struct block** blocks;
+ struct type* type;
+ int len0 = strlen (name0);
+ char* name = savestring (name0, len0);
+ int nsyms;
+ int segments;
+
+/* add_name_string_cleanup (name);*/
+/* FIXME: add_name_string_cleanup should be defined in parse.c */
+ yylval.ssym.stoken.ptr = name;
+ yylval.ssym.stoken.length = strlen (name);
+ for (segments = 0; ; segments += 1)
+ {
+ struct type* preferred_type;
+ int i, preferred_index;
+
+ if (left_block_context == NULL)
+ nsyms = ada_lookup_symbol_list (name, expression_context_block,
+ VAR_NAMESPACE, &syms, &blocks);
+ else
+ nsyms = ada_lookup_symbol_list (name, left_block_context,
+ VAR_NAMESPACE, &syms, &blocks);
+
+ /* Check for a type definition. */
+
+ /* Look for a symbol that doesn't denote void. This is (I think) a */
+ /* temporary kludge to get around problems in GNAT output. */
+ preferred_index = -1; preferred_type = NULL;
+ for (i = 0; i < nsyms; i += 1)
+ switch (SYMBOL_CLASS (syms[i]))
+ {
+ case LOC_TYPEDEF:
+ if (ada_prefer_type (SYMBOL_TYPE (syms[i]), preferred_type))
+ {
+ preferred_index = i;
+ preferred_type = SYMBOL_TYPE (syms[i]);
+ }
+ break;
+ case LOC_REGISTER:
+ case LOC_ARG:
+ case LOC_REF_ARG:
+ case LOC_REGPARM:
+ case LOC_REGPARM_ADDR:
+ case LOC_LOCAL:
+ case LOC_LOCAL_ARG:
+ case LOC_BASEREG:
+ case LOC_BASEREG_ARG:
+ goto NotType;
+ default:
+ break;
+ }
+ if (preferred_type != NULL)
+ {
+/* if (TYPE_CODE (preferred_type) == TYPE_CODE_VOID)
+ error ("`%s' matches only void type name(s)",
+ ada_demangle (name));
+*/
+/* FIXME: ada_demangle should be defined in defs.h, and is located in ada-lang.c */
+/* else*/ if (ada_is_object_renaming (syms[preferred_index]))
+ {
+ yylval.ssym.sym = syms[preferred_index];
+ *token_type = OBJECT_RENAMING;
+ return segments;
+ }
+ else if (ada_renaming_type (SYMBOL_TYPE (syms[preferred_index]))
+ != NULL)
+ {
+ int result;
+ const char* renaming =
+ ada_simple_renamed_entity (syms[preferred_index]);
+ char* new_name = xmalloc (strlen (renaming) + len0
+ - yylval.ssym.stoken.length + 1);
+/* add_name_string_cleanup (new_name);*/
+/* FIXME: add_name_string_cleanup should be defined in parse.c */
+ strcpy (new_name, renaming);
+ strcat (new_name, name0 + yylval.ssym.stoken.length);
+ result = name_lookup (new_name, err_name, token_type);
+ if (result > segments)
+ error ("Confused by renamed symbol.");
+ return result;
+ }
+ else if (segments == 0)
+ {
+ yylval.tval = preferred_type;
+ *token_type = TYPENAME;
+ return 0;
+ }
+ }
+
+ if (segments == 0)
+ {
+ type = lookup_primitive_typename (name);
+ if (type == NULL && STREQ ("system__address", name))
+ type = builtin_type_ada_system_address;
+ if (type != NULL)
+ {
+ yylval.tval = type;
+ *token_type = TYPENAME;
+ return 0;
+ }
+ }
+
+ NotType:
+ if (nsyms == 1)
+ {
+ *token_type = NAME;
+ yylval.ssym.sym = syms[0];
+ yylval.ssym.msym = NULL;
+ yylval.ssym.block = blocks[0];
+ return segments;
+ }
+ else if (nsyms == 0) {
+ int i;
+ yylval.ssym.msym = ada_lookup_minimal_symbol (name);
+ if (yylval.ssym.msym != NULL)
+ {
+ yylval.ssym.sym = NULL;
+ yylval.ssym.block = NULL;
+ *token_type = NAME;
+ return segments;
+ }
+
+ for (i = yylval.ssym.stoken.length - 1; i > 0; i -= 1)
+ {
+ if (name[i] == '.')
+ {
+ name[i] = '\0';
+ yylval.ssym.stoken.length = i;
+ break;
+ }
+ else if (name[i] == '_' && name[i-1] == '_')
+ {
+ i -= 1;
+ name[i] = '\0';
+ yylval.ssym.stoken.length = i;
+ break;
+ }
+ }
+ if (i <= 0)
+ {
+ if (!have_full_symbols () && !have_partial_symbols ()
+ && left_block_context == NULL)
+ error ("No symbol table is loaded. Use the \"file\" command.");
+ if (left_block_context == NULL)
+ error ("No definition of \"%s\" in current context.",
+ err_name);
+ else
+ error ("No definition of \"%s\" in specified context.",
+ err_name);
+ }
+ }
+ else
+ {
+ *token_type = NAME;
+ yylval.ssym.sym = NULL;
+ yylval.ssym.msym = NULL;
+ if (left_block_context == NULL)
+ yylval.ssym.block = expression_context_block;
+ else
+ yylval.ssym.block = left_block_context;
+ return segments;
+ }
+ }
+}
+
+/* Returns the position within STR of the '.' in a
+ '.{WHITE}*all' component of a dotted name, or -1 if there is none. */
+static int
+find_dot_all (str)
+ const char* str;
+{
+ int i;
+ for (i = 0; str[i] != '\000'; i += 1)
+ {
+ if (str[i] == '.')
+ {
+ int i0 = i;
+ do
+ i += 1;
+ while (isspace (str[i]));
+ if (strcmp (str+i, "all") == 0
+ && ! isalnum (str[i+3]) && str[i+3] != '_')
+ return i0;
+ }
+ }
+ return -1;
+}
+
+/* Returns non-zero iff string SUBSEQ matches a subsequence of STR, ignoring
+ case. */
+
+static int
+subseqMatch (subseq, str)
+ const char* subseq;
+ const char* str;
+{
+ if (subseq[0] == '\0')
+ return 1;
+ else if (str[0] == '\0')
+ return 0;
+ else if (tolower (subseq[0]) == tolower (str[0]))
+ return subseqMatch (subseq+1, str+1) || subseqMatch (subseq, str+1);
+ else
+ return subseqMatch (subseq, str+1);
+}
+
+
+static struct { const char* name; int code; }
+attributes[] = {
+ { "address", TICK_ADDRESS },
+ { "unchecked_access", TICK_ACCESS },
+ { "unrestricted_access", TICK_ACCESS },
+ { "access", TICK_ACCESS },
+ { "first", TICK_FIRST },
+ { "last", TICK_LAST },
+ { "length", TICK_LENGTH },
+ { "max", TICK_MAX },
+ { "min", TICK_MIN },
+ { "modulus", TICK_MODULUS },
+ { "pos", TICK_POS },
+ { "range", TICK_RANGE },
+ { "size", TICK_SIZE },
+ { "tag", TICK_TAG },
+ { "val", TICK_VAL },
+ { NULL, -1 }
+};
+
+/* Return the syntactic code corresponding to the attribute name or
+ abbreviation STR. */
+
+static int
+processAttribute (str)
+ const char* str;
+{
+ int i, k;
+
+ for (i = 0; attributes[i].code != -1; i += 1)
+ if (strcasecmp (str, attributes[i].name) == 0)
+ return attributes[i].code;
+
+ for (i = 0, k = -1; attributes[i].code != -1; i += 1)
+ if (subseqMatch (str, attributes[i].name))
+ {
+ if (k == -1)
+ k = i;
+ else
+ error ("ambiguous attribute name: `%s'", str);
+ }
+ if (k == -1)
+ error ("unrecognized attribute: `%s'", str);
+
+ return attributes[k].code;
+}
+
+int
+yywrap()
+{
+ return 1;
+}
diff --git a/gdb/ada-lex.l b/gdb/ada-lex.l
new file mode 100644
index 00000000000..2252d526a52
--- /dev/null
+++ b/gdb/ada-lex.l
@@ -0,0 +1,928 @@
+/* FLEX lexer for Ada expressions, for GDB.
+ Copyright (C) 1994, 1997, 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., 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+/*----------------------------------------------------------------------*/
+
+/* The converted version of this file is to be included in ada-exp.y, */
+/* the Ada parser for gdb. The function yylex obtains characters from */
+/* the global pointer lexptr. It returns a syntactic category for */
+/* each successive token and places a semantic value into yylval */
+/* (ada-lval), defined by the parser. */
+
+/* Run flex with (at least) the -i option (case-insensitive), and the -I */
+/* option (interactive---no unnecessary lookahead). */
+
+DIG [0-9]
+NUM10 ({DIG}({DIG}|_)*)
+HEXDIG [0-9a-f]
+NUM16 ({HEXDIG}({HEXDIG}|_)*)
+OCTDIG [0-7]
+LETTER [a-z_]
+ID ({LETTER}({LETTER}|{DIG})*|"<"{LETTER}({LETTER}|{DIG})*">")
+WHITE [ \t\n]
+TICK ("'"{WHITE}*)
+GRAPHIC [a-z0-9 #&'()*+,-./:;<>=_|!$%?@\[\]\\^`{}~]
+OPER ([-+*/=<>&]|"<="|">="|"**"|"/="|"and"|"or"|"xor"|"not"|"mod"|"rem"|"abs")
+
+EXP (e[+-]{NUM10})
+POSEXP (e"+"?{NUM10})
+
+%{
+#define NUMERAL_WIDTH 256
+#define LONGEST_SIGN ((ULONGEST) 1 << (sizeof(LONGEST) * HOST_CHAR_BIT - 1))
+
+/* Temporary staging for numeric literals. */
+static char numbuf[NUMERAL_WIDTH];
+ static void canonicalizeNumeral (char* s1, const char*);
+static int processInt (const char*, const char*, const char*);
+static int processReal (const char*);
+static int processId (const char*, int);
+static int processAttribute (const char*);
+static int find_dot_all (const char*);
+
+#undef YY_DECL
+#define YY_DECL static int yylex ( void )
+
+#undef YY_INPUT
+#define YY_INPUT(BUF, RESULT, MAX_SIZE) \
+ if ( *lexptr == '\000' ) \
+ (RESULT) = YY_NULL; \
+ else \
+ { \
+ *(BUF) = *lexptr; \
+ (RESULT) = 1; \
+ lexptr += 1; \
+ }
+
+static char *tempbuf = NULL;
+static int tempbufsize = 0;
+static int tempbuf_len;
+static struct block* left_block_context;
+
+static void resize_tempbuf (unsigned int);
+
+static void block_lookup (char*, char*);
+
+static int name_lookup (char*, char*, int*);
+
+static int find_dot_all (const char*);
+
+%}
+
+%s IN_STRING BEFORE_QUAL_QUOTE
+
+%%
+
+{WHITE} { }
+
+"--".* { yyterminate(); }
+
+{NUM10}{POSEXP} {
+ canonicalizeNumeral (numbuf, yytext);
+ return processInt (NULL, numbuf, strrchr(numbuf, 'e')+1);
+ }
+
+{NUM10} {
+ canonicalizeNumeral (numbuf, yytext);
+ return processInt (NULL, numbuf, NULL);
+ }
+
+{NUM10}"#"{HEXDIG}({HEXDIG}|_)*"#"{POSEXP} {
+ canonicalizeNumeral (numbuf, yytext);
+ return processInt (numbuf,
+ strchr (numbuf, '#') + 1,
+ strrchr(numbuf, '#') + 1);
+ }
+
+{NUM10}"#"{HEXDIG}({HEXDIG}|_)*"#" {
+ canonicalizeNumeral (numbuf, yytext);
+ return processInt (numbuf, strchr (numbuf, '#') + 1, NULL);
+ }
+
+"0x"{HEXDIG}+ {
+ canonicalizeNumeral (numbuf, yytext+2);
+ return processInt ("16#", numbuf, NULL);
+ }
+
+
+{NUM10}"."{NUM10}{EXP} {
+ canonicalizeNumeral (numbuf, yytext);
+ return processReal (numbuf);
+ }
+
+{NUM10}"."{NUM10} {
+ canonicalizeNumeral (numbuf, yytext);
+ return processReal (numbuf);
+ }
+
+{NUM10}"#"{NUM16}"."{NUM16}"#"{EXP} {
+ error ("Based real literals not implemented yet.");
+ }
+
+{NUM10}"#"{NUM16}"."{NUM16}"#" {
+ error ("Based real literals not implemented yet.");
+ }
+
+<INITIAL>"'"({GRAPHIC}|\")"'" {
+ yylval.typed_val.type = builtin_type_ada_char;
+ yylval.typed_val.val = yytext[1];
+ return CHARLIT;
+ }
+
+<INITIAL>"'[\""{HEXDIG}{2}"\"]'" {
+ int v;
+ yylval.typed_val.type = builtin_type_ada_char;
+ sscanf (yytext+3, "%2x", &v);
+ yylval.typed_val.val = v;
+ return CHARLIT;
+ }
+
+\"{OPER}\"/{WHITE}*"(" { return processId (yytext, yyleng); }
+
+<INITIAL>\" {
+ tempbuf_len = 0;
+ BEGIN IN_STRING;
+ }
+
+<IN_STRING>{GRAPHIC}*\" {
+ resize_tempbuf (yyleng+tempbuf_len);
+ strncpy (tempbuf+tempbuf_len, yytext, yyleng-1);
+ tempbuf_len += yyleng-1;
+ yylval.sval.ptr = tempbuf;
+ yylval.sval.length = tempbuf_len;
+ BEGIN INITIAL;
+ return STRING;
+ }
+
+<IN_STRING>{GRAPHIC}*"[\""{HEXDIG}{2}"\"]" {
+ int n;
+ resize_tempbuf (yyleng-5+tempbuf_len+1);
+ strncpy (tempbuf+tempbuf_len, yytext, yyleng-6);
+ sscanf(yytext+yyleng-4, "%2x", &n);
+ tempbuf[yyleng-6+tempbuf_len] = (char) n;
+ tempbuf_len += yyleng-5;
+ }
+
+<IN_STRING>{GRAPHIC}*"[\"\"\"]" {
+ int n;
+ resize_tempbuf (yyleng-4+tempbuf_len+1);
+ strncpy (tempbuf+tempbuf_len, yytext, yyleng-6);
+ tempbuf[yyleng-5+tempbuf_len] = '"';
+ tempbuf_len += yyleng-4;
+ }
+
+if {
+ while (*lexptr != 'i' && *lexptr != 'I')
+ lexptr -= 1;
+ yyrestart(NULL);
+ return 0;
+ }
+
+ /* ADA KEYWORDS */
+
+abs { return ABS; }
+and { return _AND_; }
+else { return ELSE; }
+in { return IN; }
+mod { return MOD; }
+new { return NEW; }
+not { return NOT; }
+null { return NULL_PTR; }
+or { return OR; }
+rem { return REM; }
+then { return THEN; }
+xor { return XOR; }
+
+ /* ATTRIBUTES */
+
+{TICK}[a-zA-Z][a-zA-Z]+ { return processAttribute (yytext+1); }
+
+ /* PUNCTUATION */
+
+"=>" { return ARROW; }
+".." { return DOTDOT; }
+"**" { return STARSTAR; }
+":=" { return ASSIGN; }
+"/=" { return NOTEQUAL; }
+"<=" { return LEQ; }
+">=" { return GEQ; }
+
+<BEFORE_QUAL_QUOTE>"'" { BEGIN INITIAL; return '\''; }
+
+[-&*+./:<>=|;\[\]] { return yytext[0]; }
+
+"," { if (paren_depth == 0 && comma_terminates)
+ {
+ lexptr -= 1;
+ yyrestart(NULL);
+ return 0;
+ }
+ else
+ return ',';
+ }
+
+"(" { paren_depth += 1; return '('; }
+")" { if (paren_depth == 0)
+ {
+ lexptr -= 1;
+ yyrestart(NULL);
+ return 0;
+ }
+ else
+ {
+ paren_depth -= 1;
+ return ')';
+ }
+ }
+
+"."{WHITE}*all { return DOT_ALL; }
+
+"."{WHITE}*{ID} {
+ processId (yytext+1, yyleng-1);
+ return DOT_ID;
+ }
+
+{ID}({WHITE}*"."{WHITE}*({ID}|\"{OPER}\"))*(" "*"'")? {
+ int all_posn = find_dot_all (yytext);
+ int token_type, segments, k;
+ int quote_follows;
+
+ if (all_posn == -1 && yytext[yyleng-1] == '\'')
+ {
+ quote_follows = 1;
+ do {
+ yyless (yyleng-1);
+ } while (yytext[yyleng-1] == ' ');
+ }
+ else
+ quote_follows = 0;
+
+ if (all_posn >= 0)
+ yyless (all_posn);
+ processId(yytext, yyleng);
+ segments = name_lookup (ada_mangle (yylval.ssym.stoken.ptr),
+ yylval.ssym.stoken.ptr, &token_type);
+ left_block_context = NULL;
+ for (k = yyleng; segments > 0 && k > 0; k -= 1)
+ {
+ if (yytext[k-1] == '.')
+ segments -= 1;
+ quote_follows = 0;
+ }
+ if (k <= 0)
+ error ("confused by name %s", yytext);
+ yyless (k);
+ if (quote_follows)
+ BEGIN BEFORE_QUAL_QUOTE;
+ return token_type;
+ }
+
+ /* GDB EXPRESSION CONSTRUCTS */
+
+
+"'"[^']+"'"{WHITE}*:: {
+ processId(yytext, yyleng-2);
+ block_lookup (yylval.ssym.stoken.ptr, yylval.ssym.stoken.ptr);
+ return BLOCKNAME;
+ }
+
+{ID}({WHITE}*"."{WHITE}*({ID}|\"{OPER}\"))*{WHITE}*:: {
+ processId(yytext, yyleng-2);
+ block_lookup (ada_mangle (yylval.ssym.stoken.ptr),
+ yylval.ssym.stoken.ptr);
+ return BLOCKNAME;
+ }
+
+[{}@] { return yytext[0]; }
+
+"$$" { yylval.lval = -1; return LAST; }
+"$$"{DIG}+ { yylval.lval = -atoi(yytext+2); return LAST; }
+"$" { yylval.lval = 0; return LAST; }
+"$"{DIG}+ { yylval.lval = atoi(yytext+1); return LAST; }
+
+
+ /* REGISTERS AND GDB CONVENIENCE VARIABLES */
+
+"$"({LETTER}|{DIG}|"$")+ {
+ int c;
+ for (c = 0; c < NUM_REGS; c++)
+ if (REGISTER_NAME (c) &&
+ strcmp (yytext + 1, REGISTER_NAME (c)) == 0)
+ {
+ yylval.lval = c;
+ return REGNAME;
+ }
+ yylval.sval.ptr = yytext;
+ yylval.sval.length = yyleng;
+ yylval.ivar =
+ lookup_internalvar (copy_name (yylval.sval) + 1);
+ return INTERNAL_VARIABLE;
+ }
+
+ /* CATCH-ALL ERROR CASE */
+
+. { error ("Invalid character '%s' in expression.", yytext); }
+%%
+
+#include <ctype.h>
+#include <string.h>
+
+/* Initialize the lexer for processing new expression */
+void
+lexer_init (FILE* inp)
+{
+ BEGIN INITIAL;
+ yyrestart (inp);
+}
+
+
+/* Make sure that tempbuf points at an array at least N characters long. */
+
+static void
+resize_tempbuf (n)
+ unsigned int n;
+{
+ if (tempbufsize < n)
+ {
+ tempbufsize = (n+63) & ~63;
+ tempbuf = (char*) xrealloc (tempbuf, tempbufsize);
+ }
+}
+
+/* Copy S2 to S1, removing all underscores, and downcasing all letters. */
+
+static void
+canonicalizeNumeral (s1,s2)
+ char* s1;
+ const char* s2;
+{
+ for (; *s2 != '\000'; s2 += 1)
+ {
+ if (*s2 != '_')
+ {
+ *s1 = tolower(*s2);
+ s1 += 1;
+ }
+ }
+ s1[0] = '\000';
+}
+
+#define HIGH_BYTE_POSN ((sizeof (ULONGEST) - 1) * HOST_CHAR_BIT)
+
+/* True (non-zero) iff DIGIT is a valid digit in radix BASE,
+ where 2 <= BASE <= 16. */
+
+static int
+is_digit_in_base (digit, base)
+ unsigned char digit;
+ int base;
+{
+ if (!isxdigit (digit))
+ return 0;
+ if (base <= 10)
+ return (isdigit (digit) && digit < base + '0');
+ else
+ return (isdigit (digit) || tolower (digit) < base - 10 + 'a');
+}
+
+static int
+digit_to_int (c)
+ unsigned char c;
+{
+ if (isdigit (c))
+ return c - '0';
+ else
+ return tolower (c) - 'a' + 10;
+}
+
+/* As for strtoul, but for ULONGEST results. */
+ULONGEST
+strtoulst (num, trailer, base)
+ const char *num;
+ const char **trailer;
+ int base;
+{
+ unsigned int high_part;
+ ULONGEST result;
+ int i;
+ unsigned char lim;
+
+ if (base < 2 || base > 16)
+ {
+ errno = EINVAL;
+ return 0;
+ }
+ lim = base - 1 + '0';
+
+ result = high_part = 0;
+ for (i = 0; is_digit_in_base (num[i], base); i += 1)
+ {
+ result = result*base + digit_to_int (num[i]);
+ high_part = high_part*base + (unsigned int) (result >> HIGH_BYTE_POSN);
+ result &= ((ULONGEST) 1 << HIGH_BYTE_POSN) - 1;
+ if (high_part > 0xff)
+ {
+ errno = ERANGE;
+ result = high_part = 0;
+ break;
+ }
+ }
+
+ if (trailer != NULL)
+ *trailer = &num[i];
+
+ return result + ((ULONGEST) high_part << HIGH_BYTE_POSN);
+}
+
+
+
+/* Interprets the prefix of NUM that consists of digits of the given BASE
+ as an integer of that BASE, with the string EXP as an exponent.
+ Puts value in yylval, and returns INT, if the string is valid. Causes
+ an error if the number is improperly formated. BASE, if NULL, defaults
+ to "10", and EXP to "1". The EXP does not contain a leading 'e' or 'E'. */
+
+static int
+processInt (base0, num0, exp0)
+ const char* num0;
+ const char* base0;
+ const char* exp0;
+{
+ ULONGEST result;
+ long exp;
+ int base;
+
+ char* trailer;
+
+ if (base0 == NULL)
+ base = 10;
+ else
+ {
+ base = strtol (base0, (char**) NULL, 10);
+ if (base < 2 || base > 16)
+ error ("Invalid base: %d.", base);
+ }
+
+ if (exp0 == NULL)
+ exp = 0;
+ else
+ exp = strtol(exp0, (char**) NULL, 10);
+
+ errno = 0;
+ result = strtoulst (num0, &trailer, base);
+ if (errno == ERANGE)
+ error ("Integer literal out of range");
+ if (isxdigit(*trailer))
+ error ("Invalid digit `%c' in based literal", *trailer);
+
+ while (exp > 0)
+ {
+ if (result > (ULONG_MAX / base))
+ error ("Integer literal out of range");
+ result *= base;
+ exp -= 1;
+ }
+
+ if ((result >> (TARGET_INT_BIT-1)) == 0)
+ yylval.typed_val.type = builtin_type_ada_int;
+ else if ((result >> (TARGET_LONG_BIT-1)) == 0)
+ yylval.typed_val.type = builtin_type_ada_long;
+ else if (((result >> (TARGET_LONG_BIT-1)) >> 1) == 0)
+ {
+ /* We have a number representable as an unsigned integer quantity.
+ For consistency with the C treatment, we will treat it as an
+ anonymous modular (unsigned) quantity. Alas, the types are such
+ that we need to store .val as a signed quantity. Sorry
+ for the mess, but C doesn't officially guarantee that a simple
+ assignment does the trick (no, it doesn't; read the reference manual).
+ */
+ yylval.typed_val.type = builtin_type_unsigned_long;
+ if (result & LONGEST_SIGN)
+ yylval.typed_val.val =
+ (LONGEST) (result & ~LONGEST_SIGN)
+ - (LONGEST_SIGN>>1) - (LONGEST_SIGN>>1);
+ else
+ yylval.typed_val.val = (LONGEST) result;
+ return INT;
+ }
+ else
+ yylval.typed_val.type = builtin_type_ada_long_long;
+
+ yylval.typed_val.val = (LONGEST) result;
+ return INT;
+}
+
+static int
+processReal (num0)
+ const char* num0;
+{
+ if (sizeof (DOUBLEST) <= sizeof (float))
+ sscanf (num0, "%g", &yylval.typed_val_float.dval);
+ else if (sizeof (DOUBLEST) <= sizeof (double))
+ sscanf (num0, "%lg", &yylval.typed_val_float.dval);
+ else
+ {
+#ifdef PRINTF_HAS_LONG_DOUBLE
+ sscanf (num0, "%Lg", &yylval.typed_val_float.dval);
+#else
+ /* Scan it into a double, then convert and assign it to the
+ long double. This at least wins with values representable
+ in the range of doubles. */
+ double temp;
+ sscanf (num0, "%lg", &temp);
+ yylval.typed_val_float.dval = temp;
+#endif
+ }
+
+ yylval.typed_val_float.type = builtin_type_ada_float;
+ if (sizeof(DOUBLEST) >= TARGET_DOUBLE_BIT / TARGET_CHAR_BIT)
+ yylval.typed_val_float.type = builtin_type_ada_double;
+ if (sizeof(DOUBLEST) >= TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT)
+ yylval.typed_val_float.type = builtin_type_ada_long_double;
+
+ return FLOAT;
+}
+
+static int
+processId (name0, len)
+ const char *name0;
+ int len;
+{
+ char* name = xmalloc (len + 11);
+ int i0, i;
+
+/* add_name_string_cleanup (name); */
+/* FIXME: add_name_string_cleanup should be defined in parse.c */
+ while (len > 0 && isspace (name0[len-1]))
+ len -= 1;
+ i = i0 = 0;
+ while (i0 < len)
+ {
+ if (isalnum (name0[i0]))
+ {
+ name[i] = tolower (name0[i0]);
+ i += 1; i0 += 1;
+ }
+ else switch (name0[i0])
+ {
+ default:
+ name[i] = name0[i0];
+ i += 1; i0 += 1;
+ break;
+ case ' ': case '\t':
+ i0 += 1;
+ break;
+ case '\'':
+ i0 += 1;
+ while (i0 < len && name0[i0] != '\'')
+ {
+ name[i] = name0[i0];
+ i += 1; i0 += 1;
+ }
+ i0 += 1;
+ break;
+ case '<':
+ i0 += 1;
+ while (i0 < len && name0[i0] != '>')
+ {
+ name[i] = name0[i0];
+ i += 1; i0 += 1;
+ }
+ i0 += 1;
+ break;
+ }
+ }
+ name[i] = '\000';
+
+ yylval.ssym.sym = NULL;
+ yylval.ssym.stoken.ptr = name;
+ yylval.ssym.stoken.length = i;
+ return NAME;
+}
+
+static void
+block_lookup (name, err_name)
+ char* name;
+ char* err_name;
+{
+ struct symbol** syms;
+ struct block** blocks;
+ int nsyms;
+ struct symtab *symtab;
+ nsyms = ada_lookup_symbol_list (name, left_block_context,
+ VAR_NAMESPACE, &syms, &blocks);
+ if (left_block_context == NULL &&
+ (nsyms == 0 || SYMBOL_CLASS (syms[0]) != LOC_BLOCK))
+ symtab = lookup_symtab (name);
+ else
+ symtab = NULL;
+
+ if (symtab != NULL)
+ left_block_context = yylval.bval =
+ BLOCKVECTOR_BLOCK (BLOCKVECTOR (symtab), STATIC_BLOCK);
+ else if (nsyms == 0 || SYMBOL_CLASS (syms[0]) != LOC_BLOCK)
+ {
+ if (left_block_context == NULL)
+ error ("No file or function \"%s\".", err_name);
+ else
+ error ("No function \"%s\" in specified context.", err_name);
+ }
+ else
+ {
+ left_block_context = yylval.bval = SYMBOL_BLOCK_VALUE (syms[0]);
+ if (nsyms > 1)
+ warning ("Function name \"%s\" ambiguous here", err_name);
+ }
+}
+
+/* Look up NAME0 (assumed to be mangled) as a name in VAR_NAMESPACE,
+ setting *TOKEN_TYPE to NAME or TYPENAME, depending on what is
+ found. Try first the entire name, then the name without the last
+ segment (i.e., after the last .id), etc., and return the number of
+ segments that had to be removed to get a match. Calls error if no
+ matches are found, using ERR_NAME in any error message. When
+ exactly one symbol match is found, it is placed in yylval. */
+
+static int
+name_lookup (name0, err_name, token_type)
+ char* name0;
+ char* err_name;
+ int* token_type;
+{
+ struct symbol** syms;
+ struct block** blocks;
+ struct type* type;
+ int len0 = strlen (name0);
+ char* name = savestring (name0, len0);
+ int nsyms;
+ int segments;
+
+/* add_name_string_cleanup (name);*/
+/* FIXME: add_name_string_cleanup should be defined in parse.c */
+ yylval.ssym.stoken.ptr = name;
+ yylval.ssym.stoken.length = strlen (name);
+ for (segments = 0; ; segments += 1)
+ {
+ struct type* preferred_type;
+ int i, preferred_index;
+
+ if (left_block_context == NULL)
+ nsyms = ada_lookup_symbol_list (name, expression_context_block,
+ VAR_NAMESPACE, &syms, &blocks);
+ else
+ nsyms = ada_lookup_symbol_list (name, left_block_context,
+ VAR_NAMESPACE, &syms, &blocks);
+
+ /* Check for a type definition. */
+
+ /* Look for a symbol that doesn't denote void. This is (I think) a */
+ /* temporary kludge to get around problems in GNAT output. */
+ preferred_index = -1; preferred_type = NULL;
+ for (i = 0; i < nsyms; i += 1)
+ switch (SYMBOL_CLASS (syms[i]))
+ {
+ case LOC_TYPEDEF:
+ if (ada_prefer_type (SYMBOL_TYPE (syms[i]), preferred_type))
+ {
+ preferred_index = i;
+ preferred_type = SYMBOL_TYPE (syms[i]);
+ }
+ break;
+ case LOC_REGISTER:
+ case LOC_ARG:
+ case LOC_REF_ARG:
+ case LOC_REGPARM:
+ case LOC_REGPARM_ADDR:
+ case LOC_LOCAL:
+ case LOC_LOCAL_ARG:
+ case LOC_BASEREG:
+ case LOC_BASEREG_ARG:
+ goto NotType;
+ default:
+ break;
+ }
+ if (preferred_type != NULL)
+ {
+/* if (TYPE_CODE (preferred_type) == TYPE_CODE_VOID)
+ error ("`%s' matches only void type name(s)",
+ ada_demangle (name));
+*/
+/* FIXME: ada_demangle should be defined in defs.h, and is located in ada-lang.c */
+/* else*/ if (ada_is_object_renaming (syms[preferred_index]))
+ {
+ yylval.ssym.sym = syms[preferred_index];
+ *token_type = OBJECT_RENAMING;
+ return segments;
+ }
+ else if (ada_renaming_type (SYMBOL_TYPE (syms[preferred_index]))
+ != NULL)
+ {
+ int result;
+ const char* renaming =
+ ada_simple_renamed_entity (syms[preferred_index]);
+ char* new_name = xmalloc (strlen (renaming) + len0
+ - yylval.ssym.stoken.length + 1);
+/* add_name_string_cleanup (new_name);*/
+/* FIXME: add_name_string_cleanup should be defined in parse.c */
+ strcpy (new_name, renaming);
+ strcat (new_name, name0 + yylval.ssym.stoken.length);
+ result = name_lookup (new_name, err_name, token_type);
+ if (result > segments)
+ error ("Confused by renamed symbol.");
+ return result;
+ }
+ else if (segments == 0)
+ {
+ yylval.tval = preferred_type;
+ *token_type = TYPENAME;
+ return 0;
+ }
+ }
+
+ if (segments == 0)
+ {
+ type = lookup_primitive_typename (name);
+ if (type == NULL && STREQ ("system__address", name))
+ type = builtin_type_ada_system_address;
+ if (type != NULL)
+ {
+ yylval.tval = type;
+ *token_type = TYPENAME;
+ return 0;
+ }
+ }
+
+ NotType:
+ if (nsyms == 1)
+ {
+ *token_type = NAME;
+ yylval.ssym.sym = syms[0];
+ yylval.ssym.msym = NULL;
+ yylval.ssym.block = blocks[0];
+ return segments;
+ }
+ else if (nsyms == 0) {
+ int i;
+ yylval.ssym.msym = ada_lookup_minimal_symbol (name);
+ if (yylval.ssym.msym != NULL)
+ {
+ yylval.ssym.sym = NULL;
+ yylval.ssym.block = NULL;
+ *token_type = NAME;
+ return segments;
+ }
+
+ for (i = yylval.ssym.stoken.length - 1; i > 0; i -= 1)
+ {
+ if (name[i] == '.')
+ {
+ name[i] = '\0';
+ yylval.ssym.stoken.length = i;
+ break;
+ }
+ else if (name[i] == '_' && name[i-1] == '_')
+ {
+ i -= 1;
+ name[i] = '\0';
+ yylval.ssym.stoken.length = i;
+ break;
+ }
+ }
+ if (i <= 0)
+ {
+ if (!have_full_symbols () && !have_partial_symbols ()
+ && left_block_context == NULL)
+ error ("No symbol table is loaded. Use the \"file\" command.");
+ if (left_block_context == NULL)
+ error ("No definition of \"%s\" in current context.",
+ err_name);
+ else
+ error ("No definition of \"%s\" in specified context.",
+ err_name);
+ }
+ }
+ else
+ {
+ *token_type = NAME;
+ yylval.ssym.sym = NULL;
+ yylval.ssym.msym = NULL;
+ if (left_block_context == NULL)
+ yylval.ssym.block = expression_context_block;
+ else
+ yylval.ssym.block = left_block_context;
+ return segments;
+ }
+ }
+}
+
+/* Returns the position within STR of the '.' in a
+ '.{WHITE}*all' component of a dotted name, or -1 if there is none. */
+static int
+find_dot_all (str)
+ const char* str;
+{
+ int i;
+ for (i = 0; str[i] != '\000'; i += 1)
+ {
+ if (str[i] == '.')
+ {
+ int i0 = i;
+ do
+ i += 1;
+ while (isspace (str[i]));
+ if (strcmp (str+i, "all") == 0
+ && ! isalnum (str[i+3]) && str[i+3] != '_')
+ return i0;
+ }
+ }
+ return -1;
+}
+
+/* Returns non-zero iff string SUBSEQ matches a subsequence of STR, ignoring
+ case. */
+
+static int
+subseqMatch (subseq, str)
+ const char* subseq;
+ const char* str;
+{
+ if (subseq[0] == '\0')
+ return 1;
+ else if (str[0] == '\0')
+ return 0;
+ else if (tolower (subseq[0]) == tolower (str[0]))
+ return subseqMatch (subseq+1, str+1) || subseqMatch (subseq, str+1);
+ else
+ return subseqMatch (subseq, str+1);
+}
+
+
+static struct { const char* name; int code; }
+attributes[] = {
+ { "address", TICK_ADDRESS },
+ { "unchecked_access", TICK_ACCESS },
+ { "unrestricted_access", TICK_ACCESS },
+ { "access", TICK_ACCESS },
+ { "first", TICK_FIRST },
+ { "last", TICK_LAST },
+ { "length", TICK_LENGTH },
+ { "max", TICK_MAX },
+ { "min", TICK_MIN },
+ { "modulus", TICK_MODULUS },
+ { "pos", TICK_POS },
+ { "range", TICK_RANGE },
+ { "size", TICK_SIZE },
+ { "tag", TICK_TAG },
+ { "val", TICK_VAL },
+ { NULL, -1 }
+};
+
+/* Return the syntactic code corresponding to the attribute name or
+ abbreviation STR. */
+
+static int
+processAttribute (str)
+ const char* str;
+{
+ int i, k;
+
+ for (i = 0; attributes[i].code != -1; i += 1)
+ if (strcasecmp (str, attributes[i].name) == 0)
+ return attributes[i].code;
+
+ for (i = 0, k = -1; attributes[i].code != -1; i += 1)
+ if (subseqMatch (str, attributes[i].name))
+ {
+ if (k == -1)
+ k = i;
+ else
+ error ("ambiguous attribute name: `%s'", str);
+ }
+ if (k == -1)
+ error ("unrecognized attribute: `%s'", str);
+
+ return attributes[k].code;
+}
+
+int
+yywrap()
+{
+ return 1;
+}
diff --git a/gdb/ada-tasks.c b/gdb/ada-tasks.c
new file mode 100644
index 00000000000..2ed36b79df8
--- /dev/null
+++ b/gdb/ada-tasks.c
@@ -0,0 +1,806 @@
+/* file ada-tasks.c: Ada tasking control for GDB
+ Copyright 1997 Free Software Foundation, Inc.
+ Contributed by Ada Core Technologies, Inc
+.
+ This file is part of GDB.
+
+ [$Id: ada-tasks.c,v 1.1 2002/06/04 15:28:48 aidan Exp $]
+ Authors: Roch-Alexandre Nomine Beguin, Arnaud Charlet <charlet@gnat.com>
+
+ 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.
+
+*/
+
+#include <ctype.h>
+#include "defs.h"
+#include "command.h"
+#include "value.h"
+#include "language.h"
+#include "inferior.h"
+#include "symtab.h"
+#include "target.h"
+#include "gdbcore.h"
+
+#if (defined(__alpha__) && defined(__osf__) && !defined(__alpha_vxworks))
+#include <sys/procfs.h>
+#endif
+
+#if (defined(__alpha__) && defined(__osf__) && !defined(VXWORKS_TARGET))
+#include "gregset.h"
+#endif
+
+#include "ada-lang.h"
+
+/* FIXME: move all this conditional compilation in description
+ files or in configure.in */
+
+#if defined (VXWORKS_TARGET)
+#define THREAD_TO_PID(tid,lwpid) (tid)
+
+#elif defined (linux)
+#define THREAD_TO_PID(tid,lwpid) (0)
+
+#elif (defined (sun) && defined (__SVR4))
+#define THREAD_TO_PID thread_to_pid
+
+#elif defined (sgi) || defined (__WIN32__) || defined (hpux)
+#define THREAD_TO_PID(tid,lwpid) ((int)lwpid)
+
+#else
+#define THREAD_TO_PID(tid,lwpid) (0)
+#endif
+
+#if defined(__alpha__) && defined(__osf__) && !defined(VXWORKS_TARGET)
+#define THREAD_FETCH_REGISTERS dec_thread_fetch_registers
+#define GET_CURRENT_THREAD dec_thread_get_current_thread
+extern int dec_thread_get_registers (gdb_gregset_t *, gdb_fpregset_t *);
+#endif
+
+#if defined (_AIX)
+#define THREAD_FETCH_REGISTERS aix_thread_fetch_registers
+#define GET_CURRENT_THREAD aix_thread_get_current_thread
+#endif
+
+#if defined(VXWORKS_TARGET)
+#define GET_CURRENT_THREAD() ((void*)inferior_pid)
+#define THREAD_FETCH_REGISTERS() (-1)
+
+#elif defined (sun) && defined (__SVR4)
+#define GET_CURRENT_THREAD solaris_thread_get_current_thread
+#define THREAD_FETCH_REGISTERS() (-1)
+extern void *GET_CURRENT_THREAD();
+
+#elif defined (_AIX) || (defined(__alpha__) && defined(__osf__))
+extern void *GET_CURRENT_THREAD();
+
+#elif defined (__WIN32__) || defined (hpux)
+#define GET_CURRENT_THREAD() (inferior_pid)
+#define THREAD_FETCH_REGISTERS() (-1)
+
+#else
+#define GET_CURRENT_THREAD() (NULL)
+#define THREAD_FETCH_REGISTERS() (-1)
+#endif
+
+#define KNOWN_TASKS_NAME "system__tasking__debug__known_tasks"
+
+#define READ_MEMORY(addr, var) read_memory (addr, (char*) &var, sizeof (var))
+/* external declarations */
+
+extern struct value* find_function_in_inferior (char *);
+
+/* Global visible variables */
+
+struct task_entry *task_list = NULL;
+int ada__tasks_check_symbol_table = 1;
+void *pthread_kern_addr = NULL;
+
+#if (defined(__alpha__) && defined(__osf__) && !defined(VXWORKS_TARGET))
+gdb_gregset_t gregset_saved;
+gdb_fpregset_t fpregset_saved;
+#endif
+
+/* The maximum number of tasks known to the Ada runtime */
+const int MAX_NUMBER_OF_KNOWN_TASKS = 1000;
+
+/* the current task */
+int current_task = -1, current_task_id = -1, current_task_index;
+void *current_thread, *current_lwp;
+
+char *ada_task_states[] =
+{
+ "Unactivated",
+ "Runnable",
+ "Terminated",
+ "Child Activation Wait",
+ "Accept Statement",
+ "Waiting on entry call",
+ "Async Select Wait",
+ "Delay Sleep",
+ "Child Termination Wait",
+ "Wait Child in Term Alt",
+ "",
+ "",
+ "",
+ "",
+ "Asynchronous Hold"
+};
+
+/* Global internal types */
+
+static char *ada_long_task_states[] =
+{
+ "Unactivated",
+ "Runnable",
+ "Terminated",
+ "Waiting for child activation",
+ "Blocked in accept statement",
+ "Waiting on entry call",
+ "Asynchronous Selective Wait",
+ "Delay Sleep",
+ "Waiting for children termination",
+ "Waiting for children in terminate alternative",
+ "",
+ "",
+ "",
+ "",
+ "Asynchronous Hold"
+};
+
+/* Global internal variables */
+
+static int highest_task_num = 0;
+int thread_support = 0; /* 1 if the thread library in use is supported */
+static int gdbtk_task_initialization = 0;
+
+static int add_task_entry (p_task_id, index)
+ void *p_task_id;
+ int index;
+{
+ struct task_entry *new_task_entry = NULL;
+ struct task_entry *pt;
+
+ highest_task_num++;
+ new_task_entry = malloc (sizeof (struct task_entry));
+ new_task_entry->task_num = highest_task_num;
+ new_task_entry->task_id = p_task_id;
+ new_task_entry->known_tasks_index = index;
+ new_task_entry->next_task = NULL;
+ pt = task_list;
+ if (pt)
+ {
+ while (pt->next_task)
+ pt = pt->next_task;
+ pt->next_task = new_task_entry;
+ pt->stack_per = 0;
+ }
+ else task_list = new_task_entry;
+ return new_task_entry->task_num;
+}
+
+int
+get_entry_number (p_task_id)
+ void *p_task_id;
+{
+ struct task_entry *pt;
+
+ pt = task_list;
+ while (pt != NULL)
+ {
+ if (pt->task_id == p_task_id)
+ return pt->task_num;
+ pt = pt->next_task;
+ }
+ return 0;
+}
+
+static struct task_entry *get_thread_entry_vptr (thread)
+ void *thread;
+{
+ struct task_entry *pt;
+
+ pt = task_list;
+ while (pt != NULL)
+ {
+ if (pt->thread == thread)
+ return pt;
+ pt = pt->next_task;
+ }
+ return 0;
+}
+
+static struct task_entry *get_entry_vptr (p_task_num)
+ int p_task_num;
+{
+ struct task_entry *pt;
+
+ pt = task_list;
+ while (pt)
+ {
+ if (pt->task_num == p_task_num)
+ return pt;
+ pt = pt->next_task;
+ }
+ return NULL;
+}
+
+void init_task_list ()
+{
+ struct task_entry *pt, *old_pt;
+
+ pt = task_list;
+ while (pt)
+ {
+ old_pt = pt;
+ pt = pt->next_task;
+ free (old_pt);
+ };
+ task_list = NULL;
+ highest_task_num = 0;
+}
+
+int valid_task_id (task)
+ int task;
+{
+ return get_entry_vptr (task) != NULL;
+}
+
+void *get_self_id ()
+{
+ struct value* val;
+ void *self_id;
+ int result;
+ struct task_entry *ent;
+ extern int do_not_insert_breakpoints;
+
+#if !((defined(sun) && defined(__SVR4)) || defined(VXWORKS_TARGET) || defined(__WIN32__))
+ if (thread_support)
+#endif
+ {
+ ent = get_thread_entry_vptr (GET_CURRENT_THREAD ());
+ return ent ? ent->task_id : 0;
+ }
+
+ /* FIXME: calling a function in the inferior with a multithreaded application
+ is not reliable, so return NULL if there is no safe way to get the current
+ task */
+ return NULL;
+}
+
+int get_current_task ()
+{
+ int result;
+
+ /* FIXME: language_ada should be defined in defs.h */
+ /* if (current_language->la_language != language_ada) return -1; */
+
+ result = get_entry_number (get_self_id ());
+
+ /* return -1 if not found */
+ return result == 0 ? -1 : result;
+}
+
+/* Print detailed information about specified task */
+
+static void
+info_task (arg, from_tty)
+ char *arg;
+ int from_tty;
+{
+ void *temp_task;
+ struct task_entry *pt, *pt2;
+ void *self_id, *caller;
+ struct task_fields atcb, atcb2;
+ struct entry_call call;
+ int bounds [2];
+ char image [256];
+ int num;
+
+ /* FIXME: language_ada should be defined in defs.h */
+ /* if (current_language->la_language != language_ada)
+ {
+ printf_filtered ("The current language does not support tasks.\n");
+ return;
+ }
+ */
+ pt = get_entry_vptr (atoi (arg));
+ if (pt == NULL)
+ {
+ printf_filtered ("Task %s not found.\n", arg);
+ return;
+ }
+
+ temp_task = pt->task_id;
+
+ /* read the atcb in the inferior */
+ READ_MEMORY ((CORE_ADDR) temp_task, atcb);
+
+ /* print the Ada task id */
+ printf_filtered ("Ada Task: %p\n", temp_task);
+
+ /* print the name of the task */
+ if (atcb.image.P_ARRAY != NULL) {
+ READ_MEMORY ((CORE_ADDR) EXTRACT_ADDRESS (atcb.image.P_BOUNDS), bounds);
+ bounds [1] = EXTRACT_INT (bounds [1]);
+ read_memory ((CORE_ADDR) EXTRACT_ADDRESS (atcb.image.P_ARRAY),
+ (char*) &image, bounds [1]);
+ printf_filtered ("Name: %.*s\n", bounds [1], image);
+ }
+ else printf_filtered ("<no name>\n");
+
+ /* print the thread id */
+
+ if ((long) pt->thread < 65536)
+ printf_filtered ("Thread: %ld\n", (long int) pt->thread);
+ else
+ printf_filtered ("Thread: %p\n", pt->thread);
+
+ if ((long) pt->lwp != 0)
+ {
+ if ((long) pt->lwp < 65536)
+ printf_filtered ("LWP: %ld\n", (long int) pt->lwp);
+ else
+ printf_filtered ("LWP: %p\n", pt->lwp);
+ }
+
+ /* print the parent gdb task id */
+ num = get_entry_number (EXTRACT_ADDRESS (atcb.parent));
+ if (num != 0)
+ {
+ printf_filtered ("Parent: %d", num);
+ pt2 = get_entry_vptr (num);
+ READ_MEMORY ((CORE_ADDR) pt2->task_id, atcb2);
+
+ /* print the name of the task */
+ if (atcb2.image.P_ARRAY != NULL) {
+ READ_MEMORY ((CORE_ADDR) EXTRACT_ADDRESS (atcb2.image.P_BOUNDS),
+ bounds);
+ bounds [1] = EXTRACT_INT (bounds [1]);
+ read_memory ((CORE_ADDR) EXTRACT_ADDRESS (atcb2.image.P_ARRAY),
+ (char*) &image, bounds [1]);
+ printf_filtered (" (%.*s)\n", bounds [1], image);
+ }
+ else
+ printf_filtered ("\n");
+ }
+ else
+ printf_filtered ("No parent\n");
+
+ /* print the base priority of the task */
+ printf_filtered ("Base Priority: %d\n", EXTRACT_INT (atcb.priority));
+
+ /* print the current state of the task */
+
+ /* check if this task is accepting a rendezvous */
+ if (atcb.call == NULL)
+ caller = NULL;
+ else {
+ READ_MEMORY ((CORE_ADDR) EXTRACT_ADDRESS (atcb.call), call);
+ caller = EXTRACT_ADDRESS (call.self);
+ }
+
+ if (caller != NULL)
+ {
+ num = get_entry_number (caller);
+ printf_filtered ("Accepting rendezvous with %d", num);
+
+ if (num != 0)
+ {
+ pt2 = get_entry_vptr (num);
+ READ_MEMORY ((CORE_ADDR) pt2->task_id, atcb2);
+
+ /* print the name of the task */
+ if (atcb2.image.P_ARRAY != NULL) {
+ READ_MEMORY ((CORE_ADDR) EXTRACT_ADDRESS (atcb2.image.P_BOUNDS),
+ bounds);
+ bounds [1] = EXTRACT_INT (bounds [1]);
+ read_memory ((CORE_ADDR) EXTRACT_ADDRESS (atcb2.image.P_ARRAY),
+ (char*) &image, bounds [1]);
+ printf_filtered (" (%.*s)\n", bounds [1], image);
+ }
+ else
+ printf_filtered ("\n");
+ }
+ else
+ printf_filtered ("\n");
+ }
+ else
+ printf_filtered ("State: %s\n", ada_long_task_states [atcb.state]);
+}
+
+#if 0
+
+/* A useful function that shows the alignment of all the fields in the
+ tasks_fields structure
+ */
+
+print_align ()
+{
+ struct task_fields tf;
+ void *tf_base = &(tf);
+ void *tf_state = &(tf.state);
+ void *tf_entry_num = &(tf.entry_num);
+ void *tf_parent = &(tf.parent);
+ void *tf_priority = &(tf.priority);
+ void *tf_current_priority = &(tf.current_priority);
+ void *tf_image = &(tf.image);
+ void *tf_call = &(tf.call);
+ void *tf_thread = &(tf.thread);
+ void *tf_lwp = &(tf.lwp);
+ printf_filtered ("\n");
+ printf_filtered ("(tf_base = 0x%x)\n", tf_base);
+ printf_filtered ("task_fields.entry_num at %3d (0x%x)\n", tf_entry_num - tf_base, tf_entry_num);
+ printf_filtered ("task_fields.state at %3d (0x%x)\n", tf_state - tf_base, tf_state);
+ printf_filtered ("task_fields.parent at %3d (0x%x)\n", tf_parent - tf_base, tf_parent);
+ printf_filtered ("task_fields.priority at %3d (0x%x)\n", tf_priority - tf_base, tf_priority);
+ printf_filtered ("task_fields.current_priority at %3d (0x%x)\n", tf_current_priority - tf_base, tf_current_priority);
+ printf_filtered ("task_fields.image at %3d (0x%x)\n", tf_image - tf_base, tf_image);
+ printf_filtered ("task_fields.call at %3d (0x%x)\n", tf_call - tf_base, tf_call);
+ printf_filtered ("task_fields.thread at %3d (0x%x)\n", tf_thread - tf_base, tf_thread);
+ printf_filtered ("task_fields.lwp at %3d (0x%x)\n", tf_lwp - tf_base, tf_lwp);
+ printf_filtered ("\n");
+}
+#endif
+
+/* Print information about currently known tasks */
+
+static void
+info_tasks (arg, from_tty)
+ char *arg;
+ int from_tty;
+{
+ struct value* val;
+ int i, task_number, state;
+ void *temp_task, *temp_tasks [MAX_NUMBER_OF_KNOWN_TASKS];
+ struct task_entry *pt;
+ void *self_id, *caller, *thread_id=NULL;
+ struct task_fields atcb;
+ struct entry_call call;
+ int bounds [2];
+ char image [256];
+ int size;
+ char car;
+
+#if defined(__alpha__) && defined(__osf__) && !defined(VXWORKS_TARGET)
+ pthreadTeb_t thr;
+ gdb_gregset_t regs;
+#endif
+
+ static struct symbol *sym;
+ static struct minimal_symbol *msym;
+ static void *known_tasks_addr = NULL;
+
+ int init_only = gdbtk_task_initialization;
+ gdbtk_task_initialization = 0;
+
+ task_number = 0;
+
+ if (PIDGET(inferior_ptid) == 0)
+ {
+ printf_filtered ("The program is not being run under gdb. ");
+ printf_filtered ("Use 'run' or 'attach' first.\n");
+ return;
+ }
+
+ if (ada__tasks_check_symbol_table)
+ {
+ thread_support = 0;
+#if (defined(__alpha__) && defined(__osf__) & !defined(VXWORKS_TARGET)) || \
+ defined (_AIX)
+ thread_support = 1;
+#endif
+
+ msym = lookup_minimal_symbol (KNOWN_TASKS_NAME, NULL, NULL);
+ if (msym != NULL)
+ known_tasks_addr = (void *) SYMBOL_VALUE_ADDRESS (msym);
+ else
+#ifndef VXWORKS_TARGET
+ return;
+#else
+ {
+ if (target_lookup_symbol (KNOWN_TASKS_NAME, &known_tasks_addr) != 0)
+ return;
+ }
+#endif
+
+ ada__tasks_check_symbol_table = 0;
+ }
+
+ if (known_tasks_addr == NULL)
+ return;
+
+#if !((defined(sun) && defined(__SVR4)) || defined(VXWORKS_TARGET) || defined(__WIN32__) || defined (hpux))
+ if (thread_support)
+#endif
+ thread_id = GET_CURRENT_THREAD ();
+
+ /* then we get a list of tasks created */
+
+ init_task_list ();
+
+ READ_MEMORY ((CORE_ADDR) known_tasks_addr, temp_tasks);
+
+ for (i=0; i<MAX_NUMBER_OF_KNOWN_TASKS; i++)
+ {
+ temp_task = EXTRACT_ADDRESS (temp_tasks[i]);
+
+ if (temp_task != NULL)
+ {
+ task_number = get_entry_number (temp_task);
+ if (task_number == 0)
+ task_number = add_task_entry (temp_task, i);
+ }
+ }
+
+ /* Return without printing anything if this function was called in
+ order to init GDBTK tasking. */
+
+ if (init_only) return;
+
+ /* print the header */
+
+#if defined(__alpha__) && defined(__osf__) && !defined(VXWORKS_TARGET)
+ printf_filtered
+ (" ID TID P-ID Pri Stack %% State Name\n");
+#else
+ printf_filtered (" ID TID P-ID Pri State Name\n");
+#endif
+
+ /* Now that we have a list of task id's, we can print them */
+ pt = task_list;
+ while (pt)
+ {
+ temp_task = pt->task_id;
+
+ /* read the atcb in the inferior */
+ READ_MEMORY ((CORE_ADDR) temp_task, atcb);
+
+ /* store the thread id for future use */
+ pt->thread = EXTRACT_ADDRESS (atcb.thread);
+
+#if defined (linux)
+ pt->lwp = (void *) THREAD_TO_PID (atcb.thread, 0);
+#else
+ pt->lwp = EXTRACT_ADDRESS (atcb.lwp);
+#endif
+
+ /* print a star if this task is the current one */
+ if (thread_id)
+#if defined (__WIN32__) || defined (SGI) || defined (hpux)
+ printf_filtered (pt->lwp == thread_id ? "*" : " ");
+#else
+ printf_filtered (pt->thread == thread_id ? "*" : " ");
+#endif
+
+ /* print the gdb task id */
+ printf_filtered ("%3d", pt->task_num);
+
+ /* print the Ada task id */
+#ifndef VXWORKS_TARGET
+ printf_filtered (" %9lx", (long) temp_task);
+#else
+#ifdef TARGET_64
+ printf_filtered (" %#9lx", (unsigned long)pt->thread & 0x3ffffffffff);
+#else
+ printf_filtered (" %#9lx", (long)pt->thread);
+#endif
+#endif
+
+ /* print the parent gdb task id */
+ printf_filtered
+ (" %4d", get_entry_number (EXTRACT_ADDRESS (atcb.parent)));
+
+ /* print the base priority of the task */
+ printf_filtered (" %3d", EXTRACT_INT (atcb.priority));
+
+#if defined(__alpha__) && defined(__osf__) && !defined(VXWORKS_TARGET)
+ if (pt->task_num == 1 || atcb.state == Terminated)
+ {
+ printf_filtered (" Unknown");
+ goto next;
+ }
+
+ read_memory ((CORE_ADDR)atcb.thread, &thr, sizeof (thr));
+ current_thread = atcb.thread;
+ regs.regs [SP_REGNUM] = 0;
+ if (dec_thread_get_registers (&regs, NULL) == 0) {
+ pt->stack_per = (100 * ((long)thr.__stack_base -
+ regs.regs [SP_REGNUM])) / thr.__stack_size;
+ /* if the thread is terminated but still there, the
+ stack_base/size values are erroneous. Try to patch it */
+ if (pt->stack_per < 0 || pt->stack_per > 100) pt->stack_per = 0;
+ }
+
+ /* print information about stack space used in the thread */
+ if (thr.__stack_size < 1024*1024)
+ {
+ size = thr.__stack_size / 1024;
+ car = 'K';
+ }
+ else if (thr.__stack_size < 1024*1024*1024)
+ {
+ size = thr.__stack_size / 1024 / 1024;
+ car = 'M';
+ }
+ else /* Who knows... */
+ {
+ size = thr.__stack_size / 1024 / 1024 / 1024;
+ car = 'G';
+ }
+ printf_filtered (" %4d%c %2d", size, car, pt->stack_per);
+next:
+#endif
+
+ /* print the current state of the task */
+
+ /* check if this task is accepting a rendezvous */
+ if (atcb.call == NULL)
+ caller = NULL;
+ else {
+ READ_MEMORY ((CORE_ADDR) EXTRACT_ADDRESS (atcb.call), call);
+ caller = EXTRACT_ADDRESS (call.self);
+ }
+
+ if (caller != NULL)
+ printf_filtered (" Accepting RV with %-4d", get_entry_number (caller));
+ else
+ {
+ state = atcb.state;
+#if defined (__WIN32__) || defined (SGI) || defined (hpux)
+ if (state == Runnable && (thread_id && pt->lwp == thread_id))
+#else
+ if (state == Runnable && (thread_id && pt->thread == thread_id))
+#endif
+ /* Replace "Runnable" by "Running" if this is the current task */
+ printf_filtered (" %-22s", "Running");
+ else
+ printf_filtered (" %-22s", ada_task_states [state]);
+ }
+
+ /* finally, print the name of the task */
+ if (atcb.image.P_ARRAY != NULL) {
+ READ_MEMORY ((CORE_ADDR) EXTRACT_ADDRESS (atcb.image.P_BOUNDS), bounds);
+ bounds [1] = EXTRACT_INT (bounds [1]);
+ read_memory ((CORE_ADDR) EXTRACT_ADDRESS (atcb.image.P_ARRAY),
+ (char*)&image, bounds [1]);
+ printf_filtered (" %.*s\n", bounds [1], image);
+ }
+ else printf_filtered (" <no name>\n");
+
+ pt = pt->next_task;
+ }
+}
+
+/* Task list initialization for GDB-Tk. We basically use info_tasks()
+ to initialize our variables, but abort that function before we
+ actually print anything. */
+
+int
+gdbtk_tcl_tasks_initialize ()
+{
+ gdbtk_task_initialization = 1;
+ info_tasks ("", gdb_stdout);
+
+ return (task_list != NULL);
+}
+
+static void
+info_tasks_command (arg, from_tty)
+ char *arg;
+ int from_tty;
+{
+ if (arg == NULL || *arg == '\000')
+ info_tasks (arg, from_tty);
+ else
+ info_task (arg, from_tty);
+}
+
+/* Switch from one thread to another. */
+
+static void
+switch_to_thread (ptid_t ptid)
+
+{
+ if (ptid_equal (ptid, inferior_ptid))
+ return;
+
+ inferior_ptid = ptid;
+ flush_cached_frames ();
+ registers_changed ();
+ stop_pc = read_pc ();
+ select_frame (get_current_frame ());
+}
+
+/* Switch to a specified task. */
+
+static int task_switch (tid, lwpid)
+ void *tid, *lwpid;
+{
+ int res = 0, pid;
+
+ if (thread_support)
+ {
+ flush_cached_frames ();
+
+ if (current_task != current_task_id)
+ {
+ res = THREAD_FETCH_REGISTERS ();
+ }
+ else
+ {
+#if (defined(__alpha__) && defined(__osf__) && !defined(VXWORKS_TARGET))
+ supply_gregset (&gregset_saved);
+ supply_fpregset (&fpregset_saved);
+#endif
+ }
+
+ if (res == 0) stop_pc = read_pc();
+ select_frame (get_current_frame ());
+ return res;
+ }
+
+ return -1;
+}
+
+static void task_command (tidstr, from_tty)
+ char *tidstr;
+ int from_tty;
+{
+ int num;
+ struct task_entry *e;
+
+ if (!tidstr)
+ error ("Please specify a task ID. Use the \"info tasks\" command to\n"
+ "see the IDs of currently known tasks.");
+
+ num = atoi (tidstr);
+ e = get_entry_vptr (num);
+
+ if (e == NULL)
+ error ("Task ID %d not known. Use the \"info tasks\" command to\n"
+ "see the IDs of currently known tasks.", num);
+
+ if (current_task_id == -1)
+ {
+#if (defined(__alpha__) && defined(__osf__) && !defined(VXWORKS_TARGET))
+ fill_gregset (&gregset_saved, -1);
+ fill_fpregset (&fpregset_saved, -1);
+#endif
+ current_task_id = get_current_task ();
+ }
+
+ current_task = num;
+ current_task_index = e->known_tasks_index;
+ current_thread = e->thread;
+ current_lwp = e->lwp;
+ if (task_switch (e->thread, e->lwp) == 0)
+ {
+ /* FIXME: find_printable_frame should be defined in frame.h, and
+ implemented in ada-lang.c */
+ /* find_printable_frame (selected_frame, frame_relative_level (selected_frame));*/
+ printf_filtered ("[Switching to task %d]\n", num);
+ print_stack_frame (selected_frame, frame_relative_level (selected_frame), 1);
+ }
+ else
+ printf_filtered ("Unable to switch to task %d\n", num);
+}
+
+void
+_initialize_tasks ()
+{
+ static struct cmd_list_element *task_cmd_list = NULL;
+ extern struct cmd_list_element *cmdlist;
+
+ add_info (
+ "tasks", info_tasks_command,
+ "Without argument: list all known Ada tasks, with status information.\n"
+ "info tasks n: print detailed information of task n.\n");
+
+ add_prefix_cmd ("task", class_run, task_command,
+ "Use this command to switch between tasks.\n\
+ The new task ID must be currently known.", &task_cmd_list, "task ", 1,
+ &cmdlist);
+}
diff --git a/gdb/ada-typeprint.c b/gdb/ada-typeprint.c
new file mode 100644
index 00000000000..677356186b2
--- /dev/null
+++ b/gdb/ada-typeprint.c
@@ -0,0 +1,896 @@
+/* Support for printing Ada types for GDB, the GNU debugger.
+ Copyright 1986, 1988, 1989, 1991, 1997 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., 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+#include "defs.h"
+#include "obstack.h"
+#include "bfd.h" /* Binary File Description */
+#include "symtab.h"
+#include "gdbtypes.h"
+#include "expression.h"
+#include "value.h"
+#include "gdbcore.h"
+#include "target.h"
+#include "command.h"
+#include "gdbcmd.h"
+#include "language.h"
+#include "demangle.h"
+#include "c-lang.h"
+#include "typeprint.h"
+#include "ada-lang.h"
+
+#include <ctype.h>
+#include <string.h>
+#include <errno.h>
+
+static int print_record_field_types (struct type *, struct type *,
+ struct ui_file *, int, int);
+
+static void print_array_type (struct type*, struct ui_file*, int, int);
+
+static void print_choices (struct type*, int, struct ui_file*, struct type*);
+
+static void print_range (struct type*, struct ui_file*);
+
+static void print_range_bound (struct type*, char*, int*, struct ui_file*);
+
+static void
+print_dynamic_range_bound (struct type*, const char*, int,
+ const char*, struct ui_file*);
+
+static void print_range_type_named (char*, struct ui_file*);
+
+
+
+static char* name_buffer;
+static int name_buffer_len;
+
+/* The (demangled) Ada name of TYPE. This value persists until the
+ next call. */
+
+static char*
+demangled_type_name (type)
+ struct type *type;
+{
+ if (ada_type_name (type) == NULL)
+ return NULL;
+ else
+ {
+ char* raw_name = ada_type_name (type);
+ char *s, *q;
+
+ if (name_buffer == NULL || name_buffer_len <= strlen (raw_name))
+ {
+ name_buffer_len = 16 + 2 * strlen (raw_name);
+ name_buffer = xrealloc (name_buffer, name_buffer_len);
+ }
+ strcpy (name_buffer, raw_name);
+
+ s = (char*) strstr (name_buffer, "___");
+ if (s != NULL)
+ *s = '\0';
+
+ s = name_buffer + strlen (name_buffer) - 1;
+ while (s > name_buffer && (s[0] != '_' || s[-1] != '_'))
+ s -= 1;
+
+ if (s == name_buffer)
+ return name_buffer;
+
+ if (! islower (s[1]))
+ return NULL;
+
+ for (s = q = name_buffer; *s != '\0'; q += 1)
+ {
+ if (s[0] == '_' && s[1] == '_')
+ {
+ *q = '.'; s += 2;
+ }
+ else
+ {
+ *q = *s; s += 1;
+ }
+ }
+ *q = '\0';
+ return name_buffer;
+ }
+}
+
+
+/* Print a description of a type in the format of a
+ typedef for the current language.
+ NEW is the new name for a type TYPE. */
+
+void
+ada_typedef_print (type, new, stream)
+ struct type *type;
+ struct symbol *new;
+ struct ui_file *stream;
+{
+ fprintf_filtered (stream, "type %.*s is ",
+ ada_name_prefix_len (SYMBOL_SOURCE_NAME(new)),
+ SYMBOL_SOURCE_NAME(new));
+ type_print (type, "", stream, 1);
+}
+
+/* Print range type TYPE on STREAM. */
+
+static void
+print_range (type, stream)
+ struct type* type;
+ struct ui_file* stream;
+{
+ struct type* target_type;
+ target_type = TYPE_TARGET_TYPE (type);
+ if (target_type == NULL)
+ target_type = type;
+
+ switch (TYPE_CODE (target_type))
+ {
+ case TYPE_CODE_RANGE:
+ case TYPE_CODE_INT:
+ case TYPE_CODE_BOOL:
+ case TYPE_CODE_CHAR:
+ case TYPE_CODE_ENUM:
+ break;
+ default:
+ target_type = builtin_type_ada_int;
+ break;
+ }
+
+ if (TYPE_NFIELDS (type) < 2)
+ {
+ /* A range needs at least 2 bounds to be printed. If there are less
+ than 2, just print the type name instead of the range itself.
+ This check handles cases such as characters, for example.
+
+ Note that if the name is not defined, then we don't print anything.
+ */
+ fprintf_filtered (stream, "%.*s",
+ ada_name_prefix_len (TYPE_NAME (type)),
+ TYPE_NAME (type));
+ }
+ else
+ {
+ /* We extract the range type bounds respectively from the first element
+ and the last element of the type->fields array */
+ const LONGEST lower_bound = (LONGEST) TYPE_LOW_BOUND (type);
+ const LONGEST upper_bound =
+ (LONGEST) TYPE_FIELD_BITPOS (type, TYPE_NFIELDS (type) -1);
+
+ ada_print_scalar (target_type, lower_bound, stream);
+ fprintf_filtered (stream, " .. ");
+ ada_print_scalar (target_type, upper_bound, stream);
+ }
+}
+
+/* Print the number or discriminant bound at BOUNDS+*N on STREAM, and
+ set *N past the bound and its delimiter, if any. */
+
+static void
+print_range_bound (type, bounds, n, stream)
+ struct type* type;
+ char* bounds;
+ int* n;
+ struct ui_file* stream;
+{
+ LONGEST B;
+ if (ada_scan_number (bounds, *n, &B, n))
+ {
+ ada_print_scalar (type, B, stream);
+ if (bounds[*n] == '_')
+ *n += 2;
+ }
+ else
+ {
+ int bound_len;
+ char* bound = bounds + *n;
+ char* pend;
+
+ pend = strstr (bound, "__");
+ if (pend == NULL)
+ *n += bound_len = strlen (bound);
+ else
+ {
+ bound_len = pend - bound;
+ *n += bound_len + 2;
+ }
+ fprintf_filtered (stream, "%.*s", bound_len, bound);
+ }
+}
+
+/* Assuming NAME[0 .. NAME_LEN-1] is the name of a range type, print
+ the value (if found) of the bound indicated by SUFFIX ("___L" or
+ "___U") according to the ___XD conventions. */
+
+static void
+print_dynamic_range_bound (type, name, name_len, suffix, stream)
+ struct type* type;
+ const char* name;
+ int name_len;
+ const char* suffix;
+ struct ui_file* stream;
+{
+ static char *name_buf = NULL;
+ static size_t name_buf_len = 0;
+ LONGEST B;
+ int OK;
+
+ GROW_VECT (name_buf, name_buf_len, name_len + strlen (suffix) + 1);
+ strncpy (name_buf, name, name_len);
+ strcpy (name_buf + name_len, suffix);
+
+ B = get_int_var_value (name_buf, 0, &OK);
+ if (OK)
+ ada_print_scalar (type, B, stream);
+ else
+ fprintf_filtered (stream, "?");
+}
+
+/* Print the range type named NAME. */
+
+static void
+print_range_type_named (name, stream)
+ char* name;
+ struct ui_file* stream;
+{
+ struct type *raw_type = ada_find_any_type (name);
+ struct type *base_type;
+ LONGEST low, high;
+ char* subtype_info;
+
+ if (raw_type == NULL)
+ base_type = builtin_type_int;
+ else if (TYPE_CODE (raw_type) == TYPE_CODE_RANGE)
+ base_type = TYPE_TARGET_TYPE (raw_type);
+ else
+ base_type = raw_type;
+
+ subtype_info = strstr (name, "___XD");
+ if (subtype_info == NULL && raw_type == NULL)
+ fprintf_filtered (stream, "? .. ?");
+ else if (subtype_info == NULL)
+ print_range (raw_type, stream);
+ else
+ {
+ int prefix_len = subtype_info - name;
+ char *bounds_str;
+ int n;
+
+ subtype_info += 5;
+ bounds_str = strchr (subtype_info, '_');
+ n = 1;
+
+ if (*subtype_info == 'L')
+ {
+ print_range_bound (raw_type, bounds_str, &n, stream);
+ subtype_info += 1;
+ }
+ else
+ print_dynamic_range_bound (raw_type, name, prefix_len, "___L", stream);
+
+ fprintf_filtered (stream, " .. ");
+
+ if (*subtype_info == 'U')
+ print_range_bound (raw_type, bounds_str, &n, stream);
+ else
+ print_dynamic_range_bound (raw_type, name, prefix_len, "___U", stream);
+ }
+}
+
+/* Print enumerated type TYPE on STREAM. */
+
+static void
+print_enum_type (type, stream)
+ struct type *type;
+ struct ui_file *stream;
+{
+ int len = TYPE_NFIELDS (type);
+ int i, lastval;
+
+ fprintf_filtered (stream, "(");
+ wrap_here (" ");
+
+ lastval = 0;
+ for (i = 0; i < len; i++)
+ {
+ QUIT;
+ if (i) fprintf_filtered (stream, ", ");
+ wrap_here (" ");
+ fputs_filtered (ada_enum_name (TYPE_FIELD_NAME (type, i)), stream);
+ if (lastval != TYPE_FIELD_BITPOS (type, i))
+ {
+ fprintf_filtered (stream, " => %d", TYPE_FIELD_BITPOS (type, i));
+ lastval = TYPE_FIELD_BITPOS (type, i);
+ }
+ lastval += 1;
+ }
+ fprintf_filtered (stream, ")");
+}
+
+/* Print representation of Ada fixed-point type TYPE on STREAM. */
+
+static void
+print_fixed_point_type (type, stream)
+ struct type *type;
+ struct ui_file *stream;
+{
+ DOUBLEST delta = ada_delta (type);
+ DOUBLEST small = ada_fixed_to_float (type, 1.0);
+
+ if (delta < 0.0)
+ fprintf_filtered (stream, "delta ??");
+ else
+ {
+ fprintf_filtered (stream, "delta %g", (double) delta);
+ if (delta != small)
+ fprintf_filtered (stream, " <'small = %g>", (double) small);
+ }
+}
+
+/* Print representation of special VAX floating-point type TYPE on STREAM. */
+
+static void
+print_vax_floating_point_type (type, stream)
+ struct type *type;
+ struct ui_file *stream;
+{
+ fprintf_filtered (stream, "<float format %c>",
+ ada_vax_float_type_suffix (type));
+}
+
+/* Print simple (constrained) array type TYPE on STREAM. LEVEL is the
+ recursion (indentation) level, in case the element type itself has
+ nested structure, and SHOW is the number of levels of internal
+ structure to show (see ada_print_type). */
+
+static void
+print_array_type (type, stream, show, level)
+ struct type *type;
+ struct ui_file *stream;
+ int show;
+ int level;
+{
+ int bitsize;
+ int n_indices;
+
+ bitsize = 0;
+ fprintf_filtered (stream, "array (");
+
+ n_indices = -1;
+ if (show < 0)
+ fprintf_filtered (stream, "...");
+ else
+ {
+ if (ada_is_packed_array_type (type))
+ type = ada_coerce_to_simple_array_type (type);
+ if (ada_is_simple_array (type))
+ {
+ struct type* range_desc_type =
+ ada_find_parallel_type (type, "___XA");
+ struct type* arr_type;
+
+ bitsize = 0;
+ if (range_desc_type == NULL)
+ {
+ for (arr_type = type; TYPE_CODE (arr_type) == TYPE_CODE_ARRAY;
+ arr_type = TYPE_TARGET_TYPE (arr_type))
+ {
+ if (arr_type != type)
+ fprintf_filtered (stream, ", ");
+ print_range (TYPE_INDEX_TYPE (arr_type), stream);
+ if (TYPE_FIELD_BITSIZE (arr_type, 0) > 0)
+ bitsize = TYPE_FIELD_BITSIZE (arr_type, 0);
+ }
+ }
+ else
+ {
+ int k;
+ n_indices = TYPE_NFIELDS (range_desc_type);
+ for (k = 0, arr_type = type;
+ k < n_indices;
+ k += 1, arr_type = TYPE_TARGET_TYPE (arr_type))
+ {
+ if (k > 0)
+ fprintf_filtered (stream, ", ");
+ print_range_type_named (TYPE_FIELD_NAME (range_desc_type, k),
+ stream);
+ if (TYPE_FIELD_BITSIZE (arr_type, 0) > 0)
+ bitsize = TYPE_FIELD_BITSIZE (arr_type, 0);
+ }
+ }
+ }
+ else
+ {
+ int i, i0;
+ for (i = i0 = ada_array_arity (type); i > 0; i -= 1)
+ fprintf_filtered (stream, "%s<>", i == i0 ? "" : ", ");
+ }
+ }
+
+ fprintf_filtered (stream, ") of ");
+ wrap_here ("");
+ ada_print_type (ada_array_element_type (type, n_indices), "", stream,
+ show == 0 ? 0 : show-1, level+1);
+ if (bitsize > 0)
+ fprintf_filtered (stream, " <packed: %d-bit elements>", bitsize);
+}
+
+/* Print the choices encoded by field FIELD_NUM of variant-part TYPE on
+ STREAM, assuming the VAL_TYPE is the type of the values. */
+
+static void
+print_choices (type, field_num, stream, val_type)
+ struct type *type;
+ int field_num;
+ struct ui_file *stream;
+ struct type *val_type;
+{
+ int have_output;
+ int p;
+ const char* name = TYPE_FIELD_NAME (type, field_num);
+
+ have_output = 0;
+
+ /* Skip over leading 'V': NOTE soon to be obsolete. */
+ if (name[0] == 'V')
+ {
+ if (! ada_scan_number (name, 1, NULL, &p))
+ goto Huh;
+ }
+ else
+ p = 0;
+
+ while (1)
+ {
+ switch (name[p])
+ {
+ default:
+ return;
+ case 'S':
+ case 'R':
+ case 'O':
+ if (have_output)
+ fprintf_filtered (stream, " | ");
+ have_output = 1;
+ break;
+ }
+
+ switch (name[p])
+ {
+ case 'S':
+ {
+ LONGEST W;
+ if (! ada_scan_number (name, p + 1, &W, &p))
+ goto Huh;
+ ada_print_scalar (val_type, W, stream);
+ break;
+ }
+ case 'R':
+ {
+ LONGEST L, U;
+ if (! ada_scan_number (name, p + 1, &L, &p)
+ || name[p] != 'T'
+ || ! ada_scan_number (name, p + 1, &U, &p))
+ goto Huh;
+ ada_print_scalar (val_type, L, stream);
+ fprintf_filtered (stream, " .. ");
+ ada_print_scalar (val_type, U, stream);
+ break;
+ }
+ case 'O':
+ fprintf_filtered (stream, "others");
+ p += 1;
+ break;
+ }
+ }
+
+Huh:
+ fprintf_filtered (stream, "??");
+
+}
+
+/* Assuming that field FIELD_NUM of TYPE is a VARIANTS field whose
+ discriminant is contained in OUTER_TYPE, print its variants on STREAM.
+ LEVEL is the recursion
+ (indentation) level, in case any of the fields themselves have
+ nested structure, and SHOW is the number of levels of internal structure
+ to show (see ada_print_type). For this purpose, fields nested in a
+ variant part are taken to be at the same level as the fields
+ immediately outside the variant part. */
+
+static void
+print_variant_clauses (type, field_num, outer_type, stream, show, level)
+ struct type *type;
+ int field_num;
+ struct type *outer_type;
+ struct ui_file *stream;
+ int show;
+ int level;
+{
+ int i;
+ struct type *var_type;
+ struct type *discr_type;
+
+ var_type = TYPE_FIELD_TYPE (type, field_num);
+ discr_type = ada_variant_discrim_type (var_type, outer_type);
+
+ if (TYPE_CODE (var_type) == TYPE_CODE_PTR)
+ {
+ var_type = TYPE_TARGET_TYPE (var_type);
+ if (TYPE_FLAGS (var_type) & TYPE_FLAG_STUB)
+ {
+ var_type = ada_find_parallel_type (var_type, "___XVU");
+ if (var_type == NULL)
+ return;
+ }
+ }
+
+ for (i = 0; i < TYPE_NFIELDS (var_type); i += 1)
+ {
+ fprintf_filtered (stream, "\n%*swhen ", level + 4, "");
+ print_choices (var_type, i, stream, discr_type);
+ fprintf_filtered (stream, " =>");
+ if (print_record_field_types (TYPE_FIELD_TYPE (var_type, i),
+ outer_type, stream, show, level+4) <= 0)
+ fprintf_filtered (stream, " null;");
+ }
+}
+
+/* Assuming that field FIELD_NUM of TYPE is a variant part whose
+ discriminants are contained in OUTER_TYPE, print a description of it
+ on STREAM. LEVEL is the recursion (indentation) level, in case any of
+ the fields themselves have nested structure, and SHOW is the number of
+ levels of internal structure to show (see ada_print_type). For this
+ purpose, fields nested in a variant part are taken to be at the same
+ level as the fields immediately outside the variant part. */
+
+static void
+print_variant_part (type, field_num, outer_type, stream, show, level)
+ struct type *type;
+ int field_num;
+ struct type *outer_type;
+ struct ui_file *stream;
+ int show;
+ int level;
+{
+ fprintf_filtered (stream, "\n%*scase %s is", level + 4, "",
+ ada_variant_discrim_name
+ (TYPE_FIELD_TYPE (type, field_num)));
+ print_variant_clauses (type, field_num, outer_type, stream, show, level + 4);
+ fprintf_filtered (stream, "\n%*send case;", level + 4, "");
+}
+
+/* Print a description on STREAM of the fields in record type TYPE, whose
+ discriminants are in OUTER_TYPE. LEVEL is the recursion (indentation)
+ level, in case any of the fields themselves have nested structure,
+ and SHOW is the number of levels of internal structure to show
+ (see ada_print_type). Does not print parent type information of TYPE.
+ Returns 0 if no fields printed, -1 for an incomplete type, else > 0.
+ Prints each field beginning on a new line, but does not put a new line at
+ end. */
+
+static int
+print_record_field_types (type, outer_type, stream, show, level)
+ struct type *type;
+ struct type *outer_type;
+ struct ui_file *stream;
+ int show;
+ int level;
+{
+ int len, i, flds;
+
+ flds = 0;
+ len = TYPE_NFIELDS (type);
+
+ if (len == 0 && (TYPE_FLAGS (type) & TYPE_FLAG_STUB) != 0)
+ return -1;
+
+ for (i = 0; i < len; i += 1)
+ {
+ QUIT;
+
+ if (ada_is_parent_field (type, i)
+ || ada_is_ignored_field (type, i))
+ ;
+ else if (ada_is_wrapper_field (type, i))
+ flds += print_record_field_types (TYPE_FIELD_TYPE (type, i), type,
+ stream, show, level);
+ else if (ada_is_variant_part (type, i))
+ {
+ print_variant_part (type, i, outer_type, stream, show, level);
+ flds = 1;
+ }
+ else
+ {
+ flds += 1;
+ fprintf_filtered (stream, "\n%*s", level + 4, "");
+ ada_print_type (TYPE_FIELD_TYPE (type, i),
+ TYPE_FIELD_NAME (type, i),
+ stream, show - 1, level + 4);
+ fprintf_filtered (stream, ";");
+ }
+ }
+
+ return flds;
+}
+
+/* Print record type TYPE on STREAM. LEVEL is the recursion (indentation)
+ level, in case the element type itself has nested structure, and SHOW is
+ the number of levels of internal structure to show (see ada_print_type). */
+
+static void
+print_record_type (type0, stream, show, level)
+ struct type* type0;
+ struct ui_file* stream;
+ int show;
+ int level;
+{
+ struct type* parent_type;
+ struct type* type;
+
+ type = type0;
+ if (TYPE_FLAGS (type) & TYPE_FLAG_STUB)
+ {
+ struct type* type1 = ada_find_parallel_type (type, "___XVE");
+ if (type1 != NULL)
+ type = type1;
+ }
+
+ parent_type = ada_parent_type (type);
+ if (ada_type_name (parent_type) != NULL)
+ fprintf_filtered (stream, "new %s with ",
+ demangled_type_name (parent_type));
+ else if (parent_type == NULL && ada_is_tagged_type (type))
+ fprintf_filtered (stream, "tagged ");
+
+ fprintf_filtered (stream, "record");
+
+ if (show < 0)
+ fprintf_filtered (stream, " ... end record");
+ else
+ {
+ int flds;
+
+ flds = 0;
+ if (parent_type != NULL && ada_type_name (parent_type) == NULL)
+ flds += print_record_field_types (parent_type, parent_type,
+ stream, show, level);
+ flds += print_record_field_types (type, type, stream, show, level);
+
+ if (flds > 0)
+ fprintf_filtered (stream, "\n%*send record", level, "");
+ else if (flds < 0)
+ fprintf_filtered (stream, " <incomplete type> end record");
+ else
+ fprintf_filtered (stream, " null; end record");
+ }
+}
+
+/* Print the unchecked union type TYPE in something resembling Ada
+ format on STREAM. LEVEL is the recursion (indentation) level
+ in case the element type itself has nested structure, and SHOW is the
+ number of levels of internal structure to show (see ada_print_type). */
+static void
+print_unchecked_union_type (struct type* type, struct ui_file* stream,
+ int show, int level)
+{
+ fprintf_filtered (stream, "record (?) is");
+
+ if (show < 0)
+ fprintf_filtered (stream, " ... end record");
+ else if (TYPE_NFIELDS (type) == 0)
+ fprintf_filtered (stream, " null; end record");
+ else
+ {
+ int i;
+
+ fprintf_filtered (stream, "\n%*scase ? is",
+ level+4, "");
+
+ for (i = 0; i < TYPE_NFIELDS (type); i += 1)
+ {
+ fprintf_filtered (stream, "\n%*swhen ? =>\n%*s", level+8, "",
+ level+12, "");
+ ada_print_type (TYPE_FIELD_TYPE (type, i),
+ TYPE_FIELD_NAME (type, i),
+ stream, show - 1, level + 12);
+ fprintf_filtered (stream, ";");
+ }
+
+ fprintf_filtered (stream, "\n%*send case;\n%*send record",
+ level+4, "", level, "");
+ }
+}
+
+
+
+/* Print function or procedure type TYPE on STREAM. Make it a header
+ for function or procedure NAME if NAME is not null. */
+
+static void
+print_func_type (type, stream, name)
+ struct type *type;
+ struct ui_file *stream;
+ char* name;
+{
+ int i, len = TYPE_NFIELDS (type);
+
+ if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_VOID)
+ fprintf_filtered (stream, "procedure");
+ else
+ fprintf_filtered (stream, "function");
+
+ if (name != NULL && name[0] != '\0')
+ fprintf_filtered (stream, " %s", name);
+
+ if (len > 0)
+ {
+ fprintf_filtered (stream, " (");
+ for (i = 0; i < len; i += 1)
+ {
+ if (i > 0)
+ {
+ fputs_filtered ("; ", stream);
+ wrap_here (" ");
+ }
+ fprintf_filtered (stream, "a%d: ", i+1);
+ ada_print_type (TYPE_FIELD_TYPE (type, i), "", stream, -1, 0);
+ }
+ fprintf_filtered (stream, ")");
+ }
+
+ if (TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_VOID)
+ {
+ fprintf_filtered (stream, " return ");
+ ada_print_type (TYPE_TARGET_TYPE (type), "", stream, 0, 0);
+ }
+}
+
+
+/* Print a description of a type TYPE0.
+ Output goes to STREAM (via stdio).
+ If VARSTRING is a non-empty string, print as an Ada variable/field
+ declaration.
+ SHOW+1 is the maximum number of levels of internal type structure
+ to show (this applies to record types, enumerated types, and
+ array types).
+ SHOW is the number of levels of internal type structure to show
+ when there is a type name for the SHOWth deepest level (0th is
+ outer level).
+ When SHOW<0, no inner structure is shown.
+ LEVEL indicates level of recursion (for nested definitions). */
+
+void
+ada_print_type (type0, varstring, stream, show, level)
+ struct type* type0;
+ char* varstring;
+ struct ui_file* stream;
+ int show;
+ int level;
+{
+ enum type_code code;
+ int demangled_args;
+ struct type* type = ada_completed_type (ada_get_base_type (type0));
+ char* type_name = demangled_type_name (type);
+ int is_var_decl = (varstring != NULL && varstring[0] != '\0');
+
+ if (type == NULL)
+ {
+ if (is_var_decl)
+ fprintf_filtered (stream, "%.*s: ",
+ ada_name_prefix_len(varstring),
+ varstring);
+ fprintf_filtered (stream, "<null type?>");
+ return;
+ }
+
+ if (show > 0)
+ CHECK_TYPEDEF (type);
+
+ if (is_var_decl && TYPE_CODE (type) != TYPE_CODE_FUNC)
+ fprintf_filtered (stream, "%.*s: ",
+ ada_name_prefix_len (varstring), varstring);
+
+ if (type_name != NULL && show <= 0)
+ {
+ fprintf_filtered (stream, "%.*s",
+ ada_name_prefix_len (type_name), type_name);
+ return;
+ }
+
+ if (ada_is_aligner_type (type))
+ ada_print_type (ada_aligned_type (type), "", stream, show, level);
+ else if (ada_is_packed_array_type (type))
+ print_array_type (type, stream, show, level);
+ else
+ switch (TYPE_CODE (type))
+ {
+ default:
+ fprintf_filtered (stream, "<");
+ c_print_type (type, "", stream, show, level);
+ fprintf_filtered (stream, ">");
+ break;
+ case TYPE_CODE_PTR:
+ fprintf_filtered (stream, "access ");
+ ada_print_type (TYPE_TARGET_TYPE (type), "", stream, show,
+ level);
+ break;
+ case TYPE_CODE_REF:
+ fprintf_filtered (stream, "<ref> ");
+ ada_print_type (TYPE_TARGET_TYPE (type), "", stream, show,
+ level);
+ break;
+ case TYPE_CODE_ARRAY:
+ print_array_type (type, stream, show, level);
+ break;
+ case TYPE_CODE_INT:
+ if (ada_is_fixed_point_type (type))
+ print_fixed_point_type (type, stream);
+ else if (ada_is_vax_floating_type (type))
+ print_vax_floating_point_type (type, stream);
+ else
+ {
+ char* name = ada_type_name (type);
+ if (! ada_is_range_type_name (name))
+ fprintf_filtered (stream, "<%d-byte integer>", TYPE_LENGTH (type));
+ else
+ {
+ fprintf_filtered (stream, "range ");
+ print_range_type_named (name, stream);
+ }
+ }
+ break;
+ case TYPE_CODE_RANGE:
+ if (ada_is_fixed_point_type (type))
+ print_fixed_point_type (type, stream);
+ else if (ada_is_vax_floating_type (type))
+ print_vax_floating_point_type (type, stream);
+ else if (ada_is_modular_type (type))
+ fprintf_filtered (stream, "mod %ld", (long) ada_modulus (type));
+ else
+ {
+ fprintf_filtered (stream, "range ");
+ print_range (type, stream);
+ }
+ break;
+ case TYPE_CODE_FLT:
+ fprintf_filtered (stream, "<%d-byte float>", TYPE_LENGTH (type));
+ break;
+ case TYPE_CODE_ENUM:
+ if (show < 0)
+ fprintf_filtered (stream, "(...)");
+ else
+ print_enum_type (type, stream);
+ break;
+ case TYPE_CODE_STRUCT:
+ if (ada_is_array_descriptor (type))
+ print_array_type (type, stream, show, level);
+ else if (ada_is_bogus_array_descriptor (type))
+ fprintf_filtered (stream, "array (?) of ? (<mal-formed descriptor>)");
+ else
+ print_record_type (type, stream, show, level);
+ break;
+ case TYPE_CODE_UNION:
+ print_unchecked_union_type (type, stream, show, level);
+ break;
+ case TYPE_CODE_FUNC:
+ print_func_type (type, stream, varstring);
+ break;
+ }
+}
diff --git a/gdb/ada-valprint.c b/gdb/ada-valprint.c
new file mode 100644
index 00000000000..6db18ebae1e
--- /dev/null
+++ b/gdb/ada-valprint.c
@@ -0,0 +1,1058 @@
+/* Support for printing Ada values for GDB, the GNU debugger.
+ Copyright 1986, 1988, 1989, 1991, 1992, 1993, 1994, 1997, 2001
+ 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., 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+#include <ctype.h>
+#include "defs.h"
+#include "symtab.h"
+#include "gdbtypes.h"
+#include "expression.h"
+#include "value.h"
+#include "demangle.h"
+#include "valprint.h"
+#include "language.h"
+#include "annotate.h"
+#include "ada-lang.h"
+#include "c-lang.h"
+
+/* Encapsulates arguments to ada_val_print. */
+struct ada_val_print_args {
+ struct type* type;
+ char* valaddr0;
+ int embedded_offset;
+ CORE_ADDR address;
+ struct ui_file *stream;
+ int format;
+ int deref_ref;
+ int recurse;
+ enum val_prettyprint pretty;
+};
+
+extern int inspect_it;
+extern unsigned int repeat_count_threshold;
+
+static void print_record (struct type*, char*, struct ui_file*, int,
+ int, enum val_prettyprint);
+
+static int print_field_values (struct type*, char*, struct ui_file*,
+ int, int, enum val_prettyprint,
+ int, struct type*, char*);
+
+static int print_variant_part (struct type*, int, char*,
+ struct ui_file*, int, int, enum val_prettyprint,
+ int, struct type*, char*);
+
+static void
+val_print_packed_array_elements (struct type*, char *valaddr, int,
+ struct ui_file*, int, int,
+ enum val_prettyprint);
+
+static void adjust_type_signedness (struct type*);
+
+static int ada_val_print_stub (PTR args0);
+
+static int
+ada_val_print_1 (struct type*, char*, int, CORE_ADDR, struct ui_file*,
+ int, int, int, enum val_prettyprint);
+
+
+/* Make TYPE unsigned if its range of values includes no negatives. */
+static void
+adjust_type_signedness (type)
+ struct type* type;
+{
+ if (type != NULL && TYPE_CODE (type) == TYPE_CODE_RANGE
+ && TYPE_LOW_BOUND (type) >= 0)
+ TYPE_FLAGS (type) |= TYPE_FLAG_UNSIGNED;
+}
+
+/* Assuming TYPE is a simple array type, prints its lower bound on STREAM,
+ if non-standard (i.e., other than 1 for numbers, other than lower bound
+ of index type for enumerated type). Returns 1 if something printed,
+ otherwise 0. */
+
+static int
+print_optional_low_bound (stream, type)
+ struct ui_file *stream;
+ struct type *type;
+{
+ struct type *index_type;
+ long low_bound;
+
+ index_type = TYPE_INDEX_TYPE (type);
+ low_bound = 0;
+
+ if (index_type == NULL)
+ return 0;
+ if (TYPE_CODE (index_type) == TYPE_CODE_RANGE)
+ {
+ low_bound = TYPE_LOW_BOUND (index_type);
+ index_type = TYPE_TARGET_TYPE (index_type);
+ }
+ else
+ return 0;
+
+ switch (TYPE_CODE (index_type)) {
+ case TYPE_CODE_ENUM:
+ if (low_bound == TYPE_FIELD_BITPOS (index_type, 0))
+ return 0;
+ break;
+ case TYPE_CODE_UNDEF:
+ index_type = builtin_type_long;
+ /* FALL THROUGH */
+ default:
+ if (low_bound == 1)
+ return 0;
+ break;
+ }
+
+ ada_print_scalar (index_type, (LONGEST) low_bound, stream);
+ fprintf_filtered (stream, " => ");
+ return 1;
+}
+
+/* Version of val_print_array_elements for GNAT-style packed arrays.
+ Prints elements of packed array of type TYPE at bit offset
+ BITOFFSET from VALADDR on STREAM. Formats according to FORMAT and
+ separates with commas. RECURSE is the recursion (nesting) level.
+ If PRETTY, uses "prettier" format. TYPE must have been decoded (as
+ by ada_coerce_to_simple_array). */
+
+static void
+val_print_packed_array_elements (type, valaddr, bitoffset, stream, format,
+ recurse, pretty)
+ struct type *type;
+ char *valaddr;
+ int bitoffset;
+ struct ui_file *stream;
+ int format;
+ int recurse;
+ enum val_prettyprint pretty;
+{
+ unsigned int i;
+ unsigned int things_printed = 0;
+ unsigned len;
+ struct type *elttype;
+ unsigned eltlen;
+ /* Position of the array element we are examining to see
+ whether it is repeated. */
+ unsigned int rep1;
+ /* Number of repetitions we have detected so far. */
+ unsigned int reps;
+ unsigned long bitsize = TYPE_FIELD_BITSIZE (type, 0);
+ struct value* mark = value_mark ();
+
+ elttype = TYPE_TARGET_TYPE (type);
+ eltlen = TYPE_LENGTH (check_typedef (elttype));
+
+ {
+ LONGEST low, high;
+ if (get_discrete_bounds (TYPE_FIELD_TYPE (type, 0), &low, &high) < 0)
+ len = 1;
+ else
+ len = high - low + 1;
+ }
+
+ i = 0;
+ annotate_array_section_begin (i, elttype);
+
+ while (i < len && things_printed < print_max)
+ {
+ struct value *v0, *v1;
+ int i0;
+
+ if (i != 0)
+ {
+ if (prettyprint_arrays)
+ {
+ fprintf_filtered (stream, ",\n");
+ print_spaces_filtered (2 + 2 * recurse, stream);
+ }
+ else
+ {
+ fprintf_filtered (stream, ", ");
+ }
+ }
+ wrap_here (n_spaces (2 + 2 * recurse));
+
+ i0 = i;
+ v0 = ada_value_primitive_packed_val (NULL, valaddr,
+ (i0 * bitsize) / HOST_CHAR_BIT,
+ (i0 * bitsize) % HOST_CHAR_BIT,
+ bitsize, elttype);
+ while (1)
+ {
+ i += 1;
+ if (i >= len)
+ break;
+ v1 = ada_value_primitive_packed_val (NULL, valaddr,
+ (i * bitsize) / HOST_CHAR_BIT,
+ (i * bitsize) % HOST_CHAR_BIT,
+ bitsize, elttype);
+ if (memcmp (VALUE_CONTENTS (v0), VALUE_CONTENTS (v1), eltlen)
+ != 0)
+ break;
+ }
+
+ if (i - i0 > repeat_count_threshold)
+ {
+ val_print (elttype, VALUE_CONTENTS (v0), 0, 0, stream, format,
+ 0, recurse + 1, pretty);
+ annotate_elt_rep (i - i0);
+ fprintf_filtered (stream, " <repeats %u times>", i - i0);
+ annotate_elt_rep_end ();
+
+ }
+ else
+ {
+ int j;
+ for (j = i0; j < i; j += 1)
+ {
+ if (j > i0)
+ {
+ if (prettyprint_arrays)
+ {
+ fprintf_filtered (stream, ",\n");
+ print_spaces_filtered (2 + 2 * recurse, stream);
+ }
+ else
+ {
+ fprintf_filtered (stream, ", ");
+ }
+ wrap_here (n_spaces (2 + 2 * recurse));
+ }
+ val_print (elttype, VALUE_CONTENTS (v0), 0, 0, stream, format,
+ 0, recurse + 1, pretty);
+ annotate_elt ();
+ }
+ }
+ things_printed += i - i0;
+ }
+ annotate_array_section_end ();
+ if (i < len)
+ {
+ fprintf_filtered (stream, "...");
+ }
+
+ value_free_to_mark (mark);
+}
+
+static struct type*
+printable_val_type (type, valaddr)
+ struct type* type;
+ char* valaddr;
+{
+ return ada_to_fixed_type (ada_aligned_type (type), valaddr, 0, NULL);
+}
+
+/* Print the character C on STREAM as part of the contents of a literal
+ string whose delimiter is QUOTER. TYPE_LEN is the length in bytes
+ (1 or 2) of the character. */
+
+void
+ada_emit_char (c, stream, quoter, type_len)
+ int c;
+ struct ui_file *stream;
+ int quoter;
+ int type_len;
+{
+ if (type_len != 2)
+ type_len = 1;
+
+ c &= (1 << (type_len * TARGET_CHAR_BIT)) - 1;
+
+ if (isascii (c) && isprint (c))
+ {
+ if (c == quoter && c == '"')
+ fprintf_filtered (stream, "[\"%c\"]", quoter);
+ else
+ fprintf_filtered (stream, "%c", c);
+ }
+ else
+ fprintf_filtered (stream, "[\"%0*x\"]", type_len*2, c);
+}
+
+/* Character #I of STRING, given that TYPE_LEN is the size in bytes (1
+ or 2) of a character. */
+
+static int
+char_at (string, i, type_len)
+ char* string;
+ int i;
+ int type_len;
+{
+ if (type_len == 1)
+ return string[i];
+ else
+ return (int) extract_unsigned_integer (string + 2*i, 2);
+}
+
+void
+ada_printchar (c, stream)
+ int c;
+ struct ui_file *stream;
+{
+ fputs_filtered ("'", stream);
+ ada_emit_char (c, stream, '\'', 1);
+ fputs_filtered ("'", stream);
+}
+
+/* [From print_type_scalar in typeprint.c]. Print VAL on STREAM in a
+ form appropriate for TYPE. */
+
+void
+ada_print_scalar (type, val, stream)
+ struct type *type;
+ LONGEST val;
+ struct ui_file *stream;
+{
+ unsigned int i;
+ unsigned len;
+
+ CHECK_TYPEDEF (type);
+
+ switch (TYPE_CODE (type))
+ {
+
+ case TYPE_CODE_ENUM:
+ len = TYPE_NFIELDS (type);
+ for (i = 0; i < len; i++)
+ {
+ if (TYPE_FIELD_BITPOS (type, i) == val)
+ {
+ break;
+ }
+ }
+ if (i < len)
+ {
+ fputs_filtered (ada_enum_name (TYPE_FIELD_NAME (type, i)), stream);
+ }
+ else
+ {
+ print_longest (stream, 'd', 0, val);
+ }
+ break;
+
+ case TYPE_CODE_INT:
+ print_longest (stream, TYPE_UNSIGNED (type) ? 'u' : 'd', 0, val);
+ break;
+
+ case TYPE_CODE_CHAR:
+ LA_PRINT_CHAR ((unsigned char) val, stream);
+ break;
+
+ case TYPE_CODE_BOOL:
+ fprintf_filtered (stream, val ? "true" : "false");
+ break;
+
+ case TYPE_CODE_RANGE:
+ ada_print_scalar (TYPE_TARGET_TYPE (type), val, stream);
+ return;
+
+ case TYPE_CODE_UNDEF:
+ case TYPE_CODE_PTR:
+ case TYPE_CODE_ARRAY:
+ case TYPE_CODE_STRUCT:
+ case TYPE_CODE_UNION:
+ case TYPE_CODE_FUNC:
+ case TYPE_CODE_FLT:
+ case TYPE_CODE_VOID:
+ case TYPE_CODE_SET:
+ case TYPE_CODE_STRING:
+ case TYPE_CODE_ERROR:
+ case TYPE_CODE_MEMBER:
+ case TYPE_CODE_METHOD:
+ case TYPE_CODE_REF:
+ warning ("internal error: unhandled type in ada_print_scalar");
+ break;
+
+ default:
+ error ("Invalid type code in symbol table.");
+ }
+ gdb_flush (stream);
+}
+
+/* Print the character string STRING, printing at most LENGTH characters.
+ Printing stops early if the number hits print_max; repeat counts
+ are printed as appropriate. Print ellipses at the end if we
+ had to stop before printing LENGTH characters, or if
+ FORCE_ELLIPSES. TYPE_LEN is the length (1 or 2) of the character type.
+ */
+
+static void
+printstr (stream, string, length, force_ellipses, type_len)
+ struct ui_file *stream;
+ char *string;
+ unsigned int length;
+ int force_ellipses;
+ int type_len;
+{
+ unsigned int i;
+ unsigned int things_printed = 0;
+ int in_quotes = 0;
+ int need_comma = 0;
+
+ if (length == 0)
+ {
+ fputs_filtered ("\"\"", stream);
+ return;
+ }
+
+ for (i = 0; i < length && things_printed < print_max; i += 1)
+ {
+ /* Position of the character we are examining
+ to see whether it is repeated. */
+ unsigned int rep1;
+ /* Number of repetitions we have detected so far. */
+ unsigned int reps;
+
+ QUIT;
+
+ if (need_comma)
+ {
+ fputs_filtered (", ", stream);
+ need_comma = 0;
+ }
+
+ rep1 = i + 1;
+ reps = 1;
+ while (rep1 < length &&
+ char_at(string, rep1, type_len) == char_at (string, i, type_len))
+ {
+ rep1 += 1;
+ reps += 1;
+ }
+
+ if (reps > repeat_count_threshold)
+ {
+ if (in_quotes)
+ {
+ if (inspect_it)
+ fputs_filtered ("\\\", ", stream);
+ else
+ fputs_filtered ("\", ", stream);
+ in_quotes = 0;
+ }
+ fputs_filtered ("'", stream);
+ ada_emit_char (char_at (string, i, type_len), stream, '\'', type_len);
+ fputs_filtered ("'", stream);
+ fprintf_filtered (stream, " <repeats %u times>", reps);
+ i = rep1 - 1;
+ things_printed += repeat_count_threshold;
+ need_comma = 1;
+ }
+ else
+ {
+ if (!in_quotes)
+ {
+ if (inspect_it)
+ fputs_filtered ("\\\"", stream);
+ else
+ fputs_filtered ("\"", stream);
+ in_quotes = 1;
+ }
+ ada_emit_char (char_at (string, i, type_len), stream, '"',
+ type_len);
+ things_printed += 1;
+ }
+ }
+
+ /* Terminate the quotes if necessary. */
+ if (in_quotes)
+ {
+ if (inspect_it)
+ fputs_filtered ("\\\"", stream);
+ else
+ fputs_filtered ("\"", stream);
+ }
+
+ if (force_ellipses || i < length)
+ fputs_filtered ("...", stream);
+}
+
+void
+ada_printstr (stream, string, length, force_ellipses, width)
+ struct ui_file *stream;
+ char *string;
+ unsigned int length;
+ int force_ellipses;
+ int width;
+{
+ printstr (stream, string, length, force_ellipses, width);
+}
+
+
+/* Print data of type TYPE located at VALADDR (within GDB), which came from
+ the inferior at address ADDRESS, onto stdio stream STREAM according to
+ FORMAT (a letter as for the printf % codes or 0 for natural format).
+ The data at VALADDR is in target byte order.
+
+ If the data is printed as a string, returns the number of string characters
+ printed.
+
+ If DEREF_REF is nonzero, then dereference references, otherwise just print
+ them like pointers.
+
+ RECURSE indicates the amount of indentation to supply before
+ continuation lines; this amount is roughly twice the value of RECURSE.
+
+ When PRETTY is non-zero, prints record fields on separate lines.
+ (For some reason, the current version of gdb instead uses a global
+ variable---prettyprint_arrays--- to causes a similar effect on
+ arrays.) */
+
+int
+ada_val_print (type, valaddr0, embedded_offset, address, stream,
+ format, deref_ref, recurse, pretty)
+ struct type* type;
+ char* valaddr0;
+ int embedded_offset;
+ CORE_ADDR address;
+ struct ui_file *stream;
+ int format;
+ int deref_ref;
+ int recurse;
+ enum val_prettyprint pretty;
+{
+ struct ada_val_print_args args;
+ args.type = type; args.valaddr0 = valaddr0;
+ args.embedded_offset = embedded_offset;
+ args.address = address;
+ args.stream = stream;
+ args.format = format;
+ args.deref_ref = deref_ref;
+ args.recurse = recurse;
+ args.pretty = pretty;
+
+ return catch_errors (ada_val_print_stub, &args, NULL, RETURN_MASK_ALL);
+}
+
+/* Helper for ada_val_print; used as argument to catch_errors to
+ unmarshal the arguments to ada_val_print_1, which does the work. */
+static int
+ada_val_print_stub (PTR args0)
+{
+ struct ada_val_print_args* argsp = (struct ada_val_print_args*) args0;
+ return ada_val_print_1 (argsp->type, argsp->valaddr0, argsp->embedded_offset,
+ argsp->address, argsp->stream, argsp->format,
+ argsp->deref_ref, argsp->recurse,
+ argsp->pretty);
+}
+
+/* See the comment on ada_val_print. This function differs in that it
+ * does not catch evaluation errors (leaving that to ada_val_print). */
+
+static int
+ada_val_print_1 (type, valaddr0, embedded_offset, address, stream,
+ format, deref_ref, recurse, pretty)
+ struct type* type;
+ char* valaddr0;
+ int embedded_offset;
+ CORE_ADDR address;
+ struct ui_file *stream;
+ int format;
+ int deref_ref;
+ int recurse;
+ enum val_prettyprint pretty;
+{
+ unsigned int len;
+ int i;
+ struct type *elttype;
+ unsigned int eltlen;
+ LONGEST val;
+ CORE_ADDR addr;
+ char* valaddr = valaddr0 + embedded_offset;
+
+ CHECK_TYPEDEF (type);
+
+ if (ada_is_array_descriptor (type) || ada_is_packed_array_type (type))
+ {
+ int retn;
+ struct value* mark = value_mark ();
+ struct value* val;
+ val = value_from_contents_and_address (type, valaddr, address);
+ val = ada_coerce_to_simple_array_ptr (val);
+ if (val == NULL)
+ {
+ fprintf_filtered (stream, "(null)");
+ retn = 0;
+ }
+ else
+ retn = ada_val_print_1 (VALUE_TYPE (val), VALUE_CONTENTS (val), 0,
+ VALUE_ADDRESS (val), stream, format,
+ deref_ref, recurse, pretty);
+ value_free_to_mark (mark);
+ return retn;
+ }
+
+ valaddr = ada_aligned_value_addr (type, valaddr);
+ embedded_offset -= valaddr - valaddr0 - embedded_offset;
+ type = printable_val_type (type, valaddr);
+
+ switch (TYPE_CODE (type))
+ {
+ default:
+ return c_val_print (type, valaddr0, embedded_offset, address, stream,
+ format, deref_ref, recurse, pretty);
+
+ case TYPE_CODE_INT:
+ case TYPE_CODE_RANGE:
+ if (ada_is_fixed_point_type (type))
+ {
+ LONGEST v = unpack_long (type, valaddr);
+ int len = TYPE_LENGTH (type);
+
+ fprintf_filtered (stream, len < 4 ? "%.11g" : "%.17g",
+ (double) ada_fixed_to_float (type, v));
+ return 0;
+ }
+ else if (ada_is_vax_floating_type (type))
+ {
+ struct value* val =
+ value_from_contents_and_address (type, valaddr, address);
+ struct value* func = ada_vax_float_print_function (type);
+ if (func != 0)
+ {
+ static struct type* parray_of_char = NULL;
+ struct value* printable_val;
+
+ if (parray_of_char == NULL)
+ parray_of_char =
+ make_pointer_type
+ (create_array_type
+ (NULL, builtin_type_char,
+ create_range_type (NULL, builtin_type_int, 0, 32)),
+ NULL);
+
+ printable_val =
+ value_ind (value_cast (parray_of_char,
+ call_function_by_hand (func, 1, &val)));
+
+ fprintf_filtered (stream, "%s", VALUE_CONTENTS (printable_val));
+ return 0;
+ }
+ /* No special printing function. Do as best we can. */
+ }
+ else if (TYPE_CODE (type) == TYPE_CODE_RANGE)
+ {
+ struct type* target_type = TYPE_TARGET_TYPE (type);
+ if (TYPE_LENGTH (type) != TYPE_LENGTH (target_type))
+ {
+ /* Obscure case of range type that has different length from
+ its base type. Perform a conversion, or we will get a
+ nonsense value. Actually, we could use the same
+ code regardless of lengths; I'm just avoiding a cast. */
+ struct value* v =
+ value_cast (target_type,
+ value_from_contents_and_address (type, valaddr, 0));
+ return ada_val_print_1 (target_type, VALUE_CONTENTS (v), 0, 0,
+ stream, format, 0, recurse + 1, pretty);
+ }
+ else
+ return ada_val_print_1 (TYPE_TARGET_TYPE (type),
+ valaddr0, embedded_offset,
+ address, stream, format, deref_ref,
+ recurse, pretty);
+ }
+ else
+ {
+ format = format ? format : output_format;
+ if (format)
+ {
+ print_scalar_formatted (valaddr, type, format, 0, stream);
+ }
+ else
+ {
+ val_print_type_code_int (type, valaddr, stream);
+ if (ada_is_character_type (type))
+ {
+ fputs_filtered (" ", stream);
+ ada_printchar ((unsigned char) unpack_long (type, valaddr),
+ stream);
+ }
+ }
+ return 0;
+ }
+
+ case TYPE_CODE_ENUM:
+ if (format)
+ {
+ print_scalar_formatted (valaddr, type, format, 0, stream);
+ break;
+ }
+ len = TYPE_NFIELDS (type);
+ val = unpack_long (type, valaddr);
+ for (i = 0; i < len; i++)
+ {
+ QUIT;
+ if (val == TYPE_FIELD_BITPOS (type, i))
+ {
+ break;
+ }
+ }
+ if (i < len)
+ {
+ const char* name = ada_enum_name (TYPE_FIELD_NAME (type, i));
+ if (name[0] == '\'')
+ fprintf_filtered (stream, "%ld %s", (long) val, name);
+ else
+ fputs_filtered (name, stream);
+ }
+ else
+ {
+ print_longest (stream, 'd', 0, val);
+ }
+ break;
+
+ case TYPE_CODE_UNION:
+ case TYPE_CODE_STRUCT:
+ if (ada_is_bogus_array_descriptor (type))
+ {
+ fprintf_filtered (stream, "(...?)");
+ return 0;
+ }
+ else
+ {
+ print_record (type, valaddr, stream, format,
+ recurse, pretty);
+ return 0;
+ }
+
+ case TYPE_CODE_ARRAY:
+ if (TYPE_LENGTH (type) > 0 && TYPE_LENGTH (TYPE_TARGET_TYPE (type)) > 0)
+ {
+ elttype = TYPE_TARGET_TYPE (type);
+ eltlen = TYPE_LENGTH (elttype);
+ len = TYPE_LENGTH (type) / eltlen;
+
+ /* For an array of chars, print with string syntax. */
+ if (ada_is_string_type (type)
+ && (format == 0 || format == 's'))
+ {
+ if (prettyprint_arrays)
+ {
+ print_spaces_filtered (2 + 2 * recurse, stream);
+ }
+ /* If requested, look for the first null char and only print
+ elements up to it. */
+ if (stop_print_at_null)
+ {
+ int temp_len;
+
+ /* Look for a NULL char. */
+ for (temp_len = 0;
+ temp_len < len && temp_len < print_max
+ && char_at (valaddr, temp_len, eltlen) != 0;
+ temp_len += 1);
+ len = temp_len;
+ }
+
+ printstr (stream, valaddr, len, 0, eltlen);
+ }
+ else
+ {
+ len = 0;
+ fprintf_filtered (stream, "(");
+ print_optional_low_bound (stream, type);
+ if (TYPE_FIELD_BITSIZE (type, 0) > 0)
+ val_print_packed_array_elements (type, valaddr, 0, stream,
+ format, recurse,
+ pretty);
+ else
+ val_print_array_elements (type, valaddr, address, stream,
+ format, deref_ref, recurse,
+ pretty, 0);
+ fprintf_filtered (stream, ")");
+ }
+ gdb_flush (stream);
+ return len;
+ }
+
+ case TYPE_CODE_REF:
+ elttype = check_typedef (TYPE_TARGET_TYPE (type));
+ if (addressprint)
+ {
+ fprintf_filtered (stream, "@");
+ print_address_numeric
+ (extract_address (valaddr,
+ TARGET_PTR_BIT / HOST_CHAR_BIT), 1, stream);
+ if (deref_ref)
+ fputs_filtered (": ", stream);
+ }
+ /* De-reference the reference */
+ if (deref_ref)
+ {
+ if (TYPE_CODE (elttype) != TYPE_CODE_UNDEF)
+ {
+ LONGEST deref_val_int = (LONGEST)
+ unpack_pointer (lookup_pointer_type (builtin_type_void),
+ valaddr);
+ if (deref_val_int != 0)
+ {
+ struct value* deref_val =
+ ada_value_ind (value_from_longest
+ (lookup_pointer_type (elttype),
+ deref_val_int));
+ val_print (VALUE_TYPE (deref_val),
+ VALUE_CONTENTS (deref_val), 0,
+ VALUE_ADDRESS (deref_val), stream, format,
+ deref_ref, recurse + 1, pretty);
+ }
+ else
+ fputs_filtered ("(null)", stream);
+ }
+ else
+ fputs_filtered ("???", stream);
+ }
+ break;
+ }
+ return 0;
+}
+
+static int
+print_variant_part (type, field_num, valaddr,
+ stream, format, recurse, pretty, comma_needed,
+ outer_type, outer_valaddr)
+ struct type *type;
+ int field_num;
+ char *valaddr;
+ struct ui_file *stream;
+ int format;
+ int recurse;
+ enum val_prettyprint pretty;
+ int comma_needed;
+ struct type *outer_type;
+ char *outer_valaddr;
+{
+ struct type *var_type = TYPE_FIELD_TYPE (type, field_num);
+ int which =
+ ada_which_variant_applies (var_type, outer_type, outer_valaddr);
+
+ if (which < 0)
+ return 0;
+ else
+ return print_field_values
+ (TYPE_FIELD_TYPE (var_type, which),
+ valaddr + TYPE_FIELD_BITPOS (type, field_num) / HOST_CHAR_BIT
+ + TYPE_FIELD_BITPOS (var_type, which) / HOST_CHAR_BIT,
+ stream, format, recurse, pretty,
+ comma_needed, outer_type, outer_valaddr);
+}
+
+int
+ada_value_print (val0, stream, format, pretty)
+ struct value* val0;
+ struct ui_file *stream;
+ int format;
+ enum val_prettyprint pretty;
+{
+ char* valaddr = VALUE_CONTENTS (val0);
+ CORE_ADDR address = VALUE_ADDRESS (val0) + VALUE_OFFSET (val0);
+ struct type* type =
+ ada_to_fixed_type (VALUE_TYPE (val0), valaddr, address, NULL);
+ struct value* val = value_from_contents_and_address (type, valaddr, address);
+
+ /* If it is a pointer, indicate what it points to. */
+ if (TYPE_CODE (type) == TYPE_CODE_PTR ||
+ TYPE_CODE (type) == TYPE_CODE_REF)
+ {
+ /* Hack: remove (char *) for char strings. Their
+ type is indicated by the quoted string anyway. */
+ if (TYPE_CODE (type) == TYPE_CODE_PTR &&
+ TYPE_LENGTH (TYPE_TARGET_TYPE (type)) == sizeof(char) &&
+ TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_INT &&
+ !TYPE_UNSIGNED (TYPE_TARGET_TYPE (type)))
+ {
+ /* Print nothing */
+ }
+ else
+ {
+ fprintf_filtered (stream, "(");
+ type_print (type, "", stream, -1);
+ fprintf_filtered (stream, ") ");
+ }
+ }
+ else if (ada_is_array_descriptor (type))
+ {
+ fprintf_filtered (stream, "(");
+ type_print (type, "", stream, -1);
+ fprintf_filtered (stream, ") ");
+ }
+ else if (ada_is_bogus_array_descriptor (type))
+ {
+ fprintf_filtered (stream, "(");
+ type_print (type, "", stream, -1);
+ fprintf_filtered (stream, ") (...?)");
+ return 0;
+ }
+ return (val_print (type, VALUE_CONTENTS (val), 0, address,
+ stream, format, 1, 0, pretty));
+}
+
+static void
+print_record (type, valaddr, stream, format, recurse, pretty)
+ struct type *type;
+ char *valaddr;
+ struct ui_file *stream;
+ int format;
+ int recurse;
+ enum val_prettyprint pretty;
+{
+ CHECK_TYPEDEF (type);
+
+ fprintf_filtered (stream, "(");
+
+ if (print_field_values (type, valaddr, stream, format, recurse, pretty,
+ 0, type, valaddr) != 0
+ && pretty)
+ {
+ fprintf_filtered (stream, "\n");
+ print_spaces_filtered (2 * recurse, stream);
+ }
+
+ fprintf_filtered (stream, ")");
+}
+
+/* Print out fields of value at VALADDR having structure type TYPE.
+
+ TYPE, VALADDR, STREAM, FORMAT, RECURSE, and PRETTY have the
+ same meanings as in ada_print_value and ada_val_print.
+
+ OUTER_TYPE and OUTER_VALADDR give type and address of enclosing record
+ (used to get discriminant values when printing variant parts).
+
+ COMMA_NEEDED is 1 if fields have been printed at the current recursion
+ level, so that a comma is needed before any field printed by this
+ call.
+
+ Returns 1 if COMMA_NEEDED or any fields were printed. */
+
+static int
+print_field_values (type, valaddr, stream, format, recurse, pretty,
+ comma_needed, outer_type, outer_valaddr)
+ struct type *type;
+ char *valaddr;
+ struct ui_file *stream;
+ int format;
+ int recurse;
+ enum val_prettyprint pretty;
+ int comma_needed;
+ struct type *outer_type;
+ char *outer_valaddr;
+{
+ int i, len;
+
+ len = TYPE_NFIELDS (type);
+
+ for (i = 0; i < len; i += 1)
+ {
+ if (ada_is_ignored_field (type, i))
+ continue;
+
+ if (ada_is_wrapper_field (type, i))
+ {
+ comma_needed =
+ print_field_values (TYPE_FIELD_TYPE (type, i),
+ valaddr
+ + TYPE_FIELD_BITPOS (type, i) / HOST_CHAR_BIT,
+ stream, format, recurse, pretty,
+ comma_needed, type, valaddr);
+ continue;
+ }
+ else if (ada_is_variant_part (type, i))
+ {
+ comma_needed =
+ print_variant_part (type, i, valaddr,
+ stream, format, recurse, pretty, comma_needed,
+ outer_type, outer_valaddr);
+ continue;
+ }
+
+ if (comma_needed)
+ fprintf_filtered (stream, ", ");
+ comma_needed = 1;
+
+ if (pretty)
+ {
+ fprintf_filtered (stream, "\n");
+ print_spaces_filtered (2 + 2 * recurse, stream);
+ }
+ else
+ {
+ wrap_here (n_spaces (2 + 2 * recurse));
+ }
+ if (inspect_it)
+ {
+ if (TYPE_CODE (TYPE_FIELD_TYPE (type, i)) == TYPE_CODE_PTR)
+ fputs_filtered ("\"( ptr \"", stream);
+ else
+ fputs_filtered ("\"( nodef \"", stream);
+ fprintf_symbol_filtered (stream, TYPE_FIELD_NAME (type, i),
+ language_cplus, DMGL_NO_OPTS);
+ fputs_filtered ("\" \"", stream);
+ fprintf_symbol_filtered (stream, TYPE_FIELD_NAME (type, i),
+ language_cplus, DMGL_NO_OPTS);
+ fputs_filtered ("\") \"", stream);
+ }
+ else
+ {
+ annotate_field_begin (TYPE_FIELD_TYPE (type, i));
+ fprintf_filtered (stream, "%.*s",
+ ada_name_prefix_len (TYPE_FIELD_NAME (type, i)),
+ TYPE_FIELD_NAME (type, i));
+ annotate_field_name_end ();
+ fputs_filtered (" => ", stream);
+ annotate_field_value ();
+ }
+
+ if (TYPE_FIELD_PACKED (type, i))
+ {
+ struct value* v;
+
+ /* Bitfields require special handling, especially due to byte
+ order problems. */
+ if (TYPE_CPLUS_SPECIFIC (type) != NULL
+ && TYPE_FIELD_IGNORE (type, i))
+ {
+ fputs_filtered ("<optimized out or zero length>", stream);
+ }
+ else
+ {
+ int bit_pos = TYPE_FIELD_BITPOS (type, i);
+ int bit_size = TYPE_FIELD_BITSIZE (type, i);
+
+ adjust_type_signedness (TYPE_FIELD_TYPE (type, i));
+ v = ada_value_primitive_packed_val (NULL, valaddr,
+ bit_pos / HOST_CHAR_BIT,
+ bit_pos % HOST_CHAR_BIT,
+ bit_size,
+ TYPE_FIELD_TYPE (type, i));
+ val_print (TYPE_FIELD_TYPE(type, i), VALUE_CONTENTS (v), 0, 0,
+ stream, format, 0, recurse + 1, pretty);
+ }
+ }
+ else
+ ada_val_print (TYPE_FIELD_TYPE (type, i),
+ valaddr + TYPE_FIELD_BITPOS (type, i) / HOST_CHAR_BIT,
+ 0, 0, stream, format, 0, recurse + 1, pretty);
+ annotate_field_end ();
+ }
+
+ return comma_needed;
+}
diff --git a/gdb/alpha-linux-tdep.c b/gdb/alpha-linux-tdep.c
index d467840e920..4596d37e327 100644
--- a/gdb/alpha-linux-tdep.c
+++ b/gdb/alpha-linux-tdep.c
@@ -116,5 +116,6 @@ alpha_linux_init_abi (struct gdbarch_info info,
void
_initialize_alpha_linux_tdep (void)
{
- alpha_gdbarch_register_os_abi (ALPHA_ABI_LINUX, alpha_linux_init_abi);
+ gdbarch_register_osabi (bfd_arch_alpha, GDB_OSABI_LINUX,
+ alpha_linux_init_abi);
}
diff --git a/gdb/alpha-osf1-tdep.c b/gdb/alpha-osf1-tdep.c
index 67c56cf9d36..12320519ae8 100644
--- a/gdb/alpha-osf1-tdep.c
+++ b/gdb/alpha-osf1-tdep.c
@@ -69,5 +69,5 @@ alpha_osf1_init_abi (struct gdbarch_info info,
void
_initialize_alpha_osf1_tdep (void)
{
- alpha_gdbarch_register_os_abi (ALPHA_ABI_OSF1, alpha_osf1_init_abi);
+ gdbarch_register_osabi (bfd_arch_alpha, GDB_OSABI_OSF1, alpha_osf1_init_abi);
}
diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c
index f354036dda4..8a87a8a5e50 100644
--- a/gdb/alpha-tdep.c
+++ b/gdb/alpha-tdep.c
@@ -53,9 +53,9 @@ static gdbarch_register_convert_to_virtual_ftype
alpha_register_convert_to_virtual;
static gdbarch_register_convert_to_raw_ftype alpha_register_convert_to_raw;
static gdbarch_store_struct_return_ftype alpha_store_struct_return;
-static gdbarch_extract_return_value_ftype alpha_extract_return_value;
+static gdbarch_deprecated_extract_return_value_ftype alpha_extract_return_value;
static gdbarch_store_return_value_ftype alpha_store_return_value;
-static gdbarch_extract_struct_value_address_ftype
+static gdbarch_deprecated_extract_struct_value_address_ftype
alpha_extract_struct_value_address;
static gdbarch_use_struct_convention_ftype alpha_use_struct_convention;
@@ -1766,186 +1766,6 @@ alpha_software_single_step (enum target_signal sig, int insert_breakpoints_p)
}
-/* This table matches the indices assigned to enum alpha_abi. Keep
- them in sync. */
-static const char * const alpha_abi_names[] =
-{
- "<unknown>",
- "OSF/1",
- "GNU/Linux",
- "FreeBSD",
- "NetBSD",
- NULL
-};
-
-static void
-process_note_abi_tag_sections (bfd *abfd, asection *sect, void *obj)
-{
- enum alpha_abi *os_ident_ptr = obj;
- const char *name;
- unsigned int sectsize;
-
- name = bfd_get_section_name (abfd, sect);
- sectsize = bfd_section_size (abfd, sect);
-
- if (strcmp (name, ".note.ABI-tag") == 0 && sectsize > 0)
- {
- unsigned int name_length, data_length, note_type;
- char *note;
-
- /* If the section is larger than this, it's probably not what we are
- looking for. */
- if (sectsize > 128)
- sectsize = 128;
-
- note = alloca (sectsize);
-
- bfd_get_section_contents (abfd, sect, note,
- (file_ptr) 0, (bfd_size_type) sectsize);
-
- name_length = bfd_h_get_32 (abfd, note);
- data_length = bfd_h_get_32 (abfd, note + 4);
- note_type = bfd_h_get_32 (abfd, note + 8);
-
- if (name_length == 4 && data_length == 16 && note_type == 1
- && strcmp (note + 12, "GNU") == 0)
- {
- int os_number = bfd_h_get_32 (abfd, note + 16);
-
- /* The case numbers are from abi-tags in glibc. */
- switch (os_number)
- {
- case 0 :
- *os_ident_ptr = ALPHA_ABI_LINUX;
- break;
-
- case 1 :
- internal_error
- (__FILE__, __LINE__,
- "process_note_abi_sections: Hurd objects not supported");
- break;
-
- case 2 :
- internal_error
- (__FILE__, __LINE__,
- "process_note_abi_sections: Solaris objects not supported");
- break;
-
- default :
- internal_error
- (__FILE__, __LINE__,
- "process_note_abi_sections: unknown OS number %d",
- os_number);
- break;
- }
- }
- }
- /* NetBSD uses a similar trick. */
- else if (strcmp (name, ".note.netbsd.ident") == 0 && sectsize > 0)
- {
- unsigned int name_length, desc_length, note_type;
- char *note;
-
- /* If the section is larger than this, it's probably not what we are
- looking for. */
- if (sectsize > 128)
- sectsize = 128;
-
- note = alloca (sectsize);
-
- bfd_get_section_contents (abfd, sect, note,
- (file_ptr) 0, (bfd_size_type) sectsize);
-
- name_length = bfd_h_get_32 (abfd, note);
- desc_length = bfd_h_get_32 (abfd, note + 4);
- note_type = bfd_h_get_32 (abfd, note + 8);
-
- if (name_length == 7 && desc_length == 4 && note_type == 1
- && strcmp (note + 12, "NetBSD") == 0)
- /* XXX Should we check the version here?
- Probably not necessary yet. */
- *os_ident_ptr = ALPHA_ABI_NETBSD;
- }
-}
-
-static int
-get_elfosabi (bfd *abfd)
-{
- int elfosabi;
- enum alpha_abi alpha_abi = ALPHA_ABI_UNKNOWN;
-
- elfosabi = elf_elfheader (abfd)->e_ident[EI_OSABI];
-
- /* When elfosabi is 0 (ELFOSABI_NONE), this is supposed to indicate
- what we're on a SYSV system. However, GNU/Linux uses a note section
- to record OS/ABI info, but leaves e_ident[EI_OSABI] zero. So we
- have to check the note sections too. */
- if (elfosabi == 0)
- {
- bfd_map_over_sections (abfd,
- process_note_abi_tag_sections,
- &alpha_abi);
- }
-
- if (alpha_abi != ALPHA_ABI_UNKNOWN)
- return alpha_abi;
-
- switch (elfosabi)
- {
- case ELFOSABI_NONE:
- /* Leave it as unknown. */
- break;
-
- case ELFOSABI_NETBSD:
- return ALPHA_ABI_NETBSD;
-
- case ELFOSABI_FREEBSD:
- return ALPHA_ABI_FREEBSD;
-
- case ELFOSABI_LINUX:
- return ALPHA_ABI_LINUX;
- }
-
- return ALPHA_ABI_UNKNOWN;
-}
-
-struct alpha_abi_handler
-{
- struct alpha_abi_handler *next;
- enum alpha_abi abi;
- void (*init_abi)(struct gdbarch_info, struct gdbarch *);
-};
-
-struct alpha_abi_handler *alpha_abi_handler_list = NULL;
-
-void
-alpha_gdbarch_register_os_abi (enum alpha_abi abi,
- void (*init_abi)(struct gdbarch_info,
- struct gdbarch *))
-{
- struct alpha_abi_handler **handler_p;
-
- for (handler_p = &alpha_abi_handler_list; *handler_p != NULL;
- handler_p = &(*handler_p)->next)
- {
- if ((*handler_p)->abi == abi)
- {
- internal_error
- (__FILE__, __LINE__,
- "alpha_gdbarch_register_os_abi: A handler for this ABI variant "
- "(%d) has already been registered", (int) abi);
- /* If user wants to continue, override previous definition. */
- (*handler_p)->init_abi = init_abi;
- return;
- }
- }
-
- (*handler_p)
- = (struct alpha_abi_handler *) xmalloc (sizeof (struct alpha_abi_handler));
- (*handler_p)->next = NULL;
- (*handler_p)->abi = abi;
- (*handler_p)->init_abi = init_abi;
-}
/* Initialize the current architecture based on INFO. If possible, re-use an
architecture from ARCHES, which is a list of architectures already created
@@ -1959,27 +1779,18 @@ alpha_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
{
struct gdbarch_tdep *tdep;
struct gdbarch *gdbarch;
- enum alpha_abi alpha_abi = ALPHA_ABI_UNKNOWN;
- struct alpha_abi_handler *abi_handler;
+ enum gdb_osabi osabi = GDB_OSABI_UNKNOWN;
/* Try to determine the ABI of the object we are loading. */
if (info.abfd != NULL)
{
- switch (bfd_get_flavour (info.abfd))
+ osabi = gdbarch_lookup_osabi (info.abfd);
+ if (osabi == GDB_OSABI_UNKNOWN)
{
- case bfd_target_elf_flavour:
- alpha_abi = get_elfosabi (info.abfd);
- break;
-
- case bfd_target_ecoff_flavour:
- /* Assume it's OSF/1. */
- alpha_abi = ALPHA_ABI_OSF1;
- break;
-
- default:
- /* Not sure what to do here, leave the ABI as unknown. */
- break;
+ /* If it's an ECOFF file, assume it's OSF/1. */
+ if (bfd_get_flavour (info.abfd) == bfd_target_ecoff_flavour)
+ osabi = GDB_OSABI_OSF1;
}
}
@@ -1990,22 +1801,14 @@ alpha_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
{
/* Make sure the ABI selection matches. */
tdep = gdbarch_tdep (arches->gdbarch);
- if (tdep && tdep->alpha_abi == alpha_abi)
+ if (tdep && tdep->osabi == osabi)
return arches->gdbarch;
}
tdep = xmalloc (sizeof (struct gdbarch_tdep));
gdbarch = gdbarch_alloc (&info, tdep);
- tdep->alpha_abi = alpha_abi;
- if (alpha_abi < ALPHA_ABI_INVALID)
- tdep->abi_name = alpha_abi_names[alpha_abi];
- else
- {
- internal_error (__FILE__, __LINE__, "Invalid setting of alpha_abi %d",
- (int) alpha_abi);
- tdep->abi_name = "<invalid>";
- }
+ tdep->osabi = osabi;
/* Lowest text address. This is used by heuristic_proc_start() to
decide when to stop looking. */
@@ -2069,11 +1872,11 @@ alpha_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_get_saved_register (gdbarch, alpha_get_saved_register);
set_gdbarch_use_struct_convention (gdbarch, alpha_use_struct_convention);
- set_gdbarch_extract_return_value (gdbarch, alpha_extract_return_value);
+ set_gdbarch_deprecated_extract_return_value (gdbarch, alpha_extract_return_value);
set_gdbarch_store_struct_return (gdbarch, alpha_store_struct_return);
set_gdbarch_store_return_value (gdbarch, alpha_store_return_value);
- set_gdbarch_extract_struct_value_address (gdbarch,
+ set_gdbarch_deprecated_extract_struct_value_address (gdbarch,
alpha_extract_struct_value_address);
/* Settings for calling functions in the inferior. */
@@ -2122,38 +1925,7 @@ alpha_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_frame_args_skip (gdbarch, 0);
/* Hook in ABI-specific overrides, if they have been registered. */
- if (alpha_abi == ALPHA_ABI_UNKNOWN)
- {
- /* Don't complain about not knowing the ABI variant if we don't
- have an inferior. */
- if (info.abfd)
- fprintf_filtered
- (gdb_stderr, "GDB doesn't recognize the ABI of the inferior. "
- "Attempting to continue with the default Alpha settings");
- }
- else
- {
- for (abi_handler = alpha_abi_handler_list; abi_handler != NULL;
- abi_handler = abi_handler->next)
- if (abi_handler->abi == alpha_abi)
- break;
-
- if (abi_handler)
- abi_handler->init_abi (info, gdbarch);
- else
- {
- /* We assume that if GDB_MULTI_ARCH is less than
- GDB_MULTI_ARCH_TM that an ABI variant can be supported by
- overriding definitions in this file. */
- if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
- fprintf_filtered
- (gdb_stderr,
- "A handler for the ABI variant \"%s\" is not built into this "
- "configuration of GDB. "
- "Attempting to continue with the default Alpha settings",
- alpha_abi_names[alpha_abi]);
- }
- }
+ gdbarch_init_osabi (info, gdbarch, osabi);
/* Now that we have tuned the configuration, set a few final things
based on what the OS ABI has told us. */
@@ -2172,12 +1944,8 @@ alpha_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file)
if (tdep == NULL)
return;
- if (tdep->abi_name != NULL)
- fprintf_unfiltered (file, "alpha_dump_tdep: ABI = %s\n", tdep->abi_name);
- else
- internal_error (__FILE__, __LINE__,
- "alpha_dump_tdep: illegal setting of tdep->alpha_abi (%d)",
- (int) tdep->alpha_abi);
+ fprintf_unfiltered (file, "alpha_dump_tdep: OS ABI = %s\n",
+ gdbarch_osabi_name (tdep->osabi));
fprintf_unfiltered (file,
"alpha_dump_tdep: vm_min_address = 0x%lx\n",
diff --git a/gdb/alpha-tdep.h b/gdb/alpha-tdep.h
index c3ee007c6ac..cea232b502c 100644
--- a/gdb/alpha-tdep.h
+++ b/gdb/alpha-tdep.h
@@ -22,6 +22,8 @@
#ifndef ALPHA_TDEP_H
#define ALPHA_TDEP_H
+#include "osabi.h"
+
/* Say how long (ordinary) registers are. This is a piece of bogosity
used in push_word and a few other places; REGISTER_RAW_SIZE is the
real way to know how big a register is. */
@@ -76,24 +78,10 @@
pointer, the value of localoff is obtained from the PDR. */
#define ALPHA_NUM_ARG_REGS 6
-/* ABI variants that we know about. If you add to this enum, please
- update the table of names in alpha-tdep.c. */
-enum alpha_abi
-{
- ALPHA_ABI_UNKNOWN = 0,
- ALPHA_ABI_OSF1,
- ALPHA_ABI_LINUX,
- ALPHA_ABI_FREEBSD,
- ALPHA_ABI_NETBSD,
-
- ALPHA_ABI_INVALID /* Keep this last. */
-};
-
/* Target-dependent structure in gdbarch. */
struct gdbarch_tdep
{
- enum alpha_abi alpha_abi; /* OS/ABI of inferior. */
- const char *abi_name; /* Name of the above. */
+ enum gdb_osabi osabi; /* OS/ABI of inferior. */
CORE_ADDR vm_min_address; /* used by heuristic_proc_start */
@@ -118,8 +106,4 @@ struct gdbarch_tdep
void alpha_software_single_step (enum target_signal, int);
-void alpha_gdbarch_register_os_abi (enum alpha_abi,
- void (*init_abi)(struct gdbarch_info,
- struct gdbarch *));
-
#endif /* ALPHA_TDEP_H */
diff --git a/gdb/alphafbsd-tdep.c b/gdb/alphafbsd-tdep.c
index 3c1e64da3e8..f8f515d3cc8 100644
--- a/gdb/alphafbsd-tdep.c
+++ b/gdb/alphafbsd-tdep.c
@@ -78,5 +78,6 @@ alphafbsd_init_abi (struct gdbarch_info info,
void
_initialize_alphafbsd_tdep (void)
{
- alpha_gdbarch_register_os_abi (ALPHA_ABI_FREEBSD, alphafbsd_init_abi);
+ gdbarch_register_osabi (bfd_arch_alpha, GDB_OSABI_FREEBSD_ELF,
+ alphafbsd_init_abi);
}
diff --git a/gdb/alphanbsd-tdep.c b/gdb/alphanbsd-tdep.c
index d10a3cab159..519d8164ca3 100644
--- a/gdb/alphanbsd-tdep.c
+++ b/gdb/alphanbsd-tdep.c
@@ -24,6 +24,8 @@
#include "regcache.h"
#include "value.h"
+#include "solib-svr4.h"
+
#include "alpha-tdep.h"
#include "alphabsd-tdep.h"
#include "nbsd-tdep.h"
@@ -133,29 +135,29 @@ static struct core_fns alphanbsd_elfcore_fns =
sequence and can then check whether we really are executing in the
signal trampoline. If not, -1 is returned, otherwise the offset from the
start of the return sequence is returned. */
-static const unsigned int sigtramp_retcode[] =
+static const unsigned char sigtramp_retcode[] =
{
- 0xa61e0000, /* ldq a0, 0(sp) */
- 0x23de0010, /* lda sp, 16(sp) */
- 0x201f0127, /* lda v0, 295(zero) */
- 0x00000083, /* call_pal callsys */
+ 0x00, 0x00, 0x1e, 0xa6, /* ldq a0, 0(sp) */
+ 0x10, 0x00, 0xde, 0x23, /* lda sp, 16(sp) */
+ 0x27, 0x01, 0x1f, 0x20, /* lda v0, 295(zero) */
+ 0x83, 0x00, 0x00, 0x00, /* call_pal callsys */
};
-#define RETCODE_NWORDS \
- (sizeof (sigtramp_retcode) / sizeof (sigtramp_retcode[0]))
+#define RETCODE_NWORDS 4
+#define RETCODE_SIZE (RETCODE_NWORDS * 4)
LONGEST
alphanbsd_sigtramp_offset (CORE_ADDR pc)
{
- unsigned int ret[4], w;
+ unsigned char ret[RETCODE_SIZE], w[4];
LONGEST off;
int i;
- if (read_memory_nobpt (pc, (char *) &w, 4) != 0)
+ if (read_memory_nobpt (pc, (char *) w, 4) != 0)
return -1;
for (i = 0; i < RETCODE_NWORDS; i++)
{
- if (w == sigtramp_retcode[i])
+ if (memcmp (w, sigtramp_retcode + (i * 4), 4) == 0)
break;
}
if (i == RETCODE_NWORDS)
@@ -167,7 +169,7 @@ alphanbsd_sigtramp_offset (CORE_ADDR pc)
if (read_memory_nobpt (pc, (char *) ret, sizeof (ret)) != 0)
return -1;
- if (memcmp (ret, sigtramp_retcode, sizeof (sigtramp_retcode)) == 0)
+ if (memcmp (ret, sigtramp_retcode, RETCODE_SIZE) == 0)
return off;
return -1;
@@ -203,7 +205,8 @@ alphanbsd_init_abi (struct gdbarch_info info,
void
_initialize_alphanbsd_tdep (void)
{
- alpha_gdbarch_register_os_abi (ALPHA_ABI_NETBSD, alphanbsd_init_abi);
+ gdbarch_register_osabi (bfd_arch_alpha, GDB_OSABI_NETBSD_ELF,
+ alphanbsd_init_abi);
add_core_fns (&alphanbsd_core_fns);
add_core_fns (&alphanbsd_elfcore_fns);
diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c
index bde89a8fa8e..887aa9d7223 100644
--- a/gdb/arch-utils.c
+++ b/gdb/arch-utils.c
@@ -42,6 +42,7 @@
#endif
#include "regcache.h"
#include "gdb_assert.h"
+#include "sim-regno.h"
#include "version.h"
@@ -91,6 +92,22 @@ legacy_breakpoint_from_pc (CORE_ADDR * pcptr, int *lenptr)
}
int
+legacy_register_sim_regno (int regnum)
+{
+ /* Only makes sense to supply raw registers. */
+ gdb_assert (regnum >= 0 && regnum < NUM_REGS);
+ /* NOTE: cagney/2002-05-13: The old code did it this way and it is
+ suspected that some GDB/SIM combinations may rely on this
+ behavour. The default should be one2one_register_sim_regno
+ (below). */
+ if (REGISTER_NAME (regnum) != NULL
+ && REGISTER_NAME (regnum)[0] != '\0')
+ return regnum;
+ else
+ return LEGACY_SIM_REGNO_IGNORE;
+}
+
+int
generic_frameless_function_invocation_not (struct frame_info *fi)
{
return 0;
@@ -224,7 +241,8 @@ default_double_format (struct gdbarch *gdbarch)
}
void
-default_print_float_info (void)
+default_print_float_info (struct gdbarch *gdbarch, struct ui_file *file,
+ struct frame_info *frame)
{
#ifdef FLOAT_INFO
#if GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL
@@ -232,7 +250,8 @@ default_print_float_info (void)
#endif
FLOAT_INFO;
#else
- printf_filtered ("No floating point info available for this processor.\n");
+ fprintf_filtered (file, "\
+No floating point info available for this processor.\n");
#endif
}
@@ -267,13 +286,6 @@ generic_cannot_extract_struct_value_address (char *dummy)
return 0;
}
-int
-default_register_sim_regno (int num)
-{
- return num;
-}
-
-
CORE_ADDR
core_addr_identity (CORE_ADDR addr)
{
diff --git a/gdb/arch-utils.h b/gdb/arch-utils.h
index 594a83209a3..0b397af82d4 100644
--- a/gdb/arch-utils.h
+++ b/gdb/arch-utils.h
@@ -94,11 +94,6 @@ extern void set_architecture_from_arch_mach (enum bfd_architecture, unsigned lon
extern int (*target_architecture_hook) (const struct bfd_arch_info *);
-
-/* Default raw->sim register re-numbering - does nothing. */
-
-extern int default_register_sim_regno (int reg_nr);
-
/* Identity function on a CORE_ADDR. Just returns its parameter. */
extern CORE_ADDR core_addr_identity (CORE_ADDR addr);
@@ -147,7 +142,9 @@ extern int generic_in_solib_call_trampoline (CORE_ADDR pc, char *name);
extern int generic_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc);
-extern void default_print_float_info (void);
+extern void default_print_float_info (struct gdbarch *gdbarch,
+ struct ui_file *file,
+ struct frame_info *frame);
/* Assume that the world is sane, a registers raw and virtual size
both match its type. */
@@ -166,6 +163,12 @@ extern int legacy_convert_register_p (int regnum);
extern void legacy_register_to_value (int regnum, struct type *type, char *from, char *to);
extern void legacy_value_to_register (struct type *type, int regnum, char *from, char *to);
+/* For compatibility with older architectures, returns
+ (LEGACY_SIM_REGNO_IGNORE) when the register doesn't have a valid
+ name. */
+
+extern int legacy_register_sim_regno (int regnum);
+
/* Initialize a ``struct info''. Can't use memset(0) since some
default values are not zero. */
extern void gdbarch_info_init (struct gdbarch_info *info);
diff --git a/gdb/arm-linux-tdep.c b/gdb/arm-linux-tdep.c
index 29f11ae91bf..cb930b64068 100644
--- a/gdb/arm-linux-tdep.c
+++ b/gdb/arm-linux-tdep.c
@@ -532,7 +532,7 @@ arm_linux_init_abi (struct gdbarch_info info,
sizeof (arm_linux_call_dummy_words));
/* The following two overrides shouldn't be needed. */
- set_gdbarch_extract_return_value (gdbarch, arm_linux_extract_return_value);
+ set_gdbarch_deprecated_extract_return_value (gdbarch, arm_linux_extract_return_value);
set_gdbarch_push_arguments (gdbarch, arm_linux_push_arguments);
/* Shared library handling. */
@@ -543,5 +543,5 @@ arm_linux_init_abi (struct gdbarch_info info,
void
_initialize_arm_linux_tdep (void)
{
- arm_gdbarch_register_os_abi (ARM_ABI_LINUX, arm_linux_init_abi);
+ gdbarch_register_osabi (bfd_arch_arm, GDB_OSABI_LINUX, arm_linux_init_abi);
}
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index 646d5c6ea9c..e316cf7c2a2 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -36,11 +36,16 @@
#include "solib-svr4.h"
#include "arm-tdep.h"
+#include "gdb/sim-arm.h"
#include "elf-bfd.h"
#include "coff/internal.h"
#include "elf/arm.h"
+#include "gdb_assert.h"
+
+static int arm_debug;
+
/* Each OS has a different mechanism for accessing the various
registers stored in the sigcontext structure.
@@ -93,23 +98,6 @@
#define MSYMBOL_SIZE(msym) \
((long) MSYMBOL_INFO (msym) & 0x7fffffff)
-/* This table matches the indicees assigned to enum arm_abi.
- Keep them in sync. */
-
-static const char * const arm_abi_names[] =
-{
- "<unknown>",
- "ARM EABI (version 1)",
- "ARM EABI (version 2)",
- "GNU/Linux",
- "NetBSD (a.out)",
- "NetBSD (ELF)",
- "APCS",
- "FreeBSD",
- "Windows CE",
- NULL
-};
-
/* Number of different reg name sets (options). */
static int num_flavor_options;
@@ -1424,104 +1412,125 @@ static CORE_ADDR
arm_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
int struct_return, CORE_ADDR struct_addr)
{
- char *fp;
- int argnum, argreg, nstack_size;
+ CORE_ADDR fp;
+ int argnum;
+ int argreg;
+ int nstack;
+ int simd_argreg;
+ int second_pass;
+ struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
/* Walk through the list of args and determine how large a temporary
stack is required. Need to take care here as structs may be
- passed on the stack, and we have to to push them. */
- nstack_size = -4 * REGISTER_SIZE; /* Some arguments go into A1-A4. */
- if (struct_return) /* The struct address goes in A1. */
- nstack_size += REGISTER_SIZE;
-
- /* Walk through the arguments and add their size to nstack_size. */
- for (argnum = 0; argnum < nargs; argnum++)
- {
- int len;
- struct type *arg_type;
-
- arg_type = check_typedef (VALUE_TYPE (args[argnum]));
- len = TYPE_LENGTH (arg_type);
-
- nstack_size += len;
- }
-
- /* Allocate room on the stack, and initialize our stack frame
- pointer. */
- fp = NULL;
- if (nstack_size > 0)
+ passed on the stack, and we have to to push them. On the second
+ pass, do the store. */
+ nstack = 0;
+ fp = sp;
+ for (second_pass = 0; second_pass < 2; second_pass++)
{
- sp -= nstack_size;
- fp = (char *) sp;
- }
-
- /* Initialize the integer argument register pointer. */
- argreg = ARM_A1_REGNUM;
-
- /* The struct_return pointer occupies the first parameter passing
- register. */
- if (struct_return)
- write_register (argreg++, struct_addr);
-
- /* Process arguments from left to right. Store as many as allowed
- in the parameter passing registers (A1-A4), and save the rest on
- the temporary stack. */
- for (argnum = 0; argnum < nargs; argnum++)
- {
- int len;
- char *val;
- CORE_ADDR regval;
- enum type_code typecode;
- struct type *arg_type, *target_type;
-
- arg_type = check_typedef (VALUE_TYPE (args[argnum]));
- target_type = TYPE_TARGET_TYPE (arg_type);
- len = TYPE_LENGTH (arg_type);
- typecode = TYPE_CODE (arg_type);
- val = (char *) VALUE_CONTENTS (args[argnum]);
-
-#if 1
- /* I don't know why this code was disable. The only logical use
- for a function pointer is to call that function, so setting
- the mode bit is perfectly fine. FN */
- /* If the argument is a pointer to a function, and it is a Thumb
- function, set the low bit of the pointer. */
- if (TYPE_CODE_PTR == typecode
- && NULL != target_type
- && TYPE_CODE_FUNC == TYPE_CODE (target_type))
+ /* Compute the FP using the information computed during the
+ first pass. */
+ if (second_pass)
+ fp = sp - nstack;
+
+ simd_argreg = 0;
+ argreg = ARM_A1_REGNUM;
+ nstack = 0;
+
+ /* The struct_return pointer occupies the first parameter
+ passing register. */
+ if (struct_return)
{
- CORE_ADDR regval = extract_address (val, len);
- if (arm_pc_is_thumb (regval))
- store_address (val, len, MAKE_THUMB_ADDR (regval));
+ if (second_pass)
+ {
+ if (arm_debug)
+ fprintf_unfiltered (gdb_stdlog,
+ "struct return in %s = 0x%s\n",
+ REGISTER_NAME (argreg),
+ paddr (struct_addr));
+ write_register (argreg, struct_addr);
+ }
+ argreg++;
}
-#endif
- /* Copy the argument to general registers or the stack in
- register-sized pieces. Large arguments are split between
- registers and stack. */
- while (len > 0)
- {
- int partial_len = len < REGISTER_SIZE ? len : REGISTER_SIZE;
- if (argreg <= ARM_LAST_ARG_REGNUM)
+ for (argnum = 0; argnum < nargs; argnum++)
+ {
+ int len;
+ struct type *arg_type;
+ struct type *target_type;
+ enum type_code typecode;
+ char *val;
+
+ arg_type = check_typedef (VALUE_TYPE (args[argnum]));
+ len = TYPE_LENGTH (arg_type);
+ target_type = TYPE_TARGET_TYPE (arg_type);
+ typecode = TYPE_CODE (arg_type);
+ val = VALUE_CONTENTS (args[argnum]);
+
+ /* If the argument is a pointer to a function, and it is a
+ Thumb function, create a LOCAL copy of the value and set
+ the THUMB bit in it. */
+ if (second_pass
+ && TYPE_CODE_PTR == typecode
+ && target_type != NULL
+ && TYPE_CODE_FUNC == TYPE_CODE (target_type))
{
- /* It's an argument being passed in a general register. */
- regval = extract_address (val, partial_len);
- write_register (argreg++, regval);
+ CORE_ADDR regval = extract_address (val, len);
+ if (arm_pc_is_thumb (regval))
+ {
+ val = alloca (len);
+ store_address (val, len, MAKE_THUMB_ADDR (regval));
+ }
}
- else
+
+ /* Copy the argument to general registers or the stack in
+ register-sized pieces. Large arguments are split between
+ registers and stack. */
+ while (len > 0)
{
- /* Push the arguments onto the stack. */
- write_memory ((CORE_ADDR) fp, val, REGISTER_SIZE);
- fp += REGISTER_SIZE;
+ int partial_len = len < REGISTER_SIZE ? len : REGISTER_SIZE;
+
+ if (argreg <= ARM_LAST_ARG_REGNUM)
+ {
+ /* The argument is being passed in a general purpose
+ register. */
+ if (second_pass)
+ {
+ CORE_ADDR regval = extract_address (val,
+ partial_len);
+ if (arm_debug)
+ fprintf_unfiltered (gdb_stdlog,
+ "arg %d in %s = 0x%s\n",
+ argnum,
+ REGISTER_NAME (argreg),
+ phex (regval, REGISTER_SIZE));
+ write_register (argreg, regval);
+ }
+ argreg++;
+ }
+ else
+ {
+ if (second_pass)
+ {
+ /* Push the arguments onto the stack. */
+ if (arm_debug)
+ fprintf_unfiltered (gdb_stdlog,
+ "arg %d @ 0x%s + %d\n",
+ argnum, paddr (fp), nstack);
+ write_memory (fp + nstack, val, REGISTER_SIZE);
+ }
+ nstack += REGISTER_SIZE;
+ }
+
+ len -= partial_len;
+ val += partial_len;
}
- len -= partial_len;
- val += partial_len;
}
}
- /* Return adjusted stack pointer. */
- return sp;
+ /* Return the botom of the argument list (pointed to by fp). */
+ return fp;
}
/* Pop the current frame. So long as the frame info has been
@@ -1575,7 +1584,8 @@ print_fpu_flags (int flags)
/* Print interesting information about the floating point processor
(if present) or emulator. */
static void
-arm_print_float_info (void)
+arm_print_float_info (struct gdbarch *gdbarch, struct ui_file *file,
+ struct frame_info *frame)
{
register unsigned long status = read_register (ARM_FPS_REGNUM);
int type;
@@ -1652,6 +1662,27 @@ arm_register_virtual_size (int regnum)
return STATUS_REGISTER_SIZE;
}
+/* Map GDB internal REGNUM onto the Arm simulator register numbers. */
+static int
+arm_register_sim_regno (int regnum)
+{
+ int reg = regnum;
+ gdb_assert (reg >= 0 && reg < NUM_REGS);
+
+ if (reg < NUM_GREGS)
+ return SIM_ARM_R0_REGNUM + reg;
+ reg -= NUM_GREGS;
+
+ if (reg < NUM_FREGS)
+ return SIM_ARM_FP0_REGNUM + reg;
+ reg -= NUM_FREGS;
+
+ if (reg < NUM_SREGS)
+ return SIM_ARM_FPS_REGNUM + reg;
+ reg -= NUM_SREGS;
+
+ internal_error (__FILE__, __LINE__, "Bad REGNUM %d", regnum);
+}
/* NOTE: cagney/2001-08-20: Both convert_from_extended() and
convert_to_extended() use floatformat_arm_ext_littlebyte_bigword.
@@ -2608,208 +2639,82 @@ arm_coff_make_msymbol_special(int val, struct minimal_symbol *msym)
}
-static void
-process_note_abi_tag_sections (bfd *abfd, asection *sect, void *obj)
+static enum gdb_osabi
+arm_elf_osabi_sniffer (bfd *abfd)
{
- enum arm_abi *os_ident_ptr = obj;
- const char *name;
- unsigned int sectsize;
+ unsigned int elfosabi, eflags;
+ enum gdb_osabi osabi = GDB_OSABI_UNKNOWN;
- name = bfd_get_section_name (abfd, sect);
- sectsize = bfd_section_size (abfd, sect);
+ elfosabi = elf_elfheader (abfd)->e_ident[EI_OSABI];
- if (strcmp (name, ".note.ABI-tag") == 0 && sectsize > 0)
+ switch (elfosabi)
{
- unsigned int name_length, data_length, note_type;
- char *note;
-
- /* If the section is larger than this, it's probably not what we are
- looking for. */
- if (sectsize > 128)
- sectsize = 128;
-
- note = alloca (sectsize);
-
- bfd_get_section_contents (abfd, sect, note,
- (file_ptr) 0, (bfd_size_type) sectsize);
-
- name_length = bfd_h_get_32 (abfd, note);
- data_length = bfd_h_get_32 (abfd, note + 4);
- note_type = bfd_h_get_32 (abfd, note + 8);
-
- if (name_length == 4 && data_length == 16 && note_type == 1
- && strcmp (note + 12, "GNU") == 0)
+ case ELFOSABI_NONE:
+ /* When elfosabi is ELFOSABI_NONE (0), then the ELF structures in the
+ file are conforming to the base specification for that machine
+ (there are no OS-specific extensions). In order to determine the
+ real OS in use we must look for OS notes that have been added. */
+ bfd_map_over_sections (abfd,
+ generic_elf_osabi_sniff_abi_tag_sections,
+ &osabi);
+ if (osabi == GDB_OSABI_UNKNOWN)
{
- int os_number = bfd_h_get_32 (abfd, note + 16);
-
- /* The case numbers are from abi-tags in glibc. */
- switch (os_number)
+ /* Existing ARM tools don't set this field, so look at the EI_FLAGS
+ field for more information. */
+ eflags = EF_ARM_EABI_VERSION(elf_elfheader(abfd)->e_flags);
+ switch (eflags)
{
- case 0 :
- *os_ident_ptr = ARM_ABI_LINUX;
+ case EF_ARM_EABI_VER1:
+ osabi = GDB_OSABI_ARM_EABI_V1;
break;
- case 1 :
- internal_error
- (__FILE__, __LINE__,
- "process_note_abi_sections: Hurd objects not supported");
+ case EF_ARM_EABI_VER2:
+ osabi = GDB_OSABI_ARM_EABI_V2;
break;
- case 2 :
- internal_error
- (__FILE__, __LINE__,
- "process_note_abi_sections: Solaris objects not supported");
+ case EF_ARM_EABI_UNKNOWN:
+ /* Assume GNU tools. */
+ osabi = GDB_OSABI_ARM_APCS;
break;
- default :
- internal_error
- (__FILE__, __LINE__,
- "process_note_abi_sections: unknown OS number %d",
- os_number);
- break;
+ default:
+ internal_error (__FILE__, __LINE__,
+ "arm_elf_osabi_sniffer: Unknown ARM EABI "
+ "version 0x%x", eflags);
}
}
- }
- /* NetBSD uses a similar trick. */
- else if (strcmp (name, ".note.netbsd.ident") == 0 && sectsize > 0)
- {
- unsigned int name_length, desc_length, note_type;
- char *note;
-
- /* If the section is larger than this, it's probably not what we are
- looking for. */
- if (sectsize > 128)
- sectsize = 128;
-
- note = alloca (sectsize);
-
- bfd_get_section_contents (abfd, sect, note,
- (file_ptr) 0, (bfd_size_type) sectsize);
-
- name_length = bfd_h_get_32 (abfd, note);
- desc_length = bfd_h_get_32 (abfd, note + 4);
- note_type = bfd_h_get_32 (abfd, note + 8);
-
- if (name_length == 7 && desc_length == 4 && note_type == 1
- && strcmp (note + 12, "NetBSD") == 0)
- /* XXX Should we check the version here?
- Probably not necessary yet. */
- *os_ident_ptr = ARM_ABI_NETBSD_ELF;
- }
-}
-
-/* Return one of the ELFOSABI_ constants for BFDs representing ELF
- executables. If it's not an ELF executable or if the OS/ABI couldn't
- be determined, simply return -1. */
-
-static int
-get_elfosabi (bfd *abfd)
-{
- int elfosabi;
- enum arm_abi arm_abi = ARM_ABI_UNKNOWN;
-
- elfosabi = elf_elfheader (abfd)->e_ident[EI_OSABI];
-
- /* When elfosabi is 0 (ELFOSABI_NONE), this is supposed to indicate
- that we're on a SYSV system. However, GNU/Linux uses a note section
- to record OS/ABI info, but leaves e_ident[EI_OSABI] zero. So we
- have to check the note sections too.
+ break;
- GNU/ARM tools set the EI_OSABI field to ELFOSABI_ARM, so handle that
- as well. */
- if (elfosabi == 0 || elfosabi == ELFOSABI_ARM)
- {
+ case ELFOSABI_ARM:
+ /* GNU tools use this value. Check note sections in this case,
+ as well. */
bfd_map_over_sections (abfd,
- process_note_abi_tag_sections,
- &arm_abi);
- }
-
- if (arm_abi != ARM_ABI_UNKNOWN)
- return arm_abi;
-
- switch (elfosabi)
- {
- case ELFOSABI_NONE:
- /* Existing ARM Tools don't set this field, so look at the EI_FLAGS
- field for more information. */
-
- switch (EF_ARM_EABI_VERSION(elf_elfheader(abfd)->e_flags))
+ generic_elf_osabi_sniff_abi_tag_sections,
+ &osabi);
+ if (osabi == GDB_OSABI_UNKNOWN)
{
- case EF_ARM_EABI_VER1:
- return ARM_ABI_EABI_V1;
-
- case EF_ARM_EABI_VER2:
- return ARM_ABI_EABI_V2;
-
- case EF_ARM_EABI_UNKNOWN:
- /* Assume GNU tools. */
- return ARM_ABI_APCS;
-
- default:
- internal_error (__FILE__, __LINE__,
- "get_elfosabi: Unknown ARM EABI version 0x%lx",
- EF_ARM_EABI_VERSION(elf_elfheader(abfd)->e_flags));
-
+ /* Assume APCS ABI. */
+ osabi = GDB_OSABI_ARM_APCS;
}
break;
- case ELFOSABI_NETBSD:
- return ARM_ABI_NETBSD_ELF;
-
case ELFOSABI_FREEBSD:
- return ARM_ABI_FREEBSD;
-
- case ELFOSABI_LINUX:
- return ARM_ABI_LINUX;
-
- case ELFOSABI_ARM:
- /* Assume GNU tools with the old APCS abi. */
- return ARM_ABI_APCS;
-
- default:
- }
-
- return ARM_ABI_UNKNOWN;
-}
-
-struct arm_abi_handler
-{
- struct arm_abi_handler *next;
- enum arm_abi abi;
- void (*init_abi)(struct gdbarch_info, struct gdbarch *);
-};
-
-struct arm_abi_handler *arm_abi_handler_list = NULL;
+ osabi = GDB_OSABI_FREEBSD_ELF;
+ break;
-void
-arm_gdbarch_register_os_abi (enum arm_abi abi,
- void (*init_abi)(struct gdbarch_info,
- struct gdbarch *))
-{
- struct arm_abi_handler **handler_p;
+ case ELFOSABI_NETBSD:
+ osabi = GDB_OSABI_NETBSD_ELF;
+ break;
- for (handler_p = &arm_abi_handler_list; *handler_p != NULL;
- handler_p = &(*handler_p)->next)
- {
- if ((*handler_p)->abi == abi)
- {
- internal_error
- (__FILE__, __LINE__,
- "arm_gdbarch_register_os_abi: A handler for this ABI variant (%d)"
- " has already been registered", (int)abi);
- /* If user wants to continue, override previous definition. */
- (*handler_p)->init_abi = init_abi;
- return;
- }
+ case ELFOSABI_LINUX:
+ osabi = GDB_OSABI_LINUX;
+ break;
}
- (*handler_p)
- = (struct arm_abi_handler *) xmalloc (sizeof (struct arm_abi_handler));
- (*handler_p)->next = NULL;
- (*handler_p)->abi = abi;
- (*handler_p)->init_abi = init_abi;
+ return osabi;
}
+
/* Initialize the current architecture based on INFO. If possible,
re-use an architecture from ARCHES, which is a list of
architectures already created during this debugging session.
@@ -2822,36 +2727,31 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
{
struct gdbarch_tdep *tdep;
struct gdbarch *gdbarch;
- enum arm_abi arm_abi = ARM_ABI_UNKNOWN;
- struct arm_abi_handler *abi_handler;
+ enum gdb_osabi osabi = GDB_OSABI_UNKNOWN;
/* Try to deterimine the ABI of the object we are loading. */
if (info.abfd != NULL)
{
- switch (bfd_get_flavour (info.abfd))
+ osabi = gdbarch_lookup_osabi (info.abfd);
+ if (osabi == GDB_OSABI_UNKNOWN)
{
- case bfd_target_elf_flavour:
- arm_abi = get_elfosabi (info.abfd);
- break;
-
- case bfd_target_aout_flavour:
- if (strcmp (bfd_get_target(info.abfd), "a.out-arm-netbsd") == 0)
- arm_abi = ARM_ABI_NETBSD_AOUT;
- else
- /* Assume it's an old APCS-style ABI. */
- arm_abi = ARM_ABI_APCS;
- break;
+ switch (bfd_get_flavour (info.abfd))
+ {
+ case bfd_target_aout_flavour:
+ /* Assume it's an old APCS-style ABI. */
+ osabi = GDB_OSABI_ARM_APCS;
+ break;
- case bfd_target_coff_flavour:
- /* Assume it's an old APCS-style ABI. */
- /* XXX WinCE? */
- arm_abi = ARM_ABI_APCS;
- break;
+ case bfd_target_coff_flavour:
+ /* Assume it's an old APCS-style ABI. */
+ /* XXX WinCE? */
+ osabi = GDB_OSABI_ARM_APCS;
+ break;
- default:
- /* Not sure what to do here, leave the ABI as unknown. */
- break;
+ default:
+ /* Leave it as "unknown". */
+ }
}
}
@@ -2862,22 +2762,14 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
{
/* Make sure the ABI selection matches. */
tdep = gdbarch_tdep (arches->gdbarch);
- if (tdep && tdep->arm_abi == arm_abi)
+ if (tdep && tdep->osabi == osabi)
return arches->gdbarch;
}
tdep = xmalloc (sizeof (struct gdbarch_tdep));
gdbarch = gdbarch_alloc (&info, tdep);
- tdep->arm_abi = arm_abi;
- if (arm_abi < ARM_ABI_INVALID)
- tdep->abi_name = arm_abi_names[arm_abi];
- else
- {
- internal_error (__FILE__, __LINE__, "Invalid setting of arm_abi %d",
- (int) arm_abi);
- tdep->abi_name = "<invalid>";
- }
+ tdep->osabi = osabi;
/* This is the way it has always defaulted. */
tdep->fp_model = ARM_FLOAT_FPA;
@@ -3025,16 +2917,19 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_max_register_virtual_size (gdbarch, FP_REGISTER_VIRTUAL_SIZE);
set_gdbarch_register_virtual_type (gdbarch, arm_register_type);
+ /* Internal <-> external register number maps. */
+ set_gdbarch_register_sim_regno (gdbarch, arm_register_sim_regno);
+
/* Integer registers are 4 bytes. */
set_gdbarch_register_size (gdbarch, 4);
set_gdbarch_register_name (gdbarch, arm_register_name);
/* Returning results. */
- set_gdbarch_extract_return_value (gdbarch, arm_extract_return_value);
+ set_gdbarch_deprecated_extract_return_value (gdbarch, arm_extract_return_value);
set_gdbarch_store_return_value (gdbarch, arm_store_return_value);
set_gdbarch_store_struct_return (gdbarch, arm_store_struct_return);
set_gdbarch_use_struct_convention (gdbarch, arm_use_struct_convention);
- set_gdbarch_extract_struct_value_address (gdbarch,
+ set_gdbarch_deprecated_extract_struct_value_address (gdbarch,
arm_extract_struct_value_address);
/* Single stepping. */
@@ -3047,38 +2942,7 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
arm_coff_make_msymbol_special);
/* Hook in the ABI-specific overrides, if they have been registered. */
- if (arm_abi == ARM_ABI_UNKNOWN)
- {
- /* Don't complain about not knowing the ABI variant if we don't
- have an inferior. */
- if (info.abfd)
- fprintf_filtered
- (gdb_stderr, "GDB doesn't recognize the ABI of the inferior. "
- "Attempting to continue with the default ARM settings");
- }
- else
- {
- for (abi_handler = arm_abi_handler_list; abi_handler != NULL;
- abi_handler = abi_handler->next)
- if (abi_handler->abi == arm_abi)
- break;
-
- if (abi_handler)
- abi_handler->init_abi (info, gdbarch);
- else
- {
- /* We assume that if GDB_MULTI_ARCH is less than
- GDB_MULTI_ARCH_TM that an ABI variant can be supported by
- overriding definitions in this file. */
- if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
- fprintf_filtered
- (gdb_stderr,
- "A handler for the ABI variant \"%s\" is not built into this "
- "configuration of GDB. "
- "Attempting to continue with the default ARM settings",
- arm_abi_names[arm_abi]);
- }
- }
+ gdbarch_init_osabi (info, gdbarch, osabi);
/* Now we have tuned the configuration, set a few final things,
based on what the OS ABI has told us. */
@@ -3144,12 +3008,8 @@ arm_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file)
if (tdep == NULL)
return;
- if (tdep->abi_name != NULL)
- fprintf_unfiltered (file, "arm_dump_tdep: ABI = %s\n", tdep->abi_name);
- else
- internal_error (__FILE__, __LINE__,
- "arm_dump_tdep: illegal setting of tdep->arm_abi (%d)",
- (int) tdep->arm_abi);
+ fprintf_unfiltered (file, "arm_dump_tdep: OS ABI = %s\n",
+ gdbarch_osabi_name (tdep->osabi));
fprintf_unfiltered (file, "arm_dump_tdep: Lowest pc = 0x%lx",
(unsigned long) tdep->lowest_pc);
@@ -3191,10 +3051,18 @@ _initialize_arm_tdep (void)
if (GDB_MULTI_ARCH)
gdbarch_register (bfd_arch_arm, arm_gdbarch_init, arm_dump_tdep);
+ /* Register an ELF OS ABI sniffer for ARM binaries. */
+ gdbarch_register_osabi_sniffer (bfd_arch_arm,
+ bfd_target_elf_flavour,
+ arm_elf_osabi_sniffer);
+
/* Register some ABI variants for embedded systems. */
- arm_gdbarch_register_os_abi (ARM_ABI_EABI_V1, arm_init_abi_eabi_v1);
- arm_gdbarch_register_os_abi (ARM_ABI_EABI_V2, arm_init_abi_eabi_v2);
- arm_gdbarch_register_os_abi (ARM_ABI_APCS, arm_init_abi_apcs);
+ gdbarch_register_osabi (bfd_arch_arm, GDB_OSABI_ARM_EABI_V1,
+ arm_init_abi_eabi_v1);
+ gdbarch_register_osabi (bfd_arch_arm, GDB_OSABI_ARM_EABI_V2,
+ arm_init_abi_eabi_v2);
+ gdbarch_register_osabi (bfd_arch_arm, GDB_OSABI_ARM_APCS,
+ arm_init_abi_apcs);
tm_print_insn = gdb_print_insn_arm;
@@ -3259,4 +3127,10 @@ The valid values are:\n");
prologue_cache.saved_regs = NULL;
prologue_cache.extra_info = (struct frame_extra_info *)
xcalloc (1, sizeof (struct frame_extra_info));
+
+ /* Debugging flag. */
+ add_show_from_set (add_set_cmd ("arm", class_maintenance, var_zinteger,
+ &arm_debug, "Set arm debugging.\n\
+When non-zero, arm specific debugging is enabled.", &setdebuglist),
+ &showdebuglist);
}
diff --git a/gdb/arm-tdep.h b/gdb/arm-tdep.h
index e7c56515a95..a8f15148364 100644
--- a/gdb/arm-tdep.h
+++ b/gdb/arm-tdep.h
@@ -18,6 +18,8 @@
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
+#include "osabi.h"
+
/* 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
@@ -104,23 +106,6 @@ enum gdb_regnum {
#define FLAG_C 0x20000000
#define FLAG_V 0x10000000
-/* ABI variants that we know about. If you add to this enum, please
- update the table of names in tm-arm.c. */
-enum arm_abi
-{
- ARM_ABI_UNKNOWN = 0,
- ARM_ABI_EABI_V1,
- ARM_ABI_EABI_V2,
- ARM_ABI_LINUX,
- ARM_ABI_NETBSD_AOUT,
- ARM_ABI_NETBSD_ELF,
- ARM_ABI_APCS,
- ARM_ABI_FREEBSD,
- ARM_ABI_WINCE,
-
- ARM_ABI_INVALID /* Keep this last. */
-};
-
/* Type of floating-point code in use by inferior. There are really 3 models
that are traditionally supported (plus the endianness issue), but gcc can
only generate 2 of those. The third is APCS_FLOAT, where arguments to
@@ -139,8 +124,7 @@ enum arm_float_model
/* Target-dependent structure in gdbarch. */
struct gdbarch_tdep
{
- enum arm_abi arm_abi; /* OS/ABI of inferior. */
- const char *abi_name; /* Name of the above. */
+ enum gdb_osabi osabi; /* OS/ABI of inferior. */
enum arm_float_model fp_model; /* Floating point calling conventions. */
@@ -170,10 +154,3 @@ int arm_pc_is_thumb (CORE_ADDR);
CORE_ADDR thumb_get_next_pc (CORE_ADDR);
CORE_ADDR arm_get_next_pc (CORE_ADDR);
-
-/* How a OS variant tells the ARM generic code that it can handle an ABI
- type. */
-void
-arm_gdbarch_register_os_abi (enum arm_abi abi,
- void (*init_abi)(struct gdbarch_info,
- struct gdbarch *));
diff --git a/gdb/armnbsd-tdep.c b/gdb/armnbsd-tdep.c
index 7f6e63992e2..ea920207d32 100644
--- a/gdb/armnbsd-tdep.c
+++ b/gdb/armnbsd-tdep.c
@@ -21,6 +21,8 @@
#include "defs.h"
#include "arm-tdep.h"
+#include "nbsd-tdep.h"
+#include "solib-svr4.h"
/* Description of the longjmp buffer. */
#define JB_PC 24
@@ -74,12 +76,29 @@ arm_netbsd_elf_init_abi (struct gdbarch_info info,
arm_netbsd_init_abi_common (info, gdbarch);
+ set_solib_svr4_fetch_link_map_offsets (gdbarch,
+ nbsd_ilp32_solib_svr4_fetch_link_map_offsets);
+
tdep->fp_model = ARM_FLOAT_SOFT_VFP;
}
+static enum gdb_osabi
+arm_netbsd_aout_osabi_sniffer (bfd *abfd)
+{
+ if (strcmp (bfd_get_target (abfd), "a.out-arm-netbsd") == 0)
+ return GDB_OSABI_NETBSD_AOUT;
+
+ return GDB_OSABI_UNKNOWN;
+}
+
void
_initialize_arm_netbsd_tdep (void)
{
- arm_gdbarch_register_os_abi (ARM_ABI_NETBSD_AOUT, arm_netbsd_aout_init_abi);
- arm_gdbarch_register_os_abi (ARM_ABI_NETBSD_ELF, arm_netbsd_elf_init_abi);
+ gdbarch_register_osabi_sniffer (bfd_arch_arm, bfd_target_aout_flavour,
+ arm_netbsd_aout_osabi_sniffer);
+
+ gdbarch_register_osabi (bfd_arch_arm, GDB_OSABI_NETBSD_AOUT,
+ arm_netbsd_aout_init_abi);
+ gdbarch_register_osabi (bfd_arch_arm, GDB_OSABI_NETBSD_ELF,
+ arm_netbsd_elf_init_abi);
}
diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c
index 71c7796443f..43ac3098c72 100644
--- a/gdb/avr-tdep.c
+++ b/gdb/avr-tdep.c
@@ -1230,7 +1230,7 @@ avr_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_address_to_pointer (gdbarch, avr_address_to_pointer);
set_gdbarch_pointer_to_address (gdbarch, avr_pointer_to_address);
- set_gdbarch_extract_return_value (gdbarch, avr_extract_return_value);
+ set_gdbarch_deprecated_extract_return_value (gdbarch, avr_extract_return_value);
set_gdbarch_push_arguments (gdbarch, avr_push_arguments);
set_gdbarch_push_dummy_frame (gdbarch, generic_push_dummy_frame);
/* set_gdbarch_push_return_address (gdbarch, avr_push_return_address); */
@@ -1240,8 +1240,8 @@ avr_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_use_struct_convention (gdbarch, generic_use_struct_convention);
set_gdbarch_store_struct_return (gdbarch, avr_store_struct_return);
- set_gdbarch_extract_struct_value_address (gdbarch,
- avr_extract_struct_value_address);
+ set_gdbarch_deprecated_extract_struct_value_address
+ (gdbarch, avr_extract_struct_value_address);
set_gdbarch_frame_init_saved_regs (gdbarch, avr_scan_prologue);
set_gdbarch_init_extra_frame_info (gdbarch, avr_init_extra_frame_info);
diff --git a/gdb/blockframe.c b/gdb/blockframe.c
index 78b31eff438..39038a8f6f3 100644
--- a/gdb/blockframe.c
+++ b/gdb/blockframe.c
@@ -34,9 +34,28 @@
#include "inferior.h" /* for read_pc */
#include "annotate.h"
#include "regcache.h"
+#include "gdb_assert.h"
/* Prototypes for exported functions. */
+static void generic_call_dummy_register_unwind (struct frame_info *frame,
+ void **cache,
+ int regnum,
+ int *optimized,
+ enum lval_type *lval,
+ CORE_ADDR *addrp,
+ int *realnum,
+ void *raw_buffer);
+static void frame_saved_regs_register_unwind (struct frame_info *frame,
+ void **cache,
+ int regnum,
+ int *optimized,
+ enum lval_type *lval,
+ CORE_ADDR *addrp,
+ int *realnum,
+ void *buffer);
+
+
void _initialize_blockframe (void);
/* A default FRAME_CHAIN_VALID, in the form that is suitable for most
@@ -208,6 +227,27 @@ set_current_frame (struct frame_info *frame)
current_frame = frame;
}
+
+/* Using the PC, select a mechanism for unwinding a frame returning
+ the previous frame. The register unwind function should, on
+ demand, initialize the ->context object. */
+
+static void
+set_unwind_by_pc (CORE_ADDR pc, CORE_ADDR fp,
+ frame_register_unwind_ftype **unwind)
+{
+ if (!USE_GENERIC_DUMMY_FRAMES)
+ /* Still need to set this to something. The ``info frame'' code
+ calls this function to find out where the saved registers are.
+ Hopefully this is robust enough to stop any core dumps and
+ return vaguely correct values.. */
+ *unwind = frame_saved_regs_register_unwind;
+ else if (PC_IN_CALL_DUMMY (pc, fp, fp))
+ *unwind = generic_call_dummy_register_unwind;
+ else
+ *unwind = frame_saved_regs_register_unwind;
+}
+
/* Create an arbitrary (i.e. address specified by user) or innermost frame.
Always returns a non-NULL value. */
@@ -232,6 +272,9 @@ create_new_frame (CORE_ADDR addr, CORE_ADDR pc)
if (INIT_EXTRA_FRAME_INFO_P ())
INIT_EXTRA_FRAME_INFO (0, fi);
+ /* Select/initialize an unwind function. */
+ set_unwind_by_pc (fi->pc, fi->frame, &fi->register_unwind);
+
return fi;
}
@@ -371,6 +414,15 @@ get_prev_frame (struct frame_info *next_frame)
start go curfluy than have an abort called from main not show
main. */
address = FRAME_CHAIN (next_frame);
+
+ /* FIXME: cagney/2002-06-08: There should be two tests here.
+ The first would check for a valid frame chain based on a user
+ selectable policy. The default being ``stop at main'' (as
+ implemented by generic_func_frame_chain_valid()). Other
+ policies would be available - stop at NULL, .... The second
+ test, if provided by the target architecture, would check for
+ more exotic cases - most target architectures wouldn't bother
+ with this second case. */
if (!FRAME_CHAIN_VALID (address, next_frame))
return 0;
}
@@ -456,6 +508,12 @@ get_prev_frame (struct frame_info *next_frame)
}
}
+ /* Initialize the code used to unwind the frame PREV based on the PC
+ (and probably other architectural information). The PC lets you
+ check things like the debug info at that point (dwarf2cfi?) and
+ use that to decide how the frame should be unwound. */
+ set_unwind_by_pc (prev->pc, prev->frame, &prev->register_unwind);
+
find_pc_partial_function (prev->pc, &name,
(CORE_ADDR *) NULL, (CORE_ADDR *) NULL);
if (PC_IN_SIGTRAMP (prev->pc, name))
@@ -1248,7 +1306,8 @@ generic_file_frame_chain_valid (CORE_ADDR fp, struct frame_info *fi)
int
generic_func_frame_chain_valid (CORE_ADDR fp, struct frame_info *fi)
{
- if (PC_IN_CALL_DUMMY ((fi)->pc, fp, fp))
+ if (USE_GENERIC_DUMMY_FRAMES
+ && PC_IN_CALL_DUMMY ((fi)->pc, 0, 0))
return 1; /* don't prune CALL_DUMMY frames */
else /* fall back to default algorithm (see frame.h) */
return (fp != 0
@@ -1268,6 +1327,141 @@ generic_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs,
return;
}
+/* Given a call-dummy dummy-frame, return the registers. Here the
+ register value is taken from the local copy of the register buffer. */
+
+static void
+generic_call_dummy_register_unwind (struct frame_info *frame, void **cache,
+ int regnum, int *optimized,
+ enum lval_type *lvalp, CORE_ADDR *addrp,
+ int *realnum, void *bufferp)
+{
+ gdb_assert (frame != NULL);
+ gdb_assert (PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame));
+
+ /* Describe the register's location. Generic dummy frames always
+ have the register value in an ``expression''. */
+ *optimized = 0;
+ *lvalp = not_lval;
+ *addrp = 0;
+ *realnum = -1;
+
+ /* If needed, find and return the value of the register. */
+ if (bufferp != NULL)
+ {
+ char *registers;
+#if 1
+ /* Get the address of the register buffer that contains all the
+ saved registers for this dummy frame. Cache that address. */
+ registers = (*cache);
+ if (registers == NULL)
+ {
+ registers = generic_find_dummy_frame (frame->pc, frame->frame);
+ (*cache) = registers;
+ }
+#else
+ /* Get the address of the register buffer that contains the
+ saved registers and then extract the value from that. */
+ registers = generic_find_dummy_frame (frame->pc, frame->frame);
+#endif
+ gdb_assert (registers != NULL);
+ /* Return the actual value. */
+ memcpy (bufferp, registers + REGISTER_BYTE (regnum),
+ REGISTER_RAW_SIZE (regnum));
+ }
+}
+
+/* Return the register saved in the simplistic ``saved_regs'' cache.
+ If the value isn't here AND a value is needed, try the next inner
+ most frame. */
+
+static void
+frame_saved_regs_register_unwind (struct frame_info *frame, void **cache,
+ int regnum, int *optimizedp,
+ enum lval_type *lvalp, CORE_ADDR *addrp,
+ int *realnump, void *bufferp)
+{
+ /* There is always a frame at this point. And THIS is the frame
+ we're interested in. */
+ gdb_assert (frame != NULL);
+ gdb_assert (!PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame));
+
+ /* Load the saved_regs register cache. */
+ if (frame->saved_regs == NULL)
+ FRAME_INIT_SAVED_REGS (frame);
+
+ if (frame->saved_regs != NULL
+ && frame->saved_regs[regnum] != 0)
+ {
+ if (regnum == SP_REGNUM)
+ {
+ /* SP register treated specially. */
+ *optimizedp = 0;
+ *lvalp = not_lval;
+ *addrp = 0;
+ *realnump = -1;
+ if (bufferp != NULL)
+ store_address (bufferp, REGISTER_RAW_SIZE (regnum),
+ frame->saved_regs[regnum]);
+ }
+ else
+ {
+ /* Any other register is saved in memory, fetch it but cache
+ a local copy of its value. */
+ *optimizedp = 0;
+ *lvalp = lval_memory;
+ *addrp = frame->saved_regs[regnum];
+ *realnump = -1;
+ if (bufferp != NULL)
+ {
+#if 1
+ /* Save each register value, as it is read in, in a
+ frame based cache. */
+ void **regs = (*cache);
+ if (regs == NULL)
+ {
+ int sizeof_cache = ((NUM_REGS + NUM_PSEUDO_REGS)
+ * sizeof (void *));
+ regs = frame_obstack_alloc (sizeof_cache);
+ memset (regs, 0, sizeof_cache);
+ (*cache) = regs;
+ }
+ if (regs[regnum] == NULL)
+ {
+ regs[regnum]
+ = frame_obstack_alloc (REGISTER_RAW_SIZE (regnum));
+ read_memory (frame->saved_regs[regnum], regs[regnum],
+ REGISTER_RAW_SIZE (regnum));
+ }
+ memcpy (bufferp, regs[regnum], REGISTER_RAW_SIZE (regnum));
+#else
+ /* Read the value in from memory. */
+ read_memory (frame->saved_regs[regnum], bufferp,
+ REGISTER_RAW_SIZE (regnum));
+#endif
+ }
+ }
+ return;
+ }
+
+ /* No luck, assume this and the next frame have the same register
+ value. If a value is needed, pass the request on down the chain;
+ otherwise just return an indication that the value is in the same
+ register as the next frame. */
+ if (bufferp == NULL)
+ {
+ *optimizedp = 0;
+ *lvalp = lval_register;
+ *addrp = 0;
+ *realnump = regnum;
+ }
+ else
+ {
+ frame_register_unwind (frame->next, regnum, optimizedp, lvalp, addrp,
+ realnump, bufferp);
+ }
+}
+
/* Function: get_saved_register
Find register number REGNUM relative to FRAME and put its (raw,
target format) contents in *RAW_BUFFER.
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 6f604f1961a..1861370eaa7 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -909,13 +909,7 @@ insert_breakpoints (void)
else
{
struct frame_info *fi;
-
- /* There might be no current frame at this moment if we are
- resuming from a step over a breakpoint.
- Set up current frame before trying to find the watchpoint
- frame. */
- get_current_frame ();
- fi = find_frame_addr_in_frame_chain (b->watchpoint_frame);
+ fi = frame_find_by_id (b->watchpoint_frame);
within_current_scope = (fi != NULL);
if (within_current_scope)
select_frame (fi);
@@ -2320,7 +2314,7 @@ watchpoint_check (PTR p)
any chance of handling watchpoints on local variables, we'll need
the frame chain (so we can determine if we're in scope). */
reinit_frame_cache ();
- fr = find_frame_addr_in_frame_chain (b->watchpoint_frame);
+ fr = frame_find_by_id (b->watchpoint_frame);
within_current_scope = (fr != NULL);
/* in_function_epilogue_p() returns a non-zero value if we're still
in the function but the stack frame has already been invalidated.
@@ -5321,10 +5315,12 @@ watch_command_1 (char *arg, int accessflag, int from_tty)
if (frame)
{
prev_frame = get_prev_frame (frame);
- b->watchpoint_frame = frame->frame;
+ get_frame_id (frame, &b->watchpoint_frame);
}
else
- b->watchpoint_frame = (CORE_ADDR) 0;
+ {
+ memset (&b->watchpoint_frame, 0, sizeof (b->watchpoint_frame));
+ }
/* If the expression is "local", then set up a "watchpoint scope"
breakpoint at the point where we've left the scope of the watchpoint
@@ -7266,12 +7262,7 @@ do_enable_breakpoint (struct breakpoint *bpt, enum bpdisp disposition)
if (bpt->exp_valid_block != NULL)
{
struct frame_info *fr =
-
- /* Ensure that we have the current frame. Else, this
- next query may pessimistically be answered as, "No,
- not within current scope". */
- get_current_frame ();
- fr = find_frame_addr_in_frame_chain (bpt->watchpoint_frame);
+ fr = frame_find_by_id (bpt->watchpoint_frame);
if (fr == NULL)
{
printf_filtered ("\
diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h
index 3a58aad2487..7ab300ffb65 100644
--- a/gdb/breakpoint.h
+++ b/gdb/breakpoint.h
@@ -270,10 +270,10 @@ struct breakpoint
it the watchpoint_scope breakpoint or something like that. FIXME). */
struct breakpoint *related_breakpoint;
- /* Holds the frame address which identifies the frame this watchpoint
- should be evaluated in, or NULL if the watchpoint should be evaluated
- on the outermost frame. */
- CORE_ADDR watchpoint_frame;
+ /* Holds the frame address which identifies the frame this
+ watchpoint should be evaluated in, or `null' if the watchpoint
+ should be evaluated on the outermost frame. */
+ struct frame_id watchpoint_frame;
/* Thread number for thread-specific breakpoint, or -1 if don't care */
int thread;
diff --git a/gdb/c-exp.y b/gdb/c-exp.y
index a15a4456bce..f555518ea00 100644
--- a/gdb/c-exp.y
+++ b/gdb/c-exp.y
@@ -1246,6 +1246,17 @@ yylex ()
retry:
+ /* Check if this is a macro invocation that we need to expand. */
+ if (! scanning_macro_expansion ())
+ {
+ char *expanded = macro_expand_next (&lexptr,
+ expression_macro_lookup_func,
+ expression_macro_lookup_baton);
+
+ if (expanded)
+ scan_macro_expansion (expanded);
+ }
+
prev_lexptr = lexptr;
unquoted_expr = 1;
@@ -1271,7 +1282,17 @@ yylex ()
switch (c = *tokstart)
{
case 0:
- return 0;
+ /* If we were just scanning the result of a macro expansion,
+ then we need to resume scanning the original text.
+ Otherwise, we were already scanning the original text, and
+ we're really done. */
+ if (scanning_macro_expansion ())
+ {
+ finished_macro_expansion ();
+ goto retry;
+ }
+ else
+ return 0;
case ' ':
case '\t':
@@ -1324,7 +1345,9 @@ yylex ()
return c;
case ',':
- if (comma_terminates && paren_depth == 0)
+ if (comma_terminates
+ && paren_depth == 0
+ && ! scanning_macro_expansion ())
return 0;
lexptr++;
return c;
@@ -1503,9 +1526,13 @@ yylex ()
c = tokstart[++namelen];
}
- /* The token "if" terminates the expression and is NOT
- removed from the input stream. */
- if (namelen == 2 && tokstart[0] == 'i' && tokstart[1] == 'f')
+ /* The token "if" terminates the expression and is NOT removed from
+ the input stream. It doesn't count if it appears in the
+ expansion of a macro. */
+ if (namelen == 2
+ && tokstart[0] == 'i'
+ && tokstart[1] == 'f'
+ && ! scanning_macro_expansion ())
{
return 0;
}
diff --git a/gdb/c-lang.c b/gdb/c-lang.c
index f98548a63af..09a2e6a968a 100644
--- a/gdb/c-lang.c
+++ b/gdb/c-lang.c
@@ -27,6 +27,8 @@
#include "language.h"
#include "c-lang.h"
#include "valprint.h"
+#include "macroscope.h"
+#include "gdb_assert.h"
extern void _initialize_c_language (void);
static void c_emit_char (int c, struct ui_file * stream, int quoter);
@@ -371,7 +373,128 @@ c_create_fundamental_type (struct objfile *objfile, int typeid)
return (type);
}
+/* Preprocessing and parsing C and C++ expressions. */
+
+/* When we find that lexptr (the global var defined in parse.c) is
+ pointing at a macro invocation, we expand the invocation, and call
+ scan_macro_expansion to save the old lexptr here and point lexptr
+ into the expanded text. When we reach the end of that, we call
+ end_macro_expansion to pop back to the value we saved here. The
+ macro expansion code promises to return only fully-expanded text,
+ so we don't need to "push" more than one level.
+
+ This is disgusting, of course. It would be cleaner to do all macro
+ expansion beforehand, and then hand that to lexptr. But we don't
+ really know where the expression ends. Remember, in a command like
+
+ (gdb) break *ADDRESS if CONDITION
+
+ we evaluate ADDRESS in the scope of the current frame, but we
+ evaluate CONDITION in the scope of the breakpoint's location. So
+ it's simply wrong to try to macro-expand the whole thing at once. */
+static char *macro_original_text;
+static char *macro_expanded_text;
+
+
+void
+scan_macro_expansion (char *expansion)
+{
+ /* We'd better not be trying to push the stack twice. */
+ gdb_assert (! macro_original_text);
+ gdb_assert (! macro_expanded_text);
+
+ /* Save the old lexptr value, so we can return to it when we're done
+ parsing the expanded text. */
+ macro_original_text = lexptr;
+ lexptr = expansion;
+
+ /* Save the expanded text, so we can free it when we're finished. */
+ macro_expanded_text = expansion;
+}
+
+
+int
+scanning_macro_expansion ()
+{
+ return macro_original_text != 0;
+}
+
+
+void
+finished_macro_expansion ()
+{
+ /* There'd better be something to pop back to, and we better have
+ saved a pointer to the start of the expanded text. */
+ gdb_assert (macro_original_text);
+ gdb_assert (macro_expanded_text);
+
+ /* Pop back to the original text. */
+ lexptr = macro_original_text;
+ macro_original_text = 0;
+
+ /* Free the expanded text. */
+ xfree (macro_expanded_text);
+ macro_expanded_text = 0;
+}
+
+
+static void
+scan_macro_cleanup (void *dummy)
+{
+ if (macro_original_text)
+ finished_macro_expansion ();
+}
+
+
+/* We set these global variables before calling c_parse, to tell it
+ how it to find macro definitions for the expression at hand. */
+macro_lookup_ftype *expression_macro_lookup_func;
+void *expression_macro_lookup_baton;
+
+
+static struct macro_definition *
+null_macro_lookup (const char *name, void *baton)
+{
+ return 0;
+}
+
+
+static int
+c_preprocess_and_parse ()
+{
+ /* Set up a lookup function for the macro expander. */
+ struct macro_scope *scope = 0;
+ struct cleanup *back_to = make_cleanup (free_current_contents, &scope);
+
+ if (expression_context_block)
+ scope = sal_macro_scope (find_pc_line (expression_context_pc, 0));
+ else
+ scope = default_macro_scope ();
+
+ if (scope)
+ {
+ expression_macro_lookup_func = standard_macro_lookup;
+ expression_macro_lookup_baton = (void *) scope;
+ }
+ else
+ {
+ expression_macro_lookup_func = null_macro_lookup;
+ expression_macro_lookup_baton = 0;
+ }
+
+ gdb_assert (! macro_original_text);
+ make_cleanup (scan_macro_cleanup, 0);
+
+ {
+ int result = c_parse ();
+ do_cleanups (back_to);
+ return result;
+ }
+}
+
+
+
/* Table mapping opcodes into strings for printing operators
and precedences of the operators. */
@@ -439,7 +562,7 @@ const struct language_defn c_language_defn =
range_check_off,
type_check_off,
case_sensitive_on,
- c_parse,
+ c_preprocess_and_parse,
c_error,
evaluate_subexp_standard,
c_printchar, /* Print a character constant */
@@ -491,7 +614,7 @@ const struct language_defn cplus_language_defn =
range_check_off,
type_check_off,
case_sensitive_on,
- c_parse,
+ c_preprocess_and_parse,
c_error,
evaluate_subexp_standard,
c_printchar, /* Print a character constant */
@@ -520,7 +643,7 @@ const struct language_defn asm_language_defn =
range_check_off,
type_check_off,
case_sensitive_on,
- c_parse,
+ c_preprocess_and_parse,
c_error,
evaluate_subexp_standard,
c_printchar, /* Print a character constant */
diff --git a/gdb/c-lang.h b/gdb/c-lang.h
index b1925e1e2d6..e64d4c69e90 100644
--- a/gdb/c-lang.h
+++ b/gdb/c-lang.h
@@ -24,6 +24,7 @@
#define C_LANG_H 1
#include "value.h"
+#include "macroexp.h"
extern int c_parse (void); /* Defined in c-exp.y */
@@ -49,6 +50,13 @@ extern void c_printstr (struct ui_file * stream, char *string,
unsigned int length, int width,
int force_ellipses);
+extern void scan_macro_expansion (char *expansion);
+extern int scanning_macro_expansion (void);
+extern void finished_macro_expansion (void);
+
+extern macro_lookup_ftype *expression_macro_lookup_func;
+extern void *expression_macro_lookup_baton;
+
extern struct type *c_create_fundamental_type (struct objfile *, int);
extern struct type **const (c_builtin_types[]);
diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c
index 430d5674f24..41eb0ad1a5f 100644
--- a/gdb/c-typeprint.c
+++ b/gdb/c-typeprint.c
@@ -41,7 +41,7 @@
/* Flag indicating target was compiled by HP compiler */
extern int hp_som_som_object_present;
-static void cp_type_print_method_args (struct type ** args, char *prefix,
+static void cp_type_print_method_args (struct type *mtype, char *prefix,
char *varstring, int staticp,
struct ui_file *stream);
@@ -147,40 +147,40 @@ cp_type_print_derivation_info (struct ui_file *stream, struct type *type)
fputs_filtered (" ", stream);
}
}
+
/* Print the C++ method arguments ARGS to the file STREAM. */
static void
-cp_type_print_method_args (struct type **args, char *prefix, char *varstring,
+cp_type_print_method_args (struct type *mtype, char *prefix, char *varstring,
int staticp, struct ui_file *stream)
{
+ struct field *args = TYPE_FIELDS (mtype);
+ int nargs = TYPE_NFIELDS (mtype);
+ int varargs = TYPE_VARARGS (mtype);
int i;
fprintf_symbol_filtered (stream, prefix, language_cplus, DMGL_ANSI);
fprintf_symbol_filtered (stream, varstring, language_cplus, DMGL_ANSI);
fputs_filtered ("(", stream);
- if (args && args[!staticp] && TYPE_CODE (args[!staticp]) != TYPE_CODE_VOID)
+
+ /* Skip the class variable. */
+ i = staticp ? 0 : 1;
+ if (nargs > i)
{
- i = !staticp; /* skip the class variable */
- while (1)
+ while (i < nargs)
{
- type_print (args[i++], "", stream, 0);
- if (!args[i])
- {
- fprintf_filtered (stream, " ...");
- break;
- }
- else if (TYPE_CODE (args[i]) != TYPE_CODE_VOID)
- {
- fprintf_filtered (stream, ", ");
- }
- else
- break;
+ type_print (args[i++].type, "", stream, 0);
+
+ if (i == nargs && varargs)
+ fprintf_filtered (stream, ", ...");
+ else if (i < nargs)
+ fprintf_filtered (stream, ", ");
}
}
+ else if (varargs)
+ fprintf_filtered (stream, "...");
else if (current_language->la_language == language_cplus)
- {
- fprintf_filtered (stream, "void");
- }
+ fprintf_filtered (stream, "void");
fprintf_filtered (stream, ")");
}
@@ -336,39 +336,31 @@ static void
c_type_print_args (struct type *type, struct ui_file *stream)
{
int i;
- struct type **args;
+ struct field *args;
fprintf_filtered (stream, "(");
- args = TYPE_ARG_TYPES (type);
+ args = TYPE_FIELDS (type);
if (args != NULL)
{
- if (args[1] == NULL)
- {
- fprintf_filtered (stream, "...");
- }
- else if ((TYPE_CODE (args[1]) == TYPE_CODE_VOID) &&
- (current_language->la_language == language_cplus))
- {
- fprintf_filtered (stream, "void");
- }
- else
+ int i;
+
+ /* FIXME drow/2002-05-31: Always skips the first argument,
+ should we be checking for static members? */
+
+ for (i = 1; i < TYPE_NFIELDS (type); i++)
{
- for (i = 1;
- args[i] != NULL && TYPE_CODE (args[i]) != TYPE_CODE_VOID;
- i++)
+ c_print_type (args[i].type, "", stream, -1, 0);
+ if (i != TYPE_NFIELDS (type))
{
- c_print_type (args[i], "", stream, -1, 0);
- if (args[i + 1] == NULL)
- {
- fprintf_filtered (stream, "...");
- }
- else if (TYPE_CODE (args[i + 1]) != TYPE_CODE_VOID)
- {
- fprintf_filtered (stream, ",");
- wrap_here (" ");
- }
+ fprintf_filtered (stream, ",");
+ wrap_here (" ");
}
}
+ if (TYPE_VARARGS (type))
+ fprintf_filtered (stream, "...");
+ else if (i == 1
+ && (current_language->la_language == language_cplus))
+ fprintf_filtered (stream, "void");
}
else if (current_language->la_language == language_cplus)
{
@@ -1010,10 +1002,15 @@ c_type_print_base (struct type *type, struct ui_file *stream, int show,
Let's try to reconstruct the function signature from
the symbol information */
if (!TYPE_FN_FIELD_STUB (f, j))
- cp_type_print_method_args (TYPE_FN_FIELD_ARGS (f, j), "",
- method_name,
- TYPE_FN_FIELD_STATIC_P (f, j),
- stream);
+ {
+ int staticp = TYPE_FN_FIELD_STATIC_P (f, j);
+ struct type *mtype = TYPE_FN_FIELD_TYPE (f, j);
+ cp_type_print_method_args (mtype,
+ "",
+ method_name,
+ staticp,
+ stream);
+ }
else
fprintf_filtered (stream, "<badly mangled name '%s'>",
mangled_name);
diff --git a/gdb/cli/cli-dump.c b/gdb/cli/cli-dump.c
index 1edcfe26d1b..36c1d2db2be 100644
--- a/gdb/cli/cli-dump.c
+++ b/gdb/cli/cli-dump.c
@@ -623,18 +623,16 @@ restore_command (char *args, int from_tty)
/* Parse offset (optional). */
if (args != NULL && *args != '\0')
data.load_offset =
- parse_and_eval_address (scan_expression_with_cleanup (&args,
- NULL));
+ parse_and_eval_long (scan_expression_with_cleanup (&args, NULL));
if (args != NULL && *args != '\0')
{
/* Parse start address (optional). */
data.load_start =
- parse_and_eval_address (scan_expression_with_cleanup (&args,
- NULL));
+ parse_and_eval_long (scan_expression_with_cleanup (&args, NULL));
if (args != NULL && *args != '\0')
{
/* Parse end address (optional). */
- data.load_end = parse_and_eval_address (args);
+ data.load_end = parse_and_eval_long (args);
if (data.load_end <= data.load_start)
error ("Start must be less than end.");
}
diff --git a/gdb/config/alpha/nm-linux.h b/gdb/config/alpha/nm-linux.h
index c59b88cb21e..990ccb45d97 100644
--- a/gdb/config/alpha/nm-linux.h
+++ b/gdb/config/alpha/nm-linux.h
@@ -23,7 +23,7 @@
#ifndef NM_LINUX_H
#define NM_LINUX_H
-#include "nm-linux.h"
+#include "config/nm-linux.h"
/* ptrace register ``addresses'' are absolute. */
diff --git a/gdb/config/alpha/nm-nbsd.h b/gdb/config/alpha/nm-nbsd.h
index ef6ab313a6f..caf1c237cfb 100644
--- a/gdb/config/alpha/nm-nbsd.h
+++ b/gdb/config/alpha/nm-nbsd.h
@@ -22,8 +22,6 @@
#ifndef NM_NBSD_H
#define NM_NBSD_H
-#define SVR4_SHARED_LIBS
-
/* Get generic NetBSD native definitions. */
#include "config/nm-nbsd.h"
diff --git a/gdb/config/alpha/tm-alphalinux.h b/gdb/config/alpha/tm-alphalinux.h
index 27ff45722af..4858b90eba2 100644
--- a/gdb/config/alpha/tm-alphalinux.h
+++ b/gdb/config/alpha/tm-alphalinux.h
@@ -40,6 +40,6 @@ extern LONGEST alpha_linux_sigtramp_offset (CORE_ADDR);
#undef START_INFERIOR_TRAPS_EXPECTED
#define START_INFERIOR_TRAPS_EXPECTED 2
-#include "tm-linux.h"
+#include "config/tm-linux.h"
#endif /* TM_LINUXALPHA_H */
diff --git a/gdb/config/alpha/tm-nbsd.h b/gdb/config/alpha/tm-nbsd.h
index 9e926566538..90a75a78fd6 100644
--- a/gdb/config/alpha/tm-nbsd.h
+++ b/gdb/config/alpha/tm-nbsd.h
@@ -22,6 +22,7 @@
#define TM_NBSD_H
#include "alpha/tm-alpha.h"
+#include "solib.h"
/* Number of traps that happen between exec'ing the shell to run an
inferior, and when we finally get to the inferior code. The
diff --git a/gdb/config/arc/tm-arc.h b/gdb/config/arc/tm-arc.h
index cbdcf41e0e9..af183b60f44 100644
--- a/gdb/config/arc/tm-arc.h
+++ b/gdb/config/arc/tm-arc.h
@@ -204,14 +204,14 @@ extern void arc_software_single_step (enum target_signal, int);
into VALBUF. This is only called if USE_STRUCT_CONVENTION for this
type is 0.
*/
-#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
+#define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
memcpy(VALBUF, REGBUF+REGISTER_BYTE(R0_REGNUM), TYPE_LENGTH (TYPE))
/* If USE_STRUCT_CONVENTION produces a 1,
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). */
-#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \
+#define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \
(error("Don't know where large structure is returned on arc"), 0)
/* Write into appropriate registers a function return value
diff --git a/gdb/config/arm/nbsd.mt b/gdb/config/arm/nbsd.mt
index dad2717bfc8..94971369506 100644
--- a/gdb/config/arm/nbsd.mt
+++ b/gdb/config/arm/nbsd.mt
@@ -1,2 +1,2 @@
# Target: ARM running NetBSD
-TDEPFILES= arm-tdep.o armnbsd-tdep.o solib.o solib-svr4.o solib-sunos.o
+TDEPFILES= arm-tdep.o armnbsd-tdep.o solib.o solib-svr4.o nbsd-tdep.o
diff --git a/gdb/config/arm/nbsdaout.mh b/gdb/config/arm/nbsdaout.mh
new file mode 100644
index 00000000000..100e40b42bb
--- /dev/null
+++ b/gdb/config/arm/nbsdaout.mh
@@ -0,0 +1,5 @@
+# Host ARM running NetBSD
+NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o armnbsd-nat.o \
+ solib-sunos.o
+XM_FILE=xm-nbsd.h
+NAT_FILE=nm-nbsdaout.h
diff --git a/gdb/config/arm/nbsd.mh b/gdb/config/arm/nbsdelf.mh
index 481d5cc92a5..481d5cc92a5 100644
--- a/gdb/config/arm/nbsd.mh
+++ b/gdb/config/arm/nbsdelf.mh
diff --git a/gdb/config/arm/nm-linux.h b/gdb/config/arm/nm-linux.h
index 2a0ebb3804b..7e0156db43c 100644
--- a/gdb/config/arm/nm-linux.h
+++ b/gdb/config/arm/nm-linux.h
@@ -21,7 +21,7 @@
#ifndef NM_ARMLINUX_H
#define NM_ARMLINUX_H
-#include "nm-linux.h"
+#include "config/nm-linux.h"
/* ptrace register ``addresses'' are absolute. */
diff --git a/gdb/config/arm/nm-nbsd.h b/gdb/config/arm/nm-nbsd.h
index 435c5e75954..63be920092f 100644
--- a/gdb/config/arm/nm-nbsd.h
+++ b/gdb/config/arm/nm-nbsd.h
@@ -22,6 +22,6 @@
#define NM_NBSD_H
/* Get generic NetBSD native definitions. */
-#include <nm-nbsd.h>
+#include "config/nm-nbsd.h"
#endif /* NM_NBSD_H */
diff --git a/gdb/config/arm/nm-nbsdaout.h b/gdb/config/arm/nm-nbsdaout.h
new file mode 100644
index 00000000000..3f7fee9de1a
--- /dev/null
+++ b/gdb/config/arm/nm-nbsdaout.h
@@ -0,0 +1,29 @@
+/* Native-dependent definitions for ARM running NetBSD, for GDB.
+ Copyright 1986, 1987, 1989, 1992, 1994, 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. */
+
+#ifndef NM_NBSDAOUT_H
+#define NM_NBSDAOUT_H
+
+#include "arm/nm-nbsd.h"
+
+/* Get generic NetBSD a.out native definitions. */
+#include "config/nm-nbsdaout.h"
+
+#endif /* NM_NBSDAOUT_H */
diff --git a/gdb/config/arm/tm-linux.h b/gdb/config/arm/tm-linux.h
index 6a0d0e42c96..bbf566d2d83 100644
--- a/gdb/config/arm/tm-linux.h
+++ b/gdb/config/arm/tm-linux.h
@@ -28,7 +28,7 @@
/* Include the common ARM target definitions. */
#include "arm/tm-arm.h"
-#include "tm-linux.h"
+#include "config/tm-linux.h"
/* Use target-specific function to define link map offsets. */
extern struct link_map_offsets *arm_linux_svr4_fetch_link_map_offsets (void);
diff --git a/gdb/config/arm/xm-nbsd.h b/gdb/config/arm/xm-nbsd.h
index c5348d39629..d3f76a7dd01 100644
--- a/gdb/config/arm/xm-nbsd.h
+++ b/gdb/config/arm/xm-nbsd.h
@@ -19,4 +19,4 @@
Boston, MA 02111-1307, USA. */
/* Get generic NetBSD host definitions. */
-#include "xm-nbsd.h"
+#include "config/xm-nbsd.h"
diff --git a/gdb/config/d30v/tm-d30v.h b/gdb/config/d30v/tm-d30v.h
index 7a14e39132c..e233630bae8 100644
--- a/gdb/config/d30v/tm-d30v.h
+++ b/gdb/config/d30v/tm-d30v.h
@@ -188,7 +188,7 @@ void d30v_do_registers_info (int regnum, int fpregs);
/* 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). */
-#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) (((CORE_ADDR *)(REGBUF))[2])
+#define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) (((CORE_ADDR *)(REGBUF))[2])
/* Define other aspects of the stack frame.
@@ -291,7 +291,7 @@ extern CORE_ADDR d30v_push_arguments (int, struct value **, CORE_ADDR, int,
a function return value of type TYPE, and copy that, in virtual format,
into VALBUF. */
-#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
+#define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
d30v_extract_return_value(TYPE, REGBUF, VALBUF)
extern void d30v_extract_return_value (struct type *, char *, char *);
diff --git a/gdb/config/djgpp/fnchange.lst b/gdb/config/djgpp/fnchange.lst
index eb5052f2c75..3c28052c1e6 100644
--- a/gdb/config/djgpp/fnchange.lst
+++ b/gdb/config/djgpp/fnchange.lst
@@ -10,13 +10,18 @@
@V@/bfd/cpu-m68hc12.c @V@/bfd/cm68hc12.c
@V@/bfd/efi-app-ia32.c @V@/bfd/efi-ia32-app.c
@V@/bfd/efi-app-ia64.c @V@/bfd/efi-ia64-app.c
-@V@/bfd/elf32-i370.c @V@/bfd/elf32-i7.c
+@V@/bfd/elf32-i370.c @V@/bfd/e32i370.c
+@V@/bfd/elf32-i386.c @V@/bfd/e32i86.c
+@V@/bfd/elf32-i386qnx.c @V@/bfd/e32i86q.c
@V@/bfd/elf32-m68hc11.c @V@/bfd/em68hc11.c
@V@/bfd/elf32-m68hc12.c @V@/bfd/em68hc12.c
@V@/bfd/elf32-m68k.c @V@/bfd/em68k.c
-@V@/bfd/elf32-sh-lin.c @V@/bfd/elf32shlin.c
-@V@/bfd/elf32-sh-nbsd.c @V@/bfd/elf32shnb.c
-@V@/bfd/elf32-sh64.c @V@/bfd/elf32sh64.c
+@V@/bfd/elf32-sh-lin.c @V@/bfd/e32shlin.c
+@V@/bfd/elf32-sh-nbsd.c @V@/bfd/e32shn.c
+@V@/bfd/elf32-sh64.c @V@/bfd/e32sh64.c
+@V@/bfd/elf32-sh64-nbsd.c @V@/bfd/e32sh64n.c
+@V@/bfd/elf64-sh64.c @V@/bfd/e64sh64.c
+@V@/bfd/elf64-sh64-nbsd.c @V@/bfd/e64sh64n.c
@V@/dejagnu/baseboards/mn10200-cygmon.exp @V@/dejagnu/baseboards/mn10200cygmon.exp
@V@/dejagnu/baseboards/mn10200-sim.exp @V@/dejagnu/baseboards/mn10200sim.exp
@V@/dejagnu/baseboards/mn10300-cygmon.exp @V@/dejagnu/baseboards/mn10300cygmon.exp
@@ -52,6 +57,8 @@
@V@/gdb/ChangeLog-2000 @V@/gdb/ChangeLog.000
@V@/gdb/ChangeLog-2001 @V@/gdb/ChangeLog.001
@V@/gdb/ChangeLog-3.x @V@/gdb/ChangeLog.3-x
+@V@/gdb/alphabsd-nat.c @V@/gdb/alphb-nat.c
+@V@/gdb/alphabsd-tdep.c @V@/gdb/alphb-tdep.c
@V@/gdb/alphanbsd-nat.c @V@/gdb/alphnb-nat.c
@V@/gdb/alphanbsd-tdep.c @V@/gdb/alphnb-tdep.c
@V@/gdb/arm-linux-nat.c @V@/gdb/armlin-nat.c
@@ -126,10 +133,16 @@
@V@/gdb/m68knbsd-tdep.c @V@/gdb/m6nbsd-tdep.c
@V@/gdb/mips-linux-nat.c @V@/gdb/mipslnxnat.c
@V@/gdb/mips-linux-tdep.c @V@/gdb/mipslnxtdep.c
+@V@/gdb/mipsnbsd-nat.c @V@/gdb/mipsnbnat.c
+@V@/gdb/mipsnbsd-tdep.c @V@/gdb/mipsnbtdep.c
@V@/gdb/nindy-share/b.out.h @V@/gdb/nindy-share/b_out.h
+@V@/gdb/ns32knbsd-nat.c @V@/gdb/ns32nb-nat.c
+@V@/gdb/ns32knbsd-tdep.c @V@/gdb/ns32nb-tdep.c
@V@/gdb/osf-share/cma_stack_int.h @V@/gdb/osf-share/cma_stkint.h
@V@/gdb/p-exp.tab.c @V@/gdb/p-exp_tab.c
@V@/gdb/ppc-linux-tdep.c @V@/gdb/ppc-linx-tdep.c
+@V@/gdb/ppcnbsd-nat.c @V@/gdb/ppcnb-nat.c
+@V@/gdb/ppcnbsd-tdep.c @V@/gdb/ppcnb-tdep.c
@V@/gdb/regformats/reg-i386-linux.dat @V@/gdb/regformats/r-i386-lnx.dat
@V@/gdb/regformats/reg-s390x.dat @V@/gdb/regformats/r-s390x.dat
@V@/gdb/remote-adapt.c @V@/gdb/rmt-adapt.c
@@ -156,7 +169,13 @@
@V@/gdb/remote-vxsparc.c @V@/gdb/rmt-vxsparc.c
@V@/gdb/sparclet-rom.c @V@/gdb/splet-rom.c
@V@/gdb/sparclet-stub.c @V@/gdb/splet-stub.c
+@V@/gdb/sparcnbsd-nat.c @V@/gdb/spnb-nat.c
+@V@/gdb/sparcnbsd-tdep.c @V@/gdb/spnb-tdep.c
@V@/gdb/testsuite/.gdbinit @V@/gdb/testsuite/gdb.ini
+@V@/gdb/testsuite/gdb.arch/altivec-abi.c @V@/gdb/testsuite/gdb.arch/av-abi.c
+@V@/gdb/testsuite/gdb.arch/altivec-abi.exp @V@/gdb/testsuite/gdb.arch/av-abi.exp
+@V@/gdb/testsuite/gdb.arch/altivec-regs.c @V@/gdb/testsuite/gdb.arch/av-regs.c
+@V@/gdb/testsuite/gdb.arch/altivec-regs.exp @V@/gdb/testsuite/gdb.arch/av-regs.exp
@V@/gdb/testsuite/gdb.base/coremaker2.c @V@/gdb/testsuite/gdb.base/core2maker.c
@V@/gdb/testsuite/gdb.c++ @V@/gdb/testsuite/gdb.cxx
@V@/gdb/testsuite/gdb.c++/Makefile.in @V@/gdb/testsuite/gdb.cxx/Makefile.in
diff --git a/gdb/config/fr30/tm-fr30.h b/gdb/config/fr30/tm-fr30.h
index 22ddd046a8e..e54154a2203 100644
--- a/gdb/config/fr30/tm-fr30.h
+++ b/gdb/config/fr30/tm-fr30.h
@@ -117,14 +117,14 @@ extern void fr30_pop_frame (void);
/* 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. */
-#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
+#define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
memcpy (VALBUF, REGBUF + REGISTER_BYTE(RETVAL_REG) + \
(TYPE_LENGTH(TYPE) < 4 ? 4 - TYPE_LENGTH(TYPE) : 0), TYPE_LENGTH (TYPE))
/* 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). */
-#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \
+#define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \
extract_address (REGBUF + REGISTER_BYTE (RETVAL_REG), \
REGISTER_RAW_SIZE (RETVAL_REG))
diff --git a/gdb/config/h8300/tm-h8300.h b/gdb/config/h8300/tm-h8300.h
index d43c80914ab..c70f4af542e 100644
--- a/gdb/config/h8300/tm-h8300.h
+++ b/gdb/config/h8300/tm-h8300.h
@@ -100,7 +100,7 @@ extern CORE_ADDR h8300_skip_prologue ();
#define REGISTER_SIZE 4
-#define NUM_REGS 13
+#define NUM_REGS 14
#define REGISTER_BYTES (NUM_REGS * 4)
@@ -137,7 +137,7 @@ extern CORE_ADDR h8300_skip_prologue ();
Entries beyond the first NUM_REGS are ignored. */
#define REGISTER_NAMES \
- {"r0", "r1", "r2", "r3", "r4", "r5", "r6", "sp", "ccr","pc","cycles","tick","inst"}
+ {"r0", "r1", "r2", "r3", "r4", "r5", "r6", "sp", "ccr","pc","cycles","tick","inst",""}
/* An array of names of registers. */
@@ -157,6 +157,7 @@ extern char **h8300_register_names;
#define SP_REGNUM 7 /* Contains address of top of stack */
#define CCR_REGNUM 8 /* Contains processor status */
#define PC_REGNUM 9 /* Contains program counter */
+#define EXR_REGNUM 11 /* Contains processor status */
/* Extract from an array REGBUF containing the (raw) register state
a function return value of type TYPE, and copy that, in virtual format,
@@ -165,7 +166,7 @@ extern char **h8300_register_names;
/* FIXME: Won't work with both h8/300's. */
extern void h8300_extract_return_value (struct type *, char *, char *);
-#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
+#define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
h8300_extract_return_value (TYPE, (char *)(REGBUF), (char *)(VALBUF))
/* Write into appropriate registers a function return value
@@ -187,7 +188,7 @@ extern void h8300_store_return_value (struct type *, char *);
the address in which a function should return its structure value,
as a CORE_ADDR (or an expression that can be used as one). */
-#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \
+#define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \
extract_address (REGBUF + REGISTER_BYTE (0), \
REGISTER_RAW_SIZE (0))
@@ -272,7 +273,7 @@ extern void h8300_print_register_hook (int);
#define GDB_TARGET_IS_H8300
-#define NUM_REALREGS 10
+#define NUM_REALREGS (h8300smode?11:10)
#define NOP { 0x01, 0x80} /* A sleep insn */
#define BELIEVE_PCC_PROMOTION 1
diff --git a/gdb/config/h8500/tm-h8500.h b/gdb/config/h8500/tm-h8500.h
index fae6704c637..96a93b5e75d 100644
--- a/gdb/config/h8500/tm-h8500.h
+++ b/gdb/config/h8500/tm-h8500.h
@@ -162,7 +162,7 @@ extern struct type *h8500_register_virtual_type (int regno);
a function return value of type TYPE, and copy that, in virtual format,
into VALBUF. */
-#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
+#define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
memcpy (VALBUF, (char *)(REGBUF), TYPE_LENGTH(TYPE))
/* Write into appropriate registers a function return value
@@ -175,7 +175,7 @@ extern struct type *h8500_register_virtual_type (int regno);
the address in which a function should return its structure value,
as a CORE_ADDR (or an expression that can be used as one). */
-#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) (*(CORE_ADDR *)(REGBUF))
+#define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) (*(CORE_ADDR *)(REGBUF))
/* Define other aspects of the stack frame. */
diff --git a/gdb/config/i386/i386nw.mt b/gdb/config/i386/i386nw.mt
index 3109c42149e..9eafe7dcfd7 100644
--- a/gdb/config/i386/i386nw.mt
+++ b/gdb/config/i386/i386nw.mt
@@ -1,3 +1,3 @@
# Target: Intel 386 running NetWare
TDEPFILES= i386-tdep.o i387-tdep.o
-TM_FILE= tm-i386nw.h
+TM_FILE= tm-i386.h
diff --git a/gdb/config/i386/i386sol2.mh b/gdb/config/i386/i386sol2.mh
index ec93f4a75b9..931cc132bbb 100644
--- a/gdb/config/i386/i386sol2.mh
+++ b/gdb/config/i386/i386sol2.mh
@@ -5,4 +5,5 @@ XM_CLIBS= -lsocket -lnsl
NAT_FILE= nm-i386sol2.h
NATDEPFILES= core-regset.o fork-child.o i386v4-nat.o corelow.o \
- procfs.o proc-api.o proc-events.o proc-flags.o proc-why.o gcore.o
+ procfs.o proc-api.o proc-events.o proc-flags.o proc-why.o gcore.o \
+ solib.o solib-svr4.o solib-legacy.o
diff --git a/gdb/config/i386/i386sol2.mt b/gdb/config/i386/i386sol2.mt
index 86d93a378b1..f8fabd494b7 100644
--- a/gdb/config/i386/i386sol2.mt
+++ b/gdb/config/i386/i386sol2.mt
@@ -1,3 +1,3 @@
-# Target: Intel 386 running SVR4
-TDEPFILES= i386-tdep.o i387-tdep.o solib.o solib-svr4.o solib-legacy.o
+# Target: Intel 386 running Solaris 2 (SVR4)
+TDEPFILES= i386-tdep.o i387-tdep.o i386-sol2-tdep.o i386bsd-tdep.o
TM_FILE= tm-i386sol2.h
diff --git a/gdb/config/i386/nbsd.mh b/gdb/config/i386/nbsdaout.mh
index bf957b58745..e52f38a5b21 100644
--- a/gdb/config/i386/nbsd.mh
+++ b/gdb/config/i386/nbsdaout.mh
@@ -3,4 +3,4 @@ NATDEPFILES= fork-child.o infptrace.o inftarg.o i386bsd-nat.o \
solib.o solib-sunos.o
XM_FILE= xm-nbsd.h
-NAT_FILE= nm-nbsd.h
+NAT_FILE= nm-nbsdaout.h
diff --git a/gdb/config/i386/nbsd.mt b/gdb/config/i386/nbsdaout.mt
index fc80608e01e..aa88957b9ea 100644
--- a/gdb/config/i386/nbsd.mt
+++ b/gdb/config/i386/nbsdaout.mt
@@ -1,3 +1,3 @@
# Target: Intel 386 running NetBSD
TDEPFILES= i386-tdep.o i387-tdep.o i386bsd-tdep.o i386nbsd-tdep.o corelow.o
-TM_FILE= tm-nbsd.h
+TM_FILE= tm-nbsdaout.h
diff --git a/gdb/config/i386/nbsdelf.mh b/gdb/config/i386/nbsdelf.mh
index d0cbe786d68..0d1c4d1badc 100644
--- a/gdb/config/i386/nbsdelf.mh
+++ b/gdb/config/i386/nbsdelf.mh
@@ -2,4 +2,4 @@
NATDEPFILES= fork-child.o infptrace.o inftarg.o i386bsd-nat.o \
solib.o solib-svr4.o solib-legacy.o
XM_FILE= xm-nbsd.h
-NAT_FILE= nm-nbsdelf.h
+NAT_FILE= nm-nbsd.h
diff --git a/gdb/config/i386/nbsdelf.mt b/gdb/config/i386/nbsdelf.mt
index e5cdc255677..fc80608e01e 100644
--- a/gdb/config/i386/nbsdelf.mt
+++ b/gdb/config/i386/nbsdelf.mt
@@ -1,3 +1,3 @@
# Target: Intel 386 running NetBSD
TDEPFILES= i386-tdep.o i387-tdep.o i386bsd-tdep.o i386nbsd-tdep.o corelow.o
-TM_FILE= tm-nbsdelf.h
+TM_FILE= tm-nbsd.h
diff --git a/gdb/config/i386/nm-cygwin.h b/gdb/config/i386/nm-cygwin.h
index b5e48907013..7eac99ba3fd 100644
--- a/gdb/config/i386/nm-cygwin.h
+++ b/gdb/config/i386/nm-cygwin.h
@@ -1,5 +1,5 @@
/* Native definitions for Intel x86 running CYGWIN.
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright 2002 Free Software Foundation, Inc.
This file is part of GDB.
@@ -18,8 +18,6 @@
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#define NO_PTRACE_H
-
#define I386_USE_GENERIC_WATCHPOINTS
#include "i386/nm-i386.h"
diff --git a/gdb/config/i386/nm-gnu.h b/gdb/config/i386/nm-gnu.h
index fa6d829345d..e721ce6478d 100644
--- a/gdb/config/i386/nm-gnu.h
+++ b/gdb/config/i386/nm-gnu.h
@@ -20,4 +20,4 @@
/* Include the generic hurd definitions. */
-#include "nm-gnu.h"
+#include "config/nm-gnu.h"
diff --git a/gdb/config/i386/nm-go32.h b/gdb/config/i386/nm-go32.h
index 70b1907b67e..5947b745c0e 100644
--- a/gdb/config/i386/nm-go32.h
+++ b/gdb/config/i386/nm-go32.h
@@ -1,5 +1,5 @@
/* Native definitions for Intel x86 running DJGPP.
- Copyright (C) 1997, 1998, 1999, 2001 Free Software Foundation, Inc.
+ Copyright 1997, 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
This file is part of GDB.
@@ -18,8 +18,6 @@
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#define NO_PTRACE_H
-
#define I386_USE_GENERIC_WATCHPOINTS
#include "i386/nm-i386.h"
diff --git a/gdb/config/i386/nm-i386lynx.h b/gdb/config/i386/nm-i386lynx.h
index 5d0d41de267..bc6a23410f2 100644
--- a/gdb/config/i386/nm-i386lynx.h
+++ b/gdb/config/i386/nm-i386lynx.h
@@ -21,6 +21,6 @@
#ifndef NM_I386LYNX_H
#define NM_I386LYNX_H
-#include "nm-lynx.h"
+#include "config/nm-lynx.h"
#endif /* NM_I386LYNX_H */
diff --git a/gdb/config/i386/nm-i386sol2.h b/gdb/config/i386/nm-i386sol2.h
index 0e6b3ef4c7f..8a51942791f 100644
--- a/gdb/config/i386/nm-i386sol2.h
+++ b/gdb/config/i386/nm-i386sol2.h
@@ -18,7 +18,7 @@
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#include "nm-sysv4.h"
+#include "config/nm-sysv4.h"
#ifdef NEW_PROC_API /* Solaris 6 and above can do HW watchpoints */
diff --git a/gdb/config/i386/nm-i386v4.h b/gdb/config/i386/nm-i386v4.h
index 02d445e8bc3..356d3cba0ca 100644
--- a/gdb/config/i386/nm-i386v4.h
+++ b/gdb/config/i386/nm-i386v4.h
@@ -20,7 +20,7 @@
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#include "nm-sysv4.h"
+#include "config/nm-sysv4.h"
/* Poll causes GDB to hang, at least under Unixware 1.1.2. */
#define LOSING_POLL
diff --git a/gdb/config/i386/nm-i386v42mp.h b/gdb/config/i386/nm-i386v42mp.h
index 72e440d0cc4..7ded36148f2 100644
--- a/gdb/config/i386/nm-i386v42mp.h
+++ b/gdb/config/i386/nm-i386v42mp.h
@@ -20,4 +20,4 @@
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#include "nm-sysv4.h"
+#include "config/nm-sysv4.h"
diff --git a/gdb/config/i386/nm-linux.h b/gdb/config/i386/nm-linux.h
index 8ae3eceec98..f751517d738 100644
--- a/gdb/config/i386/nm-linux.h
+++ b/gdb/config/i386/nm-linux.h
@@ -27,7 +27,7 @@
#define I386_USE_GENERIC_WATCHPOINTS
#include "i386/nm-i386.h"
-#include "nm-linux.h"
+#include "config/nm-linux.h"
/* Support for the user area. */
diff --git a/gdb/config/i386/nm-m3.h b/gdb/config/i386/nm-m3.h
index 00128cf9ce8..5ff74024942 100644
--- a/gdb/config/i386/nm-m3.h
+++ b/gdb/config/i386/nm-m3.h
@@ -20,4 +20,4 @@
/* Include the generic Mach 3 definitions. */
-#include "nm-m3.h"
+#include "config/nm-m3.h"
diff --git a/gdb/config/i386/nm-nbsd.h b/gdb/config/i386/nm-nbsd.h
index f926f9bc273..2e5adb82b3d 100644
--- a/gdb/config/i386/nm-nbsd.h
+++ b/gdb/config/i386/nm-nbsd.h
@@ -1,5 +1,5 @@
/* Native-dependent definitions for Intel 386 running NetBSD, for GDB.
- Copyright 1986, 1987, 1989, 1992, 1994, 1996, 2000
+ Copyright 1986, 1987, 1989, 1992, 1994, 2000, 2002
Free Software Foundation, Inc.
This file is part of GDB.
@@ -25,9 +25,4 @@
/* Get generic NetBSD native definitions. */
#include "config/nm-nbsd.h"
-#define REGISTER_U_ADDR(addr, blockend, regno) \
- (addr) = i386_register_u_addr ((blockend),(regno));
-
-extern int i386_register_u_addr (int, int);
-
#endif /* NM_NBSD_H */
diff --git a/gdb/config/i386/nm-nbsdelf.h b/gdb/config/i386/nm-nbsdaout.h
index 1aee1c7fd60..dc8aac961c4 100644
--- a/gdb/config/i386/nm-nbsdelf.h
+++ b/gdb/config/i386/nm-nbsdaout.h
@@ -1,5 +1,5 @@
/* Native-dependent definitions for Intel 386 running NetBSD, for GDB.
- Copyright 1986, 1987, 1989, 1992, 1994, 2000
+ Copyright 1986, 1987, 1989, 1992, 1994, 1996, 2000
Free Software Foundation, Inc.
This file is part of GDB.
@@ -19,10 +19,12 @@
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#ifndef NM_NBSDELF_H
-#define NM_NBSDELF_H
+#ifndef NM_NBSDAOUT_H
+#define NM_NBSDAOUT_H
-#define SVR4_SHARED_LIBS
#include "i386/nm-nbsd.h"
-#endif /* NM_NBSDELF_H */
+/* Get generic NetBSD a.out native definitions. */
+#include "config/nm-nbsdaout.h"
+
+#endif /* NM_NBSDAOUT_H */
diff --git a/gdb/config/i386/nm-ptx4.h b/gdb/config/i386/nm-ptx4.h
index 32b76d24256..253b1944e9c 100644
--- a/gdb/config/i386/nm-ptx4.h
+++ b/gdb/config/i386/nm-ptx4.h
@@ -22,11 +22,11 @@
#include "regcache.h"
-#include "nm-sysv4.h"
+#include "config/nm-sysv4.h"
#undef USE_PROC_FS
-#include "nm-symmetry.h"
+#include "i386/nm-symmetry.h"
#define PTRACE_READ_REGS(pid,regaddr) mptrace (XPT_RREGS, (pid), (regaddr), 0)
#define PTRACE_WRITE_REGS(pid,regaddr) \
diff --git a/gdb/config/i386/nm-x86-64.h b/gdb/config/i386/nm-x86-64.h
index 30e37310222..4430fcba5db 100644
--- a/gdb/config/i386/nm-x86-64.h
+++ b/gdb/config/i386/nm-x86-64.h
@@ -23,7 +23,7 @@
#ifndef NM_X86_64_H
#define NM_X86_64_H
-#include "nm-linux.h"
+#include "config/nm-linux.h"
#define I386_USE_GENERIC_WATCHPOINTS
#include "i386/nm-i386.h"
diff --git a/gdb/config/i386/tm-fbsd.h b/gdb/config/i386/tm-fbsd.h
index 61f5de57f4a..f51859d0b46 100644
--- a/gdb/config/i386/tm-fbsd.h
+++ b/gdb/config/i386/tm-fbsd.h
@@ -24,56 +24,17 @@
#define HAVE_I387_REGS
#include "i386/tm-i386.h"
-/* FreeBSD/ELF uses stabs-in-ELF with the DWARF register numbering
- scheme by default, so we must redefine STAB_REG_TO_REGNUM. This
- messes up the floating-point registers for a.out, but there is not
- much we can do about that. */
-
-#undef STAB_REG_TO_REGNUM
-#define STAB_REG_TO_REGNUM(reg) i386_dwarf_reg_to_regnum ((reg))
-
-/* FreeBSD uses the old gcc convention for struct returns. */
-
-#define USE_STRUCT_CONVENTION(gcc_p, type) \
- generic_use_struct_convention (1, type)
-
-
-/* Support for longjmp. */
-
-/* Details about jmp_buf. It's supposed to be an array of integers. */
-
-#define JB_ELEMENT_SIZE 4 /* Size of elements in jmp_buf. */
-#define JB_PC 0 /* Array index of saved PC. */
-
-/* Figure out where the longjmp will land. Store the address that
- longjmp will jump to in *ADDR, and return non-zero if successful. */
-
-#define GET_LONGJMP_TARGET(addr) get_longjmp_target (addr)
-extern int get_longjmp_target (CORE_ADDR *addr);
-
-
-/* Support for signal handlers. */
-
-#define IN_SIGTRAMP(pc, name) i386bsd_in_sigtramp (pc, name)
-extern int i386bsd_in_sigtramp (CORE_ADDR pc, char *name);
-
/* These defines allow the recognition of sigtramps as a function name
<sigtramp>.
- FIXME: kettenis/2001-07-13: These should be added to the target
- vector and turned into functions when we go "multi-arch". */
-
-#define SIGTRAMP_START(pc) i386bsd_sigtramp_start
-#define SIGTRAMP_END(pc) i386bsd_sigtramp_end
-extern CORE_ADDR i386bsd_sigtramp_start;
-extern CORE_ADDR i386bsd_sigtramp_end;
-
-/* Override FRAME_SAVED_PC to enable the recognition of signal handlers. */
+ FIXME: kettenis/2002-05-12: Of course these defines will have to go
+ if we go truly "multi-arch", but I don't know yet how to get rid of
+ them. */
-#undef FRAME_SAVED_PC
-#define FRAME_SAVED_PC(frame) i386bsd_frame_saved_pc (frame)
-extern CORE_ADDR i386bsd_frame_saved_pc (struct frame_info *frame);
-
+#define SIGTRAMP_START(pc) i386bsd_sigtramp_start (pc)
+#define SIGTRAMP_END(pc) i386bsd_sigtramp_end (pc)
+extern CORE_ADDR i386bsd_sigtramp_start (CORE_ADDR pc);
+extern CORE_ADDR i386bsd_sigtramp_end (CORE_ADDR pc);
/* Shared library support. */
diff --git a/gdb/config/i386/tm-go32.h b/gdb/config/i386/tm-go32.h
index b660827bd66..79370e778a2 100644
--- a/gdb/config/i386/tm-go32.h
+++ b/gdb/config/i386/tm-go32.h
@@ -26,43 +26,4 @@
#include "i386/tm-i386.h"
-/* FRAME_CHAIN takes a frame's nominal address and produces the frame's
- chain-pointer.
- In the case of the i386, the frame's nominal address
- is the address of a 4-byte word containing the calling frame's address.
- DJGPP doesn't have any special frames for signal handlers, they are
- just normal C functions. */
-#undef FRAME_CHAIN
-#define FRAME_CHAIN(thisframe) \
- (!inside_entry_file ((thisframe)->pc) ? \
- read_memory_integer ((thisframe)->frame, 4) :\
- 0)
-
-/* A macro that tells us whether the function invocation represented
- by FI does not have a frame on the stack associated with it. If it
- does not, FRAMELESS is set to 1, else 0. */
-#undef FRAMELESS_FUNCTION_INVOCATION
-#define FRAMELESS_FUNCTION_INVOCATION(FI) \
- (frameless_look_for_prologue(FI))
-
-extern CORE_ADDR i386go32_frame_saved_pc (struct frame_info *frame);
-#undef FRAME_SAVED_PC
-#define FRAME_SAVED_PC(FRAME) (i386go32_frame_saved_pc ((FRAME)))
-
-/* Support for longjmp. */
-
-/* Details about jmp_buf. It's supposed to be an array of integers. */
-
-#define JB_ELEMENT_SIZE 4 /* Size of elements in jmp_buf. */
-#define JB_PC 8 /* Array index of saved PC inside jmp_buf. */
-
-/* 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) get_longjmp_target (addr)
-extern int get_longjmp_target (CORE_ADDR *addr);
-
#endif /* TM_GO32_H */
diff --git a/gdb/config/i386/tm-i386.h b/gdb/config/i386/tm-i386.h
index f9326fecb9a..0ea151b4a14 100644
--- a/gdb/config/i386/tm-i386.h
+++ b/gdb/config/i386/tm-i386.h
@@ -32,25 +32,6 @@ struct frame_saved_regs;
struct value;
struct type;
-/* The format used for `long double' on almost all i386 targets is the
- i387 extended floating-point format. In fact, of all targets in the
- GCC 2.95 tree, only OSF/1 does it different, and insists on having
- a `long double' that's not `long' at all. */
-
-#define TARGET_LONG_DOUBLE_FORMAT &floatformat_i387_ext
-
-/* Although the i386 extended floating-point has only 80 significant
- bits, a `long double' actually takes up 96, probably to enforce
- alignment. */
-
-#define TARGET_LONG_DOUBLE_BIT 96
-
-/* Number of traps that happen between exec'ing the shell to run an
- inferior, and when we finally get to the inferior code. This is 2
- on most implementations. */
-
-#define START_INFERIOR_TRAPS_EXPECTED 2
-
/* Offset from address of function to start of its code.
Zero on most machines. */
@@ -63,11 +44,6 @@ struct type;
extern int i386_skip_prologue (int);
-/* Immediately after a function call, return the saved pc. */
-
-#define SAVED_PC_AFTER_CALL(frame) i386_saved_pc_after_call (frame)
-extern CORE_ADDR i386_saved_pc_after_call (struct frame_info *frame);
-
/* Stack grows downward. */
#define INNER_THAN(lhs,rhs) ((lhs) < (rhs))
@@ -118,7 +94,7 @@ extern CORE_ADDR i386_saved_pc_after_call (struct frame_info *frame);
#endif
/* Largest number of registers we could have in any configuration. */
-#define MAX_NUM_REGS (16 + 16 + 9)
+#define MAX_NUM_REGS (16 + 16 + 9 + 1)
/* Register numbers of various important registers.
Note that some of these values are "real" register numbers,
@@ -139,60 +115,8 @@ extern CORE_ADDR i386_saved_pc_after_call (struct frame_info *frame);
#else
#define FP0_REGNUM 0
#endif
-
-/* Return the name of register REG. */
-
-#define REGISTER_NAME(reg) i386_register_name ((reg))
-extern char *i386_register_name (int reg);
-
-/* Use the "default" register numbering scheme for stabs and COFF. */
-
-#define STAB_REG_TO_REGNUM(reg) i386_stab_reg_to_regnum ((reg))
-#define SDB_REG_TO_REGNUM(reg) i386_stab_reg_to_regnum ((reg))
-extern int i386_stab_reg_to_regnum (int reg);
-
-/* Use the DWARF register numbering scheme for DWARF and DWARF 2. */
-
-#define DWARF_REG_TO_REGNUM(reg) i386_dwarf_reg_to_regnum ((reg))
-#define DWARF2_REG_TO_REGNUM(reg) i386_dwarf_reg_to_regnum ((reg))
-extern int i386_dwarf_reg_to_regnum (int reg);
-
-/* We don't define ECOFF_REG_TO_REGNUM, since ECOFF doesn't seem to be
- in use on any of the supported i386 targets. */
-/* Sizes of individual register sets. These cover the entire register
- file, so summing up the sizes of those portions actually present
- yields REGISTER_BYTES. */
-#define SIZEOF_GREGS (NUM_GREGS * 4)
-#define SIZEOF_FPU_REGS (8 * 10)
-#define SIZEOF_FPU_CTRL_REGS (8 * 4)
-#define SIZEOF_SSE_REGS (8 * 16 + 4)
-
-
-/* Total amount of space needed to store our copies of the machine's register
- state, the array `registers'. */
-#ifdef HAVE_SSE_REGS
-#define REGISTER_BYTES \
- (SIZEOF_GREGS + SIZEOF_FPU_REGS + SIZEOF_FPU_CTRL_REGS + SIZEOF_SSE_REGS)
-#else
-#ifdef HAVE_I387_REGS
-#define REGISTER_BYTES (SIZEOF_GREGS + SIZEOF_FPU_REGS + SIZEOF_FPU_CTRL_REGS)
-#else
-#define REGISTER_BYTES (SIZEOF_GREGS)
-#endif
-#endif
-
-/* Return the offset into the register array of the start of register
- number REG. */
-#define REGISTER_BYTE(reg) i386_register_byte ((reg))
-extern int i386_register_byte (int reg);
-
-/* Return the number of bytes of storage in GDB's register array
- occupied by register REG. */
-#define REGISTER_RAW_SIZE(reg) i386_register_raw_size ((reg))
-extern int i386_register_raw_size (int reg);
-
/* Largest value REGISTER_RAW_SIZE can have. */
#define MAX_REGISTER_RAW_SIZE 16
@@ -255,7 +179,7 @@ extern void i386_store_struct_return (CORE_ADDR addr, CORE_ADDR sp);
a function return value of type TYPE, and copy that, in virtual format,
into VALBUF. */
-#define EXTRACT_RETURN_VALUE(type, regbuf, valbuf) \
+#define DEPRECATED_EXTRACT_RETURN_VALUE(type, regbuf, valbuf) \
i386_extract_return_value ((type), (regbuf), (valbuf))
extern void i386_extract_return_value (struct type *type, char *regbuf,
char *valbuf);
@@ -271,22 +195,10 @@ extern void i386_store_return_value (struct type *type, char *valbuf);
the address in which a function should return its structure value,
as a CORE_ADDR. */
-#define EXTRACT_STRUCT_VALUE_ADDRESS(regbuf) \
+#define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(regbuf) \
i386_extract_struct_value_address ((regbuf))
extern CORE_ADDR i386_extract_struct_value_address (char *regbuf);
-/* The following redefines make backtracing through sigtramp work.
- They manufacture a fake sigtramp frame and obtain the saved pc in sigtramp
- from the sigcontext structure which is pushed by the kernel on the
- user stack, along with a pointer to it. */
-
-/* Return the chain-pointer for FRAME. In the case of the i386, the
- frame's nominal address is the address of a 4-byte word containing
- the calling frame's address. */
-
-#define FRAME_CHAIN(frame) i386_frame_chain ((frame))
-extern CORE_ADDR i386_frame_chain (struct frame_info *frame);
-
/* Determine whether the function invocation represented by FRAME does
not have a from on the stack associated with it. If it does not,
return non-zero, otherwise return zero. */
@@ -295,11 +207,6 @@ extern CORE_ADDR i386_frame_chain (struct frame_info *frame);
i386_frameless_function_invocation (frame)
extern int i386_frameless_function_invocation (struct frame_info *frame);
-/* Return the saved program counter for FRAME. */
-
-#define FRAME_SAVED_PC(frame) i386_frame_saved_pc (frame)
-extern CORE_ADDR i386_frame_saved_pc (struct frame_info *frame);
-
#define FRAME_ARGS_ADDRESS(fi) ((fi)->frame)
#define FRAME_LOCALS_ADDRESS(fi) ((fi)->frame)
diff --git a/gdb/config/i386/tm-i386gnu.h b/gdb/config/i386/tm-i386gnu.h
index 00cb5a9f100..f1835423a72 100644
--- a/gdb/config/i386/tm-i386gnu.h
+++ b/gdb/config/i386/tm-i386gnu.h
@@ -24,7 +24,7 @@
/* Include common definitions for GNU systems.
FIXME: This does not belong here since this is supposed to contain
only native-dependent information. */
-#include "nm-gnu.h"
+#include "config/nm-gnu.h"
/* Thread flavors used in re-setting the T bit.
FIXME: This is native-dependent. */
@@ -51,6 +51,6 @@
#define SIGCONTEXT_PC_OFFSET 68
/* We need this file for the SOLIB_TRAMPOLINE stuff. */
-#include "tm-sysv4.h"
+#include "config/tm-sysv4.h"
#endif /* TM_I386GNU_H */
diff --git a/gdb/config/i386/tm-i386lynx.h b/gdb/config/i386/tm-i386lynx.h
index 842f9a7738d..2da0b7c8dee 100644
--- a/gdb/config/i386/tm-i386lynx.h
+++ b/gdb/config/i386/tm-i386lynx.h
@@ -21,7 +21,7 @@
#ifndef TM_I386LYNX_H
#define TM_I386LYNX_H
-#include "tm-lynx.h"
+#include "config/tm-lynx.h"
/* Most definitions from sysv could be used. */
#include "i386/tm-i386.h"
diff --git a/gdb/config/i386/tm-i386m3.h b/gdb/config/i386/tm-i386m3.h
index edc301da446..40f09016fbe 100644
--- a/gdb/config/i386/tm-i386m3.h
+++ b/gdb/config/i386/tm-i386m3.h
@@ -19,7 +19,7 @@
Boston, MA 02111-1307, USA. */
/* Include common definitions for Mach3 systems */
-#include "nm-m3.h"
+#include "config/nm-m3.h"
/* Define offsets to access CPROC stack when it does not have
* a kernel thread.
diff --git a/gdb/config/i386/tm-i386nw.h b/gdb/config/i386/tm-i386nw.h
deleted file mode 100644
index 9ede2c040e0..00000000000
--- a/gdb/config/i386/tm-i386nw.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/* Macro definitions for i386 running NetWare.
- Copyright 1993, 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. */
-
-#ifndef TM_I386NW_H
-#define TM_I386NW_H 1
-
-#include "i386/tm-i386.h"
-
-/* Stop backtracing when we wander into main. */
-
-#define FRAME_CHAIN_VALID(fp,fi) func_frame_chain_valid (fp, fi)
-
-
-/* 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. */
-
-#define JB_ELEMENT_SIZE 4 /* jmp_buf[] is array of ints */
-
-#define JB_PC 6 /* Setjmp()'s return PC saved here */
-
-/* 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 */
-
-extern int get_longjmp_target (CORE_ADDR *);
-
-#define GET_LONGJMP_TARGET(ADDR) get_longjmp_target(ADDR)
-
-#endif /* ifndef TM_I386NW_H */
diff --git a/gdb/config/i386/tm-i386sco5.h b/gdb/config/i386/tm-i386sco5.h
index e4cb014e990..dc1bb26ffa8 100644
--- a/gdb/config/i386/tm-i386sco5.h
+++ b/gdb/config/i386/tm-i386sco5.h
@@ -28,7 +28,7 @@
/* Pick up more stuff from the generic SYSV and SVR4 host include files. */
#include "i386/tm-i386v.h"
-#include "tm-sysv4.h"
+#include "config/tm-sysv4.h"
#define KERNEL_U_SIZE kernel_u_size()
diff --git a/gdb/config/i386/tm-i386sol2.h b/gdb/config/i386/tm-i386sol2.h
index c90e0d475ae..7473f3bbc91 100644
--- a/gdb/config/i386/tm-i386sol2.h
+++ b/gdb/config/i386/tm-i386sol2.h
@@ -24,11 +24,6 @@
#define HAVE_I387_REGS
#include "i386/tm-i386v4.h"
-/* We use stabs-in-ELF with the DWARF register numbering scheme. */
-
-#undef STAB_REG_TO_REGNUM
-#define STAB_REG_TO_REGNUM(reg) i386_dwarf_reg_to_regnum ((reg))
-
/* If the current gcc for for this target does not produce correct
debugging information for float parameters, both prototyped and
unprototyped, then define this macro. This forces gdb to always
@@ -37,15 +32,6 @@
#define COERCE_FLOAT_TO_DOUBLE(formal, actual) (1)
-/* Signal handler frames under Solaris 2 are recognized by a return address
- of 0xFFFFFFFF, the third parameter on the signal handler stack is
- a pointer to an ucontext. */
-#undef sigtramp_saved_pc
-#undef I386V4_SIGTRAMP_SAVED_PC
-#define SIGCONTEXT_PC_OFFSET (36 + 14 * 4)
-#undef IN_SIGTRAMP
-#define IN_SIGTRAMP(pc, name) (pc == 0xFFFFFFFF)
-
/* The SunPRO compiler puts out 0 instead of the address in N_SO symbols,
and for SunPRO 3.0, N_FUN symbols too. */
#define SOFUN_ADDRESS_MAYBE_MISSING
diff --git a/gdb/config/i386/tm-i386v4.h b/gdb/config/i386/tm-i386v4.h
index 2003b96de2e..7ebd27d7660 100644
--- a/gdb/config/i386/tm-i386v4.h
+++ b/gdb/config/i386/tm-i386v4.h
@@ -29,51 +29,6 @@
/* Pick up more stuff from the generic SVR4 host include file. */
-#include "tm-sysv4.h"
-
-/* Use the alternate method of determining valid frame chains. */
-
-#define FRAME_CHAIN_VALID(fp,fi) func_frame_chain_valid (fp, fi)
-
-/* 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. Note that <setjmp> defines _JBLEN as 10, which is the default
- if no specific machine is selected, even though we only use 6 slots. */
-
-#define JB_ELEMENT_SIZE sizeof(int) /* jmp_buf[_JBLEN] is array of ints */
-
-#define JB_EBX 0
-#define JB_ESI 1
-#define JB_EDI 2
-#define JB_EBP 3
-#define JB_ESP 4
-#define JB_EDX 5
-
-#define JB_PC JB_EDX /* Setjmp()'s return PC saved in EDX */
-
-/* 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 */
-
-extern int get_longjmp_target (CORE_ADDR *);
-
-#define GET_LONGJMP_TARGET(ADDR) get_longjmp_target(ADDR)
-
-/* The following redefines make backtracing through sigtramp work.
- They manufacture a fake sigtramp frame and obtain the saved pc in sigtramp
- from the ucontext structure which is pushed by the kernel on the
- user stack. Unfortunately there are three variants of sigtramp handlers. */
-
-#define I386V4_SIGTRAMP_SAVED_PC
-#define IN_SIGTRAMP(pc, name) ((name) \
- && (STREQ ("_sigreturn", name) \
- || STREQ ("_sigacthandler", name) \
- || STREQ ("sigvechandler", name)))
-
-/* Saved Pc. Get it from ucontext if within sigtramp. */
-
-#define sigtramp_saved_pc i386v4_sigtramp_saved_pc
-extern CORE_ADDR i386v4_sigtramp_saved_pc (struct frame_info *);
+#include "config/tm-sysv4.h"
#endif /* ifndef TM_I386V4_H */
diff --git a/gdb/config/i386/tm-linux.h b/gdb/config/i386/tm-linux.h
index 60c4b1e3e39..7bfdf03895c 100644
--- a/gdb/config/i386/tm-linux.h
+++ b/gdb/config/i386/tm-linux.h
@@ -31,74 +31,11 @@
#endif
#include "i386/tm-i386.h"
-#include "tm-linux.h"
-
-/* Register number for the "orig_eax" pseudo-register. If this
- pseudo-register contains a value >= 0 it is interpreted as the
- system call number that the kernel is supposed to restart. */
-#define I386_LINUX_ORIG_EAX_REGNUM (NUM_GREGS + NUM_FREGS + NUM_SSE_REGS)
-
-/* Adjust a few macros to deal with this extra register. */
-
-#undef NUM_REGS
-#define NUM_REGS (NUM_GREGS + NUM_FREGS + NUM_SSE_REGS + 1)
-
-#undef MAX_NUM_REGS
-#define MAX_NUM_REGS (16 + 16 + 9 + 1)
-
-#undef REGISTER_BYTES
-#define REGISTER_BYTES \
- (SIZEOF_GREGS + SIZEOF_FPU_REGS + SIZEOF_FPU_CTRL_REGS + SIZEOF_SSE_REGS + 4)
-
-#undef REGISTER_NAME
-#define REGISTER_NAME(reg) i386_linux_register_name ((reg))
-extern char *i386_linux_register_name (int reg);
-
-#undef REGISTER_BYTE
-#define REGISTER_BYTE(reg) i386_linux_register_byte ((reg))
-extern int i386_linux_register_byte (int reg);
-
-#undef REGISTER_RAW_SIZE
-#define REGISTER_RAW_SIZE(reg) i386_linux_register_raw_size ((reg))
-extern int i386_linux_register_raw_size (int reg);
-
-/* GNU/Linux ELF uses stabs-in-ELF with the DWARF register numbering
- scheme by default, so we must redefine STAB_REG_TO_REGNUM. This
- messes up the floating-point registers for a.out, but there is not
- much we can do about that. */
-#undef STAB_REG_TO_REGNUM
-#define STAB_REG_TO_REGNUM(reg) i386_dwarf_reg_to_regnum ((reg))
-
-/* Use target_specific function to define link map offsets. */
-extern struct link_map_offsets *i386_linux_svr4_fetch_link_map_offsets (void);
-#define SVR4_FETCH_LINK_MAP_OFFSETS() i386_linux_svr4_fetch_link_map_offsets ()
+#include "config/tm-linux.h"
/* The following works around a problem with /usr/include/sys/procfs.h */
#define sys_quotactl 1
-/* When the i386 Linux kernel calls a signal handler, the return
- address points to a bit of code on the stack. These definitions
- are used to identify this bit of code as a signal trampoline in
- order to support backtracing through calls to signal handlers. */
-
-#define IN_SIGTRAMP(pc, name) i386_linux_in_sigtramp (pc, name)
-extern int i386_linux_in_sigtramp (CORE_ADDR, char *);
-
-#undef FRAME_CHAIN
-#define FRAME_CHAIN(frame) i386_linux_frame_chain (frame)
-extern CORE_ADDR i386_linux_frame_chain (struct frame_info *frame);
-
-#undef FRAME_SAVED_PC
-#define FRAME_SAVED_PC(frame) i386_linux_frame_saved_pc (frame)
-extern CORE_ADDR i386_linux_frame_saved_pc (struct frame_info *frame);
-
-#undef SAVED_PC_AFTER_CALL
-#define SAVED_PC_AFTER_CALL(frame) i386_linux_saved_pc_after_call (frame)
-extern CORE_ADDR i386_linux_saved_pc_after_call (struct frame_info *);
-
-#define TARGET_WRITE_PC(pc, ptid) i386_linux_write_pc (pc, ptid)
-extern void i386_linux_write_pc (CORE_ADDR pc, ptid_t ptid);
-
/* 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
@@ -110,22 +47,5 @@ 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
-
-
-/* Support for longjmp. */
-
-/* Details about jmp_buf. It's supposed to be an array of integers. */
-
-#define JB_ELEMENT_SIZE 4 /* Size of elements in jmp_buf. */
-#define JB_PC 5 /* Array index of saved PC. */
-
-/* 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) get_longjmp_target (addr)
-extern int get_longjmp_target (CORE_ADDR *addr);
#endif /* #ifndef TM_LINUX_H */
diff --git a/gdb/config/i386/tm-nbsd.h b/gdb/config/i386/tm-nbsd.h
index 8f1295efe6e..55ef6fa56fc 100644
--- a/gdb/config/i386/tm-nbsd.h
+++ b/gdb/config/i386/tm-nbsd.h
@@ -25,46 +25,17 @@
#define HAVE_SSE_REGS
#include "i386/tm-i386.h"
-#include "config/tm-nbsd.h"
-
-extern use_struct_convention_fn i386nbsd_aout_use_struct_convention;
-#define USE_STRUCT_CONVENTION(gcc_p, type) \
- i386nbsd_aout_use_struct_convention(gcc_p, type)
-
-
-#define JB_ELEMENT_SIZE sizeof(int) /* jmp_buf[_JBLEN] is array of ints */
-#define JB_PC 0 /* Setjmp()'s return PC saved here */
-
-/* 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 */
-
-extern int get_longjmp_target (CORE_ADDR *);
-
-#define GET_LONGJMP_TARGET(ADDR) get_longjmp_target(ADDR)
-
-
-/* Support for signal handlers. */
-
-#define IN_SIGTRAMP(pc, name) i386bsd_in_sigtramp (pc, name)
-extern int i386bsd_in_sigtramp (CORE_ADDR pc, char *name);
/* These defines allow the recognition of sigtramps as a function name
<sigtramp>.
- FIXME: kettenis/2001-07-13: These should be added to the target
- vector and turned into functions when we go "multi-arch". */
-
-#define SIGTRAMP_START(pc) i386bsd_sigtramp_start
-#define SIGTRAMP_END(pc) i386bsd_sigtramp_end
-extern CORE_ADDR i386bsd_sigtramp_start;
-extern CORE_ADDR i386bsd_sigtramp_end;
-
-/* Override FRAME_SAVED_PC to enable the recognition of signal handlers. */
+ FIXME: kettenis/2002-05-12: Of course these defines will have to go
+ if we go truly "multi-arch", but I don't know yet how to get rid of
+ them. */
-#undef FRAME_SAVED_PC
-#define FRAME_SAVED_PC(frame) i386bsd_frame_saved_pc (frame)
-extern CORE_ADDR i386bsd_frame_saved_pc (struct frame_info *frame);
+#define SIGTRAMP_START(pc) i386bsd_sigtramp_start (pc)
+#define SIGTRAMP_END(pc) i386bsd_sigtramp_end (pc)
+extern CORE_ADDR i386bsd_sigtramp_start (CORE_ADDR pc);
+extern CORE_ADDR i386bsd_sigtramp_end (CORE_ADDR pc);
#endif /* TM_NBSD_H */
diff --git a/gdb/config/tm-nbsd.h b/gdb/config/i386/tm-nbsdaout.h
index d002d6bb2b5..8dde114cf82 100644
--- a/gdb/config/tm-nbsd.h
+++ b/gdb/config/i386/tm-nbsdaout.h
@@ -1,6 +1,5 @@
-/* Target machine sub-description for NetBSD.
- This is included by other tm-*.h files to specify NetBSD-specific stuff.
- Copyright 1993, 1994 Free Software Foundation, Inc.
+/* Macro definitions for i386 running under NetBSD.
+ Copyright 2000, 2002 Free Software Foundation, Inc.
This file is part of GDB.
@@ -19,11 +18,13 @@
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#ifndef SVR4_SHARED_LIBS
+#ifndef TM_NBSDAOUT_H
+#define TM_NBSDAOUT_H
-/* Return non-zero if we are in a shared library trampoline code stub. */
+#include "i386/tm-nbsd.h"
+/* Return non-zero if we are in a shared library trampoline code stub. */
#define IN_SOLIB_CALL_TRAMPOLINE(pc, name) \
(name && !strcmp(name, "_DYNAMIC"))
-#endif /* !SVR4_SHARED_LIBS */
+#endif /* TM_NBSDAOUT_H */
diff --git a/gdb/config/i386/tm-ptx.h b/gdb/config/i386/tm-ptx.h
index 2a1731a161c..ff0d56e6174 100644
--- a/gdb/config/i386/tm-ptx.h
+++ b/gdb/config/i386/tm-ptx.h
@@ -220,8 +220,8 @@ extern const struct floatformat floatformat_i387_ext; /* from floatformat.h */
a function return value of type TYPE, and copy that, in virtual format,
into VALBUF. */
-#undef EXTRACT_RETURN_VALUE
-#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
+#undef DEPRECATED_EXTRACT_RETURN_VALUE
+#define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
symmetry_extract_return_value(TYPE, REGBUF, VALBUF)
/*
diff --git a/gdb/config/i386/tm-ptx4.h b/gdb/config/i386/tm-ptx4.h
index 1f221ba8e2b..a13d4a63a7f 100644
--- a/gdb/config/i386/tm-ptx4.h
+++ b/gdb/config/i386/tm-ptx4.h
@@ -23,4 +23,4 @@
#define SEQUENT_PTX4
-#include "tm-ptx.h"
+#include "i386/tm-ptx.h"
diff --git a/gdb/config/i386/tm-symmetry.h b/gdb/config/i386/tm-symmetry.h
index 78281819dfa..e7a989b19c2 100644
--- a/gdb/config/i386/tm-symmetry.h
+++ b/gdb/config/i386/tm-symmetry.h
@@ -308,8 +308,8 @@ switch (regno) { \
a function return value of type TYPE, and copy that, in virtual format,
into VALBUF. */
-#undef EXTRACT_RETURN_VALUE
-#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
+#undef DEPRECATED_EXTRACT_RETURN_VALUE
+#define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
symmetry_extract_return_value(TYPE, REGBUF, VALBUF)
/* The following redefines make backtracing through sigtramp work.
diff --git a/gdb/config/i386/tm-vxworks.h b/gdb/config/i386/tm-vxworks.h
index 6434a6ea2f5..ffaea49306f 100644
--- a/gdb/config/i386/tm-vxworks.h
+++ b/gdb/config/i386/tm-vxworks.h
@@ -23,6 +23,6 @@
#define TM_VXWORKS_H
#include "i386/tm-i386v.h"
-#include "tm-vxworks.h"
+#include "config/tm-vxworks.h"
#endif /* ifndef TM_VXWORKS_H */
diff --git a/gdb/config/i386/x86-64linux.mt b/gdb/config/i386/x86-64linux.mt
index 85f1972531d..58a9cee1889 100644
--- a/gdb/config/i386/x86-64linux.mt
+++ b/gdb/config/i386/x86-64linux.mt
@@ -1,3 +1,3 @@
# Target: AMD x86-64 running GNU/Linux
-TDEPFILES= x86-64-tdep.o x86-64-linux-tdep.o i387-tdep.o dwarf2cfi.o \
+TDEPFILES= x86-64-tdep.o x86-64-linux-tdep.o dwarf2cfi.o \
solib.o solib-svr4.o solib-legacy.o
diff --git a/gdb/config/i386/xm-i386v4.h b/gdb/config/i386/xm-i386v4.h
index c3241100bf7..154986c1880 100644
--- a/gdb/config/i386/xm-i386v4.h
+++ b/gdb/config/i386/xm-i386v4.h
@@ -25,4 +25,4 @@
/* Pick up more stuff from the generic SVR4 host include file. */
-#include "xm-sysv4.h"
+#include "config/xm-sysv4.h"
diff --git a/gdb/config/i386/xm-nbsd.h b/gdb/config/i386/xm-nbsd.h
index 415d0fa4ffd..4a998cde4ee 100644
--- a/gdb/config/i386/xm-nbsd.h
+++ b/gdb/config/i386/xm-nbsd.h
@@ -19,6 +19,6 @@
Boston, MA 02111-1307, USA. */
/* Get generic NetBSD host definitions. */
-#include "xm-nbsd.h"
+#include "config/xm-nbsd.h"
#define HOST_LONG_DOUBLE_FORMAT &floatformat_i387_ext
diff --git a/gdb/config/i386/xm-ptx.h b/gdb/config/i386/xm-ptx.h
index 6dfb9d6d4e3..8987f297133 100644
--- a/gdb/config/i386/xm-ptx.h
+++ b/gdb/config/i386/xm-ptx.h
@@ -23,7 +23,7 @@
/* Symmetry version by Jay Vosburgh (fubar@sequent.com) */
#ifdef _SEQUENT_PTX4_
-#include "xm-sysv4.h"
+#include "config/xm-sysv4.h"
#endif /* _SEQUENT_PTX4_ */
/* This machine doesn't have the siginterrupt call. */
diff --git a/gdb/config/i386/xm-ptx4.h b/gdb/config/i386/xm-ptx4.h
index 2f466e62d70..605941315c9 100644
--- a/gdb/config/i386/xm-ptx4.h
+++ b/gdb/config/i386/xm-ptx4.h
@@ -22,6 +22,6 @@
/* Symmetry version by Jay Vosburgh (fubar@sequent.com) */
-#include "xm-sysv4.h"
+#include "config/xm-sysv4.h"
-#include "xm-ptx.h"
+#include "i386/xm-ptx.h"
diff --git a/gdb/config/i960/tm-i960.h b/gdb/config/i960/tm-i960.h
index a62e35da7e7..a0ae164a658 100644
--- a/gdb/config/i960/tm-i960.h
+++ b/gdb/config/i960/tm-i960.h
@@ -182,7 +182,7 @@ extern use_struct_convention_fn i960_use_struct_convention;
On the i960 we just take as many bytes as we need from G0 through G3. */
-#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
+#define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
memcpy(VALBUF, REGBUF+REGISTER_BYTE(G0_REGNUM), TYPE_LENGTH (TYPE))
/* If USE_STRUCT_CONVENTION produces a 1,
@@ -195,7 +195,7 @@ extern use_struct_convention_fn i960_use_struct_convention;
(..., 0) below is to make it appear to return a value, though
actually all it does is call error(). */
-#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \
+#define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \
(error("Don't know where large structure is returned on i960"), 0)
/* Write into appropriate registers a function return value
diff --git a/gdb/config/i960/tm-vx960.h b/gdb/config/i960/tm-vx960.h
index 16fc62ac6bb..a2e07cc7b0d 100644
--- a/gdb/config/i960/tm-vx960.h
+++ b/gdb/config/i960/tm-vx960.h
@@ -21,7 +21,7 @@
Boston, MA 02111-1307, USA. */
#include "i960/tm-i960.h"
-#include "tm-vxworks.h"
+#include "config/tm-vxworks.h"
/* Under VxWorks the IP isn't filled in. Skip it, go with RIP, which has
the real value. */
diff --git a/gdb/config/ia64/nm-aix.h b/gdb/config/ia64/nm-aix.h
index 3f6764c3027..8a2d66f7c28 100644
--- a/gdb/config/ia64/nm-aix.h
+++ b/gdb/config/ia64/nm-aix.h
@@ -21,7 +21,7 @@
#ifndef NM_AIX_H
#define NM_AIX_H
-#include "nm-sysv4.h"
+#include "config/nm-sysv4.h"
#ifndef AIX5
#define AIX5 1
diff --git a/gdb/config/ia64/nm-linux.h b/gdb/config/ia64/nm-linux.h
index 2c980c0ad9a..e00d561b6a3 100644
--- a/gdb/config/ia64/nm-linux.h
+++ b/gdb/config/ia64/nm-linux.h
@@ -22,7 +22,7 @@
#ifndef NM_LINUX_H
#define NM_LINUX_H
-#include "nm-linux.h"
+#include "config/nm-linux.h"
/* Note: It seems likely that we'll have to eventually define
FETCH_INFERIOR_REGISTERS. But until that time, we'll make do
diff --git a/gdb/config/ia64/tm-aix.h b/gdb/config/ia64/tm-aix.h
index 0160140c680..b59d6dd11cd 100644
--- a/gdb/config/ia64/tm-aix.h
+++ b/gdb/config/ia64/tm-aix.h
@@ -22,7 +22,7 @@
#define TM_AIX_H
#include "ia64/tm-ia64.h"
-#include "tm-sysv4.h"
+#include "config/tm-sysv4.h"
#define TARGET_ELF64
diff --git a/gdb/config/ia64/tm-linux.h b/gdb/config/ia64/tm-linux.h
index f716d83ae41..60517525467 100644
--- a/gdb/config/ia64/tm-linux.h
+++ b/gdb/config/ia64/tm-linux.h
@@ -24,7 +24,7 @@
#define IA64_GNULINUX_TARGET
#include "ia64/tm-ia64.h"
-#include "tm-linux.h"
+#include "config/tm-linux.h"
#define TARGET_ELF64
diff --git a/gdb/config/ia64/xm-aix.h b/gdb/config/ia64/xm-aix.h
index 6ca026d493f..ad717d5c01c 100644
--- a/gdb/config/ia64/xm-aix.h
+++ b/gdb/config/ia64/xm-aix.h
@@ -23,6 +23,6 @@
/* Pick up more stuff from the generic SVR4 host include file. */
-#include "xm-sysv4.h"
+#include "config/xm-sysv4.h"
#endif /* #ifndef XM_AIX_H */
diff --git a/gdb/config/m32r/tm-m32r.h b/gdb/config/m32r/tm-m32r.h
index 75bc7b231a6..9477478c26c 100644
--- a/gdb/config/m32r/tm-m32r.h
+++ b/gdb/config/m32r/tm-m32r.h
@@ -137,8 +137,8 @@ extern CORE_ADDR m32r_frame_saved_pc (struct frame_info *);
/* mvs_check FRAME_SAVED_PC */
#define FRAME_SAVED_PC(fi) m32r_frame_saved_pc (fi)
-/* mvs_check EXTRACT_RETURN_VALUE */
-#define EXTRACT_RETURN_VALUE(TYPE, REGBUF, VALBUF) \
+/* mvs_check DEPRECATED_EXTRACT_RETURN_VALUE */
+#define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE, REGBUF, VALBUF) \
memcpy ((VALBUF), \
(char *)(REGBUF) + REGISTER_BYTE (V0_REGNUM) + \
((TYPE_LENGTH (TYPE) > 4 ? 8 : 4) - TYPE_LENGTH (TYPE)), \
@@ -181,7 +181,7 @@ extern void m32r_write_sp (CORE_ADDR val);
extern use_struct_convention_fn m32r_use_struct_convention;
#define USE_STRUCT_CONVENTION(GCC_P, TYPE) m32r_use_struct_convention (GCC_P, TYPE)
-#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \
+#define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \
extract_address (REGBUF + REGISTER_BYTE (V0_REGNUM), \
REGISTER_RAW_SIZE (V0_REGNUM))
diff --git a/gdb/config/m68k/nbsd.mh b/gdb/config/m68k/nbsdaout.mh
index 30c800abd9a..7ce279b332e 100644
--- a/gdb/config/m68k/nbsd.mh
+++ b/gdb/config/m68k/nbsdaout.mh
@@ -2,4 +2,4 @@
NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o m68knbsd-nat.o \
solib.o solib-sunos.o
XM_FILE= xm-nbsd.h
-NAT_FILE= nm-nbsd.h
+NAT_FILE= nm-nbsdaout.h
diff --git a/gdb/config/m68k/nbsd.mt b/gdb/config/m68k/nbsdaout.mt
index b6ac5a000e1..b6ac5a000e1 100644
--- a/gdb/config/m68k/nbsd.mt
+++ b/gdb/config/m68k/nbsdaout.mt
diff --git a/gdb/config/m68k/nm-linux.h b/gdb/config/m68k/nm-linux.h
index 5c37af9ca12..26aa19768ad 100644
--- a/gdb/config/m68k/nm-linux.h
+++ b/gdb/config/m68k/nm-linux.h
@@ -21,7 +21,7 @@
#ifndef NM_LINUX_H
#define NM_LINUX_H
-#include "nm-linux.h"
+#include "config/nm-linux.h"
/* Return sizeof user struct to callers in less machine dependent routines */
diff --git a/gdb/config/m68k/nm-m68klynx.h b/gdb/config/m68k/nm-m68klynx.h
index 49114fc4df9..9d95d3728dd 100644
--- a/gdb/config/m68k/nm-m68klynx.h
+++ b/gdb/config/m68k/nm-m68klynx.h
@@ -21,6 +21,6 @@
#ifndef NM_M68KLYNX_H
#define NM_M68KLYNX_H
-#include "nm-lynx.h"
+#include "config/nm-lynx.h"
#endif /* NM_M68KLYNX_H */
diff --git a/gdb/config/m68k/nm-nbsd.h b/gdb/config/m68k/nm-nbsd.h
index b73b0ef71e5..72c98895a78 100644
--- a/gdb/config/m68k/nm-nbsd.h
+++ b/gdb/config/m68k/nm-nbsd.h
@@ -18,5 +18,10 @@
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
+#ifndef NM_NBSD_H
+#define NM_NBSD_H
+
/* Get generic NetBSD native definitions. */
-#include "nm-nbsd.h"
+#include "config/nm-nbsd.h"
+
+#endif /* NM_NBSD_H */
diff --git a/gdb/config/m68k/nm-nbsdaout.h b/gdb/config/m68k/nm-nbsdaout.h
new file mode 100644
index 00000000000..cb755f0bed2
--- /dev/null
+++ b/gdb/config/m68k/nm-nbsdaout.h
@@ -0,0 +1,29 @@
+/* Native-dependent definitions for Motorola m68k running NetBSD, for GDB.
+ Copyright 1996, 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 NM_NBSDAOUT_H
+#define NM_NBSDAOUT_H
+
+#include "m68k/nm-nbsd.h"
+
+/* Get generic NetBSD a.out native definitions. */
+#include "config/nm-nbsdaout.h"
+
+#endif /* NM_NBSDAOUT_H */
diff --git a/gdb/config/m68k/nm-sysv4.h b/gdb/config/m68k/nm-sysv4.h
index a7d0bdd3bda..b9cb591f389 100644
--- a/gdb/config/m68k/nm-sysv4.h
+++ b/gdb/config/m68k/nm-sysv4.h
@@ -20,4 +20,4 @@
/* Include the generic SVR4 definitions. */
-#include "nm-sysv4.h"
+#include "config/nm-sysv4.h"
diff --git a/gdb/config/m68k/tm-delta68.h b/gdb/config/m68k/tm-delta68.h
index a38baea2020..7697bc41321 100644
--- a/gdb/config/m68k/tm-delta68.h
+++ b/gdb/config/m68k/tm-delta68.h
@@ -45,7 +45,7 @@
/* When it returns a float/double value, use fp0 in sysV68. */
/* When it returns a pointer value, use a0 in sysV68. */
-#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
+#define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
if (TYPE_CODE (TYPE) == TYPE_CODE_FLT) \
REGISTER_CONVERT_TO_VIRTUAL (FP0_REGNUM, TYPE, \
&REGBUF[REGISTER_BYTE (FP0_REGNUM)], \
@@ -91,8 +91,8 @@ extern int delta68_frame_num_args (struct frame_info *fi);
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 EXTRACT_STRUCT_VALUE_ADDRESS
-#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF)\
+#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);
diff --git a/gdb/config/m68k/tm-linux.h b/gdb/config/m68k/tm-linux.h
index 94b2c2c3504..8a7d3a5b46c 100644
--- a/gdb/config/m68k/tm-linux.h
+++ b/gdb/config/m68k/tm-linux.h
@@ -36,7 +36,7 @@
function return value of type TYPE, and copy that, in virtual
format, into VALBUF. */
-#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
+#define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
{ \
if (TYPE_CODE (TYPE) == TYPE_CODE_FLT) \
{ \
@@ -76,15 +76,15 @@
} \
}
-#include "tm-linux.h"
+#include "config/tm-linux.h"
#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 EXTRACT_STRUCT_VALUE_ADDRESS
-#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \
+#undef DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS
+#define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \
(*(CORE_ADDR *)((char *) (REGBUF) + REGISTER_BYTE (A0_REGNUM)))
/* Offsets (in target ints) into jmp_buf. */
diff --git a/gdb/config/m68k/tm-m68k.h b/gdb/config/m68k/tm-m68k.h
index 5b23df0a0be..40bd25aa626 100644
--- a/gdb/config/m68k/tm-m68k.h
+++ b/gdb/config/m68k/tm-m68k.h
@@ -201,8 +201,8 @@ extern void m68k_find_saved_regs (struct frame_info *,
into VALBUF. This is assuming that floating point values are returned
as doubles in d0/d1. */
-#if !defined (EXTRACT_RETURN_VALUE)
-#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
+#if !defined (DEPRECATED_EXTRACT_RETURN_VALUE)
+#define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
memcpy ((VALBUF), \
(char *)(REGBUF) + \
(TYPE_LENGTH(TYPE) >= 4 ? 0 : 4 - TYPE_LENGTH(TYPE)), \
@@ -222,7 +222,7 @@ extern void m68k_find_saved_regs (struct frame_info *,
the address in which a function should return its structure value,
as a CORE_ADDR (or an expression that can be used as one). */
-#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) (*(CORE_ADDR *)(REGBUF))
+#define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) (*(CORE_ADDR *)(REGBUF))
/* Describe the pointer in each stack frame to the previous stack frame
(its caller). */
diff --git a/gdb/config/m68k/tm-m68klynx.h b/gdb/config/m68k/tm-m68klynx.h
index cfc462f54a4..ed1f6f0f05e 100644
--- a/gdb/config/m68k/tm-m68klynx.h
+++ b/gdb/config/m68k/tm-m68klynx.h
@@ -21,7 +21,7 @@
#ifndef TM_M68KLYNX_H
#define TM_M68KLYNX_H
-#include "tm-lynx.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. */
diff --git a/gdb/config/m68k/tm-m68kv4.h b/gdb/config/m68k/tm-m68kv4.h
index 18bf5a2187a..275ab62dd98 100644
--- a/gdb/config/m68k/tm-m68kv4.h
+++ b/gdb/config/m68k/tm-m68kv4.h
@@ -34,7 +34,7 @@
#define FRAME_CHAIN_VALID(fp,fi) func_frame_chain_valid (fp, fi)
-#include "tm-sysv4.h"
+#include "config/tm-sysv4.h"
#include "m68k/tm-m68k.h"
/* Offsets (in target ints) into jmp_buf. Not defined in any system header
diff --git a/gdb/config/m68k/tm-nbsd.h b/gdb/config/m68k/tm-nbsd.h
index 354632a32f5..62f008c7249 100644
--- a/gdb/config/m68k/tm-nbsd.h
+++ b/gdb/config/m68k/tm-nbsd.h
@@ -37,7 +37,10 @@
#define SIGTRAMP_END(pc) (STACK_END_ADDR)
#include "m68k/tm-m68k.h"
-#include "tm-nbsd.h"
+
+/* Return non-zero if we are in a shared library trampoline code stub. */
+#define IN_SOLIB_CALL_TRAMPOLINE(pc, name) \
+ (name && !strcmp(name, "_DYNAMIC"))
extern use_struct_convention_fn m68knbsd_use_struct_convention;
#define USE_STRUCT_CONVENTION(gcc_p, type) \
diff --git a/gdb/config/m68k/tm-sun2os4.h b/gdb/config/m68k/tm-sun2os4.h
index 496c32955b3..d5fe5315267 100644
--- a/gdb/config/m68k/tm-sun2os4.h
+++ b/gdb/config/m68k/tm-sun2os4.h
@@ -18,4 +18,4 @@
Boston, MA 02111-1307, USA. */
#include "m68k/tm-sun2.h"
-#include "tm-sunos.h"
+#include "config/tm-sunos.h"
diff --git a/gdb/config/m68k/tm-sun3os4.h b/gdb/config/m68k/tm-sun3os4.h
index d4bc74fd8e7..ced43761b38 100644
--- a/gdb/config/m68k/tm-sun3os4.h
+++ b/gdb/config/m68k/tm-sun3os4.h
@@ -19,4 +19,4 @@
Boston, MA 02111-1307, USA. */
#include "m68k/tm-sun3.h"
-#include "tm-sunos.h"
+#include "config/tm-sunos.h"
diff --git a/gdb/config/m68k/tm-vx68.h b/gdb/config/m68k/tm-vx68.h
index 988b4bb4b9e..ea27ac45d02 100644
--- a/gdb/config/m68k/tm-vx68.h
+++ b/gdb/config/m68k/tm-vx68.h
@@ -30,7 +30,7 @@
#define DECR_PC_AFTER_BREAK 0
#include "m68k/tm-m68k.h"
-#include "tm-vxworks.h"
+#include "config/tm-vxworks.h"
/* Takes the current frame-struct pointer and returns the chain-pointer
to get to the calling frame.
diff --git a/gdb/config/m68k/xm-m68kv4.h b/gdb/config/m68k/xm-m68kv4.h
index 11679a965eb..542cd106814 100644
--- a/gdb/config/m68k/xm-m68kv4.h
+++ b/gdb/config/m68k/xm-m68kv4.h
@@ -26,4 +26,4 @@
/* Pick up more stuff from the generic SVR4 host include file. */
-#include "xm-sysv4.h"
+#include "config/xm-sysv4.h"
diff --git a/gdb/config/m68k/xm-nbsd.h b/gdb/config/m68k/xm-nbsd.h
index c266a99e628..6c735fa1a8c 100644
--- a/gdb/config/m68k/xm-nbsd.h
+++ b/gdb/config/m68k/xm-nbsd.h
@@ -19,4 +19,4 @@
Boston, MA 02111-1307, USA. */
/* Get generic NetBSD host definitions. */
-#include "xm-nbsd.h"
+#include "config/xm-nbsd.h"
diff --git a/gdb/config/m88k/nm-delta88v4.h b/gdb/config/m88k/nm-delta88v4.h
index 90ee391b2b6..97f75f2c981 100644
--- a/gdb/config/m88k/nm-delta88v4.h
+++ b/gdb/config/m88k/nm-delta88v4.h
@@ -20,4 +20,4 @@
Boston, MA 02111-1307, USA. */
#include "m88k/nm-m88k.h"
-#include "nm-sysv4.h"
+#include "config/nm-sysv4.h"
diff --git a/gdb/config/m88k/tm-delta88v4.h b/gdb/config/m88k/tm-delta88v4.h
index 35a605d3536..44e488fb18f 100644
--- a/gdb/config/m88k/tm-delta88v4.h
+++ b/gdb/config/m88k/tm-delta88v4.h
@@ -22,7 +22,7 @@
#define DELTA88
#include "m88k/tm-m88k.h"
-#include "tm-sysv4.h"
+#include "config/tm-sysv4.h"
/* If we don't define this, backtraces go on forever. */
#define FRAME_CHAIN_VALID(fp,fi) func_frame_chain_valid (fp, fi)
diff --git a/gdb/config/m88k/tm-m88k.h b/gdb/config/m88k/tm-m88k.h
index 7405c1294f1..22e069db925 100644
--- a/gdb/config/m88k/tm-m88k.h
+++ b/gdb/config/m88k/tm-m88k.h
@@ -385,10 +385,10 @@ struct type *m88k_register_type (int regnum);
/* The 88k call/return conventions call for "small" values to be returned
into consecutive registers starting from r2. */
-#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
+#define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
memcpy ((VALBUF), &(((char *)REGBUF)[REGISTER_BYTE(RV_REGNUM)]), TYPE_LENGTH (TYPE))
-#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) (*(int *)(REGBUF))
+#define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) (*(int *)(REGBUF))
/* Write into appropriate registers a function return value
of type TYPE, given in virtual format. */
diff --git a/gdb/config/m88k/xm-delta88v4.h b/gdb/config/m88k/xm-delta88v4.h
index b09a02dd335..932b9022a89 100644
--- a/gdb/config/m88k/xm-delta88v4.h
+++ b/gdb/config/m88k/xm-delta88v4.h
@@ -19,4 +19,4 @@
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#include "xm-sysv4.h"
+#include "config/xm-sysv4.h"
diff --git a/gdb/config/mcore/tm-mcore.h b/gdb/config/mcore/tm-mcore.h
index 1da21b76e64..9806708e14e 100644
--- a/gdb/config/mcore/tm-mcore.h
+++ b/gdb/config/mcore/tm-mcore.h
@@ -94,13 +94,13 @@ extern void mcore_store_return_value (struct type *type, char *valbuf);
#define STORE_RETURN_VALUE(TYPE, VALBUF) mcore_store_return_value ((TYPE), (VALBUF))
extern void mcore_extract_return_value (struct type *type, char *regbut, char *valbuf);
-#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
+#define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
mcore_extract_return_value ((TYPE), (REGBUF), (VALBUF));
#define STORE_STRUCT_RETURN(ADDR, SP) /* handled by mcore_push_arguments */
extern CORE_ADDR mcore_extract_struct_value_address (char *regbuf);
-#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \
+#define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \
mcore_extract_struct_value_address (REGBUF)
extern CORE_ADDR mcore_skip_prologue (CORE_ADDR pc);
diff --git a/gdb/config/mips/nbsd.mh b/gdb/config/mips/nbsd.mh
new file mode 100644
index 00000000000..4556fc60b27
--- /dev/null
+++ b/gdb/config/mips/nbsd.mh
@@ -0,0 +1,4 @@
+# Host: MIPS running NetBSD
+NAT_CLIBS=
+NATDEPFILES= infptrace.o inftarg.o fork-child.o mipsnbsd-nat.o
+NAT_FILE= nm-nbsd.h
diff --git a/gdb/config/mips/nbsd.mt b/gdb/config/mips/nbsd.mt
new file mode 100644
index 00000000000..de529166c56
--- /dev/null
+++ b/gdb/config/mips/nbsd.mt
@@ -0,0 +1,6 @@
+# Target: MIPS running NetBSD
+TDEPFILES= mips-tdep.o mipsnbsd-tdep.o corelow.o solib.o solib-svr4.o
+TM_FILE= tm-nbsd.h
+
+SIM_OBS = remote-sim.o
+SIM = ../sim/mips/libsim.a
diff --git a/gdb/config/mips/nm-irix5.h b/gdb/config/mips/nm-irix5.h
index bed3144530d..8e31b592811 100644
--- a/gdb/config/mips/nm-irix5.h
+++ b/gdb/config/mips/nm-irix5.h
@@ -19,7 +19,7 @@
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#include "nm-sysv4.h"
+#include "config/nm-sysv4.h"
#undef IN_SOLIB_DYNSYM_RESOLVE_CODE
#define TARGET_HAS_HARDWARE_WATCHPOINTS
diff --git a/gdb/config/mips/nm-linux.h b/gdb/config/mips/nm-linux.h
index c43ecd68393..426dd5523b6 100644
--- a/gdb/config/mips/nm-linux.h
+++ b/gdb/config/mips/nm-linux.h
@@ -24,7 +24,7 @@
#define MIPS_GNULINUX_TARGET
-#include "nm-linux.h"
+#include "config/nm-linux.h"
/* Return sizeof user struct to callers in less machine dependent
routines. Hard coded for cross-compilation friendliness. */
diff --git a/gdb/config/mips/nm-nbsd.h b/gdb/config/mips/nm-nbsd.h
new file mode 100644
index 00000000000..67628c2fa97
--- /dev/null
+++ b/gdb/config/mips/nm-nbsd.h
@@ -0,0 +1,28 @@
+/* Native-dependent definitions for NetBSD/mips.
+ Copyright 2002 Free Software Foundation, Inc.
+ Contributed by Wasabi Systems, 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_NBSD_H
+#define NM_NBSD_H
+
+/* Get generic NetBSD native definitions. */
+#include "config/nm-nbsd.h"
+
+#endif /* NM_NBSD_H */
diff --git a/gdb/config/mips/tm-irix5.h b/gdb/config/mips/tm-irix5.h
index 49b842fb7f1..1a88de04b8d 100644
--- a/gdb/config/mips/tm-irix5.h
+++ b/gdb/config/mips/tm-irix5.h
@@ -48,18 +48,6 @@
: ((N) >= 70 && (N) <= 89) ? builtin_type_uint32 \
: builtin_type_int)
-#undef MIPS_LAST_ARG_REGNUM
-#define MIPS_LAST_ARG_REGNUM 11 /* N32 uses R4 through R11 for args */
-
-/* MIPS_STACK_ARGSIZE -- how many bytes does a pushed function arg take
- up on the stack? For the n32 ABI, eight bytes are reserved for each
- register. Like MIPS_SAVED_REGSIZE but different. */
-#define MIPS_DEFAULT_STACK_ARGSIZE 8
-
-/* N32 does not reserve home space for registers used to carry
- parameters. */
-#define MIPS_REGS_HAVE_HOME_P 0
-
/* Force N32 ABI as the default. */
#define MIPS_DEFAULT_ABI MIPS_ABI_N32
diff --git a/gdb/config/mips/tm-irix6.h b/gdb/config/mips/tm-irix6.h
index 2d90b2ef998..70b5f6fb7fc 100644
--- a/gdb/config/mips/tm-irix6.h
+++ b/gdb/config/mips/tm-irix6.h
@@ -95,18 +95,6 @@
: ((N) >= 70 && (N) <= 89) ? builtin_type_uint32 \
: builtin_type_int)
-#undef MIPS_LAST_ARG_REGNUM
-#define MIPS_LAST_ARG_REGNUM 11 /* N32 uses R4 through R11 for args */
-
-/* MIPS_STACK_ARGSIZE -- how many bytes does a pushed function arg take
- up on the stack? For the n32 ABI, eight bytes are reserved for each
- register. Like MIPS_SAVED_REGSIZE but different. */
-#define MIPS_DEFAULT_STACK_ARGSIZE 8
-
-/* N32 does not reserve home space for registers used to carry
- parameters. */
-#define MIPS_REGS_HAVE_HOME_P 0
-
/* Force N32 ABI as the default. */
#define MIPS_DEFAULT_ABI MIPS_ABI_N32
diff --git a/gdb/config/mips/tm-linux.h b/gdb/config/mips/tm-linux.h
index 0e9de3cbb26..4236ea8bec4 100644
--- a/gdb/config/mips/tm-linux.h
+++ b/gdb/config/mips/tm-linux.h
@@ -36,7 +36,7 @@
#define REALTIME_LO 32
#define REALTIME_HI 128
-#include "tm-linux.h"
+#include "config/tm-linux.h"
/* There's an E_MIPS_ABI_O32 flag in e_flags, but we don't use it - in
fact, using it may violate the o32 ABI. */
diff --git a/gdb/config/mips/tm-mips.h b/gdb/config/mips/tm-mips.h
index 8403ef87153..f573e96fd58 100644
--- a/gdb/config/mips/tm-mips.h
+++ b/gdb/config/mips/tm-mips.h
@@ -38,10 +38,6 @@ struct value;
#include "coff/sym.h" /* Needed for PDR below. */
#include "coff/symconst.h"
-#if !defined (MIPS_EABI)
-#define MIPS_EABI 0
-#endif
-
/* PC should be masked to remove possible MIPS16 flag */
#if !defined (GDB_TARGET_MASK_DISAS_PC)
#define GDB_TARGET_MASK_DISAS_PC(addr) UNMAKE_MIPS16_ADDR(addr)
@@ -130,11 +126,6 @@ extern char *mips_register_name (int regnr);
#define ZERO_REGNUM 0 /* read-only register, always 0 */
#define V0_REGNUM 2 /* Function integer return value */
#define A0_REGNUM 4 /* Loc of first arg during a subr call */
-#if MIPS_EABI
-#define MIPS_LAST_ARG_REGNUM 11 /* EABI uses R4 through R11 for args */
-#else
-#define MIPS_LAST_ARG_REGNUM 7 /* old ABI uses R4 through R7 for args */
-#endif
#define T9_REGNUM 25 /* Contains address of callee in PIC */
#define SP_REGNUM 29 /* Contains address of top of stack */
#define RA_REGNUM 31 /* Contains return address value */
@@ -146,11 +137,6 @@ extern char *mips_register_name (int regnr);
#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 */
-#if MIPS_EABI /* EABI uses F12 through F19 for args */
-#define MIPS_LAST_FP_ARG_REGNUM (FP0_REGNUM+19)
-#else /* old ABI uses F12 through F15 for args */
-#define MIPS_LAST_FP_ARG_REGNUM (FP0_REGNUM+15)
-#endif
#define FCRCS_REGNUM 70 /* FP control/status */
#define FCRIR_REGNUM 71 /* FP implementation/revision */
#define FP_REGNUM 72 /* Pseudo register that contains true address of executing stack frame */
@@ -256,7 +242,7 @@ void mips_register_convert_to_raw (struct type *virtual_type, int reg_nr,
a function return value of type TYPE, and copy that, in virtual format,
into VALBUF. XXX floats */
-#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
+#define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
mips_extract_return_value(TYPE, REGBUF, VALBUF)
extern void mips_extract_return_value (struct type *, char[], char *);
@@ -275,7 +261,7 @@ extern void mips_store_return_value (struct type *, char *);
convention is specified by the System V ABI, so I think we can rely
on it. */
-#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \
+#define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \
(extract_address (REGBUF + REGISTER_BYTE (V0_REGNUM), \
REGISTER_RAW_SIZE (V0_REGNUM)))
diff --git a/gdb/config/mips/tm-mips64.h b/gdb/config/mips/tm-mips64.h
index 510ad05c0bc..13e62d2acf3 100644
--- a/gdb/config/mips/tm-mips64.h
+++ b/gdb/config/mips/tm-mips64.h
@@ -34,4 +34,4 @@
#define OP_LDGPR 067 /* ld */
/* Get the basic MIPS definitions. */
-#include "tm-mips.h"
+#include "mips/tm-mips.h"
diff --git a/gdb/config/mips/tm-mipsm3.h b/gdb/config/mips/tm-mipsm3.h
index 19ae028c604..9e2f4901d7a 100644
--- a/gdb/config/mips/tm-mipsm3.h
+++ b/gdb/config/mips/tm-mipsm3.h
@@ -25,7 +25,7 @@
*/
/* Include common definitions for Mach3 systems */
-#include "nm-m3.h"
+#include "config/nm-m3.h"
/* Define offsets to access CPROC stack when it does not have
* a kernel thread.
diff --git a/gdb/config/mips/tm-mipsv4.h b/gdb/config/mips/tm-mipsv4.h
index d1cc21ca1e8..3a362f05a3a 100644
--- a/gdb/config/mips/tm-mipsv4.h
+++ b/gdb/config/mips/tm-mipsv4.h
@@ -19,7 +19,7 @@
Boston, MA 02111-1307, USA. */
#include "mips/tm-bigmips.h"
-#include "tm-sysv4.h"
+#include "config/tm-sysv4.h"
/* The signal handler trampoline is called _sigtramp. */
#undef IN_SIGTRAMP
diff --git a/gdb/config/mips/tm-nbsd.h b/gdb/config/mips/tm-nbsd.h
new file mode 100644
index 00000000000..fc7448665e1
--- /dev/null
+++ b/gdb/config/mips/tm-nbsd.h
@@ -0,0 +1,45 @@
+/* Target-dependent definitions for NetBSD/mips.
+ Copyright 2002 Free Software Foundation, Inc.
+ Contributed by Wasabi Systems, 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_NBSD_H
+#define TM_NBSD_H
+
+/* Saved Pc. Get it from sigcontext if within sigtramp. */
+#define SIGCONTEXT_PC_OFFSET 8
+
+#include "mips/tm-mips.h"
+#include "solib.h"
+
+/* There's an E_MIPS_ABI_O32 flag in e_flags, but we don't use it - in
+ fact, using it may violate the o32 ABI. */
+
+#define MIPS_DEFAULT_ABI MIPS_ABI_O32
+
+/* We don't want to inherit tm-mips.h's shared library trampoline code. */
+#undef IN_SOLIB_CALL_TRAMPOLINE
+#undef IN_SOLIB_RETURN_TRAMPOLINE
+#undef SKIP_TRAMPOLINE_CODE
+#undef IGNORE_HELPER_CALL
+
+/* XXX undef a bunch of stuff we want to use multi-arch */
+#undef IN_SIGTRAMP
+
+#endif /* TM_NBSD_H */
diff --git a/gdb/config/mips/tm-vxmips.h b/gdb/config/mips/tm-vxmips.h
index e4ef2b6a2bd..5475fb57259 100644
--- a/gdb/config/mips/tm-vxmips.h
+++ b/gdb/config/mips/tm-vxmips.h
@@ -20,7 +20,7 @@
Boston, MA 02111-1307, USA. */
#include "mips/tm-mips.h"
-#include "tm-vxworks.h"
+#include "config/tm-vxworks.h"
/* FIXME: These are almost certainly wrong. */
diff --git a/gdb/config/mips/xm-irix5.h b/gdb/config/mips/xm-irix5.h
index 78c3a071e10..7d61ff059cc 100644
--- a/gdb/config/mips/xm-irix5.h
+++ b/gdb/config/mips/xm-irix5.h
@@ -19,7 +19,7 @@
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#include "xm-sysv4.h"
+#include "config/xm-sysv4.h"
/* Override register locations in upage for SGI machines */
#undef REGISTER_U_ADDR
diff --git a/gdb/config/mips/xm-mipsv4.h b/gdb/config/mips/xm-mipsv4.h
index 76fa5da19db..eccb2964d05 100644
--- a/gdb/config/mips/xm-mipsv4.h
+++ b/gdb/config/mips/xm-mipsv4.h
@@ -19,4 +19,4 @@
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#include "xm-sysv4.h"
+#include "config/xm-sysv4.h"
diff --git a/gdb/config/mn10200/tm-mn10200.h b/gdb/config/mn10200/tm-mn10200.h
index 4402b78ba79..7f961301c0d 100644
--- a/gdb/config/mn10200/tm-mn10200.h
+++ b/gdb/config/mn10200/tm-mn10200.h
@@ -125,7 +125,7 @@ extern CORE_ADDR mn10200_frame_saved_pc (struct frame_info *);
a function return value of type TYPE, and copy that, in virtual format,
into VALBUF. */
-#define EXTRACT_RETURN_VALUE(TYPE, REGBUF, VALBUF) \
+#define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE, REGBUF, VALBUF) \
{ \
if (TYPE_LENGTH (TYPE) > 8) \
internal_error (__FILE__, __LINE__, "failed internal consistency check"); \
@@ -144,7 +144,7 @@ extern CORE_ADDR mn10200_frame_saved_pc (struct frame_info *);
} \
}
-#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \
+#define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \
extract_address (REGBUF + REGISTER_BYTE (4), \
REGISTER_RAW_SIZE (4))
diff --git a/gdb/config/nm-nbsd.h b/gdb/config/nm-nbsd.h
index 402f606fd26..5078c567968 100644
--- a/gdb/config/nm-nbsd.h
+++ b/gdb/config/nm-nbsd.h
@@ -25,63 +25,3 @@
#define ATTACH_DETACH
#include "solib.h" /* Support for shared libraries. */
-#if defined (SVR4_SHARED_LIBS)
-#include "elf/common.h" /* Additional ELF shared library info. */
-#endif
-
-#if !defined (SVR4_SHARED_LIBS)
-
-/* make structure definitions match up with those expected in solib.c */
-#define link_object sod
-#define lo_name sod_name
-#define lo_library sod_library
-#define lo_unused sod_reserved
-#define lo_major sod_major
-#define lo_minor sod_minor
-#define lo_next sod_next
-
-#define link_map so_map
-#define lm_addr som_addr
-#define lm_name som_path
-#define lm_next som_next
-#define lm_lop som_sod
-#define lm_lob som_sodbase
-#define lm_rwt som_write
-#define lm_ld som_dynamic
-#define lm_lpd som_spd
-
-#define link_dynamic_2 section_dispatch_table
-#define ld_loaded sdt_loaded
-#define ld_need sdt_sods
-#define ld_rules sdt_filler1
-#define ld_got sdt_got
-#define ld_plt sdt_plt
-#define ld_rel sdt_rel
-#define ld_hash sdt_hash
-#define ld_stab sdt_nzlist
-#define ld_stab_hash sdt_filler2
-#define ld_buckets sdt_buckets
-#define ld_symbols sdt_strings
-#define ld_symb_size sdt_str_sz
-#define ld_text sdt_text_sz
-#define ld_plt_sz sdt_plt_sz
-
-#define rtc_symb rt_symbol
-#define rtc_sp rt_sp
-#define rtc_next rt_next
-
-#define ld_debug so_debug
-#define ldd_version dd_version
-#define ldd_in_debugger dd_in_debugger
-#define ldd_sym_loaded dd_sym_loaded
-#define ldd_bp_addr dd_bpt_addr
-#define ldd_bp_inst dd_bpt_shadow
-#define ldd_cp dd_cc
-
-#define link_dynamic _dynamic
-#define ld_version d_version
-#define ldd d_debug
-#define ld_un d_un
-#define ld_2 d_sdt
-
-#endif
diff --git a/gdb/config/nm-nbsdaout.h b/gdb/config/nm-nbsdaout.h
new file mode 100644
index 00000000000..026f1ed8d50
--- /dev/null
+++ b/gdb/config/nm-nbsdaout.h
@@ -0,0 +1,72 @@
+/* Native-dependent definitions for NetBSD a.out.
+ Copyright 1994, 1996, 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. */
+
+/* make structure definitions match up with those expected in solib.c */
+#define link_object sod
+#define lo_name sod_name
+#define lo_library sod_library
+#define lo_unused sod_reserved
+#define lo_major sod_major
+#define lo_minor sod_minor
+#define lo_next sod_next
+
+#define link_map so_map
+#define lm_addr som_addr
+#define lm_name som_path
+#define lm_next som_next
+#define lm_lop som_sod
+#define lm_lob som_sodbase
+#define lm_rwt som_write
+#define lm_ld som_dynamic
+#define lm_lpd som_spd
+
+#define link_dynamic_2 section_dispatch_table
+#define ld_loaded sdt_loaded
+#define ld_need sdt_sods
+#define ld_rules sdt_filler1
+#define ld_got sdt_got
+#define ld_plt sdt_plt
+#define ld_rel sdt_rel
+#define ld_hash sdt_hash
+#define ld_stab sdt_nzlist
+#define ld_stab_hash sdt_filler2
+#define ld_buckets sdt_buckets
+#define ld_symbols sdt_strings
+#define ld_symb_size sdt_str_sz
+#define ld_text sdt_text_sz
+#define ld_plt_sz sdt_plt_sz
+
+#define rtc_symb rt_symbol
+#define rtc_sp rt_sp
+#define rtc_next rt_next
+
+#define ld_debug so_debug
+#define ldd_version dd_version
+#define ldd_in_debugger dd_in_debugger
+#define ldd_sym_loaded dd_sym_loaded
+#define ldd_bp_addr dd_bpt_addr
+#define ldd_bp_inst dd_bpt_shadow
+#define ldd_cp dd_cc
+
+#define link_dynamic _dynamic
+#define ld_version d_version
+#define ldd d_debug
+#define ld_un d_un
+#define ld_2 d_sdt
diff --git a/gdb/config/ns32k/nbsd.mh b/gdb/config/ns32k/nbsdaout.mh
index e39c657a4de..8cf47816a1e 100644
--- a/gdb/config/ns32k/nbsd.mh
+++ b/gdb/config/ns32k/nbsdaout.mh
@@ -2,4 +2,4 @@
NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o ns32knbsd-nat.o \
solib.o solib-sunos.o
XM_FILE= xm-nbsd.h
-NAT_FILE= nm-nbsd.h
+NAT_FILE= nm-nbsdaout.h
diff --git a/gdb/config/ns32k/nbsd.mt b/gdb/config/ns32k/nbsdaout.mt
index 14d37f9a40f..24418f4e8dc 100644
--- a/gdb/config/ns32k/nbsd.mt
+++ b/gdb/config/ns32k/nbsdaout.mt
@@ -1,3 +1,3 @@
# Target: PC532 running NetBSD
-TDEPFILES= ns32k-tdep.o
+TDEPFILES= ns32k-tdep.o ns32knbsd-tdep.o
TM_FILE= tm-nbsd.h
diff --git a/gdb/config/ns32k/nm-nbsd.h b/gdb/config/ns32k/nm-nbsd.h
index c2c81b7203f..4e1e13b9e3e 100644
--- a/gdb/config/ns32k/nm-nbsd.h
+++ b/gdb/config/ns32k/nm-nbsd.h
@@ -23,7 +23,7 @@
#define NM_NBSD_H
/* Get generic NetBSD native definitions. */
-#include "nm-nbsd.h"
+#include "config/nm-nbsd.h"
#if 0
#define FLOAT_INFO { extern ns32k_float_info(); ns32k_float_info(); }
diff --git a/gdb/config/ns32k/nm-nbsdaout.h b/gdb/config/ns32k/nm-nbsdaout.h
new file mode 100644
index 00000000000..aed3c7f3562
--- /dev/null
+++ b/gdb/config/ns32k/nm-nbsdaout.h
@@ -0,0 +1,30 @@
+/* Native-dependent definitions for ns32k running NetBSD, for GDB.
+ Copyright 1986, 1987, 1989, 1992, 1994, 2000, 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 NM_NBSDAOUT_H
+#define NM_NBSDAOUT_H
+
+#include "ns32k/nm-nbsd.h"
+
+/* Get generic NetBSD native definitions. */
+#include "config/nm-nbsdaout.h"
+
+#endif /* NM_NBSDAOUT_H */
diff --git a/gdb/config/ns32k/tm-nbsd.h b/gdb/config/ns32k/tm-nbsd.h
index 4766d61dca2..88b4e226942 100644
--- a/gdb/config/ns32k/tm-nbsd.h
+++ b/gdb/config/ns32k/tm-nbsd.h
@@ -19,62 +19,19 @@
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
+#ifndef TM_NBSD_H
+#define TM_NBSD_H
+
/* Override number of expected traps from sysv. */
#define START_INFERIOR_TRAPS_EXPECTED 2
/* Most definitions from umax could be used. */
-#include "ns32k/tm-umax.h"
-
-/* Generic NetBSD definitions. */
-
-#include "tm-nbsd.h"
+#include "ns32k/tm-ns32k.h"
/* Saved Pc. Get it from sigcontext if within sigtramp. */
/* Offset to saved PC in sigcontext, from <machine/signal.h>. */
#define SIGCONTEXT_PC_OFFSET 20
-#undef FRAME_SAVED_PC(FRAME)
-#define FRAME_SAVED_PC(FRAME) \
- (((FRAME)->signal_handler_caller \
- ? sigtramp_saved_pc (FRAME) \
- : read_memory_integer ((FRAME)->frame + 4, 4)) \
- )
-
-
-/* tm-umax.h assumes a 32082 fpu. We have a 32382 fpu. */
-#undef REGISTER_NAMES
-#undef NUM_REGS
-#undef REGISTER_BYTES
-#undef REGISTER_BYTE
-/* Initializer for an array of names of registers.
- There should be NUM_REGS strings in this initializer. */
-
-#define REGISTER_NAMES {"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \
- "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \
- "sp", "fp", "pc", "ps", \
- "fsr", \
- "l0", "l1", "l2", "l3", "l4", "l5", "l6", "l7", "xx", \
- }
-
-#define NUM_REGS 29
-
-/* Total amount of space needed to store our copies of the machine's
- register state, the array `registers'. */
-#define REGISTER_BYTES \
- ((NUM_REGS - 4) * REGISTER_RAW_SIZE(R0_REGNUM) \
- + 8 * REGISTER_RAW_SIZE(LP0_REGNUM))
-
-/* Index within `registers' of the first byte of the space for
- register N. */
-
-/* This is a bit yuck. The even numbered double precision floating
- point long registers occupy the same space as the even:odd numbered
- single precision floating point registers, but the extra 32381 fpu
- registers are at the end. Doing it this way is compatable for both
- 32081 and 32381 equiped machines. */
-
-#define REGISTER_BYTE(N) (((N) < LP0_REGNUM? (N)\
- : ((N) - LP0_REGNUM) & 1? (N) - 1 \
- : ((N) - LP0_REGNUM + FP0_REGNUM)) * 4)
+#endif /* TM_NBSD_H */
diff --git a/gdb/config/ns32k/tm-ns32k.h b/gdb/config/ns32k/tm-ns32k.h
new file mode 100644
index 00000000000..cd1594294fc
--- /dev/null
+++ b/gdb/config/ns32k/tm-ns32k.h
@@ -0,0 +1,39 @@
+/* Definitions to make GDB run on an encore under umax 4.2
+ Copyright 1987, 1989, 1991, 1993, 1994, 1998, 1999, 2000, 2001, 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_NS32K_H
+#define TM_NS32K_H
+
+#define GDB_MULTI_ARCH GDB_MULTI_ARCH_PARTIAL
+
+/* Need to get function ends by adding this to epilogue address from .bf
+ record, not using x_fsize field. */
+#define FUNCTION_EPILOGUE_SIZE 4
+
+/* Address of end of stack space. */
+
+#ifndef STACK_END_ADDR
+#define STACK_END_ADDR (0xfffff000)
+#endif
+
+#define NUM_GENERAL_REGS 8
+
+#endif /* TM_NS32K_H */
diff --git a/gdb/config/ns32k/tm-umax.h b/gdb/config/ns32k/tm-umax.h
deleted file mode 100644
index 354349ee912..00000000000
--- a/gdb/config/ns32k/tm-umax.h
+++ /dev/null
@@ -1,319 +0,0 @@
-/* Definitions to make GDB run on an encore under umax 4.2
- Copyright 1987, 1989, 1991, 1993, 1994, 1998, 1999, 2000, 2001
- 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"
-
-/* Need to get function ends by adding this to epilogue address from .bf
- record, not using x_fsize field. */
-#define FUNCTION_EPILOGUE_SIZE 4
-
-/* Offset from address of function to start of its code.
- Zero on most machines. */
-
-#define FUNCTION_START_OFFSET 0
-
-/* Advance PC across any function entry prologue instructions
- to reach some "real" code. */
-
-extern CORE_ADDR umax_skip_prologue (CORE_ADDR);
-#define SKIP_PROLOGUE(pc) (umax_skip_prologue (pc))
-
-/* Immediately after a function call, return the saved pc.
- Can't always go through the frames for this because on some machines
- the new frame is not set up until the new function executes
- some instructions. */
-
-#define SAVED_PC_AFTER_CALL(frame) \
- read_memory_integer (read_register (SP_REGNUM), 4)
-
-/* Address of end of stack space. */
-
-#ifndef STACK_END_ADDR
-#define STACK_END_ADDR (0xfffff000)
-#endif
-
-/* Stack grows downward. */
-
-#define INNER_THAN(lhs,rhs) ((lhs) < (rhs))
-
-/* Sequence of bytes for breakpoint instruction. */
-
-#define BREAKPOINT {0xf2}
-
-/* Amount PC must be decremented by after a breakpoint.
- This is often the number of bytes in BREAKPOINT
- but not always. */
-
-#define DECR_PC_AFTER_BREAK 0
-
-/* Say how long (ordinary) registers are. This is a piece of bogosity
- used in push_word and a few other places; REGISTER_RAW_SIZE is the
- real way to know how big a register is. */
-
-#define REGISTER_SIZE 4
-
-/* Number of machine registers */
-
-#define NUM_REGS 25
-
-#define NUM_GENERAL_REGS 8
-
-/* Initializer for an array of names of registers.
- There should be NUM_REGS strings in this initializer. */
-
-#define REGISTER_NAMES {"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \
- "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \
- "sp", "fp", "pc", "ps", \
- "fsr", \
- "l0", "l1", "l2", "l3", "xx", \
- }
-
-/* 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 R0_REGNUM 0 /* General register 0 */
-#define FP0_REGNUM 8 /* Floating point register 0 */
-#define SP_REGNUM 16 /* Contains address of top of stack */
-#define AP_REGNUM FP_REGNUM
-#define FP_REGNUM 17 /* Contains address of executing stack frame */
-#define PC_REGNUM 18 /* Contains program counter */
-#define PS_REGNUM 19 /* Contains processor status */
-#define FPS_REGNUM 20 /* Floating point status register */
-#define LP0_REGNUM 21 /* Double register 0 (same as FP0) */
-
-/* Total amount of space needed to store our copies of the machine's
- register state, the array `registers'. */
-#define REGISTER_BYTES \
- ((NUM_REGS - 4) * REGISTER_RAW_SIZE(R0_REGNUM) \
- + 4 * REGISTER_RAW_SIZE(LP0_REGNUM))
-
-/* Index within `registers' of the first byte of the space for
- register N. */
-
-#define REGISTER_BYTE(N) ((N) >= LP0_REGNUM ? \
- LP0_REGNUM * 4 + ((N) - LP0_REGNUM) * 8 : (N) * 4)
-
-/* Number of bytes of storage in the actual machine representation
- for register N. On the 32000, all regs are 4 bytes
- except for the doubled floating registers. */
-
-#define REGISTER_RAW_SIZE(N) ((N) >= LP0_REGNUM ? 8 : 4)
-
-/* Number of bytes of storage in the program's representation
- for register N. On the 32000, all regs are 4 bytes
- except for the doubled floating registers. */
-
-#define REGISTER_VIRTUAL_SIZE(N) ((N) >= LP0_REGNUM ? 8 : 4)
-
-/* Largest value REGISTER_RAW_SIZE can have. */
-
-#define MAX_REGISTER_RAW_SIZE 8
-
-/* Largest value REGISTER_VIRTUAL_SIZE can have. */
-
-#define MAX_REGISTER_VIRTUAL_SIZE 8
-
-/* Return the GDB type object for the "standard" data type
- of data in register N. */
-
-#define REGISTER_VIRTUAL_TYPE(N) \
- (((N) < FP0_REGNUM) ? \
- builtin_type_int : \
- ((N) < FP0_REGNUM + 8) ? \
- builtin_type_float : \
- ((N) < LP0_REGNUM) ? \
- builtin_type_int : \
- builtin_type_double)
-
-/* Store the address of the place in which to copy the structure the
- subroutine will return. This is called from call_function.
-
- On this machine this is a no-op, because gcc isn't used on it
- yet. So this calling convention is not used. */
-
-#define STORE_STRUCT_RETURN(ADDR, SP)
-
-/* 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. */
-
-#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
- memcpy (VALBUF, REGBUF+REGISTER_BYTE (TYPE_CODE (TYPE) == TYPE_CODE_FLT ? FP0_REGNUM : 0), TYPE_LENGTH (TYPE))
-
-/* Write into appropriate registers a function return value
- of type TYPE, given in virtual format. */
-
-#define STORE_RETURN_VALUE(TYPE,VALBUF) \
- write_register_bytes (REGISTER_BYTE (TYPE_CODE (TYPE) == TYPE_CODE_FLT ? FP0_REGNUM : 0), VALBUF, TYPE_LENGTH (TYPE))
-
-/* 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). */
-
-#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) (*(int *)(REGBUF))
-
-/* Describe the pointer in each stack frame to the previous stack frame
- (its caller). */
-
-/* FRAME_CHAIN takes a frame's nominal address
- and produces the frame's chain-pointer. */
-
-/* In the case of the ns32000 series, the frame's nominal address is the FP
- value, and at that address is saved previous FP value as a 4-byte word. */
-
-#define FRAME_CHAIN(thisframe) \
- (!inside_entry_file ((thisframe)->pc) ? \
- read_memory_integer ((thisframe)->frame, 4) :\
- 0)
-
-/* Define other aspects of the stack frame. */
-
-#define FRAME_SAVED_PC(FRAME) (read_memory_integer ((FRAME)->frame + 4, 4))
-
-/* Compute base of arguments. */
-
-#define FRAME_ARGS_ADDRESS(fi) \
- ((ns32k_get_enter_addr ((fi)->pc) > 1) ? \
- ((fi)->frame) : (read_register (SP_REGNUM) - 4))
-
-#define FRAME_LOCALS_ADDRESS(fi) ((fi)->frame)
-
-/* Get the address of the enter opcode for this function, if it is active.
- Returns positive address > 1 if pc is between enter/exit,
- 1 if pc before enter or after exit, 0 otherwise. */
-
-extern CORE_ADDR ns32k_get_enter_addr ();
-
-/* Return number of args passed to a frame.
- Can return -1, meaning no way to tell. */
-
-extern int umax_frame_num_args (struct frame_info *fi);
-#define FRAME_NUM_ARGS(fi) (umax_frame_num_args ((fi)))
-
-/* Return number of bytes at start of arglist that are not really args. */
-
-#define FRAME_ARGS_SKIP 8
-
-/* Put here the code to store, into a struct frame_saved_regs,
- the addresses of the saved registers of frame described by FRAME_INFO.
- This includes special registers such as pc and fp saved in special
- ways in the stack frame. sp is even more special:
- the address we return for it IS the sp for the next frame. */
-
-extern int ns32k_localcount (CORE_ADDR enter_pc);
-
-#define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs) \
-{ \
- register int regmask, regnum; \
- int localcount; \
- register CORE_ADDR enter_addr; \
- register CORE_ADDR next_addr; \
- \
- memset (&(frame_saved_regs), '\0', sizeof (frame_saved_regs)); \
- enter_addr = ns32k_get_enter_addr ((frame_info)->pc); \
- if (enter_addr > 1) \
- { \
- regmask = read_memory_integer (enter_addr+1, 1) & 0xff; \
- localcount = ns32k_localcount (enter_addr); \
- next_addr = (frame_info)->frame + localcount; \
- for (regnum = 0; regnum < 8; regnum++, regmask >>= 1) \
- (frame_saved_regs).regs[regnum] = (regmask & 1) ? \
- (next_addr -= 4) : 0; \
- (frame_saved_regs).regs[SP_REGNUM] = (frame_info)->frame + 4;\
- (frame_saved_regs).regs[PC_REGNUM] = (frame_info)->frame + 4;\
- (frame_saved_regs).regs[FP_REGNUM] = \
- (read_memory_integer ((frame_info)->frame, 4));\
- } \
- else if (enter_addr == 1) \
- { \
- CORE_ADDR sp = read_register (SP_REGNUM); \
- (frame_saved_regs).regs[PC_REGNUM] = sp; \
- (frame_saved_regs).regs[SP_REGNUM] = sp + 4; \
- } \
-}
-
-/* Things needed for making the inferior call functions. */
-
-/* Push an empty stack frame, to record the current PC, etc. */
-
-#define PUSH_DUMMY_FRAME \
-{ register CORE_ADDR sp = read_register (SP_REGNUM);\
- register int regnum; \
- sp = push_word (sp, read_register (PC_REGNUM)); \
- sp = push_word (sp, read_register (FP_REGNUM)); \
- write_register (FP_REGNUM, sp); \
- for (regnum = 0; regnum < 8; regnum++) \
- sp = push_word (sp, read_register (regnum)); \
- write_register (SP_REGNUM, sp); \
-}
-
-/* Discard from the stack the innermost frame, restoring all registers. */
-
-#define POP_FRAME \
-{ register struct frame_info *frame = get_current_frame (); \
- register CORE_ADDR fp; \
- register int regnum; \
- struct frame_saved_regs fsr; \
- struct frame_info *fi; \
- fp = frame->frame; \
- get_frame_saved_regs (frame, &fsr); \
- for (regnum = 0; regnum < 8; regnum++) \
- if (fsr.regs[regnum]) \
- write_register (regnum, read_memory_integer (fsr.regs[regnum], 4)); \
- write_register (FP_REGNUM, read_memory_integer (fp, 4)); \
- write_register (PC_REGNUM, read_memory_integer (fp + 4, 4)); \
- write_register (SP_REGNUM, fp + 8); \
- flush_cached_frames (); \
-}
-
-/* This sequence of words is the instructions
- enter 0xff,0 82 ff 00
- jsr @0x00010203 7f ae c0 01 02 03
- adjspd 0x69696969 7f a5 01 02 03 04
- bpt f2
- Note this is 16 bytes. */
-
-#define CALL_DUMMY { 0x7f00ff82, 0x0201c0ae, 0x01a57f03, 0xf2040302 }
-
-#define CALL_DUMMY_START_OFFSET 3
-#define CALL_DUMMY_LENGTH 16
-#define CALL_DUMMY_ADDR 5
-#define CALL_DUMMY_NARGS 11
-
-/* Insert the specified number of args and function address
- into a call sequence of the above form stored at DUMMYNAME. */
-
-void flip_bytes (void *ptr, int count);
-
-#define FIX_CALL_DUMMY(dummyname, pc, fun, nargs, args, type, gcc_p) \
-{ \
- int flipped; \
- flipped = fun | 0xc0000000; \
- flip_bytes (&flipped, 4); \
- *((int *) (((char *) dummyname)+CALL_DUMMY_ADDR)) = flipped; \
- flipped = - nargs * 4; \
- flip_bytes (&flipped, 4); \
- *((int *) (((char *) dummyname)+CALL_DUMMY_NARGS)) = flipped; \
-}
diff --git a/gdb/config/ns32k/xm-nbsd.h b/gdb/config/ns32k/xm-nbsd.h
index 23a0650d280..962664b70b9 100644
--- a/gdb/config/ns32k/xm-nbsd.h
+++ b/gdb/config/ns32k/xm-nbsd.h
@@ -19,4 +19,4 @@
Boston, MA 02111-1307, USA. */
/* Get generic NetBSD host definitions. */
-#include "xm-nbsd.h"
+#include "config/xm-nbsd.h"
diff --git a/gdb/config/pa/hpux11w.mh b/gdb/config/pa/hpux11w.mh
index b784263a4fb..cd897aa866b 100644
--- a/gdb/config/pa/hpux11w.mh
+++ b/gdb/config/pa/hpux11w.mh
@@ -9,6 +9,6 @@ MH_CFLAGS = -D__HP_CURSES -Dvfork=fork
XM_FILE= xm-hppah.h
NAT_FILE= nm-hppah11.h
-NATDEPFILES= hppah-nat.o corelow.o core-aout.o inftarg.o fork-child.o infttrace.o hpread.o pa64solib.o
+NATDEPFILES= hppah-nat.o corelow.o core-aout.o inftarg.o fork-child.o infttrace.o hpread.o pa64solib.o solib.o
HOST_IPC=-DBSD_IPC -DPOSIX_WAIT
diff --git a/gdb/config/pa/nm-hppao.h b/gdb/config/pa/nm-hppao.h
index 11e13e7dbca..6650a4bd19a 100644
--- a/gdb/config/pa/nm-hppao.h
+++ b/gdb/config/pa/nm-hppao.h
@@ -18,7 +18,7 @@
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#include "nm-m3.h"
+#include "config/nm-m3.h"
#define U_REGS_OFFSET 0
#define KERNEL_U_ADDR 0
diff --git a/gdb/config/pa/tm-hppa.h b/gdb/config/pa/tm-hppa.h
index 227108f49ef..0570e6fdf84 100644
--- a/gdb/config/pa/tm-hppa.h
+++ b/gdb/config/pa/tm-hppa.h
@@ -310,7 +310,7 @@ extern void pa_do_strcat_registers_info (int, int, struct ui_file *, enum precis
a function return value of type TYPE, and copy that, in virtual format,
into VALBUF. */
-#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
+#define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
hppa_extract_return_value (TYPE, REGBUF, VALBUF);
/* elz: decide whether the function returning a value of type type
@@ -337,20 +337,19 @@ extern use_struct_convention_fn hppa_use_struct_convention;
the address in which a function should return its structure value,
as a CORE_ADDR (or an expression that can be used as one). */
-#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \
+#define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \
(*(int *)((REGBUF) + REGISTER_BYTE (28)))
/* 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 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.
- */
+ 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. */
#define VALUE_RETURNED_FROM_STACK(valtype,addr) \
hppa_value_returned_from_stack (valtype, addr)
diff --git a/gdb/config/pa/tm-hppa64.h b/gdb/config/pa/tm-hppa64.h
index 10fdeede69d..10790e6bb01 100644
--- a/gdb/config/pa/tm-hppa64.h
+++ b/gdb/config/pa/tm-hppa64.h
@@ -221,13 +221,13 @@ call_dummy
#undef REG_STRUCT_HAS_ADDR
-#undef EXTRACT_RETURN_VALUE
+#undef DEPRECATED_EXTRACT_RETURN_VALUE
/* RM: floats are returned in FR4R, doubles in FR4
* integral values are in r28, padded on the left
* aggregates less that 65 bits are in r28, right padded
* aggregates upto 128 bits are in r28 and r29, right padded
*/
-#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
+#define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
{ \
if (TYPE_CODE (TYPE) == TYPE_CODE_FLT && !SOFT_FLOAT) \
memcpy ((VALBUF), \
diff --git a/gdb/config/powerpc/aix.mt b/gdb/config/powerpc/aix.mt
index 706129ae2c7..d7ba624da91 100644
--- a/gdb/config/powerpc/aix.mt
+++ b/gdb/config/powerpc/aix.mt
@@ -1,3 +1,3 @@
# Target: PowerPC running AIX
-TDEPFILES= rs6000-tdep.o xcoffread.o ppc-linux-tdep.o solib.o solib-svr4.o
+TDEPFILES= rs6000-tdep.o xcoffread.o ppc-sysv-tdep.o solib.o solib-svr4.o
TM_FILE= tm-ppc-aix.h
diff --git a/gdb/config/powerpc/linux.mt b/gdb/config/powerpc/linux.mt
index 01160b98704..a1d08c2d38e 100644
--- a/gdb/config/powerpc/linux.mt
+++ b/gdb/config/powerpc/linux.mt
@@ -1,5 +1,6 @@
# Target: Motorola PPC on Linux
-TDEPFILES= rs6000-tdep.o ppc-linux-tdep.o solib.o solib-svr4.o solib-legacy.o
+TDEPFILES= rs6000-tdep.o ppc-linux-tdep.o ppc-sysv-tdep.o solib.o \
+ solib-svr4.o solib-legacy.o
TM_FILE= tm-linux.h
SIM_OBS = remote-sim.o
diff --git a/gdb/config/powerpc/nbsd.mh b/gdb/config/powerpc/nbsd.mh
index a6de76de6f1..26ba24d9860 100644
--- a/gdb/config/powerpc/nbsd.mh
+++ b/gdb/config/powerpc/nbsd.mh
@@ -1,4 +1,3 @@
# Host: PowerPC, running NetBSD
-NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o ppcnbsd-nat.o \
- solib.o solib-svr4.o solib-legacy.o
+NATDEPFILES= fork-child.o infptrace.o inftarg.o ppcnbsd-nat.o
NAT_FILE= nm-nbsd.h
diff --git a/gdb/config/powerpc/nbsd.mt b/gdb/config/powerpc/nbsd.mt
index 40a2a993571..d492f9d763c 100644
--- a/gdb/config/powerpc/nbsd.mt
+++ b/gdb/config/powerpc/nbsd.mt
@@ -1,5 +1,6 @@
# Target: PowerPC, running NetBSD
-TDEPFILES= rs6000-tdep.o ppc-linux-tdep.o solib.o solib-svr4.o
+TDEPFILES= rs6000-tdep.o ppc-sysv-tdep.o ppcnbsd-tdep.o nbsd-tdep.o corelow.o \
+ solib.o solib-svr4.o
TM_FILE= tm-nbsd.h
SIM_OBS = remote-sim.o
diff --git a/gdb/config/powerpc/nm-linux.h b/gdb/config/powerpc/nm-linux.h
index dee39b4efaf..6e3f3a0a5c2 100644
--- a/gdb/config/powerpc/nm-linux.h
+++ b/gdb/config/powerpc/nm-linux.h
@@ -19,7 +19,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#ifndef NM_LINUX_H
-#include "nm-linux.h"
+#include "config/nm-linux.h"
#define NM_LINUX_H
diff --git a/gdb/config/powerpc/nm-nbsd.h b/gdb/config/powerpc/nm-nbsd.h
index 0ff53094e0b..5de6c9a0d21 100644
--- a/gdb/config/powerpc/nm-nbsd.h
+++ b/gdb/config/powerpc/nm-nbsd.h
@@ -1,5 +1,5 @@
/* Native-dependent definitions for PowerPC running NetBSD ELF, for GDB.
- Copyright 2000 Free Software Foundation, Inc.
+ Copyright 2000, 2002 Free Software Foundation, Inc.
This file is part of GDB.
@@ -21,9 +21,7 @@
#ifndef NM_NBSD_H
#define NM_NBSD_H
-#define SVR4_SHARED_LIBS
-
/* Get generic NetBSD native definitions. */
-#include "nm-nbsd.h"
+#include "config/nm-nbsd.h"
#endif
diff --git a/gdb/config/powerpc/ppc-eabi.mt b/gdb/config/powerpc/ppc-eabi.mt
index 2d4a77fcdef..5ef8cd9befb 100644
--- a/gdb/config/powerpc/ppc-eabi.mt
+++ b/gdb/config/powerpc/ppc-eabi.mt
@@ -1,3 +1,3 @@
# Target: PowerPC running eabi
-TDEPFILES= rs6000-tdep.o monitor.o dsrec.o ppcbug-rom.o dink32-rom.o ppc-bdm.o ocd.o remote-sds.o ppc-linux-tdep.o solib.o solib-svr4.o
+TDEPFILES= rs6000-tdep.o monitor.o dsrec.o ppcbug-rom.o dink32-rom.o ppc-bdm.o ocd.o remote-sds.o ppc-sysv-tdep.o solib.o solib-svr4.o
TM_FILE= tm-ppc-eabi.h
diff --git a/gdb/config/powerpc/ppc-sim.mt b/gdb/config/powerpc/ppc-sim.mt
index f2ad1f0b2c4..187bf39e8d5 100644
--- a/gdb/config/powerpc/ppc-sim.mt
+++ b/gdb/config/powerpc/ppc-sim.mt
@@ -1,5 +1,5 @@
# Target: PowerPC running eabi and including the simulator
-TDEPFILES= rs6000-tdep.o monitor.o dsrec.o ppcbug-rom.o dink32-rom.o ppc-bdm.o ocd.o remote-sds.o ppc-linux-tdep.o solib.o solib-svr4.o
+TDEPFILES= rs6000-tdep.o monitor.o dsrec.o ppcbug-rom.o dink32-rom.o ppc-bdm.o ocd.o remote-sds.o ppc-sysv-tdep.o solib.o solib-svr4.o
TM_FILE= tm-ppc-eabi.h
SIM_OBS = remote-sim.o
diff --git a/gdb/config/powerpc/ppcle-eabi.mt b/gdb/config/powerpc/ppcle-eabi.mt
index e7480975730..ee05f163797 100644
--- a/gdb/config/powerpc/ppcle-eabi.mt
+++ b/gdb/config/powerpc/ppcle-eabi.mt
@@ -1,3 +1,3 @@
# Target: PowerPC running eabi in little endian mode
-TDEPFILES= rs6000-tdep.o monitor.o dsrec.o ppcbug-rom.o ppc-bdm.o ocd.o ppc-linux-tdep.o solib.o solib-svr4.o
+TDEPFILES= rs6000-tdep.o monitor.o dsrec.o ppcbug-rom.o ppc-bdm.o ocd.o ppc-sysv-tdep.o solib.o solib-svr4.o
TM_FILE= tm-ppcle-eabi.h
diff --git a/gdb/config/powerpc/ppcle-sim.mt b/gdb/config/powerpc/ppcle-sim.mt
index 558c0dc885e..31cb9006a30 100644
--- a/gdb/config/powerpc/ppcle-sim.mt
+++ b/gdb/config/powerpc/ppcle-sim.mt
@@ -1,5 +1,5 @@
# Target: PowerPC running eabi in little endian mode under the simulator
-TDEPFILES= rs6000-tdep.o monitor.o dsrec.o ppcbug-rom.o ppc-bdm.o ocd.o ppc-linux-tdep.o solib.o solib-svr4.o
+TDEPFILES= rs6000-tdep.o monitor.o dsrec.o ppcbug-rom.o ppc-bdm.o ocd.o ppc-sysv-tdep.o solib.o solib-svr4.o
TM_FILE= tm-ppcle-eabi.h
SIM_OBS = remote-sim.o
diff --git a/gdb/config/powerpc/tm-linux.h b/gdb/config/powerpc/tm-linux.h
index 5fe8d76bce0..d69dfc1f5bf 100644
--- a/gdb/config/powerpc/tm-linux.h
+++ b/gdb/config/powerpc/tm-linux.h
@@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "powerpc/tm-ppc-eabi.h"
/* Avoid warning from redefinition in tm-sysv4.h (included from tm-linux.h) */
#undef SKIP_TRAMPOLINE_CODE
-#include "tm-linux.h"
+#include "config/tm-linux.h"
/* We can single step on linux */
#undef SOFTWARE_SINGLE_STEP
diff --git a/gdb/config/powerpc/tm-nbsd.h b/gdb/config/powerpc/tm-nbsd.h
index ae3418f4fdb..2b7acb8b4b8 100644
--- a/gdb/config/powerpc/tm-nbsd.h
+++ b/gdb/config/powerpc/tm-nbsd.h
@@ -22,6 +22,5 @@
#define TM_NBSD_H
#include "powerpc/tm-ppc-eabi.h"
-#include "tm-nbsd.h"
#endif /* TM_NBSD_H */
diff --git a/gdb/config/powerpc/tm-vxworks.h b/gdb/config/powerpc/tm-vxworks.h
index a31846a802f..69e2ddec3b0 100644
--- a/gdb/config/powerpc/tm-vxworks.h
+++ b/gdb/config/powerpc/tm-vxworks.h
@@ -23,6 +23,6 @@
#define TM_VXWORKS_H
#include "powerpc/tm-ppc-eabi.h"
-#include "tm-vxworks.h"
+#include "config/tm-vxworks.h"
#endif /* ifndef TM_VXWORKS_H */
diff --git a/gdb/config/powerpc/vxworks.mt b/gdb/config/powerpc/vxworks.mt
index ba6e17bcb1c..eca028f80aa 100644
--- a/gdb/config/powerpc/vxworks.mt
+++ b/gdb/config/powerpc/vxworks.mt
@@ -1,3 +1,3 @@
# Target: Powerpc running VxWorks
-TDEPFILES= rs6000-tdep.o ppc-linux-tdep.o solib.o solib-svr4.o
+TDEPFILES= rs6000-tdep.o ppc-sysv-tdep.o solib.o solib-svr4.o
TM_FILE= tm-vxworks.h
diff --git a/gdb/config/powerpc/xm-aix.h b/gdb/config/powerpc/xm-aix.h
index cc986502b77..e663453f40e 100644
--- a/gdb/config/powerpc/xm-aix.h
+++ b/gdb/config/powerpc/xm-aix.h
@@ -19,7 +19,7 @@
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#include "xm-aix4.h"
+#include "config/xm-aix4.h"
/* This doesn't seem to be declared in any header file I can find. */
char *termdef (int, int);
diff --git a/gdb/config/rs6000/aix4.mt b/gdb/config/rs6000/aix4.mt
index fb9d0033fef..388c4f237d8 100644
--- a/gdb/config/rs6000/aix4.mt
+++ b/gdb/config/rs6000/aix4.mt
@@ -1,3 +1,3 @@
# Target: IBM RS/6000 running AIX4
-TDEPFILES= rs6000-tdep.o xcoffread.o ppc-linux-tdep.o solib.o solib-svr4.o
+TDEPFILES= rs6000-tdep.o xcoffread.o ppc-sysv-tdep.o solib.o solib-svr4.o
TM_FILE= tm-rs6000-aix4.h
diff --git a/gdb/config/rs6000/nm-rs6000ly.h b/gdb/config/rs6000/nm-rs6000ly.h
index 7bc1267d266..51d12f8ac70 100644
--- a/gdb/config/rs6000/nm-rs6000ly.h
+++ b/gdb/config/rs6000/nm-rs6000ly.h
@@ -21,6 +21,6 @@
#ifndef NM_RS6000LYNX_H
#define NM_RS6000LYNX_H
-#include "nm-lynx.h"
+#include "config/nm-lynx.h"
#endif /* NM_RS6000LYNX_H */
diff --git a/gdb/config/rs6000/rs6000.mt b/gdb/config/rs6000/rs6000.mt
index 5ffcc0165a4..86b4c58b5e3 100644
--- a/gdb/config/rs6000/rs6000.mt
+++ b/gdb/config/rs6000/rs6000.mt
@@ -1,3 +1,3 @@
# Target: IBM RS/6000 running AIX
-TDEPFILES= rs6000-tdep.o xcoffread.o ppc-linux-tdep.o solib.o solib-svr4.o
+TDEPFILES= rs6000-tdep.o xcoffread.o ppc-sysv-tdep.o solib.o solib-svr4.o
TM_FILE= tm-rs6000.h
diff --git a/gdb/config/rs6000/rs6000lynx.mt b/gdb/config/rs6000/rs6000lynx.mt
index 69aeb60c221..89ed7a288f8 100644
--- a/gdb/config/rs6000/rs6000lynx.mt
+++ b/gdb/config/rs6000/rs6000lynx.mt
@@ -1,3 +1,3 @@
# Target: IBM RS6000 running LynxOS
-TDEPFILES= coff-solib.o rs6000-tdep.o ppc-linux-tdep.o solib.o solib-svr4.o
+TDEPFILES= coff-solib.o rs6000-tdep.o ppc-sysv-tdep.o solib.o solib-svr4.o
TM_FILE= tm-rs6000ly.h
diff --git a/gdb/config/rs6000/tm-rs6000ly.h b/gdb/config/rs6000/tm-rs6000ly.h
index ca7dc0d41ee..73ef7f06337 100644
--- a/gdb/config/rs6000/tm-rs6000ly.h
+++ b/gdb/config/rs6000/tm-rs6000ly.h
@@ -21,7 +21,7 @@
#ifndef TM_RS6000LYNX_H
#define TM_RS6000LYNX_H
-#include "tm-lynx.h"
+#include "config/tm-lynx.h"
/* Use generic RS6000 definitions. */
#include "rs6000/tm-rs6000.h"
diff --git a/gdb/config/rs6000/xm-aix4.h b/gdb/config/rs6000/xm-aix4.h
index 5f7aa778f45..4ca0abb8cf1 100644
--- a/gdb/config/rs6000/xm-aix4.h
+++ b/gdb/config/rs6000/xm-aix4.h
@@ -20,7 +20,7 @@
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#include "xm-aix4.h"
+#include "config/xm-aix4.h"
/* AIX 4.x uses nonstandard "int *" as type of third argument to ptrace() */
diff --git a/gdb/config/sh/tm-linux.h b/gdb/config/sh/tm-linux.h
index ab1d4d86f21..e8272d02e37 100644
--- a/gdb/config/sh/tm-linux.h
+++ b/gdb/config/sh/tm-linux.h
@@ -21,7 +21,7 @@
Boston, MA 02111-1307, USA. */
/* Pull in GNU/Linux generic defs. */
-#include "tm-linux.h"
+#include "config/tm-linux.h"
/* Pull in sh-target defs */
#include "sh/tm-sh.h"
diff --git a/gdb/config/sh/tm-sh.h b/gdb/config/sh/tm-sh.h
index bae87b8bbe5..6ae6085d9b7 100644
--- a/gdb/config/sh/tm-sh.h
+++ b/gdb/config/sh/tm-sh.h
@@ -23,100 +23,6 @@
#define GDB_MULTI_ARCH 1
-/* Information that is dependent on the processor variant. */
-
-/* ABI variants that we know about. If you add to this enum, please
- update the table of names in sh-tdep.c. */
-enum sh_osabi
-{
- SH_OSABI_UNKNOWN = 0,
- SH_OSABI_LINUX,
- SH_OSABI_NETBSD_ELF,
-
- SH_OSABI_INVALID /* Keep this last. */
-};
-
-enum sh_abi
- {
- SH_ABI_UNKNOWN,
- SH_ABI_32,
- SH_ABI_64
- };
-
-struct gdbarch_tdep
- {
- int PR_REGNUM;
- int FPUL_REGNUM; /* sh3e, sh4 */
- int FPSCR_REGNUM; /* sh3e, sh4 */
- int SR_REGNUM; /* sh-dsp, sh3, sh3-dsp, sh3e, sh4 */
- int DSR_REGNUM; /* sh-dsp, sh3-dsp */
- int FP_LAST_REGNUM; /* sh3e, sh4 */
- int A0G_REGNUM; /* sh-dsp, sh3-dsp */
- int A0_REGNUM; /* sh-dsp, sh3-dsp */
- int A1G_REGNUM; /* sh-dsp, sh3-dsp */
- int A1_REGNUM; /* sh-dsp, sh3-dsp */
- int M0_REGNUM; /* sh-dsp, sh3-dsp */
- int M1_REGNUM; /* sh-dsp, sh3-dsp */
- int X0_REGNUM; /* sh-dsp, sh3-dsp */
- int X1_REGNUM; /* sh-dsp, sh3-dsp */
- int Y0_REGNUM; /* sh-dsp, sh3-dsp */
- int Y1_REGNUM; /* sh-dsp, sh3-dsp */
- int MOD_REGNUM; /* sh-dsp, sh3-dsp */
- int SSR_REGNUM; /* sh3, sh3-dsp, sh3e, sh4 */
- int SPC_REGNUM; /* sh3, sh3-dsp, sh3e, sh4 */
- int RS_REGNUM; /* sh-dsp, sh3-dsp */
- int RE_REGNUM; /* sh-dsp, sh3-dsp */
- int DR0_REGNUM; /* sh4 */
- int DR_LAST_REGNUM; /* sh4 */
- int FV0_REGNUM; /* sh4 */
- int FV_LAST_REGNUM; /* sh4 */
- /* 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. */
- int TR7_REGNUM; /* sh5-media*/
- int FPP0_REGNUM; /* sh5-media*/
- int FPP_LAST_REGNUM; /* sh5-media*/
- int R0_C_REGNUM; /* sh5-compact*/
- int R_LAST_C_REGNUM; /* sh5-compact*/
- int PC_C_REGNUM; /* sh5-compact*/
- int GBR_C_REGNUM; /* sh5-compact*/
- int MACH_C_REGNUM; /* sh5-compact*/
- int MACL_C_REGNUM; /* sh5-compact*/
- int PR_C_REGNUM; /* sh5-compact*/
- int T_C_REGNUM; /* sh5-compact*/
- int FPSCR_C_REGNUM; /* sh5-compact*/
- int FPUL_C_REGNUM; /* sh5-compact*/
- int FP0_C_REGNUM; /* sh5-compact*/
- int FP_LAST_C_REGNUM; /* sh5-compact*/
- int DR0_C_REGNUM; /* sh5-compact*/
- int DR_LAST_C_REGNUM; /* sh5-compact*/
- int FV0_C_REGNUM; /* sh5-compact*/
- int FV_LAST_C_REGNUM; /* sh5-compact*/
- int ARG0_REGNUM;
- int ARGLAST_REGNUM;
- int FLOAT_ARGLAST_REGNUM;
- int RETURN_REGNUM;
- enum sh_osabi sh_osabi; /* OS/ABI of the inferior */
- const char *osabi_name; /* Name of the above */
- enum sh_abi sh_abi;
- };
-
-/* Registers common to all the SH variants. */
-enum
- {
- R0_REGNUM = 0,
- STRUCT_RETURN_REGNUM = 2,
- ARG0_REGNUM = 4, /* Used in h8300-tdep.c */
- ARGLAST_REGNUM = 7, /* Used in h8300-tdep.c */
- PR_REGNUM = 17, /* used in sh3-rom.c */
- GBR_REGNUM = 18,
- VBR_REGNUM = 19,
- MACH_REGNUM = 20,
- MACL_REGNUM = 21,
- SR_REGNUM = 22
- };
-
#define NUM_REALREGS 59 /* used in remote-e7000.c which is not multiarched. */
#define REGISTER_TYPE long /* used in standalone.c */
diff --git a/gdb/config/sparc/nbsd.mh b/gdb/config/sparc/nbsd.mh
deleted file mode 100644
index bf645922d33..00000000000
--- a/gdb/config/sparc/nbsd.mh
+++ /dev/null
@@ -1,6 +0,0 @@
-# Host: Sun 4 or Sparcstation, running NetBSD
-NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o sparc-nat.o \
- solib.o solib-sunos.o
-XM_FILE= xm-nbsd.h
-NAT_FILE= nm-nbsd.h
-HOST_IPC=-DBSD_IPC
diff --git a/gdb/config/sparc/nbsd.mt b/gdb/config/sparc/nbsd.mt
index 5c89318bfe9..b04dd42fabb 100644
--- a/gdb/config/sparc/nbsd.mt
+++ b/gdb/config/sparc/nbsd.mt
@@ -1,3 +1,4 @@
-# Target: Sun 4 or Sparcstation, running NetBSD
-TDEPFILES= sparc-tdep.o
+# Target: SPARC running NetBSD
+TDEPFILES= sparc-tdep.o sparcnbsd-tdep.o nbsd-tdep.o corelow.o solib.o \
+ solib-svr4.o
TM_FILE= tm-nbsd.h
diff --git a/gdb/config/sparc/nbsd64.mh b/gdb/config/sparc/nbsd64.mh
new file mode 100644
index 00000000000..eb54e489eb8
--- /dev/null
+++ b/gdb/config/sparc/nbsd64.mh
@@ -0,0 +1,3 @@
+# Host: UltraSPARC running NetBSD
+NATDEPFILES= fork-child.o infptrace.o inftarg.o sparc64nbsd-nat.o
+NAT_FILE= nm-nbsd.h
diff --git a/gdb/config/sparc/nbsd64.mt b/gdb/config/sparc/nbsd64.mt
new file mode 100644
index 00000000000..93b8f7841d4
--- /dev/null
+++ b/gdb/config/sparc/nbsd64.mt
@@ -0,0 +1,4 @@
+# Target: UltraSPARC running NetBSD
+TDEPFILES= sparc-tdep.o sparcnbsd-tdep.o nbsd-tdep.o corelow.o solib.o \
+ solib-svr4.o
+TM_FILE= tm-nbsd64.h
diff --git a/gdb/config/sparc/nbsdaout.mh b/gdb/config/sparc/nbsdaout.mh
new file mode 100644
index 00000000000..45208998124
--- /dev/null
+++ b/gdb/config/sparc/nbsdaout.mh
@@ -0,0 +1,4 @@
+# Host: Sun 4 or Sparcstation, running NetBSD
+NATDEPFILES= fork-child.o infptrace.o inftarg.o sparcnbsd-nat.o solib-sunos.o
+XM_FILE= xm-nbsd.h
+NAT_FILE= nm-nbsdaout.h
diff --git a/gdb/config/sparc/nbsdelf.mh b/gdb/config/sparc/nbsdelf.mh
index f2599fdd388..1042d91b9dd 100644
--- a/gdb/config/sparc/nbsdelf.mh
+++ b/gdb/config/sparc/nbsdelf.mh
@@ -1,6 +1,4 @@
# Host: Sun 4 or Sparcstation, running NetBSD
-NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o sparc-nat.o \
- solib.o solib-svr4.o solib-legacy.o
+NATDEPFILES= fork-child.o infptrace.o inftarg.o sparcnbsd-nat.o
XM_FILE= xm-nbsd.h
-NAT_FILE= nm-nbsdelf.h
-HOST_IPC=-DBSD_IPC
+NAT_FILE= nm-nbsd.h
diff --git a/gdb/config/sparc/nm-linux.h b/gdb/config/sparc/nm-linux.h
index 80ab0423cd0..a156eba0707 100644
--- a/gdb/config/sparc/nm-linux.h
+++ b/gdb/config/sparc/nm-linux.h
@@ -20,8 +20,8 @@
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#include <nm-sysv4.h>
-#include "nm-linux.h"
+#include "config/nm-sysv4.h"
+#include "config/nm-linux.h"
#include "solib.h"
#define FETCH_INFERIOR_REGISTERS
diff --git a/gdb/config/sparc/nm-nbsd.h b/gdb/config/sparc/nm-nbsd.h
index 653be852d85..957a34ed141 100644
--- a/gdb/config/sparc/nm-nbsd.h
+++ b/gdb/config/sparc/nm-nbsd.h
@@ -1,5 +1,5 @@
/* Native-dependent definitions for Sparc running NetBSD, for GDB.
- Copyright 1986, 1987, 1989, 1992, 1994, 1996, 1999, 2000
+ Copyright 1986, 1987, 1989, 1992, 1994, 1996, 1999, 2000, 2002
Free Software Foundation, Inc.
This file is part of GDB.
@@ -32,30 +32,4 @@
#define CHILD_PREPARE_TO_STORE() read_register_bytes (0, NULL, REGISTER_BYTES)
-/* Make things match up with what is expected in sparc-nat.c. */
-
-#define regs trapframe
-#define fp_status fpstate
-
-#define r_g1 tf_global[1]
-#define r_ps tf_psr
-#define r_pc tf_pc
-#define r_npc tf_npc
-#define r_y tf_y
-
-#define fpu fpstate
-#define fpu_regs fs_regs
-#define fpu_fsr fs_fsr
-#define fpu_fr fs_regs
-#define Fpu_fsr fs_fsr
-#define FPU_FSR_TYPE int
-
-#define PTRACE_GETREGS PT_GETREGS
-#define PTRACE_GETFPREGS PT_GETFPREGS
-#define PTRACE_SETREGS PT_SETREGS
-#define PTRACE_SETFPREGS PT_SETFPREGS
-
-#define GDB_GREGSET_T struct reg
-#define GDB_FPREGSET_T struct fpreg
-
#endif /* NM_NBSD_H */
diff --git a/gdb/config/sparc/nm-nbsdelf.h b/gdb/config/sparc/nm-nbsdaout.h
index e1eddddd092..730759153e0 100644
--- a/gdb/config/sparc/nm-nbsdelf.h
+++ b/gdb/config/sparc/nm-nbsdaout.h
@@ -1,4 +1,4 @@
-/* Native-dependent definitions for Sparc running NetBSD ELF, for GDB.
+/* Native-dependent definitions for Sparc running NetBSD a.out, for GDB.
Copyright 1999 Free Software Foundation, Inc.
This file is part of GDB.
@@ -18,10 +18,13 @@
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#ifndef NM_NBSDELF_H
-#define NM_NBSDELF_H
+#ifndef NM_NBSDAOUT_H
+#define NM_NBSDAOUT_H
-#define SVR4_SHARED_LIBS
#include "sparc/nm-nbsd.h"
-#endif
+/* Get generic NetBSD a.out native definitions. */
+
+#include "config/nm-nbsdaout.h"
+
+#endif /* NM_NBSDAOUT_H */
diff --git a/gdb/config/sparc/nm-sparclynx.h b/gdb/config/sparc/nm-sparclynx.h
index 74304be36d3..a231ba4cce1 100644
--- a/gdb/config/sparc/nm-sparclynx.h
+++ b/gdb/config/sparc/nm-sparclynx.h
@@ -21,6 +21,6 @@
#ifndef NM_SPARCLYNX_H
#define NM_SPARCLYNX_H
-#include "nm-lynx.h"
+#include "config/nm-lynx.h"
#endif /* NM_SPARCLYNX_H */
diff --git a/gdb/config/sparc/nm-sun4sol2.h b/gdb/config/sparc/nm-sun4sol2.h
index adc8231f8e8..f8aeda07ccc 100644
--- a/gdb/config/sparc/nm-sun4sol2.h
+++ b/gdb/config/sparc/nm-sun4sol2.h
@@ -22,7 +22,7 @@
/* Include the generic SVR4 definitions. */
-#include <nm-sysv4.h>
+#include "config/nm-sysv4.h"
/* Before storing, we need to read all the registers. */
diff --git a/gdb/config/sparc/tm-linux.h b/gdb/config/sparc/tm-linux.h
index 34d901f5f9b..31eeff9e206 100644
--- a/gdb/config/sparc/tm-linux.h
+++ b/gdb/config/sparc/tm-linux.h
@@ -29,6 +29,6 @@
#define SIGCONTEXT_PC_OFFSET 12
-#include "tm-linux.h"
+#include "config/tm-linux.h"
#endif /* TM_SPARCLINUX_H */
diff --git a/gdb/config/sparc/tm-nbsd.h b/gdb/config/sparc/tm-nbsd.h
index b434efe8dbd..bd9845029b5 100644
--- a/gdb/config/sparc/tm-nbsd.h
+++ b/gdb/config/sparc/tm-nbsd.h
@@ -1,5 +1,5 @@
/* Macro definitions for Sparc running under NetBSD.
- Copyright 1994 Free Software Foundation, Inc.
+ Copyright 1994, 2002 Free Software Foundation, Inc.
This file is part of GDB.
@@ -21,8 +21,9 @@
#ifndef TM_NBSD_H
#define TM_NBSD_H
-#include "sparc/tm-sparc.h"
+#define GDB_MULTI_ARCH GDB_MULTI_ARCH_PARTIAL
-#include "tm-nbsd.h"
+#include "sparc/tm-sparc.h"
+#include "solib.h"
#endif /* TM_NBSD_H */
diff --git a/gdb/config/i386/tm-nbsdelf.h b/gdb/config/sparc/tm-nbsd64.h
index 4d802c5302d..cc1d6b32297 100644
--- a/gdb/config/i386/tm-nbsdelf.h
+++ b/gdb/config/sparc/tm-nbsd64.h
@@ -1,5 +1,5 @@
-/* Macro definitions for i386 running under NetBSD.
- Copyright 2000 Free Software Foundation, Inc.
+/* Macro definitions for UltraSPARC running under NetBSD.
+ Copyright 1994, 2002 Free Software Foundation, Inc.
This file is part of GDB.
@@ -18,11 +18,10 @@
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#ifndef TM_NBSDELF_H
-#define TM_NBSDELF_H
+#ifndef TM_NBSD64_H
+#define TM_NBSD64_H
-#include "i386/tm-nbsd.h"
+#include "sparc/tm-sp64.h" /* sets GDB_MULTI_ARCH */
+#include "solib.h"
-#undef USE_STRUCT_CONVENTION
-
-#endif /* TM_NBSD_H */
+#endif /* TM_NBSD64_H */
diff --git a/gdb/config/sparc/tm-sp64.h b/gdb/config/sparc/tm-sp64.h
index 8486c860831..4c07f1fc1ba 100644
--- a/gdb/config/sparc/tm-sp64.h
+++ b/gdb/config/sparc/tm-sp64.h
@@ -273,8 +273,8 @@ extern void sparc64_write_sp (CORE_ADDR);
#define TARGET_READ_FP() (sparc64_read_fp ())
#define TARGET_WRITE_SP(X) (sparc64_write_sp (X))
-#undef EXTRACT_RETURN_VALUE
-#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
+#undef DEPRECATED_EXTRACT_RETURN_VALUE
+#define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
sp64_extract_return_value(TYPE, REGBUF, VALBUF, 0)
extern void sp64_extract_return_value (struct type *, char[], char *, int);
diff --git a/gdb/config/sparc/tm-sp64linux.h b/gdb/config/sparc/tm-sp64linux.h
index 56b56208652..c7ba03d3fbb 100644
--- a/gdb/config/sparc/tm-sp64linux.h
+++ b/gdb/config/sparc/tm-sp64linux.h
@@ -31,6 +31,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define GDB_PTRACE_REGS64
-#include "tm-sysv4.h"
+#include "config/tm-sysv4.h"
#endif TM_SPARC_LIN64_H
diff --git a/gdb/config/sparc/tm-sp64sim.h b/gdb/config/sparc/tm-sp64sim.h
index c8d115cd635..bb1263b40db 100644
--- a/gdb/config/sparc/tm-sp64sim.h
+++ b/gdb/config/sparc/tm-sp64sim.h
@@ -22,7 +22,7 @@
but it's a good start. */
#include "sparc/tm-sp64.h"
-#include "tm-sunos.h"
+#include "config/tm-sunos.h"
/* Offsets into jmp_buf. Not defined by Sun, but at least documented in a
comment in <machine/setjmp.h>! */
diff --git a/gdb/config/sparc/tm-sparc.h b/gdb/config/sparc/tm-sparc.h
index 4a5358036be..07c9e44d2ad 100644
--- a/gdb/config/sparc/tm-sparc.h
+++ b/gdb/config/sparc/tm-sparc.h
@@ -275,7 +275,7 @@ extern void sparc_store_return_value (struct type *, char *);
the address in which a function should return its structure value,
as a CORE_ADDR (or an expression that can be used as one). */
-#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \
+#define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \
sparc_extract_struct_value_address (REGBUF)
extern CORE_ADDR sparc_extract_struct_value_address (char *);
@@ -717,7 +717,7 @@ sparc32_push_arguments (int, struct value **, CORE_ADDR, int, CORE_ADDR);
function return value of type TYPE, and copy that, in virtual
format, into VALBUF. */
-#define EXTRACT_RETURN_VALUE(TYPE, REGBUF, VALBUF) \
+#define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE, REGBUF, VALBUF) \
sparc32_extract_return_value (TYPE, REGBUF, VALBUF)
extern void sparc32_extract_return_value (struct type *, char[], char *);
diff --git a/gdb/config/sparc/tm-sparclet.h b/gdb/config/sparc/tm-sparclet.h
index cc52d5a26d5..7771b2779b8 100644
--- a/gdb/config/sparc/tm-sparclet.h
+++ b/gdb/config/sparc/tm-sparclet.h
@@ -108,8 +108,8 @@ enum {
/* sparclet register numbers */
#define CCSR_REGNUM 72
-#undef EXTRACT_RETURN_VALUE
-#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
+#undef DEPRECATED_EXTRACT_RETURN_VALUE
+#define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
{ \
memcpy ((VALBUF), \
(char *)(REGBUF) + REGISTER_RAW_SIZE (O0_REGNUM) * 8 + \
diff --git a/gdb/config/sparc/tm-sparclynx.h b/gdb/config/sparc/tm-sparclynx.h
index 1a28621c065..3d196539beb 100644
--- a/gdb/config/sparc/tm-sparclynx.h
+++ b/gdb/config/sparc/tm-sparclynx.h
@@ -21,7 +21,7 @@
#ifndef TM_SPARCLYNX_H
#define TM_SPARCLYNX_H
-#include "tm-lynx.h"
+#include "config/tm-lynx.h"
/* Use generic Sparc definitions. */
#include "sparc/tm-sparc.h"
diff --git a/gdb/config/sparc/tm-sun4os4.h b/gdb/config/sparc/tm-sun4os4.h
index b561b13adc7..e080904d927 100644
--- a/gdb/config/sparc/tm-sun4os4.h
+++ b/gdb/config/sparc/tm-sun4os4.h
@@ -20,7 +20,7 @@
Boston, MA 02111-1307, USA. */
#include "sparc/tm-sparc.h"
-#include "tm-sunos.h"
+#include "config/tm-sunos.h"
/* Redefine SKIP_TRAMPOLINE_CODE to handle PIC compiled modules
in main executables. */
diff --git a/gdb/config/sparc/tm-sun4sol2.h b/gdb/config/sparc/tm-sun4sol2.h
index e3c59f630de..eb253b1c29f 100644
--- a/gdb/config/sparc/tm-sun4sol2.h
+++ b/gdb/config/sparc/tm-sun4sol2.h
@@ -22,7 +22,7 @@
#define GDB_MULTI_ARCH GDB_MULTI_ARCH_PARTIAL
#include "sparc/tm-sparc.h"
-#include "tm-sysv4.h"
+#include "config/tm-sysv4.h"
/* With Sol2 it is no longer necessary to enable software single-step,
since the /proc interface can take care of it for us in hardware. */
diff --git a/gdb/config/sparc/tm-vxsparc.h b/gdb/config/sparc/tm-vxsparc.h
index b6529f75b7f..f32f70daf73 100644
--- a/gdb/config/sparc/tm-vxsparc.h
+++ b/gdb/config/sparc/tm-vxsparc.h
@@ -20,7 +20,7 @@
Boston, MA 02111-1307, USA. */
#include "sparc/tm-spc-em.h"
-#include "tm-vxworks.h"
+#include "config/tm-vxworks.h"
/* FIXME: These are almost certainly wrong. */
diff --git a/gdb/config/sparc/xm-sun4sol2.h b/gdb/config/sparc/xm-sun4sol2.h
index b775f7cdba0..490962d4495 100644
--- a/gdb/config/sparc/xm-sun4sol2.h
+++ b/gdb/config/sparc/xm-sun4sol2.h
@@ -21,7 +21,7 @@
/* Pick up more stuff from the generic SVR4 host include file. */
-#include "xm-sysv4.h"
+#include "config/xm-sysv4.h"
/* These are not currently used in SVR4 (but should be, FIXME!). */
#undef DO_DEFERRED_STORES
diff --git a/gdb/config/tm-linux.h b/gdb/config/tm-linux.h
index 938987270b7..caf008a9cb1 100644
--- a/gdb/config/tm-linux.h
+++ b/gdb/config/tm-linux.h
@@ -30,7 +30,7 @@
/* We need this file for the SOLIB_TRAMPOLINE stuff. */
-#include "tm-sysv4.h"
+#include "config/tm-sysv4.h"
/* We define SVR4_SHARED_LIBS unconditionally, on the assumption that
link.h is available on all linux platforms. For I386 and SH3/4,
diff --git a/gdb/config/v850/tm-v850.h b/gdb/config/v850/tm-v850.h
deleted file mode 100644
index c085cb51ca3..00000000000
--- a/gdb/config/v850/tm-v850.h
+++ /dev/null
@@ -1,176 +0,0 @@
-/* Parameters for execution on an NEC V850 processor.
-
- Copyright 1996, 1997, 1998, 1999, 2000, 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. */
-
-#include "regcache.h"
-#include "symtab.h" /* For namespace_enum. */
-#include "symfile.h" /* For entry_point_address(). */
-
-#define NUM_REGS 66
-
-#define REGISTER_NAMES \
-{ "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \
- "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", \
- "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23", \
- "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31", \
- \
- "eipc", "eipsw", "fepc", "fepsw", "ecr", "psw", "sr6", "sr7", \
- "sr8", "sr9", "sr10", "sr11", "sr12", "sr13", "sr14", "sr15", \
- "sr16", "sr17", "sr18", "sr19", "sr20", "sr21", "sr22", "sr23", \
- "sr24", "sr25", "sr26", "sr27", "sr28", "sr29", "sr30", "sr31", \
- \
- "pc", "fp" }
-
-/* Initializer for an array of names of registers.
- Entries beyond the first NUM_REGS are ignored. */
-
-extern char **v850_register_names;
-#define REGISTER_NAME(i) v850_register_names[i]
-
-
-#define REGISTER_BYTES (NUM_REGS * 4)
-
-#define REGISTER_SIZE 4
-#define MAX_REGISTER_RAW_SIZE 4
-
-#define R0_REGNUM 0
-#define R1_REGNUM 1
-#define SAVE1_START_REGNUM 2
-#define SAVE1_END_REGNUM 2
-#define SP_REGNUM 3
-#define ARG0_REGNUM 6
-#define ARGLAST_REGNUM 9
-#define V0_REGNUM 10
-#define V1_REGNUM 11
-#define R12_REGNUM 12
-#define SAVE2_START_REGNUM 20
-#define SAVE2_END_REGNUM 29
-#define EP_REGNUM 30
-#define SAVE3_START_REGNUM 31
-#define SAVE3_END_REGNUM 31
-#define RP_REGNUM 31
-#define SR0_REGNUM 32
-#define PS_REGNUM (SR0_REGNUM+5)
-#define CTBP_REGNUM (SR0_REGNUM+20)
-#define PC_REGNUM 64
-#define FP_REGNUM 65
-#define FP_RAW_REGNUM 29
-
-#define TARGET_READ_FP() read_register (FP_RAW_REGNUM)
-
-#define REGISTER_VIRTUAL_TYPE(REG) builtin_type_int
-
-#define REGISTER_BYTE(REG) ((REG) * 4)
-#define REGISTER_VIRTUAL_SIZE(REG) 4
-#define REGISTER_RAW_SIZE(REG) 4
-
-#define MAX_REGISTER_VIRTUAL_SIZE 4
-
-#define BREAKPOINT {0x85, 0x05} /* little-ended */
-
-#define FUNCTION_START_OFFSET 0
-
-#define DECR_PC_AFTER_BREAK 0
-
-#define INNER_THAN(lhs,rhs) ((lhs) < (rhs))
-
-#define SAVED_PC_AFTER_CALL(fi) read_register (RP_REGNUM)
-
-struct frame_info;
-struct frame_saved_regs;
-struct type;
-struct value;
-
-#define EXTRA_FRAME_INFO struct frame_saved_regs fsr;
-
-extern void v850_init_extra_frame_info (struct frame_info *fi);
-#define INIT_EXTRA_FRAME_INFO(fromleaf, fi) v850_init_extra_frame_info (fi)
-#define INIT_FRAME_PC /* Not necessary */
-
-extern void v850_frame_find_saved_regs (struct frame_info *fi,
- struct frame_saved_regs *regaddr);
-#define FRAME_FIND_SAVED_REGS(fi, regaddr) regaddr = fi->fsr
-
-extern CORE_ADDR v850_frame_chain (struct frame_info *fi);
-#define FRAME_CHAIN(fi) v850_frame_chain (fi)
-#define FRAME_CHAIN_VALID(FP, FI) generic_file_frame_chain_valid (FP, FI)
-
-extern CORE_ADDR v850_find_callers_reg (struct frame_info *fi, int regnum);
-extern CORE_ADDR v850_frame_saved_pc (struct frame_info *);
-#define FRAME_SAVED_PC(FI) (v850_frame_saved_pc (FI))
-
-#define EXTRACT_RETURN_VALUE(TYPE, REGBUF, VALBUF) \
- memcpy (VALBUF, REGBUF + REGISTER_BYTE (V0_REGNUM), TYPE_LENGTH (TYPE))
-
-#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \
- extract_address (REGBUF + REGISTER_BYTE (V0_REGNUM), \
- REGISTER_RAW_SIZE (V0_REGNUM))
-
-#define STORE_RETURN_VALUE(TYPE, VALBUF) \
- write_register_bytes(REGISTER_BYTE (V0_REGNUM), VALBUF, TYPE_LENGTH (TYPE));
-
-extern CORE_ADDR v850_skip_prologue (CORE_ADDR pc);
-#define SKIP_PROLOGUE(pc) (v850_skip_prologue (pc))
-
-#define FRAME_ARGS_SKIP 0
-
-#define FRAME_ARGS_ADDRESS(fi) ((fi)->frame)
-#define FRAME_LOCALS_ADDRESS(fi) ((fi)->frame)
-#define FRAME_NUM_ARGS(fi) (-1)
-
-extern void v850_pop_frame (struct frame_info *frame);
-#define POP_FRAME v850_pop_frame (get_current_frame ())
-
-#define USE_GENERIC_DUMMY_FRAMES 1
-#define CALL_DUMMY {0}
-#define CALL_DUMMY_START_OFFSET (0)
-#define CALL_DUMMY_BREAKPOINT_OFFSET (0)
-#define CALL_DUMMY_LOCATION AT_ENTRY_POINT
-#define FIX_CALL_DUMMY(DUMMY, START, FUNADDR, NARGS, ARGS, TYPE, GCCP)
-#define CALL_DUMMY_ADDRESS() entry_point_address ()
-extern CORE_ADDR v850_push_return_address (CORE_ADDR, CORE_ADDR);
-#define PUSH_RETURN_ADDRESS(PC, SP) v850_push_return_address (PC, SP)
-
-
-#define PUSH_DUMMY_FRAME generic_push_dummy_frame ()
-
-extern CORE_ADDR
-v850_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
- unsigned char struct_return, CORE_ADDR struct_addr);
-#define PUSH_ARGUMENTS(NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR) \
- (v850_push_arguments (NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR))
-
-#define STORE_STRUCT_RETURN(STRUCT_ADDR, SP)
-
-
-#define PC_IN_CALL_DUMMY(PC, SP, FP) generic_pc_in_call_dummy (PC, SP, FP)
-
-extern use_struct_convention_fn v850_use_struct_convention;
-#define USE_STRUCT_CONVENTION(GCC_P, TYPE) v850_use_struct_convention (GCC_P, TYPE);
-
-/* override the default get_saved_register function with
- one that takes account of generic CALL_DUMMY frames */
-#define GET_SAVED_REGISTER(raw_buffer, optimized, addrp, frame, regnum, lval) \
- generic_get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lval)
-
-/* Define this for Wingdb */
-
-#define TARGET_V850
diff --git a/gdb/config/v850/v850.mt b/gdb/config/v850/v850.mt
index 848bc8d043b..867f8e68429 100644
--- a/gdb/config/v850/v850.mt
+++ b/gdb/config/v850/v850.mt
@@ -1,5 +1,5 @@
# Target: NEC V850 processor
TDEPFILES= v850-tdep.o
-TM_FILE= tm-v850.h
+# TM_FILE= tm-v850.h
SIM_OBS = remote-sim.o
SIM = ../sim/v850/libsim.a
diff --git a/gdb/config/z8k/tm-z8k.h b/gdb/config/z8k/tm-z8k.h
index 44058554627..194a257c44f 100644
--- a/gdb/config/z8k/tm-z8k.h
+++ b/gdb/config/z8k/tm-z8k.h
@@ -142,7 +142,7 @@ extern int z8k_saved_pc_after_call (struct frame_info *frame);
as doubles in d0/d1. */
-#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
+#define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
memcpy(VALBUF, REGBUF + REGISTER_BYTE(2), TYPE_LENGTH(TYPE));
/* Write into appropriate registers a function return value
@@ -154,7 +154,7 @@ extern int z8k_saved_pc_after_call (struct frame_info *frame);
the address in which a function should return its structure value,
as a CORE_ADDR (or an expression that can be used as one). */
-#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) (*(CORE_ADDR *)(REGBUF))
+#define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) (*(CORE_ADDR *)(REGBUF))
/* Describe the pointer in each stack frame to the previous stack frame
(its caller). */
diff --git a/gdb/configure.host b/gdb/configure.host
index 511ea76f275..4256db32134 100644
--- a/gdb/configure.host
+++ b/gdb/configure.host
@@ -38,7 +38,8 @@ alpha*-*-freebsd*) gdb_host=fbsd ;;
alpha*-*-netbsd*) gdb_host=nbsd ;;
arm*-*-linux*) gdb_host=linux ;;
-arm*-*-netbsd*) gdb_host=nbsd ;;
+arm*-*-netbsdelf*) gdb_host=nbsdelf ;;
+arm*-*-netbsd*) gdb_host=nbsdaout ;;
arm*-*-*) gdb_host=arm ;;
hppa*-*-bsd*) gdb_host=hppabsd ;;
@@ -58,8 +59,8 @@ i[3456]86-*-bsd*) gdb_host=i386bsd ;;
i[3456]86-*-dgux*) gdb_host=i386dgux ;;
i[3456]86-*-freebsd*) gdb_host=fbsd ;;
i[3456]86-*-netbsdelf*) gdb_host=nbsdelf ;;
-i[3456]86-*-netbsdaout*) gdb_host=nbsd ;;
-i[3456]86-*-netbsd*) gdb_host=nbsd ;;
+i[3456]86-*-netbsdaout*) gdb_host=nbsdaout ;;
+i[3456]86-*-netbsd*) gdb_host=nbsdaout ;;
i[3456]86-*-go32*) gdb_host=go32 ;;
i[3456]86-*-msdosdjgpp*) gdb_host=go32 ;;
i[3456]86-*-linux*) gdb_host=linux ;;
@@ -98,7 +99,7 @@ m68*-hp-bsd*) gdb_host=hp300bsd ;;
m68*-hp-hpux*) gdb_host=hp300hpux ;;
m68*-*-linux*) gdb_host=linux ;;
m68*-*-lynxos*) gdb_host=m68klynx ;;
-m68*-*-netbsd*) gdb_host=nbsd ;;
+m68*-*-netbsd*) gdb_host=nbsdaout ;;
m68*-*-sysv4*) gdb_host=m68kv4 ;;
m68*-motorola-*) gdb_host=delta68 ;;
m68*-sun-sunos3*) gdb_host=sun3os3 ;;
@@ -118,6 +119,7 @@ mips-sgi-irix5*) gdb_host=irix5 ;;
mips-sgi-irix6*) gdb_host=irix6 ;;
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 ;;
@@ -125,7 +127,7 @@ mips-*-riscos*) gdb_host=riscos ;;
none-*-*) gdb_host=none ;;
-ns32k-*-netbsd*) gdb_host=nbsd ;;
+ns32k-*-netbsd*) gdb_host=nbsdaout ;;
powerpc-*-aix*) gdb_host=aix ;;
powerpc-*-linux*) gdb_host=linux ;;
@@ -142,8 +144,8 @@ sh*-*-netbsdelf*) gdb_host=nbsd ;;
sparc-*-linux*) gdb_host=linux ;;
sparc-*-lynxos*) gdb_host=sparclynx ;;
sparc-*-netbsdelf*) gdb_host=nbsdelf ;;
-sparc-*-netbsdaout*) gdb_host=nbsd ;;
-sparc-*-netbsd*) gdb_host=nbsd ;;
+sparc-*-netbsdaout*) gdb_host=nbsdaout ;;
+sparc-*-netbsd*) gdb_host=nbsdaout ;;
sparc-*-solaris2*) gdb_host=sun4sol2 ;;
sparc-*-sunos4*) gdb_host=sun4os4 ;;
sparc-*-sunos5*) gdb_host=sun4sol2 ;;
@@ -151,6 +153,7 @@ sparc-*-*) gdb_host=sun4os4 ;;
sparc64-*-freebsd*|ultrasparc-*-freebsd*|sparcv9-*-freebsd*)
gdb_host=fbsd ;;
sparc64-*-linux*) gdb_host=linux ;;
+sparc64-*-netbsd*) gdb_host=nbsd64 ;;
sparcv9-*-* | sparc64-*-*) gdb_host=sun4sol2 ;;
strongarm-*-*) gdb_host=arm ;;
diff --git a/gdb/configure.tgt b/gdb/configure.tgt
index 322312c5903..129fa49ee8c 100644
--- a/gdb/configure.tgt
+++ b/gdb/configure.tgt
@@ -93,7 +93,7 @@ i[3456]86-*-aix*) gdb_target=i386aix ;;
i[3456]86-*-bsd*) gdb_target=i386bsd ;;
i[3456]86-*-freebsd*) gdb_target=fbsd ;;
i[3456]86-*-netbsdelf*) gdb_target=nbsdelf ;;
-i[3456]86-*-netbsd*) gdb_target=nbsd ;;
+i[3456]86-*-netbsd*) gdb_target=nbsdaout ;;
i[3456]86-*-os9k) gdb_target=i386os9k ;;
i[3456]86-*-go32*) gdb_target=i386aout ;;
i[3456]86-*-msdosdjgpp*) gdb_target=go32 ;;
@@ -157,7 +157,7 @@ m68*-*-linux*) gdb_target=linux
build_gdbserver=yes
;;
m68*-*-lynxos*) gdb_target=m68klynx ;;
-m68*-*-netbsd*) gdb_target=nbsd ;;
+m68*-*-netbsd*) gdb_target=nbsdaout ;;
m68*-*-os68k*) gdb_target=os68k ;;
m68*-*-sunos3*) gdb_target=sun3os3 ;;
m68*-*-sunos4*) gdb_target=sun3os4 ;;
@@ -201,6 +201,7 @@ mips*-sony-*) gdb_target=bigmips ;;
mips*-*-linux*) gdb_target=linux
build_gdbserver=yes
;;
+mips*-*-netbsd*) gdb_target=nbsd ;;
mips*-*-mach3*) gdb_target=mipsm3 ;;
mips*-*-sysv4*) gdb_target=mipsv4 ;;
mips*-*-sysv*) gdb_target=bigmips ;;
@@ -212,7 +213,7 @@ mn10300-*-*) gdb_target=mn10300 ;;
none-*-*) gdb_target=none ;;
-ns32k-*-netbsd*) gdb_target=nbsd ;;
+ns32k-*-netbsd*) gdb_target=nbsdaout ;;
powerpc-*-netbsd*) gdb_target=nbsd ;;
powerpc-*-aix*) gdb_target=aix ;;
@@ -276,6 +277,7 @@ sparc86x-*-*) gdb_target=sparclite ;;
sparc64-*-freebsd*|ultrasparc-*-freebsd*|sparcv9-*-freebsd*)
gdb_target=fbsd ;;
sparc64-*-linux*) gdb_target=sp64linux ;;
+sparc64-*-netbsd*) gdb_target=nbsd64 ;;
sparcv9-*-* | sparc64-*-*) gdb_target=sp64 ;;
xstormy16-*-*) gdb_target=xstormy16 ;;
@@ -310,5 +312,6 @@ d10v) gdb_multi_arch=yes ;;
m68hc11) gdb_multi_arch=yes ;;
mn10300) gdb_multi_arch=yes ;;
x86-64linux) gdb_multi_arch=yes ;;
+v850) gdb_multi_arch=yes ;;
xstormy16) gdb_multi_arch=yes ;;
esac
diff --git a/gdb/corefile.c b/gdb/corefile.c
index 29eeac87ebe..4f6eef2ce72 100644
--- a/gdb/corefile.c
+++ b/gdb/corefile.c
@@ -260,7 +260,10 @@ dis_asm_print_address (bfd_vma addr, struct disassemble_info *info)
print_address (addr, info->stream);
}
-/* Read an integer from debugged memory, given address and number of bytes. */
+/* Argument / return result struct for use with
+ do_captured_read_memory_integer(). MEMADDR and LEN are filled in
+ by gdb_read_memory_integer(). RESULT is the contents that were
+ successfully read from MEMADDR of length LEN. */
struct captured_read_memory_integer_arguments
{
@@ -269,6 +272,13 @@ struct captured_read_memory_integer_arguments
LONGEST result;
};
+/* Helper function for gdb_read_memory_integer(). DATA must be a
+ pointer to a captured_read_memory_integer_arguments struct.
+ Return 1 if successful. Note that the catch_errors() interface
+ will return 0 if an error occurred while reading memory. This
+ choice of return code is so that we can distinguish between
+ success and failure. */
+
static int
do_captured_read_memory_integer (void *data)
{
@@ -278,9 +288,13 @@ do_captured_read_memory_integer (void *data)
args->result = read_memory_integer (memaddr, len);
- return 0;
+ return 1;
}
+/* Read memory at MEMADDR of length LEN and put the contents in
+ RETURN_VALUE. Return 0 if MEMADDR couldn't be read and non-zero
+ if successful. */
+
int
safe_read_memory_integer (CORE_ADDR memaddr, int len, LONGEST *return_value)
{
@@ -291,7 +305,7 @@ safe_read_memory_integer (CORE_ADDR memaddr, int len, LONGEST *return_value)
status = catch_errors (do_captured_read_memory_integer, &args,
"", RETURN_MASK_ALL);
- if (!status)
+ if (status)
*return_value = args.result;
return status;
diff --git a/gdb/corelow.c b/gdb/corelow.c
index 657cdc8ffc9..785b8e14323 100644
--- a/gdb/corelow.c
+++ b/gdb/corelow.c
@@ -321,7 +321,12 @@ core_open (char *filename, int from_tty)
error ("\"%s\": Can't find sections: %s",
bfd_get_filename (core_bfd), bfd_errmsg (bfd_get_error ()));
- set_gdbarch_from_file (core_bfd);
+ /* If we have no exec file, try to set the architecture from the
+ core file. We don't do this unconditionally since an exec file
+ typically contains more information that helps us determine the
+ architecture than a core file. */
+ if (!exec_bfd)
+ set_gdbarch_from_file (core_bfd);
ontop = !push_target (&core_ops);
discard_cleanups (old_chain);
diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c
index e85ac129f33..b28d3bb83f7 100644
--- a/gdb/cris-tdep.c
+++ b/gdb/cris-tdep.c
@@ -4163,7 +4163,7 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_push_arguments (gdbarch, cris_abi_original_push_arguments);
set_gdbarch_store_return_value (gdbarch,
cris_abi_original_store_return_value);
- set_gdbarch_extract_return_value
+ set_gdbarch_deprecated_extract_return_value
(gdbarch, cris_abi_original_extract_return_value);
set_gdbarch_reg_struct_has_addr
(gdbarch, cris_abi_original_reg_struct_has_addr);
@@ -4173,8 +4173,8 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_double_bit (gdbarch, 64);
set_gdbarch_push_arguments (gdbarch, cris_abi_v2_push_arguments);
set_gdbarch_store_return_value (gdbarch, cris_abi_v2_store_return_value);
- set_gdbarch_extract_return_value (gdbarch,
- cris_abi_v2_extract_return_value);
+ set_gdbarch_deprecated_extract_return_value
+ (gdbarch, cris_abi_v2_extract_return_value);
set_gdbarch_reg_struct_has_addr (gdbarch,
cris_abi_v2_reg_struct_has_addr);
}
@@ -4297,8 +4297,8 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_pop_frame (gdbarch, cris_pop_frame);
set_gdbarch_store_struct_return (gdbarch, cris_store_struct_return);
- set_gdbarch_extract_struct_value_address (gdbarch,
- cris_extract_struct_value_address);
+ set_gdbarch_deprecated_extract_struct_value_address
+ (gdbarch, cris_extract_struct_value_address);
set_gdbarch_use_struct_convention (gdbarch, cris_use_struct_convention);
set_gdbarch_frame_init_saved_regs (gdbarch, cris_frame_init_saved_regs);
diff --git a/gdb/d10v-tdep.c b/gdb/d10v-tdep.c
index 58600fb92ea..4fe1c6228be 100644
--- a/gdb/d10v-tdep.c
+++ b/gdb/d10v-tdep.c
@@ -40,7 +40,8 @@
#include "regcache.h"
#include "floatformat.h"
-#include "sim-d10v.h"
+#include "gdb/sim-d10v.h"
+#include "sim-regno.h"
struct frame_extra_info
{
@@ -60,33 +61,44 @@ struct gdbarch_tdep
/* These are the addresses the D10V-EVA board maps data and
instruction memory to. */
-#define DMEM_START 0x2000000
-#define IMEM_START 0x1000000
-#define STACK_START 0x200bffe
+enum memspace {
+ DMEM_START = 0x2000000,
+ IMEM_START = 0x1000000,
+ STACK_START = 0x200bffe
+};
/* d10v register names. */
enum
{
R0_REGNUM = 0,
+ R3_REGNUM = 3,
+ _FP_REGNUM = 11,
LR_REGNUM = 13,
+ _SP_REGNUM = 15,
PSW_REGNUM = 16,
+ _PC_REGNUM = 18,
NR_IMAP_REGS = 2,
- NR_A_REGS = 2
+ NR_A_REGS = 2,
+ TS2_NUM_REGS = 37,
+ TS3_NUM_REGS = 42,
+ /* d10v calling convention. */
+ ARG1_REGNUM = R0_REGNUM,
+ ARGN_REGNUM = R3_REGNUM,
+ RET1_REGNUM = R0_REGNUM,
};
+
#define NR_DMAP_REGS (gdbarch_tdep (current_gdbarch)->nr_dmap_regs)
#define A0_REGNUM (gdbarch_tdep (current_gdbarch)->a0_regnum)
-/* d10v calling convention. */
-
-#define ARG1_REGNUM R0_REGNUM
-#define ARGN_REGNUM 3
-#define RET1_REGNUM R0_REGNUM
-
/* Local functions */
extern void _initialize_d10v_tdep (void);
+static CORE_ADDR d10v_read_sp (void);
+
+static CORE_ADDR d10v_read_fp (void);
+
static void d10v_eva_prepare_to_trace (void);
static void d10v_eva_get_trace_data (void);
@@ -101,9 +113,14 @@ static void do_d10v_pop_frame (struct frame_info *fi);
static int
d10v_frame_chain_valid (CORE_ADDR chain, struct frame_info *frame)
{
- return ((chain) != 0 && (frame) != 0
- && (frame)->pc > IMEM_START
- && !inside_entry_file (FRAME_SAVED_PC (frame)));
+ if (chain != 0 && frame != NULL)
+ {
+ if (PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame))
+ return 1; /* Path back from a call dummy must be valid. */
+ return ((frame)->pc > IMEM_START
+ && !inside_main_func (frame->pc));
+ }
+ else return 0;
}
static CORE_ADDR
@@ -284,6 +301,8 @@ d10v_imap_register (int reg_nr)
static int
d10v_ts2_register_sim_regno (int nr)
{
+ if (legacy_register_sim_regno (nr) < 0)
+ return legacy_register_sim_regno (nr);
if (nr >= TS2_IMAP0_REGNUM
&& nr < TS2_IMAP0_REGNUM + NR_IMAP_REGS)
return nr - TS2_IMAP0_REGNUM + SIM_D10V_IMAP0_REGNUM;
@@ -298,6 +317,8 @@ d10v_ts2_register_sim_regno (int nr)
static int
d10v_ts3_register_sim_regno (int nr)
{
+ if (legacy_register_sim_regno (nr) < 0)
+ return legacy_register_sim_regno (nr);
if (nr >= TS3_IMAP0_REGNUM
&& nr < TS3_IMAP0_REGNUM + NR_IMAP_REGS)
return nr - TS3_IMAP0_REGNUM + SIM_D10V_IMAP0_REGNUM;
@@ -349,6 +370,8 @@ d10v_register_virtual_type (int reg_nr)
{
if (reg_nr == PC_REGNUM)
return builtin_type_void_func_ptr;
+ if (reg_nr == _SP_REGNUM || reg_nr == _FP_REGNUM)
+ return builtin_type_void_data_ptr;
else if (reg_nr >= A0_REGNUM
&& reg_nr < (A0_REGNUM + NR_A_REGS))
return builtin_type_int64;
@@ -427,20 +450,16 @@ d10v_pointer_to_address (struct type *type, void *buf)
return d10v_make_daddr (addr);
}
+/* Don't do anything if we have an integer, this way users can type 'x
+ <addr>' w/o having gdb outsmart them. The internal gdb conversions
+ to the correct space are taken care of in the pointer_to_address
+ function. If we don't do this, 'x $fp' wouldn't work. */
static CORE_ADDR
d10v_integer_to_address (struct type *type, void *buf)
{
LONGEST val;
val = unpack_long (type, buf);
- if (TYPE_CODE (type) == TYPE_CODE_INT
- && TYPE_LENGTH (type) <= TYPE_LENGTH (builtin_type_void_data_ptr))
- /* Convert small integers that would would be directly copied into
- a pointer variable into an address pointing into data space. */
- return d10v_make_daddr (val & 0xffff);
- else
- /* The value is too large to fit in a pointer. Assume this was
- intentional and that the user in fact specified a raw address. */
- return val;
+ return val;
}
/* Store the address of the place in which to copy the structure the
@@ -463,9 +482,20 @@ d10v_store_struct_return (CORE_ADDR addr, CORE_ADDR sp)
static void
d10v_store_return_value (struct type *type, char *valbuf)
{
- write_register_bytes (REGISTER_BYTE (RET1_REGNUM),
- valbuf,
- TYPE_LENGTH (type));
+ char tmp = 0;
+ /* Only char return values need to be shifted right within R0. */
+ if (TYPE_LENGTH (type) == 1
+ && TYPE_CODE (type) == TYPE_CODE_INT)
+ {
+ write_register_bytes (REGISTER_BYTE (RET1_REGNUM),
+ &tmp, 1); /* zero the high byte */
+ write_register_bytes (REGISTER_BYTE (RET1_REGNUM) + 1,
+ valbuf, 1); /* copy the low byte */
+ }
+ else
+ write_register_bytes (REGISTER_BYTE (RET1_REGNUM),
+ valbuf,
+ TYPE_LENGTH (type));
}
/* Extract from an array REGBUF containing the (raw) register state
@@ -483,7 +513,12 @@ d10v_extract_struct_value_address (char *regbuf)
static CORE_ADDR
d10v_frame_saved_pc (struct frame_info *frame)
{
- return ((frame)->extra_info->return_pc);
+ if (PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame))
+ return d10v_make_iaddr (generic_read_register_dummy (frame->pc,
+ frame->frame,
+ PC_REGNUM));
+ else
+ return ((frame)->extra_info->return_pc);
}
/* Immediately after a function call, return the saved pc. We can't
@@ -650,11 +685,23 @@ d10v_skip_prologue (CORE_ADDR pc)
static CORE_ADDR
d10v_frame_chain (struct frame_info *fi)
{
+ CORE_ADDR addr;
+
+ /* A generic call dummy's frame is the same as caller's. */
+ if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame))
+ return fi->frame;
+
d10v_frame_init_saved_regs (fi);
+
if (fi->extra_info->return_pc == IMEM_START
|| inside_entry_file (fi->extra_info->return_pc))
- return (CORE_ADDR) 0;
+ {
+ /* This is meant to halt the backtrace at "_start".
+ Make sure we don't halt it at a generic dummy frame. */
+ if (!PC_IN_CALL_DUMMY (fi->extra_info->return_pc, 0, 0))
+ return (CORE_ADDR) 0;
+ }
if (!fi->saved_regs[FP_REGNUM])
{
@@ -665,12 +712,12 @@ d10v_frame_chain (struct frame_info *fi)
return fi->saved_regs[SP_REGNUM];
}
- if (!read_memory_unsigned_integer (fi->saved_regs[FP_REGNUM],
- REGISTER_RAW_SIZE (FP_REGNUM)))
+ addr = read_memory_unsigned_integer (fi->saved_regs[FP_REGNUM],
+ REGISTER_RAW_SIZE (FP_REGNUM));
+ if (addr == 0)
return (CORE_ADDR) 0;
- return d10v_make_daddr (read_memory_unsigned_integer (fi->saved_regs[FP_REGNUM],
- REGISTER_RAW_SIZE (FP_REGNUM)));
+ return d10v_make_daddr (addr);
}
static int next_addr, uses_frame;
@@ -804,7 +851,8 @@ d10v_frame_init_saved_regs (struct frame_info *fi)
op1 = (op & 0x3FFF8000) >> 15;
op2 = op & 0x7FFF;
}
- if (!prologue_find_regs (op1, fi, pc) || !prologue_find_regs (op2, fi, pc))
+ if (!prologue_find_regs (op1, fi, pc)
+ || !prologue_find_regs (op2, fi, pc))
break;
}
pc += 4;
@@ -813,7 +861,7 @@ d10v_frame_init_saved_regs (struct frame_info *fi)
fi->extra_info->size = -next_addr;
if (!(fp & 0xffff))
- fp = d10v_make_daddr (read_register (SP_REGNUM));
+ fp = d10v_read_sp ();
for (i = 0; i < NUM_REGS - 1; i++)
if (fi->saved_regs[i])
@@ -823,7 +871,9 @@ d10v_frame_init_saved_regs (struct frame_info *fi)
if (fi->saved_regs[LR_REGNUM])
{
- CORE_ADDR return_pc = read_memory_unsigned_integer (fi->saved_regs[LR_REGNUM], REGISTER_RAW_SIZE (LR_REGNUM));
+ CORE_ADDR return_pc
+ = read_memory_unsigned_integer (fi->saved_regs[LR_REGNUM],
+ REGISTER_RAW_SIZE (LR_REGNUM));
fi->extra_info->return_pc = d10v_make_iaddr (return_pc);
}
else
@@ -831,13 +881,14 @@ d10v_frame_init_saved_regs (struct frame_info *fi)
fi->extra_info->return_pc = d10v_make_iaddr (read_register (LR_REGNUM));
}
- /* th SP is not normally (ever?) saved, but check anyway */
+ /* The SP is not normally (ever?) saved, but check anyway */
if (!fi->saved_regs[SP_REGNUM])
{
/* if the FP was saved, that means the current FP is valid, */
/* otherwise, it isn't being used, so we use the SP instead */
if (uses_frame)
- fi->saved_regs[SP_REGNUM] = read_register (FP_REGNUM) + fi->extra_info->size;
+ fi->saved_regs[SP_REGNUM]
+ = d10v_read_fp () + fi->extra_info->size;
else
{
fi->saved_regs[SP_REGNUM] = fp + fi->extra_info->size;
@@ -858,6 +909,12 @@ d10v_init_extra_frame_info (int fromleaf, struct frame_info *fi)
fi->extra_info->size = 0;
fi->extra_info->return_pc = 0;
+ /* If fi->pc is zero, but this is not the outermost frame,
+ then let's snatch the return_pc from the callee, so that
+ PC_IN_CALL_DUMMY will work. */
+ if (fi->pc == 0 && fi->level != 0 && fi->next != NULL)
+ fi->pc = d10v_frame_saved_pc (fi->next);
+
/* The call dummy doesn't save any registers on the stack, so we can
return now. */
if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame))
@@ -1029,6 +1086,15 @@ d10v_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
int i;
int regnum = ARG1_REGNUM;
struct stack_item *si = NULL;
+ long val;
+
+ /* If struct_return is true, then the struct return address will
+ consume one argument-passing register. No need to actually
+ write the value to the register -- that's done by
+ d10v_store_struct_return(). */
+
+ if (struct_return)
+ regnum++;
/* Fill in registers and arg lists */
for (i = 0; i < nargs; i++)
@@ -1037,39 +1103,38 @@ d10v_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
struct type *type = check_typedef (VALUE_TYPE (arg));
char *contents = VALUE_CONTENTS (arg);
int len = TYPE_LENGTH (type);
+ int aligned_regnum = (regnum + 1) & ~1;
+
/* printf ("push: type=%d len=%d\n", TYPE_CODE (type), len); */
+ if (len <= 2 && regnum <= ARGN_REGNUM)
+ /* fits in a single register, do not align */
+ {
+ val = extract_unsigned_integer (contents, len);
+ write_register (regnum++, val);
+ }
+ else if (len <= (ARGN_REGNUM - aligned_regnum + 1) * 2)
+ /* value fits in remaining registers, store keeping left
+ aligned */
{
- int aligned_regnum = (regnum + 1) & ~1;
- if (len <= 2 && regnum <= ARGN_REGNUM)
- /* fits in a single register, do not align */
+ int b;
+ regnum = aligned_regnum;
+ for (b = 0; b < (len & ~1); b += 2)
{
- long val = extract_unsigned_integer (contents, len);
+ val = extract_unsigned_integer (&contents[b], 2);
write_register (regnum++, val);
}
- else if (len <= (ARGN_REGNUM - aligned_regnum + 1) * 2)
- /* value fits in remaining registers, store keeping left
- aligned */
+ if (b < len)
{
- int b;
- regnum = aligned_regnum;
- for (b = 0; b < (len & ~1); b += 2)
- {
- long val = extract_unsigned_integer (&contents[b], 2);
- write_register (regnum++, val);
- }
- if (b < len)
- {
- long val = extract_unsigned_integer (&contents[b], 1);
- write_register (regnum++, (val << 8));
- }
- }
- else
- {
- /* arg will go onto stack */
- regnum = ARGN_REGNUM + 1;
- si = push_stack_item (si, contents, len);
+ val = extract_unsigned_integer (&contents[b], 1);
+ write_register (regnum++, (val << 8));
}
}
+ else
+ {
+ /* arg will go onto stack */
+ regnum = ARGN_REGNUM + 1;
+ si = push_stack_item (si, contents, len);
+ }
}
while (si)
@@ -1091,25 +1156,31 @@ d10v_extract_return_value (struct type *type, char regbuf[REGISTER_BYTES],
char *valbuf)
{
int len;
- /* printf("RET: TYPE=%d len=%d r%d=0x%x\n", TYPE_CODE (type), TYPE_LENGTH (type), RET1_REGNUM - R0_REGNUM, (int) extract_unsigned_integer (regbuf + REGISTER_BYTE(RET1_REGNUM), REGISTER_RAW_SIZE (RET1_REGNUM))); */
+#if 0
+ printf("RET: TYPE=%d len=%d r%d=0x%x\n", TYPE_CODE (type),
+ TYPE_LENGTH (type), RET1_REGNUM - R0_REGNUM,
+ (int) extract_unsigned_integer (regbuf + REGISTER_BYTE(RET1_REGNUM),
+ REGISTER_RAW_SIZE (RET1_REGNUM)));
+#endif
+ len = TYPE_LENGTH (type);
+ if (len == 1)
{
- len = TYPE_LENGTH (type);
- if (len == 1)
- {
- unsigned short c = extract_unsigned_integer (regbuf + REGISTER_BYTE (RET1_REGNUM), REGISTER_RAW_SIZE (RET1_REGNUM));
- store_unsigned_integer (valbuf, 1, c);
- }
- else if ((len & 1) == 0)
- memcpy (valbuf, regbuf + REGISTER_BYTE (RET1_REGNUM), len);
- else
- {
- /* For return values of odd size, the first byte is in the
- least significant part of the first register. The
- remaining bytes in remaining registers. Interestingly,
- when such values are passed in, the last byte is in the
- most significant byte of that same register - wierd. */
- memcpy (valbuf, regbuf + REGISTER_BYTE (RET1_REGNUM) + 1, len);
- }
+ unsigned short c;
+
+ c = extract_unsigned_integer (regbuf + REGISTER_BYTE (RET1_REGNUM),
+ REGISTER_RAW_SIZE (RET1_REGNUM));
+ store_unsigned_integer (valbuf, 1, c);
+ }
+ else if ((len & 1) == 0)
+ memcpy (valbuf, regbuf + REGISTER_BYTE (RET1_REGNUM), len);
+ else
+ {
+ /* For return values of odd size, the first byte is in the
+ least significant part of the first register. The
+ remaining bytes in remaining registers. Interestingly,
+ when such values are passed in, the last byte is in the
+ most significant byte of that same register - wierd. */
+ memcpy (valbuf, regbuf + REGISTER_BYTE (RET1_REGNUM) + 1, len);
}
}
@@ -1536,14 +1607,14 @@ d10v_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_get_saved_register (gdbarch, generic_get_saved_register);
set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy);
- set_gdbarch_extract_return_value (gdbarch, d10v_extract_return_value);
+ set_gdbarch_deprecated_extract_return_value (gdbarch, d10v_extract_return_value);
set_gdbarch_push_arguments (gdbarch, d10v_push_arguments);
set_gdbarch_push_dummy_frame (gdbarch, generic_push_dummy_frame);
set_gdbarch_push_return_address (gdbarch, d10v_push_return_address);
set_gdbarch_store_struct_return (gdbarch, d10v_store_struct_return);
set_gdbarch_store_return_value (gdbarch, d10v_store_return_value);
- set_gdbarch_extract_struct_value_address (gdbarch, d10v_extract_struct_value_address);
+ set_gdbarch_deprecated_extract_struct_value_address (gdbarch, d10v_extract_struct_value_address);
set_gdbarch_use_struct_convention (gdbarch, d10v_use_struct_convention);
set_gdbarch_frame_init_saved_regs (gdbarch, d10v_frame_init_saved_regs);
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog
index bb46be3bb21..4d1fbb581f7 100644
--- a/gdb/doc/ChangeLog
+++ b/gdb/doc/ChangeLog
@@ -1,3 +1,50 @@
+2002-06-11 Jim Blandy <jimb@redhat.com>
+
+ * gdb.texinfo (Symbols): Update documentation for `info source'
+ command.
+
+ * gdb.texinfo (Macros): Call the command `info macro', not
+ `show macro'.
+
+2002-06-09 Andrew Cagney <ac131313@redhat.com>
+
+ * gdbint.texinfo (Coding): Add section ``Per-architecture module
+ data''.
+
+2002-06-09 Mark Kettenis <kettenis@gnu.org>
+
+ * gdbint.texinfo (Target Architecture Definition): Document
+ GDB_OSABI_GO32 and GDB_OSABI_NETWARE.
+
+2002-06-08 Andrew Cagney <ac131313@redhat.com>
+
+ * gdbint.texinfo (Releasing GDB): Fix typos in @itemize @bullet
+ lists.
+
+2002-06-08 Andrew Cagney <ac131313@redhat.com>
+
+ * gdbint.texinfo (Releasing GDB): Revise the section ``Cut the
+ Branch''.
+
+2002-06-01 Andrew Cagney <ac131313@redhat.com>
+
+ * gdbint.texinfo (Target Architecture Definition): Add section
+ ``Converting an existing Target Architecture to Multi-arch''.
+
+2002-05-30 Andrew Cagney <ac131313@redhat.com>
+
+ * gdbint.texinfo (Releasing GDB): Rename ``Obsoleting any code''
+ to ``Obsoleting code''. Revise.
+
+2002-05-17 Jim Blandy <jimb@redhat.com>
+
+ * gdb.texinfo (C Preprocessor Macros): New chapter.
+ Include it in the main menu.
+ (Contributors): Credit Jim Blandy with macro support.
+ (Compilation): Explain how to get macro information into the
+ executable.
+ (Expressions): Note that preprocessor macros are expanded.
+
2002-05-14 Daniel Jacobowitz <drow@mvista.com>
* gdb.texinfo (Debug Session): Document new `udp:' and `tcp:'
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 1080b8b44f8..aa39d767530 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -128,6 +128,7 @@ Copyright (C) 1988-2002 Free Software Foundation, Inc.
* Stack:: Examining the stack
* Source:: Examining source files
* Data:: Examining data
+* Macros:: Preprocessor Macros
* Tracepoints:: Debugging remote targets non-intrusively
* Overlays:: Debugging programs that use overlays
@@ -462,6 +463,8 @@ Romig-Koch, Rob Savoye, Jamie Smith, Mike Stump, Ian Taylor, Angela
Thomas, Michael Tiemann, Tom Tromey, Ron Unrau, Jim Wilson, and David
Zuhn have made contributions both large and small.
+Jim Blandy added support for preprocessor macros, while working for Red
+Hat.
@node Sample Session
@chapter A Sample @value{GDBN} Session
@@ -1609,6 +1612,16 @@ and addresses in the executable code.
To request debugging information, specify the @samp{-g} option when you run
the compiler.
+Most compilers do not include information about preprocessor macros in
+the debugging information if you specify the @option{-g} flag alone,
+because this information is rather large. Version 3.1 of @value{NGCC},
+the @sc{gnu} C compiler, provides macro information if you specify the
+options @option{-gdwarf-2} and @option{-g3}; the former option requests
+debugging information in the Dwarf 2 format, and the latter requests
+``extra information''. In the future, we hope to find more compact ways
+to represent macro information, so that it can be included with
+@option{-g} alone.
+
Many C compilers are unable to handle the @samp{-g} and @samp{-O}
options together. Using those compilers, you cannot generate optimized
executables containing debugging information.
@@ -4414,9 +4427,10 @@ Table}.
@code{print} and many other @value{GDBN} commands accept an expression and
compute its value. Any kind of constant, variable or operator defined
by the programming language you are using is valid in an expression in
-@value{GDBN}. This includes conditional expressions, function calls, casts
-and string constants. It unfortunately does not include symbols defined
-by preprocessor @code{#define} commands.
+@value{GDBN}. This includes conditional expressions, function calls,
+casts, and string constants. It also includes preprocessor macros, if
+you compiled your program to include this information; see
+@ref{Compilation}.
@value{GDBN} supports array constants in expressions input by
the user. The syntax is @{@var{element}, @var{element}@dots{}@}. For example,
@@ -5774,6 +5788,230 @@ the @var{bias} argument is applied.
@end table
+@node Macros
+@chapter C Preprocessor Macros
+
+Some languages, such as C and C++, provide a way to define and invoke
+``preprocessor macros'' which expand into strings of tokens.
+@value{GDBN} can evaluate expressions containing macro invocations, show
+the result of macro expansion, and show a macro's definition, including
+where it was defined.
+
+You may need to compile your program specially to provide @value{GDBN}
+with information about preprocessor macros. Most compilers do not
+include macros in their debugging information, even when you compile
+with the @option{-g} flag. @xref{Compilation}.
+
+A program may define a macro at one point, remove that definition later,
+and then provide a different definition after that. Thus, at different
+points in the program, a macro may have different definitions, or have
+no definition at all. If there is a current stack frame, @value{GDBN}
+uses the macros in scope at that frame's source code line. Otherwise,
+@value{GDBN} uses the macros in scope at the current listing location;
+see @ref{List}.
+
+At the moment, @value{GDBN} does not support the @code{##}
+token-splicing operator, the @code{#} stringification operator, or
+variable-arity macros.
+
+Whenever @value{GDBN} evaluates an expression, it always expands any
+macro invocations present in the expression. @value{GDBN} also provides
+the following commands for working with macros explicitly.
+
+@table @code
+
+@kindex macro expand
+@cindex macro expansion, showing the results of preprocessor
+@cindex preprocessor macro expansion, showing the results of
+@cindex expanding preprocessor macros
+@item macro expand @var{expression}
+@itemx macro exp @var{expression}
+Show the results of expanding all preprocessor macro invocations in
+@var{expression}. Since @value{GDBN} simply expands macros, but does
+not parse the result, @var{expression} need not be a valid expression;
+it can be any string of tokens.
+
+@kindex macro expand-once
+@item macro expand-once @var{expression}
+@itemx macro exp1 @var{expression}
+@i{(This command is not yet implemented.)} Show the results of
+expanding those preprocessor macro invocations that appear explicitly in
+@var{expression}. Macro invocations appearing in that expansion are
+left unchanged. This command allows you to see the effect of a
+particular macro more clearly, without being confused by further
+expansions. Since @value{GDBN} simply expands macros, but does not
+parse the result, @var{expression} need not be a valid expression; it
+can be any string of tokens.
+
+@kindex info macro
+@cindex macro definition, showing
+@cindex definition, showing a macro's
+@item info macro @var{macro}
+Show the definition of the macro named @var{macro}, and describe the
+source location where that definition was established.
+
+@kindex macro define
+@cindex user-defined macros
+@cindex defining macros interactively
+@cindex macros, user-defined
+@item macro define @var{macro} @var{replacement-list}
+@itemx macro define @var{macro}(@var{arglist}) @var{replacement-list}
+@i{(This command is not yet implemented.)} Introduce a definition for a
+preprocessor macro named @var{macro}, invocations of which are replaced
+by the tokens given in @var{replacement-list}. The first form of this
+command defines an ``object-like'' macro, which takes no arguments; the
+second form defines a ``function-like'' macro, which takes the arguments
+given in @var{arglist}.
+
+A definition introduced by this command is in scope in every expression
+evaluated in @value{GDBN}, until it is removed with the @command{macro
+undef} command, described below. The definition overrides all
+definitions for @var{macro} present in the program being debugged, as
+well as any previous user-supplied definition.
+
+@kindex macro undef
+@item macro undef @var{macro}
+@i{(This command is not yet implemented.)} Remove any user-supplied
+definition for the macro named @var{macro}. This command only affects
+definitions provided with the @command{macro define} command, described
+above; it cannot remove definitions present in the program being
+debugged.
+
+@end table
+
+@cindex macros, example of debugging with
+Here is a transcript showing the above commands in action. First, we
+show our source files:
+
+@smallexample
+$ cat sample.c
+#include <stdio.h>
+#include "sample.h"
+
+#define M 42
+#define ADD(x) (M + x)
+
+main ()
+@{
+#define N 28
+ printf ("Hello, world!\n");
+#undef N
+ printf ("We're so creative.\n");
+#define N 1729
+ printf ("Goodbye, world!\n");
+@}
+$ cat sample.h
+#define Q <
+$
+@end smallexample
+
+Now, we compile the program using the @sc{gnu} C compiler, @value{NGCC}.
+We pass the @option{-gdwarf-2} and @option{-g3} flags to ensure the
+compiler includes information about preprocessor macros in the debugging
+information.
+
+@smallexample
+$ gcc -gdwarf-2 -g3 sample.c -o sample
+$
+@end smallexample
+
+Now, we start @value{GDBN} on our sample program:
+
+@smallexample
+$ gdb -nw sample
+GNU gdb 2002-05-06-cvs
+Copyright 2002 Free Software Foundation, Inc.
+GDB is free software, @dots{}
+(gdb)
+@end smallexample
+
+We can expand macros and examine their definitions, even when the
+program is not running. @value{GDBN} uses the current listing position
+to decide which macro definitions are in scope:
+
+@smallexample
+(gdb) list main
+3
+4 #define M 42
+5 #define ADD(x) (M + x)
+6
+7 main ()
+8 @{
+9 #define N 28
+10 printf ("Hello, world!\n");
+11 #undef N
+12 printf ("We're so creative.\n");
+(gdb) info macro ADD
+Defined at /home/jimb/gdb/macros/play/sample.c:5
+#define ADD(x) (M + x)
+(gdb) info macro Q
+Defined at /home/jimb/gdb/macros/play/sample.h:1
+ included at /home/jimb/gdb/macros/play/sample.c:2
+#define Q <
+(gdb) macro expand ADD(1)
+expands to: (42 + 1)
+(gdb) macro expand-once ADD(1)
+expands to: once (M + 1)
+(gdb)
+@end smallexample
+
+In the example above, note that @command{macro expand-once} expands only
+the macro invocation explicit in the original text --- the invocation of
+@code{ADD} --- but does not expand the invocation of the macro @code{M},
+which was introduced by @code{ADD}.
+
+Once the program is running, GDB uses the macro definitions in force at
+the source line of the current stack frame:
+
+@smallexample
+(gdb) break main
+Breakpoint 1 at 0x8048370: file sample.c, line 10.
+(gdb) run
+Starting program: /home/jimb/gdb/macros/play/sample
+
+Breakpoint 1, main () at sample.c:10
+10 printf ("Hello, world!\n");
+(gdb)
+@end smallexample
+
+At line 10, the definition of the macro @code{N} at line 9 is in force:
+
+@smallexample
+(gdb) info macro N
+Defined at /home/jimb/gdb/macros/play/sample.c:9
+#define N 28
+(gdb) macro expand N Q M
+expands to: 28 < 42
+(gdb) print N Q M
+$1 = 1
+(gdb)
+@end smallexample
+
+As we step over directives that remove @code{N}'s definition, and then
+give it a new definition, @value{GDBN} finds the definition (or lack
+thereof) in force at each point:
+
+@smallexample
+(gdb) next
+Hello, world!
+12 printf ("We're so creative.\n");
+(gdb) info macro N
+The symbol `N' has no definition as a C/C++ preprocessor macro
+at /home/jimb/gdb/macros/play/sample.c:12
+(gdb) next
+We're so creative.
+14 printf ("Goodbye, world!\n");
+(gdb) info macro N
+Defined at /home/jimb/gdb/macros/play/sample.c:13
+#define N 1729
+(gdb) macro expand N Q M
+expands to: 1729 < 42
+(gdb) print N Q M
+$2 = 0
+(gdb)
+@end smallexample
+
+
@node Tracepoints
@chapter Tracepoints
@c This chapter is based on the documentation written by Michael
@@ -8782,9 +9020,25 @@ collect}.
@kindex info source
@item info source
-Show the name of the current source file---that is, the source file for
-the function containing the current point of execution---and the language
-it was written in.
+Show information about the current source file---that is, the source file for
+the function containing the current point of execution:
+@itemize @bullet
+@item
+the name of the source file, and the directory containing it,
+@item
+the directory it was compiled in,
+@item
+its length, in lines,
+@item
+which programming language it is written in,
+@item
+whether the executable includes debugging information for that file, and
+if so, what format the information is in (e.g., STABS, Dwarf 2, etc.), and
+@item
+whether the debugging information includes information about
+preprocessor macros.
+@end itemize
+
@kindex info sources
@item info sources
diff --git a/gdb/doc/gdbint.texinfo b/gdb/doc/gdbint.texinfo
index f6e50ef088c..578a8ad5166 100644
--- a/gdb/doc/gdbint.texinfo
+++ b/gdb/doc/gdbint.texinfo
@@ -41,7 +41,7 @@ Software Foundation raise funds for GNU development.''
@page
@tex
\def\$#1${{#1}} % Kluge: collect RCS revision info without $...$
-\xdef\manvers{\$Revision: 1.84 $} % For use in headers, footers too
+\xdef\manvers{\$Revision: 1.84.2.1 $} % For use in headers, footers too
{\parskip=0pt
\hfill Cygnus Solutions\par
\hfill \manvers\par
@@ -2312,6 +2312,135 @@ The target architecture object is implemented as the C structure
@code{struct gdbarch *}. The structure, and its methods, are generated
using the Bourne shell script @file{gdbarch.sh}.
+@section Operating System ABI Variant Handling
+@cindex OS ABI variants
+
+@value{GDBN} provides a mechanism for handling variations in OS
+ABIs. An OS ABI variant may have influence over any number of
+variables in the target architecture definition. There are two major
+components in the OS ABI mechanism: sniffers and handlers.
+
+A @dfn{sniffer} examines a file matching a BFD architecture/flavour pair
+(the architecture may be wildcarded) in an attempt to determine the
+OS ABI of that file. Sniffers with a wildcarded architecture are considered
+to be @dfn{generic}, while sniffers for a specific architecture are
+considered to be @dfn{specific}. A match from a specific sniffer
+overrides a match from a generic sniffer. Multiple sniffers for an
+architecture/flavour may exist, in order to differentiate between two
+different operating systems which use the same basic file format. The
+OS ABI framework provides a generic sniffer for ELF-format files which
+examines the @code{EI_OSABI} field of the ELF header, as well as note
+sections known to be used by several operating systems.
+
+@cindex fine-tuning @code{gdbarch} structure
+A @dfn{handler} is used to fine-tune the @code{gdbarch} structure for the
+selected OS ABI. There may be only one handler for a given OS ABI
+for each BFD architecture.
+
+The following OS ABI variants are defined in @file{osabi.h}:
+
+@table @code
+
+@findex GDB_OSABI_UNKNOWN
+@item GDB_OSABI_UNKNOWN
+The ABI of the inferior is unknown. The default @code{gdbarch}
+settings for the architecture will be used.
+
+@findex GDB_OSABI_SVR4
+@item GDB_OSABI_SVR4
+UNIX System V Release 4
+
+@findex GDB_OSABI_HURD
+@item GDB_OSABI_HURD
+GNU using the Hurd kernel
+
+@findex GDB_OSABI_SOLARIS
+@item GDB_OSABI_SOLARIS
+Sun Solaris
+
+@findex GDB_OSABI_OSF1
+@item GDB_OSABI_OSF1
+OSF/1, including Digital UNIX and Compaq Tru64 UNIX
+
+@findex GDB_OSABI_LINUX
+@item GDB_OSABI_LINUX
+GNU using the Linux kernel
+
+@findex GDB_OSABI_FREEBSD_AOUT
+@item GDB_OSABI_FREEBSD_AOUT
+FreeBSD using the a.out executable format
+
+@findex GDB_OSABI_FREEBSD_ELF
+@item GDB_OSABI_FREEBSD_ELF
+FreeBSD using the ELF executable format
+
+@findex GDB_OSABI_NETBSD_AOUT
+@item GDB_OSABI_NETBSD_AOUT
+NetBSD using the a.out executable format
+
+@findex GDB_OSABI_NETBSD_ELF
+@item GDB_OSABI_NETBSD_ELF
+NetBSD using the ELF executable format
+
+@findex GDB_OSABI_WINCE
+@item GDB_OSABI_WINCE
+Windows CE
+
+@findex GDB_OSABI_GO32
+@item GDB_OSABI_GO32
+DJGPP
+
+@findex GDB_OSABI_NETWARE
+@item GDB_OSABI_NETWARE
+Novell NetWare
+
+@findex GDB_OSABI_ARM_EABI_V1
+@item GDB_OSABI_ARM_EABI_V1
+ARM Embedded ABI version 1
+
+@findex GDB_OSABI_ARM_EABI_V2
+@item GDB_OSABI_ARM_EABI_V2
+ARM Embedded ABI version 2
+
+@findex GDB_OSABI_ARM_APCS
+@item GDB_OSABI_ARM_APCS
+Generic ARM Procedure Call Standard
+
+@end table
+
+Here are the functions that make up the OS ABI framework:
+
+@deftypefun const char *gdbarch_osabi_name (enum gdb_osabi @var{osabi})
+Return the name of the OS ABI corresponding to @var{osabi}.
+@end deftypefun
+
+@deftypefun void gdbarch_register_osabi (enum bfd_architecture @var{arch}, enum gdb_osabi @var{osabi}, void (*@var{init_osabi})(struct gdbarch_info @var{info}, struct gdbarch *@var{gdbarch}))
+Register the OS ABI handler specified by @var{init_osabi} for the
+architecture/OS ABI pair specified by @var{arch} and @var{osabi}.
+@end deftypefun
+
+@deftypefun void gdbarch_register_osabi_sniffer (enum bfd_architecture @var{arch}, enum bfd_flavour @var{flavour}, enum gdb_osabi (*@var{sniffer})(bfd *@var{abfd}))
+Register the OS ABI file sniffer specified by @var{sniffer} for the
+BFD architecture/flavour pair specified by @var{arch} and @var{flavour}.
+If @var{arch} is @code{bfd_arch_unknown}, the sniffer is considered to
+be generic, and is allowed to examine @var{flavour}-flavoured files for
+any architecture.
+@end deftypefun
+
+@deftypefun enum gdb_osabi gdbarch_lookup_osabi (bfd *@var{abfd})
+Examine the file described by @var{abfd} to determine its OS ABI.
+The value @code{GDB_OSABI_UNKNOWN} is returned if the OS ABI cannot
+be determined.
+@end deftypefun
+
+@deftypefun void gdbarch_init_osabi (struct gdbarch info @var{info}, struct gdbarch *@var{gdbarch}, enum gdb_osabi @var{osabi})
+Invoke the OS ABI handler corresponding to @var{osabi} to fine-tune the
+@code{gdbarch} structure specified by @var{gdbarch}. If a handler
+corresponding to @var{osabi} has not been registered for @var{gdbarch}'s
+architecture, a warning will be issued and the debugging session will continue
+with the defaults already established for @var{gdbarch}.
+@end deftypefun
+
@section Registers and Memory
@value{GDBN}'s model of the target machine is rather simple.
@@ -3764,6 +3893,168 @@ that just @code{#include}s @file{tm-@var{arch}.h} and
@file{config/tm-@var{os}.h}.
+@section Converting an existing Target Architecture to Multi-arch
+@cindex converting targets to multi-arch
+
+This section describes the current accepted best practice for converting
+an existing target architecture to the multi-arch framework.
+
+The process consists of generating, testing, posting and committing a
+sequence of patches. Each patch must contain a single change, for
+instance:
+
+@itemize @bullet
+
+@item
+Directly convert a group of functions into macros (the conversion does
+not change the behavior of any of the functions).
+
+@item
+Replace a non-multi-arch with a multi-arch mechanism (e.g.,
+@code{FRAME_INFO}).
+
+@item
+Enable multi-arch level one.
+
+@item
+Delete one or more files.
+
+@end itemize
+
+@noindent
+There isn't a size limit on a patch, however, a developer is strongly
+encouraged to keep the patch size down.
+
+Since each patch is well defined, and since each change has been tested
+and shows no regressions, the patches are considered @emph{fairly}
+obvious. Such patches, when submitted by developers listed in the
+@file{MAINTAINERS} file, do not need approval. Occasional steps in the
+process may be more complicated and less clear. The developer is
+expected to use their judgment and is encouraged to seek advice as
+needed.
+
+@subsection Preparation
+
+The first step is to establish control. Build (with @option{-Werror}
+enabled) and test the target so that there is a baseline against which
+the debugger can be compared.
+
+At no stage can the test results regress or @value{GDBN} stop compiling
+with @option{-Werror}.
+
+@subsection Add the multi-arch initialization code
+
+The objective of this step is to establish the basic multi-arch
+framework. It involves
+
+@itemize @bullet
+
+@item
+The addition of a @code{@var{arch}_gdbarch_init} function@footnote{The
+above is from the original example and uses K&R C. @value{GDBN}
+has since converted to ISO C but lets ignore that.} that creates
+the architecture:
+@smallexample
+static struct gdbarch *
+d10v_gdbarch_init (info, arches)
+ struct gdbarch_info info;
+ struct gdbarch_list *arches;
+@{
+ struct gdbarch *gdbarch;
+ /* there is only one d10v architecture */
+ if (arches != NULL)
+ return arches->gdbarch;
+ gdbarch = gdbarch_alloc (&info, NULL);
+ return gdbarch;
+@}
+@end smallexample
+@noindent
+@emph{}
+
+@item
+A per-architecture dump function to print any architecture specific
+information:
+@smallexample
+static void
+mips_dump_tdep (struct gdbarch *current_gdbarch,
+ struct ui_file *file)
+@{
+ @dots{} code to print architecture specific info @dots{}
+@}
+@end smallexample
+
+@item
+A change to @code{_initialize_@var{arch}_tdep} to register this new
+architecture:
+@smallexample
+void
+_initialize_mips_tdep (void)
+@{
+ gdbarch_register (bfd_arch_mips, mips_gdbarch_init,
+ mips_dump_tdep);
+@end smallexample
+
+@item
+Add the macro @code{GDB_MULTI_ARCH}, defined as 0 (zero), to the file@*
+@file{config/@var{arch}/tm-@var{arch}.h}.
+
+@end itemize
+
+@subsection Update multi-arch incompatible mechanisms
+
+Some mechanisms do not work with multi-arch. They include:
+
+@table @code
+@item EXTRA_FRAME_INFO
+Delete.
+@item FRAME_FIND_SAVED_REGS
+Replaced with @code{FRAME_INIT_SAVED_REGS}
+@end table
+
+@noindent
+At this stage you could also consider converting the macros into
+functions.
+
+@subsection Prepare for multi-arch level to one
+
+Temporally set @code{GDB_MULTI_ARCH} to @code{GDB_MULTI_ARCH_PARTIAL}
+and then build and start @value{GDBN} (the change should not be
+committed). @value{GDBN} may not build, and once built, it may die with
+an internal error listing the architecture methods that must be
+provided.
+
+Fix any build problems (patch(es)).
+
+Convert all the architecture methods listed, which are only macros, into
+functions (patch(es)).
+
+Update @code{@var{arch}_gdbarch_init} to set all the missing
+architecture methods and wrap the corresponding macros in @code{#if
+!GDB_MULTI_ARCH} (patch(es)).
+
+@subsection Set multi-arch level one
+
+Change the value of @code{GDB_MULTI_ARCH} to GDB_MULTI_ARCH_PARTIAL (a
+single patch).
+
+Any problems with throwing ``the switch'' should have been fixed
+already.
+
+@subsection Convert remaining macros
+
+Suggest converting macros into functions (and setting the corresponding
+architecture method) in small batches.
+
+@subsection Set multi-arch level to two
+
+This should go smoothly.
+
+@subsection Delete the TM file
+
+The @file{tm-@var{arch}.h} can be deleted. @file{@var{arch}.mt} and
+@file{configure.in} updated.
+
+
@node Target Vector Definition
@chapter Target Vector Definition
@@ -4325,6 +4616,143 @@ interruption must be on the cleanup chain before you call these
functions, since they might never return to your code (they
@samp{longjmp} instead).
+@section Per-architecture module data
+@cindex per-architecture module data
+@cindex multi-arch data
+@cindex data-pointer, per-architecture/per-module
+
+The multi-arch framework includes a mechanism for adding module specific
+per-architecture data-pointers to the @code{struct gdbarch} architecture
+object.
+
+A module registers one or more per-architecture data-pointers using the
+function @code{register_gdbarch_data}:
+
+@deftypefun struct gdbarch_data *register_gdbarch_data (gdbarch_data_init_ftype *@var{init}, gdbarch_data_free_ftype *@var{free})
+
+The @var{init} function is used to obtain an initial value for a
+per-architecture data-pointer. The function is called, after the
+architecture has been created, when the data-pointer is still
+uninitialized (@code{NULL}) and its value has been requested via a call
+to @code{gdbarch_data}. A data-pointer can also be initialize
+explicitly using @code{set_gdbarch_data}.
+
+The @var{free} function is called when a data-pointer needs to be
+destroyed. This occurs when either the corresponding @code{struct
+gdbarch} object is being destroyed or when @code{set_gdbarch_data} is
+overriding a non-@code{NULL} data-pointer value.
+
+The function @code{register_gdbarch_data} returns a @code{struct
+gdbarch_data} that is used to identify the data-pointer that was added
+to the module.
+
+@end deftypefun
+
+A typical module has @code{init} and @code{free} functions of the form:
+
+@smallexample
+static struct gdbarch_data *nozel_handle;
+static void *
+nozel_init (struct gdbarch *gdbarch)
+@{
+ struct nozel *data = XMALLOC (struct nozel);
+ @dots{}
+ return data;
+@}
+@dots{}
+static void
+nozel_free (struct gdbarch *gdbarch, void *data)
+@{
+ xfree (data);
+@}
+@end smallexample
+
+Since uninitialized (@code{NULL}) data-pointers are initialized
+on-demand, an @code{init} function is free to call other modules that
+use data-pointers. Those modules data-pointers will be initialized as
+needed. Care should be taken to ensure that the @code{init} call graph
+does not contain cycles.
+
+The data-pointer is registered with the call:
+
+@smallexample
+void
+_initialize_nozel (void)
+@{
+ nozel_handle = register_gdbarch_data (nozel_init, nozel_free);
+@dots{}
+@end smallexample
+
+The per-architecture data-pointer is accessed using the function:
+
+@deftypefun void *gdbarch_data (struct gdbarch *@var{gdbarch}, struct gdbarch_data *@var{data_handle})
+Given the architecture @var{arch} and module data handle
+@var{data_handle} (returned by @code{register_gdbarch_data}, this
+function returns the current value of the per-architecture data-pointer.
+@end deftypefun
+
+The non-@code{NULL} data-pointer returned by @code{gdbarch_data} should
+be saved in a local variable and then used directly:
+
+@smallexample
+int
+nozel_total (struct gdbarch *gdbarch)
+@{
+ int total;
+ struct nozel *data = gdbarch_data (gdbarch, nozel_handle);
+ @dots{}
+ return total;
+@}
+@end smallexample
+
+It is also possible to directly initialize the data-pointer using:
+
+@deftypefun void set_gdbarch_data (struct gdbarch *@var{gdbarch}, struct gdbarch_data *handle, void *@var{pointer})
+Update the data-pointer corresponding to @var{handle} with the value of
+@var{pointer}. If the previous data-pointer value is non-NULL, then it
+is freed using data-pointers @var{free} function.
+@end deftypefun
+
+This function is used by modules that require a mechanism for explicitly
+setting the per-architecture data-pointer during architecture creation:
+
+@smallexample
+/* Called during architecture creation. */
+extern void
+set_gdbarch_nozel (struct gdbarch *gdbarch,
+ int total)
+@{
+ struct nozel *data = XMALLOC (struct nozel);
+ @dots{}
+ set_gdbarch_data (gdbarch, nozel_handle, nozel);
+@}
+@end smallexample
+
+@smallexample
+/* Default, called when nozel not set by set_gdbarch_nozel(). */
+static void *
+nozel_init (struct gdbarch *gdbarch)
+@{
+ struct nozel *default_nozel = XMALLOC (struc nozel);
+ @dots{}
+ return default_nozel;
+@}
+@end smallexample
+
+@smallexample
+void
+_initialize_nozel (void)
+@{
+ nozel_handle = register_gdbarch_data (nozel_init, NULL);
+ @dots{}
+@end smallexample
+
+@noindent
+Note that an @code{init} function still needs to be registered. It is
+used to initialize the data-pointer when the architecture creation phase
+fail to set an initial value.
+
+
@section Wrapping Output Lines
@cindex line wrap in output
@@ -5037,41 +5465,50 @@ This means that changes such as adding a new architectures or (within
reason) support for a new host are considered acceptable.}
-@section Obsolete any code
+@section Obsoleting code
Before anything else, poke the other developers (and around the source
code) to see if there is anything that can be removed from @value{GDBN}
(an old target, an unused file).
Obsolete code is identified by adding an @code{OBSOLETE} prefix to every
-line. Doing this means that it is easy to identify obsolete code when
-grepping through the sources.
+line. Doing this means that it is easy to identify something that has
+been obsoleted when greping through the sources.
-The process has a number of steps and is intentionally slow --- this is
-to mainly ensure that people have had a reasonable chance to respond.
-Remember, everything on the internet takes a week.
+The process is done in stages --- this is mainly to ensure that the
+wider @value{GDBN} community has a reasonable opportunity to respond.
+Remember, everything on the Internet takes a week.
-@itemize @bullet
+@enumerate
@item
-announce the change on @email{gdb@@sources.redhat.com, GDB mailing list}
+Post the proposal on @email{gdb@@sources.redhat.com, the GDB mailing
+list} Creating a bug report to track the task's state, is also highly
+recommended.
@item
-wait a week or so
+Wait a week or so.
@item
-announce the change on @email{gdb-announce@@sources.redhat.com, GDB
-Announcement mailing list}
+Post the proposal on @email{gdb-announce@@sources.redhat.com, the GDB
+Announcement mailing list}.
@item
-wait a week or so
+Wait a week or so.
@item
-go through and edit all relevant files and lines (e.g., in
-@file{configure.tgt}) so that they are prefixed with the word
-@code{OBSOLETE}.
-@end itemize
+Go through and edit all relevant files and lines so that they are
+prefixed with the word @code{OBSOLETE}.
+@item
+Wait until the next GDB version, containing this obsolete code, has been
+released.
+@item
+Remove the obsolete code.
+@end enumerate
+
+@noindent
+@emph{Maintainer note: While removing old code is regrettable it is
+hopefully better for @value{GDBN}'s long term development. Firstly it
+helps the developers by removing code that is either no longer relevant
+or simply wrong. Secondly since it removes any history associated with
+the file (effectively clearing the slate) the developer has a much freer
+hand when it comes to fixing broken files.}
-@emph{Maintainer note: Removing old code, while regrettable, is a good
-thing. Firstly it helps the developers by removing code that is either
-no longer relevant or simply wrong. Secondly since it removes any
-history associated with the file (effectively clearing the slate) the
-developer has a much freer hand when it comes to fixing broken files.}
@section Before the Branch
@@ -5125,38 +5562,142 @@ Close anything obviously fixed.
The targets are listed in @file{gdb/MAINTAINERS}.
-@section Cut the branch
-
-@subheading The dirty work
+@section Cut the Branch
-I think something like the below was used:
+@subheading Create the branch
@smallexample
-$ d=`date -u +%Y-%m-%d`
-$ echo $d
-2002-01-24
-$ cvs -f -d /cvs/src rtag -D $d-gmt \
-gdb_5_1-$d-branchpoint insight+dejagnu
-$ cvs -f -d /cvs/src rtag -b -r gdb_V_V-$d-branchpoint \
-gdb_5_1-$d-branch insight+dejagnu
+$ u=5.1
+$ v=5.2
+$ V=`echo $v | sed 's/\./_/g'`
+$ D=`date -u +%Y-%m-%d`
+$ echo $u $V $D
+5.1 5_2 2002-03-03
+$ echo cvs -f -d :ext:sources.redhat.com:/cvs/src rtag \
+-D $D-gmt gdb_$V-$D-branchpoint insight+dejagnu
+cvs -f -d :ext:sources.redhat.com:/cvs/src rtag
+-D 2002-03-03-gmt gdb_5_2-2002-03-03-branchpoint insight+dejagnu
+$ ^echo ^^
+...
+$ echo cvs -f -d :ext:sources.redhat.com:/cvs/src rtag \
+-b -r gdb_$V-$D-branchpoint gdb_$V-branch insight+dejagnu
+cvs -f -d :ext:sources.redhat.com:/cvs/src rtag \
+-b -r gdb_5_2-2002-03-03-branchpoint gdb_5_2-branch insight+dejagnu
+$ ^echo ^^
+...
$
@end smallexample
@itemize @bullet
@item
-the @kbd{-D YYYY-MM-DD-gmt} forces the branch to an exact date/time.
+by using @kbd{-D YYYY-MM-DD-gmt} the branch is forced to an exact
+date/time.
+@item
+the trunk is first taged so that the branch point can easily be found
@item
-the trunk is first tagged so that the branch point can easily be found
+Insight (which includes GDB) and dejagnu are all tagged at the same time
@item
-Insight (which includes GDB) and dejagnu are tagged at the same time
+@file{version.in} gets bumped to avoid version number conflicts
+@item
+the reading of @file{.cvsrc} is disabled using @file{-f}
+@end itemize
+
+@subheading Update @file{version.in}
+
+@smallexample
+$ u=5.1
+$ v=5.2
+$ V=`echo $v | sed 's/\./_/g'`
+$ echo $u $v$V
+5.1 5_2
+$ cd /tmp
+$ echo cvs -f -d :ext:sources.redhat.com:/cvs/src co \
+-r gdb_$V-branch src/gdb/version.in
+cvs -f -d :ext:sources.redhat.com:/cvs/src co
+ -r gdb_5_2-branch src/gdb/version.in
+$ ^echo ^^
+U src/gdb/version.in
+$ cd src/gdb
+$ echo $u.90-0000-00-00-cvs > version.in
+$ cat version.in
+5.1.90-0000-00-00-cvs
+$ cvs -f commit version.in
+@end smallexample
+
+@itemize @bullet
+@item
+@file{0000-00-00} is used as a date to pump prime the version.in update
+mechanism
+@item
+@file{.90} and the previous branch version are used as fairly arbitrary
+initial branch version number
@end itemize
-@subheading Post the branch info
@subheading Update the web and news pages
+Something?
+
@subheading Tweak cron to track the new branch
+The file @file{gdbadmin/cron/crontab} contains gdbadmin's cron table.
+This file needs to be updated so that:
+
+@itemize @bullet
+@item
+a daily timestamp is added to the file @file{version.in}
+@item
+the new branch is included in the snapshot process
+@end itemize
+
+@noindent
+See the file @file{gdbadmin/cron/README} for how to install the updated
+cron table.
+
+The file @file{gdbadmin/ss/README} should also be reviewed to reflect
+any changes. That file is copied to both the branch/ and current/
+snapshot directories.
+
+
+@subheading Update the NEWS and README files
+
+The @file{NEWS} file needs to be updated so that on the branch it refers
+to @emph{changes in the current release} while on the trunk it also
+refers to @emph{changes since the current release}.
+
+The @file{README} file needs to be updated so that it refers to the
+current release.
+
+@subheading Post the branch info
+
+Send an announcement to the mailing lists:
+
+@itemize @bullet
+@item
+@email{gdb-announce@@sources.redhat.com, GDB Announcement mailing list}
+@item
+@email{gdb@@sources.redhat.com, GDB Discsussion mailing list} and
+@email{gdb-testers@@sources.redhat.com, GDB Discsussion mailing list}
+@end itemize
+
+@emph{Pragmatics: The branch creation is sent to the announce list to
+ensure that people people not subscribed to the higher volume discussion
+list are alerted.}
+
+The announcement should include:
+
+@itemize @bullet
+@item
+the branch tag
+@item
+how to check out the branch using CVS
+@item
+the date/number of weeks until the release
+@item
+the branch commit policy
+still holds.
+@end itemize
+
@section Stabilize the branch
Something goes here.
diff --git a/gdb/dwarf2cfi.c b/gdb/dwarf2cfi.c
index 0cc342fa93f..ea501551c8e 100644
--- a/gdb/dwarf2cfi.c
+++ b/gdb/dwarf2cfi.c
@@ -201,26 +201,27 @@ static void fde_chunks_need_space ();
static struct context *context_alloc ();
static struct frame_state *frame_state_alloc ();
+static void unwind_tmp_obstack_init ();
static void unwind_tmp_obstack_free ();
static void context_cpy (struct context *dst, struct context *src);
-static unsigned int read_1u (bfd *abfd, char **p);
-static int read_1s (bfd *abfd, char **p);
-static unsigned int read_2u (bfd *abfd, char **p);
-static int read_2s (bfd *abfd, char **p);
-static unsigned int read_4u (bfd *abfd, char **p);
-static int read_4s (bfd *abfd, char **p);
-static ULONGEST read_8u (bfd *abfd, char **p);
-static LONGEST read_8s (bfd *abfd, char **p);
-
-static ULONGEST read_uleb128 (bfd *abfd, char **p);
-static LONGEST read_sleb128 (bfd *abfd, char **p);
-static CORE_ADDR read_pointer (bfd *abfd, char **p);
-static CORE_ADDR read_encoded_pointer (bfd *abfd, char **p,
+static unsigned int read_1u (bfd * abfd, char **p);
+static int read_1s (bfd * abfd, char **p);
+static unsigned int read_2u (bfd * abfd, char **p);
+static int read_2s (bfd * abfd, char **p);
+static unsigned int read_4u (bfd * abfd, char **p);
+static int read_4s (bfd * abfd, char **p);
+static ULONGEST read_8u (bfd * abfd, char **p);
+static LONGEST read_8s (bfd * abfd, char **p);
+
+static ULONGEST read_uleb128 (bfd * abfd, char **p);
+static LONGEST read_sleb128 (bfd * abfd, char **p);
+static CORE_ADDR read_pointer (bfd * abfd, char **p);
+static CORE_ADDR read_encoded_pointer (bfd * abfd, char **p,
unsigned char encoding);
-static LONGEST read_initial_length (bfd *abfd, char *buf, int *bytes_read);
-static ULONGEST read_length (bfd *abfd, char *buf, int *bytes_read,
+static LONGEST read_initial_length (bfd * abfd, char *buf, int *bytes_read);
+static ULONGEST read_length (bfd * abfd, char *buf, int *bytes_read,
int dwarf64);
static int is_cie (ULONGEST cie_id, int dwarf64);
@@ -235,11 +236,12 @@ static void frame_state_for (struct context *context, struct frame_state *fs);
static void get_reg (char *reg, struct context *context, int regnum);
static CORE_ADDR execute_stack_op (struct objfile *objfile,
char *op_ptr, char *op_end,
- struct context *context, CORE_ADDR initial);
+ struct context *context,
+ CORE_ADDR initial);
static void update_context (struct context *context, struct frame_state *fs,
int chain);
-
+
/* Memory allocation functions. */
static struct fde_unit *
fde_unit_alloc (void)
@@ -301,17 +303,23 @@ frame_state_alloc ()
fs = (struct frame_state *) obstack_alloc (&unwind_tmp_obstack,
sizeof (struct frame_state));
memset (fs, 0, sizeof (struct frame_state));
- fs->regs.reg = (struct frame_state_reg *) obstack_alloc (&unwind_tmp_obstack,
- regs_size);
+ fs->regs.reg =
+ (struct frame_state_reg *) obstack_alloc (&unwind_tmp_obstack, regs_size);
memset (fs->regs.reg, 0, regs_size);
return fs;
}
static void
+unwind_tmp_obstack_init ()
+{
+ obstack_init (&unwind_tmp_obstack);
+}
+
+static void
unwind_tmp_obstack_free ()
{
obstack_free (&unwind_tmp_obstack, NULL);
- obstack_init (&unwind_tmp_obstack);
+ unwind_tmp_obstack_init ();
}
static void
@@ -334,92 +342,92 @@ context_cpy (struct context *dst, struct context *src)
dreg = dst->reg;
*dst = *src;
dst->reg = dreg;
-
+
memcpy (dst->reg, src->reg, regs_size);
}
static unsigned int
-read_1u (bfd *abfd, char **p)
+read_1u (bfd * abfd, char **p)
{
unsigned ret;
- ret= bfd_get_8 (abfd, (bfd_byte *) *p);
- (*p) ++;
+ ret = bfd_get_8 (abfd, (bfd_byte *) * p);
+ (*p)++;
return ret;
}
static int
-read_1s (bfd *abfd, char **p)
+read_1s (bfd * abfd, char **p)
{
int ret;
- ret= bfd_get_signed_8 (abfd, (bfd_byte *) *p);
- (*p) ++;
+ ret = bfd_get_signed_8 (abfd, (bfd_byte *) * p);
+ (*p)++;
return ret;
}
static unsigned int
-read_2u (bfd *abfd, char **p)
+read_2u (bfd * abfd, char **p)
{
unsigned ret;
- ret= bfd_get_16 (abfd, (bfd_byte *) *p);
- (*p) ++;
+ ret = bfd_get_16 (abfd, (bfd_byte *) * p);
+ (*p)++;
return ret;
}
static int
-read_2s (bfd *abfd, char **p)
+read_2s (bfd * abfd, char **p)
{
int ret;
- ret= bfd_get_signed_16 (abfd, (bfd_byte *) *p);
+ ret = bfd_get_signed_16 (abfd, (bfd_byte *) * p);
(*p) += 2;
return ret;
}
static unsigned int
-read_4u (bfd *abfd, char **p)
+read_4u (bfd * abfd, char **p)
{
unsigned int ret;
- ret= bfd_get_32 (abfd, (bfd_byte *) *p);
+ ret = bfd_get_32 (abfd, (bfd_byte *) * p);
(*p) += 4;
return ret;
}
static int
-read_4s (bfd *abfd, char **p)
+read_4s (bfd * abfd, char **p)
{
int ret;
- ret= bfd_get_signed_32 (abfd, (bfd_byte *) *p);
+ ret = bfd_get_signed_32 (abfd, (bfd_byte *) * p);
(*p) += 4;
return ret;
}
static ULONGEST
-read_8u (bfd *abfd, char **p)
+read_8u (bfd * abfd, char **p)
{
ULONGEST ret;
- ret = bfd_get_64 (abfd, (bfd_byte *) *p);
+ ret = bfd_get_64 (abfd, (bfd_byte *) * p);
(*p) += 8;
return ret;
}
static LONGEST
-read_8s (bfd *abfd, char **p)
+read_8s (bfd * abfd, char **p)
{
LONGEST ret;
- ret = bfd_get_signed_64 (abfd, (bfd_byte *) *p);
+ ret = bfd_get_signed_64 (abfd, (bfd_byte *) * p);
(*p) += 8;
return ret;
}
static ULONGEST
-read_uleb128 (bfd *abfd, char **p)
+read_uleb128 (bfd * abfd, char **p)
{
ULONGEST ret;
int i, shift;
@@ -430,8 +438,8 @@ read_uleb128 (bfd *abfd, char **p)
i = 0;
while (1)
{
- byte = bfd_get_8 (abfd, (bfd_byte *) *p);
- (*p) ++;
+ byte = bfd_get_8 (abfd, (bfd_byte *) * p);
+ (*p)++;
ret |= ((unsigned long) (byte & 127) << shift);
if ((byte & 128) == 0)
{
@@ -443,7 +451,7 @@ read_uleb128 (bfd *abfd, char **p)
}
static LONGEST
-read_sleb128 (bfd *abfd, char **p)
+read_sleb128 (bfd * abfd, char **p)
{
LONGEST ret;
int i, shift, size, num_read;
@@ -456,8 +464,8 @@ read_sleb128 (bfd *abfd, char **p)
i = 0;
while (1)
{
- byte = bfd_get_8 (abfd, (bfd_byte *) *p);
- (*p) ++;
+ byte = bfd_get_8 (abfd, (bfd_byte *) * p);
+ (*p)++;
ret |= ((long) (byte & 127) << shift);
shift += 7;
if ((byte & 128) == 0)
@@ -473,7 +481,7 @@ read_sleb128 (bfd *abfd, char **p)
}
static CORE_ADDR
-read_pointer (bfd *abfd, char **p)
+read_pointer (bfd * abfd, char **p)
{
switch (TARGET_ADDR_BIT / TARGET_CHAR_BIT)
{
@@ -487,7 +495,7 @@ read_pointer (bfd *abfd, char **p)
}
static CORE_ADDR
-read_encoded_pointer (bfd *abfd, char **p, unsigned char encoding)
+read_encoded_pointer (bfd * abfd, char **p, unsigned char encoding)
{
CORE_ADDR ret;
@@ -535,7 +543,7 @@ read_encoded_pointer (bfd *abfd, char **p, unsigned char encoding)
case DW_EH_PE_absptr:
break;
case DW_EH_PE_pcrel:
- ret += (CORE_ADDR) *p;
+ ret += (CORE_ADDR) * p;
break;
case DW_EH_PE_textrel:
case DW_EH_PE_datarel:
@@ -584,8 +592,8 @@ read_length (bfd * abfd, char *buf, int *bytes_read, int dwarf64)
}
static void
-execute_cfa_program ( struct objfile *objfile, char *insn_ptr, char *insn_end,
- struct context *context, struct frame_state *fs)
+execute_cfa_program (struct objfile *objfile, char *insn_ptr, char *insn_end,
+ struct context *context, struct frame_state *fs)
{
struct frame_state_regs *unused_rs = NULL;
@@ -604,7 +612,7 @@ execute_cfa_program ( struct objfile *objfile, char *insn_ptr, char *insn_end,
{
reg = insn & 0x3f;
uoffset = read_uleb128 (objfile->obfd, &insn_ptr);
- offset = (long) uoffset * fs->data_align;
+ offset = (long) uoffset *fs->data_align;
fs->regs.reg[reg].how = REG_SAVED_OFFSET;
fs->regs.reg[reg].loc.offset = offset;
}
@@ -802,11 +810,17 @@ frame_state_for (struct context *context, struct frame_state *fs)
context->args_size = 0;
context->lsda = 0;
- if ((fde = get_fde_for_addr (context->ra - 1)) != NULL)
- {
- fs->pc = fde->initial_location;
+ fde = get_fde_for_addr (context->ra - 1);
+ if (fde == NULL)
+ return;
+
+ fs->pc = fde->initial_location;
+
+ if (fde->cie_ptr)
+ {
cie = fde->cie_ptr;
+
fs->code_align = cie->code_align;
fs->data_align = cie->data_align;
fs->retaddr_column = cie->ra;
@@ -818,6 +832,9 @@ frame_state_for (struct context *context, struct frame_state *fs)
execute_cfa_program (cie->objfile, fde->data,
fde->data + fde->data_length, context, fs);
}
+ else
+ internal_error (__FILE__, __LINE__,
+ "%s(): Internal error: fde->cie_ptr==NULL !", __func__);
}
static void
@@ -844,8 +861,7 @@ get_reg (char *reg, struct context *context, int regnum)
REGISTER_RAW_SIZE (regnum));
break;
default:
- internal_error (__FILE__, __LINE__,
- "get_reg: unknown register rule");
+ internal_error (__FILE__, __LINE__, "get_reg: unknown register rule");
}
}
@@ -865,7 +881,8 @@ execute_stack_op (struct objfile *objfile,
while (op_ptr < op_end)
{
enum dwarf_location_atom op = *op_ptr++;
- ULONGEST result, reg;
+ CORE_ADDR result;
+ ULONGEST reg;
LONGEST offset;
switch (op)
@@ -1197,8 +1214,8 @@ execute_stack_op (struct objfile *objfile,
case DW_OP_ne:
result = (LONGEST) first != (LONGEST) second;
break;
- default: /* This label is here just to avoid warning. */
- break;
+ default: /* This label is here just to avoid warning. */
+ break;
}
}
break;
@@ -1244,8 +1261,11 @@ update_context (struct context *context, struct frame_state *fs, int chain)
CORE_ADDR cfa;
long i;
+ unwind_tmp_obstack_init ();
+
orig_context = context_alloc ();
context_cpy (orig_context, context);
+
/* Compute this frame's CFA. */
switch (fs->cfa_how)
{
@@ -1256,9 +1276,9 @@ update_context (struct context *context, struct frame_state *fs, int chain)
case CFA_EXP:
/* ??? No way of knowing what register number is the stack pointer
- to do the same sort of handling as above. Assume that if the
- CFA calculation is so complicated as to require a stack program
- that this will not be a problem. */
+ to do the same sort of handling as above. Assume that if the
+ CFA calculation is so complicated as to require a stack program
+ that this will not be a problem. */
{
char *exp = fs->cfa_exp;
ULONGEST len;
@@ -1367,8 +1387,9 @@ dwarf2_build_frame_info (struct objfile *objfile)
bfd *abfd = objfile->obfd;
char *start = NULL;
char *end = NULL;
+ int from_eh = 0;
- obstack_init (&unwind_tmp_obstack);
+ unwind_tmp_obstack_init ();
dwarf_frame_buffer = 0;
@@ -1389,6 +1410,8 @@ dwarf2_build_frame_info (struct objfile *objfile)
start = dwarf_frame_buffer;
end = dwarf_frame_buffer + dwarf_eh_frame_size;
+
+ from_eh = 1;
}
if (start)
@@ -1410,7 +1433,7 @@ dwarf2_build_frame_info (struct objfile *objfile)
cie_id = read_length (abfd, start, &bytes_read, dwarf64);
start += bytes_read;
- if (is_cie (cie_id, dwarf64))
+ if ((from_eh && cie_id == 0) || is_cie (cie_id, dwarf64))
{
struct cie_unit *cie = cie_unit_alloc ();
char *aug;
@@ -1461,7 +1484,7 @@ dwarf2_build_frame_info (struct objfile *objfile)
aug += 1;
}
else
- warning ("unknown augmentation");
+ warning ("%s(): unknown augmentation", __func__);
}
cie->data = start;
@@ -1476,17 +1499,34 @@ dwarf2_build_frame_info (struct objfile *objfile)
fde = fde_unit_alloc ();
fde_chunks.array[fde_chunks.elems++] = fde;
- fde->initial_location = read_pointer (abfd, &start);
+
+ fde->initial_location = read_pointer (abfd, &start)
+ + ANOFFSET (objfile->section_offsets,
+ SECT_OFF_TEXT (objfile));
fde->address_range = read_pointer (abfd, &start);
- for (cie = cie_chunks;
- cie && (cie->offset != cie_id); cie = cie->next);
+ cie = cie_chunks;
+ while (cie)
+ {
+ if (cie->objfile == objfile)
+ {
+ if (from_eh
+ && (cie->offset ==
+ (unit_offset + bytes_read - cie_id)))
+ break;
+ if (!from_eh && (cie->offset == cie_id))
+ break;
+ }
+
+ cie = cie->next;
+ }
+
if (!cie)
- error ("dwarf cfi error: can't find CIE pointer");
+ error ("%s(): can't find CIE pointer", __func__);
fde->cie_ptr = cie;
if (cie->augmentation[0] == 'z')
- read_uleb128 (abfd, &start);
+ read_uleb128 (abfd, &start);
fde->data = start;
fde->data_length = block_end - start;
@@ -1507,6 +1547,8 @@ cfi_read_fp ()
struct frame_state *fs;
CORE_ADDR cfa;
+ unwind_tmp_obstack_init ();
+
context = context_alloc ();
fs = frame_state_alloc ();
@@ -1516,7 +1558,9 @@ cfi_read_fp ()
update_context (context, fs, 0);
cfa = context->cfa;
+
unwind_tmp_obstack_free ();
+
return cfa;
}
@@ -1528,6 +1572,8 @@ cfi_write_fp (CORE_ADDR val)
struct context *context;
struct frame_state *fs;
+ unwind_tmp_obstack_init ();
+
context = context_alloc ();
fs = frame_state_alloc ();
@@ -1575,6 +1621,8 @@ cfi_frame_chain (struct frame_info *fi)
struct frame_state *fs;
CORE_ADDR cfa;
+ unwind_tmp_obstack_init ();
+
context = context_alloc ();
fs = frame_state_alloc ();
context_cpy (context, UNWIND_CONTEXT (fi));
@@ -1591,7 +1639,7 @@ cfi_frame_chain (struct frame_info *fi)
cfa = context->cfa;
unwind_tmp_obstack_free ();
-
+
return cfa;
}
@@ -1611,6 +1659,8 @@ cfi_init_extra_frame_info (int fromleaf, struct frame_info *fi)
{
struct frame_state *fs;
+ unwind_tmp_obstack_init ();
+
fs = frame_state_alloc ();
fi->context = frame_obstack_alloc (sizeof (struct context));
UNWIND_CONTEXT (fi)->reg =
@@ -1630,6 +1680,7 @@ cfi_init_extra_frame_info (int fromleaf, struct frame_info *fi)
frame_state_for (UNWIND_CONTEXT (fi), fs);
update_context (UNWIND_CONTEXT (fi), fs, 0);
}
+
unwind_tmp_obstack_free ();
}
@@ -1737,6 +1788,8 @@ cfi_virtual_frame_pointer (CORE_ADDR pc, int *frame_reg,
struct context *context;
struct frame_state *fs;
+ unwind_tmp_obstack_init ();
+
context = context_alloc ();
fs = frame_state_alloc ();
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 27938178325..9fa8fb3c463 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -37,6 +37,7 @@
#include "demangle.h"
#include "expression.h"
#include "filenames.h" /* for DOSish file names */
+#include "macrotab.h"
#include "language.h"
#include "complaints.h"
@@ -350,6 +351,7 @@ static char *dwarf_info_buffer;
static char *dwarf_abbrev_buffer;
static char *dwarf_line_buffer;
static char *dwarf_str_buffer;
+static char *dwarf_macinfo_buffer;
/* A zeroed version of a partial die for initialization purposes. */
static struct partial_die_info zeroed_partial_die;
@@ -443,6 +445,15 @@ struct dwarf2_pinfo
/* Size of dwarf string section for the objfile. */
unsigned int dwarf_str_size;
+
+ /* Pointer to start of dwarf macro buffer for the objfile. */
+
+ char *dwarf_macinfo_buffer;
+
+ /* Size of dwarf macinfo section for the objfile. */
+
+ unsigned int dwarf_macinfo_size;
+
};
#define PST_PRIVATE(p) ((struct dwarf2_pinfo *)(p)->read_symtab_private)
@@ -454,6 +465,8 @@ struct dwarf2_pinfo
#define DWARF_LINE_SIZE(p) (PST_PRIVATE(p)->dwarf_line_size)
#define DWARF_STR_BUFFER(p) (PST_PRIVATE(p)->dwarf_str_buffer)
#define DWARF_STR_SIZE(p) (PST_PRIVATE(p)->dwarf_str_size)
+#define DWARF_MACINFO_BUFFER(p) (PST_PRIVATE(p)->dwarf_macinfo_buffer)
+#define DWARF_MACINFO_SIZE(p) (PST_PRIVATE(p)->dwarf_macinfo_size)
/* Maintain an array of referenced fundamental types for the current
compilation unit being read. For DWARF version 1, we have to construct
@@ -617,6 +630,34 @@ static struct complaint dwarf2_line_header_too_long =
{
"line number info header doesn't fit in `.debug_line' section", 0, 0
};
+static struct complaint dwarf2_missing_macinfo_section =
+{
+ "missing .debug_macinfo section", 0, 0
+};
+static struct complaint dwarf2_macros_too_long =
+{
+ "macro info runs off end of `.debug_macinfo' section", 0, 0
+};
+static struct complaint dwarf2_macros_not_terminated =
+{
+ "no terminating 0-type entry for macros in `.debug_macinfo' section", 0, 0
+};
+static struct complaint dwarf2_macro_outside_file =
+{
+ "debug info gives macro %s outside of any file: %s", 0, 0
+};
+static struct complaint dwarf2_macro_unmatched_end_file =
+{
+ "macro debug info has an unmatched `close_file' directive", 0, 0
+};
+static struct complaint dwarf2_macro_malformed_definition =
+{
+ "macro debug info contains a malformed macro definition:\n`%s'", 0, 0
+};
+static struct complaint dwarf2_macro_spaces_in_definition =
+{
+ "macro definition contains spaces in formal argument list:\n`%s'", 0, 0
+};
/* local function prototypes */
@@ -758,8 +799,7 @@ static void dwarf2_attach_fields_to_type (struct field_info *,
struct type *, struct objfile *);
static void dwarf2_add_member_fn (struct field_info *,
- struct die_info *, struct type *,
- struct objfile *objfile,
+ struct die_info *, struct objfile *objfile,
const struct comp_unit_head *);
static void dwarf2_attach_fn_fields_to_type (struct field_info *,
@@ -862,15 +902,23 @@ static void initialize_cu_func_list (void);
static void add_to_cu_func_list (const char *, CORE_ADDR, CORE_ADDR);
+static void dwarf_decode_macros (struct line_header *, unsigned int,
+ char *, bfd *, const struct comp_unit_head *,
+ struct objfile *);
+
/* Try to locate the sections we need for DWARF 2 debugging
information and return true if we have enough to do something. */
int
dwarf2_has_info (bfd *abfd)
{
- dwarf_info_offset = dwarf_abbrev_offset = dwarf_line_offset = 0;
+ dwarf_info_offset = 0;
+ dwarf_abbrev_offset = 0;
+ dwarf_line_offset = 0;
dwarf_str_offset = 0;
- dwarf_frame_offset = dwarf_eh_frame_offset = 0;
+ dwarf_macinfo_offset = 0;
+ dwarf_frame_offset = 0;
+ dwarf_eh_frame_offset = 0;
bfd_map_over_sections (abfd, dwarf2_locate_sections, NULL);
if (dwarf_info_offset && dwarf_abbrev_offset)
{
@@ -966,6 +1014,13 @@ dwarf2_build_psymtabs (struct objfile *objfile, int mainline)
else
dwarf_str_buffer = NULL;
+ if (dwarf_macinfo_offset)
+ dwarf_macinfo_buffer = dwarf2_read_section (objfile,
+ dwarf_macinfo_offset,
+ dwarf_macinfo_size);
+ else
+ dwarf_macinfo_buffer = NULL;
+
if (mainline
|| (objfile->global_psymbols.size == 0
&& objfile->static_psymbols.size == 0))
@@ -1174,6 +1229,8 @@ dwarf2_build_psymtabs_hard (struct objfile *objfile, int mainline)
DWARF_LINE_SIZE (pst) = dwarf_line_size;
DWARF_STR_BUFFER (pst) = dwarf_str_buffer;
DWARF_STR_SIZE (pst) = dwarf_str_size;
+ DWARF_MACINFO_BUFFER (pst) = dwarf_macinfo_buffer;
+ DWARF_MACINFO_SIZE (pst) = dwarf_macinfo_size;
baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
/* Store the function that reads in the rest of the symbol table */
@@ -1476,6 +1533,8 @@ psymtab_to_symtab_1 (struct partial_symtab *pst)
dwarf_line_size = DWARF_LINE_SIZE (pst);
dwarf_str_buffer = DWARF_STR_BUFFER (pst);
dwarf_str_size = DWARF_STR_SIZE (pst);
+ dwarf_macinfo_buffer = DWARF_MACINFO_BUFFER (pst);
+ dwarf_macinfo_size = DWARF_MACINFO_SIZE (pst);
baseaddr = ANOFFSET (pst->section_offsets, SECT_OFF_TEXT (objfile));
cu_header_offset = offset;
info_ptr = dwarf_info_buffer + offset;
@@ -1738,6 +1797,17 @@ read_file_scope (struct die_info *die, struct objfile *objfile,
}
}
+ /* Decode macro information, if present. Dwarf 2 macro information
+ refers to information in the line number info statement program
+ header, so we can only read it if we've read the header
+ successfully. */
+ attr = dwarf_attr (die, DW_AT_macro_info);
+ if (attr)
+ {
+ unsigned int macro_offset = DW_UNSND (attr);
+ dwarf_decode_macros (line_header, macro_offset,
+ comp_dir, abfd, cu_header, objfile);
+ }
do_cleanups (back_to);
}
@@ -2162,7 +2232,7 @@ 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,
+ struct objfile *objfile,
const struct comp_unit_head *cu_header)
{
struct attribute *attr;
@@ -2228,23 +2298,13 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die,
if (die->type && TYPE_CODE (die->type) == TYPE_CODE_FUNC)
{
struct type *return_type = TYPE_TARGET_TYPE (die->type);
- struct type **arg_types;
int nparams = TYPE_NFIELDS (die->type);
- int iparams;
- /* Copy argument types from the subroutine type. */
- arg_types = (struct type **)
- TYPE_ALLOC (fnp->type, (nparams + 1) * sizeof (struct type *));
- for (iparams = 0; iparams < nparams; iparams++)
- arg_types[iparams] = TYPE_FIELD_TYPE (die->type, iparams);
-
- /* Set last entry in argument type vector. */
- if (TYPE_VARARGS (die->type))
- arg_types[nparams] = NULL;
- else
- arg_types[nparams] = dwarf2_fundamental_type (objfile, FT_VOID);
-
- smash_to_method_type (fnp->type, type, return_type, arg_types);
+ smash_to_method_type (fnp->type, die->type,
+ TYPE_TARGET_TYPE (die->type),
+ TYPE_FIELDS (die->type),
+ TYPE_NFIELDS (die->type),
+ TYPE_VARARGS (die->type));
/* Handle static member functions.
Dwarf2 has no clean way to discern C++ static and non-static
@@ -2414,7 +2474,7 @@ read_structure_scope (struct die_info *die, struct objfile *objfile,
{
/* C++ member function. */
process_die (child_die, objfile, cu_header);
- dwarf2_add_member_fn (&fi, child_die, type, objfile, cu_header);
+ dwarf2_add_member_fn (&fi, child_die, objfile, cu_header);
}
else if (child_die->tag == DW_TAG_inheritance)
{
@@ -4012,18 +4072,18 @@ static void
free_line_header (struct line_header *lh)
{
if (lh->standard_opcode_lengths)
- free (lh->standard_opcode_lengths);
+ xfree (lh->standard_opcode_lengths);
/* Remember that all the lh->file_names[i].name pointers are
pointers into debug_line_buffer, and don't need to be freed. */
if (lh->file_names)
- free (lh->file_names);
+ xfree (lh->file_names);
/* Similarly for the include directory names. */
if (lh->include_dirs)
- free (lh->include_dirs);
+ xfree (lh->include_dirs);
- free (lh);
+ xfree (lh);
}
@@ -6367,3 +6427,376 @@ dwarf_alloc_die (void)
memset (die, 0, sizeof (struct die_info));
return (die);
}
+
+
+/* Macro support. */
+
+
+/* Return the full name of file number I in *LH's file name table.
+ Use COMP_DIR as the name of the current directory of the
+ compilation. The result is allocated using xmalloc; the caller is
+ responsible for freeing it. */
+static char *
+file_full_name (int file, struct line_header *lh, const char *comp_dir)
+{
+ struct file_entry *fe = &lh->file_names[file - 1];
+
+ if (IS_ABSOLUTE_PATH (fe->name))
+ return xstrdup (fe->name);
+ else
+ {
+ const char *dir;
+ int dir_len;
+ char *full_name;
+
+ if (fe->dir_index)
+ dir = lh->include_dirs[fe->dir_index - 1];
+ else
+ dir = comp_dir;
+
+ if (dir)
+ {
+ dir_len = strlen (dir);
+ full_name = xmalloc (dir_len + 1 + strlen (fe->name) + 1);
+ strcpy (full_name, dir);
+ full_name[dir_len] = '/';
+ strcpy (full_name + dir_len + 1, fe->name);
+ return full_name;
+ }
+ else
+ return xstrdup (fe->name);
+ }
+}
+
+
+static struct macro_source_file *
+macro_start_file (int file, int line,
+ struct macro_source_file *current_file,
+ const char *comp_dir,
+ struct line_header *lh, struct objfile *objfile)
+{
+ /* The full name of this source file. */
+ char *full_name = file_full_name (file, lh, comp_dir);
+
+ /* We don't create a macro table for this compilation unit
+ at all until we actually get a filename. */
+ if (! pending_macros)
+ pending_macros = new_macro_table (&objfile->symbol_obstack,
+ &objfile->macro_cache);
+
+ if (! current_file)
+ /* If we have no current file, then this must be the start_file
+ directive for the compilation unit's main source file. */
+ current_file = macro_set_main (pending_macros, full_name);
+ else
+ current_file = macro_include (current_file, line, full_name);
+
+ xfree (full_name);
+
+ return current_file;
+}
+
+
+/* Copy the LEN characters at BUF to a xmalloc'ed block of memory,
+ followed by a null byte. */
+static char *
+copy_string (const char *buf, int len)
+{
+ char *s = xmalloc (len + 1);
+ memcpy (s, buf, len);
+ s[len] = '\0';
+
+ return s;
+}
+
+
+static const char *
+consume_improper_spaces (const char *p, const char *body)
+{
+ if (*p == ' ')
+ {
+ complain (&dwarf2_macro_spaces_in_definition, body);
+
+ while (*p == ' ')
+ p++;
+ }
+
+ return p;
+}
+
+
+static void
+parse_macro_definition (struct macro_source_file *file, int line,
+ const char *body)
+{
+ const char *p;
+
+ /* The body string takes one of two forms. For object-like macro
+ definitions, it should be:
+
+ <macro name> " " <definition>
+
+ For function-like macro definitions, it should be:
+
+ <macro name> "() " <definition>
+ or
+ <macro name> "(" <arg name> ( "," <arg name> ) * ") " <definition>
+
+ Spaces may appear only where explicitly indicated, and in the
+ <definition>.
+
+ The Dwarf 2 spec says that an object-like macro's name is always
+ followed by a space, but versions of GCC around March 2002 omit
+ the space when the macro's definition is the empty string.
+
+ The Dwarf 2 spec says that there should be no spaces between the
+ formal arguments in a function-like macro's formal argument list,
+ but versions of GCC around March 2002 include spaces after the
+ commas. */
+
+
+ /* Find the extent of the macro name. The macro name is terminated
+ by either a space or null character (for an object-like macro) or
+ an opening paren (for a function-like macro). */
+ for (p = body; *p; p++)
+ if (*p == ' ' || *p == '(')
+ break;
+
+ if (*p == ' ' || *p == '\0')
+ {
+ /* It's an object-like macro. */
+ int name_len = p - body;
+ char *name = copy_string (body, name_len);
+ const char *replacement;
+
+ if (*p == ' ')
+ replacement = body + name_len + 1;
+ else
+ {
+ complain (&dwarf2_macro_malformed_definition, body);
+ replacement = body + name_len;
+ }
+
+ macro_define_object (file, line, name, replacement);
+
+ xfree (name);
+ }
+ else if (*p == '(')
+ {
+ /* It's a function-like macro. */
+ char *name = copy_string (body, p - body);
+ int argc = 0;
+ int argv_size = 1;
+ char **argv = xmalloc (argv_size * sizeof (*argv));
+
+ p++;
+
+ p = consume_improper_spaces (p, body);
+
+ /* Parse the formal argument list. */
+ while (*p && *p != ')')
+ {
+ /* Find the extent of the current argument name. */
+ const char *arg_start = p;
+
+ while (*p && *p != ',' && *p != ')' && *p != ' ')
+ p++;
+
+ if (! *p || p == arg_start)
+ complain (&dwarf2_macro_malformed_definition,
+ body);
+ else
+ {
+ /* Make sure argv has room for the new argument. */
+ if (argc >= argv_size)
+ {
+ argv_size *= 2;
+ argv = xrealloc (argv, argv_size * sizeof (*argv));
+ }
+
+ argv[argc++] = copy_string (arg_start, p - arg_start);
+ }
+
+ p = consume_improper_spaces (p, body);
+
+ /* Consume the comma, if present. */
+ if (*p == ',')
+ {
+ p++;
+
+ p = consume_improper_spaces (p, body);
+ }
+ }
+
+ if (*p == ')')
+ {
+ p++;
+
+ if (*p == ' ')
+ /* Perfectly formed definition, no complaints. */
+ macro_define_function (file, line, name,
+ argc, (const char **) argv,
+ p + 1);
+ else if (*p == '\0')
+ {
+ /* Complain, but do define it. */
+ complain (&dwarf2_macro_malformed_definition, body);
+ macro_define_function (file, line, name,
+ argc, (const char **) argv,
+ p);
+ }
+ else
+ /* Just complain. */
+ complain (&dwarf2_macro_malformed_definition, body);
+ }
+ else
+ /* Just complain. */
+ complain (&dwarf2_macro_malformed_definition, body);
+
+ xfree (name);
+ {
+ int i;
+
+ for (i = 0; i < argc; i++)
+ xfree (argv[i]);
+ }
+ xfree (argv);
+ }
+ else
+ complain (&dwarf2_macro_malformed_definition, body);
+}
+
+
+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)
+{
+ char *mac_ptr, *mac_end;
+ struct macro_source_file *current_file = 0;
+
+ if (dwarf_macinfo_buffer == NULL)
+ {
+ complain (&dwarf2_missing_macinfo_section);
+ return;
+ }
+
+ mac_ptr = dwarf_macinfo_buffer + offset;
+ mac_end = dwarf_macinfo_buffer + dwarf_macinfo_size;
+
+ for (;;)
+ {
+ enum dwarf_macinfo_record_type macinfo_type;
+
+ /* Do we at least have room for a macinfo type byte? */
+ if (mac_ptr >= mac_end)
+ {
+ complain (&dwarf2_macros_too_long);
+ return;
+ }
+
+ macinfo_type = read_1_byte (abfd, mac_ptr);
+ mac_ptr++;
+
+ switch (macinfo_type)
+ {
+ /* A zero macinfo type indicates the end of the macro
+ information. */
+ case 0:
+ return;
+
+ case DW_MACINFO_define:
+ case DW_MACINFO_undef:
+ {
+ int bytes_read;
+ int line;
+ char *body;
+
+ line = read_unsigned_leb128 (abfd, mac_ptr, &bytes_read);
+ mac_ptr += bytes_read;
+ body = read_string (abfd, mac_ptr, &bytes_read);
+ mac_ptr += bytes_read;
+
+ if (! current_file)
+ complain (&dwarf2_macro_outside_file,
+ macinfo_type == DW_MACINFO_define ? "definition" :
+ macinfo_type == DW_MACINFO_undef ? "undefinition" :
+ "something-or-other",
+ body);
+ else
+ {
+ if (macinfo_type == DW_MACINFO_define)
+ parse_macro_definition (current_file, line, body);
+ else if (macinfo_type == DW_MACINFO_undef)
+ macro_undef (current_file, line, body);
+ }
+ }
+ break;
+
+ case DW_MACINFO_start_file:
+ {
+ int bytes_read;
+ int line, file;
+
+ line = read_unsigned_leb128 (abfd, mac_ptr, &bytes_read);
+ mac_ptr += bytes_read;
+ file = read_unsigned_leb128 (abfd, mac_ptr, &bytes_read);
+ mac_ptr += bytes_read;
+
+ current_file = macro_start_file (file, line,
+ current_file, comp_dir,
+ lh, objfile);
+ }
+ break;
+
+ case DW_MACINFO_end_file:
+ if (! current_file)
+ complain (&dwarf2_macro_unmatched_end_file);
+ else
+ {
+ current_file = current_file->included_by;
+ if (! current_file)
+ {
+ enum dwarf_macinfo_record_type next_type;
+
+ /* GCC circa March 2002 doesn't produce the zero
+ type byte marking the end of the compilation
+ unit. Complain if it's not there, but exit no
+ matter what. */
+
+ /* Do we at least have room for a macinfo type byte? */
+ if (mac_ptr >= mac_end)
+ {
+ complain (&dwarf2_macros_too_long);
+ return;
+ }
+
+ /* We don't increment mac_ptr here, so this is just
+ a look-ahead. */
+ next_type = read_1_byte (abfd, mac_ptr);
+ if (next_type != 0)
+ complain (&dwarf2_macros_not_terminated);
+
+ return;
+ }
+ }
+ break;
+
+ case DW_MACINFO_vendor_ext:
+ {
+ int bytes_read;
+ int constant;
+ char *string;
+
+ constant = read_unsigned_leb128 (abfd, mac_ptr, &bytes_read);
+ mac_ptr += bytes_read;
+ string = read_string (abfd, mac_ptr, &bytes_read);
+ mac_ptr += bytes_read;
+
+ /* We don't recognize any vendor extensions. */
+ }
+ break;
+ }
+ }
+}
diff --git a/gdb/frame.c b/gdb/frame.c
index 24cd9071437..5c52ed1a0a2 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -1,4 +1,4 @@
-/* Cache and manage the values of registers for GDB, the GNU debugger.
+/* Cache and manage frames for GDB, the GNU debugger.
Copyright 1986, 1987, 1989, 1991, 1994, 1995, 1996, 1998, 2000,
2001, 2002 Free Software Foundation, Inc.
@@ -26,6 +26,57 @@
#include "value.h"
#include "inferior.h" /* for inferior_ptid */
#include "regcache.h"
+#include "gdb_assert.h"
+
+/* Return a frame uniq ID that can be used to, later re-find the
+ frame. */
+
+void
+get_frame_id (struct frame_info *fi, struct frame_id *id)
+{
+ if (fi == NULL)
+ {
+ id->base = 0;
+ id->pc = 0;
+ }
+ else
+ {
+ id->base = FRAME_FP (fi);
+ id->pc = fi->pc;
+ }
+}
+
+struct frame_info *
+frame_find_by_id (struct frame_id id)
+{
+ struct frame_info *frame;
+
+ /* ZERO denotes the null frame, let the caller decide what to do
+ about it. Should it instead return get_current_frame()? */
+ if (id.base == 0 && id.pc == 0)
+ return NULL;
+
+ for (frame = get_current_frame ();
+ frame != NULL;
+ frame = get_prev_frame (frame))
+ {
+ if (INNER_THAN (FRAME_FP (frame), id.base))
+ /* ``inner/current < frame < id.base''. Keep looking along
+ the frame chain. */
+ continue;
+ if (INNER_THAN (id.base, FRAME_FP (frame)))
+ /* ``inner/current < id.base < frame''. Oops, gone past it.
+ Just give up. */
+ return NULL;
+ /* FIXME: cagney/2002-04-21: This isn't sufficient. It should
+ use id.pc to check that the two frames belong to the same
+ function. Otherwise we'll do things like match dummy frames
+ or mis-match frameless functions. However, until someone
+ notices, stick with the existing behavour. */
+ return frame;
+ }
+ return NULL;
+}
/* FIND_SAVED_REGISTER ()
@@ -62,76 +113,95 @@ find_saved_register (struct frame_info *frame, int regnum)
return addr;
}
-/* DEFAULT_GET_SAVED_REGISTER ()
-
- Find register number REGNUM relative to FRAME and put its (raw,
- target format) contents in *RAW_BUFFER. Set *OPTIMIZED if the
- variable was optimized out (and thus can't be fetched). Set *LVAL
- to lval_memory, lval_register, or not_lval, depending on whether
- the value was fetched from memory, from a register, or in a strange
- and non-modifiable way (e.g. a frame pointer which was calculated
- rather than fetched). Set *ADDRP to the address, either in memory
- on as a REGISTER_BYTE offset into the registers array.
-
- Note that this implementation never sets *LVAL to not_lval. But
- it can be replaced by defining GET_SAVED_REGISTER and supplying
- your own.
-
- The argument RAW_BUFFER must point to aligned memory. */
-
-static void
-default_get_saved_register (char *raw_buffer,
- int *optimized,
- CORE_ADDR *addrp,
- struct frame_info *frame,
- int regnum,
- enum lval_type *lval)
+void
+frame_register_unwind (struct frame_info *frame, int regnum,
+ int *optimizedp, enum lval_type *lvalp,
+ CORE_ADDR *addrp, int *realnump, void *bufferp)
{
- CORE_ADDR addr;
+ struct frame_unwind_cache *cache;
+
+ /* Require all but BUFFERP to be valid. A NULL BUFFERP indicates
+ that the value proper does not need to be fetched. */
+ gdb_assert (optimizedp != NULL);
+ gdb_assert (lvalp != NULL);
+ gdb_assert (addrp != NULL);
+ gdb_assert (realnump != NULL);
+ /* gdb_assert (bufferp != NULL); */
+
+ /* NOTE: cagney/2002-04-14: It would be nice if, instead of a
+ special case, there was always an inner frame dedicated to the
+ hardware registers. Unfortunatly, there is too much unwind code
+ around that looks up/down the frame chain while making the
+ assumption that each frame level is using the same unwind code. */
+
+ if (frame == NULL)
+ {
+ /* We're in the inner-most frame, get the value direct from the
+ register cache. */
+ *optimizedp = 0;
+ *lvalp = lval_register;
+ *addrp = 0;
+ /* Should this code test ``register_cached (regnum) < 0'' and do
+ something like set realnum to -1 when the register isn't
+ available? */
+ *realnump = regnum;
+ if (bufferp)
+ read_register_gen (regnum, bufferp);
+ return;
+ }
+
+ /* Ask this frame to unwind its register. */
+ frame->register_unwind (frame, &frame->register_unwind_cache, regnum,
+ optimizedp, lvalp, addrp, realnump, bufferp);
+}
+
+
+void
+generic_unwind_get_saved_register (char *raw_buffer,
+ int *optimizedp,
+ CORE_ADDR *addrp,
+ struct frame_info *frame,
+ int regnum,
+ enum lval_type *lvalp)
+{
+ int optimizedx;
+ CORE_ADDR addrx;
+ int realnumx;
+ enum lval_type lvalx;
if (!target_has_registers)
error ("No registers.");
- /* Normal systems don't optimize out things with register numbers. */
- if (optimized != NULL)
- *optimized = 0;
- addr = find_saved_register (frame, regnum);
- if (addr != 0)
- {
- if (lval != NULL)
- *lval = lval_memory;
- if (regnum == SP_REGNUM)
- {
- if (raw_buffer != NULL)
- {
- /* Put it back in target format. */
- store_address (raw_buffer, REGISTER_RAW_SIZE (regnum),
- (LONGEST) addr);
- }
- if (addrp != NULL)
- *addrp = 0;
- return;
- }
- if (raw_buffer != NULL)
- target_read_memory (addr, raw_buffer, REGISTER_RAW_SIZE (regnum));
- }
+ /* Keep things simple, ensure that all the pointers (except valuep)
+ are non NULL. */
+ if (optimizedp == NULL)
+ optimizedp = &optimizedx;
+ if (lvalp == NULL)
+ lvalp = &lvalx;
+ if (addrp == NULL)
+ addrp = &addrx;
+
+ /* Reached the the bottom (youngest, inner most) of the frame chain
+ (youngest, inner most) frame, go direct to the hardware register
+ cache (do not pass go, do not try to cache the value, ...). The
+ unwound value would have been cached in frame->next but that
+ doesn't exist. This doesn't matter as the hardware register
+ cache is stopping any unnecessary accesses to the target. */
+
+ /* NOTE: cagney/2002-04-14: It would be nice if, instead of a
+ special case, there was always an inner frame dedicated to the
+ hardware registers. Unfortunatly, there is too much unwind code
+ around that looks up/down the frame chain while making the
+ assumption that each frame level is using the same unwind code. */
+
+ if (frame == NULL)
+ frame_register_unwind (NULL, regnum, optimizedp, lvalp, addrp, &realnumx,
+ raw_buffer);
else
- {
- if (lval != NULL)
- *lval = lval_register;
- addr = REGISTER_BYTE (regnum);
- if (raw_buffer != NULL)
- read_register_gen (regnum, raw_buffer);
- }
- if (addrp != NULL)
- *addrp = addr;
+ frame_register_unwind (frame->next, regnum, optimizedp, lvalp, addrp,
+ &realnumx, raw_buffer);
}
-#if !defined (GET_SAVED_REGISTER)
-#define GET_SAVED_REGISTER(raw_buffer, optimized, addrp, frame, regnum, lval) \
- default_get_saved_register(raw_buffer, optimized, addrp, frame, regnum, lval)
-#endif
-
void
get_saved_register (char *raw_buffer,
int *optimized,
diff --git a/gdb/frame.h b/gdb/frame.h
index ff9e9cfbb2a..03a71c7a097 100644
--- a/gdb/frame.h
+++ b/gdb/frame.h
@@ -23,6 +23,29 @@
#if !defined (FRAME_H)
#define FRAME_H 1
+/* Return the location (and possibly value) of REGNUM for the previous
+ (older, up) frame. All parameters except VALUEP can be assumed to
+ be non NULL. When VALUEP is NULL, just the location of the
+ register should be returned.
+
+ UNWIND_CACHE is provided as mechanism for implementing a per-frame
+ local cache. It's initial value being NULL. Memory for that cache
+ should be allocated using frame_obstack_alloc().
+
+ Register window architectures (eg SPARC) should note that REGNUM
+ identifies the register for the previous frame. For instance, a
+ request for the value of "o1" for the previous frame would be found
+ in the register "i1" in this FRAME. */
+
+typedef void (frame_register_unwind_ftype) (struct frame_info *frame,
+ void **unwind_cache,
+ int regnum,
+ int *optimized,
+ enum lval_type *lvalp,
+ CORE_ADDR *addrp,
+ int *realnump,
+ void *valuep);
+
/* Describe the saved registers of a frame. */
#if defined (EXTRA_FRAME_INFO) || defined (FRAME_FIND_SAVED_REGS)
@@ -112,6 +135,11 @@ struct frame_info
related unwind data. */
struct unwind_contect *context;
+ /* See description above. Return the register value for the
+ previous frame. */
+ frame_register_unwind_ftype *register_unwind;
+ void *register_unwind_cache;
+
/* Pointers to the next (down, inner) and previous (up, outer)
frame_info's in the frame cache. */
struct frame_info *next; /* down, inner */
@@ -246,7 +274,21 @@ extern void show_stack_frame (struct frame_info *);
extern void select_frame (struct frame_info *);
-extern void record_selected_frame (CORE_ADDR *, int *);
+/* Return an ID that can be used to re-find a frame. */
+
+struct frame_id
+{
+ /* The frame's address. This should be constant through out the
+ lifetime of a frame. */
+ CORE_ADDR base;
+ /* The frame's current PC. While this changes, the function that
+ the PC falls into, does not. */
+ CORE_ADDR pc;
+};
+
+extern void get_frame_id (struct frame_info *fi, struct frame_id *id);
+
+extern struct frame_info *frame_find_by_id (struct frame_id id);
extern void print_frame_info (struct frame_info *, int, int, int);
@@ -278,6 +320,22 @@ extern void generic_get_saved_register (char *, int *, CORE_ADDR *,
struct frame_info *, int,
enum lval_type *);
+extern void generic_unwind_get_saved_register (char *raw_buffer,
+ int *optimized,
+ CORE_ADDR * addrp,
+ struct frame_info *frame,
+ int regnum,
+ enum lval_type *lval);
+
+/* Unwind the stack frame so that the value of REGNUM, in the previous
+ frame is returned. If VALUEP is NULL, don't fetch/compute the
+ value. Instead just return the location of the value. */
+
+extern void frame_register_unwind (struct frame_info *frame, int regnum,
+ int *optimizedp, enum lval_type *lvalp,
+ CORE_ADDR *addrp, int *realnump,
+ void *valuep);
+
extern void generic_save_call_dummy_addr (CORE_ADDR lo, CORE_ADDR hi);
extern void get_saved_register (char *raw_buffer, int *optimized,
diff --git a/gdb/gdb_indent.sh b/gdb/gdb_indent.sh
index e54e08eac53..1e727fe2309 100755
--- a/gdb/gdb_indent.sh
+++ b/gdb/gdb_indent.sh
@@ -47,6 +47,7 @@ esac
case `pwd` in
*/gdb ) ;;
+ */sim/* ) ;;
* ) echo "Not in GDB directory" 1>&2 ; exit 1 ;;
esac
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index 5c57110c444..96737928234 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -68,7 +68,6 @@
static void verify_gdbarch (struct gdbarch *gdbarch);
static void alloc_gdbarch_data (struct gdbarch *);
-static void init_gdbarch_data (struct gdbarch *);
static void free_gdbarch_data (struct gdbarch *);
static void init_gdbarch_swap (struct gdbarch *);
static void clear_gdbarch_swap (struct gdbarch *);
@@ -87,6 +86,8 @@ int gdbarch_debug = GDBARCH_DEBUG;
struct gdbarch
{
+ /* Has this architecture been fully initialized? */
+ int initialized_p;
/* basic architectural information */
const struct bfd_arch_info * bfd_arch_info;
int byte_order;
@@ -209,6 +210,7 @@ struct gdbarch
gdbarch_integer_to_address_ftype *integer_to_address;
gdbarch_return_value_on_stack_ftype *return_value_on_stack;
gdbarch_extract_return_value_ftype *extract_return_value;
+ gdbarch_deprecated_extract_return_value_ftype *deprecated_extract_return_value;
gdbarch_push_arguments_ftype *push_arguments;
gdbarch_push_dummy_frame_ftype *push_dummy_frame;
gdbarch_push_return_address_ftype *push_return_address;
@@ -216,6 +218,7 @@ struct gdbarch
gdbarch_store_struct_return_ftype *store_struct_return;
gdbarch_store_return_value_ftype *store_return_value;
gdbarch_extract_struct_value_address_ftype *extract_struct_value_address;
+ gdbarch_deprecated_extract_struct_value_address_ftype *deprecated_extract_struct_value_address;
gdbarch_use_struct_convention_ftype *use_struct_convention;
gdbarch_frame_init_saved_regs_ftype *frame_init_saved_regs;
gdbarch_init_extra_frame_info_ftype *init_extra_frame_info;
@@ -269,6 +272,7 @@ extern const struct bfd_arch_info bfd_default_arch_struct;
struct gdbarch startup_gdbarch =
{
+ 1, /* Always initialized. */
/* basic architecture information */
&bfd_default_arch_struct,
BFD_ENDIAN_BIG,
@@ -319,6 +323,9 @@ struct gdbarch startup_gdbarch =
0,
0,
0,
+ default_print_float_info,
+ 0,
+ 0,
0,
0,
0,
@@ -344,7 +351,6 @@ struct gdbarch startup_gdbarch =
0,
0,
0,
- generic_get_saved_register,
0,
0,
0,
@@ -423,7 +429,6 @@ initialize_non_multiarch ()
they are starting from scratch. */
clear_gdbarch_swap (&startup_gdbarch);
init_gdbarch_swap (&startup_gdbarch);
- init_gdbarch_data (&startup_gdbarch);
}
@@ -488,7 +493,7 @@ gdbarch_alloc (const struct gdbarch_info *info,
current_gdbarch->max_register_virtual_size = -1;
current_gdbarch->do_registers_info = do_registers_info;
current_gdbarch->print_float_info = default_print_float_info;
- current_gdbarch->register_sim_regno = default_register_sim_regno;
+ current_gdbarch->register_sim_regno = legacy_register_sim_regno;
current_gdbarch->cannot_fetch_register = cannot_register_not;
current_gdbarch->cannot_store_register = cannot_register_not;
current_gdbarch->use_generic_dummy_frames = -1;
@@ -503,6 +508,7 @@ gdbarch_alloc (const struct gdbarch_info *info,
current_gdbarch->init_frame_pc_first = init_frame_pc_noop;
current_gdbarch->init_frame_pc = init_frame_pc_default;
current_gdbarch->coerce_float_to_double = default_coerce_float_to_double;
+ current_gdbarch->get_saved_register = generic_unwind_get_saved_register;
current_gdbarch->register_convertible = generic_register_convertible_not;
current_gdbarch->convert_register_p = legacy_convert_register_p;
current_gdbarch->register_to_value = legacy_register_to_value;
@@ -522,7 +528,7 @@ gdbarch_alloc (const struct gdbarch_info *info,
current_gdbarch->remote_translate_xfer_address = generic_remote_translate_xfer_address;
current_gdbarch->frame_args_skip = -1;
current_gdbarch->frameless_function_invocation = generic_frameless_function_invocation_not;
- current_gdbarch->frame_chain_valid = func_frame_chain_valid;
+ current_gdbarch->frame_chain_valid = generic_func_frame_chain_valid;
current_gdbarch->extra_stack_alignment_needed = 1;
current_gdbarch->convert_from_func_ptr_addr = core_addr_identity;
current_gdbarch->addr_bits_remove = core_addr_identity;
@@ -681,9 +687,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
/* Skip verify of init_frame_pc_first, invalid_p == 0 */
/* Skip verify of init_frame_pc, invalid_p == 0 */
/* Skip verify of coerce_float_to_double, invalid_p == 0 */
- if ((GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL)
- && (gdbarch->get_saved_register == 0))
- fprintf_unfiltered (log, "\n\tget_saved_register");
+ /* Skip verify of get_saved_register, invalid_p == 0 */
/* Skip verify of register_convertible, invalid_p == 0 */
/* Skip verify of register_convert_to_virtual, invalid_p == 0 */
/* Skip verify of register_convert_to_raw, invalid_p == 0 */
@@ -699,6 +703,9 @@ verify_gdbarch (struct gdbarch *gdbarch)
if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
&& (gdbarch->extract_return_value == 0))
fprintf_unfiltered (log, "\n\textract_return_value");
+ if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
+ && (gdbarch->deprecated_extract_return_value == 0))
+ fprintf_unfiltered (log, "\n\tdeprecated_extract_return_value");
/* Skip verify of push_arguments, invalid_p == 0 */
if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
&& (gdbarch->push_dummy_frame == 0))
@@ -714,6 +721,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
&& (gdbarch->store_return_value == 0))
fprintf_unfiltered (log, "\n\tstore_return_value");
/* Skip verify of extract_struct_value_address, has predicate */
+ /* Skip verify of deprecated_extract_struct_value_address, has predicate */
/* Skip verify of use_struct_convention, invalid_p == 0 */
if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
&& (gdbarch->frame_init_saved_regs == 0))
@@ -1038,6 +1046,31 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
"gdbarch_dump: DECR_PC_AFTER_BREAK = %ld\n",
(long) DECR_PC_AFTER_BREAK);
#endif
+#ifdef DEPRECATED_EXTRACT_RETURN_VALUE
+#if GDB_MULTI_ARCH
+ /* Macro might contain `[{}]' when not multi-arch */
+ fprintf_unfiltered (file,
+ "gdbarch_dump: %s # %s\n",
+ "DEPRECATED_EXTRACT_RETURN_VALUE(type, regbuf, valbuf)",
+ XSTRING (DEPRECATED_EXTRACT_RETURN_VALUE (type, regbuf, valbuf)));
+#endif
+ if (GDB_MULTI_ARCH)
+ fprintf_unfiltered (file,
+ "gdbarch_dump: DEPRECATED_EXTRACT_RETURN_VALUE = 0x%08lx\n",
+ (long) current_gdbarch->deprecated_extract_return_value
+ /*DEPRECATED_EXTRACT_RETURN_VALUE ()*/);
+#endif
+#ifdef DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS
+ fprintf_unfiltered (file,
+ "gdbarch_dump: %s # %s\n",
+ "DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(regbuf)",
+ XSTRING (DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS (regbuf)));
+ if (GDB_MULTI_ARCH)
+ fprintf_unfiltered (file,
+ "gdbarch_dump: DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS = 0x%08lx\n",
+ (long) current_gdbarch->deprecated_extract_struct_value_address
+ /*DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS ()*/);
+#endif
#ifdef DO_REGISTERS_INFO
#if GDB_MULTI_ARCH
/* Macro might contain `[{}]' when not multi-arch */
@@ -1533,20 +1566,10 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
(long) current_gdbarch->prepare_to_proceed
/*PREPARE_TO_PROCEED ()*/);
#endif
-#ifdef PRINT_FLOAT_INFO
-#if GDB_MULTI_ARCH
- /* Macro might contain `[{}]' when not multi-arch */
- fprintf_unfiltered (file,
- "gdbarch_dump: %s # %s\n",
- "PRINT_FLOAT_INFO()",
- XSTRING (PRINT_FLOAT_INFO ()));
-#endif
if (GDB_MULTI_ARCH)
fprintf_unfiltered (file,
- "gdbarch_dump: PRINT_FLOAT_INFO = 0x%08lx\n",
- (long) current_gdbarch->print_float_info
- /*PRINT_FLOAT_INFO ()*/);
-#endif
+ "gdbarch_dump: print_float_info = 0x%08lx\n",
+ (long) current_gdbarch->print_float_info);
#ifdef PROLOGUE_FRAMELESS_P
fprintf_unfiltered (file,
"gdbarch_dump: %s # %s\n",
@@ -3007,7 +3030,7 @@ set_gdbarch_do_registers_info (struct gdbarch *gdbarch,
}
void
-gdbarch_print_float_info (struct gdbarch *gdbarch)
+gdbarch_print_float_info (struct gdbarch *gdbarch, struct ui_file *file, struct frame_info *frame)
{
gdb_assert (gdbarch != NULL);
if (gdbarch->print_float_info == 0)
@@ -3015,7 +3038,7 @@ gdbarch_print_float_info (struct gdbarch *gdbarch)
"gdbarch: gdbarch_print_float_info invalid");
if (gdbarch_debug >= 2)
fprintf_unfiltered (gdb_stdlog, "gdbarch_print_float_info called\n");
- gdbarch->print_float_info ();
+ gdbarch->print_float_info (gdbarch, file, frame);
}
void
@@ -3772,6 +3795,25 @@ set_gdbarch_extract_return_value (struct gdbarch *gdbarch,
gdbarch->extract_return_value = extract_return_value;
}
+void
+gdbarch_deprecated_extract_return_value (struct gdbarch *gdbarch, struct type *type, char *regbuf, char *valbuf)
+{
+ gdb_assert (gdbarch != NULL);
+ if (gdbarch->deprecated_extract_return_value == 0)
+ internal_error (__FILE__, __LINE__,
+ "gdbarch: gdbarch_deprecated_extract_return_value invalid");
+ if (gdbarch_debug >= 2)
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_extract_return_value called\n");
+ gdbarch->deprecated_extract_return_value (type, regbuf, valbuf);
+}
+
+void
+set_gdbarch_deprecated_extract_return_value (struct gdbarch *gdbarch,
+ gdbarch_deprecated_extract_return_value_ftype deprecated_extract_return_value)
+{
+ gdbarch->deprecated_extract_return_value = deprecated_extract_return_value;
+}
+
CORE_ADDR
gdbarch_push_arguments (struct gdbarch *gdbarch, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr)
{
@@ -3920,6 +3962,32 @@ set_gdbarch_extract_struct_value_address (struct gdbarch *gdbarch,
}
int
+gdbarch_deprecated_extract_struct_value_address_p (struct gdbarch *gdbarch)
+{
+ gdb_assert (gdbarch != NULL);
+ return gdbarch->deprecated_extract_struct_value_address != 0;
+}
+
+CORE_ADDR
+gdbarch_deprecated_extract_struct_value_address (struct gdbarch *gdbarch, char *regbuf)
+{
+ gdb_assert (gdbarch != NULL);
+ if (gdbarch->deprecated_extract_struct_value_address == 0)
+ internal_error (__FILE__, __LINE__,
+ "gdbarch: gdbarch_deprecated_extract_struct_value_address invalid");
+ if (gdbarch_debug >= 2)
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_extract_struct_value_address called\n");
+ return gdbarch->deprecated_extract_struct_value_address (regbuf);
+}
+
+void
+set_gdbarch_deprecated_extract_struct_value_address (struct gdbarch *gdbarch,
+ gdbarch_deprecated_extract_struct_value_address_ftype deprecated_extract_struct_value_address)
+{
+ gdbarch->deprecated_extract_struct_value_address = deprecated_extract_struct_value_address;
+}
+
+int
gdbarch_use_struct_convention (struct gdbarch *gdbarch, int gcc_p, struct type *value_type)
{
gdb_assert (gdbarch != NULL);
@@ -4771,6 +4839,7 @@ set_gdbarch_coff_make_msymbol_special (struct gdbarch *gdbarch,
struct gdbarch_data
{
unsigned index;
+ int init_p;
gdbarch_data_init_ftype *init;
gdbarch_data_free_ftype *free;
};
@@ -4797,6 +4866,7 @@ register_gdbarch_data (gdbarch_data_init_ftype *init,
gdbarch_data_free_ftype *free)
{
struct gdbarch_data_registration **curr;
+ /* Append the new registraration. */
for (curr = &gdbarch_data_registry.registrations;
(*curr) != NULL;
curr = &(*curr)->next);
@@ -4805,31 +4875,12 @@ register_gdbarch_data (gdbarch_data_init_ftype *init,
(*curr)->data = XMALLOC (struct gdbarch_data);
(*curr)->data->index = gdbarch_data_registry.nr++;
(*curr)->data->init = init;
+ (*curr)->data->init_p = 1;
(*curr)->data->free = free;
return (*curr)->data;
}
-/* Walk through all the registered users initializing each in turn. */
-
-static void
-init_gdbarch_data (struct gdbarch *gdbarch)
-{
- struct gdbarch_data_registration *rego;
- for (rego = gdbarch_data_registry.registrations;
- rego != NULL;
- rego = rego->next)
- {
- struct gdbarch_data *data = rego->data;
- gdb_assert (data->index < gdbarch->nr_data);
- if (data->init != NULL)
- {
- void *pointer = data->init (gdbarch);
- set_gdbarch_data (gdbarch, data, pointer);
- }
- }
-}
-
/* Create/delete the gdbarch data vector. */
static void
@@ -4862,7 +4913,7 @@ free_gdbarch_data (struct gdbarch *gdbarch)
}
-/* Initialize the current value of thee specified per-architecture
+/* Initialize the current value of the specified per-architecture
data-pointer. */
void
@@ -4871,8 +4922,11 @@ set_gdbarch_data (struct gdbarch *gdbarch,
void *pointer)
{
gdb_assert (data->index < gdbarch->nr_data);
- if (data->free != NULL && gdbarch->data[data->index] != NULL)
- data->free (gdbarch, gdbarch->data[data->index]);
+ if (gdbarch->data[data->index] != NULL)
+ {
+ gdb_assert (data->free != NULL);
+ data->free (gdbarch, gdbarch->data[data->index]);
+ }
gdbarch->data[data->index] = pointer;
}
@@ -4883,6 +4937,20 @@ void *
gdbarch_data (struct gdbarch *gdbarch, struct gdbarch_data *data)
{
gdb_assert (data->index < gdbarch->nr_data);
+ /* The data-pointer isn't initialized, call init() to get a value but
+ only if the architecture initializaiton has completed. Otherwise
+ punt - hope that the caller knows what they are doing. */
+ if (gdbarch->data[data->index] == NULL
+ && gdbarch->initialized_p)
+ {
+ /* Be careful to detect an initialization cycle. */
+ gdb_assert (data->init_p);
+ data->init_p = 0;
+ gdb_assert (data->init != NULL);
+ gdbarch->data[data->index] = data->init (gdbarch);
+ data->init_p = 1;
+ gdb_assert (gdbarch->data[data->index] != NULL);
+ }
return gdbarch->data[data->index];
}
@@ -5276,8 +5344,9 @@ gdbarch_update_p (struct gdbarch_info info)
rego->arches = this;
}
- /* Switch to this new architecture. Dump it out. */
+ /* Switch to this new architecture marking it initialized. */
current_gdbarch = new_gdbarch;
+ current_gdbarch->initialized_p = 1;
if (gdbarch_debug)
{
fprintf_unfiltered (gdb_stdlog,
@@ -5296,10 +5365,8 @@ gdbarch_update_p (struct gdbarch_info info)
called. */
init_gdbarch_swap (new_gdbarch);
- /* Initialize the per-architecture data-pointer of all parties that
- registered an interest in this architecture. CURRENT_GDBARCH
+ /* Initialize the per-architecture data. CURRENT_GDBARCH
must be updated before these modules are called. */
- init_gdbarch_data (new_gdbarch);
architecture_changed_event ();
if (gdbarch_debug)
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index ce3f93c0612..8b2736650cc 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -790,29 +790,16 @@ extern void set_gdbarch_do_registers_info (struct gdbarch *gdbarch, gdbarch_do_r
#endif
#endif
-/* Default (function) for non- multi-arch platforms. */
-#if (!GDB_MULTI_ARCH) && !defined (PRINT_FLOAT_INFO)
-#define PRINT_FLOAT_INFO() (default_print_float_info ())
-#endif
-
-typedef void (gdbarch_print_float_info_ftype) (void);
-extern void gdbarch_print_float_info (struct gdbarch *gdbarch);
+typedef void (gdbarch_print_float_info_ftype) (struct gdbarch *gdbarch, struct ui_file *file, struct frame_info *frame);
+extern void gdbarch_print_float_info (struct gdbarch *gdbarch, struct ui_file *file, struct frame_info *frame);
extern void set_gdbarch_print_float_info (struct gdbarch *gdbarch, gdbarch_print_float_info_ftype *print_float_info);
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (PRINT_FLOAT_INFO)
-#error "Non multi-arch definition of PRINT_FLOAT_INFO"
-#endif
-#if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (PRINT_FLOAT_INFO)
-#define PRINT_FLOAT_INFO() (gdbarch_print_float_info (current_gdbarch))
-#endif
-#endif
/* MAP a GDB RAW register number onto a simulator register number. See
also include/...-sim.h. */
/* Default (function) for non- multi-arch platforms. */
#if (!GDB_MULTI_ARCH) && !defined (REGISTER_SIM_REGNO)
-#define REGISTER_SIM_REGNO(reg_nr) (default_register_sim_regno (reg_nr))
+#define REGISTER_SIM_REGNO(reg_nr) (legacy_register_sim_regno (reg_nr))
#endif
typedef int (gdbarch_register_sim_regno_ftype) (int reg_nr);
@@ -1185,18 +1172,19 @@ extern void set_gdbarch_coerce_float_to_double (struct gdbarch *gdbarch, gdbarch
#endif
#endif
-/* GET_SAVED_REGISTER is like DUMMY_FRAMES. It is at level one as the
- old code has strange #ifdef interaction. So far no one has found
- that default_get_saved_register() is the default they are after. */
+/* Default (function) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (GET_SAVED_REGISTER)
+#define GET_SAVED_REGISTER(raw_buffer, optimized, addrp, frame, regnum, lval) (generic_unwind_get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lval))
+#endif
typedef void (gdbarch_get_saved_register_ftype) (char *raw_buffer, int *optimized, CORE_ADDR *addrp, struct frame_info *frame, int regnum, enum lval_type *lval);
extern void gdbarch_get_saved_register (struct gdbarch *gdbarch, char *raw_buffer, int *optimized, CORE_ADDR *addrp, struct frame_info *frame, int regnum, enum lval_type *lval);
extern void set_gdbarch_get_saved_register (struct gdbarch *gdbarch, gdbarch_get_saved_register_ftype *get_saved_register);
-#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) && defined (GET_SAVED_REGISTER)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (GET_SAVED_REGISTER)
#error "Non multi-arch definition of GET_SAVED_REGISTER"
#endif
#if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) || !defined (GET_SAVED_REGISTER)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (GET_SAVED_REGISTER)
#define GET_SAVED_REGISTER(raw_buffer, optimized, addrp, frame, regnum, lval) (gdbarch_get_saved_register (current_gdbarch, raw_buffer, optimized, addrp, frame, regnum, lval))
#endif
#endif
@@ -1485,6 +1473,18 @@ extern void set_gdbarch_extract_return_value (struct gdbarch *gdbarch, gdbarch_e
#endif
#endif
+typedef void (gdbarch_deprecated_extract_return_value_ftype) (struct type *type, char *regbuf, char *valbuf);
+extern void gdbarch_deprecated_extract_return_value (struct gdbarch *gdbarch, struct type *type, char *regbuf, char *valbuf);
+extern void set_gdbarch_deprecated_extract_return_value (struct gdbarch *gdbarch, gdbarch_deprecated_extract_return_value_ftype *deprecated_extract_return_value);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_EXTRACT_RETURN_VALUE)
+#error "Non multi-arch definition of DEPRECATED_EXTRACT_RETURN_VALUE"
+#endif
+#if GDB_MULTI_ARCH
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_EXTRACT_RETURN_VALUE)
+#define DEPRECATED_EXTRACT_RETURN_VALUE(type, regbuf, valbuf) (gdbarch_deprecated_extract_return_value (current_gdbarch, type, regbuf, valbuf))
+#endif
+#endif
+
/* Default (function) for non- multi-arch platforms. */
#if (!GDB_MULTI_ARCH) && !defined (PUSH_ARGUMENTS)
#define PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr) (default_push_arguments (nargs, args, sp, struct_return, struct_addr))
@@ -1624,6 +1624,43 @@ extern void set_gdbarch_extract_struct_value_address (struct gdbarch *gdbarch, g
#endif
#endif
+#if defined (DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS)
+/* Legacy for systems yet to multi-arch DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS */
+#if !defined (DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS_P)
+#define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS_P() (1)
+#endif
+#endif
+
+/* Default predicate for non- multi-arch targets. */
+#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS_P)
+#define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS_P() (0)
+#endif
+
+extern int gdbarch_deprecated_extract_struct_value_address_p (struct gdbarch *gdbarch);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS_P)
+#error "Non multi-arch definition of DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS"
+#endif
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS_P)
+#define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS_P() (gdbarch_deprecated_extract_struct_value_address_p (current_gdbarch))
+#endif
+
+/* Default (function) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS)
+#define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(regbuf) (internal_error (__FILE__, __LINE__, "DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS"), 0)
+#endif
+
+typedef CORE_ADDR (gdbarch_deprecated_extract_struct_value_address_ftype) (char *regbuf);
+extern CORE_ADDR gdbarch_deprecated_extract_struct_value_address (struct gdbarch *gdbarch, char *regbuf);
+extern void set_gdbarch_deprecated_extract_struct_value_address (struct gdbarch *gdbarch, gdbarch_deprecated_extract_struct_value_address_ftype *deprecated_extract_struct_value_address);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS)
+#error "Non multi-arch definition of DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS"
+#endif
+#if GDB_MULTI_ARCH
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS)
+#define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(regbuf) (gdbarch_deprecated_extract_struct_value_address (current_gdbarch, regbuf))
+#endif
+#endif
+
/* Default (function) for non- multi-arch platforms. */
#if (!GDB_MULTI_ARCH) && !defined (USE_STRUCT_CONVENTION)
#define USE_STRUCT_CONVENTION(gcc_p, value_type) (generic_use_struct_convention (gcc_p, value_type))
@@ -1888,7 +1925,7 @@ extern void set_gdbarch_frame_chain (struct gdbarch *gdbarch, gdbarch_frame_chai
/* Default (function) for non- multi-arch platforms. */
#if (!GDB_MULTI_ARCH) && !defined (FRAME_CHAIN_VALID)
-#define FRAME_CHAIN_VALID(chain, thisframe) (func_frame_chain_valid (chain, thisframe))
+#define FRAME_CHAIN_VALID(chain, thisframe) (generic_func_frame_chain_valid (chain, thisframe))
#endif
typedef int (gdbarch_frame_chain_valid_ftype) (CORE_ADDR chain, struct frame_info *thisframe);
@@ -2592,20 +2629,15 @@ extern int gdbarch_update_p (struct gdbarch_info info);
for the reserved data-pointer is returned. That identifer should
be saved in a local static variable.
- The per-architecture data-pointer can be initialized in one of two
- ways: The value can be set explicitly using a call to
- set_gdbarch_data(); the value can be set implicitly using the value
- returned by a non-NULL INIT() callback. INIT(), when non-NULL is
- called after the basic architecture vector has been created.
+ The per-architecture data-pointer is either initialized explicitly
+ (set_gdbarch_data()) or implicitly (by INIT() via a call to
+ gdbarch_data()). FREE() is called to delete either an existing
+ data-pointer overridden by set_gdbarch_data() or when the
+ architecture object is being deleted.
When a previously created architecture is re-selected, the
per-architecture data-pointer for that previous architecture is
- restored. INIT() is not called.
-
- During initialization, multiple assignments of the data-pointer are
- allowed, non-NULL values are deleted by calling FREE(). If the
- architecture is deleted using gdbarch_free() all non-NULL data
- pointers are also deleted using FREE().
+ restored. INIT() is not re-called.
Multiple registrarants for any architecture are allowed (and
strongly encouraged). */
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index fd5ff659c92..ca3ac330ec0 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -468,10 +468,10 @@ f:2:REGISTER_VIRTUAL_SIZE:int:register_virtual_size:int reg_nr:reg_nr::generic_r
v:2:MAX_REGISTER_VIRTUAL_SIZE:int:max_register_virtual_size::::0:-1
f:2:REGISTER_VIRTUAL_TYPE:struct type *:register_virtual_type:int reg_nr:reg_nr::0:0
f:2:DO_REGISTERS_INFO:void:do_registers_info:int reg_nr, int fpregs:reg_nr, fpregs:::do_registers_info::0
-f:2:PRINT_FLOAT_INFO:void:print_float_info:void::::default_print_float_info::0
+m:2:PRINT_FLOAT_INFO:void:print_float_info:struct ui_file *file, struct frame_info *frame:file, frame:::default_print_float_info::0
# MAP a GDB RAW register number onto a simulator register number. See
# also include/...-sim.h.
-f:2:REGISTER_SIM_REGNO:int:register_sim_regno:int reg_nr:reg_nr:::default_register_sim_regno::0
+f:2:REGISTER_SIM_REGNO:int:register_sim_regno:int reg_nr:reg_nr:::legacy_register_sim_regno::0
F:2:REGISTER_BYTES_OK:int:register_bytes_ok:long nr_bytes:nr_bytes::0:0
f:2:CANNOT_FETCH_REGISTER:int:cannot_fetch_register:int regnum:regnum:::cannot_register_not::0
f:2:CANNOT_STORE_REGISTER:int:cannot_store_register:int regnum:regnum:::cannot_register_not::0
@@ -505,10 +505,7 @@ f:2:INIT_FRAME_PC:void:init_frame_pc:int fromleaf, struct frame_info *prev:froml
v:2:BELIEVE_PCC_PROMOTION:int:believe_pcc_promotion:::::::
v:2:BELIEVE_PCC_PROMOTION_TYPE:int:believe_pcc_promotion_type:::::::
f:2:COERCE_FLOAT_TO_DOUBLE:int:coerce_float_to_double:struct type *formal, struct type *actual:formal, actual:::default_coerce_float_to_double::0
-# GET_SAVED_REGISTER is like DUMMY_FRAMES. It is at level one as the
-# old code has strange #ifdef interaction. So far no one has found
-# that default_get_saved_register() is the default they are after.
-f:1:GET_SAVED_REGISTER:void:get_saved_register:char *raw_buffer, int *optimized, CORE_ADDR *addrp, struct frame_info *frame, int regnum, enum lval_type *lval:raw_buffer, optimized, addrp, frame, regnum, lval::generic_get_saved_register:0
+f:2:GET_SAVED_REGISTER:void:get_saved_register:char *raw_buffer, int *optimized, CORE_ADDR *addrp, struct frame_info *frame, int regnum, enum lval_type *lval:raw_buffer, optimized, addrp, frame, regnum, lval:::generic_unwind_get_saved_register::0
#
f:2:REGISTER_CONVERTIBLE:int:register_convertible:int nr:nr:::generic_register_convertible_not::0
f:2:REGISTER_CONVERT_TO_VIRTUAL:void:register_convert_to_virtual:int regnum, struct type *type, char *from, char *to:regnum, type, from, to:::0::0
@@ -532,6 +529,7 @@ F:2:INTEGER_TO_ADDRESS:CORE_ADDR:integer_to_address:struct type *type, void *buf
#
f:2:RETURN_VALUE_ON_STACK:int:return_value_on_stack:struct type *type:type:::generic_return_value_on_stack_not::0
f:2:EXTRACT_RETURN_VALUE:void:extract_return_value:struct type *type, struct regcache *regcache, char *valbuf:type, regcache, valbuf::0:0
+f:2:DEPRECATED_EXTRACT_RETURN_VALUE:void:deprecated_extract_return_value:struct type *type, char *regbuf, char *valbuf:type, regbuf, valbuf::0:0
f:2:PUSH_ARGUMENTS:CORE_ADDR:push_arguments:int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr:nargs, args, sp, struct_return, struct_addr:::default_push_arguments::0
f:2:PUSH_DUMMY_FRAME:void:push_dummy_frame:void:-:::0
F:2:PUSH_RETURN_ADDRESS:CORE_ADDR:push_return_address:CORE_ADDR pc, CORE_ADDR sp:pc, sp:::0
@@ -540,6 +538,7 @@ f:2:POP_FRAME:void:pop_frame:void:-:::0
f:2:STORE_STRUCT_RETURN:void:store_struct_return:CORE_ADDR addr, CORE_ADDR sp:addr, sp:::0
f:2:STORE_RETURN_VALUE:void:store_return_value:struct type *type, char *valbuf:type, valbuf:::0
F:2:EXTRACT_STRUCT_VALUE_ADDRESS:CORE_ADDR:extract_struct_value_address:struct regcache *regcache:regcache:::0
+F:2:DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS:CORE_ADDR:deprecated_extract_struct_value_address:char *regbuf:regbuf:::0
f:2:USE_STRUCT_CONVENTION:int:use_struct_convention:int gcc_p, struct type *value_type:gcc_p, value_type:::generic_use_struct_convention::0
#
f:2:FRAME_INIT_SAVED_REGS:void:frame_init_saved_regs:struct frame_info *frame:frame::0:0
@@ -567,7 +566,7 @@ f:2:FRAME_CHAIN:CORE_ADDR:frame_chain:struct frame_info *frame:frame::0:0
# XXXX - both default and alternate frame_chain_valid functions are
# deprecated. New code should use dummy frames and one of the generic
# functions.
-f:2:FRAME_CHAIN_VALID:int:frame_chain_valid:CORE_ADDR chain, struct frame_info *thisframe:chain, thisframe:::func_frame_chain_valid::0
+f:2:FRAME_CHAIN_VALID:int:frame_chain_valid:CORE_ADDR chain, struct frame_info *thisframe:chain, thisframe:::generic_func_frame_chain_valid::0
f:2:FRAME_SAVED_PC:CORE_ADDR:frame_saved_pc:struct frame_info *fi:fi::0:0
f:2:FRAME_ARGS_ADDRESS:CORE_ADDR:frame_args_address:struct frame_info *fi:fi::0:0
f:2:FRAME_LOCALS_ADDRESS:CORE_ADDR:frame_locals_address:struct frame_info *fi:fi::0:0
@@ -1083,20 +1082,15 @@ extern int gdbarch_update_p (struct gdbarch_info info);
for the reserved data-pointer is returned. That identifer should
be saved in a local static variable.
- The per-architecture data-pointer can be initialized in one of two
- ways: The value can be set explicitly using a call to
- set_gdbarch_data(); the value can be set implicitly using the value
- returned by a non-NULL INIT() callback. INIT(), when non-NULL is
- called after the basic architecture vector has been created.
+ The per-architecture data-pointer is either initialized explicitly
+ (set_gdbarch_data()) or implicitly (by INIT() via a call to
+ gdbarch_data()). FREE() is called to delete either an existing
+ data-pointer overridden by set_gdbarch_data() or when the
+ architecture object is being deleted.
When a previously created architecture is re-selected, the
per-architecture data-pointer for that previous architecture is
- restored. INIT() is not called.
-
- During initialization, multiple assignments of the data-pointer are
- allowed, non-NULL values are deleted by calling FREE(). If the
- architecture is deleted using gdbarch_free() all non-NULL data
- pointers are also deleted using FREE().
+ restored. INIT() is not re-called.
Multiple registrarants for any architecture are allowed (and
strongly encouraged). */
@@ -1250,7 +1244,6 @@ cat <<EOF
static void verify_gdbarch (struct gdbarch *gdbarch);
static void alloc_gdbarch_data (struct gdbarch *);
-static void init_gdbarch_data (struct gdbarch *);
static void free_gdbarch_data (struct gdbarch *);
static void init_gdbarch_swap (struct gdbarch *);
static void clear_gdbarch_swap (struct gdbarch *);
@@ -1272,6 +1265,8 @@ printf "/* Maintain the struct gdbarch object */\n"
printf "\n"
printf "struct gdbarch\n"
printf "{\n"
+printf " /* Has this architecture been fully initialized? */\n"
+printf " int initialized_p;\n"
printf " /* basic architectural information */\n"
function_list | while do_read
do
@@ -1344,6 +1339,7 @@ printf "extern const struct bfd_arch_info bfd_default_arch_struct;\n"
printf "\n"
printf "struct gdbarch startup_gdbarch =\n"
printf "{\n"
+printf " 1, /* Always initialized. */\n"
printf " /* basic architecture information */\n"
function_list | while do_read
do
@@ -1382,7 +1378,6 @@ initialize_non_multiarch ()
they are starting from scratch. */
clear_gdbarch_swap (&startup_gdbarch);
init_gdbarch_swap (&startup_gdbarch);
- init_gdbarch_data (&startup_gdbarch);
}
EOF
@@ -1748,6 +1743,7 @@ cat <<EOF
struct gdbarch_data
{
unsigned index;
+ int init_p;
gdbarch_data_init_ftype *init;
gdbarch_data_free_ftype *free;
};
@@ -1774,6 +1770,7 @@ register_gdbarch_data (gdbarch_data_init_ftype *init,
gdbarch_data_free_ftype *free)
{
struct gdbarch_data_registration **curr;
+ /* Append the new registraration. */
for (curr = &gdbarch_data_registry.registrations;
(*curr) != NULL;
curr = &(*curr)->next);
@@ -1782,31 +1779,12 @@ register_gdbarch_data (gdbarch_data_init_ftype *init,
(*curr)->data = XMALLOC (struct gdbarch_data);
(*curr)->data->index = gdbarch_data_registry.nr++;
(*curr)->data->init = init;
+ (*curr)->data->init_p = 1;
(*curr)->data->free = free;
return (*curr)->data;
}
-/* Walk through all the registered users initializing each in turn. */
-
-static void
-init_gdbarch_data (struct gdbarch *gdbarch)
-{
- struct gdbarch_data_registration *rego;
- for (rego = gdbarch_data_registry.registrations;
- rego != NULL;
- rego = rego->next)
- {
- struct gdbarch_data *data = rego->data;
- gdb_assert (data->index < gdbarch->nr_data);
- if (data->init != NULL)
- {
- void *pointer = data->init (gdbarch);
- set_gdbarch_data (gdbarch, data, pointer);
- }
- }
-}
-
/* Create/delete the gdbarch data vector. */
static void
@@ -1839,7 +1817,7 @@ free_gdbarch_data (struct gdbarch *gdbarch)
}
-/* Initialize the current value of thee specified per-architecture
+/* Initialize the current value of the specified per-architecture
data-pointer. */
void
@@ -1848,8 +1826,11 @@ set_gdbarch_data (struct gdbarch *gdbarch,
void *pointer)
{
gdb_assert (data->index < gdbarch->nr_data);
- if (data->free != NULL && gdbarch->data[data->index] != NULL)
- data->free (gdbarch, gdbarch->data[data->index]);
+ if (gdbarch->data[data->index] != NULL)
+ {
+ gdb_assert (data->free != NULL);
+ data->free (gdbarch, gdbarch->data[data->index]);
+ }
gdbarch->data[data->index] = pointer;
}
@@ -1860,6 +1841,20 @@ void *
gdbarch_data (struct gdbarch *gdbarch, struct gdbarch_data *data)
{
gdb_assert (data->index < gdbarch->nr_data);
+ /* The data-pointer isn't initialized, call init() to get a value but
+ only if the architecture initializaiton has completed. Otherwise
+ punt - hope that the caller knows what they are doing. */
+ if (gdbarch->data[data->index] == NULL
+ && gdbarch->initialized_p)
+ {
+ /* Be careful to detect an initialization cycle. */
+ gdb_assert (data->init_p);
+ data->init_p = 0;
+ gdb_assert (data->init != NULL);
+ gdbarch->data[data->index] = data->init (gdbarch);
+ data->init_p = 1;
+ gdb_assert (gdbarch->data[data->index] != NULL);
+ }
return gdbarch->data[data->index];
}
@@ -2253,8 +2248,9 @@ gdbarch_update_p (struct gdbarch_info info)
rego->arches = this;
}
- /* Switch to this new architecture. Dump it out. */
+ /* Switch to this new architecture marking it initialized. */
current_gdbarch = new_gdbarch;
+ current_gdbarch->initialized_p = 1;
if (gdbarch_debug)
{
fprintf_unfiltered (gdb_stdlog,
@@ -2273,10 +2269,8 @@ gdbarch_update_p (struct gdbarch_info info)
called. */
init_gdbarch_swap (new_gdbarch);
- /* Initialize the per-architecture data-pointer of all parties that
- registered an interest in this architecture. CURRENT_GDBARCH
+ /* Initialize the per-architecture data. CURRENT_GDBARCH
must be updated before these modules are called. */
- init_gdbarch_data (new_gdbarch);
architecture_changed_event ();
if (gdbarch_debug)
diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in
index 2c8cd3366b4..bc9256b79cd 100644
--- a/gdb/gdbserver/Makefile.in
+++ b/gdb/gdbserver/Makefile.in
@@ -126,6 +126,7 @@ OBS = inferiors.o regcache.o remote-utils.o server.o signals.o target.o \
utils.o \
mem-break.o \
$(DEPFILES)
+GDBSERVER_LIBS = @GDBSERVER_LIBS@
# Prevent Sun make from putting in the machine type. Setting
# TARGET_ARCH to nothing works for SunOS 3, 4.0, but not for 4.1.
@@ -231,6 +232,7 @@ MAKEOVERRIDES=
## with no dependencies and no actions.
unexport CHILLFLAGS CHILL_LIB CHILL_FOR_TARGET :
+gdb_proc_service_h = $(srcdir)/../gdb_proc_service.h $(srcdir)/../gregset.h
regdat_sh = $(srcdir)/../regformats/regdat.sh
regdef_h = $(srcdir)/../regformats/regdef.h
regcache_h = $(srcdir)/regcache.h
@@ -239,10 +241,12 @@ server_h = $(srcdir)/server.h $(regcache_h) config.h $(srcdir)/target.h \
inferiors.o: inferiors.c $(server_h)
mem-break.o: mem-break.c $(server_h)
+proc-service.o: proc-service.c $(server_h) $(gdb_proc_service_h)
regcache.o: regcache.c $(server_h) $(regdef_h)
remote-utils.o: remote-utils.c terminal.h $(server_h)
server.o: server.c $(server_h)
target.o: target.c $(server_h)
+thread-db.o: thread-db.c $(server_h) $(gdb_proc_service_h)
utils.o: utils.c $(server_h)
signals.o: ../signals/signals.c $(server_h)
@@ -253,6 +257,8 @@ i387-fp.o: i387-fp.c $(server_h)
linux_low_h = $(srcdir)/linux-low.h
linux-low.o: linux-low.c $(linux_low_h) $(server_h)
+ $(CC) -c $(CPPFLAGS) $(INTERNAL_CFLAGS) $< @USE_THREAD_DB@
+
linux-arm-low.o: linux-arm-low.c $(linux_low_h) $(server_h)
linux-i386-low.o: linux-i386-low.c $(linux_low_h) $(server_h)
linux-ia64-low.o: linux-ia64-low.c $(linux_low_h) $(server_h)
diff --git a/gdb/gdbserver/acconfig.h b/gdb/gdbserver/acconfig.h
index 968feb8b436..f0464b0a280 100644
--- a/gdb/gdbserver/acconfig.h
+++ b/gdb/gdbserver/acconfig.h
@@ -7,3 +7,18 @@
/* Define if the target supports PTRACE_GETFPXREGS for extended
register access. */
#undef HAVE_PTRACE_GETFPXREGS
+
+/* Define if <sys/procfs.h> has prgregset_t. */
+#undef HAVE_PRGREGSET_T
+
+/* Define if <sys/procfs.h> has prfpregset_t. */
+#undef HAVE_PRFPREGSET_T
+
+/* Define if <sys/procfs.h> has lwpid_t. */
+#undef HAVE_LWPID_T
+
+/* Define if <sys/procfs.h> has psaddr_t. */
+#undef HAVE_PSADDR_T
+
+/* Define if the prfpregset_t type is broken. */
+#undef PRFPREGSET_T_BROKEN
diff --git a/gdb/gdbserver/acinclude.m4 b/gdb/gdbserver/acinclude.m4
new file mode 100644
index 00000000000..bbfa86f16c5
--- /dev/null
+++ b/gdb/gdbserver/acinclude.m4
@@ -0,0 +1,41 @@
+dnl gdb/gdbserver/configure.in uses BFD_HAVE_SYS_PROCFS_TYPE.
+sinclude(../../bfd/acinclude.m4)
+
+AC_DEFUN([SRV_CHECK_THREAD_DB],
+[AC_CACHE_CHECK([for libthread_db],[srv_cv_thread_db],
+ [old_LIBS="$LIBS"
+ LIBS="$LIBS -lthread_db"
+ AC_TRY_LINK(
+ [void ps_pglobal_lookup() {}
+ void ps_pdread() {}
+ void ps_pdwrite() {}
+ void ps_lgetregs() {}
+ void ps_lsetregs() {}
+ void ps_lgetfpregs() {}
+ void ps_lsetfpregs() {}
+ void ps_getpid() {}],
+ [td_ta_new();],
+ [srv_cv_thread_db="-lthread_db"],
+ [srv_cv_thread_db=no
+
+ if test "$prefix" = "/usr" || test "$prefix" = "NONE"; then
+ thread_db="/lib/libthread_db.so.1"
+ else
+ thread_db='$prefix/lib/libthread_db.so.1'
+ fi
+ LIBS="$old_LIBS `eval echo "$thread_db"`"
+ AC_TRY_LINK(
+ [void ps_pglobal_lookup() {}
+ void ps_pdread() {}
+ void ps_pdwrite() {}
+ void ps_lgetregs() {}
+ void ps_lsetregs() {}
+ void ps_lgetfpregs() {}
+ void ps_lsetfpregs() {}
+ void ps_getpid() {}],
+ [td_ta_new();],
+ [srv_cv_thread_db="$thread_db"],
+ [srv_cv_thread_db=no])
+ LIBS="$old_LIBS"
+ ]])
+)])
diff --git a/gdb/gdbserver/aclocal.m4 b/gdb/gdbserver/aclocal.m4
index 24b9ced2835..2fc6cf883da 100644
--- a/gdb/gdbserver/aclocal.m4
+++ b/gdb/gdbserver/aclocal.m4
@@ -10,91 +10,45 @@ dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
dnl PARTICULAR PURPOSE.
+dnl gdb/gdbserver/configure.in uses BFD_HAVE_SYS_PROCFS_TYPE.
+sinclude(../../bfd/acinclude.m4)
-# serial 1
+AC_DEFUN([SRV_CHECK_THREAD_DB],
+[AC_CACHE_CHECK([for libthread_db],[srv_cv_thread_db],
+ [old_LIBS="$LIBS"
+ LIBS="$LIBS -lthread_db"
+ AC_TRY_LINK(
+ [void ps_pglobal_lookup() {}
+ void ps_pdread() {}
+ void ps_pdwrite() {}
+ void ps_lgetregs() {}
+ void ps_lsetregs() {}
+ void ps_lgetfpregs() {}
+ void ps_lsetfpregs() {}
+ void ps_getpid() {}],
+ [td_ta_new();],
+ [srv_cv_thread_db="-lthread_db"],
+ [srv_cv_thread_db=no
-# @defmac AC_PROG_CC_STDC
-# @maindex PROG_CC_STDC
-# @ovindex CC
-# If the C compiler in not in ANSI C mode by default, try to add an option
-# to output variable @code{CC} to make it so. This macro tries various
-# options that select ANSI C on some system or another. It considers the
-# compiler to be in ANSI C mode if it handles function prototypes correctly.
-#
-# If you use this macro, you should check after calling it whether the C
-# compiler has been set to accept ANSI C; if not, the shell variable
-# @code{am_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source
-# code in ANSI C, you can make an un-ANSIfied copy of it by using the
-# program @code{ansi2knr}, which comes with Ghostscript.
-# @end defmac
-
-AC_DEFUN(AM_PROG_CC_STDC,
-[AC_REQUIRE([AC_PROG_CC])
-AC_BEFORE([$0], [AC_C_INLINE])
-AC_BEFORE([$0], [AC_C_CONST])
-dnl Force this before AC_PROG_CPP. Some cpp's, eg on HPUX, require
-dnl a magic option to avoid problems with ANSI preprocessor commands
-dnl like #elif.
-dnl FIXME: can't do this because then AC_AIX won't work due to a
-dnl circular dependency.
-dnl AC_BEFORE([$0], [AC_PROG_CPP])
-AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
-AC_CACHE_VAL(am_cv_prog_cc_stdc,
-[am_cv_prog_cc_stdc=no
-ac_save_CC="$CC"
-# Don't try gcc -ansi; that turns off useful extensions and
-# breaks some systems' header files.
-# AIX -qlanglvl=ansi
-# Ultrix and OSF/1 -std1
-# HP-UX -Aa -D_HPUX_SOURCE
-# SVR4 -Xc -D__EXTENSIONS__
-for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
-do
- CC="$ac_save_CC $ac_arg"
- AC_TRY_COMPILE(
-[#include <stdarg.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
-struct buf { int x; };
-FILE * (*rcsopen) (struct buf *, struct stat *, int);
-static char *e (p, i)
- char **p;
- int i;
-{
- return p[i];
-}
-static char *f (char * (*g) (char **, int), char **p, ...)
-{
- char *s;
- va_list v;
- va_start (v,p);
- s = g (p, va_arg (v,int));
- va_end (v);
- return s;
-}
-int test (int i, double x);
-struct s1 {int (*f) (int a);};
-struct s2 {int (*f) (double a);};
-int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
-int argc;
-char **argv;
-], [
-return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
-],
-[am_cv_prog_cc_stdc="$ac_arg"; break])
-done
-CC="$ac_save_CC"
-])
-if test -z "$am_cv_prog_cc_stdc"; then
- AC_MSG_RESULT([none needed])
-else
- AC_MSG_RESULT($am_cv_prog_cc_stdc)
-fi
-case "x$am_cv_prog_cc_stdc" in
- x|xno) ;;
- *) CC="$CC $am_cv_prog_cc_stdc" ;;
-esac
-])
+ if test "$prefix" = "/usr" || test "$prefix" = "NONE"; then
+ thread_db="/lib/libthread_db.so.1"
+ else
+ thread_db='$prefix/lib/libthread_db.so.1'
+ fi
+ LIBS="$old_LIBS `eval echo "$thread_db"`"
+ AC_TRY_LINK(
+ [void ps_pglobal_lookup() {}
+ void ps_pdread() {}
+ void ps_pdwrite() {}
+ void ps_lgetregs() {}
+ void ps_lsetregs() {}
+ void ps_lgetfpregs() {}
+ void ps_lsetfpregs() {}
+ void ps_getpid() {}],
+ [td_ta_new();],
+ [srv_cv_thread_db="$thread_db"],
+ [srv_cv_thread_db=no])
+ LIBS="$old_LIBS"
+ ]])
+)])
diff --git a/gdb/gdbserver/config.in b/gdb/gdbserver/config.in
index 9d553f220be..cdaeb8dfe39 100644
--- a/gdb/gdbserver/config.in
+++ b/gdb/gdbserver/config.in
@@ -1,4 +1,4 @@
-/* config.in. Generated automatically from configure.in by autoheader 2.13. */
+/* config.in. Generated automatically from configure.in by autoheader. */
/* Define if you have the ANSI C header files. */
#undef STDC_HEADERS
@@ -13,12 +13,24 @@
register access. */
#undef HAVE_PTRACE_GETFPXREGS
+/* Define if the prfpregset_t type is broken. */
+#undef PRFPREGSET_T_BROKEN
+
+/* Define if you have the <linux/elf.h> header file. */
+#undef HAVE_LINUX_ELF_H
+
+/* Define if you have the <proc_service.h> header file. */
+#undef HAVE_PROC_SERVICE_H
+
/* Define if you have the <sgtty.h> header file. */
#undef HAVE_SGTTY_H
/* Define if you have the <string.h> header file. */
#undef HAVE_STRING_H
+/* Define if you have the <sys/procfs.h> header file. */
+#undef HAVE_SYS_PROCFS_H
+
/* Define if you have the <sys/reg.h> header file. */
#undef HAVE_SYS_REG_H
@@ -27,3 +39,22 @@
/* Define if you have the <termios.h> header file. */
#undef HAVE_TERMIOS_H
+
+/* Define if you have the <thread_db.h> header file. */
+#undef HAVE_THREAD_DB_H
+
+/* Define if <sys/procfs.h> has lwpid_t. */
+#undef HAVE_LWPID_T
+
+/* Define if <sys/procfs.h> has psaddr_t. */
+#undef HAVE_PSADDR_T
+
+/* Define if <sys/procfs.h> has prgregset_t. */
+#undef HAVE_PRGREGSET_T
+
+/* Define if <sys/procfs.h> has prfpregset_t. */
+#undef HAVE_PRFPREGSET_T
+
+/* Define if <sys/procfs.h> has elf_fpregset_t. */
+#undef HAVE_ELF_FPREGSET_T
+
diff --git a/gdb/gdbserver/configure b/gdb/gdbserver/configure
index 758d48383f1..d2575c0cc92 100755
--- a/gdb/gdbserver/configure
+++ b/gdb/gdbserver/configure
@@ -28,6 +28,7 @@ program_suffix=NONE
program_transform_name=s,x,x,
silent=
site=
+sitefile=
srcdir=
target=NONE
verbose=
@@ -142,6 +143,7 @@ Configuration:
--help print this message
--no-create do not create output files
--quiet, --silent do not print \`checking...' messages
+ --site-file=FILE use FILE as the site file
--version print the version of autoconf that created configure
Directory and file names:
--prefix=PREFIX install architecture-independent files in PREFIX
@@ -312,6 +314,11 @@ EOF
-site=* | --site=* | --sit=*)
site="$ac_optarg" ;;
+ -site-file | --site-file | --site-fil | --site-fi | --site-f)
+ ac_prev=sitefile ;;
+ -site-file=* | --site-file=* | --site-fil=* | --site-fi=* | --site-f=*)
+ sitefile="$ac_optarg" ;;
+
-srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
ac_prev=srcdir ;;
-srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
@@ -477,12 +484,16 @@ fi
srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
# Prefer explicitly selected file to automatically selected ones.
-if test -z "$CONFIG_SITE"; then
- if test "x$prefix" != xNONE; then
- CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
- else
- CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
+if test -z "$sitefile"; then
+ if test -z "$CONFIG_SITE"; then
+ if test "x$prefix" != xNONE; then
+ CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
+ else
+ CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
+ fi
fi
+else
+ CONFIG_SITE="$sitefile"
fi
for ac_site_file in $CONFIG_SITE; do
if test -r "$ac_site_file"; then
@@ -526,7 +537,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:530: checking for $ac_word" >&5
+echo "configure:541: 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
@@ -556,7 +567,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:560: checking for $ac_word" >&5
+echo "configure:571: 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
@@ -607,7 +618,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:611: checking for $ac_word" >&5
+echo "configure:622: 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
@@ -639,7 +650,7 @@ fi
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:643: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:654: 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.
@@ -650,12 +661,12 @@ cross_compiling=$ac_cv_prog_cc_cross
cat > conftest.$ac_ext << EOF
-#line 654 "configure"
+#line 665 "configure"
#include "confdefs.h"
main(){return(0);}
EOF
-if { (eval echo configure:659: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:670: \"$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
@@ -681,12 +692,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:685: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:696: 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:690: checking whether we are using GNU C" >&5
+echo "configure:701: 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
@@ -695,7 +706,7 @@ else
yes;
#endif
EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:699: \"$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:710: \"$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
@@ -714,7 +725,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:718: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:729: 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
@@ -793,7 +804,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:797: checking host system type" >&5
+echo "configure:808: checking host system type" >&5
host_alias=$host
case "$host_alias" in
@@ -814,7 +825,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:818: checking target system type" >&5
+echo "configure:829: checking target system type" >&5
target_alias=$target
case "$target_alias" in
@@ -832,7 +843,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:836: checking build system type" >&5
+echo "configure:847: checking build system type" >&5
build_alias=$build
case "$build_alias" in
@@ -867,7 +878,7 @@ test "$host_alias" != "$target_alias" &&
# 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:871: checking for a BSD compatible install" >&5
+echo "configure:882: 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
@@ -921,7 +932,7 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:925: checking how to run the C preprocessor" >&5
+echo "configure:936: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
@@ -936,13 +947,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 940 "configure"
+#line 951 "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:946: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:957: \"$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
:
@@ -953,13 +964,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
-#line 957 "configure"
+#line 968 "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:963: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:974: \"$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
:
@@ -970,13 +981,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -nologo -E"
cat > conftest.$ac_ext <<EOF
-#line 974 "configure"
+#line 985 "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:980: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:991: \"$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
:
@@ -1001,12 +1012,12 @@ fi
echo "$ac_t""$CPP" 1>&6
echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:1005: checking for ANSI C header files" >&5
+echo "configure:1016: 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 1010 "configure"
+#line 1021 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
@@ -1014,7 +1025,7 @@ else
#include <float.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1018: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1029: \"$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*
@@ -1031,7 +1042,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 1035 "configure"
+#line 1046 "configure"
#include "confdefs.h"
#include <string.h>
EOF
@@ -1049,7 +1060,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 1053 "configure"
+#line 1064 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
@@ -1070,7 +1081,7 @@ if test "$cross_compiling" = yes; then
:
else
cat > conftest.$ac_ext <<EOF
-#line 1074 "configure"
+#line 1085 "configure"
#include "confdefs.h"
#include <ctype.h>
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -1081,7 +1092,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
exit (0); }
EOF
-if { (eval echo configure:1085: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1096: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
:
else
@@ -1105,21 +1116,21 @@ EOF
fi
-for ac_hdr in sgtty.h termio.h termios.h sys/reg.h string.h
+for ac_hdr in sgtty.h termio.h termios.h sys/reg.h string.h proc_service.h sys/procfs.h thread_db.h linux/elf.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1113: checking for $ac_hdr" >&5
+echo "configure:1124: 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 1118 "configure"
+#line 1129 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1123: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1134: \"$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*
@@ -1157,19 +1168,19 @@ fi
if test "${srv_linux_regsets}" = "yes"; then
echo $ac_n "checking for PTRACE_GETREGS""... $ac_c" 1>&6
-echo "configure:1161: checking for PTRACE_GETREGS" >&5
+echo "configure:1172: checking for PTRACE_GETREGS" >&5
if eval "test \"`echo '$''{'gdbsrv_cv_have_ptrace_getregs'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1166 "configure"
+#line 1177 "configure"
#include "confdefs.h"
#include <sys/ptrace.h>
int main() {
PTRACE_GETREGS;
; return 0; }
EOF
-if { (eval echo configure:1173: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1184: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
gdbsrv_cv_have_ptrace_getregs=yes
else
@@ -1190,19 +1201,19 @@ EOF
fi
echo $ac_n "checking for PTRACE_GETFPXREGS""... $ac_c" 1>&6
-echo "configure:1194: checking for PTRACE_GETFPXREGS" >&5
+echo "configure:1205: checking for PTRACE_GETFPXREGS" >&5
if eval "test \"`echo '$''{'gdbsrv_cv_have_ptrace_getfpxregs'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1199 "configure"
+#line 1210 "configure"
#include "confdefs.h"
#include <sys/ptrace.h>
int main() {
PTRACE_GETFPXREGS;
; return 0; }
EOF
-if { (eval echo configure:1206: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1217: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
gdbsrv_cv_have_ptrace_getfpxregs=yes
else
@@ -1223,7 +1234,328 @@ EOF
fi
fi
-GDBSERVER_DEPFILES="$srv_regobj $srv_tgtobj"
+if test "$ac_cv_header_sys_procfs_h" = yes; then
+ echo $ac_n "checking for lwpid_t in sys/procfs.h""... $ac_c" 1>&6
+echo "configure:1240: 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 1245 "configure"
+#include "confdefs.h"
+
+#define _SYSCALL32
+#include <sys/procfs.h>
+int main() {
+lwpid_t avar
+; return 0; }
+EOF
+if { (eval echo configure:1254: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ bfd_cv_have_sys_procfs_type_lwpid_t=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ bfd_cv_have_sys_procfs_type_lwpid_t=no
+
+fi
+rm -f conftest*
+fi
+
+ if test $bfd_cv_have_sys_procfs_type_lwpid_t = yes; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_LWPID_T 1
+EOF
+
+ fi
+ 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:1276: 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 1281 "configure"
+#include "confdefs.h"
+
+#define _SYSCALL32
+#include <sys/procfs.h>
+int main() {
+psaddr_t avar
+; return 0; }
+EOF
+if { (eval echo configure:1290: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ bfd_cv_have_sys_procfs_type_psaddr_t=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ bfd_cv_have_sys_procfs_type_psaddr_t=no
+
+fi
+rm -f conftest*
+fi
+
+ if test $bfd_cv_have_sys_procfs_type_psaddr_t = yes; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_PSADDR_T 1
+EOF
+
+ fi
+ echo "$ac_t""$bfd_cv_have_sys_procfs_type_psaddr_t" 1>&6
+
+ echo $ac_n "checking for prgregset_t in sys/procfs.h""... $ac_c" 1>&6
+echo "configure:1312: 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 1317 "configure"
+#include "confdefs.h"
+
+#define _SYSCALL32
+#include <sys/procfs.h>
+int main() {
+prgregset_t avar
+; return 0; }
+EOF
+if { (eval echo configure:1326: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ bfd_cv_have_sys_procfs_type_prgregset_t=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ bfd_cv_have_sys_procfs_type_prgregset_t=no
+
+fi
+rm -f conftest*
+fi
+
+ if test $bfd_cv_have_sys_procfs_type_prgregset_t = yes; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_PRGREGSET_T 1
+EOF
+
+ fi
+ 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:1348: 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 1353 "configure"
+#include "confdefs.h"
+
+#define _SYSCALL32
+#include <sys/procfs.h>
+int main() {
+prfpregset_t avar
+; return 0; }
+EOF
+if { (eval echo configure:1362: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ bfd_cv_have_sys_procfs_type_prfpregset_t=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ bfd_cv_have_sys_procfs_type_prfpregset_t=no
+
+fi
+rm -f conftest*
+fi
+
+ if test $bfd_cv_have_sys_procfs_type_prfpregset_t = yes; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_PRFPREGSET_T 1
+EOF
+
+ fi
+ echo "$ac_t""$bfd_cv_have_sys_procfs_type_prfpregset_t" 1>&6
+
+
+
+
+ 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:1388: 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
+ if test "$cross_compiling" = yes; then
+ gdb_cv_prfpregset_t_broken=yes
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1396 "configure"
+#include "confdefs.h"
+#include <sys/procfs.h>
+ int main ()
+ {
+ if (sizeof (prfpregset_t) == sizeof (void *))
+ return 1;
+ return 0;
+ }
+EOF
+if { (eval echo configure:1406: \"$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
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ gdb_cv_prfpregset_t_broken=yes
+fi
+rm -fr conftest*
+fi
+
+fi
+
+ echo "$ac_t""$gdb_cv_prfpregset_t_broken" 1>&6
+ if test $gdb_cv_prfpregset_t_broken = yes; then
+ cat >> confdefs.h <<\EOF
+#define PRFPREGSET_T_BROKEN 1
+EOF
+
+ fi
+ fi
+
+ echo $ac_n "checking for elf_fpregset_t in sys/procfs.h""... $ac_c" 1>&6
+echo "configure:1430: checking for elf_fpregset_t in sys/procfs.h" >&5
+ if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_elf_fpregset_t'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1435 "configure"
+#include "confdefs.h"
+
+#define _SYSCALL32
+#include <sys/procfs.h>
+int main() {
+elf_fpregset_t avar
+; return 0; }
+EOF
+if { (eval echo configure:1444: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ bfd_cv_have_sys_procfs_type_elf_fpregset_t=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ bfd_cv_have_sys_procfs_type_elf_fpregset_t=no
+
+fi
+rm -f conftest*
+fi
+
+ if test $bfd_cv_have_sys_procfs_type_elf_fpregset_t = yes; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_ELF_FPREGSET_T 1
+EOF
+
+ fi
+ echo "$ac_t""$bfd_cv_have_sys_procfs_type_elf_fpregset_t" 1>&6
+
+fi
+
+srv_thread_depfiles=
+srv_libs=
+USE_THREAD_DB=
+
+if test "$srv_linux_thread_db" = "yes"; then
+ echo $ac_n "checking for libthread_db""... $ac_c" 1>&6
+echo "configure:1473: checking for libthread_db" >&5
+if eval "test \"`echo '$''{'srv_cv_thread_db'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ old_LIBS="$LIBS"
+ LIBS="$LIBS -lthread_db"
+ cat > conftest.$ac_ext <<EOF
+#line 1480 "configure"
+#include "confdefs.h"
+void ps_pglobal_lookup() {}
+ void ps_pdread() {}
+ void ps_pdwrite() {}
+ void ps_lgetregs() {}
+ void ps_lsetregs() {}
+ void ps_lgetfpregs() {}
+ void ps_lsetfpregs() {}
+ void ps_getpid() {}
+int main() {
+td_ta_new();
+; return 0; }
+EOF
+if { (eval echo configure:1494: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ srv_cv_thread_db="-lthread_db"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ srv_cv_thread_db=no
+
+ if test "$prefix" = "/usr" || test "$prefix" = "NONE"; then
+ thread_db="/lib/libthread_db.so.1"
+ else
+ thread_db='$prefix/lib/libthread_db.so.1'
+ fi
+ LIBS="$old_LIBS `eval echo "$thread_db"`"
+ cat > conftest.$ac_ext <<EOF
+#line 1510 "configure"
+#include "confdefs.h"
+void ps_pglobal_lookup() {}
+ void ps_pdread() {}
+ void ps_pdwrite() {}
+ void ps_lgetregs() {}
+ void ps_lsetregs() {}
+ void ps_lgetfpregs() {}
+ void ps_lsetfpregs() {}
+ void ps_getpid() {}
+int main() {
+td_ta_new();
+; return 0; }
+EOF
+if { (eval echo configure:1524: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ srv_cv_thread_db="$thread_db"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ srv_cv_thread_db=no
+fi
+rm -f conftest*
+ LIBS="$old_LIBS"
+
+fi
+
+echo "$ac_t""$srv_cv_thread_db" 1>&6
+
+fi
+rm -f conftest*
+ if test "$srv_cv_thread_db" = no; then
+ echo "configure: warning: Could not find libthread_db." 1>&2
+ echo "configure: warning: Disabling thread support in gdbserver." 1>&2
+ srv_linux_thread_db=no
+ else
+ srv_libs="$srv_cv_thread_db"
+ fi
+fi
+
+if test "$srv_linux_thread_db" = "yes"; then
+ srv_thread_depfiles="thread-db.o proc-service.o"
+ USE_THREAD_DB="-DUSE_THREAD_DB"
+fi
+
+GDBSERVER_DEPFILES="$srv_regobj $srv_tgtobj $srv_thread_depfiles"
+GDBSERVER_LIBS="$srv_libs"
+
+
@@ -1381,6 +1713,8 @@ s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
s%@INSTALL_DATA@%$INSTALL_DATA%g
s%@CPP@%$CPP%g
s%@GDBSERVER_DEPFILES@%$GDBSERVER_DEPFILES%g
+s%@GDBSERVER_LIBS@%$GDBSERVER_LIBS%g
+s%@USE_THREAD_DB@%$USE_THREAD_DB%g
CEOF
EOF
diff --git a/gdb/gdbserver/configure.in b/gdb/gdbserver/configure.in
index db7e301934b..7c94d408adf 100644
--- a/gdb/gdbserver/configure.in
+++ b/gdb/gdbserver/configure.in
@@ -30,7 +30,8 @@ AC_PROG_INSTALL
AC_HEADER_STDC
-AC_CHECK_HEADERS(sgtty.h termio.h termios.h sys/reg.h string.h)
+AC_CHECK_HEADERS(sgtty.h termio.h termios.h sys/reg.h string.h dnl
+ proc_service.h sys/procfs.h thread_db.h linux/elf.h)
. ${srcdir}/configure.srv
@@ -62,9 +63,67 @@ if test "${srv_linux_regsets}" = "yes"; then
fi
fi
-GDBSERVER_DEPFILES="$srv_regobj $srv_tgtobj"
+if test "$ac_cv_header_sys_procfs_h" = yes; then
+ BFD_HAVE_SYS_PROCFS_TYPE(lwpid_t)
+ BFD_HAVE_SYS_PROCFS_TYPE(psaddr_t)
+ BFD_HAVE_SYS_PROCFS_TYPE(prgregset_t)
+ BFD_HAVE_SYS_PROCFS_TYPE(prfpregset_t)
+
+ dnl Check for broken prfpregset_t type
+
+ dnl For Linux/i386, glibc 2.1.3 was released with a bogus
+ dnl prfpregset_t type (it's a typedef for the pointer to a struct
+ dnl instead of the struct itself). We detect this here, and work
+ dnl around it in gdb_proc_service.h.
+
+ if test $bfd_cv_have_sys_procfs_type_prfpregset_t = yes; then
+ AC_MSG_CHECKING(whether prfpregset_t type is broken)
+ AC_CACHE_VAL(gdb_cv_prfpregset_t_broken,
+ [AC_TRY_RUN([#include <sys/procfs.h>
+ int main ()
+ {
+ if (sizeof (prfpregset_t) == sizeof (void *))
+ return 1;
+ return 0;
+ }],
+ gdb_cv_prfpregset_t_broken=no,
+ gdb_cv_prfpregset_t_broken=yes,
+ gdb_cv_prfpregset_t_broken=yes)])
+ AC_MSG_RESULT($gdb_cv_prfpregset_t_broken)
+ if test $gdb_cv_prfpregset_t_broken = yes; then
+ AC_DEFINE(PRFPREGSET_T_BROKEN)
+ fi
+ fi
+
+ BFD_HAVE_SYS_PROCFS_TYPE(elf_fpregset_t)
+fi
+
+srv_thread_depfiles=
+srv_libs=
+USE_THREAD_DB=
+
+if test "$srv_linux_thread_db" = "yes"; then
+ SRV_CHECK_THREAD_DB
+ if test "$srv_cv_thread_db" = no; then
+ AC_WARN([Could not find libthread_db.])
+ AC_WARN([Disabling thread support in gdbserver.])
+ srv_linux_thread_db=no
+ else
+ srv_libs="$srv_cv_thread_db"
+ fi
+fi
+
+if test "$srv_linux_thread_db" = "yes"; then
+ srv_thread_depfiles="thread-db.o proc-service.o"
+ USE_THREAD_DB="-DUSE_THREAD_DB"
+fi
+
+GDBSERVER_DEPFILES="$srv_regobj $srv_tgtobj $srv_thread_depfiles"
+GDBSERVER_LIBS="$srv_libs"
AC_SUBST(GDBSERVER_DEPFILES)
+AC_SUBST(GDBSERVER_LIBS)
+AC_SUBST(USE_THREAD_DB)
AC_OUTPUT(Makefile,
[case x$CONFIG_HEADERS in
diff --git a/gdb/gdbserver/configure.srv b/gdb/gdbserver/configure.srv
index 3268cd77207..28dc2aad1f6 100644
--- a/gdb/gdbserver/configure.srv
+++ b/gdb/gdbserver/configure.srv
@@ -21,11 +21,13 @@ case "${target}" in
arm*-*-linux*) srv_regobj=reg-arm.o
srv_tgtobj="linux-low.o linux-arm-low.o"
srv_linux_usrregs=yes
+ srv_linux_thread_db=yes
;;
i[3456]86-*-linux*) srv_regobj=reg-i386-linux.o
srv_tgtobj="linux-low.o linux-i386-low.o i387-fp.o"
srv_linux_usrregs=yes
srv_linux_regsets=yes
+ srv_linux_thread_db=yes
;;
ia64-*-linux*) srv_regobj=reg-ia64.o
srv_tgtobj="linux-low.o linux-ia64-low.o"
@@ -38,10 +40,12 @@ case "${target}" in
mips*-*-linux*) srv_regobj=reg-mips.o
srv_tgtobj="linux-low.o linux-mips-low.o"
srv_linux_usrregs=yes
+ srv_linux_thread_db=yes
;;
powerpc*-*-linux*) srv_regobj=reg-ppc.o
srv_tgtobj="linux-low.o linux-ppc-low.o"
srv_linux_usrregs=yes
+ srv_linux_thread_db=yes
;;
s390-*-linux*) srv_regobj=reg-s390.o
srv_tgtobj="linux-low.o linux-s390-low.o"
@@ -54,6 +58,7 @@ case "${target}" in
sh*-*-linux*) srv_regobj=reg-sh.o
srv_tgtobj="linux-low.o linux-sh-low.o"
srv_linux_usrregs=yes
+ srv_linux_thread_db=yes
;;
x86_64-*-linux*) srv_regobj=reg-x86-64.o
srv_tgtobj="linux-low.o linux-x86-64-low.o i387-fp.o"
diff --git a/gdb/gdbserver/i387-fp.c b/gdb/gdbserver/i387-fp.c
index 3d1d6a6fd5c..19a9929debc 100644
--- a/gdb/gdbserver/i387-fp.c
+++ b/gdb/gdbserver/i387-fp.c
@@ -20,6 +20,7 @@
Boston, MA 02111-1307, USA. */
#include "server.h"
+#include "i387-fp.h"
int num_xmm_registers = 8;
@@ -108,7 +109,7 @@ i387_cache_to_fsave (void *buf)
}
void
-i387_fsave_to_cache (void *buf)
+i387_fsave_to_cache (const void *buf)
{
struct i387_fsave *fp = (struct i387_fsave *) buf;
int i;
@@ -240,7 +241,7 @@ i387_ftag (struct i387_fxsave *fp, int regno)
}
void
-i387_fxsave_to_cache (void *buf)
+i387_fxsave_to_cache (const void *buf)
{
struct i387_fxsave *fp = (struct i387_fxsave *) buf;
int i, top;
@@ -287,4 +288,3 @@ i387_fxsave_to_cache (void *buf)
val = (fp->fop) & 0x7FF;
supply_register_by_name ("fop", &val);
}
-
diff --git a/gdb/gdbserver/i387-fp.h b/gdb/gdbserver/i387-fp.h
index 90fe4ca6eb7..d28c4228830 100644
--- a/gdb/gdbserver/i387-fp.h
+++ b/gdb/gdbserver/i387-fp.h
@@ -23,10 +23,10 @@
#define I387_FP_H
void i387_cache_to_fsave (void *buf);
-void i387_fsave_to_cache (void *buf);
+void i387_fsave_to_cache (const void *buf);
void i387_cache_to_fxsave (void *buf);
-void i387_fxsave_to_cache (void *buf);
+void i387_fxsave_to_cache (const void *buf);
extern int num_xmm_registers;
diff --git a/gdb/gdbserver/inferiors.c b/gdb/gdbserver/inferiors.c
index 774798deae3..68c91c4efa9 100644
--- a/gdb/gdbserver/inferiors.c
+++ b/gdb/gdbserver/inferiors.c
@@ -25,81 +25,175 @@
#include "server.h"
-struct inferior_info
+struct thread_info
{
- int pid;
+ struct inferior_list_entry entry;
void *target_data;
void *regcache_data;
- struct inferior_info *next;
};
-static struct inferior_info *inferiors;
-struct inferior_info *current_inferior;
-int signal_pid;
+struct inferior_list all_threads;
+
+struct thread_info *current_inferior;
+
+#define get_thread(inf) ((struct thread_info *)(inf))
+
+void
+add_inferior_to_list (struct inferior_list *list,
+ struct inferior_list_entry *new_inferior)
+{
+ new_inferior->next = NULL;
+ if (list->tail != NULL)
+ list->tail->next = new_inferior;
+ else
+ list->head = new_inferior;
+ list->tail = new_inferior;
+}
+
+void
+for_each_inferior (struct inferior_list *list,
+ void (*action) (struct inferior_list_entry *))
+{
+ struct inferior_list_entry *cur = list->head, *next;
+
+ while (cur != NULL)
+ {
+ next = cur->next;
+ (*action) (cur);
+ cur = next;
+ }
+}
void
-add_inferior (int pid)
+change_inferior_id (struct inferior_list *list,
+ int new_id)
{
- struct inferior_info *new_inferior
- = (struct inferior_info *) malloc (sizeof (*new_inferior));
+ if (list->head != list->tail)
+ error ("tried to change thread ID after multiple threads are created");
- memset (new_inferior, 0, sizeof (*new_inferior));
+ list->head->id = new_id;
+}
- new_inferior->pid = pid;
+void
+remove_inferior (struct inferior_list *list,
+ struct inferior_list_entry *entry)
+{
+ struct inferior_list_entry **cur;
- new_inferior->next = inferiors;
- inferiors = new_inferior;
+ if (list->head == entry)
+ {
+ list->head = entry->next;
+ if (list->tail == entry)
+ list->tail = list->head;
+ return;
+ }
+
+ cur = &list->head;
+ while (*cur && (*cur)->next != entry)
+ cur = &(*cur)->next;
+
+ if (*cur == NULL)
+ return;
+ (*cur)->next = entry->next;
+
+ if (list->tail == entry)
+ list->tail = *cur;
+}
+
+void
+add_thread (int thread_id, void *target_data)
+{
+ struct thread_info *new_thread
+ = (struct thread_info *) malloc (sizeof (*new_thread));
+
+ memset (new_thread, 0, sizeof (*new_thread));
+
+ new_thread->entry.id = thread_id;
+
+ add_inferior_to_list (&all_threads, & new_thread->entry);
+
if (current_inferior == NULL)
- current_inferior = inferiors;
+ current_inferior = new_thread;
- create_register_cache (new_inferior);
+ new_thread->target_data = target_data;
+ set_inferior_regcache_data (new_thread, new_register_cache ());
+}
- if (signal_pid == 0)
- signal_pid = pid;
+static void
+free_one_thread (struct inferior_list_entry *inf)
+{
+ struct thread_info *thread = get_thread (inf);
+ free_register_cache (inferior_regcache_data (thread));
+ free (thread);
+}
+
+void
+remove_thread (struct thread_info *thread)
+{
+ remove_inferior (&all_threads, (struct inferior_list_entry *) thread);
+ free_one_thread (&thread->entry);
}
void
clear_inferiors (void)
{
- struct inferior_info *inf = inferiors, *next_inf;
+ for_each_inferior (&all_threads, free_one_thread);
+
+ all_threads.head = all_threads.tail = NULL;
+}
+
+struct inferior_list_entry *
+find_inferior (struct inferior_list *list,
+ int (*func) (struct inferior_list_entry *, void *), void *arg)
+{
+ struct inferior_list_entry *inf = list->head;
- while (inf)
+ while (inf != NULL)
{
- next_inf = inf->next;
+ if ((*func) (inf, arg))
+ return inf;
+ inf = inf->next;
+ }
- if (inf->target_data)
- free (inf->target_data);
- if (inf->regcache_data)
- free_register_cache (inf);
+ return NULL;
+}
- free (inf);
- inf = next_inf;
+struct inferior_list_entry *
+find_inferior_id (struct inferior_list *list, int id)
+{
+ struct inferior_list_entry *inf = list->head;
+
+ while (inf != NULL)
+ {
+ if (inf->id == id)
+ return inf;
+ inf = inf->next;
}
- inferiors = NULL;
+ return NULL;
}
void *
-inferior_target_data (struct inferior_info *inferior)
+inferior_target_data (struct thread_info *inferior)
{
return inferior->target_data;
}
void
-set_inferior_target_data (struct inferior_info *inferior, void *data)
+set_inferior_target_data (struct thread_info *inferior, void *data)
{
inferior->target_data = data;
}
void *
-inferior_regcache_data (struct inferior_info *inferior)
+inferior_regcache_data (struct thread_info *inferior)
{
return inferior->regcache_data;
}
void
-set_inferior_regcache_data (struct inferior_info *inferior, void *data)
+set_inferior_regcache_data (struct thread_info *inferior, void *data)
{
inferior->regcache_data = data;
}
diff --git a/gdb/gdbserver/linux-arm-low.c b/gdb/gdbserver/linux-arm-low.c
index 2958fdf3129..07e2792837c 100644
--- a/gdb/gdbserver/linux-arm-low.c
+++ b/gdb/gdbserver/linux-arm-low.c
@@ -45,9 +45,49 @@ arm_cannot_fetch_register (int regno)
return (regno >= arm_num_regs);
}
+static CORE_ADDR
+arm_get_pc ()
+{
+ unsigned long pc;
+ collect_register_by_name ("pc", &pc);
+ return pc;
+}
+
+static void
+arm_set_pc (CORE_ADDR pc)
+{
+ unsigned long newpc = pc;
+ supply_register_by_name ("pc", &newpc);
+}
+
+/* Correct in either endianness. We do not support Thumb yet. */
+static const unsigned long arm_breakpoint = 0xef9f0001;
+#define arm_breakpoint_len 4
+
+static int
+arm_breakpoint_at (CORE_ADDR where)
+{
+ unsigned long insn;
+
+ (*the_target->read_memory) (where, (char *) &insn, 4);
+ if (insn == arm_breakpoint)
+ return 1;
+
+ /* If necessary, recognize more trap instructions here. GDB only uses the
+ one. */
+ return 0;
+}
+
struct linux_target_ops the_low_target = {
arm_num_regs,
arm_regmap,
arm_cannot_fetch_register,
arm_cannot_store_register,
+ arm_get_pc,
+ arm_set_pc,
+ (const char *) &arm_breakpoint,
+ arm_breakpoint_len,
+ NULL,
+ 0,
+ arm_breakpoint_at,
};
diff --git a/gdb/gdbserver/linux-i386-low.c b/gdb/gdbserver/linux-i386-low.c
index 71264321341..b79b601ae8f 100644
--- a/gdb/gdbserver/linux-i386-low.c
+++ b/gdb/gdbserver/linux-i386-low.c
@@ -72,7 +72,7 @@ i386_fill_gregset (void *buf)
}
static void
-i386_store_gregset (void *buf)
+i386_store_gregset (const void *buf)
{
int i;
@@ -89,7 +89,7 @@ i386_fill_fpregset (void *buf)
}
static void
-i386_store_fpregset (void *buf)
+i386_store_fpregset (const void *buf)
{
i387_fsave_to_cache (buf);
}
@@ -101,7 +101,7 @@ i386_fill_fpxregset (void *buf)
}
static void
-i386_store_fpxregset (void *buf)
+i386_store_fpxregset (const void *buf)
{
i387_fxsave_to_cache (buf);
}
@@ -109,14 +109,17 @@ i386_store_fpxregset (void *buf)
struct regset_info target_regsets[] = {
{ PTRACE_GETREGS, PTRACE_SETREGS, sizeof (elf_gregset_t),
+ GENERAL_REGS,
i386_fill_gregset, i386_store_gregset },
#ifdef HAVE_PTRACE_GETFPXREGS
{ PTRACE_GETFPXREGS, PTRACE_SETFPXREGS, sizeof (elf_fpxregset_t),
+ EXTENDED_REGS,
i386_fill_fpxregset, i386_store_fpxregset },
#endif
{ PTRACE_GETFPREGS, PTRACE_SETFPREGS, sizeof (elf_fpregset_t),
+ FP_REGS,
i386_fill_fpregset, i386_store_fpregset },
- { 0, 0, -1, NULL, NULL }
+ { 0, 0, -1, -1, NULL, NULL }
};
#endif /* HAVE_LINUX_REGSETS */
@@ -124,25 +127,38 @@ struct regset_info target_regsets[] = {
static const char i386_breakpoint[] = { 0xCC };
#define i386_breakpoint_len 1
+extern int debug_threads;
+
static CORE_ADDR
-i386_stop_pc ()
+i386_get_pc ()
{
unsigned long pc;
- /* Overkill */
- fetch_inferior_registers (0);
-
collect_register_by_name ("eip", &pc);
- return pc - 1;
+
+ if (debug_threads)
+ fprintf (stderr, "stop pc (before any decrement) is %08lx\n", pc);
+ return pc;
}
static void
i386_set_pc (CORE_ADDR newpc)
{
+ if (debug_threads)
+ fprintf (stderr, "set pc to %08lx\n", (long) newpc);
supply_register_by_name ("eip", &newpc);
+}
+
+static int
+i386_breakpoint_at (CORE_ADDR pc)
+{
+ unsigned char c;
+
+ read_inferior_memory (pc, &c, 1);
+ if (c == 0xCC)
+ return 1;
- /* Overkill */
- store_inferior_registers (0);
+ return 0;
}
struct linux_target_ops the_low_target = {
@@ -150,8 +166,11 @@ struct linux_target_ops the_low_target = {
i386_regmap,
i386_cannot_fetch_register,
i386_cannot_store_register,
- i386_stop_pc,
+ i386_get_pc,
i386_set_pc,
i386_breakpoint,
i386_breakpoint_len,
+ NULL,
+ 1,
+ i386_breakpoint_at,
};
diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index 6cfe0d5aea5..c272fed2142 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -35,9 +35,32 @@
#include <stdlib.h>
#include <unistd.h>
-static CORE_ADDR linux_bp_reinsert;
+/* ``all_threads'' is keyed by the LWP ID - it should be the thread ID instead,
+ however. This requires changing the ID in place when we go from !using_threads
+ to using_threads, immediately.
+ ``all_processes'' is keyed by the process ID - which on Linux is (presently)
+ the same as the LWP ID. */
+
+struct inferior_list all_processes;
+
+/* FIXME this is a bit of a hack, and could be removed. */
+int stopping_threads;
+
+/* FIXME make into a target method? */
+int using_threads;
+
+static void linux_resume_one_process (struct inferior_list_entry *entry,
+ int step, int signal);
static void linux_resume (int step, int signal);
+static void stop_all_processes (void);
+static int linux_wait_for_event (struct thread_info *child);
+
+struct pending_signals
+{
+ int signal;
+ struct pending_signals *prev;
+};
#define PTRACE_ARG3_TYPE long
#define PTRACE_XFER_TYPE long
@@ -48,12 +71,64 @@ static int use_regsets_p = 1;
extern int errno;
-static int inferior_pid;
+int debug_threads = 0;
+
+#define pid_of(proc) ((proc)->head.id)
+
+/* FIXME: Delete eventually. */
+#define inferior_pid (pid_of (get_thread_process (current_inferior)))
+
+/* This function should only be called if the process got a SIGTRAP.
+ The SIGTRAP could mean several things.
+
+ On i386, where decr_pc_after_break is non-zero:
+ If we were single-stepping this process using PTRACE_SINGLESTEP,
+ we will get only the one SIGTRAP (even if the instruction we
+ stepped over was a breakpoint). The value of $eip will be the
+ next instruction.
+ If we continue the process using PTRACE_CONT, we will get a
+ SIGTRAP when we hit a breakpoint. The value of $eip will be
+ the instruction after the breakpoint (i.e. needs to be
+ decremented). If we report the SIGTRAP to GDB, we must also
+ report the undecremented PC. If we cancel the SIGTRAP, we
+ must resume at the decremented PC.
+
+ (Presumably, not yet tested) On a non-decr_pc_after_break machine
+ with hardware or kernel single-step:
+ If we single-step over a breakpoint instruction, our PC will
+ point at the following instruction. If we continue and hit a
+ breakpoint instruction, our PC will point at the breakpoint
+ instruction. */
+
+static CORE_ADDR
+get_stop_pc (void)
+{
+ CORE_ADDR stop_pc = (*the_low_target.get_pc) ();
+
+ if (get_thread_process (current_inferior)->stepping)
+ return stop_pc;
+ else
+ return stop_pc - the_low_target.decr_pc_after_break;
+}
-struct inferior_linux_data
+static void *
+add_process (int pid)
{
- int pid;
-};
+ struct process_info *process;
+
+ process = (struct process_info *) malloc (sizeof (*process));
+ memset (process, 0, sizeof (*process));
+
+ process->head.id = pid;
+
+ /* Default to tid == lwpid == pid. */
+ process->tid = pid;
+ process->lwpid = pid;
+
+ add_inferior_to_list (&all_processes, &process->head);
+
+ return process;
+}
/* Start an inferior process and returns its pid.
ALLARGS is a vector of program-name and args. */
@@ -61,7 +136,7 @@ struct inferior_linux_data
static int
linux_create_inferior (char *program, char **allargs)
{
- struct inferior_linux_data *tdata;
+ void *new_process;
int pid;
pid = fork ();
@@ -72,6 +147,8 @@ linux_create_inferior (char *program, char **allargs)
{
ptrace (PTRACE_TRACEME, 0, 0, 0);
+ signal (SIGRTMIN + 1, SIG_DFL);
+
execv (program, allargs);
fprintf (stderr, "Cannot exec %s: %s.\n", program,
@@ -80,22 +157,18 @@ linux_create_inferior (char *program, char **allargs)
_exit (0177);
}
- add_inferior (pid);
- tdata = (struct inferior_linux_data *) malloc (sizeof (*tdata));
- tdata->pid = pid;
- set_inferior_target_data (current_inferior, tdata);
+ new_process = add_process (pid);
+ add_thread (pid, new_process);
- /* FIXME remove */
- inferior_pid = pid;
return 0;
}
/* Attach to an inferior process. */
-static int
-linux_attach (int pid)
+void
+linux_attach_lwp (int pid, int tid)
{
- struct inferior_linux_data *tdata;
+ struct process_info *new_process;
if (ptrace (PTRACE_ATTACH, pid, 0, 0) != 0)
{
@@ -103,143 +176,712 @@ linux_attach (int pid)
errno < sys_nerr ? sys_errlist[errno] : "unknown error",
errno);
fflush (stderr);
- _exit (0177);
+
+ /* If we fail to attach to an LWP, just return. */
+ if (!using_threads)
+ _exit (0177);
+ return;
}
- add_inferior (pid);
- tdata = (struct inferior_linux_data *) malloc (sizeof (*tdata));
- tdata->pid = pid;
- set_inferior_target_data (current_inferior, tdata);
+ new_process = (struct process_info *) add_process (pid);
+ add_thread (tid, new_process);
+
+ /* The next time we wait for this LWP we'll see a SIGSTOP as PTRACE_ATTACH
+ brings it to a halt. We should ignore that SIGSTOP and resume the process
+ (unless this is the first process, in which case the flag will be cleared
+ in linux_attach).
+
+ On the other hand, if we are currently trying to stop all threads, we
+ should treat the new thread as if we had sent it a SIGSTOP. This works
+ because we are guaranteed that add_process added us to the end of the
+ list, and so the new thread has not yet reached wait_for_sigstop (but
+ will). */
+ if (! stopping_threads)
+ new_process->stop_expected = 1;
+}
+
+int
+linux_attach (int pid)
+{
+ struct process_info *process;
+
+ linux_attach_lwp (pid, pid);
+
+ /* Don't ignore the initial SIGSTOP if we just attached to this process. */
+ process = (struct process_info *) find_inferior_id (&all_processes, pid);
+ process->stop_expected = 0;
+
return 0;
}
/* Kill the inferior process. Make us have no inferior. */
static void
-linux_kill (void)
+linux_kill_one_process (struct inferior_list_entry *entry)
{
- if (inferior_pid == 0)
- return;
- ptrace (PTRACE_KILL, inferior_pid, 0, 0);
- wait (0);
- clear_inferiors ();
+ struct thread_info *thread = (struct thread_info *) entry;
+ struct process_info *process = get_thread_process (thread);
+ int wstat;
+
+ do
+ {
+ ptrace (PTRACE_KILL, pid_of (process), 0, 0);
+
+ /* Make sure it died. The loop is most likely unnecessary. */
+ wstat = linux_wait_for_event (thread);
+ } while (WIFSTOPPED (wstat));
}
/* Return nonzero if the given thread is still alive. */
+static void
+linux_kill (void)
+{
+ for_each_inferior (&all_threads, linux_kill_one_process);
+}
+
+static int
+linux_thread_alive (int tid)
+{
+ if (find_inferior_id (&all_threads, tid) != NULL)
+ return 1;
+ else
+ return 0;
+}
+
+/* Return nonzero if this process stopped at a breakpoint which
+ no longer appears to be inserted. Also adjust the PC
+ appropriately to resume where the breakpoint used to be. */
static int
-linux_thread_alive (int pid)
+check_removed_breakpoint (struct process_info *event_child)
{
+ CORE_ADDR stop_pc;
+ struct thread_info *saved_inferior;
+
+ if (event_child->pending_is_breakpoint == 0)
+ return 0;
+
+ if (debug_threads)
+ fprintf (stderr, "Checking for breakpoint.\n");
+
+ saved_inferior = current_inferior;
+ current_inferior = get_process_thread (event_child);
+
+ stop_pc = get_stop_pc ();
+
+ /* If the PC has changed since we stopped, then we shouldn't do
+ anything. This happens if, for instance, GDB handled the
+ decr_pc_after_break subtraction itself. */
+ if (stop_pc != event_child->pending_stop_pc)
+ {
+ if (debug_threads)
+ fprintf (stderr, "Ignoring, PC was changed.\n");
+
+ event_child->pending_is_breakpoint = 0;
+ current_inferior = saved_inferior;
+ return 0;
+ }
+
+ /* If the breakpoint is still there, we will report hitting it. */
+ if ((*the_low_target.breakpoint_at) (stop_pc))
+ {
+ if (debug_threads)
+ fprintf (stderr, "Ignoring, breakpoint is still present.\n");
+ current_inferior = saved_inferior;
+ return 0;
+ }
+
+ if (debug_threads)
+ fprintf (stderr, "Removed breakpoint.\n");
+
+ /* For decr_pc_after_break targets, here is where we perform the
+ decrement. We go immediately from this function to resuming,
+ and can not safely call get_stop_pc () again. */
+ if (the_low_target.set_pc != NULL)
+ (*the_low_target.set_pc) (stop_pc);
+
+ /* We consumed the pending SIGTRAP. */
+ event_child->status_pending_p = 0;
+ event_child->status_pending = 0;
+
+ current_inferior = saved_inferior;
return 1;
}
+/* Return 1 if this process has an interesting status pending. This function
+ may silently resume an inferior process. */
static int
-linux_wait_for_one_inferior (struct inferior_info *child)
+status_pending_p (struct inferior_list_entry *entry, void *dummy)
+{
+ struct process_info *process = (struct process_info *) entry;
+
+ if (process->status_pending_p)
+ if (check_removed_breakpoint (process))
+ {
+ /* This thread was stopped at a breakpoint, and the breakpoint
+ is now gone. We were told to continue (or step...) all threads,
+ so GDB isn't trying to single-step past this breakpoint.
+ So instead of reporting the old SIGTRAP, pretend we got to
+ the breakpoint just after it was removed instead of just
+ before; resume the process. */
+ linux_resume_one_process (&process->head, 0, 0);
+ return 0;
+ }
+
+ return process->status_pending_p;
+}
+
+static void
+linux_wait_for_process (struct process_info **childp, int *wstatp)
{
- struct inferior_linux_data *child_data = inferior_target_data (child);
- int pid, wstat;
+ int ret;
+ int to_wait_for = -1;
+
+ if (*childp != NULL)
+ to_wait_for = (*childp)->lwpid;
while (1)
{
- pid = waitpid (child_data->pid, &wstat, 0);
+ ret = waitpid (to_wait_for, wstatp, WNOHANG);
+
+ if (ret == -1)
+ {
+ if (errno != ECHILD)
+ perror_with_name ("waitpid");
+ }
+ else if (ret > 0)
+ break;
+
+ ret = waitpid (to_wait_for, wstatp, WNOHANG | __WCLONE);
+
+ if (ret == -1)
+ {
+ if (errno != ECHILD)
+ perror_with_name ("waitpid (WCLONE)");
+ }
+ else if (ret > 0)
+ break;
+
+ usleep (1000);
+ }
+
+ if (debug_threads
+ && (!WIFSTOPPED (*wstatp)
+ || (WSTOPSIG (*wstatp) != 32
+ && WSTOPSIG (*wstatp) != 33)))
+ fprintf (stderr, "Got an event from %d (%x)\n", ret, *wstatp);
+
+ if (to_wait_for == -1)
+ *childp = (struct process_info *) find_inferior_id (&all_processes, ret);
+
+ (*childp)->stopped = 1;
+ (*childp)->pending_is_breakpoint = 0;
+
+ if (debug_threads
+ && WIFSTOPPED (*wstatp))
+ {
+ current_inferior = (struct thread_info *)
+ find_inferior_id (&all_threads, (*childp)->tid);
+ /* For testing only; i386_stop_pc prints out a diagnostic. */
+ if (the_low_target.get_pc != NULL)
+ get_stop_pc ();
+ }
+}
- if (pid != child_data->pid)
- perror_with_name ("wait");
+static int
+linux_wait_for_event (struct thread_info *child)
+{
+ CORE_ADDR stop_pc;
+ struct process_info *event_child;
+ int wstat;
+
+ /* Check for a process with a pending status. */
+ /* It is possible that the user changed the pending task's registers since
+ it stopped. We correctly handle the change of PC if we hit a breakpoint
+ (in check_removed_breakpoints); signals should be reported anyway. */
+ if (child == NULL)
+ {
+ event_child = (struct process_info *)
+ find_inferior (&all_processes, status_pending_p, NULL);
+ if (debug_threads && event_child)
+ fprintf (stderr, "Got a pending child %d\n", event_child->lwpid);
+ }
+ else
+ {
+ event_child = get_thread_process (child);
+ if (event_child->status_pending_p
+ && check_removed_breakpoint (event_child))
+ event_child = NULL;
+ }
- /* If this target supports breakpoints, see if we hit one. */
- if (the_low_target.stop_pc != NULL
- && WIFSTOPPED (wstat)
- && WSTOPSIG (wstat) == SIGTRAP)
+ if (event_child != NULL)
+ {
+ if (event_child->status_pending_p)
{
- CORE_ADDR stop_pc;
+ if (debug_threads)
+ fprintf (stderr, "Got an event from pending child %d (%04x)\n",
+ event_child->lwpid, event_child->status_pending);
+ wstat = event_child->status_pending;
+ event_child->status_pending_p = 0;
+ event_child->status_pending = 0;
+ current_inferior = get_process_thread (event_child);
+ return wstat;
+ }
+ }
+
+ /* We only enter this loop if no process has a pending wait status. Thus
+ any action taken in response to a wait status inside this loop is
+ responding as soon as we detect the status, not after any pending
+ events. */
+ while (1)
+ {
+ if (child == NULL)
+ event_child = NULL;
+ else
+ event_child = get_thread_process (child);
+
+ linux_wait_for_process (&event_child, &wstat);
+
+ if (event_child == NULL)
+ error ("event from unknown child");
- if (linux_bp_reinsert != 0)
+ current_inferior = (struct thread_info *)
+ find_inferior_id (&all_threads, event_child->tid);
+
+ if (using_threads)
+ {
+ /* Check for thread exit. */
+ if (! WIFSTOPPED (wstat))
{
- reinsert_breakpoint (linux_bp_reinsert);
- linux_bp_reinsert = 0;
- linux_resume (0, 0);
+ if (debug_threads)
+ fprintf (stderr, "Thread %d (LWP %d) exiting\n",
+ event_child->tid, event_child->head.id);
+
+ /* If the last thread is exiting, just return. */
+ if (all_threads.head == all_threads.tail)
+ return wstat;
+
+ dead_thread_notify (event_child->tid);
+
+ remove_inferior (&all_processes, &event_child->head);
+ free (event_child);
+ remove_thread (current_inferior);
+ current_inferior = (struct thread_info *) all_threads.head;
+
+ /* If we were waiting for this particular child to do something...
+ well, it did something. */
+ if (child != NULL)
+ return wstat;
+
+ /* Wait for a more interesting event. */
continue;
}
- fetch_inferior_registers (0);
- stop_pc = (*the_low_target.stop_pc) ();
+ if (WIFSTOPPED (wstat)
+ && WSTOPSIG (wstat) == SIGSTOP
+ && event_child->stop_expected)
+ {
+ if (debug_threads)
+ fprintf (stderr, "Expected stop.\n");
+ event_child->stop_expected = 0;
+ linux_resume_one_process (&event_child->head,
+ event_child->stepping, 0);
+ continue;
+ }
- if (check_breakpoints (stop_pc) != 0)
+ /* FIXME drow/2002-06-09: Get signal numbers from the inferior's
+ thread library? */
+ if (WIFSTOPPED (wstat)
+ && (WSTOPSIG (wstat) == SIGRTMIN
+ || WSTOPSIG (wstat) == SIGRTMIN + 1))
{
- if (the_low_target.set_pc != NULL)
- (*the_low_target.set_pc) (stop_pc);
+ if (debug_threads)
+ fprintf (stderr, "Ignored signal %d for %d (LWP %d).\n",
+ WSTOPSIG (wstat), event_child->tid,
+ event_child->head.id);
+ linux_resume_one_process (&event_child->head,
+ event_child->stepping,
+ WSTOPSIG (wstat));
+ continue;
+ }
+ }
- if (the_low_target.breakpoint_reinsert_addr == NULL)
- {
- linux_bp_reinsert = stop_pc;
- uninsert_breakpoint (stop_pc);
- linux_resume (1, 0);
- }
- else
- {
- reinsert_breakpoint_by_bp
- (stop_pc, (*the_low_target.breakpoint_reinsert_addr) ());
- linux_resume (0, 0);
- }
+ /* If this event was not handled above, and is not a SIGTRAP, report
+ it. */
+ if (!WIFSTOPPED (wstat) || WSTOPSIG (wstat) != SIGTRAP)
+ return wstat;
- continue;
+ /* If this target does not support breakpoints, we simply report the
+ SIGTRAP; it's of no concern to us. */
+ if (the_low_target.get_pc == NULL)
+ return wstat;
+
+ stop_pc = get_stop_pc ();
+
+ /* bp_reinsert will only be set if we were single-stepping.
+ Notice that we will resume the process after hitting
+ a gdbserver breakpoint; single-stepping to/over one
+ is not supported (yet). */
+ if (event_child->bp_reinsert != 0)
+ {
+ if (debug_threads)
+ fprintf (stderr, "Reinserted breakpoint.\n");
+ reinsert_breakpoint (event_child->bp_reinsert);
+ event_child->bp_reinsert = 0;
+
+ /* Clear the single-stepping flag and SIGTRAP as we resume. */
+ linux_resume_one_process (&event_child->head, 0, 0);
+ continue;
+ }
+
+ if (debug_threads)
+ fprintf (stderr, "Hit a (non-reinsert) breakpoint.\n");
+
+ if (check_breakpoints (stop_pc) != 0)
+ {
+ /* We hit one of our own breakpoints. We mark it as a pending
+ breakpoint, so that check_removed_breakpoints () will do the PC
+ adjustment for us at the appropriate time. */
+ event_child->pending_is_breakpoint = 1;
+ event_child->pending_stop_pc = stop_pc;
+
+ /* Now we need to put the breakpoint back. We continue in the event
+ loop instead of simply replacing the breakpoint right away,
+ in order to not lose signals sent to the thread that hit the
+ breakpoint. Unfortunately this increases the window where another
+ thread could sneak past the removed breakpoint. For the current
+ use of server-side breakpoints (thread creation) this is
+ acceptable; but it needs to be considered before this breakpoint
+ mechanism can be used in more general ways. For some breakpoints
+ it may be necessary to stop all other threads, but that should
+ be avoided where possible.
+
+ If breakpoint_reinsert_addr is NULL, that means that we can
+ use PTRACE_SINGLESTEP on this platform. Uninsert the breakpoint,
+ mark it for reinsertion, and single-step.
+
+ Otherwise, call the target function to figure out where we need
+ our temporary breakpoint, create it, and continue executing this
+ process. */
+ if (the_low_target.breakpoint_reinsert_addr == NULL)
+ {
+ event_child->bp_reinsert = stop_pc;
+ uninsert_breakpoint (stop_pc);
+ linux_resume_one_process (&event_child->head, 1, 0);
+ }
+ else
+ {
+ reinsert_breakpoint_by_bp
+ (stop_pc, (*the_low_target.breakpoint_reinsert_addr) ());
+ linux_resume_one_process (&event_child->head, 0, 0);
}
+
+ continue;
+ }
+
+ /* If we were single-stepping, we definitely want to report the
+ SIGTRAP. The single-step operation has completed, so also
+ clear the stepping flag; in general this does not matter,
+ because the SIGTRAP will be reported to the client, which
+ will give us a new action for this thread, but clear it for
+ consistency anyway. It's safe to clear the stepping flag
+ because the only consumer of get_stop_pc () after this point
+ is check_removed_breakpoints, and pending_is_breakpoint is not
+ set. It might be wiser to use a step_completed flag instead. */
+ if (event_child->stepping)
+ {
+ event_child->stepping = 0;
+ return wstat;
+ }
+
+ /* A SIGTRAP that we can't explain. It may have been a breakpoint.
+ Check if it is a breakpoint, and if so mark the process information
+ accordingly. This will handle both the necessary fiddling with the
+ PC on decr_pc_after_break targets and suppressing extra threads
+ hitting a breakpoint if two hit it at once and then GDB removes it
+ after the first is reported. Arguably it would be better to report
+ multiple threads hitting breakpoints simultaneously, but the current
+ remote protocol does not allow this. */
+ if ((*the_low_target.breakpoint_at) (stop_pc))
+ {
+ event_child->pending_is_breakpoint = 1;
+ event_child->pending_stop_pc = stop_pc;
}
return wstat;
}
+
/* NOTREACHED */
return 0;
}
-/* Wait for process, returns status */
+/* Wait for process, returns status. */
static unsigned char
linux_wait (char *status)
{
int w;
+ struct thread_info *child = NULL;
+
+retry:
+ /* If we were only supposed to resume one thread, only wait for
+ that thread - if it's still alive. If it died, however - which
+ can happen if we're coming from the thread death case below -
+ then we need to make sure we restart the other threads. We could
+ pick a thread at random or restart all; restarting all is less
+ arbitrary. */
+ if (cont_thread > 0)
+ {
+ child = (struct thread_info *) find_inferior_id (&all_threads,
+ cont_thread);
+
+ /* No stepping, no signal - unless one is pending already, of course. */
+ if (child == NULL)
+ linux_resume (0, 0);
+ }
enable_async_io ();
- w = linux_wait_for_one_inferior (current_inferior);
+ w = linux_wait_for_event (child);
+ stop_all_processes ();
disable_async_io ();
- if (WIFEXITED (w))
+ /* If we are waiting for a particular child, and it exited,
+ linux_wait_for_event will return its exit status. Similarly if
+ the last child exited. If this is not the last child, however,
+ do not report it as exited until there is a 'thread exited' response
+ available in the remote protocol. Instead, just wait for another event.
+ This should be safe, because if the thread crashed we will already
+ have reported the termination signal to GDB; that should stop any
+ in-progress stepping operations, etc.
+
+ Report the exit status of the last thread to exit. This matches
+ LinuxThreads' behavior. */
+
+ if (all_threads.head == all_threads.tail)
{
- fprintf (stderr, "\nChild exited with retcode = %x \n", WEXITSTATUS (w));
- *status = 'W';
- clear_inferiors ();
- return ((unsigned char) WEXITSTATUS (w));
+ if (WIFEXITED (w))
+ {
+ fprintf (stderr, "\nChild exited with retcode = %x \n", WEXITSTATUS (w));
+ *status = 'W';
+ clear_inferiors ();
+ return ((unsigned char) WEXITSTATUS (w));
+ }
+ else if (!WIFSTOPPED (w))
+ {
+ fprintf (stderr, "\nChild terminated with signal = %x \n", WTERMSIG (w));
+ clear_inferiors ();
+ *status = 'X';
+ return ((unsigned char) WTERMSIG (w));
+ }
}
- else if (!WIFSTOPPED (w))
+ else
{
- fprintf (stderr, "\nChild terminated with signal = %x \n", WTERMSIG (w));
- clear_inferiors ();
- *status = 'X';
- return ((unsigned char) WTERMSIG (w));
+ if (!WIFSTOPPED (w))
+ goto retry;
}
- fetch_inferior_registers (0);
-
*status = 'T';
return ((unsigned char) WSTOPSIG (w));
}
+static void
+send_sigstop (struct inferior_list_entry *entry)
+{
+ struct process_info *process = (struct process_info *) entry;
+
+ if (process->stopped)
+ return;
+
+ /* If we already have a pending stop signal for this process, don't
+ send another. */
+ if (process->stop_expected)
+ {
+ process->stop_expected = 0;
+ return;
+ }
+
+ if (debug_threads)
+ fprintf (stderr, "Sending sigstop to process %d\n", process->head.id);
+
+ kill (process->head.id, SIGSTOP);
+ process->sigstop_sent = 1;
+}
+
+static void
+wait_for_sigstop (struct inferior_list_entry *entry)
+{
+ struct process_info *process = (struct process_info *) entry;
+ struct thread_info *saved_inferior, *thread;
+ int wstat, saved_tid;
+
+ if (process->stopped)
+ return;
+
+ saved_inferior = current_inferior;
+ saved_tid = ((struct inferior_list_entry *) saved_inferior)->id;
+ thread = (struct thread_info *) find_inferior_id (&all_threads,
+ process->tid);
+ wstat = linux_wait_for_event (thread);
+
+ /* If we stopped with a non-SIGSTOP signal, save it for later
+ and record the pending SIGSTOP. If the process exited, just
+ return. */
+ if (WIFSTOPPED (wstat)
+ && WSTOPSIG (wstat) != SIGSTOP)
+ {
+ if (debug_threads)
+ fprintf (stderr, "Stopped with non-sigstop signal\n");
+ process->status_pending_p = 1;
+ process->status_pending = wstat;
+ process->stop_expected = 1;
+ }
+
+ if (linux_thread_alive (saved_tid))
+ current_inferior = saved_inferior;
+ else
+ {
+ if (debug_threads)
+ fprintf (stderr, "Previously current thread died.\n");
+
+ /* Set a valid thread as current. */
+ set_desired_inferior (0);
+ }
+}
+
+static void
+stop_all_processes (void)
+{
+ stopping_threads = 1;
+ for_each_inferior (&all_processes, send_sigstop);
+ for_each_inferior (&all_processes, wait_for_sigstop);
+ stopping_threads = 0;
+}
+
/* Resume execution of the inferior process.
If STEP is nonzero, single-step it.
If SIGNAL is nonzero, give it that signal. */
static void
-linux_resume (int step, int signal)
+linux_resume_one_process (struct inferior_list_entry *entry,
+ int step, int signal)
{
+ struct process_info *process = (struct process_info *) entry;
+ struct thread_info *saved_inferior;
+
+ if (process->stopped == 0)
+ return;
+
+ /* If we have pending signals or status, and a new signal, enqueue the
+ signal. Also enqueue the signal if we are waiting to reinsert a
+ breakpoint; it will be picked up again below. */
+ if (signal != 0
+ && (process->status_pending_p || process->pending_signals != NULL
+ || process->bp_reinsert != 0))
+ {
+ struct pending_signals *p_sig;
+ p_sig = malloc (sizeof (*p_sig));
+ p_sig->prev = process->pending_signals;
+ p_sig->signal = signal;
+ process->pending_signals = p_sig;
+ }
+
+ if (process->status_pending_p)
+ return;
+
+ saved_inferior = current_inferior;
+ current_inferior = get_process_thread (process);
+
+ if (debug_threads)
+ fprintf (stderr, "Resuming process %d (%s, signal %d, stop %s)\n", inferior_pid,
+ step ? "step" : "continue", signal,
+ process->stop_expected ? "expected" : "not expected");
+
+ /* This bit needs some thinking about. If we get a signal that
+ we must report while a single-step reinsert is still pending,
+ we often end up resuming the thread. It might be better to
+ (ew) allow a stack of pending events; then we could be sure that
+ the reinsert happened right away and not lose any signals.
+
+ Making this stack would also shrink the window in which breakpoints are
+ uninserted (see comment in linux_wait_for_process) but not enough for
+ complete correctness, so it won't solve that problem. It may be
+ worthwhile just to solve this one, however. */
+ if (process->bp_reinsert != 0)
+ {
+ if (debug_threads)
+ fprintf (stderr, " pending reinsert at %08lx", (long)process->bp_reinsert);
+ if (step == 0)
+ fprintf (stderr, "BAD - reinserting but not stepping.\n");
+ step = 1;
+
+ /* Postpone any pending signal. It was enqueued above. */
+ signal = 0;
+ }
+
+ check_removed_breakpoint (process);
+
+ if (debug_threads && the_low_target.get_pc != NULL)
+ {
+ fprintf (stderr, " ");
+ (long) (*the_low_target.get_pc) ();
+ }
+
+ /* If we have pending signals, consume one unless we are trying to reinsert
+ a breakpoint. */
+ if (process->pending_signals != NULL && process->bp_reinsert == 0)
+ {
+ struct pending_signals **p_sig;
+
+ p_sig = &process->pending_signals;
+ while ((*p_sig)->prev != NULL)
+ p_sig = &(*p_sig)->prev;
+
+ signal = (*p_sig)->signal;
+ free (*p_sig);
+ *p_sig = NULL;
+ }
+
+ regcache_invalidate_one ((struct inferior_list_entry *)
+ get_process_thread (process));
errno = 0;
- ptrace (step ? PTRACE_SINGLESTEP : PTRACE_CONT, inferior_pid, 1, signal);
+ process->stopped = 0;
+ process->stepping = step;
+ ptrace (step ? PTRACE_SINGLESTEP : PTRACE_CONT, process->lwpid, 0, signal);
+
+ current_inferior = saved_inferior;
if (errno)
perror_with_name ("ptrace");
}
+/* This function is called once per process other than the first
+ one. The first process we are told the signal to continue
+ with, and whether to step or continue; for all others, any
+ existing signals will be marked in status_pending_p to be
+ reported momentarily, and we preserve the stepping flag. */
+static void
+linux_continue_one_process (struct inferior_list_entry *entry)
+{
+ struct process_info *process;
-#ifdef HAVE_LINUX_USRREGS
+ process = (struct process_info *) entry;
+ linux_resume_one_process (entry, process->stepping, 0);
+}
+
+static void
+linux_resume (int step, int signal)
+{
+ struct process_info *process;
+
+ process = get_thread_process (current_inferior);
+
+ /* If the current process has a status pending, this signal will
+ be enqueued and sent later. */
+ linux_resume_one_process (&process->head, step, signal);
-#define REGISTER_RAW_SIZE(regno) register_size((regno))
+ if (cont_thread == 0 || cont_thread == -1)
+ for_each_inferior (&all_processes, linux_continue_one_process);
+}
+
+#ifdef HAVE_LINUX_USRREGS
int
register_addr (int regnum)
@@ -262,6 +904,7 @@ fetch_register (int regno)
{
CORE_ADDR regaddr;
register int i;
+ char *buf;
if (regno >= the_low_target.num_regs)
return;
@@ -271,10 +914,11 @@ fetch_register (int regno)
regaddr = register_addr (regno);
if (regaddr == -1)
return;
- for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (PTRACE_XFER_TYPE))
+ buf = alloca (register_size (regno));
+ for (i = 0; i < register_size (regno); i += sizeof (PTRACE_XFER_TYPE))
{
errno = 0;
- *(PTRACE_XFER_TYPE *) (register_data (regno) + i) =
+ *(PTRACE_XFER_TYPE *) (buf + i) =
ptrace (PTRACE_PEEKUSER, inferior_pid, (PTRACE_ARG3_TYPE) regaddr, 0);
regaddr += sizeof (PTRACE_XFER_TYPE);
if (errno != 0)
@@ -288,6 +932,8 @@ fetch_register (int regno)
goto error_exit;
}
}
+ supply_register (regno, buf);
+
error_exit:;
}
@@ -310,6 +956,7 @@ usr_store_inferior_registers (int regno)
{
CORE_ADDR regaddr;
int i;
+ char *buf;
if (regno >= 0)
{
@@ -323,11 +970,13 @@ usr_store_inferior_registers (int regno)
if (regaddr == -1)
return;
errno = 0;
- for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (PTRACE_XFER_TYPE))
+ buf = alloca (register_size (regno));
+ collect_register (regno, buf);
+ for (i = 0; i < register_size (regno); i += sizeof (PTRACE_XFER_TYPE))
{
errno = 0;
ptrace (PTRACE_POKEUSER, inferior_pid, (PTRACE_ARG3_TYPE) regaddr,
- *(int *) (register_data (regno) + i));
+ *(int *) (buf + i));
if (errno != 0)
{
if ((*the_low_target.cannot_store_register) (regno) == 0)
@@ -345,7 +994,7 @@ usr_store_inferior_registers (int regno)
}
else
for (regno = 0; regno < the_low_target.num_regs; regno++)
- store_inferior_registers (regno);
+ usr_store_inferior_registers (regno);
}
#endif /* HAVE_LINUX_USRREGS */
@@ -354,7 +1003,7 @@ usr_store_inferior_registers (int regno)
#ifdef HAVE_LINUX_REGSETS
static int
-regsets_fetch_inferior_registers (void)
+regsets_fetch_inferior_registers ()
{
struct regset_info *regset;
@@ -392,7 +1041,10 @@ regsets_fetch_inferior_registers (void)
}
else
{
- perror ("Warning: ptrace(regsets_fetch_inferior_registers)");
+ char s[256];
+ sprintf (s, "ptrace(regsets_fetch_inferior_registers) PID=%d",
+ inferior_pid);
+ perror (s);
}
}
regset->store_function (buf);
@@ -402,7 +1054,7 @@ regsets_fetch_inferior_registers (void)
}
static int
-regsets_store_inferior_registers (void)
+regsets_store_inferior_registers ()
{
struct regset_info *regset;
@@ -528,6 +1180,11 @@ linux_write_memory (CORE_ADDR memaddr, const char *myaddr, int len)
register PTRACE_XFER_TYPE *buffer = (PTRACE_XFER_TYPE *) alloca (count * sizeof (PTRACE_XFER_TYPE));
extern int errno;
+ if (debug_threads)
+ {
+ fprintf (stderr, "Writing %02x to %08lx\n", (unsigned)myaddr[0], (long)memaddr);
+ }
+
/* Fill start and end extra bytes of buffer with existing memory data. */
buffer[0] = ptrace (PTRACE_PEEKTEXT, inferior_pid,
@@ -562,7 +1219,40 @@ linux_write_memory (CORE_ADDR memaddr, const char *myaddr, int len)
static void
linux_look_up_symbols (void)
{
- /* Don't need to look up any symbols yet. */
+#ifdef USE_THREAD_DB
+ if (using_threads)
+ return;
+
+ using_threads = thread_db_init ();
+#endif
+}
+
+/* Return 1 if this process is not stopped. */
+static int
+unstopped_p (struct inferior_list_entry *entry, void *dummy)
+{
+ struct process_info *process = (struct process_info *) entry;
+
+ if (process->stopped)
+ return 0;
+
+ return 1;
+}
+
+static int
+linux_signal_pid ()
+{
+ struct inferior_list_entry *process;
+
+ process = find_inferior (&all_processes, unstopped_p, NULL);
+
+ if (process == NULL)
+ {
+ warning ("no unstopped process");
+ return inferior_pid;
+ }
+
+ return pid_of ((struct process_info *) process);
}
@@ -578,13 +1268,24 @@ static struct target_ops linux_target_ops = {
linux_read_memory,
linux_write_memory,
linux_look_up_symbols,
+ linux_signal_pid,
};
+static void
+linux_init_signals ()
+{
+ /* FIXME drow/2002-06-09: As above, we should check with LinuxThreads
+ to find what the cancel signal actually is. */
+ signal (SIGRTMIN+1, SIG_IGN);
+}
+
void
initialize_low (void)
{
+ using_threads = 0;
set_target_ops (&linux_target_ops);
set_breakpoint_data (the_low_target.breakpoint,
the_low_target.breakpoint_len);
init_registers ();
+ linux_init_signals ();
}
diff --git a/gdb/gdbserver/linux-low.h b/gdb/gdbserver/linux-low.h
index b484982e15e..bae76b77bdc 100644
--- a/gdb/gdbserver/linux-low.h
+++ b/gdb/gdbserver/linux-low.h
@@ -19,12 +19,21 @@
Boston, MA 02111-1307, USA. */
#ifdef HAVE_LINUX_REGSETS
-typedef void (*regset_func) (void *);
+typedef void (*regset_fill_func) (void *);
+typedef void (*regset_store_func) (const void *);
+enum regset_type {
+ GENERAL_REGS,
+ FP_REGS,
+ EXTENDED_REGS,
+};
+
struct regset_info
{
int get_request, set_request;
int size;
- regset_func fill_function, store_function;
+ enum regset_type type;
+ regset_fill_func fill_function;
+ regset_store_func store_function;
};
extern struct regset_info target_regsets[];
#endif
@@ -39,11 +48,67 @@ struct linux_target_ops
store the register, and 2 if failure to store the register
is acceptable. */
int (*cannot_store_register) (int);
- CORE_ADDR (*stop_pc) (void);
+ CORE_ADDR (*get_pc) (void);
void (*set_pc) (CORE_ADDR newpc);
const char *breakpoint;
int breakpoint_len;
CORE_ADDR (*breakpoint_reinsert_addr) (void);
+
+
+ int decr_pc_after_break;
+ int (*breakpoint_at) (CORE_ADDR pc);
};
extern struct linux_target_ops the_low_target;
+
+#define get_process(inf) ((struct process_info *)(inf))
+#define get_thread_process(thr) (get_process (inferior_target_data (thr)))
+#define get_process_thread(proc) ((struct thread_info *) \
+ find_inferior_id (&all_threads, \
+ get_process (proc)->tid))
+
+struct process_info
+{
+ struct inferior_list_entry head;
+ int thread_known;
+ int lwpid;
+ int tid;
+
+ /* If this flag is set, the next SIGSTOP will be ignored (the process will
+ be immediately resumed). */
+ int stop_expected;
+
+ /* If this flag is set, the process is known to be stopped right now (stop
+ event already received in a wait()). */
+ int stopped;
+
+ /* If this flag is set, we have sent a SIGSTOP to this process and are
+ waiting for it to stop. */
+ int sigstop_sent;
+
+ /* If this flag is set, STATUS_PENDING is a waitstatus that has not yet
+ been reported. */
+ int status_pending_p;
+ int status_pending;
+
+ /* If this flag is set, the pending status is a (GDB-placed) breakpoint. */
+ int pending_is_breakpoint;
+ CORE_ADDR pending_stop_pc;
+
+ /* If this is non-zero, it is a breakpoint to be reinserted at our next
+ stop (SIGTRAP stops only). */
+ CORE_ADDR bp_reinsert;
+
+ /* If this flag is set, the last continue operation on this process
+ was a single-step. */
+ int stepping;
+
+ /* If this is non-zero, it points to a chain of signals which need to
+ be delivered to this process. */
+ struct pending_signals *pending_signals;
+};
+extern struct inferior_list all_processes;
+
+void linux_attach_lwp (int pid, int tid);
+
+int thread_db_init (void);
diff --git a/gdb/gdbserver/linux-mips-low.c b/gdb/gdbserver/linux-mips-low.c
index f721ec94eeb..51e74cef140 100644
--- a/gdb/gdbserver/linux-mips-low.c
+++ b/gdb/gdbserver/linux-mips-low.c
@@ -96,9 +96,60 @@ mips_cannot_store_register (int regno)
return 0;
}
+static CORE_ADDR
+mips_get_pc ()
+{
+ unsigned long pc;
+ collect_register_by_name ("pc", &pc);
+ return pc;
+}
+
+static void
+mips_set_pc (CORE_ADDR pc)
+{
+ unsigned long newpc = pc;
+ supply_register_by_name ("pc", &newpc);
+}
+
+/* Correct in either endianness. */
+static const unsigned long mips_breakpoint = 0x0005000d;
+#define mips_breakpoint_len 4
+
+/* We only place breakpoints in empty marker functions, and thread locking
+ is outside of the function. So rather than importing software single-step,
+ we can just run until exit. */
+static CORE_ADDR
+mips_reinsert_addr ()
+{
+ unsigned long pc;
+ collect_register_by_name ("ra", &pc);
+ return pc;
+}
+
+static int
+mips_breakpoint_at (CORE_ADDR where)
+{
+ unsigned long insn;
+
+ (*the_target->read_memory) (where, (char *) &insn, 4);
+ if (insn == mips_breakpoint)
+ return 1;
+
+ /* If necessary, recognize more trap instructions here. GDB only uses the
+ one. */
+ return 0;
+}
+
struct linux_target_ops the_low_target = {
mips_num_regs,
mips_regmap,
mips_cannot_fetch_register,
mips_cannot_store_register,
+ mips_get_pc,
+ mips_set_pc,
+ (const char *) &mips_breakpoint,
+ mips_breakpoint_len,
+ mips_reinsert_addr,
+ 0,
+ mips_breakpoint_at,
};
diff --git a/gdb/gdbserver/linux-ppc-low.c b/gdb/gdbserver/linux-ppc-low.c
index 7cb315a304a..2bb0f50034e 100644
--- a/gdb/gdbserver/linux-ppc-low.c
+++ b/gdb/gdbserver/linux-ppc-low.c
@@ -64,9 +64,53 @@ ppc_cannot_fetch_register (int regno)
return 0;
}
+static CORE_ADDR
+ppc_get_pc (void)
+{
+ unsigned long pc;
+
+ collect_register_by_name ("pc", &pc);
+ return (CORE_ADDR) pc;
+}
+
+static void
+ppc_set_pc (CORE_ADDR pc)
+{
+ unsigned long newpc = pc;
+
+ supply_register_by_name ("pc", &newpc);
+}
+
+/* Correct in either endianness. Note that this file is
+ for PowerPC only, not PowerPC64.
+ This instruction is "twge r2, r2", which GDB uses as a software
+ breakpoint. */
+static const unsigned long ppc_breakpoint = 0x7d821008;
+#define ppc_breakpoint_len 4
+
+static int
+ppc_breakpoint_at (CORE_ADDR where)
+{
+ unsigned long insn;
+
+ (*the_target->read_memory) (where, (char *) &insn, 4);
+ if (insn == ppc_breakpoint)
+ return 1;
+ /* If necessary, recognize more trap instructions here. GDB only uses the
+ one. */
+ return 0;
+}
+
struct linux_target_ops the_low_target = {
ppc_num_regs,
ppc_regmap,
ppc_cannot_fetch_register,
ppc_cannot_store_register,
+ ppc_get_pc,
+ ppc_set_pc,
+ (const char *) &ppc_breakpoint,
+ ppc_breakpoint_len,
+ NULL,
+ 0,
+ ppc_breakpoint_at,
};
diff --git a/gdb/gdbserver/linux-sh-low.c b/gdb/gdbserver/linux-sh-low.c
index cdc390d2332..ee84561f17c 100644
--- a/gdb/gdbserver/linux-sh-low.c
+++ b/gdb/gdbserver/linux-sh-low.c
@@ -57,9 +57,49 @@ sh_cannot_fetch_register (int regno)
return 0;
}
+static CORE_ADDR
+sh_get_pc ()
+{
+ unsigned long pc;
+ collect_register_by_name ("pc", &pc);
+ return pc;
+}
+
+static void
+sh_set_pc (CORE_ADDR pc)
+{
+ unsigned long newpc = pc;
+ supply_register_by_name ("pc", &newpc);
+}
+
+/* Correct in either endianness, obviously. */
+static const unsigned short sh_breakpoint = 0xc3c3;
+#define sh_breakpoint_len 2
+
+static int
+sh_breakpoint_at (CORE_ADDR where)
+{
+ unsigned short insn;
+
+ (*the_target->read_memory) (where, (char *) &insn, 2);
+ if (insn == sh_breakpoint)
+ return 1;
+
+ /* If necessary, recognize more trap instructions here. GDB only uses the
+ one. */
+ return 0;
+}
+
struct linux_target_ops the_low_target = {
sh_num_regs,
sh_regmap,
sh_cannot_fetch_register,
sh_cannot_store_register,
+ sh_get_pc,
+ sh_set_pc,
+ (const char *) &sh_breakpoint,
+ sh_breakpoint_len,
+ NULL,
+ 0,
+ sh_breakpoint_at,
};
diff --git a/gdb/gdbserver/linux-x86-64-low.c b/gdb/gdbserver/linux-x86-64-low.c
index e1248904aba..1f80d990cc9 100644
--- a/gdb/gdbserver/linux-x86-64-low.c
+++ b/gdb/gdbserver/linux-x86-64-low.c
@@ -71,10 +71,12 @@ x86_64_store_fpregset (void *buf)
struct regset_info target_regsets[] = {
{ PTRACE_GETREGS, PTRACE_SETREGS, sizeof (elf_gregset_t),
+ GENERAL_REGS,
x86_64_fill_gregset, x86_64_store_gregset },
{ PTRACE_GETFPREGS, PTRACE_SETFPREGS, sizeof (elf_fpregset_t),
+ FP_REGS,
x86_64_fill_fpregset, x86_64_store_fpregset },
- { 0, 0, -1, NULL, NULL }
+ { 0, 0, -1, -1, NULL, NULL }
};
struct linux_target_ops the_low_target = {
diff --git a/gdb/gdbserver/proc-service.c b/gdb/gdbserver/proc-service.c
new file mode 100644
index 00000000000..becf565529b
--- /dev/null
+++ b/gdb/gdbserver/proc-service.c
@@ -0,0 +1,256 @@
+/* libthread_db helper functions for the remote server for GDB.
+ Copyright 2002
+ Free Software Foundation, Inc.
+
+ Contributed by MontaVista Software.
+
+ 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 "server.h"
+
+/* This file is currently tied to GNU/Linux. It should scale well to
+ another libthread_db implementation, with the approriate gdbserver
+ hooks, but for now this means we can use GNU/Linux's target data. */
+
+#include "linux-low.h"
+
+/* Correct for all GNU/Linux targets (for quite some time). */
+#define GDB_GREGSET_T elf_gregset_t
+#define GDB_FPREGSET_T elf_fpregset_t
+
+#ifndef HAVE_ELF_FPREGSET_T
+/* Make sure we have said types. Not all platforms bring in <linux/elf.h>
+ via <sys/procfs.h>. */
+#ifdef HAVE_LINUX_ELF_H
+#include <linux/elf.h>
+#endif
+#endif
+
+#include "../gdb_proc_service.h"
+
+typedef struct ps_prochandle *gdb_ps_prochandle_t;
+typedef void *gdb_ps_read_buf_t;
+typedef const void *gdb_ps_write_buf_t;
+typedef size_t gdb_ps_size_t;
+
+/* FIXME redo this right */
+#if 0
+#ifndef HAVE_LINUX_REGSETS
+#error HAVE_LINUX_REGSETS required!
+#else
+static struct regset_info *
+gregset_info(void)
+{
+ int i = 0;
+
+ while (target_regsets[i].size != -1)
+ {
+ if (target_regsets[i].type == GENERAL_REGS)
+ break;
+ i++;
+ }
+
+ return &target_regsets[i];
+}
+
+static struct regset_info *
+fpregset_info(void)
+{
+ int i = 0;
+
+ while (target_regsets[i].size != -1)
+ {
+ if (target_regsets[i].type == FP_REGS)
+ break;
+ i++;
+ }
+
+ return &target_regsets[i];
+}
+#endif
+#endif
+
+/* Search for the symbol named NAME within the object named OBJ within
+ the target process PH. If the symbol is found the address of the
+ symbol is stored in SYM_ADDR. */
+
+ps_err_e
+ps_pglobal_lookup (gdb_ps_prochandle_t ph, const char *obj,
+ const char *name, paddr_t *sym_addr)
+{
+ CORE_ADDR addr;
+
+ if (look_up_one_symbol (name, &addr) == 0)
+ return PS_NOSYM;
+
+ *sym_addr = (paddr_t) (unsigned long) addr;
+ return PS_OK;
+}
+
+/* Read SIZE bytes from the target process PH at address ADDR and copy
+ them into BUF. */
+
+ps_err_e
+ps_pdread (gdb_ps_prochandle_t ph, paddr_t addr,
+ gdb_ps_read_buf_t buf, gdb_ps_size_t size)
+{
+ read_inferior_memory (addr, buf, size);
+ return PS_OK;
+}
+
+/* Write SIZE bytes from BUF into the target process PH at address ADDR. */
+
+ps_err_e
+ps_pdwrite (gdb_ps_prochandle_t ph, paddr_t addr,
+ gdb_ps_write_buf_t buf, gdb_ps_size_t size)
+{
+ return write_inferior_memory (addr, buf, size);
+}
+
+/* Get the general registers of LWP LWPID within the target process PH
+ and store them in GREGSET. */
+
+ps_err_e
+ps_lgetregs (gdb_ps_prochandle_t ph, lwpid_t lwpid, prgregset_t gregset)
+{
+#if 0
+ struct thread_info *reg_inferior, *save_inferior;
+ void *regcache;
+
+ reg_inferior = (struct thread_info *) find_inferior_id (&all_threads,
+ lwpid);
+ if (reg_inferior == NULL)
+ return PS_ERR;
+
+ save_inferior = current_inferior;
+ current_inferior = reg_inferior;
+
+ regcache = new_register_cache ();
+ the_target->fetch_registers (0, regcache);
+ gregset_info()->fill_function (gregset, regcache);
+ free_register_cache (regcache);
+
+ current_inferior = save_inferior;
+ return PS_OK;
+#endif
+ /* FIXME */
+ return PS_ERR;
+}
+
+/* Set the general registers of LWP LWPID within the target process PH
+ from GREGSET. */
+
+ps_err_e
+ps_lsetregs (gdb_ps_prochandle_t ph, lwpid_t lwpid, const prgregset_t gregset)
+{
+#if 0
+ struct thread_info *reg_inferior, *save_inferior;
+ void *regcache;
+
+ reg_inferior = (struct thread_info *) find_inferior_id (&all_threads, lwpid);
+ if (reg_inferior == NULL)
+ return PS_ERR;
+
+ save_inferior = current_inferior;
+ current_inferior = reg_inferior;
+
+ regcache = new_register_cache ();
+ gregset_info()->store_function (gregset, regcache);
+ the_target->store_registers (0, regcache);
+ free_register_cache (regcache);
+
+ current_inferior = save_inferior;
+
+ return PS_OK;
+#endif
+ /* FIXME */
+ return PS_ERR;
+}
+
+/* Get the floating-point registers of LWP LWPID within the target
+ process PH and store them in FPREGSET. */
+
+ps_err_e
+ps_lgetfpregs (gdb_ps_prochandle_t ph, lwpid_t lwpid,
+ gdb_prfpregset_t *fpregset)
+{
+#if 0
+ struct thread_info *reg_inferior, *save_inferior;
+ void *regcache;
+
+ reg_inferior = (struct thread_info *) find_inferior_id (&all_threads, lwpid);
+ if (reg_inferior == NULL)
+ return PS_ERR;
+
+ save_inferior = current_inferior;
+ current_inferior = reg_inferior;
+
+ regcache = new_register_cache ();
+ the_target->fetch_registers (0, regcache);
+ fpregset_info()->fill_function (fpregset, regcache);
+ free_register_cache (regcache);
+
+ current_inferior = save_inferior;
+
+ return PS_OK;
+#endif
+ /* FIXME */
+ return PS_ERR;
+}
+
+/* Set the floating-point registers of LWP LWPID within the target
+ process PH from FPREGSET. */
+
+ps_err_e
+ps_lsetfpregs (gdb_ps_prochandle_t ph, lwpid_t lwpid,
+ const gdb_prfpregset_t *fpregset)
+{
+#if 0
+ struct thread_info *reg_inferior, *save_inferior;
+ void *regcache;
+
+ reg_inferior = (struct thread_info *) find_inferior_id (&all_threads, lwpid);
+ if (reg_inferior == NULL)
+ return PS_ERR;
+
+ save_inferior = current_inferior;
+ current_inferior = reg_inferior;
+
+ regcache = new_register_cache ();
+ fpregset_info()->store_function (fpregset, regcache);
+ the_target->store_registers (0, regcache);
+ free_register_cache (regcache);
+
+ current_inferior = save_inferior;
+
+ return PS_OK;
+#endif
+ /* FIXME */
+ return PS_ERR;
+}
+
+/* Return overall process id of the target PH. Special for GNU/Linux
+ -- not used on Solaris. */
+
+pid_t
+ps_getpid (gdb_ps_prochandle_t ph)
+{
+ return ph->pid;
+}
+
+
diff --git a/gdb/gdbserver/regcache.c b/gdb/gdbserver/regcache.c
index 701d09232f8..be3b3a7f33e 100644
--- a/gdb/gdbserver/regcache.c
+++ b/gdb/gdbserver/regcache.c
@@ -25,8 +25,13 @@
#include <stdlib.h>
#include <string.h>
+/* The private data for the register cache. Note that we have one
+ per inferior; this is primarily for simplicity, as the performance
+ benefit is minimal. */
+
struct inferior_regcache_data
{
+ int registers_valid;
char *registers;
};
@@ -38,7 +43,7 @@ static int num_registers;
const char **gdbserver_expedite_regs;
static struct inferior_regcache_data *
-get_regcache (struct inferior_info *inf)
+get_regcache (struct thread_info *inf, int fetch)
{
struct inferior_regcache_data *regcache;
@@ -47,17 +52,50 @@ get_regcache (struct inferior_info *inf)
if (regcache == NULL)
fatal ("no register cache");
+ /* FIXME - fetch registers for INF */
+ if (fetch && regcache->registers_valid == 0)
+ {
+ fetch_inferior_registers (0);
+ regcache->registers_valid = 1;
+ }
+
return regcache;
}
+void
+regcache_invalidate_one (struct inferior_list_entry *entry)
+{
+ struct thread_info *thread = (struct thread_info *) entry;
+ struct inferior_regcache_data *regcache;
+
+ regcache = (struct inferior_regcache_data *) inferior_regcache_data (thread);
+
+ if (regcache->registers_valid)
+ {
+ struct thread_info *saved_inferior = current_inferior;
+
+ current_inferior = thread;
+ store_inferior_registers (-1);
+ current_inferior = saved_inferior;
+ }
+
+ regcache->registers_valid = 0;
+}
+
+void
+regcache_invalidate ()
+{
+ for_each_inferior (&all_threads, regcache_invalidate_one);
+}
+
int
registers_length (void)
{
return 2 * register_bytes;
}
-void
-create_register_cache (struct inferior_info *inferior)
+void *
+new_register_cache (void)
{
struct inferior_regcache_data *regcache;
@@ -67,15 +105,19 @@ create_register_cache (struct inferior_info *inferior)
if (regcache->registers == NULL)
fatal ("Could not allocate register cache.");
- set_inferior_regcache_data (inferior, regcache);
+ regcache->registers_valid = 0;
+
+ return regcache;
}
void
-free_register_cache (struct inferior_info *inferior)
+free_register_cache (void *regcache_p)
{
- free (get_regcache (current_inferior)->registers);
- free (get_regcache (current_inferior));
- set_inferior_regcache_data (inferior, NULL);
+ struct inferior_regcache_data *regcache
+ = (struct inferior_regcache_data *) regcache_p;
+
+ free (regcache->registers);
+ free (regcache);
}
void
@@ -99,7 +141,7 @@ set_register_cache (struct reg *regs, int n)
void
registers_to_string (char *buf)
{
- char *registers = get_regcache (current_inferior)->registers;
+ char *registers = get_regcache (current_inferior, 1)->registers;
convert_int_to_ascii (registers, buf, register_bytes);
}
@@ -108,7 +150,7 @@ void
registers_from_string (char *buf)
{
int len = strlen (buf);
- char *registers = get_regcache (current_inferior)->registers;
+ char *registers = get_regcache (current_inferior, 1)->registers;
if (len != register_bytes * 2)
{
@@ -155,10 +197,10 @@ register_size (int n)
return reg_defs[n].size / 8;
}
-char *
-register_data (int n)
+static char *
+register_data (int n, int fetch)
{
- char *registers = get_regcache (current_inferior)->registers;
+ char *registers = get_regcache (current_inferior, fetch)->registers;
return registers + (reg_defs[n].offset / 8);
}
@@ -166,7 +208,7 @@ register_data (int n)
void
supply_register (int n, const void *buf)
{
- memcpy (register_data (n), buf, register_size (n));
+ memcpy (register_data (n, 0), buf, register_size (n));
}
void
@@ -178,7 +220,13 @@ supply_register_by_name (const char *name, const void *buf)
void
collect_register (int n, void *buf)
{
- memcpy (buf, register_data (n), register_size (n));
+ memcpy (buf, register_data (n, 1), register_size (n));
+}
+
+void
+collect_register_as_string (int n, char *buf)
+{
+ convert_int_to_ascii (register_data (n, 1), buf, register_size (n));
}
void
diff --git a/gdb/gdbserver/regcache.h b/gdb/gdbserver/regcache.h
index 362288ee049..930bd9cbfe6 100644
--- a/gdb/gdbserver/regcache.h
+++ b/gdb/gdbserver/regcache.h
@@ -21,15 +21,20 @@
#ifndef REGCACHE_H
#define REGCACHE_H
-struct inferior_info;
+struct inferior_list_entry;
/* Create a new register cache for INFERIOR. */
-void create_register_cache (struct inferior_info *inferior);
+void *new_register_cache (void);
/* Release all memory associated with the register cache for INFERIOR. */
-void free_register_cache (struct inferior_info *inferior);
+void free_register_cache (void *regcache);
+
+/* Invalidate cached registers for one or all threads. */
+
+void regcache_invalidate_one (struct inferior_list_entry *);
+void regcache_invalidate (void);
/* Convert all registers to a string in the currently specified remote
format. */
@@ -48,8 +53,6 @@ int registers_length (void);
struct reg *find_register_by_number (int n);
-char *register_data (int n);
-
int register_size (int n);
int find_regno (const char *name);
@@ -62,6 +65,8 @@ void supply_register_by_name (const char *name, const void *buf);
void collect_register (int n, void *buf);
+void collect_register_as_string (int n, char *buf);
+
void collect_register_by_name (const char *name, void *buf);
#endif /* REGCACHE_H */
diff --git a/gdb/gdbserver/remote-utils.c b/gdb/gdbserver/remote-utils.c
index 14734f161bd..c610c4c0e7c 100644
--- a/gdb/gdbserver/remote-utils.c
+++ b/gdb/gdbserver/remote-utils.c
@@ -42,6 +42,10 @@ struct ui_file *gdb_stdlog;
static int remote_desc;
+/* FIXME headerize? */
+extern int using_threads;
+extern int debug_threads;
+
/* Open a connection to a remote debugger.
NAME is the filename used for communication. */
@@ -296,10 +300,17 @@ putpkt (char *buf)
}
if (remote_debug)
- printf ("putpkt (\"%s\"); [looking for ack]\n", buf2);
+ {
+ fprintf (stderr, "putpkt (\"%s\"); [looking for ack]\n", buf2);
+ fflush (stderr);
+ }
cc = read (remote_desc, buf3, 1);
if (remote_debug)
- printf ("[received '%c' (0x%x)]\n", buf3[0], buf3[0]);
+ {
+ fprintf (stderr, "[received '%c' (0x%x)]\n", buf3[0], buf3[0]);
+ fflush (stderr);
+ }
+
if (cc <= 0)
{
if (cc == 0)
@@ -310,6 +321,10 @@ putpkt (char *buf)
free (buf2);
return -1;
}
+
+ /* Check for an input interrupt while we're here. */
+ if (buf3[0] == '\003')
+ kill ((*the_target->signal_pid) (), SIGINT);
}
while (buf3[0] != '+');
@@ -346,7 +361,7 @@ input_interrupt (int unused)
return;
}
- kill (signal_pid, SIGINT);
+ kill ((*the_target->signal_pid) (), SIGINT);
}
}
@@ -411,7 +426,11 @@ getpkt (char *buf)
if (c == '$')
break;
if (remote_debug)
- printf ("[getpkt: discarding char '%c']\n", c);
+ {
+ fprintf (stderr, "[getpkt: discarding char '%c']\n", c);
+ fflush (stderr);
+ }
+
if (c < 0)
return -1;
}
@@ -441,12 +460,19 @@ getpkt (char *buf)
}
if (remote_debug)
- printf ("getpkt (\"%s\"); [sending ack] \n", buf);
+ {
+ fprintf (stderr, "getpkt (\"%s\"); [sending ack] \n", buf);
+ fflush (stderr);
+ }
write (remote_desc, "+", 1);
if (remote_debug)
- printf ("[sent ack]\n");
+ {
+ fprintf (stderr, "[sent ack]\n");
+ fflush (stderr);
+ }
+
return bp - buf;
}
@@ -499,8 +525,6 @@ convert_ascii_to_int (char *from, char *to, int n)
static char *
outreg (int regno, char *buf)
{
- int regsize = register_size (regno);
-
if ((regno >> 12) != 0)
*buf++ = tohex ((regno >> 12) & 0xf);
if ((regno >> 8) != 0)
@@ -508,14 +532,47 @@ outreg (int regno, char *buf)
*buf++ = tohex ((regno >> 4) & 0xf);
*buf++ = tohex (regno & 0xf);
*buf++ = ':';
- convert_int_to_ascii (register_data (regno), buf, regsize);
- buf += 2 * regsize;
+ collect_register_as_string (regno, buf);
+ buf += 2 * register_size (regno);
*buf++ = ';';
return buf;
}
void
+new_thread_notify (int id)
+{
+ char own_buf[256];
+
+ /* The `n' response is not yet part of the remote protocol. Do nothing. */
+ if (1)
+ return;
+
+ if (server_waiting == 0)
+ return;
+
+ sprintf (own_buf, "n%x", id);
+ disable_async_io ();
+ putpkt (own_buf);
+ enable_async_io ();
+}
+
+void
+dead_thread_notify (int id)
+{
+ char own_buf[256];
+
+ /* The `x' response is not yet part of the remote protocol. Do nothing. */
+ if (1)
+ return;
+
+ sprintf (own_buf, "x%x", id);
+ disable_async_io ();
+ putpkt (own_buf);
+ enable_async_io ();
+}
+
+void
prepare_resume_reply (char *buf, char status, unsigned char signo)
{
int nib, sig;
@@ -538,12 +595,23 @@ prepare_resume_reply (char *buf, char status, unsigned char signo)
regp ++;
}
- /* If the debugger hasn't used any thread features, don't burden it with
- threads. If we didn't check this, GDB 4.13 and older would choke. */
- if (cont_thread != 0)
+ /* Formerly, if the debugger had not used any thread features we would not
+ burden it with a thread status response. This was for the benefit of
+ GDB 4.13 and older. However, in recent GDB versions the check
+ (``if (cont_thread != 0)'') does not have the desired effect because of
+ sillyness in the way that the remote protocol handles specifying a thread.
+ Since thread support relies on qSymbol support anyway, assume GDB can handle
+ threads. */
+
+ if (using_threads)
{
+ /* FIXME right place to set this? */
+ thread_from_wait = ((struct inferior_list_entry *)current_inferior)->id;
+ if (debug_threads)
+ fprintf (stderr, "Writing resume reply for %d\n\n", thread_from_wait);
if (old_thread_from_wait != thread_from_wait)
{
+ general_thread = thread_from_wait;
sprintf (buf, "thread:%x;", thread_from_wait);
buf += strlen (buf);
old_thread_from_wait = thread_from_wait;
@@ -620,7 +688,11 @@ look_up_one_symbol (const char *name, CORE_ADDR *addrp)
{
/* Malformed response. */
if (remote_debug)
- fprintf (stderr, "Malformed response to qSymbol, ignoring.\n");
+ {
+ fprintf (stderr, "Malformed response to qSymbol, ignoring.\n");
+ fflush (stderr);
+ }
+
return -1;
}
diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
index ba85b59d2c8..b674ed0070f 100644
--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -23,9 +23,12 @@
int cont_thread;
int general_thread;
+int step_thread;
int thread_from_wait;
int old_thread_from_wait;
int extended_protocol;
+int server_waiting;
+
jmp_buf toplevel;
static unsigned char
@@ -33,11 +36,12 @@ start_inferior (char *argv[], char *statusptr)
{
/* FIXME Check error? Or turn to void. */
create_inferior (argv[0], argv);
- /* FIXME Print pid properly. */
- fprintf (stderr, "Process %s created; pid = %d\n", argv[0], signal_pid);
+
+ fprintf (stderr, "Process %s created; pid = %d\n", argv[0],
+ all_threads.head->id);
/* Wait till we are at 1st instruction in program, return signal number. */
- return mywait (statusptr);
+ return mywait (statusptr, 0);
}
static int
@@ -48,7 +52,7 @@ attach_inferior (int pid, char *statusptr, unsigned char *sigptr)
if (myattach (pid) != 0)
return -1;
- *sigptr = mywait (statusptr);
+ *sigptr = mywait (statusptr, 0);
return 0;
}
@@ -59,6 +63,8 @@ extern int remote_debug;
void
handle_query (char *own_buf)
{
+ static struct inferior_list_entry *thread_ptr;
+
if (strcmp ("qSymbol::", own_buf) == 0)
{
if (the_target->look_up_symbols != NULL)
@@ -68,6 +74,29 @@ handle_query (char *own_buf)
return;
}
+ if (strcmp ("qfThreadInfo", own_buf) == 0)
+ {
+ thread_ptr = all_threads.head;
+ sprintf (own_buf, "m%x", thread_ptr->id);
+ thread_ptr = thread_ptr->next;
+ return;
+ }
+
+ if (strcmp ("qsThreadInfo", own_buf) == 0)
+ {
+ if (thread_ptr != NULL)
+ {
+ sprintf (own_buf, "m%x", thread_ptr->id);
+ thread_ptr = thread_ptr->next;
+ return;
+ }
+ else
+ {
+ sprintf (own_buf, "l");
+ return;
+ }
+ }
+
/* Otherwise we didn't know what packet it was. Say we didn't
understand it. */
own_buf[0] = 0;
@@ -75,6 +104,16 @@ handle_query (char *own_buf)
static int attached;
+static void
+gdbserver_usage (void)
+{
+ error ("Usage:\tgdbserver COMM PROG [ARGS ...]\n"
+ "\tgdbserver COMM --attach PID\n"
+ "\n"
+ "COMM may either be a tty device (for serial debugging), or \n"
+ "HOST:PORT to listen for a TCP connection.\n");
+}
+
int
main (int argc, char *argv[])
{
@@ -110,8 +149,7 @@ main (int argc, char *argv[])
}
if (argc < 3 || bad_attach)
- error ("Usage:\tgdbserver tty prog [args ...]\n"
- "\tgdbserver tty --attach pid");
+ gdbserver_usage();
initialize_low ();
@@ -179,12 +217,16 @@ main (int argc, char *argv[])
case 'g':
general_thread = strtol (&own_buf[2], NULL, 16);
write_ok (own_buf);
- fetch_inferior_registers (0);
+ set_desired_inferior (1);
break;
case 'c':
cont_thread = strtol (&own_buf[2], NULL, 16);
write_ok (own_buf);
break;
+ case 's':
+ step_thread = strtol (&own_buf[2], NULL, 16);
+ write_ok (own_buf);
+ break;
default:
/* Silently ignore it so that gdb can extend the protocol
without compatibility headaches. */
@@ -193,11 +235,12 @@ main (int argc, char *argv[])
}
break;
case 'g':
+ set_desired_inferior (1);
registers_to_string (own_buf);
break;
case 'G':
+ set_desired_inferior (1);
registers_from_string (&own_buf[1]);
- store_inferior_registers (-1);
write_ok (own_buf);
break;
case 'm':
@@ -218,8 +261,9 @@ main (int argc, char *argv[])
signal = target_signal_to_host (sig);
else
signal = 0;
+ set_desired_inferior (0);
myresume (0, signal);
- signal = mywait (&status);
+ signal = mywait (&status, 1);
prepare_resume_reply (own_buf, status, signal);
break;
case 'S':
@@ -228,18 +272,21 @@ main (int argc, char *argv[])
signal = target_signal_to_host (sig);
else
signal = 0;
+ set_desired_inferior (0);
myresume (1, signal);
- signal = mywait (&status);
+ signal = mywait (&status, 1);
prepare_resume_reply (own_buf, status, signal);
break;
case 'c':
+ set_desired_inferior (0);
myresume (0, 0);
- signal = mywait (&status);
+ signal = mywait (&status, 1);
prepare_resume_reply (own_buf, status, signal);
break;
case 's':
+ set_desired_inferior (0);
myresume (1, 0);
- signal = mywait (&status);
+ signal = mywait (&status, 1);
prepare_resume_reply (own_buf, status, signal);
break;
case 'k':
diff --git a/gdb/gdbserver/server.h b/gdb/gdbserver/server.h
index 32b90b5bcc7..746502b3d63 100644
--- a/gdb/gdbserver/server.h
+++ b/gdb/gdbserver/server.h
@@ -54,8 +54,21 @@
least the size of a (void *). */
typedef long long CORE_ADDR;
-/* Opaque inferior process information. */
-struct inferior_info;
+/* Generic information for tracking a list of ``inferiors'' - threads,
+ processes, etc. */
+struct inferior_list
+{
+ struct inferior_list_entry *head;
+ struct inferior_list_entry *tail;
+};
+struct inferior_list_entry
+{
+ int id;
+ struct inferior_list_entry *next;
+};
+
+/* Opaque type for user-visible threads. */
+struct thread_info;
#include "regcache.h"
#include "gdb/signals.h"
@@ -67,27 +80,41 @@ struct inferior_info;
void initialize_low ();
-/* Target-specific variables */
-
-extern char *registers;
-
/* From inferiors.c. */
-extern struct inferior_info *current_inferior;
-extern int signal_pid;
-void add_inferior (int pid);
+extern struct inferior_list all_threads;
+void add_inferior_to_list (struct inferior_list *list,
+ struct inferior_list_entry *new_inferior);
+void for_each_inferior (struct inferior_list *list,
+ void (*action) (struct inferior_list_entry *));
+extern struct thread_info *current_inferior;
+void remove_inferior (struct inferior_list *list,
+ struct inferior_list_entry *entry);
+void remove_thread (struct thread_info *thread);
+void add_thread (int thread_id, void *target_data);
void clear_inferiors (void);
-void *inferior_target_data (struct inferior_info *);
-void set_inferior_target_data (struct inferior_info *, void *);
-void *inferior_regcache_data (struct inferior_info *);
-void set_inferior_regcache_data (struct inferior_info *, void *);
+struct inferior_list_entry *find_inferior
+ (struct inferior_list *,
+ int (*func) (struct inferior_list_entry *,
+ void *),
+ void *arg);
+struct inferior_list_entry *find_inferior_id (struct inferior_list *list,
+ int id);
+void *inferior_target_data (struct thread_info *);
+void set_inferior_target_data (struct thread_info *, void *);
+void *inferior_regcache_data (struct thread_info *);
+void set_inferior_regcache_data (struct thread_info *, void *);
+void change_inferior_id (struct inferior_list *list,
+ int new_id);
/* Public variables in server.c */
extern int cont_thread;
extern int general_thread;
+extern int step_thread;
extern int thread_from_wait;
extern int old_thread_from_wait;
+extern int server_waiting;
extern jmp_buf toplevel;
@@ -103,6 +130,8 @@ void enable_async_io (void);
void disable_async_io (void);
void convert_ascii_to_int (char *from, char *to, int n);
void convert_int_to_ascii (char *from, char *to, int n);
+void new_thread_notify (int id);
+void dead_thread_notify (int id);
void prepare_resume_reply (char *buf, char status, unsigned char sig);
void decode_m_packet (char *from, CORE_ADDR * mem_addr_ptr,
diff --git a/gdb/gdbserver/target.c b/gdb/gdbserver/target.c
index 53a4c1ef55a..1c2860a11e9 100644
--- a/gdb/gdbserver/target.c
+++ b/gdb/gdbserver/target.c
@@ -26,6 +26,38 @@
struct target_ops *the_target;
void
+set_desired_inferior (int use_general)
+{
+ struct thread_info *found;
+
+ if (use_general == 1)
+ {
+ found = (struct thread_info *) find_inferior_id (&all_threads,
+ general_thread);
+ }
+ else
+ {
+ found = NULL;
+
+ /* If we are continuing any (all) thread(s), use step_thread
+ to decide which thread to step and/or send the specified
+ signal to. */
+ if (step_thread > 0 && (cont_thread == 0 || cont_thread == -1))
+ found = (struct thread_info *) find_inferior_id (&all_threads,
+ step_thread);
+
+ if (found == NULL)
+ found = (struct thread_info *) find_inferior_id (&all_threads,
+ cont_thread);
+ }
+
+ if (found == NULL)
+ current_inferior = (struct thread_info *) all_threads.head;
+ else
+ current_inferior = found;
+}
+
+void
read_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len)
{
(*the_target->read_memory) (memaddr, myaddr, len);
@@ -33,10 +65,41 @@ read_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len)
}
int
-write_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len)
+write_inferior_memory (CORE_ADDR memaddr, const char *myaddr, int len)
+{
+ /* Lacking cleanups, there is some potential for a memory leak if the
+ write fails and we go through error(). Make sure that no more than
+ one buffer is ever pending by making BUFFER static. */
+ static char *buffer = 0;
+ int res;
+
+ if (buffer != NULL)
+ free (buffer);
+
+ buffer = malloc (len);
+ memcpy (buffer, myaddr, len);
+ check_mem_write (memaddr, buffer, len);
+ res = (*the_target->write_memory) (memaddr, buffer, len);
+ free (buffer);
+ buffer = NULL;
+
+ return res;
+}
+
+unsigned char
+mywait (char *statusp, int connected_wait)
{
- check_mem_write (memaddr, myaddr, len);
- return (*the_target->write_memory) (memaddr, myaddr, len);
+ unsigned char ret;
+
+ if (connected_wait)
+ server_waiting = 1;
+
+ ret = (*the_target->wait) (statusp);
+
+ if (connected_wait)
+ server_waiting = 0;
+
+ return ret;
}
void
diff --git a/gdb/gdbserver/target.h b/gdb/gdbserver/target.h
index 6d06b9fd4ab..c6aeee6f562 100644
--- a/gdb/gdbserver/target.h
+++ b/gdb/gdbserver/target.h
@@ -104,6 +104,11 @@ struct target_ops
symbols. */
void (*look_up_symbols) (void);
+
+ /* Return the PID we should send a signal to. Used for asynchronous
+ interrupts (user hitting Control-C). */
+
+ int (*signal_pid) (void);
};
extern struct target_ops *the_target;
@@ -125,17 +130,18 @@ void set_target_ops (struct target_ops *);
#define myresume(step,signo) \
(*the_target->resume) (step, signo)
-#define mywait(statusp) \
- (*the_target->wait) (statusp)
-
#define fetch_inferior_registers(regno) \
(*the_target->fetch_registers) (regno)
#define store_inferior_registers(regno) \
(*the_target->store_registers) (regno)
+unsigned char mywait (char *statusp, int connected_wait);
+
void read_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len);
-int write_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len);
+int write_inferior_memory (CORE_ADDR memaddr, const char *myaddr, int len);
+
+void set_desired_inferior (int id);
#endif /* TARGET_H */
diff --git a/gdb/gdbserver/thread-db.c b/gdb/gdbserver/thread-db.c
new file mode 100644
index 00000000000..f3d57a54d62
--- /dev/null
+++ b/gdb/gdbserver/thread-db.c
@@ -0,0 +1,342 @@
+/* Thread management interface, for the remote server for GDB.
+ Copyright 2002
+ Free Software Foundation, Inc.
+
+ Contributed by MontaVista Software.
+
+ 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 "server.h"
+
+#include "linux-low.h"
+
+extern int debug_threads;
+
+#ifdef HAVE_THREAD_DB_H
+#include <thread_db.h>
+#endif
+
+/* Correct for all GNU/Linux targets (for quite some time). */
+#define GDB_GREGSET_T elf_gregset_t
+#define GDB_FPREGSET_T elf_fpregset_t
+
+#ifndef HAVE_ELF_FPREGSET_T
+/* Make sure we have said types. Not all platforms bring in <linux/elf.h>
+ via <sys/procfs.h>. */
+#ifdef HAVE_LINUX_ELF_H
+#include <linux/elf.h>
+#endif
+#endif
+
+#include "../gdb_proc_service.h"
+
+/* Structure that identifies the child process for the
+ <proc_service.h> interface. */
+static struct ps_prochandle proc_handle;
+
+/* Connection to the libthread_db library. */
+static td_thragent_t *thread_agent;
+
+static int find_new_threads_callback (const td_thrhandle_t *th_p, void *data);
+
+static char *
+thread_db_err_str (td_err_e err)
+{
+ static char buf[64];
+
+ switch (err)
+ {
+ case TD_OK:
+ return "generic 'call succeeded'";
+ case TD_ERR:
+ return "generic error";
+ case TD_NOTHR:
+ return "no thread to satisfy query";
+ case TD_NOSV:
+ return "no sync handle to satisfy query";
+ case TD_NOLWP:
+ return "no LWP to satisfy query";
+ case TD_BADPH:
+ return "invalid process handle";
+ case TD_BADTH:
+ return "invalid thread handle";
+ case TD_BADSH:
+ return "invalid synchronization handle";
+ case TD_BADTA:
+ return "invalid thread agent";
+ case TD_BADKEY:
+ return "invalid key";
+ case TD_NOMSG:
+ return "no event message for getmsg";
+ case TD_NOFPREGS:
+ return "FPU register set not available";
+ case TD_NOLIBTHREAD:
+ return "application not linked with libthread";
+ case TD_NOEVENT:
+ return "requested event is not supported";
+ case TD_NOCAPAB:
+ return "capability not available";
+ case TD_DBERR:
+ return "debugger service failed";
+ case TD_NOAPLIC:
+ return "operation not applicable to";
+ case TD_NOTSD:
+ return "no thread-specific data for this thread";
+ case TD_MALLOC:
+ return "malloc failed";
+ case TD_PARTIALREG:
+ return "only part of register set was written/read";
+ case TD_NOXREGS:
+ return "X register set not available for this thread";
+ default:
+ snprintf (buf, sizeof (buf), "unknown thread_db error '%d'", err);
+ return buf;
+ }
+}
+
+#if 0
+static char *
+thread_db_state_str (td_thr_state_e state)
+{
+ static char buf[64];
+
+ switch (state)
+ {
+ case TD_THR_STOPPED:
+ return "stopped by debugger";
+ case TD_THR_RUN:
+ return "runnable";
+ case TD_THR_ACTIVE:
+ return "active";
+ case TD_THR_ZOMBIE:
+ return "zombie";
+ case TD_THR_SLEEP:
+ return "sleeping";
+ case TD_THR_STOPPED_ASLEEP:
+ return "stopped by debugger AND blocked";
+ default:
+ snprintf (buf, sizeof (buf), "unknown thread_db state %d", state);
+ return buf;
+ }
+}
+#endif
+
+static void
+thread_db_create_event (CORE_ADDR where)
+{
+ td_event_msg_t msg;
+ td_err_e err;
+ struct inferior_linux_data *tdata;
+
+ if (debug_threads)
+ fprintf (stderr, "Thread creation event.\n");
+
+ tdata = inferior_target_data (current_inferior);
+
+ /* FIXME: This assumes we don't get another event.
+ In the LinuxThreads implementation, this is safe,
+ because all events come from the manager thread
+ (except for its own creation, of course). */
+ err = td_ta_event_getmsg (thread_agent, &msg);
+ if (err != TD_OK)
+ fprintf (stderr, "thread getmsg err: %s\n",
+ thread_db_err_str (err));
+
+ /* msg.event == TD_EVENT_CREATE */
+
+ find_new_threads_callback (msg.th_p, NULL);
+}
+
+#if 0
+static void
+thread_db_death_event (CORE_ADDR where)
+{
+ if (debug_threads)
+ fprintf (stderr, "Thread death event.\n");
+}
+#endif
+
+static int
+thread_db_enable_reporting ()
+{
+ td_thr_events_t events;
+ td_notify_t notify;
+ td_err_e err;
+
+ /* Set the process wide mask saying which events we're interested in. */
+ td_event_emptyset (&events);
+ td_event_addset (&events, TD_CREATE);
+
+#if 0
+ /* This is reported to be broken in glibc 2.1.3. A different approach
+ will be necessary to support that. */
+ td_event_addset (&events, TD_DEATH);
+#endif
+
+ err = td_ta_set_event (thread_agent, &events);
+ if (err != TD_OK)
+ {
+ warning ("Unable to set global thread event mask: %s",
+ thread_db_err_str (err));
+ return 0;
+ }
+
+ /* Get address for thread creation breakpoint. */
+ err = td_ta_event_addr (thread_agent, TD_CREATE, &notify);
+ if (err != TD_OK)
+ {
+ warning ("Unable to get location for thread creation breakpoint: %s",
+ thread_db_err_str (err));
+ return 0;
+ }
+ set_breakpoint_at ((CORE_ADDR) (unsigned long) notify.u.bptaddr,
+ thread_db_create_event);
+
+#if 0
+ /* Don't concern ourselves with reported thread deaths, only
+ with actual thread deaths (via wait). */
+
+ /* Get address for thread death breakpoint. */
+ err = td_ta_event_addr (thread_agent, TD_DEATH, &notify);
+ if (err != TD_OK)
+ {
+ warning ("Unable to get location for thread death breakpoint: %s",
+ thread_db_err_str (err));
+ return;
+ }
+ set_breakpoint_at ((CORE_ADDR) (unsigned long) notify.u.bptaddr,
+ thread_db_death_event);
+#endif
+
+ return 1;
+}
+
+static void
+maybe_attach_thread (const td_thrhandle_t *th_p, td_thrinfo_t *ti_p)
+{
+ td_err_e err;
+ struct thread_info *inferior;
+ struct process_info *process;
+
+ /* If we are attaching to our first thread, things are a little
+ different. */
+ if (all_threads.head == all_threads.tail)
+ {
+ inferior = (struct thread_info *) all_threads.head;
+ process = get_thread_process (inferior);
+ if (process->thread_known == 0)
+ {
+ /* Switch to indexing the threads list by TID. */
+ change_inferior_id (&all_threads, ti_p->ti_tid);
+ goto found;
+ }
+ }
+
+ inferior = (struct thread_info *) find_inferior_id (&all_threads,
+ ti_p->ti_tid);
+ if (inferior != NULL)
+ return;
+
+ if (debug_threads)
+ fprintf (stderr, "Attaching to thread %ld (LWP %d)\n",
+ ti_p->ti_tid, ti_p->ti_lid);
+ linux_attach_lwp (ti_p->ti_lid, ti_p->ti_tid);
+ inferior = (struct thread_info *) find_inferior_id (&all_threads,
+ ti_p->ti_tid);
+ if (inferior == NULL)
+ {
+ warning ("Could not attach to thread %ld (LWP %d)\n",
+ ti_p->ti_tid, ti_p->ti_lid);
+ return;
+ }
+
+ process = inferior_target_data (inferior);
+
+found:
+ new_thread_notify (ti_p->ti_tid);
+
+ process->tid = ti_p->ti_tid;
+ process->lwpid = ti_p->ti_lid;
+
+ process->thread_known = 1;
+ err = td_thr_event_enable (th_p, 1);
+ if (err != TD_OK)
+ error ("Cannot enable thread event reporting for %d: %s",
+ ti_p->ti_lid, thread_db_err_str (err));
+}
+
+static int
+find_new_threads_callback (const td_thrhandle_t *th_p, void *data)
+{
+ td_thrinfo_t ti;
+ td_err_e err;
+
+ err = td_thr_get_info (th_p, &ti);
+ if (err != TD_OK)
+ error ("Cannot get thread info: %s", thread_db_err_str (err));
+
+ /* Check for zombies. */
+ if (ti.ti_state == TD_THR_UNKNOWN || ti.ti_state == TD_THR_ZOMBIE)
+ return 0;
+
+ maybe_attach_thread (th_p, &ti);
+
+ return 0;
+}
+
+static void
+thread_db_find_new_threads (void)
+{
+ td_err_e err;
+
+ /* Iterate over all user-space threads to discover new threads. */
+ err = td_ta_thr_iter (thread_agent, find_new_threads_callback, NULL,
+ TD_THR_ANY_STATE, TD_THR_LOWEST_PRIORITY,
+ TD_SIGNO_MASK, TD_THR_ANY_USER_FLAGS);
+ if (err != TD_OK)
+ error ("Cannot find new threads: %s", thread_db_err_str (err));
+}
+
+int
+thread_db_init ()
+{
+ int err;
+
+ proc_handle.pid = ((struct inferior_list_entry *)current_inferior)->id;
+
+ err = td_ta_new (&proc_handle, &thread_agent);
+ switch (err)
+ {
+ case TD_NOLIBTHREAD:
+ /* No thread library was detected. */
+ return 0;
+
+ case TD_OK:
+ /* The thread library was detected. */
+
+ if (thread_db_enable_reporting () == 0)
+ return 0;
+ thread_db_find_new_threads ();
+ return 1;
+
+ default:
+ warning ("error initializing thread_db library.");
+ }
+
+ return 0;
+}
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index e8ba96d1038..562481cb066 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -73,7 +73,9 @@ struct type *builtin_type_uint128;
struct type *builtin_type_bool;
/* 128 bit long vector types */
+struct type *builtin_type_v2_double;
struct type *builtin_type_v4_float;
+struct type *builtin_type_v2_int64;
struct type *builtin_type_v4_int32;
struct type *builtin_type_v8_int16;
struct type *builtin_type_v16_int8;
@@ -91,6 +93,7 @@ struct type *builtin_type_v8hi;
struct type *builtin_type_v4hi;
struct type *builtin_type_v2si;
struct type *builtin_type_vec128;
+struct type *builtin_type_vec128i;
struct type *builtin_type_ieee_single_big;
struct type *builtin_type_ieee_single_little;
struct type *builtin_type_ieee_double_big;
@@ -127,7 +130,7 @@ static void add_mangled_type (struct extra *, struct type *);
static void cfront_mangle_name (struct type *, int, int);
#endif
static void print_bit_vector (B_TYPE *, int);
-static void print_arg_types (struct type **, int);
+static void print_arg_types (struct field *, int, int);
static void dump_fn_fieldlists (struct type *, int);
static void print_cplus_stuff (struct type *, int);
static void virtual_base_list_aux (struct type *dclass);
@@ -576,7 +579,6 @@ allocate_stub_method (struct type *type)
TYPE_OBJFILE (type));
TYPE_TARGET_TYPE (mtype) = type;
/* _DOMAIN_TYPE (mtype) = unknown yet */
- /* _ARG_TYPES (mtype) = unknown yet */
return (mtype);
}
@@ -844,6 +846,24 @@ build_builtin_type_vec128 (void)
return t;
}
+static struct type *
+build_builtin_type_vec128i (void)
+{
+ /* 128-bit Intel SIMD registers */
+ struct type *t;
+
+ t = init_composite_type ("__gdb_builtin_type_vec128i", TYPE_CODE_UNION);
+ append_composite_type_field (t, "v4_float", builtin_type_v4_float);
+ append_composite_type_field (t, "v2_double", builtin_type_v2_double);
+ append_composite_type_field (t, "v16_int8", builtin_type_v16_int8);
+ append_composite_type_field (t, "v8_int16", builtin_type_v8_int16);
+ append_composite_type_field (t, "v4_int32", builtin_type_v4_int32);
+ append_composite_type_field (t, "v2_int64", builtin_type_v2_int64);
+ append_composite_type_field (t, "uint128", builtin_type_int128);
+
+ return t;
+}
+
/* Smash TYPE to be a type of members of DOMAIN with type TO_TYPE.
A MEMBER is a wierd thing -- it amounts to a typed offset into
a struct, e.g. "an int at offset 8". A MEMBER TYPE doesn't
@@ -879,7 +899,8 @@ smash_to_member_type (struct type *type, struct type *domain,
void
smash_to_method_type (struct type *type, struct type *domain,
- struct type *to_type, struct type **args)
+ struct type *to_type, struct field *args,
+ int nargs, int varargs)
{
struct objfile *objfile;
@@ -889,7 +910,10 @@ smash_to_method_type (struct type *type, struct type *domain,
TYPE_OBJFILE (type) = objfile;
TYPE_TARGET_TYPE (type) = to_type;
TYPE_DOMAIN_TYPE (type) = domain;
- TYPE_ARG_TYPES (type) = args;
+ TYPE_FIELDS (type) = args;
+ TYPE_NFIELDS (type) = nargs;
+ if (varargs)
+ TYPE_FLAGS (type) |= TYPE_FLAG_VARARGS;
TYPE_LENGTH (type) = 1; /* In practice, this is never needed. */
TYPE_CODE (type) = TYPE_CODE_METHOD;
}
@@ -1593,7 +1617,7 @@ check_stub_method (struct type *type, int method_id, int signature_id)
DMGL_PARAMS | DMGL_ANSI);
char *argtypetext, *p;
int depth = 0, argcount = 1;
- struct type **argtypes;
+ struct field *argtypes;
struct type *mtype;
/* Make sure we got back a function string that we can use. */
@@ -1626,11 +1650,14 @@ check_stub_method (struct type *type, int method_id, int signature_id)
p += 1;
}
- /* We need two more slots: one for the THIS pointer, and one for the
- NULL [...] or void [end of arglist]. */
+ /* If we read one argument and it was ``void'', don't count it. */
+ if (strncmp (argtypetext, "(void)", 6) == 0)
+ argcount -= 1;
+
+ /* We need one extra slot, for the THIS pointer. */
- argtypes = (struct type **)
- TYPE_ALLOC (type, (argcount + 2) * sizeof (struct type *));
+ argtypes = (struct field *)
+ TYPE_ALLOC (type, (argcount + 1) * sizeof (struct field));
p = argtypetext;
/* Add THIS pointer for non-static methods. */
@@ -1639,7 +1666,7 @@ check_stub_method (struct type *type, int method_id, int signature_id)
argcount = 0;
else
{
- argtypes[0] = lookup_pointer_type (type);
+ argtypes[0].type = lookup_pointer_type (type);
argcount = 1;
}
@@ -1650,10 +1677,12 @@ check_stub_method (struct type *type, int method_id, int signature_id)
{
if (depth <= 0 && (*p == ',' || *p == ')'))
{
- /* Avoid parsing of ellipsis, they will be handled below. */
- if (strncmp (argtypetext, "...", p - argtypetext) != 0)
+ /* Avoid parsing of ellipsis, they will be handled below.
+ Also avoid ``void'' as above. */
+ if (strncmp (argtypetext, "...", p - argtypetext) != 0
+ && strncmp (argtypetext, "void", p - argtypetext) != 0)
{
- argtypes[argcount] =
+ argtypes[argcount].type =
safe_parse_type (argtypetext, p - argtypetext);
argcount += 1;
}
@@ -1673,25 +1702,19 @@ check_stub_method (struct type *type, int method_id, int signature_id)
}
}
- if (p[-2] != '.') /* Not '...' */
- {
- argtypes[argcount] = builtin_type_void; /* List terminator */
- }
- else
- {
- argtypes[argcount] = NULL; /* Ellist terminator */
- }
-
- xfree (demangled_name);
-
TYPE_FN_FIELD_PHYSNAME (f, signature_id) = mangled_name;
/* Now update the old "stub" type into a real type. */
mtype = TYPE_FN_FIELD_TYPE (f, signature_id);
TYPE_DOMAIN_TYPE (mtype) = type;
- TYPE_ARG_TYPES (mtype) = argtypes;
+ TYPE_FIELDS (mtype) = argtypes;
+ TYPE_NFIELDS (mtype) = argcount;
TYPE_FLAGS (mtype) &= ~TYPE_FLAG_STUB;
TYPE_FN_FIELD_STUB (f, signature_id) = 0;
+ if (p[-2] == '.')
+ TYPE_FLAGS (mtype) |= TYPE_FLAG_VARARGS;
+
+ xfree (demangled_name);
}
const struct cplus_struct_type cplus_struct_default;
@@ -2682,25 +2705,18 @@ print_bit_vector (B_TYPE *bits, int nbits)
}
}
-/* The args list is a strange beast. It is either terminated by a NULL
- pointer for varargs functions, or by a pointer to a TYPE_CODE_VOID
- type for normal fixed argcount functions. (FIXME someday)
- Also note the first arg should be the "this" pointer, we may not want to
- include it since we may get into a infinitely recursive situation. */
+/* Note the first arg should be the "this" pointer, we may not want to
+ include it since we may get into a infinitely recursive situation. */
static void
-print_arg_types (struct type **args, int spaces)
+print_arg_types (struct field *args, int nargs, int spaces)
{
if (args != NULL)
{
- while (*args != NULL)
- {
- recursive_dump_type (*args, spaces + 2);
- if (TYPE_CODE (*args++) == TYPE_CODE_VOID)
- {
- break;
- }
- }
+ int i;
+
+ for (i = 0; i < nargs; i++)
+ recursive_dump_type (args[i].type, spaces + 2);
}
}
@@ -2745,7 +2761,9 @@ dump_fn_fieldlists (struct type *type, int spaces)
gdb_print_host_address (TYPE_FN_FIELD_ARGS (f, overload_idx), gdb_stdout);
printf_filtered ("\n");
- print_arg_types (TYPE_FN_FIELD_ARGS (f, overload_idx), spaces);
+ print_arg_types (TYPE_FN_FIELD_ARGS (f, overload_idx),
+ TYPE_NFIELDS (TYPE_FN_FIELD_TYPE (f, overload_idx)),
+ spaces);
printfi_filtered (spaces + 8, "fcontext ");
gdb_print_host_address (TYPE_FN_FIELD_FCONTEXT (f, overload_idx),
gdb_stdout);
@@ -3087,14 +3105,6 @@ recursive_dump_type (struct type *type, int spaces)
printfi_filtered (spaces, "vptr_fieldno %d\n", TYPE_VPTR_FIELDNO (type));
switch (TYPE_CODE (type))
{
- case TYPE_CODE_METHOD:
- case TYPE_CODE_FUNC:
- printfi_filtered (spaces, "arg_types ");
- gdb_print_host_address (TYPE_ARG_TYPES (type), gdb_stdout);
- puts_filtered ("\n");
- print_arg_types (TYPE_ARG_TYPES (type), spaces);
- break;
-
case TYPE_CODE_STRUCT:
printfi_filtered (spaces, "cplus_stuff ");
gdb_print_host_address (TYPE_CPLUS_SPECIFIC (type), gdb_stdout);
@@ -3300,7 +3310,9 @@ build_gdbtypes (void)
= init_simd_type ("__builtin_v2si", builtin_type_int32, "f", 2);
/* 128 bit vectors. */
+ builtin_type_v2_double = init_vector_type (builtin_type_double, 2);
builtin_type_v4_float = init_vector_type (builtin_type_float, 4);
+ builtin_type_v2_int64 = init_vector_type (builtin_type_int64, 2);
builtin_type_v4_int32 = init_vector_type (builtin_type_int32, 4);
builtin_type_v8_int16 = init_vector_type (builtin_type_int16, 8);
builtin_type_v16_int8 = init_vector_type (builtin_type_int8, 16);
@@ -3312,6 +3324,7 @@ build_gdbtypes (void)
/* Vector types. */
builtin_type_vec128 = build_builtin_type_vec128 ();
+ builtin_type_vec128i = build_builtin_type_vec128i ();
/* Pointer/Address types. */
@@ -3400,7 +3413,9 @@ _initialize_gdbtypes (void)
register_gdbarch_swap (&builtin_type_v8hi, sizeof (struct type *), NULL);
register_gdbarch_swap (&builtin_type_v4hi, sizeof (struct type *), NULL);
register_gdbarch_swap (&builtin_type_v2si, sizeof (struct type *), NULL);
+ register_gdbarch_swap (&builtin_type_v2_double, sizeof (struct type *), NULL);
register_gdbarch_swap (&builtin_type_v4_float, sizeof (struct type *), NULL);
+ register_gdbarch_swap (&builtin_type_v2_int64, sizeof (struct type *), NULL);
register_gdbarch_swap (&builtin_type_v4_int32, sizeof (struct type *), NULL);
register_gdbarch_swap (&builtin_type_v8_int16, sizeof (struct type *), NULL);
register_gdbarch_swap (&builtin_type_v16_int8, sizeof (struct type *), NULL);
@@ -3409,6 +3424,7 @@ _initialize_gdbtypes (void)
register_gdbarch_swap (&builtin_type_v8_int8, sizeof (struct type *), NULL);
register_gdbarch_swap (&builtin_type_v4_int16, sizeof (struct type *), NULL);
register_gdbarch_swap (&builtin_type_vec128, sizeof (struct type *), NULL);
+ register_gdbarch_swap (&builtin_type_vec128i, sizeof (struct type *), NULL);
REGISTER_GDBARCH_SWAP (builtin_type_void_data_ptr);
REGISTER_GDBARCH_SWAP (builtin_type_void_func_ptr);
REGISTER_GDBARCH_SWAP (builtin_type_CORE_ADDR);
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index 87b529e67ea..8221bcec37a 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -240,10 +240,8 @@ enum type_code
#define TYPE_FLAG_DATA_SPACE (1 << 10)
#define TYPE_DATA_SPACE(t) (TYPE_INSTANCE_FLAGS (t) & TYPE_FLAG_DATA_SPACE)
-/* FIXME: Kludge to mark a varargs function type for C++ member
- function argument processing. Currently only used in dwarf2read.c,
- but put it here so we won't accidentally overload the bit with
- another flag. */
+/* FIXME drow/2002-06-03: Only used for methods, but applies as well
+ to functions. */
#define TYPE_FLAG_VARARGS (1 << 11)
#define TYPE_VARARGS(t) (TYPE_FLAGS (t) & TYPE_FLAG_VARARGS)
@@ -354,7 +352,7 @@ struct main_type
For range types, there are two "fields",
the minimum and maximum values (both inclusive).
For enum types, each possible value is described by one "field".
- For a function type, a "field" for each parameter type.
+ For a function or method type, a "field" for each parameter.
For C++ classes, there is one field for each base class (if it is
a derived class) plus one field for each class data member. Member
functions are recorded elsewhere.
@@ -383,7 +381,7 @@ struct main_type
CORE_ADDR physaddr;
char *physname;
- /* For a function type, this is 1 if the argument is marked
+ /* For a function or member type, this is 1 if the argument is marked
artificial. Artificial arguments should not be shown to the
user. */
int artificial;
@@ -400,13 +398,14 @@ struct main_type
int bitsize;
/* In a struct or union type, type of this field.
- In a function type, type of this argument.
+ In a function or member type, type of this argument.
In an array type, the domain-type of the array. */
struct type *type;
/* Name of field, value or argument.
- NULL for range bounds and array domains. */
+ NULL for range bounds, array domains, and member function
+ arguments. */
char *name;
@@ -438,14 +437,6 @@ struct main_type
union type_specific
{
- /* ARG_TYPES is for TYPE_CODE_METHOD.
- Contains the type of each argument, ending with a void type
- after the last argument for normal member functions or a NULL
- pointer after the last argument for functions with variable
- arguments. */
-
- struct type **arg_types;
-
/* CPLUS_STUFF is for TYPE_CODE_STRUCT. It is initialized to point to
cplus_struct_default, a default static instance of a struct
cplus_struct_type. */
@@ -604,13 +595,6 @@ struct cplus_struct_type
struct type *type;
- /* The argument list. Only valid if is_stub is clear. Contains
- the type of each argument, including `this', and ending with
- a NULL pointer after the last argument. Should not contain
- a `this' pointer for static member functions. */
-
- struct type **args;
-
/* For virtual functions.
First baseclass that defines this virtual function. */
@@ -792,7 +776,6 @@ extern void allocate_cplus_struct_type (struct type *);
#define TYPE_NINSTANTIATIONS(thistype) TYPE_CPLUS_SPECIFIC(thistype)->ninstantiations
#define TYPE_DECLARED_TYPE(thistype) TYPE_CPLUS_SPECIFIC(thistype)->declared_type
#define TYPE_TYPE_SPECIFIC(thistype) TYPE_MAIN_TYPE(thistype)->type_specific
-#define TYPE_ARG_TYPES(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.arg_types
#define TYPE_CPLUS_SPECIFIC(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.cplus_stuff
#define TYPE_FLOATFORMAT(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.floatformat
#define TYPE_BASECLASS(thistype,index) TYPE_MAIN_TYPE(thistype)->fields[index].type
@@ -870,7 +853,7 @@ extern void allocate_cplus_struct_type (struct type *);
#define TYPE_FN_FIELD(thisfn, n) (thisfn)[n]
#define TYPE_FN_FIELD_PHYSNAME(thisfn, n) (thisfn)[n].physname
#define TYPE_FN_FIELD_TYPE(thisfn, n) (thisfn)[n].type
-#define TYPE_FN_FIELD_ARGS(thisfn, n) TYPE_ARG_TYPES ((thisfn)[n].type)
+#define TYPE_FN_FIELD_ARGS(thisfn, n) TYPE_FIELDS ((thisfn)[n].type)
#define TYPE_FN_FIELD_CONST(thisfn, n) ((thisfn)[n].is_const)
#define TYPE_FN_FIELD_VOLATILE(thisfn, n) ((thisfn)[n].is_volatile)
#define TYPE_FN_FIELD_PRIVATE(thisfn, n) ((thisfn)[n].is_private)
@@ -970,6 +953,7 @@ extern struct type *builtin_type_v2si;
/* Type for 128 bit vectors. */
extern struct type *builtin_type_vec128;
+extern struct type *builtin_type_vec128i;
/* Explicit floating-point formats. See "floatformat.h". */
extern struct type *builtin_type_ieee_single_big;
@@ -1094,8 +1078,9 @@ extern struct type *make_type_with_address_space (struct type *type,
extern struct type *lookup_member_type (struct type *, struct type *);
extern void
-smash_to_method_type (struct type *, struct type *, struct type *,
- struct type **);
+smash_to_method_type (struct type *type, struct type *domain,
+ struct type *to_type, struct field *args,
+ int nargs, int varargs);
extern void
smash_to_member_type (struct type *, struct type *, struct type *);
diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c
index 93b9bbb78c1..b12897fda9d 100644
--- a/gdb/h8300-tdep.c
+++ b/gdb/h8300-tdep.c
@@ -39,8 +39,8 @@
extern int h8300hmode, h8300smode;
-#undef NUM_REGS
-#define NUM_REGS 11
+#undef NUM_REGS
+#define NUM_REGS (h8300smode?12:11)
#define UNSIGNED_SHORT(X) ((X) & 0xffff)
@@ -54,19 +54,18 @@ extern int h8300hmode, h8300smode;
#define IS_MOVK_R5(x) (x==0x7905)
#define IS_SUB_R5SP(x) (x==0x1957)
-
/* The register names change depending on whether the h8300h processor
type is selected. */
static char *original_register_names[] = REGISTER_NAMES;
-static char *h8300h_register_names[] =
-{"er0", "er1", "er2", "er3", "er4", "er5", "er6",
- "sp", "ccr", "pc", "cycles", "tick", "inst"};
+static char *h8300h_register_names[] = {
+ "er0", "er1", "er2", "er3", "er4", "er5", "er6",
+ "sp", "ccr", "pc", "cycles", "exr", "tick", "inst"
+};
char **h8300_register_names = original_register_names;
-
/* Local function declarations. */
static CORE_ADDR examine_prologue ();
@@ -766,7 +765,6 @@ h8300s_command (char *args, int from_tty)
set_register_names ();
}
-
static void
set_machine (char *args, int from_tty)
{
@@ -824,22 +822,22 @@ _initialize_h8300m (void)
specify_exec_file_hook (set_machine_hook);
}
-
-
void
h8300_print_register_hook (int regno)
{
- if (regno == 8)
+ if (regno == CCR_REGNUM)
{
/* CCR register */
int C, Z, N, V;
- unsigned char b[4];
+ unsigned char b[REGISTER_SIZE];
unsigned char l;
frame_register_read (selected_frame, regno, b);
- l = b[REGISTER_VIRTUAL_SIZE (8) - 1];
+ l = b[REGISTER_VIRTUAL_SIZE (CCR_REGNUM) - 1];
printf_unfiltered ("\t");
- printf_unfiltered ("I-%d - ", (l & 0x80) != 0);
- printf_unfiltered ("H-%d - ", (l & 0x20) != 0);
+ printf_unfiltered ("I-%d ", (l & 0x80) != 0);
+ printf_unfiltered ("UI-%d ", (l & 0x40) != 0);
+ printf_unfiltered ("H-%d ", (l & 0x20) != 0);
+ printf_unfiltered ("U-%d ", (l & 0x10) != 0);
N = (l & 0x8) != 0;
Z = (l & 0x4) != 0;
V = (l & 0x2) != 0;
@@ -869,6 +867,20 @@ h8300_print_register_hook (int regno)
if ((Z | (N ^ V)) == 1)
printf_unfiltered ("<= ");
}
+
+ if (regno == EXR_REGNUM && h8300smode)
+ {
+ /* EXR register */
+ unsigned char b[REGISTER_SIZE];
+ unsigned char l;
+ frame_register_read (selected_frame, regno, b);
+ l = b[REGISTER_VIRTUAL_SIZE (EXR_REGNUM) - 1];
+ printf_unfiltered ("\t");
+ printf_unfiltered ("T-%d - - - ", (l & 0x80) != 0);
+ printf_unfiltered ("I2-%d ", (l & 4) != 0);
+ printf_unfiltered ("I1-%d ", (l & 2) != 0);
+ printf_unfiltered ("I0-%d", (l & 1) != 0);
+ }
}
void
diff --git a/gdb/hpread.c b/gdb/hpread.c
index 45a00a6c417..6443eacac9f 100644
--- a/gdb/hpread.c
+++ b/gdb/hpread.c
@@ -3959,38 +3959,10 @@ hpread_read_struct_type (dnttpointer hp_type, union dnttentry *dn_bufp,
/* But mark it as NULL if the method was incompletely processed
We'll fix this up later when the method is fully processed */
if (TYPE_INCOMPLETE (memtype))
- {
- fn_p->field.fn_fields[ix].type = NULL;
- fn_p->field.fn_fields[ix].args = NULL;
- }
+ fn_p->field.fn_fields[ix].type = NULL;
else
- {
- fn_p->field.fn_fields[ix].type = memtype;
-
- /* The argument list */
- TYPE_TYPE_SPECIFIC (fn_p->field.fn_fields[ix].type).arg_types
- = (struct type **) obstack_alloc (&objfile->type_obstack,
- (sizeof (struct type *)
- * (TYPE_NFIELDS (memtype)
- + 1)));
- for (i = 0; i < TYPE_NFIELDS (memtype); i++)
- TYPE_TYPE_SPECIFIC (fn_p->field.fn_fields[ix].type)
- .arg_types[i] = TYPE_FIELDS (memtype)[i].type;
- /* void termination */
- TYPE_TYPE_SPECIFIC (fn_p->field.fn_fields[ix].type)
- .arg_types[TYPE_NFIELDS (memtype)] = builtin_type_void;
-
- /* pai: It's not clear why this args field has to be set. Perhaps
- * it should be eliminated entirely. */
- fn_p->field.fn_fields[ix].args =
- (struct type **) obstack_alloc (&objfile->type_obstack,
- sizeof (struct type *) * (TYPE_NFIELDS (memtype) + 1));
- for (i = 0; i < TYPE_NFIELDS (memtype); i++)
- fn_p->field.fn_fields[ix].args[i]
- = TYPE_FIELDS (memtype)[i].type;
- /* null-terminated, unlike arg_types above e */
- fn_p->field.fn_fields[ix].args[TYPE_NFIELDS (memtype)] = NULL;
- }
+ fn_p->field.fn_fields[ix].type = memtype;
+
/* For virtual functions, fill in the voffset field with the
* virtual table offset. (This is just copied over from the
* SOM record; not sure if it is what GDB expects here...).
@@ -4466,24 +4438,6 @@ fixup_class_method_type (struct type *class, struct type *method,
{
/* Set the method type */
TYPE_FN_FIELD_TYPE (TYPE_FN_FIELDLIST1 (class, i), j) = method;
- /* The argument list */
- TYPE_TYPE_SPECIFIC (TYPE_FN_FIELD_TYPE (TYPE_FN_FIELDLIST1 (class, i), j)).arg_types
- = (struct type **) obstack_alloc (&objfile->type_obstack,
- sizeof (struct type *) * (TYPE_NFIELDS (method) + 1));
- for (k = 0; k < TYPE_NFIELDS (method); k++)
- TYPE_TYPE_SPECIFIC (TYPE_FN_FIELD_TYPE (TYPE_FN_FIELDLIST1 (class, i), j)).arg_types[k] = TYPE_FIELDS (method)[k].type;
- /* void termination */
- TYPE_TYPE_SPECIFIC (TYPE_FN_FIELD_TYPE (TYPE_FN_FIELDLIST1 (class, i), j)).arg_types[TYPE_NFIELDS (method)] = builtin_type_void;
-
- /* pai: It's not clear why this args field has to be set. Perhaps
- * it should be eliminated entirely. */
- (TYPE_FN_FIELD (TYPE_FN_FIELDLIST1 (class, i), j)).args
- = (struct type **) obstack_alloc (&objfile->type_obstack,
- sizeof (struct type *) * (TYPE_NFIELDS (method) + 1));
- for (k = 0; k < TYPE_NFIELDS (method); k++)
- (TYPE_FN_FIELD (TYPE_FN_FIELDLIST1 (class, i), j)).args[k] = TYPE_FIELDS (method)[k].type;
- /* null-terminated, unlike arg_types above */
- (TYPE_FN_FIELD (TYPE_FN_FIELDLIST1 (class, i), j)).args[TYPE_NFIELDS (method)] = NULL;
/* Break out of both loops -- only one method to fix up in a class */
goto finish;
@@ -4937,21 +4891,18 @@ hpread_type_lookup (dnttpointer hp_type, struct objfile *objfile)
struct type *retvaltype;
int nargs;
int i;
- struct type **args_type;
class_type = hpread_type_lookup (dn_bufp->dptrmem.pointsto,
objfile);
functype = hpread_type_lookup (dn_bufp->dptrmem.memtype,
objfile);
retvaltype = TYPE_TARGET_TYPE (functype);
nargs = TYPE_NFIELDS (functype);
- args_type = (struct type **) xmalloc ((nargs + 1) * sizeof (struct type *));
- for (i = 0; i < nargs; i++)
- {
- args_type[i] = TYPE_FIELD_TYPE (functype, i);
- }
- args_type[nargs] = NULL;
ptrmemtype = alloc_type (objfile);
- smash_to_method_type (ptrmemtype, class_type, retvaltype, args_type);
+
+ smash_to_method_type (ptrmemtype, class_type, retvaltype,
+ TYPE_FIELDS (functype),
+ TYPE_NFIELDS (functype),
+ 0);
return make_pointer_type (ptrmemtype, NULL);
}
break;
diff --git a/gdb/i386-linux-nat.c b/gdb/i386-linux-nat.c
index e20e894113e..26f5aaf85ab 100644
--- a/gdb/i386-linux-nat.c
+++ b/gdb/i386-linux-nat.c
@@ -62,6 +62,9 @@
/* Defines for XMM0_REGNUM etc. */
#include "i386-tdep.h"
+/* Defines I386_LINUX_ORIG_EAX_REGNUM. */
+#include "i386-linux-tdep.h"
+
/* Prototypes for local functions. */
static void dummy_sse_values (void);
@@ -311,7 +314,8 @@ supply_gregset (elf_gregset_t *gregsetp)
for (i = 0; i < NUM_GREGS; i++)
supply_register (i, (char *) (regp + regmap[i]));
- supply_register (I386_LINUX_ORIG_EAX_REGNUM, (char *) (regp + ORIG_EAX));
+ if (I386_LINUX_ORIG_EAX_REGNUM < NUM_REGS)
+ supply_register (I386_LINUX_ORIG_EAX_REGNUM, (char *) (regp + ORIG_EAX));
}
/* Fill register REGNO (if it is a general-purpose register) in
@@ -328,7 +332,8 @@ fill_gregset (elf_gregset_t *gregsetp, int regno)
if ((regno == -1 || regno == i))
regcache_collect (i, regp + regmap[i]);
- if (regno == -1 || regno == I386_LINUX_ORIG_EAX_REGNUM)
+ if ((regno == -1 || regno == I386_LINUX_ORIG_EAX_REGNUM)
+ && I386_LINUX_ORIG_EAX_REGNUM < NUM_REGS)
regcache_collect (I386_LINUX_ORIG_EAX_REGNUM, regp + ORIG_EAX);
}
diff --git a/gdb/i386-linux-tdep.c b/gdb/i386-linux-tdep.c
index 9592decee19..12a2ab9004d 100644
--- a/gdb/i386-linux-tdep.c
+++ b/gdb/i386-linux-tdep.c
@@ -33,9 +33,12 @@
#include "solib-svr4.h" /* For struct link_map_offsets. */
+#include "i386-tdep.h"
+#include "i386-linux-tdep.h"
+
/* Return the name of register REG. */
-char *
+static char *
i386_linux_register_name (int reg)
{
/* Deal with the extra "orig_eax" pseudo register. */
@@ -45,7 +48,7 @@ i386_linux_register_name (int reg)
return i386_register_name (reg);
}
-int
+static int
i386_linux_register_byte (int reg)
{
/* Deal with the extra "orig_eax" pseudo register. */
@@ -56,7 +59,7 @@ i386_linux_register_byte (int reg)
return i386_register_byte (reg);
}
-int
+static int
i386_linux_register_raw_size (int reg)
{
/* Deal with the extra "orig_eax" pseudo register. */
@@ -224,8 +227,8 @@ i386_linux_rt_sigtramp_start (CORE_ADDR pc)
/* Return whether PC is in a GNU/Linux sigtramp routine. */
-int
-i386_linux_in_sigtramp (CORE_ADDR pc, char *name)
+static int
+i386_linux_pc_in_sigtramp (CORE_ADDR pc, char *name)
{
if (name)
return STREQ ("__restore", name) || STREQ ("__restore_rt", name);
@@ -379,7 +382,7 @@ i386_linux_saved_pc_after_call (struct frame_info *frame)
/* Set the program counter for process PTID to PC. */
-void
+static void
i386_linux_write_pc (CORE_ADDR pc, ptid_t ptid)
{
write_register_pid (PC_REGNUM, pc, ptid);
@@ -496,7 +499,7 @@ i386_linux_skip_solib_resolver (CORE_ADDR pc)
from a GDB that was not built on an GNU/Linux x86 host (for cross
debugging). */
-struct link_map_offsets *
+static struct link_map_offsets *
i386_linux_svr4_fetch_link_map_offsets (void)
{
static struct link_map_offsets lmo;
@@ -528,3 +531,53 @@ i386_linux_svr4_fetch_link_map_offsets (void)
return lmp;
}
+
+
+static void
+i386_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
+{
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+
+ /* GNU/Linux uses ELF. */
+ i386_elf_init_abi (info, gdbarch);
+
+ /* We support the SSE registers on GNU/Linux. */
+ tdep->num_xmm_regs = I386_NUM_XREGS - 1;
+ /* set_gdbarch_num_regs (gdbarch, I386_SSE_NUM_REGS); */
+
+ /* Since we have the extra "orig_eax" register on GNU/Linux, we have
+ to adjust a few things. */
+
+ set_gdbarch_write_pc (gdbarch, i386_linux_write_pc);
+ set_gdbarch_num_regs (gdbarch, I386_SSE_NUM_REGS + 1);
+ set_gdbarch_register_name (gdbarch, i386_linux_register_name);
+ set_gdbarch_register_bytes (gdbarch, I386_SSE_SIZEOF_REGS + 4);
+ set_gdbarch_register_byte (gdbarch, i386_linux_register_byte);
+ set_gdbarch_register_raw_size (gdbarch, i386_linux_register_raw_size);
+
+ tdep->jb_pc_offset = 20; /* From <bits/setjmp.h>. */
+
+ /* When the i386 Linux kernel calls a signal handler, the return
+ address points to a bit of code on the stack. These definitions
+ are used to identify this bit of code as a signal trampoline in
+ order to support backtracing through calls to signal handlers. */
+
+ set_gdbarch_pc_in_sigtramp (gdbarch, i386_linux_pc_in_sigtramp);
+ set_gdbarch_frame_chain (gdbarch, i386_linux_frame_chain);
+ set_gdbarch_frame_saved_pc (gdbarch, i386_linux_frame_saved_pc);
+ set_gdbarch_saved_pc_after_call (gdbarch, i386_linux_saved_pc_after_call);
+ tdep->sigtramp_saved_pc = i386_linux_sigtramp_saved_pc;
+
+ set_solib_svr4_fetch_link_map_offsets (gdbarch,
+ i386_linux_svr4_fetch_link_map_offsets);
+}
+
+/* Provide a prototype to silence -Wmissing-prototypes. */
+extern void _initialize_i386_linux_tdep (void);
+
+void
+_initialize_i386_linux_tdep (void)
+{
+ gdbarch_register_osabi (bfd_arch_i386, GDB_OSABI_LINUX,
+ i386_linux_init_abi);
+}
diff --git a/gdb/i386-linux-tdep.h b/gdb/i386-linux-tdep.h
new file mode 100644
index 00000000000..3c30130ede9
--- /dev/null
+++ b/gdb/i386-linux-tdep.h
@@ -0,0 +1,36 @@
+/* Target-dependent code for Linux/x86.
+ 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 I386_LINUX_TDEP_H
+#define I386_LINUX_TDEP_H
+
+/* The Linux kernel pretends there is an additional "orig_eax"
+ register. Since GDB needs access to that register to be able to
+ properly restart system calls when necessary (see
+ i386-linux-tdep.c) we need our own versions of a number of
+ functions that deal with GDB's register cache. */
+
+/* Register number for the "orig_eax" pseudo-register. If this
+ pseudo-register contains a value >= 0 it is interpreted as the
+ system call number that the kernel is supposed to restart. */
+#define I386_LINUX_ORIG_EAX_REGNUM I386_SSE_NUM_REGS
+
+#endif /* i386-linux-tdep.h */
diff --git a/gdb/i386-sol2-tdep.c b/gdb/i386-sol2-tdep.c
new file mode 100644
index 00000000000..714f5db9b36
--- /dev/null
+++ b/gdb/i386-sol2-tdep.c
@@ -0,0 +1,59 @@
+/* Target-dependent code for Solaris x86.
+ 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. */
+
+#include "defs.h"
+
+#include "i386-tdep.h"
+
+static int
+i386_sol2_pc_in_sigtramp (CORE_ADDR pc, char *name)
+{
+ /* Signal handler frames under Solaris 2 are recognized by a return
+ address of 0xffffffff. */
+ return (pc == 0xffffffff);
+}
+
+/* Solaris 2. */
+
+static void
+i386_sol2_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
+{
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+
+ /* Solaris is SVR4-based. */
+ i386_svr4_init_abi (info, gdbarch);
+
+ /* Signal trampolines are different from SVR4, in fact they're
+ rather similar to BSD. */
+ set_gdbarch_pc_in_sigtramp (gdbarch, i386_sol2_pc_in_sigtramp);
+ tdep->sigtramp_saved_pc = i386bsd_sigtramp_saved_pc;
+ tdep->sc_pc_offset = 36 + 14 * 4;
+}
+
+
+/* Provide a prototype to silence -Wmissing-prototypes. */
+void _initialize_i386_sol2_tdep (void);
+
+void
+_initialize_i386_sol2_tdep (void)
+{
+ gdbarch_register_osabi (bfd_arch_i386, GDB_OSABI_SOLARIS,
+ i386_sol2_init_abi);
+}
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index ddc461ec151..f0723fa660b 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -36,8 +36,6 @@
#include "value.h"
#include "gdb_assert.h"
-#include "elf-bfd.h"
-
#include "i386-tdep.h"
/* Names of the registers. The first 10 registers match the register
@@ -119,7 +117,7 @@ i386_register_virtual_size (int reg)
/* Convert stabs register number REG to the appropriate register
number used by GDB. */
-int
+static int
i386_stab_reg_to_regnum (int reg)
{
/* This implements what GCC calls the "default" register map. */
@@ -150,10 +148,10 @@ i386_stab_reg_to_regnum (int reg)
return NUM_REGS + NUM_PSEUDO_REGS;
}
-/* Convert Dwarf register number REG to the appropriate register
+/* Convert DWARF register number REG to the appropriate register
number used by GDB. */
-int
+static int
i386_dwarf_reg_to_regnum (int reg)
{
/* The DWARF register numbering includes %eip and %eflags, and
@@ -466,7 +464,7 @@ i386_get_frame_setup (CORE_ADDR pc)
frame's nominal address is the address of a 4-byte word containing
the calling frame's address. */
-CORE_ADDR
+static CORE_ADDR
i386_frame_chain (struct frame_info *frame)
{
if (frame->signal_handler_caller)
@@ -493,30 +491,24 @@ i386_frameless_function_invocation (struct frame_info *frame)
/* Return the saved program counter for FRAME. */
-CORE_ADDR
+static CORE_ADDR
i386_frame_saved_pc (struct frame_info *frame)
{
- /* FIXME: kettenis/2001-05-09: Conditionalizing the next bit of code
- on SIGCONTEXT_PC_OFFSET and I386V4_SIGTRAMP_SAVED_PC should be
- considered a temporary hack. I plan to come up with something
- better when we go multi-arch. */
-#if defined (SIGCONTEXT_PC_OFFSET) || defined (I386V4_SIGTRAMP_SAVED_PC)
if (frame->signal_handler_caller)
- return sigtramp_saved_pc (frame);
-#endif
+ {
+ CORE_ADDR (*sigtramp_saved_pc) (struct frame_info *);
+ sigtramp_saved_pc = gdbarch_tdep (current_gdbarch)->sigtramp_saved_pc;
- return read_memory_unsigned_integer (frame->frame + 4, 4);
-}
+ gdb_assert (sigtramp_saved_pc != NULL);
+ return sigtramp_saved_pc (frame);
+ }
-CORE_ADDR
-i386go32_frame_saved_pc (struct frame_info *frame)
-{
- return read_memory_integer (frame->frame + 4, 4);
+ return read_memory_unsigned_integer (frame->frame + 4, 4);
}
/* Immediately after a function call, return the saved pc. */
-CORE_ADDR
+static CORE_ADDR
i386_saved_pc_after_call (struct frame_info *frame)
{
return read_memory_unsigned_integer (read_register (SP_REGNUM), 4);
@@ -834,49 +826,35 @@ i386_pop_frame (void)
}
-#ifdef GET_LONGJMP_TARGET
-
-/* FIXME: Multi-arching does not set JB_PC and JB_ELEMENT_SIZE yet.
- Fill in with dummy value to enable compilation. */
-#ifndef JB_PC
-#define JB_PC 0
-#endif /* JB_PC */
-
-#ifndef JB_ELEMENT_SIZE
-#define JB_ELEMENT_SIZE 4
-#endif /* JB_ELEMENT_SIZE */
-
/* 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 PC. This routine returns true on
+ structure from which we extract the address that we will land at.
+ This address is copied into PC. This routine returns true on
success. */
-int
-get_longjmp_target (CORE_ADDR *pc)
+static int
+i386_get_longjmp_target (CORE_ADDR *pc)
{
- char buf[TARGET_PTR_BIT / TARGET_CHAR_BIT];
+ char buf[4];
CORE_ADDR sp, jb_addr;
+ int jb_pc_offset = gdbarch_tdep (current_gdbarch)->jb_pc_offset;
- sp = read_register (SP_REGNUM);
-
- if (target_read_memory (sp + SP_ARG0, /* Offset of first arg on stack. */
- buf,
- TARGET_PTR_BIT / TARGET_CHAR_BIT))
+ /* If JB_PC_OFFSET is -1, we have no way to find out where the
+ longjmp will land. */
+ if (jb_pc_offset == -1)
return 0;
- jb_addr = extract_address (buf, TARGET_PTR_BIT / TARGET_CHAR_BIT);
-
- if (target_read_memory (jb_addr + JB_PC * JB_ELEMENT_SIZE, buf,
- TARGET_PTR_BIT / TARGET_CHAR_BIT))
+ sp = read_register (SP_REGNUM);
+ if (target_read_memory (sp + 4, buf, 4))
return 0;
- *pc = extract_address (buf, TARGET_PTR_BIT / TARGET_CHAR_BIT);
+ jb_addr = extract_address (buf, 4);
+ if (target_read_memory (jb_addr + jb_pc_offset, buf, 4))
+ return 0;
+ *pc = extract_address (buf, 4);
return 1;
}
-
-#endif /* GET_LONGJMP_TARGET */
CORE_ADDR
@@ -1044,6 +1022,37 @@ i386_extract_struct_value_address (char *regbuf)
}
+/* This is the variable that is set with "set struct-convention", and
+ its legitimate values. */
+static const char default_struct_convention[] = "default";
+static const char pcc_struct_convention[] = "pcc";
+static const char reg_struct_convention[] = "reg";
+static const char *valid_conventions[] =
+{
+ default_struct_convention,
+ pcc_struct_convention,
+ reg_struct_convention,
+ NULL
+};
+static const char *struct_convention = default_struct_convention;
+
+static int
+i386_use_struct_convention (int gcc_p, struct type *type)
+{
+ enum struct_return struct_return;
+
+ 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;
+
+ return generic_use_struct_convention (struct_return == reg_struct_return,
+ type);
+}
+
+
/* Return the GDB type object for the "standard" data type of data in
register REGNUM. Perhaps %esi and %edi should go here, but
potentially they could be used for things other than address. */
@@ -1058,7 +1067,7 @@ i386_register_virtual_type (int regnum)
return builtin_type_i387_ext;
if (IS_SSE_REGNUM (regnum))
- return builtin_type_v4sf;
+ return builtin_type_vec128i;
return builtin_type_int;
}
@@ -1122,34 +1131,6 @@ i386_register_convert_to_raw (struct type *type, int regnum,
}
-#ifdef I386V4_SIGTRAMP_SAVED_PC
-/* Get saved user PC for sigtramp from the pushed ucontext on the
- stack for all three variants of SVR4 sigtramps. */
-
-CORE_ADDR
-i386v4_sigtramp_saved_pc (struct frame_info *frame)
-{
- CORE_ADDR saved_pc_offset = 4;
- char *name = NULL;
-
- find_pc_partial_function (frame->pc, &name, NULL, NULL);
- if (name)
- {
- if (STREQ (name, "_sigreturn"))
- saved_pc_offset = 132 + 14 * 4;
- else if (STREQ (name, "_sigacthandler"))
- saved_pc_offset = 80 + 14 * 4;
- else if (STREQ (name, "sigvechandler"))
- saved_pc_offset = 120 + 14 * 4;
- }
-
- if (frame->next)
- return read_memory_integer (frame->next->frame + saved_pc_offset, 4);
- return read_memory_integer (read_register (SP_REGNUM) + saved_pc_offset, 4);
-}
-#endif /* I386V4_SIGTRAMP_SAVED_PC */
-
-
#ifdef STATIC_TRANSFORM_NAME
/* SunPRO encodes the static variables. This is not related to C++
mangling, it is done for C too. */
@@ -1199,6 +1180,16 @@ skip_trampoline_code (CORE_ADDR pc, char *name)
}
+/* Return non-zero if PC and NAME show that we are in a signal
+ trampoline. */
+
+static int
+i386_pc_in_sigtramp (CORE_ADDR pc, char *name)
+{
+ return (name && strcmp ("_sigtramp", name) == 0);
+}
+
+
/* We have two flavours of disassembly. The machinery on this page
deals with switching between those. */
@@ -1213,229 +1204,132 @@ gdb_print_insn_i386 (bfd_vma memaddr, disassemble_info *info)
or intel_flavor. */
internal_error (__FILE__, __LINE__, "failed internal consistency check");
}
-
-/* This table matches the indices assigned to enum i386_abi. Keep
- them in sync. */
-static const char * const i386_abi_names[] =
-{
- "<unknown>",
- "SVR4",
- "NetBSD",
- "GNU/Linux",
- "GNU/Hurd",
- "Solaris",
- "FreeBSD",
- NULL
-};
+/* There are a few i386 architecture variants that differ only
+ slightly from the generic i386 target. For now, we don't give them
+ their own source file, but include them here. As a consequence,
+ they'll always be included. */
-#define ABI_TAG_OS_GNU_LINUX I386_ABI_LINUX
-#define ABI_TAG_OS_GNU_HURD I386_ABI_HURD
-#define ABI_TAG_OS_GNU_SOLARIS I386_ABI_INVALID
-#define ABI_TAG_OS_FREEBSD I386_ABI_FREEBSD
-#define ABI_TAG_OS_NETBSD I386_ABI_NETBSD
+/* System V Release 4 (SVR4). */
-static void
-process_note_sections (bfd *abfd, asection *sect, void *obj)
+static int
+i386_svr4_pc_in_sigtramp (CORE_ADDR pc, char *name)
{
- int *abi = obj;
- const char *name;
- unsigned int sectsize;
+ return (name && (strcmp ("_sigreturn", name) == 0
+ || strcmp ("_sigacthandler", name) == 0
+ || strcmp ("sigvechandler", name) == 0));
+}
- name = bfd_get_section_name (abfd, sect);
- sectsize = bfd_section_size (abfd, sect);
+/* Get saved user PC for sigtramp from the pushed ucontext on the
+ stack for all three variants of SVR4 sigtramps. */
- if (strcmp (name, ".note.ABI-tag") == 0 && sectsize > 0)
+CORE_ADDR
+i386_svr4_sigtramp_saved_pc (struct frame_info *frame)
+{
+ CORE_ADDR saved_pc_offset = 4;
+ char *name = NULL;
+
+ find_pc_partial_function (frame->pc, &name, NULL, NULL);
+ if (name)
{
- unsigned int name_length, data_length, note_type;
- char *note;
+ if (strcmp (name, "_sigreturn") == 0)
+ saved_pc_offset = 132 + 14 * 4;
+ else if (strcmp (name, "_sigacthandler") == 0)
+ saved_pc_offset = 80 + 14 * 4;
+ else if (strcmp (name, "sigvechandler") == 0)
+ saved_pc_offset = 120 + 14 * 4;
+ }
- /* If the section is larger than this, it's probably not what we
- are looking for. */
- if (sectsize > 128)
- sectsize = 128;
+ if (frame->next)
+ return read_memory_integer (frame->next->frame + saved_pc_offset, 4);
+ return read_memory_integer (read_register (SP_REGNUM) + saved_pc_offset, 4);
+}
+
- note = alloca (sectsize);
+/* DJGPP. */
- bfd_get_section_contents (abfd, sect, note,
- (file_ptr) 0, (bfd_size_type) sectsize);
+static int
+i386_go32_pc_in_sigtramp (CORE_ADDR pc, char *name)
+{
+ /* DJGPP doesn't have any special frames for signal handlers. */
+ return 0;
+}
+
- name_length = bfd_h_get_32 (abfd, note);
- data_length = bfd_h_get_32 (abfd, note + 4);
- note_type = bfd_h_get_32 (abfd, note + 8);
+/* Generic ELF. */
- if (name_length == 4 && data_length == 16
- && note_type == NT_GNU_ABI_TAG
- && strcmp (note + 12, "GNU") == 0)
- {
- int abi_tag_os = bfd_h_get_32 (abfd, note + 16);
+void
+i386_elf_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
+{
+ /* We typically use stabs-in-ELF with the DWARF register numbering. */
+ set_gdbarch_stab_reg_to_regnum (gdbarch, i386_dwarf_reg_to_regnum);
+}
- /* The case numbers are from abi-tags in glibc. */
- switch (abi_tag_os)
- {
- case GNU_ABI_TAG_LINUX:
- *abi = ABI_TAG_OS_GNU_LINUX;
- break;
-
- case GNU_ABI_TAG_HURD:
- *abi = ABI_TAG_OS_GNU_HURD;
- break;
-
- case GNU_ABI_TAG_SOLARIS:
- *abi = ABI_TAG_OS_GNU_SOLARIS;
- break;
-
- default:
- internal_error
- (__FILE__, __LINE__,
- "process_note_abi_sections: unknown ABI OS tag %d",
- abi_tag_os);
- break;
- }
- }
- else if (name_length == 8 && data_length == 4
- && note_type == NT_FREEBSD_ABI_TAG
- && strcmp (note + 12, "FreeBSD") == 0)
- *abi = ABI_TAG_OS_FREEBSD;
- }
- /* NetBSD uses a similar trick. */
- else if (strcmp (name, ".note.netbsd.ident") == 0 && sectsize > 0)
- {
- unsigned int name_length, desc_length, note_type;
- char *note;
+/* System V Release 4 (SVR4). */
- /* If the section is larger than this, it's probably not what we are
- looking for. */
- if (sectsize > 128)
- sectsize = 128;
+void
+i386_svr4_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
+{
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
- note = alloca (sectsize);
+ /* System V Release 4 uses ELF. */
+ i386_elf_init_abi (info, gdbarch);
- bfd_get_section_contents (abfd, sect, note,
- (file_ptr) 0, (bfd_size_type) sectsize);
+ /* FIXME: kettenis/20020511: Why do we override this function here? */
+ set_gdbarch_frame_chain_valid (gdbarch, func_frame_chain_valid);
- name_length = bfd_h_get_32 (abfd, note);
- desc_length = bfd_h_get_32 (abfd, note + 4);
- note_type = bfd_h_get_32 (abfd, note + 8);
+ set_gdbarch_pc_in_sigtramp (gdbarch, i386_svr4_pc_in_sigtramp);
+ tdep->sigtramp_saved_pc = i386_svr4_sigtramp_saved_pc;
- if (name_length == 7 && desc_length == 4
- && note_type == NT_NETBSD_IDENT
- && strcmp (note + 12, "NetBSD") == 0)
- *abi = ABI_TAG_OS_NETBSD;
- }
+ tdep->jb_pc_offset = 20;
}
-static int
-i386_elf_abi_from_note (bfd *abfd)
-{
- enum i386_abi abi = I386_ABI_UNKNOWN;
-
- bfd_map_over_sections (abfd, process_note_sections, &abi);
-
- return abi;
-}
+/* DJGPP. */
-static enum i386_abi
-i386_elf_abi (bfd *abfd)
+void
+i386_go32_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
- int elfosabi = elf_elfheader (abfd)->e_ident[EI_OSABI];
-
- /* The fact that the EI_OSABI byte is set to ELFOSABI_NONE doesn't
- necessarily mean that this is a System V ELF binary. To further
- distinguish between binaries for differens operating systems,
- check for vendor-specific note elements. */
- if (elfosabi == ELFOSABI_NONE)
- {
- enum i386_abi abi = i386_elf_abi_from_note (abfd);
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
- if (abi != I386_ABI_UNKNOWN)
- return abi;
-
- /* FreeBSD folks are naughty; they stored the string "FreeBSD"
- in the padding of the e_ident field of the ELF header. */
- if (strcmp (&elf_elfheader (abfd)->e_ident[8], "FreeBSD") == 0)
- return I386_ABI_FREEBSD;
- }
+ set_gdbarch_pc_in_sigtramp (gdbarch, i386_go32_pc_in_sigtramp);
- switch (elfosabi)
- {
- case ELFOSABI_NONE:
- return I386_ABI_SVR4;
- case ELFOSABI_FREEBSD:
- return I386_ABI_FREEBSD;
- }
-
- return I386_ABI_UNKNOWN;
+ tdep->jb_pc_offset = 36;
}
-struct i386_abi_handler
-{
- struct i386_abi_handler *next;
- enum i386_abi abi;
- void (*init_abi)(struct gdbarch_info, struct gdbarch *);
-};
-
-struct i386_abi_handler *i386_abi_handler_list = NULL;
+/* NetWare. */
void
-i386_gdbarch_register_os_abi (enum i386_abi abi,
- void (*init_abi)(struct gdbarch_info,
- struct gdbarch *))
+i386_nw_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
- struct i386_abi_handler **handler_p;
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
- for (handler_p = &i386_abi_handler_list; *handler_p != NULL;
- handler_p = &(*handler_p)->next)
- {
- if ((*handler_p)->abi == abi)
- {
- internal_error
- (__FILE__, __LINE__,
- "i386_gdbarch_register_abi: A handler for this ABI variant "
- "(%d) has already been registered", (int) abi);
- /* If user wants to continue, override previous definition. */
- (*handler_p)->init_abi = init_abi;
- return;
- }
- }
- (*handler_p)
- = (struct i386_abi_handler *) xmalloc (sizeof (struct i386_abi_handler));
- (*handler_p)->next = NULL;
- (*handler_p)->abi = abi;
- (*handler_p)->init_abi = init_abi;
+ /* FIXME: kettenis/20020511: Why do we override this function here? */
+ set_gdbarch_frame_chain_valid (gdbarch, func_frame_chain_valid);
+
+ tdep->jb_pc_offset = 24;
}
+
struct gdbarch *
i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
{
struct gdbarch_tdep *tdep;
struct gdbarch *gdbarch;
- enum i386_abi abi = I386_ABI_UNKNOWN;
- struct i386_abi_handler *abi_handler;
+ enum gdb_osabi osabi = GDB_OSABI_UNKNOWN;
+ /* Try to determine the OS ABI of the object we're loading. */
if (info.abfd != NULL)
- {
- switch (bfd_get_flavour (info.abfd))
- {
- case bfd_target_elf_flavour:
- abi= i386_elf_abi (info.abfd);
- break;
-
- default:
- /* Not sure what to do here, leave the ABI as unknown. */
- break;
- }
- }
+ osabi = gdbarch_lookup_osabi (info.abfd);
/* Find a candidate among extant architectures. */
for (arches = gdbarch_list_lookup_by_info (arches, &info);
arches != NULL;
arches = gdbarch_list_lookup_by_info (arches->next, &info))
{
- /* Make sure the ABI selection matches. */
+ /* Make sure the OS ABI selection matches. */
tdep = gdbarch_tdep (arches->gdbarch);
- if (tdep && tdep->abi == abi)
+ if (tdep && tdep->osabi == osabi)
return arches->gdbarch;
}
@@ -1443,11 +1337,32 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
tdep = XMALLOC (struct gdbarch_tdep);
gdbarch = gdbarch_alloc (&info, tdep);
- tdep->abi = abi;
+ tdep->osabi = osabi;
+
+ /* The i386 default settings don't include the SSE registers.
+ FIXME: kettenis/20020509: They do include the FPU registers for
+ now, which is not quite right. */
+ tdep->num_xmm_regs = 0;
+
+ tdep->jb_pc_offset = -1;
+ tdep->struct_return = pcc_struct_return;
+ tdep->sigtramp_saved_pc = NULL;
+ tdep->sigtramp_start = 0;
+ tdep->sigtramp_end = 0;
+ tdep->sc_pc_offset = -1;
+
+ /* The format used for `long double' on almost all i386 targets is
+ the i387 extended floating-point format. In fact, of all targets
+ in the GCC 2.95 tree, only OSF/1 does it different, and insists
+ on having a `long double' that's not `long' at all. */
+ set_gdbarch_long_double_format (gdbarch, &floatformat_i387_ext);
+
+ /* Although the i386 extended floating-point has only 80 significant
+ bits, a `long double' actually takes up 96, probably to enforce
+ alignment. */
+ set_gdbarch_long_double_bit (gdbarch, 96);
- /* FIXME: kettenis/2001-11-24: Although not all IA-32 processors
- have the SSE registers, it's easier to set the default to 8. */
- tdep->num_xmm_regs = 8;
+ set_gdbarch_get_longjmp_target (gdbarch, i386_get_longjmp_target);
set_gdbarch_use_generic_dummy_frames (gdbarch, 0);
@@ -1463,50 +1378,61 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_pc_in_call_dummy (gdbarch, pc_in_call_dummy_on_stack);
- /* NOTE: tm-i386nw.h and tm-i386v4.h override this. */
+ set_gdbarch_use_struct_convention (gdbarch, i386_use_struct_convention);
+
+ /* The following redefines make backtracing through sigtramp work.
+ They manufacture a fake sigtramp frame and obtain the saved pc in
+ sigtramp from the sigcontext structure which is pushed by the
+ kernel on the user stack, along with a pointer to it. */
+
+ set_gdbarch_frame_chain (gdbarch, i386_frame_chain);
set_gdbarch_frame_chain_valid (gdbarch, file_frame_chain_valid);
+ set_gdbarch_frame_saved_pc (gdbarch, i386_frame_saved_pc);
+ set_gdbarch_saved_pc_after_call (gdbarch, i386_saved_pc_after_call);
+ set_gdbarch_pc_in_sigtramp (gdbarch, i386_pc_in_sigtramp);
+
+ /* NOTE: tm-i386aix.h, tm-i386bsd.h, tm-i386os9k.h, tm-ptx.h,
+ tm-symmetry.h currently override this. Sigh. */
+ set_gdbarch_num_regs (gdbarch, I386_NUM_GREGS + I386_NUM_FREGS);
+
+ /* Use the "default" register numbering scheme for stabs and COFF. */
+ set_gdbarch_stab_reg_to_regnum (gdbarch, i386_stab_reg_to_regnum);
+ set_gdbarch_sdb_reg_to_regnum (gdbarch, i386_stab_reg_to_regnum);
+
+ /* Use the DWARF register numbering scheme for DWARF and DWARF 2. */
+ set_gdbarch_dwarf_reg_to_regnum (gdbarch, i386_dwarf_reg_to_regnum);
+ set_gdbarch_dwarf2_reg_to_regnum (gdbarch, i386_dwarf_reg_to_regnum);
- /* NOTE: tm-i386aix.h, tm-i386bsd.h, tm-i386os9k.h, tm-linux.h,
- tm-ptx.h, tm-symmetry.h currently override this. Sigh. */
- set_gdbarch_num_regs (gdbarch, NUM_GREGS + NUM_FREGS + NUM_SSE_REGS);
+ /* We don't define ECOFF_REG_TO_REGNUM, since ECOFF doesn't seem to
+ be in use on any of the supported i386 targets. */
+
+ set_gdbarch_register_bytes (gdbarch, I386_SIZEOF_GREGS + I386_SIZEOF_FREGS);
+ set_gdbarch_register_name (gdbarch, i386_register_name);
+ set_gdbarch_register_byte (gdbarch, i386_register_byte);
+ set_gdbarch_register_raw_size (gdbarch, i386_register_raw_size);
/* Hook in ABI-specific overrides, if they have been registered. */
- if (abi == I386_ABI_UNKNOWN)
- {
- /* Don't complain about not knowing the ABI variant if we don't
- have an inferior. */
- if (info.abfd)
- fprintf_filtered
- (gdb_stderr, "GDB doesn't recognize the ABI of the inferior. "
- "Attempting to continue with the default i386 settings");
- }
- else
- {
- for (abi_handler = i386_abi_handler_list; abi_handler != NULL;
- abi_handler = abi_handler->next)
- if (abi_handler->abi == abi)
- break;
+ gdbarch_init_osabi (info, gdbarch, osabi);
- if (abi_handler)
- abi_handler->init_abi (info, gdbarch);
- else
- {
- /* We assume that if GDB_MULTI_ARCH is less than
- GDB_MULTI_ARCH_TM that an ABI variant can be supported by
- overriding definitions in this file. */
- if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
- fprintf_filtered
- (gdb_stderr,
- "A handler for the ABI variant \"%s\" is not built into this "
- "configuration of GDB. "
- "Attempting to continue with the default i386 settings",
- i386_abi_names[abi]);
- }
- }
-
return gdbarch;
}
+static enum gdb_osabi
+i386_coff_osabi_sniffer (bfd *abfd)
+{
+ if (strcmp (bfd_get_target (abfd), "coff-go32-exe") == 0)
+ return GDB_OSABI_GO32;
+
+ return GDB_OSABI_UNKNOWN;
+}
+
+static enum gdb_osabi
+i386_nlm_osabi_sniffer (bfd *abfd)
+{
+ return GDB_OSABI_NETWARE;
+}
+
+
/* Provide a prototype to silence -Wmissing-prototypes. */
void _initialize_i386_tdep (void);
@@ -1544,4 +1470,30 @@ and the default value is \"att\".",
&setlist);
add_show_from_set (new_cmd, &showlist);
}
+
+ /* Add the variable that controls the convention for returning
+ structs. */
+ {
+ struct cmd_list_element *new_cmd;
+
+ new_cmd = add_set_enum_cmd ("struct-convention", no_class,
+ valid_conventions,
+ &struct_convention, "\
+Set the convention for returning small structs, valid values \
+are \"default\", \"pcc\" and \"reg\", and the default value is \"default\".",
+ &setlist);
+ add_show_from_set (new_cmd, &showlist);
+ }
+
+ gdbarch_register_osabi_sniffer (bfd_arch_i386, bfd_target_coff_flavour,
+ i386_coff_osabi_sniffer);
+ gdbarch_register_osabi_sniffer (bfd_arch_i386, bfd_target_nlm_flavour,
+ i386_nlm_osabi_sniffer);
+
+ gdbarch_register_osabi (bfd_arch_i386, GDB_OSABI_SVR4,
+ i386_svr4_init_abi);
+ gdbarch_register_osabi (bfd_arch_i386, GDB_OSABI_GO32,
+ i386_go32_init_abi);
+ gdbarch_register_osabi (bfd_arch_i386, GDB_OSABI_NETWARE,
+ i386_nw_init_abi);
}
diff --git a/gdb/i386-tdep.h b/gdb/i386-tdep.h
index 0bdbb057e2f..64af99d1e66 100644
--- a/gdb/i386-tdep.h
+++ b/gdb/i386-tdep.h
@@ -1,5 +1,5 @@
/* Target-dependent code for GDB, the GNU debugger.
- Copyright 2001
+ Copyright 2001, 2002
Free Software Foundation, Inc.
This file is part of GDB.
@@ -22,6 +22,8 @@
#ifndef I386_TDEP_H
#define I386_TDEP_H
+#include "osabi.h"
+
/* GDB's i386 target supports both the 32-bit Intel Architecture
(IA-32) and the 64-bit AMD x86-64 architecture. Internally it uses
a similar register layout for both.
@@ -40,30 +42,38 @@
differs and is determined by the num_xmm_regs member of `struct
gdbarch_tdep'. */
-/* ABI variants that we know about. */
-enum i386_abi
-{
- I386_ABI_UNKNOWN = 0,
-
- /* ELF */
- I386_ABI_SVR4, /* This is the default. */
- I386_ABI_NETBSD,
- I386_ABI_LINUX,
- I386_ABI_HURD,
- I386_ABI_SOLARIS,
- I386_ABI_FREEBSD,
+/* Convention for returning structures. */
- I386_ABI_INVALID = -1
+enum struct_return
+{
+ pcc_struct_return, /* Return "short" structures in memory. */
+ reg_struct_return /* Return "short" structures in registers. */
};
/* i386 architecture specific information. */
struct gdbarch_tdep
{
/* ABI. */
- enum i386_abi abi;
+ enum gdb_osabi osabi;
/* Number of SSE registers. */
int num_xmm_regs;
+
+ /* Offset of saved PC in jmp_buf. */
+ int jb_pc_offset;
+
+ /* Convention for returning structures. */
+ enum struct_return struct_return;
+
+ /* Get saved PC for sigtramp. */
+ CORE_ADDR (*sigtramp_saved_pc) (struct frame_info *);
+
+ /* Address range where sigtramp lives. */
+ CORE_ADDR sigtramp_start;
+ CORE_ADDR sigtramp_end;
+
+ /* Offset of saved PC in `struct sigcontext'. */
+ int sc_pc_offset;
};
/* Floating-point registers. */
@@ -129,8 +139,42 @@ struct gdbarch_tdep
#define IS_FPU_CTRL_REGNUM(n) FPC_REGNUM_P (n)
#define IS_SSE_REGNUM(n) SSE_REGNUM_P (n)
-void i386_gdbarch_register_os_abi (enum i386_abi,
- void (*init_abi)(struct gdbarch_info,
- struct gdbarch *));
+#define I386_NUM_GREGS 16
+#define I386_NUM_FREGS 16
+#define I386_NUM_XREGS 9
+
+#define I386_SSE_NUM_REGS (I386_NUM_GREGS + I386_NUM_FREGS \
+ + I386_NUM_XREGS)
+
+/* Sizes of individual register sets. These cover the entire register
+ file, so summing up the sizes of those portions actually present
+ yields REGISTER_BYTES. */
+#define I386_SIZEOF_GREGS (I386_NUM_GREGS * 4)
+#define I386_SIZEOF_FREGS (8 * 10 + 8 * 4)
+#define I386_SIZEOF_XREGS (8 * 16 + 4)
+
+#define I386_SSE_SIZEOF_REGS (I386_SIZEOF_GREGS + I386_SIZEOF_FREGS \
+ + I386_SIZEOF_XREGS)
+
+/* Return the name of register REG. */
+extern char *i386_register_name (int reg);
+
+/* Return the offset into the register array of the start of register
+ number REG. */
+extern int i386_register_byte (int reg);
+
+/* Return the number of bytes of storage in GDB's register array
+ occupied by register REG. */
+extern int i386_register_raw_size (int reg);
+
+/* Initialize a basic ELF architecture variant. */
+extern void i386_elf_init_abi (struct gdbarch_info, struct gdbarch *);
+
+/* Initialize a SVR4 architecture variant. */
+extern void i386_svr4_init_abi (struct gdbarch_info, struct gdbarch *);
+
+/* Functions exported from i386bsd-tdep.c. */
+
+extern CORE_ADDR i386bsd_sigtramp_saved_pc (struct frame_info *frame);
#endif /* i386-tdep.h */
diff --git a/gdb/i386bsd-nat.c b/gdb/i386bsd-nat.c
index ad5a3013f34..a941d5b468c 100644
--- a/gdb/i386bsd-nat.c
+++ b/gdb/i386bsd-nat.c
@@ -382,19 +382,39 @@ kernel_u_size (void)
return (sizeof (struct user));
}
-/* See i386bsd-tdep.c. */
-extern int i386bsd_sigcontext_pc_offset;
-
void
_initialize_i386bsd_nat (void)
{
+ int sc_pc_offset;
+
/* To support the recognition of signal handlers, i386bsd-tdep.c
hardcodes some constants. Inclusion of this file means that we
are compiling a native debugger, which means that we can use the
system header files and sysctl(3) to get at the relevant
information. */
+#if defined (__FreeBSD_version) && __FreeBSD_version >= 400011
+ extern int i386fbsd4_sc_pc_offset;
+#define SC_PC_OFFSET i386fbsd4_sc_pc_offset
+#elif defined (NetBSD) || defined (__NetBSD_Version__)
+ extern int i386nbsd_sc_pc_offset;
+#define SC_PC_OFFSET i386nbsd_sc_pc_offset
+#else
+ extern int i386bsd_sc_pc_offset;
+#define SC_PC_OFFSET i386bsd_sc_pc_offset
+#endif
+
/* Override the default value for the offset of the program counter
in the sigcontext structure. */
- i386bsd_sigcontext_pc_offset = offsetof (struct sigcontext, sc_pc);
+ sc_pc_offset = offsetof (struct sigcontext, sc_pc);
+
+ if (SC_PC_OFFSET != sc_pc_offset)
+ {
+ warning ("\
+offsetof (struct sigcontext, sc_pc) yields %d instead of %d.\n\
+Please report this to <bug-gdb@gnu.org>.",
+ sc_pc_offset, SC_PC_OFFSET);
+ }
+
+ SC_PC_OFFSET = sc_pc_offset;
}
diff --git a/gdb/i386bsd-tdep.c b/gdb/i386bsd-tdep.c
index a01ed6b89e6..e6427b3ac9f 100644
--- a/gdb/i386bsd-tdep.c
+++ b/gdb/i386bsd-tdep.c
@@ -1,5 +1,5 @@
/* Target-dependent code for i386 BSD's.
- Copyright 2001 Free Software Foundation, Inc.
+ Copyright 2001, 2002 Free Software Foundation, Inc.
This file is part of GDB.
@@ -23,26 +23,19 @@
#include "gdbcore.h"
#include "regcache.h"
-/* Support for signal handlers. */
-
-/* Range in which to find the signaltramp routine, traditionally found
- on the use stack, just below the user area. Initialized to values
- that work for NetBSD and FreeBSD. */
+#include "i386-tdep.h"
-CORE_ADDR i386bsd_sigtramp_start = 0xbfbfdf20;
-CORE_ADDR i386bsd_sigtramp_end = 0xbfbfdff0;
+/* Support for signal handlers. */
/* Return whether PC is in a BSD sigtramp routine. */
-int
-i386bsd_in_sigtramp (CORE_ADDR pc, char *name)
+static int
+i386bsd_pc_in_sigtramp (CORE_ADDR pc, char *name)
{
- return (pc >= i386bsd_sigtramp_start && pc < i386bsd_sigtramp_end);
-}
+ struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
-/* Offset in the sigcontext structure of the program counter.
- Initialized to the value from 4.4 BSD Lite. */
-int i386bsd_sigcontext_pc_offset = 20;
+ return (pc >= tdep->sigtramp_start && pc < tdep->sigtramp_end);
+}
/* Assuming FRAME is for a BSD sigtramp routine, return the address of
the associated sigcontext structure. */
@@ -62,19 +55,24 @@ i386bsd_sigcontext_addr (struct frame_info *frame)
}
/* Assuming FRAME is for a BSD sigtramp routine, return the saved
- program counter. */
+ program counter.
-static CORE_ADDR
+ Note: This function is used for Solaris 2 too, so don't make it
+ static. */
+
+CORE_ADDR
i386bsd_sigtramp_saved_pc (struct frame_info *frame)
{
+ int sc_pc_offset = gdbarch_tdep (current_gdbarch)->sc_pc_offset;
CORE_ADDR addr;
+
addr = i386bsd_sigcontext_addr (frame);
- return read_memory_unsigned_integer (addr + i386bsd_sigcontext_pc_offset, 4);
+ return read_memory_unsigned_integer (addr + sc_pc_offset, 4);
}
/* Return the saved program counter for FRAME. */
-CORE_ADDR
+static CORE_ADDR
i386bsd_frame_saved_pc (struct frame_info *frame)
{
if (frame->signal_handler_caller)
@@ -82,3 +80,168 @@ i386bsd_frame_saved_pc (struct frame_info *frame)
return read_memory_unsigned_integer (frame->frame + 4, 4);
}
+
+/* Return the start address of the sigtramp routine. */
+
+CORE_ADDR
+i386bsd_sigtramp_start (CORE_ADDR pc)
+{
+ return gdbarch_tdep (current_gdbarch)->sigtramp_start;
+}
+
+/* Return the end address of the sigtramp routine. */
+
+CORE_ADDR
+i386bsd_sigtramp_end (CORE_ADDR pc)
+{
+ return gdbarch_tdep (current_gdbarch)->sigtramp_end;
+}
+
+
+/* Traditional BSD (4.3 BSD, still used for BSDI and 386BSD). */
+
+/* From <machine/signal.h>. */
+int i386bsd_sc_pc_offset = 20;
+
+static void
+i386bsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
+{
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+
+ set_gdbarch_pc_in_sigtramp (gdbarch, i386bsd_pc_in_sigtramp);
+
+ tdep->jb_pc_offset = 0;
+
+ tdep->sigtramp_saved_pc = i386bsd_sigtramp_saved_pc;
+ tdep->sigtramp_start = 0xfdbfdfc0;
+ tdep->sigtramp_end = 0xfdbfe000;
+ tdep->sc_pc_offset = i386bsd_sc_pc_offset;
+}
+
+/* NetBSD 1.0 or later. */
+
+/* From <machine/signal.h>. */
+int i386nbsd_sc_pc_offset = 44;
+
+static void
+i386nbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
+{
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+
+ /* Obviously NetBSD is BSD-based. */
+ i386bsd_init_abi (info, gdbarch);
+
+ /* NetBSD uses -freg-struct-return by default. */
+ tdep->struct_return = reg_struct_return;
+
+ /* NetBSD uses a different memory layout. */
+ tdep->sigtramp_start = 0xbfbfdf20;
+ tdep->sigtramp_end = 0xbfbfdff0;
+
+ /* NetBSD has a `struct sigcontext' that's different from the
+ origional 4.3 BSD. */
+ tdep->sc_pc_offset = i386nbsd_sc_pc_offset;
+}
+
+/* NetBSD ELF. */
+static void
+i386nbsdelf_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
+{
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+
+ /* It's still NetBSD. */
+ i386nbsd_init_abi (info, gdbarch);
+
+ /* But ELF-based. */
+ i386_elf_init_abi (info, gdbarch);
+
+ /* 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);
+}
+
+/* FreeBSD 3.0-RELEASE or later. */
+
+CORE_ADDR i386fbsd_sigtramp_start = 0xbfbfdf20;
+CORE_ADDR i386fbsd_sigtramp_end = 0xbfbfdff0;
+
+static void
+i386fbsdaout_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
+{
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+
+ /* Obviously FreeBSD is BSD-based. */
+ i386bsd_init_abi (info, gdbarch);
+
+ /* FreeBSD uses -freg-struct-return by default. */
+ tdep->struct_return = reg_struct_return;
+
+ /* FreeBSD uses a different memory layout. */
+ tdep->sigtramp_start = i386fbsd_sigtramp_start;
+ tdep->sigtramp_end = i386fbsd_sigtramp_end;
+}
+
+static void
+i386fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
+{
+ /* It's almost identical to FreeBSD a.out. */
+ i386fbsdaout_init_abi (info, gdbarch);
+
+ /* Except that it uses ELF. */
+ i386_elf_init_abi (info, gdbarch);
+}
+
+/* FreeBSD 4.0-RELEASE or later. */
+
+/* From <machine/signal.h>. */
+int i386fbsd4_sc_pc_offset = 76;
+
+static void
+i386fbsd4_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
+{
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+
+ /* Inherit stuff from older releases. We assume that FreeBSD
+ 4.0-RELEASE always uses ELF. */
+ i386fbsd_init_abi (info, gdbarch);
+
+ /* FreeBSD 4.0 introduced a new `struct sigcontext'. */
+ tdep->sc_pc_offset = i386fbsd4_sc_pc_offset;
+}
+
+
+static enum gdb_osabi
+i386bsd_aout_osabi_sniffer (bfd *abfd)
+{
+ if (strcmp (bfd_get_target (abfd), "a.out-i386-netbsd") == 0)
+ return GDB_OSABI_NETBSD_AOUT;
+
+ if (strcmp (bfd_get_target (abfd), "a.out-i386-freebsd") == 0)
+ return GDB_OSABI_FREEBSD_AOUT;
+
+ return GDB_OSABI_UNKNOWN;
+}
+
+
+/* Provide a prototype to silence -Wmissing-prototypes. */
+void _initialize_i386bsd_tdep (void);
+
+void
+_initialize_i386bsd_tdep (void)
+{
+ gdbarch_register_osabi_sniffer (bfd_arch_i386, bfd_target_aout_flavour,
+ i386bsd_aout_osabi_sniffer);
+
+ gdbarch_register_osabi (bfd_arch_i386, GDB_OSABI_NETBSD_AOUT,
+ i386nbsd_init_abi);
+ gdbarch_register_osabi (bfd_arch_i386, GDB_OSABI_NETBSD_ELF,
+ i386nbsdelf_init_abi);
+ gdbarch_register_osabi (bfd_arch_i386, GDB_OSABI_FREEBSD_AOUT,
+ i386fbsdaout_init_abi);
+ gdbarch_register_osabi (bfd_arch_i386, GDB_OSABI_FREEBSD_ELF,
+ i386fbsd4_init_abi);
+}
diff --git a/gdb/i386fbsd-nat.c b/gdb/i386fbsd-nat.c
index 1c19ac87eb4..a80d0a0af89 100644
--- a/gdb/i386fbsd-nat.c
+++ b/gdb/i386fbsd-nat.c
@@ -1,5 +1,5 @@
/* Native-dependent code for FreeBSD/i386.
- Copyright 2001 Free Software Foundation, Inc.
+ Copyright 2001, 2002 Free Software Foundation, Inc.
This file is part of GDB.
@@ -79,7 +79,7 @@ _initialize_i386fbsd_nat (void)
{
/* FreeBSD provides a kern.ps_strings sysctl that we can use to
locate the sigtramp. That way we can still recognize a sigtramp
- if it's location is changed in a new kernel. Of course this is
+ if its location is changed in a new kernel. Of course this is
still based on the assumption that the sigtramp is placed
directly under the location where the program arguments and
environment can be found. */
@@ -89,13 +89,16 @@ _initialize_i386fbsd_nat (void)
int ps_strings;
size_t len;
+ extern CORE_ADDR i386fbsd_sigtramp_start;
+ extern CORE_ADDR i386fbsd_sigtramp_end;
+
mib[0] = CTL_KERN;
mib[1] = KERN_PS_STRINGS;
len = sizeof (ps_strings);
if (sysctl (mib, 2, &ps_strings, &len, NULL, 0) == 0)
{
- i386bsd_sigtramp_start = ps_strings - 128;
- i386bsd_sigtramp_end = ps_strings;
+ i386fbsd_sigtramp_start = ps_strings - 128;
+ i386fbsd_sigtramp_end = ps_strings;
}
}
#endif
diff --git a/gdb/i386nbsd-tdep.c b/gdb/i386nbsd-tdep.c
index 02ba77c7be9..c327d426de4 100644
--- a/gdb/i386nbsd-tdep.c
+++ b/gdb/i386nbsd-tdep.c
@@ -137,16 +137,6 @@ static struct core_fns i386nbsd_elfcore_fns =
NULL /* next */
};
-/* FIXME: should be multi-arch'd */
-int
-i386nbsd_aout_use_struct_convention (int gcc_p, struct type *type)
-{
- return !(TYPE_LENGTH (type) == 1
- || TYPE_LENGTH (type) == 2
- || TYPE_LENGTH (type) == 4
- || TYPE_LENGTH (type) == 8);
-}
-
void
_initialize_i386nbsd_tdep (void)
{
diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c
index ab7e4674f75..44210d7d065 100644
--- a/gdb/ia64-tdep.c
+++ b/gdb/ia64-tdep.c
@@ -96,8 +96,8 @@ static gdbarch_frame_saved_pc_ftype ia64_frame_saved_pc;
static gdbarch_skip_prologue_ftype ia64_skip_prologue;
static gdbarch_frame_init_saved_regs_ftype ia64_frame_init_saved_regs;
static gdbarch_get_saved_register_ftype ia64_get_saved_register;
-static gdbarch_extract_return_value_ftype ia64_extract_return_value;
-static gdbarch_extract_struct_value_address_ftype ia64_extract_struct_value_address;
+static gdbarch_deprecated_extract_return_value_ftype ia64_extract_return_value;
+static gdbarch_deprecated_extract_struct_value_address_ftype ia64_extract_struct_value_address;
static gdbarch_use_struct_convention_ftype ia64_use_struct_convention;
static gdbarch_frameless_function_invocation_ftype ia64_frameless_function_invocation;
static gdbarch_init_extra_frame_info_ftype ia64_init_extra_frame_info;
@@ -2190,11 +2190,11 @@ ia64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_register_convert_to_raw (gdbarch, ia64_register_convert_to_raw);
set_gdbarch_use_struct_convention (gdbarch, ia64_use_struct_convention);
- set_gdbarch_extract_return_value (gdbarch, ia64_extract_return_value);
+ set_gdbarch_deprecated_extract_return_value (gdbarch, ia64_extract_return_value);
set_gdbarch_store_struct_return (gdbarch, ia64_store_struct_return);
set_gdbarch_store_return_value (gdbarch, ia64_store_return_value);
- set_gdbarch_extract_struct_value_address (gdbarch, ia64_extract_struct_value_address);
+ set_gdbarch_deprecated_extract_struct_value_address (gdbarch, ia64_extract_struct_value_address);
set_gdbarch_memory_insert_breakpoint (gdbarch, ia64_memory_insert_breakpoint);
set_gdbarch_memory_remove_breakpoint (gdbarch, ia64_memory_remove_breakpoint);
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index ae5d5253902..89138e80007 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -1847,7 +1847,7 @@ interrupt_target_command (char *args, int from_tty)
static void
float_info (char *addr_exp, int from_tty)
{
- PRINT_FLOAT_INFO ();
+ gdbarch_print_float_info (current_gdbarch, gdb_stdout, selected_frame);
}
/* ARGSUSED */
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 409fede4d1d..cb8f1086341 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -3914,7 +3914,9 @@ struct inferior_status
any registers. */
struct regcache *registers;
- int selected_level;
+ /* A frame unique identifier. */
+ struct frame_id selected_frame_id;
+
int breakpoint_proceeded;
int restore_stack_info;
int proceed_to_finish;
@@ -3965,38 +3967,21 @@ save_inferior_status (int restore_stack_info)
inf_status->registers = regcache_dup (current_regcache);
- record_selected_frame (&(inf_status->selected_frame_address),
- &(inf_status->selected_level));
+ get_frame_id (selected_frame, &inf_status->selected_frame_id);
return inf_status;
}
-struct restore_selected_frame_args
-{
- CORE_ADDR frame_address;
- int level;
-};
-
static int
restore_selected_frame (void *args)
{
- struct restore_selected_frame_args *fr =
- (struct restore_selected_frame_args *) args;
+ struct frame_id *fid = (struct frame_id *) args;
struct frame_info *frame;
- int level = fr->level;
- frame = find_relative_frame (get_current_frame (), &level);
+ frame = frame_find_by_id (*fid);
/* If inf_status->selected_frame_address is NULL, there was no
previously selected frame. */
- if (frame == NULL ||
- /* FRAME_FP (frame) != fr->frame_address || */
- /* elz: deleted this check as a quick fix to the problem that
- for function called by hand gdb creates no internal frame
- structure and the real stack and gdb's idea of stack are
- different if nested calls by hands are made.
-
- mvs: this worries me. */
- level != 0)
+ if (frame == NULL)
{
warning ("Unable to restore previously selected frame.\n");
return 0;
@@ -4046,19 +4031,14 @@ restore_inferior_status (struct inferior_status *inf_status)
if (target_has_stack && inf_status->restore_stack_info)
{
- struct restore_selected_frame_args fr;
- fr.level = inf_status->selected_level;
- fr.frame_address = inf_status->selected_frame_address;
/* The point of catch_errors is that if the stack is clobbered,
- walking the stack might encounter a garbage pointer and error()
- trying to dereference it. */
- if (catch_errors (restore_selected_frame, &fr,
+ walking the stack might encounter a garbage pointer and
+ error() trying to dereference it. */
+ if (catch_errors (restore_selected_frame, &inf_status->selected_frame_id,
"Unable to restore previously selected frame:\n",
RETURN_MASK_ERROR) == 0)
/* Error in restoring the selected frame. Select the innermost
frame. */
-
-
select_frame (get_current_frame ());
}
diff --git a/gdb/m68hc11-tdep.c b/gdb/m68hc11-tdep.c
index 6d00ab1faf5..38ec7e348e4 100644
--- a/gdb/m68hc11-tdep.c
+++ b/gdb/m68hc11-tdep.c
@@ -1117,7 +1117,7 @@ m68hc11_gdbarch_init (struct gdbarch_info info,
set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0);
set_gdbarch_get_saved_register (gdbarch, generic_get_saved_register);
set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy);
- set_gdbarch_extract_return_value (gdbarch, m68hc11_extract_return_value);
+ set_gdbarch_deprecated_extract_return_value (gdbarch, m68hc11_extract_return_value);
set_gdbarch_push_arguments (gdbarch, m68hc11_push_arguments);
set_gdbarch_push_dummy_frame (gdbarch, generic_push_dummy_frame);
set_gdbarch_push_return_address (gdbarch, m68hc11_push_return_address);
@@ -1125,8 +1125,7 @@ m68hc11_gdbarch_init (struct gdbarch_info info,
set_gdbarch_store_struct_return (gdbarch, m68hc11_store_struct_return);
set_gdbarch_store_return_value (gdbarch, m68hc11_store_return_value);
- set_gdbarch_extract_struct_value_address (gdbarch,
- m68hc11_extract_struct_value_address);
+ set_gdbarch_deprecated_extract_struct_value_address (gdbarch, m68hc11_extract_struct_value_address);
set_gdbarch_register_convertible (gdbarch, generic_register_convertible_not);
@@ -1143,7 +1142,7 @@ m68hc11_gdbarch_init (struct gdbarch_info info,
set_gdbarch_store_struct_return (gdbarch, m68hc11_store_struct_return);
set_gdbarch_store_return_value (gdbarch, m68hc11_store_return_value);
- set_gdbarch_extract_struct_value_address
+ set_gdbarch_deprecated_extract_struct_value_address
(gdbarch, m68hc11_extract_struct_value_address);
set_gdbarch_use_struct_convention (gdbarch, m68hc11_use_struct_convention);
set_gdbarch_init_extra_frame_info (gdbarch, m68hc11_init_extra_frame_info);
diff --git a/gdb/macrocmd.c b/gdb/macrocmd.c
new file mode 100644
index 00000000000..40b31541f90
--- /dev/null
+++ b/gdb/macrocmd.c
@@ -0,0 +1,287 @@
+/* C preprocessor macro expansion commands for GDB.
+ Copyright 2002 Free Software Foundation, Inc.
+ Contributed by Red Hat, 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 "defs.h"
+#include "macrotab.h"
+#include "macroexp.h"
+#include "macroscope.h"
+#include "command.h"
+#include "gdbcmd.h"
+
+
+/* The `macro' prefix command. */
+
+static struct cmd_list_element *macrolist;
+
+static void
+macro_command (char *arg, int from_tty)
+{
+ printf_unfiltered
+ ("\"macro\" must be followed by the name of a macro command.\n");
+ help_list (macrolist, "macro ", -1, gdb_stdout);
+}
+
+
+
+/* Macro expansion commands. */
+
+
+static void
+macro_expand_command (char *exp, int from_tty)
+{
+ struct macro_scope *ms = NULL;
+ char *expanded = NULL;
+ struct cleanup *cleanup_chain = make_cleanup (free_current_contents, &ms);
+ make_cleanup (free_current_contents, &expanded);
+
+ /* You know, when the user doesn't specify any expression, it would be
+ really cool if this defaulted to the last expression evaluated.
+ Then it would be easy to ask, "Hey, what did I just evaluate?" But
+ at the moment, the `print' commands don't save the last expression
+ evaluated, just its value. */
+ if (! exp || ! *exp)
+ error ("You must follow the `macro expand' command with the"
+ " expression you\n"
+ "want to expand.");
+
+ ms = default_macro_scope ();
+ if (ms)
+ {
+ expanded = macro_expand (exp, standard_macro_lookup, ms);
+ fputs_filtered ("expands to: ", gdb_stdout);
+ fputs_filtered (expanded, gdb_stdout);
+ fputs_filtered ("\n", gdb_stdout);
+ }
+ else
+ fputs_filtered ("GDB has no preprocessor macro information for "
+ "that code.\n",
+ gdb_stdout);
+
+ do_cleanups (cleanup_chain);
+ return;
+}
+
+
+static void
+macro_expand_once_command (char *exp, int from_tty)
+{
+ struct macro_scope *ms = NULL;
+ char *expanded = NULL;
+ struct cleanup *cleanup_chain = make_cleanup (free_current_contents, &ms);
+ make_cleanup (free_current_contents, &expanded);
+
+ /* You know, when the user doesn't specify any expression, it would be
+ really cool if this defaulted to the last expression evaluated.
+ And it should set the once-expanded text as the new `last
+ expression'. That way, you could just hit return over and over and
+ see the expression expanded one level at a time. */
+ if (! exp || ! *exp)
+ error ("You must follow the `macro expand-once' command with"
+ " the expression\n"
+ "you want to expand.");
+
+ ms = default_macro_scope ();
+ if (ms)
+ {
+ expanded = macro_expand_once (exp, standard_macro_lookup, ms);
+ fputs_filtered ("expands to: ", gdb_stdout);
+ fputs_filtered (expanded, gdb_stdout);
+ fputs_filtered ("\n", gdb_stdout);
+ }
+ else
+ fputs_filtered ("GDB has no preprocessor macro information for "
+ "that code.\n",
+ gdb_stdout);
+
+ do_cleanups (cleanup_chain);
+ return;
+}
+
+
+static void
+show_pp_source_pos (struct ui_file *stream,
+ struct macro_source_file *file,
+ int line)
+{
+ fprintf_filtered (stream, "%s:%d\n", file->filename, line);
+
+ while (file->included_by)
+ {
+ fprintf_filtered (gdb_stdout, " included at %s:%d\n",
+ file->included_by->filename,
+ file->included_at_line);
+ file = file->included_by;
+ }
+}
+
+
+static void
+info_macro_command (char *name, int from_tty)
+{
+ struct macro_scope *ms = NULL;
+ struct cleanup *cleanup_chain = make_cleanup (free_current_contents, &ms);
+ struct macro_definition *d;
+
+ if (! name || ! *name)
+ error ("You must follow the `info macro' command with the name"
+ " of the macro\n"
+ "whose definition you want to see.");
+
+ ms = default_macro_scope ();
+ if (! ms)
+ error ("GDB has no preprocessor macro information for that code.\n");
+
+ d = macro_lookup_definition (ms->file, ms->line, name);
+ if (d)
+ {
+ int line;
+ struct macro_source_file *file
+ = macro_definition_location (ms->file, ms->line, name, &line);
+
+ fprintf_filtered (gdb_stdout, "Defined at ");
+ show_pp_source_pos (gdb_stdout, file, line);
+ fprintf_filtered (gdb_stdout, "#define %s", name);
+ if (d->kind == macro_function_like)
+ {
+ int i;
+
+ fputs_filtered ("(", gdb_stdout);
+ for (i = 0; i < d->argc; i++)
+ {
+ fputs_filtered (d->argv[i], gdb_stdout);
+ if (i + 1 < d->argc)
+ fputs_filtered (", ", gdb_stdout);
+ }
+ fputs_filtered (")", gdb_stdout);
+ }
+ fprintf_filtered (gdb_stdout, " %s\n", d->replacement);
+ }
+ else
+ {
+ fprintf_filtered (gdb_stdout,
+ "The symbol `%s' has no definition as a C/C++"
+ " preprocessor macro\n"
+ "at ", name);
+ show_pp_source_pos (gdb_stdout, ms->file, ms->line);
+ }
+
+ do_cleanups (cleanup_chain);
+}
+
+
+
+/* User-defined macros. */
+
+/* A table of user-defined macros. Unlike the macro tables used for
+ symtabs, this one uses xmalloc for all its allocation, not an
+ obstack, and it doesn't bcache anything; it just xmallocs things. So
+ it's perfectly possible to remove things from this, or redefine
+ things. */
+static struct macro_table *user_macros;
+
+static void
+macro_define_command (char *exp, int from_tty)
+{
+ error ("Command not implemented yet.");
+}
+
+
+static void
+macro_undef_command (char *exp, int from_tty)
+{
+ error ("Command not implemented yet.");
+}
+
+
+static void
+macro_list_command (char *exp, int from_tty)
+{
+ error ("Command not implemented yet.");
+}
+
+
+
+/* Initializing the `macrocmd' module. */
+
+void
+_initialize_macrocmd (void)
+{
+ struct cmd_list_element *c;
+
+ /* We introduce a new command prefix, `macro', under which we'll put
+ the various commands for working with preprocessor macros. */
+ add_prefix_cmd
+ ("macro", class_info, macro_command,
+ "Prefix for commands dealing with C preprocessor macros.",
+ &macrolist, "macro ", 0, &cmdlist);
+
+ add_cmd
+ ("expand", no_class, macro_expand_command,
+ "Fully expand any C/C++ preprocessor macro invocations in EXPRESSION.\n"
+ "Show the expanded expression.",
+ &macrolist);
+ add_alias_cmd ("exp", "expand", no_class, 1, &macrolist);
+ add_cmd
+ ("expand-once", no_class, macro_expand_once_command,
+ "Expand C/C++ preprocessor macro invocations appearing directly in"
+ " EXPRESSION.\n"
+ "Show the expanded expression.\n"
+ "\n"
+ "This command differs from `macro expand' in that it only expands macro\n"
+ "invocations that appear directly in EXPRESSION; if expanding a macro\n"
+ "introduces further macro invocations, those are left unexpanded.\n"
+ "\n"
+ "`macro expand-once' helps you see how a particular macro expands,\n"
+ "whereas `macro expand' shows you how all the macros involved in an\n"
+ "expression work together to yield a pre-processed expression.",
+ &macrolist);
+ add_alias_cmd ("exp1", "expand-once", no_class, 1, &macrolist);
+
+ add_cmd
+ ("macro", no_class, info_macro_command,
+ "Show the definition of MACRO, and its source location.",
+ &infolist);
+
+ add_cmd
+ ("define", no_class, macro_define_command,
+ "Define a new C/C++ preprocessor macro.\n"
+ "The GDB command `macro define DEFINITION' is equivalent to placing a\n"
+ "preprocessor directive of the form `#define DEFINITION' such that the\n"
+ "definition is visible in all the inferior's source files.\n"
+ "For example:\n"
+ " (gdb) macro define PI (3.1415926)\n"
+ " (gdb) macro define MIN(x,y) ((x) < (y) ? (x) : (y))",
+ &macrolist);
+
+ add_cmd
+ ("undef", no_class, macro_undef_command,
+ "Remove the definition of the C/C++ preprocessor macro with the"
+ " given name.",
+ &macrolist);
+
+ add_cmd
+ ("list", no_class, macro_list_command,
+ "List all the macros defined using the `macro define' command.",
+ &macrolist);
+
+ user_macros = new_macro_table (0, 0);
+}
diff --git a/gdb/macroscope.c b/gdb/macroscope.c
new file mode 100644
index 00000000000..08ff6ebff58
--- /dev/null
+++ b/gdb/macroscope.c
@@ -0,0 +1,107 @@
+/* Functions for deciding which macros are currently in scope.
+ Copyright 2002 Free Software Foundation, Inc.
+ Contributed by Red Hat, 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 "defs.h"
+
+#include "macroscope.h"
+#include "symtab.h"
+#include "target.h"
+#include "frame.h"
+#include "inferior.h"
+
+
+struct macro_scope *
+sal_macro_scope (struct symtab_and_line sal)
+{
+ struct macro_source_file *main;
+ struct macro_scope *ms;
+
+ if (! sal.symtab
+ || ! sal.symtab->macro_table)
+ return 0;
+
+ ms = (struct macro_scope *) xmalloc (sizeof (*ms));
+
+ main = macro_main (sal.symtab->macro_table);
+ ms->file = macro_lookup_inclusion (main, sal.symtab->filename);
+
+ if (! ms->file)
+ internal_error
+ (__FILE__, __LINE__,
+ "\n"
+ "the symtab `%s' refers to a preprocessor macro table which doesn't\n"
+ "have any record of processing a file by that name.\n",
+ sal.symtab->filename);
+
+ ms->line = sal.line;
+
+ return ms;
+}
+
+
+struct macro_scope *
+default_macro_scope (void)
+{
+ struct symtab_and_line sal;
+ struct macro_source_file *main;
+ struct macro_scope *ms;
+
+ /* If there's a selected frame, use its PC. */
+ if (selected_frame)
+ sal = find_pc_line (selected_frame->pc, 0);
+
+ /* If the target has any registers at all, then use its PC. Why we
+ would have registers but no stack, I'm not sure. */
+ else if (target_has_registers)
+ sal = find_pc_line (read_pc (), 0);
+
+ /* If all else fails, fall back to the current listing position. */
+ else
+ {
+ /* Don't call select_source_symtab here. That can raise an
+ error if symbols aren't loaded, but GDB calls the expression
+ evaluator in all sorts of contexts.
+
+ For example, commands like `set width' call the expression
+ evaluator to evaluate their numeric arguments. If the
+ current language is C, then that may call this function to
+ choose a scope for macro expansion. If you don't have any
+ symbol files loaded, then select_source_symtab will raise an
+ error. But `set width' shouldn't raise an error just because
+ it can't decide which scope to macro-expand its argument in. */
+ sal.symtab = current_source_symtab;
+ sal.line = current_source_line;
+ }
+
+ return sal_macro_scope (sal);
+}
+
+
+/* Look up the definition of the macro named NAME in scope at the source
+ location given by BATON, which must be a pointer to a `struct
+ macro_scope' structure. */
+struct macro_definition *
+standard_macro_lookup (const char *name, void *baton)
+{
+ struct macro_scope *ms = (struct macro_scope *) baton;
+
+ return macro_lookup_definition (ms->file, ms->line, name);
+}
diff --git a/gdb/macroscope.h b/gdb/macroscope.h
new file mode 100644
index 00000000000..fc10b6dcd60
--- /dev/null
+++ b/gdb/macroscope.h
@@ -0,0 +1,63 @@
+/* Interface to functions for deciding which macros are currently in scope.
+ Copyright 2002 Free Software Foundation, Inc.
+ Contributed by Red Hat, 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 MACROSCOPE_H
+#define MACROSCOPE_H
+
+#include "macrotab.h"
+#include "symtab.h"
+
+
+/* All the information we need to decide which macro definitions are
+ in scope: a source file (either a main source file or an
+ #inclusion), and a line number in that file. */
+struct macro_scope {
+ struct macro_source_file *file;
+ int line;
+};
+
+
+/* Return a `struct macro_scope' object corresponding to the symtab
+ and line given in SAL. If we have no macro information for that
+ location, or if SAL's pc is zero, return zero. */
+struct macro_scope *sal_macro_scope (struct symtab_and_line sal);
+
+
+/* Return a `struct macro_scope' object describing the scope the `macro
+ expand' and `macro expand-once' commands should use for looking up
+ macros. If we have a selected frame, this is the source location of
+ its PC; otherwise, this is the last listing position.
+
+ If we have no macro information for the current location, return zero.
+
+ The object returned is allocated using xmalloc; the caller is
+ responsible for freeing it. */
+struct macro_scope *default_macro_scope (void);
+
+
+/* Look up the definition of the macro named NAME in scope at the source
+ location given by BATON, which must be a pointer to a `struct
+ macro_scope' structure. This function is suitable for use as
+ a macro_lookup_ftype function. */
+struct macro_definition *standard_macro_lookup (const char *name, void *baton);
+
+
+#endif /* MACROSCOPE_H */
diff --git a/gdb/macrotab.c b/gdb/macrotab.c
index d979a91b71f..bb615a55723 100644
--- a/gdb/macrotab.c
+++ b/gdb/macrotab.c
@@ -660,27 +660,64 @@ find_definition (const char *name,
}
-/* If NAME already has a definition in scope at LINE in FILE, and
- return the key. Otherwise, return zero. */
+/* If NAME already has a definition in scope at LINE in SOURCE, return
+ the key. If the old definition is different from the definition
+ given by KIND, ARGC, ARGV, and REPLACEMENT, complain, too.
+ Otherwise, return zero. (ARGC and ARGV are meaningless unless KIND
+ is `macro_function_like'.) */
static struct macro_key *
check_for_redefinition (struct macro_source_file *source, int line,
- const char *name)
+ const char *name, enum macro_kind kind,
+ int argc, const char **argv,
+ const char *replacement)
{
splay_tree_node n = find_definition (name, source, line);
- /* This isn't really right. There's nothing wrong with redefining a
- macro if the new replacement list is the same as the old one. */
if (n)
{
struct macro_key *found_key = (struct macro_key *) n->key;
- static struct complaint macro_redefined = {
- "macro `%s' redefined at %s:%d;"
- "original definition at %s:%d", 0, 0
- };
- complain (&macro_redefined, name,
- source->filename, line,
- found_key->start_file->filename,
- found_key->start_line);
+ struct macro_definition *found_def
+ = (struct macro_definition *) n->value;
+ int same = 1;
+
+ /* Is this definition the same as the existing one?
+ According to the standard, this comparison needs to be done
+ on lists of tokens, not byte-by-byte, as we do here. But
+ that's too hard for us at the moment, and comparing
+ byte-by-byte will only yield false negatives (i.e., extra
+ warning messages), not false positives (i.e., unnoticed
+ definition changes). */
+ if (kind != found_def->kind)
+ same = 0;
+ else if (strcmp (replacement, found_def->replacement))
+ same = 0;
+ else if (kind == macro_function_like)
+ {
+ if (argc != found_def->argc)
+ same = 0;
+ else
+ {
+ int i;
+
+ for (i = 0; i < argc; i++)
+ if (strcmp (argv[i], found_def->argv[i]))
+ same = 0;
+ }
+ }
+
+ if (! same)
+ {
+ static struct complaint macro_redefined = {
+ "macro `%s' redefined at %s:%d; original definition at %s:%d",
+ 0, 0
+ };
+ complain (&macro_redefined,
+ name,
+ source->filename, line,
+ found_key->start_file->filename,
+ found_key->start_line);
+ }
+
return found_key;
}
else
@@ -696,7 +733,10 @@ macro_define_object (struct macro_source_file *source, int line,
struct macro_key *k;
struct macro_definition *d;
- k = check_for_redefinition (source, line, name);
+ k = check_for_redefinition (source, line,
+ name, macro_object_like,
+ 0, 0,
+ replacement);
/* If we're redefining a symbol, and the existing key would be
identical to our new key, then the splay_tree_insert function
@@ -726,7 +766,10 @@ macro_define_function (struct macro_source_file *source, int line,
struct macro_key *k;
struct macro_definition *d;
- k = check_for_redefinition (source, line, name);
+ k = check_for_redefinition (source, line,
+ name, macro_function_like,
+ argc, argv,
+ replacement);
/* See comments about duplicate keys in macro_define_object. */
if (k && ! key_compare (k, name, source, line))
diff --git a/gdb/mi/ChangeLog b/gdb/mi/ChangeLog
index bb529748feb..fb029512645 100644
--- a/gdb/mi/ChangeLog
+++ b/gdb/mi/ChangeLog
@@ -11,6 +11,17 @@
(register_changed_p): Use regbuf_read and regbuf_write.
(setup_architecture_data): Use regbuf_xmalloc.
+2002-05-20 Keith Seitz <keiths@redhat.com>
+
+ * mi-main.c (captured_mi_execute_command): Add uiout parameter.
+ "data" is now a structure which is used to pass data to/from this
+ function to mi_execute_command.
+ Modify function to comply with requirements from catch_exceptions.
+ Store real return result and command's return result in data.
+ (mi_execute_command): Use catch_exceptions.
+ Use enum to handle actions to be performed instead of overloading
+ catch_errors return result and the mi return result.
+
2002-04-14 Andrew Cagney <ac131313@redhat.com>
* mi-main.c (mi_cmd_exec_return):
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index 33f1cc723e9..d0e63e9a85a 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -48,6 +48,29 @@ enum
FROM_TTY = 0
};
+/* Enumerations of the actions that may result from calling
+ captured_mi_execute_command */
+
+enum captured_mi_execute_command_actions
+ {
+ EXECUTE_COMMAND_DISPLAY_PROMPT,
+ EXECUTE_COMMAND_SUPRESS_PROMPT,
+ EXECUTE_COMMAND_DISPLAY_ERROR
+ };
+
+/* This structure is used to pass information from captured_mi_execute_command
+ to mi_execute_command. */
+struct captured_mi_execute_command_args
+{
+ /* This return result of the MI command (output) */
+ enum mi_cmd_result rc;
+
+ /* What action to perform when the call is finished (output) */
+ enum captured_mi_execute_command_actions action;
+
+ /* The command context to be executed (input) */
+ struct mi_parse *command;
+};
int mi_debug_p;
struct ui_file *raw_stdout;
@@ -1023,15 +1046,19 @@ mi_cmd_data_write_memory (char *command, char **argv, int argc)
return MI_CMD_DONE;
}
-/* Execute a command within a safe environment. Return >0 for
- ok. Return <0 for supress prompt. Return 0 to have the error
- extracted from error_last_message(). */
+/* Execute a command within a safe environment.
+ Return <0 for error; >=0 for ok.
+
+ args->action will tell mi_execute_command what action
+ to perfrom after the given command has executed (display/supress
+ prompt, display error). */
static int
-captured_mi_execute_command (void *data)
+captured_mi_execute_command (struct ui_out *uiout, void *data)
{
- struct mi_parse *context = data;
- enum mi_cmd_result rc;
+ struct captured_mi_execute_command_args *args =
+ (struct captured_mi_execute_command_args *) data;
+ struct mi_parse *context = args->command;
switch (context->op)
{
@@ -1046,11 +1073,13 @@ captured_mi_execute_command (void *data)
condition expression, each function should return an
indication of what action is required and then switch on
that. */
- rc = mi_cmd_execute (context);
+ args->action = EXECUTE_COMMAND_DISPLAY_PROMPT;
+ args->rc = mi_cmd_execute (context);
+
if (!target_can_async_p () || !target_executing)
{
/* print the result if there were no errors */
- if (rc == MI_CMD_DONE)
+ if (args->rc == MI_CMD_DONE)
{
fputs_unfiltered (context->token, raw_stdout);
fputs_unfiltered ("^done", raw_stdout);
@@ -1058,7 +1087,7 @@ captured_mi_execute_command (void *data)
mi_out_rewind (uiout);
fputs_unfiltered ("\n", raw_stdout);
}
- else if (rc == MI_CMD_ERROR)
+ else if (args->rc == MI_CMD_ERROR)
{
if (mi_error_message)
{
@@ -1070,18 +1099,22 @@ captured_mi_execute_command (void *data)
}
mi_out_rewind (uiout);
}
- else if (rc == MI_CMD_CAUGHT_ERROR)
+ else if (args->rc == MI_CMD_CAUGHT_ERROR)
{
mi_out_rewind (uiout);
- return 0;
+ args->action = EXECUTE_COMMAND_DISPLAY_ERROR;
+ return 1;
}
else
mi_out_rewind (uiout);
}
else if (sync_execution)
- /* Don't print the prompt. We are executing the target in
- synchronous mode. */
- return -1;
+ {
+ /* Don't print the prompt. We are executing the target in
+ synchronous mode. */
+ args->action = EXECUTE_COMMAND_SUPRESS_PROMPT;
+ return 1;
+ }
break;
case CLI_COMMAND:
@@ -1100,9 +1133,12 @@ captured_mi_execute_command (void *data)
mi_out_put (uiout, raw_stdout);
mi_out_rewind (uiout);
fputs_unfiltered ("\n", raw_stdout);
+ args->action = EXECUTE_COMMAND_DISPLAY_PROMPT;
+ args->rc = MI_CMD_DONE;
break;
}
+
return 1;
}
@@ -1111,6 +1147,9 @@ void
mi_execute_command (char *cmd, int from_tty)
{
struct mi_parse *command;
+ struct captured_mi_execute_command_args args;
+ struct ui_out *saved_uiout = uiout;
+ int result, rc;
/* This is to handle EOF (^D). We just quit gdb. */
/* FIXME: we should call some API function here. */
@@ -1121,18 +1160,20 @@ mi_execute_command (char *cmd, int from_tty)
if (command != NULL)
{
- /* FIXME: cagney/1999-11-04: Can this use of catch_errors either
+ /* FIXME: cagney/1999-11-04: Can this use of catch_exceptions either
be pushed even further down or even eliminated? */
- int rc = catch_errors (captured_mi_execute_command, command, "",
- RETURN_MASK_ALL);
- if (rc < 0)
+ args.command = command;
+ result = catch_exceptions (uiout, captured_mi_execute_command, &args, "",
+ RETURN_MASK_ALL);
+
+ if (args.action == EXECUTE_COMMAND_SUPRESS_PROMPT)
{
/* The command is executing synchronously. Bail out early
suppressing the finished prompt. */
mi_parse_free (command);
return;
}
- if (rc == 0)
+ if (args.action == EXECUTE_COMMAND_DISPLAY_ERROR || result < 0)
{
char *msg = error_last_message ();
struct cleanup *cleanup = make_cleanup (xfree, msg);
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index 16ebaca7eb7..d7f6d855ea0 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -38,6 +38,7 @@
#include "target.h"
#include "arch-utils.h"
#include "regcache.h"
+#include "osabi.h"
#include "opcode/mips.h"
#include "elf/mips.h"
@@ -105,12 +106,6 @@ enum mips_fpu_type
#endif
static int mips_fpu_type_auto = 1;
static enum mips_fpu_type mips_fpu_type = MIPS_DEFAULT_FPU_TYPE;
-#define MIPS_FPU_TYPE mips_fpu_type
-
-/* Do not use "TARGET_IS_MIPS64" to test the size of floating point registers */
-#ifndef FP_REGISTER_DOUBLE
-#define FP_REGISTER_DOUBLE (REGISTER_VIRTUAL_SIZE(FP0_REGNUM) == 8)
-#endif
static int mips_debug = 0;
@@ -119,6 +114,7 @@ struct gdbarch_tdep
{
/* from the elf header */
int elf_flags;
+
/* mips options */
enum mips_abi mips_abi;
const char *mips_abi_string;
@@ -131,37 +127,22 @@ struct gdbarch_tdep
int mips_default_stack_argsize;
int gdb_target_is_mips64;
int default_mask_address_p;
+
+ enum gdb_osabi osabi;
};
-#if GDB_MULTI_ARCH
-#undef MIPS_EABI
#define MIPS_EABI (gdbarch_tdep (current_gdbarch)->mips_abi == MIPS_ABI_EABI32 \
|| gdbarch_tdep (current_gdbarch)->mips_abi == MIPS_ABI_EABI64)
-#endif
-#if GDB_MULTI_ARCH
-#undef MIPS_LAST_FP_ARG_REGNUM
#define MIPS_LAST_FP_ARG_REGNUM (gdbarch_tdep (current_gdbarch)->mips_last_fp_arg_regnum)
-#endif
-#if GDB_MULTI_ARCH
-#undef MIPS_LAST_ARG_REGNUM
#define MIPS_LAST_ARG_REGNUM (gdbarch_tdep (current_gdbarch)->mips_last_arg_regnum)
-#endif
-#if GDB_MULTI_ARCH
-#undef MIPS_FPU_TYPE
#define MIPS_FPU_TYPE (gdbarch_tdep (current_gdbarch)->mips_fpu_type)
-#endif
/* Return the currently configured (or set) saved register size. */
-#if GDB_MULTI_ARCH
-#undef MIPS_DEFAULT_SAVED_REGSIZE
#define MIPS_DEFAULT_SAVED_REGSIZE (gdbarch_tdep (current_gdbarch)->mips_default_saved_regsize)
-#elif !defined (MIPS_DEFAULT_SAVED_REGSIZE)
-#define MIPS_DEFAULT_SAVED_REGSIZE MIPS_REGSIZE
-#endif
static const char *mips_saved_regsize_string = size_auto;
@@ -208,31 +189,18 @@ mips2_fp_compat (void)
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. */
-#if GDB_MULTI_ARCH
-#undef FP_REGISTER_DOUBLE
#define FP_REGISTER_DOUBLE (gdbarch_tdep (current_gdbarch)->mips_fp_register_double)
-#endif
/* Does the caller allocate a ``home'' for each register used in the
function call? The N32 ABI and MIPS_EABI do not, the others do. */
-#if GDB_MULTI_ARCH
-#undef MIPS_REGS_HAVE_HOME_P
#define MIPS_REGS_HAVE_HOME_P (gdbarch_tdep (current_gdbarch)->mips_regs_have_home_p)
-#elif !defined (MIPS_REGS_HAVE_HOME_P)
-#define MIPS_REGS_HAVE_HOME_P (!MIPS_EABI)
-#endif
/* The amount of space reserved on the stack for registers. This is
different to MIPS_SAVED_REGSIZE as it determines the alignment of
data allocated after the registers have run out. */
-#if GDB_MULTI_ARCH
-#undef MIPS_DEFAULT_STACK_ARGSIZE
#define MIPS_DEFAULT_STACK_ARGSIZE (gdbarch_tdep (current_gdbarch)->mips_default_stack_argsize)
-#elif !defined (MIPS_DEFAULT_STACK_ARGSIZE)
-#define MIPS_DEFAULT_STACK_ARGSIZE (MIPS_DEFAULT_SAVED_REGSIZE)
-#endif
#define MIPS_STACK_ARGSIZE (mips_stack_argsize ())
@@ -249,17 +217,9 @@ mips_stack_argsize (void)
return 4;
}
-#if GDB_MULTI_ARCH
-#undef GDB_TARGET_IS_MIPS64
#define GDB_TARGET_IS_MIPS64 (gdbarch_tdep (current_gdbarch)->gdb_target_is_mips64 + 0)
-#endif
-#if GDB_MULTI_ARCH
-#undef MIPS_DEFAULT_MASK_ADDRESS_P
#define MIPS_DEFAULT_MASK_ADDRESS_P (gdbarch_tdep (current_gdbarch)->default_mask_address_p)
-#elif !defined (MIPS_DEFAULT_MASK_ADDRESS_P)
-#define MIPS_DEFAULT_MASK_ADDRESS_P (0)
-#endif
#define VM_MIN_ADDRESS (CORE_ADDR)0x400000
@@ -421,6 +381,8 @@ static unsigned int heuristic_fence_post = 0;
#define PROC_REG_OFFSET(proc) ((proc)->pdr.regoffset)
#define PROC_FREG_OFFSET(proc) ((proc)->pdr.fregoffset)
#define PROC_PC_REG(proc) ((proc)->pdr.pcreg)
+/* FIXME drow/2002-06-10: If a pointer on the host is bigger than a long,
+ this will corrupt pdr.iline. Fortunately we don't use it. */
#define PROC_SYMBOL(proc) (*(struct symbol**)&(proc)->pdr.isym)
#define _PROC_MAGIC_ 0x0F0F0F0F
#define PROC_DESC_IS_DUMMY(proc) ((proc)->pdr.isym == _PROC_MAGIC_)
@@ -1928,6 +1890,30 @@ heuristic_proc_desc (CORE_ADDR start_pc, CORE_ADDR limit_pc,
return &temp_proc_desc;
}
+struct mips_objfile_private
+{
+ bfd_size_type size;
+ char *contents;
+};
+
+/* Global used to communicate between non_heuristic_proc_desc and
+ compare_pdr_entries within qsort (). */
+static bfd *the_bfd;
+
+static int
+compare_pdr_entries (const void *a, const void *b)
+{
+ CORE_ADDR lhs = bfd_get_32 (the_bfd, (bfd_byte *) a);
+ CORE_ADDR rhs = bfd_get_32 (the_bfd, (bfd_byte *) b);
+
+ if (lhs < rhs)
+ return -1;
+ else if (lhs == rhs)
+ return 0;
+ else
+ return 1;
+}
+
static mips_extra_func_info_t
non_heuristic_proc_desc (CORE_ADDR pc, CORE_ADDR *addrptr)
{
@@ -1935,23 +1921,145 @@ non_heuristic_proc_desc (CORE_ADDR pc, CORE_ADDR *addrptr)
mips_extra_func_info_t proc_desc;
struct block *b = block_for_pc (pc);
struct symbol *sym;
+ struct obj_section *sec;
+ struct mips_objfile_private *priv;
+
+ if (PC_IN_CALL_DUMMY (pc, 0, 0))
+ return NULL;
find_pc_partial_function (pc, NULL, &startaddr, NULL);
if (addrptr)
*addrptr = startaddr;
- if (b == NULL || PC_IN_CALL_DUMMY (pc, 0, 0))
- sym = NULL;
- else
+
+ priv = NULL;
+
+ sec = find_pc_section (pc);
+ if (sec != NULL)
{
- if (startaddr > BLOCK_START (b))
- /* This is the "pathological" case referred to in a comment in
- print_frame_info. It might be better to move this check into
- symbol reading. */
- sym = NULL;
- else
- sym = lookup_symbol (MIPS_EFI_SYMBOL_NAME, b, LABEL_NAMESPACE, 0, NULL);
+ priv = (struct mips_objfile_private *) sec->objfile->obj_private;
+
+ /* Search the ".pdr" section generated by GAS. This includes most of
+ the information normally found in ECOFF PDRs. */
+
+ the_bfd = sec->objfile->obfd;
+ if (priv == NULL
+ && (the_bfd->format == bfd_object
+ && bfd_get_flavour (the_bfd) == bfd_target_elf_flavour
+ && elf_elfheader (the_bfd)->e_ident[EI_CLASS] == ELFCLASS64))
+ {
+ /* Right now GAS only outputs the address as a four-byte sequence.
+ This means that we should not bother with this method on 64-bit
+ targets (until that is fixed). */
+
+ priv = obstack_alloc (& sec->objfile->psymbol_obstack,
+ sizeof (struct mips_objfile_private));
+ priv->size = 0;
+ sec->objfile->obj_private = priv;
+ }
+ else if (priv == NULL)
+ {
+ asection *bfdsec;
+
+ priv = obstack_alloc (& sec->objfile->psymbol_obstack,
+ sizeof (struct mips_objfile_private));
+
+ bfdsec = bfd_get_section_by_name (sec->objfile->obfd, ".pdr");
+ if (bfdsec != NULL)
+ {
+ priv->size = bfd_section_size (sec->objfile->obfd, bfdsec);
+ priv->contents = obstack_alloc (& sec->objfile->psymbol_obstack,
+ priv->size);
+ bfd_get_section_contents (sec->objfile->obfd, bfdsec,
+ priv->contents, 0, priv->size);
+
+ /* In general, the .pdr section is sorted. However, in the
+ presence of multiple code sections (and other corner cases)
+ it can become unsorted. Sort it so that we can use a faster
+ binary search. */
+ qsort (priv->contents, priv->size / 32, 32, compare_pdr_entries);
+ }
+ else
+ priv->size = 0;
+
+ sec->objfile->obj_private = priv;
+ }
+ the_bfd = NULL;
+
+ if (priv->size != 0)
+ {
+ int low, mid, high;
+ char *ptr;
+
+ low = 0;
+ high = priv->size / 32;
+
+ do
+ {
+ CORE_ADDR pdr_pc;
+
+ mid = (low + high) / 2;
+
+ ptr = priv->contents + mid * 32;
+ pdr_pc = bfd_get_signed_32 (sec->objfile->obfd, ptr);
+ pdr_pc += ANOFFSET (sec->objfile->section_offsets,
+ SECT_OFF_TEXT (sec->objfile));
+ if (pdr_pc == startaddr)
+ break;
+ if (pdr_pc > startaddr)
+ high = mid;
+ else
+ low = mid + 1;
+ }
+ while (low != high);
+
+ if (low != high)
+ {
+ struct symbol *sym = find_pc_function (pc);
+
+ /* Fill in what we need of the proc_desc. */
+ proc_desc = (mips_extra_func_info_t)
+ obstack_alloc (&sec->objfile->psymbol_obstack,
+ sizeof (struct mips_extra_func_info));
+ PROC_LOW_ADDR (proc_desc) = startaddr;
+
+ /* Only used for dummy frames. */
+ PROC_HIGH_ADDR (proc_desc) = 0;
+
+ PROC_FRAME_OFFSET (proc_desc)
+ = bfd_get_32 (sec->objfile->obfd, ptr + 20);
+ PROC_FRAME_REG (proc_desc) = bfd_get_32 (sec->objfile->obfd,
+ ptr + 24);
+ PROC_FRAME_ADJUST (proc_desc) = 0;
+ PROC_REG_MASK (proc_desc) = bfd_get_32 (sec->objfile->obfd,
+ ptr + 4);
+ PROC_FREG_MASK (proc_desc) = bfd_get_32 (sec->objfile->obfd,
+ ptr + 12);
+ PROC_REG_OFFSET (proc_desc) = bfd_get_32 (sec->objfile->obfd,
+ ptr + 8);
+ PROC_FREG_OFFSET (proc_desc)
+ = bfd_get_32 (sec->objfile->obfd, ptr + 16);
+ PROC_PC_REG (proc_desc) = bfd_get_32 (sec->objfile->obfd,
+ ptr + 28);
+ proc_desc->pdr.isym = (long) sym;
+
+ return proc_desc;
+ }
+ }
}
+ if (b == NULL)
+ return NULL;
+
+ if (startaddr > BLOCK_START (b))
+ {
+ /* This is the "pathological" case referred to in a comment in
+ print_frame_info. It might be better to move this check into
+ symbol reading. */
+ return NULL;
+ }
+
+ sym = lookup_symbol (MIPS_EFI_SYMBOL_NAME, b, LABEL_NAMESPACE, 0, NULL);
+
/* If we never found a PDR for this function in symbol reading, then
examine prologues to find the information. */
if (sym)
@@ -3563,10 +3671,7 @@ set_mipsfpu_single_command (char *args, int from_tty)
{
mips_fpu_type = MIPS_FPU_SINGLE;
mips_fpu_type_auto = 0;
- if (GDB_MULTI_ARCH)
- {
- gdbarch_tdep (current_gdbarch)->mips_fpu_type = MIPS_FPU_SINGLE;
- }
+ gdbarch_tdep (current_gdbarch)->mips_fpu_type = MIPS_FPU_SINGLE;
}
static void
@@ -3574,10 +3679,7 @@ set_mipsfpu_double_command (char *args, int from_tty)
{
mips_fpu_type = MIPS_FPU_DOUBLE;
mips_fpu_type_auto = 0;
- if (GDB_MULTI_ARCH)
- {
- gdbarch_tdep (current_gdbarch)->mips_fpu_type = MIPS_FPU_DOUBLE;
- }
+ gdbarch_tdep (current_gdbarch)->mips_fpu_type = MIPS_FPU_DOUBLE;
}
static void
@@ -3585,10 +3687,7 @@ set_mipsfpu_none_command (char *args, int from_tty)
{
mips_fpu_type = MIPS_FPU_NONE;
mips_fpu_type_auto = 0;
- if (GDB_MULTI_ARCH)
- {
- gdbarch_tdep (current_gdbarch)->mips_fpu_type = MIPS_FPU_NONE;
- }
+ gdbarch_tdep (current_gdbarch)->mips_fpu_type = MIPS_FPU_NONE;
}
static void
@@ -4122,6 +4221,32 @@ mips_integer_to_address (struct type *type, void *buf)
TYPE_LENGTH (builtin_type_void_data_ptr));
}
+static void
+mips_find_abi_section (bfd *abfd, asection *sect, void *obj)
+{
+ enum mips_abi *abip = (enum mips_abi *) obj;
+ const char *name = bfd_get_section_name (abfd, sect);
+
+ if (*abip != MIPS_ABI_UNKNOWN)
+ return;
+
+ if (strncmp (name, ".mdebug.", 8) != 0)
+ return;
+
+ if (strcmp (name, ".mdebug.abi32") == 0)
+ *abip = MIPS_ABI_O32;
+ else if (strcmp (name, ".mdebug.abiN32") == 0)
+ *abip = MIPS_ABI_N32;
+ else if (strcmp (name, ".mdebug.abiO64") == 0)
+ *abip = MIPS_ABI_O64;
+ else if (strcmp (name, ".mdebug.eabi32") == 0)
+ *abip = MIPS_ABI_EABI32;
+ else if (strcmp (name, ".mdebug.eabi64") == 0)
+ *abip = MIPS_ABI_EABI64;
+ else
+ warning ("unsupported ABI %s.", name + 8);
+}
+
static struct gdbarch *
mips_gdbarch_init (struct gdbarch_info info,
struct gdbarch_list *arches)
@@ -4132,6 +4257,7 @@ mips_gdbarch_init (struct gdbarch_info info,
struct gdbarch_tdep *tdep;
int elf_flags;
enum mips_abi mips_abi;
+ enum gdb_osabi osabi = GDB_OSABI_UNKNOWN;
/* Reset the disassembly info, in case it was set to something
non-default. */
@@ -4139,12 +4265,18 @@ mips_gdbarch_init (struct gdbarch_info info,
tm_print_insn_info.arch = bfd_arch_unknown;
tm_print_insn_info.mach = 0;
- /* Extract the elf_flags if available */
- if (info.abfd != NULL
- && bfd_get_flavour (info.abfd) == bfd_target_elf_flavour)
- elf_flags = elf_elfheader (info.abfd)->e_flags;
- else
- elf_flags = 0;
+ elf_flags = 0;
+
+ if (info.abfd)
+ {
+ /* First of all, extract the elf_flags, if available. */
+ if (bfd_get_flavour (info.abfd) == bfd_target_elf_flavour)
+ elf_flags = elf_elfheader (info.abfd)->e_flags;
+
+ /* Try to determine the OS ABI of the object we are loading. If
+ we end up with `unknown', just leave it that way. */
+ osabi = gdbarch_lookup_osabi (info.abfd);
+ }
/* Check ELF_FLAGS to see if it specifies the ABI being used. */
switch ((elf_flags & EF_MIPS_ABI))
@@ -4169,6 +4301,10 @@ mips_gdbarch_init (struct gdbarch_info info,
break;
}
+ /* GCC creates a pseudo-section whose name describes the ABI. */
+ if (mips_abi == MIPS_ABI_UNKNOWN && info.abfd != NULL)
+ bfd_map_over_sections (info.abfd, mips_find_abi_section, &mips_abi);
+
/* Try the architecture for any hint of the corect ABI */
if (mips_abi == MIPS_ABI_UNKNOWN
&& info.bfd_arch_info != NULL
@@ -4215,13 +4351,15 @@ mips_gdbarch_init (struct gdbarch_info info,
continue;
if (gdbarch_tdep (arches->gdbarch)->mips_abi != mips_abi)
continue;
- return arches->gdbarch;
+ if (gdbarch_tdep (arches->gdbarch)->osabi == osabi)
+ return arches->gdbarch;
}
/* Need a new architecture. Fill in a target specific vector. */
tdep = (struct gdbarch_tdep *) xmalloc (sizeof (struct gdbarch_tdep));
gdbarch = gdbarch_alloc (&info, tdep);
tdep->elf_flags = elf_flags;
+ tdep->osabi = osabi;
/* Initially set everything according to the default ABI/ISA. */
set_gdbarch_short_bit (gdbarch, 16);
@@ -4433,6 +4571,10 @@ mips_gdbarch_init (struct gdbarch_info info,
set_gdbarch_pointer_to_address (gdbarch, signed_pointer_to_address);
set_gdbarch_address_to_pointer (gdbarch, address_to_signed_pointer);
set_gdbarch_integer_to_address (gdbarch, mips_integer_to_address);
+
+ /* Hook in OS ABI-specific overrides, if they have been registered. */
+ gdbarch_init_osabi (info, gdbarch, osabi);
+
return gdbarch;
}
@@ -4841,6 +4983,10 @@ mips_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file)
fprintf_unfiltered (file,
"mips_dump_tdep: _PROC_MAGIC_ = %d\n",
_PROC_MAGIC_);
+
+ fprintf_unfiltered (file,
+ "mips_dump_tdep: OS ABI = %s\n",
+ gdbarch_osabi_name (tdep->osabi));
}
void
@@ -4919,21 +5065,6 @@ This option can be set to one of:\n\
"Show current use of MIPS floating-point coprocessor target.",
&showlist);
-#if !GDB_MULTI_ARCH
- c = add_set_cmd ("processor", class_support, var_string_noescape,
- (char *) &tmp_mips_processor_type,
- "Set the type of MIPS processor in use.\n\
-Set this to be able to access processor-type-specific registers.\n\
-",
- &setlist);
- set_cmd_cfunc (c, mips_set_processor_type_command);
- c = add_show_from_set (c, &showlist);
- set_cmd_cfunc (c, mips_show_processor_type_command);
-
- tmp_mips_processor_type = xstrdup (DEFAULT_MIPS_TYPE);
- mips_set_processor_type_command (xstrdup (DEFAULT_MIPS_TYPE), 0);
-#endif
-
/* We really would like to have both "0" and "unlimited" work, but
command.c doesn't deal with that. So make it a var_zinteger
because the user can always use "999999" or some such for unlimited. */
diff --git a/gdb/mipsnbsd-nat.c b/gdb/mipsnbsd-nat.c
new file mode 100644
index 00000000000..16521f67617
--- /dev/null
+++ b/gdb/mipsnbsd-nat.c
@@ -0,0 +1,101 @@
+/* Native-dependent code for MIPS systems running NetBSD.
+ Copyright 2000, 2001, 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. */
+
+#include "defs.h"
+#include "inferior.h"
+#include "regcache.h"
+
+#include "mipsnbsd-tdep.h"
+
+#include <sys/types.h>
+#include <sys/ptrace.h>
+#include <machine/reg.h>
+
+/* Determine if PT_GETREGS fetches this register. */
+static int
+getregs_supplies (int regno)
+{
+ return ((regno) >= ZERO_REGNUM && (regno) <= PC_REGNUM);
+}
+
+void
+fetch_inferior_registers (int regno)
+{
+ if (regno == -1 || getregs_supplies (regno))
+ {
+ struct reg regs;
+
+ if (ptrace (PT_GETREGS, PIDGET (inferior_ptid),
+ (PTRACE_ARG3_TYPE) &regs, 0) == -1)
+ perror_with_name ("Couldn't get registers");
+
+ mipsnbsd_supply_reg ((char *) &regs, regno);
+ if (regno != -1)
+ return;
+ }
+
+ if (regno == -1 || regno >= FP0_REGNUM)
+ {
+ struct fpreg fpregs;
+
+ if (ptrace (PT_GETFPREGS, PIDGET (inferior_ptid),
+ (PTRACE_ARG3_TYPE) &fpregs, 0) == -1)
+ perror_with_name ("Couldn't get floating point status");
+
+ mipsnbsd_supply_fpreg ((char *) &fpregs, regno);
+ }
+}
+
+void
+store_inferior_registers (int regno)
+{
+ if (regno == -1 || getregs_supplies (regno))
+ {
+ struct reg regs;
+
+ if (ptrace (PT_GETREGS, PIDGET (inferior_ptid),
+ (PTRACE_ARG3_TYPE) &regs, 0) == -1)
+ perror_with_name ("Couldn't get registers");
+
+ mipsnbsd_fill_reg ((char *) &regs, regno);
+
+ if (ptrace (PT_SETREGS, PIDGET (inferior_ptid),
+ (PTRACE_ARG3_TYPE) &regs, 0) == -1)
+ perror_with_name ("Couldn't write registers");
+
+ if (regno != -1)
+ return;
+ }
+
+ if (regno == -1 || regno >= FP0_REGNUM)
+ {
+ struct fpreg fpregs;
+
+ if (ptrace (PT_GETFPREGS, PIDGET (inferior_ptid),
+ (PTRACE_ARG3_TYPE) &fpregs, 0) == -1)
+ perror_with_name ("Couldn't get floating point status");
+
+ mipsnbsd_fill_fpreg ((char *) &fpregs, regno);
+
+ if (ptrace (PT_SETFPREGS, PIDGET (inferior_ptid),
+ (PTRACE_ARG3_TYPE) &fpregs, 0) == -1)
+ perror_with_name ("Couldn't write floating point status");
+ }
+}
diff --git a/gdb/mipsnbsd-tdep.c b/gdb/mipsnbsd-tdep.c
new file mode 100644
index 00000000000..029ae6f28bc
--- /dev/null
+++ b/gdb/mipsnbsd-tdep.c
@@ -0,0 +1,367 @@
+/* Target-dependent code for MIPS systems running NetBSD.
+ Copyright 2002 Free Software Foundation, Inc.
+ Contributed by Wasabi Systems, 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 "defs.h"
+#include "gdbcore.h"
+#include "regcache.h"
+#include "target.h"
+#include "value.h"
+#include "osabi.h"
+
+#include "mipsnbsd-tdep.h"
+
+#include "solib-svr4.h"
+
+/* Conveniently, GDB uses the same register numbering as the
+ ptrace register structure used by NetBSD/mips. */
+
+void
+mipsnbsd_supply_reg (char *regs, int regno)
+{
+ int i;
+
+ for (i = 0; i <= PC_REGNUM; i++)
+ {
+ if (regno == i || regno == -1)
+ {
+ if (CANNOT_FETCH_REGISTER (i))
+ supply_register (i, NULL);
+ else
+ supply_register (i, regs + (i * MIPS_REGSIZE));
+ }
+ }
+}
+
+void
+mipsnbsd_fill_reg (char *regs, int regno)
+{
+ int i;
+
+ for (i = 0; i <= PC_REGNUM; i++)
+ if ((regno == i || regno == -1) && ! CANNOT_STORE_REGISTER (i))
+ regcache_collect (i, regs + (i * MIPS_REGSIZE));
+}
+
+void
+mipsnbsd_supply_fpreg (char *fpregs, int regno)
+{
+ int i;
+
+ for (i = FP0_REGNUM; i <= FCRIR_REGNUM; 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));
+ }
+ }
+}
+
+void
+mipsnbsd_fill_fpreg (char *fpregs, int regno)
+{
+ int i;
+
+ for (i = FP0_REGNUM; i <= FCRCS_REGNUM; i++)
+ if ((regno == i || regno == -1) && ! CANNOT_STORE_REGISTER (i))
+ regcache_collect (i, fpregs + ((i - FP0_REGNUM) * MIPS_REGSIZE));
+}
+
+static void
+fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, int which,
+ CORE_ADDR ignore)
+{
+ char *regs, *fpregs;
+
+ /* We get everything from one section. */
+ if (which != 0)
+ return;
+
+ regs = core_reg_sect;
+ fpregs = core_reg_sect + SIZEOF_STRUCT_REG;
+
+ /* Integer registers. */
+ mipsnbsd_supply_reg (regs, -1);
+
+ /* Floating point registers. */
+ mipsnbsd_supply_fpreg (regs, -1);
+}
+
+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
+ mipsnbsd_supply_reg (core_reg_sect, -1);
+ break;
+
+ case 2: /* Floating point registers. */
+ if (core_reg_size != SIZEOF_STRUCT_FPREG)
+ warning ("Wrong size register set in core file.");
+ else
+ mipsnbsd_supply_fpreg (core_reg_sect, -1);
+ break;
+
+ default:
+ /* Don't know what kind of register request this is; just ignore it. */
+ break;
+ }
+}
+
+static struct core_fns mipsnbsd_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 mipsnbsd_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/mips, 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
+ following code sequence:
+
+ addu a0, sp, 16
+ li v0, 295 # __sigreturn14
+ syscall
+
+ Each instruction has a unique encoding, so we simply attempt to match
+ the instruction the PC is pointing to with any of the above instructions.
+ If there is a hit, we know the offset to the start of the designated
+ sequence and can then check whether we really are executing in the
+ signal trampoline. If not, -1 is returned, otherwise the offset from the
+ start of the return sequence is returned. */
+
+#define RETCODE_NWORDS 3
+#define RETCODE_SIZE (RETCODE_NWORDS * 4)
+
+static const unsigned char sigtramp_retcode_mipsel[RETCODE_SIZE] =
+{
+ 0x10, 0x00, 0xa4, 0x27, /* addu a0, sp, 16 */
+ 0x27, 0x01, 0x02, 0x24, /* li v0, 295 */
+ 0x0c, 0x00, 0x00, 0x00, /* syscall */
+};
+
+static const unsigned char sigtramp_retcode_mipseb[RETCODE_SIZE] =
+{
+ 0x27, 0xa4, 0x00, 0x10, /* addu a0, sp, 16 */
+ 0x24, 0x02, 0x01, 0x27, /* li v0, 295 */
+ 0x00, 0x00, 0x00, 0x0c, /* syscall */
+};
+
+static LONGEST
+mipsnbsd_sigtramp_offset (CORE_ADDR pc)
+{
+ const char *retcode = TARGET_BYTE_ORDER == BFD_ENDIAN_BIG
+ ? sigtramp_retcode_mipseb : sigtramp_retcode_mipsel;
+ unsigned char ret[RETCODE_SIZE], w[4];
+ LONGEST off;
+ int i;
+
+ if (read_memory_nobpt (pc, (char *) w, sizeof (w)) != 0)
+ return -1;
+
+ for (i = 0; i < RETCODE_NWORDS; i++)
+ {
+ if (memcmp (w, retcode + (i * 4), 4) == 0)
+ break;
+ }
+ if (i == RETCODE_NWORDS)
+ return -1;
+
+ off = i * 4;
+ pc -= off;
+
+ if (read_memory_nobpt (pc, (char *) ret, sizeof (ret)) != 0)
+ return -1;
+
+ if (memcmp (ret, retcode, RETCODE_SIZE) == 0)
+ return off;
+
+ return -1;
+}
+
+static int
+mipsnbsd_pc_in_sigtramp (CORE_ADDR pc, char *func_name)
+{
+ return (mipsnbsd_sigtramp_offset (pc) >= 0);
+}
+
+/* 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_REGNUM points at the
+ jmp_buf structure from which we extract the PC that we will land
+ at. The PC is copied into *pc. This routine returns true on
+ success. */
+
+#define NBSD_MIPS_JB_PC (2 * 4)
+#define NBSD_MIPS_JB_ELEMENT_SIZE MIPS_REGSIZE
+#define NBSD_MIPS_JB_OFFSET (NBSD_MIPS_JB_PC * \
+ NBSD_MIPS_JB_ELEMENT_SIZE)
+
+static int
+mipsnbsd_get_longjmp_target (CORE_ADDR *pc)
+{
+ CORE_ADDR jb_addr;
+ char *buf;
+
+ buf = alloca (NBSD_MIPS_JB_ELEMENT_SIZE);
+
+ jb_addr = read_register (A0_REGNUM);
+
+ if (target_read_memory (jb_addr + NBSD_MIPS_JB_OFFSET, buf,
+ NBSD_MIPS_JB_ELEMENT_SIZE))
+ return 0;
+
+ *pc = extract_address (buf, NBSD_MIPS_JB_ELEMENT_SIZE);
+
+ return 1;
+}
+
+static int
+mipsnbsd_cannot_fetch_register (int regno)
+{
+ return (regno >= FP_REGNUM
+ || regno == ZERO_REGNUM
+ || regno == FCRIR_REGNUM);
+}
+
+static int
+mipsnbsd_cannot_store_register (int regno)
+{
+ return (regno >= FP_REGNUM
+ || regno == ZERO_REGNUM
+ || regno == FCRIR_REGNUM);
+}
+
+/* NetBSD/mips uses a slightly different link_map structure from the
+ other NetBSD platforms. */
+static struct link_map_offsets *
+mipsnbsd_ilp32_solib_svr4_fetch_link_map_offsets (void)
+{
+ static struct link_map_offsets lmo;
+ static struct link_map_offsets *lmp = NULL;
+
+ if (lmp == NULL)
+ {
+ lmp = &lmo;
+
+ lmo.r_debug_size = 16;
+
+ lmo.r_map_offset = 4;
+ lmo.r_map_size = 4;
+
+ lmo.link_map_size = 24;
+
+ lmo.l_addr_offset = 0;
+ lmo.l_addr_size = 4;
+
+ lmo.l_name_offset = 8;
+ lmo.l_name_size = 4;
+
+ lmo.l_next_offset = 16;
+ lmo.l_next_size = 4;
+
+ lmo.l_prev_offset = 20;
+ lmo.l_prev_size = 4;
+ }
+
+ return lmp;
+}
+
+static struct link_map_offsets *
+mipsnbsd_lp64_solib_svr4_fetch_link_map_offsets (void)
+{
+ static struct link_map_offsets lmo;
+ static struct link_map_offsets *lmp = NULL;
+
+ if (lmp == NULL)
+ {
+ lmp = &lmo;
+
+ lmo.r_debug_size = 32;
+
+ lmo.r_map_offset = 8;
+ lmo.r_map_size = 8;
+
+ lmo.link_map_size = 48;
+
+ lmo.l_addr_offset = 0;
+ lmo.l_addr_size = 8;
+
+ lmo.l_name_offset = 16;
+ lmo.l_name_size = 8;
+
+ lmo.l_next_offset = 32;
+ lmo.l_next_size = 8;
+
+ lmo.l_prev_offset = 40;
+ lmo.l_prev_size = 8;
+ }
+
+ return lmp;
+}
+
+static void
+mipsnbsd_init_abi (struct gdbarch_info info,
+ struct gdbarch *gdbarch)
+{
+ set_gdbarch_pc_in_sigtramp (gdbarch, mipsnbsd_pc_in_sigtramp);
+
+ set_gdbarch_get_longjmp_target (gdbarch, mipsnbsd_get_longjmp_target);
+
+ set_gdbarch_cannot_fetch_register (gdbarch, mipsnbsd_cannot_fetch_register);
+ set_gdbarch_cannot_store_register (gdbarch, mipsnbsd_cannot_store_register);
+
+ set_gdbarch_software_single_step (gdbarch, mips_software_single_step);
+
+ set_solib_svr4_fetch_link_map_offsets (gdbarch,
+ gdbarch_ptr_bit (gdbarch) == 32 ?
+ mipsnbsd_ilp32_solib_svr4_fetch_link_map_offsets :
+ mipsnbsd_lp64_solib_svr4_fetch_link_map_offsets);
+}
+
+void
+_initialize_mipsnbsd_tdep (void)
+{
+ gdbarch_register_osabi (bfd_arch_mips, GDB_OSABI_NETBSD_ELF,
+ mipsnbsd_init_abi);
+
+ add_core_fns (&mipsnbsd_core_fns);
+ add_core_fns (&mipsnbsd_elfcore_fns);
+}
diff --git a/gdb/mipsnbsd-tdep.h b/gdb/mipsnbsd-tdep.h
new file mode 100644
index 00000000000..6e9f50ed7c2
--- /dev/null
+++ b/gdb/mipsnbsd-tdep.h
@@ -0,0 +1,33 @@
+/* Common target dependent code for GDB on MIPS systems running NetBSD.
+ 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 MIPSNBSD_TDEP_H
+#define MIPSNBSD_TDEP_H
+
+void mipsnbsd_supply_reg (char *, int);
+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)
+
+#endif /* MIPSNBSD_TDEP_H */
diff --git a/gdb/mn10300-tdep.c b/gdb/mn10300-tdep.c
index 0a5704b1704..5d3da69c0b9 100644
--- a/gdb/mn10300-tdep.c
+++ b/gdb/mn10300-tdep.c
@@ -1171,8 +1171,8 @@ mn10300_gdbarch_init (struct gdbarch_info info,
set_gdbarch_frame_init_saved_regs (gdbarch, mn10300_frame_init_saved_regs);
set_gdbarch_frame_chain (gdbarch, mn10300_frame_chain);
set_gdbarch_frame_saved_pc (gdbarch, mn10300_frame_saved_pc);
- set_gdbarch_extract_return_value (gdbarch, mn10300_extract_return_value);
- set_gdbarch_extract_struct_value_address
+ set_gdbarch_deprecated_extract_return_value (gdbarch, mn10300_extract_return_value);
+ set_gdbarch_deprecated_extract_struct_value_address
(gdbarch, mn10300_extract_struct_value_address);
set_gdbarch_store_return_value (gdbarch, mn10300_store_return_value);
set_gdbarch_store_struct_return (gdbarch, mn10300_store_struct_return);
diff --git a/gdb/ns32k-tdep.c b/gdb/ns32k-tdep.c
index e9bbfc479a9..4e9f9608f91 100644
--- a/gdb/ns32k-tdep.c
+++ b/gdb/ns32k-tdep.c
@@ -1,6 +1,6 @@
-/* Print NS 32000 instructions for GDB, the GNU debugger.
- Copyright 1986, 1988, 1991, 1992, 1994, 1995, 1998, 1999, 2000, 2001
- Free Software Foundation, Inc.
+/* Target dependent code for the NS32000, for GDB.
+ Copyright 1986, 1988, 1991, 1992, 1994, 1995, 1998, 1999, 2000, 2001,
+ 2002 Free Software Foundation, Inc.
This file is part of GDB.
@@ -21,20 +21,128 @@
#include "defs.h"
#include "frame.h"
+#include "gdbtypes.h"
#include "gdbcore.h"
+#include "inferior.h"
+#include "regcache.h"
+#include "target.h"
+
+#include "arch-utils.h"
+
+#include "ns32k-tdep.h"
static int sign_extend (int value, int bits);
+static CORE_ADDR ns32k_get_enter_addr (CORE_ADDR);
+static int ns32k_localcount (CORE_ADDR enter_pc);
+static void flip_bytes (void *, int);
-void
-_initialize_ns32k_tdep (void)
+static char *
+ns32k_register_name_32082 (int regno)
{
- tm_print_insn = print_insn_ns32k;
+ static char *register_names[] =
+ {
+ "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
+ "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7",
+ "sp", "fp", "pc", "ps",
+ "l0", "l1", "l2", "l3", "xx",
+ };
+
+ if (regno < 0)
+ return NULL;
+ if (regno >= sizeof (register_names) / sizeof (*register_names))
+ return NULL;
+
+ return (register_names[regno]);
+}
+
+static char *
+ns32k_register_name_32382 (int regno)
+{
+ static char *register_names[] =
+ {
+ "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
+ "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7",
+ "sp", "fp", "pc", "ps",
+ "fsr",
+ "l0", "l1", "l2", "l3", "l4", "l5", "l6", "l7", "xx",
+ };
+
+ if (regno < 0)
+ return NULL;
+ if (regno >= sizeof (register_names) / sizeof (*register_names))
+ return NULL;
+
+ return (register_names[regno]);
+}
+
+static int
+ns32k_register_byte_32082 (int regno)
+{
+ if (regno >= NS32K_LP0_REGNUM)
+ return (NS32K_LP0_REGNUM * 4) + ((regno - NS32K_LP0_REGNUM) * 8);
+
+ return (regno * 4);
+}
+
+static int
+ns32k_register_byte_32382 (int regno)
+{
+ /* This is a bit yuk. The even numbered double precision floating
+ point long registers occupy the same space as the even:odd numbered
+ single precision floating point registers, but the extra 32381 FPU
+ registers are at the end. Doing it this way is compatible for both
+ 32081 and 32381 equipped machines. */
+
+ return ((regno < NS32K_LP0_REGNUM ? regno
+ : (regno - NS32K_LP0_REGNUM) & 1 ? regno - 1
+ : (regno - NS32K_LP0_REGNUM + FP0_REGNUM)) * 4);
+}
+
+static int
+ns32k_register_raw_size (int regno)
+{
+ /* All registers are 4 bytes, except for the doubled floating
+ registers. */
+
+ return ((regno >= NS32K_LP0_REGNUM) ? 8 : 4);
+}
+
+static int
+ns32k_register_virtual_size (int regno)
+{
+ return ((regno >= NS32K_LP0_REGNUM) ? 8 : 4);
+}
+
+static struct type *
+ns32k_register_virtual_type (int regno)
+{
+ if (regno < FP0_REGNUM)
+ return (builtin_type_int);
+
+ if (regno < FP0_REGNUM + 8)
+ return (builtin_type_float);
+
+ if (regno < NS32K_LP0_REGNUM)
+ return (builtin_type_int);
+
+ return (builtin_type_double);
+}
+
+/* Immediately after a function call, return the saved PC. Can't
+ always go through the frames for this because on some systems,
+ the new frame is not set up until the new function executes some
+ instructions. */
+
+static CORE_ADDR
+ns32k_saved_pc_after_call (struct frame_info *frame)
+{
+ return (read_memory_integer (read_register (SP_REGNUM), 4));
}
/* Advance PC across any function entry prologue instructions
to reach some "real" code. */
-CORE_ADDR
+static CORE_ADDR
umax_skip_prologue (CORE_ADDR pc)
{
register unsigned char op = read_memory_integer (pc, 1);
@@ -50,6 +158,15 @@ umax_skip_prologue (CORE_ADDR pc)
}
return pc;
}
+
+static const unsigned char *
+ns32k_breakpoint_from_pc (CORE_ADDR *pcp, int *lenp)
+{
+ static const unsigned char breakpoint_insn[] = { 0xf2 };
+
+ *lenp = sizeof (breakpoint_insn);
+ return breakpoint_insn;
+}
/* Return number of args passed to a frame.
Can return -1, meaning no way to tell.
@@ -57,7 +174,7 @@ umax_skip_prologue (CORE_ADDR pc)
so this will often not work properly. If the arg names
are known, it's likely most of them will be printed. */
-int
+static int
umax_frame_num_args (struct frame_info *fi)
{
int numargs;
@@ -106,7 +223,7 @@ sign_extend (int value, int bits)
: value);
}
-void
+static void
flip_bytes (void *p, int count)
{
char tmp;
@@ -122,11 +239,11 @@ flip_bytes (void *p, int count)
}
}
-/* Return the number of locals in the current frame given a pc
- pointing to the enter instruction. This is used in the macro
- FRAME_FIND_SAVED_REGS. */
+/* Return the number of locals in the current frame given a
+ pc pointing to the enter instruction. This is used by
+ ns32k_frame_init_saved_regs. */
-int
+static int
ns32k_localcount (CORE_ADDR enter_pc)
{
unsigned char localtype;
@@ -155,16 +272,10 @@ ns32k_about_to_return (CORE_ADDR pc)
return (read_memory_integer (pc, 1) == 0x12);
}
-
-/*
- * Get the address of the enter opcode for the function
- * containing PC, if there is an enter for the function,
- * and if the pc is between the enter and exit.
- * Returns positive address if pc is between enter/exit,
- * 1 if pc before enter or after exit, 0 otherwise.
- */
-
-CORE_ADDR
+/* Get the address of the enter opcode for this function, if it is active.
+ Returns positive address > 1 if pc is between enter/exit,
+ 1 if pc before enter or after exit, 0 otherwise. */
+static CORE_ADDR
ns32k_get_enter_addr (CORE_ADDR pc)
{
CORE_ADDR enter_addr;
@@ -188,3 +299,375 @@ ns32k_get_enter_addr (CORE_ADDR pc)
return enter_addr; /* pc is between enter and exit */
}
+
+static CORE_ADDR
+ns32k_frame_chain (struct frame_info *frame)
+{
+ /* In the case of the NS32000 series, the frame's nominal address is the
+ FP value, and that address is saved at the previous FP value as a
+ 4-byte word. */
+
+ if (inside_entry_file (frame->pc))
+ return 0;
+
+ return (read_memory_integer (frame->frame, 4));
+}
+
+static CORE_ADDR
+ns32k_frame_saved_pc (struct frame_info *frame)
+{
+ if (frame->signal_handler_caller)
+ return (sigtramp_saved_pc (frame)); /* XXXJRT */
+
+ return (read_memory_integer (frame->frame + 4, 4));
+}
+
+static CORE_ADDR
+ns32k_frame_args_address (struct frame_info *frame)
+{
+ if (ns32k_get_enter_addr (frame->pc) > 1)
+ return (frame->frame);
+
+ return (read_register (SP_REGNUM) - 4);
+}
+
+static CORE_ADDR
+ns32k_frame_locals_address (struct frame_info *frame)
+{
+ return (frame->frame);
+}
+
+static void
+ns32k_get_saved_register (char *raw_buffer, int *optimized, CORE_ADDR *addrp,
+ struct frame_info *frame, int regnum,
+ enum lval_type *lval)
+{
+ CORE_ADDR addr;
+
+ if (!target_has_registers)
+ error ("No registers.");
+
+ /* Normal systems don't optimize out things with register numbers. */
+ if (optimized != NULL)
+ *optimized = 0;
+ addr = find_saved_register (frame, regnum);
+ if (addr != 0)
+ {
+ if (lval != NULL)
+ *lval = lval_memory;
+ if (regnum == SP_REGNUM)
+ {
+ if (raw_buffer != NULL)
+ {
+ /* Put it back in target format. */
+ store_address (raw_buffer, REGISTER_RAW_SIZE (regnum),
+ (LONGEST) addr);
+ }
+ if (addrp != NULL)
+ *addrp = 0;
+ return;
+ }
+ if (raw_buffer != NULL)
+ target_read_memory (addr, raw_buffer, REGISTER_RAW_SIZE (regnum));
+ }
+ else
+ {
+ if (lval != NULL)
+ *lval = lval_register;
+ addr = REGISTER_BYTE (regnum);
+ if (raw_buffer != NULL)
+ read_register_gen (regnum, raw_buffer);
+ }
+ if (addrp != NULL)
+ *addrp = addr;
+}
+
+/* Code to initialize the addresses of the saved registers of frame described
+ by FRAME_INFO. This includes special registers such as pc and fp saved in
+ special ways in the stack frame. sp is even more special: the address we
+ return for it IS the sp for the next frame. */
+
+static void
+ns32k_frame_init_saved_regs (struct frame_info *frame)
+{
+ int regmask, regnum;
+ int localcount;
+ CORE_ADDR enter_addr, next_addr;
+
+ if (frame->saved_regs)
+ return;
+
+ frame_saved_regs_zalloc (frame);
+
+ enter_addr = ns32k_get_enter_addr (frame->pc);
+ if (enter_addr > 1)
+ {
+ regmask = read_memory_integer (enter_addr + 1, 1) & 0xff;
+ localcount = ns32k_localcount (enter_addr);
+ next_addr = frame->frame + localcount;
+
+ for (regnum = 0; regnum < 8; regnum++)
+ {
+ if (regmask & (1 << regnum))
+ frame->saved_regs[regnum] = next_addr -= 4;
+ }
+
+ frame->saved_regs[SP_REGNUM] = frame->frame + 4;
+ frame->saved_regs[PC_REGNUM] = frame->frame + 4;
+ frame->saved_regs[FP_REGNUM] = read_memory_integer (frame->frame, 4);
+ }
+ else if (enter_addr == 1)
+ {
+ CORE_ADDR sp = read_register (SP_REGNUM);
+ frame->saved_regs[PC_REGNUM] = sp;
+ frame->saved_regs[SP_REGNUM] = sp + 4;
+ }
+}
+
+static void
+ns32k_push_dummy_frame (void)
+{
+ CORE_ADDR sp = read_register (SP_REGNUM);
+ int regnum;
+
+ sp = push_word (sp, read_register (PC_REGNUM));
+ sp = push_word (sp, read_register (FP_REGNUM));
+ write_register (FP_REGNUM, sp);
+
+ for (regnum = 0; regnum < 8; regnum++)
+ sp = push_word (sp, read_register (regnum));
+
+ write_register (SP_REGNUM, sp);
+}
+
+static void
+ns32k_pop_frame (void)
+{
+ struct frame_info *frame = get_current_frame ();
+ CORE_ADDR fp;
+ int regnum;
+
+ fp = frame->frame;
+ FRAME_INIT_SAVED_REGS (frame);
+
+ for (regnum = 0; regnum < 8; regnum++)
+ if (frame->saved_regs[regnum])
+ write_register (regnum,
+ read_memory_integer (frame->saved_regs[regnum], 4));
+
+ write_register (FP_REGNUM, read_memory_integer (fp, 4));
+ write_register (PC_REGNUM, read_memory_integer (fp + 4, 4));
+ write_register (SP_REGNUM, fp + 8);
+ flush_cached_frames ();
+}
+
+/* The NS32000 call dummy sequence:
+
+ enter 0xff,0 82 ff 00
+ jsr @0x00010203 7f ae c0 01 02 03
+ adjspd 0x69696969 7f a5 01 02 03 04
+ bpt f2
+
+ It is 16 bytes long. */
+
+static LONGEST ns32k_call_dummy_words[] =
+{
+ 0x7f00ff82,
+ 0x0201c0ae,
+ 0x01a57f03,
+ 0xf2040302
+};
+static int sizeof_ns32k_call_dummy_words = sizeof (ns32k_call_dummy_words);
+
+#define NS32K_CALL_DUMMY_ADDR 5
+#define NS32K_CALL_DUMMY_NARGS 11
+
+static void
+ns32k_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs,
+ struct value **args, struct type *type, int gcc_p)
+{
+ int flipped;
+
+ flipped = fun | 0xc0000000;
+ flip_bytes (&flipped, 4);
+ store_unsigned_integer (dummy + NS32K_CALL_DUMMY_ADDR, 4, flipped);
+
+ flipped = - nargs * 4;
+ flip_bytes (&flipped, 4);
+ store_unsigned_integer (dummy + NS32K_CALL_DUMMY_NARGS, 4, flipped);
+}
+
+static void
+ns32k_store_struct_return (CORE_ADDR addr, CORE_ADDR sp)
+{
+ /* On this machine, this is a no-op (Encore Umax didn't use GCC). */
+}
+
+static void
+ns32k_extract_return_value (struct type *valtype, char *regbuf, char *valbuf)
+{
+ memcpy (valbuf,
+ regbuf + REGISTER_BYTE (TYPE_CODE (valtype) == TYPE_CODE_FLT ?
+ FP0_REGNUM : 0), TYPE_LENGTH (valtype));
+}
+
+static void
+ns32k_store_return_value (struct type *valtype, char *valbuf)
+{
+ write_register_bytes (TYPE_CODE (valtype) == TYPE_CODE_FLT ?
+ FP0_REGNUM : 0, valbuf, TYPE_LENGTH (valtype));
+}
+
+static CORE_ADDR
+ns32k_extract_struct_value_address (char *regbuf)
+{
+ return (extract_address (regbuf + REGISTER_BYTE (0), REGISTER_RAW_SIZE (0)));
+}
+
+void
+ns32k_gdbarch_init_32082 (struct gdbarch *gdbarch)
+{
+ set_gdbarch_num_regs (gdbarch, NS32K_NUM_REGS_32082);
+
+ set_gdbarch_register_name (gdbarch, ns32k_register_name_32082);
+ set_gdbarch_register_bytes (gdbarch, NS32K_REGISTER_BYTES_32082);
+ set_gdbarch_register_byte (gdbarch, ns32k_register_byte_32082);
+}
+
+void
+ns32k_gdbarch_init_32382 (struct gdbarch *gdbarch)
+{
+ set_gdbarch_num_regs (gdbarch, NS32K_NUM_REGS_32382);
+
+ set_gdbarch_register_name (gdbarch, ns32k_register_name_32382);
+ set_gdbarch_register_bytes (gdbarch, NS32K_REGISTER_BYTES_32382);
+ set_gdbarch_register_byte (gdbarch, ns32k_register_byte_32382);
+}
+
+/* Initialize the current architecture based on INFO. If possible, re-use an
+ architecture from ARCHES, which is a list of architectures already created
+ during this debugging session.
+
+ Called e.g. at program startup, when reading a core file, and when reading
+ a binary file. */
+
+static struct gdbarch *
+ns32k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
+{
+ struct gdbarch_tdep *tdep;
+ struct gdbarch *gdbarch;
+ enum gdb_osabi osabi = GDB_OSABI_UNKNOWN;
+
+ /* Try to determine the OS ABI of the object we are loading. */
+ if (info.abfd != NULL)
+ {
+ osabi = gdbarch_lookup_osabi (info.abfd);
+ }
+
+ /* Find a candidate among extant architectures. */
+ for (arches = gdbarch_list_lookup_by_info (arches, &info);
+ arches != NULL;
+ arches = gdbarch_list_lookup_by_info (arches->next, &info))
+ {
+ /* Make sure the OS ABI selection matches. */
+ tdep = gdbarch_tdep (arches->gdbarch);
+ if (tdep && tdep->osabi == osabi)
+ return arches->gdbarch;
+ }
+
+ tdep = xmalloc (sizeof (struct gdbarch_tdep));
+ gdbarch = gdbarch_alloc (&info, tdep);
+
+ tdep->osabi = osabi;
+
+ /* Register info */
+ ns32k_gdbarch_init_32082 (gdbarch);
+ set_gdbarch_num_regs (gdbarch, NS32K_SP_REGNUM);
+ set_gdbarch_num_regs (gdbarch, NS32K_FP_REGNUM);
+ set_gdbarch_num_regs (gdbarch, NS32K_PC_REGNUM);
+ set_gdbarch_num_regs (gdbarch, NS32K_PS_REGNUM);
+
+ set_gdbarch_register_size (gdbarch, NS32K_REGISTER_SIZE);
+ set_gdbarch_register_raw_size (gdbarch, ns32k_register_raw_size);
+ set_gdbarch_max_register_raw_size (gdbarch, NS32K_MAX_REGISTER_RAW_SIZE);
+ set_gdbarch_register_virtual_size (gdbarch, ns32k_register_virtual_size);
+ set_gdbarch_max_register_virtual_size (gdbarch,
+ NS32K_MAX_REGISTER_VIRTUAL_SIZE);
+ set_gdbarch_register_virtual_type (gdbarch, ns32k_register_virtual_type);
+
+ /* Frame and stack info */
+ set_gdbarch_skip_prologue (gdbarch, umax_skip_prologue);
+ set_gdbarch_saved_pc_after_call (gdbarch, ns32k_saved_pc_after_call);
+
+ set_gdbarch_frame_num_args (gdbarch, umax_frame_num_args);
+ set_gdbarch_frameless_function_invocation (gdbarch,
+ generic_frameless_function_invocation_not);
+
+ set_gdbarch_frame_chain (gdbarch, ns32k_frame_chain);
+ set_gdbarch_frame_chain_valid (gdbarch, func_frame_chain_valid);
+ set_gdbarch_frame_saved_pc (gdbarch, ns32k_frame_saved_pc);
+
+ set_gdbarch_frame_args_address (gdbarch, ns32k_frame_args_address);
+ set_gdbarch_frame_locals_address (gdbarch, ns32k_frame_locals_address);
+
+ set_gdbarch_frame_init_saved_regs (gdbarch, ns32k_frame_init_saved_regs);
+
+ set_gdbarch_frame_args_skip (gdbarch, 8);
+
+ set_gdbarch_get_saved_register (gdbarch, ns32k_get_saved_register);
+
+ set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
+
+ /* Return value info */
+ set_gdbarch_store_struct_return (gdbarch, ns32k_store_struct_return);
+ set_gdbarch_deprecated_extract_return_value (gdbarch, ns32k_extract_return_value);
+ set_gdbarch_store_return_value (gdbarch, ns32k_store_return_value);
+ set_gdbarch_deprecated_extract_struct_value_address (gdbarch,
+ ns32k_extract_struct_value_address);
+
+ /* Call dummy info */
+ set_gdbarch_push_dummy_frame (gdbarch, ns32k_push_dummy_frame);
+ set_gdbarch_pop_frame (gdbarch, ns32k_pop_frame);
+ set_gdbarch_call_dummy_location (gdbarch, ON_STACK);
+ set_gdbarch_call_dummy_p (gdbarch, 1);
+ set_gdbarch_call_dummy_words (gdbarch, ns32k_call_dummy_words);
+ set_gdbarch_sizeof_call_dummy_words (gdbarch, sizeof_ns32k_call_dummy_words);
+ set_gdbarch_fix_call_dummy (gdbarch, ns32k_fix_call_dummy);
+ set_gdbarch_call_dummy_start_offset (gdbarch, 3);
+ set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 0);
+ set_gdbarch_use_generic_dummy_frames (gdbarch, 0);
+ set_gdbarch_pc_in_call_dummy (gdbarch, pc_in_call_dummy_on_stack);
+ set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0);
+
+ /* Breakpoint info */
+ set_gdbarch_decr_pc_after_break (gdbarch, 0);
+ set_gdbarch_breakpoint_from_pc (gdbarch, ns32k_breakpoint_from_pc);
+
+ /* Misc info */
+ set_gdbarch_function_start_offset (gdbarch, 0);
+
+ /* Hook in OS ABI-specific overrides, if they have been registered. */
+ gdbarch_init_osabi (info, gdbarch, osabi);
+
+ return (gdbarch);
+}
+
+static void
+ns32k_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file)
+{
+ struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+
+ if (tdep == NULL)
+ return;
+
+ fprintf_unfiltered (file, "ns32k_dump_tdep: OS ABI = %s\n",
+ gdbarch_osabi_name (tdep->osabi));
+}
+
+void
+_initialize_ns32k_tdep (void)
+{
+ gdbarch_register (bfd_arch_ns32k, ns32k_gdbarch_init, ns32k_dump_tdep);
+
+ tm_print_insn = print_insn_ns32k;
+}
diff --git a/gdb/ns32k-tdep.h b/gdb/ns32k-tdep.h
new file mode 100644
index 00000000000..c0463247f47
--- /dev/null
+++ b/gdb/ns32k-tdep.h
@@ -0,0 +1,66 @@
+/* Target-dependent definitions for GDB on NS32000 systems.
+ Copyright 1987, 1989, 1991, 1993, 1994, 1998, 1999, 2000, 2001, 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 NS32K_TDEP_H
+#define NS32K_TDEP_H
+
+#include "osabi.h"
+
+/* 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 NS32K_R0_REGNUM 0 /* General register 0 */
+#define NS32K_FP0_REGNUM 8 /* Floating point register 0 */
+#define NS32K_SP_REGNUM 16 /* Contains address of top of stack */
+#define NS32K_AP_REGNUM NS32K_FP_REGNUM
+#define NS32K_FP_REGNUM 17 /* Contains address of executing stack frame */
+#define NS32K_PC_REGNUM 18 /* Contains program counter */
+#define NS32K_PS_REGNUM 19 /* Contains processor status */
+#define NS32K_FPS_REGNUM 20 /* Floating point status register */
+#define NS32K_LP0_REGNUM 21 /* Double register 0 (same as FP0) */
+
+#define NS32K_NUM_REGS_32082 25
+#define NS32K_REGISTER_BYTES_32082 \
+ ((NS32K_NUM_REGS_32082 - 4) * 4 /* size of general purpose regs */ \
+ + 4 * 8 /* size of floating point regs */)
+
+#define NS32K_NUM_REGS_32382 29
+#define NS32K_REGISTER_BYTES_32382 \
+ ((NS32K_NUM_REGS_32382 - 4) * 4 /* size of general purpose regs */ \
+ + 8 * 8 /* size of floating point regs */)
+
+#define NS32K_REGISTER_SIZE 4
+#define NS32K_MAX_REGISTER_RAW_SIZE 8
+#define NS32K_MAX_REGISTER_VIRTUAL_SIZE 8
+
+struct gdbarch_tdep
+{
+ enum gdb_osabi osabi;
+};
+
+void ns32k_gdbarch_init_32082 (struct gdbarch *);
+void ns32k_gdbarch_init_32382 (struct gdbarch *);
+
+#endif /* NS32K_TDEP_H */
diff --git a/gdb/ns32knbsd-tdep.c b/gdb/ns32knbsd-tdep.c
new file mode 100644
index 00000000000..1ca0b3b39ac
--- /dev/null
+++ b/gdb/ns32knbsd-tdep.c
@@ -0,0 +1,70 @@
+/* Target-dependent code for NS32000 systems running NetBSD.
+ Copyright 2002 Free Software Foundation, Inc.
+ Contributed by Wasabi Systems, 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 "defs.h"
+
+#include "ns32k-tdep.h"
+
+static int
+ns32knbsd_aout_in_solib_call_trampoline (CORE_ADDR pc, char *name)
+{
+ if (strcmp (name, "_DYNAMIC") == 0)
+ return 1;
+
+ return 0;
+}
+
+static void
+ns32knbsd_init_abi_common (struct gdbarch_info info,
+ struct gdbarch *gdbarch)
+{
+ /* We only support machines with the 32382 FPU. */
+ ns32k_gdbarch_init_32382 (gdbarch);
+}
+
+static void
+ns32knbsd_init_abi_aout (struct gdbarch_info info,
+ struct gdbarch *gdbarch)
+{
+ ns32knbsd_init_abi_common (info, gdbarch);
+
+ set_gdbarch_in_solib_call_trampoline (gdbarch,
+ ns32knbsd_aout_in_solib_call_trampoline);
+}
+
+static enum gdb_osabi
+ns32knbsd_aout_osabi_sniffer (bfd *abfd)
+{
+ if (strcmp (bfd_get_target (abfd), "a.out-ns32k-netbsd") == 0)
+ return GDB_OSABI_NETBSD_AOUT;
+
+ return GDB_OSABI_UNKNOWN;
+}
+
+void
+_initialize_ns32knbsd_tdep (void)
+{
+ gdbarch_register_osabi_sniffer (bfd_arch_ns32k, bfd_target_aout_flavour,
+ ns32knbsd_aout_osabi_sniffer);
+
+ gdbarch_register_osabi (bfd_arch_ns32k, GDB_OSABI_NETBSD_AOUT,
+ ns32knbsd_init_abi_aout);
+}
diff --git a/gdb/objfiles.h b/gdb/objfiles.h
index ed4e6b7b32f..f8adb498b24 100644
--- a/gdb/objfiles.h
+++ b/gdb/objfiles.h
@@ -360,7 +360,7 @@ struct objfile
so that it gets freed automatically when reading a new object
file. */
- PTR obj_private;
+ void *obj_private;
/* Set of relocation offsets to apply to each section.
Currently on the psymbol_obstack (which makes no sense, but I'm
diff --git a/gdb/osabi.c b/gdb/osabi.c
new file mode 100644
index 00000000000..0abc4a25b35
--- /dev/null
+++ b/gdb/osabi.c
@@ -0,0 +1,426 @@
+/* OS ABI variant handling for GDB.
+ Copyright 2001, 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. */
+
+#include "defs.h"
+#include "osabi.h"
+
+#include "elf-bfd.h"
+
+
+/* This table matches the indices assigned to enum gdb_osabi. Keep
+ them in sync. */
+static const char * const gdb_osabi_names[] =
+{
+ "<unknown>",
+
+ "SVR4",
+ "GNU/Hurd",
+ "Solaris",
+ "OSF/1",
+ "GNU/Linux",
+ "FreeBSD a.out",
+ "FreeBSD ELF",
+ "NetBSD a.out",
+ "NetBSD ELF",
+ "Windows CE",
+ "DJGPP",
+ "NetWare",
+
+ "ARM EABI v1",
+ "ARM EABI v2",
+ "ARM APCS",
+
+ "<invalid>"
+};
+
+const char *
+gdbarch_osabi_name (enum gdb_osabi osabi)
+{
+ if (osabi >= GDB_OSABI_UNKNOWN && osabi < GDB_OSABI_INVALID)
+ return gdb_osabi_names[osabi];
+
+ return gdb_osabi_names[GDB_OSABI_INVALID];
+}
+
+/* Handler for a given architecture/OS ABI pair. There should be only
+ one handler for a given OS ABI each architecture family. */
+struct gdb_osabi_handler
+{
+ struct gdb_osabi_handler *next;
+ enum bfd_architecture arch;
+ enum gdb_osabi osabi;
+ void (*init_osabi)(struct gdbarch_info, struct gdbarch *);
+};
+
+static struct gdb_osabi_handler *gdb_osabi_handler_list;
+
+void
+gdbarch_register_osabi (enum bfd_architecture arch, enum gdb_osabi osabi,
+ void (*init_osabi)(struct gdbarch_info,
+ struct gdbarch *))
+{
+ struct gdb_osabi_handler **handler_p;
+
+ /* Registering an OS ABI handler for "unknown" is not allowed. */
+ if (osabi == GDB_OSABI_UNKNOWN)
+ {
+ internal_error
+ (__FILE__, __LINE__,
+ "gdbarch_register_osabi: An attempt to register a handler for "
+ "OS ABI \"%s\" for architecture %s was made. The handler will "
+ "not be registered",
+ gdbarch_osabi_name (osabi),
+ bfd_printable_arch_mach (arch, 0));
+ return;
+ }
+
+ for (handler_p = &gdb_osabi_handler_list; *handler_p != NULL;
+ handler_p = &(*handler_p)->next)
+ {
+ if ((*handler_p)->arch == arch
+ && (*handler_p)->osabi == osabi)
+ {
+ internal_error
+ (__FILE__, __LINE__,
+ "gdbarch_register_osabi: A handler for OS ABI \"%s\" "
+ "has already been registered for architecture %s",
+ gdbarch_osabi_name (osabi),
+ bfd_printable_arch_mach (arch, 0));
+ /* If user wants to continue, override previous definition. */
+ (*handler_p)->init_osabi = init_osabi;
+ return;
+ }
+ }
+
+ (*handler_p)
+ = (struct gdb_osabi_handler *) xmalloc (sizeof (struct gdb_osabi_handler));
+ (*handler_p)->next = NULL;
+ (*handler_p)->arch = arch;
+ (*handler_p)->osabi = osabi;
+ (*handler_p)->init_osabi = init_osabi;
+}
+
+
+/* Sniffer to find the OS ABI for a given file's architecture and flavour.
+ It is legal to have multiple sniffers for each arch/flavour pair, to
+ disambiguate one OS's a.out from another, for example. The first sniffer
+ to return something other than GDB_OSABI_UNKNOWN wins, so a sniffer should
+ be careful to claim a file only if it knows for sure what it is. */
+struct gdb_osabi_sniffer
+{
+ struct gdb_osabi_sniffer *next;
+ enum bfd_architecture arch; /* bfd_arch_unknown == wildcard */
+ enum bfd_flavour flavour;
+ enum gdb_osabi (*sniffer)(bfd *);
+};
+
+static struct gdb_osabi_sniffer *gdb_osabi_sniffer_list;
+
+void
+gdbarch_register_osabi_sniffer (enum bfd_architecture arch,
+ enum bfd_flavour flavour,
+ enum gdb_osabi (*sniffer_fn)(bfd *))
+{
+ struct gdb_osabi_sniffer *sniffer;
+
+ sniffer =
+ (struct gdb_osabi_sniffer *) xmalloc (sizeof (struct gdb_osabi_sniffer));
+ sniffer->arch = arch;
+ sniffer->flavour = flavour;
+ sniffer->sniffer = sniffer_fn;
+
+ sniffer->next = gdb_osabi_sniffer_list;
+ gdb_osabi_sniffer_list = sniffer;
+}
+
+
+enum gdb_osabi
+gdbarch_lookup_osabi (bfd *abfd)
+{
+ struct gdb_osabi_sniffer *sniffer;
+ enum gdb_osabi osabi, match;
+ int match_specific;
+
+ match = GDB_OSABI_UNKNOWN;
+ match_specific = 0;
+
+ for (sniffer = gdb_osabi_sniffer_list; sniffer != NULL;
+ sniffer = sniffer->next)
+ {
+ if ((sniffer->arch == bfd_arch_unknown /* wildcard */
+ || sniffer->arch == bfd_get_arch (abfd))
+ && sniffer->flavour == bfd_get_flavour (abfd))
+ {
+ osabi = (*sniffer->sniffer) (abfd);
+ if (osabi < GDB_OSABI_UNKNOWN || osabi >= GDB_OSABI_INVALID)
+ {
+ internal_error
+ (__FILE__, __LINE__,
+ "gdbarch_lookup_osabi: invalid OS ABI (%d) from sniffer "
+ "for architecture %s flavour %d",
+ (int) osabi,
+ bfd_printable_arch_mach (bfd_get_arch (abfd), 0),
+ (int) bfd_get_flavour (abfd));
+ }
+ else if (osabi != GDB_OSABI_UNKNOWN)
+ {
+ /* A specific sniffer always overrides a generic sniffer.
+ Croak on multiple match if the two matches are of the
+ same class. If the user wishes to continue, we'll use
+ the first match. */
+ if (match != GDB_OSABI_UNKNOWN)
+ {
+ if ((match_specific && sniffer->arch != bfd_arch_unknown)
+ || (!match_specific && sniffer->arch == bfd_arch_unknown))
+ {
+ internal_error
+ (__FILE__, __LINE__,
+ "gdbarch_lookup_osabi: multiple %sspecific OS ABI "
+ "match for architecture %s flavour %d: first "
+ "match \"%s\", second match \"%s\"",
+ match_specific ? "" : "non-",
+ bfd_printable_arch_mach (bfd_get_arch (abfd), 0),
+ (int) bfd_get_flavour (abfd),
+ gdbarch_osabi_name (match),
+ gdbarch_osabi_name (osabi));
+ }
+ else if (sniffer->arch != bfd_arch_unknown)
+ {
+ match = osabi;
+ match_specific = 1;
+ }
+ }
+ else
+ {
+ match = osabi;
+ if (sniffer->arch != bfd_arch_unknown)
+ match_specific = 1;
+ }
+ }
+ }
+ }
+
+ return match;
+}
+
+void
+gdbarch_init_osabi (struct gdbarch_info info, struct gdbarch *gdbarch,
+ enum gdb_osabi osabi)
+{
+ struct gdb_osabi_handler *handler;
+ bfd *abfd = info.abfd;
+ const struct bfd_arch_info *arch_info = gdbarch_bfd_arch_info (gdbarch);
+
+ if (osabi == GDB_OSABI_UNKNOWN)
+ {
+ /* Don't complain about not knowing the OS ABI if we don't
+ have an inferior. */
+ if (info.abfd)
+ fprintf_filtered
+ (gdb_stderr, "GDB doesn't recognize the OS ABI of the inferior. "
+ "Attempting to continue with the default %s settings",
+ bfd_printable_arch_mach (arch_info->arch, arch_info->mach));
+ return;
+ }
+
+ for (handler = gdb_osabi_handler_list; handler != NULL;
+ handler = handler->next)
+ {
+ if (handler->arch == bfd_get_arch (abfd)
+ && handler->osabi == osabi)
+ {
+ (*handler->init_osabi) (info, gdbarch);
+ return;
+ }
+ }
+
+ /* We assume that if GDB_MULTI_ARCH is less than GDB_MULTI_ARCH_TM
+ that an ABI variant can be supported by overriding definitions in
+ the tm-file. */
+ if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
+ fprintf_filtered
+ (gdb_stderr,
+ "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 (osabi),
+ bfd_printable_arch_mach (arch_info->arch, arch_info->mach));
+}
+
+
+/* Generic sniffer for ELF flavoured files. */
+
+void
+generic_elf_osabi_sniff_abi_tag_sections (bfd *abfd, asection *sect, void *obj)
+{
+ enum gdb_osabi *os_ident_ptr = obj;
+ const char *name;
+ unsigned int sectsize;
+
+ name = bfd_get_section_name (abfd, sect);
+ sectsize = bfd_section_size (abfd, sect);
+
+ /* .note.ABI-tag notes, used by GNU/Linux and FreeBSD. */
+ if (strcmp (name, ".note.ABI-tag") == 0 && sectsize > 0)
+ {
+ unsigned int name_length, data_length, note_type;
+ char *note;
+
+ /* If the section is larger than this, it's probably not what we are
+ looking for. */
+ if (sectsize > 128)
+ sectsize = 128;
+
+ note = alloca (sectsize);
+
+ bfd_get_section_contents (abfd, sect, note,
+ (file_ptr) 0, (bfd_size_type) sectsize);
+
+ name_length = bfd_h_get_32 (abfd, note);
+ data_length = bfd_h_get_32 (abfd, note + 4);
+ note_type = bfd_h_get_32 (abfd, note + 8);
+
+ if (name_length == 4 && data_length == 16 && note_type == NT_GNU_ABI_TAG
+ && strcmp (note + 12, "GNU") == 0)
+ {
+ int os_number = bfd_h_get_32 (abfd, note + 16);
+
+ switch (os_number)
+ {
+ case GNU_ABI_TAG_LINUX:
+ *os_ident_ptr = GDB_OSABI_LINUX;
+ break;
+
+ case GNU_ABI_TAG_HURD:
+ *os_ident_ptr = GDB_OSABI_HURD;
+ break;
+
+ case GNU_ABI_TAG_SOLARIS:
+ *os_ident_ptr = GDB_OSABI_SOLARIS;
+ break;
+
+ default:
+ internal_error
+ (__FILE__, __LINE__,
+ "generic_elf_osabi_sniff_abi_tag_sections: unknown OS number %d",
+ os_number);
+ }
+ return;
+ }
+ else if (name_length == 8 && data_length == 4
+ && note_type == NT_FREEBSD_ABI_TAG
+ && strcmp (note + 12, "FreeBSD") == 0)
+ {
+ /* XXX Should we check the version here? Probably not
+ necessary yet. */
+ *os_ident_ptr = GDB_OSABI_FREEBSD_ELF;
+ }
+ return;
+ }
+
+ /* .note.netbsd.ident notes, used by NetBSD. */
+ if (strcmp (name, ".note.netbsd.ident") == 0 && sectsize > 0)
+ {
+ unsigned int name_length, data_length, note_type;
+ char *note;
+
+ /* If the section is larger than this, it's probably not what we are
+ looking for. */
+ if (sectsize > 128)
+ sectsize = 128;
+
+ note = alloca (sectsize);
+
+ bfd_get_section_contents (abfd, sect, note,
+ (file_ptr) 0, (bfd_size_type) sectsize);
+
+ name_length = bfd_h_get_32 (abfd, note);
+ data_length = bfd_h_get_32 (abfd, note + 4);
+ note_type = bfd_h_get_32 (abfd, note + 8);
+
+ if (name_length == 7 && data_length == 4 && note_type == NT_NETBSD_IDENT
+ && strcmp (note + 12, "NetBSD") == 0)
+ {
+ /* XXX Should we check the version here? Probably not
+ necessary yet. */
+ *os_ident_ptr = GDB_OSABI_NETBSD_ELF;
+ }
+ return;
+ }
+}
+
+static enum gdb_osabi
+generic_elf_osabi_sniffer (bfd *abfd)
+{
+ unsigned int elfosabi;
+ enum gdb_osabi osabi = GDB_OSABI_UNKNOWN;
+
+ elfosabi = elf_elfheader (abfd)->e_ident[EI_OSABI];
+
+ switch (elfosabi)
+ {
+ case ELFOSABI_NONE:
+ /* When elfosabi is ELFOSABI_NONE (0), then the ELF structures in the
+ file are conforming to the base specification for that machine
+ (there are no OS-specific extensions). In order to determine the
+ real OS in use we must look for OS notes that have been added. */
+ bfd_map_over_sections (abfd,
+ generic_elf_osabi_sniff_abi_tag_sections,
+ &osabi);
+ break;
+
+ case ELFOSABI_FREEBSD:
+ osabi = GDB_OSABI_FREEBSD_ELF;
+ break;
+
+ case ELFOSABI_NETBSD:
+ osabi = GDB_OSABI_NETBSD_ELF;
+ break;
+
+ case ELFOSABI_LINUX:
+ osabi = GDB_OSABI_LINUX;
+ break;
+
+ case ELFOSABI_HURD:
+ osabi = GDB_OSABI_HURD;
+ break;
+
+ case ELFOSABI_SOLARIS:
+ osabi = GDB_OSABI_SOLARIS;
+ break;
+ }
+
+ return osabi;
+}
+
+
+void
+_initialize_gdb_osabi (void)
+{
+ if (strcmp (gdb_osabi_names[GDB_OSABI_INVALID], "<invalid>") != 0)
+ internal_error
+ (__FILE__, __LINE__,
+ "_initialize_gdb_osabi: gdb_osabi_names[] is inconsistent");
+
+ /* Register a generic sniffer for ELF flavoured files. */
+ gdbarch_register_osabi_sniffer (bfd_arch_unknown,
+ bfd_target_elf_flavour,
+ generic_elf_osabi_sniffer);
+}
diff --git a/gdb/osabi.h b/gdb/osabi.h
new file mode 100644
index 00000000000..f3882e78541
--- /dev/null
+++ b/gdb/osabi.h
@@ -0,0 +1,80 @@
+/* OS ABI variant handling for GDB.
+ Copyright 2001, 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 OSABI_H
+#define OSABI_H
+
+/* List of known OS ABIs. If you change this, make sure to update the
+ table in osabi.c. */
+enum gdb_osabi
+{
+ GDB_OSABI_UNKNOWN = 0, /* keep this first */
+
+ GDB_OSABI_SVR4,
+ GDB_OSABI_HURD,
+ GDB_OSABI_SOLARIS,
+ GDB_OSABI_OSF1,
+ GDB_OSABI_LINUX,
+ GDB_OSABI_FREEBSD_AOUT,
+ GDB_OSABI_FREEBSD_ELF,
+ GDB_OSABI_NETBSD_AOUT,
+ GDB_OSABI_NETBSD_ELF,
+ GDB_OSABI_WINCE,
+ GDB_OSABI_GO32,
+ GDB_OSABI_NETWARE,
+
+ GDB_OSABI_ARM_EABI_V1,
+ GDB_OSABI_ARM_EABI_V2,
+ GDB_OSABI_ARM_APCS,
+
+ GDB_OSABI_INVALID /* keep this last */
+};
+
+/* Register an OS ABI sniffer. Each arch/flavour may have more than
+ one sniffer. This is used to e.g. differentiate one OS's a.out from
+ another. The first sniffer to return something other than
+ GDB_OSABI_UNKNOWN wins, so a sniffer should be careful to claim a file
+ only if it knows for sure what it is. */
+void gdbarch_register_osabi_sniffer (enum bfd_architecture,
+ enum bfd_flavour,
+ enum gdb_osabi (*)(bfd *));
+
+/* Register a handler for an OS ABI variant for a given architecture. There
+ should be only one handler for a given OS ABI each architecture family. */
+void gdbarch_register_osabi (enum bfd_architecture, enum gdb_osabi,
+ void (*)(struct gdbarch_info,
+ struct gdbarch *));
+
+/* Lookup the OS ABI corresponding to the specified BFD. */
+enum gdb_osabi gdbarch_lookup_osabi (bfd *);
+
+/* Initialize the gdbarch for the specified OS ABI variant. */
+void gdbarch_init_osabi (struct gdbarch_info, struct gdbarch *,
+ enum gdb_osabi);
+
+/* Return the name of the specified OS ABI. */
+const char *gdbarch_osabi_name (enum gdb_osabi);
+
+/* Helper routine for ELF file sniffers. This looks at ABI tag note
+ sections to determine the OS ABI from the note. It should be called
+ via bfd_map_over_sections. */
+void generic_elf_osabi_sniff_abi_tag_sections (bfd *, asection *, void *);
+
+#endif /* OSABI_H */
diff --git a/gdb/p-exp.y b/gdb/p-exp.y
index 8efb45019f4..7333f6d04a0 100644
--- a/gdb/p-exp.y
+++ b/gdb/p-exp.y
@@ -150,9 +150,15 @@ static char * uptok (char *, int);
/* YYSTYPE gets defined by %union */
static int
parse_number (char *, int, int, YYSTYPE *);
+
+static struct type *current_type;
+
+static void push_current_type ();
+static void pop_current_type ();
+static int search_field;
%}
-%type <voidval> exp exp1 type_exp start variable qualified_name
+%type <voidval> exp exp1 type_exp start normal_start variable qualified_name
%type <tval> type typebase
/* %type <bval> block */
@@ -170,7 +176,8 @@ parse_number (char *, int, int, YYSTYPE *);
Contexts where this distinction is not important can use the
nonterminal "name", which matches either NAME or TYPENAME. */
-%token <sval> STRING
+%token <sval> STRING
+%token <sval> FIELDNAME
%token <ssym> NAME /* BLOCKNAME defined below to give it higher precedence. */
%token <tsym> TYPENAME
%type <sval> name
@@ -219,15 +226,21 @@ parse_number (char *, int, int, YYSTYPE *);
%%
-start : exp1
+start : { current_type = NULL;
+ search_field = 0;
+ }
+ normal_start;
+
+normal_start :
+ exp1
| type_exp
;
type_exp: type
{ write_exp_elt_opcode(OP_TYPE);
write_exp_elt_type($1);
- write_exp_elt_opcode(OP_TYPE);}
- ;
+ write_exp_elt_opcode(OP_TYPE);
+ current_type = $1; } ;
/* Expressions, including the comma operator. */
exp1 : exp
@@ -237,10 +250,14 @@ exp1 : exp
/* Expressions, not including the comma operator. */
exp : exp '^' %prec UNARY
- { write_exp_elt_opcode (UNOP_IND); }
+ { write_exp_elt_opcode (UNOP_IND);
+ if (current_type)
+ current_type = TYPE_TARGET_TYPE (current_type); }
exp : '@' exp %prec UNARY
- { write_exp_elt_opcode (UNOP_ADDR); }
+ { write_exp_elt_opcode (UNOP_ADDR);
+ if (current_type)
+ current_type = TYPE_POINTER_TYPE (current_type); }
exp : '-' exp %prec UNARY
{ write_exp_elt_opcode (UNOP_NEG); }
@@ -258,24 +275,55 @@ exp : DECREMENT '(' exp ')' %prec UNARY
{ write_exp_elt_opcode (UNOP_PREDECREMENT); }
;
-exp : exp '.' name
+exp : exp '.' { search_field = 1; }
+ FIELDNAME
+ /* name */
{ write_exp_elt_opcode (STRUCTOP_STRUCT);
- write_exp_string ($3);
- write_exp_elt_opcode (STRUCTOP_STRUCT); }
- ;
-
-exp : exp '[' exp1 ']'
- { write_exp_elt_opcode (BINOP_SUBSCRIPT); }
- ;
+ write_exp_string ($4);
+ write_exp_elt_opcode (STRUCTOP_STRUCT);
+ search_field = 0;
+ if (current_type)
+ { while (TYPE_CODE (current_type) == TYPE_CODE_PTR)
+ current_type = TYPE_TARGET_TYPE (current_type);
+ current_type = lookup_struct_elt_type (
+ current_type, $4.ptr, false); };
+ } ;
+exp : exp '['
+ /* We need to save the current_type value */
+ { char *arrayname;
+ int arrayfieldindex;
+ arrayfieldindex = is_pascal_string_type (
+ current_type, NULL, NULL,
+ NULL, NULL, &arrayname);
+ if (arrayfieldindex)
+ {
+ struct stoken stringsval;
+ stringsval.ptr = alloca (strlen (arrayname) + 1);
+ stringsval.length = strlen (arrayname);
+ strcpy (stringsval.ptr, arrayname);
+ current_type = TYPE_FIELD_TYPE (current_type,
+ arrayfieldindex - 1);
+ write_exp_elt_opcode (STRUCTOP_STRUCT);
+ write_exp_string (stringsval);
+ write_exp_elt_opcode (STRUCTOP_STRUCT);
+ }
+ push_current_type (); }
+ exp1 ']'
+ { pop_current_type ();
+ write_exp_elt_opcode (BINOP_SUBSCRIPT);
+ if (current_type)
+ current_type = TYPE_TARGET_TYPE (current_type); }
exp : exp '('
/* This is to save the value of arglist_len
being accumulated by an outer function call. */
- { start_arglist (); }
+ { push_current_type ();
+ start_arglist (); }
arglist ')' %prec ARROW
{ write_exp_elt_opcode (OP_FUNCALL);
write_exp_elt_longcst ((LONGEST) end_arglist ());
- write_exp_elt_opcode (OP_FUNCALL); }
+ write_exp_elt_opcode (OP_FUNCALL);
+ pop_current_type (); }
;
arglist :
@@ -288,7 +336,8 @@ arglist :
exp : type '(' exp ')' %prec UNARY
{ write_exp_elt_opcode (UNOP_CAST);
write_exp_elt_type ($1);
- write_exp_elt_opcode (UNOP_CAST); }
+ write_exp_elt_opcode (UNOP_CAST);
+ current_type = $1; }
;
exp : '(' exp1 ')'
@@ -567,9 +616,11 @@ variable: name_not_typename
write_exp_elt_block (NULL);
write_exp_elt_sym (sym);
write_exp_elt_opcode (OP_VAR_VALUE);
- }
+ current_type = sym->type; }
else if ($1.is_a_field_of_this)
{
+ struct value * this_val;
+ struct type * this_type;
/* Object pascal: it hangs off of `this'. Must
not inadvertently convert from a method call
to data ref. */
@@ -581,6 +632,18 @@ variable: name_not_typename
write_exp_elt_opcode (STRUCTOP_PTR);
write_exp_string ($1.stoken);
write_exp_elt_opcode (STRUCTOP_PTR);
+ /* we need type of this */
+ this_val = value_of_this (0);
+ if (this_val)
+ this_type = this_val->type;
+ else
+ this_type = NULL;
+ if (this_type)
+ current_type = lookup_struct_elt_type (
+ this_type,
+ $1.stoken.ptr, false);
+ else
+ current_type = NULL;
}
else
{
@@ -881,6 +944,36 @@ parse_number (p, len, parsed_float, putithere)
return INT;
}
+
+struct type_push
+{
+ struct type *stored;
+ struct type_push *next;
+};
+
+static struct type_push *tp_top = NULL;
+
+static void push_current_type ()
+{
+ struct type_push *tpnew;
+ tpnew = (struct type_push *) malloc (sizeof (struct type_push));
+ tpnew->next = tp_top;
+ tpnew->stored = current_type;
+ current_type = NULL;
+ tp_top = tpnew;
+}
+
+static void pop_current_type ()
+{
+ struct type_push *tp = tp_top;
+ if (tp)
+ {
+ current_type = tp->stored;
+ tp_top = tp->next;
+ xfree (tp);
+ }
+}
+
struct token
{
char *operator;
@@ -907,8 +1000,8 @@ static const struct token tokentab2[] =
{"<>", NOTEQUAL, BINOP_END},
{"<=", LEQ, BINOP_END},
{">=", GEQ, BINOP_END},
- {":=", ASSIGN, BINOP_END}
- };
+ {":=", ASSIGN, BINOP_END},
+ {"::", COLONCOLON, BINOP_END} };
/* Allocate uppercased var */
/* make an uppercased copy of tokstart */
@@ -1149,6 +1242,7 @@ yylex ()
{
tempbuf = (char *) realloc (tempbuf, tempbufsize += 64);
}
+
switch (*tokptr)
{
case '\0':
@@ -1295,25 +1389,37 @@ yylex ()
char *tmp = copy_name (yylval.sval);
struct symbol *sym;
int is_a_field_of_this = 0;
+ int is_a_field = 0;
int hextype;
- sym = lookup_symbol (tmp, expression_context_block,
- VAR_NAMESPACE,
- &is_a_field_of_this,
- (struct symtab **) NULL);
+
+ if (search_field && current_type)
+ is_a_field = (lookup_struct_elt_type (current_type, tmp, 1) != NULL);
+ if (is_a_field)
+ sym = NULL;
+ else
+ sym = lookup_symbol (tmp, expression_context_block,
+ VAR_NAMESPACE,
+ &is_a_field_of_this,
+ (struct symtab **) NULL);
/* second chance uppercased (as Free Pascal does). */
- if (!sym && !is_a_field_of_this)
+ if (!sym && !is_a_field_of_this && !is_a_field)
{
for (i = 0; i <= namelen; i++)
{
if ((tmp[i] >= 'a' && tmp[i] <= 'z'))
tmp[i] -= ('a'-'A');
}
- sym = lookup_symbol (tmp, expression_context_block,
+ if (search_field && current_type)
+ is_a_field = (lookup_struct_elt_type (current_type, tmp, 1) != NULL);
+ if (is_a_field)
+ sym = NULL;
+ else
+ sym = lookup_symbol (tmp, expression_context_block,
VAR_NAMESPACE,
&is_a_field_of_this,
(struct symtab **) NULL);
- if (sym || is_a_field_of_this)
+ if (sym || is_a_field_of_this || is_a_field)
for (i = 0; i <= namelen; i++)
{
if ((tokstart[i] >= 'a' && tokstart[i] <= 'z'))
@@ -1321,7 +1427,7 @@ yylex ()
}
}
/* Third chance Capitalized (as GPC does). */
- if (!sym && !is_a_field_of_this)
+ if (!sym && !is_a_field_of_this && !is_a_field)
{
for (i = 0; i <= namelen; i++)
{
@@ -1334,11 +1440,16 @@ yylex ()
if ((tmp[i] >= 'A' && tmp[i] <= 'Z'))
tmp[i] -= ('A'-'a');
}
- sym = lookup_symbol (tmp, expression_context_block,
+ if (search_field && current_type)
+ is_a_field = (lookup_struct_elt_type (current_type, tmp, 1) != NULL);
+ if (is_a_field)
+ sym = NULL;
+ else
+ sym = lookup_symbol (tmp, expression_context_block,
VAR_NAMESPACE,
&is_a_field_of_this,
(struct symtab **) NULL);
- if (sym || is_a_field_of_this)
+ if (sym || is_a_field_of_this || is_a_field)
for (i = 0; i <= namelen; i++)
{
if (i == 0)
@@ -1351,6 +1462,15 @@ yylex ()
tokstart[i] -= ('A'-'a');
}
}
+
+ if (is_a_field)
+ {
+ tempbuf = (char *) realloc (tempbuf, namelen + 1);
+ strncpy (tempbuf, tokstart, namelen); tempbuf [namelen] = 0;
+ yylval.sval.ptr = tempbuf;
+ yylval.sval.length = namelen;
+ return FIELDNAME;
+ }
/* Call lookup_symtab, not lookup_partial_symtab, in case there are
no psymtabs (coff, xcoff, or some future change to blow away the
psymtabs once once symbols are read). */
diff --git a/gdb/pa64solib.c b/gdb/pa64solib.c
index 0058cbf6ead..fce8fea0365 100644
--- a/gdb/pa64solib.c
+++ b/gdb/pa64solib.c
@@ -1,5 +1,6 @@
/* Handle HP ELF shared libraries for GDB, the GNU Debugger.
- Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
+
+ Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of GDB.
@@ -47,7 +48,6 @@
#include "gdb-stabs.h"
#include "gdb_stat.h"
#include "gdbcmd.h"
-#include "assert.h"
#include "language.h"
#include "regcache.h"
@@ -109,7 +109,7 @@ static int pa64_solib_st_size_threshold_exceeded;
typedef struct
{
CORE_ADDR dld_flags_addr;
- long long dld_flags;
+ LONGEST dld_flags;
sec_ptr dyninfo_sect;
boolean have_read_dld_descriptor;
boolean is_valid;
@@ -251,7 +251,7 @@ pa64_solib_add_solib_objfile (struct so_list *so, char *name, int from_tty,
/* Now find the true lowest section in the shared library. */
sec = NULL;
- bfd_map_over_sections (tmp_bfd, find_lowest_section, (PTR) &sec);
+ bfd_map_over_sections (tmp_bfd, find_lowest_section, &sec);
if (sec)
{
@@ -283,7 +283,7 @@ pa64_solib_add_solib_objfile (struct so_list *so, char *name, int from_tty,
sizeof (obj_private_data_t));
obj_private->unwind_info = NULL;
obj_private->so_info = NULL;
- so->objfile->obj_private = (PTR) obj_private;
+ so->objfile->obj_private = obj_private;
}
obj_private = (obj_private_data_t *) so->objfile->obj_private;
@@ -1224,13 +1224,13 @@ bfd_lookup_symbol (bfd *abfd, char *symname)
if (storage_needed > 0)
{
symbol_table = (asymbol **) xmalloc (storage_needed);
- back_to = make_cleanup (xfree, (PTR) symbol_table);
+ back_to = make_cleanup (xfree, symbol_table);
number_of_symbols = bfd_canonicalize_symtab (abfd, symbol_table);
for (i = 0; i < number_of_symbols; i++)
{
sym = *symbol_table++;
- if (STREQ (sym->name, symname))
+ if (strcmp (sym->name, symname) == 0)
{
/* Bfd symbols are section relative. */
symaddr = sym->value + sym->section->vma;
diff --git a/gdb/parse.c b/gdb/parse.c
index 9c1f3e16d0b..bc81f221b52 100644
--- a/gdb/parse.c
+++ b/gdb/parse.c
@@ -71,6 +71,7 @@ struct expression *expout;
int expout_size;
int expout_ptr;
struct block *expression_context_block;
+CORE_ADDR expression_context_pc;
struct block *innermost_block;
int arglist_len;
union type_stack_elt *type_stack;
@@ -1140,7 +1141,13 @@ parse_exp_1 (char **stringptr, struct block *block, int comma)
old_chain = make_cleanup (free_funcalls, 0 /*ignore*/);
funcall_chain = 0;
- expression_context_block = block ? block : get_selected_block (0);
+ if (block)
+ {
+ expression_context_block = block;
+ expression_context_pc = block->startaddr;
+ }
+ else
+ expression_context_block = get_selected_block (&expression_context_pc);
namecopy = (char *) alloca (strlen (lexptr) + 1);
expout_size = 10;
diff --git a/gdb/parser-defs.h b/gdb/parser-defs.h
index ece28493752..7db1c77e123 100644
--- a/gdb/parser-defs.h
+++ b/gdb/parser-defs.h
@@ -37,6 +37,12 @@ extern int expout_ptr;
extern struct block *expression_context_block;
+/* If expression_context_block is non-zero, then this is the PC within
+ the block that we want to evaluate expressions at. When debugging
+ C or C++ code, we use this to find the exact line we're at, and
+ then look up the macro definitions active at that point. */
+CORE_ADDR expression_context_pc;
+
/* The innermost context required by the stack and register variables
we've encountered so far. */
extern struct block *innermost_block;
diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c
index f358274140b..1a88d4052d3 100644
--- a/gdb/ppc-linux-tdep.c
+++ b/gdb/ppc-linux-tdep.c
@@ -411,293 +411,6 @@ ppc_linux_frame_chain (struct frame_info *thisframe)
return rs6000_frame_chain (thisframe);
}
-/* FIXME: Move the following to rs6000-tdep.c (or some other file where
- it may be used generically by ports which use either the SysV ABI or
- the EABI */
-
-/* Until November 2001, gcc was not complying to the SYSV ABI for
- returning structures less than or equal to 8 bytes in size. It was
- returning everything in memory. When this was corrected, it wasn't
- fixed for native platforms. */
-int
-ppc_sysv_abi_broken_use_struct_convention (int gcc_p, struct type *value_type)
-{
- if (TYPE_LENGTH (value_type) == 16
- && TYPE_VECTOR (value_type))
- return 0;
-
- return generic_use_struct_convention (gcc_p, value_type);
-}
-
-/* Structures 8 bytes or less long are returned in the r3 & r4
- registers, according to the SYSV ABI. */
-int
-ppc_sysv_abi_use_struct_convention (int gcc_p, struct type *value_type)
-{
- if (TYPE_LENGTH (value_type) == 16
- && TYPE_VECTOR (value_type))
- return 0;
-
- return (TYPE_LENGTH (value_type) > 8);
-}
-
-/* round2 rounds x up to the nearest multiple of s assuming that s is a
- power of 2 */
-
-#undef round2
-#define round2(x,s) ((((long) (x) - 1) & ~(long)((s)-1)) + (s))
-
-/* 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
- be less than eight parameters if some parameters occupy more than one
- word) are passed in r3..r10 registers. float and double parameters are
- passed in fpr's, in addition to that. Rest of the parameters if any
- are passed in user stack.
-
- If the function is returning a structure, then the return address is passed
- in r3, then the first 7 words of the parametes can be passed in registers,
- starting from r4. */
-
-CORE_ADDR
-ppc_sysv_abi_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
- int struct_return, CORE_ADDR struct_addr)
-{
- int argno;
- /* Next available general register for non-float, non-vector arguments. */
- int greg;
- /* Next available floating point register for float arguments. */
- int freg;
- /* Next available vector register for vector arguments. */
- int vreg;
- int argstkspace;
- int structstkspace;
- int argoffset;
- int structoffset;
- struct value *arg;
- struct type *type;
- int len;
- char old_sp_buf[4];
- CORE_ADDR saved_sp;
-
- greg = struct_return ? 4 : 3;
- freg = 1;
- vreg = 2;
- argstkspace = 0;
- structstkspace = 0;
-
- /* Figure out how much new stack space is required for arguments
- which don't fit in registers. Unlike the PowerOpen ABI, the
- SysV ABI doesn't reserve any extra space for parameters which
- are put in registers. */
- for (argno = 0; argno < nargs; argno++)
- {
- arg = args[argno];
- type = check_typedef (VALUE_TYPE (arg));
- len = TYPE_LENGTH (type);
-
- if (TYPE_CODE (type) == TYPE_CODE_FLT)
- {
- if (freg <= 8)
- freg++;
- else
- {
- /* SysV ABI converts floats to doubles when placed in
- memory and requires 8 byte alignment */
- if (argstkspace & 0x4)
- argstkspace += 4;
- argstkspace += 8;
- }
- }
- else if (TYPE_CODE (type) == TYPE_CODE_INT && len == 8) /* long long */
- {
- if (greg > 9)
- {
- greg = 11;
- if (argstkspace & 0x4)
- argstkspace += 4;
- argstkspace += 8;
- }
- else
- {
- if ((greg & 1) == 0)
- greg++;
- greg += 2;
- }
- }
- else if (!TYPE_VECTOR (type))
- {
- if (len > 4
- || TYPE_CODE (type) == TYPE_CODE_STRUCT
- || TYPE_CODE (type) == TYPE_CODE_UNION)
- {
- /* Rounding to the nearest multiple of 8 may not be necessary,
- but it is safe. Particularly since we don't know the
- field types of the structure */
- structstkspace += round2 (len, 8);
- }
- if (greg <= 10)
- greg++;
- else
- argstkspace += 4;
- }
- else
- {
- if (len == 16
- && TYPE_CODE (type) == TYPE_CODE_ARRAY
- && TYPE_VECTOR (type))
- {
- if (vreg <= 13)
- vreg++;
- else
- {
- /* Vector arguments must be aligned to 16 bytes on
- the stack. */
- argstkspace += round2 (argstkspace, 16);
- argstkspace += 16;
- }
- }
- }
- }
-
- /* Get current SP location */
- saved_sp = read_sp ();
-
- sp -= argstkspace + structstkspace;
-
- /* Allocate space for backchain and callee's saved lr */
- sp -= 8;
-
- /* Make sure that we maintain 16 byte alignment */
- sp &= ~0x0f;
-
- /* Update %sp before proceeding any further */
- write_register (SP_REGNUM, sp);
-
- /* write the backchain */
- store_address (old_sp_buf, 4, saved_sp);
- write_memory (sp, old_sp_buf, 4);
-
- argoffset = 8;
- structoffset = argoffset + argstkspace;
- freg = 1;
- greg = 3;
- vreg = 2;
- /* Fill in r3 with the return structure, if any */
- if (struct_return)
- {
- char val_buf[4];
- store_address (val_buf, 4, struct_addr);
- memcpy (&registers[REGISTER_BYTE (greg)], val_buf, 4);
- greg++;
- }
- /* Now fill in the registers and stack... */
- for (argno = 0; argno < nargs; argno++)
- {
- arg = args[argno];
- type = check_typedef (VALUE_TYPE (arg));
- len = TYPE_LENGTH (type);
-
- if (TYPE_CODE (type) == TYPE_CODE_FLT)
- {
- if (freg <= 8)
- {
- if (len > 8)
- printf_unfiltered (
- "Fatal Error: a floating point parameter #%d with a size > 8 is found!\n", argno);
- memcpy (&registers[REGISTER_BYTE (FP0_REGNUM + freg)],
- VALUE_CONTENTS (arg), len);
- freg++;
- }
- else
- {
- /* SysV ABI converts floats to doubles when placed in
- memory and requires 8 byte alignment */
- /* FIXME: Convert floats to doubles */
- if (argoffset & 0x4)
- argoffset += 4;
- write_memory (sp + argoffset, (char *) VALUE_CONTENTS (arg), len);
- argoffset += 8;
- }
- }
- else if (TYPE_CODE (type) == TYPE_CODE_INT && len == 8) /* long long */
- {
- if (greg > 9)
- {
- greg = 11;
- if (argoffset & 0x4)
- argoffset += 4;
- write_memory (sp + argoffset, (char *) VALUE_CONTENTS (arg), len);
- argoffset += 8;
- }
- else
- {
- if ((greg & 1) == 0)
- greg++;
-
- memcpy (&registers[REGISTER_BYTE (greg)],
- VALUE_CONTENTS (arg), 4);
- memcpy (&registers[REGISTER_BYTE (greg + 1)],
- VALUE_CONTENTS (arg) + 4, 4);
- greg += 2;
- }
- }
- else if (!TYPE_VECTOR (type))
- {
- char val_buf[4];
- if (len > 4
- || TYPE_CODE (type) == TYPE_CODE_STRUCT
- || TYPE_CODE (type) == TYPE_CODE_UNION)
- {
- write_memory (sp + structoffset, VALUE_CONTENTS (arg), len);
- store_address (val_buf, 4, sp + structoffset);
- structoffset += round2 (len, 8);
- }
- else
- {
- memset (val_buf, 0, 4);
- memcpy (val_buf, VALUE_CONTENTS (arg), len);
- }
- if (greg <= 10)
- {
- memcpy (&registers[REGISTER_BYTE (greg)], val_buf, 4);
- greg++;
- }
- else
- {
- write_memory (sp + argoffset, val_buf, 4);
- argoffset += 4;
- }
- }
- else
- {
- if (len == 16
- && TYPE_CODE (type) == TYPE_CODE_ARRAY
- && TYPE_VECTOR (type))
- {
- struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
- char *v_val_buf = alloca (16);
- memset (v_val_buf, 0, 16);
- memcpy (v_val_buf, VALUE_CONTENTS (arg), len);
- if (vreg <= 13)
- {
- memcpy (&registers[REGISTER_BYTE (tdep->ppc_vr0_regnum
- + vreg)],
- v_val_buf, 16);
- vreg++;
- }
- else
- {
- write_memory (sp + argoffset, v_val_buf, 16);
- argoffset += 16;
- }
- }
- }
- }
-
- target_store_registers (-1);
- return sp;
-}
-
/* ppc_linux_memory_remove_breakpoints attempts to remove a breakpoint
in much the same fashion as memory_remove_breakpoint in mem-break.c,
but is careful not to write back the previous contents if the code
@@ -886,3 +599,44 @@ ppc_linux_svr4_fetch_link_map_offsets (void)
return lmp;
}
+
+static void
+ppc_linux_init_abi (struct gdbarch_info info,
+ struct gdbarch *gdbarch)
+{
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+
+ /* Until November 2001, gcc was not complying to the SYSV ABI for
+ returning structures less than or equal to 8 bytes in size. It was
+ returning everything in memory. When this was corrected, it wasn't
+ fixed for native platforms. */
+ set_gdbarch_use_struct_convention (gdbarch,
+ ppc_sysv_abi_broken_use_struct_convention);
+
+ if (tdep->wordsize == 4)
+ {
+ /* Note: kevinb/2002-04-12: See note in rs6000_gdbarch_init regarding
+ *_push_arguments(). The same remarks hold for the methods below. */
+ set_gdbarch_frameless_function_invocation (gdbarch,
+ ppc_linux_frameless_function_invocation);
+ set_gdbarch_frame_chain (gdbarch, ppc_linux_frame_chain);
+ set_gdbarch_frame_saved_pc (gdbarch, ppc_linux_frame_saved_pc);
+
+ set_gdbarch_frame_init_saved_regs (gdbarch,
+ ppc_linux_frame_init_saved_regs);
+ set_gdbarch_init_extra_frame_info (gdbarch,
+ ppc_linux_init_extra_frame_info);
+
+ set_gdbarch_memory_remove_breakpoint (gdbarch,
+ ppc_linux_memory_remove_breakpoint);
+ set_solib_svr4_fetch_link_map_offsets
+ (gdbarch, ppc_linux_svr4_fetch_link_map_offsets);
+ }
+}
+
+void
+_initialize_ppc_linux_tdep (void)
+{
+ gdbarch_register_osabi (bfd_arch_powerpc, GDB_OSABI_LINUX,
+ ppc_linux_init_abi);
+}
diff --git a/gdb/ppc-sysv-tdep.c b/gdb/ppc-sysv-tdep.c
new file mode 100644
index 00000000000..0d33683a4c4
--- /dev/null
+++ b/gdb/ppc-sysv-tdep.c
@@ -0,0 +1,312 @@
+/* Target-dependent code for PowerPC systems using the SVR4 ABI
+ for GDB, the GNU debugger.
+
+ Copyright 2000, 2001, 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. */
+
+#include "defs.h"
+#include "gdbcore.h"
+#include "inferior.h"
+#include "regcache.h"
+#include "value.h"
+
+#include "ppc-tdep.h"
+
+/* round2 rounds x up to the nearest multiple of s assuming that s is a
+ power of 2 */
+
+#undef round2
+#define round2(x,s) ((((long) (x) - 1) & ~(long)((s)-1)) + (s))
+
+/* 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
+ be less than eight parameters if some parameters occupy more than one
+ word) are passed in r3..r10 registers. float and double parameters are
+ passed in fpr's, in addition to that. Rest of the parameters if any
+ are passed in user stack.
+
+ If the function is returning a structure, then the return address is passed
+ in r3, then the first 7 words of the parametes can be passed in registers,
+ starting from r4. */
+
+CORE_ADDR
+ppc_sysv_abi_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
+ int struct_return, CORE_ADDR struct_addr)
+{
+ int argno;
+ /* Next available general register for non-float, non-vector arguments. */
+ int greg;
+ /* Next available floating point register for float arguments. */
+ int freg;
+ /* Next available vector register for vector arguments. */
+ int vreg;
+ int argstkspace;
+ int structstkspace;
+ int argoffset;
+ int structoffset;
+ struct value *arg;
+ struct type *type;
+ int len;
+ char old_sp_buf[4];
+ CORE_ADDR saved_sp;
+
+ greg = struct_return ? 4 : 3;
+ freg = 1;
+ vreg = 2;
+ argstkspace = 0;
+ structstkspace = 0;
+
+ /* Figure out how much new stack space is required for arguments
+ which don't fit in registers. Unlike the PowerOpen ABI, the
+ SysV ABI doesn't reserve any extra space for parameters which
+ are put in registers. */
+ for (argno = 0; argno < nargs; argno++)
+ {
+ arg = args[argno];
+ type = check_typedef (VALUE_TYPE (arg));
+ len = TYPE_LENGTH (type);
+
+ if (TYPE_CODE (type) == TYPE_CODE_FLT)
+ {
+ if (freg <= 8)
+ freg++;
+ else
+ {
+ /* SysV ABI converts floats to doubles when placed in
+ memory and requires 8 byte alignment */
+ if (argstkspace & 0x4)
+ argstkspace += 4;
+ argstkspace += 8;
+ }
+ }
+ else if (TYPE_CODE (type) == TYPE_CODE_INT && len == 8) /* long long */
+ {
+ if (greg > 9)
+ {
+ greg = 11;
+ if (argstkspace & 0x4)
+ argstkspace += 4;
+ argstkspace += 8;
+ }
+ else
+ {
+ if ((greg & 1) == 0)
+ greg++;
+ greg += 2;
+ }
+ }
+ else if (!TYPE_VECTOR (type))
+ {
+ if (len > 4
+ || TYPE_CODE (type) == TYPE_CODE_STRUCT
+ || TYPE_CODE (type) == TYPE_CODE_UNION)
+ {
+ /* Rounding to the nearest multiple of 8 may not be necessary,
+ but it is safe. Particularly since we don't know the
+ field types of the structure */
+ structstkspace += round2 (len, 8);
+ }
+ if (greg <= 10)
+ greg++;
+ else
+ argstkspace += 4;
+ }
+ else
+ {
+ if (len == 16
+ && TYPE_CODE (type) == TYPE_CODE_ARRAY
+ && TYPE_VECTOR (type))
+ {
+ if (vreg <= 13)
+ vreg++;
+ else
+ {
+ /* Vector arguments must be aligned to 16 bytes on
+ the stack. */
+ argstkspace += round2 (argstkspace, 16);
+ argstkspace += 16;
+ }
+ }
+ }
+ }
+
+ /* Get current SP location */
+ saved_sp = read_sp ();
+
+ sp -= argstkspace + structstkspace;
+
+ /* Allocate space for backchain and callee's saved lr */
+ sp -= 8;
+
+ /* Make sure that we maintain 16 byte alignment */
+ sp &= ~0x0f;
+
+ /* Update %sp before proceeding any further */
+ write_register (SP_REGNUM, sp);
+
+ /* write the backchain */
+ store_address (old_sp_buf, 4, saved_sp);
+ write_memory (sp, old_sp_buf, 4);
+
+ argoffset = 8;
+ structoffset = argoffset + argstkspace;
+ freg = 1;
+ greg = 3;
+ vreg = 2;
+ /* Fill in r3 with the return structure, if any */
+ if (struct_return)
+ {
+ char val_buf[4];
+ store_address (val_buf, 4, struct_addr);
+ memcpy (&registers[REGISTER_BYTE (greg)], val_buf, 4);
+ greg++;
+ }
+ /* Now fill in the registers and stack... */
+ for (argno = 0; argno < nargs; argno++)
+ {
+ arg = args[argno];
+ type = check_typedef (VALUE_TYPE (arg));
+ len = TYPE_LENGTH (type);
+
+ if (TYPE_CODE (type) == TYPE_CODE_FLT)
+ {
+ if (freg <= 8)
+ {
+ if (len > 8)
+ printf_unfiltered (
+ "Fatal Error: a floating point parameter #%d with a size > 8 is found!\n", argno);
+ memcpy (&registers[REGISTER_BYTE (FP0_REGNUM + freg)],
+ VALUE_CONTENTS (arg), len);
+ freg++;
+ }
+ else
+ {
+ /* SysV ABI converts floats to doubles when placed in
+ memory and requires 8 byte alignment */
+ /* FIXME: Convert floats to doubles */
+ if (argoffset & 0x4)
+ argoffset += 4;
+ write_memory (sp + argoffset, (char *) VALUE_CONTENTS (arg), len);
+ argoffset += 8;
+ }
+ }
+ else if (TYPE_CODE (type) == TYPE_CODE_INT && len == 8) /* long long */
+ {
+ if (greg > 9)
+ {
+ greg = 11;
+ if (argoffset & 0x4)
+ argoffset += 4;
+ write_memory (sp + argoffset, (char *) VALUE_CONTENTS (arg), len);
+ argoffset += 8;
+ }
+ else
+ {
+ if ((greg & 1) == 0)
+ greg++;
+
+ memcpy (&registers[REGISTER_BYTE (greg)],
+ VALUE_CONTENTS (arg), 4);
+ memcpy (&registers[REGISTER_BYTE (greg + 1)],
+ VALUE_CONTENTS (arg) + 4, 4);
+ greg += 2;
+ }
+ }
+ else if (!TYPE_VECTOR (type))
+ {
+ char val_buf[4];
+ if (len > 4
+ || TYPE_CODE (type) == TYPE_CODE_STRUCT
+ || TYPE_CODE (type) == TYPE_CODE_UNION)
+ {
+ write_memory (sp + structoffset, VALUE_CONTENTS (arg), len);
+ store_address (val_buf, 4, sp + structoffset);
+ structoffset += round2 (len, 8);
+ }
+ else
+ {
+ memset (val_buf, 0, 4);
+ memcpy (val_buf, VALUE_CONTENTS (arg), len);
+ }
+ if (greg <= 10)
+ {
+ memcpy (&registers[REGISTER_BYTE (greg)], val_buf, 4);
+ greg++;
+ }
+ else
+ {
+ write_memory (sp + argoffset, val_buf, 4);
+ argoffset += 4;
+ }
+ }
+ else
+ {
+ if (len == 16
+ && TYPE_CODE (type) == TYPE_CODE_ARRAY
+ && TYPE_VECTOR (type))
+ {
+ struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+ char *v_val_buf = alloca (16);
+ memset (v_val_buf, 0, 16);
+ memcpy (v_val_buf, VALUE_CONTENTS (arg), len);
+ if (vreg <= 13)
+ {
+ memcpy (&registers[REGISTER_BYTE (tdep->ppc_vr0_regnum
+ + vreg)],
+ v_val_buf, 16);
+ vreg++;
+ }
+ else
+ {
+ write_memory (sp + argoffset, v_val_buf, 16);
+ argoffset += 16;
+ }
+ }
+ }
+ }
+
+ target_store_registers (-1);
+ return sp;
+}
+
+/* Until November 2001, gcc was not complying to the SYSV ABI for
+ returning structures less than or equal to 8 bytes in size. It was
+ returning everything in memory. When this was corrected, it wasn't
+ fixed for native platforms. */
+int
+ppc_sysv_abi_broken_use_struct_convention (int gcc_p, struct type *value_type)
+{
+ if (TYPE_LENGTH (value_type) == 16
+ && TYPE_VECTOR (value_type))
+ return 0;
+
+ return generic_use_struct_convention (gcc_p, value_type);
+}
+
+/* Structures 8 bytes or less long are returned in the r3 & r4
+ registers, according to the SYSV ABI. */
+int
+ppc_sysv_abi_use_struct_convention (int gcc_p, struct type *value_type)
+{
+ if (TYPE_LENGTH (value_type) == 16
+ && TYPE_VECTOR (value_type))
+ return 0;
+
+ return (TYPE_LENGTH (value_type) > 8);
+}
diff --git a/gdb/ppc-tdep.h b/gdb/ppc-tdep.h
index 3da66ad1405..2f40742abcd 100644
--- a/gdb/ppc-tdep.h
+++ b/gdb/ppc-tdep.h
@@ -22,6 +22,8 @@
#ifndef PPC_TDEP_H
#define PPC_TDEP_H
+#include "osabi.h"
+
struct frame_info;
struct value;
@@ -52,7 +54,7 @@ int altivec_register_p (int regno);
struct gdbarch_tdep
{
int wordsize; /* size in bytes of fixed-point word */
- int osabi; /* OS / ABI from ELF header */
+ enum gdb_osabi osabi; /* OS / ABI from ELF header */
int *regoff; /* byte offsets in register arrays */
const struct reg *regs; /* from current variant */
int ppc_gp0_regnum; /* GPR register 0 */
diff --git a/gdb/ppcnbsd-nat.c b/gdb/ppcnbsd-nat.c
index 55acf95fb21..ce097d7a59d 100644
--- a/gdb/ppcnbsd-nat.c
+++ b/gdb/ppcnbsd-nat.c
@@ -1,6 +1,6 @@
/* Native-dependent code for PowerPC's running NetBSD, for GDB.
- Copyright 1988, 1989, 1991, 1992, 1994, 1996, 2000, 2001
- Free Software Foundation, Inc.
+ Copyright 2002 Free Software Foundation, Inc.
+ Contributed by Wasabi Systems, Inc.
This file is part of GDB.
@@ -22,124 +22,100 @@
#include <sys/types.h>
#include <sys/ptrace.h>
#include <machine/reg.h>
-#include <machine/frame.h>
#include "defs.h"
#include "inferior.h"
-#include "gdbcore.h"
-#include "ppc-tdep.h"
-#include "regcache.h"
-#define RF(dst, src) \
- memcpy(&registers[REGISTER_BYTE(dst)], &src, sizeof(src))
-
-#define RS(src, dst) \
- memcpy(&dst, &registers[REGISTER_BYTE(src)], sizeof(dst))
+#include "ppc-tdep.h"
+#include "ppcnbsd-tdep.h"
-void
-fetch_inferior_registers (int regno)
+/* Returns true if PT_GETREGS fetches this register. */
+static int
+getregs_supplies (int regno)
{
- struct reg inferior_registers;
-#ifdef PT_GETFPREGS
- struct fpreg inferior_fp_registers;
-#endif
- int i;
-
- ptrace (PT_GETREGS, PIDGET (inferior_ptid),
- (PTRACE_ARG3_TYPE) & inferior_registers, 0);
- for (i = 0; i < 32; i++)
- RF (i, inferior_registers.fixreg[i]);
- RF (gdbarch_tdep (current_gdbarch)->ppc_lr_regnum, inferior_registers.lr);
- RF (gdbarch_tdep (current_gdbarch)->ppc_cr_regnum, inferior_registers.cr);
- RF (gdbarch_tdep (current_gdbarch)->ppc_xer_regnum, inferior_registers.xer);
- RF (gdbarch_tdep (current_gdbarch)->ppc_ctr_regnum, inferior_registers.ctr);
- RF (PC_REGNUM, inferior_registers.pc);
-
-#ifdef PT_GETFPREGS
- ptrace (PT_GETFPREGS, PIDGET (inferior_ptid),
- (PTRACE_ARG3_TYPE) &inferior_fp_registers, 0);
- for (i = 0; i < 32; i++)
- RF (FP0_REGNUM + i, inferior_fp_registers.fpreg[i]);
-#endif
-
- registers_fetched ();
+ struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+
+ return ((regno >= 0 && regno <= 31)
+ || regno == tdep->ppc_lr_regnum
+ || regno == tdep->ppc_cr_regnum
+ || regno == tdep->ppc_xer_regnum
+ || regno == tdep->ppc_ctr_regnum
+ || regno == PC_REGNUM);
}
-void
-store_inferior_registers (int regno)
+/* Like above, but for PT_GETFPREGS. */
+static int
+getfpregs_supplies (int regno)
{
- struct reg inferior_registers;
-#ifdef PT_SETFPREGS
- struct fpreg inferior_fp_registers;
-#endif
- int i;
-
- for (i = 0; i < 32; i++)
- RS (i, inferior_registers.fixreg[i]);
- RS (gdbarch_tdep (current_gdbarch)->ppc_lr_regnum, inferior_registers.lr);
- RS (gdbarch_tdep (current_gdbarch)->ppc_cr_regnum, inferior_registers.cr);
- RS (gdbarch_tdep (current_gdbarch)->ppc_xer_regnum, inferior_registers.xer);
- RS (gdbarch_tdep (current_gdbarch)->ppc_ctr_regnum, inferior_registers.ctr);
- RS (PC_REGNUM, inferior_registers.pc);
-
- ptrace (PT_SETREGS, PIDGET (inferior_ptid),
- (PTRACE_ARG3_TYPE) & inferior_registers, 0);
-
-#ifdef PT_SETFPREGS
- for (i = 0; i < 32; i++)
- RS (FP0_REGNUM + i, inferior_fp_registers.fpreg[i]);
- ptrace (PT_SETFPREGS, PIDGET (inferior_ptid),
- (PTRACE_ARG3_TYPE) & inferior_fp_registers, 0);
-#endif
-}
+ struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
-struct md_core
-{
- struct reg intreg;
-#ifdef PT_GETFPREGS
- struct fpreg freg;
-#endif
-};
+ return ((regno >= FP0_REGNUM && regno <= FP0_REGNUM + 31)
+ || regno == tdep->ppc_fpscr_regnum);
+}
void
-fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, int which,
- CORE_ADDR ignore)
+fetch_inferior_registers (int regno)
{
- struct md_core *core_reg = (struct md_core *) core_reg_sect;
- int i;
-
- /* Integer registers */
- for (i = 0; i < 32; i++)
- RF (i, core_reg->intreg.fixreg[i]);
- RF (gdbarch_tdep (current_gdbarch)->ppc_lr_regnum, core_reg->intreg.lr);
- RF (gdbarch_tdep (current_gdbarch)->ppc_cr_regnum, core_reg->intreg.cr);
- RF (gdbarch_tdep (current_gdbarch)->ppc_xer_regnum, core_reg->intreg.xer);
- RF (gdbarch_tdep (current_gdbarch)->ppc_ctr_regnum, core_reg->intreg.ctr);
- RF (PC_REGNUM, core_reg->intreg.pc);
-
-#ifdef PT_FPGETREGS
- /* Floating point registers */
- for (i = 0; i < 32; i++)
- RF (FP0_REGNUM + i, core_reg->freg.fpreg[i]);
-#endif
-
- registers_fetched ();
+ if (regno == -1 || getregs_supplies (regno))
+ {
+ struct reg regs;
+
+ if (ptrace (PT_GETREGS, PIDGET (inferior_ptid),
+ (PTRACE_ARG3_TYPE) &regs, 0) == -1)
+ perror_with_name ("Couldn't get registers");
+
+ ppcnbsd_supply_reg ((char *) &regs, regno);
+ if (regno != -1)
+ return;
+ }
+
+ if (regno == -1 || getfpregs_supplies (regno))
+ {
+ struct fpreg fpregs;
+
+ if (ptrace (PT_GETFPREGS, PIDGET (inferior_ptid),
+ (PTRACE_ARG3_TYPE) &fpregs, 0) == -1)
+ perror_with_name ("Couldn't get FP registers");
+
+ ppcnbsd_supply_fpreg ((char *) &fpregs, regno);
+ if (regno != -1)
+ return;
+ }
}
-/* Register that we are able to handle ppcnbsd core file formats.
- FIXME: is this really bfd_target_unknown_flavour? */
-
-static struct core_fns ppcnbsd_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 */
-};
-
void
-_initialize_ppcnbsd_nat (void)
+store_inferior_registers (int regno)
{
- add_core_fns (&ppcnbsd_core_fns);
+ if (regno == -1 || getregs_supplies (regno))
+ {
+ struct reg regs;
+
+ if (ptrace (PT_GETREGS, PIDGET (inferior_ptid),
+ (PTRACE_ARG3_TYPE) &regs, 0) == -1)
+ perror_with_name ("Couldn't get registers");
+
+ ppcnbsd_fill_reg ((char *) &regs, regno);
+
+ if (ptrace (PT_SETREGS, PIDGET (inferior_ptid),
+ (PTRACE_ARG3_TYPE) &regs, 0) == -1)
+ perror_with_name ("Couldn't write registers");
+
+ if (regno != -1)
+ return;
+ }
+
+ if (regno == -1 || getfpregs_supplies (regno))
+ {
+ struct fpreg fpregs;
+
+ if (ptrace (PT_GETFPREGS, PIDGET (inferior_ptid),
+ (PTRACE_ARG3_TYPE) &fpregs, 0) == -1)
+ perror_with_name ("Couldn't get FP registers");
+
+ ppcnbsd_fill_fpreg ((char *) &fpregs, regno);
+
+ if (ptrace (PT_SETFPREGS, PIDGET (inferior_ptid),
+ (PTRACE_ARG3_TYPE) &fpregs, 0) == -1)
+ perror_with_name ("Couldn't set FP registers");
+ }
}
diff --git a/gdb/ppcnbsd-tdep.c b/gdb/ppcnbsd-tdep.c
new file mode 100644
index 00000000000..44d86825872
--- /dev/null
+++ b/gdb/ppcnbsd-tdep.c
@@ -0,0 +1,216 @@
+/* Target-dependent code for PowerPC systems running NetBSD.
+ Copyright 2002 Free Software Foundation, Inc.
+ Contributed by Wasabi Systems, 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 "defs.h"
+#include "gdbcore.h"
+#include "regcache.h"
+#include "target.h"
+#include "breakpoint.h"
+#include "value.h"
+
+#include "ppc-tdep.h"
+#include "ppcnbsd-tdep.h"
+#include "nbsd-tdep.h"
+
+#include "solib-svr4.h"
+
+#define REG_FIXREG_OFFSET(x) ((x) * 4)
+#define REG_LR_OFFSET (32 * 4)
+#define REG_CR_OFFSET (33 * 4)
+#define REG_XER_OFFSET (34 * 4)
+#define REG_CTR_OFFSET (35 * 4)
+#define REG_PC_OFFSET (36 * 4)
+#define SIZEOF_STRUCT_REG (37 * 4)
+
+#define FPREG_FPR_OFFSET(x) ((x) * 8)
+#define FPREG_FPSCR_OFFSET (32 * 8)
+#define SIZEOF_STRUCT_FPREG (33 * 8)
+
+void
+ppcnbsd_supply_reg (char *regs, int regno)
+{
+ struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+ int i;
+
+ for (i = 0; i <= 31; i++)
+ {
+ if (regno == i || regno == -1)
+ supply_register (i, regs + REG_FIXREG_OFFSET (i));
+ }
+
+ if (regno == tdep->ppc_lr_regnum || regno == -1)
+ supply_register (tdep->ppc_lr_regnum, regs + REG_LR_OFFSET);
+
+ if (regno == tdep->ppc_cr_regnum || regno == -1)
+ supply_register (tdep->ppc_cr_regnum, regs + REG_CR_OFFSET);
+
+ if (regno == tdep->ppc_xer_regnum || regno == -1)
+ supply_register (tdep->ppc_xer_regnum, regs + REG_XER_OFFSET);
+
+ if (regno == tdep->ppc_ctr_regnum || regno == -1)
+ supply_register (tdep->ppc_ctr_regnum, regs + REG_CTR_OFFSET);
+
+ if (regno == PC_REGNUM || regno == -1)
+ supply_register (PC_REGNUM, regs + REG_PC_OFFSET);
+}
+
+void
+ppcnbsd_fill_reg (char *regs, int regno)
+{
+ struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+ int i;
+
+ for (i = 0; i <= 31; i++)
+ {
+ if (regno == i || regno == -1)
+ regcache_collect (i, regs + REG_FIXREG_OFFSET (i));
+ }
+
+ if (regno == tdep->ppc_lr_regnum || regno == -1)
+ regcache_collect (tdep->ppc_lr_regnum, regs + REG_LR_OFFSET);
+
+ if (regno == tdep->ppc_cr_regnum || regno == -1)
+ regcache_collect (tdep->ppc_cr_regnum, regs + REG_CR_OFFSET);
+
+ if (regno == tdep->ppc_xer_regnum || regno == -1)
+ regcache_collect (tdep->ppc_xer_regnum, regs + REG_XER_OFFSET);
+
+ if (regno == tdep->ppc_ctr_regnum || regno == -1)
+ regcache_collect (tdep->ppc_ctr_regnum, regs + REG_CTR_OFFSET);
+
+ if (regno == PC_REGNUM || regno == -1)
+ regcache_collect (PC_REGNUM, regs + REG_PC_OFFSET);
+}
+
+void
+ppcnbsd_supply_fpreg (char *fpregs, int regno)
+{
+ struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+ int i;
+
+ for (i = FP0_REGNUM; i <= FP0_REGNUM + 31; i++)
+ {
+ if (regno == i || regno == -1)
+ supply_register (i, fpregs + FPREG_FPR_OFFSET (i - FP0_REGNUM));
+ }
+
+ if (regno == tdep->ppc_fpscr_regnum || regno == -1)
+ supply_register (tdep->ppc_fpscr_regnum, fpregs + FPREG_FPSCR_OFFSET);
+}
+
+void
+ppcnbsd_fill_fpreg (char *fpregs, int regno)
+{
+ struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+ int i;
+
+ for (i = FP0_REGNUM; i <= FP0_REGNUM + 31; i++)
+ {
+ if (regno == i || regno == -1)
+ regcache_collect (i, fpregs + FPREG_FPR_OFFSET (i - FP0_REGNUM));
+ }
+
+ if (regno == tdep->ppc_fpscr_regnum || regno == -1)
+ regcache_collect (tdep->ppc_fpscr_regnum, fpregs + FPREG_FPSCR_OFFSET);
+}
+
+static void
+fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, int which,
+ CORE_ADDR ignore)
+{
+ char *regs, *fpregs;
+
+ /* We get everything from one section. */
+ if (which != 0)
+ return;
+
+ regs = core_reg_sect;
+ fpregs = core_reg_sect + SIZEOF_STRUCT_REG;
+
+ /* Integer registers. */
+ ppcnbsd_supply_reg (regs, -1);
+
+ /* Floating point registers. */
+ ppcnbsd_supply_fpreg (fpregs, -1);
+}
+
+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
+ ppcnbsd_supply_reg (core_reg_sect, -1);
+ break;
+
+ case 2: /* Floating point registers. */
+ if (core_reg_size != SIZEOF_STRUCT_FPREG)
+ warning ("Wrong size FP register set in core file.");
+ else
+ ppcnbsd_supply_fpreg (core_reg_sect, -1);
+ break;
+
+ default:
+ /* Don't know what kind of register request this is; just ignore it. */
+ break;
+ }
+}
+
+static struct core_fns ppcnbsd_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 ppcnbsd_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 */
+};
+
+static void
+ppcnbsd_init_abi (struct gdbarch_info info,
+ struct gdbarch *gdbarch)
+{
+
+ set_solib_svr4_fetch_link_map_offsets (gdbarch,
+ nbsd_ilp32_solib_svr4_fetch_link_map_offsets);
+}
+
+void
+_initialize_ppcnbsd_tdep (void)
+{
+ gdbarch_register_osabi (bfd_arch_powerpc, GDB_OSABI_NETBSD_ELF,
+ ppcnbsd_init_abi);
+
+ add_core_fns (&ppcnbsd_core_fns);
+ add_core_fns (&ppcnbsd_elfcore_fns);
+}
diff --git a/gdb/ppcnbsd-tdep.h b/gdb/ppcnbsd-tdep.h
new file mode 100644
index 00000000000..3eae72d819a
--- /dev/null
+++ b/gdb/ppcnbsd-tdep.h
@@ -0,0 +1,30 @@
+/* Common target dependent code for GDB on PowerPC systems running NetBSD.
+ 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 PPCNBSD_TDEP_H
+#define PPCNBSD_TDEP_H
+
+void ppcnbsd_supply_reg (char *, int);
+void ppcnbsd_fill_reg (char *, int);
+
+void ppcnbsd_supply_fpreg (char *, int);
+void ppcnbsd_fill_fpreg (char *, int);
+
+#endif /* PPCNBSD_TDEP_H */
diff --git a/gdb/rdi-share/devsw.c b/gdb/rdi-share/devsw.c
index d5318d05b56..9afc2f8ded0 100644
--- a/gdb/rdi-share/devsw.c
+++ b/gdb/rdi-share/devsw.c
@@ -53,7 +53,7 @@ static void openLogFile ()
/* The following line is equivalent to: */
/* setlinebuf (angelDebugLogFile); */
setvbuf(angelDebugLogFile, (char *)NULL, _IOLBF, 0);
-#if defined(__CYGWIN32__) || defined(__CYGWIN__)
+#if defined(__CYGWIN__)
setmode(fileno(angelDebugLogFile), O_TEXT);
#endif
}
diff --git a/gdb/rdi-share/host.h b/gdb/rdi-share/host.h
index 2fdbf5f4541..9944c15b714 100644
--- a/gdb/rdi-share/host.h
+++ b/gdb/rdi-share/host.h
@@ -29,14 +29,6 @@
# define offsetof(T, member) ((char *)&(((T *)0)->member) - (char *)0)
#endif
-/* If under Cygwin, provide backwards compatibility with older
- Cygwin compilers that don't define the current cpp define. */
-#ifdef __CYGWIN32__
-#ifndef __CYGWIN__
-#define __CYGWIN__
-#endif
-#endif
-
/* A temporary sop to older compilers */
#if defined (__NetBSD__) || defined (unix)
# ifndef __unix /* (good for long-term portability?) */
@@ -52,7 +44,7 @@
#endif
#if defined(_WIN32)
# define COMPILING_ON_WIN32 1
-# if !defined(__CYGWIN32__)
+# if !defined(__CYGWIN__)
# define COMPILING_ON_WINDOWS 1
# endif
#endif
diff --git a/gdb/rdi-share/hostchan.c b/gdb/rdi-share/hostchan.c
index 7d293ca1da9..89b5f26bb6c 100644
--- a/gdb/rdi-share/hostchan.c
+++ b/gdb/rdi-share/hostchan.c
@@ -556,7 +556,7 @@ static unsigned long tv_diff(const struct timeval *time_now,
- ((time_was->tv_sec * 1000000) + time_was->tv_usec) );
}
-#if !defined(__unix) && !defined(__CYGWIN32__)
+#if !defined(__unix) && !defined(__CYGWIN__)
static void gettimeofday( struct timeval *time_now, void *dummy )
{
time_t t = clock();
diff --git a/gdb/rdi-share/hostchan.h b/gdb/rdi-share/hostchan.h
index 54afea20e04..df70e1ccafe 100644
--- a/gdb/rdi-share/hostchan.h
+++ b/gdb/rdi-share/hostchan.h
@@ -15,14 +15,6 @@
#ifndef angsd_hostchan_h
#define angsd_hostchan_h
-/* If under Cygwin, provide backwards compatibility with older
- Cygwin compilers that don't define the current cpp define. */
-#ifdef __CYGWIN32__
-#ifndef __CYGWIN__
-#define __CYGWIN__
-#endif
-#endif
-
/* A temporary sop to older compilers */
#if defined (__NetBSD__) || defined (unix)
# ifndef __unix /* (good for long-term portability?) */
@@ -31,7 +23,7 @@
#endif
/* struct timeval */
-#if defined(__unix) || defined(__CYGWIN32__)
+#if defined(__unix) || defined(__CYGWIN__)
# include <sys/time.h>
#else
# include "winsock.h"
diff --git a/gdb/rdi-share/serdrv.c b/gdb/rdi-share/serdrv.c
index a26e0ec91f0..9fb95a83623 100644
--- a/gdb/rdi-share/serdrv.c
+++ b/gdb/rdi-share/serdrv.c
@@ -254,7 +254,7 @@ static int SerialOpen(const char *name, const char *arg)
serial_reset();
-#if defined(__unix) || defined(__CYGWIN32__)
+#if defined(__unix) || defined(__CYGWIN__)
Unix_ioctlNonBlocking();
#endif
diff --git a/gdb/rdi-share/serpardr.c b/gdb/rdi-share/serpardr.c
index 4d422a70670..8de676f1303 100644
--- a/gdb/rdi-share/serpardr.c
+++ b/gdb/rdi-share/serpardr.c
@@ -278,7 +278,7 @@ static int SerparOpen(const char *name, const char *arg)
serpar_reset();
-#if defined(__unix) || defined(__CYGWIN32__)
+#if defined(__unix) || defined(__CYGWIN__)
Unix_ioctlNonBlocking();
#endif
diff --git a/gdb/rdi-share/unixcomm.c b/gdb/rdi-share/unixcomm.c
index 7694a31f24b..0a61e2555dc 100644
--- a/gdb/rdi-share/unixcomm.c
+++ b/gdb/rdi-share/unixcomm.c
@@ -96,7 +96,7 @@
#define PARPORT2 "/dev/par1"
#endif
-#if defined(_WIN32) || defined (__CYGWIN32__)
+#if defined(_WIN32) || defined (__CYGWIN__)
#define SERIAL_PREFIX "com"
#define SERPORT1 "com1"
#define SERPORT2 "com2"
@@ -248,7 +248,7 @@ extern int Unix_IsSerialInUse(void)
extern int Unix_OpenSerial(const char *name)
{
-#if defined(BSD) || defined(__CYGWIN32__)
+#if defined(BSD) || defined(__CYGWIN__)
serpfd = open(name, O_RDWR);
#else
serpfd = open(name, O_RDWR | O_NONBLOCK);
diff --git a/gdb/regbuf.c b/gdb/regbuf.c
deleted file mode 100644
index 79953540576..00000000000
--- a/gdb/regbuf.c
+++ /dev/null
@@ -1,220 +0,0 @@
-/* Register buffer sufficient to hold all raw registers
-
- Copyright 2002 Free Software Foundation, Inc.
-
- This file is part of GDB.
-
- Contributed by Red Hat, 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. */
-
-#include "defs.h"
-#include "regbuf.h"
-#include "gdb_assert.h"
-
-extern void _initialize_regbuf (void);
-
-/* Per-architecture object describing the layout of a register buffer.
- Computed once when the architecture is created */
-
-struct gdbarch_data *regcache_data_handle;
-
-struct regbuf_descr
-{
- struct gdbarch *gdbarch;
- /* Size of the register buffer, over-allocate making room for both
- real and pseudo-registers. */
- /* FIXME: cagney/2002-05-11: This over-allocation shouldn't be
- necessary, only some targets store values in the pseudo-register
- section and we want to be sure that GDB won't trash memory. */
- long sizeof_registers;
- /* Total number of registers in the buffer. */
- int nr_registers;
- /* Offset into the register buffer for each register. */
- long *register_offset;
- /* Size, in ``bytes'', of a register. */
- long *sizeof_register;
-};
-
-static struct regbuf_descr *
-regbuf_descr (struct gdbarch *gdbarch)
-{
- int i;
- /* FIXME: cagney/2002-05-11: gdbarch_data() should take that
- ``gdbarch'' as a parameter. */
- struct regbuf_descr *descr = gdbarch_data (gdbarch, regbuf_data_handle);
- if (descr != NULL)
- return descr;
-
- descr = XMALLOC (struct regbuf_descr);
- descr->gdbarch = gdbarch;
- /* FIXME: cagney/2002-05-11: Shouldn't be including pseudo-registers
- in the register buffer. Unfortunatly some architectures are
- storing pseudo register values in the raw register buffer. */
- descr->nr_registers = NUM_REGS + NUM_PSEUDO_REGS;
- /* FIXME: cagney/2002-05-11: Instead of using REGISTER_BYTE() this
- should compute, at runtime, an offset table describing where each
- register is in the register table. This currently isn't possible
- because some targets overlap registers, ulgh! */
- descr->register_offset = XCALLOC (descr->nr_registers, long);
- descr->sizeof_register = XCALLOC (descr->nr_registers, long);
- for (i = 0; i < descr->nr_registers; i++)
- {
- descr->register_offset[i] = REGISTER_BYTE (i);
- descr->sizeof_register[i] = REGISTER_RAW_SIZE (i);
- }
- /* Come up with the real size of the registers buffer. */
- descr->sizeof_registers = REGISTER_BYTES; /* OK use. */
- for (i = 0; i < descr->nr_registers; i++)
- {
- long regend;
- /* Keep extending the buffer so that there is always enough
- space for all registers. The comparison is necessary since
- legacy code is free to put registers in random places in the
- buffer separated by holes. Once REGISTER_BYTE() is killed
- this can be greatly simplified. */
- /* FIXME: cagney/2001-12-04: This code shouldn't need to use
- REGISTER_BYTE(). Unfortunatly, legacy code likes to lay the
- buffer out so that certain registers just happen to overlap.
- Ulgh! New targets use gdbarch's register read/write and
- entirely avoid this uglyness. */
- regend = descr->register_offset[i] + descr->sizeof_register[i];
- if (descr->sizeof_registers < regend)
- descr->sizeof_registers = regend;
- }
- set_gdbarch_data (gdbarch, regbuf_data_handle, descr);
- return descr;
-}
-
-static void
-xfree_regbuf (struct gdbarch *gdbarch, void *ptr)
-{
- struct regbuf_descr *descr = ptr;
- if (descr == NULL)
- return;
- xfree (descr->register_offset);
- xfree (descr->sizeof_register);
- xfree (descr);
-}
-
-/* For moment, ``struct regbuf'' is just a character buffer. */
-
-struct regbuf
-{
- struct regbuf_descr *descr;
- char *registers;
- char *valid_p;
-};
-
-struct regbuf *
-regbuf_xmalloc (struct gdbarch *gdbarch)
-{
- struct regbuf_descr *descr = regbuf_descr (gdbarch);
- struct regbuf *regbuf = XMALLOC (struct regbuf);
- regbuf->descr = descr;
- regbuf->registers = xmalloc (descr->sizeof_registers);
- regbuf->valid_p = xmalloc (descr->nr_registers);
- return regbuf;
-}
-
-void
-regbuf_xfree (struct regbuf *regbuf)
-{
- gdb_assert (regbuf != NULL);
- xfree (regbuf->registers);
- xfree (regbuf->valid_p);
- xfree (regbuf);
-}
-
-void
-do_regbuf_xfree (void *buf)
-{
- regbuf_xfree (buf);
-}
-
-struct regbuf *
-regbuf_xmalloc_with_cleanup (struct gdbarch *gdbarch)
-{
- struct regbuf *regbuf = regbuf_xmalloc (gdbarch);
- make_cleanup (do_regbuf_xfree, regbuf);
- return regbuf;
-}
-
-struct regbuf *
-regbuf_dup (struct regbuf *regbuf)
-{
- struct regbuf *newbuf = regbuf_xmalloc (regbuf->descr->gdbarch);
- memcpy (newbuf->registers, regbuf->registers,
- regbuf->descr->sizeof_registers);
- memcpy (newbuf->valid_p, regbuf->valid_p, regbuf->descr->nr_registers);
- return newbuf;
-}
-
-int
-regbuf_valid_p (struct regbuf *regbuf, int regnum)
-{
- gdb_assert (regnum != NULL);
- gdb_assert (regnum >= 0 && regnum < NUM_REGS + NUM_PSEUDO_REGS);
- return regbuf->valid_p[regnum];
-}
-
-void
-regbuf_read (struct regbuf *regbuf, int regnum, void *buf)
-{
- gdb_assert (regbuf != NULL);
- gdb_assert (regnum >= 0 && regnum < regbuf->descr->nr_registers);
- memcpy (buf, regbuf->registers + regbuf->descr->register_offset[regnum],
- regbuf->descr->sizeof_register[regnum]);
-}
-
-void
-regbuf_write (struct regbuf *regbuf, int regnum, const void *buf)
-{
- gdb_assert (regbuf != NULL);
- gdb_assert (regnum >= 0 && regnum < regbuf->descr->nr_registers);
- memcpy (regbuf->registers + regbuf->descr->register_offset[regnum], buf,
- regbuf->descr->sizeof_register[regnum]);
- regbuf->valid_p[regnum] = 1;
-}
-
-CORE_ADDR
-regbuf_read_as_address (struct regbuf *regbuf, int regnum)
-{
- char *buf;
- gdb_assert (regbuf != NULL);
- gdb_assert (regnum >= 0 && regnum < regbuf->descr->nr_registers);
- buf = alloca (regbuf->descr->sizeof_register[regnum]);
- regbuf_read (regbuf, regnum, buf);
- return extract_address (buf, regbuf->descr->sizeof_register[regnum]);
-}
-
-char *
-grub_around_regbuf_for_registers (struct regbuf *regbuf)
-{
- return regbuf->registers;
-}
-
-char *
-grub_around_regbuf_for_register_valid (struct regbuf *regbuf)
-{
- return regbuf->valid_p;
-}
-
-void
-_initialize_regbuf (void)
-{
- regbuf_data_handle = register_gdbarch_data (NULL, xfree_regbuf);
-}
diff --git a/gdb/regbuf.h b/gdb/regbuf.h
deleted file mode 100644
index 45955f9c7bc..00000000000
--- a/gdb/regbuf.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* Register buffer sufficient to hold all raw registers
-
- Copyright 2002 Free Software Foundation, Inc.
-
- This file is part of GDB.
-
- Contributed by Red Hat, 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. */
-
-#ifndef REGBUF_H
-#define REGBUF_H
-
-struct regbuf;
-
-/* Create/destroy the register buffer. */
-
-extern struct regbuf *regbuf_xmalloc (struct gdbarch *gdbarch);
-extern void regbuf_xfree (struct regbuf *regbuf);
-extern struct regbuf *regbuf_xmalloc_with_cleanup (struct gdbarch *gdbarch);
-
-/* Duplicate a regbuf and all contents. */
-
-extern struct regbuf *regbuf_dup (struct regbuf *regbuf);
-
-/* Is the regbuf entry valid. */
-
-int regbuf_valid_p (struct regbuf *regbuf, int regnum);
-
-/* Access the register buffer. */
-
-extern void regbuf_read (struct regbuf *regbuf, int rawnum, void *buf);
-extern void regbuf_write (struct regbuf *regbuf, int rawnum, const void *buf);
-
-/* Convenience routines for reading/writing registers using an
- internal format. */
-
-extern CORE_ADDR regbuf_read_as_address (struct regbuf *regbuf, int regnum);
-
-/* FIXME: cagney/2002-05-11: This is here simply to prop up the
- `registers' and `register_valid' global arrays. */
-
-extern char *grub_around_regbuf_for_registers (struct regbuf *regbuf);
-extern char *grub_around_regbuf_for_register_valid (struct regbuf *regbuf);
-
-#endif /* REGBUF_H */
diff --git a/gdb/remote-rdp.c b/gdb/remote-rdp.c
index 280e79cdad4..34a42abb1fa 100644
--- a/gdb/remote-rdp.c
+++ b/gdb/remote-rdp.c
@@ -41,7 +41,7 @@
#include "defs.h"
#include "inferior.h"
#include "value.h"
-#include "callback.h"
+#include "gdb/callback.h"
#include "command.h"
#include <ctype.h>
#include <fcntl.h>
diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c
index 1d037c8fa79..221efe45674 100644
--- a/gdb/remote-sim.c
+++ b/gdb/remote-sim.c
@@ -35,11 +35,13 @@
#include "terminal.h"
#include "target.h"
#include "gdbcore.h"
-#include "callback.h"
-#include "remote-sim.h"
+#include "gdb/callback.h"
+#include "gdb/remote-sim.h"
#include "remote-utils.h"
#include "command.h"
#include "regcache.h"
+#include "gdb_assert.h"
+#include "sim-regno.h"
/* Prototypes */
@@ -276,46 +278,72 @@ gdb_os_error (host_callback * p, const char *format,...)
}
}
+int
+one2one_register_sim_regno (int regnum)
+{
+ /* Only makes sense to supply raw registers. */
+ gdb_assert (regnum >= 0 && regnum < NUM_REGS);
+ return regnum;
+}
+
static void
gdbsim_fetch_register (int regno)
{
- static int warn_user = 1;
if (regno == -1)
{
for (regno = 0; regno < NUM_REGS; regno++)
gdbsim_fetch_register (regno);
+ return;
}
- else if (REGISTER_NAME (regno) != NULL
- && *REGISTER_NAME (regno) != '\0')
+
+ switch (REGISTER_SIM_REGNO (regno))
{
- char buf[MAX_REGISTER_RAW_SIZE];
- int nr_bytes;
- if (REGISTER_SIM_REGNO (regno) >= 0)
+ case LEGACY_SIM_REGNO_IGNORE:
+ break;
+ case SIM_REGNO_DOES_NOT_EXIST:
+ {
+ /* For moment treat a `does not exist' register the same way
+ as an ``unavailable'' register. */
+ char *buf = alloca (MAX_REGISTER_RAW_SIZE);
+ int nr_bytes;
+ memset (buf, 0, MAX_REGISTER_RAW_SIZE);
+ supply_register (regno, buf);
+ set_register_cached (regno, -1);
+ break;
+ }
+ default:
+ {
+ static int warn_user = 1;
+ char *buf = alloca (MAX_REGISTER_RAW_SIZE);
+ int nr_bytes;
+ gdb_assert (regno >= 0 && regno < NUM_REGS);
+ memset (buf, 0, MAX_REGISTER_RAW_SIZE);
nr_bytes = sim_fetch_register (gdbsim_desc,
REGISTER_SIM_REGNO (regno),
buf, REGISTER_RAW_SIZE (regno));
- else
- nr_bytes = 0;
- if (nr_bytes == 0)
- /* register not applicable, supply zero's */
- memset (buf, 0, MAX_REGISTER_RAW_SIZE);
- else if (nr_bytes > 0 && nr_bytes != REGISTER_RAW_SIZE (regno)
- && warn_user)
- {
- fprintf_unfiltered (gdb_stderr,
- "Size of register %s (%d/%d) incorrect (%d instead of %d))",
- REGISTER_NAME (regno),
- regno, REGISTER_SIM_REGNO (regno),
- nr_bytes, REGISTER_RAW_SIZE (regno));
- warn_user = 0;
- }
- supply_register (regno, buf);
- if (sr_get_debug ())
- {
- printf_filtered ("gdbsim_fetch_register: %d", regno);
- /* FIXME: We could print something more intelligible. */
- dump_mem (buf, REGISTER_RAW_SIZE (regno));
- }
+ if (nr_bytes > 0 && nr_bytes != REGISTER_RAW_SIZE (regno) && warn_user)
+ {
+ fprintf_unfiltered (gdb_stderr,
+ "Size of register %s (%d/%d) incorrect (%d instead of %d))",
+ REGISTER_NAME (regno),
+ regno, REGISTER_SIM_REGNO (regno),
+ nr_bytes, REGISTER_RAW_SIZE (regno));
+ warn_user = 0;
+ }
+ /* FIXME: cagney/2002-05-27: Should check `nr_bytes == 0'
+ indicatingthat GDB and the SIM have different ideas about
+ which registers are fetchable. */
+ /* Else if (nr_bytes < 0): an old simulator, that doesn't
+ think to return the register size. Just assume all is ok. */
+ supply_register (regno, buf);
+ if (sr_get_debug ())
+ {
+ printf_filtered ("gdbsim_fetch_register: %d", regno);
+ /* FIXME: We could print something more intelligible. */
+ dump_mem (buf, REGISTER_RAW_SIZE (regno));
+ }
+ break;
+ }
}
}
@@ -327,10 +355,9 @@ gdbsim_store_register (int regno)
{
for (regno = 0; regno < NUM_REGS; regno++)
gdbsim_store_register (regno);
+ return;
}
- else if (REGISTER_NAME (regno) != NULL
- && *REGISTER_NAME (regno) != '\0'
- && REGISTER_SIM_REGNO (regno) >= 0)
+ else if (REGISTER_SIM_REGNO (regno) >= 0)
{
char tmp[MAX_REGISTER_RAW_SIZE];
int nr_bytes;
@@ -341,6 +368,9 @@ gdbsim_store_register (int regno)
if (nr_bytes > 0 && nr_bytes != REGISTER_RAW_SIZE (regno))
internal_error (__FILE__, __LINE__,
"Register size different to expected");
+ /* FIXME: cagney/2002-05-27: Should check `nr_bytes == 0'
+ indicatingthat GDB and the SIM have different ideas about
+ which registers are fetchable. */
if (sr_get_debug ())
{
printf_filtered ("gdbsim_store_register: %d", regno);
diff --git a/gdb/remote-vx29k.c b/gdb/remote-vx29k.c
deleted file mode 100644
index 798cd088396..00000000000
--- a/gdb/remote-vx29k.c
+++ /dev/null
@@ -1,182 +0,0 @@
-/* Am29k-dependent portions of the RPC protocol
-
- Contributed by Wind River Systems.
-
- 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 <stdio.h>
-#include "defs.h"
-
-#include "vx-share/regPacket.h"
-#include "frame.h"
-#include "inferior.h"
-#include "target.h"
-#include "gdbcore.h"
-#include "command.h"
-#include "symtab.h"
-#include "symfile.h" /* for struct complaint */
-#include "regcache.h"
-
-#include "gdb_string.h"
-#include <errno.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/socket.h>
-
-#ifdef _AIX /* IBM claims "void *malloc()" not char * */
-#define malloc bogon_malloc
-#endif
-
-#include <rpc/rpc.h>
-#include <sys/time.h> /* UTek's <rpc/rpc.h> doesn't #incl this */
-#include <netdb.h>
-#include "vx-share/ptrace.h"
-#include "vx-share/xdr_ptrace.h"
-#include "vx-share/xdr_ld.h"
-#include "vx-share/xdr_rdb.h"
-#include "vx-share/dbgRpcLib.h"
-
-/* get rid of value.h if possible */
-#include <value.h>
-#include <symtab.h>
-
-/* Flag set if target has fpu */
-
-extern int target_has_fp;
-
-/* Generic register read/write routines in remote-vx.c. */
-
-extern void net_read_registers ();
-extern void net_write_registers ();
-
-/* Read a register or registers from the VxWorks target.
- REGNO is the register to read, or -1 for all; currently,
- it is ignored. FIXME look at regno to improve efficiency. */
-
-void
-vx_read_register (int regno)
-{
- char am29k_greg_packet[AM29K_GREG_PLEN];
- char am29k_fpreg_packet[AM29K_FPREG_PLEN];
-
- /* Get general-purpose registers. When copying values into
- registers [], don't assume that a location in registers []
- is properly aligned for the target data type. */
-
- net_read_registers (am29k_greg_packet, AM29K_GREG_PLEN, PTRACE_GETREGS);
-
- /* Now copy the register values into registers[].
- Note that this code depends on the ordering of the REGNUMs
- as defined in "tm-29k.h". */
-
- bcopy (&am29k_greg_packet[AM29K_R_GR96],
- &registers[REGISTER_BYTE (GR96_REGNUM)], 160 * AM29K_GREG_SIZE);
- bcopy (&am29k_greg_packet[AM29K_R_VAB],
- &registers[REGISTER_BYTE (VAB_REGNUM)], 15 * AM29K_GREG_SIZE);
- registers[REGISTER_BYTE (INTE_REGNUM)] = am29k_greg_packet[AM29K_R_INTE];
- bcopy (&am29k_greg_packet[AM29K_R_RSP],
- &registers[REGISTER_BYTE (GR1_REGNUM)], 5 * AM29K_GREG_SIZE);
-
- /* PAD For now, don't care about exop register */
-
- memset (&registers[REGISTER_BYTE (EXO_REGNUM)], '\0', AM29K_GREG_SIZE);
-
- /* If the target has floating point registers, fetch them.
- Otherwise, zero the floating point register values in
- registers[] for good measure, even though we might not
- need to. */
-
- if (target_has_fp)
- {
- net_read_registers (am29k_fpreg_packet, AM29K_FPREG_PLEN,
- PTRACE_GETFPREGS);
- registers[REGISTER_BYTE (FPE_REGNUM)] = am29k_fpreg_packet[AM29K_R_FPE];
- registers[REGISTER_BYTE (FPS_REGNUM)] = am29k_fpreg_packet[AM29K_R_FPS];
-
- /* PAD For now, don't care about registers (?) AI0 to q */
-
- memset (&registers[REGISTER_BYTE (161)], '\0', 21 * AM29K_FPREG_SIZE);
- }
- else
- {
- memset (&registers[REGISTER_BYTE (FPE_REGNUM)], '\0', AM29K_FPREG_SIZE);
- memset (&registers[REGISTER_BYTE (FPS_REGNUM)], '\0', AM29K_FPREG_SIZE);
-
- /* PAD For now, don't care about registers (?) AI0 to q */
-
- memset (&registers[REGISTER_BYTE (161)], '\0', 21 * AM29K_FPREG_SIZE);
- }
-
- /* Mark the register cache valid. */
-
- registers_fetched ();
-}
-
-/* Store a register or registers into the VxWorks target.
- REGNO is the register to store, or -1 for all; currently,
- it is ignored. FIXME look at regno to improve efficiency. */
-
-void
-vx_write_register (int regno)
-{
- char am29k_greg_packet[AM29K_GREG_PLEN];
- char am29k_fpreg_packet[AM29K_FPREG_PLEN];
-
- /* Store general purpose registers. When copying values from
- registers [], don't assume that a location in registers []
- is properly aligned for the target data type. */
-
- bcopy (&registers[REGISTER_BYTE (GR96_REGNUM)],
- &am29k_greg_packet[AM29K_R_GR96], 160 * AM29K_GREG_SIZE);
- bcopy (&registers[REGISTER_BYTE (VAB_REGNUM)],
- &am29k_greg_packet[AM29K_R_VAB], 15 * AM29K_GREG_SIZE);
- am29k_greg_packet[AM29K_R_INTE] = registers[REGISTER_BYTE (INTE_REGNUM)];
- bcopy (&registers[REGISTER_BYTE (GR1_REGNUM)],
- &am29k_greg_packet[AM29K_R_RSP], 5 * AM29K_GREG_SIZE);
-
- net_write_registers (am29k_greg_packet, AM29K_GREG_PLEN, PTRACE_SETREGS);
-
- /* Store floating point registers if the target has them. */
-
- if (target_has_fp)
- {
- am29k_fpreg_packet[AM29K_R_FPE] = registers[REGISTER_BYTE (FPE_REGNUM)];
- am29k_fpreg_packet[AM29K_R_FPS] = registers[REGISTER_BYTE (FPS_REGNUM)];
-
- net_write_registers (am29k_fpreg_packet, AM29K_FPREG_PLEN,
- PTRACE_SETFPREGS);
- }
-}
-
-/* VxWorks zeroes fp when the task is initialized; we use this
- to terminate the frame chain. Chain means here the nominal address of
- a frame, that is, the return address (lr0) address in the stack. To
- obtain the frame pointer (lr1) contents, we must add 4 bytes.
- Note : may be we should modify init_frame_info() to get the frame pointer
- and store it into the frame_info struct rather than reading its
- contents when FRAME_CHAIN_VALID is invoked. THISFRAME is unused. */
-
-int
-vx29k_frame_chain_valid (CORE_ADDR chain, struct frame_info *thisframe)
-{
- int fp_contents;
-
- read_memory ((CORE_ADDR) (chain + 4), (char *) &fp_contents, 4);
- return (fp_contents != 0);
-}
diff --git a/gdb/remote.c b/gdb/remote.c
index c3f40fed1f9..a1b90b7a5a4 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -86,7 +86,7 @@ static void remote_resume (ptid_t ptid, int step,
enum target_signal siggnal);
static void remote_async_resume (ptid_t ptid, int step,
enum target_signal siggnal);
-static int remote_start_remote (PTR);
+static int remote_start_remote (struct ui_out *uiout, void *dummy);
static void remote_open (char *name, int from_tty);
static void remote_async_open (char *name, int from_tty);
@@ -970,8 +970,8 @@ show_remote_protocol_binary_download_cmd (char *args,
/* Tokens for use by the asynchronous signal handlers for SIGINT */
-PTR sigint_remote_twice_token;
-PTR sigint_remote_token;
+static void *sigint_remote_twice_token;
+static void *sigint_remote_token;
/* These are pointers to hook functions that may be set in order to
modify resume/wait behavior for a particular architecture. */
@@ -2107,14 +2107,16 @@ remote_cisco_objfile_relocate (bfd_signed_vma text_off, bfd_signed_vma data_off,
/* Stub for catch_errors. */
static int
-remote_start_remote_dummy (void *dummy)
+remote_start_remote_dummy (struct ui_out *uiout, void *dummy)
{
start_remote (); /* Initialize gdb process mechanisms */
+ /* NOTE: Return something >=0. A -ve value is reserved for
+ catch_exceptions. */
return 1;
}
static int
-remote_start_remote (PTR dummy)
+remote_start_remote (struct ui_out *uiout, void *dummy)
{
immediate_quit++; /* Allow user to interrupt it */
@@ -2131,7 +2133,9 @@ remote_start_remote (PTR dummy)
putpkt ("?"); /* initiate a query from remote machine */
immediate_quit--;
- return remote_start_remote_dummy (dummy);
+ /* NOTE: See comment above in remote_start_remote_dummy(). This
+ function returns something >=0. */
+ return remote_start_remote_dummy (uiout, dummy);
}
/* Open a connection to a remote debugger.
@@ -2246,6 +2250,7 @@ static void
remote_open_1 (char *name, int from_tty, struct target_ops *target,
int extended_p)
{
+ int ex;
struct remote_state *rs = get_remote_state ();
if (name == 0)
error ("To open a remote debug connection, you need to specify what\n"
@@ -2308,15 +2313,30 @@ remote_open_1 (char *name, int from_tty, struct target_ops *target,
no_shared_libraries (NULL, 0);
#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). */
- if (!catch_errors (remote_start_remote, NULL,
- "Couldn't establish connection to remote target\n",
- RETURN_MASK_ALL))
+ /* Start the remote connection. If error() or QUIT, discard this
+ target (we'd otherwise be in an inconsistent state) and then
+ propogate the error on up the exception chain. This ensures that
+ the caller doesn't stumble along blindly assuming that the
+ function succeeded. The CLI doesn't have this problem but other
+ UI's, such as MI do.
+
+ FIXME: cagney/2002-05-19: Instead of re-throwing the exception,
+ this function should return an error indication letting the
+ caller restore the previous state. Unfortunatly the command
+ ``target remote'' is directly wired to this function making that
+ impossible. On a positive note, the CLI side of this problem has
+ been fixed - the function set_cmd_context() makes it possible for
+ all the ``target ....'' commands to share a common callback
+ function. See cli-dump.c. */
+ ex = catch_exceptions (uiout,
+ remote_start_remote, NULL,
+ "Couldn't establish connection to remote"
+ " target\n",
+ RETURN_MASK_ALL);
+ if (ex < 0)
{
pop_target ();
- return;
+ throw_exception (ex);
}
if (extended_p)
@@ -2347,6 +2367,7 @@ static void
remote_async_open_1 (char *name, int from_tty, struct target_ops *target,
int extended_p)
{
+ int ex;
struct remote_state *rs = get_remote_state ();
if (name == 0)
error ("To open a remote debug connection, you need to specify what\n"
@@ -2419,16 +2440,19 @@ remote_async_open_1 (char *name, int from_tty, struct target_ops *target,
no_shared_libraries (NULL, 0);
#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). */
- if (!catch_errors (remote_start_remote, NULL,
- "Couldn't establish connection to remote target\n",
- RETURN_MASK_ALL))
+ /* Start the remote connection; if error, discard this target. See
+ the comments in remote_open_1() for further details such as the
+ need to re-throw the exception. */
+ ex = catch_exceptions (uiout,
+ remote_start_remote, NULL,
+ "Couldn't establish connection to remote"
+ " target\n",
+ RETURN_MASK_ALL);
+ if (ex < 0)
{
pop_target ();
wait_forever_enabled_p = 1;
- return;
+ throw_exception (ex);
}
wait_forever_enabled_p = 1;
@@ -5472,6 +5496,7 @@ remote_info_process (char *args, int from_tty)
static void
remote_cisco_open (char *name, int from_tty)
{
+ int ex;
if (name == 0)
error ("To open a remote debug connection, you need to specify what \n"
"device is attached to the remote system (e.g. host:port).");
@@ -5534,14 +5559,18 @@ remote_cisco_open (char *name, int from_tty)
someday have a notion of debugging several processes. */
inferior_ptid = pid_to_ptid (MAGIC_NULL_PID);
- /* Start the remote connection; if error (0), discard this target. */
-
- if (!catch_errors (remote_start_remote_dummy, (char *) 0,
- "Couldn't establish connection to remote target\n",
- RETURN_MASK_ALL))
+ /* Start the remote connection; if error, discard this target. See
+ the comments in remote_open_1() for further details such as the
+ need to re-throw the exception. */
+ ex = catch_exceptions (uiout,
+ remote_start_remote_dummy, NULL,
+ "Couldn't establish connection to remote"
+ " target\n",
+ RETURN_MASK_ALL);
+ if (ex < 0)
{
pop_target ();
- return;
+ throw_exception (ex);
}
}
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index 37794725bf0..ffc7bb98b58 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -1857,19 +1857,16 @@ rs6000_do_registers_info (int regnum, int fpregs)
}
else
{
- /* Print as integer in hex and in decimal. */
+ /* Print the register in hex. */
+ val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0,
+ gdb_stdout, 'x', 1, 0, Val_pretty_default);
+ /* If not a vector register, print it also in decimal. */
if (!altivec_register_p (i))
{
- val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0,
- gdb_stdout, 'x', 1, 0, Val_pretty_default);
printf_filtered ("\t");
val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0,
gdb_stdout, 0, 1, 0, Val_pretty_default);
}
- else
- /* Print as integer in hex only. */
- val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0,
- gdb_stdout, 'x', 1, 0, Val_pretty_default);
}
printf_filtered ("\n");
}
@@ -2410,88 +2407,7 @@ find_variant_by_arch (enum bfd_architecture arch, unsigned long mach)
return NULL;
}
-
-
-
-
-static void
-process_note_abi_tag_sections (bfd *abfd, asection *sect, void *obj)
-{
- int *os_ident_ptr = obj;
- const char *name;
- unsigned int sectsize;
-
- name = bfd_get_section_name (abfd, sect);
- sectsize = bfd_section_size (abfd, sect);
- if (strcmp (name, ".note.ABI-tag") == 0 && sectsize > 0)
- {
- unsigned int name_length, data_length, note_type;
- char *note = alloca (sectsize);
-
- bfd_get_section_contents (abfd, sect, note,
- (file_ptr) 0, (bfd_size_type) sectsize);
-
- name_length = bfd_h_get_32 (abfd, note);
- data_length = bfd_h_get_32 (abfd, note + 4);
- note_type = bfd_h_get_32 (abfd, note + 8);
-
- if (name_length == 4 && data_length == 16 && note_type == 1
- && strcmp (note + 12, "GNU") == 0)
- {
- int os_number = bfd_h_get_32 (abfd, note + 16);
-
- /* The case numbers are from abi-tags in glibc */
- switch (os_number)
- {
- case 0 :
- *os_ident_ptr = ELFOSABI_LINUX;
- break;
- case 1 :
- *os_ident_ptr = ELFOSABI_HURD;
- break;
- case 2 :
- *os_ident_ptr = ELFOSABI_SOLARIS;
- break;
- default :
- internal_error (__FILE__, __LINE__,
- "process_note_abi_sections: unknown OS number %d",
- os_number);
- break;
- }
- }
- }
-}
-
-/* Return one of the ELFOSABI_ constants for BFDs representing ELF
- executables. If it's not an ELF executable or if the OS/ABI couldn't
- be determined, simply return -1. */
-
-static int
-get_elfosabi (bfd *abfd)
-{
- int elfosabi = -1;
-
- if (abfd != NULL && bfd_get_flavour (abfd) == bfd_target_elf_flavour)
- {
- elfosabi = elf_elfheader (abfd)->e_ident[EI_OSABI];
-
- /* When elfosabi is 0 (ELFOSABI_NONE), this is supposed to indicate
- that we're on a SYSV system. However, GNU/Linux uses a note section
- to record OS/ABI info, but leaves e_ident[EI_OSABI] zero. So we
- have to check the note sections too. */
- if (elfosabi == 0)
- {
- bfd_map_over_sections (abfd,
- process_note_abi_tag_sections,
- &elfosabi);
- }
- }
-
- return elfosabi;
-}
-
-
/* Initialize the current architecture based on INFO. If possible, re-use an
architecture from ARCHES, which is a list of architectures already created
during this debugging session.
@@ -2510,7 +2426,8 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
enum bfd_architecture arch;
unsigned long mach;
bfd abfd;
- int osabi, sysv_abi;
+ int sysv_abi;
+ enum gdb_osabi osabi = GDB_OSABI_UNKNOWN;
gdbarch_print_insn_ftype *print_insn;
from_xcoff_exec = info.abfd && info.abfd->format == bfd_object &&
@@ -2521,7 +2438,8 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
sysv_abi = info.abfd && bfd_get_flavour (info.abfd) == bfd_target_elf_flavour;
- osabi = get_elfosabi (info.abfd);
+ if (info.abfd)
+ osabi = gdbarch_lookup_osabi (info.abfd);
/* Check word size. If INFO is from a binary file, infer it from
that, else choose a likely default. */
@@ -2706,7 +2624,7 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_register_convert_to_raw (gdbarch, rs6000_register_convert_to_raw);
set_gdbarch_stab_reg_to_regnum (gdbarch, rs6000_stab_reg_to_regnum);
- set_gdbarch_extract_return_value (gdbarch, rs6000_extract_return_value);
+ set_gdbarch_deprecated_extract_return_value (gdbarch, rs6000_extract_return_value);
/* Note: kevinb/2002-04-12: I'm not convinced that rs6000_push_arguments()
is correct for the SysV ABI when the wordsize is 8, but I'm also
@@ -2722,7 +2640,7 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_store_struct_return (gdbarch, rs6000_store_struct_return);
set_gdbarch_store_return_value (gdbarch, rs6000_store_return_value);
- set_gdbarch_extract_struct_value_address (gdbarch, rs6000_extract_struct_value_address);
+ set_gdbarch_deprecated_extract_struct_value_address (gdbarch, rs6000_extract_struct_value_address);
set_gdbarch_pop_frame (gdbarch, rs6000_pop_frame);
set_gdbarch_skip_prologue (gdbarch, rs6000_skip_prologue);
@@ -2734,57 +2652,23 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* Not sure on this. FIXMEmgo */
set_gdbarch_frame_args_skip (gdbarch, 8);
- /* Until November 2001, gcc was not complying to the SYSV ABI for
- returning structures less than or equal to 8 bytes in size. It was
- returning everything in memory. When this was corrected, it wasn't
- fixed for native platforms. */
if (sysv_abi)
- {
- if (osabi == ELFOSABI_LINUX
- || osabi == ELFOSABI_NETBSD
- || osabi == ELFOSABI_FREEBSD)
- set_gdbarch_use_struct_convention (gdbarch,
- ppc_sysv_abi_broken_use_struct_convention);
- else
- set_gdbarch_use_struct_convention (gdbarch,
- ppc_sysv_abi_use_struct_convention);
- }
+ set_gdbarch_use_struct_convention (gdbarch,
+ ppc_sysv_abi_use_struct_convention);
else
- {
- set_gdbarch_use_struct_convention (gdbarch,
- generic_use_struct_convention);
- }
+ set_gdbarch_use_struct_convention (gdbarch,
+ generic_use_struct_convention);
set_gdbarch_frame_chain_valid (gdbarch, file_frame_chain_valid);
- /* Note: kevinb/2002-04-12: See note above regarding *_push_arguments().
- The same remarks hold for the methods below. */
- if (osabi == ELFOSABI_LINUX && wordsize == 4)
- {
- set_gdbarch_frameless_function_invocation (gdbarch,
- ppc_linux_frameless_function_invocation);
- set_gdbarch_frame_chain (gdbarch, ppc_linux_frame_chain);
- set_gdbarch_frame_saved_pc (gdbarch, ppc_linux_frame_saved_pc);
-
- set_gdbarch_frame_init_saved_regs (gdbarch,
- ppc_linux_frame_init_saved_regs);
- set_gdbarch_init_extra_frame_info (gdbarch,
- ppc_linux_init_extra_frame_info);
-
- set_gdbarch_memory_remove_breakpoint (gdbarch,
- ppc_linux_memory_remove_breakpoint);
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, ppc_linux_svr4_fetch_link_map_offsets);
- }
- else
- {
- set_gdbarch_frameless_function_invocation (gdbarch,
- rs6000_frameless_function_invocation);
- set_gdbarch_frame_chain (gdbarch, rs6000_frame_chain);
- set_gdbarch_frame_saved_pc (gdbarch, rs6000_frame_saved_pc);
- set_gdbarch_frame_init_saved_regs (gdbarch, rs6000_frame_init_saved_regs);
- set_gdbarch_init_extra_frame_info (gdbarch, rs6000_init_extra_frame_info);
- }
+ set_gdbarch_frameless_function_invocation (gdbarch,
+ rs6000_frameless_function_invocation);
+ set_gdbarch_frame_chain (gdbarch, rs6000_frame_chain);
+ set_gdbarch_frame_saved_pc (gdbarch, rs6000_frame_saved_pc);
+
+ set_gdbarch_frame_init_saved_regs (gdbarch, rs6000_frame_init_saved_regs);
+ set_gdbarch_init_extra_frame_info (gdbarch, rs6000_init_extra_frame_info);
+
if (!sysv_abi)
{
/* Handle RS/6000 function pointers (which are really function
@@ -2800,9 +2684,24 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
now that the C compiler delays popping them. */
set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown);
+ /* Hook in ABI-specific overrides, if they have been registered. */
+ gdbarch_init_osabi (info, gdbarch, osabi);
+
return gdbarch;
}
+static void
+rs6000_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file)
+{
+ struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+
+ if (tdep == NULL)
+ return;
+
+ fprintf_unfiltered (file, "rs6000_dump_tdep: OS ABI = %s\n",
+ gdbarch_osabi_name (tdep->osabi));
+}
+
static struct cmd_list_element *info_powerpc_cmdlist = NULL;
static void
@@ -2816,8 +2715,8 @@ rs6000_info_powerpc_command (char *args, int from_tty)
void
_initialize_rs6000_tdep (void)
{
- register_gdbarch_init (bfd_arch_rs6000, rs6000_gdbarch_init);
- register_gdbarch_init (bfd_arch_powerpc, rs6000_gdbarch_init);
+ gdbarch_register (bfd_arch_rs6000, rs6000_gdbarch_init, rs6000_dump_tdep);
+ gdbarch_register (bfd_arch_powerpc, rs6000_gdbarch_init, rs6000_dump_tdep);
/* Add root prefix command for "info powerpc" commands */
add_prefix_cmd ("powerpc", class_info, rs6000_info_powerpc_command,
@@ -2827,5 +2726,4 @@ _initialize_rs6000_tdep (void)
add_cmd ("altivec", class_info, rs6000_altivec_registers_info,
"Display the contents of the AltiVec registers.",
&info_powerpc_cmdlist);
-
}
diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c
index c69aca69fa3..8add4952f19 100644
--- a/gdb/s390-tdep.c
+++ b/gdb/s390-tdep.c
@@ -1773,7 +1773,7 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* We can't do this */
set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown);
set_gdbarch_store_struct_return (gdbarch, s390_store_struct_return);
- set_gdbarch_extract_return_value (gdbarch, s390_extract_return_value);
+ set_gdbarch_deprecated_extract_return_value (gdbarch, s390_extract_return_value);
set_gdbarch_store_return_value (gdbarch, s390_store_return_value);
/* Amount PC must be decremented by after a breakpoint.
This is often the number of bytes in BREAKPOINT
@@ -1818,7 +1818,7 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_stab_reg_to_regnum (gdbarch, s390_stab_reg_to_regnum);
set_gdbarch_dwarf_reg_to_regnum (gdbarch, s390_stab_reg_to_regnum);
set_gdbarch_dwarf2_reg_to_regnum (gdbarch, s390_stab_reg_to_regnum);
- set_gdbarch_extract_struct_value_address
+ set_gdbarch_deprecated_extract_struct_value_address
(gdbarch, generic_cannot_extract_struct_value_address);
/* Parameters for inferior function calls. */
diff --git a/gdb/ser-e7kpc.c b/gdb/ser-e7kpc.c
index 49b2c89c324..063cca13d63 100644
--- a/gdb/ser-e7kpc.c
+++ b/gdb/ser-e7kpc.c
@@ -423,16 +423,12 @@ static struct serial_ops e7000pc_ops =
e7000pc_noop, /* wait for output to drain */
};
-void
-_initialize_ser_e7000pc (void)
-{
- serial_add_interface (&e7000pc_ops);
-}
-#else
+#endif /*_WIN32 or __GO32__*/
void
_initialize_ser_e7000pc (void)
{
-
+#if defined __GO32__ || defined _WIN32
+ serial_add_interface (&e7000pc_ops);
+#endif
}
-#endif
diff --git a/gdb/ser-tcp.c b/gdb/ser-tcp.c
index cef62699ae0..c6ae19dab02 100644
--- a/gdb/ser-tcp.c
+++ b/gdb/ser-tcp.c
@@ -38,7 +38,6 @@
#include <netdb.h>
#include <sys/socket.h>
#include <netinet/tcp.h>
-#include <netinet/udp.h>
#include <signal.h>
#include "gdb_string.h"
diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c
index b7686929977..375b55a6b66 100644
--- a/gdb/sh-tdep.c
+++ b/gdb/sh-tdep.c
@@ -41,6 +41,8 @@
#include "regcache.h"
#include "doublest.h"
+#include "sh-tdep.h"
+
#include "elf-bfd.h"
#include "solib-svr4.h"
@@ -906,29 +908,8 @@ sh_store_struct_return (CORE_ADDR addr, CORE_ADDR sp)
static int
gdb_print_insn_sh (bfd_vma memaddr, disassemble_info *info)
{
- if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
- return print_insn_sh (memaddr, info);
- else
- return print_insn_shl (memaddr, info);
-}
-
-/* Disassemble an instruction. */
-static int
-gdb_print_insn_sh64 (bfd_vma memaddr, disassemble_info *info)
-{
- if (pc_is_isa32 (memaddr))
- {
- /* Round down the instruction address to the appropriate boundary
- before disassembling it. */
- return print_insn_sh64x_media (UNMAKE_ISA32_ADDR (memaddr), info);
- }
- else
- {
- if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
- return print_insn_sh (memaddr, info);
- else
- return print_insn_shl (memaddr, info);
- }
+ info->endian = TARGET_BYTE_ORDER;
+ return print_insn_sh (memaddr, info);
}
/* Given a GDB frame, determine the address of the calling function's frame.
@@ -4198,175 +4179,6 @@ sh_linux_svr4_fetch_link_map_offsets (void)
#endif /* SVR4_SHARED_LIBS */
-/* This table matches the indices assigned to enum sh_osabi. Keep
- them in sync. */
-static const char * const sh_osabi_names[] =
-{
- "<unknown>",
- "GNU/Linux",
- "NetBSD ELF",
- NULL
-};
-
-static void
-process_note_abi_tag_sections (bfd *abfd, asection *sect, void *obj)
-{
- enum sh_osabi *os_ident_ptr = obj;
- const char *name;
- unsigned int sectsize;
-
- name = bfd_get_section_name (abfd, sect);
- sectsize = bfd_section_size (abfd, sect);
-
- if (strcmp (name, ".note.ABI-tag") == 0 && sectsize > 0)
- {
- unsigned int name_length, data_length, note_type;
- char *note;
-
- /* If the section is larger than this, it's probably not what we are
- looking for. */
- if (sectsize > 128)
- sectsize = 128;
-
- note = alloca (sectsize);
-
- bfd_get_section_contents (abfd, sect, note,
- (file_ptr) 0, (bfd_size_type) sectsize);
-
- name_length = bfd_h_get_32 (abfd, note);
- data_length = bfd_h_get_32 (abfd, note + 4);
- note_type = bfd_h_get_32 (abfd, note + 8);
-
- if (name_length == 4 && data_length == 16 && note_type == NT_GNU_ABI_TAG
- && strcmp (note + 12, "GNU") == 0)
- {
- int os_number = bfd_h_get_32 (abfd, note + 16);
-
- /* The case numbers are from abi-tags in glibc. */
- switch (os_number)
- {
- case GNU_ABI_TAG_LINUX:
- *os_ident_ptr = SH_OSABI_LINUX;
- break;
-
- case GNU_ABI_TAG_HURD:
- internal_error
- (__FILE__, __LINE__,
- "process_note_abi_sections: Hurd objects not supported");
- break;
-
- case GNU_ABI_TAG_SOLARIS:
- internal_error
- (__FILE__, __LINE__,
- "process_note_abi_sections: Solaris objects not supported");
- break;
-
- default:
- internal_error
- (__FILE__, __LINE__,
- "process_note_abi_sections: unknown OS number %d",
- os_number);
- }
- }
- }
- /* NetBSD uses a similar trick. */
- else if (strcmp (name, ".note.netbsd.ident") == 0 && sectsize > 0)
- {
- unsigned int name_length, desc_length, note_type;
- char *note;
-
- /* If the section is larger than this, it's probably not what we are
- looking for. */
- if (sectsize > 128)
- sectsize = 128;
-
- note = alloca (sectsize);
-
- bfd_get_section_contents (abfd, sect, note,
- (file_ptr) 0, (bfd_size_type) sectsize);
-
- name_length = bfd_h_get_32 (abfd, note);
- desc_length = bfd_h_get_32 (abfd, note + 4);
- note_type = bfd_h_get_32 (abfd, note + 8);
-
- if (name_length == 7 && desc_length == 4 && note_type == NT_NETBSD_IDENT
- && strcmp (note + 12, "NetBSD") == 0)
- /* XXX Should we check the version here?
- Probably not necessary yet. */
- *os_ident_ptr = SH_OSABI_NETBSD_ELF;
- }
-}
-
-static int
-get_elfosabi (bfd *abfd)
-{
- int elfosabi;
- enum sh_osabi sh_osabi = SH_OSABI_UNKNOWN;
-
- elfosabi = elf_elfheader (abfd)->e_ident[EI_OSABI];
-
- switch (elfosabi)
- {
- case ELFOSABI_NONE:
- /* When elfosabi is 0 (ELFOSABI_NONE), this is supposed to indicate
- that we're on a SYSV system. However, some systems use note sections
- to record OS/ABI info, but leave e_ident[EI_OSABI] zero. So we
- have to check the note sections too. */
- bfd_map_over_sections (abfd,
- process_note_abi_tag_sections,
- &sh_osabi);
- break;
-
- case ELFOSABI_NETBSD:
- sh_osabi = SH_OSABI_NETBSD_ELF;
- break;
-
- case ELFOSABI_LINUX:
- sh_osabi = SH_OSABI_LINUX;
- break;
- }
-
- return (sh_osabi);
-}
-
-struct sh_osabi_handler
-{
- struct sh_osabi_handler *next;
- enum sh_osabi abi;
- void (*init_osabi)(struct gdbarch_info, struct gdbarch *);
-};
-
-struct sh_osabi_handler *sh_osabi_handler_list = NULL;
-
-void
-sh_gdbarch_register_os_abi (enum sh_osabi abi,
- void (*init_osabi)(struct gdbarch_info,
- struct gdbarch *))
-{
- struct sh_osabi_handler **handler_p;
-
- for (handler_p = &sh_osabi_handler_list; *handler_p != NULL;
- handler_p = &(*handler_p)->next)
- {
- if ((*handler_p)->abi == abi)
- {
- internal_error
- (__FILE__, __LINE__,
- "sh_gdbarch_register_os_abi: A handler for this ABI variant "
- "(%d) has already been registered", (int) abi);
- /* If user wants to continue, override previous definition. */
- (*handler_p)->init_osabi = init_osabi;
- return;
- }
- }
-
- (*handler_p)
- = (struct sh_osabi_handler *) xmalloc (sizeof (struct sh_osabi_handler));
- (*handler_p)->next = NULL;
- (*handler_p)->abi = abi;
- (*handler_p)->init_osabi = init_osabi;
-}
-
static gdbarch_init_ftype sh_gdbarch_init;
static struct gdbarch *
@@ -4378,23 +4190,14 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
gdbarch_register_name_ftype *sh_register_name;
gdbarch_store_return_value_ftype *sh_store_return_value;
gdbarch_register_virtual_type_ftype *sh_register_virtual_type;
- enum sh_osabi sh_osabi = SH_OSABI_UNKNOWN;
- struct sh_osabi_handler *osabi_handler;
+ enum gdb_osabi osabi = GDB_OSABI_UNKNOWN;
/* Try to determine the ABI of the object we are loading. */
if (info.abfd != NULL)
{
- switch (bfd_get_flavour (info.abfd))
- {
- case bfd_target_elf_flavour:
- sh_osabi = get_elfosabi (info.abfd);
- break;
-
- default:
- /* Just leave it as "unkown". */
- break;
- }
+ osabi = gdbarch_lookup_osabi (info.abfd);
+ /* If we get "unknown" back, just leave it that way. */
}
/* Find a candidate among the list of pre-declared architectures. */
@@ -4404,7 +4207,7 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
{
/* Make sure the ABI selection matches. */
tdep = gdbarch_tdep (arches->gdbarch);
- if (tdep && tdep->sh_osabi == sh_osabi)
+ if (tdep && tdep->osabi == osabi)
return arches->gdbarch;
}
@@ -4413,15 +4216,7 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
tdep = XMALLOC (struct gdbarch_tdep);
gdbarch = gdbarch_alloc (&info, tdep);
- tdep->sh_osabi = sh_osabi;
- if (sh_osabi < SH_OSABI_INVALID)
- tdep->osabi_name = sh_osabi_names[sh_osabi];
- else
- {
- internal_error (__FILE__, __LINE__, "Invalid setting of sh_osabi %d",
- (int) sh_osabi);
- tdep->osabi_name = "<invalid>";
- }
+ tdep->osabi = osabi;
/* Initialize the register numbers that are not common to all the
variants to -1, if necessary thse will be overwritten in the case
@@ -4475,11 +4270,11 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_frame_chain (gdbarch, sh_frame_chain);
set_gdbarch_get_saved_register (gdbarch, generic_get_saved_register);
set_gdbarch_init_extra_frame_info (gdbarch, sh_init_extra_frame_info);
- set_gdbarch_extract_return_value (gdbarch, sh_extract_return_value);
+ set_gdbarch_deprecated_extract_return_value (gdbarch, sh_extract_return_value);
set_gdbarch_push_arguments (gdbarch, sh_push_arguments);
set_gdbarch_store_struct_return (gdbarch, sh_store_struct_return);
set_gdbarch_use_struct_convention (gdbarch, sh_use_struct_convention);
- set_gdbarch_extract_struct_value_address (gdbarch, sh_extract_struct_value_address);
+ set_gdbarch_deprecated_extract_struct_value_address (gdbarch, sh_extract_struct_value_address);
set_gdbarch_pop_frame (gdbarch, sh_pop_frame);
set_gdbarch_print_insn (gdbarch, gdb_print_insn_sh);
skip_prologue_hard_way = sh_skip_prologue_hard_way;
@@ -4552,7 +4347,7 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_register_raw_size (gdbarch, sh_default_register_raw_size);
set_gdbarch_register_virtual_size (gdbarch, sh_default_register_raw_size);
set_gdbarch_register_byte (gdbarch, sh_default_register_byte);
- set_gdbarch_extract_return_value (gdbarch, sh3e_sh4_extract_return_value);
+ set_gdbarch_deprecated_extract_return_value (gdbarch, sh3e_sh4_extract_return_value);
set_gdbarch_fp0_regnum (gdbarch, 25);
tdep->FPUL_REGNUM = 23;
tdep->FPSCR_REGNUM = 24;
@@ -4592,7 +4387,7 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
sh_store_return_value = sh3e_sh4_store_return_value;
sh_register_virtual_type = sh_sh4_register_virtual_type;
set_gdbarch_frame_init_saved_regs (gdbarch, sh_fp_frame_init_saved_regs);
- set_gdbarch_extract_return_value (gdbarch, sh3e_sh4_extract_return_value);
+ set_gdbarch_deprecated_extract_return_value (gdbarch, sh3e_sh4_extract_return_value);
set_gdbarch_fp0_regnum (gdbarch, 25);
set_gdbarch_register_raw_size (gdbarch, sh_sh4_register_raw_size);
set_gdbarch_register_virtual_size (gdbarch, sh_sh4_register_raw_size);
@@ -4682,7 +4477,6 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
sh_store_return_value = sh64_store_return_value;
skip_prologue_hard_way = sh64_skip_prologue_hard_way;
do_pseudo_register = sh64_do_pseudo_register;
- set_gdbarch_print_insn (gdbarch, gdb_print_insn_sh64);
set_gdbarch_register_raw_size (gdbarch, sh_sh64_register_raw_size);
set_gdbarch_register_virtual_size (gdbarch, sh_sh64_register_raw_size);
set_gdbarch_register_byte (gdbarch, sh_sh64_register_byte);
@@ -4702,10 +4496,10 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_init_extra_frame_info (gdbarch, sh64_init_extra_frame_info);
set_gdbarch_frame_chain (gdbarch, sh64_frame_chain);
set_gdbarch_get_saved_register (gdbarch, sh64_get_saved_register);
- set_gdbarch_extract_return_value (gdbarch, sh64_extract_return_value);
+ set_gdbarch_deprecated_extract_return_value (gdbarch, sh64_extract_return_value);
set_gdbarch_push_arguments (gdbarch, sh64_push_arguments);
/*set_gdbarch_store_struct_return (gdbarch, sh64_store_struct_return);*/
- set_gdbarch_extract_struct_value_address (gdbarch, sh64_extract_struct_value_address);
+ set_gdbarch_deprecated_extract_struct_value_address (gdbarch, sh64_extract_struct_value_address);
set_gdbarch_use_struct_convention (gdbarch, sh64_use_struct_convention);
set_gdbarch_pop_frame (gdbarch, sh64_pop_frame);
set_gdbarch_elf_make_msymbol_special (gdbarch,
@@ -4774,32 +4568,11 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown);
set_gdbarch_believe_pcc_promotion (gdbarch, 1);
- /* Hook in ABI-specific overrides, if they have been registered. If
- the ABI is unknown, this is probably an embedded target, so we
- should not warn about this situation. */
- if (sh_osabi != SH_OSABI_UNKNOWN)
- {
- for (osabi_handler = sh_osabi_handler_list; osabi_handler != NULL;
- osabi_handler = osabi_handler->next)
- if (osabi_handler->abi == sh_osabi)
- break;
+ /* Hook in ABI-specific overrides, if they have been registered.
- if (osabi_handler)
- osabi_handler->init_osabi (info, gdbarch);
- else
- {
- /* We assume that if GDB_MULTI_ARCH is less than
- GDB_MULTI_ARCH_TM that an ABI variant can be supported by
- overriding definitions in this file. */
- if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
- fprintf_filtered
- (gdb_stderr,
- "A handler for the ABI variant \"%s\" is not built into this "
- "configuration of GDB. "
- "Attempting to continue with the default SuperH settings",
- sh_osabi_names[sh_osabi]);
- }
- }
+ FIXME: if the ABI is unknown, this is probably an embedded target,
+ so we should not warn about this situation. */
+ gdbarch_init_osabi (info, gdbarch, osabi);
return gdbarch;
}
@@ -4812,12 +4585,8 @@ sh_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file)
if (tdep == NULL)
return;
- if (tdep->osabi_name != NULL)
- fprintf_unfiltered (file, "sh_dump_tdep: OS ABI = %s\n", tdep->osabi_name);
- else
- internal_error (__FILE__, __LINE__,
- "sh_dump_tdep: illegal setting of tdep->sh_osabi (%d)",
- (int) tdep->sh_osabi);
+ fprintf_unfiltered (file, "sh_dump_tdep: OS ABI = %s\n",
+ gdbarch_osabi_name (tdep->osabi));
}
void
diff --git a/gdb/sh-tdep.h b/gdb/sh-tdep.h
new file mode 100644
index 00000000000..cd7f35a8324
--- /dev/null
+++ b/gdb/sh-tdep.h
@@ -0,0 +1,111 @@
+/* Target-specific definition for a Hitachi Super-H.
+ Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 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 SH_TDEP_H
+#define SH_TDEP_H
+
+#include "osabi.h"
+
+/* Contributed by Steve Chamberlain sac@cygnus.com */
+
+/* Information that is dependent on the processor variant. */
+
+enum sh_abi
+ {
+ SH_ABI_UNKNOWN,
+ SH_ABI_32,
+ SH_ABI_64
+ };
+
+struct gdbarch_tdep
+ {
+ int PR_REGNUM;
+ int FPUL_REGNUM; /* sh3e, sh4 */
+ int FPSCR_REGNUM; /* sh3e, sh4 */
+ int SR_REGNUM; /* sh-dsp, sh3, sh3-dsp, sh3e, sh4 */
+ int DSR_REGNUM; /* sh-dsp, sh3-dsp */
+ int FP_LAST_REGNUM; /* sh3e, sh4 */
+ int A0G_REGNUM; /* sh-dsp, sh3-dsp */
+ int A0_REGNUM; /* sh-dsp, sh3-dsp */
+ int A1G_REGNUM; /* sh-dsp, sh3-dsp */
+ int A1_REGNUM; /* sh-dsp, sh3-dsp */
+ int M0_REGNUM; /* sh-dsp, sh3-dsp */
+ int M1_REGNUM; /* sh-dsp, sh3-dsp */
+ int X0_REGNUM; /* sh-dsp, sh3-dsp */
+ int X1_REGNUM; /* sh-dsp, sh3-dsp */
+ int Y0_REGNUM; /* sh-dsp, sh3-dsp */
+ int Y1_REGNUM; /* sh-dsp, sh3-dsp */
+ int MOD_REGNUM; /* sh-dsp, sh3-dsp */
+ int SSR_REGNUM; /* sh3, sh3-dsp, sh3e, sh4 */
+ int SPC_REGNUM; /* sh3, sh3-dsp, sh3e, sh4 */
+ int RS_REGNUM; /* sh-dsp, sh3-dsp */
+ int RE_REGNUM; /* sh-dsp, sh3-dsp */
+ int DR0_REGNUM; /* sh4 */
+ int DR_LAST_REGNUM; /* sh4 */
+ int FV0_REGNUM; /* sh4 */
+ int FV_LAST_REGNUM; /* sh4 */
+ /* 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. */
+ int TR7_REGNUM; /* sh5-media*/
+ int FPP0_REGNUM; /* sh5-media*/
+ int FPP_LAST_REGNUM; /* sh5-media*/
+ int R0_C_REGNUM; /* sh5-compact*/
+ int R_LAST_C_REGNUM; /* sh5-compact*/
+ int PC_C_REGNUM; /* sh5-compact*/
+ int GBR_C_REGNUM; /* sh5-compact*/
+ int MACH_C_REGNUM; /* sh5-compact*/
+ int MACL_C_REGNUM; /* sh5-compact*/
+ int PR_C_REGNUM; /* sh5-compact*/
+ int T_C_REGNUM; /* sh5-compact*/
+ int FPSCR_C_REGNUM; /* sh5-compact*/
+ int FPUL_C_REGNUM; /* sh5-compact*/
+ int FP0_C_REGNUM; /* sh5-compact*/
+ int FP_LAST_C_REGNUM; /* sh5-compact*/
+ int DR0_C_REGNUM; /* sh5-compact*/
+ int DR_LAST_C_REGNUM; /* sh5-compact*/
+ int FV0_C_REGNUM; /* sh5-compact*/
+ int FV_LAST_C_REGNUM; /* sh5-compact*/
+ int ARG0_REGNUM;
+ int ARGLAST_REGNUM;
+ int FLOAT_ARGLAST_REGNUM;
+ int RETURN_REGNUM;
+ enum gdb_osabi osabi; /* OS/ABI of the inferior */
+ enum sh_abi sh_abi;
+ };
+
+/* Registers common to all the SH variants. */
+enum
+ {
+ R0_REGNUM = 0,
+ STRUCT_RETURN_REGNUM = 2,
+ ARG0_REGNUM = 4, /* Used in h8300-tdep.c */
+ ARGLAST_REGNUM = 7, /* Used in h8300-tdep.c */
+ PR_REGNUM = 17, /* used in sh3-rom.c */
+ GBR_REGNUM = 18,
+ VBR_REGNUM = 19,
+ MACH_REGNUM = 20,
+ MACL_REGNUM = 21,
+ SR_REGNUM = 22
+ };
+
+#endif /* SH_TDEP_H */
diff --git a/gdb/sh3-rom.c b/gdb/sh3-rom.c
index 2b07bd83c81..f450ac9d5fc 100644
--- a/gdb/sh3-rom.c
+++ b/gdb/sh3-rom.c
@@ -28,6 +28,8 @@
#include "arch-utils.h"
#include "regcache.h"
+#include "sh-tdep.h"
+
static struct serial *parallel;
static int parallel_in_use;
diff --git a/gdb/shnbsd-tdep.c b/gdb/shnbsd-tdep.c
index 5f9903d8d7a..02982267ba2 100644
--- a/gdb/shnbsd-tdep.c
+++ b/gdb/shnbsd-tdep.c
@@ -24,7 +24,10 @@
#include "regcache.h"
#include "value.h"
+#include "solib-svr4.h"
+
#include "nbsd-tdep.h"
+#include "sh-tdep.h"
#include "shnbsd-tdep.h"
/* Convert an r0-r15 register number into an offset into a ptrace
@@ -176,5 +179,5 @@ _initialize_shnbsd_tdep (void)
add_core_fns (&shnbsd_core_fns);
add_core_fns (&shnbsd_elfcore_fns);
- sh_gdbarch_register_os_abi (SH_OSABI_NETBSD_ELF, shnbsd_init_abi);
+ gdbarch_register_osabi (bfd_arch_sh, GDB_OSABI_NETBSD_ELF, shnbsd_init_abi);
}
diff --git a/gdb/signals/signals.c b/gdb/signals/signals.c
index 643e450fbbe..0057e60e377 100644
--- a/gdb/signals/signals.c
+++ b/gdb/signals/signals.c
@@ -498,8 +498,11 @@ target_signal_from_host (int hostsig)
if (33 <= hostsig && hostsig <= 63)
return (enum target_signal)
(hostsig - 33 + (int) TARGET_SIGNAL_REALTIME_33);
- else if (hostsig == 64)
- return TARGET_SIGNAL_REALTIME_64;
+ else if (hostsig == 32)
+ return TARGET_SIGNAL_REALTIME_32;
+ else if (64 <= hostsig && hostsig <= 127)
+ return (enum target_signal)
+ (hostsig - 64 + (int) TARGET_SIGNAL_REALTIME_64);
else
error ("GDB bug: target.c (target_signal_from_host): unrecognized real-time signal");
}
@@ -784,8 +787,21 @@ do_target_signal_to_host (enum target_signal oursig,
if (retsig >= SIGRTMIN && retsig <= SIGRTMAX)
return retsig;
}
- else if (oursig == TARGET_SIGNAL_REALTIME_64)
- return 64;
+ else if (oursig == TARGET_SIGNAL_REALTIME_32)
+ {
+ /* TARGET_SIGNAL_REALTIME_32 isn't contiguous with
+ TARGET_SIGNAL_REALTIME_33. It is 32 by definition. */
+ return 32;
+ }
+ else if (oursig >= TARGET_SIGNAL_REALTIME_64
+ && oursig <= TARGET_SIGNAL_REALTIME_127)
+ {
+ /* This block of signals is continuous, and
+ TARGET_SIGNAL_REALTIME_64 is 64 by definition. */
+ int retsig =
+ (int) oursig - (int) TARGET_SIGNAL_REALTIME_64 + 64;
+ return retsig;
+ }
#endif
*oursig_ok = 0;
return 0;
diff --git a/gdb/sim-regno.h b/gdb/sim-regno.h
new file mode 100644
index 00000000000..5a7057b6b04
--- /dev/null
+++ b/gdb/sim-regno.h
@@ -0,0 +1,45 @@
+/* Generic remote debugging interface for simulators.
+
+ Copyright 2002 Free Software Foundation, Inc.
+
+ Contributed by Red Hat, 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 SIM_REGNO_H
+#define SIM_REGNO_H
+
+/* The REGISTER_SIM_REGNO(REGNUM) method, when there is a
+ corresponding simulator register, returns that register number as a
+ cardinal. When there is no corresponding register, it returns a
+ negative value. */
+
+enum sim_regno {
+ /* Normal sane architecture. The simulator is known to not model
+ this register. */
+ SIM_REGNO_DOES_NOT_EXIST = -1,
+ /* For possible backward compatibility. The register cache doesn't
+ have a corresponding name. Skip the register entirely. */
+ LEGACY_SIM_REGNO_IGNORE = -2
+};
+
+/* Treat all raw registers as valid. */
+
+extern int one2one_register_sim_regno (int regnum);
+
+#endif
diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
index 2d71097c091..3f98a1eb433 100644
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -1318,24 +1318,20 @@ set_solib_svr4_fetch_link_map_offsets (struct gdbarch *gdbarch,
set_gdbarch_data (gdbarch, fetch_link_map_offsets_gdbarch_data, flmo);
}
-/* Initialize the architecture specific link_map_offsets fetcher.
- This is called after <arch>_gdbarch_init() has set up its struct
- gdbarch for the new architecture, so care must be taken to use the
- value set by set_solib_svr4_fetch_link_map_offsets(), above. We
- do, however, attempt to provide a reasonable alternative (for
- native targets anyway) if the <arch>_gdbarch_init() fails to call
+/* Initialize the architecture-specific link_map_offsets fetcher.
+ This is called after <arch>_gdbarch_init() has set up its `struct
+ gdbarch' for the new architecture, and is only called if the
+ link_map_offsets fetcher isn't already initialized (which is
+ usually done by calling set_solib_svr4_fetch_link_map_offsets()
+ above in <arch>_gdbarch_init()). Therefore we attempt to provide a
+ reasonable alternative (for native targets anyway) if the
+ <arch>_gdbarch_init() fails to call
set_solib_svr4_fetch_link_map_offsets(). */
static void *
init_fetch_link_map_offsets (struct gdbarch *gdbarch)
{
- struct link_map_offsets *(*flmo) =
- gdbarch_data (gdbarch, fetch_link_map_offsets_gdbarch_data);
-
- if (flmo == NULL)
- return legacy_fetch_link_map_offsets;
- else
- return flmo;
+ return legacy_fetch_link_map_offsets;
}
static struct target_so_ops svr4_so_ops;
diff --git a/gdb/somsolib.c b/gdb/somsolib.c
index d623e4b76db..2eb1ff5685c 100644
--- a/gdb/somsolib.c
+++ b/gdb/somsolib.c
@@ -1,6 +1,7 @@
/* Handle HP SOM shared libraries for GDB, the GNU Debugger.
- Copyright 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001
- Free Software Foundation, Inc.
+
+ Copyright 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 Free
+ Software Foundation, Inc.
This file is part of GDB.
@@ -38,7 +39,6 @@
#include "gdb-stabs.h"
#include "gdb_stat.h"
#include "gdbcmd.h"
-#include "assert.h"
#include "language.h"
#include "regcache.h"
@@ -319,7 +319,7 @@ som_solib_add_solib_objfile (struct so_list *so, char *name, int from_tty,
sizeof (obj_private_data_t));
obj_private->unwind_info = NULL;
obj_private->so_info = NULL;
- so->objfile->obj_private = (PTR) obj_private;
+ so->objfile->obj_private = obj_private;
}
obj_private = (obj_private_data_t *) so->objfile->obj_private;
diff --git a/gdb/source.c b/gdb/source.c
index ac743724058..c7c1ce2f5d2 100644
--- a/gdb/source.c
+++ b/gdb/source.c
@@ -500,6 +500,8 @@ source_info (char *ignore, int from_tty)
printf_filtered ("Source language is %s.\n", language_str (s->language));
printf_filtered ("Compiled with %s debugging format.\n", s->debugformat);
+ printf_filtered ("%s preprocessor macro info.\n",
+ s->macro_table ? "Includes" : "Does not include");
}
diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c
index 6461ca088f6..6ad95c48dc8 100644
--- a/gdb/sparc-tdep.c
+++ b/gdb/sparc-tdep.c
@@ -33,6 +33,7 @@
#include "bfd.h"
#include "gdb_string.h"
#include "regcache.h"
+#include "osabi.h"
#ifdef USE_PROC_FS
#include <sys/procfs.h>
@@ -111,6 +112,8 @@ struct gdbarch_tdep
int reg_save_offset;
int call_dummy_call_offset;
int print_insn_mach;
+
+ enum gdb_osabi osabi;
};
/* Now make GDB_TARGET_IS_SPARC64 a runtime test. */
@@ -2272,12 +2275,13 @@ sparc_target_architecture_hook (const bfd_arch_info_type *ap)
static struct gdbarch * sparc_gdbarch_init (struct gdbarch_info info,
struct gdbarch_list *arches);
+static void sparc_dump_tdep (struct gdbarch *, struct ui_file *);
void
_initialize_sparc_tdep (void)
{
/* Hook us into the gdbarch mechanism. */
- register_gdbarch_init (bfd_arch_sparc, sparc_gdbarch_init);
+ gdbarch_register (bfd_arch_sparc, sparc_gdbarch_init, sparc_dump_tdep);
tm_print_insn = gdb_print_insn_sparc;
tm_print_insn_info.mach = TM_PRINT_INSN_MACH; /* Selects sparc/sparclite */
@@ -2930,6 +2934,7 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
{
struct gdbarch *gdbarch;
struct gdbarch_tdep *tdep;
+ enum gdb_osabi osabi = GDB_OSABI_UNKNOWN;
static LONGEST call_dummy_32[] =
{ 0xbc100001, 0x9de38000, 0xbc100002, 0xbe100003,
@@ -2953,10 +2958,29 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
};
static LONGEST call_dummy_nil[] = {0};
+ /* Try to determine the OS ABI of the object we are loading. */
+
+ if (info.abfd != NULL)
+ {
+ osabi = gdbarch_lookup_osabi (info.abfd);
+ if (osabi == GDB_OSABI_UNKNOWN)
+ {
+ /* If it's an ELF file, assume it's Solaris. */
+ if (bfd_get_flavour (info.abfd) == bfd_target_elf_flavour)
+ osabi = GDB_OSABI_SOLARIS;
+ }
+ }
+
/* First see if there is already a gdbarch that can satisfy the request. */
- arches = gdbarch_list_lookup_by_info (arches, &info);
- if (arches != NULL)
- return arches->gdbarch;
+ for (arches = gdbarch_list_lookup_by_info (arches, &info);
+ arches != NULL;
+ arches = gdbarch_list_lookup_by_info (arches->next, &info))
+ {
+ /* Make sure the ABI selection matches. */
+ tdep = gdbarch_tdep (arches->gdbarch);
+ if (tdep && tdep->osabi == osabi)
+ return arches->gdbarch;
+ }
/* None found: is the request for a sparc architecture? */
if (info.bfd_arch_info->arch != bfd_arch_sparc)
@@ -2966,6 +2990,8 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
tdep = (struct gdbarch_tdep *) xmalloc (sizeof (struct gdbarch_tdep));
gdbarch = gdbarch_alloc (&info, tdep);
+ tdep->osabi = osabi;
+
/* First set settings that are common for all sparc architectures. */
set_gdbarch_believe_pcc_promotion (gdbarch, 1);
set_gdbarch_breakpoint_from_pc (gdbarch, memory_breakpoint_from_pc);
@@ -2976,8 +3002,7 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 1);
set_gdbarch_decr_pc_after_break (gdbarch, 0);
set_gdbarch_double_bit (gdbarch, 8 * TARGET_CHAR_BIT);
- set_gdbarch_extract_struct_value_address (gdbarch,
- sparc_extract_struct_value_address);
+ set_gdbarch_deprecated_extract_struct_value_address (gdbarch, sparc_extract_struct_value_address);
set_gdbarch_fix_call_dummy (gdbarch, sparc_gdbarch_fix_call_dummy);
set_gdbarch_float_bit (gdbarch, 4 * TARGET_CHAR_BIT);
set_gdbarch_fp_regnum (gdbarch, SPARC_FP_REGNUM);
@@ -3191,7 +3216,7 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
switch (info.bfd_arch_info->mach)
{
case bfd_mach_sparc:
- set_gdbarch_extract_return_value (gdbarch, sparc32_extract_return_value);
+ set_gdbarch_deprecated_extract_return_value (gdbarch, sparc32_extract_return_value);
set_gdbarch_frame_chain_valid (gdbarch, file_frame_chain_valid);
set_gdbarch_num_regs (gdbarch, 72);
set_gdbarch_register_bytes (gdbarch, 32*4 + 32*4 + 8*4);
@@ -3202,8 +3227,7 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
tdep->print_insn_mach = bfd_mach_sparc;
break;
case bfd_mach_sparc_sparclet:
- set_gdbarch_extract_return_value (gdbarch,
- sparclet_extract_return_value);
+ set_gdbarch_deprecated_extract_return_value (gdbarch, sparclet_extract_return_value);
set_gdbarch_frame_chain_valid (gdbarch, file_frame_chain_valid);
set_gdbarch_num_regs (gdbarch, 32 + 32 + 8 + 8 + 8);
set_gdbarch_register_bytes (gdbarch, 32*4 + 32*4 + 8*4 + 8*4 + 8*4);
@@ -3214,7 +3238,7 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
tdep->print_insn_mach = bfd_mach_sparc_sparclet;
break;
case bfd_mach_sparc_sparclite:
- set_gdbarch_extract_return_value (gdbarch, sparc32_extract_return_value);
+ set_gdbarch_deprecated_extract_return_value (gdbarch, sparc32_extract_return_value);
set_gdbarch_frame_chain_valid (gdbarch, func_frame_chain_valid);
set_gdbarch_num_regs (gdbarch, 80);
set_gdbarch_register_bytes (gdbarch, 32*4 + 32*4 + 8*4 + 8*4);
@@ -3225,7 +3249,7 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
tdep->print_insn_mach = bfd_mach_sparc_sparclite;
break;
case bfd_mach_sparc_v8plus:
- set_gdbarch_extract_return_value (gdbarch, sparc32_extract_return_value);
+ set_gdbarch_deprecated_extract_return_value (gdbarch, sparc32_extract_return_value);
set_gdbarch_frame_chain_valid (gdbarch, file_frame_chain_valid);
set_gdbarch_num_regs (gdbarch, 72);
set_gdbarch_register_bytes (gdbarch, 32*4 + 32*4 + 8*4);
@@ -3236,7 +3260,7 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
tdep->has_fpu = 1; /* (all but sparclet and sparclite) */
break;
case bfd_mach_sparc_v8plusa:
- set_gdbarch_extract_return_value (gdbarch, sparc32_extract_return_value);
+ set_gdbarch_deprecated_extract_return_value (gdbarch, sparc32_extract_return_value);
set_gdbarch_frame_chain_valid (gdbarch, file_frame_chain_valid);
set_gdbarch_num_regs (gdbarch, 72);
set_gdbarch_register_bytes (gdbarch, 32*4 + 32*4 + 8*4);
@@ -3247,7 +3271,7 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
tdep->print_insn_mach = bfd_mach_sparc;
break;
case bfd_mach_sparc_sparclite_le:
- set_gdbarch_extract_return_value (gdbarch, sparc32_extract_return_value);
+ set_gdbarch_deprecated_extract_return_value (gdbarch, sparc32_extract_return_value);
set_gdbarch_frame_chain_valid (gdbarch, func_frame_chain_valid);
set_gdbarch_num_regs (gdbarch, 80);
set_gdbarch_register_bytes (gdbarch, 32*4 + 32*4 + 8*4 + 8*4);
@@ -3258,7 +3282,7 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
tdep->print_insn_mach = bfd_mach_sparc_sparclite;
break;
case bfd_mach_sparc_v9:
- set_gdbarch_extract_return_value (gdbarch, sparc64_extract_return_value);
+ set_gdbarch_deprecated_extract_return_value (gdbarch, sparc64_extract_return_value);
set_gdbarch_frame_chain_valid (gdbarch, file_frame_chain_valid);
set_gdbarch_num_regs (gdbarch, 125);
set_gdbarch_register_bytes (gdbarch, 32*8 + 32*8 + 45*8);
@@ -3269,7 +3293,7 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
tdep->print_insn_mach = bfd_mach_sparc_v9a;
break;
case bfd_mach_sparc_v9a:
- set_gdbarch_extract_return_value (gdbarch, sparc64_extract_return_value);
+ set_gdbarch_deprecated_extract_return_value (gdbarch, sparc64_extract_return_value);
set_gdbarch_frame_chain_valid (gdbarch, file_frame_chain_valid);
set_gdbarch_num_regs (gdbarch, 125);
set_gdbarch_register_bytes (gdbarch, 32*8 + 32*8 + 45*8);
@@ -3281,6 +3305,20 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
break;
}
+ /* Hook in OS ABI-specific overrides, if they have been registered. */
+ gdbarch_init_osabi (info, gdbarch, osabi);
+
return gdbarch;
}
+static void
+sparc_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file)
+{
+ struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+
+ if (tdep == NULL)
+ return;
+
+ fprintf_unfiltered (file, "sparc_dump_tdep: OS ABI = %s\n",
+ gdbarch_osabi_name (tdep->osabi));
+}
diff --git a/gdb/sparc64nbsd-nat.c b/gdb/sparc64nbsd-nat.c
new file mode 100644
index 00000000000..a991d0ef2a4
--- /dev/null
+++ b/gdb/sparc64nbsd-nat.c
@@ -0,0 +1,207 @@
+/* Native-dependent code for UltraSPARC systems running NetBSD.
+ Copyright 2002 Free Software Foundation, Inc.
+ Contributed by Wasabi Systems, 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 "defs.h"
+#include "inferior.h"
+#include "regcache.h"
+
+#include "sparcnbsd-tdep.h"
+
+#include <sys/types.h>
+#include <sys/ptrace.h>
+#include <machine/reg.h>
+
+/* NOTE: We don't bother with any of the deferred_store nonsense; it
+ makes things a lot more complicated than they need to be. */
+
+/* Determine if PT_GETREGS fetches this register. */
+static int
+getregs_supplies (int regno)
+{
+ /* FIXME: PS_REGNUM for 32-bit code. */
+ return (regno == TSTATE_REGNUM
+ || regno == PC_REGNUM
+ || regno == NPC_REGNUM
+ || regno == Y_REGNUM
+ || (regno >= G0_REGNUM && regno <= G7_REGNUM)
+ || (regno >= O0_REGNUM && regno <= O7_REGNUM)
+ /* stack regs (handled by sparcnbsd_supply_reg) */
+ || (regno >= L0_REGNUM && regno <= I7_REGNUM));
+}
+
+/* Determine if PT_GETFPREGS fetches this register. */
+static int
+getfpregs_supplies (int regno)
+{
+ return ((regno >= FP0_REGNUM && regno <= (FP0_REGNUM + 47))
+ || regno == FPS_REGNUM);
+}
+
+void
+fetch_inferior_registers (int regno)
+{
+ /* We don't use deferred stores. */
+ if (deferred_stores)
+ internal_error (__FILE__, __LINE__,
+ "fetch_inferior_registers: deferred stores pending");
+
+ if (regno == -1 || getregs_supplies (regno))
+ {
+ union {
+ struct reg32 regs32;
+ struct reg64 regs64;
+ } regs;
+
+ if (ptrace (PT_GETREGS, PIDGET (inferior_ptid),
+ (PTRACE_ARG3_TYPE) &regs, 0) == -1)
+ perror_with_name ("Couldn't get registers");
+
+ if (gdbarch_ptr_bit (current_gdbarch) == 32)
+ sparcnbsd_supply_reg32 ((char *) &regs.regs32, regno);
+ else
+ sparcnbsd_supply_reg64 ((char *) &regs.regs64, regno);
+ if (regno != -1)
+ return;
+ }
+
+ if (regno == -1 || getfpregs_supplies (regno))
+ {
+ union {
+ struct fpreg32 fpregs32;
+ struct fpreg64 fpregs64;
+ } fpregs;
+
+ if (ptrace (PT_GETFPREGS, PIDGET (inferior_ptid),
+ (PTRACE_ARG3_TYPE) &fpregs, 0) == -1)
+ perror_with_name ("Couldn't get floating point registers");
+
+ if (gdbarch_ptr_bit (current_gdbarch) == 32)
+ sparcnbsd_supply_fpreg32 ((char *) &fpregs.fpregs32, regno);
+ else
+ sparcnbsd_supply_fpreg64 ((char *) &fpregs.fpregs64, regno);
+ if (regno != -1)
+ return;
+ }
+}
+
+void
+store_inferior_registers (int regno)
+{
+ /* We don't use deferred stores. */
+ if (deferred_stores)
+ internal_error (__FILE__, __LINE__,
+ "store_inferior_registers: deferred stores pending");
+
+ if (regno == -1 || getregs_supplies (regno))
+ {
+ union {
+ struct reg32 regs32;
+ struct reg64 regs64;
+ } regs;
+
+ if (ptrace (PT_GETREGS, PIDGET (inferior_ptid),
+ (PTRACE_ARG3_TYPE) &regs, 0) == -1)
+ perror_with_name ("Couldn't get registers");
+
+ if (gdbarch_ptr_bit (current_gdbarch) == 32)
+ sparcnbsd_fill_reg32 ((char *) &regs.regs32, regno);
+ else
+ sparcnbsd_fill_reg64 ((char *) &regs.regs64, regno);
+
+ if (ptrace (PT_SETREGS, PIDGET (inferior_ptid),
+ (PTRACE_ARG3_TYPE) &regs, 0) == -1)
+ perror_with_name ("Couldn't write registers");
+
+ /* Deal with the stack regs. */
+ if (regno == -1 || regno == SP_REGNUM
+ || (regno >= L0_REGNUM && regno <= I7_REGNUM))
+ {
+ CORE_ADDR sp = read_register (SP_REGNUM);
+ int i;
+ char buf[8];
+
+ if (sp & 1)
+ {
+ /* Registers are 64-bit. */
+ sp += 2047;
+
+ for (i = L0_REGNUM; i <= I7_REGNUM; i++)
+ {
+ if (regno == -1 || regno == SP_REGNUM || regno == i)
+ {
+ regcache_collect (i, buf);
+ target_write_memory (sp + ((i - L0_REGNUM) * 8),
+ buf, sizeof (buf));
+ }
+ }
+ }
+ else
+ {
+ /* Registers are 32-bit. Toss any sign-extension of the stack
+ pointer.
+
+ FIXME: We don't currently handle 32-bit code in a binary
+ that indicated LP64. Do we have to care about that? */
+ if (gdbarch_ptr_bit (current_gdbarch) != 32)
+ internal_error
+ (__FILE__, __LINE__,
+ "store_inferior_registers: 32-bit code in 64-bit inferior");
+
+ sp &= 0xffffffffUL;
+ for (i = L0_REGNUM; i <= I7_REGNUM; i++)
+ {
+ if (regno == -1 || regno == SP_REGNUM || regno == i)
+ {
+ regcache_collect (i, buf);
+ target_write_memory (sp + ((i - L0_REGNUM) * 4), buf, 4);
+ }
+ }
+ }
+ }
+
+ if (regno != -1)
+ return;
+ }
+
+ if (regno == -1 || getfpregs_supplies (regno))
+ {
+ union {
+ struct fpreg32 fpregs32;
+ struct fpreg64 fpregs64;
+ } fpregs;
+
+ if (ptrace (PT_GETFPREGS, PIDGET (inferior_ptid),
+ (PTRACE_ARG3_TYPE) &fpregs, 0) == -1)
+ perror_with_name ("Couldn't get floating point registers");
+
+ if (gdbarch_ptr_bit (current_gdbarch) == 32)
+ sparcnbsd_fill_fpreg32 ((char *) &fpregs.fpregs32, regno);
+ else
+ sparcnbsd_fill_fpreg64 ((char *) &fpregs.fpregs64, regno);
+
+ if (ptrace (PT_SETFPREGS, PIDGET (inferior_ptid),
+ (PTRACE_ARG3_TYPE) &fpregs, 0) == -1)
+ perror_with_name ("Couldn't write floating point registers");
+
+ if (regno != -1)
+ return;
+ }
+}
diff --git a/gdb/sparcl-tdep.c b/gdb/sparcl-tdep.c
index 87351f11c13..aa06747e97b 100644
--- a/gdb/sparcl-tdep.c
+++ b/gdb/sparcl-tdep.c
@@ -27,7 +27,7 @@
#include "regcache.h"
#include <sys/types.h>
-#if (!defined(__GO32__) && !defined(_WIN32)) || defined(__CYGWIN32__)
+#if (!defined(__GO32__) && !defined(_WIN32)) || defined(__CYGWIN__)
#define HAVE_SOCKETS
#include <sys/time.h>
#include <sys/socket.h>
diff --git a/gdb/sparcnbsd-nat.c b/gdb/sparcnbsd-nat.c
new file mode 100644
index 00000000000..ce5d44dc6b4
--- /dev/null
+++ b/gdb/sparcnbsd-nat.c
@@ -0,0 +1,154 @@
+/* Native-dependent code for SPARC systems running NetBSD.
+ Copyright 2002 Free Software Foundation, Inc.
+ Contributed by Wasabi Systems, 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 "defs.h"
+#include "inferior.h"
+#include "regcache.h"
+
+#include "sparcnbsd-tdep.h"
+
+#include <sys/types.h>
+#include <sys/ptrace.h>
+#include <machine/reg.h>
+
+/* NOTE: We don't bother with any of the deferred_store nonsense; it
+ makes things a lot more complicated than they need to be. */
+
+/* Determine if PT_GETREGS fetches this register. */
+static int
+getregs_supplies (int regno)
+{
+ return (regno == PS_REGNUM
+ || regno == PC_REGNUM
+ || regno == NPC_REGNUM
+ || regno == Y_REGNUM
+ || (regno >= G0_REGNUM && regno <= G7_REGNUM)
+ || (regno >= O0_REGNUM && regno <= O7_REGNUM)
+ /* stack regs (handled by sparcnbsd_supply_reg) */
+ || (regno >= L0_REGNUM && regno <= I7_REGNUM));
+}
+
+/* Determine if PT_GETFPREGS fetches this register. */
+static int
+getfpregs_supplies (int regno)
+{
+ return ((regno >= FP0_REGNUM && regno <= (FP0_REGNUM + 31))
+ || regno == FPS_REGNUM);
+}
+
+void
+fetch_inferior_registers (int regno)
+{
+ /* We don't use deferred stores. */
+ if (deferred_stores)
+ internal_error (__FILE__, __LINE__,
+ "fetch_inferior_registers: deferred stores pending");
+
+ if (regno == -1 || getregs_supplies (regno))
+ {
+ struct reg regs;
+
+ if (ptrace (PT_GETREGS, PIDGET (inferior_ptid),
+ (PTRACE_ARG3_TYPE) &regs, 0) == -1)
+ perror_with_name ("Couldn't get registers");
+
+ sparcnbsd_supply_reg32 ((char *) &regs, regno);
+ if (regno != -1)
+ return;
+ }
+
+ if (regno == -1 || getfpregs_supplies (regno))
+ {
+ struct fpreg fpregs;
+
+ if (ptrace (PT_GETFPREGS, PIDGET (inferior_ptid),
+ (PTRACE_ARG3_TYPE) &fpregs, 0) == -1)
+ perror_with_name ("Couldn't get floating point registers");
+
+ sparcnbsd_supply_fpreg32 ((char *) &fpregs, regno);
+ if (regno != -1)
+ return;
+ }
+}
+
+void
+store_inferior_registers (int regno)
+{
+ /* We don't use deferred stores. */
+ if (deferred_stores)
+ internal_error (__FILE__, __LINE__,
+ "store_inferior_registers: deferred stores pending");
+
+ if (regno == -1 || getregs_supplies (regno))
+ {
+ struct reg regs;
+
+ if (ptrace (PT_GETREGS, PIDGET (inferior_ptid),
+ (PTRACE_ARG3_TYPE) &regs, 0) == -1)
+ perror_with_name ("Couldn't get registers");
+
+ sparcnbsd_fill_reg32 ((char *) &regs, regno);
+
+ if (ptrace (PT_SETREGS, PIDGET (inferior_ptid),
+ (PTRACE_ARG3_TYPE) &regs, 0) == -1)
+ perror_with_name ("Couldn't write registers");
+
+ /* Deal with the stack regs. */
+ if (regno == -1 || regno == SP_REGNUM
+ || (regno >= L0_REGNUM && regno <= I7_REGNUM))
+ {
+ CORE_ADDR sp = read_register (SP_REGNUM);
+ int i;
+ char buf[4];
+
+ for (i = L0_REGNUM; i <= I7_REGNUM; i++)
+ {
+ if (regno == -1 || regno == SP_REGNUM || regno == i)
+ {
+ regcache_collect (i, buf);
+ target_write_memory (sp + ((i - L0_REGNUM) * 4),
+ buf, sizeof (buf));
+ }
+ }
+ }
+
+ if (regno != -1)
+ return;
+ }
+
+ if (regno == -1 || getfpregs_supplies (regno))
+ {
+ struct fpreg fpregs;
+
+ if (ptrace (PT_GETFPREGS, PIDGET (inferior_ptid),
+ (PTRACE_ARG3_TYPE) &fpregs, 0) == -1)
+ perror_with_name ("Couldn't get floating point registers");
+
+ sparcnbsd_fill_fpreg32 ((char *) &fpregs, regno);
+
+ if (ptrace (PT_SETFPREGS, PIDGET (inferior_ptid),
+ (PTRACE_ARG3_TYPE) &fpregs, 0) == -1)
+ perror_with_name ("Couldn't write floating point registers");
+
+ if (regno != -1)
+ return;
+ }
+}
diff --git a/gdb/sparcnbsd-tdep.c b/gdb/sparcnbsd-tdep.c
new file mode 100644
index 00000000000..ea70e517b6d
--- /dev/null
+++ b/gdb/sparcnbsd-tdep.c
@@ -0,0 +1,531 @@
+/* Target-dependent code for SPARC systems running NetBSD.
+ Copyright 2002 Free Software Foundation, Inc.
+ Contributed by Wasabi Systems, 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 "defs.h"
+#include "gdbcore.h"
+#include "regcache.h"
+#include "target.h"
+#include "value.h"
+#include "osabi.h"
+
+#include "sparcnbsd-tdep.h"
+#include "nbsd-tdep.h"
+
+#include "solib-svr4.h"
+
+#define REG32_OFFSET_PSR (0 * 4)
+#define REG32_OFFSET_PC (1 * 4)
+#define REG32_OFFSET_NPC (2 * 4)
+#define REG32_OFFSET_Y (3 * 4)
+#define REG32_OFFSET_GLOBAL (4 * 4)
+#define REG32_OFFSET_OUT (12 * 4)
+
+#define REG64_OFFSET_TSTATE (0 * 8)
+#define REG64_OFFSET_PC (1 * 8)
+#define REG64_OFFSET_NPC (2 * 8)
+#define REG64_OFFSET_Y (3 * 8)
+#define REG64_OFFSET_GLOBAL (4 * 8)
+#define REG64_OFFSET_OUT (12 * 8)
+
+void
+sparcnbsd_supply_reg32 (char *regs, int regno)
+{
+ int i;
+
+ if (regno == PS_REGNUM || regno == -1)
+ supply_register (PS_REGNUM, regs + REG32_OFFSET_PSR);
+
+ if (regno == PC_REGNUM || regno == -1)
+ supply_register (PC_REGNUM, regs + REG32_OFFSET_PC);
+
+ if (regno == NPC_REGNUM || regno == -1)
+ supply_register (NPC_REGNUM, regs + REG32_OFFSET_NPC);
+
+ if (regno == Y_REGNUM || regno == -1)
+ supply_register (Y_REGNUM, regs + REG32_OFFSET_Y);
+
+ if ((regno >= G0_REGNUM && regno <= G7_REGNUM) || regno == -1)
+ {
+ if (regno == G0_REGNUM || regno == -1)
+ supply_register (G0_REGNUM, NULL); /* %g0 is always zero */
+ for (i = G1_REGNUM; i <= G7_REGNUM; i++)
+ {
+ if (regno == i || regno == -1)
+ supply_register (i, regs + REG32_OFFSET_GLOBAL +
+ ((i - G0_REGNUM) * 4));
+ }
+ }
+
+ if ((regno >= O0_REGNUM && regno <= O7_REGNUM) || regno == -1)
+ {
+ for (i = O0_REGNUM; i <= O7_REGNUM; i++)
+ {
+ if (regno == i || regno == -1)
+ supply_register (i, regs + REG32_OFFSET_OUT +
+ ((i - O0_REGNUM) * 4));
+ }
+ }
+
+ /* Inputs and Locals are stored onto the stack by by the kernel. */
+ if ((regno >= L0_REGNUM && regno <= I7_REGNUM) || regno == -1)
+ {
+ CORE_ADDR sp = read_register (SP_REGNUM);
+ char buf[4];
+
+ for (i = L0_REGNUM; i <= I7_REGNUM; i++)
+ {
+ if (regno == i || regno == -1)
+ {
+ target_read_memory (sp + ((i - L0_REGNUM) * 4),
+ buf, sizeof (buf));
+ supply_register (i, buf);
+ }
+ }
+ }
+
+ /* FIXME: If we don't set these valid, read_register_bytes() rereads
+ all the regs every time it is called! */
+ if (regno == WIM_REGNUM || regno == -1)
+ supply_register (WIM_REGNUM, NULL);
+ if (regno == TBR_REGNUM || regno == -1)
+ supply_register (TBR_REGNUM, NULL);
+ if (regno == CPS_REGNUM || regno == -1)
+ supply_register (CPS_REGNUM, NULL);
+}
+
+void
+sparcnbsd_supply_reg64 (char *regs, int regno)
+{
+ int i;
+ char buf[8];
+
+ if (regno == TSTATE_REGNUM || regno == -1)
+ supply_register (PS_REGNUM, regs + REG64_OFFSET_TSTATE);
+
+ if (regno == PC_REGNUM || regno == -1)
+ supply_register (PC_REGNUM, regs + REG64_OFFSET_PC);
+
+ if (regno == NPC_REGNUM || regno == -1)
+ supply_register (NPC_REGNUM, regs + REG64_OFFSET_NPC);
+
+ if (regno == Y_REGNUM || regno == -1)
+ {
+ memset (buf, 0, sizeof (buf));
+ memcpy (&buf[4], regs + REG64_OFFSET_Y, 4);
+ supply_register (Y_REGNUM, buf);
+ }
+
+ if ((regno >= G0_REGNUM && regno <= G7_REGNUM) || regno == -1)
+ {
+ if (regno == G0_REGNUM || regno == -1)
+ supply_register (G0_REGNUM, NULL); /* %g0 is always zero */
+ for (i = G1_REGNUM; i <= G7_REGNUM; i++)
+ {
+ if (regno == i || regno == -1)
+ supply_register (i, regs + REG64_OFFSET_GLOBAL +
+ ((i - G0_REGNUM) * 8));
+ }
+ }
+
+ if ((regno >= O0_REGNUM && regno <= O7_REGNUM) || regno == -1)
+ {
+ for (i = O0_REGNUM; i <= O7_REGNUM; i++)
+ {
+ if (regno == i || regno == -1)
+ supply_register (i, regs + REG64_OFFSET_OUT +
+ ((i - O0_REGNUM) * 8));
+ }
+ }
+
+ /* Inputs and Locals are stored onto the stack by by the kernel. */
+ if ((regno >= L0_REGNUM && regno <= I7_REGNUM) || regno == -1)
+ {
+ CORE_ADDR sp = read_register (SP_REGNUM);
+ char buf[8];
+
+ if (sp & 1)
+ {
+ /* Registers are 64-bit. */
+ sp += 2047;
+
+ for (i = L0_REGNUM; i <= I7_REGNUM; i++)
+ {
+ if (regno == i || regno == -1)
+ {
+ target_read_memory (sp + ((i - L0_REGNUM) * 8),
+ buf, sizeof (buf));
+ supply_register (i, buf);
+ }
+ }
+ }
+ else
+ {
+ /* Registers are 32-bit. Toss any sign-extension of the stack
+ pointer, clear out the top half of the temporary buffer, and
+ put the register value in the bottom half. */
+
+ sp &= 0xffffffffUL;
+ memset (buf, 0, sizeof (buf));
+ for (i = L0_REGNUM; i <= I7_REGNUM; i++)
+ {
+ if (regno == i || regno == -1)
+ {
+ target_read_memory (sp + ((i - L0_REGNUM) * 4),
+ &buf[4], sizeof (buf));
+ supply_register (i, buf);
+ }
+ }
+ }
+ }
+
+ /* FIXME: If we don't set these valid, read_register_bytes() rereads
+ all the regs every time it is called! */
+ if (regno == WIM_REGNUM || regno == -1)
+ supply_register (WIM_REGNUM, NULL);
+ if (regno == TBR_REGNUM || regno == -1)
+ supply_register (TBR_REGNUM, NULL);
+ if (regno == CPS_REGNUM || regno == -1)
+ supply_register (CPS_REGNUM, NULL);
+}
+
+void
+sparcnbsd_fill_reg32 (char *regs, int regno)
+{
+ int i;
+
+ if (regno == PS_REGNUM || regno == -1)
+ regcache_collect (PS_REGNUM, regs + REG32_OFFSET_PSR);
+
+ if (regno == PC_REGNUM || regno == -1)
+ regcache_collect (PC_REGNUM, regs + REG32_OFFSET_PC);
+
+ if (regno == NPC_REGNUM || regno == -1)
+ regcache_collect (NPC_REGNUM, regs + REG32_OFFSET_NPC);
+
+ if (regno == Y_REGNUM || regno == -1)
+ regcache_collect (Y_REGNUM, regs + REG32_OFFSET_Y);
+
+ if ((regno >= G0_REGNUM && regno <= G7_REGNUM) || regno == -1)
+ {
+ /* %g0 is always zero */
+ for (i = G1_REGNUM; i <= G7_REGNUM; i++)
+ {
+ if (regno == i || regno == -1)
+ regcache_collect (i, regs + REG32_OFFSET_GLOBAL +
+ ((i - G0_REGNUM) * 4));
+ }
+ }
+
+ if ((regno >= O0_REGNUM && regno <= O7_REGNUM) || regno == -1)
+ {
+ for (i = O0_REGNUM; i <= O7_REGNUM; i++)
+ {
+ if (regno == i || regno == -1)
+ regcache_collect (i, regs + REG32_OFFSET_OUT +
+ ((i - O0_REGNUM) * 4));
+ }
+ }
+
+ /* Responsibility for the stack regs is pushed off onto the caller. */
+}
+
+void
+sparcnbsd_fill_reg64 (char *regs, int regno)
+{
+ int i;
+
+ if (regno == TSTATE_REGNUM || regno == -1)
+ regcache_collect (TSTATE_REGNUM, regs + REG64_OFFSET_TSTATE);
+
+ if (regno == PC_REGNUM || regno == -1)
+ regcache_collect (PC_REGNUM, regs + REG64_OFFSET_PC);
+
+ if (regno == NPC_REGNUM || regno == -1)
+ regcache_collect (NPC_REGNUM, regs + REG64_OFFSET_NPC);
+
+ if (regno == Y_REGNUM || regno == -1)
+ regcache_collect (Y_REGNUM, regs + REG64_OFFSET_Y);
+
+ if ((regno >= G0_REGNUM && regno <= G7_REGNUM) || regno == -1)
+ {
+ /* %g0 is always zero */
+ for (i = G1_REGNUM; i <= G7_REGNUM; i++)
+ {
+ if (regno == i || regno == -1)
+ regcache_collect (i, regs + REG64_OFFSET_GLOBAL +
+ ((i - G0_REGNUM) * 4));
+ }
+ }
+
+ if ((regno >= O0_REGNUM && regno <= O7_REGNUM) || regno == -1)
+ {
+ for (i = O0_REGNUM; i <= O7_REGNUM; i++)
+ {
+ if (regno == i || regno == -1)
+ regcache_collect (i, regs + REG64_OFFSET_OUT +
+ ((i - O0_REGNUM) * 4));
+ }
+ }
+
+ /* Responsibility for the stack regs is pushed off onto the caller. */
+}
+
+void
+sparcnbsd_supply_fpreg32 (char *fpregs, int regno)
+{
+ int i;
+
+ for (i = 0; i <= 31; i++)
+ {
+ if (regno == (FP0_REGNUM + i) || regno == -1)
+ supply_register (FP0_REGNUM + i, fpregs + (i * 4));
+ }
+
+ if (regno == FPS_REGNUM || regno == -1)
+ supply_register (FPS_REGNUM, fpregs + (32 * 4));
+}
+
+void
+sparcnbsd_supply_fpreg64 (char *fpregs, int regno)
+{
+ int i;
+
+ for (i = 0; i <= 31; i++)
+ {
+ if (regno == (FP0_REGNUM + i) || regno == -1)
+ supply_register (FP0_REGNUM + i, fpregs + (i * 4));
+ }
+
+ for (; i <= 47; i++)
+ {
+ if (regno == (FP0_REGNUM + i) || regno == -1)
+ supply_register (FP0_REGNUM + i, fpregs + (32 * 4) + (i * 8));
+ }
+
+ if (regno == FPS_REGNUM || regno == -1)
+ supply_register (FPS_REGNUM, fpregs + (32 * 4) + (16 * 8));
+
+ /* XXX %gsr */
+}
+
+void
+sparcnbsd_fill_fpreg32 (char *fpregs, int regno)
+{
+ int i;
+
+ for (i = 0; i <= 31; i++)
+ {
+ if (regno == (FP0_REGNUM + i) || regno == -1)
+ regcache_collect (FP0_REGNUM + i, fpregs + (i * 4));
+ }
+
+ if (regno == FPS_REGNUM || regno == -1)
+ regcache_collect (FPS_REGNUM, fpregs + (32 * 4));
+}
+
+void
+sparcnbsd_fill_fpreg64 (char *fpregs, int regno)
+{
+ int i;
+
+ for (i = 0; i <= 31; i++)
+ {
+ if (regno == (FP0_REGNUM + i) || regno == -1)
+ regcache_collect (FP0_REGNUM + i, fpregs + (i * 4));
+ }
+
+ for (; i <= 47; i++)
+ {
+ if (regno == (FP0_REGNUM + i) || regno == -1)
+ regcache_collect (FP0_REGNUM + i, fpregs + (32 * 4) + (i * 8));
+ }
+
+ if (regno == FPS_REGNUM || regno == -1)
+ regcache_collect (FPS_REGNUM, fpregs + (32 * 4) + (16 * 8));
+
+ /* XXX %gsr */
+}
+
+/* Unlike other NetBSD implementations, the SPARC port historically used
+ .reg and .reg2 (see bfd/netbsd-core.c), and as such, we can share one
+ routine for a.out and ELF core files. */
+static void
+fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, int which,
+ CORE_ADDR ignore)
+{
+ int reg_size, fpreg_size;
+
+ if (gdbarch_ptr_bit (current_gdbarch) == 32)
+ {
+ reg_size = (20 * 4);
+ fpreg_size = (33 * 4);
+ }
+ else
+ {
+ reg_size = (20 * 8);
+ fpreg_size = (64 * 4)
+ + 8 /* fsr */
+ + 4 /* gsr */
+ + 4; /* pad */
+ }
+
+ switch (which)
+ {
+ case 0: /* Integer registers */
+ if (core_reg_size != reg_size)
+ warning ("Wrong size register set in core file.");
+ else if (gdbarch_ptr_bit (current_gdbarch) == 32)
+ sparcnbsd_supply_reg32 (core_reg_sect, -1);
+ else
+ sparcnbsd_supply_reg64 (core_reg_sect, -1);
+ break;
+
+ case 2: /* Floating pointer registers */
+ if (core_reg_size != fpreg_size)
+ warning ("Wrong size FP register set in core file.");
+ else if (gdbarch_ptr_bit (current_gdbarch) == 32)
+ sparcnbsd_supply_fpreg32 (core_reg_sect, -1);
+ else
+ sparcnbsd_supply_fpreg64 (core_reg_sect, -1);
+ break;
+
+ default:
+ /* Don't know what kind of register request this is; just ignore it. */
+ break;
+ }
+}
+
+static struct core_fns sparcnbsd_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
+};
+
+static struct core_fns sparcnbsd_elfcore_fns =
+{
+ bfd_target_elf_flavour, /* core_flavour */
+ default_check_format, /* check_format */
+ default_core_sniffer, /* core_sniffer */
+ fetch_core_registers, /* core_read_registers */
+ NULL
+};
+
+/* FIXME: Need PC_IN_SIGTRAMP() support, but NetBSD/sparc signal trampolines
+ aren't easily identified. */
+
+static int
+sparcnbsd_get_longjmp_target_32 (CORE_ADDR *pc)
+{
+ CORE_ADDR jb_addr;
+ char buf[4];
+
+ jb_addr = read_register (O0_REGNUM);
+
+ if (target_read_memory (jb_addr + 12, buf, sizeof (buf)))
+ return 0;
+
+ *pc = extract_address (buf, sizeof (buf));
+
+ return 1;
+}
+
+static int
+sparcnbsd_get_longjmp_target_64 (CORE_ADDR *pc)
+{
+ CORE_ADDR jb_addr;
+ char buf[8];
+
+ jb_addr = read_register (O0_REGNUM);
+
+ if (target_read_memory (jb_addr + 16, buf, sizeof (buf)))
+ return 0;
+
+ *pc = extract_address (buf, sizeof (buf));
+
+ return 1;
+}
+
+static int
+sparcnbsd_aout_in_solib_call_trampoline (CORE_ADDR pc, char *name)
+{
+ if (strcmp (name, "_DYNAMIC") == 0)
+ return 1;
+
+ return 0;
+}
+
+static void
+sparcnbsd_init_abi_common (struct gdbarch_info info,
+ struct gdbarch *gdbarch)
+{
+ set_gdbarch_get_longjmp_target (gdbarch, gdbarch_ptr_bit (gdbarch) == 32 ?
+ sparcnbsd_get_longjmp_target_32 :
+ sparcnbsd_get_longjmp_target_64);
+}
+
+static void
+sparcnbsd_init_abi_aout (struct gdbarch_info info,
+ struct gdbarch *gdbarch)
+{
+ sparcnbsd_init_abi_common (info, gdbarch);
+
+ set_gdbarch_in_solib_call_trampoline (gdbarch,
+ sparcnbsd_aout_in_solib_call_trampoline);
+}
+
+static void
+sparcnbsd_init_abi_elf (struct gdbarch_info info,
+ struct gdbarch *gdbarch)
+{
+ sparcnbsd_init_abi_common (info, gdbarch);
+
+ set_solib_svr4_fetch_link_map_offsets (gdbarch,
+ gdbarch_ptr_bit (gdbarch) == 32 ?
+ nbsd_ilp32_solib_svr4_fetch_link_map_offsets :
+ nbsd_lp64_solib_svr4_fetch_link_map_offsets);
+}
+
+static enum gdb_osabi
+sparcnbsd_aout_osabi_sniffer (bfd *abfd)
+{
+ if (strcmp (bfd_get_target (abfd), "a.out-sparc-netbsd") == 0)
+ return GDB_OSABI_NETBSD_AOUT;
+
+ return GDB_OSABI_UNKNOWN;
+}
+
+void
+_initialize_sparnbsd_tdep (void)
+{
+ gdbarch_register_osabi_sniffer (bfd_arch_sparc, bfd_target_aout_flavour,
+ sparcnbsd_aout_osabi_sniffer);
+
+ gdbarch_register_osabi (bfd_arch_sparc, GDB_OSABI_NETBSD_AOUT,
+ sparcnbsd_init_abi_aout);
+ gdbarch_register_osabi (bfd_arch_sparc, GDB_OSABI_NETBSD_ELF,
+ sparcnbsd_init_abi_elf);
+
+ add_core_fns (&sparcnbsd_core_fns);
+ add_core_fns (&sparcnbsd_elfcore_fns);
+}
diff --git a/gdb/sparcnbsd-tdep.h b/gdb/sparcnbsd-tdep.h
new file mode 100644
index 00000000000..bad2d653c8e
--- /dev/null
+++ b/gdb/sparcnbsd-tdep.h
@@ -0,0 +1,34 @@
+/* Common target dependent code for GDB on SPARC systems running NetBSD.
+ 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 SPARCNBSD_TDEP_H
+#define SPARCNBSD_TDEP_H
+
+void sparcnbsd_supply_reg32 (char *, int);
+void sparcnbsd_supply_reg64 (char *, int);
+void sparcnbsd_fill_reg32 (char *, int);
+void sparcnbsd_fill_reg64 (char *, int);
+
+void sparcnbsd_supply_fpreg32 (char *, int);
+void sparcnbsd_supply_fpreg64 (char *, int);
+void sparcnbsd_fill_fpreg32 (char *, int);
+void sparcnbsd_fill_fpreg64 (char *, int);
+
+#endif /* SPARCNBSD_TDEP_H */
diff --git a/gdb/stabsread.c b/gdb/stabsread.c
index 56b78495938..47502141547 100644
--- a/gdb/stabsread.c
+++ b/gdb/stabsread.c
@@ -142,7 +142,7 @@ static struct type *read_struct_type (char **, struct type *,
static struct type *read_array_type (char **, struct type *,
struct objfile *);
-static struct type **read_args (char **, int, struct objfile *);
+static struct field *read_args (char **, int, struct objfile *, int *, int *);
static int
read_cpp_abbrev (struct field_info *, char **, struct type *,
@@ -2780,7 +2780,8 @@ again:
{
struct type *domain = read_type (pp, objfile);
struct type *return_type;
- struct type **args;
+ struct field *args;
+ int nargs, varargs;
if (**pp != ',')
/* Invalid member type data format. */
@@ -2789,9 +2790,10 @@ again:
++(*pp);
return_type = read_type (pp, objfile);
- args = read_args (pp, ';', objfile);
+ args = read_args (pp, ';', objfile, &nargs, &varargs);
type = dbx_alloc_type (typenums, objfile);
- smash_to_method_type (type, domain, return_type, args);
+ smash_to_method_type (type, domain, return_type, args,
+ nargs, varargs);
}
break;
@@ -4929,38 +4931,39 @@ handle_true_range:
and terminated with END. Return the list of types read in, or (struct type
**)-1 if there is an error. */
-static struct type **
-read_args (char **pp, int end, struct objfile *objfile)
+static struct field *
+read_args (char **pp, int end, struct objfile *objfile, int *nargsp,
+ int *varargsp)
{
/* FIXME! Remove this arbitrary limit! */
- struct type *types[1024], **rval; /* allow for fns of 1023 parameters */
- int n = 0;
+ struct type *types[1024]; /* allow for fns of 1023 parameters */
+ int n = 0, i;
+ struct field *rval;
while (**pp != end)
{
if (**pp != ',')
/* Invalid argument list: no ','. */
- return (struct type **) -1;
+ return (struct field *) -1;
(*pp)++;
STABS_CONTINUE (pp, objfile);
types[n++] = read_type (pp, objfile);
}
(*pp)++; /* get past `end' (the ':' character) */
- if (n == 1)
- {
- rval = (struct type **) xmalloc (2 * sizeof (struct type *));
- }
- else if (TYPE_CODE (types[n - 1]) != TYPE_CODE_VOID)
- {
- rval = (struct type **) xmalloc ((n + 1) * sizeof (struct type *));
- memset (rval + n, 0, sizeof (struct type *));
- }
+ if (TYPE_CODE (types[n - 1]) != TYPE_CODE_VOID)
+ *varargsp = 1;
else
{
- rval = (struct type **) xmalloc (n * sizeof (struct type *));
+ n--;
+ *varargsp = 0;
}
- memcpy (rval, types, n * sizeof (struct type *));
+
+ rval = (struct field *) xmalloc (n * sizeof (struct field));
+ memset (rval, 0, n * sizeof (struct field));
+ for (i = 0; i < n; i++)
+ rval[i].type = types[i];
+ *nargsp = n;
return rval;
}
diff --git a/gdb/stack.c b/gdb/stack.c
index 2dab0deb016..014c274c740 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -929,39 +929,84 @@ frame_info (char *addr_exp, int from_tty)
}
}
- FRAME_INIT_SAVED_REGS (fi);
- if (fi->saved_regs != NULL)
- {
- /* The sp is special; what's returned isn't the save address, but
- actually the value of the previous frame's sp. */
- printf_filtered (" Previous frame's sp is ");
- print_address_numeric (fi->saved_regs[SP_REGNUM], 1, gdb_stdout);
- printf_filtered ("\n");
- count = 0;
- numregs = NUM_REGS + NUM_PSEUDO_REGS;
- for (i = 0; i < numregs; i++)
- if (fi->saved_regs[i] && i != SP_REGNUM)
+ if (fi->saved_regs == NULL)
+ FRAME_INIT_SAVED_REGS (fi);
+ /* Print as much information as possible on the location of all the
+ registers. */
+ {
+ enum lval_type lval;
+ int optimized;
+ CORE_ADDR addr;
+ int realnum;
+ int count;
+ int i;
+ int need_nl = 1;
+
+ /* The sp is special; what's displayed isn't the save address, but
+ the value of the previous frame's sp. This is a legacy thing,
+ at one stage the frame cached the previous frame's SP instead
+ of its address, hence it was easiest to just display the cached
+ value. */
+ if (SP_REGNUM >= 0)
+ {
+ /* Find out the location of the saved stack pointer with out
+ actually evaluating it. */
+ frame_register_unwind (fi, SP_REGNUM, &optimized, &lval, &addr,
+ &realnum, NULL);
+ if (!optimized && lval == not_lval)
{
- if (count == 0)
- puts_filtered (" Saved registers:\n ");
- else
- puts_filtered (",");
- wrap_here (" ");
- printf_filtered (" %s at ", REGISTER_NAME (i));
- print_address_numeric (fi->saved_regs[i], 1, gdb_stdout);
- count++;
+ void *value = alloca (MAX_REGISTER_RAW_SIZE);
+ CORE_ADDR sp;
+ frame_register_unwind (fi, SP_REGNUM, &optimized, &lval, &addr,
+ &realnum, value);
+ sp = extract_address (value, REGISTER_RAW_SIZE (SP_REGNUM));
+ printf_filtered (" Previous frame's sp is ");
+ print_address_numeric (sp, 1, gdb_stdout);
+ printf_filtered ("\n");
+ need_nl = 0;
}
- if (count)
- puts_filtered ("\n");
- }
- else
- {
- /* We could get some information about saved registers by
- calling get_saved_register on each register. Which info goes
- with which frame is necessarily lost, however, and I suspect
- that the users don't care whether they get the info. */
+ else if (!optimized && lval == lval_memory)
+ {
+ printf_filtered (" Previous frame's sp at ");
+ print_address_numeric (addr, 1, gdb_stdout);
+ printf_filtered ("\n");
+ need_nl = 0;
+ }
+ else if (!optimized && lval == lval_register)
+ {
+ printf_filtered (" Previous frame's sp in %s\n",
+ REGISTER_NAME (realnum));
+ need_nl = 0;
+ }
+ /* else keep quiet. */
+ }
+
+ count = 0;
+ numregs = NUM_REGS + NUM_PSEUDO_REGS;
+ for (i = 0; i < numregs; i++)
+ if (i != SP_REGNUM)
+ {
+ /* Find out the location of the saved register without
+ fetching the corresponding value. */
+ frame_register_unwind (fi, i, &optimized, &lval, &addr, &realnum,
+ NULL);
+ /* For moment, only display registers that were saved on the
+ stack. */
+ if (!optimized && lval == lval_memory)
+ {
+ if (count == 0)
+ puts_filtered (" Saved registers:\n ");
+ else
+ puts_filtered (",");
+ wrap_here (" ");
+ printf_filtered (" %s at ", REGISTER_NAME (i));
+ print_address_numeric (addr, 1, gdb_stdout);
+ count++;
+ }
+ }
+ if (count || need_nl)
puts_filtered ("\n");
- }
+ }
}
#if 0
@@ -1500,17 +1545,6 @@ select_and_print_frame (struct frame_info *fi)
}
}
-
-/* Store the selected frame and its level into *FRAMEP and *LEVELP.
- If there is no selected frame, *FRAMEP is set to NULL. */
-
-void
-record_selected_frame (CORE_ADDR *frameaddrp, int *levelp)
-{
- *frameaddrp = selected_frame ? selected_frame->frame : 0;
- *levelp = frame_relative_level (selected_frame);
-}
-
/* Return the symbol-block in which the selected frame is executing.
Can return zero under various legitimate circumstances.
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 2705785946e..da681a6b34e 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,89 @@
+2002-06-11 Jim Blandy <jimb@redhat.com>
+
+ * lib/gdb.exp (get_debug_format): Tolerate message saying whether
+ preprocessor macro information is present.
+
+ * macscp.exp, macscp1.c, macscp2.h, macscp3.h, macscp4.h: New
+ tests.
+
+2002-06-06 Michael Snyder <msnyder@redhat.com>
+
+ * gdb.base/overlays.exp: Record addresses of overlay
+ functions in TCL variables rather than in GDB variables,
+ to avoid having GDB convert them to pointers (with loss
+ of information).
+
+ * gdb.base/d10v.ld: Merge in several years worth of
+ default linker script changes.
+ * gdb.base/long_long.exp: Add check for sizeof (long double).
+
+2002-06-06 Michal Ludvig <mludvig@suse.cz>
+
+ * gdb.asm/asm-source.exp: Add x86-64 target.
+ * gdb.asm/x86_64.inc: New.
+
+2002-05-30 Michael Chastain <mec@shout.net>
+
+ From Benjamin Kosnik <bkoz@redhat.com>:
+ * gdb.c++/m-static.cc: New file.
+ * gdb.c++/m-static.exp: New file.
+
+2002-05-28 Michael Snyder <msnyder@redhat.com>
+
+ * gdb.base/call-ar-st.exp: Allow for reduced floating point
+ precision.
+
+2002-05-27 Michael Chastain <mec@shout.net>
+
+ From Benjamin Kosnik <bkoz@redhat.com>:
+ * gdb.c++/m-data.cc: New file.
+ * gdb.c++/m-data.exp: New file.
+
+2002-05-27 Michael Chastain <mec@shout.net>
+
+ From Benjamin Kosnik <bkoz@redhat.com>:
+ * gdb.c++/try_catch.cc: New file.
+ * gdb.c++/try_catch.exp: New file.
+
+2002-05-27 Michael Chastain <mec@shout.net>
+
+ * gdb.c++/local.exp: Accept more nested types in output.
+
+2002-05-26 Michael Chastain <mec@shout.net>
+
+ * gdb.base/call-rt-st.exp: Fix typo in brace quoting.
+
+2002-05-15 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * lib/gdb.exp (gdb_wrapper_init): Just because
+ gdb_wrapper_file exists, this does not mean that the file
+ should not be rebuilt. That is what gdb_wrapper_initialized
+ is for.
+ (default_gdb_init): Reset gdb_wrapper_initialized.
+
+2002-05-23 Michael Snyder <msnyder@redhat.com>
+
+ * gdb.base/all-bin.exp: Revise previous patch by just reducing
+ the precision of the floating point test results.
+ * gdb.base/call-rt-st.exp: Ditto.
+
+ * gdb.base/all-bin.exp: Allow for reduced floating point precision.
+ * gdb.base/call-rt-st.exp: Ditto.
+
+2002-05-19 Michael Chastain <mec@shout.net>
+
+ * gdb.c++/inherit.exp: Accept "VTT for ..." in output strings.
+
+2002-05-19 Elena Zannoni <ezannoni@redhat.com>
+
+ * configure.in (configdirs): Add gdb.arch.
+ * configure: Regenerate.
+
+2002-05-17 Jim Blandy <jimb@redhat.com>
+
+ * gdb.base/completion.exp: Recognize the more detailed error
+ messages produced by the macro expander's lexical analyzer.
+
2002-05-14 Elena Zannoni <ezannoni@redhat.com>
* gdb.arch/altivec-abi.c: New file.
diff --git a/gdb/testsuite/configure b/gdb/testsuite/configure
index ba66f400d89..bdfc4cd443e 100755
--- a/gdb/testsuite/configure
+++ b/gdb/testsuite/configure
@@ -649,7 +649,8 @@ test "$host_alias" != "$target_alias" &&
# Directories to use in all configurations.
-configdirs="gdb.asm \
+configdirs="gdb.arch \
+ gdb.asm \
gdb.base \
gdb.c++ \
gdb.java \
@@ -749,12 +750,12 @@ fi
# End stuff to support --enable-shared
echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6
-echo "configure:753: checking for Cygwin environment" >&5
+echo "configure:754: 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 758 "configure"
+#line 759 "configure"
#include "confdefs.h"
int main() {
@@ -765,7 +766,7 @@ int main() {
return __CYGWIN__;
; return 0; }
EOF
-if { (eval echo configure:769: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:770: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_cygwin=yes
else
@@ -782,19 +783,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:786: checking for mingw32 environment" >&5
+echo "configure:787: 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 791 "configure"
+#line 792 "configure"
#include "confdefs.h"
int main() {
return __MINGW32__;
; return 0; }
EOF
-if { (eval echo configure:798: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:799: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_mingw32=yes
else
@@ -813,7 +814,7 @@ test "$ac_cv_mingw32" = yes && MINGW32=yes
echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
-echo "configure:817: checking for executable suffix" >&5
+echo "configure:818: checking for executable suffix" >&5
if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -823,7 +824,7 @@ else
rm -f conftest*
echo 'int main () { return 0; }' > conftest.$ac_ext
ac_cv_exeext=
- if { (eval echo configure:827: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+ if { (eval echo configure:828: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
for file in conftest.*; do
case $file in
*.c | *.o | *.obj | *.ilk | *.pdb) ;;
diff --git a/gdb/testsuite/configure.in b/gdb/testsuite/configure.in
index 446c8d1429f..48e50d873f4 100644
--- a/gdb/testsuite/configure.in
+++ b/gdb/testsuite/configure.in
@@ -13,7 +13,8 @@ AC_CONFIG_AUX_DIR(`cd $srcdir;pwd`/../..)
AC_CANONICAL_SYSTEM
# Directories to use in all configurations.
-configdirs="gdb.asm \
+configdirs="gdb.arch \
+ gdb.asm \
gdb.base \
gdb.c++ \
gdb.java \
diff --git a/gdb/testsuite/gdb.asm/asm-source.exp b/gdb/testsuite/gdb.asm/asm-source.exp
index f6ce1c73b2b..f10f4ae2a62 100644
--- a/gdb/testsuite/gdb.asm/asm-source.exp
+++ b/gdb/testsuite/gdb.asm/asm-source.exp
@@ -47,6 +47,10 @@ if [istarget "d10v-*-*"] then {
if [istarget "s390-*-*"] then {
set asm-arch s390
}
+if [istarget "x86_64-*-*"] then {
+ set asm-arch x86_64
+ set asm-flags "-gdwarf2 -I${srcdir}/${subdir} -I${objdir}/${subdir}"
+}
if [istarget "i\[3456\]86-*-*"] then {
set asm-arch i386
}
diff --git a/gdb/testsuite/gdb.asm/x86_64.inc b/gdb/testsuite/gdb.asm/x86_64.inc
new file mode 100644
index 00000000000..5bcaeae25ab
--- /dev/null
+++ b/gdb/testsuite/gdb.asm/x86_64.inc
@@ -0,0 +1,39 @@
+ comment "subroutine prologue"
+ .macro gdbasm_enter
+ push %rbp
+ mov %rsp,%rbp
+ .endm
+
+ comment "subroutine epilogue"
+ .macro gdbasm_leave
+ pop %rbp
+ ret
+ .endm
+
+ .macro gdbasm_call subr
+ call \subr
+ .endm
+
+ .macro gdbasm_several_nops
+ nop
+ nop
+ nop
+ nop
+ .endm
+
+ comment "exit (0)"
+ .macro gdbasm_exit0
+ hlt
+ .endm
+
+ comment "crt0 startup"
+ .macro gdbasm_startup
+ xor %rbp, %rbp
+ .endm
+
+ comment "Declare a data variable"
+ .macro gdbasm_datavar name value
+ .data
+\name:
+ .long \value
+ .endm
diff --git a/gdb/testsuite/gdb.base/all-bin.exp b/gdb/testsuite/gdb.base/all-bin.exp
index d809db7d158..fe6b7558e4c 100644
--- a/gdb/testsuite/gdb.base/all-bin.exp
+++ b/gdb/testsuite/gdb.base/all-bin.exp
@@ -187,12 +187,12 @@ gdb_expect {
send_gdb "print v_int+v_double\n"
gdb_expect {
- -re ".*206.56565.*$gdb_prompt $" {
+ -re ".*206.565.*$gdb_prompt $" {
pass "print value of v_int+v_double"
- }
+ }
-re ".*$gdb_prompt $" { fail "print value of v_int+v_double" }
- timeout { fail "(timeout) print value of v_int+" }
- }
+ timeout { fail "(timeout) print value of v_int+v_double" }
+}
#
diff --git a/gdb/testsuite/gdb.base/call-ar-st.exp b/gdb/testsuite/gdb.base/call-ar-st.exp
index d9bb350f8d1..a7ea5cf56aa 100644
--- a/gdb/testsuite/gdb.base/call-ar-st.exp
+++ b/gdb/testsuite/gdb.base/call-ar-st.exp
@@ -125,7 +125,7 @@ if {![gdb_skip_float_test "print print_double_array(double_array)"] && \
"\[ \t\r\n\]+array_d :"
"\[ \t\r\n\]+========="
"\[ \t\r\n\]+0.000000"
- "\[ \t\r\n\]+23.456700 46.913400 70.370100 93.826800 117.283500 140.740200 164.196900 187.653600"
+ "\[ \t\r\n\]+23.456\[0-9\]* 46.913\[0-9\]* 70.370\[0-9\]* 93.826\[0-9\]* 117.283\[0-9\]* 140.740\[0-9\]* 164.196\[0-9\]* 187.653\[0-9\]"
"\[ \t\r\n\]+"
}
}
@@ -194,7 +194,7 @@ if {![gdb_skip_float_test "continuing to breakpoint 1220"] && \
"\[ \t\r\n\]+array_d :"
"\[ \t\r\n\]+========="
"\[ \t\r\n\]+0.000000"
- "\[ \t\r\n\]+23.456700 46.913400 70.370100 93.826800 117.283500 140.740200 164.196900 187.653600"
+ "\[ \t\r\n\]+23.456\[0-9\]* 46.913\[0-9\]* 70.370\[0-9\]* 93.826\[0-9\]* 117.283\[0-9\]* 140.740\[0-9\]* 164.196\[0-9\]* 187.653\[0-9\]*"
"\[ \t\r\n\]+"
".*array_f :"
".*student id :\[\t \]+.*YELLOW"
@@ -240,7 +240,7 @@ if {![gdb_skip_float_test "print print_double_array(array_d)"] && \
"array_d :"
"\[ \t\r\n\]+========="
"\[ \t\r\n\]+\[ \t\r\n\]+0.000000"
- "\[ \t\r\n\]+23.456700 46.913400 70.370100 93.826800 117.283500 140.740200 164.196900 187.653600"
+ "\[ \t\r\n\]+23.456\[0-9\]* 46.913\[0-9\]* 70.370\[0-9\]* 93.826\[0-9\]* 117.283\[0-9\]* 140.740\[0-9\]* 164.196\[0-9\]* 187.653\[0-9\]*"
"\[ \t\r\n\]+"
}
}
@@ -259,7 +259,7 @@ if {![gdb_skip_float_test "continuing to 1236"] && \
"\[ \t\r\n\]+array_d :"
"\[ \t\r\n\]+========="
"\[ \t\r\n\]+0.000000"
- "\[ \t\r\n\]+23.456700 46.913400 70.370100 93.826800 117.283500 140.740200 164.196900 187.653600"
+ "\[ \t\r\n\]+23.456\[0-9\]* 46.913\[0-9\]* 70.370\[0-9\]* 93.826\[0-9\]* 117.283\[0-9\]* 140.740\[0-9\]* 164.196\[0-9\]* 187.653\[0-9\]*"
"\[ \t\r\n\]+.*HELLO WORLD.*main \\(\\) at .*call-ar-st.c:1236.*printf\\(.BYE BYE FOR NOW.n.\\)."
}
} else {
@@ -433,11 +433,11 @@ if {![gdb_skip_float_test "print print_ten_doubles(...)"] && \
![gdb_skip_stdio_test "print print_ten_doubles(...)"]} {
send_gdb "print print_ten_doubles(123.456, 123.456, -0.12, -1.23, 343434.8, 89.098, 3.14, -5678.12345, -0.11111111, 216.97065)\n"
gdb_expect_list "print print_ten_doubles" ".*$gdb_prompt $" {
- "\[\t\r\n \]+Two Doubles : 123.456000.*123.456000"
- "\[\t\r\n \]+Two Doubles : -0.120000.*-1.230000"
- "\[\t\r\n \]+Two Doubles : 343434.800000.*89.098000"
- "\[\t\r\n \]+Two Doubles : 3.140000.*-5678.123450"
- "\[\t\r\n \]+Two Doubles : -0.111111.*216.970650"
+ "\[\t\r\n \]+Two Doubles : 123.45\[0-9\]*.*123.45\[0-9\]*"
+ "\[\t\r\n \]+Two Doubles : -0.1200\[0-9\]*.*-1.2300\[0-9\]*"
+ "\[\t\r\n \]+Two Doubles : 343434.\[0-9\]*.*89.09\[0-9\]*"
+ "\[\t\r\n \]+Two Doubles : 3.1400\[0-9\]*.*-5678.123\[0-9\]*"
+ "\[\t\r\n \]+Two Doubles : -0.1111\[0-9\]*.*216.97\[0-9\]*"
}
}
diff --git a/gdb/testsuite/gdb.base/call-rt-st.exp b/gdb/testsuite/gdb.base/call-rt-st.exp
index 033b5ef73dc..115dcb3fa7e 100644
--- a/gdb/testsuite/gdb.base/call-rt-st.exp
+++ b/gdb/testsuite/gdb.base/call-rt-st.exp
@@ -1,4 +1,4 @@
-# Copyright 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+# Copyright 1998, 1999, 2000, 2001, 2002 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
@@ -176,7 +176,7 @@ if ![gdb_skip_stdio_test "print print_one_large_struct(...)"] {
if {![gdb_skip_float_test "print print_one_double(*d1)"] && \
![gdb_skip_stdio_test "print print_one_double(*d1)"] } {
print_struct_call "print_one_double(*d1)" \
- ".*Contents of one_double_t:\[ \r\n\]+1\\.111110\[ \r\n\]+.\[0-9\]+ = \\{double1 = 1\\.11111\\}"
+ ".*Contents of one_double_t:\[ \r\n\]+1\\.111110\[ \r\n\]+.\[0-9\]+ = \\{double1 = 1\\.111\[0-9\]*\\}"
}
if {![gdb_skip_float_test "print print_two_floats(*f3)"] && \
diff --git a/gdb/testsuite/gdb.base/completion.exp b/gdb/testsuite/gdb.base/completion.exp
index f8f4568e5f8..332e1697a7f 100644
--- a/gdb/testsuite/gdb.base/completion.exp
+++ b/gdb/testsuite/gdb.base/completion.exp
@@ -414,7 +414,7 @@ gdb_expect {
-re "^p 'a\\\x07$"\
{ send_gdb "\n"
gdb_expect {
- -re "Invalid character constant\\..*$gdb_prompt $"\
+ -re "(Invalid character constant\\.|Unmatched single quote\\.).*$gdb_prompt $"\
{ pass "complete 'p \'a'"}
-re ".*$gdb_prompt $" { fail "complete 'p \'a'"}
timeout {fail "(timeout) complete 'p \'a'"}
@@ -433,7 +433,7 @@ gdb_expect {
-re ".*argv.*$gdb_prompt p .a$" {
send_gdb "\n"
gdb_expect {
- -re "Invalid character constant\\..*$gdb_prompt $" {
+ -re "(Invalid character constant\\.|Unmatched single quote\\.).*$gdb_prompt $" {
pass "complete (2) 'p \'a'"
}
-re ".*$gdb_prompt $" { fail "complete (2) 'p \'a'" }
@@ -446,7 +446,7 @@ gdb_expect {
-re "\\(gdb\\) p 'a$" {
send_gdb "\n"
gdb_expect {
- -re "Invalid character constant\\..*$gdb_prompt $" {
+ -re "(Invalid character constant\\.|Unmatched single quote\\.).*$gdb_prompt $" {
pass "complete (2) 'p \'a'"
}
-re ".*$gdb_prompt $" {
diff --git a/gdb/testsuite/gdb.base/d10v.ld b/gdb/testsuite/gdb.base/d10v.ld
index 3c4c38a3c9c..41f085b1ed7 100644
--- a/gdb/testsuite/gdb.base/d10v.ld
+++ b/gdb/testsuite/gdb.base/d10v.ld
@@ -2,54 +2,57 @@ OUTPUT_FORMAT("elf32-d10v", "elf32-d10v",
"elf32-d10v")
OUTPUT_ARCH(d10v)
ENTRY(_start)
- SEARCH_DIR(/usr/cygnus/d10v-961230/H-sparc-sun-sunos4.1//lib);
/* Do we need any of these for elf?
__DYNAMIC = 0; */
+
+MEMORY
+{
+ UNIFIED : org = 0, len = 0x1000000
+ INSN : org = 0x1014000, len = 0x40000
+ DATA : org = 0x2000004, len = 0x7FFC
+ STACK : org = 0x200BFFE, len = 4
+}
+
SECTIONS
{
/* Overlay sections: */
- .ovly0 0x01010000 : AT (0x12010000) { foo.o(.text) }
- .ovly1 0x01010000 : AT (0x12011000) { bar.o(.text) }
- .ovly2 0x01011000 : AT (0x12012000) { baz.o(.text) }
- .ovly3 0x01011000 : AT (0x12013000) { grbx.o(.text) }
- .data00 0x00001000 : AT (0x12014000) { foo.o(.data) }
- .data01 0x00001000 : AT (0x12015000) { bar.o(.data) }
- .data02 0x00002000 : AT (0x12016000) { baz.o(.data) }
- .data03 0x00002000 : AT (0x12017000) { grbx.o(.data) }
- /* Read-only sections, merged into data segment: */
- . = 0x00000004;
- .interp : { *(.interp) }
- .hash : { *(.hash) }
- .dynsym : { *(.dynsym) }
- .dynstr : { *(.dynstr) }
- .rel.text : { *(.rel.text) }
- .rela.text : { *(.rela.text) }
- .rel.data : { *(.rel.data) }
- .rela.data : { *(.rela.data) }
- .rel.rodata : { *(.rel.rodata) }
- .rela.rodata : { *(.rela.rodata) }
- .rel.got : { *(.rel.got) }
- .rela.got : { *(.rela.got) }
- .rel.ctors : { *(.rel.ctors) }
- .rela.ctors : { *(.rela.ctors) }
- .rel.dtors : { *(.rel.dtors) }
- .rela.dtors : { *(.rela.dtors) }
- .rel.init : { *(.rel.init) }
- .rela.init : { *(.rela.init) }
- .rel.fini : { *(.rel.fini) }
- .rela.fini : { *(.rela.fini) }
- .rel.bss : { *(.rel.bss) }
- .rela.bss : { *(.rela.bss) }
- .rel.plt : { *(.rel.plt) }
- .rela.plt : { *(.rela.plt) }
- .plt : { *(.plt) }
- .rodata : { *(.rodata) *(.gnu.linkonce.r*) }
- .rodata1 : { *(.rodata1) }
- /* Adjust the address for the data segment. */
- . = ALIGN(4);
+ .ovly0 0x1001000 : AT (0x8000) { foo.o(.text) }
+ .ovly1 0x1001000 : AT (0x9000) { bar.o(.text) }
+ .ovly2 0x1002000 : AT (0xa000) { baz.o(.text) }
+ .ovly3 0x1002000 : AT (0xb000) { grbx.o(.text) }
+ .data00 0x2001000 : AT (0xc000) { foo.o(.data) }
+ .data01 0x2001000 : AT (0xd000) { bar.o(.data) }
+ .data02 0x2002000 : AT (0xe000) { baz.o(.data) }
+ .data03 0x2002000 : AT (0xf000) { grbx.o(.data) }
+
+ .text :
+ {
+ KEEP (*(.init))
+ KEEP (*(.init.*))
+ KEEP (*(.fini))
+ KEEP (*(.fini.*))
+ *(.text)
+ *(.text.*)
+ /* .gnu.warning sections are handled specially by elf32.em. */
+ *(.gnu.warning)
+ *(.gnu.linkonce.t*)
+ _etext = .;
+ PROVIDE (etext = .);
+ } >INSN =0
+ .rodata : {
+ *(.rodata)
+ *(.gnu.linkonce.r*)
+ *(.rodata.*)
+ } >DATA
+ .rodata1 : {
+ *(.rodata1)
+ *(.rodata1.*)
+ } >DATA
+
.data :
{
*(.data)
+ *(.data.*)
*(.gnu.linkonce.d*)
_ovly_table = .;
LONG(ABSOLUTE(ADDR(.ovly0)));
@@ -87,34 +90,66 @@ SECTIONS
_novlys = .;
LONG((_novlys - _ovly_table) / 16);
CONSTRUCTORS
- }
- .data1 : { *(.data1) }
+ } >DATA
+ .data1 : {
+ *(.data1)
+ *(.data1.*)
+ } >DATA
.ctors :
{
- *(.ctors)
- }
+ /* gcc uses crtbegin.o to find the start of
+ the constructors, so we make sure it is
+ first. Because this is a wildcard, it
+ doesn't matter if the user does not
+ actually link against crtbegin.o; the
+ linker won't look for a file to match a
+ wildcard. The wildcard also means that it
+ doesn't matter which directory crtbegin.o
+ is in. */
+
+ KEEP (*crtbegin.o(.ctors))
+
+ /* We don't want to include the .ctor section from
+ from the crtend.o file until after the sorted ctors.
+ The .ctor section from the crtend file contains the
+ end of ctors marker and it must be last */
+
+ KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
+ KEEP (*(SORT(.ctors.*)))
+ KEEP (*(.ctors))
+ } >DATA
.dtors :
{
- *(.dtors)
- }
- .got : { *(.got.plt) *(.got) }
- .dynamic : { *(.dynamic) }
+ KEEP (*crtbegin.o(.dtors))
+ KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
+ KEEP (*(SORT(.dtors.*)))
+ KEEP (*(.dtors))
+ } >DATA
/* We want the small data sections together, so single-instruction offsets
can access them all, and initialized data all before uninitialized, so
we can shorten the on-disk segment size. */
- .sdata : { *(.sdata) }
+ .sdata : {
+ *(.sdata)
+ *(.sdata.*)
+ } >DATA
_edata = .;
PROVIDE (edata = .);
__bss_start = .;
- .sbss : { *(.sbss) *(.scommon) }
+ .sbss : { *(.sbss) *(.scommon) } >DATA
.bss :
{
*(.dynbss)
+ *(.dynbss.*)
*(.bss)
+ *(.bss.*)
*(COMMON)
- }
+ } >DATA
+
_end = . ;
PROVIDE (end = .);
+
+ .stack : { _stack = .; *(.stack) } >STACK
+
/* Stabs debugging sections. */
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }
@@ -122,34 +157,37 @@ SECTIONS
.stab.exclstr 0 : { *(.stab.exclstr) }
.stab.index 0 : { *(.stab.index) }
.stab.indexstr 0 : { *(.stab.indexstr) }
+
.comment 0 : { *(.comment) }
+
/* DWARF debug sections.
- Symbols in the .debug DWARF section are relative to the beginning of the
- section so we begin .debug at 0. It's not clear yet what needs to happen
- for the others. */
+ Symbols in the DWARF debugging sections are relative to the beginning
+ of the section so we begin them at 0. */
+
+ /* DWARF 1 */
.debug 0 : { *(.debug) }
- .debug_info 0 : { *(.debug_info) }
- .debug_abbrev 0 : { *(.debug_abbrev) }
- .debug_line 0 : { *(.debug_line) }
- .debug_frame 0 : { *(.debug_frame) }
+ .line 0 : { *(.line) }
+
+ /* GNU DWARF 1 extensions */
.debug_srcinfo 0 : { *(.debug_srcinfo) }
+ .debug_sfnames 0 : { *(.debug_sfnames) }
+
+ /* DWARF 1.1 and DWARF 2 */
.debug_aranges 0 : { *(.debug_aranges) }
.debug_pubnames 0 : { *(.debug_pubnames) }
- .debug_sfnames 0 : { *(.debug_sfnames) }
- .line 0 : { *(.line) }
- /* These must appear regardless of . */
- /* Hmmm, there's got to be a better way. This sets the stack to the
- top of the simulator memory (i.e. top of 64K data space). */
- .stack 0x00007FFE : { _stack = .; *(.stack) }
- .text 0x1000000 :
- {
- *(.init)
- *(.fini)
- *(.text)
- /* .gnu.warning sections are handled specially by elf32.em. */
- *(.gnu.warning)
- *(.gnu.linkonce.t*)
- } =0
- _etext = .;
- PROVIDE (etext = .);
+
+ /* DWARF 2 */
+ .debug_info 0 : { *(.debug_info) *(.gnu.linkonce.wi.*) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_frame 0 : { *(.debug_frame) }
+ .debug_str 0 : { *(.debug_str) }
+ .debug_loc 0 : { *(.debug_loc) }
+ .debug_macinfo 0 : { *(.debug_macinfo) }
+
+ /* SGI/MIPS DWARF 2 extensions */
+ .debug_weaknames 0 : { *(.debug_weaknames) }
+ .debug_funcnames 0 : { *(.debug_funcnames) }
+ .debug_typenames 0 : { *(.debug_typenames) }
+ .debug_varnames 0 : { *(.debug_varnames) }
}
diff --git a/gdb/testsuite/gdb.base/long_long.exp b/gdb/testsuite/gdb.base/long_long.exp
index 7084a8deee1..55086d76755 100644
--- a/gdb/testsuite/gdb.base/long_long.exp
+++ b/gdb/testsuite/gdb.base/long_long.exp
@@ -114,6 +114,14 @@ gdb_expect {
default { }
}
+set sizeof_long_double 8
+send_gdb "print sizeof(long double)\n"
+gdb_expect {
+ -re ".* = 4.*$gdb_prompt $" { set sizeof_long_double 4 }
+ -re ".*$gdb_prompt $" { }
+ default { }
+}
+
gdb_test "n 4" ".*38.*" "get to known place"
# Check the hack for long long prints.
@@ -146,11 +154,10 @@ if { $sizeof_ptr == 2 } {
}
gdb_test "p/c oct" ".*'w'.*"
-if { $sizeof_double == 8 } {
-
-# ARM floating point numbers are not strictly little endian or big endian,
-# but a hybrid. They are in little endian format with the two words
-# swapped in big endian format.
+if { $sizeof_double == 8 || $sizeof_long_double == 8 } {
+ # ARM floating point numbers are not strictly little endian or big endian,
+ # but a hybrid. They are in little endian format with the two words
+ # swapped in big endian format.
if { [istarget "arm*-*-*"] || \
[istarget "xscale*-*-*"] || \
@@ -239,7 +246,7 @@ if { $target_bigendian_p } {
gdb_test "x/c &oct" ".*-89 .*"
# FIXME GDB's output is correct, but this longer match fails.
# gdb_test "x/c &oct" ".*-89 '\\\\247'.*"
- if { $sizeof_double == 8 } {
+ if { $sizeof_double == 8 || $sizeof_long_double == 8 } {
gdb_test "x/f &oct" ".*-5.9822653797615723e-120.*"
} else {
gdb_test "x/f &oct" ".*-2.42716126e-15.*"
diff --git a/gdb/testsuite/gdb.base/macscp.exp b/gdb/testsuite/gdb.base/macscp.exp
new file mode 100644
index 00000000000..283fe844573
--- /dev/null
+++ b/gdb/testsuite/gdb.base/macscp.exp
@@ -0,0 +1,403 @@
+# Test macro scoping.
+# Copyright 2002 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
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+set prms_id 0
+set bug_id 0
+
+set testfile "macscp"
+set binfile ${objdir}/${subdir}/${testfile}
+
+if {[gdb_compile "${srcdir}/${subdir}/macscp1.c" "${binfile}" executable {debug}] != "" } {
+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+
+# Ask GDB to show the current definition of MACRO, and return a list
+# describing the result.
+#
+# The return value has the form {FILE1 FILE2 ... DEF}, which means
+# that MACRO has the definition `DEF', and was defined in `FILE1',
+# which was included from `FILE2', included from ... .
+#
+# If GDB says that MACRO has no definition, return the string `undefined'.
+#
+# If GDB complains that it doesn't have any information about
+# preprocessor macro definitions, return the string `no-macro-info'.
+#
+# If expect times out waiting for GDB, we return the string `timeout'.
+#
+# If GDB's output doesn't otherwise match what we're expecting, we
+# return the empty string.
+
+proc info_macro {macro} {
+ global gdb_prompt
+ global decimal
+
+ set filepat {macscp[0-9]+\.[ch]}
+ set definition {}
+ set location {}
+
+ send_gdb "info macro ${macro}\n"
+
+ set debug_me 0
+
+ if {$debug_me} {exp_internal 1}
+ gdb_expect {
+ -re "Defined at \[^\r\n\]*(${filepat}):${decimal}\[\r\n\]" {
+ # `location' and `definition' should be empty when we see
+ # this message.
+ if {[llength $location] == 0 && [llength $definition] == 0} {
+ set location $expect_out(1,string)
+ exp_continue
+ } else {
+ # Exit this expect loop, with a result indicating failure.
+ set definition {}
+ }
+ }
+ -re "The symbol `${macro}' has no definition as a C/C\\+\\+ preprocessor macro\[^\r\n\]*\[\r\n\]" {
+ # `location' and `definition' should be empty when we see
+ # this message.
+ if {[llength $location] == 0 && [llength $definition] == 0} {
+ set definition undefined
+ exp_continue
+ } else {
+ # Exit this expect loop, with a result indicating failure.
+ set definition {}
+ }
+ }
+ -re "^\[\r\n\]* included at \[^\r\n\]*(${filepat}):${decimal}\[\r\n\]" {
+ # `location' should *not* be empty when we see this
+ # message. It should have recorded at least the initial
+ # `Defined at ' message (for definitions) or ` at' message
+ # (for undefined symbols).
+ if {[llength $location] != 0} {
+ lappend location $expect_out(1,string)
+ exp_continue
+ } else {
+ # Exit this expect loop, with a result indicating failure.
+ set definition {}
+ }
+ }
+ -re "^\[\r\n\]*at \[^\r\n\]*(${filepat}):${decimal}\[\r\n\]" {
+ # This appears after a `has no definition' message.
+ # `location' should be empty when we see it.
+ if {[string compare $definition undefined] == 0 \
+ && [llength $location] == 0} {
+ set location $expect_out(1,string)
+ exp_continue
+ } else {
+ # Exit this expect loop, with a result indicating failure.
+ set definition {}
+ }
+ }
+ -re "#define ${macro} (\[^\r\n\]*)\[\r\n\]" {
+ # `definition' should be empty when we see this message.
+ if {[string compare $definition ""] == 0} {
+ set definition $expect_out(1,string)
+ exp_continue
+ } else {
+ # Exit this expect loop, with a result indicating failure.
+ set definition {}
+ }
+ }
+ -re "has no preprocessor macro information.*$gdb_prompt $" {
+ set definition no-macro-info
+ }
+ -re "$gdb_prompt $" {
+ # Exit the expect loop; let the existing value of `definition'
+ # indicate failure or success.
+ }
+ timeout {
+ set definition timeout
+ }
+ }
+ if {$debug_me} {exp_internal 0}
+
+ switch -exact -- $definition {
+ no-macro-info { return no-macro-info }
+ timeout { return timeout }
+ undefined -
+ default {
+ if {[llength $location] >= 1} {
+ return [concat $location [list $definition]]
+ } else {
+ return {}
+ }
+ }
+ }
+}
+
+
+# Call info_macro to show the definition of MACRO. Expect a result of
+# EXPECTED. Use WHERE in pass/fail messages to identify the context.
+# Return non-zero if we should abort the entire test file, or zero if
+# we can continue.
+proc check_macro {macro expected where} {
+ set func_def [info_macro $macro]
+ if {[string compare $func_def $expected] == 0} {
+ pass "info macro $macro $where"
+ } else {
+ switch -exact -- $func_def {
+ no-macro-info {
+ xfail "executable includes no macro debugging information"
+ return 1
+ }
+ timeout {
+ fail "info macro $macro $where (timeout)"
+ }
+ default {
+ fail "info macro $macro $where"
+ }
+ }
+ }
+ return 0
+}
+
+
+# List the function FUNC, and then show the definition of MACRO,
+# expecting the result EXPECTED.
+proc list_and_check_macro {func macro expected} {
+ gdb_test "list $func" ".*${func}.*"
+ return [check_macro $macro $expected "after `list $func'"]
+}
+
+
+if {[list_and_check_macro main WHERE {macscp1.c {before macscp1_3}}]} {
+ return 0
+}
+list_and_check_macro macscp2_2 WHERE {macscp2.h macscp1.c {before macscp2_2}}
+list_and_check_macro macscp3_2 WHERE {macscp3.h macscp1.c {before macscp3_2}}
+
+
+# Although GDB's macro table structures distinguish between multiple
+# #inclusions of the same file, GDB's other structures don't. So the
+# `list' command here doesn't reliably select one #inclusion or the
+# other, even though it could. It would be nice to eventually change
+# GDB's structures to handle this correctly.
+gdb_test "list macscp4_2_from_macscp2" ".*macscp4_2_, MACSCP4_INCLUSION.*"
+switch -exact -- [info_macro WHERE] {
+ {macscp4.h macscp2.h macscp1.c {before macscp4_2_..., from macscp2.h}} {
+ pass "info macro WHERE after `list macscp_4_2_from_macscp2'"
+ }
+ {macscp4.h macscp3.h macscp1.c {before macscp4_2_..., from macscp3.h}} {
+ # setup_kfail "gdb/555"
+ fail "info macro WHERE after `list macscp_4_2_from_macscp2' (gdb/555)"
+ }
+ timeout {
+ fail "info macro WHERE after `list macscp_4_2_from_macscp2' (timeout)"
+ }
+ default { fail "info macro WHERE after `list macscp_4_2_from_macscp2'" }
+}
+
+gdb_test "list macscp4_2_from_macscp3" ".*macscp4_2_, MACSCP4_INCLUSION.*"
+switch -exact -- [info_macro WHERE] {
+ {macscp4.h macscp3.h macscp1.c {before macscp4_2_..., from macscp3.h}} {
+ pass "info macro WHERE after `list macscp_4_2_from_macscp3'"
+ }
+ {macscp4.h macscp2.h macscp1.c {before macscp4_2_..., from macscp2.h}} {
+ # setup_kfail "gdb/555"
+ fail "info macro WHERE after `list macscp_4_2_from_macscp3' (gdb/555)"
+ }
+ timeout {
+ fail "info macro WHERE after `list macscp_4_2_from_macscp3' (timeout)"
+ }
+ default { fail "info macro WHERE after `list macscp_4_2_from_macscp3'" }
+}
+
+
+#### Test the selection of the macro scope by the current frame.
+
+### A table of functions, in the order they will be reached, which is
+### also the order they appear in the preprocessed output. Each entry
+### has the form {FUNCNAME WHERE KFAILWHERE}, where:
+### - FUNCNAME is the name of the function,
+### - WHERE is the definition we expect to see for the macro `WHERE', as
+### returned by `info_macro', and
+### - KFAILWHERE is an alternate definition which should be reported
+### as a `known failure', due to GDB's inability to distinguish multiple
+### #inclusions of the same file.
+### KFAILWHERE may be omitted.
+
+set funcs {
+ {
+ macscp1_1
+ {macscp1.c {before macscp1_1}}
+ }
+ {
+ macscp2_1
+ {macscp2.h macscp1.c {before macscp2_1}}
+ }
+ {
+ macscp4_1_from_macscp2
+ {macscp4.h macscp2.h macscp1.c {before macscp4_1_..., from macscp2.h}}
+ {macscp4.h macscp3.h macscp1.c {before macscp4_1_..., from macscp3.h}}
+ }
+ {
+ macscp4_2_from_macscp2
+ {macscp4.h macscp2.h macscp1.c {before macscp4_2_..., from macscp2.h}}
+ {macscp4.h macscp3.h macscp1.c {before macscp4_2_..., from macscp3.h}}
+ }
+ {
+ macscp2_2
+ {macscp2.h macscp1.c {before macscp2_2}}
+ }
+ {
+ macscp1_2
+ {macscp1.c {before macscp1_2}}
+ }
+ {
+ macscp3_1
+ {macscp3.h macscp1.c {before macscp3_1}}
+ }
+ {
+ macscp4_1_from_macscp3
+ {macscp4.h macscp3.h macscp1.c {before macscp4_1_..., from macscp3.h}}
+ {macscp4.h macscp2.h macscp1.c {before macscp4_1_..., from macscp2.h}}
+ }
+ {
+ macscp4_2_from_macscp3
+ {macscp4.h macscp3.h macscp1.c {before macscp4_2_..., from macscp3.h}}
+ {macscp4.h macscp2.h macscp1.c {before macscp4_2_..., from macscp2.h}}
+ }
+ {
+ macscp3_2
+ {macscp3.h macscp1.c {before macscp3_2}}
+ }
+ {
+ macscp1_3
+ {macscp1.c {before macscp1_3}}
+ }
+}
+
+
+# Start the program running.
+if {! [runto_main]} {
+ fail "macro tests suppressed: couldn't run to main"
+ return 0
+}
+
+# Set a breakpoint on each of the functions.
+foreach func_entry $funcs {
+ set func [lindex $func_entry 0]
+ gdb_test "break $func" "Breakpoint.*"
+}
+
+# Run to each of the breakpoints and check the definition (or lack
+# thereof) of each macro.
+for {set i 0} {$i < [llength $funcs]} {incr i} {
+ set func_entry [lindex $funcs $i]
+ set func [lindex $func_entry 0]
+ set expected [lindex $func_entry 1]
+ set kfail_expected [lindex $func_entry 2]
+
+ # Run to the breakpoint for $func.
+ gdb_test "continue" "Breakpoint $decimal, $func .*" "continue to $func"
+
+ # Check the macro WHERE.
+ set result [info_macro WHERE]
+ if {[string compare $result $expected] == 0} {
+ pass "info macro WHERE stopped in $func"
+ } elseif {[string compare $result $kfail_expected] == 0} {
+ # setup_kfail "gdb/555"
+ fail "info macro WHERE stopped in $func (gdb/555)"
+ } elseif {[string compare $result timeout] == 0} {
+ fail "info macro WHERE stopped in $func (timeout)"
+ } else {
+ fail "info macro WHERE stopped in $func"
+ }
+
+ # Check that the BEFORE_<func> macros for all prior functions are
+ # #defined, and that those for all subsequent functions are not.
+ for {set j 0} {$j < [llength $funcs]} {incr j} {
+ if {$j != $i} {
+ set func_j_entry [lindex $funcs $j]
+ set func_j [lindex $func_j_entry 0]
+
+ set before_macro "BEFORE_[string toupper $func_j]"
+ set test_name \
+ "$before_macro defined/undefined when stopped at $func"
+ set result [info_macro $before_macro]
+
+ # We can't get the right scope info when we're stopped in
+ # the macro4_ functions.
+ if {[string match macscp4_* $func]} {
+ # setup_kfail "gdb/555"
+ set test_name "$test_name (gdb/555)"
+ }
+ if {$j < $i} {
+ if {[llength $result] >= 2 && \
+ [string compare [lindex $result end] {}] == 0} {
+ pass $test_name
+ } elseif {[string compare $result timeout] == 0} {
+ fail "$test_name (timeout)"
+ } else {
+ fail "$test_name"
+ }
+ } elseif {$j > $i} {
+ switch -- [lindex $result end] {
+ undefined { pass $test_name }
+ timeout { fail "$test_name (timeout)" }
+ default {
+ fail "$test_name"
+ }
+ }
+ }
+
+ set until_macro "UNTIL_[string toupper $func_j]"
+ set test_name \
+ "$until_macro defined/undefined when stopped at $func"
+ set result [info_macro $until_macro]
+
+ # We can't get the right scope info when we're stopped in
+ # the macro4_ functions.
+ if {[string match macscp4_* $func]} {
+ # setup_kfail "gdb/555"
+ set test_name "$test_name (gdb/555)"
+ }
+ if {$j <= $i} {
+ switch -- [lindex $result end] {
+ undefined { pass $test_name }
+ timeout { fail "$test_name (timeout)" }
+ default {
+ fail "$test_name"
+ }
+ }
+ } elseif {$j > $i} {
+ if {[llength $result] >= 2 && \
+ [string compare [lindex $result end] {}] == 0} {
+ pass $test_name
+ } elseif {[string compare $result timeout] == 0} {
+ fail "$test_name (timeout)"
+ } else {
+ fail "$test_name"
+ }
+ }
+ }
+ }
+}
diff --git a/gdb/testsuite/gdb.base/macscp1.c b/gdb/testsuite/gdb.base/macscp1.c
new file mode 100644
index 00000000000..89a1b07d1e6
--- /dev/null
+++ b/gdb/testsuite/gdb.base/macscp1.c
@@ -0,0 +1,80 @@
+#include <stdio.h>
+
+#define SPLICE(a, b) INNER_SPLICE(a, b)
+#define INNER_SPLICE(a, b) a ## b
+#define STRINGIFY(a) INNER_STRINGIFY(a)
+#define INNER_STRINGIFY(a) #a
+
+/* A macro named UNTIL_<func> is #defined until just before the
+ definition of the function <func>.
+
+ A macro named BEFORE_<func> is not #defined until just before the
+ definition of <func>.
+
+ The macro WHERE is redefined before each function <func> to the
+ token list ``before <func>''.
+
+ The macscp IN_MACSCP2_H and IN_MACSCP3_H are defined while
+ processing those header files; macscp4.h uses them to choose
+ appropriate function names, output strings, and macro definitions. */
+
+#define UNTIL_MACSCP1_1
+#define UNTIL_MACSCP2_1
+#define UNTIL_MACSCP4_1_FROM_MACSCP2
+#define UNTIL_MACSCP4_2_FROM_MACSCP2
+#define UNTIL_MACSCP2_2
+#define UNTIL_MACSCP1_2
+#define UNTIL_MACSCP3_1
+#define UNTIL_MACSCP4_1_FROM_MACSCP3
+#define UNTIL_MACSCP4_2_FROM_MACSCP3
+#define UNTIL_MACSCP3_2
+#define UNTIL_MACSCP1_3
+
+#define WHERE before macscp1_1
+#define BEFORE_MACSCP1_1
+#undef UNTIL_MACSCP1_1
+void
+macscp1_1 ()
+{
+ puts ("macscp1_1");
+}
+
+#include "macscp2.h"
+
+#undef WHERE
+#define WHERE before macscp1_2
+#define BEFORE_MACSCP1_2
+#undef UNTIL_MACSCP1_2
+void
+macscp1_2 ()
+{
+ puts ("macscp1_2");
+}
+
+#include "macscp3.h"
+
+#undef WHERE
+#define WHERE before macscp1_3
+#define BEFORE_MACSCP1_3
+#undef UNTIL_MACSCP1_3
+void
+macscp1_3 ()
+{
+ puts ("macscp1_3");
+}
+
+int
+main (int argc, char **argv)
+{
+ macscp1_1 ();
+ macscp2_1 ();
+ macscp4_1_from_macscp2 ();
+ macscp4_2_from_macscp2 ();
+ macscp2_2 ();
+ macscp1_2 ();
+ macscp3_1 ();
+ macscp4_1_from_macscp3 ();
+ macscp4_2_from_macscp3 ();
+ macscp3_2 ();
+ macscp1_3 ();
+}
diff --git a/gdb/testsuite/gdb.base/macscp2.h b/gdb/testsuite/gdb.base/macscp2.h
new file mode 100644
index 00000000000..ef0feaac5a5
--- /dev/null
+++ b/gdb/testsuite/gdb.base/macscp2.h
@@ -0,0 +1,25 @@
+#define IN_MACSCP2_H
+
+#undef WHERE
+#define WHERE before macscp2_1
+#define BEFORE_MACSCP2_1
+#undef UNTIL_MACSCP2_1
+void
+macscp2_1 ()
+{
+ puts ("macscp2_1");
+}
+
+#include "macscp4.h"
+
+#undef WHERE
+#define WHERE before macscp2_2
+#define BEFORE_MACSCP2_2
+#undef UNTIL_MACSCP2_2
+void
+macscp2_2 ()
+{
+ puts ("macscp2_2");
+}
+
+#undef IN_MACSCP2_H
diff --git a/gdb/testsuite/gdb.base/macscp3.h b/gdb/testsuite/gdb.base/macscp3.h
new file mode 100644
index 00000000000..ebfcc6e1930
--- /dev/null
+++ b/gdb/testsuite/gdb.base/macscp3.h
@@ -0,0 +1,25 @@
+#define IN_MACSCP3_H
+
+#undef WHERE
+#define WHERE before macscp3_1
+#define BEFORE_MACSCP3_1
+#undef UNTIL_MACSCP3_1
+void
+macscp3_1 ()
+{
+ puts ("macscp3_1");
+}
+
+#include "macscp4.h"
+
+#undef WHERE
+#define WHERE before macscp3_2
+#define BEFORE_MACSCP3_2
+#undef UNTIL_MACSCP3_2
+void
+macscp3_2 ()
+{
+ puts ("macscp3_2");
+}
+
+#undef IN_MACSCP3_H
diff --git a/gdb/testsuite/gdb.base/macscp4.h b/gdb/testsuite/gdb.base/macscp4.h
new file mode 100644
index 00000000000..5302d8d3c47
--- /dev/null
+++ b/gdb/testsuite/gdb.base/macscp4.h
@@ -0,0 +1,44 @@
+/* Put together a macro we can use as part of function names. */
+#undef MACSCP4_INCLUSION
+#ifdef IN_MACSCP2_H
+#define MACSCP4_INCLUSION from_macscp2
+#endif
+#ifdef IN_MACSCP3_H
+#define MACSCP4_INCLUSION from_macscp3
+#endif
+
+#undef WHERE
+#ifdef IN_MACSCP2_H
+#define WHERE before macscp4_1_..., from macscp2.h
+#define BEFORE_MACSCP4_1_FROM_MACSCP2
+#undef UNTIL_MACSCP4_1_FROM_MACSCP2
+#endif
+#ifdef IN_MACSCP3_H
+#define WHERE before macscp4_1_..., from macscp3.h
+#define BEFORE_MACSCP4_1_FROM_MACSCP3
+#undef UNTIL_MACSCP4_1_FROM_MACSCP3
+#endif
+void
+SPLICE (macscp4_1_, MACSCP4_INCLUSION) ()
+{
+ puts ("macscp4_1_" STRINGIFY(MACSCP4_INCLUSION));
+}
+
+#undef WHERE
+#ifdef IN_MACSCP2_H
+#define WHERE before macscp4_2_..., from macscp2.h
+#define BEFORE_MACSCP4_2_FROM_MACSCP2
+#undef UNTIL_MACSCP4_2_FROM_MACSCP2
+#endif
+#ifdef IN_MACSCP3_H
+#define WHERE before macscp4_2_..., from macscp3.h
+#define BEFORE_MACSCP4_2_FROM_MACSCP3
+#undef UNTIL_MACSCP4_2_FROM_MACSCP3
+#endif
+void
+SPLICE (macscp4_2_, MACSCP4_INCLUSION) ()
+{
+ puts ("macscp4_2_" STRINGIFY(MACSCP4_INCLUSION));
+}
+
+#define DEFINED_IN_MACSCP4 this was defined in macscp4.h.
diff --git a/gdb/testsuite/gdb.base/overlays.exp b/gdb/testsuite/gdb.base/overlays.exp
index 9188b278014..c31da4e5ad4 100644
--- a/gdb/testsuite/gdb.base/overlays.exp
+++ b/gdb/testsuite/gdb.base/overlays.exp
@@ -1,4 +1,4 @@
-# Copyright 1997, 1998 Free Software Foundation, Inc.
+# Copyright 1997, 1998, 2002 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
@@ -86,22 +86,42 @@ if ![runto_main] then {
}
# couple of convenience variables
-set fptrcast [string_to_regexp "(int (*)(int))"]
+set fptrcast [string_to_regexp "{int (int)}"]
set iptrcast [string_to_regexp "(int *)"]
+set hexx "0x\[0-9abcdefABCDEF\]+"
gdb_test "overlay manual" ""
gdb_test "overlay list" "No sections are mapped." "List with none mapped"
# capture the LMA addresses of [foo bar baz grbx foox barx bazx grbxx]
-gdb_test "print \$foo_lma = &foo" \
- ".* $fptrcast 0x.* <\\*foo\\*>" "foo load addr"
-gdb_test "print \$bar_lma = &bar" \
- ".* $fptrcast 0x.* <\\*bar\\*>" "bar load addr"
-gdb_test "print \$baz_lma = &baz" \
- ".* $fptrcast 0x.* <\\*baz\\*>" "baz load addr"
-gdb_test "print \$grbx_lma = &grbx" \
- ".* $fptrcast 0x.* <\\*grbx\\*>" "grbx load addr"
+proc get_func_address { func func_sym msg } {
+ global gdb_prompt
+ global fptrcast
+ global hexx
+
+ set func_addr 0
+ send_gdb "print $func\n"
+ gdb_expect {
+ -re "\\$\[0-9\]+ = $fptrcast (${hexx}) <$func_sym>.*$gdb_prompt $" {
+ set func_addr $expect_out(1,string)
+ pass "get $msg"
+ }
+ -re ".*$gdb_prompt $" {
+ fail "get $msg"
+ }
+ default {
+ fail "get $msg (timeout)"
+ }
+ }
+ return $func_addr
+}
+
+set foo_lma [get_func_address "foo" "\\*foo\\*" "foo load address"]
+set bar_lma [get_func_address "bar" "\\*bar\\*" "bar load address"]
+set baz_lma [get_func_address "baz" "\\*baz\\*" "baz load address"]
+set grbx_lma [get_func_address "grbx" "\\*grbx\\*" "grbx load address"]
+
gdb_test "print \$foox_lma = &foox" \
".* $iptrcast 0x.*" "foox load addr"
gdb_test "print \$barx_lma = &barx" \
@@ -116,23 +136,19 @@ gdb_test "print \$grbxx_lma = &grbxx" \
gdb_test "overlay map .ovly0" ""
gdb_test "overlay list" "Section .ovly0, loaded at.*, mapped at.*" "List ovly0"
-gdb_test "print \$foo_vma = &foo" \
- ".* $fptrcast 0x.* <foo>" "foo runtime addr"
+set foo_vma [get_func_address "foo" "foo" "foo runtime address"]
gdb_test "overlay map .ovly1" ""
gdb_test "overlay list" "Section .ovly1, loaded at.*, mapped at.*" "List ovly1"
-gdb_test "print \$bar_vma = &bar" \
- ".* $fptrcast 0x.* <bar>" "bar runtime addr"
+set bar_vma [get_func_address "bar" "bar" "bar runtime address"]
gdb_test "overlay map .ovly2" ""
gdb_test "overlay list" "Section .ovly2, loaded at.*, mapped at.*" "List ovly2"
-gdb_test "print \$baz_vma = &baz" \
- ".* $fptrcast 0x.* <baz>" "baz runtime addr"
+set baz_vma [get_func_address "baz" "baz" "baz runtime address"]
gdb_test "overlay map .ovly3" ""
gdb_test "overlay list" "Section .ovly3, loaded at.*, mapped at.*" "List ovly3"
-gdb_test "print \$grbx_vma = &grbx" \
- ".* $fptrcast 0x.* <grbx>" "grbx runtime addr"
+set grbx_vma [get_func_address "grbx" "grbx" "grbx runtime address"]
gdb_test "overlay map .data00" ""
gdb_test "overlay list" "Section .data00, loaded .*, mapped .*" "List data00"
@@ -156,10 +172,10 @@ gdb_test "print \$grbxx_vma = &grbxx" \
# Verify that LMA != VMA
-gdb_test "print \$foo_lma != \$foo_vma" ".* = 1" "foo's LMA != VMA"
-gdb_test "print \$bar_lma != \$bar_vma" ".* = 1" "bar's LMA != VMA"
-gdb_test "print \$baz_lma != \$baz_vma" ".* = 1" "baz's LMA != VMA"
-gdb_test "print \$grbx_lma != \$grbx_vma" ".* = 1" "grbx's LMA != VMA"
+gdb_test "print $foo_lma != $foo_vma" ".* = 1" "foo's LMA != VMA"
+gdb_test "print $bar_lma != $bar_vma" ".* = 1" "bar's LMA != VMA"
+gdb_test "print $baz_lma != $baz_vma" ".* = 1" "baz's LMA != VMA"
+gdb_test "print $grbx_lma != $grbx_vma" ".* = 1" "grbx's LMA != VMA"
gdb_test "print \$foox_lma != \$foox_vma" ".* = 1" "foox's LMA != VMA"
gdb_test "print \$barx_lma != \$barx_vma" ".* = 1" "barx's LMA != VMA"
gdb_test "print \$bazx_lma != \$bazx_vma" ".* = 1" "bazx's LMA != VMA"
diff --git a/gdb/testsuite/gdb.c++/inherit.exp b/gdb/testsuite/gdb.c++/inherit.exp
index e24b7f5885a..286c27b09f3 100644
--- a/gdb/testsuite/gdb.c++/inherit.exp
+++ b/gdb/testsuite/gdb.c++/inherit.exp
@@ -993,7 +993,7 @@ proc test_print_mvi_classes {} {
-re ".* = \{\<vD\> = \{\<vB\> = \{\<vA\> = \{va = 0, vx = 0\}, ${vbptr}vA = $hex, vb = 0, vx = 0\}, \<vC\> = \{${vbptr}vA = $hex, vc = 0, vx = 0\}, ${vbptr}vC = $hex, ${vbptr}vB = $hex, vd = 0, vx = 0\}, ${vbptr}vD = $hex, ve = 27, vx = 28\}$nl$gdb_prompt $" {
pass "print g_vE"
}
- -re ".* = \{\<vD\> = \{\<vB\> = \{\<vA\> = \{va = 0, vx = 0\}, _vptr.vB = $hex, vb = 0, vx = 0\}, \<vC\> = \{_vptr.vC = $hex, vc = 0, vx = 0\}, _vptr.vD = $hex, vd = 0, vx = 0\}, _vptr.vE = $hex, ve = 27, vx = 28\}$nl$gdb_prompt $" {
+ -re ".* = \{\<vD\> = \{\<vB\> = \{\<vA\> = \{va = 0, vx = 0\}, _vptr.vB = $hex *(\<VTT for vD\>)?, vb = 0, vx = 0\}, \<vC\> = \{_vptr.vC = $hex *(\<VTT for vD\>)?, vc = 0, vx = 0\}, _vptr.vD = $hex, vd = 0, vx = 0\}, _vptr.vE = $hex, ve = 27, vx = 28\}$nl$gdb_prompt $" {
pass "print g_vE (FIXME v3 vtbl ptr)"
}
-re ".*$gdb_prompt $" { fail "print g_vE" }
diff --git a/gdb/testsuite/gdb.c++/local.exp b/gdb/testsuite/gdb.c++/local.exp
index 091d643f0d4..3ec2d5ef8b5 100644
--- a/gdb/testsuite/gdb.c++/local.exp
+++ b/gdb/testsuite/gdb.c++/local.exp
@@ -124,12 +124,12 @@ gdb_expect {
# Pattern 1:
# PASS
# dwarf-2
-# 2.95.3, 2.96-rh, 3.0.4, gcc-3_1-branch, HEAD
+# 2.95.3, 2.96-rh, 3.0.4, 3.1, gcc-3_1-branch, HEAD
#
# Pattern 2:
# PASS
# stabs+
-# 2.95.3, 2.96-rh, 3.0.4, gcc-3_1-branch, HEAD
+# 2.95.3, 2.96-rh, 3.0.4, 3.1, gcc-3_1-branch, HEAD
#
# Pattern 3:
# Old hppa pattern.
@@ -137,12 +137,12 @@ gdb_expect {
# Pattern 4:
# Old hppa pattern.
#
-# chastain 2002-04-08
+# chastain 2002-05-27
send_gdb "ptype InnerLocal\n"
gdb_expect {
- -re "type = class InnerLocal \{\[\r\n\t \]*public:\[\r\n\t \]*char ilc;\[\r\n\t \]*int \\* *ip;\[\r\n\t \]*NestedInnerLocal nest1;\[\r\n\t \]*int il_foo\\((unsigned char const|const unsigned char) *&\\);\[\r\n\t \]*\}.*$gdb_prompt $" { pass "ptype InnerLocal" }
- -re "type = class InnerLocal \{\[\r\n\t \]*public:\[\r\n\t \]*char ilc;\[\r\n\t \]*int \\* *ip;\[\r\n\t \]*NestedInnerLocal nest1;\[\r\n\t \]*InnerLocal *& operator *=\\((main${sep}::|)InnerLocal const *&\\);\[\r\n\t \]*InnerLocal\\((main${sep}::|)InnerLocal const *&\\);\[\r\n\t \]*InnerLocal\\((void|)\\);\[\r\n\t \]*int il_foo\\(unsigned char const *&\\);\[\r\n\t \]*\}.*$gdb_prompt $" { pass "ptype InnerLocal" }
+ -re "type = class InnerLocal \{\[\r\n\t \]*public:\[\r\n\t \]*char ilc;\[\r\n\t \]*int \\* *ip;\[\r\n\t \]*(InnerLocal::|)NestedInnerLocal nest1;\[\r\n\t \]*int il_foo\\((unsigned char const|const unsigned char) *&\\);\[\r\n\t \]*\}.*$gdb_prompt $" { pass "ptype InnerLocal (pattern 1)" }
+ -re "type = class InnerLocal \{\[\r\n\t \]*public:\[\r\n\t \]*char ilc;\[\r\n\t \]*int \\* *ip;\[\r\n\t \]*(InnerLocal::|)NestedInnerLocal nest1;\[\r\n\t \]*InnerLocal *& operator *=\\((main${sep}::|)InnerLocal const *&\\);\[\r\n\t \]*InnerLocal\\((main${sep}::|)InnerLocal const *&\\);\[\r\n\t \]*InnerLocal\\((void|)\\);\[\r\n\t \]*int il_foo\\(unsigned char const *&\\);\[\r\n\t \]*\}.*$gdb_prompt $" { pass "ptype InnerLocal (pattern 2)" }
-re "type = class InnerLocal \{\r\n\[\t \]*public:\r\n\[\t \]*char ilc;\r\n\[\t \]*int \\*ip;\r\n\[\t \]*InnerLocal::NestedInnerLocal nest1;\r\n\r\n\[\t \]*.int il_foo\\(unsigned char const &\\);\r\n\[\t \]*\}\[\t \]*\\(Local at.*local\\.cc:36\\).*$gdb_prompt $" { pass "ptype InnerLocal (old HP aCC)" }
-re "type = class InnerLocal \{\r\n\[\t \]*public:\r\n\[\t \]*char ilc;\r\n\[\t \]*int \\*ip;\r\n\[\t \]*class InnerLocal4::NestedInnerLocal nest1;\r\n\r\n\[\t \]*int il_foo\\(unsigned char const &\\);\r\n\[\t \]*\\(Local at.*local\.cc:\[0-9\]+\\)\r\n\}.*$gdb_prompt $" { pass "ptype InnerLocal (old HP aCC)" }
-re ".*$gdb_prompt $" { fail "ptype InnerLocal" }
diff --git a/gdb/testsuite/gdb.c++/m-data.cc b/gdb/testsuite/gdb.c++/m-data.cc
new file mode 100644
index 00000000000..d9950274d7a
--- /dev/null
+++ b/gdb/testsuite/gdb.c++/m-data.cc
@@ -0,0 +1,53 @@
+// 2002-05-13
+
+namespace __gnu_test
+{
+ enum region { oriental, egyptian, greek, etruscan, roman };
+
+ // Test one.
+ class gnu_obj_1
+ {
+ protected:
+ typedef region antiquities;
+ const bool test;
+ const int key1;
+ long key2;
+
+ antiquities value;
+
+ public:
+ gnu_obj_1(antiquities a, long l): test(true), key1(5), key2(l), value(a) {}
+ };
+
+ // Test two.
+ template<typename T>
+ class gnu_obj_2: public virtual gnu_obj_1
+ {
+ protected:
+ antiquities value_derived;
+
+ public:
+ gnu_obj_2(antiquities b): gnu_obj_1(oriental, 7), value_derived(b) { }
+ };
+
+ // Test three.
+ template<typename T>
+ class gnu_obj_3
+ {
+ protected:
+ typedef region antiquities;
+ gnu_obj_2<int> data;
+
+ public:
+ gnu_obj_3(antiquities b): data(etruscan) { }
+ };
+}
+
+int main()
+{
+ using namespace __gnu_test;
+ gnu_obj_1 test1(egyptian, 4589);
+ gnu_obj_2<long> test2(roman);
+ gnu_obj_3<long> test3(greek);
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.c++/m-data.exp b/gdb/testsuite/gdb.c++/m-data.exp
new file mode 100644
index 00000000000..ac6825870da
--- /dev/null
+++ b/gdb/testsuite/gdb.c++/m-data.exp
@@ -0,0 +1,112 @@
+# Copyright 2002 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.
+
+# Tests for member data
+# 2002-05-13 Benjamin Kosnik <bkoz@redhat.com>
+
+# This file is part of the gdb testsuite
+
+if $tracelevel then {
+ strace $tracelevel
+ }
+
+if { [skip_cplus_tests] } { continue }
+
+#
+# test running programs
+#
+set prms_id 0
+set bug_id 0
+
+set testfile "m-data"
+set srcfile ${testfile}.cc
+set binfile ${objdir}/${subdir}/${testfile}
+
+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."
+}
+
+if [get_compiler_info ${binfile} "c++"] {
+ return -1
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+
+if ![runto_main] then {
+ perror "couldn't run to breakpoint"
+ continue
+}
+
+# One.
+gdb_test "break 50" "Breakpoint \[0-9\]*.*line 50\\."
+gdb_test "continue" "Continuing\\.\r\n\r\nBreakpoint.*at.*m-data\\.cc:50\r\n.*" "continue to 50"
+
+# simple object, const bool
+gdb_test "print test1.test" "\\$\[0-9\]* = true" "simple object, const bool"
+
+# simple object, const int
+gdb_test "print test1.key1" "\\$\[0-9\]* = 5" "simple object, const int"
+
+# simple object, long
+gdb_test "print test1.key2" "\\$\[0-9\]* = 4589" "simple object, long"
+
+# simple object, enum
+gdb_test "print test1.value" "\\$\[0-9\]* = egyptian" "simple object, enum"
+
+# Two.
+gdb_test "break 51" "Breakpoint \[0-9\]*.*line 51\\."
+gdb_test "continue" "Continuing\\.\r\n\r\nBreakpoint.*at.*m-data\\.cc:51\r\n.*" "continue to 51"
+
+# derived template object, base const bool
+gdb_test "print test2.test" "\\$\[0-9\]* = true" "derived template object, base const bool"
+
+# derived template object, base const int
+gdb_test "print test2.key1" "\\$\[0-9\]* = 5" "derived template object, base const int"
+
+# derived template object, base long
+gdb_test "print test2.key2" "\\$\[0-9\]* = 7" "derived template object, base long"
+
+# derived template object, base enum
+gdb_test "print test2.value" "\\$\[0-9\]* = oriental" "derived template object, base enum"
+
+# derived template object, enum
+gdb_test "print test2.value_derived" "\\$\[0-9\]* = roman" "derived template object, derived enum"
+
+# Three.
+gdb_test "break 52" "Breakpoint \[0-9\]*.*line 52\\."
+gdb_test "continue" "Continuing\\.\r\n\r\nBreakpoint.*at.*m-data\\.cc:52\r\n.*" "continue to 52"
+
+# template object, derived template data member's base const bool
+gdb_test "print test3.data.test" "\\$\[0-9\]* = true" "template object, const bool"
+
+# template object, derived template data member's base const int
+gdb_test "print test3.data.key1" "\\$\[0-9\]* = 5" "template object, const int"
+
+# template object, derived template data member's base long
+gdb_test "print test3.data.key2" "\\$\[0-9\]* = 7" "template object, long"
+
+# template object, derived template data member's base enum
+gdb_test "print test3.data.value" "\\$\[0-9\]* = oriental" "template object, base enum"
+
+# template object, derived template data member's enum
+gdb_test "print test3.data.value_derived" "\\$\[0-9]\* = etruscan" "template object, derived enum"
+
+gdb_exit
+return 0
diff --git a/gdb/testsuite/gdb.c++/m-static.cc b/gdb/testsuite/gdb.c++/m-static.cc
new file mode 100644
index 00000000000..24338014365
--- /dev/null
+++ b/gdb/testsuite/gdb.c++/m-static.cc
@@ -0,0 +1,72 @@
+// 2002-05-13
+
+namespace __gnu_test
+{
+ enum region { oriental, egyptian, greek, etruscan, roman };
+
+ // Test one.
+ class gnu_obj_1
+ {
+ protected:
+ typedef region antiquities;
+ static const bool test = true;
+ static const int key1 = 5;
+ static long key2;
+
+ static antiquities value;
+
+ public:
+ gnu_obj_1(antiquities a, long l) {}
+ };
+
+ const bool gnu_obj_1::test;
+ const int gnu_obj_1::key1;
+ long gnu_obj_1::key2 = 77;
+ gnu_obj_1::antiquities gnu_obj_1::value = oriental;
+
+
+ // Test two.
+ template<typename T>
+ class gnu_obj_2: public virtual gnu_obj_1
+ {
+ public:
+ static antiquities value_derived;
+
+ public:
+ gnu_obj_2(antiquities b): gnu_obj_1(oriental, 7) { }
+ };
+
+ template<typename T>
+ typename gnu_obj_2<T>::antiquities gnu_obj_2<T>::value_derived = etruscan;
+
+ // Test three.
+ template<typename T>
+ class gnu_obj_3
+ {
+ public:
+ typedef region antiquities;
+ static gnu_obj_2<int> data;
+
+ public:
+ gnu_obj_3(antiquities b) { }
+ };
+
+ template<typename T>
+ gnu_obj_2<int> gnu_obj_3<T>::data(etruscan);
+}
+
+// instantiate templates explicitly so their static members will exist
+template class __gnu_test::gnu_obj_2<int>;
+template class __gnu_test::gnu_obj_2<long>;
+template class __gnu_test::gnu_obj_3<long>;
+
+int main()
+{
+ using namespace __gnu_test;
+
+ gnu_obj_1 test1(egyptian, 4589);
+ gnu_obj_2<long> test2(roman);
+ gnu_obj_3<long> test3(greek);
+
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.c++/m-static.exp b/gdb/testsuite/gdb.c++/m-static.exp
new file mode 100644
index 00000000000..c05983b6538
--- /dev/null
+++ b/gdb/testsuite/gdb.c++/m-static.exp
@@ -0,0 +1,112 @@
+# Copyright 2002 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.
+
+# Tests for member static data
+# 2002-05-13 Benjamin Kosnik <bkoz@redhat.com>
+
+# This file is part of the gdb testsuite
+
+if $tracelevel then {
+ strace $tracelevel
+ }
+
+if { [skip_cplus_tests] } { continue }
+
+#
+# test running programs
+#
+set prms_id 0
+set bug_id 0
+
+set testfile "m-static"
+set srcfile ${testfile}.cc
+set binfile ${objdir}/${subdir}/${testfile}
+
+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."
+}
+
+if [get_compiler_info ${binfile} "c++"] {
+ return -1
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+
+if ![runto_main] then {
+ perror "couldn't run to breakpoint"
+ continue
+}
+
+# One.
+gdb_test "break 68" "Breakpoint \[0-9\]*.*line 68\\."
+gdb_test "continue" "Continuing\\.\r\n\r\nBreakpoint.*at.*m-static\\.cc:68\r\n.*" "continue to 68"
+
+# simple object, static const bool
+gdb_test "print test1.test" "\\$\[0-9\]* = true" "simple object, static const bool"
+
+# simple object, static const int
+gdb_test "print test1.key1" "\\$\[0-9\]* = 5" "simple object, static const int"
+
+# simple object, static long
+gdb_test "print test1.key2" "\\$\[0-9\]* = 77" "simple object, static long"
+
+# simple object, static enum
+gdb_test "print test1.value" "\\$\[0-9\]* = oriental" "simple object, static enum"
+
+# Two.
+gdb_test "break 69" "Breakpoint \[0-9\]*.*line 69\\."
+gdb_test "continue" "Continuing\\.\r\n\r\nBreakpoint.*at.*m-static\\.cc:69\r\n.*" "continue to 69"
+
+# derived template object, base static const bool
+gdb_test "print test2.test" "\\$\[0-9\]* = true" "derived template object, base static const bool"
+
+# derived template object, base static const int
+gdb_test "print test2.key1" "\\$\[0-9\]* = 5" "derived template object, base static const int"
+
+# derived template object, base static long
+gdb_test "print test2.key2" "\\$\[0-9\]* = 77" "derived template object, base static long"
+
+# derived template object, base static enum
+gdb_test "print test2.value" "\\$\[0-9\].* = oriental" "derived template object, base static enum"
+
+# derived template object, static enum
+gdb_test "print test2.value_derived" "\\$\[0-9\].* = etruscan" "derived template object, static enum"
+
+# Three.
+gdb_test "break 71" "Breakpoint \[0-9\]*.*line 71\\."
+gdb_test "continue" "Continuing\\.\r\n\r\nBreakpoint.*at.*m-static\\.cc:71\r\n.*" "continue to 71"
+
+# template object, static derived template data member's base static const bool
+gdb_test "print test3.data.test" "\\$\[0-9\].* = true" "template object, static const bool"
+
+# template object, static derived template data member's base static const int
+gdb_test "print test3.data.key1" "\\$\[0-9\].* = 5" "template object, static const int"
+
+# template object, static derived template data member's base static long
+gdb_test "print test3.data.key2" "\\$\[0-9\].* = 77" "template object, static long"
+
+# template object, static derived template data member's base static enum
+gdb_test "print test3.data.value" "\\$\[0-9\].* = oriental" "template object, static enum"
+
+# template object, static derived template data member's static enum
+gdb_test "print test3.data.value_derived" "\\$\[0-9\].* = etruscan" "template object, static derived enum"
+
+gdb_exit
+return 0
diff --git a/gdb/testsuite/gdb.c++/try_catch.cc b/gdb/testsuite/gdb.c++/try_catch.cc
new file mode 100644
index 00000000000..9a9c737b55d
--- /dev/null
+++ b/gdb/testsuite/gdb.c++/try_catch.cc
@@ -0,0 +1,126 @@
+// 2002-05-27
+
+#include <exception>
+#include <stdexcept>
+#include <string>
+
+namespace __gnu_test
+{
+ enum region { oriental, egyptian, greek, etruscan, roman };
+
+ // Test one.
+ class gnu_obj_1
+ {
+ public:
+ typedef region antiquities;
+ const bool test;
+ const int key1;
+ long key2;
+
+ antiquities value;
+
+ gnu_obj_1(antiquities a, long l): test(true), key1(5), key2(l), value(a) {}
+ };
+
+ // Test two.
+ template<typename T>
+ class gnu_obj_2: public virtual gnu_obj_1
+ {
+ public:
+ antiquities value_derived;
+
+ gnu_obj_2(antiquities b): gnu_obj_1(oriental, 7), value_derived(b) { }
+ };
+
+ // Test three.
+ template<typename T>
+ class gnu_obj_3
+ {
+ public:
+ typedef region antiquities;
+ gnu_obj_2<int> data;
+
+ gnu_obj_3(antiquities b): data(etruscan) { }
+ };
+}
+
+int main()
+{
+ using namespace __gnu_test;
+
+ bool test = true;
+ const int i = 5;
+ int j = i;
+ gnu_obj_2<long> test2(roman);
+ gnu_obj_3<long> test3(greek);
+
+ // 1
+ try
+ {
+ ++j;
+ throw gnu_obj_1(egyptian, 4589);
+ }
+ catch (gnu_obj_1& obj)
+ {
+ ++j;
+ if (obj.value != egyptian)
+ test &= false;
+ if (obj.key2 != 4589)
+ test &= false;
+ }
+ catch (...)
+ {
+ j = 0;
+ test &= false;
+ }
+
+ // 2
+ try
+ {
+ ++j;
+ try
+ {
+ ++j;
+ try
+ {
+ ++j;
+ throw gnu_obj_1(egyptian, 4589);
+ }
+ catch (gnu_obj_1& obj)
+ {
+ ++j;
+ if (obj.value != egyptian)
+ test &= false;
+ if (obj.key2 != 4589)
+ test &= false;
+ }
+ }
+ catch (gnu_obj_1& obj)
+ {
+ ++j;
+ if (obj.value != egyptian)
+ test &= false;
+ if (obj.key2 != 4589)
+ test &= false;
+ }
+ }
+ catch (...)
+ {
+ j = 0;
+ test &= false;
+ }
+
+ // 3 use standard library
+ using namespace std;
+ try
+ {
+ if (j < 100)
+ throw invalid_argument("gdb.1");
+ }
+ catch (exception& obj)
+ {
+ if (obj.what() != "gdb.1")
+ test &= false;
+ }
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.c++/try_catch.exp b/gdb/testsuite/gdb.c++/try_catch.exp
new file mode 100644
index 00000000000..e024132b99e
--- /dev/null
+++ b/gdb/testsuite/gdb.c++/try_catch.exp
@@ -0,0 +1,84 @@
+# Copyright 2002 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.
+
+# Tests for member data
+# 2002-05-27 Benjamin Kosnik <bkoz@redhat.com>
+
+# This file is part of the gdb testsuite
+
+if $tracelevel then {
+ strace $tracelevel
+ }
+
+if { [skip_cplus_tests] } { continue }
+
+#
+# test running programs
+#
+set prms_id 0
+set bug_id 0
+
+set testfile "try_catch"
+set srcfile ${testfile}.cc
+set binfile ${objdir}/${subdir}/${testfile}
+
+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."
+}
+
+if [get_compiler_info ${binfile} "c++"] {
+ return -1
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+
+if ![runto_main] then {
+ perror "couldn't run to breakpoint"
+ continue
+}
+
+# One.
+
+gdb_test "break 61" "Breakpoint \[0-9\]*.*line 61\\."
+gdb_test "continue" "Continuing\\.\r\n\r\nBreakpoint.*at.*try_catch\\.cc:61\r\n.*" "continue to 61"
+
+gdb_test "break 66" "Breakpoint \[0-9\]*.*line 66\\."
+gdb_test "continue" "Continuing\\.\r\n\r\nBreakpoint.*at.*try_catch\\.cc:66\r\n.*" "continue to 66"
+
+gdb_test "break 80" "Breakpoint \[0-9\]*.*line 80\\."
+gdb_test "continue" "Continuing\\.\r\n\r\nBreakpoint.*at.*try_catch\\.cc:80\r\n.*" "continue to 80"
+
+gdb_test "break 83" "Breakpoint \[0-9\]*.*line 83\\."
+gdb_test "continue" "Continuing\\.\r\n\r\nBreakpoint.*at.*try_catch\\.cc:83\r\n.*" "continue to 83"
+
+gdb_test "break 87" "Breakpoint \[0-9\]*.*line 87\\."
+gdb_test "continue" "Continuing\\.\r\n\r\nBreakpoint.*at.*try_catch\\.cc:87\r\n.*" "continue to 87"
+
+gdb_test "break 92" "Breakpoint \[0-9\]*.*line 92\\."
+gdb_test "continue" "Continuing\\.\r\n\r\nBreakpoint.*at.*try_catch\\.cc:92\r\n.*" "continue to 92"
+
+gdb_test "break 118" "Breakpoint \[0-9\]*.*line 118\\."
+gdb_test "continue" "Continuing\\.\r\n\r\nBreakpoint.*at.*try_catch\\.cc:118\r\n.*" "continue to 118"
+
+gdb_test "break 122" "Breakpoint \[0-9\]*.*line 122\\."
+gdb_test "continue" "Continuing\\.\r\n\r\nBreakpoint.*at.*try_catch\\.cc:122\r\n.*" "continue to 122"
+
+gdb_exit
+return 0
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index c41ed725473..8d666f936ef 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -1119,8 +1119,7 @@ proc gdb_wrapper_init { args } {
if { $gdb_wrapper_initialized == 1 } { return; }
if {[target_info exists needs_status_wrapper] && \
- [target_info needs_status_wrapper] != "0" && \
- ![info exists gdb_wrapper_file]} {
+ [target_info needs_status_wrapper] != "0"} {
set result [build_wrapper "testglue.o"];
if { $result != "" } {
set gdb_wrapper_file [lindex $result 0];
@@ -1390,8 +1389,14 @@ proc gdb_continue { function } {
}
proc default_gdb_init { args } {
+ global gdb_wrapper_initialized
+
gdb_clear_suppressed;
+ # Make sure that the wrapper is rebuilt
+ # with the appropriate multilib option.
+ set gdb_wrapper_initialized 0
+
# Uh, this is lame. Really, really, really lame. But there's this *one*
# testcase that will fail in random places if we don't increase this.
match_max -d 20000
@@ -1435,7 +1440,7 @@ proc get_debug_format { } {
set debug_format "unknown"
send_gdb "info source\n"
gdb_expect 10 {
- -re "Compiled with (.*) debugging format.\r\n$gdb_prompt $" {
+ -re "Compiled with (.*) debugging format.\r\n.*$gdb_prompt $" {
set debug_format $expect_out(1,string)
verbose "debug format is $debug_format"
return 1;
diff --git a/gdb/v850-tdep.c b/gdb/v850-tdep.c
index 534e9565066..dc3bc6ba9e0 100644
--- a/gdb/v850-tdep.c
+++ b/gdb/v850-tdep.c
@@ -1,5 +1,5 @@
/* Target-dependent code for the NEC V850 for GDB, the GNU debugger.
- Copyright 1996, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright 1996, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of GDB.
@@ -30,9 +30,118 @@
#include "symfile.h"
#include "arch-utils.h"
#include "regcache.h"
+#include "symtab.h"
+struct gdbarch_tdep
+{
+ /* gdbarch target dependent data here. Currently unused for v850. */
+};
+
+/* Extra info which is saved in each frame_info. */
+struct frame_extra_info
+{
+};
+
+enum {
+ E_R0_REGNUM,
+ E_R1_REGNUM,
+ E_R2_REGNUM, E_SAVE1_START_REGNUM = E_R2_REGNUM, E_SAVE1_END_REGNUM = E_R2_REGNUM,
+ E_R3_REGNUM, E_SP_REGNUM = E_R3_REGNUM,
+ E_R4_REGNUM,
+ E_R5_REGNUM,
+ E_R6_REGNUM, E_ARG0_REGNUM = E_R6_REGNUM,
+ E_R7_REGNUM,
+ E_R8_REGNUM,
+ E_R9_REGNUM, E_ARGLAST_REGNUM = E_R9_REGNUM,
+ E_R10_REGNUM, E_V0_REGNUM = E_R10_REGNUM,
+ E_R11_REGNUM, E_V1_REGNUM = E_R11_REGNUM,
+ E_R12_REGNUM,
+ E_R13_REGNUM,
+ E_R14_REGNUM,
+ E_R15_REGNUM,
+ E_R16_REGNUM,
+ E_R17_REGNUM,
+ E_R18_REGNUM,
+ E_R19_REGNUM,
+ E_R20_REGNUM, E_SAVE2_START_REGNUM = E_R20_REGNUM,
+ E_R21_REGNUM,
+ E_R22_REGNUM,
+ E_R23_REGNUM,
+ E_R24_REGNUM,
+ E_R25_REGNUM,
+ E_R26_REGNUM,
+ E_R27_REGNUM,
+ E_R28_REGNUM,
+ E_R29_REGNUM, E_SAVE2_END_REGNUM = E_R29_REGNUM, E_FP_RAW_REGNUM = E_R29_REGNUM,
+ E_R30_REGNUM, E_EP_REGNUM = E_R30_REGNUM,
+ E_R31_REGNUM, E_SAVE3_START_REGNUM = E_R31_REGNUM, E_SAVE3_END_REGNUM = E_R31_REGNUM, E_RP_REGNUM = E_R31_REGNUM,
+ E_R32_REGNUM, E_SR0_REGNUM = E_R32_REGNUM,
+ E_R33_REGNUM,
+ E_R34_REGNUM,
+ E_R35_REGNUM,
+ E_R36_REGNUM,
+ E_R37_REGNUM, E_PS_REGNUM = E_R37_REGNUM,
+ E_R38_REGNUM,
+ E_R39_REGNUM,
+ E_R40_REGNUM,
+ E_R41_REGNUM,
+ E_R42_REGNUM,
+ E_R43_REGNUM,
+ E_R44_REGNUM,
+ E_R45_REGNUM,
+ E_R46_REGNUM,
+ E_R47_REGNUM,
+ E_R48_REGNUM,
+ E_R49_REGNUM,
+ E_R50_REGNUM,
+ E_R51_REGNUM,
+ E_R52_REGNUM, E_CTBP_REGNUM = E_R52_REGNUM,
+ E_R53_REGNUM,
+ E_R54_REGNUM,
+ E_R55_REGNUM,
+ E_R56_REGNUM,
+ E_R57_REGNUM,
+ E_R58_REGNUM,
+ E_R59_REGNUM,
+ E_R60_REGNUM,
+ E_R61_REGNUM,
+ E_R62_REGNUM,
+ E_R63_REGNUM,
+ E_R64_REGNUM, E_PC_REGNUM = E_R64_REGNUM,
+ E_R65_REGNUM, E_FP_REGNUM = E_R65_REGNUM,
+ E_NUM_REGS
+};
+
+enum
+{
+ v850_reg_size = 4
+};
+
+/* Size of all registers as a whole. */
+enum
+{
+ E_ALL_REGS_SIZE = (E_NUM_REGS) * v850_reg_size
+};
+
+/* Size of return datatype which fits into all return registers. */
+enum
+{
+ E_MAX_RETTYPE_SIZE_IN_REGS = 2 * v850_reg_size
+};
-static char *v850_generic_reg_names[] = REGISTER_NAMES;
+static LONGEST call_dummy_nil[] = {0};
+
+static char *v850_generic_reg_names[] =
+{ "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
+ "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
+ "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
+ "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31",
+ "eipc", "eipsw", "fepc", "fepsw", "ecr", "psw", "sr6", "sr7",
+ "sr8", "sr9", "sr10", "sr11", "sr12", "sr13", "sr14", "sr15",
+ "sr16", "sr17", "sr18", "sr19", "sr20", "sr21", "sr22", "sr23",
+ "sr24", "sr25", "sr26", "sr27", "sr28", "sr29", "sr30", "sr31",
+ "pc", "fp"
+};
static char *v850e_reg_names[] =
{
@@ -93,12 +202,160 @@ struct prologue_info
static CORE_ADDR v850_scan_prologue (CORE_ADDR pc, struct prologue_info *fs);
+/* Function: v850_register_name
+ Returns the name of the v850/v850e register N. */
+
+static char *
+v850_register_name (int regnum)
+{
+ if (regnum < 0 || regnum >= E_NUM_REGS)
+ internal_error (__FILE__, __LINE__,
+ "v850_register_name: illegal register number %d",
+ regnum);
+ else
+ return v850_register_names[regnum];
+
+}
+
+/* Function: v850_register_byte
+ Returns the byte position in the register cache for register N. */
+
+static int
+v850_register_byte (int regnum)
+{
+ if (regnum < 0 || regnum >= E_NUM_REGS)
+ internal_error (__FILE__, __LINE__,
+ "v850_register_byte: illegal register number %d",
+ regnum);
+ else
+ return regnum * v850_reg_size;
+}
+
+/* Function: v850_register_raw_size
+ Returns the number of bytes occupied by the register on the target. */
+
+static int
+v850_register_raw_size (int regnum)
+{
+ if (regnum < 0 || regnum >= E_NUM_REGS)
+ internal_error (__FILE__, __LINE__,
+ "v850_register_raw_size: illegal register number %d",
+ regnum);
+ /* Only the PC has 4 Byte, all other registers 2 Byte. */
+ else
+ return v850_reg_size;
+}
+
+/* Function: v850_register_virtual_size
+ Returns the number of bytes occupied by the register as represented
+ internally by gdb. */
+
+static int
+v850_register_virtual_size (int regnum)
+{
+ return v850_register_raw_size (regnum);
+}
+
+/* Function: v850_reg_virtual_type
+ Returns the default type for register N. */
+
+static struct type *
+v850_reg_virtual_type (int regnum)
+{
+ if (regnum < 0 || regnum >= E_NUM_REGS)
+ internal_error (__FILE__, __LINE__,
+ "v850_register_virtual_type: illegal register number %d",
+ regnum);
+ else if (regnum == E_PC_REGNUM)
+ return builtin_type_uint32;
+ else
+ return builtin_type_int32;
+}
+
+static int
+v850_type_is_scalar (struct type *t)
+{
+ return (TYPE_CODE (t) != TYPE_CODE_STRUCT
+ && TYPE_CODE (t) != TYPE_CODE_UNION
+ && TYPE_CODE (t) != TYPE_CODE_ARRAY);
+}
/* Should call_function allocate stack space for a struct return? */
-int
+static int
v850_use_struct_convention (int gcc_p, struct type *type)
{
- return (TYPE_NFIELDS (type) > 1 || TYPE_LENGTH (type) > 4);
+ /* According to ABI:
+ * return TYPE_LENGTH (type) > 8);
+ */
+
+ /* Current implementation in gcc: */
+
+ int i;
+ struct type *fld_type, *tgt_type;
+
+ /* 1. The value is greater than 8 bytes -> returned by copying */
+ if (TYPE_LENGTH (type) > 8)
+ return 1;
+
+ /* 2. The value is a single basic type -> returned in register */
+ if (v850_type_is_scalar (type))
+ return 0;
+
+ /* The value is a structure or union with a single element
+ * and that element is either a single basic type or an array of
+ * a single basic type whoes size is greater than or equal to 4
+ * -> returned in register */
+ if ((TYPE_CODE (type) == TYPE_CODE_STRUCT
+ || TYPE_CODE (type) == TYPE_CODE_UNION)
+ && TYPE_NFIELDS (type) == 1)
+ {
+ fld_type = TYPE_FIELD_TYPE (type, 0);
+ if (v850_type_is_scalar (fld_type) && TYPE_LENGTH (fld_type) >= 4)
+ return 0;
+
+ if (TYPE_CODE (fld_type) == TYPE_CODE_ARRAY)
+ {
+ tgt_type = TYPE_TARGET_TYPE (fld_type);
+ if (v850_type_is_scalar (tgt_type) && TYPE_LENGTH (tgt_type) >= 4)
+ return 0;
+ }
+ }
+
+ /* The value is a structure whose first element is an integer or
+ * a float, and which contains no arrays of more than two elements
+ * -> returned in register */
+ if (TYPE_CODE (type) == TYPE_CODE_STRUCT
+ && v850_type_is_scalar (TYPE_FIELD_TYPE (type, 0))
+ && TYPE_LENGTH (TYPE_FIELD_TYPE (type, 0)) == 4)
+ {
+ for (i = 1; i < TYPE_NFIELDS (type); ++i)
+ {
+ fld_type = TYPE_FIELD_TYPE (type, 0);
+ if (TYPE_CODE (fld_type) == TYPE_CODE_ARRAY)
+ {
+ tgt_type = TYPE_TARGET_TYPE (fld_type);
+ if (TYPE_LENGTH (fld_type) >= 0 && TYPE_LENGTH (tgt_type) >= 0
+ && TYPE_LENGTH (fld_type) / TYPE_LENGTH (tgt_type) > 2)
+ return 1;
+ }
+ }
+ return 0;
+ }
+
+ /* The value is a union which contains at least one field which
+ * would be returned in registers according to these rules
+ * -> returned in register */
+ if (TYPE_CODE (type) == TYPE_CODE_UNION)
+ {
+ for (i = 0; i < TYPE_NFIELDS (type); ++i)
+ {
+ fld_type = TYPE_FIELD_TYPE (type, 0);
+ if (!v850_use_struct_convention (0, fld_type))
+ return 0;
+ }
+ }
+
+ return 1;
}
@@ -150,7 +407,7 @@ handle_prepare (int insn, int insn2, CORE_ADDR * current_pc_ptr,
it to the immediate value used to adjust SP. */
for (i = 0; reg_table[i].mask != 0; i++)
if (list12 & reg_table[i].mask)
- offset += REGISTER_RAW_SIZE (regtable[i].regno);
+ offset += v850_register_raw_size (reg_table[i].regno);
pi->frameoffset -= offset;
/* Calculate the offsets of the registers relative to the value
@@ -163,7 +420,7 @@ handle_prepare (int insn, int insn2, CORE_ADDR * current_pc_ptr,
if (list12 & reg_table[i].mask)
{
int reg = reg_table[i].regno;
- offset -= REGISTER_RAW_SIZE (reg);
+ offset -= v850_register_raw_size (reg);
pifsr->reg = reg;
pifsr->offset = offset;
pifsr->cur_frameoffset = pi->frameoffset;
@@ -197,7 +454,7 @@ handle_pushm (int insn, int insn2, struct prologue_info *pi,
long offset = 0;
static struct reg_list pushml_reg_table[] =
{
- {0x80000, PS_REGNUM}, /* PSW */
+ {0x80000, E_PS_REGNUM}, /* PSW */
{0x40000, 1}, /* r1 */
{0x20000, 2}, /* r2 */
{0x10000, 3}, /* r3 */
@@ -248,7 +505,7 @@ handle_pushm (int insn, int insn2, struct prologue_info *pi,
it to the immediate value used to adjust SP. */
for (i = 0; reg_table[i].mask != 0; i++)
if (list12 & reg_table[i].mask)
- offset += REGISTER_RAW_SIZE (regtable[i].regno);
+ offset += v850_register_raw_size (reg_table[i].regno);
pi->frameoffset -= offset;
/* Calculate the offsets of the registers relative to the value
@@ -261,7 +518,7 @@ handle_pushm (int insn, int insn2, struct prologue_info *pi,
if (list12 & reg_table[i].mask)
{
int reg = reg_table[i].regno;
- offset -= REGISTER_RAW_SIZE (reg);
+ offset -= v850_register_raw_size (reg);
pifsr->reg = reg;
pifsr->offset = offset;
pifsr->cur_frameoffset = pi->frameoffset;
@@ -285,12 +542,12 @@ handle_pushm (int insn, int insn2, struct prologue_info *pi,
/* Function: scan_prologue
Scan the prologue of the function that contains PC, and record what
- we find in PI. PI->fsr must be zeroed by the called. Returns the
- pc after the prologue. Note that the addresses saved in pi->fsr
- are actually just frame relative (negative offsets from the frame
- pointer). This is because we don't know the actual value of the
- frame pointer yet. In some circumstances, the frame pointer can't
- be determined till after we have scanned the prologue. */
+ we find in PI. Returns the pc after the prologue. Note that the
+ addresses saved in frame->saved_regs are just frame relative (negative
+ offsets from the frame pointer). This is because we don't know the
+ actual value of the frame pointer yet. In some circumstances, the
+ frame pointer can't be determined till after we have scanned the
+ prologue. */
static CORE_ADDR
v850_scan_prologue (CORE_ADDR pc, struct prologue_info *pi)
@@ -340,7 +597,7 @@ v850_scan_prologue (CORE_ADDR pc, struct prologue_info *pi)
registers. */
pi->frameoffset = 0;
- pi->framereg = SP_REGNUM;
+ pi->framereg = E_SP_REGNUM;
fp_used = 0;
ep_used = 0;
pifsr = pi->pifsrs;
@@ -397,7 +654,7 @@ v850_scan_prologue (CORE_ADDR pc, struct prologue_info *pi)
}
else if ((insn & 0xffc0) == 0x0200 && !regsave_func_p)
{ /* callt <imm6> */
- long ctbp = read_register (CTBP_REGNUM);
+ long ctbp = read_register (E_CTBP_REGNUM);
long adr = ctbp + ((insn & 0x3f) << 1);
save_pc = current_pc;
@@ -455,33 +712,33 @@ v850_scan_prologue (CORE_ADDR pc, struct prologue_info *pi)
break; /* Ran into end of prologue */
}
- else if ((insn & 0xffe0) == ((SP_REGNUM << 11) | 0x0240)) /* add <imm>,sp */
+ else if ((insn & 0xffe0) == ((E_SP_REGNUM << 11) | 0x0240)) /* add <imm>,sp */
pi->frameoffset += ((insn & 0x1f) ^ 0x10) - 0x10;
- else if (insn == ((SP_REGNUM << 11) | 0x0600 | SP_REGNUM)) /* addi <imm>,sp,sp */
+ else if (insn == ((E_SP_REGNUM << 11) | 0x0600 | E_SP_REGNUM)) /* addi <imm>,sp,sp */
pi->frameoffset += insn2;
- else if (insn == ((FP_RAW_REGNUM << 11) | 0x0000 | SP_REGNUM)) /* mov sp,fp */
+ else if (insn == ((E_FP_RAW_REGNUM << 11) | 0x0000 | E_SP_REGNUM)) /* mov sp,fp */
{
fp_used = 1;
- pi->framereg = FP_RAW_REGNUM;
+ pi->framereg = E_FP_RAW_REGNUM;
}
- else if (insn == ((R12_REGNUM << 11) | 0x0640 | R0_REGNUM)) /* movhi hi(const),r0,r12 */
+ else if (insn == ((E_R12_REGNUM << 11) | 0x0640 | E_R0_REGNUM)) /* movhi hi(const),r0,r12 */
r12_tmp = insn2 << 16;
- else if (insn == ((R12_REGNUM << 11) | 0x0620 | R12_REGNUM)) /* movea lo(const),r12,r12 */
+ else if (insn == ((E_R12_REGNUM << 11) | 0x0620 | E_R12_REGNUM)) /* movea lo(const),r12,r12 */
r12_tmp += insn2;
- else if (insn == ((SP_REGNUM << 11) | 0x01c0 | R12_REGNUM) && r12_tmp) /* add r12,sp */
+ else if (insn == ((E_SP_REGNUM << 11) | 0x01c0 | E_R12_REGNUM) && r12_tmp) /* add r12,sp */
pi->frameoffset = r12_tmp;
- else if (insn == ((EP_REGNUM << 11) | 0x0000 | SP_REGNUM)) /* mov sp,ep */
+ else if (insn == ((E_EP_REGNUM << 11) | 0x0000 | E_SP_REGNUM)) /* mov sp,ep */
ep_used = 1;
- else if (insn == ((EP_REGNUM << 11) | 0x0000 | R1_REGNUM)) /* mov r1,ep */
+ else if (insn == ((E_EP_REGNUM << 11) | 0x0000 | E_R1_REGNUM)) /* mov r1,ep */
ep_used = 0;
- else if (((insn & 0x07ff) == (0x0760 | SP_REGNUM) /* st.w <reg>,<offset>[sp] */
+ else if (((insn & 0x07ff) == (0x0760 | E_SP_REGNUM) /* st.w <reg>,<offset>[sp] */
|| (fp_used
- && (insn & 0x07ff) == (0x0760 | FP_RAW_REGNUM))) /* st.w <reg>,<offset>[fp] */
+ && (insn & 0x07ff) == (0x0760 | E_FP_RAW_REGNUM))) /* st.w <reg>,<offset>[fp] */
&& pifsr
- && (((reg = (insn >> 11) & 0x1f) >= SAVE1_START_REGNUM && reg <= SAVE1_END_REGNUM)
- || (reg >= SAVE2_START_REGNUM && reg <= SAVE2_END_REGNUM)
- || (reg >= SAVE3_START_REGNUM && reg <= SAVE3_END_REGNUM)))
+ && (((reg = (insn >> 11) & 0x1f) >= E_SAVE1_START_REGNUM && reg <= E_SAVE1_END_REGNUM)
+ || (reg >= E_SAVE2_START_REGNUM && reg <= E_SAVE2_END_REGNUM)
+ || (reg >= E_SAVE3_START_REGNUM && reg <= E_SAVE3_END_REGNUM)))
{
pifsr->reg = reg;
pifsr->offset = insn2 & ~1;
@@ -495,9 +752,9 @@ v850_scan_prologue (CORE_ADDR pc, struct prologue_info *pi)
else if (ep_used /* sst.w <reg>,<offset>[ep] */
&& ((insn & 0x0781) == 0x0501)
&& pifsr
- && (((reg = (insn >> 11) & 0x1f) >= SAVE1_START_REGNUM && reg <= SAVE1_END_REGNUM)
- || (reg >= SAVE2_START_REGNUM && reg <= SAVE2_END_REGNUM)
- || (reg >= SAVE3_START_REGNUM && reg <= SAVE3_END_REGNUM)))
+ && (((reg = (insn >> 11) & 0x1f) >= E_SAVE1_START_REGNUM && reg <= E_SAVE1_END_REGNUM)
+ || (reg >= E_SAVE2_START_REGNUM && reg <= E_SAVE2_END_REGNUM)
+ || (reg >= E_SAVE3_START_REGNUM && reg <= E_SAVE3_END_REGNUM)))
{
pifsr->reg = reg;
pifsr->offset = (insn & 0x007e) << 1;
@@ -536,49 +793,25 @@ v850_scan_prologue (CORE_ADDR pc, struct prologue_info *pi)
return current_pc;
}
-/* Function: init_extra_frame_info
- Setup the frame's frame pointer, pc, and frame addresses for saved
- registers. Most of the work is done in scan_prologue().
-
- Note that when we are called for the last frame (currently active frame),
- that fi->pc and fi->frame will already be setup. However, fi->frame will
- be valid only if this routine uses FP. For previous frames, fi-frame will
- always be correct (since that is derived from v850_frame_chain ()).
-
- We can be called with the PC in the call dummy under two circumstances.
- First, during normal backtracing, second, while figuring out the frame
- pointer just prior to calling the target function (see run_stack_dummy). */
+/* Function: find_callers_reg
+ Find REGNUM on the stack. Otherwise, it's in an active register.
+ One thing we might want to do here is to check REGNUM against the
+ clobber mask, and somehow flag it as invalid if it isn't saved on
+ the stack somewhere. This would provide a graceful failure mode
+ when trying to get the value of caller-saves registers for an inner
+ frame. */
-void
-v850_init_extra_frame_info (struct frame_info *fi)
+CORE_ADDR
+v850_find_callers_reg (struct frame_info *fi, int regnum)
{
- struct prologue_info pi;
- struct pifsr pifsrs[NUM_REGS + 1], *pifsr;
-
- if (fi->next)
- fi->pc = FRAME_SAVED_PC (fi->next);
-
- memset (fi->fsr.regs, '\000', sizeof fi->fsr.regs);
-
- /* The call dummy doesn't save any registers on the stack, so we can return
- now. */
- if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame))
- return;
-
- pi.pifsrs = pifsrs;
-
- v850_scan_prologue (fi->pc, &pi);
-
- if (!fi->next && pi.framereg == SP_REGNUM)
- fi->frame = read_register (pi.framereg) - pi.frameoffset;
-
- for (pifsr = pifsrs; pifsr->framereg; pifsr++)
- {
- fi->fsr.regs[pifsr->reg] = pifsr->offset + fi->frame;
+ for (; fi; fi = fi->next)
+ if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame))
+ return generic_read_register_dummy (fi->pc, fi->frame, regnum);
+ else if (fi->saved_regs[regnum] != 0)
+ return read_memory_unsigned_integer (fi->saved_regs[regnum],
+ v850_register_raw_size (regnum));
- if (pifsr->framereg == SP_REGNUM)
- fi->fsr.regs[pifsr->reg] += pi.frameoffset;
- }
+ return read_register (regnum);
}
/* Function: frame_chain
@@ -597,7 +830,7 @@ v850_frame_chain (struct frame_info *fi)
/* First, find out who called us */
callers_pc = FRAME_SAVED_PC (fi);
/* If caller is a call-dummy, then our FP bears no relation to his FP! */
- fp = v850_find_callers_reg (fi, FP_RAW_REGNUM);
+ fp = v850_find_callers_reg (fi, E_FP_RAW_REGNUM);
if (PC_IN_CALL_DUMMY (callers_pc, fp, fp))
return fp; /* caller is call-dummy: return oldest value of FP */
@@ -610,33 +843,12 @@ v850_frame_chain (struct frame_info *fi)
if (pi.start_function)
return 0; /* Don't chain beyond the start function */
- if (pi.framereg == FP_RAW_REGNUM)
+ if (pi.framereg == E_FP_RAW_REGNUM)
return v850_find_callers_reg (fi, pi.framereg);
return fi->frame - pi.frameoffset;
}
-/* Function: find_callers_reg
- Find REGNUM on the stack. Otherwise, it's in an active register.
- One thing we might want to do here is to check REGNUM against the
- clobber mask, and somehow flag it as invalid if it isn't saved on
- the stack somewhere. This would provide a graceful failure mode
- when trying to get the value of caller-saves registers for an inner
- frame. */
-
-CORE_ADDR
-v850_find_callers_reg (struct frame_info *fi, int regnum)
-{
- for (; fi; fi = fi->next)
- if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame))
- return generic_read_register_dummy (fi->pc, fi->frame, regnum);
- else if (fi->fsr.regs[regnum] != 0)
- return read_memory_unsigned_integer (fi->fsr.regs[regnum],
- REGISTER_RAW_SIZE (regnum));
-
- return read_register (regnum);
-}
-
/* Function: skip_prologue
Return the address of the first code past the prologue of the function. */
@@ -671,23 +883,24 @@ v850_skip_prologue (CORE_ADDR pc)
command, or the call dummy breakpoint gets hit. */
void
-v850_pop_frame (struct frame_info *frame)
+v850_pop_frame (void)
{
+ struct frame_info *frame = get_current_frame ();
int regnum;
if (PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame))
generic_pop_dummy_frame ();
else
{
- write_register (PC_REGNUM, FRAME_SAVED_PC (frame));
+ write_register (E_PC_REGNUM, FRAME_SAVED_PC (frame));
- for (regnum = 0; regnum < NUM_REGS; regnum++)
- if (frame->fsr.regs[regnum] != 0)
+ for (regnum = 0; regnum < E_NUM_REGS; regnum++)
+ if (frame->saved_regs[regnum] != 0)
write_register (regnum,
- read_memory_unsigned_integer (frame->fsr.regs[regnum],
- REGISTER_RAW_SIZE (regnum)));
+ read_memory_unsigned_integer (frame->saved_regs[regnum],
+ v850_register_raw_size (regnum)));
- write_register (SP_REGNUM, FRAME_FP (frame));
+ write_register (E_SP_REGNUM, FRAME_FP (frame));
}
flush_cached_frames ();
@@ -706,7 +919,7 @@ v850_pop_frame (struct frame_info *frame)
CORE_ADDR
v850_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
- unsigned char struct_return, CORE_ADDR struct_addr)
+ int struct_return, CORE_ADDR struct_addr)
{
int argreg;
int argnum;
@@ -716,22 +929,22 @@ v850_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
/* First, just for safety, make sure stack is aligned */
sp &= ~3;
+ /* The offset onto the stack at which we will start copying parameters
+ (after the registers are used up) begins at 16 rather than at zero.
+ I don't really know why, that's just the way it seems to work. */
+ stack_offset = 16;
+
/* Now make space on the stack for the args. */
for (argnum = 0; argnum < nargs; argnum++)
len += ((TYPE_LENGTH (VALUE_TYPE (args[argnum])) + 3) & ~3);
- sp -= len; /* possibly over-allocating, but it works... */
+ sp -= len + stack_offset; /* possibly over-allocating, but it works... */
/* (you might think we could allocate 16 bytes */
/* less, but the ABI seems to use it all! ) */
- argreg = ARG0_REGNUM;
+ argreg = E_ARG0_REGNUM;
/* the struct_return pointer occupies the first parameter-passing reg */
if (struct_return)
- write_register (argreg++, struct_addr);
-
- stack_offset = 16;
- /* The offset onto the stack at which we will start copying parameters
- (after the registers are used up) begins at 16 rather than at zero.
- I don't really know why, that's just the way it seems to work. */
+ argreg++;
/* Now load as many as possible of the first arguments into
registers, and push the rest onto the stack. There are 16 bytes
@@ -740,10 +953,10 @@ v850_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
{
int len;
char *val;
- char valbuf[REGISTER_RAW_SIZE (ARG0_REGNUM)];
+ char valbuf[v850_register_raw_size (E_ARG0_REGNUM)];
- if (TYPE_CODE (VALUE_TYPE (*args)) == TYPE_CODE_STRUCT
- && TYPE_LENGTH (VALUE_TYPE (*args)) > 8)
+ if (!v850_type_is_scalar (VALUE_TYPE (*args))
+ && TYPE_LENGTH (VALUE_TYPE (*args)) > E_MAX_RETTYPE_SIZE_IN_REGS)
{
store_address (valbuf, 4, VALUE_ADDRESS (*args));
len = 4;
@@ -756,15 +969,15 @@ v850_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
}
while (len > 0)
- if (argreg <= ARGLAST_REGNUM)
+ if (argreg <= E_ARGLAST_REGNUM)
{
CORE_ADDR regval;
- regval = extract_address (val, REGISTER_RAW_SIZE (argreg));
+ regval = extract_address (val, v850_register_raw_size (argreg));
write_register (argreg, regval);
- len -= REGISTER_RAW_SIZE (argreg);
- val += REGISTER_RAW_SIZE (argreg);
+ len -= v850_register_raw_size (argreg);
+ val += v850_register_raw_size (argreg);
argreg++;
}
else
@@ -787,12 +1000,12 @@ v850_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
CORE_ADDR
v850_push_return_address (CORE_ADDR pc, CORE_ADDR sp)
{
- write_register (RP_REGNUM, CALL_DUMMY_ADDRESS ());
+ write_register (E_RP_REGNUM, CALL_DUMMY_ADDRESS ());
return sp;
}
/* Function: frame_saved_pc
- Find the caller of this frame. We do this by seeing if RP_REGNUM
+ Find the caller of this frame. We do this by seeing if E_RP_REGNUM
is saved in the stack anywhere, otherwise we get it from the
registers. If the inner frame is a dummy frame, return its PC
instead of RP, because that's where "caller" of the dummy-frame
@@ -802,9 +1015,9 @@ CORE_ADDR
v850_frame_saved_pc (struct frame_info *fi)
{
if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame))
- return generic_read_register_dummy (fi->pc, fi->frame, PC_REGNUM);
+ return generic_read_register_dummy (fi->pc, fi->frame, E_PC_REGNUM);
else
- return v850_find_callers_reg (fi, RP_REGNUM);
+ return v850_find_callers_reg (fi, E_RP_REGNUM);
}
@@ -815,7 +1028,7 @@ v850_frame_saved_pc (struct frame_info *fi)
trap
*/
-int
+void
v850_fix_call_dummy (char *dummy, CORE_ADDR sp, CORE_ADDR fun, int nargs,
struct value **args, struct type *type, int gcc_p)
{
@@ -827,36 +1040,271 @@ v850_fix_call_dummy (char *dummy, CORE_ADDR sp, CORE_ADDR fun, int nargs,
store_unsigned_integer ((unsigned int *) &dummy[2], 2, offset24 & 0xffff);
store_unsigned_integer ((unsigned int *) &dummy[0], 2, offset24 >> 16);
- return 0;
}
-/* Change the register names based on the current machine type. */
+static CORE_ADDR
+v850_saved_pc_after_call (struct frame_info *ignore)
+{
+ return read_register (E_RP_REGNUM);
+}
-static int
-v850_target_architecture_hook (const bfd_arch_info_type *ap)
+static void
+v850_extract_return_value (struct type *type, char *regbuf, char *valbuf)
+{
+ CORE_ADDR return_buffer;
+
+ if (!v850_use_struct_convention (0, type))
+ {
+ /* Scalar return values of <= 8 bytes are returned in
+ E_V0_REGNUM to E_V1_REGNUM. */
+ memcpy (valbuf,
+ &regbuf[REGISTER_BYTE (E_V0_REGNUM)],
+ TYPE_LENGTH (type));
+ }
+ else
+ {
+ /* Aggregates and return values > 8 bytes are returned in memory,
+ pointed to by R6. */
+ return_buffer =
+ extract_address (regbuf + REGISTER_BYTE (E_V0_REGNUM),
+ REGISTER_RAW_SIZE (E_V0_REGNUM));
+
+ read_memory (return_buffer, valbuf, TYPE_LENGTH (type));
+ }
+}
+
+const static unsigned char *
+v850_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr)
{
- int i, j;
+ static unsigned char breakpoint[] = { 0x85, 0x05 };
+ *lenptr = sizeof (breakpoint);
+ return breakpoint;
+}
+
+static CORE_ADDR
+v850_extract_struct_value_address (char *regbuf)
+{
+ return extract_address (regbuf + v850_register_byte (E_V0_REGNUM),
+ v850_register_raw_size (E_V0_REGNUM));
+}
+
+static void
+v850_store_return_value (struct type *type, char *valbuf)
+{
+ CORE_ADDR return_buffer;
- if (ap->arch != bfd_arch_v850)
+ if (!v850_use_struct_convention (0, type))
+ write_register_bytes (REGISTER_BYTE (E_V0_REGNUM), valbuf,
+ TYPE_LENGTH (type));
+ else
+ {
+ return_buffer = read_register (E_V0_REGNUM);
+ write_memory (return_buffer, valbuf, TYPE_LENGTH (type));
+ }
+}
+
+static void
+v850_frame_init_saved_regs (struct frame_info *fi)
+{
+ struct prologue_info pi;
+ struct pifsr pifsrs[E_NUM_REGS + 1], *pifsr;
+ CORE_ADDR func_addr, func_end;
+
+ if (!fi->saved_regs)
+ {
+ frame_saved_regs_zalloc (fi);
+
+ /* The call dummy doesn't save any registers on the stack, so we
+ can return now. */
+ if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame))
+ return;
+
+ /* Find the beginning of this function, so we can analyze its
+ prologue. */
+ if (find_pc_partial_function (fi->pc, NULL, &func_addr, &func_end))
+ {
+ pi.pifsrs = pifsrs;
+
+ v850_scan_prologue (fi->pc, &pi);
+
+ if (!fi->next && pi.framereg == E_SP_REGNUM)
+ fi->frame = read_register (pi.framereg) - pi.frameoffset;
+
+ for (pifsr = pifsrs; pifsr->framereg; pifsr++)
+ {
+ fi->saved_regs[pifsr->reg] = pifsr->offset + fi->frame;
+
+ if (pifsr->framereg == E_SP_REGNUM)
+ fi->saved_regs[pifsr->reg] += pi.frameoffset;
+ }
+ }
+ /* Else we're out of luck (can't debug completely stripped code).
+ FIXME. */
+ }
+}
+
+/* Function: init_extra_frame_info
+ Setup the frame's frame pointer, pc, and frame addresses for saved
+ registers. Most of the work is done in scan_prologue().
+
+ Note that when we are called for the last frame (currently active frame),
+ that fi->pc and fi->frame will already be setup. However, fi->frame will
+ be valid only if this routine uses FP. For previous frames, fi-frame will
+ always be correct (since that is derived from v850_frame_chain ()).
+
+ We can be called with the PC in the call dummy under two circumstances.
+ First, during normal backtracing, second, while figuring out the frame
+ pointer just prior to calling the target function (see run_stack_dummy). */
+
+static void
+v850_init_extra_frame_info (int fromleaf, struct frame_info *fi)
+{
+ struct prologue_info pi;
+
+ if (fi->next)
+ fi->pc = FRAME_SAVED_PC (fi->next);
+
+ v850_frame_init_saved_regs (fi);
+}
+
+static void
+v850_store_struct_return (CORE_ADDR addr, CORE_ADDR sp)
+{
+ write_register (E_ARG0_REGNUM, addr);
+}
+
+static CORE_ADDR
+v850_target_read_fp (void)
+{
+ return read_register (E_FP_RAW_REGNUM);
+}
+
+static struct gdbarch *
+v850_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
+{
+ static LONGEST call_dummy_words[1] = { 0 };
+ struct gdbarch_tdep *tdep = NULL;
+ struct gdbarch *gdbarch;
+ int i;
+
+ /* find a candidate among the list of pre-declared architectures. */
+ arches = gdbarch_list_lookup_by_info (arches, &info);
+ if (arches != NULL)
+ return (arches->gdbarch);
+
+#if 0
+ tdep = (struct gdbarch_tdep *) xmalloc (sizeof (struct gdbarch_tdep));
+#endif
+
+ /* Change the register names based on the current machine type. */
+ if (info.bfd_arch_info->arch != bfd_arch_v850)
return 0;
+ gdbarch = gdbarch_alloc (&info, 0);
+
for (i = 0; v850_processor_type_table[i].regnames != NULL; i++)
{
- if (v850_processor_type_table[i].mach == ap->mach)
+ if (v850_processor_type_table[i].mach == info.bfd_arch_info->mach)
{
v850_register_names = v850_processor_type_table[i].regnames;
- tm_print_insn_info.mach = ap->mach;
- return 1;
+ tm_print_insn_info.mach = info.bfd_arch_info->mach;
+ break;
}
}
- internal_error (__FILE__, __LINE__,
- "Architecture `%s' unrecognized", ap->printable_name);
+ /*
+ * Basic register fields and methods.
+ */
+ set_gdbarch_num_regs (gdbarch, E_NUM_REGS);
+ set_gdbarch_num_pseudo_regs (gdbarch, 0);
+ set_gdbarch_sp_regnum (gdbarch, E_SP_REGNUM);
+ set_gdbarch_fp_regnum (gdbarch, E_FP_REGNUM);
+ set_gdbarch_pc_regnum (gdbarch, E_PC_REGNUM);
+ set_gdbarch_register_name (gdbarch, v850_register_name);
+ set_gdbarch_register_size (gdbarch, v850_reg_size);
+ set_gdbarch_register_bytes (gdbarch, E_ALL_REGS_SIZE);
+ set_gdbarch_register_byte (gdbarch, v850_register_byte);
+ set_gdbarch_register_raw_size (gdbarch, v850_register_raw_size);
+ set_gdbarch_max_register_raw_size (gdbarch, v850_reg_size);
+ set_gdbarch_register_virtual_size (gdbarch, v850_register_raw_size);
+ set_gdbarch_max_register_virtual_size (gdbarch, v850_reg_size);
+ set_gdbarch_register_virtual_type (gdbarch, v850_reg_virtual_type);
+
+ set_gdbarch_read_fp (gdbarch, v850_target_read_fp);
+
+ /*
+ * Frame Info
+ */
+ set_gdbarch_init_extra_frame_info (gdbarch, v850_init_extra_frame_info);
+ set_gdbarch_frame_init_saved_regs (gdbarch, v850_frame_init_saved_regs);
+ set_gdbarch_frame_chain (gdbarch, v850_frame_chain);
+ set_gdbarch_get_saved_register (gdbarch, generic_get_saved_register);
+ set_gdbarch_saved_pc_after_call (gdbarch, v850_saved_pc_after_call);
+ set_gdbarch_frame_saved_pc (gdbarch, v850_frame_saved_pc);
+ set_gdbarch_skip_prologue (gdbarch, v850_skip_prologue);
+ set_gdbarch_frame_chain_valid (gdbarch, generic_file_frame_chain_valid);
+ set_gdbarch_frame_args_address (gdbarch, default_frame_address);
+ set_gdbarch_frame_locals_address (gdbarch, default_frame_address);
+
+ /*
+ * Miscelany
+ */
+ /* Stack grows up. */
+ set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
+ /* PC stops zero byte after a trap instruction
+ (which means: exactly on trap instruction). */
+ set_gdbarch_decr_pc_after_break (gdbarch, 0);
+ /* This value is almost never non-zero... */
+ set_gdbarch_function_start_offset (gdbarch, 0);
+ /* This value is almost never non-zero... */
+ set_gdbarch_frame_args_skip (gdbarch, 0);
+ /* OK to default this value to 'unknown'. */
+ set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown);
+ /* W/o prototype, coerce float args to double. */
+ set_gdbarch_coerce_float_to_double (gdbarch, standard_coerce_float_to_double);
+
+ /*
+ * Call Dummies
+ *
+ * These values and methods are used when gdb calls a target function. */
+ set_gdbarch_use_generic_dummy_frames (gdbarch, 1);
+ set_gdbarch_push_dummy_frame (gdbarch, generic_push_dummy_frame);
+ set_gdbarch_push_return_address (gdbarch, v850_push_return_address);
+ set_gdbarch_deprecated_extract_return_value (gdbarch, v850_extract_return_value);
+ set_gdbarch_push_arguments (gdbarch, v850_push_arguments);
+ set_gdbarch_pop_frame (gdbarch, v850_pop_frame);
+ set_gdbarch_store_struct_return (gdbarch, v850_store_struct_return);
+ set_gdbarch_store_return_value (gdbarch, v850_store_return_value);
+ set_gdbarch_deprecated_extract_struct_value_address (gdbarch, v850_extract_struct_value_address);
+ set_gdbarch_use_struct_convention (gdbarch, v850_use_struct_convention);
+ set_gdbarch_call_dummy_location (gdbarch, AT_ENTRY_POINT);
+ set_gdbarch_call_dummy_address (gdbarch, entry_point_address);
+ set_gdbarch_call_dummy_start_offset (gdbarch, 0);
+ set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0);
+ set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1);
+ set_gdbarch_call_dummy_length (gdbarch, 0);
+ set_gdbarch_pc_in_call_dummy (gdbarch, generic_pc_in_call_dummy);
+ set_gdbarch_call_dummy_p (gdbarch, 1);
+ set_gdbarch_call_dummy_words (gdbarch, call_dummy_nil);
+ set_gdbarch_sizeof_call_dummy_words (gdbarch, 0);
+ set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0);
+ /* set_gdbarch_call_dummy_stack_adjust */
+ set_gdbarch_fix_call_dummy (gdbarch, v850_fix_call_dummy);
+ set_gdbarch_breakpoint_from_pc (gdbarch, v850_breakpoint_from_pc);
+
+ set_gdbarch_int_bit (gdbarch, 4 * TARGET_CHAR_BIT);
+ set_gdbarch_ptr_bit (gdbarch, 4 * TARGET_CHAR_BIT);
+ set_gdbarch_addr_bit (gdbarch, 4 * TARGET_CHAR_BIT);
+ set_gdbarch_long_double_bit (gdbarch, 8 * TARGET_CHAR_BIT);
+
+ set_gdbarch_extra_stack_alignment_needed (gdbarch, 0);
+
+ return gdbarch;
}
void
_initialize_v850_tdep (void)
{
tm_print_insn = print_insn_v850;
- target_architecture_hook = v850_target_architecture_hook;
+ register_gdbarch_init (bfd_arch_v850, v850_gdbarch_init);
}
diff --git a/gdb/valops.c b/gdb/valops.c
index 5e51d1dd066..691c1c4461f 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -45,7 +45,8 @@ extern int hp_som_som_object_present;
extern int overload_debug;
/* Local functions. */
-static int typecmp (int staticp, struct type *t1[], struct value *t2[]);
+static int typecmp (int staticp, int varargs, int nargs,
+ struct field t1[], struct value *t2[]);
static CORE_ADDR find_function_addr (struct value *, struct type **);
static struct value *value_arg_coerce (struct value *, struct type *, int);
@@ -1438,42 +1439,25 @@ hand_function_call (struct value *function, int nargs, struct value **args)
sp = old_sp; /* It really is used, for some ifdef's... */
#endif
- if (TYPE_CODE (ftype) == TYPE_CODE_METHOD)
- {
- i = 0;
- while (TYPE_CODE (TYPE_ARG_TYPES (ftype)[i]) != TYPE_CODE_VOID)
- i++;
- n_method_args = i;
- if (nargs < i)
- error ("too few arguments in method call");
- }
- else if (nargs < TYPE_NFIELDS (ftype))
+ if (nargs < TYPE_NFIELDS (ftype))
error ("too few arguments in function call");
for (i = nargs - 1; i >= 0; i--)
{
- /* Assume that methods are always prototyped, unless they are off the
- end (which we should only be allowing if there is a ``...'').
- FIXME. */
- if (TYPE_CODE (ftype) == TYPE_CODE_METHOD)
- {
- if (i < n_method_args)
- args[i] = value_arg_coerce (args[i], TYPE_ARG_TYPES (ftype)[i], 1);
- else
- args[i] = value_arg_coerce (args[i], NULL, 0);
- }
+ int prototyped;
- /* If we're off the end of the known arguments, do the standard
- promotions. FIXME: if we had a prototype, this should only
- be allowed if ... were present. */
- if (i >= TYPE_NFIELDS (ftype))
- args[i] = value_arg_coerce (args[i], NULL, 0);
+ /* FIXME drow/2002-05-31: Should just always mark methods as
+ prototyped. Can we respect TYPE_VARARGS? Probably not. */
+ if (TYPE_CODE (ftype) == TYPE_CODE_METHOD)
+ prototyped = 1;
+ else
+ prototyped = TYPE_PROTOTYPED (ftype);
+ if (i < TYPE_NFIELDS (ftype))
+ args[i] = value_arg_coerce (args[i], TYPE_FIELD_TYPE (ftype, i),
+ prototyped);
else
- {
- param_type = TYPE_FIELD_TYPE (ftype, i);
- args[i] = value_arg_coerce (args[i], param_type, TYPE_PROTOTYPED (ftype));
- }
+ args[i] = value_arg_coerce (args[i], NULL, 0);
/*elz: this code is to handle the case in which the function to be called
has a pointer to function as parameter and the corresponding actual argument
@@ -1485,7 +1469,7 @@ hand_function_call (struct value *function, int nargs, struct value **args)
In cc this is not a problem. */
if (using_gcc == 0)
- if (param_type)
+ if (param_type && TYPE_CODE (ftype) != TYPE_CODE_METHOD)
/* if this parameter is a pointer to function */
if (TYPE_CODE (param_type) == TYPE_CODE_PTR)
if (TYPE_CODE (TYPE_TARGET_TYPE (param_type)) == TYPE_CODE_FUNC)
@@ -1938,13 +1922,14 @@ value_bitstring (char *ptr, int len)
}
/* See if we can pass arguments in T2 to a function which takes arguments
- of types T1. Both t1 and t2 are NULL-terminated vectors. If some
- arguments need coercion of some sort, then the coerced values are written
- into T2. Return value is 0 if the arguments could be matched, or the
- position at which they differ if not.
+ of types T1. T1 is a list of NARGS arguments, and T2 is a NULL-terminated
+ vector. If some arguments need coercion of some sort, then the coerced
+ values are written into T2. Return value is 0 if the arguments could be
+ matched, or the position at which they differ if not.
STATICP is nonzero if the T1 argument list came from a
- static member function.
+ static member function. T2 will still include the ``this'' pointer,
+ but it will be skipped.
For non-static member functions, we ignore the first argument,
which is the type of the instance variable. This is because we want
@@ -1953,30 +1938,30 @@ value_bitstring (char *ptr, int len)
requested operation is type secure, shouldn't we? FIXME. */
static int
-typecmp (int staticp, struct type *t1[], struct value *t2[])
+typecmp (int staticp, int varargs, int nargs,
+ struct field t1[], struct value *t2[])
{
int i;
if (t2 == 0)
- return 1;
- if (staticp && t1 == 0)
- return t2[1] != 0;
- if (t1 == 0)
- return 1;
- if (t1[!staticp] == 0)
- return 0;
- if (TYPE_CODE (t1[0]) == TYPE_CODE_VOID)
- return 0;
+ internal_error (__FILE__, __LINE__, "typecmp: no argument list");
+
/* Skip ``this'' argument if applicable. T2 will always include THIS. */
if (staticp)
- t2++;
- for (i = !staticp; t1[i] && TYPE_CODE (t1[i]) != TYPE_CODE_VOID; i++)
+ t2 ++;
+
+ for (i = 0;
+ (i < nargs) && TYPE_CODE (t1[i].type) != TYPE_CODE_VOID;
+ i++)
{
struct type *tt1, *tt2;
+
if (!t2[i])
return i + 1;
- tt1 = check_typedef (t1[i]);
+
+ tt1 = check_typedef (t1[i].type);
tt2 = check_typedef (VALUE_TYPE (t2[i]));
+
if (TYPE_CODE (tt1) == TYPE_CODE_REF
/* We should be doing hairy argument matching, as below. */
&& (TYPE_CODE (check_typedef (TYPE_TARGET_TYPE (tt1))) == TYPE_CODE (tt2)))
@@ -2012,12 +1997,12 @@ typecmp (int staticp, struct type *t1[], struct value *t2[])
/* We should be doing much hairier argument matching (see section 13.2
of the ARM), but as a quick kludge, just check for the same type
code. */
- if (TYPE_CODE (t1[i]) != TYPE_CODE (VALUE_TYPE (t2[i])))
+ if (TYPE_CODE (t1[i].type) != TYPE_CODE (VALUE_TYPE (t2[i])))
return i + 1;
}
- if (!t1[i])
+ if (varargs || t2[i] == NULL)
return 0;
- return t2[i] ? i + 1 : 0;
+ return i + 1;
}
/* Helper function used by value_struct_elt to recurse through baseclasses.
@@ -2303,6 +2288,8 @@ search_struct_method (char *name, struct value **arg1p,
if (TYPE_FN_FIELD_STUB (f, j))
check_stub_method (type, i, j);
if (!typecmp (TYPE_FN_FIELD_STATIC_P (f, j),
+ TYPE_VARARGS (TYPE_FN_FIELD_TYPE (f, j)),
+ TYPE_NFIELDS (TYPE_FN_FIELD_TYPE (f, j)),
TYPE_FN_FIELD_ARGS (f, j), args))
{
if (TYPE_FN_FIELD_VIRTUAL_P (f, j))
@@ -2754,13 +2741,7 @@ find_overload_match (struct type **arg_types, int nargs, char *name, int method,
{
if (TYPE_FN_FIELD_STATIC_P (fns_ptr, ix))
static_offset = 1;
- nparms=0;
-
- if (TYPE_FN_FIELD_ARGS(fns_ptr,ix))
- {
- while (TYPE_CODE(TYPE_FN_FIELD_ARGS(fns_ptr,ix)[nparms]) != TYPE_CODE_VOID)
- nparms++;
- }
+ nparms = TYPE_NFIELDS (TYPE_FN_FIELD_TYPE (fns_ptr, ix));
}
else
{
@@ -2772,7 +2753,7 @@ find_overload_match (struct type **arg_types, int nargs, char *name, int method,
parm_types = (struct type **) xmalloc (nparms * (sizeof (struct type *)));
for (jj = 0; jj < nparms; jj++)
parm_types[jj] = (method
- ? (TYPE_FN_FIELD_ARGS (fns_ptr, ix)[jj])
+ ? (TYPE_FN_FIELD_ARGS (fns_ptr, ix)[jj].type)
: TYPE_FIELD_TYPE (SYMBOL_TYPE (oload_syms[ix]), jj));
/* Compare parameter types to supplied argument types. Skip THIS for
diff --git a/gdb/values.c b/gdb/values.c
index a799b595194..1328ddb34b5 100644
--- a/gdb/values.c
+++ b/gdb/values.c
@@ -1230,6 +1230,7 @@ value_being_returned (struct type *valtype, struct regcache *retbuf,
struct value *val;
CORE_ADDR addr;
+#if 0
/* If this is not defined, just use EXTRACT_RETURN_VALUE instead. */
if (EXTRACT_STRUCT_VALUE_ADDRESS_P ())
if (struct_return)
@@ -1239,9 +1240,21 @@ value_being_returned (struct type *valtype, struct regcache *retbuf,
error ("Function return value unknown.");
return value_at (valtype, addr, NULL);
}
+#endif
+
+ /* If this is not defined, just use EXTRACT_RETURN_VALUE instead. */
+ if (DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS_P ())
+ if (struct_return)
+ {
+ addr = DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS (retbuf);
+ if (!addr)
+ error ("Function return value unknown.");
+ return value_at (valtype, addr, NULL);
+ }
val = allocate_value (valtype);
CHECK_TYPEDEF (valtype);
+#define EXTRACT_RETURN_VALUE DEPRECATED_EXTRACT_RETURN_VALUE
EXTRACT_RETURN_VALUE (valtype, retbuf, VALUE_CONTENTS_RAW (val));
return val;
diff --git a/gdb/vax-tdep.c b/gdb/vax-tdep.c
index 0478227ee92..2e82d927e10 100644
--- a/gdb/vax-tdep.c
+++ b/gdb/vax-tdep.c
@@ -48,9 +48,9 @@ static gdbarch_frame_init_saved_regs_ftype vax_frame_init_saved_regs;
static gdbarch_get_saved_register_ftype vax_get_saved_register;
static gdbarch_store_struct_return_ftype vax_store_struct_return;
-static gdbarch_extract_return_value_ftype vax_extract_return_value;
+static gdbarch_deprecated_extract_return_value_ftype vax_extract_return_value;
static gdbarch_store_return_value_ftype vax_store_return_value;
-static gdbarch_extract_struct_value_address_ftype
+static gdbarch_deprecated_extract_struct_value_address_ftype
vax_extract_struct_value_address;
static gdbarch_push_dummy_frame_ftype vax_push_dummy_frame;
@@ -671,10 +671,9 @@ vax_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* Return value info */
set_gdbarch_store_struct_return (gdbarch, vax_store_struct_return);
- set_gdbarch_extract_return_value (gdbarch, vax_extract_return_value);
+ set_gdbarch_deprecated_extract_return_value (gdbarch, vax_extract_return_value);
set_gdbarch_store_return_value (gdbarch, vax_store_return_value);
- set_gdbarch_extract_struct_value_address (gdbarch,
- vax_extract_struct_value_address);
+ set_gdbarch_deprecated_extract_struct_value_address (gdbarch, vax_extract_struct_value_address);
/* Call dummy info */
set_gdbarch_push_dummy_frame (gdbarch, vax_push_dummy_frame);
diff --git a/gdb/version.in b/gdb/version.in
index beaddec3fbb..ff62cb84c8f 100644
--- a/gdb/version.in
+++ b/gdb/version.in
@@ -1 +1 @@
-2002-05-15-cvs
+2002-06-15-cvs
diff --git a/gdb/x86-64-linux-nat.c b/gdb/x86-64-linux-nat.c
index f57a5f27675..4c4f64382c4 100644
--- a/gdb/x86-64-linux-nat.c
+++ b/gdb/x86-64-linux-nat.c
@@ -25,7 +25,6 @@
#include "inferior.h"
#include "gdbcore.h"
#include "regcache.h"
-#include "i387-tdep.h"
#include "gdb_assert.h"
#include "x86-64-tdep.h"
@@ -195,23 +194,73 @@ store_regs (int tid, int regno)
/* Transfering floating-point registers between GDB, inferiors and cores. */
-/* Fill GDB's register array with the floating-point register values in
- *FPREGSETP. */
+static void *
+x86_64_fxsave_offset (elf_fpregset_t * fxsave, int regnum)
+{
+ char *reg_name;
+ int reg_index;
+
+ gdb_assert (x86_64_num_gregs - 1 < regnum && regnum < x86_64_num_regs);
+
+ reg_name = x86_64_register_nr2name (regnum);
+
+ if (reg_name[0] == 's' && reg_name[1] == 't')
+ {
+ reg_index = reg_name[2] - '0';
+ return &fxsave->st_space[reg_index * 2];
+ }
+
+ if (reg_name[0] == 'x' && reg_name[1] == 'm' && reg_name[2] == 'm')
+ {
+ reg_index = reg_name[3] - '0';
+ return &fxsave->xmm_space[reg_index * 4];
+ }
+
+ if (strcmp (reg_name, "mxcsr") == 0)
+ return &fxsave->mxcsr;
+
+ return NULL;
+}
+
+/* Fill GDB's register array with the floating-point and SSE register
+ values in *FXSAVE. This function masks off any of the reserved
+ bits in *FXSAVE. */
void
-supply_fpregset (elf_fpregset_t * fpregsetp)
+supply_fpregset (elf_fpregset_t * fxsave)
{
- i387_supply_fxsave ((char *) fpregsetp);
+ int i, reg_st0, reg_mxcsr;
+
+ reg_st0 = x86_64_register_name2nr ("st0");
+ reg_mxcsr = x86_64_register_name2nr ("mxcsr");
+
+ gdb_assert (reg_st0 > 0 && reg_mxcsr > reg_st0);
+
+ for (i = reg_st0; i <= reg_mxcsr; i++)
+ supply_register (i, x86_64_fxsave_offset (fxsave, i));
}
-/* Fill register REGNO (if it is a floating-point register) in
- *FPREGSETP with the value in GDB's register array. If REGNO is -1,
- do this for all registers. */
+/* Fill register REGNUM (if it is a floating-point or SSE register) in
+ *FXSAVE with the value in GDB's register array. If REGNUM is -1, do
+ this for all registers. This function doesn't touch any of the
+ reserved bits in *FXSAVE. */
void
-fill_fpregset (elf_fpregset_t * fpregsetp, int regno)
+fill_fpregset (elf_fpregset_t * fxsave, int regnum)
{
- i387_fill_fxsave ((char *) fpregsetp, regno);
+ int i, last_regnum = MXCSR_REGNUM;
+ void *ptr;
+
+ if (gdbarch_tdep (current_gdbarch)->num_xmm_regs == 0)
+ last_regnum = FOP_REGNUM;
+
+ for (i = FP0_REGNUM; i <= last_regnum; i++)
+ if (regnum == -1 || regnum == i)
+ {
+ ptr = x86_64_fxsave_offset (fxsave, i);
+ if (ptr)
+ regcache_collect (i, ptr);
+ }
}
/* Fetch all floating-point registers from process/thread TID and store
diff --git a/gdb/x86-64-tdep.c b/gdb/x86-64-tdep.c
index 94f57a5a539..111861aaafe 100644
--- a/gdb/x86-64-tdep.c
+++ b/gdb/x86-64-tdep.c
@@ -376,14 +376,15 @@ classify_argument (struct type *type,
{
int num = classify_argument (TYPE_FIELDS (type)[j].type,
subclasses,
- (TYPE_FIELDS (type)[j].loc.bitpos
- + bit_offset) % 256);
+ (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;
+ (TYPE_FIELDS (type)[j].loc.bitpos +
+ bit_offset) / 8 / 8;
classes[i + pos] =
merge_classes (subclasses[i], classes[i + pos]);
}
@@ -490,7 +491,7 @@ classify_argument (struct type *type,
}
case TYPE_CODE_VOID:
return 0;
- default: /* Avoid warning. */
+ default: /* Avoid warning. */
break;
}
internal_error (__FILE__, __LINE__,
@@ -797,13 +798,24 @@ x86_64_store_return_value (struct type *type, char *valbuf)
}
-static char *
-x86_64_register_name (int reg_nr)
+char *
+x86_64_register_nr2name (int reg_nr)
{
if (reg_nr < 0 || reg_nr >= X86_64_NUM_REGS)
return NULL;
return x86_64_register_info_table[reg_nr].name;
}
+
+int
+x86_64_register_name2nr (const char *name)
+{
+ int reg_nr;
+
+ for (reg_nr = 0; reg_nr < X86_64_NUM_REGS; reg_nr++)
+ if (strcmp (name, x86_64_register_info_table[reg_nr].name) == 0)
+ return reg_nr;
+ return -1;
+}
@@ -845,10 +857,10 @@ x86_64_frameless_function_invocation (struct frame_info *frame)
CORE_ADDR
x86_64_skip_prologue (CORE_ADDR pc)
{
- int i, firstline, currline;
+ int i;
struct symtab_and_line v_sal;
struct symbol *v_function;
- CORE_ADDR salendaddr = 0, endaddr = 0;
+ CORE_ADDR endaddr;
/* We will handle only functions beginning with:
55 pushq %rbp
@@ -859,23 +871,14 @@ x86_64_skip_prologue (CORE_ADDR pc)
read_memory (pc, (char *) prolog_buf, PROLOG_BUFSIZE);
- /* First check, whether pc points to pushq %rbp. If not,
- * print a recommendation to enable frame pointer. */
- if (prolog_expect[0] != prolog_buf[0])
- {
- if (!omit_fp_note_printed)
- {
- printf_filtered
- ("NOTE: This function doesn't seem to have a valid prologue.\n"
- " Consider adding -fno-omit-frame-pointer to your gcc's CFLAGS.\n");
- omit_fp_note_printed++;
- }
- return pc;
- }
- /* Valid prolog continues with movq %rsp,%rbp. */
- for (i = 1; i < PROLOG_BUFSIZE; i++)
+ /* First check, whether pc points to pushq %rbp, movq %rsp,%rbp. */
+ for (i = 0; i < PROLOG_BUFSIZE; i++)
if (prolog_expect[i] != prolog_buf[i])
- return pc + 1; /* First instruction after pushq %rbp. */
+ return pc; /* ... no, it doesn't. Nothing to skip. */
+
+ /* OK, we have found the prologue and want PC of the first
+ non-prologue instruction. */
+ pc += PROLOG_BUFSIZE;
v_function = find_pc_function (pc);
v_sal = find_pc_line (pc, 0);
@@ -885,18 +888,13 @@ x86_64_skip_prologue (CORE_ADDR pc)
if (!v_function || !v_function->ginfo.value.block || !v_sal.symtab)
return pc;
- firstline = v_sal.line;
- currline = firstline;
- salendaddr = v_sal.end;
endaddr = v_function->ginfo.value.block->endaddr;
for (i = 0; i < v_sal.symtab->linetable->nitems; i++)
- if (v_sal.symtab->linetable->item[i].line > firstline
- && v_sal.symtab->linetable->item[i].pc >= salendaddr
+ if (v_sal.symtab->linetable->item[i].pc >= pc
&& v_sal.symtab->linetable->item[i].pc < endaddr)
{
pc = v_sal.symtab->linetable->item[i].pc;
- currline = v_sal.symtab->linetable->item[i].line;
break;
}
@@ -991,7 +989,7 @@ x86_64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_long_double_format (gdbarch, &floatformat_i387_ext);
set_gdbarch_num_regs (gdbarch, X86_64_NUM_REGS);
- set_gdbarch_register_name (gdbarch, x86_64_register_name);
+ set_gdbarch_register_name (gdbarch, x86_64_register_nr2name);
set_gdbarch_register_size (gdbarch, 8);
set_gdbarch_register_raw_size (gdbarch, x86_64_register_raw_size);
set_gdbarch_max_register_raw_size (gdbarch, 16);
@@ -1078,7 +1076,7 @@ x86_64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* Return number of args passed to a frame, no way to tell. */
set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown);
/* Don't use default structure extract routine */
- set_gdbarch_extract_struct_value_address (gdbarch, 0);
+ set_gdbarch_deprecated_extract_struct_value_address (gdbarch, 0);
/* If USE_STRUCT_CONVENTION retruns 0, then gdb uses STORE_RETURN_VALUE
and EXTRACT_RETURN_VALUE to store/fetch the functions return value. It is
@@ -1092,7 +1090,7 @@ x86_64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* 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. */
- set_gdbarch_extract_return_value (gdbarch, x86_64_extract_return_value);
+ set_gdbarch_deprecated_extract_return_value (gdbarch, x86_64_extract_return_value);
/* Write into the appropriate registers a function return value stored
diff --git a/gdb/x86-64-tdep.h b/gdb/x86-64-tdep.h
index d15b8e71e7f..dda94bc5eb8 100644
--- a/gdb/x86-64-tdep.h
+++ b/gdb/x86-64-tdep.h
@@ -28,6 +28,9 @@
extern int x86_64_num_regs;
extern int x86_64_num_gregs;
+int x86_64_register_name2nr (const char *name);
+char *x86_64_register_nr2name (int reg_nr);
+
gdbarch_frame_saved_pc_ftype x86_64_linux_frame_saved_pc;
gdbarch_saved_pc_after_call_ftype x86_64_linux_saved_pc_after_call;
diff --git a/gdb/xstormy16-tdep.c b/gdb/xstormy16-tdep.c
index f8c20b70f28..9be59718918 100644
--- a/gdb/xstormy16-tdep.c
+++ b/gdb/xstormy16-tdep.c
@@ -1086,13 +1086,12 @@ xstormy16_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_use_generic_dummy_frames (gdbarch, 1);
set_gdbarch_push_dummy_frame (gdbarch, generic_push_dummy_frame);
set_gdbarch_push_return_address (gdbarch, xstormy16_push_return_address);
- set_gdbarch_extract_return_value (gdbarch, xstormy16_extract_return_value);
+ set_gdbarch_deprecated_extract_return_value (gdbarch, xstormy16_extract_return_value);
set_gdbarch_push_arguments (gdbarch, xstormy16_push_arguments);
set_gdbarch_pop_frame (gdbarch, xstormy16_pop_frame);
set_gdbarch_store_struct_return (gdbarch, xstormy16_store_struct_return);
set_gdbarch_store_return_value (gdbarch, xstormy16_store_return_value);
- set_gdbarch_extract_struct_value_address (gdbarch,
- xstormy16_extract_struct_value_address);
+ set_gdbarch_deprecated_extract_struct_value_address (gdbarch, xstormy16_extract_struct_value_address);
set_gdbarch_use_struct_convention (gdbarch,
xstormy16_use_struct_convention);
set_gdbarch_call_dummy_location (gdbarch, AT_ENTRY_POINT);
diff --git a/gdb/z8k-tdep.c b/gdb/z8k-tdep.c
index 572a878dc20..789fe2e0235 100644
--- a/gdb/z8k-tdep.c
+++ b/gdb/z8k-tdep.c
@@ -325,25 +325,26 @@ z8k_print_register_hook (int regno)
{
if ((regno & 1) == 0 && regno < 16)
{
- unsigned short l[2];
+ unsigned char l[4];
- frame_register_read (selected_frame, regno, (char *) (l + 0));
- frame_register_read (selected_frame, regno + 1, (char *) (l + 1));
+ frame_register_read (selected_frame, regno, l + 0);
+ frame_register_read (selected_frame, regno + 1, l + 2);
printf_unfiltered ("\t");
- printf_unfiltered ("%04x%04x", l[0], l[1]);
+ printf_unfiltered ("0x%02x%02x%02x%02x", l[0], l[1], l[2], l[3]);
}
if ((regno & 3) == 0 && regno < 16)
{
- unsigned short l[4];
+ unsigned char l[8];
- frame_register_read (selected_frame, regno, (char *) (l + 0));
- frame_register_read (selected_frame, regno + 1, (char *) (l + 1));
- frame_register_read (selected_frame, regno + 2, (char *) (l + 2));
- frame_register_read (selected_frame, regno + 3, (char *) (l + 3));
+ frame_register_read (selected_frame, regno, l + 0);
+ frame_register_read (selected_frame, regno + 1, l + 2);
+ frame_register_read (selected_frame, regno + 2, l + 4);
+ frame_register_read (selected_frame, regno + 3, l + 6);
printf_unfiltered ("\t");
- printf_unfiltered ("%04x%04x%04x%04x", l[0], l[1], l[2], l[3]);
+ printf_unfiltered ("0x%02x%02x%02x%02x%02x%02x%02x%02x",
+ l[0], l[1], l[2], l[3], l[4], l[5], l[6], l[7]);
}
if (regno == 15)
{
diff --git a/include/ChangeLog b/include/ChangeLog
index dd0a2302ae9..1f04e1b1e6e 100644
--- a/include/ChangeLog
+++ b/include/ChangeLog
@@ -1,3 +1,68 @@
+2002-06-09 Andrew Cagney <cagney@redhat.com>
+
+ * remote-sim.h: Move to directory gdb/.
+ * callback.h: Move to directory gdb/.
+
+2002-06-07 Charles Wilson <cwilson@ece.gatech.edu>
+
+ * bfdlink.h (struct bfd_link_info): Change type of
+ pei386_auto_import field to int so that -1 can mean enabled by
+ default and 1 can mean enabled by command line switch.
+
+2002-06-06 DJ Delorie <dj@redhat.com>
+
+ * hashtab.h (htab): Rearrange new members for backward
+ compatibility.
+ (htab_create): Don't use a macro that requires other headers.
+
+2002-06-05 Geoffrey Keating <geoffk@redhat.com>
+
+ * hashtab.h (htab_create): Restore prototype for backward
+ compatibility.
+ (htab_try_create): Likewise.
+
+2002-05-22 Geoffrey Keating <geoffk@redhat.com>
+
+ * hashtab.h (struct htab): Update for change to length specifier.
+
+2002-05-10 Geoffrey Keating <geoffk@redhat.com>
+
+ * hashtab.h (GTY): Define if undefined.
+ (htab_alloc): New typedef.
+ (htab_free): New typedef.
+ (struct htab): Support gengtype; allow user-specified memory
+ allocation.
+ (htab_create_alloc): New.
+ (htab_create): Replace with #define.
+ (htab_try_create): Delete.
+
+2002-05-31 Michal Ludvig <mludvig@suse.cz>
+
+ * 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.
+
+2002-05-23 Andrew Cagney <ac131313@redhat.com>
+
+ * sim-d10v.h: Delete file. Moved to include/gdb/.
+
+2002-05-23 Jakub Jelinek <jakub@redhat.com>
+
+ * elf/common.h (PT_TLS, SHF_TLS, STT_TLS, DF_STATIC_TLS): Define.
+ * elf/ia64.h (R_IA64_LTOFF_TPREL22): Renamed from R_IA64_LTOFF_TP22.
+ * elf/i386.h: Add TLS relocs.
+
+2002-05-21 H.J. Lu (hjl@gnu.org)
+
+ * bfdlink.h (bfd_link_info): Add allow_multiple_definition.
+
+2002-05-17 J"orn Rennecke <joern.rennecke@superh.com>
+
+ * dis-asm.h (print_insn_shl, print_insn_sh64l): Remove prototype.
+
2002-04-16 David S. Miller <davem@redhat.com>
* xregex2.h (__restrict_arr): Define to __restrict on GCC
diff --git a/include/bfdlink.h b/include/bfdlink.h
index a034547212d..719e7060eab 100644
--- a/include/bfdlink.h
+++ b/include/bfdlink.h
@@ -3,21 +3,21 @@
Free Software Foundation, Inc.
Written by Steve Chamberlain and Ian Lance Taylor, Cygnus Support.
-This file is part of BFD, the Binary File Descriptor library.
+ This file is part of BFD, the Binary File Descriptor library.
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifndef BFDLINK_H
#define BFDLINK_H
@@ -231,6 +231,8 @@ struct bfd_link_info
select an appropriate memset function. Apparently it is also
normal for HPPA shared libraries to have undefined symbols. */
boolean allow_shlib_undefined;
+ /* True if ok to have multiple definition. */
+ boolean allow_multiple_definition;
/* Which symbols to strip. */
enum bfd_link_strip strip;
/* Which local symbols to discard. */
@@ -286,9 +288,10 @@ struct bfd_link_info
/* May be used to set DT_FLAGS_1 for ELF. */
bfd_vma flags_1;
- /* True if auto-import thunks for DATA items in pei386 DLLs
- should be generated/linked against. */
- boolean pei386_auto_import;
+ /* 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. */
+ int pei386_auto_import;
/* True if non-PLT relocs should be merged into one reloc section
and sorted so that relocs against the same symbol come together. */
diff --git a/include/dis-asm.h b/include/dis-asm.h
index decc863c6d3..8d38f7e8d2b 100644
--- a/include/dis-asm.h
+++ b/include/dis-asm.h
@@ -205,6 +205,7 @@ extern int print_insn_little_a29k PARAMS ((bfd_vma, disassemble_info*));
extern int print_insn_avr PARAMS ((bfd_vma, disassemble_info*));
extern int print_insn_d10v PARAMS ((bfd_vma, disassemble_info*));
extern int print_insn_d30v PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_dlx PARAMS ((bfd_vma, disassemble_info*));
extern int print_insn_fr30 PARAMS ((bfd_vma, disassemble_info*));
extern int print_insn_hppa PARAMS ((bfd_vma, disassemble_info*));
extern int print_insn_i860 PARAMS ((bfd_vma, disassemble_info*));
@@ -226,7 +227,6 @@ extern int print_insn_little_powerpc PARAMS ((bfd_vma, disassemble_info*));
extern int print_insn_rs6000 PARAMS ((bfd_vma, disassemble_info*));
extern int print_insn_s390 PARAMS ((bfd_vma, disassemble_info*));
extern int print_insn_sh PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_shl PARAMS ((bfd_vma, disassemble_info*));
extern int print_insn_tic30 PARAMS ((bfd_vma, disassemble_info*));
extern int print_insn_tic54x PARAMS ((bfd_vma, disassemble_info*));
extern int print_insn_tic80 PARAMS ((bfd_vma, disassemble_info*));
@@ -235,7 +235,6 @@ extern int print_insn_vax PARAMS ((bfd_vma, disassemble_info*));
extern int print_insn_w65 PARAMS ((bfd_vma, disassemble_info*));
extern int print_insn_xstormy16 PARAMS ((bfd_vma, disassemble_info*));
extern int print_insn_sh64 PARAMS ((bfd_vma, disassemble_info *));
-extern int print_insn_sh64l PARAMS ((bfd_vma, disassemble_info *));
extern int print_insn_sh64x_media PARAMS ((bfd_vma, disassemble_info *));
extern disassembler_ftype arc_get_disassembler PARAMS ((void *));
diff --git a/include/elf/ChangeLog b/include/elf/ChangeLog
index fe3823b1b67..2a1f6b41d81 100644
--- a/include/elf/ChangeLog
+++ b/include/elf/ChangeLog
@@ -1,3 +1,35 @@
+2002-06-06 Lars Brinkhoff <lars@nocrew.org>
+
+ * common.h: Change registry@sco.com to registry@caldera.com.
+ (EM_PDP10, EM_PDP11): Define.
+
+2002-06-04 Jason Thorpe <thorpej@wasabisystems.com>
+
+ * sh.h (_bfd_sh64_crange_qsort_cmpb, _bfd_sh64_crange_qsort_cmpl)
+ (_bfd_sh64_crange_bsearch_cmpb, _bfd_sh64_crange_bsearch_cmpl): New
+ prototypes.
+
+2002-06-01 Richard Henderson <rth@redhat.com>
+
+ * alpha.h (LITUSE_ALPHA_ADDR, LITUSE_ALPHA_BASE, LITUSE_ALPHA_BYTOFF,
+ LITUSE_ALPHA_JSR, LITUSE_ALPHA_TLSGD, LITUSE_ALPHA_TLSLDM): New.
+
+2002-05-30 Richard Henderson <rth@redhat.com>
+
+ * alpha.h (R_ALPHA_TLSGD, R_ALPHA_TLSLDM, R_ALPHA_DTPMOD64,
+ R_ALPHA_GOTDTPREL, R_ALPHA_DTPREL64, R_ALPHA_DTPRELHI,
+ R_ALPHA_DTPRELLO, R_ALPHA_DTPREL16, R_ALPHA_GOTTPREL, R_ALPHA_TPREL64,
+ R_ALPHA_TPRELHI, R_ALPHA_TPRELLO, R_ALPHA_TPREL16): New.
+
+2002-05-29 Matt Thomas <matt@3am-software.com>
+
+ * vax.h: New file
+
+2002-05-28 Kuang Hwa Lin <kuang@sbcglobal.net>
+
+ * common.h (EM_DLX): Define.
+ * dlx.h: New file.
+
2002-05-08 Jason Thorpe <thorpej@wasabisystems.com>
* common.h (NT_GNU_ABI_TAG): Define.
diff --git a/include/elf/alpha.h b/include/elf/alpha.h
index e937b814788..0313b5be6bb 100644
--- a/include/elf/alpha.h
+++ b/include/elf/alpha.h
@@ -99,6 +99,28 @@ START_RELOC_NUMBERS (elf_alpha_reloc_type)
STO_ALPHA_STD_GPLOAD. */
RELOC_NUMBER (R_ALPHA_BRSGP, 28)
+ /* Thread-Local Storage. */
+ RELOC_NUMBER (R_ALPHA_TLSGD, 29)
+ RELOC_NUMBER (R_ALPHA_TLSLDM, 30)
+ RELOC_NUMBER (R_ALPHA_DTPMOD64, 31)
+ RELOC_NUMBER (R_ALPHA_GOTDTPREL, 32)
+ RELOC_NUMBER (R_ALPHA_DTPREL64, 33)
+ RELOC_NUMBER (R_ALPHA_DTPRELHI, 34)
+ RELOC_NUMBER (R_ALPHA_DTPRELLO, 35)
+ RELOC_NUMBER (R_ALPHA_DTPREL16, 36)
+ RELOC_NUMBER (R_ALPHA_GOTTPREL, 37)
+ RELOC_NUMBER (R_ALPHA_TPREL64, 38)
+ RELOC_NUMBER (R_ALPHA_TPRELHI, 39)
+ RELOC_NUMBER (R_ALPHA_TPRELLO, 40)
+ RELOC_NUMBER (R_ALPHA_TPREL16, 41)
+
END_RELOC_NUMBERS (R_ALPHA_max)
+#define LITUSE_ALPHA_ADDR 0
+#define LITUSE_ALPHA_BASE 1
+#define LITUSE_ALPHA_BYTOFF 2
+#define LITUSE_ALPHA_JSR 3
+#define LITUSE_ALPHA_TLSGD 4
+#define LITUSE_ALPHA_TLSLDM 5
+
#endif /* _ELF_ALPHA_H */
diff --git a/include/elf/common.h b/include/elf/common.h
index f8b0832e867..ce3974eec7a 100644
--- a/include/elf/common.h
+++ b/include/elf/common.h
@@ -92,7 +92,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define ET_HIPROC 0xFFFF /* Processor-specific */
/* Values for e_machine, which identifies the architecture. These numbers
- are officially assigned by registry@sco.com. See below for a list of
+ are officially assigned by registry@caldera.com. See below for a list of
ad-hoc numbers used during initial development. */
#define EM_NONE 0 /* No machine */
@@ -145,6 +145,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define EM_TINYJ 61 /* Advanced Logic Corp. TinyJ embedded processor */
#define EM_X86_64 62 /* Advanced Micro Devices X86-64 processor */
+#define EM_PDP10 64 /* Digital Equipment Corp. PDP-10 */
+#define EM_PDP11 65 /* Digital Equipment Corp. PDP-11 */
#define EM_FX66 66 /* Siemens FX66 microcontroller */
#define EM_ST9PLUS 67 /* STMicroelectronics ST9+ 8/16 bit microcontroller */
#define EM_ST7 68 /* STMicroelectronics ST7 8-bit microcontroller */
@@ -184,7 +186,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
will have a collision. Instead, pick a random number.
Normally, each entity or maintainer responsible for a machine with an
- unofficial e_machine number should eventually ask registry@sco.com for
+ unofficial e_machine number should eventually ask registry@caldera.com for
an officially blessed number to be added to the list above. */
#define EM_PJ_OLD 99 /* picoJava */
@@ -236,6 +238,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
Written in the absense of an ABI. */
#define EM_OPENRISC_OLD 0x3426
+/* DLX magic number
+ Written in the absense of an ABI. */
+#define EM_DLX 0x5aa5
+
#define EM_XSTORMY16 0xad45
/* See the above comment before you add a new EM_* value here. */
@@ -254,6 +260,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define PT_NOTE 4 /* Auxiliary information */
#define PT_SHLIB 5 /* Reserved, unspecified semantics */
#define PT_PHDR 6 /* Entry for header table itself */
+#define PT_TLS 7 /* Thread local storage segment */
#define PT_LOOS 0x60000000 /* OS-specific */
#define PT_HIOS 0x6fffffff /* OS-specific */
#define PT_LOPROC 0x70000000 /* Processor-specific */
@@ -322,6 +329,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define SHF_LINK_ORDER (1 << 7) /* Preserve section ordering when linking */
#define SHF_OS_NONCONFORMING (1 << 8) /* OS specific processing required */
#define SHF_GROUP (1 << 9) /* Member of a section group */
+#define SHF_TLS (1 << 10) /* Thread local storage section */
/* #define SHF_MASKOS 0x0F000000 *//* OS-specific semantics */
#define SHF_MASKOS 0x0FF00000 /* New value, Oct 4, 1999 Draft */
@@ -417,6 +425,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define STT_SECTION 3 /* Symbol associated with a section */
#define STT_FILE 4 /* Symbol gives a file name */
#define STT_COMMON 5 /* An uninitialised common block */
+#define STT_TLS 6 /* Thread local data object */
#define STT_LOOS 10 /* OS-specific semantics */
#define STT_HIOS 12 /* OS-specific semantics */
#define STT_LOPROC 13 /* Application-specific semantics */
@@ -585,6 +594,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define DF_SYMBOLIC (1 << 1)
#define DF_TEXTREL (1 << 2)
#define DF_BIND_NOW (1 << 3)
+#define DF_STATIC_TLS (1 << 4)
/* These constants are used for the version number of a Elf32_Verdef
structure. */
diff --git a/include/elf/dlx.h b/include/elf/dlx.h
new file mode 100644
index 00000000000..562f600f35d
--- /dev/null
+++ b/include/elf/dlx.h
@@ -0,0 +1,53 @@
+/* DLX support for BFD.
+ Copyright 2002 Free Software Foundation, Inc.
+
+ 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 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 _ELF_DLX_H
+#define _ELF_DLX_H
+
+#include "elf/reloc-macros.h"
+
+#if 0
+START_RELOC_NUMBERS (elf_dlx_reloc_type)
+ RELOC_NUMBER (R_DLX_NONE, 0)
+ RELOC_NUMBER (R_DLX_RELOC_16, 1)
+ RELOC_NUMBER (R_DLX_RELOC_26, 2)
+ RELOC_NUMBER (R_DLX_RELOC_32, 3)
+ RELOC_NUMBER (R_DLX_GNU_VTINHERIT, 4)
+ RELOC_NUMBER (R_DLX_GNU_VTENTRY, 5)
+ RELOC_NUMBER (R_DLX_RELOC_16_HI, 6)
+ RELOC_NUMBER (R_DLX_RELOC_16_LO, 7)
+ RELOC_NUMBER (R_DLX_RELOC_16_PCREL, 8)
+ RELOC_NUMBER (R_DLX_RELOC_26_PCREL, 9)
+END_RELOC_NUMBERS (R_DLX_max)
+#else
+START_RELOC_NUMBERS (elf_dlx_reloc_type)
+ RELOC_NUMBER (R_DLX_NONE, 0)
+ RELOC_NUMBER (R_DLX_RELOC_8, 1)
+ RELOC_NUMBER (R_DLX_RELOC_16, 2)
+ RELOC_NUMBER (R_DLX_RELOC_32, 3)
+ RELOC_NUMBER (R_DLX_GNU_VTINHERIT, 4)
+ RELOC_NUMBER (R_DLX_GNU_VTENTRY, 5)
+ RELOC_NUMBER (R_DLX_RELOC_16_HI, 6)
+ RELOC_NUMBER (R_DLX_RELOC_16_LO, 7)
+ RELOC_NUMBER (R_DLX_RELOC_16_PCREL, 8)
+ RELOC_NUMBER (R_DLX_RELOC_26_PCREL, 9)
+END_RELOC_NUMBERS (R_DLX_max)
+#endif /* 0 */
+
+#endif /* _ELF_DLX_H */
diff --git a/include/elf/dwarf2.h b/include/elf/dwarf2.h
index 750a7204ebf..0e78310c69f 100644
--- a/include/elf/dwarf2.h
+++ b/include/elf/dwarf2.h
@@ -649,8 +649,8 @@ enum dwarf_call_frame_info
#define DW_CIE_VERSION 1
#define DW_CFA_extended 0
-#define DW_CFA_low_user 0x1c
-#define DW_CFA_high_user 0x3f
+#define DW_CFA_lo_user 0x1c
+#define DW_CFA_hi_user 0x3f
#define DW_CHILDREN_no 0x00
#define DW_CHILDREN_yes 0x01
diff --git a/include/elf/i386.h b/include/elf/i386.h
index 4a15efc4912..c6e9709a1fe 100644
--- a/include/elf/i386.h
+++ b/include/elf/i386.h
@@ -34,12 +34,31 @@ START_RELOC_NUMBERS (elf_i386_reloc_type)
RELOC_NUMBER (R_386_RELATIVE, 8) /* Adjust by program base */
RELOC_NUMBER (R_386_GOTOFF, 9) /* 32 bit offset to GOT */
RELOC_NUMBER (R_386_GOTPC, 10) /* 32 bit PC relative offset to GOT */
- FAKE_RELOC (FIRST_INVALID_RELOC, 11)
- FAKE_RELOC (LAST_INVALID_RELOC, 19)
+ RELOC_NUMBER (R_386_32PLT, 11) /* Used by Sun */
+ FAKE_RELOC (FIRST_INVALID_RELOC, 12)
+ FAKE_RELOC (LAST_INVALID_RELOC, 16)
+ RELOC_NUMBER (R_386_TLS_LE, 17)
+ RELOC_NUMBER (R_386_TLS_GD, 18)
+ RELOC_NUMBER (R_386_TLS_LDM, 19)
RELOC_NUMBER (R_386_16, 20)
RELOC_NUMBER (R_386_PC16, 21)
RELOC_NUMBER (R_386_8, 22)
RELOC_NUMBER (R_386_PC8, 23)
+ RELOC_NUMBER (R_386_TLS_GD_32, 24)
+ RELOC_NUMBER (R_386_TLS_GD_PUSH, 25)
+ RELOC_NUMBER (R_386_TLS_GD_CALL, 26)
+ RELOC_NUMBER (R_386_TLS_GD_POP, 27)
+ RELOC_NUMBER (R_386_TLS_LDM_32, 28)
+ RELOC_NUMBER (R_386_TLS_LDM_PUSH, 29)
+ RELOC_NUMBER (R_386_TLS_LDM_CALL, 30)
+ RELOC_NUMBER (R_386_TLS_LDM_POP, 31)
+ RELOC_NUMBER (R_386_TLS_LDO_32, 32)
+ RELOC_NUMBER (R_386_TLS_IE_32, 33)
+ RELOC_NUMBER (R_386_TLS_LE_32, 34)
+ RELOC_NUMBER (R_386_TLS_DTPMOD32, 35)
+ RELOC_NUMBER (R_386_TLS_DTPOFF32, 36)
+ RELOC_NUMBER (R_386_TLS_TPOFF32, 37)
+
/* These are GNU extensions to enable C++ vtable garbage collection. */
RELOC_NUMBER (R_386_GNU_VTINHERIT, 250)
RELOC_NUMBER (R_386_GNU_VTENTRY, 251)
diff --git a/include/elf/ia64.h b/include/elf/ia64.h
index 5e632ed010e..310a7f74af0 100644
--- a/include/elf/ia64.h
+++ b/include/elf/ia64.h
@@ -192,7 +192,7 @@ START_RELOC_NUMBERS (elf_ia64_reloc_type)
RELOC_NUMBER (R_IA64_TPREL64MSB, 0x96) /* @tprel(sym+add), data8 MSB */
RELOC_NUMBER (R_IA64_TPREL64LSB, 0x97) /* @tprel(sym+add), data8 LSB */
- RELOC_NUMBER (R_IA64_LTOFF_TP22, 0x9a) /* @ltoff(@tprel(s+a)), add imm22 */
+ RELOC_NUMBER (R_IA64_LTOFF_TPREL22, 0x9a) /* @ltoff(@tprel(s+a)), add imm22 */
RELOC_NUMBER (R_IA64_DTPMOD64MSB, 0xa6) /* @dtpmod(sym+add), data8 MSB */
RELOC_NUMBER (R_IA64_DTPMOD64LSB, 0xa7) /* @dtpmod(sym+add), data8 LSB */
diff --git a/include/elf/sh.h b/include/elf/sh.h
index 1480f490bd5..af78c9bb04e 100644
--- a/include/elf/sh.h
+++ b/include/elf/sh.h
@@ -108,6 +108,11 @@ extern enum sh64_elf_cr_type sh64_get_contents_type
FIXME: This seems redundant now that we export the interface above. */
extern boolean sh64_address_is_shmedia PARAMS ((asection *, bfd_vma));
+extern int _bfd_sh64_crange_qsort_cmpb PARAMS ((const void *, const void *));
+extern int _bfd_sh64_crange_qsort_cmpl PARAMS ((const void *, const void *));
+extern int _bfd_sh64_crange_bsearch_cmpb PARAMS ((const void *, const void *));
+extern int _bfd_sh64_crange_bsearch_cmpl PARAMS ((const void *, const void *));
+
/* We put this in elf_section_data (section)->tdata. */
struct sh64_section_data
{
diff --git a/include/elf/vax.h b/include/elf/vax.h
new file mode 100644
index 00000000000..aba5d9f08a0
--- /dev/null
+++ b/include/elf/vax.h
@@ -0,0 +1,51 @@
+/* VAX ELF support for BFD.
+ Copyright (C) 2002 Free Software Foundation, Inc.
+ Contributed by Matt Thomas <matt@3am-software.com>.
+
+ 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 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 _ELF_VAX_H
+#define _ELF_VAX_H
+
+#include "elf/reloc-macros.h"
+
+/* Relocation types. */
+START_RELOC_NUMBERS (elf_vax_reloc_type)
+ RELOC_NUMBER (R_VAX_NONE, 0) /* No reloc */
+ RELOC_NUMBER (R_VAX_32, 1) /* Direct 32 bit */
+ RELOC_NUMBER (R_VAX_16, 2) /* Direct 16 bit */
+ RELOC_NUMBER (R_VAX_8, 3) /* Direct 8 bit */
+ RELOC_NUMBER (R_VAX_PC32, 4) /* PC relative 32 bit */
+ RELOC_NUMBER (R_VAX_PC16, 5) /* PC relative 16 bit */
+ RELOC_NUMBER (R_VAX_PC8, 6) /* PC relative 8 bit */
+ RELOC_NUMBER (R_VAX_GOT32, 7) /* 32 bit PC relative GOT entry */
+ RELOC_NUMBER (R_VAX_PLT32, 13) /* 32 bit PC relative PLT address */
+ RELOC_NUMBER (R_VAX_COPY, 19) /* Copy symbol at runtime */
+ RELOC_NUMBER (R_VAX_GLOB_DAT, 20) /* Create GOT entry */
+ RELOC_NUMBER (R_VAX_JMP_SLOT, 21) /* Create PLT entry */
+ RELOC_NUMBER (R_VAX_RELATIVE, 22) /* Adjust by program base */
+ /* These are GNU extensions to enable C++ vtable garbage collection. */
+ RELOC_NUMBER (R_VAX_GNU_VTINHERIT, 23)
+ RELOC_NUMBER (R_VAX_GNU_VTENTRY, 24)
+END_RELOC_NUMBERS (R_VAX_max)
+
+/* Processor specific flags for the ELF header e_flags field. */
+#define EF_NONPIC 0x0001 /* Object contains non-PIC code */
+#define EF_DFLOAT 0x0100 /* Object contains D-Float insn. */
+#define EF_GFLOAT 0x0200 /* Object contains G-Float insn. */
+
+#endif
diff --git a/include/gdb/ChangeLog b/include/gdb/ChangeLog
index 96a4a058a30..0ea02b3f8c4 100644
--- a/include/gdb/ChangeLog
+++ b/include/gdb/ChangeLog
@@ -1,3 +1,21 @@
+2002-06-12 Andrew Cagney <ac131313@redhat.com>
+
+ * sim-arm.h: New file.
+
+2002-06-08 Andrew Cagney <cagney@redhat.com>
+
+ * callback.h: Copy to here from directory above.
+ * remote-sim.h: Copy to here from directory above.
+
+2002-06-01 Andrew Cagney <ac131313@redhat.com>
+
+ * sim-d10v.h (sim_d10v_regs): Expand to include all registers.
+ Update copyright.
+
+2002-05-23 Andrew Cagney <ac131313@redhat.com>
+
+ * sim-d10v.h: New file. Moved from include/sim-d10v.h.
+
2002-05-10 Elena Zannoni <ezannoni@redhat.com>
* sim-sh.h: New file, for sh gdb<->sim interface.
diff --git a/include/gdb/callback.h b/include/gdb/callback.h
new file mode 100644
index 00000000000..30752842ed9
--- /dev/null
+++ b/include/gdb/callback.h
@@ -0,0 +1,270 @@
+/* Remote target system call callback support.
+ Copyright 1997 Free Software Foundation, Inc.
+ Contributed by Cygnus Solutions.
+
+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 interface isn't intended to be specific to any particular kind
+ of remote (hardware, simulator, whatever). As such, support for it
+ (e.g. sim/common/callback.c) should *not* live in the simulator source
+ tree, nor should it live in the gdb source tree. */
+
+/* There are various ways to handle system calls:
+
+ 1) Have a simulator intercept the appropriate trap instruction and
+ directly perform the system call on behalf of the target program.
+ This is the typical way of handling system calls for embedded targets.
+ [Handling system calls for embedded targets isn't that much of an
+ oxymoron as running compiler testsuites make use of the capability.]
+
+ This method of system call handling is done when STATE_ENVIRONMENT
+ is ENVIRONMENT_USER.
+
+ 2) Have a simulator emulate the hardware as much as possible.
+ If the program running on the real hardware communicates with some sort
+ of target manager, one would want to be able to run this program on the
+ simulator as well.
+
+ This method of system call handling is done when STATE_ENVIRONMENT
+ is ENVIRONMENT_OPERATING.
+*/
+
+#ifndef CALLBACK_H
+#define CALLBACK_H
+
+/* ??? The reason why we check for va_start here should be documented. */
+
+#ifndef va_start
+#include <ansidecl.h>
+#ifdef ANSI_PROTOTYPES
+#include <stdarg.h>
+#else
+#include <varargs.h>
+#endif
+#endif
+
+/* Mapping of host/target values. */
+/* ??? For debugging purposes, one might want to add a string of the
+ name of the symbol. */
+
+typedef struct {
+ int host_val;
+ int target_val;
+} CB_TARGET_DEFS_MAP;
+
+#define MAX_CALLBACK_FDS 10
+
+/* Forward decl for stat/fstat. */
+struct stat;
+
+typedef struct host_callback_struct host_callback;
+
+struct host_callback_struct
+{
+ int (*close) PARAMS ((host_callback *,int));
+ int (*get_errno) PARAMS ((host_callback *));
+ int (*isatty) PARAMS ((host_callback *, int));
+ int (*lseek) PARAMS ((host_callback *, int, long , int));
+ int (*open) PARAMS ((host_callback *, const char*, int mode));
+ int (*read) PARAMS ((host_callback *,int, char *, int));
+ int (*read_stdin) PARAMS (( host_callback *, char *, int));
+ int (*rename) PARAMS ((host_callback *, const char *, const char *));
+ int (*system) PARAMS ((host_callback *, const char *));
+ long (*time) PARAMS ((host_callback *, long *));
+ int (*unlink) PARAMS ((host_callback *, const char *));
+ int (*write) PARAMS ((host_callback *,int, const char *, int));
+ int (*write_stdout) PARAMS ((host_callback *, const char *, int));
+ void (*flush_stdout) PARAMS ((host_callback *));
+ int (*write_stderr) PARAMS ((host_callback *, const char *, int));
+ void (*flush_stderr) PARAMS ((host_callback *));
+ int (*stat) PARAMS ((host_callback *, const char *, struct stat *));
+ int (*fstat) PARAMS ((host_callback *, int, struct stat *));
+
+ /* When present, call to the client to give it the oportunity to
+ poll any io devices for a request to quit (indicated by a nonzero
+ return value). */
+ int (*poll_quit) PARAMS ((host_callback *));
+
+ /* Used when the target has gone away, so we can close open
+ handles and free memory etc etc. */
+ int (*shutdown) PARAMS ((host_callback *));
+ int (*init) PARAMS ((host_callback *));
+
+ /* depreciated, use vprintf_filtered - Talk to the user on a console. */
+ void (*printf_filtered) PARAMS ((host_callback *, const char *, ...));
+
+ /* Talk to the user on a console. */
+ void (*vprintf_filtered) PARAMS ((host_callback *, const char *, va_list));
+
+ /* Same as vprintf_filtered but to stderr. */
+ void (*evprintf_filtered) PARAMS ((host_callback *, const char *, va_list));
+
+ /* Print an error message and "exit".
+ In the case of gdb "exiting" means doing a longjmp back to the main
+ command loop. */
+ void (*error) PARAMS ((host_callback *, const char *, ...));
+
+ int last_errno; /* host format */
+
+ int fdmap[MAX_CALLBACK_FDS];
+ char fdopen[MAX_CALLBACK_FDS];
+ char alwaysopen[MAX_CALLBACK_FDS];
+
+ /* System call numbers. */
+ CB_TARGET_DEFS_MAP *syscall_map;
+ /* Errno values. */
+ CB_TARGET_DEFS_MAP *errno_map;
+ /* Flags to the open system call. */
+ CB_TARGET_DEFS_MAP *open_map;
+ /* Signal numbers. */
+ CB_TARGET_DEFS_MAP *signal_map;
+ /* Layout of `stat' struct.
+ The format is a series of "name,length" pairs separated by colons.
+ Empty space is indicated with a `name' of "space".
+ All padding must be explicitly mentioned.
+ Lengths are in bytes. If this needs to be extended to bits,
+ use "name.bits".
+ Example: "st_dev,4:st_ino,4:st_mode,4:..." */
+ const char *stat_map;
+
+ /* Marker for those wanting to do sanity checks.
+ This should remain the last member of this struct to help catch
+ miscompilation errors. */
+#define HOST_CALLBACK_MAGIC 4705 /* teds constant */
+ int magic;
+};
+
+extern host_callback default_callback;
+
+/* Canonical versions of system call numbers.
+ It's not intended to willy-nilly throw every system call ever heard
+ of in here. Only include those that have an important use.
+ ??? One can certainly start a discussion over the ones that are currently
+ here, but that will always be true. */
+
+/* These are used by the ANSI C support of libc. */
+#define CB_SYS_exit 1
+#define CB_SYS_open 2
+#define CB_SYS_close 3
+#define CB_SYS_read 4
+#define CB_SYS_write 5
+#define CB_SYS_lseek 6
+#define CB_SYS_unlink 7
+#define CB_SYS_getpid 8
+#define CB_SYS_kill 9
+#define CB_SYS_fstat 10
+/*#define CB_SYS_sbrk 11 - not currently a system call, but reserved. */
+
+/* ARGV support. */
+#define CB_SYS_argvlen 12
+#define CB_SYS_argv 13
+
+/* These are extras added for one reason or another. */
+#define CB_SYS_chdir 14
+#define CB_SYS_stat 15
+#define CB_SYS_chmod 16
+#define CB_SYS_utime 17
+#define CB_SYS_time 18
+
+/* Struct use to pass and return information necessary to perform a
+ system call. */
+/* FIXME: Need to consider target word size. */
+
+typedef struct cb_syscall {
+ /* The target's value of what system call to perform. */
+ int func;
+ /* The arguments to the syscall. */
+ long arg1, arg2, arg3, arg4;
+
+ /* The result. */
+ long result;
+ /* Some system calls have two results. */
+ long result2;
+ /* The target's errno value, or 0 if success.
+ This is converted to the target's value with host_to_target_errno. */
+ int errcode;
+
+ /* Working space to be used by memory read/write callbacks. */
+ PTR p1;
+ PTR p2;
+ long x1,x2;
+
+ /* Callbacks for reading/writing memory (e.g. for read/write syscalls).
+ ??? long or unsigned long might be better to use for the `count'
+ argument here. We mimic sim_{read,write} for now. Be careful to
+ test any changes with -Wall -Werror, mixed signed comparisons
+ will get you. */
+ int (*read_mem) PARAMS ((host_callback * /*cb*/, struct cb_syscall * /*sc*/,
+ unsigned long /*taddr*/, char * /*buf*/,
+ int /*bytes*/));
+ int (*write_mem) PARAMS ((host_callback * /*cb*/, struct cb_syscall * /*sc*/,
+ unsigned long /*taddr*/, const char * /*buf*/,
+ int /*bytes*/));
+
+ /* For sanity checking, should be last entry. */
+ int magic;
+} CB_SYSCALL;
+
+/* Magic number sanity checker. */
+#define CB_SYSCALL_MAGIC 0x12344321
+
+/* Macro to initialize CB_SYSCALL. Called first, before filling in
+ any fields. */
+#define CB_SYSCALL_INIT(sc) \
+do { \
+ memset ((sc), 0, sizeof (*(sc))); \
+ (sc)->magic = CB_SYSCALL_MAGIC; \
+} while (0)
+
+/* Return codes for various interface routines. */
+
+typedef enum {
+ CB_RC_OK = 0,
+ /* generic error */
+ CB_RC_ERR,
+ /* either file not found or no read access */
+ CB_RC_ACCESS,
+ CB_RC_NO_MEM
+} CB_RC;
+
+/* Read in target values for system call numbers, errno values, signals. */
+CB_RC cb_read_target_syscall_maps PARAMS ((host_callback *, const char *));
+
+/* Translate target to host syscall function numbers. */
+int cb_target_to_host_syscall PARAMS ((host_callback *, int));
+
+/* Translate host to target errno value. */
+int cb_host_to_target_errno PARAMS ((host_callback *, int));
+
+/* Translate target to host open flags. */
+int cb_target_to_host_open PARAMS ((host_callback *, int));
+
+/* Translate target signal number to host. */
+int cb_target_to_host_signal PARAMS ((host_callback *, int));
+
+/* Translate host signal number to target. */
+int cb_host_to_target_signal PARAMS ((host_callback *, int));
+
+/* Translate host stat struct to target.
+ If stat struct ptr is NULL, just compute target stat struct size.
+ Result is size of target stat struct or 0 if error. */
+int cb_host_to_target_stat PARAMS ((host_callback *, const struct stat *, PTR));
+
+/* Perform a system call. */
+CB_RC cb_syscall PARAMS ((host_callback *, CB_SYSCALL *));
+
+#endif
diff --git a/include/remote-sim.h b/include/gdb/remote-sim.h
index 726ec623fbd..726ec623fbd 100644
--- a/include/remote-sim.h
+++ b/include/gdb/remote-sim.h
diff --git a/include/gdb/sim-arm.h b/include/gdb/sim-arm.h
new file mode 100644
index 00000000000..1e49781e8c0
--- /dev/null
+++ b/include/gdb/sim-arm.h
@@ -0,0 +1,65 @@
+/* This file defines the interface between the Arm simulator and GDB.
+
+ Copyright 2002 Free Software Foundation, Inc.
+
+ Contributed by Red Hat.
+
+ 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. */
+
+#if !defined (SIM_ARM_H)
+#define SIM_ARM_H
+
+#ifdef __cplusplus
+extern "C" { // }
+#endif
+
+enum sim_arm_regnum
+{
+ SIM_ARM_R0_REGNUM,
+ SIM_ARM_R1_REGNUM,
+ SIM_ARM_R2_REGNUM,
+ SIM_ARM_R3_REGNUM,
+ SIM_ARM_R4_REGNUM,
+ SIM_ARM_R5_REGNUM,
+ SIM_ARM_R6_REGNUM,
+ SIM_ARM_R7_REGNUM,
+ SIM_ARM_R8_REGNUM,
+ SIM_ARM_R9_REGNUM,
+ SIM_ARM_R10_REGNUM,
+ SIM_ARM_R11_REGNUM,
+ SIM_ARM_R12_REGNUM,
+ SIM_ARM_R13_REGNUM,
+ SIM_ARM_R14_REGNUM,
+ SIM_ARM_R15_REGNUM, /* PC */
+ SIM_ARM_FP0_REGNUM,
+ SIM_ARM_FP1_REGNUM,
+ SIM_ARM_FP2_REGNUM,
+ SIM_ARM_FP3_REGNUM,
+ SIM_ARM_FP4_REGNUM,
+ SIM_ARM_FP5_REGNUM,
+ SIM_ARM_FP6_REGNUM,
+ SIM_ARM_FP7_REGNUM,
+ SIM_ARM_FPS_REGNUM,
+ SIM_ARM_PS_REGNUM
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/sim-d10v.h b/include/gdb/sim-d10v.h
index 9d29e05841b..f153a419478 100644
--- a/include/sim-d10v.h
+++ b/include/gdb/sim-d10v.h
@@ -1,5 +1,6 @@
/* This file defines the interface between the d10v simulator and gdb.
- Copyright 1999 Free Software Foundation, Inc.
+
+ Copyright 1999, 2002 Free Software Foundation, Inc.
This file is part of GDB.
@@ -75,26 +76,61 @@ extern unsigned long sim_d10v_translate_addr
/* The simulator makes use of the following register information. */
+enum sim_d10v_regs
+{
+ SIM_D10V_R0_REGNUM,
+ SIM_D10V_R1_REGNUM,
+ SIM_D10V_R2_REGNUM,
+ SIM_D10V_R3_REGNUM,
+ SIM_D10V_R4_REGNUM,
+ SIM_D10V_R5_REGNUM,
+ SIM_D10V_R6_REGNUM,
+ SIM_D10V_R7_REGNUM,
+ SIM_D10V_R8_REGNUM,
+ SIM_D10V_R9_REGNUM,
+ SIM_D10V_R10_REGNUM,
+ SIM_D10V_R11_REGNUM,
+ SIM_D10V_R12_REGNUM,
+ SIM_D10V_R13_REGNUM,
+ SIM_D10V_R14_REGNUM,
+ SIM_D10V_R15_REGNUM,
+ SIM_D10V_CR0_REGNUM,
+ SIM_D10V_CR1_REGNUM,
+ SIM_D10V_CR2_REGNUM,
+ SIM_D10V_CR3_REGNUM,
+ SIM_D10V_CR4_REGNUM,
+ SIM_D10V_CR5_REGNUM,
+ SIM_D10V_CR6_REGNUM,
+ SIM_D10V_CR7_REGNUM,
+ SIM_D10V_CR8_REGNUM,
+ SIM_D10V_CR9_REGNUM,
+ SIM_D10V_CR10_REGNUM,
+ SIM_D10V_CR11_REGNUM,
+ SIM_D10V_CR12_REGNUM,
+ SIM_D10V_CR13_REGNUM,
+ SIM_D10V_CR14_REGNUM,
+ SIM_D10V_CR15_REGNUM,
+ SIM_D10V_A0_REGNUM,
+ SIM_D10V_A1_REGNUM,
+ SIM_D10V_SPI_REGNUM,
+ SIM_D10V_SPU_REGNUM,
+ SIM_D10V_IMAP0_REGNUM,
+ SIM_D10V_IMAP1_REGNUM,
+ SIM_D10V_DMAP0_REGNUM,
+ SIM_D10V_DMAP1_REGNUM,
+ SIM_D10V_DMAP2_REGNUM,
+ SIM_D10V_DMAP3_REGNUM,
+ SIM_D10V_TS2_DMAP_REGNUM
+};
+
enum
- {
- SIM_D10V_R0_REGNUM = 0,
- SIM_D10V_CR0_REGNUM = 16,
- SIM_D10V_A0_REGNUM = 32,
- SIM_D10V_SPI_REGNUM = 34,
- SIM_D10V_SPU_REGNUM = 35,
- SIM_D10V_IMAP0_REGNUM = 36,
- SIM_D10V_DMAP0_REGNUM = 38,
- SIM_D10V_TS2_DMAP_REGNUM = 40
- };
-
-enum
- {
- SIM_D10V_NR_R_REGS = 16,
- SIM_D10V_NR_A_REGS = 2,
- SIM_D10V_NR_IMAP_REGS = 2,
- SIM_D10V_NR_DMAP_REGS = 4,
- SIM_D10V_NR_CR_REGS = 16
- };
+{
+ SIM_D10V_NR_R_REGS = 16,
+ SIM_D10V_NR_A_REGS = 2,
+ SIM_D10V_NR_IMAP_REGS = 2,
+ SIM_D10V_NR_DMAP_REGS = 4,
+ SIM_D10V_NR_CR_REGS = 16
+};
#ifdef __cplusplus
}
diff --git a/include/hashtab.h b/include/hashtab.h
index 8871710e5d8..7fb31e48c4e 100644
--- a/include/hashtab.h
+++ b/include/hashtab.h
@@ -38,6 +38,10 @@ extern "C" {
#include <ansidecl.h>
+#ifndef GTY
+#define GTY(X)
+#endif
+
/* The type for a hash code. */
typedef unsigned int hashval_t;
@@ -63,12 +67,21 @@ typedef void (*htab_del) PARAMS ((void *));
htab_traverse. Return 1 to continue scan, 0 to stop. */
typedef int (*htab_trav) PARAMS ((void **, void *));
+/* Memory-allocation function, with the same functionality as calloc().
+ Iff it returns NULL, the hash table implementation will pass an error
+ code back to the user, so if your code doesn't handle errors,
+ best if you use xcalloc instead. */
+typedef PTR (*htab_alloc) PARAMS ((size_t, size_t));
+
+/* We also need a free() routine. */
+typedef void (*htab_free) PARAMS ((PTR));
+
/* Hash tables are of the following type. The structure
(implementation) of this type is not needed for using the hash
tables. All work with hash table should be executed only through
functions mentioned below. */
-struct htab
+struct htab GTY(())
{
/* Pointer to hash function. */
htab_hash hash_f;
@@ -80,7 +93,7 @@ struct htab
htab_del del_f;
/* Table itself. */
- PTR *entries;
+ PTR * GTY ((use_param (""), length ("%h.size"))) entries;
/* Current size (in entries) of the hash table */
size_t size;
@@ -99,9 +112,9 @@ struct htab
of collisions fixed for time of work with the hash table. */
unsigned int collisions;
- /* This is non-zero if we are allowed to return NULL for function calls
- that allocate memory. */
- int return_allocation_failure;
+ /* Pointers to allocate/free functions. */
+ htab_alloc alloc_f;
+ htab_free free_f;
};
typedef struct htab *htab_t;
@@ -111,14 +124,14 @@ enum insert_option {NO_INSERT, INSERT};
/* The prototypes of the package functions. */
-extern htab_t htab_create PARAMS ((size_t, htab_hash,
- htab_eq, htab_del));
+extern htab_t htab_create_alloc PARAMS ((size_t, htab_hash,
+ htab_eq, htab_del,
+ htab_alloc, htab_free));
+
+/* Backward-compatibility functions. */
+extern htab_t htab_create PARAMS ((size_t, htab_hash, htab_eq, htab_del));
+extern htab_t htab_try_create PARAMS ((size_t, htab_hash, htab_eq, htab_del));
-/* This function is like htab_create, but may return NULL if memory
- allocation fails, and also signals that htab_find_slot_with_hash and
- htab_find_slot are allowed to return NULL when inserting. */
-extern htab_t htab_try_create PARAMS ((size_t, htab_hash,
- htab_eq, htab_del));
extern void htab_delete PARAMS ((htab_t));
extern void htab_empty PARAMS ((htab_t));
diff --git a/include/opcode/ChangeLog b/include/opcode/ChangeLog
index 2882ce56897..1d4c54af1e9 100644
--- a/include/opcode/ChangeLog
+++ b/include/opcode/ChangeLog
@@ -1,3 +1,38 @@
+2002-06-08 Alan Modra <amodra@bigpond.net.au>
+
+ * a29k.h: Replace CONST with const.
+ (CONST): Don't define.
+ * convex.h: Replace CONST with const.
+ (CONST): Don't define.
+ * dlx.h: Replace CONST with const.
+ * or32.h (CONST): Don't define.
+
+2002-05-30 Chris G. Demetriou <cgd@broadcom.com>
+
+ * mips.h (OP_SH_ALN, OP_MASK_ALN, OP_SH_VSEL, OP_MASK_VSEL)
+ (MDMX_FMTSEL_IMM_QH, MDMX_FMTSEL_IMM_OB, MDMX_FMTSEL_VEC_QH)
+ (MDMX_FMTSEL_VEC_OB, INSN_READ_MDMX_ACC, INSN_WRITE_MDMX_ACC)
+ (INSN_MDMX): New constants, for MDMX support.
+ (opcode character list): Add "O", "Q", "X", "Y", and "Z" for MDMX.
+
+2002-05-28 Kuang Hwa Lin <kuang@sbcglobal.net>
+
+ * dlx.h: New file.
+
+2002-05-25 Alan Modra <amodra@bigpond.net.au>
+
+ * ia64.h: Use #include "" instead of <> for local header files.
+ * sparc.h: Likewise.
+
+2002-05-22 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
+
+ * mips.h: Add M_DROL, M_DROL_I, M_DROR, M_DROR_I macro cases.
+
+2002-05-17 Andrey Volkov <avolkov@sources.redhat.com>
+
+ * h8300.h: Corrected defs of all control regs
+ and eepmov instr.
+
2002-04-11 Alan Modra <amodra@bigpond.net.au>
* i386.h: Add intel mode cmpsd and movsd.
diff --git a/include/opcode/a29k.h b/include/opcode/a29k.h
index 399be67ca5a..c6c8c370003 100644
--- a/include/opcode/a29k.h
+++ b/include/opcode/a29k.h
@@ -1,5 +1,5 @@
/* Table of opcodes for the AMD 29000 family.
- Copyright 1990, 1991, 1993, 1994 Free Software Foundation, Inc.
+ Copyright 1990, 1991, 1993, 1994, 2002 Free Software Foundation, Inc.
This file is part of GDB and GAS.
@@ -62,11 +62,7 @@ struct a29k_opcode {
char *args;
};
-#ifndef CONST
-#define CONST
-#endif /* CONST */
-
-static CONST struct a29k_opcode a29k_opcodes[] =
+static const struct a29k_opcode a29k_opcodes[] =
{
{ "add", 0x14000000, "c,a,b" },
@@ -282,4 +278,4 @@ static CONST struct a29k_opcode a29k_opcodes[] =
if we've run off the end of the table. */
};
-CONST unsigned int num_opcodes = (((sizeof a29k_opcodes) / (sizeof a29k_opcodes[0])) - 1);
+const unsigned int num_opcodes = (((sizeof a29k_opcodes) / (sizeof a29k_opcodes[0])) - 1);
diff --git a/include/opcode/convex.h b/include/opcode/convex.h
index 780b12d481a..ccf55682915 100644
--- a/include/opcode/convex.h
+++ b/include/opcode/convex.h
@@ -1,5 +1,5 @@
/* Information for instruction disassembly on the Convex.
- Copyright 1989, 1993 Free Software Foundation, Inc.
+ Copyright 1989, 1993, 2002 Free Software Foundation, Inc.
This file is part of GDB.
@@ -17,10 +17,6 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-#ifndef CONST
-#define CONST
-#endif /* CONST */
-
#define xxx 0
#define rrr 1
#define rr 2
@@ -67,7 +63,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define CPUID 20
#define TID 21
-CONST char *op[] = {
+const char *op[] = {
"",
"v0\0v1\0v2\0v3\0v4\0v5\0v6\0v7",
"s0\0s1\0s2\0s3\0s4\0s5\0s6\0s7",
@@ -92,7 +88,7 @@ CONST char *op[] = {
"tid",
};
-CONST struct formstr format0[] = {
+const struct formstr format0[] = {
{0,0,rrr,V,S,S}, /* mov */
{0,0,rrr,S,S,V}, /* mov */
{1,1,rrr,V,V,V}, /* merg.t */
@@ -159,7 +155,7 @@ CONST struct formstr format0[] = {
{4,8,rrr,V,S,V}, /* div.l */
};
-CONST struct formstr format1[] = {
+const struct formstr format1[] = {
{11,0,xxx,0,0,0}, /* exit */
{12,0,a3,0,0,0}, /* jmp */
{13,2,a3,0,0,0}, /* jmpi.f */
@@ -226,7 +222,7 @@ CONST struct formstr format1[] = {
{21,8,a2r,V,0,0}, /* st.l */
};
-CONST struct formstr format2[] = {
+const struct formstr format2[] = {
{28,5,rr,A,A,0}, /* cvtw.b */
{28,6,rr,A,A,0}, /* cvtw.h */
{29,7,rr,A,A,0}, /* cvtb.w */
@@ -357,7 +353,7 @@ CONST struct formstr format2[] = {
{4,8,rr,S,S,0}, /* div.l */
};
-CONST struct formstr format3[] = {
+const struct formstr format3[] = {
{32,3,rr,V,V,0}, /* cvtd.s */
{31,4,rr,V,V,0}, /* cvts.d */
{33,4,rr,V,V,0}, /* cvtl.d */
@@ -424,7 +420,7 @@ CONST struct formstr format3[] = {
{43,8,rr,S,S,0}, /* neg.l */
};
-CONST struct formstr format4[] = {
+const struct formstr format4[] = {
{46,0,nops,0,0,0}, /* nop */
{47,0,pcrel,0,0,0}, /* br */
{48,2,pcrel,0,0,0}, /* bri.f */
@@ -435,7 +431,7 @@ CONST struct formstr format4[] = {
{50,1,pcrel,0,0,0}, /* brs.t */
};
-CONST struct formstr format5[] = {
+const struct formstr format5[] = {
{51,5,rr,V,V,0}, /* ldvi.b */
{51,6,rr,V,V,0}, /* ldvi.h */
{51,7,rr,V,V,0}, /* ldvi.w */
@@ -454,7 +450,7 @@ CONST struct formstr format5[] = {
{52,8,rxr,S,V,0}, /* stvi.l */
};
-CONST struct formstr format6[] = {
+const struct formstr format6[] = {
{53,0,r,A,0,0}, /* ldsdr */
{54,0,r,A,0,0}, /* ldkdr */
{55,3,r,S,0,0}, /* ln.s */
@@ -521,7 +517,7 @@ CONST struct formstr format6[] = {
{83,4,r,S,0,0}, /* atan.d */
};
-CONST struct formstr format7[] = {
+const struct formstr format7[] = {
{84,5,r,V,0,0}, /* sum.b */
{84,6,r,V,0,0}, /* sum.h */
{84,7,r,V,0,0}, /* sum.w */
@@ -556,11 +552,11 @@ CONST struct formstr format7[] = {
{0,0,0,0,0,0},
};
-CONST struct formstr formatx[] = {
+const struct formstr formatx[] = {
{0,0,0,0,0,0},
};
-CONST struct formstr format1a[] = {
+const struct formstr format1a[] = {
{91,0,imr,A,0,0}, /* halt */
{92,0,a4,0,0,0}, /* sysc */
{18,6,imr,A,0,0}, /* ld.h */
@@ -595,7 +591,7 @@ CONST struct formstr format1a[] = {
{41,7,imr,A,0,0}, /* lt.w */
};
-CONST struct formstr format1b[] = {
+const struct formstr format1b[] = {
{18,4,imr,S,0,0}, /* ld.d */
{18,10,imr,S,0,0}, /* ld.u */
{18,8,imr,S,0,0}, /* ld.l */
@@ -630,7 +626,7 @@ CONST struct formstr format1b[] = {
{41,7,imr,S,0,0}, /* lt.w */
};
-CONST struct formstr e0_format0[] = {
+const struct formstr e0_format0[] = {
{10,3,rrr,S,V,V}, /* sub.s */
{10,4,rrr,S,V,V}, /* sub.d */
{4,3,rrr,S,V,V}, /* div.s */
@@ -697,7 +693,7 @@ CONST struct formstr e0_format0[] = {
{4,16,rrr,V,S,V}, /* div.l.f */
};
-CONST struct formstr e0_format1[] = {
+const struct formstr e0_format1[] = {
{0,0,0,0,0,0},
{94,0,a3,0,0,0}, /* tst */
{95,0,a3,0,0,0}, /* lck */
@@ -764,7 +760,7 @@ CONST struct formstr e0_format1[] = {
{21,16,a2r,V,0,0}, /* st.l.f */
};
-CONST struct formstr e0_format2[] = {
+const struct formstr e0_format2[] = {
{28,5,rr,V,V,0}, /* cvtw.b */
{28,6,rr,V,V,0}, /* cvtw.h */
{29,7,rr,V,V,0}, /* cvtb.w */
@@ -895,7 +891,7 @@ CONST struct formstr e0_format2[] = {
{0,0,0,0,0,0},
};
-CONST struct formstr e0_format3[] = {
+const struct formstr e0_format3[] = {
{32,11,rr,V,V,0}, /* cvtd.s.f */
{31,12,rr,V,V,0}, /* cvts.d.f */
{33,12,rr,V,V,0}, /* cvtl.d.f */
@@ -962,7 +958,7 @@ CONST struct formstr e0_format3[] = {
{0,0,0,0,0,0},
};
-CONST struct formstr e0_format4[] = {
+const struct formstr e0_format4[] = {
{0,0,0,0,0,0},
{0,0,0,0,0,0},
{0,0,0,0,0,0},
@@ -973,7 +969,7 @@ CONST struct formstr e0_format4[] = {
{0,0,0,0,0,0},
};
-CONST struct formstr e0_format5[] = {
+const struct formstr e0_format5[] = {
{51,13,rr,V,V,0}, /* ldvi.b.f */
{51,14,rr,V,V,0}, /* ldvi.h.f */
{51,15,rr,V,V,0}, /* ldvi.w.f */
@@ -992,7 +988,7 @@ CONST struct formstr e0_format5[] = {
{52,16,rxr,S,V,0}, /* stvi.l.f */
};
-CONST struct formstr e0_format6[] = {
+const struct formstr e0_format6[] = {
{0,0,rxl,S,CIR,0}, /* mov */
{0,0,lr,CIR,S,0}, /* mov */
{0,0,lr,TOC,S,0}, /* mov */
@@ -1059,7 +1055,7 @@ CONST struct formstr e0_format6[] = {
{0,0,0,0,0,0},
};
-CONST struct formstr e0_format7[] = {
+const struct formstr e0_format7[] = {
{84,13,r,V,0,0}, /* sum.b.f */
{84,14,r,V,0,0}, /* sum.h.f */
{84,15,r,V,0,0}, /* sum.w.f */
@@ -1094,7 +1090,7 @@ CONST struct formstr e0_format7[] = {
{0,0,0,0,0,0},
};
-CONST struct formstr e1_format0[] = {
+const struct formstr e1_format0[] = {
{0,0,0,0,0,0},
{0,0,0,0,0,0},
{0,0,0,0,0,0},
@@ -1161,7 +1157,7 @@ CONST struct formstr e1_format0[] = {
{4,23,rrr,V,S,V}, /* div.l.t */
};
-CONST struct formstr e1_format1[] = {
+const struct formstr e1_format1[] = {
{0,0,0,0,0,0},
{0,0,0,0,0,0},
{0,0,0,0,0,0},
@@ -1228,7 +1224,7 @@ CONST struct formstr e1_format1[] = {
{21,23,a2r,V,0,0}, /* st.l.t */
};
-CONST struct formstr e1_format2[] = {
+const struct formstr e1_format2[] = {
{0,0,0,0,0,0},
{0,0,0,0,0,0},
{0,0,0,0,0,0},
@@ -1359,7 +1355,7 @@ CONST struct formstr e1_format2[] = {
{0,0,0,0,0,0},
};
-CONST struct formstr e1_format3[] = {
+const struct formstr e1_format3[] = {
{32,18,rr,V,V,0}, /* cvtd.s.t */
{31,19,rr,V,V,0}, /* cvts.d.t */
{33,19,rr,V,V,0}, /* cvtl.d.t */
@@ -1426,7 +1422,7 @@ CONST struct formstr e1_format3[] = {
{0,0,0,0,0,0},
};
-CONST struct formstr e1_format4[] = {
+const struct formstr e1_format4[] = {
{0,0,0,0,0,0},
{0,0,0,0,0,0},
{0,0,0,0,0,0},
@@ -1437,7 +1433,7 @@ CONST struct formstr e1_format4[] = {
{0,0,0,0,0,0},
};
-CONST struct formstr e1_format5[] = {
+const struct formstr e1_format5[] = {
{51,20,rr,V,V,0}, /* ldvi.b.t */
{51,21,rr,V,V,0}, /* ldvi.h.t */
{51,22,rr,V,V,0}, /* ldvi.w.t */
@@ -1456,7 +1452,7 @@ CONST struct formstr e1_format5[] = {
{52,23,rxr,S,V,0}, /* stvi.l.t */
};
-CONST struct formstr e1_format6[] = {
+const struct formstr e1_format6[] = {
{0,0,0,0,0,0},
{0,0,0,0,0,0},
{0,0,0,0,0,0},
@@ -1523,7 +1519,7 @@ CONST struct formstr e1_format6[] = {
{0,0,0,0,0,0},
};
-CONST struct formstr e1_format7[] = {
+const struct formstr e1_format7[] = {
{84,20,r,V,0,0}, /* sum.b.t */
{84,21,r,V,0,0}, /* sum.h.t */
{84,22,r,V,0,0}, /* sum.w.t */
diff --git a/include/opcode/dlx.h b/include/opcode/dlx.h
new file mode 100644
index 00000000000..e1b249f8523
--- /dev/null
+++ b/include/opcode/dlx.h
@@ -0,0 +1,282 @@
+/* Table of opcodes for the DLX microprocess.
+ Copyright 2002 Free Software Foundation, Inc.
+
+ This file is part of GDB and GAS.
+
+ 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.
+
+ Initially created by Kuang Hwa Lin, 2002. */
+
+/* Following are the function codes for the Special OP (ALU). */
+#define ALUOP 0x00000000
+#define SPECIALOP 0x00000000
+
+#define NOPF 0x00000000
+#define SLLF 0x00000004
+#define SRLF 0x00000006
+#define SRAF 0x00000007
+
+#define SEQUF 0x00000010
+#define SNEUF 0x00000011
+#define SLTUF 0x00000012
+#define SGTUF 0x00000013
+#define SLEUF 0x00000014
+#define SGEUF 0x00000015
+
+#define ADDF 0x00000020
+#define ADDUF 0x00000021
+#define SUBF 0x00000022
+#define SUBUF 0x00000023
+#define ANDF 0x00000024
+#define ORF 0x00000025
+#define XORF 0x00000026
+
+#define SEQF 0x00000028
+#define SNEF 0x00000029
+#define SLTF 0x0000002A
+#define SGTF 0x0000002B
+#define SLEF 0x0000002C
+#define SGEF 0x0000002D
+ /* Following special functions was not mentioned in the
+ Hennessy's book but was implemented in the RTL. */
+#define MVTSF 0x00000030
+#define MVFSF 0x00000031
+#define BSWAPF 0x00000032
+#define LUTF 0x00000033
+/* Following special functions was mentioned in the
+ Hennessy's book but was not implemented in the RTL. */
+#define MULTF 0x00000005
+#define MULTUF 0x00000006
+#define DIVF 0x00000007
+#define DIVUF 0x00000008
+
+
+/* Following are the rest of the OPcodes:
+ JOP = (0x002 << 26), JALOP = (0x003 << 26), BEQOP = (0x004 << 26), BNEOP = (0x005 << 26)
+ ADDIOP = (0x008 << 26), ADDUIOP= (0x009 << 26), SUBIOP = (0x00A << 26), SUBUIOP= (0x00B << 26)
+ ANDIOP = (0x00C << 26), ORIOP = (0x00D << 26), XORIOP = (0x00E << 26), LHIOP = (0x00F << 26)
+ RFEOP = (0x010 << 26), TRAPOP = (0x011 << 26), JROP = (0x012 << 26), JALROP = (0x013 << 26)
+ BREAKOP= (0x014 << 26)
+ SEQIOP = (0x018 << 26), SNEIOP = (0x019 << 26), SLTIOP = (0x01A << 26), SGTIOP = (0x01B << 26)
+ SLEIOP = (0x01C << 26), SGEIOP = (0x01D << 26)
+ LBOP = (0x020 << 26), LHOP = (0x021 << 26), LWOP = (0x023 << 26), LBUOP = (0x024 << 26)
+ LHUOP = (0x025 << 26), SBOP = (0x028 << 26), SHOP = (0x029 << 26), SWOP = (0x02B << 26)
+ LSBUOP = (0x026 << 26), LSHU = (0x027 << 26), LSW = (0x02C << 26),
+ SEQUIOP= (0x030 << 26), SNEUIOP= (0x031 << 26), SLTUIOP= (0x032 << 26), SGTUIOP= (0x033 << 26)
+ SLEUIOP= (0x034 << 26), SGEUIOP= (0x035 << 26)
+ SLLIOP = (0x036 << 26), SRLIOP = (0x037 << 26), SRAIOP = (0x038 << 26). */
+#define JOP 0x08000000
+#define JALOP 0x0c000000
+#define BEQOP 0x10000000
+#define BNEOP 0x14000000
+
+#define ADDIOP 0x20000000
+#define ADDUIOP 0x24000000
+#define SUBIOP 0x28000000
+#define SUBUIOP 0x2c000000
+#define ANDIOP 0x30000000
+#define ORIOP 0x34000000
+#define XORIOP 0x38000000
+#define LHIOP 0x3c000000
+#define RFEOP 0x40000000
+#define TRAPOP 0x44000000
+#define JROP 0x48000000
+#define JALROP 0x4c000000
+#define BREAKOP 0x50000000
+
+#define SEQIOP 0x60000000
+#define SNEIOP 0x64000000
+#define SLTIOP 0x68000000
+#define SGTIOP 0x6c000000
+#define SLEIOP 0x70000000
+#define SGEIOP 0x74000000
+
+#define LBOP 0x80000000
+#define LHOP 0x84000000
+#define LWOP 0x8c000000
+#define LBUOP 0x90000000
+#define LHUOP 0x94000000
+#define LDSTBU
+#define LDSTHU
+#define SBOP 0xa0000000
+#define SHOP 0xa4000000
+#define SWOP 0xac000000
+#define LDST
+
+#define SEQUIOP 0xc0000000
+#define SNEUIOP 0xc4000000
+#define SLTUIOP 0xc8000000
+#define SGTUIOP 0xcc000000
+#define SLEUIOP 0xd0000000
+#define SGEUIOP 0xd4000000
+
+#define SLLIOP 0xd8000000
+#define SRLIOP 0xdc000000
+#define SRAIOP 0xe0000000
+
+/* Following 3 ops was added to provide the MP atonmic operation. */
+#define LSBUOP 0x98000000
+#define LSHUOP 0x9c000000
+#define LSWOP 0xb0000000
+
+/* Following opcode was defined in the Hennessy's book as
+ "normal" opcode but was implemented in the RTL as special
+ functions. */
+#if 0
+#define MVTSOP 0x50000000
+#define MVFSOP 0x54000000
+#endif
+
+struct dlx_opcode
+{
+ /* Name of the instruction. */
+ char *name;
+
+ /* Opcode word. */
+ unsigned long opcode;
+
+ /* A string of characters which describe the operands.
+ Valid characters are:
+ , Itself. The character appears in the assembly code.
+ a rs1 The register number is in bits 21-25 of the instruction.
+ b rs2/rd The register number is in bits 16-20 of the instruction.
+ c rd. The register number is in bits 11-15 of the instruction.
+ f FUNC bits 0-10 of the instruction.
+ i An immediate operand is in bits 0-16 of the instruction. 0 extended
+ I An immediate operand is in bits 0-16 of the instruction. sign extended
+ d An 16 bit PC relative displacement.
+ D An immediate operand is in bits 0-25 of the instruction.
+ N No opperands needed, for nops.
+ P it can be a register or a 16 bit operand. */
+ char *args;
+};
+
+static const struct dlx_opcode dlx_opcodes[] =
+ {
+ /* Arithmetic and Logic R-TYPE instructions. */
+ { "nop", (ALUOP|NOPF), "N" }, /* NOP */
+ { "add", (ALUOP|ADDF), "c,a,b" }, /* Add */
+ { "addu", (ALUOP|ADDUF), "c,a,b" }, /* Add Unsigned */
+ { "sub", (ALUOP|SUBF), "c,a,b" }, /* SUB */
+ { "subu", (ALUOP|SUBUF), "c,a,b" }, /* Sub Unsigned */
+ { "mult", (ALUOP|MULTF), "c,a,b" }, /* MULTIPLY */
+ { "multu", (ALUOP|MULTUF), "c,a,b" }, /* MULTIPLY Unsigned */
+ { "div", (ALUOP|DIVF), "c,a,b" }, /* DIVIDE */
+ { "divu", (ALUOP|DIVUF), "c,a,b" }, /* DIVIDE Unsigned */
+ { "and", (ALUOP|ANDF), "c,a,b" }, /* AND */
+ { "or", (ALUOP|ORF), "c,a,b" }, /* OR */
+ { "xor", (ALUOP|XORF), "c,a,b" }, /* Exclusive OR */
+ { "sll", (ALUOP|SLLF), "c,a,b" }, /* SHIFT LEFT LOGICAL */
+ { "sra", (ALUOP|SRAF), "c,a,b" }, /* SHIFT RIGHT ARITHMETIC */
+ { "srl", (ALUOP|SRLF), "c,a,b" }, /* SHIFT RIGHT LOGICAL */
+ { "seq", (ALUOP|SEQF), "c,a,b" }, /* Set if equal */
+ { "sne", (ALUOP|SNEF), "c,a,b" }, /* Set if not equal */
+ { "slt", (ALUOP|SLTF), "c,a,b" }, /* Set if less */
+ { "sgt", (ALUOP|SGTF), "c,a,b" }, /* Set if greater */
+ { "sle", (ALUOP|SLEF), "c,a,b" }, /* Set if less or equal */
+ { "sge", (ALUOP|SGEF), "c,a,b" }, /* Set if greater or equal */
+ { "sequ", (ALUOP|SEQUF), "c,a,b" }, /* Set if equal unsigned */
+ { "sneu", (ALUOP|SNEUF), "c,a,b" }, /* Set if not equal unsigned */
+ { "sltu", (ALUOP|SLTUF), "c,a,b" }, /* Set if less unsigned */
+ { "sgtu", (ALUOP|SGTUF), "c,a,b" }, /* Set if greater unsigned */
+ { "sleu", (ALUOP|SLEUF), "c,a,b" }, /* Set if less or equal unsigned*/
+ { "sgeu", (ALUOP|SGEUF), "c,a,b" }, /* Set if greater or equal */
+ { "mvts", (ALUOP|MVTSF), "c,a" }, /* Move to special register */
+ { "mvfs", (ALUOP|MVFSF), "c,a" }, /* Move from special register */
+ { "bswap", (ALUOP|BSWAPF), "c,a,b" }, /* ??? Was not documented */
+ { "lut", (ALUOP|LUTF), "c,a,b" }, /* ????? same as above */
+
+ /* Arithmetic and Logical Immediate I-TYPE instructions. */
+ { "addi", ADDIOP, "b,a,I" }, /* Add Immediate */
+ { "addui", ADDUIOP, "b,a,i" }, /* Add Usigned Immediate */
+ { "subi", SUBIOP, "b,a,I" }, /* Sub Immediate */
+ { "subui", SUBUIOP, "b,a,i" }, /* Sub Unsigned Immedated */
+ { "andi", ANDIOP, "b,a,i" }, /* AND Immediate */
+ { "ori", ORIOP, "b,a,i" }, /* OR Immediate */
+ { "xori", XORIOP, "b,a,i" }, /* Exclusive OR Immediate */
+ { "slli", SLLIOP, "b,a,i" }, /* SHIFT LEFT LOCICAL Immediate */
+ { "srai", SRAIOP, "b,a,i" }, /* SHIFT RIGHT ARITH. Immediate */
+ { "srli", SRLIOP, "b,a,i" }, /* SHIFT RIGHT LOGICAL Immediate*/
+ { "seqi", SEQIOP, "b,a,i" }, /* Set if equal */
+ { "snei", SNEIOP, "b,a,i" }, /* Set if not equal */
+ { "slti", SLTIOP, "b,a,i" }, /* Set if less */
+ { "sgti", SGTIOP, "b,a,i" }, /* Set if greater */
+ { "slei", SLEIOP, "b,a,i" }, /* Set if less or equal */
+ { "sgei", SGEIOP, "b,a,i" }, /* Set if greater or equal */
+ { "sequi", SEQUIOP, "b,a,i" }, /* Set if equal */
+ { "sneui", SNEUIOP, "b,a,i" }, /* Set if not equal */
+ { "sltui", SLTUIOP, "b,a,i" }, /* Set if less */
+ { "sgtui", SGTUIOP, "b,a,i" }, /* Set if greater */
+ { "sleui", SLEUIOP, "b,a,i" }, /* Set if less or equal */
+ { "sgeui", SGEUIOP, "b,a,i" }, /* Set if greater or equal */
+ /* Macros for I type instructions. */
+ { "mov", ADDIOP, "b,P" }, /* a move macro */
+ { "movu", ADDUIOP, "b,P" }, /* a move macro, unsigned */
+
+#if 0
+ /* Move special. */
+ { "mvts", MVTSOP, "b,a" }, /* Move From Integer to Special */
+ { "mvfs", MVFSOP, "b,a" }, /* Move From Special to Integer */
+#endif
+
+ /* Load high Immediate I-TYPE instruction. */
+ { "lhi", LHIOP, "b,i" }, /* Load High Immediate */
+ { "lui", LHIOP, "b,i" }, /* Load High Immediate */
+ { "sethi", LHIOP, "b,i" }, /* Load High Immediate */
+
+ /* LOAD/STORE BYTE 8 bits I-TYPE. */
+ { "lb", LBOP, "b,a,I" }, /* Load Byte */
+ { "lbu", LBUOP, "b,a,I" }, /* Load Byte Unsigned */
+ { "ldstbu", LSBUOP, "b,a,I" }, /* Load store Byte Unsigned */
+ { "sb", SBOP, "b,a,I" }, /* Store Byte */
+
+ /* LOAD/STORE HALFWORD 16 bits. */
+ { "lh", LHOP, "b,a,I" }, /* Load Halfword */
+ { "lhu", LHUOP, "b,a,I" }, /* Load Halfword Unsigned */
+ { "ldsthu", LSHUOP, "b,a,I" }, /* Load Store Halfword Unsigned */
+ { "sh", SHOP, "b,a,I" }, /* Store Halfword */
+
+ /* LOAD/STORE WORD 32 bits. */
+ { "lw", LWOP, "b,a,I" }, /* Load Word */
+ { "sw", SWOP, "b,a,I" }, /* Store Word */
+ { "ldstw", LSWOP, "b,a,I" }, /* Load Store Word */
+
+ /* Branch PC-relative, 16 bits offset. */
+ { "beqz", BEQOP, "a,d" }, /* Branch if a == 0 */
+ { "bnez", BNEOP, "a,d" }, /* Branch if a != 0 */
+ { "beq", BEQOP, "a,d" }, /* Branch if a == 0 */
+ { "bne", BNEOP, "a,d" }, /* Branch if a != 0 */
+
+ /* Jumps Trap and RFE J-TYPE. */
+ { "j", JOP, "D" }, /* Jump, PC-relative 26 bits */
+ { "jal", JALOP, "D" }, /* JAL, PC-relative 26 bits */
+ { "break", BREAKOP, "D" }, /* break to OS */
+ { "trap" , TRAPOP, "D" }, /* TRAP to OS */
+ { "rfe", RFEOP, "N" }, /* Return From Exception */
+ /* Macros. */
+ { "call", JOP, "D" }, /* Jump, PC-relative 26 bits */
+
+ /* Jumps Trap and RFE I-TYPE. */
+ { "jr", JROP, "a" }, /* Jump Register, Abs (32 bits) */
+ { "jalr", JALROP, "a" }, /* JALR, Abs (32 bits) */
+ /* Macros. */
+ { "retr", JROP, "a" }, /* Jump Register, Abs (32 bits) */
+
+ { "", 0x0, "" } /* Dummy entry, not included in NUM_OPCODES.
+ This lets code examine entry i + 1 without
+ checking if we've run off the end of the table. */
+ };
+
+const unsigned int num_dlx_opcodes = (((sizeof dlx_opcodes) / (sizeof dlx_opcodes[0])) - 1);
diff --git a/include/opcode/h8300.h b/include/opcode/h8300.h
index 9cd40a6cb89..18d17c537dc 100644
--- a/include/opcode/h8300.h
+++ b/include/opcode/h8300.h
@@ -333,8 +333,8 @@ struct h8_opcode h8_opcodes[] =
NEW_SOP(O(O_AND,SL),0,6,"and.l"),{{IMM32,RD32,E }},{{0x7,0xA,0x6,B30|RD32,IMM32LIST,E}} EOP,
NEW_SOP(O(O_AND,SL),0,2,"and.l") ,{{RS32,RD32,E }},{{0x0,0x1,0xF,0x0,0x6,0x6,B30|RS32,B30|RD32,E}} EOP,
- NEW_SOP(O(O_ANDC,SB),1,2,"andc"), {{IMM8,CCR,E}},{{ 0x0,0x6,IMM8,IGNORE,E,0,0,0,0}} EOP,
- NEW_SOP(O(O_ANDC,SB),1,2,"andc"), {{IMM8,EXR,E}},{{ 0x0,0x1,0x4,0x1,0x0,0x6,IMM8,IGNORE,E,0,0,0,0}} EOP,
+ NEW_SOP(O(O_ANDC,SB),1,2,"andc"), {{IMM8,CCR|DST,E}},{{ 0x0,0x6,IMM8,IGNORE,E,0,0,0,0}} EOP,
+ NEW_SOP(O(O_ANDC,SB),1,2,"andc"), {{IMM8,EXR|DST,E}},{{ 0x0,0x1,0x4,0x1,0x0,0x6,IMM8,IGNORE,E,0,0,0,0}} EOP,
BITOP(O(O_BAND,SB), IMM3|B30,"band",0x7,0x6,0x7,0xC,0x7,0xE,0x0),
BRANCH(O(O_BRA,SB),"bra",0x0),
@@ -391,14 +391,14 @@ struct h8_opcode h8_opcodes[] =
NEW_SOP(O(O_DEC, SW),0,2,"dec.w") ,{{DBIT,RD16,E }},{{0x1,0xB,0x5|DBIT,RD16,E}} EOP,
NEW_SOP(O(O_DEC, SL),0,2,"dec.l") ,{{DBIT,RD32,E }},{{0x1,0xB,0x7|DBIT,RD32|B30,E}} EOP,
- NEW_SOP(O(O_DIVU,SB),1,6,"divxu.b"), {{RS8,RD16,E}}, {{0x5,0x1,RS8,RD16,E,0,0,0,0}}EOP,
- NEW_SOP(O(O_DIVU,SW),0,20,"divxu.w"),{{RS16,RD32,E}},{{0x5,0x3,RS16,B30|RD32,E}}EOP,
+ NEW_SOP(O(O_DIVU,SB),1,13,"divxu.b"), {{RS8,RD16,E}}, {{0x5,0x1,RS8,RD16,E,0,0,0,0}}EOP,
+ NEW_SOP(O(O_DIVU,SW),0,21,"divxu.w"),{{RS16,RD32,E}},{{0x5,0x3,RS16,B30|RD32,E}}EOP,
- NEW_SOP(O(O_DIVS,SB),0,20,"divxs.b") ,{{RS8,RD16,E }},{{0x0,0x1,0xD,0x0,0x5,0x1,RS8,RD16,E}} EOP,
- NEW_SOP(O(O_DIVS,SW),0,02,"divxs.w") ,{{RS16,RD32,E }},{{0x0,0x1,0xD,0x0,0x5,0x3,RS16,B30|RD32,E}} EOP,
+ NEW_SOP(O(O_DIVS,SB),0,13,"divxs.b") ,{{RS8,RD16,E }},{{0x0,0x1,0xD,0x0,0x5,0x1,RS8,RD16,E}} EOP,
+ NEW_SOP(O(O_DIVS,SW),0,21,"divxs.w") ,{{RS16,RD32,E }},{{0x0,0x1,0xD,0x0,0x5,0x3,RS16,B30|RD32,E}} EOP,
- NEW_SOP(O(O_EEPMOV,SB),1,50,"eepmov.b"),{{E,0,0}},{{0x7,0xB,0x5,0xC,0x5,0x9,0x8,0xF,E}}EOP,
- NEW_SOP(O(O_EEPMOV,SW),0,50,"eepmov.w"),{{E,0,0}},{{0x7,0xB,0xD,0x4,0x5,0x9,0x8,0xF,E}} EOP,
+ NEW_SOP(O(O_EEPMOV,SB),1,4,"eepmov.b"),{{E,0,0}},{{0x7,0xB,0x5,0xC,0x5,0x9,0x8,0xF,E}}EOP,
+ NEW_SOP(O(O_EEPMOV,SW),0,4,"eepmov.w"),{{E,0,0}},{{0x7,0xB,0xD,0x4,0x5,0x9,0x8,0xF,E}} EOP,
NEW_SOP(O(O_EXTS,SW),0,2,"exts.w"),{{OR16,E,0}},{{0x1,0x7,0xD,OR16,E }}EOP,
NEW_SOP(O(O_EXTS,SL),0,2,"exts.l"),{{OR32,E,0}},{{0x1,0x7,0xF,OR32|B30,E }}EOP,
@@ -419,23 +419,23 @@ struct h8_opcode h8_opcodes[] =
SOP(O(O_JSR,SB),8,"jsr"),{{SRC|ABSJMP,E,0}},{{0x5,0xE,SRC|ABSJMP,IGNORE,IGNORE,IGNORE,IGNORE,IGNORE,E}}EOP,
SOP(O(O_JSR,SB),8,"jsr"),{{SRC|MEMIND,E,0}},{{0x5,0xF,SRC|MEMIND,IGNORE,E,0,0,0,0}}EOP,
- NEW_SOP(O(O_LDC,SB),1,2,"ldc"),{{IMM8,CCR,E}}, {{ 0x0,0x7,IMM8,IGNORE,E,0,0,0,0}}EOP,
- NEW_SOP(O(O_LDC,SB),1,2,"ldc"),{{OR8,CCR,E}}, {{ 0x0,0x3,0x0,OR8,E,0,0,0,0}}EOP,
- NEW_SOP(O(O_LDC,SB),0,2,"ldc"),{{ABS16SRC,CCR,E}}, {{PREFIXLDC,0x6,0xB,0x0,0x0,ABS16SRC,IGNORE,IGNORE,IGNORE,E}}EOP,
- NEW_SOP(O(O_LDC,SB),0,2,"ldc"),{{ABS32SRC,CCR,E}}, {{PREFIXLDC,0x6,0xB,0x2,0x0,SRC|ABS32LIST,E}}EOP,
- NEW_SOP(O(O_LDC,SB),0,2,"ldc"),{{DISP|SRC|L_16,CCR,E}},{{PREFIXLDC,0x6,0xF,B30|DISPREG,0,DISP|L_16,IGNORE,IGNORE,IGNORE,E}}EOP,
- NEW_SOP(O(O_LDC,SB),0,2,"ldc"),{{DISP|SRC|L_32,CCR,E}},{{PREFIXLDC,0x7,0x8,B30|DISPREG,0,0x6,0xB,0x2,0x0,SRC|DISP32LIST,E}}EOP,
- NEW_SOP(O(O_LDC,SB),0,2,"ldc"),{{RSINC,CCR,E}}, {{PREFIXLDC,0x6,0xD,B30|RSINC,0x0,E}}EOP,
- NEW_SOP(O(O_LDC,SB),0,2,"ldc"),{{RSIND,CCR,E}}, {{PREFIXLDC,0x6,0x9,B30|RDIND,0x0,E}} EOP,
-
- NEW_SOP(O(O_LDC,SB),1,2,"ldc"),{{IMM8,EXR,E}}, {{ 0x0,0x1,0x4,0x1,0x0,0x7,IMM8,IGNORE,E,0,0,0,0}}EOP,
- NEW_SOP(O(O_LDC,SB),1,2,"ldc"),{{OR8,EXR,E}}, {{ 0x0,0x3,0x1,OR8,E,0,0,0,0}}EOP,
- NEW_SOP(O(O_LDC,SB),0,2,"ldc"),{{ABS16SRC,EXR,E}}, {{ 0x0,0x1,0x4,0x1,0x6,0xb,0x0,0x0,ABS16SRC,IGNORE,IGNORE,IGNORE,E}}EOP,
- NEW_SOP(O(O_LDC,SB),0,2,"ldc"),{{ABS32SRC,EXR,E}}, {{ 0x0,0x1,0x4,0x1,0x6,0xb,0x2,0x0,SRC|ABS32LIST,E}}EOP,
- NEW_SOP(O(O_LDC,SB),0,2,"ldc"),{{DISP|SRC|L_16,EXR,E}},{{ 0x0,0x1,0x4,0x1,0x6,0xf,B30|DISPREG,0,DISP|L_16,IGNORE,IGNORE,IGNORE,E}}EOP,
- NEW_SOP(O(O_LDC,SB),0,2,"ldc"),{{DISP|SRC|L_32,EXR,E}},{{ 0x0,0x1,0x4,0x1,0x7,0x8,B30|DISPREG,0,0x6,0xB,0x2,0x0,SRC|DISP32LIST,E}}EOP,
- NEW_SOP(O(O_LDC,SB),0,2,"ldc"),{{RSINC,EXR,E}}, {{ 0x0,0x1,0x4,0x1,0x6,0xd,B30|RSINC,0x0,E}}EOP,
- NEW_SOP(O(O_LDC,SB),0,2,"ldc"),{{RSIND,EXR,E}}, {{ 0x0,0x1,0x4,0x1,0x6,0x9,B30|RDIND,0x0,E}} EOP,
+ NEW_SOP(O(O_LDC,SB),1,2,"ldc"),{{IMM8,CCR|DST,E}}, {{ 0x0,0x7,IMM8,IGNORE,E,0,0,0,0}}EOP,
+ NEW_SOP(O(O_LDC,SB),1,2,"ldc"),{{OR8,CCR|DST,E}}, {{ 0x0,0x3,0x0,OR8,E,0,0,0,0}}EOP,
+ NEW_SOP(O(O_LDC,SB),0,2,"ldc"),{{ABS16SRC,CCR|DST,E}}, {{PREFIXLDC,0x6,0xB,0x0,0x0,ABS16SRC,IGNORE,IGNORE,IGNORE,E}}EOP,
+ NEW_SOP(O(O_LDC,SB),0,2,"ldc"),{{ABS32SRC,CCR|DST,E}}, {{PREFIXLDC,0x6,0xB,0x2,0x0,SRC|ABS32LIST,E}}EOP,
+ NEW_SOP(O(O_LDC,SB),0,2,"ldc"),{{DISP|SRC|L_16,CCR|DST,E}},{{PREFIXLDC,0x6,0xF,B30|DISPREG,0,DISP|L_16,IGNORE,IGNORE,IGNORE,E}}EOP,
+ NEW_SOP(O(O_LDC,SB),0,2,"ldc"),{{DISP|SRC|L_32,CCR|DST,E}},{{PREFIXLDC,0x7,0x8,B30|DISPREG,0,0x6,0xB,0x2,0x0,SRC|DISP32LIST,E}}EOP,
+ NEW_SOP(O(O_LDC,SB),0,2,"ldc"),{{RSINC,CCR|DST,E}}, {{PREFIXLDC,0x6,0xD,B30|RSINC,0x0,E}}EOP,
+ NEW_SOP(O(O_LDC,SB),0,2,"ldc"),{{RSIND,CCR|DST,E}}, {{PREFIXLDC,0x6,0x9,B30|RDIND,0x0,E}} EOP,
+
+ NEW_SOP(O(O_LDC,SB),1,2,"ldc"),{{IMM8,EXR|DST,E}}, {{ 0x0,0x1,0x4,0x1,0x0,0x7,IMM8,IGNORE,E,0,0,0,0}}EOP,
+ NEW_SOP(O(O_LDC,SB),1,2,"ldc"),{{OR8,EXR|DST,E}}, {{ 0x0,0x3,0x1,OR8,E,0,0,0,0}}EOP,
+ NEW_SOP(O(O_LDC,SB),0,2,"ldc"),{{ABS16SRC,EXR|DST,E}}, {{ 0x0,0x1,0x4,0x1,0x6,0xb,0x0,0x0,ABS16SRC,IGNORE,IGNORE,IGNORE,E}}EOP,
+ NEW_SOP(O(O_LDC,SB),0,2,"ldc"),{{ABS32SRC,EXR|DST,E}}, {{ 0x0,0x1,0x4,0x1,0x6,0xb,0x2,0x0,SRC|ABS32LIST,E}}EOP,
+ NEW_SOP(O(O_LDC,SB),0,2,"ldc"),{{DISP|SRC|L_16,EXR|DST,E}},{{ 0x0,0x1,0x4,0x1,0x6,0xf,B30|DISPREG,0,DISP|L_16,IGNORE,IGNORE,IGNORE,E}}EOP,
+ NEW_SOP(O(O_LDC,SB),0,2,"ldc"),{{DISP|SRC|L_32,EXR|DST,E}},{{ 0x0,0x1,0x4,0x1,0x7,0x8,B30|DISPREG,0,0x6,0xB,0x2,0x0,SRC|DISP32LIST,E}}EOP,
+ NEW_SOP(O(O_LDC,SB),0,2,"ldc"),{{RSINC,EXR|DST,E}}, {{ 0x0,0x1,0x4,0x1,0x6,0xd,B30|RSINC,0x0,E}}EOP,
+ NEW_SOP(O(O_LDC,SB),0,2,"ldc"),{{RSIND,EXR|DST,E}}, {{ 0x0,0x1,0x4,0x1,0x6,0x9,B30|RDIND,0x0,E}} EOP,
SOP(O(O_MOV_TO_REG,SB),4,"mov.b"),{{ABS|SRC|L_16|MEMRELAX,RD8,E}}, {{ 0x6,0xA,0x0,RD8,SRC|ABS|MEMRELAX|A16LIST,E}}EOP,
SOP(O(O_MOV_TO_REG,SB),6,"mov.b"),{{ABS|SRC|L_32|MEMRELAX,RD8,E }}, {{ 0x6,0xA,0x2,RD8,SRC|ABS|MEMRELAX|A32LIST,E }}EOP,
@@ -520,8 +520,8 @@ struct h8_opcode h8_opcodes[] =
NEW_SOP(O(O_OR,SL),0,6,"or.l"),{{IMM32,RD32,E }},{{0x7,0xA,0x4,B30|RD32,IMM32LIST,E}} EOP,
NEW_SOP(O(O_OR,SL),0,2,"or.l"),{{RS32,RD32,E }},{{0x0,0x1,0xF,0x0,0x6,0x4,B30|RS32,B30|RD32,E}} EOP,
- NEW_SOP(O(O_ORC,SB),1,2,"orc"),{{IMM8,CCR,E}},{{ 0x0,0x4,IMM8,IGNORE,E,0,0,0,0}}EOP,
- NEW_SOP(O(O_ORC,SB),1,2,"orc"),{{IMM8,EXR,E}},{{ 0x0,0x1,0x4,0x1,0x0,0x4,IMM8,IGNORE,E,0,0,0,0}}EOP,
+ NEW_SOP(O(O_ORC,SB),1,2,"orc"),{{IMM8,CCR|DST,E}},{{ 0x0,0x4,IMM8,IGNORE,E,0,0,0,0}}EOP,
+ NEW_SOP(O(O_ORC,SB),1,2,"orc"),{{IMM8,EXR|DST,E}},{{ 0x0,0x1,0x4,0x1,0x0,0x4,IMM8,IGNORE,E,0,0,0,0}}EOP,
NEW_SOP(O(O_MOV_TO_REG,SW),1,6,"pop.w"),{{OR16,E,0}},{{ 0x6,0xD,0x7,OR16,E,0,0,0,0}}EOP,
NEW_SOP(O(O_MOV_TO_REG,SL),0,6,"pop.l"),{{OR32,E,0}},{{ PREFIX32,0x6,0xD,0x7,OR32|B30,E,0,0,0,0}}EOP,
@@ -544,25 +544,25 @@ struct h8_opcode h8_opcodes[] =
SOP(O(O_SLEEP,SN),2,"sleep"),{{E,0,0}},{{ 0x0,0x1,0x8,0x0,E,0,0,0,0}} EOP,
- NEW_SOP(O(O_STC,SB), 1,2,"stc"),{{CCR,RD8,E}},{{ 0x0,0x2,0x0,RD8,E,0,0,0,0}} EOP,
+ NEW_SOP(O(O_STC,SB), 1,2,"stc"),{{CCR|SRC,RD8,E}},{{ 0x0,0x2,0x0,RD8,E,0,0,0,0}} EOP,
- NEW_SOP(O(O_STC,SB),0,2,"stc"),{{CCR,RSIND,E}}, {{PREFIXLDC,0x6,0x9,B31|RDIND,0x0,E}} EOP,
- NEW_SOP(O(O_STC,SB),0,2,"stc"),{{CCR,DISP|DST|L_16,E}},{{PREFIXLDC,0x6,0xF,B31|DISPREG,0,DST|DISP|L_16,IGNORE,IGNORE,IGNORE,E}}EOP,
- NEW_SOP(O(O_STC,SB),0,2,"stc"),{{CCR,DISP|DST|L_32,E}},{{PREFIXLDC,0x7,0x8,B30|DISPREG,0,0x6,0xB,0xA,0x0,DST|DISP32LIST,E}}EOP,
- NEW_SOP(O(O_STC,SB),0,2,"stc"),{{CCR,RDDEC,E}}, {{PREFIXLDC,0x6,0xD,B31|RDDEC,0x0,E}}EOP,
+ NEW_SOP(O(O_STC,SB),0,2,"stc"),{{CCR|SRC,RSIND,E}}, {{PREFIXLDC,0x6,0x9,B31|RDIND,0x0,E}} EOP,
+ NEW_SOP(O(O_STC,SB),0,2,"stc"),{{CCR|SRC,DISP|DST|L_16,E}},{{PREFIXLDC,0x6,0xF,B31|DISPREG,0,DST|DISP|L_16,IGNORE,IGNORE,IGNORE,E}}EOP,
+ NEW_SOP(O(O_STC,SB),0,2,"stc"),{{CCR|SRC,DISP|DST|L_32,E}},{{PREFIXLDC,0x7,0x8,B30|DISPREG,0,0x6,0xB,0xA,0x0,DST|DISP32LIST,E}}EOP,
+ NEW_SOP(O(O_STC,SB),0,2,"stc"),{{CCR|SRC,RDDEC,E}}, {{PREFIXLDC,0x6,0xD,B31|RDDEC,0x0,E}}EOP,
- NEW_SOP(O(O_STC,SB),0,2,"stc"),{{CCR,ABS16SRC,E}}, {{PREFIXLDC,0x6,0xB,0x8,0x0,ABS16DST,IGNORE,IGNORE,IGNORE,E}}EOP,
- NEW_SOP(O(O_STC,SB),0,2,"stc"),{{CCR,ABS32SRC,E}}, {{PREFIXLDC,0x6,0xB,0xA,0x0,DST|ABS32LIST,E}}EOP,
+ NEW_SOP(O(O_STC,SB),0,2,"stc"),{{CCR|SRC,ABS16DST,E}}, {{PREFIXLDC,0x6,0xB,0x8,0x0,ABS16DST,IGNORE,IGNORE,IGNORE,E}}EOP,
+ NEW_SOP(O(O_STC,SB),0,2,"stc"),{{CCR|SRC,ABS32DST,E}}, {{PREFIXLDC,0x6,0xB,0xA,0x0,DST|ABS32LIST,E}}EOP,
- NEW_SOP(O(O_STC,SB), 1,2,"stc"),{{EXR,RD8,E}},{{ 0x0,0x2,0x1,RD8,E,0,0,0,0}} EOP,
+ NEW_SOP(O(O_STC,SB), 1,2,"stc"),{{EXR|SRC,RD8,E}},{{ 0x0,0x2,0x1,RD8,E,0,0,0,0}} EOP,
- NEW_SOP(O(O_STC,SB),0,2,"stc"),{{EXR,RSIND,E}}, {{0x0,0x1,0x4,0x1,0x6,0x9,B31|RDIND,0x0,E}} EOP,
- NEW_SOP(O(O_STC,SB),0,2,"stc"),{{EXR,DISP|DST|L_16,E}},{{0x0,0x1,0x4,0x1,0x6,0xF,B31|DISPREG,0,DST|DISP|L_16,IGNORE,IGNORE,IGNORE,E}}EOP,
- NEW_SOP(O(O_STC,SB),0,2,"stc"),{{EXR,DISP|DST|L_32,E}},{{0x0,0x1,0x4,0x1,0x7,0x8,B30|DISPREG,0,0x6,0xB,0xA,0x0,DST|DISP32LIST,E}}EOP,
- NEW_SOP(O(O_STC,SB),0,2,"stc"),{{EXR,RDDEC,E}}, {{0x0,0x1,0x4,0x1,0x6,0xD,B31|RDDEC,0x0,E}}EOP,
+ NEW_SOP(O(O_STC,SB),0,2,"stc"),{{EXR|SRC,RSIND,E}}, {{0x0,0x1,0x4,0x1,0x6,0x9,B31|RDIND,0x0,E}} EOP,
+ NEW_SOP(O(O_STC,SB),0,2,"stc"),{{EXR|SRC,DISP|DST|L_16,E}},{{0x0,0x1,0x4,0x1,0x6,0xF,B31|DISPREG,0,DST|DISP|L_16,IGNORE,IGNORE,IGNORE,E}}EOP,
+ NEW_SOP(O(O_STC,SB),0,2,"stc"),{{EXR|SRC,DISP|DST|L_32,E}},{{0x0,0x1,0x4,0x1,0x7,0x8,B30|DISPREG,0,0x6,0xB,0xA,0x0,DST|DISP32LIST,E}}EOP,
+ NEW_SOP(O(O_STC,SB),0,2,"stc"),{{EXR|SRC,RDDEC,E}}, {{0x0,0x1,0x4,0x1,0x6,0xD,B31|RDDEC,0x0,E}}EOP,
- NEW_SOP(O(O_STC,SB),0,2,"stc"),{{EXR,ABS16SRC,E}}, {{0x0,0x1,0x4,0x1,0x6,0xB,0x8,0x0,ABS16DST,IGNORE,IGNORE,IGNORE,E}}EOP,
- NEW_SOP(O(O_STC,SB),0,2,"stc"),{{EXR,ABS32SRC,E}}, {{0x0,0x1,0x4,0x1,0x6,0xB,0xA,0x0,DST|ABS32LIST,E}}EOP,
+ NEW_SOP(O(O_STC,SB),0,2,"stc"),{{EXR|SRC,ABS16DST,E}}, {{0x0,0x1,0x4,0x1,0x6,0xB,0x8,0x0,ABS16DST,IGNORE,IGNORE,IGNORE,E}}EOP,
+ NEW_SOP(O(O_STC,SB),0,2,"stc"),{{EXR|SRC,ABS32DST,E}}, {{0x0,0x1,0x4,0x1,0x6,0xB,0xA,0x0,DST|ABS32LIST,E}}EOP,
SOP(O(O_SUB,SB),2,"sub.b"),{{RS8,RD8,E}},{{ 0x1,0x8,RS8,RD8,E,0,0,0,0}}EOP,
@@ -585,8 +585,8 @@ struct h8_opcode h8_opcodes[] =
NEW_SOP(O(O_XOR,SL),0,6,"xor.l"),{{IMM32,RD32,E }},{{0x7,0xA,0x5,B30|RD32,IMM32LIST,E}} EOP,
NEW_SOP(O(O_XOR,SL),0,2,"xor.l") ,{{RS32,RD32,E }},{{0x0,0x1,0xF,0x0,0x6,0x5,B30|RS32,B30|RD32,E}} EOP,
- SOP(O(O_XORC,SB),2,"xorc"),{{IMM8,CCR,E}},{{ 0x0,0x5,IMM8,IGNORE,E,0,0,0,0}}EOP,
- SOP(O(O_XORC,SB),2,"xorc"),{{IMM8,EXR,E}},{{ 0x0,0x1,0x4,0x1,0x0,0x5,IMM8,IGNORE,E,0,0,0,0}}EOP,
+ SOP(O(O_XORC,SB),2,"xorc"),{{IMM8,CCR|DST,E}},{{ 0x0,0x5,IMM8,IGNORE,E,0,0,0,0}}EOP,
+ SOP(O(O_XORC,SB),2,"xorc"),{{IMM8,EXR|DST,E}},{{ 0x0,0x1,0x4,0x1,0x0,0x5,IMM8,IGNORE,E,0,0,0,0}}EOP,
NEW_SOP(O(O_CLRMAC,SN),1,2,"clrmac"),{{E, 0, 0}},{{0x0,0x1,0xa,0x0,E}} EOP,
NEW_SOP(O(O_MAC,SL),1,2,"mac"),{{RSINC,RDINC,E}},{{0x0,0x1,0x6,0x0,0x6,0xd,B30|RSINC,B30|RDINC,E}} EOP,
diff --git a/include/opcode/ia64.h b/include/opcode/ia64.h
index 642330cc118..d4e6d108137 100644
--- a/include/opcode/ia64.h
+++ b/include/opcode/ia64.h
@@ -1,5 +1,5 @@
/* ia64.h -- Header file for ia64 opcode table
- Copyright (C) 1998, 1999 David Mosberger-Tang <davidm@hpl.hp.com>
+ Copyright (C) 1998, 1999, 2002 David Mosberger-Tang <davidm@hpl.hp.com>
See the file HP-COPYRIGHT for additional information. */
@@ -8,7 +8,7 @@
#include <sys/types.h>
-#include <bfd.h>
+#include "bfd.h"
typedef BFD_HOST_U_64_BIT ia64_insn;
diff --git a/include/opcode/mips.h b/include/opcode/mips.h
index 96c7a576e5c..801999c05c8 100644
--- a/include/opcode/mips.h
+++ b/include/opcode/mips.h
@@ -133,6 +133,16 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
#define OP_MASK_SEL 0x7 /* The sel field of mfcZ and mtcZ. */
#define OP_SH_CODE19 6 /* 19 bit wait code. */
#define OP_MASK_CODE19 0x7ffff
+#define OP_SH_ALN 21
+#define OP_MASK_ALN 0x7
+#define OP_SH_VSEL 21
+#define OP_MASK_VSEL 0x1f
+
+/* Values in the 'VSEL' field. */
+#define MDMX_FMTSEL_IMM_QH 0x1d
+#define MDMX_FMTSEL_IMM_OB 0x1e
+#define MDMX_FMTSEL_VEC_QH 0x15
+#define MDMX_FMTSEL_VEC_OB 0x16
/* This structure holds information for a particular instruction. */
@@ -220,13 +230,21 @@ struct mips_opcode
"f" 32 bit floating point constant
"l" 32 bit floating point constant in .lit4
+ MDMX instruction operands (note that while these use the FP register
+ fields, they accept both $fN and $vN names for the registers):
+ "O" MDMX alignment offset (OP_*_ALN)
+ "Q" MDMX vector/scalar/immediate source (OP_*_VSEL and OP_*_FT)
+ "X" MDMX destination register (OP_*_FD)
+ "Y" MDMX source register (OP_*_FS)
+ "Z" MDMX source register (OP_*_FT)
+
Other:
"()" parens surrounding optional value
"," separates operands
Characters used so far, for quick reference when adding more:
"<>(),"
- "ABCDEFGHIJLMNPRSTUVW"
+ "ABCDEFGHIJLMNOPQRSTUVWXYZ"
"abcdfhijklopqrstuvwxz"
*/
@@ -297,6 +315,10 @@ struct mips_opcode
#define INSN_MULT 0x40000000
/* Instruction synchronize shared memory. */
#define INSN_SYNC 0x80000000
+/* Instruction reads MDMX accumulator. XXX FIXME: No bits left! */
+#define INSN_READ_MDMX_ACC 0
+/* Instruction writes MDMX accumulator. XXX FIXME: No bits left! */
+#define INSN_WRITE_MDMX_ACC 0
/* Instruction is actually a macro. It should be ignored by the
disassembler, and requires special treatment by the assembler. */
@@ -320,6 +342,8 @@ struct mips_opcode
/* MIPS-3D ASE */
#define INSN_MIPS3D 0x00004000
+/* MDMX ASE */
+#define INSN_MDMX 0x00008000
/* Chip specific instructions. These are bitmasks. */
@@ -526,9 +550,13 @@ enum
M_REM_3I,
M_REMU_3,
M_REMU_3I,
+ M_DROL,
M_ROL,
+ M_DROL_I,
M_ROL_I,
+ M_DROR,
M_ROR,
+ M_DROR_I,
M_ROR_I,
M_S_DA,
M_S_DOB,
diff --git a/include/opcode/or32.h b/include/opcode/or32.h
index 05c532667da..4609a48db56 100644
--- a/include/opcode/or32.h
+++ b/include/opcode/or32.h
@@ -31,10 +31,6 @@
#define PARAMS(x) x
#endif
-#ifndef CONST
-#define CONST const
-#endif
-
#define MAX_GPRS 32
#define PAGE_SIZE 4096
#undef __HALF_WORD_INSN__
diff --git a/include/opcode/sparc.h b/include/opcode/sparc.h
index 5b6b5d14932..c41292364b1 100644
--- a/include/opcode/sparc.h
+++ b/include/opcode/sparc.h
@@ -1,5 +1,5 @@
/* Definitions for opcode table for the sparc.
- Copyright 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 2000
+ Copyright 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 2000, 2002
Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler, GDB, the GNU debugger, and
@@ -20,7 +20,7 @@ along with GAS or GDB; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#include <ansidecl.h>
+#include "ansidecl.h"
/* The SPARC opcode table (and other related data) is defined in
the opcodes library in sparc-opc.c. If you change anything here, make
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index 7024c37fb64..916995e5b12 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,3 +1,26 @@
+2002-06-05 Geoffrey Keating <geoffk@redhat.com>
+
+ * hashtab.c (htab_create): New stub function for backward
+ compatibility.
+ (htab_try_create): Likewise.
+
+2002-06-03 Geoffrey Keating <geoffk@redhat.com>
+
+ * hashtab.c (htab_create): Delete.
+ (htab_try_create): Delete.
+ (htab_create_alloc): New.
+ (htab_delete): Support user-specified memory allocation.
+ (htab_expand): Likewise.
+
+2002-05-22 Roman Lechtchinsky <rl@cs.tu-berlin.de>
+
+ * configure.in: Fix typo in the code checking for sys_errlist.
+ * configure: Regenerated.
+
+2002-05-13 Andreas Schwab <schwab@suse.de>
+
+ * config.table: Use mh-x86pic also for x86-64.
+
2002-05-08 Alexandre Oliva <aoliva@redhat.com>
* configure.in (ORIGINAL_LD_FOR_MULTILIBS): Preserve LD at
@@ -26,7 +49,7 @@
2002-03-30 Bryce McKinlay <bryce@waitaki.otago.ac.nz>
- * cp-demangle.c (java_demangle_v3): Don't try to release "demangled"
+ * cp-demangle.c (java_demangle_v3): Don't try to release "demangled"
if it is NULL.
2002-03-27 DJ Delorie <dj@redhat.com>
@@ -85,7 +108,7 @@
* xmalloc.c (xmalloc_fail): Clarify error message.
-2002-02-21 Jim Blandy <jimb@redhat.com>
+2002-02-22 Jim Blandy <jimb@redhat.com>
* splay-tree.c (splay_tree_xmalloc_allocate,
splay_tree_xmalloc_deallocate): New functions.
diff --git a/libiberty/config.table b/libiberty/config.table
index 6118a9c8256..b9a2479aac7 100644
--- a/libiberty/config.table
+++ b/libiberty/config.table
@@ -34,7 +34,8 @@ if [ "${shared}" = "yes" ]; then
alpha*-*-linux*) frag=mh-elfalphapic ;;
arm*-*-*) frag=mh-armpic ;;
hppa*-*-*) frag=mh-papic ;;
- i[3456]86-*-*) frag=mh-x86pic ;;
+ i[3456]86-*-* | x86_64-*-*)
+ frag=mh-x86pic ;;
powerpc*-*-aix*) ;;
powerpc*-*-*) frag=mh-ppcpic ;;
sparc*-*-*) frag=mh-sparcpic ;;
diff --git a/libiberty/configure b/libiberty/configure
index fc89885f305..7f2c0a931a3 100755
--- a/libiberty/configure
+++ b/libiberty/configure
@@ -2860,7 +2860,7 @@ else
#include "confdefs.h"
int *p;
int main() {
-extern int $v []; p = &$v;
+extern int $v []; p = $v;
; return 0; }
EOF
if { (eval echo configure:2867: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
diff --git a/libiberty/configure.in b/libiberty/configure.in
index f6d92bcb03e..c84ece4ef41 100644
--- a/libiberty/configure.in
+++ b/libiberty/configure.in
@@ -401,7 +401,7 @@ if test -z "${setobjs}"; then
for v in $vars; do
AC_MSG_CHECKING([for $v])
AC_CACHE_VAL(libiberty_cv_var_$v,
- [AC_TRY_LINK([int *p;], [extern int $v []; p = &$v;],
+ [AC_TRY_LINK([int *p;], [extern int $v []; p = $v;],
[eval "libiberty_cv_var_$v=yes"],
[eval "libiberty_cv_var_$v=no"])])
if eval "test \"`echo '$libiberty_cv_var_'$v`\" = yes"; then
diff --git a/libiberty/hashtab.c b/libiberty/hashtab.c
index 7477c35c3bc..6bf59ff7378 100644
--- a/libiberty/hashtab.c
+++ b/libiberty/hashtab.c
@@ -158,60 +158,60 @@ eq_pointer (p1, p2)
/* This function creates table with length slightly longer than given
source length. Created hash table is initiated as empty (all the
hash table entries are EMPTY_ENTRY). The function returns the
- created hash table. Memory allocation must not fail. */
+ created hash table, or NULL if memory allocation fails. */
htab_t
-htab_create (size, hash_f, eq_f, del_f)
+htab_create_alloc (size, hash_f, eq_f, del_f, alloc_f, free_f)
size_t size;
htab_hash hash_f;
htab_eq eq_f;
htab_del del_f;
+ htab_alloc alloc_f;
+ htab_free free_f;
{
htab_t result;
size = higher_prime_number (size);
- result = (htab_t) xcalloc (1, sizeof (struct htab));
- result->entries = (PTR *) xcalloc (size, sizeof (PTR));
+ result = (htab_t) (*alloc_f) (1, sizeof (struct htab));
+ if (result == NULL)
+ return NULL;
+ result->entries = (PTR *) (*alloc_f) (size, sizeof (PTR));
+ if (result->entries == NULL)
+ {
+ if (free_f != NULL)
+ (*free_f) (result);
+ return NULL;
+ }
result->size = size;
result->hash_f = hash_f;
result->eq_f = eq_f;
result->del_f = del_f;
- result->return_allocation_failure = 0;
+ result->alloc_f = alloc_f;
+ result->free_f = free_f;
return result;
}
-/* This function creates table with length slightly longer than given
- source length. The created hash table is initiated as empty (all the
- hash table entries are EMPTY_ENTRY). The function returns the created
- hash table. Memory allocation may fail; it may return NULL. */
+/* These functions exist solely for backward compatibility. */
+#undef htab_create
htab_t
-htab_try_create (size, hash_f, eq_f, del_f)
+htab_create (size, hash_f, eq_f, del_f)
size_t size;
htab_hash hash_f;
htab_eq eq_f;
htab_del del_f;
{
- htab_t result;
-
- size = higher_prime_number (size);
- result = (htab_t) calloc (1, sizeof (struct htab));
- if (result == NULL)
- return NULL;
-
- result->entries = (PTR *) calloc (size, sizeof (PTR));
- if (result->entries == NULL)
- {
- free (result);
- return NULL;
- }
+ return htab_create_alloc (size, hash_f, eq_f, del_f, xcalloc, free);
+}
- result->size = size;
- result->hash_f = hash_f;
- result->eq_f = eq_f;
- result->del_f = del_f;
- result->return_allocation_failure = 1;
- return result;
+htab_t
+htab_try_create (size, hash_f, eq_f, del_f)
+ size_t size;
+ htab_hash hash_f;
+ htab_eq eq_f;
+ htab_del del_f;
+{
+ return htab_create_alloc (size, hash_f, eq_f, del_f, calloc, free);
}
/* This function frees all memory allocated for given hash table.
@@ -229,8 +229,11 @@ htab_delete (htab)
&& htab->entries[i] != DELETED_ENTRY)
(*htab->del_f) (htab->entries[i]);
- free (htab->entries);
- free (htab);
+ if (htab->free_f != NULL)
+ {
+ (*htab->free_f) (htab->entries);
+ (*htab->free_f) (htab);
+ }
}
/* This function clears all entries in the given hash table. */
@@ -302,21 +305,17 @@ htab_expand (htab)
PTR *oentries;
PTR *olimit;
PTR *p;
+ PTR *nentries;
oentries = htab->entries;
olimit = oentries + htab->size;
htab->size = higher_prime_number (htab->size * 2);
- if (htab->return_allocation_failure)
- {
- PTR *nentries = (PTR *) calloc (htab->size, sizeof (PTR *));
- if (nentries == NULL)
- return 0;
- htab->entries = nentries;
- }
- else
- htab->entries = (PTR *) xcalloc (htab->size, sizeof (PTR *));
+ nentries = (PTR *) (*htab->alloc_f) (htab->size, sizeof (PTR *));
+ if (nentries == NULL)
+ return 0;
+ htab->entries = nentries;
htab->n_elements -= htab->n_deleted;
htab->n_deleted = 0;
@@ -337,7 +336,8 @@ htab_expand (htab)
}
while (p < olimit);
- free (oentries);
+ if (htab->free_f != NULL)
+ (*htab->free_f) (oentries);
return 1;
}
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index 9db7dec8ee9..542313e9445 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,3 +1,132 @@
+2002-06-08 Alan Modra <amodra@bigpond.net.au>
+
+ * a29k-dis.c: Replace CONST with const.
+ * h8300-dis.c: Likewise.
+ * m68k-dis.c: Likewise.
+ * or32-dis.c: Likewise.
+ * sparc-dis.c: Likewise.
+
+2002-06-04 Jason Thorpe <thorpej@wasabisystems.com>
+
+ * configure.in: Add "sh5*-*" to list of targets which include
+ sh64 support.
+ * configure: Regenerate.
+
+2002-05-31 Chris G. Demetriou <cgd@broadcom.com>
+
+ * mips-opc.c: Clean up a few whitespace issues, and sort a
+ few entries understanding that 'x' follows 'w' in the alphabet.
+
+2002-05-31 Chris G. Demetriou <cgd@broadcom.com>
+ Ed Satterthwaite <ehs@broadcom.com>
+
+ * mips-opc.c: Add support for SB-1 MDMX subset and extensions.
+
+2002-05-31 Alan Modra <amodra@bigpond.net.au>
+
+ * Makefile.am: Run "make dep-am".
+ * Makefile.in: Regenerate.
+ * po/POTFILES.in: Regenerate.
+
+2002-05-30 Chris G. Demetriou <cgd@broadcom.com>
+ Ed Satterthwaite <ehs@broadcom.com>
+
+ * mips-dis.c (print_insn_arg): Add support for 'O', 'Q', 'X', 'Y',
+ and 'Z' formats, for MDMX.
+ (mips_isa_type): Add MDMX instructions to the ISA
+ bit mask for bfd_mach_mipsisa64.
+ * mips-opc.c: Add support for MDMX instructions.
+ (MX): New definition.
+
+ * mips-dis.c: Update copyright years to include 2002.
+
+2002-05-30 Diego Novillo <dnovillo@redhat.com>
+
+ * d10v-opc.c (d10v_opcodes): `btsti' does not modify its
+ arguments.
+
+2002-05-28 Kuang Hwa Lin <kuang@sbcglobal.net>
+
+ * configure.in: Add DLX configuraton support.
+ * configure: Regenerate.
+ * Makefile.am: Add DLX configuraton support.
+ * Makefile.in: Regenerate.
+ * disassemble.c: Add DLX support.
+ * dlx-dis.c: New file.
+
+2002-05-25 Alan Modra <amodra@bigpond.net.au>
+
+ * Makefile.am (sh-dis.lo): Don't put make commands in deps.
+ * Makefile.in: Regenerate.
+ * arc-dis.c: Use #include "" instead of <> for local header files.
+ * m68k-dis.c: Likewise.
+
+Wed May 22 20:11:51 2002 J"orn Rennecke <joern.rennecke@superh.com>
+
+ * Makefile.am (sh-dis.lo): Compile with @archdefs@.
+ * Makefile.in: regenerate.
+
+ * sh-dis.c (print_insn_sh): If coff and bfd_mach_sh, use arch_sh4
+ for disassembly.
+
+2002-05-22 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
+
+ * mips-opc.c (mips_builtin_opcodes): Add drol, dror macros.
+
+Fri May 17 14:26:44 2002 J"orn Rennecke <joern.rennecke@superh.com>
+
+ * disassemble.c (disassembler): Just use print_insn_sh for bfd_arch_sh.
+ * sh-dis.c (LITTLE_BIT): Delete.
+ (print_insn_sh, print_insn_shl): Deleted.
+ (print_insn_shx): Renamed to
+ (print_insn_sh). No longer static. Handle SHmedia instructions.
+ Use info->endian to determine endianness.
+ * sh64-dis.c (print_insn_sh64, print_insn_sh64l): Delete.
+ (print_insn_sh64x): No longer static. Renamed to
+ (print_insn_sh64). Removed pfun_compact and endian arguments.
+ If we got an uneven address to indicate SHmedia, adjust it.
+ Return -2 for SHcompact instructions.
+
+2002-05-17 Alan Modra <amodra@bigpond.net.au>
+
+ * acinclude.m4 (AM_INSTALL_LIBBFD): Fake to fool autotools.
+ * configure.in: Invoke AM_INSTALL_LIBBFD.
+ * Makefile.am (install-data-local): Move to..
+ (install_libopcodes): .. New target.
+ (uninstall_libopcodes): Likewise.
+ (install-bfdlibLTLIBRARIES): Likewise.
+ (uninstall-bfdlibLTLIBRARIES): Likewise.
+ (bfdlibdir): New.
+ (bfdincludedir): New.
+ (lib_LTLIBRARIES): Rename to bfdlib_LTLIBRARIES.
+ * aclocal.m4: Regenerate.
+ * configure: Regenerate.
+ * Makefile.in: Regenerate.
+
+2002-05-15 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * fr30-asm.c: Regenerate.
+ * fr30-desc.c: Regenerate.
+ * fr30-dis.c: Regenerate.
+ * m32r-asm.c: Regenerate.
+ * m32r-desc.c: Regenerate.
+ * m32r-dis.c: Regenerate.
+ * openrisc-asm.c: Regenerate.
+ * openrisc-desc.c: Regenerate.
+ * openrisc-dis.c: Regenerate.
+ * xstormy16-asm.c: Regenerate.
+ * xstormy16-desc.c: Regenerate.
+ * xstormy16-dis.c: Regenerate.
+
+2002-05-15 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
+
+ * mips-dis.c (is_newabi): EABI is not a NewABI.
+
+2002-05-13 Jason Thorpe <thorpej@wasabisystems.com>
+
+ * configure.in (shle-*-*elf*): Include sh64 support.
+ * configure: Regenerate.
+
2002-04-28 Jason Thorpe <thorpej@wasabisystems.com>
* vax-dis.c (print_insn_arg): Pass the insn info to print_insn_mode.
@@ -180,7 +309,7 @@ Mon Mar 18 21:10:43 CET 2002 Jan Hubicka <jh@suse.cz>
2002-02-20 Tom Rix <trix@redhat.com>
- * ppc-opc.c (powerpc_operands): Add WS feild. Use for tlbre, tlbwe.
+ * ppc-opc.c (powerpc_operands): Add WS field. Use for tlbre, tlbwe.
2002-02-19 Martin Schwidefsky <schwidefsky@de.ibm.com>
diff --git a/opcodes/Makefile.am b/opcodes/Makefile.am
index ad3bdf4b548..7ee8c32b944 100644
--- a/opcodes/Makefile.am
+++ b/opcodes/Makefile.am
@@ -11,7 +11,10 @@ MKDEP = gcc -MM
WARN_CFLAGS = @WARN_CFLAGS@
AM_CFLAGS = $(WARN_CFLAGS)
-lib_LTLIBRARIES = libopcodes.la
+bfdlibdir = @bfdlibdir@
+bfdincludedir = @bfdincludedir@
+
+bfdlib_LTLIBRARIES = libopcodes.la
# This is where bfd.h lives.
BFD_H = ../bfd/bfd.h
@@ -55,6 +58,7 @@ CFILES = \
d10v-opc.c \
d30v-dis.c \
d30v-opc.c \
+ dlx-dis.c \
dis-buf.c \
disassemble.c \
fr30-asm.c \
@@ -158,6 +162,7 @@ ALL_MACHINES = \
d10v-opc.lo \
d30v-dis.lo \
d30v-opc.lo \
+ dlx-dis.lo \
fr30-asm.lo \
fr30-desc.lo \
fr30-dis.lo \
@@ -271,11 +276,29 @@ po/POTFILES.in: @MAINT@ Makefile
config.status: $(srcdir)/configure $(srcdir)/../bfd/configure.in
$(SHELL) ./config.status --recheck
-# Install libopcodes include file.
-install-data-local:
+install-bfdlibLTLIBRARIES: @INSTALL_LIBBFD_TRUE@install_libopcodes
@$(NORMAL_INSTALL)
- $(mkinstalldirs) $(DESTDIR)$(includedir)
- $(INSTALL_DATA) $(INCDIR)/dis-asm.h $(DESTDIR)$(includedir)/dis-asm.h
+
+uninstall-bfdlibLTLIBRARIES: @INSTALL_LIBBFD_TRUE@uninstall_libopcodes
+ @$(NORMAL_UNINSTALL)
+
+.PHONY: install_libopcodes uninstall_libopcodes
+install_libopcodes: $(bfdlib_LTLIBRARIES)
+ $(mkinstalldirs) $(DESTDIR)$(bfdlibdir)
+ $(mkinstalldirs) $(DESTDIR)$(bfdincludedir)
+ @list='$(bfdlib_LTLIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ echo "$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(bfdlibdir)/$$p"; \
+ $(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(bfdlibdir)/$$p; \
+ else :; fi; \
+ done
+ $(INSTALL_DATA) $(INCDIR)/dis-asm.h $(DESTDIR)$(bfdincludedir)/dis-asm.h
+
+uninstall_libopcodes:
+ list='$(bfdlib_LTLIBRARIES)'; for p in $$list; do \
+ $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(bfdlibdir)/$$p; \
+ done
+ rm -f $(DESTDIR)$(bfdincludedir)/dis-asm.h
CLEANFILES = \
stamp-m32r stamp-fr30 stamp-openrisc \
@@ -350,6 +373,9 @@ s390-mkopc: s390-mkopc.c
s390-opc.tab: s390-mkopc s390-opc.txt
./s390-mkopc < $(srcdir)/s390-opc.txt > s390-opc.tab
+sh-dis.lo: sh-dis.c
+ $(LIBTOOL) --mode=compile $(COMPILE) -c @archdefs@ $<
+
Makefile: $(BFDDIR)/configure.in
# This dependency stuff is copied from BFD.
@@ -447,6 +473,8 @@ d30v-dis.lo: d30v-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \
$(INCDIR)/symcat.h opintl.h
d30v-opc.lo: d30v-opc.c sysdep.h config.h $(INCDIR)/ansidecl.h \
$(INCDIR)/opcode/d30v.h
+dlx-dis.lo: dlx-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \
+ $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h $(INCDIR)/opcode/dlx.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
disassemble.lo: disassemble.c sysdep.h config.h $(INCDIR)/ansidecl.h \
diff --git a/opcodes/Makefile.in b/opcodes/Makefile.in
index 48c863006fe..f7147e14bb8 100644
--- a/opcodes/Makefile.in
+++ b/opcodes/Makefile.in
@@ -121,7 +121,10 @@ MKDEP = gcc -MM
WARN_CFLAGS = @WARN_CFLAGS@
AM_CFLAGS = $(WARN_CFLAGS)
-lib_LTLIBRARIES = libopcodes.la
+bfdlibdir = @bfdlibdir@
+bfdincludedir = @bfdincludedir@
+
+bfdlib_LTLIBRARIES = libopcodes.la
# This is where bfd.h lives.
BFD_H = ../bfd/bfd.h
@@ -166,6 +169,7 @@ CFILES = \
d10v-opc.c \
d30v-dis.c \
d30v-opc.c \
+ dlx-dis.c \
dis-buf.c \
disassemble.c \
fr30-asm.c \
@@ -270,6 +274,7 @@ ALL_MACHINES = \
d10v-opc.lo \
d30v-dis.lo \
d30v-opc.lo \
+ dlx-dis.lo \
fr30-asm.lo \
fr30-desc.lo \
fr30-dis.lo \
@@ -402,7 +407,7 @@ LIBS = @LIBS@
libopcodes_a_LIBADD =
libopcodes_a_SOURCES = libopcodes.a.c
libopcodes_a_OBJECTS = libopcodes.a.$(OBJEXT)
-LTLIBRARIES = $(lib_LTLIBRARIES)
+LTLIBRARIES = $(bfdlib_LTLIBRARIES)
libopcodes_la_OBJECTS = dis-buf.lo disassemble.lo
CFLAGS = @CFLAGS@
@@ -517,33 +522,17 @@ distclean-libtool:
maintainer-clean-libtool:
-mostlyclean-libLTLIBRARIES:
-
-clean-libLTLIBRARIES:
- -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
+mostlyclean-bfdlibLTLIBRARIES:
-distclean-libLTLIBRARIES:
+clean-bfdlibLTLIBRARIES:
+ -test -z "$(bfdlib_LTLIBRARIES)" || rm -f $(bfdlib_LTLIBRARIES)
-maintainer-clean-libLTLIBRARIES:
+distclean-bfdlibLTLIBRARIES:
-install-libLTLIBRARIES: $(lib_LTLIBRARIES)
- @$(NORMAL_INSTALL)
- $(mkinstalldirs) $(DESTDIR)$(libdir)
- @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
- if test -f $$p; then \
- echo "$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p"; \
- $(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p; \
- else :; fi; \
- done
-
-uninstall-libLTLIBRARIES:
- @$(NORMAL_UNINSTALL)
- list='$(lib_LTLIBRARIES)'; for p in $$list; do \
- $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \
- done
+maintainer-clean-bfdlibLTLIBRARIES:
libopcodes.la: $(libopcodes_la_OBJECTS) $(libopcodes_la_DEPENDENCIES)
- $(LINK) -rpath $(libdir) $(libopcodes_la_LDFLAGS) $(libopcodes_la_OBJECTS) $(libopcodes_la_LIBADD) $(LIBS)
+ $(LINK) -rpath $(bfdlibdir) $(libopcodes_la_LDFLAGS) $(libopcodes_la_OBJECTS) $(libopcodes_la_LIBADD) $(LIBS)
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
@@ -705,16 +694,16 @@ install-info: install-info-recursive
all-recursive-am: config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive
-install-exec-am: install-libLTLIBRARIES
+install-exec-am:
install-exec: install-exec-recursive
-install-data-am: install-data-local
+install-data-am: install-bfdlibLTLIBRARIES
install-data: install-data-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
install: install-recursive
-uninstall-am: uninstall-libLTLIBRARIES
+uninstall-am: uninstall-bfdlibLTLIBRARIES
uninstall: uninstall-recursive
all-am: Makefile $(LIBRARIES) $(LTLIBRARIES) config.h
all-redirect: all-recursive-am
@@ -722,7 +711,7 @@ install-strip:
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
installdirs: installdirs-recursive
installdirs-am:
- $(mkinstalldirs) $(DESTDIR)$(libdir)
+ $(mkinstalldirs) $(DESTDIR)$(bfdlibdir)
mostlyclean-generic:
@@ -737,19 +726,19 @@ distclean-generic:
maintainer-clean-generic:
mostlyclean-am: mostlyclean-hdr mostlyclean-noinstLIBRARIES \
mostlyclean-compile mostlyclean-libtool \
- mostlyclean-libLTLIBRARIES mostlyclean-tags \
+ mostlyclean-bfdlibLTLIBRARIES mostlyclean-tags \
mostlyclean-generic
mostlyclean: mostlyclean-recursive
clean-am: clean-hdr clean-noinstLIBRARIES clean-compile clean-libtool \
- clean-libLTLIBRARIES clean-tags clean-generic \
+ clean-bfdlibLTLIBRARIES clean-tags clean-generic \
mostlyclean-am
clean: clean-recursive
distclean-am: distclean-hdr distclean-noinstLIBRARIES distclean-compile \
- distclean-libtool distclean-libLTLIBRARIES \
+ distclean-libtool distclean-bfdlibLTLIBRARIES \
distclean-tags distclean-generic clean-am
-rm -f libtool
@@ -759,8 +748,9 @@ distclean: distclean-recursive
maintainer-clean-am: maintainer-clean-hdr \
maintainer-clean-noinstLIBRARIES \
maintainer-clean-compile maintainer-clean-libtool \
- maintainer-clean-libLTLIBRARIES maintainer-clean-tags \
- maintainer-clean-generic distclean-am
+ maintainer-clean-bfdlibLTLIBRARIES \
+ maintainer-clean-tags maintainer-clean-generic \
+ distclean-am
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
@@ -772,22 +762,22 @@ mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \
clean-noinstLIBRARIES maintainer-clean-noinstLIBRARIES \
mostlyclean-compile distclean-compile clean-compile \
maintainer-clean-compile mostlyclean-libtool distclean-libtool \
-clean-libtool maintainer-clean-libtool mostlyclean-libLTLIBRARIES \
-distclean-libLTLIBRARIES clean-libLTLIBRARIES \
-maintainer-clean-libLTLIBRARIES uninstall-libLTLIBRARIES \
-install-libLTLIBRARIES install-data-recursive uninstall-data-recursive \
-install-exec-recursive uninstall-exec-recursive installdirs-recursive \
-uninstalldirs-recursive all-recursive check-recursive \
-installcheck-recursive info-recursive dvi-recursive \
-mostlyclean-recursive distclean-recursive clean-recursive \
+clean-libtool maintainer-clean-libtool mostlyclean-bfdlibLTLIBRARIES \
+distclean-bfdlibLTLIBRARIES clean-bfdlibLTLIBRARIES \
+maintainer-clean-bfdlibLTLIBRARIES uninstall-bfdlibLTLIBRARIES \
+install-bfdlibLTLIBRARIES install-data-recursive \
+uninstall-data-recursive install-exec-recursive \
+uninstall-exec-recursive installdirs-recursive uninstalldirs-recursive \
+all-recursive check-recursive installcheck-recursive info-recursive \
+dvi-recursive mostlyclean-recursive distclean-recursive clean-recursive \
maintainer-clean-recursive tags tags-recursive mostlyclean-tags \
distclean-tags clean-tags maintainer-clean-tags distdir info-am info \
dvi-am dvi check check-am installcheck-am installcheck install-info-am \
install-info all-recursive-am install-exec-am install-exec \
-install-data-local install-data-am install-data install-am install \
-uninstall-am uninstall all-redirect all-am all installdirs-am \
-installdirs mostlyclean-generic distclean-generic clean-generic \
-maintainer-clean-generic clean mostlyclean distclean maintainer-clean
+install-data-am install-data install-am install uninstall-am uninstall \
+all-redirect all-am all installdirs-am installdirs mostlyclean-generic \
+distclean-generic clean-generic maintainer-clean-generic clean \
+mostlyclean distclean maintainer-clean
disassemble.lo: disassemble.c $(INCDIR)/dis-asm.h
@@ -812,11 +802,29 @@ po/POTFILES.in: @MAINT@ Makefile
config.status: $(srcdir)/configure $(srcdir)/../bfd/configure.in
$(SHELL) ./config.status --recheck
-# Install libopcodes include file.
-install-data-local:
+install-bfdlibLTLIBRARIES: @INSTALL_LIBBFD_TRUE@install_libopcodes
@$(NORMAL_INSTALL)
- $(mkinstalldirs) $(DESTDIR)$(includedir)
- $(INSTALL_DATA) $(INCDIR)/dis-asm.h $(DESTDIR)$(includedir)/dis-asm.h
+
+uninstall-bfdlibLTLIBRARIES: @INSTALL_LIBBFD_TRUE@uninstall_libopcodes
+ @$(NORMAL_UNINSTALL)
+
+.PHONY: install_libopcodes uninstall_libopcodes
+install_libopcodes: $(bfdlib_LTLIBRARIES)
+ $(mkinstalldirs) $(DESTDIR)$(bfdlibdir)
+ $(mkinstalldirs) $(DESTDIR)$(bfdincludedir)
+ @list='$(bfdlib_LTLIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ echo "$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(bfdlibdir)/$$p"; \
+ $(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(bfdlibdir)/$$p; \
+ else :; fi; \
+ done
+ $(INSTALL_DATA) $(INCDIR)/dis-asm.h $(DESTDIR)$(bfdincludedir)/dis-asm.h
+
+uninstall_libopcodes:
+ list='$(bfdlib_LTLIBRARIES)'; for p in $$list; do \
+ $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(bfdlibdir)/$$p; \
+ done
+ rm -f $(DESTDIR)$(bfdincludedir)/dis-asm.h
run-cgen:
$(SHELL) $(srcdir)/cgen.sh opcodes $(srcdir) $(CGEN) \
@@ -861,6 +869,9 @@ s390-mkopc: s390-mkopc.c
s390-opc.tab: s390-mkopc s390-opc.txt
./s390-mkopc < $(srcdir)/s390-opc.txt > s390-opc.tab
+sh-dis.lo: sh-dis.c
+ $(LIBTOOL) --mode=compile $(COMPILE) -c @archdefs@ $<
+
Makefile: $(BFDDIR)/configure.in
# This dependency stuff is copied from BFD.
@@ -958,6 +969,8 @@ d30v-dis.lo: d30v-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \
$(INCDIR)/symcat.h opintl.h
d30v-opc.lo: d30v-opc.c sysdep.h config.h $(INCDIR)/ansidecl.h \
$(INCDIR)/opcode/d30v.h
+dlx-dis.lo: dlx-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \
+ $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h $(INCDIR)/opcode/dlx.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
disassemble.lo: disassemble.c sysdep.h config.h $(INCDIR)/ansidecl.h \
diff --git a/opcodes/a29k-dis.c b/opcodes/a29k-dis.c
index 0e937ba0eab..a3090c3e21b 100644
--- a/opcodes/a29k-dis.c
+++ b/opcodes/a29k-dis.c
@@ -1,5 +1,5 @@
/* Instruction printing code for the AMD 29000
- Copyright 1990, 1993, 1994, 1995, 1998, 2000, 2001
+ Copyright 1990, 1993, 1994, 1995, 1998, 2000, 2001, 2002
Free Software Foundation, Inc.
Contributed by Cygnus Support. Written by Jim Kingdon.
@@ -153,7 +153,7 @@ print_insn (memaddr, info)
find_byte_func_type find_byte_func = (find_byte_func_type)info->private_data;
- struct a29k_opcode CONST * opcode;
+ struct a29k_opcode const * opcode;
{
int status =
diff --git a/opcodes/acinclude.m4 b/opcodes/acinclude.m4
index bb689a5ce8f..3a47b1b67c4 100644
--- a/opcodes/acinclude.m4
+++ b/opcodes/acinclude.m4
@@ -15,3 +15,10 @@ ifelse(yes,no,[
AC_DEFUN([CY_WITH_NLS],)
AC_SUBST(INTLLIBS)
])
+
+dnl AM_INSTALL_LIBBFD already included in bfd/acinclude.m4
+ifelse(yes,no,[
+AC_DEFUN([AM_INSTALL_LIBBFD],)
+AC_SUBST(bfdlibdir)
+AC_SUBST(bfdincludedir)
+])
diff --git a/opcodes/aclocal.m4 b/opcodes/aclocal.m4
index 5858db78bf1..184bf3665ad 100644
--- a/opcodes/aclocal.m4
+++ b/opcodes/aclocal.m4
@@ -28,6 +28,13 @@ AC_DEFUN([CY_WITH_NLS],)
AC_SUBST(INTLLIBS)
])
+dnl AM_INSTALL_LIBBFD already included in bfd/acinclude.m4
+ifelse(yes,no,[
+AC_DEFUN([AM_INSTALL_LIBBFD],)
+AC_SUBST(bfdlibdir)
+AC_SUBST(bfdincludedir)
+])
+
# Do all the work for Automake. This macro actually does too much --
# some checks are only needed if your package does certain things.
# But this isn't really a big deal.
diff --git a/opcodes/arc-dis.c b/opcodes/arc-dis.c
index d38e2fa81d2..194a75ac9fe 100644
--- a/opcodes/arc-dis.c
+++ b/opcodes/arc-dis.c
@@ -1,5 +1,5 @@
/* Instruction printing code for the ARC.
- Copyright 1994, 1995, 1997, 1998, 2000, 2001
+ Copyright 1994, 1995, 1997, 1998, 2000, 2001, 2002
Free Software Foundation, Inc.
Contributed by Doug Evans (dje@cygnus.com).
@@ -17,8 +17,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-#include <ansidecl.h>
-#include <libiberty.h>
+#include "ansidecl.h"
+#include "libiberty.h"
#include "dis-asm.h"
#include "opcode/arc.h"
#include "elf-bfd.h"
diff --git a/opcodes/arm-dis.c b/opcodes/arm-dis.c
index 7e9b3309008..f3785f2ed9b 100644
--- a/opcodes/arm-dis.c
+++ b/opcodes/arm-dis.c
@@ -1,5 +1,5 @@
/* Instruction printing code for the ARM
- Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+ Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
Free Software Foundation, Inc.
Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org)
Modification by James G. Smith (jsmith@cygnus.co.uk)
@@ -28,7 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "libcoff.h"
#include "opintl.h"
-/* FIXME: This shouldn't be done here */
+/* FIXME: This shouldn't be done here. */
#include "elf-bfd.h"
#include "elf/internal.h"
#include "elf/arm.h"
@@ -99,15 +99,16 @@ int get_arm_regnames (int option, const char **setname,
const char **setdescription,
const char ***register_names);
-/* Functions. */
+/* Functions. */
int
-get_arm_regname_num_options (void)
+get_arm_regname_num_options ()
{
return NUM_ARM_REGNAMES;
}
int
-set_arm_regname_option (int option)
+set_arm_regname_option (option)
+ int option;
{
int old = regname_selected;
regname_selected = option;
@@ -115,9 +116,11 @@ set_arm_regname_option (int option)
}
int
-get_arm_regnames (int option, const char **setname,
- const char **setdescription,
- const char ***register_names)
+get_arm_regnames (option, setname, setdescription, register_names)
+ int option;
+ const char **setname;
+ const char **setdescription;
+ const char ***register_names;
{
*setname = regnames[option].name;
*setdescription = regnames[option].description;
@@ -161,6 +164,7 @@ arm_decode_shift (given, func, stream)
/* Print one instruction from PC on INFO->STREAM.
Return the size of the instruction (always 4 on ARM). */
+
static int
print_insn_arm (pc, info, given)
bfd_vma pc;
@@ -200,7 +204,7 @@ print_insn_arm (pc, info, given)
if ((given & 0x00800000) == 0)
offset = - offset;
- /* pre-indexed */
+ /* Pre-indexed. */
func (stream, ", #%d]", offset);
offset += pc + 8;
@@ -217,7 +221,8 @@ print_insn_arm (pc, info, given)
/* Post indexed. */
func (stream, "], #%d", offset);
- offset = pc + 8; /* ie ignore the offset. */
+ /* ie ignore the offset. */
+ offset = pc + 8;
}
func (stream, "\t; ");
@@ -740,6 +745,7 @@ print_insn_arm (pc, info, given)
/* Print one instruction from PC on INFO->STREAM.
Return the size of the instruction. */
+
static int
print_insn_thumb (pc, info, given)
bfd_vma pc;
@@ -765,26 +771,17 @@ print_insn_thumb (pc, info, given)
info->bytes_per_line = 4;
offset = BDISP23 (given);
-
+ offset = offset * 2 + pc + 4;
+
if ((given & 0x10000000) == 0)
{
func (stream, "blx\t");
-
- /* The spec says that bit 1 of the branch's destination
- address comes from bit 1 of the instruction's
- address and not from the offset in the instruction. */
- if (offset & 0x1)
- {
- /* func (stream, "*malformed!* "); */
- offset &= ~ 0x1;
- }
-
- offset |= ((pc & 0x2) >> 1);
+ offset &= 0xfffffffc;
}
else
func (stream, "bl\t");
- info->print_address_func (offset * 2 + pc + 4, info);
+ info->print_address_func (offset, info);
return 4;
}
else
@@ -988,6 +985,7 @@ print_insn_thumb (pc, info, given)
}
/* Parse an individual disassembler option. */
+
void
parse_arm_disassembler_option (option)
char * option;
@@ -1022,6 +1020,7 @@ parse_arm_disassembler_option (option)
}
/* Parse the string of disassembler options, spliting it at whitespaces. */
+
static void
parse_disassembler_options (options)
char * options;
@@ -1050,6 +1049,7 @@ parse_disassembler_options (options)
/* NOTE: There are no checks in these routines that
the relevant number of data bytes exist. */
+
static int
print_insn (pc, info, little)
bfd_vma pc;
diff --git a/opcodes/configure b/opcodes/configure
index d8f162a1dac..4d0b55f891f 100755
--- a/opcodes/configure
+++ b/opcodes/configure
@@ -33,6 +33,8 @@ ac_help="$ac_help
--enable-maintainer-mode enable make rules and dependencies not useful
(and sometimes confusing) to the casual installer"
ac_help="$ac_help
+ --install-libbfd controls installation of libbfd and related headers"
+ac_help="$ac_help
--disable-nls do not use Native Language Support"
ac_help="$ac_help
--with-included-gettext use the GNU gettext library included here"
@@ -548,12 +550,12 @@ else
fi
echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6
-echo "configure:552: checking for Cygwin environment" >&5
+echo "configure:554: 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 557 "configure"
+#line 559 "configure"
#include "confdefs.h"
int main() {
@@ -564,7 +566,7 @@ int main() {
return __CYGWIN__;
; return 0; }
EOF
-if { (eval echo configure:568: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:570: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_cygwin=yes
else
@@ -581,19 +583,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:585: checking for mingw32 environment" >&5
+echo "configure:587: 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 590 "configure"
+#line 592 "configure"
#include "confdefs.h"
int main() {
return __MINGW32__;
; return 0; }
EOF
-if { (eval echo configure:597: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:599: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_mingw32=yes
else
@@ -658,7 +660,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:662: checking host system type" >&5
+echo "configure:664: checking host system type" >&5
host_alias=$host
case "$host_alias" in
@@ -679,7 +681,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:683: checking target system type" >&5
+echo "configure:685: checking target system type" >&5
target_alias=$target
case "$target_alias" in
@@ -697,7 +699,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:701: checking build system type" >&5
+echo "configure:703: checking build system type" >&5
build_alias=$build
case "$build_alias" in
@@ -722,7 +724,7 @@ test "$host_alias" != "$target_alias" &&
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:726: checking for $ac_word" >&5
+echo "configure:728: 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
@@ -752,7 +754,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:756: checking for $ac_word" >&5
+echo "configure:758: 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
@@ -803,7 +805,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:807: checking for $ac_word" >&5
+echo "configure:809: 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
@@ -835,7 +837,7 @@ fi
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:839: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:841: 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.
@@ -846,12 +848,12 @@ cross_compiling=$ac_cv_prog_cc_cross
cat > conftest.$ac_ext << EOF
-#line 850 "configure"
+#line 852 "configure"
#include "confdefs.h"
main(){return(0);}
EOF
-if { (eval echo configure:855: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:857: \"$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
@@ -877,12 +879,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:881: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:883: 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:886: checking whether we are using GNU C" >&5
+echo "configure:888: 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
@@ -891,7 +893,7 @@ else
yes;
#endif
EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:895: \"$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:897: \"$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
@@ -910,7 +912,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:914: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:916: 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
@@ -942,7 +944,7 @@ else
fi
echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6
-echo "configure:946: checking for POSIXized ISC" >&5
+echo "configure:948: 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
@@ -980,7 +982,7 @@ BFD_VERSION=`sed -n -e 's/^.._INIT_AUTOMAKE.*,[ ]*\([^ ]*\)[ ]*).*/\1/p' < ${
# 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:984: checking for a BSD compatible install" >&5
+echo "configure:986: 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
@@ -1033,7 +1035,7 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6
-echo "configure:1037: checking whether build environment is sane" >&5
+echo "configure:1039: checking whether build environment is sane" >&5
# Just in case
sleep 1
echo timestamp > conftestfile
@@ -1090,7 +1092,7 @@ test "$program_suffix" != NONE &&
test "$program_transform_name" = "" && program_transform_name="s,x,x,"
echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:1094: checking whether ${MAKE-make} sets \${MAKE}" >&5
+echo "configure:1096: 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
@@ -1136,7 +1138,7 @@ EOF
missing_dir=`cd $ac_aux_dir && pwd`
echo $ac_n "checking for working aclocal""... $ac_c" 1>&6
-echo "configure:1140: checking for working aclocal" >&5
+echo "configure:1142: checking for working aclocal" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
@@ -1149,7 +1151,7 @@ else
fi
echo $ac_n "checking for working autoconf""... $ac_c" 1>&6
-echo "configure:1153: checking for working autoconf" >&5
+echo "configure:1155: checking for working autoconf" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
@@ -1162,7 +1164,7 @@ else
fi
echo $ac_n "checking for working automake""... $ac_c" 1>&6
-echo "configure:1166: checking for working automake" >&5
+echo "configure:1168: checking for working automake" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
@@ -1175,7 +1177,7 @@ else
fi
echo $ac_n "checking for working autoheader""... $ac_c" 1>&6
-echo "configure:1179: checking for working autoheader" >&5
+echo "configure:1181: checking for working autoheader" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
@@ -1188,7 +1190,7 @@ else
fi
echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6
-echo "configure:1192: checking for working makeinfo" >&5
+echo "configure:1194: checking for working makeinfo" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
@@ -1211,7 +1213,7 @@ fi
# Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
set dummy ${ac_tool_prefix}ar; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1215: checking for $ac_word" >&5
+echo "configure:1217: 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
@@ -1243,7 +1245,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:1247: checking for $ac_word" >&5
+echo "configure:1249: 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
@@ -1275,7 +1277,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:1279: checking for $ac_word" >&5
+echo "configure:1281: 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
@@ -1390,7 +1392,7 @@ ac_prog=ld
if test "$GCC" = yes; then
# Check if gcc -print-prog-name=ld gives a path.
echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6
-echo "configure:1394: checking for ld used by GCC" >&5
+echo "configure:1396: checking for ld used by GCC" >&5
case $host in
*-*-mingw*)
# gcc leaves a trailing carriage return which upsets mingw
@@ -1420,10 +1422,10 @@ echo "configure:1394: checking for ld used by GCC" >&5
esac
elif test "$with_gnu_ld" = yes; then
echo $ac_n "checking for GNU ld""... $ac_c" 1>&6
-echo "configure:1424: checking for GNU ld" >&5
+echo "configure:1426: checking for GNU ld" >&5
else
echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6
-echo "configure:1427: checking for non-GNU ld" >&5
+echo "configure:1429: checking for non-GNU ld" >&5
fi
if eval "test \"`echo '$''{'lt_cv_path_LD'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -1458,7 +1460,7 @@ else
fi
test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; }
echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6
-echo "configure:1462: checking if the linker ($LD) is GNU ld" >&5
+echo "configure:1464: checking if the linker ($LD) is GNU ld" >&5
if eval "test \"`echo '$''{'lt_cv_prog_gnu_ld'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1475,7 +1477,7 @@ with_gnu_ld=$lt_cv_prog_gnu_ld
echo $ac_n "checking for $LD option to reload object files""... $ac_c" 1>&6
-echo "configure:1479: checking for $LD option to reload object files" >&5
+echo "configure:1481: checking for $LD option to reload object files" >&5
if eval "test \"`echo '$''{'lt_cv_ld_reload_flag'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1487,7 +1489,7 @@ reload_flag=$lt_cv_ld_reload_flag
test -n "$reload_flag" && reload_flag=" $reload_flag"
echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6
-echo "configure:1491: checking for BSD-compatible nm" >&5
+echo "configure:1493: checking for BSD-compatible nm" >&5
if eval "test \"`echo '$''{'lt_cv_path_NM'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1525,7 +1527,7 @@ NM="$lt_cv_path_NM"
echo "$ac_t""$NM" 1>&6
echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
-echo "configure:1529: checking whether ln -s works" >&5
+echo "configure:1531: 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
@@ -1546,7 +1548,7 @@ else
fi
echo $ac_n "checking how to recognise dependant libraries""... $ac_c" 1>&6
-echo "configure:1550: checking how to recognise dependant libraries" >&5
+echo "configure:1552: checking how to recognise dependant libraries" >&5
if eval "test \"`echo '$''{'lt_cv_deplibs_check_method'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1719,13 +1721,13 @@ file_magic_cmd=$lt_cv_file_magic_cmd
deplibs_check_method=$lt_cv_deplibs_check_method
echo $ac_n "checking for object suffix""... $ac_c" 1>&6
-echo "configure:1723: checking for object suffix" >&5
+echo "configure:1725: checking for object suffix" >&5
if eval "test \"`echo '$''{'ac_cv_objext'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
rm -f conftest*
echo 'int i = 1;' > conftest.$ac_ext
-if { (eval echo configure:1729: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1731: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
for ac_file in conftest.*; do
case $ac_file in
*.c) ;;
@@ -1745,7 +1747,7 @@ ac_objext=$ac_cv_objext
echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
-echo "configure:1749: checking for executable suffix" >&5
+echo "configure:1751: checking for executable suffix" >&5
if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1755,7 +1757,7 @@ else
rm -f conftest*
echo 'int main () { return 0; }' > conftest.$ac_ext
ac_cv_exeext=
- if { (eval echo configure:1759: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+ if { (eval echo configure:1761: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
for file in conftest.*; do
case $file in
*.c | *.o | *.obj) ;;
@@ -1782,7 +1784,7 @@ case $deplibs_check_method in
file_magic*)
if test "$file_magic_cmd" = '$MAGIC_CMD'; then
echo $ac_n "checking for ${ac_tool_prefix}file""... $ac_c" 1>&6
-echo "configure:1786: checking for ${ac_tool_prefix}file" >&5
+echo "configure:1788: checking for ${ac_tool_prefix}file" >&5
if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1844,7 +1846,7 @@ fi
if test -z "$lt_cv_path_MAGIC_CMD"; then
if test -n "$ac_tool_prefix"; then
echo $ac_n "checking for file""... $ac_c" 1>&6
-echo "configure:1848: checking for file" >&5
+echo "configure:1850: checking for file" >&5
if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1915,7 +1917,7 @@ esac
# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
set dummy ${ac_tool_prefix}ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1919: checking for $ac_word" >&5
+echo "configure:1921: 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
@@ -1947,7 +1949,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:1951: checking for $ac_word" >&5
+echo "configure:1953: 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
@@ -1982,7 +1984,7 @@ fi
# Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
set dummy ${ac_tool_prefix}strip; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1986: checking for $ac_word" >&5
+echo "configure:1988: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2014,7 +2016,7 @@ if test -n "$ac_tool_prefix"; then
# Extract the first word of "strip", so it can be a program name with args.
set dummy strip; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2018: checking for $ac_word" >&5
+echo "configure:2020: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2081,8 +2083,8 @@ test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic"
case $host in
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 2085 "configure"' > conftest.$ac_ext
- if { (eval echo configure:2086: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ echo '#line 2087 "configure"' > conftest.$ac_ext
+ if { (eval echo configure:2088: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
case `/usr/bin/file conftest.$ac_objext` in
*32-bit*)
LD="${LD-ld} -32"
@@ -2101,7 +2103,7 @@ case $host in
ia64-*-hpux*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
- if { (eval echo configure:2105: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ if { (eval echo configure:2107: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
case "`/usr/bin/file conftest.o`" in
*ELF-32*)
HPUX_IA64_MODE="32"
@@ -2119,7 +2121,7 @@ ia64-*-hpux*)
SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -belf"
echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6
-echo "configure:2123: checking whether the C compiler needs -belf" >&5
+echo "configure:2125: checking whether the C compiler needs -belf" >&5
if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2132,14 +2134,14 @@ ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$a
cross_compiling=$ac_cv_prog_cc_cross
cat > conftest.$ac_ext <<EOF
-#line 2136 "configure"
+#line 2138 "configure"
#include "confdefs.h"
int main() {
; return 0; }
EOF
-if { (eval echo configure:2143: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2145: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
lt_cv_cc_needs_belf=yes
else
@@ -2307,7 +2309,7 @@ if test -z "$target" ; then
fi
echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6
-echo "configure:2311: checking whether to enable maintainer-specific portions of Makefiles" >&5
+echo "configure:2313: 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"
@@ -2329,10 +2331,45 @@ fi
MAINT=$MAINTAINER_MODE_TRUE
+echo $ac_n "checking whether to install libbfd""... $ac_c" 1>&6
+echo "configure:2336: checking whether to install libbfd" >&5
+ # Check whether --enable-install-libbfd or --disable-install-libbfd was given.
+if test "${enable_install_libbfd+set}" = set; then
+ enableval="$enable_install_libbfd"
+ install_libbfd_p=$enableval
+else
+ if test "${host}" = "${target}" -o "$enable_shared" = "yes"; then
+ install_libbfd_p=yes
+ else
+ install_libbfd_p=no
+ fi
+fi
+
+ echo "$ac_t""$install_libbfd_p" 1>&6
+
+
+if test $install_libbfd_p = yes; then
+ INSTALL_LIBBFD_TRUE=
+ INSTALL_LIBBFD_FALSE='#'
+else
+ INSTALL_LIBBFD_TRUE='#'
+ INSTALL_LIBBFD_FALSE=
+fi
+ # libbfd.a is a host library containing target dependent code
+ bfdlibdir='$(libdir)'
+ bfdincludedir='$(includedir)'
+ if test "${host}" != "${target}"; then
+ bfdlibdir='$(exec_prefix)/$(host_alias)/$(target_alias)/lib'
+ bfdincludedir='$(exec_prefix)/$(host_alias)/$(target_alias)/include'
+ fi
+
+
+
+
echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
-echo "configure:2336: checking for executable suffix" >&5
+echo "configure:2373: checking for executable suffix" >&5
if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2342,7 +2379,7 @@ else
rm -f conftest*
echo 'int main () { return 0; }' > conftest.$ac_ext
ac_cv_exeext=
- if { (eval echo configure:2346: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+ if { (eval echo configure:2383: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
for file in conftest.*; do
case $file in
*.c | *.o | *.obj) ;;
@@ -2368,7 +2405,7 @@ ac_exeext=$EXEEXT
# 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:2372: checking for $ac_word" >&5
+echo "configure:2409: 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
@@ -2398,7 +2435,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:2402: checking for $ac_word" >&5
+echo "configure:2439: 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
@@ -2449,7 +2486,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:2453: checking for $ac_word" >&5
+echo "configure:2490: 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
@@ -2481,7 +2518,7 @@ fi
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:2485: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:2522: 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.
@@ -2492,12 +2529,12 @@ cross_compiling=$ac_cv_prog_cc_cross
cat > conftest.$ac_ext << EOF
-#line 2496 "configure"
+#line 2533 "configure"
#include "confdefs.h"
main(){return(0);}
EOF
-if { (eval echo configure:2501: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2538: \"$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
@@ -2523,12 +2560,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:2527: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:2564: 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:2532: checking whether we are using GNU C" >&5
+echo "configure:2569: 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
@@ -2537,7 +2574,7 @@ else
yes;
#endif
EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2541: \"$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:2578: \"$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
@@ -2556,7 +2593,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:2560: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:2597: 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
@@ -2590,7 +2627,7 @@ fi
ALL_LINGUAS="fr sv tr es da de id"
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:2594: checking how to run the C preprocessor" >&5
+echo "configure:2631: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
@@ -2605,13 +2642,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 2609 "configure"
+#line 2646 "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:2615: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2652: \"$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
:
@@ -2622,13 +2659,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
-#line 2626 "configure"
+#line 2663 "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:2632: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2669: \"$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
:
@@ -2639,13 +2676,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -nologo -E"
cat > conftest.$ac_ext <<EOF
-#line 2643 "configure"
+#line 2680 "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:2649: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2686: \"$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
:
@@ -2672,7 +2709,7 @@ echo "$ac_t""$CPP" 1>&6
# Extract the first word of "ranlib", so it can be a program name with args.
set dummy ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2676: checking for $ac_word" >&5
+echo "configure:2713: 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
@@ -2700,12 +2737,12 @@ else
fi
echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:2704: checking for ANSI C header files" >&5
+echo "configure:2741: 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 2709 "configure"
+#line 2746 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
@@ -2713,7 +2750,7 @@ else
#include <float.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2717: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2754: \"$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*
@@ -2730,7 +2767,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 2734 "configure"
+#line 2771 "configure"
#include "confdefs.h"
#include <string.h>
EOF
@@ -2748,7 +2785,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 2752 "configure"
+#line 2789 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
@@ -2769,7 +2806,7 @@ if test "$cross_compiling" = yes; then
:
else
cat > conftest.$ac_ext <<EOF
-#line 2773 "configure"
+#line 2810 "configure"
#include "confdefs.h"
#include <ctype.h>
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -2780,7 +2817,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
exit (0); }
EOF
-if { (eval echo configure:2784: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2821: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
:
else
@@ -2804,12 +2841,12 @@ EOF
fi
echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:2808: checking for working const" >&5
+echo "configure:2845: 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 2813 "configure"
+#line 2850 "configure"
#include "confdefs.h"
int main() {
@@ -2858,7 +2895,7 @@ ccp = (char const *const *) p;
; return 0; }
EOF
-if { (eval echo configure:2862: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2899: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_const=yes
else
@@ -2879,21 +2916,21 @@ EOF
fi
echo $ac_n "checking for inline""... $ac_c" 1>&6
-echo "configure:2883: checking for inline" >&5
+echo "configure:2920: 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 2890 "configure"
+#line 2927 "configure"
#include "confdefs.h"
int main() {
} $ac_kw foo() {
; return 0; }
EOF
-if { (eval echo configure:2897: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2934: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_inline=$ac_kw; break
else
@@ -2919,12 +2956,12 @@ EOF
esac
echo $ac_n "checking for off_t""... $ac_c" 1>&6
-echo "configure:2923: checking for off_t" >&5
+echo "configure:2960: 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 2928 "configure"
+#line 2965 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@@ -2952,12 +2989,12 @@ EOF
fi
echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:2956: checking for size_t" >&5
+echo "configure:2993: 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 2961 "configure"
+#line 2998 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@@ -2987,19 +3024,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:2991: checking for working alloca.h" >&5
+echo "configure:3028: 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 2996 "configure"
+#line 3033 "configure"
#include "confdefs.h"
#include <alloca.h>
int main() {
char *p = alloca(2 * sizeof(int));
; return 0; }
EOF
-if { (eval echo configure:3003: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3040: \"$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
@@ -3020,12 +3057,12 @@ EOF
fi
echo $ac_n "checking for alloca""... $ac_c" 1>&6
-echo "configure:3024: checking for alloca" >&5
+echo "configure:3061: 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 3029 "configure"
+#line 3066 "configure"
#include "confdefs.h"
#ifdef __GNUC__
@@ -3053,7 +3090,7 @@ int main() {
char *p = (char *) alloca(1);
; return 0; }
EOF
-if { (eval echo configure:3057: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3094: \"$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
@@ -3085,12 +3122,12 @@ EOF
echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
-echo "configure:3089: checking whether alloca needs Cray hooks" >&5
+echo "configure:3126: 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 3094 "configure"
+#line 3131 "configure"
#include "confdefs.h"
#if defined(CRAY) && ! defined(CRAY2)
webecray
@@ -3115,12 +3152,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:3119: checking for $ac_func" >&5
+echo "configure:3156: 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 3124 "configure"
+#line 3161 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3143,7 +3180,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3147: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3184: \"$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
@@ -3170,7 +3207,7 @@ done
fi
echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
-echo "configure:3174: checking stack direction for C alloca" >&5
+echo "configure:3211: 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
@@ -3178,7 +3215,7 @@ else
ac_cv_c_stack_direction=0
else
cat > conftest.$ac_ext <<EOF
-#line 3182 "configure"
+#line 3219 "configure"
#include "confdefs.h"
find_stack_direction ()
{
@@ -3197,7 +3234,7 @@ main ()
exit (find_stack_direction() < 0);
}
EOF
-if { (eval echo configure:3201: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3238: \"$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
@@ -3218,21 +3255,21 @@ EOF
fi
-for ac_hdr in stdlib.h unistd.h sys/stat.h sys/types.h
+for ac_hdr in unistd.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3226: checking for $ac_hdr" >&5
+echo "configure:3263: 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 3231 "configure"
+#line 3268 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3236: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3273: \"$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*
@@ -3261,12 +3298,12 @@ done
for ac_func in getpagesize
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3265: checking for $ac_func" >&5
+echo "configure:3302: 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 3270 "configure"
+#line 3307 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3289,7 +3326,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3293: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3330: \"$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
@@ -3314,7 +3351,7 @@ fi
done
echo $ac_n "checking for working mmap""... $ac_c" 1>&6
-echo "configure:3318: checking for working mmap" >&5
+echo "configure:3355: 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
@@ -3322,7 +3359,7 @@ else
ac_cv_func_mmap_fixed_mapped=no
else
cat > conftest.$ac_ext <<EOF
-#line 3326 "configure"
+#line 3363 "configure"
#include "confdefs.h"
/* Thanks to Mike Haertel and Jim Avera for this test.
@@ -3350,24 +3387,11 @@ else
#include <fcntl.h>
#include <sys/mman.h>
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_STDLIB_H
-# include <stdlib.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
/* This mess was copied from the GNU getpagesize.h. */
#ifndef HAVE_GETPAGESIZE
+# ifdef HAVE_UNISTD_H
+# include <unistd.h>
+# endif
/* Assume that all systems that can run configure have sys/param.h. */
# ifndef HAVE_SYS_PARAM_H
@@ -3475,7 +3499,7 @@ main()
}
EOF
-if { (eval echo configure:3479: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3503: \"$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
@@ -3503,17 +3527,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:3507: checking for $ac_hdr" >&5
+echo "configure:3531: 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 3512 "configure"
+#line 3536 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3517: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3541: \"$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*
@@ -3543,12 +3567,12 @@ done
__argz_count __argz_stringify __argz_next
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3547: checking for $ac_func" >&5
+echo "configure:3571: 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 3552 "configure"
+#line 3576 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3571,7 +3595,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3575: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3599: \"$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
@@ -3600,12 +3624,12 @@ done
for ac_func in stpcpy
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3604: checking for $ac_func" >&5
+echo "configure:3628: 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 3609 "configure"
+#line 3633 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3628,7 +3652,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3632: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3656: \"$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
@@ -3662,19 +3686,19 @@ EOF
if test $ac_cv_header_locale_h = yes; then
echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6
-echo "configure:3666: checking for LC_MESSAGES" >&5
+echo "configure:3690: 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 3671 "configure"
+#line 3695 "configure"
#include "confdefs.h"
#include <locale.h>
int main() {
return LC_MESSAGES
; return 0; }
EOF
-if { (eval echo configure:3678: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3702: \"$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
@@ -3695,7 +3719,7 @@ EOF
fi
fi
echo $ac_n "checking whether NLS is requested""... $ac_c" 1>&6
-echo "configure:3699: checking whether NLS is requested" >&5
+echo "configure:3723: 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"
@@ -3715,7 +3739,7 @@ fi
EOF
echo $ac_n "checking whether included gettext is requested""... $ac_c" 1>&6
-echo "configure:3719: checking whether included gettext is requested" >&5
+echo "configure:3743: 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"
@@ -3734,17 +3758,17 @@ fi
ac_safe=`echo "libintl.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for libintl.h""... $ac_c" 1>&6
-echo "configure:3738: checking for libintl.h" >&5
+echo "configure:3762: 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 3743 "configure"
+#line 3767 "configure"
#include "confdefs.h"
#include <libintl.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3748: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3772: \"$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*
@@ -3761,19 +3785,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:3765: checking for gettext in libc" >&5
+echo "configure:3789: 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 3770 "configure"
+#line 3794 "configure"
#include "confdefs.h"
#include <libintl.h>
int main() {
return (int) gettext ("")
; return 0; }
EOF
-if { (eval echo configure:3777: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3801: \"$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
@@ -3789,7 +3813,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:3793: checking for bindtextdomain in -lintl" >&5
+echo "configure:3817: 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
@@ -3797,7 +3821,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lintl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 3801 "configure"
+#line 3825 "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
@@ -3808,7 +3832,7 @@ int main() {
bindtextdomain()
; return 0; }
EOF
-if { (eval echo configure:3812: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3836: \"$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
@@ -3824,19 +3848,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:3828: checking for gettext in libintl" >&5
+echo "configure:3852: 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 3833 "configure"
+#line 3857 "configure"
#include "confdefs.h"
int main() {
return (int) gettext ("")
; return 0; }
EOF
-if { (eval echo configure:3840: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3864: \"$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
@@ -3864,7 +3888,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:3868: checking for $ac_word" >&5
+echo "configure:3892: 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
@@ -3898,12 +3922,12 @@ fi
for ac_func in dcgettext
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3902: checking for $ac_func" >&5
+echo "configure:3926: 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 3907 "configure"
+#line 3931 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3926,7 +3950,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3930: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3954: \"$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
@@ -3953,7 +3977,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:3957: checking for $ac_word" >&5
+echo "configure:3981: 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
@@ -3989,7 +4013,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:3993: checking for $ac_word" >&5
+echo "configure:4017: 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
@@ -4021,7 +4045,7 @@ else
fi
cat > conftest.$ac_ext <<EOF
-#line 4025 "configure"
+#line 4049 "configure"
#include "confdefs.h"
int main() {
@@ -4029,7 +4053,7 @@ extern int _nl_msg_cat_cntr;
return _nl_msg_cat_cntr
; return 0; }
EOF
-if { (eval echo configure:4033: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4057: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
CATOBJEXT=.gmo
DATADIRNAME=share
@@ -4061,7 +4085,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:4065: checking for $ac_word" >&5
+echo "configure:4089: 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
@@ -4095,7 +4119,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:4099: checking for $ac_word" >&5
+echo "configure:4123: 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
@@ -4131,7 +4155,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:4135: checking for $ac_word" >&5
+echo "configure:4159: 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
@@ -4221,7 +4245,7 @@ fi
LINGUAS=
else
echo $ac_n "checking for catalogs to be installed""... $ac_c" 1>&6
-echo "configure:4225: checking for catalogs to be installed" >&5
+echo "configure:4249: checking for catalogs to be installed" >&5
NEW_LINGUAS=
for lang in ${LINGUAS=$ALL_LINGUAS}; do
case "$ALL_LINGUAS" in
@@ -4249,17 +4273,17 @@ echo "configure:4225: 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:4253: checking for linux/version.h" >&5
+echo "configure:4277: 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 4258 "configure"
+#line 4282 "configure"
#include "confdefs.h"
#include <linux/version.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4263: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4287: \"$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*
@@ -4337,7 +4361,7 @@ if test "x$cross_compiling" = "xno"; then
EXEEXT_FOR_BUILD='$(EXEEXT)'
else
echo $ac_n "checking for build system executable suffix""... $ac_c" 1>&6
-echo "configure:4341: checking for build system executable suffix" >&5
+echo "configure:4365: checking for build system executable suffix" >&5
if eval "test \"`echo '$''{'bfd_cv_build_exeext'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -4374,7 +4398,7 @@ fi
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:4378: checking for a BSD compatible install" >&5
+echo "configure:4402: 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
@@ -4431,17 +4455,17 @@ for ac_hdr in string.h strings.h stdlib.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4435: checking for $ac_hdr" >&5
+echo "configure:4459: 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 4440 "configure"
+#line 4464 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4445: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4469: \"$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*
@@ -4567,6 +4591,7 @@ if test x${all_targets} = xfalse ; then
bfd_cris_arch) ta="$ta cris-dis.lo cris-opc.lo" ;;
bfd_d10v_arch) ta="$ta d10v-dis.lo d10v-opc.lo" ;;
bfd_d30v_arch) ta="$ta d30v-dis.lo d30v-opc.lo" ;;
+ bfd_dlx_arch) ta="$ta dlx-dis.lo" ;;
bfd_fr30_arch) ta="$ta fr30-asm.lo fr30-desc.lo fr30-dis.lo fr30-ibld.lo fr30-opc.lo" using_cgen=yes ;;
bfd_h8300_arch) ta="$ta h8300-dis.lo" ;;
bfd_h8500_arch) ta="$ta h8500-dis.lo" ;;
@@ -4604,7 +4629,8 @@ if test x${all_targets} = xfalse ; then
# Include it just for ELF targets, since the SH5 bfd:s are ELF only.
for t in $target $canon_targets; do
case $t in
- all | sh64-* | sh-*-*elf* | shl-*-*elf* | sh-*-linux* | shl-*-linux*)
+ all | sh5*-* | sh64*-* | sh-*-*elf* | shl*-*-*elf* | \
+ sh-*-linux* | shl-*-linux*)
ta="$ta sh64-dis.lo sh64-opc.lo"
archdefs="$archdefs -DINCLUDE_SHMEDIA"
break;;
@@ -4835,6 +4861,10 @@ s%@WARN_CFLAGS@%$WARN_CFLAGS%g
s%@MAINTAINER_MODE_TRUE@%$MAINTAINER_MODE_TRUE%g
s%@MAINTAINER_MODE_FALSE@%$MAINTAINER_MODE_FALSE%g
s%@MAINT@%$MAINT%g
+s%@INSTALL_LIBBFD_TRUE@%$INSTALL_LIBBFD_TRUE%g
+s%@INSTALL_LIBBFD_FALSE@%$INSTALL_LIBBFD_FALSE%g
+s%@bfdlibdir@%$bfdlibdir%g
+s%@bfdincludedir@%$bfdincludedir%g
s%@CPP@%$CPP%g
s%@ALLOCA@%$ALLOCA%g
s%@USE_NLS@%$USE_NLS%g
diff --git a/opcodes/configure.in b/opcodes/configure.in
index 699f9be06f7..c09fad0600e 100644
--- a/opcodes/configure.in
+++ b/opcodes/configure.in
@@ -71,6 +71,7 @@ if test -z "$target" ; then
fi
AM_MAINTAINER_MODE
+AM_INSTALL_LIBBFD
AC_EXEEXT
# host-specific stuff:
@@ -178,6 +179,7 @@ if test x${all_targets} = xfalse ; then
bfd_cris_arch) ta="$ta cris-dis.lo cris-opc.lo" ;;
bfd_d10v_arch) ta="$ta d10v-dis.lo d10v-opc.lo" ;;
bfd_d30v_arch) ta="$ta d30v-dis.lo d30v-opc.lo" ;;
+ bfd_dlx_arch) ta="$ta dlx-dis.lo" ;;
bfd_fr30_arch) ta="$ta fr30-asm.lo fr30-desc.lo fr30-dis.lo fr30-ibld.lo fr30-opc.lo" using_cgen=yes ;;
bfd_h8300_arch) ta="$ta h8300-dis.lo" ;;
bfd_h8500_arch) ta="$ta h8500-dis.lo" ;;
@@ -215,7 +217,8 @@ if test x${all_targets} = xfalse ; then
# Include it just for ELF targets, since the SH5 bfd:s are ELF only.
for t in $target $canon_targets; do
case $t in
- all | sh64-* | sh-*-*elf* | shl-*-*elf* | sh-*-linux* | shl-*-linux*)
+ all | sh5*-* | sh64*-* | sh-*-*elf* | shl*-*-*elf* | \
+ sh-*-linux* | shl-*-linux*)
ta="$ta sh64-dis.lo sh64-opc.lo"
archdefs="$archdefs -DINCLUDE_SHMEDIA"
break;;
diff --git a/opcodes/d10v-opc.c b/opcodes/d10v-opc.c
index b2ce10f6163..868217775b1 100644
--- a/opcodes/d10v-opc.c
+++ b/opcodes/d10v-opc.c
@@ -1,5 +1,5 @@
/* d10v-opc.c -- D10V opcode list
- Copyright 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
Written by Martin Hunt, Cygnus Support
This file is part of GDB, GAS, and the GNU binutils.
@@ -196,7 +196,7 @@ const struct d10v_opcode d10v_opcodes[] = {
{ "brf0t.s", SHORT_B, 3, MU, BRANCH|PAR|RF0, 0x4b00, 0x7f00, { ANUM8 } },
{ "brf0t.l", LONG_B, 3, MU, SEQ, 0x25800000, 0x3fff0000, { ANUM16 } },
{ "bseti", SHORT_2, 1, IU, PAR, 0x801, 0x7e01, { RDST, UNUM4 } },
- { "btsti", SHORT_2, 1, IU, PAR|WF0, 0xe01, 0x7e01, { RDST, UNUM4 } },
+ { "btsti", SHORT_2, 1, IU, PAR|WF0, 0xe01, 0x7e01, { RSRC2, UNUM4 } },
{ "clrac", SHORT_2, 1, IU, PAR, 0x5601, 0x7eff, { ADST } },
{ "cmp", SHORT_2, 1, EITHER, PAR|WF0, 0x600, 0x7e01, { RSRC2, RSRC } },
{ "cmp", SHORT_2, 1, IU, PAR|WF0, 0x1603, 0x7eef, { ASRC2, ASRC } },
diff --git a/opcodes/disassemble.c b/opcodes/disassemble.c
index 93f3f005a45..bfb22c2c188 100644
--- a/opcodes/disassemble.c
+++ b/opcodes/disassemble.c
@@ -28,6 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define ARCH_cris
#define ARCH_d10v
#define ARCH_d30v
+#define ARCH_dlx
#define ARCH_h8300
#define ARCH_h8500
#define ARCH_hppa
@@ -126,6 +127,12 @@ disassembler (abfd)
disassemble = print_insn_d30v;
break;
#endif
+#ifdef ARCH_dlx
+ case bfd_arch_dlx:
+ /* As far as I know we only handle big-endian DLX objects. */
+ disassemble = print_insn_dlx;
+ break;
+#endif
#ifdef ARCH_h8300
case bfd_arch_h8300:
if (bfd_get_mach(abfd) == bfd_mach_h8300h)
@@ -278,20 +285,7 @@ disassembler (abfd)
#endif
#ifdef ARCH_sh
case bfd_arch_sh:
-#ifdef INCLUDE_SHMEDIA
- if (bfd_get_mach (abfd) == bfd_mach_sh5)
- {
- if (bfd_big_endian (abfd))
- disassemble = print_insn_sh64;
- else
- disassemble = print_insn_sh64l;
- break;
- }
-#endif
- if (bfd_big_endian (abfd))
- disassemble = print_insn_sh;
- else
- disassemble = print_insn_shl;
+ disassemble = print_insn_sh;
break;
#endif
#ifdef ARCH_sparc
diff --git a/opcodes/dlx-dis.c b/opcodes/dlx-dis.c
new file mode 100644
index 00000000000..8878b98aef0
--- /dev/null
+++ b/opcodes/dlx-dis.c
@@ -0,0 +1,544 @@
+/* Instruction printing code for the DLX Microprocessor
+ Copyright 2002 Free Software Foundation, Inc.
+ Contributed by Kuang Hwa Lin. Written by Kuang Hwa Lin, 03/2002.
+
+ 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 "sysdep.h"
+#include "dis-asm.h"
+#include "opcode/dlx.h"
+
+#define R_ERROR 0x1
+#define R_TYPE 0x2
+#define ILD_TYPE 0x3
+#define IST_TYPE 0x4
+#define IAL_TYPE 0x5
+#define IBR_TYPE 0x6
+#define IJ_TYPE 0x7
+#define IJR_TYPE 0x8
+#define NIL 0x9
+
+#define OPC(x) ((x >> 26) & 0x3F)
+#define FUNC(x) (x & 0x7FF)
+
+unsigned char opc, rs1, rs2, rd;
+unsigned long imm26, imm16, func, current_insn_addr;
+
+static unsigned char dlx_get_opcode PARAMS ((unsigned long));
+static unsigned char dlx_get_rs1 PARAMS ((unsigned long));
+static unsigned char dlx_get_rs2 PARAMS ((unsigned long));
+static unsigned char dlx_get_rdR PARAMS ((unsigned long));
+static unsigned long dlx_get_func PARAMS ((unsigned long));
+static unsigned long dlx_get_imm16 PARAMS ((unsigned long));
+static unsigned long dlx_get_imm26 PARAMS ((unsigned long));
+static void operand_deliminator PARAMS ((struct disassemble_info *, char *));
+static unsigned char dlx_r_type PARAMS ((struct disassemble_info *));
+static unsigned char dlx_load_type PARAMS ((struct disassemble_info *));
+static unsigned char dlx_store_type PARAMS ((struct disassemble_info *));
+static unsigned char dlx_aluI_type PARAMS ((struct disassemble_info *));
+static unsigned char dlx_br_type PARAMS ((struct disassemble_info *));
+static unsigned char dlx_jmp_type PARAMS ((struct disassemble_info *));
+static unsigned char dlx_jr_type PARAMS ((struct disassemble_info *));
+
+/* Print one instruction from MEMADDR on INFO->STREAM.
+ Return the size of the instruction (always 4 on dlx). */
+
+static unsigned char
+dlx_get_opcode (opcode)
+ unsigned long opcode;
+{
+ return (unsigned char) ((opcode >> 26) & 0x3F);
+}
+
+static unsigned char
+dlx_get_rs1 (opcode)
+ unsigned long opcode;
+{
+ return (unsigned char) ((opcode >> 21) & 0x1F);
+}
+
+static unsigned char
+dlx_get_rs2 (opcode)
+ unsigned long opcode;
+{
+ return (unsigned char) ((opcode >> 16) & 0x1F);
+}
+
+static unsigned char
+dlx_get_rdR (opcode)
+ unsigned long opcode;
+{
+ return (unsigned char) ((opcode >> 11) & 0x1F);
+}
+
+static unsigned long
+dlx_get_func (opcode)
+ unsigned long opcode;
+{
+ return (unsigned char) (opcode & 0x7FF);
+}
+
+static unsigned long
+dlx_get_imm16 (opcode)
+ unsigned long opcode;
+{
+ return (unsigned long) (opcode & 0xFFFF);
+}
+
+static unsigned long
+dlx_get_imm26 (opcode)
+ unsigned long opcode;
+{
+ return (unsigned long) (opcode & 0x03FFFFFF);
+}
+
+/* Fill the opcode to the max length. */
+static void
+operand_deliminator (info, ptr)
+ struct disassemble_info *info;
+ char *ptr;
+{
+ int difft = 8 - (int) strlen (ptr);
+
+ while (difft > 0)
+ {
+ (*info->fprintf_func) (info->stream, "%c", ' ');
+ difft -= 1;
+ }
+}
+
+/* Process the R-type opcode. */
+static unsigned char
+dlx_r_type (info)
+ struct disassemble_info *info;
+{
+ unsigned char r_opc[] = { OPC(ALUOP) }; /* Fix ME */
+ int r_opc_num = (sizeof r_opc) / (sizeof (char));
+ struct _r_opcode
+ {
+ unsigned long func;
+ char *name;
+ }
+ dlx_r_opcode[] =
+ {
+ { NOPF, "nop" }, /* NOP */
+ { ADDF, "add" }, /* Add */
+ { ADDUF, "addu" }, /* Add Unsigned */
+ { SUBF, "sub" }, /* SUB */
+ { SUBUF, "subu" }, /* Sub Unsigned */
+ { MULTF, "mult" }, /* MULTIPLY */
+ { MULTUF, "multu" }, /* MULTIPLY Unsigned */
+ { DIVF, "div" }, /* DIVIDE */
+ { DIVUF, "divu" }, /* DIVIDE Unsigned */
+ { ANDF, "and" }, /* AND */
+ { ORF, "or" }, /* OR */
+ { XORF, "xor" }, /* Exclusive OR */
+ { SLLF, "sll" }, /* SHIFT LEFT LOGICAL */
+ { SRAF, "sra" }, /* SHIFT RIGHT ARITHMETIC */
+ { SRLF, "srl" }, /* SHIFT RIGHT LOGICAL */
+ { SEQF, "seq" }, /* Set if equal */
+ { SNEF, "sne" }, /* Set if not equal */
+ { SLTF, "slt" }, /* Set if less */
+ { SGTF, "sgt" }, /* Set if greater */
+ { SLEF, "sle" }, /* Set if less or equal */
+ { SGEF, "sge" }, /* Set if greater or equal */
+ { SEQUF, "sequ" }, /* Set if equal */
+ { SNEUF, "sneu" }, /* Set if not equal */
+ { SLTUF, "sltu" }, /* Set if less */
+ { SGTUF, "sgtu" }, /* Set if greater */
+ { SLEUF, "sleu" }, /* Set if less or equal */
+ { SGEUF, "sgeu" }, /* Set if greater or equal */
+ { MVTSF, "mvts" }, /* Move to special register */
+ { MVFSF, "mvfs" }, /* Move from special register */
+ { BSWAPF, "bswap" }, /* Byte swap ?? */
+ { LUTF, "lut" } /* ????????? ?? */
+ };
+ int dlx_r_opcode_num = (sizeof dlx_r_opcode) / (sizeof dlx_r_opcode[0]);
+ int idx;
+
+ for (idx = 0; idx < r_opc_num; idx++)
+ {
+ if (r_opc[idx] != opc)
+ continue;
+ else
+ break;
+ }
+
+ if (idx == r_opc_num)
+ return NIL;
+
+ for (idx = 0 ; idx < dlx_r_opcode_num; idx++)
+ if (dlx_r_opcode[idx].func == func)
+ {
+ (*info->fprintf_func) (info->stream, "%s", dlx_r_opcode[idx].name);
+
+ if (func != NOPF)
+ {
+ /* This is not a nop. */
+ operand_deliminator (info, dlx_r_opcode[idx].name);
+ (*info->fprintf_func) (info->stream, "r%d,", (int)rd);
+ (*info->fprintf_func) (info->stream, "r%d", (int)rs1);
+ if (func != MVTSF && func != MVFSF)
+ (*info->fprintf_func) (info->stream, ",r%d", (int)rs2);
+ }
+ return (unsigned char) R_TYPE;
+ }
+
+ return (unsigned char) R_ERROR;
+}
+
+/* Process the memory read opcode. */
+
+static unsigned char
+dlx_load_type (info)
+ struct disassemble_info* info;
+{
+ struct _load_opcode
+ {
+ unsigned long opcode;
+ char *name;
+ }
+ dlx_load_opcode[] =
+ {
+ { OPC(LHIOP), "lhi" }, /* Load HI to register. */
+ { OPC(LBOP), "lb" }, /* load byte sign extended. */
+ { OPC(LBUOP), "lbu" }, /* load byte unsigned. */
+ { OPC(LSBUOP),"ldstbu"}, /* load store byte unsigned. */
+ { OPC(LHOP), "lh" }, /* load halfword sign extended. */
+ { OPC(LHUOP), "lhu" }, /* load halfword unsigned. */
+ { OPC(LSHUOP),"ldsthu"}, /* load store halfword unsigned. */
+ { OPC(LWOP), "lw" }, /* load word. */
+ { OPC(LSWOP), "ldstw" } /* load store word. */
+ };
+ int dlx_load_opcode_num =
+ (sizeof dlx_load_opcode) / (sizeof dlx_load_opcode[0]);
+ int idx;
+
+ for (idx = 0 ; idx < dlx_load_opcode_num; idx++)
+ if (dlx_load_opcode[idx].opcode == opc)
+ {
+ if (opc == OPC (LHIOP))
+ {
+ (*info->fprintf_func) (info->stream, "%s", dlx_load_opcode[idx].name);
+ operand_deliminator (info, dlx_load_opcode[idx].name);
+ (*info->fprintf_func) (info->stream, "r%d,", (int)rs2);
+ (*info->fprintf_func) (info->stream, "0x%04x", (int)imm16);
+ }
+ else
+ {
+ (*info->fprintf_func) (info->stream, "%s", dlx_load_opcode[idx].name);
+ operand_deliminator (info, dlx_load_opcode[idx].name);
+ (*info->fprintf_func) (info->stream, "r%d,", (int)rs2);
+ (*info->fprintf_func) (info->stream, "0x%04x[r%d]", (int)imm16, (int)rs1);
+ }
+
+ return (unsigned char) ILD_TYPE;
+ }
+
+ return (unsigned char) NIL;
+}
+
+/* Process the memory store opcode. */
+
+static unsigned char
+dlx_store_type (info)
+ struct disassemble_info* info;
+{
+ struct _store_opcode
+ {
+ unsigned long opcode;
+ char *name;
+ }
+ dlx_store_opcode[] =
+ {
+ { OPC(SBOP), "sb" }, /* Store byte. */
+ { OPC(SHOP), "sh" }, /* Store halfword. */
+ { OPC(SWOP), "sw" }, /* Store word. */
+ };
+ int dlx_store_opcode_num =
+ (sizeof dlx_store_opcode) / (sizeof dlx_store_opcode[0]);
+ int idx;
+
+ for (idx = 0 ; idx < dlx_store_opcode_num; idx++)
+ if (dlx_store_opcode[idx].opcode == opc)
+ {
+ (*info->fprintf_func) (info->stream, "%s", dlx_store_opcode[idx].name);
+ operand_deliminator (info, dlx_store_opcode[idx].name);
+ (*info->fprintf_func) (info->stream, "0x%04x[r%d],", (int)imm16, (int)rs1);
+ (*info->fprintf_func) (info->stream, "r%d", (int)rs2);
+ return (unsigned char) IST_TYPE;
+ }
+
+ return (unsigned char) NIL;
+}
+
+/* Process the Arithmetic and Logical I-TYPE opcode. */
+
+static unsigned char
+dlx_aluI_type (info)
+ struct disassemble_info* info;
+{
+ struct _aluI_opcode
+ {
+ unsigned long opcode;
+ char *name;
+ }
+ dlx_aluI_opcode[] =
+ {
+ { OPC(ADDIOP), "addi" }, /* Store byte. */
+ { OPC(ADDUIOP), "addui" }, /* Store halfword. */
+ { OPC(SUBIOP), "subi" }, /* Store word. */
+ { OPC(SUBUIOP), "subui" }, /* Store word. */
+ { OPC(ANDIOP), "andi" }, /* Store word. */
+ { OPC(ORIOP), "ori" }, /* Store word. */
+ { OPC(XORIOP), "xori" }, /* Store word. */
+ { OPC(SLLIOP), "slli" }, /* Store word. */
+ { OPC(SRAIOP), "srai" }, /* Store word. */
+ { OPC(SRLIOP), "srli" }, /* Store word. */
+ { OPC(SEQIOP), "seqi" }, /* Store word. */
+ { OPC(SNEIOP), "snei" }, /* Store word. */
+ { OPC(SLTIOP), "slti" }, /* Store word. */
+ { OPC(SGTIOP), "sgti" }, /* Store word. */
+ { OPC(SLEIOP), "slei" }, /* Store word. */
+ { OPC(SGEIOP), "sgei" }, /* Store word. */
+ { OPC(SEQUIOP), "sequi" }, /* Store word. */
+ { OPC(SNEUIOP), "sneui" }, /* Store word. */
+ { OPC(SLTUIOP), "sltui" }, /* Store word. */
+ { OPC(SGTUIOP), "sgtui" }, /* Store word. */
+ { OPC(SLEUIOP), "sleui" }, /* Store word. */
+ { OPC(SGEUIOP), "sgeui" }, /* Store word. */
+#if 0
+ { OPC(MVTSOP), "mvts" }, /* Store word. */
+ { OPC(MVFSOP), "mvfs" }, /* Store word. */
+#endif
+ };
+ int dlx_aluI_opcode_num =
+ (sizeof dlx_aluI_opcode) / (sizeof dlx_aluI_opcode[0]);
+ int idx;
+
+ for (idx = 0 ; idx < dlx_aluI_opcode_num; idx++)
+ if (dlx_aluI_opcode[idx].opcode == opc)
+ {
+ (*info->fprintf_func) (info->stream, "%s", dlx_aluI_opcode[idx].name);
+ operand_deliminator (info, dlx_aluI_opcode[idx].name);
+ (*info->fprintf_func) (info->stream, "r%d,", (int)rs2);
+ (*info->fprintf_func) (info->stream, "r%d,", (int)rs1);
+ (*info->fprintf_func) (info->stream, "0x%04x", (int)imm16);
+
+ return (unsigned char) IAL_TYPE;
+ }
+
+ return (unsigned char) NIL;
+}
+
+/* Process the branch instruction. */
+
+static unsigned char
+dlx_br_type (info)
+ struct disassemble_info* info;
+{
+ struct _br_opcode
+ {
+ unsigned long opcode;
+ char *name;
+ }
+ dlx_br_opcode[] =
+ {
+ { OPC(BEQOP), "beqz" }, /* Store byte. */
+ { OPC(BNEOP), "bnez" } /* Store halfword. */
+ };
+ int dlx_br_opcode_num =
+ (sizeof dlx_br_opcode) / (sizeof dlx_br_opcode[0]);
+ int idx;
+
+ for (idx = 0 ; idx < dlx_br_opcode_num; idx++)
+ if (dlx_br_opcode[idx].opcode == opc)
+ {
+ if (imm16 & 0x00008000)
+ imm16 |= 0xFFFF0000;
+
+ imm16 += (current_insn_addr + 4);
+ (*info->fprintf_func) (info->stream, "%s", dlx_br_opcode[idx].name);
+ operand_deliminator (info, dlx_br_opcode[idx].name);
+ (*info->fprintf_func) (info->stream, "r%d,", (int)rs1);
+ (*info->fprintf_func) (info->stream, "0x%08x", (int)imm16);
+
+ return (unsigned char) IBR_TYPE;
+ }
+
+ return (unsigned char) NIL;
+}
+
+/* Process the jump instruction. */
+
+static unsigned char
+dlx_jmp_type (info)
+ struct disassemble_info* info;
+{
+ struct _jmp_opcode
+ {
+ unsigned long opcode;
+ char *name;
+ }
+ dlx_jmp_opcode[] =
+ {
+ { OPC(JOP), "j" }, /* Store byte. */
+ { OPC(JALOP), "jal" }, /* Store halfword. */
+ { OPC(BREAKOP), "break" }, /* Store halfword. */
+ { OPC(TRAPOP), "trap" }, /* Store halfword. */
+ { OPC(RFEOP), "rfe" } /* Store halfword. */
+ };
+ int dlx_jmp_opcode_num =
+ (sizeof dlx_jmp_opcode) / (sizeof dlx_jmp_opcode[0]);
+ int idx;
+
+ for (idx = 0 ; idx < dlx_jmp_opcode_num; idx++)
+ if (dlx_jmp_opcode[idx].opcode == opc)
+ {
+ if (imm26 & 0x02000000)
+ imm26 |= 0xFC000000;
+
+ imm26 += (current_insn_addr + 4);
+
+ (*info->fprintf_func) (info->stream, "%s", dlx_jmp_opcode[idx].name);
+ operand_deliminator (info, dlx_jmp_opcode[idx].name);
+ (*info->fprintf_func) (info->stream, "0x%08x", (int)imm26);
+
+ return (unsigned char) IJ_TYPE;
+ }
+
+ return (unsigned char) NIL;
+}
+
+/* Process the jump register instruction. */
+
+static unsigned char
+dlx_jr_type (info)
+ struct disassemble_info* info;
+{
+ struct _jr_opcode
+ {
+ unsigned long opcode;
+ char *name;
+ }
+ dlx_jr_opcode[] = {
+ { OPC(JROP), "jr" }, /* Store byte. */
+ { OPC(JALROP), "jalr" } /* Store halfword. */
+ };
+ int dlx_jr_opcode_num =
+ (sizeof dlx_jr_opcode) / (sizeof dlx_jr_opcode[0]);
+ int idx;
+
+ for (idx = 0 ; idx < dlx_jr_opcode_num; idx++)
+ if (dlx_jr_opcode[idx].opcode == opc)
+ {
+ (*info->fprintf_func) (info->stream, "%s", dlx_jr_opcode[idx].name);
+ operand_deliminator (info, dlx_jr_opcode[idx].name);
+ (*info->fprintf_func) (info->stream, "r%d", (int)rs1);
+ return (unsigned char) IJR_TYPE;
+ }
+
+ return (unsigned char) NIL;
+}
+
+typedef unsigned char (* dlx_insn) PARAMS ((struct disassemble_info *));
+
+/* This is the main DLX insn handling routine. */
+
+int
+print_insn_dlx (memaddr, info)
+ bfd_vma memaddr;
+ struct disassemble_info* info;
+{
+ bfd_byte buffer[4];
+ int insn_idx;
+ unsigned long insn_word;
+ unsigned char rtn_code;
+ unsigned long dlx_insn_type[] =
+ {
+ (unsigned long) dlx_r_type,
+ (unsigned long) dlx_load_type,
+ (unsigned long) dlx_store_type,
+ (unsigned long) dlx_aluI_type,
+ (unsigned long) dlx_br_type,
+ (unsigned long) dlx_jmp_type,
+ (unsigned long) dlx_jr_type,
+ (unsigned long) NULL
+ };
+ int dlx_insn_type_num = ((sizeof dlx_insn_type) / (sizeof (unsigned long))) - 1;
+ int status =
+ (*info->read_memory_func) (memaddr, (bfd_byte *) &buffer[0], 4, info);
+
+ if (status != 0)
+ {
+ (*info->memory_error_func) (status, memaddr, info);
+ return -1;
+ }
+
+ /* Now decode the insn */
+ insn_word = bfd_getb32 (buffer);
+ opc = dlx_get_opcode (insn_word);
+ rs1 = dlx_get_rs1 (insn_word);
+ rs2 = dlx_get_rs2 (insn_word);
+ rd = dlx_get_rdR (insn_word);
+ func = dlx_get_func (insn_word);
+ imm16= dlx_get_imm16 (insn_word);
+ imm26= dlx_get_imm26 (insn_word);
+
+#if 0
+ printf ("print_insn_big_dlx: opc = 0x%02x\n"
+ " rs1 = 0x%02x\n"
+ " rs2 = 0x%02x\n"
+ " rd = 0x%02x\n"
+ " func = 0x%08x\n"
+ " imm16 = 0x%08x\n"
+ " imm26 = 0x%08x\n",
+ opc, rs1, rs2, rd, func, imm16, imm26);
+#endif
+
+ /* Scan through all the insn type and print the insn out. */
+ rtn_code = 0;
+ current_insn_addr = (unsigned long) memaddr;
+
+ for (insn_idx = 0; dlx_insn_type[insn_idx] != 0x0; insn_idx++)
+ switch (((dlx_insn) (dlx_insn_type[insn_idx])) (info))
+ {
+ /* Found the correct opcode */
+ case R_TYPE:
+ case ILD_TYPE:
+ case IST_TYPE:
+ case IAL_TYPE:
+ case IBR_TYPE:
+ case IJ_TYPE:
+ case IJR_TYPE:
+ return 4;
+
+ /* Wrong insn type check next one. */
+ default:
+ case NIL:
+ continue;
+
+ /* All rest of the return code are not recongnized, treat it as error */
+ /* we should never get here, I hope! */
+ case R_ERROR:
+ return -1;
+ }
+
+ if (insn_idx == dlx_insn_type_num)
+ /* Well, does not recoganize this opcode. */
+ (*info->fprintf_func) (info->stream, "<%s>", "Unrecognized Opcode");
+
+ return 4;
+}
diff --git a/opcodes/fr30-asm.c b/opcodes/fr30-asm.c
index 40f015ad035..be9c36c947c 100644
--- a/opcodes/fr30-asm.c
+++ b/opcodes/fr30-asm.c
@@ -571,7 +571,7 @@ parse_insn_normal (cd, insn, strp, fields)
}
/* We have an operand of some sort. */
- errmsg = fr30_cgen_parse_operand (cd, CGEN_SYNTAX_FIELD (*syn),
+ errmsg = cd->parse_operand (cd, CGEN_SYNTAX_FIELD (*syn),
&str, fields);
if (errmsg)
return errmsg;
diff --git a/opcodes/fr30-desc.c b/opcodes/fr30-desc.c
index fd6afee7d2d..18963b9f168 100644
--- a/opcodes/fr30-desc.c
+++ b/opcodes/fr30-desc.c
@@ -1747,10 +1747,43 @@ void
fr30_cgen_cpu_close (cd)
CGEN_CPU_DESC cd;
{
+ unsigned int i;
+ CGEN_INSN *insns;
+
+ if (cd->macro_insn_table.init_entries)
+ {
+ insns = cd->macro_insn_table.init_entries;
+ for (i = 0; i < cd->macro_insn_table.num_init_entries; ++i, ++insns)
+ {
+ if (CGEN_INSN_RX ((insns)))
+ regfree(CGEN_INSN_RX (insns));
+ }
+ }
+
+ if (cd->insn_table.init_entries)
+ {
+ insns = cd->insn_table.init_entries;
+ for (i = 0; i < cd->insn_table.num_init_entries; ++i, ++insns)
+ {
+ if (CGEN_INSN_RX (insns))
+ regfree(CGEN_INSN_RX (insns));
+ }
+ }
+
+
+
+ if (cd->macro_insn_table.init_entries)
+ free ((CGEN_INSN *) cd->macro_insn_table.init_entries);
+
if (cd->insn_table.init_entries)
free ((CGEN_INSN *) cd->insn_table.init_entries);
+
if (cd->hw_table.entries)
free ((CGEN_HW_ENTRY *) cd->hw_table.entries);
+
+ if (cd->operand_table.entries)
+ free ((CGEN_HW_ENTRY *) cd->operand_table.entries);
+
free (cd);
}
diff --git a/opcodes/fr30-dis.c b/opcodes/fr30-dis.c
index 961ce220290..7affa860f4f 100644
--- a/opcodes/fr30-dis.c
+++ b/opcodes/fr30-dis.c
@@ -632,11 +632,21 @@ default_print_insn (cd, pc, info)
Print one instruction from PC on INFO->STREAM.
Return the size of the instruction (in bytes). */
+typedef struct cpu_desc_list {
+ struct cpu_desc_list *next;
+ int isa;
+ int mach;
+ int endian;
+ CGEN_CPU_DESC cd;
+} cpu_desc_list;
+
int
print_insn_fr30 (pc, info)
bfd_vma pc;
disassemble_info *info;
{
+ static cpu_desc_list *cd_list = 0;
+ cpu_desc_list *cl = 0;
static CGEN_CPU_DESC cd = 0;
static int prev_isa;
static int prev_mach;
@@ -667,18 +677,27 @@ print_insn_fr30 (pc, info)
#ifdef CGEN_COMPUTE_ISA
isa = CGEN_COMPUTE_ISA (info);
#else
- isa = 0;
+ isa = info->insn_sets;
#endif
- /* If we've switched cpu's, close the current table and open a new one. */
+ /* If we've switched cpu's, try to find a handle we've used before */
if (cd
&& (isa != prev_isa
|| mach != prev_mach
|| endian != prev_endian))
{
- fr30_cgen_cpu_close (cd);
cd = 0;
- }
+ for (cl = cd_list; cl; cl = cl->next)
+ {
+ if (cl->isa == isa &&
+ cl->mach == mach &&
+ cl->endian == endian)
+ {
+ cd = cl->cd;
+ break;
+ }
+ }
+ }
/* If we haven't initialized yet, initialize the opcode table. */
if (! cd)
@@ -699,6 +718,16 @@ print_insn_fr30 (pc, info)
CGEN_CPU_OPEN_END);
if (!cd)
abort ();
+
+ /* save this away for future reference */
+ cl = xmalloc (sizeof (struct cpu_desc_list));
+ cl->cd = cd;
+ cl->isa = isa;
+ cl->mach = mach;
+ cl->endian = endian;
+ cl->next = cd_list;
+ cd_list = cl;
+
fr30_cgen_init_dis (cd);
}
diff --git a/opcodes/h8300-dis.c b/opcodes/h8300-dis.c
index c521c773fce..d14fda9858b 100644
--- a/opcodes/h8300-dis.c
+++ b/opcodes/h8300-dis.c
@@ -1,5 +1,6 @@
/* Disassemble h8300 instructions.
- Copyright 1993, 1994, 1996, 1998, 2000, 2001 Free Software Foundation, Inc.
+ Copyright 1993, 1994, 1996, 1998, 2000, 2001, 2002
+ 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
@@ -69,17 +70,17 @@ bfd_h8_disassemble (addr, info, mode)
int mode;
{
/* Find the first entry in the table for this opcode. */
- static CONST char *regnames[] =
+ static const char *regnames[] =
{
"r0h", "r1h", "r2h", "r3h", "r4h", "r5h", "r6h", "r7h",
"r0l", "r1l", "r2l", "r3l", "r4l", "r5l", "r6l", "r7l"
};
- static CONST char *wregnames[] =
+ static const char *wregnames[] =
{
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
"e0", "e1", "e2", "e3", "e4", "e5", "e6", "e7"
};
- static CONST char *lregnames[] =
+ static const char *lregnames[] =
{
"er0", "er1", "er2", "er3", "er4", "er5", "er6", "er7",
"er0", "er1", "er2", "er3", "er4", "er5", "er6", "er7"
@@ -92,7 +93,7 @@ bfd_h8_disassemble (addr, info, mode)
int plen = 0;
static boolean init = 0;
struct h8_opcode *q;
- char CONST **pregnames = mode != 0 ? lregnames : wregnames;
+ char const **pregnames = mode != 0 ? lregnames : wregnames;
int status;
int l;
unsigned char data[20];
diff --git a/opcodes/m32r-asm.c b/opcodes/m32r-asm.c
index 718dd994ce1..4abe187b81f 100644
--- a/opcodes/m32r-asm.c
+++ b/opcodes/m32r-asm.c
@@ -573,7 +573,7 @@ parse_insn_normal (cd, insn, strp, fields)
}
/* We have an operand of some sort. */
- errmsg = m32r_cgen_parse_operand (cd, CGEN_SYNTAX_FIELD (*syn),
+ errmsg = cd->parse_operand (cd, CGEN_SYNTAX_FIELD (*syn),
&str, fields);
if (errmsg)
return errmsg;
diff --git a/opcodes/m32r-desc.c b/opcodes/m32r-desc.c
index 4acf72044c5..de7bde44fdc 100644
--- a/opcodes/m32r-desc.c
+++ b/opcodes/m32r-desc.c
@@ -1441,10 +1441,43 @@ void
m32r_cgen_cpu_close (cd)
CGEN_CPU_DESC cd;
{
+ unsigned int i;
+ CGEN_INSN *insns;
+
+ if (cd->macro_insn_table.init_entries)
+ {
+ insns = cd->macro_insn_table.init_entries;
+ for (i = 0; i < cd->macro_insn_table.num_init_entries; ++i, ++insns)
+ {
+ if (CGEN_INSN_RX ((insns)))
+ regfree(CGEN_INSN_RX (insns));
+ }
+ }
+
+ if (cd->insn_table.init_entries)
+ {
+ insns = cd->insn_table.init_entries;
+ for (i = 0; i < cd->insn_table.num_init_entries; ++i, ++insns)
+ {
+ if (CGEN_INSN_RX (insns))
+ regfree(CGEN_INSN_RX (insns));
+ }
+ }
+
+
+
+ if (cd->macro_insn_table.init_entries)
+ free ((CGEN_INSN *) cd->macro_insn_table.init_entries);
+
if (cd->insn_table.init_entries)
free ((CGEN_INSN *) cd->insn_table.init_entries);
+
if (cd->hw_table.entries)
free ((CGEN_HW_ENTRY *) cd->hw_table.entries);
+
+ if (cd->operand_table.entries)
+ free ((CGEN_HW_ENTRY *) cd->operand_table.entries);
+
free (cd);
}
diff --git a/opcodes/m32r-dis.c b/opcodes/m32r-dis.c
index 40d7679907e..07560e15ff5 100644
--- a/opcodes/m32r-dis.c
+++ b/opcodes/m32r-dis.c
@@ -563,11 +563,21 @@ default_print_insn (cd, pc, info)
Print one instruction from PC on INFO->STREAM.
Return the size of the instruction (in bytes). */
+typedef struct cpu_desc_list {
+ struct cpu_desc_list *next;
+ int isa;
+ int mach;
+ int endian;
+ CGEN_CPU_DESC cd;
+} cpu_desc_list;
+
int
print_insn_m32r (pc, info)
bfd_vma pc;
disassemble_info *info;
{
+ static cpu_desc_list *cd_list = 0;
+ cpu_desc_list *cl = 0;
static CGEN_CPU_DESC cd = 0;
static int prev_isa;
static int prev_mach;
@@ -598,18 +608,27 @@ print_insn_m32r (pc, info)
#ifdef CGEN_COMPUTE_ISA
isa = CGEN_COMPUTE_ISA (info);
#else
- isa = 0;
+ isa = info->insn_sets;
#endif
- /* If we've switched cpu's, close the current table and open a new one. */
+ /* If we've switched cpu's, try to find a handle we've used before */
if (cd
&& (isa != prev_isa
|| mach != prev_mach
|| endian != prev_endian))
{
- m32r_cgen_cpu_close (cd);
cd = 0;
- }
+ for (cl = cd_list; cl; cl = cl->next)
+ {
+ if (cl->isa == isa &&
+ cl->mach == mach &&
+ cl->endian == endian)
+ {
+ cd = cl->cd;
+ break;
+ }
+ }
+ }
/* If we haven't initialized yet, initialize the opcode table. */
if (! cd)
@@ -630,6 +649,16 @@ print_insn_m32r (pc, info)
CGEN_CPU_OPEN_END);
if (!cd)
abort ();
+
+ /* save this away for future reference */
+ cl = xmalloc (sizeof (struct cpu_desc_list));
+ cl->cd = cd;
+ cl->isa = isa;
+ cl->mach = mach;
+ cl->endian = endian;
+ cl->next = cd_list;
+ cd_list = cl;
+
m32r_cgen_init_dis (cd);
}
diff --git a/opcodes/m68k-dis.c b/opcodes/m68k-dis.c
index 0e9afb02f9a..12c0b9460ef 100644
--- a/opcodes/m68k-dis.c
+++ b/opcodes/m68k-dis.c
@@ -1,6 +1,6 @@
/* Print Motorola 68k instructions.
Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
- 1998, 1999, 2000, 2001
+ 1998, 1999, 2000, 2001, 2002
Free Software Foundation, Inc.
This file is free software; you can redistribute it and/or modify
@@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "sysdep.h"
#include "dis-asm.h"
#include "floatformat.h"
-#include <libiberty.h>
+#include "libiberty.h"
#include "opintl.h"
#include "opcode/m68k.h"
@@ -46,7 +46,7 @@ static int
print_insn_arg PARAMS ((const char *, unsigned char *, unsigned char *,
bfd_vma, disassemble_info *));
-CONST char * CONST fpcr_names[] = {
+const char * const fpcr_names[] = {
"", "%fpiar", "%fpsr", "%fpiar/%fpsr", "%fpcr",
"%fpiar/%fpcr", "%fpsr/%fpcr", "%fpiar/%fpsr/%fpcr"
};
@@ -478,7 +478,7 @@ print_insn_arg (d, buffer, p0, addr, info)
register int place = d[1];
register unsigned char *p = p0;
int regno;
- register CONST char *regname;
+ register const char *regname;
register unsigned char *p1;
double flval;
int flt_p;
diff --git a/opcodes/mips-dis.c b/opcodes/mips-dis.c
index 9931a1882e1..b832ca2ce45 100644
--- a/opcodes/mips-dis.c
+++ b/opcodes/mips-dis.c
@@ -284,6 +284,53 @@ print_insn_arg (d, l, pc, info)
(l >> OP_SH_SEL) & OP_MASK_SEL);
break;
+ case 'O':
+ (*info->fprintf_func) (info->stream, "%d",
+ (l >> OP_SH_ALN) & OP_MASK_ALN);
+ break;
+
+ case 'Q':
+ {
+ unsigned int vsel = (l >> OP_SH_VSEL) & OP_MASK_VSEL;
+ if ((vsel & 0x10) == 0)
+ {
+ int fmt;
+ vsel &= 0x0f;
+ for (fmt = 0; fmt < 3; fmt++, vsel >>= 1)
+ if ((vsel & 1) == 0)
+ break;
+ (*info->fprintf_func) (info->stream, "$v%d[%d]",
+ (l >> OP_SH_FT) & OP_MASK_FT,
+ vsel >> 1);
+ }
+ else if ((vsel & 0x08) == 0)
+ {
+ (*info->fprintf_func) (info->stream, "$v%d",
+ (l >> OP_SH_FT) & OP_MASK_FT);
+ }
+ else
+ {
+ (*info->fprintf_func) (info->stream, "0x%x",
+ (l >> OP_SH_FT) & OP_MASK_FT);
+ }
+ }
+ break;
+
+ case 'X':
+ (*info->fprintf_func) (info->stream, "$v%d",
+ (l >> OP_SH_FD) & OP_MASK_FD);
+ break;
+
+ case 'Y':
+ (*info->fprintf_func) (info->stream, "$v%d",
+ (l >> OP_SH_FS) & OP_MASK_FS);
+ break;
+
+ case 'Z':
+ (*info->fprintf_func) (info->stream, "$v%d",
+ (l >> OP_SH_FT) & OP_MASK_FT);
+ break;
+
default:
/* xgettext:c-format */
(*info->fprintf_func) (info->stream,
@@ -378,8 +425,8 @@ mips_isa_type (mach, isa, cputype)
case bfd_mach_mipsisa32:
*cputype = CPU_MIPS32;
/* For stock MIPS32, disassemble all applicable MIPS-specified ASEs.
- Note that MIPS-3D is not applicable to MIPS32. (See _MIPS32
- Architecture For Programmers Volume I: Introduction to the
+ Note that MIPS-3D and MDMX are not applicable to MIPS32. (See
+ _MIPS32 Architecture For Programmers Volume I: Introduction to the
MIPS32 Architecture_ (MIPS Document Number MD00082, Revision 0.95),
page 1. */
*isa = ISA_MIPS32;
@@ -387,7 +434,7 @@ mips_isa_type (mach, isa, cputype)
case bfd_mach_mipsisa64:
*cputype = CPU_MIPS64;
/* For stock MIPS64, disassemble all applicable MIPS-specified ASEs. */
- *isa = ISA_MIPS64 | INSN_MIPS3D;
+ *isa = ISA_MIPS64 | INSN_MDMX | INSN_MIPS3D;
break;
default:
@@ -407,10 +454,8 @@ is_newabi (header)
if (header->e_ident[EI_CLASS] == ELFCLASS64)
return 1;
- /* If a 32-bit ELF file, N32, EABI32, and EABI64 are new-style ABIs. */
- if ((header->e_flags & EF_MIPS_ABI2) != 0
- || (header->e_flags & EF_MIPS_ABI) == E_MIPS_ABI_EABI32
- || (header->e_flags & EF_MIPS_ABI) == E_MIPS_ABI_EABI64)
+ /* If a 32-bit ELF file, n32 is a new-style ABI. */
+ if ((header->e_flags & EF_MIPS_ABI2) != 0)
return 1;
return 0;
diff --git a/opcodes/mips-opc.c b/opcodes/mips-opc.c
index d3776d6f445..cbf92230a9a 100644
--- a/opcodes/mips-opc.c
+++ b/opcodes/mips-opc.c
@@ -4,7 +4,7 @@
Contributed by Ralph Campbell and OSF
Commented and modified by Ian Lance Taylor, Cygnus Support
Extended for MIPS32 support by Anders Norlander, and by SiByte, Inc.
- MIPS-3D support added by Broadcom Corporation (SiByte).
+ MIPS-3D and MDMX support added by Broadcom Corporation (SiByte).
This file is part of GDB, GAS, and the GNU binutils.
@@ -75,6 +75,9 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
#define IS_M INSN_MULT
+#define WR_MACC INSN_WRITE_MDMX_ACC
+#define RD_MACC INSN_READ_MDMX_ACC
+
#define I1 INSN_ISA1
#define I2 INSN_ISA2
#define I3 INSN_ISA3
@@ -86,6 +89,9 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
/* MIPS64 MIPS-3D ASE support. */
#define M3D INSN_MIPS3D
+/* MIPS64 MDMX ASE support. */
+#define MX INSN_MDMX
+
#define P3 INSN_4650
#define L1 INSN_4010
#define V1 INSN_4100
@@ -144,15 +150,27 @@ const struct mips_opcode mips_builtin_opcodes[] =
{"add", "t,r,I", 0, (int) M_ADD_I, INSN_MACRO, I1 },
{"add.s", "D,V,T", 0x46000000, 0xffe0003f, WR_D|RD_S|RD_T|FP_S, I1 },
{"add.d", "D,V,T", 0x46200000, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, I1 },
+{"add.ob", "X,Y,Q", 0x7800000b, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX|SB1 },
{"add.ps", "D,V,T", 0x46c00000, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, I5 },
+{"add.qh", "X,Y,Q", 0x7820000b, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX },
+{"adda.ob", "Y,Q", 0x78000037, 0xfc2007ff, WR_MACC|RD_S|RD_T|FP_D, MX|SB1 },
+{"adda.qh", "Y,Q", 0x78200037, 0xfc2007ff, WR_MACC|RD_S|RD_T|FP_D, MX },
{"addi", "t,r,j", 0x20000000, 0xfc000000, WR_t|RD_s, I1 },
{"addiu", "t,r,j", 0x24000000, 0xfc000000, WR_t|RD_s, I1 },
+{"addl.ob", "Y,Q", 0x78000437, 0xfc2007ff, WR_MACC|RD_S|RD_T|FP_D, MX|SB1 },
+{"addl.qh", "Y,Q", 0x78200437, 0xfc2007ff, WR_MACC|RD_S|RD_T|FP_D, MX },
{"addr.ps", "D,S,T", 0x46c00018, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, M3D },
{"addu", "d,v,t", 0x00000021, 0xfc0007ff, WR_d|RD_s|RD_t, I1 },
{"addu", "t,r,I", 0, (int) M_ADDU_I, INSN_MACRO, I1 },
+{"alni.ob", "X,Y,Z,O", 0x78000018, 0xff00003f, WR_D|RD_S|RD_T|FP_D, MX|SB1 },
+{"alni.qh", "X,Y,Z,O", 0x7800001a, 0xff00003f, WR_D|RD_S|RD_T|FP_D, MX },
{"alnv.ps", "D,V,T,s", 0x4c00001e, 0xfc00003f, WR_D|RD_S|RD_T|FP_D, I5 },
+{"alnv.ob", "X,Y,Z,s", 0x78000019, 0xfc00003f, WR_D|RD_S|RD_T|RD_s|FP_D, MX|SB1 },
+{"alnv.qh", "X,Y,Z,s", 0x7800001b, 0xfc00003f, WR_D|RD_S|RD_T|RD_s|FP_D, MX },
{"and", "d,v,t", 0x00000024, 0xfc0007ff, WR_d|RD_s|RD_t, I1 },
{"and", "t,r,I", 0, (int) M_AND_I, INSN_MACRO, I1 },
+{"and.ob", "X,Y,Q", 0x7800000c, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX|SB1 },
+{"and.qh", "X,Y,Q", 0x7820000c, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX },
{"andi", "t,r,i", 0x30000000, 0xfc000000, WR_t|RD_s, I1 },
/* b is at the top of the table. */
/* bal is at the top of the table. */
@@ -256,8 +274,10 @@ const struct mips_opcode mips_builtin_opcodes[] =
{"c.eq.d", "M,S,T", 0x46200032, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, I4|I32 },
{"c.eq.s", "S,T", 0x46000032, 0xffe007ff, RD_S|RD_T|WR_CC|FP_S, I1 },
{"c.eq.s", "M,S,T", 0x46000032, 0xffe000ff, RD_S|RD_T|WR_CC|FP_S, I4|I32 },
+{"c.eq.ob", "Y,Q", 0x78000001, 0xfc2007ff, WR_CC|RD_S|RD_T|FP_D, MX|SB1 },
{"c.eq.ps", "S,T", 0x46c00032, 0xffe007ff, RD_S|RD_T|WR_CC|FP_D, I5 },
{"c.eq.ps", "M,S,T", 0x46c00032, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, I5 },
+{"c.eq.qh", "Y,Q", 0x78200001, 0xfc2007ff, WR_CC|RD_S|RD_T|FP_D, MX },
{"c.ueq.d", "S,T", 0x46200033, 0xffe007ff, RD_S|RD_T|WR_CC|FP_D, I1 },
{"c.ueq.d", "M,S,T", 0x46200033, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, I4|I32 },
{"c.ueq.s", "S,T", 0x46000033, 0xffe007ff, RD_S|RD_T|WR_CC|FP_S, I1 },
@@ -316,8 +336,10 @@ const struct mips_opcode mips_builtin_opcodes[] =
{"c.lt.d", "M,S,T", 0x4620003c, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, I4|I32 },
{"c.lt.s", "S,T", 0x4600003c, 0xffe007ff, RD_S|RD_T|WR_CC|FP_S, I1 },
{"c.lt.s", "M,S,T", 0x4600003c, 0xffe000ff, RD_S|RD_T|WR_CC|FP_S, I4|I32 },
+{"c.lt.ob", "Y,Q", 0x78000004, 0xfc2007ff, WR_CC|RD_S|RD_T|FP_D, MX|SB1 },
{"c.lt.ps", "S,T", 0x46c0003c, 0xffe007ff, RD_S|RD_T|WR_CC|FP_D, I5 },
{"c.lt.ps", "M,S,T", 0x46c0003c, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, I5 },
+{"c.lt.qh", "Y,Q", 0x78200004, 0xfc2007ff, WR_CC|RD_S|RD_T|FP_D, MX },
{"c.nge.d", "S,T", 0x4620003d, 0xffe007ff, RD_S|RD_T|WR_CC|FP_D, I1 },
{"c.nge.d", "M,S,T", 0x4620003d, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, I4|I32 },
{"c.nge.s", "S,T", 0x4600003d, 0xffe007ff, RD_S|RD_T|WR_CC|FP_S, I1 },
@@ -328,8 +350,10 @@ const struct mips_opcode mips_builtin_opcodes[] =
{"c.le.d", "M,S,T", 0x4620003e, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, I4|I32 },
{"c.le.s", "S,T", 0x4600003e, 0xffe007ff, RD_S|RD_T|WR_CC|FP_S, I1 },
{"c.le.s", "M,S,T", 0x4600003e, 0xffe000ff, RD_S|RD_T|WR_CC|FP_S, I4|I32 },
+{"c.le.ob", "Y,Q", 0x78000005, 0xfc2007ff, WR_CC|RD_S|RD_T|FP_D, MX|SB1 },
{"c.le.ps", "S,T", 0x46c0003e, 0xffe007ff, RD_S|RD_T|WR_CC|FP_D, I5 },
{"c.le.ps", "M,S,T", 0x46c0003e, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, I5 },
+{"c.le.qh", "Y,Q", 0x78200005, 0xfc2007ff, WR_CC|RD_S|RD_T|FP_D, MX },
{"c.ngt.d", "S,T", 0x4620003f, 0xffe007ff, RD_S|RD_T|WR_CC|FP_D, I1 },
{"c.ngt.d", "M,S,T", 0x4620003f, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, I4|I32 },
{"c.ngt.s", "S,T", 0x4600003f, 0xffe007ff, RD_S|RD_T|WR_CC|FP_S, I1 },
@@ -492,6 +516,10 @@ const struct mips_opcode mips_builtin_opcodes[] =
{"dremu", "z,s,t", 0x0000001f, 0xfc00ffff, RD_s|RD_t|WR_HILO, I3 },
{"dremu", "d,v,t", 3, (int) M_DREMU_3, INSN_MACRO, I3 },
{"dremu", "d,v,I", 3, (int) M_DREMU_3I, INSN_MACRO, I3 },
+{"drol", "d,v,t", 0, (int) M_DROL, INSN_MACRO, I3 },
+{"drol", "d,v,I", 0, (int) M_DROL_I, INSN_MACRO, I3 },
+{"dror", "d,v,t", 0, (int) M_DROR, INSN_MACRO, I3 },
+{"dror", "d,v,I", 0, (int) M_DROR_I, INSN_MACRO, I3 },
{"dsllv", "d,t,s", 0x00000014, 0xfc0007ff, WR_d|RD_t|RD_s, I3 },
{"dsll32", "d,w,<", 0x0000003c, 0xffe0003f, WR_d|RD_t, I3 },
{"dsll", "d,w,s", 0x00000014, 0xfc0007ff, WR_d|RD_t|RD_s, I3 }, /* dsllv */
@@ -622,6 +650,8 @@ const struct mips_opcode mips_builtin_opcodes[] =
{"maddu", "s,t", 0x70000001, 0xfc00ffff, RD_s|RD_t|WR_HILO|IS_M, G1 },
{"maddu", "d,s,t", 0x70000001, 0xfc0007ff, RD_s|RD_t|WR_HILO|WR_d|IS_M, G1 },
{"madd16", "s,t", 0x00000028, 0xfc00ffff, RD_s|RD_t|MOD_HILO, V1 },
+{"max.ob", "X,Y,Q", 0x78000007, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX|SB1 },
+{"max.qh", "X,Y,Q", 0x78200007, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX },
{"mfpc", "t,P", 0x4000c801, 0xffe0ffc1, LCD|WR_t|RD_C0, M1 },
{"mfps", "t,P", 0x4000c800, 0xffe0ffc1, LCD|WR_t|RD_C0, M1 },
{"mfc0", "t,G", 0x40000000, 0xffe007ff, LCD|WR_t|RD_C0, I1 },
@@ -634,28 +664,39 @@ const struct mips_opcode mips_builtin_opcodes[] =
{"mfc3", "t,G,H", 0x4c000000, 0xffe007f8, LCD|WR_t|RD_C3, I32 },
{"mfhi", "d", 0x00000010, 0xffff07ff, WR_d|RD_HI, I1 },
{"mflo", "d", 0x00000012, 0xffff07ff, WR_d|RD_LO, I1 },
+{"min.ob", "X,Y,Q", 0x78000006, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX|SB1 },
+{"min.qh", "X,Y,Q", 0x78200006, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX },
{"mov.d", "D,S", 0x46200006, 0xffff003f, WR_D|RD_S|FP_D, I1 },
{"mov.s", "D,S", 0x46000006, 0xffff003f, WR_D|RD_S|FP_S, I1 },
{"mov.ps", "D,S", 0x46c00006, 0xffff003f, WR_D|RD_S|FP_D, I5 },
{"movf", "d,s,N", 0x00000001, 0xfc0307ff, WR_d|RD_s|RD_CC|FP_D|FP_S, I4|I32},
{"movf.d", "D,S,N", 0x46200011, 0xffe3003f, WR_D|RD_S|RD_CC|FP_D, I4|I32 },
+{"movf.l", "D,S,N", 0x46a00011, 0xffe3003f, WR_D|RD_S|RD_CC|FP_D, MX|SB1 },
+{"movf.l", "X,Y,N", 0x46a00011, 0xffe3003f, WR_D|RD_S|RD_CC|FP_D, MX|SB1 },
{"movf.s", "D,S,N", 0x46000011, 0xffe3003f, WR_D|RD_S|RD_CC|FP_S, I4|I32 },
{"movf.ps", "D,S,N", 0x46c00011, 0xffe3003f, WR_D|RD_S|RD_CC|FP_D, I5 },
{"movn", "d,v,t", 0x0000000b, 0xfc0007ff, WR_d|RD_s|RD_t, I4|I32 },
{"ffc", "d,v", 0x0000000b, 0xfc1f07ff, WR_d|RD_s, L1 },
{"movn.d", "D,S,t", 0x46200013, 0xffe0003f, WR_D|RD_S|RD_t|FP_D, I4|I32 },
+{"movn.l", "D,S,t", 0x46a00013, 0xffe0003f, WR_D|RD_S|RD_t|FP_D, MX|SB1 },
+{"movn.l", "X,Y,t", 0x46a00013, 0xffe0003f, WR_D|RD_S|RD_t|FP_D, MX|SB1 },
{"movn.s", "D,S,t", 0x46000013, 0xffe0003f, WR_D|RD_S|RD_t|FP_S, I4|I32 },
{"movn.ps", "D,S,t", 0x46c00013, 0xffe0003f, WR_D|RD_S|RD_t|FP_D, I5 },
{"movt", "d,s,N", 0x00010001, 0xfc0307ff, WR_d|RD_s|RD_CC, I4|I32 },
{"movt.d", "D,S,N", 0x46210011, 0xffe3003f, WR_D|RD_S|RD_CC|FP_D, I4|I32 },
+{"movt.l", "D,S,N", 0x46a10011, 0xffe3003f, WR_D|RD_S|RD_CC|FP_D, MX|SB1 },
+{"movt.l", "X,Y,N", 0x46a10011, 0xffe3003f, WR_D|RD_S|RD_CC|FP_D, MX|SB1 },
{"movt.s", "D,S,N", 0x46010011, 0xffe3003f, WR_D|RD_S|RD_CC|FP_S, I4|I32 },
{"movt.ps", "D,S,N", 0x46c10011, 0xffe3003f, WR_D|RD_S|RD_CC|FP_D, I5 },
{"movz", "d,v,t", 0x0000000a, 0xfc0007ff, WR_d|RD_s|RD_t, I4|I32 },
{"ffs", "d,v", 0x0000000a, 0xfc1f07ff, WR_d|RD_s, L1 },
{"movz.d", "D,S,t", 0x46200012, 0xffe0003f, WR_D|RD_S|RD_t|FP_D, I4|I32 },
+{"movz.l", "D,S,t", 0x46a00012, 0xffe0003f, WR_D|RD_S|RD_t|FP_D, MX|SB1 },
+{"movz.l", "X,Y,t", 0x46a00012, 0xffe0003f, WR_D|RD_S|RD_t|FP_D, MX|SB1 },
{"movz.s", "D,S,t", 0x46000012, 0xffe0003f, WR_D|RD_S|RD_t|FP_S, I4|I32 },
{"movz.ps", "D,S,t", 0x46c00012, 0xffe0003f, WR_D|RD_S|RD_t|FP_D, I5 },
/* move is at the top of the table. */
+{"msgn.qh", "X,Y,Q", 0x78200000, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX },
{"msub.d", "D,R,S,T", 0x4c000029, 0xfc00003f, RD_R|RD_S|RD_T|WR_D|FP_D, I4 },
{"msub.s", "D,R,S,T", 0x4c000028, 0xfc00003f, RD_R|RD_S|RD_T|WR_D|FP_S, I4 },
{"msub.ps", "D,R,S,T", 0x4c00002e, 0xfc00003f, RD_R|RD_S|RD_T|WR_D|FP_D, I5 },
@@ -677,15 +718,25 @@ const struct mips_opcode mips_builtin_opcodes[] =
{"mtlo", "s", 0x00000013, 0xfc1fffff, RD_s|WR_LO, I1 },
{"mul.d", "D,V,T", 0x46200002, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, I1 },
{"mul.s", "D,V,T", 0x46000002, 0xffe0003f, WR_D|RD_S|RD_T|FP_S, I1 },
+{"mul.ob", "X,Y,Q", 0x78000030, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX|SB1 },
{"mul.ps", "D,V,T", 0x46c00002, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, I5 },
+{"mul.qh", "X,Y,Q", 0x78200030, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX },
{"mul", "d,v,t", 0x70000002, 0xfc0007ff, WR_d|RD_s|RD_t|WR_HILO, I32|P3 },
{"mul", "d,v,t", 0, (int) M_MUL, INSN_MACRO, I1 },
{"mul", "d,v,I", 0, (int) M_MUL_I, INSN_MACRO, I1 },
+{"mula.ob", "Y,Q", 0x78000033, 0xfc2007ff, WR_MACC|RD_S|RD_T|FP_D, MX|SB1 },
+{"mula.qh", "Y,Q", 0x78200033, 0xfc2007ff, WR_MACC|RD_S|RD_T|FP_D, MX },
+{"mull.ob", "Y,Q", 0x78000433, 0xfc2007ff, WR_MACC|RD_S|RD_T|FP_D, MX|SB1 },
+{"mull.qh", "Y,Q", 0x78200433, 0xfc2007ff, WR_MACC|RD_S|RD_T|FP_D, MX },
{"mulo", "d,v,t", 0, (int) M_MULO, INSN_MACRO, I1 },
{"mulo", "d,v,I", 0, (int) M_MULO_I, INSN_MACRO, I1 },
{"mulou", "d,v,t", 0, (int) M_MULOU, INSN_MACRO, I1 },
{"mulou", "d,v,I", 0, (int) M_MULOU_I, INSN_MACRO, I1 },
{"mulr.ps", "D,S,T", 0x46c0001a, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, M3D },
+{"muls.ob", "Y,Q", 0x78000032, 0xfc2007ff, WR_MACC|RD_S|RD_T|FP_D, MX|SB1 },
+{"muls.qh", "Y,Q", 0x78200032, 0xfc2007ff, WR_MACC|RD_S|RD_T|FP_D, MX },
+{"mulsl.ob", "Y,Q", 0x78000432, 0xfc2007ff, WR_MACC|RD_S|RD_T|FP_D, MX|SB1 },
+{"mulsl.qh", "Y,Q", 0x78200432, 0xfc2007ff, WR_MACC|RD_S|RD_T|FP_D, MX },
{"mult", "s,t", 0x00000018, 0xfc00ffff, RD_s|RD_t|WR_HILO|IS_M, I1 },
{"mult", "d,s,t", 0x00000018, 0xfc0007ff, RD_s|RD_t|WR_HILO|WR_d|IS_M, G1 },
{"multu", "s,t", 0x00000019, 0xfc00ffff, RD_s|RD_t|WR_HILO|IS_M, I1 },
@@ -704,19 +755,32 @@ const struct mips_opcode mips_builtin_opcodes[] =
/* nop is at the start of the table. */
{"nor", "d,v,t", 0x00000027, 0xfc0007ff, WR_d|RD_s|RD_t, I1 },
{"nor", "t,r,I", 0, (int) M_NOR_I, INSN_MACRO, I1 },
+{"nor.ob", "X,Y,Q", 0x7800000f, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX|SB1 },
+{"nor.qh", "X,Y,Q", 0x7820000f, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX },
{"not", "d,v", 0x00000027, 0xfc1f07ff, WR_d|RD_s|RD_t, I1 },/*nor d,s,0*/
{"or", "d,v,t", 0x00000025, 0xfc0007ff, WR_d|RD_s|RD_t, I1 },
{"or", "t,r,I", 0, (int) M_OR_I, INSN_MACRO, I1 },
+{"or.ob", "X,Y,Q", 0x7800000e, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX|SB1 },
+{"or.qh", "X,Y,Q", 0x7820000e, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX },
{"ori", "t,r,i", 0x34000000, 0xfc000000, WR_t|RD_s, I1 },
-
+{"pabsdiff.ob", "X,Y,Q",0x78000009, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, SB1 },
+{"pabsdiffc.ob", "Y,Q", 0x78000035, 0xfc2007ff, WR_MACC|RD_S|RD_T|FP_D, SB1 },
+{"pavg.ob", "X,Y,Q", 0x78000008, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, SB1 },
+{"pickf.ob", "X,Y,Q", 0x78000002, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX|SB1 },
+{"pickf.qh", "X,Y,Q", 0x78200002, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX },
+{"pickt.ob", "X,Y,Q", 0x78000003, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX|SB1 },
+{"pickt.qh", "X,Y,Q", 0x78200003, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX },
{"pll.ps", "D,V,T", 0x46c0002c, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, I5 },
{"plu.ps", "D,V,T", 0x46c0002d, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, I5 },
-
/* pref and prefx are at the start of the table. */
-
{"pul.ps", "D,V,T", 0x46c0002e, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, I5 },
{"puu.ps", "D,V,T", 0x46c0002f, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, I5 },
-
+{"rach.ob", "X", 0x7a00003f, 0xfffff83f, WR_D|RD_MACC|FP_D, MX|SB1 },
+{"rach.qh", "X", 0x7a20003f, 0xfffff83f, WR_D|RD_MACC|FP_D, MX },
+{"racl.ob", "X", 0x7800003f, 0xfffff83f, WR_D|RD_MACC|FP_D, MX|SB1 },
+{"racl.qh", "X", 0x7820003f, 0xfffff83f, WR_D|RD_MACC|FP_D, MX },
+{"racm.ob", "X", 0x7900003f, 0xfffff83f, WR_D|RD_MACC|FP_D, MX|SB1 },
+{"racm.qh", "X", 0x7920003f, 0xfffff83f, WR_D|RD_MACC|FP_D, MX },
{"recip.d", "D,S", 0x46200015, 0xffff003f, WR_D|RD_S|FP_D, I4 },
{"recip.ps","D,S", 0x46c00015, 0xffff003f, WR_D|RD_S|FP_D, SB1 },
{"recip.s", "D,S", 0x46000015, 0xffff003f, WR_D|RD_S|FP_S, I4 },
@@ -733,6 +797,12 @@ const struct mips_opcode mips_builtin_opcodes[] =
{"remu", "d,v,t", 0, (int) M_REMU_3, INSN_MACRO, I1 },
{"remu", "d,v,I", 0, (int) M_REMU_3I, INSN_MACRO, I1 },
{"rfe", "", 0x42000010, 0xffffffff, 0, I1|T3 },
+{"rnas.qh", "X,Q", 0x78200025, 0xfc20f83f, WR_D|RD_MACC|RD_T|FP_D, MX },
+{"rnau.ob", "X,Q", 0x78000021, 0xfc20f83f, WR_D|RD_MACC|RD_T|FP_D, MX|SB1 },
+{"rnau.qh", "X,Q", 0x78200021, 0xfc20f83f, WR_D|RD_MACC|RD_T|FP_D, MX },
+{"rnes.qh", "X,Q", 0x78200026, 0xfc20f83f, WR_D|RD_MACC|RD_T|FP_D, MX },
+{"rneu.ob", "X,Q", 0x78000022, 0xfc20f83f, WR_D|RD_MACC|RD_T|FP_D, MX|SB1 },
+{"rneu.qh", "X,Q", 0x78200022, 0xfc20f83f, WR_D|RD_MACC|RD_T|FP_D, MX },
{"rol", "d,v,t", 0, (int) M_ROL, INSN_MACRO, I1 },
{"rol", "d,v,I", 0, (int) M_ROL_I, INSN_MACRO, I1 },
{"ror", "d,v,t", 0, (int) M_ROR, INSN_MACRO, I1 },
@@ -750,6 +820,9 @@ const struct mips_opcode mips_builtin_opcodes[] =
{"rsqrt2.d", "D,S,T", 0x4620001f, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, M3D },
{"rsqrt2.ps", "D,S,T", 0x46c0001f, 0xffe0003f, WR_D|RD_S|RD_T|FP_S, M3D },
{"rsqrt2.s", "D,S,T", 0x4600001f, 0xffe0003f, WR_D|RD_S|RD_T|FP_S, M3D },
+{"rzs.qh", "X,Q", 0x78200024, 0xfc20f83f, WR_D|RD_MACC|RD_T|FP_D, MX },
+{"rzu.ob", "X,Q", 0x78000020, 0xfc20f83f, WR_D|RD_MACC|RD_T|FP_D, MX|SB1 },
+{"rzu.qh", "X,Q", 0x78200020, 0xfc20f83f, WR_D|RD_MACC|RD_T|FP_D, MX },
{"sb", "t,o(b)", 0xa0000000, 0xfc000000, SM|RD_t|RD_b, I1 },
{"sb", "t,A(b)", 0, (int) M_SB_AB, INSN_MACRO, I1 },
{"sc", "t,o(b)", 0xe0000000, 0xfc000000, SM|RD_t|WR_t|RD_b, I2 },
@@ -794,6 +867,16 @@ const struct mips_opcode mips_builtin_opcodes[] =
{"sgtu", "d,v,I", 0, (int) M_SGTU_I, INSN_MACRO, I1 },
{"sh", "t,o(b)", 0xa4000000, 0xfc000000, SM|RD_t|RD_b, I1 },
{"sh", "t,A(b)", 0, (int) M_SH_AB, INSN_MACRO, I1 },
+{"shfl.bfla.qh", "X,Y,Z", 0x7a20001f, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, MX },
+{"shfl.mixh.ob", "X,Y,Z", 0x7980001f, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, MX|SB1 },
+{"shfl.mixh.qh", "X,Y,Z", 0x7820001f, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, MX },
+{"shfl.mixl.ob", "X,Y,Z", 0x79c0001f, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, MX|SB1 },
+{"shfl.mixl.qh", "X,Y,Z", 0x78a0001f, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, MX },
+{"shfl.pach.ob", "X,Y,Z", 0x7900001f, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, MX|SB1 },
+{"shfl.pach.qh", "X,Y,Z", 0x7920001f, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, MX },
+{"shfl.repa.qh", "X,Y,Z", 0x7b20001f, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, MX },
+{"shfl.repb.qh", "X,Y,Z", 0x7ba0001f, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, MX },
+{"shfl.upsl.ob", "X,Y,Z", 0x78c0001f, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, MX|SB1 },
{"sle", "d,v,t", 0, (int) M_SLE, INSN_MACRO, I1 },
{"sle", "d,v,I", 0, (int) M_SLE_I, INSN_MACRO, I1 },
{"sleu", "d,v,t", 0, (int) M_SLEU, INSN_MACRO, I1 },
@@ -801,6 +884,8 @@ const struct mips_opcode mips_builtin_opcodes[] =
{"sllv", "d,t,s", 0x00000004, 0xfc0007ff, WR_d|RD_t|RD_s, I1 },
{"sll", "d,w,s", 0x00000004, 0xfc0007ff, WR_d|RD_t|RD_s, I1 }, /* sllv */
{"sll", "d,w,<", 0x00000000, 0xffe0003f, WR_d|RD_t, I1 },
+{"sll.ob", "X,Y,Q", 0x78000010, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX|SB1 },
+{"sll.qh", "X,Y,Q", 0x78200010, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX },
{"slt", "d,v,t", 0x0000002a, 0xfc0007ff, WR_d|RD_s|RD_t, I1 },
{"slt", "d,v,I", 0, (int) M_SLT_I, INSN_MACRO, I1 },
{"slti", "t,r,j", 0x28000000, 0xfc000000, WR_t|RD_s, I1 },
@@ -815,16 +900,25 @@ const struct mips_opcode mips_builtin_opcodes[] =
{"srav", "d,t,s", 0x00000007, 0xfc0007ff, WR_d|RD_t|RD_s, I1 },
{"sra", "d,w,s", 0x00000007, 0xfc0007ff, WR_d|RD_t|RD_s, I1 }, /* srav */
{"sra", "d,w,<", 0x00000003, 0xffe0003f, WR_d|RD_t, I1 },
+{"sra.qh", "X,Y,Q", 0x78200013, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX },
{"srlv", "d,t,s", 0x00000006, 0xfc0007ff, WR_d|RD_t|RD_s, I1 },
{"srl", "d,w,s", 0x00000006, 0xfc0007ff, WR_d|RD_t|RD_s, I1 }, /* srlv */
{"srl", "d,w,<", 0x00000002, 0xffe0003f, WR_d|RD_t, I1 },
+{"srl.ob", "X,Y,Q", 0x78000012, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX|SB1 },
+{"srl.qh", "X,Y,Q", 0x78200012, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX },
/* ssnop is at the start of the table. */
{"standby", "", 0x42000021, 0xffffffff, 0, V1 },
{"sub", "d,v,t", 0x00000022, 0xfc0007ff, WR_d|RD_s|RD_t, I1 },
{"sub", "d,v,I", 0, (int) M_SUB_I, INSN_MACRO, I1 },
{"sub.d", "D,V,T", 0x46200001, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, I1 },
{"sub.s", "D,V,T", 0x46000001, 0xffe0003f, WR_D|RD_S|RD_T|FP_S, I1 },
+{"sub.ob", "X,Y,Q", 0x7800000a, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX|SB1 },
{"sub.ps", "D,V,T", 0x46c00001, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, I5 },
+{"sub.qh", "X,Y,Q", 0x7820000a, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX },
+{"suba.ob", "Y,Q", 0x78000036, 0xfc2007ff, WR_MACC|RD_S|RD_T|FP_D, MX|SB1 },
+{"suba.qh", "Y,Q", 0x78200036, 0xfc2007ff, WR_MACC|RD_S|RD_T|FP_D, MX },
+{"subl.ob", "Y,Q", 0x78000436, 0xfc2007ff, WR_MACC|RD_S|RD_T|FP_D, MX|SB1 },
+{"subl.qh", "Y,Q", 0x78200436, 0xfc2007ff, WR_MACC|RD_S|RD_T|FP_D, MX },
{"subu", "d,v,t", 0x00000023, 0xfc0007ff, WR_d|RD_s|RD_t, I1 },
{"subu", "d,v,I", 0, (int) M_SUBU_I, INSN_MACRO, I1 },
{"suspend", "", 0x42000022, 0xffffffff, 0, V1 },
@@ -913,13 +1007,20 @@ const struct mips_opcode mips_builtin_opcodes[] =
{"ush", "t,A(b)", 0, (int) M_USH_A, INSN_MACRO, I1 },
{"usw", "t,o(b)", 0, (int) M_USW, INSN_MACRO, I1 },
{"usw", "t,A(b)", 0, (int) M_USW_A, INSN_MACRO, I1 },
-{"xor", "d,v,t", 0x00000026, 0xfc0007ff, WR_d|RD_s|RD_t, I1 },
-{"xor", "t,r,I", 0, (int) M_XOR_I, INSN_MACRO, I1 },
-{"xori", "t,r,i", 0x38000000, 0xfc000000, WR_t|RD_s, I1 },
+{"wach.ob", "Y", 0x7a00003e, 0xffff07ff, WR_MACC|RD_S|FP_D, MX|SB1 },
+{"wach.qh", "Y", 0x7a20003e, 0xffff07ff, WR_MACC|RD_S|FP_D, MX },
+{"wacl.ob", "Y,Z", 0x7800003e, 0xffe007ff, WR_MACC|RD_S|RD_T|FP_D, MX|SB1 },
+{"wacl.qh", "Y,Z", 0x7820003e, 0xffe007ff, WR_MACC|RD_S|RD_T|FP_D, MX },
{"wait", "", 0x42000020, 0xffffffff, TRAP, I3|I32 },
{"wait", "J", 0x42000020, 0xfe00003f, TRAP, I32 },
{"waiti", "", 0x42000020, 0xffffffff, TRAP, L1 },
{"wb", "o(b)", 0xbc040000, 0xfc1f0000, SM|RD_b, L1 },
+{"xor", "d,v,t", 0x00000026, 0xfc0007ff, WR_d|RD_s|RD_t, I1 },
+{"xor", "t,r,I", 0, (int) M_XOR_I, INSN_MACRO, I1 },
+{"xor.ob", "X,Y,Q", 0x7800000d, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX|SB1 },
+{"xor.qh", "X,Y,Q", 0x7820000d, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX },
+{"xori", "t,r,i", 0x38000000, 0xfc000000, WR_t|RD_s, I1 },
+
/* No hazard protection on coprocessor instructions--they shouldn't
change the state of the processor and if they do it's up to the
user to put in nops as necessary. These are at the end so that the
diff --git a/opcodes/openrisc-asm.c b/opcodes/openrisc-asm.c
index 96a6c4d2b7b..d47659b8c8f 100644
--- a/opcodes/openrisc-asm.c
+++ b/opcodes/openrisc-asm.c
@@ -492,7 +492,7 @@ parse_insn_normal (cd, insn, strp, fields)
}
/* We have an operand of some sort. */
- errmsg = openrisc_cgen_parse_operand (cd, CGEN_SYNTAX_FIELD (*syn),
+ errmsg = cd->parse_operand (cd, CGEN_SYNTAX_FIELD (*syn),
&str, fields);
if (errmsg)
return errmsg;
diff --git a/opcodes/openrisc-desc.c b/opcodes/openrisc-desc.c
index e5eded9e73c..f66514c002b 100644
--- a/opcodes/openrisc-desc.c
+++ b/opcodes/openrisc-desc.c
@@ -1017,10 +1017,43 @@ void
openrisc_cgen_cpu_close (cd)
CGEN_CPU_DESC cd;
{
+ unsigned int i;
+ CGEN_INSN *insns;
+
+ if (cd->macro_insn_table.init_entries)
+ {
+ insns = cd->macro_insn_table.init_entries;
+ for (i = 0; i < cd->macro_insn_table.num_init_entries; ++i, ++insns)
+ {
+ if (CGEN_INSN_RX ((insns)))
+ regfree(CGEN_INSN_RX (insns));
+ }
+ }
+
+ if (cd->insn_table.init_entries)
+ {
+ insns = cd->insn_table.init_entries;
+ for (i = 0; i < cd->insn_table.num_init_entries; ++i, ++insns)
+ {
+ if (CGEN_INSN_RX (insns))
+ regfree(CGEN_INSN_RX (insns));
+ }
+ }
+
+
+
+ if (cd->macro_insn_table.init_entries)
+ free ((CGEN_INSN *) cd->macro_insn_table.init_entries);
+
if (cd->insn_table.init_entries)
free ((CGEN_INSN *) cd->insn_table.init_entries);
+
if (cd->hw_table.entries)
free ((CGEN_HW_ENTRY *) cd->hw_table.entries);
+
+ if (cd->operand_table.entries)
+ free ((CGEN_HW_ENTRY *) cd->operand_table.entries);
+
free (cd);
}
diff --git a/opcodes/openrisc-dis.c b/opcodes/openrisc-dis.c
index 628a86c8304..e6a7d6a9d85 100644
--- a/opcodes/openrisc-dis.c
+++ b/opcodes/openrisc-dis.c
@@ -450,11 +450,21 @@ default_print_insn (cd, pc, info)
Print one instruction from PC on INFO->STREAM.
Return the size of the instruction (in bytes). */
+typedef struct cpu_desc_list {
+ struct cpu_desc_list *next;
+ int isa;
+ int mach;
+ int endian;
+ CGEN_CPU_DESC cd;
+} cpu_desc_list;
+
int
print_insn_openrisc (pc, info)
bfd_vma pc;
disassemble_info *info;
{
+ static cpu_desc_list *cd_list = 0;
+ cpu_desc_list *cl = 0;
static CGEN_CPU_DESC cd = 0;
static int prev_isa;
static int prev_mach;
@@ -485,18 +495,27 @@ print_insn_openrisc (pc, info)
#ifdef CGEN_COMPUTE_ISA
isa = CGEN_COMPUTE_ISA (info);
#else
- isa = 0;
+ isa = info->insn_sets;
#endif
- /* If we've switched cpu's, close the current table and open a new one. */
+ /* If we've switched cpu's, try to find a handle we've used before */
if (cd
&& (isa != prev_isa
|| mach != prev_mach
|| endian != prev_endian))
{
- openrisc_cgen_cpu_close (cd);
cd = 0;
- }
+ for (cl = cd_list; cl; cl = cl->next)
+ {
+ if (cl->isa == isa &&
+ cl->mach == mach &&
+ cl->endian == endian)
+ {
+ cd = cl->cd;
+ break;
+ }
+ }
+ }
/* If we haven't initialized yet, initialize the opcode table. */
if (! cd)
@@ -517,6 +536,16 @@ print_insn_openrisc (pc, info)
CGEN_CPU_OPEN_END);
if (!cd)
abort ();
+
+ /* save this away for future reference */
+ cl = xmalloc (sizeof (struct cpu_desc_list));
+ cl->cd = cd;
+ cl->isa = isa;
+ cl->mach = mach;
+ cl->endian = endian;
+ cl->next = cd_list;
+ cd_list = cl;
+
openrisc_cgen_init_dis (cd);
}
diff --git a/opcodes/or32-dis.c b/opcodes/or32-dis.c
index 8876a303666..d5f467944d2 100644
--- a/opcodes/or32-dis.c
+++ b/opcodes/or32-dis.c
@@ -261,7 +261,7 @@ print_insn (memaddr, info)
/* The four bytes of the instruction. */
unsigned long insn;
find_byte_func_type find_byte_func = (find_byte_func_type)info->private_data;
- struct or32_opcode CONST * opcode;
+ struct or32_opcode const * opcode;
{
int status =
diff --git a/opcodes/po/POTFILES.in b/opcodes/po/POTFILES.in
index 0cb531b31b2..f247acb58e4 100644
--- a/opcodes/po/POTFILES.in
+++ b/opcodes/po/POTFILES.in
@@ -18,6 +18,7 @@ d30v-dis.c
d30v-opc.c
dis-buf.c
disassemble.c
+dlx-dis.c
fr30-asm.c
fr30-desc.c
fr30-desc.h
diff --git a/opcodes/sh-dis.c b/opcodes/sh-dis.c
index 92d7139d224..24d4b41eaff 100644
--- a/opcodes/sh-dis.c
+++ b/opcodes/sh-dis.c
@@ -24,14 +24,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "sh-opc.h"
#include "dis-asm.h"
-#define LITTLE_BIT 2
-
static void print_movxy
PARAMS ((sh_opcode_info *, int, int, fprintf_ftype, void *));
static void print_insn_ddt PARAMS ((int, struct disassemble_info *));
static void print_dsp_reg PARAMS ((int, fprintf_ftype, void *));
static void print_insn_ppi PARAMS ((int, struct disassemble_info *));
-static int print_insn_shx PARAMS ((bfd_vma, struct disassemble_info *));
static void
print_movxy (op, rn, rm, fprintf_fn, stream)
@@ -286,8 +283,8 @@ print_insn_ppi (field_b, info)
fprintf_fn (stream, ".word 0x%x", field_b);
}
-static int
-print_insn_shx (memaddr, info)
+int
+print_insn_sh (memaddr, info)
bfd_vma memaddr;
struct disassemble_info *info;
{
@@ -304,6 +301,12 @@ print_insn_shx (memaddr, info)
{
case bfd_mach_sh:
target_arch = arch_sh1;
+ /* SH coff object files lack information about the machine type, so
+ we end up with bfd_mach_sh unless it was set explicitly (which
+ could have happended if this is a call from gdb or the simulator.) */
+ if (info->symbols
+ && bfd_asymbol_flavour(*info->symbols) == bfd_target_coff_flavour)
+ target_arch = arch_sh4;
break;
case bfd_mach_sh2:
target_arch = arch_sh2;
@@ -324,6 +327,11 @@ print_insn_shx (memaddr, info)
target_arch = arch_sh4;
break;
case bfd_mach_sh5:
+#ifdef INCLUDE_SHMEDIA
+ status = print_insn_sh64 (memaddr, info);
+ if (status != -2)
+ return status;
+#endif
/* When we get here for sh64, it's because we want to disassemble
SHcompact, i.e. arch_sh4. */
target_arch = arch_sh4;
@@ -340,7 +348,7 @@ print_insn_shx (memaddr, info)
return -1;
}
- if (info->flags & LITTLE_BIT)
+ if (info->endian == BFD_ENDIAN_LITTLE)
{
nibs[0] = (insn[1] >> 4) & 0xf;
nibs[1] = insn[1] & 0xf;
@@ -371,7 +379,7 @@ print_insn_shx (memaddr, info)
return -1;
}
- if (info->flags & LITTLE_BIT)
+ if (info->endian == BFD_ENDIAN_LITTLE)
field_b = insn[1] << 8 | insn[0];
else
field_b = insn[0] << 8 | insn[1];
@@ -677,7 +685,7 @@ print_insn_shx (memaddr, info)
{
info->flags |= 1;
fprintf_fn (stream, "\t(slot ");
- print_insn_shx (memaddr + 2, info);
+ print_insn_sh (memaddr + 2, info);
info->flags &= ~1;
fprintf_fn (stream, ")");
return 4;
@@ -700,14 +708,14 @@ print_insn_shx (memaddr, info)
if (size == 2)
{
- if ((info->flags & LITTLE_BIT) != 0)
+ if (info->endian == BFD_ENDIAN_LITTLE)
val = bfd_getl16 (bytes);
else
val = bfd_getb16 (bytes);
}
else
{
- if ((info->flags & LITTLE_BIT) != 0)
+ if (info->endian == BFD_ENDIAN_LITTLE)
val = bfd_getl32 (bytes);
else
val = bfd_getb32 (bytes);
@@ -724,27 +732,3 @@ print_insn_shx (memaddr, info)
fprintf_fn (stream, ".word 0x%x%x%x%x", nibs[0], nibs[1], nibs[2], nibs[3]);
return 2;
}
-
-int
-print_insn_shl (memaddr, info)
- bfd_vma memaddr;
- struct disassemble_info *info;
-{
- int r;
-
- info->flags = LITTLE_BIT;
- r = print_insn_shx (memaddr, info);
- return r;
-}
-
-int
-print_insn_sh (memaddr, info)
- bfd_vma memaddr;
- struct disassemble_info *info;
-{
- int r;
-
- info->flags = 0;
- r = print_insn_shx (memaddr, info);
- return r;
-}
diff --git a/opcodes/sh64-dis.c b/opcodes/sh64-dis.c
index 2c760673bd2..10c0f3102e8 100644
--- a/opcodes/sh64-dis.c
+++ b/opcodes/sh64-dis.c
@@ -55,10 +55,6 @@ static unsigned long *shmedia_opcode_mask_table;
static void initialize_shmedia_opcode_mask_table PARAMS ((void));
static int print_insn_shmedia PARAMS ((bfd_vma, disassemble_info *));
-static int print_insn_sh64x
- PARAMS ((bfd_vma, disassemble_info *,
- int (*) PARAMS ((bfd_vma, struct disassemble_info *)),
- enum bfd_endian));
static const char *creg_name PARAMS ((int));
static boolean init_sh64_disasm_info PARAMS ((struct disassemble_info *));
static enum sh64_elf_cr_type sh64_get_contents_type_disasm
@@ -555,15 +551,15 @@ print_insn_sh64x_media (memaddr, info)
return print_insn_shmedia (memaddr, info);
}
-/* Main entry to disassemble SHcompact or SHmedia insns. */
+/* Main entry to disassemble SHmedia insns.
+ If we see an SHcompact instruction, return -2. */
-static int
-print_insn_sh64x (memaddr, info, pfun_compact, endian)
+int
+print_insn_sh64 (memaddr, info)
bfd_vma memaddr;
struct disassemble_info *info;
- int (*pfun_compact) PARAMS ((bfd_vma, struct disassemble_info *));
- enum bfd_endian endian;
{
+ enum bfd_endian endian = info->endian;
enum sh64_elf_cr_type cr_type;
if (info->private_data == NULL && ! init_sh64_disasm_info (info))
@@ -575,6 +571,10 @@ print_insn_sh64x (memaddr, info, pfun_compact, endian)
int length = 4 - (memaddr % 4);
info->display_endian = endian;
+ /* If we got an uneven address to indicate SHmedia, adjust it. */
+ if (cr_type == CRT_SH5_ISA32 && length == 3)
+ memaddr--, length = 4;
+
/* Only disassemble on four-byte boundaries. Addresses that are not
a multiple of four can happen after a data region. */
if (cr_type == CRT_SH5_ISA32 && length == 4)
@@ -633,27 +633,6 @@ print_insn_sh64x (memaddr, info, pfun_compact, endian)
}
}
- return (*pfun_compact) (memaddr, info);
-}
-
-/* Main entry to disassemble SHcompact or SHmedia insns, big endian. */
-
-int
-print_insn_sh64 (memaddr, info)
- bfd_vma memaddr;
- struct disassemble_info *info;
-{
- return
- print_insn_sh64x (memaddr, info, print_insn_sh, BFD_ENDIAN_BIG);
-}
-
-/* Main entry to disassemble SHcompact or SHmedia insns, little endian. */
-
-int
-print_insn_sh64l (memaddr, info)
- bfd_vma memaddr;
- struct disassemble_info *info;
-{
- return
- print_insn_sh64x (memaddr, info, print_insn_shl, BFD_ENDIAN_LITTLE);
+ /* SH1 .. SH4 instruction, let caller handle it. */
+ return -2;
}
diff --git a/opcodes/sparc-dis.c b/opcodes/sparc-dis.c
index 4c59398d54d..47ebb313744 100644
--- a/opcodes/sparc-dis.c
+++ b/opcodes/sparc-dis.c
@@ -1,6 +1,6 @@
/* Print SPARC instructions.
Copyright 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000 Free Software Foundation, Inc.
+ 2000, 2002 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
@@ -188,7 +188,7 @@ is_delayed_branch (insn)
for (op = opcode_hash_table[HASH_INSN (insn)]; op; op = op->next)
{
- CONST struct sparc_opcode *opcode = op->opcode;
+ const struct sparc_opcode *opcode = op->opcode;
if ((opcode->match & insn) == opcode->match
&& (opcode->lose & insn) == 0)
return (opcode->flags & F_DELAYED);
@@ -272,7 +272,7 @@ print_insn_sparc (memaddr, info)
for (op = opcode_hash_table[HASH_INSN (insn)]; op; op = op->next)
{
- CONST struct sparc_opcode *opcode = op->opcode;
+ const struct sparc_opcode *opcode = op->opcode;
/* If the insn isn't supported by the current architecture, skip it. */
if (! (opcode->architecture & current_arch_mask))
@@ -312,7 +312,7 @@ print_insn_sparc (memaddr, info)
(*info->fprintf_func) (stream, opcode->name);
{
- register CONST char *s;
+ register const char *s;
if (opcode->args[0] != ',')
(*info->fprintf_func) (stream, " ");
diff --git a/opcodes/xstormy16-asm.c b/opcodes/xstormy16-asm.c
index 3f26b18562c..047339dadd8 100644
--- a/opcodes/xstormy16-asm.c
+++ b/opcodes/xstormy16-asm.c
@@ -479,7 +479,7 @@ parse_insn_normal (cd, insn, strp, fields)
}
/* We have an operand of some sort. */
- errmsg = xstormy16_cgen_parse_operand (cd, CGEN_SYNTAX_FIELD (*syn),
+ errmsg = cd->parse_operand (cd, CGEN_SYNTAX_FIELD (*syn),
&str, fields);
if (errmsg)
return errmsg;
diff --git a/opcodes/xstormy16-desc.c b/opcodes/xstormy16-desc.c
index 41da91ba9c7..0c506252e45 100644
--- a/opcodes/xstormy16-desc.c
+++ b/opcodes/xstormy16-desc.c
@@ -1458,10 +1458,43 @@ void
xstormy16_cgen_cpu_close (cd)
CGEN_CPU_DESC cd;
{
+ unsigned int i;
+ CGEN_INSN *insns;
+
+ if (cd->macro_insn_table.init_entries)
+ {
+ insns = cd->macro_insn_table.init_entries;
+ for (i = 0; i < cd->macro_insn_table.num_init_entries; ++i, ++insns)
+ {
+ if (CGEN_INSN_RX ((insns)))
+ regfree(CGEN_INSN_RX (insns));
+ }
+ }
+
+ if (cd->insn_table.init_entries)
+ {
+ insns = cd->insn_table.init_entries;
+ for (i = 0; i < cd->insn_table.num_init_entries; ++i, ++insns)
+ {
+ if (CGEN_INSN_RX (insns))
+ regfree(CGEN_INSN_RX (insns));
+ }
+ }
+
+
+
+ if (cd->macro_insn_table.init_entries)
+ free ((CGEN_INSN *) cd->macro_insn_table.init_entries);
+
if (cd->insn_table.init_entries)
free ((CGEN_INSN *) cd->insn_table.init_entries);
+
if (cd->hw_table.entries)
free ((CGEN_HW_ENTRY *) cd->hw_table.entries);
+
+ if (cd->operand_table.entries)
+ free ((CGEN_HW_ENTRY *) cd->operand_table.entries);
+
free (cd);
}
diff --git a/opcodes/xstormy16-dis.c b/opcodes/xstormy16-dis.c
index bd6c593f494..f3cc8e6327a 100644
--- a/opcodes/xstormy16-dis.c
+++ b/opcodes/xstormy16-dis.c
@@ -483,11 +483,21 @@ default_print_insn (cd, pc, info)
Print one instruction from PC on INFO->STREAM.
Return the size of the instruction (in bytes). */
+typedef struct cpu_desc_list {
+ struct cpu_desc_list *next;
+ int isa;
+ int mach;
+ int endian;
+ CGEN_CPU_DESC cd;
+} cpu_desc_list;
+
int
print_insn_xstormy16 (pc, info)
bfd_vma pc;
disassemble_info *info;
{
+ static cpu_desc_list *cd_list = 0;
+ cpu_desc_list *cl = 0;
static CGEN_CPU_DESC cd = 0;
static int prev_isa;
static int prev_mach;
@@ -518,18 +528,27 @@ print_insn_xstormy16 (pc, info)
#ifdef CGEN_COMPUTE_ISA
isa = CGEN_COMPUTE_ISA (info);
#else
- isa = 0;
+ isa = info->insn_sets;
#endif
- /* If we've switched cpu's, close the current table and open a new one. */
+ /* If we've switched cpu's, try to find a handle we've used before */
if (cd
&& (isa != prev_isa
|| mach != prev_mach
|| endian != prev_endian))
{
- xstormy16_cgen_cpu_close (cd);
cd = 0;
- }
+ for (cl = cd_list; cl; cl = cl->next)
+ {
+ if (cl->isa == isa &&
+ cl->mach == mach &&
+ cl->endian == endian)
+ {
+ cd = cl->cd;
+ break;
+ }
+ }
+ }
/* If we haven't initialized yet, initialize the opcode table. */
if (! cd)
@@ -550,6 +569,16 @@ print_insn_xstormy16 (pc, info)
CGEN_CPU_OPEN_END);
if (!cd)
abort ();
+
+ /* save this away for future reference */
+ cl = xmalloc (sizeof (struct cpu_desc_list));
+ cl->cd = cd;
+ cl->isa = isa;
+ cl->mach = mach;
+ cl->endian = endian;
+ cl->next = cd_list;
+ cd_list = cl;
+
xstormy16_cgen_init_dis (cd);
}
diff --git a/sim/ChangeLog b/sim/ChangeLog
index 0376c56aea8..2a1bb25790a 100644
--- a/sim/ChangeLog
+++ b/sim/ChangeLog
@@ -1,3 +1,16 @@
+Thu Jun 6 12:34:13 2002 Andrew Cagney <cagney@redhat.com>
+
+ * Makefile.in (ChangeLog): New makefile variable.
+ * README-HACKING: Mention the ChangeLog makefile variable.
+
+2002-06-01 Andrew Cagney <ac131313@redhat.com>
+
+ * tic80/: Delete directory.
+
+2002-05-16 Stephane Carrez <stcarrez@nerim.fr>
+
+ * MAINTAINERS: Update my email address.
+
2002-03-06 Stephane Carrez <Stephane.Carrez@worldnet.fr>
* MAINTAINERS: Record self as maintainer of m68hc11 simulator.
diff --git a/sim/MAINTAINERS b/sim/MAINTAINERS
index ac5073f7697..9615a13bb07 100644
--- a/sim/MAINTAINERS
+++ b/sim/MAINTAINERS
@@ -12,7 +12,7 @@ gdb-patches@sources.redhat.com
arm Nick Clifton <nickc@redhat.com>
ppc Andrew Cagney <ac131313@redhat.com>
ppc Geoff Keating <geoffk@redhat.com>
-m68hc11 Stephane Carrez <Stephane.Carrez@worldnet.fr>
+m68hc11 Stephane Carrez <stcarrez@nerim.fr>
mips Andrew Cagney <ac131313@redhat.com>
mips Chris Demetriou <cgd@broadcom.com>
common Ben Elliston <bje@redhat.com>
diff --git a/sim/Makefile.in b/sim/Makefile.in
index 1e53780fd5d..aebdab3b2ab 100644
--- a/sim/Makefile.in
+++ b/sim/Makefile.in
@@ -73,6 +73,10 @@ CC_FOR_BUILD = $(CC)
# @target_makefile_frag@
###
+# Name of the ChangeLog file.
+ChangeLog = ChangeLog
+
+
RUNTEST = `if [ -f $${srcdir}/../dejagnu/runtest ] ; then \
echo $${srcdir}/../dejagnu/runtest ; else echo runtest; \
fi`
@@ -229,7 +233,7 @@ autoconf-changelog autoheader-changelog:
do \
if [ -d $$d -a -f $$d/configure.in ] ; \
then \
- echo "Creating new-ChangeLog in $$d ..." ; \
+ echo "Creating new-$(ChangeLog) in $$d ..." ; \
( echo "$$date $$name <$$id@$$host>" ; \
echo "" ; \
echo " * configure: Regenerated to track ../common/aclocal.m4 changes." ; \
@@ -238,8 +242,8 @@ autoconf-changelog autoheader-changelog:
echo " * config.in: Ditto." ; \
fi ; \
echo "" ; \
- cat $$d/ChangeLog \
- ) > $$d/new-ChangeLog ; \
+ cat $$d/$(ChangeLog) \
+ ) > $$d/new-$(ChangeLog) ; \
fi ; \
done
@@ -248,7 +252,7 @@ autoconf-install autoheader-install:
do \
if [ -d $$d -a -f $$d/configure.in ] ; \
then \
- echo "Moving $$d/new-ChangeLog to $$d/ChangeLog ..." ; \
- mv $$d/new-ChangeLog $$d/ChangeLog ; \
+ echo "Moving $$d/new-$(ChangeLog) to $$d/$(ChangeLog) ..." ; \
+ mv $$d/new-$(ChangeLog) $$d/$(ChangeLog) ; \
fi ; \
done
diff --git a/sim/README-HACKING b/sim/README-HACKING
index e4efeb155b0..bee504aa1e8 100644
--- a/sim/README-HACKING
+++ b/sim/README-HACKING
@@ -153,6 +153,11 @@ updated using the sequence:
$ make -f Makefile.in SHELL=/bin/sh autoheader-changelog
$ more */new-ChangeLog
$ make -f Makefile.in SHELL=/bin/sh autoheader-install
+
+To add the entries to an alternative ChangeLog file, use:
+
+ $ make ChangeLog=MyChangeLog ....
+
tconfig.in
==========
diff --git a/sim/arm/ChangeLog b/sim/arm/ChangeLog
index e10ef891d14..f9f7160adb2 100644
--- a/sim/arm/ChangeLog
+++ b/sim/arm/ChangeLog
@@ -1,3 +1,86 @@
+2002-06-12 Andrew Cagney <ac131313@redhat.com>
+
+ * Makefile.in: Update copyright.
+ (wrapper.o): Specify dependencies.
+ * wrapper.c: Include "gdb/sim-arm.h".
+ (sim_store_register, sim_fetch_register): Rewrite using `enum
+ arm_sim_regs' and a switch.
+
+2002-06-09 Andrew Cagney <cagney@redhat.com>
+
+ * wrapper.c: Include "gdb/callback.h" and "gdb/remote-sim.h".
+ * armos.c: Include "gdb/callback.h".
+
+2002-05-29 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * armcopro.c (XScale_check_memacc): Set the FSR and FAR registers
+ if a Data Abort is detected.
+
+2002-05-27 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * armvirt.c (GetWord): Only perform access checks if 'check'
+ is set.
+ (PutWord): Likewise.
+ * wrapper.c (sim_create_inferior): Report unknown machine
+ numbers.
+ * thumbemu.c (ARMul_ThumbDecode, Case 31): Do not set LR to pc +
+ 2, it has already been advanced.
+
+2002-05-23 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * thumbemu.c (ARMul_ThumbDecode): When decoding a BLX(1)
+ instruction do not add in the second bit of the base address -
+ this has already been accounted for.
+
+2002-05-21 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * armcopro.c (check_cp13_access): Allow access to register 1 when
+ CRm is 1.
+ (write_cp13_reg): Allow bit 0 of reg 1 of CRm 1 to be written to.
+
+2002-05-20 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * Makefile.in (SWI_TARGET_SWITCHES): Define.
+ * armos.c (swi_mask): Define. Initialise to supporting all
+ SWI emulations.
+ (ARMul_OSInit): For XScale targets, only support the ANGEL
+ SWI interface. (This is at the request if Intel).
+ (ARMul_OSHandleSWI): Examine swi_mask to see if a particular
+ SWI call should be emulated.
+ Do not fall through from AngelSWI_Reason_WriteC.
+ Propagate exit code from RedBoot Exit SWI.
+ * rdi-dgb.h (swi_mask): Prototype.
+ (SWI_MASK_DEMON, SWI_MASK_ANGEL, SWI_MASK_REDBOOT): Define.
+ * wrapper.c: Include run-sim.h.
+ (sim_target_parse_command_line): New function. Look for and
+ handle --swi-support switch.
+ (sim_target_parse_arg_array): New function. Process an argv
+ array for parsing by sim_target_parse_command_line.
+ (sim_target_display_usage): New function. Describe syntax of
+ --swi-suppoort switch.
+ (sim_open): Add call to sim_target_parse_arg_array).
+
+2002-05-17 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * Makefile.in (SWI_TARGET_SWITCHES): Define.
+ * armos.c (swi_mask): Define. Initialise to supporting all
+ SWI emulations.
+ (ARMul_OSInit): For XScale targets, only support the ANGEL
+ SWI interface. (This is at the request if Intel).
+ (ARMul_OSHandleSWI): Examine swi_mask to see if a particular
+ SWI call should be emulated.
+ Do not fall through from AngelSWI_Reason_WriteC.
+ Propagate exit code from RedBoot Exit SWI.
+ * rdi-dgb.h (swi_mask): Prototype.
+ (SWI_MASK_DEMON, SWI_MASK_ANGEL, SWI_MASK_REDBOOT): Define.
+ * wrapper.c (sim_target_parse_command_line): New function.
+ Look for and handle --swi-support switch.
+ (sim_target_parse_arg_array): New function. Process an argv
+ array for parsing by sim_target_parse_command_line.
+ (sim_target_display_usage): New function. Describe syntax of
+ --swi-suppoort switch.
+ (sim_open): Add call to sim_target_parse_arg_array).
+
2002-05-09 Nick Clifton <nickc@cambridge.redhat.com>
* armos.c (ARMul_OSHandleSWI): Support the RedBoot SWI in ARM
diff --git a/sim/arm/Makefile.in b/sim/arm/Makefile.in
index cb7c0d90481..0da765fd703 100644
--- a/sim/arm/Makefile.in
+++ b/sim/arm/Makefile.in
@@ -1,5 +1,5 @@
# Makefile template for Configure for the arm sim library.
-# Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+# Copyright 1995, 1996, 1997, 2002 Free Software Foundation, Inc.
# Written by Cygnus Support.
#
# This program is free software; you can redistribute it and/or modify
@@ -18,7 +18,7 @@
## COMMON_PRE_CONFIG_FRAG
-SIM_EXTRA_CFLAGS = -DMODET -DNEED_UI_LOOP_HOOK
+SIM_EXTRA_CFLAGS = -DMODET -DNEED_UI_LOOP_HOOK -DSIM_TARGET_SWITCHES
COPRO=@COPRO@
@@ -48,3 +48,9 @@ armsupp.o: armsupp.c armdefs.h armemu.h
thumbemu.o: thumbemu.c armdefs.h armemu.h
bag.o: bag.c bag.h
+
+wrapper.o: armdefs.h armemu.h dbg_rdi.h \
+ $(srcdir)/../common/run-sim.h \
+ $(srcdir)/../common/sim-utils.h \
+ $(srcdir)/../../include/gdb/sim-arm.h \
+ $(srcdir)/../../include/gdb/remote-sim.h
diff --git a/sim/arm/armcopro.c b/sim/arm/armcopro.c
index 75c6bfca62b..2c2ca8505a6 100644
--- a/sim/arm/armcopro.c
+++ b/sim/arm/armcopro.c
@@ -85,7 +85,6 @@ XScale_cp15_init (ARMul_State * state ATTRIBUTE_UNUSED)
/* Initialise the ARM Control Register. */
XScale_cp15_opcode_2_is_0_Regs[1] = 0x00000078;
-
}
/* Check an access to a register. */
@@ -253,7 +252,7 @@ write_cp15_reg (ARMul_State * state,
value &= 0x00003b87;
value |= 0x00000078;
- /* Change the endianness if necessary */
+ /* Change the endianness if necessary. */
if ((value & ARMul_CP15_R1_ENDIAN) !=
(XScale_cp15_opcode_2_is_0_Regs [reg] & ARMul_CP15_R1_ENDIAN))
{
@@ -475,12 +474,19 @@ XScale_check_memacc (ARMul_State * state, ARMword * address, int store)
/* Check for PID-ification.
XXX BTB access support will require this test failing. */
r0 = (read_cp15_reg (13, 0, 0) & 0xfe000000);
- if (r0 && (*address & 0xfe000000) == 0)
- *address |= r0;
+ if (r0 && (* address & 0xfe000000) == 0)
+ * address |= r0;
/* Check alignment fault enable/disable. */
- if ((read_cp15_reg (1, 0, 0) & ARMul_CP15_R1_ALIGN) && (*address & 3))
- ARMul_Abort (state, ARMul_DataAbortV);
+ if ((read_cp15_reg (1, 0, 0) & ARMul_CP15_R1_ALIGN) && (* address & 3))
+ {
+ /* Set the FSR and FAR.
+ Do not use XScale_set_fsr_far as this checks the DCSR register. */
+ write_cp15_reg (state, 5, 0, 0, ARMul_CP15_R5_MMU_EXCPT);
+ write_cp15_reg (state, 6, 0, 0, * address);
+
+ ARMul_Abort (state, ARMul_DataAbortV);
+ }
if (XScale_debug_moe (state, -1))
return;
@@ -495,7 +501,7 @@ XScale_check_memacc (ARMul_State * state, ARMword * address, int store)
{
/* r1 is a inverse mask. */
if (e0 != 0 && ((store && e0 != 3) || (!store && e0 != 1))
- && ((*address & ~r1) == (r0 & ~r1)))
+ && ((* address & ~r1) == (r0 & ~r1)))
{
XScale_debug_moe (state, ARMul_CP14_R10_MOE_DB);
ARMul_OSHandleSWI (state, SWI_Breakpoint);
@@ -504,7 +510,7 @@ XScale_check_memacc (ARMul_State * state, ARMword * address, int store)
else
{
if (e0 != 0 && ((store && e0 != 3) || (!store && e0 != 1))
- && ((*address & ~3) == (r0 & ~3)))
+ && ((* address & ~3) == (r0 & ~3)))
{
XScale_debug_moe (state, ARMul_CP14_R10_MOE_DB);
ARMul_OSHandleSWI (state, SWI_Breakpoint);
@@ -512,7 +518,7 @@ XScale_check_memacc (ARMul_State * state, ARMword * address, int store)
e1 = (dbcon & ARMul_CP15_DBCON_E1) >> 2;
if (e1 != 0 && ((store && e1 != 3) || (!store && e1 != 1))
- && ((*address & ~3) == (r1 & ~3)))
+ && ((* address & ~3) == (r1 & ~3)))
{
XScale_debug_moe (state, ARMul_CP14_R10_MOE_DB);
ARMul_OSHandleSWI (state, SWI_Breakpoint);
@@ -520,7 +526,7 @@ XScale_check_memacc (ARMul_State * state, ARMword * address, int store)
}
}
-/* Check set. */
+/* Set the XScale FSR and FAR registers. */
void
XScale_set_fsr_far (ARMul_State * state, ARMword fsr, ARMword far)
@@ -587,7 +593,7 @@ check_cp13_access (ARMul_State * state,
unsigned opcode_1,
unsigned opcode_2)
{
- /* Do not allow access to these register in USER mode. */
+ /* Do not allow access to these registers in USER mode. */
if (state->Mode == USER26MODE || state->Mode == USER32MODE)
return ARMul_CANT;
@@ -601,7 +607,7 @@ check_cp13_access (ARMul_State * state,
return ARMul_CANT;
/* Registers 0, 4 and 8 are defined when CRm == 0.
- Registers 0, 4, 5, 6, 7, 8 are defined when CRm == 1.
+ Registers 0, 1, 4, 5, 6, 7, 8 are defined when CRm == 1.
For all other CRm values undefined behaviour results. */
if (CRm == 0)
{
@@ -610,7 +616,7 @@ check_cp13_access (ARMul_State * state,
}
else if (CRm == 1)
{
- if (reg == 0 || (reg >= 4 && reg <= 8))
+ if (reg == 0 || reg == 1 || (reg >= 4 && reg <= 8))
return ARMul_DONE;
}
@@ -659,6 +665,12 @@ write_cp13_reg (unsigned reg, unsigned CRm, ARMword value)
value |= XScale_cp13_CR1_Regs[0] & (1UL << 31);
break;
+ case 1: /* BCUMOD */
+ /* Only bit 0 is accecssible. */
+ value &= 1;
+ value |= XScale_cp13_CR1_Regs[1] & ~ 1;
+ break;
+
case 4: /* ELOG0 */
case 5: /* ELOG1 */
case 6: /* ECAR0 */
@@ -841,7 +853,7 @@ write_cp14_reg (unsigned reg, ARMword value)
/* Only BITS (27:12), BITS (10:8) and BITS (6:0) can be written. */
value &= 0x0ffff77f;
- /* Reset the clock counter if necessary */
+ /* Reset the clock counter if necessary. */
if (value & ARMul_CP14_R0_CLKRST)
XScale_cp14_Regs [1] = 0;
break;
diff --git a/sim/arm/armemu.c b/sim/arm/armemu.c
index ea2bdfda568..8e719264e7f 100644
--- a/sim/arm/armemu.c
+++ b/sim/arm/armemu.c
@@ -3206,7 +3206,7 @@ check_PMUintr:
ARMul_UndefInstr (state, instr);
else
{
- /* XScale MAR insn. Move two registers into accumulator. */
+ /* XScale MAR insn. Move two registers into accumulator. */
state->Accumulator = state->Reg[BITS (12, 15)];
state->Accumulator += (ARMdword) state->Reg[BITS (16, 19)] << 32;
}
diff --git a/sim/arm/armos.c b/sim/arm/armos.c
index d833665ac2d..ccf9a576e87 100644
--- a/sim/arm/armos.c
+++ b/sim/arm/armos.c
@@ -83,7 +83,7 @@ extern int _fisatty (FILE *);
/* For RDIError_BreakpointReached. */
#include "dbg_rdi.h"
-#include "callback.h"
+#include "gdb/callback.h"
extern host_callback *sim_callback;
extern unsigned ARMul_OSInit (ARMul_State *);
@@ -125,6 +125,10 @@ struct OSblock
#define FIXCRLF(t,c) c
#endif
+/* Bit mask of enabled SWI implementations. */
+unsigned int swi_mask = -1;
+
+
static ARMword softvectorcode[] =
{
/* Basic: swi tidyexception + event; mov pc, lr;
@@ -226,7 +230,11 @@ ARMul_OSInit (ARMul_State * state)
#endif /* VALIDATE */
#endif /* NOOS */
- return TRUE;
+ /* Intel do not want DEMON SWI support. */
+ if (state->is_XScale)
+ swi_mask = SWI_MASK_ANGEL;
+
+ return TRUE;
}
void
@@ -397,110 +405,134 @@ SWIflen (ARMul_State * state, ARMword fh)
unsigned
ARMul_OSHandleSWI (ARMul_State * state, ARMword number)
{
- ARMword addr;
- ARMword temp;
- ARMword saved_number = 0;
struct OSblock * OSptr = (struct OSblock *) state->OSptr;
-
- /* Intel do not want DEMON SWI support. */
- if (state->is_XScale)
- switch (number)
- {
- case SWI_Read:
- case SWI_Write:
- case SWI_Open:
- case SWI_Clock:
- case SWI_Time:
- case SWI_Close:
- case SWI_Flen:
- case SWI_Exit:
- case SWI_Seek:
- case SWI_WriteC:
- case SWI_Write0:
- case SWI_GetErrno:
- case SWI_GetEnv:
- saved_number = number;
- number = -1;
- default:
- break;
- }
-
+ int unhandled = FALSE;
+
switch (number)
{
case SWI_Read:
- SWIread (state, state->Reg[0], state->Reg[1], state->Reg[2]);
+ if (swi_mask & SWI_MASK_DEMON)
+ SWIread (state, state->Reg[0], state->Reg[1], state->Reg[2]);
+ else
+ unhandled = TRUE;
break;
case SWI_Write:
- SWIwrite (state, state->Reg[0], state->Reg[1], state->Reg[2]);
+ if (swi_mask & SWI_MASK_DEMON)
+ SWIwrite (state, state->Reg[0], state->Reg[1], state->Reg[2]);
+ else
+ unhandled = TRUE;
break;
case SWI_Open:
- SWIopen (state, state->Reg[0], state->Reg[1]);
+ if (swi_mask & SWI_MASK_DEMON)
+ SWIopen (state, state->Reg[0], state->Reg[1]);
+ else
+ unhandled = TRUE;
break;
case SWI_Clock:
- /* Return number of centi-seconds. */
- state->Reg[0] =
+ if (swi_mask & SWI_MASK_DEMON)
+ {
+ /* Return number of centi-seconds. */
+ state->Reg[0] =
#ifdef CLOCKS_PER_SEC
- (CLOCKS_PER_SEC >= 100)
- ? (ARMword) (clock () / (CLOCKS_PER_SEC / 100))
- : (ARMword) ((clock () * 100) / CLOCKS_PER_SEC);
+ (CLOCKS_PER_SEC >= 100)
+ ? (ARMword) (clock () / (CLOCKS_PER_SEC / 100))
+ : (ARMword) ((clock () * 100) / CLOCKS_PER_SEC);
#else
- /* Presume unix... clock() returns microseconds. */
- (ARMword) (clock () / 10000);
+ /* Presume unix... clock() returns microseconds. */
+ (ARMword) (clock () / 10000);
#endif
- OSptr->ErrorNo = errno;
+ OSptr->ErrorNo = errno;
+ }
+ else
+ unhandled = TRUE;
break;
case SWI_Time:
- state->Reg[0] = (ARMword) sim_callback->time (sim_callback, NULL);
- OSptr->ErrorNo = sim_callback->get_errno (sim_callback);
+ if (swi_mask & SWI_MASK_DEMON)
+ {
+ state->Reg[0] = (ARMword) sim_callback->time (sim_callback, NULL);
+ OSptr->ErrorNo = sim_callback->get_errno (sim_callback);
+ }
+ else
+ unhandled = TRUE;
break;
case SWI_Close:
- state->Reg[0] = sim_callback->close (sim_callback, state->Reg[0]);
- OSptr->ErrorNo = sim_callback->get_errno (sim_callback);
+ if (swi_mask & SWI_MASK_DEMON)
+ {
+ state->Reg[0] = sim_callback->close (sim_callback, state->Reg[0]);
+ OSptr->ErrorNo = sim_callback->get_errno (sim_callback);
+ }
+ else
+ unhandled = TRUE;
break;
case SWI_Flen:
- SWIflen (state, state->Reg[0]);
+ if (swi_mask & SWI_MASK_DEMON)
+ SWIflen (state, state->Reg[0]);
+ else
+ unhandled = TRUE;
break;
case SWI_Exit:
- state->Emulate = FALSE;
+ if (swi_mask & SWI_MASK_DEMON)
+ state->Emulate = FALSE;
+ else
+ unhandled = TRUE;
break;
case SWI_Seek:
- /* We must return non-zero for failure. */
- state->Reg[0] = -1 >= sim_callback->lseek (sim_callback, state->Reg[0], state->Reg[1], SEEK_SET);
- OSptr->ErrorNo = sim_callback->get_errno (sim_callback);
+ if (swi_mask & SWI_MASK_DEMON)
+ {
+ /* We must return non-zero for failure. */
+ state->Reg[0] = -1 >= sim_callback->lseek (sim_callback, state->Reg[0], state->Reg[1], SEEK_SET);
+ OSptr->ErrorNo = sim_callback->get_errno (sim_callback);
+ }
+ else
+ unhandled = TRUE;
break;
case SWI_WriteC:
- {
- char tmp = state->Reg[0];
- (void) sim_callback->write_stdout (sim_callback, &tmp, 1);
- OSptr->ErrorNo = sim_callback->get_errno (sim_callback);
- }
+ if (swi_mask & SWI_MASK_DEMON)
+ {
+ char tmp = state->Reg[0];
+ (void) sim_callback->write_stdout (sim_callback, &tmp, 1);
+ OSptr->ErrorNo = sim_callback->get_errno (sim_callback);
+ }
+ else
+ unhandled = TRUE;
break;
case SWI_Write0:
- SWIWrite0 (state, state->Reg[0]);
+ if (swi_mask & SWI_MASK_DEMON)
+ SWIWrite0 (state, state->Reg[0]);
+ else
+ unhandled = TRUE;
break;
case SWI_GetErrno:
- state->Reg[0] = OSptr->ErrorNo;
+ if (swi_mask & SWI_MASK_DEMON)
+ state->Reg[0] = OSptr->ErrorNo;
+ else
+ unhandled = TRUE;
break;
case SWI_GetEnv:
- state->Reg[0] = ADDRCMDLINE;
- if (state->MemSize)
- state->Reg[1] = state->MemSize;
- else
- state->Reg[1] = ADDRUSERSTACK;
+ if (swi_mask & SWI_MASK_DEMON)
+ {
+ state->Reg[0] = ADDRCMDLINE;
+ if (state->MemSize)
+ state->Reg[1] = state->MemSize;
+ else
+ state->Reg[1] = ADDRUSERSTACK;
- WriteCommandLineTo (state, state->Reg[0]);
+ WriteCommandLineTo (state, state->Reg[0]);
+ }
+ else
+ unhandled = TRUE;
break;
case SWI_Breakpoint:
@@ -511,132 +543,141 @@ ARMul_OSHandleSWI (ARMul_State * state, ARMword number)
/* Handle Angel SWIs as well as Demon ones. */
case AngelSWI_ARM:
case AngelSWI_Thumb:
- /* R1 is almost always a parameter block. */
- addr = state->Reg[1];
- /* R0 is a reason code. */
- switch (state->Reg[0])
+ if (swi_mask & SWI_MASK_ANGEL)
{
- /* Unimplemented reason codes. */
- case AngelSWI_Reason_ReadC:
- case AngelSWI_Reason_IsTTY:
- case AngelSWI_Reason_TmpNam:
- case AngelSWI_Reason_Remove:
- case AngelSWI_Reason_Rename:
- case AngelSWI_Reason_System:
- case AngelSWI_Reason_EnterSVC:
- default:
- state->Emulate = FALSE;
- return FALSE;
-
- case AngelSWI_Reason_Clock:
- /* Return number of centi-seconds. */
- state->Reg[0] =
+ ARMword addr;
+ ARMword temp;
+
+ /* R1 is almost always a parameter block. */
+ addr = state->Reg[1];
+ /* R0 is a reason code. */
+ switch (state->Reg[0])
+ {
+ /* Unimplemented reason codes. */
+ case AngelSWI_Reason_ReadC:
+ case AngelSWI_Reason_IsTTY:
+ case AngelSWI_Reason_TmpNam:
+ case AngelSWI_Reason_Remove:
+ case AngelSWI_Reason_Rename:
+ case AngelSWI_Reason_System:
+ case AngelSWI_Reason_EnterSVC:
+ default:
+ state->Emulate = FALSE;
+ return FALSE;
+
+ case AngelSWI_Reason_Clock:
+ /* Return number of centi-seconds. */
+ state->Reg[0] =
#ifdef CLOCKS_PER_SEC
- (CLOCKS_PER_SEC >= 100)
- ? (ARMword) (clock () / (CLOCKS_PER_SEC / 100))
- : (ARMword) ((clock () * 100) / CLOCKS_PER_SEC);
+ (CLOCKS_PER_SEC >= 100)
+ ? (ARMword) (clock () / (CLOCKS_PER_SEC / 100))
+ : (ARMword) ((clock () * 100) / CLOCKS_PER_SEC);
#else
- /* Presume unix... clock() returns microseconds. */
- (ARMword) (clock () / 10000);
+ /* Presume unix... clock() returns microseconds. */
+ (ARMword) (clock () / 10000);
#endif
- OSptr->ErrorNo = errno;
- break;
-
- case AngelSWI_Reason_Time:
- state->Reg[0] = (ARMword) sim_callback->time (sim_callback, NULL);
- OSptr->ErrorNo = sim_callback->get_errno (sim_callback);
- break;
-
- case AngelSWI_Reason_WriteC:
- {
- char tmp = ARMul_SafeReadByte (state, addr);
- (void) sim_callback->write_stdout (sim_callback, &tmp, 1);
- OSptr->ErrorNo = sim_callback->get_errno (sim_callback);
- }
- /* Fall thgrough. */
-
- case AngelSWI_Reason_Write0:
- SWIWrite0 (state, addr);
- break;
-
- case AngelSWI_Reason_Close:
- state->Reg[0] = sim_callback->close (sim_callback, ARMul_ReadWord (state, addr));
- OSptr->ErrorNo = sim_callback->get_errno (sim_callback);
- break;
-
- case AngelSWI_Reason_Seek:
- state->Reg[0] = -1 >= sim_callback->lseek (sim_callback, ARMul_ReadWord (state, addr),
- ARMul_ReadWord (state, addr + 4),
- SEEK_SET);
- OSptr->ErrorNo = sim_callback->get_errno (sim_callback);
- break;
-
- case AngelSWI_Reason_FLen:
- SWIflen (state, ARMul_ReadWord (state, addr));
- break;
-
- case AngelSWI_Reason_GetCmdLine:
- WriteCommandLineTo (state, ARMul_ReadWord (state, addr));
- break;
-
- case AngelSWI_Reason_HeapInfo:
- /* R1 is a pointer to a pointer. */
- addr = ARMul_ReadWord (state, addr);
-
- /* Pick up the right memory limit. */
- if (state->MemSize)
- temp = state->MemSize;
- else
- temp = ADDRUSERSTACK;
-
- ARMul_WriteWord (state, addr, 0); /* Heap base. */
- ARMul_WriteWord (state, addr + 4, temp); /* Heap limit. */
- ARMul_WriteWord (state, addr + 8, temp); /* Stack base. */
- ARMul_WriteWord (state, addr + 12, temp); /* Stack limit. */
- break;
-
- case AngelSWI_Reason_ReportException:
- if (state->Reg[1] == ADP_Stopped_ApplicationExit)
- state->Reg[0] = 0;
- else
- state->Reg[0] = -1;
- state->Emulate = FALSE;
- break;
-
- case ADP_Stopped_ApplicationExit:
- state->Reg[0] = 0;
- state->Emulate = FALSE;
- break;
-
- case ADP_Stopped_RunTimeError:
- state->Reg[0] = -1;
- state->Emulate = FALSE;
- break;
-
- case AngelSWI_Reason_Errno:
- state->Reg[0] = OSptr->ErrorNo;
- break;
-
- case AngelSWI_Reason_Open:
- SWIopen (state,
- ARMul_ReadWord (state, addr),
- ARMul_ReadWord (state, addr + 4));
- break;
-
- case AngelSWI_Reason_Read:
- SWIread (state,
- ARMul_ReadWord (state, addr),
- ARMul_ReadWord (state, addr + 4),
- ARMul_ReadWord (state, addr + 8));
- break;
-
- case AngelSWI_Reason_Write:
- SWIwrite (state,
- ARMul_ReadWord (state, addr),
- ARMul_ReadWord (state, addr + 4),
- ARMul_ReadWord (state, addr + 8));
- break;
+ OSptr->ErrorNo = errno;
+ break;
+
+ case AngelSWI_Reason_Time:
+ state->Reg[0] = (ARMword) sim_callback->time (sim_callback, NULL);
+ OSptr->ErrorNo = sim_callback->get_errno (sim_callback);
+ break;
+
+ case AngelSWI_Reason_WriteC:
+ {
+ char tmp = ARMul_SafeReadByte (state, addr);
+ (void) sim_callback->write_stdout (sim_callback, &tmp, 1);
+ OSptr->ErrorNo = sim_callback->get_errno (sim_callback);
+ break;
+ }
+
+ case AngelSWI_Reason_Write0:
+ SWIWrite0 (state, addr);
+ break;
+
+ case AngelSWI_Reason_Close:
+ state->Reg[0] = sim_callback->close (sim_callback, ARMul_ReadWord (state, addr));
+ OSptr->ErrorNo = sim_callback->get_errno (sim_callback);
+ break;
+
+ case AngelSWI_Reason_Seek:
+ state->Reg[0] = -1 >= sim_callback->lseek (sim_callback, ARMul_ReadWord (state, addr),
+ ARMul_ReadWord (state, addr + 4),
+ SEEK_SET);
+ OSptr->ErrorNo = sim_callback->get_errno (sim_callback);
+ break;
+
+ case AngelSWI_Reason_FLen:
+ SWIflen (state, ARMul_ReadWord (state, addr));
+ break;
+
+ case AngelSWI_Reason_GetCmdLine:
+ WriteCommandLineTo (state, ARMul_ReadWord (state, addr));
+ break;
+
+ case AngelSWI_Reason_HeapInfo:
+ /* R1 is a pointer to a pointer. */
+ addr = ARMul_ReadWord (state, addr);
+
+ /* Pick up the right memory limit. */
+ if (state->MemSize)
+ temp = state->MemSize;
+ else
+ temp = ADDRUSERSTACK;
+
+ ARMul_WriteWord (state, addr, 0); /* Heap base. */
+ ARMul_WriteWord (state, addr + 4, temp); /* Heap limit. */
+ ARMul_WriteWord (state, addr + 8, temp); /* Stack base. */
+ ARMul_WriteWord (state, addr + 12, temp); /* Stack limit. */
+ break;
+
+ case AngelSWI_Reason_ReportException:
+ if (state->Reg[1] == ADP_Stopped_ApplicationExit)
+ state->Reg[0] = 0;
+ else
+ state->Reg[0] = -1;
+ state->Emulate = FALSE;
+ break;
+
+ case ADP_Stopped_ApplicationExit:
+ state->Reg[0] = 0;
+ state->Emulate = FALSE;
+ break;
+
+ case ADP_Stopped_RunTimeError:
+ state->Reg[0] = -1;
+ state->Emulate = FALSE;
+ break;
+
+ case AngelSWI_Reason_Errno:
+ state->Reg[0] = OSptr->ErrorNo;
+ break;
+
+ case AngelSWI_Reason_Open:
+ SWIopen (state,
+ ARMul_ReadWord (state, addr),
+ ARMul_ReadWord (state, addr + 4));
+ break;
+
+ case AngelSWI_Reason_Read:
+ SWIread (state,
+ ARMul_ReadWord (state, addr),
+ ARMul_ReadWord (state, addr + 4),
+ ARMul_ReadWord (state, addr + 8));
+ break;
+
+ case AngelSWI_Reason_Write:
+ SWIwrite (state,
+ ARMul_ReadWord (state, addr),
+ ARMul_ReadWord (state, addr + 4),
+ ARMul_ReadWord (state, addr + 8));
+ break;
+ }
}
+ else
+ unhandled = TRUE;
+ break;
case 0x90:
case 0x91:
@@ -645,78 +686,84 @@ ARMul_OSHandleSWI (ARMul_State * state, ARMword number)
break;
case 0x180001: /* RedBoot's Syscall SWI in ARM mode. */
- switch (state->Reg[0])
+ if (swi_mask & SWI_MASK_REDBOOT)
{
- /* These numbers are defined in libgloss/syscall.h
- but the simulator should not be dependend upon
- libgloss being installed. */
- case 1: /* Exit. */
- state->Emulate = FALSE;
- return TRUE;
-
- case 2: /* Open. */
- SWIopen (state, state->Reg[1], state->Reg[2]);
- return TRUE;
-
- case 3: /* Close. */
- state->Reg[0] = sim_callback->close (sim_callback, state->Reg[1]);
- OSptr->ErrorNo = sim_callback->get_errno (sim_callback);
- return TRUE;
-
- case 4: /* Read. */
- SWIread (state, state->Reg[1], state->Reg[2], state->Reg[3]);
- return TRUE;
-
- case 5: /* Write. */
- SWIwrite (state, state->Reg[1], state->Reg[2], state->Reg[3]);
- return TRUE;
-
- case 6: /* Lseek. */
- state->Reg[0] = sim_callback->lseek (sim_callback,
- state->Reg[1],
- state->Reg[2],
- state->Reg[3]);
- OSptr->ErrorNo = sim_callback->get_errno (sim_callback);
- return TRUE;
-
- case 17: /* Utime. */
- state->Reg[0] = (ARMword) sim_callback->time (sim_callback,
- (long *) state->Reg[1]);
- OSptr->ErrorNo = sim_callback->get_errno (sim_callback);
- return TRUE;
-
- case 7: /* Unlink. */
- case 8: /* Getpid. */
- case 9: /* Kill. */
- case 10: /* Fstat. */
- case 11: /* Sbrk. */
- case 12: /* Argvlen. */
- case 13: /* Argv. */
- case 14: /* ChDir. */
- case 15: /* Stat. */
- case 16: /* Chmod. */
- case 18: /* Time. */
- sim_callback->printf_filtered
- (sim_callback,
- "sim: unhandled RedBoot syscall '%d' encountered - ignoring\n",
- state->Reg[0]);
- return FALSE;
-
- default:
- sim_callback->printf_filtered
- (sim_callback,
- "sim: unknown RedBoot syscall '%d' encountered - ignoring\n",
- state->Reg[0]);
- return FALSE;
+ switch (state->Reg[0])
+ {
+ /* These numbers are defined in libgloss/syscall.h
+ but the simulator should not be dependend upon
+ libgloss being installed. */
+ case 1: /* Exit. */
+ state->Emulate = FALSE;
+ /* Copy exit code into r0. */
+ state->Reg[0] = state->Reg[1];
+ break;
+
+ case 2: /* Open. */
+ SWIopen (state, state->Reg[1], state->Reg[2]);
+ break;
+
+ case 3: /* Close. */
+ state->Reg[0] = sim_callback->close (sim_callback, state->Reg[1]);
+ OSptr->ErrorNo = sim_callback->get_errno (sim_callback);
+ break;
+
+ case 4: /* Read. */
+ SWIread (state, state->Reg[1], state->Reg[2], state->Reg[3]);
+ break;
+
+ case 5: /* Write. */
+ SWIwrite (state, state->Reg[1], state->Reg[2], state->Reg[3]);
+ break;
+
+ case 6: /* Lseek. */
+ state->Reg[0] = sim_callback->lseek (sim_callback,
+ state->Reg[1],
+ state->Reg[2],
+ state->Reg[3]);
+ OSptr->ErrorNo = sim_callback->get_errno (sim_callback);
+ break;
+
+ case 17: /* Utime. */
+ state->Reg[0] = (ARMword) sim_callback->time (sim_callback,
+ (long *) state->Reg[1]);
+ OSptr->ErrorNo = sim_callback->get_errno (sim_callback);
+ break;
+
+ case 7: /* Unlink. */
+ case 8: /* Getpid. */
+ case 9: /* Kill. */
+ case 10: /* Fstat. */
+ case 11: /* Sbrk. */
+ case 12: /* Argvlen. */
+ case 13: /* Argv. */
+ case 14: /* ChDir. */
+ case 15: /* Stat. */
+ case 16: /* Chmod. */
+ case 18: /* Time. */
+ sim_callback->printf_filtered
+ (sim_callback,
+ "sim: unhandled RedBoot syscall '%d' encountered - ignoring\n",
+ state->Reg[0]);
+ return FALSE;
+
+ default:
+ sim_callback->printf_filtered
+ (sim_callback,
+ "sim: unknown RedBoot syscall '%d' encountered - ignoring\n",
+ state->Reg[0]);
+ return FALSE;
+ }
+ break;
}
- return TRUE;
default:
- /* If there is a SWI vector installed use it. */
- if (state->is_XScale && saved_number != -1)
- number = saved_number;
-
- if (SWI_vector_installed && number != SWI_Breakpoint)
+ unhandled = TRUE;
+ }
+
+ if (unhandled)
+ {
+ if (SWI_vector_installed)
{
ARMword cpsr;
ARMword i_size;
diff --git a/sim/arm/armsupp.c b/sim/arm/armsupp.c
index 027a9622134..6e22ac771c9 100644
--- a/sim/arm/armsupp.c
+++ b/sim/arm/armsupp.c
@@ -138,6 +138,7 @@ void
ARMul_FixCPSR (ARMul_State * state, ARMword instr, ARMword rhs)
{
state->Cpsr = ARMul_GetCPSR (state);
+
if (state->Mode != USER26MODE
&& state->Mode != USER32MODE)
{
@@ -569,7 +570,6 @@ ARMul_STC (ARMul_State * state, ARMword instr, ARMword address)
#ifndef MODE32
if (ADDREXCEPT (address) || VECTORACCESS (address))
INTERNALABORT (address);
-
#endif
BUSUSEDINCPCN;
if (BIT (21))
diff --git a/sim/arm/armvirt.c b/sim/arm/armvirt.c
index ce1e77d8c45..26fd905ac36 100644
--- a/sim/arm/armvirt.c
+++ b/sim/arm/armvirt.c
@@ -64,7 +64,8 @@ GetWord (ARMul_State * state, ARMword address, int check)
ARMword **pagetable;
ARMword *pageptr;
- XScale_check_memacc (state, &address, 0);
+ if (check)
+ XScale_check_memacc (state, &address, 0);
page = address >> PAGEBITS;
offset = (address & OFFSETBITS) >> 2;
@@ -99,7 +100,8 @@ PutWord (ARMul_State * state, ARMword address, ARMword data, int check)
ARMword **pagetable;
ARMword *pageptr;
- XScale_check_memacc (state, &address, 1);
+ if (check)
+ XScale_check_memacc (state, &address, 1);
page = address >> PAGEBITS;
offset = (address & OFFSETBITS) >> 2;
diff --git a/sim/arm/dbg_rdi.h b/sim/arm/dbg_rdi.h
index 35924ec2267..14d9d703916 100644
--- a/sim/arm/dbg_rdi.h
+++ b/sim/arm/dbg_rdi.h
@@ -330,3 +330,9 @@ struct RDIProcVec
};
#endif
+
+extern unsigned int swi_mask;
+
+#define SWI_MASK_DEMON (1 << 0)
+#define SWI_MASK_ANGEL (1 << 1)
+#define SWI_MASK_REDBOOT (1 << 2)
diff --git a/sim/arm/thumbemu.c b/sim/arm/thumbemu.c
index 4f007333363..1b28edf80f0 100644
--- a/sim/arm/thumbemu.c
+++ b/sim/arm/thumbemu.c
@@ -489,7 +489,7 @@ tdstate ARMul_ThumbDecode (state, pc, tinstr, ainstr)
if r14 is not suitably initialised. */
{
ARMword tmp = (pc + 2);
-
+
state->Reg[15] = ((state->Reg[14] + ((tinstr & 0x07FF) << 1))
& 0xFFFFFFFC);
CLEART;
@@ -509,8 +509,9 @@ tdstate ARMul_ThumbDecode (state, pc, tinstr, ainstr)
second half of this BL, and if it is we simulate it
immediately. */
state->Reg[14] = state->Reg[15] \
- +(((tinstr & 0x07FF) << 12) \
- |((tinstr & (1 << 10)) ? 0xFF800000 : 0));
+ + (((tinstr & 0x07FF) << 12) \
+ | ((tinstr & (1 << 10)) ? 0xFF800000 : 0));
+
valid = t_branch; /* in-case we don't have the 2nd half */
tinstr = next_instr; /* move the instruction down */
pc += 2; /* point the pc at the 2nd half */
@@ -520,12 +521,8 @@ tdstate ARMul_ThumbDecode (state, pc, tinstr, ainstr)
{
ARMword tmp = (pc + 2);
- /* Bit one of the destination address comes from bit one of the
- address of the first (H == 10) half of the instruction, not
- from the offset in the instruction. */
state->Reg[15] = ((state->Reg[14]
- + ((tinstr & 0x07FE) << 1)
- + ((pc - 2) & 2))
+ + ((tinstr & 0x07FE) << 1))
& 0xFFFFFFFC);
CLEART;
state->Reg[14] = (tmp | 1);
@@ -538,6 +535,7 @@ tdstate ARMul_ThumbDecode (state, pc, tinstr, ainstr)
break;
}
/* else we fall through to process the second half of the BL */
+ pc += 2; /* point the pc at the 2nd half */
case 31: /* BL instruction 2 */
/* Format 19 */
/* There is no single ARM instruction equivalent for this
@@ -546,7 +544,8 @@ tdstate ARMul_ThumbDecode (state, pc, tinstr, ainstr)
the simulation of it on its own, with undefined results if
r14 is not suitably initialised. */
{
- ARMword tmp = (pc + 2);
+ ARMword tmp = pc;
+
state->Reg[15] = (state->Reg[14] + ((tinstr & 0x07FF) << 1));
state->Reg[14] = (tmp | 1);
valid = t_branch;
diff --git a/sim/arm/wrapper.c b/sim/arm/wrapper.c
index 773ef354d86..c8361ba9fae 100644
--- a/sim/arm/wrapper.c
+++ b/sim/arm/wrapper.c
@@ -28,13 +28,15 @@
#include <string.h>
#include <bfd.h>
#include <signal.h>
-#include "callback.h"
-#include "remote-sim.h"
+#include "gdb/callback.h"
+#include "gdb/remote-sim.h"
#include "armdefs.h"
#include "armemu.h"
#include "dbg_rdi.h"
#include "ansidecl.h"
#include "sim-utils.h"
+#include "run-sim.h"
+#include "gdb/sim-arm.h"
host_callback *sim_callback;
@@ -222,7 +224,8 @@ sim_create_inferior (sd, abfd, argv, env)
default:
(*sim_callback->printf_filtered)
(sim_callback,
- "Unknown machine type; please update sim_create_inferior.\n");
+ "Unknown machine type '%d'; please update sim_create_inferior.\n",
+ mach);
/* fall through */
case 0:
@@ -384,13 +387,45 @@ sim_store_register (sd, rn, memory, length)
{
init ();
- if (rn == 25)
+ switch ((enum sim_arm_regs) rn)
{
+ case SIM_ARM_R0_REGNUM:
+ case SIM_ARM_R1_REGNUM:
+ case SIM_ARM_R2_REGNUM:
+ case SIM_ARM_R3_REGNUM:
+ case SIM_ARM_R4_REGNUM:
+ case SIM_ARM_R5_REGNUM:
+ case SIM_ARM_R6_REGNUM:
+ case SIM_ARM_R7_REGNUM:
+ case SIM_ARM_R8_REGNUM:
+ case SIM_ARM_R9_REGNUM:
+ case SIM_ARM_R10_REGNUM:
+ case SIM_ARM_R11_REGNUM:
+ case SIM_ARM_R12_REGNUM:
+ case SIM_ARM_R13_REGNUM:
+ case SIM_ARM_R14_REGNUM:
+ case SIM_ARM_R15_REGNUM: /* PC */
+ case SIM_ARM_FP0_REGNUM:
+ case SIM_ARM_FP1_REGNUM:
+ case SIM_ARM_FP2_REGNUM:
+ case SIM_ARM_FP3_REGNUM:
+ case SIM_ARM_FP4_REGNUM:
+ case SIM_ARM_FP5_REGNUM:
+ case SIM_ARM_FP6_REGNUM:
+ case SIM_ARM_FP7_REGNUM:
+ case SIM_ARM_FPS_REGNUM:
+ ARMul_SetReg (state, state->Mode, rn, frommem (state, memory));
+ break;
+
+ case SIM_ARM_PS_REGNUM:
state->Cpsr = frommem (state, memory);
- ARMul_CPSRAltered (state);
+ ARMul_CPSRAltered (state);
+ break;
+
+ default:
+ return 0;
}
- else
- ARMul_SetReg (state, state->Mode, rn, frommem (state, memory));
+
return -1;
}
@@ -405,14 +440,46 @@ sim_fetch_register (sd, rn, memory, length)
init ();
- if (rn < 16)
- regval = ARMul_GetReg (state, state->Mode, rn);
- else if (rn == 25)
- /* FIXME: use PS_REGNUM from gdb/config/arm/tm-arm.h. */
- regval = ARMul_GetCPSR (state);
- else
- /* FIXME: should report an error. */
- regval = 0;
+ switch ((enum sim_arm_regs) rn)
+ {
+ case SIM_ARM_R0_REGNUM:
+ case SIM_ARM_R1_REGNUM:
+ case SIM_ARM_R2_REGNUM:
+ case SIM_ARM_R3_REGNUM:
+ case SIM_ARM_R4_REGNUM:
+ case SIM_ARM_R5_REGNUM:
+ case SIM_ARM_R6_REGNUM:
+ case SIM_ARM_R7_REGNUM:
+ case SIM_ARM_R8_REGNUM:
+ case SIM_ARM_R9_REGNUM:
+ case SIM_ARM_R10_REGNUM:
+ case SIM_ARM_R11_REGNUM:
+ case SIM_ARM_R12_REGNUM:
+ case SIM_ARM_R13_REGNUM:
+ case SIM_ARM_R14_REGNUM:
+ case SIM_ARM_R15_REGNUM: /* PC */
+ regval = ARMul_GetReg (state, state->Mode, rn);
+ break;
+
+ case SIM_ARM_FP0_REGNUM:
+ case SIM_ARM_FP1_REGNUM:
+ case SIM_ARM_FP2_REGNUM:
+ case SIM_ARM_FP3_REGNUM:
+ case SIM_ARM_FP4_REGNUM:
+ case SIM_ARM_FP5_REGNUM:
+ case SIM_ARM_FP6_REGNUM:
+ case SIM_ARM_FP7_REGNUM:
+ case SIM_ARM_FPS_REGNUM:
+ memset (memory, 0, length);
+ return 0;
+
+ case SIM_ARM_PS_REGNUM:
+ regval = ARMul_GetCPSR (state);
+ break;
+
+ default:
+ return 0;
+ }
while (length)
{
@@ -426,6 +493,119 @@ sim_fetch_register (sd, rn, memory, length)
return -1;
}
+#ifdef SIM_TARGET_SWITCHES
+
+static void sim_target_parse_arg_array PARAMS ((char **));
+
+typedef struct
+{
+ char * swi_option;
+ unsigned int swi_mask;
+} swi_options;
+
+#define SWI_SWITCH "--swi-support"
+
+static swi_options options[] =
+ {
+ { "none", 0 },
+ { "demon", SWI_MASK_DEMON },
+ { "angel", SWI_MASK_ANGEL },
+ { "redboot", SWI_MASK_REDBOOT },
+ { "all", -1 },
+ { "NONE", 0 },
+ { "DEMON", SWI_MASK_DEMON },
+ { "ANGEL", SWI_MASK_ANGEL },
+ { "REDBOOT", SWI_MASK_REDBOOT },
+ { "ALL", -1 }
+ };
+
+
+int
+sim_target_parse_command_line (argc, argv)
+ int argc;
+ char ** argv;
+{
+ int i;
+
+ for (i = 1; i < argc; i++)
+ {
+ char * ptr = argv[i];
+ int arg;
+
+ if ((ptr == NULL) || (* ptr != '-'))
+ break;
+
+ if (strncmp (ptr, SWI_SWITCH, sizeof SWI_SWITCH - 1) != 0)
+ continue;
+
+ if (ptr[sizeof SWI_SWITCH - 1] == 0)
+ {
+ /* Remove this option from the argv array. */
+ for (arg = i; arg < argc; arg ++)
+ argv[arg] = argv[arg + 1];
+ argc --;
+
+ ptr = argv[i];
+ }
+ else
+ ptr += sizeof SWI_SWITCH;
+
+ swi_mask = 0;
+
+ while (* ptr)
+ {
+ int i;
+
+ for (i = sizeof options / sizeof options[0]; i--;)
+ if (strncmp (ptr, options[i].swi_option,
+ strlen (options[i].swi_option)) == 0)
+ {
+ swi_mask |= options[i].swi_mask;
+ ptr += strlen (options[i].swi_option);
+
+ if (* ptr == ',')
+ ++ ptr;
+
+ break;
+ }
+
+ if (i < 0)
+ break;
+ }
+
+ if (* ptr != 0)
+ fprintf (stderr, "Ignoring swi options: %s\n", ptr);
+
+ /* Remove this option from the argv array. */
+ for (arg = i; arg < argc; arg ++)
+ argv[arg] = argv[arg + 1];
+ argc --;
+ i --;
+ }
+ return argc;
+}
+
+static void
+sim_target_parse_arg_array (argv)
+ char ** argv;
+{
+ int i;
+
+ for (i = 0; argv[i]; i++)
+ ;
+
+ return (void) sim_target_parse_command_line (i, argv);
+}
+
+void
+sim_target_display_usage ()
+{
+ fprintf (stderr, "%s=<list> Comma seperated list of SWI protocols to supoport.\n\
+ This list can contain: NONE, DEMON, ANGEL, REDBOOT and/or ALL.\n",
+ SWI_SWITCH);
+}
+#endif
+
SIM_DESC
sim_open (kind, ptr, abfd, argv)
SIM_OPEN_KIND kind;
@@ -438,6 +618,10 @@ sim_open (kind, ptr, abfd, argv)
myname = (char *) xstrdup (argv[0]);
sim_callback = ptr;
+#ifdef SIM_TARGET_SWITCHES
+ sim_target_parse_arg_array (argv);
+#endif
+
/* Decide upon the endian-ness of the processor.
If we can, get the information from the bfd itself.
Otherwise look to see if we have been given a command
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog
index 6935b013c79..979c1ee945b 100644
--- a/sim/common/ChangeLog
+++ b/sim/common/ChangeLog
@@ -1,3 +1,51 @@
+2002-06-09 Aldy Hernandez <aldyh@redhat.com>
+
+ * sim-fpu.c (unpack_fpu): Initialize exponent for
+ sim_fpu_class_zero.
+ (i2fpu): Same.
+ (sim_fpu_sqrt): Same.
+
+2002-06-08 Andrew Cagney <cagney@redhat.com>
+
+ * gentmap.c (gen_targ_map_c): Generate "gdb/callback.h".
+ * sim-basics.h: Include "gdb/callback.h" and "gdb/remote-sim.h".
+ * run.c: Ditto.
+ * sim-load.c: Ditto.
+ * callback.c: Ditto.
+ * syscall.c: Ditto.
+ * Make-common.in (callback_h): Define.
+ (remote_sim_h): Define.
+ (run.o): Update.
+ (callback.o): Update.
+ (syscall.o): Update.
+ (sim-load.o):
+ (nrun.o): Update.
+ (sim-hload.o): Update.
+ (sim-io.o): Update.
+ (sim-reason.o): Update.
+ (sim-reg.o): Update.
+ (sim-resume.o): Update.
+
+2002-05-30 Kazu Hirata <kazu@cs.umass.edu>
+
+ * run.c: Fix formatting.
+
+2002-05-20 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * run-sim.h: New header. Provide prototypes for functions used
+ between run() and libsim.a which are not used by GDB.
+ * run.c: Include run-sim.h.
+ (main): If SIM_TARGET_SWITCHES is defined call
+ sim_target_parse_command_line.
+ (usage): If SIM_TARGET_SWITCHES is defined call
+ sim_target_display_usage.
+
+2002-05-17 Andrey Volkov <avolkov@transas.com>
+
+ * run.c: Made h8300s as new target, not h8300h alias.
+ Added new option -S (h8300s target)
+ * sim-options.c: Ditto.
+
2002-05-01 Chris Demetriou <cgd@broadcom.com>
* callback.c: Use 'deprecated' rather than 'depreciated.'
diff --git a/sim/common/Make-common.in b/sim/common/Make-common.in
index 519b213da73..6662efd748a 100644
--- a/sim/common/Make-common.in
+++ b/sim/common/Make-common.in
@@ -248,6 +248,9 @@ LIB_OBJS = callback.o syscall.o targ-map.o $(SIM_OBJS)
RUNTESTFLAGS =
+callback_h = $(srcroot)/include/gdb/callback.h
+remote_sim_h = $(srcroot)/include/gdb/remote-sim.h
+
all: $(SIM_EXTRA_ALL) libsim.a run .gdbinit
libsim.a: $(LIB_OBJS)
@@ -259,8 +262,7 @@ run: $(SIM_RUN_OBJS) libsim.a $(LIBDEPS)
$(CC) $(ALL_CFLAGS) -o run$(EXEEXT) \
$(SIM_RUN_OBJS) libsim.a $(EXTRA_LIBS)
-run.o: $(srccom)/run.c config.h tconfig.h \
- $(srcroot)/include/remote-sim.h $(srcroot)/include/callback.h
+run.o: $(srccom)/run.c config.h tconfig.h $(remote_sim_h) $(callback_h)
$(CC) -c $(srccom)/run.c $(ALL_CFLAGS)
# FIXME: Ideally, callback.o and friends live in a library outside of
@@ -268,12 +270,10 @@ run.o: $(srccom)/run.c config.h tconfig.h \
# devo/libremote because this directory would contain more than just
# a library).
-callback.o: $(srccom)/callback.c config.h tconfig.h \
- $(srcroot)/include/callback.h targ-vals.h
+callback.o: $(srccom)/callback.c config.h tconfig.h $(callback_h) targ-vals.h
$(CC) -c $(srccom)/callback.c $(ALL_CFLAGS)
-syscall.o: $(srccom)/syscall.c config.h tconfig.h \
- $(srcroot)/include/callback.h targ-vals.h
+syscall.o: $(srccom)/syscall.c config.h tconfig.h $(callback_h) targ-vals.h
$(CC) -c $(srccom)/syscall.c $(ALL_CFLAGS)
targ-map.o: targ-map.c targ-vals.h
@@ -399,21 +399,18 @@ sim-fpu.o: $(srccom)/sim-fpu.c $(sim-fpu_h) \
$(SIM_EXTRA_DEPS)
$(CC) -c $(srccom)/sim-fpu.c $(ALL_CFLAGS)
-sim-hload.o: $(srccom)/sim-hload.c $(sim-assert_h) \
- $(srcroot)/include/remote-sim.h \
+sim-hload.o: $(srccom)/sim-hload.c $(sim-assert_h) $(remote_sim_h) \
$(SIM_EXTRA_DEPS)
$(CC) -c $(srccom)/sim-hload.c $(ALL_CFLAGS)
-sim-hrw.o: $(srccom)/sim-hrw.c $(sim-assert_h) $(sim_core_h) \
- $(srcroot)/include/remote-sim.h \
+sim-hrw.o: $(srccom)/sim-hrw.c $(sim-assert_h) $(sim_core_h) $(remote_sim_h) \
$(SIM_EXTRA_DEPS)
$(CC) -c $(srccom)/sim-hrw.c $(ALL_CFLAGS)
sim-hw.o: $(srccom)/sim-hw.c $(sim_main_headers)
$(CC) -c $(srccom)/sim-hw.c $(ALL_CFLAGS)
-sim-info.o: $(srccom)/sim-info.c $(sim-assert_h) \
- $(srcroot)/include/remote-sim.h \
+sim-info.o: $(srccom)/sim-info.c $(sim-assert_h) $(remote_sim_h) \
$(SIM_EXTRA_DEPS)
$(CC) -c $(srccom)/sim-info.c $(ALL_CFLAGS)
@@ -423,8 +420,8 @@ sim-inline.c: $(srccom)/sim-inline.c
cat $(srccom)/$@ >> tmp-$@
$(SHELL) $(srcdir)/../../move-if-change tmp-$@ $@
-sim-io.o: $(srccom)/sim-io.c $(sim_main_headers) $(sim-io_h) \
- $(srcroot)/include/remote-sim.h targ-vals.h
+sim-io.o: $(srccom)/sim-io.c $(sim_main_headers) $(sim-io_h) $(remote_sim_h) \
+ targ-vals.h
$(CC) -c $(srccom)/sim-io.c $(ALL_CFLAGS)
sim-memopt.o: $(srccom)/sim-memopt.c $(sim_main_headers) \
@@ -439,16 +436,13 @@ sim-options.o: $(srccom)/sim-options.c $(sim_main_headers) \
$(sim-options_h) $(sim-io_h)
$(CC) -c $(srccom)/sim-options.c $(ALL_CFLAGS)
-sim-reason.o: $(srccom)/sim-reason.c $(sim_main_headers) \
- $(srcroot)/include/remote-sim.h
+sim-reason.o: $(srccom)/sim-reason.c $(sim_main_headers) $(remote_sim_h)
$(CC) -c $(srccom)/sim-reason.c $(ALL_CFLAGS)
-sim-reg.o: $(srccom)/sim-reg.c $(sim_main_headers) \
- $(srcroot)/include/remote-sim.h
+sim-reg.o: $(srccom)/sim-reg.c $(sim_main_headers) $(remote_sim_h)
$(CC) -c $(srccom)/sim-reg.c $(ALL_CFLAGS)
-sim-resume.o: $(srccom)/sim-resume.c $(sim_main_headers) \
- $(srcroot)/include/remote-sim.h
+sim-resume.o: $(srccom)/sim-resume.c $(sim_main_headers) $(remote_sim_h)
$(CC) -c $(srccom)/sim-resume.c $(ALL_CFLAGS)
sim-run.o: $(srccom)/sim-run.c $(sim_main_headers)
@@ -478,7 +472,7 @@ sim-utils.o: $(srccom)/sim-utils.c $(sim_main_headers)
sim-watch.o: $(srccom)/sim-watch.c $(sim_main_headers)
$(CC) -c $(srccom)/sim-watch.c $(ALL_CFLAGS)
-sim-load.o: $(srccom)/sim-load.c $(srcroot)/include/callback.h
+sim-load.o: $(srccom)/sim-load.c $(callback_h)
$(CC) -c $(srccom)/sim-load.c $(ALL_CFLAGS)
sim-break.o: $(srccom)/sim-break.c $(sim_main_headers) \
@@ -547,8 +541,7 @@ dv-sockser.o: $(srccom)/dv-sockser.h $(sim_main_headers)
$(CC) -c $(srccom)/dv-sockser.c $(ALL_CFLAGS)
-nrun.o: $(srccom)/nrun.c config.h tconfig.h \
- $(srcroot)/include/remote-sim.h $(srcroot)/include/callback.h \
+nrun.o: $(srccom)/nrun.c config.h tconfig.h $(remote_sim_h) $(callback_h) \
$(sim_main_headers)
$(CC) -c $(srccom)/nrun.c $(ALL_CFLAGS)
@@ -685,7 +678,7 @@ cgen-arch: force
$(SHELL) $(srccom)/cgen.sh arch $(srcdir) \
$(CGEN) $(CGENDIR) "$(CGENFLAGS)" \
$(arch) "$(FLAGS)" ignored "$(isa)" $(mach) ignored ignored
-
+
cgen-cpu: force
$(SHELL) $(srccom)/cgen.sh cpu $(srcdir) \
$(CGEN) $(CGENDIR) "$(CGENFLAGS)" \
diff --git a/sim/common/callback.c b/sim/common/callback.c
index af5de148ad0..db0fff68e80 100644
--- a/sim/common/callback.c
+++ b/sim/common/callback.c
@@ -46,7 +46,7 @@
#include <time.h>
#include <sys/types.h>
#include <sys/stat.h>
-#include "callback.h"
+#include "gdb/callback.h"
#include "targ-vals.h"
#ifdef HAVE_UNISTD_H
diff --git a/sim/common/gentmap.c b/sim/common/gentmap.c
index e4f5d0dc8b4..897a6f70c77 100644
--- a/sim/common/gentmap.c
+++ b/sim/common/gentmap.c
@@ -68,7 +68,7 @@ gen_targ_map_c ()
printf ("#include <errno.h>\n");
printf ("#include <fcntl.h>\n");
printf ("#include \"ansidecl.h\"\n");
- printf ("#include \"callback.h\"\n");
+ printf ("#include \"gdb/callback.h\"\n");
printf ("#include \"targ-vals.h\"\n");
printf ("\n");
diff --git a/sim/common/run-sim.h b/sim/common/run-sim.h
new file mode 100644
index 00000000000..7792373e789
--- /dev/null
+++ b/sim/common/run-sim.h
@@ -0,0 +1,32 @@
+/* This file defines the part of the interface between the standalone
+ simaulator program - run - and simulator library - libsim.a - that
+ is not used by GDB. The GDB part is described in include/remote-sim.h.
+
+ 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. */
+
+#ifdef SIM_TARGET_SWITCHES
+ /* Parse the command line, extracting any target specific switches
+ before the generic simulator code gets a chance to complain
+ about them. Returns the adjusted value of argc. */
+int sim_target_parse_command_line PARAMS ((int, char **));
+
+ /* Display a list of target specific switches supported by this
+ target. */
+void sim_target_display_usage PARAMS ((void));
+#endif
diff --git a/sim/common/run.c b/sim/common/run.c
index c34d5e6a124..d8c86cdd701 100644
--- a/sim/common/run.c
+++ b/sim/common/run.c
@@ -1,5 +1,5 @@
/* run front end support for all the simulators.
- Copyright (C) 1992, 93-96, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1992, 93-96, 1997, 2002 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
@@ -43,9 +43,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "libiberty.h"
#include "bfd.h"
-#include "callback.h"
-#include "remote-sim.h"
+#include "gdb/callback.h"
+#include "gdb/remote-sim.h"
#include "ansidecl.h"
+#include "run-sim.h"
static void usage PARAMS ((void));
extern int optind;
@@ -58,7 +59,7 @@ static char *myname;
extern int getopt ();
#ifdef NEED_UI_LOOP_HOOK
-/* Gdb foolery. This is only needed for gdb using a gui. */
+/* Gdb foolery. This is only needed for gdb using a gui. */
int (*ui_loop_hook) PARAMS ((int signo));
#endif
@@ -107,17 +108,21 @@ main (ac, av)
/* FIXME: This is currently being migrated into sim_open.
Simulators that use functions such as sim_size() still require
- this. */
+ this. */
default_callback.init (&default_callback);
sim_set_callbacks (&default_callback);
+#ifdef SIM_TARGET_SWITCHES
+ ac = sim_target_parse_command_line (ac, av);
+#endif
+
/* FIXME: This is currently being rewritten to have each simulator
do all argv processing. */
#ifdef SIM_H8300 /* FIXME: quick hack */
- while ((i = getopt (ac, av, "a:c:m:op:s:htv")) != EOF)
+ while ((i = getopt (ac, av, "a:c:m:op:s:hStv")) != EOF)
#else
- while ((i = getopt (ac, av, "a:c:m:op:s:tv")) != EOF)
+ while ((i = getopt (ac, av, "a:c:m:op:s:tv")) != EOF)
#endif
switch (i)
{
@@ -148,7 +153,7 @@ main (ac, av)
#ifdef SIM_HAVE_ENVIRONMENT
case 'o':
/* Operating enironment where any signals are delivered to the
- target. */
+ target. */
operating_p = 1;
break;
#endif SIM_HAVE_ENVIRONMENT
@@ -173,7 +178,10 @@ main (ac, av)
/* FIXME: Quick hack, to be replaced by more general facility. */
#ifdef SIM_H8300
case 'h':
- set_h8300h (1);
+ set_h8300h (1, 0);
+ break;
+ case 'S':
+ set_h8300h (1, 1);
break;
#endif
default:
@@ -194,9 +202,9 @@ main (ac, av)
}
abfd = bfd_openr (name, 0);
- if (!abfd)
+ if (!abfd)
{
- fprintf (stderr, "%s: can't open %s: %s\n",
+ fprintf (stderr, "%s: can't open %s: %s\n",
myname, name, bfd_errmsg (bfd_get_error ()));
exit (1);
}
@@ -223,7 +231,7 @@ main (ac, av)
#endif
/* Ensure that any run-time initialisation that needs to be
- performed by the simulator can occur. */
+ performed by the simulator can occur. */
sd = sim_open (SIM_OPEN_STANDALONE, &default_callback, abfd, sim_argv);
if (sd == 0)
exit (1);
@@ -237,7 +245,7 @@ main (ac, av)
#ifdef SIM_HAVE_ENVIRONMENT
/* NOTE: An old simulator supporting the operating environment MUST
provide sim_set_trace() and not sim_trace(). That way
- sim_stop_reason() can be used to determine any stop reason. */
+ sim_stop_reason() can be used to determine any stop reason. */
if (trace)
sim_set_trace ();
sigrc = 0;
@@ -291,14 +299,14 @@ main (ac, av)
case sim_signalled:
case sim_stopped:
if (sigrc != 0)
- fprintf (stderr, "program stopped with signal %d.\n", sigrc);
+ fprintf (stderr, "program stopped with signal %d.\n", sigrc);
break;
case sim_exited:
break;
case sim_running:
- case sim_polling: /* these indicate a serious problem */
+ case sim_polling: /* These indicate a serious problem. */
abort ();
break;
@@ -318,7 +326,8 @@ usage ()
fprintf (stderr, "-c size Set simulator cache size to `size'.\n");
#endif
#ifdef SIM_H8300
- fprintf (stderr, "-h Executable is for H8/300H or H8/S.\n");
+ fprintf (stderr, "-h Executable is for h8/300h.\n");
+ fprintf (stderr, "-S Executable is for h8/300s.\n");
#endif
fprintf (stderr, "-m size Set memory size of simulator, in bytes.\n");
#ifdef SIM_HAVE_ENVIRONMENT
@@ -334,5 +343,9 @@ usage ()
fprintf (stderr, "\n");
fprintf (stderr, "program args Arguments to pass to simulated program.\n");
fprintf (stderr, " Note: Very few simulators support this.\n");
+#ifdef SIM_TARGET_SWITCHES
+ fprintf (stderr, "\nTarget specific options:\n");
+ sim_target_display_usage ();
+#endif
exit (1);
}
diff --git a/sim/common/sim-basics.h b/sim/common/sim-basics.h
index fc34b21618f..a7d7a1ed472 100644
--- a/sim/common/sim-basics.h
+++ b/sim/common/sim-basics.h
@@ -132,8 +132,8 @@ typedef enum {
#endif
#include "ansidecl.h"
-#include "callback.h"
-#include "remote-sim.h"
+#include "gdb/callback.h"
+#include "gdb/remote-sim.h"
#include "sim-config.h"
diff --git a/sim/common/sim-fpu.c b/sim/common/sim-fpu.c
index 7639175170e..28d61a565fe 100644
--- a/sim/common/sim-fpu.c
+++ b/sim/common/sim-fpu.c
@@ -330,6 +330,7 @@ unpack_fpu (sim_fpu *dst, unsigned64 packed, int is_double)
/* tastes like zero */
dst->class = sim_fpu_class_zero;
dst->sign = sign;
+ dst->normal_exp = 0;
}
else
{
@@ -520,6 +521,7 @@ i2fpu (sim_fpu *f, signed64 i, int is_64bit)
{
f->class = sim_fpu_class_zero;
f->sign = 0;
+ f->normal_exp = 0;
}
else
{
@@ -648,6 +650,7 @@ u2fpu (sim_fpu *f, unsigned64 u, int is_64bit)
{
f->class = sim_fpu_class_zero;
f->sign = 0;
+ f->normal_exp = 0;
}
else
{
@@ -1799,6 +1802,7 @@ sim_fpu_sqrt (sim_fpu *f,
{
f->class = sim_fpu_class_zero;
f->sign = r->sign;
+ f->normal_exp = 0;
return 0;
}
if (sim_fpu_is_infinity (r))
diff --git a/sim/common/sim-load.c b/sim/common/sim-load.c
index bfe3f15c4bd..314d2dd173c 100644
--- a/sim/common/sim-load.c
+++ b/sim/common/sim-load.c
@@ -36,8 +36,8 @@ along with this program; if not, write to the Free Software Foundation, Inc.,
#include "bfd.h"
#include "sim-utils.h"
-#include "callback.h"
-#include "remote-sim.h"
+#include "gdb/callback.h"
+#include "gdb/remote-sim.h"
static void eprintf PARAMS ((host_callback *, const char *, ...));
static void xprintf PARAMS ((host_callback *, const char *, ...));
diff --git a/sim/common/sim-options.c b/sim/common/sim-options.c
index 9ccc51dc3d9..aae0245613e 100644
--- a/sim/common/sim-options.c
+++ b/sim/common/sim-options.c
@@ -110,6 +110,7 @@ typedef enum {
OPTION_HELP,
#ifdef SIM_H8300 /* FIXME: Should be movable to h8300 dir. */
OPTION_H8300,
+ OPTION_H8300S,
#endif
OPTION_LOAD_LMA,
OPTION_LOAD_VMA,
@@ -152,7 +153,10 @@ static const OPTION standard_options[] =
#ifdef SIM_H8300 /* FIXME: Should be movable to h8300 dir. */
{ {"h8300h", no_argument, NULL, OPTION_H8300},
- 'h', NULL, "Indicate the CPU is h8/300h or h8/300s",
+ '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",
standard_option_handler },
#endif
@@ -354,7 +358,10 @@ standard_option_handler (SIM_DESC sd, sim_cpu *cpu, int opt,
#ifdef SIM_H8300 /* FIXME: Can be moved to h8300 dir. */
case OPTION_H8300:
- set_h8300h (1);
+ set_h8300h (1,0);
+ break;
+ case OPTION_H8300S:
+ set_h8300h (1,1);
break;
#endif
diff --git a/sim/common/syscall.c b/sim/common/syscall.c
index e0a3b880b84..75121cf2fc4 100644
--- a/sim/common/syscall.c
+++ b/sim/common/syscall.c
@@ -46,7 +46,7 @@
#include <time.h>
#include <sys/types.h>
#include <sys/stat.h>
-#include "callback.h"
+#include "gdb/callback.h"
#include "targ-vals.h"
#ifndef ENOSYS
diff --git a/sim/d10v/ChangeLog b/sim/d10v/ChangeLog
index 5f7ad2e09f1..91d71f3f512 100644
--- a/sim/d10v/ChangeLog
+++ b/sim/d10v/ChangeLog
@@ -1,3 +1,42 @@
+2002-06-09 Andrew Cagney <cagney@redhat.com>
+
+ * Makefile.in (INCLUDE): Update path to callback.h.
+ * gencode.c: Do not include "callback.h".
+ * d10v_sim.h: Include "gdb/callback.h" and "gdb/remote-sim.h".
+ * interp.c: Ditto.
+
+2002-06-08 Andrew Cagney <cagney@redhat.com>
+
+ * interp.c (sim_fetch_register): Fix name of enum used in cast.
+ (sim_store_register): Ditto.
+
+2002-06-02 Elena Zannoni <ezannoni@redhat.com>
+
+ From Jason Eckhardt <jle@redhat.com>
+ * d10v_sim.h (INC_ADDR): Correctly handle the case where MOD_E is
+ less than MOD_S (post-decrement).
+
+2002-06-01 Andrew Cagney <ac131313@redhat.com>
+
+ * interp.c (sim_fetch_register, sim_store_register): Use a switch
+ statement and enums from "sim-d10v.h".
+
+2002-05-28 Elena Zannoni <ezannoni@redhat.com>
+
+ * interp.c (sim_create_inferior): Add comment.
+
+ From Alan Matsuoka <alanm@redhat.com>:
+ From 2001-04-27 Jason Eckhardt <jle@cygnus.com>:
+ * simops.c (OP_4400): Output "mvf0f" instead of "mf0f".
+ (OP_4401): Output "mvf0t" instead of "mf0t".
+ (OP_460B): Do not output a flag register.
+ (OP_4609): Do not output a flag register.
+
+2002-05-23 Andrew Cagney <ac131313@redhat.com>
+
+ * Makefile.in (INCLUDE): Add "gdb/sim-d10v.h".
+ * interp.c: Include "gdb/sim-d10v.h" instead of "sim-d10v.h".
+
2001-08-01 John R. Moore <jmoore@redhat.com>
* interp.c (sim_create_inferior): Removed a hack that stated
diff --git a/sim/d10v/Makefile.in b/sim/d10v/Makefile.in
index 82d7e11ceb3..f46c54dd388 100644
--- a/sim/d10v/Makefile.in
+++ b/sim/d10v/Makefile.in
@@ -22,7 +22,8 @@ SIM_OBJS = interp.o table.o simops.o endian.o sim-load.o
SIM_EXTRA_CLEAN = clean-extra
SIM_EXTRA_CFLAGS = -DNEED_UI_LOOP_HOOK -DSIM_HAVE_ENVIRONMENT
-INCLUDE = d10v_sim.h $(srcroot)/include/callback.h targ-vals.h endian.c
+INCLUDE = d10v_sim.h $(srcroot)/include/gdb/callback.h targ-vals.h endian.c \
+ $(srcroot)/include/gdb/sim-d10v.h
# This selects the d10v newlib/libgloss syscall definitions.
NL_TARGET = -DNL_TARGET_d10v
diff --git a/sim/d10v/d10v_sim.h b/sim/d10v/d10v_sim.h
index 3566da01d26..ca14006fbce 100644
--- a/sim/d10v/d10v_sim.h
+++ b/sim/d10v/d10v_sim.h
@@ -3,7 +3,7 @@
#include <ctype.h>
#include <limits.h>
#include "ansidecl.h"
-#include "callback.h"
+#include "gdb/callback.h"
#include "opcode/d10v.h"
#include "bfd.h"
@@ -21,7 +21,7 @@
extern int d10v_debug;
-#include "remote-sim.h"
+#include "gdb/remote-sim.h"
#include "sim-config.h"
#include "sim-types.h"
@@ -435,7 +435,7 @@ do \
{ \
int test_i = i < 0 ? i : ~((i) - 1); \
if (PSW_MD && GPR (x) == (MOD_E & test_i)) \
- SET_GPR (x, MOD_S); \
+ SET_GPR (x, MOD_S & test_i); \
else \
SET_GPR (x, GPR (x) + (i)); \
} \
diff --git a/sim/d10v/gencode.c b/sim/d10v/gencode.c
index 2d1269be996..b66297d0146 100644
--- a/sim/d10v/gencode.c
+++ b/sim/d10v/gencode.c
@@ -3,7 +3,6 @@
#include <ctype.h>
#include <limits.h>
#include "ansidecl.h"
-#include "callback.h"
#include "opcode/d10v.h"
static void write_header PARAMS ((void));
diff --git a/sim/d10v/interp.c b/sim/d10v/interp.c
index ea1828c3e0e..e465a809d02 100644
--- a/sim/d10v/interp.c
+++ b/sim/d10v/interp.c
@@ -1,11 +1,11 @@
#include <signal.h>
#include "sysdep.h"
#include "bfd.h"
-#include "callback.h"
-#include "remote-sim.h"
+#include "gdb/callback.h"
+#include "gdb/remote-sim.h"
#include "d10v_sim.h"
-#include "sim-d10v.h"
+#include "gdb/sim-d10v.h"
enum _leftright { LEFT_FIRST, RIGHT_FIRST };
@@ -1202,6 +1202,14 @@ sim_create_inferior (sd, abfd, argv, env)
/* reset all state information */
memset (&State.regs, 0, (int)&State.mem - (int)&State.regs);
+ /* There was a hack here to copy the values of argc and argv into r0
+ and r1. The values were also saved into some high memory that
+ won't be overwritten by the stack (0x7C00). The reason for doing
+ this was to allow the 'run' program to accept arguments. Without
+ the hack, this is not possible anymore. If the simulator is run
+ from the debugger, arguments cannot be passed in, so this makes
+ no difference. */
+
/* set PC */
if (abfd != NULL)
start_address = bfd_get_start_address (abfd);
@@ -1299,54 +1307,82 @@ sim_fetch_register (sd, rn, memory, length)
int length;
{
int size;
- if (rn < 0)
- size = 0;
- else if (rn >= SIM_D10V_R0_REGNUM
- && rn < SIM_D10V_R0_REGNUM + SIM_D10V_NR_R_REGS)
+ switch ((enum sim_d10v_regs) rn)
{
+ case SIM_D10V_R0_REGNUM:
+ case SIM_D10V_R1_REGNUM:
+ case SIM_D10V_R2_REGNUM:
+ case SIM_D10V_R3_REGNUM:
+ case SIM_D10V_R4_REGNUM:
+ case SIM_D10V_R5_REGNUM:
+ case SIM_D10V_R6_REGNUM:
+ case SIM_D10V_R7_REGNUM:
+ case SIM_D10V_R8_REGNUM:
+ case SIM_D10V_R9_REGNUM:
+ case SIM_D10V_R10_REGNUM:
+ case SIM_D10V_R11_REGNUM:
+ case SIM_D10V_R12_REGNUM:
+ case SIM_D10V_R13_REGNUM:
+ case SIM_D10V_R14_REGNUM:
+ case SIM_D10V_R15_REGNUM:
WRITE_16 (memory, GPR (rn - SIM_D10V_R0_REGNUM));
size = 2;
- }
- else if (rn >= SIM_D10V_CR0_REGNUM
- && rn < SIM_D10V_CR0_REGNUM + SIM_D10V_NR_CR_REGS)
- {
+ break;
+ case SIM_D10V_CR0_REGNUM:
+ case SIM_D10V_CR1_REGNUM:
+ case SIM_D10V_CR2_REGNUM:
+ case SIM_D10V_CR3_REGNUM:
+ case SIM_D10V_CR4_REGNUM:
+ case SIM_D10V_CR5_REGNUM:
+ case SIM_D10V_CR6_REGNUM:
+ case SIM_D10V_CR7_REGNUM:
+ case SIM_D10V_CR8_REGNUM:
+ case SIM_D10V_CR9_REGNUM:
+ case SIM_D10V_CR10_REGNUM:
+ case SIM_D10V_CR11_REGNUM:
+ case SIM_D10V_CR12_REGNUM:
+ case SIM_D10V_CR13_REGNUM:
+ case SIM_D10V_CR14_REGNUM:
+ case SIM_D10V_CR15_REGNUM:
WRITE_16 (memory, CREG (rn - SIM_D10V_CR0_REGNUM));
size = 2;
- }
- else if (rn >= SIM_D10V_A0_REGNUM
- && rn < SIM_D10V_A0_REGNUM + SIM_D10V_NR_A_REGS)
- {
+ break;
+ case SIM_D10V_A0_REGNUM:
+ case SIM_D10V_A1_REGNUM:
WRITE_64 (memory, ACC (rn - SIM_D10V_A0_REGNUM));
size = 8;
- }
- else if (rn == SIM_D10V_SPI_REGNUM)
- {
+ break;
+ case SIM_D10V_SPI_REGNUM:
/* PSW_SM indicates that the current SP is the USER
stack-pointer. */
WRITE_16 (memory, spi_register ());
size = 2;
- }
- else if (rn == SIM_D10V_SPU_REGNUM)
- {
+ break;
+ case SIM_D10V_SPU_REGNUM:
/* PSW_SM indicates that the current SP is the USER
stack-pointer. */
WRITE_16 (memory, spu_register ());
size = 2;
- }
- else if (rn >= SIM_D10V_IMAP0_REGNUM
- && rn < SIM_D10V_IMAP0_REGNUM + SIM_D10V_NR_IMAP_REGS)
- {
+ break;
+ case SIM_D10V_IMAP0_REGNUM:
+ case SIM_D10V_IMAP1_REGNUM:
WRITE_16 (memory, imap_register (rn - SIM_D10V_IMAP0_REGNUM));
size = 2;
- }
- else if (rn >= SIM_D10V_DMAP0_REGNUM
- && rn < SIM_D10V_DMAP0_REGNUM + SIM_D10V_NR_DMAP_REGS)
- {
+ break;
+ case SIM_D10V_DMAP0_REGNUM:
+ case SIM_D10V_DMAP1_REGNUM:
+ case SIM_D10V_DMAP2_REGNUM:
+ case SIM_D10V_DMAP3_REGNUM:
WRITE_16 (memory, dmap_register (rn - SIM_D10V_DMAP0_REGNUM));
size = 2;
+ break;
+ case SIM_D10V_TS2_DMAP_REGNUM:
+ size = 0;
+ break;
+ default:
+ size = 0;
+ break;
}
- else
- size = 0;
return size;
}
@@ -1358,52 +1394,80 @@ sim_store_register (sd, rn, memory, length)
int length;
{
int size;
- if (rn < 0)
- size = 0;
- else if (rn >= SIM_D10V_R0_REGNUM
- && rn < SIM_D10V_R0_REGNUM + SIM_D10V_NR_R_REGS)
+ switch ((enum sim_d10v_regs) rn)
{
+ case SIM_D10V_R0_REGNUM:
+ case SIM_D10V_R1_REGNUM:
+ case SIM_D10V_R2_REGNUM:
+ case SIM_D10V_R3_REGNUM:
+ case SIM_D10V_R4_REGNUM:
+ case SIM_D10V_R5_REGNUM:
+ case SIM_D10V_R6_REGNUM:
+ case SIM_D10V_R7_REGNUM:
+ case SIM_D10V_R8_REGNUM:
+ case SIM_D10V_R9_REGNUM:
+ case SIM_D10V_R10_REGNUM:
+ case SIM_D10V_R11_REGNUM:
+ case SIM_D10V_R12_REGNUM:
+ case SIM_D10V_R13_REGNUM:
+ case SIM_D10V_R14_REGNUM:
+ case SIM_D10V_R15_REGNUM:
SET_GPR (rn - SIM_D10V_R0_REGNUM, READ_16 (memory));
size = 2;
- }
- else if (rn >= SIM_D10V_CR0_REGNUM
- && rn < SIM_D10V_CR0_REGNUM + SIM_D10V_NR_CR_REGS)
- {
+ break;
+ case SIM_D10V_CR0_REGNUM:
+ case SIM_D10V_CR1_REGNUM:
+ case SIM_D10V_CR2_REGNUM:
+ case SIM_D10V_CR3_REGNUM:
+ case SIM_D10V_CR4_REGNUM:
+ case SIM_D10V_CR5_REGNUM:
+ case SIM_D10V_CR6_REGNUM:
+ case SIM_D10V_CR7_REGNUM:
+ case SIM_D10V_CR8_REGNUM:
+ case SIM_D10V_CR9_REGNUM:
+ case SIM_D10V_CR10_REGNUM:
+ case SIM_D10V_CR11_REGNUM:
+ case SIM_D10V_CR12_REGNUM:
+ case SIM_D10V_CR13_REGNUM:
+ case SIM_D10V_CR14_REGNUM:
+ case SIM_D10V_CR15_REGNUM:
SET_CREG (rn - SIM_D10V_CR0_REGNUM, READ_16 (memory));
size = 2;
- }
- else if (rn >= SIM_D10V_A0_REGNUM
- && rn < SIM_D10V_A0_REGNUM + SIM_D10V_NR_A_REGS)
- {
+ break;
+ case SIM_D10V_A0_REGNUM:
+ case SIM_D10V_A1_REGNUM:
SET_ACC (rn - SIM_D10V_A0_REGNUM, READ_64 (memory) & MASK40);
size = 8;
- }
- else if (rn == SIM_D10V_SPI_REGNUM)
- {
+ break;
+ case SIM_D10V_SPI_REGNUM:
/* PSW_SM indicates that the current SP is the USER
stack-pointer. */
set_spi_register (READ_16 (memory));
size = 2;
- }
- else if (rn == SIM_D10V_SPU_REGNUM)
- {
+ break;
+ case SIM_D10V_SPU_REGNUM:
set_spu_register (READ_16 (memory));
size = 2;
- }
- else if (rn >= SIM_D10V_IMAP0_REGNUM
- && rn < SIM_D10V_IMAP0_REGNUM + SIM_D10V_NR_IMAP_REGS)
- {
+ break;
+ case SIM_D10V_IMAP0_REGNUM:
+ case SIM_D10V_IMAP1_REGNUM:
set_imap_register (rn - SIM_D10V_IMAP0_REGNUM, READ_16(memory));
size = 2;
- }
- else if (rn >= SIM_D10V_DMAP0_REGNUM
- && rn < SIM_D10V_DMAP0_REGNUM + SIM_D10V_NR_DMAP_REGS)
- {
+ break;
+ case SIM_D10V_DMAP0_REGNUM:
+ case SIM_D10V_DMAP1_REGNUM:
+ case SIM_D10V_DMAP2_REGNUM:
+ case SIM_D10V_DMAP3_REGNUM:
set_dmap_register (rn - SIM_D10V_DMAP0_REGNUM, READ_16(memory));
size = 2;
+ break;
+ case SIM_D10V_TS2_DMAP_REGNUM:
+ size = 0;
+ break;
+ default:
+ size = 0;
+ break;
}
- else
- size = 0;
SLOT_FLUSH ();
return size;
}
diff --git a/sim/d10v/simops.c b/sim/d10v/simops.c
index cb0fa56c888..1c0ecfe7479 100644
--- a/sim/d10v/simops.c
+++ b/sim/d10v/simops.c
@@ -1972,7 +1972,7 @@ void
OP_4400 ()
{
int16 tmp;
- trace_input ("mf0f", OP_REG_OUTPUT, OP_REG, OP_VOID);
+ trace_input ("mvf0f", OP_REG_OUTPUT, OP_REG, OP_VOID);
if (PSW_F0 == 0)
{
tmp = GPR (OP[1]);
@@ -1988,7 +1988,7 @@ void
OP_4401 ()
{
int16 tmp;
- trace_input ("mf0t", OP_REG_OUTPUT, OP_REG, OP_VOID);
+ trace_input ("mvf0t", OP_REG_OUTPUT, OP_REG, OP_VOID);
if (PSW_F0)
{
tmp = GPR (OP[1]);
@@ -2604,7 +2604,7 @@ void
OP_460B ()
{
int16 tmp;
- trace_input ("slx", OP_REG, OP_FLAG, OP_VOID);
+ trace_input ("slx", OP_REG, OP_VOID, OP_VOID);
tmp = ((GPR (OP[0]) << 1) | PSW_F0);
SET_GPR (OP[0], tmp);
trace_output_16 (tmp);
@@ -2726,7 +2726,7 @@ void
OP_4609 ()
{
uint16 tmp;
- trace_input ("srx", OP_REG, OP_FLAG, OP_VOID);
+ trace_input ("srx", OP_REG, OP_VOID, OP_VOID);
tmp = PSW_F0 << 15;
tmp = ((GPR (OP[0]) >> 1) | tmp);
SET_GPR (OP[0], tmp);
diff --git a/sim/erc32/ChangeLog b/sim/erc32/ChangeLog
index f2ff60050a1..d68e6639a2b 100644
--- a/sim/erc32/ChangeLog
+++ b/sim/erc32/ChangeLog
@@ -1,3 +1,8 @@
+2002-06-08 Andrew Cagney <cagney@redhat.com>
+
+ * sis.h: Include "gdb/remote-sim.h" and "gdb/callback.h".
+ * interf.c: Include "gdb/remote-sim.h".
+
Tue May 23 21:39:23 2000 Andrew Cagney <cagney@b1.cygnus.com>
* configure: Regenerated to track ../common/aclocal.m4 changes.
diff --git a/sim/erc32/interf.c b/sim/erc32/interf.c
index d0a781eb937..19318864534 100644
--- a/sim/erc32/interf.c
+++ b/sim/erc32/interf.c
@@ -31,7 +31,7 @@
#include <dis-asm.h>
#include "sim-config.h"
-#include "remote-sim.h"
+#include "gdb/remote-sim.h"
#ifndef fprintf
extern fprintf();
diff --git a/sim/erc32/sis.h b/sim/erc32/sis.h
index 2a895c0277d..5bdd7704e24 100644
--- a/sim/erc32/sis.h
+++ b/sim/erc32/sis.h
@@ -21,8 +21,8 @@
*/
#include "ansidecl.h"
-#include "callback.h"
-#include "remote-sim.h"
+#include "gdb/callback.h"
+#include "gdb/remote-sim.h"
#include "end.h"
diff --git a/sim/h8300/ChangeLog b/sim/h8300/ChangeLog
index 63925e647d9..443b2228ba7 100644
--- a/sim/h8300/ChangeLog
+++ b/sim/h8300/ChangeLog
@@ -1,3 +1,38 @@
+2002-06-08 Andrew Cagney <cagney@redhat.com>
+
+ * compile.c: Include "gdb/callback.h" and "gdb/remote-sim.h".
+
+2002-05-19 Kazu Hirata <kazu@cs.umass.edu>
+
+ * compile.c: Fix formatting.
+
+2002-05-18 Kazu Hirata <kazu@cs.umass.edu>
+
+ * compile.c: Fix formatting.
+
+2002-05-17 Andrey Volkov (avolkov@transas.com)
+
+ * compile.c: Add absented opcodes: LDC, STC, EEPMOV, TAS.
+
+2002-05-17 Andrey Volkov (avolkov@transas.com)
+
+ * compile.c: Add support of EXR register
+ * inst.h: Ditto.
+
+2002-05-17 Andrey Volkov (avolkov@transas.com)
+
+ * compile.c: Made h8300s as new target, not h8300h alias.
+ * inst.h: Ditto.
+
+2002-05-17 Andrey Volkov (avolkov@transas.com)
+
+ * compile.c: Add additional CCR flags (I,UI,H,U)
+
+2002-05-17 Andrey Volkov (avolkov@transas.com)
+
+ * compile.c: Change literal regnumbers to REGNUMS.
+ Fix instruction and cycles counting
+
2001-12-20 Kazu Hirata <kazu@hxi.com>
* compile.c: Fix formatting.
diff --git a/sim/h8300/compile.c b/sim/h8300/compile.c
index 5e66dcb0954..b8c5ef3f568 100644
--- a/sim/h8300/compile.c
+++ b/sim/h8300/compile.c
@@ -32,8 +32,8 @@
#endif
#include "ansidecl.h"
#include "bfd.h"
-#include "callback.h"
-#include "remote-sim.h"
+#include "gdb/callback.h"
+#include "gdb/remote-sim.h"
#ifndef SIGTRAP
# define SIGTRAP 5
@@ -67,6 +67,7 @@ void sim_set_simcache_size PARAMS ((int));
#define OP_CCR 7
#define OP_IMM 8
#define OP_ABS 10
+#define OP_EXR 11
#define h8_opcodes ops
#define DEFINE_TABLE
#include "opcode/h8300.h"
@@ -81,13 +82,26 @@ void sim_set_simcache_size PARAMS ((int));
#define HIGH_BYTE(x) (((x) >> 8) & 0xff)
#define P(X,Y) ((X << 8) | Y)
-#define BUILDSR() cpu.ccr = (N << 3) | (Z << 2) | (V << 1) | C;
+#define BUILDSR() cpu.ccr = (I << 7) | (UI << 6)| (H<<5) | (U<<4) | \
+ (N << 3) | (Z << 2) | (V<<1) | C;
+
+#define BUILDEXR() \
+ if (h8300smode) cpu.exr = (trace<<7) | intMask;
#define GETSR() \
c = (cpu.ccr >> 0) & 1;\
v = (cpu.ccr >> 1) & 1;\
nz = !((cpu.ccr >> 2) & 1);\
- n = (cpu.ccr >> 3) & 1;
+ n = (cpu.ccr >> 3) & 1;\
+ u = (cpu.ccr >> 4) & 1;\
+ h = (cpu.ccr >> 5) & 1;\
+ ui = ((cpu.ccr >> 6) & 1);\
+ intMaskBit = (cpu.ccr >> 7) & 1;
+
+#define GETEXR() \
+ if (h8300smode) { \
+ trace = (cpu.exr >> 7) & 1;\
+ intMask = cpu.exr & 7; }
#ifdef __CHAR_IS_SIGNED__
#define SEXTCHAR(x) ((char) (x))
@@ -111,10 +125,7 @@ static int memory_size;
static int
get_now ()
{
-#ifndef WIN32
- return time (0);
-#endif
- return 0;
+ return time (0); /* WinXX HAS UNIX like 'time', so why not using it? */
}
static int
@@ -155,7 +166,7 @@ lvalue (x, rn)
return X (OP_MEM, SP);
default:
- abort ();
+ abort (); /* ?? May be something more usefull? */
}
}
@@ -410,6 +421,10 @@ decode (addr, data, dst)
{
p->type = OP_CCR;
}
+ else if (x & EXR)
+ {
+ p->type = OP_EXR;
+ }
else
printf ("Hmmmm %x", x);
@@ -608,7 +623,7 @@ fetch (arg, n)
return t;
default:
- abort ();
+ abort (); /* ?? May be something more usefull? */
}
}
@@ -702,7 +717,9 @@ init_pointers ()
init = 1;
littleendian.i = 1;
- if (h8300hmode)
+ if (h8300smode)
+ memory_size = H8300S_MSIZE;
+ else if (h8300hmode)
memory_size = H8300H_MSIZE;
else
memory_size = H8300_MSIZE;
@@ -778,6 +795,10 @@ control_c (sig, code, scp, addr)
#define Z (nz == 0)
#define V (v != 0)
#define N (n != 0)
+#define U (u != 0)
+#define H (h != 0)
+#define UI (ui != 0)
+#define I (intMaskBit != 0)
static int
mop (code, bsize, sign)
@@ -829,7 +850,7 @@ mop (code, bsize, sign)
}
#define ONOT(name, how) \
-case O(name, SB): \
+case O (name, SB): \
{ \
int t; \
int hm = 0x80; \
@@ -837,7 +858,7 @@ case O(name, SB): \
how; \
goto shift8; \
} \
-case O(name, SW): \
+case O (name, SW): \
{ \
int t; \
int hm = 0x8000; \
@@ -845,7 +866,7 @@ case O(name, SW): \
how; \
goto shift16; \
} \
-case O(name, SL): \
+case O (name, SL): \
{ \
int t; \
int hm = 0x80000000; \
@@ -855,7 +876,7 @@ case O(name, SL): \
}
#define OSHIFTS(name, how1, how2) \
-case O(name, SB): \
+case O (name, SB): \
{ \
int t; \
int hm = 0x80; \
@@ -870,7 +891,7 @@ case O(name, SB): \
} \
goto shift8; \
} \
-case O(name, SW): \
+case O (name, SW): \
{ \
int t; \
int hm = 0x8000; \
@@ -885,7 +906,7 @@ case O(name, SW): \
} \
goto shift16; \
} \
-case O(name, SL): \
+case O (name, SL): \
{ \
int t; \
int hm = 0x80000000; \
@@ -902,14 +923,14 @@ case O(name, SL): \
}
#define OBITOP(name,f, s, op) \
-case O(name, SB): \
+case O (name, SB): \
{ \
int m; \
int b; \
if (f) ea = fetch (&code->dst); \
- m=1<< fetch(&code->src); \
+ m=1<< fetch (&code->src); \
op; \
- if(s) store (&code->dst,ea); goto next; \
+ if (s) store (&code->dst,ea); goto next; \
}
int
@@ -921,6 +942,28 @@ sim_stop (sd)
return 1;
}
+#define R0_REGNUM 0
+#define R1_REGNUM 1
+#define R2_REGNUM 2
+#define R3_REGNUM 3
+#define R4_REGNUM 4
+#define R5_REGNUM 5
+#define R6_REGNUM 6
+#define R7_REGNUM 7
+
+#define SP_REGNUM R7_REGNUM /* Contains address of top of stack */
+#define FP_REGNUM R6_REGNUM /* Contains address of executing
+ * stack frame */
+
+#define CCR_REGNUM 8 /* Contains processor status */
+#define PC_REGNUM 9 /* Contains program counter */
+
+#define CYCLE_REGNUM 10
+
+#define EXR_REGNUM 11
+#define INST_REGNUM 12
+#define TICK_REGNUM 13
+
void
sim_resume (sd, step, siggnal)
SIM_DESC sd;
@@ -937,7 +980,8 @@ sim_resume (sd, step, siggnal)
int ea;
int bit;
int pc;
- int c, nz, v, n;
+ int c, nz, v, n, u, h, ui, intMaskBit;
+ int trace, intMask;
int oldmask;
init_pointers ();
@@ -961,6 +1005,8 @@ sim_resume (sd, step, siggnal)
abort ();
GETSR ();
+ GETEXR ();
+
oldmask = cpu.mask;
if (!h8300hmode)
cpu.mask = 0xffff;
@@ -975,15 +1021,15 @@ sim_resume (sd, step, siggnal)
#define ALUOP(STORE, NAME, HOW) \
- case O(NAME,SB): HOW; if(STORE)goto alu8;else goto just_flags_alu8; \
- case O(NAME, SW): HOW; if(STORE)goto alu16;else goto just_flags_alu16; \
- case O(NAME,SL): HOW; if(STORE)goto alu32;else goto just_flags_alu32;
+ case O (NAME,SB): HOW; if (STORE)goto alu8;else goto just_flags_alu8; \
+ case O (NAME, SW): HOW; if (STORE)goto alu16;else goto just_flags_alu16; \
+ case O (NAME,SL): HOW; if (STORE)goto alu32;else goto just_flags_alu32;
#define LOGOP(NAME, HOW) \
- case O(NAME,SB): HOW; goto log8;\
- case O(NAME, SW): HOW; goto log16;\
- case O(NAME,SL): HOW; goto log32;
+ case O (NAME,SB): HOW; goto log8;\
+ case O (NAME, SW): HOW; goto log16;\
+ case O (NAME,SL): HOW; goto log32;
@@ -997,8 +1043,12 @@ sim_resume (sd, step, siggnal)
#endif
- cycles += code->cycles;
- insts++;
+ if (code->opcode)
+ {
+ cycles += code->cycles;
+ insts++;
+ }
+
switch (code->opcode)
{
case 0:
@@ -1025,8 +1075,8 @@ sim_resume (sd, step, siggnal)
res = rd + ea;
goto alu8;
-#define EA ea = fetch(&code->src);
-#define RD_EA ea = fetch(&code->src); rd = fetch(&code->dst);
+#define EA ea = fetch (&code->src);
+#define RD_EA ea = fetch (&code->src); rd = fetch (&code->dst);
ALUOP (1, O_SUB, RD_EA;
ea = -ea;
@@ -1087,6 +1137,37 @@ sim_resume (sd, step, siggnal)
SET_L_REG (code->dst.reg, res);
goto just_flags_log32;
+ case O (O_EEPMOV, SB):
+ case O (O_EEPMOV, SW):
+ if (h8300hmode||h8300smode)
+ {
+ register unsigned char *_src,*_dst;
+ unsigned int count = (code->opcode == O(O_EEPMOV, SW))?cpu.regs[R4_REGNUM]&0xffff:
+ cpu.regs[R4_REGNUM]&0xff;
+
+ _src = cpu.regs[R5_REGNUM] < memory_size ? cpu.memory+cpu.regs[R5_REGNUM] :
+ cpu.eightbit + (cpu.regs[R5_REGNUM] & 0xff);
+ if ((_src+count)>=(cpu.memory+memory_size))
+ {
+ if ((_src+count)>=(cpu.eightbit+0x100))
+ goto illegal;
+ }
+ _dst = cpu.regs[R6_REGNUM] < memory_size ? cpu.memory+cpu.regs[R6_REGNUM] :
+ cpu.eightbit + (cpu.regs[R6_REGNUM] & 0xff);
+ if ((_dst+count)>=(cpu.memory+memory_size))
+ {
+ if ((_dst+count)>=(cpu.eightbit+0x100))
+ goto illegal;
+ }
+ memcpy(_dst,_src,count);
+
+ cpu.regs[R5_REGNUM]+=count;
+ cpu.regs[R6_REGNUM]+=count;
+ cpu.regs[R4_REGNUM]&=(code->opcode == O(O_EEPMOV, SW))?(~0xffff):(~0xff);
+ cycles += 2*count;
+ goto next;
+ }
+ goto illegal;
case O (O_ADDS, SL):
SET_L_REG (code->dst.reg,
@@ -1166,23 +1247,69 @@ sim_resume (sd, step, siggnal)
SET_L_REG (code->dst.reg, res);
goto just_flags_inc32;
-
#define GET_CCR(x) BUILDSR();x = cpu.ccr
+#define GET_EXR(x) BUILDEXR ();x = cpu.exr
+
+ case O (O_LDC, SB):
+ case O (O_LDC, SW):
+ res = fetch (&code->src);
+ goto setc;
+ case O (O_STC, SB):
+ case O (O_STC, SW):
+ if (code->src.type == OP_CCR)
+ {
+ GET_CCR (res);
+ }
+ else if (code->src.type == OP_EXR && h8300smode)
+ {
+ GET_EXR (res);
+ }
+ else
+ goto illegal;
+ store (&code->dst, res);
+ goto next;
case O (O_ANDC, SB):
- GET_CCR (rd);
+ if (code->dst.type == OP_CCR)
+ {
+ GET_CCR (rd);
+ }
+ else if (code->dst.type == OP_EXR && h8300smode)
+ {
+ GET_EXR (rd);
+ }
+ else
+ goto illegal;
ea = code->src.literal;
res = rd & ea;
goto setc;
case O (O_ORC, SB):
- GET_CCR (rd);
+ if (code->dst.type == OP_CCR)
+ {
+ GET_CCR (rd);
+ }
+ else if (code->dst.type == OP_EXR && h8300smode)
+ {
+ GET_EXR (rd);
+ }
+ else
+ goto illegal;
ea = code->src.literal;
res = rd | ea;
goto setc;
case O (O_XORC, SB):
- GET_CCR (rd);
+ if (code->dst.type == OP_CCR)
+ {
+ GET_CCR (rd);
+ }
+ else if (code->dst.type == OP_EXR && h8300smode)
+ {
+ GET_EXR (rd);
+ }
+ else
+ goto illegal;
ea = code->src.literal;
res = rd ^ ea;
goto setc;
@@ -1283,7 +1410,7 @@ sim_resume (sd, step, siggnal)
c = rd & (hm >> 1); v = (rd & (hm >> 1)) != ((rd & (hm >> 2)) << 2); rd <<= 2);
OSHIFTS (O_SHAR,
t = rd & hm; c = rd & 1; v = 0; rd >>= 1; rd |= t,
- t = rd & hm; c = rd & 2; v = 0; rd >>= 2; rd |= t | t >> 1 );
+ t = rd & hm; c = rd & 2; v = 0; rd >>= 2; rd |= t | t >> 1);
OSHIFTS (O_ROTL,
c = rd & hm; v = 0; rd <<= 1; rd |= C,
c = rd & hm; v = 0; rd <<= 1; rd |= C; c = rd & hm; rd <<= 1; rd |= C);
@@ -1362,7 +1489,7 @@ sim_resume (sd, step, siggnal)
the macros here instead of looking for .../sys/wait.h. */
#define SIM_WIFEXITED(v) (((v) & 0xff) == 0)
#define SIM_WIFSIGNALED(v) (((v) & 0x7f) > 0 && (((v) & 0x7f) < 0x7f))
- if (! SIM_WIFEXITED (cpu.regs[0]) && SIM_WIFSIGNALED (cpu.regs[0]))
+ if (! SIM_WIFEXITED (cpu.regs[0]) && SIM_WIFSIGNALED (cpu.regs[0]))
cpu.exception = SIGILL;
else
cpu.exception = SIGTRAP;
@@ -1375,7 +1502,7 @@ sim_resume (sd, step, siggnal)
OBITOP (O_BNOT, 1, 1, ea ^= m);
OBITOP (O_BTST, 1, 0, nz = ea & m);
OBITOP (O_BCLR, 1, 1, ea &= ~m);
- OBITOP (O_BSET, 1, 1, ea |= m);
+ OBITOP (O_BSET, 1, 1, ea |= m);
OBITOP (O_BLD, 1, 0, c = ea & m);
OBITOP (O_BILD, 1, 0, c = !(ea & m));
OBITOP (O_BST, 1, 1, ea &= ~m;
@@ -1406,6 +1533,22 @@ sim_resume (sd, step, siggnal)
MOP (0, 0);
break;
+ case O (O_TAS, SB):
+ if (!h8300smode || code->src.type != X (OP_REG, SL))
+ goto illegal;
+ switch (code->src.reg)
+ {
+ case R0_REGNUM:
+ case R1_REGNUM:
+ case R4_REGNUM:
+ case R5_REGNUM:
+ break;
+ default:
+ goto illegal;
+ }
+ res = fetch (&code->src);
+ store (&code->src,res|0x80);
+ goto just_flags_log8;
case O (O_DIVU, SB):
{
@@ -1529,6 +1672,7 @@ sim_resume (sd, step, siggnal)
goto next;
default:
+ illegal:
cpu.state = SIM_STATE_STOPPED;
cpu.exception = SIGILL;
goto end;
@@ -1537,8 +1681,19 @@ sim_resume (sd, step, siggnal)
abort ();
setc:
- cpu.ccr = res;
- GETSR ();
+ if (code->dst.type == OP_CCR)
+ {
+ cpu.ccr = res;
+ GETSR ();
+ }
+ else if (code->dst.type == OP_EXR && h8300smode)
+ {
+ cpu.exr = res;
+ GETEXR ();
+ }
+ else
+ goto illegal;
+
goto next;
condtrue:
@@ -1718,6 +1873,7 @@ sim_resume (sd, step, siggnal)
cpu.pc = pc;
BUILDSR ();
+ BUILDEXR ();
cpu.mask = oldmask;
signal (SIGINT, prev);
}
@@ -1773,27 +1929,6 @@ sim_read (sd, addr, buffer, size)
}
-#define R0_REGNUM 0
-#define R1_REGNUM 1
-#define R2_REGNUM 2
-#define R3_REGNUM 3
-#define R4_REGNUM 4
-#define R5_REGNUM 5
-#define R6_REGNUM 6
-#define R7_REGNUM 7
-
-#define SP_REGNUM R7_REGNUM /* Contains address of top of stack */
-#define FP_REGNUM R6_REGNUM /* Contains address of executing
- * stack frame */
-
-#define CCR_REGNUM 8 /* Contains processor status */
-#define PC_REGNUM 9 /* Contains program counter */
-
-#define CYCLE_REGNUM 10
-#define INST_REGNUM 11
-#define TICK_REGNUM 12
-
-
int
sim_store_register (sd, rn, value, length)
SIM_DESC sd;
@@ -1829,6 +1964,9 @@ sim_store_register (sd, rn, value, length)
case CCR_REGNUM:
cpu.ccr = intval;
break;
+ case EXR_REGNUM:
+ cpu.exr = intval;
+ break;
case CYCLE_REGNUM:
cpu.cycles = longval;
break;
@@ -1856,14 +1994,19 @@ sim_fetch_register (sd, rn, buf, length)
init_pointers ();
+ if (!h8300smode && rn >=EXR_REGNUM)
+ rn++;
switch (rn)
{
default:
abort ();
- case 8:
+ case CCR_REGNUM:
v = cpu.ccr;
break;
- case 9:
+ case EXR_REGNUM:
+ v = cpu.exr;
+ break;
+ case PC_REGNUM:
v = cpu.pc;
break;
case R0_REGNUM:
@@ -1876,15 +2019,15 @@ sim_fetch_register (sd, rn, buf, length)
case R7_REGNUM:
v = cpu.regs[rn];
break;
- case 10:
+ case CYCLE_REGNUM:
v = cpu.cycles;
longreg = 1;
break;
- case 11:
+ case TICK_REGNUM:
v = cpu.ticks;
longreg = 1;
break;
- case 12:
+ case INST_REGNUM:
v = cpu.insts;
longreg = 1;
break;
@@ -1998,13 +2141,14 @@ sim_info (sd, verbose)
FLAG is non-zero for the H8/300H. */
void
-set_h8300h (flag)
- int flag;
+set_h8300h (h_flag, s_flag)
+ int h_flag, s_flag;
{
/* FIXME: Much of the code in sim_load can be moved to sim_open.
This function being replaced by a sim_open:ARGV configuration
option. */
- h8300hmode = flag;
+ h8300hmode = h_flag;
+ h8300smode = s_flag;
}
SIM_DESC
@@ -2059,8 +2203,8 @@ sim_load (sd, prog, abfd, from_tty)
if (bfd_check_format (prog_bfd, bfd_object))
{
unsigned long mach = bfd_get_mach (prog_bfd);
- set_h8300h (mach == bfd_mach_h8300h
- || mach == bfd_mach_h8300s);
+ set_h8300h (mach == bfd_mach_h8300h || mach == bfd_mach_h8300s,
+ mach == bfd_mach_h8300s);
}
}
@@ -2078,7 +2222,10 @@ sim_load (sd, prog, abfd, from_tty)
so we just reallocate memory now; this will also allow us to handle
switching between H8/300 and H8/300H programs without exiting
gdb. */
- if (h8300hmode)
+
+ if (h8300smode)
+ memory_size = H8300S_MSIZE;
+ else if (h8300hmode)
memory_size = H8300H_MSIZE;
else
memory_size = H8300_MSIZE;
diff --git a/sim/h8300/inst.h b/sim/h8300/inst.h
index ce930c3a7fd..bcf8e4a6b33 100644
--- a/sim/h8300/inst.h
+++ b/sim/h8300/inst.h
@@ -15,7 +15,13 @@
can only happen when simulating H8/300H programs). We make no attempt
to catch overlapping addresses, wrapped addresses, etc etc. */
#define H8300_MSIZE (1<<16)
-#define H8300H_MSIZE (1<<18)
+
+/* avolkov:
+ Next 2 macros are ugly for any workstation, but while they're work.
+ Memory size MUST be configurable.
+ */
+#define H8300H_MSIZE (1<<18)
+#define H8300S_MSIZE (1<<24)
#define CSIZE 1000
@@ -26,6 +32,7 @@ typedef enum
R_ZERO,
R_PC,
R_CCR,
+ R_EXR,
R_HARD_0,
R_LAST,
} reg_type;
@@ -67,7 +74,7 @@ typedef struct
unsigned int regs[9];
int pc;
int ccr;
-
+ int exr;
unsigned char *memory;
unsigned char *eightbit;
diff --git a/sim/h8500/ChangeLog b/sim/h8500/ChangeLog
index af4f78470bb..eeb4d6ddc48 100644
--- a/sim/h8500/ChangeLog
+++ b/sim/h8500/ChangeLog
@@ -1,3 +1,7 @@
+2002-06-08 Andrew Cagney <cagney@redhat.com>
+
+ * compile.c: Include "gdb/callback.h" and "gdb/remote-sim.h".
+
Tue May 23 21:39:23 2000 Andrew Cagney <cagney@b1.cygnus.com>
* configure: Regenerated to track ../common/aclocal.m4 changes.
diff --git a/sim/h8500/compile.c b/sim/h8500/compile.c
index 1aad644fa8a..aec8ce97372 100644
--- a/sim/h8500/compile.c
+++ b/sim/h8500/compile.c
@@ -31,8 +31,8 @@
#include <setjmp.h>
#include "ansidecl.h"
#include "bfd.h"
-#include "callback.h"
-#include "remote-sim.h"
+#include "gdb/callback.h"
+#include "gdb/remote-sim.h"
#define O_RECOMPILE 85
#define DEFINE_TABLE
diff --git a/sim/igen/ChangeLog b/sim/igen/ChangeLog
index d5ba8abf638..f6cb513f650 100644
--- a/sim/igen/ChangeLog
+++ b/sim/igen/ChangeLog
@@ -1,3 +1,8 @@
+2002-06-03 Richard Henderson <rth@redhat.com>
+
+ * gen-engine.c (print_run_body): Avoid multi-line strings.
+ * lf.c (lf_print__gnu_copyleft): Likewise.
+
2002-05-01 Chris Demetriou <cgd@broadcom.com>
* igen.c: Use 'deprecated' rather than 'depreciated.'
diff --git a/sim/igen/gen-engine.c b/sim/igen/gen-engine.c
index 4b6861ed97e..ee27e680317 100644
--- a/sim/igen/gen-engine.c
+++ b/sim/igen/gen-engine.c
@@ -98,21 +98,21 @@ print_run_body (lf *file,
if (!options.gen.smp)
{
- lf_putstr (file, "
-/* CASE 1: NO SMP (with or with out instruction cache).
-
-In this case, we can take advantage of the fact that the current
-instruction address (CIA) does not need to be read from / written to
-the CPU object after the execution of an instruction.
-
-Instead, CIA is only saved when the main loop exits. This occures
-when either sim_engine_halt or sim_engine_restart is called. Both of
-these functions save the current instruction address before halting /
-restarting the simulator.
-
-As a variation, there may also be support for an instruction cracking
-cache. */
-
+ lf_putstr (file, "\
+/* CASE 1: NO SMP (with or with out instruction cache).\n\
+\n\
+In this case, we can take advantage of the fact that the current\n\
+instruction address (CIA) does not need to be read from / written to\n\
+the CPU object after the execution of an instruction.\n\
+\n\
+Instead, CIA is only saved when the main loop exits. This occures\n\
+when either sim_engine_halt or sim_engine_restart is called. Both of\n\
+these functions save the current instruction address before halting /\n\
+restarting the simulator.\n\
+\n\
+As a variation, there may also be support for an instruction cracking\n\
+cache. */\n\
+\n\
");
lf_putstr (file, "\n");
@@ -215,14 +215,14 @@ cache. */
if (options.gen.smp)
{
- lf_putstr (file, "
-/* CASE 2: SMP (With or without ICACHE)
-
-The complexity here comes from needing to correctly halt the simulator
-when it is aborted. For instance, if cpu0 requests a restart then
-cpu1 will normally be the next cpu that is run. Cpu0 being restarted
-after all the other CPU's and the event queue have been processed */
-
+ lf_putstr (file, "\
+/* CASE 2: SMP (With or without ICACHE)\n\
+\n\
+The complexity here comes from needing to correctly halt the simulator\n\
+when it is aborted. For instance, if cpu0 requests a restart then\n\
+cpu1 will normally be the next cpu that is run. Cpu0 being restarted\n\
+after all the other CPU's and the event queue have been processed */\n\
+\n\
");
lf_putstr (file, "\n");
diff --git a/sim/igen/lf.c b/sim/igen/lf.c
index 1b4a5f136ec..d2098585657 100644
--- a/sim/igen/lf.c
+++ b/sim/igen/lf.c
@@ -259,27 +259,27 @@ lf_print__gnu_copyleft (lf *file)
case lf_is_c:
case lf_is_h:
nr += lf_printf(file, "\
-/* This file is part of the program psim.
-
- Copyright (C) 1994-1997, Andrew Cagney <cagney@highland.com.au>
-
- 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 file was generated by the program %s */
+/* This file is part of the program psim.\n\
+\n\
+ Copyright (C) 1994-1997, Andrew Cagney <cagney@highland.com.au>\n\
+\n\
+ This program is free software; you can redistribute it and/or modify\n\
+ it under the terms of the GNU General Public License as published by\n\
+ the Free Software Foundation; either version 2 of the License, or\n\
+ (at your option) any later version.\n\
+\n\
+ This program is distributed in the hope that it will be useful,\n\
+ but WITHOUT ANY WARRANTY; without even the implied warranty of\n\
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\
+ GNU General Public License for more details.\n\
+ \n\
+ You should have received a copy of the GNU General Public License\n\
+ along with this program; if not, write to the Free Software\n\
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n\
+\n\
+ --\n\
+\n\
+ This file was generated by the program %s */\n\
", filter_filename(file->program));
break;
default:
diff --git a/sim/m68hc11/ChangeLog b/sim/m68hc11/ChangeLog
index 12734148c17..ee0cd2eac7a 100644
--- a/sim/m68hc11/ChangeLog
+++ b/sim/m68hc11/ChangeLog
@@ -1,3 +1,8 @@
+2002-06-09 Andrew Cagney <cagney@redhat.com>
+
+ * Makefile.in (INCLUDE): Update path to callback.h.
+ * sim-main.h: Include "gdb/callback.h" and "gdb/remote-sim.h".
+
2002-03-07 Stephane Carrez <Stephane.Carrez@worldnet.fr>
* m68hc11_sim.c (cpu_move8): Call sim_engine_abort in default case.
diff --git a/sim/m68hc11/Makefile.in b/sim/m68hc11/Makefile.in
index 51e873bbbeb..a054a329c7d 100644
--- a/sim/m68hc11/Makefile.in
+++ b/sim/m68hc11/Makefile.in
@@ -42,7 +42,7 @@ SIM_EXTRA_CLEAN = clean-extra
SIM_EXTRA_OBJS = @m68hc11_extra_objs@
-INCLUDE = $(srcdir)/../../include/callback.h \
+INCLUDE = $(srcdir)/../../include/gdb/callback.h \
interrupts.h sim-main.h
diff --git a/sim/m68hc11/sim-main.h b/sim/m68hc11/sim-main.h
index a47e7aa36e9..75c3b5b8451 100644
--- a/sim/m68hc11/sim-main.h
+++ b/sim/m68hc11/sim-main.h
@@ -36,8 +36,8 @@ typedef address_word sim_cia;
#include "opcode/m68hc11.h"
-#include "callback.h"
-#include "remote-sim.h"
+#include "gdb/callback.h"
+#include "gdb/remote-sim.h"
#include "opcode/m68hc11.h"
#include "sim-types.h"
diff --git a/sim/mcore/ChangeLog b/sim/mcore/ChangeLog
index a5e5ef97c94..066f0f3bedb 100644
--- a/sim/mcore/ChangeLog
+++ b/sim/mcore/ChangeLog
@@ -1,3 +1,7 @@
+2002-06-08 Andrew Cagney <cagney@redhat.com>
+
+ * interp.c: Include "gdb/callback.h" and "gdb/remote-sim.h".
+
Tue May 23 21:39:23 2000 Andrew Cagney <cagney@b1.cygnus.com>
* configure: Regenerated to track ../common/aclocal.m4 changes.
diff --git a/sim/mcore/interp.c b/sim/mcore/interp.c
index 456e4811cd4..79c7d2ede0b 100644
--- a/sim/mcore/interp.c
+++ b/sim/mcore/interp.c
@@ -24,9 +24,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <sys/param.h>
#include <netinet/in.h> /* for byte ordering macros */
#include "bfd.h"
-#include "callback.h"
+#include "gdb/callback.h"
#include "libiberty.h"
-#include "remote-sim.h"
+#include "gdb/remote-sim.h"
#ifndef NUM_ELEM
#define NUM_ELEM(A) (sizeof (A) / sizeof (A)[0])
diff --git a/sim/mips/ChangeLog b/sim/mips/ChangeLog
index 388753966c5..d08971d8d77 100644
--- a/sim/mips/ChangeLog
+++ b/sim/mips/ChangeLog
@@ -1,3 +1,241 @@
+2002-06-14 Chris Demetriou <cgd@broadcom.com>
+ Ed Satterthwaite <ehs@broadcom.com>
+
+ * mips3d.igen: New file which contains MIPS-3D ASE instructions.
+ * Makefile.in (IGEN_INCLUDE): Add mips3d.igen.
+ * mips.igen: Include mips3d.igen.
+ (mips3d): New model name for MIPS-3D ASE instructions.
+ (CVT.W.fmt): Don't use this instruction for word (source) format
+ instructions.
+ * cp1.c (fp_binary_r, fp_add_r, fp_mul_r, fpu_inv1, fpu_inv1_32)
+ (fpu_inv1_64, fp_recip1, fp_recip2, fpu_inv_sqrt1, fpu_inv_sqrt1_32)
+ (fpu_inv_sqrt1_64, fp_rsqrt1, fp_rsqrt2): New functions.
+ (NR_FRAC_GUARD, IMPLICIT_1): New macros.
+ * sim-main.h (fmt_pw, CompareAbs, AddR, MultiplyR, Recip1, Recip2)
+ (RSquareRoot1, RSquareRoot2): New macros.
+ (fp_add_r, fp_mul_r, fp_recip1, fp_recip2, fp_rsqrt1)
+ (fp_rsqrt2): New functions.
+ * configure.in: Add MIPS-3D support to mipsisa64 simulator.
+ * configure: Regenerate.
+
+2002-06-13 Chris Demetriou <cgd@broadcom.com>
+ Ed Satterthwaite <ehs@broadcom.com>
+
+ * cp1.c (FP_PS_upper, FP_PS_lower, FP_PS_cat, FPQNaN_PS): New macros.
+ (value_fpr, store_fpr, fp_cmp, fp_unary, fp_binary, fp_mac)
+ (fp_inv_sqrt, fpu_format_name): Add paired-single support.
+ (convert): Note that this function is not used for paired-single
+ format conversions.
+ (ps_lower, ps_upper, pack_ps, convert_ps): New functions.
+ * mips.igen (FMT, MOVtf.fmt): Add paired-single support.
+ (check_fmt_p): Enable paired-single support.
+ (ALNV.PS, CVT.PS.S, CVT.S.PL, CVT.S.PU, PLL.PS, PLU.PS, PUL.PS)
+ (PUU.PS): New instructions.
+ (CVT.S.fmt): Don't use this instruction for paired-single format
+ destinations.
+ * sim-main.h (FP_formats): New value 'fmt_ps.'
+ (ps_lower, ps_upper, pack_ps, convert_ps): New prototypes.
+ (PSLower, PSUpper, PackPS, ConvertPS): New macros.
+
+2002-06-12 Chris Demetriou <cgd@broadcom.com>
+
+ * mips.igen: Fix formatting of function calls in
+ many FP operations.
+
+2002-06-12 Chris Demetriou <cgd@broadcom.com>
+
+ * mips.igen (MOVN, MOVZ): Trace result.
+ (TNEI): Print "tnei" as the opcode name in traces.
+ (CEIL.W): Add disassembly string for traces.
+ (RSQRT.fmt): Make location of disassembly string consistent
+ with other instructions.
+
+2002-06-12 Chris Demetriou <cgd@broadcom.com>
+
+ * mips.igen (X): Delete unused function.
+
+2002-06-08 Andrew Cagney <cagney@redhat.com>
+
+ * interp.c: Include "gdb/callback.h" and "gdb/remote-sim.h".
+
+2002-06-07 Chris Demetriou <cgd@broadcom.com>
+ Ed Satterthwaite <ehs@broadcom.com>
+
+ * cp1.c (inner_mac, fp_mac, inner_rsqrt, fp_inv_sqrt)
+ (fp_rsqrt, fp_madd, fp_msub, fp_nmadd, fp_nmsub): New functions.
+ * sim-main.h (fp_rsqrt, fp_madd, fp_msub, fp_nmadd)
+ (fp_nmsub): New prototypes.
+ (RSquareRoot, MultiplyAdd, MultiplySub, NegMultiplyAdd)
+ (NegMultiplySub): New defines.
+ * mips.igen (RSQRT.fmt): Use RSquareRoot().
+ (MADD.D, MADD.S): Replace with...
+ (MADD.fmt): New instruction.
+ (MSUB.D, MSUB.S): Replace with...
+ (MSUB.fmt): New instruction.
+ (NMADD.D, NMADD.S): Replace with...
+ (NMADD.fmt): New instruction.
+ (NMSUB.D, MSUB.S): Replace with...
+ (NMSUB.fmt): New instruction.
+
+2002-06-07 Chris Demetriou <cgd@broadcom.com>
+ Ed Satterthwaite <ehs@broadcom.com>
+
+ * cp1.c: Fix more comment spelling and formatting.
+ (value_fcr, store_fcr): Use fenr_FS rather than hard-coding value.
+ (denorm_mode): New function.
+ (fpu_unary, fpu_binary): Round results after operation, collect
+ status from rounding operations, and update the FCSR.
+ (convert): Collect status from integer conversions and rounding
+ operations, and update the FCSR. Adjust NaN values that result
+ from conversions. Convert to use sim_io_eprintf rather than
+ fprintf, and remove some debugging code.
+ * cp1.h (fenr_FS): New define.
+
+2002-06-07 Chris Demetriou <cgd@broadcom.com>
+
+ * cp1.c (convert): Remove unusable debugging code, and move MIPS
+ rounding mode to sim FP rounding mode flag conversion code into...
+ (rounding_mode): New function.
+
+2002-06-07 Chris Demetriou <cgd@broadcom.com>
+
+ * cp1.c: Clean up formatting of a few comments.
+ (value_fpr): Reformat switch statement.
+
+2002-06-06 Chris Demetriou <cgd@broadcom.com>
+ Ed Satterthwaite <ehs@broadcom.com>
+
+ * cp1.h: New file.
+ * sim-main.h: Include cp1.h.
+ (SETFCC, GETFCC, IR, UF, OF, DX, IO, UO, FP_FLAGS, FP_ENABLE)
+ (FP_CAUSE, GETFS, FP_RM_NEAREST, FP_RM_TOZERO, FP_RM_TOPINF)
+ (FP_RM_TOMINF, GETRM): Remove. Moved to cp1.h.
+ (FP_FS, FP_MASK_RM, FP_SH_RM, Nan, Less, Equal): Remove.
+ (value_fcr, store_fcr, test_fcsr, fp_cmp): New prototypes.
+ (ValueFCR, StoreFCR, TestFCSR, Compare): New macros.
+ * cp1.c: Don't include sim-fpu.h; already included by
+ sim-main.h. Clean up formatting of some comments.
+ (NaN, Equal, Less): Remove.
+ (test_fcsr, value_fcr, store_fcr, update_fcsr, fp_test)
+ (fp_cmp): New functions.
+ * mips.igen (do_c_cond_fmt): Remove.
+ (C.cond.fmta, C.cond.fmtb): Replace uses of do_c_cond_fmt_a with
+ Compare. Add result tracing.
+ (CxC1): Remove, replace with...
+ (CFC1a, CFC1b, CFC1c, CTC1a, CTC1b, CTC1c): New instructions.
+ (DMxC1): Remove, replace with...
+ (DMFC1a, DMFC1b, DMTC1a, DMTC1b): New instructions.
+ (MxC1): Remove, replace with...
+ (MFC1a, MFC1b, MTC1a, MTC1b): New instructions.
+
+2002-06-04 Chris Demetriou <cgd@broadcom.com>
+
+ * sim-main.h (FGRIDX): Remove, replace all uses with...
+ (FGR_BASE): New macro.
+ (FP0_REGNUM, FCRCS_REGNUM, FCRIR_REGNUM): New macros.
+ (_sim_cpu): Move 'fgr' member to be right before 'fpr_state' member.
+ (NR_FGR, FGR): Likewise.
+ * interp.c: Replace all uses of FGRIDX with FGR_BASE.
+ * mips.igen: Likewise.
+
+2002-06-04 Chris Demetriou <cgd@broadcom.com>
+
+ * cp1.c: Add an FSF Copyright notice to this file.
+
+2002-06-04 Chris Demetriou <cgd@broadcom.com>
+ Ed Satterthwaite <ehs@broadcom.com>
+
+ * cp1.c (Infinity): Remove.
+ * sim-main.h (Infinity): Likewise.
+
+ * cp1.c (fp_unary, fp_binary): New functions.
+ (fp_abs, fp_neg, fp_add, fp_sub, fp_mul, fp_div, fp_recip)
+ (fp_sqrt): New functions, implemented in terms of the above.
+ (AbsoluteValue, Negate, Add, Sub, Multiply, Divide)
+ (Recip, SquareRoot): Remove (replaced by functions above).
+ * sim-main.h (fp_abs, fp_neg, fp_add, fp_sub, fp_mul, fp_div)
+ (fp_recip, fp_sqrt): New prototypes.
+ (AbsoluteValue, Negate, Add, Sub, Multiply, Divide)
+ (Recip, SquareRoot): Replace prototypes with #defines which
+ invoke the functions above.
+
+2002-06-03 Chris Demetriou <cgd@broadcom.com>
+
+ * sim-main.h (Nan, Infinity, Less, Equal, AbsoluteValue, Negate)
+ (Add, Sub, Multiply, Divide, Recip, SquareRoot): Move lower in
+ file, remove PARAMS from prototypes.
+ (value_fpr, store_fpr, convert): Likewise. Use SIM_STATE to provide
+ simulator state arguments.
+ (ValueFPR, StoreFPR, Convert): Move lower in file. Use SIM_ARGS to
+ pass simulator state arguments.
+ * cp1.c (SD): Redefine as CPU_STATE(cpu).
+ (store_fpr, convert): Remove 'sd' argument.
+ (value_fpr): Likewise. Convert to use 'SD' instead.
+
+2002-06-03 Chris Demetriou <cgd@broadcom.com>
+
+ * cp1.c (Min, Max): Remove #if 0'd functions.
+ * sim-main.h (Min, Max): Remove.
+
+2002-06-03 Chris Demetriou <cgd@broadcom.com>
+
+ * cp1.c: fix formatting of switch case and default labels.
+ * interp.c: Likewise.
+ * sim-main.c: Likewise.
+
+2002-06-03 Chris Demetriou <cgd@broadcom.com>
+
+ * cp1.c: Clean up comments which describe FP formats.
+ (FPQNaN_DOUBLE, FPQNaN_LONG): Generate using UNSIGNED64.
+
+2002-06-03 Chris Demetriou <cgd@broadcom.com>
+ Ed Satterthwaite <ehs@broadcom.com>
+
+ * configure.in (mipsisa64sb1*-*-*): New target for supporting
+ Broadcom SiByte SB-1 processor configurations.
+ * configure: Regenerate.
+ * sb1.igen: New file.
+ * mips.igen: Include sb1.igen.
+ (sb1): New model.
+ * Makefile.in (IGEN_INCLUDE): Add sb1.igen.
+ * mdmx.igen: Add "sb1" model to all appropriate functions and
+ instructions.
+ * mdmx.c (AbsDiffOB, AvgOB, AccAbsDiffOB): New functions.
+ (ob_func, ob_acc): Reference the above.
+ (qh_acc): Adjust to keep the same size as ob_acc.
+ * sim-main.h (status_SBX, MX_VECT_ABSD, MX_VECT_AVG, MX_AbsDiff)
+ (MX_Avg, MX_VECT_ABSDA, MX_AbsDiffC): New macros.
+
+2002-06-03 Chris Demetriou <cgd@broadcom.com>
+
+ * Makefile.in (IGEN_INCLUDE): Add mdmx.igen.
+
+2002-06-02 Chris Demetriou <cgd@broadcom.com>
+ Ed Satterthwaite <ehs@broadcom.com>
+
+ * mips.igen (mdmx): New (pseudo-)model.
+ * mdmx.c, mdmx.igen: New files.
+ * Makefile.in (SIM_OBJS): Add mdmx.o.
+ * sim-main.h (MDMX_accumulator, MX_fmtsel, signed24, signed48):
+ New typedefs.
+ (ACC, MX_Add, MX_AddA, MX_AddL, MX_And, MX_C_EQ, MX_C_LT, MX_Comp)
+ (MX_FMT_OB, MX_FMT_QH, MX_Max, MX_Min, MX_Msgn, MX_Mul, MX_MulA)
+ (MX_MulL, MX_MulS, MX_MulSL, MX_Nor, MX_Or, MX_Pick, MX_RAC)
+ (MX_RAC_H, MX_RAC_L, MX_RAC_M, MX_RNAS, MX_RNAU, MX_RND_AS)
+ (MX_RND_AU, MX_RND_ES, MX_RND_EU, MX_RND_ZS, MX_RND_ZU, MX_RNES)
+ (MX_RNEU, MX_RZS, MX_RZU, MX_SHFL, MX_ShiftLeftLogical)
+ (MX_ShiftRightArith, MX_ShiftRightLogical, MX_Sub, MX_SubA, MX_SubL)
+ (MX_VECT_ADD, MX_VECT_ADDA, MX_VECT_ADDL, MX_VECT_AND)
+ (MX_VECT_MAX, MX_VECT_MIN, MX_VECT_MSGN, MX_VECT_MUL, MX_VECT_MULA)
+ (MX_VECT_MULL, MX_VECT_MULS, MX_VECT_MULSL, MX_VECT_NOR)
+ (MX_VECT_OR, MX_VECT_SLL, MX_VECT_SRA, MX_VECT_SRL, MX_VECT_SUB)
+ (MX_VECT_SUBA, MX_VECT_SUBL, MX_VECT_XOR, MX_WACH, MX_WACL, MX_Xor)
+ (SIM_ARGS, SIM_STATE, UnpredictableResult, fmt_mdmx, ob_fmtsel)
+ (qh_fmtsel): New macros.
+ (_sim_cpu): New member "acc".
+ (mdmx_acc_op, mdmx_cc_op, mdmx_cpr_op, mdmx_pick_op, mdmx_rac_op)
+ (mdmx_round_op, mdmx_shuffle, mdmx_wach, mdmx_wacl): New functions.
+
2002-05-01 Chris Demetriou <cgd@broadcom.com>
* interp.c: Use 'deprecated' rather than 'depreciated.'
diff --git a/sim/mips/Makefile.in b/sim/mips/Makefile.in
index 5d0a3364e8f..e0e9fafcafe 100644
--- a/sim/mips/Makefile.in
+++ b/sim/mips/Makefile.in
@@ -43,6 +43,7 @@ SIM_OBJS = \
$(MIPS_EXTRA_OBJS) \
cp1.o \
interp.o \
+ mdmx.o \
sim-main.o \
sim-hload.o \
sim-engine.o \
@@ -71,6 +72,7 @@ SIM_RUN_OBJS = nrun.o
interp.o: $(srcdir)/interp.c config.h sim-main.h itable.h
cp1.o: $(srcdir)/cp1.c config.h sim-main.h
+mdmx.o: $(srcdir)/mdmx.c $(srcdir)/sim-main.h
../igen/igen:
cd ../igen && $(MAKE)
@@ -81,6 +83,9 @@ IGEN_DC=$(srcdir)/mips.dc
M16_DC=$(srcdir)/m16.dc
IGEN_INCLUDE=\
$(srcdir)/m16.igen \
+ $(srcdir)/mdmx.igen \
+ $(srcdir)/mips3d.igen \
+ $(srcdir)/sb1.igen \
$(srcdir)/tx.igen \
$(srcdir)/vr.igen \
diff --git a/sim/mips/configure b/sim/mips/configure
index e5f427e10f7..859757a12af 100755
--- a/sim/mips/configure
+++ b/sim/mips/configure
@@ -4023,8 +4023,12 @@ case "${target}" in
sim_igen_machine="-M mips32"
sim_igen_filter="32,f"
;;
+ mipsisa64sb1*-*-*) sim_gen=IGEN
+ sim_igen_machine="-M mips64,sb1"
+ sim_igen_filter="32,64,f"
+ ;;
mipsisa64*-*-*) sim_gen=IGEN
- sim_igen_machine="-M mips64"
+ sim_igen_machine="-M mips64,mips3d"
sim_igen_filter="32,64,f"
;;
mips*lsi*) sim_gen=M16
@@ -4132,7 +4136,7 @@ esac
# 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:4136: checking for X" >&5
+echo "configure:4140: checking for X" >&5
# Check whether --with-x or --without-x was given.
if test "${with_x+set}" = set; then
@@ -4194,12 +4198,12 @@ if test "$ac_x_includes" = NO; then
# First, try using that file with no special directory specified.
cat > conftest.$ac_ext <<EOF
-#line 4198 "configure"
+#line 4202 "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:4203: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4207: \"$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*
@@ -4268,14 +4272,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 4272 "configure"
+#line 4276 "configure"
#include "confdefs.h"
int main() {
${x_direct_test_function}()
; return 0; }
EOF
-if { (eval echo configure:4279: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4283: \"$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.
@@ -4368,17 +4372,17 @@ for ac_hdr in string.h strings.h stdlib.h stdlib.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4372: checking for $ac_hdr" >&5
+echo "configure:4376: 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 4377 "configure"
+#line 4381 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4382: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4386: \"$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*
@@ -4405,7 +4409,7 @@ fi
done
echo $ac_n "checking for fabs in -lm""... $ac_c" 1>&6
-echo "configure:4409: checking for fabs in -lm" >&5
+echo "configure:4413: checking for fabs in -lm" >&5
ac_lib_var=`echo m'_'fabs | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -4413,7 +4417,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lm $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 4417 "configure"
+#line 4421 "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
@@ -4424,7 +4428,7 @@ int main() {
fabs()
; return 0; }
EOF
-if { (eval echo configure:4428: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4432: \"$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
@@ -4454,12 +4458,12 @@ fi
for ac_func in aint anint sqrt
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4458: checking for $ac_func" >&5
+echo "configure:4462: 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 4463 "configure"
+#line 4467 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -4482,7 +4486,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:4486: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4490: \"$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/sim/mips/configure.in b/sim/mips/configure.in
index d8c40232695..3672b66e73a 100644
--- a/sim/mips/configure.in
+++ b/sim/mips/configure.in
@@ -128,8 +128,12 @@ case "${target}" in
sim_igen_machine="-M mips32"
sim_igen_filter="32,f"
;;
+ mipsisa64sb1*-*-*) sim_gen=IGEN
+ sim_igen_machine="-M mips64,sb1"
+ sim_igen_filter="32,64,f"
+ ;;
mipsisa64*-*-*) sim_gen=IGEN
- sim_igen_machine="-M mips64"
+ sim_igen_machine="-M mips64,mips3d"
sim_igen_filter="32,64,f"
;;
mips*lsi*) sim_gen=M16
diff --git a/sim/mips/cp1.c b/sim/mips/cp1.c
index 063c241c277..26249f00bfe 100644
--- a/sim/mips/cp1.c
+++ b/sim/mips/cp1.c
@@ -1,9 +1,33 @@
/*> cp1.c <*/
+/* MIPS Simulator FPU (CoProcessor 1) support.
+ Copyright (C) 2002 Free Software Foundation, Inc.
+ Originally created by Cygnus Solutions, modified substially
+ by Broadcom Corporation (SiByte). Paired-single operation support
+ and MIPS-3D support contributed by Broadcom Corporation (SiByte).
+
+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 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. */
+
+/* XXX: The following notice should be removed as soon as is practical: */
/* Floating Point Support for gdb MIPS simulators
This file is part of the MIPS sim
THIS SOFTWARE IS NOT COPYRIGHTED
+ (by Cygnus.)
Cygnus offers the following for use in the public domain. Cygnus
makes no warranty with regard to the software or it's performance
@@ -17,44 +41,59 @@
*/
#include "sim-main.h"
-#include "sim-fpu.h"
/* Within cp1.c we refer to sim_cpu directly. */
#define CPU cpu
-#define SD sd
+#define SD CPU_STATE(cpu)
/*-- FPU support routines ---------------------------------------------------*/
/* Numbers are held in normalized form. The SINGLE and DOUBLE binary
- formats conform to ANSI/IEEE Std 754-1985. */
-/* SINGLE precision floating:
- * seeeeeeeefffffffffffffffffffffff
- * s = 1bit = sign
- * e = 8bits = exponent
- * f = 23bits = fraction
- */
-/* SINGLE precision fixed:
- * siiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
- * s = 1bit = sign
- * i = 31bits = integer
- */
-/* DOUBLE precision floating:
- * seeeeeeeeeeeffffffffffffffffffffffffffffffffffffffffffffffffffff
- * s = 1bit = sign
- * e = 11bits = exponent
- * f = 52bits = fraction
- */
-/* DOUBLE precision fixed:
- * siiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
- * s = 1bit = sign
- * i = 63bits = integer
+ formats conform to ANSI/IEEE Std 754-1985.
+
+ SINGLE precision floating:
+ seeeeeeeefffffffffffffffffffffff
+ s = 1bit = sign
+ e = 8bits = exponent
+ f = 23bits = fraction
+
+ SINGLE precision fixed:
+ siiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
+ s = 1bit = sign
+ i = 31bits = integer
+
+ DOUBLE precision floating:
+ seeeeeeeeeeeffffffffffffffffffffffffffffffffffffffffffffffffffff
+ s = 1bit = sign
+ e = 11bits = exponent
+ f = 52bits = fraction
+
+ DOUBLE precision fixed:
+ siiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
+ s = 1bit = sign
+ i = 63bits = integer
+
+ PAIRED SINGLE precision floating:
+ seeeeeeeefffffffffffffffffffffffseeeeeeeefffffffffffffffffffffff
+ | upper || lower |
+ s = 1bit = sign
+ e = 8bits = exponent
+ f = 23bits = fraction
+ Note: upper = [63..32], lower = [31..0]
*/
-/* Explicit QNaN values used when value required: */
+/* Extract packed single values: */
+#define FP_PS_upper(v) (((v) >> 32) & (unsigned)0xFFFFFFFF)
+#define FP_PS_lower(v) ((v) & (unsigned)0xFFFFFFFF)
+#define FP_PS_cat(u,l) (((unsigned64)((u) & (unsigned)0xFFFFFFFF) << 32) \
+ | (unsigned64)((l) & 0xFFFFFFFF))
+
+/* Explicit QNaN values. */
#define FPQNaN_SINGLE (0x7FBFFFFF)
#define FPQNaN_WORD (0x7FFFFFFF)
-#define FPQNaN_DOUBLE ((((uword64) 0x7FF7FFFF) << 32) | 0xFFFFFFFF)
-#define FPQNaN_LONG ((((uword64) 0x7FFFFFFF) << 32) | 0xFFFFFFFF)
+#define FPQNaN_DOUBLE (UNSIGNED64 (0x7FF7FFFFFFFFFFFF))
+#define FPQNaN_LONG (UNSIGNED64 (0x7FFFFFFFFFFFFFFF))
+#define FPQNaN_PS (FP_PS_cat (FPQNaN_SINGLE, FPQNaN_SINGLE))
static const char *fpu_format_name (FP_formats fmt);
#ifdef DEBUG
@@ -62,8 +101,7 @@ static const char *fpu_rounding_mode_name (int rm);
#endif
uword64
-value_fpr (SIM_DESC sd,
- sim_cpu *cpu,
+value_fpr (sim_cpu *cpu,
address_word cia,
int fpr,
FP_formats fmt)
@@ -71,7 +109,7 @@ value_fpr (SIM_DESC sd,
uword64 value = 0;
int err = 0;
- /* Treat unused register values, as fixed-point 64bit values: */
+ /* Treat unused register values, as fixed-point 64bit values. */
if ((fmt == fmt_uninterpreted) || (fmt == fmt_unknown))
{
#if 1
@@ -83,7 +121,7 @@ value_fpr (SIM_DESC sd,
#endif
}
- /* For values not yet accessed, set to the desired format: */
+ /* For values not yet accessed, set to the desired format. */
if (FPR_STATE[fpr] == fmt_uninterpreted)
{
FPR_STATE[fpr] = fmt;
@@ -94,7 +132,7 @@ value_fpr (SIM_DESC sd,
}
if (fmt != FPR_STATE[fpr])
{
- sim_io_eprintf (sd, "FPR %d (format %s) being accessed with format %s - setting to unknown (PC = 0x%s)\n",
+ sim_io_eprintf (SD, "FPR %d (format %s) being accessed with format %s - setting to unknown (PC = 0x%s)\n",
fpr, fpu_format_name (FPR_STATE[fpr]),
fpu_format_name (fmt), pr_addr (cia));
FPR_STATE[fpr] = fmt_unknown;
@@ -105,25 +143,12 @@ value_fpr (SIM_DESC sd,
/* Set QNaN value: */
switch (fmt)
{
- case fmt_single:
- value = FPQNaN_SINGLE;
- break;
-
- case fmt_double:
- value = FPQNaN_DOUBLE;
- break;
-
- case fmt_word:
- value = FPQNaN_WORD;
- break;
-
- case fmt_long:
- value = FPQNaN_LONG;
- break;
-
- default:
- err = -1;
- break;
+ case fmt_single: value = FPQNaN_SINGLE; break;
+ case fmt_double: value = FPQNaN_DOUBLE; break;
+ case fmt_word: value = FPQNaN_WORD; break;
+ case fmt_long: value = FPQNaN_LONG; break;
+ case fmt_ps: value = FPQNaN_PS; break;
+ default: err = -1; break;
}
}
else if (SizeFGR () == 64)
@@ -138,6 +163,7 @@ value_fpr (SIM_DESC sd,
case fmt_uninterpreted:
case fmt_double:
case fmt_long:
+ case fmt_ps:
value = FGR[fpr];
break;
@@ -160,7 +186,7 @@ value_fpr (SIM_DESC sd,
case fmt_long:
if ((fpr & 1) == 0)
{
- /* even registers only */
+ /* Even register numbers only. */
#ifdef DEBUG
printf ("DBG: ValueFPR: FGR[%d] = %s, FGR[%d] = %s\n",
fpr + 1, pr_uword64 ((uword64) FGR[fpr+1]),
@@ -175,7 +201,11 @@ value_fpr (SIM_DESC sd,
}
break;
- default :
+ case fmt_ps:
+ SignalException (ReservedInstruction, 0);
+ break;
+
+ default:
err = -1;
break;
}
@@ -194,8 +224,7 @@ value_fpr (SIM_DESC sd,
}
void
-store_fpr (SIM_DESC sd,
- sim_cpu *cpu,
+store_fpr (sim_cpu *cpu,
address_word cia,
int fpr,
FP_formats fmt,
@@ -215,8 +244,8 @@ store_fpr (SIM_DESC sd,
{
case fmt_uninterpreted_32:
fmt = fmt_uninterpreted;
- case fmt_single :
- case fmt_word :
+ case fmt_single:
+ case fmt_word:
if (STATE_VERBOSE_P (SD))
sim_io_eprintf (SD,
"Warning: PC 0x%s: interp.c store_fpr DEADCODE\n",
@@ -228,13 +257,14 @@ store_fpr (SIM_DESC sd,
case fmt_uninterpreted_64:
fmt = fmt_uninterpreted;
case fmt_uninterpreted:
- case fmt_double :
- case fmt_long :
+ case fmt_double:
+ case fmt_long:
+ case fmt_ps:
FGR[fpr] = value;
FPR_STATE[fpr] = fmt;
break;
- default :
+ default:
FPR_STATE[fpr] = fmt_unknown;
err = -1;
break;
@@ -246,8 +276,8 @@ store_fpr (SIM_DESC sd,
{
case fmt_uninterpreted_32:
fmt = fmt_uninterpreted;
- case fmt_single :
- case fmt_word :
+ case fmt_single:
+ case fmt_word:
FGR[fpr] = (value & 0xFFFFFFFF);
FPR_STATE[fpr] = fmt;
break;
@@ -255,11 +285,11 @@ store_fpr (SIM_DESC sd,
case fmt_uninterpreted_64:
fmt = fmt_uninterpreted;
case fmt_uninterpreted:
- case fmt_double :
- case fmt_long :
+ case fmt_double:
+ case fmt_long:
if ((fpr & 1) == 0)
{
- /* even register number only */
+ /* Even register numbers only. */
FGR[fpr+1] = (value >> 32);
FGR[fpr] = (value & 0xFFFFFFFF);
FPR_STATE[fpr + 1] = fmt;
@@ -273,7 +303,12 @@ store_fpr (SIM_DESC sd,
}
break;
- default :
+ case fmt_ps:
+ FPR_STATE[fpr] = fmt_unknown;
+ SignalException (ReservedInstruction, 0);
+ break;
+
+ default:
FPR_STATE[fpr] = fmt_unknown;
err = -1;
break;
@@ -291,168 +326,216 @@ store_fpr (SIM_DESC sd,
return;
}
-int
-NaN (op, fmt)
- uword64 op;
- FP_formats fmt;
+
+/* CP1 control/status register access functions. */
+
+void
+test_fcsr (sim_cpu *cpu,
+ address_word cia)
{
- int boolean = 0;
- switch (fmt)
+ unsigned int cause;
+
+ cause = (FCSR & fcsr_CAUSE_mask) >> fcsr_CAUSE_shift;
+ if ((cause & ((FCSR & fcsr_ENABLES_mask) >> fcsr_ENABLES_shift)) != 0
+ || (cause & (1 << UO)))
{
- case fmt_single:
- case fmt_word:
- {
- sim_fpu wop;
- sim_fpu_32to (&wop, op);
- boolean = sim_fpu_is_nan (&wop);
- break;
- }
- case fmt_double:
- case fmt_long:
- {
- sim_fpu wop;
- sim_fpu_64to (&wop, op);
- boolean = sim_fpu_is_nan (&wop);
- break;
- }
- default:
- fprintf (stderr, "Bad switch\n");
- abort ();
+ SignalExceptionFPE();
}
-
-#ifdef DEBUG
- printf ("DBG: NaN: returning %d for 0x%s (format = %s)\n",
- boolean, pr_addr (op), fpu_format_name (fmt));
-#endif /* DEBUG */
-
- return (boolean);
}
-int
-Infinity (op, fmt)
- uword64 op;
- FP_formats fmt;
+unsigned_word
+value_fcr(sim_cpu *cpu,
+ address_word cia,
+ int fcr)
{
- int boolean = 0;
+ unsigned32 value = 0;
-#ifdef DEBUG
- printf ("DBG: Infinity: format %s 0x%s\n",
- fpu_format_name (fmt), pr_addr (op));
-#endif /* DEBUG */
-
- switch (fmt)
+ switch (fcr)
{
- case fmt_single:
- {
- sim_fpu wop;
- sim_fpu_32to (&wop, op);
- boolean = sim_fpu_is_infinity (&wop);
- break;
- }
- case fmt_double:
- {
- sim_fpu wop;
- sim_fpu_64to (&wop, op);
- boolean = sim_fpu_is_infinity (&wop);
- break;
- }
- default:
- printf ("DBG: TODO: unrecognised format (%s) for Infinity check\n",
- fpu_format_name (fmt));
+ case 0: /* FP Implementation and Revision Register. */
+ value = FCR0;
+ break;
+ case 25: /* FP Condition Codes Register (derived from FCSR). */
+ value = (FCR31 & fcsr_FCC_mask) >> fcsr_FCC_shift;
+ value = (value & 0x1) | (value >> 1); /* Close FCC gap. */
+ break;
+ case 26: /* FP Exceptions Register (derived from FCSR). */
+ value = FCR31 & (fcsr_CAUSE_mask | fcsr_FLAGS_mask);
+ break;
+ case 28: /* FP Enables Register (derived from FCSR). */
+ value = FCR31 & (fcsr_ENABLES_mask | fcsr_RM_mask);
+ if ((FCR31 & fcsr_FS) != 0)
+ value |= fenr_FS;
+ break;
+ case 31: /* FP Control/Status Register (FCSR). */
+ value = FCR31 & ~fcsr_ZERO_mask;
break;
}
-#ifdef DEBUG
- printf ("DBG: Infinity: returning %d for 0x%s (format = %s)\n",
- boolean, pr_addr (op), fpu_format_name (fmt));
-#endif /* DEBUG */
+ return (EXTEND32 (value));
+}
+
+void
+store_fcr(sim_cpu *cpu,
+ address_word cia,
+ int fcr,
+ unsigned_word value)
+{
+ unsigned32 v;
- return (boolean);
+ v = VL4_8(value);
+ switch (fcr)
+ {
+ case 25: /* FP Condition Codes Register (stored into FCSR). */
+ v = (v << 1) | (v & 0x1); /* Adjust for FCC gap. */
+ FCR31 &= ~fcsr_FCC_mask;
+ FCR31 |= ((v << fcsr_FCC_shift) & fcsr_FCC_mask);
+ break;
+ case 26: /* FP Exceptions Register (stored into FCSR). */
+ FCR31 &= ~(fcsr_CAUSE_mask | fcsr_FLAGS_mask);
+ FCR31 |= (v & (fcsr_CAUSE_mask | fcsr_FLAGS_mask));
+ test_fcsr(cpu, cia);
+ break;
+ case 28: /* FP Enables Register (stored into FCSR). */
+ if ((v & fenr_FS) != 0)
+ v |= fcsr_FS;
+ else
+ v &= ~fcsr_FS;
+ FCR31 &= (fcsr_FCC_mask | fcsr_CAUSE_mask | fcsr_FLAGS_mask);
+ FCR31 |= (v & (fcsr_FS | fcsr_ENABLES_mask | fcsr_RM_mask));
+ test_fcsr(cpu, cia);
+ break;
+ case 31: /* FP Control/Status Register (FCSR). */
+ FCR31 = v & ~fcsr_ZERO_mask;
+ test_fcsr(cpu, cia);
+ break;
+ }
}
-int
-Less (op1, op2, fmt)
- uword64 op1;
- uword64 op2;
- FP_formats fmt;
+void
+update_fcsr (sim_cpu *cpu,
+ address_word cia,
+ sim_fpu_status status)
{
- int boolean = 0;
+ FCSR &= ~fcsr_CAUSE_mask;
- /* Argument checking already performed by the FPCOMPARE code */
+ if (status != 0)
+ {
+ unsigned int cause = 0;
+
+ /* map between sim_fpu codes and MIPS FCSR */
+ if (status & (sim_fpu_status_invalid_snan
+ | sim_fpu_status_invalid_isi
+ | sim_fpu_status_invalid_idi
+ | sim_fpu_status_invalid_zdz
+ | sim_fpu_status_invalid_imz
+ | sim_fpu_status_invalid_cmp
+ | sim_fpu_status_invalid_sqrt
+ | sim_fpu_status_invalid_cvi))
+ cause |= (1 << IO);
+ if (status & sim_fpu_status_invalid_div0)
+ cause |= (1 << DZ);
+ if (status & sim_fpu_status_overflow)
+ cause |= (1 << OF);
+ if (status & sim_fpu_status_underflow)
+ cause |= (1 << UF);
+ if (status & sim_fpu_status_inexact)
+ cause |= (1 << IR);
+#if 0 /* Not yet. */
+ /* Implicit clearing of other bits by unimplemented done by callers. */
+ if (status & sim_fpu_status_unimplemented)
+ cause |= (1 << UO);
+#endif
-#ifdef DEBUG
- printf ("DBG: Less: %s: op1 = 0x%s : op2 = 0x%s\n",
- fpu_format_name (fmt), pr_addr (op1), pr_addr (op2));
-#endif /* DEBUG */
+ FCSR |= (cause << fcsr_CAUSE_shift);
+ test_fcsr (cpu, cia);
+ FCSR |= ((cause & ~(1 << UO)) << fcsr_FLAGS_shift);
+ }
+ return;
+}
- /* The format type should already have been checked: */
- switch (fmt)
+static sim_fpu_round
+rounding_mode(int rm)
+{
+ sim_fpu_round round;
+
+ switch (rm)
{
- case fmt_single:
- {
- sim_fpu wop1;
- sim_fpu wop2;
- sim_fpu_32to (&wop1, op1);
- sim_fpu_32to (&wop2, op2);
- boolean = sim_fpu_is_lt (&wop1, &wop2);
- break;
- }
- case fmt_double:
- {
- sim_fpu wop1;
- sim_fpu wop2;
- sim_fpu_64to (&wop1, op1);
- sim_fpu_64to (&wop2, op2);
- boolean = sim_fpu_is_lt (&wop1, &wop2);
- break;
- }
+ case FP_RM_NEAREST:
+ /* Round result to nearest representable value. When two
+ representable values are equally near, round to the value
+ that has a least significant bit of zero (i.e. is even). */
+ round = sim_fpu_round_near;
+ break;
+ case FP_RM_TOZERO:
+ /* Round result to the value closest to, and not greater in
+ magnitude than, the result. */
+ round = sim_fpu_round_zero;
+ break;
+ case FP_RM_TOPINF:
+ /* Round result to the value closest to, and not less than,
+ the result. */
+ round = sim_fpu_round_up;
+ break;
+ case FP_RM_TOMINF:
+ /* Round result to the value closest to, and not greater than,
+ the result. */
+ round = sim_fpu_round_down;
+ break;
default:
+ round = 0;
fprintf (stderr, "Bad switch\n");
abort ();
}
+ return round;
+}
-#ifdef DEBUG
- printf ("DBG: Less: returning %d (format = %s)\n",
- boolean, fpu_format_name (fmt));
-#endif /* DEBUG */
+/* When the FS bit is set, MIPS processors return zero for
+ denormalized results and optionally replace denormalized inputs
+ with zero. When FS is clear, some implementation trap on input
+ and/or output, while other perform the operation in hardware. */
+static sim_fpu_denorm
+denorm_mode(sim_cpu *cpu)
+{
+ sim_fpu_denorm denorm;
- return (boolean);
+ /* XXX: FIXME: Eventually should be CPU model dependent. */
+ if (GETFS())
+ denorm = sim_fpu_denorm_zero;
+ else
+ denorm = 0;
+ return denorm;
}
-int
-Equal (op1, op2, fmt)
- uword64 op1;
- uword64 op2;
- FP_formats fmt;
-{
- int boolean = 0;
- /* Argument checking already performed by the FPCOMPARE code */
+/* Comparison operations. */
-#ifdef DEBUG
- printf ("DBG: Equal: %s: op1 = 0x%s : op2 = 0x%s\n",
- fpu_format_name (fmt), pr_addr (op1), pr_addr (op2));
-#endif /* DEBUG */
+static sim_fpu_status
+fp_test(unsigned64 op1,
+ unsigned64 op2,
+ FP_formats fmt,
+ int abs,
+ int cond,
+ int *condition)
+{
+ sim_fpu wop1;
+ sim_fpu wop2;
+ sim_fpu_status status = 0;
+ int less, equal, unordered;
- /* The format type should already have been checked: */
+ /* The format type has already been checked: */
switch (fmt)
{
case fmt_single:
{
- sim_fpu wop1;
- sim_fpu wop2;
sim_fpu_32to (&wop1, op1);
sim_fpu_32to (&wop2, op2);
- boolean = sim_fpu_is_eq (&wop1, &wop2);
break;
}
case fmt_double:
{
- sim_fpu wop1;
- sim_fpu wop2;
sim_fpu_64to (&wop1, op1);
sim_fpu_64to (&wop2, op2);
- boolean = sim_fpu_is_eq (&wop1, &wop2);
break;
}
default:
@@ -460,585 +543,816 @@ Equal (op1, op2, fmt)
abort ();
}
-#ifdef DEBUG
- printf ("DBG: Equal: returning %d (format = %s)\n",
- boolean, fpu_format_name (fmt));
-#endif /* DEBUG */
-
- return (boolean);
+ if (sim_fpu_is_nan (&wop1) || sim_fpu_is_nan (&wop2))
+ {
+ if ((cond & (1 << 3)) ||
+ sim_fpu_is_snan (&wop1) || sim_fpu_is_snan (&wop2))
+ status = sim_fpu_status_invalid_snan;
+ less = 0;
+ equal = 0;
+ unordered = 1;
+ }
+ else
+ {
+ if (abs)
+ {
+ status |= sim_fpu_abs (&wop1, &wop1);
+ status |= sim_fpu_abs (&wop2, &wop2);
+ }
+ equal = sim_fpu_is_eq (&wop1, &wop2);
+ less = !equal && sim_fpu_is_lt (&wop1, &wop2);
+ unordered = 0;
+ }
+ *condition = (((cond & (1 << 2)) && less)
+ || ((cond & (1 << 1)) && equal)
+ || ((cond & (1 << 0)) && unordered));
+ return status;
}
-uword64
-AbsoluteValue (op, fmt)
- uword64 op;
- FP_formats fmt;
+void
+fp_cmp(sim_cpu *cpu,
+ address_word cia,
+ unsigned64 op1,
+ unsigned64 op2,
+ FP_formats fmt,
+ int abs,
+ int cond,
+ int cc)
{
- uword64 result = 0;
+ sim_fpu_status status = 0;
-#ifdef DEBUG
- printf ("DBG: AbsoluteValue: %s: op = 0x%s\n",
- fpu_format_name (fmt), pr_addr (op));
-#endif /* DEBUG */
-
- /* The format type should already have been checked: */
+ /* The format type should already have been checked. The FCSR is
+ updated before the condition codes so that any exceptions will
+ be signalled before the condition codes are changed. */
switch (fmt)
{
case fmt_single:
+ case fmt_double:
{
- sim_fpu wop;
- unsigned32 ans;
- sim_fpu_32to (&wop, op);
- sim_fpu_abs (&wop, &wop);
- sim_fpu_to32 (&ans, &wop);
- result = ans;
+ int result;
+ status = fp_test(op1, op2, fmt, abs, cond, &result);
+ update_fcsr (cpu, cia, status);
+ SETFCC (cc, result);
break;
}
- case fmt_double:
+ case fmt_ps:
{
- sim_fpu wop;
- unsigned64 ans;
- sim_fpu_64to (&wop, op);
- sim_fpu_abs (&wop, &wop);
- sim_fpu_to64 (&ans, &wop);
- result = ans;
+ int result0, result1;
+ status = fp_test(FP_PS_lower (op1), FP_PS_lower (op2), fmt_single,
+ abs, cond, &result0);
+ status |= fp_test(FP_PS_upper (op1), FP_PS_upper (op2), fmt_single,
+ abs, cond, &result1);
+ update_fcsr (cpu, cia, status);
+ SETFCC (cc, result0);
+ SETFCC (cc+1, result1);
break;
}
default:
- fprintf (stderr, "Bad switch\n");
+ sim_io_eprintf (SD, "Bad switch\n");
abort ();
}
-
- return (result);
}
-uword64
-Negate (op, fmt)
- uword64 op;
- FP_formats fmt;
-{
- uword64 result = 0;
-#ifdef DEBUG
- printf ("DBG: Negate: %s: op = 0x%s\n",
- fpu_format_name (fmt), pr_addr (op));
-#endif /* DEBUG */
+/* Basic arithmetic operations. */
- /* The format type should already have been checked: */
+static unsigned64
+fp_unary(sim_cpu *cpu,
+ address_word cia,
+ int (*sim_fpu_op)(sim_fpu *, const sim_fpu *),
+ unsigned64 op,
+ FP_formats fmt)
+{
+ sim_fpu wop;
+ sim_fpu ans;
+ sim_fpu_round round = rounding_mode (GETRM());
+ sim_fpu_denorm denorm = denorm_mode (cpu);
+ sim_fpu_status status = 0;
+ unsigned64 result = 0;
+
+ /* The format type has already been checked: */
switch (fmt)
{
case fmt_single:
{
- sim_fpu wop;
- unsigned32 ans;
+ unsigned32 res;
sim_fpu_32to (&wop, op);
- sim_fpu_neg (&wop, &wop);
- sim_fpu_to32 (&ans, &wop);
- result = ans;
+ status |= (*sim_fpu_op) (&ans, &wop);
+ status |= sim_fpu_round_32 (&ans, round, denorm);
+ sim_fpu_to32 (&res, &ans);
+ result = res;
break;
}
case fmt_double:
{
- sim_fpu wop;
- unsigned64 ans;
+ unsigned64 res;
sim_fpu_64to (&wop, op);
- sim_fpu_neg (&wop, &wop);
- sim_fpu_to64 (&ans, &wop);
- result = ans;
+ status |= (*sim_fpu_op) (&ans, &wop);
+ status |= sim_fpu_round_64 (&ans, round, denorm);
+ sim_fpu_to64 (&res, &ans);
+ result = res;
+ break;
+ }
+ case fmt_ps:
+ {
+ int status_u = 0, status_l = 0;
+ unsigned32 res_u, res_l;
+ sim_fpu_32to (&wop, FP_PS_upper(op));
+ status_u |= (*sim_fpu_op) (&ans, &wop);
+ sim_fpu_to32 (&res_u, &ans);
+ sim_fpu_32to (&wop, FP_PS_lower(op));
+ status_l |= (*sim_fpu_op) (&ans, &wop);
+ sim_fpu_to32 (&res_l, &ans);
+ result = FP_PS_cat(res_u, res_l);
+ status = status_u | status_l;
break;
}
default:
- fprintf (stderr, "Bad switch\n");
+ sim_io_eprintf (SD, "Bad switch\n");
abort ();
}
- return (result);
+ update_fcsr (cpu, cia, status);
+ return result;
}
-uword64
-Add (op1, op2, fmt)
- uword64 op1;
- uword64 op2;
- FP_formats fmt;
+static unsigned64
+fp_binary(sim_cpu *cpu,
+ address_word cia,
+ int (*sim_fpu_op)(sim_fpu *, const sim_fpu *, const sim_fpu *),
+ unsigned64 op1,
+ unsigned64 op2,
+ FP_formats fmt)
{
- uword64 result = 0;
-
-#ifdef DEBUG
- printf ("DBG: Add: %s: op1 = 0x%s : op2 = 0x%s\n",
- fpu_format_name (fmt), pr_addr (op1), pr_addr (op2));
-#endif /* DEBUG */
-
- /* The registers must specify FPRs valid for operands of type
- "fmt". If they are not valid, the result is undefined. */
-
- /* The format type should already have been checked: */
+ sim_fpu wop1;
+ sim_fpu wop2;
+ sim_fpu ans;
+ sim_fpu_round round = rounding_mode (GETRM());
+ sim_fpu_denorm denorm = denorm_mode (cpu);
+ sim_fpu_status status = 0;
+ unsigned64 result = 0;
+
+ /* The format type has already been checked: */
switch (fmt)
{
case fmt_single:
{
- sim_fpu wop1;
- sim_fpu wop2;
- sim_fpu ans;
unsigned32 res;
sim_fpu_32to (&wop1, op1);
sim_fpu_32to (&wop2, op2);
- sim_fpu_add (&ans, &wop1, &wop2);
+ status |= (*sim_fpu_op) (&ans, &wop1, &wop2);
+ status |= sim_fpu_round_32 (&ans, round, denorm);
sim_fpu_to32 (&res, &ans);
result = res;
break;
}
case fmt_double:
{
- sim_fpu wop1;
- sim_fpu wop2;
- sim_fpu ans;
unsigned64 res;
sim_fpu_64to (&wop1, op1);
sim_fpu_64to (&wop2, op2);
- sim_fpu_add (&ans, &wop1, &wop2);
+ status |= (*sim_fpu_op) (&ans, &wop1, &wop2);
+ status |= sim_fpu_round_64 (&ans, round, denorm);
sim_fpu_to64 (&res, &ans);
result = res;
break;
}
+ case fmt_ps:
+ {
+ int status_u = 0, status_l = 0;
+ unsigned32 res_u, res_l;
+ sim_fpu_32to (&wop1, FP_PS_upper(op1));
+ sim_fpu_32to (&wop2, FP_PS_upper(op2));
+ status_u |= (*sim_fpu_op) (&ans, &wop1, &wop2);
+ sim_fpu_to32 (&res_u, &ans);
+ sim_fpu_32to (&wop1, FP_PS_lower(op1));
+ sim_fpu_32to (&wop2, FP_PS_lower(op2));
+ status_l |= (*sim_fpu_op) (&ans, &wop1, &wop2);
+ sim_fpu_to32 (&res_l, &ans);
+ result = FP_PS_cat(res_u, res_l);
+ status = status_u | status_l;
+ break;
+ }
default:
- fprintf (stderr, "Bad switch\n");
+ sim_io_eprintf (SD, "Bad switch\n");
abort ();
}
-#ifdef DEBUG
- printf ("DBG: Add: returning 0x%s (format = %s)\n",
- pr_addr (result), fpu_format_name (fmt));
-#endif /* DEBUG */
-
- return (result);
+ update_fcsr (cpu, cia, status);
+ return result;
}
-uword64
-Sub (op1, op2, fmt)
- uword64 op1;
- uword64 op2;
- FP_formats fmt;
+/* Common MAC code for single operands (.s or .d), defers setting FCSR. */
+static sim_fpu_status
+inner_mac(int (*sim_fpu_op)(sim_fpu *, const sim_fpu *, const sim_fpu *),
+ unsigned64 op1,
+ unsigned64 op2,
+ unsigned64 op3,
+ int scale,
+ int negate,
+ FP_formats fmt,
+ sim_fpu_round round,
+ sim_fpu_denorm denorm,
+ unsigned64 *result)
{
- uword64 result = 0;
-
-#ifdef DEBUG
- printf ("DBG: Sub: %s: op1 = 0x%s : op2 = 0x%s\n",
- fpu_format_name (fmt), pr_addr (op1), pr_addr (op2));
-#endif /* DEBUG */
-
- /* The registers must specify FPRs valid for operands of type
- "fmt". If they are not valid, the result is undefined. */
+ sim_fpu wop1;
+ sim_fpu wop2;
+ sim_fpu ans;
+ sim_fpu_status status = 0;
+ sim_fpu_status op_status;
+ unsigned64 temp = 0;
- /* The format type should already have been checked: */
switch (fmt)
{
case fmt_single:
{
- sim_fpu wop1;
- sim_fpu wop2;
- sim_fpu ans;
unsigned32 res;
sim_fpu_32to (&wop1, op1);
sim_fpu_32to (&wop2, op2);
- sim_fpu_sub (&ans, &wop1, &wop2);
+ status |= sim_fpu_mul (&ans, &wop1, &wop2);
+ if (scale != 0 && sim_fpu_is_number (&ans)) /* number or denorm */
+ ans.normal_exp += scale;
+ status |= sim_fpu_round_32 (&ans, round, denorm);
+ wop1 = ans;
+ op_status = 0;
+ sim_fpu_32to (&wop2, op3);
+ op_status |= (*sim_fpu_op) (&ans, &wop1, &wop2);
+ op_status |= sim_fpu_round_32 (&ans, round, denorm);
+ status |= op_status;
+ if (negate)
+ {
+ wop1 = ans;
+ op_status = sim_fpu_neg (&ans, &wop1);
+ op_status |= sim_fpu_round_32 (&ans, round, denorm);
+ status |= op_status;
+ }
sim_fpu_to32 (&res, &ans);
- result = res;
+ temp = res;
+ break;
}
- break;
case fmt_double:
{
- sim_fpu wop1;
- sim_fpu wop2;
- sim_fpu ans;
unsigned64 res;
sim_fpu_64to (&wop1, op1);
sim_fpu_64to (&wop2, op2);
- sim_fpu_sub (&ans, &wop1, &wop2);
+ status |= sim_fpu_mul (&ans, &wop1, &wop2);
+ if (scale != 0 && sim_fpu_is_number (&ans)) /* number or denorm */
+ ans.normal_exp += scale;
+ status |= sim_fpu_round_64 (&ans, round, denorm);
+ wop1 = ans;
+ op_status = 0;
+ sim_fpu_64to (&wop2, op3);
+ op_status |= (*sim_fpu_op) (&ans, &wop1, &wop2);
+ op_status |= sim_fpu_round_64 (&ans, round, denorm);
+ status |= op_status;
+ if (negate)
+ {
+ wop1 = ans;
+ op_status = sim_fpu_neg (&ans, &wop1);
+ op_status |= sim_fpu_round_64 (&ans, round, denorm);
+ status |= op_status;
+ }
sim_fpu_to64 (&res, &ans);
- result = res;
+ temp = res;
+ break;
}
- break;
default:
fprintf (stderr, "Bad switch\n");
abort ();
}
-
-#ifdef DEBUG
- printf ("DBG: Sub: returning 0x%s (format = %s)\n",
- pr_addr (result), fpu_format_name (fmt));
-#endif /* DEBUG */
-
- return (result);
+ *result = temp;
+ return status;
}
-uword64
-Multiply (op1, op2, fmt)
- uword64 op1;
- uword64 op2;
- FP_formats fmt;
+/* Common implementation of madd, nmadd, msub, nmsub that does
+ intermediate rounding per spec. Also used for recip2 and rsqrt2,
+ which are transformed into equivalent nmsub operations. The scale
+ argument is an adjustment to the exponent of the intermediate
+ product op1*op2. It is currently non-zero for rsqrt2 (-1), which
+ requires an effective division by 2. */
+static unsigned64
+fp_mac(sim_cpu *cpu,
+ address_word cia,
+ int (*sim_fpu_op)(sim_fpu *, const sim_fpu *, const sim_fpu *),
+ unsigned64 op1,
+ unsigned64 op2,
+ unsigned64 op3,
+ int scale,
+ int negate,
+ FP_formats fmt)
{
- uword64 result = 0;
-
-#ifdef DEBUG
- printf ("DBG: Multiply: %s: op1 = 0x%s : op2 = 0x%s\n",
- fpu_format_name (fmt), pr_addr (op1), pr_addr (op2));
-#endif /* DEBUG */
+ sim_fpu_round round = rounding_mode (GETRM());
+ sim_fpu_denorm denorm = denorm_mode (cpu);
+ sim_fpu_status status = 0;
+ unsigned64 result = 0;
- /* The registers must specify FPRs valid for operands of type
- "fmt". If they are not valid, the result is undefined. */
-
- /* The format type should already have been checked: */
+ /* The format type has already been checked: */
switch (fmt)
{
case fmt_single:
- {
- sim_fpu wop1;
- sim_fpu wop2;
- sim_fpu ans;
- unsigned32 res;
- sim_fpu_32to (&wop1, op1);
- sim_fpu_32to (&wop2, op2);
- sim_fpu_mul (&ans, &wop1, &wop2);
- sim_fpu_to32 (&res, &ans);
- result = res;
- break;
- }
case fmt_double:
+ status = inner_mac(sim_fpu_op, op1, op2, op3, scale,
+ negate, fmt, round, denorm, &result);
+ break;
+ case fmt_ps:
{
- sim_fpu wop1;
- sim_fpu wop2;
- sim_fpu ans;
- unsigned64 res;
- sim_fpu_64to (&wop1, op1);
- sim_fpu_64to (&wop2, op2);
- sim_fpu_mul (&ans, &wop1, &wop2);
- sim_fpu_to64 (&res, &ans);
- result = res;
+ int status_u, status_l;
+ unsigned64 result_u, result_l;
+ status_u = inner_mac(sim_fpu_op, FP_PS_upper(op1), FP_PS_upper(op2),
+ FP_PS_upper(op3), scale, negate, fmt_single,
+ round, denorm, &result_u);
+ status_l = inner_mac(sim_fpu_op, FP_PS_lower(op1), FP_PS_lower(op2),
+ FP_PS_lower(op3), scale, negate, fmt_single,
+ round, denorm, &result_l);
+ result = FP_PS_cat(result_u, result_l);
+ status = status_u | status_l;
break;
}
default:
- fprintf (stderr, "Bad switch\n");
+ sim_io_eprintf (SD, "Bad switch\n");
abort ();
}
-#ifdef DEBUG
- printf ("DBG: Multiply: returning 0x%s (format = %s)\n",
- pr_addr (result), fpu_format_name (fmt));
-#endif /* DEBUG */
-
- return (result);
+ update_fcsr (cpu, cia, status);
+ return result;
}
-uword64
-Divide (op1, op2, fmt)
- uword64 op1;
- uword64 op2;
- FP_formats fmt;
+/* Common rsqrt code for single operands (.s or .d), intermediate rounding. */
+static sim_fpu_status
+inner_rsqrt(unsigned64 op1,
+ FP_formats fmt,
+ sim_fpu_round round,
+ sim_fpu_denorm denorm,
+ unsigned64 *result)
{
- uword64 result = 0;
+ sim_fpu wop1;
+ sim_fpu ans;
+ sim_fpu_status status = 0;
+ sim_fpu_status op_status;
+ unsigned64 temp = 0;
-#ifdef DEBUG
- printf ("DBG: Divide: %s: op1 = 0x%s : op2 = 0x%s\n",
- fpu_format_name (fmt), pr_addr (op1), pr_addr (op2));
-#endif /* DEBUG */
-
- /* The registers must specify FPRs valid for operands of type
- "fmt". If they are not valid, the result is undefined. */
-
- /* The format type should already have been checked: */
switch (fmt)
{
case fmt_single:
{
- sim_fpu wop1;
- sim_fpu wop2;
- sim_fpu ans;
unsigned32 res;
sim_fpu_32to (&wop1, op1);
- sim_fpu_32to (&wop2, op2);
- sim_fpu_div (&ans, &wop1, &wop2);
+ status |= sim_fpu_sqrt (&ans, &wop1);
+ status |= sim_fpu_round_32 (&ans, status, round);
+ wop1 = ans;
+ op_status = sim_fpu_inv (&ans, &wop1);
+ op_status |= sim_fpu_round_32 (&ans, round, denorm);
sim_fpu_to32 (&res, &ans);
- result = res;
+ temp = res;
+ status |= op_status;
break;
}
case fmt_double:
{
- sim_fpu wop1;
- sim_fpu wop2;
- sim_fpu ans;
unsigned64 res;
sim_fpu_64to (&wop1, op1);
- sim_fpu_64to (&wop2, op2);
- sim_fpu_div (&ans, &wop1, &wop2);
+ status |= sim_fpu_sqrt (&ans, &wop1);
+ status |= sim_fpu_round_64 (&ans, round, denorm);
+ wop1 = ans;
+ op_status = sim_fpu_inv (&ans, &wop1);
+ op_status |= sim_fpu_round_64 (&ans, round, denorm);
sim_fpu_to64 (&res, &ans);
- result = res;
+ temp = res;
+ status |= op_status;
break;
}
default:
fprintf (stderr, "Bad switch\n");
abort ();
}
-
-#ifdef DEBUG
- printf ("DBG: Divide: returning 0x%s (format = %s)\n",
- pr_addr (result), fpu_format_name (fmt));
-#endif /* DEBUG */
-
- return (result);
+ *result = temp;
+ return status;
}
-uword64 UNUSED
-Recip (op, fmt)
- uword64 op;
- FP_formats fmt;
+static unsigned64
+fp_inv_sqrt(sim_cpu *cpu,
+ address_word cia,
+ unsigned64 op1,
+ FP_formats fmt)
{
- uword64 result = 0;
-
-#ifdef DEBUG
- printf ("DBG: Recip: %s: op = 0x%s\n",
- fpu_format_name (fmt), pr_addr (op));
-#endif /* DEBUG */
+ sim_fpu_round round = rounding_mode (GETRM());
+ sim_fpu_round denorm = denorm_mode (cpu);
+ sim_fpu_status status = 0;
+ unsigned64 result = 0;
- /* The registers must specify FPRs valid for operands of type
- "fmt". If they are not valid, the result is undefined. */
-
- /* The format type should already have been checked: */
+ /* The format type has already been checked: */
switch (fmt)
{
case fmt_single:
- {
- sim_fpu wop;
- sim_fpu ans;
- unsigned32 res;
- sim_fpu_32to (&wop, op);
- sim_fpu_inv (&ans, &wop);
- sim_fpu_to32 (&res, &ans);
- result = res;
- break;
- }
case fmt_double:
+ status = inner_rsqrt (op1, fmt, round, denorm, &result);
+ break;
+ case fmt_ps:
{
- sim_fpu wop;
- sim_fpu ans;
- unsigned64 res;
- sim_fpu_64to (&wop, op);
- sim_fpu_inv (&ans, &wop);
- sim_fpu_to64 (&res, &ans);
- result = res;
+ int status_u, status_l;
+ unsigned64 result_u, result_l;
+ status_u = inner_rsqrt (FP_PS_upper(op1), fmt_single, round, denorm,
+ &result_u);
+ status_l = inner_rsqrt (FP_PS_lower(op1), fmt_single, round, denorm,
+ &result_l);
+ result = FP_PS_cat(result_u, result_l);
+ status = status_u | status_l;
break;
}
default:
- fprintf (stderr, "Bad switch\n");
+ sim_io_eprintf (SD, "Bad switch\n");
abort ();
}
-#ifdef DEBUG
- printf ("DBG: Recip: returning 0x%s (format = %s)\n",
- pr_addr (result), fpu_format_name (fmt));
-#endif /* DEBUG */
+ update_fcsr (cpu, cia, status);
+ return result;
+}
- return (result);
+
+unsigned64
+fp_abs(sim_cpu *cpu,
+ address_word cia,
+ unsigned64 op,
+ FP_formats fmt)
+{
+ return fp_unary(cpu, cia, &sim_fpu_abs, op, fmt);
}
-uword64
-SquareRoot (op, fmt)
- uword64 op;
- FP_formats fmt;
+unsigned64
+fp_neg(sim_cpu *cpu,
+ address_word cia,
+ unsigned64 op,
+ FP_formats fmt)
{
- uword64 result = 0;
+ return fp_unary(cpu, cia, &sim_fpu_neg, op, fmt);
+}
-#ifdef DEBUG
- printf ("DBG: SquareRoot: %s: op = 0x%s\n",
- fpu_format_name (fmt), pr_addr (op));
-#endif /* DEBUG */
+unsigned64
+fp_add(sim_cpu *cpu,
+ address_word cia,
+ unsigned64 op1,
+ unsigned64 op2,
+ FP_formats fmt)
+{
+ return fp_binary(cpu, cia, &sim_fpu_add, op1, op2, fmt);
+}
- /* The registers must specify FPRs valid for operands of type
- "fmt". If they are not valid, the result is undefined. */
+unsigned64
+fp_sub(sim_cpu *cpu,
+ address_word cia,
+ unsigned64 op1,
+ unsigned64 op2,
+ FP_formats fmt)
+{
+ return fp_binary(cpu, cia, &sim_fpu_sub, op1, op2, fmt);
+}
- /* The format type should already have been checked: */
- switch (fmt)
- {
- case fmt_single:
- {
- sim_fpu wop;
- sim_fpu ans;
- unsigned32 res;
- sim_fpu_32to (&wop, op);
- sim_fpu_sqrt (&ans, &wop);
- sim_fpu_to32 (&res, &ans);
- result = res;
- break;
- }
- case fmt_double:
- {
- sim_fpu wop;
- sim_fpu ans;
- unsigned64 res;
- sim_fpu_64to (&wop, op);
- sim_fpu_sqrt (&ans, &wop);
- sim_fpu_to64 (&res, &ans);
- result = res;
- break;
- }
- default:
- fprintf (stderr, "Bad switch\n");
- abort ();
- }
+unsigned64
+fp_mul(sim_cpu *cpu,
+ address_word cia,
+ unsigned64 op1,
+ unsigned64 op2,
+ FP_formats fmt)
+{
+ return fp_binary(cpu, cia, &sim_fpu_mul, op1, op2, fmt);
+}
-#ifdef DEBUG
- printf ("DBG: SquareRoot: returning 0x%s (format = %s)\n",
- pr_addr (result), fpu_format_name (fmt));
-#endif /* DEBUG */
+unsigned64
+fp_div(sim_cpu *cpu,
+ address_word cia,
+ unsigned64 op1,
+ unsigned64 op2,
+ FP_formats fmt)
+{
+ return fp_binary(cpu, cia, &sim_fpu_div, op1, op2, fmt);
+}
- return (result);
+unsigned64
+fp_recip(sim_cpu *cpu,
+ address_word cia,
+ unsigned64 op,
+ FP_formats fmt)
+{
+ return fp_unary(cpu, cia, &sim_fpu_inv, op, fmt);
}
-#if 0
-uword64
-Max (uword64 op1,
- uword64 op2,
- FP_formats fmt)
+unsigned64
+fp_sqrt(sim_cpu *cpu,
+ address_word cia,
+ unsigned64 op,
+ FP_formats fmt)
+{
+ return fp_unary(cpu, cia, &sim_fpu_sqrt, op, fmt);
+}
+
+unsigned64
+fp_rsqrt(sim_cpu *cpu,
+ address_word cia,
+ unsigned64 op,
+ FP_formats fmt)
+{
+ return fp_inv_sqrt(cpu, cia, op, fmt);
+}
+
+unsigned64
+fp_madd(sim_cpu *cpu,
+ address_word cia,
+ unsigned64 op1,
+ unsigned64 op2,
+ unsigned64 op3,
+ FP_formats fmt)
+{
+ return fp_mac(cpu, cia, &sim_fpu_add, op1, op2, op3, 0, 0, fmt);
+}
+
+unsigned64
+fp_msub(sim_cpu *cpu,
+ address_word cia,
+ unsigned64 op1,
+ unsigned64 op2,
+ unsigned64 op3,
+ FP_formats fmt)
{
- int cmp;
+ return fp_mac(cpu, cia, &sim_fpu_sub, op1, op2, op3, 0, 0, fmt);
+}
+
+unsigned64
+fp_nmadd(sim_cpu *cpu,
+ address_word cia,
+ unsigned64 op1,
+ unsigned64 op2,
+ unsigned64 op3,
+ FP_formats fmt)
+{
+ return fp_mac(cpu, cia, &sim_fpu_add, op1, op2, op3, 0, 1, fmt);
+}
+
+unsigned64
+fp_nmsub(sim_cpu *cpu,
+ address_word cia,
+ unsigned64 op1,
+ unsigned64 op2,
+ unsigned64 op3,
+ FP_formats fmt)
+{
+ return fp_mac(cpu, cia, &sim_fpu_sub, op1, op2, op3, 0, 1, fmt);
+}
+
+
+/* MIPS-3D ASE operations. */
+
+/* Variant of fp_binary for *r.ps MIPS-3D operations. */
+static unsigned64
+fp_binary_r(sim_cpu *cpu,
+ address_word cia,
+ int (*sim_fpu_op)(sim_fpu *, const sim_fpu *, const sim_fpu *),
+ unsigned64 op1,
+ unsigned64 op2)
+{
+ sim_fpu wop1;
+ sim_fpu wop2;
+ sim_fpu ans;
+ sim_fpu_round round = rounding_mode (GETRM ());
+ sim_fpu_denorm denorm = denorm_mode (cpu);
+ sim_fpu_status status_u, status_l;
unsigned64 result;
+ unsigned32 res_u, res_l;
+
+ /* The format must be fmt_ps. */
+ status_u = 0;
+ sim_fpu_32to (&wop1, FP_PS_upper (op1));
+ sim_fpu_32to (&wop2, FP_PS_lower (op1));
+ status_u |= (*sim_fpu_op) (&ans, &wop1, &wop2);
+ status_u |= sim_fpu_round_32 (&ans, round, denorm);
+ sim_fpu_to32 (&res_u, &ans);
+ status_l = 0;
+ sim_fpu_32to (&wop1, FP_PS_upper (op2));
+ sim_fpu_32to (&wop2, FP_PS_lower (op2));
+ status_l |= (*sim_fpu_op) (&ans, &wop1, &wop2);
+ status_l |= sim_fpu_round_32 (&ans, round, denorm);
+ sim_fpu_to32 (&res_l, &ans);
+ result = FP_PS_cat (res_u, res_l);
+
+ update_fcsr (cpu, cia, status_u | status_l);
+ return result;
+}
-#ifdef DEBUG
- printf ("DBG: Max: %s: op1 = 0x%s : op2 = 0x%s\n",
- fpu_format_name (fmt), pr_addr (op1), pr_addr (op2));
-#endif /* DEBUG */
+unsigned64
+fp_add_r(sim_cpu *cpu,
+ address_word cia,
+ unsigned64 op1,
+ unsigned64 op2,
+ FP_formats fmt)
+{
+ return fp_binary_r (cpu, cia, &sim_fpu_add, op1, op2);
+}
- /* The registers must specify FPRs valid for operands of type
- "fmt". If they are not valid, the result is undefined. */
+unsigned64
+fp_mul_r(sim_cpu *cpu,
+ address_word cia,
+ unsigned64 op1,
+ unsigned64 op2,
+ FP_formats fmt)
+{
+ return fp_binary_r (cpu, cia, &sim_fpu_mul, op1, op2);
+}
- /* The format type should already have been checked: */
+#define NR_FRAC_GUARD (60)
+#define IMPLICIT_1 LSBIT64 (NR_FRAC_GUARD)
+
+static int
+fpu_inv1(sim_fpu *f, const sim_fpu *l)
+{
+ static const sim_fpu sim_fpu_one = {
+ sim_fpu_class_number, 0, IMPLICIT_1, 0
+ };
+ int status = 0;
+ sim_fpu t;
+
+ if (sim_fpu_is_zero (l))
+ {
+ *f = sim_fpu_maxfp;
+ f->sign = l->sign;
+ return sim_fpu_status_invalid_div0;
+ }
+ if (sim_fpu_is_infinity (l))
+ {
+ *f = sim_fpu_zero;
+ f->sign = l->sign;
+ return status;
+ }
+ status |= sim_fpu_div (f, &sim_fpu_one, l);
+ return status;
+}
+
+static int
+fpu_inv1_32(sim_fpu *f, const sim_fpu *l)
+{
+ if (sim_fpu_is_zero (l))
+ {
+ *f = sim_fpu_max32;
+ f->sign = l->sign;
+ return sim_fpu_status_invalid_div0;
+ }
+ return fpu_inv1 (f, l);
+}
+
+static int
+fpu_inv1_64(sim_fpu *f, const sim_fpu *l)
+{
+ if (sim_fpu_is_zero (l))
+ {
+ *f = sim_fpu_max64;
+ f->sign = l->sign;
+ return sim_fpu_status_invalid_div0;
+ }
+ return fpu_inv1 (f, l);
+}
+
+unsigned64
+fp_recip1(sim_cpu *cpu,
+ address_word cia,
+ unsigned64 op,
+ FP_formats fmt)
+{
switch (fmt)
{
case fmt_single:
- {
- sim_fpu wop1;
- sim_fpu wop2;
- sim_fpu_32to (&wop1, op1);
- sim_fpu_32to (&wop2, op2);
- cmp = sim_fpu_cmp (&wop1, &wop2);
- break;
- }
+ case fmt_ps:
+ return fp_unary (cpu, cia, &fpu_inv1_32, op, fmt);
case fmt_double:
- {
- sim_fpu wop1;
- sim_fpu wop2;
- sim_fpu_64to (&wop1, op1);
- sim_fpu_64to (&wop2, op2);
- cmp = sim_fpu_cmp (&wop1, &wop2);
- break;
- }
- default:
- fprintf (stderr, "Bad switch\n");
- abort ();
+ return fp_unary (cpu, cia, &fpu_inv1_64, op, fmt);
}
+ return 0;
+}
+
+unsigned64
+fp_recip2(sim_cpu *cpu,
+ address_word cia,
+ unsigned64 op1,
+ unsigned64 op2,
+ FP_formats fmt)
+{
+ static const unsigned64 one_single = UNSIGNED64 (0x3F800000);
+ static const unsigned64 one_double = UNSIGNED64 (0x3FF0000000000000);
+ static const unsigned64 one_ps = (one_single << 32 | one_single);
+ unsigned64 one;
- switch (cmp)
+ /* Implemented as nmsub fd, 1, fs, ft. */
+ switch (fmt)
{
- case SIM_FPU_IS_SNAN:
- case SIM_FPU_IS_QNAN:
- result = op1;
- case SIM_FPU_IS_NINF:
- case SIM_FPU_IS_NNUMBER:
- case SIM_FPU_IS_NDENORM:
- case SIM_FPU_IS_NZERO:
- result = op2; /* op1 - op2 < 0 */
- case SIM_FPU_IS_PINF:
- case SIM_FPU_IS_PNUMBER:
- case SIM_FPU_IS_PDENORM:
- case SIM_FPU_IS_PZERO:
- result = op1; /* op1 - op2 > 0 */
- default:
- fprintf (stderr, "Bad switch\n");
- abort ();
+ case fmt_single: one = one_single; break;
+ case fmt_double: one = one_double; break;
+ case fmt_ps: one = one_ps; break;
+ default: one = 0; abort ();
}
+ return fp_mac (cpu, cia, &sim_fpu_sub, op1, op2, one, 0, 1, fmt);
+}
-#ifdef DEBUG
- printf ("DBG: Max: returning 0x%s (format = %s)\n",
- pr_addr (result), fpu_format_name (fmt));
-#endif /* DEBUG */
+static int
+fpu_inv_sqrt1(sim_fpu *f, const sim_fpu *l)
+{
+ static const sim_fpu sim_fpu_one = {
+ sim_fpu_class_number, 0, IMPLICIT_1, 0
+ };
+ int status = 0;
+ sim_fpu t;
- return (result);
+ if (sim_fpu_is_zero (l))
+ {
+ *f = sim_fpu_maxfp;
+ f->sign = l->sign;
+ return sim_fpu_status_invalid_div0;
+ }
+ if (sim_fpu_is_infinity (l))
+ {
+ if (!l->sign)
+ {
+ f->class = sim_fpu_class_zero;
+ f->sign = 0;
+ }
+ else
+ {
+ *f = sim_fpu_qnan;
+ status = sim_fpu_status_invalid_sqrt;
+ }
+ return status;
+ }
+ status |= sim_fpu_sqrt (&t, l);
+ status |= sim_fpu_div (f, &sim_fpu_one, &t);
+ return status;
}
-#endif
-#if 0
-uword64
-Min (uword64 op1,
- uword64 op2,
- FP_formats fmt)
+static int
+fpu_inv_sqrt1_32(sim_fpu *f, const sim_fpu *l)
{
- int cmp;
- unsigned64 result;
-
-#ifdef DEBUG
- printf ("DBG: Min: %s: op1 = 0x%s : op2 = 0x%s\n",
- fpu_format_name (fmt), pr_addr (op1), pr_addr (op2));
-#endif /* DEBUG */
+ if (sim_fpu_is_zero (l))
+ {
+ *f = sim_fpu_max32;
+ f->sign = l->sign;
+ return sim_fpu_status_invalid_div0;
+ }
+ return fpu_inv_sqrt1 (f, l);
+}
- /* The registers must specify FPRs valid for operands of type
- "fmt". If they are not valid, the result is undefined. */
+static int
+fpu_inv_sqrt1_64(sim_fpu *f, const sim_fpu *l)
+{
+ if (sim_fpu_is_zero (l))
+ {
+ *f = sim_fpu_max64;
+ f->sign = l->sign;
+ return sim_fpu_status_invalid_div0;
+ }
+ return fpu_inv_sqrt1 (f, l);
+}
- /* The format type should already have been checked: */
+unsigned64
+fp_rsqrt1(sim_cpu *cpu,
+ address_word cia,
+ unsigned64 op,
+ FP_formats fmt)
+{
switch (fmt)
{
case fmt_single:
- {
- sim_fpu wop1;
- sim_fpu wop2;
- sim_fpu_32to (&wop1, op1);
- sim_fpu_32to (&wop2, op2);
- cmp = sim_fpu_cmp (&wop1, &wop2);
- break;
- }
+ case fmt_ps:
+ return fp_unary (cpu, cia, &fpu_inv_sqrt1_32, op, fmt);
case fmt_double:
- {
- sim_fpu wop1;
- sim_fpu wop2;
- sim_fpu_64to (&wop1, op1);
- sim_fpu_64to (&wop2, op2);
- cmp = sim_fpu_cmp (&wop1, &wop2);
- break;
- }
- default:
- fprintf (stderr, "Bad switch\n");
- abort ();
+ return fp_unary (cpu, cia, &fpu_inv_sqrt1_64, op, fmt);
}
+ return 0;
+}
- switch (cmp)
+unsigned64
+fp_rsqrt2(sim_cpu *cpu,
+ address_word cia,
+ unsigned64 op1,
+ unsigned64 op2,
+ FP_formats fmt)
+{
+ static const unsigned64 half_single = UNSIGNED64 (0x3F000000);
+ static const unsigned64 half_double = UNSIGNED64 (0x3FE0000000000000);
+ static const unsigned64 half_ps = (half_single << 32 | half_single);
+ unsigned64 half;
+
+ /* Implemented as (nmsub fd, 0.5, fs, ft)/2, where the divide is
+ done by scaling the exponent during multiply. */
+ switch (fmt)
{
- case SIM_FPU_IS_SNAN:
- case SIM_FPU_IS_QNAN:
- result = op1;
- case SIM_FPU_IS_NINF:
- case SIM_FPU_IS_NNUMBER:
- case SIM_FPU_IS_NDENORM:
- case SIM_FPU_IS_NZERO:
- result = op1; /* op1 - op2 < 0 */
- case SIM_FPU_IS_PINF:
- case SIM_FPU_IS_PNUMBER:
- case SIM_FPU_IS_PDENORM:
- case SIM_FPU_IS_PZERO:
- result = op2; /* op1 - op2 > 0 */
- default:
- fprintf (stderr, "Bad switch\n");
- abort ();
+ case fmt_single: half = half_single; break;
+ case fmt_double: half = half_double; break;
+ case fmt_ps: half = half_ps; break;
+ default: half = 0; abort ();
}
+ return fp_mac (cpu, cia, &sim_fpu_sub, op1, op2, half, -1, 1, fmt);
+}
-#ifdef DEBUG
- printf ("DBG: Min: returning 0x%s (format = %s)\n",
- pr_addr (result), fpu_format_name (fmt));
-#endif /* DEBUG */
- return (result);
-}
-#endif
+/* Conversion operations. */
uword64
-convert (SIM_DESC sd,
- sim_cpu *cpu,
+convert (sim_cpu *cpu,
address_word cia,
int rm,
uword64 op,
@@ -1046,47 +1360,11 @@ convert (SIM_DESC sd,
FP_formats to)
{
sim_fpu wop;
- sim_fpu_round round;
+ sim_fpu_round round = rounding_mode (rm);
+ sim_fpu_denorm denorm = denorm_mode (cpu);
unsigned32 result32;
unsigned64 result64;
-
-#ifdef DEBUG
-#if 0 /* FIXME: doesn't compile */
- printf ("DBG: Convert: mode %s : op 0x%s : from %s : to %s : (PC = 0x%s)\n",
- fpu_rounding_mode_name (rm), pr_addr (op), fpu_format_name (from),
- fpu_format_name (to), pr_addr (IPC));
-#endif
-#endif /* DEBUG */
-
- switch (rm)
- {
- case FP_RM_NEAREST:
- /* Round result to nearest representable value. When two
- representable values are equally near, round to the value
- that has a least significant bit of zero (i.e. is even). */
- round = sim_fpu_round_near;
- break;
- case FP_RM_TOZERO:
- /* Round result to the value closest to, and not greater in
- magnitude than, the result. */
- round = sim_fpu_round_zero;
- break;
- case FP_RM_TOPINF:
- /* Round result to the value closest to, and not less than,
- the result. */
- round = sim_fpu_round_up;
- break;
-
- case FP_RM_TOMINF:
- /* Round result to the value closest to, and not greater than,
- the result. */
- round = sim_fpu_round_down;
- break;
- default:
- round = 0;
- fprintf (stderr, "Bad switch\n");
- abort ();
- }
+ sim_fpu_status status = 0;
/* Convert the input to sim_fpu internal format */
switch (from)
@@ -1098,13 +1376,13 @@ convert (SIM_DESC sd,
sim_fpu_32to (&wop, op);
break;
case fmt_word:
- sim_fpu_i32to (&wop, op, round);
+ status = sim_fpu_i32to (&wop, op, round);
break;
case fmt_long:
- sim_fpu_i64to (&wop, op, round);
+ status = sim_fpu_i64to (&wop, op, round);
break;
default:
- fprintf (stderr, "Bad switch\n");
+ sim_io_eprintf (SD, "Bad switch\n");
abort ();
}
@@ -1112,38 +1390,148 @@ convert (SIM_DESC sd,
/* The value WOP is converted to the destination format, rounding
using mode RM. When the destination is a fixed-point format, then
a source value of Infinity, NaN or one which would round to an
- integer outside the fixed point range then an IEEE Invalid
- Operation condition is raised. */
+ integer outside the fixed point range then an IEEE Invalid Operation
+ condition is raised. Not used if destination format is PS. */
switch (to)
{
case fmt_single:
- sim_fpu_round_32 (&wop, round, 0);
+ status |= sim_fpu_round_32 (&wop, round, denorm);
+ /* For a NaN, normalize mantissa bits (cvt.s.d can't preserve them) */
+ if (sim_fpu_is_qnan (&wop))
+ wop = sim_fpu_qnan;
sim_fpu_to32 (&result32, &wop);
result64 = result32;
break;
case fmt_double:
- sim_fpu_round_64 (&wop, round, 0);
+ status |= sim_fpu_round_64 (&wop, round, denorm);
+ /* For a NaN, normalize mantissa bits (make cvt.d.s consistent) */
+ if (sim_fpu_is_qnan (&wop))
+ wop = sim_fpu_qnan;
sim_fpu_to64 (&result64, &wop);
break;
case fmt_word:
- sim_fpu_to32i (&result32, &wop, round);
+ status |= sim_fpu_to32i (&result32, &wop, round);
result64 = result32;
break;
case fmt_long:
- sim_fpu_to64i (&result64, &wop, round);
+ status |= sim_fpu_to64i (&result64, &wop, round);
break;
default:
result64 = 0;
- fprintf (stderr, "Bad switch\n");
+ sim_io_eprintf (SD, "Bad switch\n");
abort ();
}
-#ifdef DEBUG
- printf ("DBG: Convert: returning 0x%s (to format = %s)\n",
- pr_addr (result64), fpu_format_name (to));
-#endif /* DEBUG */
+ update_fcsr (cpu, cia, status);
+ return result64;
+}
+
+unsigned64
+ps_lower(sim_cpu *cpu,
+ address_word cia,
+ unsigned64 op)
+{
+ return FP_PS_lower (op);
+}
+
+unsigned64
+ps_upper(sim_cpu *cpu,
+ address_word cia,
+ unsigned64 op)
+{
+ return FP_PS_upper(op);
+}
+
+unsigned64
+pack_ps(sim_cpu *cpu,
+ address_word cia,
+ unsigned64 op1,
+ unsigned64 op2,
+ FP_formats fmt)
+{
+ unsigned64 result = 0;
+
+ /* The registers must specify FPRs valid for operands of type
+ "fmt". If they are not valid, the result is undefined. */
+
+ /* The format type should already have been checked: */
+ switch (fmt)
+ {
+ case fmt_single:
+ {
+ sim_fpu wop;
+ unsigned32 res_u, res_l;
+ sim_fpu_32to (&wop, op1);
+ sim_fpu_to32 (&res_u, &wop);
+ sim_fpu_32to (&wop, op2);
+ sim_fpu_to32 (&res_l, &wop);
+ result = FP_PS_cat(res_u, res_l);
+ break;
+ }
+ default:
+ sim_io_eprintf (SD, "Bad switch\n");
+ abort ();
+ }
+
+ return result;
+}
+
+unsigned64
+convert_ps (sim_cpu *cpu,
+ address_word cia,
+ int rm,
+ unsigned64 op,
+ FP_formats from,
+ FP_formats to)
+{
+ sim_fpu wop_u, wop_l;
+ sim_fpu_round round = rounding_mode (rm);
+ sim_fpu_denorm denorm = denorm_mode (cpu);
+ unsigned32 res_u, res_l;
+ unsigned64 result;
+ sim_fpu_status status_u = 0, status_l = 0;
+
+ /* As convert, but used only for paired values (formats PS, PW) */
+
+ /* Convert the input to sim_fpu internal format */
+ switch (from)
+ {
+ case fmt_word: /* fmt_pw */
+ sim_fpu_i32to (&wop_u, (op >> 32) & (unsigned)0xFFFFFFFF, round);
+ sim_fpu_i32to (&wop_l, op & (unsigned)0xFFFFFFFF, round);
+ break;
+ case fmt_ps:
+ sim_fpu_32to (&wop_u, FP_PS_upper(op));
+ sim_fpu_32to (&wop_l, FP_PS_lower(op));
+ break;
+ default:
+ sim_io_eprintf (SD, "Bad switch\n");
+ abort ();
+ }
+
+ /* Convert sim_fpu format into the output */
+ switch (to)
+ {
+ case fmt_word: /* fmt_pw */
+ status_u |= sim_fpu_to32i (&res_u, &wop_u, round);
+ status_l |= sim_fpu_to32i (&res_l, &wop_l, round);
+ result = (((unsigned64)res_u) << 32) | (unsigned64)res_l;
+ break;
+ case fmt_ps:
+ status_u |= sim_fpu_round_32 (&wop_u, 0, round);
+ status_l |= sim_fpu_round_32 (&wop_l, 0, round);
+ sim_fpu_to32 (&res_u, &wop_u);
+ sim_fpu_to32 (&res_l, &wop_l);
+ result = FP_PS_cat(res_u, res_l);
+ break;
+ default:
+ result = 0;
+ sim_io_eprintf (SD, "Bad switch\n");
+ abort ();
+ }
- return (result64);
+ update_fcsr (cpu, cia, status_u | status_l);
+ return result;
}
static const char *
@@ -1159,6 +1547,8 @@ fpu_format_name (FP_formats fmt)
return "word";
case fmt_long:
return "long";
+ case fmt_ps:
+ return "ps";
case fmt_unknown:
return "<unknown>";
case fmt_uninterpreted:
diff --git a/sim/mips/cp1.h b/sim/mips/cp1.h
new file mode 100644
index 00000000000..24901d8b75a
--- /dev/null
+++ b/sim/mips/cp1.h
@@ -0,0 +1,82 @@
+/*> cp1.h <*/
+/* MIPS Simulator FPU (CoProcessor 1) definitions.
+ Copyright (C) 1997, 1998, 2002 Free Software Foundation, Inc.
+ Derived from sim-main.h contributed by Cygnus Solutions,
+ modified substially by Broadcom Corporation (SiByte).
+
+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 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 CP1_H
+#define CP1_H
+
+/* See sim-main.h for allocation of registers FCR0 and FCR31 (FCSR)
+ in CPU state (struct sim_cpu), and for FPU functions. */
+
+#define fcsr_FCC_mask (0xFE800000)
+#define fcsr_FCC_shift (23)
+#define fcsr_FCC_bit(cc) ((cc) == 0 ? 23 : (24 + (cc)))
+#define fcsr_FS (1 << 24) /* MIPS III onwards : Flush to Zero */
+#define fcsr_ZERO_mask (0x007C0000)
+#define fcsr_CAUSE_mask (0x0003F000)
+#define fcsr_CAUSE_shift (12)
+#define fcsr_ENABLES_mask (0x00000F80)
+#define fcsr_ENABLES_shift (7)
+#define fcsr_FLAGS_mask (0x0000007C)
+#define fcsr_FLAGS_shift (2)
+#define fcsr_RM_mask (0x00000003)
+#define fcsr_RM_shift (0)
+
+#define fenr_FS (0x00000004)
+
+/* Macros to update and retrieve the FCSR condition-code bits. This
+ is complicated by the fact that there is a hole in the index range
+ of the bits within the FCSR register. (Note that the number of bits
+ visible depends on the ISA in use, but that is handled elsewhere.) */
+#define SETFCC(cc,v) \
+ do { \
+ (FCSR = ((FCSR & ~(1 << fcsr_FCC_bit(cc))) | ((v) << fcsr_FCC_bit(cc)))); \
+ } while (0)
+#define GETFCC(cc) ((FCSR & (1 << fcsr_FCC_bit(cc))) != 0 ? 1 : 0)
+
+
+/* Read flush-to-zero bit (not right-justified). */
+#define GETFS() ((int)(FCSR & fcsr_FS))
+
+
+/* FCSR flag bits definitions and access macros. */
+#define IR 0 /* I: Inexact Result */
+#define UF 1 /* U: UnderFlow */
+#define OF 2 /* O: OverFlow */
+#define DZ 3 /* Z: Division by Zero */
+#define IO 4 /* V: Invalid Operation */
+#define UO 5 /* E: Unimplemented Operation (CAUSE field only) */
+
+#define FP_FLAGS(b) (1 << ((b) + fcsr_FLAGS_shift))
+#define FP_ENABLE(b) (1 << ((b) + fcsr_ENABLES_shift))
+#define FP_CAUSE(b) (1 << ((b) + fcsr_CAUSE_shift))
+
+
+/* Rounding mode bit definitions and access macros. */
+#define FP_RM_NEAREST 0 /* Round to nearest (Round). */
+#define FP_RM_TOZERO 1 /* Round to zero (Trunc). */
+#define FP_RM_TOPINF 2 /* Round to Plus infinity (Ceil). */
+#define FP_RM_TOMINF 3 /* Round to Minus infinity (Floor). */
+
+#define GETRM() ((FCSR >> fcsr_RM_shift) & fcsr_RM_mask)
+
+
+#endif /* CP1_H */
diff --git a/sim/mips/interp.c b/sim/mips/interp.c
index 805f72a9236..d069d2bc834 100644
--- a/sim/mips/interp.c
+++ b/sim/mips/interp.c
@@ -61,8 +61,8 @@ code on the hardware.
#include "getopt.h"
#include "libiberty.h"
#include "bfd.h"
-#include "callback.h" /* GDB simulator callback interface */
-#include "remote-sim.h" /* GDB simulator interface */
+#include "gdb/callback.h" /* GDB simulator callback interface */
+#include "gdb/remote-sim.h" /* GDB simulator interface */
#include "sysdep.h"
@@ -575,7 +575,7 @@ sim_open (kind, cb, abfd, argv)
{
if (rn < 32)
cpu->register_widths[rn] = WITH_TARGET_WORD_BITSIZE;
- else if ((rn >= FGRIDX) && (rn < (FGRIDX + NR_FGR)))
+ else if ((rn >= FGR_BASE) && (rn < (FGR_BASE + NR_FGR)))
cpu->register_widths[rn] = WITH_TARGET_FLOATING_POINT_BITSIZE;
else if ((rn >= 33) && (rn <= 37))
cpu->register_widths[rn] = WITH_TARGET_WORD_BITSIZE;
@@ -849,26 +849,26 @@ sim_store_register (sd,rn,memory,length)
- if (rn >= FGRIDX && rn < FGRIDX + NR_FGR)
+ if (rn >= FGR_BASE && rn < FGR_BASE + NR_FGR)
{
- cpu->fpr_state[rn - FGRIDX] = fmt_uninterpreted;
+ cpu->fpr_state[rn - FGR_BASE] = fmt_uninterpreted;
if (cpu->register_widths[rn] == 32)
{
if (length == 8)
{
- cpu->fgr[rn - FGRIDX] =
+ cpu->fgr[rn - FGR_BASE] =
(unsigned32) T2H_8 (*(unsigned64*)memory);
return 8;
}
else
{
- cpu->fgr[rn - FGRIDX] = T2H_4 (*(unsigned32*)memory);
+ cpu->fgr[rn - FGR_BASE] = T2H_4 (*(unsigned32*)memory);
return 4;
}
}
else
{
- cpu->fgr[rn - FGRIDX] = T2H_8 (*(unsigned64*)memory);
+ cpu->fgr[rn - FGR_BASE] = T2H_8 (*(unsigned64*)memory);
return 8;
}
}
@@ -921,25 +921,25 @@ sim_fetch_register (sd,rn,memory,length)
/* Any floating point register */
- if (rn >= FGRIDX && rn < FGRIDX + NR_FGR)
+ if (rn >= FGR_BASE && rn < FGR_BASE + NR_FGR)
{
if (cpu->register_widths[rn] == 32)
{
if (length == 8)
{
*(unsigned64*)memory =
- H2T_8 ((unsigned32) (cpu->fgr[rn - FGRIDX]));
+ H2T_8 ((unsigned32) (cpu->fgr[rn - FGR_BASE]));
return 8;
}
else
{
- *(unsigned32*)memory = H2T_4 (cpu->fgr[rn - FGRIDX]);
+ *(unsigned32*)memory = H2T_4 (cpu->fgr[rn - FGR_BASE]);
return 4;
}
}
else
{
- *(unsigned64*)memory = H2T_8 (cpu->fgr[rn - FGRIDX]);
+ *(unsigned64*)memory = H2T_8 (cpu->fgr[rn - FGR_BASE]);
return 8;
}
}
@@ -1223,7 +1223,7 @@ sim_monitor (SIM_DESC sd,
break;
}
- case 28 : /* PMON flush_cache */
+ case 28: /* PMON flush_cache */
break;
case 55: /* void get_mem_info(unsigned int *ptr) */
@@ -1242,7 +1242,7 @@ sim_monitor (SIM_DESC sd,
break;
}
- case 158 : /* PMON printf */
+ case 158: /* PMON printf */
/* in: A0 = pointer to format string */
/* A1 = optional argument 1 */
/* A2 = optional argument 2 */
@@ -1671,7 +1671,7 @@ signal_exception (SIM_DESC sd,
switch (exception) {
- case DebugBreakPoint :
+ case DebugBreakPoint:
if (! (Debug & Debug_DM))
{
if (INDELAYSLOT())
@@ -1694,7 +1694,7 @@ signal_exception (SIM_DESC sd,
}
break;
- case ReservedInstruction :
+ case ReservedInstruction:
{
va_list ap;
unsigned int instruction;
@@ -1845,7 +1845,7 @@ signal_exception (SIM_DESC sd,
sim_engine_halt (SD, CPU, NULL, PC,
sim_stopped, SIM_SIGTRAP);
- default : /* Unknown internal exception */
+ default: /* Unknown internal exception */
PC = EPC;
sim_engine_halt (SD, CPU, NULL, PC,
sim_stopped, SIM_SIGABRT);
diff --git a/sim/mips/mdmx.c b/sim/mips/mdmx.c
new file mode 100644
index 00000000000..96abe1ddc12
--- /dev/null
+++ b/sim/mips/mdmx.c
@@ -0,0 +1,1472 @@
+/* Simulation code for the MIPS MDMX ASE.
+ Copyright (C) 2002 Free Software Foundation, Inc.
+ Contributed by Broadcom Corporation (SiByte).
+
+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 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 <stdio.h>
+
+#include "sim-main.h"
+
+/* Within mdmx.c we refer to the sim_cpu directly. */
+#define CPU cpu
+#define SD (CPU_STATE(CPU))
+#define SD_ cpu, cia, -1
+
+/* MDMX Representations
+
+ An 8-bit packed byte element (OB) is always unsigned.
+ The 24-bit accumulators are signed and are represented as 32-bit
+ signed values, which are reduced to 24-bit signed values prior to
+ Round and Clamp operations.
+
+ A 16-bit packed halfword element (QH) is always signed.
+ The 48-bit accumulators are signed and are represented as 64-bit
+ signed values, which are reduced to 48-bit signed values prior to
+ Round and Clamp operations.
+
+ The code below assumes a 2's-complement representation of signed
+ quantities. Care is required to clear extended sign bits when
+ repacking fields.
+
+ The code (and the code for arithmetic shifts in mips.igen) also makes
+ the (not guaranteed portable) assumption that right shifts of signed
+ quantities in C do sign extension. */
+
+typedef unsigned64 unsigned48;
+#define MASK48 (UNSIGNED64 (0xffffffffffff))
+
+typedef unsigned32 unsigned24;
+#define MASK24 (UNSIGNED32 (0xffffff))
+
+typedef enum {
+ mdmx_ob, /* OB (octal byte) */
+ mdmx_qh /* QH (quad half-word) */
+} MX_fmt;
+
+typedef enum {
+ sel_elem, /* element select */
+ sel_vect, /* vector select */
+ sel_imm /* immediate select */
+} VT_select;
+
+#define OB_MAX ((unsigned8)0xFF)
+#define QH_MIN ((signed16)0x8000)
+#define QH_MAX ((signed16)0x7FFF)
+
+#define OB_CLAMP(x) ((unsigned8)((x) > OB_MAX ? OB_MAX : (x)))
+#define QH_CLAMP(x) ((signed16)((x) < QH_MIN ? QH_MIN : \
+ ((x) > QH_MAX ? QH_MAX : (x))))
+
+#define MX_FMT(fmtsel) (((fmtsel) & 0x1) == 0 ? mdmx_ob : mdmx_qh)
+#define MX_VT(fmtsel) (((fmtsel) & 0x10) == 0 ? sel_elem : \
+ (((fmtsel) & 0x18) == 0x10 ? sel_vect : sel_imm))
+
+#define QH_ELEM(v,fmtsel) \
+ ((signed16)(((v) >> (((fmtsel) & 0xC) << 2)) & 0xFFFF))
+#define OB_ELEM(v,fmtsel) \
+ ((unsigned8)(((v) >> (((fmtsel) & 0xE) << 2)) & 0xFF))
+
+
+typedef signed16 (*QH_FUNC)(signed16, signed16);
+typedef unsigned8 (*OB_FUNC)(unsigned8, unsigned8);
+
+/* vectorized logical operators */
+
+static signed16
+AndQH(signed16 ts, signed16 tt)
+{
+ return (signed16)((unsigned16)ts & (unsigned16)tt);
+}
+
+static unsigned8
+AndOB(unsigned8 ts, unsigned8 tt)
+{
+ return ts & tt;
+}
+
+static signed16
+NorQH(signed16 ts, signed16 tt)
+{
+ return (signed16)(((unsigned16)ts | (unsigned16)tt) ^ 0xFFFF);
+}
+
+static unsigned8
+NorOB(unsigned8 ts, unsigned8 tt)
+{
+ return (ts | tt) ^ 0xFF;
+}
+
+static signed16
+OrQH(signed16 ts, signed16 tt)
+{
+ return (signed16)((unsigned16)ts | (unsigned16)tt);
+}
+
+static unsigned8
+OrOB(unsigned8 ts, unsigned8 tt)
+{
+ return ts | tt;
+}
+
+static signed16
+XorQH(signed16 ts, signed16 tt)
+{
+ return (signed16)((unsigned16)ts ^ (unsigned16)tt);
+}
+
+static unsigned8
+XorOB(unsigned8 ts, unsigned8 tt)
+{
+ return ts ^ tt;
+}
+
+static signed16
+SLLQH(signed16 ts, signed16 tt)
+{
+ unsigned32 s = (unsigned32)tt & 0xF;
+ return (signed16)(((unsigned32)ts << s) & 0xFFFF);
+}
+
+static unsigned8
+SLLOB(unsigned8 ts, unsigned8 tt)
+{
+ unsigned32 s = tt & 0x7;
+ return (ts << s) & 0xFF;
+}
+
+static signed16
+SRLQH(signed16 ts, signed16 tt)
+{
+ unsigned32 s = (unsigned32)tt & 0xF;
+ return (signed16)((unsigned16)ts >> s);
+}
+
+static unsigned8
+SRLOB(unsigned8 ts, unsigned8 tt)
+{
+ unsigned32 s = tt & 0x7;
+ return ts >> s;
+}
+
+
+/* Vectorized arithmetic operators. */
+
+static signed16
+AddQH(signed16 ts, signed16 tt)
+{
+ signed32 t = (signed32)ts + (signed32)tt;
+ return QH_CLAMP(t);
+}
+
+static unsigned8
+AddOB(unsigned8 ts, unsigned8 tt)
+{
+ unsigned32 t = (unsigned32)ts + (unsigned32)tt;
+ return OB_CLAMP(t);
+}
+
+static signed16
+SubQH(signed16 ts, signed16 tt)
+{
+ signed32 t = (signed32)ts - (signed32)tt;
+ return QH_CLAMP(t);
+}
+
+static unsigned8
+SubOB(unsigned8 ts, unsigned8 tt)
+{
+ signed32 t;
+ t = (signed32)ts - (signed32)tt;
+ if (t < 0)
+ t = 0;
+ return (unsigned8)t;
+}
+
+static signed16
+MinQH(signed16 ts, signed16 tt)
+{
+ return (ts < tt ? ts : tt);
+}
+
+static unsigned8
+MinOB(unsigned8 ts, unsigned8 tt)
+{
+ return (ts < tt ? ts : tt);
+}
+
+static signed16
+MaxQH(signed16 ts, signed16 tt)
+{
+ return (ts > tt ? ts : tt);
+}
+
+static unsigned8
+MaxOB(unsigned8 ts, unsigned8 tt)
+{
+ return (ts > tt ? ts : tt);
+}
+
+static signed16
+MulQH(signed16 ts, signed16 tt)
+{
+ signed32 t = (signed32)ts * (signed32)tt;
+ return QH_CLAMP(t);
+}
+
+static unsigned8
+MulOB(unsigned8 ts, unsigned8 tt)
+{
+ unsigned32 t = (unsigned32)ts * (unsigned32)tt;
+ return OB_CLAMP(t);
+}
+
+/* "msgn" and "sra" are defined only for QH format. */
+
+static signed16
+MsgnQH(signed16 ts, signed16 tt)
+{
+ signed16 t;
+ if (ts < 0)
+ t = (tt == QH_MIN ? QH_MAX : -tt);
+ else if (ts == 0)
+ t = 0;
+ else
+ t = tt;
+ return t;
+}
+
+static signed16
+SRAQH(signed16 ts, signed16 tt)
+{
+ unsigned32 s = (unsigned32)tt & 0xF;
+ return (signed16)((signed32)ts >> s);
+}
+
+
+/* "pabsdiff" and "pavg" are defined only for OB format. */
+
+static unsigned8
+AbsDiffOB(unsigned8 ts, unsigned8 tt)
+{
+ return (ts >= tt ? ts - tt : tt - ts);
+}
+
+static unsigned8
+AvgOB(unsigned8 ts, unsigned8 tt)
+{
+ return ((unsigned32)ts + (unsigned32)tt + 1) >> 1;
+}
+
+
+/* Dispatch tables for operations that update a CPR. */
+
+static const QH_FUNC qh_func[] = {
+ AndQH, NorQH, OrQH, XorQH, SLLQH, SRLQH,
+ AddQH, SubQH, MinQH, MaxQH,
+ MulQH, MsgnQH, SRAQH, NULL, NULL
+};
+
+static const OB_FUNC ob_func[] = {
+ AndOB, NorOB, OrOB, XorOB, SLLOB, SRLOB,
+ AddOB, SubOB, MinOB, MaxOB,
+ MulOB, NULL, NULL, AbsDiffOB, AvgOB
+};
+
+/* Auxiliary functions for CPR updates. */
+
+/* Vector mapping for QH format. */
+static unsigned64
+qh_vector_op(unsigned64 v1, unsigned64 v2, QH_FUNC func)
+{
+ unsigned64 result = 0;
+ int i;
+ signed16 h, h1, h2;
+
+ for (i = 0; i < 64; i += 16)
+ {
+ h1 = (signed16)(v1 & 0xFFFF); v1 >>= 16;
+ h2 = (signed16)(v2 & 0xFFFF); v2 >>= 16;
+ h = (*func)(h1, h2);
+ result |= ((unsigned64)((unsigned16)h) << i);
+ }
+ return result;
+}
+
+static unsigned64
+qh_map_op(unsigned64 v1, signed16 h2, QH_FUNC func)
+{
+ unsigned64 result = 0;
+ int i;
+ signed16 h, h1;
+
+ for (i = 0; i < 64; i += 16)
+ {
+ h1 = (signed16)(v1 & 0xFFFF); v1 >>= 16;
+ h = (*func)(h1, h2);
+ result |= ((unsigned64)((unsigned16)h) << i);
+ }
+ return result;
+}
+
+
+/* Vector operations for OB format. */
+
+static unsigned64
+ob_vector_op(unsigned64 v1, unsigned64 v2, OB_FUNC func)
+{
+ unsigned64 result = 0;
+ int i;
+ unsigned8 b, b1, b2;
+
+ for (i = 0; i < 64; i += 8)
+ {
+ b1 = v1 & 0xFF; v1 >>= 8;
+ b2 = v2 & 0xFF; v2 >>= 8;
+ b = (*func)(b1, b2);
+ result |= ((unsigned64)b << i);
+ }
+ return result;
+}
+
+static unsigned64
+ob_map_op(unsigned64 v1, unsigned8 b2, OB_FUNC func)
+{
+ unsigned64 result = 0;
+ int i;
+ unsigned8 b, b1;
+
+ for (i = 0; i < 64; i += 8)
+ {
+ b1 = v1 & 0xFF; v1 >>= 8;
+ b = (*func)(b1, b2);
+ result |= ((unsigned64)b << i);
+ }
+ return result;
+}
+
+
+/* Primary entry for operations that update CPRs. */
+unsigned64
+mdmx_cpr_op(sim_cpu *cpu,
+ address_word cia,
+ int op,
+ unsigned64 op1,
+ int vt,
+ MX_fmtsel fmtsel)
+{
+ unsigned64 op2;
+ unsigned64 result = 0;
+
+ switch (MX_FMT (fmtsel))
+ {
+ case mdmx_qh:
+ switch (MX_VT (fmtsel))
+ {
+ case sel_elem:
+ op2 = ValueFPR(vt, fmt_mdmx);
+ result = qh_map_op(op1, QH_ELEM(op2, fmtsel), qh_func[op]);
+ break;
+ case sel_vect:
+ result = qh_vector_op(op1, ValueFPR(vt, fmt_mdmx), qh_func[op]);
+ break;
+ case sel_imm:
+ result = qh_map_op(op1, vt, qh_func[op]);
+ break;
+ }
+ break;
+ case mdmx_ob:
+ switch (MX_VT (fmtsel))
+ {
+ case sel_elem:
+ op2 = ValueFPR(vt, fmt_mdmx);
+ result = ob_map_op(op1, OB_ELEM(op2, fmtsel), ob_func[op]);
+ break;
+ case sel_vect:
+ result = ob_vector_op(op1, ValueFPR(vt, fmt_mdmx), ob_func[op]);
+ break;
+ case sel_imm:
+ result = ob_map_op(op1, vt, ob_func[op]);
+ break;
+ }
+ break;
+ default:
+ Unpredictable ();
+ }
+
+ return result;
+}
+
+
+/* Operations that update CCs */
+
+static void
+qh_vector_test(sim_cpu *cpu, unsigned64 v1, unsigned64 v2, int cond)
+{
+ int i;
+ signed16 h1, h2;
+ int boolean;
+
+ for (i = 0; i < 4; i++)
+ {
+ h1 = (signed16)(v1 & 0xFFFF); v1 >>= 16;
+ h2 = (signed16)(v2 & 0xFFFF); v2 >>= 16;
+ boolean = ((cond & MX_C_EQ) && (h1 == h2)) ||
+ ((cond & MX_C_LT) && (h1 < h2));
+ SETFCC(i, boolean);
+ }
+}
+
+static void
+qh_map_test(sim_cpu *cpu, unsigned64 v1, signed16 h2, int cond)
+{
+ int i;
+ signed16 h1;
+ int boolean;
+
+ for (i = 0; i < 4; i++)
+ {
+ h1 = (signed16)(v1 & 0xFFFF); v1 >>= 16;
+ boolean = ((cond & MX_C_EQ) && (h1 == h2)) ||
+ ((cond & MX_C_LT) && (h1 < h2));
+ SETFCC(i, boolean);
+ }
+}
+
+static void
+ob_vector_test(sim_cpu *cpu, unsigned64 v1, unsigned64 v2, int cond)
+{
+ int i;
+ unsigned8 b1, b2;
+ int boolean;
+
+ for (i = 0; i < 8; i++)
+ {
+ b1 = v1 & 0xFF; v1 >>= 8;
+ b2 = v2 & 0xFF; v2 >>= 8;
+ boolean = ((cond & MX_C_EQ) && (b1 == b2)) ||
+ ((cond & MX_C_LT) && (b1 < b2));
+ SETFCC(i, boolean);
+ }
+}
+
+static void
+ob_map_test(sim_cpu *cpu, unsigned64 v1, unsigned8 b2, int cond)
+{
+ int i;
+ unsigned8 b1;
+ int boolean;
+
+ for (i = 0; i < 8; i++)
+ {
+ b1 = (unsigned8)(v1 & 0xFF); v1 >>= 8;
+ boolean = ((cond & MX_C_EQ) && (b1 == b2)) ||
+ ((cond & MX_C_LT) && (b1 < b2));
+ SETFCC(i, boolean);
+ }
+}
+
+
+void
+mdmx_cc_op(sim_cpu *cpu,
+ address_word cia,
+ int cond,
+ unsigned64 v1,
+ int vt,
+ MX_fmtsel fmtsel)
+{
+ unsigned64 op2;
+
+ switch (MX_FMT (fmtsel))
+ {
+ case mdmx_qh:
+ switch (MX_VT (fmtsel))
+ {
+ case sel_elem:
+ op2 = ValueFPR(vt, fmt_mdmx);
+ qh_map_test(cpu, v1, QH_ELEM(op2, fmtsel), cond);
+ break;
+ case sel_vect:
+ qh_vector_test(cpu, v1, ValueFPR(vt, fmt_mdmx), cond);
+ break;
+ case sel_imm:
+ qh_map_test(cpu, v1, vt, cond);
+ break;
+ }
+ break;
+ case mdmx_ob:
+ switch (MX_VT (fmtsel))
+ {
+ case sel_elem:
+ op2 = ValueFPR(vt, fmt_mdmx);
+ ob_map_test(cpu, v1, OB_ELEM(op2, fmtsel), cond);
+ break;
+ case sel_vect:
+ ob_vector_test(cpu, v1, ValueFPR(vt, fmt_mdmx), cond);
+ break;
+ case sel_imm:
+ ob_map_test(cpu, v1, vt, cond);
+ break;
+ }
+ break;
+ default:
+ Unpredictable ();
+ }
+}
+
+
+/* Pick operations. */
+
+static unsigned64
+qh_vector_pick(sim_cpu *cpu, unsigned64 v1, unsigned64 v2, int tf)
+{
+ unsigned64 result = 0;
+ int i, s;
+ unsigned16 h;
+
+ s = 0;
+ for (i = 0; i < 4; i++)
+ {
+ h = ((GETFCC(i) == tf) ? (v1 & 0xFFFF) : (v2 & 0xFFFF));
+ v1 >>= 16; v2 >>= 16;
+ result |= ((unsigned64)h << s);
+ s += 16;
+ }
+ return result;
+}
+
+static unsigned64
+qh_map_pick(sim_cpu *cpu, unsigned64 v1, signed16 h2, int tf)
+{
+ unsigned64 result = 0;
+ int i, s;
+ unsigned16 h;
+
+ s = 0;
+ for (i = 0; i < 4; i++)
+ {
+ h = (GETFCC(i) == tf) ? (v1 & 0xFFFF) : (unsigned16)h2;
+ v1 >>= 16;
+ result |= ((unsigned64)h << s);
+ s += 16;
+ }
+ return result;
+}
+
+static unsigned64
+ob_vector_pick(sim_cpu *cpu, unsigned64 v1, unsigned64 v2, int tf)
+{
+ unsigned64 result = 0;
+ int i, s;
+ unsigned8 b;
+
+ s = 0;
+ for (i = 0; i < 8; i++)
+ {
+ b = (GETFCC(i) == tf) ? (v1 & 0xFF) : (v2 & 0xFF);
+ v1 >>= 8; v2 >>= 8;
+ result |= ((unsigned64)b << s);
+ s += 8;
+ }
+ return result;
+}
+
+static unsigned64
+ob_map_pick(sim_cpu *cpu, unsigned64 v1, unsigned8 b2, int tf)
+{
+ unsigned64 result = 0;
+ int i, s;
+ unsigned8 b;
+
+ s = 0;
+ for (i = 0; i < 8; i++)
+ {
+ b = (GETFCC(i) == tf) ? (v1 & 0xFF) : b2;
+ v1 >>= 8;
+ result |= ((unsigned64)b << s);
+ s += 8;
+ }
+ return result;
+}
+
+
+unsigned64
+mdmx_pick_op(sim_cpu *cpu,
+ address_word cia,
+ int tf,
+ unsigned64 v1,
+ int vt,
+ MX_fmtsel fmtsel)
+{
+ unsigned64 result = 0;
+ unsigned64 op2;
+
+ switch (MX_FMT (fmtsel))
+ {
+ case mdmx_qh:
+ switch (MX_VT (fmtsel))
+ {
+ case sel_elem:
+ op2 = ValueFPR(vt, fmt_mdmx);
+ result = qh_map_pick(cpu, v1, QH_ELEM(op2, fmtsel), tf);
+ break;
+ case sel_vect:
+ result = qh_vector_pick(cpu, v1, ValueFPR(vt, fmt_mdmx), tf);
+ break;
+ case sel_imm:
+ result = qh_map_pick(cpu, v1, vt, tf);
+ break;
+ }
+ break;
+ case mdmx_ob:
+ switch (MX_VT (fmtsel))
+ {
+ case sel_elem:
+ op2 = ValueFPR(vt, fmt_mdmx);
+ result = ob_map_pick(cpu, v1, OB_ELEM(op2, fmtsel), tf);
+ break;
+ case sel_vect:
+ result = ob_vector_pick(cpu, v1, ValueFPR(vt, fmt_mdmx), tf);
+ break;
+ case sel_imm:
+ result = ob_map_pick(cpu, v1, vt, tf);
+ break;
+ }
+ break;
+ default:
+ Unpredictable ();
+ }
+ return result;
+}
+
+
+/* Accumulators. */
+
+typedef void (*QH_ACC)(signed48 *a, signed16 ts, signed16 tt);
+
+static void
+AccAddAQH(signed48 *a, signed16 ts, signed16 tt)
+{
+ *a += (signed48)ts + (signed48)tt;
+}
+
+static void
+AccAddLQH(signed48 *a, signed16 ts, signed16 tt)
+{
+ *a = (signed48)ts + (signed48)tt;
+}
+
+static void
+AccMulAQH(signed48 *a, signed16 ts, signed16 tt)
+{
+ *a += (signed48)ts * (signed48)tt;
+}
+
+static void
+AccMulLQH(signed48 *a, signed16 ts, signed16 tt)
+{
+ *a = (signed48)ts * (signed48)tt;
+}
+
+static void
+SubMulAQH(signed48 *a, signed16 ts, signed16 tt)
+{
+ *a -= (signed48)ts * (signed48)tt;
+}
+
+static void
+SubMulLQH(signed48 *a, signed16 ts, signed16 tt)
+{
+ *a = -((signed48)ts * (signed48)tt);
+}
+
+static void
+AccSubAQH(signed48 *a, signed16 ts, signed16 tt)
+{
+ *a += (signed48)ts - (signed48)tt;
+}
+
+static void
+AccSubLQH(signed48 *a, signed16 ts, signed16 tt)
+{
+ *a = (signed48)ts - (signed48)tt;
+}
+
+
+typedef void (*OB_ACC)(signed24 *acc, unsigned8 ts, unsigned8 tt);
+
+static void
+AccAddAOB(signed24 *a, unsigned8 ts, unsigned8 tt)
+{
+ *a += (signed24)ts + (signed24)tt;
+}
+
+static void
+AccAddLOB(signed24 *a, unsigned8 ts, unsigned8 tt)
+{
+ *a = (signed24)ts + (signed24)tt;
+}
+
+static void
+AccMulAOB(signed24 *a, unsigned8 ts, unsigned8 tt)
+{
+ *a += (signed24)ts * (signed24)tt;
+}
+
+static void
+AccMulLOB(signed24 *a, unsigned8 ts, unsigned8 tt)
+{
+ *a = (signed24)ts * (signed24)tt;
+}
+
+static void
+SubMulAOB(signed24 *a, unsigned8 ts, unsigned8 tt)
+{
+ *a -= (signed24)ts * (signed24)tt;
+}
+
+static void
+SubMulLOB(signed24 *a, unsigned8 ts, unsigned8 tt)
+{
+ *a = -((signed24)ts * (signed24)tt);
+}
+
+static void
+AccSubAOB(signed24 *a, unsigned8 ts, unsigned8 tt)
+{
+ *a += (signed24)ts - (signed24)tt;
+}
+
+static void
+AccSubLOB(signed24 *a, unsigned8 ts, unsigned8 tt)
+{
+ *a = (signed24)ts - (signed24)tt;
+}
+
+static void
+AccAbsDiffOB(signed24 *a, unsigned8 ts, unsigned8 tt)
+{
+ unsigned8 t = (ts >= tt ? ts - tt : tt - ts);
+ *a += (signed24)t;
+}
+
+
+/* Dispatch tables for operations that update a CPR. */
+
+static const QH_ACC qh_acc[] = {
+ AccAddAQH, AccAddAQH, AccMulAQH, AccMulLQH,
+ SubMulAQH, SubMulLQH, AccSubAQH, AccSubLQH,
+ NULL
+};
+
+static const OB_ACC ob_acc[] = {
+ AccAddAOB, AccAddLOB, AccMulAOB, AccMulLOB,
+ SubMulAOB, SubMulLOB, AccSubAOB, AccSubLOB,
+ AccAbsDiffOB
+};
+
+
+static void
+qh_vector_acc(signed48 a[], unsigned64 v1, unsigned64 v2, QH_ACC acc)
+{
+ int i;
+ signed16 h1, h2;
+
+ for (i = 0; i < 4; i++)
+ {
+ h1 = (signed16)(v1 & 0xFFFF); v1 >>= 16;
+ h2 = (signed16)(v2 & 0xFFFF); v2 >>= 16;
+ (*acc)(&a[i], h1, h2);
+ }
+}
+
+static void
+qh_map_acc(signed48 a[], unsigned64 v1, signed16 h2, QH_ACC acc)
+{
+ int i;
+ signed16 h1;
+
+ for (i = 0; i < 4; i++)
+ {
+ h1 = (signed16)(v1 & 0xFFFF); v1 >>= 16;
+ (*acc)(&a[i], h1, h2);
+ }
+}
+
+static void
+ob_vector_acc(signed24 a[], unsigned64 v1, unsigned64 v2, OB_ACC acc)
+{
+ int i;
+ unsigned8 b1, b2;
+
+ for (i = 0; i < 8; i++)
+ {
+ b1 = v1 & 0xFF; v1 >>= 8;
+ b2 = v2 & 0xFF; v2 >>= 8;
+ (*acc)(&a[i], b1, b2);
+ }
+}
+
+static void
+ob_map_acc(signed24 a[], unsigned64 v1, unsigned8 b2, OB_ACC acc)
+{
+ int i;
+ unsigned8 b1;
+
+ for (i = 0; i < 8; i++)
+ {
+ b1 = v1 & 0xFF; v1 >>= 8;
+ (*acc)(&a[i], b1, b2);
+ }
+}
+
+
+/* Primary entry for operations that accumulate */
+void
+mdmx_acc_op(sim_cpu *cpu,
+ address_word cia,
+ int op,
+ unsigned64 op1,
+ int vt,
+ MX_fmtsel fmtsel)
+{
+ unsigned64 op2;
+
+ switch (MX_FMT (fmtsel))
+ {
+ case mdmx_qh:
+ switch (MX_VT (fmtsel))
+ {
+ case sel_elem:
+ op2 = ValueFPR(vt, fmt_mdmx);
+ qh_map_acc(ACC.qh, op1, QH_ELEM(op2, fmtsel), qh_acc[op]);
+ break;
+ case sel_vect:
+ qh_vector_acc(ACC.qh, op1, ValueFPR(vt, fmt_mdmx), qh_acc[op]);
+ break;
+ case sel_imm:
+ qh_map_acc(ACC.qh, op1, vt, qh_acc[op]);
+ break;
+ }
+ break;
+ case mdmx_ob:
+ switch (MX_VT (fmtsel))
+ {
+ case sel_elem:
+ op2 = ValueFPR(vt, fmt_mdmx);
+ ob_map_acc(ACC.ob, op1, OB_ELEM(op2, fmtsel), ob_acc[op]);
+ break;
+ case sel_vect:
+ ob_vector_acc(ACC.ob, op1, ValueFPR(vt, fmt_mdmx), ob_acc[op]);
+ break;
+ case sel_imm:
+ ob_map_acc(ACC.ob, op1, op2, ob_acc[op]);
+ break;
+ }
+ break;
+ default:
+ Unpredictable ();
+ }
+}
+
+
+/* Reading and writing accumulator (no conversion). */
+
+unsigned64
+mdmx_rac_op(sim_cpu *cpu,
+ address_word cia,
+ int op,
+ int fmt)
+{
+ unsigned64 result;
+ unsigned int shift;
+ int i;
+
+ shift = op; /* L = 00, M = 01, H = 10. */
+ result = 0;
+
+ switch (fmt)
+ {
+ case MX_FMT_QH:
+ shift <<= 4; /* 16 bits per element. */
+ for (i = 3; i >= 0; --i)
+ {
+ result <<= 16;
+ result |= ((ACC.qh[i] >> shift) & 0xFFFF);
+ }
+ break;
+ case MX_FMT_OB:
+ shift <<= 3; /* 8 bits per element. */
+ for (i = 7; i >= 0; --i)
+ {
+ result <<= 8;
+ result |= ((ACC.ob[i] >> shift) & 0xFF);
+ }
+ break;
+ default:
+ Unpredictable ();
+ }
+ return result;
+}
+
+void
+mdmx_wacl(sim_cpu *cpu,
+ address_word cia,
+ int fmt,
+ unsigned64 vs,
+ unsigned64 vt)
+{
+ int i;
+
+ switch (fmt)
+ {
+ case MX_FMT_QH:
+ for (i = 0; i < 4; i++)
+ {
+ signed32 s = (signed16)(vs & 0xFFFF);
+ ACC.qh[i] = ((signed48)s << 16) | (vt & 0xFFFF);
+ vs >>= 16; vt >>= 16;
+ }
+ break;
+ case MX_FMT_OB:
+ for (i = 0; i < 8; i++)
+ {
+ signed16 s = (signed8)(vs & 0xFF);
+ ACC.ob[i] = ((signed24)s << 8) | (vt & 0xFF);
+ vs >>= 8; vt >>= 8;
+ }
+ break;
+ default:
+ Unpredictable ();
+ }
+}
+
+void
+mdmx_wach(sim_cpu *cpu,
+ address_word cia,
+ int fmt,
+ unsigned64 vs)
+{
+ int i;
+
+ switch (fmt)
+ {
+ case MX_FMT_QH:
+ for (i = 0; i < 4; i++)
+ {
+ signed32 s = (signed16)(vs & 0xFFFF);
+ ACC.qh[i] &= ~((signed48)0xFFFF << 32);
+ ACC.qh[i] |= ((signed48)s << 32);
+ vs >>= 16;
+ }
+ break;
+ case MX_FMT_OB:
+ for (i = 0; i < 8; i++)
+ {
+ ACC.ob[i] &= ~((signed24)0xFF << 16);
+ ACC.ob[i] |= ((signed24)(vs & 0xFF) << 16);
+ vs >>= 8;
+ }
+ break;
+ default:
+ Unpredictable ();
+ }
+}
+
+
+/* Reading and writing accumulator (rounding conversions).
+ Enumerating function guarantees s >= 0 for QH ops. */
+
+typedef signed16 (*QH_ROUND)(signed48 a, signed16 s);
+
+#define QH_BIT(n) ((unsigned48)1 << (n))
+#define QH_ONES(n) (((unsigned48)1 << (n))-1)
+
+static signed16
+RNASQH(signed48 a, signed16 s)
+{
+ signed48 t;
+ signed16 result = 0;
+
+ if (s > 48)
+ result = 0;
+ else
+ {
+ t = (a >> s);
+ if ((a & QH_BIT(47)) == 0)
+ {
+ if (s > 0 && ((a >> (s-1)) & 1) == 1)
+ t++;
+ if (t > QH_MAX)
+ t = QH_MAX;
+ }
+ else
+ {
+ if (s > 0 && ((a >> (s-1)) & 1) == 1)
+ {
+ if (s > 1 && ((unsigned48)a & QH_ONES(s-1)) != 0)
+ t++;
+ }
+ if (t < QH_MIN)
+ t = QH_MIN;
+ }
+ result = (signed16)t;
+ }
+ return result;
+}
+
+static signed16
+RNAUQH(signed48 a, signed16 s)
+{
+ unsigned48 t;
+ signed16 result;
+
+ if (s > 48)
+ result = 0;
+ else if (s == 48)
+ result = ((unsigned48)a & MASK48) >> 47;
+ else
+ {
+ t = ((unsigned48)a & MASK48) >> s;
+ if (s > 0 && ((a >> (s-1)) & 1) == 1)
+ t++;
+ if (t > 0xFFFF)
+ t = 0xFFFF;
+ result = (signed16)t;
+ }
+ return result;
+}
+
+static signed16
+RNESQH(signed48 a, signed16 s)
+{
+ signed48 t;
+ signed16 result = 0;
+
+ if (s > 47)
+ result = 0;
+ else
+ {
+ t = (a >> s);
+ if (s > 0 && ((a >> (s-1)) & 1) == 1)
+ {
+ if (s == 1 || (a & QH_ONES(s-1)) == 0)
+ t += t & 1;
+ else
+ t += 1;
+ }
+ if ((a & QH_BIT(47)) == 0)
+ {
+ if (t > QH_MAX)
+ t = QH_MAX;
+ }
+ else
+ {
+ if (t < QH_MIN)
+ t = QH_MIN;
+ }
+ result = (signed16)t;
+ }
+ return result;
+}
+
+static signed16
+RNEUQH(signed48 a, signed16 s)
+{
+ unsigned48 t;
+ signed16 result;
+
+ if (s > 48)
+ result = 0;
+ else if (s == 48)
+ result = ((unsigned48)a > QH_BIT(47) ? 1 : 0);
+ else
+ {
+ t = ((unsigned48)a & MASK48) >> s;
+ if (s > 0 && ((a >> (s-1)) & 1) == 1)
+ {
+ if (s > 1 && (a & QH_ONES(s-1)) != 0)
+ t++;
+ else
+ t += t & 1;
+ }
+ if (t > 0xFFFF)
+ t = 0xFFFF;
+ result = (signed16)t;
+ }
+ return result;
+}
+
+static signed16
+RZSQH(signed48 a, signed16 s)
+{
+ signed48 t;
+ signed16 result = 0;
+
+ if (s > 47)
+ result = 0;
+ else
+ {
+ t = (a >> s);
+ if ((a & QH_BIT(47)) == 0)
+ {
+ if (t > QH_MAX)
+ t = QH_MAX;
+ }
+ else
+ {
+ if (t < QH_MIN)
+ t = QH_MIN;
+ }
+ result = (signed16)t;
+ }
+ return result;
+}
+
+static signed16
+RZUQH(signed48 a, signed16 s)
+{
+ unsigned48 t;
+ signed16 result = 0;
+
+ if (s > 48)
+ result = 0;
+ else if (s == 48)
+ result = ((unsigned48)a > QH_BIT(47) ? 1 : 0);
+ else
+ {
+ t = ((unsigned48)a & MASK48) >> s;
+ if (t > 0xFFFF)
+ t = 0xFFFF;
+ result = (signed16)t;
+ }
+ return result;
+}
+
+
+typedef unsigned8 (*OB_ROUND)(signed24 a, unsigned8 s);
+
+#define OB_BIT(n) ((unsigned24)1 << (n))
+#define OB_ONES(n) (((unsigned24)1 << (n))-1)
+
+static unsigned8
+RNAUOB(signed24 a, unsigned8 s)
+{
+ unsigned8 result;
+ unsigned24 t;
+
+ if (s > 24)
+ result = 0;
+ else if (s == 24)
+ result = ((unsigned24)a & MASK24) >> 23;
+ else
+ {
+ t = ((unsigned24)a & MASK24) >> s;
+ if (s > 0 && ((a >> (s-1)) & 1) == 1)
+ t ++;
+ result = OB_CLAMP(t);
+ }
+ return result;
+}
+
+static unsigned8
+RNEUOB(signed24 a, unsigned8 s)
+{
+ unsigned8 result;
+ unsigned24 t;
+
+ if (s > 24)
+ result = 0;
+ else if (s == 24)
+ result = (((unsigned24)a & MASK24) > OB_BIT(23) ? 1 : 0);
+ else
+ {
+ t = ((unsigned24)a & MASK24) >> s;
+ if (s > 0 && ((a >> (s-1)) & 1) == 1)
+ {
+ if (s > 1 && (a & OB_ONES(s-1)) != 0)
+ t++;
+ else
+ t += t & 1;
+ }
+ result = OB_CLAMP(t);
+ }
+ return result;
+}
+
+static unsigned8
+RZUOB(signed24 a, unsigned8 s)
+{
+ unsigned8 result;
+ unsigned24 t;
+
+ if (s >= 24)
+ result = 0;
+ else
+ {
+ t = ((unsigned24)a & MASK24) >> s;
+ result = OB_CLAMP(t);
+ }
+ return result;
+}
+
+
+static const QH_ROUND qh_round[] = {
+ RNASQH, RNAUQH, RNESQH, RNEUQH, RZSQH, RZUQH
+};
+
+static const OB_ROUND ob_round[] = {
+ NULL, RNAUOB, NULL, RNEUOB, NULL, RZUOB
+};
+
+
+static unsigned64
+qh_vector_round(sim_cpu *cpu, address_word cia, unsigned64 v2, QH_ROUND round)
+{
+ unsigned64 result = 0;
+ int i, s;
+ signed16 h, h2;
+
+ s = 0;
+ for (i = 0; i < 4; i++)
+ {
+ h2 = (signed16)(v2 & 0xFFFF);
+ if (h2 >= 0)
+ h = (*round)(ACC.qh[i], h2);
+ else
+ {
+ UnpredictableResult ();
+ h = 0xdead;
+ }
+ v2 >>= 16;
+ result |= ((unsigned64)((unsigned16)h) << s);
+ s += 16;
+ }
+ return result;
+}
+
+static unsigned64
+qh_map_round(sim_cpu *cpu, address_word cia, signed16 h2, QH_ROUND round)
+{
+ unsigned64 result = 0;
+ int i, s;
+ signed16 h;
+
+ s = 0;
+ for (i = 0; i < 4; i++)
+ {
+ if (h2 >= 0)
+ h = (*round)(ACC.qh[i], h2);
+ else
+ {
+ UnpredictableResult ();
+ h = 0xdead;
+ }
+ result |= ((unsigned64)((unsigned16)h) << s);
+ s += 16;
+ }
+ return result;
+}
+
+static unsigned64
+ob_vector_round(sim_cpu *cpu, address_word cia, unsigned64 v2, OB_ROUND round)
+{
+ unsigned64 result = 0;
+ int i, s;
+ unsigned8 b, b2;
+
+ s = 0;
+ for (i = 0; i < 8; i++)
+ {
+ b2 = v2 & 0xFF; v2 >>= 8;
+ b = (*round)(ACC.ob[i], b2);
+ result |= ((unsigned64)b << s);
+ s += 8;
+ }
+ return result;
+}
+
+static unsigned64
+ob_map_round(sim_cpu *cpu, address_word cia, unsigned8 b2, OB_ROUND round)
+{
+ unsigned64 result = 0;
+ int i, s;
+ unsigned8 b;
+
+ s = 0;
+ for (i = 0; i < 8; i++)
+ {
+ b = (*round)(ACC.ob[i], b2);
+ result |= ((unsigned64)b << s);
+ s += 8;
+ }
+ return result;
+}
+
+
+unsigned64
+mdmx_round_op(sim_cpu *cpu,
+ address_word cia,
+ int rm,
+ int vt,
+ MX_fmtsel fmtsel)
+{
+ unsigned64 op2;
+ unsigned64 result = 0;
+
+ switch (MX_FMT (fmtsel))
+ {
+ case mdmx_qh:
+ switch (MX_VT (fmtsel))
+ {
+ case sel_elem:
+ op2 = ValueFPR(vt, fmt_mdmx);
+ result = qh_map_round(cpu, cia, QH_ELEM(op2, fmtsel), qh_round[rm]);
+ break;
+ case sel_vect:
+ op2 = ValueFPR(vt, fmt_mdmx);
+ result = qh_vector_round(cpu, cia, op2, qh_round[rm]);
+ break;
+ case sel_imm:
+ result = qh_map_round(cpu, cia, vt, qh_round[rm]);
+ break;
+ }
+ break;
+ case mdmx_ob:
+ switch (MX_VT (fmtsel))
+ {
+ case sel_elem:
+ op2 = ValueFPR(vt, fmt_mdmx);
+ result = ob_map_round(cpu, cia, OB_ELEM(op2, fmtsel), ob_round[rm]);
+ break;
+ case sel_vect:
+ op2 = ValueFPR(vt, fmt_mdmx);
+ result = ob_vector_round(cpu, cia, op2, ob_round[rm]);
+ break;
+ case sel_imm:
+ result = ob_map_round(cpu, cia, vt, ob_round[rm]);
+ break;
+ }
+ break;
+ default:
+ Unpredictable ();
+ }
+
+ return result;
+}
+
+
+/* Shuffle operation. */
+
+typedef struct {
+ enum {vs, ss, vt} source;
+ unsigned int index;
+} sh_map;
+
+static const sh_map ob_shuffle[][8] = {
+ /* MDMX 2.0 encodings (3-4, 6-7). */
+ /* vr5400 encoding (5), otherwise. */
+ { }, /* RSVD */
+ {{vt,4}, {vs,4}, {vt,5}, {vs,5}, {vt,6}, {vs,6}, {vt,7}, {vs,7}}, /* RSVD */
+ {{vt,0}, {vs,0}, {vt,1}, {vs,1}, {vt,2}, {vs,2}, {vt,3}, {vs,3}}, /* RSVD */
+ {{vs,0}, {ss,0}, {vs,1}, {ss,1}, {vs,2}, {ss,2}, {vs,3}, {ss,3}}, /* upsl */
+ {{vt,1}, {vt,3}, {vt,5}, {vt,7}, {vs,1}, {vs,3}, {vs,5}, {vs,7}}, /* pach */
+ {{vt,0}, {vt,2}, {vt,4}, {vt,6}, {vs,0}, {vs,2}, {vs,4}, {vs,6}}, /* pacl */
+ {{vt,4}, {vs,4}, {vt,5}, {vs,5}, {vt,6}, {vs,6}, {vt,7}, {vs,7}}, /* mixh */
+ {{vt,0}, {vs,0}, {vt,1}, {vs,1}, {vt,2}, {vs,2}, {vt,3}, {vs,3}} /* mixl */
+};
+
+static const sh_map qh_shuffle[][4] = {
+ {{vt,2}, {vs,2}, {vt,3}, {vs,3}}, /* mixh */
+ {{vt,0}, {vs,0}, {vt,1}, {vs,1}}, /* mixl */
+ {{vt,1}, {vt,3}, {vs,1}, {vs,3}}, /* pach */
+ { }, /* RSVD */
+ {{vt,1}, {vs,0}, {vt,3}, {vs,2}}, /* bfla */
+ { }, /* RSVD */
+ {{vt,2}, {vt,3}, {vs,2}, {vs,3}}, /* repa */
+ {{vt,0}, {vt,1}, {vs,0}, {vs,1}} /* repb */
+};
+
+
+unsigned64
+mdmx_shuffle(sim_cpu *cpu,
+ address_word cia,
+ int shop,
+ unsigned64 op1,
+ unsigned64 op2)
+{
+ unsigned64 result = 0;
+ int i, s;
+ int op;
+
+ if ((shop & 0x3) == 0x1) /* QH format. */
+ {
+ op = shop >> 2;
+ s = 0;
+ for (i = 0; i < 4; i++)
+ {
+ unsigned64 v;
+
+ switch (qh_shuffle[op][i].source)
+ {
+ case vs:
+ v = op1;
+ break;
+ case vt:
+ v = op2;
+ break;
+ default:
+ Unpredictable ();
+ v = 0;
+ }
+ result |= (((v >> 16*qh_shuffle[op][i].index) & 0xFFFF) << s);
+ s += 16;
+ }
+ }
+ else if ((shop & 0x1) == 0x0) /* OB format. */
+ {
+ op = shop >> 1;
+ s = 0;
+ for (i = 0; i < 8; i++)
+ {
+ unsigned8 b;
+ unsigned int ishift = 8*ob_shuffle[op][i].index;
+
+ switch (ob_shuffle[op][i].source)
+ {
+ case vs:
+ b = (op1 >> ishift) & 0xFF;
+ break;
+ case ss:
+ b = ((op1 >> ishift) & 0x80) ? 0xFF : 0;
+ break;
+ case vt:
+ b = (op2 >> ishift) & 0xFF;
+ break;
+ default:
+ Unpredictable ();
+ b = 0;
+ }
+ result |= ((unsigned64)b << s);
+ s += 8;
+ }
+ }
+ else
+ Unpredictable ();
+
+ return result;
+}
diff --git a/sim/mips/mdmx.igen b/sim/mips/mdmx.igen
new file mode 100644
index 00000000000..f286e3b4ab4
--- /dev/null
+++ b/sim/mips/mdmx.igen
@@ -0,0 +1,592 @@
+// -*- C -*-
+
+// Simulator definition for the MIPS MDMX ASE.
+// Copyright (C) 2002 Free Software Foundation, Inc.
+// Contributed by Broadcom Corporation (SiByte).
+//
+// 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 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.
+
+// Reference: MIPS64 Architecture Volume IV-b:
+// The MDMX Application-Specific Extension
+
+// Notes on "format selectors" (FMTSEL):
+//
+// A selector with final bit 0 indicates OB format.
+// A selector with final bits 01 indicates QH format.
+// A selector with final bits 11 has UNPREDICTABLE result per the spec.
+//
+// Similarly, for the single-bit fields which differentiate between
+// formats (FMTOP), 0 is OB format and 1 is QH format.
+
+// If you change this file to add instructions, please make sure that model
+// "sb1" configurations still build, and that you've added no new
+// instructions to the "sb1" model.
+
+
+// Helper:
+//
+// Check whether MDMX is usable, and if not signal an appropriate exception.
+//
+
+:function:::void:check_mdmx:instruction_word insn
+*mdmx:
+{
+ if (! COP_Usable (1))
+ SignalExceptionCoProcessorUnusable (1);
+ if ((SR & (status_MX|status_FR)) != (status_MX|status_FR))
+ SignalExceptionMDMX ();
+ check_u64 (SD_, insn);
+}
+
+
+// Helper:
+//
+// Check whether a given MDMX format selector indicates a valid and usable
+// format, and if not signal an appropriate exception.
+//
+
+:function:::int:check_mdmx_fmtsel:instruction_word insn, int fmtsel
+*mdmx:
+{
+ switch (fmtsel & 0x03)
+ {
+ case 0x00: /* ob */
+ case 0x02:
+ case 0x01: /* qh */
+ return 1;
+ case 0x03: /* UNPREDICTABLE */
+ SignalException (ReservedInstruction, insn);
+ return 0;
+ }
+ return 0;
+}
+
+
+// Helper:
+//
+// Check whether a given MDMX format bit indicates a valid and usable
+// format, and if not signal an appropriate exception.
+//
+
+:function:::int:check_mdmx_fmtop:instruction_word insn, int fmtop
+*mdmx:
+{
+ switch (fmtop & 0x01)
+ {
+ case 0x00: /* ob */
+ case 0x01: /* qh */
+ return 1;
+ }
+ return 0;
+}
+
+
+:%s::::FMTSEL:int fmtsel
+*mdmx:
+*sb1:
+{
+ if ((fmtsel & 0x1) == 0)
+ return "ob";
+ else if ((fmtsel & 0x3) == 1)
+ return "qh";
+ else
+ return "?";
+}
+
+
+:%s::::FMTOP:int fmtop
+*mdmx:
+*sb1:
+{
+ switch (fmtop)
+ {
+ case 0: return "ob";
+ case 1: return "qh";
+ default: return "?";
+ }
+}
+
+
+:%s::::SHOP:int shop
+*mdmx:
+*sb1:
+{
+ if ((shop & 0x11) == 0x00)
+ switch ((shop >> 1) & 0x07)
+ {
+ case 3: return "upsl.ob";
+ case 4: return "pach.ob";
+ case 6: return "mixh.ob";
+ case 7: return "mixl.ob";
+ default: return "?";
+ }
+ else if ((shop & 0x03) == 0x01)
+ switch ((shop >> 2) & 0x07)
+ {
+ case 0: return "mixh.qh";
+ case 1: return "mixl.qh";
+ case 2: return "pach.qh";
+ case 4: return "bfla.qh";
+ case 6: return "repa.qh";
+ case 7: return "repb.qh";
+ default: return "?";
+ }
+ else
+ return "?";
+}
+
+
+011110,5.FMTSEL,5.VT,5.VS,5.VD,001011:MDMX:64::ADD.fmt
+"add.%s<FMTSEL> v<VD>, v<VS>, v<VT>"
+*mdmx:
+*sb1:
+{
+ check_mdmx (SD_, instruction_0);
+ if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL))
+ StoreFPR(VD,fmt_mdmx,MX_Add(ValueFPR(VS,fmt_mdmx),VT,FMTSEL));
+}
+
+
+011110,5.FMTSEL,5.VT,5.VS,0,0000,110111:MDMX:64::ADDA.fmt
+"adda.%s<FMTSEL> v<VS>, v<VT>"
+*mdmx:
+*sb1:
+{
+ check_mdmx (SD_, instruction_0);
+ if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL))
+ MX_AddA(ValueFPR(VS,fmt_mdmx),VT,FMTSEL);
+}
+
+
+011110,5.FMTSEL,5.VT,5.VS,1,0000,110111:MDMX:64::ADDL.fmt
+"addl.%s<FMTSEL> v<VS>, v<VT>"
+*mdmx:
+*sb1:
+{
+ check_mdmx (SD_, instruction_0);
+ if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL))
+ MX_AddL(ValueFPR(VS,fmt_mdmx),VT,FMTSEL);
+}
+
+
+011110,00,3.IMM,5.VT,5.VS,5.VD,0110,1.FMTOP,0:MDMX:64::ALNI.fmt
+"alni.%s<FMTOP> v<VD>, v<VS>, v<VT>, <IMM>"
+*mdmx:
+*sb1:
+{
+ unsigned64 result;
+ int s;
+ check_mdmx (SD_, instruction_0);
+ check_mdmx_fmtop (SD_, instruction_0, FMTOP);
+ s = (IMM << 3);
+ result = ValueFPR(VS,fmt_mdmx) << s;
+ if (s != 0) // x86 gcc treats >> 64 as >> 0
+ result |= ValueFPR(VT,fmt_mdmx) >> (64 - s);
+ StoreFPR(VD,fmt_mdmx,result);
+}
+
+
+011110,5.RS,5.VT,5.VS,5.VD,0110,1.FMTOP,1:MDMX:64::ALNV.fmt
+"alnv.%s<FMTOP> v<VD>, v<VS>, v<VT>, r<RS>"
+*mdmx:
+*sb1:
+{
+ unsigned64 result;
+ int s;
+ check_mdmx (SD_, instruction_0);
+ check_mdmx_fmtop (SD_, instruction_0, FMTOP);
+ s = ((GPR[RS] & 0x7) << 3);
+ result = ValueFPR(VS,fmt_mdmx) << s;
+ if (s != 0) // x86 gcc treats >> 64 as >> 0
+ result |= ValueFPR(VT,fmt_mdmx) >> (64 - s);
+ StoreFPR(VD,fmt_mdmx,result);
+}
+
+
+011110,5.FMTSEL,5.VT,5.VS,5.VD,001100:MDMX:64::AND.fmt
+"and.%s<FMTSEL> v<VD>, v<VS>, v<VT>"
+*mdmx:
+*sb1:
+{
+ check_mdmx (SD_, instruction_0);
+ if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL))
+ StoreFPR(VD,fmt_mdmx,MX_And(ValueFPR(VS,fmt_mdmx),VT,FMTSEL));
+}
+
+
+011110,5.FMTSEL,5.VT,5.VS,00000,000001:MDMX:64::C.EQ.fmt
+"c.eq.%s<FMTSEL> v<VS>, v<VT>"
+*mdmx:
+*sb1:
+{
+ check_mdmx (SD_, instruction_0);
+ if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL))
+ MX_Comp(ValueFPR(VS,fmt_mdmx),MX_C_EQ,VT,FMTSEL);
+}
+
+
+011110,5.FMTSEL,5.VT,5.VS,00000,000101:MDMX:64::C.LE.fmt
+"c.le.%s<FMTSEL> v<VS>, v<VT>"
+*mdmx:
+*sb1:
+{
+ check_mdmx (SD_, instruction_0);
+ if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL))
+ MX_Comp(ValueFPR(VS,fmt_mdmx),MX_C_LT|MX_C_EQ,VT,FMTSEL);
+}
+
+
+011110,5.FMTSEL,5.VT,5.VS,00000,000100:MDMX:64::C.LT.fmt
+"c.lt.%s<FMTSEL> v<VS>, v<VT>"
+*mdmx:
+*sb1:
+{
+ check_mdmx (SD_, instruction_0);
+ if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL))
+ MX_Comp(ValueFPR(VS,fmt_mdmx),MX_C_LT,VT,FMTSEL);
+}
+
+
+011110,5.FMTSEL,5.VT,5.VS,5.VD,000111:MDMX:64::MAX.fmt
+"max.%s<FMTSEL> v<VD>, v<VS>, v<VT>"
+*mdmx:
+*sb1:
+{
+ check_mdmx (SD_, instruction_0);
+ if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL))
+ StoreFPR(VD,fmt_mdmx,MX_Max(ValueFPR(VS,fmt_mdmx),VT,FMTSEL));
+}
+
+
+011110,5.FMTSEL,5.VT,5.VS,5.VD,000110:MDMX:64::MIN.fmt
+"min.%s<FMTSEL> v<VD>, v<VS>, v<VT>"
+*mdmx:
+*sb1:
+{
+ check_mdmx (SD_, instruction_0);
+ if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL))
+ StoreFPR(VD,fmt_mdmx,MX_Min(ValueFPR(VS,fmt_mdmx),VT,FMTSEL));
+}
+
+
+011110,3.SEL,01,5.VT,5.VS,5.VD,000000:MDMX:64::MSGN.QH
+"msgn.qh v<VD>, v<VS>, v<VT>"
+*mdmx:
+{
+ check_mdmx (SD_, instruction_0);
+ StoreFPR(VD,fmt_mdmx,MX_Msgn(ValueFPR(VS,fmt_mdmx),VT,qh_fmtsel(SEL)));
+}
+
+
+011110,5.FMTSEL,5.VT,5.VS,5.VD,110000:MDMX:64::MUL.fmt
+"mul.%s<FMTSEL> v<VD>, v<VS>, v<VT>"
+*mdmx:
+*sb1:
+{
+ check_mdmx (SD_, instruction_0);
+ if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL))
+ StoreFPR(VD,fmt_mdmx,MX_Mul(ValueFPR(VS,fmt_mdmx),VT,FMTSEL));
+}
+
+
+011110,5.FMTSEL,5.VT,5.VS,0,0000,110011:MDMX:64::MULA.fmt
+"mula.%s<FMTSEL> v<VS>, v<VT>"
+*mdmx:
+*sb1:
+{
+ check_mdmx (SD_, instruction_0);
+ if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL))
+ MX_MulA(ValueFPR(VS,fmt_mdmx),VT,FMTSEL);
+}
+
+
+011110,5.FMTSEL,5.VT,5.VS,1,0000,110011:MDMX:64::MULL.fmt
+"mull.%s<FMTSEL> v<VS>, v<VT>"
+*mdmx:
+*sb1:
+{
+ check_mdmx (SD_, instruction_0);
+ if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL))
+ MX_MulL(ValueFPR(VS,fmt_mdmx),VT,FMTSEL);
+}
+
+
+011110,5.FMTSEL,5.VT,5.VS,0,0000,110010:MDMX:64::MULS.fmt
+"muls.%s<FMTSEL> v<VS>, v<VT>"
+*mdmx:
+*sb1:
+{
+ check_mdmx (SD_, instruction_0);
+ if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL))
+ MX_MulS(ValueFPR(VS,fmt_mdmx),VT,FMTSEL);
+}
+
+
+011110,5.FMTSEL,5.VT,5.VS,1,0000,110010:MDMX:64::MULSL.fmt
+"mulsl.%s<FMTSEL> v<VS>, v<VT>"
+*mdmx:
+*sb1:
+{
+ check_mdmx (SD_, instruction_0);
+ if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL))
+ MX_MulSL(ValueFPR(VS,fmt_mdmx),VT,FMTSEL);
+}
+
+
+011110,5.FMTSEL,5.VT,5.VS,5.VD,001111:MDMX:64::NOR.fmt
+"nor.%s<FMTSEL> v<VD>, v<VS>, v<VT>"
+*mdmx:
+*sb1:
+{
+ check_mdmx (SD_, instruction_0);
+ if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL))
+ StoreFPR(VD,fmt_mdmx,MX_Nor(ValueFPR(VS,fmt_mdmx),VT,FMTSEL));
+}
+
+
+011110,5.FMTSEL,5.VT,5.VS,5.VD,001110:MDMX:64::OR.fmt
+"or.%s<FMTSEL> v<VD>, v<VS>, v<VT>"
+*mdmx:
+*sb1:
+{
+ check_mdmx (SD_, instruction_0);
+ if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL))
+ StoreFPR(VD,fmt_mdmx,MX_Or(ValueFPR(VS,fmt_mdmx),VT,FMTSEL));
+}
+
+
+011110,5.FMTSEL,5.VT,5.VS,5.VD,000010:MDMX:64::PICKF.fmt
+"pickf.%s<FMTSEL> v<VD>, v<VS>, v<VT>"
+*mdmx:
+*sb1:
+{
+ check_mdmx (SD_, instruction_0);
+ if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL))
+ StoreFPR(VD,fmt_mdmx,MX_Pick(0,ValueFPR(VS,fmt_mdmx),VT,FMTSEL));
+}
+
+
+011110,5.FMTSEL,5.VT,5.VS,5.VD,000011:MDMX:64::PICKT.fmt
+"pickt.%s<FMTSEL> v<VD>, v<VS>, v<VT>"
+*mdmx:
+*sb1:
+{
+ check_mdmx (SD_, instruction_0);
+ if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL))
+ StoreFPR(VD,fmt_mdmx,MX_Pick(1,ValueFPR(VS,fmt_mdmx),VT,FMTSEL));
+}
+
+
+011110,1000,1.FMTOP,00000,00000,5.VD,111111:MDMX:64::RACH.fmt
+"rach.%s<FMTOP> v<VD>"
+*mdmx:
+*sb1:
+{
+ check_mdmx (SD_, instruction_0);
+ check_mdmx_fmtop (SD_, instruction_0, FMTOP);
+ StoreFPR(VD,fmt_mdmx,MX_RAC(MX_RAC_H,FMTOP));
+}
+
+
+011110,0000,1.FMTOP,00000,00000,5.VD,111111:MDMX:64::RACL.fmt
+"racl.%s<FMTOP> v<VD>"
+*mdmx:
+*sb1:
+{
+ check_mdmx (SD_, instruction_0);
+ check_mdmx_fmtop (SD_, instruction_0, FMTOP);
+ StoreFPR(VD,fmt_mdmx,MX_RAC(MX_RAC_L,FMTOP));
+}
+
+
+011110,0100,1.FMTOP,00000,00000,5.VD,111111:MDMX:64::RACM.fmt
+"racm.%s<FMTOP> v<VD>"
+*mdmx:
+*sb1:
+{
+ check_mdmx (SD_, instruction_0);
+ check_mdmx_fmtop (SD_, instruction_0, FMTOP);
+ StoreFPR(VD,fmt_mdmx,MX_RAC(MX_RAC_M,FMTOP));
+}
+
+
+011110,3.SEL,01,5.VT,00000,5.VD,100101:MDMX:64::RNAS.QH
+"rnas.qh v<VD>, v<VT>"
+*mdmx:
+{
+ check_mdmx (SD_, instruction_0);
+ StoreFPR(VD,fmt_mdmx,MX_RNAS(VT,qh_fmtsel(SEL)));
+}
+
+
+011110,5.FMTSEL,5.VT,00000,5.VD,100001:MDMX:64::RNAU.fmt
+"rnau.%s<FMTSEL> v<VD>, v<VT>"
+*mdmx:
+*sb1:
+{
+ check_mdmx (SD_, instruction_0);
+ if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL))
+ StoreFPR(VD,fmt_mdmx,MX_RNAU(VT,FMTSEL));
+}
+
+
+011110,3.SEL,01,5.VT,00000,5.VD,100110:MDMX:64::RNES.QH
+"rnes.qh v<VD>, v<VT>"
+*mdmx:
+{
+ check_mdmx (SD_, instruction_0);
+ StoreFPR(VD,fmt_mdmx,MX_RNES(VT,qh_fmtsel(SEL)));
+}
+
+
+011110,5.FMTSEL,5.VT,00000,5.VD,100010:MDMX:64::RNEU.fmt
+"rneu.%s<FMTSEL> v<VD>, v<VT>"
+*mdmx:
+*sb1:
+{
+ check_mdmx (SD_, instruction_0);
+ if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL))
+ StoreFPR(VD,fmt_mdmx,MX_RNEU(VT,FMTSEL));
+}
+
+
+011110,3.SEL,01,5.VT,00000,5.VD,100100:MDMX:64::RZS.QH
+"rzs.qh v<VD>, v<VT>"
+*mdmx:
+{
+ check_mdmx (SD_, instruction_0);
+ StoreFPR(VD,fmt_mdmx,MX_RZS(VT,qh_fmtsel(SEL)));
+}
+
+
+011110,5.FMTSEL,5.VT,00000,5.VD,100000:MDMX:64::RZU.fmt
+"rzu.%s<FMTSEL> v<VD>, v<VT>"
+*mdmx:
+*sb1:
+{
+ check_mdmx (SD_, instruction_0);
+ if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL))
+ StoreFPR(VD,fmt_mdmx,MX_RZU(VT,FMTSEL));
+}
+
+
+011110,5.SHOP,5.VT,5.VS,5.VD,011111:MDMX:64::SHFL.op.fmt
+"shfl.%s<SHOP> v<VD>, v<VS>, v<VT>"
+*mdmx:
+*sb1:
+{
+ check_mdmx (SD_, instruction_0);
+ if (check_mdmx_fmtsel (SD_, instruction_0, SHOP))
+ StoreFPR(VD,fmt_mdmx,MX_SHFL(SHOP,ValueFPR(VS,fmt_mdmx),ValueFPR(VT,fmt_mdmx)));
+}
+
+
+011110,5.FMTSEL,5.VT,5.VS,5.VD,010000:MDMX:64::SLL.fmt
+"sll.%s<FMTSEL> v<VD>, v<VS>, v<VT>"
+*mdmx:
+*sb1:
+{
+ check_mdmx (SD_, instruction_0);
+ if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL))
+ StoreFPR(VD,fmt_mdmx,MX_ShiftLeftLogical(ValueFPR(VS,fmt_mdmx),VT,FMTSEL));
+}
+
+
+011110,3.SEL,01,5.VT,5.VS,5.VD,010011:MDMX:64::SRA.QH
+"sra.qh v<VD>, v<VS>, v<VT>"
+*mdmx:
+{
+ check_mdmx (SD_, instruction_0);
+ StoreFPR(VD,fmt_mdmx,MX_ShiftRightArith(ValueFPR(VS,fmt_mdmx),VT,qh_fmtsel(SEL)));
+}
+
+
+011110,5.FMTSEL,5.VT,5.VS,5.VD,010010:MDMX:64::SRL.fmt
+"srl.%s<FMTSEL> v<VD>, v<VS>, v<VT>"
+*mdmx:
+*sb1:
+{
+ check_mdmx (SD_, instruction_0);
+ if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL))
+ StoreFPR(VD,fmt_mdmx,MX_ShiftRightLogical(ValueFPR(VS,fmt_mdmx),VT,FMTSEL));
+}
+
+
+011110,5.FMTSEL,5.VT,5.VS,5.VD,001010:MDMX:64::SUB.fmt
+"sub.%s<FMTSEL> v<VD>, v<VS>, v<VT>"
+*mdmx:
+*sb1:
+{
+ check_mdmx (SD_, instruction_0);
+ if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL))
+ StoreFPR(VD,fmt_mdmx,MX_Sub(ValueFPR(VS,fmt_mdmx),VT,FMTSEL));
+}
+
+
+011110,5.FMTSEL,5.VT,5.VS,0,0000,110110:MDMX:64::SUBA.fmt
+"suba.%s<FMTSEL> v<VS>, v<VT>"
+*mdmx:
+*sb1:
+{
+ check_mdmx (SD_, instruction_0);
+ if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL))
+ MX_SubA(ValueFPR(VS,fmt_mdmx),VT,FMTSEL);
+}
+
+
+011110,5.FMTSEL,5.VT,5.VS,1,0000,110110:MDMX:64::SUBL.fmt
+"subl.%s<FMTSEL> v<VS>, v<VT>"
+*mdmx:
+*sb1:
+{
+ check_mdmx (SD_, instruction_0);
+ if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL))
+ MX_SubL(ValueFPR(VS,fmt_mdmx),VT,FMTSEL);
+}
+
+
+011110,1000,1.FMTOP,00000,5.VS,00000,111110:MDMX:64::WACH.fmt
+"wach.%s<FMTOP> v<VS>"
+*mdmx:
+*sb1:
+{
+ check_mdmx (SD_, instruction_0);
+ check_mdmx_fmtop (SD_, instruction_0, FMTOP);
+ MX_WACH(FMTOP,ValueFPR(VS,fmt_mdmx));
+}
+
+
+011110,0000,1.FMTOP,5.VT,5.VS,00000,111110:MDMX:64::WACL.fmt
+"wacl.%s<FMTOP> v<VS>, v<VT>"
+*mdmx:
+*sb1:
+{
+ check_mdmx (SD_, instruction_0);
+ check_mdmx_fmtop (SD_, instruction_0, FMTOP);
+ MX_WACL(FMTOP,ValueFPR(VS,fmt_mdmx),ValueFPR(VT,fmt_mdmx));
+}
+
+
+011110,5.FMTSEL,5.VT,5.VS,5.VD,001101:MDMX:64::XOR.fmt
+"xor.%s<FMTSEL> v<VD>, v<VS>, v<VT>"
+*mdmx:
+*sb1:
+{
+ check_mdmx (SD_, instruction_0);
+ if (check_mdmx_fmtsel (SD_, instruction_0, FMTSEL))
+ StoreFPR(VD,fmt_mdmx,MX_Xor(ValueFPR(VS,fmt_mdmx),VT,FMTSEL));
+}
diff --git a/sim/mips/mips.igen b/sim/mips/mips.igen
index cd96766d885..1e558258153 100644
--- a/sim/mips/mips.igen
+++ b/sim/mips/mips.igen
@@ -61,7 +61,16 @@
// MIPS Application Specific Extensions (ASEs)
//
// Instructions for the ASEs are in separate .igen files.
+// ASEs add instructions on to a base ISA.
:model:::mips16:mips16: // m16.igen (and m16.dc)
+:model:::mips3d:mips3d: // mips3d.igen
+:model:::mdmx:mdmx: // mdmx.igen
+
+// Vendor Extensions
+//
+// Instructions specific to these extensions are in separate .igen files.
+// Extensions add instructions on to a base ISA.
+:model:::sb1:sb1: // sb1.igen
// Pseudo instructions known by IGEN
@@ -2274,7 +2283,10 @@
*vr5000:
{
if (GPR[RT] != 0)
- GPR[RD] = GPR[RS];
+ {
+ GPR[RD] = GPR[RS];
+ TRACE_ALU_RESULT (GPR[RD]);
+ }
}
@@ -2288,7 +2300,10 @@
*vr5000:
{
if (GPR[RT] == 0)
- GPR[RD] = GPR[RS];
+ {
+ GPR[RD] = GPR[RS];
+ TRACE_ALU_RESULT (GPR[RD]);
+ }
}
@@ -3430,7 +3445,7 @@
000001,5.RS,01110,16.IMMEDIATE:REGIMM:32::TNEI
-"tne r<RS>, <IMMEDIATE>"
+"tnei r<RS>, <IMMEDIATE>"
*mipsII:
*mipsIII:
*mipsIV:
@@ -3508,16 +3523,7 @@
case fmt_double: return "d";
case fmt_word: return "w";
case fmt_long: return "l";
- default: return "?";
- }
-}
-
-:%s::::X:int x
-{
- switch (x)
- {
- case 0: return "f";
- case 1: return "t";
+ case fmt_ps: return "ps";
default: return "?";
}
}
@@ -3606,13 +3612,9 @@
*mipsV:
*mips64:
{
-#if 0 /* XXX FIXME: FP code doesn't yet support paired single ops. */
if ((fmt != fmt_single) && (fmt != fmt_double)
&& (fmt != fmt_ps || (UserMode && (SR & (status_UX|status_PX)) == 0)))
SignalException (ReservedInstruction, insn);
-#else
- check_fmt (SD_, fmt, insn);
-#endif
}
@@ -3655,7 +3657,7 @@
int fmt = FMT;
check_fpu (SD_);
check_fmt_p (SD_, fmt, instruction_0);
- StoreFPR(FD,fmt,AbsoluteValue(ValueFPR(FS,fmt),fmt));
+ StoreFPR (FD, fmt, AbsoluteValue (ValueFPR (FS, fmt), fmt));
}
@@ -3676,10 +3678,36 @@
int fmt = FMT;
check_fpu (SD_);
check_fmt_p (SD_, fmt, instruction_0);
- StoreFPR(FD,fmt,Add(ValueFPR(FS,fmt),ValueFPR(FT,fmt),fmt));
+ StoreFPR (FD, fmt, Add (ValueFPR (FS, fmt), ValueFPR (FT, fmt), fmt));
}
+010011,5.RS,5.FT,5.FS,5.FD,011,110:COP1X:64,f::ALNV.PS
+"alnv.ps f<FD>, f<FS>, f<FT>, r<RS>"
+*mipsV:
+*mips64:
+{
+ unsigned64 fs;
+ unsigned64 ft;
+ unsigned64 fd;
+ check_fpu (SD_);
+ check_u64 (SD_, instruction_0);
+ fs = ValueFPR (FS, fmt_ps);
+ if ((GPR[RS] & 0x3) != 0)
+ Unpredictable ();
+ if ((GPR[RS] & 0x4) == 0)
+ fd = fs;
+ else
+ {
+ ft = ValueFPR (FT, fmt_ps);
+ if (BigEndianCPU)
+ fd = PackPS (PSLower (fs), PSUpper (ft));
+ else
+ fd = PackPS (PSLower (ft), PSUpper (fs));
+ }
+ StoreFPR (FD, fmt_ps, fd);
+}
+
// BC1F
// BC1FL
@@ -3739,45 +3767,6 @@
}
-
-
-
-
-// C.EQ.S
-// C.EQ.D
-// ...
-
-:function:::void:do_c_cond_fmt:int fmt, int ft, int fs, int cc, int cond, instruction_word insn
-{
- int less;
- int equal;
- int unordered;
- int condition;
- unsigned64 ofs = ValueFPR (fs, fmt);
- unsigned64 oft = ValueFPR (ft, fmt);
- if (NaN (ofs, fmt) || NaN (oft, fmt))
- {
- if (FCSR & FP_ENABLE (IO))
- {
- FCSR |= FP_CAUSE (IO);
- SignalExceptionFPE ();
- }
- less = 0;
- equal = 0;
- unordered = 1;
- }
- else
- {
- less = Less (ofs, oft, fmt);
- equal = Equal (ofs, oft, fmt);
- unordered = 0;
- }
- condition = (((cond & (1 << 2)) && less)
- || ((cond & (1 << 1)) && equal)
- || ((cond & (1 << 0)) && unordered));
- SETFCC (cc, condition);
-}
-
010001,10,3.FMT,5.FT,5.FS,3.0,00,11,4.COND:COP1:32,f::C.cond.fmta
"c.%s<COND>.%s<FMT> f<FS>, f<FT>"
*mipsI:
@@ -3787,7 +3776,8 @@
int fmt = FMT;
check_fpu (SD_);
check_fmt_p (SD_, fmt, instruction_0);
- do_c_cond_fmt (SD_, fmt, FT, FS, 0, COND, instruction_0);
+ Compare (ValueFPR (FS, fmt), ValueFPR (FT, fmt), fmt, COND, 0);
+ TRACE_ALU_RESULT (ValueFCR (31));
}
010001,10,3.FMT,5.FT,5.FS,3.CC,00,11,4.COND:COP1:32,f::C.cond.fmtb
@@ -3804,7 +3794,8 @@
int fmt = FMT;
check_fpu (SD_);
check_fmt_p (SD_, fmt, instruction_0);
- do_c_cond_fmt (SD_, fmt, FT, FS, CC, COND, instruction_0);
+ Compare (ValueFPR (FS, fmt), ValueFPR (FT, fmt), fmt, COND, CC);
+ TRACE_ALU_RESULT (ValueFCR (31));
}
@@ -3821,11 +3812,13 @@
int fmt = FMT;
check_fpu (SD_);
check_fmt (SD_, fmt, instruction_0);
- StoreFPR(FD,fmt_long,Convert(FP_RM_TOPINF,ValueFPR(FS,fmt),fmt,fmt_long));
+ StoreFPR (FD, fmt_long, Convert (FP_RM_TOPINF, ValueFPR (FS, fmt), fmt,
+ fmt_long));
}
010001,10,3.FMT,00000,5.FS,5.FD,001110:COP1:32,f::CEIL.W
+"ceil.w.%s<FMT> f<FD>, f<FS>"
*mipsII:
*mipsIII:
*mipsIV:
@@ -3839,84 +3832,97 @@
int fmt = FMT;
check_fpu (SD_);
check_fmt (SD_, fmt, instruction_0);
- StoreFPR(FD,fmt_word,Convert(FP_RM_TOPINF,ValueFPR(FS,fmt),fmt,fmt_word));
+ StoreFPR (FD, fmt_word, Convert (FP_RM_TOPINF, ValueFPR (FS, fmt), fmt,
+ fmt_word));
}
-// CFC1
-// CTC1
-010001,00,X,10,5.RT,5.FS,00000000000:COP1Sa:32,f::CxC1
-"c%s<X>c1 r<RT>, f<FS>"
+010001,00010,5.RT,5.FS,00000000000:COP1:32,f::CFC1a
+"cfc1 r<RT>, f<FS>"
*mipsI:
*mipsII:
*mipsIII:
{
check_fpu (SD_);
- if (X)
+ if (FS == 0)
+ PENDING_FILL (RT, EXTEND32 (FCR0));
+ else if (FS == 31)
+ PENDING_FILL (RT, EXTEND32 (FCR31));
+ /* else NOP */
+}
+
+010001,00010,5.RT,5.FS,00000000000:COP1:32,f::CFC1b
+"cfc1 r<RT>, f<FS>"
+*mipsIV:
+*vr4100:
+*vr5000:
+*r3900:
+{
+ check_fpu (SD_);
+ if (FS == 0 || FS == 31)
{
- if (FS == 0)
- PENDING_FILL(FCR0IDX,VL4_8(GPR[RT]));
- else if (FS == 31)
- PENDING_FILL(FCR31IDX,VL4_8(GPR[RT]));
- /* else NOP */
- PENDING_SCHED(FCSR, FCR31 & (1<<23), 1, 23);
- }
- else
- { /* control from */
- if (FS == 0)
- PENDING_FILL(RT, EXTEND32 (FCR0));
- else if (FS == 31)
- PENDING_FILL(RT, EXTEND32 (FCR31));
- /* else NOP */
+ unsigned_word fcr = ValueFCR (FS);
+ TRACE_ALU_INPUT1 (fcr);
+ GPR[RT] = fcr;
}
+ /* else NOP */
+ TRACE_ALU_RESULT (GPR[RT]);
}
-010001,00,X,10,5.RT,5.FS,00000000000:COP1Sb:32,f::CxC1
-"c%s<X>c1 r<RT>, f<FS>"
-*mipsIV:
+
+010001,00010,5.RT,5.FS,00000000000:COP1:32,f::CFC1c
+"cfc1 r<RT>, f<FS>"
*mipsV:
*mips32:
*mips64:
+{
+ check_fpu (SD_);
+ if (FS == 0 || FS == 25 || FS == 26 || FS == 28 || FS == 31)
+ {
+ unsigned_word fcr = ValueFCR (FS);
+ TRACE_ALU_INPUT1 (fcr);
+ GPR[RT] = fcr;
+ }
+ /* else NOP */
+ TRACE_ALU_RESULT (GPR[RT]);
+}
+
+010001,00110,5.RT,5.FS,00000000000:COP1:32,f::CTC1a
+"ctc1 r<RT>, f<FS>"
+*mipsI:
+*mipsII:
+*mipsIII:
+{
+ check_fpu (SD_);
+ if (FS == 31)
+ PENDING_FILL (FCRCS_REGNUM, VL4_8 (GPR[RT]));
+ /* else NOP */
+}
+
+010001,00110,5.RT,5.FS,00000000000:COP1:32,f::CTC1b
+"ctc1 r<RT>, f<FS>"
+*mipsIV:
*vr4100:
*vr5000:
*r3900:
{
check_fpu (SD_);
- if (X)
- {
- /* control to */
- TRACE_ALU_INPUT1 (GPR[RT]);
- if (FS == 0)
- {
- FCR0 = VL4_8(GPR[RT]);
- TRACE_ALU_RESULT (FCR0);
- }
- else if (FS == 31)
- {
- FCR31 = VL4_8(GPR[RT]);
- SETFCC(0,((FCR31 & (1 << 23)) ? 1 : 0));
- TRACE_ALU_RESULT (FCR31);
- }
- else
- {
- TRACE_ALU_RESULT0 ();
- }
- /* else NOP */
- }
- else
- { /* control from */
- if (FS == 0)
- {
- TRACE_ALU_INPUT1 (FCR0);
- GPR[RT] = EXTEND32 (FCR0);
- }
- else if (FS == 31)
- {
- TRACE_ALU_INPUT1 (FCR31);
- GPR[RT] = EXTEND32 (FCR31);
- }
- TRACE_ALU_RESULT (GPR[RT]);
- /* else NOP */
- }
+ TRACE_ALU_INPUT1 (GPR[RT]);
+ if (FS == 31)
+ StoreFCR (FS, GPR[RT]);
+ /* else NOP */
+}
+
+010001,00110,5.RT,5.FS,00000000000:COP1:32,f::CTC1c
+"ctc1 r<RT>, f<FS>"
+*mipsV:
+*mips32:
+*mips64:
+{
+ check_fpu (SD_);
+ TRACE_ALU_INPUT1 (GPR[RT]);
+ if (FS == 25 || FS == 26 || FS == 28 || FS == 31)
+ StoreFCR (FS, GPR[RT]);
+ /* else NOP */
}
@@ -3938,12 +3944,10 @@
{
int fmt = FMT;
check_fpu (SD_);
- {
- if ((fmt == fmt_double) | 0)
- SignalException (ReservedInstruction, instruction_0);
- else
- StoreFPR(FD,fmt_double,Convert(GETRM(),ValueFPR(FS,fmt),fmt,fmt_double));
- }
+ if ((fmt == fmt_double) | 0)
+ SignalException (ReservedInstruction, instruction_0);
+ StoreFPR (FD, fmt_double, Convert (GETRM (), ValueFPR (FS, fmt), fmt,
+ fmt_double));
}
@@ -3959,19 +3963,29 @@
{
int fmt = FMT;
check_fpu (SD_);
- {
- if ((fmt == fmt_long) | ((fmt == fmt_long) || (fmt == fmt_word)))
- SignalException (ReservedInstruction, instruction_0);
- else
- StoreFPR(FD,fmt_long,Convert(GETRM(),ValueFPR(FS,fmt),fmt,fmt_long));
- }
+ if ((fmt == fmt_long) | ((fmt == fmt_long) || (fmt == fmt_word)))
+ SignalException (ReservedInstruction, instruction_0);
+ StoreFPR (FD, fmt_long, Convert (GETRM (), ValueFPR (FS, fmt), fmt,
+ fmt_long));
+}
+
+
+010001,10,000,5.FT,5.FS,5.FD,100110:COP1:64,f::CVT.PS.S
+"cvt.ps.s f<FD>, f<FS>, f<FT>"
+*mipsV:
+*mips64:
+{
+ check_fpu (SD_);
+ check_u64 (SD_, instruction_0);
+ StoreFPR (FD, fmt_ps, PackPS (ValueFPR (FS, fmt_single),
+ ValueFPR (FT, fmt_single)));
}
//
// FIXME: Does not correctly differentiate between mips*
//
-010001,10,3.FMT,00000,5.FS,5.FD,100000:COP1:32,f::CVT.S.fmt
+010001,10,3.FMT!6,00000,5.FS,5.FD,100000:COP1:32,f::CVT.S.fmt
"cvt.s.%s<FMT> f<FD>, f<FS>"
*mipsI:
*mipsII:
@@ -3986,16 +4000,36 @@
{
int fmt = FMT;
check_fpu (SD_);
- {
- if ((fmt == fmt_single) | 0)
- SignalException (ReservedInstruction, instruction_0);
- else
- StoreFPR(FD,fmt_single,Convert(GETRM(),ValueFPR(FS,fmt),fmt,fmt_single));
- }
+ if ((fmt == fmt_single) | 0)
+ SignalException (ReservedInstruction, instruction_0);
+ StoreFPR (FD, fmt_single, Convert (GETRM (), ValueFPR (FS, fmt), fmt,
+ fmt_single));
}
-010001,10,3.FMT,00000,5.FS,5.FD,100100:COP1:32,f::CVT.W.fmt
+010001,10,110,00000,5.FS,5.FD,101000:COP1:64,f::CVT.S.PL
+"cvt.s.pl f<FD>, f<FS>"
+*mipsV:
+*mips64:
+{
+ check_fpu (SD_);
+ check_u64 (SD_, instruction_0);
+ StoreFPR (FD, fmt_single, PSLower (ValueFPR (FS, fmt_ps)));
+}
+
+
+010001,10,110,00000,5.FS,5.FD,100000:COP1:64,f::CVT.S.PU
+"cvt.s.pu f<FD>, f<FS>"
+*mipsV:
+*mips64:
+{
+ check_fpu (SD_);
+ check_u64 (SD_, instruction_0);
+ StoreFPR (FD, fmt_single, PSUpper (ValueFPR (FS, fmt_ps)));
+}
+
+
+010001,10,3.FMT!6,00000,5.FS,5.FD,100100:COP1:32,f::CVT.W.fmt
"cvt.w.%s<FMT> f<FD>, f<FS>"
*mipsI:
*mipsII:
@@ -4010,12 +4044,10 @@
{
int fmt = FMT;
check_fpu (SD_);
- {
- if ((fmt == fmt_word) | ((fmt == fmt_long) || (fmt == fmt_word)))
- SignalException (ReservedInstruction, instruction_0);
- else
- StoreFPR(FD,fmt_word,Convert(GETRM(),ValueFPR(FS,fmt),fmt,fmt_word));
- }
+ if ((fmt == fmt_word) | ((fmt == fmt_long) || (fmt == fmt_word)))
+ SignalException (ReservedInstruction, instruction_0);
+ StoreFPR (FD, fmt_word, Convert (GETRM (), ValueFPR (FS, fmt), fmt,
+ fmt_word));
}
@@ -4035,46 +4067,29 @@
int fmt = FMT;
check_fpu (SD_);
check_fmt (SD_, fmt, instruction_0);
- StoreFPR(FD,fmt,Divide(ValueFPR(FS,fmt),ValueFPR(FT,fmt),fmt));
+ StoreFPR (FD, fmt, Divide (ValueFPR (FS, fmt), ValueFPR (FT, fmt), fmt));
}
-// DMFC1
-// DMTC1
-010001,00,X,01,5.RT,5.FS,00000000000:COP1Sa:64,f::DMxC1
-"dm%s<X>c1 r<RT>, f<FS>"
+010001,00001,5.RT,5.FS,00000000000:COP1:64,f::DMFC1a
+"dmfc1 r<RT>, f<FS>"
*mipsIII:
{
+ unsigned64 v;
check_fpu (SD_);
check_u64 (SD_, instruction_0);
- if (X)
- {
- if (SizeFGR() == 64)
- PENDING_FILL((FS + FGRIDX),GPR[RT]);
- else if ((FS & 0x1) == 0)
- {
- PENDING_FILL(((FS + 1) + FGRIDX),VH4_8(GPR[RT]));
- PENDING_FILL((FS + FGRIDX),VL4_8(GPR[RT]));
- }
- }
+ if (SizeFGR () == 64)
+ v = FGR[FS];
+ else if ((FS & 0x1) == 0)
+ v = SET64HI (FGR[FS+1]) | FGR[FS];
else
- {
- if (SizeFGR() == 64)
- PENDING_FILL(RT,FGR[FS]);
- else if ((FS & 0x1) == 0)
- PENDING_FILL(RT,(SET64HI(FGR[FS+1]) | FGR[FS]));
- else
- {
- if (STATE_VERBOSE_P(SD))
- sim_io_eprintf (SD,
- "Warning: PC 0x%lx: semantic_DMxC1_COP1Sa 32-bit use of odd FPR number\n",
- (long) CIA);
- PENDING_FILL(RT,SET64HI(0xDEADC0DE) | 0xBAD0BAD0);
- }
- }
+ v = SET64HI (0xDEADC0DE) | 0xBAD0BAD0;
+ PENDING_FILL (RT, v);
+ TRACE_ALU_RESULT (v);
}
-010001,00,X,01,5.RT,5.FS,00000000000:COP1Sb:64,f::DMxC1
-"dm%s<X>c1 r<RT>, f<FS>"
+
+010001,00001,5.RT,5.FS,00000000000:COP1:64,f::DMFC1b
+"dmfc1 r<RT>, f<FS>"
*mipsIV:
*mipsV:
*mips64:
@@ -4084,28 +4099,52 @@
{
check_fpu (SD_);
check_u64 (SD_, instruction_0);
- if (X)
- {
- if (SizeFGR() == 64)
- StoreFPR (FS, fmt_uninterpreted_64, GPR[RT]);
- else if ((FS & 0x1) == 0)
- StoreFPR (FS, fmt_uninterpreted_64, SET64HI (FGR[FS+1]) | FGR[FS]);
- }
+ if (SizeFGR () == 64)
+ GPR[RT] = FGR[FS];
+ else if ((FS & 0x1) == 0)
+ GPR[RT] = SET64HI (FGR[FS+1]) | FGR[FS];
else
+ GPR[RT] = SET64HI (0xDEADC0DE) | 0xBAD0BAD0;
+ TRACE_ALU_RESULT (GPR[RT]);
+}
+
+
+010001,00101,5.RT,5.FS,00000000000:COP1:64,f::DMTC1a
+"dmtc1 r<RT>, f<FS>"
+*mipsIII:
+{
+ unsigned64 v;
+ check_fpu (SD_);
+ check_u64 (SD_, instruction_0);
+ if (SizeFGR () == 64)
+ PENDING_FILL ((FS + FGR_BASE), GPR[RT]);
+ else if ((FS & 0x1) == 0)
{
- if (SizeFGR() == 64)
- GPR[RT] = FGR[FS];
- else if ((FS & 0x1) == 0)
- GPR[RT] = SET64HI (FGR[FS+1]) | FGR[FS];
- else
- {
- if (STATE_VERBOSE_P(SD))
- sim_io_eprintf (SD,
- "Warning: PC 0x%lx: DMxC1 32-bit use of odd FPR number\n",
- (long) CIA);
- GPR[RT] = SET64HI (0xDEADC0DE) | 0xBAD0BAD0;
- }
+ PENDING_FILL (((FS + 1) + FGR_BASE), VH4_8 (GPR[RT]));
+ PENDING_FILL ((FS + FGR_BASE), VL4_8 (GPR[RT]));
}
+ else
+ Unpredictable ();
+ TRACE_FP_RESULT (GPR[RT]);
+}
+
+010001,00101,5.RT,5.FS,00000000000:COP1:64,f::DMTC1b
+"dmtc1 r<RT>, f<FS>"
+*mipsIV:
+*mipsV:
+*mips64:
+*vr4100:
+*vr5000:
+*r3900:
+{
+ check_fpu (SD_);
+ check_u64 (SD_, instruction_0);
+ if (SizeFGR () == 64)
+ StoreFPR (FS, fmt_uninterpreted_64, GPR[RT]);
+ else if ((FS & 0x1) == 0)
+ StoreFPR (FS, fmt_uninterpreted_64, GPR[RT]);
+ else
+ Unpredictable ();
}
@@ -4122,7 +4161,8 @@
int fmt = FMT;
check_fpu (SD_);
check_fmt (SD_, fmt, instruction_0);
- StoreFPR(FD,fmt_long,Convert(FP_RM_TOMINF,ValueFPR(FS,fmt),fmt,fmt_long));
+ StoreFPR (FD, fmt_long, Convert (FP_RM_TOMINF, ValueFPR (FS, fmt), fmt,
+ fmt_long));
}
@@ -4141,7 +4181,8 @@
int fmt = FMT;
check_fpu (SD_);
check_fmt (SD_, fmt, instruction_0);
- StoreFPR(FD,fmt_word,Convert(FP_RM_TOMINF,ValueFPR(FS,fmt),fmt,fmt_word));
+ StoreFPR (FD, fmt_word, Convert (FP_RM_TOMINF, ValueFPR (FS, fmt), fmt,
+ fmt_word));
}
@@ -4208,64 +4249,37 @@
-//
-// FIXME: Not correct for mips*
-//
-010011,5.FR,5.FT,5.FS,5.FD,100,001:COP1X:32,f::MADD.D
-"madd.d f<FD>, f<FR>, f<FS>, f<FT>"
-*mipsIV:
-*mipsV:
-*mips64:
-*vr5000:
-{
- check_fpu (SD_);
- {
- StoreFPR(FD,fmt_double,Add(Multiply(ValueFPR(FS,fmt_double),ValueFPR(FT,fmt_double),fmt_double),ValueFPR(FR,fmt_double),fmt_double));
- }
-}
-
-
-010011,5.FR,5.FT,5.FS,5.FD,100,000:COP1X:32,f::MADD.S
-"madd.s f<FD>, f<FR>, f<FS>, f<FT>"
+010011,5.FR,5.FT,5.FS,5.FD,100,3.FMT:COP1X:64,f::MADD.fmt
+"madd.%s<FMT> f<FD>, f<FR>, f<FS>, f<FT>"
*mipsIV:
*mipsV:
*mips64:
*vr5000:
{
+ int fmt = FMT;
check_fpu (SD_);
- {
- StoreFPR(FD,fmt_single,Add(Multiply(ValueFPR(FS,fmt_single),ValueFPR(FT,fmt_single),fmt_single),ValueFPR(FR,fmt_single),fmt_single));
- }
+ check_u64 (SD_, instruction_0);
+ check_fmt_p (SD_, fmt, instruction_0);
+ StoreFPR (FD, fmt, MultiplyAdd (ValueFPR (FS, fmt), ValueFPR (FT, fmt),
+ ValueFPR (FR, fmt), fmt));
}
-// MFC1
-// MTC1
-010001,00,X,00,5.RT,5.FS,00000000000:COP1Sa:32,f::MxC1
-"m%s<X>c1 r<RT>, f<FS>"
+010001,00000,5.RT,5.FS,00000000000:COP1:32,f::MFC1a
+"mfc1 r<RT>, f<FS>"
*mipsI:
*mipsII:
*mipsIII:
{
+ unsigned64 v;
check_fpu (SD_);
- if (X)
- { /*MTC1*/
- if (SizeFGR() == 64)
- {
- if (STATE_VERBOSE_P(SD))
- sim_io_eprintf (SD,
- "Warning: PC 0x%lx: MTC1 not DMTC1 with 64 bit regs\n",
- (long) CIA);
- PENDING_FILL ((FS + FGRIDX), (SET64HI(0xDEADC0DE) | VL4_8(GPR[RT])));
- }
- else
- PENDING_FILL ((FS + FGRIDX), VL4_8(GPR[RT]));
- }
- else /*MFC1*/
- PENDING_FILL (RT, EXTEND32 (FGR[FS]));
+ v = EXTEND32 (FGR[FS]);
+ PENDING_FILL (RT, v);
+ TRACE_ALU_RESULT (v);
}
-010001,00,X,00,5.RT,5.FS,00000000000:COP1Sb:32,f::MxC1
-"m%s<X>c1 r<RT>, f<FS>"
+
+010001,00000,5.RT,5.FS,00000000000:COP1:32,f::MFC1b
+"mfc1 r<RT>, f<FS>"
*mipsIV:
*mipsV:
*mips32:
@@ -4273,14 +4287,10 @@
*vr4100:
*vr5000:
*r3900:
-{
- int fs = FS;
+{
check_fpu (SD_);
- if (X)
- /*MTC1*/
- StoreFPR (FS, fmt_uninterpreted_32, VL4_8 (GPR[RT]));
- else /*MFC1*/
- GPR[RT] = EXTEND32 (FGR[FS]);
+ GPR[RT] = EXTEND32 (FGR[FS]);
+ TRACE_ALU_RESULT (GPR[RT]);
}
@@ -4300,7 +4310,7 @@
int fmt = FMT;
check_fpu (SD_);
check_fmt_p (SD_, fmt, instruction_0);
- StoreFPR(FD,fmt,ValueFPR(FS,fmt));
+ StoreFPR (FD, fmt, ValueFPR (FS, fmt));
}
@@ -4332,12 +4342,22 @@
{
int fmt = FMT;
check_fpu (SD_);
- {
- if (GETFCC(CC) == TF)
- StoreFPR (FD, fmt, ValueFPR (FS, fmt));
- else
- StoreFPR (FD, fmt, ValueFPR (FD, fmt));
- }
+ if (fmt != fmt_ps)
+ {
+ if (GETFCC(CC) == TF)
+ StoreFPR (FD, fmt, ValueFPR (FS, fmt));
+ else
+ StoreFPR (FD, fmt, ValueFPR (FD, fmt)); /* set fmt */
+ }
+ else
+ {
+ unsigned64 fd;
+ fd = PackPS (PSUpper (ValueFPR ((GETFCC (CC+1) == TF) ? FS : FD,
+ fmt_ps)),
+ PSLower (ValueFPR ((GETFCC (CC+0) == TF) ? FS : FD,
+ fmt_ps)));
+ StoreFPR (FD, fmt_ps, fd);
+ }
}
@@ -4380,35 +4400,51 @@
}
-// MSUB.fmt
-010011,5.FR,5.FT,5.FS,5.FD,101,001:COP1X:32,f::MSUB.D
-"msub.d f<FD>, f<FR>, f<FS>, f<FT>"
+010011,5.FR,5.FT,5.FS,5.FD,101,3.FMT:COP1X:64,f::MSUB.fmt
+"msub.%s<FMT> f<FD>, f<FR>, f<FS>, f<FT>"
*mipsIV:
*mipsV:
*mips64:
*vr5000:
{
+ int fmt = FMT;
check_fpu (SD_);
- StoreFPR(FD,fmt_double,Sub(Multiply(ValueFPR(FS,fmt_double),ValueFPR(FT,fmt_double),fmt_double),ValueFPR(FR,fmt_double),fmt_double));
+ check_u64 (SD_, instruction_0);
+ check_fmt_p (SD_, fmt, instruction_0);
+ StoreFPR (FD, fmt, MultiplySub (ValueFPR (FS, fmt), ValueFPR (FT, fmt),
+ ValueFPR (FR, fmt), fmt));
}
-// MSUB.fmt
-010011,5.FR,5.FT,5.FS,5.FD,101000:COP1X:32,f::MSUB.S
-"msub.s f<FD>, f<FR>, f<FS>, f<FT>"
+010001,00100,5.RT,5.FS,00000000000:COP1:32,f::MTC1a
+"mtc1 r<RT>, f<FS>"
+*mipsI:
+*mipsII:
+*mipsIII:
+{
+ check_fpu (SD_);
+ if (SizeFGR () == 64)
+ PENDING_FILL ((FS + FGR_BASE), (SET64HI (0xDEADC0DE) | VL4_8 (GPR[RT])));
+ else
+ PENDING_FILL ((FS + FGR_BASE), VL4_8 (GPR[RT]));
+ TRACE_FP_RESULT (GPR[RT]);
+}
+
+010001,00100,5.RT,5.FS,00000000000:COP1:32,f::MTC1b
+"mtc1 r<RT>, f<FS>"
*mipsIV:
*mipsV:
+*mips32:
*mips64:
+*vr4100:
*vr5000:
+*r3900:
{
- check_fpu (SD_);
- StoreFPR(FD,fmt_single,Sub(Multiply(ValueFPR(FS,fmt_single),ValueFPR(FT,fmt_single),fmt_single),ValueFPR(FR,fmt_single),fmt_single));
+ check_fpu (SD_);
+ StoreFPR (FS, fmt_uninterpreted_32, VL4_8 (GPR[RT]));
}
-// MTC1 see MxC1
-
-
010001,10,3.FMT,5.FT,5.FS,5.FD,000010:COP1:32,f::MUL.fmt
"mul.%s<FMT> f<FD>, f<FS>, f<FT>"
*mipsI:
@@ -4425,7 +4461,7 @@
int fmt = FMT;
check_fpu (SD_);
check_fmt_p (SD_, fmt, instruction_0);
- StoreFPR(FD,fmt,Multiply(ValueFPR(FS,fmt),ValueFPR(FT,fmt),fmt));
+ StoreFPR (FD, fmt, Multiply (ValueFPR (FS, fmt), ValueFPR (FT, fmt), fmt));
}
@@ -4445,59 +4481,63 @@
int fmt = FMT;
check_fpu (SD_);
check_fmt_p (SD_, fmt, instruction_0);
- StoreFPR(FD,fmt,Negate(ValueFPR(FS,fmt),fmt));
+ StoreFPR (FD, fmt, Negate (ValueFPR (FS, fmt), fmt));
}
-// NMADD.fmt
-010011,5.FR,5.FT,5.FS,5.FD,110001:COP1X:32,f::NMADD.D
-"nmadd.d f<FD>, f<FR>, f<FS>, f<FT>"
+010011,5.FR,5.FT,5.FS,5.FD,110,3.FMT:COP1X:64,f::NMADD.fmt
+"nmadd.%s<FMT> f<FD>, f<FR>, f<FS>, f<FT>"
*mipsIV:
*mipsV:
*mips64:
*vr5000:
{
+ int fmt = FMT;
check_fpu (SD_);
- StoreFPR(FD,fmt_double,Negate(Add(Multiply(ValueFPR(FS,fmt_double),ValueFPR(FT,fmt_double),fmt_double),ValueFPR(FR,fmt_double),fmt_double),fmt_double));
+ check_u64 (SD_, instruction_0);
+ check_fmt_p (SD_, fmt, instruction_0);
+ StoreFPR (FD, fmt, NegMultiplyAdd (ValueFPR (FS, fmt), ValueFPR (FT, fmt),
+ ValueFPR (FR, fmt), fmt));
}
-// NMADD.fmt
-010011,5.FR,5.FT,5.FS,5.FD,110000:COP1X:32,f::NMADD.S
-"nmadd.s f<FD>, f<FR>, f<FS>, f<FT>"
+010011,5.FR,5.FT,5.FS,5.FD,111,3.FMT:COP1X:64,f::NMSUB.fmt
+"nmsub.%s<FMT> f<FD>, f<FR>, f<FS>, f<FT>"
*mipsIV:
*mipsV:
*mips64:
*vr5000:
{
+ int fmt = FMT;
check_fpu (SD_);
- StoreFPR(FD,fmt_single,Negate(Add(Multiply(ValueFPR(FS,fmt_single),ValueFPR(FT,fmt_single),fmt_single),ValueFPR(FR,fmt_single),fmt_single),fmt_single));
+ check_u64 (SD_, instruction_0);
+ check_fmt_p (SD_, fmt, instruction_0);
+ StoreFPR (FD, fmt, NegMultiplySub (ValueFPR (FS, fmt), ValueFPR (FT, fmt),
+ ValueFPR (FR, fmt), fmt));
}
-// NMSUB.fmt
-010011,5.FR,5.FT,5.FS,5.FD,111001:COP1X:32,f::NMSUB.D
-"nmsub.d f<FD>, f<FR>, f<FS>, f<FT>"
-*mipsIV:
+010001,10,110,5.FT,5.FS,5.FD,101100:COP1:64,f::PLL.PS
+"pll.ps f<FD>, f<FS>, f<FT>"
*mipsV:
*mips64:
-*vr5000:
{
check_fpu (SD_);
- StoreFPR(FD,fmt_double,Negate(Sub(Multiply(ValueFPR(FS,fmt_double),ValueFPR(FT,fmt_double),fmt_double),ValueFPR(FR,fmt_double),fmt_double),fmt_double));
+ check_u64 (SD_, instruction_0);
+ StoreFPR (FD, fmt_ps, PackPS (PSLower (ValueFPR (FS, fmt_ps)),
+ PSLower (ValueFPR (FT, fmt_ps))));
}
-// NMSUB.fmt
-010011,5.FR,5.FT,5.FS,5.FD,111000:COP1X:32,f::NMSUB.S
-"nmsub.s f<FD>, f<FR>, f<FS>, f<FT>"
-*mipsIV:
+010001,10,110,5.FT,5.FS,5.FD,101101:COP1:64,f::PLU.PS
+"plu.ps f<FD>, f<FS>, f<FT>"
*mipsV:
*mips64:
-*vr5000:
{
check_fpu (SD_);
- StoreFPR(FD,fmt_single,Negate(Sub(Multiply(ValueFPR(FS,fmt_single),ValueFPR(FT,fmt_single),fmt_single),ValueFPR(FR,fmt_single),fmt_single),fmt_single));
+ check_u64 (SD_, instruction_0);
+ StoreFPR (FD, fmt_ps, PackPS (PSLower (ValueFPR (FS, fmt_ps)),
+ PSUpper (ValueFPR (FT, fmt_ps))));
}
@@ -4519,6 +4559,31 @@
}
}
+
+010001,10,110,5.FT,5.FS,5.FD,101110:COP1:64,f::PUL.PS
+"pul.ps f<FD>, f<FS>, f<FT>"
+*mipsV:
+*mips64:
+{
+ check_fpu (SD_);
+ check_u64 (SD_, instruction_0);
+ StoreFPR (FD, fmt_ps, PackPS (PSUpper (ValueFPR (FS, fmt_ps)),
+ PSLower (ValueFPR (FT, fmt_ps))));
+}
+
+
+010001,10,110,5.FT,5.FS,5.FD,101111:COP1:64,f::PUU.PS
+"puu.ps f<FD>, f<FS>, f<FT>"
+*mipsV:
+*mips64:
+{
+ check_fpu (SD_);
+ check_u64 (SD_, instruction_0);
+ StoreFPR (FD, fmt_ps, PackPS (PSUpper (ValueFPR (FS, fmt_ps)),
+ PSUpper (ValueFPR (FT, fmt_ps))));
+}
+
+
010001,10,3.FMT,00000,5.FS,5.FD,010101:COP1:32,f::RECIP.fmt
"recip.%s<FMT> f<FD>, f<FS>"
*mipsIV:
@@ -4529,7 +4594,7 @@
int fmt = FMT;
check_fpu (SD_);
check_fmt (SD_, fmt, instruction_0);
- StoreFPR(FD,fmt,Recip(ValueFPR(FS,fmt),fmt));
+ StoreFPR (FD, fmt, Recip (ValueFPR (FS, fmt), fmt));
}
@@ -4546,7 +4611,8 @@
int fmt = FMT;
check_fpu (SD_);
check_fmt (SD_, fmt, instruction_0);
- StoreFPR(FD,fmt_long,Convert(FP_RM_NEAREST,ValueFPR(FS,fmt),fmt,fmt_long));
+ StoreFPR (FD, fmt_long, Convert (FP_RM_NEAREST, ValueFPR (FS, fmt), fmt,
+ fmt_long));
}
@@ -4565,21 +4631,22 @@
int fmt = FMT;
check_fpu (SD_);
check_fmt (SD_, fmt, instruction_0);
- StoreFPR(FD,fmt_word,Convert(FP_RM_NEAREST,ValueFPR(FS,fmt),fmt,fmt_word));
+ StoreFPR (FD, fmt_word, Convert (FP_RM_NEAREST, ValueFPR (FS, fmt), fmt,
+ fmt_word));
}
010001,10,3.FMT,00000,5.FS,5.FD,010110:COP1:32,f::RSQRT.fmt
+"rsqrt.%s<FMT> f<FD>, f<FS>"
*mipsIV:
*mipsV:
*mips64:
-"rsqrt.%s<FMT> f<FD>, f<FS>"
*vr5000:
{
int fmt = FMT;
check_fpu (SD_);
check_fmt (SD_, fmt, instruction_0);
- StoreFPR(FD,fmt,Recip(SquareRoot(ValueFPR(FS,fmt),fmt),fmt));
+ StoreFPR (FD, fmt, RSquareRoot (ValueFPR (FS, fmt), fmt));
}
@@ -4628,7 +4695,7 @@
int fmt = FMT;
check_fpu (SD_);
check_fmt (SD_, fmt, instruction_0);
- StoreFPR(FD,fmt,(SquareRoot(ValueFPR(FS,fmt),fmt)));
+ StoreFPR (FD, fmt, (SquareRoot (ValueFPR (FS, fmt), fmt)));
}
@@ -4648,7 +4715,7 @@
int fmt = FMT;
check_fpu (SD_);
check_fmt_p (SD_, fmt, instruction_0);
- StoreFPR(FD,fmt,Sub(ValueFPR(FS,fmt),ValueFPR(FT,fmt),fmt));
+ StoreFPR (FD, fmt, Sub (ValueFPR (FS, fmt), ValueFPR (FT, fmt), fmt));
}
@@ -4750,7 +4817,8 @@
int fmt = FMT;
check_fpu (SD_);
check_fmt (SD_, fmt, instruction_0);
- StoreFPR(FD,fmt_long,Convert(FP_RM_TOZERO,ValueFPR(FS,fmt),fmt,fmt_long));
+ StoreFPR (FD, fmt_long, Convert (FP_RM_TOZERO, ValueFPR (FS, fmt), fmt,
+ fmt_long));
}
@@ -4769,7 +4837,8 @@
int fmt = FMT;
check_fpu (SD_);
check_fmt (SD_, fmt, instruction_0);
- StoreFPR(FD,fmt_word,Convert(FP_RM_TOZERO,ValueFPR(FS,fmt),fmt,fmt_word));
+ StoreFPR (FD, fmt_word, Convert (FP_RM_TOZERO, ValueFPR (FS, fmt), fmt,
+ fmt_word));
}
@@ -5054,6 +5123,9 @@
:include:::m16.igen
+:include:::mdmx.igen
+:include:::mips3d.igen
+:include:::sb1.igen
:include:::tx.igen
:include:::vr.igen
diff --git a/sim/mips/mips3d.igen b/sim/mips/mips3d.igen
new file mode 100644
index 00000000000..f7043efcac0
--- /dev/null
+++ b/sim/mips/mips3d.igen
@@ -0,0 +1,176 @@
+// -*- C -*-
+
+// Simulator definition for the MIPS MIPS-3D ASE.
+// Copyright (C) 2002 Free Software Foundation, Inc.
+// Contributed by Broadcom Corporation (SiByte).
+//
+// 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 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.
+
+// Reference: MIPS64 Architecture for Programmers Volume IV-c:
+// The MIPS-3D Application-Specific Extension to the
+// MIPS64 Architecture. (MIPS Document MD00099)
+
+
+010001,10,110,5.FT,5.FS,5.FD,011000:COP1:64,f::ADDR.PS
+"addr.ps f<FD>, f<FS>, f<FT>"
+*mips3d:
+{
+ /* fd.PL = ft.PU + ft.PL; fd.PU = fs.PU + fs.PL; */
+ check_fpu (SD_);
+ check_u64 (SD_, instruction_0);
+ StoreFPR (FD, fmt_ps, AddR (ValueFPR (FS, fmt_ps),
+ ValueFPR (FT, fmt_ps), fmt_ps));
+}
+
+
+010001,01001,3.CC,0,1.TF,16.OFFSET:COP1:64,f::BC1ANY2tf
+"bc1any2%s<TF> <CC>, %#lx<OFFSET>"
+*mips3d:
+{
+ address_word offset;
+ int cc = CC;
+ check_fpu (SD_);
+ check_u64 (SD_, instruction_0);
+ if ((cc & 0x1) != 0)
+ Unpredictable ();
+ if ((GETFCC (cc) == TF) || (GETFCC (cc + 1) == TF))
+ {
+ offset = (EXTEND16 (OFFSET) << 2);
+ DELAY_SLOT (NIA + offset);
+ }
+}
+
+
+010001,01010,3.CC,0,1.TF,16.OFFSET:COP1:64,f::BC1ANY4tf
+"bc1any4%s<TF> <CC>, %#lx<OFFSET>"
+*mips3d:
+{
+ address_word offset;
+ int cc = CC;
+ check_fpu (SD_);
+ check_u64 (SD_, instruction_0);
+ if ((cc & 0x3) != 0)
+ Unpredictable ();
+ if ((GETFCC (cc) == TF)
+ || (GETFCC (cc + 1) == TF)
+ || (GETFCC (cc + 2) == TF)
+ || (GETFCC (cc + 3) == TF))
+ {
+ offset = (EXTEND16 (OFFSET) << 2);
+ DELAY_SLOT (NIA + offset);
+ }
+}
+
+
+010001,10,3.FMT,5.FT,5.FS,3.CC,01,11,4.COND:COP1:64,f::CABS.cond.fmt
+"cabs.%s<COND>.%s<FMT> <CC>, f<FS>, f<FT>"
+*mips3d:
+{
+ int fmt = FMT;
+ check_fpu (SD_);
+ check_u64 (SD_, instruction_0);
+ check_fmt_p (SD_, fmt, instruction_0);
+ CompareAbs (ValueFPR (FS, fmt), ValueFPR (FT, fmt), fmt, COND, CC);
+ TRACE_ALU_RESULT (ValueFCR (31));
+}
+
+
+010001,10,110,00000,5.FS,5.FD,100100:COP1:64,f::CVT.PW.PS
+"cvt.pw.ps f<FD>, f<FS>"
+*mips3d:
+{
+ /* fd.pu = cvt_rnd (fs.pu); fd.pl = cvt_rnd (fs.pl); */
+ /* fmt_pw is fmt_long for 64 bit transfers, but cvt encoding is fmt_word. */
+ check_fpu (SD_);
+ check_u64 (SD_, instruction_0);
+ StoreFPR (FD, fmt_pw, ConvertPS (GETRM (), ValueFPR (FS, fmt_ps),
+ fmt_ps, fmt_word));
+}
+
+
+010001,10,100,00000,5.FS,5.FD,100110:COP1:64,f::CVT.PS.PW
+"cvt.ps.pw f<FD>, f<FS>"
+*mips3d:
+{
+ /* fd.pl = cvt_rnd (fs.pl); fd.pu = cvt_rnd (fs.pu); */
+ /* fmt_pw is fmt_long for 64 bit transfers, but cvt encoding is fmt_word. */
+ check_fpu (SD_);
+ check_u64 (SD_, instruction_0);
+ StoreFPR (FD, fmt_ps, ConvertPS (GETRM (), ValueFPR (FS, fmt_pw),
+ fmt_word, fmt_ps));
+}
+
+
+010001,10,110,5.FT,5.FS,5.FD,011010:COP1:64,f::MULR.PS
+"mulr.ps f<FD>, f<FS>, f<FT>"
+*mips3d:
+{
+ /* fd.PL = ft.PU * ft.PL; fd.PU = fs.PU * fs.PL; */
+ check_fpu (SD_);
+ check_u64 (SD_, instruction_0);
+ StoreFPR (FD, fmt_ps, MultiplyR (ValueFPR (FS, fmt_ps),
+ ValueFPR (FT, fmt_ps), fmt_ps));
+}
+
+
+010001,10,3.FMT,00000,5.FS,5.FD,011101:COP1:64,f::RECIP1.fmt
+"recip1.%s<FMT> f<FD>, f<FS>"
+*mips3d:
+{
+ int fmt = FMT;
+ check_fpu (SD_);
+ check_u64 (SD_, instruction_0);
+ check_fmt_p (SD_, fmt, instruction_0);
+ StoreFPR (FD, fmt, Recip1 (ValueFPR (FS, fmt), fmt));
+}
+
+
+010001,10,3.FMT,5.FT,5.FS,5.FD,011100:COP1:64,f::RECIP2.fmt
+"recip2.%s<FMT> f<FD>, f<FS>, f<FT>"
+*mips3d:
+{
+ int fmt = FMT;
+ check_fpu (SD_);
+ check_u64 (SD_, instruction_0);
+ check_fmt_p (SD_, fmt, instruction_0);
+ StoreFPR (FD, fmt, Recip2 (ValueFPR (FS, fmt), ValueFPR (FT, fmt), fmt));
+}
+
+
+010001,10,3.FMT,00000,5.FS,5.FD,011110:COP1:64,f::RSQRT1.fmt
+"rsqrt1.%s<FMT> f<FD>, f<FS>"
+*mips3d:
+{
+ int fmt = FMT;
+ check_fpu (SD_);
+ check_u64 (SD_, instruction_0);
+ check_fmt_p (SD_, fmt, instruction_0);
+ StoreFPR (FD, fmt, RSquareRoot1 (ValueFPR (FS, fmt), fmt));
+}
+
+
+010001,10,3.FMT,5.FT,5.FS,5.FD,011111:COP1:64,f::RSQRT2.fmt
+"rsqrt2.%s<FMT> f<FD>, f<FS>, f<FT>"
+*mips3d:
+{
+ int fmt = FMT;
+ check_fpu (SD_);
+ check_u64 (SD_, instruction_0);
+ check_fmt_p (SD_, fmt, instruction_0);
+ StoreFPR (FD, fmt, RSquareRoot2 (ValueFPR (FS, fmt),
+ ValueFPR (FT, fmt), fmt));
+}
diff --git a/sim/mips/sb1.igen b/sim/mips/sb1.igen
new file mode 100644
index 00000000000..6453670b1d6
--- /dev/null
+++ b/sim/mips/sb1.igen
@@ -0,0 +1,191 @@
+// -*- C -*-
+
+// Simulator definition for the Broadcom SiByte SB-1 CPU extensions.
+// Copyright (C) 2002 Free Software Foundation, Inc.
+// Contributed by Broadcom Corporation (SiByte).
+//
+// 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 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.
+
+
+// MDMX ASE Instructions
+// ---------------------
+//
+// The SB-1 implements the format OB subset of MDMX
+// and has three additions (pavg, pabsdiff, pabsdifc).
+// In addition, there are a couple of partial-decoding
+// issues for the read/write accumulator instructions.
+//
+// This code is structured so that mdmx.igen can be used by
+// selecting the allowed instructions either via model, or by
+// using check_mdmx_fmtsel and check_mdmx_fmtop to cause an
+// exception if the instruction is not allowed.
+
+
+:function:::void:check_mdmx:instruction_word insn
+*sb1:
+{
+ if (!COP_Usable(1))
+ SignalExceptionCoProcessorUnusable(1);
+ if ((SR & status_MX) == 0)
+ SignalExceptionMDMX();
+ check_u64 (SD_, insn);
+}
+
+:function:::int:check_mdmx_fmtsel:instruction_word insn, int fmtsel
+*sb1:
+{
+ switch (fmtsel & 0x03)
+ {
+ case 0x00: /* ob */
+ case 0x02:
+ return 1;
+ case 0x01: /* qh */
+ case 0x03: /* UNPREDICTABLE */
+ SignalException (ReservedInstruction, insn);
+ return 0;
+ }
+ return 0;
+}
+
+:function:::int:check_mdmx_fmtop:instruction_word insn, int fmtop
+*sb1:
+{
+ switch (fmtop & 0x01)
+ {
+ case 0x00: /* ob */
+ return 1;
+ case 0x01: /* qh */
+ SignalException (ReservedInstruction, insn);
+ return 0;
+ }
+ return 0;
+}
+
+
+011110,10,2.X!0,1.FMTOP,00000,00000,5.VD,111111:MDMX:64::RACH.sb1.fmt
+"rach.?<X>.%s<FMTOP> v<VD>"
+*sb1:
+{
+ check_mdmx (SD_, instruction_0);
+ check_mdmx_fmtop (SD_, instruction_0, FMTOP);
+ /* No op. */
+}
+
+
+011110,00,2.X!0,1.FMTOP,00000,00000,5.VD,111111:MDMX:64::RACL.sb1.fmt
+"racl.?<X>.%s<FMTOP> v<VD>"
+*sb1:
+{
+ check_mdmx (SD_, instruction_0);
+ check_mdmx_fmtop (SD_, instruction_0, FMTOP);
+ /* No op. */
+}
+
+
+011110,01,2.X!0,1.FMTOP,00000,00000,5.VD,111111:MDMX:64::RACM.sb1.fmt
+"racm.?<X>.%s<FMTOP> v<VD>"
+*sb1:
+{
+ check_mdmx (SD_, instruction_0);
+ check_mdmx_fmtop (SD_, instruction_0, FMTOP);
+ /* No op. */
+}
+
+
+011110,2.X1!0!1!2,2.X2,1.FMTOP,00000,00000,5.VD,111111:MDMX:64::RAC.sb1.fmt
+"rac?<X1>.?<X2> v<VD>"
+*sb1:
+{
+ check_mdmx (SD_, instruction_0);
+ check_mdmx_fmtop (SD_, instruction_0, FMTOP);
+ /* No op. */
+}
+
+
+011110,10,2.X!0,1.FMTOP,00000,5.VS,00000,111110:MDMX:64::WACH.sb1.fmt
+"wach.?<X>.%s<FMTOP> v<VS>"
+*sb1:
+{
+ check_mdmx (SD_, instruction_0);
+ check_mdmx_fmtop (SD_, instruction_0, FMTOP);
+ /* No op. */
+}
+
+
+011110,00,2.X!0,1.FMTOP,5.VT,5.VS,00000,111110:MDMX:64::WACL.sb1.fmt
+"wacl.?<X>.%s<FMTOP> v<VS>,v<VT>"
+*sb1:
+{
+ check_mdmx (SD_, instruction_0);
+ check_mdmx_fmtop (SD_, instruction_0, FMTOP);
+ /* No op. */
+}
+
+
+011110,2.X1!0!2,2.X2,1.FMTOP,5.VT,5.VS,00000,111110:MDMX:64::WAC.sb1.fmt
+"wacl?<X1>.?<X2>.%s<FMTOP> v<VS>,v<VT>"
+*sb1:
+{
+ check_mdmx (SD_, instruction_0);
+ check_mdmx_fmtop (SD_, instruction_0, FMTOP);
+ /* No op. */
+}
+
+
+011110,5.FMTSEL,5.VT,5.VS,5.VD,001001:MDMX:64::PABSDIFF.fmt
+"pabsdiff.%s<FMTSEL> v<VD>,v<VS>,v<VT>"
+*sb1:
+{
+ check_mdmx (SD_, instruction_0);
+ if (SR & status_SBX)
+ {
+ check_mdmx_fmtsel (SD_, instruction_0, FMTSEL);
+ StoreFPR(VD,fmt_mdmx,MX_AbsDiff(ValueFPR(VS,fmt_mdmx),VT,FMTSEL));
+ }
+ else
+ SignalException(ReservedInstruction, instruction_0);
+}
+
+
+011110,5.FMTSEL,5.VT,5.VS,00000,110101:MDMX:64::PABSDIFC.fmt
+"pabsdifc.%<FMTSEL> v<VS>,v<VT>"
+*sb1:
+{
+ check_mdmx (SD_, instruction_0);
+ if (SR & status_SBX)
+ {
+ check_mdmx_fmtsel (SD_, instruction_0, FMTSEL);
+ MX_AbsDiffC(ValueFPR(VS,fmt_mdmx),VT,FMTSEL);
+ }
+ else
+ SignalException(ReservedInstruction, instruction_0);
+}
+
+
+011110,5.FMTSEL,5.VT,5.VS,5.VD,001000:MDMX:64::PAVG.fmt
+"pavg.%s<FMTSEL> v<VD>,v<VS>,v<VT>"
+*sb1:
+{
+ check_mdmx (SD_, instruction_0);
+ if (SR & status_SBX)
+ {
+ check_mdmx_fmtsel (SD_, instruction_0, FMTSEL);
+ StoreFPR(VD,fmt_mdmx,MX_Avg(ValueFPR(VS,fmt_mdmx),VT,FMTSEL));
+ }
+ else
+ SignalException(ReservedInstruction, instruction_0);
+}
diff --git a/sim/mips/sim-main.c b/sim/mips/sim-main.c
index 7b3e6c61501..edee498bc94 100644
--- a/sim/mips/sim-main.c
+++ b/sim/mips/sim-main.c
@@ -163,35 +163,35 @@ load_memory (SIM_DESC SD,
switch (AccessLength)
{
- case AccessLength_QUADWORD :
+ case AccessLength_QUADWORD:
{
unsigned_16 val = sim_core_read_aligned_16 (CPU, cia, read_map, pAddr);
value1 = VH8_16 (val);
value = VL8_16 (val);
break;
}
- case AccessLength_DOUBLEWORD :
+ case AccessLength_DOUBLEWORD:
value = sim_core_read_aligned_8 (CPU, cia, read_map, pAddr);
break;
- case AccessLength_SEPTIBYTE :
+ case AccessLength_SEPTIBYTE:
value = sim_core_read_misaligned_7 (CPU, cia, read_map, pAddr);
break;
- case AccessLength_SEXTIBYTE :
+ case AccessLength_SEXTIBYTE:
value = sim_core_read_misaligned_6 (CPU, cia, read_map, pAddr);
break;
- case AccessLength_QUINTIBYTE :
+ case AccessLength_QUINTIBYTE:
value = sim_core_read_misaligned_5 (CPU, cia, read_map, pAddr);
break;
- case AccessLength_WORD :
+ case AccessLength_WORD:
value = sim_core_read_aligned_4 (CPU, cia, read_map, pAddr);
break;
- case AccessLength_TRIPLEBYTE :
+ case AccessLength_TRIPLEBYTE:
value = sim_core_read_misaligned_3 (CPU, cia, read_map, pAddr);
break;
- case AccessLength_HALFWORD :
+ case AccessLength_HALFWORD:
value = sim_core_read_aligned_2 (CPU, cia, read_map, pAddr);
break;
- case AccessLength_BYTE :
+ case AccessLength_BYTE:
value = sim_core_read_aligned_1 (CPU, cia, read_map, pAddr);
break;
default:
@@ -292,34 +292,34 @@ store_memory (SIM_DESC SD,
switch (AccessLength)
{
- case AccessLength_QUADWORD :
+ case AccessLength_QUADWORD:
{
unsigned_16 val = U16_8 (MemElem1, MemElem);
sim_core_write_aligned_16 (CPU, cia, write_map, pAddr, val);
break;
}
- case AccessLength_DOUBLEWORD :
+ case AccessLength_DOUBLEWORD:
sim_core_write_aligned_8 (CPU, cia, write_map, pAddr, MemElem);
break;
- case AccessLength_SEPTIBYTE :
+ case AccessLength_SEPTIBYTE:
sim_core_write_misaligned_7 (CPU, cia, write_map, pAddr, MemElem);
break;
- case AccessLength_SEXTIBYTE :
+ case AccessLength_SEXTIBYTE:
sim_core_write_misaligned_6 (CPU, cia, write_map, pAddr, MemElem);
break;
- case AccessLength_QUINTIBYTE :
+ case AccessLength_QUINTIBYTE:
sim_core_write_misaligned_5 (CPU, cia, write_map, pAddr, MemElem);
break;
- case AccessLength_WORD :
+ case AccessLength_WORD:
sim_core_write_aligned_4 (CPU, cia, write_map, pAddr, MemElem);
break;
- case AccessLength_TRIPLEBYTE :
+ case AccessLength_TRIPLEBYTE:
sim_core_write_misaligned_3 (CPU, cia, write_map, pAddr, MemElem);
break;
- case AccessLength_HALFWORD :
+ case AccessLength_HALFWORD:
sim_core_write_aligned_2 (CPU, cia, write_map, pAddr, MemElem);
break;
- case AccessLength_BYTE :
+ case AccessLength_BYTE:
sim_core_write_aligned_1 (CPU, cia, write_map, pAddr, MemElem);
break;
default:
diff --git a/sim/mips/sim-main.h b/sim/mips/sim-main.h
index bcdcd80e3fd..fed625ecb54 100644
--- a/sim/mips/sim-main.h
+++ b/sim/mips/sim-main.h
@@ -64,6 +64,7 @@ typedef unsigned64 uword64;
/* Floating-point operations: */
#include "sim-fpu.h"
+#include "cp1.h"
/* FPU registers must be one of the following types. All other values
are reserved (and undefined). */
@@ -72,6 +73,7 @@ typedef enum {
fmt_double = 1,
fmt_word = 4,
fmt_long = 5,
+ fmt_ps = 6,
/* The following are well outside the normal acceptable format
range, and are used in the register status vector. */
fmt_unknown = 0x10000000,
@@ -80,40 +82,9 @@ typedef enum {
fmt_uninterpreted_64 = 0x80000000U,
} FP_formats;
-unsigned64 value_fpr PARAMS ((SIM_DESC sd, sim_cpu *cpu, address_word cia, int fpr, FP_formats));
-#define ValueFPR(FPR,FMT) value_fpr (SD, CPU, cia, (FPR), (FMT))
-
-void store_fpr PARAMS ((SIM_DESC sd, sim_cpu *cpu, address_word cia, int fpr, FP_formats fmt, unsigned64 value));
-#define StoreFPR(FPR,FMT,VALUE) store_fpr (SD, CPU, cia, (FPR), (FMT), (VALUE))
-
-int NaN PARAMS ((unsigned64 op, FP_formats fmt));
-int Infinity PARAMS ((unsigned64 op, FP_formats fmt));
-int Less PARAMS ((unsigned64 op1, unsigned64 op2, FP_formats fmt));
-int Equal PARAMS ((unsigned64 op1, unsigned64 op2, FP_formats fmt));
-unsigned64 AbsoluteValue PARAMS ((unsigned64 op, FP_formats fmt));
-unsigned64 Negate PARAMS ((unsigned64 op, FP_formats fmt));
-unsigned64 Add PARAMS ((unsigned64 op1, unsigned64 op2, FP_formats fmt));
-unsigned64 Sub PARAMS ((unsigned64 op1, unsigned64 op2, FP_formats fmt));
-unsigned64 Multiply PARAMS ((unsigned64 op1, unsigned64 op2, FP_formats fmt));
-unsigned64 Divide PARAMS ((unsigned64 op1, unsigned64 op2, FP_formats fmt));
-unsigned64 Recip PARAMS ((unsigned64 op, FP_formats fmt));
-unsigned64 SquareRoot PARAMS ((unsigned64 op, FP_formats fmt));
-unsigned64 Max PARAMS ((unsigned64 op1, unsigned64 op2, FP_formats fmt));
-unsigned64 Min PARAMS ((unsigned64 op1, unsigned64 op2, FP_formats fmt));
-unsigned64 convert PARAMS ((SIM_DESC sd, sim_cpu *cpu, address_word cia, int rm, unsigned64 op, FP_formats from, FP_formats to));
-#define Convert(rm,op,from,to) \
-convert (SD, CPU, cia, rm, op, from, to)
-
-/* Macro to update FPSR condition-code field. This is complicated by
- the fact that there is a hole in the index range of the bits within
- the FCSR register. Also, the number of bits visible depends on the
- MIPS ISA version being supported. */
-
-#define SETFCC(cc,v) {\
- int bit = ((cc == 0) ? 23 : (24 + (cc)));\
- FCSR = ((FCSR & ~(1 << bit)) | ((v) << bit));\
-}
-#define GETFCC(cc) (((((cc) == 0) ? (FCSR & (1 << 23)) : (FCSR & (1 << (24 + (cc))))) != 0) ? 1U : 0)
+/* For paired word (pw) operations, the opcode representation is fmt_word,
+ but register transfers (StoreFPR, ValueFPR, etc.) are done as fmt_long. */
+#define fmt_pw fmt_long
/* This should be the COC1 value at the start of the preceding
instruction: */
@@ -128,36 +99,6 @@ convert (SD, CPU, cia, rm, op, from, to)
#define SizeFGR() (WITH_TARGET_FLOATING_POINT_BITSIZE)
#endif
-/* Standard FCRS bits: */
-#define IR (0) /* Inexact Result */
-#define UF (1) /* UnderFlow */
-#define OF (2) /* OverFlow */
-#define DZ (3) /* Division by Zero */
-#define IO (4) /* Invalid Operation */
-#define UO (5) /* Unimplemented Operation */
-
-/* Get masks for individual flags: */
-#if 1 /* SAFE version */
-#define FP_FLAGS(b) (((unsigned)(b) < 5) ? (1 << ((b) + 2)) : 0)
-#define FP_ENABLE(b) (((unsigned)(b) < 5) ? (1 << ((b) + 7)) : 0)
-#define FP_CAUSE(b) (((unsigned)(b) < 6) ? (1 << ((b) + 12)) : 0)
-#else
-#define FP_FLAGS(b) (1 << ((b) + 2))
-#define FP_ENABLE(b) (1 << ((b) + 7))
-#define FP_CAUSE(b) (1 << ((b) + 12))
-#endif
-
-#define FP_FS (1 << 24) /* MIPS III onwards : Flush to Zero */
-
-#define FP_MASK_RM (0x3)
-#define FP_SH_RM (0)
-#define FP_RM_NEAREST (0) /* Round to nearest (Round) */
-#define FP_RM_TOZERO (1) /* Round to zero (Trunc) */
-#define FP_RM_TOPINF (2) /* Round to Plus infinity (Ceil) */
-#define FP_RM_TOMINF (3) /* Round to Minus infinity (Floor) */
-#define GETRM() (int)((FCSR >> FP_SH_RM) & FP_MASK_RM)
-
-
@@ -278,10 +219,10 @@ memset (&(CPU)->pending, 0, sizeof ((CPU)->pending))
/* For backward compatibility */
#define PENDING_FILL(R,VAL) \
do { \
- if ((R) >= FGRIDX && (R) < FGRIDX + NR_FGR) \
+ if ((R) >= FGR_BASE && (R) < FGR_BASE + NR_FGR) \
{ \
- PENDING_SCHED(FGR[(R) - FGRIDX], VAL, 1, -1); \
- PENDING_SCHED(FPR_STATE[(R) - FGRIDX], fmt_uninterpreted, 1, -1); \
+ PENDING_SCHED(FGR[(R) - FGR_BASE], VAL, 1, -1); \
+ PENDING_SCHED(FPR_STATE[(R) - FGR_BASE], fmt_uninterpreted, 1, -1); \
} \
else \
PENDING_SCHED(GPR[(R)], VAL, 1, -1); \
@@ -296,6 +237,24 @@ enum float_operation
};
+/* The internal representation of an MDMX accumulator.
+ Note that 24 and 48 bit accumulator elements are represented in
+ 32 or 64 bits. Since the accumulators are 2's complement with
+ overflow suppressed, high-order bits can be ignored in most contexts. */
+
+typedef signed32 signed24;
+typedef signed64 signed48;
+
+typedef union {
+ signed24 ob[8];
+ signed48 qh[4];
+} MDMX_accumulator;
+
+
+/* Conventional system arguments. */
+#define SIM_STATE sim_cpu *cpu, address_word cia
+#define SIM_ARGS CPU, cia
+
struct _sim_cpu {
@@ -356,7 +315,9 @@ struct _sim_cpu {
#define LAST_EMBED_REGNUM (89)
#define NUM_REGS (LAST_EMBED_REGNUM + 1)
-
+#define FP0_REGNUM 38 /* Floating point register 0 (single float) */
+#define FCRCS_REGNUM 70 /* FP control/status */
+#define FCRIR_REGNUM 71 /* FP implementation/revision */
#endif
@@ -372,15 +333,6 @@ struct _sim_cpu {
#define GPR (&REGISTERS[0])
#define GPR_SET(N,VAL) (REGISTERS[(N)] = (VAL))
- /* While space is allocated for the floating point registers in the
- main registers array, they are stored separatly. This is because
- their size may not necessarily match the size of either the
- general-purpose or system specific registers */
-#define NR_FGR (32)
-#define FGRIDX (38)
- fp_word fgr[NR_FGR];
-#define FGR ((CPU)->fgr)
-
#define LO (REGISTERS[33])
#define HI (REGISTERS[34])
#define PCIDX 37
@@ -433,12 +385,25 @@ struct _sim_cpu {
#define COP0_GPR ((CPU)->cop0_gpr)
#define COP0_BADVADDR ((unsigned32)(COP0_GPR[8]))
+ /* While space is allocated for the floating point registers in the
+ main registers array, they are stored separatly. This is because
+ their size may not necessarily match the size of either the
+ general-purpose or system specific registers. */
+#define NR_FGR (32)
+#define FGR_BASE FP0_REGNUM
+ fp_word fgr[NR_FGR];
+#define FGR ((CPU)->fgr)
+
/* Keep the current format state for each register: */
FP_formats fpr_state[32];
#define FPR_STATE ((CPU)->fpr_state)
pending_write_queue pending;
+ /* The MDMX accumulator (used only for MDMX ASE). */
+ MDMX_accumulator acc;
+#define ACC ((CPU)->acc)
+
/* LLBIT = Load-Linked bit. A bit of "virtual" state used by atomic
read-write instructions. It is set when a linked load occurs. It
is tested and cleared by the conditional store. It is cleared
@@ -545,6 +510,8 @@ struct sim_state {
#define status_CU1 (1 << 29) /* Coprocessor 1 usable */
#define status_CU2 (1 << 30) /* Coprocessor 2 usable */
#define status_CU3 (1 << 31) /* Coprocessor 3 usable */
+/* Bits reserved for implementations: */
+#define status_SBX (1 << 16) /* Enable SiByte SB-1 extensions. */
#define cause_BD ((unsigned)1 << 31) /* L1 Exception in branch delay slot */
#define cause_BD2 (1 << 30) /* L2 Exception in branch delay slot */
@@ -707,6 +674,191 @@ decode_coproc (SD, CPU, cia, (instruction))
int sim_monitor (SIM_DESC sd, sim_cpu *cpu, address_word cia, unsigned int arg);
+/* FPR access. */
+unsigned64 value_fpr (SIM_STATE, int fpr, FP_formats);
+#define ValueFPR(FPR,FMT) value_fpr (SIM_ARGS, (FPR), (FMT))
+void store_fpr (SIM_STATE, int fpr, FP_formats fmt, unsigned64 value);
+#define StoreFPR(FPR,FMT,VALUE) store_fpr (SIM_ARGS, (FPR), (FMT), (VALUE))
+unsigned64 ps_lower (SIM_STATE, unsigned64 op);
+#define PSLower(op) ps_lower (SIM_ARGS, op)
+unsigned64 ps_upper (SIM_STATE, unsigned64 op);
+#define PSUpper(op) ps_upper (SIM_ARGS, op)
+unsigned64 pack_ps (SIM_STATE, unsigned64 op1, unsigned64 op2, FP_formats from);
+#define PackPS(op1,op2) pack_ps (SIM_ARGS, op1, op2, fmt_single)
+
+
+/* FCR access. */
+unsigned_word value_fcr (SIM_STATE, int fcr);
+#define ValueFCR(FCR) value_fcr (SIM_ARGS, (FCR))
+void store_fcr (SIM_STATE, int fcr, unsigned_word value);
+#define StoreFCR(FCR,VALUE) store_fcr (SIM_ARGS, (FCR), (VALUE))
+void test_fcsr (SIM_STATE);
+#define TestFCSR() test_fcsr (SIM_ARGS)
+
+
+/* FPU operations. */
+void fp_cmp (SIM_STATE, unsigned64 op1, unsigned64 op2, FP_formats fmt, int abs, int cond, int cc);
+#define Compare(op1,op2,fmt,cond,cc) fp_cmp(SIM_ARGS, op1, op2, fmt, 0, cond, cc)
+unsigned64 fp_abs (SIM_STATE, unsigned64 op, FP_formats fmt);
+#define AbsoluteValue(op,fmt) fp_abs(SIM_ARGS, op, fmt)
+unsigned64 fp_neg (SIM_STATE, unsigned64 op, FP_formats fmt);
+#define Negate(op,fmt) fp_neg(SIM_ARGS, op, fmt)
+unsigned64 fp_add (SIM_STATE, unsigned64 op1, unsigned64 op2, FP_formats fmt);
+#define Add(op1,op2,fmt) fp_add(SIM_ARGS, op1, op2, fmt)
+unsigned64 fp_sub (SIM_STATE, unsigned64 op1, unsigned64 op2, FP_formats fmt);
+#define Sub(op1,op2,fmt) fp_sub(SIM_ARGS, op1, op2, fmt)
+unsigned64 fp_mul (SIM_STATE, unsigned64 op1, unsigned64 op2, FP_formats fmt);
+#define Multiply(op1,op2,fmt) fp_mul(SIM_ARGS, op1, op2, fmt)
+unsigned64 fp_div (SIM_STATE, unsigned64 op1, unsigned64 op2, FP_formats fmt);
+#define Divide(op1,op2,fmt) fp_div(SIM_ARGS, op1, op2, fmt)
+unsigned64 fp_recip (SIM_STATE, unsigned64 op, FP_formats fmt);
+#define Recip(op,fmt) fp_recip(SIM_ARGS, op, fmt)
+unsigned64 fp_sqrt (SIM_STATE, unsigned64 op, FP_formats fmt);
+#define SquareRoot(op,fmt) fp_sqrt(SIM_ARGS, op, fmt)
+unsigned64 fp_rsqrt (SIM_STATE, unsigned64 op, FP_formats fmt);
+#define RSquareRoot(op,fmt) fp_rsqrt(SIM_ARGS, op, fmt)
+unsigned64 fp_madd (SIM_STATE, unsigned64 op1, unsigned64 op2,
+ unsigned64 op3, FP_formats fmt);
+#define MultiplyAdd(op1,op2,op3,fmt) fp_madd(SIM_ARGS, op1, op2, op3, fmt)
+unsigned64 fp_msub (SIM_STATE, unsigned64 op1, unsigned64 op2,
+ unsigned64 op3, FP_formats fmt);
+#define MultiplySub(op1,op2,op3,fmt) fp_msub(SIM_ARGS, op1, op2, op3, fmt)
+unsigned64 fp_nmadd (SIM_STATE, unsigned64 op1, unsigned64 op2,
+ unsigned64 op3, FP_formats fmt);
+#define NegMultiplyAdd(op1,op2,op3,fmt) fp_nmadd(SIM_ARGS, op1, op2, op3, fmt)
+unsigned64 fp_nmsub (SIM_STATE, unsigned64 op1, unsigned64 op2,
+ unsigned64 op3, FP_formats fmt);
+#define NegMultiplySub(op1,op2,op3,fmt) fp_nmsub(SIM_ARGS, op1, op2, op3, fmt)
+unsigned64 convert (SIM_STATE, int rm, unsigned64 op, FP_formats from, FP_formats to);
+#define Convert(rm,op,from,to) convert (SIM_ARGS, rm, op, from, to)
+unsigned64 convert_ps (SIM_STATE, int rm, unsigned64 op, FP_formats from,
+ FP_formats to);
+#define ConvertPS(rm,op,from,to) convert_ps (SIM_ARGS, rm, op, from, to)
+
+
+/* MIPS-3D ASE operations. */
+#define CompareAbs(op1,op2,fmt,cond,cc) \
+fp_cmp(SIM_ARGS, op1, op2, fmt, 1, cond, cc)
+unsigned64 fp_add_r (SIM_STATE, unsigned64 op1, unsigned64 op2, FP_formats fmt);
+#define AddR(op1,op2,fmt) fp_add_r(SIM_ARGS, op1, op2, fmt)
+unsigned64 fp_mul_r (SIM_STATE, unsigned64 op1, unsigned64 op2, FP_formats fmt);
+#define MultiplyR(op1,op2,fmt) fp_mul_r(SIM_ARGS, op1, op2, fmt)
+unsigned64 fp_recip1 (SIM_STATE, unsigned64 op, FP_formats fmt);
+#define Recip1(op,fmt) fp_recip1(SIM_ARGS, op, fmt)
+unsigned64 fp_recip2 (SIM_STATE, unsigned64 op1, unsigned64 op2, FP_formats fmt);
+#define Recip2(op1,op2,fmt) fp_recip2(SIM_ARGS, op1, op2, fmt)
+unsigned64 fp_rsqrt1 (SIM_STATE, unsigned64 op, FP_formats fmt);
+#define RSquareRoot1(op,fmt) fp_rsqrt1(SIM_ARGS, op, fmt)
+unsigned64 fp_rsqrt2 (SIM_STATE, unsigned64 op1, unsigned64 op2, FP_formats fmt);
+#define RSquareRoot2(op1,op2,fmt) fp_rsqrt2(SIM_ARGS, op1, op2, fmt)
+
+
+/* MDMX access. */
+
+typedef unsigned int MX_fmtsel; /* MDMX format select field (5 bits). */
+#define ob_fmtsel(sel) (((sel)<<1)|0x0)
+#define qh_fmtsel(sel) (((sel)<<2)|0x1)
+
+#define fmt_mdmx fmt_uninterpreted
+
+#define MX_VECT_AND (0)
+#define MX_VECT_NOR (1)
+#define MX_VECT_OR (2)
+#define MX_VECT_XOR (3)
+#define MX_VECT_SLL (4)
+#define MX_VECT_SRL (5)
+#define MX_VECT_ADD (6)
+#define MX_VECT_SUB (7)
+#define MX_VECT_MIN (8)
+#define MX_VECT_MAX (9)
+#define MX_VECT_MUL (10)
+#define MX_VECT_MSGN (11)
+#define MX_VECT_SRA (12)
+#define MX_VECT_ABSD (13) /* SB-1 only. */
+#define MX_VECT_AVG (14) /* SB-1 only. */
+
+unsigned64 mdmx_cpr_op (SIM_STATE, int op, unsigned64 op1, int vt, MX_fmtsel fmtsel);
+#define MX_Add(op1,vt,fmtsel) mdmx_cpr_op(SIM_ARGS, MX_VECT_ADD, op1, vt, fmtsel)
+#define MX_And(op1,vt,fmtsel) mdmx_cpr_op(SIM_ARGS, MX_VECT_AND, op1, vt, fmtsel)
+#define MX_Max(op1,vt,fmtsel) mdmx_cpr_op(SIM_ARGS, MX_VECT_MAX, op1, vt, fmtsel)
+#define MX_Min(op1,vt,fmtsel) mdmx_cpr_op(SIM_ARGS, MX_VECT_MIN, op1, vt, fmtsel)
+#define MX_Msgn(op1,vt,fmtsel) mdmx_cpr_op(SIM_ARGS, MX_VECT_MSGN, op1, vt, fmtsel)
+#define MX_Mul(op1,vt,fmtsel) mdmx_cpr_op(SIM_ARGS, MX_VECT_MUL, op1, vt, fmtsel)
+#define MX_Nor(op1,vt,fmtsel) mdmx_cpr_op(SIM_ARGS, MX_VECT_NOR, op1, vt, fmtsel)
+#define MX_Or(op1,vt,fmtsel) mdmx_cpr_op(SIM_ARGS, MX_VECT_OR, op1, vt, fmtsel)
+#define MX_ShiftLeftLogical(op1,vt,fmtsel) mdmx_cpr_op(SIM_ARGS, MX_VECT_SLL, op1, vt, fmtsel)
+#define MX_ShiftRightArith(op1,vt,fmtsel) mdmx_cpr_op(SIM_ARGS, MX_VECT_SRA, op1, vt, fmtsel)
+#define MX_ShiftRightLogical(op1,vt,fmtsel) mdmx_cpr_op(SIM_ARGS, MX_VECT_SRL, op1, vt, fmtsel)
+#define MX_Sub(op1,vt,fmtsel) mdmx_cpr_op(SIM_ARGS, MX_VECT_SUB, op1, vt, fmtsel)
+#define MX_Xor(op1,vt,fmtsel) mdmx_cpr_op(SIM_ARGS, MX_VECT_XOR, op1, vt, fmtsel)
+#define MX_AbsDiff(op1,vt,fmtsel) mdmx_cpr_op(SIM_ARGS, MX_VECT_ABSD, op1, vt, fmtsel)
+#define MX_Avg(op1,vt,fmtsel) mdmx_cpr_op(SIM_ARGS, MX_VECT_AVG, op1, vt, fmtsel)
+
+#define MX_C_EQ 0x1
+#define MX_C_LT 0x4
+
+void mdmx_cc_op (SIM_STATE, int cond, unsigned64 op1, int vt, MX_fmtsel fmtsel);
+#define MX_Comp(op1,cond,vt,fmtsel) mdmx_cc_op(SIM_ARGS, cond, op1, vt, fmtsel)
+
+unsigned64 mdmx_pick_op (SIM_STATE, int tf, unsigned64 op1, int vt, MX_fmtsel fmtsel);
+#define MX_Pick(tf,op1,vt,fmtsel) mdmx_pick_op(SIM_ARGS, tf, op1, vt, fmtsel)
+
+#define MX_VECT_ADDA (0)
+#define MX_VECT_ADDL (1)
+#define MX_VECT_MULA (2)
+#define MX_VECT_MULL (3)
+#define MX_VECT_MULS (4)
+#define MX_VECT_MULSL (5)
+#define MX_VECT_SUBA (6)
+#define MX_VECT_SUBL (7)
+#define MX_VECT_ABSDA (8) /* SB-1 only. */
+
+void mdmx_acc_op (SIM_STATE, int op, unsigned64 op1, int vt, MX_fmtsel fmtsel);
+#define MX_AddA(op1,vt,fmtsel) mdmx_acc_op(SIM_ARGS, MX_VECT_ADDA, op1, vt, fmtsel)
+#define MX_AddL(op1,vt,fmtsel) mdmx_acc_op(SIM_ARGS, MX_VECT_ADDL, op1, vt, fmtsel)
+#define MX_MulA(op1,vt,fmtsel) mdmx_acc_op(SIM_ARGS, MX_VECT_MULA, op1, vt, fmtsel)
+#define MX_MulL(op1,vt,fmtsel) mdmx_acc_op(SIM_ARGS, MX_VECT_MULL, op1, vt, fmtsel)
+#define MX_MulS(op1,vt,fmtsel) mdmx_acc_op(SIM_ARGS, MX_VECT_MULS, op1, vt, fmtsel)
+#define MX_MulSL(op1,vt,fmtsel) mdmx_acc_op(SIM_ARGS, MX_VECT_MULSL, op1, vt, fmtsel)
+#define MX_SubA(op1,vt,fmtsel) mdmx_acc_op(SIM_ARGS, MX_VECT_SUBA, op1, vt, fmtsel)
+#define MX_SubL(op1,vt,fmtsel) mdmx_acc_op(SIM_ARGS, MX_VECT_SUBL, op1, vt, fmtsel)
+#define MX_AbsDiffC(op1,vt,fmtsel) mdmx_acc_op(SIM_ARGS, MX_VECT_ABSDA, op1, vt, fmtsel)
+
+#define MX_FMT_OB (0)
+#define MX_FMT_QH (1)
+
+/* The following codes chosen to indicate the units of shift. */
+#define MX_RAC_L (0)
+#define MX_RAC_M (1)
+#define MX_RAC_H (2)
+
+unsigned64 mdmx_rac_op (SIM_STATE, int, int);
+#define MX_RAC(op,fmt) mdmx_rac_op(SIM_ARGS, op, fmt)
+
+void mdmx_wacl (SIM_STATE, int, unsigned64, unsigned64);
+#define MX_WACL(fmt,vs,vt) mdmx_wacl(SIM_ARGS, fmt, vs, vt)
+void mdmx_wach (SIM_STATE, int, unsigned64);
+#define MX_WACH(fmt,vs) mdmx_wach(SIM_ARGS, fmt, vs)
+
+#define MX_RND_AS (0)
+#define MX_RND_AU (1)
+#define MX_RND_ES (2)
+#define MX_RND_EU (3)
+#define MX_RND_ZS (4)
+#define MX_RND_ZU (5)
+
+unsigned64 mdmx_round_op (SIM_STATE, int, int, MX_fmtsel);
+#define MX_RNAS(vt,fmt) mdmx_round_op(SIM_ARGS, MX_RND_AS, vt, fmt)
+#define MX_RNAU(vt,fmt) mdmx_round_op(SIM_ARGS, MX_RND_AU, vt, fmt)
+#define MX_RNES(vt,fmt) mdmx_round_op(SIM_ARGS, MX_RND_ES, vt, fmt)
+#define MX_RNEU(vt,fmt) mdmx_round_op(SIM_ARGS, MX_RND_EU, vt, fmt)
+#define MX_RZS(vt,fmt) mdmx_round_op(SIM_ARGS, MX_RND_ZS, vt, fmt)
+#define MX_RZU(vt,fmt) mdmx_round_op(SIM_ARGS, MX_RND_ZU, vt, fmt)
+
+unsigned64 mdmx_shuffle (SIM_STATE, int, unsigned64, unsigned64);
+#define MX_SHFL(shop,op1,op2) mdmx_shuffle(SIM_ARGS, shop, op1, op2)
+
+
/* Memory accesses */
@@ -774,6 +926,7 @@ prefetch (SD, CPU, cia, CCA, pAddr, vAddr, DATA, hint)
void unpredictable_action (sim_cpu *cpu, address_word cia);
#define NotWordValue(val) not_word_value (SD_, (val))
#define Unpredictable() unpredictable (SD_)
+#define UnpredictableResult() /* For now, do nothing. */
INLINE_SIM_MAIN (unsigned32) ifetch32 PARAMS ((SIM_DESC sd, sim_cpu *cpu, address_word cia, address_word vaddr));
#define IMEM32(CIA) ifetch32 (SD, CPU, (CIA), (CIA))
diff --git a/sim/mn10200/ChangeLog b/sim/mn10200/ChangeLog
index 6e997245746..ddc51c9b8d9 100644
--- a/sim/mn10200/ChangeLog
+++ b/sim/mn10200/ChangeLog
@@ -1,3 +1,8 @@
+2002-06-09 Andrew Cagney <cagney@redhat.com>
+
+ * Makefile.in (INCLUDE): Update path to callback.h.
+ * mn10200_sim.h: Include "gdb/callback.h" and "gdb/remote-sim.h".
+
2001-04-15 J.T. Conklin <jtc@redback.com>
* Makefile.in (simops.o): Add simops.h to dependency list.
diff --git a/sim/mn10200/Makefile.in b/sim/mn10200/Makefile.in
index bcc15c86834..563a4edec7b 100644
--- a/sim/mn10200/Makefile.in
+++ b/sim/mn10200/Makefile.in
@@ -25,7 +25,7 @@ SIM_EXTRA_CLEAN = clean-extra
# Select mn10200 support in nltvals.def.
NL_TARGET = -DNL_TARGET_mn10200
-INCLUDE = mn10200_sim.h $(srcdir)/../../include/callback.h
+INCLUDE = mn10200_sim.h $(srcdir)/../../include/gdb/callback.h
## COMMON_POST_CONFIG_FRAG
diff --git a/sim/mn10200/mn10200_sim.h b/sim/mn10200/mn10200_sim.h
index a7b7c4d888c..2f85aa0cb4f 100644
--- a/sim/mn10200/mn10200_sim.h
+++ b/sim/mn10200/mn10200_sim.h
@@ -1,10 +1,10 @@
#include <stdio.h>
#include <ctype.h>
#include "ansidecl.h"
-#include "callback.h"
+#include "gdb/callback.h"
#include "opcode/mn10200.h"
#include <limits.h>
-#include "remote-sim.h"
+#include "gdb/remote-sim.h"
#ifndef INLINE
#ifdef __GNUC__
diff --git a/sim/mn10300/ChangeLog b/sim/mn10300/ChangeLog
index 59f45155012..7245767f471 100644
--- a/sim/mn10300/ChangeLog
+++ b/sim/mn10300/ChangeLog
@@ -1,3 +1,9 @@
+2002-06-09 Andrew Cagney <cagney@redhat.com>
+
+ * Makefile.in (INCLUDE): Update path to callback.h.
+ * mn10300_sim.h: Include "gdb/callback.h" and "gdb/remote-sim.h".
+ * tconfig.in: Ditto.
+
2001-05-06 Jim Blandy <jimb@redhat.com>
* mn10300.igen: Doc fixes.
diff --git a/sim/mn10300/Makefile.in b/sim/mn10300/Makefile.in
index f3a52ed1994..1f493ec467d 100644
--- a/sim/mn10300/Makefile.in
+++ b/sim/mn10300/Makefile.in
@@ -48,7 +48,7 @@ SIM_EXTRA_CLEAN = clean-extra
# Select mn10300 support in nltvals.def.
NL_TARGET = -DNL_TARGET_mn10300
-INCLUDE = mn10300_sim.h $(srcdir)/../../include/callback.h
+INCLUDE = mn10300_sim.h $(srcdir)/../../include/gdb/callback.h
# List of extra flags to always pass to $(CC).
SIM_EXTRA_CFLAGS = @sim_gen@ -DPOLL_QUIT_INTERVAL=0x20
diff --git a/sim/mn10300/mn10300_sim.h b/sim/mn10300/mn10300_sim.h
index da6c25915be..6a2c5715583 100644
--- a/sim/mn10300/mn10300_sim.h
+++ b/sim/mn10300/mn10300_sim.h
@@ -1,10 +1,10 @@
#include <stdio.h>
#include <ctype.h>
#include "ansidecl.h"
-#include "callback.h"
+#include "gdb/callback.h"
#include "opcode/mn10300.h"
#include <limits.h>
-#include "remote-sim.h"
+#include "gdb/remote-sim.h"
#include "bfd.h"
#ifndef INLINE
diff --git a/sim/mn10300/tconfig.in b/sim/mn10300/tconfig.in
index 521b6e77694..14ca8e77645 100644
--- a/sim/mn10300/tconfig.in
+++ b/sim/mn10300/tconfig.in
@@ -2,8 +2,8 @@
/* FIXME: This is unnecessarily necessary: */
#include "ansidecl.h"
-#include "callback.h"
-#include "remote-sim.h"
+#include "gdb/callback.h"
+#include "gdb/remote-sim.h"
#include "sim-module.h"
MODULE_INSTALL_FN dv_sockser_install;
diff --git a/sim/ppc/ChangeLog b/sim/ppc/ChangeLog
index d8198e1a20d..0aea7d41b49 100644
--- a/sim/ppc/ChangeLog
+++ b/sim/ppc/ChangeLog
@@ -1,3 +1,15 @@
+2002-06-08 Andrew Cagney <cagney@redhat.com>
+
+ * main.c: Include "gdb/callback.h" and "gdb/remote-sim.h".
+ * sim_calls.c: Ditto.
+
+2002-05-30 DJ Delorie <dj@redhat.com>
+
+ * lf.c (lf_print__gnu_copyleft): Convert multiline strings to
+ compatible format.
+ * gen-idecode.c (print_run_until_stop_body): Likewise.
+ * gen-model.c (gen_model_c): Likewise.
+
2002-04-15 Elena Zannoni <ezannoni@redhat.com>
* sim_calls.c (sim_fetch_register, sim_store_register): Return -1 for
diff --git a/sim/ppc/gen-idecode.c b/sim/ppc/gen-idecode.c
index 87d76a06029..3b88866aa86 100644
--- a/sim/ppc/gen-idecode.c
+++ b/sim/ppc/gen-idecode.c
@@ -757,21 +757,21 @@ print_run_until_stop_body(lf *file,
if (!generate_smp) {
- lf_putstr(file, "
-/* CASE 1: NO SMP (with or with out instruction cache).
-
- In this case, we can take advantage of the fact that the current
- instruction address does not need to be returned to the cpu object
- after every execution of an instruction. Instead it only needs to
- be saved when either A. the main loop exits or B. A cpu-halt or
- cpu-restart call forces the loop to be re-enered. The later
- functions always save the current cpu instruction address.
-
- Two subcases also exist that with and that without an instruction
- cache.
-
- An additional complexity is the need to ensure that a 1:1 ratio
- is maintained between the execution of an instruction and the
+ lf_putstr(file, "\n\
+/* CASE 1: NO SMP (with or with out instruction cache).\n\
+\n\
+ In this case, we can take advantage of the fact that the current\n\
+ instruction address does not need to be returned to the cpu object\n\
+ after every execution of an instruction. Instead it only needs to\n\
+ be saved when either A. the main loop exits or B. A cpu-halt or\n\
+ cpu-restart call forces the loop to be re-enered. The later\n\
+ functions always save the current cpu instruction address.\n\
+\n\
+ Two subcases also exist that with and that without an instruction\n\
+ cache.\n\
+\n\
+ An additional complexity is the need to ensure that a 1:1 ratio\n\
+ is maintained between the execution of an instruction and the\n\
incrementing of the simulation clock */");
lf_putstr(file, "\n");
@@ -867,12 +867,12 @@ print_run_until_stop_body(lf *file,
if (generate_smp) {
- lf_putstr(file, "
-/* CASE 2: SMP (With or without ICACHE)
-
- The complexity here comes from needing to correctly restart the
- system when it is aborted. In particular if cpu0 requests a
- restart, the next cpu is still cpu1. Cpu0 being restarted after
+ lf_putstr(file, "\n\
+/* CASE 2: SMP (With or without ICACHE)\n\
+\n\
+ The complexity here comes from needing to correctly restart the\n\
+ system when it is aborted. In particular if cpu0 requests a\n\
+ restart, the next cpu is still cpu1. Cpu0 being restarted after\n\
all the other CPU's and the event queue have been processed */");
lf_putstr(file, "\n");
diff --git a/sim/ppc/gen-model.c b/sim/ppc/gen-model.c
index 4ec167717c0..34c1b90f5ce 100644
--- a/sim/ppc/gen-model.c
+++ b/sim/ppc/gen-model.c
@@ -377,7 +377,7 @@ gen_model_c(insn_table *table, lf *file)
lf_printf(file, " }\n");
lf_printf(file, " }\n");
lf_printf(file, "\n");
- lf_printf(file, " error(\"Unknown model '%%s', Models which are known are:%%s\n\",\n");
+ lf_printf(file, " error(\"Unknown model '%%s', Models which are known are:%%s\\n\",\n");
lf_printf(file, " name,\n");
lf_printf(file, " \"");
for(model_ptr = models; model_ptr; model_ptr = model_ptr->next) {
diff --git a/sim/ppc/lf.c b/sim/ppc/lf.c
index 2a420151efa..fc2a3c13524 100644
--- a/sim/ppc/lf.c
+++ b/sim/ppc/lf.c
@@ -273,28 +273,28 @@ lf_print__gnu_copyleft(lf *file)
switch (file->type) {
case lf_is_c:
case lf_is_h:
- nr += lf_printf(file, "\
-/* This file is part of the program psim.
-
- Copyright (C) 1994-1995, Andrew Cagney <cagney@highland.com.au>
-
- 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 file was generated by the program %s */
+ nr += lf_printf(file, "\n\
+/* This file is part of the program psim.\n\
+\n\
+ Copyright (C) 1994-1995, Andrew Cagney <cagney@highland.com.au>\n\
+\n\
+ This program is free software; you can redistribute it and/or modify\n\
+ it under the terms of the GNU General Public License as published by\n\
+ the Free Software Foundation; either version 2 of the License, or\n\
+ (at your option) any later version.\n\
+\n\
+ This program is distributed in the hope that it will be useful,\n\
+ but WITHOUT ANY WARRANTY; without even the implied warranty of\n\
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\
+ GNU General Public License for more details.\n\
+ \n\
+ You should have received a copy of the GNU General Public License\n\
+ along with this program; if not, write to the Free Software\n\
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n\
+ \n\
+ --\n\
+\n\
+ This file was generated by the program %s */\n\
", filter_filename(file->program));
break;
default:
diff --git a/sim/ppc/main.c b/sim/ppc/main.c
index f6ac87f45fd..4df78ab5aef 100644
--- a/sim/ppc/main.c
+++ b/sim/ppc/main.c
@@ -31,8 +31,8 @@
#include "events.h" /* FIXME: psim should provide the interface */
#include "bfd.h"
-#include "callback.h"
-#include "remote-sim.h"
+#include "gdb/callback.h"
+#include "gdb/remote-sim.h"
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
diff --git a/sim/ppc/sim_calls.c b/sim/ppc/sim_calls.c
index 47af5b12a45..f2c2d1950d5 100644
--- a/sim/ppc/sim_calls.c
+++ b/sim/ppc/sim_calls.c
@@ -42,8 +42,8 @@
#include "defs.h"
#include "bfd.h"
-#include "callback.h"
-#include "remote-sim.h"
+#include "gdb/callback.h"
+#include "gdb/remote-sim.h"
/* Define the rate at which the simulator should poll the host
for a quit. */
diff --git a/sim/sh/ChangeLog b/sim/sh/ChangeLog
index 541ed1f27d2..62320a84a69 100644
--- a/sim/sh/ChangeLog
+++ b/sim/sh/ChangeLog
@@ -1,3 +1,7 @@
+2002-06-08 Andrew Cagney <cagney@redhat.com>
+
+ * interp.c: Include "gdb/callback.h" and "gdb/remote-sim.h".
+
2001-01-30 Ben Elliston <bje@redhat.com>
* interp.c (sim_create_inferior): Record program arguments for
diff --git a/sim/sh/interp.c b/sim/sh/interp.c
index 99f51d16a2c..286dd2dccba 100644
--- a/sim/sh/interp.c
+++ b/sim/sh/interp.c
@@ -27,8 +27,8 @@
#include "sysdep.h"
#include "bfd.h"
-#include "callback.h"
-#include "remote-sim.h"
+#include "gdb/callback.h"
+#include "gdb/remote-sim.h"
/* This file is local - if newlib changes, then so should this. */
#include "syscall.h"
diff --git a/sim/tic80/ChangeLog b/sim/tic80/ChangeLog
deleted file mode 100644
index a98b57dad84..00000000000
--- a/sim/tic80/ChangeLog
+++ /dev/null
@@ -1,662 +0,0 @@
-Tue Jul 4 13:58:43 2000 Andrew Cagney <cagney@b1.cygnus.com>
-
- * tic80.igen: Rename insns. Re-format.
- * tic80.dc: rename dc.
- * tic80.ic: rename ic. Replace ``compute'' with ``cache''.
-
-Wed May 24 14:40:34 2000 Andrew Cagney <cagney@b1.cygnus.com>
-
- * configure: Regenerated to track ../common/aclocal.m4 changes.
-
-2000-04-12 Frank Ch. Eigler <fche@redhat.com>
-
- * cpu.h (GPR_CLEAR): New macro.
- (GPR_SET): Removed macro.
-
-Thu Sep 2 18:15:53 1999 Andrew Cagney <cagney@b1.cygnus.com>
-
- * configure: Regenerated to track ../common/aclocal.m4 changes.
-
-1999-05-08 Felix Lee <flee@cygnus.com>
-
- * configure: Regenerated to track ../common/aclocal.m4 changes.
-
-Fri May 1 14:41:11 1998 Andrew Cagney <cagney@b1.cygnus.com>
-
- * insns: Pass correct arguments to sim_engine_abort.
-
-Tue Apr 28 18:33:31 1998 Geoffrey Noer <noer@cygnus.com>
-
- * configure: Regenerated to track ../common/aclocal.m4 changes.
-
-Sun Apr 26 15:31:55 1998 Tom Tromey <tromey@creche>
-
- * configure: Regenerated to track ../common/aclocal.m4 changes.
- * config.in: Ditto.
-
-Sun Apr 26 15:19:45 1998 Tom Tromey <tromey@cygnus.com>
-
- * acconfig.h: New file.
- * configure.in: Reverted change of Apr 24; use sinclude again.
-
-Fri Apr 24 14:16:40 1998 Tom Tromey <tromey@creche>
-
- * configure: Regenerated to track ../common/aclocal.m4 changes.
- * config.in: Ditto.
-
-Fri Apr 24 11:18:28 1998 Tom Tromey <tromey@cygnus.com>
-
- * configure.in: Don't call sinclude.
-
-Fri Apr 24 19:43:30 1998 Andrew Cagney <cagney@b1.cygnus.com>
-
- * ic (rBase, rLink): Make the type a pointer.
-
-Sat Apr 4 20:36:25 1998 Andrew Cagney <cagney@b1.cygnus.com>
-
- * configure: Regenerated to track ../common/aclocal.m4 changes.
-
-Fri Mar 27 16:15:52 1998 Andrew Cagney <cagney@b1.cygnus.com>
-
- * configure: Regenerated to track ../common/aclocal.m4 changes.
-
-Wed Mar 25 12:35:29 1998 Andrew Cagney <cagney@b1.cygnus.com>
-
- * configure: Regenerated to track ../common/aclocal.m4 changes.
-
-Wed Mar 18 12:38:12 1998 Andrew Cagney <cagney@b1.cygnus.com>
-
- * configure: Regenerated to track ../common/aclocal.m4 changes.
-
-Wed Mar 11 14:12:56 1998 Andrew Cagney <cagney@b1.cygnus.com>
-
- * alu.h (IMEM32_IMMED, IMEM32, STORE, MEM): Replace sim_core_*_map
- with read_map, write_map, exec_map resp.
-
-Thu Feb 26 19:08:37 1998 Andrew Cagney <cagney@b1.cygnus.com>
-
- * sim-calls.c (sim_info): Delete.
-
-Tue Feb 17 14:35:05 1998 Michael Meissner <meissner@cygnus.com>
-
- * misc.c (tic80_trace_cond_br): Take size/code arguments, and
- decode bcond conditions and bbo/bbz comparison bits.
-
- * cpu.h (tic80_trace_cond_br): Update prototype.
- (TRACE_COND_PR): Take size/code additional arguments.
-
- * insns: (bbo/bbz/bcnd): Update call to TRACE_COND_PR.
-
-Tue Feb 17 12:50:27 1998 Andrew Cagney <cagney@b1.cygnus.com>
-
- * sim-calls.c (sim_store_register, sim_fetch_register): Pass in
- length parameter. Return -1.
-
-Fri Feb 13 17:11:22 1998 Michael Meissner <meissner@cygnus.com>
-
- * insns ({get,set}_fp_reg): Tic80 floating point is little endian,
- not big endian.
-
- * misc.c (tic80_trace_fpu*): Pass address of sim_fpu structure,
- not the structure itself. Use %g consistantly to print floating
- point.
-
- * cpu.h: (tic80_trace_fpu*): Update prototypes.
-
-Tue Feb 3 16:25:47 1998 Andrew Cagney <cagney@b1.cygnus.com>
-
- * alu.h (IMEM32, IMEM32_IMMED): Rename IMEM and IMEM_IMMED so that
- in sync with recent igen change.
-
-Sun Feb 1 16:47:51 1998 Andrew Cagney <cagney@b1.cygnus.com>
-
- * configure: Regenerated to track ../common/aclocal.m4 changes.
-
-Sat Jan 31 18:15:41 1998 Andrew Cagney <cagney@b1.cygnus.com>
-
- * configure: Regenerated to track ../common/aclocal.m4 changes.
-
-Fri Jan 30 11:47:50 1998 Andrew Cagney <cagney@b1.cygnus.com>
-
- * cpu.h (CPU_CIA): Delete macro, replace with...
- (CIA_SET, CIA_GET): Define.
-
-Wed Jan 28 18:44:33 1998 Michael Meissner <meissner@cygnus.com>
-
- * misc.c (tic80_trace_cmp_internal): New function to return
- compare bits as a string.
- (tic80_trace_{,fpu2}cmp): New functions for tracing cmp and fcmp.
-
- * cpu.h (tic80_trace_{,fpu2}cmp): Add declaration.
- (TRACE_{,FPU2}CMP): New macros for tracing compares.
-
- * insns (do_{,f}cmp): Use compare specific tracing functions to
- print out the flag bits.
-
-Mon Jan 19 22:26:29 1998 Doug Evans <devans@seba>
-
- * configure: Regenerated to track ../common/aclocal.m4 changes.
-
-Mon Dec 15 23:17:11 1997 Andrew Cagney <cagney@b1.cygnus.com>
-
- * configure: Regenerated to track ../common/aclocal.m4 changes.
- * config.in: Ditto.
-
-Thu Dec 4 09:21:05 1997 Doug Evans <devans@canuck.cygnus.com>
-
- * configure: Regenerated to track ../common/aclocal.m4 changes.
-
-Mon Nov 24 14:57:58 1997 Doug Evans <devans@seba.cygnus.com>
-
- * cpu.h (TRACE_COND_BR): Use TRACE_BRANCH_P, not TRACE_ALU_P.
-
-Sat Nov 22 21:42:09 1997 Andrew Cagney <cagney@b1.cygnus.com>
-
- * interp.c (engine_step): Replace SIGTRAP with SIM_SIGTRAP.
- (engine_run_until_stop): Replace SIGINT with SIM_SIGINT.
-
- * sim-main.h: Include sim-signal.h.
- (SIGTRAP): Delete definition.
-
- * interp.c, sim-calls.c: Do not include signal.h.
-
- * insns (illegal): SIGILL -> SIM_SIGILL.
- (fp_unavailable): SIGFPE -> SIM_SIGFPE.
- (do_trap): SIGTRAP -> SIM_SIGTRAP.
-
-Tue Nov 18 15:33:48 1997 Doug Evans <devans@canuck.cygnus.com>
-
- * sim-main.h (CIA_ADDR): Define.
-
- * Makefile.in (SIM_OBJS): Use $(SIM_NEW_COMMON_OBJS).
-
-Fri Oct 17 17:26:36 1997 Andrew Cagney <cagney@b1.cygnus.com>
-
- * alu.h (ALU32_END): Use ALU32_RESULT.
-
-Mon Sep 29 12:49:06 1997 Andrew Cagney <cagney@b1.cygnus.com>
-
- * insns (get_fp_reg, set_fp_reg): Update to use changed sim_fpu
- interface.
- (do_fadd, do_fcmp, do_fdiv, do_fmpy, do_frnd, do_fsub): Ditto.
-
- * misc.c (tic80_trace_fpu3, tic80_trace_fpu2, tic80_trace_fpu1,
- tic80_trace_fpu2i) Update to use changed sim_fpu interface.
-
-Fri Oct 3 09:28:00 1997 Andrew Cagney <cagney@b1.cygnus.com>
-
- * configure.in (SIM_AC_OPTIONS_BITSIZE): Define.
- * configure: Regenerated to track ../common/aclocal.m4 changes.
-
-Wed Sep 24 17:38:57 1997 Andrew Cagney <cagney@b1.cygnus.com>
-
- * configure: Regenerated to track ../common/aclocal.m4 changes.
-
-Tue Sep 23 11:04:38 1997 Andrew Cagney <cagney@b1.cygnus.com>
-
- * configure: Regenerated to track ../common/aclocal.m4 changes.
-
-Tue Sep 23 10:19:51 1997 Andrew Cagney <cagney@b1.cygnus.com>
-
- * Makefile.in (SIM_WARNINGS, SIM_ALIGNMENT, SIM_ENDIAN,
- SIM_HOSTENDIAN, SIM_INLINE, SIM_RESERVED_BITS): Delete, moved to
- common.
- (SIM_EXTRA_CFLAGS): Update.
-
-Mon Sep 22 11:46:20 1997 Andrew Cagney <cagney@b1.cygnus.com>
-
- * configure: Regenerated to track ../common/aclocal.m4 changes.
-
-Fri Sep 19 17:45:25 1997 Andrew Cagney <cagney@b1.cygnus.com>
-
- * configure: Regenerated to track ../common/aclocal.m4 changes.
-
-Tue Sep 16 23:10:03 1997 Felix Lee <flee@cygnus.com>
-
- * sim-main.h (kill): macro was missing args.
- (SIGTRAP): define for MSVC.
-
-Mon Sep 15 17:36:15 1997 Andrew Cagney <cagney@b1.cygnus.com>
-
- * configure: Regenerated to track ../common/aclocal.m4 changes.
-
-Mon Sep 8 20:10:43 1997 Andrew Cagney <cagney@b1.cygnus.com>
-
- * cpu.h (CPU_CIA): Define.
-
- * sim-main.h (struct sim_state): Delete halt_ok, path_to_halt,
- restart_ok, path_to_restart members.
- (struct sim_state): Delete reason, siggnal members.
-
-Thu Sep 4 17:21:23 1997 Doug Evans <dje@seba>
-
- * configure: Regenerated to track ../common/aclocal.m4 changes.
-
-Thu Sep 4 17:45:14 1997 Andrew Cagney <cagney@b1.cygnus.com>
-
- * sim-calls.c (sim_open): Add memory before parsing arguments.
- (sim_read): Delete, replace with sim-hrw.
- (sim_write): Delete, replace with sim-hrw.
-
-Thu Sep 4 10:48:57 1997 Andrew Cagney <cagney@b1.cygnus.com>
-
- * sim-calls.c (sim_open): Use sim_do_command to add memory, only
- add memory if none already present.
- (sim_open): Move init of registers from here.
- (sim_create_inferior): To here. Init modules.
-
- * Makefile.in (SIM_OBJS): Add sim-memopt.o module.
-
- * sim-calls.c (sim_open): Add zero modulo arg to sim_core_attach.
-
-Mon Sep 1 11:06:30 1997 Andrew Cagney <cagney@b1.cygnus.com>
-
- * sim-calls.c (sim_open): Use sim_state_alloc
- (simulation): Delete.
-
-Sat Aug 30 09:40:47 1997 Andrew Cagney <cagney@b1.cygnus.com>
-
- * insns (do_trap): Unsigned `i' for unsigned iterator.
- (do_trap): Ditto for comparison with getpid.
-
-Wed Aug 27 18:13:22 1997 Andrew Cagney <cagney@b1.cygnus.com>
-
- * configure: Regenerated to track ../common/aclocal.m4 changes.
- * config.in: Ditto.
-
-Wed Aug 27 13:41:24 1997 Andrew Cagney <cagney@b1.cygnus.com>
-
- * insns (do_st): Use U8_4 instead of V4_L8.
-
- * sim-calls.c (sim_open): Add call to sim_analyze_program, update
- call to sim_config.
-
- * sim-calls.c (sim_kill): Delete.
- (sim_create_inferior): Add ABFD argument. Initialize PC from ABFD
- and not SD.
- (sim_load): Delete, use sim-hload.c.
-
- * Makefile.in (SIM_OBJS): Add sim-hload.o module.
-
-Mon Aug 25 17:50:22 1997 Andrew Cagney <cagney@b1.cygnus.com>
-
- * configure: Regenerated to track ../common/aclocal.m4 changes.
- * config.in: Ditto.
-
-Mon Aug 25 16:33:29 1997 Andrew Cagney <cagney@b1.cygnus.com>
-
- * sim-calls.c (sim_open): Add ABFD argument.
- (sim_open): Move sim_config call to just after argument
- parsing. Check return status.
-
-Fri Aug 8 21:52:27 1997 Mark Alexander <marka@cygnus.com>
-
- * sim-calls.c (sim_store_register): Allow accumulators
- other than A0 to be modified. Correct error message.
-
-Thu May 29 14:02:40 1997 Andrew Cagney <cagney@b1.cygnus.com>
-
- * misc.c (tic80_trace_fpu3, tic80_trace_fpu2, tic80_trace_fpu1,
- tic80_trace_fpu2i): Pass in function prefix.
- (tic80_trace_ldst): Rewrite so it calls print_one_insn directly.
-
- * Makefile.in (SIM_OBJS): Include sim-watch.o module.
-
- * sim-main.h (WITH_WATCHPOINTS): Enable watchpoints.
-
- * ic (bitnum): Compute bitnum from BITNUM.
- * insn (bbo, bbz): Use.
-
- * insn: Convert long immediate instructions to igen long immediate
- form.
- * insn: Add disasembler information.
-
-Thu May 29 12:09:13 1997 Andrew Cagney <cagney@b2.cygnus.com>
-
- * alu.h (IMEM_IMMED): New macro, fetch 32bit immediate operand N.
-
- * insns (subu i): Immediate is signed not unsigned.
-
-Tue May 27 13:22:13 1997 Andrew Cagney <cagney@b1.cygnus.com>
-
- * sim-calls.c (sim_read): Pass NULL cpu to sim_core_read_buffer.
- (sim_write): Ditto for write.
-
-Tue May 20 09:33:31 1997 Andrew Cagney <cagney@b1.cygnus.com>
-
- * sim-calls.c (sim_load): Set STATE_LOADED_P.
-
- * sim-main.h: Include <unistd.h>.
-
- * sim-calls.c (sim_set_callback): Delete.
- (sim_open): Add/install callback argument.
- (sim_size): Delete.
-
-Mon May 19 18:59:33 1997 Mike Meissner <meissner@cygnus.com>
-
- * configure.in: Check for getpid, kill functions.
- * config{.in,ure}: Regenerate.
-
- * insns (do_trap): Add support for kill, getpid system calls.
-
- * sim-main.h (errno.h): Include.
- (getpid,kill): Define as NOPs if the host doesn't have them.
-
-Mon May 19 14:58:47 1997 Andrew Cagney <cagney@b1.cygnus.com>
-
- * sim-calls.c (sim_open): Set the simulator base magic number.
- (sim_load): Delete prototype of sim_load_file.
- (sim_open): Define sd to be &simulation.
-
-Fri May 16 14:35:30 1997 Andrew Cagney <cagney@b1.cygnus.com>
-
- * insns (illegal, fp_unavailable): Halt instead of abort the
- simulator.
-
- * insns: Replace calls to engine_error with sim_engine_abort.
- Ditto for engine_halt V sim_engine_halt.
-
-Tue May 13 15:24:12 1997 Andrew Cagney <cagney@b2.cygnus.com>
-
- * interp.c (engine_run_until_stop): Delete. Moved to common.
- (engine_step): Ditto.
- (engine_step): Ditto.
- (engine_halt): Ditto.
- (engine_restart): Ditto.
- (engine_halt): Ditto.
- (engine_error): Ditto.
-
- * sim-calls.c (sim_stop): Delete. Moved to common.
- (sim_stop_reason): Ditto.
- (sim_resume): Ditto.
-
- * Makefile.in (SIM_OBJS): Link in generic sim-engine, sim-run,
- sim-resume, sim-reason, sim-stop modules.
-
-Fri May 16 11:57:49 1997 Andrew Cagney <cagney@b1.cygnus.com>
-
- * ic (compute): Drop check for REG == 0, now always forced to
- zero.
-
- * cpu.h (GPR_SET): New macro update the gpr.
- * insns (do_add): Use GPR_SET to update the GPR register.
-
- * sim-calls.c (sim_fetch_register): Pretend that r0 is zero.
-
- * Makefile.in (tmp-igen): Specify zero-r0 so that every
- instruction clears r0.
-
- * interp.c (engine_run_until_stop): Igen now generates code to
- clear r0.
- (engine_step): Ditto.
-
-Thu May 15 11:45:37 1997 Andrew Cagney <cagney@b1.cygnus.com>
-
- * insns (do_shift): When rot==0 and zero/sign merge treat it as
- 32.
- (set_fp_reg): For interger conversion, use sim-fpu fpu2i
- functions.
- (do_fmpy): Perform iii and uuu using integer arithmetic.
-
- * Makefile.in (ENGINE_H): Assume everything depends on the fpu.
-
- * insns (get_fp_reg): Use sim_fpu_u32to to perform unsigned
- conversion.
- (do_fcmp): Update to use new fp compare functions. Make reg nr arg
- instead of reg. Stops fp overflow.
- (get_fp_reg): Assume val is valid when reg == 0.
- (set_fp_reg): Fix double conversion.
-
- * misc.c (tic80_trace_fpu1): New function, trace simple fp op.
-
- * insns (do_frnd): Add tracing.
-
- * cpu.h (TRACE_FPU1): Ditto.
-
- * insns (do_trap): Printf formatting.
-
-Wed May 14 18:05:50 1997 Mike Meissner <meissner@cygnus.com>
-
- * misc.c (tic80_trace_fpu{3,2,2i}): Align columns with other
- insns. Use %g to print floating point instead of %f in case the
- numbers are real large.
-
-Tue May 13 18:00:10 1997 Mike Meissner <meissner@cygnus.com>
-
- * insns (do_trap): For system calls that are defined, but not
- provided return EINVAL. Temporarily add traps 74-79 to just print
- the register state.
-
- * interp.c (engine_{run_until_stop,step}): Before executing
- instructions, make sure r0 == 0.
-
-Tue May 13 16:39:37 1997 Andrew Cagney <cagney@b1.cygnus.com>
-
- * alu.h (IMEM): Take full cia not just IP as argument.
-
- * interp.c (engine_run_until_stop): Delete handling of annuled
- instructions.
- (engine_step): Ditto.
-
- * insn (do_branch): New function.
- (do_bbo, do_bbz, do_bcnd, do_bsr, do_jsr): Use do_branch to handle
- annuled branches.
-
-Mon May 12 17:15:52 1997 Mike Meissner <meissner@cygnus.com>
-
- * insns (do_{ld,st}): Fix tracing for ld/st.
-
-Mon May 12 11:12:24 1997 Andrew Cagney <cagney@b1.cygnus.com>
-
- * sim-calls.c (sim_stop_reason): Restore keep_running after a
- CNTRL-C, don't re-clear it.
-
- * interp.c (engine_error): stop rather than signal with SIGABRT
- when an error.
-
- * insns (do_ld): For 64bit loads, always store LSW in rDest, MSW in
- rDest + 1. Also done by Michael Meissner <meissner@cygnus.com>
- (do_st): Converse for store.
-
- * misc.c (tic80_trace_fpu2i): Correct printf format for int type.
-
-Sun May 11 11:02:57 1997 Andrew Cagney <cagney@b1.cygnus.com>
-
- * sim-calls.c (sim_stop_reason): Return a SIGINT if keep_running
- was cleared.
-
- * interp.c (engine_step): New function. Single step the simulator
- taking care of cntrl-c during a step.
-
- * sim-calls.c (sim_resume): Differentiate between stepping and
- running so that a cntrl-c during a step is reported.
-
-Sun May 11 10:54:31 1997 Mark Alexander <marka@cygnus.com>
-
- * sim-calls.c (sim_fetch_register): Use correct reg base.
- (sim_store_register): Ditto.
-
-Sun May 11 10:25:14 1997 Michael Meissner <meissner@cygnus.com>
-
- * cpu.h (tic80_trace_shift): Add declaration.
- (TRACE_SHIFT): New macro to trace shift instructions.
-
- * misc.c (tic80_trace_alu2): Align spacing.
- (tic80_trace_shift): New function to trace shifts.
-
- * insns (lmo): Add missing 0b prefix to bits.
- (do_shift): Use ~ (unsigned32)0, instead of -1. Use TRACE_SHIFT
- instead of TRACE_ALU2.
- (sl r): Use EndMask as is, instead of using Source+1 register.
- (subu): Operands are unsigned, not signed.
- (do_{ld,st}): Fix endian problems with ld.d/st.d.
-
-Sat May 10 12:35:47 1997 Michael Meissner <meissner@cygnus.com>
-
- * insns (and{.tt,.tf,.ft,.ff}): Immediate values are unsigned, not
- signed.
-
-Fri May 9 15:47:36 1997 Mike Meissner <meissner@cygnus.com>
-
- * insns (cmp_vals,do_cmp): Produce the correct bits as specified
- by the architecture.
- (xor): Fix xor immediate patterns to use the correct bits.
-
-Fri May 9 09:55:33 1997 Andrew Cagney <cagney@b1.cygnus.com>
-
- * alu.h (long_immediate): Adjust the CIA delay-pointer as well as
- the NIA when a 64bit insn.
-
-Thu May 8 11:57:47 1997 Michael Meissner <meissner@cygnus.com>
-
- * insns (jsr,bsr): For non-allulled calls, set r31 so that the
- return address does not reexecute the instruction in the delay
- slot.
- (bbo,bbz): Complement bit number to reverse the one's complement
- that the assembler is required to do.
-
- * misc.c (tic80_trace_*): Change format slightly to accomidate
- real large decimal values.
-
-Thu May 8 14:07:16 1997 Andrew Cagney <cagney@b1.cygnus.com>
-
- * sim-calls.c (sim_do_command): Implement.
- (sim_store_register): Fix typo T2H v H2T.
-
-Wed May 7 11:48:55 1997 Andrew Cagney <cagney@b1.cygnus.com>
-
- * cpu.h (TRACE_FPU2, TRACE_FPU3, TRACE_FPU2I): Add.
- * insn: Clean up fpu tracing.
-
- * sim-calls.c (sim_create_inferior): Start out with interrupts
- enabled.
-
- * cpu.h (TRACE_SINK3), misc.c (tic80_trace_sink3): Three argument
- sink
-
- * insns (rdcr, swcr, wrcr, brcr, rmo, lmo): Implement.
-
- * insns (do_*): Remove MY_INDEX/indx argument from support functions,
- igen now handles this.
-
- * cpu.h (CR): New macro - access TIc80 control registers.
-
- * misc.c: New file.
- (tic80_cr2index): New function, map control register opcode index
- into the internal CR enum.
-
- * interp.c
- (tic80_trace_{alu{2,3},nop,sink{1,2},{,u}cond_br,ldst}): Move from
- here
- * misc.c: to here.
-
- * Makefile.in (SIM_OBJS): Add misc.o.
-
-Tue May 6 15:22:58 1997 Mike Meissner <meissner@cygnus.com>
-
- * cpu.h ({,v}{S,D}P_FPR): Delete unused macros that won't work on
- big endian hosts.
- (tic80_trace_{alu{2,3},nop,sink{1,2},{,u}cond_br,ldst}): Declare
- new functions.
- (TRACE_{ALU{2,3},NOP,SINK{1,2},{,U}COND_BR,LD,ST}): New macros to
- trace various instruction types.
-
- * insns: Modify all instructions to support semantic tracing.
-
- * interp.c (toplevel): Include itable.h.
- (tic80_trace_{alu{2,3},nop,sink{1,2},{,u}cond_br,ldst}): New
- functions to provide semantic level tracing information.
-
-Mon May 5 11:50:43 1997 Andrew Cagney <cagney@b1.cygnus.com>
-
- * alu.h: Update usage of core object to reflect recent changes in
- ../common/sim-*core.
- * sim-calls.c (sim_open): Ditto.
-
-Mon May 5 14:10:17 1997 Andrew Cagney <cagney@b1.cygnus.com>
-
- * insn (cmnd): No-op cache flushes.
-
- * insns (do_trap): Allow writes to STDERR.
-
- * Makefile.in (SIM_OBJS): Link in sim-fpu.o.
- (SIM_EXTRA_LIBS): Link in the math library.
-
- * alu.h: Add support for floating point unit using sim-alu.
-
- * insns (fadd, fsub, fmpy, fdiv, fcmp, frnd*): Implement.
-
-Fri May 2 14:57:14 1997 Andrew Cagney <cagney@b1.cygnus.com>
-
- * sim-calls.c: Include sim-utils.h and sim-options.h.
-
- * sim-main.h (sim_state): Drop sim_events and sim_core members,
- moved to simulator base type.
-
- * alu.h (IMEM, MEM, STORE): Update track changes in common
- directory.
-
- * insns: Drop cia argument from functions, igen now handles this.
-
- * interp.c (engine_init): Include string.h/strings.h to define
- memset et.al.
-
- * sim-main.h (sim_cia): Delcare, tracking common dir changes.
-
- * cpu.h (sim_cpu): Update instruction_address with sim_cia.
-
-Wed Apr 30 11:26:56 1997 Andrew Cagney <cagney@b1.cygnus.com>
-
- * sim-main.h (signal.h): Include so that SIG* available to all
- callers of sig_halt.
-
- * insns (do_shift): New function, implement shift operations.
- (do_trap): Add handler for trap 73 - SIGTRAP.
-
-Tue Apr 29 10:58:48 1997 Andrew Cagney <cagney@b1.cygnus.com>
-
- * alu.h (MEM, STORE): Force addresses to be correctly aligned.
-
- * insns (do_jsr): Fix.
- (do_st, do_ld): Handle 64bit transfers.
- (do_trap): Match libgloss.
- (rdcr): Implement nop - Dest == r0 - variant.
-
- * sim-calls.c (sim_create_inferior): Initialize SP.
-
- * Makefile.in (ENGINE_H): Everything now depends on sim-options.h.
- (support.o): Depends on ENGINE_H.
-
- * cpu.h: Four accumulators.
-
- * Makefile.in (tmp-igen): Include line number information in
- generated files.
-
- * insns (dld, dst): Fill in.
-
-Mon Apr 28 13:02:26 1997 Andrew Cagney <cagney@b1.cygnus.com>
-
- * insns (vld): Fix instruction format wrong.
-
-Thu Apr 24 16:43:09 1997 Andrew Cagney <cagney@b1.cygnus.com>
-
- * dc: Add additional rules so that minor opcode files are
- detected.
- * insns: Enable more instructions.
-
- * sim-calls.c (sim_fetch_register,sim_store_register, sim_write):
- Implement.
-
-Thu Apr 24 00:39:51 1997 Doug Evans <dje@canuck.cygnus.com>
-
- * configure: Regenerated to track ../common/aclocal.m4 changes.
- * Makefile.in (SIM_OBJS): Add sim-module.o, sim-profile.o.
- * sim-calls.c (sim_open): Call sim_module_uninstall if argument
- parsing fails. Call sim_post_argv_init.
- (sim_close): Call sim_module_uninstall.
-
-Wed Apr 23 20:05:33 1997 Andrew Cagney <cagney@b1.cygnus.com>
-
- * insns (and, bbo, bcnd, bsr, dcache, jsr, or, xor, nor): Enable.
- * ic: Add fields for enabled instructions.
-
diff --git a/sim/tic80/Makefile.in b/sim/tic80/Makefile.in
deleted file mode 100644
index 7111a618d47..00000000000
--- a/sim/tic80/Makefile.in
+++ /dev/null
@@ -1,140 +0,0 @@
-# Makefile for blah ...
-# Copyright blah ...
-
-
-
-## COMMON_PRE_CONFIG_FRAG
-
-# These variables are given default values in COMMON_PRE_CONFIG_FRAG.
-# We override the ones we need to here.
-# Not all of these need to be mentioned, only the necessary ones.
-
-# List of object files, less common parts.
-SIM_OBJS = \
- $(SIM_NEW_COMMON_OBJS) \
- support.o idecode.o semantics.o itable.o misc.o \
- sim-engine.o \
- sim-calls.o \
- sim-hload.o \
- sim-hrw.o \
- sim-reason.o \
- sim-resume.o \
- sim-run.o \
- sim-stop.o \
-
-# List of extra dependencies.
-# Generally this consists of simulator specific files included by sim-main.h.
-SIM_EXTRA_DEPS = itable.h idecode.h cpu.h alu.h
-
-# List of extra libraries to link with
-SIM_EXTRA_LIBS = -lm
-
-# List of generators
-SIM_GEN=tmp-igen
-
-# List of flags to always pass to $(CC).
-
-SIM_EXTRA_CFLAGS = \
- -DWITH_TARGET_WORD_MSB=31
-
-# List of main object files for `run'.
-SIM_RUN_OBJS = nrun.o
-
-# Dependency of `clean' to clean any extra files.
-SIM_EXTRA_CLEAN = clean-igen
-
-
-## COMMON_POST_CONFIG_FRAG
-
-# Rules need to build $(SIM_OBJS), plus whatever else the target wants.
-
-# ... target specific rules ...
-
-BUILT_SRC_FROM_IGEN = \
- icache.h \
- icache.c \
- idecode.h \
- idecode.c \
- semantics.h \
- semantics.c \
- model.h \
- model.c \
- support.h \
- support.c \
- itable.h itable.c
-$(BUILT_SRC_FROM_IGEN): tmp-igen
-#
-
-.PHONY: clean-igen
-clean-igen:
- rm -f $(BUILT_SRC_FROM_IGEN)
- rm -f tmp-igen tmp-insns
-
-../igen/igen:
- cd ../igen && $(MAKE)
-
-tmp-igen: $(srcdir)/tic80.dc $(srcdir)/tic80.igen $(srcdir)/tic80.ic ../igen/igen
- cd ../igen && $(MAKE)
- ../igen/igen \
- -F f \
- -G direct-access \
- -G delayed-branch \
- -G zero-r0 \
- -F short,emul \
- -B 32 -H 31 \
- -o $(srcdir)/tic80.dc \
- -k $(srcdir)/tic80.ic \
- -i $(srcdir)/tic80.igen \
- -n icache.h -hc tmp-icache.h \
- -n icache.c -c tmp-icache.c \
- -n semantics.h -hs tmp-semantics.h \
- -n semantics.c -s tmp-semantics.c \
- -n idecode.h -hd tmp-idecode.h \
- -n idecode.c -d tmp-idecode.c \
- -n model.h -hm tmp-model.h \
- -n model.c -m tmp-model.c \
- -n support.h -hf tmp-support.h \
- -n support.c -f tmp-support.c \
- -n itable.h -ht tmp-itable.h \
- -n itable.c -t tmp-itable.c
- $(srcdir)/../../move-if-change tmp-icache.h icache.h
- $(srcdir)/../../move-if-change tmp-icache.c icache.c
- $(srcdir)/../../move-if-change tmp-idecode.h idecode.h
- $(srcdir)/../../move-if-change tmp-idecode.c idecode.c
- $(srcdir)/../../move-if-change tmp-semantics.h semantics.h
- $(srcdir)/../../move-if-change tmp-semantics.c semantics.c
- $(srcdir)/../../move-if-change tmp-model.h model.h
- $(srcdir)/../../move-if-change tmp-model.c model.c
- $(srcdir)/../../move-if-change tmp-support.h support.h
- $(srcdir)/../../move-if-change tmp-support.c support.c
- $(srcdir)/../../move-if-change tmp-itable.h itable.h
- $(srcdir)/../../move-if-change tmp-itable.c itable.c
- touch tmp-igen
-
-ENGINE_H = \
- sim-main.h \
- $(srcdir)/../common/sim-basics.h \
- config.h \
- $(srcdir)/../common/sim-config.h \
- $(srcdir)/../common/sim-inline.h \
- $(srcdir)/../common/sim-types.h \
- $(srcdir)/../common/sim-bits.h \
- $(srcdir)/../common/sim-endian.h \
- $(srcdir)/../common/sim-options.h \
- itable.h \
- idecode.h \
- cpu.h \
- alu.h \
- $(srcdir)/../common/sim-alu.h \
- $(srcdir)/../common/sim-core.h \
- $(srcdir)/../common/sim-events.h \
- $(srcdir)/../common/sim-fpu.h \
- $(srcdir)/../common/sim-engine.h \
-
-idecode.o: $(ENGINE_H)
-semantics.o: $(ENGINE_H)
-support.o: $(ENGINE_H)
-interp.o: interp.c $(ENGINE_H)
-sim-calls.o: sim-calls.c $(ENGINE_H)
-cpu.o: cpu.c $(ENGINE_H)
-misc.o: $(ENGINE_H) \ No newline at end of file
diff --git a/sim/tic80/acconfig.h b/sim/tic80/acconfig.h
deleted file mode 100644
index f9b87a10c60..00000000000
--- a/sim/tic80/acconfig.h
+++ /dev/null
@@ -1,15 +0,0 @@
-
-/* Define to 1 if NLS is requested. */
-#undef ENABLE_NLS
-
-/* Define as 1 if you have catgets and don't want to use GNU gettext. */
-#undef HAVE_CATGETS
-
-/* Define as 1 if you have gettext and don't want to use GNU gettext. */
-#undef HAVE_GETTEXT
-
-/* Define as 1 if you have the stpcpy function. */
-#undef HAVE_STPCPY
-
-/* Define if your locale.h file contains LC_MESSAGES. */
-#undef HAVE_LC_MESSAGES
diff --git a/sim/tic80/alu.h b/sim/tic80/alu.h
deleted file mode 100644
index b5bc7c1af31..00000000000
--- a/sim/tic80/alu.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/* Texas Instruments TMS320C80 (MVP) Simulator.
- Copyright (C) 1997 Free Software Foundation, Inc.
- Contributed by Cygnus Support.
-
-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 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 _TIC80_ALU_H_
-#define _TIC80_ALU_H_
-
-#define ALU_CARRY 0 /* FIXME */
-
-#define ALU32_END(TARG) \
-{ \
- (TARG) = ALU32_RESULT; /* FIXME */ \
-}
-
-#define ALU_END(TARG) ALU32_END(TARG)
-
-#include "sim-alu.h"
-
-
-
-/* Bring data in from the cold */
-
-#define IMEM32(CIA) \
-(sim_core_read_aligned_4(STATE_CPU (sd, 0), CIA, exec_map, (CIA).ip))
-
-#define IMEM32_IMMED(CIA, N) \
-(sim_core_read_aligned_4 (STATE_CPU (sd, 0), CIA, exec_map, (CIA).ip + 4 * (N)))
-
-#define MEM(SIGN, EA, NR_BYTES) \
-((SIGN##_##NR_BYTES) sim_core_read_unaligned_##NR_BYTES (STATE_CPU (sd, 0), cia, \
- read_map, \
- (EA)))
-
-#define STORE(EA, NR_BYTES, VAL) \
-do { \
- sim_core_write_unaligned_##NR_BYTES (STATE_CPU (sd, 0), cia, \
- write_map, \
- (EA), (VAL)); \
-} while (0)
-
-
-#define long_immediate(VARIABLE) \
- unsigned_word VARIABLE = MEM (unsigned, nia.ip, 4); \
- cia.dp += sizeof (instruction_word); \
- nia.ip += sizeof (instruction_word); \
- nia.dp += sizeof (instruction_word);
-
-
-
-/* Floating point support */
-
-#define IS_FP_AVAILABLE ((CPU)->cr[IE_CR] & IE_CR_IE)
-
-#include "sim-fpu.h"
-
-
-#endif
diff --git a/sim/tic80/config.in b/sim/tic80/config.in
deleted file mode 100644
index fffbc5935ef..00000000000
--- a/sim/tic80/config.in
+++ /dev/null
@@ -1,168 +0,0 @@
-/* config.in. Generated automatically from configure.in by autoheader. */
-
-/* Define if using alloca.c. */
-#undef C_ALLOCA
-
-/* Define to empty if the keyword does not work. */
-#undef const
-
-/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
- This function is required for alloca.c support on those systems. */
-#undef CRAY_STACKSEG_END
-
-/* Define if you have alloca, as a function or macro. */
-#undef HAVE_ALLOCA
-
-/* Define if you have <alloca.h> and it should be used (not on Ultrix). */
-#undef HAVE_ALLOCA_H
-
-/* Define if you have a working `mmap' system call. */
-#undef HAVE_MMAP
-
-/* Define as __inline if that's what the C compiler calls it. */
-#undef inline
-
-/* Define to `long' if <sys/types.h> doesn't define. */
-#undef off_t
-
-/* Define if you need to in order for stat and other things to work. */
-#undef _POSIX_SOURCE
-
-/* Define as the return type of signal handlers (int or void). */
-#undef RETSIGTYPE
-
-/* Define to `unsigned' if <sys/types.h> doesn't define. */
-#undef size_t
-
-/* If using the C implementation of alloca, define if you know the
- direction of stack growth for your system; otherwise it will be
- automatically deduced at run-time.
- STACK_DIRECTION > 0 => grows toward higher addresses
- STACK_DIRECTION < 0 => grows toward lower addresses
- STACK_DIRECTION = 0 => direction of growth unknown
- */
-#undef STACK_DIRECTION
-
-/* Define if you have the ANSI C header files. */
-#undef STDC_HEADERS
-
-/* Define if your processor stores words with the most significant
- byte first (like Motorola and SPARC, unlike Intel and VAX). */
-#undef WORDS_BIGENDIAN
-
-/* Define to 1 if NLS is requested. */
-#undef ENABLE_NLS
-
-/* Define as 1 if you have gettext and don't want to use GNU gettext. */
-#undef HAVE_GETTEXT
-
-/* Define as 1 if you have the stpcpy function. */
-#undef HAVE_STPCPY
-
-/* Define if your locale.h file contains LC_MESSAGES. */
-#undef HAVE_LC_MESSAGES
-
-/* Define if you have the __argz_count function. */
-#undef HAVE___ARGZ_COUNT
-
-/* Define if you have the __argz_next function. */
-#undef HAVE___ARGZ_NEXT
-
-/* Define if you have the __argz_stringify function. */
-#undef HAVE___ARGZ_STRINGIFY
-
-/* Define if you have the __setfpucw function. */
-#undef HAVE___SETFPUCW
-
-/* Define if you have the dcgettext function. */
-#undef HAVE_DCGETTEXT
-
-/* Define if you have the getcwd function. */
-#undef HAVE_GETCWD
-
-/* Define if you have the getpagesize function. */
-#undef HAVE_GETPAGESIZE
-
-/* Define if you have the getpid function. */
-#undef HAVE_GETPID
-
-/* Define if you have the getrusage function. */
-#undef HAVE_GETRUSAGE
-
-/* Define if you have the kill function. */
-#undef HAVE_KILL
-
-/* Define if you have the munmap function. */
-#undef HAVE_MUNMAP
-
-/* Define if you have the putenv function. */
-#undef HAVE_PUTENV
-
-/* Define if you have the setenv function. */
-#undef HAVE_SETENV
-
-/* Define if you have the setlocale function. */
-#undef HAVE_SETLOCALE
-
-/* Define if you have the sigaction function. */
-#undef HAVE_SIGACTION
-
-/* Define if you have the stpcpy function. */
-#undef HAVE_STPCPY
-
-/* Define if you have the strcasecmp function. */
-#undef HAVE_STRCASECMP
-
-/* Define if you have the strchr function. */
-#undef HAVE_STRCHR
-
-/* Define if you have the time function. */
-#undef HAVE_TIME
-
-/* Define if you have the <argz.h> header file. */
-#undef HAVE_ARGZ_H
-
-/* Define if you have the <fcntl.h> header file. */
-#undef HAVE_FCNTL_H
-
-/* Define if you have the <fpu_control.h> header file. */
-#undef HAVE_FPU_CONTROL_H
-
-/* Define if you have the <limits.h> header file. */
-#undef HAVE_LIMITS_H
-
-/* Define if you have the <locale.h> header file. */
-#undef HAVE_LOCALE_H
-
-/* Define if you have the <malloc.h> header file. */
-#undef HAVE_MALLOC_H
-
-/* Define if you have the <nl_types.h> header file. */
-#undef HAVE_NL_TYPES_H
-
-/* Define if you have the <stdlib.h> header file. */
-#undef HAVE_STDLIB_H
-
-/* Define if you have the <string.h> header file. */
-#undef HAVE_STRING_H
-
-/* Define if you have the <strings.h> header file. */
-#undef HAVE_STRINGS_H
-
-/* Define if you have the <sys/param.h> header file. */
-#undef HAVE_SYS_PARAM_H
-
-/* Define if you have the <sys/resource.h> header file. */
-#undef HAVE_SYS_RESOURCE_H
-
-/* Define if you have the <sys/time.h> header file. */
-#undef HAVE_SYS_TIME_H
-
-/* Define if you have the <time.h> header file. */
-#undef HAVE_TIME_H
-
-/* Define if you have the <unistd.h> header file. */
-#undef HAVE_UNISTD_H
-
-/* Define if you have the <values.h> header file. */
-#undef HAVE_VALUES_H
diff --git a/sim/tic80/configure b/sim/tic80/configure
deleted file mode 100755
index b681188344a..00000000000
--- a/sim/tic80/configure
+++ /dev/null
@@ -1,4459 +0,0 @@
-#! /bin/sh
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-sim_inline="-DDEFAULT_INLINE=0"
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-# This file is derived from `gettext.m4'. The difference is that the
-# included macros assume Cygnus-style source and build trees.
-
-# Macro to add for using GNU gettext.
-# Ulrich Drepper <drepper@cygnus.com>, 1995.
-#
-# This file file be copied and used freely without restrictions. It can
-# be used in projects which are not available under the GNU Public License
-# but which still want to provide support for the GNU gettext functionality.
-# Please note that the actual code is *not* freely available.
-
-# serial 3
-
-
-
-
-
-# Search path for a program which passes the given test.
-# Ulrich Drepper <drepper@cygnus.com>, 1996.
-#
-# This file file be copied and used freely without restrictions. It can
-# be used in projects which are not available under the GNU Public License
-# but which still want to provide support for the GNU gettext functionality.
-# Please note that the actual code is *not* freely available.
-
-# serial 1
-
-
-
-# Check whether LC_MESSAGES is available in <locale.h>.
-# Ulrich Drepper <drepper@cygnus.com>, 1995.
-#
-# This file file be copied and used freely without restrictions. It can
-# be used in projects which are not available under the GNU Public License
-# but which still want to provide support for the GNU gettext functionality.
-# Please note that the actual code is *not* freely available.
-
-# serial 1
-
-
-
-
-
-
-# Guess values for system-dependent variables and create Makefiles.
-# Generated automatically using autoconf version 2.13
-# 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:
-ac_help="$ac_help
- --disable-nls do not use Native Language Support"
-ac_help="$ac_help
- --with-included-gettext use the GNU gettext library included here"
-ac_help="$ac_help
- --enable-maintainer-mode Enable developer functionality."
-ac_help="$ac_help
- --enable-sim-bswap Use Host specific BSWAP instruction."
-ac_help="$ac_help
- --enable-sim-cflags=opts Extra CFLAGS for use in building simulator"
-ac_help="$ac_help
- --enable-sim-debug=opts Enable debugging flags"
-ac_help="$ac_help
- --enable-sim-stdio Specify whether to use stdio for console input/output."
-ac_help="$ac_help
- --enable-sim-trace=opts Enable tracing flags"
-ac_help="$ac_help
- --enable-sim-profile=opts Enable profiling flags"
-ac_help="$ac_help
- --enable-sim-inline=inlines Specify which functions should be inlined."
-ac_help="$ac_help
- --enable-sim-endian=endian Specify target byte endian orientation."
-ac_help="$ac_help
- --enable-sim-alignment=align Specify strict, nonstrict or forced alignment of memory accesses."
-ac_help="$ac_help
- --enable-sim-hostendian=end Specify host byte endian orientation."
-ac_help="$ac_help
- --enable-build-warnings[=LIST] Enable build-time compiler warnings"
-ac_help="$ac_help
- --enable-sim-reserved-bits Specify whether to check reserved bits in instruction."
-ac_help="$ac_help
- --enable-sim-bitsize=N Specify target bitsize (32 or 64)."
-
-# 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=
-sitefile=
-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
- --site-file=FILE use FILE as the site file
- --version print the version of autoconf that created configure
-Directory and file names:
- --prefix=PREFIX install architecture-independent files in PREFIX
- [$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" ;;
-
- -site-file | --site-file | --site-fil | --site-fi | --site-f)
- ac_prev=sitefile ;;
- -site-file=* | --site-file=* | --site-fil=* | --site-fi=* | --site-f=*)
- sitefile="$ac_optarg" ;;
-
- -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
- ac_prev=srcdir ;;
- -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
- 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.13"
- 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=Makefile.in
-
-# 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 "$sitefile"; then
- if test -z "$CONFIG_SITE"; then
- if test "x$prefix" != xNONE; then
- CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
- else
- CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
- fi
- fi
-else
- CONFIG_SITE="$sitefile"
-fi
-for ac_site_file in $CONFIG_SITE; do
- if test -r "$ac_site_file"; then
- 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${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-ac_exeext=
-ac_objext=o
-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
-
-
-
-echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:693: checking how to run the C preprocessor" >&5
-# On Suns, sometimes $CPP names a directory.
-if test -n "$CPP" && test -d "$CPP"; then
- CPP=
-fi
-if test -z "$CPP"; then
-if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- # This must be in double quotes, not single quotes, because CPP may get
- # substituted into the Makefile and "${CC-cc}" will confuse make.
- CPP="${CC-cc} -E"
- # On the NeXT, cc -E runs the code through the compiler's parser,
- # not just through cpp.
- cat > conftest.$ac_ext <<EOF
-#line 708 "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:714: \"$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
- :
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- CPP="${CC-cc} -E -traditional-cpp"
- cat > conftest.$ac_ext <<EOF
-#line 725 "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:731: \"$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
- :
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- CPP="${CC-cc} -nologo -E"
- cat > conftest.$ac_ext <<EOF
-#line 742 "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:748: \"$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
- :
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- CPP=/lib/cpp
-fi
-rm -f conftest*
-fi
-rm -f conftest*
-fi
-rm -f conftest*
- ac_cv_prog_CPP="$CPP"
-fi
- CPP="$ac_cv_prog_CPP"
-else
- ac_cv_prog_CPP="$CPP"
-fi
-echo "$ac_t""$CPP" 1>&6
-
-echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:773: 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
-else
- cat > conftestmake <<\EOF
-all:
- @echo 'ac_maketemp="${MAKE}"'
-EOF
-# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
-eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=`
-if test -n "$ac_maketemp"; then
- eval ac_cv_prog_make_${ac_make}_set=yes
-else
- eval ac_cv_prog_make_${ac_make}_set=no
-fi
-rm -f conftestmake
-fi
-if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- SET_MAKE=
-else
- echo "$ac_t""no" 1>&6
- SET_MAKE="MAKE=${MAKE-make}"
-fi
-
-echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6
-echo "configure:800: checking for POSIXized ISC" >&5
-if test -d /etc/conf/kconfig.d &&
- grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1
-then
- echo "$ac_t""yes" 1>&6
- ISC=yes # If later tests want to check for ISC.
- cat >> confdefs.h <<\EOF
-#define _POSIX_SOURCE 1
-EOF
-
- if test "$GCC" = yes; then
- CC="$CC -posix"
- else
- CC="$CC -Xp"
- fi
-else
- echo "$ac_t""no" 1>&6
- ISC=
-fi
-
-echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:821: 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 826 "configure"
-#include "confdefs.h"
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <float.h>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:834: \"$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*
- ac_cv_header_stdc=yes
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_cv_header_stdc=no
-fi
-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 851 "configure"
-#include "confdefs.h"
-#include <string.h>
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "memchr" >/dev/null 2>&1; then
- :
-else
- rm -rf conftest*
- ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-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 869 "configure"
-#include "confdefs.h"
-#include <stdlib.h>
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "free" >/dev/null 2>&1; then
- :
-else
- rm -rf conftest*
- ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-fi
-
-if test $ac_cv_header_stdc = yes; then
- # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
-if test "$cross_compiling" = yes; then
- :
-else
- cat > conftest.$ac_ext <<EOF
-#line 890 "configure"
-#include "confdefs.h"
-#include <ctype.h>
-#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
-#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
-#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
-int main () { int i; for (i = 0; i < 256; i++)
-if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
-exit (0); }
-
-EOF
-if { (eval echo configure:901: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
-then
- :
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -fr conftest*
- ac_cv_header_stdc=no
-fi
-rm -fr conftest*
-fi
-
-fi
-fi
-
-echo "$ac_t""$ac_cv_header_stdc" 1>&6
-if test $ac_cv_header_stdc = yes; then
- cat >> confdefs.h <<\EOF
-#define STDC_HEADERS 1
-EOF
-
-fi
-
-echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:925: 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 930 "configure"
-#include "confdefs.h"
-
-int main() {
-
-/* Ultrix mips cc rejects this. */
-typedef int charset[2]; const charset x;
-/* SunOS 4.1.1 cc rejects this. */
-char const *const *ccp;
-char **p;
-/* NEC SVR4.0.2 mips cc rejects this. */
-struct point {int x, y;};
-static struct point const zero = {0,0};
-/* AIX XL C 1.02.0.0 rejects this.
- It does not let you subtract one const X* pointer from another in an arm
- of an if-expression whose if-part is not a constant expression */
-const char *g = "string";
-ccp = &g + (g ? g-g : 0);
-/* HPUX 7.0 cc rejects these. */
-++ccp;
-p = (char**) ccp;
-ccp = (char const *const *) p;
-{ /* SCO 3.2v4 cc rejects this. */
- char *t;
- char const *s = 0 ? (char *) 0 : (char const *) 0;
-
- *t++ = 0;
-}
-{ /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */
- int x[] = {25, 17};
- const int *foo = &x[0];
- ++foo;
-}
-{ /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
- typedef const int *iptr;
- iptr p = 0;
- ++p;
-}
-{ /* AIX XL C 1.02.0.0 rejects this saying
- "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
- struct s { int j; const int *ap[3]; };
- struct s *b; b->j = 5;
-}
-{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
- const int foo = 10;
-}
-
-; return 0; }
-EOF
-if { (eval echo configure:979: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- ac_cv_c_const=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_cv_c_const=no
-fi
-rm -f conftest*
-fi
-
-echo "$ac_t""$ac_cv_c_const" 1>&6
-if test $ac_cv_c_const = no; then
- cat >> confdefs.h <<\EOF
-#define const
-EOF
-
-fi
-
-echo $ac_n "checking for inline""... $ac_c" 1>&6
-echo "configure:1000: 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 1007 "configure"
-#include "confdefs.h"
-
-int main() {
-} $ac_kw foo() {
-; return 0; }
-EOF
-if { (eval echo configure:1014: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- ac_cv_c_inline=$ac_kw; break
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
-fi
-rm -f conftest*
-done
-
-fi
-
-echo "$ac_t""$ac_cv_c_inline" 1>&6
-case "$ac_cv_c_inline" in
- inline | yes) ;;
- no) cat >> confdefs.h <<\EOF
-#define inline
-EOF
- ;;
- *) cat >> confdefs.h <<EOF
-#define inline $ac_cv_c_inline
-EOF
- ;;
-esac
-
-echo $ac_n "checking for off_t""... $ac_c" 1>&6
-echo "configure:1040: 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 1045 "configure"
-#include "confdefs.h"
-#include <sys/types.h>
-#if STDC_HEADERS
-#include <stdlib.h>
-#include <stddef.h>
-#endif
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "(^|[^a-zA-Z_0-9])off_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
- rm -rf conftest*
- ac_cv_type_off_t=yes
-else
- rm -rf conftest*
- ac_cv_type_off_t=no
-fi
-rm -f conftest*
-
-fi
-echo "$ac_t""$ac_cv_type_off_t" 1>&6
-if test $ac_cv_type_off_t = no; then
- cat >> confdefs.h <<\EOF
-#define off_t long
-EOF
-
-fi
-
-echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:1073: 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 1078 "configure"
-#include "confdefs.h"
-#include <sys/types.h>
-#if STDC_HEADERS
-#include <stdlib.h>
-#include <stddef.h>
-#endif
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "(^|[^a-zA-Z_0-9])size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
- rm -rf conftest*
- ac_cv_type_size_t=yes
-else
- rm -rf conftest*
- ac_cv_type_size_t=no
-fi
-rm -f conftest*
-
-fi
-echo "$ac_t""$ac_cv_type_size_t" 1>&6
-if test $ac_cv_type_size_t = no; then
- cat >> confdefs.h <<\EOF
-#define size_t unsigned
-EOF
-
-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:1108: 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 1113 "configure"
-#include "confdefs.h"
-#include <alloca.h>
-int main() {
-char *p = alloca(2 * sizeof(int));
-; return 0; }
-EOF
-if { (eval echo configure:1120: \"$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
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_cv_header_alloca_h=no
-fi
-rm -f conftest*
-fi
-
-echo "$ac_t""$ac_cv_header_alloca_h" 1>&6
-if test $ac_cv_header_alloca_h = yes; then
- cat >> confdefs.h <<\EOF
-#define HAVE_ALLOCA_H 1
-EOF
-
-fi
-
-echo $ac_n "checking for alloca""... $ac_c" 1>&6
-echo "configure:1141: 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 1146 "configure"
-#include "confdefs.h"
-
-#ifdef __GNUC__
-# define alloca __builtin_alloca
-#else
-# ifdef _MSC_VER
-# include <malloc.h>
-# define alloca _alloca
-# else
-# if HAVE_ALLOCA_H
-# include <alloca.h>
-# else
-# ifdef _AIX
- #pragma alloca
-# else
-# ifndef alloca /* predefined by HP cc +Olibcalls */
-char *alloca ();
-# endif
-# endif
-# endif
-# endif
-#endif
-
-int main() {
-char *p = (char *) alloca(1);
-; return 0; }
-EOF
-if { (eval echo configure:1174: \"$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
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_cv_func_alloca_works=no
-fi
-rm -f conftest*
-fi
-
-echo "$ac_t""$ac_cv_func_alloca_works" 1>&6
-if test $ac_cv_func_alloca_works = yes; then
- cat >> confdefs.h <<\EOF
-#define HAVE_ALLOCA 1
-EOF
-
-fi
-
-if test $ac_cv_func_alloca_works = no; then
- # The SVR3 libPW and SVR4 libucb both contain incompatible functions
- # that cause trouble. Some versions do not even contain alloca or
- # contain a buggy version. If you still want to use their alloca,
- # use ar to extract alloca.o from them instead of compiling alloca.c.
- ALLOCA=alloca.${ac_objext}
- cat >> confdefs.h <<\EOF
-#define C_ALLOCA 1
-EOF
-
-
-echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
-echo "configure:1206: 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 1211 "configure"
-#include "confdefs.h"
-#if defined(CRAY) && ! defined(CRAY2)
-webecray
-#else
-wenotbecray
-#endif
-
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "webecray" >/dev/null 2>&1; then
- rm -rf conftest*
- ac_cv_os_cray=yes
-else
- rm -rf conftest*
- ac_cv_os_cray=no
-fi
-rm -f conftest*
-
-fi
-
-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:1236: 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 1241 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func();
-
-int main() {
-
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-$ac_func();
-#endif
-
-; return 0; }
-EOF
-if { (eval echo configure:1264: \"$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
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- cat >> confdefs.h <<EOF
-#define CRAY_STACKSEG_END $ac_func
-EOF
-
- break
-else
- echo "$ac_t""no" 1>&6
-fi
-
-done
-fi
-
-echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
-echo "configure:1291: 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
- if test "$cross_compiling" = yes; then
- ac_cv_c_stack_direction=0
-else
- cat > conftest.$ac_ext <<EOF
-#line 1299 "configure"
-#include "confdefs.h"
-find_stack_direction ()
-{
- static char *addr = 0;
- auto char dummy;
- if (addr == 0)
- {
- addr = &dummy;
- return find_stack_direction ();
- }
- else
- return (&dummy > addr) ? 1 : -1;
-}
-main ()
-{
- exit (find_stack_direction() < 0);
-}
-EOF
-if { (eval echo configure:1318: \"$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
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -fr conftest*
- ac_cv_c_stack_direction=-1
-fi
-rm -fr conftest*
-fi
-
-fi
-
-echo "$ac_t""$ac_cv_c_stack_direction" 1>&6
-cat >> confdefs.h <<EOF
-#define STACK_DIRECTION $ac_cv_c_stack_direction
-EOF
-
-fi
-
-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:1343: 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 1348 "configure"
-#include "confdefs.h"
-#include <$ac_hdr>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1353: \"$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_func in getpagesize
-do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1382: 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 1387 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func();
-
-int main() {
-
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-$ac_func();
-#endif
-
-; return 0; }
-EOF
-if { (eval echo configure:1410: \"$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
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
-fi
-done
-
-echo $ac_n "checking for working mmap""... $ac_c" 1>&6
-echo "configure:1435: 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
- if test "$cross_compiling" = yes; then
- ac_cv_func_mmap_fixed_mapped=no
-else
- cat > conftest.$ac_ext <<EOF
-#line 1443 "configure"
-#include "confdefs.h"
-
-/* Thanks to Mike Haertel and Jim Avera for this test.
- Here is a matrix of mmap possibilities:
- mmap private not fixed
- mmap private fixed at somewhere currently unmapped
- mmap private fixed at somewhere already mapped
- mmap shared not fixed
- mmap shared fixed at somewhere currently unmapped
- mmap shared fixed at somewhere already mapped
- For private mappings, we should verify that changes cannot be read()
- back from the file, nor mmap's back from the file at a different
- address. (There have been systems where private was not correctly
- implemented like the infamous i386 svr4.0, and systems where the
- VM page cache was not coherent with the filesystem buffer cache
- like early versions of FreeBSD and possibly contemporary NetBSD.)
- For shared mappings, we should conversely verify that changes get
- propogated back to all the places they're supposed to be.
-
- Grep wants private fixed already mapped.
- The main things grep needs to know about mmap are:
- * does it exist and is it safe to write into the mmap'd area
- * how to use it (BSD variants) */
-#include <sys/types.h>
-#include <fcntl.h>
-#include <sys/mman.h>
-
-/* This mess was copied from the GNU getpagesize.h. */
-#ifndef HAVE_GETPAGESIZE
-# ifdef HAVE_UNISTD_H
-# include <unistd.h>
-# endif
-
-/* Assume that all systems that can run configure have sys/param.h. */
-# ifndef HAVE_SYS_PARAM_H
-# define HAVE_SYS_PARAM_H 1
-# endif
-
-# ifdef _SC_PAGESIZE
-# define getpagesize() sysconf(_SC_PAGESIZE)
-# else /* no _SC_PAGESIZE */
-# ifdef HAVE_SYS_PARAM_H
-# include <sys/param.h>
-# ifdef EXEC_PAGESIZE
-# define getpagesize() EXEC_PAGESIZE
-# else /* no EXEC_PAGESIZE */
-# ifdef NBPG
-# define getpagesize() NBPG * CLSIZE
-# ifndef CLSIZE
-# define CLSIZE 1
-# endif /* no CLSIZE */
-# else /* no NBPG */
-# ifdef NBPC
-# define getpagesize() NBPC
-# else /* no NBPC */
-# ifdef PAGESIZE
-# define getpagesize() PAGESIZE
-# endif /* PAGESIZE */
-# endif /* no NBPC */
-# endif /* no NBPG */
-# endif /* no EXEC_PAGESIZE */
-# else /* no HAVE_SYS_PARAM_H */
-# define getpagesize() 8192 /* punt totally */
-# endif /* no HAVE_SYS_PARAM_H */
-# endif /* no _SC_PAGESIZE */
-
-#endif /* no HAVE_GETPAGESIZE */
-
-#ifdef __cplusplus
-extern "C" { void *malloc(unsigned); }
-#else
-char *malloc();
-#endif
-
-int
-main()
-{
- char *data, *data2, *data3;
- int i, pagesize;
- int fd;
-
- pagesize = getpagesize();
-
- /*
- * First, make a file with some known garbage in it.
- */
- data = malloc(pagesize);
- if (!data)
- exit(1);
- for (i = 0; i < pagesize; ++i)
- *(data + i) = rand();
- umask(0);
- fd = creat("conftestmmap", 0600);
- if (fd < 0)
- exit(1);
- if (write(fd, data, pagesize) != pagesize)
- exit(1);
- close(fd);
-
- /*
- * Next, try to mmap the file at a fixed address which
- * already has something else allocated at it. If we can,
- * also make sure that we see the same garbage.
- */
- fd = open("conftestmmap", O_RDWR);
- if (fd < 0)
- exit(1);
- data2 = malloc(2 * pagesize);
- if (!data2)
- exit(1);
- data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1);
- if (data2 != mmap(data2, pagesize, PROT_READ | PROT_WRITE,
- MAP_PRIVATE | MAP_FIXED, fd, 0L))
- exit(1);
- for (i = 0; i < pagesize; ++i)
- if (*(data + i) != *(data2 + i))
- exit(1);
-
- /*
- * Finally, make sure that changes to the mapped area
- * do not percolate back to the file as seen by read().
- * (This is a bug on some variants of i386 svr4.0.)
- */
- for (i = 0; i < pagesize; ++i)
- *(data2 + i) = *(data2 + i) + 1;
- data3 = malloc(pagesize);
- if (!data3)
- exit(1);
- if (read(fd, data3, pagesize) != pagesize)
- exit(1);
- for (i = 0; i < pagesize; ++i)
- if (*(data + i) != *(data3 + i))
- exit(1);
- close(fd);
- unlink("conftestmmap");
- exit(0);
-}
-
-EOF
-if { (eval echo configure:1583: \"$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
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -fr conftest*
- ac_cv_func_mmap_fixed_mapped=no
-fi
-rm -fr conftest*
-fi
-
-fi
-
-echo "$ac_t""$ac_cv_func_mmap_fixed_mapped" 1>&6
-if test $ac_cv_func_mmap_fixed_mapped = yes; then
- cat >> confdefs.h <<\EOF
-#define HAVE_MMAP 1
-EOF
-
-fi
-
-echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6
-echo "configure:1606: 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 1611 "configure"
-#include "confdefs.h"
-
-int main() {
-
-#ifndef __CYGWIN__
-#define __CYGWIN__ __CYGWIN32__
-#endif
-return __CYGWIN__;
-; return 0; }
-EOF
-if { (eval echo configure:1622: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- ac_cv_cygwin=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_cv_cygwin=no
-fi
-rm -f conftest*
-rm -f conftest*
-fi
-
-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:1639: 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 1644 "configure"
-#include "confdefs.h"
-
-int main() {
-return __MINGW32__;
-; return 0; }
-EOF
-if { (eval echo configure:1651: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- ac_cv_mingw32=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_cv_mingw32=no
-fi
-rm -f conftest*
-rm -f conftest*
-fi
-
-echo "$ac_t""$ac_cv_mingw32" 1>&6
-MINGW32=
-test "$ac_cv_mingw32" = yes && MINGW32=yes
-
-# autoconf.info says this should be called right after AC_INIT.
-
-
-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:1718: 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:1739: 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:1757: 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}-
-
-if test "$program_transform_name" = s,x,x,; then
- program_transform_name=
-else
- # Double any \ or $. echo might interpret backslashes.
- cat <<\EOF_SED > conftestsed
-s,\\,\\\\,g; s,\$,$$,g
-EOF_SED
- program_transform_name="`echo $program_transform_name|sed -f conftestsed`"
- rm -f conftestsed
-fi
-test "$program_prefix" != NONE &&
- program_transform_name="s,^,${program_prefix},; $program_transform_name"
-# Use a double $ so make ignores it.
-test "$program_suffix" != NONE &&
- program_transform_name="s,\$\$,${program_suffix},; $program_transform_name"
-
-# sed with no file args requires a program.
-test "$program_transform_name" = "" && program_transform_name="s,x,x,"
-
-# 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:1801: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_CC="gcc"
- break
- fi
- done
- IFS="$ac_save_ifs"
-fi
-fi
-CC="$ac_cv_prog_CC"
-if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-if test -z "$CC"; then
- # Extract the first word of "cc", so it can be a program name with args.
-set dummy cc; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1831: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_prog_rejected=no
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
- ac_prog_rejected=yes
- continue
- fi
- ac_cv_prog_CC="cc"
- break
- fi
- done
- IFS="$ac_save_ifs"
-if test $ac_prog_rejected = yes; then
- # We found a bogon in the path, so make sure we never use it.
- set dummy $ac_cv_prog_CC
- shift
- if test $# -gt 0; then
- # We chose a different compiler from the bogus one.
- # However, it has the same basename, so the bogon will be chosen
- # first if we set CC to just the basename; use the full file name.
- shift
- set dummy "$ac_dir/$ac_word" "$@"
- shift
- ac_cv_prog_CC="$@"
- fi
-fi
-fi
-fi
-CC="$ac_cv_prog_CC"
-if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
- if test -z "$CC"; then
- case "`uname -s`" in
- *win32* | *WIN32*)
- # Extract the first word of "cl", so it can be a program name with args.
-set dummy cl; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1882: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_CC="cl"
- break
- fi
- done
- IFS="$ac_save_ifs"
-fi
-fi
-CC="$ac_cv_prog_CC"
-if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
- ;;
- esac
- fi
- test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
-fi
-
-echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:1914: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
-
-ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-cat > conftest.$ac_ext << EOF
-
-#line 1925 "configure"
-#include "confdefs.h"
-
-main(){return(0);}
-EOF
-if { (eval echo configure:1930: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- ac_cv_prog_cc_works=yes
- # If we can't run a trivial program, we are probably using a cross compiler.
- if (./conftest; exit) 2>/dev/null; then
- ac_cv_prog_cc_cross=no
- else
- ac_cv_prog_cc_cross=yes
- fi
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- ac_cv_prog_cc_works=no
-fi
-rm -fr conftest*
-ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
-if test $ac_cv_prog_cc_works = no; then
- { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
-fi
-echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:1956: 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:1961: checking whether we are using GNU C" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.c <<EOF
-#ifdef __GNUC__
- yes;
-#endif
-EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1970: \"$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
-fi
-fi
-
-echo "$ac_t""$ac_cv_prog_gcc" 1>&6
-
-if test $ac_cv_prog_gcc = yes; then
- GCC=yes
-else
- GCC=
-fi
-
-ac_test_CFLAGS="${CFLAGS+set}"
-ac_save_CFLAGS="$CFLAGS"
-CFLAGS=
-echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:1989: checking whether ${CC-cc} accepts -g" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- echo 'void f(){}' > conftest.c
-if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
- ac_cv_prog_cc_g=yes
-else
- ac_cv_prog_cc_g=no
-fi
-rm -f conftest*
-
-fi
-
-echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
-if test "$ac_test_CFLAGS" = set; then
- CFLAGS="$ac_save_CFLAGS"
-elif test $ac_cv_prog_cc_g = yes; then
- if test "$GCC" = yes; then
- CFLAGS="-g -O2"
- else
- CFLAGS="-g"
- fi
-else
- if test "$GCC" = yes; then
- CFLAGS="-O2"
- else
- CFLAGS=
- fi
-fi
-
-# Find a good install program. We prefer a C program (faster),
-# so one script is as good as another. But avoid the broken or
-# incompatible versions:
-# SysV /etc/install, /usr/sbin/install
-# SunOS /usr/etc/install
-# IRIX /sbin/install
-# AIX /bin/install
-# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
-# AFS /usr/afsws/bin/install, which mishandles nonexistent args
-# 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:2032: 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
-else
- IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":"
- for ac_dir in $PATH; do
- # Account for people who put trailing slashes in PATH elements.
- case "$ac_dir/" in
- /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
- *)
- # OSF1 and SCO ODT 3.0 have their own names for install.
- # Don't use installbsd from OSF since it installs stuff as root
- # by default.
- for ac_prog in ginstall scoinst install; do
- if test -f $ac_dir/$ac_prog; then
- if test $ac_prog = install &&
- grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
- # AIX install. It has an incompatible calling convention.
- :
- else
- ac_cv_path_install="$ac_dir/$ac_prog -c"
- break 2
- fi
- fi
- done
- ;;
- esac
- done
- IFS="$ac_save_IFS"
-
-fi
- if test "${ac_cv_path_install+set}" = set; then
- INSTALL="$ac_cv_path_install"
- else
- # As a last resort, use the slow shell script. We don't cache a
- # path for INSTALL within a source directory, because that will
- # break other packages using the cache if that directory is
- # removed, or if the path is relative.
- INSTALL="$ac_install_sh"
- fi
-fi
-echo "$ac_t""$INSTALL" 1>&6
-
-# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
-# It thinks the first close brace ends the variable substitution.
-test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
-
-test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
-
-test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
-
-
-# Put a plausible default for CC_FOR_BUILD in Makefile.
-if test "x$cross_compiling" = "xno"; then
- CC_FOR_BUILD='$(CC)'
-else
- CC_FOR_BUILD=gcc
-fi
-
-
-
-
-AR=${AR-ar}
-
-# 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:2100: 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
- if test -n "$RANLIB"; then
- ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_RANLIB="ranlib"
- break
- fi
- done
- IFS="$ac_save_ifs"
- test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":"
-fi
-fi
-RANLIB="$ac_cv_prog_RANLIB"
-if test -n "$RANLIB"; then
- echo "$ac_t""$RANLIB" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-
-ALL_LINGUAS=
-
- for ac_hdr in argz.h limits.h locale.h nl_types.h malloc.h string.h \
-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:2135: 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 2140 "configure"
-#include "confdefs.h"
-#include <$ac_hdr>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2145: \"$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_func in getcwd munmap putenv setenv setlocale strchr strcasecmp \
-__argz_count __argz_stringify __argz_next
-do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2175: 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 2180 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func();
-
-int main() {
-
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-$ac_func();
-#endif
-
-; return 0; }
-EOF
-if { (eval echo configure:2203: \"$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
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
-fi
-done
-
-
- if test "${ac_cv_func_stpcpy+set}" != "set"; then
- for ac_func in stpcpy
-do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2232: 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 2237 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func();
-
-int main() {
-
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-$ac_func();
-#endif
-
-; return 0; }
-EOF
-if { (eval echo configure:2260: \"$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
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
-fi
-done
-
- fi
- if test "${ac_cv_func_stpcpy}" = "yes"; then
- cat >> confdefs.h <<\EOF
-#define HAVE_STPCPY 1
-EOF
-
- fi
-
- if test $ac_cv_header_locale_h = yes; then
- echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6
-echo "configure:2294: 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 2299 "configure"
-#include "confdefs.h"
-#include <locale.h>
-int main() {
-return LC_MESSAGES
-; return 0; }
-EOF
-if { (eval echo configure:2306: \"$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
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- am_cv_val_LC_MESSAGES=no
-fi
-rm -f conftest*
-fi
-
-echo "$ac_t""$am_cv_val_LC_MESSAGES" 1>&6
- if test $am_cv_val_LC_MESSAGES = yes; then
- cat >> confdefs.h <<\EOF
-#define HAVE_LC_MESSAGES 1
-EOF
-
- fi
- fi
- echo $ac_n "checking whether NLS is requested""... $ac_c" 1>&6
-echo "configure:2327: 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"
- USE_NLS=$enableval
-else
- USE_NLS=yes
-fi
-
- echo "$ac_t""$USE_NLS" 1>&6
-
-
- USE_INCLUDED_LIBINTL=no
-
- if test "$USE_NLS" = "yes"; then
- cat >> confdefs.h <<\EOF
-#define ENABLE_NLS 1
-EOF
-
- echo $ac_n "checking whether included gettext is requested""... $ac_c" 1>&6
-echo "configure:2347: 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"
- nls_cv_force_use_gnu_gettext=$withval
-else
- nls_cv_force_use_gnu_gettext=no
-fi
-
- echo "$ac_t""$nls_cv_force_use_gnu_gettext" 1>&6
-
- nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
- if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
- nls_cv_header_intl=
- nls_cv_header_libgt=
- CATOBJEXT=NONE
-
- ac_safe=`echo "libintl.h" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for libintl.h""... $ac_c" 1>&6
-echo "configure:2366: 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 2371 "configure"
-#include "confdefs.h"
-#include <libintl.h>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2376: \"$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
- echo $ac_n "checking for gettext in libc""... $ac_c" 1>&6
-echo "configure:2393: 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 2398 "configure"
-#include "confdefs.h"
-#include <libintl.h>
-int main() {
-return (int) gettext ("")
-; return 0; }
-EOF
-if { (eval echo configure:2405: \"$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
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- gt_cv_func_gettext_libc=no
-fi
-rm -f conftest*
-fi
-
-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:2421: 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
-else
- ac_save_LIBS="$LIBS"
-LIBS="-lintl $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 2429 "configure"
-#include "confdefs.h"
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char bindtextdomain();
-
-int main() {
-bindtextdomain()
-; return 0; }
-EOF
-if { (eval echo configure:2440: \"$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
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- echo $ac_n "checking for gettext in libintl""... $ac_c" 1>&6
-echo "configure:2456: 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 2461 "configure"
-#include "confdefs.h"
-
-int main() {
-return (int) gettext ("")
-; return 0; }
-EOF
-if { (eval echo configure:2468: \"$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
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- gt_cv_func_gettext_libintl=no
-fi
-rm -f conftest*
-fi
-
-echo "$ac_t""$gt_cv_func_gettext_libintl" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
- fi
-
- if test "$gt_cv_func_gettext_libc" = "yes" \
- || test "$gt_cv_func_gettext_libintl" = "yes"; then
- cat >> confdefs.h <<\EOF
-#define HAVE_GETTEXT 1
-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:2496: 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
- case "$MSGFMT" in
- /*)
- ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path.
- ;;
- *)
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
- for ac_dir in $PATH; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- if test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"; then
- ac_cv_path_MSGFMT="$ac_dir/$ac_word"
- break
- fi
- fi
- done
- IFS="$ac_save_ifs"
- test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT="no"
- ;;
-esac
-fi
-MSGFMT="$ac_cv_path_MSGFMT"
-if test -n "$MSGFMT"; then
- echo "$ac_t""$MSGFMT" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
- if test "$MSGFMT" != "no"; then
- for ac_func in dcgettext
-do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2530: 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 2535 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func();
-
-int main() {
-
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-$ac_func();
-#endif
-
-; return 0; }
-EOF
-if { (eval echo configure:2558: \"$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
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
-fi
-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:2585: 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
- case "$GMSGFMT" in
- /*)
- ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path.
- ;;
- ?:/*)
- ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a dos path.
- ;;
- *)
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_path_GMSGFMT="$ac_dir/$ac_word"
- break
- fi
- done
- IFS="$ac_save_ifs"
- test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT"
- ;;
-esac
-fi
-GMSGFMT="$ac_cv_path_GMSGFMT"
-if test -n "$GMSGFMT"; then
- echo "$ac_t""$GMSGFMT" 1>&6
-else
- echo "$ac_t""no" 1>&6
-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:2621: 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
- case "$XGETTEXT" in
- /*)
- ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path.
- ;;
- *)
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
- for ac_dir in $PATH; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- if test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"; then
- ac_cv_path_XGETTEXT="$ac_dir/$ac_word"
- break
- fi
- fi
- done
- IFS="$ac_save_ifs"
- test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":"
- ;;
-esac
-fi
-XGETTEXT="$ac_cv_path_XGETTEXT"
-if test -n "$XGETTEXT"; then
- echo "$ac_t""$XGETTEXT" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
- cat > conftest.$ac_ext <<EOF
-#line 2653 "configure"
-#include "confdefs.h"
-
-int main() {
-extern int _nl_msg_cat_cntr;
- return _nl_msg_cat_cntr
-; return 0; }
-EOF
-if { (eval echo configure:2661: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- CATOBJEXT=.gmo
- DATADIRNAME=share
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- CATOBJEXT=.mo
- DATADIRNAME=lib
-fi
-rm -f conftest*
- INSTOBJEXT=.mo
- fi
- fi
-
-else
- echo "$ac_t""no" 1>&6
-fi
-
-
-
- if test "$CATOBJEXT" = "NONE"; then
- nls_cv_use_gnu_gettext=yes
- fi
- fi
-
- if test "$nls_cv_use_gnu_gettext" = "yes"; then
- INTLOBJS="\$(GETTOBJS)"
- # 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:2693: 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
- case "$MSGFMT" in
- /*)
- ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path.
- ;;
- *)
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
- for ac_dir in $PATH; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- if test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"; then
- ac_cv_path_MSGFMT="$ac_dir/$ac_word"
- break
- fi
- fi
- done
- IFS="$ac_save_ifs"
- test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT="msgfmt"
- ;;
-esac
-fi
-MSGFMT="$ac_cv_path_MSGFMT"
-if test -n "$MSGFMT"; then
- echo "$ac_t""$MSGFMT" 1>&6
-else
- echo "$ac_t""no" 1>&6
-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:2727: 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
- case "$GMSGFMT" in
- /*)
- ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path.
- ;;
- ?:/*)
- ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a dos path.
- ;;
- *)
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_path_GMSGFMT="$ac_dir/$ac_word"
- break
- fi
- done
- IFS="$ac_save_ifs"
- test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT"
- ;;
-esac
-fi
-GMSGFMT="$ac_cv_path_GMSGFMT"
-if test -n "$GMSGFMT"; then
- echo "$ac_t""$GMSGFMT" 1>&6
-else
- echo "$ac_t""no" 1>&6
-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:2763: 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
- case "$XGETTEXT" in
- /*)
- ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path.
- ;;
- *)
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
- for ac_dir in $PATH; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- if test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"; then
- ac_cv_path_XGETTEXT="$ac_dir/$ac_word"
- break
- fi
- fi
- done
- IFS="$ac_save_ifs"
- test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":"
- ;;
-esac
-fi
-XGETTEXT="$ac_cv_path_XGETTEXT"
-if test -n "$XGETTEXT"; then
- echo "$ac_t""$XGETTEXT" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-
- USE_INCLUDED_LIBINTL=yes
- CATOBJEXT=.gmo
- INSTOBJEXT=.mo
- DATADIRNAME=share
- INTLDEPS='$(top_builddir)/../intl/libintl.a'
- INTLLIBS=$INTLDEPS
- LIBS=`echo $LIBS | sed -e 's/-lintl//'`
- nls_cv_header_intl=libintl.h
- nls_cv_header_libgt=libgettext.h
- fi
-
- if test "$XGETTEXT" != ":"; then
- if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
- : ;
- else
- echo "$ac_t""found xgettext programs is not GNU xgettext; ignore it" 1>&6
- XGETTEXT=":"
- fi
- fi
-
- # We need to process the po/ directory.
- POSUB=po
- else
- DATADIRNAME=share
- nls_cv_header_intl=libintl.h
- nls_cv_header_libgt=libgettext.h
- fi
-
- # If this is used in GNU gettext we have to set USE_NLS to `yes'
- # because some of the sources are only built for this goal.
- if test "$PACKAGE" = gettext; then
- USE_NLS=yes
- USE_INCLUDED_LIBINTL=yes
- fi
-
- for lang in $ALL_LINGUAS; do
- GMOFILES="$GMOFILES $lang.gmo"
- POFILES="$POFILES $lang.po"
- done
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- if test "x$CATOBJEXT" != "x"; then
- if test "x$ALL_LINGUAS" = "x"; then
- LINGUAS=
- else
- echo $ac_n "checking for catalogs to be installed""... $ac_c" 1>&6
-echo "configure:2853: checking for catalogs to be installed" >&5
- NEW_LINGUAS=
- for lang in ${LINGUAS=$ALL_LINGUAS}; do
- case "$ALL_LINGUAS" in
- *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
- esac
- done
- LINGUAS=$NEW_LINGUAS
- echo "$ac_t""$LINGUAS" 1>&6
- fi
-
- if test -n "$LINGUAS"; then
- for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
- fi
- fi
-
- if test $ac_cv_header_locale_h = yes; then
- INCLUDE_LOCALE_H="#include <locale.h>"
- else
- INCLUDE_LOCALE_H="\
-/* The system does not provide the header <locale.h>. Take care yourself. */"
- fi
-
-
- if test -f $srcdir/po2tbl.sed.in; then
- 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:2881: 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 2886 "configure"
-#include "confdefs.h"
-#include <linux/version.h>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2891: \"$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
- msgformat=linux
-else
- echo "$ac_t""no" 1>&6
-msgformat=xopen
-fi
-
-
- sed -e '/^#/d' $srcdir/$msgformat-msg.sed > po2msg.sed
- fi
- sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
- $srcdir/po2tbl.sed.in > po2tbl.sed
- fi
-
- if test "$PACKAGE" = "gettext"; then
- GT_NO="#NO#"
- GT_YES=
- else
- GT_NO=
- GT_YES="#YES#"
- fi
-
-
-
- MKINSTALLDIRS="\$(srcdir)/../../mkinstalldirs"
-
-
- l=
-
-
- if test -d $srcdir/po; then
- test -d po || mkdir po
- if test "x$srcdir" != "x."; then
- if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
- posrcprefix="$srcdir/"
- else
- posrcprefix="../$srcdir/"
- fi
- else
- posrcprefix="../"
- fi
- rm -f po/POTFILES
- sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
- < $srcdir/po/POTFILES.in > po/POTFILES
- fi
-
-
-# Check for common headers.
-# FIXME: Seems to me this can cause problems for i386-windows hosts.
-# At one point there were hardcoded AC_DEFINE's if ${host} = i386-*-windows*.
-for ac_hdr in stdlib.h string.h strings.h unistd.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:2960: 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 2965 "configure"
-#include "confdefs.h"
-#include <$ac_hdr>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2970: \"$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 sys/time.h sys/resource.h
-do
-ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3000: 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 3005 "configure"
-#include "confdefs.h"
-#include <$ac_hdr>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3010: \"$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 fcntl.h fpu_control.h
-do
-ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3040: 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 3045 "configure"
-#include "confdefs.h"
-#include <$ac_hdr>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3050: \"$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 dlfcn.h errno.h sys/stat.h
-do
-ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3080: 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 3085 "configure"
-#include "confdefs.h"
-#include <$ac_hdr>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3090: \"$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_func in getrusage time sigaction __setfpucw
-do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3119: 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 3124 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func();
-
-int main() {
-
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-$ac_func();
-#endif
-
-; return 0; }
-EOF
-if { (eval echo configure:3147: \"$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
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
-fi
-done
-
-
-# Check for socket libraries
-echo $ac_n "checking for bind in -lsocket""... $ac_c" 1>&6
-echo "configure:3174: checking for bind in -lsocket" >&5
-ac_lib_var=`echo socket'_'bind | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- ac_save_LIBS="$LIBS"
-LIBS="-lsocket $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 3182 "configure"
-#include "confdefs.h"
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char bind();
-
-int main() {
-bind()
-; return 0; }
-EOF
-if { (eval echo configure:3193: \"$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
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_lib=HAVE_LIB`echo socket | sed -e 's/[^a-zA-Z0-9_]/_/g' \
- -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_lib 1
-EOF
-
- LIBS="-lsocket $LIBS"
-
-else
- echo "$ac_t""no" 1>&6
-fi
-
-echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6
-echo "configure:3221: checking for gethostbyname in -lnsl" >&5
-ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- ac_save_LIBS="$LIBS"
-LIBS="-lnsl $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 3229 "configure"
-#include "confdefs.h"
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char gethostbyname();
-
-int main() {
-gethostbyname()
-; return 0; }
-EOF
-if { (eval echo configure:3240: \"$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
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_lib=HAVE_LIB`echo nsl | sed -e 's/[^a-zA-Z0-9_]/_/g' \
- -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_lib 1
-EOF
-
- LIBS="-lnsl $LIBS"
-
-else
- echo "$ac_t""no" 1>&6
-fi
-
-
-. ${srcdir}/../../bfd/configure.host
-
-
-
-USE_MAINTAINER_MODE=no
-# Check whether --enable-maintainer-mode or --disable-maintainer-mode was given.
-if test "${enable_maintainer_mode+set}" = set; then
- enableval="$enable_maintainer_mode"
- case "${enableval}" in
- yes) MAINT="" USE_MAINTAINER_MODE=yes ;;
- no) MAINT="#" ;;
- *) { echo "configure: error: "--enable-maintainer-mode does not take a value"" 1>&2; exit 1; }; MAINT="#" ;;
-esac
-if test x"$silent" != x"yes" && test x"$MAINT" = x""; then
- echo "Setting maintainer mode" 6>&1
-fi
-else
- MAINT="#"
-fi
-
-
-
-# Check whether --enable-sim-bswap or --disable-sim-bswap was given.
-if test "${enable_sim_bswap+set}" = set; then
- enableval="$enable_sim_bswap"
- case "${enableval}" in
- yes) sim_bswap="-DWITH_BSWAP=1 -DUSE_BSWAP=1";;
- no) sim_bswap="-DWITH_BSWAP=0";;
- *) { echo "configure: error: "--enable-sim-bswap does not take a value"" 1>&2; exit 1; }; sim_bswap="";;
-esac
-if test x"$silent" != x"yes" && test x"$sim_bswap" != x""; then
- echo "Setting bswap flags = $sim_bswap" 6>&1
-fi
-else
- sim_bswap=""
-fi
-
-
-
-# Check whether --enable-sim-cflags or --disable-sim-cflags was given.
-if test "${enable_sim_cflags+set}" = set; then
- enableval="$enable_sim_cflags"
- case "${enableval}" in
- yes) sim_cflags="-O2 -fomit-frame-pointer";;
- trace) { echo "configure: error: "Please use --enable-sim-debug instead."" 1>&2; exit 1; }; sim_cflags="";;
- no) sim_cflags="";;
- *) sim_cflags=`echo "${enableval}" | sed -e "s/,/ /g"`;;
-esac
-if test x"$silent" != x"yes" && test x"$sim_cflags" != x""; then
- echo "Setting sim cflags = $sim_cflags" 6>&1
-fi
-else
- sim_cflags=""
-fi
-
-
-
-# Check whether --enable-sim-debug or --disable-sim-debug was given.
-if test "${enable_sim_debug+set}" = set; then
- enableval="$enable_sim_debug"
- case "${enableval}" in
- yes) sim_debug="-DDEBUG=7 -DWITH_DEBUG=7";;
- no) sim_debug="-DDEBUG=0 -DWITH_DEBUG=0";;
- *) sim_debug="-DDEBUG='(${enableval})' -DWITH_DEBUG='(${enableval})'";;
-esac
-if test x"$silent" != x"yes" && test x"$sim_debug" != x""; then
- echo "Setting sim debug = $sim_debug" 6>&1
-fi
-else
- sim_debug=""
-fi
-
-
-
-# Check whether --enable-sim-stdio or --disable-sim-stdio was given.
-if test "${enable_sim_stdio+set}" = set; then
- enableval="$enable_sim_stdio"
- case "${enableval}" in
- yes) sim_stdio="-DWITH_STDIO=DO_USE_STDIO";;
- no) sim_stdio="-DWITH_STDIO=DONT_USE_STDIO";;
- *) { echo "configure: error: "Unknown value $enableval passed to --enable-sim-stdio"" 1>&2; exit 1; }; sim_stdio="";;
-esac
-if test x"$silent" != x"yes" && test x"$sim_stdio" != x""; then
- echo "Setting stdio flags = $sim_stdio" 6>&1
-fi
-else
- sim_stdio=""
-fi
-
-
-
-# Check whether --enable-sim-trace or --disable-sim-trace was given.
-if test "${enable_sim_trace+set}" = set; then
- enableval="$enable_sim_trace"
- case "${enableval}" in
- yes) sim_trace="-DTRACE=1 -DWITH_TRACE=-1";;
- no) sim_trace="-DTRACE=0 -DWITH_TRACE=0";;
- [-0-9]*)
- sim_trace="-DTRACE='(${enableval})' -DWITH_TRACE='(${enableval})'";;
- [a-z]*)
- sim_trace=""
- for x in `echo "$enableval" | sed -e "s/,/ /g"`; do
- if test x"$sim_trace" = x; then
- sim_trace="-DWITH_TRACE='(TRACE_$x"
- else
- sim_trace="${sim_trace}|TRACE_$x"
- fi
- done
- sim_trace="$sim_trace)'" ;;
-esac
-if test x"$silent" != x"yes" && test x"$sim_trace" != x""; then
- echo "Setting sim trace = $sim_trace" 6>&1
-fi
-else
- sim_trace=""
-fi
-
-
-
-# Check whether --enable-sim-profile or --disable-sim-profile was given.
-if test "${enable_sim_profile+set}" = set; then
- enableval="$enable_sim_profile"
- case "${enableval}" in
- yes) sim_profile="-DPROFILE=1 -DWITH_PROFILE=-1";;
- no) sim_profile="-DPROFILE=0 -DWITH_PROFILE=0";;
- [-0-9]*)
- sim_profile="-DPROFILE='(${enableval})' -DWITH_PROFILE='(${enableval})'";;
- [a-z]*)
- sim_profile=""
- for x in `echo "$enableval" | sed -e "s/,/ /g"`; do
- if test x"$sim_profile" = x; then
- sim_profile="-DWITH_PROFILE='(PROFILE_$x"
- else
- sim_profile="${sim_profile}|PROFILE_$x"
- fi
- done
- sim_profile="$sim_profile)'" ;;
-esac
-if test x"$silent" != x"yes" && test x"$sim_profile" != x""; then
- echo "Setting sim profile = $sim_profile" 6>&1
-fi
-else
- sim_profile="-DPROFILE=1 -DWITH_PROFILE=-1"
-fi
-
-
-
-echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
-echo "configure:3416: 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 3421 "configure"
-#include "confdefs.h"
-#include <sys/types.h>
-#include <signal.h>
-#ifdef signal
-#undef signal
-#endif
-#ifdef __cplusplus
-extern "C" void (*signal (int, void (*)(int)))(int);
-#else
-void (*signal ()) ();
-#endif
-
-int main() {
-int i;
-; return 0; }
-EOF
-if { (eval echo configure:3438: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- ac_cv_type_signal=void
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_cv_type_signal=int
-fi
-rm -f conftest*
-fi
-
-echo "$ac_t""$ac_cv_type_signal" 1>&6
-cat >> confdefs.h <<EOF
-#define RETSIGTYPE $ac_cv_type_signal
-EOF
-
-
-
-
-
-echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
-echo "configure:3460: checking for executable suffix" >&5
-if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test "$CYGWIN" = yes || test "$MINGW32" = yes; then
- ac_cv_exeext=.exe
-else
- rm -f conftest*
- echo 'int main () { return 0; }' > conftest.$ac_ext
- ac_cv_exeext=
- if { (eval echo configure:3470: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
- for file in conftest.*; do
- case $file in
- *.c | *.o | *.obj | *.ilk | *.pdb) ;;
- *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;;
- esac
- done
- else
- { echo "configure: error: installation or configuration problem: compiler cannot create executables." 1>&2; exit 1; }
- fi
- rm -f conftest*
- test x"${ac_cv_exeext}" = x && ac_cv_exeext=no
-fi
-fi
-
-EXEEXT=""
-test x"${ac_cv_exeext}" != xno && EXEEXT=${ac_cv_exeext}
-echo "$ac_t""${ac_cv_exeext}" 1>&6
-ac_exeext=$EXEEXT
-
-
-sim_link_files=
-sim_link_links=
-
-sim_link_links=tconfig.h
-if test -f ${srcdir}/tconfig.in
-then
- sim_link_files=tconfig.in
-else
- sim_link_files=../common/tconfig.in
-fi
-
-# targ-vals.def points to the libc macro description file.
-case "${target}" in
-*-*-*) TARG_VALS_DEF=../common/nltvals.def ;;
-esac
-sim_link_files="${sim_link_files} ${TARG_VALS_DEF}"
-sim_link_links="${sim_link_links} targ-vals.def"
-
-
-
-
-default_sim_inline="-DDEFAULT_INLINE=0"
-# Check whether --enable-sim-inline or --disable-sim-inline was given.
-if test "${enable_sim_inline+set}" = set; then
- enableval="$enable_sim_inline"
- sim_inline=""
-case "$enableval" in
- no) sim_inline="-DDEFAULT_INLINE=0";;
- 0) sim_inline="-DDEFAULT_INLINE=0";;
- yes | 2) sim_inline="-DDEFAULT_INLINE=ALL_C_INLINE";;
- 1) sim_inline="-DDEFAULT_INLINE=INLINE_LOCALS";;
- *) for x in `echo "$enableval" | sed -e "s/,/ /g"`; do
- new_flag=""
- case "$x" in
- *_INLINE=*) new_flag="-D$x";;
- *=*) new_flag=`echo "$x" | sed -e "s/=/_INLINE=/" -e "s/^/-D/"`;;
- *_INLINE) new_flag="-D$x=ALL_C_INLINE";;
- *) new_flag="-D$x""_INLINE=ALL_C_INLINE";;
- esac
- if test x"$sim_inline" = x""; then
- sim_inline="$new_flag"
- else
- sim_inline="$sim_inline $new_flag"
- fi
- done;;
-esac
-if test x"$silent" != x"yes" && test x"$sim_inline" != x""; then
- echo "Setting inline flags = $sim_inline" 6>&1
-fi
-else
-
-if test "x$cross_compiling" = "xno"; then
- if test x"$GCC" != "x" -a x"${default_sim_inline}" != "x" ; then
- sim_inline="${default_sim_inline}"
- if test x"$silent" != x"yes"; then
- echo "Setting inline flags = $sim_inline" 6>&1
- fi
- else
- sim_inline=""
- fi
-else
- sim_inline="-DDEFAULT_INLINE=0"
-fi
-fi
-
-
-wire_endian="LITTLE_ENDIAN"
-default_endian=""
-# Check whether --enable-sim-endian or --disable-sim-endian was given.
-if test "${enable_sim_endian+set}" = set; then
- enableval="$enable_sim_endian"
- case "${enableval}" in
- b*|B*) sim_endian="-DWITH_TARGET_BYTE_ORDER=BIG_ENDIAN";;
- l*|L*) sim_endian="-DWITH_TARGET_BYTE_ORDER=LITTLE_ENDIAN";;
- yes) if test x"$wire_endian" != x; then
- sim_endian="-DWITH_TARGET_BYTE_ORDER=${wire_endian}"
- else
- if test x"$default_endian" != x; then
- sim_endian="-DWITH_TARGET_BYTE_ORDER=${default_endian}"
- else
- echo "No hard-wired endian for target $target" 1>&6
- sim_endian="-DWITH_TARGET_BYTE_ORDER=0"
- fi
- fi;;
- no) if test x"$default_endian" != x; then
- sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=${default_endian}"
- else
- if test x"$wire_endian" != x; then
- sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=${wire_endian}"
- else
- echo "No default endian for target $target" 1>&6
- sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=0"
- fi
- fi;;
- *) { echo "configure: error: "Unknown value $enableval for --enable-sim-endian"" 1>&2; exit 1; }; sim_endian="";;
-esac
-if test x"$silent" != x"yes" && test x"$sim_endian" != x""; then
- echo "Setting endian flags = $sim_endian" 6>&1
-fi
-else
- if test x"$default_endian" != x; then
- sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=${default_endian}"
-else
- if test x"$wire_endian" != x; then
- sim_endian="-DWITH_TARGET_BYTE_ORDER=${wire_endian}"
- else
- sim_endian=
- fi
-fi
-fi
-
-wire_alignment="FORCED_ALIGNMENT"
-default_alignment=""
-
-# Check whether --enable-sim-alignment or --disable-sim-alignment was given.
-if test "${enable_sim_alignment+set}" = set; then
- enableval="$enable_sim_alignment"
- case "${enableval}" in
- strict | STRICT) sim_alignment="-DWITH_ALIGNMENT=STRICT_ALIGNMENT";;
- nonstrict | NONSTRICT) sim_alignment="-DWITH_ALIGNMENT=NONSTRICT_ALIGNMENT";;
- forced | FORCED) sim_alignment="-DWITH_ALIGNMENT=FORCED_ALIGNMENT";;
- yes) if test x"$wire_alignment" != x; then
- sim_alignment="-DWITH_ALIGNMENT=${wire_alignment}"
- else
- if test x"$default_alignment" != x; then
- sim_alignment="-DWITH_ALIGNMENT=${default_alignment}"
- else
- echo "No hard-wired alignment for target $target" 1>&6
- sim_alignment="-DWITH_ALIGNMENT=0"
- fi
- fi;;
- no) if test x"$default_alignment" != x; then
- sim_alignment="-DWITH_DEFAULT_ALIGNMENT=${default_alignment}"
- else
- if test x"$wire_alignment" != x; then
- sim_alignment="-DWITH_DEFAULT_ALIGNMENT=${wire_alignment}"
- else
- echo "No default alignment for target $target" 1>&6
- sim_alignment="-DWITH_DEFAULT_ALIGNMENT=0"
- fi
- fi;;
- *) { echo "configure: error: "Unknown value $enableval passed to --enable-sim-alignment"" 1>&2; exit 1; }; sim_alignment="";;
-esac
-if test x"$silent" != x"yes" && test x"$sim_alignment" != x""; then
- echo "Setting alignment flags = $sim_alignment" 6>&1
-fi
-else
- if test x"$default_alignment" != x; then
- sim_alignment="-DWITH_DEFAULT_ALIGNMENT=${default_alignment}"
-else
- if test x"$wire_alignment" != x; then
- sim_alignment="-DWITH_ALIGNMENT=${wire_alignment}"
- else
- sim_alignment=
- fi
-fi
-fi
-
-
-# Check whether --enable-sim-hostendian or --disable-sim-hostendian was given.
-if test "${enable_sim_hostendian+set}" = set; then
- enableval="$enable_sim_hostendian"
- case "${enableval}" in
- no) sim_hostendian="-DWITH_HOST_BYTE_ORDER=0";;
- b*|B*) sim_hostendian="-DWITH_HOST_BYTE_ORDER=BIG_ENDIAN";;
- l*|L*) sim_hostendian="-DWITH_HOST_BYTE_ORDER=LITTLE_ENDIAN";;
- *) { echo "configure: error: "Unknown value $enableval for --enable-sim-hostendian"" 1>&2; exit 1; }; sim_hostendian="";;
-esac
-if test x"$silent" != x"yes" && test x"$sim_hostendian" != x""; then
- echo "Setting hostendian flags = $sim_hostendian" 6>&1
-fi
-else
-
-if test "x$cross_compiling" = "xno"; then
- echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6
-echo "configure:3666: checking whether byte ordering is bigendian" >&5
-if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- ac_cv_c_bigendian=unknown
-# See if sys/param.h defines the BYTE_ORDER macro.
-cat > conftest.$ac_ext <<EOF
-#line 3673 "configure"
-#include "confdefs.h"
-#include <sys/types.h>
-#include <sys/param.h>
-int main() {
-
-#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
- bogus endian macros
-#endif
-; return 0; }
-EOF
-if { (eval echo configure:3684: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- # It does; now see whether it defined to BIG_ENDIAN or not.
-cat > conftest.$ac_ext <<EOF
-#line 3688 "configure"
-#include "confdefs.h"
-#include <sys/types.h>
-#include <sys/param.h>
-int main() {
-
-#if BYTE_ORDER != BIG_ENDIAN
- not big endian
-#endif
-; return 0; }
-EOF
-if { (eval echo configure:3699: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- ac_cv_c_bigendian=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_cv_c_bigendian=no
-fi
-rm -f conftest*
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
-fi
-rm -f conftest*
-if test $ac_cv_c_bigendian = unknown; then
-if test "$cross_compiling" = yes; then
- { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
-else
- cat > conftest.$ac_ext <<EOF
-#line 3719 "configure"
-#include "confdefs.h"
-main () {
- /* Are we little or big endian? From Harbison&Steele. */
- union
- {
- long l;
- char c[sizeof (long)];
- } u;
- u.l = 1;
- exit (u.c[sizeof (long) - 1] == 1);
-}
-EOF
-if { (eval echo configure:3732: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
-then
- ac_cv_c_bigendian=no
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -fr conftest*
- ac_cv_c_bigendian=yes
-fi
-rm -fr conftest*
-fi
-
-fi
-fi
-
-echo "$ac_t""$ac_cv_c_bigendian" 1>&6
-if test $ac_cv_c_bigendian = yes; then
- cat >> confdefs.h <<\EOF
-#define WORDS_BIGENDIAN 1
-EOF
-
-fi
-
- if test $ac_cv_c_bigendian = yes; then
- sim_hostendian="-DWITH_HOST_BYTE_ORDER=BIG_ENDIAN"
- else
- sim_hostendian="-DWITH_HOST_BYTE_ORDER=LITTLE_ENDIAN"
- fi
-else
- sim_hostendian="-DWITH_HOST_BYTE_ORDER=0"
-fi
-fi
-
-
-# Check whether --enable-build-warnings or --disable-build-warnings was given.
-if test "${enable_build_warnings+set}" = set; then
- enableval="$enable_build_warnings"
- build_warnings="-Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations"
-case "${enableval}" in
- yes) ;;
- no) build_warnings="-w";;
- ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"`
- build_warnings="${build_warnings} ${t}";;
- *,) t=`echo "${enableval}" | sed -e "s/,/ /g"`
- build_warnings="${t} ${build_warnings}";;
- *) build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
-esac
-if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then
- echo "Setting warning flags = $build_warnings" 6>&1
-fi
-WARN_CFLAGS=""
-WERROR_CFLAGS=""
-if test "x${build_warnings}" != x -a "x$GCC" = xyes
-then
- # Separate out the -Werror flag as some files just cannot be
- # compiled with it enabled.
- for w in ${build_warnings}; do
- case $w in
- -Werr*) WERROR_CFLAGS=-Werror ;;
- *) WARN_CFLAGS="${WARN_CFLAGS} $w"
- esac
- done
-fi
-else
- build_warnings=""
-fi
-
-
-default_sim_reserved_bits="1"
-# Check whether --enable-sim-reserved-bits or --disable-sim-reserved-bits was given.
-if test "${enable_sim_reserved_bits+set}" = set; then
- enableval="$enable_sim_reserved_bits"
- case "${enableval}" in
- yes) sim_reserved_bits="-DWITH_RESERVED_BITS=1";;
- no) sim_reserved_bits="-DWITH_RESERVED_BITS=0";;
- *) { echo "configure: error: "--enable-sim-reserved-bits does not take a value"" 1>&2; exit 1; }; sim_reserved_bits="";;
-esac
-if test x"$silent" != x"yes" && test x"$sim_reserved_bits" != x""; then
- echo "Setting reserved flags = $sim_reserved_bits" 6>&1
-fi
-else
- sim_reserved_bits="-DWITH_RESERVED_BITS=${default_sim_reserved_bits}"
-fi
-
-wire_word_bitsize="32"
-wire_word_msb="31"
-wire_address_bitsize=""
-wire_cell_bitsize=""
-# Check whether --enable-sim-bitsize or --disable-sim-bitsize was given.
-if test "${enable_sim_bitsize+set}" = set; then
- enableval="$enable_sim_bitsize"
- sim_bitsize=
-case "${enableval}" in
- 64,63 | 64,63,* ) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=64 -DWITH_TARGET_WORD_MSB=63";;
- 32,31 | 32,31,* ) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=31";;
- 64,0 | 64,0,* ) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=0";;
- 32,0 | 64,0,* ) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=0";;
- 32) if test x"$wire_word_msb" != x -a x"$wire_word_msb" != x0; then
- sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=31"
- else
- sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=0"
- fi ;;
- 64) if test x"$wire_word_msb" != x -a x"$wire_word_msb" != x0; then
- sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=64 -DWITH_TARGET_WORD_MSB=63"
- else
- sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=64 -DWITH_TARGET_WORD_MSB=0"
- fi ;;
- *) { echo "configure: error: "--enable-sim-bitsize was given $enableval. Expected 32 or 64"" 1>&2; exit 1; } ;;
-esac
-# address bitsize
-tmp=`echo "${enableval}" | sed -e "s/^[0-9]*,*[0-9]*,*//"`
-case x"${tmp}" in
- x ) ;;
- x32 | x32,* ) sim_bitsize="${sim_bitsize} -DWITH_TARGET_ADDRESS_BITSIZE=32" ;;
- x64 | x64,* ) sim_bitsize="${sim_bitsize} -DWITH_TARGET_ADDRESS_BITSIZE=64" ;;
- * ) { echo "configure: error: "--enable-sim-bitsize was given address size $enableval. Expected 32 or 64"" 1>&2; exit 1; } ;;
-esac
-# cell bitsize
-tmp=`echo "${enableval}" | sed -e "s/^[0-9]*,*[0-9*]*,*[0-9]*,*//"`
-case x"${tmp}" in
- x ) ;;
- x32 | x32,* ) sim_bitsize="${sim_bitsize} -DWITH_TARGET_CELL_BITSIZE=32" ;;
- x64 | x64,* ) sim_bitsize="${sim_bitsize} -DWITH_TARGET_CELL_BITSIZE=64" ;;
- * ) { echo "configure: error: "--enable-sim-bitsize was given cell size $enableval. Expected 32 or 64"" 1>&2; exit 1; } ;;
-esac
-if test x"$silent" != x"yes" && test x"$sim_bitsize" != x""; then
- echo "Setting bitsize flags = $sim_bitsize" 6>&1
-fi
-else
- sim_bitsize=""
-if test x"$wire_word_bitsize" != x; then
- sim_bitsize="$sim_bitsize -DWITH_TARGET_WORD_BITSIZE=$wire_word_bitsize"
-fi
-if test x"$wire_word_msb" != x; then
- sim_bitsize="$sim_bitsize -DWITH_TARGET_WORD_MSB=$wire_word_msb"
-fi
-if test x"$wire_address_bitsize" != x; then
- sim_bitsize="$sim_bitsize -DWITH_TARGET_ADDRESS_BITSIZE=$wire_address_bitsize"
-fi
-if test x"$wire_cell_bitsize" != x; then
- sim_bitsize="$sim_bitsize -DWITH_TARGET_CELL_BITSIZE=$wire_cell_bitsize"
-fi
-fi
-
-
-for ac_hdr in stdlib.h unistd.h string.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:3881: 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 3886 "configure"
-#include "confdefs.h"
-#include <$ac_hdr>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3891: \"$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_func in getpid kill
-do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3920: 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 3925 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func();
-
-int main() {
-
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-$ac_func();
-#endif
-
-; return 0; }
-EOF
-if { (eval echo configure:3948: \"$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
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
-fi
-done
-
-
-
-
-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 | grep ac_space) 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
-
-DEFS=-DHAVE_CONFIG_H
-
-# 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.13"
- 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
-ac_given_INSTALL="$INSTALL"
-
-trap 'rm -fr `echo "Makefile.sim:Makefile.in Make-common.sim:../common/Make-common.in .gdbinit:../common/gdbinit.in config.h:config.in" | 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%@sim_environment@%$sim_environment%g
-s%@sim_alignment@%$sim_alignment%g
-s%@sim_assert@%$sim_assert%g
-s%@sim_bitsize@%$sim_bitsize%g
-s%@sim_endian@%$sim_endian%g
-s%@sim_hostendian@%$sim_hostendian%g
-s%@sim_float@%$sim_float%g
-s%@sim_scache@%$sim_scache%g
-s%@sim_default_model@%$sim_default_model%g
-s%@sim_hw_cflags@%$sim_hw_cflags%g
-s%@sim_hw_objs@%$sim_hw_objs%g
-s%@sim_hw@%$sim_hw%g
-s%@sim_inline@%$sim_inline%g
-s%@sim_packages@%$sim_packages%g
-s%@sim_regparm@%$sim_regparm%g
-s%@sim_reserved_bits@%$sim_reserved_bits%g
-s%@sim_smp@%$sim_smp%g
-s%@sim_stdcall@%$sim_stdcall%g
-s%@sim_xor_endian@%$sim_xor_endian%g
-s%@WARN_CFLAGS@%$WARN_CFLAGS%g
-s%@WERROR_CFLAGS@%$WERROR_CFLAGS%g
-s%@SHELL@%$SHELL%g
-s%@CFLAGS@%$CFLAGS%g
-s%@CPPFLAGS@%$CPPFLAGS%g
-s%@CXXFLAGS@%$CXXFLAGS%g
-s%@FFLAGS@%$FFLAGS%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%@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
-s%@CC@%$CC%g
-s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
-s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
-s%@INSTALL_DATA@%$INSTALL_DATA%g
-s%@CC_FOR_BUILD@%$CC_FOR_BUILD%g
-s%@HDEFINES@%$HDEFINES%g
-s%@AR@%$AR%g
-s%@RANLIB@%$RANLIB%g
-s%@SET_MAKE@%$SET_MAKE%g
-s%@CPP@%$CPP%g
-s%@ALLOCA@%$ALLOCA%g
-s%@USE_NLS@%$USE_NLS%g
-s%@MSGFMT@%$MSGFMT%g
-s%@GMSGFMT@%$GMSGFMT%g
-s%@XGETTEXT@%$XGETTEXT%g
-s%@USE_INCLUDED_LIBINTL@%$USE_INCLUDED_LIBINTL%g
-s%@CATALOGS@%$CATALOGS%g
-s%@CATOBJEXT@%$CATOBJEXT%g
-s%@DATADIRNAME@%$DATADIRNAME%g
-s%@GMOFILES@%$GMOFILES%g
-s%@INSTOBJEXT@%$INSTOBJEXT%g
-s%@INTLDEPS@%$INTLDEPS%g
-s%@INTLLIBS@%$INTLLIBS%g
-s%@INTLOBJS@%$INTLOBJS%g
-s%@POFILES@%$POFILES%g
-s%@POSUB@%$POSUB%g
-s%@INCLUDE_LOCALE_H@%$INCLUDE_LOCALE_H%g
-s%@GT_NO@%$GT_NO%g
-s%@GT_YES@%$GT_YES%g
-s%@MKINSTALLDIRS@%$MKINSTALLDIRS%g
-s%@l@%$l%g
-s%@MAINT@%$MAINT%g
-s%@sim_bswap@%$sim_bswap%g
-s%@sim_cflags@%$sim_cflags%g
-s%@sim_debug@%$sim_debug%g
-s%@sim_stdio@%$sim_stdio%g
-s%@sim_trace@%$sim_trace%g
-s%@sim_profile@%$sim_profile%g
-s%@EXEEXT@%$EXEEXT%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.sim:Makefile.in Make-common.sim:../common/Make-common.in .gdbinit:../common/gdbinit.in"}
-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
-
- case "$ac_given_INSTALL" in
- [/$]*) INSTALL="$ac_given_INSTALL" ;;
- *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
- 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
-s%@INSTALL@%$INSTALL%g
-" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
-fi; done
-rm -f conftest.s*
-
-# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
-# NAME is the cpp macro being defined and VALUE is the value it is being given.
-#
-# ac_d sets the value in "#define NAME VALUE" lines.
-ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)'
-ac_dB='\([ ][ ]*\)[^ ]*%\1#\2'
-ac_dC='\3'
-ac_dD='%g'
-# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
-ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
-ac_uB='\([ ]\)%\1#\2define\3'
-ac_uC=' '
-ac_uD='\4%g'
-# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
-ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
-ac_eB='$%\1#\2define\3'
-ac_eC=' '
-ac_eD='%g'
-
-if test "${CONFIG_HEADERS+set}" != set; then
-EOF
-cat >> $CONFIG_STATUS <<EOF
- CONFIG_HEADERS="config.h:config.in"
-EOF
-cat >> $CONFIG_STATUS <<\EOF
-fi
-for ac_file in .. $CONFIG_HEADERS; 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
-
- echo creating $ac_file
-
- rm -f conftest.frag conftest.in conftest.out
- ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
- cat $ac_file_inputs > conftest.in
-
-EOF
-
-# Transform confdefs.h into a sed script conftest.vals that substitutes
-# the proper values into config.h.in to produce config.h. And first:
-# Protect against being on the right side of a sed subst in config.status.
-# Protect against being in an unquoted here document in config.status.
-rm -f conftest.vals
-cat > conftest.hdr <<\EOF
-s/[\\&%]/\\&/g
-s%[\\$`]%\\&%g
-s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp
-s%ac_d%ac_u%gp
-s%ac_u%ac_e%gp
-EOF
-sed -n -f conftest.hdr confdefs.h > conftest.vals
-rm -f conftest.hdr
-
-# This sed command replaces #undef with comments. This is necessary, for
-# example, in the case of _POSIX_SOURCE, which is predefined and required
-# on some systems where configure will not decide to define it.
-cat >> conftest.vals <<\EOF
-s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */%
-EOF
-
-# Break up conftest.vals because some shells have a limit on
-# the size of here documents, and old seds have small limits too.
-
-rm -f conftest.tail
-while :
-do
- ac_lines=`grep -c . conftest.vals`
- # grep -c gives empty output for an empty file on some AIX systems.
- if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi
- # Write a limited-size here document to conftest.frag.
- echo ' cat > conftest.frag <<CEOF' >> $CONFIG_STATUS
- sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS
- echo 'CEOF
- sed -f conftest.frag conftest.in > conftest.out
- rm -f conftest.in
- mv conftest.out conftest.in
-' >> $CONFIG_STATUS
- sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail
- rm -f conftest.vals
- mv conftest.tail conftest.vals
-done
-rm -f conftest.vals
-
-cat >> $CONFIG_STATUS <<\EOF
- rm -f conftest.frag conftest.h
- echo "/* $ac_file. Generated automatically by configure. */" > conftest.h
- cat conftest.in >> conftest.h
- rm -f conftest.in
- if cmp -s $ac_file conftest.h 2>/dev/null; then
- echo "$ac_file is unchanged"
- rm -f conftest.h
- else
- # 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"
- fi
- rm -f $ac_file
- mv conftest.h $ac_file
- fi
-fi; done
-
-EOF
-
-cat >> $CONFIG_STATUS <<EOF
-ac_sources="$sim_link_files"
-ac_dests="$sim_link_links"
-EOF
-
-cat >> $CONFIG_STATUS <<\EOF
-srcdir=$ac_given_srcdir
-while test -n "$ac_sources"; do
- set $ac_dests; ac_dest=$1; shift; ac_dests=$*
- set $ac_sources; ac_source=$1; shift; ac_sources=$*
-
- echo "linking $srcdir/$ac_source to $ac_dest"
-
- if test ! -r $srcdir/$ac_source; then
- { echo "configure: error: $srcdir/$ac_source: File not found" 1>&2; exit 1; }
- fi
- rm -f $ac_dest
-
- # Make relative symlinks.
- # Remove last slash and all that follows it. Not all systems have dirname.
- ac_dest_dir=`echo $ac_dest|sed 's%/[^/][^/]*$%%'`
- if test "$ac_dest_dir" != "$ac_dest" && test "$ac_dest_dir" != .; then
- # The dest file is in a subdirectory.
- test ! -d "$ac_dest_dir" && mkdir "$ac_dest_dir"
- ac_dest_dir_suffix="/`echo $ac_dest_dir|sed 's%^\./%%'`"
- # A "../" for each directory in $ac_dest_dir_suffix.
- ac_dots=`echo $ac_dest_dir_suffix|sed 's%/[^/]*%../%g'`
- else
- ac_dest_dir_suffix= ac_dots=
- fi
-
- case "$srcdir" in
- [/$]*) ac_rel_source="$srcdir/$ac_source" ;;
- *) ac_rel_source="$ac_dots$srcdir/$ac_source" ;;
- esac
-
- # Make a symlink if possible; otherwise try a hard link.
- if ln -s $ac_rel_source $ac_dest 2>/dev/null ||
- ln $srcdir/$ac_source $ac_dest; then :
- else
- { echo "configure: error: can not link $ac_dest to $srcdir/$ac_source" 1>&2; exit 1; }
- fi
-done
-EOF
-cat >> $CONFIG_STATUS <<EOF
-
-EOF
-cat >> $CONFIG_STATUS <<\EOF
-case "x$CONFIG_FILES" in
- xMakefile*)
- echo "Merging Makefile.sim+Make-common.sim into Makefile ..."
- rm -f Makesim1.tmp Makesim2.tmp Makefile
- sed -n -e '/^## COMMON_PRE_/,/^## End COMMON_PRE_/ p' <Make-common.sim >Makesim1.tmp
- sed -n -e '/^## COMMON_POST_/,/^## End COMMON_POST_/ p' <Make-common.sim >Makesim2.tmp
- sed -e '/^## COMMON_PRE_/ r Makesim1.tmp' \
- -e '/^## COMMON_POST_/ r Makesim2.tmp' \
- <Makefile.sim >Makefile
- rm -f Makefile.sim Make-common.sim Makesim1.tmp Makesim2.tmp
- ;;
- esac
- case "x$CONFIG_HEADERS" in xconfig.h:config.in) echo > stamp-h ;; esac
-
-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/sim/tic80/configure.in b/sim/tic80/configure.in
deleted file mode 100644
index 730b62e6cfd..00000000000
--- a/sim/tic80/configure.in
+++ /dev/null
@@ -1,21 +0,0 @@
-dnl Process this file with autoconf to produce a configure script.
-sinclude(../common/aclocal.m4)
-AC_PREREQ(2.5)dnl
-AC_INIT(Makefile.in)
-
-SIM_AC_COMMON
-
-dnl Options available in this module
-SIM_AC_OPTION_INLINE(0)
-SIM_AC_OPTION_ENDIAN(LITTLE_ENDIAN)
-SIM_AC_OPTION_ALIGNMENT(FORCED_ALIGNMENT)
-SIM_AC_OPTION_HOSTENDIAN
-SIM_AC_OPTION_WARNINGS
-SIM_AC_OPTION_RESERVED_BITS(1)
-SIM_AC_OPTION_BITSIZE(32,31)
-
-dnl For UNIX emulation
-AC_CHECK_HEADERS(stdlib.h unistd.h string.h strings.h)
-AC_CHECK_FUNCS(getpid kill)
-
-SIM_AC_OUTPUT
diff --git a/sim/tic80/cpu.h b/sim/tic80/cpu.h
deleted file mode 100644
index 642c18103db..00000000000
--- a/sim/tic80/cpu.h
+++ /dev/null
@@ -1,345 +0,0 @@
-/* TIc80 Simulator.
- Copyright (C) 1997, 1998 Free Software Foundation, Inc.
- Contributed by Cygnus Support.
-
-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 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. */
-
-
-
-/* TI C80 control registers */
-
-typedef enum {
- EPC_CR,
- EIP_CR,
- CONFIG_CR,
- INTPEN_CR,
- IE_CR,
- FPST_CR,
- PPERROR_CR,
- PKTREQ_CR,
- TCOUNT_CR,
- TSCALE_CR,
- FLTOP_CR,
- FLTADR_CR,
- FLTTAG_CR,
- FLTDLT_CR,
- FLTDTH_CR,
- FLT005_CR,
- FLT006_CR,
- FLT007_CR,
- FLT008_CR,
- FLT009_CR,
- FLT010_CR,
- FLT011_CR,
- FLT012_CR,
- FLT013_CR,
- FLT014_CR,
- FLT015_CR,
- SYSSTK_CR,
- SYSTMP_CR,
- MPC_CR,
- MIP_CR,
- ECOMCNTL_CR,
- ANASTAT_CR,
- BRK1_CR,
- BRK2_CR,
- ITAG0_CR,
- ITAG1_CR,
- ITAG2_CR,
- ITAG3_CR,
- ITAG4_CR,
- ITAG5_CR,
- ITAG6_CR,
- ITAG7_CR,
- ITAG8_CR,
- ITAG9_CR,
- ITAG10_CR,
- ITAG11_CR,
- ITAG12_CR,
- ITAG13_CR,
- ITAG14_CR,
- ITAG15_CR,
- ILRU_CR,
- DTAG0_CR,
- DTAG1_CR,
- DTAG2_CR,
- DTAG3_CR,
- DTAG4_CR,
- DTAG5_CR,
- DTAG6_CR,
- DTAG7_CR,
- DTAG8_CR,
- DTAG9_CR,
- DTAG10_CR,
- DTAG11_CR,
- DTAG12_CR,
- DTAG13_CR,
- DTAG14_CR,
- DTAG15_CR,
- DLRU_CR,
- IN0P_CR,
- IN1P_CR,
- OUTP_CR,
- SCRATCH_CR,
- nr_tic80_control_regs,
-} tic80_control_regs;
-
-/* extern int tic80_cr2index (tic80_control_regs reg); */
-
-/* Map an instruction CR index onto the corresponding internal cr enum
- or SCRATCH_CR if the index is invalid */
-
-extern tic80_control_regs tic80_index2cr (int index);
-
-
-/* TIc80 interrupt register bits */
-
-enum {
- IE_CR_PE = BIT32(31),
- IE_CR_X4 = BIT32(30),
- IE_CR_X3 = BIT32(29),
- IE_CR_BP = BIT32(28),
- IE_CR_PB = BIT32(27),
- IE_CR_PC = BIT32(26),
- IE_CR_MI = BIT32(25),
- /**/
- IE_CR_P3 = BIT32(19),
- IE_CR_P2 = BIT32(18),
- IE_CR_P1 = BIT32(17),
- IE_CR_P0 = BIT32(16),
- IE_CR_IO = BIT32(15),
- IE_CR_MF = BIT32(14),
- /**/
- IE_CR_X2 = BIT32(12),
- IE_CR_X1 = BIT32(11),
- IE_CR_TI = BIT32(10),
- IE_CR_F1 = BIT32(9),
- IE_CR_F0 = BIT32(8),
- IE_CR_FX = BIT32(7),
- IE_CR_FU = BIT32(6),
- IE_CR_FO = BIT32(5),
- /**/
- IE_CR_FZ = BIT32(3),
- IE_CR_FI = BIT32(2),
- /**/
- IE_CR_IE = BIT32(0),
-};
-
-
-
-
-struct _sim_cpu {
- unsigned32 reg[32];
- unsigned64 acc[4];
- unsigned32 cr[nr_tic80_control_regs];
- int is_user_mode; /* hidden mode latch */
- sim_cia cia;
- sim_cpu_base base;
-};
-
-#define CIA_GET(CPU) ((CPU)->cia)
-#define CIA_SET(CPU,VAL) ((CPU)->cia = (VAL))
-
-#define GPR(N) ((CPU)->reg[N])
-#define GPR_CLEAR(N) (GPR((N)) = 0)
-#define ACC(N) ((CPU)->acc[N])
-#define CR(N) ((CPU)->cr[tic80_index2cr ((N))])
-
-
-
-#if defined(WITH_TRACE)
-extern char *tic80_trace_alu3 PARAMS ((int, unsigned32, unsigned32, unsigned32));
-extern char *tic80_trace_cmp PARAMS ((int, unsigned32, unsigned32, unsigned32));
-extern char *tic80_trace_alu2 PARAMS ((int, unsigned32, unsigned32));
-extern char *tic80_trace_shift PARAMS ((int, unsigned32, unsigned32, int, int, int, int, int));
-extern void tic80_trace_fpu3 PARAMS ((SIM_DESC, sim_cpu *, sim_cia, int, sim_fpu *, sim_fpu *, sim_fpu *));
-extern void tic80_trace_fpu2 PARAMS ((SIM_DESC, sim_cpu *, sim_cia, int, sim_fpu *, sim_fpu *));
-extern void tic80_trace_fpu1 PARAMS ((SIM_DESC, sim_cpu *, sim_cia, int, sim_fpu *));
-extern void tic80_trace_fpu2i PARAMS ((SIM_DESC, sim_cpu *, sim_cia, int, unsigned32, sim_fpu *, sim_fpu *));
-extern void tic80_trace_fpu2cmp PARAMS ((SIM_DESC, sim_cpu *, sim_cia, int, unsigned32, sim_fpu *, sim_fpu *));
-extern char *tic80_trace_nop PARAMS ((int));
-extern char *tic80_trace_sink1 PARAMS ((int, unsigned32));
-extern char *tic80_trace_sink2 PARAMS ((int, unsigned32, unsigned32));
-extern char *tic80_trace_sink3 PARAMS ((int, unsigned32, unsigned32, unsigned32));
-extern char *tic80_trace_cond_br PARAMS ((int, int, unsigned32, unsigned32, int, int));
-extern char *tic80_trace_ucond_br PARAMS ((int, unsigned32));
-extern void tic80_trace_ldst PARAMS ((SIM_DESC, sim_cpu *, sim_cia, int, int, int, int, unsigned32, unsigned32, unsigned32));
-
-#define TRACE_ALU3(indx, result, input1, input2) \
-do { \
- if (TRACE_ALU_P (CPU)) { \
- trace_one_insn (SD, CPU, cia.ip, 1, itable[indx].file, \
- itable[indx].line_nr, "alu", \
- tic80_trace_alu3 (indx, result, input1, input2)); \
- } \
-} while (0)
-
-#define TRACE_CMP(indx, result, input1, input2) \
-do { \
- if (TRACE_ALU_P (CPU)) { \
- trace_one_insn (SD, CPU, cia.ip, 1, itable[indx].file, \
- itable[indx].line_nr, "alu", \
- tic80_trace_cmp (indx, result, input1, input2)); \
- } \
-} while (0)
-
-#define TRACE_ALU2(indx, result, input) \
-do { \
- if (TRACE_ALU_P (CPU)) { \
- trace_one_insn (SD, CPU, cia.ip, 1, itable[indx].file, \
- itable[indx].line_nr, "alu", \
- tic80_trace_alu2 (indx, result, input)); \
- } \
-} while (0)
-
-#define TRACE_SHIFT(indx, result, input, i, n, merge, endmask, rotate) \
-do { \
- if (TRACE_ALU_P (CPU)) { \
- trace_one_insn (SD, CPU, cia.ip, 1, itable[indx].file, \
- itable[indx].line_nr, "shift", \
- tic80_trace_shift (indx, result, input, i, n, \
- merge, endmask, rotate)); \
- } \
-} while (0)
-
-#define TRACE_FPU3(result, input1, input2) \
-do { \
- if (TRACE_FPU_P (CPU)) { \
- tic80_trace_fpu3 (SD, CPU, cia, MY_INDEX, \
- &result, &input1, &input2); \
- } \
-} while (0)
-
-#define TRACE_FPU2(result, input) \
-do { \
- if (TRACE_FPU_P (CPU)) { \
- tic80_trace_fpu2 (SD, CPU, cia, MY_INDEX, \
- &result, &input); \
- } \
-} while (0)
-
-#define TRACE_FPU1(result) \
-do { \
- if (TRACE_FPU_P (CPU)) { \
- tic80_trace_fpu1 (SD, CPU, cia, MY_INDEX, \
- &result); \
- } \
-} while (0)
-
-#define TRACE_FPU2I(result, input1, input2) \
-do { \
- if (TRACE_FPU_P (CPU)) { \
- tic80_trace_fpu2i (SD, CPU, cia, MY_INDEX, \
- result, &input1, &input2); \
- } \
-} while (0)
-
-#define TRACE_FPU2CMP(result, input1, input2) \
-do { \
- if (TRACE_FPU_P (CPU)) { \
- tic80_trace_fpu2cmp (SD, CPU, cia, MY_INDEX, \
- result, &input1, &input2); \
- } \
-} while (0)
-
-#define TRACE_NOP(indx) \
-do { \
- if (TRACE_ALU_P (CPU)) { \
- trace_one_insn (SD, CPU, cia.ip, 1, itable[indx].file, \
- itable[indx].line_nr, "nop", \
- tic80_trace_nop (indx)); \
- } \
-} while (0)
-
-#define TRACE_SINK1(indx, input) \
-do { \
- if (TRACE_ALU_P (CPU)) { \
- trace_one_insn (SD, CPU, cia.ip, 1, itable[indx].file, \
- itable[indx].line_nr, "nop", \
- tic80_trace_sink1 (indx, input)); \
- } \
-} while (0)
-
-#define TRACE_SINK2(indx, input1, input2) \
-do { \
- if (TRACE_ALU_P (CPU)) { \
- trace_one_insn (SD, CPU, cia.ip, 1, itable[indx].file, \
- itable[indx].line_nr, "nop", \
- tic80_trace_sink2 (indx, input1, input2)); \
- } \
-} while (0)
-
-#define TRACE_SINK3(indx, input1, input2, input3) \
-do { \
- if (TRACE_ALU_P (CPU)) { \
- trace_one_insn (SD, CPU, cia.ip, 1, itable[indx].file, \
- itable[indx].line_nr, "nop", \
- tic80_trace_sink3 (indx, input1, input2, input3)); \
- } \
-} while (0)
-
-#define TRACE_COND_BR(indx, jump_p, cond, target, size, code) \
-do { \
- if (TRACE_BRANCH_P (CPU)) { \
- trace_one_insn (SD, CPU, cia.ip, 1, itable[indx].file, \
- itable[indx].line_nr, "branch", \
- tic80_trace_cond_br (indx, jump_p, cond, target, \
- size, code)); \
- } \
-} while (0)
-
-#define TRACE_UCOND_BR(indx, target) \
-do { \
- if (TRACE_BRANCH_P (CPU)) { \
- trace_one_insn (SD, CPU, cia.ip, 1, itable[indx].file, \
- itable[indx].line_nr, "branch", \
- tic80_trace_ucond_br (indx, target)); \
- } \
-} while (0)
-
-#define TRACE_LD(result, m, s, addr1, addr2) \
-do { \
- if (TRACE_MEMORY_P (CPU)) { \
- tic80_trace_ldst (SD, CPU, cia, MY_INDEX, \
- 0, m, s, result, addr1, addr2); \
- } \
-} while (0)
-
-#define TRACE_ST(value, m, s, addr1, addr2) \
-do { \
- if (TRACE_MEMORY_P (CPU)) { \
- tic80_trace_ldst (SD, CPU, cia, MY_INDEX, \
- 1, m, s, value, addr1, addr2); \
- } \
-} while (0)
-
-#else
-#define TRACE_ALU3(indx, result, input1, input2)
-#define TRACE_ALU2(indx, result, input)
-#define TRACE_FPU3(result, input1, input2)
-#define TRACE_FPU2(result, input)
-#define TRACE_FPU1(result)
-#define TRACE_FPU2I(result, input1, input2)
-#define TRACE_NOP(indx)
-#define TRACE_SINK1(indx, input)
-#define TRACE_SINK2(indx, input1, input2)
-#define TRACE_SINK3(indx, input1, input2, input3)
-#define TRACE_COND_BR(indx, jump_p, cond, target, size, code)
-#define TRACE_UCOND_BR(indx, target)
-#define TRACE_LD(m, s, result, addr1, addr2)
-#define TRACE_ST(m, s, value, addr1, addr2)
-#endif
diff --git a/sim/tic80/interp.c b/sim/tic80/interp.c
deleted file mode 100644
index 17f06d486c2..00000000000
--- a/sim/tic80/interp.c
+++ /dev/null
@@ -1,127 +0,0 @@
-/* This file is part of the GDB simulators.
-
- Copyright (C) 1997, Free Software Foundation
- Condtributed by Cyngnus Solutions.
-
- 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 "sim-main.h"
-
-#include "idecode.h"
-#include "itable.h"
-
-#ifdef HAVE_STRING_H
-#include <string.h>
-#else
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#endif
-#endif
-
-
-#if 0
-
-void
-engine_error (SIM_DESC sd,
- sim_cpu *cpu,
- instruction_address cia,
- const char *fmt,
- ...)
-{
- va_list ap;
- va_start (ap, fmt);
- sim_io_evprintf (sd, fmt, ap);
- va_end (ap);
-
- sim_halt (sd, cpu, NULL, cia, sim_stopped, SIGABRT);
-}
-
-void
-engine_halt (SIM_DESC sd,
- sim_cpu *cpu,
- instruction_address cia,
- enum sim_stop reason,
- int siggnal)
-{
- if (!sd->halt_ok)
- sim_io_error (sd, "engine_halt - bad longjmp");
- sd->reason = reason;
- sd->siggnal = siggnal;
- sd->halt_ok = 0;
- sd->restart_ok = 0;
- if (cpu != NULL)
- cpu->cia = cia;
- longjmp (sd->path_to_halt, 1);
-}
-
-void
-engine_restart (SIM_DESC sd,
- sim_cpu *cpu,
- instruction_address cia)
-{
- if (!sd->restart_ok)
- sim_io_error (sd, "engine_restart - bad longjmp");
- sd->restart_ok = 0;
- cpu->cia = cia;
- longjmp(sd->path_to_restart, 1);
-}
-
-
-void
-engine_run_until_stop (SIM_DESC sd,
- volatile int *keep_running)
-{
- if (!setjmp (sd->path_to_halt))
- {
- instruction_address cia;
- sim_cpu *cpu = STATE_CPU (sd, 0);
- sd->halt_ok = 1;
- setjmp (sd->path_to_restart);
- sd->restart_ok = 1;
- cia = cpu->cia;
- do
- {
- instruction_word insn = IMEM (cia);
- cia = idecode_issue (sd, insn, cia);
- }
- while (*keep_running);
- engine_halt (sd, cpu, cia, sim_stopped, SIM_SIGINT);
- }
-}
-
-
-void
-engine_step (SIM_DESC sd)
-{
- if (!setjmp (sd->path_to_halt))
- {
- instruction_address cia;
- instruction_word insn;
- sim_cpu *cpu = STATE_CPU (sd, 0);
- sd->halt_ok = 1;
- setjmp (sd->path_to_restart);
- sd->restart_ok = 1;
- cia = cpu->cia;
- insn = IMEM (cia);
- cia = idecode_issue (sd, insn, cia);
- engine_halt (sd, cpu, cia, sim_stopped, SIM_SIGTRAP);
- }
-}
-
-#endif
diff --git a/sim/tic80/misc.c b/sim/tic80/misc.c
deleted file mode 100644
index fc7fbec12b7..00000000000
--- a/sim/tic80/misc.c
+++ /dev/null
@@ -1,624 +0,0 @@
-/* TIc80 Simulator.
- Copyright (C) 1997, 1998 Free Software Foundation, Inc.
- Contributed by Cygnus Support.
-
-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 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"
-
-#ifdef HAVE_STRING_H
-#include <string.h>
-#else
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#endif
-#endif
-
-
-tic80_control_regs
-tic80_index2cr (int index)
-{
- switch (index)
- {
- case 0x0000: return EPC_CR;
- case 0x0001: return EIP_CR;
- case 0x0002: return CONFIG_CR;
- case 0x0004: return INTPEN_CR;
- case 0x0006: return IE_CR;
- case 0x0008: return FPST_CR;
- case 0x000A: return PPERROR_CR;
- case 0x000D: return PKTREQ_CR;
- case 0x000E: return TCOUNT_CR;
- case 0x000F: return TSCALE_CR;
- case 0x0010: return FLTOP_CR;
- case 0x0011: return FLTADR_CR;
- case 0x0012: return FLTTAG_CR;
- case 0x0013: return FLTDLT_CR;
- case 0x0014: return FLTDTH_CR;
- case 0x0015: return FLT005_CR;
- case 0x0016: return FLT006_CR;
- case 0x0017: return FLT007_CR;
- case 0x0018: return FLT008_CR;
- case 0x0019: return FLT009_CR;
- case 0x001a: return FLT010_CR;
- case 0x001b: return FLT011_CR;
- case 0x001c: return FLT012_CR;
- case 0x001d: return FLT013_CR;
- case 0x001e: return FLT014_CR;
- case 0x001f: return FLT015_CR;
- case 0x0020: return SYSSTK_CR;
- case 0x0021: return SYSTMP_CR;
- case 0x0030: return MPC_CR;
- case 0x0031: return MIP_CR;
- case 0x0033: return ECOMCNTL_CR;
- case 0x0034: return ANASTAT_CR;
- case 0x0039: return BRK1_CR;
- case 0x003A: return BRK2_CR;
- case 0x0200: return ITAG0_CR;
- case 0x0201: return ITAG1_CR;
- case 0x0202: return ITAG2_CR;
- case 0x0203: return ITAG3_CR;
- case 0x0204: return ITAG4_CR;
- case 0x0205: return ITAG5_CR;
- case 0x0206: return ITAG6_CR;
- case 0x0207: return ITAG7_CR;
- case 0x0208: return ITAG8_CR;
- case 0x0209: return ITAG9_CR;
- case 0x020a: return ITAG10_CR;
- case 0x020b: return ITAG11_CR;
- case 0x020c: return ITAG12_CR;
- case 0x020d: return ITAG13_CR;
- case 0x020e: return ITAG14_CR;
- case 0x020f: return ITAG15_CR;
- case 0x0300: return ILRU_CR;
- case 0x0400: return DTAG0_CR;
- case 0x0401: return DTAG1_CR;
- case 0x0402: return DTAG2_CR;
- case 0x0403: return DTAG3_CR;
- case 0x0404: return DTAG4_CR;
- case 0x0405: return DTAG5_CR;
- case 0x0406: return DTAG6_CR;
- case 0x0407: return DTAG7_CR;
- case 0x0408: return DTAG8_CR;
- case 0x0409: return DTAG9_CR;
- case 0x040a: return DTAG10_CR;
- case 0x040b: return DTAG11_CR;
- case 0x040c: return DTAG12_CR;
- case 0x040d: return DTAG13_CR;
- case 0x040e: return DTAG14_CR;
- case 0x040f: return DTAG15_CR;
- case 0x0500: return DLRU_CR;
- case 0x4000: return IN0P_CR;
- case 0x4001: return IN1P_CR;
- case 0x4002: return OUTP_CR;
- default: return SCRATCH_CR;
- }
-}
-
-
-
-#if defined(WITH_TRACE)
-/* Tracing support routines */
-
-static char tic80_trace_buffer[1024];
-static int tic80_size_name;
-
-#define SIZE_HEX 8
-#define SIZE_DECIMAL 11
-
-/* Initialize tracing by calculating the maximum name size */
-static void
-tic80_init_trace (void)
-{
- int i;
- int len, max_len = 0;
-
- for (i = 0; i < (int)nr_itable_entries; i++) {
- len = strlen (itable[i].name);
- if (len > max_len)
- max_len = len;
- }
-
- tic80_size_name = max_len + sizeof(":m") - 1 + sizeof (":s") - 1;
-}
-
-/* Given an integer which is the result of a comparison, return a string
- giving which bits are set. */
-
-static char *
-tic80_trace_cmp_internal (unsigned32 flag)
-{
- struct cmp_bits { unsigned32 bit; char *string; };
- static char buffer[32*8];
- static struct cmp_bits bits[] =
- {
- { BIT32(29), "hs" },
- { BIT32(28), "lo" },
- { BIT32(27), "ls" },
- { BIT32(26), "hi" },
- { BIT32(25), "ge" },
- { BIT32(24), "lt" },
- { BIT32(23), "le" },
- { BIT32(22), "gt" },
- { BIT32(21), "ne" },
- { BIT32(20), "eq" },
-
- { BIT32(19), "hs.h" },
- { BIT32(18), "lo.h" },
- { BIT32(17), "ls.h" },
- { BIT32(16), "hi.h" },
- { BIT32(15), "ge.h" },
- { BIT32(14), "lt.h" },
- { BIT32(13), "le.h" },
- { BIT32(12), "gt.h" },
- { BIT32(11), "ne.h" },
- { BIT32(10), "eq.h" },
-
- { BIT32( 9), "hs.b" },
- { BIT32( 8), "lo.b" },
- { BIT32( 7), "ls.b" },
- { BIT32( 6), "hi.b" },
- { BIT32( 5), "ge.b" },
- { BIT32( 4), "lt.b" },
- { BIT32( 3), "le.b" },
- { BIT32( 2), "gt.b" },
- { BIT32( 1), "ne.b" },
- { BIT32( 0), "eq.b" },
- { 0, (char *)0 },
- };
-
- int i;
- char *p = buffer;
-
- for (i = 0; bits[i].bit != 0; i++)
- {
- if ((flag & bits[i].bit) != 0)
- {
- if (p != buffer)
- *p++ = ' ';
-
- strcpy (p, bits[i].string);
- p += strlen (p);
- }
- }
-
- *p = '\0';
- return buffer;
-}
-
-/* Trace the result of an ALU operation with 2 integer inputs and an integer output */
-char *
-tic80_trace_alu3 (int indx,
- unsigned32 result,
- unsigned32 input1,
- unsigned32 input2)
-{
- if (!tic80_size_name)
- tic80_init_trace ();
-
- sprintf (tic80_trace_buffer, "%-*s 0x%.*lx/%*ld 0x%.*lx/%*ld => 0x%.*lx/%*ld",
- tic80_size_name, itable[indx].name,
- SIZE_HEX, input1, SIZE_DECIMAL, (long)(signed32)input1,
- SIZE_HEX, input2, SIZE_DECIMAL, (long)(signed32)input2,
- SIZE_HEX, result, SIZE_DECIMAL, (long)(signed32)result);
-
- return tic80_trace_buffer;
-}
-
-/* Trace the result of an ALU operation with 2 integer inputs and an integer output
- that sets the bits from a compare instruction. */
-char *
-tic80_trace_cmp (int indx,
- unsigned32 result,
- unsigned32 input1,
- unsigned32 input2)
-{
- if (!tic80_size_name)
- tic80_init_trace ();
-
- sprintf (tic80_trace_buffer, "%-*s 0x%.*lx/%*ld 0x%.*lx/%*ld => 0x%.*lx %s",
- tic80_size_name, itable[indx].name,
- SIZE_HEX, input1, SIZE_DECIMAL, (long)(signed32)input1,
- SIZE_HEX, input2, SIZE_DECIMAL, (long)(signed32)input2,
- SIZE_HEX, result, tic80_trace_cmp_internal (result));
-
- return tic80_trace_buffer;
-}
-
-/* Trace the result of an ALU operation with 1 integer input and an integer output */
-char *
-tic80_trace_alu2 (int indx,
- unsigned32 result,
- unsigned32 input)
-{
- if (!tic80_size_name)
- tic80_init_trace ();
-
- sprintf (tic80_trace_buffer, "%-*s 0x%.*lx/%*ld %*s => 0x%.*lx/%*ld",
- tic80_size_name, itable[indx].name,
- SIZE_HEX, input, SIZE_DECIMAL, (long)(signed32)input,
- SIZE_HEX + SIZE_DECIMAL + 3, "",
- SIZE_HEX, result, SIZE_DECIMAL, (long)(signed32)result);
-
- return tic80_trace_buffer;
-}
-
-/* Trace the result of a shift instruction */
-char *
-tic80_trace_shift (int indx,
- unsigned32 result,
- unsigned32 input,
- int i,
- int n,
- int merge,
- int endmask,
- int rotate)
-{
- const char *merge_name;
- char name[40];
- char *p;
-
- if (!tic80_size_name)
- tic80_init_trace ();
-
- switch (merge)
- {
- default: merge_name = ".??"; break;
- case 0: merge_name = ".dz"; break;
- case 1: merge_name = ".dm"; break;
- case 2: merge_name = ".ds"; break;
- case 3: merge_name = ".ez"; break;
- case 4: merge_name = ".em"; break;
- case 5: merge_name = ".es"; break;
- case 6: merge_name = ".iz"; break;
- case 7: merge_name = ".im"; break;
- }
-
- /* Don't use itable[indx].name, which is just sl {r,i}. Instead reconstruct
- the name, using the i and n fields. */
- p = strchr (itable[indx].name, ' ');
- sprintf (name, "s%s%s%s%s",
- (n) ? "r" : "l",
- (i) ? "i" : "",
- merge_name,
- (p) ? p : "");
-
- sprintf (tic80_trace_buffer, "%-*s 0x%.*lx/%*ld %*s%2d,%2d => 0x%.*lx/%*ld",
- tic80_size_name, name,
- SIZE_HEX, input, SIZE_DECIMAL, (long)(signed32)input,
- SIZE_HEX + SIZE_DECIMAL - 2, "",
- rotate, endmask,
- SIZE_HEX, result, SIZE_DECIMAL, (long)(signed32)result);
-
- return tic80_trace_buffer;
-}
-
-/* Trace the result of an FPU operation with 2 floating point inputs and a floating point output */
-void
-tic80_trace_fpu3 (SIM_DESC sd,
- sim_cpu *cpu,
- sim_cia cia,
- int indx,
- sim_fpu *result,
- sim_fpu *input1,
- sim_fpu *input2)
-{
- if (!tic80_size_name)
- tic80_init_trace ();
-
- trace_one_insn (sd, cpu, cia.ip, 1,
- itable[indx].file, itable[indx].line_nr, "fpu",
- "%-*s %*g %*g => %*g",
- tic80_size_name, itable[indx].name,
- SIZE_HEX + SIZE_DECIMAL + 3, sim_fpu_2d (input1),
- SIZE_HEX + SIZE_DECIMAL + 3, sim_fpu_2d (input2),
- SIZE_HEX + SIZE_DECIMAL + 3, sim_fpu_2d (result));
-}
-
-/* Trace the result of an FPU operation with 1 floating point input and a floating point output */
-void
-tic80_trace_fpu2 (SIM_DESC sd,
- sim_cpu *cpu,
- sim_cia cia,
- int indx,
- sim_fpu *result,
- sim_fpu *input)
-{
- if (!tic80_size_name)
- tic80_init_trace ();
-
- trace_one_insn (sd, cpu, cia.ip, 1,
- itable[indx].file, itable[indx].line_nr, "fpu",
- "%-*s %*g %-*s => %*g",
- tic80_size_name, itable[indx].name,
- SIZE_HEX + SIZE_DECIMAL + 3, sim_fpu_2d (input),
- SIZE_HEX + SIZE_DECIMAL + 3, "",
- SIZE_HEX + SIZE_DECIMAL, sim_fpu_2d (result));
-}
-
-/* Trace the result of an FPU operation with 1 floating point input and a floating point output */
-void
-tic80_trace_fpu1 (SIM_DESC sd,
- sim_cpu *cpu,
- sim_cia cia,
- int indx,
- sim_fpu *result)
-{
- if (!tic80_size_name)
- tic80_init_trace ();
-
- trace_one_insn (sd, cpu, cia.ip, 1,
- itable[indx].file, itable[indx].line_nr, "fpu",
- "%-*s %-*s %-*s => %*g",
- tic80_size_name, itable[indx].name,
- SIZE_HEX + SIZE_DECIMAL + 3, "",
- SIZE_HEX + SIZE_DECIMAL + 3, "",
- SIZE_HEX + SIZE_DECIMAL, sim_fpu_2d (result));
-}
-
-/* Trace the result of an FPU operation with 2 floating point inputs and an integer output */
-void
-tic80_trace_fpu2i (SIM_DESC sd,
- sim_cpu *cpu,
- sim_cia cia,
- int indx,
- unsigned32 result,
- sim_fpu *input1,
- sim_fpu *input2)
-{
- if (!tic80_size_name)
- tic80_init_trace ();
-
- trace_one_insn (sd, cpu, cia.ip, 1,
- itable[indx].file, itable[indx].line_nr, "fpu",
- "%-*s %*g %*g => 0x%.*lx %-*ld",
- tic80_size_name, itable[indx].name,
- SIZE_HEX + SIZE_DECIMAL + 3, sim_fpu_2d (input1),
- SIZE_HEX + SIZE_DECIMAL + 3, sim_fpu_2d (input2),
- SIZE_HEX, result, SIZE_DECIMAL, (long)(signed32)result);
-}
-
-/* Trace the result of an FPU operation with 2 floating point inputs and an integer output
- that is the result of a comparison. */
-void
-tic80_trace_fpu2cmp (SIM_DESC sd,
- sim_cpu *cpu,
- sim_cia cia,
- int indx,
- unsigned32 result,
- sim_fpu *input1,
- sim_fpu *input2)
-{
- if (!tic80_size_name)
- tic80_init_trace ();
-
- trace_one_insn (sd, cpu, cia.ip, 1,
- itable[indx].file, itable[indx].line_nr, "fpu",
- "%-*s %*g %*g => 0x%.*lx %s",
- tic80_size_name, itable[indx].name,
- SIZE_HEX + SIZE_DECIMAL + 3, sim_fpu_2d (input1),
- SIZE_HEX + SIZE_DECIMAL + 3, sim_fpu_2d (input2),
- SIZE_HEX, result, tic80_trace_cmp_internal (result));
-}
-
-/* Trace the result of a NOP operation */
-char *
-tic80_trace_nop (int indx)
-{
- if (!tic80_size_name)
- tic80_init_trace ();
-
- sprintf (tic80_trace_buffer, "%s", itable[indx].name);
- return tic80_trace_buffer;
-}
-
-/* Trace the result of a data sink with one input */
-char *
-tic80_trace_sink1 (int indx, unsigned32 input)
-{
- if (!tic80_size_name)
- tic80_init_trace ();
-
- sprintf (tic80_trace_buffer, "%-*s 0x%.*lx/%*ld",
- tic80_size_name, itable[indx].name,
- SIZE_HEX, input, SIZE_DECIMAL, (long)(signed32)input);
-
- return tic80_trace_buffer;
-}
-
-/* Trace the result of a data sink with two inputs */
-char *
-tic80_trace_sink2 (int indx, unsigned32 input1, unsigned32 input2)
-{
- if (!tic80_size_name)
- tic80_init_trace ();
-
- sprintf (tic80_trace_buffer, "%-*s 0x%.*lx/%*ld 0x%.*lx/%*ld",
- tic80_size_name, itable[indx].name,
- SIZE_HEX, input1, SIZE_DECIMAL, (long)(signed32)input1,
- SIZE_HEX, input2, SIZE_DECIMAL, (long)(signed32)input2);
-
- return tic80_trace_buffer;
-}
-
-/* Trace the result of a data sink with three inputs */
-char *
-tic80_trace_sink3 (int indx, unsigned32 input1, unsigned32 input2, unsigned32 input3)
-{
- if (!tic80_size_name)
- tic80_init_trace ();
-
- sprintf (tic80_trace_buffer, "%-*s 0x%.*lx/%*ld 0x%.*lx/%*ld 0x%.*lx/%*ld",
- tic80_size_name, itable[indx].name,
- SIZE_HEX, input1, SIZE_DECIMAL, (long)(signed32)input1,
- SIZE_HEX, input2, SIZE_DECIMAL, (long)(signed32)input2,
- SIZE_HEX, input3, SIZE_DECIMAL, (long)(signed32)input3);
-
- return tic80_trace_buffer;
-}
-
-/* Trace the result of a conditional branch operation */
-char *
-tic80_trace_cond_br (int indx,
- int jump_p,
- unsigned32 cond,
- unsigned32 target,
- int size,
- int code)
-{
- char *suffix1, *suffix2;
-
- if (!tic80_size_name)
- tic80_init_trace ();
-
- if (size >= 0 && code >= 0)
- { /* BCND */
- switch (code)
- {
- default: suffix1 = "???"; break;
- case 0: suffix1 = "nev"; break;
- case 1: suffix1 = "gt0"; break;
- case 2: suffix1 = "eq0"; break;
- case 3: suffix1 = "ge0"; break;
- case 4: suffix1 = "lt0"; break;
- case 5: suffix1 = "ne0"; break;
- case 6: suffix1 = "le0"; break;
- case 7: suffix1 = "alw"; break;
- }
-
- switch (size)
- {
- default: suffix2 = ".?"; break;
- case 0: suffix2 = ".b"; break;
- case 1: suffix2 = ".h"; break;
- case 2: suffix2 = ".w"; break;
- }
-
- } else { /* BBO/BBZ */
-
- suffix2 = "";
- switch (cond)
- {
- default: suffix1 = "??.?"; break;
- case 29: suffix1 = "hs.w"; break;
- case 28: suffix1 = "lo.w"; break;
- case 27: suffix1 = "ls.w"; break;
- case 26: suffix1 = "hi.w"; break;
- case 25: suffix1 = "ge.w"; break;
- case 24: suffix1 = "lt.w"; break;
- case 23: suffix1 = "le.w"; break;
- case 22: suffix1 = "gt.w"; break;
- case 21: suffix1 = "ne.w"; break;
- case 20: suffix1 = "eq.w"; break;
- case 19: suffix1 = "hs.h"; break;
- case 18: suffix1 = "lo.h"; break;
- case 17: suffix1 = "ls.h"; break;
- case 16: suffix1 = "hi.h"; break;
- case 15: suffix1 = "ge.h"; break;
- case 14: suffix1 = "lt.h"; break;
- case 13: suffix1 = "le.h"; break;
- case 12: suffix1 = "gt.h"; break;
- case 11: suffix1 = "ne.h"; break;
- case 10: suffix1 = "eq.h"; break;
- case 9: suffix1 = "hs.b"; break;
- case 8: suffix1 = "lo.b"; break;
- case 7: suffix1 = "ls.b"; break;
- case 6: suffix1 = "hi.b"; break;
- case 5: suffix1 = "ge.b"; break;
- case 4: suffix1 = "lt.b"; break;
- case 3: suffix1 = "le.b"; break;
- case 2: suffix1 = "gt.b"; break;
- case 1: suffix1 = "ne.b"; break;
- case 0: suffix1 = "eq.b"; break;
- }
- }
-
- if (jump_p)
- sprintf (tic80_trace_buffer,
- "%-*s 0x%.*lx %*s 0x%.*lx/%*ld => 0x%.*lx %s%s",
- tic80_size_name, itable[indx].name,
- SIZE_HEX, target, SIZE_DECIMAL, "",
- SIZE_HEX, cond, SIZE_DECIMAL, (long)(signed32)cond,
- SIZE_HEX, target,
- suffix1, suffix2);
- else
- sprintf (tic80_trace_buffer,
- "%-*s 0x%.*lx %*s 0x%.*lx/%*ld => %-*s %s%s",
- tic80_size_name, itable[indx].name,
- SIZE_HEX, target, SIZE_DECIMAL, "",
- SIZE_HEX, cond, SIZE_DECIMAL, (long)(signed32)cond,
- SIZE_HEX + 2, "[no jump]",
- suffix1, suffix2);
-
- return tic80_trace_buffer;
-}
-
-/* Trace the result of a unconditional branch operation */
-char *
-tic80_trace_ucond_br (int indx,
- unsigned32 target)
-{
- if (!tic80_size_name)
- tic80_init_trace ();
-
- sprintf (tic80_trace_buffer,
- "%-*s 0x%.*lx %*s => 0x%.*lx",
- tic80_size_name, itable[indx].name,
- SIZE_HEX, target, (SIZE_DECIMAL*2) + SIZE_HEX + 4, "",
- SIZE_HEX, target);
-
- return tic80_trace_buffer;
-}
-
-/* Trace the result of a load or store operation with 2 integer addresses
- and an integer output or input */
-void
-tic80_trace_ldst (SIM_DESC sd,
- sim_cpu *cpu,
- sim_cia cia,
- int indx,
- int st_p,
- int m_p,
- int s_p,
- unsigned32 value,
- unsigned32 input1,
- unsigned32 input2)
-{
- char name[40];
-
- if (!tic80_size_name)
- tic80_init_trace ();
-
- strcpy (name, itable[indx].name);
- if (m_p)
- strcat (name, ":m");
-
- if (s_p)
- strcat (name, ":s");
-
- trace_one_insn (sd, cpu, cia.ip, 1,
- itable[indx].file, itable[indx].line_nr, "memory",
- "%-*s 0x%.*lx/%*ld 0x%.*lx/%*ld %s 0x%.*lx/%*ld",
- tic80_size_name, name,
- SIZE_HEX, input1, SIZE_DECIMAL, (long)(signed32)input1,
- SIZE_HEX, input2, SIZE_DECIMAL, (long)(signed32)input2,
- (!st_p) ? "=>" : "<=",
- SIZE_HEX, value, SIZE_DECIMAL, (long)(signed32)value);
-}
-
-#endif /* WITH_TRACE */
diff --git a/sim/tic80/sim-calls.c b/sim/tic80/sim-calls.c
deleted file mode 100644
index c60bd9b8d21..00000000000
--- a/sim/tic80/sim-calls.c
+++ /dev/null
@@ -1,203 +0,0 @@
-/* This file is part of the program psim.
-
- Copyright (C) 1994-1996, Andrew Cagney <cagney@highland.com.au>
- Copyright (C) 1997, Free Software Foundation
-
- 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 <stdarg.h>
-#include <ctype.h>
-
-#include "bfd.h"
-#include "sim-main.h"
-#include "sim-utils.h"
-#include "sim-options.h"
-
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-
-#ifdef HAVE_STRING_H
-#include <string.h>
-#else
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#endif
-#endif
-
-
-#define SIM_ADDR unsigned
-
-SIM_DESC
-sim_open (SIM_OPEN_KIND kind,
- host_callback *callback,
- struct _bfd *abfd,
- char **argv)
-{
- char *buf;
- SIM_DESC sd = sim_state_alloc (kind, callback);
-
- if (sim_pre_argv_init (sd, argv[0]) != SIM_RC_OK)
- return 0;
-
-#define TIC80_MEM_START 0x2000000
-#define TIC80_MEM_SIZE 0x100000
-
- /* main memory */
- asprintf (&buf, "memory region 0x%lx,0x%lx",
- TIC80_MEM_START, TIC80_MEM_SIZE);
- sim_do_command (sd, buf);
- free (buf);
- /* interrupt memory */
- sim_do_command (sd, "memory region 0x1010000,0x1000");
- /* some memory at zero */
- sim_do_command (sd, "memory region 0,0x100000");
-
- /* getopt will print the error message so we just have to exit if this fails.
- FIXME: Hmmm... in the case of gdb we need getopt to call
- print_filtered. */
- if (sim_parse_args (sd, argv) != SIM_RC_OK)
- {
- /* Uninstall the modules to avoid memory leaks,
- file descriptor leaks, etc. */
- sim_module_uninstall (sd);
- return 0;
- }
-
- /* check for/establish the a reference program image */
- if (sim_analyze_program (sd,
- (STATE_PROG_ARGV (sd) != NULL
- ? *STATE_PROG_ARGV (sd)
- : NULL),
- abfd) != SIM_RC_OK)
- {
- sim_module_uninstall (sd);
- return 0;
- }
-
- /* establish any remaining configuration options */
- if (sim_config (sd) != SIM_RC_OK)
- {
- sim_module_uninstall (sd);
- return 0;
- }
-
- if (sim_post_argv_init (sd) != SIM_RC_OK)
- {
- /* Uninstall the modules to avoid memory leaks,
- file descriptor leaks, etc. */
- sim_module_uninstall (sd);
- return 0;
- }
-
- /* FIXME: for now */
- return sd;
-}
-
-
-void
-sim_close (SIM_DESC sd, int quitting)
-{
- /* Uninstall the modules to avoid memory leaks,
- file descriptor leaks, etc. */
- sim_module_uninstall (sd);
-}
-
-
-/* FIXME - these magic numbers need to be moved elsewhere */
-
-#define SP_REGNUM 1 /* Contains address of top of stack */
-#define FP_REGNUM 31 /* Contains address of executing stack frame */
-#define PC_REGNUM 32 /* Contains program counter (FIXME?) */
-#define NPC_REGNUM 33 /* Contains the next program counter (FIXME?) */
-#define A0_REGNUM 34 /* Accumulator register 0 */
-#define A3_REGNUM 37 /* Accumulator register 1 */
-
-#define R0_REGNUM 0 /* General Purpose Register 0 - for sim */
-#define Rn_REGNUM 31 /* Last General Purpose Register - for sim */
-#define An_REGNUM A3_REGNUM /* Last Accumulator register - for sim */
-
-int
-sim_fetch_register (SIM_DESC sd, int regnr, unsigned char *buf, int length)
-{
- if (regnr == R0_REGNUM)
- memset (buf, 0, sizeof (unsigned32));
- else if (regnr > R0_REGNUM && regnr <= Rn_REGNUM)
- *(unsigned32*)buf = H2T_4 (STATE_CPU (sd, 0)->reg[regnr - R0_REGNUM]);
- else if (regnr == PC_REGNUM)
- *(unsigned32*)buf = H2T_4 (STATE_CPU (sd, 0)->cia.ip);
- else if (regnr == NPC_REGNUM)
- *(unsigned32*)buf = H2T_4 (STATE_CPU (sd, 0)->cia.dp);
- else if (regnr >= A0_REGNUM && regnr <= An_REGNUM)
- *(unsigned64*)buf = H2T_8 (STATE_CPU (sd, 0)->acc[regnr - A0_REGNUM]);
- else
- sim_io_error (sd, "sim_fetch_register - unknown register nr %d", regnr);
- return -1;
-}
-
-
-int
-sim_store_register (SIM_DESC sd, int regnr, unsigned char *buf, int length)
-{
- if (regnr >= R0_REGNUM && regnr <= Rn_REGNUM)
- STATE_CPU (sd, 0)->reg[regnr - R0_REGNUM] = T2H_4 (*(unsigned32*)buf);
- else if (regnr == PC_REGNUM)
- STATE_CPU (sd, 0)->cia.ip = T2H_4 (*(unsigned32*)buf);
- else if (regnr == NPC_REGNUM)
- STATE_CPU (sd, 0)->cia.dp = T2H_4 (*(unsigned32*)buf);
- else if (regnr >= A0_REGNUM && regnr <= An_REGNUM)
- STATE_CPU (sd, 0)->acc[regnr - A0_REGNUM] = T2H_8 (*(unsigned64*)buf);
- else
- sim_io_error (sd, "sim_store_register - unknown register nr %d", regnr);
- return -1;
-}
-
-
-SIM_RC
-sim_create_inferior (SIM_DESC sd,
- struct _bfd *abfd,
- char **argv,
- char **envp)
-{
- /* clear all registers */
- memset (&STATE_CPU (sd, 0)->reg, 0, sizeof (STATE_CPU (sd, 0)->reg));
- memset (&STATE_CPU (sd, 0)->acc, 0, sizeof (STATE_CPU (sd, 0)->acc));
- memset (&STATE_CPU (sd, 0)->cr, 0, sizeof (STATE_CPU (sd, 0)->cr));
- STATE_CPU (sd, 0)->is_user_mode = 0;
- memset (&STATE_CPU (sd, 0)->cia, 0, sizeof (STATE_CPU (sd, 0)->cia));
- /* initialize any modules */
- sim_module_init (sd);
- /* set the stack-pointer/program counter */
- if (abfd != NULL)
- STATE_CPU (sd, 0)->cia.ip = bfd_get_start_address (abfd);
- else
- STATE_CPU (sd, 0)->cia.ip = 0;
- STATE_CPU (sd, 0)->cia.dp = (STATE_CPU (sd, 0)->cia.ip
- + sizeof (instruction_word));
- STATE_CPU (sd, 0)->cr[IE_CR] |= IE_CR_IE;
- STATE_CPU (sd, 0)->reg[1] = TIC80_MEM_START + TIC80_MEM_SIZE - 16;
- return SIM_RC_OK;
-}
-
-
-void
-sim_do_command (SIM_DESC sd, char *cmd)
-{
- if (sim_args_command (sd, cmd) != SIM_RC_OK)
- sim_io_eprintf (sd, "Unknown command `%s'\n", cmd);
-}
diff --git a/sim/tic80/sim-main.h b/sim/tic80/sim-main.h
deleted file mode 100644
index 67db3535441..00000000000
--- a/sim/tic80/sim-main.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/* This file is part of the program psim.
-
- Copyright (C) 1994-1997, Andrew Cagney <cagney@highland.com.au>
- Copyright (C) 1997, Free Software Foundation
-
- 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 _SIM_MAIN_H_
-#define _SIM_MAIN_H_
-
-
-#include "sim-basics.h"
-#include "sim-signal.h"
-
-#include <signal.h> /* For kill() in insns:do_trap */
-
-#include <errno.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-/* These are generated files. */
-#include "itable.h"
-#include "idecode.h"
-#include "idecode.h"
-
-typedef instruction_address sim_cia;
-static const sim_cia null_cia = {0}; /* Dummy */
-#define NULL_CIA null_cia
-/* FIXME: Perhaps igen should generate access macros for
- `instruction_address' that we could use. */
-#define CIA_ADDR(cia) ((cia).ip)
-
-#define WITH_WATCHPOINTS 1
-
-#include "sim-base.h"
-
-#include "alu.h"
-#include "cpu.h"
-
-
-struct sim_state {
-
- /* the processors proper */
- sim_cpu cpu;
-#define STATE_CPU(sd, n) (&(sd)->cpu)
-
- /* The base class. */
- sim_state_base base;
-
-};
-
-/* (re) initialize the simulator */
-
-extern void engine_init
-(SIM_DESC sd);
-
-
-#ifndef HAVE_GETPID
-#define getpid() 42
-#endif
-
-#ifndef HAVE_KILL
-#define kill(sig, pid) (errno = EINVAL, -1)
-#endif
-#endif
diff --git a/sim/tic80/tic80.dc b/sim/tic80/tic80.dc
deleted file mode 100644
index 41998265864..00000000000
--- a/sim/tic80/tic80.dc
+++ /dev/null
@@ -1,6 +0,0 @@
-# most instructions
-switch: 21: 12: 21: 12
-switch: 11: 7: 6: 12
-#switch: 21: 13: 21: 13
-#switch: 12: 7: 6: 13
-switch: 27: 27: 27: 27
diff --git a/sim/tic80/tic80.ic b/sim/tic80/tic80.ic
deleted file mode 100644
index de81d14a92e..00000000000
--- a/sim/tic80/tic80.ic
+++ /dev/null
@@ -1,52 +0,0 @@
-cache:Dest:Dest:
-cache:Dest:rDest:signed_word *:(&(CPU)->reg[Dest])
-#
-cache:Source1:Source1:
-cache:Source1:vSource1:signed_word:(GPR (Source1) + 0)
-#cache:Source1:vSource1:signed_word:(Source1 == 0 ? 0 : (CPU)->reg[Source1])
-#
-cache:Source2:Source2:
-cache:Source2:vSource2:signed_word:(GPR (Source2) + 0)
-#cache:Source2:vSource2:signed_word:(Source2 == 0 ? 0 : (CPU)->reg[Source2])
-#
-cache:Source:Source:
-cache:Source:vSource:signed_word:(GPR (Source) + 0)
-#cache:Source:vSource:signed_word:(Source == 0 ? 0 : (CPU)->reg[Source])
-#
-cache:IndOff:IndOff:
-cache:IndOff:rIndOff:signed_word:(GPR (IndOff) + 0)
-#cache:IndOff:rIndOff:signed_word:(IndOff == 0 ? 0 : (CPU)->reg[IndOff])
-#
-cache:Base:Base:
-cache:Base:vBase:signed_word:(GPR (Base) + 0)
-cache:Base:rBase:signed_word*:(&GPR (Base))
-#cache:Base:vBase:signed_word:(Base == 0 ? 0 : (CPU)->reg[Base])
-#
-cache:Link:Link:
-cache:Link:rLink:signed_word*:(&(CPU)->reg[Link])
-#
-# Trap Number
-cache:UTN:UTN:
-cache:INDTR:INDTR:
-cache:INDTR:UTN:unsigned_word:(INDTR == 0 ? 0 : (CPU)->reg[INDTR])
-#
-cache:A:A:
-#
-cache:SignedImmediate:SignedImmediate:
-cache:SignedImmediate:vSource1:signed_word:SEXT (SignedImmediate, 14)
-#
-cache:UnsignedImmediate:UnsignedImmediate:
-cache:UnsignedImmediate:vSource1:signed_word:UnsignedImmediate
-#
-cache:BITNUM:BITNUM:
-cache:Code:Code:
-cache:BITNUM:bitnum:int:(~BITNUM) & 0x1f
-
-#
-cache:SignedOffset:SignedOffset:
-cache:SignedOffset:vSignedOffset:signed_word:SEXT (SignedOffset, 14)
-#
-cache:UCRN:UCRN:
-cache:INDCR:INDCR:
-cache:INDCR:UCRN:unsigned32:(GPR (INDCR) + 0)
-#cache:INDCR:UCRN:unsigned32:(INDCR == 0 ? 0 : (CPU)->reg[INDCR])
diff --git a/sim/tic80/tic80.igen b/sim/tic80/tic80.igen
deleted file mode 100644
index 1595693f524..00000000000
--- a/sim/tic80/tic80.igen
+++ /dev/null
@@ -1,1615 +0,0 @@
-// Texas Instruments TMS320C80 (MVP) Simulator.
-
-
-// The following is called when ever an illegal instruction is encountered.
-:internal::::illegal:
-{
- sim_io_eprintf (SD, "0x%lx: illegal instruction\n", (unsigned long) cia.ip);
- sim_engine_halt (SD, CPU, NULL, cia, sim_signalled, SIM_SIGILL);
-}
-
-// The following is called when ever an FP op is attempted with FPU disabled.
-:internal::::fp_unavailable:
-{
- sim_io_eprintf (SD, "0x%lx: floating-point unavailable\n", (unsigned long) cia.ip);
- sim_engine_halt (SD, CPU, NULL, cia, sim_signalled, SIM_SIGFPE);
-}
-
-// Handle a branch instruction
-:function:::instruction_address:do_branch:int annul, address_word target, int rLink_p, unsigned32 *rLink
-{
- instruction_address nia;
- if (annul)
- {
- if (rLink_p)
- *rLink = cia.dp;
- nia.ip = target;
- nia.dp = target + 4;
- }
- else
- {
- if (rLink_p)
- *rLink = cia.dp + sizeof (instruction_word);
- nia.ip = cia.dp;
- nia.dp = target;
- }
- return nia;
-}
-
-// Signed Integer Add - add source1, source2, dest
-:function:::void:do_add:unsigned32 *rDest, signed32 source1, signed32 source2
-{
- unsigned32 result;
- ALU_BEGIN (source1);
- ALU_ADD (source2);
- ALU_END (result);
- *rDest = result;
- TRACE_ALU3 (MY_INDEX, result, source1, source2);
- /* FIXME - a signed add may cause an exception */
-}
-31.Dest,26.Source2,21.0b101100,15.0,14.SignedImmediate::::add i
-"add <SignedImmediate>, r<Source2>, r<Dest>"
-{
- do_add (_SD, rDest, vSource1, vSource2);
-}
-31.Dest,26.Source2,21.0b11101100,13.0,12.0,11./,4.Source1::::add r
-"add r<Source1>, r<Source2>, r<Dest>"
-{
- do_add (_SD, rDest, vSource1, vSource2);
-}
-31.Dest,26.Source2,21.0b11101100,13.0,12.1,11./+LongSignedImmediate::::add l
-"add 0x%08lx<LongSignedImmediate>, r<Source2>, r<Dest>"
-{
- do_add (_SD, rDest, LongSignedImmediate, vSource2);
-}
-
-
-// Unsigned Integer Add - addu source1, source2, dest
-:function:::void:do_addu:unsigned32 *rDest, unsigned32 source1, unsigned32 source2
-{
- unsigned32 result = source1 + source2;
- TRACE_ALU3 (MY_INDEX, result, source1, source2);
- *rDest = result;
-}
-
-31.Dest,26.Source2,21.0b101100,15.1,14.SignedImmediate::::addu i
-"addu <SignedImmediate>, r<Source2>, r<Dest>"
-{
- do_addu (_SD, rDest, vSource1, vSource2);
-}
-31.Dest,26.Source2,21.0b11101100,13.1,12.0,11./,4.Source1::::addu r
-"addu r<Source1>, r<Source2>, r<Dest>"
-{
- do_addu (_SD, rDest, vSource1, vSource2);
-}
-31.Dest,26.Source2,21.0b11101100,13.1,12.1,11./+LongSignedImmediate::::addu l
-"addu 0x%08lx<LongSignedImmediate>, r<Source2>, r<Dest>"
-{
- do_addu (_SD, rDest, LongSignedImmediate, vSource2);
-}
-
-
-:function:::void:do_and:signed32 *rDest, signed32 source1, signed32 source2
-{
- unsigned32 result = source1 & source2;
- TRACE_ALU3 (MY_INDEX, result, source1, source2);
- *rDest = result;
-}
-
-
-// and, and.tt
-31.Dest,26.Source2,21.0b0010001,14.UnsignedImmediate::::and.tt i
-"and.tt <UnsignedImmediate>, r<Source2>, r<Dest>"
-{
- do_and (_SD, rDest, vSource1, vSource2);
-}
-31.Dest,26.Source2,21.0b110010001,12.0,11./,4.Source1::::and.tt r
-"and.tt r<Source1>, r<Source2>, r<Dest>"
-{
- do_and (_SD, rDest, vSource1, vSource2);
-}
-31.Dest,26.Source2,21.0b110010001,12.1,11./+LongSignedImmediate::::and.tt l
-"and.tt 0x%08lx<LongSignedImmediate>, r<Source2>, r<Dest>"
-{
- do_and (_SD, rDest, LongSignedImmediate, vSource2);
-
-}
-
-// and.ff
-31.Dest,26.Source2,21.0b0011000,14.UnsignedImmediate::::and.ff i
-"and.ff <UnsignedImmediate>, r<Source2>, r<Dest>"
-{
- do_and (_SD, rDest, ~vSource1, ~vSource2);
-}
-31.Dest,26.Source2,21.0b110011000,12.0,11./,4.Source1::::and.ff r
-"and.ff r<Source1>, r<Source2>, r<Dest>"
-{
- do_and (_SD, rDest, ~vSource1, ~vSource2);
-}
-31.Dest,26.Source2,21.0b110011000,12.1,11./+LongSignedImmediate::::and.ff l
-"and.ff 0x%08lx<LongSignedImmediate>, r<Source2>, r<Dest>"
-{
- do_and (_SD, rDest, ~LongSignedImmediate, ~vSource2);
-}
-
-// and.ft
-31.Dest,26.Source2,21.0b0010100,14.UnsignedImmediate::::and.ft i
-"and.ft <UnsignedImmediate>, r<Source2>, r<Dest>"
-{
- do_and (_SD, rDest, ~vSource1, vSource2);
-}
-31.Dest,26.Source2,21.0b110010100,12.0,11./,4.Source1::::and.ft r
-"and.ft r<Source1>, r<Source2>, r<Dest>"
-{
- do_and (_SD, rDest, ~vSource1, vSource2);
-}
-31.Dest,26.Source2,21.0b110010100,12.1,11./+LongSignedImmediate::::and.ft l
-"and.ft 0x%08lx<LongSignedImmediate>, r<Source2>, r<Dest>"
-{
- do_and (_SD, rDest, ~LongSignedImmediate, vSource2);
-}
-
-// and.tf
-31.Dest,26.Source2,21.0b0010010,14.UnsignedImmediate::::and.tf i
-"and.tf <UnsignedImmediate>, r<Source2>, r<Dest>"
-{
- do_and (_SD, rDest, vSource1, ~vSource2);
-}
-31.Dest,26.Source2,21.0b110010010,12.0,11./,4.Source1::::and.tf r
-"and.tf r<Source1>, r<Source2>, r<Dest>"
-{
- do_and (_SD, rDest, vSource1, ~vSource2);
-}
-31.Dest,26.Source2,21.0b110010010,12.1,11./+LongSignedImmediate::::and.tf l
-"and.tf 0x%08lx<LongSignedImmediate>, r<Source2>, r<Dest>"
-{
- do_and (_SD, rDest, LongSignedImmediate, ~vSource2);
-}
-
-// bbo[.a]
-:function:::instruction_address:do_bbo:instruction_address nia, int bitnum, unsigned32 source, int annul, unsigned32 offset
-{
- int jump_p;
- address_word target = cia.ip + 4 * offset;
- if (MASKED32 (source, bitnum, bitnum))
- {
- nia = do_branch (_SD, annul, target, 0, NULL);
- jump_p = 1;
- }
- else
- jump_p = 0;
- TRACE_COND_BR(MY_INDEX, jump_p, bitnum, target, -1, -1);
- return nia;
-}
-:%s::::A:int A
-{
- if (A)
- return ".a";
- else
- return "";
-}
-31.BITNUM,26.Source,21.0b100101,15.A,14.SignedOffset::::bbo i
-"bbo%s<A> <SignedOffset>, r<Source>, <bitnum>"
-{
- nia = do_bbo (_SD, nia, bitnum, vSource, A, vSignedOffset);
-}
-31.BITNUM,26.Source,21.0b11100101,13.A,12.0,11./,4.IndOff::::bbo r
-"bbo%s<A> r<IndOff>, r<Source>, <bitnum>"
-{
- nia = do_bbo (_SD, nia, bitnum, vSource, A, rIndOff);
-}
-31.BITNUM,26.Source,21.0b11100101,13.A,12.1,11./+LongSignedImmediate::::bbo l
-"bbo%s<A> <LongSignedImmediate>, r<Source>, <bitnum>"
-{
- nia = do_bbo (_SD, nia, bitnum, vSource, A, LongSignedImmediate);
-}
-
-// bbz[.a]
-:function:::instruction_address:do_bbz:instruction_address nia, int bitnum, unsigned32 source, int annul, unsigned32 offset
-{
- int jump_p;
- address_word target = cia.ip + 4 * offset;
- if (!MASKED32 (source, bitnum, bitnum))
- {
- nia = do_branch (_SD, annul, target, 0, NULL);
- jump_p = 1;
- }
- else
- jump_p = 0;
- TRACE_COND_BR(MY_INDEX, jump_p, bitnum, target, -1, -1);
- return nia;
-}
-31.BITNUM,26.Source,21.0b100100,15.A,14.SignedOffset::::bbz i
-"bbz%s<A> <SignedOffset>, r<Source>, <bitnum>"
-{
- nia = do_bbz (_SD, nia, bitnum, vSource, A, vSignedOffset);
-}
-31.BITNUM,26.Source,21.0b11100100,13.A,12.0,11./,4.IndOff::::bbz r
-"bbz%s<A> r<IndOff>, r<Source>, <bitnum>"
-{
- nia = do_bbz (_SD, nia, bitnum, vSource, A, rIndOff);
-}
-31.BITNUM,26.Source,21.0b11100100,13.A,12.1,11./+LongSignedImmediate::::bbz l
-"bbz%s<A> <LongSignedImmediate>, r<Source>, <bitnum>"
-{
- nia = do_bbz (_SD, nia, bitnum, vSource, A, LongSignedImmediate);
-}
-
-// bcnd[.a]
-:function:::instruction_address:do_bcnd:instruction_address nia, int Cond, unsigned32 source, int annul, unsigned32 offset
-{
- int condition;
- int size = EXTRACTED32 (Cond, 31 - 27, 30 - 27);
- int code = EXTRACTED32 (Cond, 29 - 27, 27 - 27);
- signed32 val = 0;
- address_word target = cia.ip + 4 * offset;
- switch (size)
- {
- case 0: val = SEXT32 (source, 7); break;
- case 1: val = SEXT32 (source, 15); break;
- case 2: val = source; break;
- default: sim_engine_abort (SD, CPU, cia, "bcnd - reserved size");
- }
- switch (code)
- {
- case 0: condition = 0; break;
- case 1: condition = val > 0; break;
- case 2: condition = val == 0; break;
- case 3: condition = val >= 0; break;
- case 4: condition = val < 0; break;
- case 5: condition = val != 0; break;
- case 6: condition = val <= 0; break;
- default: condition = 1; break;
- }
- if (condition)
- {
- nia = do_branch (_SD, annul, target, 0, NULL);
- }
- TRACE_COND_BR(MY_INDEX, condition, val, target, size, code);
- return nia;
-}
-31.Code,26.Source,21.0b100110,15.A,14.SignedOffset::::bcnd i
-"bcnd%s<A> <SignedOffset>, r<Source>, <Code>"
-{
- nia = do_bcnd (_SD, nia, Code, vSource, A, vSignedOffset);
-}
-31.Code,26.Source,21.0b11100110,13.A,12.0,11./,4.IndOff::::bcnd r
-"bcnd%s<A> r<IndOff>, r<Source>, <Code>"
-{
- nia = do_bcnd (_SD, nia, Code, vSource, A, rIndOff);
-}
-31.Code,26.Source,21.0b11100110,13.A,12.1,11./+LongSignedImmediate::::bcnd l
-"bcnd%s<A> <LongSignedImmediate>, r<Source>, <Code>"
-{
- nia = do_bcnd (_SD, nia, Code, vSource, A, LongSignedImmediate);
-}
-
-// br[.a] - see bbz[.a]
-
-
-// brcr
-:function:::sim_cia:do_brcr:instruction_address nia, int cr
-{
- if (cr >= 0x4000 || !(CPU)->is_user_mode)
- {
- unsigned32 control = CR (cr);
- unsigned32 ie = control & 0x00000001;
- unsigned32 pc = control & 0xfffffffc;
- unsigned32 is_user_mode = control & 0x00000002;
- (CPU)->is_user_mode = is_user_mode;
- nia.dp = pc;
- if (ie)
- (CPU)->cr[IE_CR] |= IE_CR_IE;
- else
- (CPU)->cr[IE_CR] &= ~IE_CR_IE;
- }
- TRACE_UCOND_BR (MY_INDEX, nia.dp);
- return nia;
-}
-31.//,27.0,26.//,21.0b0000110,14.UCRN::::brcr i
-"brcr CR[<UCRN>]"
-{
- nia = do_brcr (_SD, nia, UCRN);
-}
-31.//,27.0,26.//,21.0b110000110,12.0,11./,4.INDCR::::brcr r
-"brcr CR[r<INDCR>]"
-{
- nia = do_brcr (_SD, nia, UCRN);
-}
-31.//,27.0,26.//,21.0b110000110,12.1,11./+UnsignedControlRegisterNumber::::brcr l
-"brcr CR[<UnsignedControlRegisterNumber>]"
-{
- nia = do_brcr (_SD, nia, UnsignedControlRegisterNumber);
-}
-
-// bsr[.a]
-:function:::instruction_address:do_bsr:instruction_address nia, signed32 *rLink, int annul, unsigned32 offset
-{
- address_word target = cia.ip + 4 * offset;
- nia = do_branch (_SD, annul, target, 1, rLink);
- TRACE_UCOND_BR (MY_INDEX, target);
- return nia;
-}
-31.Link,26./,21.0b100000,15.A,14.SignedOffset::::bsr i
-"bsr%s<A> <SignedOffset>, r<Link>"
-{
- nia = do_bsr (_SD, nia, rLink, A, vSignedOffset);
-}
-31.Link,26./,21.0b11100000,13.A,12.0,11./,4.IndOff::::bsr r
-"bsr%s<A> r<IndOff>, r<Link>"
-{
- nia = do_bsr (_SD, nia, rLink, A, rIndOff);
-}
-31.Link,26./,21.0b11100000,13.A,12.1,11./+LongSignedImmediate::::bsr l
-"bsr%s<A> <LongSignedImmediate>, r<Link>"
-{
- nia = do_bsr (_SD, nia, rLink, A, LongSignedImmediate);
-}
-
-// cmnd
-:function:::void:do_cmnd:signed32 source
-{
- int Reset = EXTRACTED32 (source, 31, 31);
- int Halt = EXTRACTED32 (source, 30, 30);
- int Unhalt = EXTRACTED32 (source, 29, 29);
- /* int ICR = EXTRACTED32 (source, 28, 28); */
- /* int DCR = EXTRACTED32 (source, 27, 27); */
- int Task = EXTRACTED32 (source, 14, 14);
- int Msg = EXTRACTED32 (source, 13, 13);
- int VC = EXTRACTED32 (source, 10, 10);
- int TC = EXTRACTED32 (source, 9, 9);
- int MP = EXTRACTED32 (source, 8, 8);
- int PP = EXTRACTED32 (source, 3, 0);
- /* what is implemented? */
- if (PP != 0)
- sim_engine_abort (SD, CPU, cia, "0x%lx: cmnd - PPs not supported",
- (unsigned long) cia.ip);
- if (VC != 0)
- sim_engine_abort (SD, CPU, cia, "0x%lx: cmnd - VC not supported",
- (unsigned long) cia.ip);
- if (TC != 0)
- sim_engine_abort (SD, CPU, cia, "0x%lx: cmnd - TC not supported",
- (unsigned long) cia.ip);
- if (MP)
- {
- if (Reset || Halt)
- sim_engine_halt (SD, CPU, NULL, cia, sim_exited, 0);
- if (Unhalt)
- sim_engine_abort (SD, CPU, cia, "0x%lx: cmnd - Can not unhalt the MP",
- (unsigned long) cia.ip);
- /* if (ICR || DCR); */
- if (Task)
- sim_engine_abort (SD, CPU, cia, "0x%lx: cmnd - Can not Task the MP",
- (unsigned long) cia.ip);
- if (Msg)
- sim_engine_abort (SD, CPU, cia, "0x%lx: cmnd - Msg to MP not suported",
- (unsigned long) cia.ip);
- }
- TRACE_SINK1 (MY_INDEX, source);
-}
-31./,21.0b0000010,14.UI::::cmnd i
-"cmnd <UI>"
-{
- do_cmnd (_SD, UI);
-}
-31./,21.0b110000010,12.0,11./,4.Source::::cmnd r
-"cmnd r<Source>"
-{
- do_cmnd (_SD, vSource);
-}
-31./,21.0b110000010,12.1,11./+LongUnsignedImmediate::::cmnd l
-"cmnd <LongUnsignedImmediate>"
-{
- do_cmnd (_SD, LongUnsignedImmediate);
-}
-
-// cmp
-:function:::unsigned32:cmp_vals:signed32 s1, unsigned32 u1, signed32 s2, unsigned32 u2
-{
- unsigned32 field = 0;
- if (s1 == s2) field |= 0x001;
- if (s1 != s2) field |= 0x002;
- if (s1 > s2) field |= 0x004;
- if (s1 <= s2) field |= 0x008;
- if (s1 < s2) field |= 0x010;
- if (s1 >= s2) field |= 0x020;
- if (u1 > u2) field |= 0x040;
- if (u1 <= u2) field |= 0x080;
- if (u1 < u2) field |= 0x100;
- if (u1 >= u2) field |= 0x200;
- return field;
-}
-:function:::void:do_cmp:unsigned32 *rDest, unsigned32 source1, unsigned32 source2
-{
- unsigned32 field = 0;
- field |= cmp_vals (_SD, source1, source1, source2, source2) << 20;
- field |= cmp_vals (_SD, (signed16)source1, (unsigned16)source1,
- (signed16)source2, (unsigned16)source2) << 10;
- field |= cmp_vals (_SD, (signed8)source1, (unsigned8)source1,
- (signed8)source2, (unsigned8)source2);
- TRACE_CMP (MY_INDEX, field, source1, source2);
- *rDest = field;
-}
-31.Dest,26.Source2,21.0b1010000,14.SignedImmediate::::cmp i
-"cmp <SignedImmediate>, r<Source2>, r<Dest>"
-{
- do_cmp (_SD, rDest, vSource1, vSource2);
-}
-31.Dest,26.Source2,21.0b111010000,12.0,11./,4.Source1::::cmp r
-"cmp r<Source1>, r<Source2>, r<Dest>"
-{
- do_cmp (_SD, rDest, vSource1, vSource2);
-}
-31.Dest,26.Source2,21.0b111010000,12.1,11./+LongSignedImmediate::::cmp l
-"cmp 0x%08lx<LongSignedImmediate>, r<Source2>, r<Dest>"
-{
- do_cmp (_SD, rDest, LongSignedImmediate, vSource2);
-}
-
-// dcache
-:%s::::F:int F
-{
- if (F)
- return "f";
- else
- return "c";
-}
-31./,27.F,26.Source2,21.0b0111,17.m,16.0b00,14.SignedOffset::::dcache i
-"dcache%s<F> <SignedOffset> (r<Source2>%s<m>)"
-{
- TRACE_NOP (MY_INDEX);
- /* NOP */
-}
-31./,27.F,26.Source2,21.0b110111,15.m,14.0b00,12.0,11./,4.Source1::::dcache r
-"dcache%s<F> r<Source1> (r<Source2>%s<m>)"
-{
- TRACE_NOP (MY_INDEX);
- /* NOP */
-}
-31./,27.F,26.Source2,21.0b110111,15.m,14.0b00,12.1,11./+LongSignedImmediate::::dcache l
-"dcache%s<F> <LongSignedImmediate> (r<Source2>%s<m>)"
-{
- TRACE_NOP (MY_INDEX);
- /* NOP */
-}
-
-// dld[{.b|.h|.d}]
-void::function::do_dld:int Dest, unsigned32 base, unsigned32 *rBase, int m , int sz, int S, unsigned32 offset
-{
- do_ld (_SD, Dest, base, rBase, m, sz, S, offset);
-}
-31.Dest,26.Base,21.0b110100,15.m,14.sz,12.0,11.S,10.1,9./,4.IndOff::::dld r
-"dld%s<sz> r<IndOff>%s<S> (r<Base>%s<m>), r<Dest>"
-{
- do_dld (_SD, Dest, vBase, rBase, m, sz, S, rIndOff);
-}
-31.Dest,26.Base,21.0b110100,15.m,14.sz,12.1,11.S,10.1,9./+LongSignedImmediateOffset::::dld l
-"dld%s<sz> 0x%08lx<LongSignedImmediateOffset>%s<S> (r<Base>%s<m>), r<Dest>"
-{
- do_dld (_SD, Dest, vBase, rBase, m, sz, S, LongSignedImmediateOffset);
-}
-
-// dld.u[{.b|.h|.d}]
-void::function::do_dld_u:unsigned32 *rDest, unsigned32 base, unsigned32 *rBase, int m , int sz, int S, unsigned32 offset
-{
- do_ld_u (_SD, rDest, base, rBase, m, sz, S, offset);
-}
-31.Dest,26.Base,21.0b110101,15.m,14.sz,12.0,11.S,10.1,9./,4.IndOff::::dld.u r
-"dld.u%s<sz> r<IndOff>%s<S> (r<Base>%s<m>), r<Dest>"
-{
- do_dld_u (_SD, rDest, vBase, rBase, m, sz, S, rIndOff);
-}
-31.Dest,26.Base,21.0b110101,15.m,14.sz,12.1,11.S,10.1,9./+LongSignedImmediateOffset::::dld.u l
-"dld.u%s<sz> 0x%08lx<LongSignedImmediateOffset>%s<S> (r<Base>%s<m>), r<Dest>"
-{
- do_dld_u (_SD, rDest, vBase, rBase, m, sz, S, LongSignedImmediateOffset);
-}
-
-// dst[{.b|.h|.d}]
-void::function::do_dst:int Source, unsigned32 base, unsigned32 *rBase, int m , int sz, int S, unsigned32 offset
-{
- do_st (_SD, Source, base, rBase, m, sz, S, offset);
-}
-31.Source,26.Base,21.0b110110,15.m,14.sz,12.0,11.S,10.1,9./,4.IndOff::::dst r
-"dst%s<sz> r<IndOff>%s<S> (r<Base>%s<m>), r<Source>"
-{
- do_dst (_SD, Source, vBase, rBase, m, sz, S, rIndOff);
-}
-31.Source,26.Base,21.0b110110,15.m,14.sz,12.1,11.S,10.1,9./+LongSignedImmediateOffset::::dst l
-"dst%s<sz> 0x%08lx<LongSignedImmediateOffset>%s<S> (r<Base>%s<m>), r<Source>"
-{
- do_dst (_SD, Source, vBase, rBase, m, sz, S, LongSignedImmediateOffset);
-}
-
-// estop
-31./,21.0b1111111,14.1,13.0,12.0,11./::::estop
-
-// etrap
-31./,27.1,26./,21.0b0000001,14.UTN::::etrap i
-31./,27.1,26./,21.0b110000001,12.0,11./,4.iUTN::::etrap r
-31./,27.1,26./,21.0b110000001,12.1,11./::::etrap l
-
-
-// exts - see shift.ds
-
-
-// extu - see shift.dz
-
-
-sim_fpu::function::get_fp_reg:int reg, unsigned32 val, int precision
-{
- sim_fpu ans;
- switch (precision)
- {
- case 0: /* single */
- sim_fpu_32to (&ans, val);
- break;
- case 1: /* double */
- if (reg < 0)
- sim_engine_abort (SD, CPU, cia, "DP immediate invalid");
- if (reg & 1)
- sim_engine_abort (SD, CPU, cia, "DP FP register must be even");
- if (reg <= 1)
- sim_engine_abort (SD, CPU, cia, "DP FP register must be >= 2");
- sim_fpu_232to (&ans, GPR (reg + 1), GPR (reg));
- break;
- case 2: /* 32 bit signed integer */
- sim_fpu_i32to (&ans, val, 0);
- break;
- case 3: /* 32 bit unsigned integer */
- sim_fpu_u32to (&ans, val, 0);
- break;
- default:
- sim_engine_abort (SD, CPU, cia, "Unsupported FP precision");
- }
- return ans;
-}
-void::function::set_fp_reg:int Dest, sim_fpu val, int PD
-{
- switch (PD)
- {
- case 0: /* single */
- {
- sim_fpu_to32 (&GPR (Dest), &val);
- break;
- }
- case 1: /* double */
- {
- if (Dest & 1)
- sim_engine_abort (SD, CPU, cia, "DP FP Dest register must be even");
- if (Dest <= 1)
- sim_engine_abort (SD, CPU, cia, "DP FP Dest register must be >= 2");
- sim_fpu_to232 (&GPR (Dest + 1), &GPR (Dest + 0), &val);
- break;
- }
- case 2: /* signed */
- {
- sim_fpu_to32i (&GPR (Dest), &val, 0);
- break;
- }
- case 3: /* unsigned */
- {
- sim_fpu_to32u (&GPR (Dest), &val, 0);
- break;
- }
- default:
- sim_engine_abort (SD, CPU, cia, "Unsupported FP precision");
- }
-
-}
-// fadd.{s|d}{s|d}{s|d}
-void::function::do_fadd:int Dest, int PD, sim_fpu s1, sim_fpu s2
-{
- sim_fpu ans;
- sim_fpu_add (&ans, &s1, &s2);
- TRACE_FPU3 (ans, s1, s2);
- set_fp_reg (_SD, Dest, ans, PD);
-}
-const char *::function::str_PX:int PX
-{
- switch (PX)
- {
- case 0: return "s";
- case 1: return "d";
- case 2: return "i";
- case 3: return "u";
- default: return "?";
- }
-}
-31.Dest,26.Source2,21.0b111110000,12.0,11.r,10.PD,8.P2,6.P1,4.Source1::f::fadd r
-"fadd.%s<PX#P1>%s<PX#P2>%s<PX#PD> r<Source1>, r<Source2>, r<Dest>"
-{
- do_fadd (_SD, Dest, PD,
- get_fp_reg (_SD, Source1, vSource1, P1),
- get_fp_reg (_SD, Source2, vSource2, P2));
-}
-31.Dest,26.Source2,21.0b111110000,12.1,11.r,10.PD,8.P2,6.P1,4./+SinglePrecisionFloatingPoint::f::fadd l
-"fadd.%s<PX#P1>%s<PX#P2>%s<PX#PD> 0x%08lx<SinglePrecisionFloatingPoint>, r<Source2>, r<Dest>"
-{
- do_fadd (_SD, Dest, PD,
- get_fp_reg (_SD, -1, SinglePrecisionFloatingPoint, P1),
- get_fp_reg (_SD, Source2, vSource2, P2));
-
-}
-
-// fcmp.{s|d}{s|d}{s|d}
-void::function::do_fcmp:unsigned32 *rDest, sim_fpu s1, sim_fpu s2
-{
- unsigned32 result = 0;
- if (sim_fpu_is_nan (&s1) || sim_fpu_is_nan (&s2))
- result |= BIT32 (30);
- else
- {
- result |= BIT32 (31);
- if (sim_fpu_is_eq (&s1, &s2)) result |= BIT32(20);
- if (sim_fpu_is_ne (&s1, &s2)) result |= BIT32(21);
- if (sim_fpu_is_gt (&s1, &s2)) result |= BIT32(22);
- if (sim_fpu_is_le (&s1, &s2)) result |= BIT32(23);
- if (sim_fpu_is_lt (&s1, &s2)) result |= BIT32(24);
- if (sim_fpu_is_ge (&s1, &s2)) result |= BIT32(25);
- if (sim_fpu_is_lt (&s1, &sim_fpu_zero)
- || sim_fpu_is_gt (&s1, &s2)) result |= BIT32(26);
- if (sim_fpu_is_lt (&sim_fpu_zero, &s1)
- && sim_fpu_is_lt (&s1, &s2)) result |= BIT32(27);
- if (sim_fpu_is_le (&sim_fpu_zero, &s1)
- && sim_fpu_is_le (&s1, &s2)) result |= BIT32(28);
- if (sim_fpu_is_le (&s1, &sim_fpu_zero)
- || sim_fpu_is_ge (&s1, &s2)) result |= BIT32(29);
- }
- *rDest = result;
- TRACE_FPU2CMP (result, s1, s2);
-}
-31.Dest,26.Source2,21.0b111110101,12.0,11./,10.0,8.P2,6.P1,4.Source1::f::fcmp r
-"fcmp.%s<PX#P1>%s<PX#P2> r<Source1>, r<Source2>, r<Dest>"
-{
- do_fcmp (_SD, rDest,
- get_fp_reg (_SD, Source1, vSource1, P1),
- get_fp_reg (_SD, Source2, vSource2, P2));
-}
-31.Dest,26.Source2,21.0b111110101,12.1,11./,10.0,8.P2,6.P1,4./+SinglePrecisionFloatingPoint::f::fcmp l
-"fcmp.%s<PX#P1>%s<PX#P2> 0x%08lx<SinglePrecisionFloatingPoint>, r<Source2>, r<Dest>"
-{
- do_fcmp (_SD, rDest,
- get_fp_reg (_SD, -1, SinglePrecisionFloatingPoint, P1),
- get_fp_reg (_SD, Source2, vSource2, P2));
-}
-
-
-// fdiv.{s|d}{s|d}{s|d}
-void::function::do_fdiv:int Dest, int PD, sim_fpu s1, sim_fpu s2
-{
- sim_fpu ans;
- sim_fpu_div (&ans, &s1, &s2);
- TRACE_FPU3 (ans, s1, s2);
- set_fp_reg (_SD, Dest, ans, PD);
-}
-31.Dest,26.Source2,21.0b111110011,12.0,11./,10.PD,8.P2,6.P1,4.Source1::f::fdiv r
-"fdiv.%s<PX#P1>%s<PX#P2>%s<PX#PD> r<Source1>, r<Source2>, r<Dest>"
-{
- do_fdiv (_SD, Dest, PD,
- get_fp_reg (_SD, Source1, vSource1, P1),
- get_fp_reg (_SD, Source2, vSource2, P2));
-}
-31.Dest,26.Source2,21.0b111110011,12.1,11./,10.PD,8.P2,6.P1,4./+SinglePrecisionFloatingPoint::f::fdiv l
-"fdiv.%s<PX#P1>%s<PX#P2>%s<PX#PD> 0x%08lx<SinglePrecisionFloatingPoint>, r<Source2>, r<Dest>"
-{
- do_fdiv (_SD, Dest, PD,
- get_fp_reg (_SD, -1, SinglePrecisionFloatingPoint, P1),
- get_fp_reg (_SD, Source2, vSource2, P2));
-}
-
-// fmpy.{s|d|i|u}{s|d|i|u}{s|d|i|u}
-void::function::do_fmpy:int Dest, int PD, sim_fpu s1, sim_fpu s2
-{
- switch (PD)
- {
- case 2: /* signed */
- {
- signed64 i1;
- signed64 i2;
- sim_fpu_to64i (&i1, &s1, 0);
- sim_fpu_to64i (&i2, &s2, 0);
- GPR (Dest) = i1 * i2;
- TRACE_FPU2I (GPR (Dest), s1, s2);
- break;
- }
- case 3: /* unsigned */
- {
- unsigned64 u1;
- unsigned64 u2;
- sim_fpu_to64u (&u1, &s1, 0);
- sim_fpu_to64u (&u2, &s2, 0);
- GPR (Dest) = u1 * u2;
- TRACE_FPU2I (GPR (Dest), s1, s2);
- break;
- }
- default:
- {
- sim_fpu ans;
- sim_fpu_mul (&ans, &s1, &s2);
- set_fp_reg (_SD, Dest, ans, PD);
- TRACE_FPU3 (ans, s1, s2);
- }
- }
-}
-31.Dest,26.Source2,21.0b111110010,12.0,11./,10.PD,8.P2,6.P1,4.Source1::f::fmpy r
-"fmpy.%s<PX#P1>%s<PX#P2>%s<PX#PD> r<Source1>, r<Source2>, r<Dest>"
-{
- do_fmpy (_SD, Dest, PD,
- get_fp_reg (_SD, Source1, vSource1, P1),
- get_fp_reg (_SD, Source2, vSource2, P2));
-}
-31.Dest,26.Source2,21.0b111110010,12.1,11./,10.PD,8.P2,6.P1,4./+SinglePrecisionFloatingPoint::f::fmpy l
-"fmpy.%s<PX#P1>%s<PX#P2>%s<PX#PD> 0x%08lx<SinglePrecisionFloatingPoint>, r<Source2>, r<Dest>"
-{
- do_fmpy (_SD, Dest, PD,
- get_fp_reg (_SD, -1, SinglePrecisionFloatingPoint, P1),
- get_fp_reg (_SD, Source2, vSource2, P2));
-}
-
-// frndm.{s|d|i|u}{s|d|i|u}
-void::function::do_frnd:int Dest, int PD, sim_fpu s1
-{
- set_fp_reg (_SD, Dest, s1, PD);
- TRACE_FPU1 (s1);
-}
-31.Dest,26./,21.0b111110100,12.0,11.r,10.PD,8.0b11,6.P1,4.Source::f::frndm r
-"frndm.%s<PX#P1>%s<PX#PD> r<Source>, r<Dest>"
-{
- do_frnd (_SD, Dest, PD,
- get_fp_reg (_SD, Source, vSource, P1));
-}
-31.Dest,26./,21.0b111110100,12.1,11.r,10.PD,8.0b11,6.P1,4./+SinglePrecisionFloatingPoint::f::frndm l
-"frndm.%s<PX#P1>%s<PX#PD> 0x%08lx<SinglePrecisionFloatingPoint>, r<Dest>"
-{
- do_frnd (_SD, Dest, PD,
- get_fp_reg (_SD, -1, SinglePrecisionFloatingPoint, P1));
-}
-
-// frndn.{s|d|i|u}{s|d|i|u}
-31.Dest,26./,21.0b111110100,12.0,11.r,10.PD,8.0b00,6.P1,4.Source::f::frndn r
-"frndn.%s<PX#P1>%s<PX#PD> r<Source>, r<Dest>"
-{
- do_frnd (_SD, Dest, PD,
- get_fp_reg (_SD, Source, vSource, P1));
-}
-31.Dest,26./,21.0b111110100,12.1,11.r,10.PD,8.0b00,6.P1,4./+SinglePrecisionFloatingPoint::f::frndn l
-"frndn.%s<PX#P1>%s<PX#PD> 0x%08lx<SinglePrecisionFloatingPoint>, r<Dest>"
-{
- do_frnd (_SD, Dest, PD,
- get_fp_reg (_SD, -1, SinglePrecisionFloatingPoint, P1));
-}
-
-// frndp.{s|d|i|u}{s|d|i|u}
-31.Dest,26./,21.0b111110100,12.0,11.r,10.PD,8.0b10,6.P1,4.Source::f::frndp r
-"frndp.%s<PX#P1>%s<PX#PD> r<Source>, r<Dest>"
-{
- do_frnd (_SD, Dest, PD,
- get_fp_reg (_SD, Source, vSource, P1));
-}
-31.Dest,26./,21.0b111110100,12.1,11.r,10.PD,8.0b10,6.P1,4./+SinglePrecisionFloatingPoint::f::frndp l
-"frndp.%s<PX#P1>%s<PX#PD> 0x%08lx<SinglePrecisionFloatingPoint>, r<Dest>"
-{
- do_frnd (_SD, Dest, PD,
- get_fp_reg (_SD, -1, SinglePrecisionFloatingPoint, P1));
-}
-
-// frndz.{s|d|i|u}{s|d|i|u}
-31.Dest,26./,21.0b111110100,12.0,11.r,10.PD,8.0b01,6.P1,4.Source::f::frndz r
-"frndz.%s<PX#P1>%s<PX#PD> r<Source>, r<Dest>"
-{
- do_frnd (_SD, Dest, PD,
- get_fp_reg (_SD, Source, vSource, P1));
-}
-31.Dest,26./,21.0b111110100,12.1,11.r,10.PD,8.0b01,6.P1,4./+SinglePrecisionFloatingPoint::f::frndz l
-"frndz.%s<PX#P1>%s<PX#PD> 0x%08lx<SinglePrecisionFloatingPoint>, r<Dest>"
-{
- do_frnd (_SD, Dest, PD,
- get_fp_reg (_SD, -1, SinglePrecisionFloatingPoint, P1));
-}
-
-// fsqrt.{s|d}{s|d}{s|d}
-#void::function::do_fsqrt:unsigned32 *rDest, unsigned32 Source, unsigned32 Source2
-# sim_io_error ("fsqrt");
-31.Dest,26./,21.0b111110111,12.0,11./,10.PD,8.//,6.P1,4.Source::f::fsqrt r
-"fsqrt.%s<PX#P1>%s<PX#PD> r<Source>, r<Dest>"
-# do_fsqrt (_SD, rDest, vSource);
-31.Dest,26./,21.0b111110111,12.1,11./,10.PD,8.//,6.P1,4./+SinglePrecisionFloatingPoint::f::fsqrt l
-"fsqrt.%s<PX#P1>%s<PX#PD> 0x%08lx<SinglePrecisionFloatingPoint>, r<Dest>"
-# do_fsqrt (_SD, rDest, SinglePrecisionFloatingPoint);
-
-
-// fsub.{s|d}{s|d}{s|d}
-void::function::do_fsub:int Dest, int PD, sim_fpu s1, sim_fpu s2
-{
- sim_fpu ans;
- sim_fpu_sub (&ans, &s1, &s2);
- TRACE_FPU3 (ans, s1, s2);
- set_fp_reg (_SD, Dest, ans, PD);
-}
-31.Dest,26.Source2,21.0b111110001,12.0,11.r,10.PD,8.P2,6.P1,4.Source1::f::fsub r
-"fsub.%s<PX#P1>%s<PX#P2>%s<PX#PD> r<Source1>, r<Source2>, r<Dest>"
-{
- do_fsub (_SD, Dest, PD,
- get_fp_reg (_SD, Source1, vSource1, P1),
- get_fp_reg (_SD, Source2, vSource2, P2));
-}
-31.Dest,26.Source2,21.0b111110001,12.1,11.r,10.PD,8.P2,6.P1,4./+SinglePrecisionFloatingPoint::f::fsub l
-"fsub.%s<PX#P1>%s<PX#P2>%s<PX#PD> 0x%08lx<SinglePrecisionFloatingPoint>, r<Source2>, r<Dest>"
-{
- do_fsub (_SD, Dest, PD,
- get_fp_reg (_SD, -1, SinglePrecisionFloatingPoint, P1),
- get_fp_reg (_SD, Source2, vSource2, P2));
-}
-
-// illop
-31./,21.0b0000000,14./::::illop
-"illop"
-31./,21.0b111111111,12./::::illop l
-"illop"
-
-
-// ins - see sl.im
-
-
-// jsr[.a]
-instruction_address::function::do_jsr:instruction_address nia, signed32 *rLink, int annul, unsigned32 offset, unsigned32 base
-{
- address_word target = offset + base;
- TRACE_UCOND_BR (MY_INDEX, target);
- nia = do_branch (_SD, annul, target, 1, rLink);
- if (nia.dp & 0x3)
- sim_engine_abort (SD, CPU, cia,
- "0x%lx: destination address 0x%lx misaligned",
- (unsigned long) cia.ip,
- (unsigned long) nia.dp);
- return nia;
-}
-31.Link,26.Base,21.0b100010,15.A,14.SignedOffset::::jsr i
-"jsr%s<A> <SignedOffset>, r<Link>"
-{
- nia = do_jsr (_SD, nia, rLink, A, vSignedOffset, vBase);
-}
-31.Link,26.Base,21.0b11100010,13.A,12.0,11./,4.IndOff::::jsr r
-"jsr%s<A> r<IndOff>, r<Link>"
-{
- nia = do_jsr (_SD, nia, rLink, A, rIndOff, vBase);
-}
-31.Link,26.Base,21.0b11100010,13.A,12.1,11./+LongSignedImmediate::::jsr l
-"jsr%s<A> <LongSignedImmediate>, r<Link>"
-{
- nia = do_jsr (_SD, nia, rLink, A, LongSignedImmediate, vBase);
-}
-
-// ld[{.b.h.d}]
-void::function::do_ld:int Dest, unsigned32 base, unsigned32 *rBase, int m , int sz, int S, unsigned32 offset
-{
- unsigned32 addr;
- switch (sz)
- {
- case 0:
- addr = base + (S ? (offset << 0) : offset);
- if (m)
- *rBase = addr;
- GPR(Dest) = MEM (signed, addr, 1);
- break;
- case 1:
- addr = base + (S ? (offset << 1) : offset);
- if (m)
- *rBase = addr;
- GPR(Dest) = MEM (signed, addr, 2);
- break;
- case 2:
- addr = base + (S ? (offset << 2) : offset);
- if (m)
- *rBase = addr;
- GPR(Dest) = MEM (signed, addr, 4);
- break;
- case 3:
- {
- signed64 val;
- if (Dest & 0x1)
- sim_engine_abort (SD, CPU, cia, "0x%lx: ld.d to odd register %d",
- cia.ip, Dest);
- addr = base + (S ? (offset << 3) : offset);
- if (m)
- *rBase = addr;
- val = MEM (signed, addr, 8);
- GPR(Dest + 1) = VH4_8 (val);
- GPR(Dest + 0) = VL4_8 (val);
- }
- break;
- default:
- addr = -1;
- sim_engine_abort (SD, CPU, cia, "ld - invalid sz %d", sz);
- }
- TRACE_LD (GPR(Dest), m, S, base, offset);
-}
-const char *::function::str_sz:int sz
-{
- switch (sz)
- {
- case 0: return ".b";
- case 1: return ".h";
- case 2: return "";
- case 3: return ".d";
- default: return "?";
- }
-}
-const char *::function::str_m:int m
-{
- if (m)
- return ":m";
- else
- return "";
-}
-const char *::function::str_S:int S
-{
- if (S)
- return ":s";
- else
- return "";
-}
-31.Dest,26.Base,21.0b0100,17.m,16.sz,14.SignedOffset::::ld i
-"ld%s<sz> <SignedOffset> (r<Base>%s<m>), r<Dest>"
-{
- do_ld (_SD, Dest, vBase, rBase, m, sz, 0, vSignedOffset);
-}
-31.Dest,26.Base,21.0b110100,15.m,14.sz,12.0,11.S,10.0,9./,4.IndOff::::ld r
-"ld%s<sz> r<IndOff>%s<S> (r<Base>%s<m>), r<Dest>"
-{
- do_ld (_SD, Dest, vBase, rBase, m, sz, S, rIndOff);
-}
-31.Dest,26.Base,21.0b110100,15.m,14.sz,12.1,11.S,10.0,9./+LongSignedImmediateOffset::::ld l
-"ld%s<sz> 0x%08lx<LongSignedImmediateOffset>%s<S> (r<Base>%s<m>), r<Dest>"
-{
- do_ld (_SD, Dest, vBase, rBase, m, sz, S, LongSignedImmediateOffset);
-}
-
-// ld.u[{.b.h.d}]
-void::function::do_ld_u:unsigned32 *rDest, unsigned32 base, unsigned32 *rBase, int m , int sz, int S, unsigned32 offset
-{
- unsigned32 addr;
- switch (sz)
- {
- case 0:
- addr = base + (S ? (offset << 0) : offset);
- *rDest = MEM (unsigned, addr, 1);
- break;
- case 1:
- addr = base + (S ? (offset << 1) : offset);
- *rDest = MEM (unsigned, addr, 2);
- break;
- default:
- addr = -1;
- sim_engine_abort (SD, CPU, cia, "ld.u - invalid sz %d", sz);
- }
- if (m)
- *rBase = addr;
- TRACE_LD (m, S, *rDest, base, offset);
-}
-31.Dest,26.Base,21.0b0101,17.m,16.sz,14.SignedOffset::::ld.u i
-"ld.u%s<sz> <SignedOffset> (r<Base>%s<m>), r<Dest>"
-{
- do_ld_u (_SD, rDest, vBase, rBase, m, sz, 0, vSignedOffset);
-}
-31.Dest,26.Base,21.0b110101,15.m,14.sz,12.0,11.S,10.0,9./,4.IndOff::::ld.u r
-"ld.u%s<sz> r<IndOff>%s<S> (r<Base>%s<m>), r<Dest>"
-{
- do_ld_u (_SD, rDest, vBase, rBase, m, sz, S, rIndOff);
-}
-31.Dest,26.Base,21.0b110101,15.m,14.sz,12.1,11.S,10.0,9./+LongSignedImmediateOffset::::ld.u l
-"ld.u%s<sz> 0x%08lx<LongSignedImmediateOffset>%s<S> (r<Base>%s<m>), r<Dest>"
-{
- do_ld_u (_SD, rDest, vBase, rBase, m, sz, S, LongSignedImmediateOffset);
-}
-
-// lmo
-31.Dest,26.Source,21.0b111111000,12.0,11./::::lmo
-"lmo r<Source>, r<Dest>"
-{
- int b;
- for (b = 0; b < 32; b++)
- if (vSource & BIT32 (31 - b))
- break;
- TRACE_ALU2 (MY_INDEX, b, vSource);
- *rDest = b;
-}
-
-
-// nop - see rdcr 0, r0
-
-
-void::function::do_or:unsigned32 *rDest, unsigned32 Source1, unsigned32 Source2
-{
- unsigned32 result = Source1 | Source2;
- TRACE_ALU3 (MY_INDEX, result, Source1, Source2);
- *rDest = result;
-}
-
-// or, or.tt
-31.Dest,26.Source2,21.0b0010111,14.UnsignedImmediate::::or.tt i
-"or.tt <UnsignedImmediate>, r<Source2>, r<Dest>"
-{
- do_or (_SD, rDest, vSource1, vSource2);
-}
-31.Dest,26.Source2,21.0b110010111,12.0,11./,4.Source1::::or.tt r
-"or.tt r<Source1>, r<Source2>, r<Dest>"
-{
- do_or (_SD, rDest, vSource1, vSource2);
-}
-31.Dest,26.Source2,21.0b110010111,12.1,11./+LongUnsignedImmediate::::or.tt l
-"or.tt 0x%08lx<LongUnsignedImmediate>, r<Source2>, r<Dest>"
-{
- do_or (_SD, rDest, LongUnsignedImmediate, vSource2);
-}
-
-// or.ff
-31.Dest,26.Source2,21.0b0011110,14.UnsignedImmediate::::or.ff i
-"or.ff <UnsignedImmediate>, r<Source2>, r<Dest>"
-{
- do_or (_SD, rDest, ~vSource1, ~vSource2);
-}
-31.Dest,26.Source2,21.0b110011110,12.0,11./,4.Source1::::or.ff r
-"or.ff r<Source1>, r<Source2>, r<Dest>"
-{
- do_or (_SD, rDest, ~vSource1, ~vSource2);
-}
-31.Dest,26.Source2,21.0b110011110,12.1,11./+LongUnsignedImmediate::::or.ff l
-"or.ff 0x%08lx<LongUnsignedImmediate>, r<Source2>, r<Dest>"
-{
- do_or (_SD, rDest, ~LongUnsignedImmediate, ~vSource2);
-}
-
-// or.ft
-31.Dest,26.Source2,21.0b0011101,14.UnsignedImmediate::::or.ft i
-"or.ft <UnsignedImmediate>, r<Source2>, r<Dest>"
-{
- do_or (_SD, rDest, ~vSource1, vSource2);
-}
-31.Dest,26.Source2,21.0b110011101,12.0,11./,4.Source1::::or.ft r
-"or.ft r<Source1>, r<Source2>, r<Dest>"
-{
- do_or (_SD, rDest, ~vSource1, vSource2);
-}
-31.Dest,26.Source2,21.0b110011101,12.1,11./+LongUnsignedImmediate::::or.ft l
-"or.ft 0x%08lx<LongUnsignedImmediate>, r<Source2>, r<Dest>"
-{
- do_or (_SD, rDest, ~LongUnsignedImmediate, vSource2);
-}
-
-// or.tf
-31.Dest,26.Source2,21.0b0011011,14.UnsignedImmediate::::or.tf i
-"or.tf <UnsignedImmediate>, r<Source2>, r<Dest>"
-{
- do_or (_SD, rDest, vSource1, ~vSource2);
-}
-31.Dest,26.Source2,21.0b110011011,12.0,11./,4.Source1::::or.tf r
-"or.tf r<Source1>, r<Source2>, r<Dest>"
-{
- do_or (_SD, rDest, vSource1, ~vSource2);
-}
-31.Dest,26.Source2,21.0b110011011,12.1,11./+LongUnsignedImmediate::::or.tf l
-"or.tf 0x%08lx<LongUnsignedImmediate>, r<Source2>, r<Dest>"
-{
- do_or (_SD, rDest, LongUnsignedImmediate, ~vSource2);
-}
-
-// rdcr
-void::function::do_rdcr:unsigned32 Dest, int cr
-{
- TRACE_SINK2 (MY_INDEX, Dest, cr);
- GPR (Dest) = CR (cr);
-}
-31.Dest,26.0,21.0b0000100,14.UCRN::::rdcr i
-"rdcr CR[<UCRN>], r<Dest>"
-{
- do_rdcr (_SD, Dest, UCRN);
-}
-31.Dest,26.0,21.0b110000100,12.0,11./,4.INDCR::::rdcr r
-"rdcr CR[r<INDCR>], r<Dest>"
-{
- do_rdcr (_SD, Dest, UCRN);
-}
-31.Dest,26.0,21.0b110000100,12.1,11./+UnsignedControlRegisterNumber::::rdcr l
-"rdcr CR[<UnsignedControlRegisterNumber>], r<Dest>"
-{
- do_rdcr (_SD, Dest, UnsignedControlRegisterNumber);
-}
-
-// rmo
-31.Dest,26.Source,21.0b111111001,12.0,11./::::rmo
-"rmo r<Source>, r<Dest>"
-{
- int b;
- for (b = 0; b < 32; b++)
- if (vSource & BIT32 (b))
- break;
- if (b < 32)
- b = 31 - b;
- TRACE_ALU2 (MY_INDEX, b, vSource);
- *rDest = b;
-}
-
-// rotl - see sl.dz
-
-
-// rotr - see sl.dz
-
-
-// shl - see sl.iz
-
-
-// sl.{d|e|i}{m|s|z}
-void::function::do_shift:int Dest, unsigned32 source, int Merge, int i, int n, int EndMask, int Rotate
-{
- /* see 10-30 for a reasonable description */
- unsigned32 input = source;
- unsigned32 rotated;
- unsigned32 endmask;
- unsigned32 shiftmask;
- unsigned32 cm;
- int nRotate;
- /* rotate the source */
- if (n)
- {
- rotated = ROTR32 (source, Rotate);
- nRotate = (- Rotate) & 31;
- }
- else
- {
- rotated = ROTL32 (source, Rotate);
- nRotate = Rotate;
- }
- /* form the end mask */
- if (EndMask == 0)
- endmask = ~ (unsigned32)0;
- else
- endmask = (1 << EndMask) - 1;
- if (i)
- endmask = ~endmask;
- /* form the shiftmask */
- switch (Merge)
- {
- case 0: case 1: case 2:
- shiftmask = ~ (unsigned32)0; /* disabled */
- break;
- case 3: case 5: /* enabled - 0 -> 32 */
- if (nRotate == 0)
- shiftmask = ~ (unsigned32)0;
- else
- shiftmask = ((1 << nRotate) - 1); /* enabled - 0 -> 0 */
- break;
- case 4:
- shiftmask = ((1 << nRotate) - 1); /* enabled - 0 -> 0 */
- break;
- case 6: case 7:
- shiftmask = ~((1 << nRotate) - 1); /* inverted */
- break;
- default:
- sim_engine_abort (SD, CPU, cia,
- "0x%lx: Invalid merge (%d) for shift",
- (long) cia.ip, (int) source);
- shiftmask = 0;
- }
- /* and the composite mask */
- cm = shiftmask & endmask;
- /* and merge */
- switch (Merge)
- {
- case 0: case 3: case 6: /* zero */
- GPR (Dest) = rotated & cm;
- break;
- case 1: case 4: case 7: /* merge */
- GPR (Dest) = (rotated & cm) | (GPR (Dest) & ~cm);
- break;
- case 2: case 5: /* sign */
- {
- int b;
- GPR (Dest) = rotated & cm;
- for (b = 1; b <= 31; b++)
- if (!MASKED32 (cm, b, b))
- GPR (Dest) |= INSERTED32 (EXTRACTED32 (GPR (Dest), b - 1, b - 1),
- b, b);
- }
- break;
- default:
- sim_engine_abort (SD, CPU, cia,
- "0x%lx: Invalid merge (%d)",
- (long) cia.ip, (int) source);
- }
- TRACE_SHIFT (MY_INDEX, GPR (Dest), input, i, n, Merge, EndMask, Rotate);
-}
-const char *::function::str_Merge:int Merge
-{
- switch (Merge)
- {
- case 0: return "dz";
- case 1: return "dm";
- case 2: return "ds";
- case 3: return "ez";
- case 4: return "em";
- case 5: return "es";
- case 6: return "iz";
- case 7: return "im";
- default: return "?";
- }
-}
-31.Dest,26.Source,21.0b0001,17.Merge,14./,11.i,10.n,9.EndMask,4.Rotate::::sl i
-"sl.%s<Merge> <Rotate>, <EndMask>, r<Source>, r<Dest>"
-{
- do_shift (_SD, Dest, vSource, Merge, i, n, EndMask, Rotate);
-}
-31.Dest,26.Source,21.0b110001,15.Merge,12.0,11.i,10.n,9.EndMask,4.RotReg::::sl r
-"sl.%s<Merge> r<RotReg>, <EndMask>, r<Source>, r<Dest>"
-{
- do_shift (_SD, Dest, vSource, Merge, i, n, EndMask, GPR (RotReg) & 31);
-}
-
-// sli.{d|e|i}{m|s|z} - see shift
-
-
-// sr.{d|e|i}{m|s|z} - see shift
-
-
-// sra - see sr.es - see shift
-
-
-// sri.{d|e|i}{m|s|z} - see shift
-
-
-// srl - see sr.ez
-
-
-// st[{.b|.h|.d}]
-void::function::do_st:int Source, unsigned32 base, unsigned32 *rBase, int m , int sz, int S, unsigned32 offset
-{
- unsigned32 addr;
- switch (sz)
- {
- case 0:
- addr = base + (S ? (offset << 0) : offset);
- STORE (addr, 1, GPR(Source));
- break;
- case 1:
- addr = base + (S ? (offset << 1) : offset);
- STORE (addr, 2, GPR(Source));
- break;
- case 2:
- addr = base + (S ? (offset << 2) : offset);
- STORE (addr, 4, GPR(Source));
- break;
- case 3:
- {
- signed64 val;
- if (Source & 0x1)
- sim_engine_abort (SD, CPU, cia,
- "0x%lx: st.d with odd source register %d",
- cia.ip, Source);
- addr = base + (S ? (offset << 3) : offset);
- val = U8_4 (GPR(Source + 1), GPR(Source));
- STORE (addr, 8, val);
- }
- break;
- default:
- addr = -1;
- sim_engine_abort (SD, CPU, cia, "st - invalid sz %d", sz);
- }
- if (m)
- *rBase = addr;
- TRACE_ST (Source, m, S, base, offset);
-}
-31.Source,26.Base,21.0b0110,17.m,16.sz,14.SignedOffset::::st i
-"st%s<sz> <SignedOffset> (r<Base>%s<m>), r<Source>"
-{
- do_st (_SD, Source, vBase, rBase, m, sz, 0, vSignedOffset);
-}
-31.Source,26.Base,21.0b110110,15.m,14.sz,12.0,11.S,10.0,9./,4.IndOff::::st r
-"st%s<sz> r<IndOff>%s<S> (r<Base>%s<m>), r<Source>"
-{
- do_st (_SD, Source, vBase, rBase, m, sz, S, rIndOff);
-}
-31.Source,26.Base,21.0b110110,15.m,14.sz,12.1,11.S,10.0,9./+LongSignedImmediateOffset::::st l
-"st%s<sz> 0x%08lx<LongSignedImmediateOffset>%s<S> (r<Base>%s<m>), r<Source>"
-{
- do_st (_SD, Source, vBase, rBase, m, sz, S, LongSignedImmediateOffset);
-}
-
-// sub
-void::function::do_sub:signed32 *rDest, signed32 Source1, signed32 Source2
-{
- ALU_BEGIN (Source1);
- ALU_SUB (Source2);
- ALU_END (*rDest);
- TRACE_ALU3 (MY_INDEX, *rDest, Source1, Source2);
-}
-31.Dest,26.Source2,21.0b101101,15.0,14.SignedImmediate::::sub i
-"sub <SignedImmediate>, r<Source2>, r<Dest>"
-{
- do_sub (_SD, rDest, vSource1, vSource2);
-}
-31.Dest,26.Source2,21.0b11101101,13.0,12.0,11./,4.Source1::::sub r
-"sub r<Source1>, r<Source2>, r<Dest>"
-{
- do_sub (_SD, rDest, vSource1, vSource2);
-}
-31.Dest,26.Source2,21.0b11101101,13.0,12.1,11./+LongSignedImmediate::::sub l
-"sub 0x%08lx<LongSignedImmediate>, r<Source2>, r<Dest>"
-{
- do_sub (_SD, rDest, LongSignedImmediate, vSource2);
-}
-
-// subu
-void::function::do_subu:unsigned32 *rDest, unsigned32 Source1, signed32 Source2
-{
- unsigned32 result = Source1 - Source2;
- TRACE_ALU3 (MY_INDEX, result, Source1, Source2);
- *rDest = result;
-}
-// NOTE - the book has 15.1 which conflicts with subu.
-31.Dest,26.Source2,21.0b101101,15.1,14.SignedImmediate::::subu i
-"subu <SignedImmediate>, r<Source2>, r<Dest>"
-{
- do_subu (_SD, rDest, vSource1, vSource2);
-}
-31.Dest,26.Source2,21.0b11101101,13.1,12.0,11./,4.Source1::::subu r
-"subu r<Source1>, r<Source2>, r<Dest>"
-{
- do_subu (_SD, rDest, vSource1, vSource2);
-}
-31.Dest,26.Source2,21.0b11101101,13.1,12.1,11./+LongSignedImmediate::::subu l
-"subu 0x%08lx<LongSignedImmediate>, r<Source2>, r<Dest>"
-{
- do_subu (_SD, rDest, LongSignedImmediate, vSource2);
-}
-
-// swcr
-void::function::do_swcr:int Dest, signed32 source, signed32 cr
-{
- tic80_control_regs reg = tic80_index2cr (cr);
- /* cache the old CR value */
- unsigned32 old_cr = CR (cr);
- /* Handle the write if allowed */
- if (cr >= 0x4000 || !(CPU)->is_user_mode)
- switch (reg)
- {
- case INTPEN_CR:
- CR (cr) &= ~source;
- break;
- default:
- CR (cr) = source;
- break;
- }
- /* Finish off the read */
- GPR (Dest) = old_cr;
- TRACE_SINK3 (MY_INDEX, source, cr, Dest);
-}
-31.Dest,26.Source,21.0b000010,15.1,14.UCRN::::swcr i
-"swcr CR[<UCRN>], r<Dest>"
-{
- do_swcr (_SD, Dest, vSource, UCRN);
-}
-31.Dest,26.Source,21.0b11000010,13.1,12.0,11./,4.INDCR::::swcr r
-"swcr CR[r<INDCR>], r<Dest>"
-{
- do_swcr (_SD, Dest, vSource, UCRN);
-}
-31.Dest,26.Source,21.0b11000010,13.1,12.1,11./+LongUnsignedControlRegisterNumber::::swcr l
-"swcr CR[<LongUnsignedControlRegisterNumber>], r<Dest>"
-{
- do_swcr (_SD, Dest, vSource, LongUnsignedControlRegisterNumber);
-}
-
-// trap
-void::function::do_trap:unsigned32 trap_number
-{
- int i;
- TRACE_SINK1 (MY_INDEX, trap_number);
- switch (trap_number)
- {
- case 72:
- switch (GPR(15))
- {
- case 1: /* EXIT */
- {
- sim_engine_halt (SD, CPU, NULL, cia, sim_exited, GPR(2));
- break;
- }
- case 4: /* WRITE */
- {
- unsigned i;
- if (GPR(2) == 1)
- for (i = 0; i < GPR(6); i++)
- {
- char c;
- c = MEM (unsigned, GPR(4) + i, 1);
- sim_io_write_stdout (SD, &c, 1);
- }
- else if (GPR(2) == 2)
- for (i = 0; i < GPR(6); i++)
- {
- char c;
- c = MEM (unsigned, GPR(4) + i, 1);
- sim_io_write_stderr (SD, &c, 1);
- }
- else
- sim_engine_abort (SD, CPU, cia,
- "0x%lx: write to invalid fid %d",
- (long) cia.ip, (int) GPR(2));
- GPR(2) = GPR(6);
- break;
- }
- case 20: /* GETPID */
- {
- GPR(2) = getpid ();
- break;
- }
- case 37: /* KILL */
- if ( GPR (2) != (unsigned) getpid ())
- {
- int ret = kill (GPR(2), GPR(4));
- if (ret < 0)
- ret = -errno;
- GPR (2) = ret;
- break;
- }
- else
- {
- sim_engine_halt (SD, CPU, NULL, cia, sim_signalled, GPR(4));
- break;
- }
- default:
- /* For system calls which are defined, just return EINVAL instead of trapping */
- if (GPR(15) <= 204)
- {
- GPR(2) = -22; /* -EINVAL */
- break;
- }
- sim_engine_abort (SD, CPU, cia,
- "0x%lx: unknown syscall %d",
- (long) cia.ip, (int) GPR(15));
- }
- break;
- case 73:
- sim_engine_halt (SD, CPU, NULL, cia, sim_stopped, SIM_SIGTRAP);
-
- /* Add a few traps for now to print the register state */
- case 74:
- case 75:
- case 76:
- case 77:
- case 78:
- case 79:
- if (!TRACE_ALU_P (CPU))
- trace_one_insn (SD, CPU, cia.ip, 1, itable[MY_INDEX].file,
- itable[MY_INDEX].line_nr, "trap",
- "Trap %ld", (long) trap_number);
-
- for (i = 0; i < 32; i++)
- sim_io_eprintf (SD, "%s0x%.8lx%s", ((i % 8) == 0) ? "\t" : " ", (long)GPR(i),
- (((i+1) % 8) == 0) ? "\n" : "");
- sim_io_write_stderr (SD, "\n", 1);
- break;
-
- default:
- sim_engine_abort (SD, CPU, cia,
- "0x%lx: unsupported trap %d",
- (long) cia.ip, (int) trap_number);
- }
-}
-31./,27.0,26./,21.0b0000001,14.UTN::::trap i
-"trap <UTN>"
-{
- do_trap (_SD, UTN);
-}
-31./,27.0,26./,21.0b110000001,12.0,11./,4.INDTR::::trap r
-"trap r<INDTR>"
-{
- do_trap (_SD, UTN);
-}
-31./,27.0,26./,21.0b110000001,12.1,11./+UTN::::trap l
-"trap 0x%08lx<UTN>"
-{
- do_trap (_SD, UTN);
-}
-
-// vadd.{s|d}{s|d}
-31.*,26.Dest,21.0b11110,16./,15.0b000,12.0,11./,10.*,9.*,7.PD,6.*,5.P1,4.Source::f::vadd r
-31.*,26.Dest,21.0b11110,16./,15.0b000,12.1,11./,10.*,9.*,7.PD,6.*,5.P1,4.Source::f::vadd l
-
-
-// vld{0|1}.{s|d} - see above - same instruction
-#31.Dest,26.*,21.0b11110,16.*,10.1,9.S,8.*,6.p,7.******::f::vld
-
-
-// vmac.ss{s|d}
-#31.*, 26.Source2,21.0b11110,16.a0,15.0b110,12.0,11.a1,10.*,9.*, 8.Z,7./,6.*,5./,4.Source1::f::vmac.ss ra
-31.Dest,26.Source2,21.0b11110,16.a0,15.0b110,12.0,11.a1,10.0,9.PD,8.Z,7./,6.0,5./,4.Source1::f::vmac.ss rr
-#31.*, 26.Source2,21.0b11110,16.a0,15.0b110,12.1,11.a1,10.*,9.*, 8.Z,7./,6.*,5./,4./::f::vmac.ss ia
-31.Dest,26.Source2,21.0b11110,16.a0,15.0b110,12.1,11.a1,10.0,9.PD,8.Z,7./,6.0,5./,4./::f::vmac.ss ir
-
-
-// vmpy.{s|d}{s|d}
-31.*,26.Dest,21.0b11110,16./,15.0b010,12.0,11./,10.*,8.*,7.PD,6.*,5.P1,4.Source::f::vmpy r
-31.*,26.Dest,21.0b11110,16./,15.0b010,12.1,11./,10.*,8.*,7.PD,6.*,5.P1,4./::f::vmpy l
-
-
-// vmsc.ss{s|d}
-#31.*, 26.Source2,21.0b11110,16.a0,15.0b111,12.0,11.a1,10.*,9.*, 8.Z,7./,6.*,5./,4.Source1::f::vmsc.ss ra
-31.Dest,26.Source2,21.0b11110,16.a0,15.0b111,12.0,11.a1,10.0,9.PD,8.Z,7./,6.0,5./,4.Source1::f::vmsc.ss rr
-#31.*, 26.Source2,21.0b11110,16.a0,15.0b111,12.1,11.a1,10.*,9.*, 8.Z,7./,6.*,5./,4./::f::vmsc.ss ia
-31.Dest,26.Source2,21.0b11110,16.a0,15.0b111,12.1,11.a1,10.0,9.PD,8.Z,7./,6.0,5./,4./::f::vmsc.ss ir
-
-
-// vmsub.{s|d}{s|d}
-31.*,26.Dest,21.0b11110,16.a0,15.0b011,12.0,11.a1,10.*,8.Z,7.PD,6.*,5./,4.Source::f::vmsub r
-31.*,26.Dest,21.0b11110,16.a0,15.0b011,12.1,11.a1,10.*,8.Z,7.PD,6.*,5./,4./::f::vmsub l
-
-
-// vrnd.{s|d}{s|d}
-31.*,26.Dest,21.0b11110,16.a0,15.0b100,12.0,11.a1,10.*,8.PD,6.*,5.P1,4.Source::f::vrnd f r
-31.*,26.Dest,21.0b11110,16.a0,15.0b100,12.1,11.a1,10.*,8.PD,6.*,5.P1,4./::f::vrnd f l
-
-
-// vrnd.{i|u}{s|d}
-31.*,26.Dest,21.0b11110,16./,15.0b101,12.0,11./,10.*,8./,7.PD,6.*,5.P1,4.Source::f::vrnd i r
-31.*,26.Dest,21.0b11110,16./,15.0b101,12.1,11./,10.*,8./,7.PD,6.*,5.P1,4./::f::vrnd i l
-
-
-// vst.{s|d} - see above - same instruction
-#31.Source,26.*,21.0b11110,16.*,10.0,9.S,8.*,6.1,5.*::f::vst
-
-
-// vsub.{i|u}{s|d}
-31.*,26.Dest,21.0b11110,16./,15.0b001,12.0,11./,10.*,8./,7.PD,6.*,5.P1,4.Source::f::vsub r
-31.*,26.Dest,21.0b11110,16./,15.0b001,12.1,11./,10.*,8./,7.PD,6.*,5.P1,4./::f::vsub l
-
-
-// wrcr - see swcr, creg, source, r0
-
-
-// xnor
-void::function::do_xnor:signed32 *rDest, signed32 source1, signed32 source2
-{
- unsigned32 result = ~ (source1 ^ source2);
- TRACE_ALU3 (MY_INDEX, result, source1, source2);
- *rDest = result;
-}
-31.Dest,26.Source2,21.0b0011001,14.UnsignedImmediate::::xnor i
-"xnor <UnsignedImmediate>, r<Source2>, r<Dest>"
-{
- do_xnor (_SD, rDest, vSource1, vSource2);
-}
-31.Dest,26.Source2,21.0b110011001,12.0,11./,4.Source1::::xnor r
-"xnor r<Source1>, r<Source2>, r<Dest>"
-{
- do_xnor (_SD, rDest, vSource1, vSource2);
-}
-31.Dest,26.Source2,21.0b110011001,12.1,11./+LongUnsignedImmediate::::xnor l
-"xnor 0x%08lx<LongUnsignedImmediate>, r<Source2>, r<Dest>"
-{
- do_xnor (_SD, rDest, LongUnsignedImmediate, vSource2);
-}
-
-// xor
-void::function::do_xor:signed32 *rDest, signed32 source1, signed32 source2
-{
- unsigned32 result = source1 ^ source2;
- TRACE_ALU3 (MY_INDEX, result, source1, source2);
- *rDest = result;
-}
-31.Dest,26.Source2,21.0b0010110,14.UnsignedImmediate::::xor i
-"xor <UnsignedImmediate>, r<Source2>, r<Dest>"
-{
- do_xor (_SD, rDest, vSource1, vSource2);
-}
-31.Dest,26.Source2,21.0b110010110,12.0,11./,4.Source1::::xor r
-"xor r<Source1>, r<Source2>, r<Dest>"
-{
- do_xor (_SD, rDest, vSource1, vSource2);
-}
-31.Dest,26.Source2,21.0b110010110,12.1,11./+LongUnsignedImmediate::::xor l
-"xor 0x%08lx<LongUnsignedImmediate>, r<Source2>, r<Dest>"
-{
- do_xor (_SD, rDest, LongUnsignedImmediate, vSource2);
-}
diff --git a/sim/w65/ChangeLog b/sim/w65/ChangeLog
index 088f8b24867..ea4ffbe3041 100644
--- a/sim/w65/ChangeLog
+++ b/sim/w65/ChangeLog
@@ -1,3 +1,7 @@
+2002-06-08 Andrew Cagney <cagney@redhat.com>
+
+ * interp.c: Include "gdb/callback.h" and "gdb/remote-sim.h".
+
Tue May 23 21:39:23 2000 Andrew Cagney <cagney@b1.cygnus.com>
* configure: Regenerated to track ../common/aclocal.m4 changes.
diff --git a/sim/w65/interp.c b/sim/w65/interp.c
index 36c4e322c9c..a4b325a1cc7 100644
--- a/sim/w65/interp.c
+++ b/sim/w65/interp.c
@@ -33,8 +33,8 @@
#endif
#include <sys/param.h>
#include "bfd.h"
-#include "callback.h"
-#include "remote-sim.h"
+#include "gdb/callback.h"
+#include "gdb/remote-sim.h"
#include "../../newlib/libc/sys/w65/sys/syscall.h"
#include "interp.h"
diff --git a/sim/z8k/ChangeLog b/sim/z8k/ChangeLog
index 8036fe331cf..b6f5ed8346c 100644
--- a/sim/z8k/ChangeLog
+++ b/sim/z8k/ChangeLog
@@ -1,3 +1,20 @@
+2002-06-09 Andrew Cagney <cagney@redhat.com>
+
+ * iface.c: Include "gdb/callback.h" and "gdb/remote-sim.h".
+ * support.c: Ditto.
+
+2002-06-06 Andrew Cagney <ac131313@redhat.com>
+
+ * writecode.c (lookup_inst): Generate inverse table on-the-fly.
+ (z8k_inv_list): Delete global.
+ (DIRTY_HACK): Delete macro.
+ (makelist): Delete global.
+ (main): Delete code making a list. Delete dirty hack code. Use
+ lookup_inst instead of z8k_inv_list.
+ * list.c: Delete file.
+ * Makefile.in (writecode): Do not link in list.o.
+ (list.o): Delete target.
+
2002-04-29 Nick Clifton <nickc@cambridge.redhat.com>
* writecode.c (lookup_inst): Ignore CLASS_IGNORE.
diff --git a/sim/z8k/Makefile.in b/sim/z8k/Makefile.in
index f6432d4157a..db3f9318ac3 100644
--- a/sim/z8k/Makefile.in
+++ b/sim/z8k/Makefile.in
@@ -49,15 +49,12 @@ tc-gen3.h:writecode
tc-genb3.h:writecode
./writecode -b3 >tc-genb3.h
-writecode: writecode.o list.o bquick.o
- $(CC_FOR_BUILD) -o writecode writecode.o list.o bquick.o
+writecode: writecode.o bquick.o
+ $(CC_FOR_BUILD) -o writecode writecode.o bquick.o
writecode.o: writecode.c $(CONFIG_H)
$(CC_FOR_BUILD) -c $(CFLAGS) $(HDEFINES) $(CSEARCH) $(CSWITCHES) $(srcdir)/writecode.c
-list.o: list.c
- $(CC_FOR_BUILD) -c $(CFLAGS) $(HDEFINES) $(CSEARCH) $(CSWITCHES) $(srcdir)/list.c
-
# Two copies of quick.o are created. One for $build and one for $host.
bquick.o: quick.c
$(CC_FOR_BUILD) -c $(CFLAGS) $(HDEFINES) $(CSEARCH) $(CSWITCHES) $(srcdir)/quick.c -o bquick.o
diff --git a/sim/z8k/iface.c b/sim/z8k/iface.c
index 1b3883ef545..c76d63f30a6 100644
--- a/sim/z8k/iface.c
+++ b/sim/z8k/iface.c
@@ -22,8 +22,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "tm.h"
#include "signal.h"
#include "bfd.h"
-#include "callback.h"
-#include "remote-sim.h"
+#include "gdb/callback.h"
+#include "gdb/remote-sim.h"
#ifndef NULL
#define NULL 0
diff --git a/sim/z8k/support.c b/sim/z8k/support.c
index 73923640628..e3cdc736e03 100644
--- a/sim/z8k/support.c
+++ b/sim/z8k/support.c
@@ -36,8 +36,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/param.h>
-#include "callback.h"
-#include "remote-sim.h"
+#include "gdb/callback.h"
+#include "gdb/remote-sim.h"
#include "syscall.h"
static int get_now PARAMS ((void));
diff --git a/sim/z8k/writecode.c b/sim/z8k/writecode.c
index b398545c04f..acff7c462f9 100644
--- a/sim/z8k/writecode.c
+++ b/sim/z8k/writecode.c
@@ -1,6 +1,6 @@
-
/* generate instructions for Z8KSIM
- Copyright (C) 1992, 1993 Free Software Foundation, Inc.
+
+ Copyright 1992, 1993, 2002 Free Software Foundation, Inc.
This file is part of Z8KSIM
@@ -35,9 +35,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-b3 tc-genb3.h same as -3 but for long pointers
- -m regenerates list.c, which is an inverted list of opcodes to
- pointers into the z8k dissassemble opcode table, it's just there
- to makes things faster.
*/
/* steve chamberlain
@@ -65,8 +62,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define NOPS 500
-#define DIRTY_HACK 0 /* Enable if your gcc can't cope with huge tables */
-extern short z8k_inv_list[];
struct opcode_value
{
int n;
@@ -84,7 +79,6 @@ static char *reg_names[] =
#define SIZE_ADDRESS (BIG ? 8 : 4) /* number of nibbles in a ptr*/
static int file;
-static int makelist;
static int nibs = 0;
@@ -103,7 +97,16 @@ static opcode_entry_type *
lookup_inst (what)
int what;
{
- if (makelist)
+ static short *z8k_inv_list = NULL;
+ const nr_z8k_inv_list_elements = 1 << 16;
+ if (z8k_inv_list == NULL)
+ {
+ /* Initialize the list to 0xff == -1 */
+ z8k_inv_list = calloc (nr_z8k_inv_list_elements, sizeof (short));
+ memset (z8k_inv_list, 0xff, nr_z8k_inv_list_elements * sizeof (short));
+ }
+ /* Entry empty? Fill it in. */
+ if (z8k_inv_list[what] == -1)
{
int nibl_index;
@@ -121,6 +124,9 @@ lookup_inst (what)
instr_nibbles[1] = (what >> 8) & 0xf;
instr_nibbles[0] = (what >> 12) & 0xf;
+ /* Assume it won't be found. */
+ z8k_inv_list[what] = -2;
+
while (ptr->name)
{
nibl_matched = 1;
@@ -181,19 +187,15 @@ lookup_inst (what)
}
if (nibl_matched)
{
- return ptr;
+ z8k_inv_list[what] = ptr->idx;
+ break; /* while */
}
ptr++;
}
- return 0;
- }
- else
- {
-
- if (z8k_inv_list[what] < 0)
- return 0;
- return z8k_table + z8k_inv_list[what];
}
+ if (z8k_inv_list[what] >= 0)
+ return z8k_table + z8k_inv_list[what];
+ return 0;
}
static char *
@@ -1677,12 +1679,8 @@ main (ac, av)
int i;
int needcomma = 0;
- makelist = 0;
-
for (i = 1; i < ac; i++)
{
- if (strcmp (av[i], "-m") == 0)
- makelist = 1;
if (strcmp (av[i], "-1") == 0)
file = 1;
if (strcmp (av[i], "-2") == 0)
@@ -1696,52 +1694,6 @@ main (ac, av)
}
}
- if (makelist)
- {
-
- int i;
- needcomma = 0;
- printf ("short int z8k_inv_list[] = {\n");
-
- for (i = 0; i < 1 << 16; i++)
- {
- opcode_entry_type *p = lookup_inst (i);
-
- if(needcomma)
- printf(",");
- if ((i & 0xf) == 0)
- printf ("\n");
-
-#if 0
- printf ("\n /*%04x %s */", i, p ? p->nicename : "");
-#endif
-
- if (!p)
- {
- printf ("-1");
- }
- else
- {
- printf ("%d", p->idx);
- }
-
- if ((i & 0x3f) == 0 && DIRTY_HACK)
- {
- printf ("\n#ifdef __GNUC__\n");
- printf ("};\n");
- printf("short int int_list%d[] = {\n", i);
- printf ("#else\n");
- printf (",\n");
- printf ("#endif\n");
- needcomma = 0;
- }
- else
- needcomma = 1;
-
- }
- printf ("};\n");
- return 1;
- }
/* First work out which opcodes use which bit patterns,
build a list of all matching bit pattens */
@@ -1776,9 +1728,7 @@ main (ac, av)
{
int t = quick[i];
- mangle (z8k_table + z8k_inv_list[t],
- 1,
- t);
+ mangle (lookup_inst (t), 1, t);
}
}
if (file == 3)
@@ -1809,16 +1759,6 @@ main (ac, av)
printf (",");
emit ("<fop>_%d\n", i);
needcomma = 1;
- if ((i & 0x3f) == 0 && DIRTY_HACK)
- {
- printf ("#ifdef __GNUC__\n");
- printf ("};\n");
- emit ("int (*(<fop>_table%d[]))() = {\n", i);
- printf ("#else\n");
- printf (",\n");
- printf ("#endif\n");
- needcomma = 0;
- }
}
emit ("};\n");
}
@@ -1854,8 +1794,7 @@ main (ac, av)
printf ("struct op_info op_info_table[] = {\n");
for (i = 0; i < 1 << 16; i++)
{
- int inv = z8k_inv_list[i];
- opcode_entry_type *p = z8k_table + inv;
+ opcode_entry_type *p = lookup_inst (i);
if (needcomma)
printf (",");
@@ -1866,13 +1805,13 @@ main (ac, av)
}
else
#endif
- if (inv >= 0)
+ if (p != NULL)
{
- printf ("%d", inv);
+ printf ("%d", p->idx);
}
else
printf ("400");
- if (inv >= 0)
+ if (p != NULL)
{
printf (" /* %04x %s */\n", i, p->nicename);
}
@@ -1881,17 +1820,6 @@ main (ac, av)
printf ("\n");
}
needcomma = 1;
- if ((i & 0x3f) == 0 && DIRTY_HACK)
- {
- printf ("#ifdef __GNUC__\n");
- printf ("}; \n");
- printf ("struct op_info op_info_table%d[] = {\n", i);
- printf ("#else\n");
- printf (",\n");
-
- printf ("#endif\n");
- needcomma = 0;
- }
}
printf ("};\n");