From 54c5547c6f7a63ebd9faab7f26326c762e95af29 Mon Sep 17 00:00:00 2001 From: dfr Date: Sun, 2 May 1999 15:34:14 +0000 Subject: Delete parts of gdb which are now shared with binutils. --- contrib/gdb/bfd/COPYING | 339 -- contrib/gdb/bfd/Makefile.in | 1090 ------ contrib/gdb/bfd/PORTING | 83 - contrib/gdb/bfd/TODO | 25 - contrib/gdb/bfd/VERSION | 1 - contrib/gdb/bfd/aclocal.m4 | 43 - contrib/gdb/bfd/aout-target.h | 607 ---- contrib/gdb/bfd/aout32.c | 23 - contrib/gdb/bfd/aoutx.h | 5525 ------------------------------ contrib/gdb/bfd/archive.c | 2094 ----------- contrib/gdb/bfd/archures.c | 720 ---- contrib/gdb/bfd/bfd-in.h | 668 ---- contrib/gdb/bfd/bfd.c | 1144 ------- contrib/gdb/bfd/binary.c | 348 -- contrib/gdb/bfd/cache.c | 347 -- contrib/gdb/bfd/coff-i386.c | 493 --- contrib/gdb/bfd/coffcode.h | 3612 ------------------- contrib/gdb/bfd/coffgen.c | 2121 ------------ contrib/gdb/bfd/coffswap.h | 807 ----- contrib/gdb/bfd/config.bfd | 491 --- contrib/gdb/bfd/config.in | 67 - contrib/gdb/bfd/configure | 2439 ------------- contrib/gdb/bfd/configure.host | 128 - contrib/gdb/bfd/configure.in | 577 ---- contrib/gdb/bfd/corefile.c | 106 - contrib/gdb/bfd/cpu-i386.c | 38 - contrib/gdb/bfd/dep-in.sed | 24 - contrib/gdb/bfd/doc/ChangeLog | 268 -- contrib/gdb/bfd/doc/Makefile.in | 311 -- contrib/gdb/bfd/doc/bfd.texinfo | 348 -- contrib/gdb/bfd/doc/bfdsumm.texi | 148 - contrib/gdb/bfd/doc/chew.c | 1551 --------- contrib/gdb/bfd/doc/doc.str | 158 - contrib/gdb/bfd/doc/proto.str | 135 - contrib/gdb/bfd/ecoff.c | 4740 ------------------------- contrib/gdb/bfd/ecofflink.c | 2452 ------------- contrib/gdb/bfd/elf-bfd.h | 858 ----- contrib/gdb/bfd/elf.c | 3318 ------------------ contrib/gdb/bfd/format.c | 319 -- contrib/gdb/bfd/freebsd.h | 125 - contrib/gdb/bfd/genlink.h | 106 - contrib/gdb/bfd/hash.c | 734 ---- contrib/gdb/bfd/hosts/alphalinux.h | 6 - contrib/gdb/bfd/hosts/decstation.h | 17 - contrib/gdb/bfd/hosts/delta68.h | 18 - contrib/gdb/bfd/hosts/dpx2.h | 8 - contrib/gdb/bfd/hosts/hp300bsd.h | 13 - contrib/gdb/bfd/hosts/i386bsd.h | 25 - contrib/gdb/bfd/hosts/i386linux.h | 8 - contrib/gdb/bfd/hosts/i386mach3.h | 25 - contrib/gdb/bfd/hosts/i386sco.h | 19 - contrib/gdb/bfd/hosts/i860mach3.h | 27 - contrib/gdb/bfd/hosts/m68kaux.h | 16 - contrib/gdb/bfd/hosts/m68klinux.h | 6 - contrib/gdb/bfd/hosts/m88kmach3.h | 11 - contrib/gdb/bfd/hosts/mipsbsd.h | 12 - contrib/gdb/bfd/hosts/mipsmach3.h | 10 - contrib/gdb/bfd/hosts/news-mips.h | 12 - contrib/gdb/bfd/hosts/news.h | 9 - contrib/gdb/bfd/hosts/pc532mach.h | 24 - contrib/gdb/bfd/hosts/riscos.h | 10 - contrib/gdb/bfd/hosts/symmetry.h | 20 - contrib/gdb/bfd/hosts/tahoe.h | 12 - contrib/gdb/bfd/hosts/vaxbsd.h | 19 - contrib/gdb/bfd/hosts/vaxult.h | 8 - contrib/gdb/bfd/hosts/vaxult2.h | 8 - contrib/gdb/bfd/i386aout.c | 68 - contrib/gdb/bfd/i386bsd.c | 46 - contrib/gdb/bfd/i386freebsd.c | 33 - contrib/gdb/bfd/ihex.c | 1005 ------ contrib/gdb/bfd/init.c | 50 - contrib/gdb/bfd/libaout.h | 608 ---- contrib/gdb/bfd/libbfd.c | 1197 ------- contrib/gdb/bfd/libbfd.h | 735 ---- contrib/gdb/bfd/libcoff.h | 823 ----- contrib/gdb/bfd/libecoff.h | 352 -- contrib/gdb/bfd/linker.c | 2781 --------------- contrib/gdb/bfd/opncls.c | 604 ---- contrib/gdb/bfd/reloc.c | 2391 ------------- contrib/gdb/bfd/section.c | 976 ------ contrib/gdb/bfd/srec.c | 1324 ------- contrib/gdb/bfd/stab-syms.c | 57 - contrib/gdb/bfd/syms.c | 1084 ------ contrib/gdb/bfd/sysdep.h | 114 - contrib/gdb/bfd/targets.c | 886 ----- contrib/gdb/bfd/tekhex.c | 1031 ------ contrib/gdb/bfd/trad-core.c | 315 -- contrib/gdb/include/COPYING | 339 -- contrib/gdb/include/ChangeLog | 973 ------ contrib/gdb/include/ansidecl.h | 141 - contrib/gdb/include/aout/ChangeLog | 174 - contrib/gdb/include/aout/adobe.h | 297 -- contrib/gdb/include/aout/aout64.h | 475 --- contrib/gdb/include/aout/ar.h | 36 - contrib/gdb/include/aout/dynix3.h | 71 - contrib/gdb/include/aout/encap.h | 135 - contrib/gdb/include/aout/host.h | 22 - contrib/gdb/include/aout/hp.h | 82 - contrib/gdb/include/aout/hp300hpux.h | 119 - contrib/gdb/include/aout/hppa.h | 7 - contrib/gdb/include/aout/ranlib.h | 62 - contrib/gdb/include/aout/reloc.h | 66 - contrib/gdb/include/aout/stab.def | 264 -- contrib/gdb/include/aout/stab_gnu.h | 37 - contrib/gdb/include/aout/sun4.h | 219 -- contrib/gdb/include/bfdlink.h | 452 --- contrib/gdb/include/bout.h | 182 - contrib/gdb/include/coff/ChangeLog | 622 ---- contrib/gdb/include/coff/a29k.h | 305 -- contrib/gdb/include/coff/alpha.h | 342 -- contrib/gdb/include/coff/apollo.h | 248 -- contrib/gdb/include/coff/arm.h | 215 -- contrib/gdb/include/coff/aux-coff.h | 31 - contrib/gdb/include/coff/ecoff.h | 408 --- contrib/gdb/include/coff/h8300.h | 203 -- contrib/gdb/include/coff/h8500.h | 201 -- contrib/gdb/include/coff/i386.h | 224 -- contrib/gdb/include/coff/i860.h | 204 -- contrib/gdb/include/coff/i960.h | 251 -- contrib/gdb/include/coff/internal.h | 648 ---- contrib/gdb/include/coff/m68k.h | 221 -- contrib/gdb/include/coff/m88k.h | 218 -- contrib/gdb/include/coff/mips.h | 368 -- contrib/gdb/include/coff/pe.h | 161 - contrib/gdb/include/coff/powerpc.h | 196 -- contrib/gdb/include/coff/rs6000.h | 242 -- contrib/gdb/include/coff/sh.h | 253 -- contrib/gdb/include/coff/sparc.h | 209 -- contrib/gdb/include/coff/sym.h | 484 --- contrib/gdb/include/coff/symconst.h | 177 - contrib/gdb/include/coff/w65.h | 201 -- contrib/gdb/include/coff/we32k.h | 206 -- contrib/gdb/include/coff/z8k.h | 201 -- contrib/gdb/include/demangle.h | 108 - contrib/gdb/include/dis-asm.h | 175 - contrib/gdb/include/elf/ChangeLog | 195 -- contrib/gdb/include/elf/common.h | 239 -- contrib/gdb/include/elf/dwarf.h | 319 -- contrib/gdb/include/elf/external.h | 195 -- contrib/gdb/include/elf/hppa.h | 94 - contrib/gdb/include/elf/internal.h | 207 -- contrib/gdb/include/elf/mips.h | 298 -- contrib/gdb/include/elf/ppc.h | 54 - contrib/gdb/include/elf/sparc.h | 73 - contrib/gdb/include/floatformat.h | 88 - contrib/gdb/include/fopen-bin.h | 27 - contrib/gdb/include/fopen-same.h | 27 - contrib/gdb/include/gdbm.h | 91 - contrib/gdb/include/getopt.h | 129 - contrib/gdb/include/hp-symtab.h | 983 ------ contrib/gdb/include/ieee.h | 139 - contrib/gdb/include/libiberty.h | 133 - contrib/gdb/include/mpw/ChangeLog | 61 - contrib/gdb/include/mpw/README | 1 - contrib/gdb/include/mpw/dir.h | 23 - contrib/gdb/include/mpw/dirent.h | 31 - contrib/gdb/include/mpw/fcntl.h | 124 - contrib/gdb/include/mpw/grp.h | 10 - contrib/gdb/include/mpw/mpw.h | 130 - contrib/gdb/include/mpw/pwd.h | 15 - contrib/gdb/include/mpw/spin.h | 64 - contrib/gdb/include/mpw/stat.h | 75 - contrib/gdb/include/mpw/sys/file.h | 1 - contrib/gdb/include/mpw/sys/param.h | 1 - contrib/gdb/include/mpw/sys/resource.h | 9 - contrib/gdb/include/mpw/sys/stat.h | 44 - contrib/gdb/include/mpw/sys/time.h | 13 - contrib/gdb/include/mpw/sys/types.h | 15 - contrib/gdb/include/mpw/utime.h | 7 - contrib/gdb/include/mpw/varargs.h | 9 - contrib/gdb/include/nlm/ChangeLog | 83 - contrib/gdb/include/nlm/alpha-ext.h | 166 - contrib/gdb/include/nlm/common.h | 124 - contrib/gdb/include/nlm/external.h | 174 - contrib/gdb/include/nlm/i386-ext.h | 116 - contrib/gdb/include/nlm/internal.h | 309 -- contrib/gdb/include/nlm/ppc-ext.h | 163 - contrib/gdb/include/nlm/sparc32-ext.h | 120 - contrib/gdb/include/oasys.h | 152 - contrib/gdb/include/obstack.h | 518 --- contrib/gdb/include/opcode/ChangeLog | 812 ----- contrib/gdb/include/opcode/a29k.h | 285 -- contrib/gdb/include/opcode/arm.h | 294 -- contrib/gdb/include/opcode/convex.h | 1711 --------- contrib/gdb/include/opcode/h8300.h | 550 --- contrib/gdb/include/opcode/hppa.h | 471 --- contrib/gdb/include/opcode/i386.h | 898 ----- contrib/gdb/include/opcode/i860.h | 491 --- contrib/gdb/include/opcode/i960.h | 509 --- contrib/gdb/include/opcode/m68k.h | 297 -- contrib/gdb/include/opcode/m88k.h | 923 ----- contrib/gdb/include/opcode/mips.h | 481 --- contrib/gdb/include/opcode/np1.h | 422 --- contrib/gdb/include/opcode/ns32k.h | 491 --- contrib/gdb/include/opcode/pn.h | 282 -- contrib/gdb/include/opcode/ppc.h | 248 -- contrib/gdb/include/opcode/pyr.h | 287 -- contrib/gdb/include/opcode/rs6k.h | 254 -- contrib/gdb/include/opcode/sparc.h | 220 -- contrib/gdb/include/opcode/tahoe.h | 213 -- contrib/gdb/include/opcode/vax.h | 382 --- contrib/gdb/include/os9k.h | 169 - contrib/gdb/include/progress.h | 37 - contrib/gdb/include/wait.h | 63 - contrib/gdb/libiberty/COPYING.LIB | 481 --- contrib/gdb/libiberty/ChangeLog | 1815 ---------- contrib/gdb/libiberty/Makefile.in | 321 -- contrib/gdb/libiberty/README | 129 - contrib/gdb/libiberty/alloca-botch.h | 5 - contrib/gdb/libiberty/alloca-norm.h | 16 - contrib/gdb/libiberty/alloca.c | 475 --- contrib/gdb/libiberty/argv.c | 328 -- contrib/gdb/libiberty/atexit.c | 14 - contrib/gdb/libiberty/basename.c | 43 - contrib/gdb/libiberty/bcmp.c | 49 - contrib/gdb/libiberty/bcopy.c | 35 - contrib/gdb/libiberty/bzero.c | 31 - contrib/gdb/libiberty/clock.c | 73 - contrib/gdb/libiberty/concat.c | 167 - contrib/gdb/libiberty/config.table | 63 - contrib/gdb/libiberty/config/mh-a68bsd | 2 - contrib/gdb/libiberty/config/mh-aix | 10 - contrib/gdb/libiberty/config/mh-apollo68 | 2 - contrib/gdb/libiberty/config/mh-cxux7 | 3 - contrib/gdb/libiberty/config/mh-go32 | 4 - contrib/gdb/libiberty/config/mh-hpbsd | 2 - contrib/gdb/libiberty/config/mh-irix4 | 4 - contrib/gdb/libiberty/config/mh-lynxos | 1 - contrib/gdb/libiberty/config/mh-ncr3000 | 19 - contrib/gdb/libiberty/config/mh-riscix | 6 - contrib/gdb/libiberty/config/mh-sysv | 1 - contrib/gdb/libiberty/config/mh-sysv4 | 3 - contrib/gdb/libiberty/config/mt-sunos4 | 2 - contrib/gdb/libiberty/config/mt-vxworks5 | 27 - contrib/gdb/libiberty/configure.bat | 15 - contrib/gdb/libiberty/configure.in | 77 - contrib/gdb/libiberty/copysign.c | 140 - contrib/gdb/libiberty/cplus-dem.c | 3019 ---------------- contrib/gdb/libiberty/dummy.c | 49 - contrib/gdb/libiberty/fdmatch.c | 73 - contrib/gdb/libiberty/floatformat.c | 385 --- contrib/gdb/libiberty/functions.def | 67 - contrib/gdb/libiberty/getcwd.c | 52 - contrib/gdb/libiberty/getopt.c | 757 ---- contrib/gdb/libiberty/getopt1.c | 190 - contrib/gdb/libiberty/getpagesize.c | 89 - contrib/gdb/libiberty/getruntime.c | 82 - contrib/gdb/libiberty/hex.c | 33 - contrib/gdb/libiberty/index.c | 11 - contrib/gdb/libiberty/insque.c | 50 - contrib/gdb/libiberty/makefile.dos | 29 - contrib/gdb/libiberty/memchr.c | 60 - contrib/gdb/libiberty/memcmp.c | 38 - contrib/gdb/libiberty/memcpy.c | 28 - contrib/gdb/libiberty/memmove.c | 18 - contrib/gdb/libiberty/memset.c | 19 - contrib/gdb/libiberty/mpw-config.in | 9 - contrib/gdb/libiberty/mpw-make.sed | 49 - contrib/gdb/libiberty/mpw.c | 1010 ------ contrib/gdb/libiberty/msdos.c | 15 - contrib/gdb/libiberty/obstack.c | 507 --- contrib/gdb/libiberty/random.c | 373 -- contrib/gdb/libiberty/rename.c | 22 - contrib/gdb/libiberty/rindex.c | 11 - contrib/gdb/libiberty/sigsetmask.c | 30 - contrib/gdb/libiberty/spaces.c | 71 - contrib/gdb/libiberty/strcasecmp.c | 81 - contrib/gdb/libiberty/strchr.c | 34 - contrib/gdb/libiberty/strdup.c | 10 - contrib/gdb/libiberty/strerror.c | 829 ----- contrib/gdb/libiberty/strncasecmp.c | 82 - contrib/gdb/libiberty/strrchr.c | 34 - contrib/gdb/libiberty/strsignal.c | 627 ---- contrib/gdb/libiberty/strstr.c | 51 - contrib/gdb/libiberty/strtod.c | 122 - contrib/gdb/libiberty/strtol.c | 143 - contrib/gdb/libiberty/strtoul.c | 110 - contrib/gdb/libiberty/tmpnam.c | 39 - contrib/gdb/libiberty/vasprintf.c | 165 - contrib/gdb/libiberty/vfork.c | 8 - contrib/gdb/libiberty/vfprintf.c | 13 - contrib/gdb/libiberty/vmsbuild.com | 142 - contrib/gdb/libiberty/vprintf.c | 11 - contrib/gdb/libiberty/vsprintf.c | 55 - contrib/gdb/libiberty/waitpid.c | 11 - contrib/gdb/libiberty/xatexit.c | 82 - contrib/gdb/libiberty/xexit.c | 36 - contrib/gdb/libiberty/xmalloc.c | 106 - contrib/gdb/libiberty/xstrdup.c | 17 - contrib/gdb/libiberty/xstrerror.c | 54 - contrib/gdb/opcodes/ChangeLog | 1772 ---------- contrib/gdb/opcodes/Makefile.in | 305 -- contrib/gdb/opcodes/config.in | 7 - contrib/gdb/opcodes/configure | 1538 --------- contrib/gdb/opcodes/configure.in | 216 -- contrib/gdb/opcodes/dis-buf.c | 70 - contrib/gdb/opcodes/disassemble.c | 166 - contrib/gdb/opcodes/i386-dis.c | 2031 ----------- contrib/gdb/opcodes/sysdep.h | 38 - contrib/gdb/opcodes/z8k-dis.c | 571 --- 300 files changed, 105553 deletions(-) delete mode 100644 contrib/gdb/bfd/COPYING delete mode 100644 contrib/gdb/bfd/Makefile.in delete mode 100644 contrib/gdb/bfd/PORTING delete mode 100644 contrib/gdb/bfd/TODO delete mode 100644 contrib/gdb/bfd/VERSION delete mode 100644 contrib/gdb/bfd/aclocal.m4 delete mode 100644 contrib/gdb/bfd/aout-target.h delete mode 100644 contrib/gdb/bfd/aout32.c delete mode 100644 contrib/gdb/bfd/aoutx.h delete mode 100644 contrib/gdb/bfd/archive.c delete mode 100644 contrib/gdb/bfd/archures.c delete mode 100644 contrib/gdb/bfd/bfd-in.h delete mode 100644 contrib/gdb/bfd/bfd.c delete mode 100644 contrib/gdb/bfd/binary.c delete mode 100644 contrib/gdb/bfd/cache.c delete mode 100644 contrib/gdb/bfd/coff-i386.c delete mode 100644 contrib/gdb/bfd/coffcode.h delete mode 100644 contrib/gdb/bfd/coffgen.c delete mode 100644 contrib/gdb/bfd/coffswap.h delete mode 100644 contrib/gdb/bfd/config.bfd delete mode 100644 contrib/gdb/bfd/config.in delete mode 100644 contrib/gdb/bfd/configure delete mode 100644 contrib/gdb/bfd/configure.host delete mode 100644 contrib/gdb/bfd/configure.in delete mode 100644 contrib/gdb/bfd/corefile.c delete mode 100644 contrib/gdb/bfd/cpu-i386.c delete mode 100644 contrib/gdb/bfd/dep-in.sed delete mode 100644 contrib/gdb/bfd/doc/ChangeLog delete mode 100644 contrib/gdb/bfd/doc/Makefile.in delete mode 100644 contrib/gdb/bfd/doc/bfd.texinfo delete mode 100644 contrib/gdb/bfd/doc/bfdsumm.texi delete mode 100644 contrib/gdb/bfd/doc/chew.c delete mode 100644 contrib/gdb/bfd/doc/doc.str delete mode 100644 contrib/gdb/bfd/doc/proto.str delete mode 100644 contrib/gdb/bfd/ecoff.c delete mode 100644 contrib/gdb/bfd/ecofflink.c delete mode 100644 contrib/gdb/bfd/elf-bfd.h delete mode 100644 contrib/gdb/bfd/elf.c delete mode 100644 contrib/gdb/bfd/format.c delete mode 100644 contrib/gdb/bfd/freebsd.h delete mode 100644 contrib/gdb/bfd/genlink.h delete mode 100644 contrib/gdb/bfd/hash.c delete mode 100644 contrib/gdb/bfd/hosts/alphalinux.h delete mode 100644 contrib/gdb/bfd/hosts/decstation.h delete mode 100644 contrib/gdb/bfd/hosts/delta68.h delete mode 100644 contrib/gdb/bfd/hosts/dpx2.h delete mode 100644 contrib/gdb/bfd/hosts/hp300bsd.h delete mode 100644 contrib/gdb/bfd/hosts/i386bsd.h delete mode 100644 contrib/gdb/bfd/hosts/i386linux.h delete mode 100644 contrib/gdb/bfd/hosts/i386mach3.h delete mode 100644 contrib/gdb/bfd/hosts/i386sco.h delete mode 100644 contrib/gdb/bfd/hosts/i860mach3.h delete mode 100644 contrib/gdb/bfd/hosts/m68kaux.h delete mode 100644 contrib/gdb/bfd/hosts/m68klinux.h delete mode 100644 contrib/gdb/bfd/hosts/m88kmach3.h delete mode 100644 contrib/gdb/bfd/hosts/mipsbsd.h delete mode 100644 contrib/gdb/bfd/hosts/mipsmach3.h delete mode 100644 contrib/gdb/bfd/hosts/news-mips.h delete mode 100644 contrib/gdb/bfd/hosts/news.h delete mode 100644 contrib/gdb/bfd/hosts/pc532mach.h delete mode 100644 contrib/gdb/bfd/hosts/riscos.h delete mode 100644 contrib/gdb/bfd/hosts/symmetry.h delete mode 100644 contrib/gdb/bfd/hosts/tahoe.h delete mode 100644 contrib/gdb/bfd/hosts/vaxbsd.h delete mode 100644 contrib/gdb/bfd/hosts/vaxult.h delete mode 100644 contrib/gdb/bfd/hosts/vaxult2.h delete mode 100644 contrib/gdb/bfd/i386aout.c delete mode 100644 contrib/gdb/bfd/i386bsd.c delete mode 100644 contrib/gdb/bfd/i386freebsd.c delete mode 100644 contrib/gdb/bfd/ihex.c delete mode 100644 contrib/gdb/bfd/init.c delete mode 100644 contrib/gdb/bfd/libaout.h delete mode 100644 contrib/gdb/bfd/libbfd.c delete mode 100644 contrib/gdb/bfd/libbfd.h delete mode 100644 contrib/gdb/bfd/libcoff.h delete mode 100644 contrib/gdb/bfd/libecoff.h delete mode 100644 contrib/gdb/bfd/linker.c delete mode 100644 contrib/gdb/bfd/opncls.c delete mode 100644 contrib/gdb/bfd/reloc.c delete mode 100644 contrib/gdb/bfd/section.c delete mode 100644 contrib/gdb/bfd/srec.c delete mode 100644 contrib/gdb/bfd/stab-syms.c delete mode 100644 contrib/gdb/bfd/syms.c delete mode 100644 contrib/gdb/bfd/sysdep.h delete mode 100644 contrib/gdb/bfd/targets.c delete mode 100644 contrib/gdb/bfd/tekhex.c delete mode 100644 contrib/gdb/bfd/trad-core.c delete mode 100644 contrib/gdb/include/COPYING delete mode 100644 contrib/gdb/include/ChangeLog delete mode 100644 contrib/gdb/include/ansidecl.h delete mode 100644 contrib/gdb/include/aout/ChangeLog delete mode 100644 contrib/gdb/include/aout/adobe.h delete mode 100644 contrib/gdb/include/aout/aout64.h delete mode 100644 contrib/gdb/include/aout/ar.h delete mode 100644 contrib/gdb/include/aout/dynix3.h delete mode 100644 contrib/gdb/include/aout/encap.h delete mode 100644 contrib/gdb/include/aout/host.h delete mode 100644 contrib/gdb/include/aout/hp.h delete mode 100644 contrib/gdb/include/aout/hp300hpux.h delete mode 100644 contrib/gdb/include/aout/hppa.h delete mode 100644 contrib/gdb/include/aout/ranlib.h delete mode 100644 contrib/gdb/include/aout/reloc.h delete mode 100644 contrib/gdb/include/aout/stab.def delete mode 100644 contrib/gdb/include/aout/stab_gnu.h delete mode 100644 contrib/gdb/include/aout/sun4.h delete mode 100644 contrib/gdb/include/bfdlink.h delete mode 100644 contrib/gdb/include/bout.h delete mode 100644 contrib/gdb/include/coff/ChangeLog delete mode 100644 contrib/gdb/include/coff/a29k.h delete mode 100644 contrib/gdb/include/coff/alpha.h delete mode 100644 contrib/gdb/include/coff/apollo.h delete mode 100644 contrib/gdb/include/coff/arm.h delete mode 100644 contrib/gdb/include/coff/aux-coff.h delete mode 100644 contrib/gdb/include/coff/ecoff.h delete mode 100644 contrib/gdb/include/coff/h8300.h delete mode 100644 contrib/gdb/include/coff/h8500.h delete mode 100644 contrib/gdb/include/coff/i386.h delete mode 100644 contrib/gdb/include/coff/i860.h delete mode 100644 contrib/gdb/include/coff/i960.h delete mode 100644 contrib/gdb/include/coff/internal.h delete mode 100644 contrib/gdb/include/coff/m68k.h delete mode 100644 contrib/gdb/include/coff/m88k.h delete mode 100644 contrib/gdb/include/coff/mips.h delete mode 100644 contrib/gdb/include/coff/pe.h delete mode 100644 contrib/gdb/include/coff/powerpc.h delete mode 100644 contrib/gdb/include/coff/rs6000.h delete mode 100644 contrib/gdb/include/coff/sh.h delete mode 100644 contrib/gdb/include/coff/sparc.h delete mode 100644 contrib/gdb/include/coff/sym.h delete mode 100644 contrib/gdb/include/coff/symconst.h delete mode 100644 contrib/gdb/include/coff/w65.h delete mode 100644 contrib/gdb/include/coff/we32k.h delete mode 100644 contrib/gdb/include/coff/z8k.h delete mode 100644 contrib/gdb/include/demangle.h delete mode 100644 contrib/gdb/include/dis-asm.h delete mode 100644 contrib/gdb/include/elf/ChangeLog delete mode 100644 contrib/gdb/include/elf/common.h delete mode 100644 contrib/gdb/include/elf/dwarf.h delete mode 100644 contrib/gdb/include/elf/external.h delete mode 100644 contrib/gdb/include/elf/hppa.h delete mode 100644 contrib/gdb/include/elf/internal.h delete mode 100644 contrib/gdb/include/elf/mips.h delete mode 100644 contrib/gdb/include/elf/ppc.h delete mode 100644 contrib/gdb/include/elf/sparc.h delete mode 100644 contrib/gdb/include/floatformat.h delete mode 100644 contrib/gdb/include/fopen-bin.h delete mode 100644 contrib/gdb/include/fopen-same.h delete mode 100644 contrib/gdb/include/gdbm.h delete mode 100644 contrib/gdb/include/getopt.h delete mode 100644 contrib/gdb/include/hp-symtab.h delete mode 100644 contrib/gdb/include/ieee.h delete mode 100644 contrib/gdb/include/libiberty.h delete mode 100644 contrib/gdb/include/mpw/ChangeLog delete mode 100644 contrib/gdb/include/mpw/README delete mode 100644 contrib/gdb/include/mpw/dir.h delete mode 100644 contrib/gdb/include/mpw/dirent.h delete mode 100644 contrib/gdb/include/mpw/fcntl.h delete mode 100644 contrib/gdb/include/mpw/grp.h delete mode 100644 contrib/gdb/include/mpw/mpw.h delete mode 100644 contrib/gdb/include/mpw/pwd.h delete mode 100644 contrib/gdb/include/mpw/spin.h delete mode 100644 contrib/gdb/include/mpw/stat.h delete mode 100644 contrib/gdb/include/mpw/sys/file.h delete mode 100644 contrib/gdb/include/mpw/sys/param.h delete mode 100644 contrib/gdb/include/mpw/sys/resource.h delete mode 100644 contrib/gdb/include/mpw/sys/stat.h delete mode 100644 contrib/gdb/include/mpw/sys/time.h delete mode 100644 contrib/gdb/include/mpw/sys/types.h delete mode 100644 contrib/gdb/include/mpw/utime.h delete mode 100644 contrib/gdb/include/mpw/varargs.h delete mode 100644 contrib/gdb/include/nlm/ChangeLog delete mode 100644 contrib/gdb/include/nlm/alpha-ext.h delete mode 100644 contrib/gdb/include/nlm/common.h delete mode 100644 contrib/gdb/include/nlm/external.h delete mode 100644 contrib/gdb/include/nlm/i386-ext.h delete mode 100644 contrib/gdb/include/nlm/internal.h delete mode 100644 contrib/gdb/include/nlm/ppc-ext.h delete mode 100644 contrib/gdb/include/nlm/sparc32-ext.h delete mode 100644 contrib/gdb/include/oasys.h delete mode 100644 contrib/gdb/include/obstack.h delete mode 100644 contrib/gdb/include/opcode/ChangeLog delete mode 100644 contrib/gdb/include/opcode/a29k.h delete mode 100644 contrib/gdb/include/opcode/arm.h delete mode 100644 contrib/gdb/include/opcode/convex.h delete mode 100644 contrib/gdb/include/opcode/h8300.h delete mode 100644 contrib/gdb/include/opcode/hppa.h delete mode 100644 contrib/gdb/include/opcode/i386.h delete mode 100644 contrib/gdb/include/opcode/i860.h delete mode 100644 contrib/gdb/include/opcode/i960.h delete mode 100644 contrib/gdb/include/opcode/m68k.h delete mode 100644 contrib/gdb/include/opcode/m88k.h delete mode 100644 contrib/gdb/include/opcode/mips.h delete mode 100644 contrib/gdb/include/opcode/np1.h delete mode 100644 contrib/gdb/include/opcode/ns32k.h delete mode 100644 contrib/gdb/include/opcode/pn.h delete mode 100644 contrib/gdb/include/opcode/ppc.h delete mode 100644 contrib/gdb/include/opcode/pyr.h delete mode 100644 contrib/gdb/include/opcode/rs6k.h delete mode 100644 contrib/gdb/include/opcode/sparc.h delete mode 100644 contrib/gdb/include/opcode/tahoe.h delete mode 100644 contrib/gdb/include/opcode/vax.h delete mode 100644 contrib/gdb/include/os9k.h delete mode 100644 contrib/gdb/include/progress.h delete mode 100644 contrib/gdb/include/wait.h delete mode 100644 contrib/gdb/libiberty/COPYING.LIB delete mode 100644 contrib/gdb/libiberty/ChangeLog delete mode 100644 contrib/gdb/libiberty/Makefile.in delete mode 100644 contrib/gdb/libiberty/README delete mode 100644 contrib/gdb/libiberty/alloca-botch.h delete mode 100644 contrib/gdb/libiberty/alloca-norm.h delete mode 100644 contrib/gdb/libiberty/alloca.c delete mode 100644 contrib/gdb/libiberty/argv.c delete mode 100644 contrib/gdb/libiberty/atexit.c delete mode 100644 contrib/gdb/libiberty/basename.c delete mode 100644 contrib/gdb/libiberty/bcmp.c delete mode 100644 contrib/gdb/libiberty/bcopy.c delete mode 100644 contrib/gdb/libiberty/bzero.c delete mode 100644 contrib/gdb/libiberty/clock.c delete mode 100644 contrib/gdb/libiberty/concat.c delete mode 100644 contrib/gdb/libiberty/config.table delete mode 100644 contrib/gdb/libiberty/config/mh-a68bsd delete mode 100644 contrib/gdb/libiberty/config/mh-aix delete mode 100644 contrib/gdb/libiberty/config/mh-apollo68 delete mode 100644 contrib/gdb/libiberty/config/mh-cxux7 delete mode 100644 contrib/gdb/libiberty/config/mh-go32 delete mode 100644 contrib/gdb/libiberty/config/mh-hpbsd delete mode 100644 contrib/gdb/libiberty/config/mh-irix4 delete mode 100644 contrib/gdb/libiberty/config/mh-lynxos delete mode 100644 contrib/gdb/libiberty/config/mh-ncr3000 delete mode 100644 contrib/gdb/libiberty/config/mh-riscix delete mode 100644 contrib/gdb/libiberty/config/mh-sysv delete mode 100644 contrib/gdb/libiberty/config/mh-sysv4 delete mode 100644 contrib/gdb/libiberty/config/mt-sunos4 delete mode 100644 contrib/gdb/libiberty/config/mt-vxworks5 delete mode 100644 contrib/gdb/libiberty/configure.bat delete mode 100644 contrib/gdb/libiberty/configure.in delete mode 100644 contrib/gdb/libiberty/copysign.c delete mode 100644 contrib/gdb/libiberty/cplus-dem.c delete mode 100644 contrib/gdb/libiberty/dummy.c delete mode 100644 contrib/gdb/libiberty/fdmatch.c delete mode 100644 contrib/gdb/libiberty/floatformat.c delete mode 100644 contrib/gdb/libiberty/functions.def delete mode 100644 contrib/gdb/libiberty/getcwd.c delete mode 100644 contrib/gdb/libiberty/getopt.c delete mode 100644 contrib/gdb/libiberty/getopt1.c delete mode 100644 contrib/gdb/libiberty/getpagesize.c delete mode 100644 contrib/gdb/libiberty/getruntime.c delete mode 100644 contrib/gdb/libiberty/hex.c delete mode 100644 contrib/gdb/libiberty/index.c delete mode 100644 contrib/gdb/libiberty/insque.c delete mode 100644 contrib/gdb/libiberty/makefile.dos delete mode 100644 contrib/gdb/libiberty/memchr.c delete mode 100644 contrib/gdb/libiberty/memcmp.c delete mode 100644 contrib/gdb/libiberty/memcpy.c delete mode 100644 contrib/gdb/libiberty/memmove.c delete mode 100644 contrib/gdb/libiberty/memset.c delete mode 100644 contrib/gdb/libiberty/mpw-config.in delete mode 100644 contrib/gdb/libiberty/mpw-make.sed delete mode 100644 contrib/gdb/libiberty/mpw.c delete mode 100644 contrib/gdb/libiberty/msdos.c delete mode 100644 contrib/gdb/libiberty/obstack.c delete mode 100644 contrib/gdb/libiberty/random.c delete mode 100644 contrib/gdb/libiberty/rename.c delete mode 100644 contrib/gdb/libiberty/rindex.c delete mode 100644 contrib/gdb/libiberty/sigsetmask.c delete mode 100644 contrib/gdb/libiberty/spaces.c delete mode 100644 contrib/gdb/libiberty/strcasecmp.c delete mode 100644 contrib/gdb/libiberty/strchr.c delete mode 100644 contrib/gdb/libiberty/strdup.c delete mode 100644 contrib/gdb/libiberty/strerror.c delete mode 100644 contrib/gdb/libiberty/strncasecmp.c delete mode 100644 contrib/gdb/libiberty/strrchr.c delete mode 100644 contrib/gdb/libiberty/strsignal.c delete mode 100644 contrib/gdb/libiberty/strstr.c delete mode 100644 contrib/gdb/libiberty/strtod.c delete mode 100644 contrib/gdb/libiberty/strtol.c delete mode 100644 contrib/gdb/libiberty/strtoul.c delete mode 100644 contrib/gdb/libiberty/tmpnam.c delete mode 100644 contrib/gdb/libiberty/vasprintf.c delete mode 100644 contrib/gdb/libiberty/vfork.c delete mode 100644 contrib/gdb/libiberty/vfprintf.c delete mode 100644 contrib/gdb/libiberty/vmsbuild.com delete mode 100644 contrib/gdb/libiberty/vprintf.c delete mode 100644 contrib/gdb/libiberty/vsprintf.c delete mode 100644 contrib/gdb/libiberty/waitpid.c delete mode 100644 contrib/gdb/libiberty/xatexit.c delete mode 100644 contrib/gdb/libiberty/xexit.c delete mode 100644 contrib/gdb/libiberty/xmalloc.c delete mode 100644 contrib/gdb/libiberty/xstrdup.c delete mode 100644 contrib/gdb/libiberty/xstrerror.c delete mode 100644 contrib/gdb/opcodes/ChangeLog delete mode 100644 contrib/gdb/opcodes/Makefile.in delete mode 100644 contrib/gdb/opcodes/config.in delete mode 100755 contrib/gdb/opcodes/configure delete mode 100644 contrib/gdb/opcodes/configure.in delete mode 100644 contrib/gdb/opcodes/dis-buf.c delete mode 100644 contrib/gdb/opcodes/disassemble.c delete mode 100644 contrib/gdb/opcodes/i386-dis.c delete mode 100644 contrib/gdb/opcodes/sysdep.h delete mode 100644 contrib/gdb/opcodes/z8k-dis.c (limited to 'contrib/gdb') diff --git a/contrib/gdb/bfd/COPYING b/contrib/gdb/bfd/COPYING deleted file mode 100644 index a43ea21..0000000 --- a/contrib/gdb/bfd/COPYING +++ /dev/null @@ -1,339 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 675 Mass Ave, Cambridge, MA 02139, USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - Appendix: How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) 19yy - - 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. - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) 19yy name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/contrib/gdb/bfd/Makefile.in b/contrib/gdb/bfd/Makefile.in deleted file mode 100644 index e531cf8..0000000 --- a/contrib/gdb/bfd/Makefile.in +++ /dev/null @@ -1,1090 +0,0 @@ -# Makefile template for Configure for the BFD library. -# Copyright (C) 1990, 91, 92, 93, 94, 95, 1996 -# Free Software Foundation, Inc. -# Written by Cygnus Support. -# -# 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. - -VPATH = @srcdir@ -srcdir = @srcdir@ - -prefix = @prefix@ - -program_transform_name = @program_transform_name@ -exec_prefix = @exec_prefix@ -bindir = $(exec_prefix)/bin -libdir = $(exec_prefix)/lib - -datadir = $(prefix)/lib -mandir = $(prefix)/man -man1dir = $(mandir)/man1 -man2dir = $(mandir)/man2 -man3dir = $(mandir)/man3 -man4dir = $(mandir)/man4 -man5dir = $(mandir)/man5 -man6dir = $(mandir)/man6 -man7dir = $(mandir)/man7 -man8dir = $(mandir)/man8 -man9dir = $(mandir)/man9 -infodir = $(prefix)/info -includedir = $(prefix)/include -oldincludedir = -docdir = doc - -SHELL = /bin/sh - -INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_DATA = @INSTALL_DATA@ - -AR = @AR@ -AR_FLAGS = rc -CC = @CC@ -CFLAGS = @CFLAGS@ -MAKEINFO = makeinfo -RANLIB = @RANLIB@ - -ALLLIBS = @ALLLIBS@ - -PICFLAG = @PICFLAG@ -SHLIB = @SHLIB@ -SHLIB_CC = @SHLIB_CC@ -SHLIB_CFLAGS = @SHLIB_CFLAGS@ -COMMON_SHLIB = @COMMON_SHLIB@ -SHLINK = @SHLINK@ - -SONAME = lib`echo $(SHLIB) | sed -e 's/^lib//' | sed '$(program_transform_name)'` - -CC_FOR_BUILD = @CC_FOR_BUILD@ - -INCDIR = $(srcdir)/../include -CSEARCH = -I. -I$(srcdir) -I$(INCDIR) -DEP = mkdep - -SUBDIRS = doc - -TARGETLIB = libbfd.a - -# bfd.h goes here, for now -BFD_H = bfd.h - -# Some of these files should be in BFD*_BACKENDS below, but some programs -# won't link without them. So, in order for some of the minimal-bfd -# hacks to work, they're also included here for now. -# gdb: elf.o -# objdump: elf.o -# -# Also, Jim Kingdon notes: -# Writing S-records should be included in all (or at least most) -# *-*-coff, *-*-aout, etc., configurations, because people will want to -# be able to use objcopy to create S-records. (S-records are not useful -# 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). -BFD_LIBS = \ - archive.o archures.o bfd.o cache.o coffgen.o corefile.o \ - format.o init.o libbfd.o opncls.o reloc.o \ - section.o syms.o targets.o hash.o linker.o \ - elf.o srec.o binary.o tekhex.o ihex.o stab-syms.o - -BFD_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 \ - elf.c srec.c binary.c tekhex.c ihex.c stab-syms.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.o \ - cpu-alpha.o \ - cpu-arm.o \ - cpu-h8300.o \ - cpu-h8500.o \ - cpu-hppa.o \ - cpu-i386.o \ - cpu-i860.o \ - cpu-i960.o \ - cpu-m68k.o \ - cpu-m88k.o \ - cpu-mips.o \ - cpu-ns32k.o \ - cpu-powerpc.o \ - cpu-rs6000.o \ - cpu-sh.o \ - cpu-sparc.o \ - cpu-vax.o \ - cpu-we32k.o \ - cpu-w65.o \ - cpu-z8k.o - -ALL_MACHINES_CFILES = \ - cpu-a29k.c \ - cpu-alpha.c \ - cpu-arm.c \ - cpu-h8300.c \ - cpu-h8500.c \ - cpu-hppa.c \ - cpu-i386.c \ - cpu-i860.c \ - cpu-i960.c \ - cpu-m68k.c \ - cpu-m88k.c \ - cpu-mips.c \ - cpu-ns32k.c \ - cpu-powerpc.c \ - cpu-rs6000.c \ - cpu-sh.c \ - cpu-sparc.c \ - cpu-vax.c \ - cpu-we32k.c \ - cpu-w65.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.o \ - aout-ns32k.o \ - aout0.o \ - aout32.o \ - bout.o \ - cf-i386lynx.o \ - cf-m68klynx.o \ - cf-sparclynx.o \ - coff-a29k.o \ - coff-apollo.o \ - coff-arm.o \ - coff-aux.o \ - coff-h8300.o \ - coff-h8500.o \ - coff-i386.o \ - coff-go32.o \ - coff-i860.o \ - coff-i960.o \ - coff-m68k.o \ - coff-m88k.o \ - coff-mips.o \ - coff-pmac.o \ - coff-rs6000.o \ - coff-sh.o \ - coff-sparc.o \ - coff-u68k.o \ - coff-we32k.o \ - coff-w65.o \ - coff-z8k.o \ - cofflink.o \ - ecoff.o \ - ecofflink.o \ - elf32-gen.o \ - elf32-hppa.o \ - elf32-i386.o \ - elf32-i860.o \ - elf32-m68k.o \ - elf32-m88k.o \ - elf32-mips.o \ - elf32-ppc.o \ - elf32-sparc.o \ - elf32.o \ - elflink.o \ - hp300hpux.o \ - som.o \ - i386aout.o \ - i386bsd.o \ - i386freebsd.o \ - i386linux.o \ - i386lynx.o \ - i386msdos.o \ - i386netbsd.o \ - i386mach3.o \ - i386os9k.o \ - ieee.o \ - m68klinux.o \ - m68klynx.o \ - m68knetbsd.o \ - m88kmach3.o \ - mipsbsd.o \ - newsos3.o \ - nlm.o \ - nlm32-i386.o \ - nlm32-sparc.o \ - nlm32-ppc.o \ - nlm32.o \ - ns32knetbsd.o \ - oasys.o \ - pc532-mach.o \ - pe-arm.o \ - pei-arm.o \ - pe-i386.o \ - pei-i386.o \ - pe-ppc.o \ - pei-ppc.o \ - reloc16.o \ - sparclynx.o \ - sparcnetbsd.o \ - sunos.o \ - tekhex.o \ - versados.o \ - xcofflink.o - -BFD32_BACKENDS_CFILES = \ - aout-adobe.c \ - aout-ns32k.c \ - aout0.c \ - aout32.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-pmac.c \ - coff-rs6000.c \ - coff-sh.c \ - coff-sparc.c \ - coff-u68k.c \ - coff-we32k.c \ - coff-w65.c \ - coff-z8k.c \ - cofflink.c \ - ecoff.c \ - ecofflink.c \ - elf32-gen.c \ - elf32-hppa.c \ - elf32-i386.c \ - elf32-i860.c \ - elf32-m68k.c \ - elf32-m88k.c \ - elf32-mips.c \ - elf32-ppc.c \ - elf32-sparc.c \ - elf32.c \ - elflink.c \ - hp300hpux.c \ - som.c \ - i386aout.c \ - i386bsd.c \ - i386freebsd.c \ - i386linux.c \ - i386lynx.c \ - i386msdos.c \ - i386netbsd.c \ - i386mach3.c \ - i386os9k.c \ - ieee.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 \ - pe-arm.c \ - pei-arm.c \ - pe-i386.c \ - pei-i386.c \ - pe-ppc.c \ - pei-ppc.c \ - reloc16.c \ - sparclynx.c \ - sparcnetbsd.c \ - sunos.c \ - tekhex.c \ - versados.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 = \ - aout64.o \ - coff-alpha.o \ - demo64.o \ - elf64-gen.o \ - elf64-sparc.o \ - elf64.o \ - nlm32-alpha.o \ - nlm64.o - -BFD64_BACKENDS_CFILES = \ - aout64.c \ - coff-alpha.c \ - demo64.c \ - elf64-gen.c \ - elf64-sparc.c \ - elf64.c \ - nlm32-alpha.c \ - nlm64.c - -OPTIONAL_BACKENDS = \ - aix386-core.o \ - hpux-core.o \ - irix-core.o \ - lynx-core.o \ - osf-core.o \ - trad-core.o \ - cisco-core.o - -OPTIONAL_BACKENDS_CFILES = \ - aix386-core.c \ - hpux-core.c \ - irix-core.c \ - lynx-core.c \ - osf-core.c \ - trad-core.c \ - cisco-core.c - -# These are defined by configure.in: -WORDSIZE = @wordsize@ -ALL_BACKENDS = @all_backends@ -BFD_BACKENDS = @bfd_backends@ -BFD_MACHINES = @bfd_machines@ -TDEFAULTS = @tdefaults@ - -all: - -FLAGS_TO_PASS = \ - "prefix=$(prefix)" \ - "exec_prefix=$(exec_prefix)" \ - "against=$(against)" \ - "AR=$(AR)" \ - "AR_FLAGS=$(AR_FLAGS)" \ - "CC=$(CC)" \ - "CC_FOR_BUILD=$(CC_FOR_BUILD)" \ - "CFLAGS=$(CFLAGS)" \ - "RANLIB=$(RANLIB)" \ - "MAKEINFO=$(MAKEINFO)" \ - "INSTALL=$(INSTALL)" \ - "INSTALL_DATA=$(INSTALL_DATA)" \ - "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" - -ALL_CFLAGS=@HDEFINES@ @COREFLAG@ @TDEFINES@ $(CSEARCH) $(CSWITCHES) $(CFLAGS) -.c.o: - if [ -n "$(PICFLAG)" ]; then \ - $(CC) -c $(PICFLAG) $(ALL_CFLAGS) $< -o pic/$@; \ - else true; fi - $(CC) -c $(ALL_CFLAGS) $< - -bfd_libs_here = -all_machines_here = -bfd32_backends_here = -core_files_here = -configs_not_included_in_all_targets_option_here = - -# C source files that correspond to .o's. -CFILES = \ - $(BFD_LIBS_CFILES) \ - $(ALL_MACHINES_CFILES) \ - $(BFD32_BACKENDS_CFILES) \ - $(BFD64_BACKENDS_CFILES) \ - $(OPTIONAL_BACKENDS_CFILES) \ - i386dynix.c hp300bsd.c - -HFILES = aout-target.h aoutf1.h aoutx.h coffcode.h \ - coffswap.h ecoffswap.h elf32-hppa.h elf32-target.h elf64-target.h \ - elfcode.h hppa_stubs.h libaout.h libbfd.h \ - libcoff.h libecoff.h elf-bfd.h libhppa.h libieee.h libnlm.h \ - liboasys.h nlm-target.h nlmcode.h som.h genlink.h netbsd.h - -all: Makefile $(ALLLIBS) @PICLIST@ - @$(MAKE) subdir_do DO=all "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) - -.NOEXPORT: -MAKEOVERRIDES= - -.PHONY: check installcheck -check: - @echo No testsuites exist for the BFD library. Nothing to check. - -installcheck: - @echo No testsuites exist for the BFD library. Nothing to check. - -info dvi : force - @$(MAKE) subdir_do DO=$@ "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) - -clean-info: - @$(MAKE) subdir_do DO=clean-info "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) - -install-info: force - @$(MAKE) subdir_do DO=install-info "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) - -diststuff: info - -# Various kinds of .o files to put in libbfd.a: -# BFD_LIBS Generic routines, always needed. -# BFD_BACKENDS Routines the configured targets need. -# BFD_MACHINES Architecture-specific routines the configured targets need. -# COREFILE Core file routines for a native configuration -OFILES = $(BFD_LIBS) $(BFD_BACKENDS) $(BFD_MACHINES) @COREFILE@ - -stamp-ofiles: Makefile - rm -f tofiles - f=""; \ - for i in $(OFILES) ; do \ - case " $$f " in \ - *" $$i "*) ;; \ - *) f="$$f $$i" ;; \ - esac ; \ - done ; \ - echo $$f > tofiles - $(srcdir)/../move-if-change tofiles ofiles - touch stamp-ofiles - -ofiles: stamp-ofiles ; @true - -$(TARGETLIB): $(OFILES) ofiles - rm -f $(TARGETLIB) - @echo ofiles = `cat ofiles` - $(AR) $(AR_FLAGS) $(TARGETLIB) `cat ofiles` - $(RANLIB) $(TARGETLIB) - -stamp-piclist: ofiles - rm -f tpiclist - if [ -n "$(PICFLAG)" ]; then \ - sed -e 's,\([^ ][^ ]*\),pic/\1,g' ofiles > tpiclist; \ - else \ - cp ofiles tpiclist; \ - fi - $(srcdir)/../move-if-change tpiclist piclist - touch stamp-piclist - -piclist: stamp-piclist ; @true - -$(SHLIB): stamp-picdir $(OFILES) piclist - rm -f $(SHLIB) - $(SHLIB_CC) $(SHLIB_CFLAGS) -o $(SHLIB) `cat piclist` - -# We make a link from libbfd.so to libbfd.so.VERSION for linking, and -# also a link from libTARGET-bfd.so.VERSION for running. -$(SHLINK): $(SHLIB) - ts=lib`echo $(SHLIB) | sed -e 's/^lib//' | sed -e '$(program_transform_name)'`; \ - if [ "$$ts" != "$(SHLIB)" ]; then \ - rm -f $$ts; \ - ln -sf $(SHLIB) $$ts; \ - else true; fi - rm -f $(SHLINK) - ln -sf $(SHLIB) $(SHLINK) - -# This target creates libTARGET-bfd.so.VERSION as a symlink to -# libbfd.so.VERSION. It is used on SunOS, which does not have SONAME. -stamp-tshlink: $(SHLIB) - tf=lib`echo $(SHLIB) | sed -e 's/^lib//' | sed '$(program_transform_name)'`; \ - if [ "$$tf" != "$(SHLIB)" ]; then \ - rm -f $$tf; \ - ln -sf $(SHLIB) $$tf; \ - else true; fi - touch stamp-tshlink - -# When compiling archures.c and targets.c, supply the default target -# info from configure. - -targets.o: targets.c Makefile - if [ -n "$(PICFLAG)" ]; then \ - $(CC) -c $(PICFLAG) $(TDEFAULTS) $(ALL_CFLAGS) $(srcdir)/targets.c -o pic/targets.o; \ - else true; fi - $(CC) -c $(TDEFAULTS) $(ALL_CFLAGS) $(srcdir)/targets.c - -archures.o: archures.c Makefile - if [ -n "$(PICFLAG)" ]; then \ - $(CC) -c $(PICFLAG) $(TDEFAULTS) $(ALL_CFLAGS) $(srcdir)/archures.c -o pic/archures.o; \ - else true; fi - $(CC) -c $(TDEFAULTS) $(ALL_CFLAGS) $(srcdir)/archures.c - -elf32-target.h : elfxx-target.h - rm -f elf32-target.h - sed -e s/NN/32/g < $(srcdir)/elfxx-target.h > elf32-target.new - mv -f elf32-target.new elf32-target.h - -elf64-target.h : elfxx-target.h - rm -f elf64-target.h - sed -e s/NN/64/g < $(srcdir)/elfxx-target.h > elf64-target.new - mv -f elf64-target.new elf64-target.h - -subdir_do: force - @for i in $(DODIRS); do \ - if [ -d ./$$i ] ; then \ - if (cd ./$$i; \ - $(MAKE) $(FLAGS_TO_PASS) $(DO)) ; then true ; \ - else exit 1 ; fi ; \ - else true ; fi ; \ - done - -tags etags: TAGS - -TAGS: force - etags $(INCDIR)/*.h $(srcdir)/*.h $(srcdir)/*.c - -do_mostlyclean: - rm -f *.o *~ core *.E *.p *.ip aout-params.h gen-aout config.log \ - pic/*.o -do_clean: do_mostlyclean - rm -f libbfd.a TAGS bfd.h stmp-bfd.h ofiles stamp-ofiles \ - elf32-target.h elf64-target.h $(SHLIB) $(SHLINK) \ - piclist stamp-piclist -do_distclean: do_clean - rm -f Makefile config.status config.cache config.h stamp-h - rm -rf pic stamp-picdir -do_maintainer_clean: do_distclean - rm -f $(srcdir)/bfd-in2.h $(srcdir)/libbfd.h $(srcdir)/libcoff.h - -mostlyclean: do_mostlyclean - $(MAKE) subdir_do DO=mostlyclean "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) -clean: do_clean - $(MAKE) subdir_do DO=clean "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) -distclean: - $(MAKE) subdir_do DO=distclean "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) - $(MAKE) do_distclean -clobber maintainer-clean realclean: - @echo "This command is intended for maintainers to use;" - @echo "it deletes files that may require special tools to rebuild." - $(MAKE) subdir_do DO=maintainer-clean "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) - $(MAKE) do_maintainer_clean - -BFD_H_DEPS= $(INCDIR)/ansidecl.h $(INCDIR)/obstack.h -LOCAL_H_DEPS= libbfd.h sysdep.h config.h -$(BFD_LIBS): $(BFD_H) $(BFD_H_DEPS) $(LOCAL_H_DEPS) -$(BFD_MACHINES): $(BFD_H) $(BFD_H_DEPS) $(LOCAL_H_DEPS) -$(BFD_BACKENDS): $(BFD_H) $(BFD_H_DEPS) $(LOCAL_H_DEPS) -$(OPTIONAL_BACKENDS): $(BFD_H) $(BFD_H_DEPS) $(LOCAL_H_DEPS) - -# Get around a Sun Make bug in SunOS 4.1.1 with VPATH -cpu-i386.o:cpu-i386.c -cpu-z8k.o: cpu-z8k.c -cpu-h8500.o: cpu-h8500.c -cpu-we32k.o: cpu-we32k.c - -saber: - #suppress 65 on bfd_map_over_sections - #suppress 66 on bfd_map_over_sections - #suppress 67 on bfd_map_over_sections - #suppress 68 on bfd_map_over_sections - #suppress 69 on bfd_map_over_sections - #suppress 70 on bfd_map_over_sections - #suppress 110 in bfd_map_over_sections - #suppress 112 in bfd_map_over_sections - #suppress 530 - #suppress 590 in swap_exec_header - #suppress 590 in _bfd_dummy_core_file_matches_executable_p - #suppress 590 in bfd_dont_truncate_arname - #suppress 590 on ignore - #suppress 590 on abfd - #setopt load_flags $(CFLAGS) - #load $(CFILES) - - -#----------------------------------------------------------------------------- -# 'STANDARD' GNU/960 TARGETS BELOW THIS POINT -# -# 'VERSION' file must be present and contain a string of the form "x.y" -#----------------------------------------------------------------------------- - -ver960.c: FORCE - rm -f ver960.c - echo "char ${TARG}_ver[]= \"${TARG} `cat VERSION`, `date`\";" > ver960.c - - -# This target should be invoked before building a new release. -# 'VERSION' file must be present and contain a string of the form "x.y" -# -roll: - @V=`cat VERSION` ; \ - MAJ=`sed 's/\..*//' VERSION` ; \ - MIN=`sed 's/.*\.//' VERSION` ; \ - V=$$MAJ.`expr $$MIN + 1` ; \ - rm -f VERSION ; \ - echo $$V >VERSION ; \ - echo Version $$V - -# Dummy target to force execution of dependent targets. -# -force: - -install: $(ALLLIBS) - for f in $(ALLLIBS); do \ - if [ "$$f" = "stamp-tshlink" ]; then \ - continue; \ - fi; \ - tf=lib`echo $$f | sed -e 's/^lib//' | sed '$(program_transform_name)'`; \ - rm -f $(libdir)/$$tf; \ - if [ "$$f" = "$(SHLINK)" ]; then \ - ts=lib`echo $(SHLIB) | sed -e 's/^lib//' | sed '$(program_transform_name)'`; \ - ln -sf $$ts $(libdir)/$$tf; \ - elif [ "$$f" = "$(SHLIB)" ]; then \ - $(INSTALL_PROGRAM) $$f $(libdir)/$$tf; \ - else \ - $(INSTALL_DATA) $$f $(libdir)/$$tf; \ - $(RANLIB) $(libdir)/$$tf; \ - chmod a-x $(libdir)/$$tf; \ - fi; \ - done -# Install BFD include file, and others that it needs. Install them -# both in GCC's include directory, and in the system include dir -# if configured as $(oldincludedir) -- which it usually isnt. - $(INSTALL_DATA) $(BFD_H) $(includedir)/bfd.h - $(INSTALL_DATA) $(INCDIR)/ansidecl.h $(includedir)/ansidecl.h - $(INSTALL_DATA) $(INCDIR)/bfdlink.h $(includedir)/bfdlink.h - $(INSTALL_DATA) $(INCDIR)/obstack.h $(includedir)/obstack.h - -if test -z "$(oldincludedir)"; then true; else \ - test -d $(oldincludedir) || mkdir $(oldincludedir); \ - $(INSTALL_DATA) $(BFD_H) $(oldincludedir)/bfd.h; \ - $(INSTALL_DATA) $(INCDIR)/ansidecl.h $(oldincludedir)/ansidecl.h; \ - $(INSTALL_DATA) $(INCDIR)/bfdlink.h $(oldincludedir)/bfdlink.h; \ - $(INSTALL_DATA) $(INCDIR)/obstack.h $(oldincludedir)/obstack.h; \ - $(MAKE) subdir_do DO=install "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS); \ - fi - -Makefile: Makefile.in config.status - CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) ./config.status - -config.h: stamp-h ; @true -stamp-h: config.in config.status - CONFIG_FILES= CONFIG_HEADERS=config.h:config.in $(SHELL) ./config.status - -config.status: configure configure.host config.bfd - $(SHELL) config.status --recheck - -# Have to get rid of .dep1 here so that "$?" later includes all of $(CFILES). -.dep: dep.sed $(CFILES) $(HFILES) bfd.h - rm -f .dep1 - $(MAKE) DEP=$(DEP) .dep1 - sed -f dep.sed <.dep1 >.dep - -# This rule really wants a mkdep that runs "gcc -MM". -# The NetBSD mkdep overwrites any existing file contents, and doesn't insert -# the "DO NOT DELETE" line. -# Other mkdep versions require a file that already exists, and do insert it. -# Hence the weirdness.... -.dep1: $(CFILES) - rm -f .dep2 .dep2a - echo '# DO NOT DELETE THIS LINE -- mkdep uses it.' > .dep2 - echo > .dep2a - $(DEP) -f .dep2a $(ALL_CFLAGS) $? - sed -e '/DO NOT DELETE/d' -e '/^$$/d' < .dep2a >> .dep2 - rm -f .dep2a - $(srcdir)/../move-if-change .dep2 .dep1 - -dep.sed: dep-in.sed config.status - sed <$(srcdir)/dep-in.sed >dep.sed \ - -e 's!@BFD_H@!$(BFD_H)!' \ - -e 's!@INCDIR@!$(INCDIR)!' \ - -e 's!@SRCDIR@!$(srcdir)!' - -dep: .dep - sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < Makefile > tmp-Makefile - cat .dep >> tmp-Makefile - $(srcdir)/../move-if-change tmp-Makefile Makefile - -dep-in: .dep - sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < $(srcdir)/Makefile.in > tmp-Makefile.in - cat .dep >> tmp-Makefile.in - $(srcdir)/../move-if-change tmp-Makefile.in $(srcdir)/Makefile.in - -host-aout.o: Makefile - -# The following program can be used to generate a simple config file -# which can be folded into an h-XXX file for a new host, with some editing. -aout-params.h: gen-aout - ./gen-aout host > aout-params.h -gen-aout: $(srcdir)/gen-aout.c Makefile - $(CC) -o gen-aout $(CFLAGS) $(LFLAGS) $(srcdir)/gen-aout.c - -BFDIN_H= $(srcdir)/bfd-in2.h - -$(BFD_H): stmp-bfd.h ; @true - -stmp-bfd.h : $(srcdir)/bfd-in2.h Makefile - rm -f bfd.h-new - sed -e 's/@WORDSIZE@/$(WORDSIZE)/' \ - -e "s/@VERSION@/`cat $(srcdir)/VERSION`/" \ - -e 's/@BFD_HOST_64BIT_LONG@/@HOST_64BIT_LONG@/' \ - < $(srcdir)/bfd-in2.h \ - > bfd.h-new - $(srcdir)/../move-if-change bfd.h-new $(BFD_H) - touch stmp-bfd.h - -# Could really use a "copy-if-change"... -headers: - (cd $(docdir); $(MAKE) protos $(FLAGS_TO_PASS)) - cp $(docdir)/bfd.h bfd-in2.h-new - $(srcdir)/../move-if-change bfd-in2.h-new $(srcdir)/bfd-in2.h - cp $(docdir)/libbfd.h libbfd.h-new - $(srcdir)/../move-if-change libbfd.h-new $(srcdir)/libbfd.h - cp $(docdir)/libcoff.h libcoff.h-new - $(srcdir)/../move-if-change libcoff.h-new $(srcdir)/libcoff.h - -# The rules for the generated header files are here so that people can -# type `make bfd-in2.h' if they remove it. They are not run by default. -$(srcdir)/bfd-in2.h: - (cd $(docdir); $(MAKE) bfd.h $(FLAGS_TO_PASS)) - cp $(docdir)/bfd.h bfd-in2.h-new - $(srcdir)/../move-if-change bfd-in2.h-new $(srcdir)/bfd-in2.h -$(srcdir)/libbfd.h: - (cd $(docdir); $(MAKE) libbfd.h $(FLAGS_TO_PASS)) - cp $(docdir)/libbfd.h libbfd.h-new - $(srcdir)/../move-if-change libbfd.h-new $(srcdir)/libbfd.h -$(srcdir)/libcoff.h: - (cd $(docdir); $(MAKE) libcoff.h $(FLAGS_TO_PASS)) - cp $(docdir)/libcoff.h libcoff.h-new - $(srcdir)/../move-if-change libcoff.h-new $(srcdir)/libcoff.h - -bfd.info: - (cd $(docdir); $(MAKE) bfd.info $(FLAGS_TO_PASS)) - -bfd.dvi: - (cd $(docdir); $(MAKE) bfd.dvi $(FLAGS_TO_PASS)) - -bfd.ps: - (cd $(docdir); $(MAKE) bfd.ps $(FLAGS_TO_PASS)) - - -$(OFILES): stamp-picdir - -stamp-picdir: - if [ -n "$(PICFLAG)" ] && [ ! -d pic ]; then \ - mkdir pic; \ - else true; fi - touch stamp-picdir - -# What appears below is generated by a hacked mkdep using gcc -MM. - -# DO NOT DELETE THIS LINE -- mkdep uses it. -# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. -archive.o: archive.c $(INCDIR)/aout/ar.h $(INCDIR)/aout/ranlib.h -archures.o: archures.c -bfd.o: bfd.c $(INCDIR)/bfdlink.h $(INCDIR)/coff/internal.h \ - $(INCDIR)/coff/sym.h libcoff.h libecoff.h $(INCDIR)/coff/ecoff.h \ - elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h -cache.o: cache.c -coffgen.o: coffgen.c $(INCDIR)/coff/internal.h libcoff.h \ - $(INCDIR)/bfdlink.h -corefile.o: corefile.c -format.o: format.c -init.o: init.c -libbfd.o: libbfd.c -opncls.o: opncls.c -reloc.o: reloc.c $(INCDIR)/bfdlink.h -section.o: section.c -syms.o: syms.c $(INCDIR)/bfdlink.h $(INCDIR)/aout/stab_gnu.h \ - $(INCDIR)/aout/stab.def -targets.o: targets.c -hash.o: hash.c -linker.o: linker.c $(INCDIR)/bfdlink.h genlink.h -elf.o: elf.c $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \ - $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h -srec.o: srec.c $(INCDIR)/libiberty.h -binary.o: binary.c -tekhex.o: tekhex.c $(INCDIR)/libiberty.h -ihex.o: ihex.c $(INCDIR)/libiberty.h -stab-syms.o: stab-syms.c libaout.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab.def -cpu-a29k.o: cpu-a29k.c -cpu-alpha.o: cpu-alpha.c -cpu-arm.o: cpu-arm.c -cpu-h8300.o: cpu-h8300.c -cpu-h8500.o: cpu-h8500.c -cpu-hppa.o: cpu-hppa.c -cpu-i386.o: cpu-i386.c -cpu-i860.o: cpu-i860.c -cpu-i960.o: cpu-i960.c -cpu-m68k.o: cpu-m68k.c -cpu-m88k.o: cpu-m88k.c -cpu-mips.o: cpu-mips.c -cpu-ns32k.o: cpu-ns32k.c -cpu-powerpc.o: cpu-powerpc.c -cpu-rs6000.o: cpu-rs6000.c -cpu-sh.o: cpu-sh.c -cpu-sparc.o: cpu-sparc.c -cpu-vax.o: cpu-vax.c -cpu-we32k.o: cpu-we32k.c -cpu-w65.o: cpu-w65.c -cpu-z8k.o: cpu-z8k.c -aout-adobe.o: aout-adobe.c $(INCDIR)/aout/adobe.h $(INCDIR)/aout/stab_gnu.h \ - $(INCDIR)/aout/stab.def libaout.h $(INCDIR)/bfdlink.h -aout-ns32k.o: aout-ns32k.c $(INCDIR)/aout/aout64.h \ - libaout.h $(INCDIR)/bfdlink.h -aout0.o: aout0.c aoutf1.h $(INCDIR)/aout/sun4.h libaout.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \ - $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h aout-target.h -aout32.o: aout32.c aoutx.h $(INCDIR)/bfdlink.h libaout.h \ - $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ - $(INCDIR)/aout/ar.h -bout.o: bout.c $(INCDIR)/bfdlink.h genlink.h $(INCDIR)/bout.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def libaout.h -cf-i386lynx.o: cf-i386lynx.c coff-i386.c $(INCDIR)/coff/i386.h \ - $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h \ - coffcode.h coffswap.h -cf-m68klynx.o: cf-m68klynx.c coff-m68k.c $(INCDIR)/coff/m68k.h \ - $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h \ - coffcode.h coffswap.h -cf-sparclynx.o: cf-sparclynx.c coff-sparc.c $(INCDIR)/coff/sparc.h \ - $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h \ - coffcode.h coffswap.h -coff-a29k.o: coff-a29k.c $(INCDIR)/coff/a29k.h $(INCDIR)/coff/internal.h \ - libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h -coff-apollo.o: coff-apollo.c $(INCDIR)/coff/apollo.h \ - $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h \ - coffcode.h coffswap.h -coff-arm.o: coff-arm.c $(INCDIR)/coff/arm.h $(INCDIR)/coff/internal.h \ - libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h -coff-aux.o: coff-aux.c $(INCDIR)/coff/aux-coff.h $(INCDIR)/coff/internal.h \ - $(INCDIR)/coff/m68k.h coff-m68k.c libcoff.h $(INCDIR)/bfdlink.h \ - coffcode.h coffswap.h -coff-h8300.o: coff-h8300.c $(INCDIR)/bfdlink.h $(INCDIR)/coff/h8300.h \ - $(INCDIR)/coff/internal.h libcoff.h coffcode.h coffswap.h -coff-h8500.o: coff-h8500.c $(INCDIR)/bfdlink.h $(INCDIR)/coff/h8500.h \ - $(INCDIR)/coff/internal.h libcoff.h coffcode.h coffswap.h -coff-i386.o: coff-i386.c $(INCDIR)/coff/i386.h $(INCDIR)/coff/internal.h \ - libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h -coff-i860.o: coff-i860.c $(INCDIR)/coff/i860.h $(INCDIR)/coff/internal.h \ - libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h -coff-go32.o: coff-go32.c coff-i386.c $(INCDIR)/coff/i386.h \ - $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h \ - coffcode.h coffswap.h -coff-i960.o: coff-i960.c $(INCDIR)/coff/i960.h $(INCDIR)/coff/internal.h \ - libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h -coff-m68k.o: coff-m68k.c $(INCDIR)/coff/m68k.h $(INCDIR)/coff/internal.h \ - libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h -coff-m88k.o: coff-m88k.c $(INCDIR)/coff/m88k.h $(INCDIR)/coff/internal.h \ - libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h -coff-mips.o: coff-mips.c $(INCDIR)/bfdlink.h $(INCDIR)/coff/internal.h \ - $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h $(INCDIR)/coff/ecoff.h \ - $(INCDIR)/coff/mips.h libcoff.h libecoff.h coffswap.h \ - ecoffswap.h -coff-pmac.o: coff-pmac.c coff-rs6000.c $(INCDIR)/coff/internal.h \ - $(INCDIR)/coff/rs6000.h libcoff.h $(INCDIR)/bfdlink.h \ - coffcode.h coffswap.h -coff-rs6000.o: coff-rs6000.c $(INCDIR)/coff/internal.h \ - $(INCDIR)/coff/rs6000.h libcoff.h $(INCDIR)/bfdlink.h \ - coffcode.h coffswap.h -coff-sh.o: coff-sh.c $(INCDIR)/bfdlink.h $(INCDIR)/coff/sh.h \ - $(INCDIR)/coff/internal.h libcoff.h coffcode.h coffswap.h -coff-sparc.o: coff-sparc.c $(INCDIR)/coff/sparc.h $(INCDIR)/coff/internal.h \ - libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h -coff-u68k.o: coff-u68k.c coff-m68k.c $(INCDIR)/coff/m68k.h \ - $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h \ - coffcode.h coffswap.h -coff-we32k.o: coff-we32k.c $(INCDIR)/coff/we32k.h $(INCDIR)/coff/internal.h \ - libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h -coff-w65.o: coff-w65.c $(INCDIR)/bfdlink.h $(INCDIR)/coff/w65.h \ - $(INCDIR)/coff/internal.h libcoff.h coffcode.h coffswap.h -coff-z8k.o: coff-z8k.c $(INCDIR)/bfdlink.h $(INCDIR)/coff/z8k.h \ - $(INCDIR)/coff/internal.h libcoff.h coffcode.h coffswap.h -cofflink.o: cofflink.c $(INCDIR)/bfdlink.h $(INCDIR)/coff/internal.h \ - libcoff.h -ecoff.o: ecoff.c $(INCDIR)/bfdlink.h $(INCDIR)/aout/ar.h \ - $(INCDIR)/aout/ranlib.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ - libaout.h $(INCDIR)/aout/aout64.h $(INCDIR)/coff/internal.h \ - $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h $(INCDIR)/coff/ecoff.h \ - libcoff.h libecoff.h -ecofflink.o: ecofflink.c $(INCDIR)/bfdlink.h $(INCDIR)/aout/stab_gnu.h \ - $(INCDIR)/aout/stab.def $(INCDIR)/coff/internal.h $(INCDIR)/coff/sym.h \ - $(INCDIR)/coff/symconst.h $(INCDIR)/coff/ecoff.h -elf32-gen.o: elf32-gen.c elf-bfd.h $(INCDIR)/elf/common.h \ - $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ - elf32-target.h -elf32-hppa.o: elf32-hppa.c $(INCDIR)/bfdlink.h elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - elf32-hppa.h libhppa.h $(INCDIR)/elf/hppa.h hppa_stubs.h \ - elf32-target.h -elf32-i386.o: elf32-i386.c $(INCDIR)/bfdlink.h elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - elf32-target.h -elf32-i860.o: elf32-i860.c elf-bfd.h $(INCDIR)/elf/common.h \ - $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ - elf32-target.h -elf32-m68k.o: elf32-m68k.c $(INCDIR)/bfdlink.h elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - elf32-target.h -elf32-m88k.o: elf32-m88k.c elf-bfd.h $(INCDIR)/elf/common.h \ - $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ - elf32-target.h -elf32-mips.o: elf32-mips.c $(INCDIR)/bfdlink.h genlink.h \ - elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/elf/mips.h $(INCDIR)/coff/sym.h \ - $(INCDIR)/coff/symconst.h $(INCDIR)/coff/internal.h \ - $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/mips.h ecoffswap.h \ - elf32-target.h -elf32-ppc.o: elf32-ppc.c $(INCDIR)/bfdlink.h elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/elf/ppc.h elf32-target.h -elf32-sparc.o: elf32-sparc.c $(INCDIR)/bfdlink.h elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/elf/sparc.h elf32-target.h -elf32.o: elf32.c elfcode.h $(INCDIR)/bfdlink.h elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - elfcore.h elflink.h -elflink.o: elflink.c $(INCDIR)/bfdlink.h elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h -hp300hpux.o: hp300hpux.c $(INCDIR)/aout/hp300hpux.h \ - aoutx.h $(INCDIR)/bfdlink.h libaout.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \ - aout-target.h -som.o: som.c -i386aout.o: i386aout.c 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 -i386bsd.o: i386bsd.c 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 -i386freebsd.o: i386freebsd.c freebsd.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 -i386linux.o: i386linux.c $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \ - $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h libaout.h \ - $(INCDIR)/bfdlink.h aout-target.h -i386lynx.o: i386lynx.c libaout.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/aout/aout64.h aout-target.h $(INCDIR)/aout/stab_gnu.h \ - $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h -i386msdos.o: i386msdos.c libaout.h $(INCDIR)/bfdlink.h -i386netbsd.o: i386netbsd.c netbsd.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 -i386mach3.o: i386mach3.c $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \ - $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h libaout.h \ - $(INCDIR)/bfdlink.h aout-target.h -i386os9k.o: i386os9k.c $(INCDIR)/bfdlink.h libaout.h \ - $(INCDIR)/os9k.h -ieee.o: ieee.c $(INCDIR)/ieee.h libieee.h -m68klinux.o: m68klinux.c $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \ - $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h libaout.h \ - $(INCDIR)/bfdlink.h aout-target.h -m68klynx.o: m68klynx.c libaout.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/aout/aout64.h aout-target.h $(INCDIR)/aout/stab_gnu.h \ - $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h -m68knetbsd.o: m68knetbsd.c netbsd.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 -m88kmach3.o: m88kmach3.c 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 -mipsbsd.o: mipsbsd.c 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 -newsos3.o: newsos3.c $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \ - $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h libaout.h \ - $(INCDIR)/bfdlink.h aout-target.h -nlm.o: nlm.c libnlm.h $(INCDIR)/nlm/common.h $(INCDIR)/nlm/internal.h \ - $(INCDIR)/nlm/external.h -nlm32-i386.o: nlm32-i386.c $(INCDIR)/nlm/i386-ext.h \ - libnlm.h $(INCDIR)/nlm/common.h $(INCDIR)/nlm/internal.h \ - $(INCDIR)/nlm/external.h nlmswap.h nlm-target.h -nlm32-sparc.o: nlm32-sparc.c $(INCDIR)/nlm/sparc32-ext.h \ - libnlm.h $(INCDIR)/nlm/common.h $(INCDIR)/nlm/internal.h \ - $(INCDIR)/nlm/external.h nlmswap.h nlm-target.h -nlm32-ppc.o: nlm32-ppc.c $(INCDIR)/nlm/ppc-ext.h libnlm.h \ - $(INCDIR)/nlm/common.h $(INCDIR)/nlm/internal.h $(INCDIR)/nlm/external.h \ - nlmswap.h nlm-target.h -nlm32.o: nlm32.c nlmcode.h libnlm.h $(INCDIR)/nlm/common.h \ - $(INCDIR)/nlm/internal.h $(INCDIR)/nlm/external.h -ns32knetbsd.o: ns32knetbsd.c netbsd.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 -oasys.o: oasys.c $(INCDIR)/oasys.h liboasys.h -pc532-mach.o: pc532-mach.c libaout.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/aout/aout64.h aout-target.h $(INCDIR)/aout/stab_gnu.h \ - $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h -pe-arm.o: pe-arm.c coff-arm.c $(INCDIR)/coff/arm.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \ - $(INCDIR)/bfdlink.h coffcode.h peicode.h -pei-arm.o: pei-arm.c coff-arm.c $(INCDIR)/coff/arm.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \ - $(INCDIR)/bfdlink.h coffcode.h peicode.h -pe-i386.o: pe-i386.c coff-i386.c $(INCDIR)/coff/i386.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \ - $(INCDIR)/bfdlink.h coffcode.h peicode.h -pei-i386.o: pei-i386.c coff-i386.c $(INCDIR)/coff/i386.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \ - $(INCDIR)/bfdlink.h coffcode.h peicode.h -pe-ppc.o: pe-ppc.c coff-ppc.c $(INCDIR)/coff/powerpc.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \ - $(INCDIR)/bfdlink.h coffcode.h peicode.h -pei-ppc.o: pei-ppc.c coff-ppc.c $(INCDIR)/coff/powerpc.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \ - $(INCDIR)/bfdlink.h coffcode.h peicode.h -reloc16.o: reloc16.c $(INCDIR)/bfdlink.h genlink.h \ - $(INCDIR)/coff/internal.h libcoff.h -sparclynx.o: sparclynx.c $(INCDIR)/aout/sun4.h libaout.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \ - $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h aout-target.h -sparcnetbsd.o: sparcnetbsd.c netbsd.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 -sunos.o: sunos.c $(INCDIR)/bfdlink.h libaout.h aoutf1.h \ - $(INCDIR)/aout/sun4.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \ - $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h aout-target.h -versados.o: versados.c $(INCDIR)/libiberty.h -xcofflink.o: xcofflink.c $(INCDIR)/bfdlink.h $(INCDIR)/coff/internal.h \ - libcoff.h -aout64.o: aout64.c aoutx.h $(INCDIR)/bfdlink.h libaout.h \ - $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ - $(INCDIR)/aout/ar.h -coff-alpha.o: coff-alpha.c $(INCDIR)/bfdlink.h $(INCDIR)/coff/internal.h \ - $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h $(INCDIR)/coff/ecoff.h \ - $(INCDIR)/coff/alpha.h $(INCDIR)/aout/ar.h libcoff.h \ - libecoff.h coffswap.h ecoffswap.h -demo64.o: demo64.c aoutf1.h $(INCDIR)/aout/sun4.h libaout.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \ - $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h aout-target.h -elf64-gen.o: elf64-gen.c elf-bfd.h $(INCDIR)/elf/common.h \ - $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ - elf64-target.h -elf64-sparc.o: elf64-sparc.c elf-bfd.h $(INCDIR)/elf/common.h \ - $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/elf/sparc.h elf64-target.h -elf64.o: elf64.c elfcode.h $(INCDIR)/bfdlink.h elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - elfcore.h elflink.h -nlm32-alpha.o: nlm32-alpha.c $(INCDIR)/nlm/alpha-ext.h \ - libnlm.h $(INCDIR)/nlm/common.h $(INCDIR)/nlm/internal.h \ - $(INCDIR)/nlm/external.h nlmswap.h nlm-target.h -nlm64.o: nlm64.c nlmcode.h libnlm.h $(INCDIR)/nlm/common.h \ - $(INCDIR)/nlm/internal.h $(INCDIR)/nlm/external.h -aix386-core.o: aix386-core.c $(INCDIR)/coff/i386.h \ - $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h -hpux-core.o: hpux-core.c -irix-core.o: irix-core.c -lynx-core.o: lynx-core.c -osf-core.o: osf-core.c -trad-core.o: trad-core.c libaout.h $(INCDIR)/bfdlink.h -cisco-core.o: cisco-core.c -i386dynix.o: i386dynix.c $(INCDIR)/aout/dynix3.h aoutx.h \ - $(INCDIR)/bfdlink.h libaout.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \ - aout-target.h -hp300bsd.o: hp300bsd.c 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 -# IF YOU PUT ANYTHING HERE IT WILL GO AWAY diff --git a/contrib/gdb/bfd/PORTING b/contrib/gdb/bfd/PORTING deleted file mode 100644 index c8bfd77..0000000 --- a/contrib/gdb/bfd/PORTING +++ /dev/null @@ -1,83 +0,0 @@ - Preliminary Notes on Porting BFD - -------------------------------- - -The 'host' is the system a tool runs *on*. -The 'target' is the system a tool runs *for*, i.e. -a tool can read/write the binaries of the target. - -Porting to a new host ---------------------- -Pick a name for your host. Call that . -( might be sun4, ...) -Create a file hosts/.mh. - -Porting to a new target ------------------------ -Pick a name for your target. Call that . -Call the name for your CPU architecture . -You need to create .c and config/.mt, -and add a case for it to a case statements in bfd/configure.host and -bfd/config.bfd, which associates each canonical host type with a BFD -host type (used as the base of the makefile fragment names), and to the -table in bfd/configure.in which associates each target vector with -the .o files it uses. - -config/.mt is a Makefile fragment. -The following is usually enough: -DEFAULT_VECTOR=_vec -SELECT_ARCHITECTURES=bfd__arch - -See the list of cpu types in archures.c, or "ls cpu-*.c". -If your architecture is new, you need to add it to the tables -in bfd/archures.c, opcodes/configure.in, and binutils/objdump.c. - -For more information about .mt and .mh files, see config/README. - -The file .c is the hard part. It implements the -bfd_target _vec, which includes pointers to -functions that do the actual -specific methods. - -Porting to a that uses the a.out binary format -------------------------------------------------------- - -In this case, the include file aout-target.h probaby does most -of what you need. The program gen-aout generates .c for -you automatically for many a.out systems. Do: - make gen-aout - ./gen-aout > .c -(This only works if you are building on the target ("native"). -If you must make a cross-port from scratch, copy the most -similar existing file that includes aout-target.h, and fix what is wrong.) - -Check the parameters in .c, and fix anything that is wrong. -(Also let us know about it; perhaps we can improve gen-aout.c.) - -TARGET_IS_BIG_ENDIAN_P - Should be defined if is big-endian. - -N_HEADER_IN_TEXT(x) - See discussion in ../include/aout/aout64.h. - -BYTES_IN_WORD - Number of bytes per word. (Usually 4 but can be 8.) - -ARCH - Number of bits per word. (Usually 32, but can be 64.) - -ENTRY_CAN_BE_ZERO - Define if the extry point (start address of an - executable program) can be 0x0. - -TEXT_START_ADDR - The address of the start of the text segemnt in - virtual memory. Normally, the same as the entry point. - -TARGET_PAGE_SIZE - -SEGMENT_SIZE - Usually, the same as the TARGET_PAGE_SIZE. - Alignment needed for the data segment. - -TARGETNAME - The name of the target, for run-time lookups. - Usually "a.out-" diff --git a/contrib/gdb/bfd/TODO b/contrib/gdb/bfd/TODO deleted file mode 100644 index 08a3641..0000000 --- a/contrib/gdb/bfd/TODO +++ /dev/null @@ -1,25 +0,0 @@ -Things that still need to be done: -*- Text -*- - - o - A source of space lossage is that all the target-dependent code - is in a single bfd_target structure. Hence all the code for - *writing* object files is still pulled into all the applications - that only care about *reading* (gdb, nm, objdump), while gas has - to carry along all the unneded baggage for reading objects. And - so on. This would be a substantial change, and the payoff would - not all that great (essentially none if bfd is used as a shared - library). - - o - The storage needed by BFD data structures is also larger than strictly - needed. This may be difficult to do much about. - - o - implement bfd_abort, which should close the bfd but not alter the - filesystem. - - o - update the bfd doc; write a how-to-write-a-backend doc, take out - the stupid quips and fill in all the blanks. - - o - upgrade the reloc handling as per Steve's suggestion. - - - - diff --git a/contrib/gdb/bfd/VERSION b/contrib/gdb/bfd/VERSION deleted file mode 100644 index 9ddf6b5..0000000 --- a/contrib/gdb/bfd/VERSION +++ /dev/null @@ -1 +0,0 @@ -cygnus-2.6 diff --git a/contrib/gdb/bfd/aclocal.m4 b/contrib/gdb/bfd/aclocal.m4 deleted file mode 100644 index 1f5027e..0000000 --- a/contrib/gdb/bfd/aclocal.m4 +++ /dev/null @@ -1,43 +0,0 @@ -dnl See whether we need to use fopen-bin.h rather than fopen-same.h. -AC_DEFUN(BFD_BINARY_FOPEN, -[AC_REQUIRE([AC_CANONICAL_SYSTEM]) -case "${host}" in -changequote(,)dnl -i[345]86-*-msdos* | i[345]86-*-go32* | *-*-cygwin32) -changequote([,])dnl - AC_DEFINE(USE_BINARY_FOPEN) ;; -esac])dnl - -dnl Get a default for CC_FOR_BUILD to put into Makefile. -AC_DEFUN(BFD_CC_FOR_BUILD, -[# Put a plausible default for CC_FOR_BUILD in Makefile. -AC_REQUIRE([AC_C_CROSS])dnl -if test -z "$CC_FOR_BUILD"; then - if test "x$cross_compiling" = "xno"; then - CC_FOR_BUILD='$(CC)' - else - CC_FOR_BUILD=gcc - fi -fi -AC_SUBST(CC_FOR_BUILD)])dnl - -dnl See whether we need a declaration for a function. -AC_DEFUN(BFD_NEED_DECLARATION, -[AC_MSG_CHECKING([whether $1 must be declared]) -AC_CACHE_VAL(bfd_cv_decl_needed_$1, -[AC_TRY_COMPILE([ -#include -#ifdef HAVE_STDLIB_H -#include -#endif -#ifdef HAVE_UNISTD_H -#include -#endif], -[char *(*pfn) = (char *(*)) $1], -bfd_cv_decl_needed_$1=no, bfd_cv_decl_needed_$1=yes)]) -AC_MSG_RESULT($bfd_cv_decl_needed_$1) -if test $bfd_cv_decl_needed_$1 = yes; then - bfd_tr_decl=NEED_DECLARATION_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - AC_DEFINE_UNQUOTED($bfd_tr_decl) -fi -])dnl diff --git a/contrib/gdb/bfd/aout-target.h b/contrib/gdb/bfd/aout-target.h deleted file mode 100644 index 6711a71..0000000 --- a/contrib/gdb/bfd/aout-target.h +++ /dev/null @@ -1,607 +0,0 @@ -/* Define a target vector and some small routines for a variant of a.out. - Copyright (C) 1990, 91, 92, 93, 94, 95, 1996 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 "aout/aout64.h" -#include "aout/stab_gnu.h" -#include "aout/ar.h" -/*#include "libaout.h"*/ - -extern reloc_howto_type * NAME(aout,reloc_type_lookup) (); - -/* Set parameters about this a.out file that are machine-dependent. - This routine is called from some_aout_object_p just before it returns. */ -#ifndef MY_callback -static const bfd_target * -MY(callback) (abfd) - bfd *abfd; -{ - struct internal_exec *execp = exec_hdr (abfd); - unsigned int arch_align_power; - unsigned long arch_align; - - /* Calculate the file positions of the parts of a newly read aout header */ - obj_textsec (abfd)->_raw_size = N_TXTSIZE(*execp); - - /* The virtual memory addresses of the sections */ - obj_textsec (abfd)->vma = N_TXTADDR(*execp); - obj_datasec (abfd)->vma = N_DATADDR(*execp); - obj_bsssec (abfd)->vma = N_BSSADDR(*execp); - - obj_textsec (abfd)->lma = obj_textsec (abfd)->vma; - obj_datasec (abfd)->lma = obj_datasec (abfd)->vma; - obj_bsssec (abfd)->lma = obj_bsssec (abfd)->vma; - - /* The file offsets of the sections */ - obj_textsec (abfd)->filepos = N_TXTOFF (*execp); - obj_datasec (abfd)->filepos = N_DATOFF (*execp); - - /* The file offsets of the relocation info */ - obj_textsec (abfd)->rel_filepos = N_TRELOFF(*execp); - obj_datasec (abfd)->rel_filepos = N_DRELOFF(*execp); - - /* The file offsets of the string table and symbol table. */ - obj_sym_filepos (abfd) = N_SYMOFF (*execp); - obj_str_filepos (abfd) = N_STROFF (*execp); - - /* Determine the architecture and machine type of the object file. */ -#ifdef SET_ARCH_MACH - SET_ARCH_MACH(abfd, *execp); -#else - bfd_default_set_arch_mach(abfd, DEFAULT_ARCH, 0); -#endif - - /* Now that we know the architecture, set the alignments of the - sections. This is normally done by NAME(aout,new_section_hook), - but when the initial sections were created the architecture had - not yet been set. However, for backward compatibility, we don't - set the alignment power any higher than as required by the size - of the section. */ - arch_align_power = bfd_get_arch_info (abfd)->section_align_power; - arch_align = 1 << arch_align_power; - if ((BFD_ALIGN (obj_textsec (abfd)->_raw_size, arch_align) - == obj_textsec (abfd)->_raw_size) - && (BFD_ALIGN (obj_datasec (abfd)->_raw_size, arch_align) - == obj_datasec (abfd)->_raw_size) - && (BFD_ALIGN (obj_bsssec (abfd)->_raw_size, arch_align) - == obj_bsssec (abfd)->_raw_size)) - { - obj_textsec (abfd)->alignment_power = arch_align_power; - obj_datasec (abfd)->alignment_power = arch_align_power; - obj_bsssec (abfd)->alignment_power = arch_align_power; - } - - /* Don't set sizes now -- can't be sure until we know arch & mach. - Sizes get set in set_sizes callback, later. */ -#if 0 - adata(abfd).page_size = TARGET_PAGE_SIZE; -#ifdef SEGMENT_SIZE - adata(abfd).segment_size = SEGMENT_SIZE; -#else - adata(abfd).segment_size = TARGET_PAGE_SIZE; -#endif - adata(abfd).exec_bytes_size = EXEC_BYTES_SIZE; -#endif - - return abfd->xvec; -} -#endif - -#ifndef MY_object_p -/* Finish up the reading of an a.out file header */ - -static const bfd_target * -MY(object_p) (abfd) - bfd *abfd; -{ - struct external_exec exec_bytes; /* Raw exec header from file */ - struct internal_exec exec; /* Cleaned-up exec header */ - const bfd_target *target; - - if (bfd_read ((PTR) &exec_bytes, 1, EXEC_BYTES_SIZE, abfd) - != EXEC_BYTES_SIZE) { - if (bfd_get_error () != bfd_error_system_call) - bfd_set_error (bfd_error_wrong_format); - return 0; - } - -#ifdef SWAP_MAGIC - exec.a_info = SWAP_MAGIC (exec_bytes.e_info); -#else - exec.a_info = bfd_h_get_32 (abfd, exec_bytes.e_info); -#endif /* SWAP_MAGIC */ - - if (N_BADMAG (exec)) return 0; -#ifdef MACHTYPE_OK - if (!(MACHTYPE_OK (N_MACHTYPE (exec)))) return 0; -#endif - - NAME(aout,swap_exec_header_in)(abfd, &exec_bytes, &exec); - -#ifdef SWAP_MAGIC - /* swap_exec_header_in read in a_info with the wrong byte order */ - exec.a_info = SWAP_MAGIC (exec_bytes.e_info); -#endif /* SWAP_MAGIC */ - - target = NAME(aout,some_aout_object_p) (abfd, &exec, MY(callback)); - -#ifdef ENTRY_CAN_BE_ZERO - /* The NEWSOS3 entry-point is/was 0, which (amongst other lossage) - * means that it isn't obvious if EXEC_P should be set. - * All of the following must be true for an executable: - * There must be no relocations, the bfd can be neither an - * archive nor an archive element, and the file must be executable. */ - - if (exec.a_trsize + exec.a_drsize == 0 - && bfd_get_format(abfd) == bfd_object && abfd->my_archive == NULL) - { - struct stat buf; -#ifndef S_IXUSR -#define S_IXUSR 0100 /* Execute by owner. */ -#endif - if (stat(abfd->filename, &buf) == 0 && (buf.st_mode & S_IXUSR)) - abfd->flags |= EXEC_P; - } -#endif /* ENTRY_CAN_BE_ZERO */ - - return target; -} -#define MY_object_p MY(object_p) -#endif - - -#ifndef MY_mkobject -static boolean -MY(mkobject) (abfd) - bfd *abfd; -{ - if (NAME(aout,mkobject)(abfd) == false) - return false; -#if 0 /* Sizes get set in set_sizes callback, later, after we know - the architecture and machine. */ - adata(abfd).page_size = TARGET_PAGE_SIZE; -#ifdef SEGMENT_SIZE - adata(abfd).segment_size = SEGMENT_SIZE; -#else - adata(abfd).segment_size = TARGET_PAGE_SIZE; -#endif - adata(abfd).exec_bytes_size = EXEC_BYTES_SIZE; -#endif - return true; -} -#define MY_mkobject MY(mkobject) -#endif - -#ifndef MY_bfd_copy_private_section_data - -/* Copy private section data. This actually does nothing with the - sections. It copies the subformat field. We copy it here, because - we need to know whether this is a QMAGIC file before we set the - section contents, and copy_private_bfd_data is not called until - after the section contents have been set. */ - -/*ARGSUSED*/ -static boolean -MY_bfd_copy_private_section_data (ibfd, isec, obfd, osec) - bfd *ibfd; - asection *isec; - bfd *obfd; - asection *osec; -{ - if (bfd_get_flavour (obfd) == bfd_target_aout_flavour) - obj_aout_subformat (obfd) = obj_aout_subformat (ibfd); - return true; -} - -#endif - -/* Write an object file. - Section contents have already been written. We write the - file header, symbols, and relocation. */ - -#ifndef MY_write_object_contents -static boolean -MY(write_object_contents) (abfd) - bfd *abfd; -{ - struct external_exec exec_bytes; - struct internal_exec *execp = exec_hdr (abfd); - -#if CHOOSE_RELOC_SIZE - CHOOSE_RELOC_SIZE(abfd); -#else - obj_reloc_entry_size (abfd) = RELOC_STD_SIZE; -#endif - - WRITE_HEADERS(abfd, execp); - - return true; -} -#define MY_write_object_contents MY(write_object_contents) -#endif - -#ifndef MY_set_sizes -static boolean -MY(set_sizes) (abfd) - bfd *abfd; -{ - adata(abfd).page_size = TARGET_PAGE_SIZE; - -#ifdef SEGMENT_SIZE - adata(abfd).segment_size = SEGMENT_SIZE; -#else - adata(abfd).segment_size = TARGET_PAGE_SIZE; -#endif - -#ifdef ZMAGIC_DISK_BLOCK_SIZE - adata(abfd).zmagic_disk_block_size = ZMAGIC_DISK_BLOCK_SIZE; -#else - adata(abfd).zmagic_disk_block_size = TARGET_PAGE_SIZE; -#endif - - adata(abfd).exec_bytes_size = EXEC_BYTES_SIZE; - return true; -} -#define MY_set_sizes MY(set_sizes) -#endif - -#ifndef MY_exec_hdr_flags -#define MY_exec_hdr_flags 0 -#endif - -#ifndef MY_backend_data - -#ifndef MY_zmagic_contiguous -#define MY_zmagic_contiguous 0 -#endif -#ifndef MY_text_includes_header -#define MY_text_includes_header 0 -#endif -#ifndef MY_exec_header_not_counted -#define MY_exec_header_not_counted 0 -#endif -#ifndef MY_add_dynamic_symbols -#define MY_add_dynamic_symbols 0 -#endif -#ifndef MY_add_one_symbol -#define MY_add_one_symbol 0 -#endif -#ifndef MY_link_dynamic_object -#define MY_link_dynamic_object 0 -#endif -#ifndef MY_write_dynamic_symbol -#define MY_write_dynamic_symbol 0 -#endif -#ifndef MY_check_dynamic_reloc -#define MY_check_dynamic_reloc 0 -#endif -#ifndef MY_finish_dynamic_link -#define MY_finish_dynamic_link 0 -#endif - -static CONST struct aout_backend_data MY(backend_data) = { - MY_zmagic_contiguous, - MY_text_includes_header, - MY_exec_hdr_flags, - 0, /* text vma? */ - MY_set_sizes, - MY_exec_header_not_counted, - MY_add_dynamic_symbols, - MY_add_one_symbol, - MY_link_dynamic_object, - MY_write_dynamic_symbol, - MY_check_dynamic_reloc, - MY_finish_dynamic_link -}; -#define MY_backend_data &MY(backend_data) -#endif - -#ifndef MY_final_link_callback - -/* Callback for the final_link routine to set the section offsets. */ - -static void MY_final_link_callback - PARAMS ((bfd *, file_ptr *, file_ptr *, file_ptr *)); - -static void -MY_final_link_callback (abfd, ptreloff, pdreloff, psymoff) - bfd *abfd; - file_ptr *ptreloff; - file_ptr *pdreloff; - file_ptr *psymoff; -{ - struct internal_exec *execp = exec_hdr (abfd); - - *ptreloff = N_TRELOFF (*execp); - *pdreloff = N_DRELOFF (*execp); - *psymoff = N_SYMOFF (*execp); -} - -#endif - -#ifndef MY_bfd_final_link - -/* Final link routine. We need to use a call back to get the correct - offsets in the output file. */ - -static boolean -MY_bfd_final_link (abfd, info) - bfd *abfd; - struct bfd_link_info *info; -{ - return NAME(aout,final_link) (abfd, info, MY_final_link_callback); -} - -#endif - -/* We assume BFD generic archive files. */ -#ifndef MY_openr_next_archived_file -#define MY_openr_next_archived_file bfd_generic_openr_next_archived_file -#endif -#ifndef MY_get_elt_at_index -#define MY_get_elt_at_index _bfd_generic_get_elt_at_index -#endif -#ifndef MY_generic_stat_arch_elt -#define MY_generic_stat_arch_elt bfd_generic_stat_arch_elt -#endif -#ifndef MY_slurp_armap -#define MY_slurp_armap bfd_slurp_bsd_armap -#endif -#ifndef MY_slurp_extended_name_table -#define MY_slurp_extended_name_table _bfd_slurp_extended_name_table -#endif -#ifndef MY_construct_extended_name_table -#define MY_construct_extended_name_table \ - _bfd_archive_bsd_construct_extended_name_table -#endif -#ifndef MY_write_armap -#define MY_write_armap bsd_write_armap -#endif -#ifndef MY_read_ar_hdr -#define MY_read_ar_hdr _bfd_generic_read_ar_hdr -#endif -#ifndef MY_truncate_arname -#define MY_truncate_arname bfd_bsd_truncate_arname -#endif -#ifndef MY_update_armap_timestamp -#define MY_update_armap_timestamp _bfd_archive_bsd_update_armap_timestamp -#endif - -/* No core file defined here -- configure in trad-core.c separately. */ -#ifndef MY_core_file_failing_command -#define MY_core_file_failing_command _bfd_nocore_core_file_failing_command -#endif -#ifndef MY_core_file_failing_signal -#define MY_core_file_failing_signal _bfd_nocore_core_file_failing_signal -#endif -#ifndef MY_core_file_matches_executable_p -#define MY_core_file_matches_executable_p \ - _bfd_nocore_core_file_matches_executable_p -#endif -#ifndef MY_core_file_p -#define MY_core_file_p _bfd_dummy_target -#endif - -#ifndef MY_bfd_debug_info_start -#define MY_bfd_debug_info_start bfd_void -#endif -#ifndef MY_bfd_debug_info_end -#define MY_bfd_debug_info_end bfd_void -#endif -#ifndef MY_bfd_debug_info_accumulate -#define MY_bfd_debug_info_accumulate \ - (void (*) PARAMS ((bfd*, struct sec *))) bfd_void -#endif - -#ifndef MY_core_file_failing_command -#define MY_core_file_failing_command NAME(aout,core_file_failing_command) -#endif -#ifndef MY_core_file_failing_signal -#define MY_core_file_failing_signal NAME(aout,core_file_failing_signal) -#endif -#ifndef MY_core_file_matches_executable_p -#define MY_core_file_matches_executable_p NAME(aout,core_file_matches_executable_p) -#endif -#ifndef MY_set_section_contents -#define MY_set_section_contents NAME(aout,set_section_contents) -#endif -#ifndef MY_get_section_contents -#define MY_get_section_contents NAME(aout,get_section_contents) -#endif -#ifndef MY_get_section_contents_in_window -#define MY_get_section_contents_in_window _bfd_generic_get_section_contents_in_window -#endif -#ifndef MY_new_section_hook -#define MY_new_section_hook NAME(aout,new_section_hook) -#endif -#ifndef MY_get_symtab_upper_bound -#define MY_get_symtab_upper_bound NAME(aout,get_symtab_upper_bound) -#endif -#ifndef MY_get_symtab -#define MY_get_symtab NAME(aout,get_symtab) -#endif -#ifndef MY_get_reloc_upper_bound -#define MY_get_reloc_upper_bound NAME(aout,get_reloc_upper_bound) -#endif -#ifndef MY_canonicalize_reloc -#define MY_canonicalize_reloc NAME(aout,canonicalize_reloc) -#endif -#ifndef MY_make_empty_symbol -#define MY_make_empty_symbol NAME(aout,make_empty_symbol) -#endif -#ifndef MY_print_symbol -#define MY_print_symbol NAME(aout,print_symbol) -#endif -#ifndef MY_get_symbol_info -#define MY_get_symbol_info NAME(aout,get_symbol_info) -#endif -#ifndef MY_get_lineno -#define MY_get_lineno NAME(aout,get_lineno) -#endif -#ifndef MY_set_arch_mach -#define MY_set_arch_mach NAME(aout,set_arch_mach) -#endif -#ifndef MY_find_nearest_line -#define MY_find_nearest_line NAME(aout,find_nearest_line) -#endif -#ifndef MY_sizeof_headers -#define MY_sizeof_headers NAME(aout,sizeof_headers) -#endif -#ifndef MY_bfd_get_relocated_section_contents -#define MY_bfd_get_relocated_section_contents \ - bfd_generic_get_relocated_section_contents -#endif -#ifndef MY_bfd_relax_section -#define MY_bfd_relax_section bfd_generic_relax_section -#endif -#ifndef MY_bfd_reloc_type_lookup -#define MY_bfd_reloc_type_lookup NAME(aout,reloc_type_lookup) -#endif -#ifndef MY_bfd_make_debug_symbol -#define MY_bfd_make_debug_symbol 0 -#endif -#ifndef MY_read_minisymbols -#define MY_read_minisymbols NAME(aout,read_minisymbols) -#endif -#ifndef MY_minisymbol_to_symbol -#define MY_minisymbol_to_symbol NAME(aout,minisymbol_to_symbol) -#endif -#ifndef MY_bfd_link_hash_table_create -#define MY_bfd_link_hash_table_create NAME(aout,link_hash_table_create) -#endif -#ifndef MY_bfd_link_add_symbols -#define MY_bfd_link_add_symbols NAME(aout,link_add_symbols) -#endif -#ifndef MY_bfd_link_split_section -#define MY_bfd_link_split_section _bfd_generic_link_split_section -#endif - - -#ifndef MY_bfd_copy_private_bfd_data -#define MY_bfd_copy_private_bfd_data _bfd_generic_bfd_copy_private_bfd_data -#endif - -#ifndef MY_bfd_merge_private_bfd_data -#define MY_bfd_merge_private_bfd_data _bfd_generic_bfd_merge_private_bfd_data -#endif - -#ifndef MY_bfd_copy_private_symbol_data -#define MY_bfd_copy_private_symbol_data _bfd_generic_bfd_copy_private_symbol_data -#endif - -#ifndef MY_bfd_print_private_bfd_data -#define MY_bfd_print_private_bfd_data _bfd_generic_bfd_print_private_bfd_data -#endif - -#ifndef MY_bfd_set_private_flags -#define MY_bfd_set_private_flags _bfd_generic_bfd_set_private_flags -#endif - -#ifndef MY_bfd_is_local_label -#define MY_bfd_is_local_label bfd_generic_is_local_label -#endif - -#ifndef MY_bfd_free_cached_info -#define MY_bfd_free_cached_info NAME(aout,bfd_free_cached_info) -#endif - -#ifndef MY_close_and_cleanup -#define MY_close_and_cleanup MY_bfd_free_cached_info -#endif - -#ifndef MY_get_dynamic_symtab_upper_bound -#define MY_get_dynamic_symtab_upper_bound \ - _bfd_nodynamic_get_dynamic_symtab_upper_bound -#endif -#ifndef MY_canonicalize_dynamic_symtab -#define MY_canonicalize_dynamic_symtab \ - _bfd_nodynamic_canonicalize_dynamic_symtab -#endif -#ifndef MY_get_dynamic_reloc_upper_bound -#define MY_get_dynamic_reloc_upper_bound \ - _bfd_nodynamic_get_dynamic_reloc_upper_bound -#endif -#ifndef MY_canonicalize_dynamic_reloc -#define MY_canonicalize_dynamic_reloc \ - _bfd_nodynamic_canonicalize_dynamic_reloc -#endif - -/* Aout symbols normally have leading underscores */ -#ifndef MY_symbol_leading_char -#define MY_symbol_leading_char '_' -#endif - -/* Aout archives normally use spaces for padding */ -#ifndef AR_PAD_CHAR -#define AR_PAD_CHAR ' ' -#endif - -#ifndef MY_BFD_TARGET -const bfd_target MY(vec) = -{ - TARGETNAME, /* name */ - bfd_target_aout_flavour, -#ifdef TARGET_IS_BIG_ENDIAN_P - BFD_ENDIAN_BIG, /* target byte order (big) */ - BFD_ENDIAN_BIG, /* target headers byte order (big) */ -#else - BFD_ENDIAN_LITTLE, /* target byte order (little) */ - BFD_ENDIAN_LITTLE, /* target headers byte order (little) */ -#endif - (HAS_RELOC | EXEC_P | /* object flags */ - HAS_LINENO | HAS_DEBUG | - HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED), - (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */ - MY_symbol_leading_char, - AR_PAD_CHAR, /* ar_pad_char */ - 15, /* ar_max_namelen */ -#ifdef TARGET_IS_BIG_ENDIAN_P - bfd_getb64, bfd_getb_signed_64, bfd_putb64, - bfd_getb32, bfd_getb_signed_32, bfd_putb32, - bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */ - bfd_getb64, bfd_getb_signed_64, bfd_putb64, - bfd_getb32, bfd_getb_signed_32, bfd_putb32, - bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */ -#else - bfd_getl64, bfd_getl_signed_64, bfd_putl64, - bfd_getl32, bfd_getl_signed_32, bfd_putl32, - bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */ - bfd_getl64, bfd_getl_signed_64, bfd_putl64, - bfd_getl32, bfd_getl_signed_32, bfd_putl32, - bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */ -#endif - {_bfd_dummy_target, MY_object_p, /* bfd_check_format */ - bfd_generic_archive_p, MY_core_file_p}, - {bfd_false, MY_mkobject, /* bfd_set_format */ - _bfd_generic_mkarchive, bfd_false}, - {bfd_false, MY_write_object_contents, /* bfd_write_contents */ - _bfd_write_archive_contents, bfd_false}, - - BFD_JUMP_TABLE_GENERIC (MY), - BFD_JUMP_TABLE_COPY (MY), - BFD_JUMP_TABLE_CORE (MY), - BFD_JUMP_TABLE_ARCHIVE (MY), - BFD_JUMP_TABLE_SYMBOLS (MY), - BFD_JUMP_TABLE_RELOCS (MY), - BFD_JUMP_TABLE_WRITE (MY), - BFD_JUMP_TABLE_LINK (MY), - BFD_JUMP_TABLE_DYNAMIC (MY), - - (PTR) MY_backend_data, -}; -#endif /* MY_BFD_TARGET */ diff --git a/contrib/gdb/bfd/aout32.c b/contrib/gdb/bfd/aout32.c deleted file mode 100644 index bfc40b4..0000000 --- a/contrib/gdb/bfd/aout32.c +++ /dev/null @@ -1,23 +0,0 @@ -/* BFD back-end for 32-bit a.out files. - Copyright (C) 1990, 91, 92, 93, 94 Free Software Foundation, Inc. - Written by Cygnus Support. - -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 ARCH_SIZE 32 - -#include "aoutx.h" diff --git a/contrib/gdb/bfd/aoutx.h b/contrib/gdb/bfd/aoutx.h deleted file mode 100644 index 4b04943..0000000 --- a/contrib/gdb/bfd/aoutx.h +++ /dev/null @@ -1,5525 +0,0 @@ -/* BFD semi-generic back-end for a.out binaries. - Copyright 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. - Written by Cygnus Support. - -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. */ - -/* -SECTION - a.out backends - - -DESCRIPTION - - BFD supports a number of different flavours of a.out format, - though the major differences are only the sizes of the - structures on disk, and the shape of the relocation - information. - - The support is split into a basic support file @file{aoutx.h} - and other files which derive functions from the base. One - derivation file is @file{aoutf1.h} (for a.out flavour 1), and - adds to the basic a.out functions support for sun3, sun4, 386 - and 29k a.out files, to create a target jump vector for a - specific target. - - This information is further split out into more specific files - for each machine, including @file{sunos.c} for sun3 and sun4, - @file{newsos3.c} for the Sony NEWS, and @file{demo64.c} for a - demonstration of a 64 bit a.out format. - - The base file @file{aoutx.h} defines general mechanisms for - reading and writing records to and from disk and various - other methods which BFD requires. It is included by - @file{aout32.c} and @file{aout64.c} to form the names - <>, <>, etc. - - As an example, this is what goes on to make the back end for a - sun4, from @file{aout32.c}: - -| #define ARCH_SIZE 32 -| #include "aoutx.h" - - Which exports names: - -| ... -| aout_32_canonicalize_reloc -| aout_32_find_nearest_line -| aout_32_get_lineno -| aout_32_get_reloc_upper_bound -| ... - - from @file{sunos.c}: - -| #define TARGET_NAME "a.out-sunos-big" -| #define VECNAME sunos_big_vec -| #include "aoutf1.h" - - requires all the names from @file{aout32.c}, and produces the jump vector - -| sunos_big_vec - - The file @file{host-aout.c} is a special case. It is for a large set - of hosts that use ``more or less standard'' a.out files, and - for which cross-debugging is not interesting. It uses the - standard 32-bit a.out support routines, but determines the - file offsets and addresses of the text, data, and BSS - sections, the machine architecture and machine type, and the - entry point address, in a host-dependent manner. Once these - values have been determined, generic code is used to handle - the object file. - - When porting it to run on a new system, you must supply: - -| HOST_PAGE_SIZE -| HOST_SEGMENT_SIZE -| HOST_MACHINE_ARCH (optional) -| HOST_MACHINE_MACHINE (optional) -| HOST_TEXT_START_ADDR -| HOST_STACK_END_ADDR - - in the file @file{../include/sys/h-@var{XXX}.h} (for your host). These - values, plus the structures and macros defined in @file{a.out.h} on - your host system, will produce a BFD target that will access - ordinary a.out files on your host. To configure a new machine - to use @file{host-aout.c}, specify: - -| TDEFAULTS = -DDEFAULT_VECTOR=host_aout_big_vec -| TDEPFILES= host-aout.o trad-core.o - - in the @file{config/@var{XXX}.mt} file, and modify @file{configure.in} - to use the - @file{@var{XXX}.mt} file (by setting "<>") when your - configuration is selected. - -*/ - -/* Some assumptions: - * Any BFD with D_PAGED set is ZMAGIC, and vice versa. - Doesn't matter what the setting of WP_TEXT is on output, but it'll - get set on input. - * Any BFD with D_PAGED clear and WP_TEXT set is NMAGIC. - * Any BFD with both flags clear is OMAGIC. - (Just want to make these explicit, so the conditions tested in this - file make sense if you're more familiar with a.out than with BFD.) */ - -#define KEEPIT udata.i - -#include /* For strchr and friends */ -#include -#include "bfd.h" -#include -#include "bfdlink.h" - -#include "libaout.h" -#include "libbfd.h" -#include "aout/aout64.h" -#include "aout/stab_gnu.h" -#include "aout/ar.h" - -static boolean aout_get_external_symbols PARAMS ((bfd *)); -static boolean translate_from_native_sym_flags - PARAMS ((bfd *, aout_symbol_type *)); -static boolean translate_to_native_sym_flags - PARAMS ((bfd *, asymbol *, struct external_nlist *)); - -/* -SUBSECTION - Relocations - -DESCRIPTION - The file @file{aoutx.h} provides for both the @emph{standard} - and @emph{extended} forms of a.out relocation records. - - The standard records contain only an - address, a symbol index, and a type field. The extended records - (used on 29ks and sparcs) also have a full integer for an - addend. - -*/ -#ifndef CTOR_TABLE_RELOC_HOWTO -#define CTOR_TABLE_RELOC_IDX 2 -#define CTOR_TABLE_RELOC_HOWTO(BFD) ((obj_reloc_entry_size(BFD) == RELOC_EXT_SIZE \ - ? howto_table_ext : howto_table_std) \ - + CTOR_TABLE_RELOC_IDX) -#endif - -#ifndef MY_swap_std_reloc_in -#define MY_swap_std_reloc_in NAME(aout,swap_std_reloc_in) -#endif - -#ifndef MY_swap_std_reloc_out -#define MY_swap_std_reloc_out NAME(aout,swap_std_reloc_out) -#endif - -#ifndef MY_final_link_relocate -#define MY_final_link_relocate _bfd_final_link_relocate -#endif - -#ifndef MY_relocate_contents -#define MY_relocate_contents _bfd_relocate_contents -#endif - -#define howto_table_ext NAME(aout,ext_howto_table) -#define howto_table_std NAME(aout,std_howto_table) - -reloc_howto_type howto_table_ext[] = -{ - /* type rs size bsz pcrel bitpos ovrf sf name part_inpl readmask setmask pcdone */ - HOWTO(RELOC_8, 0, 0, 8, false, 0, complain_overflow_bitfield,0,"8", false, 0,0x000000ff, false), - HOWTO(RELOC_16, 0, 1, 16, false, 0, complain_overflow_bitfield,0,"16", false, 0,0x0000ffff, false), - HOWTO(RELOC_32, 0, 2, 32, false, 0, complain_overflow_bitfield,0,"32", false, 0,0xffffffff, false), - HOWTO(RELOC_DISP8, 0, 0, 8, true, 0, complain_overflow_signed,0,"DISP8", false, 0,0x000000ff, false), - HOWTO(RELOC_DISP16, 0, 1, 16, true, 0, complain_overflow_signed,0,"DISP16", false, 0,0x0000ffff, false), - HOWTO(RELOC_DISP32, 0, 2, 32, true, 0, complain_overflow_signed,0,"DISP32", false, 0,0xffffffff, false), - HOWTO(RELOC_WDISP30,2, 2, 30, true, 0, complain_overflow_signed,0,"WDISP30", false, 0,0x3fffffff, false), - HOWTO(RELOC_WDISP22,2, 2, 22, true, 0, complain_overflow_signed,0,"WDISP22", false, 0,0x003fffff, false), - HOWTO(RELOC_HI22, 10, 2, 22, false, 0, complain_overflow_bitfield,0,"HI22", false, 0,0x003fffff, false), - HOWTO(RELOC_22, 0, 2, 22, false, 0, complain_overflow_bitfield,0,"22", false, 0,0x003fffff, false), - HOWTO(RELOC_13, 0, 2, 13, false, 0, complain_overflow_bitfield,0,"13", false, 0,0x00001fff, false), - HOWTO(RELOC_LO10, 0, 2, 10, false, 0, complain_overflow_dont,0,"LO10", false, 0,0x000003ff, false), - HOWTO(RELOC_SFA_BASE,0, 2, 32, false, 0, complain_overflow_bitfield,0,"SFA_BASE", false, 0,0xffffffff, false), - HOWTO(RELOC_SFA_OFF13,0,2, 32, false, 0, complain_overflow_bitfield,0,"SFA_OFF13",false, 0,0xffffffff, false), - HOWTO(RELOC_BASE10, 0, 2, 10, false, 0, complain_overflow_dont,0,"BASE10", false, 0,0x000003ff, false), - HOWTO(RELOC_BASE13, 0, 2, 13, false, 0, complain_overflow_bitfield,0,"BASE13", false, 0,0x00001fff, false), - HOWTO(RELOC_BASE22, 10, 2, 22, false, 0, complain_overflow_bitfield,0,"BASE22", false, 0,0x003fffff, false), - HOWTO(RELOC_PC10, 0, 2, 10, true, 0, complain_overflow_dont,0,"PC10", false, 0,0x000003ff, true), - HOWTO(RELOC_PC22, 10, 2, 22, true, 0, complain_overflow_signed,0,"PC22", false, 0,0x003fffff, true), - HOWTO(RELOC_JMP_TBL,2, 2, 30, true, 0, complain_overflow_signed,0,"JMP_TBL", false, 0,0x3fffffff, false), - HOWTO(RELOC_SEGOFF16,0, 2, 0, false, 0, complain_overflow_bitfield,0,"SEGOFF16", false, 0,0x00000000, false), - HOWTO(RELOC_GLOB_DAT,0, 2, 0, false, 0, complain_overflow_bitfield,0,"GLOB_DAT", false, 0,0x00000000, false), - HOWTO(RELOC_JMP_SLOT,0, 2, 0, false, 0, complain_overflow_bitfield,0,"JMP_SLOT", false, 0,0x00000000, false), - HOWTO(RELOC_RELATIVE,0, 2, 0, false, 0, complain_overflow_bitfield,0,"RELATIVE", false, 0,0x00000000, false), -}; - -/* Convert standard reloc records to "arelent" format (incl byte swap). */ - -reloc_howto_type howto_table_std[] = { - /* type rs size bsz pcrel bitpos ovrf sf name part_inpl readmask setmask pcdone */ -HOWTO( 0, 0, 0, 8, false, 0, complain_overflow_bitfield,0,"8", true, 0x000000ff,0x000000ff, false), -HOWTO( 1, 0, 1, 16, false, 0, complain_overflow_bitfield,0,"16", true, 0x0000ffff,0x0000ffff, false), -HOWTO( 2, 0, 2, 32, false, 0, complain_overflow_bitfield,0,"32", true, 0xffffffff,0xffffffff, false), -HOWTO( 3, 0, 4, 64, false, 0, complain_overflow_bitfield,0,"64", true, 0xdeaddead,0xdeaddead, false), -HOWTO( 4, 0, 0, 8, true, 0, complain_overflow_signed, 0,"DISP8", true, 0x000000ff,0x000000ff, false), -HOWTO( 5, 0, 1, 16, true, 0, complain_overflow_signed, 0,"DISP16", true, 0x0000ffff,0x0000ffff, false), -HOWTO( 6, 0, 2, 32, true, 0, complain_overflow_signed, 0,"DISP32", true, 0xffffffff,0xffffffff, false), -HOWTO( 7, 0, 4, 64, true, 0, complain_overflow_signed, 0,"DISP64", true, 0xfeedface,0xfeedface, false), -HOWTO( 8, 0, 2, 0, false, 0, complain_overflow_bitfield,0,"GOT_REL", false, 0,0x00000000, false), -HOWTO( 9, 0, 1, 16, false, 0, complain_overflow_bitfield,0,"BASE16", false,0xffffffff,0xffffffff, false), -HOWTO(10, 0, 2, 32, false, 0, complain_overflow_bitfield,0,"BASE32", false,0xffffffff,0xffffffff, false), -{ -1 }, -{ -1 }, -{ -1 }, -{ -1 }, -{ -1 }, - HOWTO(16, 0, 2, 0, false, 0, complain_overflow_bitfield,0,"JMP_TABLE", false, 0,0x00000000, false), -{ -1 }, -{ -1 }, -{ -1 }, -{ -1 }, -{ -1 }, -{ -1 }, -{ -1 }, -{ -1 }, { -1 }, { -1 }, { -1 }, { -1 }, { -1 }, { -1 }, { -1 }, - HOWTO(32, 0, 2, 0, false, 0, complain_overflow_bitfield,0,"RELATIVE", false, 0,0x00000000, false), -{ -1 }, -{ -1 }, -{ -1 }, -{ -1 }, -{ -1 }, -{ -1 }, -{ -1 }, - HOWTO(40, 0, 2, 0, false, 0, complain_overflow_bitfield,0,"BASEREL", false, 0,0x00000000, false), -}; - -#define TABLE_SIZE(TABLE) (sizeof(TABLE)/sizeof(TABLE[0])) - -reloc_howto_type * -NAME(aout,reloc_type_lookup) (abfd,code) - bfd *abfd; - bfd_reloc_code_real_type code; -{ -#define EXT(i,j) case i: return &howto_table_ext[j] -#define STD(i,j) case i: return &howto_table_std[j] - int ext = obj_reloc_entry_size (abfd) == RELOC_EXT_SIZE; - if (code == BFD_RELOC_CTOR) - switch (bfd_get_arch_info (abfd)->bits_per_address) - { - case 32: - code = BFD_RELOC_32; - break; - case 64: - code = BFD_RELOC_64; - break; - } - if (ext) - switch (code) - { - EXT (BFD_RELOC_32, 2); - EXT (BFD_RELOC_HI22, 8); - EXT (BFD_RELOC_LO10, 11); - EXT (BFD_RELOC_32_PCREL_S2, 6); - EXT (BFD_RELOC_SPARC_WDISP22, 7); - EXT (BFD_RELOC_SPARC13, 10); - EXT (BFD_RELOC_SPARC_GOT10, 14); - EXT (BFD_RELOC_SPARC_BASE13, 15); - EXT (BFD_RELOC_SPARC_GOT13, 15); - EXT (BFD_RELOC_SPARC_GOT22, 16); - EXT (BFD_RELOC_SPARC_PC10, 17); - EXT (BFD_RELOC_SPARC_PC22, 18); - EXT (BFD_RELOC_SPARC_WPLT30, 19); - default: return (reloc_howto_type *) NULL; - } - else - /* std relocs */ - switch (code) - { - STD (BFD_RELOC_16, 1); - STD (BFD_RELOC_32, 2); - STD (BFD_RELOC_8_PCREL, 4); - STD (BFD_RELOC_16_PCREL, 5); - STD (BFD_RELOC_32_PCREL, 6); - STD (BFD_RELOC_16_BASEREL, 9); - STD (BFD_RELOC_32_BASEREL, 10); - default: return (reloc_howto_type *) NULL; - } -} - -/* -SUBSECTION - Internal entry points - -DESCRIPTION - @file{aoutx.h} exports several routines for accessing the - contents of an a.out file, which are gathered and exported in - turn by various format specific files (eg sunos.c). - -*/ - -/* -FUNCTION - aout_@var{size}_swap_exec_header_in - -SYNOPSIS - void aout_@var{size}_swap_exec_header_in, - (bfd *abfd, - struct external_exec *raw_bytes, - struct internal_exec *execp); - -DESCRIPTION - Swap the information in an executable header @var{raw_bytes} taken - from a raw byte stream memory image into the internal exec header - structure @var{execp}. -*/ - -#ifndef NAME_swap_exec_header_in -void -NAME(aout,swap_exec_header_in) (abfd, raw_bytes, execp) - bfd *abfd; - struct external_exec *raw_bytes; - struct internal_exec *execp; -{ - struct external_exec *bytes = (struct external_exec *)raw_bytes; - - /* The internal_exec structure has some fields that are unused in this - configuration (IE for i960), so ensure that all such uninitialized - fields are zero'd out. There are places where two of these structs - are memcmp'd, and thus the contents do matter. */ - memset ((PTR) execp, 0, sizeof (struct internal_exec)); - /* Now fill in fields in the execp, from the bytes in the raw data. */ - execp->a_info = bfd_h_get_32 (abfd, bytes->e_info); - execp->a_text = GET_WORD (abfd, bytes->e_text); - execp->a_data = GET_WORD (abfd, bytes->e_data); - execp->a_bss = GET_WORD (abfd, bytes->e_bss); - execp->a_syms = GET_WORD (abfd, bytes->e_syms); - execp->a_entry = GET_WORD (abfd, bytes->e_entry); - execp->a_trsize = GET_WORD (abfd, bytes->e_trsize); - execp->a_drsize = GET_WORD (abfd, bytes->e_drsize); -} -#define NAME_swap_exec_header_in NAME(aout,swap_exec_header_in) -#endif - -/* -FUNCTION - aout_@var{size}_swap_exec_header_out - -SYNOPSIS - void aout_@var{size}_swap_exec_header_out - (bfd *abfd, - struct internal_exec *execp, - struct external_exec *raw_bytes); - -DESCRIPTION - Swap the information in an internal exec header structure - @var{execp} into the buffer @var{raw_bytes} ready for writing to disk. -*/ -void -NAME(aout,swap_exec_header_out) (abfd, execp, raw_bytes) - bfd *abfd; - struct internal_exec *execp; - struct external_exec *raw_bytes; -{ - struct external_exec *bytes = (struct external_exec *)raw_bytes; - - /* Now fill in fields in the raw data, from the fields in the exec struct. */ - bfd_h_put_32 (abfd, execp->a_info , bytes->e_info); - PUT_WORD (abfd, execp->a_text , bytes->e_text); - PUT_WORD (abfd, execp->a_data , bytes->e_data); - PUT_WORD (abfd, execp->a_bss , bytes->e_bss); - PUT_WORD (abfd, execp->a_syms , bytes->e_syms); - PUT_WORD (abfd, execp->a_entry , bytes->e_entry); - PUT_WORD (abfd, execp->a_trsize, bytes->e_trsize); - PUT_WORD (abfd, execp->a_drsize, bytes->e_drsize); -} - -/* Make all the section for an a.out file. */ - -boolean -NAME(aout,make_sections) (abfd) - bfd *abfd; -{ - if (obj_textsec (abfd) == (asection *) NULL - && bfd_make_section (abfd, ".text") == (asection *) NULL) - return false; - if (obj_datasec (abfd) == (asection *) NULL - && bfd_make_section (abfd, ".data") == (asection *) NULL) - return false; - if (obj_bsssec (abfd) == (asection *) NULL - && bfd_make_section (abfd, ".bss") == (asection *) NULL) - return false; - return true; -} - -/* -FUNCTION - aout_@var{size}_some_aout_object_p - -SYNOPSIS - const bfd_target *aout_@var{size}_some_aout_object_p - (bfd *abfd, - const bfd_target *(*callback_to_real_object_p)()); - -DESCRIPTION - Some a.out variant thinks that the file open in @var{abfd} - checking is an a.out file. Do some more checking, and set up - for access if it really is. Call back to the calling - environment's "finish up" function just before returning, to - handle any last-minute setup. -*/ - -const bfd_target * -NAME(aout,some_aout_object_p) (abfd, execp, callback_to_real_object_p) - bfd *abfd; - struct internal_exec *execp; - const bfd_target *(*callback_to_real_object_p) PARAMS ((bfd *)); -{ - struct aout_data_struct *rawptr, *oldrawptr; - const bfd_target *result; - - rawptr = (struct aout_data_struct *) bfd_zalloc (abfd, sizeof (struct aout_data_struct )); - if (rawptr == NULL) - return 0; - - oldrawptr = abfd->tdata.aout_data; - abfd->tdata.aout_data = rawptr; - - /* Copy the contents of the old tdata struct. - In particular, we want the subformat, since for hpux it was set in - hp300hpux.c:swap_exec_header_in and will be used in - hp300hpux.c:callback. */ - if (oldrawptr != NULL) - *abfd->tdata.aout_data = *oldrawptr; - - abfd->tdata.aout_data->a.hdr = &rawptr->e; - *(abfd->tdata.aout_data->a.hdr) = *execp; /* Copy in the internal_exec struct */ - execp = abfd->tdata.aout_data->a.hdr; - - /* Set the file flags */ - abfd->flags = NO_FLAGS; - if (execp->a_drsize || execp->a_trsize) - abfd->flags |= HAS_RELOC; - /* Setting of EXEC_P has been deferred to the bottom of this function */ - if (execp->a_syms) - abfd->flags |= HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS; - if (N_DYNAMIC(*execp)) - abfd->flags |= DYNAMIC; - - if (N_MAGIC (*execp) == ZMAGIC) - { - abfd->flags |= D_PAGED | WP_TEXT; - adata (abfd).magic = z_magic; - } - else if (N_MAGIC (*execp) == QMAGIC) - { - abfd->flags |= D_PAGED | WP_TEXT; - adata (abfd).magic = z_magic; - adata (abfd).subformat = q_magic_format; - } - else if (N_MAGIC (*execp) == NMAGIC) - { - abfd->flags |= WP_TEXT; - adata (abfd).magic = n_magic; - } - else if (N_MAGIC (*execp) == OMAGIC - || N_MAGIC (*execp) == BMAGIC) - adata (abfd).magic = o_magic; - else - { - /* Should have been checked with N_BADMAG before this routine - was called. */ - abort (); - } - - bfd_get_start_address (abfd) = execp->a_entry; - - obj_aout_symbols (abfd) = (aout_symbol_type *)NULL; - bfd_get_symcount (abfd) = execp->a_syms / sizeof (struct external_nlist); - - /* The default relocation entry size is that of traditional V7 Unix. */ - obj_reloc_entry_size (abfd) = RELOC_STD_SIZE; - - /* The default symbol entry size is that of traditional Unix. */ - obj_symbol_entry_size (abfd) = EXTERNAL_NLIST_SIZE; - -#ifdef USE_MMAP - bfd_init_window (&obj_aout_sym_window (abfd)); - bfd_init_window (&obj_aout_string_window (abfd)); -#endif - obj_aout_external_syms (abfd) = NULL; - obj_aout_external_strings (abfd) = NULL; - obj_aout_sym_hashes (abfd) = NULL; - - if (! NAME(aout,make_sections) (abfd)) - return NULL; - - obj_datasec (abfd)->_raw_size = execp->a_data; - obj_bsssec (abfd)->_raw_size = execp->a_bss; - - obj_textsec (abfd)->flags = - (execp->a_trsize != 0 - ? (SEC_ALLOC | SEC_LOAD | SEC_CODE | SEC_HAS_CONTENTS | SEC_RELOC) - : (SEC_ALLOC | SEC_LOAD | SEC_CODE | SEC_HAS_CONTENTS)); - obj_datasec (abfd)->flags = - (execp->a_drsize != 0 - ? (SEC_ALLOC | SEC_LOAD | SEC_DATA | SEC_HAS_CONTENTS | SEC_RELOC) - : (SEC_ALLOC | SEC_LOAD | SEC_DATA | SEC_HAS_CONTENTS)); - obj_bsssec (abfd)->flags = SEC_ALLOC; - -#ifdef THIS_IS_ONLY_DOCUMENTATION - /* The common code can't fill in these things because they depend - on either the start address of the text segment, the rounding - up of virtual addresses between segments, or the starting file - position of the text segment -- all of which varies among different - versions of a.out. */ - - /* Call back to the format-dependent code to fill in the rest of the - fields and do any further cleanup. Things that should be filled - in by the callback: */ - - struct exec *execp = exec_hdr (abfd); - - obj_textsec (abfd)->size = N_TXTSIZE(*execp); - obj_textsec (abfd)->raw_size = N_TXTSIZE(*execp); - /* data and bss are already filled in since they're so standard */ - - /* The virtual memory addresses of the sections */ - obj_textsec (abfd)->vma = N_TXTADDR(*execp); - obj_datasec (abfd)->vma = N_DATADDR(*execp); - obj_bsssec (abfd)->vma = N_BSSADDR(*execp); - - /* The file offsets of the sections */ - obj_textsec (abfd)->filepos = N_TXTOFF(*execp); - obj_datasec (abfd)->filepos = N_DATOFF(*execp); - - /* The file offsets of the relocation info */ - obj_textsec (abfd)->rel_filepos = N_TRELOFF(*execp); - obj_datasec (abfd)->rel_filepos = N_DRELOFF(*execp); - - /* The file offsets of the string table and symbol table. */ - obj_str_filepos (abfd) = N_STROFF (*execp); - obj_sym_filepos (abfd) = N_SYMOFF (*execp); - - /* Determine the architecture and machine type of the object file. */ - switch (N_MACHTYPE (*exec_hdr (abfd))) { - default: - abfd->obj_arch = bfd_arch_obscure; - break; - } - - adata(abfd)->page_size = TARGET_PAGE_SIZE; - adata(abfd)->segment_size = SEGMENT_SIZE; - adata(abfd)->exec_bytes_size = EXEC_BYTES_SIZE; - - return abfd->xvec; - - /* The architecture is encoded in various ways in various a.out variants, - or is not encoded at all in some of them. The relocation size depends - on the architecture and the a.out variant. Finally, the return value - is the bfd_target vector in use. If an error occurs, return zero and - set bfd_error to the appropriate error code. - - Formats such as b.out, which have additional fields in the a.out - header, should cope with them in this callback as well. */ -#endif /* DOCUMENTATION */ - - result = (*callback_to_real_object_p)(abfd); - - /* Now that the segment addresses have been worked out, take a better - guess at whether the file is executable. If the entry point - is within the text segment, assume it is. (This makes files - executable even if their entry point address is 0, as long as - their text starts at zero.). */ - if ((execp->a_entry >= obj_textsec(abfd)->vma) && - (execp->a_entry < obj_textsec(abfd)->vma + obj_textsec(abfd)->_raw_size)) - abfd->flags |= EXEC_P; -#ifdef STAT_FOR_EXEC - else - { - struct stat stat_buf; - - /* The original heuristic doesn't work in some important cases. - The a.out file has no information about the text start - address. For files (like kernels) linked to non-standard - addresses (ld -Ttext nnn) the entry point may not be between - the default text start (obj_textsec(abfd)->vma) and - (obj_textsec(abfd)->vma) + text size. This is not just a mach - issue. Many kernels are loaded at non standard addresses. */ - if (abfd->iostream != NULL - && (abfd->flags & BFD_IN_MEMORY) == 0 - && (fstat(fileno((FILE *) (abfd->iostream)), &stat_buf) == 0) - && ((stat_buf.st_mode & 0111) != 0)) - abfd->flags |= EXEC_P; - } -#endif /* STAT_FOR_EXEC */ - - if (result) - { -#if 0 /* These should be set correctly anyways. */ - abfd->sections = obj_textsec (abfd); - obj_textsec (abfd)->next = obj_datasec (abfd); - obj_datasec (abfd)->next = obj_bsssec (abfd); -#endif - } - else - { - free (rawptr); - abfd->tdata.aout_data = oldrawptr; - } - return result; -} - -/* -FUNCTION - aout_@var{size}_mkobject - -SYNOPSIS - boolean aout_@var{size}_mkobject, (bfd *abfd); - -DESCRIPTION - Initialize BFD @var{abfd} for use with a.out files. -*/ - -boolean -NAME(aout,mkobject) (abfd) - bfd *abfd; -{ - struct aout_data_struct *rawptr; - - bfd_set_error (bfd_error_system_call); - - /* Use an intermediate variable for clarity */ - rawptr = (struct aout_data_struct *)bfd_zalloc (abfd, sizeof (struct aout_data_struct )); - - if (rawptr == NULL) - return false; - - abfd->tdata.aout_data = rawptr; - exec_hdr (abfd) = &(rawptr->e); - - obj_textsec (abfd) = (asection *)NULL; - obj_datasec (abfd) = (asection *)NULL; - obj_bsssec (abfd) = (asection *)NULL; - - return true; -} - - -/* -FUNCTION - aout_@var{size}_machine_type - -SYNOPSIS - enum machine_type aout_@var{size}_machine_type - (enum bfd_architecture arch, - unsigned long machine)); - -DESCRIPTION - Keep track of machine architecture and machine type for - a.out's. Return the <> for a particular - architecture and machine, or <> if that exact architecture - and machine can't be represented in a.out format. - - If the architecture is understood, machine type 0 (default) - is always understood. -*/ - -enum machine_type -NAME(aout,machine_type) (arch, machine, unknown) - enum bfd_architecture arch; - unsigned long machine; - boolean *unknown; -{ - enum machine_type arch_flags; - - arch_flags = M_UNKNOWN; - *unknown = true; - - switch (arch) { - case bfd_arch_sparc: - if (machine == 0 - || machine == bfd_mach_sparc - || machine == bfd_mach_sparc_v9) - arch_flags = M_SPARC; - break; - - case bfd_arch_m68k: - switch (machine) { - case 0: arch_flags = M_68010; break; - case 68000: arch_flags = M_UNKNOWN; *unknown = false; break; - case 68010: arch_flags = M_68010; break; - case 68020: arch_flags = M_68020; break; - default: arch_flags = M_UNKNOWN; break; - } - break; - - case bfd_arch_i386: - if (machine == 0) arch_flags = M_386; - break; - - case bfd_arch_a29k: - if (machine == 0) arch_flags = M_29K; - break; - - case bfd_arch_arm: - if (machine == 0) arch_flags = M_ARM; - break; - - case bfd_arch_mips: - switch (machine) { - case 0: - case 2000: - case 3000: arch_flags = M_MIPS1; break; - case 4000: /* mips3 */ - case 4400: - case 8000: /* mips4 */ - /* real mips2: */ - case 6000: arch_flags = M_MIPS2; break; - default: arch_flags = M_UNKNOWN; break; - } - break; - - case bfd_arch_ns32k: - switch (machine) { - case 0: arch_flags = M_NS32532; break; - case 32032: arch_flags = M_NS32032; break; - case 32532: arch_flags = M_NS32532; break; - default: arch_flags = M_UNKNOWN; break; - } - break; - - case bfd_arch_vax: - *unknown = false; - break; - - - default: - arch_flags = M_UNKNOWN; - } - - if (arch_flags != M_UNKNOWN) - *unknown = false; - - return arch_flags; -} - - -/* -FUNCTION - aout_@var{size}_set_arch_mach - -SYNOPSIS - boolean aout_@var{size}_set_arch_mach, - (bfd *, - enum bfd_architecture arch, - unsigned long machine)); - -DESCRIPTION - Set the architecture and the machine of the BFD @var{abfd} to the - values @var{arch} and @var{machine}. Verify that @var{abfd}'s format - can support the architecture required. -*/ - -boolean -NAME(aout,set_arch_mach) (abfd, arch, machine) - bfd *abfd; - enum bfd_architecture arch; - unsigned long machine; -{ - if (! bfd_default_set_arch_mach (abfd, arch, machine)) - return false; - - if (arch != bfd_arch_unknown) - { - boolean unknown; - - NAME(aout,machine_type) (arch, machine, &unknown); - if (unknown) - return false; - } - - /* Determine the size of a relocation entry */ - switch (arch) { - case bfd_arch_sparc: - case bfd_arch_a29k: - case bfd_arch_mips: - obj_reloc_entry_size (abfd) = RELOC_EXT_SIZE; - break; - default: - obj_reloc_entry_size (abfd) = RELOC_STD_SIZE; - break; - } - - return (*aout_backend_info(abfd)->set_sizes) (abfd); -} - -static void -adjust_o_magic (abfd, execp) - bfd *abfd; - struct internal_exec *execp; -{ - file_ptr pos = adata (abfd).exec_bytes_size; - bfd_vma vma = 0; - int pad = 0; - - /* Text. */ - obj_textsec(abfd)->filepos = pos; - if (!obj_textsec(abfd)->user_set_vma) - obj_textsec(abfd)->vma = vma; - else - vma = obj_textsec(abfd)->vma; - - pos += obj_textsec(abfd)->_raw_size; - vma += obj_textsec(abfd)->_raw_size; - - /* Data. */ - if (!obj_datasec(abfd)->user_set_vma) - { -#if 0 /* ?? Does alignment in the file image really matter? */ - pad = align_power (vma, obj_datasec(abfd)->alignment_power) - vma; -#endif - obj_textsec(abfd)->_raw_size += pad; - pos += pad; - vma += pad; - obj_datasec(abfd)->vma = vma; - } - else - vma = obj_datasec(abfd)->vma; - obj_datasec(abfd)->filepos = pos; - pos += obj_datasec(abfd)->_raw_size; - vma += obj_datasec(abfd)->_raw_size; - - /* BSS. */ - if (!obj_bsssec(abfd)->user_set_vma) - { -#if 0 - pad = align_power (vma, obj_bsssec(abfd)->alignment_power) - vma; -#endif - obj_datasec(abfd)->_raw_size += pad; - pos += pad; - vma += pad; - obj_bsssec(abfd)->vma = vma; - } - else - { - /* The VMA of the .bss section is set by the the VMA of the - .data section plus the size of the .data section. We may - need to add padding bytes to make this true. */ - pad = obj_bsssec (abfd)->vma - vma; - if (pad > 0) - { - obj_datasec (abfd)->_raw_size += pad; - pos += pad; - } - } - obj_bsssec(abfd)->filepos = pos; - - /* Fix up the exec header. */ - execp->a_text = obj_textsec(abfd)->_raw_size; - execp->a_data = obj_datasec(abfd)->_raw_size; - execp->a_bss = obj_bsssec(abfd)->_raw_size; - N_SET_MAGIC (*execp, OMAGIC); -} - -static void -adjust_z_magic (abfd, execp) - bfd *abfd; - struct internal_exec *execp; -{ - bfd_size_type data_pad, text_pad; - file_ptr text_end; - CONST struct aout_backend_data *abdp; - int ztih; /* Nonzero if text includes exec header. */ - - abdp = aout_backend_info (abfd); - - /* Text. */ - ztih = (abdp != NULL - && (abdp->text_includes_header - || obj_aout_subformat (abfd) == q_magic_format)); - obj_textsec(abfd)->filepos = (ztih - ? adata(abfd).exec_bytes_size - : adata(abfd).zmagic_disk_block_size); - if (! obj_textsec(abfd)->user_set_vma) - { - /* ?? Do we really need to check for relocs here? */ - obj_textsec(abfd)->vma = ((abfd->flags & HAS_RELOC) - ? 0 - : (ztih - ? (abdp->default_text_vma - + adata(abfd).exec_bytes_size) - : abdp->default_text_vma)); - text_pad = 0; - } - else - { - /* The .text section is being loaded at an unusual address. We - may need to pad it such that the .data section starts at a page - boundary. */ - if (ztih) - text_pad = ((obj_textsec (abfd)->filepos - obj_textsec (abfd)->vma) - & (adata (abfd).page_size - 1)); - else - text_pad = ((- obj_textsec (abfd)->vma) - & (adata (abfd).page_size - 1)); - } - - /* Find start of data. */ - if (ztih) - { - text_end = obj_textsec (abfd)->filepos + obj_textsec (abfd)->_raw_size; - text_pad += BFD_ALIGN (text_end, adata (abfd).page_size) - text_end; - } - else - { - /* Note that if page_size == zmagic_disk_block_size, then - filepos == page_size, and this case is the same as the ztih - case. */ - text_end = obj_textsec (abfd)->_raw_size; - text_pad += BFD_ALIGN (text_end, adata (abfd).page_size) - text_end; - text_end += obj_textsec (abfd)->filepos; - } - obj_textsec(abfd)->_raw_size += text_pad; - text_end += text_pad; - - /* Data. */ - if (!obj_datasec(abfd)->user_set_vma) - { - bfd_vma vma; - vma = obj_textsec(abfd)->vma + obj_textsec(abfd)->_raw_size; - obj_datasec(abfd)->vma = BFD_ALIGN (vma, adata(abfd).segment_size); - } - if (abdp && abdp->zmagic_mapped_contiguous) - { - text_pad = (obj_datasec(abfd)->vma - - obj_textsec(abfd)->vma - - obj_textsec(abfd)->_raw_size); - obj_textsec(abfd)->_raw_size += text_pad; - } - obj_datasec(abfd)->filepos = (obj_textsec(abfd)->filepos - + obj_textsec(abfd)->_raw_size); - - /* Fix up exec header while we're at it. */ - execp->a_text = obj_textsec(abfd)->_raw_size; - if (ztih && (!abdp || (abdp && !abdp->exec_header_not_counted))) - execp->a_text += adata(abfd).exec_bytes_size; - if (obj_aout_subformat (abfd) == q_magic_format) - N_SET_MAGIC (*execp, QMAGIC); - else - N_SET_MAGIC (*execp, ZMAGIC); - - /* Spec says data section should be rounded up to page boundary. */ - obj_datasec(abfd)->_raw_size - = align_power (obj_datasec(abfd)->_raw_size, - obj_bsssec(abfd)->alignment_power); - execp->a_data = BFD_ALIGN (obj_datasec(abfd)->_raw_size, - adata(abfd).page_size); - data_pad = execp->a_data - obj_datasec(abfd)->_raw_size; - - /* BSS. */ - if (!obj_bsssec(abfd)->user_set_vma) - obj_bsssec(abfd)->vma = (obj_datasec(abfd)->vma - + obj_datasec(abfd)->_raw_size); - /* If the BSS immediately follows the data section and extra space - in the page is left after the data section, fudge data - in the header so that the bss section looks smaller by that - amount. We'll start the bss section there, and lie to the OS. - (Note that a linker script, as well as the above assignment, - could have explicitly set the BSS vma to immediately follow - the data section.) */ - if (align_power (obj_bsssec(abfd)->vma, obj_bsssec(abfd)->alignment_power) - == obj_datasec(abfd)->vma + obj_datasec(abfd)->_raw_size) - execp->a_bss = (data_pad > obj_bsssec(abfd)->_raw_size) ? 0 : - obj_bsssec(abfd)->_raw_size - data_pad; - else - execp->a_bss = obj_bsssec(abfd)->_raw_size; -} - -static void -adjust_n_magic (abfd, execp) - bfd *abfd; - struct internal_exec *execp; -{ - file_ptr pos = adata(abfd).exec_bytes_size; - bfd_vma vma = 0; - int pad; - - /* Text. */ - obj_textsec(abfd)->filepos = pos; - if (!obj_textsec(abfd)->user_set_vma) - obj_textsec(abfd)->vma = vma; - else - vma = obj_textsec(abfd)->vma; - pos += obj_textsec(abfd)->_raw_size; - vma += obj_textsec(abfd)->_raw_size; - - /* Data. */ - obj_datasec(abfd)->filepos = pos; - if (!obj_datasec(abfd)->user_set_vma) - obj_datasec(abfd)->vma = BFD_ALIGN (vma, adata(abfd).segment_size); - vma = obj_datasec(abfd)->vma; - - /* Since BSS follows data immediately, see if it needs alignment. */ - vma += obj_datasec(abfd)->_raw_size; - pad = align_power (vma, obj_bsssec(abfd)->alignment_power) - vma; - obj_datasec(abfd)->_raw_size += pad; - pos += obj_datasec(abfd)->_raw_size; - - /* BSS. */ - if (!obj_bsssec(abfd)->user_set_vma) - obj_bsssec(abfd)->vma = vma; - else - vma = obj_bsssec(abfd)->vma; - - /* Fix up exec header. */ - execp->a_text = obj_textsec(abfd)->_raw_size; - execp->a_data = obj_datasec(abfd)->_raw_size; - execp->a_bss = obj_bsssec(abfd)->_raw_size; - N_SET_MAGIC (*execp, NMAGIC); -} - -boolean -NAME(aout,adjust_sizes_and_vmas) (abfd, text_size, text_end) - bfd *abfd; - bfd_size_type *text_size; - file_ptr *text_end; -{ - struct internal_exec *execp = exec_hdr (abfd); - - if (! NAME(aout,make_sections) (abfd)) - return false; - - if (adata(abfd).magic != undecided_magic) - return true; - - obj_textsec(abfd)->_raw_size = - align_power(obj_textsec(abfd)->_raw_size, - obj_textsec(abfd)->alignment_power); - - *text_size = obj_textsec (abfd)->_raw_size; - /* Rule (heuristic) for when to pad to a new page. Note that there - are (at least) two ways demand-paged (ZMAGIC) files have been - handled. Most Berkeley-based systems start the text segment at - (TARGET_PAGE_SIZE). However, newer versions of SUNOS start the text - segment right after the exec header; the latter is counted in the - text segment size, and is paged in by the kernel with the rest of - the text. */ - - /* This perhaps isn't the right way to do this, but made it simpler for me - to understand enough to implement it. Better would probably be to go - right from BFD flags to alignment/positioning characteristics. But the - old code was sloppy enough about handling the flags, and had enough - other magic, that it was a little hard for me to understand. I think - I understand it better now, but I haven't time to do the cleanup this - minute. */ - - if (abfd->flags & D_PAGED) - /* Whether or not WP_TEXT is set -- let D_PAGED override. */ - adata(abfd).magic = z_magic; - else if (abfd->flags & WP_TEXT) - adata(abfd).magic = n_magic; - else - adata(abfd).magic = o_magic; - -#ifdef BFD_AOUT_DEBUG /* requires gcc2 */ -#if __GNUC__ >= 2 - fprintf (stderr, "%s text=<%x,%x,%x> data=<%x,%x,%x> bss=<%x,%x,%x>\n", - ({ char *str; - switch (adata(abfd).magic) { - case n_magic: str = "NMAGIC"; break; - case o_magic: str = "OMAGIC"; break; - case z_magic: str = "ZMAGIC"; break; - default: abort (); - } - str; - }), - obj_textsec(abfd)->vma, obj_textsec(abfd)->_raw_size, - obj_textsec(abfd)->alignment_power, - obj_datasec(abfd)->vma, obj_datasec(abfd)->_raw_size, - obj_datasec(abfd)->alignment_power, - obj_bsssec(abfd)->vma, obj_bsssec(abfd)->_raw_size, - obj_bsssec(abfd)->alignment_power); -#endif -#endif - - switch (adata(abfd).magic) - { - case o_magic: - adjust_o_magic (abfd, execp); - break; - case z_magic: - adjust_z_magic (abfd, execp); - break; - case n_magic: - adjust_n_magic (abfd, execp); - break; - default: - abort (); - } - -#ifdef BFD_AOUT_DEBUG - fprintf (stderr, " text=<%x,%x,%x> data=<%x,%x,%x> bss=<%x,%x>\n", - obj_textsec(abfd)->vma, obj_textsec(abfd)->_raw_size, - obj_textsec(abfd)->filepos, - obj_datasec(abfd)->vma, obj_datasec(abfd)->_raw_size, - obj_datasec(abfd)->filepos, - obj_bsssec(abfd)->vma, obj_bsssec(abfd)->_raw_size); -#endif - - return true; -} - -/* -FUNCTION - aout_@var{size}_new_section_hook - -SYNOPSIS - boolean aout_@var{size}_new_section_hook, - (bfd *abfd, - asection *newsect)); - -DESCRIPTION - Called by the BFD in response to a @code{bfd_make_section} - request. -*/ -boolean -NAME(aout,new_section_hook) (abfd, newsect) - bfd *abfd; - asection *newsect; -{ - /* align to double at least */ - newsect->alignment_power = bfd_get_arch_info(abfd)->section_align_power; - - - if (bfd_get_format (abfd) == bfd_object) - { - if (obj_textsec(abfd) == NULL && !strcmp(newsect->name, ".text")) { - obj_textsec(abfd)= newsect; - newsect->target_index = N_TEXT; - return true; - } - - if (obj_datasec(abfd) == NULL && !strcmp(newsect->name, ".data")) { - obj_datasec(abfd) = newsect; - newsect->target_index = N_DATA; - return true; - } - - if (obj_bsssec(abfd) == NULL && !strcmp(newsect->name, ".bss")) { - obj_bsssec(abfd) = newsect; - newsect->target_index = N_BSS; - return true; - } - - } - - /* We allow more than three sections internally */ - return true; -} - -boolean -NAME(aout,set_section_contents) (abfd, section, location, offset, count) - bfd *abfd; - sec_ptr section; - PTR location; - file_ptr offset; - bfd_size_type count; -{ - file_ptr text_end; - bfd_size_type text_size; - - if (! abfd->output_has_begun) - { - if (! NAME(aout,adjust_sizes_and_vmas) (abfd, &text_size, &text_end)) - return false; - } - - if (section == obj_bsssec (abfd)) - { - bfd_set_error (bfd_error_no_contents); - return false; - } - - if (section != obj_textsec (abfd) - && section != obj_datasec (abfd)) - { - (*_bfd_error_handler) - ("%s: can not represent section `%s' in a.out object file format", - bfd_get_filename (abfd), bfd_get_section_name (abfd, section)); - bfd_set_error (bfd_error_nonrepresentable_section); - return false; - } - - if (count != 0) - { - if (bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0 - || bfd_write (location, 1, count, abfd) != count) - return false; - } - - return true; -} - -/* Read the external symbols from an a.out file. */ - -static boolean -aout_get_external_symbols (abfd) - bfd *abfd; -{ - if (obj_aout_external_syms (abfd) == (struct external_nlist *) NULL) - { - bfd_size_type count; - struct external_nlist *syms; - - count = exec_hdr (abfd)->a_syms / EXTERNAL_NLIST_SIZE; - -#ifdef USE_MMAP - if (bfd_get_file_window (abfd, - obj_sym_filepos (abfd), exec_hdr (abfd)->a_syms, - &obj_aout_sym_window (abfd), true) == false) - return false; - syms = (struct external_nlist *) obj_aout_sym_window (abfd).data; -#else - /* We allocate using malloc to make the values easy to free - later on. If we put them on the obstack it might not be - possible to free them. */ - syms = ((struct external_nlist *) - bfd_malloc ((size_t) count * EXTERNAL_NLIST_SIZE)); - if (syms == (struct external_nlist *) NULL && count != 0) - return false; - - if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0 - || (bfd_read (syms, 1, exec_hdr (abfd)->a_syms, abfd) - != exec_hdr (abfd)->a_syms)) - { - free (syms); - return false; - } -#endif - - obj_aout_external_syms (abfd) = syms; - obj_aout_external_sym_count (abfd) = count; - } - - if (obj_aout_external_strings (abfd) == NULL - && exec_hdr (abfd)->a_syms != 0) - { - unsigned char string_chars[BYTES_IN_WORD]; - bfd_size_type stringsize; - char *strings; - - /* Get the size of the strings. */ - if (bfd_seek (abfd, obj_str_filepos (abfd), SEEK_SET) != 0 - || (bfd_read ((PTR) string_chars, BYTES_IN_WORD, 1, abfd) - != BYTES_IN_WORD)) - return false; - stringsize = GET_WORD (abfd, string_chars); - -#ifdef USE_MMAP - if (bfd_get_file_window (abfd, obj_str_filepos (abfd), stringsize, - &obj_aout_string_window (abfd), true) == false) - return false; - strings = (char *) obj_aout_string_window (abfd).data; -#else - strings = (char *) bfd_malloc ((size_t) stringsize + 1); - if (strings == NULL) - return false; - - /* Skip space for the string count in the buffer for convenience - when using indexes. */ - if (bfd_read (strings + BYTES_IN_WORD, 1, stringsize - BYTES_IN_WORD, - abfd) - != stringsize - BYTES_IN_WORD) - { - free (strings); - return false; - } -#endif - - /* Ensure that a zero index yields an empty string. */ - strings[0] = '\0'; - - strings[stringsize - 1] = 0; - - obj_aout_external_strings (abfd) = strings; - obj_aout_external_string_size (abfd) = stringsize; - } - - return true; -} - -/* Translate an a.out symbol into a BFD symbol. The desc, other, type - and symbol->value fields of CACHE_PTR will be set from the a.out - nlist structure. This function is responsible for setting - symbol->flags and symbol->section, and adjusting symbol->value. */ - -static boolean -translate_from_native_sym_flags (abfd, cache_ptr) - bfd *abfd; - aout_symbol_type *cache_ptr; -{ - flagword visible; - - if ((cache_ptr->type & N_STAB) != 0 - || cache_ptr->type == N_FN) - { - asection *sec; - - /* This is a debugging symbol. */ - - cache_ptr->symbol.flags = BSF_DEBUGGING; - - /* Work out the symbol section. */ - switch (cache_ptr->type & N_TYPE) - { - case N_TEXT: - case N_FN: - sec = obj_textsec (abfd); - break; - case N_DATA: - sec = obj_datasec (abfd); - break; - case N_BSS: - sec = obj_bsssec (abfd); - break; - default: - case N_ABS: - sec = bfd_abs_section_ptr; - break; - } - - cache_ptr->symbol.section = sec; - cache_ptr->symbol.value -= sec->vma; - - return true; - } - - /* Get the default visibility. This does not apply to all types, so - we just hold it in a local variable to use if wanted. */ - if ((cache_ptr->type & N_EXT) == 0) - visible = BSF_LOCAL; - else - visible = BSF_GLOBAL; - - switch (cache_ptr->type) - { - default: - case N_ABS: case N_ABS | N_EXT: - cache_ptr->symbol.section = bfd_abs_section_ptr; - cache_ptr->symbol.flags = visible; - break; - - case N_UNDF | N_EXT: - if (cache_ptr->symbol.value != 0) - { - /* This is a common symbol. */ - cache_ptr->symbol.flags = BSF_GLOBAL; - cache_ptr->symbol.section = bfd_com_section_ptr; - } - else - { - cache_ptr->symbol.flags = 0; - cache_ptr->symbol.section = bfd_und_section_ptr; - } - break; - - case N_TEXT: case N_TEXT | N_EXT: - cache_ptr->symbol.section = obj_textsec (abfd); - cache_ptr->symbol.value -= cache_ptr->symbol.section->vma; - cache_ptr->symbol.flags = visible; - break; - - /* N_SETV symbols used to represent set vectors placed in the - data section. They are no longer generated. Theoretically, - it was possible to extract the entries and combine them with - new ones, although I don't know if that was ever actually - done. Unless that feature is restored, treat them as data - symbols. */ - case N_SETV: case N_SETV | N_EXT: - case N_DATA: case N_DATA | N_EXT: - cache_ptr->symbol.section = obj_datasec (abfd); - cache_ptr->symbol.value -= cache_ptr->symbol.section->vma; - cache_ptr->symbol.flags = visible; - break; - - case N_BSS: case N_BSS | N_EXT: - cache_ptr->symbol.section = obj_bsssec (abfd); - cache_ptr->symbol.value -= cache_ptr->symbol.section->vma; - cache_ptr->symbol.flags = visible; - break; - - case N_SETA: case N_SETA | N_EXT: - case N_SETT: case N_SETT | N_EXT: - case N_SETD: case N_SETD | N_EXT: - case N_SETB: case N_SETB | N_EXT: - { - asection *section; - arelent_chain *reloc; - asection *into_section; - - /* This is a set symbol. The name of the symbol is the name - of the set (e.g., __CTOR_LIST__). The value of the symbol - is the value to add to the set. We create a section with - the same name as the symbol, and add a reloc to insert the - appropriate value into the section. - - This action is actually obsolete; it used to make the - linker do the right thing, but the linker no longer uses - this function. */ - - section = bfd_get_section_by_name (abfd, cache_ptr->symbol.name); - if (section == NULL) - { - char *copy; - - copy = bfd_alloc (abfd, strlen (cache_ptr->symbol.name) + 1); - if (copy == NULL) - return false; - - strcpy (copy, cache_ptr->symbol.name); - section = bfd_make_section (abfd, copy); - if (section == NULL) - return false; - } - - reloc = (arelent_chain *) bfd_alloc (abfd, sizeof (arelent_chain)); - if (reloc == NULL) - return false; - - /* Build a relocation entry for the constructor. */ - switch (cache_ptr->type & N_TYPE) - { - case N_SETA: - into_section = bfd_abs_section_ptr; - cache_ptr->type = N_ABS; - break; - case N_SETT: - into_section = obj_textsec (abfd); - cache_ptr->type = N_TEXT; - break; - case N_SETD: - into_section = obj_datasec (abfd); - cache_ptr->type = N_DATA; - break; - case N_SETB: - into_section = obj_bsssec (abfd); - cache_ptr->type = N_BSS; - break; - } - - /* Build a relocation pointing into the constructor section - pointing at the symbol in the set vector specified. */ - reloc->relent.addend = cache_ptr->symbol.value; - cache_ptr->symbol.section = into_section; - reloc->relent.sym_ptr_ptr = into_section->symbol_ptr_ptr; - - /* We modify the symbol to belong to a section depending upon - the name of the symbol, and add to the size of the section - to contain a pointer to the symbol. Build a reloc entry to - relocate to this symbol attached to this section. */ - section->flags = SEC_CONSTRUCTOR | SEC_RELOC; - - section->reloc_count++; - section->alignment_power = 2; - - reloc->next = section->constructor_chain; - section->constructor_chain = reloc; - reloc->relent.address = section->_raw_size; - section->_raw_size += BYTES_IN_WORD; - - reloc->relent.howto = CTOR_TABLE_RELOC_HOWTO(abfd); - - cache_ptr->symbol.flags |= BSF_CONSTRUCTOR; - } - break; - - case N_WARNING: - /* This symbol is the text of a warning message. The next - symbol is the symbol to associate the warning with. If a - reference is made to that symbol, a warning is issued. */ - cache_ptr->symbol.flags = BSF_DEBUGGING | BSF_WARNING; - cache_ptr->symbol.section = bfd_abs_section_ptr; - break; - - case N_INDR: case N_INDR | N_EXT: - /* An indirect symbol. This consists of two symbols in a row. - The first symbol is the name of the indirection. The second - symbol is the name of the target. A reference to the first - symbol becomes a reference to the second. */ - cache_ptr->symbol.flags = BSF_DEBUGGING | BSF_INDIRECT | visible; - cache_ptr->symbol.section = bfd_ind_section_ptr; - break; - - case N_WEAKU: - cache_ptr->symbol.section = bfd_und_section_ptr; - cache_ptr->symbol.flags = BSF_WEAK; - break; - - case N_WEAKA: - cache_ptr->symbol.section = bfd_abs_section_ptr; - cache_ptr->symbol.flags = BSF_WEAK; - break; - - case N_WEAKT: - cache_ptr->symbol.section = obj_textsec (abfd); - cache_ptr->symbol.value -= cache_ptr->symbol.section->vma; - cache_ptr->symbol.flags = BSF_WEAK; - break; - - case N_WEAKD: - cache_ptr->symbol.section = obj_datasec (abfd); - cache_ptr->symbol.value -= cache_ptr->symbol.section->vma; - cache_ptr->symbol.flags = BSF_WEAK; - break; - - case N_WEAKB: - cache_ptr->symbol.section = obj_bsssec (abfd); - cache_ptr->symbol.value -= cache_ptr->symbol.section->vma; - cache_ptr->symbol.flags = BSF_WEAK; - break; - } - - return true; -} - -/* Set the fields of SYM_POINTER according to CACHE_PTR. */ - -static boolean -translate_to_native_sym_flags (abfd, cache_ptr, sym_pointer) - bfd *abfd; - asymbol *cache_ptr; - struct external_nlist *sym_pointer; -{ - bfd_vma value = cache_ptr->value; - asection *sec; - bfd_vma off; - - /* Mask out any existing type bits in case copying from one section - to another. */ - sym_pointer->e_type[0] &= ~N_TYPE; - - sec = bfd_get_section (cache_ptr); - off = 0; - - if (sec == NULL) - { - /* This case occurs, e.g., for the *DEBUG* section of a COFF - file. */ - (*_bfd_error_handler) - ("%s: can not represent section `%s' in a.out object file format", - bfd_get_filename (abfd), bfd_get_section_name (abfd, sec)); - bfd_set_error (bfd_error_nonrepresentable_section); - return false; - } - - if (sec->output_section != NULL) - { - off = sec->output_offset; - sec = sec->output_section; - } - - if (bfd_is_abs_section (sec)) - sym_pointer->e_type[0] |= N_ABS; - else if (sec == obj_textsec (abfd)) - sym_pointer->e_type[0] |= N_TEXT; - else if (sec == obj_datasec (abfd)) - sym_pointer->e_type[0] |= N_DATA; - else if (sec == obj_bsssec (abfd)) - sym_pointer->e_type[0] |= N_BSS; - else if (bfd_is_und_section (sec)) - sym_pointer->e_type[0] = N_UNDF | N_EXT; - else if (bfd_is_ind_section (sec)) - sym_pointer->e_type[0] = N_INDR; - else if (bfd_is_com_section (sec)) - sym_pointer->e_type[0] = N_UNDF | N_EXT; - else - { - (*_bfd_error_handler) - ("%s: can not represent section `%s' in a.out object file format", - bfd_get_filename (abfd), bfd_get_section_name (abfd, sec)); - bfd_set_error (bfd_error_nonrepresentable_section); - return false; - } - - /* Turn the symbol from section relative to absolute again */ - value += sec->vma + off; - - if ((cache_ptr->flags & BSF_WARNING) != 0) - sym_pointer->e_type[0] = N_WARNING; - - if ((cache_ptr->flags & BSF_DEBUGGING) != 0) - sym_pointer->e_type[0] = ((aout_symbol_type *) cache_ptr)->type; - else if ((cache_ptr->flags & BSF_GLOBAL) != 0) - sym_pointer->e_type[0] |= N_EXT; - - if ((cache_ptr->flags & BSF_CONSTRUCTOR) != 0) - { - int type = ((aout_symbol_type *) cache_ptr)->type; - switch (type) - { - case N_ABS: type = N_SETA; break; - case N_TEXT: type = N_SETT; break; - case N_DATA: type = N_SETD; break; - case N_BSS: type = N_SETB; break; - } - sym_pointer->e_type[0] = type; - } - - if ((cache_ptr->flags & BSF_WEAK) != 0) - { - int type; - - switch (sym_pointer->e_type[0] & N_TYPE) - { - default: - case N_ABS: type = N_WEAKA; break; - case N_TEXT: type = N_WEAKT; break; - case N_DATA: type = N_WEAKD; break; - case N_BSS: type = N_WEAKB; break; - case N_UNDF: type = N_WEAKU; break; - } - sym_pointer->e_type[0] = type; - } - - PUT_WORD(abfd, value, sym_pointer->e_value); - - return true; -} - -/* Native-level interface to symbols. */ - -asymbol * -NAME(aout,make_empty_symbol) (abfd) - bfd *abfd; -{ - aout_symbol_type *new = - (aout_symbol_type *)bfd_zalloc (abfd, sizeof (aout_symbol_type)); - if (!new) - return NULL; - new->symbol.the_bfd = abfd; - - return &new->symbol; -} - -/* Translate a set of internal symbols into external symbols. */ - -boolean -NAME(aout,translate_symbol_table) (abfd, in, ext, count, str, strsize, dynamic) - bfd *abfd; - aout_symbol_type *in; - struct external_nlist *ext; - bfd_size_type count; - char *str; - bfd_size_type strsize; - boolean dynamic; -{ - struct external_nlist *ext_end; - - ext_end = ext + count; - for (; ext < ext_end; ext++, in++) - { - bfd_vma x; - - x = GET_WORD (abfd, ext->e_strx); - in->symbol.the_bfd = abfd; - - /* For the normal symbols, the zero index points at the number - of bytes in the string table but is to be interpreted as the - null string. For the dynamic symbols, the number of bytes in - the string table is stored in the __DYNAMIC structure and the - zero index points at an actual string. */ - if (x == 0 && ! dynamic) - in->symbol.name = ""; - else if (x < strsize) - in->symbol.name = str + x; - else - return false; - - in->symbol.value = GET_SWORD (abfd, ext->e_value); - in->desc = bfd_h_get_16 (abfd, ext->e_desc); - in->other = bfd_h_get_8 (abfd, ext->e_other); - in->type = bfd_h_get_8 (abfd, ext->e_type); - in->symbol.udata.p = NULL; - - if (! translate_from_native_sym_flags (abfd, in)) - return false; - - if (dynamic) - in->symbol.flags |= BSF_DYNAMIC; - } - - return true; -} - -/* We read the symbols into a buffer, which is discarded when this - function exits. We read the strings into a buffer large enough to - hold them all plus all the cached symbol entries. */ - -boolean -NAME(aout,slurp_symbol_table) (abfd) - bfd *abfd; -{ - struct external_nlist *old_external_syms; - aout_symbol_type *cached; - size_t cached_size; - - /* If there's no work to be done, don't do any */ - if (obj_aout_symbols (abfd) != (aout_symbol_type *) NULL) - return true; - - old_external_syms = obj_aout_external_syms (abfd); - - if (! aout_get_external_symbols (abfd)) - return false; - - cached_size = (obj_aout_external_sym_count (abfd) - * sizeof (aout_symbol_type)); - cached = (aout_symbol_type *) bfd_malloc (cached_size); - if (cached == NULL && cached_size != 0) - return false; - if (cached_size != 0) - memset (cached, 0, cached_size); - - /* Convert from external symbol information to internal. */ - if (! (NAME(aout,translate_symbol_table) - (abfd, cached, - obj_aout_external_syms (abfd), - obj_aout_external_sym_count (abfd), - obj_aout_external_strings (abfd), - obj_aout_external_string_size (abfd), - false))) - { - free (cached); - return false; - } - - bfd_get_symcount (abfd) = obj_aout_external_sym_count (abfd); - - obj_aout_symbols (abfd) = cached; - - /* It is very likely that anybody who calls this function will not - want the external symbol information, so if it was allocated - because of our call to aout_get_external_symbols, we free it up - right away to save space. */ - if (old_external_syms == (struct external_nlist *) NULL - && obj_aout_external_syms (abfd) != (struct external_nlist *) NULL) - { -#ifdef USE_MMAP - bfd_free_window (&obj_aout_sym_window (abfd)); -#else - free (obj_aout_external_syms (abfd)); -#endif - obj_aout_external_syms (abfd) = NULL; - } - - return true; -} - -/* We use a hash table when writing out symbols so that we only write - out a particular string once. This helps particularly when the - linker writes out stabs debugging entries, because each different - contributing object file tends to have many duplicate stabs - strings. - - This hash table code breaks dbx on SunOS 4.1.3, so we don't do it - if BFD_TRADITIONAL_FORMAT is set. */ - -static bfd_size_type add_to_stringtab - PARAMS ((bfd *, struct bfd_strtab_hash *, const char *, boolean)); -static boolean emit_stringtab PARAMS ((bfd *, struct bfd_strtab_hash *)); - -/* Get the index of a string in a strtab, adding it if it is not - already present. */ - -static INLINE bfd_size_type -add_to_stringtab (abfd, tab, str, copy) - bfd *abfd; - struct bfd_strtab_hash *tab; - const char *str; - boolean copy; -{ - boolean hash; - bfd_size_type index; - - /* An index of 0 always means the empty string. */ - if (str == 0 || *str == '\0') - return 0; - - /* Don't hash if BFD_TRADITIONAL_FORMAT is set, because SunOS dbx - doesn't understand a hashed string table. */ - hash = true; - if ((abfd->flags & BFD_TRADITIONAL_FORMAT) != 0) - hash = false; - - index = _bfd_stringtab_add (tab, str, hash, copy); - - if (index != (bfd_size_type) -1) - { - /* Add BYTES_IN_WORD to the return value to account for the - space taken up by the string table size. */ - index += BYTES_IN_WORD; - } - - return index; -} - -/* Write out a strtab. ABFD is already at the right location in the - file. */ - -static boolean -emit_stringtab (abfd, tab) - register bfd *abfd; - struct bfd_strtab_hash *tab; -{ - bfd_byte buffer[BYTES_IN_WORD]; - - /* The string table starts with the size. */ - PUT_WORD (abfd, _bfd_stringtab_size (tab) + BYTES_IN_WORD, buffer); - if (bfd_write ((PTR) buffer, 1, BYTES_IN_WORD, abfd) != BYTES_IN_WORD) - return false; - - return _bfd_stringtab_emit (abfd, tab); -} - -boolean -NAME(aout,write_syms) (abfd) - bfd *abfd; -{ - unsigned int count ; - asymbol **generic = bfd_get_outsymbols (abfd); - struct bfd_strtab_hash *strtab; - - strtab = _bfd_stringtab_init (); - if (strtab == NULL) - return false; - - for (count = 0; count < bfd_get_symcount (abfd); count++) - { - asymbol *g = generic[count]; - bfd_size_type indx; - struct external_nlist nsp; - - indx = add_to_stringtab (abfd, strtab, g->name, false); - if (indx == (bfd_size_type) -1) - goto error_return; - PUT_WORD (abfd, indx, (bfd_byte *) nsp.e_strx); - - if (bfd_asymbol_flavour(g) == abfd->xvec->flavour) - { - bfd_h_put_16(abfd, aout_symbol(g)->desc, nsp.e_desc); - bfd_h_put_8(abfd, aout_symbol(g)->other, nsp.e_other); - bfd_h_put_8(abfd, aout_symbol(g)->type, nsp.e_type); - } - else - { - bfd_h_put_16(abfd,0, nsp.e_desc); - bfd_h_put_8(abfd, 0, nsp.e_other); - bfd_h_put_8(abfd, 0, nsp.e_type); - } - - if (! translate_to_native_sym_flags (abfd, g, &nsp)) - goto error_return; - - if (bfd_write((PTR)&nsp,1,EXTERNAL_NLIST_SIZE, abfd) - != EXTERNAL_NLIST_SIZE) - goto error_return; - - /* NB: `KEEPIT' currently overlays `udata.p', so set this only - here, at the end. */ - g->KEEPIT = count; - } - - if (! emit_stringtab (abfd, strtab)) - goto error_return; - - _bfd_stringtab_free (strtab); - - return true; - -error_return: - _bfd_stringtab_free (strtab); - return false; -} - - -long -NAME(aout,get_symtab) (abfd, location) - bfd *abfd; - asymbol **location; -{ - unsigned int counter = 0; - aout_symbol_type *symbase; - - if (!NAME(aout,slurp_symbol_table)(abfd)) - return -1; - - for (symbase = obj_aout_symbols(abfd); counter++ < bfd_get_symcount (abfd);) - *(location++) = (asymbol *)( symbase++); - *location++ =0; - return bfd_get_symcount (abfd); -} - - -/* Standard reloc stuff */ -/* Output standard relocation information to a file in target byte order. */ - -void -NAME(aout,swap_std_reloc_out) (abfd, g, natptr) - bfd *abfd; - arelent *g; - struct reloc_std_external *natptr; -{ - int r_index; - asymbol *sym = *(g->sym_ptr_ptr); - int r_extern; - unsigned int r_length; - int r_pcrel; - int r_baserel, r_jmptable, r_relative; - asection *output_section = sym->section->output_section; - - PUT_WORD(abfd, g->address, natptr->r_address); - - r_length = g->howto->size ; /* Size as a power of two */ - r_pcrel = (int) g->howto->pc_relative; /* Relative to PC? */ - /* XXX This relies on relocs coming from a.out files. */ - r_baserel = (g->howto->type & 8) != 0; - r_jmptable = (g->howto->type & 16) != 0; - r_relative = (g->howto->type & 32) != 0; - -#if 0 - /* For a standard reloc, the addend is in the object file. */ - r_addend = g->addend + (*(g->sym_ptr_ptr))->section->output_section->vma; -#endif - - /* name was clobbered by aout_write_syms to be symbol index */ - - /* If this relocation is relative to a symbol then set the - r_index to the symbols index, and the r_extern bit. - - Absolute symbols can come in in two ways, either as an offset - from the abs section, or as a symbol which has an abs value. - check for that here - */ - - - if (bfd_is_com_section (output_section) - || bfd_is_abs_section (output_section) - || bfd_is_und_section (output_section)) - { - if (bfd_abs_section_ptr->symbol == sym) - { - /* Whoops, looked like an abs symbol, but is really an offset - from the abs section */ - r_index = 0; - r_extern = 0; - } - else - { - /* Fill in symbol */ - r_extern = 1; - r_index = (*(g->sym_ptr_ptr))->KEEPIT; - - } - } - else - { - /* Just an ordinary section */ - r_extern = 0; - r_index = output_section->target_index; - } - - /* now the fun stuff */ - if (bfd_header_big_endian (abfd)) { - natptr->r_index[0] = r_index >> 16; - natptr->r_index[1] = r_index >> 8; - natptr->r_index[2] = r_index; - natptr->r_type[0] = - (r_extern? RELOC_STD_BITS_EXTERN_BIG: 0) - | (r_pcrel? RELOC_STD_BITS_PCREL_BIG: 0) - | (r_baserel? RELOC_STD_BITS_BASEREL_BIG: 0) - | (r_jmptable? RELOC_STD_BITS_JMPTABLE_BIG: 0) - | (r_relative? RELOC_STD_BITS_RELATIVE_BIG: 0) - | (r_length << RELOC_STD_BITS_LENGTH_SH_BIG); - } else { - natptr->r_index[2] = r_index >> 16; - natptr->r_index[1] = r_index >> 8; - natptr->r_index[0] = r_index; - natptr->r_type[0] = - (r_extern? RELOC_STD_BITS_EXTERN_LITTLE: 0) - | (r_pcrel? RELOC_STD_BITS_PCREL_LITTLE: 0) - | (r_baserel? RELOC_STD_BITS_BASEREL_LITTLE: 0) - | (r_jmptable? RELOC_STD_BITS_JMPTABLE_LITTLE: 0) - | (r_relative? RELOC_STD_BITS_RELATIVE_LITTLE: 0) - | (r_length << RELOC_STD_BITS_LENGTH_SH_LITTLE); - } -} - - -/* Extended stuff */ -/* Output extended relocation information to a file in target byte order. */ - -void -NAME(aout,swap_ext_reloc_out) (abfd, g, natptr) - bfd *abfd; - arelent *g; - register struct reloc_ext_external *natptr; -{ - int r_index; - int r_extern; - unsigned int r_type; - unsigned int r_addend; - asymbol *sym = *(g->sym_ptr_ptr); - asection *output_section = sym->section->output_section; - - PUT_WORD (abfd, g->address, natptr->r_address); - - r_type = (unsigned int) g->howto->type; - - r_addend = g->addend; - if ((sym->flags & BSF_SECTION_SYM) != 0) - r_addend += (*(g->sym_ptr_ptr))->section->output_section->vma; - - /* If this relocation is relative to a symbol then set the - r_index to the symbols index, and the r_extern bit. - - Absolute symbols can come in in two ways, either as an offset - from the abs section, or as a symbol which has an abs value. - check for that here. */ - - if (bfd_is_abs_section (bfd_get_section (sym))) - { - r_extern = 0; - r_index = 0; - } - else if ((sym->flags & BSF_SECTION_SYM) == 0) - { - if (bfd_is_und_section (bfd_get_section (sym)) - || (sym->flags & BSF_GLOBAL) != 0) - r_extern = 1; - else - r_extern = 0; - r_index = (*(g->sym_ptr_ptr))->KEEPIT; - } - else - { - /* Just an ordinary section */ - r_extern = 0; - r_index = output_section->target_index; - } - - /* now the fun stuff */ - if (bfd_header_big_endian (abfd)) { - natptr->r_index[0] = r_index >> 16; - natptr->r_index[1] = r_index >> 8; - natptr->r_index[2] = r_index; - natptr->r_type[0] = - ((r_extern? RELOC_EXT_BITS_EXTERN_BIG: 0) - | (r_type << RELOC_EXT_BITS_TYPE_SH_BIG)); - } else { - natptr->r_index[2] = r_index >> 16; - natptr->r_index[1] = r_index >> 8; - natptr->r_index[0] = r_index; - natptr->r_type[0] = - (r_extern? RELOC_EXT_BITS_EXTERN_LITTLE: 0) - | (r_type << RELOC_EXT_BITS_TYPE_SH_LITTLE); - } - - PUT_WORD (abfd, r_addend, natptr->r_addend); -} - -/* BFD deals internally with all things based from the section they're - in. so, something in 10 bytes into a text section with a base of - 50 would have a symbol (.text+10) and know .text vma was 50. - - Aout keeps all it's symbols based from zero, so the symbol would - contain 60. This macro subs the base of each section from the value - to give the true offset from the section */ - - -#define MOVE_ADDRESS(ad) \ - if (r_extern) { \ - /* undefined symbol */ \ - cache_ptr->sym_ptr_ptr = symbols + r_index; \ - cache_ptr->addend = ad; \ - } else { \ - /* defined, section relative. replace symbol with pointer to \ - symbol which points to section */ \ - switch (r_index) { \ - case N_TEXT: \ - case N_TEXT | N_EXT: \ - cache_ptr->sym_ptr_ptr = obj_textsec(abfd)->symbol_ptr_ptr; \ - cache_ptr->addend = ad - su->textsec->vma; \ - break; \ - case N_DATA: \ - case N_DATA | N_EXT: \ - cache_ptr->sym_ptr_ptr = obj_datasec(abfd)->symbol_ptr_ptr; \ - cache_ptr->addend = ad - su->datasec->vma; \ - break; \ - case N_BSS: \ - case N_BSS | N_EXT: \ - cache_ptr->sym_ptr_ptr = obj_bsssec(abfd)->symbol_ptr_ptr; \ - cache_ptr->addend = ad - su->bsssec->vma; \ - break; \ - default: \ - case N_ABS: \ - case N_ABS | N_EXT: \ - cache_ptr->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; \ - cache_ptr->addend = ad; \ - break; \ - } \ - } \ - -void -NAME(aout,swap_ext_reloc_in) (abfd, bytes, cache_ptr, symbols, symcount) - bfd *abfd; - struct reloc_ext_external *bytes; - arelent *cache_ptr; - asymbol **symbols; - bfd_size_type symcount; -{ - unsigned int r_index; - int r_extern; - unsigned int r_type; - struct aoutdata *su = &(abfd->tdata.aout_data->a); - - cache_ptr->address = (GET_SWORD (abfd, bytes->r_address)); - - /* now the fun stuff */ - if (bfd_header_big_endian (abfd)) { - r_index = (bytes->r_index[0] << 16) - | (bytes->r_index[1] << 8) - | bytes->r_index[2]; - r_extern = (0 != (bytes->r_type[0] & RELOC_EXT_BITS_EXTERN_BIG)); - r_type = (bytes->r_type[0] & RELOC_EXT_BITS_TYPE_BIG) - >> RELOC_EXT_BITS_TYPE_SH_BIG; - } else { - r_index = (bytes->r_index[2] << 16) - | (bytes->r_index[1] << 8) - | bytes->r_index[0]; - r_extern = (0 != (bytes->r_type[0] & RELOC_EXT_BITS_EXTERN_LITTLE)); - r_type = (bytes->r_type[0] & RELOC_EXT_BITS_TYPE_LITTLE) - >> RELOC_EXT_BITS_TYPE_SH_LITTLE; - } - - cache_ptr->howto = howto_table_ext + r_type; - - /* Base relative relocs are always against the symbol table, - regardless of the setting of r_extern. r_extern just reflects - whether the symbol the reloc is against is local or global. */ - if (r_type == RELOC_BASE10 - || r_type == RELOC_BASE13 - || r_type == RELOC_BASE22) - r_extern = 1; - - if (r_extern && r_index > symcount) - { - /* We could arrange to return an error, but it might be useful - to see the file even if it is bad. */ - r_extern = 0; - r_index = N_ABS; - } - - MOVE_ADDRESS(GET_SWORD(abfd, bytes->r_addend)); -} - -void -NAME(aout,swap_std_reloc_in) (abfd, bytes, cache_ptr, symbols, symcount) - bfd *abfd; - struct reloc_std_external *bytes; - arelent *cache_ptr; - asymbol **symbols; - bfd_size_type symcount; -{ - unsigned int r_index; - int r_extern; - unsigned int r_length; - int r_pcrel; - int r_baserel, r_jmptable, r_relative; - struct aoutdata *su = &(abfd->tdata.aout_data->a); - unsigned int howto_idx; - - cache_ptr->address = bfd_h_get_32 (abfd, bytes->r_address); - - /* now the fun stuff */ - if (bfd_header_big_endian (abfd)) { - r_index = (bytes->r_index[0] << 16) - | (bytes->r_index[1] << 8) - | bytes->r_index[2]; - r_extern = (0 != (bytes->r_type[0] & RELOC_STD_BITS_EXTERN_BIG)); - r_pcrel = (0 != (bytes->r_type[0] & RELOC_STD_BITS_PCREL_BIG)); - r_baserel = (0 != (bytes->r_type[0] & RELOC_STD_BITS_BASEREL_BIG)); - r_jmptable= (0 != (bytes->r_type[0] & RELOC_STD_BITS_JMPTABLE_BIG)); - r_relative= (0 != (bytes->r_type[0] & RELOC_STD_BITS_RELATIVE_BIG)); - r_length = (bytes->r_type[0] & RELOC_STD_BITS_LENGTH_BIG) - >> RELOC_STD_BITS_LENGTH_SH_BIG; - } else { - r_index = (bytes->r_index[2] << 16) - | (bytes->r_index[1] << 8) - | bytes->r_index[0]; - r_extern = (0 != (bytes->r_type[0] & RELOC_STD_BITS_EXTERN_LITTLE)); - r_pcrel = (0 != (bytes->r_type[0] & RELOC_STD_BITS_PCREL_LITTLE)); - r_baserel = (0 != (bytes->r_type[0] & RELOC_STD_BITS_BASEREL_LITTLE)); - r_jmptable= (0 != (bytes->r_type[0] & RELOC_STD_BITS_JMPTABLE_LITTLE)); - r_relative= (0 != (bytes->r_type[0] & RELOC_STD_BITS_RELATIVE_LITTLE)); - r_length = (bytes->r_type[0] & RELOC_STD_BITS_LENGTH_LITTLE) - >> RELOC_STD_BITS_LENGTH_SH_LITTLE; - } - - howto_idx = r_length + 4 * r_pcrel + 8 * r_baserel - + 16 * r_jmptable + 32 * r_relative; - BFD_ASSERT (howto_idx < TABLE_SIZE (howto_table_std)); - cache_ptr->howto = howto_table_std + howto_idx; - BFD_ASSERT (cache_ptr->howto->type != (unsigned int) -1); - - /* Base relative relocs are always against the symbol table, - regardless of the setting of r_extern. r_extern just reflects - whether the symbol the reloc is against is local or global. */ - if (r_baserel) - r_extern = 1; - - if (r_extern && r_index > symcount) - { - /* We could arrange to return an error, but it might be useful - to see the file even if it is bad. */ - r_extern = 0; - r_index = N_ABS; - } - - MOVE_ADDRESS(0); -} - -/* Read and swap the relocs for a section. */ - -boolean -NAME(aout,slurp_reloc_table) (abfd, asect, symbols) - bfd *abfd; - sec_ptr asect; - asymbol **symbols; -{ - unsigned int count; - bfd_size_type reloc_size; - PTR relocs; - arelent *reloc_cache; - size_t each_size; - unsigned int counter = 0; - arelent *cache_ptr; - - if (asect->relocation) - return true; - - if (asect->flags & SEC_CONSTRUCTOR) - return true; - - if (asect == obj_datasec (abfd)) - reloc_size = exec_hdr(abfd)->a_drsize; - else if (asect == obj_textsec (abfd)) - reloc_size = exec_hdr(abfd)->a_trsize; - else if (asect == obj_bsssec (abfd)) - reloc_size = 0; - else - { - bfd_set_error (bfd_error_invalid_operation); - return false; - } - - if (bfd_seek (abfd, asect->rel_filepos, SEEK_SET) != 0) - return false; - - each_size = obj_reloc_entry_size (abfd); - - count = reloc_size / each_size; - - reloc_cache = (arelent *) bfd_malloc ((size_t) (count * sizeof (arelent))); - if (reloc_cache == NULL && count != 0) - return false; - memset (reloc_cache, 0, count * sizeof (arelent)); - - relocs = bfd_malloc ((size_t) reloc_size); - if (relocs == NULL && reloc_size != 0) - { - free (reloc_cache); - return false; - } - - if (bfd_read (relocs, 1, reloc_size, abfd) != reloc_size) - { - free (relocs); - free (reloc_cache); - return false; - } - - cache_ptr = reloc_cache; - if (each_size == RELOC_EXT_SIZE) - { - register struct reloc_ext_external *rptr = - (struct reloc_ext_external *) relocs; - - for (; counter < count; counter++, rptr++, cache_ptr++) - NAME(aout,swap_ext_reloc_in) (abfd, rptr, cache_ptr, symbols, - bfd_get_symcount (abfd)); - } - else - { - register struct reloc_std_external *rptr = - (struct reloc_std_external *) relocs; - - for (; counter < count; counter++, rptr++, cache_ptr++) - MY_swap_std_reloc_in (abfd, rptr, cache_ptr, symbols, - bfd_get_symcount (abfd)); - } - - free (relocs); - - asect->relocation = reloc_cache; - asect->reloc_count = cache_ptr - reloc_cache; - - return true; -} - -/* Write out a relocation section into an object file. */ - -boolean -NAME(aout,squirt_out_relocs) (abfd, section) - bfd *abfd; - asection *section; -{ - arelent **generic; - unsigned char *native, *natptr; - size_t each_size; - - unsigned int count = section->reloc_count; - size_t natsize; - - if (count == 0) return true; - - each_size = obj_reloc_entry_size (abfd); - natsize = each_size * count; - native = (unsigned char *) bfd_zalloc (abfd, natsize); - if (!native) - return false; - - generic = section->orelocation; - - if (each_size == RELOC_EXT_SIZE) - { - for (natptr = native; - count != 0; - --count, natptr += each_size, ++generic) - NAME(aout,swap_ext_reloc_out) (abfd, *generic, (struct reloc_ext_external *)natptr); - } - else - { - for (natptr = native; - count != 0; - --count, natptr += each_size, ++generic) - MY_swap_std_reloc_out(abfd, *generic, (struct reloc_std_external *)natptr); - } - - if ( bfd_write ((PTR) native, 1, natsize, abfd) != natsize) { - bfd_release(abfd, native); - return false; - } - bfd_release (abfd, native); - - return true; -} - -/* This is stupid. This function should be a boolean predicate */ -long -NAME(aout,canonicalize_reloc) (abfd, section, relptr, symbols) - bfd *abfd; - sec_ptr section; - arelent **relptr; - asymbol **symbols; -{ - arelent *tblptr = section->relocation; - unsigned int count; - - if (section == obj_bsssec (abfd)) - { - *relptr = NULL; - return 0; - } - - if (!(tblptr || NAME(aout,slurp_reloc_table)(abfd, section, symbols))) - return -1; - - if (section->flags & SEC_CONSTRUCTOR) { - arelent_chain *chain = section->constructor_chain; - for (count = 0; count < section->reloc_count; count ++) { - *relptr ++ = &chain->relent; - chain = chain->next; - } - } - else { - tblptr = section->relocation; - - for (count = 0; count++ < section->reloc_count;) - { - *relptr++ = tblptr++; - } - } - *relptr = 0; - - return section->reloc_count; -} - -long -NAME(aout,get_reloc_upper_bound) (abfd, asect) - bfd *abfd; - sec_ptr asect; -{ - if (bfd_get_format (abfd) != bfd_object) { - bfd_set_error (bfd_error_invalid_operation); - return -1; - } - if (asect->flags & SEC_CONSTRUCTOR) { - return (sizeof (arelent *) * (asect->reloc_count+1)); - } - - if (asect == obj_datasec (abfd)) - return (sizeof (arelent *) - * ((exec_hdr(abfd)->a_drsize / obj_reloc_entry_size (abfd)) - + 1)); - - if (asect == obj_textsec (abfd)) - return (sizeof (arelent *) - * ((exec_hdr(abfd)->a_trsize / obj_reloc_entry_size (abfd)) - + 1)); - - if (asect == obj_bsssec (abfd)) - return sizeof (arelent *); - - if (asect == obj_bsssec (abfd)) - return 0; - - bfd_set_error (bfd_error_invalid_operation); - return -1; -} - - -long -NAME(aout,get_symtab_upper_bound) (abfd) - bfd *abfd; -{ - if (!NAME(aout,slurp_symbol_table)(abfd)) - return -1; - - return (bfd_get_symcount (abfd)+1) * (sizeof (aout_symbol_type *)); -} - -/*ARGSUSED*/ - alent * -NAME(aout,get_lineno) (ignore_abfd, ignore_symbol) - bfd *ignore_abfd; - asymbol *ignore_symbol; -{ -return (alent *)NULL; -} - -/*ARGSUSED*/ -void -NAME(aout,get_symbol_info) (ignore_abfd, symbol, ret) - bfd *ignore_abfd; - asymbol *symbol; - symbol_info *ret; -{ - bfd_symbol_info (symbol, ret); - - if (ret->type == '?') - { - int type_code = aout_symbol(symbol)->type & 0xff; - const char *stab_name = bfd_get_stab_name (type_code); - static char buf[10]; - - if (stab_name == NULL) - { - sprintf(buf, "(%d)", type_code); - stab_name = buf; - } - ret->type = '-'; - ret->stab_type = type_code; - ret->stab_other = (unsigned)(aout_symbol(symbol)->other & 0xff); - ret->stab_desc = (unsigned)(aout_symbol(symbol)->desc & 0xffff); - ret->stab_name = stab_name; - } -} - -/*ARGSUSED*/ -void -NAME(aout,print_symbol) (ignore_abfd, afile, symbol, how) - bfd *ignore_abfd; - PTR afile; - asymbol *symbol; - bfd_print_symbol_type how; -{ - FILE *file = (FILE *)afile; - - switch (how) { - case bfd_print_symbol_name: - if (symbol->name) - fprintf(file,"%s", symbol->name); - break; - case bfd_print_symbol_more: - fprintf(file,"%4x %2x %2x",(unsigned)(aout_symbol(symbol)->desc & 0xffff), - (unsigned)(aout_symbol(symbol)->other & 0xff), - (unsigned)(aout_symbol(symbol)->type)); - break; - case bfd_print_symbol_all: - { - CONST char *section_name = symbol->section->name; - - - bfd_print_symbol_vandf((PTR)file,symbol); - - fprintf(file," %-5s %04x %02x %02x", - section_name, - (unsigned)(aout_symbol(symbol)->desc & 0xffff), - (unsigned)(aout_symbol(symbol)->other & 0xff), - (unsigned)(aout_symbol(symbol)->type & 0xff)); - if (symbol->name) - fprintf(file," %s", symbol->name); - } - break; - } -} - -/* If we don't have to allocate more than 1MB to hold the generic - symbols, we use the generic minisymbol methord: it's faster, since - it only translates the symbols once, not multiple times. */ -#define MINISYM_THRESHOLD (1000000 / sizeof (asymbol)) - -/* Read minisymbols. For minisymbols, we use the unmodified a.out - symbols. The minisymbol_to_symbol function translates these into - BFD asymbol structures. */ - -long -NAME(aout,read_minisymbols) (abfd, dynamic, minisymsp, sizep) - bfd *abfd; - boolean dynamic; - PTR *minisymsp; - unsigned int *sizep; -{ - if (dynamic) - { - /* We could handle the dynamic symbols here as well, but it's - easier to hand them off. */ - return _bfd_generic_read_minisymbols (abfd, dynamic, minisymsp, sizep); - } - - if (! aout_get_external_symbols (abfd)) - return -1; - - if (obj_aout_external_sym_count (abfd) < MINISYM_THRESHOLD) - return _bfd_generic_read_minisymbols (abfd, dynamic, minisymsp, sizep); - - *minisymsp = (PTR) obj_aout_external_syms (abfd); - - /* By passing the external symbols back from this routine, we are - giving up control over the memory block. Clear - obj_aout_external_syms, so that we do not try to free it - ourselves. */ - obj_aout_external_syms (abfd) = NULL; - - *sizep = EXTERNAL_NLIST_SIZE; - return obj_aout_external_sym_count (abfd); -} - -/* Convert a minisymbol to a BFD asymbol. A minisymbol is just an - unmodified a.out symbol. The SYM argument is a structure returned - by bfd_make_empty_symbol, which we fill in here. */ - -asymbol * -NAME(aout,minisymbol_to_symbol) (abfd, dynamic, minisym, sym) - bfd *abfd; - boolean dynamic; - const PTR minisym; - asymbol *sym; -{ - if (dynamic - || obj_aout_external_sym_count (abfd) < MINISYM_THRESHOLD) - return _bfd_generic_minisymbol_to_symbol (abfd, dynamic, minisym, sym); - - memset (sym, 0, sizeof (aout_symbol_type)); - - /* We call translate_symbol_table to translate a single symbol. */ - if (! (NAME(aout,translate_symbol_table) - (abfd, - (aout_symbol_type *) sym, - (struct external_nlist *) minisym, - (bfd_size_type) 1, - obj_aout_external_strings (abfd), - obj_aout_external_string_size (abfd), - false))) - return NULL; - - return sym; -} - -/* - provided a BFD, a section and an offset into the section, calculate - and return the name of the source file and the line nearest to the - wanted location. -*/ - -boolean -NAME(aout,find_nearest_line) - (abfd, section, symbols, offset, filename_ptr, functionname_ptr, line_ptr) - bfd *abfd; - asection *section; - asymbol **symbols; - bfd_vma offset; - CONST char **filename_ptr; - CONST char **functionname_ptr; - unsigned int *line_ptr; -{ - /* Run down the file looking for the filename, function and linenumber */ - asymbol **p; - CONST char *directory_name = NULL; - CONST char *main_file_name = NULL; - CONST char *current_file_name = NULL; - CONST char *line_file_name = NULL; /* Value of current_file_name at line number. */ - bfd_vma low_line_vma = 0; - bfd_vma low_func_vma = 0; - asymbol *func = 0; - size_t filelen, funclen; - char *buf; - - *filename_ptr = abfd->filename; - *functionname_ptr = 0; - *line_ptr = 0; - if (symbols != (asymbol **)NULL) { - for (p = symbols; *p; p++) { - aout_symbol_type *q = (aout_symbol_type *)(*p); - next: - switch (q->type){ - case N_SO: - main_file_name = current_file_name = q->symbol.name; - /* Look ahead to next symbol to check if that too is an N_SO. */ - p++; - if (*p == NULL) - break; - q = (aout_symbol_type *)(*p); - if (q->type != (int)N_SO) - goto next; - - /* Found a second N_SO First is directory; second is filename. */ - directory_name = current_file_name; - main_file_name = current_file_name = q->symbol.name; - if (obj_textsec(abfd) != section) - goto done; - break; - case N_SOL: - current_file_name = q->symbol.name; - break; - - case N_SLINE: - - case N_DSLINE: - case N_BSLINE: - /* We'll keep this if it resolves nearer than the one we have - already. */ - if (q->symbol.value >= low_line_vma - && q->symbol.value <= offset) - { - *line_ptr = q->desc; - low_line_vma = q->symbol.value; - line_file_name = current_file_name; - } - break; - case N_FUN: - { - /* We'll keep this if it is nearer than the one we have already */ - if (q->symbol.value >= low_func_vma && - q->symbol.value <= offset) { - low_func_vma = q->symbol.value; - func = (asymbol *)q; - } - else if (q->symbol.value > offset) - goto done; - } - break; - } - } - } - - done: - if (*line_ptr != 0) - main_file_name = line_file_name; - - if (main_file_name == NULL - || main_file_name[0] == '/' - || directory_name == NULL) - filelen = 0; - else - filelen = strlen (directory_name) + strlen (main_file_name); - if (func == NULL) - funclen = 0; - else - funclen = strlen (bfd_asymbol_name (func)); - - if (adata (abfd).line_buf != NULL) - free (adata (abfd).line_buf); - if (filelen + funclen == 0) - adata (abfd).line_buf = buf = NULL; - else - { - buf = (char *) bfd_malloc (filelen + funclen + 2); - adata (abfd).line_buf = buf; - if (buf == NULL) - return false; - } - - if (main_file_name != NULL) - { - if (main_file_name[0] == '/' || directory_name == NULL) - *filename_ptr = main_file_name; - else - { - sprintf (buf, "%s%s", directory_name, main_file_name); - *filename_ptr = buf; - buf += filelen + 1; - } - } - - if (func) - { - const char *function = func->name; - char *p; - - /* The caller expects a symbol name. We actually have a - function name, without the leading underscore. Put the - underscore back in, so that the caller gets a symbol name. */ - if (bfd_get_symbol_leading_char (abfd) == '\0') - strcpy (buf, function); - else - { - buf[0] = bfd_get_symbol_leading_char (abfd); - strcpy (buf + 1, function); - } - /* Have to remove : stuff */ - p = strchr (buf, ':'); - if (p != NULL) - *p = '\0'; - *functionname_ptr = buf; - } - - return true; -} - -/*ARGSUSED*/ -int -NAME(aout,sizeof_headers) (abfd, execable) - bfd *abfd; - boolean execable; -{ - return adata(abfd).exec_bytes_size; -} - -/* Free all information we have cached for this BFD. We can always - read it again later if we need it. */ - -boolean -NAME(aout,bfd_free_cached_info) (abfd) - bfd *abfd; -{ - asection *o; - - if (bfd_get_format (abfd) != bfd_object) - return true; - -#define BFCI_FREE(x) if (x != NULL) { free (x); x = NULL; } - BFCI_FREE (obj_aout_symbols (abfd)); -#ifdef USE_MMAP - obj_aout_external_syms (abfd) = 0; - bfd_free_window (&obj_aout_sym_window (abfd)); - bfd_free_window (&obj_aout_string_window (abfd)); - obj_aout_external_strings (abfd) = 0; -#else - BFCI_FREE (obj_aout_external_syms (abfd)); - BFCI_FREE (obj_aout_external_strings (abfd)); -#endif - for (o = abfd->sections; o != (asection *) NULL; o = o->next) - BFCI_FREE (o->relocation); -#undef BFCI_FREE - - return true; -} - -/* a.out link code. */ - -static boolean aout_link_add_object_symbols - PARAMS ((bfd *, struct bfd_link_info *)); -static boolean aout_link_check_archive_element - PARAMS ((bfd *, struct bfd_link_info *, boolean *)); -static boolean aout_link_free_symbols PARAMS ((bfd *)); -static boolean aout_link_check_ar_symbols - PARAMS ((bfd *, struct bfd_link_info *, boolean *pneeded)); -static boolean aout_link_add_symbols - PARAMS ((bfd *, struct bfd_link_info *)); - -/* Routine to create an entry in an a.out link hash table. */ - -struct bfd_hash_entry * -NAME(aout,link_hash_newfunc) (entry, table, string) - struct bfd_hash_entry *entry; - struct bfd_hash_table *table; - const char *string; -{ - struct aout_link_hash_entry *ret = (struct aout_link_hash_entry *) entry; - - /* Allocate the structure if it has not already been allocated by a - subclass. */ - if (ret == (struct aout_link_hash_entry *) NULL) - ret = ((struct aout_link_hash_entry *) - bfd_hash_allocate (table, sizeof (struct aout_link_hash_entry))); - if (ret == (struct aout_link_hash_entry *) NULL) - return (struct bfd_hash_entry *) ret; - - /* Call the allocation method of the superclass. */ - ret = ((struct aout_link_hash_entry *) - _bfd_link_hash_newfunc ((struct bfd_hash_entry *) ret, - table, string)); - if (ret) - { - /* Set local fields. */ - ret->written = false; - ret->indx = -1; - } - - return (struct bfd_hash_entry *) ret; -} - -/* Initialize an a.out link hash table. */ - -boolean -NAME(aout,link_hash_table_init) (table, abfd, newfunc) - struct aout_link_hash_table *table; - bfd *abfd; - struct bfd_hash_entry *(*newfunc) PARAMS ((struct bfd_hash_entry *, - struct bfd_hash_table *, - const char *)); -{ - return _bfd_link_hash_table_init (&table->root, abfd, newfunc); -} - -/* Create an a.out link hash table. */ - -struct bfd_link_hash_table * -NAME(aout,link_hash_table_create) (abfd) - bfd *abfd; -{ - struct aout_link_hash_table *ret; - - ret = ((struct aout_link_hash_table *) - bfd_alloc (abfd, sizeof (struct aout_link_hash_table))); - if (ret == NULL) - return (struct bfd_link_hash_table *) NULL; - if (! NAME(aout,link_hash_table_init) (ret, abfd, - NAME(aout,link_hash_newfunc))) - { - free (ret); - return (struct bfd_link_hash_table *) NULL; - } - return &ret->root; -} - -/* Given an a.out BFD, add symbols to the global hash table as - appropriate. */ - -boolean -NAME(aout,link_add_symbols) (abfd, info) - bfd *abfd; - struct bfd_link_info *info; -{ - switch (bfd_get_format (abfd)) - { - case bfd_object: - return aout_link_add_object_symbols (abfd, info); - case bfd_archive: - return _bfd_generic_link_add_archive_symbols - (abfd, info, aout_link_check_archive_element); - default: - bfd_set_error (bfd_error_wrong_format); - return false; - } -} - -/* Add symbols from an a.out object file. */ - -static boolean -aout_link_add_object_symbols (abfd, info) - bfd *abfd; - struct bfd_link_info *info; -{ - if (! aout_get_external_symbols (abfd)) - return false; - if (! aout_link_add_symbols (abfd, info)) - return false; - if (! info->keep_memory) - { - if (! aout_link_free_symbols (abfd)) - return false; - } - return true; -} - -/* Check a single archive element to see if we need to include it in - the link. *PNEEDED is set according to whether this element is - needed in the link or not. This is called from - _bfd_generic_link_add_archive_symbols. */ - -static boolean -aout_link_check_archive_element (abfd, info, pneeded) - bfd *abfd; - struct bfd_link_info *info; - boolean *pneeded; -{ - if (! aout_get_external_symbols (abfd)) - return false; - - if (! aout_link_check_ar_symbols (abfd, info, pneeded)) - return false; - - if (*pneeded) - { - if (! aout_link_add_symbols (abfd, info)) - return false; - } - - if (! info->keep_memory || ! *pneeded) - { - if (! aout_link_free_symbols (abfd)) - return false; - } - - return true; -} - -/* Free up the internal symbols read from an a.out file. */ - -static boolean -aout_link_free_symbols (abfd) - bfd *abfd; -{ - if (obj_aout_external_syms (abfd) != (struct external_nlist *) NULL) - { -#ifdef USE_MMAP - bfd_free_window (&obj_aout_sym_window (abfd)); -#else - free ((PTR) obj_aout_external_syms (abfd)); -#endif - obj_aout_external_syms (abfd) = (struct external_nlist *) NULL; - } - if (obj_aout_external_strings (abfd) != (char *) NULL) - { -#ifdef USE_MMAP - bfd_free_window (&obj_aout_string_window (abfd)); -#else - free ((PTR) obj_aout_external_strings (abfd)); -#endif - obj_aout_external_strings (abfd) = (char *) NULL; - } - return true; -} - -/* Look through the internal symbols to see if this object file should - be included in the link. We should include this object file if it - defines any symbols which are currently undefined. If this object - file defines a common symbol, then we may adjust the size of the - known symbol but we do not include the object file in the link - (unless there is some other reason to include it). */ - -static boolean -aout_link_check_ar_symbols (abfd, info, pneeded) - bfd *abfd; - struct bfd_link_info *info; - boolean *pneeded; -{ - register struct external_nlist *p; - struct external_nlist *pend; - char *strings; - - *pneeded = false; - - /* Look through all the symbols. */ - p = obj_aout_external_syms (abfd); - pend = p + obj_aout_external_sym_count (abfd); - strings = obj_aout_external_strings (abfd); - for (; p < pend; p++) - { - int type = bfd_h_get_8 (abfd, p->e_type); - const char *name; - struct bfd_link_hash_entry *h; - - /* Ignore symbols that are not externally visible. This is an - optimization only, as we check the type more thoroughly - below. */ - if (((type & N_EXT) == 0 - || (type & N_STAB) != 0 - || type == N_FN) - && type != N_WEAKA - && type != N_WEAKT - && type != N_WEAKD - && type != N_WEAKB) - { - if (type == N_WARNING - || type == N_INDR) - ++p; - continue; - } - - name = strings + GET_WORD (abfd, p->e_strx); - h = bfd_link_hash_lookup (info->hash, name, false, false, true); - - /* We are only interested in symbols that are currently - undefined or common. */ - if (h == (struct bfd_link_hash_entry *) NULL - || (h->type != bfd_link_hash_undefined - && h->type != bfd_link_hash_common)) - { - if (type == (N_INDR | N_EXT)) - ++p; - continue; - } - - if (type == (N_TEXT | N_EXT) - || type == (N_DATA | N_EXT) - || type == (N_BSS | N_EXT) - || type == (N_ABS | N_EXT) - || type == (N_INDR | N_EXT)) - { - /* This object file defines this symbol. We must link it - in. This is true regardless of whether the current - definition of the symbol is undefined or common. If the - current definition is common, we have a case in which we - have already seen an object file including - int a; - and this object file from the archive includes - int a = 5; - In such a case we must include this object file. - - FIXME: The SunOS 4.1.3 linker will pull in the archive - element if the symbol is defined in the .data section, - but not if it is defined in the .text section. That - seems a bit crazy to me, and I haven't implemented it. - However, it might be correct. */ - if (! (*info->callbacks->add_archive_element) (info, abfd, name)) - return false; - *pneeded = true; - return true; - } - - if (type == (N_UNDF | N_EXT)) - { - bfd_vma value; - - value = GET_WORD (abfd, p->e_value); - if (value != 0) - { - /* This symbol is common in the object from the archive - file. */ - if (h->type == bfd_link_hash_undefined) - { - bfd *symbfd; - unsigned int power; - - symbfd = h->u.undef.abfd; - if (symbfd == (bfd *) NULL) - { - /* This symbol was created as undefined from - outside BFD. We assume that we should link - in the object file. This is done for the -u - option in the linker. */ - if (! (*info->callbacks->add_archive_element) (info, - abfd, - name)) - return false; - *pneeded = true; - return true; - } - /* Turn the current link symbol into a common - symbol. It is already on the undefs list. */ - h->type = bfd_link_hash_common; - h->u.c.p = ((struct bfd_link_hash_common_entry *) - bfd_hash_allocate (&info->hash->table, - sizeof (struct bfd_link_hash_common_entry))); - if (h->u.c.p == NULL) - return false; - - h->u.c.size = value; - - /* FIXME: This isn't quite right. The maximum - alignment of a common symbol should be set by the - architecture of the output file, not of the input - file. */ - power = bfd_log2 (value); - if (power > bfd_get_arch_info (abfd)->section_align_power) - power = bfd_get_arch_info (abfd)->section_align_power; - h->u.c.p->alignment_power = power; - - h->u.c.p->section = bfd_make_section_old_way (symbfd, - "COMMON"); - } - else - { - /* Adjust the size of the common symbol if - necessary. */ - if (value > h->u.c.size) - h->u.c.size = value; - } - } - } - - if (type == N_WEAKA - || type == N_WEAKT - || type == N_WEAKD - || type == N_WEAKB) - { - /* This symbol is weak but defined. We must pull it in if - the current link symbol is undefined, but we don't want - it if the current link symbol is common. */ - if (h->type == bfd_link_hash_undefined) - { - if (! (*info->callbacks->add_archive_element) (info, abfd, name)) - return false; - *pneeded = true; - return true; - } - } - } - - /* We do not need this object file. */ - return true; -} - -/* Add all symbols from an object file to the hash table. */ - -static boolean -aout_link_add_symbols (abfd, info) - bfd *abfd; - struct bfd_link_info *info; -{ - boolean (*add_one_symbol) PARAMS ((struct bfd_link_info *, bfd *, - const char *, flagword, asection *, - bfd_vma, const char *, boolean, - boolean, - struct bfd_link_hash_entry **)); - struct external_nlist *syms; - bfd_size_type sym_count; - char *strings; - boolean copy; - struct aout_link_hash_entry **sym_hash; - register struct external_nlist *p; - struct external_nlist *pend; - - syms = obj_aout_external_syms (abfd); - sym_count = obj_aout_external_sym_count (abfd); - strings = obj_aout_external_strings (abfd); - if (info->keep_memory) - copy = false; - else - copy = true; - - if ((abfd->flags & DYNAMIC) != 0 - && aout_backend_info (abfd)->add_dynamic_symbols != NULL) - { - if (! ((*aout_backend_info (abfd)->add_dynamic_symbols) - (abfd, info, &syms, &sym_count, &strings))) - return false; - } - - /* We keep a list of the linker hash table entries that correspond - to particular symbols. We could just look them up in the hash - table, but keeping the list is more efficient. Perhaps this - should be conditional on info->keep_memory. */ - sym_hash = ((struct aout_link_hash_entry **) - bfd_alloc (abfd, - ((size_t) sym_count - * sizeof (struct aout_link_hash_entry *)))); - if (sym_hash == NULL && sym_count != 0) - return false; - obj_aout_sym_hashes (abfd) = sym_hash; - - add_one_symbol = aout_backend_info (abfd)->add_one_symbol; - if (add_one_symbol == NULL) - add_one_symbol = _bfd_generic_link_add_one_symbol; - - p = syms; - pend = p + sym_count; - for (; p < pend; p++, sym_hash++) - { - int type; - const char *name; - bfd_vma value; - asection *section; - flagword flags; - const char *string; - - *sym_hash = NULL; - - type = bfd_h_get_8 (abfd, p->e_type); - - /* Ignore debugging symbols. */ - if ((type & N_STAB) != 0) - continue; - - name = strings + GET_WORD (abfd, p->e_strx); - value = GET_WORD (abfd, p->e_value); - flags = BSF_GLOBAL; - string = NULL; - switch (type) - { - default: - abort (); - - case N_UNDF: - case N_ABS: - case N_TEXT: - case N_DATA: - case N_BSS: - case N_FN_SEQ: - case N_COMM: - case N_SETV: - case N_FN: - /* Ignore symbols that are not externally visible. */ - continue; - case N_INDR: - /* Ignore local indirect symbol. */ - ++p; - ++sym_hash; - continue; - - case N_UNDF | N_EXT: - if (value == 0) - { - section = bfd_und_section_ptr; - flags = 0; - } - else - section = bfd_com_section_ptr; - break; - case N_ABS | N_EXT: - section = bfd_abs_section_ptr; - break; - case N_TEXT | N_EXT: - section = obj_textsec (abfd); - value -= bfd_get_section_vma (abfd, section); - break; - case N_DATA | N_EXT: - case N_SETV | N_EXT: - /* Treat N_SETV symbols as N_DATA symbol; see comment in - translate_from_native_sym_flags. */ - section = obj_datasec (abfd); - value -= bfd_get_section_vma (abfd, section); - break; - case N_BSS | N_EXT: - section = obj_bsssec (abfd); - value -= bfd_get_section_vma (abfd, section); - break; - case N_INDR | N_EXT: - /* An indirect symbol. The next symbol is the symbol - which this one really is. */ - BFD_ASSERT (p + 1 < pend); - ++p; - string = strings + GET_WORD (abfd, p->e_strx); - section = bfd_ind_section_ptr; - flags |= BSF_INDIRECT; - break; - case N_COMM | N_EXT: - section = bfd_com_section_ptr; - break; - case N_SETA: case N_SETA | N_EXT: - section = bfd_abs_section_ptr; - flags |= BSF_CONSTRUCTOR; - break; - case N_SETT: case N_SETT | N_EXT: - section = obj_textsec (abfd); - flags |= BSF_CONSTRUCTOR; - value -= bfd_get_section_vma (abfd, section); - break; - case N_SETD: case N_SETD | N_EXT: - section = obj_datasec (abfd); - flags |= BSF_CONSTRUCTOR; - value -= bfd_get_section_vma (abfd, section); - break; - case N_SETB: case N_SETB | N_EXT: - section = obj_bsssec (abfd); - flags |= BSF_CONSTRUCTOR; - value -= bfd_get_section_vma (abfd, section); - break; - case N_WARNING: - /* A warning symbol. The next symbol is the one to warn - about. */ - BFD_ASSERT (p + 1 < pend); - ++p; - string = name; - name = strings + GET_WORD (abfd, p->e_strx); - section = bfd_und_section_ptr; - flags |= BSF_WARNING; - break; - case N_WEAKU: - section = bfd_und_section_ptr; - flags = BSF_WEAK; - break; - case N_WEAKA: - section = bfd_abs_section_ptr; - flags = BSF_WEAK; - break; - case N_WEAKT: - section = obj_textsec (abfd); - value -= bfd_get_section_vma (abfd, section); - flags = BSF_WEAK; - break; - case N_WEAKD: - section = obj_datasec (abfd); - value -= bfd_get_section_vma (abfd, section); - flags = BSF_WEAK; - break; - case N_WEAKB: - section = obj_bsssec (abfd); - value -= bfd_get_section_vma (abfd, section); - flags = BSF_WEAK; - break; - } - - if (! ((*add_one_symbol) - (info, abfd, name, flags, section, value, string, copy, false, - (struct bfd_link_hash_entry **) sym_hash))) - return false; - - /* Restrict the maximum alignment of a common symbol based on - the architecture, since a.out has no way to represent - alignment requirements of a section in a .o file. FIXME: - This isn't quite right: it should use the architecture of the - output file, not the input files. */ - if ((*sym_hash)->root.type == bfd_link_hash_common - && ((*sym_hash)->root.u.c.p->alignment_power > - bfd_get_arch_info (abfd)->section_align_power)) - (*sym_hash)->root.u.c.p->alignment_power = - bfd_get_arch_info (abfd)->section_align_power; - - /* If this is a set symbol, and we are not building sets, then - it is possible for the hash entry to not have been set. In - such a case, treat the symbol as not globally defined. */ - if ((*sym_hash)->root.type == bfd_link_hash_new) - { - BFD_ASSERT ((flags & BSF_CONSTRUCTOR) != 0); - *sym_hash = NULL; - } - - if (type == (N_INDR | N_EXT) || type == N_WARNING) - ++sym_hash; - } - - return true; -} - -/* A hash table used for header files with N_BINCL entries. */ - -struct aout_link_includes_table -{ - struct bfd_hash_table root; -}; - -/* A linked list of totals that we have found for a particular header - file. */ - -struct aout_link_includes_totals -{ - struct aout_link_includes_totals *next; - bfd_vma total; -}; - -/* An entry in the header file hash table. */ - -struct aout_link_includes_entry -{ - struct bfd_hash_entry root; - /* List of totals we have found for this file. */ - struct aout_link_includes_totals *totals; -}; - -/* Look up an entry in an the header file hash table. */ - -#define aout_link_includes_lookup(table, string, create, copy) \ - ((struct aout_link_includes_entry *) \ - bfd_hash_lookup (&(table)->root, (string), (create), (copy))) - -/* During the final link step we need to pass around a bunch of - information, so we do it in an instance of this structure. */ - -struct aout_final_link_info -{ - /* General link information. */ - struct bfd_link_info *info; - /* Output bfd. */ - bfd *output_bfd; - /* Reloc file positions. */ - file_ptr treloff, dreloff; - /* File position of symbols. */ - file_ptr symoff; - /* String table. */ - struct bfd_strtab_hash *strtab; - /* Header file hash table. */ - struct aout_link_includes_table includes; - /* A buffer large enough to hold the contents of any section. */ - bfd_byte *contents; - /* A buffer large enough to hold the relocs of any section. */ - PTR relocs; - /* A buffer large enough to hold the symbol map of any input BFD. */ - int *symbol_map; - /* A buffer large enough to hold output symbols of any input BFD. */ - struct external_nlist *output_syms; -}; - -static struct bfd_hash_entry *aout_link_includes_newfunc - PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); -static boolean aout_link_input_bfd - PARAMS ((struct aout_final_link_info *, bfd *input_bfd)); -static boolean aout_link_write_symbols - PARAMS ((struct aout_final_link_info *, bfd *input_bfd)); -static boolean aout_link_write_other_symbol - PARAMS ((struct aout_link_hash_entry *, PTR)); -static boolean aout_link_input_section - PARAMS ((struct aout_final_link_info *, bfd *input_bfd, - asection *input_section, file_ptr *reloff_ptr, - bfd_size_type rel_size)); -static boolean aout_link_input_section_std - PARAMS ((struct aout_final_link_info *, bfd *input_bfd, - asection *input_section, struct reloc_std_external *, - bfd_size_type rel_size, bfd_byte *contents)); -static boolean aout_link_input_section_ext - PARAMS ((struct aout_final_link_info *, bfd *input_bfd, - asection *input_section, struct reloc_ext_external *, - bfd_size_type rel_size, bfd_byte *contents)); -static INLINE asection *aout_reloc_index_to_section - PARAMS ((bfd *, int)); -static boolean aout_link_reloc_link_order - PARAMS ((struct aout_final_link_info *, asection *, - struct bfd_link_order *)); - -/* The function to create a new entry in the header file hash table. */ - -static struct bfd_hash_entry * -aout_link_includes_newfunc (entry, table, string) - struct bfd_hash_entry *entry; - struct bfd_hash_table *table; - const char *string; -{ - struct aout_link_includes_entry *ret = - (struct aout_link_includes_entry *) entry; - - /* Allocate the structure if it has not already been allocated by a - subclass. */ - if (ret == (struct aout_link_includes_entry *) NULL) - ret = ((struct aout_link_includes_entry *) - bfd_hash_allocate (table, - sizeof (struct aout_link_includes_entry))); - if (ret == (struct aout_link_includes_entry *) NULL) - return (struct bfd_hash_entry *) ret; - - /* Call the allocation method of the superclass. */ - ret = ((struct aout_link_includes_entry *) - bfd_hash_newfunc ((struct bfd_hash_entry *) ret, table, string)); - if (ret) - { - /* Set local fields. */ - ret->totals = NULL; - } - - return (struct bfd_hash_entry *) ret; -} - -/* Do the final link step. This is called on the output BFD. The - INFO structure should point to a list of BFDs linked through the - link_next field which can be used to find each BFD which takes part - in the output. Also, each section in ABFD should point to a list - of bfd_link_order structures which list all the input sections for - the output section. */ - -boolean -NAME(aout,final_link) (abfd, info, callback) - bfd *abfd; - struct bfd_link_info *info; - void (*callback) PARAMS ((bfd *, file_ptr *, file_ptr *, file_ptr *)); -{ - struct aout_final_link_info aout_info; - boolean includes_hash_initialized = false; - register bfd *sub; - bfd_size_type trsize, drsize; - size_t max_contents_size; - size_t max_relocs_size; - size_t max_sym_count; - bfd_size_type text_size; - file_ptr text_end; - register struct bfd_link_order *p; - asection *o; - boolean have_link_order_relocs; - - if (info->shared) - abfd->flags |= DYNAMIC; - - aout_info.info = info; - aout_info.output_bfd = abfd; - aout_info.contents = NULL; - aout_info.relocs = NULL; - aout_info.symbol_map = NULL; - aout_info.output_syms = NULL; - - if (! bfd_hash_table_init_n (&aout_info.includes.root, - aout_link_includes_newfunc, - 251)) - goto error_return; - includes_hash_initialized = true; - - /* Figure out the largest section size. Also, if generating - relocateable output, count the relocs. */ - trsize = 0; - drsize = 0; - max_contents_size = 0; - max_relocs_size = 0; - max_sym_count = 0; - for (sub = info->input_bfds; sub != NULL; sub = sub->link_next) - { - size_t sz; - - if (info->relocateable) - { - if (bfd_get_flavour (sub) == bfd_target_aout_flavour) - { - trsize += exec_hdr (sub)->a_trsize; - drsize += exec_hdr (sub)->a_drsize; - } - else - { - /* FIXME: We need to identify the .text and .data sections - and call get_reloc_upper_bound and canonicalize_reloc to - work out the number of relocs needed, and then multiply - by the reloc size. */ - (*_bfd_error_handler) - ("%s: relocateable link from %s to %s not supported", - bfd_get_filename (abfd), - sub->xvec->name, abfd->xvec->name); - bfd_set_error (bfd_error_invalid_operation); - goto error_return; - } - } - - if (bfd_get_flavour (sub) == bfd_target_aout_flavour) - { - sz = bfd_section_size (sub, obj_textsec (sub)); - if (sz > max_contents_size) - max_contents_size = sz; - sz = bfd_section_size (sub, obj_datasec (sub)); - if (sz > max_contents_size) - max_contents_size = sz; - - sz = exec_hdr (sub)->a_trsize; - if (sz > max_relocs_size) - max_relocs_size = sz; - sz = exec_hdr (sub)->a_drsize; - if (sz > max_relocs_size) - max_relocs_size = sz; - - sz = obj_aout_external_sym_count (sub); - if (sz > max_sym_count) - max_sym_count = sz; - } - } - - if (info->relocateable) - { - if (obj_textsec (abfd) != (asection *) NULL) - trsize += (_bfd_count_link_order_relocs (obj_textsec (abfd) - ->link_order_head) - * obj_reloc_entry_size (abfd)); - if (obj_datasec (abfd) != (asection *) NULL) - drsize += (_bfd_count_link_order_relocs (obj_datasec (abfd) - ->link_order_head) - * obj_reloc_entry_size (abfd)); - } - - exec_hdr (abfd)->a_trsize = trsize; - exec_hdr (abfd)->a_drsize = drsize; - - exec_hdr (abfd)->a_entry = bfd_get_start_address (abfd); - - /* Adjust the section sizes and vmas according to the magic number. - This sets a_text, a_data and a_bss in the exec_hdr and sets the - filepos for each section. */ - if (! NAME(aout,adjust_sizes_and_vmas) (abfd, &text_size, &text_end)) - goto error_return; - - /* The relocation and symbol file positions differ among a.out - targets. We are passed a callback routine from the backend - specific code to handle this. - FIXME: At this point we do not know how much space the symbol - table will require. This will not work for any (nonstandard) - a.out target that needs to know the symbol table size before it - can compute the relocation file positions. This may or may not - be the case for the hp300hpux target, for example. */ - (*callback) (abfd, &aout_info.treloff, &aout_info.dreloff, - &aout_info.symoff); - obj_textsec (abfd)->rel_filepos = aout_info.treloff; - obj_datasec (abfd)->rel_filepos = aout_info.dreloff; - obj_sym_filepos (abfd) = aout_info.symoff; - - /* We keep a count of the symbols as we output them. */ - obj_aout_external_sym_count (abfd) = 0; - - /* We accumulate the string table as we write out the symbols. */ - aout_info.strtab = _bfd_stringtab_init (); - if (aout_info.strtab == NULL) - goto error_return; - - /* Allocate buffers to hold section contents and relocs. */ - aout_info.contents = (bfd_byte *) bfd_malloc (max_contents_size); - aout_info.relocs = (PTR) bfd_malloc (max_relocs_size); - aout_info.symbol_map = (int *) bfd_malloc (max_sym_count * sizeof (int *)); - aout_info.output_syms = ((struct external_nlist *) - bfd_malloc ((max_sym_count + 1) - * sizeof (struct external_nlist))); - if ((aout_info.contents == NULL && max_contents_size != 0) - || (aout_info.relocs == NULL && max_relocs_size != 0) - || (aout_info.symbol_map == NULL && max_sym_count != 0) - || aout_info.output_syms == NULL) - goto error_return; - - /* If we have a symbol named __DYNAMIC, force it out now. This is - required by SunOS. Doing this here rather than in sunos.c is a - hack, but it's easier than exporting everything which would be - needed. */ - { - struct aout_link_hash_entry *h; - - h = aout_link_hash_lookup (aout_hash_table (info), "__DYNAMIC", - false, false, false); - if (h != NULL) - aout_link_write_other_symbol (h, &aout_info); - } - - /* The most time efficient way to do the link would be to read all - the input object files into memory and then sort out the - information into the output file. Unfortunately, that will - probably use too much memory. Another method would be to step - through everything that composes the text section and write it - out, and then everything that composes the data section and write - it out, and then write out the relocs, and then write out the - symbols. Unfortunately, that requires reading stuff from each - input file several times, and we will not be able to keep all the - input files open simultaneously, and reopening them will be slow. - - What we do is basically process one input file at a time. We do - everything we need to do with an input file once--copy over the - section contents, handle the relocation information, and write - out the symbols--and then we throw away the information we read - from it. This approach requires a lot of lseeks of the output - file, which is unfortunate but still faster than reopening a lot - of files. - - We use the output_has_begun field of the input BFDs to see - whether we have already handled it. */ - for (sub = info->input_bfds; sub != (bfd *) NULL; sub = sub->link_next) - sub->output_has_begun = false; - - have_link_order_relocs = false; - for (o = abfd->sections; o != (asection *) NULL; o = o->next) - { - for (p = o->link_order_head; - p != (struct bfd_link_order *) NULL; - p = p->next) - { - if (p->type == bfd_indirect_link_order - && (bfd_get_flavour (p->u.indirect.section->owner) - == bfd_target_aout_flavour)) - { - bfd *input_bfd; - - input_bfd = p->u.indirect.section->owner; - if (! input_bfd->output_has_begun) - { - if (! aout_link_input_bfd (&aout_info, input_bfd)) - goto error_return; - input_bfd->output_has_begun = true; - } - } - else if (p->type == bfd_section_reloc_link_order - || p->type == bfd_symbol_reloc_link_order) - { - /* These are handled below. */ - have_link_order_relocs = true; - } - else - { - if (! _bfd_default_link_order (abfd, info, o, p)) - goto error_return; - } - } - } - - /* Write out any symbols that we have not already written out. */ - aout_link_hash_traverse (aout_hash_table (info), - aout_link_write_other_symbol, - (PTR) &aout_info); - - /* Now handle any relocs we were asked to create by the linker. - These did not come from any input file. We must do these after - we have written out all the symbols, so that we know the symbol - indices to use. */ - if (have_link_order_relocs) - { - for (o = abfd->sections; o != (asection *) NULL; o = o->next) - { - for (p = o->link_order_head; - p != (struct bfd_link_order *) NULL; - p = p->next) - { - if (p->type == bfd_section_reloc_link_order - || p->type == bfd_symbol_reloc_link_order) - { - if (! aout_link_reloc_link_order (&aout_info, o, p)) - goto error_return; - } - } - } - } - - if (aout_info.contents != NULL) - { - free (aout_info.contents); - aout_info.contents = NULL; - } - if (aout_info.relocs != NULL) - { - free (aout_info.relocs); - aout_info.relocs = NULL; - } - if (aout_info.symbol_map != NULL) - { - free (aout_info.symbol_map); - aout_info.symbol_map = NULL; - } - if (aout_info.output_syms != NULL) - { - free (aout_info.output_syms); - aout_info.output_syms = NULL; - } - if (includes_hash_initialized) - { - bfd_hash_table_free (&aout_info.includes.root); - includes_hash_initialized = false; - } - - /* Finish up any dynamic linking we may be doing. */ - if (aout_backend_info (abfd)->finish_dynamic_link != NULL) - { - if (! (*aout_backend_info (abfd)->finish_dynamic_link) (abfd, info)) - goto error_return; - } - - /* Update the header information. */ - abfd->symcount = obj_aout_external_sym_count (abfd); - exec_hdr (abfd)->a_syms = abfd->symcount * EXTERNAL_NLIST_SIZE; - obj_str_filepos (abfd) = obj_sym_filepos (abfd) + exec_hdr (abfd)->a_syms; - obj_textsec (abfd)->reloc_count = - exec_hdr (abfd)->a_trsize / obj_reloc_entry_size (abfd); - obj_datasec (abfd)->reloc_count = - exec_hdr (abfd)->a_drsize / obj_reloc_entry_size (abfd); - - /* Write out the string table. */ - if (bfd_seek (abfd, obj_str_filepos (abfd), SEEK_SET) != 0) - goto error_return; - return emit_stringtab (abfd, aout_info.strtab); - - error_return: - if (aout_info.contents != NULL) - free (aout_info.contents); - if (aout_info.relocs != NULL) - free (aout_info.relocs); - if (aout_info.symbol_map != NULL) - free (aout_info.symbol_map); - if (aout_info.output_syms != NULL) - free (aout_info.output_syms); - if (includes_hash_initialized) - bfd_hash_table_free (&aout_info.includes.root); - return false; -} - -/* Link an a.out input BFD into the output file. */ - -static boolean -aout_link_input_bfd (finfo, input_bfd) - struct aout_final_link_info *finfo; - bfd *input_bfd; -{ - bfd_size_type sym_count; - - BFD_ASSERT (bfd_get_format (input_bfd) == bfd_object); - - /* If this is a dynamic object, it may need special handling. */ - if ((input_bfd->flags & DYNAMIC) != 0 - && aout_backend_info (input_bfd)->link_dynamic_object != NULL) - { - return ((*aout_backend_info (input_bfd)->link_dynamic_object) - (finfo->info, input_bfd)); - } - - /* Get the symbols. We probably have them already, unless - finfo->info->keep_memory is false. */ - if (! aout_get_external_symbols (input_bfd)) - return false; - - sym_count = obj_aout_external_sym_count (input_bfd); - - /* Write out the symbols and get a map of the new indices. The map - is placed into finfo->symbol_map. */ - if (! aout_link_write_symbols (finfo, input_bfd)) - return false; - - /* Relocate and write out the sections. These functions use the - symbol map created by aout_link_write_symbols. */ - if (! aout_link_input_section (finfo, input_bfd, - obj_textsec (input_bfd), - &finfo->treloff, - exec_hdr (input_bfd)->a_trsize) - || ! aout_link_input_section (finfo, input_bfd, - obj_datasec (input_bfd), - &finfo->dreloff, - exec_hdr (input_bfd)->a_drsize)) - return false; - - /* If we are not keeping memory, we don't need the symbols any - longer. We still need them if we are keeping memory, because the - strings in the hash table point into them. */ - if (! finfo->info->keep_memory) - { - if (! aout_link_free_symbols (input_bfd)) - return false; - } - - return true; -} - -/* Adjust and write out the symbols for an a.out file. Set the new - symbol indices into a symbol_map. */ - -static boolean -aout_link_write_symbols (finfo, input_bfd) - struct aout_final_link_info *finfo; - bfd *input_bfd; -{ - bfd *output_bfd; - bfd_size_type sym_count; - char *strings; - enum bfd_link_strip strip; - enum bfd_link_discard discard; - struct external_nlist *outsym; - bfd_size_type strtab_index; - register struct external_nlist *sym; - struct external_nlist *sym_end; - struct aout_link_hash_entry **sym_hash; - int *symbol_map; - boolean pass; - boolean skip_next; - - output_bfd = finfo->output_bfd; - sym_count = obj_aout_external_sym_count (input_bfd); - strings = obj_aout_external_strings (input_bfd); - strip = finfo->info->strip; - discard = finfo->info->discard; - outsym = finfo->output_syms; - - /* First write out a symbol for this object file, unless we are - discarding such symbols. */ - if (strip != strip_all - && (strip != strip_some - || bfd_hash_lookup (finfo->info->keep_hash, input_bfd->filename, - false, false) != NULL) - && discard != discard_all) - { - bfd_h_put_8 (output_bfd, N_TEXT, outsym->e_type); - bfd_h_put_8 (output_bfd, 0, outsym->e_other); - bfd_h_put_16 (output_bfd, (bfd_vma) 0, outsym->e_desc); - strtab_index = add_to_stringtab (output_bfd, finfo->strtab, - input_bfd->filename, false); - if (strtab_index == (bfd_size_type) -1) - return false; - PUT_WORD (output_bfd, strtab_index, outsym->e_strx); - PUT_WORD (output_bfd, - (bfd_get_section_vma (output_bfd, - obj_textsec (input_bfd)->output_section) - + obj_textsec (input_bfd)->output_offset), - outsym->e_value); - ++obj_aout_external_sym_count (output_bfd); - ++outsym; - } - - pass = false; - skip_next = false; - sym = obj_aout_external_syms (input_bfd); - sym_end = sym + sym_count; - sym_hash = obj_aout_sym_hashes (input_bfd); - symbol_map = finfo->symbol_map; - memset (symbol_map, 0, sym_count * sizeof *symbol_map); - for (; sym < sym_end; sym++, sym_hash++, symbol_map++) - { - const char *name; - int type; - struct aout_link_hash_entry *h; - boolean skip; - asection *symsec; - bfd_vma val = 0; - boolean copy; - - /* We set *symbol_map to 0 above for all symbols. If it has - already been set to -1 for this symbol, it means that we are - discarding it because it appears in a duplicate header file. - See the N_BINCL code below. */ - if (*symbol_map == -1) - continue; - - /* Initialize *symbol_map to -1, which means that the symbol was - not copied into the output file. We will change it later if - we do copy the symbol over. */ - *symbol_map = -1; - - type = bfd_h_get_8 (input_bfd, sym->e_type); - name = strings + GET_WORD (input_bfd, sym->e_strx); - - h = NULL; - - if (pass) - { - /* Pass this symbol through. It is the target of an - indirect or warning symbol. */ - val = GET_WORD (input_bfd, sym->e_value); - pass = false; - } - else if (skip_next) - { - /* Skip this symbol, which is the target of an indirect - symbol that we have changed to no longer be an indirect - symbol. */ - skip_next = false; - continue; - } - else - { - struct aout_link_hash_entry *hresolve; - - /* We have saved the hash table entry for this symbol, if - there is one. Note that we could just look it up again - in the hash table, provided we first check that it is an - external symbol. */ - h = *sym_hash; - - /* Use the name from the hash table, in case the symbol was - wrapped. */ - if (h != NULL) - name = h->root.root.string; - - /* If this is an indirect or warning symbol, then change - hresolve to the base symbol. We also change *sym_hash so - that the relocation routines relocate against the real - symbol. */ - hresolve = h; - if (h != (struct aout_link_hash_entry *) NULL - && (h->root.type == bfd_link_hash_indirect - || h->root.type == bfd_link_hash_warning)) - { - hresolve = (struct aout_link_hash_entry *) h->root.u.i.link; - while (hresolve->root.type == bfd_link_hash_indirect - || hresolve->root.type == bfd_link_hash_warning) - hresolve = ((struct aout_link_hash_entry *) - hresolve->root.u.i.link); - *sym_hash = hresolve; - } - - /* If the symbol has already been written out, skip it. */ - if (h != (struct aout_link_hash_entry *) NULL - && h->root.type != bfd_link_hash_warning - && h->written) - { - if ((type & N_TYPE) == N_INDR - || type == N_WARNING) - skip_next = true; - *symbol_map = h->indx; - continue; - } - - /* See if we are stripping this symbol. */ - skip = false; - switch (strip) - { - case strip_none: - break; - case strip_debugger: - if ((type & N_STAB) != 0) - skip = true; - break; - case strip_some: - if (bfd_hash_lookup (finfo->info->keep_hash, name, false, false) - == NULL) - skip = true; - break; - case strip_all: - skip = true; - break; - } - if (skip) - { - if (h != (struct aout_link_hash_entry *) NULL) - h->written = true; - continue; - } - - /* Get the value of the symbol. */ - if ((type & N_TYPE) == N_TEXT - || type == N_WEAKT) - symsec = obj_textsec (input_bfd); - else if ((type & N_TYPE) == N_DATA - || type == N_WEAKD) - symsec = obj_datasec (input_bfd); - else if ((type & N_TYPE) == N_BSS - || type == N_WEAKB) - symsec = obj_bsssec (input_bfd); - else if ((type & N_TYPE) == N_ABS - || type == N_WEAKA) - symsec = bfd_abs_section_ptr; - else if (((type & N_TYPE) == N_INDR - && (hresolve == (struct aout_link_hash_entry *) NULL - || (hresolve->root.type != bfd_link_hash_defined - && hresolve->root.type != bfd_link_hash_defweak - && hresolve->root.type != bfd_link_hash_common))) - || type == N_WARNING) - { - /* Pass the next symbol through unchanged. The - condition above for indirect symbols is so that if - the indirect symbol was defined, we output it with - the correct definition so the debugger will - understand it. */ - pass = true; - val = GET_WORD (input_bfd, sym->e_value); - symsec = NULL; - } - else if ((type & N_STAB) != 0) - { - val = GET_WORD (input_bfd, sym->e_value); - symsec = NULL; - } - else - { - /* If we get here with an indirect symbol, it means that - we are outputting it with a real definition. In such - a case we do not want to output the next symbol, - which is the target of the indirection. */ - if ((type & N_TYPE) == N_INDR) - skip_next = true; - - symsec = NULL; - - /* We need to get the value from the hash table. We use - hresolve so that if we have defined an indirect - symbol we output the final definition. */ - if (h == (struct aout_link_hash_entry *) NULL) - { - switch (type & N_TYPE) - { - case N_SETT: - symsec = obj_textsec (input_bfd); - break; - case N_SETD: - symsec = obj_datasec (input_bfd); - break; - case N_SETB: - symsec = obj_bsssec (input_bfd); - break; - case N_SETA: - symsec = bfd_abs_section_ptr; - break; - default: - val = 0; - break; - } - } - else if (hresolve->root.type == bfd_link_hash_defined - || hresolve->root.type == bfd_link_hash_defweak) - { - asection *input_section; - asection *output_section; - - /* This case usually means a common symbol which was - turned into a defined symbol. */ - input_section = hresolve->root.u.def.section; - output_section = input_section->output_section; - BFD_ASSERT (bfd_is_abs_section (output_section) - || output_section->owner == output_bfd); - val = (hresolve->root.u.def.value - + bfd_get_section_vma (output_bfd, output_section) - + input_section->output_offset); - - /* Get the correct type based on the section. If - this is a constructed set, force it to be - globally visible. */ - if (type == N_SETT - || type == N_SETD - || type == N_SETB - || type == N_SETA) - type |= N_EXT; - - type &=~ N_TYPE; - - if (output_section == obj_textsec (output_bfd)) - type |= (hresolve->root.type == bfd_link_hash_defined - ? N_TEXT - : N_WEAKT); - else if (output_section == obj_datasec (output_bfd)) - type |= (hresolve->root.type == bfd_link_hash_defined - ? N_DATA - : N_WEAKD); - else if (output_section == obj_bsssec (output_bfd)) - type |= (hresolve->root.type == bfd_link_hash_defined - ? N_BSS - : N_WEAKB); - else - type |= (hresolve->root.type == bfd_link_hash_defined - ? N_ABS - : N_WEAKA); - } - else if (hresolve->root.type == bfd_link_hash_common) - val = hresolve->root.u.c.size; - else if (hresolve->root.type == bfd_link_hash_undefweak) - { - val = 0; - type = N_WEAKU; - } - else - val = 0; - } - if (symsec != (asection *) NULL) - val = (symsec->output_section->vma - + symsec->output_offset - + (GET_WORD (input_bfd, sym->e_value) - - symsec->vma)); - - /* If this is a global symbol set the written flag, and if - it is a local symbol see if we should discard it. */ - if (h != (struct aout_link_hash_entry *) NULL) - { - h->written = true; - h->indx = obj_aout_external_sym_count (output_bfd); - } - else if ((type & N_TYPE) != N_SETT - && (type & N_TYPE) != N_SETD - && (type & N_TYPE) != N_SETB - && (type & N_TYPE) != N_SETA) - { - switch (discard) - { - case discard_none: - break; - case discard_l: - if (*name == *finfo->info->lprefix - && (finfo->info->lprefix_len == 1 - || strncmp (name, finfo->info->lprefix, - finfo->info->lprefix_len) == 0)) - skip = true; - break; - case discard_all: - skip = true; - break; - } - if (skip) - { - pass = false; - continue; - } - } - - /* An N_BINCL symbol indicates the start of the stabs - entries for a header file. We need to scan ahead to the - next N_EINCL symbol, ignoring nesting, adding up all the - characters in the symbol names, not including the file - numbers in types (the first number after an open - parenthesis). */ - if (type == N_BINCL) - { - struct external_nlist *incl_sym; - int nest; - struct aout_link_includes_entry *incl_entry; - struct aout_link_includes_totals *t; - - val = 0; - nest = 0; - for (incl_sym = sym + 1; incl_sym < sym_end; incl_sym++) - { - int incl_type; - - incl_type = bfd_h_get_8 (input_bfd, incl_sym->e_type); - if (incl_type == N_EINCL) - { - if (nest == 0) - break; - --nest; - } - else if (incl_type == N_BINCL) - ++nest; - else if (nest == 0) - { - const char *s; - - s = strings + GET_WORD (input_bfd, incl_sym->e_strx); - for (; *s != '\0'; s++) - { - val += *s; - if (*s == '(') - { - /* Skip the file number. */ - ++s; - while (isdigit ((unsigned char) *s)) - ++s; - --s; - } - } - } - } - - /* If we have already included a header file with the - same value, then replace this one with an N_EXCL - symbol. */ - copy = ! finfo->info->keep_memory; - incl_entry = aout_link_includes_lookup (&finfo->includes, - name, true, copy); - if (incl_entry == NULL) - return false; - for (t = incl_entry->totals; t != NULL; t = t->next) - if (t->total == val) - break; - if (t == NULL) - { - /* This is the first time we have seen this header - file with this set of stabs strings. */ - t = ((struct aout_link_includes_totals *) - bfd_hash_allocate (&finfo->includes.root, - sizeof *t)); - if (t == NULL) - return false; - t->total = val; - t->next = incl_entry->totals; - incl_entry->totals = t; - } - else - { - int *incl_map; - - /* This is a duplicate header file. We must change - it to be an N_EXCL entry, and mark all the - included symbols to prevent outputting them. */ - type = N_EXCL; - - nest = 0; - for (incl_sym = sym + 1, incl_map = symbol_map + 1; - incl_sym < sym_end; - incl_sym++, incl_map++) - { - int incl_type; - - incl_type = bfd_h_get_8 (input_bfd, incl_sym->e_type); - if (incl_type == N_EINCL) - { - if (nest == 0) - { - *incl_map = -1; - break; - } - --nest; - } - else if (incl_type == N_BINCL) - ++nest; - else if (nest == 0) - *incl_map = -1; - } - } - } - } - - /* Copy this symbol into the list of symbols we are going to - write out. */ - bfd_h_put_8 (output_bfd, type, outsym->e_type); - bfd_h_put_8 (output_bfd, bfd_h_get_8 (input_bfd, sym->e_other), - outsym->e_other); - bfd_h_put_16 (output_bfd, bfd_h_get_16 (input_bfd, sym->e_desc), - outsym->e_desc); - copy = false; - if (! finfo->info->keep_memory) - { - /* name points into a string table which we are going to - free. If there is a hash table entry, use that string. - Otherwise, copy name into memory. */ - if (h != (struct aout_link_hash_entry *) NULL) - name = h->root.root.string; - else - copy = true; - } - strtab_index = add_to_stringtab (output_bfd, finfo->strtab, - name, copy); - if (strtab_index == (bfd_size_type) -1) - return false; - PUT_WORD (output_bfd, strtab_index, outsym->e_strx); - PUT_WORD (output_bfd, val, outsym->e_value); - *symbol_map = obj_aout_external_sym_count (output_bfd); - ++obj_aout_external_sym_count (output_bfd); - ++outsym; - } - - /* Write out the output symbols we have just constructed. */ - if (outsym > finfo->output_syms) - { - bfd_size_type outsym_count; - - if (bfd_seek (output_bfd, finfo->symoff, SEEK_SET) != 0) - return false; - outsym_count = outsym - finfo->output_syms; - if (bfd_write ((PTR) finfo->output_syms, - (bfd_size_type) EXTERNAL_NLIST_SIZE, - (bfd_size_type) outsym_count, output_bfd) - != outsym_count * EXTERNAL_NLIST_SIZE) - return false; - finfo->symoff += outsym_count * EXTERNAL_NLIST_SIZE; - } - - return true; -} - -/* Write out a symbol that was not associated with an a.out input - object. */ - -static boolean -aout_link_write_other_symbol (h, data) - struct aout_link_hash_entry *h; - PTR data; -{ - struct aout_final_link_info *finfo = (struct aout_final_link_info *) data; - bfd *output_bfd; - int type; - bfd_vma val; - struct external_nlist outsym; - bfd_size_type indx; - - output_bfd = finfo->output_bfd; - - if (aout_backend_info (output_bfd)->write_dynamic_symbol != NULL) - { - if (! ((*aout_backend_info (output_bfd)->write_dynamic_symbol) - (output_bfd, finfo->info, h))) - { - /* FIXME: No way to handle errors. */ - abort (); - } - } - - if (h->written) - return true; - - h->written = true; - - /* An indx of -2 means the symbol must be written. */ - if (h->indx != -2 - && (finfo->info->strip == strip_all - || (finfo->info->strip == strip_some - && bfd_hash_lookup (finfo->info->keep_hash, h->root.root.string, - false, false) == NULL))) - return true; - - switch (h->root.type) - { - default: - abort (); - /* Avoid variable not initialized warnings. */ - return true; - case bfd_link_hash_new: - /* This can happen for set symbols when sets are not being - built. */ - return true; - case bfd_link_hash_undefined: - type = N_UNDF | N_EXT; - val = 0; - break; - case bfd_link_hash_defined: - case bfd_link_hash_defweak: - { - asection *sec; - - sec = h->root.u.def.section->output_section; - BFD_ASSERT (bfd_is_abs_section (sec) - || sec->owner == output_bfd); - if (sec == obj_textsec (output_bfd)) - type = h->root.type == bfd_link_hash_defined ? N_TEXT : N_WEAKT; - else if (sec == obj_datasec (output_bfd)) - type = h->root.type == bfd_link_hash_defined ? N_DATA : N_WEAKD; - else if (sec == obj_bsssec (output_bfd)) - type = h->root.type == bfd_link_hash_defined ? N_BSS : N_WEAKB; - else - type = h->root.type == bfd_link_hash_defined ? N_ABS : N_WEAKA; - type |= N_EXT; - val = (h->root.u.def.value - + sec->vma - + h->root.u.def.section->output_offset); - } - break; - case bfd_link_hash_common: - type = N_UNDF | N_EXT; - val = h->root.u.c.size; - break; - case bfd_link_hash_undefweak: - type = N_WEAKU; - val = 0; - case bfd_link_hash_indirect: - case bfd_link_hash_warning: - /* FIXME: Ignore these for now. The circumstances under which - they should be written out are not clear to me. */ - return true; - } - - bfd_h_put_8 (output_bfd, type, outsym.e_type); - bfd_h_put_8 (output_bfd, 0, outsym.e_other); - bfd_h_put_16 (output_bfd, 0, outsym.e_desc); - indx = add_to_stringtab (output_bfd, finfo->strtab, h->root.root.string, - false); - if (indx == (bfd_size_type) -1) - { - /* FIXME: No way to handle errors. */ - abort (); - } - PUT_WORD (output_bfd, indx, outsym.e_strx); - PUT_WORD (output_bfd, val, outsym.e_value); - - if (bfd_seek (output_bfd, finfo->symoff, SEEK_SET) != 0 - || bfd_write ((PTR) &outsym, (bfd_size_type) EXTERNAL_NLIST_SIZE, - (bfd_size_type) 1, output_bfd) != EXTERNAL_NLIST_SIZE) - { - /* FIXME: No way to handle errors. */ - abort (); - } - - finfo->symoff += EXTERNAL_NLIST_SIZE; - h->indx = obj_aout_external_sym_count (output_bfd); - ++obj_aout_external_sym_count (output_bfd); - - return true; -} - -/* Link an a.out section into the output file. */ - -static boolean -aout_link_input_section (finfo, input_bfd, input_section, reloff_ptr, - rel_size) - struct aout_final_link_info *finfo; - bfd *input_bfd; - asection *input_section; - file_ptr *reloff_ptr; - bfd_size_type rel_size; -{ - bfd_size_type input_size; - PTR relocs; - - /* Get the section contents. */ - input_size = bfd_section_size (input_bfd, input_section); - if (! bfd_get_section_contents (input_bfd, input_section, - (PTR) finfo->contents, - (file_ptr) 0, input_size)) - return false; - - /* Read in the relocs if we haven't already done it. */ - if (aout_section_data (input_section) != NULL - && aout_section_data (input_section)->relocs != NULL) - relocs = aout_section_data (input_section)->relocs; - else - { - relocs = finfo->relocs; - if (rel_size > 0) - { - if (bfd_seek (input_bfd, input_section->rel_filepos, SEEK_SET) != 0 - || bfd_read (relocs, 1, rel_size, input_bfd) != rel_size) - return false; - } - } - - /* Relocate the section contents. */ - if (obj_reloc_entry_size (input_bfd) == RELOC_STD_SIZE) - { - if (! aout_link_input_section_std (finfo, input_bfd, input_section, - (struct reloc_std_external *) relocs, - rel_size, finfo->contents)) - return false; - } - else - { - if (! aout_link_input_section_ext (finfo, input_bfd, input_section, - (struct reloc_ext_external *) relocs, - rel_size, finfo->contents)) - return false; - } - - /* Write out the section contents. */ - if (! bfd_set_section_contents (finfo->output_bfd, - input_section->output_section, - (PTR) finfo->contents, - input_section->output_offset, - input_size)) - return false; - - /* If we are producing relocateable output, the relocs were - modified, and we now write them out. */ - if (finfo->info->relocateable && rel_size > 0) - { - if (bfd_seek (finfo->output_bfd, *reloff_ptr, SEEK_SET) != 0) - return false; - if (bfd_write (relocs, (bfd_size_type) 1, rel_size, finfo->output_bfd) - != rel_size) - return false; - *reloff_ptr += rel_size; - - /* Assert that the relocs have not run into the symbols, and - that if these are the text relocs they have not run into the - data relocs. */ - BFD_ASSERT (*reloff_ptr <= obj_sym_filepos (finfo->output_bfd) - && (reloff_ptr != &finfo->treloff - || (*reloff_ptr - <= obj_datasec (finfo->output_bfd)->rel_filepos))); - } - - return true; -} - -/* Get the section corresponding to a reloc index. */ - -static INLINE asection * -aout_reloc_index_to_section (abfd, indx) - bfd *abfd; - int indx; -{ - switch (indx & N_TYPE) - { - case N_TEXT: - return obj_textsec (abfd); - case N_DATA: - return obj_datasec (abfd); - case N_BSS: - return obj_bsssec (abfd); - case N_ABS: - case N_UNDF: - return bfd_abs_section_ptr; - default: - abort (); - } -} - -/* Relocate an a.out section using standard a.out relocs. */ - -static boolean -aout_link_input_section_std (finfo, input_bfd, input_section, relocs, - rel_size, contents) - struct aout_final_link_info *finfo; - bfd *input_bfd; - asection *input_section; - struct reloc_std_external *relocs; - bfd_size_type rel_size; - bfd_byte *contents; -{ - boolean (*check_dynamic_reloc) PARAMS ((struct bfd_link_info *, - bfd *, asection *, - struct aout_link_hash_entry *, - PTR, bfd_byte *, boolean *, - bfd_vma *)); - bfd *output_bfd; - boolean relocateable; - struct external_nlist *syms; - char *strings; - struct aout_link_hash_entry **sym_hashes; - int *symbol_map; - bfd_size_type reloc_count; - register struct reloc_std_external *rel; - struct reloc_std_external *rel_end; - - output_bfd = finfo->output_bfd; - check_dynamic_reloc = aout_backend_info (output_bfd)->check_dynamic_reloc; - - BFD_ASSERT (obj_reloc_entry_size (input_bfd) == RELOC_STD_SIZE); - BFD_ASSERT (input_bfd->xvec->header_byteorder - == output_bfd->xvec->header_byteorder); - - relocateable = finfo->info->relocateable; - syms = obj_aout_external_syms (input_bfd); - strings = obj_aout_external_strings (input_bfd); - sym_hashes = obj_aout_sym_hashes (input_bfd); - symbol_map = finfo->symbol_map; - - reloc_count = rel_size / RELOC_STD_SIZE; - rel = relocs; - rel_end = rel + reloc_count; - for (; rel < rel_end; rel++) - { - bfd_vma r_addr; - int r_index; - int r_extern; - int r_pcrel; - int r_baserel = 0; - reloc_howto_type *howto; - struct aout_link_hash_entry *h = NULL; - bfd_vma relocation; - bfd_reloc_status_type r; - - r_addr = GET_SWORD (input_bfd, rel->r_address); - -#ifdef MY_reloc_howto - howto = MY_reloc_howto(input_bfd, rel, r_index, r_extern, r_pcrel); -#else - { - int r_jmptable; - int r_relative; - int r_length; - unsigned int howto_idx; - - if (bfd_header_big_endian (input_bfd)) - { - r_index = ((rel->r_index[0] << 16) - | (rel->r_index[1] << 8) - | rel->r_index[2]); - r_extern = (0 != (rel->r_type[0] & RELOC_STD_BITS_EXTERN_BIG)); - r_pcrel = (0 != (rel->r_type[0] & RELOC_STD_BITS_PCREL_BIG)); - r_baserel = (0 != (rel->r_type[0] & RELOC_STD_BITS_BASEREL_BIG)); - r_jmptable= (0 != (rel->r_type[0] & RELOC_STD_BITS_JMPTABLE_BIG)); - r_relative= (0 != (rel->r_type[0] & RELOC_STD_BITS_RELATIVE_BIG)); - r_length = ((rel->r_type[0] & RELOC_STD_BITS_LENGTH_BIG) - >> RELOC_STD_BITS_LENGTH_SH_BIG); - } - else - { - r_index = ((rel->r_index[2] << 16) - | (rel->r_index[1] << 8) - | rel->r_index[0]); - r_extern = (0 != (rel->r_type[0] & RELOC_STD_BITS_EXTERN_LITTLE)); - r_pcrel = (0 != (rel->r_type[0] & RELOC_STD_BITS_PCREL_LITTLE)); - r_baserel = (0 != (rel->r_type[0] - & RELOC_STD_BITS_BASEREL_LITTLE)); - r_jmptable= (0 != (rel->r_type[0] - & RELOC_STD_BITS_JMPTABLE_LITTLE)); - r_relative= (0 != (rel->r_type[0] - & RELOC_STD_BITS_RELATIVE_LITTLE)); - r_length = ((rel->r_type[0] & RELOC_STD_BITS_LENGTH_LITTLE) - >> RELOC_STD_BITS_LENGTH_SH_LITTLE); - } - - howto_idx = (r_length + 4 * r_pcrel + 8 * r_baserel - + 16 * r_jmptable + 32 * r_relative); - BFD_ASSERT (howto_idx < TABLE_SIZE (howto_table_std)); - howto = howto_table_std + howto_idx; - } -#endif - - if (relocateable) - { - /* We are generating a relocateable output file, and must - modify the reloc accordingly. */ - if (r_extern) - { - /* If we know the symbol this relocation is against, - convert it into a relocation against a section. This - is what the native linker does. */ - h = sym_hashes[r_index]; - if (h != (struct aout_link_hash_entry *) NULL - && (h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak)) - { - asection *output_section; - - /* Change the r_extern value. */ - if (bfd_header_big_endian (output_bfd)) - rel->r_type[0] &=~ RELOC_STD_BITS_EXTERN_BIG; - else - rel->r_type[0] &=~ RELOC_STD_BITS_EXTERN_LITTLE; - - /* Compute a new r_index. */ - output_section = h->root.u.def.section->output_section; - if (output_section == obj_textsec (output_bfd)) - r_index = N_TEXT; - else if (output_section == obj_datasec (output_bfd)) - r_index = N_DATA; - else if (output_section == obj_bsssec (output_bfd)) - r_index = N_BSS; - else - r_index = N_ABS; - - /* Add the symbol value and the section VMA to the - addend stored in the contents. */ - relocation = (h->root.u.def.value - + output_section->vma - + h->root.u.def.section->output_offset); - } - else - { - /* We must change r_index according to the symbol - map. */ - r_index = symbol_map[r_index]; - - if (r_index == -1) - { - if (h != NULL) - { - /* We decided to strip this symbol, but it - turns out that we can't. Note that we - lose the other and desc information here. - I don't think that will ever matter for a - global symbol. */ - if (h->indx < 0) - { - h->indx = -2; - h->written = false; - if (! aout_link_write_other_symbol (h, - (PTR) finfo)) - return false; - } - r_index = h->indx; - } - else - { - const char *name; - - name = strings + GET_WORD (input_bfd, - syms[r_index].e_strx); - if (! ((*finfo->info->callbacks->unattached_reloc) - (finfo->info, name, input_bfd, input_section, - r_addr))) - return false; - r_index = 0; - } - } - - relocation = 0; - } - - /* Write out the new r_index value. */ - if (bfd_header_big_endian (output_bfd)) - { - rel->r_index[0] = r_index >> 16; - rel->r_index[1] = r_index >> 8; - rel->r_index[2] = r_index; - } - else - { - rel->r_index[2] = r_index >> 16; - rel->r_index[1] = r_index >> 8; - rel->r_index[0] = r_index; - } - } - else - { - asection *section; - - /* This is a relocation against a section. We must - adjust by the amount that the section moved. */ - section = aout_reloc_index_to_section (input_bfd, r_index); - relocation = (section->output_section->vma - + section->output_offset - - section->vma); - } - - /* Change the address of the relocation. */ - PUT_WORD (output_bfd, - r_addr + input_section->output_offset, - rel->r_address); - - /* Adjust a PC relative relocation by removing the reference - to the original address in the section and including the - reference to the new address. */ - if (r_pcrel) - relocation -= (input_section->output_section->vma - + input_section->output_offset - - input_section->vma); - -#ifdef MY_relocatable_reloc - MY_relocatable_reloc (howto, output_bfd, rel, relocation, r_addr); -#endif - - if (relocation == 0) - r = bfd_reloc_ok; - else - r = MY_relocate_contents (howto, - input_bfd, relocation, - contents + r_addr); - } - else - { - boolean hundef; - - /* We are generating an executable, and must do a full - relocation. */ - hundef = false; - if (r_extern) - { - h = sym_hashes[r_index]; - - if (h != (struct aout_link_hash_entry *) NULL - && (h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak)) - { - relocation = (h->root.u.def.value - + h->root.u.def.section->output_section->vma - + h->root.u.def.section->output_offset); - } - else if (h != (struct aout_link_hash_entry *) NULL - && h->root.type == bfd_link_hash_undefweak) - relocation = 0; - else - { - hundef = true; - relocation = 0; - } - } - else - { - asection *section; - - section = aout_reloc_index_to_section (input_bfd, r_index); - relocation = (section->output_section->vma - + section->output_offset - - section->vma); - if (r_pcrel) - relocation += input_section->vma; - } - - if (check_dynamic_reloc != NULL) - { - boolean skip; - - if (! ((*check_dynamic_reloc) - (finfo->info, input_bfd, input_section, h, - (PTR) rel, contents, &skip, &relocation))) - return false; - if (skip) - continue; - } - - /* Now warn if a global symbol is undefined. We could not - do this earlier, because check_dynamic_reloc might want - to skip this reloc. */ - if (hundef && ! finfo->info->shared && ! r_baserel) - { - const char *name; - - if (h != NULL) - name = h->root.root.string; - else - name = strings + GET_WORD (input_bfd, syms[r_index].e_strx); - if (! ((*finfo->info->callbacks->undefined_symbol) - (finfo->info, name, input_bfd, input_section, r_addr))) - return false; - } - - r = MY_final_link_relocate (howto, - input_bfd, input_section, - contents, r_addr, relocation, - (bfd_vma) 0); - } - - if (r != bfd_reloc_ok) - { - switch (r) - { - default: - case bfd_reloc_outofrange: - abort (); - case bfd_reloc_overflow: - { - const char *name; - - if (r_extern) - name = strings + GET_WORD (input_bfd, - syms[r_index].e_strx); - else - { - asection *s; - - s = aout_reloc_index_to_section (input_bfd, r_index); - name = bfd_section_name (input_bfd, s); - } - if (! ((*finfo->info->callbacks->reloc_overflow) - (finfo->info, name, howto->name, - (bfd_vma) 0, input_bfd, input_section, r_addr))) - return false; - } - break; - } - } - } - - return true; -} - -/* Relocate an a.out section using extended a.out relocs. */ - -static boolean -aout_link_input_section_ext (finfo, input_bfd, input_section, relocs, - rel_size, contents) - struct aout_final_link_info *finfo; - bfd *input_bfd; - asection *input_section; - struct reloc_ext_external *relocs; - bfd_size_type rel_size; - bfd_byte *contents; -{ - boolean (*check_dynamic_reloc) PARAMS ((struct bfd_link_info *, - bfd *, asection *, - struct aout_link_hash_entry *, - PTR, bfd_byte *, boolean *, - bfd_vma *)); - bfd *output_bfd; - boolean relocateable; - struct external_nlist *syms; - char *strings; - struct aout_link_hash_entry **sym_hashes; - int *symbol_map; - bfd_size_type reloc_count; - register struct reloc_ext_external *rel; - struct reloc_ext_external *rel_end; - - output_bfd = finfo->output_bfd; - check_dynamic_reloc = aout_backend_info (output_bfd)->check_dynamic_reloc; - - BFD_ASSERT (obj_reloc_entry_size (input_bfd) == RELOC_EXT_SIZE); - BFD_ASSERT (input_bfd->xvec->header_byteorder - == output_bfd->xvec->header_byteorder); - - relocateable = finfo->info->relocateable; - syms = obj_aout_external_syms (input_bfd); - strings = obj_aout_external_strings (input_bfd); - sym_hashes = obj_aout_sym_hashes (input_bfd); - symbol_map = finfo->symbol_map; - - reloc_count = rel_size / RELOC_EXT_SIZE; - rel = relocs; - rel_end = rel + reloc_count; - for (; rel < rel_end; rel++) - { - bfd_vma r_addr; - int r_index; - int r_extern; - unsigned int r_type; - bfd_vma r_addend; - struct aout_link_hash_entry *h = NULL; - asection *r_section = NULL; - bfd_vma relocation; - - r_addr = GET_SWORD (input_bfd, rel->r_address); - - if (bfd_header_big_endian (input_bfd)) - { - r_index = ((rel->r_index[0] << 16) - | (rel->r_index[1] << 8) - | rel->r_index[2]); - r_extern = (0 != (rel->r_type[0] & RELOC_EXT_BITS_EXTERN_BIG)); - r_type = ((rel->r_type[0] & RELOC_EXT_BITS_TYPE_BIG) - >> RELOC_EXT_BITS_TYPE_SH_BIG); - } - else - { - r_index = ((rel->r_index[2] << 16) - | (rel->r_index[1] << 8) - | rel->r_index[0]); - r_extern = (0 != (rel->r_type[0] & RELOC_EXT_BITS_EXTERN_LITTLE)); - r_type = ((rel->r_type[0] & RELOC_EXT_BITS_TYPE_LITTLE) - >> RELOC_EXT_BITS_TYPE_SH_LITTLE); - } - - r_addend = GET_SWORD (input_bfd, rel->r_addend); - - BFD_ASSERT (r_type < TABLE_SIZE (howto_table_ext)); - - if (relocateable) - { - /* We are generating a relocateable output file, and must - modify the reloc accordingly. */ - if (r_extern) - { - /* If we know the symbol this relocation is against, - convert it into a relocation against a section. This - is what the native linker does. */ - h = sym_hashes[r_index]; - if (h != (struct aout_link_hash_entry *) NULL - && (h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak)) - { - asection *output_section; - - /* Change the r_extern value. */ - if (bfd_header_big_endian (output_bfd)) - rel->r_type[0] &=~ RELOC_EXT_BITS_EXTERN_BIG; - else - rel->r_type[0] &=~ RELOC_EXT_BITS_EXTERN_LITTLE; - - /* Compute a new r_index. */ - output_section = h->root.u.def.section->output_section; - if (output_section == obj_textsec (output_bfd)) - r_index = N_TEXT; - else if (output_section == obj_datasec (output_bfd)) - r_index = N_DATA; - else if (output_section == obj_bsssec (output_bfd)) - r_index = N_BSS; - else - r_index = N_ABS; - - /* Add the symbol value and the section VMA to the - addend. */ - relocation = (h->root.u.def.value - + output_section->vma - + h->root.u.def.section->output_offset); - - /* Now RELOCATION is the VMA of the final - destination. If this is a PC relative reloc, - then ADDEND is the negative of the source VMA. - We want to set ADDEND to the difference between - the destination VMA and the source VMA, which - means we must adjust RELOCATION by the change in - the source VMA. This is done below. */ - } - else - { - /* We must change r_index according to the symbol - map. */ - r_index = symbol_map[r_index]; - - if (r_index == -1) - { - if (h != NULL) - { - /* We decided to strip this symbol, but it - turns out that we can't. Note that we - lose the other and desc information here. - I don't think that will ever matter for a - global symbol. */ - if (h->indx < 0) - { - h->indx = -2; - h->written = false; - if (! aout_link_write_other_symbol (h, - (PTR) finfo)) - return false; - } - r_index = h->indx; - } - else - { - const char *name; - - name = strings + GET_WORD (input_bfd, - syms[r_index].e_strx); - if (! ((*finfo->info->callbacks->unattached_reloc) - (finfo->info, name, input_bfd, input_section, - r_addr))) - return false; - r_index = 0; - } - } - - relocation = 0; - - /* If this is a PC relative reloc, then the addend - is the negative of the source VMA. We must - adjust it by the change in the source VMA. This - is done below. */ - } - - /* Write out the new r_index value. */ - if (bfd_header_big_endian (output_bfd)) - { - rel->r_index[0] = r_index >> 16; - rel->r_index[1] = r_index >> 8; - rel->r_index[2] = r_index; - } - else - { - rel->r_index[2] = r_index >> 16; - rel->r_index[1] = r_index >> 8; - rel->r_index[0] = r_index; - } - } - else - { - /* This is a relocation against a section. We must - adjust by the amount that the section moved. */ - r_section = aout_reloc_index_to_section (input_bfd, r_index); - relocation = (r_section->output_section->vma - + r_section->output_offset - - r_section->vma); - - /* If this is a PC relative reloc, then the addend is - the difference in VMA between the destination and the - source. We have just adjusted for the change in VMA - of the destination, so we must also adjust by the - change in VMA of the source. This is done below. */ - } - - /* As described above, we must always adjust a PC relative - reloc by the change in VMA of the source. */ - if (howto_table_ext[r_type].pc_relative) - relocation -= (input_section->output_section->vma - + input_section->output_offset - - input_section->vma); - - /* Change the addend if necessary. */ - if (relocation != 0) - PUT_WORD (output_bfd, r_addend + relocation, rel->r_addend); - - /* Change the address of the relocation. */ - PUT_WORD (output_bfd, - r_addr + input_section->output_offset, - rel->r_address); - } - else - { - boolean hundef; - bfd_reloc_status_type r; - - /* We are generating an executable, and must do a full - relocation. */ - hundef = false; - if (r_extern) - { - h = sym_hashes[r_index]; - - if (h != (struct aout_link_hash_entry *) NULL - && (h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak)) - { - relocation = (h->root.u.def.value - + h->root.u.def.section->output_section->vma - + h->root.u.def.section->output_offset); - } - else if (h != (struct aout_link_hash_entry *) NULL - && h->root.type == bfd_link_hash_undefweak) - relocation = 0; - else - { - hundef = true; - relocation = 0; - } - } - else if (r_type == RELOC_BASE10 - || r_type == RELOC_BASE13 - || r_type == RELOC_BASE22) - { - struct external_nlist *sym; - int type; - - /* For base relative relocs, r_index is always an index - into the symbol table, even if r_extern is 0. */ - sym = syms + r_index; - type = bfd_h_get_8 (input_bfd, sym->e_type); - if ((type & N_TYPE) == N_TEXT - || type == N_WEAKT) - r_section = obj_textsec (input_bfd); - else if ((type & N_TYPE) == N_DATA - || type == N_WEAKD) - r_section = obj_datasec (input_bfd); - else if ((type & N_TYPE) == N_BSS - || type == N_WEAKB) - r_section = obj_bsssec (input_bfd); - else if ((type & N_TYPE) == N_ABS - || type == N_WEAKA) - r_section = bfd_abs_section_ptr; - else - abort (); - relocation = (r_section->output_section->vma - + r_section->output_offset - + (GET_WORD (input_bfd, sym->e_value) - - r_section->vma)); - } - else - { - r_section = aout_reloc_index_to_section (input_bfd, r_index); - - /* If this is a PC relative reloc, then R_ADDEND is the - difference between the two vmas, or - old_dest_sec + old_dest_off - (old_src_sec + old_src_off) - where - old_dest_sec == section->vma - and - old_src_sec == input_section->vma - and - old_src_off == r_addr - - _bfd_final_link_relocate expects RELOCATION + - R_ADDEND to be the VMA of the destination minus - r_addr (the minus r_addr is because this relocation - is not pcrel_offset, which is a bit confusing and - should, perhaps, be changed), or - new_dest_sec - where - new_dest_sec == output_section->vma + output_offset - We arrange for this to happen by setting RELOCATION to - new_dest_sec + old_src_sec - old_dest_sec - - If this is not a PC relative reloc, then R_ADDEND is - simply the VMA of the destination, so we set - RELOCATION to the change in the destination VMA, or - new_dest_sec - old_dest_sec - */ - relocation = (r_section->output_section->vma - + r_section->output_offset - - r_section->vma); - if (howto_table_ext[r_type].pc_relative) - relocation += input_section->vma; - } - - if (check_dynamic_reloc != NULL) - { - boolean skip; - - if (! ((*check_dynamic_reloc) - (finfo->info, input_bfd, input_section, h, - (PTR) rel, contents, &skip, &relocation))) - return false; - if (skip) - continue; - } - - /* Now warn if a global symbol is undefined. We could not - do this earlier, because check_dynamic_reloc might want - to skip this reloc. */ - if (hundef - && ! finfo->info->shared - && r_type != RELOC_BASE10 - && r_type != RELOC_BASE13 - && r_type != RELOC_BASE22) - { - const char *name; - - if (h != NULL) - name = h->root.root.string; - else - name = strings + GET_WORD (input_bfd, syms[r_index].e_strx); - if (! ((*finfo->info->callbacks->undefined_symbol) - (finfo->info, name, input_bfd, input_section, r_addr))) - return false; - } - - r = MY_final_link_relocate (howto_table_ext + r_type, - input_bfd, input_section, - contents, r_addr, relocation, - r_addend); - if (r != bfd_reloc_ok) - { - switch (r) - { - default: - case bfd_reloc_outofrange: - abort (); - case bfd_reloc_overflow: - { - const char *name; - - if (r_extern - || r_type == RELOC_BASE10 - || r_type == RELOC_BASE13 - || r_type == RELOC_BASE22) - name = strings + GET_WORD (input_bfd, - syms[r_index].e_strx); - else - { - asection *s; - - s = aout_reloc_index_to_section (input_bfd, r_index); - name = bfd_section_name (input_bfd, s); - } - if (! ((*finfo->info->callbacks->reloc_overflow) - (finfo->info, name, howto_table_ext[r_type].name, - r_addend, input_bfd, input_section, r_addr))) - return false; - } - break; - } - } - } - } - - return true; -} - -/* Handle a link order which is supposed to generate a reloc. */ - -static boolean -aout_link_reloc_link_order (finfo, o, p) - struct aout_final_link_info *finfo; - asection *o; - struct bfd_link_order *p; -{ - struct bfd_link_order_reloc *pr; - int r_index; - int r_extern; - reloc_howto_type *howto; - file_ptr *reloff_ptr; - struct reloc_std_external srel; - struct reloc_ext_external erel; - PTR rel_ptr; - - pr = p->u.reloc.p; - - if (p->type == bfd_section_reloc_link_order) - { - r_extern = 0; - if (bfd_is_abs_section (pr->u.section)) - r_index = N_ABS | N_EXT; - else - { - BFD_ASSERT (pr->u.section->owner == finfo->output_bfd); - r_index = pr->u.section->target_index; - } - } - else - { - struct aout_link_hash_entry *h; - - BFD_ASSERT (p->type == bfd_symbol_reloc_link_order); - r_extern = 1; - h = ((struct aout_link_hash_entry *) - bfd_wrapped_link_hash_lookup (finfo->output_bfd, finfo->info, - pr->u.name, false, false, true)); - if (h != (struct aout_link_hash_entry *) NULL - && h->indx >= 0) - r_index = h->indx; - else if (h != NULL) - { - /* We decided to strip this symbol, but it turns out that we - can't. Note that we lose the other and desc information - here. I don't think that will ever matter for a global - symbol. */ - h->indx = -2; - h->written = false; - if (! aout_link_write_other_symbol (h, (PTR) finfo)) - return false; - r_index = h->indx; - } - else - { - if (! ((*finfo->info->callbacks->unattached_reloc) - (finfo->info, pr->u.name, (bfd *) NULL, - (asection *) NULL, (bfd_vma) 0))) - return false; - r_index = 0; - } - } - - howto = bfd_reloc_type_lookup (finfo->output_bfd, pr->reloc); - if (howto == 0) - { - bfd_set_error (bfd_error_bad_value); - return false; - } - - if (o == obj_textsec (finfo->output_bfd)) - reloff_ptr = &finfo->treloff; - else if (o == obj_datasec (finfo->output_bfd)) - reloff_ptr = &finfo->dreloff; - else - abort (); - - if (obj_reloc_entry_size (finfo->output_bfd) == RELOC_STD_SIZE) - { -#ifdef MY_put_reloc - MY_put_reloc(finfo->output_bfd, r_extern, r_index, p->offset, howto, - &srel); -#else - { - int r_pcrel; - int r_baserel; - int r_jmptable; - int r_relative; - int r_length; - - r_pcrel = howto->pc_relative; - r_baserel = (howto->type & 8) != 0; - r_jmptable = (howto->type & 16) != 0; - r_relative = (howto->type & 32) != 0; - r_length = howto->size; - - PUT_WORD (finfo->output_bfd, p->offset, srel.r_address); - if (bfd_header_big_endian (finfo->output_bfd)) - { - srel.r_index[0] = r_index >> 16; - srel.r_index[1] = r_index >> 8; - srel.r_index[2] = r_index; - srel.r_type[0] = - ((r_extern ? RELOC_STD_BITS_EXTERN_BIG : 0) - | (r_pcrel ? RELOC_STD_BITS_PCREL_BIG : 0) - | (r_baserel ? RELOC_STD_BITS_BASEREL_BIG : 0) - | (r_jmptable ? RELOC_STD_BITS_JMPTABLE_BIG : 0) - | (r_relative ? RELOC_STD_BITS_RELATIVE_BIG : 0) - | (r_length << RELOC_STD_BITS_LENGTH_SH_BIG)); - } - else - { - srel.r_index[2] = r_index >> 16; - srel.r_index[1] = r_index >> 8; - srel.r_index[0] = r_index; - srel.r_type[0] = - ((r_extern ? RELOC_STD_BITS_EXTERN_LITTLE : 0) - | (r_pcrel ? RELOC_STD_BITS_PCREL_LITTLE : 0) - | (r_baserel ? RELOC_STD_BITS_BASEREL_LITTLE : 0) - | (r_jmptable ? RELOC_STD_BITS_JMPTABLE_LITTLE : 0) - | (r_relative ? RELOC_STD_BITS_RELATIVE_LITTLE : 0) - | (r_length << RELOC_STD_BITS_LENGTH_SH_LITTLE)); - } - } -#endif - rel_ptr = (PTR) &srel; - - /* We have to write the addend into the object file, since - standard a.out relocs are in place. It would be more - reliable if we had the current contents of the file here, - rather than assuming zeroes, but we can't read the file since - it was opened using bfd_openw. */ - if (pr->addend != 0) - { - bfd_size_type size; - bfd_reloc_status_type r; - bfd_byte *buf; - boolean ok; - - size = bfd_get_reloc_size (howto); - buf = (bfd_byte *) bfd_zmalloc (size); - if (buf == (bfd_byte *) NULL) - return false; - r = MY_relocate_contents (howto, finfo->output_bfd, - pr->addend, buf); - switch (r) - { - case bfd_reloc_ok: - break; - default: - case bfd_reloc_outofrange: - abort (); - case bfd_reloc_overflow: - if (! ((*finfo->info->callbacks->reloc_overflow) - (finfo->info, - (p->type == bfd_section_reloc_link_order - ? bfd_section_name (finfo->output_bfd, - pr->u.section) - : pr->u.name), - howto->name, pr->addend, (bfd *) NULL, - (asection *) NULL, (bfd_vma) 0))) - { - free (buf); - return false; - } - break; - } - ok = bfd_set_section_contents (finfo->output_bfd, o, - (PTR) buf, - (file_ptr) p->offset, - size); - free (buf); - if (! ok) - return false; - } - } - else - { - PUT_WORD (finfo->output_bfd, p->offset, erel.r_address); - - if (bfd_header_big_endian (finfo->output_bfd)) - { - erel.r_index[0] = r_index >> 16; - erel.r_index[1] = r_index >> 8; - erel.r_index[2] = r_index; - erel.r_type[0] = - ((r_extern ? RELOC_EXT_BITS_EXTERN_BIG : 0) - | (howto->type << RELOC_EXT_BITS_TYPE_SH_BIG)); - } - else - { - erel.r_index[2] = r_index >> 16; - erel.r_index[1] = r_index >> 8; - erel.r_index[0] = r_index; - erel.r_type[0] = - (r_extern ? RELOC_EXT_BITS_EXTERN_LITTLE : 0) - | (howto->type << RELOC_EXT_BITS_TYPE_SH_LITTLE); - } - - PUT_WORD (finfo->output_bfd, pr->addend, erel.r_addend); - - rel_ptr = (PTR) &erel; - } - - if (bfd_seek (finfo->output_bfd, *reloff_ptr, SEEK_SET) != 0 - || (bfd_write (rel_ptr, (bfd_size_type) 1, - obj_reloc_entry_size (finfo->output_bfd), - finfo->output_bfd) - != obj_reloc_entry_size (finfo->output_bfd))) - return false; - - *reloff_ptr += obj_reloc_entry_size (finfo->output_bfd); - - /* Assert that the relocs have not run into the symbols, and that n - the text relocs have not run into the data relocs. */ - BFD_ASSERT (*reloff_ptr <= obj_sym_filepos (finfo->output_bfd) - && (reloff_ptr != &finfo->treloff - || (*reloff_ptr - <= obj_datasec (finfo->output_bfd)->rel_filepos))); - - return true; -} diff --git a/contrib/gdb/bfd/archive.c b/contrib/gdb/bfd/archive.c deleted file mode 100644 index 248b918..0000000 --- a/contrib/gdb/bfd/archive.c +++ /dev/null @@ -1,2094 +0,0 @@ -/* BFD back-end for archive files (libraries). - Copyright 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. - Written by Cygnus Support. Mostly Gumby Henkel-Wallace's fault. - -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. */ - -/* -@setfilename archive-info -SECTION - Archives - -DESCRIPTION - An archive (or library) is just another BFD. It has a symbol - table, although there's not much a user program will do with it. - - The big difference between an archive BFD and an ordinary BFD - is that the archive doesn't have sections. Instead it has a - chain of BFDs that are considered its contents. These BFDs can - be manipulated like any other. The BFDs contained in an - archive opened for reading will all be opened for reading. You - may put either input or output BFDs into an archive opened for - output; they will be handled correctly when the archive is closed. - - Use <> to step through - the contents of an archive opened for input. You don't - have to read the entire archive if you don't want - to! Read it until you find what you want. - - Archive contents of output BFDs are chained through the - <> pointer in a BFD. The first one is findable through - the <> slot of the archive. Set it with - <> (q.v.). A given BFD may be in only one - open output archive at a time. - - As expected, the BFD archive code is more general than the - archive code of any given environment. BFD archives may - contain files of different formats (e.g., a.out and coff) and - even different architectures. You may even place archives - recursively into archives! - - This can cause unexpected confusion, since some archive - formats are more expressive than others. For instance, Intel - COFF archives can preserve long filenames; SunOS a.out archives - cannot. If you move a file from the first to the second - format and back again, the filename may be truncated. - Likewise, different a.out environments have different - conventions as to how they truncate filenames, whether they - preserve directory names in filenames, etc. When - interoperating with native tools, be sure your files are - homogeneous. - - Beware: most of these formats do not react well to the - presence of spaces in filenames. We do the best we can, but - can't always handle this case due to restrictions in the format of - archives. Many Unix utilities are braindead in regards to - spaces and such in filenames anyway, so this shouldn't be much - of a restriction. - - Archives are supported in BFD in <>. - -*/ - -/* Assumes: - o - all archive elements start on an even boundary, newline padded; - o - all arch headers are char *; - o - all arch headers are the same size (across architectures). -*/ - -/* Some formats provide a way to cram a long filename into the short - (16 chars) space provided by a BSD archive. The trick is: make a - special "file" in the front of the archive, sort of like the SYMDEF - entry. If the filename is too long to fit, put it in the extended - name table, and use its index as the filename. To prevent - confusion prepend the index with a space. This means you can't - have filenames that start with a space, but then again, many Unix - utilities can't handle that anyway. - - This scheme unfortunately requires that you stand on your head in - order to write an archive since you need to put a magic file at the - front, and need to touch every entry to do so. C'est la vie. - - We support two variants of this idea: - The SVR4 format (extended name table is named "//"), - and an extended pseudo-BSD variant (extended name table is named - "ARFILENAMES/"). The origin of the latter format is uncertain. - - BSD 4.4 uses a third scheme: It writes a long filename - directly after the header. This allows 'ar q' to work. - We currently can read BSD 4.4 archives, but not write them. -*/ - -/* Summary of archive member names: - - Symbol table (must be first): - "__.SYMDEF " - Symbol table, Berkeley style, produced by ranlib. - "/ " - Symbol table, system 5 style. - - Long name table (must be before regular file members): - "// " - Long name table, System 5 R4 style. - "ARFILENAMES/ " - Long name table, non-standard extended BSD (not BSD 4.4). - - Regular file members with short names: - "filename.o/ " - Regular file, System 5 style (embedded spaces ok). - "filename.o " - Regular file, Berkeley style (no embedded spaces). - - Regular files with long names (or embedded spaces, for BSD variants): - "/18 " - SVR4 style, name at offset 18 in name table. - "#1/23 " - Long name (or embedded paces) 23 characters long, - BSD 4.4 style, full name follows header. - Implemented for reading, not writing. - " 18 " - Long name 18 characters long, extended pseudo-BSD. - */ - -#include "bfd.h" -#include "sysdep.h" -#include "libbfd.h" -#include "aout/ar.h" -#include "aout/ranlib.h" -#include -#include /* For memchr, strrchr and friends */ -#include - -#ifndef errno -extern int errno; -#endif - -#ifdef GNU960 -#define BFD_GNU960_ARMAG(abfd) (BFD_COFF_FILE_P((abfd)) ? ARMAG : ARMAGB) -#endif - -/* Can't define this in hosts/foo.h, because (e.g. in gprof) the hosts file - is included, then obstack.h, which thinks if offsetof is defined, it - doesn't need to include stddef.h. */ -/* Define offsetof for those systems which lack it */ - -#if !defined (offsetof) -#define offsetof(TYPE, MEMBER) ((unsigned long) &((TYPE *)0)->MEMBER) -#endif - -/* We keep a cache of archive filepointers to archive elements to - speed up searching the archive by filepos. We only add an entry to - the cache when we actually read one. We also don't sort the cache; - it's generally short enough to search linearly. - Note that the pointers here point to the front of the ar_hdr, not - to the front of the contents! -*/ -struct ar_cache -{ - file_ptr ptr; - bfd *arelt; - struct ar_cache *next; -}; - -#define ar_padchar(abfd) ((abfd)->xvec->ar_pad_char) -#define ar_maxnamelen(abfd) ((abfd)->xvec->ar_max_namelen) - -#define arch_eltdata(bfd) ((struct areltdata *)((bfd)->arelt_data)) -#define arch_hdr(bfd) ((struct ar_hdr *)arch_eltdata(bfd)->arch_header) - -static char *get_extended_arelt_filename PARAMS ((bfd *arch, - const char *name)); -static boolean do_slurp_bsd_armap PARAMS ((bfd *abfd)); -static boolean do_slurp_coff_armap PARAMS ((bfd *abfd)); -static const char *normalize PARAMS ((bfd *, const char *file)); -static struct areltdata *bfd_ar_hdr_from_filesystem PARAMS ((bfd *abfd, - const char *)); - -boolean -_bfd_generic_mkarchive (abfd) - bfd *abfd; -{ - abfd->tdata.aout_ar_data = ((struct artdata *) - bfd_zalloc (abfd, sizeof (struct artdata))); - - if (bfd_ardata (abfd) == NULL) - return false; - - bfd_ardata (abfd)->cache = NULL; - bfd_ardata (abfd)->archive_head = NULL; - bfd_ardata (abfd)->symdefs = NULL; - bfd_ardata (abfd)->extended_names = NULL; - bfd_ardata (abfd)->tdata = NULL; - - return true; -} - -/* -FUNCTION - bfd_get_next_mapent - -SYNOPSIS - symindex bfd_get_next_mapent(bfd *abfd, symindex previous, carsym **sym); - -DESCRIPTION - Step through archive @var{abfd}'s symbol table (if it - has one). Successively update @var{sym} with the next symbol's - information, returning that symbol's (internal) index into the - symbol table. - - Supply <> as the @var{previous} entry to get - the first one; returns <> when you've already - got the last one. - - A <> is a canonical archive symbol. The only - user-visible element is its name, a null-terminated string. -*/ - -symindex -bfd_get_next_mapent (abfd, prev, entry) - bfd *abfd; - symindex prev; - carsym **entry; -{ - if (!bfd_has_map (abfd)) - { - bfd_set_error (bfd_error_invalid_operation); - return BFD_NO_MORE_SYMBOLS; - } - - if (prev == BFD_NO_MORE_SYMBOLS) - prev = 0; - else - ++prev; - if (prev >= bfd_ardata (abfd)->symdef_count) - return BFD_NO_MORE_SYMBOLS; - - *entry = (bfd_ardata (abfd)->symdefs + prev); - return prev; -} - -/* To be called by backends only */ - -bfd * -_bfd_create_empty_archive_element_shell (obfd) - bfd *obfd; -{ - return _bfd_new_bfd_contained_in (obfd); -} - -/* -FUNCTION - bfd_set_archive_head - -SYNOPSIS - boolean bfd_set_archive_head(bfd *output, bfd *new_head); - -DESCRIPTION - Set the head of the chain of - BFDs contained in the archive @var{output} to @var{new_head}. -*/ - -boolean -bfd_set_archive_head (output_archive, new_head) - bfd *output_archive; - bfd *new_head; -{ - - output_archive->archive_head = new_head; - return true; -} - -bfd * -_bfd_look_for_bfd_in_cache (arch_bfd, filepos) - bfd *arch_bfd; - file_ptr filepos; -{ - struct ar_cache *current; - - for (current = bfd_ardata (arch_bfd)->cache; current != NULL; - current = current->next) - if (current->ptr == filepos) - return current->arelt; - - return NULL; -} - -/* Kind of stupid to call cons for each one, but we don't do too many */ -boolean -_bfd_add_bfd_to_archive_cache (arch_bfd, filepos, new_elt) - bfd *arch_bfd, *new_elt; - file_ptr filepos; -{ - struct ar_cache *new_cache = ((struct ar_cache *) - bfd_zalloc (arch_bfd, - sizeof (struct ar_cache))); - - if (new_cache == NULL) - return false; - - new_cache->ptr = filepos; - new_cache->arelt = new_elt; - new_cache->next = (struct ar_cache *) NULL; - if (bfd_ardata (arch_bfd)->cache == NULL) - bfd_ardata (arch_bfd)->cache = new_cache; - else - { - struct ar_cache *current = bfd_ardata (arch_bfd)->cache; - - while (current->next != NULL) - current = current->next; - current->next = new_cache; - } - - return true; -} - -/* The name begins with space. Hence the rest of the name is an index into - the string table. */ - -static char * -get_extended_arelt_filename (arch, name) - bfd *arch; - const char *name; -{ - unsigned long index = 0; - - /* Should extract string so that I can guarantee not to overflow into - the next region, but I'm too lazy. */ - errno = 0; - /* Skip first char, which is '/' in SVR4 or ' ' in some other variants. */ - index = strtol (name + 1, NULL, 10); - if (errno != 0) - { - bfd_set_error (bfd_error_malformed_archive); - return NULL; - } - - return bfd_ardata (arch)->extended_names + index; -} - -/* This functions reads an arch header and returns an areltdata pointer, or - NULL on error. - - Presumes the file pointer is already in the right place (ie pointing - to the ar_hdr in the file). Moves the file pointer; on success it - should be pointing to the front of the file contents; on failure it - could have been moved arbitrarily. -*/ - -PTR -_bfd_generic_read_ar_hdr (abfd) - bfd *abfd; -{ - return _bfd_generic_read_ar_hdr_mag (abfd, (const char *) NULL); -} - -/* Alpha ECOFF uses an optional different ARFMAG value, so we have a - variant of _bfd_generic_read_ar_hdr which accepts a magic string. */ - -PTR -_bfd_generic_read_ar_hdr_mag (abfd, mag) - bfd *abfd; - const char *mag; -{ - struct ar_hdr hdr; - char *hdrp = (char *) &hdr; - unsigned int parsed_size; - struct areltdata *ared; - char *filename = NULL; - unsigned int namelen = 0; - unsigned int allocsize = sizeof (struct areltdata) + sizeof (struct ar_hdr); - char *allocptr = 0; - - if (bfd_read ((PTR) hdrp, 1, sizeof (struct ar_hdr), abfd) - != sizeof (struct ar_hdr)) - { - if (bfd_get_error () != bfd_error_system_call) - bfd_set_error (bfd_error_no_more_archived_files); - return NULL; - } - if (strncmp (hdr.ar_fmag, ARFMAG, 2) != 0 - && (mag == NULL - || strncmp (hdr.ar_fmag, mag, 2) != 0)) - { - bfd_set_error (bfd_error_malformed_archive); - return NULL; - } - - errno = 0; - parsed_size = strtol (hdr.ar_size, NULL, 10); - if (errno != 0) - { - bfd_set_error (bfd_error_malformed_archive); - return NULL; - } - - /* Extract the filename from the archive - there are two ways to - specify an extendend name table, either the first char of the - name is a space, or it's a slash. */ - if ((hdr.ar_name[0] == '/' - || (hdr.ar_name[0] == ' ' - && memchr (hdr.ar_name, '/', ar_maxnamelen (abfd)) == NULL)) - && bfd_ardata (abfd)->extended_names != NULL) - { - filename = get_extended_arelt_filename (abfd, hdr.ar_name); - if (filename == NULL) - { - bfd_set_error (bfd_error_malformed_archive); - return NULL; - } - } - /* BSD4.4-style long filename. - Only implemented for reading, so far! */ - else if (hdr.ar_name[0] == '#' && hdr.ar_name[1] == '1' - && hdr.ar_name[2] == '/' && isdigit (hdr.ar_name[3])) - { - /* BSD-4.4 extended name */ - namelen = atoi (&hdr.ar_name[3]); - allocsize += namelen + 1; - parsed_size -= namelen; - - allocptr = bfd_zalloc (abfd, allocsize); - if (allocptr == NULL) - return NULL; - filename = (allocptr - + sizeof (struct areltdata) - + sizeof (struct ar_hdr)); - if (bfd_read (filename, 1, namelen, abfd) != namelen) - { - if (bfd_get_error () != bfd_error_system_call) - bfd_set_error (bfd_error_no_more_archived_files); - return NULL; - } - filename[namelen] = '\0'; - } - else - { - /* We judge the end of the name by looking for '/' or ' '. - Note: The SYSV format (terminated by '/') allows embedded - spaces, so only look for ' ' if we don't find '/'. */ - - namelen = 0; - while (hdr.ar_name[namelen] != '\0' && - hdr.ar_name[namelen] != '/') - { - namelen++; - if (namelen == (unsigned) ar_maxnamelen (abfd)) - { - namelen = 0; - while (hdr.ar_name[namelen] != ' ' - && namelen < (unsigned) ar_maxnamelen (abfd)) - namelen++; - break; - } - } - - allocsize += namelen + 1; - } - - if (!allocptr) - { - allocptr = bfd_zalloc (abfd, allocsize); - if (allocptr == NULL) - return NULL; - } - - ared = (struct areltdata *) allocptr; - - ared->arch_header = allocptr + sizeof (struct areltdata); - memcpy ((char *) ared->arch_header, (char *) &hdr, sizeof (struct ar_hdr)); - ared->parsed_size = parsed_size; - - if (filename != NULL) - ared->filename = filename; - else - { - ared->filename = allocptr + (sizeof (struct areltdata) + - sizeof (struct ar_hdr)); - if (namelen) - memcpy (ared->filename, hdr.ar_name, namelen); - ared->filename[namelen] = '\0'; - } - - return (PTR) ared; -} - -/* This is an internal function; it's mainly used when indexing - through the archive symbol table, but also used to get the next - element, since it handles the bookkeeping so nicely for us. */ - -bfd * -_bfd_get_elt_at_filepos (archive, filepos) - bfd *archive; - file_ptr filepos; -{ - struct areltdata *new_areldata; - bfd *n_nfd; - - n_nfd = _bfd_look_for_bfd_in_cache (archive, filepos); - if (n_nfd) - return n_nfd; - - if (0 > bfd_seek (archive, filepos, SEEK_SET)) - return NULL; - - if ((new_areldata = (struct areltdata *) _bfd_read_ar_hdr (archive)) == NULL) - return NULL; - - n_nfd = _bfd_create_empty_archive_element_shell (archive); - if (n_nfd == NULL) - { - bfd_release (archive, (PTR) new_areldata); - return NULL; - } - - n_nfd->origin = bfd_tell (archive); - n_nfd->arelt_data = (PTR) new_areldata; - n_nfd->filename = new_areldata->filename; - - if (_bfd_add_bfd_to_archive_cache (archive, filepos, n_nfd)) - return n_nfd; - - /* huh? */ - bfd_release (archive, (PTR) n_nfd); - bfd_release (archive, (PTR) new_areldata); - return NULL; -} - -/* Return the BFD which is referenced by the symbol in ABFD indexed by - INDEX. INDEX should have been returned by bfd_get_next_mapent. */ - -bfd * -_bfd_generic_get_elt_at_index (abfd, index) - bfd *abfd; - symindex index; -{ - carsym *entry; - - entry = bfd_ardata (abfd)->symdefs + index; - return _bfd_get_elt_at_filepos (abfd, entry->file_offset); -} - -/* -FUNCTION - bfd_openr_next_archived_file - -SYNOPSIS - bfd *bfd_openr_next_archived_file(bfd *archive, bfd *previous); - -DESCRIPTION - Provided a BFD, @var{archive}, containing an archive and NULL, open - an input BFD on the first contained element and returns that. - Subsequent calls should pass - the archive and the previous return value to return a created - BFD to the next contained element. NULL is returned when there - are no more. - -*/ - -bfd * -bfd_openr_next_archived_file (archive, last_file) - bfd *archive; - bfd *last_file; -{ - if ((bfd_get_format (archive) != bfd_archive) || - (archive->direction == write_direction)) - { - bfd_set_error (bfd_error_invalid_operation); - return NULL; - } - - return BFD_SEND (archive, - openr_next_archived_file, - (archive, - last_file)); -} - -bfd * -bfd_generic_openr_next_archived_file (archive, last_file) - bfd *archive; - bfd *last_file; -{ - file_ptr filestart; - - if (!last_file) - filestart = bfd_ardata (archive)->first_file_filepos; - else - { - unsigned int size = arelt_size (last_file); - /* Pad to an even boundary... - Note that last_file->origin can be odd in the case of - BSD-4.4-style element with a long odd size. */ - filestart = last_file->origin + size; - filestart += filestart % 2; - } - - return _bfd_get_elt_at_filepos (archive, filestart); -} - - -const bfd_target * -bfd_generic_archive_p (abfd) - bfd *abfd; -{ - struct artdata *tdata_hold; - char armag[SARMAG + 1]; - - tdata_hold = abfd->tdata.aout_ar_data; - - if (bfd_read ((PTR) armag, 1, SARMAG, abfd) != SARMAG) - { - if (bfd_get_error () != bfd_error_system_call) - bfd_set_error (bfd_error_wrong_format); - return NULL; - } - -#ifdef GNU960 - if (strncmp (armag, BFD_GNU960_ARMAG (abfd), SARMAG) != 0) - return 0; -#else - if (strncmp (armag, ARMAG, SARMAG) != 0 && - strncmp (armag, ARMAGB, SARMAG) != 0) - return 0; -#endif - - /* We are setting bfd_ardata(abfd) here, but since bfd_ardata - involves a cast, we can't do it as the left operand of assignment. */ - abfd->tdata.aout_ar_data = ((struct artdata *) - bfd_zalloc (abfd, sizeof (struct artdata))); - - if (bfd_ardata (abfd) == NULL) - return NULL; - - bfd_ardata (abfd)->first_file_filepos = SARMAG; - bfd_ardata (abfd)->cache = NULL; - bfd_ardata (abfd)->archive_head = NULL; - bfd_ardata (abfd)->symdefs = NULL; - bfd_ardata (abfd)->extended_names = NULL; - bfd_ardata (abfd)->tdata = NULL; - - if (!BFD_SEND (abfd, _bfd_slurp_armap, (abfd))) - { - bfd_release (abfd, bfd_ardata (abfd)); - abfd->tdata.aout_ar_data = tdata_hold; - return NULL; - } - - if (!BFD_SEND (abfd, _bfd_slurp_extended_name_table, (abfd))) - { - bfd_release (abfd, bfd_ardata (abfd)); - abfd->tdata.aout_ar_data = tdata_hold; - return NULL; - } - - if (bfd_has_map (abfd)) - { - bfd *first; - - /* This archive has a map, so we may presume that the contents - are object files. Make sure that if the first file in the - archive can be recognized as an object file, it is for this - target. If not, assume that this is the wrong format. If - the first file is not an object file, somebody is doing - something weird, and we permit it so that ar -t will work. - - This is done because any normal format will recognize any - normal archive, regardless of the format of the object files. - We do accept an empty archive. */ - - first = bfd_openr_next_archived_file (abfd, (bfd *) NULL); - if (first != NULL) - { - boolean fail; - - first->target_defaulted = false; - fail = false; - if (bfd_check_format (first, bfd_object) - && first->xvec != abfd->xvec) - { - (void) bfd_close (first); - bfd_release (abfd, bfd_ardata (abfd)); - abfd->tdata.aout_ar_data = tdata_hold; - bfd_set_error (bfd_error_wrong_format); - return NULL; - } - - /* We ought to close first here, but we can't, because we - have no way to remove it from the archive cache. FIXME. */ - } - } - - return abfd->xvec; -} - -/* Some constants for a 32 bit BSD archive structure. We do not - support 64 bit archives presently; so far as I know, none actually - exist. Supporting them would require changing these constants, and - changing some bfd_h_get_32 to bfd_h_get_64. */ - -/* The size of an external symdef structure. */ -#define BSD_SYMDEF_SIZE 8 - -/* The offset from the start of a symdef structure to the file offset. */ -#define BSD_SYMDEF_OFFSET_SIZE 4 - -/* The size of the symdef count. */ -#define BSD_SYMDEF_COUNT_SIZE 4 - -/* The size of the string count. */ -#define BSD_STRING_COUNT_SIZE 4 - -/* Returns false on error, true otherwise */ - -static boolean -do_slurp_bsd_armap (abfd) - bfd *abfd; -{ - struct areltdata *mapdata; - unsigned int counter; - bfd_byte *raw_armap, *rbase; - struct artdata *ardata = bfd_ardata (abfd); - char *stringbase; - unsigned int parsed_size; - carsym *set; - - mapdata = (struct areltdata *) _bfd_read_ar_hdr (abfd); - if (mapdata == NULL) - return false; - parsed_size = mapdata->parsed_size; - bfd_release (abfd, (PTR) mapdata); /* Don't need it any more. */ - - raw_armap = (bfd_byte *) bfd_zalloc (abfd, parsed_size); - if (raw_armap == (bfd_byte *) NULL) - return false; - - if (bfd_read ((PTR) raw_armap, 1, parsed_size, abfd) != parsed_size) - { - if (bfd_get_error () != bfd_error_system_call) - bfd_set_error (bfd_error_malformed_archive); - byebye: - bfd_release (abfd, (PTR) raw_armap); - return false; - } - - ardata->symdef_count = bfd_h_get_32 (abfd, raw_armap) / BSD_SYMDEF_SIZE; - - if (ardata->symdef_count * BSD_SYMDEF_SIZE > - parsed_size - BSD_SYMDEF_COUNT_SIZE) - { - /* Probably we're using the wrong byte ordering. */ - bfd_set_error (bfd_error_wrong_format); - goto byebye; - } - - ardata->cache = 0; - rbase = raw_armap + BSD_SYMDEF_COUNT_SIZE; - stringbase = ((char *) rbase - + ardata->symdef_count * BSD_SYMDEF_SIZE - + BSD_STRING_COUNT_SIZE); - ardata->symdefs = (carsym *) bfd_alloc (abfd, - (ardata->symdef_count - * sizeof (carsym))); - if (!ardata->symdefs) - return false; - - for (counter = 0, set = ardata->symdefs; - counter < ardata->symdef_count; - counter++, set++, rbase += BSD_SYMDEF_SIZE) - { - set->name = bfd_h_get_32 (abfd, rbase) + stringbase; - set->file_offset = bfd_h_get_32 (abfd, rbase + BSD_SYMDEF_OFFSET_SIZE); - } - - ardata->first_file_filepos = bfd_tell (abfd); - /* Pad to an even boundary if you have to */ - ardata->first_file_filepos += (ardata->first_file_filepos) % 2; - /* FIXME, we should provide some way to free raw_ardata when - we are done using the strings from it. For now, it seems - to be allocated on an obstack anyway... */ - bfd_has_map (abfd) = true; - return true; -} - -/* Returns false on error, true otherwise */ -static boolean -do_slurp_coff_armap (abfd) - bfd *abfd; -{ - struct areltdata *mapdata; - int *raw_armap, *rawptr; - struct artdata *ardata = bfd_ardata (abfd); - char *stringbase; - unsigned int stringsize; - unsigned int parsed_size; - carsym *carsyms; - unsigned int nsymz; /* Number of symbols in armap. */ - bfd_vma (*swap) PARAMS ((const bfd_byte *)); - char int_buf[sizeof (long)]; - unsigned int carsym_size, ptrsize, i; - - mapdata = (struct areltdata *) _bfd_read_ar_hdr (abfd); - if (mapdata == NULL) - return false; - parsed_size = mapdata->parsed_size; - bfd_release (abfd, (PTR) mapdata); /* Don't need it any more. */ - - if (bfd_read ((PTR) int_buf, 1, 4, abfd) != 4) - { - if (bfd_get_error () != bfd_error_system_call) - bfd_set_error (bfd_error_malformed_archive); - return false; - } - /* It seems that all numeric information in a coff archive is always - in big endian format, nomatter the host or target. */ - swap = bfd_getb32; - nsymz = bfd_getb32 ((PTR) int_buf); - stringsize = parsed_size - (4 * nsymz) - 4; - -#if 1 - /* ... except that some archive formats are broken, and it may be our - fault - the i960 little endian coff sometimes has big and sometimes - little, because our tools changed. Here's a horrible hack to clean - up the crap. */ - - if (stringsize > 0xfffff) - { - /* This looks dangerous, let's do it the other way around */ - nsymz = bfd_getl32 ((PTR) int_buf); - stringsize = parsed_size - (4 * nsymz) - 4; - swap = bfd_getl32; - } -#endif - - /* The coff armap must be read sequentially. So we construct a - bsd-style one in core all at once, for simplicity. */ - - carsym_size = (nsymz * sizeof (carsym)); - ptrsize = (4 * nsymz); - - ardata->symdefs = (carsym *) bfd_zalloc (abfd, carsym_size + stringsize + 1); - if (ardata->symdefs == NULL) - return false; - carsyms = ardata->symdefs; - stringbase = ((char *) ardata->symdefs) + carsym_size; - - /* Allocate and read in the raw offsets. */ - raw_armap = (int *) bfd_alloc (abfd, ptrsize); - if (raw_armap == NULL) - goto release_symdefs; - if (bfd_read ((PTR) raw_armap, 1, ptrsize, abfd) != ptrsize - || bfd_read ((PTR) stringbase, 1, stringsize, abfd) != stringsize) - { - if (bfd_get_error () != bfd_error_system_call) - bfd_set_error (bfd_error_malformed_archive); - goto release_raw_armap; - } - - /* OK, build the carsyms */ - for (i = 0; i < nsymz; i++) - { - rawptr = raw_armap + i; - carsyms->file_offset = swap ((PTR) rawptr); - carsyms->name = stringbase; - stringbase += strlen (stringbase) + 1; - carsyms++; - } - *stringbase = 0; - - ardata->symdef_count = nsymz; - ardata->first_file_filepos = bfd_tell (abfd); - /* Pad to an even boundary if you have to */ - ardata->first_file_filepos += (ardata->first_file_filepos) % 2; - - - bfd_has_map (abfd) = true; - bfd_release (abfd, (PTR) raw_armap); - - - /* Check for a second archive header (as used by PE) */ - { - struct areltdata *tmp; - - bfd_seek (abfd, ardata->first_file_filepos, SEEK_SET); - tmp = (struct areltdata *) _bfd_read_ar_hdr (abfd); - if (tmp != NULL) - { - if (tmp->arch_header[0] == '/' - && tmp->arch_header[1] == ' ') - { - ardata->first_file_filepos += - (tmp->parsed_size + sizeof(struct ar_hdr) + 1) & ~1; - } - bfd_release (abfd, tmp); - } - } - - return true; - -release_raw_armap: - bfd_release (abfd, (PTR) raw_armap); -release_symdefs: - bfd_release (abfd, (PTR) (ardata)->symdefs); - return false; -} - -/* This routine can handle either coff-style or bsd-style armaps. - Returns false on error, true otherwise */ - -boolean -bfd_slurp_armap (abfd) - bfd *abfd; -{ - char nextname[17]; - int i = bfd_read ((PTR) nextname, 1, 16, abfd); - - if (i == 0) - return true; - if (i != 16) - return false; - - if (bfd_seek (abfd, (file_ptr) - 16, SEEK_CUR) != 0) - return false; - - if (!strncmp (nextname, "__.SYMDEF ", 16) - || !strncmp (nextname, "__.SYMDEF/ ", 16)) /* old Linux archives */ - return do_slurp_bsd_armap (abfd); - else if (!strncmp (nextname, "/ ", 16)) - return do_slurp_coff_armap (abfd); - - bfd_has_map (abfd) = false; - return true; -} - -/* Returns false on error, true otherwise */ -/* flavor 2 of a bsd armap, similar to bfd_slurp_bsd_armap except the - header is in a slightly different order and the map name is '/'. - This flavour is used by hp300hpux. */ - -#define HPUX_SYMDEF_COUNT_SIZE 2 - -boolean -bfd_slurp_bsd_armap_f2 (abfd) - bfd *abfd; -{ - struct areltdata *mapdata; - char nextname[17]; - unsigned int counter; - bfd_byte *raw_armap, *rbase; - struct artdata *ardata = bfd_ardata (abfd); - char *stringbase; - unsigned int stringsize; - carsym *set; - int i = bfd_read ((PTR) nextname, 1, 16, abfd); - - if (i == 0) - return true; - if (i != 16) - return false; - - /* The archive has at least 16 bytes in it */ - if (bfd_seek (abfd, -16L, SEEK_CUR) != 0) - return false; - - if (!strncmp (nextname, "__.SYMDEF ", 16) - || !strncmp (nextname, "__.SYMDEF/ ", 16)) /* old Linux archives */ - return do_slurp_bsd_armap (abfd); - - if (strncmp (nextname, "/ ", 16)) - { - bfd_has_map (abfd) = false; - return true; - } - - mapdata = (struct areltdata *) _bfd_read_ar_hdr (abfd); - if (mapdata == NULL) - return false; - - raw_armap = (bfd_byte *) bfd_zalloc (abfd, mapdata->parsed_size); - if (raw_armap == NULL) - { - byebye: - bfd_release (abfd, (PTR) mapdata); - return false; - } - - if (bfd_read ((PTR) raw_armap, 1, mapdata->parsed_size, abfd) != - mapdata->parsed_size) - { - if (bfd_get_error () != bfd_error_system_call) - bfd_set_error (bfd_error_malformed_archive); - byebyebye: - bfd_release (abfd, (PTR) raw_armap); - goto byebye; - } - - ardata->symdef_count = bfd_h_get_16 (abfd, (PTR) raw_armap); - - if (ardata->symdef_count * BSD_SYMDEF_SIZE - > mapdata->parsed_size - HPUX_SYMDEF_COUNT_SIZE) - { - /* Probably we're using the wrong byte ordering. */ - bfd_set_error (bfd_error_wrong_format); - goto byebyebye; - } - - ardata->cache = 0; - - stringsize = bfd_h_get_32 (abfd, raw_armap + HPUX_SYMDEF_COUNT_SIZE); - /* skip sym count and string sz */ - stringbase = ((char *) raw_armap - + HPUX_SYMDEF_COUNT_SIZE - + BSD_STRING_COUNT_SIZE); - rbase = (bfd_byte *) stringbase + stringsize; - ardata->symdefs = (carsym *) bfd_alloc (abfd, - (ardata->symdef_count - * BSD_SYMDEF_SIZE)); - if (!ardata->symdefs) - return false; - - for (counter = 0, set = ardata->symdefs; - counter < ardata->symdef_count; - counter++, set++, rbase += BSD_SYMDEF_SIZE) - { - set->name = bfd_h_get_32 (abfd, rbase) + stringbase; - set->file_offset = bfd_h_get_32 (abfd, rbase + BSD_SYMDEF_OFFSET_SIZE); - } - - ardata->first_file_filepos = bfd_tell (abfd); - /* Pad to an even boundary if you have to */ - ardata->first_file_filepos += (ardata->first_file_filepos) % 2; - /* FIXME, we should provide some way to free raw_ardata when - we are done using the strings from it. For now, it seems - to be allocated on an obstack anyway... */ - bfd_has_map (abfd) = true; - return true; -} - -/** Extended name table. - - Normally archives support only 14-character filenames. - - Intel has extended the format: longer names are stored in a special - element (the first in the archive, or second if there is an armap); - the name in the ar_hdr is replaced by . Index is the P.R. of an int (decimal). Data General have - extended the format by using the prefix // for the special element */ - -/* Returns false on error, true otherwise */ -boolean -_bfd_slurp_extended_name_table (abfd) - bfd *abfd; -{ - char nextname[17]; - struct areltdata *namedata; - - /* FIXME: Formatting sucks here, and in case of failure of BFD_READ, - we probably don't want to return true. */ - bfd_seek (abfd, bfd_ardata (abfd)->first_file_filepos, SEEK_SET); - if (bfd_read ((PTR) nextname, 1, 16, abfd) == 16) - { - if (bfd_seek (abfd, (file_ptr) - 16, SEEK_CUR) != 0) - return false; - - if (strncmp (nextname, "ARFILENAMES/ ", 16) != 0 && - strncmp (nextname, "// ", 16) != 0) - { - bfd_ardata (abfd)->extended_names = NULL; - return true; - } - - namedata = (struct areltdata *) _bfd_read_ar_hdr (abfd); - if (namedata == NULL) - return false; - - bfd_ardata (abfd)->extended_names = - bfd_zalloc (abfd, namedata->parsed_size); - if (bfd_ardata (abfd)->extended_names == NULL) - { - byebye: - bfd_release (abfd, (PTR) namedata); - return false; - } - - if (bfd_read ((PTR) bfd_ardata (abfd)->extended_names, 1, - namedata->parsed_size, abfd) != namedata->parsed_size) - { - if (bfd_get_error () != bfd_error_system_call) - bfd_set_error (bfd_error_malformed_archive); - bfd_release (abfd, (PTR) (bfd_ardata (abfd)->extended_names)); - bfd_ardata (abfd)->extended_names = NULL; - goto byebye; - } - - /* Since the archive is supposed to be printable if it contains - text, the entries in the list are newline-padded, not null - padded. In SVR4-style archives, the names also have a - trailing '/'. DOS/NT created archive often have \ in them - We'll fix all problems here.. */ - { - char *temp = bfd_ardata (abfd)->extended_names; - char *limit = temp + namedata->parsed_size; - for (; temp < limit; ++temp) { - if (*temp == '\012') - temp[temp[-1] == '/' ? -1 : 0] = '\0'; - if (*temp == '\\') - *temp = '/'; - } - } - - /* Pad to an even boundary if you have to */ - bfd_ardata (abfd)->first_file_filepos = bfd_tell (abfd); - bfd_ardata (abfd)->first_file_filepos += - (bfd_ardata (abfd)->first_file_filepos) % 2; - - /* FIXME, we can't release namedata here because it was allocated - below extended_names on the obstack... */ - /* bfd_release (abfd, namedata); */ - } - return true; -} - -#ifdef VMS - -/* Return a copy of the stuff in the filename between any :]> and a - semicolon */ -static const char * -normalize (abfd, file) - bfd *abfd; - const char *file; -{ - CONST char *first; - CONST char *last; - char *copy; - - first = file + strlen (file) - 1; - last = first + 1; - - while (first != file) - { - if (*first == ';') - last = first; - if (*first == ':' || *first == ']' || *first == '>') - { - first++; - break; - } - first--; - } - - copy = (char *) bfd_alloc (abfd, last - first + 1); - if (copy == NULL) - return NULL; - - memcpy (copy, first, last - first); - copy[last - first] = 0; - - return copy; -} - -#else -static const char * -normalize (abfd, file) - bfd *abfd; - const char *file; -{ - const char *filename = strrchr (file, '/'); - - if (filename != (char *) NULL) - filename++; - else - filename = file; - return filename; -} -#endif - -/* Build a BFD style extended name table. */ - -boolean -_bfd_archive_bsd_construct_extended_name_table (abfd, tabloc, tablen, name) - bfd *abfd; - char **tabloc; - bfd_size_type *tablen; - const char **name; -{ - *name = "ARFILENAMES/"; - return _bfd_construct_extended_name_table (abfd, false, tabloc, tablen); -} - -/* Build an SVR4 style extended name table. */ - -boolean -_bfd_archive_coff_construct_extended_name_table (abfd, tabloc, tablen, name) - bfd *abfd; - char **tabloc; - bfd_size_type *tablen; - const char **name; -{ - *name = "//"; - return _bfd_construct_extended_name_table (abfd, true, tabloc, tablen); -} - -/* Follows archive_head and produces an extended name table if - necessary. Returns (in tabloc) a pointer to an extended name - table, and in tablen the length of the table. If it makes an entry - it clobbers the filename so that the element may be written without - further massage. Returns true if it ran successfully, false if - something went wrong. A successful return may still involve a - zero-length tablen! */ - -boolean -_bfd_construct_extended_name_table (abfd, trailing_slash, tabloc, tablen) - bfd *abfd; - boolean trailing_slash; - char **tabloc; - bfd_size_type *tablen; -{ - unsigned int maxname = abfd->xvec->ar_max_namelen; - unsigned int total_namelen = 0; - bfd *current; - char *strptr; - - *tablen = 0; - - /* Figure out how long the table should be */ - for (current = abfd->archive_head; current != NULL; current = current->next) - { - const char *normal; - unsigned int thislen; - - normal = normalize (current, current->filename); - if (normal == NULL) - return false; - - thislen = strlen (normal); - - if (thislen > maxname - && (bfd_get_file_flags (abfd) & BFD_TRADITIONAL_FORMAT) != 0) - thislen = maxname; - - if (thislen > maxname) - { - /* Add one to leave room for \n. */ - total_namelen += thislen + 1; - if (trailing_slash) - { - /* Leave room for trailing slash. */ - ++total_namelen; - } - } - else - { - struct ar_hdr *hdr = arch_hdr (current); - if (strncmp (normal, hdr->ar_name, thislen) != 0 - || (thislen < sizeof hdr->ar_name - && hdr->ar_name[thislen] != ar_padchar (current))) - { - /* Must have been using extended format even though it - didn't need to. Fix it to use normal format. */ - memcpy (hdr->ar_name, normal, thislen); - if (thislen < maxname - || (thislen == maxname && thislen < sizeof hdr->ar_name)) - hdr->ar_name[thislen] = ar_padchar (current); - } - } - } - - if (total_namelen == 0) - return true; - - *tabloc = bfd_zalloc (abfd, total_namelen); - if (*tabloc == NULL) - return false; - - *tablen = total_namelen; - strptr = *tabloc; - - for (current = abfd->archive_head; current != NULL; current = - current->next) - { - const char *normal; - unsigned int thislen; - - normal = normalize (current, current->filename); - if (normal == NULL) - return false; - - thislen = strlen (normal); - if (thislen > maxname) - { - /* Works for now; may need to be re-engineered if we - encounter an oddball archive format and want to - generalise this hack. */ - struct ar_hdr *hdr = arch_hdr (current); - strcpy (strptr, normal); - if (! trailing_slash) - strptr[thislen] = '\012'; - else - { - strptr[thislen] = '/'; - strptr[thislen + 1] = '\012'; - } - hdr->ar_name[0] = ar_padchar (current); - /* We know there will always be enough room (one of the few - cases where you may safely use sprintf). */ - sprintf ((hdr->ar_name) + 1, "%-d", (unsigned) (strptr - *tabloc)); - /* Kinda Kludgy. We should just use the returned value of - sprintf but not all implementations get this right */ - { - char *temp = hdr->ar_name + 2; - for (; temp < hdr->ar_name + maxname; temp++) - if (*temp == '\0') - *temp = ' '; - } - strptr += thislen + 1; - if (trailing_slash) - ++strptr; - } - } - - return true; -} - -/** A couple of functions for creating ar_hdrs */ - -/* Takes a filename, returns an arelt_data for it, or NULL if it can't - make one. The filename must refer to a filename in the filesystem. - The filename field of the ar_hdr will NOT be initialized */ - -static struct areltdata * -bfd_ar_hdr_from_filesystem (abfd, filename) - bfd *abfd; - const char *filename; -{ - struct stat status; - struct areltdata *ared; - struct ar_hdr *hdr; - char *temp, *temp1; - - if (stat (filename, &status) != 0) - { - bfd_set_error (bfd_error_system_call); - return NULL; - } - - ared = (struct areltdata *) bfd_zalloc (abfd, sizeof (struct ar_hdr) + - sizeof (struct areltdata)); - if (ared == NULL) - return NULL; - hdr = (struct ar_hdr *) (((char *) ared) + sizeof (struct areltdata)); - - /* ar headers are space padded, not null padded! */ - memset ((PTR) hdr, ' ', sizeof (struct ar_hdr)); - - strncpy (hdr->ar_fmag, ARFMAG, 2); - - /* Goddamned sprintf doesn't permit MAXIMUM field lengths */ - sprintf ((hdr->ar_date), "%-12ld", (long) status.st_mtime); - sprintf ((hdr->ar_uid), "%ld", (long) status.st_uid); - sprintf ((hdr->ar_gid), "%ld", (long) status.st_gid); - sprintf ((hdr->ar_mode), "%-8o", (unsigned int) status.st_mode); - sprintf ((hdr->ar_size), "%-10ld", (long) status.st_size); - /* Correct for a lossage in sprintf whereby it null-terminates. I cannot - understand how these C losers could design such a ramshackle bunch of - IO operations */ - temp = (char *) hdr; - temp1 = temp + sizeof (struct ar_hdr) - 2; - for (; temp < temp1; temp++) - { - if (*temp == '\0') - *temp = ' '; - } - strncpy (hdr->ar_fmag, ARFMAG, 2); - ared->parsed_size = status.st_size; - ared->arch_header = (char *) hdr; - - return ared; -} - -/* This is magic required by the "ar" program. Since it's - undocumented, it's undocumented. You may think that it would take - a strong stomach to write this, and it does, but it takes even a - stronger stomach to try to code around such a thing! */ - -struct ar_hdr * -bfd_special_undocumented_glue (abfd, filename) - bfd *abfd; - char *filename; -{ - struct areltdata *ar_elt = bfd_ar_hdr_from_filesystem (abfd, filename); - if (ar_elt == NULL) - return NULL; - return (struct ar_hdr *) ar_elt->arch_header; -} - - -/* Analogous to stat call */ -int -bfd_generic_stat_arch_elt (abfd, buf) - bfd *abfd; - struct stat *buf; -{ - struct ar_hdr *hdr; - char *aloser; - - if (abfd->arelt_data == NULL) - { - bfd_set_error (bfd_error_invalid_operation); - return -1; - } - - hdr = arch_hdr (abfd); - -#define foo(arelt, stelt, size) \ - buf->stelt = strtol (hdr->arelt, &aloser, size); \ - if (aloser == hdr->arelt) return -1; - - foo (ar_date, st_mtime, 10); - foo (ar_uid, st_uid, 10); - foo (ar_gid, st_gid, 10); - foo (ar_mode, st_mode, 8); - - buf->st_size = arch_eltdata (abfd)->parsed_size; - - return 0; -} - -void -bfd_dont_truncate_arname (abfd, pathname, arhdr) - bfd *abfd; - CONST char *pathname; - char *arhdr; -{ - /* FIXME: This interacts unpleasantly with ar's quick-append option. - Fortunately ic960 users will never use that option. Fixing this - is very hard; fortunately I know how to do it and will do so once - intel's release is out the door. */ - - struct ar_hdr *hdr = (struct ar_hdr *) arhdr; - size_t length; - const char *filename; - size_t maxlen = ar_maxnamelen (abfd); - - if ((bfd_get_file_flags (abfd) & BFD_TRADITIONAL_FORMAT) != 0) - { - bfd_bsd_truncate_arname (abfd, pathname, arhdr); - return; - } - - filename = normalize (abfd, pathname); - if (filename == NULL) - { - /* FIXME */ - abort (); - } - - length = strlen (filename); - - if (length <= maxlen) - memcpy (hdr->ar_name, filename, length); - - /* Add the padding character if there is room for it. */ - if (length < maxlen - || (length == maxlen && length < sizeof hdr->ar_name)) - (hdr->ar_name)[length] = ar_padchar (abfd); -} - -void -bfd_bsd_truncate_arname (abfd, pathname, arhdr) - bfd *abfd; - CONST char *pathname; - char *arhdr; -{ - struct ar_hdr *hdr = (struct ar_hdr *) arhdr; - int length; - CONST char *filename = strrchr (pathname, '/'); - int maxlen = ar_maxnamelen (abfd); - - if (filename == NULL) - filename = pathname; - else - ++filename; - - length = strlen (filename); - - if (length <= maxlen) - memcpy (hdr->ar_name, filename, length); - else - { - /* pathname: meet procrustes */ - memcpy (hdr->ar_name, filename, maxlen); - length = maxlen; - } - - if (length < maxlen) - (hdr->ar_name)[length] = ar_padchar (abfd); -} - -/* Store name into ar header. Truncates the name to fit. - 1> strip pathname to be just the basename. - 2> if it's short enuf to fit, stuff it in. - 3> If it doesn't end with .o, truncate it to fit - 4> truncate it before the .o, append .o, stuff THAT in. */ - -/* This is what gnu ar does. It's better but incompatible with the - bsd ar. */ - -void -bfd_gnu_truncate_arname (abfd, pathname, arhdr) - bfd *abfd; - CONST char *pathname; - char *arhdr; -{ - struct ar_hdr *hdr = (struct ar_hdr *) arhdr; - int length; - CONST char *filename = strrchr (pathname, '/'); - int maxlen = ar_maxnamelen (abfd); - - if (filename == NULL) - filename = pathname; - else - ++filename; - - length = strlen (filename); - - if (length <= maxlen) - memcpy (hdr->ar_name, filename, length); - else - { /* pathname: meet procrustes */ - memcpy (hdr->ar_name, filename, maxlen); - if ((filename[length - 2] == '.') && (filename[length - 1] == 'o')) - { - hdr->ar_name[maxlen - 2] = '.'; - hdr->ar_name[maxlen - 1] = 'o'; - } - length = maxlen; - } - - if (length < 16) - (hdr->ar_name)[length] = ar_padchar (abfd); -} - -/* The BFD is open for write and has its format set to bfd_archive */ - -boolean -_bfd_write_archive_contents (arch) - bfd *arch; -{ - bfd *current; - char *etable = NULL; - bfd_size_type elength = 0; - const char *ename = NULL; - boolean makemap = bfd_has_map (arch); - boolean hasobjects = false; /* if no .o's, don't bother to make a map */ - bfd_size_type wrote; - unsigned int i; - int tries; - - /* Verify the viability of all entries; if any of them live in the - filesystem (as opposed to living in an archive open for input) - then construct a fresh ar_hdr for them. */ - for (current = arch->archive_head; current; current = current->next) - { - if (bfd_write_p (current)) - { - bfd_set_error (bfd_error_invalid_operation); - return false; - } - if (!current->arelt_data) - { - current->arelt_data = - (PTR) bfd_ar_hdr_from_filesystem (arch, current->filename); - if (!current->arelt_data) - return false; - - /* Put in the file name */ - BFD_SEND (arch, _bfd_truncate_arname, (arch, - current->filename, - (char *) arch_hdr (current))); - } - - if (makemap && ! hasobjects) - { /* don't bother if we won't make a map! */ - if ((bfd_check_format (current, bfd_object)) -#if 0 /* FIXME -- these are not set correctly */ - && ((bfd_get_file_flags (current) & HAS_SYMS)) -#endif - ) - hasobjects = true; - } - } - - if (!BFD_SEND (arch, _bfd_construct_extended_name_table, - (arch, &etable, &elength, &ename))) - return false; - - if (bfd_seek (arch, (file_ptr) 0, SEEK_SET) != 0) - return false; -#ifdef GNU960 - wrote = bfd_write (BFD_GNU960_ARMAG (arch), 1, SARMAG, arch); -#else - wrote = bfd_write (ARMAG, 1, SARMAG, arch); -#endif - if (wrote != SARMAG) - return false; - - if (makemap && hasobjects) - { - if (_bfd_compute_and_write_armap (arch, elength) != true) - return false; - } - - if (elength != 0) - { - struct ar_hdr hdr; - - memset ((char *) (&hdr), 0, sizeof (struct ar_hdr)); - strcpy (hdr.ar_name, ename); - /* Round size up to even number in archive header. */ - sprintf (&(hdr.ar_size[0]), "%-10d", - (int) ((elength + 1) & ~1)); - strncpy (hdr.ar_fmag, ARFMAG, 2); - for (i = 0; i < sizeof (struct ar_hdr); i++) - if (((char *) (&hdr))[i] == '\0') - (((char *) (&hdr))[i]) = ' '; - if ((bfd_write ((char *) &hdr, 1, sizeof (struct ar_hdr), arch) - != sizeof (struct ar_hdr)) - || bfd_write (etable, 1, elength, arch) != elength) - return false; - if ((elength % 2) == 1) - { - if (bfd_write ("\012", 1, 1, arch) != 1) - return false; - } - } - - for (current = arch->archive_head; current; current = current->next) - { - char buffer[DEFAULT_BUFFERSIZE]; - unsigned int remaining = arelt_size (current); - struct ar_hdr *hdr = arch_hdr (current); - - /* write ar header */ - if (bfd_write ((char *) hdr, 1, sizeof (*hdr), arch) != sizeof (*hdr)) - return false; - if (bfd_seek (current, (file_ptr) 0, SEEK_SET) != 0) - return false; - while (remaining) - { - unsigned int amt = DEFAULT_BUFFERSIZE; - if (amt > remaining) - amt = remaining; - errno = 0; - if (bfd_read (buffer, amt, 1, current) != amt) - { - if (bfd_get_error () != bfd_error_system_call) - bfd_set_error (bfd_error_malformed_archive); - return false; - } - if (bfd_write (buffer, amt, 1, arch) != amt) - return false; - remaining -= amt; - } - if ((arelt_size (current) % 2) == 1) - { - if (bfd_write ("\012", 1, 1, arch) != 1) - return false; - } - } - - if (makemap && hasobjects) - { - /* Verify the timestamp in the archive file. If it would not be - accepted by the linker, rewrite it until it would be. If - anything odd happens, break out and just return. (The - Berkeley linker checks the timestamp and refuses to read the - table-of-contents if it is >60 seconds less than the file's - modified-time. That painful hack requires this painful hack. */ - tries = 1; - do - { - if (bfd_update_armap_timestamp (arch)) - break; - (*_bfd_error_handler) - ("Warning: writing archive was slow: rewriting timestamp\n"); - } - while (++tries < 6); - } - - return true; -} - -/* Note that the namidx for the first symbol is 0 */ - -boolean -_bfd_compute_and_write_armap (arch, elength) - bfd *arch; - unsigned int elength; -{ - char *first_name = NULL; - bfd *current; - file_ptr elt_no = 0; - struct orl *map = NULL; - int orl_max = 1024; /* fine initial default */ - int orl_count = 0; - int stridx = 0; /* string index */ - asymbol **syms = NULL; - long syms_max = 0; - boolean ret; - - /* Dunno if this is the best place for this info... */ - if (elength != 0) - elength += sizeof (struct ar_hdr); - elength += elength % 2; - - map = (struct orl *) bfd_malloc (orl_max * sizeof (struct orl)); - if (map == NULL) - goto error_return; - - /* We put the symbol names on the arch obstack, and then discard - them when done. */ - first_name = bfd_alloc (arch, 1); - if (first_name == NULL) - goto error_return; - - /* Drop all the files called __.SYMDEF, we're going to make our - own */ - while (arch->archive_head && - strcmp (arch->archive_head->filename, "__.SYMDEF") == 0) - arch->archive_head = arch->archive_head->next; - - /* Map over each element */ - for (current = arch->archive_head; - current != (bfd *) NULL; - current = current->next, elt_no++) - { - if ((bfd_check_format (current, bfd_object) == true) - && ((bfd_get_file_flags (current) & HAS_SYMS))) - { - long storage; - long symcount; - long src_count; - - storage = bfd_get_symtab_upper_bound (current); - if (storage < 0) - goto error_return; - - if (storage != 0) - { - if (storage > syms_max) - { - if (syms_max > 0) - free (syms); - syms_max = storage; - syms = (asymbol **) bfd_malloc ((size_t) syms_max); - if (syms == NULL) - goto error_return; - } - symcount = bfd_canonicalize_symtab (current, syms); - if (symcount < 0) - goto error_return; - - /* Now map over all the symbols, picking out the ones we want */ - for (src_count = 0; src_count < symcount; src_count++) - { - flagword flags = (syms[src_count])->flags; - asection *sec = syms[src_count]->section; - - if ((flags & BSF_GLOBAL || - flags & BSF_WEAK || - flags & BSF_INDIRECT || - bfd_is_com_section (sec)) - && ! bfd_is_und_section (sec)) - { - size_t namelen; - struct orl *new_map; - - /* This symbol will go into the archive header */ - if (orl_count == orl_max) - { - orl_max *= 2; - new_map = - ((struct orl *) - bfd_realloc (map, orl_max * sizeof (struct orl))); - if (new_map == (struct orl *) NULL) - goto error_return; - - map = new_map; - } - - namelen = strlen (syms[src_count]->name); - map[orl_count].name = ((char **) - bfd_alloc (arch, - sizeof (char *))); - if (map[orl_count].name == NULL) - goto error_return; - *(map[orl_count].name) = bfd_alloc (arch, namelen + 1); - if (*(map[orl_count].name) == NULL) - goto error_return; - strcpy (*(map[orl_count].name), syms[src_count]->name); - (map[orl_count]).pos = (file_ptr) current; - (map[orl_count]).namidx = stridx; - - stridx += namelen + 1; - ++orl_count; - } - } - } - - /* Now ask the BFD to free up any cached information, so we - don't fill all of memory with symbol tables. */ - if (! bfd_free_cached_info (current)) - goto error_return; - } - } - - /* OK, now we have collected all the data, let's write them out */ - ret = BFD_SEND (arch, write_armap, - (arch, elength, map, orl_count, stridx)); - - if (syms_max > 0) - free (syms); - if (map != NULL) - free (map); - if (first_name != NULL) - bfd_release (arch, first_name); - - return ret; - - error_return: - if (syms_max > 0) - free (syms); - if (map != NULL) - free (map); - if (first_name != NULL) - bfd_release (arch, first_name); - - return false; -} - -boolean -bsd_write_armap (arch, elength, map, orl_count, stridx) - bfd *arch; - unsigned int elength; - struct orl *map; - unsigned int orl_count; - int stridx; -{ - int padit = stridx & 1; - unsigned int ranlibsize = orl_count * BSD_SYMDEF_SIZE; - unsigned int stringsize = stridx + padit; - /* Include 8 bytes to store ranlibsize and stringsize in output. */ - unsigned int mapsize = ranlibsize + stringsize + 8; - file_ptr firstreal; - bfd *current = arch->archive_head; - bfd *last_elt = current; /* last element arch seen */ - bfd_byte temp[4]; - unsigned int count; - struct ar_hdr hdr; - struct stat statbuf; - unsigned int i; - - firstreal = mapsize + elength + sizeof (struct ar_hdr) + SARMAG; - - stat (arch->filename, &statbuf); - memset ((char *) (&hdr), 0, sizeof (struct ar_hdr)); - sprintf (hdr.ar_name, RANLIBMAG); - /* Remember the timestamp, to keep it holy. But fudge it a little. */ - bfd_ardata (arch)->armap_timestamp = statbuf.st_mtime + ARMAP_TIME_OFFSET; - bfd_ardata (arch)->armap_datepos = (SARMAG - + offsetof (struct ar_hdr, ar_date[0])); - sprintf (hdr.ar_date, "%ld", bfd_ardata (arch)->armap_timestamp); - sprintf (hdr.ar_uid, "%ld", (long) getuid ()); - sprintf (hdr.ar_gid, "%ld", (long) getgid ()); - sprintf (hdr.ar_size, "%-10d", (int) mapsize); - strncpy (hdr.ar_fmag, ARFMAG, 2); - for (i = 0; i < sizeof (struct ar_hdr); i++) - if (((char *) (&hdr))[i] == '\0') - (((char *) (&hdr))[i]) = ' '; - if (bfd_write ((char *) &hdr, 1, sizeof (struct ar_hdr), arch) - != sizeof (struct ar_hdr)) - return false; - bfd_h_put_32 (arch, (bfd_vma) ranlibsize, temp); - if (bfd_write (temp, 1, sizeof (temp), arch) != sizeof (temp)) - return false; - - for (count = 0; count < orl_count; count++) - { - bfd_byte buf[BSD_SYMDEF_SIZE]; - - if (((bfd *) (map[count]).pos) != last_elt) - { - do - { - firstreal += arelt_size (current) + sizeof (struct ar_hdr); - firstreal += firstreal % 2; - current = current->next; - } - while (current != (bfd *) (map[count]).pos); - } /* if new archive element */ - - last_elt = current; - bfd_h_put_32 (arch, map[count].namidx, buf); - bfd_h_put_32 (arch, firstreal, buf + BSD_SYMDEF_OFFSET_SIZE); - if (bfd_write (buf, BSD_SYMDEF_SIZE, 1, arch) != BSD_SYMDEF_SIZE) - return false; - } - - /* now write the strings themselves */ - bfd_h_put_32 (arch, stringsize, temp); - if (bfd_write (temp, 1, sizeof (temp), arch) != sizeof (temp)) - return false; - for (count = 0; count < orl_count; count++) - { - size_t len = strlen (*map[count].name) + 1; - - if (bfd_write (*map[count].name, 1, len, arch) != len) - return false; - } - - /* The spec sez this should be a newline. But in order to be - bug-compatible for sun's ar we use a null. */ - if (padit) - { - if (bfd_write ("", 1, 1, arch) != 1) - return false; - } - - return true; -} - -/* At the end of archive file handling, update the timestamp in the - file, so the linker will accept it. - - Return true if the timestamp was OK, or an unusual problem happened. - Return false if we updated the timestamp. */ - -boolean -_bfd_archive_bsd_update_armap_timestamp (arch) - bfd *arch; -{ - struct stat archstat; - struct ar_hdr hdr; - unsigned int i; - - /* Flush writes, get last-write timestamp from file, and compare it - to the timestamp IN the file. */ - bfd_flush (arch); - if (bfd_stat (arch, &archstat) == -1) - { - perror ("Reading archive file mod timestamp"); - return true; /* Can't read mod time for some reason */ - } - if (archstat.st_mtime <= bfd_ardata (arch)->armap_timestamp) - return true; /* OK by the linker's rules */ - - /* Update the timestamp. */ - bfd_ardata (arch)->armap_timestamp = archstat.st_mtime + ARMAP_TIME_OFFSET; - - /* Prepare an ASCII version suitable for writing. */ - memset (hdr.ar_date, 0, sizeof (hdr.ar_date)); - sprintf (hdr.ar_date, "%ld", bfd_ardata (arch)->armap_timestamp); - for (i = 0; i < sizeof (hdr.ar_date); i++) - if (hdr.ar_date[i] == '\0') - (hdr.ar_date)[i] = ' '; - - /* Write it into the file. */ - bfd_ardata (arch)->armap_datepos = (SARMAG - + offsetof (struct ar_hdr, ar_date[0])); - if (bfd_seek (arch, bfd_ardata (arch)->armap_datepos, SEEK_SET) != 0 - || (bfd_write (hdr.ar_date, sizeof (hdr.ar_date), 1, arch) - != sizeof (hdr.ar_date))) - { - /* FIXME: bfd can't call perror. */ - perror ("Writing updated armap timestamp"); - return true; /* Some error while writing */ - } - - return false; /* We updated the timestamp successfully. */ -} - -/* A coff armap looks like : - lARMAG - struct ar_hdr with name = '/' - number of symbols - offset of file for symbol 0 - offset of file for symbol 1 - - offset of file for symbol n-1 - symbol name 0 - symbol name 1 - - symbol name n-1 -*/ - -boolean -coff_write_armap (arch, elength, map, symbol_count, stridx) - bfd *arch; - unsigned int elength; - struct orl *map; - unsigned int symbol_count; - int stridx; -{ - /* The size of the ranlib is the number of exported symbols in the - archive * the number of bytes in a int, + an int for the count */ - unsigned int ranlibsize = (symbol_count * 4) + 4; - unsigned int stringsize = stridx; - unsigned int mapsize = stringsize + ranlibsize; - file_ptr archive_member_file_ptr; - bfd *current = arch->archive_head; - unsigned int count; - struct ar_hdr hdr; - unsigned int i; - int padit = mapsize & 1; - - if (padit) - mapsize++; - - /* work out where the first object file will go in the archive */ - archive_member_file_ptr = (mapsize - + elength - + sizeof (struct ar_hdr) - + SARMAG); - - memset ((char *) (&hdr), 0, sizeof (struct ar_hdr)); - hdr.ar_name[0] = '/'; - sprintf (hdr.ar_size, "%-10d", (int) mapsize); - sprintf (hdr.ar_date, "%ld", (long) time (NULL)); - /* This, at least, is what Intel coff sets the values to.: */ - sprintf ((hdr.ar_uid), "%d", 0); - sprintf ((hdr.ar_gid), "%d", 0); - sprintf ((hdr.ar_mode), "%-7o", (unsigned) 0); - strncpy (hdr.ar_fmag, ARFMAG, 2); - - for (i = 0; i < sizeof (struct ar_hdr); i++) - if (((char *) (&hdr))[i] == '\0') - (((char *) (&hdr))[i]) = ' '; - - /* Write the ar header for this item and the number of symbols */ - - if (bfd_write ((PTR) &hdr, 1, sizeof (struct ar_hdr), arch) - != sizeof (struct ar_hdr)) - return false; - - bfd_write_bigendian_4byte_int (arch, symbol_count); - - /* Two passes, first write the file offsets for each symbol - - remembering that each offset is on a two byte boundary. */ - - /* Write out the file offset for the file associated with each - symbol, and remember to keep the offsets padded out. */ - - current = arch->archive_head; - count = 0; - while (current != (bfd *) NULL && count < symbol_count) - { - /* For each symbol which is used defined in this object, write out - the object file's address in the archive */ - - while (((bfd *) (map[count]).pos) == current) - { - bfd_write_bigendian_4byte_int (arch, archive_member_file_ptr); - count++; - } - /* Add size of this archive entry */ - archive_member_file_ptr += (arelt_size (current) - + sizeof (struct ar_hdr)); - /* remember aboout the even alignment */ - archive_member_file_ptr += archive_member_file_ptr % 2; - current = current->next; - } - - /* now write the strings themselves */ - for (count = 0; count < symbol_count; count++) - { - size_t len = strlen (*map[count].name) + 1; - - if (bfd_write (*map[count].name, 1, len, arch) != len) - return false; - } - - /* The spec sez this should be a newline. But in order to be - bug-compatible for arc960 we use a null. */ - if (padit) - { - if (bfd_write ("", 1, 1, arch) != 1) - return false; - } - - return true; -} diff --git a/contrib/gdb/bfd/archures.c b/contrib/gdb/bfd/archures.c deleted file mode 100644 index 1db8bc2..0000000 --- a/contrib/gdb/bfd/archures.c +++ /dev/null @@ -1,720 +0,0 @@ -/* BFD library support routines for architectures. - Copyright (C) 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. - Hacked by John Gilmore and Steve Chamberlain of Cygnus Support. - -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 - -/* - -SECTION - Architectures - - BFD keeps one atom in a BFD describing the - architecture of the data attached to the BFD: a pointer to a - <>. - - Pointers to structures can be requested independently of a BFD - so that an architecture's information can be interrogated - without access to an open BFD. - - The architecture information is provided by each architecture package. - The set of default architectures is selected by the macro - <>. This is normally set up in the - @file{config/@var{target}.mt} file of your choice. If the name is not - defined, then all the architectures supported are included. - - When BFD starts up, all the architectures are called with an - initialize method. It is up to the architecture back end to - insert as many items into the list of architectures as it wants to; - generally this would be one for each machine and one for the - default case (an item with a machine field of 0). - - BFD's idea of an architecture is implemented in @file{archures.c}. -*/ - -/* - -SUBSECTION - bfd_architecture - -DESCRIPTION - This enum gives the object file's CPU architecture, in a - global sense---i.e., what processor family does it belong to? - Another field indicates which processor within - the family is in use. The machine gives a number which - distinguishes different versions of the architecture, - containing, for example, 2 and 3 for Intel i960 KA and i960 KB, - and 68020 and 68030 for Motorola 68020 and 68030. - -.enum bfd_architecture -.{ -. bfd_arch_unknown, {* File arch not known *} -. bfd_arch_obscure, {* Arch known, not one of these *} -. bfd_arch_m68k, {* Motorola 68xxx *} -. bfd_arch_vax, {* DEC Vax *} -. bfd_arch_i960, {* Intel 960 *} -. {* The order of the following is important. -. lower number indicates a machine type that -. only accepts a subset of the instructions -. available to machines with higher numbers. -. The exception is the "ca", which is -. incompatible with all other machines except -. "core". *} -. -.#define bfd_mach_i960_core 1 -.#define bfd_mach_i960_ka_sa 2 -.#define bfd_mach_i960_kb_sb 3 -.#define bfd_mach_i960_mc 4 -.#define bfd_mach_i960_xa 5 -.#define bfd_mach_i960_ca 6 -.#define bfd_mach_i960_jx 7 -.#define bfd_mach_i960_hx 8 -. -. bfd_arch_a29k, {* AMD 29000 *} -. bfd_arch_sparc, {* SPARC *} -.#define bfd_mach_sparc 1 -.{* The difference between v8plus and v9 is that v9 is a true 64 bit env. *} -.#define bfd_mach_sparc_v8plus 2 -.#define bfd_mach_sparc_v8plusa 3 {* with ultrasparc add'ns *} -.#define bfd_mach_sparc_v9 4 -.#define bfd_mach_sparc_v9a 5 {* with ultrasparc add'ns *} -.{* Nonzero if MACH has the v9 instruction set. *} -.#define bfd_mach_sparc_v9_p(mach) ((mach) != bfd_mach_sparc) -. bfd_arch_mips, {* MIPS Rxxxx *} -. bfd_arch_i386, {* Intel 386 *} -. bfd_arch_we32k, {* AT&T WE32xxx *} -. bfd_arch_tahoe, {* CCI/Harris Tahoe *} -. bfd_arch_i860, {* Intel 860 *} -. bfd_arch_romp, {* IBM ROMP PC/RT *} -. bfd_arch_alliant, {* Alliant *} -. bfd_arch_convex, {* Convex *} -. bfd_arch_m88k, {* Motorola 88xxx *} -. bfd_arch_pyramid, {* Pyramid Technology *} -. bfd_arch_h8300, {* Hitachi H8/300 *} -.#define bfd_mach_h8300 1 -.#define bfd_mach_h8300h 2 -. bfd_arch_powerpc, {* PowerPC *} -. bfd_arch_rs6000, {* IBM RS/6000 *} -. bfd_arch_hppa, {* HP PA RISC *} -. bfd_arch_z8k, {* Zilog Z8000 *} -.#define bfd_mach_z8001 1 -.#define bfd_mach_z8002 2 -. bfd_arch_h8500, {* Hitachi H8/500 *} -. bfd_arch_sh, {* Hitachi SH *} -. bfd_arch_alpha, {* Dec Alpha *} -. bfd_arch_arm, {* Advanced Risc Machines ARM *} -. bfd_arch_ns32k, {* National Semiconductors ns32000 *} -. bfd_arch_w65, {* WDC 65816 *} -. bfd_arch_last -. }; - - -*/ - -/* - -SUBSECTION - bfd_arch_info - -DESCRIPTION - This structure contains information on architectures for use - within BFD. - -. -.typedef struct bfd_arch_info -.{ -. int bits_per_word; -. int bits_per_address; -. int bits_per_byte; -. enum bfd_architecture arch; -. unsigned long mach; -. const char *arch_name; -. const char *printable_name; -. unsigned int section_align_power; -. {* true if this is the default machine for the architecture *} -. boolean the_default; -. const struct bfd_arch_info * (*compatible) -. PARAMS ((const struct bfd_arch_info *a, -. const struct bfd_arch_info *b)); -. -. boolean (*scan) PARAMS ((const struct bfd_arch_info *, const char *)); -. -. const struct bfd_arch_info *next; -.} bfd_arch_info_type; -*/ - -extern const bfd_arch_info_type bfd_a29k_arch; -extern const bfd_arch_info_type bfd_alpha_arch; -extern const bfd_arch_info_type bfd_arm_arch; -extern const bfd_arch_info_type bfd_h8300_arch; -extern const bfd_arch_info_type bfd_h8500_arch; -extern const bfd_arch_info_type bfd_hppa_arch; -extern const bfd_arch_info_type bfd_i386_arch; -extern const bfd_arch_info_type bfd_i860_arch; -extern const bfd_arch_info_type bfd_i960_arch; -extern const bfd_arch_info_type bfd_m68k_arch; -extern const bfd_arch_info_type bfd_m88k_arch; -extern const bfd_arch_info_type bfd_mips_arch; -extern const bfd_arch_info_type bfd_powerpc_arch; -extern const bfd_arch_info_type bfd_rs6000_arch; -extern const bfd_arch_info_type bfd_sh_arch; -extern const bfd_arch_info_type bfd_sparc_arch; -extern const bfd_arch_info_type bfd_vax_arch; -extern const bfd_arch_info_type bfd_we32k_arch; -extern const bfd_arch_info_type bfd_z8k_arch; -extern const bfd_arch_info_type bfd_ns32k_arch; -extern const bfd_arch_info_type bfd_w65_arch; - -static const bfd_arch_info_type * const bfd_archures_list[] = -{ -#ifdef SELECT_ARCHITECTURES - SELECT_ARCHITECTURES, -#else - &bfd_a29k_arch, - &bfd_alpha_arch, - &bfd_arm_arch, - &bfd_h8300_arch, - &bfd_h8500_arch, - &bfd_hppa_arch, - &bfd_i386_arch, - &bfd_i860_arch, - &bfd_i960_arch, - &bfd_m68k_arch, - &bfd_m88k_arch, - &bfd_mips_arch, - &bfd_powerpc_arch, - &bfd_rs6000_arch, - &bfd_sh_arch, - &bfd_sparc_arch, - &bfd_vax_arch, - &bfd_we32k_arch, - &bfd_z8k_arch, - &bfd_ns32k_arch, - &bfd_w65_arch, -#endif - 0 -}; - -/* -FUNCTION - bfd_printable_name - -SYNOPSIS - const char *bfd_printable_name(bfd *abfd); - -DESCRIPTION - Return a printable string representing the architecture and machine - from the pointer to the architecture info structure. - -*/ - -const char * -bfd_printable_name (abfd) - bfd *abfd; -{ - return abfd->arch_info->printable_name; -} - - - -/* -FUNCTION - bfd_scan_arch - -SYNOPSIS - const bfd_arch_info_type *bfd_scan_arch(const char *string); - -DESCRIPTION - Figure out if BFD supports any cpu which could be described with - the name @var{string}. Return a pointer to an <> - structure if a machine is found, otherwise NULL. - -*/ - -const bfd_arch_info_type * -bfd_scan_arch (string) - const char *string; -{ - const bfd_arch_info_type * const *app, *ap; - - /* Look through all the installed architectures */ - for (app = bfd_archures_list; *app != NULL; app++) - { - for (ap = *app; ap != NULL; ap = ap->next) - { - if (ap->scan (ap, string)) - return ap; - } - } - - return NULL; -} - - - -/* -FUNCTION - bfd_arch_get_compatible - -SYNOPSIS - const bfd_arch_info_type *bfd_arch_get_compatible( - const bfd *abfd, - const bfd *bbfd); - -DESCRIPTION - Determine whether two BFDs' - architectures and machine types are compatible. Calculates - the lowest common denominator between the two architectures - and machine types implied by the BFDs and returns a pointer to - an <> structure describing the compatible machine. -*/ - -const bfd_arch_info_type * -bfd_arch_get_compatible (abfd, bbfd) - const bfd *abfd; - const bfd *bbfd; -{ - /* If either architecture is unknown, then all we can do is assume - the user knows what he's doing. */ - if (abfd->arch_info->arch == bfd_arch_unknown) - return bbfd->arch_info; - if (bbfd->arch_info->arch == bfd_arch_unknown) - return abfd->arch_info; - - /* Otherwise architecture-specific code has to decide. */ - return abfd->arch_info->compatible (abfd->arch_info, bbfd->arch_info); -} - - -/* -INTERNAL_DEFINITION - bfd_default_arch_struct - -DESCRIPTION - The <> is an item of - <> which has been initialized to a fairly - generic state. A BFD starts life by pointing to this - structure, until the correct back end has determined the real - architecture of the file. - -.extern const bfd_arch_info_type bfd_default_arch_struct; - -*/ - -const bfd_arch_info_type bfd_default_arch_struct = -{ - 32,32,8,bfd_arch_unknown,0,"unknown","unknown",2,true, - bfd_default_compatible, - bfd_default_scan, - 0, -}; - -/* -FUNCTION - bfd_set_arch_info - -SYNOPSIS - void bfd_set_arch_info(bfd *abfd, const bfd_arch_info_type *arg); - -DESCRIPTION - Set the architecture info of @var{abfd} to @var{arg}. -*/ - -void -bfd_set_arch_info (abfd, arg) - bfd *abfd; - const bfd_arch_info_type *arg; -{ - abfd->arch_info = arg; -} - -/* -INTERNAL_FUNCTION - bfd_default_set_arch_mach - -SYNOPSIS - boolean bfd_default_set_arch_mach(bfd *abfd, - enum bfd_architecture arch, - unsigned long mach); - -DESCRIPTION - Set the architecture and machine type in BFD @var{abfd} - to @var{arch} and @var{mach}. Find the correct - pointer to a structure and insert it into the <> - pointer. -*/ - -boolean -bfd_default_set_arch_mach (abfd, arch, mach) - bfd *abfd; - enum bfd_architecture arch; - unsigned long mach; -{ - const bfd_arch_info_type * const *app, *ap; - - for (app = bfd_archures_list; *app != NULL; app++) - { - for (ap = *app; ap != NULL; ap = ap->next) - { - if (ap->arch == arch - && (ap->mach == mach - || (mach == 0 && ap->the_default))) - { - abfd->arch_info = ap; - return true; - } - } - } - - abfd->arch_info = &bfd_default_arch_struct; - bfd_set_error (bfd_error_bad_value); - return false; -} - - -/* -FUNCTION - bfd_get_arch - -SYNOPSIS - enum bfd_architecture bfd_get_arch(bfd *abfd); - -DESCRIPTION - Return the enumerated type which describes the BFD @var{abfd}'s - architecture. - -*/ - -enum bfd_architecture -bfd_get_arch (abfd) - bfd *abfd; -{ - return abfd->arch_info->arch; -} - -/* -FUNCTION - bfd_get_mach - -SYNOPSIS - unsigned long bfd_get_mach(bfd *abfd); - -DESCRIPTION - Return the long type which describes the BFD @var{abfd}'s - machine. -*/ - -unsigned long -bfd_get_mach (abfd) - bfd *abfd; -{ - return abfd->arch_info->mach; -} - -/* -FUNCTION - bfd_arch_bits_per_byte - -SYNOPSIS - unsigned int bfd_arch_bits_per_byte(bfd *abfd); - -DESCRIPTION - Return the number of bits in one of the BFD @var{abfd}'s - architecture's bytes. - -*/ - -unsigned int -bfd_arch_bits_per_byte (abfd) - bfd *abfd; -{ - return abfd->arch_info->bits_per_byte; -} - -/* -FUNCTION - bfd_arch_bits_per_address - -SYNOPSIS - unsigned int bfd_arch_bits_per_address(bfd *abfd); - -DESCRIPTION - Return the number of bits in one of the BFD @var{abfd}'s - architecture's addresses. -*/ - -unsigned int -bfd_arch_bits_per_address (abfd) - bfd *abfd; -{ - return abfd->arch_info->bits_per_address; -} - - -/* -INTERNAL_FUNCTION - bfd_default_compatible - -SYNOPSIS - const bfd_arch_info_type *bfd_default_compatible - (const bfd_arch_info_type *a, - const bfd_arch_info_type *b); - -DESCRIPTION - The default function for testing for compatibility. -*/ - -const bfd_arch_info_type * -bfd_default_compatible (a,b) - const bfd_arch_info_type *a; - const bfd_arch_info_type *b; -{ - if (a->arch != b->arch) - return NULL; - - if (a->mach > b->mach) - return a; - - if (b->mach > a->mach) - return b; - - return a; -} - - -/* -INTERNAL_FUNCTION - bfd_default_scan - -SYNOPSIS - boolean bfd_default_scan(const struct bfd_arch_info *info, const char *string); - -DESCRIPTION - The default function for working out whether this is an - architecture hit and a machine hit. -*/ - -boolean -bfd_default_scan (info, string) - const struct bfd_arch_info *info; - const char *string; -{ - const char *ptr_src; - const char *ptr_tst; - unsigned long number; - enum bfd_architecture arch; - - /* First test for an exact match */ - if (strcmp (string, info->printable_name) == 0) - return true; - - /* See how much of the supplied string matches with the - architecture, eg the string m68k:68020 would match the 68k entry - up to the :, then we get left with the machine number */ - - for (ptr_src = string, ptr_tst = info->arch_name; - *ptr_src && *ptr_tst; - ptr_src++, ptr_tst++) - { - if (*ptr_src != *ptr_tst) break; - } - - /* Chewed up as much of the architecture as will match, skip any - colons */ - if (*ptr_src == ':') - ptr_src++; - - if (*ptr_src == 0) - { - /* nothing more, then only keep this one if it is the default - machine for this architecture */ - return info->the_default; - } - - number = 0; - while (isdigit(*ptr_src)) - { - number = number * 10 + *ptr_src - '0'; - ptr_src++; - } - - switch (number) - { - case 65: - arch = bfd_arch_w65; - break; - - case 300: - arch = bfd_arch_h8300; - break; - - case 500: - arch = bfd_arch_h8500; - break; - - case 68010: - case 68020: - case 68030: - case 68040: - case 68332: - case 68050: - case 68000: - arch = bfd_arch_m68k; - break; - - case 386: - case 80386: - case 486: - case 80486: - arch = bfd_arch_i386; - break; - - case 29000: - arch = bfd_arch_a29k; - break; - - case 8000: - arch = bfd_arch_z8k; - break; - - case 32000: - arch = bfd_arch_we32k; - break; - - case 860: - case 80860: - arch = bfd_arch_i860; - break; - case 960: - case 80960: - arch = bfd_arch_i960; - break; - - case 2000: - case 3000: - case 4000: - case 4400: - arch = bfd_arch_mips; - break; - - case 6000: - arch = bfd_arch_rs6000; - break; - - default: - return false; - } - - if (arch != info->arch) - return false; - - if (number != info->mach) - return false; - - return true; -} - - -/* -FUNCTION - bfd_get_arch_info - -SYNOPSIS - const bfd_arch_info_type * bfd_get_arch_info(bfd *abfd); - -DESCRIPTION - Return the architecture info struct in @var{abfd}. -*/ - -const bfd_arch_info_type * -bfd_get_arch_info (abfd) - bfd *abfd; -{ - return abfd->arch_info; -} - - -/* -FUNCTION - bfd_lookup_arch - -SYNOPSIS - const bfd_arch_info_type *bfd_lookup_arch - (enum bfd_architecture - arch, - unsigned long machine); - -DESCRIPTION - Look for the architecure info structure which matches the - arguments @var{arch} and @var{machine}. A machine of 0 matches the - machine/architecture structure which marks itself as the - default. -*/ - -const bfd_arch_info_type * -bfd_lookup_arch (arch, machine) - enum bfd_architecture arch; - unsigned long machine; -{ - const bfd_arch_info_type * const *app, *ap; - - for (app = bfd_archures_list; *app != NULL; app++) - { - for (ap = *app; ap != NULL; ap = ap->next) - { - if (ap->arch == arch - && (ap->mach == machine - || (machine == 0 && ap->the_default))) - return ap; - } - } - - return NULL; -} - - -/* -FUNCTION - bfd_printable_arch_mach - -SYNOPSIS - const char *bfd_printable_arch_mach - (enum bfd_architecture arch, unsigned long machine); - -DESCRIPTION - Return a printable string representing the architecture and - machine type. - - This routine is depreciated. -*/ - -const char * -bfd_printable_arch_mach (arch, machine) - enum bfd_architecture arch; - unsigned long machine; -{ - const bfd_arch_info_type *ap = bfd_lookup_arch (arch, machine); - - if (ap) - return ap->printable_name; - return "UNKNOWN!"; -} diff --git a/contrib/gdb/bfd/bfd-in.h b/contrib/gdb/bfd/bfd-in.h deleted file mode 100644 index d291239..0000000 --- a/contrib/gdb/bfd/bfd-in.h +++ /dev/null @@ -1,668 +0,0 @@ -/* Main header file for the bfd library -- portable access to object files. - Copyright 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. - Contributed by Cygnus Support. - -** NOTE: bfd.h and bfd-in2.h are GENERATED files. Don't change them; -** instead, change bfd-in.h or the other BFD source files processed to -** generate these files. - -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. */ - -/* bfd.h -- The only header file required by users of the bfd library - -The bfd.h file is generated from bfd-in.h and various .c files; if you -change it, your changes will probably be lost. - -All the prototypes and definitions following the comment "THE FOLLOWING -IS EXTRACTED FROM THE SOURCE" are extracted from the source files for -BFD. If you change it, someone oneday will extract it from the source -again, and your changes will be lost. To save yourself from this bind, -change the definitions in the source in the bfd directory. Type "make -docs" and then "make headers" in that directory, and magically this file -will change to reflect your changes. - -If you don't have the tools to perform the extraction, then you are -safe from someone on your system trampling over your header files. -You should still maintain the equivalence between the source and this -file though; every change you make to the .c file should be reflected -here. */ - -#ifndef __BFD_H_SEEN__ -#define __BFD_H_SEEN__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "ansidecl.h" -#include "obstack.h" - -/* These two lines get substitutions done by commands in Makefile.in. */ -#define BFD_VERSION "@VERSION@" -#define BFD_ARCH_SIZE @WORDSIZE@ -#define BFD_HOST_64BIT_LONG @BFD_HOST_64BIT_LONG@ - -#if BFD_ARCH_SIZE >= 64 -#define BFD64 -#endif - -#ifndef INLINE -#if __GNUC__ >= 2 -#define INLINE __inline__ -#else -#define INLINE -#endif -#endif - -/* forward declaration */ -typedef struct _bfd bfd; - -/* To squelch erroneous compiler warnings ("illegal pointer - combination") from the SVR3 compiler, we would like to typedef - boolean to int (it doesn't like functions which return boolean. - Making sure they are never implicitly declared to return int - doesn't seem to help). But this file is not configured based on - the host. */ -/* General rules: functions which are boolean return true on success - and false on failure (unless they're a predicate). -- bfd.doc */ -/* I'm sure this is going to break something and someone is going to - force me to change it. */ -/* typedef enum boolean {false, true} boolean; */ -/* Yup, SVR4 has a "typedef enum boolean" in -fnf */ -/* It gets worse if the host also defines a true/false enum... -sts */ -/* And even worse if your compiler has built-in boolean types... -law */ -#if defined (__GNUG__) && (__GNUC_MINOR__ > 5) -#define TRUE_FALSE_ALREADY_DEFINED -#endif -#ifdef MPW -/* Pre-emptive strike - get the file with the enum. */ -#include -#define TRUE_FALSE_ALREADY_DEFINED -#endif /* MPW */ -#ifndef TRUE_FALSE_ALREADY_DEFINED -typedef enum bfd_boolean {false, true} boolean; -#define BFD_TRUE_FALSE -#else -/* Use enum names that will appear nowhere else. */ -typedef enum bfd_boolean {bfd_fffalse, bfd_tttrue} boolean; -#endif - -/* A pointer to a position in a file. */ -/* FIXME: This should be using off_t from . - For now, try to avoid breaking stuff by not including here. - This will break on systems with 64-bit file offsets (e.g. 4.4BSD). - Probably the best long-term answer is to avoid using file_ptr AND off_t - in this header file, and to handle this in the BFD implementation - rather than in its interface. */ -/* typedef off_t file_ptr; */ -typedef long int file_ptr; - -/* Support for different sizes of target format ints and addresses. - If the type `long' is at least 64 bits, BFD_HOST_64BIT_LONG will be - set to 1 above. Otherwise, if gcc is being used, this code will - use gcc's "long long" type. Otherwise, the compilation will fail - if 64-bit targets are requested. */ - -#ifdef BFD64 - -#ifndef BFD_HOST_64_BIT -#if BFD_HOST_64BIT_LONG -#define BFD_HOST_64_BIT long -#else -#ifdef __GNUC__ -#define BFD_HOST_64_BIT long long -#endif /* defined (__GNUC__) */ -#endif /* ! BFD_HOST_64BIT_LONG */ -#endif /* ! defined (BFD_HOST_64_BIT) */ - -typedef unsigned BFD_HOST_64_BIT bfd_vma; -typedef BFD_HOST_64_BIT bfd_signed_vma; -typedef unsigned BFD_HOST_64_BIT bfd_size_type; -typedef unsigned BFD_HOST_64_BIT symvalue; - -#ifndef fprintf_vma -#if BFD_HOST_64BIT_LONG -#define sprintf_vma(s,x) sprintf (s, "%016lx", x) -#define fprintf_vma(f,x) fprintf (f, "%016lx", x) -#else -#define _bfd_int64_low(x) ((unsigned long) (((x) & 0xffffffff))) -#define _bfd_int64_high(x) ((unsigned long) (((x) >> 32) & 0xffffffff)) -#define fprintf_vma(s,x) \ - fprintf ((s), "%08lx%08lx", _bfd_int64_high (x), _bfd_int64_low (x)) -#define sprintf_vma(s,x) \ - sprintf ((s), "%08lx%08lx", _bfd_int64_high (x), _bfd_int64_low (x)) -#endif -#endif - -#else /* not BFD64 */ - -/* Represent a target address. Also used as a generic unsigned type - which is guaranteed to be big enough to hold any arithmetic types - we need to deal with. */ -typedef unsigned long bfd_vma; - -/* A generic signed type which is guaranteed to be big enough to hold any - arithmetic types we need to deal with. Can be assumed to be compatible - with bfd_vma in the same way that signed and unsigned ints are compatible - (as parameters, in assignment, etc). */ -typedef long bfd_signed_vma; - -typedef unsigned long symvalue; -typedef unsigned long bfd_size_type; - -/* Print a bfd_vma x on stream s. */ -#define fprintf_vma(s,x) fprintf(s, "%08lx", x) -#define sprintf_vma(s,x) sprintf(s, "%08lx", x) -#endif /* not BFD64 */ -#define printf_vma(x) fprintf_vma(stdout,x) - -typedef unsigned int flagword; /* 32 bits of flags */ -typedef unsigned char bfd_byte; - -/** File formats */ - -typedef enum bfd_format { - bfd_unknown = 0, /* file format is unknown */ - bfd_object, /* linker/assember/compiler output */ - bfd_archive, /* object archive file */ - bfd_core, /* core dump */ - bfd_type_end} /* marks the end; don't use it! */ - bfd_format; - -/* Values that may appear in the flags field of a BFD. These also - appear in the object_flags field of the bfd_target structure, where - they indicate the set of flags used by that backend (not all flags - are meaningful for all object file formats) (FIXME: at the moment, - the object_flags values have mostly just been copied from backend - to another, and are not necessarily correct). */ - -/* No flags. */ -#define NO_FLAGS 0x00 - -/* BFD contains relocation entries. */ -#define HAS_RELOC 0x01 - -/* BFD is directly executable. */ -#define EXEC_P 0x02 - -/* BFD has line number information (basically used for F_LNNO in a - COFF header). */ -#define HAS_LINENO 0x04 - -/* BFD has debugging information. */ -#define HAS_DEBUG 0x08 - -/* BFD has symbols. */ -#define HAS_SYMS 0x10 - -/* BFD has local symbols (basically used for F_LSYMS in a COFF - header). */ -#define HAS_LOCALS 0x20 - -/* BFD is a dynamic object. */ -#define DYNAMIC 0x40 - -/* Text section is write protected (if D_PAGED is not set, this is - like an a.out NMAGIC file) (the linker sets this by default, but - clears it for -r or -N). */ -#define WP_TEXT 0x80 - -/* BFD is dynamically paged (this is like an a.out ZMAGIC file) (the - linker sets this by default, but clears it for -r or -n or -N). */ -#define D_PAGED 0x100 - -/* BFD is relaxable (this means that bfd_relax_section may be able to - do something) (sometimes bfd_relax_section can do something even if - this is not set). */ -#define BFD_IS_RELAXABLE 0x200 - -/* This may be set before writing out a BFD to request using a - traditional format. For example, this is used to request that when - writing out an a.out object the symbols not be hashed to eliminate - duplicates. */ -#define BFD_TRADITIONAL_FORMAT 0x400 - -/* This flag indicates that the BFD contents are actually cached in - memory. If this is set, iostream points to a bfd_in_memory struct. */ -#define BFD_IN_MEMORY 0x800 - -/* symbols and relocation */ - -/* A count of carsyms (canonical archive symbols). */ -typedef unsigned long symindex; - -/* How to perform a relocation. */ -typedef const struct reloc_howto_struct reloc_howto_type; - -#define BFD_NO_MORE_SYMBOLS ((symindex) ~0) - -/* General purpose part of a symbol X; - target specific parts are in libcoff.h, libaout.h, etc. */ - -#define bfd_get_section(x) ((x)->section) -#define bfd_get_output_section(x) ((x)->section->output_section) -#define bfd_set_section(x,y) ((x)->section) = (y) -#define bfd_asymbol_base(x) ((x)->section->vma) -#define bfd_asymbol_value(x) (bfd_asymbol_base(x) + (x)->value) -#define bfd_asymbol_name(x) ((x)->name) -/*Perhaps future: #define bfd_asymbol_bfd(x) ((x)->section->owner)*/ -#define bfd_asymbol_bfd(x) ((x)->the_bfd) -#define bfd_asymbol_flavour(x) (bfd_asymbol_bfd(x)->xvec->flavour) - -/* A canonical archive symbol. */ -/* This is a type pun with struct ranlib on purpose! */ -typedef struct carsym { - char *name; - file_ptr file_offset; /* look here to find the file */ -} carsym; /* to make these you call a carsymogen */ - - -/* Used in generating armaps (archive tables of contents). - Perhaps just a forward definition would do? */ -struct orl { /* output ranlib */ - char **name; /* symbol name */ - file_ptr pos; /* bfd* or file position */ - int namidx; /* index into string table */ -}; - - -/* Linenumber stuff */ -typedef struct lineno_cache_entry { - unsigned int line_number; /* Linenumber from start of function*/ - union { - struct symbol_cache_entry *sym; /* Function name */ - unsigned long offset; /* Offset into section */ - } u; -} alent; - -/* object and core file sections */ - -#define align_power(addr, align) \ - ( ((addr) + ((1<<(align))-1)) & (-1 << (align))) - -typedef struct sec *sec_ptr; - -#define bfd_get_section_name(bfd, ptr) ((ptr)->name + 0) -#define bfd_get_section_vma(bfd, ptr) ((ptr)->vma + 0) -#define bfd_get_section_alignment(bfd, ptr) ((ptr)->alignment_power + 0) -#define bfd_section_name(bfd, ptr) ((ptr)->name) -#define bfd_section_size(bfd, ptr) (bfd_get_section_size_before_reloc(ptr)) -#define bfd_section_vma(bfd, ptr) ((ptr)->vma) -#define bfd_section_alignment(bfd, ptr) ((ptr)->alignment_power) -#define bfd_get_section_flags(bfd, ptr) ((ptr)->flags + 0) -#define bfd_get_section_userdata(bfd, ptr) ((ptr)->userdata) - -#define bfd_is_com_section(ptr) (((ptr)->flags & SEC_IS_COMMON) != 0) - -#define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (ptr)->lma= (val)), ((ptr)->user_set_vma = (boolean)true), true) -#define bfd_set_section_alignment(bfd, ptr, val) (((ptr)->alignment_power = (val)),true) -#define bfd_set_section_userdata(bfd, ptr, val) (((ptr)->userdata = (val)),true) - -typedef struct stat stat_type; - -typedef enum bfd_print_symbol -{ - bfd_print_symbol_name, - bfd_print_symbol_more, - bfd_print_symbol_all -} bfd_print_symbol_type; - -/* Information about a symbol that nm needs. */ - -typedef struct _symbol_info -{ - symvalue value; - char type; - CONST char *name; /* Symbol name. */ - unsigned char stab_type; /* Stab type. */ - char stab_other; /* Stab other. */ - short stab_desc; /* Stab desc. */ - CONST char *stab_name; /* String for stab type. */ -} symbol_info; - -/* Get the name of a stabs type code. */ - -extern const char *bfd_get_stab_name PARAMS ((int)); - -/* Hash table routines. There is no way to free up a hash table. */ - -/* An element in the hash table. Most uses will actually use a larger - structure, and an instance of this will be the first field. */ - -struct bfd_hash_entry -{ - /* Next entry for this hash code. */ - struct bfd_hash_entry *next; - /* String being hashed. */ - const char *string; - /* Hash code. This is the full hash code, not the index into the - table. */ - unsigned long hash; -}; - -/* A hash table. */ - -struct bfd_hash_table -{ - /* The hash array. */ - struct bfd_hash_entry **table; - /* The number of slots in the hash table. */ - unsigned int size; - /* A function used to create new elements in the hash table. The - first entry is itself a pointer to an element. When this - function is first invoked, this pointer will be NULL. However, - having the pointer permits a hierarchy of method functions to be - built each of which calls the function in the superclass. Thus - each function should be written to allocate a new block of memory - only if the argument is NULL. */ - struct bfd_hash_entry *(*newfunc) PARAMS ((struct bfd_hash_entry *, - struct bfd_hash_table *, - const char *)); - /* An obstack for this hash table. */ - struct obstack memory; -}; - -/* Initialize a hash table. */ -extern boolean bfd_hash_table_init - PARAMS ((struct bfd_hash_table *, - struct bfd_hash_entry *(*) (struct bfd_hash_entry *, - struct bfd_hash_table *, - const char *))); - -/* Initialize a hash table specifying a size. */ -extern boolean bfd_hash_table_init_n - PARAMS ((struct bfd_hash_table *, - struct bfd_hash_entry *(*) (struct bfd_hash_entry *, - struct bfd_hash_table *, - const char *), - unsigned int size)); - -/* Free up a hash table. */ -extern void bfd_hash_table_free PARAMS ((struct bfd_hash_table *)); - -/* Look up a string in a hash table. If CREATE is true, a new entry - will be created for this string if one does not already exist. The - COPY argument must be true if this routine should copy the string - into newly allocated memory when adding an entry. */ -extern struct bfd_hash_entry *bfd_hash_lookup - PARAMS ((struct bfd_hash_table *, const char *, boolean create, - boolean copy)); - -/* Replace an entry in a hash table. */ -extern void bfd_hash_replace - PARAMS ((struct bfd_hash_table *, struct bfd_hash_entry *old, - struct bfd_hash_entry *nw)); - -/* Base method for creating a hash table entry. */ -extern struct bfd_hash_entry *bfd_hash_newfunc - PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, - const char *)); - -/* Grab some space for a hash table entry. */ -extern PTR bfd_hash_allocate PARAMS ((struct bfd_hash_table *, - unsigned int)); - -/* Traverse a hash table in a random order, calling a function on each - element. If the function returns false, the traversal stops. The - INFO argument is passed to the function. */ -extern void bfd_hash_traverse PARAMS ((struct bfd_hash_table *, - boolean (*) (struct bfd_hash_entry *, - PTR), - PTR info)); - -/* Semi-portable string concatenation in cpp. - The CAT4 hack is to avoid a problem with some strict ANSI C preprocessors. - The problem is, "32_" is not a valid preprocessing token, and we don't - want extra underscores (e.g., "nlm_32_"). The XCAT2 macro will cause the - inner CAT macros to be evaluated first, producing still-valid pp-tokens. - Then the final concatenation can be done. (Sigh.) */ -#ifndef CAT -#ifdef SABER -#define CAT(a,b) a##b -#define CAT3(a,b,c) a##b##c -#define CAT4(a,b,c,d) a##b##c##d -#else -#if defined(__STDC__) || defined(ALMOST_STDC) -#define CAT(a,b) a##b -#define CAT3(a,b,c) a##b##c -#define XCAT2(a,b) CAT(a,b) -#define CAT4(a,b,c,d) XCAT2(CAT(a,b),CAT(c,d)) -#else -#define CAT(a,b) a/**/b -#define CAT3(a,b,c) a/**/b/**/c -#define CAT4(a,b,c,d) a/**/b/**/c/**/d -#endif -#endif -#endif - -#define COFF_SWAP_TABLE (PTR) &bfd_coff_std_swap_table - -/* User program access to BFD facilities */ - -/* Direct I/O routines, for programs which know more about the object - file than BFD does. Use higher level routines if possible. */ - -extern bfd_size_type bfd_read - PARAMS ((PTR, bfd_size_type size, bfd_size_type nitems, bfd *abfd)); -extern bfd_size_type bfd_write - PARAMS ((const PTR, bfd_size_type size, bfd_size_type nitems, bfd *abfd)); -extern int bfd_seek PARAMS ((bfd *abfd, file_ptr fp, int direction)); -extern long bfd_tell PARAMS ((bfd *abfd)); -extern int bfd_flush PARAMS ((bfd *abfd)); -extern int bfd_stat PARAMS ((bfd *abfd, struct stat *)); - - -/* Cast from const char * to char * so that caller can assign to - a char * without a warning. */ -#define bfd_get_filename(abfd) ((char *) (abfd)->filename) -#define bfd_get_cacheable(abfd) ((abfd)->cacheable) -#define bfd_get_format(abfd) ((abfd)->format) -#define bfd_get_target(abfd) ((abfd)->xvec->name) -#define bfd_get_flavour(abfd) ((abfd)->xvec->flavour) -#define bfd_big_endian(abfd) ((abfd)->xvec->byteorder == BFD_ENDIAN_BIG) -#define bfd_little_endian(abfd) ((abfd)->xvec->byteorder == BFD_ENDIAN_LITTLE) -#define bfd_header_big_endian(abfd) \ - ((abfd)->xvec->header_byteorder == BFD_ENDIAN_BIG) -#define bfd_header_little_endian(abfd) \ - ((abfd)->xvec->header_byteorder == BFD_ENDIAN_LITTLE) -#define bfd_get_file_flags(abfd) ((abfd)->flags) -#define bfd_applicable_file_flags(abfd) ((abfd)->xvec->object_flags) -#define bfd_applicable_section_flags(abfd) ((abfd)->xvec->section_flags) -#define bfd_my_archive(abfd) ((abfd)->my_archive) -#define bfd_has_map(abfd) ((abfd)->has_armap) - -#define bfd_valid_reloc_types(abfd) ((abfd)->xvec->valid_reloc_types) -#define bfd_usrdata(abfd) ((abfd)->usrdata) - -#define bfd_get_start_address(abfd) ((abfd)->start_address) -#define bfd_get_symcount(abfd) ((abfd)->symcount) -#define bfd_get_outsymbols(abfd) ((abfd)->outsymbols) -#define bfd_count_sections(abfd) ((abfd)->section_count) - -#define bfd_get_symbol_leading_char(abfd) ((abfd)->xvec->symbol_leading_char) - -#define bfd_set_cacheable(abfd,bool) (((abfd)->cacheable = (boolean)(bool)), true) - -extern boolean bfd_record_phdr - PARAMS ((bfd *, unsigned long, boolean, flagword, boolean, bfd_vma, - boolean, boolean, unsigned int, struct sec **)); - -/* Byte swapping routines. */ - -bfd_vma bfd_getb64 PARAMS ((const unsigned char *)); -bfd_vma bfd_getl64 PARAMS ((const unsigned char *)); -bfd_signed_vma bfd_getb_signed_64 PARAMS ((const unsigned char *)); -bfd_signed_vma bfd_getl_signed_64 PARAMS ((const unsigned char *)); -bfd_vma bfd_getb32 PARAMS ((const unsigned char *)); -bfd_vma bfd_getl32 PARAMS ((const unsigned char *)); -bfd_signed_vma bfd_getb_signed_32 PARAMS ((const unsigned char *)); -bfd_signed_vma bfd_getl_signed_32 PARAMS ((const unsigned char *)); -bfd_vma bfd_getb16 PARAMS ((const unsigned char *)); -bfd_vma bfd_getl16 PARAMS ((const unsigned char *)); -bfd_signed_vma bfd_getb_signed_16 PARAMS ((const unsigned char *)); -bfd_signed_vma bfd_getl_signed_16 PARAMS ((const unsigned char *)); -void bfd_putb64 PARAMS ((bfd_vma, unsigned char *)); -void bfd_putl64 PARAMS ((bfd_vma, unsigned char *)); -void bfd_putb32 PARAMS ((bfd_vma, unsigned char *)); -void bfd_putl32 PARAMS ((bfd_vma, unsigned char *)); -void bfd_putb16 PARAMS ((bfd_vma, unsigned char *)); -void bfd_putl16 PARAMS ((bfd_vma, unsigned char *)); - -/* Externally visible ECOFF routines. */ - -#if defined(__STDC__) || defined(ALMOST_STDC) -struct ecoff_debug_info; -struct ecoff_debug_swap; -struct ecoff_extr; -struct symbol_cache_entry; -struct bfd_link_info; -struct bfd_link_hash_entry; -#endif -extern bfd_vma bfd_ecoff_get_gp_value PARAMS ((bfd * abfd)); -extern boolean bfd_ecoff_set_gp_value PARAMS ((bfd *abfd, bfd_vma gp_value)); -extern boolean bfd_ecoff_set_regmasks - PARAMS ((bfd *abfd, unsigned long gprmask, unsigned long fprmask, - unsigned long *cprmask)); -extern PTR bfd_ecoff_debug_init - PARAMS ((bfd *output_bfd, struct ecoff_debug_info *output_debug, - const struct ecoff_debug_swap *output_swap, - struct bfd_link_info *)); -extern void bfd_ecoff_debug_free - PARAMS ((PTR handle, bfd *output_bfd, struct ecoff_debug_info *output_debug, - const struct ecoff_debug_swap *output_swap, - struct bfd_link_info *)); -extern boolean bfd_ecoff_debug_accumulate - PARAMS ((PTR handle, bfd *output_bfd, struct ecoff_debug_info *output_debug, - const struct ecoff_debug_swap *output_swap, - bfd *input_bfd, struct ecoff_debug_info *input_debug, - const struct ecoff_debug_swap *input_swap, - struct bfd_link_info *)); -extern boolean bfd_ecoff_debug_accumulate_other - PARAMS ((PTR handle, bfd *output_bfd, struct ecoff_debug_info *output_debug, - const struct ecoff_debug_swap *output_swap, bfd *input_bfd, - struct bfd_link_info *)); -extern boolean bfd_ecoff_debug_externals - PARAMS ((bfd *abfd, struct ecoff_debug_info *debug, - const struct ecoff_debug_swap *swap, - boolean relocateable, - boolean (*get_extr) (struct symbol_cache_entry *, - struct ecoff_extr *), - void (*set_index) (struct symbol_cache_entry *, - bfd_size_type))); -extern boolean bfd_ecoff_debug_one_external - PARAMS ((bfd *abfd, struct ecoff_debug_info *debug, - const struct ecoff_debug_swap *swap, - const char *name, struct ecoff_extr *esym)); -extern bfd_size_type bfd_ecoff_debug_size - PARAMS ((bfd *abfd, struct ecoff_debug_info *debug, - const struct ecoff_debug_swap *swap)); -extern boolean bfd_ecoff_write_debug - PARAMS ((bfd *abfd, struct ecoff_debug_info *debug, - const struct ecoff_debug_swap *swap, file_ptr where)); -extern boolean bfd_ecoff_write_accumulated_debug - PARAMS ((PTR handle, bfd *abfd, struct ecoff_debug_info *debug, - const struct ecoff_debug_swap *swap, - struct bfd_link_info *info, file_ptr where)); -extern boolean bfd_mips_ecoff_create_embedded_relocs - PARAMS ((bfd *, struct bfd_link_info *, struct sec *, struct sec *, - char **)); - -/* Externally visible ELF routines. */ - -struct bfd_link_needed_list -{ - struct bfd_link_needed_list *next; - bfd *by; - const char *name; -}; - -extern boolean bfd_elf32_record_link_assignment - PARAMS ((bfd *, struct bfd_link_info *, const char *, boolean)); -extern boolean bfd_elf64_record_link_assignment - PARAMS ((bfd *, struct bfd_link_info *, const char *, boolean)); -extern struct bfd_link_needed_list *bfd_elf_get_needed_list - PARAMS ((bfd *, struct bfd_link_info *)); -extern boolean bfd_elf32_size_dynamic_sections - PARAMS ((bfd *, const char *, const char *, boolean, - struct bfd_link_info *, struct sec **)); -extern boolean bfd_elf64_size_dynamic_sections - PARAMS ((bfd *, const char *, const char *, boolean, - struct bfd_link_info *, struct sec **)); -extern void bfd_elf_set_dt_needed_name PARAMS ((bfd *, const char *)); -extern const char *bfd_elf_get_dt_soname PARAMS ((bfd *)); - -/* SunOS shared library support routines for the linker. */ - -extern struct bfd_link_needed_list *bfd_sunos_get_needed_list - PARAMS ((bfd *, struct bfd_link_info *)); -extern boolean bfd_sunos_record_link_assignment - PARAMS ((bfd *, struct bfd_link_info *, const char *)); -extern boolean bfd_sunos_size_dynamic_sections - PARAMS ((bfd *, struct bfd_link_info *, struct sec **, struct sec **, - struct sec **)); - -/* Linux shared library support routines for the linker. */ - -extern boolean bfd_i386linux_size_dynamic_sections - PARAMS ((bfd *, struct bfd_link_info *)); -extern boolean bfd_m68klinux_size_dynamic_sections - PARAMS ((bfd *, struct bfd_link_info *)); - -/* mmap hacks */ - -struct _bfd_window_internal; -typedef struct _bfd_window_internal bfd_window_internal; - -typedef struct _bfd_window { - /* What the user asked for. */ - PTR data; - bfd_size_type size; - /* The actual window used by BFD. Small user-requested read-only - regions sharing a page may share a single window into the object - file. Read-write versions shouldn't until I've fixed things to - keep track of which portions have been claimed by the - application; don't want to give the same region back when the - application wants two writable copies! */ - struct _bfd_window_internal *i; -} bfd_window; - -extern void bfd_init_window PARAMS ((bfd_window *)); -extern void bfd_free_window PARAMS ((bfd_window *)); -extern boolean bfd_get_file_window - PARAMS ((bfd *, file_ptr, bfd_size_type, bfd_window *, boolean)); - -/* XCOFF support routines for the linker. */ - -extern boolean bfd_xcoff_link_record_set - PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *, - bfd_size_type)); -extern boolean bfd_xcoff_import_symbol - PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *, - bfd_vma, const char *, const char *, const char *)); -extern boolean bfd_xcoff_export_symbol - PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *, - boolean)); -extern boolean bfd_xcoff_link_count_reloc - PARAMS ((bfd *, struct bfd_link_info *, const char *)); -extern boolean bfd_xcoff_record_link_assignment - PARAMS ((bfd *, struct bfd_link_info *, const char *)); -extern boolean bfd_xcoff_size_dynamic_sections - PARAMS ((bfd *, struct bfd_link_info *, const char *, const char *, - unsigned long, unsigned long, unsigned long, boolean, - int, boolean, boolean, struct sec **)); - -/* And more from the source. */ diff --git a/contrib/gdb/bfd/bfd.c b/contrib/gdb/bfd/bfd.c deleted file mode 100644 index 10ec67e..0000000 --- a/contrib/gdb/bfd/bfd.c +++ /dev/null @@ -1,1144 +0,0 @@ -/* Generic BFD library interface and support routines. - Copyright (C) 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. - Written by Cygnus Support. - -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. */ - -/* -SECTION - <> - - A BFD has type <>; objects of this type are the - cornerstone of any application using BFD. Using BFD - consists of making references though the BFD and to data in the BFD. - - Here is the structure that defines the type <>. It - contains the major data about the file and pointers - to the rest of the data. - -CODE_FRAGMENT -. -.struct _bfd -.{ -. {* The filename the application opened the BFD with. *} -. CONST char *filename; -. -. {* A pointer to the target jump table. *} -. const struct bfd_target *xvec; -. -. {* To avoid dragging too many header files into every file that -. includes `<>', IOSTREAM has been declared as a "char -. *", and MTIME as a "long". Their correct types, to which they -. are cast when used, are "FILE *" and "time_t". The iostream -. is the result of an fopen on the filename. However, if the -. BFD_IN_MEMORY flag is set, then iostream is actually a pointer -. to a bfd_in_memory struct. *} -. PTR iostream; -. -. {* Is the file descriptor being cached? That is, can it be closed as -. needed, and re-opened when accessed later? *} -. -. boolean cacheable; -. -. {* Marks whether there was a default target specified when the -. BFD was opened. This is used to select which matching algorithm -. to use to choose the back end. *} -. -. boolean target_defaulted; -. -. {* The caching routines use these to maintain a -. least-recently-used list of BFDs *} -. -. struct _bfd *lru_prev, *lru_next; -. -. {* When a file is closed by the caching routines, BFD retains -. state information on the file here: *} -. -. file_ptr where; -. -. {* and here: (``once'' means at least once) *} -. -. boolean opened_once; -. -. {* Set if we have a locally maintained mtime value, rather than -. getting it from the file each time: *} -. -. boolean mtime_set; -. -. {* File modified time, if mtime_set is true: *} -. -. long mtime; -. -. {* Reserved for an unimplemented file locking extension.*} -. -. int ifd; -. -. {* The format which belongs to the BFD. (object, core, etc.) *} -. -. bfd_format format; -. -. {* The direction the BFD was opened with*} -. -. enum bfd_direction {no_direction = 0, -. read_direction = 1, -. write_direction = 2, -. both_direction = 3} direction; -. -. {* Format_specific flags*} -. -. flagword flags; -. -. {* Currently my_archive is tested before adding origin to -. anything. I believe that this can become always an add of -. origin, with origin set to 0 for non archive files. *} -. -. file_ptr origin; -. -. {* Remember when output has begun, to stop strange things -. from happening. *} -. boolean output_has_begun; -. -. {* Pointer to linked list of sections*} -. struct sec *sections; -. -. {* The number of sections *} -. unsigned int section_count; -. -. {* Stuff only useful for object files: -. The start address. *} -. bfd_vma start_address; -. -. {* Used for input and output*} -. unsigned int symcount; -. -. {* Symbol table for output BFD (with symcount entries) *} -. struct symbol_cache_entry **outsymbols; -. -. {* Pointer to structure which contains architecture information*} -. const struct bfd_arch_info *arch_info; -. -. {* Stuff only useful for archives:*} -. PTR arelt_data; -. struct _bfd *my_archive; {* The containing archive BFD. *} -. struct _bfd *next; {* The next BFD in the archive. *} -. struct _bfd *archive_head; {* The first BFD in the archive. *} -. boolean has_armap; -. -. {* A chain of BFD structures involved in a link. *} -. struct _bfd *link_next; -. -. {* A field used by _bfd_generic_link_add_archive_symbols. This will -. be used only for archive elements. *} -. int archive_pass; -. -. {* Used by the back end to hold private data. *} -. -. union -. { -. struct aout_data_struct *aout_data; -. struct artdata *aout_ar_data; -. struct _oasys_data *oasys_obj_data; -. struct _oasys_ar_data *oasys_ar_data; -. struct coff_tdata *coff_obj_data; -. struct pe_tdata *pe_obj_data; -. struct xcoff_tdata *xcoff_obj_data; -. struct ecoff_tdata *ecoff_obj_data; -. struct ieee_data_struct *ieee_data; -. struct ieee_ar_data_struct *ieee_ar_data; -. struct srec_data_struct *srec_data; -. struct ihex_data_struct *ihex_data; -. struct tekhex_data_struct *tekhex_data; -. struct elf_obj_tdata *elf_obj_data; -. struct nlm_obj_tdata *nlm_obj_data; -. struct bout_data_struct *bout_data; -. struct sun_core_struct *sun_core_data; -. struct trad_core_struct *trad_core_data; -. struct som_data_struct *som_data; -. struct hpux_core_struct *hpux_core_data; -. struct hppabsd_core_struct *hppabsd_core_data; -. struct sgi_core_struct *sgi_core_data; -. struct lynx_core_struct *lynx_core_data; -. struct osf_core_struct *osf_core_data; -. struct cisco_core_struct *cisco_core_data; -. struct versados_data_struct *versados_data; -. struct netbsd_core_struct *netbsd_core_data; -. PTR any; -. } tdata; -. -. {* Used by the application to hold private data*} -. PTR usrdata; -. -. {* Where all the allocated stuff under this BFD goes *} -. struct obstack memory; -.}; -. -*/ - -#include "bfd.h" -#include "sysdep.h" - -#ifdef ANSI_PROTOTYPES -#include -#else -#include -#endif - -#include "bfdlink.h" -#include "libbfd.h" -#include "coff/internal.h" -#include "coff/sym.h" -#include "libcoff.h" -#include "libecoff.h" -#undef obj_symbols -#include "elf-bfd.h" - -#include - -/* provide storage for subsystem, stack and heap data which may have been - passed in on the command line. Ld puts this data into a bfd_link_info - struct which ultimately gets passed in to the bfd. When it arrives, copy - it to the following struct so that the data will be available in coffcode.h - where it is needed. The typedef's used are defined in bfd.h */ - - - -/* -SECTION - Error reporting - - Most BFD functions return nonzero on success (check their - individual documentation for precise semantics). On an error, - they call <> to set an error condition that callers - can check by calling <>. - If that returns <>, then check - <>. - - The easiest way to report a BFD error to the user is to - use <>. - -SUBSECTION - Type <> - - The values returned by <> are defined by the - enumerated type <>. - -CODE_FRAGMENT -. -.typedef enum bfd_error -.{ -. bfd_error_no_error = 0, -. bfd_error_system_call, -. bfd_error_invalid_target, -. bfd_error_wrong_format, -. bfd_error_invalid_operation, -. bfd_error_no_memory, -. bfd_error_no_symbols, -. bfd_error_no_armap, -. bfd_error_no_more_archived_files, -. bfd_error_malformed_archive, -. bfd_error_file_not_recognized, -. bfd_error_file_ambiguously_recognized, -. bfd_error_no_contents, -. bfd_error_nonrepresentable_section, -. bfd_error_no_debug_section, -. bfd_error_bad_value, -. bfd_error_file_truncated, -. bfd_error_file_too_big, -. bfd_error_invalid_error_code -.} bfd_error_type; -. -*/ - -#undef strerror -extern char *strerror(); - -static bfd_error_type bfd_error = bfd_error_no_error; - -CONST char *CONST bfd_errmsgs[] = { - "No error", - "System call error", - "Invalid bfd target", - "File in wrong format", - "Invalid operation", - "Memory exhausted", - "No symbols", - "Archive has no index; run ranlib to add one", - "No more archived files", - "Malformed archive", - "File format not recognized", - "File format is ambiguous", - "Section has no contents", - "Nonrepresentable section on output", - "Symbol needs debug section which does not exist", - "Bad value", - "File truncated", - "File too big", - "#" - }; - -/* -FUNCTION - bfd_get_error - -SYNOPSIS - bfd_error_type bfd_get_error (void); - -DESCRIPTION - Return the current BFD error condition. -*/ - -bfd_error_type -bfd_get_error () -{ - return bfd_error; -} - -/* -FUNCTION - bfd_set_error - -SYNOPSIS - void bfd_set_error (bfd_error_type error_tag); - -DESCRIPTION - Set the BFD error condition to be @var{error_tag}. -*/ - -void -bfd_set_error (error_tag) - bfd_error_type error_tag; -{ - bfd_error = error_tag; -} - -/* -FUNCTION - bfd_errmsg - -SYNOPSIS - CONST char *bfd_errmsg (bfd_error_type error_tag); - -DESCRIPTION - Return a string describing the error @var{error_tag}, or - the system error if @var{error_tag} is <>. -*/ - -CONST char * -bfd_errmsg (error_tag) - bfd_error_type error_tag; -{ -#ifndef errno - extern int errno; -#endif - if (error_tag == bfd_error_system_call) - { - const char *errmsg; - - errmsg = strerror (errno); - if (errmsg == NULL) - { - static char buf[32]; - - sprintf (buf, "Error %d", errno); - errmsg = buf; - } - return errmsg; - } - - if ((((int)error_tag <(int) bfd_error_no_error) || - ((int)error_tag > (int)bfd_error_invalid_error_code))) - error_tag = bfd_error_invalid_error_code;/* sanity check */ - - return bfd_errmsgs [(int)error_tag]; -} - -/* -FUNCTION - bfd_perror - -SYNOPSIS - void bfd_perror (CONST char *message); - -DESCRIPTION - Print to the standard error stream a string describing the - last BFD error that occurred, or the last system error if - the last BFD error was a system call failure. If @var{message} - is non-NULL and non-empty, the error string printed is preceded - by @var{message}, a colon, and a space. It is followed by a newline. -*/ - -void -bfd_perror (message) - CONST char *message; -{ - if (bfd_get_error () == bfd_error_system_call) - perror((char *)message); /* must be system error then... */ - else { - if (message == NULL || *message == '\0') - fprintf (stderr, "%s\n", bfd_errmsg (bfd_get_error ())); - else - fprintf (stderr, "%s: %s\n", message, bfd_errmsg (bfd_get_error ())); - } -} - -/* -SUBSECTION - BFD error handler - - Some BFD functions want to print messages describing the - problem. They call a BFD error handler function. This - function may be overriden by the program. - - The BFD error handler acts like printf. - -CODE_FRAGMENT -. -.typedef void (*bfd_error_handler_type) PARAMS ((const char *, ...)); -. -*/ - -/* The program name used when printing BFD error messages. */ - -static const char *_bfd_error_program_name; - -/* This is the default routine to handle BFD error messages. */ - -#ifdef ANSI_PROTOTYPES - -static void _bfd_default_error_handler PARAMS ((const char *s, ...)); - -static void -_bfd_default_error_handler (const char *s, ...) -{ - va_list p; - - if (_bfd_error_program_name != NULL) - fprintf (stderr, "%s: ", _bfd_error_program_name); - - va_start (p, s); - - vfprintf (stderr, s, p); - - va_end (p); - - fprintf (stderr, "\n"); -} - -#else /* ! defined (ANSI_PROTOTYPES) */ - -static void _bfd_default_error_handler (); - -static void -_bfd_default_error_handler (va_alist) - va_dcl -{ - va_list p; - const char *s; - - if (_bfd_error_program_name != NULL) - fprintf (stderr, "%s: ", _bfd_error_program_name); - - va_start (p); - - s = va_arg (p, const char *); - vfprintf (stderr, s, p); - - va_end (p); - - fprintf (stderr, "\n"); -} - -#endif /* ! defined (ANSI_PROTOTYPES) */ - -/* This is a function pointer to the routine which should handle BFD - error messages. It is called when a BFD routine encounters an - error for which it wants to print a message. Going through a - function pointer permits a program linked against BFD to intercept - the messages and deal with them itself. */ - -bfd_error_handler_type _bfd_error_handler = _bfd_default_error_handler; - -/* -FUNCTION - bfd_set_error_handler - -SYNOPSIS - bfd_error_handler_type bfd_set_error_handler (bfd_error_handler_type); - -DESCRIPTION - Set the BFD error handler function. Returns the previous - function. -*/ - -bfd_error_handler_type -bfd_set_error_handler (pnew) - bfd_error_handler_type pnew; -{ - bfd_error_handler_type pold; - - pold = _bfd_error_handler; - _bfd_error_handler = pnew; - return pold; -} - -/* -FUNCTION - bfd_set_error_program_name - -SYNOPSIS - void bfd_set_error_program_name (const char *); - -DESCRIPTION - Set the program name to use when printing a BFD error. This - is printed before the error message followed by a colon and - space. The string must not be changed after it is passed to - this function. -*/ - -void -bfd_set_error_program_name (name) - const char *name; -{ - _bfd_error_program_name = name; -} - -/* -SECTION - Symbols -*/ - -/* -FUNCTION - bfd_get_reloc_upper_bound - -SYNOPSIS - long bfd_get_reloc_upper_bound(bfd *abfd, asection *sect); - -DESCRIPTION - Return the number of bytes required to store the - relocation information associated with section @var{sect} - attached to bfd @var{abfd}. If an error occurs, return -1. - -*/ - - -long -bfd_get_reloc_upper_bound (abfd, asect) - bfd *abfd; - sec_ptr asect; -{ - if (abfd->format != bfd_object) { - bfd_set_error (bfd_error_invalid_operation); - return -1; - } - - return BFD_SEND (abfd, _get_reloc_upper_bound, (abfd, asect)); -} - -/* -FUNCTION - bfd_canonicalize_reloc - -SYNOPSIS - long bfd_canonicalize_reloc - (bfd *abfd, - asection *sec, - arelent **loc, - asymbol **syms); - -DESCRIPTION - Call the back end associated with the open BFD - @var{abfd} and translate the external form of the relocation - information attached to @var{sec} into the internal canonical - form. Place the table into memory at @var{loc}, which has - been preallocated, usually by a call to - <>. Returns the number of relocs, or - -1 on error. - - The @var{syms} table is also needed for horrible internal magic - reasons. - - -*/ -long -bfd_canonicalize_reloc (abfd, asect, location, symbols) - bfd *abfd; - sec_ptr asect; - arelent **location; - asymbol **symbols; -{ - if (abfd->format != bfd_object) { - bfd_set_error (bfd_error_invalid_operation); - return -1; - } - return BFD_SEND (abfd, _bfd_canonicalize_reloc, - (abfd, asect, location, symbols)); -} - -/* -FUNCTION - bfd_set_reloc - -SYNOPSIS - void bfd_set_reloc - (bfd *abfd, asection *sec, arelent **rel, unsigned int count) - -DESCRIPTION - Set the relocation pointer and count within - section @var{sec} to the values @var{rel} and @var{count}. - The argument @var{abfd} is ignored. - -*/ -/*ARGSUSED*/ -void -bfd_set_reloc (ignore_abfd, asect, location, count) - bfd *ignore_abfd; - sec_ptr asect; - arelent **location; - unsigned int count; -{ - asect->orelocation = location; - asect->reloc_count = count; -} - -/* -FUNCTION - bfd_set_file_flags - -SYNOPSIS - boolean bfd_set_file_flags(bfd *abfd, flagword flags); - -DESCRIPTION - Set the flag word in the BFD @var{abfd} to the value @var{flags}. - - Possible errors are: - o <> - The target bfd was not of object format. - o <> - The target bfd was open for reading. - o <> - - The flag word contained a bit which was not applicable to the - type of file. E.g., an attempt was made to set the <> bit - on a BFD format which does not support demand paging. - -*/ - -boolean -bfd_set_file_flags (abfd, flags) - bfd *abfd; - flagword flags; -{ - if (abfd->format != bfd_object) { - bfd_set_error (bfd_error_wrong_format); - return false; - } - - if (bfd_read_p (abfd)) { - bfd_set_error (bfd_error_invalid_operation); - return false; - } - - bfd_get_file_flags (abfd) = flags; - if ((flags & bfd_applicable_file_flags (abfd)) != flags) { - bfd_set_error (bfd_error_invalid_operation); - return false; - } - -return true; -} - -void -bfd_assert (file, line) - const char *file; - int line; -{ - (*_bfd_error_handler) ("bfd assertion fail %s:%d", file, line); -} - - -/* -FUNCTION - bfd_set_start_address - -SYNOPSIS - boolean bfd_set_start_address(bfd *abfd, bfd_vma vma); - -DESCRIPTION - Make @var{vma} the entry point of output BFD @var{abfd}. - -RETURNS - Returns <> on success, <> otherwise. -*/ - -boolean -bfd_set_start_address(abfd, vma) -bfd *abfd; -bfd_vma vma; -{ - abfd->start_address = vma; - return true; -} - - -/* -FUNCTION - bfd_get_mtime - -SYNOPSIS - long bfd_get_mtime(bfd *abfd); - -DESCRIPTION - Return the file modification time (as read from the file system, or - from the archive header for archive members). - -*/ - -long -bfd_get_mtime (abfd) - bfd *abfd; -{ - FILE *fp; - struct stat buf; - - if (abfd->mtime_set) - return abfd->mtime; - - fp = bfd_cache_lookup (abfd); - if (0 != fstat (fileno (fp), &buf)) - return 0; - - abfd->mtime = buf.st_mtime; /* Save value in case anyone wants it */ - return buf.st_mtime; -} - -/* -FUNCTION - bfd_get_size - -SYNOPSIS - long bfd_get_size(bfd *abfd); - -DESCRIPTION - Return the file size (as read from file system) for the file - associated with BFD @var{abfd}. - - The initial motivation for, and use of, this routine is not - so we can get the exact size of the object the BFD applies to, since - that might not be generally possible (archive members for example). - It would be ideal if someone could eventually modify - it so that such results were guaranteed. - - Instead, we want to ask questions like "is this NNN byte sized - object I'm about to try read from file offset YYY reasonable?" - As as example of where we might do this, some object formats - use string tables for which the first <> bytes of the - table contain the size of the table itself, including the size bytes. - If an application tries to read what it thinks is one of these - string tables, without some way to validate the size, and for - some reason the size is wrong (byte swapping error, wrong location - for the string table, etc.), the only clue is likely to be a read - error when it tries to read the table, or a "virtual memory - exhausted" error when it tries to allocate 15 bazillon bytes - of space for the 15 bazillon byte table it is about to read. - This function at least allows us to answer the quesion, "is the - size reasonable?". -*/ - -long -bfd_get_size (abfd) - bfd *abfd; -{ - FILE *fp; - struct stat buf; - - if ((abfd->flags & BFD_IN_MEMORY) != 0) - return ((struct bfd_in_memory *) abfd->iostream)->size; - - fp = bfd_cache_lookup (abfd); - if (0 != fstat (fileno (fp), &buf)) - return 0; - - return buf.st_size; -} - -/* -FUNCTION - bfd_get_gp_size - -SYNOPSIS - int bfd_get_gp_size(bfd *abfd); - -DESCRIPTION - Return the maximum size of objects to be optimized using the GP - register under MIPS ECOFF. This is typically set by the <<-G>> - argument to the compiler, assembler or linker. -*/ - -int -bfd_get_gp_size (abfd) - bfd *abfd; -{ - if (abfd->format == bfd_object) - { - if (abfd->xvec->flavour == bfd_target_ecoff_flavour) - return ecoff_data (abfd)->gp_size; - else if (abfd->xvec->flavour == bfd_target_elf_flavour) - return elf_gp_size (abfd); - } - return 0; -} - -/* -FUNCTION - bfd_set_gp_size - -SYNOPSIS - void bfd_set_gp_size(bfd *abfd, int i); - -DESCRIPTION - Set the maximum size of objects to be optimized using the GP - register under ECOFF or MIPS ELF. This is typically set by - the <<-G>> argument to the compiler, assembler or linker. -*/ - -void -bfd_set_gp_size (abfd, i) - bfd *abfd; - int i; -{ - /* Don't try to set GP size on an archive or core file! */ - if (abfd->format != bfd_object) - return; - if (abfd->xvec->flavour == bfd_target_ecoff_flavour) - ecoff_data (abfd)->gp_size = i; - else if (abfd->xvec->flavour == bfd_target_elf_flavour) - elf_gp_size (abfd) = i; -} - -/* Get the GP value. This is an internal function used by some of the - relocation special_function routines on targets which support a GP - register. */ - -bfd_vma -_bfd_get_gp_value (abfd) - bfd *abfd; -{ - if (abfd->format == bfd_object) - { - if (abfd->xvec->flavour == bfd_target_ecoff_flavour) - return ecoff_data (abfd)->gp; - else if (abfd->xvec->flavour == bfd_target_elf_flavour) - return elf_gp (abfd); - } - return 0; -} - -/* Set the GP value. */ - -void -_bfd_set_gp_value (abfd, v) - bfd *abfd; - bfd_vma v; -{ - if (abfd->format != bfd_object) - return; - if (abfd->xvec->flavour == bfd_target_ecoff_flavour) - ecoff_data (abfd)->gp = v; - else if (abfd->xvec->flavour == bfd_target_elf_flavour) - elf_gp (abfd) = v; -} - -/* -FUNCTION - bfd_scan_vma - -SYNOPSIS - bfd_vma bfd_scan_vma(CONST char *string, CONST char **end, int base); - -DESCRIPTION - Convert, like <>, a numerical expression - @var{string} into a <> integer, and return that integer. - (Though without as many bells and whistles as <>.) - The expression is assumed to be unsigned (i.e., positive). - If given a @var{base}, it is used as the base for conversion. - A base of 0 causes the function to interpret the string - in hex if a leading "0x" or "0X" is found, otherwise - in octal if a leading zero is found, otherwise in decimal. - - Overflow is not detected. -*/ - -bfd_vma -bfd_scan_vma (string, end, base) - CONST char *string; - CONST char **end; - int base; -{ - bfd_vma value; - int digit; - - /* Let the host do it if possible. */ - if (sizeof(bfd_vma) <= sizeof(unsigned long)) - return (bfd_vma) strtoul (string, (char **) end, base); - - /* A negative base makes no sense, and we only need to go as high as hex. */ - if ((base < 0) || (base > 16)) - return (bfd_vma) 0; - - if (base == 0) - { - if (string[0] == '0') - { - if ((string[1] == 'x') || (string[1] == 'X')) - base = 16; - /* XXX should we also allow "0b" or "0B" to set base to 2? */ - else - base = 8; - } - else - base = 10; - } - if ((base == 16) && - (string[0] == '0') && ((string[1] == 'x') || (string[1] == 'X'))) - string += 2; - /* XXX should we also skip over "0b" or "0B" if base is 2? */ - -/* Speed could be improved with a table like hex_value[] in gas. */ -#define HEX_VALUE(c) \ - (isxdigit(c) ? \ - (isdigit(c) ? \ - (c - '0') : \ - (10 + c - (islower(c) ? 'a' : 'A'))) : \ - 42) - - for (value = 0; (digit = HEX_VALUE(*string)) < base; string++) - { - value = value * base + digit; - } - - if (end) - *end = string; - - return value; -} - -/* -FUNCTION - bfd_copy_private_bfd_data - -SYNOPSIS - boolean bfd_copy_private_bfd_data(bfd *ibfd, bfd *obfd); - -DESCRIPTION - Copy private BFD information from the BFD @var{ibfd} to the - the BFD @var{obfd}. Return <> on success, <> on error. - Possible error returns are: - - o <> - - Not enough memory exists to create private data for @var{obfd}. - -.#define bfd_copy_private_bfd_data(ibfd, obfd) \ -. BFD_SEND (ibfd, _bfd_copy_private_bfd_data, \ -. (ibfd, obfd)) - -*/ - -/* -FUNCTION - bfd_merge_private_bfd_data - -SYNOPSIS - boolean bfd_merge_private_bfd_data(bfd *ibfd, bfd *obfd); - -DESCRIPTION - Merge private BFD information from the BFD @var{ibfd} to the - the output file BFD @var{obfd} when linking. Return <> - on success, <> on error. Possible error returns are: - - o <> - - Not enough memory exists to create private data for @var{obfd}. - -.#define bfd_merge_private_bfd_data(ibfd, obfd) \ -. BFD_SEND (ibfd, _bfd_merge_private_bfd_data, \ -. (ibfd, obfd)) - -*/ - -/* -FUNCTION - bfd_set_private_flags - -SYNOPSIS - boolean bfd_set_private_flags(bfd *abfd, flagword flags); - -DESCRIPTION - Set private BFD flag information in the BFD @var{abfd}. - Return <> on success, <> on error. Possible error - returns are: - - o <> - - Not enough memory exists to create private data for @var{obfd}. - -.#define bfd_set_private_flags(abfd, flags) \ -. BFD_SEND (abfd, _bfd_set_private_flags, \ -. (abfd, flags)) - -*/ - -/* -FUNCTION - stuff - -DESCRIPTION - Stuff which should be documented: - -.#define bfd_sizeof_headers(abfd, reloc) \ -. BFD_SEND (abfd, _bfd_sizeof_headers, (abfd, reloc)) -. -.#define bfd_find_nearest_line(abfd, sec, syms, off, file, func, line) \ -. BFD_SEND (abfd, _bfd_find_nearest_line, (abfd, sec, syms, off, file, func, line)) -. -. {* Do these three do anything useful at all, for any back end? *} -.#define bfd_debug_info_start(abfd) \ -. BFD_SEND (abfd, _bfd_debug_info_start, (abfd)) -. -.#define bfd_debug_info_end(abfd) \ -. BFD_SEND (abfd, _bfd_debug_info_end, (abfd)) -. -.#define bfd_debug_info_accumulate(abfd, section) \ -. BFD_SEND (abfd, _bfd_debug_info_accumulate, (abfd, section)) -. -. -.#define bfd_stat_arch_elt(abfd, stat) \ -. BFD_SEND (abfd, _bfd_stat_arch_elt,(abfd, stat)) -. -.#define bfd_update_armap_timestamp(abfd) \ -. BFD_SEND (abfd, _bfd_update_armap_timestamp, (abfd)) -. -.#define bfd_set_arch_mach(abfd, arch, mach)\ -. BFD_SEND ( abfd, _bfd_set_arch_mach, (abfd, arch, mach)) -. -.#define bfd_relax_section(abfd, section, link_info, again) \ -. BFD_SEND (abfd, _bfd_relax_section, (abfd, section, link_info, again)) -. -.#define bfd_link_hash_table_create(abfd) \ -. BFD_SEND (abfd, _bfd_link_hash_table_create, (abfd)) -. -.#define bfd_link_add_symbols(abfd, info) \ -. BFD_SEND (abfd, _bfd_link_add_symbols, (abfd, info)) -. -.#define bfd_final_link(abfd, info) \ -. BFD_SEND (abfd, _bfd_final_link, (abfd, info)) -. -.#define bfd_free_cached_info(abfd) \ -. BFD_SEND (abfd, _bfd_free_cached_info, (abfd)) -. -.#define bfd_get_dynamic_symtab_upper_bound(abfd) \ -. BFD_SEND (abfd, _bfd_get_dynamic_symtab_upper_bound, (abfd)) -. -.#define bfd_print_private_bfd_data(abfd, file)\ -. BFD_SEND (abfd, _bfd_print_private_bfd_data, (abfd, file)) -. -.#define bfd_canonicalize_dynamic_symtab(abfd, asymbols) \ -. BFD_SEND (abfd, _bfd_canonicalize_dynamic_symtab, (abfd, asymbols)) -. -.#define bfd_get_dynamic_reloc_upper_bound(abfd) \ -. BFD_SEND (abfd, _bfd_get_dynamic_reloc_upper_bound, (abfd)) -. -.#define bfd_canonicalize_dynamic_reloc(abfd, arels, asyms) \ -. BFD_SEND (abfd, _bfd_canonicalize_dynamic_reloc, (abfd, arels, asyms)) -. -.extern bfd_byte *bfd_get_relocated_section_contents -. PARAMS ((bfd *, struct bfd_link_info *, -. struct bfd_link_order *, bfd_byte *, -. boolean, asymbol **)); -. - -*/ - -bfd_byte * -bfd_get_relocated_section_contents (abfd, link_info, link_order, data, - relocateable, symbols) - bfd *abfd; - struct bfd_link_info *link_info; - struct bfd_link_order *link_order; - bfd_byte *data; - boolean relocateable; - asymbol **symbols; -{ - bfd *abfd2; - bfd_byte *(*fn) PARAMS ((bfd *, struct bfd_link_info *, - struct bfd_link_order *, bfd_byte *, boolean, - asymbol **)); - - if (link_order->type == bfd_indirect_link_order) - { - abfd2 = link_order->u.indirect.section->owner; - if (abfd2 == 0) - abfd2 = abfd; - } - else - abfd2 = abfd; - fn = abfd2->xvec->_bfd_get_relocated_section_contents; - - return (*fn) (abfd, link_info, link_order, data, relocateable, symbols); -} - -/* Record information about an ELF program header. */ - -boolean -bfd_record_phdr (abfd, type, flags_valid, flags, at_valid, at, - includes_filehdr, includes_phdrs, count, secs) - bfd *abfd; - unsigned long type; - boolean flags_valid; - flagword flags; - boolean at_valid; - bfd_vma at; - boolean includes_filehdr; - boolean includes_phdrs; - unsigned int count; - asection **secs; -{ - struct elf_segment_map *m, **pm; - - if (bfd_get_flavour (abfd) != bfd_target_elf_flavour) - return true; - - m = ((struct elf_segment_map *) - bfd_alloc (abfd, - (sizeof (struct elf_segment_map) - + (count - 1) * sizeof (asection *)))); - if (m == NULL) - return false; - - m->next = NULL; - m->p_type = type; - m->p_flags = flags; - m->p_paddr = at; - m->p_flags_valid = flags_valid; - m->p_paddr_valid = at_valid; - m->includes_filehdr = includes_filehdr; - m->includes_phdrs = includes_phdrs; - m->count = count; - if (count > 0) - memcpy (m->sections, secs, count * sizeof (asection *)); - - for (pm = &elf_tdata (abfd)->segment_map; *pm != NULL; pm = &(*pm)->next) - ; - *pm = m; - - return true; -} diff --git a/contrib/gdb/bfd/binary.c b/contrib/gdb/bfd/binary.c deleted file mode 100644 index a480e46..0000000 --- a/contrib/gdb/bfd/binary.c +++ /dev/null @@ -1,348 +0,0 @@ -/* BFD back-end for binary objects. - Copyright 1994 Free Software Foundation, Inc. - Written by Ian Lance Taylor, Cygnus Support, - -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. */ - -/* This is a BFD backend which may be used to write binary objects. - It may only be used for output, not input. The intention is that - this may be used as an output format for objcopy in order to - generate raw binary data. - - This is very simple. The only complication is that the real data - will start at some address X, and in some cases we will not want to - include X zeroes just to get to that point. Since the start - address is not meaningful for this object file format, we use it - instead to indicate the number of zeroes to skip at the start of - the file. objcopy cooperates by specially setting the start - address to zero by default. */ - -#include - -#include "bfd.h" -#include "sysdep.h" -#include "libbfd.h" - -/* Any bfd we create by reading a binary file has three symbols: - a start symbol, an end symbol, and an absolute length symbol. */ -#define BIN_SYMS 3 - -static boolean binary_mkobject PARAMS ((bfd *)); -static const bfd_target *binary_object_p PARAMS ((bfd *)); -static boolean binary_get_section_contents - PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type)); -static long binary_get_symtab_upper_bound PARAMS ((bfd *)); -static char *mangle_name PARAMS ((bfd *, char *)); -static long binary_get_symtab PARAMS ((bfd *, asymbol **)); -static asymbol *binary_make_empty_symbol PARAMS ((bfd *)); -static void binary_get_symbol_info PARAMS ((bfd *, asymbol *, symbol_info *)); -static boolean binary_set_section_contents - PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type)); -static int binary_sizeof_headers PARAMS ((bfd *, boolean)); - -/* Create a binary object. Invoked via bfd_set_format. */ - -static boolean -binary_mkobject (abfd) - bfd *abfd; -{ - return true; -} - -/* Any file may be considered to be a binary file, provided the target - was not defaulted. That is, it must be explicitly specified as - being binary. */ - -static const bfd_target * -binary_object_p (abfd) - bfd *abfd; -{ - struct stat statbuf; - asection *sec; - - if (abfd->target_defaulted) - { - bfd_set_error (bfd_error_wrong_format); - return NULL; - } - - abfd->symcount = BIN_SYMS; - - /* Find the file size. */ - if (bfd_stat (abfd, &statbuf) < 0) - { - bfd_set_error (bfd_error_system_call); - return NULL; - } - - /* One data section. */ - sec = bfd_make_section (abfd, ".data"); - if (sec == NULL) - return NULL; - sec->flags = SEC_ALLOC | SEC_LOAD | SEC_DATA | SEC_HAS_CONTENTS; - sec->vma = 0; - sec->_raw_size = statbuf.st_size; - sec->filepos = 0; - - abfd->tdata.any = (PTR) sec; - - return abfd->xvec; -} - -#define binary_close_and_cleanup _bfd_generic_close_and_cleanup -#define binary_bfd_free_cached_info _bfd_generic_bfd_free_cached_info -#define binary_new_section_hook _bfd_generic_new_section_hook - -/* Get contents of the only section. */ - -static boolean -binary_get_section_contents (abfd, section, location, offset, count) - bfd *abfd; - asection *section; - PTR location; - file_ptr offset; - bfd_size_type count; -{ - if (bfd_seek (abfd, offset, SEEK_SET) != 0 - || bfd_read (location, 1, count, abfd) != count) - return false; - return true; -} - -/* Return the amount of memory needed to read the symbol table. */ - -static long -binary_get_symtab_upper_bound (abfd) - bfd *abfd; -{ - return (BIN_SYMS + 1) * sizeof (asymbol *); -} - -/* Create a symbol name based on the bfd's filename. */ - -static char * -mangle_name (abfd, suffix) - bfd *abfd; - char *suffix; -{ - int size; - char *buf; - char *p; - - size = (strlen (bfd_get_filename (abfd)) - + strlen (suffix) - + sizeof "_binary__"); - - buf = (char *) bfd_alloc (abfd, size); - if (buf == NULL) - return ""; - - sprintf (buf, "_binary_%s_%s", bfd_get_filename (abfd), suffix); - - /* Change any non-alphanumeric characters to underscores. */ - for (p = buf; *p; p++) - if (! isalnum (*p)) - *p = '_'; - - return buf; -} - -/* Return the symbol table. */ - -static long -binary_get_symtab (abfd, alocation) - bfd *abfd; - asymbol **alocation; -{ - asection *sec = (asection *) abfd->tdata.any; - asymbol *syms; - unsigned int i; - - syms = (asymbol *) bfd_alloc (abfd, BIN_SYMS * sizeof (asymbol)); - if (syms == NULL) - return false; - - /* Start symbol. */ - syms[0].the_bfd = abfd; - syms[0].name = mangle_name (abfd, "start"); - syms[0].value = 0; - syms[0].flags = BSF_GLOBAL; - syms[0].section = sec; - syms[0].udata.p = NULL; - - /* End symbol. */ - syms[1].the_bfd = abfd; - syms[1].name = mangle_name (abfd, "end"); - syms[1].value = sec->_raw_size; - syms[1].flags = BSF_GLOBAL; - syms[1].section = sec; - syms[1].udata.p = NULL; - - /* Size symbol. */ - syms[2].the_bfd = abfd; - syms[2].name = mangle_name (abfd, "size"); - syms[2].value = sec->_raw_size; - syms[2].flags = BSF_GLOBAL; - syms[2].section = bfd_abs_section_ptr; - syms[2].udata.p = NULL; - - for (i = 0; i < BIN_SYMS; i++) - *alocation++ = syms++; - *alocation = NULL; - - return BIN_SYMS; -} - -/* Make an empty symbol. */ - -static asymbol * -binary_make_empty_symbol (abfd) - bfd *abfd; -{ - return (asymbol *) bfd_alloc (abfd, sizeof (asymbol)); -} - -#define binary_print_symbol _bfd_nosymbols_print_symbol - -/* Get information about a symbol. */ - -static void -binary_get_symbol_info (ignore_abfd, symbol, ret) - bfd *ignore_abfd; - asymbol *symbol; - symbol_info *ret; -{ - bfd_symbol_info (symbol, ret); -} - -#define binary_bfd_is_local_label bfd_generic_is_local_label -#define binary_get_lineno _bfd_nosymbols_get_lineno -#define binary_find_nearest_line _bfd_nosymbols_find_nearest_line -#define binary_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol -#define binary_read_minisymbols _bfd_generic_read_minisymbols -#define binary_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol - -#define binary_get_reloc_upper_bound \ - ((long (*) PARAMS ((bfd *, asection *))) bfd_0l) -#define binary_canonicalize_reloc \ - ((long (*) PARAMS ((bfd *, asection *, arelent **, asymbol **))) bfd_0l) -#define binary_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup - -/* Set the architecture of a binary file. */ -#define binary_set_arch_mach _bfd_generic_set_arch_mach - -/* Write section contents of a binary file. */ - -static boolean -binary_set_section_contents (abfd, sec, data, offset, size) - bfd *abfd; - asection *sec; - PTR data; - file_ptr offset; - bfd_size_type size; -{ - if (! abfd->output_has_begun) - { - bfd_vma low; - asection *s; - - /* The lowest section VMA sets the virtual address of the start - of the file. We use the set the file position of all the - sections. */ - low = abfd->sections->vma; - for (s = abfd->sections->next; s != NULL; s = s->next) - if (s->vma < low) - low = s->vma; - - for (s = abfd->sections; s != NULL; s = s->next) - s->filepos = s->vma - low; - - abfd->output_has_begun = true; - } - - return _bfd_generic_set_section_contents (abfd, sec, data, offset, size); -} - -/* No space is required for header information. */ - -static int -binary_sizeof_headers (abfd, exec) - bfd *abfd; - boolean exec; -{ - return 0; -} - -#define binary_bfd_get_relocated_section_contents \ - bfd_generic_get_relocated_section_contents -#define binary_bfd_relax_section bfd_generic_relax_section -#define binary_bfd_link_hash_table_create _bfd_generic_link_hash_table_create -#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 -#define binary_get_section_contents_in_window \ - _bfd_generic_get_section_contents_in_window - -const bfd_target binary_vec = -{ - "binary", /* name */ - bfd_target_unknown_flavour, /* flavour */ - BFD_ENDIAN_UNKNOWN, /* byteorder */ - BFD_ENDIAN_UNKNOWN, /* header_byteorder */ - EXEC_P, /* object_flags */ - (SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_CODE | SEC_DATA - | SEC_ROM | SEC_HAS_CONTENTS), /* section_flags */ - 0, /* symbol_leading_char */ - ' ', /* ar_pad_char */ - 16, /* ar_max_namelen */ - bfd_getb64, bfd_getb_signed_64, bfd_putb64, - bfd_getb32, bfd_getb_signed_32, bfd_putb32, - bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */ - bfd_getb64, bfd_getb_signed_64, bfd_putb64, - bfd_getb32, bfd_getb_signed_32, bfd_putb32, - bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */ - { /* bfd_check_format */ - _bfd_dummy_target, - binary_object_p, /* bfd_check_format */ - _bfd_dummy_target, - _bfd_dummy_target, - }, - { /* bfd_set_format */ - bfd_false, - binary_mkobject, - bfd_false, - bfd_false, - }, - { /* bfd_write_contents */ - bfd_false, - bfd_true, - bfd_false, - bfd_false, - }, - - BFD_JUMP_TABLE_GENERIC (binary), - BFD_JUMP_TABLE_COPY (_bfd_generic), - BFD_JUMP_TABLE_CORE (_bfd_nocore), - BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive), - BFD_JUMP_TABLE_SYMBOLS (binary), - BFD_JUMP_TABLE_RELOCS (binary), - BFD_JUMP_TABLE_WRITE (binary), - BFD_JUMP_TABLE_LINK (binary), - BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), - - NULL -}; diff --git a/contrib/gdb/bfd/cache.c b/contrib/gdb/bfd/cache.c deleted file mode 100644 index ef15877..0000000 --- a/contrib/gdb/bfd/cache.c +++ /dev/null @@ -1,347 +0,0 @@ -/* BFD library -- caching of file descriptors. - Copyright 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. - Hacked by Steve Chamberlain of Cygnus Support (steve@cygnus.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. */ - -/* -SECTION - File caching - - The file caching mechanism is embedded within BFD and allows - the application to open as many BFDs as it wants without - regard to the underlying operating system's file descriptor - limit (often as low as 20 open files). The module in - <> maintains a least recently used list of - <> files, and exports the name - <>, which runs around and makes sure that - the required BFD is open. If not, then it chooses a file to - close, closes it and opens the one wanted, returning its file - handle. - -*/ - -#include "bfd.h" -#include "sysdep.h" -#include "libbfd.h" - -static void insert PARAMS ((bfd *)); -static void snip PARAMS ((bfd *)); -static boolean close_one PARAMS ((void)); -static boolean bfd_cache_delete PARAMS ((bfd *)); - -/* -INTERNAL_FUNCTION - BFD_CACHE_MAX_OPEN macro - -DESCRIPTION - The maximum number of files which the cache will keep open at - one time. - -.#define BFD_CACHE_MAX_OPEN 10 - -*/ - -/* The number of BFD files we have open. */ - -static int open_files; - -/* -INTERNAL_FUNCTION - bfd_last_cache - -SYNOPSIS - extern bfd *bfd_last_cache; - -DESCRIPTION - Zero, or a pointer to the topmost BFD on the chain. This is - used by the <> macro in @file{libbfd.h} to - determine when it can avoid a function call. -*/ - -bfd *bfd_last_cache; - -/* - INTERNAL_FUNCTION - bfd_cache_lookup - - DESCRIPTION - Check to see if the required BFD is the same as the last one - looked up. If so, then it can use the stream in the BFD with - impunity, since it can't have changed since the last lookup; - otherwise, it has to perform the complicated lookup function. - - .#define bfd_cache_lookup(x) \ - . ((x)==bfd_last_cache? \ - . (FILE*)(bfd_last_cache->iostream): \ - . bfd_cache_lookup_worker(x)) - - - */ - -/* Insert a BFD into the cache. */ - -static INLINE void -insert (abfd) - bfd *abfd; -{ - if (bfd_last_cache == NULL) - { - abfd->lru_next = abfd; - abfd->lru_prev = abfd; - } - else - { - abfd->lru_next = bfd_last_cache; - abfd->lru_prev = bfd_last_cache->lru_prev; - abfd->lru_prev->lru_next = abfd; - abfd->lru_next->lru_prev = abfd; - } - bfd_last_cache = abfd; -} - -/* Remove a BFD from the cache. */ - -static INLINE void -snip (abfd) - bfd *abfd; -{ - abfd->lru_prev->lru_next = abfd->lru_next; - abfd->lru_next->lru_prev = abfd->lru_prev; - if (abfd == bfd_last_cache) - { - bfd_last_cache = abfd->lru_next; - if (abfd == bfd_last_cache) - bfd_last_cache = NULL; - } -} - -/* We need to open a new file, and the cache is full. Find the least - recently used cacheable BFD and close it. */ - -static boolean -close_one () -{ - register bfd *kill; - - if (bfd_last_cache == NULL) - kill = NULL; - else - { - for (kill = bfd_last_cache->lru_prev; - ! kill->cacheable; - kill = kill->lru_prev) - { - if (kill == bfd_last_cache) - { - kill = NULL; - break; - } - } - } - - if (kill == NULL) - { - /* There are no open cacheable BFD's. */ - return true; - } - - kill->where = ftell ((FILE *) kill->iostream); - - return bfd_cache_delete (kill); -} - -/* Close a BFD and remove it from the cache. */ - -static boolean -bfd_cache_delete (abfd) - bfd *abfd; -{ - boolean ret; - - if (fclose ((FILE *) abfd->iostream) == 0) - ret = true; - else - { - ret = false; - bfd_set_error (bfd_error_system_call); - } - - snip (abfd); - - abfd->iostream = NULL; - --open_files; - - return ret; -} - -/* -INTERNAL_FUNCTION - bfd_cache_init - -SYNOPSIS - boolean bfd_cache_init (bfd *abfd); - -DESCRIPTION - Add a newly opened BFD to the cache. -*/ - -boolean -bfd_cache_init (abfd) - bfd *abfd; -{ - BFD_ASSERT (abfd->iostream != NULL); - if (open_files >= BFD_CACHE_MAX_OPEN) - { - if (! close_one ()) - return false; - } - insert (abfd); - ++open_files; - return true; -} - -/* -INTERNAL_FUNCTION - bfd_cache_close - -SYNOPSIS - boolean bfd_cache_close (bfd *abfd); - -DESCRIPTION - Remove the BFD @var{abfd} from the cache. If the attached file is open, - then close it too. - -RETURNS - <> is returned if closing the file fails, <> is - returned if all is well. -*/ - -boolean -bfd_cache_close (abfd) - bfd *abfd; -{ - if (abfd->iostream == NULL - || (abfd->flags & BFD_IN_MEMORY) != 0) - return true; - - return bfd_cache_delete (abfd); -} - -/* -INTERNAL_FUNCTION - bfd_open_file - -SYNOPSIS - FILE* bfd_open_file(bfd *abfd); - -DESCRIPTION - Call the OS to open a file for @var{abfd}. Return the <> - (possibly <>) that results from this operation. Set up the - BFD so that future accesses know the file is open. If the <> - returned is <>, then it won't have been put in the - cache, so it won't have to be removed from it. -*/ - -FILE * -bfd_open_file (abfd) - bfd *abfd; -{ - abfd->cacheable = true; /* Allow it to be closed later. */ - - if (open_files >= BFD_CACHE_MAX_OPEN) - { - if (! close_one ()) - return NULL; - } - - switch (abfd->direction) - { - case read_direction: - case no_direction: - abfd->iostream = (PTR) fopen (abfd->filename, FOPEN_RB); - break; - case both_direction: - case write_direction: - if (abfd->opened_once == true) - { - abfd->iostream = (PTR) fopen (abfd->filename, FOPEN_RUB); - if (abfd->iostream == NULL) - abfd->iostream = (PTR) fopen (abfd->filename, FOPEN_WUB); - } - else - { - /*open for creat */ - abfd->iostream = (PTR) fopen (abfd->filename, FOPEN_WB); - abfd->opened_once = true; - } - break; - } - - if (abfd->iostream != NULL) - { - if (! bfd_cache_init (abfd)) - return NULL; - } - - return (FILE *) abfd->iostream; -} - -/* -INTERNAL_FUNCTION - bfd_cache_lookup_worker - -SYNOPSIS - FILE *bfd_cache_lookup_worker(bfd *abfd); - -DESCRIPTION - Called when the macro <> fails to find a - quick answer. Find a file descriptor for @var{abfd}. If - necessary, it open it. If there are already more than - <> files open, it tries to close one first, to - avoid running out of file descriptors. -*/ - -FILE * -bfd_cache_lookup_worker (abfd) - bfd *abfd; -{ - if ((abfd->flags & BFD_IN_MEMORY) != 0) - abort (); - - if (abfd->my_archive) - abfd = abfd->my_archive; - - if (abfd->iostream != NULL) - { - /* Move the file to the start of the cache. */ - if (abfd != bfd_last_cache) - { - snip (abfd); - insert (abfd); - } - } - else - { - if (bfd_open_file (abfd) == NULL) - return NULL; - if (fseek ((FILE *) abfd->iostream, abfd->where, SEEK_SET) != 0) - return NULL; - } - - return (FILE *) abfd->iostream; -} diff --git a/contrib/gdb/bfd/coff-i386.c b/contrib/gdb/bfd/coff-i386.c deleted file mode 100644 index d905b53..0000000 --- a/contrib/gdb/bfd/coff-i386.c +++ /dev/null @@ -1,493 +0,0 @@ -/* BFD back-end for Intel 386 COFF files. - Copyright 1990, 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc. - Written by Cygnus Support. - -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 "obstack.h" - -#include "coff/i386.h" - -#include "coff/internal.h" - -#ifdef COFF_WITH_PE -#include "coff/pe.h" -#endif - -#include "libcoff.h" - -static bfd_reloc_status_type coff_i386_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); -static reloc_howto_type *coff_i386_rtype_to_howto - PARAMS ((bfd *, asection *, struct internal_reloc *, - struct coff_link_hash_entry *, struct internal_syment *, - - bfd_vma *)); - -#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (2) -/* The page size is a guess based on ELF. */ - -#define COFF_PAGE_SIZE 0x1000 - -/* For some reason when using i386 COFF the value stored in the .text - section for a reference to a common symbol is the value itself plus - any desired offset. Ian Taylor, Cygnus Support. */ - -/* If we are producing relocateable output, we need to do some - adjustments to the object file that are not done by the - bfd_perform_relocation function. This function is called by every - reloc type to make any required adjustments. */ - -static bfd_reloc_status_type -coff_i386_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; -{ - symvalue diff; - - if (output_bfd == (bfd *) NULL) - return bfd_reloc_continue; - - - if (bfd_is_com_section (symbol->section)) - { - /* We are relocating a common symbol. The current value in the - object file is ORIG + OFFSET, where ORIG is the value of the - common symbol as seen by the object file when it was compiled - (this may be zero if the symbol was undefined) and OFFSET is - the offset into the common symbol (normally zero, but may be - non-zero when referring to a field in a common structure). - ORIG is the negative of reloc_entry->addend, which is set by - the CALC_ADDEND macro below. We want to replace the value in - the object file with NEW + OFFSET, where NEW is the value of - the common symbol which we are going to put in the final - object file. NEW is symbol->value. */ - diff = symbol->value + reloc_entry->addend; - } - else - { - /* For some reason bfd_perform_relocation always effectively - ignores the addend for a COFF target when producing - relocateable output. This seems to be always wrong for 386 - COFF, so we handle the addend here instead. */ - diff = reloc_entry->addend; - } - - -#ifdef COFF_WITH_PE - if (reloc_entry->howto->type == 7) - { -/* diff -= coff_data(output_bfd)->link_info->pe_info.image_base.value;*/ - exit(1); - } -#endif - -#define DOIT(x) \ - x = ((x & ~howto->dst_mask) | (((x & howto->src_mask) + diff) & howto->dst_mask)) - - if (diff != 0) - { - reloc_howto_type *howto = reloc_entry->howto; - unsigned char *addr = (unsigned char *) data + reloc_entry->address; - - switch (howto->size) - { - case 0: - { - char x = bfd_get_8 (abfd, addr); - DOIT (x); - bfd_put_8 (abfd, x, addr); - } - break; - - case 1: - { - short x = bfd_get_16 (abfd, addr); - DOIT (x); - bfd_put_16 (abfd, x, addr); - } - break; - - case 2: - { - long x = bfd_get_32 (abfd, addr); - DOIT (x); - bfd_put_32 (abfd, x, addr); - } - break; - - default: - abort (); - } - } - - /* Now let bfd_perform_relocation finish everything up. */ - return bfd_reloc_continue; -} - -#ifdef COFF_WITH_PE -/* Return true if this relocation should - appear in the output .reloc section. */ - -static boolean in_reloc_p(abfd, howto) - bfd * abfd; - reloc_howto_type *howto; -{ - return ! howto->pc_relative && howto->type != R_IMAGEBASE; -} -#endif - -#ifndef PCRELOFFSET -#define PCRELOFFSET false -#endif - -static reloc_howto_type howto_table[] = -{ - {0}, - {1}, - {2}, - {3}, - {4}, - {5}, - HOWTO (R_DIR32, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - coff_i386_reloc, /* special_function */ - "dir32", /* name */ - true, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - true), /* pcrel_offset */ - /* {7}, */ - HOWTO (R_IMAGEBASE, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - coff_i386_reloc, /* special_function */ - "rva32", /* name */ - true, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - false), /* pcrel_offset */ - {010}, - {011}, - {012}, - {013}, - {014}, - {015}, - {016}, - HOWTO (R_RELBYTE, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 8, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - coff_i386_reloc, /* special_function */ - "8", /* name */ - true, /* partial_inplace */ - 0x000000ff, /* src_mask */ - 0x000000ff, /* dst_mask */ - PCRELOFFSET), /* pcrel_offset */ - HOWTO (R_RELWORD, /* type */ - 0, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - coff_i386_reloc, /* special_function */ - "16", /* name */ - true, /* partial_inplace */ - 0x0000ffff, /* src_mask */ - 0x0000ffff, /* dst_mask */ - PCRELOFFSET), /* pcrel_offset */ - HOWTO (R_RELLONG, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - coff_i386_reloc, /* special_function */ - "32", /* name */ - true, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - PCRELOFFSET), /* pcrel_offset */ - HOWTO (R_PCRBYTE, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 8, /* bitsize */ - true, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - coff_i386_reloc, /* special_function */ - "DISP8", /* name */ - true, /* partial_inplace */ - 0x000000ff, /* src_mask */ - 0x000000ff, /* dst_mask */ - PCRELOFFSET), /* pcrel_offset */ - HOWTO (R_PCRWORD, /* type */ - 0, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - true, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - coff_i386_reloc, /* special_function */ - "DISP16", /* name */ - true, /* partial_inplace */ - 0x0000ffff, /* src_mask */ - 0x0000ffff, /* dst_mask */ - PCRELOFFSET), /* pcrel_offset */ - HOWTO (R_PCRLONG, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - true, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - coff_i386_reloc, /* special_function */ - "DISP32", /* name */ - true, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - PCRELOFFSET) /* pcrel_offset */ -}; - -/* Turn a howto into a reloc nunmber */ - -#define SELECT_RELOC(x,howto) { x.r_type = howto->type; } -#define BADMAG(x) I386BADMAG(x) -#define I386 1 /* Customize coffcode.h */ - -#define RTYPE2HOWTO(cache_ptr, dst) \ - (cache_ptr)->howto = howto_table + (dst)->r_type; - -/* For 386 COFF a STYP_NOLOAD | STYP_BSS section is part of a shared - library. On some other COFF targets STYP_BSS is normally - STYP_NOLOAD. */ -#define BSS_NOLOAD_IS_SHARED_LIBRARY - -/* Compute the addend of a reloc. If the reloc is to a common symbol, - the object file contains the value of the common symbol. By the - time this is called, the linker may be using a different symbol - from a different object file with a different value. Therefore, we - hack wildly to locate the original symbol from this file so that we - can make the correct adjustment. This macro sets coffsym to the - symbol from the original file, and uses it to set the addend value - correctly. If this is not a common symbol, the usual addend - calculation is done, except that an additional tweak is needed for - PC relative relocs. - FIXME: This macro refers to symbols and asect; these are from the - calling function, not the macro arguments. */ - -#define CALC_ADDEND(abfd, ptr, reloc, cache_ptr) \ - { \ - coff_symbol_type *coffsym = (coff_symbol_type *) NULL; \ - if (ptr && bfd_asymbol_bfd (ptr) != abfd) \ - coffsym = (obj_symbols (abfd) \ - + (cache_ptr->sym_ptr_ptr - symbols)); \ - else if (ptr) \ - coffsym = coff_symbol_from (abfd, ptr); \ - if (coffsym != (coff_symbol_type *) NULL \ - && coffsym->native->u.syment.n_scnum == 0) \ - cache_ptr->addend = - coffsym->native->u.syment.n_value; \ - else if (ptr && bfd_asymbol_bfd (ptr) == abfd \ - && ptr->section != (asection *) NULL) \ - cache_ptr->addend = - (ptr->section->vma + ptr->value); \ - else \ - cache_ptr->addend = 0; \ - if (ptr && howto_table[reloc.r_type].pc_relative) \ - cache_ptr->addend += asect->vma; \ - } - -/* We use the special COFF backend linker. */ -#define coff_relocate_section _bfd_coff_generic_relocate_section - -static reloc_howto_type * -coff_i386_rtype_to_howto (abfd, sec, rel, h, sym, addendp) - bfd *abfd; - asection *sec; - struct internal_reloc *rel; - struct coff_link_hash_entry *h; - struct internal_syment *sym; - bfd_vma *addendp; -{ - - reloc_howto_type *howto; - - howto = howto_table + rel->r_type; - -#ifdef COFF_WITH_PE - *addendp = 0; -#endif - - if (howto->pc_relative) - *addendp += sec->vma; - - if (sym != NULL && sym->n_scnum == 0 && sym->n_value != 0) - { - /* This is a common symbol. The section contents include the - size (sym->n_value) as an addend. The relocate_section - function will be adding in the final value of the symbol. We - need to subtract out the current size in order to get the - correct result. */ - - BFD_ASSERT (h != NULL); - - -#ifndef COFF_WITH_PE - /* I think we *do* want to bypass this. If we don't, I have seen some data - parameters get the wrong relcation address. If I link two versions - with and without this section bypassed and then do a binary comparison, - the addresses which are different can be looked up in the map. The - case in which this section has been bypassed has addresses which correspond - to values I can find in the map */ - *addendp -= sym->n_value; -#endif - } - - /* If the output symbol is common (in which case this must be a - relocateable link), we need to add in the final size of the - common symbol. */ - if (h != NULL && h->root.type == bfd_link_hash_common) - *addendp += h->root.u.c.size; - - -#ifdef COFF_WITH_PE - if (howto->pc_relative) - *addendp -= 4; - - if (rel->r_type == R_IMAGEBASE) - { - *addendp -= pe_data(sec->output_section->owner)->pe_opthdr.ImageBase; - } -#endif - - return howto; -} - - -#define coff_bfd_reloc_type_lookup coff_i386_reloc_type_lookup - - -static reloc_howto_type * -coff_i386_reloc_type_lookup (abfd, code) - bfd *abfd; - bfd_reloc_code_real_type code; -{ - switch (code) - { - case BFD_RELOC_RVA: - return howto_table +R_IMAGEBASE; - case BFD_RELOC_32: - return howto_table + R_DIR32; - case BFD_RELOC_32_PCREL: - return howto_table + R_PCRLONG; - default: - BFD_FAIL (); - return 0; - } -} - - - -#define coff_rtype_to_howto coff_i386_rtype_to_howto - -#include "coffcode.h" - -static const bfd_target * -i3coff_object_p(a) - bfd *a; -{ - return coff_object_p(a); -} - -const bfd_target -#ifdef TARGET_SYM - TARGET_SYM = -#else - i386coff_vec = -#endif -{ -#ifdef TARGET_NAME - TARGET_NAME, -#else - "coff-i386", /* name */ -#endif - bfd_target_coff_flavour, - BFD_ENDIAN_LITTLE, /* data byte order is little */ - BFD_ENDIAN_LITTLE, /* header byte order is little */ - - (HAS_RELOC | EXEC_P | /* object flags */ - HAS_LINENO | HAS_DEBUG | - HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED), - - (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */ -#ifdef TARGET_UNDERSCORE - TARGET_UNDERSCORE, /* leading underscore */ -#else - 0, /* leading underscore */ -#endif - '/', /* ar_pad_char */ - 15, /* ar_max_namelen */ - - bfd_getl64, bfd_getl_signed_64, bfd_putl64, - bfd_getl32, bfd_getl_signed_32, bfd_putl32, - bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */ - bfd_getl64, bfd_getl_signed_64, bfd_putl64, - bfd_getl32, bfd_getl_signed_32, bfd_putl32, - bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */ - -/* Note that we allow an object file to be treated as a core file as well. */ - {_bfd_dummy_target, i3coff_object_p, /* bfd_check_format */ - bfd_generic_archive_p, i3coff_object_p}, - {bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */ - bfd_false}, - {bfd_false, coff_write_object_contents, /* bfd_write_contents */ - _bfd_write_archive_contents, bfd_false}, - - BFD_JUMP_TABLE_GENERIC (coff), - BFD_JUMP_TABLE_COPY (coff), - BFD_JUMP_TABLE_CORE (_bfd_nocore), - BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff), - BFD_JUMP_TABLE_SYMBOLS (coff), - BFD_JUMP_TABLE_RELOCS (coff), - BFD_JUMP_TABLE_WRITE (coff), - BFD_JUMP_TABLE_LINK (coff), - BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), - - COFF_SWAP_TABLE, -}; diff --git a/contrib/gdb/bfd/coffcode.h b/contrib/gdb/bfd/coffcode.h deleted file mode 100644 index 22babd0..0000000 --- a/contrib/gdb/bfd/coffcode.h +++ /dev/null @@ -1,3612 +0,0 @@ -/* Support for the generic parts of most COFF variants, for BFD. - Copyright 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. - Written by Cygnus Support. - -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. */ - -/* -Most of this hacked by Steve Chamberlain, - sac@cygnus.com -*/ -/* - -SECTION - coff backends - - BFD supports a number of different flavours of coff format. - The major differences between formats are the sizes and - alignments of fields in structures on disk, and the occasional - extra field. - - Coff in all its varieties is implemented with a few common - files and a number of implementation specific files. For - example, The 88k bcs coff format is implemented in the file - @file{coff-m88k.c}. This file @code{#include}s - @file{coff/m88k.h} which defines the external structure of the - coff format for the 88k, and @file{coff/internal.h} which - defines the internal structure. @file{coff-m88k.c} also - defines the relocations used by the 88k format - @xref{Relocations}. - - The Intel i960 processor version of coff is implemented in - @file{coff-i960.c}. This file has the same structure as - @file{coff-m88k.c}, except that it includes @file{coff/i960.h} - rather than @file{coff-m88k.h}. - -SUBSECTION - Porting to a new version of coff - - The recommended method is to select from the existing - implementations the version of coff which is most like the one - you want to use. For example, we'll say that i386 coff is - the one you select, and that your coff flavour is called foo. - Copy @file{i386coff.c} to @file{foocoff.c}, copy - @file{../include/coff/i386.h} to @file{../include/coff/foo.h}, - and add the lines to @file{targets.c} and @file{Makefile.in} - so that your new back end is used. Alter the shapes of the - structures in @file{../include/coff/foo.h} so that they match - what you need. You will probably also have to add - @code{#ifdef}s to the code in @file{coff/internal.h} and - @file{coffcode.h} if your version of coff is too wild. - - You can verify that your new BFD backend works quite simply by - building @file{objdump} from the @file{binutils} directory, - and making sure that its version of what's going on and your - host system's idea (assuming it has the pretty standard coff - dump utility, usually called @code{att-dump} or just - @code{dump}) are the same. Then clean up your code, and send - what you've done to Cygnus. Then your stuff will be in the - next release, and you won't have to keep integrating it. - -SUBSECTION - How the coff backend works - -SUBSUBSECTION - File layout - - The Coff backend is split into generic routines that are - applicable to any Coff target and routines that are specific - to a particular target. The target-specific routines are - further split into ones which are basically the same for all - Coff targets except that they use the external symbol format - or use different values for certain constants. - - The generic routines are in @file{coffgen.c}. These routines - work for any Coff target. They use some hooks into the target - specific code; the hooks are in a @code{bfd_coff_backend_data} - structure, one of which exists for each target. - - The essentially similar target-specific routines are in - @file{coffcode.h}. This header file includes executable C code. - The various Coff targets first include the appropriate Coff - header file, make any special defines that are needed, and - then include @file{coffcode.h}. - - Some of the Coff targets then also have additional routines in - the target source file itself. - - For example, @file{coff-i960.c} includes - @file{coff/internal.h} and @file{coff/i960.h}. It then - defines a few constants, such as @code{I960}, and includes - @file{coffcode.h}. Since the i960 has complex relocation - types, @file{coff-i960.c} also includes some code to - manipulate the i960 relocs. This code is not in - @file{coffcode.h} because it would not be used by any other - target. - -SUBSUBSECTION - Bit twiddling - - Each flavour of coff supported in BFD has its own header file - describing the external layout of the structures. There is also - an internal description of the coff layout, in - @file{coff/internal.h}. A major function of the - coff backend is swapping the bytes and twiddling the bits to - translate the external form of the structures into the normal - internal form. This is all performed in the - @code{bfd_swap}_@i{thing}_@i{direction} routines. Some - elements are different sizes between different versions of - coff; it is the duty of the coff version specific include file - to override the definitions of various packing routines in - @file{coffcode.h}. E.g., the size of line number entry in coff is - sometimes 16 bits, and sometimes 32 bits. @code{#define}ing - @code{PUT_LNSZ_LNNO} and @code{GET_LNSZ_LNNO} will select the - correct one. No doubt, some day someone will find a version of - coff which has a varying field size not catered to at the - moment. To port BFD, that person will have to add more @code{#defines}. - Three of the bit twiddling routines are exported to - @code{gdb}; @code{coff_swap_aux_in}, @code{coff_swap_sym_in} - and @code{coff_swap_linno_in}. @code{GDB} reads the symbol - table on its own, but uses BFD to fix things up. More of the - bit twiddlers are exported for @code{gas}; - @code{coff_swap_aux_out}, @code{coff_swap_sym_out}, - @code{coff_swap_lineno_out}, @code{coff_swap_reloc_out}, - @code{coff_swap_filehdr_out}, @code{coff_swap_aouthdr_out}, - @code{coff_swap_scnhdr_out}. @code{Gas} currently keeps track - of all the symbol table and reloc drudgery itself, thereby - saving the internal BFD overhead, but uses BFD to swap things - on the way out, making cross ports much safer. Doing so also - allows BFD (and thus the linker) to use the same header files - as @code{gas}, which makes one avenue to disaster disappear. - -SUBSUBSECTION - Symbol reading - - The simple canonical form for symbols used by BFD is not rich - enough to keep all the information available in a coff symbol - table. The back end gets around this problem by keeping the original - symbol table around, "behind the scenes". - - When a symbol table is requested (through a call to - @code{bfd_canonicalize_symtab}), a request gets through to - @code{coff_get_normalized_symtab}. This reads the symbol table from - the coff file and swaps all the structures inside into the - internal form. It also fixes up all the pointers in the table - (represented in the file by offsets from the first symbol in - the table) into physical pointers to elements in the new - internal table. This involves some work since the meanings of - fields change depending upon context: a field that is a - pointer to another structure in the symbol table at one moment - may be the size in bytes of a structure at the next. Another - pass is made over the table. All symbols which mark file names - (<> symbols) are modified so that the internal - string points to the value in the auxent (the real filename) - rather than the normal text associated with the symbol - (@code{".file"}). - - At this time the symbol names are moved around. Coff stores - all symbols less than nine characters long physically - within the symbol table; longer strings are kept at the end of - the file in the string table. This pass moves all strings - into memory and replaces them with pointers to the strings. - - - The symbol table is massaged once again, this time to create - the canonical table used by the BFD application. Each symbol - is inspected in turn, and a decision made (using the - @code{sclass} field) about the various flags to set in the - @code{asymbol}. @xref{Symbols}. The generated canonical table - shares strings with the hidden internal symbol table. - - Any linenumbers are read from the coff file too, and attached - to the symbols which own the functions the linenumbers belong to. - -SUBSUBSECTION - Symbol writing - - Writing a symbol to a coff file which didn't come from a coff - file will lose any debugging information. The @code{asymbol} - structure remembers the BFD from which the symbol was taken, and on - output the back end makes sure that the same destination target as - source target is present. - - When the symbols have come from a coff file then all the - debugging information is preserved. - - Symbol tables are provided for writing to the back end in a - vector of pointers to pointers. This allows applications like - the linker to accumulate and output large symbol tables - without having to do too much byte copying. - - This function runs through the provided symbol table and - patches each symbol marked as a file place holder - (@code{C_FILE}) to point to the next file place holder in the - list. It also marks each @code{offset} field in the list with - the offset from the first symbol of the current symbol. - - Another function of this procedure is to turn the canonical - value form of BFD into the form used by coff. Internally, BFD - expects symbol values to be offsets from a section base; so a - symbol physically at 0x120, but in a section starting at - 0x100, would have the value 0x20. Coff expects symbols to - contain their final value, so symbols have their values - changed at this point to reflect their sum with their owning - section. This transformation uses the - <> field of the @code{asymbol}'s - @code{asection} @xref{Sections}. - - o <> - - This routine runs though the provided symbol table and uses - the offsets generated by the previous pass and the pointers - generated when the symbol table was read in to create the - structured hierachy required by coff. It changes each pointer - to a symbol into the index into the symbol table of the asymbol. - - o <> - - This routine runs through the symbol table and patches up the - symbols from their internal form into the coff way, calls the - bit twiddlers, and writes out the table to the file. - -*/ - -/* -INTERNAL_DEFINITION - coff_symbol_type - -DESCRIPTION - The hidden information for an <> is described in a - <>: - -CODE_FRAGMENT -. -.typedef struct coff_ptr_struct -.{ -. -. {* Remembers the offset from the first symbol in the file for -. this symbol. Generated by coff_renumber_symbols. *} -.unsigned int offset; -. -. {* Should the value of this symbol be renumbered. Used for -. XCOFF C_BSTAT symbols. Set by coff_slurp_symbol_table. *} -.unsigned int fix_value : 1; -. -. {* Should the tag field of this symbol be renumbered. -. Created by coff_pointerize_aux. *} -.unsigned int fix_tag : 1; -. -. {* Should the endidx field of this symbol be renumbered. -. Created by coff_pointerize_aux. *} -.unsigned int fix_end : 1; -. -. {* Should the x_csect.x_scnlen field be renumbered. -. Created by coff_pointerize_aux. *} -.unsigned int fix_scnlen : 1; -. -. {* Fix up an XCOFF C_BINCL/C_EINCL symbol. The value is the -. index into the line number entries. Set by -. coff_slurp_symbol_table. *} -.unsigned int fix_line : 1; -. -. {* The container for the symbol structure as read and translated -. from the file. *} -. -.union { -. union internal_auxent auxent; -. struct internal_syment syment; -. } u; -.} combined_entry_type; -. -. -.{* Each canonical asymbol really looks like this: *} -. -.typedef struct coff_symbol_struct -.{ -. {* The actual symbol which the rest of BFD works with *} -.asymbol symbol; -. -. {* A pointer to the hidden information for this symbol *} -.combined_entry_type *native; -. -. {* A pointer to the linenumber information for this symbol *} -.struct lineno_cache_entry *lineno; -. -. {* Have the line numbers been relocated yet ? *} -.boolean done_lineno; -.} coff_symbol_type; - - -*/ - -#ifdef COFF_WITH_PE -#include "peicode.h" -#else -#include "coffswap.h" -#endif - - -/* void warning(); */ - -/* - * Return a word with STYP_* (scnhdr.s_flags) flags set to represent the - * incoming SEC_* flags. The inverse of this function is styp_to_sec_flags(). - * NOTE: If you add to/change this routine, you should mirror the changes - * in styp_to_sec_flags(). - */ -static long -sec_to_styp_flags (sec_name, sec_flags) - CONST char *sec_name; - flagword sec_flags; -{ - long styp_flags = 0; - - if (!strcmp (sec_name, _TEXT)) - { - styp_flags = STYP_TEXT; - } - else if (!strcmp (sec_name, _DATA)) - { - styp_flags = STYP_DATA; - } - else if (!strcmp (sec_name, _BSS)) - { - styp_flags = STYP_BSS; -#ifdef _COMMENT - } - else if (!strcmp (sec_name, _COMMENT)) - { - styp_flags = STYP_INFO; -#endif /* _COMMENT */ -#ifdef _LIB - } - else if (!strcmp (sec_name, _LIB)) - { - styp_flags = STYP_LIB; -#endif /* _LIB */ -#ifdef _LIT - } - else if (!strcmp (sec_name, _LIT)) - { - styp_flags = STYP_LIT; -#endif /* _LIT */ - } - else if (!strcmp (sec_name, ".debug")) - { -#ifdef STYP_DEBUG - styp_flags = STYP_DEBUG; -#else - styp_flags = STYP_INFO; -#endif - } - else if (!strncmp (sec_name, ".stab", 5)) - { - styp_flags = STYP_INFO; - } -#ifdef COFF_WITH_PE - else if (!strcmp (sec_name, ".edata")) - { - styp_flags = STYP_DATA; - } -#endif -#ifdef RS6000COFF_C - else if (!strcmp (sec_name, _PAD)) - { - styp_flags = STYP_PAD; - } - else if (!strcmp (sec_name, _LOADER)) - { - styp_flags = STYP_LOADER; - } -#endif - /* Try and figure out what it should be */ - else if (sec_flags & SEC_CODE) - { - styp_flags = STYP_TEXT; - } - else if (sec_flags & SEC_DATA) - { - styp_flags = STYP_DATA; - } - else if (sec_flags & SEC_READONLY) - { -#ifdef STYP_LIT /* 29k readonly text/data section */ - styp_flags = STYP_LIT; -#else - styp_flags = STYP_TEXT; -#endif /* STYP_LIT */ - } - else if (sec_flags & SEC_LOAD) - { - styp_flags = STYP_TEXT; - } - else if (sec_flags & SEC_ALLOC) - { - styp_flags = STYP_BSS; - } - -#ifdef STYP_NOLOAD - if ((sec_flags & (SEC_NEVER_LOAD | SEC_COFF_SHARED_LIBRARY)) != 0) - styp_flags |= STYP_NOLOAD; -#endif - - return (styp_flags); -} -/* - * Return a word with SEC_* flags set to represent the incoming - * STYP_* flags (from scnhdr.s_flags). The inverse of this - * function is sec_to_styp_flags(). - * NOTE: If you add to/change this routine, you should mirror the changes - * in sec_to_styp_flags(). - */ -static flagword -styp_to_sec_flags (abfd, hdr, name) - bfd *abfd; - PTR hdr; - const char *name; -{ - struct internal_scnhdr *internal_s = (struct internal_scnhdr *) hdr; - long styp_flags = internal_s->s_flags; - flagword sec_flags = 0; - -#ifdef STYP_NOLOAD - if (styp_flags & STYP_NOLOAD) - { - sec_flags |= SEC_NEVER_LOAD; - } -#endif /* STYP_NOLOAD */ - - /* For 386 COFF, at least, an unloadable text or data section is - actually a shared library section. */ - if (styp_flags & STYP_TEXT) - { - if (sec_flags & SEC_NEVER_LOAD) - sec_flags |= SEC_CODE | SEC_COFF_SHARED_LIBRARY; - else - sec_flags |= SEC_CODE | SEC_LOAD | SEC_ALLOC; - } - else if (styp_flags & STYP_DATA) - { - if (sec_flags & SEC_NEVER_LOAD) - sec_flags |= SEC_DATA | SEC_COFF_SHARED_LIBRARY; - else - sec_flags |= SEC_DATA | SEC_LOAD | SEC_ALLOC; - } - else if (styp_flags & STYP_BSS) - { -#ifdef BSS_NOLOAD_IS_SHARED_LIBRARY - if (sec_flags & SEC_NEVER_LOAD) - sec_flags |= SEC_ALLOC | SEC_COFF_SHARED_LIBRARY; - else -#endif - sec_flags |= SEC_ALLOC; - } - else if (styp_flags & STYP_INFO) - { - /* We mark these as SEC_DEBUGGING, but only if COFF_PAGE_SIZE is - defined. coff_compute_section_file_positions uses - COFF_PAGE_SIZE to ensure that the low order bits of the - section VMA and the file offset match. If we don't know - COFF_PAGE_SIZE, we can't ensure the correct correspondence, - and demand page loading of the file will fail. */ -#ifdef COFF_PAGE_SIZE - sec_flags |= SEC_DEBUGGING; -#endif - } - else if (styp_flags & STYP_PAD) - { - sec_flags = 0; - } - else if (strcmp (name, _TEXT) == 0) - { - if (sec_flags & SEC_NEVER_LOAD) - sec_flags |= SEC_CODE | SEC_COFF_SHARED_LIBRARY; - else - sec_flags |= SEC_CODE | SEC_LOAD | SEC_ALLOC; - } - else if (strcmp (name, _DATA) == 0) - { - if (sec_flags & SEC_NEVER_LOAD) - sec_flags |= SEC_DATA | SEC_COFF_SHARED_LIBRARY; - else - sec_flags |= SEC_DATA | SEC_LOAD | SEC_ALLOC; - } - else if (strcmp (name, _BSS) == 0) - { -#ifdef BSS_NOLOAD_IS_SHARED_LIBRARY - if (sec_flags & SEC_NEVER_LOAD) - sec_flags |= SEC_ALLOC | SEC_COFF_SHARED_LIBRARY; - else -#endif - sec_flags |= SEC_ALLOC; - } - else if (strcmp (name, ".debug") == 0 -#ifdef _COMMENT - || strcmp (name, _COMMENT) == 0 -#endif - || strncmp (name, ".stab", 5) == 0) - { -#ifdef COFF_PAGE_SIZE - sec_flags |= SEC_DEBUGGING; -#endif - } -#ifdef _LIB - else if (strcmp (name, _LIB) == 0) - ; -#endif -#ifdef _LIT - else if (strcmp (name, _LIT) == 0) - { - sec_flags = SEC_LOAD | SEC_ALLOC | SEC_READONLY; - } -#endif - else - { - sec_flags |= SEC_ALLOC | SEC_LOAD; - } - -#ifdef STYP_LIT /* A29k readonly text/data section type */ - if ((styp_flags & STYP_LIT) == STYP_LIT) - { - sec_flags = (SEC_LOAD | SEC_ALLOC | SEC_READONLY); - } -#endif /* STYP_LIT */ -#ifdef STYP_OTHER_LOAD /* Other loaded sections */ - if (styp_flags & STYP_OTHER_LOAD) - { - sec_flags = (SEC_LOAD | SEC_ALLOC); - } -#endif /* STYP_SDATA */ - - return (sec_flags); -} - -#define get_index(symbol) ((symbol)->udata.i) - -/* -INTERNAL_DEFINITION - bfd_coff_backend_data - -CODE_FRAGMENT - -Special entry points for gdb to swap in coff symbol table parts: -.typedef struct -.{ -. void (*_bfd_coff_swap_aux_in) PARAMS (( -. bfd *abfd, -. PTR ext, -. int type, -. int class, -. int indaux, -. int numaux, -. PTR in)); -. -. void (*_bfd_coff_swap_sym_in) PARAMS (( -. bfd *abfd , -. PTR ext, -. PTR in)); -. -. void (*_bfd_coff_swap_lineno_in) PARAMS (( -. bfd *abfd, -. PTR ext, -. PTR in)); -. - -Special entry points for gas to swap out coff parts: - -. unsigned int (*_bfd_coff_swap_aux_out) PARAMS (( -. bfd *abfd, -. PTR in, -. int type, -. int class, -. int indaux, -. int numaux, -. PTR ext)); -. -. unsigned int (*_bfd_coff_swap_sym_out) PARAMS (( -. bfd *abfd, -. PTR in, -. PTR ext)); -. -. unsigned int (*_bfd_coff_swap_lineno_out) PARAMS (( -. bfd *abfd, -. PTR in, -. PTR ext)); -. -. unsigned int (*_bfd_coff_swap_reloc_out) PARAMS (( -. bfd *abfd, -. PTR src, -. PTR dst)); -. -. unsigned int (*_bfd_coff_swap_filehdr_out) PARAMS (( -. bfd *abfd, -. PTR in, -. PTR out)); -. -. unsigned int (*_bfd_coff_swap_aouthdr_out) PARAMS (( -. bfd *abfd, -. PTR in, -. PTR out)); -. -. unsigned int (*_bfd_coff_swap_scnhdr_out) PARAMS (( -. bfd *abfd, -. PTR in, -. PTR out)); -. - -Special entry points for generic COFF routines to call target -dependent COFF routines: - -. unsigned int _bfd_filhsz; -. unsigned int _bfd_aoutsz; -. unsigned int _bfd_scnhsz; -. unsigned int _bfd_symesz; -. unsigned int _bfd_auxesz; -. unsigned int _bfd_relsz; -. unsigned int _bfd_linesz; -. boolean _bfd_coff_long_filenames; -. void (*_bfd_coff_swap_filehdr_in) PARAMS (( -. bfd *abfd, -. PTR ext, -. PTR in)); -. void (*_bfd_coff_swap_aouthdr_in) PARAMS (( -. bfd *abfd, -. PTR ext, -. PTR in)); -. void (*_bfd_coff_swap_scnhdr_in) PARAMS (( -. bfd *abfd, -. PTR ext, -. PTR in)); -. void (*_bfd_coff_swap_reloc_in) PARAMS (( -. bfd *abfd, -. PTR ext, -. PTR in)); -. boolean (*_bfd_coff_bad_format_hook) PARAMS (( -. bfd *abfd, -. PTR internal_filehdr)); -. boolean (*_bfd_coff_set_arch_mach_hook) PARAMS (( -. bfd *abfd, -. PTR internal_filehdr)); -. PTR (*_bfd_coff_mkobject_hook) PARAMS (( -. bfd *abfd, -. PTR internal_filehdr, -. PTR internal_aouthdr)); -. flagword (*_bfd_styp_to_sec_flags_hook) PARAMS (( -. bfd *abfd, -. PTR internal_scnhdr, -. const char *name)); -. void (*_bfd_set_alignment_hook) PARAMS (( -. bfd *abfd, -. asection *sec, -. PTR internal_scnhdr)); -. boolean (*_bfd_coff_slurp_symbol_table) PARAMS (( -. bfd *abfd)); -. boolean (*_bfd_coff_symname_in_debug) PARAMS (( -. bfd *abfd, -. struct internal_syment *sym)); -. boolean (*_bfd_coff_pointerize_aux_hook) PARAMS (( -. bfd *abfd, -. combined_entry_type *table_base, -. combined_entry_type *symbol, -. unsigned int indaux, -. combined_entry_type *aux)); -. boolean (*_bfd_coff_print_aux) PARAMS (( -. bfd *abfd, -. FILE *file, -. combined_entry_type *table_base, -. combined_entry_type *symbol, -. combined_entry_type *aux, -. unsigned int indaux)); -. void (*_bfd_coff_reloc16_extra_cases) PARAMS (( -. bfd *abfd, -. struct bfd_link_info *link_info, -. struct bfd_link_order *link_order, -. arelent *reloc, -. bfd_byte *data, -. unsigned int *src_ptr, -. unsigned int *dst_ptr)); -. int (*_bfd_coff_reloc16_estimate) PARAMS (( -. bfd *abfd, -. asection *input_section, -. arelent *r, -. unsigned int shrink, -. struct bfd_link_info *link_info)); -. boolean (*_bfd_coff_sym_is_global) PARAMS (( -. bfd *abfd, -. struct internal_syment *)); -. void (*_bfd_coff_compute_section_file_positions) PARAMS (( -. bfd *abfd)); -. boolean (*_bfd_coff_start_final_link) PARAMS (( -. bfd *output_bfd, -. struct bfd_link_info *info)); -. boolean (*_bfd_coff_relocate_section) PARAMS (( -. bfd *output_bfd, -. struct bfd_link_info *info, -. bfd *input_bfd, -. asection *input_section, -. bfd_byte *contents, -. struct internal_reloc *relocs, -. struct internal_syment *syms, -. asection **sections)); -. reloc_howto_type *(*_bfd_coff_rtype_to_howto) PARAMS (( -. bfd *abfd, -. asection *sec, -. struct internal_reloc *rel, -. struct coff_link_hash_entry *h, -. struct internal_syment *sym, -. bfd_vma *addendp)); -. boolean (*_bfd_coff_adjust_symndx) PARAMS (( -. bfd *obfd, -. struct bfd_link_info *info, -. bfd *ibfd, -. asection *sec, -. struct internal_reloc *reloc, -. boolean *adjustedp)); -. boolean (*_bfd_coff_link_add_one_symbol) PARAMS (( -. struct bfd_link_info *info, -. bfd *abfd, -. const char *name, -. flagword flags, -. asection *section, -. bfd_vma value, -. const char *string, -. boolean copy, -. boolean collect, -. struct bfd_link_hash_entry **hashp)); -. -.} bfd_coff_backend_data; -. -.#define coff_backend_info(abfd) ((bfd_coff_backend_data *) (abfd)->xvec->backend_data) -. -.#define bfd_coff_swap_aux_in(a,e,t,c,ind,num,i) \ -. ((coff_backend_info (a)->_bfd_coff_swap_aux_in) (a,e,t,c,ind,num,i)) -. -.#define bfd_coff_swap_sym_in(a,e,i) \ -. ((coff_backend_info (a)->_bfd_coff_swap_sym_in) (a,e,i)) -. -.#define bfd_coff_swap_lineno_in(a,e,i) \ -. ((coff_backend_info ( a)->_bfd_coff_swap_lineno_in) (a,e,i)) -. -.#define bfd_coff_swap_reloc_out(abfd, i, o) \ -. ((coff_backend_info (abfd)->_bfd_coff_swap_reloc_out) (abfd, i, o)) -. -.#define bfd_coff_swap_lineno_out(abfd, i, o) \ -. ((coff_backend_info (abfd)->_bfd_coff_swap_lineno_out) (abfd, i, o)) -. -.#define bfd_coff_swap_aux_out(a,i,t,c,ind,num,o) \ -. ((coff_backend_info (a)->_bfd_coff_swap_aux_out) (a,i,t,c,ind,num,o)) -. -.#define bfd_coff_swap_sym_out(abfd, i,o) \ -. ((coff_backend_info (abfd)->_bfd_coff_swap_sym_out) (abfd, i, o)) -. -.#define bfd_coff_swap_scnhdr_out(abfd, i,o) \ -. ((coff_backend_info (abfd)->_bfd_coff_swap_scnhdr_out) (abfd, i, o)) -. -.#define bfd_coff_swap_filehdr_out(abfd, i,o) \ -. ((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_out) (abfd, i, o)) -. -.#define bfd_coff_swap_aouthdr_out(abfd, i,o) \ -. ((coff_backend_info (abfd)->_bfd_coff_swap_aouthdr_out) (abfd, i, o)) -. -.#define bfd_coff_filhsz(abfd) (coff_backend_info (abfd)->_bfd_filhsz) -.#define bfd_coff_aoutsz(abfd) (coff_backend_info (abfd)->_bfd_aoutsz) -.#define bfd_coff_scnhsz(abfd) (coff_backend_info (abfd)->_bfd_scnhsz) -.#define bfd_coff_symesz(abfd) (coff_backend_info (abfd)->_bfd_symesz) -.#define bfd_coff_auxesz(abfd) (coff_backend_info (abfd)->_bfd_auxesz) -.#define bfd_coff_relsz(abfd) (coff_backend_info (abfd)->_bfd_relsz) -.#define bfd_coff_linesz(abfd) (coff_backend_info (abfd)->_bfd_linesz) -.#define bfd_coff_long_filenames(abfd) (coff_backend_info (abfd)->_bfd_coff_long_filenames) -.#define bfd_coff_swap_filehdr_in(abfd, i,o) \ -. ((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_in) (abfd, i, o)) -. -.#define bfd_coff_swap_aouthdr_in(abfd, i,o) \ -. ((coff_backend_info (abfd)->_bfd_coff_swap_aouthdr_in) (abfd, i, o)) -. -.#define bfd_coff_swap_scnhdr_in(abfd, i,o) \ -. ((coff_backend_info (abfd)->_bfd_coff_swap_scnhdr_in) (abfd, i, o)) -. -.#define bfd_coff_swap_reloc_in(abfd, i, o) \ -. ((coff_backend_info (abfd)->_bfd_coff_swap_reloc_in) (abfd, i, o)) -. -.#define bfd_coff_bad_format_hook(abfd, filehdr) \ -. ((coff_backend_info (abfd)->_bfd_coff_bad_format_hook) (abfd, filehdr)) -. -.#define bfd_coff_set_arch_mach_hook(abfd, filehdr)\ -. ((coff_backend_info (abfd)->_bfd_coff_set_arch_mach_hook) (abfd, filehdr)) -.#define bfd_coff_mkobject_hook(abfd, filehdr, aouthdr)\ -. ((coff_backend_info (abfd)->_bfd_coff_mkobject_hook) (abfd, filehdr, aouthdr)) -. -.#define bfd_coff_styp_to_sec_flags_hook(abfd, scnhdr, name)\ -. ((coff_backend_info (abfd)->_bfd_styp_to_sec_flags_hook) (abfd, scnhdr, name)) -. -.#define bfd_coff_set_alignment_hook(abfd, sec, scnhdr)\ -. ((coff_backend_info (abfd)->_bfd_set_alignment_hook) (abfd, sec, scnhdr)) -. -.#define bfd_coff_slurp_symbol_table(abfd)\ -. ((coff_backend_info (abfd)->_bfd_coff_slurp_symbol_table) (abfd)) -. -.#define bfd_coff_symname_in_debug(abfd, sym)\ -. ((coff_backend_info (abfd)->_bfd_coff_symname_in_debug) (abfd, sym)) -. -.#define bfd_coff_print_aux(abfd, file, base, symbol, aux, indaux)\ -. ((coff_backend_info (abfd)->_bfd_coff_print_aux)\ -. (abfd, file, base, symbol, aux, indaux)) -. -.#define bfd_coff_reloc16_extra_cases(abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr)\ -. ((coff_backend_info (abfd)->_bfd_coff_reloc16_extra_cases)\ -. (abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr)) -. -.#define bfd_coff_reloc16_estimate(abfd, section, reloc, shrink, link_info)\ -. ((coff_backend_info (abfd)->_bfd_coff_reloc16_estimate)\ -. (abfd, section, reloc, shrink, link_info)) -. -.#define bfd_coff_sym_is_global(abfd, sym)\ -. ((coff_backend_info (abfd)->_bfd_coff_sym_is_global)\ -. (abfd, sym)) -. -.#define bfd_coff_compute_section_file_positions(abfd)\ -. ((coff_backend_info (abfd)->_bfd_coff_compute_section_file_positions)\ -. (abfd)) -. -.#define bfd_coff_start_final_link(obfd, info)\ -. ((coff_backend_info (obfd)->_bfd_coff_start_final_link)\ -. (obfd, info)) -.#define bfd_coff_relocate_section(obfd,info,ibfd,o,con,rel,isyms,secs)\ -. ((coff_backend_info (ibfd)->_bfd_coff_relocate_section)\ -. (obfd, info, ibfd, o, con, rel, isyms, secs)) -.#define bfd_coff_rtype_to_howto(abfd, sec, rel, h, sym, addendp)\ -. ((coff_backend_info (abfd)->_bfd_coff_rtype_to_howto)\ -. (abfd, sec, rel, h, sym, addendp)) -.#define bfd_coff_adjust_symndx(obfd, info, ibfd, sec, rel, adjustedp)\ -. ((coff_backend_info (abfd)->_bfd_coff_adjust_symndx)\ -. (obfd, info, ibfd, sec, rel, adjustedp)) -.#define bfd_coff_link_add_one_symbol(info,abfd,name,flags,section,value,string,cp,coll,hashp)\ -. ((coff_backend_info (abfd)->_bfd_coff_link_add_one_symbol)\ -. (info, abfd, name, flags, section, value, string, cp, coll, hashp)) -. -*/ - -/* See whether the magic number matches. */ - -static boolean -coff_bad_format_hook (abfd, filehdr) - bfd * abfd; - PTR filehdr; -{ - struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr; - - if (BADMAG (*internal_f)) - return false; - - /* if the optional header is NULL or not the correct size then - quit; the only difference I can see between m88k dgux headers (MC88DMAGIC) - and Intel 960 readwrite headers (I960WRMAGIC) is that the - optional header is of a different size. - - But the mips keeps extra stuff in it's opthdr, so dont check - when doing that - */ - -#if defined(M88) || defined(I960) - if (internal_f->f_opthdr != 0 && AOUTSZ != internal_f->f_opthdr) - return false; -#endif - - return true; -} - -/* - initialize a section structure with information peculiar to this - particular implementation of coff -*/ - -static boolean -coff_new_section_hook (abfd, section) - bfd * abfd; - asection * section; -{ - section->alignment_power = COFF_DEFAULT_SECTION_ALIGNMENT_POWER; - -#ifdef RS6000COFF_C - if (xcoff_data (abfd)->text_align_power != 0 - && strcmp (bfd_get_section_name (abfd, section), ".text") == 0) - section->alignment_power = xcoff_data (abfd)->text_align_power; - if (xcoff_data (abfd)->data_align_power != 0 - && strcmp (bfd_get_section_name (abfd, section), ".data") == 0) - section->alignment_power = xcoff_data (abfd)->data_align_power; -#endif - - /* Allocate aux records for section symbols, to store size and - related info. - - @@ Shouldn't use constant multiplier here! */ - coffsymbol (section->symbol)->native = - (combined_entry_type *) bfd_zalloc (abfd, - sizeof (combined_entry_type) * 10); - - /* The .stab section must be aligned to 2**2 at most, because - otherwise there may be gaps in the section which gdb will not - know how to interpret. Examining the section name is a hack, but - that is also how gdb locates the section. - We need to handle the .ctors and .dtors sections similarly, to - avoid introducing null words in the tables. */ - if (COFF_DEFAULT_SECTION_ALIGNMENT_POWER > 2 - && (strncmp (section->name, ".stab", 5) == 0 - || strcmp (section->name, ".ctors") == 0 - || strcmp (section->name, ".dtors") == 0)) - section->alignment_power = 2; - - /* Similarly, the .stabstr section must be aligned to 2**0 at most. */ - if (COFF_DEFAULT_SECTION_ALIGNMENT_POWER > 0 - && strncmp (section->name, ".stabstr", 8) == 0) - section->alignment_power = 0; - - return true; -} - -#ifdef I960 - -/* Set the alignment of a BFD section. */ - -static void -coff_set_alignment_hook (abfd, section, scnhdr) - bfd * abfd; - asection * section; - PTR scnhdr; -{ - struct internal_scnhdr *hdr = (struct internal_scnhdr *) scnhdr; - unsigned int i; - - for (i = 0; i < 32; i++) - if ((1 << i) >= hdr->s_align) - break; - section->alignment_power = i; -} - -#else /* ! I960 */ -#ifdef COFF_WITH_PE - -/* a couple of macros to help setting the alignment power field */ -#define ALIGN_SET(field,x,y) \ - if (((field) & IMAGE_SCN_ALIGN_64BYTES) == x )\ - {\ - section->alignment_power = y;\ - } - -#define ELIFALIGN_SET(field,x,y) \ - else if (( (field) & IMAGE_SCN_ALIGN_64BYTES) == x ) \ - {\ - section->alignment_power = y;\ - } - -static void -coff_set_alignment_hook (abfd, section, scnhdr) - bfd * abfd; - asection * section; - PTR scnhdr; -{ - struct internal_scnhdr *hdr = (struct internal_scnhdr *) scnhdr; - - ALIGN_SET (hdr->s_flags, IMAGE_SCN_ALIGN_64BYTES, 6) - ELIFALIGN_SET (hdr->s_flags, IMAGE_SCN_ALIGN_32BYTES, 5) - ELIFALIGN_SET (hdr->s_flags, IMAGE_SCN_ALIGN_16BYTES, 4) - ELIFALIGN_SET (hdr->s_flags, IMAGE_SCN_ALIGN_8BYTES, 3) - ELIFALIGN_SET (hdr->s_flags, IMAGE_SCN_ALIGN_4BYTES, 2) - ELIFALIGN_SET (hdr->s_flags, IMAGE_SCN_ALIGN_2BYTES, 1) - ELIFALIGN_SET (hdr->s_flags, IMAGE_SCN_ALIGN_1BYTES, 0) - -#ifdef POWERPC_LE_PE - if (strcmp (section->name, ".idata$2") == 0) - { - section->alignment_power = 0; - } - else if (strcmp (section->name, ".idata$3") == 0) - { - section->alignment_power = 0; - } - else if (strcmp (section->name, ".idata$4") == 0) - { - section->alignment_power = 2; - } - else if (strcmp (section->name, ".idata$5") == 0) - { - section->alignment_power = 2; - } - else if (strcmp (section->name, ".idata$6") == 0) - { - section->alignment_power = 1; - } - else if (strcmp (section->name, ".reloc") == 0) - { - section->alignment_power = 1; - } - else if (strncmp (section->name, ".stab", 5) == 0) - { - section->alignment_power = 2; - } -#endif -} -#undef ALIGN_SET -#undef ELIFALIGN_SET - -#else /* ! COFF_WITH_PE */ -#ifdef RS6000COFF_C - -/* We grossly abuse this function to handle XCOFF overflow headers. - When we see one, we correct the reloc and line number counts in the - real header, and remove the section we just created. */ - -static void -coff_set_alignment_hook (abfd, section, scnhdr) - bfd *abfd; - asection *section; - PTR scnhdr; -{ - struct internal_scnhdr *hdr = (struct internal_scnhdr *) scnhdr; - asection *real_sec; - asection **ps; - - if ((hdr->s_flags & STYP_OVRFLO) == 0) - return; - - real_sec = coff_section_from_bfd_index (abfd, hdr->s_nreloc); - if (real_sec == NULL) - return; - - real_sec->reloc_count = hdr->s_paddr; - real_sec->lineno_count = hdr->s_vaddr; - - for (ps = &abfd->sections; *ps != NULL; ps = &(*ps)->next) - { - if (*ps == section) - { - *ps = (*ps)->next; - --abfd->section_count; - break; - } - } -} - -#else /* ! RS6000COFF_C */ - -#define coff_set_alignment_hook \ - ((void (*) PARAMS ((bfd *, asection *, PTR))) bfd_void) - -#endif /* ! RS6000COFF_C */ -#endif /* ! COFF_WITH_PE */ -#endif /* ! I960 */ - -#ifndef coff_mkobject -static boolean -coff_mkobject (abfd) - bfd * abfd; -{ - coff_data_type *coff; - - abfd->tdata.coff_obj_data = (struct coff_tdata *) bfd_zalloc (abfd, sizeof (coff_data_type)); - if (abfd->tdata.coff_obj_data == 0) - return false; - coff = coff_data (abfd); - coff->symbols = (coff_symbol_type *) NULL; - coff->conversion_table = (unsigned int *) NULL; - coff->raw_syments = (struct coff_ptr_struct *) NULL; - coff->relocbase = 0; - coff->local_toc_sym_map = 0; - -/* make_abs_section(abfd);*/ - - return true; -} -#endif - -/* Create the COFF backend specific information. */ -#ifndef coff_mkobject_hook -static PTR -coff_mkobject_hook (abfd, filehdr, aouthdr) - bfd * abfd; - PTR filehdr; - PTR aouthdr; -{ - struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr; - coff_data_type *coff; - - if (coff_mkobject (abfd) == false) - return NULL; - - coff = coff_data (abfd); - - coff->sym_filepos = internal_f->f_symptr; - - /* These members communicate important constants about the symbol - table to GDB's symbol-reading code. These `constants' - unfortunately vary among coff implementations... */ - coff->local_n_btmask = N_BTMASK; - coff->local_n_btshft = N_BTSHFT; - coff->local_n_tmask = N_TMASK; - coff->local_n_tshift = N_TSHIFT; - coff->local_symesz = SYMESZ; - coff->local_auxesz = AUXESZ; - coff->local_linesz = LINESZ; - - obj_raw_syment_count (abfd) = - obj_conv_table_size (abfd) = - internal_f->f_nsyms; - -#ifdef RS6000COFF_C - if ((internal_f->f_flags & F_SHROBJ) != 0) - abfd->flags |= DYNAMIC; - if (aouthdr != NULL && internal_f->f_opthdr >= AOUTSZ) - { - struct internal_aouthdr *internal_a = - (struct internal_aouthdr *) aouthdr; - struct xcoff_tdata *xcoff; - - xcoff = xcoff_data (abfd); - xcoff->full_aouthdr = true; - 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; - xcoff->modtype = internal_a->o_modtype; - xcoff->cputype = internal_a->o_cputype; - xcoff->maxdata = internal_a->o_maxdata; - xcoff->maxstack = internal_a->o_maxstack; - } -#endif - - return (PTR) coff; -} -#endif - -/* Determine the machine architecture and type. FIXME: This is target - dependent because the magic numbers are defined in the target - dependent header files. But there is no particular need for this. - If the magic numbers were moved to a separate file, this function - would be target independent and would also be much more successful - at linking together COFF files for different architectures. */ - -static boolean -coff_set_arch_mach_hook (abfd, filehdr) - bfd *abfd; - PTR filehdr; -{ - long machine; - enum bfd_architecture arch; - struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr; - - machine = 0; - switch (internal_f->f_magic) - { -#ifdef PPCMAGIC - case PPCMAGIC: - arch = bfd_arch_powerpc; - machine = 0; /* what does this mean? (krk) */ - break; -#endif -#ifdef I386MAGIC - case I386MAGIC: - case I386PTXMAGIC: - case I386AIXMAGIC: /* Danbury PS/2 AIX C Compiler */ - case LYNXCOFFMAGIC: /* shadows the m68k Lynx number below, sigh */ - arch = bfd_arch_i386; - machine = 0; - break; -#endif -#ifdef A29K_MAGIC_BIG - case A29K_MAGIC_BIG: - case A29K_MAGIC_LITTLE: - arch = bfd_arch_a29k; - machine = 0; - break; -#endif -#ifdef ARMMAGIC - case ARMMAGIC: - arch = bfd_arch_arm; - machine =0; - break; -#endif -#ifdef MC68MAGIC - case MC68MAGIC: - case M68MAGIC: -#ifdef MC68KBCSMAGIC - case MC68KBCSMAGIC: -#endif -#ifdef APOLLOM68KMAGIC - case APOLLOM68KMAGIC: -#endif -#ifdef LYNXCOFFMAGIC - case LYNXCOFFMAGIC: -#endif - arch = bfd_arch_m68k; - machine = 68020; - break; -#endif -#ifdef MC88MAGIC - case MC88MAGIC: - case MC88DMAGIC: - case MC88OMAGIC: - arch = bfd_arch_m88k; - machine = 88100; - break; -#endif -#ifdef Z8KMAGIC - case Z8KMAGIC: - arch = bfd_arch_z8k; - switch (internal_f->f_flags & F_MACHMASK) - { - case F_Z8001: - machine = bfd_mach_z8001; - break; - case F_Z8002: - machine = bfd_mach_z8002; - break; - default: - return false; - } - break; -#endif -#ifdef I860 - case I860MAGIC: - arch = bfd_arch_i860; - break; -#endif -#ifdef I960 -#ifdef I960ROMAGIC - case I960ROMAGIC: - case I960RWMAGIC: - arch = bfd_arch_i960; - switch (F_I960TYPE & internal_f->f_flags) - { - default: - case F_I960CORE: - machine = bfd_mach_i960_core; - break; - case F_I960KB: - machine = bfd_mach_i960_kb_sb; - break; - case F_I960MC: - machine = bfd_mach_i960_mc; - break; - case F_I960XA: - machine = bfd_mach_i960_xa; - break; - case F_I960CA: - machine = bfd_mach_i960_ca; - break; - case F_I960KA: - machine = bfd_mach_i960_ka_sa; - break; - case F_I960JX: - machine = bfd_mach_i960_jx; - break; - case F_I960HX: - machine = bfd_mach_i960_hx; - break; - } - break; -#endif -#endif - -#ifdef RS6000COFF_C - case U802ROMAGIC: - case U802WRMAGIC: - case U802TOCMAGIC: - { - int cputype; - - if (xcoff_data (abfd)->cputype != -1) - cputype = xcoff_data (abfd)->cputype & 0xff; - else - { - /* We did not get a value from the a.out header. If the - file has not been stripped, we may be able to get the - architecture information from the first symbol, if it - is a .file symbol. */ - if (obj_raw_syment_count (abfd) == 0) - cputype = 0; - else - { - bfd_byte buf[SYMESZ]; - struct internal_syment sym; - - if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0 - || bfd_read (buf, 1, SYMESZ, abfd) != SYMESZ) - return false; - coff_swap_sym_in (abfd, (PTR) buf, (PTR) &sym); - if (sym.n_sclass == C_FILE) - cputype = sym.n_type & 0xff; - else - cputype = 0; - } - } - - /* FIXME: We don't handle all cases here. */ - switch (cputype) - { - default: - case 0: -#ifdef POWERMAC - /* PowerPC Macs use the same magic numbers as RS/6000 - (because that's how they were bootstrapped originally), - but they are always PowerPC architecture. */ - arch = bfd_arch_powerpc; - machine = 0; -#else - arch = bfd_arch_rs6000; - machine = 6000; -#endif /* POWERMAC */ - break; - - case 1: - arch = bfd_arch_powerpc; - machine = 601; - break; - case 2: /* 64 bit PowerPC */ - arch = bfd_arch_powerpc; - machine = 620; - break; - case 3: - arch = bfd_arch_powerpc; - machine = 0; - break; - case 4: - arch = bfd_arch_rs6000; - machine = 6000; - break; - } - } - break; -#endif - -#ifdef WE32KMAGIC - case WE32KMAGIC: - arch = bfd_arch_we32k; - machine = 0; - break; -#endif - -#ifdef H8300MAGIC - case H8300MAGIC: - arch = bfd_arch_h8300; - machine = bfd_mach_h8300; - /* !! FIXME this probably isn't the right place for this */ - abfd->flags |= BFD_IS_RELAXABLE; - break; -#endif - -#ifdef H8300HMAGIC - case H8300HMAGIC: - arch = bfd_arch_h8300; - machine = bfd_mach_h8300h; - /* !! FIXME this probably isn't the right place for this */ - abfd->flags |= BFD_IS_RELAXABLE; - break; -#endif - -#ifdef SH_ARCH_MAGIC_BIG - case SH_ARCH_MAGIC_BIG: - case SH_ARCH_MAGIC_LITTLE: - arch = bfd_arch_sh; - machine = 0; - break; -#endif - -#ifdef H8500MAGIC - case H8500MAGIC: - arch = bfd_arch_h8500; - machine = 0; - break; -#endif - -#ifdef SPARCMAGIC - case SPARCMAGIC: -#ifdef LYNXCOFFMAGIC - case LYNXCOFFMAGIC: -#endif - arch = bfd_arch_sparc; - machine = 0; - break; -#endif - - default: /* Unreadable input file type */ - arch = bfd_arch_obscure; - break; - } - - bfd_default_set_arch_mach (abfd, arch, machine); - return true; -} - -#ifdef SYMNAME_IN_DEBUG - -static boolean -symname_in_debug_hook (abfd, sym) - bfd * abfd; - struct internal_syment *sym; -{ - return SYMNAME_IN_DEBUG (sym) ? true : false; -} - -#else - -#define symname_in_debug_hook \ - (boolean (*) PARAMS ((bfd *, struct internal_syment *))) bfd_false - -#endif - -#ifdef RS6000COFF_C - -/* Handle the csect auxent of a C_EXT or C_HIDEXT symbol. */ - -static boolean coff_pointerize_aux_hook - PARAMS ((bfd *, combined_entry_type *, combined_entry_type *, - unsigned int, combined_entry_type *)); - -/*ARGSUSED*/ -static boolean -coff_pointerize_aux_hook (abfd, table_base, symbol, indaux, aux) - bfd *abfd; - combined_entry_type *table_base; - combined_entry_type *symbol; - unsigned int indaux; - combined_entry_type *aux; -{ - int class = symbol->u.syment.n_sclass; - - if ((class == C_EXT || class == C_HIDEXT) - && indaux + 1 == symbol->u.syment.n_numaux) - { - if (SMTYP_SMTYP (aux->u.auxent.x_csect.x_smtyp) == XTY_LD) - { - aux->u.auxent.x_csect.x_scnlen.p = - table_base + aux->u.auxent.x_csect.x_scnlen.l; - aux->fix_scnlen = 1; - } - - /* Return true to indicate that the caller should not do any - further work on this auxent. */ - return true; - } - - /* Return false to indicate that this auxent should be handled by - the caller. */ - return false; -} - -#else -#ifdef I960 - -/* We don't want to pointerize bal entries. */ - -static boolean coff_pointerize_aux_hook - PARAMS ((bfd *, combined_entry_type *, combined_entry_type *, - unsigned int, combined_entry_type *)); - -/*ARGSUSED*/ -static boolean -coff_pointerize_aux_hook (abfd, table_base, symbol, indaux, aux) - bfd *abfd; - combined_entry_type *table_base; - combined_entry_type *symbol; - unsigned int indaux; - combined_entry_type *aux; -{ - /* Return true if we don't want to pointerize this aux entry, which - is the case for the lastfirst aux entry for a C_LEAFPROC symbol. */ - return (indaux == 1 - && (symbol->u.syment.n_sclass == C_LEAFPROC - || symbol->u.syment.n_sclass == C_LEAFSTAT - || symbol->u.syment.n_sclass == C_LEAFEXT)); -} - -#else /* ! I960 */ - -#define coff_pointerize_aux_hook 0 - -#endif /* ! I960 */ -#endif /* ! RS6000COFF_C */ - -/* Print an aux entry. This returns true if it has printed it. */ - -static boolean coff_print_aux - PARAMS ((bfd *, FILE *, combined_entry_type *, combined_entry_type *, - combined_entry_type *, unsigned int)); - -static boolean -coff_print_aux (abfd, file, table_base, symbol, aux, indaux) - bfd *abfd; - FILE *file; - combined_entry_type *table_base; - combined_entry_type *symbol; - combined_entry_type *aux; - unsigned int indaux; -{ -#ifdef RS6000COFF_C - if ((symbol->u.syment.n_sclass == C_EXT - || symbol->u.syment.n_sclass == C_HIDEXT) - && indaux + 1 == symbol->u.syment.n_numaux) - { - /* This is a csect entry. */ - fprintf (file, "AUX "); - if (SMTYP_SMTYP (aux->u.auxent.x_csect.x_smtyp) != XTY_LD) - { - BFD_ASSERT (! aux->fix_scnlen); - fprintf (file, "val %5ld", aux->u.auxent.x_csect.x_scnlen.l); - } - else - { - fprintf (file, "indx "); - if (! aux->fix_scnlen) - fprintf (file, "%4ld", aux->u.auxent.x_csect.x_scnlen.l); - else - fprintf (file, "%4ld", - (long) (aux->u.auxent.x_csect.x_scnlen.p - table_base)); - } - fprintf (file, - " prmhsh %ld snhsh %u typ %d algn %d clss %u stb %ld snstb %u", - aux->u.auxent.x_csect.x_parmhash, - (unsigned int) aux->u.auxent.x_csect.x_snhash, - SMTYP_SMTYP (aux->u.auxent.x_csect.x_smtyp), - SMTYP_ALIGN (aux->u.auxent.x_csect.x_smtyp), - (unsigned int) aux->u.auxent.x_csect.x_smclas, - aux->u.auxent.x_csect.x_stab, - (unsigned int) aux->u.auxent.x_csect.x_snstab); - return true; - } -#endif - - /* Return false to indicate that no special action was taken. */ - return false; -} - -/* -SUBSUBSECTION - Writing relocations - - To write relocations, the back end steps though the - canonical relocation table and create an - @code{internal_reloc}. The symbol index to use is removed from - the @code{offset} field in the symbol table supplied. The - address comes directly from the sum of the section base - address and the relocation offset; the type is dug directly - from the howto field. Then the @code{internal_reloc} is - swapped into the shape of an @code{external_reloc} and written - out to disk. - -*/ - -#ifdef TARG_AUX - -static int compare_arelent_ptr PARAMS ((const PTR, const PTR)); - -/* AUX's ld wants relocations to be sorted */ -static int -compare_arelent_ptr (x, y) - const PTR x; - const PTR y; -{ - const arelent **a = (const arelent **) x; - const arelent **b = (const arelent **) y; - bfd_size_type aadr = (*a)->address; - bfd_size_type badr = (*b)->address; - - return (aadr < badr ? -1 : badr < aadr ? 1 : 0); -} - -#endif /* TARG_AUX */ - -static boolean -coff_write_relocs (abfd, first_undef) - bfd * abfd; - int first_undef; -{ - asection *s; - - for (s = abfd->sections; s != (asection *) NULL; s = s->next) - { - unsigned int i; - struct external_reloc dst; - arelent **p; - -#ifndef TARG_AUX - p = s->orelocation; -#else - /* sort relocations before we write them out */ - p = (arelent **) bfd_malloc (s->reloc_count * sizeof (arelent *)); - if (p == NULL && s->reloc_count > 0) - return false; - memcpy (p, s->orelocation, s->reloc_count * sizeof (arelent *)); - qsort (p, s->reloc_count, sizeof (arelent *), compare_arelent_ptr); -#endif - - if (bfd_seek (abfd, s->rel_filepos, SEEK_SET) != 0) - return false; - for (i = 0; i < s->reloc_count; i++) - { - struct internal_reloc n; - arelent *q = p[i]; - memset ((PTR) & n, 0, sizeof (n)); - - /* Now we've renumbered the symbols we know where the - undefined symbols live in the table. Check the reloc - entries for symbols who's output bfd isn't the right one. - This is because the symbol was undefined (which means - that all the pointers are never made to point to the same - place). This is a bad thing,'cause the symbols attached - to the output bfd are indexed, so that the relocation - entries know which symbol index they point to. So we - have to look up the output symbol here. */ - - if (q->sym_ptr_ptr[0]->the_bfd != abfd) - { - int i; - const char *sname = q->sym_ptr_ptr[0]->name; - asymbol **outsyms = abfd->outsymbols; - for (i = first_undef; outsyms[i]; i++) - { - const char *intable = outsyms[i]->name; - if (strcmp (intable, sname) == 0) { - /* got a hit, so repoint the reloc */ - q->sym_ptr_ptr = outsyms + i; - break; - } - } - } - - n.r_vaddr = q->address + s->vma; - -#ifdef R_IHCONST - /* The 29k const/consth reloc pair is a real kludge. The consth - part doesn't have a symbol; it has an offset. So rebuilt - that here. */ - if (q->howto->type == R_IHCONST) - n.r_symndx = q->addend; - else -#endif - if (q->sym_ptr_ptr) - { - if (q->sym_ptr_ptr == bfd_abs_section_ptr->symbol_ptr_ptr) - /* This is a relocation relative to the absolute symbol. */ - n.r_symndx = -1; - else - { - n.r_symndx = get_index ((*(q->sym_ptr_ptr))); - /* Take notice if the symbol reloc points to a symbol - we don't have in our symbol table. What should we - do for this?? */ - if (n.r_symndx > obj_conv_table_size (abfd)) - abort (); - } - } - -#ifdef SWAP_OUT_RELOC_OFFSET - n.r_offset = q->addend; -#endif - -#ifdef SELECT_RELOC - /* Work out reloc type from what is required */ - SELECT_RELOC (n, q->howto); -#else - n.r_type = q->howto->type; -#endif - coff_swap_reloc_out (abfd, &n, &dst); - if (bfd_write ((PTR) & dst, 1, RELSZ, abfd) != RELSZ) - return false; - } - -#ifdef TARG_AUX - if (p != NULL) - free (p); -#endif - } - - return true; -} - -/* Set flags and magic number of a coff file from architecture and machine - type. Result is true if we can represent the arch&type, false if not. */ - -static boolean -coff_set_flags (abfd, magicp, flagsp) - bfd * abfd; - unsigned *magicp; - unsigned short *flagsp; -{ - switch (bfd_get_arch (abfd)) - { -#ifdef Z8KMAGIC - case bfd_arch_z8k: - *magicp = Z8KMAGIC; - switch (bfd_get_mach (abfd)) - { - case bfd_mach_z8001: - *flagsp = F_Z8001; - break; - case bfd_mach_z8002: - *flagsp = F_Z8002; - break; - default: - return false; - } - return true; -#endif -#ifdef I960ROMAGIC - - case bfd_arch_i960: - - { - unsigned flags; - *magicp = I960ROMAGIC; - /* - ((bfd_get_file_flags(abfd) & WP_TEXT) ? I960ROMAGIC : - I960RWMAGIC); FIXME??? - */ - switch (bfd_get_mach (abfd)) - { - case bfd_mach_i960_core: - flags = F_I960CORE; - break; - case bfd_mach_i960_kb_sb: - flags = F_I960KB; - break; - case bfd_mach_i960_mc: - flags = F_I960MC; - break; - case bfd_mach_i960_xa: - flags = F_I960XA; - break; - case bfd_mach_i960_ca: - flags = F_I960CA; - break; - case bfd_mach_i960_ka_sa: - flags = F_I960KA; - break; - case bfd_mach_i960_jx: - flags = F_I960JX; - break; - case bfd_mach_i960_hx: - flags = F_I960HX; - break; - default: - return false; - } - *flagsp = flags; - return true; - } - break; -#endif -#ifdef ARMMAGIC - case bfd_arch_arm: - *magicp = ARMMAGIC; - return true; -#endif -#ifdef PPCMAGIC - case bfd_arch_powerpc: - *magicp = PPCMAGIC; - return true; - break; -#endif -#ifdef I386MAGIC - case bfd_arch_i386: - *magicp = I386MAGIC; -#ifdef LYNXOS - /* Just overwrite the usual value if we're doing Lynx. */ - *magicp = LYNXCOFFMAGIC; -#endif - return true; - break; -#endif -#ifdef I860MAGIC - case bfd_arch_i860: - *magicp = I860MAGIC; - return true; - break; -#endif -#ifdef MC68MAGIC - case bfd_arch_m68k: -#ifdef APOLLOM68KMAGIC - *magicp = APOLLO_COFF_VERSION_NUMBER; -#else - *magicp = MC68MAGIC; -#endif -#ifdef LYNXOS - /* Just overwrite the usual value if we're doing Lynx. */ - *magicp = LYNXCOFFMAGIC; -#endif - return true; - break; -#endif - -#ifdef MC88MAGIC - case bfd_arch_m88k: - *magicp = MC88OMAGIC; - return true; - break; -#endif -#ifdef H8300MAGIC - case bfd_arch_h8300: - switch (bfd_get_mach (abfd)) - { - case bfd_mach_h8300: - *magicp = H8300MAGIC; - return true; - case bfd_mach_h8300h: - *magicp = H8300HMAGIC; - return true; - } - break; -#endif - -#ifdef SH_ARCH_MAGIC_BIG - case bfd_arch_sh: - if (bfd_big_endian (abfd)) - *magicp = SH_ARCH_MAGIC_BIG; - else - *magicp = SH_ARCH_MAGIC_LITTLE; - return true; - break; -#endif - -#ifdef SPARCMAGIC - case bfd_arch_sparc: - *magicp = SPARCMAGIC; -#ifdef LYNXOS - /* Just overwrite the usual value if we're doing Lynx. */ - *magicp = LYNXCOFFMAGIC; -#endif - return true; - break; -#endif - -#ifdef H8500MAGIC - case bfd_arch_h8500: - *magicp = H8500MAGIC; - return true; - break; -#endif -#ifdef A29K_MAGIC_BIG - case bfd_arch_a29k: - if (bfd_big_endian (abfd)) - *magicp = A29K_MAGIC_BIG; - else - *magicp = A29K_MAGIC_LITTLE; - return true; - break; -#endif - -#ifdef WE32KMAGIC - case bfd_arch_we32k: - *magicp = WE32KMAGIC; - return true; - break; -#endif - -#ifdef U802TOCMAGIC - case bfd_arch_rs6000: -#ifndef PPCMAGIC - case bfd_arch_powerpc: -#endif - *magicp = U802TOCMAGIC; - return true; - break; -#endif - - default: /* Unknown architecture */ - /* return false; -- fall through to "return false" below, to avoid - "statement never reached" errors on the one below. */ - break; - } - - return false; -} - - -static boolean -coff_set_arch_mach (abfd, arch, machine) - bfd * abfd; - enum bfd_architecture arch; - unsigned long machine; -{ - unsigned dummy1; - unsigned short dummy2; - - if (! bfd_default_set_arch_mach (abfd, arch, machine)) - return false; - - if (arch != bfd_arch_unknown && - coff_set_flags (abfd, &dummy1, &dummy2) != true) - return false; /* We can't represent this type */ - - return true; /* We're easy ... */ -} - - -/* Calculate the file position for each section. */ - -static void -coff_compute_section_file_positions (abfd) - bfd * abfd; -{ - asection *current; - asection *previous = (asection *) NULL; - file_ptr sofar = FILHSZ; - -#ifndef I960 - file_ptr old_sofar; -#endif - unsigned int count; - -#ifdef RS6000COFF_C - /* On XCOFF, if we have symbols, set up the .debug section. */ - if (bfd_get_symcount (abfd) > 0) - { - bfd_size_type sz; - bfd_size_type i, symcount; - asymbol **symp; - - sz = 0; - symcount = bfd_get_symcount (abfd); - for (symp = abfd->outsymbols, i = 0; i < symcount; symp++, i++) - { - coff_symbol_type *cf; - - cf = coff_symbol_from (abfd, *symp); - if (cf != NULL - && cf->native != NULL - && SYMNAME_IN_DEBUG (&cf->native->u.syment)) - { - size_t len; - - len = strlen (bfd_asymbol_name (*symp)); - if (len > SYMNMLEN) - sz += len + 3; - } - } - if (sz > 0) - { - asection *dsec; - - dsec = bfd_make_section_old_way (abfd, ".debug"); - if (dsec == NULL) - abort (); - dsec->_raw_size = sz; - dsec->flags |= SEC_HAS_CONTENTS; - } - } -#endif - -#ifdef COFF_IMAGE_WITH_PE - int page_size; - if (coff_data (abfd)->link_info) - { - page_size = pe_data (abfd)->pe_opthdr.FileAlignment; - } - else - page_size = PE_DEF_FILE_ALIGNMENT; -#else -#ifdef COFF_PAGE_SIZE - int page_size = COFF_PAGE_SIZE; -#endif -#endif - - if (bfd_get_start_address (abfd)) - { - /* A start address may have been added to the original file. In this - case it will need an optional header to record it. */ - abfd->flags |= EXEC_P; - } - - if (abfd->flags & EXEC_P) - sofar += AOUTSZ; -#ifdef RS6000COFF_C - else if (xcoff_data (abfd)->full_aouthdr) - sofar += AOUTSZ; - else - sofar += SMALL_AOUTSZ; -#endif - - sofar += abfd->section_count * SCNHSZ; - -#ifdef RS6000COFF_C - /* XCOFF handles overflows in the reloc and line number count fields - by allocating a new section header to hold the correct counts. */ - for (current = abfd->sections; current != NULL; current = current->next) - if (current->reloc_count >= 0xffff || current->lineno_count >= 0xffff) - sofar += SCNHSZ; -#endif - - for (current = abfd->sections, count = 1; - current != (asection *) NULL; - current = current->next, ++count) - { - current->target_index = count; - - /* Only deal with sections which have contents */ - if (!(current->flags & SEC_HAS_CONTENTS)) - continue; - -#ifdef COFF_WITH_PE - /* Do not include the .junk section. This is where we collect section - data which we don't need. This is mainly the MS .debug$ data which - stores codeview debug data. */ - if (strcmp (current->name, ".junk") == 0) - { - continue; - } -#endif - - /* Align the sections in the file to the same boundary on - which they are aligned in virtual memory. I960 doesn't - do this (FIXME) so we can stay in sync with Intel. 960 - doesn't yet page from files... */ -#ifndef I960 - if ((abfd->flags & EXEC_P) != 0) - { - /* make sure this section is aligned on the right boundary - by - padding the previous section up if necessary */ - - old_sofar = sofar; - sofar = BFD_ALIGN (sofar, 1 << current->alignment_power); - if (previous != (asection *) NULL) - { - previous->_raw_size += sofar - old_sofar; - } - } - -#endif - - /* In demand paged files the low order bits of the file offset - must match the low order bits of the virtual address. */ -#ifdef COFF_PAGE_SIZE - if ((abfd->flags & D_PAGED) != 0 - && (current->flags & SEC_ALLOC) != 0) - sofar += (current->vma - sofar) % page_size; -#endif - current->filepos = sofar; - -#ifdef COFF_IMAGE_WITH_PE - /* With PE we have to pad each section to be a multiple of its page size - too, and remember both sizes. Cooked_size becomes very useful. */ - current->_cooked_size = current->_raw_size; - current->_raw_size = (current->_raw_size + page_size -1) & -page_size; -#endif - - sofar += current->_raw_size; - -#ifndef I960 - /* make sure that this section is of the right size too */ - old_sofar = sofar; - sofar = BFD_ALIGN (sofar, 1 << current->alignment_power); - current->_raw_size += sofar - old_sofar; -#endif - -#ifdef _LIB - /* Force .lib sections to start at zero. The vma is then - incremented in coff_set_section_contents. This is right for - SVR3.2. */ - if (strcmp (current->name, _LIB) == 0) - bfd_set_section_vma (abfd, current, 0); -#endif - - previous = current; - } - - obj_relocbase (abfd) = sofar; - abfd->output_has_begun = true; - -} - -#if 0 - -/* This can never work, because it is called too late--after the - section positions have been set. I can't figure out what it is - for, so I am going to disable it--Ian Taylor 20 March 1996. */ - -/* If .file, .text, .data, .bss symbols are missing, add them. */ -/* @@ Should we only be adding missing symbols, or overriding the aux - values for existing section symbols? */ -static boolean -coff_add_missing_symbols (abfd) - bfd *abfd; -{ - unsigned int nsyms = bfd_get_symcount (abfd); - asymbol **sympp = abfd->outsymbols; - asymbol **sympp2; - unsigned int i; - int need_text = 1, need_data = 1, need_bss = 1, need_file = 1; - - for (i = 0; i < nsyms; i++) - { - coff_symbol_type *csym = coff_symbol_from (abfd, sympp[i]); - CONST char *name; - if (csym) - { - /* only do this if there is a coff representation of the input - symbol */ - if (csym->native && csym->native->u.syment.n_sclass == C_FILE) - { - need_file = 0; - continue; - } - name = csym->symbol.name; - if (!name) - continue; - if (!strcmp (name, _TEXT)) - need_text = 0; -#ifdef APOLLO_M68 - else if (!strcmp (name, ".wtext")) - need_text = 0; -#endif - else if (!strcmp (name, _DATA)) - need_data = 0; - else if (!strcmp (name, _BSS)) - need_bss = 0; - } - } - /* Now i == bfd_get_symcount (abfd). */ - /* @@ For now, don't deal with .file symbol. */ - need_file = 0; - - if (!need_text && !need_data && !need_bss && !need_file) - return true; - nsyms += need_text + need_data + need_bss + need_file; - sympp2 = (asymbol **) bfd_alloc_by_size_t (abfd, nsyms * sizeof (asymbol *)); - if (!sympp2) - return false; - memcpy (sympp2, sympp, i * sizeof (asymbol *)); - if (need_file) - { - /* @@ Generate fake .file symbol, in sympp2[i], and increment i. */ - abort (); - } - if (need_text) - sympp2[i++] = coff_section_symbol (abfd, _TEXT); - if (need_data) - sympp2[i++] = coff_section_symbol (abfd, _DATA); - if (need_bss) - sympp2[i++] = coff_section_symbol (abfd, _BSS); - BFD_ASSERT (i == nsyms); - bfd_set_symtab (abfd, sympp2, nsyms); - return true; -} - -#endif /* 0 */ - -/* SUPPRESS 558 */ -/* SUPPRESS 529 */ -static boolean -coff_write_object_contents (abfd) - bfd * abfd; -{ - asection *current; - boolean hasrelocs = false; - boolean haslinno = false; - file_ptr scn_base; - file_ptr reloc_base; - file_ptr lineno_base; - file_ptr sym_base; - unsigned long reloc_size = 0; - unsigned long lnno_size = 0; - asection *text_sec = NULL; - asection *data_sec = NULL; - asection *bss_sec = NULL; - - struct internal_filehdr internal_f; - struct internal_aouthdr internal_a; - - bfd_set_error (bfd_error_system_call); - - /* Make a pass through the symbol table to count line number entries and - put them into the correct asections */ - - lnno_size = coff_count_linenumbers (abfd) * LINESZ; - - if (abfd->output_has_begun == false) - coff_compute_section_file_positions (abfd); - - reloc_base = obj_relocbase (abfd); - - /* Work out the size of the reloc and linno areas */ - - for (current = abfd->sections; current != NULL; current = - current->next) - reloc_size += current->reloc_count * RELSZ; - - lineno_base = reloc_base + reloc_size; - sym_base = lineno_base + lnno_size; - - /* Indicate in each section->line_filepos its actual file address */ - for (current = abfd->sections; current != NULL; current = - current->next) - { - if (current->lineno_count) - { - current->line_filepos = lineno_base; - current->moving_line_filepos = lineno_base; - lineno_base += current->lineno_count * LINESZ; - } - else - { - current->line_filepos = 0; - } - if (current->reloc_count) - { - current->rel_filepos = reloc_base; - reloc_base += current->reloc_count * RELSZ; - } - else - { - current->rel_filepos = 0; - } - } - - /* Write section headers to the file. */ - internal_f.f_nscns = 0; - - if ((abfd->flags & EXEC_P) != 0) - scn_base = FILHSZ + AOUTSZ; - else - { - scn_base = FILHSZ; -#ifdef RS6000COFF_C - if (xcoff_data (abfd)->full_aouthdr) - scn_base += AOUTSZ; - else - scn_base += SMALL_AOUTSZ; -#endif - } - - if (bfd_seek (abfd, scn_base, SEEK_SET) != 0) - return false; - - for (current = abfd->sections; - current != NULL; - current = current->next) - { - struct internal_scnhdr section; - -#ifdef COFF_WITH_PE - /* Do not include the .junk section. This is where we collect section - data which we don't need. This is mainly the MS .debug$ data which - stores codeview debug data. */ - if (strcmp (current->name, ".junk") == 0) - { - continue; - } - - /* If we've got a .reloc section, remember. */ - -#ifdef COFF_IMAGE_WITH_PE - if (strcmp (current->name, ".reloc") == 0) - { - pe_data (abfd)->has_reloc_section = 1; - } -#endif - -#endif - internal_f.f_nscns++; - strncpy (&(section.s_name[0]), current->name, 8); -#ifdef _LIB - /* Always set s_vaddr of .lib to 0. This is right for SVR3.2 - Ian Taylor . */ - if (strcmp (current->name, _LIB) == 0) - section.s_vaddr = 0; - else -#endif - section.s_vaddr = current->vma; - section.s_paddr = current->lma; - section.s_size = current->_raw_size; - -#ifdef COFF_WITH_PE - section.s_paddr = current->_cooked_size; -#endif - - /* - If this section has no size or is unloadable then the scnptr - will be 0 too - */ - if (current->_raw_size == 0 || - (current->flags & (SEC_LOAD | SEC_HAS_CONTENTS)) == 0) - { - section.s_scnptr = 0; - } - else - { - section.s_scnptr = current->filepos; - } - section.s_relptr = current->rel_filepos; - section.s_lnnoptr = current->line_filepos; - section.s_nreloc = current->reloc_count; - section.s_nlnno = current->lineno_count; - if (current->reloc_count != 0) - hasrelocs = true; - if (current->lineno_count != 0) - haslinno = true; - -#ifdef RS6000COFF_C - /* Indicate the use of an XCOFF overflow section header. */ - if (current->reloc_count >= 0xffff || current->lineno_count >= 0xffff) - { - section.s_nreloc = 0xffff; - section.s_nlnno = 0xffff; - } -#endif - - section.s_flags = sec_to_styp_flags (current->name, current->flags); - - if (!strcmp (current->name, _TEXT)) - { - text_sec = current; - } - else if (!strcmp (current->name, _DATA)) - { - data_sec = current; - } - else if (!strcmp (current->name, _BSS)) - { - bss_sec = current; - } - -#ifdef I960 - section.s_align = (current->alignment_power - ? 1 << current->alignment_power - : 0); - -#endif - -#ifdef COFF_IMAGE_WITH_PE - /* suppress output of the sections if they are null. ld includes - the bss and data sections even if there is no size assigned - to them. NT loader doesn't like it if these section headers are - included if the sections themselves are not needed */ - if (section.s_size == 0) - internal_f.f_nscns--; - else -#endif - { - SCNHDR buff; - if (coff_swap_scnhdr_out (abfd, §ion, &buff) == 0 - || bfd_write ((PTR) (&buff), 1, SCNHSZ, abfd) != SCNHSZ) - return false; - } - } - -#ifdef RS6000COFF_C - /* XCOFF handles overflows in the reloc and line number count fields - by creating a new section header to hold the correct values. */ - for (current = abfd->sections; current != NULL; current = current->next) - { - if (current->reloc_count >= 0xffff || current->lineno_count >= 0xffff) - { - struct internal_scnhdr scnhdr; - SCNHDR buff; - - internal_f.f_nscns++; - strncpy (&(scnhdr.s_name[0]), current->name, 8); - scnhdr.s_paddr = current->reloc_count; - scnhdr.s_vaddr = current->lineno_count; - scnhdr.s_size = 0; - scnhdr.s_scnptr = 0; - scnhdr.s_relptr = current->rel_filepos; - scnhdr.s_lnnoptr = current->line_filepos; - scnhdr.s_nreloc = current->target_index; - scnhdr.s_nlnno = current->target_index; - scnhdr.s_flags = STYP_OVRFLO; - if (coff_swap_scnhdr_out (abfd, &scnhdr, &buff) == 0 - || bfd_write ((PTR) &buff, 1, SCNHSZ, abfd) != SCNHSZ) - return false; - } - } -#endif - - /* OK, now set up the filehdr... */ - - /* Don't include the internal abs section in the section count */ - - /* - We will NOT put a fucking timestamp in the header here. Every time you - put it back, I will come in and take it out again. I'm sorry. This - field does not belong here. We fill it with a 0 so it compares the - same but is not a reasonable time. -- gnu@cygnus.com - */ - internal_f.f_timdat = 0; - - internal_f.f_flags = 0; - - if (abfd->flags & EXEC_P) - internal_f.f_opthdr = AOUTSZ; - else - { - internal_f.f_opthdr = 0; -#ifdef RS6000COFF_C - if (xcoff_data (abfd)->full_aouthdr) - internal_f.f_opthdr = AOUTSZ; - else - internal_f.f_opthdr = SMALL_AOUTSZ; -#endif - } - - if (!hasrelocs) - internal_f.f_flags |= F_RELFLG; - if (!haslinno) - internal_f.f_flags |= F_LNNO; - if (abfd->flags & EXEC_P) - internal_f.f_flags |= F_EXEC; - - /* FIXME: this is wrong for PPC_PE! */ - if (bfd_little_endian (abfd)) - internal_f.f_flags |= F_AR32WR; - else - internal_f.f_flags |= F_AR32W; - - /* - FIXME, should do something about the other byte orders and - architectures. - */ - -#ifdef RS6000COFF_C - if ((abfd->flags & DYNAMIC) != 0) - internal_f.f_flags |= F_SHROBJ; - if (bfd_get_section_by_name (abfd, _LOADER) != NULL) - internal_f.f_flags |= F_DYNLOAD; -#endif - - memset (&internal_a, 0, sizeof internal_a); - - /* Set up architecture-dependent stuff */ - - { - unsigned int magic = 0; - unsigned short flags = 0; - coff_set_flags (abfd, &magic, &flags); - internal_f.f_magic = magic; - internal_f.f_flags |= flags; - /* ...and the "opt"hdr... */ - -#ifdef A29K -#ifdef ULTRA3 /* NYU's machine */ - /* FIXME: This is a bogus check. I really want to see if there - * is a .shbss or a .shdata section, if so then set the magic - * number to indicate a shared data executable. - */ - if (internal_f.f_nscns >= 7) - internal_a.magic = SHMAGIC; /* Shared magic */ - else -#endif /* ULTRA3 */ - internal_a.magic = NMAGIC; /* Assume separate i/d */ -#define __A_MAGIC_SET__ -#endif /* A29K */ -#ifdef I860 - /* FIXME: What are the a.out magic numbers for the i860? */ - internal_a.magic = 0; -#define __A_MAGIC_SET__ -#endif /* I860 */ -#ifdef I960 - internal_a.magic = (magic == I960ROMAGIC ? NMAGIC : OMAGIC); -#define __A_MAGIC_SET__ -#endif /* I960 */ -#if M88 -#define __A_MAGIC_SET__ - internal_a.magic = PAGEMAGICBCS; -#endif /* M88 */ - -#if APOLLO_M68 -#define __A_MAGIC_SET__ - internal_a.magic = APOLLO_COFF_VERSION_NUMBER; -#endif - -#if defined(M68) || defined(WE32K) || defined(M68K) -#define __A_MAGIC_SET__ -#if defined(LYNXOS) - internal_a.magic = LYNXCOFFMAGIC; -#else -#if defined(TARG_AUX) - internal_a.magic = (abfd->flags & D_PAGED ? PAGEMAGICPEXECPAGED : - abfd->flags & WP_TEXT ? PAGEMAGICPEXECSWAPPED : - PAGEMAGICEXECSWAPPED); -#else -#if defined (PAGEMAGICPEXECPAGED) - internal_a.magic = PAGEMAGICPEXECPAGED; -#endif -#endif /* TARG_AUX */ -#endif /* LYNXOS */ -#endif /* M68 || WE32K || M68K */ - -#if defined(ARM) -#define __A_MAGIC_SET__ - internal_a.magic = ZMAGIC; -#endif -#if defined(PPC) -#define __A_MAGIC_SET__ - internal_a.magic = IMAGE_NT_OPTIONAL_HDR_MAGIC; -#endif -#if defined(I386) -#define __A_MAGIC_SET__ -#if defined(LYNXOS) - internal_a.magic = LYNXCOFFMAGIC; -#else /* LYNXOS */ - internal_a.magic = ZMAGIC; -#endif /* LYNXOS */ -#endif /* I386 */ - -#if defined(SPARC) -#define __A_MAGIC_SET__ -#if defined(LYNXOS) - internal_a.magic = LYNXCOFFMAGIC; -#endif /* LYNXOS */ -#endif /* SPARC */ - -#if RS6000COFF_C -#define __A_MAGIC_SET__ - internal_a.magic = (abfd->flags & D_PAGED) ? RS6K_AOUTHDR_ZMAGIC : - (abfd->flags & WP_TEXT) ? RS6K_AOUTHDR_NMAGIC : - RS6K_AOUTHDR_OMAGIC; -#endif - -#ifndef __A_MAGIC_SET__ -#include "Your aouthdr magic number is not being set!" -#else -#undef __A_MAGIC_SET__ -#endif - } - - /* FIXME: Does anybody ever set this to another value? */ - internal_a.vstamp = 0; - - /* Now should write relocs, strings, syms */ - obj_sym_filepos (abfd) = sym_base; - - if (bfd_get_symcount (abfd) != 0) - { - int firstundef; -#if 0 - if (!coff_add_missing_symbols (abfd)) - return false; -#endif - if (!coff_renumber_symbols (abfd, &firstundef)) - return false; - coff_mangle_symbols (abfd); - if (! coff_write_symbols (abfd)) - return false; - if (! coff_write_linenumbers (abfd)) - return false; - if (! coff_write_relocs (abfd, firstundef)) - return false; - } -#ifdef COFF_IMAGE_WITH_PE -#ifdef PPC - else if ((abfd->flags & EXEC_P) != 0) - { - bfd_byte b; - - /* PowerPC PE appears to require that all executable files be - rounded up to the page size. */ - b = 0; - if (bfd_seek (abfd, - BFD_ALIGN (sym_base, COFF_PAGE_SIZE) - 1, - SEEK_SET) != 0 - || bfd_write (&b, 1, 1, abfd) != 1) - return false; - } -#endif -#endif - - /* If bfd_get_symcount (abfd) != 0, then we are not using the COFF - backend linker, and obj_raw_syment_count is not valid until after - coff_write_symbols is called. */ - if (obj_raw_syment_count (abfd) != 0) - { - internal_f.f_symptr = sym_base; -#ifdef RS6000COFF_C - /* AIX appears to require that F_RELFLG not be set if there are - local symbols but no relocations. */ - internal_f.f_flags &=~ F_RELFLG; -#endif - } - else - { - internal_f.f_symptr = 0; - internal_f.f_flags |= F_LSYMS; - } - - if (text_sec) - { - internal_a.tsize = bfd_get_section_size_before_reloc (text_sec); - internal_a.text_start = internal_a.tsize ? text_sec->vma : 0; - } - if (data_sec) - { - internal_a.dsize = bfd_get_section_size_before_reloc (data_sec); - internal_a.data_start = internal_a.dsize ? data_sec->vma : 0; - } - if (bss_sec) - { - internal_a.bsize = bfd_get_section_size_before_reloc (bss_sec); - if (internal_a.bsize && bss_sec->vma < internal_a.data_start) - internal_a.data_start = bss_sec->vma; - } - - internal_a.entry = bfd_get_start_address (abfd); - internal_f.f_nsyms = obj_raw_syment_count (abfd); - -#ifdef RS6000COFF_C - if (xcoff_data (abfd)->full_aouthdr) - { - bfd_vma toc; - asection *loader_sec; - - internal_a.vstamp = 1; - - internal_a.o_snentry = xcoff_data (abfd)->snentry; - if (internal_a.o_snentry == 0) - internal_a.entry = (bfd_vma) -1; - - if (text_sec != NULL) - { - internal_a.o_sntext = text_sec->target_index; - internal_a.o_algntext = bfd_get_section_alignment (abfd, text_sec); - } - else - { - internal_a.o_sntext = 0; - internal_a.o_algntext = 0; - } - if (data_sec != NULL) - { - internal_a.o_sndata = data_sec->target_index; - internal_a.o_algndata = bfd_get_section_alignment (abfd, data_sec); - } - else - { - internal_a.o_sndata = 0; - internal_a.o_algndata = 0; - } - loader_sec = bfd_get_section_by_name (abfd, ".loader"); - if (loader_sec != NULL) - internal_a.o_snloader = loader_sec->target_index; - else - internal_a.o_snloader = 0; - if (bss_sec != NULL) - internal_a.o_snbss = bss_sec->target_index; - else - internal_a.o_snbss = 0; - - toc = xcoff_data (abfd)->toc; - internal_a.o_toc = toc; - internal_a.o_sntoc = xcoff_data (abfd)->sntoc; - - internal_a.o_modtype = xcoff_data (abfd)->modtype; - if (xcoff_data (abfd)->cputype != -1) - internal_a.o_cputype = xcoff_data (abfd)->cputype; - else - { - switch (bfd_get_arch (abfd)) - { - case bfd_arch_rs6000: - internal_a.o_cputype = 4; - break; - case bfd_arch_powerpc: - if (bfd_get_mach (abfd) == 0) - internal_a.o_cputype = 3; - else - internal_a.o_cputype = 1; - break; - default: - abort (); - } - } - internal_a.o_maxstack = xcoff_data (abfd)->maxstack; - internal_a.o_maxdata = xcoff_data (abfd)->maxdata; - } -#endif - - /* now write them */ - if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) - return false; - { - FILHDR buff; - coff_swap_filehdr_out (abfd, (PTR) & internal_f, (PTR) & buff); - if (bfd_write ((PTR) & buff, 1, FILHSZ, abfd) != FILHSZ) - return false; - } - if (abfd->flags & EXEC_P) - { - AOUTHDR buff; - coff_swap_aouthdr_out (abfd, (PTR) & internal_a, (PTR) & buff); - if (bfd_write ((PTR) & buff, 1, AOUTSZ, abfd) != AOUTSZ) - return false; - } -#ifdef RS6000COFF_C - else - { - AOUTHDR buff; - size_t size; - - /* XCOFF seems to always write at least a small a.out header. */ - coff_swap_aouthdr_out (abfd, (PTR) &internal_a, (PTR) &buff); - if (xcoff_data (abfd)->full_aouthdr) - size = AOUTSZ; - else - size = SMALL_AOUTSZ; - if (bfd_write ((PTR) &buff, 1, size, abfd) != size) - return false; - } -#endif - - return true; -} - -static boolean -coff_set_section_contents (abfd, section, location, offset, count) - bfd * abfd; - sec_ptr section; - PTR location; - file_ptr offset; - bfd_size_type count; -{ - if (abfd->output_has_begun == false) /* set by bfd.c handler */ - coff_compute_section_file_positions (abfd); - -#ifdef _LIB - - /* The physical address field of a .lib section is used to hold the - number of shared libraries in the section. This code counts the - number of sections being written, and increments the lma field - with the number. - - I have found no documentation on the contents of this section. - Experimentation indicates that the section contains zero or more - records, each of which has the following structure: - - - a (four byte) word holding the length of this record, in words, - - a word that always seems to be set to "2", - - the path to a shared library, null-terminated and then padded - to a whole word boundary. - - bfd_assert calls have been added to alert if an attempt is made - to write a section which doesn't follow these assumptions. The - code has been tested on ISC 4.1 by me, and on SCO by Robert Lipe - (Thanks!). - - Gvran Uddeborg */ - - if (strcmp (section->name, _LIB) == 0) - { - bfd_byte *rec, *recend; - - rec = (bfd_byte *) location; - recend = rec + count; - while (rec < recend) - { - ++section->lma; - rec += bfd_get_32 (abfd, rec) * 4; - } - - BFD_ASSERT (rec == recend); - } - -#endif - - /* Don't write out bss sections - one way to do this is to - see if the filepos has not been set. */ - if (section->filepos == 0) - return true; - - if (bfd_seek (abfd, (file_ptr) (section->filepos + offset), SEEK_SET) != 0) - return false; - - if (count != 0) - { - return (bfd_write (location, 1, count, abfd) == count) ? true : false; - } - return true; -} -#if 0 -static boolean -coff_close_and_cleanup (abfd) - bfd *abfd; -{ - if (!bfd_read_p (abfd)) - switch (abfd->format) - { - case bfd_archive: - if (!_bfd_write_archive_contents (abfd)) - return false; - break; - case bfd_object: - if (!coff_write_object_contents (abfd)) - return false; - break; - default: - bfd_set_error (bfd_error_invalid_operation); - return false; - } - - /* We depend on bfd_close to free all the memory on the obstack. */ - /* FIXME if bfd_release is not using obstacks! */ - return true; -} - -#endif - -static PTR -buy_and_read (abfd, where, seek_direction, size) - bfd *abfd; - file_ptr where; - int seek_direction; - size_t size; -{ - PTR area = (PTR) bfd_alloc (abfd, size); - if (!area) - return (NULL); - if (bfd_seek (abfd, where, seek_direction) != 0 - || bfd_read (area, 1, size, abfd) != size) - return (NULL); - return (area); -} /* buy_and_read() */ - -/* -SUBSUBSECTION - Reading linenumbers - - Creating the linenumber table is done by reading in the entire - coff linenumber table, and creating another table for internal use. - - A coff linenumber table is structured so that each function - is marked as having a line number of 0. Each line within the - function is an offset from the first line in the function. The - base of the line number information for the table is stored in - the symbol associated with the function. - - The information is copied from the external to the internal - table, and each symbol which marks a function is marked by - pointing its... - - How does this work ? - -*/ - -static boolean -coff_slurp_line_table (abfd, asect) - bfd *abfd; - asection *asect; -{ - LINENO *native_lineno; - alent *lineno_cache; - - BFD_ASSERT (asect->lineno == (alent *) NULL); - - native_lineno = (LINENO *) buy_and_read (abfd, - asect->line_filepos, - SEEK_SET, - (size_t) (LINESZ * - asect->lineno_count)); - lineno_cache = - (alent *) bfd_alloc (abfd, (size_t) ((asect->lineno_count + 1) * sizeof (alent))); - if (lineno_cache == NULL) - return false; - else - { - unsigned int counter = 0; - alent *cache_ptr = lineno_cache; - LINENO *src = native_lineno; - - while (counter < asect->lineno_count) - { - struct internal_lineno dst; - coff_swap_lineno_in (abfd, src, &dst); - cache_ptr->line_number = dst.l_lnno; - - if (cache_ptr->line_number == 0) - { - coff_symbol_type *sym = - (coff_symbol_type *) (dst.l_addr.l_symndx - + obj_raw_syments (abfd))->u.syment._n._n_n._n_zeroes; - cache_ptr->u.sym = (asymbol *) sym; - if (sym->lineno != NULL) - { - (*_bfd_error_handler) - ("%s: warning: duplicate line number information for `%s'", - bfd_get_filename (abfd), - bfd_asymbol_name (&sym->symbol)); - } - sym->lineno = cache_ptr; - } - else - { - cache_ptr->u.offset = dst.l_addr.l_paddr - - bfd_section_vma (abfd, asect); - } /* If no linenumber expect a symbol index */ - - cache_ptr++; - src++; - counter++; - } - cache_ptr->line_number = 0; - - } - asect->lineno = lineno_cache; - /* FIXME, free native_lineno here, or use alloca or something. */ - return true; -} - -static boolean -coff_slurp_symbol_table (abfd) - bfd * abfd; -{ - combined_entry_type *native_symbols; - coff_symbol_type *cached_area; - unsigned int *table_ptr; - - unsigned int number_of_symbols = 0; - - if (obj_symbols (abfd)) - return true; - - /* Read in the symbol table */ - if ((native_symbols = coff_get_normalized_symtab (abfd)) == NULL) - { - return (false); - } /* on error */ - - /* Allocate enough room for all the symbols in cached form */ - cached_area = ((coff_symbol_type *) - bfd_alloc (abfd, - (obj_raw_syment_count (abfd) - * sizeof (coff_symbol_type)))); - - if (cached_area == NULL) - return false; - table_ptr = ((unsigned int *) - bfd_alloc (abfd, - (obj_raw_syment_count (abfd) - * sizeof (unsigned int)))); - - if (table_ptr == NULL) - return false; - else - { - coff_symbol_type *dst = cached_area; - unsigned int last_native_index = obj_raw_syment_count (abfd); - unsigned int this_index = 0; - while (this_index < last_native_index) - { - combined_entry_type *src = native_symbols + this_index; - table_ptr[this_index] = number_of_symbols; - dst->symbol.the_bfd = abfd; - - dst->symbol.name = (char *) (src->u.syment._n._n_n._n_offset); - /* We use the native name field to point to the cached field. */ - src->u.syment._n._n_n._n_zeroes = (long) dst; - dst->symbol.section = coff_section_from_bfd_index (abfd, - src->u.syment.n_scnum); - dst->symbol.flags = 0; - dst->done_lineno = false; - - switch (src->u.syment.n_sclass) - { -#ifdef I960 - case C_LEAFEXT: -#if 0 - dst->symbol.value = src->u.syment.n_value - dst->symbol.section->vma; - dst->symbol.flags = BSF_EXPORT | BSF_GLOBAL; - dst->symbol.flags |= BSF_NOT_AT_END | BSF_FUNCTION; -#endif - /* Fall through to next case */ - -#endif - - case C_EXT: -#ifdef RS6000COFF_C - case C_HIDEXT: -#endif -#ifdef COFF_WITH_PE - /* PE uses storage class 0x68 to denote a section symbol */ - case C_SECTION: - /* PE uses storage class 0x67 for a weak external symbol. */ - case C_NT_WEAK: -#endif - if ((src->u.syment.n_scnum) == 0) - { - if ((src->u.syment.n_value) == 0) - { - dst->symbol.section = bfd_und_section_ptr; - dst->symbol.value = 0; - } - else - { - dst->symbol.section = bfd_com_section_ptr; - dst->symbol.value = (src->u.syment.n_value); - } - } - else - { - /* Base the value as an index from the base of the - section */ - - dst->symbol.flags = BSF_EXPORT | BSF_GLOBAL; - dst->symbol.value = (src->u.syment.n_value - - dst->symbol.section->vma); - - if (ISFCN ((src->u.syment.n_type))) - { - /* A function ext does not go at the end of a - file. */ - dst->symbol.flags |= BSF_NOT_AT_END | BSF_FUNCTION; - } - } - -#ifdef RS6000COFF_C - /* A C_HIDEXT symbol is not global. */ - if (src->u.syment.n_sclass == C_HIDEXT) - dst->symbol.flags = BSF_LOCAL; - /* A symbol with a csect entry should not go at the end. */ - if (src->u.syment.n_numaux > 0) - dst->symbol.flags |= BSF_NOT_AT_END; -#endif - -#ifdef COFF_WITH_PE - if (src->u.syment.n_sclass == C_NT_WEAK) - dst->symbol.flags = BSF_WEAK; -#endif - - break; - - case C_STAT: /* static */ -#ifdef I960 - case C_LEAFSTAT: /* static leaf procedure */ -#endif - case C_LABEL: /* label */ - if (src->u.syment.n_scnum == -2) - dst->symbol.flags = BSF_DEBUGGING; - else - dst->symbol.flags = BSF_LOCAL; - /* - Base the value as an index from the base of the section, if - there is one - */ - if (dst->symbol.section) - dst->symbol.value = (src->u.syment.n_value) - - dst->symbol.section->vma; - else - dst->symbol.value = (src->u.syment.n_value); - break; - - case C_MOS: /* member of structure */ - case C_EOS: /* end of structure */ -#ifdef NOTDEF /* C_AUTOARG has the same value */ -#ifdef C_GLBLREG - case C_GLBLREG: /* A29k-specific storage class */ -#endif -#endif - case C_REGPARM: /* register parameter */ - case C_REG: /* register variable */ -#ifdef C_AUTOARG - case C_AUTOARG: /* 960-specific storage class */ -#endif - case C_TPDEF: /* type definition */ - case C_ARG: - case C_AUTO: /* automatic variable */ - case C_FIELD: /* bit field */ - case C_ENTAG: /* enumeration tag */ - case C_MOE: /* member of enumeration */ - case C_MOU: /* member of union */ - case C_UNTAG: /* union tag */ - dst->symbol.flags = BSF_DEBUGGING; - dst->symbol.value = (src->u.syment.n_value); - break; - - case C_FILE: /* file name */ - case C_STRTAG: /* structure tag */ -#ifdef RS6000COFF_C - case C_GSYM: - case C_LSYM: - case C_PSYM: - case C_RSYM: - case C_RPSYM: - case C_STSYM: - case C_BCOMM: - case C_ECOMM: - case C_DECL: - case C_ENTRY: - case C_FUN: - case C_ESTAT: -#endif - dst->symbol.flags = BSF_DEBUGGING; - dst->symbol.value = (src->u.syment.n_value); - break; - -#ifdef RS6000COFF_C - case C_BINCL: /* beginning of include file */ - case C_EINCL: /* ending of include file */ - /* The value is actually a pointer into the line numbers - of the file. We locate the line number entry, and - set the section to the section which contains it, and - the value to the index in that section. */ - { - asection *sec; - - dst->symbol.flags = BSF_DEBUGGING; - for (sec = abfd->sections; sec != NULL; sec = sec->next) - if (sec->line_filepos <= (file_ptr) src->u.syment.n_value - && ((file_ptr) (sec->line_filepos - + sec->lineno_count * LINESZ) - > (file_ptr) src->u.syment.n_value)) - break; - if (sec == NULL) - dst->symbol.value = 0; - else - { - dst->symbol.section = sec; - dst->symbol.value = ((src->u.syment.n_value - - sec->line_filepos) - / LINESZ); - src->fix_line = 1; - } - } - break; - - case C_BSTAT: - dst->symbol.flags = BSF_DEBUGGING; - - /* The value is actually a symbol index. Save a pointer - to the symbol instead of the index. FIXME: This - should use a union. */ - src->u.syment.n_value = - (long) (native_symbols + src->u.syment.n_value); - dst->symbol.value = src->u.syment.n_value; - src->fix_value = 1; - break; -#endif - - case C_BLOCK: /* ".bb" or ".eb" */ - case C_FCN: /* ".bf" or ".ef" */ - case C_EFCN: /* physical end of function */ - dst->symbol.flags = BSF_LOCAL; - /* - Base the value as an index from the base of the section - */ - dst->symbol.value = (src->u.syment.n_value) - dst->symbol.section->vma; - break; - - case C_NULL: - case C_EXTDEF: /* external definition */ - case C_ULABEL: /* undefined label */ - case C_USTATIC: /* undefined static */ -#ifndef COFF_WITH_PE - /* C_LINE in regular coff is 0x68. NT has taken over this storage - class to represent a section symbol */ - case C_LINE: /* line # reformatted as symbol table entry */ - /* NT uses 0x67 for a weak symbol, not C_ALIAS. */ - case C_ALIAS: /* duplicate tag */ -#endif - case C_HIDDEN: /* ext symbol in dmert public lib */ - default: - (*_bfd_error_handler) - ("%s: Unrecognized storage class %d for %s symbol `%s'", - bfd_get_filename (abfd), src->u.syment.n_sclass, - dst->symbol.section->name, dst->symbol.name); - dst->symbol.flags = BSF_DEBUGGING; - dst->symbol.value = (src->u.syment.n_value); - break; - } - -/* BFD_ASSERT(dst->symbol.flags != 0);*/ - - dst->native = src; - - dst->symbol.udata.i = 0; - dst->lineno = (alent *) NULL; - this_index += (src->u.syment.n_numaux) + 1; - dst++; - number_of_symbols++; - } /* walk the native symtab */ - } /* bfdize the native symtab */ - - obj_symbols (abfd) = cached_area; - obj_raw_syments (abfd) = native_symbols; - - bfd_get_symcount (abfd) = number_of_symbols; - obj_convert (abfd) = table_ptr; - /* Slurp the line tables for each section too */ - { - asection *p; - p = abfd->sections; - while (p) - { - coff_slurp_line_table (abfd, p); - p = p->next; - } - } - return true; -} /* coff_slurp_symbol_table() */ - -/* Check whether a symbol is globally visible. This is used by the - COFF backend linker code in cofflink.c, since a couple of targets - have globally visible symbols which are not class C_EXT. This - function need not handle the case of n_class == C_EXT. */ - -#undef OTHER_GLOBAL_CLASS - -#ifdef I960 -#define OTHER_GLOBAL_CLASS C_LEAFEXT -#endif - -#ifdef COFF_WITH_PE -#define OTHER_GLOBAL_CLASS C_SECTION -#endif - -#ifdef OTHER_GLOBAL_CLASS - -static boolean -coff_sym_is_global (abfd, syment) - bfd *abfd; - struct internal_syment *syment; -{ - if (syment->n_sclass == OTHER_GLOBAL_CLASS) - return true; - return false; -} - -#undef OTHER_GLOBAL_CLASS - -#else /* ! defined (OTHER_GLOBAL_CLASS) */ - -/* sym_is_global should not be defined if it has nothing to do. */ - -#define coff_sym_is_global 0 - -#endif /* ! defined (OTHER_GLOBAL_CLASS) */ - -/* -SUBSUBSECTION - Reading relocations - - Coff relocations are easily transformed into the internal BFD form - (@code{arelent}). - - Reading a coff relocation table is done in the following stages: - - o Read the entire coff relocation table into memory. - - o Process each relocation in turn; first swap it from the - external to the internal form. - - o Turn the symbol referenced in the relocation's symbol index - into a pointer into the canonical symbol table. - This table is the same as the one returned by a call to - @code{bfd_canonicalize_symtab}. The back end will call that - routine and save the result if a canonicalization hasn't been done. - - o The reloc index is turned into a pointer to a howto - structure, in a back end specific way. For instance, the 386 - and 960 use the @code{r_type} to directly produce an index - into a howto table vector; the 88k subtracts a number from the - @code{r_type} field and creates an addend field. - - -*/ - -#ifndef CALC_ADDEND -#define CALC_ADDEND(abfd, ptr, reloc, cache_ptr) \ - { \ - coff_symbol_type *coffsym = (coff_symbol_type *) NULL; \ - if (ptr && bfd_asymbol_bfd (ptr) != abfd) \ - coffsym = (obj_symbols (abfd) \ - + (cache_ptr->sym_ptr_ptr - symbols)); \ - else if (ptr) \ - coffsym = coff_symbol_from (abfd, ptr); \ - if (coffsym != (coff_symbol_type *) NULL \ - && coffsym->native->u.syment.n_scnum == 0) \ - cache_ptr->addend = 0; \ - else if (ptr && bfd_asymbol_bfd (ptr) == abfd \ - && ptr->section != (asection *) NULL) \ - cache_ptr->addend = - (ptr->section->vma + ptr->value); \ - else \ - cache_ptr->addend = 0; \ - } -#endif - -static boolean -coff_slurp_reloc_table (abfd, asect, symbols) - bfd * abfd; - sec_ptr asect; - asymbol ** symbols; -{ - RELOC *native_relocs; - arelent *reloc_cache; - arelent *cache_ptr; - - unsigned int idx; - - if (asect->relocation) - return true; - if (asect->reloc_count == 0) - return true; - if (asect->flags & SEC_CONSTRUCTOR) - return true; - if (!coff_slurp_symbol_table (abfd)) - return false; - native_relocs = - (RELOC *) buy_and_read (abfd, - asect->rel_filepos, - SEEK_SET, - (size_t) (RELSZ * - asect->reloc_count)); - reloc_cache = (arelent *) - bfd_alloc (abfd, (size_t) (asect->reloc_count * sizeof (arelent))); - - if (reloc_cache == NULL) - return false; - - - for (idx = 0; idx < asect->reloc_count; idx++) - { -#ifdef RELOC_PROCESSING - struct internal_reloc dst; - struct external_reloc *src; - - cache_ptr = reloc_cache + idx; - src = native_relocs + idx; - coff_swap_reloc_in (abfd, src, &dst); - - RELOC_PROCESSING (cache_ptr, &dst, symbols, abfd, asect); -#else - struct internal_reloc dst; - asymbol *ptr; - struct external_reloc *src; - - cache_ptr = reloc_cache + idx; - src = native_relocs + idx; - - coff_swap_reloc_in (abfd, src, &dst); - - - cache_ptr->address = dst.r_vaddr; - - if (dst.r_symndx != -1) - { - /* @@ Should never be greater than count of symbols! */ - if (dst.r_symndx >= obj_conv_table_size (abfd)) - abort (); - cache_ptr->sym_ptr_ptr = symbols + obj_convert (abfd)[dst.r_symndx]; - ptr = *(cache_ptr->sym_ptr_ptr); - } - else - { - cache_ptr->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; - ptr = 0; - } - - /* The symbols definitions that we have read in have been - relocated as if their sections started at 0. But the offsets - refering to the symbols in the raw data have not been - modified, so we have to have a negative addend to compensate. - - Note that symbols which used to be common must be left alone */ - - /* Calculate any reloc addend by looking at the symbol */ - CALC_ADDEND (abfd, ptr, dst, cache_ptr); - - cache_ptr->address -= asect->vma; -/* !! cache_ptr->section = (asection *) NULL;*/ - - /* Fill in the cache_ptr->howto field from dst.r_type */ - RTYPE2HOWTO (cache_ptr, &dst); -#endif - - } - - asect->relocation = reloc_cache; - return true; -} - -#ifndef coff_rtype_to_howto -#ifdef RTYPE2HOWTO - -/* Get the howto structure for a reloc. This is only used if the file - including this one defines coff_relocate_section to be - _bfd_coff_generic_relocate_section, so it is OK if it does not - always work. It is the responsibility of the including file to - make sure it is reasonable if it is needed. */ - -static reloc_howto_type *coff_rtype_to_howto - PARAMS ((bfd *, asection *, struct internal_reloc *, - struct coff_link_hash_entry *, struct internal_syment *, - bfd_vma *)); - -/*ARGSUSED*/ -static reloc_howto_type * -coff_rtype_to_howto (abfd, sec, rel, h, sym, addendp) - bfd *abfd; - asection *sec; - struct internal_reloc *rel; - struct coff_link_hash_entry *h; - struct internal_syment *sym; - bfd_vma *addendp; -{ - arelent genrel; - - RTYPE2HOWTO (&genrel, rel); - return genrel.howto; -} - -#else /* ! defined (RTYPE2HOWTO) */ - -#define coff_rtype_to_howto NULL - -#endif /* ! defined (RTYPE2HOWTO) */ -#endif /* ! defined (coff_rtype_to_howto) */ - -/* This is stupid. This function should be a boolean predicate. */ -static long -coff_canonicalize_reloc (abfd, section, relptr, symbols) - bfd * abfd; - sec_ptr section; - arelent ** relptr; - asymbol ** symbols; -{ - arelent *tblptr = section->relocation; - unsigned int count = 0; - - - if (section->flags & SEC_CONSTRUCTOR) - { - /* this section has relocs made up by us, they are not in the - file, so take them out of their chain and place them into - the data area provided */ - arelent_chain *chain = section->constructor_chain; - for (count = 0; count < section->reloc_count; count++) - { - *relptr++ = &chain->relent; - chain = chain->next; - } - - } - else - { - if (! coff_slurp_reloc_table (abfd, section, symbols)) - return -1; - - tblptr = section->relocation; - - for (; count++ < section->reloc_count;) - *relptr++ = tblptr++; - - - } - *relptr = 0; - return section->reloc_count; -} - -#ifdef GNU960 -file_ptr -coff_sym_filepos (abfd) - bfd *abfd; -{ - return obj_sym_filepos (abfd); -} -#endif - -#ifndef coff_reloc16_estimate -#define coff_reloc16_estimate dummy_reloc16_estimate - -static int -dummy_reloc16_estimate (abfd, input_section, reloc, shrink, link_info) - bfd *abfd; - asection *input_section; - arelent *reloc; - unsigned int shrink; - struct bfd_link_info *link_info; -{ - abort (); -} - -#endif - -#ifndef coff_reloc16_extra_cases -#define coff_reloc16_extra_cases dummy_reloc16_extra_cases -/* This works even if abort is not declared in any header file. */ -static void -dummy_reloc16_extra_cases (abfd, link_info, link_order, reloc, data, src_ptr, - dst_ptr) - bfd *abfd; - struct bfd_link_info *link_info; - struct bfd_link_order *link_order; - arelent *reloc; - bfd_byte *data; - unsigned int *src_ptr; - unsigned int *dst_ptr; -{ - abort (); -} -#endif - -/* If coff_relocate_section is defined, we can use the optimized COFF - backend linker. Otherwise we must continue to use the old linker. */ -#ifdef coff_relocate_section -#ifndef coff_bfd_link_hash_table_create -#define coff_bfd_link_hash_table_create _bfd_coff_link_hash_table_create -#endif -#ifndef coff_bfd_link_add_symbols -#define coff_bfd_link_add_symbols _bfd_coff_link_add_symbols -#endif -#ifndef coff_bfd_final_link -#define coff_bfd_final_link _bfd_coff_final_link -#endif -#else /* ! defined (coff_relocate_section) */ -#define coff_relocate_section NULL -#define coff_bfd_link_hash_table_create _bfd_generic_link_hash_table_create -#ifndef coff_bfd_link_add_symbols -#define coff_bfd_link_add_symbols _bfd_generic_link_add_symbols -#endif -#define coff_bfd_final_link _bfd_generic_final_link -#endif /* ! defined (coff_relocate_section) */ -#define coff_bfd_link_split_section _bfd_generic_link_split_section - -#ifndef coff_start_final_link -#define coff_start_final_link NULL -#endif - -#ifndef coff_adjust_symndx -#define coff_adjust_symndx NULL -#endif - -#ifndef coff_link_add_one_symbol -#define coff_link_add_one_symbol _bfd_generic_link_add_one_symbol -#endif - -static CONST bfd_coff_backend_data bfd_coff_std_swap_table = -{ - coff_swap_aux_in, coff_swap_sym_in, coff_swap_lineno_in, - coff_swap_aux_out, coff_swap_sym_out, - coff_swap_lineno_out, coff_swap_reloc_out, - coff_swap_filehdr_out, coff_swap_aouthdr_out, - coff_swap_scnhdr_out, - FILHSZ, AOUTSZ, SCNHSZ, SYMESZ, AUXESZ, RELSZ, LINESZ, -#ifdef COFF_LONG_FILENAMES - true, -#else - false, -#endif - coff_swap_filehdr_in, coff_swap_aouthdr_in, coff_swap_scnhdr_in, - coff_swap_reloc_in, coff_bad_format_hook, coff_set_arch_mach_hook, - coff_mkobject_hook, styp_to_sec_flags, coff_set_alignment_hook, - coff_slurp_symbol_table, symname_in_debug_hook, coff_pointerize_aux_hook, - coff_print_aux, coff_reloc16_extra_cases, coff_reloc16_estimate, - coff_sym_is_global, coff_compute_section_file_positions, - coff_start_final_link, coff_relocate_section, coff_rtype_to_howto, - coff_adjust_symndx, coff_link_add_one_symbol -}; - -#define coff_close_and_cleanup _bfd_generic_close_and_cleanup -#define coff_bfd_free_cached_info _bfd_generic_bfd_free_cached_info -#define coff_get_section_contents _bfd_generic_get_section_contents - -#ifndef coff_bfd_copy_private_symbol_data -#define coff_bfd_copy_private_symbol_data _bfd_generic_bfd_copy_private_symbol_data -#endif - -#ifndef coff_bfd_copy_private_section_data -#define coff_bfd_copy_private_section_data _bfd_generic_bfd_copy_private_section_data -#endif - -#ifndef coff_bfd_copy_private_bfd_data -#define coff_bfd_copy_private_bfd_data _bfd_generic_bfd_copy_private_bfd_data -#endif - -#define coff_bfd_merge_private_bfd_data _bfd_generic_bfd_merge_private_bfd_data -#define coff_bfd_set_private_flags _bfd_generic_bfd_set_private_flags - -#ifndef coff_bfd_print_private_bfd_data -#define coff_bfd_print_private_bfd_data _bfd_generic_bfd_print_private_bfd_data -#endif - -#ifndef coff_bfd_is_local_label -#define coff_bfd_is_local_label bfd_generic_is_local_label -#endif -#ifndef coff_read_minisymbols -#define coff_read_minisymbols _bfd_generic_read_minisymbols -#endif -#ifndef coff_minisymbol_to_symbol -#define coff_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol -#endif - -/* The reloc lookup routine must be supplied by each individual COFF - backend. */ -#ifndef coff_bfd_reloc_type_lookup -#define coff_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup -#endif - -#ifndef coff_bfd_get_relocated_section_contents -#define coff_bfd_get_relocated_section_contents \ - bfd_generic_get_relocated_section_contents -#endif -#ifndef coff_bfd_relax_section -#define coff_bfd_relax_section bfd_generic_relax_section -#endif diff --git a/contrib/gdb/bfd/coffgen.c b/contrib/gdb/bfd/coffgen.c deleted file mode 100644 index 285fe61..0000000 --- a/contrib/gdb/bfd/coffgen.c +++ /dev/null @@ -1,2121 +0,0 @@ -/* Support for the generic parts of COFF, for BFD. - Copyright 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. - Written by Cygnus Support. - -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. */ - -/* Most of this hacked by Steve Chamberlain, sac@cygnus.com. - Split out of coffcode.h by Ian Taylor, ian@cygnus.com. */ - -/* This file contains COFF code that is not dependent on any - particular COFF target. There is only one version of this file in - libbfd.a, so no target specific code may be put in here. Or, to - put it another way, - - ********** DO NOT PUT TARGET SPECIFIC CODE IN THIS FILE ********** - - If you need to add some target specific behaviour, add a new hook - function to bfd_coff_backend_data. - - Some of these functions are also called by the ECOFF routines. - Those functions may not use any COFF specific information, such as - coff_data (abfd). */ - -#include "bfd.h" -#include "sysdep.h" -#include "libbfd.h" -#include "coff/internal.h" -#include "libcoff.h" - -static void coff_fix_symbol_name - PARAMS ((bfd *, asymbol *, combined_entry_type *, bfd_size_type *, - asection **, bfd_size_type *)); -static boolean coff_write_symbol - PARAMS ((bfd *, asymbol *, combined_entry_type *, unsigned int *, - bfd_size_type *, asection **, bfd_size_type *)); -static boolean coff_write_alien_symbol - PARAMS ((bfd *, asymbol *, unsigned int *, bfd_size_type *, - asection **, bfd_size_type *)); -static boolean coff_write_native_symbol - PARAMS ((bfd *, coff_symbol_type *, unsigned int *, bfd_size_type *, - asection **, bfd_size_type *)); -static void coff_pointerize_aux - PARAMS ((bfd *, combined_entry_type *, combined_entry_type *, - unsigned int, combined_entry_type *)); - -#define STRING_SIZE_SIZE (4) - -/* Take a section header read from a coff file (in HOST byte order), - and make a BFD "section" out of it. This is used by ECOFF. */ -static boolean -make_a_section_from_file (abfd, hdr, target_index) - bfd *abfd; - struct internal_scnhdr *hdr; - unsigned int target_index; -{ - asection *return_section; - char *name; - - /* Assorted wastage to null-terminate the name, thanks AT&T! */ - name = bfd_alloc (abfd, sizeof (hdr->s_name) + 1); - if (name == NULL) - return false; - strncpy (name, (char *) &hdr->s_name[0], sizeof (hdr->s_name)); - name[sizeof (hdr->s_name)] = 0; - - return_section = bfd_make_section_anyway (abfd, name); - if (return_section == NULL) - return false; - - return_section->vma = hdr->s_vaddr; - return_section->lma = hdr->s_paddr; - return_section->_raw_size = hdr->s_size; - return_section->filepos = hdr->s_scnptr; - return_section->rel_filepos = hdr->s_relptr; - return_section->reloc_count = hdr->s_nreloc; - - bfd_coff_set_alignment_hook (abfd, return_section, hdr); - - return_section->line_filepos = hdr->s_lnnoptr; - - return_section->lineno_count = hdr->s_nlnno; - return_section->userdata = NULL; - return_section->next = (asection *) NULL; - return_section->flags = bfd_coff_styp_to_sec_flags_hook (abfd, hdr, name); - - return_section->target_index = target_index; - - /* At least on i386-coff, the line number count for a shared library - section must be ignored. */ - if ((return_section->flags & SEC_COFF_SHARED_LIBRARY) != 0) - return_section->lineno_count = 0; - - if (hdr->s_nreloc != 0) - return_section->flags |= SEC_RELOC; - /* FIXME: should this check 'hdr->s_size > 0' */ - if (hdr->s_scnptr != 0) - return_section->flags |= SEC_HAS_CONTENTS; - return true; -} - -/* Read in a COFF object and make it into a BFD. This is used by - ECOFF as well. */ - -static const bfd_target * -coff_real_object_p (abfd, nscns, internal_f, internal_a) - bfd *abfd; - unsigned nscns; - struct internal_filehdr *internal_f; - struct internal_aouthdr *internal_a; -{ - flagword oflags = abfd->flags; - bfd_vma ostart = bfd_get_start_address (abfd); - PTR tdata; - size_t readsize; /* length of file_info */ - unsigned int scnhsz; - char *external_sections; - - if (!(internal_f->f_flags & F_RELFLG)) - abfd->flags |= HAS_RELOC; - if ((internal_f->f_flags & F_EXEC)) - abfd->flags |= EXEC_P; - if (!(internal_f->f_flags & F_LNNO)) - abfd->flags |= HAS_LINENO; - if (!(internal_f->f_flags & F_LSYMS)) - abfd->flags |= HAS_LOCALS; - - /* FIXME: How can we set D_PAGED correctly? */ - if ((internal_f->f_flags & F_EXEC) != 0) - abfd->flags |= D_PAGED; - - bfd_get_symcount (abfd) = internal_f->f_nsyms; - if (internal_f->f_nsyms) - abfd->flags |= HAS_SYMS; - - if (internal_a != (struct internal_aouthdr *) NULL) - bfd_get_start_address (abfd) = internal_a->entry; - else - bfd_get_start_address (abfd) = 0; - - /* Set up the tdata area. ECOFF uses its own routine, and overrides - abfd->flags. */ - tdata = bfd_coff_mkobject_hook (abfd, (PTR) internal_f, (PTR) internal_a); - if (tdata == NULL) - return 0; - - scnhsz = bfd_coff_scnhsz (abfd); - readsize = nscns * scnhsz; - external_sections = (char *) bfd_alloc (abfd, readsize); - if (!external_sections) - goto fail; - - if (bfd_read ((PTR) external_sections, 1, readsize, abfd) != readsize) - goto fail; - - /* Now copy data as required; construct all asections etc */ - if (nscns != 0) - { - unsigned int i; - for (i = 0; i < nscns; i++) - { - struct internal_scnhdr tmp; - bfd_coff_swap_scnhdr_in (abfd, - (PTR) (external_sections + i * scnhsz), - (PTR) & tmp); - make_a_section_from_file (abfd, &tmp, i + 1); - } - } - - /* make_abs_section (abfd); */ - - if (bfd_coff_set_arch_mach_hook (abfd, (PTR) internal_f) == false) - goto fail; - - return abfd->xvec; - - fail: - bfd_release (abfd, tdata); - abfd->flags = oflags; - bfd_get_start_address (abfd) = ostart; - return (const bfd_target *) NULL; -} - -/* Turn a COFF file into a BFD, but fail with bfd_error_wrong_format if it is - not a COFF file. This is also used by ECOFF. */ - -const bfd_target * -coff_object_p (abfd) - bfd *abfd; -{ - unsigned int filhsz; - unsigned int aoutsz; - int nscns; - PTR filehdr; - struct internal_filehdr internal_f; - struct internal_aouthdr internal_a; - - /* figure out how much to read */ - filhsz = bfd_coff_filhsz (abfd); - aoutsz = bfd_coff_aoutsz (abfd); - - filehdr = bfd_alloc (abfd, filhsz); - if (filehdr == NULL) - return 0; - if (bfd_read (filehdr, 1, filhsz, abfd) != filhsz) - { - if (bfd_get_error () != bfd_error_system_call) - bfd_set_error (bfd_error_wrong_format); - return 0; - } - bfd_coff_swap_filehdr_in (abfd, filehdr, &internal_f); - bfd_release (abfd, filehdr); - - if (bfd_coff_bad_format_hook (abfd, &internal_f) == false) - { - bfd_set_error (bfd_error_wrong_format); - return 0; - } - nscns = internal_f.f_nscns; - - if (internal_f.f_opthdr) - { - PTR opthdr; - - opthdr = bfd_alloc (abfd, aoutsz); - if (opthdr == NULL) - return 0;; - if (bfd_read (opthdr, 1, aoutsz, abfd) != aoutsz) - { - return 0; - } - bfd_coff_swap_aouthdr_in (abfd, opthdr, (PTR) & internal_a); - } - - /* Seek past the opt hdr stuff */ - if (bfd_seek (abfd, (file_ptr) (internal_f.f_opthdr + filhsz), SEEK_SET) - != 0) - return NULL; - - return coff_real_object_p (abfd, nscns, &internal_f, - (internal_f.f_opthdr != 0 - ? &internal_a - : (struct internal_aouthdr *) NULL)); -} - -/* Get the BFD section from a COFF symbol section number. */ - -asection * -coff_section_from_bfd_index (abfd, index) - bfd *abfd; - int index; -{ - struct sec *answer = abfd->sections; - - if (index == N_ABS) - return bfd_abs_section_ptr; - if (index == N_UNDEF) - return bfd_und_section_ptr; - if (index == N_DEBUG) - return bfd_abs_section_ptr; - - while (answer) - { - if (answer->target_index == index) - return answer; - answer = answer->next; - } - - /* We should not reach this point, but the SCO 3.2v4 /lib/libc_s.a - has a bad symbol table in biglitpow.o. */ - return bfd_und_section_ptr; -} - -/* Get the upper bound of a COFF symbol table. */ - -long -coff_get_symtab_upper_bound (abfd) - bfd *abfd; -{ - if (!bfd_coff_slurp_symbol_table (abfd)) - return -1; - - return (bfd_get_symcount (abfd) + 1) * (sizeof (coff_symbol_type *)); -} - - -/* Canonicalize a COFF symbol table. */ - -long -coff_get_symtab (abfd, alocation) - bfd *abfd; - asymbol **alocation; -{ - unsigned int counter; - coff_symbol_type *symbase; - coff_symbol_type **location = (coff_symbol_type **) alocation; - - if (!bfd_coff_slurp_symbol_table (abfd)) - return -1; - - symbase = obj_symbols (abfd); - counter = bfd_get_symcount (abfd); - while (counter-- > 0) - *location++ = symbase++; - - *location = NULL; - - return bfd_get_symcount (abfd); -} - -/* Get the name of a symbol. The caller must pass in a buffer of size - >= SYMNMLEN + 1. */ - -const char * -_bfd_coff_internal_syment_name (abfd, sym, buf) - bfd *abfd; - const struct internal_syment *sym; - char *buf; -{ - /* FIXME: It's not clear this will work correctly if sizeof - (_n_zeroes) != 4. */ - if (sym->_n._n_n._n_zeroes != 0 - || sym->_n._n_n._n_offset == 0) - { - memcpy (buf, sym->_n._n_name, SYMNMLEN); - buf[SYMNMLEN] = '\0'; - return buf; - } - else - { - const char *strings; - - BFD_ASSERT (sym->_n._n_n._n_offset >= STRING_SIZE_SIZE); - strings = obj_coff_strings (abfd); - if (strings == NULL) - { - strings = _bfd_coff_read_string_table (abfd); - if (strings == NULL) - return NULL; - } - return strings + sym->_n._n_n._n_offset; - } -} - -/* Read in and swap the relocs. This returns a buffer holding the - relocs for section SEC in file ABFD. If CACHE is true and - INTERNAL_RELOCS is NULL, the relocs read in will be saved in case - the function is called again. If EXTERNAL_RELOCS is not NULL, it - is a buffer large enough to hold the unswapped relocs. If - INTERNAL_RELOCS is not NULL, it is a buffer large enough to hold - the swapped relocs. If REQUIRE_INTERNAL is true, then the return - value must be INTERNAL_RELOCS. The function returns NULL on error. */ - -struct internal_reloc * -_bfd_coff_read_internal_relocs (abfd, sec, cache, external_relocs, - require_internal, internal_relocs) - bfd *abfd; - asection *sec; - boolean cache; - bfd_byte *external_relocs; - boolean require_internal; - struct internal_reloc *internal_relocs; -{ - bfd_size_type relsz; - bfd_byte *free_external = NULL; - struct internal_reloc *free_internal = NULL; - bfd_byte *erel; - bfd_byte *erel_end; - struct internal_reloc *irel; - - if (coff_section_data (abfd, sec) != NULL - && coff_section_data (abfd, sec)->relocs != NULL) - { - if (! require_internal) - return coff_section_data (abfd, sec)->relocs; - memcpy (internal_relocs, coff_section_data (abfd, sec)->relocs, - sec->reloc_count * sizeof (struct internal_reloc)); - return internal_relocs; - } - - relsz = bfd_coff_relsz (abfd); - - if (external_relocs == NULL) - { - free_external = (bfd_byte *) bfd_malloc (sec->reloc_count * relsz); - if (free_external == NULL && sec->reloc_count > 0) - goto error_return; - external_relocs = free_external; - } - - if (bfd_seek (abfd, sec->rel_filepos, SEEK_SET) != 0 - || (bfd_read (external_relocs, relsz, sec->reloc_count, abfd) - != relsz * sec->reloc_count)) - goto error_return; - - if (internal_relocs == NULL) - { - free_internal = ((struct internal_reloc *) - bfd_malloc (sec->reloc_count - * sizeof (struct internal_reloc))); - if (free_internal == NULL && sec->reloc_count > 0) - goto error_return; - internal_relocs = free_internal; - } - - /* Swap in the relocs. */ - erel = external_relocs; - erel_end = erel + relsz * sec->reloc_count; - irel = internal_relocs; - for (; erel < erel_end; erel += relsz, irel++) - bfd_coff_swap_reloc_in (abfd, (PTR) erel, (PTR) irel); - - if (free_external != NULL) - { - free (free_external); - free_external = NULL; - } - - if (cache && free_internal != NULL) - { - if (coff_section_data (abfd, sec) == NULL) - { - sec->used_by_bfd = - (PTR) bfd_zalloc (abfd, - sizeof (struct coff_section_tdata)); - if (sec->used_by_bfd == NULL) - goto error_return; - coff_section_data (abfd, sec)->contents = NULL; - } - coff_section_data (abfd, sec)->relocs = free_internal; - } - - return internal_relocs; - - error_return: - if (free_external != NULL) - free (free_external); - if (free_internal != NULL) - free (free_internal); - return NULL; -} - -/* Set lineno_count for the output sections of a COFF file. */ - -int -coff_count_linenumbers (abfd) - bfd *abfd; -{ - unsigned int limit = bfd_get_symcount (abfd); - unsigned int i; - int total = 0; - asymbol **p; - asection *s; - - if (limit == 0) - { - /* This may be from the backend linker, in which case the - lineno_count in the sections is correct. */ - for (s = abfd->sections; s != NULL; s = s->next) - total += s->lineno_count; - return total; - } - - for (s = abfd->sections; s != NULL; s = s->next) - BFD_ASSERT (s->lineno_count == 0); - - for (p = abfd->outsymbols, i = 0; i < limit; i++, p++) - { - asymbol *q_maybe = *p; - - if (bfd_asymbol_flavour (q_maybe) == bfd_target_coff_flavour) - { - coff_symbol_type *q = coffsymbol (q_maybe); - - /* The AIX 4.1 compiler can sometimes generate line numbers - attached to debugging symbols. We try to simply ignore - those here. */ - if (q->lineno != NULL - && q->symbol.section->owner != NULL) - { - /* This symbol has line numbers. Increment the owning - section's linenumber count. */ - alent *l = q->lineno; - - ++q->symbol.section->output_section->lineno_count; - ++total; - ++l; - while (l->line_number != 0) - { - ++total; - ++q->symbol.section->output_section->lineno_count; - ++l; - } - } - } - } - - return total; -} - -/* Takes a bfd and a symbol, returns a pointer to the coff specific - area of the symbol if there is one. */ - -/*ARGSUSED*/ -coff_symbol_type * -coff_symbol_from (ignore_abfd, symbol) - bfd *ignore_abfd; - asymbol *symbol; -{ - if (bfd_asymbol_flavour (symbol) != bfd_target_coff_flavour) - return (coff_symbol_type *) NULL; - - if (bfd_asymbol_bfd (symbol)->tdata.coff_obj_data == (coff_data_type *) NULL) - return (coff_symbol_type *) NULL; - - return (coff_symbol_type *) symbol; -} - -static void -fixup_symbol_value (coff_symbol_ptr, syment) - coff_symbol_type *coff_symbol_ptr; - struct internal_syment *syment; -{ - - /* Normalize the symbol flags */ - if (bfd_is_com_section (coff_symbol_ptr->symbol.section)) - { - /* a common symbol is undefined with a value */ - syment->n_scnum = N_UNDEF; - syment->n_value = coff_symbol_ptr->symbol.value; - } - else if (coff_symbol_ptr->symbol.flags & BSF_DEBUGGING) - { - syment->n_value = coff_symbol_ptr->symbol.value; - } - else if (bfd_is_und_section (coff_symbol_ptr->symbol.section)) - { - syment->n_scnum = N_UNDEF; - syment->n_value = 0; - } - else - { - if (coff_symbol_ptr->symbol.section) - { - syment->n_scnum = - coff_symbol_ptr->symbol.section->output_section->target_index; - - syment->n_value = - coff_symbol_ptr->symbol.value + - coff_symbol_ptr->symbol.section->output_offset + - coff_symbol_ptr->symbol.section->output_section->vma; - } - else - { - BFD_ASSERT (0); - /* This can happen, but I don't know why yet (steve@cygnus.com) */ - syment->n_scnum = N_ABS; - syment->n_value = coff_symbol_ptr->symbol.value; - } - } -} - -/* Run through all the symbols in the symbol table and work out what - their indexes into the symbol table will be when output. - - Coff requires that each C_FILE symbol points to the next one in the - chain, and that the last one points to the first external symbol. We - do that here too. */ - -boolean -coff_renumber_symbols (bfd_ptr, first_undef) - bfd *bfd_ptr; - int *first_undef; -{ - unsigned int symbol_count = bfd_get_symcount (bfd_ptr); - asymbol **symbol_ptr_ptr = bfd_ptr->outsymbols; - unsigned int native_index = 0; - struct internal_syment *last_file = (struct internal_syment *) NULL; - unsigned int symbol_index; - - /* COFF demands that undefined symbols come after all other symbols. - Since we don't need to impose this extra knowledge on all our - client programs, deal with that here. Sort the symbol table; - just move the undefined symbols to the end, leaving the rest - alone. The O'Reilly book says that defined global symbols come - at the end before the undefined symbols, so we do that here as - well. */ - /* @@ Do we have some condition we could test for, so we don't always - have to do this? I don't think relocatability is quite right, but - I'm not certain. [raeburn:19920508.1711EST] */ - { - asymbol **newsyms; - unsigned int i; - - newsyms = (asymbol **) bfd_alloc_by_size_t (bfd_ptr, - sizeof (asymbol *) - * (symbol_count + 1)); - if (!newsyms) - return false; - bfd_ptr->outsymbols = newsyms; - for (i = 0; i < symbol_count; i++) - if ((symbol_ptr_ptr[i]->flags & BSF_NOT_AT_END) != 0 - || (!bfd_is_und_section (symbol_ptr_ptr[i]->section) - && !bfd_is_com_section (symbol_ptr_ptr[i]->section) - && ((symbol_ptr_ptr[i]->flags & (BSF_GLOBAL | BSF_FUNCTION)) - != BSF_GLOBAL))) - *newsyms++ = symbol_ptr_ptr[i]; - - for (i = 0; i < symbol_count; i++) - if (!bfd_is_und_section (symbol_ptr_ptr[i]->section) - && (bfd_is_com_section (symbol_ptr_ptr[i]->section) - || ((symbol_ptr_ptr[i]->flags & (BSF_GLOBAL - | BSF_NOT_AT_END - | BSF_FUNCTION)) - == BSF_GLOBAL))) - *newsyms++ = symbol_ptr_ptr[i]; - - *first_undef = newsyms - bfd_ptr->outsymbols; - - for (i = 0; i < symbol_count; i++) - if ((symbol_ptr_ptr[i]->flags & BSF_NOT_AT_END) == 0 - && bfd_is_und_section (symbol_ptr_ptr[i]->section)) - *newsyms++ = symbol_ptr_ptr[i]; - *newsyms = (asymbol *) NULL; - symbol_ptr_ptr = bfd_ptr->outsymbols; - } - - for (symbol_index = 0; symbol_index < symbol_count; symbol_index++) - { - coff_symbol_type *coff_symbol_ptr = coff_symbol_from (bfd_ptr, symbol_ptr_ptr[symbol_index]); - symbol_ptr_ptr[symbol_index]->udata.i = symbol_index; - if (coff_symbol_ptr && coff_symbol_ptr->native) - { - combined_entry_type *s = coff_symbol_ptr->native; - int i; - - if (s->u.syment.n_sclass == C_FILE) - { - if (last_file != (struct internal_syment *) NULL) - last_file->n_value = native_index; - last_file = &(s->u.syment); - } - else - { - - /* Modify the symbol values according to their section and - type */ - - fixup_symbol_value (coff_symbol_ptr, &(s->u.syment)); - } - for (i = 0; i < s->u.syment.n_numaux + 1; i++) - s[i].offset = native_index++; - } - else - { - native_index++; - } - } - obj_conv_table_size (bfd_ptr) = native_index; - - return true; -} - -/* Run thorough the symbol table again, and fix it so that all - pointers to entries are changed to the entries' index in the output - symbol table. */ - -void -coff_mangle_symbols (bfd_ptr) - bfd *bfd_ptr; -{ - unsigned int symbol_count = bfd_get_symcount (bfd_ptr); - asymbol **symbol_ptr_ptr = bfd_ptr->outsymbols; - unsigned int symbol_index; - - for (symbol_index = 0; symbol_index < symbol_count; symbol_index++) - { - coff_symbol_type *coff_symbol_ptr = - coff_symbol_from (bfd_ptr, symbol_ptr_ptr[symbol_index]); - - if (coff_symbol_ptr && coff_symbol_ptr->native) - { - int i; - combined_entry_type *s = coff_symbol_ptr->native; - - if (s->fix_value) - { - /* FIXME: We should use a union here. */ - s->u.syment.n_value = - ((combined_entry_type *) s->u.syment.n_value)->offset; - s->fix_value = 0; - } - if (s->fix_line) - { - /* The value is the offset into the line number entries - for the symbol's section. On output, the symbol's - section should be N_DEBUG. */ - s->u.syment.n_value = - (coff_symbol_ptr->symbol.section->output_section->line_filepos - + s->u.syment.n_value * bfd_coff_linesz (bfd_ptr)); - coff_symbol_ptr->symbol.section = - coff_section_from_bfd_index (bfd_ptr, N_DEBUG); - BFD_ASSERT (coff_symbol_ptr->symbol.flags & BSF_DEBUGGING); - } - for (i = 0; i < s->u.syment.n_numaux; i++) - { - combined_entry_type *a = s + i + 1; - if (a->fix_tag) - { - a->u.auxent.x_sym.x_tagndx.l = - a->u.auxent.x_sym.x_tagndx.p->offset; - a->fix_tag = 0; - } - if (a->fix_end) - { - a->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.l = - a->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.p->offset; - a->fix_end = 0; - } - if (a->fix_scnlen) - { - a->u.auxent.x_csect.x_scnlen.l = - a->u.auxent.x_csect.x_scnlen.p->offset; - a->fix_scnlen = 0; - } - } - } - } -} - -static void -coff_fix_symbol_name (abfd, symbol, native, string_size_p, - debug_string_section_p, debug_string_size_p) - bfd *abfd; - asymbol *symbol; - combined_entry_type *native; - bfd_size_type *string_size_p; - asection **debug_string_section_p; - bfd_size_type *debug_string_size_p; -{ - unsigned int name_length; - union internal_auxent *auxent; - char *name = (char *) (symbol->name); - - if (name == (char *) NULL) - { - /* coff symbols always have names, so we'll make one up */ - symbol->name = "strange"; - name = (char *) symbol->name; - } - name_length = strlen (name); - - if (native->u.syment.n_sclass == C_FILE - && native->u.syment.n_numaux > 0) - { - strncpy (native->u.syment._n._n_name, ".file", SYMNMLEN); - auxent = &(native + 1)->u.auxent; - - if (bfd_coff_long_filenames (abfd)) - { - if (name_length <= FILNMLEN) - { - strncpy (auxent->x_file.x_fname, name, FILNMLEN); - } - else - { - auxent->x_file.x_n.x_offset = *string_size_p + STRING_SIZE_SIZE; - auxent->x_file.x_n.x_zeroes = 0; - *string_size_p += name_length + 1; - } - } - else - { - strncpy (auxent->x_file.x_fname, name, FILNMLEN); - if (name_length > FILNMLEN) - { - name[FILNMLEN] = '\0'; - } - } - } - else - { - if (name_length <= SYMNMLEN) - { - /* This name will fit into the symbol neatly */ - strncpy (native->u.syment._n._n_name, symbol->name, SYMNMLEN); - } - else if (!bfd_coff_symname_in_debug (abfd, &native->u.syment)) - { - native->u.syment._n._n_n._n_offset = (*string_size_p - + STRING_SIZE_SIZE); - native->u.syment._n._n_n._n_zeroes = 0; - *string_size_p += name_length + 1; - } - else - { - long filepos; - bfd_byte buf[2]; - - /* This name should be written into the .debug section. For - some reason each name is preceded by a two byte length - and also followed by a null byte. FIXME: We assume that - the .debug section has already been created, and that it - is large enough. */ - if (*debug_string_section_p == (asection *) NULL) - *debug_string_section_p = bfd_get_section_by_name (abfd, ".debug"); - filepos = bfd_tell (abfd); - bfd_put_16 (abfd, name_length + 1, buf); - if (!bfd_set_section_contents (abfd, - *debug_string_section_p, - (PTR) buf, - (file_ptr) *debug_string_size_p, - (bfd_size_type) 2) - || !bfd_set_section_contents (abfd, - *debug_string_section_p, - (PTR) symbol->name, - ((file_ptr) *debug_string_size_p - + 2), - (bfd_size_type) name_length + 1)) - abort (); - if (bfd_seek (abfd, filepos, SEEK_SET) != 0) - abort (); - native->u.syment._n._n_n._n_offset = *debug_string_size_p + 2; - native->u.syment._n._n_n._n_zeroes = 0; - *debug_string_size_p += name_length + 3; - } - } -} - -/* We need to keep track of the symbol index so that when we write out - the relocs we can get the index for a symbol. This method is a - hack. FIXME. */ - -#define set_index(symbol, idx) ((symbol)->udata.i = (idx)) - -/* Write a symbol out to a COFF file. */ - -static boolean -coff_write_symbol (abfd, symbol, native, written, string_size_p, - debug_string_section_p, debug_string_size_p) - bfd *abfd; - asymbol *symbol; - combined_entry_type *native; - unsigned int *written; - bfd_size_type *string_size_p; - asection **debug_string_section_p; - bfd_size_type *debug_string_size_p; -{ - unsigned int numaux = native->u.syment.n_numaux; - int type = native->u.syment.n_type; - int class = native->u.syment.n_sclass; - PTR buf; - bfd_size_type symesz; - - if (native->u.syment.n_sclass == C_FILE) - symbol->flags |= BSF_DEBUGGING; - - if (symbol->flags & BSF_DEBUGGING - && bfd_is_abs_section (symbol->section)) - { - native->u.syment.n_scnum = N_DEBUG; - } - else if (bfd_is_abs_section (symbol->section)) - { - native->u.syment.n_scnum = N_ABS; - } - else if (bfd_is_und_section (symbol->section)) - { - native->u.syment.n_scnum = N_UNDEF; - } - else - { - native->u.syment.n_scnum = - symbol->section->output_section->target_index; - } - - coff_fix_symbol_name (abfd, symbol, native, string_size_p, - debug_string_section_p, debug_string_size_p); - - symesz = bfd_coff_symesz (abfd); - buf = bfd_alloc (abfd, symesz); - if (!buf) - return false; - bfd_coff_swap_sym_out (abfd, &native->u.syment, buf); - if (bfd_write (buf, 1, symesz, abfd) != symesz) - return false; - bfd_release (abfd, buf); - - if (native->u.syment.n_numaux > 0) - { - bfd_size_type auxesz; - unsigned int j; - - auxesz = bfd_coff_auxesz (abfd); - buf = bfd_alloc (abfd, auxesz); - if (!buf) - return false; - for (j = 0; j < native->u.syment.n_numaux; j++) - { - bfd_coff_swap_aux_out (abfd, - &((native + j + 1)->u.auxent), - type, - class, - j, - native->u.syment.n_numaux, - buf); - if (bfd_write (buf, 1, auxesz, abfd) != auxesz) - return false; - } - bfd_release (abfd, buf); - } - - /* Store the index for use when we write out the relocs. */ - set_index (symbol, *written); - - *written += numaux + 1; - return true; -} - -/* Write out a symbol to a COFF file that does not come from a COFF - file originally. This symbol may have been created by the linker, - or we may be linking a non COFF file to a COFF file. */ - -static boolean -coff_write_alien_symbol (abfd, symbol, written, string_size_p, - debug_string_section_p, debug_string_size_p) - bfd *abfd; - asymbol *symbol; - unsigned int *written; - bfd_size_type *string_size_p; - asection **debug_string_section_p; - bfd_size_type *debug_string_size_p; -{ - combined_entry_type *native; - combined_entry_type dummy; - - native = &dummy; - native->u.syment.n_type = T_NULL; - native->u.syment.n_flags = 0; - if (bfd_is_und_section (symbol->section)) - { - native->u.syment.n_scnum = N_UNDEF; - native->u.syment.n_value = symbol->value; - } - else if (bfd_is_com_section (symbol->section)) - { - native->u.syment.n_scnum = N_UNDEF; - native->u.syment.n_value = symbol->value; - } - else if (symbol->flags & BSF_DEBUGGING) - { - /* There isn't much point to writing out a debugging symbol - unless we are prepared to convert it into COFF debugging - format. So, we just ignore them. We must clobber the symbol - name to keep it from being put in the string table. */ - symbol->name = ""; - return true; - } - else - { - native->u.syment.n_scnum = - symbol->section->output_section->target_index; - native->u.syment.n_value = (symbol->value - + symbol->section->output_section->vma - + symbol->section->output_offset); - - /* Copy the any flags from the the file header into the symbol. - FIXME: Why? */ - { - coff_symbol_type *c = coff_symbol_from (abfd, symbol); - if (c != (coff_symbol_type *) NULL) - native->u.syment.n_flags = bfd_asymbol_bfd (&c->symbol)->flags; - } - } - - native->u.syment.n_type = 0; - if (symbol->flags & BSF_LOCAL) - native->u.syment.n_sclass = C_STAT; - else - native->u.syment.n_sclass = C_EXT; - native->u.syment.n_numaux = 0; - - return coff_write_symbol (abfd, symbol, native, written, string_size_p, - debug_string_section_p, debug_string_size_p); -} - -/* Write a native symbol to a COFF file. */ - -static boolean -coff_write_native_symbol (abfd, symbol, written, string_size_p, - debug_string_section_p, debug_string_size_p) - bfd *abfd; - coff_symbol_type *symbol; - unsigned int *written; - bfd_size_type *string_size_p; - asection **debug_string_section_p; - bfd_size_type *debug_string_size_p; -{ - combined_entry_type *native = symbol->native; - alent *lineno = symbol->lineno; - - /* If this symbol has an associated line number, we must store the - symbol index in the line number field. We also tag the auxent to - point to the right place in the lineno table. */ - if (lineno && !symbol->done_lineno && symbol->symbol.section->owner != NULL) - { - unsigned int count = 0; - lineno[count].u.offset = *written; - if (native->u.syment.n_numaux) - { - union internal_auxent *a = &((native + 1)->u.auxent); - - a->x_sym.x_fcnary.x_fcn.x_lnnoptr = - symbol->symbol.section->output_section->moving_line_filepos; - } - - /* Count and relocate all other linenumbers. */ - count++; - while (lineno[count].line_number != 0) - { -#if 0 - /* 13 april 92. sac - I've been told this, but still need proof: - > The second bug is also in `bfd/coffcode.h'. This bug - > causes the linker to screw up the pc-relocations for - > all the line numbers in COFF code. This bug isn't only - > specific to A29K implementations, but affects all - > systems using COFF format binaries. Note that in COFF - > object files, the line number core offsets output by - > the assembler are relative to the start of each - > procedure, not to the start of the .text section. This - > patch relocates the line numbers relative to the - > `native->u.syment.n_value' instead of the section - > virtual address. - > modular!olson@cs.arizona.edu (Jon Olson) - */ - lineno[count].u.offset += native->u.syment.n_value; -#else - lineno[count].u.offset += - (symbol->symbol.section->output_section->vma - + symbol->symbol.section->output_offset); -#endif - count++; - } - symbol->done_lineno = true; - - symbol->symbol.section->output_section->moving_line_filepos += - count * bfd_coff_linesz (abfd); - } - - return coff_write_symbol (abfd, &(symbol->symbol), native, written, - string_size_p, debug_string_section_p, - debug_string_size_p); -} - -/* Write out the COFF symbols. */ - -boolean -coff_write_symbols (abfd) - bfd *abfd; -{ - bfd_size_type string_size; - asection *debug_string_section; - bfd_size_type debug_string_size; - unsigned int i; - unsigned int limit = bfd_get_symcount (abfd); - unsigned int written = 0; - asymbol **p; - - string_size = 0; - debug_string_section = NULL; - debug_string_size = 0; - - /* Seek to the right place */ - if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0) - return false; - - /* Output all the symbols we have */ - - written = 0; - for (p = abfd->outsymbols, i = 0; i < limit; i++, p++) - { - asymbol *symbol = *p; - coff_symbol_type *c_symbol = coff_symbol_from (abfd, symbol); - - if (c_symbol == (coff_symbol_type *) NULL - || c_symbol->native == (combined_entry_type *) NULL) - { - if (!coff_write_alien_symbol (abfd, symbol, &written, &string_size, - &debug_string_section, - &debug_string_size)) - return false; - } - else - { - if (!coff_write_native_symbol (abfd, c_symbol, &written, - &string_size, &debug_string_section, - &debug_string_size)) - return false; - } - } - - obj_raw_syment_count (abfd) = written; - - /* Now write out strings */ - - if (string_size != 0) - { - unsigned int size = string_size + STRING_SIZE_SIZE; - bfd_byte buffer[STRING_SIZE_SIZE]; - -#if STRING_SIZE_SIZE == 4 - bfd_h_put_32 (abfd, size, buffer); -#else - #error Change bfd_h_put_32 -#endif - if (bfd_write ((PTR) buffer, 1, sizeof (buffer), abfd) != sizeof (buffer)) - return false; - for (p = abfd->outsymbols, i = 0; - i < limit; - i++, p++) - { - asymbol *q = *p; - size_t name_length = strlen (q->name); - coff_symbol_type *c_symbol = coff_symbol_from (abfd, q); - size_t maxlen; - - /* Figure out whether the symbol name should go in the string - table. Symbol names that are short enough are stored - directly in the syment structure. File names permit a - different, longer, length in the syment structure. On - XCOFF, some symbol names are stored in the .debug section - rather than in the string table. */ - - if (c_symbol == NULL - || c_symbol->native == NULL) - { - /* This is not a COFF symbol, so it certainly is not a - file name, nor does it go in the .debug section. */ - maxlen = SYMNMLEN; - } - else if (bfd_coff_symname_in_debug (abfd, - &c_symbol->native->u.syment)) - { - /* This symbol name is in the XCOFF .debug section. - Don't write it into the string table. */ - maxlen = name_length; - } - else if (c_symbol->native->u.syment.n_sclass == C_FILE - && c_symbol->native->u.syment.n_numaux > 0) - maxlen = FILNMLEN; - else - maxlen = SYMNMLEN; - - if (name_length > maxlen) - { - if (bfd_write ((PTR) (q->name), 1, name_length + 1, abfd) - != name_length + 1) - return false; - } - } - } - else - { - /* We would normally not write anything here, but we'll write - out 4 so that any stupid coff reader which tries to read the - string table even when there isn't one won't croak. */ - unsigned int size = STRING_SIZE_SIZE; - bfd_byte buffer[STRING_SIZE_SIZE]; - -#if STRING_SIZE_SIZE == 4 - bfd_h_put_32 (abfd, size, buffer); -#else - #error Change bfd_h_put_32 -#endif - if (bfd_write ((PTR) buffer, 1, STRING_SIZE_SIZE, abfd) - != STRING_SIZE_SIZE) - return false; - } - - /* Make sure the .debug section was created to be the correct size. - We should create it ourselves on the fly, but we don't because - BFD won't let us write to any section until we know how large all - the sections are. We could still do it by making another pass - over the symbols. FIXME. */ - BFD_ASSERT (debug_string_size == 0 - || (debug_string_section != (asection *) NULL - && (BFD_ALIGN (debug_string_size, - 1 << debug_string_section->alignment_power) - == bfd_section_size (abfd, debug_string_section)))); - - return true; -} - -boolean -coff_write_linenumbers (abfd) - bfd *abfd; -{ - asection *s; - bfd_size_type linesz; - PTR buff; - - linesz = bfd_coff_linesz (abfd); - buff = bfd_alloc (abfd, linesz); - if (!buff) - return false; - for (s = abfd->sections; s != (asection *) NULL; s = s->next) - { - if (s->lineno_count) - { - asymbol **q = abfd->outsymbols; - if (bfd_seek (abfd, s->line_filepos, SEEK_SET) != 0) - return false; - /* Find all the linenumbers in this section */ - while (*q) - { - asymbol *p = *q; - if (p->section->output_section == s) - { - alent *l = - BFD_SEND (bfd_asymbol_bfd (p), _get_lineno, - (bfd_asymbol_bfd (p), p)); - if (l) - { - /* Found a linenumber entry, output */ - struct internal_lineno out; - memset ((PTR) & out, 0, sizeof (out)); - out.l_lnno = 0; - out.l_addr.l_symndx = l->u.offset; - bfd_coff_swap_lineno_out (abfd, &out, buff); - if (bfd_write (buff, 1, linesz, abfd) != linesz) - return false; - l++; - while (l->line_number) - { - out.l_lnno = l->line_number; - out.l_addr.l_symndx = l->u.offset; - bfd_coff_swap_lineno_out (abfd, &out, buff); - if (bfd_write (buff, 1, linesz, abfd) != linesz) - return false; - l++; - } - } - } - q++; - } - } - } - bfd_release (abfd, buff); - return true; -} - -/*ARGSUSED */ -alent * -coff_get_lineno (ignore_abfd, symbol) - bfd *ignore_abfd; - asymbol *symbol; -{ - return coffsymbol (symbol)->lineno; -} - -#if 0 - -/* This is only called from coff_add_missing_symbols, which has been - disabled. */ - -asymbol * -coff_section_symbol (abfd, name) - bfd *abfd; - char *name; -{ - asection *sec = bfd_make_section_old_way (abfd, name); - asymbol *sym; - combined_entry_type *csym; - - sym = sec->symbol; - csym = coff_symbol_from (abfd, sym)->native; - /* Make sure back-end COFF stuff is there. */ - if (csym == 0) - { - struct foo - { - coff_symbol_type sym; - /* @@FIXME This shouldn't use a fixed size!! */ - combined_entry_type e[10]; - }; - struct foo *f; - f = (struct foo *) bfd_alloc_by_size_t (abfd, 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; - csym[0].u.syment.n_numaux = 1; -/* SF_SET_STATICS (sym); @@ ??? */ - csym[1].u.auxent.x_scn.x_scnlen = sec->_raw_size; - csym[1].u.auxent.x_scn.x_nreloc = sec->reloc_count; - csym[1].u.auxent.x_scn.x_nlinno = sec->lineno_count; - - if (sec->output_section == NULL) - { - sec->output_section = sec; - sec->output_offset = 0; - } - - return sym; -} - -#endif /* 0 */ - -/* This function transforms the offsets into the symbol table into - pointers to syments. */ - -static void -coff_pointerize_aux (abfd, table_base, symbol, indaux, auxent) - bfd *abfd; - combined_entry_type *table_base; - combined_entry_type *symbol; - unsigned int indaux; - combined_entry_type *auxent; -{ - int type = symbol->u.syment.n_type; - int class = symbol->u.syment.n_sclass; - - if (coff_backend_info (abfd)->_bfd_coff_pointerize_aux_hook) - { - if ((*coff_backend_info (abfd)->_bfd_coff_pointerize_aux_hook) - (abfd, table_base, symbol, indaux, auxent)) - return; - } - - /* Don't bother if this is a file or a section */ - if (class == C_STAT && type == T_NULL) - return; - if (class == C_FILE) - return; - - /* Otherwise patch up */ -#define N_TMASK coff_data (abfd)->local_n_tmask -#define N_BTSHFT coff_data (abfd)->local_n_btshft - if ((ISFCN (type) || ISTAG (class) || class == C_BLOCK) - && auxent->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.l > 0) - { - auxent->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.p = - table_base + auxent->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.l; - auxent->fix_end = 1; - } - /* A negative tagndx is meaningless, but the SCO 3.2v4 cc can - generate one, so we must be careful to ignore it. */ - if (auxent->u.auxent.x_sym.x_tagndx.l > 0) - { - auxent->u.auxent.x_sym.x_tagndx.p = - table_base + auxent->u.auxent.x_sym.x_tagndx.l; - auxent->fix_tag = 1; - } -} - -/* Allocate space for the ".debug" section, and read it. - We did not read the debug section until now, because - we didn't want to go to the trouble until someone needed it. */ - -static char * -build_debug_section (abfd) - bfd *abfd; -{ - char *debug_section; - long position; - - asection *sect = bfd_get_section_by_name (abfd, ".debug"); - - if (!sect) - { - bfd_set_error (bfd_error_no_debug_section); - return NULL; - } - - debug_section = (PTR) bfd_alloc (abfd, - bfd_get_section_size_before_reloc (sect)); - if (debug_section == NULL) - return NULL; - - /* Seek to the beginning of the `.debug' section and read it. - Save the current position first; it is needed by our caller. - Then read debug section and reset the file pointer. */ - - position = bfd_tell (abfd); - if (bfd_seek (abfd, sect->filepos, SEEK_SET) != 0 - || (bfd_read (debug_section, - bfd_get_section_size_before_reloc (sect), 1, abfd) - != bfd_get_section_size_before_reloc (sect)) - || bfd_seek (abfd, position, SEEK_SET) != 0) - return NULL; - return debug_section; -} - - -/* Return a pointer to a malloc'd copy of 'name'. 'name' may not be - \0-terminated, but will not exceed 'maxlen' characters. The copy *will* - be \0-terminated. */ -static char * -copy_name (abfd, name, maxlen) - bfd *abfd; - char *name; - int maxlen; -{ - int len; - char *newname; - - for (len = 0; len < maxlen; ++len) - { - if (name[len] == '\0') - { - break; - } - } - - if ((newname = (PTR) bfd_alloc (abfd, len + 1)) == NULL) - return (NULL); - strncpy (newname, name, len); - newname[len] = '\0'; - return newname; -} - -/* Read in the external symbols. */ - -boolean -_bfd_coff_get_external_symbols (abfd) - bfd *abfd; -{ - bfd_size_type symesz; - size_t size; - PTR syms; - - if (obj_coff_external_syms (abfd) != NULL) - return true; - - symesz = bfd_coff_symesz (abfd); - - size = obj_raw_syment_count (abfd) * symesz; - - syms = (PTR) bfd_malloc (size); - if (syms == NULL && size != 0) - return false; - - if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0 - || bfd_read (syms, size, 1, abfd) != size) - { - if (syms != NULL) - free (syms); - return false; - } - - obj_coff_external_syms (abfd) = syms; - - return true; -} - -/* Read in the external strings. The strings are not loaded until - they are needed. This is because we have no simple way of - detecting a missing string table in an archive. */ - -const char * -_bfd_coff_read_string_table (abfd) - bfd *abfd; -{ - char extstrsize[STRING_SIZE_SIZE]; - size_t strsize; - char *strings; - - if (obj_coff_strings (abfd) != NULL) - return obj_coff_strings (abfd); - - if (bfd_seek (abfd, - (obj_sym_filepos (abfd) - + obj_raw_syment_count (abfd) * bfd_coff_symesz (abfd)), - SEEK_SET) != 0) - return NULL; - - if (bfd_read (extstrsize, sizeof extstrsize, 1, abfd) != sizeof extstrsize) - { - if (bfd_get_error () != bfd_error_file_truncated) - return NULL; - - /* There is no string table. */ - strsize = STRING_SIZE_SIZE; - } - else - { -#if STRING_SIZE_SIZE == 4 - strsize = bfd_h_get_32 (abfd, (bfd_byte *) extstrsize); -#else - #error Change bfd_h_get_32 -#endif - } - - if (strsize < STRING_SIZE_SIZE) - { - (*_bfd_error_handler) - ("%s: bad string table size %lu", bfd_get_filename (abfd), - (unsigned long) strsize); - bfd_set_error (bfd_error_bad_value); - return NULL; - } - - strings = (char *) bfd_malloc (strsize); - if (strings == NULL) - return NULL; - - if (bfd_read (strings + STRING_SIZE_SIZE, - strsize - STRING_SIZE_SIZE, 1, abfd) - != strsize - STRING_SIZE_SIZE) - { - free (strings); - return NULL; - } - - obj_coff_strings (abfd) = strings; - - return strings; -} - -/* Free up the external symbols and strings read from a COFF file. */ - -boolean -_bfd_coff_free_symbols (abfd) - bfd *abfd; -{ - if (obj_coff_external_syms (abfd) != NULL - && ! obj_coff_keep_syms (abfd)) - { - free (obj_coff_external_syms (abfd)); - obj_coff_external_syms (abfd) = NULL; - } - if (obj_coff_strings (abfd) != NULL - && ! obj_coff_keep_strings (abfd)) - { - free (obj_coff_strings (abfd)); - obj_coff_strings (abfd) = NULL; - } - return true; -} - -/* Read a symbol table into freshly bfd_allocated memory, swap it, and - knit the symbol names into a normalized form. By normalized here I - mean that all symbols have an n_offset pointer that points to a null- - terminated string. */ - -combined_entry_type * -coff_get_normalized_symtab (abfd) - bfd *abfd; -{ - combined_entry_type *internal; - combined_entry_type *internal_ptr; - combined_entry_type *symbol_ptr; - combined_entry_type *internal_end; - bfd_size_type symesz; - char *raw_src; - char *raw_end; - const char *string_table = NULL; - char *debug_section = NULL; - unsigned long size; - - if (obj_raw_syments (abfd) != NULL) - return obj_raw_syments (abfd); - - size = obj_raw_syment_count (abfd) * sizeof (combined_entry_type); - internal = (combined_entry_type *) bfd_zalloc (abfd, size); - if (internal == NULL && size != 0) - return NULL; - internal_end = internal + obj_raw_syment_count (abfd); - - if (! _bfd_coff_get_external_symbols (abfd)) - return NULL; - - raw_src = (char *) obj_coff_external_syms (abfd); - - /* mark the end of the symbols */ - symesz = bfd_coff_symesz (abfd); - raw_end = (char *) raw_src + obj_raw_syment_count (abfd) * symesz; - - /* FIXME SOMEDAY. A string table size of zero is very weird, but - probably possible. If one shows up, it will probably kill us. */ - - /* Swap all the raw entries */ - for (internal_ptr = internal; - raw_src < raw_end; - raw_src += symesz, internal_ptr++) - { - - unsigned int i; - bfd_coff_swap_sym_in (abfd, (PTR) raw_src, - (PTR) & internal_ptr->u.syment); - symbol_ptr = internal_ptr; - - for (i = 0; - i < symbol_ptr->u.syment.n_numaux; - i++) - { - internal_ptr++; - raw_src += symesz; - bfd_coff_swap_aux_in (abfd, (PTR) raw_src, - symbol_ptr->u.syment.n_type, - symbol_ptr->u.syment.n_sclass, - i, symbol_ptr->u.syment.n_numaux, - &(internal_ptr->u.auxent)); - coff_pointerize_aux (abfd, internal, symbol_ptr, i, - internal_ptr); - } - } - - /* Free the raw symbols, but not the strings (if we have them). */ - obj_coff_keep_strings (abfd) = true; - if (! _bfd_coff_free_symbols (abfd)) - return NULL; - - for (internal_ptr = internal; internal_ptr < internal_end; - internal_ptr++) - { - if (internal_ptr->u.syment.n_sclass == C_FILE - && internal_ptr->u.syment.n_numaux > 0) - { - /* make a file symbol point to the name in the auxent, since - the text ".file" is redundant */ - if ((internal_ptr + 1)->u.auxent.x_file.x_n.x_zeroes == 0) - { - /* the filename is a long one, point into the string table */ - if (string_table == NULL) - { - string_table = _bfd_coff_read_string_table (abfd); - if (string_table == NULL) - return NULL; - } - - internal_ptr->u.syment._n._n_n._n_offset = - ((long) - (string_table - + (internal_ptr + 1)->u.auxent.x_file.x_n.x_offset)); - } - else - { - /* ordinary short filename, put into memory anyway */ - internal_ptr->u.syment._n._n_n._n_offset = (long) - copy_name (abfd, (internal_ptr + 1)->u.auxent.x_file.x_fname, - FILNMLEN); - } - } - else - { - if (internal_ptr->u.syment._n._n_n._n_zeroes != 0) - { - /* This is a "short" name. Make it long. */ - unsigned long i = 0; - char *newstring = NULL; - - /* find the length of this string without walking into memory - that isn't ours. */ - for (i = 0; i < 8; ++i) - { - if (internal_ptr->u.syment._n._n_name[i] == '\0') - { - break; - } /* if end of string */ - } /* possible lengths of this string. */ - - if ((newstring = (PTR) bfd_alloc (abfd, ++i)) == NULL) - return (NULL); - memset (newstring, 0, i); - strncpy (newstring, internal_ptr->u.syment._n._n_name, i - 1); - internal_ptr->u.syment._n._n_n._n_offset = (long int) newstring; - internal_ptr->u.syment._n._n_n._n_zeroes = 0; - } - else if (internal_ptr->u.syment._n._n_n._n_offset == 0) - internal_ptr->u.syment._n._n_n._n_offset = (long int) ""; - else if (!bfd_coff_symname_in_debug (abfd, &internal_ptr->u.syment)) - { - /* Long name already. Point symbol at the string in the - table. */ - if (string_table == NULL) - { - string_table = _bfd_coff_read_string_table (abfd); - if (string_table == NULL) - return NULL; - } - internal_ptr->u.syment._n._n_n._n_offset = - ((long int) - (string_table - + internal_ptr->u.syment._n._n_n._n_offset)); - } - else - { - /* Long name in debug section. Very similar. */ - if (debug_section == NULL) - debug_section = build_debug_section (abfd); - internal_ptr->u.syment._n._n_n._n_offset = (long int) - (debug_section + internal_ptr->u.syment._n._n_n._n_offset); - } - } - internal_ptr += internal_ptr->u.syment.n_numaux; - } - - obj_raw_syments (abfd) = internal; - BFD_ASSERT (obj_raw_syment_count (abfd) - == (unsigned int) (internal_ptr - internal)); - - return (internal); -} /* coff_get_normalized_symtab() */ - -long -coff_get_reloc_upper_bound (abfd, asect) - bfd *abfd; - sec_ptr asect; -{ - if (bfd_get_format (abfd) != bfd_object) - { - bfd_set_error (bfd_error_invalid_operation); - return -1; - } - return (asect->reloc_count + 1) * sizeof (arelent *); -} - -asymbol * -coff_make_empty_symbol (abfd) - bfd *abfd; -{ - coff_symbol_type *new = (coff_symbol_type *) bfd_alloc (abfd, sizeof (coff_symbol_type)); - if (new == NULL) - return (NULL); - memset (new, 0, sizeof *new); - new->symbol.section = 0; - new->native = 0; - new->lineno = (alent *) NULL; - new->done_lineno = false; - new->symbol.the_bfd = abfd; - return &new->symbol; -} - -/* Make a debugging symbol. */ - -asymbol * -coff_bfd_make_debug_symbol (abfd, ptr, sz) - bfd *abfd; - PTR ptr; - unsigned long sz; -{ - coff_symbol_type *new = (coff_symbol_type *) bfd_alloc (abfd, sizeof (coff_symbol_type)); - if (new == NULL) - return (NULL); - /* @@ This shouldn't be using a constant multiplier. */ - new->native = (combined_entry_type *) bfd_zalloc (abfd, sizeof (combined_entry_type) * 10); - if (!new->native) - return (NULL); - new->symbol.section = bfd_abs_section_ptr; - new->symbol.flags = BSF_DEBUGGING; - new->lineno = (alent *) NULL; - new->done_lineno = false; - new->symbol.the_bfd = abfd; - return &new->symbol; -} - -/*ARGSUSED */ -void -coff_get_symbol_info (abfd, symbol, ret) - bfd *abfd; - asymbol *symbol; - symbol_info *ret; -{ - bfd_symbol_info (symbol, ret); - if (coffsymbol (symbol)->native != NULL - && coffsymbol (symbol)->native->fix_value) - { - combined_entry_type *psym; - - psym = ((combined_entry_type *) - coffsymbol (symbol)->native->u.syment.n_value); - ret->value = (bfd_vma) (psym - obj_raw_syments (abfd)); - } -} - -/* Print out information about COFF symbol. */ - -void -coff_print_symbol (abfd, filep, symbol, how) - bfd *abfd; - PTR filep; - asymbol *symbol; - bfd_print_symbol_type how; -{ - FILE *file = (FILE *) filep; - - switch (how) - { - case bfd_print_symbol_name: - fprintf (file, "%s", symbol->name); - break; - - case bfd_print_symbol_more: - fprintf (file, "coff %s %s", - coffsymbol (symbol)->native ? "n" : "g", - coffsymbol (symbol)->lineno ? "l" : " "); - break; - - case bfd_print_symbol_all: - if (coffsymbol (symbol)->native) - { - unsigned long val; - unsigned int aux; - combined_entry_type *combined = coffsymbol (symbol)->native; - combined_entry_type *root = obj_raw_syments (abfd); - struct lineno_cache_entry *l = coffsymbol (symbol)->lineno; - - fprintf (file, "[%3ld]", (long) (combined - root)); - - if (! combined->fix_value) - val = (unsigned long) combined->u.syment.n_value; - else - val = ((unsigned long) - ((combined_entry_type *) combined->u.syment.n_value - - root)); - - fprintf (file, - "(sec %2d)(fl 0x%02x)(ty %3x)(scl %3d) (nx %d) 0x%08lx %s", - combined->u.syment.n_scnum, - combined->u.syment.n_flags, - combined->u.syment.n_type, - combined->u.syment.n_sclass, - combined->u.syment.n_numaux, - val, - symbol->name); - - for (aux = 0; aux < combined->u.syment.n_numaux; aux++) - { - combined_entry_type *auxp = combined + aux + 1; - long tagndx; - - if (auxp->fix_tag) - tagndx = auxp->u.auxent.x_sym.x_tagndx.p - root; - else - tagndx = auxp->u.auxent.x_sym.x_tagndx.l; - - fprintf (file, "\n"); - - if (bfd_coff_print_aux (abfd, file, root, combined, auxp, aux)) - continue; - - switch (combined->u.syment.n_sclass) - { - case C_FILE: - fprintf (file, "File "); - break; - - case C_STAT: - if (combined->u.syment.n_type == T_NULL) - /* probably a section symbol? */ - { - fprintf (file, "AUX scnlen 0x%lx nreloc %d nlnno %d", - (long) auxp->u.auxent.x_scn.x_scnlen, - auxp->u.auxent.x_scn.x_nreloc, - auxp->u.auxent.x_scn.x_nlinno); - break; - } - /* else fall through */ - - default: - fprintf (file, "AUX lnno %d size 0x%x tagndx %ld", - auxp->u.auxent.x_sym.x_misc.x_lnsz.x_lnno, - auxp->u.auxent.x_sym.x_misc.x_lnsz.x_size, - tagndx); - if (auxp->fix_end) - fprintf (file, " endndx %ld", - ((long) - (auxp->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.p - - root))); - break; - } - } - - if (l) - { - fprintf (file, "\n%s :", l->u.sym->name); - l++; - while (l->line_number) - { - fprintf (file, "\n%4d : 0x%lx", - l->line_number, - ((unsigned long) - (l->u.offset + symbol->section->vma))); - l++; - } - } - } - else - { - bfd_print_symbol_vandf ((PTR) file, symbol); - fprintf (file, " %-5s %s %s %s", - symbol->section->name, - coffsymbol (symbol)->native ? "n" : "g", - coffsymbol (symbol)->lineno ? "l" : " ", - symbol->name); - } - } -} - -/* Provided a BFD, a section and an offset into the section, calculate - and return the name of the source file and the line nearest to the - wanted location. */ - -/*ARGSUSED*/ -boolean -coff_find_nearest_line (abfd, section, symbols, offset, filename_ptr, - functionname_ptr, line_ptr) - bfd *abfd; - asection *section; - asymbol **symbols; - bfd_vma offset; - CONST char **filename_ptr; - CONST char **functionname_ptr; - unsigned int *line_ptr; -{ - boolean found; - unsigned int i; - unsigned int line_base; - coff_data_type *cof = coff_data (abfd); - /* Run through the raw syments if available */ - combined_entry_type *p; - combined_entry_type *pend; - alent *l; - struct coff_section_tdata *sec_data; - - /* Before looking through the symbol table, try to use a .stab - section to find the information. */ - if (! _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, - &found, filename_ptr, - functionname_ptr, line_ptr, - &coff_data (abfd)->line_info)) - return false; - if (found) - return true; - - *filename_ptr = 0; - *functionname_ptr = 0; - *line_ptr = 0; - - /* Don't try and find line numbers in a non coff file */ - if (abfd->xvec->flavour != bfd_target_coff_flavour) - return false; - - if (cof == NULL) - return false; - - /* Find the first C_FILE symbol. */ - p = cof->raw_syments; - pend = p + cof->raw_syment_count; - while (p < pend) - { - if (p->u.syment.n_sclass == C_FILE) - break; - p += 1 + p->u.syment.n_numaux; - } - - if (p < pend) - { - bfd_vma maxdiff; - - /* Look through the C_FILE symbols to find the best one. */ - *filename_ptr = (char *) p->u.syment._n._n_n._n_offset; - maxdiff = (bfd_vma) 0 - (bfd_vma) 1; - while (1) - { - combined_entry_type *p2; - - for (p2 = p + 1 + p->u.syment.n_numaux; - p2 < pend; - p2 += 1 + p2->u.syment.n_numaux) - { - if (p2->u.syment.n_scnum > 0 - && (section - == coff_section_from_bfd_index (abfd, - p2->u.syment.n_scnum))) - break; - if (p2->u.syment.n_sclass == C_FILE) - { - p2 = pend; - break; - } - } - - if (p2 < pend - && offset >= (bfd_vma) p2->u.syment.n_value - && offset - (bfd_vma) p2->u.syment.n_value < maxdiff) - { - *filename_ptr = (char *) p->u.syment._n._n_n._n_offset; - maxdiff = offset - p2->u.syment.n_value; - } - - /* Avoid endless loops on erroneous files by ensuring that - we always move forward in the file. */ - if (p - cof->raw_syments >= p->u.syment.n_value) - break; - - p = cof->raw_syments + p->u.syment.n_value; - if (p > pend || p->u.syment.n_sclass != C_FILE) - break; - } - } - - /* Now wander though the raw linenumbers of the section */ - /* If we have been called on this section before, and the offset we - want is further down then we can prime the lookup loop. */ - sec_data = coff_section_data (abfd, section); - if (sec_data != NULL - && sec_data->i > 0 - && offset >= sec_data->offset) - { - i = sec_data->i; - *functionname_ptr = sec_data->function; - line_base = sec_data->line_base; - } - else - { - i = 0; - line_base = 0; - } - - if (section->lineno != NULL) - { - l = §ion->lineno[i]; - - for (; i < section->lineno_count; i++) - { - if (l->line_number == 0) - { - /* Get the symbol this line number points at */ - coff_symbol_type *coff = (coff_symbol_type *) (l->u.sym); - if (coff->symbol.value > offset) - break; - *functionname_ptr = coff->symbol.name; - if (coff->native) - { - combined_entry_type *s = coff->native; - s = s + 1 + s->u.syment.n_numaux; - - /* In XCOFF a debugging symbol can follow the - function symbol. */ - if (s->u.syment.n_scnum == N_DEBUG) - s = s + 1 + s->u.syment.n_numaux; - - /* S should now point to the .bf of the function. */ - if (s->u.syment.n_numaux) - { - /* The linenumber is stored in the auxent. */ - union internal_auxent *a = &((s + 1)->u.auxent); - line_base = a->x_sym.x_misc.x_lnsz.x_lnno; - *line_ptr = line_base; - } - } - } - else - { - if (l->u.offset + bfd_get_section_vma (abfd, section) > offset) - break; - *line_ptr = l->line_number + line_base - 1; - } - l++; - } - } - - /* Cache the results for the next call. */ - if (sec_data == NULL && section->owner == abfd) - { - section->used_by_bfd = - ((PTR) bfd_zalloc (abfd, - sizeof (struct coff_section_tdata))); - sec_data = (struct coff_section_tdata *) section->used_by_bfd; - } - if (sec_data != NULL) - { - sec_data->offset = offset; - sec_data->i = i; - sec_data->function = *functionname_ptr; - sec_data->line_base = line_base; - } - - return true; -} - -int -coff_sizeof_headers (abfd, reloc) - bfd *abfd; - boolean reloc; -{ - size_t size; - - if (reloc == false) - { - size = bfd_coff_filhsz (abfd) + bfd_coff_aoutsz (abfd); - } - else - { - size = bfd_coff_filhsz (abfd); - } - - size += abfd->section_count * bfd_coff_scnhsz (abfd); - return size; -} diff --git a/contrib/gdb/bfd/coffswap.h b/contrib/gdb/bfd/coffswap.h deleted file mode 100644 index ef1b6b3..0000000 --- a/contrib/gdb/bfd/coffswap.h +++ /dev/null @@ -1,807 +0,0 @@ -/* Generic COFF swapping routines, for BFD. - Copyright 1990, 1991, 1992, 1993, 1995 Free Software Foundation, Inc. - Written by Cygnus Support. - -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. */ - -/* This file contains routines used to swap COFF data. It is a header - file because the details of swapping depend on the details of the - structures used by each COFF implementation. This is included by - coffcode.h, as well as by the ECOFF backend. - - Any file which uses this must first include "coff/internal.h" and - "coff/CPU.h". The functions will then be correct for that CPU. */ - -#ifndef IMAGE_BASE -#define IMAGE_BASE 0 -#endif - -#define PUTWORD bfd_h_put_32 -#define PUTHALF bfd_h_put_16 -#define PUTBYTE bfd_h_put_8 - -#ifndef GET_FCN_LNNOPTR -#define GET_FCN_LNNOPTR(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_lnnoptr) -#endif - -#ifndef GET_FCN_ENDNDX -#define GET_FCN_ENDNDX(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_endndx) -#endif - -#ifndef PUT_FCN_LNNOPTR -#define PUT_FCN_LNNOPTR(abfd, in, ext) PUTWORD(abfd, in, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_lnnoptr) -#endif -#ifndef PUT_FCN_ENDNDX -#define PUT_FCN_ENDNDX(abfd, in, ext) PUTWORD(abfd, in, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_endndx) -#endif -#ifndef GET_LNSZ_LNNO -#define GET_LNSZ_LNNO(abfd, ext) bfd_h_get_16(abfd, (bfd_byte *) ext->x_sym.x_misc.x_lnsz.x_lnno) -#endif -#ifndef GET_LNSZ_SIZE -#define GET_LNSZ_SIZE(abfd, ext) bfd_h_get_16(abfd, (bfd_byte *) ext->x_sym.x_misc.x_lnsz.x_size) -#endif -#ifndef PUT_LNSZ_LNNO -#define PUT_LNSZ_LNNO(abfd, in, ext) bfd_h_put_16(abfd, in, (bfd_byte *)ext->x_sym.x_misc.x_lnsz.x_lnno) -#endif -#ifndef PUT_LNSZ_SIZE -#define PUT_LNSZ_SIZE(abfd, in, ext) bfd_h_put_16(abfd, in, (bfd_byte*) ext->x_sym.x_misc.x_lnsz.x_size) -#endif -#ifndef GET_SCN_SCNLEN -#define GET_SCN_SCNLEN(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *) ext->x_scn.x_scnlen) -#endif -#ifndef GET_SCN_NRELOC -#define GET_SCN_NRELOC(abfd, ext) bfd_h_get_16(abfd, (bfd_byte *)ext->x_scn.x_nreloc) -#endif -#ifndef GET_SCN_NLINNO -#define GET_SCN_NLINNO(abfd, ext) bfd_h_get_16(abfd, (bfd_byte *)ext->x_scn.x_nlinno) -#endif -#ifndef PUT_SCN_SCNLEN -#define PUT_SCN_SCNLEN(abfd,in, ext) bfd_h_put_32(abfd, in, (bfd_byte *) ext->x_scn.x_scnlen) -#endif -#ifndef PUT_SCN_NRELOC -#define PUT_SCN_NRELOC(abfd,in, ext) bfd_h_put_16(abfd, in, (bfd_byte *)ext->x_scn.x_nreloc) -#endif -#ifndef PUT_SCN_NLINNO -#define PUT_SCN_NLINNO(abfd,in, ext) bfd_h_put_16(abfd,in, (bfd_byte *) ext->x_scn.x_nlinno) -#endif -#ifndef GET_LINENO_LNNO -#define GET_LINENO_LNNO(abfd, ext) bfd_h_get_16(abfd, (bfd_byte *) (ext->l_lnno)); -#endif -#ifndef PUT_LINENO_LNNO -#define PUT_LINENO_LNNO(abfd,val, ext) bfd_h_put_16(abfd,val, (bfd_byte *) (ext->l_lnno)); -#endif - -/* The f_symptr field in the filehdr is sometimes 64 bits. */ -#ifndef GET_FILEHDR_SYMPTR -#define GET_FILEHDR_SYMPTR bfd_h_get_32 -#endif -#ifndef PUT_FILEHDR_SYMPTR -#define PUT_FILEHDR_SYMPTR bfd_h_put_32 -#endif - -/* Some fields in the aouthdr are sometimes 64 bits. */ -#ifndef GET_AOUTHDR_TSIZE -#define GET_AOUTHDR_TSIZE bfd_h_get_32 -#endif -#ifndef PUT_AOUTHDR_TSIZE -#define PUT_AOUTHDR_TSIZE bfd_h_put_32 -#endif -#ifndef GET_AOUTHDR_DSIZE -#define GET_AOUTHDR_DSIZE bfd_h_get_32 -#endif -#ifndef PUT_AOUTHDR_DSIZE -#define PUT_AOUTHDR_DSIZE bfd_h_put_32 -#endif -#ifndef GET_AOUTHDR_BSIZE -#define GET_AOUTHDR_BSIZE bfd_h_get_32 -#endif -#ifndef PUT_AOUTHDR_BSIZE -#define PUT_AOUTHDR_BSIZE bfd_h_put_32 -#endif -#ifndef GET_AOUTHDR_ENTRY -#define GET_AOUTHDR_ENTRY bfd_h_get_32 -#endif -#ifndef PUT_AOUTHDR_ENTRY -#define PUT_AOUTHDR_ENTRY bfd_h_put_32 -#endif -#ifndef GET_AOUTHDR_TEXT_START -#define GET_AOUTHDR_TEXT_START bfd_h_get_32 -#endif -#ifndef PUT_AOUTHDR_TEXT_START -#define PUT_AOUTHDR_TEXT_START bfd_h_put_32 -#endif -#ifndef GET_AOUTHDR_DATA_START -#define GET_AOUTHDR_DATA_START bfd_h_get_32 -#endif -#ifndef PUT_AOUTHDR_DATA_START -#define PUT_AOUTHDR_DATA_START bfd_h_put_32 -#endif - -/* Some fields in the scnhdr are sometimes 64 bits. */ -#ifndef GET_SCNHDR_PADDR -#define GET_SCNHDR_PADDR bfd_h_get_32 -#endif -#ifndef PUT_SCNHDR_PADDR -#define PUT_SCNHDR_PADDR bfd_h_put_32 -#endif -#ifndef GET_SCNHDR_VADDR -#define GET_SCNHDR_VADDR bfd_h_get_32 -#endif -#ifndef PUT_SCNHDR_VADDR -#define PUT_SCNHDR_VADDR bfd_h_put_32 -#endif -#ifndef GET_SCNHDR_SIZE -#define GET_SCNHDR_SIZE bfd_h_get_32 -#endif -#ifndef PUT_SCNHDR_SIZE -#define PUT_SCNHDR_SIZE bfd_h_put_32 -#endif -#ifndef GET_SCNHDR_SCNPTR -#define GET_SCNHDR_SCNPTR bfd_h_get_32 -#endif -#ifndef PUT_SCNHDR_SCNPTR -#define PUT_SCNHDR_SCNPTR bfd_h_put_32 -#endif -#ifndef GET_SCNHDR_RELPTR -#define GET_SCNHDR_RELPTR bfd_h_get_32 -#endif -#ifndef PUT_SCNHDR_RELPTR -#define PUT_SCNHDR_RELPTR bfd_h_put_32 -#endif -#ifndef GET_SCNHDR_LNNOPTR -#define GET_SCNHDR_LNNOPTR bfd_h_get_32 -#endif -#ifndef PUT_SCNHDR_LNNOPTR -#define PUT_SCNHDR_LNNOPTR bfd_h_put_32 -#endif - -#ifndef NO_COFF_RELOCS - -static void -coff_swap_reloc_in (abfd, src, dst) - bfd *abfd; - PTR src; - PTR dst; -{ - RELOC *reloc_src = (RELOC *) src; - struct internal_reloc *reloc_dst = (struct internal_reloc *) dst; - - reloc_dst->r_vaddr = bfd_h_get_32(abfd, (bfd_byte *)reloc_src->r_vaddr); - reloc_dst->r_symndx = bfd_h_get_signed_32(abfd, (bfd_byte *) reloc_src->r_symndx); - -#ifdef RS6000COFF_C - reloc_dst->r_type = bfd_h_get_8(abfd, reloc_src->r_type); - reloc_dst->r_size = bfd_h_get_8(abfd, reloc_src->r_size); -#else - reloc_dst->r_type = bfd_h_get_16(abfd, (bfd_byte *) reloc_src->r_type); -#endif - -#ifdef SWAP_IN_RELOC_OFFSET - reloc_dst->r_offset = SWAP_IN_RELOC_OFFSET(abfd, - (bfd_byte *) reloc_src->r_offset); -#endif -} - - -static unsigned int -coff_swap_reloc_out (abfd, src, dst) - bfd *abfd; - PTR src; - PTR dst; -{ - struct internal_reloc *reloc_src = (struct internal_reloc *)src; - struct external_reloc *reloc_dst = (struct external_reloc *)dst; - bfd_h_put_32(abfd, reloc_src->r_vaddr, (bfd_byte *) reloc_dst->r_vaddr); - bfd_h_put_32(abfd, reloc_src->r_symndx, (bfd_byte *) reloc_dst->r_symndx); - -#ifdef RS6000COFF_C - bfd_h_put_8 (abfd, reloc_src->r_type, (bfd_byte *) reloc_dst->r_type); - bfd_h_put_8 (abfd, reloc_src->r_size, (bfd_byte *) reloc_dst->r_size); -#else - bfd_h_put_16(abfd, reloc_src->r_type, (bfd_byte *) - reloc_dst->r_type); -#endif - -#ifdef SWAP_OUT_RELOC_OFFSET - SWAP_OUT_RELOC_OFFSET(abfd, - reloc_src->r_offset, - (bfd_byte *) reloc_dst->r_offset); -#endif -#ifdef SWAP_OUT_RELOC_EXTRA - SWAP_OUT_RELOC_EXTRA(abfd,reloc_src, reloc_dst); -#endif - - return sizeof(struct external_reloc); -} - -#endif /* NO_COFF_RELOCS */ - -static void -coff_swap_filehdr_in (abfd, src, dst) - bfd *abfd; - PTR src; - PTR dst; -{ - FILHDR *filehdr_src = (FILHDR *) src; - struct internal_filehdr *filehdr_dst = (struct internal_filehdr *) dst; - filehdr_dst->f_magic = bfd_h_get_16(abfd, (bfd_byte *) filehdr_src->f_magic); - filehdr_dst->f_nscns = bfd_h_get_16(abfd, (bfd_byte *)filehdr_src-> f_nscns); - filehdr_dst->f_timdat = bfd_h_get_32(abfd, (bfd_byte *)filehdr_src-> f_timdat); - filehdr_dst->f_symptr = - GET_FILEHDR_SYMPTR (abfd, (bfd_byte *) filehdr_src->f_symptr); - filehdr_dst->f_nsyms = bfd_h_get_32(abfd, (bfd_byte *)filehdr_src-> f_nsyms); - filehdr_dst->f_opthdr = bfd_h_get_16(abfd, (bfd_byte *)filehdr_src-> f_opthdr); - filehdr_dst->f_flags = bfd_h_get_16(abfd, (bfd_byte *)filehdr_src-> f_flags); -} - -static unsigned int -coff_swap_filehdr_out (abfd, in, out) - bfd *abfd; - PTR in; - PTR out; -{ - struct internal_filehdr *filehdr_in = (struct internal_filehdr *)in; - FILHDR *filehdr_out = (FILHDR *)out; - - bfd_h_put_16(abfd, filehdr_in->f_magic, (bfd_byte *) filehdr_out->f_magic); - bfd_h_put_16(abfd, filehdr_in->f_nscns, (bfd_byte *) filehdr_out->f_nscns); - bfd_h_put_32(abfd, filehdr_in->f_timdat, (bfd_byte *) filehdr_out->f_timdat); - PUT_FILEHDR_SYMPTR (abfd, (bfd_vma) filehdr_in->f_symptr, - (bfd_byte *) filehdr_out->f_symptr); - bfd_h_put_32(abfd, filehdr_in->f_nsyms, (bfd_byte *) filehdr_out->f_nsyms); - bfd_h_put_16(abfd, filehdr_in->f_opthdr, (bfd_byte *) filehdr_out->f_opthdr); - bfd_h_put_16(abfd, filehdr_in->f_flags, (bfd_byte *) filehdr_out->f_flags); - - return sizeof(FILHDR); -} - - -#ifndef NO_COFF_SYMBOLS - -static void -coff_swap_sym_in (abfd, ext1, in1) - bfd *abfd; - PTR ext1; - PTR in1; -{ - SYMENT *ext = (SYMENT *)ext1; - struct internal_syment *in = (struct internal_syment *)in1; - - if( ext->e.e_name[0] == 0) { - in->_n._n_n._n_zeroes = 0; - in->_n._n_n._n_offset = bfd_h_get_32(abfd, (bfd_byte *) ext->e.e.e_offset); - } - else { -#if SYMNMLEN != E_SYMNMLEN - -> Error, we need to cope with truncating or extending SYMNMLEN!; -#else - memcpy(in->_n._n_name, ext->e.e_name, SYMNMLEN); -#endif - } - in->n_value = bfd_h_get_32(abfd, (bfd_byte *) ext->e_value); - in->n_scnum = bfd_h_get_16(abfd, (bfd_byte *) ext->e_scnum); - if (sizeof(ext->e_type) == 2){ - in->n_type = bfd_h_get_16(abfd, (bfd_byte *) ext->e_type); - } - else { - in->n_type = bfd_h_get_32(abfd, (bfd_byte *) ext->e_type); - } - in->n_sclass = bfd_h_get_8(abfd, ext->e_sclass); - in->n_numaux = bfd_h_get_8(abfd, ext->e_numaux); -} - -static unsigned int -coff_swap_sym_out (abfd, inp, extp) - bfd *abfd; - PTR inp; - PTR extp; -{ - struct internal_syment *in = (struct internal_syment *)inp; - SYMENT *ext =(SYMENT *)extp; - if(in->_n._n_name[0] == 0) { - bfd_h_put_32(abfd, 0, (bfd_byte *) ext->e.e.e_zeroes); - bfd_h_put_32(abfd, in->_n._n_n._n_offset, (bfd_byte *) ext->e.e.e_offset); - } - else { -#if SYMNMLEN != E_SYMNMLEN - -> Error, we need to cope with truncating or extending SYMNMLEN!; -#else - memcpy(ext->e.e_name, in->_n._n_name, SYMNMLEN); -#endif - } - bfd_h_put_32(abfd, in->n_value , (bfd_byte *) ext->e_value); - bfd_h_put_16(abfd, in->n_scnum , (bfd_byte *) ext->e_scnum); - if (sizeof(ext->e_type) == 2) - { - bfd_h_put_16(abfd, in->n_type , (bfd_byte *) ext->e_type); - } - else - { - bfd_h_put_32(abfd, in->n_type , (bfd_byte *) ext->e_type); - } - bfd_h_put_8(abfd, in->n_sclass , ext->e_sclass); - bfd_h_put_8(abfd, in->n_numaux , ext->e_numaux); - return sizeof(SYMENT); -} - -static void -coff_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1) - bfd *abfd; - PTR ext1; - int type; - int class; - int indx; - int numaux; - PTR in1; -{ - AUXENT *ext = (AUXENT *)ext1; - union internal_auxent *in = (union internal_auxent *)in1; - - switch (class) { - case C_FILE: - if (ext->x_file.x_fname[0] == 0) { - in->x_file.x_n.x_zeroes = 0; - in->x_file.x_n.x_offset = - bfd_h_get_32(abfd, (bfd_byte *) ext->x_file.x_n.x_offset); - } else { -#if FILNMLEN != E_FILNMLEN - -> Error, we need to cope with truncating or extending FILNMLEN!; -#else - memcpy (in->x_file.x_fname, ext->x_file.x_fname, FILNMLEN); -#endif - } - return; - - /* RS/6000 "csect" auxents */ -#ifdef RS6000COFF_C - case C_EXT: - case C_HIDEXT: - if (indx + 1 == numaux) - { - in->x_csect.x_scnlen.l = bfd_h_get_32 (abfd, ext->x_csect.x_scnlen); - in->x_csect.x_parmhash = bfd_h_get_32 (abfd, - ext->x_csect.x_parmhash); - in->x_csect.x_snhash = bfd_h_get_16 (abfd, ext->x_csect.x_snhash); - /* We don't have to hack bitfields in x_smtyp because it's - defined by shifts-and-ands, which are equivalent on all - byte orders. */ - in->x_csect.x_smtyp = bfd_h_get_8 (abfd, ext->x_csect.x_smtyp); - in->x_csect.x_smclas = bfd_h_get_8 (abfd, ext->x_csect.x_smclas); - in->x_csect.x_stab = bfd_h_get_32 (abfd, ext->x_csect.x_stab); - in->x_csect.x_snstab = bfd_h_get_16 (abfd, ext->x_csect.x_snstab); - return; - } - break; -#endif - - case C_STAT: -#ifdef C_LEAFSTAT - case C_LEAFSTAT: -#endif - case C_HIDDEN: - if (type == T_NULL) { - in->x_scn.x_scnlen = GET_SCN_SCNLEN(abfd, ext); - in->x_scn.x_nreloc = GET_SCN_NRELOC(abfd, ext); - in->x_scn.x_nlinno = GET_SCN_NLINNO(abfd, ext); - return; - } - break; - } - - in->x_sym.x_tagndx.l = bfd_h_get_32(abfd, (bfd_byte *) ext->x_sym.x_tagndx); -#ifndef NO_TVNDX - in->x_sym.x_tvndx = bfd_h_get_16(abfd, (bfd_byte *) ext->x_sym.x_tvndx); -#endif - - if (class == C_BLOCK || ISFCN (type) || ISTAG (class)) - { - in->x_sym.x_fcnary.x_fcn.x_lnnoptr = GET_FCN_LNNOPTR (abfd, ext); - in->x_sym.x_fcnary.x_fcn.x_endndx.l = GET_FCN_ENDNDX (abfd, ext); - } - else - { -#if DIMNUM != E_DIMNUM - #error we need to cope with truncating or extending DIMNUM -#endif - in->x_sym.x_fcnary.x_ary.x_dimen[0] = - bfd_h_get_16 (abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[0]); - in->x_sym.x_fcnary.x_ary.x_dimen[1] = - bfd_h_get_16 (abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[1]); - in->x_sym.x_fcnary.x_ary.x_dimen[2] = - bfd_h_get_16 (abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[2]); - in->x_sym.x_fcnary.x_ary.x_dimen[3] = - bfd_h_get_16 (abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[3]); - } - - if (ISFCN(type)) { - in->x_sym.x_misc.x_fsize = bfd_h_get_32(abfd, (bfd_byte *) ext->x_sym.x_misc.x_fsize); - } - else { - in->x_sym.x_misc.x_lnsz.x_lnno = GET_LNSZ_LNNO(abfd, ext); - in->x_sym.x_misc.x_lnsz.x_size = GET_LNSZ_SIZE(abfd, ext); - } -} - -static unsigned int -coff_swap_aux_out (abfd, inp, type, class, indx, numaux, extp) - bfd *abfd; - PTR inp; - int type; - int class; - int indx; - int numaux; - PTR extp; -{ - union internal_auxent *in = (union internal_auxent *)inp; - AUXENT *ext = (AUXENT *)extp; - - memset((PTR)ext, 0, AUXESZ); - switch (class) { - case C_FILE: - if (in->x_file.x_fname[0] == 0) { - PUTWORD(abfd, 0, (bfd_byte *) ext->x_file.x_n.x_zeroes); - PUTWORD(abfd, - in->x_file.x_n.x_offset, - (bfd_byte *) ext->x_file.x_n.x_offset); - } - else { -#if FILNMLEN != E_FILNMLEN - -> Error, we need to cope with truncating or extending FILNMLEN!; -#else - memcpy (ext->x_file.x_fname, in->x_file.x_fname, FILNMLEN); -#endif - } - return sizeof (AUXENT); - -#ifdef RS6000COFF_C - /* RS/6000 "csect" auxents */ - case C_EXT: - case C_HIDEXT: - if (indx + 1 == numaux) - { - PUTWORD (abfd, in->x_csect.x_scnlen.l, ext->x_csect.x_scnlen); - PUTWORD (abfd, in->x_csect.x_parmhash, ext->x_csect.x_parmhash); - PUTHALF (abfd, in->x_csect.x_snhash, ext->x_csect.x_snhash); - /* We don't have to hack bitfields in x_smtyp because it's - defined by shifts-and-ands, which are equivalent on all - byte orders. */ - PUTBYTE (abfd, in->x_csect.x_smtyp, ext->x_csect.x_smtyp); - PUTBYTE (abfd, in->x_csect.x_smclas, ext->x_csect.x_smclas); - PUTWORD (abfd, in->x_csect.x_stab, ext->x_csect.x_stab); - PUTHALF (abfd, in->x_csect.x_snstab, ext->x_csect.x_snstab); - return sizeof (AUXENT); - } - break; -#endif - - case C_STAT: -#ifdef C_LEAFSTAT - case C_LEAFSTAT: -#endif - case C_HIDDEN: - if (type == T_NULL) { - PUT_SCN_SCNLEN(abfd, in->x_scn.x_scnlen, ext); - PUT_SCN_NRELOC(abfd, in->x_scn.x_nreloc, ext); - PUT_SCN_NLINNO(abfd, in->x_scn.x_nlinno, ext); - return sizeof (AUXENT); - } - break; - } - - PUTWORD(abfd, in->x_sym.x_tagndx.l, (bfd_byte *) ext->x_sym.x_tagndx); -#ifndef NO_TVNDX - bfd_h_put_16(abfd, in->x_sym.x_tvndx , (bfd_byte *) ext->x_sym.x_tvndx); -#endif - - if (class == C_BLOCK || ISFCN (type) || ISTAG (class)) - { - PUT_FCN_LNNOPTR(abfd, in->x_sym.x_fcnary.x_fcn.x_lnnoptr, ext); - PUT_FCN_ENDNDX(abfd, in->x_sym.x_fcnary.x_fcn.x_endndx.l, ext); - } - else - { -#if DIMNUM != E_DIMNUM - #error we need to cope with truncating or extending DIMNUM -#endif - bfd_h_put_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[0], - (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[0]); - bfd_h_put_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[1], - (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[1]); - bfd_h_put_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[2], - (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[2]); - bfd_h_put_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[3], - (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[3]); - } - - if (ISFCN (type)) - PUTWORD (abfd, in->x_sym.x_misc.x_fsize, - (bfd_byte *) ext->x_sym.x_misc.x_fsize); - else - { - PUT_LNSZ_LNNO (abfd, in->x_sym.x_misc.x_lnsz.x_lnno, ext); - PUT_LNSZ_SIZE (abfd, in->x_sym.x_misc.x_lnsz.x_size, ext); - } - - return sizeof(AUXENT); -} - -#endif /* NO_COFF_SYMBOLS */ - -#ifndef NO_COFF_LINENOS - -static void -coff_swap_lineno_in (abfd, ext1, in1) - bfd *abfd; - PTR ext1; - PTR in1; -{ - LINENO *ext = (LINENO *)ext1; - struct internal_lineno *in = (struct internal_lineno *)in1; - - in->l_addr.l_symndx = bfd_h_get_32(abfd, (bfd_byte *) ext->l_addr.l_symndx); - in->l_lnno = GET_LINENO_LNNO(abfd, ext); -} - -static unsigned int -coff_swap_lineno_out (abfd, inp, outp) - bfd *abfd; - PTR inp; - PTR outp; -{ - struct internal_lineno *in = (struct internal_lineno *)inp; - struct external_lineno *ext = (struct external_lineno *)outp; - PUTWORD(abfd, in->l_addr.l_symndx, (bfd_byte *) - ext->l_addr.l_symndx); - - PUT_LINENO_LNNO (abfd, in->l_lnno, ext); - return sizeof(struct external_lineno); -} - -#endif /* NO_COFF_LINENOS */ - - -static void -coff_swap_aouthdr_in (abfd, aouthdr_ext1, aouthdr_int1) - bfd *abfd; - PTR aouthdr_ext1; - PTR aouthdr_int1; -{ - AOUTHDR *aouthdr_ext = (AOUTHDR *) aouthdr_ext1; - struct internal_aouthdr *aouthdr_int = (struct internal_aouthdr *)aouthdr_int1; - - aouthdr_int->magic = bfd_h_get_16(abfd, (bfd_byte *) aouthdr_ext->magic); - aouthdr_int->vstamp = bfd_h_get_16(abfd, (bfd_byte *) aouthdr_ext->vstamp); - aouthdr_int->tsize = - GET_AOUTHDR_TSIZE (abfd, (bfd_byte *) aouthdr_ext->tsize); - aouthdr_int->dsize = - GET_AOUTHDR_DSIZE (abfd, (bfd_byte *) aouthdr_ext->dsize); - aouthdr_int->bsize = - GET_AOUTHDR_BSIZE (abfd, (bfd_byte *) aouthdr_ext->bsize); - aouthdr_int->entry = - GET_AOUTHDR_ENTRY (abfd, (bfd_byte *) aouthdr_ext->entry); - aouthdr_int->text_start = - GET_AOUTHDR_TEXT_START (abfd, (bfd_byte *) aouthdr_ext->text_start); - aouthdr_int->data_start = - GET_AOUTHDR_DATA_START (abfd, (bfd_byte *) aouthdr_ext->data_start); - -#ifdef I960 - aouthdr_int->tagentries = bfd_h_get_32(abfd, (bfd_byte *) aouthdr_ext->tagentries); -#endif - -#ifdef APOLLO_M68 - bfd_h_put_32(abfd, aouthdr_int->o_inlib, (bfd_byte *) aouthdr_ext->o_inlib); - bfd_h_put_32(abfd, aouthdr_int->o_sri, (bfd_byte *) aouthdr_ext->o_sri); - bfd_h_put_32(abfd, aouthdr_int->vid[0], (bfd_byte *) aouthdr_ext->vid); - bfd_h_put_32(abfd, aouthdr_int->vid[1], (bfd_byte *) aouthdr_ext->vid + 4); -#endif - - -#ifdef RS6000COFF_C - aouthdr_int->o_toc = bfd_h_get_32(abfd, aouthdr_ext->o_toc); - aouthdr_int->o_snentry = bfd_h_get_16(abfd, aouthdr_ext->o_snentry); - aouthdr_int->o_sntext = bfd_h_get_16(abfd, aouthdr_ext->o_sntext); - aouthdr_int->o_sndata = bfd_h_get_16(abfd, aouthdr_ext->o_sndata); - aouthdr_int->o_sntoc = bfd_h_get_16(abfd, aouthdr_ext->o_sntoc); - aouthdr_int->o_snloader = bfd_h_get_16(abfd, aouthdr_ext->o_snloader); - aouthdr_int->o_snbss = bfd_h_get_16(abfd, aouthdr_ext->o_snbss); - aouthdr_int->o_algntext = bfd_h_get_16(abfd, aouthdr_ext->o_algntext); - aouthdr_int->o_algndata = bfd_h_get_16(abfd, aouthdr_ext->o_algndata); - aouthdr_int->o_modtype = bfd_h_get_16(abfd, aouthdr_ext->o_modtype); - aouthdr_int->o_cputype = bfd_h_get_16(abfd, aouthdr_ext->o_cputype); - aouthdr_int->o_maxstack = bfd_h_get_32(abfd, aouthdr_ext->o_maxstack); - aouthdr_int->o_maxdata = bfd_h_get_32(abfd, aouthdr_ext->o_maxdata); -#endif - -#ifdef MIPSECOFF - aouthdr_int->bss_start = bfd_h_get_32(abfd, aouthdr_ext->bss_start); - aouthdr_int->gp_value = bfd_h_get_32(abfd, aouthdr_ext->gp_value); - aouthdr_int->gprmask = bfd_h_get_32(abfd, aouthdr_ext->gprmask); - aouthdr_int->cprmask[0] = bfd_h_get_32(abfd, aouthdr_ext->cprmask[0]); - aouthdr_int->cprmask[1] = bfd_h_get_32(abfd, aouthdr_ext->cprmask[1]); - aouthdr_int->cprmask[2] = bfd_h_get_32(abfd, aouthdr_ext->cprmask[2]); - aouthdr_int->cprmask[3] = bfd_h_get_32(abfd, aouthdr_ext->cprmask[3]); -#endif - -#ifdef ALPHAECOFF - aouthdr_int->bss_start = bfd_h_get_64(abfd, aouthdr_ext->bss_start); - aouthdr_int->gp_value = bfd_h_get_64(abfd, aouthdr_ext->gp_value); - aouthdr_int->gprmask = bfd_h_get_32(abfd, aouthdr_ext->gprmask); - aouthdr_int->fprmask = bfd_h_get_32(abfd, aouthdr_ext->fprmask); -#endif -} - -static unsigned int -coff_swap_aouthdr_out (abfd, in, out) - bfd *abfd; - PTR in; - PTR out; -{ - struct internal_aouthdr *aouthdr_in = (struct internal_aouthdr *)in; - AOUTHDR *aouthdr_out = (AOUTHDR *)out; - - bfd_h_put_16(abfd, aouthdr_in->magic, (bfd_byte *) aouthdr_out->magic); - bfd_h_put_16(abfd, aouthdr_in->vstamp, (bfd_byte *) aouthdr_out->vstamp); - PUT_AOUTHDR_TSIZE (abfd, aouthdr_in->tsize, (bfd_byte *) aouthdr_out->tsize); - PUT_AOUTHDR_DSIZE (abfd, aouthdr_in->dsize, (bfd_byte *) aouthdr_out->dsize); - PUT_AOUTHDR_BSIZE (abfd, aouthdr_in->bsize, (bfd_byte *) aouthdr_out->bsize); - PUT_AOUTHDR_ENTRY (abfd, aouthdr_in->entry, (bfd_byte *) aouthdr_out->entry); - PUT_AOUTHDR_TEXT_START (abfd, aouthdr_in->text_start, - (bfd_byte *) aouthdr_out->text_start); - PUT_AOUTHDR_DATA_START (abfd, aouthdr_in->data_start, - (bfd_byte *) aouthdr_out->data_start); - -#ifdef I960 - bfd_h_put_32(abfd, aouthdr_in->tagentries, (bfd_byte *) aouthdr_out->tagentries); -#endif - -#ifdef RS6000COFF_C - bfd_h_put_32 (abfd, aouthdr_in->o_toc, aouthdr_out->o_toc); - bfd_h_put_16 (abfd, aouthdr_in->o_snentry, aouthdr_out->o_snentry); - bfd_h_put_16 (abfd, aouthdr_in->o_sntext, aouthdr_out->o_sntext); - bfd_h_put_16 (abfd, aouthdr_in->o_sndata, aouthdr_out->o_sndata); - bfd_h_put_16 (abfd, aouthdr_in->o_sntoc, aouthdr_out->o_sntoc); - bfd_h_put_16 (abfd, aouthdr_in->o_snloader, aouthdr_out->o_snloader); - bfd_h_put_16 (abfd, aouthdr_in->o_snbss, aouthdr_out->o_snbss); - bfd_h_put_16 (abfd, aouthdr_in->o_algntext, aouthdr_out->o_algntext); - bfd_h_put_16 (abfd, aouthdr_in->o_algndata, aouthdr_out->o_algndata); - bfd_h_put_16 (abfd, aouthdr_in->o_modtype, aouthdr_out->o_modtype); - bfd_h_put_16 (abfd, aouthdr_in->o_cputype, aouthdr_out->o_cputype); - bfd_h_put_32 (abfd, aouthdr_in->o_maxstack, aouthdr_out->o_maxstack); - bfd_h_put_32 (abfd, aouthdr_in->o_maxdata, aouthdr_out->o_maxdata); - memset (aouthdr_out->o_resv2, 0, sizeof aouthdr_out->o_resv2); -#endif - -#ifdef MIPSECOFF - bfd_h_put_32(abfd, aouthdr_in->bss_start, (bfd_byte *) aouthdr_out->bss_start); - bfd_h_put_32(abfd, aouthdr_in->gp_value, (bfd_byte *) aouthdr_out->gp_value); - bfd_h_put_32(abfd, aouthdr_in->gprmask, (bfd_byte *) aouthdr_out->gprmask); - bfd_h_put_32(abfd, aouthdr_in->cprmask[0], (bfd_byte *) aouthdr_out->cprmask[0]); - bfd_h_put_32(abfd, aouthdr_in->cprmask[1], (bfd_byte *) aouthdr_out->cprmask[1]); - bfd_h_put_32(abfd, aouthdr_in->cprmask[2], (bfd_byte *) aouthdr_out->cprmask[2]); - bfd_h_put_32(abfd, aouthdr_in->cprmask[3], (bfd_byte *) aouthdr_out->cprmask[3]); -#endif - -#ifdef ALPHAECOFF - /* FIXME: What does bldrev mean? */ - bfd_h_put_16(abfd, (bfd_vma) 2, (bfd_byte *) aouthdr_out->bldrev); - bfd_h_put_16(abfd, (bfd_vma) 0, (bfd_byte *) aouthdr_out->padding); - bfd_h_put_64(abfd, aouthdr_in->bss_start, (bfd_byte *) aouthdr_out->bss_start); - bfd_h_put_64(abfd, aouthdr_in->gp_value, (bfd_byte *) aouthdr_out->gp_value); - bfd_h_put_32(abfd, aouthdr_in->gprmask, (bfd_byte *) aouthdr_out->gprmask); - bfd_h_put_32(abfd, aouthdr_in->fprmask, (bfd_byte *) aouthdr_out->fprmask); -#endif - - return sizeof(AOUTHDR); -} - -static void -coff_swap_scnhdr_in (abfd, ext, in) - bfd *abfd; - PTR ext; - PTR in; -{ - SCNHDR *scnhdr_ext = (SCNHDR *) ext; - struct internal_scnhdr *scnhdr_int = (struct internal_scnhdr *) in; - - memcpy(scnhdr_int->s_name, scnhdr_ext->s_name, sizeof(scnhdr_int->s_name)); - scnhdr_int->s_vaddr = - GET_SCNHDR_VADDR (abfd, (bfd_byte *) scnhdr_ext->s_vaddr); - scnhdr_int->s_paddr = - GET_SCNHDR_PADDR (abfd, (bfd_byte *) scnhdr_ext->s_paddr); - scnhdr_int->s_size = - GET_SCNHDR_SIZE (abfd, (bfd_byte *) scnhdr_ext->s_size); - - scnhdr_int->s_scnptr = - GET_SCNHDR_SCNPTR (abfd, (bfd_byte *) scnhdr_ext->s_scnptr); - scnhdr_int->s_relptr = - GET_SCNHDR_RELPTR (abfd, (bfd_byte *) scnhdr_ext->s_relptr); - scnhdr_int->s_lnnoptr = - GET_SCNHDR_LNNOPTR (abfd, (bfd_byte *) scnhdr_ext->s_lnnoptr); - scnhdr_int->s_flags = bfd_h_get_32(abfd, (bfd_byte *) scnhdr_ext->s_flags); -#if defined(M88) - scnhdr_int->s_nreloc = bfd_h_get_32(abfd, (bfd_byte *) scnhdr_ext->s_nreloc); - scnhdr_int->s_nlnno = bfd_h_get_32(abfd, (bfd_byte *) scnhdr_ext->s_nlnno); -#else - scnhdr_int->s_nreloc = bfd_h_get_16(abfd, (bfd_byte *) scnhdr_ext->s_nreloc); - scnhdr_int->s_nlnno = bfd_h_get_16(abfd, (bfd_byte *) scnhdr_ext->s_nlnno); -#endif -#ifdef I960 - scnhdr_int->s_align = bfd_h_get_32(abfd, (bfd_byte *) scnhdr_ext->s_align); -#endif -} - -static unsigned int -coff_swap_scnhdr_out (abfd, in, out) - bfd *abfd; - PTR in; - PTR out; -{ - struct internal_scnhdr *scnhdr_int = (struct internal_scnhdr *)in; - SCNHDR *scnhdr_ext = (SCNHDR *)out; - unsigned int ret = sizeof (SCNHDR); - - memcpy(scnhdr_ext->s_name, scnhdr_int->s_name, sizeof(scnhdr_int->s_name)); - - PUT_SCNHDR_VADDR (abfd, scnhdr_int->s_vaddr, - (bfd_byte *) scnhdr_ext->s_vaddr); - - - PUT_SCNHDR_PADDR (abfd, scnhdr_int->s_paddr, - (bfd_byte *) scnhdr_ext->s_paddr); - PUT_SCNHDR_SIZE (abfd, scnhdr_int->s_size, - (bfd_byte *) scnhdr_ext->s_size); - - PUT_SCNHDR_SCNPTR (abfd, scnhdr_int->s_scnptr, - (bfd_byte *) scnhdr_ext->s_scnptr); - PUT_SCNHDR_RELPTR (abfd, scnhdr_int->s_relptr, - (bfd_byte *) scnhdr_ext->s_relptr); - PUT_SCNHDR_LNNOPTR (abfd, scnhdr_int->s_lnnoptr, - (bfd_byte *) scnhdr_ext->s_lnnoptr); - PUTWORD(abfd, scnhdr_int->s_flags, (bfd_byte *) scnhdr_ext->s_flags); -#if defined(M88) - PUTWORD(abfd, scnhdr_int->s_nlnno, (bfd_byte *) scnhdr_ext->s_nlnno); - PUTWORD(abfd, scnhdr_int->s_nreloc, (bfd_byte *) scnhdr_ext->s_nreloc); -#else - if (scnhdr_int->s_nlnno <= 0xffff) - PUTHALF(abfd, scnhdr_int->s_nlnno, (bfd_byte *) scnhdr_ext->s_nlnno); - else - { - (*_bfd_error_handler) ("%s: line number overflow: 0x%lx > 0xffff", - bfd_get_filename (abfd), - scnhdr_int->s_nlnno); - bfd_set_error (bfd_error_file_truncated); - PUTHALF (abfd, 0xffff, (bfd_byte *) scnhdr_ext->s_nlnno); - ret = 0; - } - if (scnhdr_int->s_nreloc <= 0xffff) - PUTHALF(abfd, scnhdr_int->s_nreloc, (bfd_byte *) scnhdr_ext->s_nreloc); - else - { - (*_bfd_error_handler) ("%s: reloc overflow: 0x%lx > 0xffff", - bfd_get_filename (abfd), - scnhdr_int->s_nreloc); - bfd_set_error (bfd_error_file_truncated); - PUTHALF (abfd, 0xffff, (bfd_byte *) scnhdr_ext->s_nreloc); - ret = 0; - } -#endif - -#if defined(I960) - PUTWORD(abfd, scnhdr_int->s_align, (bfd_byte *) scnhdr_ext->s_align); -#endif - return ret; -} diff --git a/contrib/gdb/bfd/config.bfd b/contrib/gdb/bfd/config.bfd deleted file mode 100644 index 7757d5f..0000000 --- a/contrib/gdb/bfd/config.bfd +++ /dev/null @@ -1,491 +0,0 @@ -# config.bfd -# Convert a canonical host type into a BFD host type. -# Set shell variable targ to canonical target name, and run -# using ``. config.bfd''. -# Sets the following shell variables: -# targ_defvec Default vector for this target -# targ_selvecs Vectors to build for this target -# targ_archs Architectures for this target -# targ_cflags $(CFLAGS) for this target (FIXME: pretty bogus) -# targ_undercore Whether underscores are used: yes or no - -# The binutils c++filt program wants to know whether underscores are -# stripped or not. That is why we set targ_underscore. c++filt uses -# this information to choose a default. This information is -# duplicated in the symbol_leading_char field of the BFD target -# vector, but c++filt does not deal with object files and is not -# linked against libbfd.a. It is not terribly important that c++filt -# get this right; it is just convenient. - -targ_defvec= -targ_selvecs= -targ_cflags= -targ_underscore=no - -targ_cpu=`echo $targ | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'` -case "${targ_cpu}" in -arm*) targ_archs=bfd_arm_arch ;; -hppa*) targ_archs=bfd_hppa_arch ;; -i[345]86) targ_archs=bfd_i386_arch ;; -m68*) targ_archs=bfd_m68k_arch ;; -m88*) targ_archs=bfd_m88k_arch ;; -mips*) targ_archs=bfd_mips_arch ;; -powerpc*) targ_archs="bfd_rs6000_arch bfd_powerpc_arch" ;; -rs6000) targ_archs="bfd_rs6000_arch bfd_powerpc_arch" ;; -sparc*) targ_archs=bfd_sparc_arch ;; -z8k*) targ_archs=bfd_z8k_arch ;; -*) targ_archs=bfd_${targ_cpu}_arch ;; -esac - -# WHEN ADDING ENTRIES TO THIS MATRIX: -# Make sure that the left side always has two dashes. Otherwise you -# can get spurious matches. Even for unambiguous cases, do this as a -# convention, else the table becomes a real mess to understand and maintain. - -case "${targ}" in - alpha-*-netware*) - targ_defvec=ecoffalpha_little_vec - targ_selvecs=nlm32_alpha_vec - ;; - alpha-*-*) - targ_defvec=ecoffalpha_little_vec - ;; - - - arm-*-riscix*) - targ_defvec=riscix_vec - ;; - arm-*-pe*) - targ_defvec=armpe_little_vec - targ_selvecs="armpe_little_vec armpe_big_vec armpei_little_vec armpei_big_vec" - targ_underscore=yes - ;; - arm-*-aout | armel-*-aout) - targ_defvec=aout_arm_little_vec - targ_selvecs=aout_arm_big_vec - ;; - armeb-*-aout) - targ_defvec=aout_arm_big_vec - targ_selvecs=aout_arm_little_vec - ;; - arm-*-coff) - targ_defvec=armcoff_little_vec - targ_selvecs=armcoff_big_vec - targ_underscore=yes - ;; - - a29k-*-ebmon* | a29k-*-udi* | a29k-*-coff* | a29k-*-sym1* | \ - a29k-*-vxworks* | a29k-*-sysv*) - targ_defvec=a29kcoff_big_vec - targ_selvecs=sunos_big_vec - targ_underscore=yes - ;; - a29k-*-aout* | a29k-*-bsd* | a29k-*-vsta*) - targ_defvec=sunos_big_vec - targ_underscore=yes - ;; - - h8300*-*-*) - targ_defvec=h8300coff_vec - targ_underscore=yes - ;; - - h8500-*-*) - targ_defvec=h8500coff_vec - targ_underscore=yes - ;; - - sh-*-*) - targ_defvec=shcoff_vec - targ_selvecs="shcoff_vec shlcoff_vec" - targ_underscore=yes - ;; - - hppa*-*-*elf* | hppa*-*-lites* | hppa*-*-sysv4*) - targ_defvec=bfd_elf32_hppa_vec - ;; - hppa*-*-bsd*) - targ_defvec=som_vec - targ_selvecs=bfd_elf32_hppa_vec - ;; - hppa*-*-hpux* | hppa*-*-hiux*) - targ_defvec=som_vec - ;; - hppa*-*-osf*) - targ_defvec=som_vec - targ_selvecs=bfd_elf32_hppa_vec - ;; - - i[345]86-*-sysv4* | i[345]86-*-unixware | i[345]86-*-solaris2* | \ - i[345]86-*-elf | i[345]86-*-sco*elf*) - targ_defvec=bfd_elf32_i386_vec - targ_selvecs=i386coff_vec - ;; - i[345]86-*-sysv* | i[345]86-*-isc* | i[345]86-*-sco* | i[345]86-*-coff | \ - i[345]86-*-aix* | i[345]86-*-go32*) - targ_defvec=i386coff_vec - ;; - i[345]86-sequent-bsd*) - targ_defvec=i386dynix_vec - targ_underscore=yes - ;; - i[345]86-*-bsd*) - targ_defvec=i386bsd_vec - targ_underscore=yes - ;; - i[345]86-*-freebsd*) - targ_defvec=i386freebsd_vec - targ_selvecs=i386bsd_vec - targ_underscore=yes - ;; - i[345]86-*-netbsd*) - targ_defvec=i386netbsd_vec - targ_selvecs=i386bsd_vec - targ_underscore=yes - ;; - i[345]86-*-netware*) - targ_defvec=bfd_elf32_i386_vec - targ_selvecs="nlm32_i386_vec i386coff_vec i386aout_vec" - ;; - i[345]86-*-linuxaout*) - targ_defvec=i386linux_vec - targ_selvecs=bfd_elf32_i386_vec - targ_underscore=yes - ;; - i[345]86-*-linux*) - targ_defvec=bfd_elf32_i386_vec - targ_selvecs=i386linux_vec - targ_underscore=yes - ;; - i[345]86-*-lynxos*) - targ_defvec=i386lynx_coff_vec - targ_selvecs=i386lynx_aout_vec - ;; - i[345]86-*-gnu*) - targ_defvec=bfd_elf32_i386_vec - targ_selvecs=i386mach3_vec - targ_cflags=-DSTAT_FOR_EXEC - targ_underscore=yes - ;; - i[345]86-*-mach* | i[345]86-*-osf1mk*) - targ_defvec=i386mach3_vec - targ_cflags=-DSTAT_FOR_EXEC - targ_underscore=yes - ;; - i[345]86-*-os9k) - targ_defvec=i386os9k_vec - ;; - i[345]86-*-msdos*) - targ_defvec=i386aout_vec - targ_selvecs=i386msdos_vec - ;; - i[345]86-*-moss*) - targ_defvec=bfd_elf32_i386_vec - targ_selvecs="i386msdos_vec i386aout_vec" - ;; - i[345]86-*-cygwin32 | i[345]86-*-winnt | i[345]86-*-pe) - targ_defvec=i386pe_vec - targ_selvecs="i386pe_vec i386pei_vec" - ;; - i[345]86-none-*) - targ_defvec=i386coff_vec - ;; - i[345]86-*-aout* | i[345]86*-*-vsta*) - targ_defvec=i386aout_vec - ;; - - i860-*-mach3* | i860-*-osf1* | i860-*-coff*) - targ_defvec=i860coff_vec - ;; - i860-*-sysv4* | i860-*-elf*) - targ_defvec=bfd_elf32_i860_vec - ;; - - i960-*-vxworks4* | i960-*-vxworks5.0) - targ_defvec=b_out_vec_little_host - targ_selvecs="b_out_vec_big_host icoff_little_vec icoff_big_vec" - targ_underscore=yes - ;; - i960-*-vxworks5.* | i960-*-coff* | i960-*-sysv*) - targ_defvec=icoff_little_vec - targ_selvecs="icoff_big_vec b_out_vec_little_host b_out_vec_big_host" - targ_underscore=yes - ;; - i960-*-vxworks* | i960-*-aout* | i960-*-bout* | i960-*-nindy*) - targ_defvec=b_out_vec_little_host - targ_selvecs="b_out_vec_big_host icoff_little_vec icoff_big_vec" - targ_underscore=yes - ;; - - m68*-apollo-*) - targ_defvec=apollocoff_vec - ;; - m68*-bull-sysv*) - targ_defvec=m68kcoffun_vec - targ_underscore=yes - ;; - m68*-hp-bsd*) - targ_defvec=hp300bsd_vec - targ_underscore=yes - ;; - m68*-*-aout*) - targ_defvec=aout0_big_vec - # We include this here, rather than making a separate cisco - # configuration, so that cisco-core.c gets routinely tested at - # least for compilation. - targ_selvecs=cisco_core_vec - targ_underscore=yes - ;; - m68*-*-elf* | m68*-*-sysv4*) - targ_defvec=bfd_elf32_m68k_vec - targ_selvecs=m68kcoff_vec - ;; - m68*-*-coff* | m68*-*-sysv*) - targ_defvec=m68kcoff_vec - targ_selvecs="m68kcoff_vec versados_vec" - ;; - m68*-*-hpux*) - targ_defvec=hp300hpux_vec - targ_underscore=yes - ;; - m68*-*-linuxaout*) - targ_defvec=m68klinux_vec - targ_selvecs=bfd_elf32_m68k_vec - targ_underscore=yes - ;; - m68*-*-linux*) - targ_defvec=bfd_elf32_m68k_vec - targ_selvecs=m68klinux_vec - ;; - m68*-*-lynxos*) - targ_defvec=m68klynx_coff_vec - targ_selvecs=m68klynx_aout_vec - ;; - m68*-hp*-netbsd*) - targ_defvec=m68k4knetbsd_vec - targ_selvecs="m68knetbsd_vec hp300bsd_vec sunos_big_vec" - targ_underscore=yes - ;; - m68*-*-netbsd*) - targ_defvec=m68knetbsd_vec - targ_selvecs="m68k4knetbsd_vec hp300bsd_vec sunos_big_vec" - targ_underscore=yes - ;; - m68*-*-sunos* | m68*-*-os68k* | m68*-*-vxworks* | m68*-netx-* | \ - m68*-*-bsd* | m68*-*-vsta*) - targ_defvec=sunos_big_vec - targ_underscore=yes - ;; - m68*-ericsson-*) - targ_defvec=sunos_big_vec - targ_selvecs="m68kcoff_vec tekhex_vec" - targ_underscore=yes - ;; - m68*-cbm-*) - targ_defvec=bfd_elf32_m68k_vec - targ_selvecs=m68kcoff_vec - ;; - m68*-apple-aux*) - targ_defvec=m68kaux_coff_vec - ;; - m68*-*-psos*) - targ_defvec=bfd_elf32_m68k_vec - targ_selvecs=ieee_vec - targ_underscore=yes - ;; - - m88*-harris-cxux* | m88*-*-dgux* | m88*-*-sysv4*) - targ_defvec=bfd_elf32_m88k_vec - targ_selvecs=m88kbcs_vec - ;; - m88*-*-mach3*) - targ_defvec=m88kmach3_vec - targ_cflags=-DSTAT_FOR_EXEC - ;; - m88*-*-*) - targ_defvec=m88kbcs_vec - targ_underscore=yes - ;; - - mips*-big-*) - targ_defvec=ecoff_big_vec - targ_selvecs=ecoff_little_vec - ;; - mips-dec-netbsd*) - targ_defvec=bfd_elf32_littlemips_vec - targ_selvecs=bfd_elf32_bigmips_vec - ;; - mips*-dec-bsd*) - targ_defvec=aout_mips_little_vec - targ_underscore=yes - ;; - mips*-dec-mach3*) - targ_defvec=aout_mips_little_vec - targ_cflags=-DSTAT_FOR_EXEC - ;; - mips*-dec-* | mips*el-*-ecoff*) - targ_defvec=ecoff_little_vec - targ_selvecs=ecoff_big_vec - ;; - mips*-*-ecoff*) - targ_defvec=ecoff_big_vec - targ_selvecs=ecoff_little_vec - ;; - mips*-*-irix5*) - targ_defvec=bfd_elf32_bigmips_vec - targ_selvecs="bfd_elf32_littlemips_vec ecoff_big_vec ecoff_little_vec" - ;; - mips*-sgi-* | mips*-*-bsd*) - targ_defvec=ecoff_big_vec - targ_selvecs=ecoff_little_vec - ;; - mips*-*-mach3*) - targ_defvec=aout_mips_little_vec - targ_cflags=-DSTAT_FOR_EXEC - ;; - mips*-*-sysv4*) - targ_defvec=bfd_elf32_bigmips_vec - targ_selvecs="bfd_elf32_littlemips_vec ecoff_big_vec ecoff_little_vec" - ;; - mips*-*-sysv* | mips*-*-riscos*) - targ_defvec=ecoff_big_vec - targ_selvecs=ecoff_little_vec - ;; - mips*el-*-elf*) - targ_defvec=bfd_elf32_littlemips_vec - targ_selvecs=bfd_elf32_bigmips_vec - ;; - mips*-*-elf*) - targ_defvec=bfd_elf32_bigmips_vec - targ_selvecs=bfd_elf32_littlemips_vec - ;; - - ns32k-pc532-mach* | ns32k-pc532-ux*) - targ_defvec=pc532machaout_vec - targ_underscore=yes - ;; - ns32k-*-netbsd* | ns32k-*-lites*) - targ_defvec=pc532netbsd_vec - targ_underscore=yes - ;; - - powerpc-*-aix*) - targ_defvec=rs6000coff_vec - ;; - powerpc-*-elf* | powerpc-*-sysv4* | powerpc-*-eabi* | powerpc-*-solaris2*) - targ_defvec=bfd_elf32_powerpc_vec - targ_selvecs="rs6000coff_vec bfd_elf32_powerpcle_vec bfd_powerpcle_pei_vec bfd_powerpc_pei_vec bfd_powerpcle_pe_vec bfd_powerpc_pe_vec" - ;; - powerpc-*-macos* | powerpc-*-mpw*) - targ_defvec=pmac_xcoff_vec - ;; - powerpc-*-netware*) - targ_defvec=bfd_elf32_powerpc_vec - targ_selvecs="nlm32_powerpc_vec rs6000coff_vec" - ;; - powerpcle-*-elf* | powerpcle-*-sysv4* | powerpcle-*-eabi* | \ - powerpcle-*-solaris2*) - targ_defvec=bfd_elf32_powerpcle_vec - targ_selvecs="rs6000coff_vec bfd_elf32_powerpc_vec bfd_powerpcle_pei_vec bfd_powerpc_pei_vec bfd_powerpcle_pe_vec bfd_powerpc_pe_vec" - ;; - - powerpcle-*-pe | powerpcle-*-winnt* | powerpcle-*-cygwin32) - targ_defvec=bfd_powerpcle_pe_vec - targ_selvecs="bfd_powerpcle_pei_vec bfd_powerpc_pei_vec bfd_powerpcle_pe_vec bfd_powerpc_pe_vec" - ;; - - rs6000-*-*) - targ_defvec=rs6000coff_vec - ;; - - sparc-*-lynxos*) - targ_defvec=sparclynx_coff_vec - targ_selvecs=sparclynx_aout_vec - ;; - sparc-*-netbsd*) - targ_defvec=sparcnetbsd_vec - targ_underscore=yes - ;; - sparc-*-elf* | sparc-*-sysv4* | sparc-*-solaris2*) - targ_defvec=bfd_elf32_sparc_vec - targ_selvecs=sunos_big_vec - ;; - sparc64-*-aout*) - targ_defvec=sunos_big_vec - targ_underscore=yes - ;; - sparc64-*-elf*) - targ_defvec=bfd_elf64_sparc_vec - targ_selvecs=bfd_elf32_sparc_vec - ;; - sparc64-*-solaris2* | sparc64-*-sysv4*) - targ_defvec=bfd_elf32_sparc_vec - # Adding 64 bit support by default causes things like objdump to - # print addresses as 64 bits. - #targ_selvecs=bfd_elf64_sparc_vec - ;; - sparc-*-netware*) - targ_defvec=bfd_elf32_sparc_vec - targ_selvecs="nlm32_sparc_vec sunos_big_vec" - ;; - sparc*-*-coff*) - targ_defvec=sparccoff_vec - ;; - sparc*-*-*) - targ_defvec=sunos_big_vec - targ_underscore=yes - ;; - - tahoe-*-*) - targ_defvec=host_aout_vec - targ_underscore=yes - ;; - - vax-*-vms*) - echo 1>&2 "*** BFD does not support target ${targ}." - echo 1>&2 "*** Look in bfd/config.bfd for supported targets." - exit 1 - ;; - vax-*-*) - targ_defvec=host_aout_vec - targ_underscore=yes - ;; - - we32k-*-*) - targ_defvec=we32kcoff_vec - ;; - - w65-*-*) - targ_defvec=w65_vec - ;; - - z8k*-*-*) - targ_defvec=z8kcoff_vec - targ_underscore=yes - ;; - - *-*-ieee*) - targ_defvec=ieee_vec - ;; - - *-adobe-*) - targ_defvec=a_aout_adobe_vec - targ_underscore=yes - ;; - - *-sony-*) - targ_defvec=newsos3_vec - targ_underscore=yes - ;; - - *-tandem-*) - targ_defvec=m68kcoff_vec - targ_selvecs=ieee_vec - ;; - - *) - echo 1>&2 "*** BFD does not support target ${targ}." - echo 1>&2 "*** Look in bfd/config.bfd for supported targets." - exit 1 - ;; -esac diff --git a/contrib/gdb/bfd/config.in b/contrib/gdb/bfd/config.in deleted file mode 100644 index dd4f968..0000000 --- a/contrib/gdb/bfd/config.in +++ /dev/null @@ -1,67 +0,0 @@ -/* config.in. Generated automatically from configure.in by autoheader. */ - -/* Whether malloc must be declared even if is included. */ -#undef NEED_DECLARATION_MALLOC - -/* Whether free must be declared even if is included. */ -#undef NEED_DECLARATION_FREE - -/* Define if you have a working `mmap' system call. */ -#undef HAVE_MMAP - -/* Define if you can safely include both and . */ -#undef TIME_WITH_SYS_TIME - -/* Do we need to use the b modifier when opening binary files? */ -#undef USE_BINARY_FOPEN - -/* Name of host specific header file to include in trad-core.c. */ -#undef TRAD_HEADER - -/* Define only if is available *and* it defines prstatus_t. */ -#undef HAVE_SYS_PROCFS_H - -/* Do we really want to use mmap if it's available? */ -#undef USE_MMAP - -/* Define if you have the fcntl function. */ -#undef HAVE_FCNTL - -/* Define if you have the getpagesize function. */ -#undef HAVE_GETPAGESIZE - -/* Define if you have the madvise function. */ -#undef HAVE_MADVISE - -/* Define if you have the mprotect function. */ -#undef HAVE_MPROTECT - -/* Define if you have the valloc function. */ -#undef HAVE_VALLOC - -/* Define if you have the header file. */ -#undef HAVE_FCNTL_H - -/* Define if you have the header file. */ -#undef HAVE_STDDEF_H - -/* Define if you have the header file. */ -#undef HAVE_STDLIB_H - -/* Define if you have the header file. */ -#undef HAVE_STRING_H - -/* Define if you have the header file. */ -#undef HAVE_STRINGS_H - -/* Define if you have the header file. */ -#undef HAVE_SYS_FILE_H - -/* Define if you have the header file. */ -#undef HAVE_SYS_TIME_H - -/* Define if you have the header file. */ -#undef HAVE_TIME_H - -/* Define if you have the header file. */ -#undef HAVE_UNISTD_H diff --git a/contrib/gdb/bfd/configure b/contrib/gdb/bfd/configure deleted file mode 100644 index 5db14db..0000000 --- a/contrib/gdb/bfd/configure +++ /dev/null @@ -1,2439 +0,0 @@ -#! /bin/sh - -# Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.8 -# Copyright (C) 1992, 1993, 1994 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 - --enable-64-bit-bfd 64-bit support (on hosts with narrower word sizes)" -ac_help="$ac_help - --enable-targets alternative target configurations" -ac_help="$ac_help - --enable-shared build shared BFD library" -ac_help="$ac_help - --enable-commonbfdlib build shared BFD/opcodes/libiberty library" -ac_help="$ac_help - --with-mmap try using mmap for BFD input files if available" - -# Initialize some variables set by options. -# The variables have the same names as the options, with -# dashes changed to underlines. -build=NONE -cache_file=./config.cache -exec_prefix=NONE -host=NONE -no_create= -nonopt=NONE -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -srcdir= -target=NONE -verbose= -x_includes=NONE -x_libraries=NONE -bindir='${exec_prefix}/bin' -sbindir='${exec_prefix}/sbin' -libexecdir='${exec_prefix}/libexec' -datadir='${prefix}/share' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -libdir='${exec_prefix}/lib' -includedir='${prefix}/include' -oldincludedir='/usr/include' -infodir='${prefix}/info' -mandir='${prefix}/man' - -# Initialize some other variables. -subdirs= -MFLAGS= MAKEFLAGS= - -ac_prev= -for ac_option -do - - # If the previous option needs an argument, assign it. - if test -n "$ac_prev"; then - eval "$ac_prev=\$ac_option" - ac_prev= - continue - fi - - case "$ac_option" in - -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; - *) ac_optarg= ;; - esac - - # Accept the important Cygnus configure options, so we can diagnose typos. - - case "$ac_option" in - - -bindir | --bindir | --bindi | --bind | --bin | --bi) - ac_prev=bindir ;; - -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir="$ac_optarg" ;; - - -build | --build | --buil | --bui | --bu) - ac_prev=build ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build="$ac_optarg" ;; - - -cache-file | --cache-file | --cache-fil | --cache-fi \ - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) - ac_prev=cache_file ;; - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ - | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file="$ac_optarg" ;; - - -datadir | --datadir | --datadi | --datad | --data | --dat | --da) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ - | --da=*) - datadir="$ac_optarg" ;; - - -disable-* | --disable-*) - ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then - { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } - fi - ac_feature=`echo $ac_feature| sed 's/-/_/g'` - eval "enable_${ac_feature}=no" ;; - - -enable-* | --enable-*) - ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then - { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } - fi - ac_feature=`echo $ac_feature| sed 's/-/_/g'` - case "$ac_option" in - *=*) ;; - *) ac_optarg=yes ;; - esac - eval "enable_${ac_feature}='$ac_optarg'" ;; - - -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ - | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ - | --exec | --exe | --ex) - ac_prev=exec_prefix ;; - -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ - | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ - | --exec=* | --exe=* | --ex=*) - exec_prefix="$ac_optarg" ;; - - -gas | --gas | --ga | --g) - # Obsolete; use --with-gas. - with_gas=yes ;; - - -help | --help | --hel | --he) - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat << EOF -Usage: configure [options] [host] -Options: [defaults in brackets after descriptions] -Configuration: - --cache-file=FILE cache test results in FILE - --help print this message - --no-create do not create output files - --quiet, --silent do not print \`checking...' messages - --version print the version of autoconf that created configure -Directory and file names: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [same as prefix] - --bindir=DIR user executables in DIR [EPREFIX/bin] - --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] - --libexecdir=DIR program executables in DIR [EPREFIX/libexec] - --datadir=DIR read-only architecture-independent data in DIR - [PREFIX/share] - --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data in DIR - [PREFIX/com] - --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] - --libdir=DIR object code libraries in DIR [EPREFIX/lib] - --includedir=DIR C header files in DIR [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] - --infodir=DIR info documentation in DIR [PREFIX/info] - --mandir=DIR man documentation in DIR [PREFIX/man] - --srcdir=DIR find the sources in DIR [configure dir or ..] - --program-prefix=PREFIX prepend PREFIX to installed program names - --program-suffix=SUFFIX append SUFFIX to installed program names - --program-transform-name=PROGRAM - run sed PROGRAM on installed program names -EOF - cat << EOF -Host type: - --build=BUILD configure for building on BUILD [BUILD=HOST] - --host=HOST configure for HOST [guessed] - --target=TARGET configure for TARGET [TARGET=HOST] -Features and packages: - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --x-includes=DIR X include files are in DIR - --x-libraries=DIR X library files are in DIR -EOF - if test -n "$ac_help"; then - echo "--enable and --with options recognized:$ac_help" - fi - exit 0 ;; - - -host | --host | --hos | --ho) - ac_prev=host ;; - -host=* | --host=* | --hos=* | --ho=*) - host="$ac_optarg" ;; - - -includedir | --includedir | --includedi | --included | --include \ - | --includ | --inclu | --incl | --inc) - ac_prev=includedir ;; - -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ - | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir="$ac_optarg" ;; - - -infodir | --infodir | --infodi | --infod | --info | --inf) - ac_prev=infodir ;; - -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir="$ac_optarg" ;; - - -libdir | --libdir | --libdi | --libd) - ac_prev=libdir ;; - -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir="$ac_optarg" ;; - - -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ - | --libexe | --libex | --libe) - ac_prev=libexecdir ;; - -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ - | --libexe=* | --libex=* | --libe=*) - libexecdir="$ac_optarg" ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst \ - | --locals | --local | --loca | --loc | --lo) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* \ - | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) - localstatedir="$ac_optarg" ;; - - -mandir | --mandir | --mandi | --mand | --man | --ma | --m) - ac_prev=mandir ;; - -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir="$ac_optarg" ;; - - -nfp | --nfp | --nf) - # Obsolete; use --without-fp. - with_fp=no ;; - - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c) - no_create=yes ;; - - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) - no_recursion=yes ;; - - -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ - | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ - | --oldin | --oldi | --old | --ol | --o) - ac_prev=oldincludedir ;; - -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ - | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ - | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir="$ac_optarg" ;; - - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) - ac_prev=prefix ;; - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix="$ac_optarg" ;; - - -program-prefix | --program-prefix | --program-prefi | --program-pref \ - | --program-pre | --program-pr | --program-p) - ac_prev=program_prefix ;; - -program-prefix=* | --program-prefix=* | --program-prefi=* \ - | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix="$ac_optarg" ;; - - -program-suffix | --program-suffix | --program-suffi | --program-suff \ - | --program-suf | --program-su | --program-s) - ac_prev=program_suffix ;; - -program-suffix=* | --program-suffix=* | --program-suffi=* \ - | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix="$ac_optarg" ;; - - -program-transform-name | --program-transform-name \ - | --program-transform-nam | --program-transform-na \ - | --program-transform-n | --program-transform- \ - | --program-transform | --program-transfor \ - | --program-transfo | --program-transf \ - | --program-trans | --program-tran \ - | --progr-tra | --program-tr | --program-t) - ac_prev=program_transform_name ;; - -program-transform-name=* | --program-transform-name=* \ - | --program-transform-nam=* | --program-transform-na=* \ - | --program-transform-n=* | --program-transform-=* \ - | --program-transform=* | --program-transfor=* \ - | --program-transfo=* | --program-transf=* \ - | --program-trans=* | --program-tran=* \ - | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name="$ac_optarg" ;; - - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - silent=yes ;; - - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) - ac_prev=sbindir ;; - -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ - | --sbi=* | --sb=*) - sbindir="$ac_optarg" ;; - - -sharedstatedir | --sharedstatedir | --sharedstatedi \ - | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ - | --sharedst | --shareds | --shared | --share | --shar \ - | --sha | --sh) - ac_prev=sharedstatedir ;; - -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ - | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ - | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ - | --sha=* | --sh=*) - sharedstatedir="$ac_optarg" ;; - - -site | --site | --sit) - ac_prev=site ;; - -site=* | --site=* | --sit=*) - site="$ac_optarg" ;; - - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir="$ac_optarg" ;; - - -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ - | --syscon | --sysco | --sysc | --sys | --sy) - ac_prev=sysconfdir ;; - -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ - | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir="$ac_optarg" ;; - - -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target="$ac_optarg" ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 2.8" - 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 LANG and LC_ALL to C if already set. -# These must not be set unconditionally because not all systems understand -# e.g. LANG=C (notably SCO). -if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi -if test "${LANG+set}" = set; then LANG=C; export LANG; 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=libbfd.c - -# Find the source files, if location was not specified. -if test -z "$srcdir"; then - ac_srcdir_defaulted=yes - # Try the directory containing this script, then its parent. - ac_prog=$0 - ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` - test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. - srcdir=$ac_confdir - if test ! -r $srcdir/$ac_unique_file; then - srcdir=.. - fi -else - ac_srcdir_defaulted=no -fi -if test ! -r $srcdir/$ac_unique_file; then - if test "$ac_srcdir_defaulted" = yes; then - { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } - else - { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } - fi -fi -srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` - -# Prefer explicitly selected file to automatically selected ones. -if test -z "$CONFIG_SITE"; then - if test "x$prefix" != xNONE; then - CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" - else - CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" - fi -fi -for ac_site_file in $CONFIG_SITE; do - if test -r "$ac_site_file"; then - echo "loading site script $ac_site_file" - . "$ac_site_file" - fi -done - -if test -r "$cache_file"; then - echo "loading cache $cache_file" - . $cache_file -else - echo "creating cache $cache_file" - > $cache_file -fi - -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' - -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 - - - -# Check whether --enable-64-bit-bfd or --disable-64-bit-bfd was given. -if test "${enable_64_bit_bfd+set}" = set; then - enableval="$enable_64_bit_bfd" - case "${enableval}" in - yes) want64=true ;; - no) want64=false ;; - *) { echo "configure: error: bad value ${enableval} for 64-bit-bfd option" 1>&2; exit 1; } ;; -esac -else - want64=false -fi -# Check whether --enable-targets or --disable-targets was given. -if test "${enable_targets+set}" = set; then - enableval="$enable_targets" - case "${enableval}" in - yes | "") { echo "configure: error: enable-targets option must specify target names or 'all'" 1>&2; exit 1; } - ;; - no) enable_targets= ;; - *) enable_targets=$enableval ;; -esac -fi -# Check whether --enable-shared or --disable-shared was given. -if test "${enable_shared+set}" = set; then - enableval="$enable_shared" - case "${enableval}" in - yes) shared=true ;; - no) shared=false ;; - *) { echo "configure: error: bad value ${enableval} for BFD shared option" 1>&2; exit 1; } ;; -esac -fi -# Check whether --enable-commonbfdlib or --disable-commonbfdlib was given. -if test "${enable_commonbfdlib+set}" = set; then - enableval="$enable_commonbfdlib" - case "${enableval}" in - yes) commonbfdlib=true ;; - no) commonbfdlib=false ;; - *) { echo "configure: error: bad value ${enableval} for BFD commonbfdlib option" 1>&2; exit 1; } ;; -esac -fi -# Check whether --with-mmap or --without-mmap was given. -if test "${with_mmap+set}" = set; then - withval="$with_mmap" - case "${withval}" in - yes) want_mmap=true ;; - no) want_mmap=false ;; - *) { echo "configure: error: bad value ${withval} for BFD with-mmap option" 1>&2; exit 1; } ;; -esac -else - want_mmap=false -fi - - - -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 $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 - -host_alias=$host -case "$host_alias" in -NONE) - case $nonopt in - NONE) - if host_alias=`$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=`$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 - -target_alias=$target -case "$target_alias" in -NONE) - case $nonopt in - NONE) target_alias=$host_alias ;; - *) target_alias=$nonopt ;; - esac ;; -esac - -target=`$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 - -build_alias=$build -case "$build_alias" in -NONE) - case $nonopt in - NONE) build_alias=$host_alias ;; - *) build_alias=$nonopt ;; - esac ;; -esac - -build=`$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 -z "$target" ; then - { echo "configure: error: Unrecognized target system type; please check config.sub." 1>&2; exit 1; } -fi -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," - - -host64=false -target64=false - -# host stuff: - -ALLLIBS='$(TARGETLIB)' -PICFLAG= -SHLIB=unused-shlib -SHLINK=unused-shlink -if test "${shared}" = "true"; then - PICFLAG=-fpic - if test "${commonbfdlib}" = "true"; then - ALLLIBS='$(TARGETLIB)' - else - ALLLIBS='$(TARGETLIB) $(SHLIB) $(SHLINK)' - SHLIB=libbfd.so.`sed -e 's/[^0-9]*\([0-9.]*\).*/\1/' ${srcdir}/VERSION` - SHLINK=libbfd.so - fi -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 -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="${IFS}:" - for ac_dir in $PATH; 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 -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="${IFS}:" - ac_prog_rejected=no - for ac_dir in $PATH; 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 - - test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } -fi - -echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then - ac_cv_prog_gcc=yes -else - ac_cv_prog_gcc=no -fi -fi - -echo "$ac_t""$ac_cv_prog_gcc" 1>&6 -if test $ac_cv_prog_gcc = yes; then - GCC=yes - if test "${CFLAGS+set}" != set; then - echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -if eval "test \"`echo '$''{'ac_cv_prog_gcc_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_gcc_g=yes -else - ac_cv_prog_gcc_g=no -fi -rm -f conftest* - -fi - -echo "$ac_t""$ac_cv_prog_gcc_g" 1>&6 - if test $ac_cv_prog_gcc_g = yes; then - CFLAGS="-g -O" - else - CFLAGS="-O" - fi - fi -else - GCC= - test "${CFLAGS+set}" = set || CFLAGS="-g" -fi - - -# Permit host specific settings. -. ${srcdir}/configure.host - - -if test $host != $build; then - ac_tool_prefix=${host_alias}- -else - ac_tool_prefix= -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 -if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$AR"; then - ac_cv_prog_AR="$AR" # Let the user override the test. -else - 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 - ac_cv_prog_AR="${ac_tool_prefix}ar" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_prog_AR" && ac_cv_prog_AR="ar" -fi -fi -AR="$ac_cv_prog_AR" -if test -n "$AR"; then - echo "$ac_t""$AR" 1>&6 -else - echo "$ac_t""no" 1>&6 -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 -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="${IFS}:" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" - break - fi - done - IFS="$ac_save_ifs" -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 - - -if test -z "$ac_cv_prog_RANLIB"; then -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 -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="${IFS}:" - for ac_dir in $PATH; 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 - -else - RANLIB=":" -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 -# 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 -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="${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. - for ac_prog in ginstall installbsd 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. - # OSF/1 installbsd also uses dspmsg, but is usable. - : - 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_DATA" && INSTALL_DATA='${INSTALL} -m 644' - - -if test "${shared}" = "true"; then - if test "${GCC}" != "yes" && test "${shared_non_gcc}" != "yes"; then - echo "configure: warning: BFD --enable-shared only supported when using gcc" 1>&2 - shared=false - ALLLIBS='$(TARGETLIB)' - PICFLAG= - SHLIB=unused-shlib - fi -fi - - - - - - -if test "${commonbfdlib}" = "true"; then - COMMON_SHLIB=yes - PICLIST=piclist -else - COMMON_SHLIB= - PICLIST= -fi - - - - -HOST_64BIT_LONG=0 -if test "x${HOST_64BIT_TYPE}" = "xlong"; then - HOST_64BIT_LONG=1 -fi - - -# If we cannot run a trivial program, we must be cross compiling. -echo $ac_n "checking whether cross-compiling""... $ac_c" 1>&6 -if eval "test \"`echo '$''{'ac_cv_c_cross'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test "$cross_compiling" = yes; then - ac_cv_c_cross=yes -else -cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } -if test -s conftest && (./conftest; exit) 2>/dev/null; then - ac_cv_c_cross=no -else - ac_cv_c_cross=yes -fi -fi -rm -fr conftest* -fi - -echo "$ac_t""$ac_cv_c_cross" 1>&6 -cross_compiling=$ac_cv_c_cross - -# Put a plausible default for CC_FOR_BUILD in Makefile. -if test -z "$CC_FOR_BUILD"; then - if test "x$cross_compiling" = "xno"; then - CC_FOR_BUILD='$(CC)' - else - CC_FOR_BUILD=gcc - fi -fi - - -echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -# 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 < -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1104: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out` -if test -z "$ac_err"; then - : -else - echo "$ac_err" >&5 - rm -rf conftest* - CPP="${CC-cc} -E -traditional-cpp" - cat > conftest.$ac_ext < -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1119: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out` -if test -z "$ac_err"; then - : -else - echo "$ac_err" >&5 - rm -rf conftest* - CPP=/lib/cpp -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 - -for ac_hdr in stddef.h string.h strings.h stdlib.h time.h unistd.h -do -ac_safe=`echo "$ac_hdr" | tr './\055' '___'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1152: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&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 | tr 'abcdefghijklmnopqrstuvwxyz./\055' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ___'` - cat >> confdefs.h <&6 -fi -done - -for ac_hdr in fcntl.h sys/file.h sys/time.h -do -ac_safe=`echo "$ac_hdr" | tr './\055' '___'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1189: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&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 | tr 'abcdefghijklmnopqrstuvwxyz./\055' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ___'` - cat >> confdefs.h <&6 -fi -done - -echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 -if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -#include -#include -int main() { return 0; } -int t() { -struct tm *tp; -; return 0; } -EOF -if { (eval echo configure:1228: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ac_cv_header_time=yes -else - rm -rf conftest* - ac_cv_header_time=no -fi -rm -f conftest* - -fi - -echo "$ac_t""$ac_cv_header_time" 1>&6 -if test $ac_cv_header_time = yes; then - cat >> confdefs.h <<\EOF -#define TIME_WITH_SYS_TIME 1 -EOF - -fi - -for ac_func in fcntl getpagesize -do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -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 < -/* Override any gcc2 internal prototype to avoid an error. */ -char $ac_func(); - -int main() { return 0; } -int t() { - -/* 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:1276: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" -else - 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 <&6 -fi -done - - - -case "${host}" in -i[345]86-*-msdos* | i[345]86-*-go32* | *-*-cygwin32) - cat >> confdefs.h <<\EOF -#define USE_BINARY_FOPEN 1 -EOF - ;; -esac - -echo $ac_n "checking whether malloc must be declared""... $ac_c" 1>&6 -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 < -#ifdef HAVE_STDLIB_H -#include -#endif -#ifdef HAVE_UNISTD_H -#include -#endif -int main() { return 0; } -int t() { -char *(*pfn) = (char *(*)) malloc -; return 0; } -EOF -if { (eval echo configure:1328: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - bfd_cv_decl_needed_malloc=no -else - rm -rf conftest* - bfd_cv_decl_needed_malloc=yes -fi -rm -f conftest* - -fi - -echo "$ac_t""$bfd_cv_decl_needed_malloc" 1>&6 -if test $bfd_cv_decl_needed_malloc = yes; then - bfd_tr_decl=NEED_DECLARATION_`echo malloc | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <&6 -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 < -#ifdef HAVE_STDLIB_H -#include -#endif -#ifdef HAVE_UNISTD_H -#include -#endif -int main() { return 0; } -int t() { -char *(*pfn) = (char *(*)) free -; return 0; } -EOF -if { (eval echo configure:1368: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - bfd_cv_decl_needed_free=no -else - rm -rf conftest* - bfd_cv_decl_needed_free=yes -fi -rm -f conftest* - -fi - -echo "$ac_t""$bfd_cv_decl_needed_free" 1>&6 -if test $bfd_cv_decl_needed_free = yes; then - bfd_tr_decl=NEED_DECLARATION_`echo free | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <> confdefs.h <<\EOF -#define TRAD_HEADER "hosts/alphalinux.h" -EOF - - ;; - alpha*-*-*) COREFILE=osf-core.o ;; - arm-*-riscix) COREFILE=trad-core.o ;; - hppa*-*-hpux*) COREFILE=hpux-core.o ;; - hppa*-*-hiux*) COREFILE=hpux-core.o ;; - hppa*-*-bsd*) COREFILE="hpux-core.o hppabsd-core.o" - COREFLAG="-DHPUX_CORE -DHPPABSD_CORE" ;; - i[345]86-sequent-bsd*) - COREFILE=trad-core.o; - cat >> confdefs.h <<\EOF -#define TRAD_HEADER "hosts/symmetry.h" -EOF - - ;; - i[345]86-sequent-sysv4*) ;; - i[345]86-sequent-sysv*) - COREFILE=trad-core.o - cat >> confdefs.h <<\EOF -#define TRAD_HEADER "hosts/symmetry.h" -EOF - - ;; - i[345]86-*-bsd* | i[345]86-*-freebsd*) - COREFILE=trad-core.o - cat >> confdefs.h <<\EOF -#define TRAD_HEADER "hosts/i386bsd.h" -EOF - - ;; - i[345]86-*-netbsd*) - COREFILE=netbsd-core.o - ;; - i[345]86-esix-sysv3*) - COREFILE=trad-core.o - cat >> confdefs.h <<\EOF -#define TRAD_HEADER "hosts/esix.h" -EOF - - ;; - i[345]86-*-sco* | i[345]86-*-isc*) - COREFILE=trad-core.o - cat >> confdefs.h <<\EOF -#define TRAD_HEADER "hosts/i386sco.h" -EOF - - ;; - i[345]86-*-mach3*) - COREFILE=trad-core.o - cat >> confdefs.h <<\EOF -#define TRAD_HEADER "hosts/i386mach3.h" -EOF - - ;; - i[345]86-*-linux*) - COREFILE=trad-core.o - cat >> confdefs.h <<\EOF -#define TRAD_HEADER "hosts/i386linux.h" -EOF - - ;; - i[345]86-*-isc*) COREFILE=trad-core.o ;; - i[345]86-*-aix*) COREFILE=aix386-core.o ;; - i860-*-mach3* | i860-*-osf1*) - COREFILE=trad-core.o - cat >> confdefs.h <<\EOF -#define TRAD_HEADER "hosts/i860mach3.h" -EOF - - ;; - mips-dec-bsd*) - COREFILE=trad-core.o - cat >> confdefs.h <<\EOF -#define TRAD_HEADER "hosts/mipsbsd.h" -EOF - - ;; - mips-dec-mach3*) - COREFILE=trad-core.o - cat >> confdefs.h <<\EOF -#define TRAD_HEADER "hosts/mipsmach3.h" -EOF - - ;; - mips-*-netbsd*) - COREFILE=netbsd-core.o - ;; - mips-dec-*) - COREFILE=trad-core.o - cat >> confdefs.h <<\EOF -#define TRAD_HEADER "hosts/decstation.h" -EOF - - ;; - mips-sgi-irix4*) COREFILE=irix-core.o ;; - mips-sgi-irix5*) COREFILE=irix-core.o ;; - mips-*-mach3*) - COREFILE=trad-core.o - cat >> confdefs.h <<\EOF -#define TRAD_HEADER "hosts/mipsmach3.h" -EOF - - ;; - mips-*-sysv4*) ;; - mips-*-sysv* | mips-*-riscos*) - COREFILE=trad-core.o - cat >> confdefs.h <<\EOF -#define TRAD_HEADER "hosts/riscos.h" -EOF - - ;; - mips-sony-bsd*) - COREFILE=trad-core.o - cat >> confdefs.h <<\EOF -#define TRAD_HEADER "hosts/news-mips.h" -EOF - - ;; - m68*-bull*-sysv*) - COREFILE=trad-core.o - cat >> confdefs.h <<\EOF -#define TRAD_HEADER "hosts/dpx2.h" -EOF - - ;; - m68*-hp-hpux*) COREFILE=hpux-core.o ;; - m68*-hp-bsd*) - COREFILE=trad-core.o - cat >> confdefs.h <<\EOF -#define TRAD_HEADER "hosts/hp300bsd.h" -EOF - - ;; - m68*-*-linux*) - COREFILE=trad-core.o - cat >> confdefs.h <<\EOF -#define TRAD_HEADER "hosts/m68klinux.h" -EOF - - ;; - m68*-motorola-sysv*) - COREFILE=trad-core.o - cat >> confdefs.h <<\EOF -#define TRAD_HEADER "hosts/delta68.h" -EOF - - ;; - m68*-sony-*) - COREFILE=trad-core.o - cat >> confdefs.h <<\EOF -#define TRAD_HEADER "hosts/news.h" -EOF - - ;; - m68*-*-netbsd*) - COREFILE=netbsd-core.o - ;; - m68*-apple-aux*) - COREFILE=trad-core.o - cat >> confdefs.h <<\EOF -#define TRAD_HEADER "hosts/m68kaux.h" -EOF - - ;; - m88*-*-sysv4*) ;; - m88*-motorola-sysv*) COREFILE=ptrace-core.o ;; - m88*-*-mach3*) - COREFILE=trad-core.o - cat >> confdefs.h <<\EOF -#define TRAD_HEADER "hosts/m88kmach3.h" -EOF - - ;; - ns32k-pc532-mach) - COREFILE=trad-core.o - cat >> confdefs.h <<\EOF -#define TRAD_HEADER "hosts/pc532mach.h" -EOF - - ;; - ns32k-*-netbsd*) - COREFILE=netbsd-core.o - ;; - rs6000-*-lynx*) COREFILE=lynx-core.o ;; - rs6000-*-aix4*) COREFILE=rs6000-core.o ;; - rs6000-*-*) COREFILE=rs6000-core.o ;; - powerpc-*-aix4*) COREFILE=rs6000-core.o ;; - powerpc-*-aix*) COREFILE=rs6000-core.o ;; - sparc-*-netbsd*) - COREFILE=netbsd-core.o - ;; - tahoe-*-*) - COREFILE=trad-core.o - cat >> confdefs.h <<\EOF -#define TRAD_HEADER "hosts/tahoe.h" -EOF - - ;; - vax-*-ultrix2*) - COREFILE=trad-core.o - cat >> confdefs.h <<\EOF -#define TRAD_HEADER "hosts/vaxult2.h" -EOF - - ;; - vax-*-ultrix*) - COREFILE=trad-core.o - cat >> confdefs.h <<\EOF -#define TRAD_HEADER "hosts/vaxult2.h" -EOF - - ;; - vax-*-*) - COREFILE=trad-core.o - cat >> confdefs.h <<\EOF -#define TRAD_HEADER "hosts/vaxbsd.h" -EOF - - ;; - esac - - case "$COREFILE" in - aix386-core.o) COREFLAG=-DAIX386_CORE ;; - hppabsd-core.o) COREFLAG=-DHPPABSD_CORE ;; - hpux-core.o) COREFLAG=-DHPUX_CORE ;; - irix-core.o) COREFLAG=-DIRIX_CORE ;; - lynx-core.o) COREFLAG=-DLYNX_CORE ;; - osf-core.o) COREFLAG=-DOSF_CORE ;; - ptrace-core.o) COREFLAG=-DPTRACE_CORE ;; - rs6000-core.o) COREFLAG="$COREFLAG -DAIX_CORE" ;; - trad-core.o) COREFLAG="$COREFLAG -DTRAD_CORE" ;; - esac - - # The ELF code uses the native to handle core files. - # Define HAVE_SYS_PROCFS_H if the file exists and defines - # prstatus_t. - echo $ac_n "checking for sys/procfs.h""... $ac_c" 1>&6 - if eval "test \"`echo '$''{'bfd_cv_header_sys_procfs_h'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -int main() { return 0; } -int t() { -prstatus_t t; -; return 0; } -EOF -if { (eval echo configure:1648: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - bfd_cv_header_sys_procfs_h=yes -else - rm -rf conftest* - bfd_cv_header_sys_procfs_h=no -fi -rm -f conftest* - -fi - - echo "$ac_t""$bfd_cv_header_sys_procfs_h" 1>&6 - if test $bfd_cv_header_sys_procfs_h = yes; then - cat >> confdefs.h <<\EOF -#define HAVE_SYS_PROCFS_H 1 -EOF - - fi - -fi - - - -# target stuff: - -# Canonicalize the secondary target names. -if test -n "$enable_targets" ; then - for targ in `echo $enable_targets | sed 's/,/ /g'` - do - result=`$ac_config_sub $targ 2>/dev/null` - if test -n "$result" ; then - canon_targets="$canon_targets $result" - else - # Allow targets that config.sub doesn't recognize, like "all". - canon_targets="$canon_targets $targ" - fi - done -fi - -all_targets=false -defvec= -selvecs= -selarchs= -TDEFINES= -for targ in $target $canon_targets -do - if test "x$targ" = "xall"; then - all_targets=true - else - . $srcdir/config.bfd - if test "x$targ" = "x$target"; then - defvec=$targ_defvec - fi - selvecs="$selvecs $targ_defvec $targ_selvecs" - selarchs="$selarchs $targ_archs" - TDEFINES="$TDEFINES $targ_cflags" - fi -done - - -# This processing still needs to be done if we're to decide properly whether -# 64-bit support needs to be compiled in. Currently, it will be included if -# the default or any other explicitly requested target requires it; it -# will not be included on a 32-bit host if no 64-bit target is requested, and -# no "--with-64-bit-bfd" option is given, even if "--with-targets=all" is -# used. - -# uniq the default and selected vectors in all the configured targets. -f="" -for i in $selvecs ; do - case " $f " in - *" $i "*) ;; - *) f="$f $i" ;; - esac -done -selvecs="$f" - -# uniq the architectures in all the configured targets. -f="" -for i in $selarchs ; do - case " $f " in - *" $i "*) ;; - *) f="$f $i" ;; - esac -done -selarchs="$f" - -# Target backend .o files. -tb= - -elf="elf.o elflink.o" - -for vec in $selvecs -do - case "$vec" in - # This list is alphabetized to make it easy to compare - # with the two vector lists in targets.c. - a29kcoff_big_vec) tb="$tb coff-a29k.o cofflink.o" ;; - a_out_adobe_vec) tb="$tb aout-adobe.o aout32.o" ;; - armcoff_little_vec) tb="$tb coff-arm.o cofflink.o " ;; - armcoff_big_vec) tb="$tb coff-arm.o cofflink.o " ;; - armpe_little_vec) tb="$tb pe-arm.o cofflink.o " ;; - armpe_big_vec) tb="$tb pe-arm.o cofflink.o " ;; - armpei_little_vec) tb="$tb pei-arm.o cofflink.o " ;; - armpei_big_vec) tb="$tb pei-arm.o cofflink.o " ;; - aout0_big_vec) tb="$tb aout0.o aout32.o" ;; - aout_arm_big_vec) tb="$tb aout-arm.o aout32.o" ;; - aout_arm_little_vec) tb="$tb aout-arm.o aout32.o" ;; - aout_mips_big_vec) tb="$tb mipsbsd.o aout32.o" ;; - aout_mips_little_vec) tb="$tb mipsbsd.o aout32.o" ;; - apollocoff_vec) tb="$tb coff-apollo.o" ;; - b_out_vec_big_host) tb="$tb bout.o aout32.o" ;; - b_out_vec_little_host) tb="$tb bout.o aout32.o" ;; - bfd_elf32_big_generic_vec) tb="$tb elf32-gen.o elf32.o $elf" ;; - bfd_elf32_bigmips_vec) tb="$tb elf32-mips.o elf32.o $elf ecofflink.o" ;; - bfd_elf32_hppa_vec) tb="$tb elf32-hppa.o elf32.o $elf" ;; - bfd_elf32_i386_vec) tb="$tb elf32-i386.o elf32.o $elf" ;; - bfd_elf32_i860_vec) tb="$tb elf32-i860.o elf32.o $elf" ;; - bfd_elf32_little_generic_vec) tb="$tb elf32-gen.o elf32.o $elf" ;; - bfd_elf32_littlemips_vec) tb="$tb elf32-mips.o elf32.o $elf ecofflink.o" ;; - bfd_elf32_m68k_vec) tb="$tb elf32-m68k.o elf32.o $elf" ;; - bfd_elf32_m88k_vec) tb="$tb elf32-m88k.o elf32.o $elf" ;; - bfd_elf32_powerpc_vec) tb="$tb elf32-ppc.o elf32.o $elf" ;; - bfd_elf32_powerpcle_vec) tb="$tb elf32-ppc.o elf32.o $elf" ;; - bfd_elf32_sparc_vec) tb="$tb elf32-sparc.o elf32.o $elf" ;; - bfd_elf64_big_generic_vec) tb="$tb elf64-gen.o elf64.o $elf" - target64=true ;; - bfd_elf64_little_generic_vec) tb="$tb elf64-gen.o elf64.o $elf" - target64=true ;; - bfd_elf64_sparc_vec) tb="$tb elf64-sparc.o elf64.o $elf" - target64=true ;; - cisco_core_vec) tb="$tb cisco-core.o" ;; - demo_64_vec) tb="$tb demo64.o aout64.o" - target64=true ;; - ecoff_big_vec) tb="$tb coff-mips.o ecoff.o ecofflink.o" ;; - ecoff_little_vec) tb="$tb coff-mips.o ecoff.o ecofflink.o" ;; - ecoffalpha_little_vec) tb="$tb coff-alpha.o ecoff.o ecofflink.o" - target64=true ;; - h8300coff_vec) tb="$tb coff-h8300.o reloc16.o" ;; - h8500coff_vec) tb="$tb coff-h8500.o reloc16.o" ;; - host_aout_vec) tb="$tb host-aout.o aout32.o" ;; - hp300bsd_vec) tb="$tb hp300bsd.o aout32.o" ;; - hp300hpux_vec) tb="$tb hp300hpux.o aout32.o" ;; - i386aout_vec) tb="$tb i386aout.o aout32.o" ;; - i386bsd_vec) tb="$tb i386bsd.o aout32.o" ;; - i386coff_vec) tb="$tb coff-i386.o cofflink.o" ;; - i386dynix_vec) tb="$tb i386dynix.o aout32.o" ;; - i386freebsd_vec) tb="$tb i386freebsd.o aout32.o" ;; - i386msdos_vec) tb="$tb i386msdos.o" ;; - i386pe_vec) tb="$tb pe-i386.o cofflink.o " ;; - i386pei_vec) tb="$tb pei-i386.o cofflink.o" ;; - i386linux_vec) tb="$tb i386linux.o aout32.o" ;; - i386lynx_aout_vec) tb="$tb i386lynx.o lynx-core.o aout32.o" ;; - i386lynx_coff_vec) tb="$tb cf-i386lynx.o cofflink.o lynx-core.o" ;; - i386mach3_vec) tb="$tb i386mach3.o aout32.o" ;; - i386netbsd_vec) tb="$tb i386netbsd.o aout32.o" ;; - i386os9k_vec) tb="$tb i386os9k.o aout32.o" ;; - i860coff_vec) tb="$tb coff-i860.o cofflink.o" ;; - icoff_big_vec) tb="$tb coff-i960.o cofflink.o" ;; - icoff_little_vec) tb="$tb coff-i960.o cofflink.o" ;; - ieee_vec) tb="$tb ieee.o" ;; - m68kcoff_vec) tb="$tb coff-m68k.o cofflink.o" ;; - m68kcoffun_vec) tb="$tb coff-u68k.o coff-m68k.o cofflink.o" ;; - m68klinux_vec) tb="$tb m68klinux.o aout32.o" ;; - m68klynx_aout_vec) tb="$tb m68klynx.o lynx-core.o aout32.o" ;; - m68klynx_coff_vec) tb="$tb cf-m68klynx.o coff-m68k.o cofflink.o lynx-core.o" ;; - m68knetbsd_vec) tb="$tb m68knetbsd.o aout32.o" ;; - m68k4knetbsd_vec) tb="$tb m68k4knetbsd.o aout32.o" ;; - m68kaux_coff_vec) tb="$tb coff-aux.o coff-m68k.o cofflink.o" ;; - m88kbcs_vec) tb="$tb coff-m88k.o" ;; - newsos3_vec) tb="$tb newsos3.o aout32.o" ;; - nlm32_i386_vec) tb="$tb nlm32-i386.o nlm32.o nlm.o" ;; - nlm32_sparc_vec) tb="$tb nlm32-sparc.o nlm32.o nlm.o" ;; - nlm32_alpha_vec) tb="$tb nlm32-alpha.o nlm32.o nlm.o" - target64=true ;; - riscix_vec) tb="$tb aout32.o riscix.o" ;; - nlm32_powerpc_vec) tb="$tb nlm32-ppc.o nlm32.o nlm.o" ;; - pc532netbsd_vec) tb="$tb ns32knetbsd.o aout-ns32k.o" ;; - pc532machaout_vec) tb="$tb pc532-mach.o aout-ns32k.o" ;; - pmac_xcoff_vec) tb="$tb coff-pmac.o xcofflink.o" ;; - rs6000coff_vec) tb="$tb coff-rs6000.o xcofflink.o" ;; - bfd_powerpc_pe_vec) tb="$tb pe-ppc.o cofflink.o" ;; - bfd_powerpcle_pe_vec) tb="$tb pe-ppc.o cofflink.o" ;; - bfd_powerpc_pei_vec) tb="$tb pei-ppc.o cofflink.o" ;; - bfd_powerpcle_pei_vec) tb="$tb pei-ppc.o cofflink.o" ;; - shcoff_vec) tb="$tb coff-sh.o cofflink.o" ;; - shlcoff_vec) tb="$tb coff-sh.o cofflink.o" ;; - som_vec) tb="$tb som.o" ;; - sparclynx_aout_vec) tb="$tb sparclynx.o lynx-core.o aout32.o" ;; - sparclynx_coff_vec) tb="$tb cf-sparclynx.o lynx-core.o" ;; - sparcnetbsd_vec) tb="$tb sparcnetbsd.o aout32.o" ;; - sparccoff_vec) tb="$tb coff-sparc.o" ;; - srec_vec) tb="$tb srec.o" ;; - sunos_big_vec) tb="$tb sunos.o aout32.o" ;; - symbolsrec_vec) tb="$tb srec.o" ;; - tekhex_vec) tb="$tb tekhex.o" ;; - we32kcoff_vec) tb="$tb coff-we32k.o" ;; - z8kcoff_vec) tb="$tb coff-z8k.o reloc16.o" ;; - w65_vec) tb="$tb coff-w65.o reloc16.o" ;; - versados_vec) tb="$tb versados.o" ;; - - "") ;; - *) { echo "configure: error: *** unknown target vector $vec" 1>&2; exit 1; } ;; - esac -done - -# Target architecture .o files. -ta=`echo $selarchs | sed -e s/bfd_/cpu-/g -e s/_arch/.o/g` - -# Weed out duplicate .o files. -f="" -for i in $tb ; do - case " $f " in - *" $i "*) ;; - *) f="$f $i" ;; - esac -done -tb="$f" - -f="" -for i in $ta ; do - case " $f " in - *" $i "*) ;; - *) f="$f $i" ;; - esac -done -ta="$f" - -bfd_backends="$tb" -bfd_machines="$ta" - -if test x${all_targets} = xtrue ; then - bfd_backends="${bfd_backends}"' $(ALL_BACKENDS)' - bfd_machines="${bfd_machines}"' $(ALL_MACHINES)' - selvecs= - selarchs= -else # all_targets is true - # Only set these if they will be nonempty, for the clever echo. - test -n "$selvecs" && - selvecs=`echo $selvecs | sed -e 's/^/\&/' -e 's/ \(.\)/,\&\1/g'` - test -n "$selarchs" && - selarchs=`echo $selarchs | sed -e 's/^/\&/' -e 's/ \(.\)/,\&\1/g'` -fi # all_targets is true - -case ${host64}-${target64}-${want64} in - *true*) - wordsize=64 - all_backends='$(BFD64_BACKENDS) $(BFD32_BACKENDS)' - ;; - false-false-false) - wordsize=32 - all_backends='$(BFD32_BACKENDS)' - ;; -esac - - - - - - -tdefaults="" -test -n "${defvec}" && tdefaults="${tdefaults} -DDEFAULT_VECTOR=${defvec}" -test -n "${selvecs}" && tdefaults="${tdefaults} -DSELECT_VECS='${selvecs}'" -test -n "${selarchs}" && tdefaults="${tdefaults} -DSELECT_ARCHITECTURES='${selarchs}'" - - -for ac_func in valloc getpagesize -do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -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 < -/* Override any gcc2 internal prototype to avoid an error. */ -char $ac_func(); - -int main() { return 0; } -int t() { - -/* 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:1950: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" -else - 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 <&6 -fi -done - -echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -if eval "test \"`echo '$''{'ac_cv_func_mmap'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test "$cross_compiling" = yes; then - ac_cv_func_mmap=no -else -cat > conftest.$ac_ext < -#include -#include - -#ifndef HAVE_GETPAGESIZE -# include -# ifdef EXEC_PAGESIZE -# define getpagesize() EXEC_PAGESIZE -# else -# ifdef NBPG -# define getpagesize() NBPG * CLSIZE -# ifndef CLSIZE -# define CLSIZE 1 -# endif -# else -# ifdef NBPC -# define getpagesize() NBPC -# else -# define getpagesize() PAGESIZE /* SVR4 */ -# endif -# endif -# endif -#endif - -#ifndef HAVE_VALLOC -# define valloc malloc -#endif - -#ifdef __cplusplus -extern "C" { void *valloc(unsigned), *malloc(unsigned); } -#else -char *valloc(), *malloc(); -#endif - -int -main() -{ - char *buf1, *buf2, *buf3; - int i = getpagesize(), j; - int i2 = i * 2; - int fd; - - buf1 = (char *)valloc(i2); - buf2 = (char *)valloc(i); - buf3 = (char *)malloc(i2); - for (j = 0; j < i2; ++j) - *(buf1 + j) = rand(); - fd = open("conftestmmap", O_CREAT | O_RDWR, 0666); - write(fd, buf1, i2); - mmap(buf2, i, PROT_READ | PROT_WRITE, MAP_FIXED | MAP_PRIVATE, fd, 0); - for (j = 0; j < i; ++j) - if (*(buf1 + j) != *(buf2 + j)) - exit(1); - lseek(fd, (long)i, 0); - read(fd, buf2, i); /* read into mapped memory -- file should not change */ - /* (it does in i386 SVR4.0 - Jim Avera, jima@netcom.com) */ - lseek(fd, (long)0, 0); - read(fd, buf3, i2); - for (j = 0; j < i2; ++j) - if (*(buf1 + j) != *(buf3 + j)) - exit(1); - exit(0); -} - -EOF -{ (eval echo configure:2049: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } -if test -s conftest && (./conftest; exit) 2>/dev/null; then - ac_cv_func_mmap=yes -else - ac_cv_func_mmap=no -fi -fi -rm -fr conftest* -fi - -echo "$ac_t""$ac_cv_func_mmap" 1>&6 -if test $ac_cv_func_mmap = yes; then - cat >> confdefs.h <<\EOF -#define HAVE_MMAP 1 -EOF - -fi - -for ac_func in madvise mprotect -do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -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 < -/* Override any gcc2 internal prototype to avoid an error. */ -char $ac_func(); - -int main() { return 0; } -int t() { - -/* 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:2096: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" -else - 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 <&6 -fi -done - -case ${want_mmap}+${ac_cv_func_mmap} in - true+yes ) cat >> confdefs.h <<\EOF -#define USE_MMAP 1 -EOF - ;; -esac - -rm -f doc/config.status -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 -# 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 | - sed -n "s/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=\${\1='\2'}/p" \ - >> 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 </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.8" - 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 doc/Makefile config.h:config.in" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 -EOF -cat >> $CONFIG_STATUS < conftest.subs <<\\CEOF -$ac_vpsub -$extrasub -s%@CFLAGS@%$CFLAGS%g -s%@CPPFLAGS@%$CPPFLAGS%g -s%@CXXFLAGS@%$CXXFLAGS%g -s%@DEFS@%$DEFS%g -s%@LDFLAGS@%$LDFLAGS%g -s%@LIBS@%$LIBS%g -s%@exec_prefix@%$exec_prefix%g -s%@prefix@%$prefix%g -s%@program_transform_name@%$program_transform_name%g -s%@bindir@%$bindir%g -s%@sbindir@%$sbindir%g -s%@libexecdir@%$libexecdir%g -s%@datadir@%$datadir%g -s%@sysconfdir@%$sysconfdir%g -s%@sharedstatedir@%$sharedstatedir%g -s%@localstatedir@%$localstatedir%g -s%@libdir@%$libdir%g -s%@includedir@%$includedir%g -s%@oldincludedir@%$oldincludedir%g -s%@infodir@%$infodir%g -s%@mandir@%$mandir%g -s%@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%@HDEFINES@%$HDEFINES%g -s%@AR@%$AR%g -s%@RANLIB@%$RANLIB%g -s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g -s%@INSTALL_DATA@%$INSTALL_DATA%g -s%@ALLLIBS@%$ALLLIBS%g -s%@PICFLAG@%$PICFLAG%g -s%@SHLIB@%$SHLIB%g -s%@SHLIB_CC@%$SHLIB_CC%g -s%@SHLIB_CFLAGS@%$SHLIB_CFLAGS%g -s%@COMMON_SHLIB@%$COMMON_SHLIB%g -s%@PICLIST@%$PICLIST%g -s%@SHLINK@%$SHLINK%g -s%@HOST_64BIT_LONG@%$HOST_64BIT_LONG%g -s%@CC_FOR_BUILD@%$CC_FOR_BUILD%g -s%@CPP@%$CPP%g -s%@COREFILE@%$COREFILE%g -s%@COREFLAG@%$COREFLAG%g -s%@TDEFINES@%$TDEFINES%g -s%@wordsize@%$wordsize%g -s%@all_backends@%$all_backends%g -s%@bfd_backends@%$bfd_backends%g -s%@bfd_machines@%$bfd_machines%g -s%@tdefaults@%$tdefaults%g - -CEOF -EOF -cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF -for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then - # Support "outfile[: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 relative srcdir, etc. 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 - sed -e "$ac_comsub -s%@configure_input@%$configure_input%g -s%@srcdir@%$srcdir%g -s%@top_srcdir@%$top_srcdir%g -s%@INSTALL@%$INSTALL%g -" -f conftest.subs $ac_given_srcdir/$ac_file_in > $ac_file -fi; done -rm -f conftest.subs - -# 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' - -CONFIG_HEADERS=${CONFIG_HEADERS-"config.h:config.in"} -for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then - # Support "outfile[: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 - cp $ac_given_srcdir/$ac_file_in 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. -# Maximum number of lines to put in a single here document. -ac_max_here_lines=12 - -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 <> $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 - rm -f $ac_file - mv conftest.h $ac_file - fi -fi; done - - -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/contrib/gdb/bfd/configure.host b/contrib/gdb/bfd/configure.host deleted file mode 100644 index 484e5bd..0000000 --- a/contrib/gdb/bfd/configure.host +++ /dev/null @@ -1,128 +0,0 @@ -# This file is a shell script that overrides some of the tools and -# flags used on a host specific basis. - -# Since the "bfd/hosts" directory is shared by the bfd, opcodes, and -# binutils directories (at least), the index to it is also shared. -# This is that index. Each configure.in file should source this file -# in its per-host part. - -# This sets the following shell variables: -# HDEFINES host specific compiler options -# host64 set to true if this is a 64 bit host -# HOST_64BIT_TYPE host 64 bit type -# SHLIB_CC compiler to use when building shared library -# SHLIB_CFLAGS flags to use when building shared library -# PICFLAG may be set to flag to use to compile PIC -# SHLINK may be set to the name to link the shared library to -# ALLLIBS may be set to libraries to build -# HLDFLAGS LDFLAGS specific to the host -# RPATH_ENVVAR environment variable used to find shared libraries - -HDEFINES= -host64=false -HOST_64BIT_TYPE= - -case "${host}" in - -alpha-*-*) host64=true; HOST_64BIT_TYPE=long ;; - -hppa*-*-hpux*) HDEFINES=-DHOST_HPPAHPUX ;; -hppa*-*-hiux*) HDEFINES=-DHOST_HPPAHPUX ;; -hppa*-*-bsd*) HDEFINES=-DHOST_HPPABSD ;; -hppa*-*-osf*) HDEFINES=-DHOST_HPPAOSF ;; - -i[345]86-sequent-bsd*) HDEFINES=-Dshared=genshared ;; -i[345]86-sequent-sysv4*) ;; -i[345]86-sequent-sysv*) HDEFINES=-Dshared=genshared ;; - -mips-dec-netbsd*) ;; -mips-dec-*) HDEFINES="-G 4" ;; -mips-sgi-irix3*) HDEFINES="-G 4" ;; -mips-sgi-irix4*) HDEFINES="-G 4" ;; -mips-*-sysv4*) ;; -mips-*-sysv*) HDEFINES="-G 4" ;; -mips-*-riscos*) HDEFINES="-G 4" ;; - -m68*-hp-hpux*) HDEFINES=-DHOST_HP300HPUX ;; - -esac - -# If we are configuring with --enable-shared, adjust the shared -# library support based on the host. This support must work for both -# the BFD and the opcodes libraries. -HLDFLAGS= -RPATH_ENVVAR=LD_LIBRARY_PATH -SHLIB_CC='$(CC)' -SHLIB_CFLAGS='-shared' -if [ "${shared}" = "true" ]; then - case "${host}" in - hppa*-*-*) picfrag=../config/mh-papic ;; - i[3456]86-*-*) picfrag=../config/mh-x86pic ;; - *-*-*) picfrag=../config/mh-${host_cpu}pic ;; - esac - if [ -f "${picfrag}" ]; then - pic=`sed -n -e 's/^PICFLAG[ ]*=[ ]*\(.*\)$/\1/p' ${picfrag}` - if [ -n "${pic}" ]; then - PICFLAG=${pic} - fi - fi - - case "${host}" in - *-dec-osf*) - # -fpic is not needed on the Alpha. - PICFLAG= - ;; - *-*-hpux*) - # HP/UX uses .sl for shared libraries. - SHLINK=`echo ${SHLINK} | sed -e 's/so$/sl/'` - SHLIB_CFLAGS='-shared $(PICFLAG)' - HLDFLAGS='-Wl,+s,+b,$(libdir)' - RPATH_ENVVAR=SHLIB_PATH - ;; - *-*-irix5*) - # -fpic is not needed on Irix 5. - PICFLAG= - SHLIB_CFLAGS='-shared -Wl,-soname,$(SONAME)' - HLDFLAGS='-Wl,-rpath,$(libdir)' - ;; - *-*-linux*aout*) - ;; - *-*-linux*) - SHLIB_CFLAGS='-shared -Wl,-soname,$(SONAME)' - case "$(libdir)" in - /lib | /usr/lib) ;; - *) HLDFLAGS='-Wl,-rpath,$(libdir)' ;; - esac - ;; - *-*-sysv4* | *-*-solaris*) - SHLIB_CFLAGS='-shared -h $(SONAME)' - HLDFLAGS='-R $(libdir)' - ;; - *-*-sunos*) - # Build a libTARGET-bfd.so.VERSION symlink in the object directory. - ALLLIBS=`echo ${ALLLIBS} | sed -e 's/\$(SHLINK)/stamp-tshlink/'` - ;; - esac -fi - -# On SunOS, if the linker supports the -rpath option, use it to -# prevent ../bfd and ../opcodes from being included in the run time -# search path. -case "${host}" in - *-*-sunos*) - echo 'main () { }' > conftest.c - ${CC} -o conftest -Wl,-rpath= conftest.c >/dev/null 2>conftest.t - if grep 'unrecognized' conftest.t >/dev/null 2>&1; then - : - elif grep 'No such file' conftest.t >/dev/null 2>&1; then - : - elif grep 'do not mix' conftest.t >/dev/null 2>&1; then - : - elif [ "${shared}" = "true" ]; then - HLDFLAGS='-Wl,-rpath=$(libdir)' - else - HLDFLAGS='-Wl,-rpath=' - fi - rm -f conftest.t conftest.c conftest - ;; -esac diff --git a/contrib/gdb/bfd/configure.in b/contrib/gdb/bfd/configure.in deleted file mode 100644 index c8b8de5..0000000 --- a/contrib/gdb/bfd/configure.in +++ /dev/null @@ -1,577 +0,0 @@ -dnl Process this file with autoconf to produce a configure script. -dnl -AC_PREREQ(2.3) -AC_INIT(libbfd.c) - -AC_ARG_ENABLE(64-bit-bfd, -[ --enable-64-bit-bfd 64-bit support (on hosts with narrower word sizes)], -[case "${enableval}" in - yes) want64=true ;; - no) want64=false ;; - *) AC_MSG_ERROR(bad value ${enableval} for 64-bit-bfd option) ;; -esac],[want64=false])dnl -AC_ARG_ENABLE(targets, -[ --enable-targets alternative target configurations], -[case "${enableval}" in - yes | "") AC_ERROR(enable-targets option must specify target names or 'all') - ;; - no) enable_targets= ;; - *) enable_targets=$enableval ;; -esac])dnl -AC_ARG_ENABLE(shared, -[ --enable-shared build shared BFD library], -[case "${enableval}" in - yes) shared=true ;; - no) shared=false ;; - *) AC_MSG_ERROR([bad value ${enableval} for BFD shared option]) ;; -esac])dnl -AC_ARG_ENABLE(commonbfdlib, -[ --enable-commonbfdlib build shared BFD/opcodes/libiberty library], -[case "${enableval}" in - yes) commonbfdlib=true ;; - no) commonbfdlib=false ;; - *) AC_MSG_ERROR([bad value ${enableval} for BFD commonbfdlib option]) ;; -esac])dnl -AC_ARG_WITH(mmap, -[ --with-mmap try using mmap for BFD input files if available], -[case "${withval}" in - yes) want_mmap=true ;; - no) want_mmap=false ;; - *) AC_MSG_ERROR(bad value ${withval} for BFD with-mmap option) ;; -esac],[want_mmap=false])dnl - -AC_CONFIG_HEADER(config.h:config.in) - -AC_CONFIG_AUX_DIR(`cd $srcdir/..;pwd`) -AC_CANONICAL_SYSTEM -if test -z "$target" ; then - AC_MSG_ERROR(Unrecognized target system type; please check config.sub.) -fi -AC_ARG_PROGRAM - -host64=false -target64=false - -# host stuff: - -ALLLIBS='$(TARGETLIB)' -PICFLAG= -SHLIB=unused-shlib -SHLINK=unused-shlink -if test "${shared}" = "true"; then - PICFLAG=-fpic - if test "${commonbfdlib}" = "true"; then - ALLLIBS='$(TARGETLIB)' - else - ALLLIBS='$(TARGETLIB) $(SHLIB) $(SHLINK)' -changequote(,)dnl - SHLIB=libbfd.so.`sed -e 's/[^0-9]*\([0-9.]*\).*/\1/' ${srcdir}/VERSION` -changequote([,])dnl - SHLINK=libbfd.so - fi -fi - -AC_PROG_CC - -# Permit host specific settings. -. ${srcdir}/configure.host - -AC_SUBST(HDEFINES) -AC_CHECK_TOOL(AR, ar) -AC_CHECK_TOOL(RANLIB, ranlib, :) -AC_PROG_INSTALL - -if test "${shared}" = "true"; then - if test "${GCC}" != "yes" && test "${shared_non_gcc}" != "yes"; then - AC_MSG_WARN([BFD --enable-shared only supported when using gcc]) - shared=false - ALLLIBS='$(TARGETLIB)' - PICFLAG= - SHLIB=unused-shlib - fi -fi - -AC_SUBST(ALLLIBS) -AC_SUBST(PICFLAG) -AC_SUBST(SHLIB) -AC_SUBST(SHLIB_CC) -AC_SUBST(SHLIB_CFLAGS) -if test "${commonbfdlib}" = "true"; then - COMMON_SHLIB=yes - PICLIST=piclist -else - COMMON_SHLIB= - PICLIST= -fi -AC_SUBST(COMMON_SHLIB) -AC_SUBST(PICLIST) -AC_SUBST(SHLINK) - -HOST_64BIT_LONG=0 -if test "x${HOST_64BIT_TYPE}" = "xlong"; then - HOST_64BIT_LONG=1 -fi -AC_SUBST(HOST_64BIT_LONG) - -BFD_CC_FOR_BUILD - -AC_CHECK_HEADERS(stddef.h string.h strings.h stdlib.h time.h unistd.h) -AC_CHECK_HEADERS(fcntl.h sys/file.h sys/time.h) -AC_HEADER_TIME -AC_CHECK_FUNCS(fcntl getpagesize) - -BFD_BINARY_FOPEN - -BFD_NEED_DECLARATION(malloc) -BFD_NEED_DECLARATION(free) - -# If we are configured native, pick a core file support file. -COREFILE= -COREFLAG= -if test "${target}" = "${host}"; then - case "${host}" in - alpha*-*-linux*) - COREFILE=trad-core.o - AC_DEFINE(TRAD_HEADER,"hosts/alphalinux.h") - ;; - alpha*-*-*) COREFILE=osf-core.o ;; - arm-*-riscix) COREFILE=trad-core.o ;; - hppa*-*-hpux*) COREFILE=hpux-core.o ;; - hppa*-*-hiux*) COREFILE=hpux-core.o ;; - hppa*-*-bsd*) COREFILE="hpux-core.o hppabsd-core.o" - COREFLAG="-DHPUX_CORE -DHPPABSD_CORE" ;; -changequote(,)dnl - i[345]86-sequent-bsd*) -changequote([,])dnl - COREFILE=trad-core.o; - AC_DEFINE(TRAD_HEADER,"hosts/symmetry.h") - ;; -changequote(,)dnl - i[345]86-sequent-sysv4*) ;; - i[345]86-sequent-sysv*) -changequote([,])dnl - COREFILE=trad-core.o - AC_DEFINE(TRAD_HEADER,"hosts/symmetry.h") - ;; -changequote(,)dnl - i[345]86-*-bsd* | i[345]86-*-freebsd*) -changequote([,])dnl - COREFILE=trad-core.o - AC_DEFINE(TRAD_HEADER,"hosts/i386bsd.h") - ;; -changequote(,)dnl - i[345]86-*-netbsd*) -changequote([,])dnl - COREFILE=netbsd-core.o - ;; -changequote(,)dnl - i[345]86-esix-sysv3*) -changequote([,])dnl - COREFILE=trad-core.o - AC_DEFINE(TRAD_HEADER,"hosts/esix.h") - ;; -changequote(,)dnl - i[345]86-*-sco* | i[345]86-*-isc*) -changequote([,])dnl - COREFILE=trad-core.o - AC_DEFINE(TRAD_HEADER,"hosts/i386sco.h") - ;; -changequote(,)dnl - i[345]86-*-mach3*) -changequote([,])dnl - COREFILE=trad-core.o - AC_DEFINE(TRAD_HEADER,"hosts/i386mach3.h") - ;; -changequote(,)dnl - i[345]86-*-linux*) -changequote([,])dnl - COREFILE=trad-core.o - AC_DEFINE(TRAD_HEADER,"hosts/i386linux.h") - ;; -changequote(,)dnl - i[345]86-*-isc*) COREFILE=trad-core.o ;; - i[345]86-*-aix*) COREFILE=aix386-core.o ;; -changequote([,])dnl - i860-*-mach3* | i860-*-osf1*) - COREFILE=trad-core.o - AC_DEFINE(TRAD_HEADER,"hosts/i860mach3.h") - ;; - mips-dec-bsd*) - COREFILE=trad-core.o - AC_DEFINE(TRAD_HEADER,"hosts/mipsbsd.h") - ;; - mips-dec-mach3*) - COREFILE=trad-core.o - AC_DEFINE(TRAD_HEADER,"hosts/mipsmach3.h") - ;; - mips-*-netbsd*) - COREFILE=netbsd-core.o - ;; - mips-dec-*) - COREFILE=trad-core.o - AC_DEFINE(TRAD_HEADER,"hosts/decstation.h") - ;; - mips-sgi-irix4*) COREFILE=irix-core.o ;; - mips-sgi-irix5*) COREFILE=irix-core.o ;; - mips-*-mach3*) - COREFILE=trad-core.o - AC_DEFINE(TRAD_HEADER,"hosts/mipsmach3.h") - ;; - mips-*-sysv4*) ;; - mips-*-sysv* | mips-*-riscos*) - COREFILE=trad-core.o - AC_DEFINE(TRAD_HEADER,"hosts/riscos.h") - ;; - mips-sony-bsd*) - COREFILE=trad-core.o - AC_DEFINE(TRAD_HEADER,"hosts/news-mips.h") - ;; - m68*-bull*-sysv*) - COREFILE=trad-core.o - AC_DEFINE(TRAD_HEADER,"hosts/dpx2.h") - ;; - m68*-hp-hpux*) COREFILE=hpux-core.o ;; - m68*-hp-bsd*) - COREFILE=trad-core.o - AC_DEFINE(TRAD_HEADER,"hosts/hp300bsd.h") - ;; - m68*-*-linux*) - COREFILE=trad-core.o - AC_DEFINE(TRAD_HEADER,"hosts/m68klinux.h") - ;; - m68*-motorola-sysv*) - COREFILE=trad-core.o - AC_DEFINE(TRAD_HEADER, "hosts/delta68.h") - ;; - m68*-sony-*) - COREFILE=trad-core.o - AC_DEFINE(TRAD_HEADER,"hosts/news.h") - ;; - m68*-*-netbsd*) - COREFILE=netbsd-core.o - ;; - m68*-apple-aux*) - COREFILE=trad-core.o - AC_DEFINE(TRAD_HEADER,"hosts/m68kaux.h") - ;; - m88*-*-sysv4*) ;; - m88*-motorola-sysv*) COREFILE=ptrace-core.o ;; - m88*-*-mach3*) - COREFILE=trad-core.o - AC_DEFINE(TRAD_HEADER,"hosts/m88kmach3.h") - ;; - ns32k-pc532-mach) - COREFILE=trad-core.o - AC_DEFINE(TRAD_HEADER,"hosts/pc532mach.h") - ;; - ns32k-*-netbsd*) - COREFILE=netbsd-core.o - ;; - rs6000-*-lynx*) COREFILE=lynx-core.o ;; - rs6000-*-aix4*) COREFILE=rs6000-core.o ;; - rs6000-*-*) COREFILE=rs6000-core.o ;; - powerpc-*-aix4*) COREFILE=rs6000-core.o ;; - powerpc-*-aix*) COREFILE=rs6000-core.o ;; - sparc-*-netbsd*) - COREFILE=netbsd-core.o - ;; - tahoe-*-*) - COREFILE=trad-core.o - AC_DEFINE(TRAD_HEADER,"hosts/tahoe.h") - ;; - vax-*-ultrix2*) - COREFILE=trad-core.o - AC_DEFINE(TRAD_HEADER,"hosts/vaxult2.h") - ;; - vax-*-ultrix*) - COREFILE=trad-core.o - AC_DEFINE(TRAD_HEADER,"hosts/vaxult2.h") - ;; - vax-*-*) - COREFILE=trad-core.o - AC_DEFINE(TRAD_HEADER,"hosts/vaxbsd.h") - ;; - esac - - case "$COREFILE" in - aix386-core.o) COREFLAG=-DAIX386_CORE ;; - hppabsd-core.o) COREFLAG=-DHPPABSD_CORE ;; - hpux-core.o) COREFLAG=-DHPUX_CORE ;; - irix-core.o) COREFLAG=-DIRIX_CORE ;; - lynx-core.o) COREFLAG=-DLYNX_CORE ;; - osf-core.o) COREFLAG=-DOSF_CORE ;; - ptrace-core.o) COREFLAG=-DPTRACE_CORE ;; - rs6000-core.o) COREFLAG="$COREFLAG -DAIX_CORE" ;; - trad-core.o) COREFLAG="$COREFLAG -DTRAD_CORE" ;; - esac - - # The ELF code uses the native to handle core files. - # Define HAVE_SYS_PROCFS_H if the file exists and defines - # prstatus_t. - AC_MSG_CHECKING([for sys/procfs.h]) - AC_CACHE_VAL(bfd_cv_header_sys_procfs_h, - [AC_TRY_COMPILE([#include ], - [prstatus_t t;], - bfd_cv_header_sys_procfs_h=yes, bfd_cv_header_sys_procfs_h=no)]) - AC_MSG_RESULT($bfd_cv_header_sys_procfs_h) - if test $bfd_cv_header_sys_procfs_h = yes; then - AC_DEFINE(HAVE_SYS_PROCFS_H) - fi - -fi -AC_SUBST(COREFILE) -AC_SUBST(COREFLAG) - -# target stuff: - -# Canonicalize the secondary target names. -if test -n "$enable_targets" ; then - for targ in `echo $enable_targets | sed 's/,/ /g'` - do - result=`$ac_config_sub $targ 2>/dev/null` - if test -n "$result" ; then - canon_targets="$canon_targets $result" - else - # Allow targets that config.sub doesn't recognize, like "all". - canon_targets="$canon_targets $targ" - fi - done -fi - -all_targets=false -defvec= -selvecs= -selarchs= -TDEFINES= -for targ in $target $canon_targets -do - if test "x$targ" = "xall"; then - all_targets=true - else - . $srcdir/config.bfd - if test "x$targ" = "x$target"; then - defvec=$targ_defvec - fi - selvecs="$selvecs $targ_defvec $targ_selvecs" - selarchs="$selarchs $targ_archs" - TDEFINES="$TDEFINES $targ_cflags" - fi -done -AC_SUBST(TDEFINES) - -# This processing still needs to be done if we're to decide properly whether -# 64-bit support needs to be compiled in. Currently, it will be included if -# the default or any other explicitly requested target requires it; it -# will not be included on a 32-bit host if no 64-bit target is requested, and -# no "--with-64-bit-bfd" option is given, even if "--with-targets=all" is -# used. - -# uniq the default and selected vectors in all the configured targets. -f="" -for i in $selvecs ; do - case " $f " in - *" $i "*) ;; - *) f="$f $i" ;; - esac -done -selvecs="$f" - -# uniq the architectures in all the configured targets. -f="" -for i in $selarchs ; do - case " $f " in - *" $i "*) ;; - *) f="$f $i" ;; - esac -done -selarchs="$f" - -# Target backend .o files. -tb= - -elf="elf.o elflink.o" - -for vec in $selvecs -do - case "$vec" in - # This list is alphabetized to make it easy to compare - # with the two vector lists in targets.c. - a29kcoff_big_vec) tb="$tb coff-a29k.o cofflink.o" ;; - a_out_adobe_vec) tb="$tb aout-adobe.o aout32.o" ;; - armcoff_little_vec) tb="$tb coff-arm.o cofflink.o " ;; - armcoff_big_vec) tb="$tb coff-arm.o cofflink.o " ;; - armpe_little_vec) tb="$tb pe-arm.o cofflink.o " ;; - armpe_big_vec) tb="$tb pe-arm.o cofflink.o " ;; - armpei_little_vec) tb="$tb pei-arm.o cofflink.o " ;; - armpei_big_vec) tb="$tb pei-arm.o cofflink.o " ;; - aout0_big_vec) tb="$tb aout0.o aout32.o" ;; - aout_arm_big_vec) tb="$tb aout-arm.o aout32.o" ;; - aout_arm_little_vec) tb="$tb aout-arm.o aout32.o" ;; - aout_mips_big_vec) tb="$tb mipsbsd.o aout32.o" ;; - aout_mips_little_vec) tb="$tb mipsbsd.o aout32.o" ;; - apollocoff_vec) tb="$tb coff-apollo.o" ;; - b_out_vec_big_host) tb="$tb bout.o aout32.o" ;; - b_out_vec_little_host) tb="$tb bout.o aout32.o" ;; - bfd_elf32_big_generic_vec) tb="$tb elf32-gen.o elf32.o $elf" ;; - bfd_elf32_bigmips_vec) tb="$tb elf32-mips.o elf32.o $elf ecofflink.o" ;; - bfd_elf32_hppa_vec) tb="$tb elf32-hppa.o elf32.o $elf" ;; - bfd_elf32_i386_vec) tb="$tb elf32-i386.o elf32.o $elf" ;; - bfd_elf32_i860_vec) tb="$tb elf32-i860.o elf32.o $elf" ;; - bfd_elf32_little_generic_vec) tb="$tb elf32-gen.o elf32.o $elf" ;; - bfd_elf32_littlemips_vec) tb="$tb elf32-mips.o elf32.o $elf ecofflink.o" ;; - bfd_elf32_m68k_vec) tb="$tb elf32-m68k.o elf32.o $elf" ;; - bfd_elf32_m88k_vec) tb="$tb elf32-m88k.o elf32.o $elf" ;; - bfd_elf32_powerpc_vec) tb="$tb elf32-ppc.o elf32.o $elf" ;; - bfd_elf32_powerpcle_vec) tb="$tb elf32-ppc.o elf32.o $elf" ;; - bfd_elf32_sparc_vec) tb="$tb elf32-sparc.o elf32.o $elf" ;; - bfd_elf64_big_generic_vec) tb="$tb elf64-gen.o elf64.o $elf" - target64=true ;; - bfd_elf64_little_generic_vec) tb="$tb elf64-gen.o elf64.o $elf" - target64=true ;; - bfd_elf64_sparc_vec) tb="$tb elf64-sparc.o elf64.o $elf" - target64=true ;; - cisco_core_vec) tb="$tb cisco-core.o" ;; - demo_64_vec) tb="$tb demo64.o aout64.o" - target64=true ;; - ecoff_big_vec) tb="$tb coff-mips.o ecoff.o ecofflink.o" ;; - ecoff_little_vec) tb="$tb coff-mips.o ecoff.o ecofflink.o" ;; - ecoffalpha_little_vec) tb="$tb coff-alpha.o ecoff.o ecofflink.o" - target64=true ;; - h8300coff_vec) tb="$tb coff-h8300.o reloc16.o" ;; - h8500coff_vec) tb="$tb coff-h8500.o reloc16.o" ;; - host_aout_vec) tb="$tb host-aout.o aout32.o" ;; - hp300bsd_vec) tb="$tb hp300bsd.o aout32.o" ;; - hp300hpux_vec) tb="$tb hp300hpux.o aout32.o" ;; - i386aout_vec) tb="$tb i386aout.o aout32.o" ;; - i386bsd_vec) tb="$tb i386bsd.o aout32.o" ;; - i386coff_vec) tb="$tb coff-i386.o cofflink.o" ;; - i386dynix_vec) tb="$tb i386dynix.o aout32.o" ;; - i386freebsd_vec) tb="$tb i386freebsd.o aout32.o" ;; - i386msdos_vec) tb="$tb i386msdos.o" ;; - i386pe_vec) tb="$tb pe-i386.o cofflink.o " ;; - i386pei_vec) tb="$tb pei-i386.o cofflink.o" ;; - i386linux_vec) tb="$tb i386linux.o aout32.o" ;; - i386lynx_aout_vec) tb="$tb i386lynx.o lynx-core.o aout32.o" ;; - i386lynx_coff_vec) tb="$tb cf-i386lynx.o cofflink.o lynx-core.o" ;; - i386mach3_vec) tb="$tb i386mach3.o aout32.o" ;; - i386netbsd_vec) tb="$tb i386netbsd.o aout32.o" ;; - i386os9k_vec) tb="$tb i386os9k.o aout32.o" ;; - i860coff_vec) tb="$tb coff-i860.o cofflink.o" ;; - icoff_big_vec) tb="$tb coff-i960.o cofflink.o" ;; - icoff_little_vec) tb="$tb coff-i960.o cofflink.o" ;; - ieee_vec) tb="$tb ieee.o" ;; - m68kcoff_vec) tb="$tb coff-m68k.o cofflink.o" ;; - m68kcoffun_vec) tb="$tb coff-u68k.o coff-m68k.o cofflink.o" ;; - m68klinux_vec) tb="$tb m68klinux.o aout32.o" ;; - m68klynx_aout_vec) tb="$tb m68klynx.o lynx-core.o aout32.o" ;; - m68klynx_coff_vec) tb="$tb cf-m68klynx.o coff-m68k.o cofflink.o lynx-core.o" ;; - m68knetbsd_vec) tb="$tb m68knetbsd.o aout32.o" ;; - m68k4knetbsd_vec) tb="$tb m68k4knetbsd.o aout32.o" ;; - m68kaux_coff_vec) tb="$tb coff-aux.o coff-m68k.o cofflink.o" ;; - m88kbcs_vec) tb="$tb coff-m88k.o" ;; - newsos3_vec) tb="$tb newsos3.o aout32.o" ;; - nlm32_i386_vec) tb="$tb nlm32-i386.o nlm32.o nlm.o" ;; - nlm32_sparc_vec) tb="$tb nlm32-sparc.o nlm32.o nlm.o" ;; - nlm32_alpha_vec) tb="$tb nlm32-alpha.o nlm32.o nlm.o" - target64=true ;; - riscix_vec) tb="$tb aout32.o riscix.o" ;; - nlm32_powerpc_vec) tb="$tb nlm32-ppc.o nlm32.o nlm.o" ;; - pc532netbsd_vec) tb="$tb ns32knetbsd.o aout-ns32k.o" ;; - pc532machaout_vec) tb="$tb pc532-mach.o aout-ns32k.o" ;; - pmac_xcoff_vec) tb="$tb coff-pmac.o xcofflink.o" ;; - rs6000coff_vec) tb="$tb coff-rs6000.o xcofflink.o" ;; - bfd_powerpc_pe_vec) tb="$tb pe-ppc.o cofflink.o" ;; - bfd_powerpcle_pe_vec) tb="$tb pe-ppc.o cofflink.o" ;; - bfd_powerpc_pei_vec) tb="$tb pei-ppc.o cofflink.o" ;; - bfd_powerpcle_pei_vec) tb="$tb pei-ppc.o cofflink.o" ;; - shcoff_vec) tb="$tb coff-sh.o cofflink.o" ;; - shlcoff_vec) tb="$tb coff-sh.o cofflink.o" ;; - som_vec) tb="$tb som.o" ;; - sparclynx_aout_vec) tb="$tb sparclynx.o lynx-core.o aout32.o" ;; - sparclynx_coff_vec) tb="$tb cf-sparclynx.o lynx-core.o" ;; - sparcnetbsd_vec) tb="$tb sparcnetbsd.o aout32.o" ;; - sparccoff_vec) tb="$tb coff-sparc.o" ;; - srec_vec) tb="$tb srec.o" ;; - sunos_big_vec) tb="$tb sunos.o aout32.o" ;; - symbolsrec_vec) tb="$tb srec.o" ;; - tekhex_vec) tb="$tb tekhex.o" ;; - we32kcoff_vec) tb="$tb coff-we32k.o" ;; - z8kcoff_vec) tb="$tb coff-z8k.o reloc16.o" ;; - w65_vec) tb="$tb coff-w65.o reloc16.o" ;; - versados_vec) tb="$tb versados.o" ;; - - "") ;; - *) AC_MSG_ERROR(*** unknown target vector $vec) ;; - esac -done - -# Target architecture .o files. -ta=`echo $selarchs | sed -e s/bfd_/cpu-/g -e s/_arch/.o/g` - -# Weed out duplicate .o files. -f="" -for i in $tb ; do - case " $f " in - *" $i "*) ;; - *) f="$f $i" ;; - esac -done -tb="$f" - -f="" -for i in $ta ; do - case " $f " in - *" $i "*) ;; - *) f="$f $i" ;; - esac -done -ta="$f" - -bfd_backends="$tb" -bfd_machines="$ta" - -if test x${all_targets} = xtrue ; then - bfd_backends="${bfd_backends}"' $(ALL_BACKENDS)' - bfd_machines="${bfd_machines}"' $(ALL_MACHINES)' - selvecs= - selarchs= -else # all_targets is true - # Only set these if they will be nonempty, for the clever echo. - test -n "$selvecs" && - selvecs=`echo $selvecs | sed -e 's/^/\&/' -e 's/ \(.\)/,\&\1/g'` - test -n "$selarchs" && - selarchs=`echo $selarchs | sed -e 's/^/\&/' -e 's/ \(.\)/,\&\1/g'` -fi # all_targets is true - -case ${host64}-${target64}-${want64} in - *true*) - wordsize=64 - all_backends='$(BFD64_BACKENDS) $(BFD32_BACKENDS)' - ;; - false-false-false) - wordsize=32 - all_backends='$(BFD32_BACKENDS)' - ;; -esac - -AC_SUBST(wordsize) -AC_SUBST(all_backends) -AC_SUBST(bfd_backends) -AC_SUBST(bfd_machines) - -tdefaults="" -test -n "${defvec}" && tdefaults="${tdefaults} -DDEFAULT_VECTOR=${defvec}" -test -n "${selvecs}" && tdefaults="${tdefaults} -DSELECT_VECS='${selvecs}'" -test -n "${selarchs}" && tdefaults="${tdefaults} -DSELECT_ARCHITECTURES='${selarchs}'" -AC_SUBST(tdefaults) - -dnl AC_CHECK_HEADERS(sys/mman.h) -AC_FUNC_MMAP -AC_CHECK_FUNCS(madvise mprotect) -case ${want_mmap}+${ac_cv_func_mmap} in - true+yes ) AC_DEFINE(USE_MMAP) ;; -esac - -rm -f doc/config.status -AC_OUTPUT(Makefile doc/Makefile, -[case x$CONFIG_HEADERS in xconfig.h:config.in) echo > stamp-h ;; esac]) diff --git a/contrib/gdb/bfd/corefile.c b/contrib/gdb/bfd/corefile.c deleted file mode 100644 index 212f519..0000000 --- a/contrib/gdb/bfd/corefile.c +++ /dev/null @@ -1,106 +0,0 @@ -/* Core file generic interface routines for BFD. - Copyright (C) 1990, 91, 92, 93, 94 Free Software Foundation, Inc. - Written by Cygnus Support. - -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. */ - -/* -SECTION - Core files - -DESCRIPTION - These are functions pertaining to core files. -*/ - -#include "bfd.h" -#include "sysdep.h" -#include "libbfd.h" - - -/* -FUNCTION - bfd_core_file_failing_command - -SYNOPSIS - CONST char *bfd_core_file_failing_command(bfd *abfd); - -DESCRIPTION - Return a read-only string explaining which program was running - when it failed and produced the core file @var{abfd}. - -*/ - -CONST char * -bfd_core_file_failing_command (abfd) - bfd *abfd; -{ - if (abfd->format != bfd_core) { - bfd_set_error (bfd_error_invalid_operation); - return NULL; - } - return BFD_SEND (abfd, _core_file_failing_command, (abfd)); -} - -/* -FUNCTION - bfd_core_file_failing_signal - -SYNOPSIS - int bfd_core_file_failing_signal(bfd *abfd); - -DESCRIPTION - Returns the signal number which caused the core dump which - generated the file the BFD @var{abfd} is attached to. -*/ - -int -bfd_core_file_failing_signal (abfd) - bfd *abfd; -{ - if (abfd->format != bfd_core) { - bfd_set_error (bfd_error_invalid_operation); - return 0; - } - return BFD_SEND (abfd, _core_file_failing_signal, (abfd)); -} - - -/* -FUNCTION - core_file_matches_executable_p - -SYNOPSIS - boolean core_file_matches_executable_p - (bfd *core_bfd, bfd *exec_bfd); - -DESCRIPTION - Return <> if the core file attached to @var{core_bfd} - was generated by a run of the executable file attached to - @var{exec_bfd}, <> otherwise. -*/ -boolean -core_file_matches_executable_p (core_bfd, exec_bfd) - bfd *core_bfd, *exec_bfd; -{ - if ((core_bfd->format != bfd_core) || (exec_bfd->format != bfd_object)) { - bfd_set_error (bfd_error_wrong_format); - return false; - } - - return BFD_SEND (core_bfd, _core_file_matches_executable_p, - (core_bfd, exec_bfd)); -} diff --git a/contrib/gdb/bfd/cpu-i386.c b/contrib/gdb/bfd/cpu-i386.c deleted file mode 100644 index 4041090..0000000 --- a/contrib/gdb/bfd/cpu-i386.c +++ /dev/null @@ -1,38 +0,0 @@ -/* BFD support for the Intel 386 architecture. - Copyright 1992 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" - -const bfd_arch_info_type bfd_i386_arch = - { - 32, /* 32 bits in a word */ - 32, /* 32 bits in an address */ - 8, /* 8 bits in a byte */ - bfd_arch_i386, - 0, /* only 1 machine */ - "i386", - "i386", - 3, - true, /* the one and only */ - bfd_default_compatible, - bfd_default_scan , - 0, - }; diff --git a/contrib/gdb/bfd/dep-in.sed b/contrib/gdb/bfd/dep-in.sed deleted file mode 100644 index 1cbd786..0000000 --- a/contrib/gdb/bfd/dep-in.sed +++ /dev/null @@ -1,24 +0,0 @@ -:loop -/\\$/N -/\\$/b loop - -s! @BFD_H@!!g -s!@INCDIR@!$(INCDIR)!g -s!@SRCDIR@/!!g -s!hosts/[^ ]*\.h ! !g -s/ sysdep.h//g -s/ libbfd.h//g -s/ config.h//g -s! \$(INCDIR)/fopen-[^ ]*\.h!!g -s! \$(INCDIR)/ansidecl\.h!!g -s! \$(INCDIR)/obstack\.h!!g - -s/\\\n */ /g - -s/ *$// -s/ */ /g -s/ *:/:/g -/:$/d - -s/\(.\{50\}[^ ]*\) /\1 \\\ - /g diff --git a/contrib/gdb/bfd/doc/ChangeLog b/contrib/gdb/bfd/doc/ChangeLog deleted file mode 100644 index f076e37..0000000 --- a/contrib/gdb/bfd/doc/ChangeLog +++ /dev/null @@ -1,268 +0,0 @@ -Tue Jan 30 14:10:46 1996 Ian Lance Taylor - - From Ronald F. Guilmette : - * Makefile.in (libbfd.h): Depend upon proto.str. - (libcoff.h, bfd.h): Likewise. - -Fri Nov 3 14:46:48 1995 Fred Fish - - * Makefile.in (SRCDOC, SRCPROT, core.texi, bfd.h): Use corefile.c, - renamed from core.c. - -Wed Nov 1 14:28:23 1995 Manfred Hollstein KS/EF4A 60/1F/110 #40283 - - * chew.c: Include . - -Fri Oct 6 16:23:34 1995 Ken Raeburn - - Mon Sep 25 22:49:32 1995 Andreas Schwab - - * Makefile.in (Makefile): Only remake this Makefile. - -Wed Oct 4 15:51:05 1995 Ken Raeburn - - * chew.c: Include . - -Tue Sep 12 18:14:50 1995 Ian Lance Taylor - - * Makefile.in (maintainer-clean): New target. - -Thu Aug 31 12:18:43 1995 Ian Lance Taylor - - * Makefile.in (bfd.h): Add additional #endif at end of bfd.h if - __cplusplus is defined. - -Tue Nov 29 16:13:34 1994 Doug Evans - - * chew.c (write_buffer): New argument `f', all callers changed. - (stdout, stderr, print, drop, idrop): New forth words. - * proto.str (COMMENT): New command. - * doc.str (COMMENT): Likewise. - -Mon Sep 12 11:44:17 1994 Ian Lance Taylor (ian@sanguine.cygnus.com) - - * Makefile.in (DOCFILES): Remove ctor.texi. - (IPROTOS): Remove ctor.ip. - (SRCIPROT): Remove $(srcdir)/../ctor.c. - (ctor.texi): Remove target. - (libbfd.h): Remove dependency on $(srcdir)/../ctor.c. Remove - $(MKDOC) run on $(srcdir)/../ctor.c. - * bfd.texinfo (Constructors): Remove section. - -Fri Sep 2 13:33:44 1994 Ken Raeburn (raeburn@cujo.cygnus.com) - - * chew.c: Include assert.h. Added prototypes for most functions. - Changed most uses of int to long. Do bounds checking on the - stacks. Added comment at the beginning documenting most of the - intrinsics. Lots of whitespace changes. Re-ordered some - functions. - (die, check_range, icheck_range): New functions. - (strip_trailing_newlines, print_stack_level): New functions. - (translatecomments): Don't insert tab before "/*". - (iscommand): Minimum command length is now 4. - (nextword): Handle some \-sequences. - (push_addr): Deleted. - (main): Add new intrinsics strip_trailing_newlines and - print_stack_level. Complain at end if stack contains more than - one element, or less. - (remchar): Make sure the string is not empty before chopping off a - character. - - * doc.str, proto.str: Handle new commands SENUM, ENUM, ENUMX, - ENUMEQ, ENUMEQX, ENUMDOC. - -Wed Jan 12 18:37:12 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * bfd.texinfo: Added Linker Functions node. - * doc/Makefile.in (DOCFILES): Added linker.texi. - (SRCDOC): Added linker.c. - (linker.texi): New target. - -Tue Jan 4 10:52:56 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * chew.c: Don't rely on a correct declaration of exit. - (chew_exit): New function which just calls exit. - (main): Use it. - -Mon Jan 3 11:40:40 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * bfd.texinfo: Added Hash Tables node. - * Makefile.in (DOCFILES): Added hash.texi. - (SRCDOC): Added hash.c. - (hash.texi): New target. - -Thu Dec 30 16:57:04 1993 Ken Raeburn (raeburn@cujo.cygnus.com) - - * Makefile.in: Delete all references to seclet.c, since it's just - been deleted. Don't mention hash.c, linker.c, or genlink.h yet, - since they don't contain documentation yet (hint, hint!). - -Fri Nov 5 10:58:53 1993 David J. Mackenzie (djm@thepub.cygnus.com) - - * bfd.texinfo: Small cleanups. - -Fri Nov 19 03:46:11 1993 Ken Raeburn (raeburn@cambridge.cygnus.com) - - * Makefile.in (archures.texi): Depends on $(MKDOC). - -Tue Aug 10 14:22:39 1993 Ken Raeburn (raeburn@cambridge.cygnus.com) - - * bfd.texinfo (BFD back end): Don't include elfcode.texi, since - it's empty now and that triggers a makeinfo bug. - -Mon Aug 9 16:27:30 1993 Ken Raeburn (raeburn@cambridge.cygnus.com) - - * bfd.texinfo (BFD back end): New section on ELF, includes - elf.texi and elfcode.texi. - * Makefile.in (DOCFILES): Include elf.texi, elfcode.texi. - (SRCDOC): Include elfcode.h, elf.c. - (elf.texi, elfcode.texi): New intermediate targets. - -Thu Jun 24 13:48:13 1993 David J. Mackenzie (djm@thepub.cygnus.com) - - * Makefile.in (.c.o, chew.o): Put CFLAGS last. - * bfdsumm.texi: New file, broken out of bfd.texinfo, to share - with ld.texinfo. - -Mon Jun 14 12:07:07 1993 david d `zoo' zuhn (zoo at rtl.cygnus.com) - - * Makefile.in (install-info): remove parentdir cruft, - -Wed Jun 9 16:00:32 1993 Jim Kingdon (kingdon@cygnus.com) - - * Makefile.in (mostlyclean): Remove chew.o. - -Tue May 25 14:46:58 1993 Ken Raeburn (raeburn@cambridge.cygnus.com) - - * Makefile.in (libbfd.h): Use elfcode.h, not elf32.c. - -Mon May 24 15:50:07 1993 Ken Raeburn (raeburn@cygnus.com) - - * chew.c (compile): Add a couple of missing casts. - -Wed May 12 14:45:14 1993 Ian Lance Taylor (ian@cygnus.com) - - * Makefile.in (CC_FOR_BUILD): New variable, define to be $(CC). - (chew.o, $(MKDOC)): Build using CC_FOR_BUILD rather than CC, since - it must run on the build machine. - -Tue Apr 6 22:38:10 1993 John Gilmore (gnu@cygnus.com) - - * Makefile.in (chew): Don't compile from .c to executable in a - single step; it puts a temporary .o filename into the executable, - which makes multi-stage comparisons fail. Compile chew.c to - chew.o, and link that, which makes identical executables every time. - -Wed Mar 24 17:26:29 1993 david d `zoo' zuhn (zoo at poseidon.cygnus.com) - - * Makefile.in: fix typo (bfd.texinfo not bfd.texino) - -Fri Mar 19 01:13:00 1993 Ken Raeburn (raeburn@kr-pc.cygnus.com) - - * bfd.texinfo: Since BFD version number has been bumped, do same - to "version number" on title page, and elsewhere. Should be - fixed to extract real version number. - -Tue Mar 16 12:15:13 1993 Per Bothner (bothner@rtl.cygnus.com) - - * Makefile.in: Add *clean rules. - -Mon Jan 11 18:43:56 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * Makefile.in (libbfd.h): Removed duplicate init.c and libbfd.c. - Added seclet.c. - (bfd.h): Added dependency on bfd.c and seclet.c. Added seclet.c - to build. - -Thu Dec 17 19:35:43 1992 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * Makefile.in: added dvi target, define and use $(TEXI2DVI) - -Thu Dec 3 17:42:48 1992 Ken Raeburn (raeburn@cambridge.cygnus.com) - - * Makefile.in (TEXIDIR): New variable. - (bfd.dvi): Look for bfd.texinfo in $(srcdir). Generate index. - - * bfd.texinfo: Minor doc fixes. - -Thu Nov 5 03:13:55 1992 John Gilmore (gnu@cygnus.com) - - Cleanup: Replace all uses of EXFUN in the BFD sources, with PARAMS. - - * doc/chew.c (exfunstuff): Eliminate. - (paramstuff): Replace exfunstuff with function to generate PARAMS. - * doc/proto.str: Use paramstuff rather than exfunstuff. - -Mon Aug 17 12:40:32 1992 Steve Chamberlain (sac@thepub.cygnus.com) - - * chew.c: various patches provided by Howard Chu. - -Fri Jun 19 18:59:54 1992 John Gilmore (gnu at cygnus.com) - - * Makefile.in (libbfd.h): Add elf.c as a source of prototypes. - -Mon May 11 18:55:59 1992 John Gilmore (gnu at cygnus.com) - - * chew.c: exit() should be declared by config files, not by - portable source code. Its type could be int or void function. - -Mon May 4 13:45:57 1992 K. Richard Pixley (rich@rtl.cygnus.com) - - * Makefile.in: another CFLAGS correction. - -Tue Apr 28 10:21:32 1992 K. Richard Pixley (rich@rtl.cygnus.com) - - * Makefile.in: Do the CFLAGS thing. - -Fri Apr 10 22:34:52 1992 Fred Fish (fnf@cygnus.com) - - * Makefile.in (MINUS_G): Add macro and default to -g. - -Fri Mar 6 18:53:18 1992 Steve Chamberlain (sac@thepub.cygnus.com) - - * chew.c: now has -w switch turn on warnings - -Wed Feb 26 18:04:40 1992 K. Richard Pixley (rich@cygnus.com) - - * Makefile.in, configure.in: removed traces of namesubdir, - -subdirs, $(subdir), $(unsubdir), some rcs triggers. Forced - copyrights to '92, changed some from Cygnus to FSF. - -Tue Dec 10 22:11:05 1991 K. Richard Pixley (rich at rtl.cygnus.com) - - * Makefile.in: build chew into the current directory. Complete - the MKDOC macro transition. - -Tue Dec 10 08:26:28 1991 Steve Chamberlain (sac at rtl.cygnus.com) - - * chew.c: don't core dump when can't open file - * Makefile.in: get proto.str from the right place when built in - odd directories - -Tue Dec 10 04:07:25 1991 K. Richard Pixley (rich at rtl.cygnus.com) - - * Makefile.in: infodir belongs in datadir. - -Sat Dec 7 17:01:23 1991 Steve Chamberlain (sac at rtl.cygnus.com) - - * chew.c: Much modified - * proto.str, doc.str: New files for extracting to product - prototypes and documents respectively. - - -Fri Dec 6 22:57:12 1991 K. Richard Pixley (rich at rtl.cygnus.com) - - * Makefile.in: added standards.text support, host/site/target - inclusion hooks, install using INSTALL_DATA rather than cp, - don't echo on install. - -Thu Dec 5 22:46:17 1991 K. Richard Pixley (rich at rtl.cygnus.com) - - * Makefile.in: idestdir and ddestdir go away. Added copyrights - and shift gpl to v2. Added ChangeLog if it didn't exist. docdir - and mandir now keyed off datadir by default. - - -Local Variables: -version-control: never -End: diff --git a/contrib/gdb/bfd/doc/Makefile.in b/contrib/gdb/bfd/doc/Makefile.in deleted file mode 100644 index aa3a76c..0000000 --- a/contrib/gdb/bfd/doc/Makefile.in +++ /dev/null @@ -1,311 +0,0 @@ -# -# Makefile -# Copyright (C) 1990, 1991, 1992, 1993 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 -# 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. */ -# - -VPATH = @srcdir@ -srcdir = @srcdir@ - -prefix = @prefix@ - -exec_prefix = @exec_prefix@ -bindir = $(exec_prefix)/bin -libdir = $(exec_prefix)/lib - -datadir = $(prefix)/lib -mandir = $(prefix)/man -man1dir = $(mandir)/man1 -man2dir = $(mandir)/man2 -man3dir = $(mandir)/man3 -man4dir = $(mandir)/man4 -man5dir = $(mandir)/man5 -man6dir = $(mandir)/man6 -man7dir = $(mandir)/man7 -man8dir = $(mandir)/man8 -man9dir = $(mandir)/man9 -infodir = $(prefix)/info -includedir = $(prefix)/include -docdir = $(datadir)/doc - -MKDOC=./chew -SHELL = /bin/sh - -INSTALL = `cd $(srcdir)/../..;pwd`/install.sh -c -INSTALL_PROGRAM = $(INSTALL) -INSTALL_DATA = $(INSTALL) - -MAKEINFO = makeinfo -TEXI2DVI = texi2dvi -CFLAGS = -g - -CC_FOR_BUILD = $(CC) - -#### Host, target, and site specific Makefile fragments come in here. -### - -.c.o: - $(CC) -c -I.. -I$(srcdir)/.. -I$(srcdir)/../../include $(H_CFLAGS) $(CFLAGS) $< - -DOCFILES = aoutx.texi archive.texi archures.texi \ - bfd.texi cache.texi coffcode.texi \ - core.texi elf.texi elfcode.texi format.texi libbfd.texi \ - opncls.texi reloc.texi section.texi \ - syms.texi targets.texi init.texi hash.texi linker.texi - -PROTOS = archive.p archures.p bfd.p \ - core.p format.p \ - libbfd.p opncls.p reloc.p \ - section.p syms.p targets.p \ - format.p core.p init.p - -IPROTOS = cache.ip libbfd.ip reloc.ip init.ip archures.ip coffcode.ip - -# SRCDOC, SRCPROT, SRCIPROT only used to sidestep Sun Make bug in interaction -# between VPATH and suffix rules. If you use GNU Make, perhaps other Makes, -# you don't need these three: -SRCDOC = $(srcdir)/../aoutx.h $(srcdir)/../archive.c \ - $(srcdir)/../archures.c $(srcdir)/../bfd.c \ - $(srcdir)/../cache.c $(srcdir)/../coffcode.h \ - $(srcdir)/../corefile.c $(srcdir)/../elf.c \ - $(srcdir)/../elfcode.h $(srcdir)/../format.c \ - $(srcdir)/../libbfd.c $(srcdir)/../opncls.c \ - $(srcdir)/../reloc.c $(srcdir)/../section.c \ - $(srcdir)/../syms.c $(srcdir)/../targets.c \ - $(srcdir)/../hash.c $(srcdir)/../linker.c - -SRCPROT = $(srcdir)/../archive.c $(srcdir)/../archures.c \ - $(srcdir)/../bfd.c $(srcdir)/../coffcode.h $(srcdir)/../corefile.c \ - $(srcdir)/../format.c $(srcdir)/../libbfd.c \ - $(srcdir)/../opncls.c $(srcdir)/../reloc.c \ - $(srcdir)/../section.c $(srcdir)/../syms.c \ - $(srcdir)/../targets.c $(srcdir)/../init.c - -SRCIPROT = $(srcdir)/../cache.c $(srcdir)/../libbfd.c \ - $(srcdir)/../reloc.c $(srcdir)/../cpu-h8300.c \ - $(srcdir)/../cpu-i960.c $(srcdir)/../archures.c \ - $(srcdir)/../init.c - -STAGESTUFF = $(DOCFILES) *.info* - -TEXIDIR = $(srcdir)/../../texinfo/fsf - -all install: - -info: bfd.info - -dvi: bfd.dvi - -install-info: info - for i in *.info* ; do \ - $(INSTALL_DATA) $$i $(infodir)/$$i ; \ - done - -docs: $(MKDOC) protos bfd.info bfd.dvi bfd.ps - -$(MKDOC): chew.o - $(CC_FOR_BUILD) -o $(MKDOC) chew.o $(LOADLIBES) $(LDFLAGS) - -chew.o: chew.c - $(CC_FOR_BUILD) -c -I.. -I$(srcdir)/.. -I$(srcdir)/../../include $(H_CFLAGS) $(CFLAGS) $(srcdir)/chew.c - -protos: libbfd.h libcoff.h bfd.h - - -# We can't replace these rules with an implicit rule, because -# makes without VPATH support couldn't find the .h files in `..'. - -aoutx.texi: $(MKDOC) $(srcdir)/../aoutx.h $(srcdir)/doc.str - $(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../aoutx.h >aoutx.texi - -archive.texi: $(MKDOC) $(srcdir)/../archive.c $(srcdir)/doc.str - $(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../archive.c >archive.texi - -archures.texi: $(MKDOC) $(srcdir)/../archures.c $(srcdir)/doc.str - $(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../archures.c >archures.texi - -bfd.texi: $(MKDOC) $(srcdir)/../bfd.c $(srcdir)/doc.str - $(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../bfd.c >bfd.texi - -cache.texi: $(MKDOC) $(srcdir)/../cache.c $(srcdir)/doc.str - $(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../cache.c >cache.texi - -coffcode.texi: $(MKDOC) $(srcdir)/../coffcode.h $(srcdir)/doc.str - $(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../coffcode.h >coffcode.texi - -core.texi: $(MKDOC) $(srcdir)/../corefile.c $(srcdir)/doc.str - $(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../corefile.c >core.texi - -elf.texi: $(MKDOC) $(srcdir)/../elf.c $(srcdir)/doc.str - $(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../elf.c >elf.texi - -elfcode.texi: $(MKDOC) $(srcdir)/../elfcode.h $(srcdir)/doc.str - $(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../elfcode.h >elfcode.texi - -format.texi: $(MKDOC) $(srcdir)/../format.c $(srcdir)/doc.str - $(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../format.c >format.texi - -libbfd.texi: $(MKDOC) $(srcdir)/../libbfd.c $(srcdir)/doc.str - $(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../libbfd.c >libbfd.texi - -opncls.texi: $(MKDOC) $(srcdir)/../opncls.c $(srcdir)/doc.str - $(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../opncls.c >opncls.texi - -reloc.texi : $(MKDOC) $(srcdir)/../reloc.c - $(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../reloc.c >reloc.texi - -section.texi: $(MKDOC) $(srcdir)/../section.c $(srcdir)/doc.str - $(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../section.c >section.texi - -syms.texi : $(MKDOC) $(srcdir)/../syms.c - $(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../syms.c >syms.texi - -targets.texi: $(MKDOC) $(srcdir)/../targets.c $(srcdir)/doc.str - $(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../targets.c >targets.texi - -init.texi: $(MKDOC) $(srcdir)/../init.c $(srcdir)/doc.str - $(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../init.c >init.texi - -hash.texi: $(MKDOC) $(srcdir)/../hash.c $(srcdir)/doc.str - $(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../hash.c >hash.texi - -linker.texi: $(MKDOC) $(srcdir)/../linker.c $(srcdir)/doc.str - $(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../linker.c >linker.texi - -libbfd.h: $(srcdir)/../libbfd-in.h \ - $(srcdir)/../init.c \ - $(srcdir)/../libbfd.c \ - $(srcdir)/../cache.c \ - $(srcdir)/../reloc.c \ - $(srcdir)/../cpu-h8300.c \ - $(srcdir)/../cpu-i960.c \ - $(srcdir)/../archures.c \ - $(srcdir)/../elfcode.h \ - $(srcdir)/proto.str \ - $(MKDOC) - cat $(srcdir)/../libbfd-in.h >libbfd.h - $(MKDOC) -i -f $(srcdir)/proto.str < $(srcdir)/../init.c >>libbfd.h - $(MKDOC) -i -f $(srcdir)/proto.str < $(srcdir)/../libbfd.c >>libbfd.h - $(MKDOC) -i -f $(srcdir)/proto.str < $(srcdir)/../cache.c >>libbfd.h - $(MKDOC) -i -f $(srcdir)/proto.str < $(srcdir)/../reloc.c >>libbfd.h - $(MKDOC) -i -f $(srcdir)/proto.str < $(srcdir)/../cpu-h8300.c >>libbfd.h - $(MKDOC) -i -f $(srcdir)/proto.str < $(srcdir)/../cpu-i960.c >>libbfd.h - $(MKDOC) -i -f $(srcdir)/proto.str < $(srcdir)/../archures.c >>libbfd.h - $(MKDOC) -i -f $(srcdir)/proto.str < $(srcdir)/../elf.c >>libbfd.h - $(MKDOC) -i -f $(srcdir)/proto.str < $(srcdir)/../elfcode.h >>libbfd.h - -libcoff.h: $(srcdir)/../libcoff-in.h \ - $(srcdir)/../coffcode.h \ - $(srcdir)/proto.str \ - $(MKDOC) - cat $(srcdir)/../libcoff-in.h >libcoff.h - $(MKDOC) -i -f $(srcdir)/proto.str < $(srcdir)/../coffcode.h >>libcoff.h - -bfd.h: $(srcdir)/../bfd-in.h \ - $(srcdir)/../init.c \ - $(srcdir)/../opncls.c \ - $(srcdir)/../libbfd.c \ - $(srcdir)/../section.c \ - $(srcdir)/../archures.c \ - $(srcdir)/../reloc.c \ - $(srcdir)/../syms.c \ - $(srcdir)/../bfd.c \ - $(srcdir)/../archive.c \ - $(srcdir)/../corefile.c \ - $(srcdir)/../targets.c \ - $(srcdir)/../format.c \ - $(srcdir)/proto.str \ - $(MKDOC) - cat $(srcdir)/../bfd-in.h >bfd.h - $(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../init.c >>bfd.h - $(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../opncls.c >>bfd.h - $(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../libbfd.c >>bfd.h - $(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../section.c >>bfd.h - $(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../archures.c >>bfd.h - $(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../reloc.c >>bfd.h - $(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../syms.c >>bfd.h - $(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../bfd.c >>bfd.h - $(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../archive.c >>bfd.h - $(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../corefile.c >>bfd.h - $(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../targets.c >>bfd.h - $(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../format.c >>bfd.h - echo "#ifdef __cplusplus" >>bfd.h - echo "}" >>bfd.h - echo "#endif" >>bfd.h - echo "#endif" >>bfd.h - - -clean-info: clean - -mostlyclean: - rm -rf *.log *.ps *~* *.dvi *# $(MKDOC) *.o - -clean: mostlyclean - rm -rf $(STAGESTUFF) - rm -f *.p *.ip bfd.?? bfd.??? bfd.h libbfd.h libcoff.h texput.log - -distclean: clean - rm -f Makefile config.status - -maintainer-clean realclean: clean - rm -f Makefile config.status - -bfd.info: $(DOCFILES) bfdsumm.texi bfd.texinfo - $(MAKEINFO) -I$(srcdir) -o bfd.info $(srcdir)/bfd.texinfo - -bfd.dvi: $(DOCFILES) bfdsumm.texi bfd.texinfo - $(TEXI2DVI) $(srcdir)/bfd.texinfo - -bfd.ps: bfd.dvi - dvips bfd -o - -quickdoc: $(DOCFILES) bfdsumm.texi bfd.texinfo - TEXINPUTS=${TEXIDIR}:.:$$TEXINPUTS tex bfd.texinfo - -stage1: force - - mkdir stage1 - - mv -f $(STAGESTUFF) stage1 - -stage2: force - - mkdir stage2 - - mv -f $(STAGESTUFF) stage2 - -stage3: force - - mkdir stage3 - - mv -f $(STAGESTUFF) stage3 - -against=stage2 - -comparison: force - for i in $(STAGESTUFF) ; do cmp $$i $(against)/$$i || exit 1 ; done - -de-stage1: force - - (cd stage1 ; mv -f $(STAGESTUFF) ..) - - rmdir stage1 - -de-stage2: force - - (cd stage2 ; mv -f $(STAGESTUFF) ..) - - rmdir stage2 - -de-stage3: force - - (cd stage3 ; mv -f $(STAGESTUFF) ..) - - rmdir stage3 - -force: - -Makefile: $(srcdir)/Makefile.in - cd .. && CONFIG_FILES=doc/$@ CONFIG_HEADERS= $(SHELL) ./config.status - diff --git a/contrib/gdb/bfd/doc/bfd.texinfo b/contrib/gdb/bfd/doc/bfd.texinfo deleted file mode 100644 index af7bc10..0000000 --- a/contrib/gdb/bfd/doc/bfd.texinfo +++ /dev/null @@ -1,348 +0,0 @@ -\input texinfo.tex -@setfilename bfd.info -@c $Id: bfd.texinfo,v 1.28 1995/11/10 20:04:12 victoria Exp $ -@tex -% NOTE LOCAL KLUGE TO AVOID TOO MUCH WHITESPACE -\global\long\def\example{% -\begingroup -\let\aboveenvbreak=\par -\let\afterenvbreak=\par -\parskip=0pt -\lisp} -\global\long\def\Eexample{% -\Elisp -\endgroup -\vskip -\parskip% to cancel out effect of following \par -} -@end tex -@synindex fn cp - -@ifinfo -@format -START-INFO-DIR-ENTRY -* Bfd: (bfd). The Binary File Descriptor library. -END-INFO-DIR-ENTRY -@end format -@end ifinfo - -@ifinfo -This file documents the BFD library. - -Copyright (C) 1991 Free Software Foundation, Inc. - -Permission is granted to make and distribute verbatim copies of -this manual provided the copyright notice and this permission notice -are preserved on all copies. - -@ignore -Permission is granted to process this file through Tex and print the -results, provided the printed document carries copying permission -notice identical to this one except for the removal of this paragraph -(this paragraph not being relevant to the printed manual). - -@end ignore -Permission is granted to copy and distribute modified versions of this -manual under the conditions for verbatim copying, subject to the terms -of the GNU General Public License, which includes the provision that the -entire resulting derived work is distributed under the terms of a -permission notice identical to this one. - -Permission is granted to copy and distribute translations of this manual -into another language, under the above conditions for modified versions. -@end ifinfo -@iftex -@c@finalout -@setchapternewpage on -@c@setchapternewpage odd -@settitle LIB BFD, the Binary File Descriptor Library -@titlepage -@title{libbfd} -@subtitle{The Binary File Descriptor Library} -@sp 1 -@subtitle First Edition---BFD version < 3.0 -@subtitle April 1991 -@author {Steve Chamberlain} -@author {Cygnus Support} -@page - -@tex -\def\$#1${{#1}} % Kluge: collect RCS revision info without $...$ -\xdef\manvers{\$Revision: 1.28 $} % For use in headers, footers too -{\parskip=0pt -\hfill Cygnus Support\par -\hfill sac\@cygnus.com\par -\hfill {\it BFD}, \manvers\par -\hfill \TeX{}info \texinfoversion\par -} -\global\parindent=0pt % Steve likes it this way -@end tex - -@vskip 0pt plus 1filll -Copyright @copyright{} 1991 Free Software Foundation, Inc. - -Permission is granted to make and distribute verbatim copies of -this manual provided the copyright notice and this permission notice -are preserved on all copies. - -Permission is granted to copy and distribute modified versions of this -manual under the conditions for verbatim copying, subject to the terms -of the GNU General Public License, which includes the provision that the -entire resulting derived work is distributed under the terms of a -permission notice identical to this one. - -Permission is granted to copy and distribute translations of this manual -into another language, under the above conditions for modified versions. -@end titlepage -@end iftex - -@node Top, Overview, (dir), (dir) -@ifinfo -This file documents the binary file descriptor library libbfd. -@end ifinfo - -@menu -* Overview:: Overview of BFD -* BFD front end:: BFD front end -* BFD back ends:: BFD back ends -* Index:: Index -@end menu - -@node Overview, BFD front end, Top, Top -@chapter Introduction -@cindex BFD -@cindex what is it? -BFD is a package which allows applications to use the -same routines to operate on object files whatever the object file -format. A new object file format can be supported simply by -creating a new BFD back end and adding it to the library. - -BFD is split into two parts: the front end, and the back ends (one for -each object file format). -@itemize @bullet -@item The front end of BFD provides the interface to the user. It manages -memory and various canonical data structures. The front end also -decides which back end to use and when to call back end routines. -@item The back ends provide BFD its view of the real world. Each back -end provides a set of calls which the BFD front end can use to maintain -its canonical form. The back ends also may keep around information for -their own use, for greater efficiency. -@end itemize -@menu -* History:: History -* How It Works:: How It Works -* What BFD Version 2 Can Do:: What BFD Version 2 Can Do -@end menu - -@node History, How It Works, Overview, Overview -@section History - -One spur behind BFD was the desire, on the part of the GNU 960 team at -Intel Oregon, for interoperability of applications on their COFF and -b.out file formats. Cygnus was providing GNU support for the team, and -was contracted to provide the required functionality. - -The name came from a conversation David Wallace was having with Richard -Stallman about the library: RMS said that it would be quite hard---David -said ``BFD''. Stallman was right, but the name stuck. - -At the same time, Ready Systems wanted much the same thing, but for -different object file formats: IEEE-695, Oasys, Srecords, a.out and 68k -coff. - -BFD was first implemented by members of Cygnus Support; Steve -Chamberlain (@code{sac@@cygnus.com}), John Gilmore -(@code{gnu@@cygnus.com}), K. Richard Pixley (@code{rich@@cygnus.com}) -and David Henkel-Wallace (@code{gumby@@cygnus.com}). - - - -@node How It Works, What BFD Version 2 Can Do, History, Overview -@section How To Use BFD - -To use the library, include @file{bfd.h} and link with @file{libbfd.a}. - -BFD provides a common interface to the parts of an object file -for a calling application. - -When an application sucessfully opens a target file (object, archive, or -whatever), a pointer to an internal structure is returned. This pointer -points to a structure called @code{bfd}, described in -@file{bfd.h}. Our convention is to call this pointer a BFD, and -instances of it within code @code{abfd}. All operations on -the target object file are applied as methods to the BFD. The mapping is -defined within @code{bfd.h} in a set of macros, all beginning -with @samp{bfd_} to reduce namespace pollution. - -For example, this sequence does what you would probably expect: -return the number of sections in an object file attached to a BFD -@code{abfd}. - -@lisp -@c @cartouche -#include "bfd.h" - -unsigned int number_of_sections(abfd) -bfd *abfd; -@{ - return bfd_count_sections(abfd); -@} -@c @end cartouche -@end lisp - -The abstraction used within BFD is that an object file has: - -@itemize @bullet -@item -a header, -@item -a number of sections containing raw data (@pxref{Sections}), -@item -a set of relocations (@pxref{Relocations}), and -@item -some symbol information (@pxref{Symbols}). -@end itemize -@noindent -Also, BFDs opened for archives have the additional attribute of an index -and contain subordinate BFDs. This approach is fine for a.out and coff, -but loses efficiency when applied to formats such as S-records and -IEEE-695. - -@node What BFD Version 2 Can Do, , How It Works, Overview -@section What BFD Version 2 Can Do -@include bfdsumm.texi - -@node BFD front end, BFD back ends, Overview, Top -@chapter BFD front end -@include bfd.texi - -@menu -* Memory Usage:: -* Initialization:: -* Sections:: -* Symbols:: -* Archives:: -* Formats:: -* Relocations:: -* Core Files:: -* Targets:: -* Architectures:: -* Opening and Closing:: -* Internal:: -* File Caching:: -* Linker Functions:: -* Hash Tables:: -@end menu - -@node Memory Usage, Initialization, BFD front end, BFD front end -@section Memory usage -BFD keeps all of its internal structures in obstacks. There is one obstack -per open BFD file, into which the current state is stored. When a BFD is -closed, the obstack is deleted, and so everything which has been -allocated by BFD for the closing file is thrown away. - -BFD does not free anything created by an application, but pointers into -@code{bfd} structures become invalid on a @code{bfd_close}; for example, -after a @code{bfd_close} the vector passed to -@code{bfd_canonicalize_symtab} is still around, since it has been -allocated by the application, but the data that it pointed to are -lost. - -The general rule is to not close a BFD until all operations dependent -upon data from the BFD have been completed, or all the data from within -the file has been copied. To help with the management of memory, there -is a function (@code{bfd_alloc_size}) which returns the number of bytes -in obstacks associated with the supplied BFD. This could be used to -select the greediest open BFD, close it to reclaim the memory, perform -some operation and reopen the BFD again, to get a fresh copy of the data -structures. - -@node Initialization, Sections, Memory Usage, BFD front end -@include init.texi - -@node Sections, Symbols, Initialization, BFD front end -@include section.texi - -@node Symbols, Archives, Sections, BFD front end -@include syms.texi - -@node Archives, Formats, Symbols, BFD front end -@include archive.texi - -@node Formats, Relocations, Archives, BFD front end -@include format.texi - -@node Relocations, Core Files, Formats, BFD front end -@include reloc.texi - -@node Core Files, Targets, Relocations, BFD front end -@include core.texi - -@node Targets, Architectures, Core Files, BFD front end -@include targets.texi - -@node Architectures, Opening and Closing, Targets, BFD front end -@include archures.texi - -@node Opening and Closing, Internal, Architectures, BFD front end -@include opncls.texi - -@node Internal, File Caching, Opening and Closing, BFD front end -@include libbfd.texi - -@node File Caching, Linker Functions, Internal, BFD front end -@include cache.texi - -@node Linker Functions, Hash Tables, File Caching, BFD front end -@include linker.texi - -@node Hash Tables, , Linker Functions, BFD front end -@include hash.texi - -@node BFD back ends, Index, BFD front end, Top -@chapter BFD back ends -@menu -* What to Put Where:: -* aout :: a.out backends -* coff :: coff backends -* elf :: elf backends -@ignore -* oasys :: oasys backends -* ieee :: ieee backend -* srecord :: s-record backend -@end ignore -@end menu -@node What to Put Where, aout, BFD back ends, BFD back ends -All of BFD lives in one directory. - -@node aout, coff, What to Put Where, BFD back ends -@include aoutx.texi - -@node coff, elf, aout, BFD back ends -@include coffcode.texi - -@node elf, , coff, BFD back ends -@include elf.texi -@c Leave this out until the file has some actual contents... -@c @include elfcode.texi - -@node Index, , BFD back ends , Top -@unnumbered Index -@printindex cp - -@tex -% I think something like @colophon should be in texinfo. In the -% meantime: -\long\def\colophon{\hbox to0pt{}\vfill -\centerline{The body of this manual is set in} -\centerline{\fontname\tenrm,} -\centerline{with headings in {\bf\fontname\tenbf}} -\centerline{and examples in {\tt\fontname\tentt}.} -\centerline{{\it\fontname\tenit\/} and} -\centerline{{\sl\fontname\tensl\/}} -\centerline{are used for emphasis.}\vfill} -\page\colophon -% Blame: doc@cygnus.com, 28mar91. -@end tex - -@contents -@bye diff --git a/contrib/gdb/bfd/doc/bfdsumm.texi b/contrib/gdb/bfd/doc/bfdsumm.texi deleted file mode 100644 index 844531a..0000000 --- a/contrib/gdb/bfd/doc/bfdsumm.texi +++ /dev/null @@ -1,148 +0,0 @@ -@c This summary of BFD is shared by the BFD and LD docs. -When an object file is opened, BFD subroutines automatically determine -the format of the input object file. They then build a descriptor in -memory with pointers to routines that will be used to access elements of -the object file's data structures. - -As different information from the the object files is required, -BFD reads from different sections of the file and processes them. -For example, a very common operation for the linker is processing symbol -tables. Each BFD back end provides a routine for converting -between the object file's representation of symbols and an internal -canonical format. When the linker asks for the symbol table of an object -file, it calls through a memory pointer to the routine from the -relevant BFD back end which reads and converts the table into a canonical -form. The linker then operates upon the canonical form. When the link is -finished and the linker writes the output file's symbol table, -another BFD back end routine is called to take the newly -created symbol table and convert it into the chosen output format. - -@menu -* BFD information loss:: Information Loss -* Canonical format:: The BFD canonical object-file format -@end menu - -@node BFD information loss -@subsection Information Loss - -@emph{Information can be lost during output.} The output formats -supported by BFD do not provide identical facilities, and -information which can be described in one form has nowhere to go in -another format. One example of this is alignment information in -@code{b.out}. There is nowhere in an @code{a.out} format file to store -alignment information on the contained data, so when a file is linked -from @code{b.out} and an @code{a.out} image is produced, alignment -information will not propagate to the output file. (The linker will -still use the alignment information internally, so the link is performed -correctly). - -Another example is COFF section names. COFF files may contain an -unlimited number of sections, each one with a textual section name. If -the target of the link is a format which does not have many sections (e.g., -@code{a.out}) or has sections without names (e.g., the Oasys format), the -link cannot be done simply. You can circumvent this problem by -describing the desired input-to-output section mapping with the linker command -language. - -@emph{Information can be lost during canonicalization.} The BFD -internal canonical form of the external formats is not exhaustive; there -are structures in input formats for which there is no direct -representation internally. This means that the BFD back ends -cannot maintain all possible data richness through the transformation -between external to internal and back to external formats. - -This limitation is only a problem when an application reads one -format and writes another. Each BFD back end is responsible for -maintaining as much data as possible, and the internal BFD -canonical form has structures which are opaque to the BFD core, -and exported only to the back ends. When a file is read in one format, -the canonical form is generated for BFD and the application. At the -same time, the back end saves away any information which may otherwise -be lost. If the data is then written back in the same format, the back -end routine will be able to use the canonical form provided by the -BFD core as well as the information it prepared earlier. Since -there is a great deal of commonality between back ends, -there is no information lost when -linking or copying big endian COFF to little endian COFF, or @code{a.out} to -@code{b.out}. When a mixture of formats is linked, the information is -only lost from the files whose format differs from the destination. - -@node Canonical format -@subsection The BFD canonical object-file format - -The greatest potential for loss of information occurs when there is the least -overlap between the information provided by the source format, that -stored by the canonical format, and that needed by the -destination format. A brief description of the canonical form may help -you understand which kinds of data you can count on preserving across -conversions. -@cindex BFD canonical format -@cindex internal object-file format - -@table @emph -@item files -Information stored on a per-file basis includes target machine -architecture, particular implementation format type, a demand pageable -bit, and a write protected bit. Information like Unix magic numbers is -not stored here---only the magic numbers' meaning, so a @code{ZMAGIC} -file would have both the demand pageable bit and the write protected -text bit set. The byte order of the target is stored on a per-file -basis, so that big- and little-endian object files may be used with one -another. - -@item sections -Each section in the input file contains the name of the section, the -section's original address in the object file, size and alignment -information, various flags, and pointers into other BFD data -structures. - -@item symbols -Each symbol contains a pointer to the information for the object file -which originally defined it, its name, its value, and various flag -bits. When a BFD back end reads in a symbol table, it relocates all -symbols to make them relative to the base of the section where they were -defined. Doing this ensures that each symbol points to its containing -section. Each symbol also has a varying amount of hidden private data -for the BFD back end. Since the symbol points to the original file, the -private data format for that symbol is accessible. @code{ld} can -operate on a collection of symbols of wildly different formats without -problems. - -Normal global and simple local symbols are maintained on output, so an -output file (no matter its format) will retain symbols pointing to -functions and to global, static, and common variables. Some symbol -information is not worth retaining; in @code{a.out}, type information is -stored in the symbol table as long symbol names. This information would -be useless to most COFF debuggers; the linker has command line switches -to allow users to throw it away. - -There is one word of type information within the symbol, so if the -format supports symbol type information within symbols (for example, COFF, -IEEE, Oasys) and the type is simple enough to fit within one word -(nearly everything but aggregates), the information will be preserved. - -@item relocation level -Each canonical BFD relocation record contains a pointer to the symbol to -relocate to, the offset of the data to relocate, the section the data -is in, and a pointer to a relocation type descriptor. Relocation is -performed by passing messages through the relocation type -descriptor and the symbol pointer. Therefore, relocations can be performed -on output data using a relocation method that is only available in one of the -input formats. For instance, Oasys provides a byte relocation format. -A relocation record requesting this relocation type would point -indirectly to a routine to perform this, so the relocation may be -performed on a byte being written to a 68k COFF file, even though 68k COFF -has no such relocation type. - -@item line numbers -Object formats can contain, for debugging purposes, some form of mapping -between symbols, source line numbers, and addresses in the output file. -These addresses have to be relocated along with the symbol information. -Each symbol with an associated list of line number records points to the -first record of the list. The head of a line number list consists of a -pointer to the symbol, which allows finding out the address of the -function whose line number is being described. The rest of the list is -made up of pairs: offsets into the section and line numbers. Any format -which can simply derive this information can pass it successfully -between formats (COFF, IEEE and Oasys). -@end table diff --git a/contrib/gdb/bfd/doc/chew.c b/contrib/gdb/bfd/doc/chew.c deleted file mode 100644 index 5c04404..0000000 --- a/contrib/gdb/bfd/doc/chew.c +++ /dev/null @@ -1,1551 +0,0 @@ -/* chew - Copyright (C) 1990-1991 Free Software Foundation, Inc. - Contributed by steve chamberlain @cygnus - -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. */ - -/* Yet another way of extracting documentation from source. - No, I haven't finished it yet, but I hope you people like it better - than the old way - - sac - - Basically, this is a sort of string forth, maybe we should call it - struth? - - You define new words thus: - : ; - -*/ - -/* Primitives provided by the program: - - Two stacks are provided, a string stack and an integer stack. - - Internal state variables: - internal_wanted - indicates whether `-i' was passed - internal_mode - user-settable - - Commands: - push_text - ! - pop top of integer stack for address, pop next for value; store - @ - treat value on integer stack as the address of an integer; push - that integer on the integer stack after popping the "address" - hello - print "hello\n" to stdout - stdout - put stdout marker on TOS - stderr - put stderr marker on TOS - print - print TOS-1 on TOS (eg: "hello\n" stdout print) - skip_past_newline - catstr - fn icatstr - copy_past_newline - append input, up to and including newline into TOS - dup - fn other_dup - drop - discard TOS - idrop - ditto - remchar - delete last character from TOS - get_stuff_in_command - do_fancy_stuff - translate <> to @code{foo} in TOS - bulletize - if "o" lines found, prepend @itemize @bullet to TOS - and @item to each "o" line; append @end itemize - courierize - put @example around . and | lines, translate {* *} { } - exit - fn chew_exit - swap - outputdots - strip out lines without leading dots - paramstuff - convert full declaration into "PARAMS" form if not already - maybecatstr - do catstr if internal_mode == internal_wanted, discard - value in any case - translatecomments - turn {* and *} into comment delimiters - kill_bogus_lines - get rid of extra newlines - indent - internalmode - pop from integer stack, set `internalmode' to that value - print_stack_level - print current stack depth to stderr - strip_trailing_newlines - go ahead, guess... - [quoted string] - push string onto string stack - [word starting with digit] - push atol(str) onto integer stack - - A command must be all upper-case, and alone on a line. - - Foo. */ - - -#include -#include "sysdep.h" -#include -#include -#include - -#define DEF_SIZE 5000 -#define STACK 50 - -int internal_wanted; -int internal_mode; - -int warning; - -/* Here is a string type ... */ - -typedef struct buffer -{ - char *ptr; - unsigned long write_idx; - unsigned long size; -} string_type; - - -#ifdef __STDC__ -static void init_string_with_size (string_type *, unsigned int); -static void init_string (string_type *); -static int find (string_type *, char *); -static void write_buffer (string_type *, FILE *); -static void delete_string (string_type *); -static char *addr (string_type *, unsigned int); -static char at (string_type *, unsigned int); -static void catchar (string_type *, int); -static void overwrite_string (string_type *, string_type *); -static void catbuf (string_type *, char *, unsigned int); -static void cattext (string_type *, char *); -static void catstr (string_type *, string_type *); -static unsigned int skip_white_and_starts (string_type *, unsigned int); -#endif - - -static void DEFUN(init_string_with_size,(buffer, size), - string_type *buffer AND - unsigned int size ) -{ - buffer->write_idx = 0; - buffer->size = size; - buffer->ptr = malloc(size); -} - -static void DEFUN(init_string,(buffer), - string_type *buffer) -{ - init_string_with_size(buffer, DEF_SIZE); - -} - -static int DEFUN(find, (str, what), - string_type *str AND - char *what) -{ - unsigned int i; - char *p; - p = what; - for (i = 0; i < str->write_idx && *p; i++) - { - if (*p == str->ptr[i]) - p++; - else - p = what; - } - return (*p == 0); - -} - -static void DEFUN(write_buffer,(buffer, f), - string_type *buffer AND - FILE *f) -{ - fwrite(buffer->ptr, buffer->write_idx, 1, f); -} - - -static void DEFUN(delete_string,(buffer), - string_type *buffer) -{ - free(buffer->ptr); -} - - -static char *DEFUN(addr, (buffer, idx), - string_type *buffer AND - unsigned int idx) -{ - return buffer->ptr + idx; -} - -static char DEFUN(at,(buffer, pos), - string_type *buffer AND - unsigned int pos) -{ - if (pos >= buffer->write_idx) - return 0; - return buffer->ptr[pos]; -} - -static void DEFUN(catchar,(buffer, ch), - string_type *buffer AND - int ch) -{ - if (buffer->write_idx == buffer->size) - { - buffer->size *=2; - buffer->ptr = realloc(buffer->ptr, buffer->size); - } - - buffer->ptr[buffer->write_idx ++ ] = ch; -} - - -static void DEFUN(overwrite_string,(dst, src), - string_type *dst AND - string_type *src) -{ - free(dst->ptr); - dst->size = src->size; - dst->write_idx = src->write_idx; - dst->ptr = src->ptr; -} - -static void DEFUN(catbuf,(buffer, buf, len), - string_type *buffer AND - char *buf AND - unsigned int len) -{ - if (buffer->write_idx + len >= buffer->size) - { - while (buffer->write_idx + len >= buffer->size) - buffer->size *= 2; - buffer->ptr = realloc (buffer->ptr, buffer->size); - } - memcpy (buffer->ptr + buffer->write_idx, buf, len); - buffer->write_idx += len; -} - -static void DEFUN(cattext,(buffer, string), - string_type *buffer AND - char *string) -{ - catbuf (buffer, string, (unsigned int) strlen (string)); -} - -static void DEFUN(catstr,(dst, src), - string_type *dst AND - string_type *src) -{ - catbuf (dst, src->ptr, src->write_idx); -} - - -static unsigned int -DEFUN(skip_white_and_stars,(src, idx), - string_type *src AND - unsigned int idx) -{ - char c; - while ((c = at(src,idx)), - isspace (c) - || (c == '*' - /* Don't skip past end-of-comment or star as first - character on its line. */ - && at(src,idx +1) != '/' - && at(src,idx -1) != '\n')) - idx++; - return idx; -} - -/***********************************************************************/ - - -string_type stack[STACK]; -string_type *tos; - -unsigned int idx = 0; /* Pos in input buffer */ -string_type *ptr; /* and the buffer */ -typedef void (*stinst_type)(); -stinst_type *pc; -stinst_type sstack[STACK]; -stinst_type *ssp = &sstack[0]; -long istack[STACK]; -long *isp = &istack[0]; - -typedef int *word_type; - - - -struct dict_struct -{ - char *word; - struct dict_struct *next; - stinst_type *code; - int code_length; - int code_end; - int var; - -}; -typedef struct dict_struct dict_type; -#define WORD(x) static void x() - -static void -die (msg) - char *msg; -{ - fprintf (stderr, "%s\n", msg); - exit (1); -} - -static void -check_range () -{ - if (tos < stack) - die ("underflow in string stack"); - if (tos >= stack + STACK) - die ("overflow in string stack"); -} - -static void -icheck_range () -{ - if (isp < istack) - die ("underflow in integer stack"); - if (isp >= istack + STACK) - die ("overflow in integer stack"); -} - -#ifdef __STDC__ -static void exec (dict_type *); -static void call (void); -static void remchar (void), strip_trailing_newlines (void), push_number (void); -static void push_text (void); -static void remove_noncomments (string_type *, string_type *); -static void print_stack_level (void); -static void paramstuff (void), translatecomments (void), manglecomments (void); -static void outputdots (void), courierize (void), bulletize (void); -static void do_fancy_stuff (void); -static int iscommand (string_type *, unsigned int); -static int copy_past_newline (string_type *, unsigned int, string_type *); -static void icopy_past_newline (void), kill_bogus_lines (void), indent (void); -static void get_stuff_in_command (void), swap (void), other_dup (void); -static void drop (void), idrop (void); -static void icatstr (void), skip_past_newline (void), internalmode (void); -static void maybecatstr (void); -static char *nextword (char *, char **); -dict_type *lookup_word (char *); -static void perform (void); -dict_type *newentry (char *); -unsigned int add_to_definition (dict_type *, stinst_type); -void add_intrinsic (char *, void (*)()); -void add_var (char *); -void compile (char *); -static void bang (void); -static void atsign (void); -static void hello (void); -static void stdout_ (void); -static void stderr_ (void); -static void print (void); -static void read_in (string_type *, FILE *); -static void usage (void); -static void chew_exit (void); -#endif - -static void DEFUN(exec,(word), - dict_type *word) -{ - pc = word->code; - while (*pc) - (*pc)(); -} -WORD(call) -{ - stinst_type *oldpc = pc; - dict_type *e; - e = (dict_type *)(pc [1]); - exec(e); - pc = oldpc + 2; - -} - -WORD(remchar) -{ - if (tos->write_idx) - tos->write_idx--; - pc++; -} - -static void -strip_trailing_newlines () -{ - while ((isspace (at (tos, tos->write_idx - 1)) - || at (tos, tos->write_idx - 1) == '\n') - && tos->write_idx > 0) - tos->write_idx--; - pc++; -} - -WORD(push_number) -{ - isp++; - icheck_range (); - pc++; - *isp = (long)(*pc); - pc++; -} - -WORD(push_text) -{ - tos++; - check_range (); - init_string(tos); - pc++; - cattext(tos,*((char **)pc)); - pc++; - -} - - -/* This function removes everything not inside comments starting on - the first char of the line from the string, also when copying - comments, removes blank space and leading *'s. - Blank lines are turned into one blank line. */ - -static void -DEFUN(remove_noncomments,(src,dst), - string_type *src AND - string_type *dst) -{ - unsigned int idx = 0; - - while (at(src,idx)) - { - /* Now see if we have a comment at the start of the line */ - if (at(src,idx) == '\n' - && at(src,idx+1) == '/' - && at(src,idx+2) == '*') - { - idx+=3; - - idx = skip_white_and_stars(src,idx); - - /* Remove leading dot */ - if (at(src, idx) == '.') - idx++; - - /* Copy to the end of the line, or till the end of the - comment */ - while (at(src, idx)) - { - if (at(src, idx) == '\n') - { - /* end of line, echo and scrape of leading blanks */ - if (at(src,idx +1) == '\n') - catchar(dst,'\n'); - catchar(dst,'\n'); - idx++; - idx = skip_white_and_stars(src, idx); - } - else if (at(src, idx) == '*' && at(src,idx+1) == '/') - { - idx +=2 ; - cattext(dst,"\nENDDD\n"); - break; - } - else - { - catchar(dst, at(src, idx)); - idx++; - } - } - } - else idx++; - } -} - -static void -print_stack_level () -{ - fprintf (stderr, "current string stack depth = %d, ", tos - stack); - fprintf (stderr, "current integer stack depth = %d\n", isp - istack); - pc++; -} - -/* turn: - foobar name(stuff); - into: - foobar - name PARAMS ((stuff)); - and a blank line. - */ - -static void -DEFUN_VOID(paramstuff) -{ - unsigned int openp; - unsigned int fname; - unsigned int idx; - string_type out; - init_string(&out); - - - /* make sure that it's not already param'd or proto'd */ - if(find(tos,"PARAMS") || find(tos,"PROTO") || !find(tos,"(")) { - catstr(&out,tos); - } - else - { - /* Find the open paren */ - for (openp = 0; at(tos, openp) != '(' && at(tos,openp); openp++) - ; - - fname = openp; - /* Step back to the fname */ - fname--; - while (fname && isspace(at(tos, fname))) - fname --; - while (fname && !isspace(at(tos,fname)) && at(tos,fname) != '*') - fname--; - - fname++; - - for (idx = 0; idx < fname; idx++) /* Output type */ - { - catchar(&out, at(tos,idx)); - } - - cattext(&out, "\n"); /* Insert a newline between type and fnname */ - - for (idx = fname; idx < openp; idx++) /* Output fnname */ - { - catchar(&out, at(tos,idx)); - } - - cattext(&out," PARAMS ("); - - while (at(tos,idx) && at(tos,idx) !=';') - { - catchar(&out, at(tos, idx)); - idx++; - } - cattext(&out,");\n\n"); - } - overwrite_string(tos, &out); - pc++; - -} - - - -/* turn {* - and *} into comments */ - -WORD(translatecomments) -{ - unsigned int idx = 0; - string_type out; - init_string(&out); - - while (at(tos, idx)) - { - if (at(tos,idx) == '{' && at(tos,idx+1) =='*') - { - cattext(&out,"/*"); - idx+=2; - } - else if (at(tos,idx) == '*' && at(tos,idx+1) =='}') - { - cattext(&out,"*/"); - idx+=2; - } - else - { - catchar(&out, at(tos, idx)); - idx++; - } - } - - - overwrite_string(tos, &out); - - pc++; - -} - -/* turn everything not starting with a . into a comment */ - -WORD(manglecomments) -{ - unsigned int idx = 0; - string_type out; - init_string(&out); - - while (at(tos, idx)) - { - if (at(tos,idx) == '\n' && at(tos,idx+1) =='*') - { - cattext(&out," /*"); - idx+=2; - } - else if (at(tos,idx) == '*' && at(tos,idx+1) =='}') - { - cattext(&out,"*/"); - idx+=2; - } - else - { - catchar(&out, at(tos, idx)); - idx++; - } - } - - - overwrite_string(tos, &out); - - pc++; - -} - -/* Mod tos so that only lines with leading dots remain */ -static void -DEFUN_VOID(outputdots) -{ - unsigned int idx = 0; - string_type out; - init_string(&out); - - while (at(tos, idx)) - { - if (at(tos, idx) == '\n' && at(tos, idx+1) == '.') - { - char c, c2; - idx += 2; - - while ((c = at(tos, idx)) && c != '\n') - { - if (c == '{' && at(tos,idx+1) =='*') - { - cattext(&out," /*"); - idx+=2; - } - else if (c == '*' && at(tos,idx+1) =='}') - { - cattext(&out,"*/"); - idx+=2; - } - else - { - catchar(&out, c); - idx++; - } - } - catchar(&out,'\n'); - } - else - { - idx++; - } - } - - overwrite_string(tos, &out); - pc++; - -} - -/* Find lines starting with . and | and put example around them on tos */ -WORD(courierize) -{ - string_type out; - unsigned int idx = 0; - int command = 0; - - init_string(&out); - - while (at(tos, idx)) - { - if (at(tos, idx) == '\n' - && (at(tos, idx +1 ) == '.' - || at(tos,idx+1) == '|')) - { - cattext(&out,"\n@example\n"); - do - { - idx += 2; - - while (at(tos, idx) && at(tos, idx)!='\n') - { - if (at(tos,idx)=='{' && at(tos,idx+1) =='*') - { - cattext(&out," /*"); - idx+=2; - } - else if (at(tos,idx)=='*' && at(tos,idx+1) =='}') - { - cattext(&out,"*/"); - idx+=2; - } - else if (at(tos,idx) == '{' && !command) - { - cattext(&out,"@{"); - idx++; - } - else if (at(tos,idx) == '}' && !command) - { - cattext(&out,"@}"); - idx++; - } - else - { - if (at(tos,idx) == '@') - command = 1; - else if (isspace(at(tos,idx)) || at(tos,idx) == '}') - command = 0; - catchar(&out, at(tos, idx)); - idx++; - } - - } - catchar(&out,'\n'); - } - while (at(tos, idx) == '\n' - && (at(tos, idx+1) == '.') - || (at(tos,idx+1) == '|')); - cattext(&out,"@end example"); - } - else - { - catchar(&out, at(tos, idx)); - idx++; - } - } - - overwrite_string(tos, &out); - pc++; - - -} - -/* Finds any lines starting with "o ", if there are any, then turns - on @itemize @bullet, and @items each of them. Then ends with @end - itemize, inplace at TOS*/ - - -WORD(bulletize) -{ - unsigned int idx = 0; - int on = 0; - string_type out; - init_string(&out); - - while (at(tos, idx)) { - if (at(tos, idx) == '@' && - at(tos, idx+1) == '*') - { - cattext(&out,"*"); - idx+=2; - } - -else - if (at(tos, idx) == '\n' && - at(tos, idx+1) == 'o' && - isspace(at(tos, idx +2))) - { - if (!on) - { - cattext(&out,"\n@itemize @bullet\n"); - on = 1; - - } - cattext(&out,"\n@item\n"); - idx+=3; - } - else - { - catchar(&out, at(tos, idx)); - if (on && at(tos, idx) == '\n' && - at(tos, idx+1) == '\n' && - at(tos, idx+2) != 'o') - { - cattext(&out, "@end itemize"); - on = 0; - } - idx++; - - } - } - if (on) - { - cattext(&out,"@end itemize\n"); - } - - delete_string(tos); - *tos = out; - pc++; - -} - -/* Turn <> into @code{foo} in place at TOS*/ - - -WORD(do_fancy_stuff) -{ - unsigned int idx = 0; - string_type out; - init_string(&out); - while (at(tos, idx)) - { - if (at(tos, idx) == '<' - && at(tos, idx+1) == '<' - && !isspace(at(tos,idx + 2))) - { - /* This qualifies as a << startup */ - idx +=2; - cattext(&out,"@code{"); - while(at(tos,idx) && - at(tos,idx) != '>' ) - { - catchar(&out, at(tos, idx)); - idx++; - - } - cattext(&out,"}"); - idx+=2; - } - else - { - catchar(&out, at(tos, idx)); - idx++; - } - } - delete_string(tos); - *tos = out; - pc++; - -} -/* A command is all upper case,and alone on a line */ -static int -DEFUN( iscommand,(ptr, idx), - string_type *ptr AND - unsigned int idx) -{ - unsigned int len = 0; - while (at(ptr,idx)) { - if (isupper(at(ptr,idx)) || at(ptr,idx) == ' ' || - at(ptr,idx) == '_') - { - len++; - idx++; - } - else if(at(ptr,idx) == '\n') - { - if (len > 3) return 1; - return 0; - } - else return 0; - } - return 0; - -} - - -DEFUN(copy_past_newline,(ptr, idx, dst), - string_type *ptr AND - unsigned int idx AND - string_type *dst) -{ - while (at(ptr, idx) && at(ptr, idx) != '\n') - { - catchar(dst, at(ptr, idx)); - idx++; - - } - catchar(dst, at(ptr, idx)); - idx++; - return idx; - -} - -WORD(icopy_past_newline) -{ - tos++; - check_range (); - init_string(tos); - idx = copy_past_newline(ptr, idx, tos); - pc++; -} - -/* indent - Take the string at the top of the stack, do some prettying */ - - -WORD(kill_bogus_lines) -{ - int sl ; - - int nl = 0; - int idx = 0; - int c; - int dot = 0 ; - - string_type out; - init_string(&out); - /* Drop leading nl */ - while (at(tos,idx) == '\n') - { - idx++; - } - c = idx; - - /* Find the last char */ - while (at(tos,idx)) - { - idx++; - } - - /* find the last non white before the nl */ - idx--; - - while (idx && isspace(at(tos,idx))) - idx--; - idx++; - - /* Copy buffer upto last char, but blank lines before and after - dots don't count */ - sl = 1; - - while (c < idx) - { - if (at(tos,c) == '\n' - && at(tos,c+1) == '\n' - && at(tos,c+2) == '.') - { - /* Ignore two newlines before a dot*/ - c++; - } - else if (at(tos,c) == '.' && sl) - { - /* remember that this line started with a dot */ - dot=2; - } - else if (at(tos,c) == '\n' - && at(tos,c+1) == '\n' - && dot) - { - c++; - /* Ignore two newlines when last line was dot */ - } - - catchar(&out, at(tos,c)); - if (at(tos,c) == '\n') - { - sl = 1; - - if (dot == 2)dot=1;else dot = 0; - } - - c++; - - } - - /* Append nl*/ - catchar(&out, '\n'); - pc++; - delete_string(tos); - *tos = out; - - -} - -WORD(indent) -{ - string_type out; - int tab = 0; - int idx = 0; - int ol =0; - init_string(&out); - while (at(tos,idx)) { - switch (at(tos,idx)) - { - case '\n': - cattext(&out,"\n"); - idx++; - if (tab) - { - cattext(&out," "); - } - ol = 0; - break; - case '(': - tab++; - if (ol == 0) - cattext(&out," "); - idx++; - cattext(&out,"("); - ol = 1; - break; - case ')': - tab--; - cattext(&out,")"); - idx++; - ol=1; - - break; - default: - catchar(&out,at(tos,idx)); - ol=1; - - idx++; - break; - } - } - - pc++; - delete_string(tos); - *tos = out; - -} - - -WORD(get_stuff_in_command) -{ - tos++; - check_range (); - init_string(tos); - - while (at(ptr, idx)) { - if (iscommand(ptr, idx)) break; - idx = copy_past_newline(ptr, idx, tos); - } - pc++; -} - -WORD(swap) -{ - string_type t; - - t = tos[0]; - tos[0] = tos[-1]; - tos[-1] =t; - pc++; - -} - -WORD(other_dup) -{ - tos++; - check_range (); - init_string(tos); - catstr(tos, tos-1); - pc++; -} - -WORD(drop) -{ - tos--; - check_range (); - pc++; -} - -WORD(idrop) -{ - isp--; - icheck_range (); - pc++; -} - -WORD(icatstr) -{ - tos--; - check_range (); - catstr(tos, tos+1); - delete_string(tos+1); - pc++; -} - -WORD(skip_past_newline) -{ - while (at(ptr,idx) - && at(ptr,idx) != '\n') - idx++; - idx++; - pc++; -} - - -WORD(internalmode) -{ - internal_mode = *(isp); - isp--; - icheck_range (); - pc++; -} - -WORD(maybecatstr) -{ - if (internal_wanted == internal_mode) - { - catstr(tos-1, tos); - } - delete_string(tos); - tos--; - check_range (); - pc++; -} - -char * -DEFUN(nextword,(string, word), - char *string AND - char **word) -{ - char *word_start; - int idx; - char *dst; - char *src; - - int length = 0; - - while (isspace(*string) || *string == '-') { - if (*string == '-') - { - while (*string && *string != '\n') - string++; - - } - else { - string++; - } - } - if (!*string) return 0; - - word_start = string; - if (*string == '"') - { - do - { - string++; - length++; - if (*string == '\\') - { - string += 2; - length += 2; - } - } - while (*string != '"'); - } - else - { - while (!isspace(*string)) - { - string++; - length++; - - } - } - - *word = malloc(length + 1); - - dst = *word; - src = word_start; - - - for (idx= 0; idx < length; idx++) - { - if (src[idx] == '\\') - switch (src[idx+1]) - { - case 'n': - *dst++ = '\n'; - idx++; - break; - case '"': - case '\\': - *dst++ = src[idx+1]; - idx++; - break; - default: - *dst++ = '\\'; - break; - } - else - *dst++ = src[idx]; - } - *dst++ = 0; - - - - - - if(*string) - return string + 1; - else - return 0; - -} -dict_type *root; -dict_type * -DEFUN(lookup_word,(word), - char *word) -{ - dict_type *ptr = root; - while (ptr) { - if (strcmp(ptr->word, word) == 0) return ptr; - ptr = ptr->next; - - } - if (warning) - fprintf(stderr,"Can't find %s\n",word); - return 0; - - -} - -static void DEFUN_VOID(perform) -{ - tos = stack; - - while (at(ptr, idx)) { - /* It's worth looking through the command list */ - if (iscommand(ptr, idx)) - { - unsigned int i; - int found = 0; - - char *next; - dict_type *word ; - - (void) nextword(addr(ptr, idx), &next); - - - word = lookup_word(next); - - - - - if (word) - { - exec(word); - } - else - { - if (warning) - fprintf(stderr,"warning, %s is not recognised\n", next); - skip_past_newline(); - } - - } - else skip_past_newline(); - - } -} - -dict_type * -DEFUN(newentry,(word), - char *word) -{ - dict_type *new = (dict_type *)malloc(sizeof(dict_type)); - new->word = word; - new->next = root; - root = new; - new->code = (stinst_type *)malloc(sizeof(stinst_type )); - new->code_length = 1; - new->code_end = 0; - return new; - -} - - -unsigned int -DEFUN(add_to_definition,(entry, word), - dict_type *entry AND - stinst_type word) -{ - if (entry->code_end == entry->code_length) - { - entry->code_length += 2; - entry->code = - (stinst_type *) realloc((char *)(entry->code), - entry->code_length *sizeof(word_type)); - } - entry->code[entry->code_end] = word; - -return entry->code_end++; -} - - - - - - - -void -DEFUN(add_intrinsic,(name, func), - char *name AND - void (*func)()) -{ - dict_type *new = newentry(name); - add_to_definition(new, func); - add_to_definition(new, 0); -} - -void -DEFUN(add_var,(name), - char *name) -{ - dict_type *new = newentry(name); - add_to_definition(new, push_number); - add_to_definition(new, (stinst_type)(&(new->var))); - add_to_definition(new,0); -} - - -void -DEFUN(compile, (string), - char *string) -{ - int jstack[STACK]; - int *jptr = jstack; - /* add words to the dictionary */ - char *word; - string = nextword(string, &word); - while (string && *string && word[0]) - { - if (strcmp(word,"var")==0) - { - string=nextword(string, &word); - - add_var(word); - string=nextword(string, &word); - } -else - - if (word[0] == ':') - { - dict_type *ptr; - /* Compile a word and add to dictionary */ - string = nextword(string, &word); - - ptr = newentry(word); - string = nextword(string, &word); - while (word[0] != ';' ) - { - switch (word[0]) - { - case '"': - /* got a string, embed magic push string - function */ - add_to_definition(ptr, push_text); - add_to_definition(ptr, (stinst_type)(word+1)); - break; - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - /* Got a number, embedd the magic push number - function */ - add_to_definition(ptr, push_number); - add_to_definition(ptr, (stinst_type)atol(word)); - break; - default: - add_to_definition(ptr, call); - add_to_definition(ptr, (stinst_type)lookup_word(word)); - } - - string = nextword(string, &word); - } - add_to_definition(ptr,0); - string = nextword(string, &word); - } - else - { - fprintf(stderr,"syntax error at %s\n",string-1); - } - } - -} - - -static void DEFUN_VOID(bang) -{ - *(long *)((isp[0])) = isp[-1]; - isp-=2; - icheck_range (); - pc++; -} - -WORD(atsign) -{ - isp[0] = *(long *)(isp[0]); - pc++; -} - -WORD(hello) -{ - printf("hello\n"); - pc++; -} - -WORD(stdout_) -{ - isp++; - icheck_range (); - *isp = 1; - pc++; -} - -WORD(stderr_) -{ - isp++; - icheck_range (); - *isp = 2; - pc++; -} - -WORD(print) -{ - if (*isp == 1) - write_buffer (tos, stdout); - else if (*isp == 2) - write_buffer (tos, stderr); - else - fprintf (stderr, "print: illegal print destination `%d'\n", *isp); - isp--; - tos--; - icheck_range (); - check_range (); - pc++; -} - - -static void DEFUN(read_in, (str, file), - string_type *str AND - FILE *file) -{ - char buff[10000]; - unsigned int r; - do - { - r = fread(buff, 1, sizeof(buff), file); - catbuf(str, buff, r); - } - while (r); - buff[0] = 0; - - catbuf(str, buff,1); -} - - -static void DEFUN_VOID(usage) -{ - fprintf(stderr,"usage: -[d|i|g] file\n"); - exit(33); -} - -/* There is no reliable way to declare exit. Sometimes it returns - int, and sometimes it returns void. Sometimes it changes between - OS releases. Trying to get it declared correctly in the hosts file - is a pointless waste of time. */ - -static void -chew_exit () -{ - exit (0); -} - -int DEFUN(main,(ac,av), -int ac AND -char *av[]) -{ - unsigned int i; - string_type buffer; - string_type pptr; - - init_string(&buffer); - init_string(&pptr); - init_string(stack+0); - tos=stack+1; - ptr = &pptr; - - add_intrinsic("push_text", push_text); - add_intrinsic("!", bang); - add_intrinsic("@", atsign); - add_intrinsic("hello",hello); - add_intrinsic("stdout",stdout_); - add_intrinsic("stderr",stderr_); - add_intrinsic("print",print); - add_intrinsic("skip_past_newline", skip_past_newline ); - add_intrinsic("catstr", icatstr ); - add_intrinsic("copy_past_newline", icopy_past_newline ); - add_intrinsic("dup", other_dup ); - add_intrinsic("drop", drop); - add_intrinsic("idrop", idrop); - add_intrinsic("remchar", remchar ); - add_intrinsic("get_stuff_in_command", get_stuff_in_command ); - add_intrinsic("do_fancy_stuff", do_fancy_stuff ); - add_intrinsic("bulletize", bulletize ); - add_intrinsic("courierize", courierize ); - /* If the following line gives an error, exit() is not declared in the - ../hosts/foo.h file for this host. Fix it there, not here! */ - /* No, don't fix it anywhere; see comment on chew_exit--Ian Taylor. */ - add_intrinsic("exit", chew_exit ); - add_intrinsic("swap", swap ); - add_intrinsic("outputdots", outputdots ); - add_intrinsic("paramstuff", paramstuff ); - add_intrinsic("maybecatstr", maybecatstr ); - add_intrinsic("translatecomments", translatecomments ); - add_intrinsic("kill_bogus_lines", kill_bogus_lines); - add_intrinsic("indent", indent); - add_intrinsic("internalmode", internalmode); - add_intrinsic("print_stack_level", print_stack_level); - add_intrinsic("strip_trailing_newlines", strip_trailing_newlines); - - /* Put a nl at the start */ - catchar(&buffer,'\n'); - - read_in(&buffer, stdin); - remove_noncomments(&buffer, ptr); - for (i= 1; i < ac; i++) - { - if (av[i][0] == '-') - { - if (av[i][1] == 'f') - { - string_type b; - FILE *f; - init_string(&b); - - f = fopen(av[i+1],"r"); - if (!f) - { - fprintf(stderr,"Can't open the input file %s\n",av[i+1]); - return 33; - } - - read_in(&b, f); - compile(b.ptr); - perform(); - } - else if (av[i][1] == 'i') - { - internal_wanted = 1; - } - else if (av[i][1] == 'w') - { - warning = 1; - } - } - } - write_buffer(stack+0, stdout); - if (tos != stack) - { - fprintf (stderr, "finishing with current stack level %d\n", tos - stack); - return 1; - } - return 0; -} diff --git a/contrib/gdb/bfd/doc/doc.str b/contrib/gdb/bfd/doc/doc.str deleted file mode 100644 index 9368599..0000000 --- a/contrib/gdb/bfd/doc/doc.str +++ /dev/null @@ -1,158 +0,0 @@ -: DOCDD - skip_past_newline - get_stuff_in_command kill_bogus_lines catstr - ; - -: ENDDD - skip_past_newline - ; - -: EXAMPLE - skip_past_newline - get_stuff_in_command kill_bogus_lines do_fancy_stuff translatecomments - courierize catstr - - ; - -: INODE - "@node " catstr skip_past_newline copy_past_newline catstr - ; - -: CODE_FRAGMENT - EXAMPLE - ; - -: COMMENT - skip_past_newline - get_stuff_in_command - drop - ; - -: SYNOPSIS - skip_past_newline - "@strong{Synopsis}\n" catstr - "@example\n" catstr - get_stuff_in_command - kill_bogus_lines - indent - catstr - "@end example\n" catstr - - ; - -: func - "@findex " - a - skip_past_newline - copy_past_newline - dup - a x x - "@subsubsection @code{" - a x x b - swap - remchar - "}\n" - a x b x c - catstr catstr catstr catstr catstr - ; - -: FUNCTION - "@findex " - a - skip_past_newline - copy_past_newline - dup - a x x - "@subsubsection @code{" - a x x b - swap - remchar - "}\n" - a x b x c - catstr catstr catstr catstr catstr - ; - -: bodytext - get_stuff_in_command - bulletize - kill_bogus_lines - do_fancy_stuff - courierize - catstr - "@*\n" catstr - ; - -: asection - skip_past_newline - catstr - copy_past_newline - do_fancy_stuff catstr - bodytext - ; - -: SECTION - "@section " asection ; - -: SUBSECTION - "@subsection " asection ; - -: SUBSUBSECTION - "@subsubsection " asection ; - -: subhead - skip_past_newline - bodytext - ; - - - - -: DESCRIPTION - "@strong{Description}@*\n" catstr subhead ; - -: RETURNS - "@strong{Returns}@*\n" catstr subhead ; - -: INTERNAL_FUNCTION - func ; - - -: INTERNAL_DEFINITION - func ; - - -: INTERNAL - func ; - -: TYPEDEF - FUNCTION ; - -: SENUM - skip_past_newline - "Here are the possible values for @code{enum " - copy_past_newline remchar catstr - "}:\n\n" catstr catstr - ; -: ENUM - skip_past_newline - "@deffn {} " - copy_past_newline catstr catstr - ; -: ENUMX - skip_past_newline - "@deffnx {} " - copy_past_newline catstr - catstr - ; -: ENUMEQ - skip_past_newline - "@deffn {} " - copy_past_newline catstr catstr - skip_past_newline - ; -: ENUMEQX - skip_past_newline - "@deffnx {} " - copy_past_newline catstr - catstr - skip_past_newline - ; -: ENUMDOC - skip_past_newline - get_stuff_in_command - strip_trailing_newlines - catstr - "\n@end deffn\n" catstr - ; diff --git a/contrib/gdb/bfd/doc/proto.str b/contrib/gdb/bfd/doc/proto.str deleted file mode 100644 index 8431c16..0000000 --- a/contrib/gdb/bfd/doc/proto.str +++ /dev/null @@ -1,135 +0,0 @@ - -: SYNOPSIS - skip_past_newline - get_stuff_in_command - paramstuff - indent - maybecatstr -; - -: ignore - skip_past_newline - get_stuff_in_command - outputdots - maybecatstr - ; - -: CODE_FRAGMENT - ignore ; - -: external - 0 internalmode ignore ; - -: internal - 1 internalmode ignore ; - -- input stack { a b } output b if internal, a if external -: ifinternal - "" swap 1 internalmode maybecatstr - swap - "" swap 0 internalmode maybecatstr - catstr - ; - -- Put note in output string, regardless of internal mode. -: COMMENT - skip_past_newline - get_stuff_in_command - translatecomments - catstr - ; - -- SENUM enum-type-name -- ENUM enum-name -- ENUMX addl-enum-name -- ENUMDOC doc for preceding enums -- ENDSENUM max-enum-name - -: make_enum_header - dup - "enum " swap catstr - " {\n" catstr - swap " _dummy_first_" swap catstr catstr - ",\n" catstr - ; -: make_string_table_header - dup - "#ifdef _BFD_MAKE_TABLE_" swap catstr swap - "\n\nstatic const char *const " swap catstr catstr - "_names[] = { \"@@uninitialized@@\",\n" catstr - ; -: SENUM - skip_past_newline - copy_past_newline - remchar - dup - make_enum_header - swap - make_string_table_header - ifinternal - catstr - get_stuff_in_command catstr - translatecomments ; -: ENDSENUM - skip_past_newline - copy_past_newline strip_trailing_newlines - dup - " " swap catstr " };\n" catstr swap - " \"@@overflow: " swap catstr "@@\",\n};\n#endif\n\n" catstr - ifinternal - catstr - ; -: make_enumerator - " " swap catstr - ",\n" catstr - ; -: make_enumerator_string - " \"" swap catstr - "\",\n" catstr - ; -: ENUM - skip_past_newline - copy_past_newline - remchar - dup - make_enumerator - swap - make_enumerator_string - ifinternal - ; -: ENUMX ENUM catstr ; -: ENUMEQ - skip_past_newline - "#define " - copy_past_newline remchar - catstr - " " - catstr - copy_past_newline - catstr - "" swap 0 internalmode maybecatstr - ; -: ENUMEQX ENUMEQ catstr ; -: ENUMDOC - skip_past_newline - get_stuff_in_command - strip_trailing_newlines - "\n{* " swap catstr " *}\n" catstr - translatecomments - - discard it if we're doing internal mode - "" swap 0 internalmode maybecatstr - swap - catstr catstr - ; -: ENDDD external ; -: SECTION ignore ; -: SUBSECTION ignore ; -: SUBSUBSECTION ignore ; -: INTERNAL_DEFINITION internal ; -: DESCRIPTION ignore ; -: FUNCTION external ; -: RETURNS ignore ; -: TYPEDEF external ; -: INTERNAL_FUNCTION internal ; -: INTERNAL internal ; -: INODE ignore ; diff --git a/contrib/gdb/bfd/ecoff.c b/contrib/gdb/bfd/ecoff.c deleted file mode 100644 index e219ff7..0000000 --- a/contrib/gdb/bfd/ecoff.c +++ /dev/null @@ -1,4740 +0,0 @@ -/* Generic ECOFF (Extended-COFF) routines. - Copyright 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. - Original version by Per Bothner. - Full support added by Ian Lance Taylor, ian@cygnus.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 "aout/ar.h" -#include "aout/ranlib.h" -#include "aout/stab_gnu.h" - -/* FIXME: We need the definitions of N_SET[ADTB], but aout64.h defines - some other stuff which we don't want and which conflicts with stuff - we do want. */ -#include "libaout.h" -#include "aout/aout64.h" -#undef N_ABS -#undef exec_hdr -#undef obj_sym_filepos - -#include "coff/internal.h" -#include "coff/sym.h" -#include "coff/symconst.h" -#include "coff/ecoff.h" -#include "libcoff.h" -#include "libecoff.h" - -/* Prototypes for static functions. */ - -static int ecoff_get_magic PARAMS ((bfd *abfd)); -static long ecoff_sec_to_styp_flags PARAMS ((const char *name, - flagword flags)); -static boolean ecoff_slurp_symbolic_header PARAMS ((bfd *abfd)); -static boolean ecoff_set_symbol_info PARAMS ((bfd *abfd, SYMR *ecoff_sym, - asymbol *asym, int ext, int weak)); -static void ecoff_emit_aggregate PARAMS ((bfd *abfd, FDR *fdr, - char *string, - RNDXR *rndx, long isym, - const char *which)); -static char *ecoff_type_to_string PARAMS ((bfd *abfd, FDR *fdr, - unsigned int indx)); -static boolean ecoff_slurp_reloc_table PARAMS ((bfd *abfd, asection *section, - asymbol **symbols)); -static int ecoff_sort_hdrs PARAMS ((const PTR, const PTR)); -static boolean ecoff_compute_section_file_positions PARAMS ((bfd *abfd)); -static bfd_size_type ecoff_compute_reloc_file_positions PARAMS ((bfd *abfd)); -static boolean ecoff_get_extr PARAMS ((asymbol *, EXTR *)); -static void ecoff_set_index PARAMS ((asymbol *, bfd_size_type)); -static unsigned int ecoff_armap_hash PARAMS ((CONST char *s, - unsigned int *rehash, - unsigned int size, - unsigned int hlog)); - -/* This stuff is somewhat copied from coffcode.h. */ - -static asection bfd_debug_section = { "*DEBUG*" }; - -/* Create an ECOFF object. */ - -boolean -_bfd_ecoff_mkobject (abfd) - bfd *abfd; -{ - abfd->tdata.ecoff_obj_data = ((struct ecoff_tdata *) - bfd_zalloc (abfd, sizeof (ecoff_data_type))); - if (abfd->tdata.ecoff_obj_data == NULL) - return false; - - return true; -} - -/* This is a hook called by coff_real_object_p to create any backend - specific information. */ - -PTR -_bfd_ecoff_mkobject_hook (abfd, filehdr, aouthdr) - bfd *abfd; - PTR filehdr; - PTR aouthdr; -{ - struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr; - struct internal_aouthdr *internal_a = (struct internal_aouthdr *) aouthdr; - ecoff_data_type *ecoff; - - if (_bfd_ecoff_mkobject (abfd) == false) - return NULL; - - ecoff = ecoff_data (abfd); - ecoff->gp_size = 8; - ecoff->sym_filepos = internal_f->f_symptr; - - if (internal_a != (struct internal_aouthdr *) NULL) - { - int i; - - ecoff->text_start = internal_a->text_start; - ecoff->text_end = internal_a->text_start + internal_a->tsize; - ecoff->gp = internal_a->gp_value; - ecoff->gprmask = internal_a->gprmask; - for (i = 0; i < 4; i++) - ecoff->cprmask[i] = internal_a->cprmask[i]; - ecoff->fprmask = internal_a->fprmask; - if (internal_a->magic == ECOFF_AOUT_ZMAGIC) - abfd->flags |= D_PAGED; - else - abfd->flags &=~ D_PAGED; - } - - /* It turns out that no special action is required by the MIPS or - Alpha ECOFF backends. They have different information in the - a.out header, but we just copy it all (e.g., gprmask, cprmask and - fprmask) and let the swapping routines ensure that only relevant - information is written out. */ - - return (PTR) ecoff; -} - -/* Initialize a new section. */ - -boolean -_bfd_ecoff_new_section_hook (abfd, section) - bfd *abfd; - asection *section; -{ - /* For the .pdata section, which has a special meaning on the Alpha, - we set the alignment power to 3. We correct this later in - ecoff_compute_section_file_positions. We do this hackery because - we need to know the exact unaligned size of the .pdata section in - order to set the lnnoptr field correctly. For every other - section we use an alignment power of 4; this could be made target - dependent by adding a field to ecoff_backend_data, but 4 appears - to be correct for both the MIPS and the Alpha. */ - if (strcmp (section->name, _PDATA) == 0) - section->alignment_power = 3; - else - section->alignment_power = 4; - - if (strcmp (section->name, _TEXT) == 0) - section->flags |= SEC_CODE | SEC_LOAD | SEC_ALLOC; - else if (strcmp (section->name, _DATA) == 0 - || strcmp (section->name, _SDATA) == 0) - section->flags |= SEC_DATA | SEC_LOAD | SEC_ALLOC; - else if (strcmp (section->name, _RDATA) == 0 - || strcmp (section->name, _LIT8) == 0 - || strcmp (section->name, _LIT4) == 0 - || strcmp (section->name, _RCONST) == 0) - section->flags |= SEC_DATA | SEC_LOAD | SEC_ALLOC | SEC_READONLY; - else if (strcmp (section->name, _BSS) == 0 - || strcmp (section->name, _SBSS) == 0) - section->flags |= SEC_ALLOC; - else if (strcmp (section->name, _LIB) == 0) - { - /* An Irix 4 shared libary. */ - section->flags |= SEC_COFF_SHARED_LIBRARY; - } - - /* Probably any other section name is SEC_NEVER_LOAD, but I'm - uncertain about .init on some systems and I don't know how shared - libraries work. */ - - return true; -} - -/* Determine the machine architecture and type. This is called from - the generic COFF routines. It is the inverse of ecoff_get_magic, - below. This could be an ECOFF backend routine, with one version - for each target, but there aren't all that many ECOFF targets. */ - -boolean -_bfd_ecoff_set_arch_mach_hook (abfd, filehdr) - bfd *abfd; - PTR filehdr; -{ - struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr; - enum bfd_architecture arch; - unsigned long mach; - - switch (internal_f->f_magic) - { - case MIPS_MAGIC_1: - case MIPS_MAGIC_LITTLE: - case MIPS_MAGIC_BIG: - arch = bfd_arch_mips; - mach = 3000; - break; - - case MIPS_MAGIC_LITTLE2: - case MIPS_MAGIC_BIG2: - /* MIPS ISA level 2: the r6000 */ - arch = bfd_arch_mips; - mach = 6000; - break; - - case MIPS_MAGIC_LITTLE3: - case MIPS_MAGIC_BIG3: - /* MIPS ISA level 3: the r4000 */ - arch = bfd_arch_mips; - mach = 4000; - break; - - case ALPHA_MAGIC: - arch = bfd_arch_alpha; - mach = 0; - break; - - default: - arch = bfd_arch_obscure; - mach = 0; - break; - } - - return bfd_default_set_arch_mach (abfd, arch, mach); -} - -/* Get the magic number to use based on the architecture and machine. - This is the inverse of _bfd_ecoff_set_arch_mach_hook, above. */ - -static int -ecoff_get_magic (abfd) - bfd *abfd; -{ - int big, little; - - switch (bfd_get_arch (abfd)) - { - case bfd_arch_mips: - switch (bfd_get_mach (abfd)) - { - default: - case 0: - case 3000: - big = MIPS_MAGIC_BIG; - little = MIPS_MAGIC_LITTLE; - break; - - case 6000: - big = MIPS_MAGIC_BIG2; - little = MIPS_MAGIC_LITTLE2; - break; - - case 4000: - big = MIPS_MAGIC_BIG3; - little = MIPS_MAGIC_LITTLE3; - break; - } - - return bfd_big_endian (abfd) ? big : little; - - case bfd_arch_alpha: - return ALPHA_MAGIC; - - default: - abort (); - return 0; - } -} - -/* Get the section s_flags to use for a section. */ - -static long -ecoff_sec_to_styp_flags (name, flags) - const char *name; - flagword flags; -{ - long styp; - - styp = 0; - - if (strcmp (name, _TEXT) == 0) - styp = STYP_TEXT; - else if (strcmp (name, _DATA) == 0) - styp = STYP_DATA; - else if (strcmp (name, _SDATA) == 0) - styp = STYP_SDATA; - else if (strcmp (name, _RDATA) == 0) - styp = STYP_RDATA; - else if (strcmp (name, _LITA) == 0) - styp = STYP_LITA; - else if (strcmp (name, _LIT8) == 0) - styp = STYP_LIT8; - else if (strcmp (name, _LIT4) == 0) - styp = STYP_LIT4; - else if (strcmp (name, _BSS) == 0) - styp = STYP_BSS; - else if (strcmp (name, _SBSS) == 0) - styp = STYP_SBSS; - else if (strcmp (name, _INIT) == 0) - styp = STYP_ECOFF_INIT; - else if (strcmp (name, _FINI) == 0) - styp = STYP_ECOFF_FINI; - else if (strcmp (name, _PDATA) == 0) - styp = STYP_PDATA; - else if (strcmp (name, _XDATA) == 0) - styp = STYP_XDATA; - else if (strcmp (name, _LIB) == 0) - styp = STYP_ECOFF_LIB; - else if (strcmp (name, _GOT) == 0) - styp = STYP_GOT; - else if (strcmp (name, _HASH) == 0) - styp = STYP_HASH; - else if (strcmp (name, _DYNAMIC) == 0) - styp = STYP_DYNAMIC; - else if (strcmp (name, _LIBLIST) == 0) - styp = STYP_LIBLIST; - else if (strcmp (name, _RELDYN) == 0) - styp = STYP_RELDYN; - else if (strcmp (name, _CONFLIC) == 0) - styp = STYP_CONFLIC; - else if (strcmp (name, _DYNSTR) == 0) - styp = STYP_DYNSTR; - else if (strcmp (name, _DYNSYM) == 0) - styp = STYP_DYNSYM; - else if (strcmp (name, _COMMENT) == 0) - { - styp = STYP_COMMENT; - flags &=~ SEC_NEVER_LOAD; - } - else if (strcmp (name, _RCONST) == 0) - styp = STYP_RCONST; - else if (flags & SEC_CODE) - styp = STYP_TEXT; - else if (flags & SEC_DATA) - styp = STYP_DATA; - else if (flags & SEC_READONLY) - styp = STYP_RDATA; - else if (flags & SEC_LOAD) - styp = STYP_REG; - else - styp = STYP_BSS; - - if (flags & SEC_NEVER_LOAD) - styp |= STYP_NOLOAD; - - return styp; -} - -/* Get the BFD flags to use for a section. */ - -/*ARGSUSED*/ -flagword -_bfd_ecoff_styp_to_sec_flags (abfd, hdr, name) - bfd *abfd; - PTR hdr; - const char *name; -{ - struct internal_scnhdr *internal_s = (struct internal_scnhdr *) hdr; - long styp_flags = internal_s->s_flags; - flagword sec_flags=0; - - if (styp_flags & STYP_NOLOAD) - sec_flags |= SEC_NEVER_LOAD; - - /* For 386 COFF, at least, an unloadable text or data section is - actually a shared library section. */ - if ((styp_flags & STYP_TEXT) - || (styp_flags & STYP_ECOFF_INIT) - || (styp_flags & STYP_ECOFF_FINI) - || (styp_flags & STYP_DYNAMIC) - || (styp_flags & STYP_LIBLIST) - || (styp_flags & STYP_RELDYN) - || styp_flags == STYP_CONFLIC - || (styp_flags & STYP_DYNSTR) - || (styp_flags & STYP_DYNSYM) - || (styp_flags & STYP_HASH)) - { - if (sec_flags & SEC_NEVER_LOAD) - sec_flags |= SEC_CODE | SEC_COFF_SHARED_LIBRARY; - else - sec_flags |= SEC_CODE | SEC_LOAD | SEC_ALLOC; - } - else if ((styp_flags & STYP_DATA) - || (styp_flags & STYP_RDATA) - || (styp_flags & STYP_SDATA) - || styp_flags == STYP_PDATA - || styp_flags == STYP_XDATA - || (styp_flags & STYP_GOT) - || styp_flags == STYP_RCONST) - { - if (sec_flags & SEC_NEVER_LOAD) - sec_flags |= SEC_DATA | SEC_COFF_SHARED_LIBRARY; - else - sec_flags |= SEC_DATA | SEC_LOAD | SEC_ALLOC; - if ((styp_flags & STYP_RDATA) - || styp_flags == STYP_PDATA - || styp_flags == STYP_RCONST) - sec_flags |= SEC_READONLY; - } - else if ((styp_flags & STYP_BSS) - || (styp_flags & STYP_SBSS)) - { - sec_flags |= SEC_ALLOC; - } - else if ((styp_flags & STYP_INFO) || styp_flags == STYP_COMMENT) - { - sec_flags |= SEC_NEVER_LOAD; - } - else if ((styp_flags & STYP_LITA) - || (styp_flags & STYP_LIT8) - || (styp_flags & STYP_LIT4)) - { - sec_flags |= SEC_DATA | SEC_LOAD | SEC_ALLOC | SEC_READONLY; - } - else if (styp_flags & STYP_ECOFF_LIB) - { - sec_flags |= SEC_COFF_SHARED_LIBRARY; - } - else - { - sec_flags |= SEC_ALLOC | SEC_LOAD; - } - - return sec_flags; -} - -/* Read in the symbolic header for an ECOFF object file. */ - -static boolean -ecoff_slurp_symbolic_header (abfd) - bfd *abfd; -{ - const struct ecoff_backend_data * const backend = ecoff_backend (abfd); - bfd_size_type external_hdr_size; - PTR raw = NULL; - HDRR *internal_symhdr; - - /* See if we've already read it in. */ - if (ecoff_data (abfd)->debug_info.symbolic_header.magic == - backend->debug_swap.sym_magic) - return true; - - /* See whether there is a symbolic header. */ - if (ecoff_data (abfd)->sym_filepos == 0) - { - bfd_get_symcount (abfd) = 0; - return true; - } - - /* At this point bfd_get_symcount (abfd) holds the number of symbols - as read from the file header, but on ECOFF this is always the - size of the symbolic information header. It would be cleaner to - handle this when we first read the file in coffgen.c. */ - external_hdr_size = backend->debug_swap.external_hdr_size; - if (bfd_get_symcount (abfd) != external_hdr_size) - { - bfd_set_error (bfd_error_bad_value); - return false; - } - - /* Read the symbolic information header. */ - raw = (PTR) bfd_malloc ((size_t) external_hdr_size); - if (raw == NULL) - goto error_return; - - if (bfd_seek (abfd, ecoff_data (abfd)->sym_filepos, SEEK_SET) == -1 - || (bfd_read (raw, external_hdr_size, 1, abfd) - != external_hdr_size)) - goto error_return; - internal_symhdr = &ecoff_data (abfd)->debug_info.symbolic_header; - (*backend->debug_swap.swap_hdr_in) (abfd, raw, internal_symhdr); - - if (internal_symhdr->magic != backend->debug_swap.sym_magic) - { - bfd_set_error (bfd_error_bad_value); - goto error_return; - } - - /* Now we can get the correct number of symbols. */ - bfd_get_symcount (abfd) = (internal_symhdr->isymMax - + internal_symhdr->iextMax); - - if (raw != NULL) - free (raw); - return true; - error_return: - if (raw != NULL) - free (raw); - return false; -} - -/* Read in and swap the important symbolic information for an ECOFF - object file. This is called by gdb via the read_debug_info entry - point in the backend structure. */ - -/*ARGSUSED*/ -boolean -_bfd_ecoff_slurp_symbolic_info (abfd, ignore, debug) - bfd *abfd; - asection *ignore; - struct ecoff_debug_info *debug; -{ - const struct ecoff_backend_data * const backend = ecoff_backend (abfd); - HDRR *internal_symhdr; - bfd_size_type raw_base; - bfd_size_type raw_size; - PTR raw; - bfd_size_type external_fdr_size; - char *fraw_src; - char *fraw_end; - struct fdr *fdr_ptr; - bfd_size_type raw_end; - bfd_size_type cb_end; - - BFD_ASSERT (debug == &ecoff_data (abfd)->debug_info); - - /* Check whether we've already gotten it, and whether there's any to - get. */ - if (ecoff_data (abfd)->raw_syments != (PTR) NULL) - return true; - if (ecoff_data (abfd)->sym_filepos == 0) - { - bfd_get_symcount (abfd) = 0; - return true; - } - - if (! ecoff_slurp_symbolic_header (abfd)) - return false; - - internal_symhdr = &debug->symbolic_header; - - /* Read all the symbolic information at once. */ - raw_base = (ecoff_data (abfd)->sym_filepos - + backend->debug_swap.external_hdr_size); - - /* Alpha ecoff makes the determination of raw_size difficult. It has - an undocumented debug data section between the symhdr and the first - documented section. And the ordering of the sections varies between - statically and dynamically linked executables. - If bfd supports SEEK_END someday, this code could be simplified. */ - - raw_end = 0; - -#define UPDATE_RAW_END(start, count, size) \ - cb_end = internal_symhdr->start + internal_symhdr->count * (size); \ - if (cb_end > raw_end) \ - raw_end = cb_end - - UPDATE_RAW_END (cbLineOffset, cbLine, sizeof (unsigned char)); - UPDATE_RAW_END (cbDnOffset, idnMax, backend->debug_swap.external_dnr_size); - UPDATE_RAW_END (cbPdOffset, ipdMax, backend->debug_swap.external_pdr_size); - UPDATE_RAW_END (cbSymOffset, isymMax, backend->debug_swap.external_sym_size); - UPDATE_RAW_END (cbOptOffset, ioptMax, backend->debug_swap.external_opt_size); - UPDATE_RAW_END (cbAuxOffset, iauxMax, sizeof (union aux_ext)); - UPDATE_RAW_END (cbSsOffset, issMax, sizeof (char)); - UPDATE_RAW_END (cbSsExtOffset, issExtMax, sizeof (char)); - UPDATE_RAW_END (cbFdOffset, ifdMax, backend->debug_swap.external_fdr_size); - UPDATE_RAW_END (cbRfdOffset, crfd, backend->debug_swap.external_rfd_size); - UPDATE_RAW_END (cbExtOffset, iextMax, backend->debug_swap.external_ext_size); - -#undef UPDATE_RAW_END - - raw_size = raw_end - raw_base; - if (raw_size == 0) - { - ecoff_data (abfd)->sym_filepos = 0; - return true; - } - raw = (PTR) bfd_alloc (abfd, raw_size); - if (raw == NULL) - return false; - if (bfd_seek (abfd, - (ecoff_data (abfd)->sym_filepos - + backend->debug_swap.external_hdr_size), - SEEK_SET) != 0 - || bfd_read (raw, raw_size, 1, abfd) != raw_size) - { - bfd_release (abfd, raw); - return false; - } - - ecoff_data (abfd)->raw_syments = raw; - - /* Get pointers for the numeric offsets in the HDRR structure. */ -#define FIX(off1, off2, type) \ - if (internal_symhdr->off1 == 0) \ - debug->off2 = (type) NULL; \ - else \ - debug->off2 = (type) ((char *) raw \ - + (internal_symhdr->off1 \ - - raw_base)) - FIX (cbLineOffset, line, unsigned char *); - FIX (cbDnOffset, external_dnr, PTR); - FIX (cbPdOffset, external_pdr, PTR); - FIX (cbSymOffset, external_sym, PTR); - FIX (cbOptOffset, external_opt, PTR); - FIX (cbAuxOffset, external_aux, union aux_ext *); - FIX (cbSsOffset, ss, char *); - FIX (cbSsExtOffset, ssext, char *); - FIX (cbFdOffset, external_fdr, PTR); - FIX (cbRfdOffset, external_rfd, PTR); - FIX (cbExtOffset, external_ext, PTR); -#undef FIX - - /* I don't want to always swap all the data, because it will just - waste time and most programs will never look at it. The only - time the linker needs most of the debugging information swapped - is when linking big-endian and little-endian MIPS object files - together, which is not a common occurrence. - - We need to look at the fdr to deal with a lot of information in - the symbols, so we swap them here. */ - debug->fdr = (struct fdr *) bfd_alloc (abfd, - (internal_symhdr->ifdMax * - sizeof (struct fdr))); - if (debug->fdr == NULL) - return false; - external_fdr_size = backend->debug_swap.external_fdr_size; - fdr_ptr = debug->fdr; - fraw_src = (char *) debug->external_fdr; - fraw_end = fraw_src + internal_symhdr->ifdMax * external_fdr_size; - for (; fraw_src < fraw_end; fraw_src += external_fdr_size, fdr_ptr++) - (*backend->debug_swap.swap_fdr_in) (abfd, (PTR) fraw_src, fdr_ptr); - - return true; -} - -/* ECOFF symbol table routines. The ECOFF symbol table is described - in gcc/mips-tfile.c. */ - -/* ECOFF uses two common sections. One is the usual one, and the - other is for small objects. All the small objects are kept - together, and then referenced via the gp pointer, which yields - faster assembler code. This is what we use for the small common - section. */ -static asection ecoff_scom_section; -static asymbol ecoff_scom_symbol; -static asymbol *ecoff_scom_symbol_ptr; - -/* Create an empty symbol. */ - -asymbol * -_bfd_ecoff_make_empty_symbol (abfd) - bfd *abfd; -{ - ecoff_symbol_type *new; - - new = (ecoff_symbol_type *) bfd_alloc (abfd, sizeof (ecoff_symbol_type)); - 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; - new->native = NULL; - new->symbol.the_bfd = abfd; - return &new->symbol; -} - -/* Set the BFD flags and section for an ECOFF symbol. */ - -static boolean -ecoff_set_symbol_info (abfd, ecoff_sym, asym, ext, weak) - bfd *abfd; - SYMR *ecoff_sym; - asymbol *asym; - int ext; - int weak; -{ - asym->the_bfd = abfd; - asym->value = ecoff_sym->value; - asym->section = &bfd_debug_section; - asym->udata.i = 0; - - /* Most symbol types are just for debugging. */ - switch (ecoff_sym->st) - { - case stGlobal: - case stStatic: - case stLabel: - case stProc: - case stStaticProc: - break; - case stNil: - if (ECOFF_IS_STAB (ecoff_sym)) - { - asym->flags = BSF_DEBUGGING; - return true; - } - break; - default: - asym->flags = BSF_DEBUGGING; - return true; - } - - if (weak) - asym->flags = BSF_EXPORT | BSF_WEAK; - else if (ext) - asym->flags = BSF_EXPORT | BSF_GLOBAL; - else - { - asym->flags = BSF_LOCAL; - /* Normally, a local stProc symbol will have a corresponding - external symbol. We mark the local symbol as a debugging - symbol, in order to prevent nm from printing both out. - Similarly, we mark stLabel and stabs symbols as debugging - symbols. In both cases, we do want to set the value - correctly based on the symbol class. */ - if (ecoff_sym->st == stProc - || ecoff_sym->st == stLabel - || ECOFF_IS_STAB (ecoff_sym)) - asym->flags |= BSF_DEBUGGING; - } - switch (ecoff_sym->sc) - { - case scNil: - /* Used for compiler generated labels. Leave them in the - debugging section, and mark them as local. If BSF_DEBUGGING - is set, then nm does not display them for some reason. If no - flags are set then the linker whines about them. */ - asym->flags = BSF_LOCAL; - break; - case scText: - asym->section = bfd_make_section_old_way (abfd, ".text"); - asym->value -= asym->section->vma; - break; - case scData: - asym->section = bfd_make_section_old_way (abfd, ".data"); - asym->value -= asym->section->vma; - break; - case scBss: - asym->section = bfd_make_section_old_way (abfd, ".bss"); - asym->value -= asym->section->vma; - break; - case scRegister: - asym->flags = BSF_DEBUGGING; - break; - case scAbs: - asym->section = bfd_abs_section_ptr; - break; - case scUndefined: - asym->section = bfd_und_section_ptr; - asym->flags = 0; - asym->value = 0; - break; - case scCdbLocal: - case scBits: - case scCdbSystem: - case scRegImage: - case scInfo: - case scUserStruct: - asym->flags = BSF_DEBUGGING; - break; - case scSData: - asym->section = bfd_make_section_old_way (abfd, ".sdata"); - asym->value -= asym->section->vma; - break; - case scSBss: - asym->section = bfd_make_section_old_way (abfd, ".sbss"); - asym->value -= asym->section->vma; - break; - case scRData: - asym->section = bfd_make_section_old_way (abfd, ".rdata"); - asym->value -= asym->section->vma; - break; - case scVar: - asym->flags = BSF_DEBUGGING; - break; - case scCommon: - if (asym->value > ecoff_data (abfd)->gp_size) - { - asym->section = bfd_com_section_ptr; - asym->flags = 0; - break; - } - /* Fall through. */ - case scSCommon: - if (ecoff_scom_section.name == NULL) - { - /* Initialize the small common section. */ - ecoff_scom_section.name = SCOMMON; - ecoff_scom_section.flags = SEC_IS_COMMON; - ecoff_scom_section.output_section = &ecoff_scom_section; - ecoff_scom_section.symbol = &ecoff_scom_symbol; - ecoff_scom_section.symbol_ptr_ptr = &ecoff_scom_symbol_ptr; - ecoff_scom_symbol.name = SCOMMON; - ecoff_scom_symbol.flags = BSF_SECTION_SYM; - ecoff_scom_symbol.section = &ecoff_scom_section; - ecoff_scom_symbol_ptr = &ecoff_scom_symbol; - } - asym->section = &ecoff_scom_section; - asym->flags = 0; - break; - case scVarRegister: - case scVariant: - asym->flags = BSF_DEBUGGING; - break; - case scSUndefined: - asym->section = bfd_und_section_ptr; - asym->flags = 0; - asym->value = 0; - break; - case scInit: - asym->section = bfd_make_section_old_way (abfd, ".init"); - asym->value -= asym->section->vma; - break; - case scBasedVar: - case scXData: - case scPData: - asym->flags = BSF_DEBUGGING; - break; - case scFini: - asym->section = bfd_make_section_old_way (abfd, ".fini"); - asym->value -= asym->section->vma; - break; - case scRConst: - asym->section = bfd_make_section_old_way (abfd, ".rconst"); - asym->value -= asym->section->vma; - break; - default: - break; - } - - /* Look for special constructors symbols and make relocation entries - in a special construction section. These are produced by the - -fgnu-linker argument to g++. */ - if (ECOFF_IS_STAB (ecoff_sym)) - { - switch (ECOFF_UNMARK_STAB (ecoff_sym->index)) - { - default: - break; - - case N_SETA: - case N_SETT: - case N_SETD: - case N_SETB: - { - const char *name; - asection *section; - arelent_chain *reloc_chain; - unsigned int bitsize; - - /* Get a section with the same name as the symbol (usually - __CTOR_LIST__ or __DTOR_LIST__). FIXME: gcc uses the - name ___CTOR_LIST (three underscores). We need - __CTOR_LIST (two underscores), since ECOFF doesn't use - a leading underscore. This should be handled by gcc, - but instead we do it here. Actually, this should all - be done differently anyhow. */ - name = bfd_asymbol_name (asym); - if (name[0] == '_' && name[1] == '_' && name[2] == '_') - { - ++name; - asym->name = name; - } - section = bfd_get_section_by_name (abfd, name); - if (section == (asection *) NULL) - { - char *copy; - - copy = (char *) bfd_alloc (abfd, strlen (name) + 1); - if (!copy) - return false; - strcpy (copy, name); - section = bfd_make_section (abfd, copy); - } - - /* Build a reloc pointing to this constructor. */ - reloc_chain = - (arelent_chain *) bfd_alloc (abfd, sizeof (arelent_chain)); - if (!reloc_chain) - return false; - reloc_chain->relent.sym_ptr_ptr = - bfd_get_section (asym)->symbol_ptr_ptr; - reloc_chain->relent.address = section->_raw_size; - reloc_chain->relent.addend = asym->value; - reloc_chain->relent.howto = - ecoff_backend (abfd)->constructor_reloc; - - /* Set up the constructor section to hold the reloc. */ - section->flags = SEC_CONSTRUCTOR; - ++section->reloc_count; - - /* Constructor sections must be rounded to a boundary - based on the bitsize. These are not real sections-- - they are handled specially by the linker--so the ECOFF - 16 byte alignment restriction does not apply. */ - bitsize = ecoff_backend (abfd)->constructor_bitsize; - section->alignment_power = 1; - while ((1 << section->alignment_power) < bitsize / 8) - ++section->alignment_power; - - reloc_chain->next = section->constructor_chain; - section->constructor_chain = reloc_chain; - section->_raw_size += bitsize / 8; - - /* Mark the symbol as a constructor. */ - asym->flags |= BSF_CONSTRUCTOR; - } - break; - } - } - return true; -} - -/* Read an ECOFF symbol table. */ - -boolean -_bfd_ecoff_slurp_symbol_table (abfd) - bfd *abfd; -{ - const struct ecoff_backend_data * const backend = ecoff_backend (abfd); - const bfd_size_type external_ext_size - = backend->debug_swap.external_ext_size; - const bfd_size_type external_sym_size - = backend->debug_swap.external_sym_size; - void (* const swap_ext_in) PARAMS ((bfd *, PTR, EXTR *)) - = backend->debug_swap.swap_ext_in; - void (* const swap_sym_in) PARAMS ((bfd *, PTR, SYMR *)) - = backend->debug_swap.swap_sym_in; - bfd_size_type internal_size; - ecoff_symbol_type *internal; - ecoff_symbol_type *internal_ptr; - char *eraw_src; - char *eraw_end; - FDR *fdr_ptr; - FDR *fdr_end; - - /* If we've already read in the symbol table, do nothing. */ - if (ecoff_data (abfd)->canonical_symbols != NULL) - return true; - - /* Get the symbolic information. */ - if (! _bfd_ecoff_slurp_symbolic_info (abfd, (asection *) NULL, - &ecoff_data (abfd)->debug_info)) - return false; - if (bfd_get_symcount (abfd) == 0) - return true; - - internal_size = bfd_get_symcount (abfd) * sizeof (ecoff_symbol_type); - internal = (ecoff_symbol_type *) bfd_alloc (abfd, internal_size); - if (internal == NULL) - return false; - - internal_ptr = internal; - eraw_src = (char *) ecoff_data (abfd)->debug_info.external_ext; - eraw_end = (eraw_src - + (ecoff_data (abfd)->debug_info.symbolic_header.iextMax - * external_ext_size)); - for (; eraw_src < eraw_end; eraw_src += external_ext_size, internal_ptr++) - { - EXTR internal_esym; - - (*swap_ext_in) (abfd, (PTR) eraw_src, &internal_esym); - internal_ptr->symbol.name = (ecoff_data (abfd)->debug_info.ssext - + internal_esym.asym.iss); - if (!ecoff_set_symbol_info (abfd, &internal_esym.asym, - &internal_ptr->symbol, 1, - internal_esym.weakext)) - return false; - /* The alpha uses a negative ifd field for section symbols. */ - if (internal_esym.ifd >= 0) - internal_ptr->fdr = (ecoff_data (abfd)->debug_info.fdr - + internal_esym.ifd); - else - internal_ptr->fdr = NULL; - internal_ptr->local = false; - internal_ptr->native = (PTR) eraw_src; - } - - /* The local symbols must be accessed via the fdr's, because the - string and aux indices are relative to the fdr information. */ - fdr_ptr = ecoff_data (abfd)->debug_info.fdr; - fdr_end = fdr_ptr + ecoff_data (abfd)->debug_info.symbolic_header.ifdMax; - for (; fdr_ptr < fdr_end; fdr_ptr++) - { - char *lraw_src; - char *lraw_end; - - lraw_src = ((char *) ecoff_data (abfd)->debug_info.external_sym - + fdr_ptr->isymBase * external_sym_size); - lraw_end = lraw_src + fdr_ptr->csym * external_sym_size; - for (; - lraw_src < lraw_end; - lraw_src += external_sym_size, internal_ptr++) - { - SYMR internal_sym; - - (*swap_sym_in) (abfd, (PTR) lraw_src, &internal_sym); - internal_ptr->symbol.name = (ecoff_data (abfd)->debug_info.ss - + fdr_ptr->issBase - + internal_sym.iss); - if (!ecoff_set_symbol_info (abfd, &internal_sym, - &internal_ptr->symbol, 0, 0)) - return false; - internal_ptr->fdr = fdr_ptr; - internal_ptr->local = true; - internal_ptr->native = (PTR) lraw_src; - } - } - - ecoff_data (abfd)->canonical_symbols = internal; - - return true; -} - -/* Return the amount of space needed for the canonical symbols. */ - -long -_bfd_ecoff_get_symtab_upper_bound (abfd) - bfd *abfd; -{ - if (! _bfd_ecoff_slurp_symbolic_info (abfd, (asection *) NULL, - &ecoff_data (abfd)->debug_info)) - return -1; - - if (bfd_get_symcount (abfd) == 0) - return 0; - - return (bfd_get_symcount (abfd) + 1) * (sizeof (ecoff_symbol_type *)); -} - -/* Get the canonical symbols. */ - -long -_bfd_ecoff_get_symtab (abfd, alocation) - bfd *abfd; - asymbol **alocation; -{ - unsigned int counter = 0; - ecoff_symbol_type *symbase; - ecoff_symbol_type **location = (ecoff_symbol_type **) alocation; - - if (_bfd_ecoff_slurp_symbol_table (abfd) == false) - return -1; - if (bfd_get_symcount (abfd) == 0) - return 0; - - symbase = ecoff_data (abfd)->canonical_symbols; - while (counter < bfd_get_symcount (abfd)) - { - *(location++) = symbase++; - counter++; - } - *location++ = (ecoff_symbol_type *) NULL; - return bfd_get_symcount (abfd); -} - -/* Turn ECOFF type information into a printable string. - ecoff_emit_aggregate and ecoff_type_to_string are from - gcc/mips-tdump.c, with swapping added and used_ptr removed. */ - -/* Write aggregate information to a string. */ - -static void -ecoff_emit_aggregate (abfd, fdr, string, rndx, isym, which) - bfd *abfd; - FDR *fdr; - char *string; - RNDXR *rndx; - long isym; - const char *which; -{ - const struct ecoff_debug_swap * const debug_swap = - &ecoff_backend (abfd)->debug_swap; - struct ecoff_debug_info * const debug_info = &ecoff_data (abfd)->debug_info; - unsigned int ifd = rndx->rfd; - unsigned int indx = rndx->index; - const char *name; - - if (ifd == 0xfff) - ifd = isym; - - /* An ifd of -1 is an opaque type. An escaped index of 0 is a - struct return type of a procedure compiled without -g. */ - if (ifd == 0xffffffff - || (rndx->rfd == 0xfff && indx == 0)) - name = ""; - else if (indx == indexNil) - name = ""; - else - { - SYMR sym; - - if (debug_info->external_rfd == NULL) - fdr = debug_info->fdr + ifd; - else - { - RFDT rfd; - - (*debug_swap->swap_rfd_in) (abfd, - ((char *) debug_info->external_rfd - + ((fdr->rfdBase + ifd) - * debug_swap->external_rfd_size)), - &rfd); - fdr = debug_info->fdr + rfd; - } - - indx += fdr->isymBase; - - (*debug_swap->swap_sym_in) (abfd, - ((char *) debug_info->external_sym - + indx * debug_swap->external_sym_size), - &sym); - - name = debug_info->ss + fdr->issBase + sym.iss; - } - - sprintf (string, - "%s %s { ifd = %u, index = %lu }", - which, name, ifd, - ((long) indx - + debug_info->symbolic_header.iextMax)); -} - -/* Convert the type information to string format. */ - -static char * -ecoff_type_to_string (abfd, fdr, indx) - bfd *abfd; - FDR *fdr; - unsigned int indx; -{ - union aux_ext *aux_ptr; - int bigendian; - AUXU u; - struct qual { - unsigned int type; - int low_bound; - int high_bound; - int stride; - } qualifiers[7]; - unsigned int basic_type; - int i; - char buffer1[1024]; - static char buffer2[1024]; - char *p1 = buffer1; - char *p2 = buffer2; - RNDXR rndx; - - aux_ptr = ecoff_data (abfd)->debug_info.external_aux + fdr->iauxBase; - bigendian = fdr->fBigendian; - - for (i = 0; i < 7; i++) - { - qualifiers[i].low_bound = 0; - qualifiers[i].high_bound = 0; - qualifiers[i].stride = 0; - } - - if (AUX_GET_ISYM (bigendian, &aux_ptr[indx]) == (bfd_vma) -1) - return "-1 (no type)"; - _bfd_ecoff_swap_tir_in (bigendian, &aux_ptr[indx++].a_ti, &u.ti); - - basic_type = u.ti.bt; - qualifiers[0].type = u.ti.tq0; - qualifiers[1].type = u.ti.tq1; - qualifiers[2].type = u.ti.tq2; - qualifiers[3].type = u.ti.tq3; - qualifiers[4].type = u.ti.tq4; - qualifiers[5].type = u.ti.tq5; - qualifiers[6].type = tqNil; - - /* - * Go get the basic type. - */ - switch (basic_type) - { - case btNil: /* undefined */ - strcpy (p1, "nil"); - break; - - case btAdr: /* address - integer same size as pointer */ - strcpy (p1, "address"); - break; - - case btChar: /* character */ - strcpy (p1, "char"); - break; - - case btUChar: /* unsigned character */ - strcpy (p1, "unsigned char"); - break; - - case btShort: /* short */ - strcpy (p1, "short"); - break; - - case btUShort: /* unsigned short */ - strcpy (p1, "unsigned short"); - break; - - case btInt: /* int */ - strcpy (p1, "int"); - break; - - case btUInt: /* unsigned int */ - strcpy (p1, "unsigned int"); - break; - - case btLong: /* long */ - strcpy (p1, "long"); - break; - - case btULong: /* unsigned long */ - strcpy (p1, "unsigned long"); - break; - - case btFloat: /* float (real) */ - strcpy (p1, "float"); - break; - - case btDouble: /* Double (real) */ - strcpy (p1, "double"); - break; - - /* Structures add 1-2 aux words: - 1st word is [ST_RFDESCAPE, offset] pointer to struct def; - 2nd word is file index if 1st word rfd is ST_RFDESCAPE. */ - - case btStruct: /* Structure (Record) */ - _bfd_ecoff_swap_rndx_in (bigendian, &aux_ptr[indx].a_rndx, &rndx); - ecoff_emit_aggregate (abfd, fdr, p1, &rndx, - (long) AUX_GET_ISYM (bigendian, &aux_ptr[indx+1]), - "struct"); - indx++; /* skip aux words */ - break; - - /* Unions add 1-2 aux words: - 1st word is [ST_RFDESCAPE, offset] pointer to union def; - 2nd word is file index if 1st word rfd is ST_RFDESCAPE. */ - - case btUnion: /* Union */ - _bfd_ecoff_swap_rndx_in (bigendian, &aux_ptr[indx].a_rndx, &rndx); - ecoff_emit_aggregate (abfd, fdr, p1, &rndx, - (long) AUX_GET_ISYM (bigendian, &aux_ptr[indx+1]), - "union"); - indx++; /* skip aux words */ - break; - - /* Enumerations add 1-2 aux words: - 1st word is [ST_RFDESCAPE, offset] pointer to enum def; - 2nd word is file index if 1st word rfd is ST_RFDESCAPE. */ - - case btEnum: /* Enumeration */ - _bfd_ecoff_swap_rndx_in (bigendian, &aux_ptr[indx].a_rndx, &rndx); - ecoff_emit_aggregate (abfd, fdr, p1, &rndx, - (long) AUX_GET_ISYM (bigendian, &aux_ptr[indx+1]), - "enum"); - indx++; /* skip aux words */ - break; - - case btTypedef: /* defined via a typedef, isymRef points */ - strcpy (p1, "typedef"); - break; - - case btRange: /* subrange of int */ - strcpy (p1, "subrange"); - break; - - case btSet: /* pascal sets */ - strcpy (p1, "set"); - break; - - case btComplex: /* fortran complex */ - strcpy (p1, "complex"); - break; - - case btDComplex: /* fortran double complex */ - strcpy (p1, "double complex"); - break; - - case btIndirect: /* forward or unnamed typedef */ - strcpy (p1, "forward/unamed typedef"); - break; - - case btFixedDec: /* Fixed Decimal */ - strcpy (p1, "fixed decimal"); - break; - - case btFloatDec: /* Float Decimal */ - strcpy (p1, "float decimal"); - break; - - case btString: /* Varying Length Character String */ - strcpy (p1, "string"); - break; - - case btBit: /* Aligned Bit String */ - strcpy (p1, "bit"); - break; - - case btPicture: /* Picture */ - strcpy (p1, "picture"); - break; - - case btVoid: /* Void */ - strcpy (p1, "void"); - break; - - default: - sprintf (p1, "Unknown basic type %d", (int) basic_type); - break; - } - - p1 += strlen (buffer1); - - /* - * If this is a bitfield, get the bitsize. - */ - if (u.ti.fBitfield) - { - int bitsize; - - bitsize = AUX_GET_WIDTH (bigendian, &aux_ptr[indx++]); - sprintf (p1, " : %d", bitsize); - p1 += strlen (buffer1); - } - - - /* - * Deal with any qualifiers. - */ - if (qualifiers[0].type != tqNil) - { - /* - * Snarf up any array bounds in the correct order. Arrays - * store 5 successive words in the aux. table: - * word 0 RNDXR to type of the bounds (ie, int) - * word 1 Current file descriptor index - * word 2 low bound - * word 3 high bound (or -1 if []) - * word 4 stride size in bits - */ - for (i = 0; i < 7; i++) - { - if (qualifiers[i].type == tqArray) - { - qualifiers[i].low_bound = - AUX_GET_DNLOW (bigendian, &aux_ptr[indx+2]); - qualifiers[i].high_bound = - AUX_GET_DNHIGH (bigendian, &aux_ptr[indx+3]); - qualifiers[i].stride = - AUX_GET_WIDTH (bigendian, &aux_ptr[indx+4]); - indx += 5; - } - } - - /* - * Now print out the qualifiers. - */ - for (i = 0; i < 6; i++) - { - switch (qualifiers[i].type) - { - case tqNil: - case tqMax: - break; - - case tqPtr: - strcpy (p2, "ptr to "); - p2 += sizeof ("ptr to ")-1; - break; - - case tqVol: - strcpy (p2, "volatile "); - p2 += sizeof ("volatile ")-1; - break; - - case tqFar: - strcpy (p2, "far "); - p2 += sizeof ("far ")-1; - break; - - case tqProc: - strcpy (p2, "func. ret. "); - p2 += sizeof ("func. ret. "); - break; - - case tqArray: - { - int first_array = i; - int j; - - /* Print array bounds reversed (ie, in the order the C - programmer writes them). C is such a fun language.... */ - - while (i < 5 && qualifiers[i+1].type == tqArray) - i++; - - for (j = i; j >= first_array; j--) - { - strcpy (p2, "array ["); - p2 += sizeof ("array [")-1; - if (qualifiers[j].low_bound != 0) - sprintf (p2, - "%ld:%ld {%ld bits}", - (long) qualifiers[j].low_bound, - (long) qualifiers[j].high_bound, - (long) qualifiers[j].stride); - - else if (qualifiers[j].high_bound != -1) - sprintf (p2, - "%ld {%ld bits}", - (long) (qualifiers[j].high_bound + 1), - (long) (qualifiers[j].stride)); - - else - sprintf (p2, " {%ld bits}", (long) (qualifiers[j].stride)); - - p2 += strlen (p2); - strcpy (p2, "] of "); - p2 += sizeof ("] of ")-1; - } - } - break; - } - } - } - - strcpy (p2, buffer1); - return buffer2; -} - -/* Return information about ECOFF symbol SYMBOL in RET. */ - -/*ARGSUSED*/ -void -_bfd_ecoff_get_symbol_info (abfd, symbol, ret) - bfd *abfd; /* Ignored. */ - asymbol *symbol; - symbol_info *ret; -{ - bfd_symbol_info (symbol, ret); -} - -/* Return whether this is a local label. */ - -/*ARGSUSED*/ -boolean -_bfd_ecoff_bfd_is_local_label (abfd, symbol) - bfd *abfd; - asymbol *symbol; -{ - return symbol->name[0] == '$'; -} - -/* Print information about an ECOFF symbol. */ - -void -_bfd_ecoff_print_symbol (abfd, filep, symbol, how) - bfd *abfd; - PTR filep; - asymbol *symbol; - bfd_print_symbol_type how; -{ - const struct ecoff_debug_swap * const debug_swap - = &ecoff_backend (abfd)->debug_swap; - FILE *file = (FILE *)filep; - - switch (how) - { - case bfd_print_symbol_name: - fprintf (file, "%s", symbol->name); - break; - case bfd_print_symbol_more: - if (ecoffsymbol (symbol)->local) - { - SYMR ecoff_sym; - - (*debug_swap->swap_sym_in) (abfd, ecoffsymbol (symbol)->native, - &ecoff_sym); - fprintf (file, "ecoff local "); - fprintf_vma (file, (bfd_vma) ecoff_sym.value); - fprintf (file, " %x %x", (unsigned) ecoff_sym.st, - (unsigned) ecoff_sym.sc); - } - else - { - EXTR ecoff_ext; - - (*debug_swap->swap_ext_in) (abfd, ecoffsymbol (symbol)->native, - &ecoff_ext); - fprintf (file, "ecoff extern "); - fprintf_vma (file, (bfd_vma) ecoff_ext.asym.value); - fprintf (file, " %x %x", (unsigned) ecoff_ext.asym.st, - (unsigned) ecoff_ext.asym.sc); - } - break; - case bfd_print_symbol_all: - /* Print out the symbols in a reasonable way */ - { - char type; - int pos; - EXTR ecoff_ext; - char jmptbl; - char cobol_main; - char weakext; - - if (ecoffsymbol (symbol)->local) - { - (*debug_swap->swap_sym_in) (abfd, ecoffsymbol (symbol)->native, - &ecoff_ext.asym); - type = 'l'; - pos = ((((char *) ecoffsymbol (symbol)->native - - (char *) ecoff_data (abfd)->debug_info.external_sym) - / debug_swap->external_sym_size) - + ecoff_data (abfd)->debug_info.symbolic_header.iextMax); - jmptbl = ' '; - cobol_main = ' '; - weakext = ' '; - } - else - { - (*debug_swap->swap_ext_in) (abfd, ecoffsymbol (symbol)->native, - &ecoff_ext); - type = 'e'; - pos = (((char *) ecoffsymbol (symbol)->native - - (char *) ecoff_data (abfd)->debug_info.external_ext) - / debug_swap->external_ext_size); - jmptbl = ecoff_ext.jmptbl ? 'j' : ' '; - cobol_main = ecoff_ext.cobol_main ? 'c' : ' '; - weakext = ecoff_ext.weakext ? 'w' : ' '; - } - - fprintf (file, "[%3d] %c ", - pos, type); - fprintf_vma (file, (bfd_vma) ecoff_ext.asym.value); - fprintf (file, " st %x sc %x indx %x %c%c%c %s", - (unsigned) ecoff_ext.asym.st, - (unsigned) ecoff_ext.asym.sc, - (unsigned) ecoff_ext.asym.index, - jmptbl, cobol_main, weakext, - symbol->name); - - if (ecoffsymbol (symbol)->fdr != NULL - && ecoff_ext.asym.index != indexNil) - { - FDR *fdr; - unsigned int indx; - int bigendian; - bfd_size_type sym_base; - union aux_ext *aux_base; - - fdr = ecoffsymbol (symbol)->fdr; - indx = ecoff_ext.asym.index; - - /* sym_base is used to map the fdr relative indices which - appear in the file to the position number which we are - using. */ - sym_base = fdr->isymBase; - if (ecoffsymbol (symbol)->local) - sym_base += - ecoff_data (abfd)->debug_info.symbolic_header.iextMax; - - /* aux_base is the start of the aux entries for this file; - asym.index is an offset from this. */ - aux_base = (ecoff_data (abfd)->debug_info.external_aux - + fdr->iauxBase); - - /* The aux entries are stored in host byte order; the - order is indicated by a bit in the fdr. */ - bigendian = fdr->fBigendian; - - /* This switch is basically from gcc/mips-tdump.c */ - switch (ecoff_ext.asym.st) - { - case stNil: - case stLabel: - break; - - case stFile: - case stBlock: - fprintf (file, "\n End+1 symbol: %ld", - (long) (indx + sym_base)); - break; - - case stEnd: - if (ecoff_ext.asym.sc == scText - || ecoff_ext.asym.sc == scInfo) - fprintf (file, "\n First symbol: %ld", - (long) (indx + sym_base)); - else - fprintf (file, "\n First symbol: %ld", - ((long) - (AUX_GET_ISYM (bigendian, - &aux_base[ecoff_ext.asym.index]) - + sym_base))); - break; - - case stProc: - case stStaticProc: - if (ECOFF_IS_STAB (&ecoff_ext.asym)) - ; - else if (ecoffsymbol (symbol)->local) - fprintf (file, "\n End+1 symbol: %-7ld Type: %s", - ((long) - (AUX_GET_ISYM (bigendian, - &aux_base[ecoff_ext.asym.index]) - + sym_base)), - ecoff_type_to_string (abfd, fdr, indx + 1)); - else - fprintf (file, "\n Local symbol: %ld", - ((long) indx - + (long) sym_base - + (ecoff_data (abfd) - ->debug_info.symbolic_header.iextMax))); - break; - - case stStruct: - fprintf (file, "\n struct; End+1 symbol: %ld", - (long) (indx + sym_base)); - break; - - case stUnion: - fprintf (file, "\n union; End+1 symbol: %ld", - (long) (indx + sym_base)); - break; - - case stEnum: - fprintf (file, "\n enum; End+1 symbol: %ld", - (long) (indx + sym_base)); - break; - - default: - if (! ECOFF_IS_STAB (&ecoff_ext.asym)) - fprintf (file, "\n Type: %s", - ecoff_type_to_string (abfd, fdr, indx)); - break; - } - } - } - break; - } -} - -/* Read in the relocs for a section. */ - -static boolean -ecoff_slurp_reloc_table (abfd, section, symbols) - bfd *abfd; - asection *section; - asymbol **symbols; -{ - const struct ecoff_backend_data * const backend = ecoff_backend (abfd); - arelent *internal_relocs; - bfd_size_type external_reloc_size; - bfd_size_type external_relocs_size; - char *external_relocs; - arelent *rptr; - unsigned int i; - - if (section->relocation != (arelent *) NULL - || section->reloc_count == 0 - || (section->flags & SEC_CONSTRUCTOR) != 0) - return true; - - if (_bfd_ecoff_slurp_symbol_table (abfd) == false) - return false; - - internal_relocs = (arelent *) bfd_alloc (abfd, - (sizeof (arelent) - * section->reloc_count)); - external_reloc_size = backend->external_reloc_size; - external_relocs_size = external_reloc_size * section->reloc_count; - external_relocs = (char *) bfd_alloc (abfd, external_relocs_size); - if (internal_relocs == (arelent *) NULL - || external_relocs == (char *) NULL) - return false; - if (bfd_seek (abfd, section->rel_filepos, SEEK_SET) != 0) - return false; - if (bfd_read (external_relocs, 1, external_relocs_size, abfd) - != external_relocs_size) - return false; - - for (i = 0, rptr = internal_relocs; i < section->reloc_count; i++, rptr++) - { - struct internal_reloc intern; - - (*backend->swap_reloc_in) (abfd, - external_relocs + i * external_reloc_size, - &intern); - - if (intern.r_extern) - { - /* r_symndx is an index into the external symbols. */ - BFD_ASSERT (intern.r_symndx >= 0 - && (intern.r_symndx - < (ecoff_data (abfd) - ->debug_info.symbolic_header.iextMax))); - rptr->sym_ptr_ptr = symbols + intern.r_symndx; - rptr->addend = 0; - } - else if (intern.r_symndx == RELOC_SECTION_NONE - || intern.r_symndx == RELOC_SECTION_ABS) - { - rptr->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; - rptr->addend = 0; - } - else - { - CONST char *sec_name; - asection *sec; - - /* r_symndx is a section key. */ - switch (intern.r_symndx) - { - case RELOC_SECTION_TEXT: sec_name = ".text"; break; - case RELOC_SECTION_RDATA: sec_name = ".rdata"; break; - case RELOC_SECTION_DATA: sec_name = ".data"; break; - case RELOC_SECTION_SDATA: sec_name = ".sdata"; break; - case RELOC_SECTION_SBSS: sec_name = ".sbss"; break; - case RELOC_SECTION_BSS: sec_name = ".bss"; break; - case RELOC_SECTION_INIT: sec_name = ".init"; break; - case RELOC_SECTION_LIT8: sec_name = ".lit8"; break; - case RELOC_SECTION_LIT4: sec_name = ".lit4"; break; - case RELOC_SECTION_XDATA: sec_name = ".xdata"; break; - case RELOC_SECTION_PDATA: sec_name = ".pdata"; break; - case RELOC_SECTION_FINI: sec_name = ".fini"; break; - case RELOC_SECTION_LITA: sec_name = ".lita"; break; - case RELOC_SECTION_RCONST: sec_name = ".rconst"; break; - default: abort (); - } - - sec = bfd_get_section_by_name (abfd, sec_name); - if (sec == (asection *) NULL) - abort (); - rptr->sym_ptr_ptr = sec->symbol_ptr_ptr; - - rptr->addend = - bfd_get_section_vma (abfd, sec); - } - - rptr->address = intern.r_vaddr - bfd_get_section_vma (abfd, section); - - /* Let the backend select the howto field and do any other - required processing. */ - (*backend->adjust_reloc_in) (abfd, &intern, rptr); - } - - bfd_release (abfd, external_relocs); - - section->relocation = internal_relocs; - - return true; -} - -/* Get a canonical list of relocs. */ - -long -_bfd_ecoff_canonicalize_reloc (abfd, section, relptr, symbols) - bfd *abfd; - asection *section; - arelent **relptr; - asymbol **symbols; -{ - unsigned int count; - - if (section->flags & SEC_CONSTRUCTOR) - { - arelent_chain *chain; - - /* This section has relocs made up by us, not the file, so take - them out of their chain and place them into the data area - provided. */ - for (count = 0, chain = section->constructor_chain; - count < section->reloc_count; - count++, chain = chain->next) - *relptr++ = &chain->relent; - } - else - { - arelent *tblptr; - - if (ecoff_slurp_reloc_table (abfd, section, symbols) == false) - return -1; - - tblptr = section->relocation; - - for (count = 0; count < section->reloc_count; count++) - *relptr++ = tblptr++; - } - - *relptr = (arelent *) NULL; - - return section->reloc_count; -} - -/* Provided a BFD, a section and an offset into the section, calculate - and return the name of the source file and the line nearest to the - wanted location. */ - -/*ARGSUSED*/ -boolean -_bfd_ecoff_find_nearest_line (abfd, section, ignore_symbols, offset, - filename_ptr, functionname_ptr, retline_ptr) - bfd *abfd; - asection *section; - asymbol **ignore_symbols; - bfd_vma offset; - CONST char **filename_ptr; - CONST char **functionname_ptr; - unsigned int *retline_ptr; -{ - const struct ecoff_debug_swap * const debug_swap - = &ecoff_backend (abfd)->debug_swap; - struct ecoff_debug_info * const debug_info = &ecoff_data (abfd)->debug_info; - struct ecoff_find_line *line_info; - - /* Make sure we have the FDR's. */ - if (! _bfd_ecoff_slurp_symbolic_info (abfd, (asection *) NULL, debug_info) - || bfd_get_symcount (abfd) == 0) - return false; - - if (ecoff_data (abfd)->find_line_info == NULL) - { - ecoff_data (abfd)->find_line_info = - ((struct ecoff_find_line *) - bfd_alloc (abfd, sizeof (struct ecoff_find_line))); - if (ecoff_data (abfd)->find_line_info == NULL) - return false; - ecoff_data (abfd)->find_line_info->find_buffer = NULL; - ecoff_data (abfd)->find_line_info->fdrtab_len = 0; - ecoff_data (abfd)->find_line_info->fdrtab = NULL; - } - line_info = ecoff_data (abfd)->find_line_info; - - return _bfd_ecoff_locate_line (abfd, section, offset, debug_info, - debug_swap, line_info, filename_ptr, - functionname_ptr, retline_ptr); -} - -/* Copy private BFD data. This is called by objcopy and strip. We - use it to copy the ECOFF debugging information from one BFD to the - other. It would be theoretically possible to represent the ECOFF - debugging information in the symbol table. However, it would be a - lot of work, and there would be little gain (gas, gdb, and ld - already access the ECOFF debugging information via the - ecoff_debug_info structure, and that structure would have to be - retained in order to support ECOFF debugging in MIPS ELF). - - The debugging information for the ECOFF external symbols comes from - the symbol table, so this function only handles the other debugging - information. */ - -boolean -_bfd_ecoff_bfd_copy_private_bfd_data (ibfd, obfd) - bfd *ibfd; - bfd *obfd; -{ - struct ecoff_debug_info *iinfo = &ecoff_data (ibfd)->debug_info; - struct ecoff_debug_info *oinfo = &ecoff_data (obfd)->debug_info; - register int i; - asymbol **sym_ptr_ptr; - size_t c; - boolean local; - - /* This function is selected based on the input vector. We only - want to copy information over if the output BFD also uses ECOFF - format. */ - if (bfd_get_flavour (obfd) != bfd_target_ecoff_flavour) - return true; - - /* Copy the GP value and the register masks. */ - ecoff_data (obfd)->gp = ecoff_data (ibfd)->gp; - ecoff_data (obfd)->gprmask = ecoff_data (ibfd)->gprmask; - ecoff_data (obfd)->fprmask = ecoff_data (ibfd)->fprmask; - for (i = 0; i < 3; i++) - ecoff_data (obfd)->cprmask[i] = ecoff_data (ibfd)->cprmask[i]; - - /* Copy the version stamp. */ - oinfo->symbolic_header.vstamp = iinfo->symbolic_header.vstamp; - - /* If there are no symbols, don't copy any debugging information. */ - c = bfd_get_symcount (obfd); - sym_ptr_ptr = bfd_get_outsymbols (obfd); - if (c == 0 || sym_ptr_ptr == (asymbol **) NULL) - return true; - - /* See if there are any local symbols. */ - local = false; - for (; c > 0; c--, sym_ptr_ptr++) - { - if (ecoffsymbol (*sym_ptr_ptr)->local) - { - local = true; - break; - } - } - - if (local) - { - /* There are some local symbols. We just bring over all the - debugging information. FIXME: This is not quite the right - thing to do. If the user has asked us to discard all - debugging information, then we are probably going to wind up - keeping it because there will probably be some local symbol - which objcopy did not discard. We should actually break - apart the debugging information and only keep that which - applies to the symbols we want to keep. */ - oinfo->symbolic_header.ilineMax = iinfo->symbolic_header.ilineMax; - oinfo->symbolic_header.cbLine = iinfo->symbolic_header.cbLine; - oinfo->line = iinfo->line; - - oinfo->symbolic_header.idnMax = iinfo->symbolic_header.idnMax; - oinfo->external_dnr = iinfo->external_dnr; - - oinfo->symbolic_header.ipdMax = iinfo->symbolic_header.ipdMax; - oinfo->external_pdr = iinfo->external_pdr; - - oinfo->symbolic_header.isymMax = iinfo->symbolic_header.isymMax; - oinfo->external_sym = iinfo->external_sym; - - oinfo->symbolic_header.ioptMax = iinfo->symbolic_header.ioptMax; - oinfo->external_opt = iinfo->external_opt; - - oinfo->symbolic_header.iauxMax = iinfo->symbolic_header.iauxMax; - oinfo->external_aux = iinfo->external_aux; - - oinfo->symbolic_header.issMax = iinfo->symbolic_header.issMax; - oinfo->ss = iinfo->ss; - - oinfo->symbolic_header.ifdMax = iinfo->symbolic_header.ifdMax; - oinfo->external_fdr = iinfo->external_fdr; - - oinfo->symbolic_header.crfd = iinfo->symbolic_header.crfd; - oinfo->external_rfd = iinfo->external_rfd; - } - else - { - /* We are discarding all the local symbol information. Look - through the external symbols and remove all references to FDR - or aux information. */ - c = bfd_get_symcount (obfd); - sym_ptr_ptr = bfd_get_outsymbols (obfd); - for (; c > 0; c--, sym_ptr_ptr++) - { - EXTR esym; - - (*(ecoff_backend (obfd)->debug_swap.swap_ext_in)) - (obfd, ecoffsymbol (*sym_ptr_ptr)->native, &esym); - esym.ifd = ifdNil; - esym.asym.index = indexNil; - (*(ecoff_backend (obfd)->debug_swap.swap_ext_out)) - (obfd, &esym, ecoffsymbol (*sym_ptr_ptr)->native); - } - } - - return true; -} - -/* Set the architecture. The supported architecture is stored in the - backend pointer. We always set the architecture anyhow, since many - callers ignore the return value. */ - -boolean -_bfd_ecoff_set_arch_mach (abfd, arch, machine) - bfd *abfd; - enum bfd_architecture arch; - unsigned long machine; -{ - bfd_default_set_arch_mach (abfd, arch, machine); - return arch == ecoff_backend (abfd)->arch; -} - -/* Get the size of the section headers. */ - -/*ARGSUSED*/ -int -_bfd_ecoff_sizeof_headers (abfd, reloc) - bfd *abfd; - boolean reloc; -{ - asection *current; - int c; - int ret; - - c = 0; - for (current = abfd->sections; - current != (asection *)NULL; - current = current->next) - ++c; - - ret = (bfd_coff_filhsz (abfd) - + bfd_coff_aoutsz (abfd) - + c * bfd_coff_scnhsz (abfd)); - return BFD_ALIGN (ret, 16); -} - -/* Get the contents of a section. */ - -boolean -_bfd_ecoff_get_section_contents (abfd, section, location, offset, count) - bfd *abfd; - asection *section; - PTR location; - file_ptr offset; - bfd_size_type count; -{ - return _bfd_generic_get_section_contents (abfd, section, location, - offset, count); -} - -/* Sort sections by VMA, but put SEC_ALLOC sections first. This is - called via qsort. */ - -static int -ecoff_sort_hdrs (arg1, arg2) - const PTR arg1; - const PTR arg2; -{ - const asection *hdr1 = *(const asection **) arg1; - const asection *hdr2 = *(const asection **) arg2; - - if ((hdr1->flags & SEC_ALLOC) != 0) - { - if ((hdr2->flags & SEC_ALLOC) == 0) - return -1; - } - else - { - if ((hdr2->flags & SEC_ALLOC) != 0) - return 1; - } - if (hdr1->vma < hdr2->vma) - return -1; - else if (hdr1->vma > hdr2->vma) - return 1; - else - return 0; -} - -/* Calculate the file position for each section, and set - reloc_filepos. */ - -static boolean -ecoff_compute_section_file_positions (abfd) - bfd *abfd; -{ - file_ptr sofar; - asection **sorted_hdrs; - asection *current; - unsigned int i; - file_ptr old_sofar; - boolean first_data, first_nonalloc; - const bfd_vma round = ecoff_backend (abfd)->round; - - sofar = _bfd_ecoff_sizeof_headers (abfd, false); - - /* Sort the sections by VMA. */ - sorted_hdrs = (asection **) bfd_malloc (abfd->section_count - * sizeof (asection *)); - if (sorted_hdrs == NULL) - return false; - for (current = abfd->sections, i = 0; - current != NULL; - current = current->next, i++) - sorted_hdrs[i] = current; - BFD_ASSERT (i == abfd->section_count); - - qsort (sorted_hdrs, abfd->section_count, sizeof (asection *), - ecoff_sort_hdrs); - - first_data = true; - first_nonalloc = true; - for (i = 0; i < abfd->section_count; i++) - { - unsigned int alignment_power; - - current = sorted_hdrs[i]; - - /* For the Alpha ECOFF .pdata section the lnnoptr field is - supposed to indicate the number of .pdata entries that are - really in the section. Each entry is 8 bytes. We store this - away in line_filepos before increasing the section size. */ - if (strcmp (current->name, _PDATA) != 0) - alignment_power = current->alignment_power; - else - { - current->line_filepos = current->_raw_size / 8; - alignment_power = 4; - } - - /* On Ultrix, the data sections in an executable file must be - aligned to a page boundary within the file. This does not - affect the section size, though. FIXME: Does this work for - other platforms? It requires some modification for the - Alpha, because .rdata on the Alpha goes with the text, not - the data. */ - if ((abfd->flags & EXEC_P) != 0 - && (abfd->flags & D_PAGED) != 0 - && ! first_data - && (current->flags & SEC_CODE) == 0 - && (! ecoff_backend (abfd)->rdata_in_text - || strcmp (current->name, _RDATA) != 0) - && strcmp (current->name, _PDATA) != 0 - && strcmp (current->name, _RCONST) != 0) - { - sofar = (sofar + round - 1) &~ (round - 1); - first_data = false; - } - else if (strcmp (current->name, _LIB) == 0) - { - /* On Irix 4, the location of contents of the .lib section - from a shared library section is also rounded up to a - page boundary. */ - - sofar = (sofar + round - 1) &~ (round - 1); - } - else if (first_nonalloc - && (current->flags & SEC_ALLOC) == 0 - && (abfd->flags & D_PAGED) != 0) - { - /* Skip up to the next page for an unallocated section, such - as the .comment section on the Alpha. This leaves room - for the .bss section. */ - first_nonalloc = false; - sofar = (sofar + round - 1) &~ (round - 1); - } - - /* Align the sections in the file to the same boundary on - which they are aligned in virtual memory. */ - old_sofar = sofar; - sofar = BFD_ALIGN (sofar, 1 << alignment_power); - - if ((abfd->flags & D_PAGED) != 0 - && (current->flags & SEC_ALLOC) != 0) - sofar += (current->vma - sofar) % round; - - if ((current->flags & (SEC_HAS_CONTENTS | SEC_LOAD)) != 0) - current->filepos = sofar; - - sofar += current->_raw_size; - - /* make sure that this section is of the right size too */ - old_sofar = sofar; - sofar = BFD_ALIGN (sofar, 1 << alignment_power); - current->_raw_size += sofar - old_sofar; - } - - free (sorted_hdrs); - sorted_hdrs = NULL; - - ecoff_data (abfd)->reloc_filepos = sofar; - - return true; -} - -/* Determine the location of the relocs for all the sections in the - output file, as well as the location of the symbolic debugging - information. */ - -static bfd_size_type -ecoff_compute_reloc_file_positions (abfd) - bfd *abfd; -{ - const bfd_size_type external_reloc_size = - ecoff_backend (abfd)->external_reloc_size; - file_ptr reloc_base; - bfd_size_type reloc_size; - asection *current; - file_ptr sym_base; - - if (! abfd->output_has_begun) - { - if (! ecoff_compute_section_file_positions (abfd)) - abort (); - abfd->output_has_begun = true; - } - - reloc_base = ecoff_data (abfd)->reloc_filepos; - - reloc_size = 0; - for (current = abfd->sections; - current != (asection *)NULL; - current = current->next) - { - if (current->reloc_count == 0) - current->rel_filepos = 0; - else - { - bfd_size_type relsize; - - current->rel_filepos = reloc_base; - relsize = current->reloc_count * external_reloc_size; - reloc_size += relsize; - reloc_base += relsize; - } - } - - sym_base = ecoff_data (abfd)->reloc_filepos + reloc_size; - - /* At least on Ultrix, the symbol table of an executable file must - be aligned to a page boundary. FIXME: Is this true on other - platforms? */ - if ((abfd->flags & EXEC_P) != 0 - && (abfd->flags & D_PAGED) != 0) - sym_base = ((sym_base + ecoff_backend (abfd)->round - 1) - &~ (ecoff_backend (abfd)->round - 1)); - - ecoff_data (abfd)->sym_filepos = sym_base; - - return reloc_size; -} - -/* Set the contents of a section. */ - -boolean -_bfd_ecoff_set_section_contents (abfd, section, location, offset, count) - bfd *abfd; - asection *section; - PTR location; - file_ptr offset; - bfd_size_type count; -{ - /* This must be done first, because bfd_set_section_contents is - going to set output_has_begun to true. */ - if (abfd->output_has_begun == false) - { - if (! ecoff_compute_section_file_positions (abfd)) - return false; - } - - /* If this is a .lib section, bump the vma address so that it winds - up being the number of .lib sections output. This is right for - Irix 4. Ian Taylor . */ - if (strcmp (section->name, _LIB) == 0) - ++section->vma; - - if (count == 0) - return true; - - if (bfd_seek (abfd, (file_ptr) (section->filepos + offset), SEEK_SET) != 0 - || bfd_write (location, 1, count, abfd) != count) - return false; - - return true; -} - -/* Get the GP value for an ECOFF file. This is a hook used by - nlmconv. */ - -bfd_vma -bfd_ecoff_get_gp_value (abfd) - bfd *abfd; -{ - if (bfd_get_flavour (abfd) != bfd_target_ecoff_flavour - || bfd_get_format (abfd) != bfd_object) - { - bfd_set_error (bfd_error_invalid_operation); - return 0; - } - - return ecoff_data (abfd)->gp; -} - -/* Set the GP value for an ECOFF file. This is a hook used by the - assembler. */ - -boolean -bfd_ecoff_set_gp_value (abfd, gp_value) - bfd *abfd; - bfd_vma gp_value; -{ - if (bfd_get_flavour (abfd) != bfd_target_ecoff_flavour - || bfd_get_format (abfd) != bfd_object) - { - bfd_set_error (bfd_error_invalid_operation); - return false; - } - - ecoff_data (abfd)->gp = gp_value; - - return true; -} - -/* Set the register masks for an ECOFF file. This is a hook used by - the assembler. */ - -boolean -bfd_ecoff_set_regmasks (abfd, gprmask, fprmask, cprmask) - bfd *abfd; - unsigned long gprmask; - unsigned long fprmask; - unsigned long *cprmask; -{ - ecoff_data_type *tdata; - - if (bfd_get_flavour (abfd) != bfd_target_ecoff_flavour - || bfd_get_format (abfd) != bfd_object) - { - bfd_set_error (bfd_error_invalid_operation); - return false; - } - - tdata = ecoff_data (abfd); - tdata->gprmask = gprmask; - tdata->fprmask = fprmask; - if (cprmask != (unsigned long *) NULL) - { - register int i; - - for (i = 0; i < 3; i++) - tdata->cprmask[i] = cprmask[i]; - } - - return true; -} - -/* Get ECOFF EXTR information for an external symbol. This function - is passed to bfd_ecoff_debug_externals. */ - -static boolean -ecoff_get_extr (sym, esym) - asymbol *sym; - EXTR *esym; -{ - ecoff_symbol_type *ecoff_sym_ptr; - bfd *input_bfd; - - if (bfd_asymbol_flavour (sym) != bfd_target_ecoff_flavour - || ecoffsymbol (sym)->native == NULL) - { - /* Don't include debugging, local, or section symbols. */ - if ((sym->flags & BSF_DEBUGGING) != 0 - || (sym->flags & BSF_LOCAL) != 0 - || (sym->flags & BSF_SECTION_SYM) != 0) - return false; - - esym->jmptbl = 0; - esym->cobol_main = 0; - esym->weakext = (sym->flags & BSF_WEAK) != 0; - esym->reserved = 0; - esym->ifd = ifdNil; - /* FIXME: we can do better than this for st and sc. */ - esym->asym.st = stGlobal; - esym->asym.sc = scAbs; - esym->asym.reserved = 0; - esym->asym.index = indexNil; - return true; - } - - ecoff_sym_ptr = ecoffsymbol (sym); - - if (ecoff_sym_ptr->local) - return false; - - input_bfd = bfd_asymbol_bfd (sym); - (*(ecoff_backend (input_bfd)->debug_swap.swap_ext_in)) - (input_bfd, ecoff_sym_ptr->native, esym); - - /* If the symbol was defined by the linker, then esym will be - undefined but sym will not be. Get a better class for such a - symbol. */ - if ((esym->asym.sc == scUndefined - || esym->asym.sc == scSUndefined) - && ! bfd_is_und_section (bfd_get_section (sym))) - esym->asym.sc = scAbs; - - /* Adjust the FDR index for the symbol by that used for the input - BFD. */ - if (esym->ifd != -1) - { - struct ecoff_debug_info *input_debug; - - input_debug = &ecoff_data (input_bfd)->debug_info; - BFD_ASSERT (esym->ifd < input_debug->symbolic_header.ifdMax); - if (input_debug->ifdmap != (RFDT *) NULL) - esym->ifd = input_debug->ifdmap[esym->ifd]; - } - - return true; -} - -/* Set the external symbol index. This routine is passed to - bfd_ecoff_debug_externals. */ - -static void -ecoff_set_index (sym, indx) - asymbol *sym; - bfd_size_type indx; -{ - ecoff_set_sym_index (sym, indx); -} - -/* Write out an ECOFF file. */ - -boolean -_bfd_ecoff_write_object_contents (abfd) - bfd *abfd; -{ - const struct ecoff_backend_data * const backend = ecoff_backend (abfd); - const bfd_vma round = backend->round; - const bfd_size_type filhsz = bfd_coff_filhsz (abfd); - const bfd_size_type aoutsz = bfd_coff_aoutsz (abfd); - const bfd_size_type scnhsz = bfd_coff_scnhsz (abfd); - const bfd_size_type external_hdr_size - = backend->debug_swap.external_hdr_size; - const bfd_size_type external_reloc_size = backend->external_reloc_size; - void (* const adjust_reloc_out) PARAMS ((bfd *, - const arelent *, - struct internal_reloc *)) - = backend->adjust_reloc_out; - void (* const swap_reloc_out) PARAMS ((bfd *, - const struct internal_reloc *, - PTR)) - = backend->swap_reloc_out; - struct ecoff_debug_info * const debug = &ecoff_data (abfd)->debug_info; - HDRR * const symhdr = &debug->symbolic_header; - asection *current; - unsigned int count; - bfd_size_type reloc_size; - bfd_size_type text_size; - bfd_vma text_start; - boolean set_text_start; - bfd_size_type data_size; - bfd_vma data_start; - boolean set_data_start; - bfd_size_type bss_size; - PTR buff = NULL; - PTR reloc_buff = NULL; - struct internal_filehdr internal_f; - struct internal_aouthdr internal_a; - int i; - - /* Determine where the sections and relocs will go in the output - file. */ - reloc_size = ecoff_compute_reloc_file_positions (abfd); - - count = 1; - for (current = abfd->sections; - current != (asection *)NULL; - current = current->next) - { - current->target_index = count; - ++count; - } - - if ((abfd->flags & D_PAGED) != 0) - text_size = _bfd_ecoff_sizeof_headers (abfd, false); - else - text_size = 0; - text_start = 0; - set_text_start = false; - data_size = 0; - data_start = 0; - set_data_start = false; - bss_size = 0; - - /* Write section headers to the file. */ - - /* Allocate buff big enough to hold a section header, - file header, or a.out header. */ - { - bfd_size_type siz; - siz = scnhsz; - if (siz < filhsz) - siz = filhsz; - if (siz < aoutsz) - siz = aoutsz; - buff = (PTR) bfd_malloc ((size_t) siz); - if (buff == NULL) - goto error_return; - } - - internal_f.f_nscns = 0; - if (bfd_seek (abfd, (file_ptr) (filhsz + aoutsz), SEEK_SET) != 0) - goto error_return; - for (current = abfd->sections; - current != (asection *) NULL; - current = current->next) - { - struct internal_scnhdr section; - bfd_vma vma; - - ++internal_f.f_nscns; - - strncpy (section.s_name, current->name, sizeof section.s_name); - - /* This seems to be correct for Irix 4 shared libraries. */ - vma = bfd_get_section_vma (abfd, current); - if (strcmp (current->name, _LIB) == 0) - section.s_vaddr = 0; - else - section.s_vaddr = vma; - - section.s_paddr = current->lma; - section.s_size = bfd_get_section_size_before_reloc (current); - - /* If this section is unloadable then the scnptr will be 0. */ - if ((current->flags & (SEC_LOAD | SEC_HAS_CONTENTS)) == 0) - section.s_scnptr = 0; - else - section.s_scnptr = current->filepos; - section.s_relptr = current->rel_filepos; - - /* FIXME: the lnnoptr of the .sbss or .sdata section of an - object file produced by the assembler is supposed to point to - information about how much room is required by objects of - various different sizes. I think this only matters if we - want the linker to compute the best size to use, or - something. I don't know what happens if the information is - not present. */ - if (strcmp (current->name, _PDATA) != 0) - section.s_lnnoptr = 0; - else - { - /* The Alpha ECOFF .pdata section uses the lnnoptr field to - hold the number of entries in the section (each entry is - 8 bytes). We stored this in the line_filepos field in - ecoff_compute_section_file_positions. */ - section.s_lnnoptr = current->line_filepos; - } - - section.s_nreloc = current->reloc_count; - section.s_nlnno = 0; - section.s_flags = ecoff_sec_to_styp_flags (current->name, - current->flags); - - if (bfd_coff_swap_scnhdr_out (abfd, (PTR) §ion, buff) == 0 - || bfd_write (buff, 1, scnhsz, abfd) != scnhsz) - goto error_return; - - if ((section.s_flags & STYP_TEXT) != 0 - || ((section.s_flags & STYP_RDATA) != 0 - && backend->rdata_in_text) - || section.s_flags == STYP_PDATA - || (section.s_flags & STYP_DYNAMIC) != 0 - || (section.s_flags & STYP_LIBLIST) != 0 - || (section.s_flags & STYP_RELDYN) != 0 - || section.s_flags == STYP_CONFLIC - || (section.s_flags & STYP_DYNSTR) != 0 - || (section.s_flags & STYP_DYNSYM) != 0 - || (section.s_flags & STYP_HASH) != 0 - || (section.s_flags & STYP_ECOFF_INIT) != 0 - || (section.s_flags & STYP_ECOFF_FINI) != 0 - || section.s_flags == STYP_RCONST) - { - text_size += bfd_get_section_size_before_reloc (current); - if (! set_text_start || text_start > vma) - { - text_start = vma; - set_text_start = true; - } - } - else if ((section.s_flags & STYP_RDATA) != 0 - || (section.s_flags & STYP_DATA) != 0 - || (section.s_flags & STYP_LITA) != 0 - || (section.s_flags & STYP_LIT8) != 0 - || (section.s_flags & STYP_LIT4) != 0 - || (section.s_flags & STYP_SDATA) != 0 - || section.s_flags == STYP_XDATA - || (section.s_flags & STYP_GOT) != 0) - { - data_size += bfd_get_section_size_before_reloc (current); - if (! set_data_start || data_start > vma) - { - data_start = vma; - set_data_start = true; - } - } - else if ((section.s_flags & STYP_BSS) != 0 - || (section.s_flags & STYP_SBSS) != 0) - bss_size += bfd_get_section_size_before_reloc (current); - else if (section.s_flags == 0 - || (section.s_flags & STYP_ECOFF_LIB) != 0 - || section.s_flags == STYP_COMMENT) - /* Do nothing */ ; - else - abort (); - } - - /* Set up the file header. */ - - internal_f.f_magic = ecoff_get_magic (abfd); - - /* We will NOT put a fucking timestamp in the header here. Every - time you put it back, I will come in and take it out again. I'm - sorry. This field does not belong here. We fill it with a 0 so - it compares the same but is not a reasonable time. -- - gnu@cygnus.com. */ - internal_f.f_timdat = 0; - - if (bfd_get_symcount (abfd) != 0) - { - /* The ECOFF f_nsyms field is not actually the number of - symbols, it's the size of symbolic information header. */ - internal_f.f_nsyms = external_hdr_size; - internal_f.f_symptr = ecoff_data (abfd)->sym_filepos; - } - else - { - internal_f.f_nsyms = 0; - internal_f.f_symptr = 0; - } - - internal_f.f_opthdr = aoutsz; - - internal_f.f_flags = F_LNNO; - if (reloc_size == 0) - internal_f.f_flags |= F_RELFLG; - if (bfd_get_symcount (abfd) == 0) - internal_f.f_flags |= F_LSYMS; - if (abfd->flags & EXEC_P) - internal_f.f_flags |= F_EXEC; - - if (bfd_little_endian (abfd)) - internal_f.f_flags |= F_AR32WR; - else - internal_f.f_flags |= F_AR32W; - - /* Set up the ``optional'' header. */ - if ((abfd->flags & D_PAGED) != 0) - internal_a.magic = ECOFF_AOUT_ZMAGIC; - else - internal_a.magic = ECOFF_AOUT_OMAGIC; - - /* FIXME: Is this really correct? */ - internal_a.vstamp = symhdr->vstamp; - - /* At least on Ultrix, these have to be rounded to page boundaries. - FIXME: Is this true on other platforms? */ - if ((abfd->flags & D_PAGED) != 0) - { - internal_a.tsize = (text_size + round - 1) &~ (round - 1); - internal_a.text_start = text_start &~ (round - 1); - internal_a.dsize = (data_size + round - 1) &~ (round - 1); - internal_a.data_start = data_start &~ (round - 1); - } - else - { - internal_a.tsize = text_size; - internal_a.text_start = text_start; - internal_a.dsize = data_size; - internal_a.data_start = data_start; - } - - /* On Ultrix, the initial portions of the .sbss and .bss segments - are at the end of the data section. The bsize field in the - optional header records how many bss bytes are required beyond - those in the data section. The value is not rounded to a page - boundary. */ - if (bss_size < internal_a.dsize - data_size) - bss_size = 0; - else - bss_size -= internal_a.dsize - data_size; - internal_a.bsize = bss_size; - internal_a.bss_start = internal_a.data_start + internal_a.dsize; - - internal_a.entry = bfd_get_start_address (abfd); - - internal_a.gp_value = ecoff_data (abfd)->gp; - - internal_a.gprmask = ecoff_data (abfd)->gprmask; - internal_a.fprmask = ecoff_data (abfd)->fprmask; - for (i = 0; i < 4; i++) - internal_a.cprmask[i] = ecoff_data (abfd)->cprmask[i]; - - /* Let the backend adjust the headers if necessary. */ - if (backend->adjust_headers) - { - if (! (*backend->adjust_headers) (abfd, &internal_f, &internal_a)) - goto error_return; - } - - /* Write out the file header and the optional header. */ - - if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) - goto error_return; - - bfd_coff_swap_filehdr_out (abfd, (PTR) &internal_f, buff); - if (bfd_write (buff, 1, filhsz, abfd) != filhsz) - goto error_return; - - bfd_coff_swap_aouthdr_out (abfd, (PTR) &internal_a, buff); - if (bfd_write (buff, 1, aoutsz, abfd) != aoutsz) - goto error_return; - - /* Build the external symbol information. This must be done before - writing out the relocs so that we know the symbol indices. We - don't do this if this BFD was created by the backend linker, - since it will have already handled the symbols and relocs. */ - if (! ecoff_data (abfd)->linker) - { - symhdr->iextMax = 0; - symhdr->issExtMax = 0; - debug->external_ext = debug->external_ext_end = NULL; - debug->ssext = debug->ssext_end = NULL; - if (bfd_ecoff_debug_externals (abfd, debug, &backend->debug_swap, - (((abfd->flags & EXEC_P) == 0) - ? true : false), - ecoff_get_extr, ecoff_set_index) - == false) - goto error_return; - - /* Write out the relocs. */ - for (current = abfd->sections; - current != (asection *) NULL; - current = current->next) - { - arelent **reloc_ptr_ptr; - arelent **reloc_end; - char *out_ptr; - - if (current->reloc_count == 0) - continue; - - reloc_buff = - bfd_alloc (abfd, current->reloc_count * external_reloc_size); - if (reloc_buff == NULL) - goto error_return; - - reloc_ptr_ptr = current->orelocation; - reloc_end = reloc_ptr_ptr + current->reloc_count; - out_ptr = (char *) reloc_buff; - for (; - reloc_ptr_ptr < reloc_end; - reloc_ptr_ptr++, out_ptr += external_reloc_size) - { - arelent *reloc; - asymbol *sym; - struct internal_reloc in; - - memset ((PTR) &in, 0, sizeof in); - - reloc = *reloc_ptr_ptr; - sym = *reloc->sym_ptr_ptr; - - in.r_vaddr = (reloc->address - + bfd_get_section_vma (abfd, current)); - in.r_type = reloc->howto->type; - - if ((sym->flags & BSF_SECTION_SYM) == 0) - { - in.r_symndx = ecoff_get_sym_index (*reloc->sym_ptr_ptr); - in.r_extern = 1; - } - else - { - CONST char *name; - - name = bfd_get_section_name (abfd, bfd_get_section (sym)); - if (strcmp (name, ".text") == 0) - in.r_symndx = RELOC_SECTION_TEXT; - else if (strcmp (name, ".rdata") == 0) - in.r_symndx = RELOC_SECTION_RDATA; - else if (strcmp (name, ".data") == 0) - in.r_symndx = RELOC_SECTION_DATA; - else if (strcmp (name, ".sdata") == 0) - in.r_symndx = RELOC_SECTION_SDATA; - else if (strcmp (name, ".sbss") == 0) - in.r_symndx = RELOC_SECTION_SBSS; - else if (strcmp (name, ".bss") == 0) - in.r_symndx = RELOC_SECTION_BSS; - else if (strcmp (name, ".init") == 0) - in.r_symndx = RELOC_SECTION_INIT; - else if (strcmp (name, ".lit8") == 0) - in.r_symndx = RELOC_SECTION_LIT8; - else if (strcmp (name, ".lit4") == 0) - in.r_symndx = RELOC_SECTION_LIT4; - else if (strcmp (name, ".xdata") == 0) - in.r_symndx = RELOC_SECTION_XDATA; - else if (strcmp (name, ".pdata") == 0) - in.r_symndx = RELOC_SECTION_PDATA; - else if (strcmp (name, ".fini") == 0) - in.r_symndx = RELOC_SECTION_FINI; - else if (strcmp (name, ".lita") == 0) - in.r_symndx = RELOC_SECTION_LITA; - else if (strcmp (name, "*ABS*") == 0) - in.r_symndx = RELOC_SECTION_ABS; - else if (strcmp (name, ".rconst") == 0) - in.r_symndx = RELOC_SECTION_RCONST; - else - abort (); - in.r_extern = 0; - } - - (*adjust_reloc_out) (abfd, reloc, &in); - - (*swap_reloc_out) (abfd, &in, (PTR) out_ptr); - } - - if (bfd_seek (abfd, current->rel_filepos, SEEK_SET) != 0) - goto error_return; - if (bfd_write (reloc_buff, - external_reloc_size, current->reloc_count, abfd) - != external_reloc_size * current->reloc_count) - goto error_return; - bfd_release (abfd, reloc_buff); - reloc_buff = NULL; - } - - /* Write out the symbolic debugging information. */ - if (bfd_get_symcount (abfd) > 0) - { - /* Write out the debugging information. */ - if (bfd_ecoff_write_debug (abfd, debug, &backend->debug_swap, - ecoff_data (abfd)->sym_filepos) - == false) - goto error_return; - } - } - - /* The .bss section of a demand paged executable must receive an - entire page. If there are symbols, the symbols will start on the - next page. If there are no symbols, we must fill out the page by - hand. */ - if (bfd_get_symcount (abfd) == 0 - && (abfd->flags & EXEC_P) != 0 - && (abfd->flags & D_PAGED) != 0) - { - char c; - - if (bfd_seek (abfd, (file_ptr) ecoff_data (abfd)->sym_filepos - 1, - SEEK_SET) != 0) - goto error_return; - if (bfd_read (&c, 1, 1, abfd) == 0) - c = 0; - if (bfd_seek (abfd, (file_ptr) ecoff_data (abfd)->sym_filepos - 1, - SEEK_SET) != 0) - goto error_return; - if (bfd_write (&c, 1, 1, abfd) != 1) - goto error_return; - } - - if (reloc_buff != NULL) - bfd_release (abfd, reloc_buff); - if (buff != NULL) - free (buff); - return true; - error_return: - if (reloc_buff != NULL) - bfd_release (abfd, reloc_buff); - if (buff != NULL) - free (buff); - return false; -} - -/* Archive handling. ECOFF uses what appears to be a unique type of - archive header (armap). The byte ordering of the armap and the - contents are encoded in the name of the armap itself. At least for - now, we only support archives with the same byte ordering in the - armap and the contents. - - The first four bytes in the armap are the number of symbol - definitions. This is always a power of two. - - This is followed by the symbol definitions. Each symbol definition - occupies 8 bytes. The first four bytes are the offset from the - start of the armap strings to the null-terminated string naming - this symbol. The second four bytes are the file offset to the - archive member which defines this symbol. If the second four bytes - are 0, then this is not actually a symbol definition, and it should - be ignored. - - The symbols are hashed into the armap with a closed hashing scheme. - See the functions below for the details of the algorithm. - - After the symbol definitions comes four bytes holding the size of - the string table, followed by the string table itself. */ - -/* The name of an archive headers looks like this: - __________E[BL]E[BL]_ (with a trailing space). - The trailing space is changed to an X if the archive is changed to - indicate that the armap is out of date. - - The Alpha seems to use ________64E[BL]E[BL]_. */ - -#define ARMAP_BIG_ENDIAN 'B' -#define ARMAP_LITTLE_ENDIAN 'L' -#define ARMAP_MARKER 'E' -#define ARMAP_START_LENGTH 10 -#define ARMAP_HEADER_MARKER_INDEX 10 -#define ARMAP_HEADER_ENDIAN_INDEX 11 -#define ARMAP_OBJECT_MARKER_INDEX 12 -#define ARMAP_OBJECT_ENDIAN_INDEX 13 -#define ARMAP_END_INDEX 14 -#define ARMAP_END "_ " - -/* This is a magic number used in the hashing algorithm. */ -#define ARMAP_HASH_MAGIC 0x9dd68ab5 - -/* This returns the hash value to use for a string. It also sets - *REHASH to the rehash adjustment if the first slot is taken. SIZE - is the number of entries in the hash table, and HLOG is the log - base 2 of SIZE. */ - -static unsigned int -ecoff_armap_hash (s, rehash, size, hlog) - CONST char *s; - unsigned int *rehash; - unsigned int size; - unsigned int hlog; -{ - unsigned int hash; - - hash = *s++; - while (*s != '\0') - hash = ((hash >> 27) | (hash << 5)) + *s++; - hash *= ARMAP_HASH_MAGIC; - *rehash = (hash & (size - 1)) | 1; - return hash >> (32 - hlog); -} - -/* Read in the armap. */ - -boolean -_bfd_ecoff_slurp_armap (abfd) - bfd *abfd; -{ - char nextname[17]; - unsigned int i; - struct areltdata *mapdata; - bfd_size_type parsed_size; - char *raw_armap; - struct artdata *ardata; - unsigned int count; - char *raw_ptr; - struct symdef *symdef_ptr; - char *stringbase; - - /* Get the name of the first element. */ - i = bfd_read ((PTR) nextname, 1, 16, abfd); - if (i == 0) - return true; - if (i != 16) - return false; - - if (bfd_seek (abfd, (file_ptr) -16, SEEK_CUR) != 0) - return false; - - /* Irix 4.0.5F apparently can use either an ECOFF armap or a - standard COFF armap. We could move the ECOFF armap stuff into - bfd_slurp_armap, but that seems inappropriate since no other - target uses this format. Instead, we check directly for a COFF - armap. */ - if (strncmp (nextname, "/ ", 16) == 0) - return bfd_slurp_armap (abfd); - - /* See if the first element is an armap. */ - if (strncmp (nextname, ecoff_backend (abfd)->armap_start, - ARMAP_START_LENGTH) != 0 - || nextname[ARMAP_HEADER_MARKER_INDEX] != ARMAP_MARKER - || (nextname[ARMAP_HEADER_ENDIAN_INDEX] != ARMAP_BIG_ENDIAN - && nextname[ARMAP_HEADER_ENDIAN_INDEX] != ARMAP_LITTLE_ENDIAN) - || nextname[ARMAP_OBJECT_MARKER_INDEX] != ARMAP_MARKER - || (nextname[ARMAP_OBJECT_ENDIAN_INDEX] != ARMAP_BIG_ENDIAN - && nextname[ARMAP_OBJECT_ENDIAN_INDEX] != ARMAP_LITTLE_ENDIAN) - || strncmp (nextname + ARMAP_END_INDEX, - ARMAP_END, sizeof ARMAP_END - 1) != 0) - { - bfd_has_map (abfd) = false; - return true; - } - - /* Make sure we have the right byte ordering. */ - if (((nextname[ARMAP_HEADER_ENDIAN_INDEX] == ARMAP_BIG_ENDIAN) - ^ (bfd_header_big_endian (abfd))) - || ((nextname[ARMAP_OBJECT_ENDIAN_INDEX] == ARMAP_BIG_ENDIAN) - ^ (bfd_big_endian (abfd)))) - { - bfd_set_error (bfd_error_wrong_format); - return false; - } - - /* Read in the armap. */ - ardata = bfd_ardata (abfd); - mapdata = (struct areltdata *) _bfd_read_ar_hdr (abfd); - if (mapdata == (struct areltdata *) NULL) - return false; - parsed_size = mapdata->parsed_size; - bfd_release (abfd, (PTR) mapdata); - - raw_armap = (char *) bfd_alloc (abfd, parsed_size); - if (raw_armap == (char *) NULL) - return false; - - if (bfd_read ((PTR) raw_armap, 1, parsed_size, abfd) != parsed_size) - { - if (bfd_get_error () != bfd_error_system_call) - bfd_set_error (bfd_error_malformed_archive); - bfd_release (abfd, (PTR) raw_armap); - return false; - } - - ardata->tdata = (PTR) raw_armap; - - count = bfd_h_get_32 (abfd, (PTR) raw_armap); - - ardata->symdef_count = 0; - ardata->cache = (struct ar_cache *) NULL; - - /* This code used to overlay the symdefs over the raw archive data, - but that doesn't work on a 64 bit host. */ - - stringbase = raw_armap + count * 8 + 8; - -#ifdef CHECK_ARMAP_HASH - { - unsigned int hlog; - - /* Double check that I have the hashing algorithm right by making - sure that every symbol can be looked up successfully. */ - hlog = 0; - for (i = 1; i < count; i <<= 1) - hlog++; - BFD_ASSERT (i == count); - - raw_ptr = raw_armap + 4; - for (i = 0; i < count; i++, raw_ptr += 8) - { - unsigned int name_offset, file_offset; - unsigned int hash, rehash, srch; - - name_offset = bfd_h_get_32 (abfd, (PTR) raw_ptr); - file_offset = bfd_h_get_32 (abfd, (PTR) (raw_ptr + 4)); - if (file_offset == 0) - continue; - hash = ecoff_armap_hash (stringbase + name_offset, &rehash, count, - hlog); - if (hash == i) - continue; - - /* See if we can rehash to this location. */ - for (srch = (hash + rehash) & (count - 1); - srch != hash && srch != i; - srch = (srch + rehash) & (count - 1)) - BFD_ASSERT (bfd_h_get_32 (abfd, (PTR) (raw_armap + 8 + srch * 8)) - != 0); - BFD_ASSERT (srch == i); - } - } - -#endif /* CHECK_ARMAP_HASH */ - - raw_ptr = raw_armap + 4; - for (i = 0; i < count; i++, raw_ptr += 8) - if (bfd_h_get_32 (abfd, (PTR) (raw_ptr + 4)) != 0) - ++ardata->symdef_count; - - symdef_ptr = ((struct symdef *) - bfd_alloc (abfd, - ardata->symdef_count * sizeof (struct symdef))); - if (!symdef_ptr) - return false; - - ardata->symdefs = (carsym *) symdef_ptr; - - raw_ptr = raw_armap + 4; - for (i = 0; i < count; i++, raw_ptr += 8) - { - unsigned int name_offset, file_offset; - - file_offset = bfd_h_get_32 (abfd, (PTR) (raw_ptr + 4)); - if (file_offset == 0) - continue; - name_offset = bfd_h_get_32 (abfd, (PTR) raw_ptr); - symdef_ptr->s.name = stringbase + name_offset; - symdef_ptr->file_offset = file_offset; - ++symdef_ptr; - } - - ardata->first_file_filepos = bfd_tell (abfd); - /* Pad to an even boundary. */ - ardata->first_file_filepos += ardata->first_file_filepos % 2; - - bfd_has_map (abfd) = true; - - return true; -} - -/* Write out an armap. */ - -boolean -_bfd_ecoff_write_armap (abfd, elength, map, orl_count, stridx) - bfd *abfd; - unsigned int elength; - struct orl *map; - unsigned int orl_count; - int stridx; -{ - unsigned int hashsize, hashlog; - unsigned int symdefsize; - int padit; - unsigned int stringsize; - unsigned int mapsize; - file_ptr firstreal; - struct ar_hdr hdr; - struct stat statbuf; - unsigned int i; - bfd_byte temp[4]; - bfd_byte *hashtable; - bfd *current; - bfd *last_elt; - - /* Ultrix appears to use as a hash table size the least power of two - greater than twice the number of entries. */ - for (hashlog = 0; (1 << hashlog) <= 2 * orl_count; hashlog++) - ; - hashsize = 1 << hashlog; - - symdefsize = hashsize * 8; - padit = stridx % 2; - stringsize = stridx + padit; - - /* Include 8 bytes to store symdefsize and stringsize in output. */ - mapsize = symdefsize + stringsize + 8; - - firstreal = SARMAG + sizeof (struct ar_hdr) + mapsize + elength; - - memset ((PTR) &hdr, 0, sizeof hdr); - - /* Work out the ECOFF armap name. */ - strcpy (hdr.ar_name, ecoff_backend (abfd)->armap_start); - hdr.ar_name[ARMAP_HEADER_MARKER_INDEX] = ARMAP_MARKER; - hdr.ar_name[ARMAP_HEADER_ENDIAN_INDEX] = - (bfd_header_big_endian (abfd) - ? ARMAP_BIG_ENDIAN - : ARMAP_LITTLE_ENDIAN); - hdr.ar_name[ARMAP_OBJECT_MARKER_INDEX] = ARMAP_MARKER; - hdr.ar_name[ARMAP_OBJECT_ENDIAN_INDEX] = - bfd_big_endian (abfd) ? ARMAP_BIG_ENDIAN : ARMAP_LITTLE_ENDIAN; - memcpy (hdr.ar_name + ARMAP_END_INDEX, ARMAP_END, sizeof ARMAP_END - 1); - - /* Write the timestamp of the archive header to be just a little bit - later than the timestamp of the file, otherwise the linker will - complain that the index is out of date. Actually, the Ultrix - linker just checks the archive name; the GNU linker may check the - date. */ - stat (abfd->filename, &statbuf); - sprintf (hdr.ar_date, "%ld", (long) (statbuf.st_mtime + 60)); - - /* The DECstation uses zeroes for the uid, gid and mode of the - armap. */ - hdr.ar_uid[0] = '0'; - hdr.ar_gid[0] = '0'; - hdr.ar_mode[0] = '0'; - - sprintf (hdr.ar_size, "%-10d", (int) mapsize); - - hdr.ar_fmag[0] = '`'; - hdr.ar_fmag[1] = '\012'; - - /* Turn all null bytes in the header into spaces. */ - for (i = 0; i < sizeof (struct ar_hdr); i++) - if (((char *)(&hdr))[i] == '\0') - (((char *)(&hdr))[i]) = ' '; - - if (bfd_write ((PTR) &hdr, 1, sizeof (struct ar_hdr), abfd) - != sizeof (struct ar_hdr)) - return false; - - bfd_h_put_32 (abfd, (bfd_vma) hashsize, temp); - if (bfd_write ((PTR) temp, 1, 4, abfd) != 4) - return false; - - hashtable = (bfd_byte *) bfd_zalloc (abfd, symdefsize); - if (!hashtable) - return false; - - current = abfd->archive_head; - last_elt = current; - for (i = 0; i < orl_count; i++) - { - unsigned int hash, rehash; - - /* Advance firstreal to the file position of this archive - element. */ - if (((bfd *) map[i].pos) != last_elt) - { - do - { - firstreal += arelt_size (current) + sizeof (struct ar_hdr); - firstreal += firstreal % 2; - current = current->next; - } - while (current != (bfd *) map[i].pos); - } - - last_elt = current; - - hash = ecoff_armap_hash (*map[i].name, &rehash, hashsize, hashlog); - if (bfd_h_get_32 (abfd, (PTR) (hashtable + (hash * 8) + 4)) != 0) - { - unsigned int srch; - - /* The desired slot is already taken. */ - for (srch = (hash + rehash) & (hashsize - 1); - srch != hash; - srch = (srch + rehash) & (hashsize - 1)) - if (bfd_h_get_32 (abfd, (PTR) (hashtable + (srch * 8) + 4)) == 0) - break; - - BFD_ASSERT (srch != hash); - - hash = srch; - } - - bfd_h_put_32 (abfd, (bfd_vma) map[i].namidx, - (PTR) (hashtable + hash * 8)); - bfd_h_put_32 (abfd, (bfd_vma) firstreal, - (PTR) (hashtable + hash * 8 + 4)); - } - - if (bfd_write ((PTR) hashtable, 1, symdefsize, abfd) != symdefsize) - return false; - - bfd_release (abfd, hashtable); - - /* Now write the strings. */ - bfd_h_put_32 (abfd, (bfd_vma) stringsize, temp); - if (bfd_write ((PTR) temp, 1, 4, abfd) != 4) - return false; - for (i = 0; i < orl_count; i++) - { - bfd_size_type len; - - len = strlen (*map[i].name) + 1; - if (bfd_write ((PTR) (*map[i].name), 1, len, abfd) != len) - return false; - } - - /* The spec sez this should be a newline. But in order to be - bug-compatible for DECstation ar we use a null. */ - if (padit) - { - if (bfd_write ("", 1, 1, abfd) != 1) - return false; - } - - return true; -} - -/* See whether this BFD is an archive. If it is, read in the armap - and the extended name table. */ - -const bfd_target * -_bfd_ecoff_archive_p (abfd) - bfd *abfd; -{ - char armag[SARMAG + 1]; - - if (bfd_read ((PTR) armag, 1, SARMAG, abfd) != SARMAG - || strncmp (armag, ARMAG, SARMAG) != 0) - { - if (bfd_get_error () != bfd_error_system_call) - bfd_set_error (bfd_error_wrong_format); - return (const bfd_target *) NULL; - } - - /* We are setting bfd_ardata(abfd) here, but since bfd_ardata - involves a cast, we can't do it as the left operand of - assignment. */ - abfd->tdata.aout_ar_data = - (struct artdata *) bfd_zalloc (abfd, sizeof (struct artdata)); - - if (bfd_ardata (abfd) == (struct artdata *) NULL) - return (const bfd_target *) NULL; - - bfd_ardata (abfd)->first_file_filepos = SARMAG; - bfd_ardata (abfd)->cache = NULL; - bfd_ardata (abfd)->archive_head = NULL; - bfd_ardata (abfd)->symdefs = NULL; - bfd_ardata (abfd)->extended_names = NULL; - bfd_ardata (abfd)->tdata = NULL; - - if (_bfd_ecoff_slurp_armap (abfd) == false - || _bfd_ecoff_slurp_extended_name_table (abfd) == false) - { - bfd_release (abfd, bfd_ardata (abfd)); - abfd->tdata.aout_ar_data = (struct artdata *) NULL; - return (const bfd_target *) NULL; - } - - return abfd->xvec; -} - -/* ECOFF linker code. */ - -static struct bfd_hash_entry *ecoff_link_hash_newfunc - PARAMS ((struct bfd_hash_entry *entry, - struct bfd_hash_table *table, - const char *string)); -static boolean ecoff_link_add_archive_symbols - PARAMS ((bfd *, struct bfd_link_info *)); -static boolean ecoff_link_check_archive_element - PARAMS ((bfd *, struct bfd_link_info *, boolean *pneeded)); -static boolean ecoff_link_add_object_symbols - PARAMS ((bfd *, struct bfd_link_info *)); -static boolean ecoff_link_add_externals - PARAMS ((bfd *, struct bfd_link_info *, PTR, char *)); - -/* Routine to create an entry in an ECOFF link hash table. */ - -static struct bfd_hash_entry * -ecoff_link_hash_newfunc (entry, table, string) - struct bfd_hash_entry *entry; - struct bfd_hash_table *table; - const char *string; -{ - struct ecoff_link_hash_entry *ret = (struct ecoff_link_hash_entry *) entry; - - /* Allocate the structure if it has not already been allocated by a - subclass. */ - if (ret == (struct ecoff_link_hash_entry *) NULL) - ret = ((struct ecoff_link_hash_entry *) - bfd_hash_allocate (table, sizeof (struct ecoff_link_hash_entry))); - if (ret == (struct ecoff_link_hash_entry *) NULL) - return NULL; - - /* Call the allocation method of the superclass. */ - ret = ((struct ecoff_link_hash_entry *) - _bfd_link_hash_newfunc ((struct bfd_hash_entry *) ret, - table, string)); - - if (ret) - { - /* Set local fields. */ - ret->indx = -1; - ret->abfd = NULL; - ret->written = 0; - ret->small = 0; - } - memset ((PTR) &ret->esym, 0, sizeof ret->esym); - - return (struct bfd_hash_entry *) ret; -} - -/* Create an ECOFF link hash table. */ - -struct bfd_link_hash_table * -_bfd_ecoff_bfd_link_hash_table_create (abfd) - bfd *abfd; -{ - struct ecoff_link_hash_table *ret; - - ret = ((struct ecoff_link_hash_table *) - bfd_alloc (abfd, sizeof (struct ecoff_link_hash_table))); - if (ret == NULL) - return NULL; - if (! _bfd_link_hash_table_init (&ret->root, abfd, - ecoff_link_hash_newfunc)) - { - free (ret); - return (struct bfd_link_hash_table *) NULL; - } - return &ret->root; -} - -/* Look up an entry in an ECOFF link hash table. */ - -#define ecoff_link_hash_lookup(table, string, create, copy, follow) \ - ((struct ecoff_link_hash_entry *) \ - bfd_link_hash_lookup (&(table)->root, (string), (create), (copy), (follow))) - -/* Traverse an ECOFF link hash table. */ - -#define ecoff_link_hash_traverse(table, func, info) \ - (bfd_link_hash_traverse \ - (&(table)->root, \ - (boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func), \ - (info))) - -/* Get the ECOFF link hash table from the info structure. This is - just a cast. */ - -#define ecoff_hash_table(p) ((struct ecoff_link_hash_table *) ((p)->hash)) - -/* Given an ECOFF BFD, add symbols to the global hash table as - appropriate. */ - -boolean -_bfd_ecoff_bfd_link_add_symbols (abfd, info) - bfd *abfd; - struct bfd_link_info *info; -{ - switch (bfd_get_format (abfd)) - { - case bfd_object: - return ecoff_link_add_object_symbols (abfd, info); - case bfd_archive: - return ecoff_link_add_archive_symbols (abfd, info); - default: - bfd_set_error (bfd_error_wrong_format); - return false; - } -} - -/* Add the symbols from an archive file to the global hash table. - This looks through the undefined symbols, looks each one up in the - archive hash table, and adds any associated object file. We do not - use _bfd_generic_link_add_archive_symbols because ECOFF archives - already have a hash table, so there is no reason to construct - another one. */ - -static boolean -ecoff_link_add_archive_symbols (abfd, info) - bfd *abfd; - struct bfd_link_info *info; -{ - const struct ecoff_backend_data * const backend = ecoff_backend (abfd); - const bfd_byte *raw_armap; - struct bfd_link_hash_entry **pundef; - unsigned int armap_count; - unsigned int armap_log; - unsigned int i; - const bfd_byte *hashtable; - const char *stringbase; - - if (! bfd_has_map (abfd)) - { - /* An empty archive is a special case. */ - if (bfd_openr_next_archived_file (abfd, (bfd *) NULL) == NULL) - return true; - bfd_set_error (bfd_error_no_armap); - return false; - } - - /* If we don't have any raw data for this archive, as can happen on - Irix 4.0.5F, we call the generic routine. - FIXME: We should be more clever about this, since someday tdata - may get to something for a generic archive. */ - raw_armap = (const bfd_byte *) bfd_ardata (abfd)->tdata; - if (raw_armap == (bfd_byte *) NULL) - return (_bfd_generic_link_add_archive_symbols - (abfd, info, ecoff_link_check_archive_element)); - - armap_count = bfd_h_get_32 (abfd, raw_armap); - - armap_log = 0; - for (i = 1; i < armap_count; i <<= 1) - armap_log++; - BFD_ASSERT (i == armap_count); - - hashtable = raw_armap + 4; - stringbase = (const char *) raw_armap + armap_count * 8 + 8; - - /* Look through the list of undefined symbols. */ - pundef = &info->hash->undefs; - while (*pundef != (struct bfd_link_hash_entry *) NULL) - { - struct bfd_link_hash_entry *h; - unsigned int hash, rehash; - unsigned int file_offset; - const char *name; - bfd *element; - - h = *pundef; - - /* When a symbol is defined, it is not necessarily removed from - the list. */ - if (h->type != bfd_link_hash_undefined - && h->type != bfd_link_hash_common) - { - /* Remove this entry from the list, for general cleanliness - and because we are going to look through the list again - if we search any more libraries. We can't remove the - entry if it is the tail, because that would lose any - entries we add to the list later on. */ - if (*pundef != info->hash->undefs_tail) - *pundef = (*pundef)->next; - else - pundef = &(*pundef)->next; - continue; - } - - /* Native ECOFF linkers do not pull in archive elements merely - to satisfy common definitions, so neither do we. We leave - them on the list, though, in case we are linking against some - other object format. */ - if (h->type != bfd_link_hash_undefined) - { - pundef = &(*pundef)->next; - continue; - } - - /* Look for this symbol in the archive hash table. */ - hash = ecoff_armap_hash (h->root.string, &rehash, armap_count, - armap_log); - - file_offset = bfd_h_get_32 (abfd, hashtable + (hash * 8) + 4); - if (file_offset == 0) - { - /* Nothing in this slot. */ - pundef = &(*pundef)->next; - continue; - } - - name = stringbase + bfd_h_get_32 (abfd, hashtable + (hash * 8)); - if (name[0] != h->root.string[0] - || strcmp (name, h->root.string) != 0) - { - unsigned int srch; - boolean found; - - /* That was the wrong symbol. Try rehashing. */ - found = false; - for (srch = (hash + rehash) & (armap_count - 1); - srch != hash; - srch = (srch + rehash) & (armap_count - 1)) - { - file_offset = bfd_h_get_32 (abfd, hashtable + (srch * 8) + 4); - if (file_offset == 0) - break; - name = stringbase + bfd_h_get_32 (abfd, hashtable + (srch * 8)); - if (name[0] == h->root.string[0] - && strcmp (name, h->root.string) == 0) - { - found = true; - break; - } - } - - if (! found) - { - pundef = &(*pundef)->next; - continue; - } - - hash = srch; - } - - element = (*backend->get_elt_at_filepos) (abfd, file_offset); - if (element == (bfd *) NULL) - return false; - - if (! bfd_check_format (element, bfd_object)) - return false; - - /* Unlike the generic linker, we know that this element provides - a definition for an undefined symbol and we know that we want - to include it. We don't need to check anything. */ - if (! (*info->callbacks->add_archive_element) (info, element, name)) - return false; - if (! ecoff_link_add_object_symbols (element, info)) - return false; - - pundef = &(*pundef)->next; - } - - return true; -} - -/* This is called if we used _bfd_generic_link_add_archive_symbols - because we were not dealing with an ECOFF archive. */ - -static boolean -ecoff_link_check_archive_element (abfd, info, pneeded) - bfd *abfd; - struct bfd_link_info *info; - boolean *pneeded; -{ - const struct ecoff_backend_data * const backend = ecoff_backend (abfd); - void (* const swap_ext_in) PARAMS ((bfd *, PTR, EXTR *)) - = backend->debug_swap.swap_ext_in; - HDRR *symhdr; - bfd_size_type external_ext_size; - PTR external_ext = NULL; - size_t esize; - char *ssext = NULL; - char *ext_ptr; - char *ext_end; - - *pneeded = false; - - if (! ecoff_slurp_symbolic_header (abfd)) - goto error_return; - - /* If there are no symbols, we don't want it. */ - if (bfd_get_symcount (abfd) == 0) - goto successful_return; - - symhdr = &ecoff_data (abfd)->debug_info.symbolic_header; - - /* Read in the external symbols and external strings. */ - external_ext_size = backend->debug_swap.external_ext_size; - esize = symhdr->iextMax * external_ext_size; - external_ext = (PTR) bfd_malloc (esize); - if (external_ext == NULL && esize != 0) - goto error_return; - - if (bfd_seek (abfd, symhdr->cbExtOffset, SEEK_SET) != 0 - || bfd_read (external_ext, 1, esize, abfd) != esize) - goto error_return; - - ssext = (char *) bfd_malloc (symhdr->issExtMax); - if (ssext == NULL && symhdr->issExtMax != 0) - goto error_return; - - if (bfd_seek (abfd, symhdr->cbSsExtOffset, SEEK_SET) != 0 - || (bfd_read (ssext, 1, symhdr->issExtMax, abfd) != - (bfd_size_type) symhdr->issExtMax)) - goto error_return; - - /* Look through the external symbols to see if they define some - symbol that is currently undefined. */ - ext_ptr = (char *) external_ext; - ext_end = ext_ptr + esize; - for (; ext_ptr < ext_end; ext_ptr += external_ext_size) - { - EXTR esym; - boolean def; - const char *name; - struct bfd_link_hash_entry *h; - - (*swap_ext_in) (abfd, (PTR) ext_ptr, &esym); - - /* See if this symbol defines something. */ - if (esym.asym.st != stGlobal - && esym.asym.st != stLabel - && esym.asym.st != stProc) - continue; - - switch (esym.asym.sc) - { - case scText: - case scData: - case scBss: - case scAbs: - case scSData: - case scSBss: - case scRData: - case scCommon: - case scSCommon: - case scInit: - case scFini: - case scRConst: - def = true; - break; - default: - def = false; - break; - } - - if (! def) - continue; - - name = ssext + esym.asym.iss; - h = bfd_link_hash_lookup (info->hash, name, false, false, true); - - /* Unlike the generic linker, we do not pull in elements because - of common symbols. */ - if (h == (struct bfd_link_hash_entry *) NULL - || h->type != bfd_link_hash_undefined) - continue; - - /* Include this element. */ - if (! (*info->callbacks->add_archive_element) (info, abfd, name)) - goto error_return; - if (! ecoff_link_add_externals (abfd, info, external_ext, ssext)) - goto error_return; - - *pneeded = true; - goto successful_return; - } - - successful_return: - if (external_ext != NULL) - free (external_ext); - if (ssext != NULL) - free (ssext); - return true; - error_return: - if (external_ext != NULL) - free (external_ext); - if (ssext != NULL) - free (ssext); - return false; -} - -/* Add symbols from an ECOFF object file to the global linker hash - table. */ - -static boolean -ecoff_link_add_object_symbols (abfd, info) - bfd *abfd; - struct bfd_link_info *info; -{ - HDRR *symhdr; - bfd_size_type external_ext_size; - PTR external_ext = NULL; - size_t esize; - char *ssext = NULL; - boolean result; - - if (! ecoff_slurp_symbolic_header (abfd)) - return false; - - /* If there are no symbols, we don't want it. */ - if (bfd_get_symcount (abfd) == 0) - return true; - - symhdr = &ecoff_data (abfd)->debug_info.symbolic_header; - - /* Read in the external symbols and external strings. */ - external_ext_size = ecoff_backend (abfd)->debug_swap.external_ext_size; - esize = symhdr->iextMax * external_ext_size; - external_ext = (PTR) bfd_malloc (esize); - if (external_ext == NULL && esize != 0) - goto error_return; - - if (bfd_seek (abfd, symhdr->cbExtOffset, SEEK_SET) != 0 - || bfd_read (external_ext, 1, esize, abfd) != esize) - goto error_return; - - ssext = (char *) bfd_malloc (symhdr->issExtMax); - if (ssext == NULL && symhdr->issExtMax != 0) - goto error_return; - - if (bfd_seek (abfd, symhdr->cbSsExtOffset, SEEK_SET) != 0 - || (bfd_read (ssext, 1, symhdr->issExtMax, abfd) - != (bfd_size_type) symhdr->issExtMax)) - goto error_return; - - result = ecoff_link_add_externals (abfd, info, external_ext, ssext); - - if (ssext != NULL) - free (ssext); - if (external_ext != NULL) - free (external_ext); - return result; - - error_return: - if (ssext != NULL) - free (ssext); - if (external_ext != NULL) - free (external_ext); - return false; -} - -/* Add the external symbols of an object file to the global linker - hash table. The external symbols and strings we are passed are - just allocated on the stack, and will be discarded. We must - explicitly save any information we may need later on in the link. - We do not want to read the external symbol information again. */ - -static boolean -ecoff_link_add_externals (abfd, info, external_ext, ssext) - bfd *abfd; - struct bfd_link_info *info; - PTR external_ext; - char *ssext; -{ - const struct ecoff_backend_data * const backend = ecoff_backend (abfd); - void (* const swap_ext_in) PARAMS ((bfd *, PTR, EXTR *)) - = backend->debug_swap.swap_ext_in; - bfd_size_type external_ext_size = backend->debug_swap.external_ext_size; - unsigned long ext_count; - struct ecoff_link_hash_entry **sym_hash; - char *ext_ptr; - char *ext_end; - - ext_count = ecoff_data (abfd)->debug_info.symbolic_header.iextMax; - - sym_hash = ((struct ecoff_link_hash_entry **) - bfd_alloc (abfd, - ext_count * sizeof (struct bfd_link_hash_entry *))); - if (!sym_hash) - return false; - ecoff_data (abfd)->sym_hashes = sym_hash; - - ext_ptr = (char *) external_ext; - ext_end = ext_ptr + ext_count * external_ext_size; - for (; ext_ptr < ext_end; ext_ptr += external_ext_size, sym_hash++) - { - EXTR esym; - boolean skip; - bfd_vma value; - asection *section; - const char *name; - struct ecoff_link_hash_entry *h; - - *sym_hash = NULL; - - (*swap_ext_in) (abfd, (PTR) ext_ptr, &esym); - - /* Skip debugging symbols. */ - skip = false; - switch (esym.asym.st) - { - case stGlobal: - case stStatic: - case stLabel: - case stProc: - case stStaticProc: - break; - default: - skip = true; - break; - } - - if (skip) - continue; - - /* Get the information for this symbol. */ - value = esym.asym.value; - switch (esym.asym.sc) - { - default: - case scNil: - case scRegister: - case scCdbLocal: - case scBits: - case scCdbSystem: - case scRegImage: - case scInfo: - case scUserStruct: - case scVar: - case scVarRegister: - case scVariant: - case scBasedVar: - case scXData: - case scPData: - section = NULL; - break; - case scText: - section = bfd_make_section_old_way (abfd, ".text"); - value -= section->vma; - break; - case scData: - section = bfd_make_section_old_way (abfd, ".data"); - value -= section->vma; - break; - case scBss: - section = bfd_make_section_old_way (abfd, ".bss"); - value -= section->vma; - break; - case scAbs: - section = bfd_abs_section_ptr; - break; - case scUndefined: - section = bfd_und_section_ptr; - break; - case scSData: - section = bfd_make_section_old_way (abfd, ".sdata"); - value -= section->vma; - break; - case scSBss: - section = bfd_make_section_old_way (abfd, ".sbss"); - value -= section->vma; - break; - case scRData: - section = bfd_make_section_old_way (abfd, ".rdata"); - value -= section->vma; - break; - case scCommon: - if (value > ecoff_data (abfd)->gp_size) - { - section = bfd_com_section_ptr; - break; - } - /* Fall through. */ - case scSCommon: - if (ecoff_scom_section.name == NULL) - { - /* Initialize the small common section. */ - ecoff_scom_section.name = SCOMMON; - ecoff_scom_section.flags = SEC_IS_COMMON; - ecoff_scom_section.output_section = &ecoff_scom_section; - ecoff_scom_section.symbol = &ecoff_scom_symbol; - ecoff_scom_section.symbol_ptr_ptr = &ecoff_scom_symbol_ptr; - ecoff_scom_symbol.name = SCOMMON; - ecoff_scom_symbol.flags = BSF_SECTION_SYM; - ecoff_scom_symbol.section = &ecoff_scom_section; - ecoff_scom_symbol_ptr = &ecoff_scom_symbol; - } - section = &ecoff_scom_section; - break; - case scSUndefined: - section = bfd_und_section_ptr; - break; - case scInit: - section = bfd_make_section_old_way (abfd, ".init"); - value -= section->vma; - break; - case scFini: - section = bfd_make_section_old_way (abfd, ".fini"); - value -= section->vma; - break; - case scRConst: - section = bfd_make_section_old_way (abfd, ".rconst"); - value -= section->vma; - break; - } - - if (section == (asection *) NULL) - continue; - - name = ssext + esym.asym.iss; - - h = NULL; - if (! (_bfd_generic_link_add_one_symbol - (info, abfd, name, - esym.weakext ? BSF_WEAK : BSF_GLOBAL, - section, value, (const char *) NULL, true, true, - (struct bfd_link_hash_entry **) &h))) - return false; - - *sym_hash = h; - - /* If we are building an ECOFF hash table, save the external - symbol information. */ - if (info->hash->creator->flavour == bfd_get_flavour (abfd)) - { - if (h->abfd == (bfd *) NULL - || (! bfd_is_und_section (section) - && (! bfd_is_com_section (section) - || (h->root.type != bfd_link_hash_defined - && h->root.type != bfd_link_hash_defweak)))) - { - h->abfd = abfd; - h->esym = esym; - } - - /* Remember whether this symbol was small undefined. */ - if (esym.asym.sc == scSUndefined) - h->small = 1; - - /* If this symbol was ever small undefined, it needs to wind - up in a GP relative section. We can't control the - section of a defined symbol, but we can control the - section of a common symbol. This case is actually needed - on Ultrix 4.2 to handle the symbol cred in -lckrb. */ - if (h->small - && h->root.type == bfd_link_hash_common - && strcmp (h->root.u.c.p->section->name, SCOMMON) != 0) - { - h->root.u.c.p->section = bfd_make_section_old_way (abfd, - SCOMMON); - h->root.u.c.p->section->flags = SEC_ALLOC; - if (h->esym.asym.sc == scCommon) - h->esym.asym.sc = scSCommon; - } - } - } - - return true; -} - -/* ECOFF final link routines. */ - -static boolean ecoff_final_link_debug_accumulate - PARAMS ((bfd *output_bfd, bfd *input_bfd, struct bfd_link_info *, - PTR handle)); -static boolean ecoff_link_write_external - PARAMS ((struct ecoff_link_hash_entry *, PTR)); -static boolean ecoff_indirect_link_order - PARAMS ((bfd *, struct bfd_link_info *, asection *, - struct bfd_link_order *)); -static boolean ecoff_reloc_link_order - PARAMS ((bfd *, struct bfd_link_info *, asection *, - struct bfd_link_order *)); - -/* Structure used to pass information to ecoff_link_write_external. */ - -struct extsym_info -{ - bfd *abfd; - struct bfd_link_info *info; -}; - -/* ECOFF final link routine. This looks through all the input BFDs - and gathers together all the debugging information, and then - processes all the link order information. This may cause it to - close and reopen some input BFDs; I'll see how bad this is. */ - -boolean -_bfd_ecoff_bfd_final_link (abfd, info) - bfd *abfd; - struct bfd_link_info *info; -{ - const struct ecoff_backend_data * const backend = ecoff_backend (abfd); - struct ecoff_debug_info * const debug = &ecoff_data (abfd)->debug_info; - HDRR *symhdr; - PTR handle; - register bfd *input_bfd; - asection *o; - struct bfd_link_order *p; - struct extsym_info einfo; - - /* We accumulate the debugging information counts in the symbolic - header. */ - symhdr = &debug->symbolic_header; - symhdr->vstamp = 0; - symhdr->ilineMax = 0; - symhdr->cbLine = 0; - symhdr->idnMax = 0; - symhdr->ipdMax = 0; - symhdr->isymMax = 0; - symhdr->ioptMax = 0; - symhdr->iauxMax = 0; - symhdr->issMax = 0; - symhdr->issExtMax = 0; - symhdr->ifdMax = 0; - symhdr->crfd = 0; - symhdr->iextMax = 0; - - /* We accumulate the debugging information itself in the debug_info - structure. */ - debug->line = NULL; - debug->external_dnr = NULL; - debug->external_pdr = NULL; - debug->external_sym = NULL; - debug->external_opt = NULL; - debug->external_aux = NULL; - debug->ss = NULL; - debug->ssext = debug->ssext_end = NULL; - debug->external_fdr = NULL; - debug->external_rfd = NULL; - debug->external_ext = debug->external_ext_end = NULL; - - handle = bfd_ecoff_debug_init (abfd, debug, &backend->debug_swap, info); - if (handle == (PTR) NULL) - return false; - - /* Accumulate the debugging symbols from each input BFD. */ - for (input_bfd = info->input_bfds; - input_bfd != (bfd *) NULL; - input_bfd = input_bfd->link_next) - { - boolean ret; - - if (bfd_get_flavour (input_bfd) == bfd_target_ecoff_flavour) - { - /* Abitrarily set the symbolic header vstamp to the vstamp - of the first object file in the link. */ - if (symhdr->vstamp == 0) - symhdr->vstamp - = ecoff_data (input_bfd)->debug_info.symbolic_header.vstamp; - ret = ecoff_final_link_debug_accumulate (abfd, input_bfd, info, - handle); - } - else - ret = bfd_ecoff_debug_accumulate_other (handle, abfd, - debug, &backend->debug_swap, - input_bfd, info); - if (! ret) - return false; - - /* Combine the register masks. */ - ecoff_data (abfd)->gprmask |= ecoff_data (input_bfd)->gprmask; - ecoff_data (abfd)->fprmask |= ecoff_data (input_bfd)->fprmask; - ecoff_data (abfd)->cprmask[0] |= ecoff_data (input_bfd)->cprmask[0]; - ecoff_data (abfd)->cprmask[1] |= ecoff_data (input_bfd)->cprmask[1]; - ecoff_data (abfd)->cprmask[2] |= ecoff_data (input_bfd)->cprmask[2]; - ecoff_data (abfd)->cprmask[3] |= ecoff_data (input_bfd)->cprmask[3]; - } - - /* Write out the external symbols. */ - einfo.abfd = abfd; - einfo.info = info; - ecoff_link_hash_traverse (ecoff_hash_table (info), - ecoff_link_write_external, - (PTR) &einfo); - - if (info->relocateable) - { - /* We need to make a pass over the link_orders to count up the - number of relocations we will need to output, so that we know - how much space they will take up. */ - for (o = abfd->sections; o != (asection *) NULL; o = o->next) - { - o->reloc_count = 0; - for (p = o->link_order_head; - p != (struct bfd_link_order *) NULL; - p = p->next) - if (p->type == bfd_indirect_link_order) - o->reloc_count += p->u.indirect.section->reloc_count; - else if (p->type == bfd_section_reloc_link_order - || p->type == bfd_symbol_reloc_link_order) - ++o->reloc_count; - } - } - - /* Compute the reloc and symbol file positions. */ - ecoff_compute_reloc_file_positions (abfd); - - /* Write out the debugging information. */ - if (! bfd_ecoff_write_accumulated_debug (handle, abfd, debug, - &backend->debug_swap, info, - ecoff_data (abfd)->sym_filepos)) - return false; - - bfd_ecoff_debug_free (handle, abfd, debug, &backend->debug_swap, info); - - if (info->relocateable) - { - /* Now reset the reloc_count field of the sections in the output - BFD to 0, so that we can use them to keep track of how many - relocs we have output thus far. */ - for (o = abfd->sections; o != (asection *) NULL; o = o->next) - o->reloc_count = 0; - } - - /* Get a value for the GP register. */ - if (ecoff_data (abfd)->gp == 0) - { - struct bfd_link_hash_entry *h; - - h = bfd_link_hash_lookup (info->hash, "_gp", false, false, true); - if (h != (struct bfd_link_hash_entry *) NULL - && h->type == bfd_link_hash_defined) - ecoff_data (abfd)->gp = (h->u.def.value - + h->u.def.section->output_section->vma - + h->u.def.section->output_offset); - else if (info->relocateable) - { - bfd_vma lo; - - /* Make up a value. */ - lo = (bfd_vma) -1; - for (o = abfd->sections; o != (asection *) NULL; o = o->next) - { - if (o->vma < lo - && (strcmp (o->name, _SBSS) == 0 - || strcmp (o->name, _SDATA) == 0 - || strcmp (o->name, _LIT4) == 0 - || strcmp (o->name, _LIT8) == 0 - || strcmp (o->name, _LITA) == 0)) - lo = o->vma; - } - ecoff_data (abfd)->gp = lo + 0x8000; - } - else - { - /* If the relocate_section function needs to do a reloc - involving the GP value, it should make a reloc_dangerous - callback to warn that GP is not defined. */ - } - } - - for (o = abfd->sections; o != (asection *) NULL; o = o->next) - { - for (p = o->link_order_head; - p != (struct bfd_link_order *) NULL; - p = p->next) - { - if (p->type == bfd_indirect_link_order - && (bfd_get_flavour (p->u.indirect.section->owner) - == bfd_target_ecoff_flavour)) - { - if (! ecoff_indirect_link_order (abfd, info, o, p)) - return false; - } - else if (p->type == bfd_section_reloc_link_order - || p->type == bfd_symbol_reloc_link_order) - { - if (! ecoff_reloc_link_order (abfd, info, o, p)) - return false; - } - else - { - if (! _bfd_default_link_order (abfd, info, o, p)) - return false; - } - } - } - - bfd_get_symcount (abfd) = symhdr->iextMax + symhdr->isymMax; - - ecoff_data (abfd)->linker = true; - - return true; -} - -/* Accumulate the debugging information for an input BFD into the - output BFD. This must read in the symbolic information of the - input BFD. */ - -static boolean -ecoff_final_link_debug_accumulate (output_bfd, input_bfd, info, handle) - bfd *output_bfd; - bfd *input_bfd; - struct bfd_link_info *info; - PTR handle; -{ - struct ecoff_debug_info * const debug = &ecoff_data (input_bfd)->debug_info; - const struct ecoff_debug_swap * const swap = - &ecoff_backend (input_bfd)->debug_swap; - HDRR *symhdr = &debug->symbolic_header; - boolean ret; - -#define READ(ptr, offset, count, size, type) \ - if (symhdr->count == 0) \ - debug->ptr = NULL; \ - else \ - { \ - debug->ptr = (type) bfd_malloc ((size_t) (size * symhdr->count)); \ - if (debug->ptr == NULL) \ - { \ - ret = false; \ - goto return_something; \ - } \ - if ((bfd_seek (input_bfd, (file_ptr) symhdr->offset, SEEK_SET) \ - != 0) \ - || (bfd_read (debug->ptr, size, symhdr->count, \ - input_bfd) != size * symhdr->count)) \ - { \ - ret = false; \ - goto return_something; \ - } \ - } - - /* If raw_syments is not NULL, then the data was already by read by - _bfd_ecoff_slurp_symbolic_info. */ - if (ecoff_data (input_bfd)->raw_syments == NULL) - { - READ (line, cbLineOffset, cbLine, sizeof (unsigned char), - unsigned char *); - READ (external_dnr, cbDnOffset, idnMax, swap->external_dnr_size, PTR); - READ (external_pdr, cbPdOffset, ipdMax, swap->external_pdr_size, PTR); - READ (external_sym, cbSymOffset, isymMax, swap->external_sym_size, PTR); - READ (external_opt, cbOptOffset, ioptMax, swap->external_opt_size, PTR); - READ (external_aux, cbAuxOffset, iauxMax, sizeof (union aux_ext), - union aux_ext *); - READ (ss, cbSsOffset, issMax, sizeof (char), char *); - READ (external_fdr, cbFdOffset, ifdMax, swap->external_fdr_size, PTR); - READ (external_rfd, cbRfdOffset, crfd, swap->external_rfd_size, PTR); - } -#undef READ - - /* We do not read the external strings or the external symbols. */ - - ret = (bfd_ecoff_debug_accumulate - (handle, output_bfd, &ecoff_data (output_bfd)->debug_info, - &ecoff_backend (output_bfd)->debug_swap, - input_bfd, debug, swap, info)); - - return_something: - if (ecoff_data (input_bfd)->raw_syments == NULL) - { - if (debug->line != NULL) - free (debug->line); - if (debug->external_dnr != NULL) - free (debug->external_dnr); - if (debug->external_pdr != NULL) - free (debug->external_pdr); - if (debug->external_sym != NULL) - free (debug->external_sym); - if (debug->external_opt != NULL) - free (debug->external_opt); - if (debug->external_aux != NULL) - free (debug->external_aux); - if (debug->ss != NULL) - free (debug->ss); - if (debug->external_fdr != NULL) - free (debug->external_fdr); - if (debug->external_rfd != NULL) - free (debug->external_rfd); - - /* Make sure we don't accidentally follow one of these pointers - into freed memory. */ - debug->line = NULL; - debug->external_dnr = NULL; - debug->external_pdr = NULL; - debug->external_sym = NULL; - debug->external_opt = NULL; - debug->external_aux = NULL; - debug->ss = NULL; - debug->external_fdr = NULL; - debug->external_rfd = NULL; - } - - return ret; -} - -/* Put out information for an external symbol. These come only from - the hash table. */ - -static boolean -ecoff_link_write_external (h, data) - struct ecoff_link_hash_entry *h; - PTR data; -{ - struct extsym_info *einfo = (struct extsym_info *) data; - bfd *output_bfd = einfo->abfd; - boolean strip; - - /* We need to check if this symbol is being stripped. */ - if (h->root.type == bfd_link_hash_undefined - || h->root.type == bfd_link_hash_undefweak) - strip = false; - else if (einfo->info->strip == strip_all - || (einfo->info->strip == strip_some - && bfd_hash_lookup (einfo->info->keep_hash, - h->root.root.string, - false, false) == NULL)) - strip = true; - else - strip = false; - - if (strip || h->written) - return true; - - if (h->abfd == (bfd *) NULL) - { - h->esym.jmptbl = 0; - h->esym.cobol_main = 0; - h->esym.weakext = 0; - h->esym.reserved = 0; - h->esym.ifd = ifdNil; - h->esym.asym.value = 0; - h->esym.asym.st = stGlobal; - - if (h->root.type != bfd_link_hash_defined - && h->root.type != bfd_link_hash_defweak) - h->esym.asym.sc = scAbs; - else - { - asection *output_section; - const char *name; - - output_section = h->root.u.def.section->output_section; - name = bfd_section_name (output_section->owner, output_section); - - if (strcmp (name, _TEXT) == 0) - h->esym.asym.sc = scText; - else if (strcmp (name, _DATA) == 0) - h->esym.asym.sc = scData; - else if (strcmp (name, _SDATA) == 0) - h->esym.asym.sc = scSData; - else if (strcmp (name, _RDATA) == 0) - h->esym.asym.sc = scRData; - else if (strcmp (name, _BSS) == 0) - h->esym.asym.sc = scBss; - else if (strcmp (name, _SBSS) == 0) - h->esym.asym.sc = scSBss; - else if (strcmp (name, _INIT) == 0) - h->esym.asym.sc = scInit; - else if (strcmp (name, _FINI) == 0) - h->esym.asym.sc = scFini; - else if (strcmp (name, _PDATA) == 0) - h->esym.asym.sc = scPData; - else if (strcmp (name, _XDATA) == 0) - h->esym.asym.sc = scXData; - else if (strcmp (name, _RCONST) == 0) - h->esym.asym.sc = scRConst; - else - h->esym.asym.sc = scAbs; - } - - h->esym.asym.reserved = 0; - h->esym.asym.index = indexNil; - } - else if (h->esym.ifd != -1) - { - struct ecoff_debug_info *debug; - - /* Adjust the FDR index for the symbol by that used for the - input BFD. */ - debug = &ecoff_data (h->abfd)->debug_info; - BFD_ASSERT (h->esym.ifd >= 0 - && h->esym.ifd < debug->symbolic_header.ifdMax); - h->esym.ifd = debug->ifdmap[h->esym.ifd]; - } - - switch (h->root.type) - { - default: - case bfd_link_hash_new: - abort (); - case bfd_link_hash_undefined: - case bfd_link_hash_undefweak: - if (h->esym.asym.sc != scUndefined - && h->esym.asym.sc != scSUndefined) - h->esym.asym.sc = scUndefined; - break; - case bfd_link_hash_defined: - case bfd_link_hash_defweak: - if (h->esym.asym.sc == scUndefined - || h->esym.asym.sc == scSUndefined) - h->esym.asym.sc = scAbs; - else if (h->esym.asym.sc == scCommon) - h->esym.asym.sc = scBss; - else if (h->esym.asym.sc == scSCommon) - h->esym.asym.sc = scSBss; - h->esym.asym.value = (h->root.u.def.value - + h->root.u.def.section->output_section->vma - + h->root.u.def.section->output_offset); - break; - case bfd_link_hash_common: - if (h->esym.asym.sc != scCommon - && h->esym.asym.sc != scSCommon) - h->esym.asym.sc = scCommon; - h->esym.asym.value = h->root.u.c.size; - break; - case bfd_link_hash_indirect: - case bfd_link_hash_warning: - /* FIXME: Ignore these for now. The circumstances under which - they should be written out are not clear to me. */ - return true; - } - - /* bfd_ecoff_debug_one_external uses iextMax to keep track of the - symbol number. */ - h->indx = ecoff_data (output_bfd)->debug_info.symbolic_header.iextMax; - h->written = 1; - - return (bfd_ecoff_debug_one_external - (output_bfd, &ecoff_data (output_bfd)->debug_info, - &ecoff_backend (output_bfd)->debug_swap, h->root.root.string, - &h->esym)); -} - -/* Relocate and write an ECOFF section into an ECOFF output file. */ - -static boolean -ecoff_indirect_link_order (output_bfd, info, output_section, link_order) - bfd *output_bfd; - struct bfd_link_info *info; - asection *output_section; - struct bfd_link_order *link_order; -{ - asection *input_section; - bfd *input_bfd; - struct ecoff_section_tdata *section_tdata; - bfd_size_type raw_size; - bfd_size_type cooked_size; - bfd_byte *contents = NULL; - bfd_size_type external_reloc_size; - bfd_size_type external_relocs_size; - PTR external_relocs = NULL; - - BFD_ASSERT ((output_section->flags & SEC_HAS_CONTENTS) != 0); - - if (link_order->size == 0) - return true; - - input_section = link_order->u.indirect.section; - input_bfd = input_section->owner; - section_tdata = ecoff_section_data (input_bfd, input_section); - - raw_size = input_section->_raw_size; - cooked_size = input_section->_cooked_size; - if (cooked_size == 0) - cooked_size = raw_size; - - BFD_ASSERT (input_section->output_section == output_section); - BFD_ASSERT (input_section->output_offset == link_order->offset); - BFD_ASSERT (cooked_size == link_order->size); - - /* Get the section contents. We allocate memory for the larger of - the size before relocating and the size after relocating. */ - contents = (bfd_byte *) bfd_malloc (raw_size >= cooked_size - ? (size_t) raw_size - : (size_t) cooked_size); - if (contents == NULL && raw_size != 0) - goto error_return; - - /* If we are relaxing, the contents may have already been read into - memory, in which case we copy them into our new buffer. We don't - simply reuse the old buffer in case cooked_size > raw_size. */ - if (section_tdata != (struct ecoff_section_tdata *) NULL - && section_tdata->contents != (bfd_byte *) NULL) - memcpy (contents, section_tdata->contents, (size_t) raw_size); - else - { - if (! bfd_get_section_contents (input_bfd, input_section, - (PTR) contents, - (file_ptr) 0, raw_size)) - goto error_return; - } - - /* Get the relocs. If we are relaxing MIPS code, they will already - have been read in. Otherwise, we read them in now. */ - external_reloc_size = ecoff_backend (input_bfd)->external_reloc_size; - external_relocs_size = external_reloc_size * input_section->reloc_count; - - if (section_tdata != (struct ecoff_section_tdata *) NULL - && section_tdata->external_relocs != NULL) - external_relocs = section_tdata->external_relocs; - else - { - external_relocs = (PTR) bfd_malloc ((size_t) external_relocs_size); - if (external_relocs == NULL && external_relocs_size != 0) - goto error_return; - - if (bfd_seek (input_bfd, input_section->rel_filepos, SEEK_SET) != 0 - || (bfd_read (external_relocs, 1, external_relocs_size, input_bfd) - != external_relocs_size)) - goto error_return; - } - - /* Relocate the section contents. */ - if (! ((*ecoff_backend (input_bfd)->relocate_section) - (output_bfd, info, input_bfd, input_section, contents, - external_relocs))) - goto error_return; - - /* Write out the relocated section. */ - if (! bfd_set_section_contents (output_bfd, - output_section, - (PTR) contents, - input_section->output_offset, - cooked_size)) - goto error_return; - - /* If we are producing relocateable output, the relocs were - modified, and we write them out now. We use the reloc_count - field of output_section to keep track of the number of relocs we - have output so far. */ - if (info->relocateable) - { - if (bfd_seek (output_bfd, - (output_section->rel_filepos + - output_section->reloc_count * external_reloc_size), - SEEK_SET) != 0 - || (bfd_write (external_relocs, 1, external_relocs_size, output_bfd) - != external_relocs_size)) - goto error_return; - output_section->reloc_count += input_section->reloc_count; - } - - if (contents != NULL) - free (contents); - if (external_relocs != NULL && section_tdata == NULL) - free (external_relocs); - return true; - - error_return: - if (contents != NULL) - free (contents); - if (external_relocs != NULL && section_tdata == NULL) - free (external_relocs); - return false; -} - -/* Generate a reloc when linking an ECOFF file. This is a reloc - requested by the linker, and does come from any input file. This - is used to build constructor and destructor tables when linking - with -Ur. */ - -static boolean -ecoff_reloc_link_order (output_bfd, info, output_section, link_order) - bfd *output_bfd; - struct bfd_link_info *info; - asection *output_section; - struct bfd_link_order *link_order; -{ - enum bfd_link_order_type type; - asection *section; - bfd_vma addend; - arelent rel; - struct internal_reloc in; - bfd_size_type external_reloc_size; - bfd_byte *rbuf; - boolean ok; - - type = link_order->type; - section = NULL; - addend = link_order->u.reloc.p->addend; - - /* We set up an arelent to pass to the backend adjust_reloc_out - routine. */ - rel.address = link_order->offset; - - rel.howto = bfd_reloc_type_lookup (output_bfd, link_order->u.reloc.p->reloc); - if (rel.howto == 0) - { - bfd_set_error (bfd_error_bad_value); - return false; - } - - if (type == bfd_section_reloc_link_order) - { - section = link_order->u.reloc.p->u.section; - rel.sym_ptr_ptr = section->symbol_ptr_ptr; - } - else - { - struct bfd_link_hash_entry *h; - - /* Treat a reloc against a defined symbol as though it were - actually against the section. */ - h = bfd_wrapped_link_hash_lookup (output_bfd, info, - link_order->u.reloc.p->u.name, - false, false, false); - if (h != NULL - && (h->type == bfd_link_hash_defined - || h->type == bfd_link_hash_defweak)) - { - type = bfd_section_reloc_link_order; - section = h->u.def.section->output_section; - /* It seems that we ought to add the symbol value to the - addend here, but in practice it has already been added - because it was passed to constructor_callback. */ - addend += section->vma + h->u.def.section->output_offset; - } - else - { - /* We can't set up a reloc against a symbol correctly, - because we have no asymbol structure. Currently no - adjust_reloc_out routine cares. */ - rel.sym_ptr_ptr = (asymbol **) NULL; - } - } - - /* All ECOFF relocs are in-place. Put the addend into the object - file. */ - - BFD_ASSERT (rel.howto->partial_inplace); - if (addend != 0) - { - bfd_size_type size; - bfd_reloc_status_type rstat; - bfd_byte *buf; - boolean ok; - - size = bfd_get_reloc_size (rel.howto); - buf = (bfd_byte *) bfd_zmalloc (size); - if (buf == (bfd_byte *) NULL) - return false; - rstat = _bfd_relocate_contents (rel.howto, output_bfd, addend, buf); - switch (rstat) - { - case bfd_reloc_ok: - break; - default: - case bfd_reloc_outofrange: - abort (); - case bfd_reloc_overflow: - if (! ((*info->callbacks->reloc_overflow) - (info, - (link_order->type == bfd_section_reloc_link_order - ? bfd_section_name (output_bfd, section) - : link_order->u.reloc.p->u.name), - rel.howto->name, addend, (bfd *) NULL, - (asection *) NULL, (bfd_vma) 0))) - { - free (buf); - return false; - } - break; - } - ok = bfd_set_section_contents (output_bfd, output_section, (PTR) buf, - (file_ptr) link_order->offset, size); - free (buf); - if (! ok) - return false; - } - - rel.addend = 0; - - /* Move the information into a internal_reloc structure. */ - in.r_vaddr = (rel.address - + bfd_get_section_vma (output_bfd, output_section)); - in.r_type = rel.howto->type; - - if (type == bfd_symbol_reloc_link_order) - { - struct ecoff_link_hash_entry *h; - - h = ((struct ecoff_link_hash_entry *) - bfd_wrapped_link_hash_lookup (output_bfd, info, - link_order->u.reloc.p->u.name, - false, false, true)); - if (h != (struct ecoff_link_hash_entry *) NULL - && h->indx != -1) - in.r_symndx = h->indx; - else - { - if (! ((*info->callbacks->unattached_reloc) - (info, link_order->u.reloc.p->u.name, (bfd *) NULL, - (asection *) NULL, (bfd_vma) 0))) - return false; - in.r_symndx = 0; - } - in.r_extern = 1; - } - else - { - CONST char *name; - - name = bfd_get_section_name (output_bfd, section); - if (strcmp (name, ".text") == 0) - in.r_symndx = RELOC_SECTION_TEXT; - else if (strcmp (name, ".rdata") == 0) - in.r_symndx = RELOC_SECTION_RDATA; - else if (strcmp (name, ".data") == 0) - in.r_symndx = RELOC_SECTION_DATA; - else if (strcmp (name, ".sdata") == 0) - in.r_symndx = RELOC_SECTION_SDATA; - else if (strcmp (name, ".sbss") == 0) - in.r_symndx = RELOC_SECTION_SBSS; - else if (strcmp (name, ".bss") == 0) - in.r_symndx = RELOC_SECTION_BSS; - else if (strcmp (name, ".init") == 0) - in.r_symndx = RELOC_SECTION_INIT; - else if (strcmp (name, ".lit8") == 0) - in.r_symndx = RELOC_SECTION_LIT8; - else if (strcmp (name, ".lit4") == 0) - in.r_symndx = RELOC_SECTION_LIT4; - else if (strcmp (name, ".xdata") == 0) - in.r_symndx = RELOC_SECTION_XDATA; - else if (strcmp (name, ".pdata") == 0) - in.r_symndx = RELOC_SECTION_PDATA; - else if (strcmp (name, ".fini") == 0) - in.r_symndx = RELOC_SECTION_FINI; - else if (strcmp (name, ".lita") == 0) - in.r_symndx = RELOC_SECTION_LITA; - else if (strcmp (name, "*ABS*") == 0) - in.r_symndx = RELOC_SECTION_ABS; - else if (strcmp (name, ".rconst") == 0) - in.r_symndx = RELOC_SECTION_RCONST; - else - abort (); - in.r_extern = 0; - } - - /* Let the BFD backend adjust the reloc. */ - (*ecoff_backend (output_bfd)->adjust_reloc_out) (output_bfd, &rel, &in); - - /* Get some memory and swap out the reloc. */ - external_reloc_size = ecoff_backend (output_bfd)->external_reloc_size; - rbuf = (bfd_byte *) bfd_malloc ((size_t) external_reloc_size); - if (rbuf == (bfd_byte *) NULL) - return false; - - (*ecoff_backend (output_bfd)->swap_reloc_out) (output_bfd, &in, (PTR) rbuf); - - ok = (bfd_seek (output_bfd, - (output_section->rel_filepos + - output_section->reloc_count * external_reloc_size), - SEEK_SET) == 0 - && (bfd_write ((PTR) rbuf, 1, external_reloc_size, output_bfd) - == external_reloc_size)); - - if (ok) - ++output_section->reloc_count; - - free (rbuf); - - return ok; -} diff --git a/contrib/gdb/bfd/ecofflink.c b/contrib/gdb/bfd/ecofflink.c deleted file mode 100644 index 03d6e00..0000000 --- a/contrib/gdb/bfd/ecofflink.c +++ /dev/null @@ -1,2452 +0,0 @@ -/* Routines to link ECOFF debugging information. - Copyright 1993 Free Software Foundation, Inc. - Written by Ian Lance Taylor, Cygnus Support, . - -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 "obstack.h" -#include "aout/stab_gnu.h" -#include "coff/internal.h" -#include "coff/sym.h" -#include "coff/symconst.h" -#include "coff/ecoff.h" - -static boolean ecoff_add_bytes PARAMS ((char **buf, char **bufend, - size_t need)); -static struct bfd_hash_entry *string_hash_newfunc - PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, - const char *)); -static void ecoff_align_debug PARAMS ((bfd *abfd, - struct ecoff_debug_info *debug, - const struct ecoff_debug_swap *swap)); -static boolean ecoff_write_symhdr PARAMS ((bfd *, struct ecoff_debug_info *, - const struct ecoff_debug_swap *, - file_ptr where)); -static int cmp_fdrtab_entry PARAMS ((const PTR, const PTR)); -static boolean mk_fdrtab PARAMS ((bfd *, - struct ecoff_debug_info * const, - const struct ecoff_debug_swap * const, - struct ecoff_find_line *)); -static long fdrtab_lookup PARAMS ((struct ecoff_find_line *, bfd_vma)); - -/* Obstack allocation and deallocation routines. */ -#define obstack_chunk_alloc malloc -#define obstack_chunk_free free - -/* Routines to swap auxiliary information in and out. I am assuming - that the auxiliary information format is always going to be target - independent. */ - -/* Swap in a type information record. - BIGEND says whether AUX symbols are big-endian or little-endian; this - info comes from the file header record (fh-fBigendian). */ - -void -_bfd_ecoff_swap_tir_in (bigend, ext_copy, intern) - int bigend; - const struct tir_ext *ext_copy; - TIR *intern; -{ - struct tir_ext ext[1]; - - *ext = *ext_copy; /* Make it reasonable to do in-place. */ - - /* now the fun stuff... */ - if (bigend) { - intern->fBitfield = 0 != (ext->t_bits1[0] & TIR_BITS1_FBITFIELD_BIG); - intern->continued = 0 != (ext->t_bits1[0] & TIR_BITS1_CONTINUED_BIG); - intern->bt = (ext->t_bits1[0] & TIR_BITS1_BT_BIG) - >> TIR_BITS1_BT_SH_BIG; - intern->tq4 = (ext->t_tq45[0] & TIR_BITS_TQ4_BIG) - >> TIR_BITS_TQ4_SH_BIG; - intern->tq5 = (ext->t_tq45[0] & TIR_BITS_TQ5_BIG) - >> TIR_BITS_TQ5_SH_BIG; - intern->tq0 = (ext->t_tq01[0] & TIR_BITS_TQ0_BIG) - >> TIR_BITS_TQ0_SH_BIG; - intern->tq1 = (ext->t_tq01[0] & TIR_BITS_TQ1_BIG) - >> TIR_BITS_TQ1_SH_BIG; - intern->tq2 = (ext->t_tq23[0] & TIR_BITS_TQ2_BIG) - >> TIR_BITS_TQ2_SH_BIG; - intern->tq3 = (ext->t_tq23[0] & TIR_BITS_TQ3_BIG) - >> TIR_BITS_TQ3_SH_BIG; - } else { - intern->fBitfield = 0 != (ext->t_bits1[0] & TIR_BITS1_FBITFIELD_LITTLE); - intern->continued = 0 != (ext->t_bits1[0] & TIR_BITS1_CONTINUED_LITTLE); - intern->bt = (ext->t_bits1[0] & TIR_BITS1_BT_LITTLE) - >> TIR_BITS1_BT_SH_LITTLE; - intern->tq4 = (ext->t_tq45[0] & TIR_BITS_TQ4_LITTLE) - >> TIR_BITS_TQ4_SH_LITTLE; - intern->tq5 = (ext->t_tq45[0] & TIR_BITS_TQ5_LITTLE) - >> TIR_BITS_TQ5_SH_LITTLE; - intern->tq0 = (ext->t_tq01[0] & TIR_BITS_TQ0_LITTLE) - >> TIR_BITS_TQ0_SH_LITTLE; - intern->tq1 = (ext->t_tq01[0] & TIR_BITS_TQ1_LITTLE) - >> TIR_BITS_TQ1_SH_LITTLE; - intern->tq2 = (ext->t_tq23[0] & TIR_BITS_TQ2_LITTLE) - >> TIR_BITS_TQ2_SH_LITTLE; - intern->tq3 = (ext->t_tq23[0] & TIR_BITS_TQ3_LITTLE) - >> TIR_BITS_TQ3_SH_LITTLE; - } - -#ifdef TEST - if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0) - abort(); -#endif -} - -/* Swap out a type information record. - BIGEND says whether AUX symbols are big-endian or little-endian; this - info comes from the file header record (fh-fBigendian). */ - -void -_bfd_ecoff_swap_tir_out (bigend, intern_copy, ext) - int bigend; - const TIR *intern_copy; - struct tir_ext *ext; -{ - TIR intern[1]; - - *intern = *intern_copy; /* Make it reasonable to do in-place. */ - - /* now the fun stuff... */ - if (bigend) { - ext->t_bits1[0] = ((intern->fBitfield ? TIR_BITS1_FBITFIELD_BIG : 0) - | (intern->continued ? TIR_BITS1_CONTINUED_BIG : 0) - | ((intern->bt << TIR_BITS1_BT_SH_BIG) - & TIR_BITS1_BT_BIG)); - ext->t_tq45[0] = (((intern->tq4 << TIR_BITS_TQ4_SH_BIG) - & TIR_BITS_TQ4_BIG) - | ((intern->tq5 << TIR_BITS_TQ5_SH_BIG) - & TIR_BITS_TQ5_BIG)); - ext->t_tq01[0] = (((intern->tq0 << TIR_BITS_TQ0_SH_BIG) - & TIR_BITS_TQ0_BIG) - | ((intern->tq1 << TIR_BITS_TQ1_SH_BIG) - & TIR_BITS_TQ1_BIG)); - ext->t_tq23[0] = (((intern->tq2 << TIR_BITS_TQ2_SH_BIG) - & TIR_BITS_TQ2_BIG) - | ((intern->tq3 << TIR_BITS_TQ3_SH_BIG) - & TIR_BITS_TQ3_BIG)); - } else { - ext->t_bits1[0] = ((intern->fBitfield ? TIR_BITS1_FBITFIELD_LITTLE : 0) - | (intern->continued ? TIR_BITS1_CONTINUED_LITTLE : 0) - | ((intern->bt << TIR_BITS1_BT_SH_LITTLE) - & TIR_BITS1_BT_LITTLE)); - ext->t_tq45[0] = (((intern->tq4 << TIR_BITS_TQ4_SH_LITTLE) - & TIR_BITS_TQ4_LITTLE) - | ((intern->tq5 << TIR_BITS_TQ5_SH_LITTLE) - & TIR_BITS_TQ5_LITTLE)); - ext->t_tq01[0] = (((intern->tq0 << TIR_BITS_TQ0_SH_LITTLE) - & TIR_BITS_TQ0_LITTLE) - | ((intern->tq1 << TIR_BITS_TQ1_SH_LITTLE) - & TIR_BITS_TQ1_LITTLE)); - ext->t_tq23[0] = (((intern->tq2 << TIR_BITS_TQ2_SH_LITTLE) - & TIR_BITS_TQ2_LITTLE) - | ((intern->tq3 << TIR_BITS_TQ3_SH_LITTLE) - & TIR_BITS_TQ3_LITTLE)); - } - -#ifdef TEST - if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0) - abort(); -#endif -} - -/* Swap in a relative symbol record. BIGEND says whether it is in - big-endian or little-endian format.*/ - -void -_bfd_ecoff_swap_rndx_in (bigend, ext_copy, intern) - int bigend; - const struct rndx_ext *ext_copy; - RNDXR *intern; -{ - struct rndx_ext ext[1]; - - *ext = *ext_copy; /* Make it reasonable to do in-place. */ - - /* now the fun stuff... */ - if (bigend) { - intern->rfd = (ext->r_bits[0] << RNDX_BITS0_RFD_SH_LEFT_BIG) - | ((ext->r_bits[1] & RNDX_BITS1_RFD_BIG) - >> RNDX_BITS1_RFD_SH_BIG); - intern->index = ((ext->r_bits[1] & RNDX_BITS1_INDEX_BIG) - << RNDX_BITS1_INDEX_SH_LEFT_BIG) - | (ext->r_bits[2] << RNDX_BITS2_INDEX_SH_LEFT_BIG) - | (ext->r_bits[3] << RNDX_BITS3_INDEX_SH_LEFT_BIG); - } else { - intern->rfd = (ext->r_bits[0] << RNDX_BITS0_RFD_SH_LEFT_LITTLE) - | ((ext->r_bits[1] & RNDX_BITS1_RFD_LITTLE) - << RNDX_BITS1_RFD_SH_LEFT_LITTLE); - intern->index = ((ext->r_bits[1] & RNDX_BITS1_INDEX_LITTLE) - >> RNDX_BITS1_INDEX_SH_LITTLE) - | (ext->r_bits[2] << RNDX_BITS2_INDEX_SH_LEFT_LITTLE) - | ((unsigned int) ext->r_bits[3] - << RNDX_BITS3_INDEX_SH_LEFT_LITTLE); - } - -#ifdef TEST - if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0) - abort(); -#endif -} - -/* Swap out a relative symbol record. BIGEND says whether it is in - big-endian or little-endian format.*/ - -void -_bfd_ecoff_swap_rndx_out (bigend, intern_copy, ext) - int bigend; - const RNDXR *intern_copy; - struct rndx_ext *ext; -{ - RNDXR intern[1]; - - *intern = *intern_copy; /* Make it reasonable to do in-place. */ - - /* now the fun stuff... */ - if (bigend) { - ext->r_bits[0] = intern->rfd >> RNDX_BITS0_RFD_SH_LEFT_BIG; - ext->r_bits[1] = (((intern->rfd << RNDX_BITS1_RFD_SH_BIG) - & RNDX_BITS1_RFD_BIG) - | ((intern->index >> RNDX_BITS1_INDEX_SH_LEFT_BIG) - & RNDX_BITS1_INDEX_BIG)); - ext->r_bits[2] = intern->index >> RNDX_BITS2_INDEX_SH_LEFT_BIG; - ext->r_bits[3] = intern->index >> RNDX_BITS3_INDEX_SH_LEFT_BIG; - } else { - ext->r_bits[0] = intern->rfd >> RNDX_BITS0_RFD_SH_LEFT_LITTLE; - ext->r_bits[1] = (((intern->rfd >> RNDX_BITS1_RFD_SH_LEFT_LITTLE) - & RNDX_BITS1_RFD_LITTLE) - | ((intern->index << RNDX_BITS1_INDEX_SH_LITTLE) - & RNDX_BITS1_INDEX_LITTLE)); - ext->r_bits[2] = intern->index >> RNDX_BITS2_INDEX_SH_LEFT_LITTLE; - ext->r_bits[3] = intern->index >> RNDX_BITS3_INDEX_SH_LEFT_LITTLE; - } - -#ifdef TEST - if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0) - abort(); -#endif -} - -/* The minimum amount of data to allocate. */ -#define ALLOC_SIZE (4064) - -/* Add bytes to a buffer. Return success. */ - -static boolean -ecoff_add_bytes (buf, bufend, need) - char **buf; - char **bufend; - size_t need; -{ - size_t have; - size_t want; - char *newbuf; - - have = *bufend - *buf; - if (have > need) - want = ALLOC_SIZE; - else - { - want = need - have; - if (want < ALLOC_SIZE) - want = ALLOC_SIZE; - } - newbuf = (char *) bfd_realloc (*buf, have + want); - if (newbuf == NULL) - return false; - *buf = newbuf; - *bufend = *buf + have + want; - return true; -} - -/* We keep a hash table which maps strings to numbers. We use it to - map FDR names to indices in the output file, and to map local - strings when combining stabs debugging information. */ - -struct string_hash_entry -{ - struct bfd_hash_entry root; - /* FDR index or string table offset. */ - long val; - /* Next entry in string table. */ - struct string_hash_entry *next; -}; - -struct string_hash_table -{ - struct bfd_hash_table table; -}; - -/* Routine to create an entry in a string hash table. */ - -static struct bfd_hash_entry * -string_hash_newfunc (entry, table, string) - struct bfd_hash_entry *entry; - struct bfd_hash_table *table; - const char *string; -{ - struct string_hash_entry *ret = (struct string_hash_entry *) entry; - - /* Allocate the structure if it has not already been allocated by a - subclass. */ - if (ret == (struct string_hash_entry *) NULL) - ret = ((struct string_hash_entry *) - bfd_hash_allocate (table, sizeof (struct string_hash_entry))); - if (ret == (struct string_hash_entry *) NULL) - return NULL; - - /* Call the allocation method of the superclass. */ - ret = ((struct string_hash_entry *) - bfd_hash_newfunc ((struct bfd_hash_entry *) ret, table, string)); - - if (ret) - { - /* Initialize the local fields. */ - ret->val = -1; - ret->next = NULL; - } - - return (struct bfd_hash_entry *) ret; -} - -/* Look up an entry in an string hash table. */ - -#define string_hash_lookup(t, string, create, copy) \ - ((struct string_hash_entry *) \ - bfd_hash_lookup (&(t)->table, (string), (create), (copy))) - -/* We can't afford to read in all the debugging information when we do - a link. Instead, we build a list of these structures to show how - different parts of the input file map to the output file. */ - -struct shuffle -{ - /* The next entry in this linked list. */ - struct shuffle *next; - /* The length of the information. */ - unsigned long size; - /* Whether this information comes from a file or not. */ - boolean filep; - union - { - struct - { - /* The BFD the data comes from. */ - bfd *input_bfd; - /* The offset within input_bfd. */ - file_ptr offset; - } file; - /* The data to be written out. */ - PTR memory; - } u; -}; - -/* This structure holds information across calls to - bfd_ecoff_debug_accumulate. */ - -struct accumulate -{ - /* The FDR hash table. */ - struct string_hash_table fdr_hash; - /* The strings hash table. */ - struct string_hash_table str_hash; - /* Linked lists describing how to shuffle the input debug - information into the output file. We keep a pointer to both the - head and the tail. */ - struct shuffle *line; - struct shuffle *line_end; - struct shuffle *pdr; - struct shuffle *pdr_end; - struct shuffle *sym; - struct shuffle *sym_end; - struct shuffle *opt; - struct shuffle *opt_end; - struct shuffle *aux; - struct shuffle *aux_end; - struct shuffle *ss; - struct shuffle *ss_end; - struct string_hash_entry *ss_hash; - struct string_hash_entry *ss_hash_end; - struct shuffle *fdr; - struct shuffle *fdr_end; - struct shuffle *rfd; - struct shuffle *rfd_end; - /* The size of the largest file shuffle. */ - unsigned long largest_file_shuffle; - /* An obstack for debugging information. */ - struct obstack memory; -}; - -/* Add a file entry to a shuffle list. */ - -static boolean add_file_shuffle PARAMS ((struct accumulate *, - struct shuffle **, - struct shuffle **, bfd *, file_ptr, - unsigned long)); - -static boolean -add_file_shuffle (ainfo, head, tail, input_bfd, offset, size) - struct accumulate *ainfo; - struct shuffle **head; - struct shuffle **tail; - bfd *input_bfd; - file_ptr offset; - unsigned long size; -{ - struct shuffle *n; - - if (*tail != (struct shuffle *) NULL - && (*tail)->filep - && (*tail)->u.file.input_bfd == input_bfd - && (*tail)->u.file.offset + (*tail)->size == (unsigned long) offset) - { - /* Just merge this entry onto the existing one. */ - (*tail)->size += size; - if ((*tail)->size > ainfo->largest_file_shuffle) - ainfo->largest_file_shuffle = (*tail)->size; - return true; - } - - n = (struct shuffle *) obstack_alloc (&ainfo->memory, - sizeof (struct shuffle)); - if (!n) - { - bfd_set_error (bfd_error_no_memory); - return false; - } - n->next = NULL; - n->size = size; - n->filep = true; - n->u.file.input_bfd = input_bfd; - n->u.file.offset = offset; - if (*head == (struct shuffle *) NULL) - *head = n; - if (*tail != (struct shuffle *) NULL) - (*tail)->next = n; - *tail = n; - if (size > ainfo->largest_file_shuffle) - ainfo->largest_file_shuffle = size; - return true; -} - -/* Add a memory entry to a shuffle list. */ - -static boolean add_memory_shuffle PARAMS ((struct accumulate *, - struct shuffle **head, - struct shuffle **tail, - bfd_byte *data, unsigned long size)); - -static boolean -add_memory_shuffle (ainfo, head, tail, data, size) - struct accumulate *ainfo; - struct shuffle **head; - struct shuffle **tail; - bfd_byte *data; - unsigned long size; -{ - struct shuffle *n; - - n = (struct shuffle *) obstack_alloc (&ainfo->memory, - sizeof (struct shuffle)); - if (!n) - { - bfd_set_error (bfd_error_no_memory); - return false; - } - n->next = NULL; - n->size = size; - n->filep = false; - n->u.memory = (PTR) data; - if (*head == (struct shuffle *) NULL) - *head = n; - if (*tail != (struct shuffle *) NULL) - (*tail)->next = n; - *tail = n; - return true; -} - -/* Initialize the FDR hash table. This returns a handle which is then - passed in to bfd_ecoff_debug_accumulate, et. al. */ - -/*ARGSUSED*/ -PTR -bfd_ecoff_debug_init (output_bfd, output_debug, output_swap, info) - bfd *output_bfd; - struct ecoff_debug_info *output_debug; - const struct ecoff_debug_swap *output_swap; - struct bfd_link_info *info; -{ - struct accumulate *ainfo; - - ainfo = (struct accumulate *) bfd_malloc (sizeof (struct accumulate)); - if (!ainfo) - return NULL; - if (! bfd_hash_table_init_n (&ainfo->fdr_hash.table, string_hash_newfunc, - 1021)) - return NULL; - - ainfo->line = NULL; - ainfo->line_end = NULL; - ainfo->pdr = NULL; - ainfo->pdr_end = NULL; - ainfo->sym = NULL; - ainfo->sym_end = NULL; - ainfo->opt = NULL; - ainfo->opt_end = NULL; - ainfo->aux = NULL; - ainfo->aux_end = NULL; - ainfo->ss = NULL; - ainfo->ss_end = NULL; - ainfo->ss_hash = NULL; - ainfo->ss_hash_end = NULL; - ainfo->fdr = NULL; - ainfo->fdr_end = NULL; - ainfo->rfd = NULL; - ainfo->rfd_end = NULL; - - ainfo->largest_file_shuffle = 0; - - if (! info->relocateable) - { - if (! bfd_hash_table_init (&ainfo->str_hash.table, string_hash_newfunc)) - return NULL; - - /* The first entry in the string table is the empty string. */ - output_debug->symbolic_header.issMax = 1; - } - - if (!obstack_begin (&ainfo->memory, 4050)) - { - bfd_set_error (bfd_error_no_memory); - return NULL; - } - - return (PTR) ainfo; -} - -/* Free the accumulated debugging information. */ - -/*ARGSUSED*/ -void -bfd_ecoff_debug_free (handle, output_bfd, output_debug, output_swap, info) - PTR handle; - bfd *output_bfd; - struct ecoff_debug_info *output_debug; - const struct ecoff_debug_swap *output_swap; - struct bfd_link_info *info; -{ - struct accumulate *ainfo = (struct accumulate *) handle; - - bfd_hash_table_free (&ainfo->fdr_hash.table); - - if (! info->relocateable) - bfd_hash_table_free (&ainfo->str_hash.table); - - obstack_free (&ainfo->memory, (PTR) NULL); - - free (ainfo); -} - -/* Accumulate the debugging information from INPUT_BFD into - OUTPUT_BFD. The INPUT_DEBUG argument points to some ECOFF - debugging information which we want to link into the information - pointed to by the OUTPUT_DEBUG argument. OUTPUT_SWAP and - INPUT_SWAP point to the swapping information needed. INFO is the - linker information structure. HANDLE is returned by - bfd_ecoff_debug_init. */ - -/*ARGSUSED*/ -boolean -bfd_ecoff_debug_accumulate (handle, output_bfd, output_debug, output_swap, - input_bfd, input_debug, input_swap, - info) - PTR handle; - bfd *output_bfd; - struct ecoff_debug_info *output_debug; - const struct ecoff_debug_swap *output_swap; - bfd *input_bfd; - struct ecoff_debug_info *input_debug; - const struct ecoff_debug_swap *input_swap; - struct bfd_link_info *info; -{ - struct accumulate *ainfo = (struct accumulate *) handle; - void (* const swap_sym_in) PARAMS ((bfd *, PTR, SYMR *)) - = input_swap->swap_sym_in; - void (* const swap_rfd_in) PARAMS ((bfd *, PTR, RFDT *)) - = input_swap->swap_rfd_in; - void (* const swap_sym_out) PARAMS ((bfd *, const SYMR *, PTR)) - = output_swap->swap_sym_out; - void (* const swap_fdr_out) PARAMS ((bfd *, const FDR *, PTR)) - = output_swap->swap_fdr_out; - void (* const swap_rfd_out) PARAMS ((bfd *, const RFDT *, PTR)) - = output_swap->swap_rfd_out; - bfd_size_type external_pdr_size = output_swap->external_pdr_size; - bfd_size_type external_sym_size = output_swap->external_sym_size; - bfd_size_type external_opt_size = output_swap->external_opt_size; - bfd_size_type external_fdr_size = output_swap->external_fdr_size; - bfd_size_type external_rfd_size = output_swap->external_rfd_size; - HDRR * const output_symhdr = &output_debug->symbolic_header; - HDRR * const input_symhdr = &input_debug->symbolic_header; - bfd_vma section_adjust[scMax]; - asection *sec; - bfd_byte *fdr_start; - bfd_byte *fdr_ptr; - bfd_byte *fdr_end; - bfd_size_type fdr_add; - unsigned int copied; - RFDT i; - unsigned long sz; - bfd_byte *rfd_out; - bfd_byte *rfd_in; - bfd_byte *rfd_end; - long newrfdbase = 0; - long oldrfdbase = 0; - bfd_byte *fdr_out; - - /* Use section_adjust to hold the value to add to a symbol in a - particular section. */ - memset ((PTR) section_adjust, 0, sizeof section_adjust); - -#define SET(name, indx) \ - sec = bfd_get_section_by_name (input_bfd, name); \ - if (sec != NULL) \ - section_adjust[indx] = (sec->output_section->vma \ - + sec->output_offset \ - - sec->vma); - - SET (".text", scText); - SET (".data", scData); - SET (".bss", scBss); - SET (".sdata", scSData); - SET (".sbss", scSBss); - /* scRdata section may be either .rdata or .rodata. */ - SET (".rdata", scRData); - SET (".rodata", scRData); - SET (".init", scInit); - SET (".fini", scFini); - SET (".rconst", scRConst); - -#undef SET - - /* Find all the debugging information based on the FDR's. We need - to handle them whether they are swapped or not. */ - if (input_debug->fdr != (FDR *) NULL) - { - fdr_start = (bfd_byte *) input_debug->fdr; - fdr_add = sizeof (FDR); - } - else - { - fdr_start = (bfd_byte *) input_debug->external_fdr; - fdr_add = input_swap->external_fdr_size; - } - fdr_end = fdr_start + input_symhdr->ifdMax * fdr_add; - - input_debug->ifdmap = (RFDT *) bfd_alloc (input_bfd, - (input_symhdr->ifdMax - * sizeof (RFDT))); - - sz = (input_symhdr->crfd + input_symhdr->ifdMax) * external_rfd_size; - rfd_out = (bfd_byte *) obstack_alloc (&ainfo->memory, sz); - if (!input_debug->ifdmap || !rfd_out) - { - bfd_set_error (bfd_error_no_memory); - return false; - } - if (!add_memory_shuffle (ainfo, &ainfo->rfd, &ainfo->rfd_end, rfd_out, sz)) - return false; - - copied = 0; - - /* Look through the FDR's to see which ones we are going to include - in the final output. We do not want duplicate FDR information - for header files, because ECOFF debugging is often very large. - When we find an FDR with no line information which can be merged, - we look it up in a hash table to ensure that we only include it - once. We keep a table mapping FDR numbers to the final number - they get with the BFD, so that we can refer to it when we write - out the external symbols. */ - for (fdr_ptr = fdr_start, i = 0; - fdr_ptr < fdr_end; - fdr_ptr += fdr_add, i++, rfd_out += external_rfd_size) - { - FDR fdr; - - if (input_debug->fdr != (FDR *) NULL) - fdr = *(FDR *) fdr_ptr; - else - (*input_swap->swap_fdr_in) (input_bfd, (PTR) fdr_ptr, &fdr); - - /* See if this FDR can be merged with an existing one. */ - if (fdr.cbLine == 0 && fdr.rss != -1 && fdr.fMerge) - { - const char *name; - char *lookup; - struct string_hash_entry *fh; - - /* We look up a string formed from the file name and the - number of symbols. Sometimes an include file will - conditionally define a typedef or something based on the - order of include files. Using the number of symbols as a - hash reduces the chance that we will merge symbol - information that should not be merged. */ - name = input_debug->ss + fdr.issBase + fdr.rss; - - lookup = (char *) bfd_malloc (strlen (name) + 20); - if (lookup == NULL) - return false; - sprintf (lookup, "%s %lx", name, fdr.csym); - - fh = string_hash_lookup (&ainfo->fdr_hash, lookup, true, true); - free (lookup); - if (fh == (struct string_hash_entry *) NULL) - return false; - - if (fh->val != -1) - { - input_debug->ifdmap[i] = fh->val; - (*swap_rfd_out) (output_bfd, input_debug->ifdmap + i, - (PTR) rfd_out); - - /* Don't copy this FDR. */ - continue; - } - - fh->val = output_symhdr->ifdMax + copied; - } - - input_debug->ifdmap[i] = output_symhdr->ifdMax + copied; - (*swap_rfd_out) (output_bfd, input_debug->ifdmap + i, (PTR) rfd_out); - ++copied; - } - - newrfdbase = output_symhdr->crfd; - output_symhdr->crfd += input_symhdr->ifdMax; - - /* Copy over any existing RFD's. RFD's are only created by the - linker, so this will only happen for input files which are the - result of a partial link. */ - rfd_in = (bfd_byte *) input_debug->external_rfd; - rfd_end = rfd_in + input_symhdr->crfd * input_swap->external_rfd_size; - for (; - rfd_in < rfd_end; - rfd_in += input_swap->external_rfd_size) - { - RFDT rfd; - - (*swap_rfd_in) (input_bfd, (PTR) rfd_in, &rfd); - BFD_ASSERT (rfd >= 0 && rfd < input_symhdr->ifdMax); - rfd = input_debug->ifdmap[rfd]; - (*swap_rfd_out) (output_bfd, &rfd, (PTR) rfd_out); - rfd_out += external_rfd_size; - } - - oldrfdbase = output_symhdr->crfd; - output_symhdr->crfd += input_symhdr->crfd; - - /* Look through the FDR's and copy over all associated debugging - information. */ - sz = copied * external_fdr_size; - fdr_out = (bfd_byte *) obstack_alloc (&ainfo->memory, sz); - if (!fdr_out) - { - bfd_set_error (bfd_error_no_memory); - return false; - } - if (!add_memory_shuffle (ainfo, &ainfo->fdr, &ainfo->fdr_end, fdr_out, sz)) - return false; - for (fdr_ptr = fdr_start, i = 0; - fdr_ptr < fdr_end; - fdr_ptr += fdr_add, i++) - { - FDR fdr; - bfd_vma fdr_adr; - bfd_byte *sym_out; - bfd_byte *lraw_src; - bfd_byte *lraw_end; - boolean fgotfilename; - - if (input_debug->ifdmap[i] < output_symhdr->ifdMax) - { - /* We are not copying this FDR. */ - continue; - } - - if (input_debug->fdr != (FDR *) NULL) - fdr = *(FDR *) fdr_ptr; - else - (*input_swap->swap_fdr_in) (input_bfd, (PTR) fdr_ptr, &fdr); - - fdr_adr = fdr.adr; - - /* Adjust the FDR address for any changes that may have been - made by relaxing. */ - if (input_debug->adjust != (struct ecoff_value_adjust *) NULL) - { - struct ecoff_value_adjust *adjust; - - for (adjust = input_debug->adjust; - adjust != (struct ecoff_value_adjust *) NULL; - adjust = adjust->next) - if (fdr_adr >= adjust->start - && fdr_adr < adjust->end) - fdr.adr += adjust->adjust; - } - - /* FIXME: It is conceivable that this FDR points to the .init or - .fini section, in which case this will not do the right - thing. */ - fdr.adr += section_adjust[scText]; - - /* Swap in the local symbols, adjust their values, and swap them - out again. */ - fgotfilename = false; - sz = fdr.csym * external_sym_size; - sym_out = (bfd_byte *) obstack_alloc (&ainfo->memory, sz); - if (!sym_out) - { - bfd_set_error (bfd_error_no_memory); - return false; - } - if (!add_memory_shuffle (ainfo, &ainfo->sym, &ainfo->sym_end, sym_out, - sz)) - return false; - lraw_src = ((bfd_byte *) input_debug->external_sym - + fdr.isymBase * input_swap->external_sym_size); - lraw_end = lraw_src + fdr.csym * input_swap->external_sym_size; - for (; lraw_src < lraw_end; lraw_src += input_swap->external_sym_size) - { - SYMR internal_sym; - - (*swap_sym_in) (input_bfd, (PTR) lraw_src, &internal_sym); - - BFD_ASSERT (internal_sym.sc != scCommon - && internal_sym.sc != scSCommon); - - /* Adjust the symbol value if appropriate. */ - switch (internal_sym.st) - { - case stNil: - if (ECOFF_IS_STAB (&internal_sym)) - break; - /* Fall through. */ - case stGlobal: - case stStatic: - case stLabel: - case stProc: - case stStaticProc: - if (input_debug->adjust != (struct ecoff_value_adjust *) NULL) - { - bfd_vma value; - struct ecoff_value_adjust *adjust; - - value = internal_sym.value; - for (adjust = input_debug->adjust; - adjust != (struct ecoff_value_adjust *) NULL; - adjust = adjust->next) - if (value >= adjust->start - && value < adjust->end) - internal_sym.value += adjust->adjust; - } - internal_sym.value += section_adjust[internal_sym.sc]; - break; - - default: - break; - } - - /* If we are doing a final link, we hash all the strings in - the local symbol table together. This reduces the amount - of space required by debugging information. We don't do - this when performing a relocateable link because it would - prevent us from easily merging different FDR's. */ - if (! info->relocateable) - { - boolean ffilename; - const char *name; - - if (! fgotfilename && internal_sym.iss == fdr.rss) - ffilename = true; - else - ffilename = false; - - /* Hash the name into the string table. */ - name = input_debug->ss + fdr.issBase + internal_sym.iss; - if (*name == '\0') - internal_sym.iss = 0; - else - { - struct string_hash_entry *sh; - - sh = string_hash_lookup (&ainfo->str_hash, name, true, true); - if (sh == (struct string_hash_entry *) NULL) - return false; - if (sh->val == -1) - { - sh->val = output_symhdr->issMax; - output_symhdr->issMax += strlen (name) + 1; - if (ainfo->ss_hash == (struct string_hash_entry *) NULL) - ainfo->ss_hash = sh; - if (ainfo->ss_hash_end - != (struct string_hash_entry *) NULL) - ainfo->ss_hash_end->next = sh; - ainfo->ss_hash_end = sh; - } - internal_sym.iss = sh->val; - } - - if (ffilename) - { - fdr.rss = internal_sym.iss; - fgotfilename = true; - } - } - - (*swap_sym_out) (output_bfd, &internal_sym, sym_out); - sym_out += external_sym_size; - } - - fdr.isymBase = output_symhdr->isymMax; - output_symhdr->isymMax += fdr.csym; - - /* Copy the information that does not need swapping. */ - - /* FIXME: If we are relaxing, we need to adjust the line - numbers. Frankly, forget it. Anybody using stabs debugging - information will not use this line number information, and - stabs are adjusted correctly. */ - if (fdr.cbLine > 0) - { - if (!add_file_shuffle (ainfo, &ainfo->line, &ainfo->line_end, - input_bfd, - input_symhdr->cbLineOffset + fdr.cbLineOffset, - fdr.cbLine)) - return false; - fdr.ilineBase = output_symhdr->ilineMax; - fdr.cbLineOffset = output_symhdr->cbLine; - output_symhdr->ilineMax += fdr.cline; - output_symhdr->cbLine += fdr.cbLine; - } - if (fdr.caux > 0) - { - if (!add_file_shuffle (ainfo, &ainfo->aux, &ainfo->aux_end, - input_bfd, - (input_symhdr->cbAuxOffset - + fdr.iauxBase * sizeof (union aux_ext)), - fdr.caux * sizeof (union aux_ext))) - return false; - fdr.iauxBase = output_symhdr->iauxMax; - output_symhdr->iauxMax += fdr.caux; - } - if (! info->relocateable) - { - - /* When are are hashing strings, we lie about the number of - strings attached to each FDR. We need to set cbSs - because some versions of dbx apparently use it to decide - how much of the string table to read in. */ - fdr.issBase = 0; - fdr.cbSs = output_symhdr->issMax; - } - else if (fdr.cbSs > 0) - { - if (!add_file_shuffle (ainfo, &ainfo->ss, &ainfo->ss_end, - input_bfd, - input_symhdr->cbSsOffset + fdr.issBase, - fdr.cbSs)) - return false; - fdr.issBase = output_symhdr->issMax; - output_symhdr->issMax += fdr.cbSs; - } - - if ((output_bfd->xvec->header_byteorder - == input_bfd->xvec->header_byteorder) - && input_debug->adjust == (struct ecoff_value_adjust *) NULL) - { - /* The two BFD's have the same endianness, and we don't have - to adjust the PDR addresses, so simply copying the - information will suffice. */ - BFD_ASSERT (external_pdr_size == input_swap->external_pdr_size); - if (fdr.cpd > 0) - { - if (!add_file_shuffle (ainfo, &ainfo->pdr, &ainfo->pdr_end, - input_bfd, - (input_symhdr->cbPdOffset - + fdr.ipdFirst * external_pdr_size), - fdr.cpd * external_pdr_size)) - return false; - } - BFD_ASSERT (external_opt_size == input_swap->external_opt_size); - if (fdr.copt > 0) - { - if (!add_file_shuffle (ainfo, &ainfo->opt, &ainfo->opt_end, - input_bfd, - (input_symhdr->cbOptOffset - + fdr.ioptBase * external_opt_size), - fdr.copt * external_opt_size)) - return false; - } - } - else - { - bfd_size_type outsz, insz; - bfd_byte *in; - bfd_byte *end; - bfd_byte *out; - - /* The two BFD's have different endianness, so we must swap - everything in and out. This code would always work, but - it would be unnecessarily slow in the normal case. */ - outsz = external_pdr_size; - insz = input_swap->external_pdr_size; - in = ((bfd_byte *) input_debug->external_pdr - + fdr.ipdFirst * insz); - end = in + fdr.cpd * insz; - sz = fdr.cpd * outsz; - out = (bfd_byte *) obstack_alloc (&ainfo->memory, sz); - if (!out) - { - bfd_set_error (bfd_error_no_memory); - return false; - } - if (!add_memory_shuffle (ainfo, &ainfo->pdr, &ainfo->pdr_end, out, - sz)) - return false; - for (; in < end; in += insz, out += outsz) - { - PDR pdr; - - (*input_swap->swap_pdr_in) (input_bfd, (PTR) in, &pdr); - - /* If we have been relaxing, we may have to adjust the - address. */ - if (input_debug->adjust != (struct ecoff_value_adjust *) NULL) - { - bfd_vma adr; - struct ecoff_value_adjust *adjust; - - adr = fdr_adr + pdr.adr; - for (adjust = input_debug->adjust; - adjust != (struct ecoff_value_adjust *) NULL; - adjust = adjust->next) - if (adr >= adjust->start - && adr < adjust->end) - pdr.adr += adjust->adjust; - } - - (*output_swap->swap_pdr_out) (output_bfd, &pdr, (PTR) out); - } - - /* Swap over the optimization information. */ - outsz = external_opt_size; - insz = input_swap->external_opt_size; - in = ((bfd_byte *) input_debug->external_opt - + fdr.ioptBase * insz); - end = in + fdr.copt * insz; - sz = fdr.copt * outsz; - out = (bfd_byte *) obstack_alloc (&ainfo->memory, sz); - if (!out) - { - bfd_set_error (bfd_error_no_memory); - return false; - } - if (!add_memory_shuffle (ainfo, &ainfo->opt, &ainfo->opt_end, out, - sz)) - return false; - for (; in < end; in += insz, out += outsz) - { - OPTR opt; - - (*input_swap->swap_opt_in) (input_bfd, (PTR) in, &opt); - (*output_swap->swap_opt_out) (output_bfd, &opt, (PTR) out); - } - } - - fdr.ipdFirst = output_symhdr->ipdMax; - output_symhdr->ipdMax += fdr.cpd; - fdr.ioptBase = output_symhdr->ioptMax; - output_symhdr->ioptMax += fdr.copt; - - if (fdr.crfd <= 0) - { - /* Point this FDR at the table of RFD's we created. */ - fdr.rfdBase = newrfdbase; - fdr.crfd = input_symhdr->ifdMax; - } - else - { - /* Point this FDR at the remapped RFD's. */ - fdr.rfdBase += oldrfdbase; - } - - (*swap_fdr_out) (output_bfd, &fdr, fdr_out); - fdr_out += external_fdr_size; - ++output_symhdr->ifdMax; - } - - return true; -} - -/* Add a string to the debugging information we are accumulating. - Return the offset from the fdr string base. */ - -static long ecoff_add_string PARAMS ((struct accumulate *, - struct bfd_link_info *, - struct ecoff_debug_info *, - FDR *fdr, const char *string)); - -static long -ecoff_add_string (ainfo, info, debug, fdr, string) - struct accumulate *ainfo; - struct bfd_link_info *info; - struct ecoff_debug_info *debug; - FDR *fdr; - const char *string; -{ - HDRR *symhdr; - size_t len; - bfd_size_type ret; - - symhdr = &debug->symbolic_header; - len = strlen (string); - if (info->relocateable) - { - if (!add_memory_shuffle (ainfo, &ainfo->ss, &ainfo->ss_end, (PTR) string, - len + 1)) - return -1; - ret = symhdr->issMax; - symhdr->issMax += len + 1; - fdr->cbSs += len + 1; - } - else - { - struct string_hash_entry *sh; - - sh = string_hash_lookup (&ainfo->str_hash, string, true, true); - if (sh == (struct string_hash_entry *) NULL) - return -1; - if (sh->val == -1) - { - sh->val = symhdr->issMax; - symhdr->issMax += len + 1; - if (ainfo->ss_hash == (struct string_hash_entry *) NULL) - ainfo->ss_hash = sh; - if (ainfo->ss_hash_end - != (struct string_hash_entry *) NULL) - ainfo->ss_hash_end->next = sh; - ainfo->ss_hash_end = sh; - } - ret = sh->val; - } - - return ret; -} - -/* Add debugging information from a non-ECOFF file. */ - -boolean -bfd_ecoff_debug_accumulate_other (handle, output_bfd, output_debug, - output_swap, input_bfd, info) - PTR handle; - bfd *output_bfd; - struct ecoff_debug_info *output_debug; - const struct ecoff_debug_swap *output_swap; - bfd *input_bfd; - struct bfd_link_info *info; -{ - struct accumulate *ainfo = (struct accumulate *) handle; - void (* const swap_sym_out) PARAMS ((bfd *, const SYMR *, PTR)) - = output_swap->swap_sym_out; - HDRR *output_symhdr = &output_debug->symbolic_header; - FDR fdr; - asection *sec; - asymbol **symbols; - asymbol **sym_ptr; - asymbol **sym_end; - long symsize; - long symcount; - PTR external_fdr; - - memset ((PTR) &fdr, 0, sizeof fdr); - - sec = bfd_get_section_by_name (input_bfd, ".text"); - if (sec != NULL) - fdr.adr = sec->output_section->vma + sec->output_offset; - else - { - /* FIXME: What about .init or .fini? */ - fdr.adr = 0; - } - - fdr.issBase = output_symhdr->issMax; - fdr.cbSs = 0; - fdr.rss = ecoff_add_string (ainfo, info, output_debug, &fdr, - bfd_get_filename (input_bfd)); - if (fdr.rss == -1) - return false; - fdr.isymBase = output_symhdr->isymMax; - - /* Get the local symbols from the input BFD. */ - symsize = bfd_get_symtab_upper_bound (input_bfd); - if (symsize < 0) - return false; - symbols = (asymbol **) bfd_alloc (output_bfd, symsize); - if (symbols == (asymbol **) NULL) - return false; - symcount = bfd_canonicalize_symtab (input_bfd, symbols); - if (symcount < 0) - return false; - sym_end = symbols + symcount; - - /* Handle the local symbols. Any external symbols are handled - separately. */ - fdr.csym = 0; - for (sym_ptr = symbols; sym_ptr != sym_end; sym_ptr++) - { - SYMR internal_sym; - PTR external_sym; - - if (((*sym_ptr)->flags & BSF_EXPORT) != 0) - continue; - memset ((PTR) &internal_sym, 0, sizeof internal_sym); - internal_sym.iss = ecoff_add_string (ainfo, info, output_debug, &fdr, - (*sym_ptr)->name); - - if (internal_sym.iss == -1) - return false; - if (bfd_is_com_section ((*sym_ptr)->section) - || bfd_is_und_section ((*sym_ptr)->section)) - internal_sym.value = (*sym_ptr)->value; - else - internal_sym.value = ((*sym_ptr)->value - + (*sym_ptr)->section->output_offset - + (*sym_ptr)->section->output_section->vma); - internal_sym.st = stNil; - internal_sym.sc = scUndefined; - internal_sym.index = indexNil; - - external_sym = (PTR) obstack_alloc (&ainfo->memory, - output_swap->external_sym_size); - if (!external_sym) - { - bfd_set_error (bfd_error_no_memory); - return false; - } - (*swap_sym_out) (output_bfd, &internal_sym, external_sym); - add_memory_shuffle (ainfo, &ainfo->sym, &ainfo->sym_end, - external_sym, output_swap->external_sym_size); - ++fdr.csym; - ++output_symhdr->isymMax; - } - - bfd_release (output_bfd, (PTR) symbols); - - /* Leave everything else in the FDR zeroed out. This will cause - the lang field to be langC. The fBigendian field will - indicate little endian format, but it doesn't matter because - it only applies to aux fields and there are none. */ - external_fdr = (PTR) obstack_alloc (&ainfo->memory, - output_swap->external_fdr_size); - if (!external_fdr) - { - bfd_set_error (bfd_error_no_memory); - return false; - } - (*output_swap->swap_fdr_out) (output_bfd, &fdr, external_fdr); - add_memory_shuffle (ainfo, &ainfo->fdr, &ainfo->fdr_end, - external_fdr, output_swap->external_fdr_size); - - ++output_symhdr->ifdMax; - - return true; -} - -/* Set up ECOFF debugging information for the external symbols. - FIXME: This is done using a memory buffer, but it should be - probably be changed to use a shuffle structure. The assembler uses - this interface, so that must be changed to do something else. */ - -boolean -bfd_ecoff_debug_externals (abfd, debug, swap, relocateable, get_extr, - set_index) - bfd *abfd; - struct ecoff_debug_info *debug; - const struct ecoff_debug_swap *swap; - boolean relocateable; - boolean (*get_extr) PARAMS ((asymbol *, EXTR *)); - void (*set_index) PARAMS ((asymbol *, bfd_size_type)); -{ - HDRR * const symhdr = &debug->symbolic_header; - asymbol **sym_ptr_ptr; - size_t c; - - sym_ptr_ptr = bfd_get_outsymbols (abfd); - if (sym_ptr_ptr == NULL) - return true; - - for (c = bfd_get_symcount (abfd); c > 0; c--, sym_ptr_ptr++) - { - asymbol *sym_ptr; - EXTR esym; - - sym_ptr = *sym_ptr_ptr; - - /* Get the external symbol information. */ - if ((*get_extr) (sym_ptr, &esym) == false) - continue; - - /* If we're producing an executable, move common symbols into - bss. */ - if (relocateable == false) - { - if (esym.asym.sc == scCommon) - esym.asym.sc = scBss; - else if (esym.asym.sc == scSCommon) - esym.asym.sc = scSBss; - } - - if (bfd_is_com_section (sym_ptr->section) - || bfd_is_und_section (sym_ptr->section) - || sym_ptr->section->output_section == (asection *) NULL) - { - /* FIXME: gas does not keep the value of a small undefined - symbol in the symbol itself, because of relocation - problems. */ - if (esym.asym.sc != scSUndefined - || esym.asym.value == 0 - || sym_ptr->value != 0) - esym.asym.value = sym_ptr->value; - } - else - esym.asym.value = (sym_ptr->value - + sym_ptr->section->output_offset - + sym_ptr->section->output_section->vma); - - if (set_index) - (*set_index) (sym_ptr, (bfd_size_type) symhdr->iextMax); - - if (! bfd_ecoff_debug_one_external (abfd, debug, swap, - sym_ptr->name, &esym)) - return false; - } - - return true; -} - -/* Add a single external symbol to the debugging information. */ - -boolean -bfd_ecoff_debug_one_external (abfd, debug, swap, name, esym) - bfd *abfd; - struct ecoff_debug_info *debug; - const struct ecoff_debug_swap *swap; - const char *name; - EXTR *esym; -{ - const bfd_size_type external_ext_size = swap->external_ext_size; - void (* const swap_ext_out) PARAMS ((bfd *, const EXTR *, PTR)) - = swap->swap_ext_out; - HDRR * const symhdr = &debug->symbolic_header; - size_t namelen; - - namelen = strlen (name); - - if ((size_t) (debug->ssext_end - debug->ssext) - < symhdr->issExtMax + namelen + 1) - { - if (ecoff_add_bytes ((char **) &debug->ssext, - (char **) &debug->ssext_end, - symhdr->issExtMax + namelen + 1) - == false) - return false; - } - if ((size_t) ((char *) debug->external_ext_end - - (char *) debug->external_ext) - < (symhdr->iextMax + 1) * external_ext_size) - { - if (ecoff_add_bytes ((char **) &debug->external_ext, - (char **) &debug->external_ext_end, - (symhdr->iextMax + 1) * external_ext_size) - == false) - return false; - } - - esym->asym.iss = symhdr->issExtMax; - - (*swap_ext_out) (abfd, esym, - ((char *) debug->external_ext - + symhdr->iextMax * swap->external_ext_size)); - - ++symhdr->iextMax; - - strcpy (debug->ssext + symhdr->issExtMax, name); - symhdr->issExtMax += namelen + 1; - - return true; -} - -/* Align the ECOFF debugging information. */ - -/*ARGSUSED*/ -static void -ecoff_align_debug (abfd, debug, swap) - bfd *abfd; - struct ecoff_debug_info *debug; - const struct ecoff_debug_swap *swap; -{ - HDRR * const symhdr = &debug->symbolic_header; - bfd_size_type debug_align, aux_align, rfd_align; - size_t add; - - /* Adjust the counts so that structures are aligned. */ - debug_align = swap->debug_align; - aux_align = debug_align / sizeof (union aux_ext); - rfd_align = debug_align / swap->external_rfd_size; - - add = debug_align - (symhdr->cbLine & (debug_align - 1)); - if (add != debug_align) - { - if (debug->line != (unsigned char *) NULL) - memset ((PTR) (debug->line + symhdr->cbLine), 0, add); - symhdr->cbLine += add; - } - - add = debug_align - (symhdr->issMax & (debug_align - 1)); - if (add != debug_align) - { - if (debug->ss != (char *) NULL) - memset ((PTR) (debug->ss + symhdr->issMax), 0, add); - symhdr->issMax += add; - } - - add = debug_align - (symhdr->issExtMax & (debug_align - 1)); - if (add != debug_align) - { - if (debug->ssext != (char *) NULL) - memset ((PTR) (debug->ssext + symhdr->issExtMax), 0, add); - symhdr->issExtMax += add; - } - - add = aux_align - (symhdr->iauxMax & (aux_align - 1)); - if (add != aux_align) - { - if (debug->external_aux != (union aux_ext *) NULL) - memset ((PTR) (debug->external_aux + symhdr->iauxMax), 0, - add * sizeof (union aux_ext)); - symhdr->iauxMax += add; - } - - add = rfd_align - (symhdr->crfd & (rfd_align - 1)); - if (add != rfd_align) - { - if (debug->external_rfd != (PTR) NULL) - memset ((PTR) ((char *) debug->external_rfd - + symhdr->crfd * swap->external_rfd_size), - 0, (size_t) (add * swap->external_rfd_size)); - symhdr->crfd += add; - } -} - -/* Return the size required by the ECOFF debugging information. */ - -bfd_size_type -bfd_ecoff_debug_size (abfd, debug, swap) - bfd *abfd; - struct ecoff_debug_info *debug; - const struct ecoff_debug_swap *swap; -{ - bfd_size_type tot; - - ecoff_align_debug (abfd, debug, swap); - tot = swap->external_hdr_size; - -#define ADD(count, size) \ - tot += debug->symbolic_header.count * size - - ADD (cbLine, sizeof (unsigned char)); - ADD (idnMax, swap->external_dnr_size); - ADD (ipdMax, swap->external_pdr_size); - ADD (isymMax, swap->external_sym_size); - ADD (ioptMax, swap->external_opt_size); - ADD (iauxMax, sizeof (union aux_ext)); - ADD (issMax, sizeof (char)); - ADD (issExtMax, sizeof (char)); - ADD (ifdMax, swap->external_fdr_size); - ADD (crfd, swap->external_rfd_size); - ADD (iextMax, swap->external_ext_size); - -#undef ADD - - return tot; -} - -/* Write out the ECOFF symbolic header, given the file position it is - going to be placed at. This assumes that the counts are set - correctly. */ - -static boolean -ecoff_write_symhdr (abfd, debug, swap, where) - bfd *abfd; - struct ecoff_debug_info *debug; - const struct ecoff_debug_swap *swap; - file_ptr where; -{ - HDRR * const symhdr = &debug->symbolic_header; - char *buff = NULL; - - ecoff_align_debug (abfd, debug, swap); - - /* Go to the right location in the file. */ - if (bfd_seek (abfd, where, SEEK_SET) != 0) - return false; - - where += swap->external_hdr_size; - - symhdr->magic = swap->sym_magic; - - /* Fill in the file offsets. */ -#define SET(offset, count, size) \ - if (symhdr->count == 0) \ - symhdr->offset = 0; \ - else \ - { \ - symhdr->offset = where; \ - where += symhdr->count * size; \ - } - - SET (cbLineOffset, cbLine, sizeof (unsigned char)); - SET (cbDnOffset, idnMax, swap->external_dnr_size); - SET (cbPdOffset, ipdMax, swap->external_pdr_size); - SET (cbSymOffset, isymMax, swap->external_sym_size); - SET (cbOptOffset, ioptMax, swap->external_opt_size); - SET (cbAuxOffset, iauxMax, sizeof (union aux_ext)); - SET (cbSsOffset, issMax, sizeof (char)); - SET (cbSsExtOffset, issExtMax, sizeof (char)); - SET (cbFdOffset, ifdMax, swap->external_fdr_size); - SET (cbRfdOffset, crfd, swap->external_rfd_size); - SET (cbExtOffset, iextMax, swap->external_ext_size); -#undef SET - - buff = (PTR) bfd_malloc ((size_t) swap->external_hdr_size); - if (buff == NULL && swap->external_hdr_size != 0) - goto error_return; - - (*swap->swap_hdr_out) (abfd, symhdr, buff); - if (bfd_write (buff, 1, swap->external_hdr_size, abfd) - != swap->external_hdr_size) - goto error_return; - - if (buff != NULL) - free (buff); - return true; - error_return: - if (buff != NULL) - free (buff); - return false; -} - -/* Write out the ECOFF debugging information. This function assumes - that the information (the pointers and counts) in *DEBUG have been - set correctly. WHERE is the position in the file to write the - information to. This function fills in the file offsets in the - symbolic header. */ - -boolean -bfd_ecoff_write_debug (abfd, debug, swap, where) - bfd *abfd; - struct ecoff_debug_info *debug; - const struct ecoff_debug_swap *swap; - file_ptr where; -{ - HDRR * const symhdr = &debug->symbolic_header; - - if (! ecoff_write_symhdr (abfd, debug, swap, where)) - return false; - -#define WRITE(ptr, count, size, offset) \ - BFD_ASSERT (symhdr->offset == 0 \ - || (bfd_vma) bfd_tell (abfd) == symhdr->offset); \ - if (bfd_write ((PTR) debug->ptr, size, symhdr->count, abfd) \ - != size * symhdr->count) \ - return false; - - WRITE (line, cbLine, sizeof (unsigned char), cbLineOffset); - WRITE (external_dnr, idnMax, swap->external_dnr_size, cbDnOffset); - WRITE (external_pdr, ipdMax, swap->external_pdr_size, cbPdOffset); - WRITE (external_sym, isymMax, swap->external_sym_size, cbSymOffset); - WRITE (external_opt, ioptMax, swap->external_opt_size, cbOptOffset); - WRITE (external_aux, iauxMax, sizeof (union aux_ext), cbAuxOffset); - WRITE (ss, issMax, sizeof (char), cbSsOffset); - WRITE (ssext, issExtMax, sizeof (char), cbSsExtOffset); - WRITE (external_fdr, ifdMax, swap->external_fdr_size, cbFdOffset); - WRITE (external_rfd, crfd, swap->external_rfd_size, cbRfdOffset); - WRITE (external_ext, iextMax, swap->external_ext_size, cbExtOffset); -#undef WRITE - - return true; -} - -/* Write out a shuffle list. */ - -static boolean ecoff_write_shuffle PARAMS ((bfd *, - const struct ecoff_debug_swap *, - struct shuffle *, PTR space)); - -static boolean -ecoff_write_shuffle (abfd, swap, shuffle, space) - bfd *abfd; - const struct ecoff_debug_swap *swap; - struct shuffle *shuffle; - PTR space; -{ - register struct shuffle *l; - unsigned long total; - - total = 0; - for (l = shuffle; l != (struct shuffle *) NULL; l = l->next) - { - if (! l->filep) - { - if (bfd_write (l->u.memory, 1, l->size, abfd) != l->size) - return false; - } - else - { - if (bfd_seek (l->u.file.input_bfd, l->u.file.offset, SEEK_SET) != 0 - || bfd_read (space, 1, l->size, l->u.file.input_bfd) != l->size - || bfd_write (space, 1, l->size, abfd) != l->size) - return false; - } - total += l->size; - } - - if ((total & (swap->debug_align - 1)) != 0) - { - unsigned int i; - bfd_byte *s; - - i = swap->debug_align - (total & (swap->debug_align - 1)); - s = (bfd_byte *) bfd_malloc (i); - if (s == NULL && i != 0) - return false; - - memset ((PTR) s, 0, i); - if (bfd_write ((PTR) s, 1, i, abfd) != i) - { - free (s); - return false; - } - free (s); - } - - return true; -} - -/* Write out debugging information using accumulated linker - information. */ - -boolean -bfd_ecoff_write_accumulated_debug (handle, abfd, debug, swap, info, where) - PTR handle; - bfd *abfd; - struct ecoff_debug_info *debug; - const struct ecoff_debug_swap *swap; - struct bfd_link_info *info; - file_ptr where; -{ - struct accumulate *ainfo = (struct accumulate *) handle; - PTR space = NULL; - - if (! ecoff_write_symhdr (abfd, debug, swap, where)) - goto error_return; - - space = (PTR) bfd_malloc (ainfo->largest_file_shuffle); - if (space == NULL && ainfo->largest_file_shuffle != 0) - goto error_return; - - if (! ecoff_write_shuffle (abfd, swap, ainfo->line, space) - || ! ecoff_write_shuffle (abfd, swap, ainfo->pdr, space) - || ! ecoff_write_shuffle (abfd, swap, ainfo->sym, space) - || ! ecoff_write_shuffle (abfd, swap, ainfo->opt, space) - || ! ecoff_write_shuffle (abfd, swap, ainfo->aux, space)) - goto error_return; - - /* The string table is written out from the hash table if this is a - final link. */ - if (info->relocateable) - { - BFD_ASSERT (ainfo->ss_hash == (struct string_hash_entry *) NULL); - if (! ecoff_write_shuffle (abfd, swap, ainfo->ss, space)) - goto error_return; - } - else - { - unsigned long total; - bfd_byte null; - struct string_hash_entry *sh; - - BFD_ASSERT (ainfo->ss == (struct shuffle *) NULL); - null = 0; - if (bfd_write ((PTR) &null, 1, 1, abfd) != 1) - goto error_return; - total = 1; - BFD_ASSERT (ainfo->ss_hash == NULL || ainfo->ss_hash->val == 1); - for (sh = ainfo->ss_hash; - sh != (struct string_hash_entry *) NULL; - sh = sh->next) - { - size_t len; - - len = strlen (sh->root.string); - if (bfd_write ((PTR) sh->root.string, 1, len + 1, abfd) != len + 1) - goto error_return; - total += len + 1; - } - - if ((total & (swap->debug_align - 1)) != 0) - { - unsigned int i; - bfd_byte *s; - - i = swap->debug_align - (total & (swap->debug_align - 1)); - s = (bfd_byte *) bfd_malloc (i); - if (s == NULL && i != 0) - goto error_return; - memset ((PTR) s, 0, i); - if (bfd_write ((PTR) s, 1, i, abfd) != i) - { - free (s); - goto error_return; - } - free (s); - } - } - - /* The external strings and symbol are not converted over to using - shuffles. FIXME: They probably should be. */ - if (bfd_write (debug->ssext, 1, debug->symbolic_header.issExtMax, abfd) - != (bfd_size_type) debug->symbolic_header.issExtMax) - goto error_return; - if ((debug->symbolic_header.issExtMax & (swap->debug_align - 1)) != 0) - { - unsigned int i; - bfd_byte *s; - - i = (swap->debug_align - - (debug->symbolic_header.issExtMax & (swap->debug_align - 1))); - s = (bfd_byte *) bfd_malloc (i); - if (s == NULL && i != 0) - goto error_return; - memset ((PTR) s, 0, i); - if (bfd_write ((PTR) s, 1, i, abfd) != i) - { - free (s); - goto error_return; - } - free (s); - } - - if (! ecoff_write_shuffle (abfd, swap, ainfo->fdr, space) - || ! ecoff_write_shuffle (abfd, swap, ainfo->rfd, space)) - goto error_return; - - BFD_ASSERT (debug->symbolic_header.cbExtOffset == 0 - || (debug->symbolic_header.cbExtOffset - == (bfd_vma) bfd_tell (abfd))); - - if (bfd_write (debug->external_ext, swap->external_ext_size, - debug->symbolic_header.iextMax, abfd) - != debug->symbolic_header.iextMax * swap->external_ext_size) - goto error_return; - - if (space != NULL) - free (space); - return true; - - error_return: - if (space != NULL) - free (space); - return false; -} - -/* Handle the find_nearest_line function for both ECOFF and MIPS ELF - files. */ - -/* Compare FDR entries. This is called via qsort. */ - -static int -cmp_fdrtab_entry (leftp, rightp) - const PTR leftp; - const PTR rightp; -{ - const struct ecoff_fdrtab_entry *lp = - (const struct ecoff_fdrtab_entry *) leftp; - const struct ecoff_fdrtab_entry *rp = - (const struct ecoff_fdrtab_entry *) rightp; - - if (lp->base_addr < rp->base_addr) - return -1; - if (lp->base_addr > rp->base_addr) - return 1; - return 0; -} - -/* Each file descriptor (FDR) has a memory address, to simplify - looking up an FDR by address, we build a table covering all FDRs - that have a least one procedure descriptor in them. The final - table will be sorted by address so we can look it up via binary - search. */ - -static boolean -mk_fdrtab (abfd, debug_info, debug_swap, line_info) - bfd *abfd; - struct ecoff_debug_info * const debug_info; - const struct ecoff_debug_swap * const debug_swap; - struct ecoff_find_line *line_info; -{ - struct ecoff_fdrtab_entry *tab; - FDR *fdr_ptr; - FDR *fdr_start; - FDR *fdr_end; - boolean stabs; - long len; - - fdr_start = debug_info->fdr; - fdr_end = fdr_start + debug_info->symbolic_header.ifdMax; - - /* First, let's see how long the table needs to be: */ - for (len = 0, fdr_ptr = fdr_start; fdr_ptr < fdr_end; fdr_ptr++) - { - if (fdr_ptr->cpd == 0) /* skip FDRs that have no PDRs */ - continue; - ++len; - } - - /* Now, create and fill in the table: */ - - line_info->fdrtab = ((struct ecoff_fdrtab_entry*) - bfd_zalloc (abfd, - len * sizeof (struct ecoff_fdrtab_entry))); - if (line_info->fdrtab == NULL) - return false; - line_info->fdrtab_len = len; - - tab = line_info->fdrtab; - for (fdr_ptr = fdr_start; fdr_ptr < fdr_end; fdr_ptr++) - { - if (fdr_ptr->cpd == 0) - continue; - - /* Check whether this file has stabs debugging information. In - a file with stabs debugging information, the second local - symbol is named @stabs. */ - stabs = false; - if (fdr_ptr->csym >= 2) - { - char *sym_ptr; - SYMR sym; - - sym_ptr = ((char *) debug_info->external_sym - + (fdr_ptr->isymBase + 1)*debug_swap->external_sym_size); - (*debug_swap->swap_sym_in) (abfd, sym_ptr, &sym); - if (strcmp (debug_info->ss + fdr_ptr->issBase + sym.iss, - STABS_SYMBOL) == 0) - stabs = true; - } - - if (!stabs) - { - bfd_size_type external_pdr_size; - char *pdr_ptr; - PDR pdr; - - external_pdr_size = debug_swap->external_pdr_size; - - pdr_ptr = ((char *) debug_info->external_pdr - + fdr_ptr->ipdFirst * external_pdr_size); - (*debug_swap->swap_pdr_in) (abfd, (PTR) pdr_ptr, &pdr); - /* The address of the first PDR is the offset of that - procedure relative to the beginning of file FDR. */ - tab->base_addr = fdr_ptr->adr - pdr.adr; - } - else - { - /* XXX I don't know about stabs, so this is a guess - (davidm@cs.arizona.edu): */ - tab->base_addr = fdr_ptr->adr; - } - tab->fdr = fdr_ptr; - ++tab; - } - - /* Finally, the table is sorted in increasing memory-address order. - The table is mostly sorted already, but there are cases (e.g., - static functions in include files), where this does not hold. - Use "odump -PFv" to verify... */ - qsort ((PTR) line_info->fdrtab, len, - sizeof (struct ecoff_fdrtab_entry), cmp_fdrtab_entry); - - return true; -} - -/* Return index of first FDR that covers to OFFSET. */ - -static long -fdrtab_lookup (line_info, offset) - struct ecoff_find_line *line_info; - bfd_vma offset; -{ - long low, high, len; - long mid = -1; - struct ecoff_fdrtab_entry *tab; - - len = line_info->fdrtab_len; - if (len == 0) - return -1; - - tab = line_info->fdrtab; - for (low = 0, high = len - 1 ; low != high ;) - { - mid = (high + low) / 2; - if (offset >= tab[mid].base_addr && offset < tab[mid + 1].base_addr) - goto find_min; - - if (tab[mid].base_addr > offset) - high = mid; - else - low = mid + 1; - } - ++mid; - - /* last entry is catch-all for all higher addresses: */ - if (offset < tab[mid].base_addr) - return -1; - - find_min: - - while (mid > 0 && tab[mid - 1].base_addr == tab[mid].base_addr) - --mid; - - return mid; -} - -/* Do the work of find_nearest_line. */ - -boolean -_bfd_ecoff_locate_line (abfd, section, offset, debug_info, debug_swap, - line_info, filename_ptr, functionname_ptr, retline_ptr) - bfd *abfd; - asection *section; - bfd_vma offset; - struct ecoff_debug_info * const debug_info; - const struct ecoff_debug_swap * const debug_swap; - struct ecoff_find_line *line_info; - const char **filename_ptr; - const char **functionname_ptr; - unsigned int *retline_ptr; -{ - struct ecoff_fdrtab_entry *tab; - boolean stabs; - FDR *fdr_ptr; - int i; - - offset += section->vma; - - /* Build FDR table (sorted by object file's base-address) if we - don't have it already. */ - if (line_info->fdrtab == NULL - && !mk_fdrtab (abfd, debug_info, debug_swap, line_info)) - return false; - - tab = line_info->fdrtab; - - /* find first FDR for address OFFSET */ - i = fdrtab_lookup (line_info, offset); - if (i < 0) - return false; /* no FDR, no fun... */ - fdr_ptr = tab[i].fdr; - - /* Check whether this file has stabs debugging information. In a - file with stabs debugging information, the second local symbol is - named @stabs. */ - stabs = false; - if (fdr_ptr->csym >= 2) - { - char *sym_ptr; - SYMR sym; - - sym_ptr = ((char *) debug_info->external_sym - + (fdr_ptr->isymBase + 1) * debug_swap->external_sym_size); - (*debug_swap->swap_sym_in) (abfd, sym_ptr, &sym); - if (strcmp (debug_info->ss + fdr_ptr->issBase + sym.iss, - STABS_SYMBOL) == 0) - stabs = true; - } - - if (!stabs) - { - bfd_size_type external_pdr_size; - char *pdr_ptr; - char *best_pdr = NULL; - FDR *best_fdr; - bfd_vma best_dist = ~0; - PDR pdr; - unsigned char *line_ptr; - unsigned char *line_end; - int lineno; - /* This file uses ECOFF debugging information. Each FDR has a - list of procedure descriptors (PDR). The address in the FDR - is the absolute address of the first procedure. The address - in the first PDR gives the offset of that procedure relative - to the object file's base-address. The addresses in - subsequent PDRs specify each procedure's address relative to - the object file's base-address. To make things more juicy, - whenever the PROF bit in the PDR is set, the real entry point - of the procedure may be 16 bytes below what would normally be - the procedure's entry point. Instead, DEC came up with a - wicked scheme to create profiled libraries "on the fly": - instead of shipping a regular and a profiled version of each - library, they insert 16 bytes of unused space in front of - each procedure and set the "prof" bit in the PDR to indicate - that there is a gap there (this is done automagically by "as" - when option "-pg" is specified). Thus, normally, you link - against such a library and, except for lots of 16 byte gaps - between functions, things will behave as usual. However, - when invoking "ld" with option "-pg", it will fill those gaps - with code that calls mcount(). It then moves the function's - entry point down by 16 bytes, and out pops a binary that has - all functions profiled. - - NOTE: Neither FDRs nor PDRs are strictly sorted in memory - order. For example, when including header-files that - define functions, the FDRs follow behind the including - file, even though their code may have been generated at - a lower address. File coff-alpha.c from libbfd - illustrates this (use "odump -PFv" to look at a file's - FDR/PDR). Similarly, PDRs are sometimes out of order - as well. An example of this is OSF/1 v3.0 libc's - malloc.c. I'm not sure why this happens, but it could - be due to optimizations that reorder a function's - position within an object-file. - - Strategy: - - On the first call to this function, we build a table of FDRs - that is sorted by the base-address of the object-file the FDR - is referring to. Notice that each object-file may contain - code from multiple source files (e.g., due to code defined in - include files). Thus, for any given base-address, there may - be multiple FDRs (but this case is, fortunately, uncommon). - lookup(addr) guarantees to return the first FDR that applies - to address ADDR. Thus, after invoking lookup(), we have a - list of FDRs that may contain the PDR for ADDR. Next, we - walk through the PDRs of these FDRs and locate the one that - is closest to ADDR (i.e., for which the difference between - ADDR and the PDR's entry point is positive and minimal). - Once, the right FDR and PDR are located, we simply walk - through the line-number table to lookup the line-number that - best matches ADDR. Obviously, things could be sped up by - keeping a sorted list of PDRs instead of a sorted list of - FDRs. However, this would increase space requirements - considerably, which is undesirable. */ - external_pdr_size = debug_swap->external_pdr_size; - - /* Make offset relative to object file's start-address: */ - offset -= tab[i].base_addr; - /* Search FDR list starting at tab[i] for the PDR that best matches - OFFSET. Normally, the FDR list is only one entry long. */ - best_fdr = NULL; - do - { - bfd_vma dist, min_dist = 0; - char *pdr_hold; - char *pdr_end; - - fdr_ptr = tab[i].fdr; - - pdr_ptr = ((char *) debug_info->external_pdr - + fdr_ptr->ipdFirst * external_pdr_size); - pdr_end = pdr_ptr + fdr_ptr->cpd * external_pdr_size; - (*debug_swap->swap_pdr_in) (abfd, (PTR) pdr_ptr, &pdr); - /* Find PDR that is closest to OFFSET. If pdr.prof is set, - the procedure entry-point *may* be 0x10 below pdr.adr. We - simply pretend that pdr.prof *implies* a lower entry-point. - This is safe because it just means that may identify 4 NOPs - in front of the function as belonging to the function. */ - for (pdr_hold = NULL; - pdr_ptr < pdr_end; - (pdr_ptr += external_pdr_size, - (*debug_swap->swap_pdr_in) (abfd, (PTR) pdr_ptr, &pdr))) - { - if (offset >= (pdr.adr - 0x10 * pdr.prof)) - { - dist = offset - (pdr.adr - 0x10 * pdr.prof); - if (!pdr_hold || dist < min_dist) - { - min_dist = dist; - pdr_hold = pdr_ptr; - } - } - } - - if (!best_pdr || min_dist < best_dist) - { - best_dist = min_dist; - best_fdr = fdr_ptr; - best_pdr = pdr_hold; - } - /* continue looping until base_addr of next entry is different: */ - } - while (++i < line_info->fdrtab_len - && tab[i].base_addr == tab[i - 1].base_addr); - - if (!best_fdr || !best_pdr) - return false; /* shouldn't happen... */ - - /* phew, finally we got something that we can hold onto: */ - fdr_ptr = best_fdr; - pdr_ptr = best_pdr; - (*debug_swap->swap_pdr_in) (abfd, (PTR) pdr_ptr, &pdr); - /* Now we can look for the actual line number. The line numbers - are stored in a very funky format, which I won't try to - describe. The search is bounded by the end of the FDRs line - number entries. */ - line_end = debug_info->line + fdr_ptr->cbLineOffset + fdr_ptr->cbLine; - - /* Make offset relative to procedure entry: */ - offset -= pdr.adr - 0x10 * pdr.prof; - lineno = pdr.lnLow; - line_ptr = debug_info->line + fdr_ptr->cbLineOffset + pdr.cbLineOffset; - while (line_ptr < line_end) - { - int delta; - unsigned int count; - - delta = *line_ptr >> 4; - if (delta >= 0x8) - delta -= 0x10; - count = (*line_ptr & 0xf) + 1; - ++line_ptr; - if (delta == -8) - { - delta = (((line_ptr[0]) & 0xff) << 8) + ((line_ptr[1]) & 0xff); - if (delta >= 0x8000) - delta -= 0x10000; - line_ptr += 2; - } - lineno += delta; - if (offset < count * 4) - break; - offset -= count * 4; - } - - /* If fdr_ptr->rss is -1, then this file does not have full - symbols, at least according to gdb/mipsread.c. */ - if (fdr_ptr->rss == -1) - { - *filename_ptr = NULL; - if (pdr.isym == -1) - *functionname_ptr = NULL; - else - { - EXTR proc_ext; - - (*debug_swap->swap_ext_in) - (abfd, - ((char *) debug_info->external_ext - + pdr.isym * debug_swap->external_ext_size), - &proc_ext); - *functionname_ptr = debug_info->ssext + proc_ext.asym.iss; - } - } - else - { - SYMR proc_sym; - - *filename_ptr = debug_info->ss + fdr_ptr->issBase + fdr_ptr->rss; - (*debug_swap->swap_sym_in) - (abfd, - ((char *) debug_info->external_sym - + (fdr_ptr->isymBase + pdr.isym) * debug_swap->external_sym_size), - &proc_sym); - *functionname_ptr = debug_info->ss + fdr_ptr->issBase + proc_sym.iss; - } - if (lineno == ilineNil) - lineno = 0; - *retline_ptr = lineno; - } - else - { - bfd_size_type external_sym_size; - const char *directory_name; - const char *main_file_name; - const char *current_file_name; - const char *function_name; - const char *line_file_name; - bfd_vma low_func_vma; - bfd_vma low_line_vma; - boolean past_line; - boolean past_fn; - char *sym_ptr, *sym_ptr_end; - size_t len, funclen; - char *buffer = NULL; - - /* This file uses stabs debugging information. When gcc is not - optimizing, it will put the line number information before - the function name stabs entry. When gcc is optimizing, it - will put the stabs entry for all the function first, followed - by the line number information. (This appears to happen - because of the two output files used by the -mgpopt switch, - which is implied by -O). This means that we must keep - looking through the symbols until we find both a line number - and a function name which are beyond the address we want. */ - - *filename_ptr = NULL; - *functionname_ptr = NULL; - *retline_ptr = 0; - - directory_name = NULL; - main_file_name = NULL; - current_file_name = NULL; - function_name = NULL; - line_file_name = NULL; - low_func_vma = 0; - low_line_vma = 0; - past_line = false; - past_fn = false; - - external_sym_size = debug_swap->external_sym_size; - - sym_ptr = ((char *) debug_info->external_sym - + (fdr_ptr->isymBase + 2) * external_sym_size); - sym_ptr_end = sym_ptr + (fdr_ptr->csym - 2) * external_sym_size; - for (; - sym_ptr < sym_ptr_end && (! past_line || ! past_fn); - sym_ptr += external_sym_size) - { - SYMR sym; - - (*debug_swap->swap_sym_in) (abfd, sym_ptr, &sym); - - if (ECOFF_IS_STAB (&sym)) - { - switch (ECOFF_UNMARK_STAB (sym.index)) - { - case N_SO: - main_file_name = current_file_name = - debug_info->ss + fdr_ptr->issBase + sym.iss; - - /* Check the next symbol to see if it is also an - N_SO symbol. */ - if (sym_ptr + external_sym_size < sym_ptr_end) - { - SYMR nextsym; - - (*debug_swap->swap_sym_in) (abfd, - sym_ptr + external_sym_size, - &nextsym); - if (ECOFF_IS_STAB (&nextsym) - && ECOFF_UNMARK_STAB (nextsym.index) == N_SO) - { - directory_name = current_file_name; - main_file_name = current_file_name = - debug_info->ss + fdr_ptr->issBase + nextsym.iss; - sym_ptr += external_sym_size; - } - } - break; - - case N_SOL: - current_file_name = - debug_info->ss + fdr_ptr->issBase + sym.iss; - break; - - case N_FUN: - if (sym.value > offset) - past_fn = true; - else if (sym.value >= low_func_vma) - { - low_func_vma = sym.value; - function_name = - debug_info->ss + fdr_ptr->issBase + sym.iss; - } - break; - } - } - else if (sym.st == stLabel && sym.index != indexNil) - { - if (sym.value > offset) - past_line = true; - else if (sym.value >= low_line_vma) - { - low_line_vma = sym.value; - line_file_name = current_file_name; - *retline_ptr = sym.index; - } - } - } - - if (*retline_ptr != 0) - main_file_name = line_file_name; - - /* We need to remove the stuff after the colon in the function - name. We also need to put the directory name and the file - name together. */ - if (function_name == NULL) - len = funclen = 0; - else - len = funclen = strlen (function_name) + 1; - - if (main_file_name != NULL - && directory_name != NULL - && main_file_name[0] != '/') - len += strlen (directory_name) + strlen (main_file_name) + 1; - - if (len != 0) - { - if (line_info->find_buffer != NULL) - free (line_info->find_buffer); - buffer = (char *) bfd_malloc (len); - if (buffer == NULL) - return false; - line_info->find_buffer = buffer; - } - - if (function_name != NULL) - { - char *colon; - - strcpy (buffer, function_name); - colon = strchr (buffer, ':'); - if (colon != NULL) - *colon = '\0'; - *functionname_ptr = buffer; - } - - if (main_file_name != NULL) - { - if (directory_name == NULL || main_file_name[0] == '/') - *filename_ptr = main_file_name; - else - { - sprintf (buffer + funclen, "%s%s", directory_name, - main_file_name); - *filename_ptr = buffer + funclen; - } - } - } - - return true; -} - -/* These routines copy symbolic information into a memory buffer. - - FIXME: The whole point of the shuffle code is to avoid storing - everything in memory, since the linker is such a memory hog. This - code makes that effort useless. It is only called by the MIPS ELF - code when generating a shared library, so it is not that big a - deal, but it should be fixed eventually. */ - -/* Collect a shuffle into a memory buffer. */ - -static boolean ecoff_collect_shuffle PARAMS ((struct shuffle *, bfd_byte *)); - -static boolean -ecoff_collect_shuffle (l, buff) - struct shuffle *l; - bfd_byte *buff; -{ - unsigned long total; - - total = 0; - for (; l != (struct shuffle *) NULL; l = l->next) - { - if (! l->filep) - memcpy (buff, l->u.memory, l->size); - else - { - if (bfd_seek (l->u.file.input_bfd, l->u.file.offset, SEEK_SET) != 0 - || bfd_read (buff, 1, l->size, l->u.file.input_bfd) != l->size) - return false; - } - total += l->size; - buff += l->size; - } - - return true; -} - -/* Copy PDR information into a memory buffer. */ - -boolean -_bfd_ecoff_get_accumulated_pdr (handle, buff) - PTR handle; - bfd_byte *buff; -{ - struct accumulate *ainfo = (struct accumulate *) handle; - - return ecoff_collect_shuffle (ainfo->pdr, buff); -} - -/* Copy symbol information into a memory buffer. */ - -boolean -_bfd_ecoff_get_accumulated_sym (handle, buff) - PTR handle; - bfd_byte *buff; -{ - struct accumulate *ainfo = (struct accumulate *) handle; - - return ecoff_collect_shuffle (ainfo->sym, buff); -} - -/* Copy the string table into a memory buffer. */ - -boolean -_bfd_ecoff_get_accumulated_ss (handle, buff) - PTR handle; - bfd_byte *buff; -{ - struct accumulate *ainfo = (struct accumulate *) handle; - struct string_hash_entry *sh; - unsigned long total; - - /* The string table is written out from the hash table if this is a - final link. */ - BFD_ASSERT (ainfo->ss == (struct shuffle *) NULL); - *buff++ = '\0'; - total = 1; - BFD_ASSERT (ainfo->ss_hash == NULL || ainfo->ss_hash->val == 1); - for (sh = ainfo->ss_hash; - sh != (struct string_hash_entry *) NULL; - sh = sh->next) - { - size_t len; - - len = strlen (sh->root.string); - memcpy (buff, (PTR) sh->root.string, len + 1); - total += len + 1; - buff += len + 1; - } - - return true; -} diff --git a/contrib/gdb/bfd/elf-bfd.h b/contrib/gdb/bfd/elf-bfd.h deleted file mode 100644 index ee38e5b..0000000 --- a/contrib/gdb/bfd/elf-bfd.h +++ /dev/null @@ -1,858 +0,0 @@ -/* BFD back-end data structures for ELF files. - Copyright (C) 1992, 1993, 1994, 1995, 1996 Free Software Foundation, Inc. - Written by Cygnus Support. - -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 _LIBELF_H_ -#define _LIBELF_H_ 1 - -#include "elf/common.h" -#include "elf/internal.h" -#include "elf/external.h" -#include "bfdlink.h" - -/* If size isn't specified as 64 or 32, NAME macro should fail. */ -#ifndef NAME -#if ARCH_SIZE==64 -#define NAME(x,y) CAT4(x,64,_,y) -#endif -#if ARCH_SIZE==32 -#define NAME(x,y) CAT4(x,32,_,y) -#endif -#endif - -#ifndef NAME -#define NAME(x,y) CAT4(x,NOSIZE,_,y) -#endif - -#define ElfNAME(X) NAME(Elf,X) -#define elfNAME(X) NAME(elf,X) - -/* Information held for an ELF symbol. The first field is the - corresponding asymbol. Every symbol is an ELF file is actually a - pointer to this structure, although it is often handled as a - pointer to an asymbol. */ - -typedef struct -{ - /* The BFD symbol. */ - asymbol symbol; - /* ELF symbol information. */ - Elf_Internal_Sym internal_elf_sym; - /* Backend specific information. */ - union - { - unsigned int hppa_arg_reloc; - PTR mips_extr; - PTR any; - } - tc_data; -} elf_symbol_type; - -/* ELF linker hash table entries. */ - -struct elf_link_hash_entry -{ - struct bfd_link_hash_entry root; - - /* Symbol index in output file. This is initialized to -1. It is - set to -2 if the symbol is used by a reloc. */ - long indx; - - /* Symbol size. */ - bfd_size_type size; - - /* Symbol index as a dynamic symbol. Initialized to -1, and remains - -1 if this is not a dynamic symbol. */ - long dynindx; - - /* String table index in .dynstr if this is a dynamic symbol. */ - unsigned long dynstr_index; - - /* If this is a weak defined symbol from a dynamic object, this - field points to a defined symbol with the same value, if there is - one. Otherwise it is NULL. */ - struct elf_link_hash_entry *weakdef; - - /* If this symbol requires an entry in the global offset table, the - processor specific backend uses this field to hold the offset - into the .got section. If this field is -1, then the symbol does - not require a global offset table entry. */ - bfd_vma got_offset; - - /* If this symbol requires an entry in the procedure linkage table, - the processor specific backend uses these two fields to hold the - offset into the procedure linkage section and the offset into the - .got section. If plt_offset is -1, then the symbol does not - require an entry in the procedure linkage table. */ - bfd_vma plt_offset; - - /* If this symbol is used in the linker created sections, the processor - specific backend uses this field to map the field into the offset - from the beginning of the section. */ - struct elf_linker_section_pointers *linker_section_pointer; - - /* Symbol type (STT_NOTYPE, STT_OBJECT, etc.). */ - char type; - - /* Some flags; legal values follow. */ - unsigned char elf_link_hash_flags; - /* Symbol is referenced by a non-shared object. */ -#define ELF_LINK_HASH_REF_REGULAR 01 - /* Symbol is defined by a non-shared object. */ -#define ELF_LINK_HASH_DEF_REGULAR 02 - /* Symbol is referenced by a shared object. */ -#define ELF_LINK_HASH_REF_DYNAMIC 04 - /* Symbol is defined by a shared object. */ -#define ELF_LINK_HASH_DEF_DYNAMIC 010 - /* Dynamic symbol has been adjustd. */ -#define ELF_LINK_HASH_DYNAMIC_ADJUSTED 020 - /* Symbol needs a copy reloc. */ -#define ELF_LINK_HASH_NEEDS_COPY 040 - /* Symbol needs a procedure linkage table entry. */ -#define ELF_LINK_HASH_NEEDS_PLT 0100 - /* Symbol appears in a non-ELF input file. */ -#define ELF_LINK_NON_ELF 0200 - /* Note: If you add more flags, you must change the type of - elf_link_hash_flags. */ -}; - -/* ELF linker hash table. */ - -struct elf_link_hash_table -{ - struct bfd_link_hash_table root; - /* Whether we have created the special dynamic sections required - when linking against or generating a shared object. */ - boolean dynamic_sections_created; - /* The BFD used to hold special sections created by the linker. - This will be the first BFD found which requires these sections to - be created. */ - bfd *dynobj; - /* The number of symbols found in the link which must be put into - the .dynsym section. */ - bfd_size_type dynsymcount; - /* The string table of dynamic symbols, which becomes the .dynstr - section. */ - struct bfd_strtab_hash *dynstr; - /* The number of buckets in the hash table in the .hash section. - This is based on the number of dynamic symbols. */ - bfd_size_type bucketcount; - /* A linked list of DT_NEEDED names found in dynamic objects - included in the link. */ - struct bfd_link_needed_list *needed; -}; - -/* Look up an entry in an ELF linker hash table. */ - -#define elf_link_hash_lookup(table, string, create, copy, follow) \ - ((struct elf_link_hash_entry *) \ - bfd_link_hash_lookup (&(table)->root, (string), (create), \ - (copy), (follow))) - -/* Traverse an ELF linker hash table. */ - -#define elf_link_hash_traverse(table, func, info) \ - (bfd_link_hash_traverse \ - (&(table)->root, \ - (boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func), \ - (info))) - -/* Get the ELF linker hash table from a link_info structure. */ - -#define elf_hash_table(p) ((struct elf_link_hash_table *) ((p)->hash)) - -/* Constant information held for an ELF backend. */ - -struct elf_size_info { - unsigned char sizeof_ehdr, sizeof_phdr, sizeof_shdr; - unsigned char sizeof_rel, sizeof_rela, sizeof_sym, sizeof_dyn, sizeof_note; - - unsigned char arch_size, file_align; - unsigned char elfclass, ev_current; - int (*write_out_phdrs) PARAMS ((bfd *, Elf_Internal_Phdr *, int)); - boolean (*write_shdrs_and_ehdr) PARAMS ((bfd *)); - void (*write_relocs) PARAMS ((bfd *, asection *, PTR)); - void (*swap_symbol_out) PARAMS ((bfd *, Elf_Internal_Sym *, PTR)); - boolean (*slurp_reloc_table) PARAMS ((bfd *, asection *, asymbol **)); - long (*slurp_symbol_table) PARAMS ((bfd *, asymbol **, boolean)); - void (*swap_dyn_in) PARAMS ((bfd *, const PTR, Elf_Internal_Dyn *)); -}; - -#define elf_symbol_from(ABFD,S) \ - (((S)->the_bfd->xvec->flavour == bfd_target_elf_flavour \ - && (S)->the_bfd->tdata.elf_obj_data != 0) \ - ? (elf_symbol_type *) (S) \ - : 0) - -struct elf_backend_data -{ - /* Whether the backend uses REL or RELA relocations. FIXME: some - ELF backends use both. When we need to support one, this whole - approach will need to be changed. */ - int use_rela_p; - - /* The architecture for this backend. */ - enum bfd_architecture arch; - - /* The ELF machine code (EM_xxxx) for this backend. */ - int elf_machine_code; - - /* The maximum page size for this backend. */ - bfd_vma maxpagesize; - - /* This is true if the linker should act like collect and gather - global constructors and destructors by name. This is true for - MIPS ELF because the Irix 5 tools can not handle the .init - section. */ - boolean collect; - - /* This is true if the linker should ignore changes to the type of a - symbol. This is true for MIPS ELF because some Irix 5 objects - record undefined functions as STT_OBJECT although the definitions - are STT_FUNC. */ - boolean type_change_ok; - - /* A function to translate an ELF RELA relocation to a BFD arelent - structure. */ - void (*elf_info_to_howto) PARAMS ((bfd *, arelent *, - Elf_Internal_Rela *)); - - /* A function to translate an ELF REL relocation to a BFD arelent - structure. */ - void (*elf_info_to_howto_rel) PARAMS ((bfd *, arelent *, - Elf_Internal_Rel *)); - - /* A function to determine whether a symbol is global when - partitioning the symbol table into local and global symbols. - This should be NULL for most targets, in which case the correct - thing will be done. MIPS ELF, at least on the Irix 5, has - special requirements. */ - boolean (*elf_backend_sym_is_global) PARAMS ((bfd *, asymbol *)); - - /* The remaining functions are hooks which are called only if they - are not NULL. */ - - /* A function to permit a backend specific check on whether a - particular BFD format is relevant for an object file, and to - permit the backend to set any global information it wishes. When - this is called elf_elfheader is set, but anything else should be - used with caution. If this returns false, the check_format - routine will return a bfd_error_wrong_format error. */ - boolean (*elf_backend_object_p) PARAMS ((bfd *)); - - /* A function to do additional symbol processing when reading the - ELF symbol table. This is where any processor-specific special - section indices are handled. */ - void (*elf_backend_symbol_processing) PARAMS ((bfd *, asymbol *)); - - /* A function to do additional symbol processing after reading the - entire ELF symbol table. */ - boolean (*elf_backend_symbol_table_processing) PARAMS ((bfd *, - elf_symbol_type *, - unsigned int)); - - /* A function to do additional processing on the ELF section header - just before writing it out. This is used to set the flags and - type fields for some sections, or to actually write out data for - unusual sections. */ - boolean (*elf_backend_section_processing) PARAMS ((bfd *, - Elf32_Internal_Shdr *)); - - /* 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 *)); - - /* A function to set up the ELF section header for a BFD section in - preparation for writing it out. This is where the flags and type - fields are set for unusual sections. */ - boolean (*elf_backend_fake_sections) PARAMS ((bfd *, Elf32_Internal_Shdr *, - asection *)); - - /* A function to get the ELF section index for a BFD section. If - this returns true, the section was found. If it is a normal ELF - section, *RETVAL should be left unchanged. If it is not a normal - ELF section *RETVAL should be set to the SHN_xxxx index. */ - boolean (*elf_backend_section_from_bfd_section) - PARAMS ((bfd *, Elf32_Internal_Shdr *, asection *, int *retval)); - - /* If this field is not NULL, it is called by the add_symbols phase - of a link just before adding a symbol to the global linker hash - table. It may modify any of the fields as it wishes. If *NAME - is set to NULL, the symbol will be skipped rather than being - added to the hash table. This function is responsible for - handling all processor dependent symbol bindings and section - indices, and must set at least *FLAGS and *SEC for each processor - dependent case; failure to do so will cause a link error. */ - boolean (*elf_add_symbol_hook) - PARAMS ((bfd *abfd, struct bfd_link_info *info, - const Elf_Internal_Sym *, const char **name, - flagword *flags, asection **sec, bfd_vma *value)); - - /* If this field is not NULL, it is called by the elf_link_output_sym - phase of a link for each symbol which will appear in the object file. */ - boolean (*elf_backend_link_output_symbol_hook) - PARAMS ((bfd *, struct bfd_link_info *info, const char *, - Elf_Internal_Sym *, asection *)); - - /* The CREATE_DYNAMIC_SECTIONS function is called by the ELF backend - linker the first time it encounters a dynamic object in the link. - This function must create any sections required for dynamic - linking. The ABFD argument is a dynamic object. The .interp, - .dynamic, .dynsym, .dynstr, and .hash functions have already been - created, and this function may modify the section flags if - desired. This function will normally create the .got and .plt - sections, but different backends have different requirements. */ - boolean (*elf_backend_create_dynamic_sections) - PARAMS ((bfd *abfd, struct bfd_link_info *info)); - - /* The CHECK_RELOCS function is called by the add_symbols phase of - the ELF backend linker. It is called once for each section with - relocs of an object file, just after the symbols for the object - file have been added to the global linker hash table. The - function must look through the relocs and do any special handling - required. This generally means allocating space in the global - offset table, and perhaps allocating space for a reloc. The - relocs are always passed as Rela structures; if the section - actually uses Rel structures, the r_addend field will always be - zero. */ - boolean (*check_relocs) - PARAMS ((bfd *abfd, struct bfd_link_info *info, asection *o, - const Elf_Internal_Rela *relocs)); - - /* The ADJUST_DYNAMIC_SYMBOL function is called by the ELF backend - linker for every symbol which is defined by a dynamic object and - referenced by a regular object. This is called after all the - input files have been seen, but before the SIZE_DYNAMIC_SECTIONS - function has been called. The hash table entry should be - bfd_link_hash_defined ore bfd_link_hash_defweak, and it should be - defined in a section from a dynamic object. Dynamic object - sections are not included in the final link, and this function is - responsible for changing the value to something which the rest of - the link can deal with. This will normally involve adding an - entry to the .plt or .got or some such section, and setting the - symbol to point to that. */ - boolean (*elf_backend_adjust_dynamic_symbol) - PARAMS ((struct bfd_link_info *info, struct elf_link_hash_entry *h)); - - /* The SIZE_DYNAMIC_SECTIONS function is called by the ELF backend - linker after all the linker input files have been seen but before - the sections sizes have been set. This is called after - ADJUST_DYNAMIC_SYMBOL has been called on all appropriate symbols. - It is only called when linking against a dynamic object. It must - set the sizes of the dynamic sections, and may fill in their - contents as well. The generic ELF linker can handle the .dynsym, - .dynstr and .hash sections. This function must handle the - .interp section and any sections created by the - CREATE_DYNAMIC_SECTIONS entry point. */ - boolean (*elf_backend_size_dynamic_sections) - PARAMS ((bfd *output_bfd, struct bfd_link_info *info)); - - /* The RELOCATE_SECTION function is called by the ELF backend linker - to handle the relocations for a section. - - The relocs are always passed as Rela structures; if the section - actually uses Rel structures, the r_addend field will always be - zero. - - This function is responsible for adjust the section contents as - necessary, and (if using Rela relocs and generating a - relocateable output file) adjusting the reloc addend as - necessary. - - This function does not have to worry about setting the reloc - address or the reloc symbol index. - - LOCAL_SYMS is a pointer to the swapped in local symbols. - - LOCAL_SECTIONS is an array giving the section in the input file - corresponding to the st_shndx field of each local symbol. - - The global hash table entry for the global symbols can be found - via elf_sym_hashes (input_bfd). - - When generating relocateable output, this function must handle - STB_LOCAL/STT_SECTION symbols specially. The output symbol is - going to be the section symbol corresponding to the output - section, which means that the addend must be adjusted - accordingly. */ - boolean (*elf_backend_relocate_section) - PARAMS ((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)); - - /* The FINISH_DYNAMIC_SYMBOL function is called by the ELF backend - linker just before it writes a symbol out to the .dynsym section. - The processor backend may make any required adjustment to the - symbol. It may also take the opportunity to set contents of the - dynamic sections. Note that FINISH_DYNAMIC_SYMBOL is called on - all .dynsym symbols, while ADJUST_DYNAMIC_SYMBOL is only called - on those symbols which are defined by a dynamic object. */ - boolean (*elf_backend_finish_dynamic_symbol) - PARAMS ((bfd *output_bfd, struct bfd_link_info *info, - struct elf_link_hash_entry *h, Elf_Internal_Sym *sym)); - - /* The FINISH_DYNAMIC_SECTIONS function is called by the ELF backend - linker just before it writes all the dynamic sections out to the - output file. The FINISH_DYNAMIC_SYMBOL will have been called on - all dynamic symbols. */ - boolean (*elf_backend_finish_dynamic_sections) - PARAMS ((bfd *output_bfd, struct bfd_link_info *info)); - - /* A function to do any beginning processing needed for the ELF file - before building the ELF headers and computing file positions. */ - void (*elf_backend_begin_write_processing) - PARAMS ((bfd *, struct bfd_link_info *)); - - /* A function to do any final processing needed for the ELF file - before writing it out. The LINKER argument is true if this BFD - was created by the ELF backend linker. */ - void (*elf_backend_final_write_processing) - PARAMS ((bfd *, boolean linker)); - - /* This function is called by get_program_header_size. It should - return the number of additional program segments which this BFD - will need. It should return -1 on error. */ - int (*elf_backend_additional_program_headers) PARAMS ((bfd *)); - - /* This function is called to modify an existing segment map in a - backend specific fashion. */ - boolean (*elf_backend_modify_segment_map) PARAMS ((bfd *)); - - /* The swapping table to use when dealing with ECOFF information. - Used for the MIPS ELF .mdebug section. */ - const struct ecoff_debug_swap *elf_backend_ecoff_debug_swap; - - /* Alternate EM_xxxx machine codes for this backend. */ - int elf_machine_alt1; - int elf_machine_alt2; - - const struct elf_size_info *s; - - unsigned want_got_plt : 1; - unsigned plt_readonly : 1; - unsigned want_plt_sym : 1; -}; - -/* Information stored for each BFD section in an ELF file. This - structure is allocated by elf_new_section_hook. */ - -struct bfd_elf_section_data -{ - /* The ELF header for this section. */ - Elf_Internal_Shdr this_hdr; - /* The ELF header for the reloc section associated with this - section, if any. */ - Elf_Internal_Shdr rel_hdr; - /* The ELF section number of this section. Only used for an output - file. */ - int this_idx; - /* The ELF section number of the reloc section associated with this - section, if any. Only used for an output file. */ - int rel_idx; - /* Used by the backend linker to store the symbol hash table entries - associated with relocs against global symbols. */ - struct elf_link_hash_entry **rel_hashes; - /* A pointer to the swapped relocs. If the section uses REL relocs, - rather than RELA, all the r_addend fields will be zero. This - pointer may be NULL. It is used by the backend linker. */ - Elf_Internal_Rela *relocs; - /* Used by the backend linker when generating a shared library to - record the dynamic symbol index for a section symbol - corresponding to this section. */ - long dynindx; - /* A pointer available for the processor specific ELF backend. */ - PTR tdata; -}; - -#define elf_section_data(sec) ((struct bfd_elf_section_data*)sec->used_by_bfd) - -#define get_elf_backend_data(abfd) \ - ((struct elf_backend_data *) (abfd)->xvec->backend_data) - -/* Enumeration to specify the special section. */ -typedef enum elf_linker_section_enum -{ - LINKER_SECTION_UNKNOWN, /* not used */ - LINKER_SECTION_GOT, /* .got section for global offset pointers */ - LINKER_SECTION_PLT, /* .plt section for generated procedure stubs */ - LINKER_SECTION_SDATA, /* .sdata/.sbss section for PowerPC */ - LINKER_SECTION_SDATA2, /* .sdata2/.sbss2 section for PowerPC */ - LINKER_SECTION_MAX /* # of linker sections */ -} elf_linker_section_enum_t; - -/* Sections created by the linker. */ - -typedef struct elf_linker_section -{ - char *name; /* name of the section */ - char *rel_name; /* name of the associated .rel{,a}. section */ - char *bss_name; /* name of a related .bss section */ - char *sym_name; /* name of symbol to reference this section */ - asection *section; /* pointer to the section */ - asection *bss_section; /* pointer to the bss section associated with this */ - asection *rel_section; /* pointer to the relocations needed for this section */ - struct elf_link_hash_entry *sym_hash; /* pointer to the created symbol hash value */ - bfd_vma initial_size; /* initial size before any linker generated allocations */ - bfd_vma sym_offset; /* offset of symbol from beginning of section */ - bfd_vma hole_size; /* size of reserved address hole in allocation */ - bfd_vma hole_offset; /* current offset for the hole */ - bfd_vma max_hole_offset; /* maximum offset for the hole */ - elf_linker_section_enum_t which; /* which section this is */ - boolean hole_written_p; /* whether the hole has been initialized */ - int alignment; /* alignment for the section */ - flagword flags; /* flags to use to create the section */ -} elf_linker_section_t; - -/* Linked list of allocated pointer entries. This hangs off of the symbol lists, and - provides allows us to return different pointers, based on different addend's. */ - -typedef struct elf_linker_section_pointers -{ - struct elf_linker_section_pointers *next; /* next allocated pointer for this symbol */ - bfd_vma offset; /* offset of pointer from beginning of section */ - bfd_signed_vma addend; /* addend used */ - elf_linker_section_enum_t which; /* which linker section this is */ - boolean written_address_p; /* whether address was written yet */ -} elf_linker_section_pointers_t; - -/* Some private data is stashed away for future use using the tdata pointer - in the bfd structure. */ - -struct elf_obj_tdata -{ - Elf_Internal_Ehdr elf_header[1]; /* Actual data, but ref like ptr */ - Elf_Internal_Shdr **elf_sect_ptr; - Elf_Internal_Phdr *phdr; - struct elf_segment_map *segment_map; - struct bfd_strtab_hash *strtab_ptr; - int num_locals; - int num_globals; - asymbol **section_syms; /* STT_SECTION symbols for each section */ - Elf_Internal_Shdr symtab_hdr; - Elf_Internal_Shdr shstrtab_hdr; - Elf_Internal_Shdr strtab_hdr; - Elf_Internal_Shdr dynsymtab_hdr; - Elf_Internal_Shdr dynstrtab_hdr; - unsigned int symtab_section, shstrtab_section; - unsigned int strtab_section, dynsymtab_section; - file_ptr next_file_pos; - void *prstatus; /* The raw /proc prstatus structure */ - void *prpsinfo; /* The raw /proc prpsinfo structure */ - bfd_vma gp; /* The gp value (MIPS only, for now) */ - unsigned int gp_size; /* The gp size (MIPS only, for now) */ - - /* This is set to true if the object was created by the backend - linker. */ - boolean linker; - - /* A mapping from external symbols to entries in the linker hash - table, used when linking. This is indexed by the symbol index - minus the sh_info field of the symbol table header. */ - struct elf_link_hash_entry **sym_hashes; - - /* A mapping from local symbols to offsets into the global offset - table, used when linking. This is indexed by the symbol index. */ - bfd_vma *local_got_offsets; - - /* A mapping from local symbols to offsets into the various linker - sections added. This is index by the symbol index. */ - elf_linker_section_pointers_t **linker_section_pointers; - - /* The linker ELF emulation code needs to let the backend ELF linker - know what filename should be used for a dynamic object if the - dynamic object is found using a search. The emulation code then - sometimes needs to know what name was actually used. Until the - file has been added to the linker symbol table, this field holds - the name the linker wants. After it has been added, it holds the - name actually used, which will be the DT_SONAME entry if there is - one. */ - const char *dt_name; - - /* Irix 5 often screws up the symbol table, sorting local symbols - after global symbols. This flag is set if the symbol table in - this BFD appears to be screwed up. If it is, we ignore the - sh_info field in the symbol table header, and always read all the - symbols. */ - boolean bad_symtab; - - /* Records the result of `get_program_header_size'. */ - bfd_size_type program_header_size; - - /* Used by find_nearest_line entry point. */ - PTR line_info; - - /* Used by MIPS ELF find_nearest_line entry point. The structure - could be included directly in this one, but there's no point to - wasting the memory just for the infrequently called - find_nearest_line. */ - struct mips_elf_find_line *find_line_info; - - /* Used to determine if the e_flags field has been initialized */ - boolean flags_init; - - /* Linker sections that we are interested in. */ - struct elf_linker_section *linker_section[ (int)LINKER_SECTION_MAX ]; -}; - -#define elf_tdata(bfd) ((bfd) -> tdata.elf_obj_data) -#define elf_elfheader(bfd) (elf_tdata(bfd) -> elf_header) -#define elf_elfsections(bfd) (elf_tdata(bfd) -> elf_sect_ptr) -#define elf_shstrtab(bfd) (elf_tdata(bfd) -> strtab_ptr) -#define elf_onesymtab(bfd) (elf_tdata(bfd) -> symtab_section) -#define elf_dynsymtab(bfd) (elf_tdata(bfd) -> dynsymtab_section) -#define elf_num_locals(bfd) (elf_tdata(bfd) -> num_locals) -#define elf_num_globals(bfd) (elf_tdata(bfd) -> num_globals) -#define elf_section_syms(bfd) (elf_tdata(bfd) -> section_syms) -#define core_prpsinfo(bfd) (elf_tdata(bfd) -> prpsinfo) -#define core_prstatus(bfd) (elf_tdata(bfd) -> prstatus) -#define elf_gp(bfd) (elf_tdata(bfd) -> gp) -#define elf_gp_size(bfd) (elf_tdata(bfd) -> gp_size) -#define elf_sym_hashes(bfd) (elf_tdata(bfd) -> sym_hashes) -#define elf_local_got_offsets(bfd) (elf_tdata(bfd) -> local_got_offsets) -#define elf_local_ptr_offsets(bfd) (elf_tdata(bfd) -> linker_section_pointers) -#define elf_dt_name(bfd) (elf_tdata(bfd) -> dt_name) -#define elf_bad_symtab(bfd) (elf_tdata(bfd) -> bad_symtab) -#define elf_flags_init(bfd) (elf_tdata(bfd) -> flags_init) -#define elf_linker_section(bfd,n) (elf_tdata(bfd) -> linker_section[(int)n]) - -extern int _bfd_elf_section_from_bfd_section PARAMS ((bfd *, asection *)); -extern char *bfd_elf_string_from_elf_section - PARAMS ((bfd *, unsigned, unsigned)); -extern char *bfd_elf_get_str_section PARAMS ((bfd *, unsigned)); - -extern boolean _bfd_elf_print_private_bfd_data PARAMS ((bfd *, PTR)); -extern void bfd_elf_print_symbol PARAMS ((bfd *, PTR, asymbol *, - bfd_print_symbol_type)); -#define elf_string_from_elf_strtab(abfd,strindex) \ - bfd_elf_string_from_elf_section(abfd,elf_elfheader(abfd)->e_shstrndx,strindex) - -#define bfd_elf32_print_symbol bfd_elf_print_symbol -#define bfd_elf64_print_symbol bfd_elf_print_symbol -#define bfd_elf32_mkobject bfd_elf_mkobject -#define bfd_elf64_mkobject bfd_elf_mkobject -#define elf_mkobject bfd_elf_mkobject - -extern unsigned long bfd_elf_hash PARAMS ((CONST unsigned char *)); - -extern bfd_reloc_status_type bfd_elf_generic_reloc PARAMS ((bfd *, - arelent *, - asymbol *, - PTR, - asection *, - bfd *, - char **)); -extern boolean bfd_elf_mkobject PARAMS ((bfd *)); -extern Elf_Internal_Shdr *bfd_elf_find_section PARAMS ((bfd *, char *)); -extern boolean _bfd_elf_make_section_from_shdr - PARAMS ((bfd *abfd, Elf_Internal_Shdr *hdr, const char *name)); -extern struct bfd_hash_entry *_bfd_elf_link_hash_newfunc - PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); -extern struct bfd_link_hash_table *_bfd_elf_link_hash_table_create - PARAMS ((bfd *)); -extern boolean _bfd_elf_link_hash_table_init - PARAMS ((struct elf_link_hash_table *, bfd *, - struct bfd_hash_entry *(*) (struct bfd_hash_entry *, - struct bfd_hash_table *, - const char *))); - -extern boolean _bfd_elf_copy_private_symbol_data - PARAMS ((bfd *, asymbol *, bfd *, asymbol *)); -extern boolean _bfd_elf_copy_private_section_data - PARAMS ((bfd *, asection *, bfd *, asection *)); -extern boolean _bfd_elf_write_object_contents PARAMS ((bfd *)); -extern boolean _bfd_elf_set_section_contents PARAMS ((bfd *, sec_ptr, PTR, - file_ptr, - bfd_size_type)); -extern long _bfd_elf_get_symtab_upper_bound PARAMS ((bfd *)); -extern long _bfd_elf_get_symtab PARAMS ((bfd *, asymbol **)); -extern long _bfd_elf_get_dynamic_symtab_upper_bound PARAMS ((bfd *)); -extern long _bfd_elf_canonicalize_dynamic_symtab PARAMS ((bfd *, asymbol **)); -extern long _bfd_elf_get_reloc_upper_bound PARAMS ((bfd *, sec_ptr)); -extern long _bfd_elf_canonicalize_reloc PARAMS ((bfd *, sec_ptr, - arelent **, asymbol **)); -extern asymbol *_bfd_elf_make_empty_symbol PARAMS ((bfd *)); -extern void _bfd_elf_get_symbol_info PARAMS ((bfd *, asymbol *, - symbol_info *)); -extern alent *_bfd_elf_get_lineno PARAMS ((bfd *, asymbol *)); -extern boolean _bfd_elf_set_arch_mach PARAMS ((bfd *, enum bfd_architecture, - unsigned long)); -extern boolean _bfd_elf_find_nearest_line PARAMS ((bfd *, asection *, - asymbol **, - bfd_vma, CONST char **, - CONST char **, - unsigned int *)); -#define _bfd_elf_read_minisymbols _bfd_generic_read_minisymbols -#define _bfd_elf_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol -extern int _bfd_elf_sizeof_headers PARAMS ((bfd *, boolean)); -extern boolean _bfd_elf_new_section_hook PARAMS ((bfd *, asection *)); - -/* If the target doesn't have reloc handling written yet: */ -extern void _bfd_elf_no_info_to_howto PARAMS ((bfd *, arelent *, - Elf_Internal_Rela *)); - -asection *bfd_section_from_elf_index PARAMS ((bfd *, unsigned int)); -boolean _bfd_elf_create_dynamic_sections PARAMS ((bfd *, - struct bfd_link_info *)); -struct bfd_strtab_hash *_bfd_elf_stringtab_init PARAMS ((void)); -boolean -_bfd_elf_link_record_dynamic_symbol PARAMS ((struct bfd_link_info *, - struct elf_link_hash_entry *)); -boolean -_bfd_elf_compute_section_file_positions PARAMS ((bfd *, - struct bfd_link_info *)); -void _bfd_elf_assign_file_positions_for_relocs PARAMS ((bfd *)); -file_ptr _bfd_elf_assign_file_position_for_section PARAMS ((Elf_Internal_Shdr *, - file_ptr, - boolean)); - -boolean _bfd_elf_create_dynamic_sections PARAMS ((bfd *, - struct bfd_link_info *)); -boolean _bfd_elf_create_got_section PARAMS ((bfd *, - struct bfd_link_info *)); - -elf_linker_section_t *_bfd_elf_create_linker_section - PARAMS ((bfd *abfd, - struct bfd_link_info *info, - enum elf_linker_section_enum, - elf_linker_section_t *defaults)); - -elf_linker_section_pointers_t *_bfd_elf_find_pointer_linker_section - PARAMS ((elf_linker_section_pointers_t *linker_pointers, - bfd_signed_vma addend, - elf_linker_section_enum_t which)); - -boolean bfd_elf32_create_pointer_linker_section - PARAMS ((bfd *abfd, - struct bfd_link_info *info, - elf_linker_section_t *lsect, - struct elf_link_hash_entry *h, - const Elf32_Internal_Rela *rel)); - -bfd_vma bfd_elf32_finish_pointer_linker_section - PARAMS ((bfd *output_abfd, - bfd *input_bfd, - struct bfd_link_info *info, - elf_linker_section_t *lsect, - struct elf_link_hash_entry *h, - bfd_vma relocation, - const Elf32_Internal_Rela *rel, - int relative_reloc)); - -boolean bfd_elf64_create_pointer_linker_section - PARAMS ((bfd *abfd, - struct bfd_link_info *info, - elf_linker_section_t *lsect, - struct elf_link_hash_entry *h, - const Elf64_Internal_Rela *rel)); - -bfd_vma bfd_elf64_finish_pointer_linker_section - PARAMS ((bfd *output_abfd, - bfd *input_bfd, - struct bfd_link_info *info, - elf_linker_section_t *lsect, - struct elf_link_hash_entry *h, - bfd_vma relocation, - const Elf64_Internal_Rela *rel, - int relative_reloc)); - -boolean _bfd_elf_make_linker_section_rela - PARAMS ((bfd *dynobj, - elf_linker_section_t *lsect, - int alignment)); - -extern const bfd_target *bfd_elf32_object_p PARAMS ((bfd *)); -extern const bfd_target *bfd_elf32_core_file_p PARAMS ((bfd *)); -extern char *bfd_elf32_core_file_failing_command PARAMS ((bfd *)); -extern int bfd_elf32_core_file_failing_signal PARAMS ((bfd *)); -extern boolean bfd_elf32_core_file_matches_executable_p PARAMS ((bfd *, - bfd *)); - -extern boolean bfd_elf32_bfd_link_add_symbols - PARAMS ((bfd *, struct bfd_link_info *)); -extern boolean bfd_elf32_bfd_final_link - PARAMS ((bfd *, struct bfd_link_info *)); - -extern void bfd_elf32_swap_symbol_in - PARAMS ((bfd *, Elf32_External_Sym *, Elf_Internal_Sym *)); -extern void bfd_elf32_swap_symbol_out - PARAMS ((bfd *, Elf_Internal_Sym *, PTR)); -extern void bfd_elf32_swap_reloc_in - PARAMS ((bfd *, Elf32_External_Rel *, Elf_Internal_Rel *)); -extern void bfd_elf32_swap_reloc_out - PARAMS ((bfd *, Elf_Internal_Rel *, Elf32_External_Rel *)); -extern void bfd_elf32_swap_reloca_in - PARAMS ((bfd *, Elf32_External_Rela *, Elf_Internal_Rela *)); -extern void bfd_elf32_swap_reloca_out - PARAMS ((bfd *, Elf_Internal_Rela *, Elf32_External_Rela *)); -extern void bfd_elf32_swap_phdr_in - PARAMS ((bfd *, Elf32_External_Phdr *, Elf_Internal_Phdr *)); -extern void bfd_elf32_swap_phdr_out - PARAMS ((bfd *, Elf_Internal_Phdr *, Elf32_External_Phdr *)); -extern void bfd_elf32_swap_dyn_in - PARAMS ((bfd *, const PTR, Elf_Internal_Dyn *)); -extern void bfd_elf32_swap_dyn_out - PARAMS ((bfd *, const Elf_Internal_Dyn *, Elf32_External_Dyn *)); -extern boolean bfd_elf32_add_dynamic_entry - PARAMS ((struct bfd_link_info *, bfd_vma, bfd_vma)); -extern boolean bfd_elf32_link_create_dynamic_sections - PARAMS ((bfd *, struct bfd_link_info *)); - -extern const bfd_target *bfd_elf64_object_p PARAMS ((bfd *)); -extern const bfd_target *bfd_elf64_core_file_p PARAMS ((bfd *)); -extern char *bfd_elf64_core_file_failing_command PARAMS ((bfd *)); -extern int bfd_elf64_core_file_failing_signal PARAMS ((bfd *)); -extern boolean bfd_elf64_core_file_matches_executable_p PARAMS ((bfd *, - bfd *)); -extern boolean bfd_elf64_bfd_link_add_symbols - PARAMS ((bfd *, struct bfd_link_info *)); -extern boolean bfd_elf64_bfd_final_link - PARAMS ((bfd *, struct bfd_link_info *)); - -extern void bfd_elf64_swap_symbol_in - PARAMS ((bfd *, Elf64_External_Sym *, Elf_Internal_Sym *)); -extern void bfd_elf64_swap_symbol_out - PARAMS ((bfd *, Elf_Internal_Sym *, PTR)); -extern void bfd_elf64_swap_reloc_in - PARAMS ((bfd *, Elf64_External_Rel *, Elf_Internal_Rel *)); -extern void bfd_elf64_swap_reloc_out - PARAMS ((bfd *, Elf_Internal_Rel *, Elf64_External_Rel *)); -extern void bfd_elf64_swap_reloca_in - PARAMS ((bfd *, Elf64_External_Rela *, Elf_Internal_Rela *)); -extern void bfd_elf64_swap_reloca_out - PARAMS ((bfd *, Elf_Internal_Rela *, Elf64_External_Rela *)); -extern void bfd_elf64_swap_phdr_in - PARAMS ((bfd *, Elf64_External_Phdr *, Elf_Internal_Phdr *)); -extern void bfd_elf64_swap_phdr_out - PARAMS ((bfd *, Elf_Internal_Phdr *, Elf64_External_Phdr *)); -extern void bfd_elf64_swap_dyn_in - PARAMS ((bfd *, const PTR, Elf_Internal_Dyn *)); -extern void bfd_elf64_swap_dyn_out - PARAMS ((bfd *, const Elf_Internal_Dyn *, Elf64_External_Dyn *)); -extern boolean bfd_elf64_add_dynamic_entry - PARAMS ((struct bfd_link_info *, bfd_vma, bfd_vma)); -extern boolean bfd_elf64_link_create_dynamic_sections - PARAMS ((bfd *, struct bfd_link_info *)); - -#define bfd_elf32_link_record_dynamic_symbol _bfd_elf_link_record_dynamic_symbol -#define bfd_elf64_link_record_dynamic_symbol _bfd_elf_link_record_dynamic_symbol - -#endif /* _LIBELF_H_ */ diff --git a/contrib/gdb/bfd/elf.c b/contrib/gdb/bfd/elf.c deleted file mode 100644 index 981d3ee..0000000 --- a/contrib/gdb/bfd/elf.c +++ /dev/null @@ -1,3318 +0,0 @@ -/* ELF executable support for BFD. - Copyright 1993, 1994, 1995, 1996 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. */ - -/* - -SECTION - ELF backends - - BFD support for ELF formats is being worked on. - Currently, the best supported back ends are for sparc and i386 - (running svr4 or Solaris 2). - - Documentation of the internals of the support code still needs - to be written. The code is changing quickly enough that we - haven't bothered yet. - */ - -#include "bfd.h" -#include "sysdep.h" -#include "bfdlink.h" -#include "libbfd.h" -#define ARCH_SIZE 0 -#include "elf-bfd.h" - -static INLINE struct elf_segment_map *make_mapping - PARAMS ((bfd *, asection **, unsigned int, unsigned int, boolean)); -static int elf_sort_sections PARAMS ((const PTR, const PTR)); -static boolean assign_file_positions_for_segments PARAMS ((bfd *)); -static boolean assign_file_positions_except_relocs PARAMS ((bfd *)); -static boolean prep_headers PARAMS ((bfd *)); -static boolean swap_out_syms PARAMS ((bfd *, struct bfd_strtab_hash **)); -static boolean copy_private_bfd_data PARAMS ((bfd *, bfd *)); - -/* Standard ELF hash function. Do not change this function; you will - cause invalid hash tables to be generated. (Well, you would if this - were being used yet.) */ -unsigned long -bfd_elf_hash (name) - CONST unsigned char *name; -{ - unsigned long h = 0; - unsigned long g; - int ch; - - while ((ch = *name++) != '\0') - { - h = (h << 4) + ch; - if ((g = (h & 0xf0000000)) != 0) - { - h ^= g >> 24; - h &= ~g; - } - } - return h; -} - -/* Read a specified number of bytes at a specified offset in an ELF - file, into a newly allocated buffer, and return a pointer to the - buffer. */ - -static char * -elf_read (abfd, offset, size) - bfd * abfd; - long offset; - unsigned int size; -{ - char *buf; - - if ((buf = bfd_alloc (abfd, size)) == NULL) - return NULL; - if (bfd_seek (abfd, offset, SEEK_SET) == -1) - return NULL; - if (bfd_read ((PTR) buf, size, 1, abfd) != size) - { - if (bfd_get_error () != bfd_error_system_call) - bfd_set_error (bfd_error_file_truncated); - return NULL; - } - return buf; -} - -boolean -elf_mkobject (abfd) - bfd * abfd; -{ - /* this just does initialization */ - /* coff_mkobject zalloc's space for tdata.coff_obj_data ... */ - elf_tdata (abfd) = (struct elf_obj_tdata *) - bfd_zalloc (abfd, sizeof (struct elf_obj_tdata)); - if (elf_tdata (abfd) == 0) - return false; - /* since everything is done at close time, do we need any - initialization? */ - - return true; -} - -char * -bfd_elf_get_str_section (abfd, shindex) - bfd * abfd; - unsigned int shindex; -{ - Elf_Internal_Shdr **i_shdrp; - char *shstrtab = NULL; - unsigned int offset; - unsigned int shstrtabsize; - - i_shdrp = elf_elfsections (abfd); - if (i_shdrp == 0 || i_shdrp[shindex] == 0) - return 0; - - shstrtab = (char *) i_shdrp[shindex]->contents; - if (shstrtab == NULL) - { - /* No cached one, attempt to read, and cache what we read. */ - offset = i_shdrp[shindex]->sh_offset; - shstrtabsize = i_shdrp[shindex]->sh_size; - shstrtab = elf_read (abfd, offset, shstrtabsize); - i_shdrp[shindex]->contents = (PTR) shstrtab; - } - return shstrtab; -} - -char * -bfd_elf_string_from_elf_section (abfd, shindex, strindex) - bfd * abfd; - unsigned int shindex; - unsigned int strindex; -{ - Elf_Internal_Shdr *hdr; - - if (strindex == 0) - return ""; - - hdr = elf_elfsections (abfd)[shindex]; - - if (hdr->contents == NULL - && bfd_elf_get_str_section (abfd, shindex) == NULL) - return NULL; - - return ((char *) hdr->contents) + strindex; -} - -/* Make a BFD section from an ELF section. We store a pointer to the - BFD section in the bfd_section field of the header. */ - -boolean -_bfd_elf_make_section_from_shdr (abfd, hdr, name) - bfd *abfd; - Elf_Internal_Shdr *hdr; - const char *name; -{ - asection *newsect; - flagword flags; - - if (hdr->bfd_section != NULL) - { - BFD_ASSERT (strcmp (name, - bfd_get_section_name (abfd, hdr->bfd_section)) == 0); - return true; - } - - newsect = bfd_make_section_anyway (abfd, name); - if (newsect == NULL) - return false; - - newsect->filepos = hdr->sh_offset; - - if (! bfd_set_section_vma (abfd, newsect, hdr->sh_addr) - || ! bfd_set_section_size (abfd, newsect, hdr->sh_size) - || ! bfd_set_section_alignment (abfd, newsect, - bfd_log2 (hdr->sh_addralign))) - return false; - - flags = SEC_NO_FLAGS; - if (hdr->sh_type != SHT_NOBITS) - flags |= SEC_HAS_CONTENTS; - if ((hdr->sh_flags & SHF_ALLOC) != 0) - { - flags |= SEC_ALLOC; - if (hdr->sh_type != SHT_NOBITS) - flags |= SEC_LOAD; - } - if ((hdr->sh_flags & SHF_WRITE) == 0) - flags |= SEC_READONLY; - if ((hdr->sh_flags & SHF_EXECINSTR) != 0) - flags |= SEC_CODE; - else if ((flags & SEC_LOAD) != 0) - flags |= SEC_DATA; - - /* The debugging sections appear to be recognized only by name, not - any sort of flag. */ - if (strncmp (name, ".debug", sizeof ".debug" - 1) == 0 - || strncmp (name, ".line", sizeof ".line" - 1) == 0 - || strncmp (name, ".stab", sizeof ".stab" - 1) == 0) - flags |= SEC_DEBUGGING; - - if (! bfd_set_section_flags (abfd, newsect, flags)) - return false; - - if ((flags & SEC_ALLOC) != 0) - { - Elf_Internal_Phdr *phdr; - unsigned int i; - - /* Look through the phdrs to see if we need to adjust the lma. */ - phdr = elf_tdata (abfd)->phdr; - for (i = 0; i < elf_elfheader (abfd)->e_phnum; i++, phdr++) - { - if (phdr->p_type == PT_LOAD - && phdr->p_paddr != 0 - && phdr->p_vaddr != phdr->p_paddr - && phdr->p_vaddr <= hdr->sh_addr - && phdr->p_vaddr + phdr->p_memsz >= hdr->sh_addr + hdr->sh_size) - { - newsect->lma += phdr->p_paddr - phdr->p_vaddr; - break; - } - } - } - - hdr->bfd_section = newsect; - elf_section_data (newsect)->this_hdr = *hdr; - - return true; -} - -/* -INTERNAL_FUNCTION - bfd_elf_find_section - -SYNOPSIS - struct elf_internal_shdr *bfd_elf_find_section (bfd *abfd, char *name); - -DESCRIPTION - Helper functions for GDB to locate the string tables. - Since BFD hides string tables from callers, GDB needs to use an - internal hook to find them. Sun's .stabstr, in particular, - isn't even pointed to by the .stab section, so ordinary - mechanisms wouldn't work to find it, even if we had some. -*/ - -struct elf_internal_shdr * -bfd_elf_find_section (abfd, name) - bfd * abfd; - char *name; -{ - Elf_Internal_Shdr **i_shdrp; - char *shstrtab; - unsigned int max; - unsigned int i; - - i_shdrp = elf_elfsections (abfd); - if (i_shdrp != NULL) - { - shstrtab = bfd_elf_get_str_section (abfd, elf_elfheader (abfd)->e_shstrndx); - if (shstrtab != NULL) - { - max = elf_elfheader (abfd)->e_shnum; - for (i = 1; i < max; i++) - if (!strcmp (&shstrtab[i_shdrp[i]->sh_name], name)) - return i_shdrp[i]; - } - } - return 0; -} - -const char *const bfd_elf_section_type_names[] = { - "SHT_NULL", "SHT_PROGBITS", "SHT_SYMTAB", "SHT_STRTAB", - "SHT_RELA", "SHT_HASH", "SHT_DYNAMIC", "SHT_NOTE", - "SHT_NOBITS", "SHT_REL", "SHT_SHLIB", "SHT_DYNSYM", -}; - -/* 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. */ - -/*ARGSUSED*/ -bfd_reloc_status_type -bfd_elf_generic_reloc (abfd, - reloc_entry, - symbol, - data, - input_section, - output_bfd, - error_message) - bfd *abfd; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message; -{ - if (output_bfd != (bfd *) NULL - && (symbol->flags & BSF_SECTION_SYM) == 0 - && (! reloc_entry->howto->partial_inplace - || reloc_entry->addend == 0)) - { - reloc_entry->address += input_section->output_offset; - return bfd_reloc_ok; - } - - return bfd_reloc_continue; -} - -/* Print out the program headers. */ - -boolean -_bfd_elf_print_private_bfd_data (abfd, farg) - bfd *abfd; - PTR farg; -{ - FILE *f = (FILE *) farg; - Elf_Internal_Phdr *p; - asection *s; - bfd_byte *dynbuf = NULL; - - p = elf_tdata (abfd)->phdr; - if (p != NULL) - { - unsigned int i, c; - - fprintf (f, "\nProgram Header:\n"); - c = elf_elfheader (abfd)->e_phnum; - for (i = 0; i < c; i++, p++) - { - const char *s; - char buf[20]; - - switch (p->p_type) - { - case PT_NULL: s = "NULL"; break; - case PT_LOAD: s = "LOAD"; break; - case PT_DYNAMIC: s = "DYNAMIC"; break; - case PT_INTERP: s = "INTERP"; break; - case PT_NOTE: s = "NOTE"; break; - case PT_SHLIB: s = "SHLIB"; break; - case PT_PHDR: s = "PHDR"; break; - default: sprintf (buf, "0x%lx", p->p_type); s = buf; break; - } - fprintf (f, "%8s off 0x", s); - fprintf_vma (f, p->p_offset); - fprintf (f, " vaddr 0x"); - fprintf_vma (f, p->p_vaddr); - fprintf (f, " paddr 0x"); - fprintf_vma (f, p->p_paddr); - fprintf (f, " align 2**%u\n", bfd_log2 (p->p_align)); - fprintf (f, " filesz 0x"); - fprintf_vma (f, p->p_filesz); - fprintf (f, " memsz 0x"); - fprintf_vma (f, p->p_memsz); - fprintf (f, " flags %c%c%c", - (p->p_flags & PF_R) != 0 ? 'r' : '-', - (p->p_flags & PF_W) != 0 ? 'w' : '-', - (p->p_flags & PF_X) != 0 ? 'x' : '-'); - if ((p->p_flags &~ (PF_R | PF_W | PF_X)) != 0) - fprintf (f, " %lx", p->p_flags &~ (PF_R | PF_W | PF_X)); - fprintf (f, "\n"); - } - } - - s = bfd_get_section_by_name (abfd, ".dynamic"); - if (s != NULL) - { - int elfsec; - unsigned long link; - bfd_byte *extdyn, *extdynend; - size_t extdynsize; - void (*swap_dyn_in) PARAMS ((bfd *, const PTR, Elf_Internal_Dyn *)); - - fprintf (f, "\nDynamic Section:\n"); - - dynbuf = (bfd_byte *) bfd_malloc (s->_raw_size); - if (dynbuf == NULL) - goto error_return; - if (! bfd_get_section_contents (abfd, s, (PTR) dynbuf, (file_ptr) 0, - s->_raw_size)) - goto error_return; - - elfsec = _bfd_elf_section_from_bfd_section (abfd, s); - if (elfsec == -1) - goto error_return; - link = elf_elfsections (abfd)[elfsec]->sh_link; - - extdynsize = get_elf_backend_data (abfd)->s->sizeof_dyn; - swap_dyn_in = get_elf_backend_data (abfd)->s->swap_dyn_in; - - extdyn = dynbuf; - extdynend = extdyn + s->_raw_size; - for (; extdyn < extdynend; extdyn += extdynsize) - { - Elf_Internal_Dyn dyn; - const char *name; - char ab[20]; - boolean stringp; - - (*swap_dyn_in) (abfd, (PTR) extdyn, &dyn); - - if (dyn.d_tag == DT_NULL) - break; - - stringp = false; - switch (dyn.d_tag) - { - default: - sprintf (ab, "0x%lx", (unsigned long) dyn.d_tag); - name = ab; - break; - - case DT_NEEDED: name = "NEEDED"; stringp = true; break; - case DT_PLTRELSZ: name = "PLTRELSZ"; break; - case DT_PLTGOT: name = "PLTGOT"; break; - case DT_HASH: name = "HASH"; break; - case DT_STRTAB: name = "STRTAB"; break; - case DT_SYMTAB: name = "SYMTAB"; break; - case DT_RELA: name = "RELA"; break; - case DT_RELASZ: name = "RELASZ"; break; - case DT_RELAENT: name = "RELAENT"; break; - case DT_STRSZ: name = "STRSZ"; break; - case DT_SYMENT: name = "SYMENT"; break; - case DT_INIT: name = "INIT"; break; - case DT_FINI: name = "FINI"; break; - case DT_SONAME: name = "SONAME"; stringp = true; break; - case DT_RPATH: name = "RPATH"; stringp = true; break; - case DT_SYMBOLIC: name = "SYMBOLIC"; break; - case DT_REL: name = "REL"; break; - case DT_RELSZ: name = "RELSZ"; break; - case DT_RELENT: name = "RELENT"; break; - case DT_PLTREL: name = "PLTREL"; break; - case DT_DEBUG: name = "DEBUG"; break; - case DT_TEXTREL: name = "TEXTREL"; break; - case DT_JMPREL: name = "JMPREL"; break; - } - - fprintf (f, " %-11s ", name); - if (! stringp) - fprintf (f, "0x%lx", (unsigned long) dyn.d_un.d_val); - else - { - const char *string; - - string = bfd_elf_string_from_elf_section (abfd, link, - dyn.d_un.d_val); - if (string == NULL) - goto error_return; - fprintf (f, "%s", string); - } - fprintf (f, "\n"); - } - - free (dynbuf); - dynbuf = NULL; - } - - return true; - - error_return: - if (dynbuf != NULL) - free (dynbuf); - return false; -} - -/* Display ELF-specific fields of a symbol. */ -void -bfd_elf_print_symbol (ignore_abfd, filep, symbol, how) - bfd *ignore_abfd; - PTR filep; - asymbol *symbol; - bfd_print_symbol_type how; -{ - FILE *file = (FILE *) filep; - switch (how) - { - case bfd_print_symbol_name: - fprintf (file, "%s", symbol->name); - break; - case bfd_print_symbol_more: - fprintf (file, "elf "); - fprintf_vma (file, symbol->value); - fprintf (file, " %lx", (long) symbol->flags); - break; - case bfd_print_symbol_all: - { - CONST char *section_name; - section_name = symbol->section ? symbol->section->name : "(*none*)"; - bfd_print_symbol_vandf ((PTR) file, symbol); - fprintf (file, " %s\t", section_name); - /* Print the "other" value for a symbol. For common symbols, - we've already printed the size; now print the alignment. - For other symbols, we have no specified alignment, and - we've printed the address; now print the size. */ - fprintf_vma (file, - (bfd_is_com_section (symbol->section) - ? ((elf_symbol_type *) symbol)->internal_elf_sym.st_value - : ((elf_symbol_type *) symbol)->internal_elf_sym.st_size)); - fprintf (file, " %s", symbol->name); - } - break; - } -} - -/* Create an entry in an ELF linker hash table. */ - -struct bfd_hash_entry * -_bfd_elf_link_hash_newfunc (entry, table, string) - struct bfd_hash_entry *entry; - struct bfd_hash_table *table; - const char *string; -{ - struct elf_link_hash_entry *ret = (struct elf_link_hash_entry *) entry; - - /* Allocate the structure if it has not already been allocated by a - subclass. */ - if (ret == (struct elf_link_hash_entry *) NULL) - ret = ((struct elf_link_hash_entry *) - bfd_hash_allocate (table, sizeof (struct elf_link_hash_entry))); - if (ret == (struct elf_link_hash_entry *) NULL) - return (struct bfd_hash_entry *) ret; - - /* Call the allocation method of the superclass. */ - ret = ((struct elf_link_hash_entry *) - _bfd_link_hash_newfunc ((struct bfd_hash_entry *) ret, - table, string)); - if (ret != (struct elf_link_hash_entry *) NULL) - { - /* Set local fields. */ - ret->indx = -1; - ret->size = 0; - ret->dynindx = -1; - ret->dynstr_index = 0; - ret->weakdef = NULL; - ret->got_offset = (bfd_vma) -1; - ret->plt_offset = (bfd_vma) -1; - ret->linker_section_pointer = (elf_linker_section_pointers_t *)0; - ret->type = STT_NOTYPE; - /* Assume that we have been called by a non-ELF symbol reader. - This flag is then reset by the code which reads an ELF input - file. This ensures that a symbol created by a non-ELF symbol - reader will have the flag set correctly. */ - ret->elf_link_hash_flags = ELF_LINK_NON_ELF; - } - - return (struct bfd_hash_entry *) ret; -} - -/* Initialize an ELF linker hash table. */ - -boolean -_bfd_elf_link_hash_table_init (table, abfd, newfunc) - struct elf_link_hash_table *table; - bfd *abfd; - struct bfd_hash_entry *(*newfunc) PARAMS ((struct bfd_hash_entry *, - struct bfd_hash_table *, - const char *)); -{ - table->dynamic_sections_created = false; - table->dynobj = NULL; - /* The first dynamic symbol is a dummy. */ - table->dynsymcount = 1; - table->dynstr = NULL; - table->bucketcount = 0; - table->needed = NULL; - return _bfd_link_hash_table_init (&table->root, abfd, newfunc); -} - -/* Create an ELF linker hash table. */ - -struct bfd_link_hash_table * -_bfd_elf_link_hash_table_create (abfd) - bfd *abfd; -{ - struct elf_link_hash_table *ret; - - ret = ((struct elf_link_hash_table *) - bfd_alloc (abfd, sizeof (struct elf_link_hash_table))); - if (ret == (struct elf_link_hash_table *) NULL) - return NULL; - - if (! _bfd_elf_link_hash_table_init (ret, abfd, _bfd_elf_link_hash_newfunc)) - { - bfd_release (abfd, ret); - return NULL; - } - - return &ret->root; -} - -/* This is a hook for the ELF emulation code in the generic linker to - tell the backend linker what file name to use for the DT_NEEDED - entry for a dynamic object. The generic linker passes name as an - empty string to indicate that no DT_NEEDED entry should be made. */ - -void -bfd_elf_set_dt_needed_name (abfd, name) - bfd *abfd; - const char *name; -{ - if (bfd_get_flavour (abfd) == bfd_target_elf_flavour - && bfd_get_format (abfd) == bfd_object) - elf_dt_name (abfd) = name; -} - -/* Get the list of DT_NEEDED entries for a link. This is a hook for - the ELF emulation code. */ - -struct bfd_link_needed_list * -bfd_elf_get_needed_list (abfd, info) - bfd *abfd; - struct bfd_link_info *info; -{ - if (info->hash->creator->flavour != bfd_target_elf_flavour) - return NULL; - return elf_hash_table (info)->needed; -} - -/* Get the name actually used for a dynamic object for a link. This - is the SONAME entry if there is one. Otherwise, it is the string - passed to bfd_elf_set_dt_needed_name, or it is the filename. */ - -const char * -bfd_elf_get_dt_soname (abfd) - bfd *abfd; -{ - if (bfd_get_flavour (abfd) == bfd_target_elf_flavour - && bfd_get_format (abfd) == bfd_object) - return elf_dt_name (abfd); - return NULL; -} - -/* Allocate an ELF string table--force the first byte to be zero. */ - -struct bfd_strtab_hash * -_bfd_elf_stringtab_init () -{ - struct bfd_strtab_hash *ret; - - ret = _bfd_stringtab_init (); - if (ret != NULL) - { - bfd_size_type loc; - - loc = _bfd_stringtab_add (ret, "", true, false); - BFD_ASSERT (loc == 0 || loc == (bfd_size_type) -1); - if (loc == (bfd_size_type) -1) - { - _bfd_stringtab_free (ret); - ret = NULL; - } - } - return ret; -} - -/* ELF .o/exec file reading */ - -/* Create a new bfd section from an ELF section header. */ - -boolean -bfd_section_from_shdr (abfd, shindex) - bfd *abfd; - unsigned int 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; - - name = elf_string_from_elf_strtab (abfd, hdr->sh_name); - - switch (hdr->sh_type) - { - case SHT_NULL: - /* Inactive section. Throw it away. */ - return true; - - case SHT_PROGBITS: /* Normal section with contents. */ - case SHT_DYNAMIC: /* Dynamic linking information. */ - case SHT_NOBITS: /* .bss section. */ - case SHT_HASH: /* .hash section. */ - case SHT_NOTE: /* .note section. */ - return _bfd_elf_make_section_from_shdr (abfd, hdr, name); - - case SHT_SYMTAB: /* A symbol table */ - if (elf_onesymtab (abfd) == shindex) - return true; - - BFD_ASSERT (hdr->sh_entsize == bed->s->sizeof_sym); - BFD_ASSERT (elf_onesymtab (abfd) == 0); - elf_onesymtab (abfd) = shindex; - elf_tdata (abfd)->symtab_hdr = *hdr; - elf_elfsections (abfd)[shindex] = hdr = &elf_tdata (abfd)->symtab_hdr; - abfd->flags |= HAS_SYMS; - - /* Sometimes a shared object will map in the symbol table. If - SHF_ALLOC is set, and this is a shared object, then we also - treat this section as a BFD section. We can not base the - decision purely on SHF_ALLOC, because that flag is sometimes - set in a relocateable object file, which would confuse the - linker. */ - if ((hdr->sh_flags & SHF_ALLOC) != 0 - && (abfd->flags & DYNAMIC) != 0 - && ! _bfd_elf_make_section_from_shdr (abfd, hdr, name)) - return false; - - return true; - - case SHT_DYNSYM: /* A dynamic symbol table */ - if (elf_dynsymtab (abfd) == shindex) - return true; - - BFD_ASSERT (hdr->sh_entsize == bed->s->sizeof_sym); - BFD_ASSERT (elf_dynsymtab (abfd) == 0); - elf_dynsymtab (abfd) = shindex; - elf_tdata (abfd)->dynsymtab_hdr = *hdr; - elf_elfsections (abfd)[shindex] = hdr = &elf_tdata (abfd)->dynsymtab_hdr; - abfd->flags |= HAS_SYMS; - - /* Besides being a symbol table, we also treat this as a regular - section, so that objcopy can handle it. */ - return _bfd_elf_make_section_from_shdr (abfd, hdr, name); - - case SHT_STRTAB: /* A string table */ - if (hdr->bfd_section != NULL) - return true; - if (ehdr->e_shstrndx == shindex) - { - elf_tdata (abfd)->shstrtab_hdr = *hdr; - elf_elfsections (abfd)[shindex] = &elf_tdata (abfd)->shstrtab_hdr; - return true; - } - { - unsigned int i; - - for (i = 1; i < ehdr->e_shnum; i++) - { - Elf_Internal_Shdr *hdr2 = elf_elfsections (abfd)[i]; - if (hdr2->sh_link == shindex) - { - if (! bfd_section_from_shdr (abfd, i)) - return false; - if (elf_onesymtab (abfd) == i) - { - elf_tdata (abfd)->strtab_hdr = *hdr; - elf_elfsections (abfd)[shindex] = - &elf_tdata (abfd)->strtab_hdr; - return true; - } - if (elf_dynsymtab (abfd) == i) - { - elf_tdata (abfd)->dynstrtab_hdr = *hdr; - elf_elfsections (abfd)[shindex] = hdr = - &elf_tdata (abfd)->dynstrtab_hdr; - /* We also treat this as a regular section, so - that objcopy can handle it. */ - break; - } -#if 0 /* Not handling other string tables specially right now. */ - hdr2 = elf_elfsections (abfd)[i]; /* in case it moved */ - /* We have a strtab for some random other section. */ - newsect = (asection *) hdr2->bfd_section; - if (!newsect) - break; - hdr->bfd_section = newsect; - hdr2 = &elf_section_data (newsect)->str_hdr; - *hdr2 = *hdr; - elf_elfsections (abfd)[shindex] = hdr2; -#endif - } - } - } - - return _bfd_elf_make_section_from_shdr (abfd, hdr, name); - - case SHT_REL: - case SHT_RELA: - /* *These* do a lot of work -- but build no sections! */ - { - asection *target_sect; - Elf_Internal_Shdr *hdr2; - int use_rela_p = get_elf_backend_data (abfd)->use_rela_p; - - /* For some incomprehensible reason Oracle distributes - libraries for Solaris in which some of the objects have - bogus sh_link fields. It would be nice if we could just - reject them, but, unfortunately, some people need to use - them. We scan through the section headers; if we find only - one suitable symbol table, we clobber the sh_link to point - to it. I hope this doesn't break anything. */ - if (elf_elfsections (abfd)[hdr->sh_link]->sh_type != SHT_SYMTAB - && elf_elfsections (abfd)[hdr->sh_link]->sh_type != SHT_DYNSYM) - { - int scan; - int found; - - found = 0; - for (scan = 1; scan < ehdr->e_shnum; scan++) - { - if (elf_elfsections (abfd)[scan]->sh_type == SHT_SYMTAB - || elf_elfsections (abfd)[scan]->sh_type == SHT_DYNSYM) - { - if (found != 0) - { - found = 0; - break; - } - found = scan; - } - } - if (found != 0) - hdr->sh_link = found; - } - - /* Get the symbol table. */ - if (elf_elfsections (abfd)[hdr->sh_link]->sh_type == SHT_SYMTAB - && ! bfd_section_from_shdr (abfd, hdr->sh_link)) - return false; - - /* If this reloc section does not use the main symbol table we - don't treat it as a reloc section. BFD can't adequately - represent such a section, so at least for now, we don't - try. We just present it as a normal section. */ - if (hdr->sh_link != elf_onesymtab (abfd)) - return _bfd_elf_make_section_from_shdr (abfd, hdr, name); - - /* Don't allow REL relocations on a machine that uses RELA and - vice versa. */ - /* @@ Actually, the generic ABI does suggest that both might be - used in one file. But the four ABI Processor Supplements I - have access to right now all specify that only one is used on - each of those architectures. It's conceivable that, e.g., a - bunch of absolute 32-bit relocs might be more compact in REL - form even on a RELA machine... */ - BFD_ASSERT (use_rela_p - ? (hdr->sh_type == SHT_RELA - && hdr->sh_entsize == bed->s->sizeof_rela) - : (hdr->sh_type == SHT_REL - && hdr->sh_entsize == bed->s->sizeof_rel)); - - if (! bfd_section_from_shdr (abfd, hdr->sh_info)) - return false; - target_sect = bfd_section_from_elf_index (abfd, hdr->sh_info); - if (target_sect == NULL) - return false; - - hdr2 = &elf_section_data (target_sect)->rel_hdr; - *hdr2 = *hdr; - elf_elfsections (abfd)[shindex] = hdr2; - target_sect->reloc_count = hdr->sh_size / hdr->sh_entsize; - target_sect->flags |= SEC_RELOC; - target_sect->relocation = NULL; - target_sect->rel_filepos = hdr->sh_offset; - abfd->flags |= HAS_RELOC; - return true; - } - break; - - case SHT_SHLIB: - return true; - - default: - /* Check for any processor-specific section types. */ - { - if (bed->elf_backend_section_from_shdr) - (*bed->elf_backend_section_from_shdr) (abfd, hdr, name); - } - break; - } - - return true; -} - -/* Given an ELF section number, retrieve the corresponding BFD - section. */ - -asection * -bfd_section_from_elf_index (abfd, index) - bfd *abfd; - unsigned int index; -{ - BFD_ASSERT (index > 0 && index < SHN_LORESERVE); - if (index >= elf_elfheader (abfd)->e_shnum) - return NULL; - return elf_elfsections (abfd)[index]->bfd_section; -} - -boolean -_bfd_elf_new_section_hook (abfd, sec) - bfd *abfd; - asection *sec; -{ - struct bfd_elf_section_data *sdata; - - sdata = (struct bfd_elf_section_data *) bfd_alloc (abfd, sizeof (*sdata)); - if (!sdata) - return false; - sec->used_by_bfd = (PTR) sdata; - memset (sdata, 0, sizeof (*sdata)); - return true; -} - -/* Create a new bfd section from an ELF program header. - - Since program segments have no names, we generate a synthetic name - of the form segment, where NUM is generally the index in the - program header table. For segments that are split (see below) we - generate the names segmenta and segmentb. - - Note that some program segments may have a file size that is different than - (less than) the memory size. All this means is that at execution the - system must allocate the amount of memory specified by the memory size, - but only initialize it with the first "file size" bytes read from the - file. This would occur for example, with program segments consisting - of combined data+bss. - - To handle the above situation, this routine generates TWO bfd sections - for the single program segment. The first has the length specified by - the file size of the segment, and the second has the length specified - by the difference between the two sizes. In effect, the segment is split - into it's initialized and uninitialized parts. - - */ - -boolean -bfd_section_from_phdr (abfd, hdr, index) - bfd *abfd; - Elf_Internal_Phdr *hdr; - int index; -{ - asection *newsect; - char *name; - char namebuf[64]; - int split; - - split = ((hdr->p_memsz > 0) && - (hdr->p_filesz > 0) && - (hdr->p_memsz > hdr->p_filesz)); - sprintf (namebuf, split ? "segment%da" : "segment%d", index); - name = bfd_alloc (abfd, strlen (namebuf) + 1); - if (!name) - return false; - strcpy (name, namebuf); - newsect = bfd_make_section (abfd, name); - if (newsect == NULL) - return false; - newsect->vma = hdr->p_vaddr; - newsect->lma = hdr->p_paddr; - newsect->_raw_size = hdr->p_filesz; - newsect->filepos = hdr->p_offset; - newsect->flags |= SEC_HAS_CONTENTS; - if (hdr->p_type == PT_LOAD) - { - newsect->flags |= SEC_ALLOC; - newsect->flags |= SEC_LOAD; - if (hdr->p_flags & PF_X) - { - /* FIXME: all we known is that it has execute PERMISSION, - may be data. */ - newsect->flags |= SEC_CODE; - } - } - if (!(hdr->p_flags & PF_W)) - { - newsect->flags |= SEC_READONLY; - } - - if (split) - { - sprintf (namebuf, "segment%db", index); - name = bfd_alloc (abfd, strlen (namebuf) + 1); - if (!name) - return false; - strcpy (name, namebuf); - newsect = bfd_make_section (abfd, name); - if (newsect == NULL) - return false; - newsect->vma = hdr->p_vaddr + hdr->p_filesz; - newsect->lma = hdr->p_paddr + hdr->p_filesz; - newsect->_raw_size = hdr->p_memsz - hdr->p_filesz; - if (hdr->p_type == PT_LOAD) - { - newsect->flags |= SEC_ALLOC; - if (hdr->p_flags & PF_X) - newsect->flags |= SEC_CODE; - } - if (!(hdr->p_flags & PF_W)) - newsect->flags |= SEC_READONLY; - } - - return true; -} - -/* Set up an ELF internal section header for a section. */ - -/*ARGSUSED*/ -static void -elf_fake_sections (abfd, asect, failedptrarg) - bfd *abfd; - asection *asect; - PTR failedptrarg; -{ - struct elf_backend_data *bed = get_elf_backend_data (abfd); - boolean *failedptr = (boolean *) failedptrarg; - Elf_Internal_Shdr *this_hdr; - - if (*failedptr) - { - /* We already failed; just get out of the bfd_map_over_sections - loop. */ - return; - } - - this_hdr = &elf_section_data (asect)->this_hdr; - - this_hdr->sh_name = (unsigned long) _bfd_stringtab_add (elf_shstrtab (abfd), - asect->name, - true, false); - if (this_hdr->sh_name == (unsigned long) -1) - { - *failedptr = true; - return; - } - - this_hdr->sh_flags = 0; - - if ((asect->flags & SEC_ALLOC) != 0) - this_hdr->sh_addr = asect->vma; - else - this_hdr->sh_addr = 0; - - this_hdr->sh_offset = 0; - this_hdr->sh_size = asect->_raw_size; - this_hdr->sh_link = 0; - this_hdr->sh_addralign = 1 << asect->alignment_power; - /* The sh_entsize and sh_info fields may have been set already by - copy_private_section_data. */ - - this_hdr->bfd_section = asect; - this_hdr->contents = NULL; - - /* FIXME: This should not be based on section names. */ - if (strcmp (asect->name, ".dynstr") == 0) - this_hdr->sh_type = SHT_STRTAB; - else if (strcmp (asect->name, ".hash") == 0) - { - this_hdr->sh_type = SHT_HASH; - this_hdr->sh_entsize = bed->s->arch_size / 8; - } - else if (strcmp (asect->name, ".dynsym") == 0) - { - this_hdr->sh_type = SHT_DYNSYM; - this_hdr->sh_entsize = bed->s->sizeof_sym; - } - else if (strcmp (asect->name, ".dynamic") == 0) - { - this_hdr->sh_type = SHT_DYNAMIC; - this_hdr->sh_entsize = bed->s->sizeof_dyn; - } - else if (strncmp (asect->name, ".rela", 5) == 0 - && get_elf_backend_data (abfd)->use_rela_p) - { - this_hdr->sh_type = SHT_RELA; - this_hdr->sh_entsize = bed->s->sizeof_rela; - } - else if (strncmp (asect->name, ".rel", 4) == 0 - && ! get_elf_backend_data (abfd)->use_rela_p) - { - this_hdr->sh_type = SHT_REL; - this_hdr->sh_entsize = bed->s->sizeof_rel; - } - else if (strcmp (asect->name, ".note") == 0) - this_hdr->sh_type = SHT_NOTE; - else if (strncmp (asect->name, ".stab", 5) == 0 - && strcmp (asect->name + strlen (asect->name) - 3, "str") == 0) - this_hdr->sh_type = SHT_STRTAB; - else if ((asect->flags & SEC_ALLOC) != 0 - && (asect->flags & SEC_LOAD) != 0) - this_hdr->sh_type = SHT_PROGBITS; - else if ((asect->flags & SEC_ALLOC) != 0 - && ((asect->flags & SEC_LOAD) == 0)) - this_hdr->sh_type = SHT_NOBITS; - else - { - /* Who knows? */ - this_hdr->sh_type = SHT_PROGBITS; - } - - if ((asect->flags & SEC_ALLOC) != 0) - this_hdr->sh_flags |= SHF_ALLOC; - if ((asect->flags & SEC_READONLY) == 0) - this_hdr->sh_flags |= SHF_WRITE; - if ((asect->flags & SEC_CODE) != 0) - this_hdr->sh_flags |= SHF_EXECINSTR; - - /* Check for processor-specific section types. */ - { - struct elf_backend_data *bed = get_elf_backend_data (abfd); - - if (bed->elf_backend_fake_sections) - (*bed->elf_backend_fake_sections) (abfd, this_hdr, asect); - } - - /* If the section has relocs, set up a section header for the - SHT_REL[A] section. */ - if ((asect->flags & SEC_RELOC) != 0) - { - Elf_Internal_Shdr *rela_hdr; - int use_rela_p = get_elf_backend_data (abfd)->use_rela_p; - char *name; - - rela_hdr = &elf_section_data (asect)->rel_hdr; - name = bfd_alloc (abfd, sizeof ".rela" + strlen (asect->name)); - if (name == NULL) - { - *failedptr = true; - return; - } - sprintf (name, "%s%s", use_rela_p ? ".rela" : ".rel", asect->name); - rela_hdr->sh_name = - (unsigned int) _bfd_stringtab_add (elf_shstrtab (abfd), name, - true, false); - if (rela_hdr->sh_name == (unsigned int) -1) - { - *failedptr = true; - return; - } - rela_hdr->sh_type = use_rela_p ? SHT_RELA : SHT_REL; - rela_hdr->sh_entsize = (use_rela_p - ? bed->s->sizeof_rela - : bed->s->sizeof_rel); - rela_hdr->sh_addralign = bed->s->file_align; - rela_hdr->sh_flags = 0; - rela_hdr->sh_addr = 0; - rela_hdr->sh_size = 0; - rela_hdr->sh_offset = 0; - } -} - -/* Assign all ELF section numbers. The dummy first section is handled here - too. The link/info pointers for the standard section types are filled - in here too, while we're at it. */ - -static boolean -assign_section_numbers (abfd) - bfd *abfd; -{ - struct elf_obj_tdata *t = elf_tdata (abfd); - asection *sec; - unsigned int section_number; - Elf_Internal_Shdr **i_shdrp; - struct elf_backend_data *bed = get_elf_backend_data (abfd); - - section_number = 1; - - for (sec = abfd->sections; sec; sec = sec->next) - { - struct bfd_elf_section_data *d = elf_section_data (sec); - - d->this_idx = section_number++; - if ((sec->flags & SEC_RELOC) == 0) - d->rel_idx = 0; - else - d->rel_idx = section_number++; - } - - t->shstrtab_section = section_number++; - elf_elfheader (abfd)->e_shstrndx = t->shstrtab_section; - t->shstrtab_hdr.sh_size = _bfd_stringtab_size (elf_shstrtab (abfd)); - - if (abfd->symcount > 0) - { - t->symtab_section = section_number++; - t->strtab_section = section_number++; - } - - elf_elfheader (abfd)->e_shnum = section_number; - - /* Set up the list of section header pointers, in agreement with the - indices. */ - i_shdrp = ((Elf_Internal_Shdr **) - bfd_alloc (abfd, section_number * sizeof (Elf_Internal_Shdr *))); - if (i_shdrp == NULL) - return false; - - i_shdrp[0] = ((Elf_Internal_Shdr *) - bfd_alloc (abfd, sizeof (Elf_Internal_Shdr))); - if (i_shdrp[0] == NULL) - { - bfd_release (abfd, i_shdrp); - return false; - } - memset (i_shdrp[0], 0, sizeof (Elf_Internal_Shdr)); - - elf_elfsections (abfd) = i_shdrp; - - i_shdrp[t->shstrtab_section] = &t->shstrtab_hdr; - if (abfd->symcount > 0) - { - i_shdrp[t->symtab_section] = &t->symtab_hdr; - i_shdrp[t->strtab_section] = &t->strtab_hdr; - t->symtab_hdr.sh_link = t->strtab_section; - } - for (sec = abfd->sections; sec; sec = sec->next) - { - struct bfd_elf_section_data *d = elf_section_data (sec); - asection *s; - const char *name; - - i_shdrp[d->this_idx] = &d->this_hdr; - if (d->rel_idx != 0) - i_shdrp[d->rel_idx] = &d->rel_hdr; - - /* Fill in the sh_link and sh_info fields while we're at it. */ - - /* sh_link of a reloc section is the section index of the symbol - table. sh_info is the section index of the section to which - the relocation entries apply. */ - if (d->rel_idx != 0) - { - d->rel_hdr.sh_link = t->symtab_section; - d->rel_hdr.sh_info = d->this_idx; - } - - switch (d->this_hdr.sh_type) - { - case SHT_REL: - case SHT_RELA: - /* A reloc section which we are treating as a normal BFD - section. sh_link is the section index of the symbol - table. sh_info is the section index of the section to - which the relocation entries apply. We assume that an - allocated reloc section uses the dynamic symbol table. - FIXME: How can we be sure? */ - s = bfd_get_section_by_name (abfd, ".dynsym"); - if (s != NULL) - d->this_hdr.sh_link = elf_section_data (s)->this_idx; - - /* We look up the section the relocs apply to by name. */ - name = sec->name; - if (d->this_hdr.sh_type == SHT_REL) - name += 4; - else - name += 5; - s = bfd_get_section_by_name (abfd, name); - if (s != NULL) - d->this_hdr.sh_info = elf_section_data (s)->this_idx; - break; - - case SHT_STRTAB: - /* We assume that a section named .stab*str is a stabs - string section. We look for a section with the same name - but without the trailing ``str'', and set its sh_link - field to point to this section. */ - if (strncmp (sec->name, ".stab", sizeof ".stab" - 1) == 0 - && strcmp (sec->name + strlen (sec->name) - 3, "str") == 0) - { - size_t len; - char *alc; - - len = strlen (sec->name); - alc = (char *) bfd_malloc (len - 2); - if (alc == NULL) - return false; - strncpy (alc, sec->name, len - 3); - alc[len - 3] = '\0'; - s = bfd_get_section_by_name (abfd, alc); - free (alc); - if (s != NULL) - { - elf_section_data (s)->this_hdr.sh_link = d->this_idx; - - /* This is a .stab section. */ - elf_section_data (s)->this_hdr.sh_entsize = - 4 + 2 * (bed->s->arch_size / 8); - } - } - break; - - case SHT_DYNAMIC: - case SHT_DYNSYM: - /* sh_link is the section header index of the string table - used for the dynamic entries or symbol table. */ - s = bfd_get_section_by_name (abfd, ".dynstr"); - if (s != NULL) - d->this_hdr.sh_link = elf_section_data (s)->this_idx; - break; - - case SHT_HASH: - /* sh_link is the section header index of the symbol table - this hash table is for. */ - s = bfd_get_section_by_name (abfd, ".dynsym"); - if (s != NULL) - d->this_hdr.sh_link = elf_section_data (s)->this_idx; - break; - } - } - - return true; -} - -/* Map symbol from it's internal number to the external number, moving - all local symbols to be at the head of the list. */ - -static INLINE int -sym_is_global (abfd, sym) - bfd *abfd; - asymbol *sym; -{ - /* If the backend has a special mapping, use it. */ - if (get_elf_backend_data (abfd)->elf_backend_sym_is_global) - return ((*get_elf_backend_data (abfd)->elf_backend_sym_is_global) - (abfd, sym)); - - return ((sym->flags & (BSF_GLOBAL | BSF_WEAK)) != 0 - || bfd_is_und_section (bfd_get_section (sym)) - || bfd_is_com_section (bfd_get_section (sym))); -} - -static boolean -elf_map_symbols (abfd) - bfd *abfd; -{ - int symcount = bfd_get_symcount (abfd); - asymbol **syms = bfd_get_outsymbols (abfd); - asymbol **sect_syms; - int num_locals = 0; - int num_globals = 0; - int num_locals2 = 0; - int num_globals2 = 0; - int max_index = 0; - int num_sections = 0; - int idx; - asection *asect; - asymbol **new_syms; - -#ifdef DEBUG - fprintf (stderr, "elf_map_symbols\n"); - fflush (stderr); -#endif - - /* Add a section symbol for each BFD section. FIXME: Is this really - necessary? */ - for (asect = abfd->sections; asect; asect = asect->next) - { - if (max_index < asect->index) - max_index = asect->index; - } - - max_index++; - sect_syms = (asymbol **) bfd_zalloc (abfd, max_index * sizeof (asymbol *)); - if (sect_syms == NULL) - return false; - elf_section_syms (abfd) = sect_syms; - - for (idx = 0; idx < symcount; idx++) - { - if ((syms[idx]->flags & BSF_SECTION_SYM) != 0 - && (syms[idx]->value + syms[idx]->section->vma) == 0) - { - asection *sec; - - sec = syms[idx]->section; - if (sec->owner != NULL) - { - if (sec->owner != abfd) - { - if (sec->output_offset != 0) - continue; - sec = sec->output_section; - BFD_ASSERT (sec->owner == abfd); - } - sect_syms[sec->index] = syms[idx]; - } - } - } - - for (asect = abfd->sections; asect; asect = asect->next) - { - asymbol *sym; - - if (sect_syms[asect->index] != NULL) - continue; - - sym = bfd_make_empty_symbol (abfd); - if (sym == NULL) - return false; - sym->the_bfd = abfd; - sym->name = asect->name; - sym->value = 0; - /* Set the flags to 0 to indicate that this one was newly added. */ - sym->flags = 0; - sym->section = asect; - sect_syms[asect->index] = sym; - num_sections++; -#ifdef DEBUG - fprintf (stderr, - "creating section symbol, name = %s, value = 0x%.8lx, index = %d, section = 0x%.8lx\n", - asect->name, (long) asect->vma, asect->index, (long) asect); -#endif - } - - /* Classify all of the symbols. */ - for (idx = 0; idx < symcount; idx++) - { - if (!sym_is_global (abfd, syms[idx])) - num_locals++; - else - num_globals++; - } - for (asect = abfd->sections; asect; asect = asect->next) - { - if (sect_syms[asect->index] != NULL - && sect_syms[asect->index]->flags == 0) - { - sect_syms[asect->index]->flags = BSF_SECTION_SYM; - if (!sym_is_global (abfd, sect_syms[asect->index])) - num_locals++; - else - num_globals++; - sect_syms[asect->index]->flags = 0; - } - } - - /* Now sort the symbols so the local symbols are first. */ - new_syms = ((asymbol **) - bfd_alloc (abfd, - (num_locals + num_globals) * sizeof (asymbol *))); - if (new_syms == NULL) - return false; - - for (idx = 0; idx < symcount; idx++) - { - asymbol *sym = syms[idx]; - int i; - - if (!sym_is_global (abfd, sym)) - i = num_locals2++; - else - i = num_locals + num_globals2++; - new_syms[i] = sym; - sym->udata.i = i + 1; - } - for (asect = abfd->sections; asect; asect = asect->next) - { - if (sect_syms[asect->index] != NULL - && sect_syms[asect->index]->flags == 0) - { - asymbol *sym = sect_syms[asect->index]; - int i; - - sym->flags = BSF_SECTION_SYM; - if (!sym_is_global (abfd, sym)) - i = num_locals2++; - else - i = num_locals + num_globals2++; - new_syms[i] = sym; - sym->udata.i = i + 1; - } - } - - bfd_set_symtab (abfd, new_syms, num_locals + num_globals); - - elf_num_locals (abfd) = num_locals; - elf_num_globals (abfd) = num_globals; - return true; -} - -/* Align to the maximum file alignment that could be required for any - ELF data structure. */ - -static INLINE file_ptr align_file_position PARAMS ((file_ptr, int)); -static INLINE file_ptr -align_file_position (off, align) - file_ptr off; - int align; -{ - return (off + align - 1) & ~(align - 1); -} - -/* Assign a file position to a section, optionally aligning to the - required section alignment. */ - -INLINE file_ptr -_bfd_elf_assign_file_position_for_section (i_shdrp, offset, align) - Elf_Internal_Shdr *i_shdrp; - file_ptr offset; - boolean align; -{ - if (align) - { - unsigned int al; - - al = i_shdrp->sh_addralign; - if (al > 1) - offset = BFD_ALIGN (offset, al); - } - i_shdrp->sh_offset = offset; - if (i_shdrp->bfd_section != NULL) - i_shdrp->bfd_section->filepos = offset; - if (i_shdrp->sh_type != SHT_NOBITS) - offset += i_shdrp->sh_size; - return offset; -} - -/* Compute the file positions we are going to put the sections at, and - otherwise prepare to begin writing out the ELF file. If LINK_INFO - is not NULL, this is being called by the ELF backend linker. */ - -boolean -_bfd_elf_compute_section_file_positions (abfd, link_info) - bfd *abfd; - struct bfd_link_info *link_info; -{ - struct elf_backend_data *bed = get_elf_backend_data (abfd); - boolean failed; - struct bfd_strtab_hash *strtab; - Elf_Internal_Shdr *shstrtab_hdr; - - if (abfd->output_has_begun) - return true; - - /* Do any elf backend specific processing first. */ - if (bed->elf_backend_begin_write_processing) - (*bed->elf_backend_begin_write_processing) (abfd, link_info); - - if (! prep_headers (abfd)) - return false; - - failed = false; - bfd_map_over_sections (abfd, elf_fake_sections, &failed); - if (failed) - return false; - - if (!assign_section_numbers (abfd)) - return false; - - /* The backend linker builds symbol table information itself. */ - if (link_info == NULL && abfd->symcount > 0) - { - if (! swap_out_syms (abfd, &strtab)) - return false; - } - - shstrtab_hdr = &elf_tdata (abfd)->shstrtab_hdr; - /* sh_name was set in prep_headers. */ - shstrtab_hdr->sh_type = SHT_STRTAB; - shstrtab_hdr->sh_flags = 0; - shstrtab_hdr->sh_addr = 0; - shstrtab_hdr->sh_size = _bfd_stringtab_size (elf_shstrtab (abfd)); - shstrtab_hdr->sh_entsize = 0; - shstrtab_hdr->sh_link = 0; - shstrtab_hdr->sh_info = 0; - /* sh_offset is set in assign_file_positions_except_relocs. */ - shstrtab_hdr->sh_addralign = 1; - - if (!assign_file_positions_except_relocs (abfd)) - return false; - - if (link_info == NULL && abfd->symcount > 0) - { - file_ptr off; - Elf_Internal_Shdr *hdr; - - off = elf_tdata (abfd)->next_file_pos; - - hdr = &elf_tdata (abfd)->symtab_hdr; - off = _bfd_elf_assign_file_position_for_section (hdr, off, true); - - hdr = &elf_tdata (abfd)->strtab_hdr; - off = _bfd_elf_assign_file_position_for_section (hdr, off, true); - - elf_tdata (abfd)->next_file_pos = off; - - /* Now that we know where the .strtab section goes, write it - out. */ - if (bfd_seek (abfd, hdr->sh_offset, SEEK_SET) != 0 - || ! _bfd_stringtab_emit (abfd, strtab)) - return false; - _bfd_stringtab_free (strtab); - } - - abfd->output_has_begun = true; - - return true; -} - -/* Create a mapping from a set of sections to a program segment. */ - -static INLINE struct elf_segment_map * -make_mapping (abfd, sections, from, to, phdr) - bfd *abfd; - asection **sections; - unsigned int from; - unsigned int to; - boolean phdr; -{ - struct elf_segment_map *m; - unsigned int i; - asection **hdrpp; - - m = ((struct elf_segment_map *) - bfd_zalloc (abfd, - (sizeof (struct elf_segment_map) - + (to - from - 1) * sizeof (asection *)))); - if (m == NULL) - return NULL; - m->next = NULL; - m->p_type = PT_LOAD; - for (i = from, hdrpp = sections + from; i < to; i++, hdrpp++) - m->sections[i - from] = *hdrpp; - m->count = to - from; - - if (from == 0 && phdr) - { - /* Include the headers in the first PT_LOAD segment. */ - m->includes_filehdr = 1; - m->includes_phdrs = 1; - } - - return m; -} - -/* Set up a mapping from BFD sections to program segments. */ - -static boolean -map_sections_to_segments (abfd) - bfd *abfd; -{ - asection **sections = NULL; - asection *s; - unsigned int i; - unsigned int count; - struct elf_segment_map *mfirst; - struct elf_segment_map **pm; - struct elf_segment_map *m; - asection *last_hdr; - unsigned int phdr_index; - bfd_vma maxpagesize; - asection **hdrpp; - boolean phdr_in_section = true; - boolean writable; - asection *dynsec; - - if (elf_tdata (abfd)->segment_map != NULL) - return true; - - if (bfd_count_sections (abfd) == 0) - return true; - - /* Select the allocated sections, and sort them. */ - - sections = (asection **) bfd_malloc (bfd_count_sections (abfd) - * sizeof (asection *)); - if (sections == NULL) - goto error_return; - - i = 0; - for (s = abfd->sections; s != NULL; s = s->next) - { - if ((s->flags & SEC_ALLOC) != 0) - { - sections[i] = s; - ++i; - } - } - BFD_ASSERT (i <= bfd_count_sections (abfd)); - count = i; - - qsort (sections, (size_t) count, sizeof (asection *), elf_sort_sections); - - /* Build the mapping. */ - - mfirst = NULL; - pm = &mfirst; - - /* If we have a .interp section, then create a PT_PHDR segment for - the program headers and a PT_INTERP segment for the .interp - section. */ - s = bfd_get_section_by_name (abfd, ".interp"); - if (s != NULL && (s->flags & SEC_LOAD) != 0) - { - m = ((struct elf_segment_map *) - bfd_zalloc (abfd, sizeof (struct elf_segment_map))); - if (m == NULL) - goto error_return; - m->next = NULL; - m->p_type = PT_PHDR; - /* FIXME: UnixWare and Solaris set PF_X, Irix 5 does not. */ - m->p_flags = PF_R | PF_X; - m->p_flags_valid = 1; - m->includes_phdrs = 1; - - *pm = m; - pm = &m->next; - - m = ((struct elf_segment_map *) - bfd_zalloc (abfd, sizeof (struct elf_segment_map))); - if (m == NULL) - goto error_return; - m->next = NULL; - m->p_type = PT_INTERP; - m->count = 1; - m->sections[0] = s; - - *pm = m; - pm = &m->next; - } - - /* Look through the sections. We put sections in the same program - segment when the start of the second section can be placed within - a few bytes of the end of the first section. */ - last_hdr = NULL; - phdr_index = 0; - maxpagesize = get_elf_backend_data (abfd)->maxpagesize; - writable = false; - dynsec = bfd_get_section_by_name (abfd, ".dynamic"); - if (dynsec != NULL - && (dynsec->flags & SEC_LOAD) == 0) - dynsec = NULL; - - /* Deal with -Ttext or something similar such that the - first section is not adjacent to the program headers. */ - if (count - && ((sections[0]->lma % maxpagesize) < - (elf_tdata (abfd)->program_header_size % maxpagesize))) - phdr_in_section = false; - - for (i = 0, hdrpp = sections; i < count; i++, hdrpp++) - { - asection *hdr; - - hdr = *hdrpp; - - /* See if this section and the last one will fit in the same - segment. Don't put a loadable section after a non-loadable - section. If we are building a dynamic executable, don't put - a writable section in a read only segment (we don't do this - for a non-dynamic executable because some people prefer to - have only one program segment; anybody can use PHDRS in their - linker script to control what happens anyhow). */ - if (last_hdr == NULL - || ((BFD_ALIGN (last_hdr->lma + last_hdr->_raw_size, maxpagesize) - >= hdr->lma) - && ((last_hdr->flags & SEC_LOAD) != 0 - || (hdr->flags & SEC_LOAD) == 0) - && (dynsec == NULL - || writable - || (hdr->flags & SEC_READONLY) != 0))) - { - last_hdr = hdr; - continue; - } - - /* This section won't fit in the program segment. We must - create a new program header holding all the sections from - phdr_index until hdr. */ - - m = make_mapping (abfd, sections, phdr_index, i, phdr_in_section); - if (m == NULL) - goto error_return; - - *pm = m; - pm = &m->next; - - if ((hdr->flags & SEC_READONLY) == 0) - writable = true; - - last_hdr = hdr; - phdr_index = i; - phdr_in_section = false; - } - - /* Create a final PT_LOAD program segment. */ - if (last_hdr != NULL) - { - m = make_mapping (abfd, sections, phdr_index, i, phdr_in_section); - if (m == NULL) - goto error_return; - - *pm = m; - pm = &m->next; - } - - /* If there is a .dynamic section, throw in a PT_DYNAMIC segment. */ - if (dynsec != NULL) - { - m = ((struct elf_segment_map *) - bfd_zalloc (abfd, sizeof (struct elf_segment_map))); - if (m == NULL) - goto error_return; - m->next = NULL; - m->p_type = PT_DYNAMIC; - m->count = 1; - m->sections[0] = dynsec; - - *pm = m; - pm = &m->next; - } - - free (sections); - sections = NULL; - - elf_tdata (abfd)->segment_map = mfirst; - return true; - - error_return: - if (sections != NULL) - free (sections); - return false; -} - -/* Sort sections by VMA. */ - -static int -elf_sort_sections (arg1, arg2) - const PTR arg1; - const PTR arg2; -{ - const asection *sec1 = *(const asection **) arg1; - const asection *sec2 = *(const asection **) arg2; - - if (sec1->vma < sec2->vma) - return -1; - else if (sec1->vma > sec2->vma) - return 1; - - /* Put !SEC_LOAD sections after SEC_LOAD ones. */ - -#define TOEND(x) (((x)->flags & SEC_LOAD) == 0) - - if (TOEND (sec1)) - if (TOEND (sec2)) - return sec1->target_index - sec2->target_index; - else - return 1; - - if (TOEND (sec2)) - return -1; - -#undef TOEND - - /* Sort by size, to put zero sized sections before others at the - same address. */ - - if (sec1->_raw_size < sec2->_raw_size) - return -1; - if (sec1->_raw_size > sec2->_raw_size) - return 1; - - return sec1->target_index - sec2->target_index; -} - -/* Assign file positions to the sections based on the mapping from - sections to segments. This function also sets up some fields in - the file header, and writes out the program headers. */ - -static boolean -assign_file_positions_for_segments (abfd) - bfd *abfd; -{ - const struct elf_backend_data *bed = get_elf_backend_data (abfd); - unsigned int count; - struct elf_segment_map *m; - unsigned int alloc; - Elf_Internal_Phdr *phdrs; - file_ptr off; - bfd_vma filehdr_vaddr, filehdr_paddr; - bfd_vma phdrs_vaddr, phdrs_paddr; - Elf_Internal_Phdr *p; - - if (elf_tdata (abfd)->segment_map == NULL) - { - if (! map_sections_to_segments (abfd)) - return false; - } - - if (bed->elf_backend_modify_segment_map) - { - if (! (*bed->elf_backend_modify_segment_map) (abfd)) - return false; - } - - count = 0; - for (m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next) - ++count; - - elf_elfheader (abfd)->e_phoff = bed->s->sizeof_ehdr; - elf_elfheader (abfd)->e_phentsize = bed->s->sizeof_phdr; - elf_elfheader (abfd)->e_phnum = count; - - if (count == 0) - return true; - - /* If we already counted the number of program segments, make sure - that we allocated enough space. This happens when SIZEOF_HEADERS - is used in a linker script. */ - alloc = elf_tdata (abfd)->program_header_size / bed->s->sizeof_phdr; - if (alloc != 0 && count > alloc) - { - ((*_bfd_error_handler) - ("%s: Not enough room for program headers (allocated %u, need %u)", - bfd_get_filename (abfd), alloc, count)); - bfd_set_error (bfd_error_bad_value); - return false; - } - - if (alloc == 0) - alloc = count; - - phdrs = ((Elf_Internal_Phdr *) - bfd_alloc (abfd, alloc * sizeof (Elf_Internal_Phdr))); - if (phdrs == NULL) - return false; - - off = bed->s->sizeof_ehdr; - off += alloc * bed->s->sizeof_phdr; - - filehdr_vaddr = 0; - filehdr_paddr = 0; - phdrs_vaddr = 0; - phdrs_paddr = 0; - for (m = elf_tdata (abfd)->segment_map, p = phdrs; - m != NULL; - m = m->next, p++) - { - unsigned int i; - asection **secpp; - - /* If elf_segment_map is not from map_sections_to_segments, the - sections may not be correctly ordered. */ - if (m->count > 0) - qsort (m->sections, (size_t) m->count, sizeof (asection *), - elf_sort_sections); - - p->p_type = m->p_type; - - if (m->p_flags_valid) - p->p_flags = m->p_flags; - else - p->p_flags = 0; - - if (p->p_type == PT_LOAD - && m->count > 0 - && (m->sections[0]->flags & SEC_LOAD) != 0) - off += (m->sections[0]->vma - off) % bed->maxpagesize; - - if (m->count == 0) - p->p_vaddr = 0; - else - p->p_vaddr = m->sections[0]->vma; - - if (m->p_paddr_valid) - p->p_paddr = m->p_paddr; - else if (m->count == 0) - p->p_paddr = 0; - else - p->p_paddr = m->sections[0]->lma; - - if (p->p_type == PT_LOAD) - p->p_align = bed->maxpagesize; - else if (m->count == 0) - p->p_align = bed->s->file_align; - else - p->p_align = 0; - - p->p_offset = 0; - p->p_filesz = 0; - p->p_memsz = 0; - - if (m->includes_filehdr) - { - if (! m->p_flags_valid) - p->p_flags |= PF_R; - p->p_offset = 0; - p->p_filesz = bed->s->sizeof_ehdr; - p->p_memsz = bed->s->sizeof_ehdr; - if (m->count > 0) - { - BFD_ASSERT (p->p_type == PT_LOAD); - p->p_vaddr -= off; - if (! m->p_paddr_valid) - p->p_paddr -= off; - } - if (p->p_type == PT_LOAD) - { - filehdr_vaddr = p->p_vaddr; - filehdr_paddr = p->p_paddr; - } - } - - if (m->includes_phdrs) - { - if (! m->p_flags_valid) - p->p_flags |= PF_R; - if (m->includes_filehdr) - { - if (p->p_type == PT_LOAD) - { - phdrs_vaddr = p->p_vaddr + bed->s->sizeof_ehdr; - phdrs_paddr = p->p_paddr + bed->s->sizeof_ehdr; - } - } - else - { - p->p_offset = bed->s->sizeof_ehdr; - if (m->count > 0) - { - BFD_ASSERT (p->p_type == PT_LOAD); - p->p_vaddr -= off - p->p_offset; - if (! m->p_paddr_valid) - p->p_paddr -= off - p->p_offset; - } - if (p->p_type == PT_LOAD) - { - phdrs_vaddr = p->p_vaddr; - phdrs_paddr = p->p_paddr; - } - } - p->p_filesz += alloc * bed->s->sizeof_phdr; - p->p_memsz += alloc * bed->s->sizeof_phdr; - } - - if (p->p_type == PT_LOAD) - { - if (! m->includes_filehdr && ! m->includes_phdrs) - p->p_offset = off; - else - { - file_ptr adjust; - - adjust = off - (p->p_offset + p->p_filesz); - p->p_filesz += adjust; - p->p_memsz += adjust; - } - } - - for (i = 0, secpp = m->sections; i < m->count; i++, secpp++) - { - asection *sec; - flagword flags; - bfd_size_type align; - - sec = *secpp; - flags = sec->flags; - - if (p->p_type == PT_LOAD) - { - bfd_vma adjust; - - /* The section VMA must equal the file position modulo - the page size. */ - if ((flags & SEC_ALLOC) != 0) - { - adjust = (sec->vma - off) % bed->maxpagesize; - if (adjust != 0) - { - if (i == 0) - abort (); - p->p_memsz += adjust; - off += adjust; - if ((flags & SEC_LOAD) != 0) - p->p_filesz += adjust; - } - } - - sec->filepos = off; - - if ((flags & SEC_LOAD) != 0) - off += sec->_raw_size; - } - - p->p_memsz += sec->_raw_size; - - if ((flags & SEC_LOAD) != 0) - p->p_filesz += sec->_raw_size; - - align = 1 << bfd_get_section_alignment (abfd, sec); - if (align > p->p_align) - p->p_align = align; - - if (! m->p_flags_valid) - { - p->p_flags |= PF_R; - if ((flags & SEC_CODE) != 0) - p->p_flags |= PF_X; - if ((flags & SEC_READONLY) == 0) - p->p_flags |= PF_W; - } - } - } - - /* Now that we have set the section file positions, we can set up - the file positions for the non PT_LOAD segments. */ - for (m = elf_tdata (abfd)->segment_map, p = phdrs; - m != NULL; - m = m->next, p++) - { - if (p->p_type != PT_LOAD && m->count > 0) - { - BFD_ASSERT (! m->includes_filehdr && ! m->includes_phdrs); - p->p_offset = m->sections[0]->filepos; - } - if (m->count == 0) - { - if (m->includes_filehdr) - { - p->p_vaddr = filehdr_vaddr; - if (! m->p_paddr_valid) - p->p_paddr = filehdr_paddr; - } - else if (m->includes_phdrs) - { - p->p_vaddr = phdrs_vaddr; - if (! m->p_paddr_valid) - p->p_paddr = phdrs_paddr; - } - } - } - - /* Clear out any program headers we allocated but did not use. */ - for (; count < alloc; count++, p++) - { - memset (p, 0, sizeof *p); - p->p_type = PT_NULL; - } - - elf_tdata (abfd)->phdr = phdrs; - - elf_tdata (abfd)->next_file_pos = off; - - /* Write out the program headers. */ - if (bfd_seek (abfd, bed->s->sizeof_ehdr, SEEK_SET) != 0 - || bed->s->write_out_phdrs (abfd, phdrs, alloc) != 0) - return false; - - return true; -} - -/* Get the size of the program header. - - If this is called by the linker before any of the section VMA's are set, it - can't calculate the correct value for a strange memory layout. This only - happens when SIZEOF_HEADERS is used in a linker script. In this case, - SORTED_HDRS is NULL and we assume the normal scenario of one text and one - data segment (exclusive of .interp and .dynamic). - - ??? User written scripts must either not use SIZEOF_HEADERS, or assume there - will be two segments. */ - -static bfd_size_type -get_program_header_size (abfd) - bfd *abfd; -{ - size_t segs; - asection *s; - struct elf_backend_data *bed = get_elf_backend_data (abfd); - - /* We can't return a different result each time we're called. */ - if (elf_tdata (abfd)->program_header_size != 0) - return elf_tdata (abfd)->program_header_size; - - if (elf_tdata (abfd)->segment_map != NULL) - { - struct elf_segment_map *m; - - segs = 0; - for (m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next) - ++segs; - elf_tdata (abfd)->program_header_size = segs * bed->s->sizeof_phdr; - return elf_tdata (abfd)->program_header_size; - } - - /* Assume we will need exactly two PT_LOAD segments: one for text - and one for data. */ - segs = 2; - - s = bfd_get_section_by_name (abfd, ".interp"); - if (s != NULL && (s->flags & SEC_LOAD) != 0) - { - /* If we have a loadable interpreter section, we need a - PT_INTERP segment. In this case, assume we also need a - PT_PHDR segment, although that may not be true for all - targets. */ - segs += 2; - } - - if (bfd_get_section_by_name (abfd, ".dynamic") != NULL) - { - /* We need a PT_DYNAMIC segment. */ - ++segs; - } - - /* Let the backend count up any program headers it might need. */ - if (bed->elf_backend_additional_program_headers) - { - int a; - - a = (*bed->elf_backend_additional_program_headers) (abfd); - if (a == -1) - abort (); - segs += a; - } - - elf_tdata (abfd)->program_header_size = segs * bed->s->sizeof_phdr; - return elf_tdata (abfd)->program_header_size; -} - -/* Work out the file positions of all the sections. This is called by - _bfd_elf_compute_section_file_positions. All the section sizes and - VMAs must be known before this is called. - - We do not consider reloc sections at this point, unless they form - part of the loadable image. Reloc sections are assigned file - positions in assign_file_positions_for_relocs, which is called by - write_object_contents and final_link. - - We also don't set the positions of the .symtab and .strtab here. */ - -static boolean -assign_file_positions_except_relocs (abfd) - bfd *abfd; -{ - struct elf_obj_tdata * const tdata = elf_tdata (abfd); - Elf_Internal_Ehdr * const i_ehdrp = elf_elfheader (abfd); - Elf_Internal_Shdr ** const i_shdrpp = elf_elfsections (abfd); - file_ptr off; - struct elf_backend_data *bed = get_elf_backend_data (abfd); - - if ((abfd->flags & (EXEC_P | DYNAMIC)) == 0) - { - Elf_Internal_Shdr **hdrpp; - unsigned int i; - - /* Start after the ELF header. */ - off = i_ehdrp->e_ehsize; - - /* We are not creating an executable, which means that we are - not creating a program header, and that the actual order of - the sections in the file is unimportant. */ - for (i = 1, hdrpp = i_shdrpp + 1; i < i_ehdrp->e_shnum; i++, hdrpp++) - { - Elf_Internal_Shdr *hdr; - - hdr = *hdrpp; - if (hdr->sh_type == SHT_REL || hdr->sh_type == SHT_RELA) - { - hdr->sh_offset = -1; - continue; - } - if (i == tdata->symtab_section - || i == tdata->strtab_section) - { - hdr->sh_offset = -1; - continue; - } - - off = _bfd_elf_assign_file_position_for_section (hdr, off, true); - } - } - else - { - unsigned int i; - Elf_Internal_Shdr **hdrpp; - - /* Assign file positions for the loaded sections based on the - assignment of sections to segments. */ - if (! assign_file_positions_for_segments (abfd)) - return false; - - /* Assign file positions for the other sections. */ - - off = elf_tdata (abfd)->next_file_pos; - for (i = 1, hdrpp = i_shdrpp + 1; i < i_ehdrp->e_shnum; i++, hdrpp++) - { - Elf_Internal_Shdr *hdr; - - hdr = *hdrpp; - if (hdr->bfd_section != NULL - && hdr->bfd_section->filepos != 0) - hdr->sh_offset = hdr->bfd_section->filepos; - else if ((hdr->sh_flags & SHF_ALLOC) != 0) - { - ((*_bfd_error_handler) - ("%s: warning: allocated section `%s' not in segment", - bfd_get_filename (abfd), - (hdr->bfd_section == NULL - ? "*unknown*" - : hdr->bfd_section->name))); - off += (hdr->sh_addr - off) % bed->maxpagesize; - off = _bfd_elf_assign_file_position_for_section (hdr, off, - false); - } - else if (hdr->sh_type == SHT_REL - || hdr->sh_type == SHT_RELA - || hdr == i_shdrpp[tdata->symtab_section] - || hdr == i_shdrpp[tdata->strtab_section]) - hdr->sh_offset = -1; - else - off = _bfd_elf_assign_file_position_for_section (hdr, off, true); - } - } - - /* Place the section headers. */ - off = align_file_position (off, bed->s->file_align); - i_ehdrp->e_shoff = off; - off += i_ehdrp->e_shnum * i_ehdrp->e_shentsize; - - elf_tdata (abfd)->next_file_pos = off; - - return true; -} - -static boolean -prep_headers (abfd) - bfd *abfd; -{ - Elf_Internal_Ehdr *i_ehdrp; /* Elf file header, internal form */ - Elf_Internal_Phdr *i_phdrp = 0; /* Program header table, internal form */ - Elf_Internal_Shdr **i_shdrp; /* Section header table, internal form */ - int count; - struct bfd_strtab_hash *shstrtab; - struct elf_backend_data *bed = get_elf_backend_data (abfd); - - i_ehdrp = elf_elfheader (abfd); - i_shdrp = elf_elfsections (abfd); - - shstrtab = _bfd_elf_stringtab_init (); - if (shstrtab == NULL) - return false; - - elf_shstrtab (abfd) = shstrtab; - - i_ehdrp->e_ident[EI_MAG0] = ELFMAG0; - i_ehdrp->e_ident[EI_MAG1] = ELFMAG1; - i_ehdrp->e_ident[EI_MAG2] = ELFMAG2; - i_ehdrp->e_ident[EI_MAG3] = ELFMAG3; - - i_ehdrp->e_ident[EI_CLASS] = bed->s->elfclass; - i_ehdrp->e_ident[EI_DATA] = - bfd_big_endian (abfd) ? ELFDATA2MSB : ELFDATA2LSB; - i_ehdrp->e_ident[EI_VERSION] = bed->s->ev_current; - - for (count = EI_PAD; count < EI_NIDENT; count++) - i_ehdrp->e_ident[count] = 0; - - if ((abfd->flags & DYNAMIC) != 0) - i_ehdrp->e_type = ET_DYN; - else if ((abfd->flags & EXEC_P) != 0) - i_ehdrp->e_type = ET_EXEC; - else - i_ehdrp->e_type = ET_REL; - - switch (bfd_get_arch (abfd)) - { - case bfd_arch_unknown: - i_ehdrp->e_machine = EM_NONE; - break; - case bfd_arch_sparc: - if (bed->s->arch_size == 64) - i_ehdrp->e_machine = EM_SPARC64; - else - i_ehdrp->e_machine = EM_SPARC; - break; - case bfd_arch_i386: - i_ehdrp->e_machine = EM_386; - break; - case bfd_arch_m68k: - i_ehdrp->e_machine = EM_68K; - break; - case bfd_arch_m88k: - i_ehdrp->e_machine = EM_88K; - break; - case bfd_arch_i860: - i_ehdrp->e_machine = EM_860; - break; - case bfd_arch_mips: /* MIPS Rxxxx */ - i_ehdrp->e_machine = EM_MIPS; /* only MIPS R3000 */ - break; - case bfd_arch_hppa: - i_ehdrp->e_machine = EM_PARISC; - break; - case bfd_arch_powerpc: - i_ehdrp->e_machine = EM_PPC; - break; - /* also note that EM_M32, AT&T WE32100 is unknown to bfd */ - default: - i_ehdrp->e_machine = EM_NONE; - } - i_ehdrp->e_version = bed->s->ev_current; - i_ehdrp->e_ehsize = bed->s->sizeof_ehdr; - - /* no program header, for now. */ - i_ehdrp->e_phoff = 0; - i_ehdrp->e_phentsize = 0; - i_ehdrp->e_phnum = 0; - - /* each bfd section is section header entry */ - i_ehdrp->e_entry = bfd_get_start_address (abfd); - i_ehdrp->e_shentsize = bed->s->sizeof_shdr; - - /* if we're building an executable, we'll need a program header table */ - if (abfd->flags & EXEC_P) - { - /* it all happens later */ -#if 0 - i_ehdrp->e_phentsize = sizeof (Elf_External_Phdr); - - /* elf_build_phdrs() returns a (NULL-terminated) array of - Elf_Internal_Phdrs */ - i_phdrp = elf_build_phdrs (abfd, i_ehdrp, i_shdrp, &i_ehdrp->e_phnum); - i_ehdrp->e_phoff = outbase; - outbase += i_ehdrp->e_phentsize * i_ehdrp->e_phnum; -#endif - } - else - { - i_ehdrp->e_phentsize = 0; - i_phdrp = 0; - i_ehdrp->e_phoff = 0; - } - - elf_tdata (abfd)->symtab_hdr.sh_name = - (unsigned int) _bfd_stringtab_add (shstrtab, ".symtab", true, false); - elf_tdata (abfd)->strtab_hdr.sh_name = - (unsigned int) _bfd_stringtab_add (shstrtab, ".strtab", true, false); - elf_tdata (abfd)->shstrtab_hdr.sh_name = - (unsigned int) _bfd_stringtab_add (shstrtab, ".shstrtab", true, false); - if (elf_tdata (abfd)->symtab_hdr.sh_name == (unsigned int) -1 - || elf_tdata (abfd)->symtab_hdr.sh_name == (unsigned int) -1 - || elf_tdata (abfd)->shstrtab_hdr.sh_name == (unsigned int) -1) - return false; - - return true; -} - -/* Assign file positions for all the reloc sections which are not part - of the loadable file image. */ - -void -_bfd_elf_assign_file_positions_for_relocs (abfd) - bfd *abfd; -{ - file_ptr off; - unsigned int i; - Elf_Internal_Shdr **shdrpp; - - off = elf_tdata (abfd)->next_file_pos; - - for (i = 1, shdrpp = elf_elfsections (abfd) + 1; - i < elf_elfheader (abfd)->e_shnum; - i++, shdrpp++) - { - Elf_Internal_Shdr *shdrp; - - shdrp = *shdrpp; - if ((shdrp->sh_type == SHT_REL || shdrp->sh_type == SHT_RELA) - && shdrp->sh_offset == -1) - off = _bfd_elf_assign_file_position_for_section (shdrp, off, true); - } - - elf_tdata (abfd)->next_file_pos = off; -} - -boolean -_bfd_elf_write_object_contents (abfd) - bfd *abfd; -{ - struct elf_backend_data *bed = get_elf_backend_data (abfd); - Elf_Internal_Ehdr *i_ehdrp; - Elf_Internal_Shdr **i_shdrp; - boolean failed; - unsigned int count; - - if (! abfd->output_has_begun - && ! _bfd_elf_compute_section_file_positions (abfd, - (struct bfd_link_info *) NULL)) - return false; - - i_shdrp = elf_elfsections (abfd); - i_ehdrp = elf_elfheader (abfd); - - failed = false; - bfd_map_over_sections (abfd, bed->s->write_relocs, &failed); - if (failed) - return false; - _bfd_elf_assign_file_positions_for_relocs (abfd); - - /* After writing the headers, we need to write the sections too... */ - for (count = 1; count < i_ehdrp->e_shnum; count++) - { - if (bed->elf_backend_section_processing) - (*bed->elf_backend_section_processing) (abfd, i_shdrp[count]); - if (i_shdrp[count]->contents) - { - if (bfd_seek (abfd, i_shdrp[count]->sh_offset, SEEK_SET) != 0 - || (bfd_write (i_shdrp[count]->contents, i_shdrp[count]->sh_size, - 1, abfd) - != i_shdrp[count]->sh_size)) - return false; - } - } - - /* Write out the section header names. */ - if (bfd_seek (abfd, elf_tdata (abfd)->shstrtab_hdr.sh_offset, SEEK_SET) != 0 - || ! _bfd_stringtab_emit (abfd, elf_shstrtab (abfd))) - return false; - - if (bed->elf_backend_final_write_processing) - (*bed->elf_backend_final_write_processing) (abfd, - elf_tdata (abfd)->linker); - - return bed->s->write_shdrs_and_ehdr (abfd); -} - -/* given a section, search the header to find them... */ -int -_bfd_elf_section_from_bfd_section (abfd, asect) - bfd *abfd; - struct sec *asect; -{ - struct elf_backend_data *bed = get_elf_backend_data (abfd); - Elf_Internal_Shdr **i_shdrp = elf_elfsections (abfd); - int index; - Elf_Internal_Shdr *hdr; - int maxindex = elf_elfheader (abfd)->e_shnum; - - for (index = 0; index < maxindex; index++) - { - hdr = i_shdrp[index]; - if (hdr->bfd_section == asect) - return index; - } - - if (bed->elf_backend_section_from_bfd_section) - { - for (index = 0; index < maxindex; index++) - { - int retval; - - hdr = i_shdrp[index]; - retval = index; - if ((*bed->elf_backend_section_from_bfd_section) - (abfd, hdr, asect, &retval)) - return retval; - } - } - - if (bfd_is_abs_section (asect)) - return SHN_ABS; - if (bfd_is_com_section (asect)) - return SHN_COMMON; - if (bfd_is_und_section (asect)) - return SHN_UNDEF; - - return -1; -} - -/* Given a BFD symbol, return the index in the ELF symbol table, or -1 - on error. */ - -int -_bfd_elf_symbol_from_bfd_symbol (abfd, asym_ptr_ptr) - bfd *abfd; - struct symbol_cache_entry **asym_ptr_ptr; -{ - struct symbol_cache_entry *asym_ptr = *asym_ptr_ptr; - int idx; - flagword flags = asym_ptr->flags; - - /* When gas creates relocations against local labels, it creates its - own symbol for the section, but does put the symbol into the - symbol chain, so udata is 0. When the linker is generating - relocatable output, this section symbol may be for one of the - input sections rather than the output section. */ - if (asym_ptr->udata.i == 0 - && (flags & BSF_SECTION_SYM) - && asym_ptr->section) - { - int indx; - - if (asym_ptr->section->output_section != NULL) - indx = asym_ptr->section->output_section->index; - else - indx = asym_ptr->section->index; - if (elf_section_syms (abfd)[indx]) - asym_ptr->udata.i = elf_section_syms (abfd)[indx]->udata.i; - } - - idx = asym_ptr->udata.i; - - if (idx == 0) - { - /* This case can occur when using --strip-symbol on a symbol - which is used in a relocation entry. */ - (*_bfd_error_handler) - ("%s: symbol `%s' required but not present", - bfd_get_filename (abfd), bfd_asymbol_name (asym_ptr)); - bfd_set_error (bfd_error_no_symbols); - return -1; - } - -#if DEBUG & 4 - { - fprintf (stderr, - "elf_symbol_from_bfd_symbol 0x%.8lx, name = %s, sym num = %d, flags = 0x%.8lx%s\n", - (long) asym_ptr, asym_ptr->name, idx, flags, - elf_symbol_flags (flags)); - fflush (stderr); - } -#endif - - return idx; -} - -/* Copy private BFD data. This copies any program header information. */ - -static boolean -copy_private_bfd_data (ibfd, obfd) - bfd *ibfd; - bfd *obfd; -{ - Elf_Internal_Ehdr *iehdr; - struct elf_segment_map *mfirst; - struct elf_segment_map **pm; - Elf_Internal_Phdr *p; - unsigned int i, c; - - if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour - || bfd_get_flavour (obfd) != bfd_target_elf_flavour) - return true; - - if (elf_tdata (ibfd)->phdr == NULL) - return true; - - iehdr = elf_elfheader (ibfd); - - mfirst = NULL; - pm = &mfirst; - - c = elf_elfheader (ibfd)->e_phnum; - for (i = 0, p = elf_tdata (ibfd)->phdr; i < c; i++, p++) - { - unsigned int csecs; - asection *s; - struct elf_segment_map *m; - unsigned int isec; - - csecs = 0; - - /* The complicated case when p_vaddr is 0 is to handle the - Solaris linker, which generates a PT_INTERP section with - p_vaddr and p_memsz set to 0. */ - for (s = ibfd->sections; s != NULL; s = s->next) - if (((s->vma >= p->p_vaddr - && (s->vma + s->_raw_size <= p->p_vaddr + p->p_memsz - || s->vma + s->_raw_size <= p->p_vaddr + p->p_filesz)) - || (p->p_vaddr == 0 - && p->p_filesz > 0 - && (s->flags & SEC_HAS_CONTENTS) != 0 - && (bfd_vma) s->filepos >= p->p_offset - && ((bfd_vma) s->filepos + s->_raw_size - <= p->p_offset + p->p_filesz))) - && (s->flags & SEC_ALLOC) != 0 - && s->output_section != NULL) - ++csecs; - - m = ((struct elf_segment_map *) - bfd_alloc (obfd, - (sizeof (struct elf_segment_map) - + (csecs - 1) * sizeof (asection *)))); - if (m == NULL) - return false; - - m->next = NULL; - m->p_type = p->p_type; - m->p_flags = p->p_flags; - m->p_flags_valid = 1; - m->p_paddr = p->p_paddr; - m->p_paddr_valid = 1; - - m->includes_filehdr = (p->p_offset == 0 - && p->p_filesz >= iehdr->e_ehsize); - - m->includes_phdrs = (p->p_offset <= (bfd_vma) iehdr->e_phoff - && (p->p_offset + p->p_filesz - >= ((bfd_vma) iehdr->e_phoff - + iehdr->e_phnum * iehdr->e_phentsize))); - - isec = 0; - for (s = ibfd->sections; s != NULL; s = s->next) - { - if (((s->vma >= p->p_vaddr - && (s->vma + s->_raw_size <= p->p_vaddr + p->p_memsz - || s->vma + s->_raw_size <= p->p_vaddr + p->p_filesz)) - || (p->p_vaddr == 0 - && p->p_filesz > 0 - && (s->flags & SEC_HAS_CONTENTS) != 0 - && (bfd_vma) s->filepos >= p->p_offset - && ((bfd_vma) s->filepos + s->_raw_size - <= p->p_offset + p->p_filesz))) - && (s->flags & SEC_ALLOC) != 0 - && s->output_section != NULL) - { - m->sections[isec] = s->output_section; - ++isec; - } - } - BFD_ASSERT (isec == csecs); - m->count = csecs; - - *pm = m; - pm = &m->next; - } - - elf_tdata (obfd)->segment_map = mfirst; - - return true; -} - -/* Copy private section information. This copies over the entsize - field, and sometimes the info field. */ - -boolean -_bfd_elf_copy_private_section_data (ibfd, isec, obfd, osec) - bfd *ibfd; - asection *isec; - bfd *obfd; - asection *osec; -{ - Elf_Internal_Shdr *ihdr, *ohdr; - - if (ibfd->xvec->flavour != bfd_target_elf_flavour - || obfd->xvec->flavour != bfd_target_elf_flavour) - return true; - - /* Copy over private BFD data if it has not already been copied. - 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 when all the sections have been set - up. */ - for (s = ibfd->sections; s != NULL; s = s->next) - if (s->output_section == NULL) - break; - if (s == NULL) - { - if (! copy_private_bfd_data (ibfd, obfd)) - return false; - } - } - - ihdr = &elf_section_data (isec)->this_hdr; - ohdr = &elf_section_data (osec)->this_hdr; - - ohdr->sh_entsize = ihdr->sh_entsize; - - if (ihdr->sh_type == SHT_SYMTAB - || ihdr->sh_type == SHT_DYNSYM) - ohdr->sh_info = ihdr->sh_info; - - return true; -} - -/* Copy private symbol information. If this symbol is in a section - which we did not map into a BFD section, try to map the section - index correctly. We use special macro definitions for the mapped - section indices; these definitions are interpreted by the - swap_out_syms function. */ - -#define MAP_ONESYMTAB (SHN_LORESERVE - 1) -#define MAP_DYNSYMTAB (SHN_LORESERVE - 2) -#define MAP_STRTAB (SHN_LORESERVE - 3) -#define MAP_SHSTRTAB (SHN_LORESERVE - 4) - -boolean -_bfd_elf_copy_private_symbol_data (ibfd, isymarg, obfd, osymarg) - bfd *ibfd; - asymbol *isymarg; - bfd *obfd; - asymbol *osymarg; -{ - elf_symbol_type *isym, *osym; - - isym = elf_symbol_from (ibfd, isymarg); - osym = elf_symbol_from (obfd, osymarg); - - if (isym != NULL - && osym != NULL - && bfd_is_abs_section (isym->symbol.section)) - { - unsigned int shndx; - - shndx = isym->internal_elf_sym.st_shndx; - if (shndx == elf_onesymtab (ibfd)) - shndx = MAP_ONESYMTAB; - else if (shndx == elf_dynsymtab (ibfd)) - shndx = MAP_DYNSYMTAB; - else if (shndx == elf_tdata (ibfd)->strtab_section) - shndx = MAP_STRTAB; - else if (shndx == elf_tdata (ibfd)->shstrtab_section) - shndx = MAP_SHSTRTAB; - osym->internal_elf_sym.st_shndx = shndx; - } - - return true; -} - -/* Swap out the symbols. */ - -static boolean -swap_out_syms (abfd, sttp) - bfd *abfd; - struct bfd_strtab_hash **sttp; -{ - struct elf_backend_data *bed = get_elf_backend_data (abfd); - - if (!elf_map_symbols (abfd)) - return false; - - /* Dump out the symtabs. */ - { - int symcount = bfd_get_symcount (abfd); - asymbol **syms = bfd_get_outsymbols (abfd); - struct bfd_strtab_hash *stt; - Elf_Internal_Shdr *symtab_hdr; - Elf_Internal_Shdr *symstrtab_hdr; - char *outbound_syms; - int idx; - - stt = _bfd_elf_stringtab_init (); - if (stt == NULL) - return false; - - symtab_hdr = &elf_tdata (abfd)->symtab_hdr; - symtab_hdr->sh_type = SHT_SYMTAB; - symtab_hdr->sh_entsize = bed->s->sizeof_sym; - symtab_hdr->sh_size = symtab_hdr->sh_entsize * (symcount + 1); - symtab_hdr->sh_info = elf_num_locals (abfd) + 1; - symtab_hdr->sh_addralign = bed->s->file_align; - - symstrtab_hdr = &elf_tdata (abfd)->strtab_hdr; - symstrtab_hdr->sh_type = SHT_STRTAB; - - outbound_syms = bfd_alloc (abfd, - (1 + symcount) * bed->s->sizeof_sym); - if (outbound_syms == NULL) - return false; - symtab_hdr->contents = (PTR) outbound_syms; - - /* now generate the data (for "contents") */ - { - /* Fill in zeroth symbol and swap it out. */ - Elf_Internal_Sym sym; - sym.st_name = 0; - sym.st_value = 0; - sym.st_size = 0; - sym.st_info = 0; - sym.st_other = 0; - sym.st_shndx = SHN_UNDEF; - bed->s->swap_symbol_out (abfd, &sym, (PTR) outbound_syms); - outbound_syms += bed->s->sizeof_sym; - } - for (idx = 0; idx < symcount; idx++) - { - Elf_Internal_Sym sym; - bfd_vma value = syms[idx]->value; - elf_symbol_type *type_ptr; - flagword flags = syms[idx]->flags; - int type; - - if (flags & BSF_SECTION_SYM) - /* Section symbols have no names. */ - sym.st_name = 0; - else - { - sym.st_name = (unsigned long) _bfd_stringtab_add (stt, - syms[idx]->name, - true, false); - if (sym.st_name == (unsigned long) -1) - return false; - } - - type_ptr = elf_symbol_from (abfd, syms[idx]); - - if (bfd_is_com_section (syms[idx]->section)) - { - /* ELF common symbols put the alignment into the `value' field, - and the size into the `size' field. This is backwards from - how BFD handles it, so reverse it here. */ - sym.st_size = value; - if (type_ptr == NULL - || type_ptr->internal_elf_sym.st_value == 0) - sym.st_value = value >= 16 ? 16 : (1 << bfd_log2 (value)); - else - sym.st_value = type_ptr->internal_elf_sym.st_value; - sym.st_shndx = _bfd_elf_section_from_bfd_section (abfd, - syms[idx]->section); - } - else - { - asection *sec = syms[idx]->section; - int shndx; - - if (sec->output_section) - { - value += sec->output_offset; - sec = sec->output_section; - } - value += sec->vma; - sym.st_value = value; - sym.st_size = type_ptr ? type_ptr->internal_elf_sym.st_size : 0; - - if (bfd_is_abs_section (sec) - && type_ptr != NULL - && type_ptr->internal_elf_sym.st_shndx != 0) - { - /* This symbol is in a real ELF section which we did - not create as a BFD section. Undo the mapping done - by copy_private_symbol_data. */ - shndx = type_ptr->internal_elf_sym.st_shndx; - switch (shndx) - { - case MAP_ONESYMTAB: - shndx = elf_onesymtab (abfd); - break; - case MAP_DYNSYMTAB: - shndx = elf_dynsymtab (abfd); - break; - case MAP_STRTAB: - shndx = elf_tdata (abfd)->strtab_section; - break; - case MAP_SHSTRTAB: - shndx = elf_tdata (abfd)->shstrtab_section; - break; - default: - break; - } - } - else - { - shndx = _bfd_elf_section_from_bfd_section (abfd, sec); - - if (shndx == -1) - { - asection *sec2; - - /* Writing this would be a hell of a lot easier if - we had some decent documentation on bfd, and - knew what to expect of the library, and what to - demand of applications. For example, it - appears that `objcopy' might not set the - section of a symbol to be a section that is - actually in the output file. */ - sec2 = bfd_get_section_by_name (abfd, sec->name); - BFD_ASSERT (sec2 != 0); - shndx = _bfd_elf_section_from_bfd_section (abfd, sec2); - BFD_ASSERT (shndx != -1); - } - } - - sym.st_shndx = shndx; - } - - if ((flags & BSF_FUNCTION) != 0) - type = STT_FUNC; - else if ((flags & BSF_OBJECT) != 0) - type = STT_OBJECT; - else - type = STT_NOTYPE; - - if (bfd_is_com_section (syms[idx]->section)) - sym.st_info = ELF_ST_INFO (STB_GLOBAL, type); - else if (bfd_is_und_section (syms[idx]->section)) - sym.st_info = ELF_ST_INFO (((flags & BSF_WEAK) - ? STB_WEAK - : STB_GLOBAL), - type); - else if (flags & BSF_SECTION_SYM) - sym.st_info = ELF_ST_INFO (STB_LOCAL, STT_SECTION); - else if (flags & BSF_FILE) - sym.st_info = ELF_ST_INFO (STB_LOCAL, STT_FILE); - else - { - int bind = STB_LOCAL; - - if (flags & BSF_LOCAL) - bind = STB_LOCAL; - else if (flags & BSF_WEAK) - bind = STB_WEAK; - else if (flags & BSF_GLOBAL) - bind = STB_GLOBAL; - - sym.st_info = ELF_ST_INFO (bind, type); - } - - sym.st_other = 0; - bed->s->swap_symbol_out (abfd, &sym, (PTR) outbound_syms); - outbound_syms += bed->s->sizeof_sym; - } - - *sttp = stt; - symstrtab_hdr->sh_size = _bfd_stringtab_size (stt); - symstrtab_hdr->sh_type = SHT_STRTAB; - - symstrtab_hdr->sh_flags = 0; - symstrtab_hdr->sh_addr = 0; - symstrtab_hdr->sh_entsize = 0; - symstrtab_hdr->sh_link = 0; - symstrtab_hdr->sh_info = 0; - symstrtab_hdr->sh_addralign = 1; - } - - return true; -} - -/* Return the number of bytes required to hold the symtab vector. - - Note that we base it on the count plus 1, since we will null terminate - the vector allocated based on this size. However, the ELF symbol table - always has a dummy entry as symbol #0, so it ends up even. */ - -long -_bfd_elf_get_symtab_upper_bound (abfd) - bfd *abfd; -{ - long symcount; - long symtab_size; - Elf_Internal_Shdr *hdr = &elf_tdata (abfd)->symtab_hdr; - - symcount = hdr->sh_size / get_elf_backend_data (abfd)->s->sizeof_sym; - symtab_size = (symcount - 1 + 1) * (sizeof (asymbol *)); - - return symtab_size; -} - -long -_bfd_elf_get_dynamic_symtab_upper_bound (abfd) - bfd *abfd; -{ - long symcount; - long symtab_size; - Elf_Internal_Shdr *hdr = &elf_tdata (abfd)->dynsymtab_hdr; - - if (elf_dynsymtab (abfd) == 0) - { - bfd_set_error (bfd_error_invalid_operation); - return -1; - } - - symcount = hdr->sh_size / get_elf_backend_data (abfd)->s->sizeof_sym; - symtab_size = (symcount - 1 + 1) * (sizeof (asymbol *)); - - return symtab_size; -} - -long -_bfd_elf_get_reloc_upper_bound (abfd, asect) - bfd *abfd; - sec_ptr asect; -{ - return (asect->reloc_count + 1) * sizeof (arelent *); -} - -/* Canonicalize the relocs. */ - -long -_bfd_elf_canonicalize_reloc (abfd, section, relptr, symbols) - bfd *abfd; - sec_ptr section; - arelent **relptr; - asymbol **symbols; -{ - arelent *tblptr; - unsigned int i; - - if (! get_elf_backend_data (abfd)->s->slurp_reloc_table (abfd, section, symbols)) - return -1; - - tblptr = section->relocation; - for (i = 0; i < section->reloc_count; i++) - *relptr++ = tblptr++; - - *relptr = NULL; - - return section->reloc_count; -} - -long -_bfd_elf_get_symtab (abfd, alocation) - bfd *abfd; - asymbol **alocation; -{ - long symcount = get_elf_backend_data (abfd)->s->slurp_symbol_table (abfd, alocation, false); - - if (symcount >= 0) - bfd_get_symcount (abfd) = symcount; - return symcount; -} - -long -_bfd_elf_canonicalize_dynamic_symtab (abfd, alocation) - bfd *abfd; - asymbol **alocation; -{ - return get_elf_backend_data (abfd)->s->slurp_symbol_table (abfd, alocation, true); -} - -asymbol * -_bfd_elf_make_empty_symbol (abfd) - bfd *abfd; -{ - elf_symbol_type *newsym; - - newsym = (elf_symbol_type *) bfd_zalloc (abfd, sizeof (elf_symbol_type)); - if (!newsym) - return NULL; - else - { - newsym->symbol.the_bfd = abfd; - return &newsym->symbol; - } -} - -void -_bfd_elf_get_symbol_info (ignore_abfd, symbol, ret) - bfd *ignore_abfd; - asymbol *symbol; - symbol_info *ret; -{ - bfd_symbol_info (symbol, ret); -} - -alent * -_bfd_elf_get_lineno (ignore_abfd, symbol) - bfd *ignore_abfd; - asymbol *symbol; -{ - abort (); - return NULL; -} - -boolean -_bfd_elf_set_arch_mach (abfd, arch, machine) - bfd *abfd; - enum bfd_architecture arch; - unsigned long machine; -{ - /* If this isn't the right architecture for this backend, and this - isn't the generic backend, fail. */ - if (arch != get_elf_backend_data (abfd)->arch - && arch != bfd_arch_unknown - && get_elf_backend_data (abfd)->arch != bfd_arch_unknown) - return false; - - return bfd_default_set_arch_mach (abfd, arch, machine); -} - -/* Find the nearest line to a particular section and offset, for error - reporting. */ - -boolean -_bfd_elf_find_nearest_line (abfd, - section, - symbols, - offset, - filename_ptr, - functionname_ptr, - line_ptr) - bfd *abfd; - asection *section; - asymbol **symbols; - bfd_vma offset; - CONST char **filename_ptr; - CONST char **functionname_ptr; - unsigned int *line_ptr; -{ - boolean found; - const char *filename; - asymbol *func; - bfd_vma low_func; - asymbol **p; - - if (! _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, - &found, filename_ptr, - functionname_ptr, line_ptr, - &elf_tdata (abfd)->line_info)) - return false; - if (found) - return true; - - if (symbols == NULL) - return false; - - filename = NULL; - func = NULL; - low_func = 0; - - for (p = symbols; *p != NULL; p++) - { - elf_symbol_type *q; - - q = (elf_symbol_type *) *p; - - if (bfd_get_section (&q->symbol) != section) - continue; - - switch (ELF_ST_TYPE (q->internal_elf_sym.st_info)) - { - default: - break; - case STT_FILE: - filename = bfd_asymbol_name (&q->symbol); - break; - case STT_FUNC: - if (q->symbol.section == section - && q->symbol.value >= low_func - && q->symbol.value <= offset) - { - func = (asymbol *) q; - low_func = q->symbol.value; - } - break; - } - } - - if (func == NULL) - return false; - - *filename_ptr = filename; - *functionname_ptr = bfd_asymbol_name (func); - *line_ptr = 0; - return true; -} - -int -_bfd_elf_sizeof_headers (abfd, reloc) - bfd *abfd; - boolean reloc; -{ - int ret; - - ret = get_elf_backend_data (abfd)->s->sizeof_ehdr; - if (! reloc) - ret += get_program_header_size (abfd); - return ret; -} - -boolean -_bfd_elf_set_section_contents (abfd, section, location, offset, count) - bfd *abfd; - sec_ptr section; - PTR location; - file_ptr offset; - bfd_size_type count; -{ - Elf_Internal_Shdr *hdr; - - if (! abfd->output_has_begun - && ! _bfd_elf_compute_section_file_positions (abfd, - (struct bfd_link_info *) NULL)) - return false; - - hdr = &elf_section_data (section)->this_hdr; - - if (bfd_seek (abfd, hdr->sh_offset + offset, SEEK_SET) == -1) - return false; - if (bfd_write (location, 1, count, abfd) != count) - return false; - - return true; -} - -void -_bfd_elf_no_info_to_howto (abfd, cache_ptr, dst) - bfd *abfd; - arelent *cache_ptr; - Elf_Internal_Rela *dst; -{ - abort (); -} - -#if 0 -void -_bfd_elf_no_info_to_howto_rel (abfd, cache_ptr, dst) - bfd *abfd; - arelent *cache_ptr; - Elf_Internal_Rel *dst; -{ - abort (); -} -#endif diff --git a/contrib/gdb/bfd/format.c b/contrib/gdb/bfd/format.c deleted file mode 100644 index 7a303424..0000000 --- a/contrib/gdb/bfd/format.c +++ /dev/null @@ -1,319 +0,0 @@ -/* Generic BFD support for file formats. - Copyright (C) 1990, 91, 92, 93, 94 Free Software Foundation, Inc. - Written by Cygnus Support. - -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. */ - -/* -SECTION - File formats - - A format is a BFD concept of high level file contents type. The - formats supported by BFD are: - - o <> - - The BFD may contain data, symbols, relocations and debug info. - - o <> - - The BFD contains other BFDs and an optional index. - - o <> - - The BFD contains the result of an executable core dump. - - -*/ - -#include "bfd.h" -#include "sysdep.h" -#include "libbfd.h" - -/* IMPORT from targets.c. */ -extern const size_t _bfd_target_vector_entries; - -/* -FUNCTION - bfd_check_format - -SYNOPSIS - boolean bfd_check_format(bfd *abfd, bfd_format format); - -DESCRIPTION - Verify if the file attached to the BFD @var{abfd} is compatible - with the format @var{format} (i.e., one of <>, - <> or <>). - - If the BFD has been set to a specific target before the - call, only the named target and format combination is - checked. If the target has not been set, or has been set to - <>, then all the known target backends is - interrogated to determine a match. If the default target - matches, it is used. If not, exactly one target must recognize - the file, or an error results. - - The function returns <> on success, otherwise <> - with one of the following error codes: - - o <> - - if <> is not one of <>, <> or - <>. - - o <> - - if an error occured during a read - even some file mismatches - can cause bfd_error_system_calls. - - o <> - - none of the backends recognised the file format. - - o <> - - more than one backend recognised the file format. -*/ - -boolean -bfd_check_format (abfd, format) - bfd *abfd; - bfd_format format; -{ - return bfd_check_format_matches (abfd, format, NULL); -} - -/* -FUNCTION - bfd_check_format_matches - -SYNOPSIS - boolean bfd_check_format_matches(bfd *abfd, bfd_format format, char ***matching); - -DESCRIPTION - Like <>, except when it returns false with - <> set to <>. In that - case, if @var{matching} is not NULL, it will be filled in with - a NULL-terminated list of the names of the formats that matched, - allocated with <>. - Then the user may choose a format and try again. - - When done with the list that @var{matching} points to, the caller - should free it. -*/ - -boolean -bfd_check_format_matches (abfd, format, matching) - bfd *abfd; - bfd_format format; - char ***matching; -{ - const bfd_target * const *target, *save_targ, *right_targ; - char **matching_vector = NULL; - int match_count; - - if (!bfd_read_p (abfd) || - ((int)(abfd->format) < (int)bfd_unknown) || - ((int)(abfd->format) >= (int)bfd_type_end)) { - bfd_set_error (bfd_error_invalid_operation); - return false; - } - - if (abfd->format != bfd_unknown) - return (abfd->format == format)? true: false; - - - /* Since the target type was defaulted, check them - all in the hope that one will be uniquely recognized. */ - - save_targ = abfd->xvec; - match_count = 0; - if (matching) - { - matching_vector = - (char **) bfd_malloc (sizeof (char *) * - (_bfd_target_vector_entries + 1)); - if (!matching_vector) - return false; - matching_vector[0] = NULL; - *matching = matching_vector; - } - right_targ = 0; - - - /* presume the answer is yes */ - abfd->format = format; - - /* If the target type was explicitly specified, just check that target. */ - - if (!abfd->target_defaulted) { - if (bfd_seek (abfd, (file_ptr)0, SEEK_SET) != 0) /* rewind! */ - return false; - right_targ = BFD_SEND_FMT (abfd, _bfd_check_format, (abfd)); - if (right_targ) { - abfd->xvec = right_targ; /* Set the target as returned */ - if (matching) - free (matching_vector); - return true; /* File position has moved, BTW */ - } - } - - for (target = bfd_target_vector; *target != NULL; target++) { - extern const bfd_target binary_vec; - const bfd_target *temp; - - if (*target == &binary_vec) - continue; - - abfd->xvec = *target; /* Change BFD's target temporarily */ - if (bfd_seek (abfd, (file_ptr)0, SEEK_SET) != 0) - return false; - /* If _bfd_check_format neglects to set bfd_error, assume bfd_error_wrong_format. - We didn't used to even pay any attention to bfd_error, so I suspect - that some _bfd_check_format might have this problem. */ - bfd_set_error (bfd_error_wrong_format); - temp = BFD_SEND_FMT (abfd, _bfd_check_format, (abfd)); - if (temp) { /* This format checks out as ok! */ - right_targ = temp; - if (matching) - { - matching_vector[match_count] = temp->name; - matching_vector[match_count + 1] = NULL; - } - match_count++; - /* If this is the default target, accept it, even if other targets - might match. People who want those other targets have to set - the GNUTARGET variable. */ - if (temp == bfd_default_vector[0]) - { - if (matching) - { - matching_vector[0] = temp->name; - matching_vector[1] = NULL; - } - match_count = 1; - break; - } -#ifdef GNU960 - /* Big- and little-endian b.out archives look the same, but it doesn't - * matter: there is no difference in their headers, and member file byte - * orders will (I hope) be handled appropriately by bfd. Ditto for big - * and little coff archives. And the 4 coff/b.out object formats are - * unambiguous. So accept the first match we find. - */ - break; -#endif - } else if (bfd_get_error () != bfd_error_wrong_format) { - abfd->xvec = save_targ; - abfd->format = bfd_unknown; - if (matching && bfd_get_error () != bfd_error_file_ambiguously_recognized) - free (matching_vector); - return false; - } - } - - if (match_count == 1) { - abfd->xvec = right_targ; /* Change BFD's target permanently */ - if (matching) - free (matching_vector); - return true; /* File position has moved, BTW */ - } - - abfd->xvec = save_targ; /* Restore original target type */ - abfd->format = bfd_unknown; /* Restore original format */ - if (match_count == 0) - { - bfd_set_error (bfd_error_file_not_recognized); - if (matching) - free (matching_vector); - } - else - bfd_set_error (bfd_error_file_ambiguously_recognized); - return false; -} - -/* -FUNCTION - bfd_set_format - -SYNOPSIS - boolean bfd_set_format(bfd *abfd, bfd_format format); - -DESCRIPTION - This function sets the file format of the BFD @var{abfd} to the - format @var{format}. If the target set in the BFD does not - support the format requested, the format is invalid, or the BFD - is not open for writing, then an error occurs. - -*/ - -boolean -bfd_set_format (abfd, format) - bfd *abfd; - bfd_format format; -{ - - if (bfd_read_p (abfd) || - ((int)abfd->format < (int)bfd_unknown) || - ((int)abfd->format >= (int)bfd_type_end)) { - bfd_set_error (bfd_error_invalid_operation); - return false; - } - - if (abfd->format != bfd_unknown) - return (abfd->format == format) ? true:false; - - /* presume the answer is yes */ - abfd->format = format; - - if (!BFD_SEND_FMT (abfd, _bfd_set_format, (abfd))) { - abfd->format = bfd_unknown; - return false; - } - - return true; -} - - -/* -FUNCTION - bfd_format_string - -SYNOPSIS - CONST char *bfd_format_string(bfd_format format); - -DESCRIPTION - Return a pointer to a const string - <>, <>, <>, <>, or <>, - depending upon the value of @var{format}. -*/ - -CONST char * -bfd_format_string (format) - bfd_format format; -{ - if (((int)format <(int) bfd_unknown) - || ((int)format >=(int) bfd_type_end)) - return "invalid"; - - switch (format) { - case bfd_object: - return "object"; /* linker/assember/compiler output */ - case bfd_archive: - return "archive"; /* object archive file */ - case bfd_core: - return "core"; /* core dump */ - default: - return "unknown"; - } -} diff --git a/contrib/gdb/bfd/freebsd.h b/contrib/gdb/bfd/freebsd.h deleted file mode 100644 index 43d29a9..0000000 --- a/contrib/gdb/bfd/freebsd.h +++ /dev/null @@ -1,125 +0,0 @@ -/* BFD back-end definitions used by all FreeBSD targets. - Copyright (C) 1990, 1991, 1992, 1996 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. -*/ - -/* FreeBSD ZMAGIC files never have the header in the text. */ -#define N_HEADER_IN_TEXT(x) 0 - -/* A ZMAGIC file can start at almost any address if it is a kernel. */ -#define TEXT_START_ADDR dont use TEXT_START_ADDR - -/* The following definitions are essentially the same as the ones in - FreeBSD's . They override gdb's versions, which - don't work for kernels. See ../include/aout/aout64.h. */ -#define N_TXTADDR(x) \ - (N_GETMAGIC(x) == OMAGIC || N_GETMAGIC(x) == NMAGIC \ - || N_GETMAGIC(x) == ZMAGIC \ - ? ((x).a_entry < (x).a_text ? 0 : (x).a_entry & ~TARGET_PAGE_SIZE) \ - : TARGET_PAGE_SIZE) -#define N_TXTOFF(x) \ - (N_GETMAGIC(x) == ZMAGIC ? TARGET_PAGE_SIZE \ - : (N_GETMAGIC(x) == QMAGIC || N_GETMAGIC_NET(x) == ZMAGIC) ? 0 \ - : sizeof(struct external_exec)) -#define N_TXTSIZE(x) ((x).a_text) - -#define N_GETMAGIC(exec) \ - ((exec).a_info & 0xffff) -#define N_GETMAGIC_NET(exec) \ - (ntohl ((exec).a_info) & 0xffff) -#define N_GETMID_NET(exec) \ - ((ntohl ((exec).a_info) >> 16) & 0x3ff) -#define N_GETFLAG_NET(ex) \ - ((ntohl ((exec).a_info) >> 26) & 0x3f) - -#define N_MACHTYPE(exec) \ - ((enum machine_type) \ - ((N_GETMAGIC_NET (exec) == ZMAGIC) ? N_GETMID_NET (exec) : \ - ((exec).a_info >> 16) & 0x3ff)) -#define N_FLAGS(exec) \ - ((N_GETMAGIC_NET (exec) == ZMAGIC) ? N_GETFLAG_NET (exec) : \ - ((exec).a_info >> 26) & 0x3f) - -#define N_SET_INFO(exec, magic, type, flags) \ - ((exec).a_info = ((magic) & 0xffff) \ - | (((int)(type) & 0x3ff) << 16) \ - | (((flags) & 0x3f) << 26)) -#define N_SET_MACHTYPE(exec, machtype) \ - ((exec).a_info = \ - ((exec).a_info & 0xfb00ffff) | ((((int)(machtype))&0x3ff) << 16)) -#define N_SET_FLAGS(exec, flags) \ - ((exec).a_info = \ - ((exec).a_info & 0x03ffffff) | ((flags & 0x03f) << 26)) - -#include "bfd.h" -#include "sysdep.h" -#include "libbfd.h" -#include "libaout.h" - -/* On FreeBSD, the magic number is always in correct endian format */ -#define NO_SWAP_MAGIC - - -#define MY_write_object_contents MY(write_object_contents) -static boolean MY(write_object_contents) PARAMS ((bfd *abfd)); - -#include "aout-target.h" - -/* Write an object file. - Section contents have already been written. We write the - file header, symbols, and relocation. */ - -static boolean -MY(write_object_contents) (abfd) - bfd *abfd; -{ - struct external_exec exec_bytes; - struct internal_exec *execp = exec_hdr (abfd); - -#if CHOOSE_RELOC_SIZE - CHOOSE_RELOC_SIZE(abfd); -#else - obj_reloc_entry_size (abfd) = RELOC_STD_SIZE; -#endif - - /* Magic number, maestro, please! */ - switch (bfd_get_arch(abfd)) { - case bfd_arch_m68k: - if (strcmp (abfd->xvec->name, "a.out-m68k4k-netbsd") == 0) - N_SET_MACHTYPE(*execp, M_68K4K_NETBSD); - else - N_SET_MACHTYPE(*execp, M_68K_NETBSD); - break; - case bfd_arch_sparc: - N_SET_MACHTYPE(*execp, M_SPARC_NETBSD); - break; - case bfd_arch_i386: - N_SET_MACHTYPE(*execp, M_386_NETBSD); - break; - case bfd_arch_ns32k: - N_SET_MACHTYPE(*execp, M_532_NETBSD); - break; - default: - N_SET_MACHTYPE(*execp, M_UNKNOWN); - break; - } - - WRITE_HEADERS(abfd, execp); - - return true; -} diff --git a/contrib/gdb/bfd/genlink.h b/contrib/gdb/bfd/genlink.h deleted file mode 100644 index 5f08094..0000000 --- a/contrib/gdb/bfd/genlink.h +++ /dev/null @@ -1,106 +0,0 @@ -/* genlink.h -- interface to the BFD generic linker - Copyright 1993, 1994 Free Software Foundation, Inc. - Written by Ian Lance Taylor, Cygnus Support. - -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 GENLINK_H -#define GENLINK_H - -/* This header file is internal to BFD. It describes the internal - structures and functions used by the BFD generic linker, in case - any of the more specific linkers want to use or call them. Note - that some functions, such as _bfd_generic_link_hash_table_create, - are declared in libbfd.h, because they are expected to be widely - used. The functions and structures in this file will probably only - be used by a few files besides linker.c itself. In fact, this file - is not particularly complete; I have only put in the interfaces I - actually needed. */ - -/* The generic linker uses a hash table which is a derived class of - the standard linker hash table, just as the other backend specific - linkers do. Do not confuse the generic linker hash table with the - standard BFD linker hash table it is built upon. */ - -/* Generic linker hash table entries. */ - -struct generic_link_hash_entry -{ - struct bfd_link_hash_entry root; - /* Whether this symbol has been written out. */ - boolean written; - /* Symbol from input BFD. */ - asymbol *sym; -}; - -/* Generic linker hash table. */ - -struct generic_link_hash_table -{ - struct bfd_link_hash_table root; -}; - -/* Look up an entry in an generic link hash table. */ - -#define _bfd_generic_link_hash_lookup(table, string, create, copy, follow) \ - ((struct generic_link_hash_entry *) \ - bfd_link_hash_lookup (&(table)->root, (string), (create), (copy), (follow))) - -/* Traverse an generic link hash table. */ - -#define _bfd_generic_link_hash_traverse(table, func, info) \ - (bfd_link_hash_traverse \ - (&(table)->root, \ - (boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func), \ - (info))) - -/* Get the generic link hash table from the info structure. This is - just a cast. */ - -#define _bfd_generic_hash_table(p) \ - ((struct generic_link_hash_table *) ((p)->hash)) - -/* The generic linker reads in the asymbol structures for an input BFD - and keeps them in the outsymbol and symcount fields. */ - -#define _bfd_generic_link_get_symbols(abfd) ((abfd)->outsymbols) -#define _bfd_generic_link_get_symcount(abfd) ((abfd)->symcount) - -/* Add the symbols of input_bfd to the symbols being built for - output_bfd. */ -extern boolean _bfd_generic_link_output_symbols - PARAMS ((bfd *output_bfd, bfd *input_bfd, struct bfd_link_info *, - size_t *psymalloc)); - -/* This structure is used to pass information to - _bfd_generic_link_write_global_symbol, which may be called via - _bfd_generic_link_hash_traverse. */ - -struct generic_write_global_symbol_info -{ - struct bfd_link_info *info; - bfd *output_bfd; - size_t *psymalloc; -}; - -/* Write out a single global symbol. This is expected to be called - via _bfd_generic_link_hash_traverse. The second argument must - actually be a struct generic_write_global_symbol_info *. */ -extern boolean _bfd_generic_link_write_global_symbol - PARAMS ((struct generic_link_hash_entry *, PTR)); - -#endif diff --git a/contrib/gdb/bfd/hash.c b/contrib/gdb/bfd/hash.c deleted file mode 100644 index 35913fc..0000000 --- a/contrib/gdb/bfd/hash.c +++ /dev/null @@ -1,734 +0,0 @@ -/* hash.c -- hash table routines for BFD - Copyright (C) 1993, 94 Free Software Foundation, Inc. - Written by Steve Chamberlain - -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 "obstack.h" - -/* -SECTION - Hash Tables - -@cindex Hash tables - BFD provides a simple set of hash table functions. Routines - are provided to initialize a hash table, to free a hash table, - to look up a string in a hash table and optionally create an - entry for it, and to traverse a hash table. There is - currently no routine to delete an string from a hash table. - - The basic hash table does not permit any data to be stored - with a string. However, a hash table is designed to present a - base class from which other types of hash tables may be - derived. These derived types may store additional information - with the string. Hash tables were implemented in this way, - rather than simply providing a data pointer in a hash table - entry, because they were designed for use by the linker back - ends. The linker may create thousands of hash table entries, - and the overhead of allocating private data and storing and - following pointers becomes noticeable. - - The basic hash table code is in <>. - -@menu -@* Creating and Freeing a Hash Table:: -@* Looking Up or Entering a String:: -@* Traversing a Hash Table:: -@* Deriving a New Hash Table Type:: -@end menu - -INODE -Creating and Freeing a Hash Table, Looking Up or Entering a String, Hash Tables, Hash Tables -SUBSECTION - Creating and freeing a hash table - -@findex bfd_hash_table_init -@findex bfd_hash_table_init_n - To create a hash table, create an instance of a <> (defined in <>) and call - <> (if you know approximately how many - entries you will need, the function <>, - which takes a @var{size} argument, may be used). - <> returns <> if some sort of - error occurs. - -@findex bfd_hash_newfunc - The function <> take as an argument a - function to use to create new entries. For a basic hash - table, use the function <>. @xref{Deriving - a New Hash Table Type} for why you would want to use a - different value for this argument. - -@findex bfd_hash_allocate - <> will create an obstack which will be - used to allocate new entries. You may allocate memory on this - obstack using <>. - -@findex bfd_hash_table_free - Use <> to free up all the memory that has - been allocated for a hash table. This will not free up the - <> itself, which you must provide. - -INODE -Looking Up or Entering a String, Traversing a Hash Table, Creating and Freeing a Hash Table, Hash Tables -SUBSECTION - Looking up or entering a string - -@findex bfd_hash_lookup - The function <> is used both to look up a - string in the hash table and to create a new entry. - - If the @var{create} argument is <>, <> - will look up a string. If the string is found, it will - returns a pointer to a <>. If the - string is not found in the table <> will - return <>. You should not modify any of the fields in - the returns <>. - - If the @var{create} argument is <>, the string will be - entered into the hash table if it is not already there. - Either way a pointer to a <> will be - returned, either to the existing structure or to a newly - created one. In this case, a <> return means that an - error occurred. - - If the @var{create} argument is <>, and a new entry is - created, the @var{copy} argument is used to decide whether to - copy the string onto the hash table obstack or not. If - @var{copy} is passed as <>, you must be careful not to - deallocate or modify the string as long as the hash table - exists. - -INODE -Traversing a Hash Table, Deriving a New Hash Table Type, Looking Up or Entering a String, Hash Tables -SUBSECTION - Traversing a hash table - -@findex bfd_hash_traverse - The function <> may be used to traverse a - hash table, calling a function on each element. The traversal - is done in a random order. - - <> takes as arguments a function and a - generic <> pointer. The function is called with a - hash table entry (a <>) and the - generic pointer passed to <>. The function - must return a <> value, which indicates whether to - continue traversing the hash table. If the function returns - <>, <> will stop the traversal and - return immediately. - -INODE -Deriving a New Hash Table Type, , Traversing a Hash Table, Hash Tables -SUBSECTION - Deriving a new hash table type - - Many uses of hash tables want to store additional information - which each entry in the hash table. Some also find it - convenient to store additional information with the hash table - itself. This may be done using a derived hash table. - - Since C is not an object oriented language, creating a derived - hash table requires sticking together some boilerplate - routines with a few differences specific to the type of hash - table you want to create. - - An example of a derived hash table is the linker hash table. - The structures for this are defined in <>. The - functions are in <>. - - You may also derive a hash table from an already derived hash - table. For example, the a.out linker backend code uses a hash - table derived from the linker hash table. - -@menu -@* Define the Derived Structures:: -@* Write the Derived Creation Routine:: -@* Write Other Derived Routines:: -@end menu - -INODE -Define the Derived Structures, Write the Derived Creation Routine, Deriving a New Hash Table Type, Deriving a New Hash Table Type -SUBSUBSECTION - Define the derived structures - - You must define a structure for an entry in the hash table, - and a structure for the hash table itself. - - The first field in the structure for an entry in the hash - table must be of the type used for an entry in the hash table - you are deriving from. If you are deriving from a basic hash - table this is <>, which is defined in - <>. The first field in the structure for the hash - table itself must be of the type of the hash table you are - deriving from itself. If you are deriving from a basic hash - table, this is <>. - - For example, the linker hash table defines <> (in <>). The first field, - <>, is of type <>. Similarly, - the first field in <>, <>, - is of type <>. - -INODE -Write the Derived Creation Routine, Write Other Derived Routines, Define the Derived Structures, Deriving a New Hash Table Type -SUBSUBSECTION - Write the derived creation routine - - You must write a routine which will create and initialize an - entry in the hash table. This routine is passed as the - function argument to <>. - - In order to permit other hash tables to be derived from the - hash table you are creating, this routine must be written in a - standard way. - - The first argument to the creation routine is a pointer to a - hash table entry. This may be <>, in which case the - routine should allocate the right amount of space. Otherwise - the space has already been allocated by a hash table type - derived from this one. - - After allocating space, the creation routine must call the - creation routine of the hash table type it is derived from, - passing in a pointer to the space it just allocated. This - will initialize any fields used by the base hash table. - - Finally the creation routine must initialize any local fields - for the new hash table type. - - Here is a boilerplate example of a creation routine. - @var{function_name} is the name of the routine. - @var{entry_type} is the type of an entry in the hash table you - are creating. @var{base_newfunc} is the name of the creation - routine of the hash table type your hash table is derived - from. - -EXAMPLE - -.struct bfd_hash_entry * -.@var{function_name} (entry, table, string) -. struct bfd_hash_entry *entry; -. struct bfd_hash_table *table; -. const char *string; -.{ -. struct @var{entry_type} *ret = (@var{entry_type} *) entry; -. -. {* Allocate the structure if it has not already been allocated by a -. derived class. *} -. if (ret == (@var{entry_type} *) NULL) -. { -. ret = ((@var{entry_type} *) -. bfd_hash_allocate (table, sizeof (@var{entry_type}))); -. if (ret == (@var{entry_type} *) NULL) -. return NULL; -. } -. -. {* Call the allocation method of the base class. *} -. ret = ((@var{entry_type} *) -. @var{base_newfunc} ((struct bfd_hash_entry *) ret, table, string)); -. -. {* Initialize the local fields here. *} -. -. return (struct bfd_hash_entry *) ret; -.} - -DESCRIPTION - The creation routine for the linker hash table, which is in - <>, looks just like this example. - @var{function_name} is <<_bfd_link_hash_newfunc>>. - @var{entry_type} is <>. - @var{base_newfunc} is <>, the creation - routine for a basic hash table. - - <<_bfd_link_hash_newfunc>> also initializes the local fields - in a linker hash table entry: <>, <> and - <>. - -INODE -Write Other Derived Routines, , Write the Derived Creation Routine, Deriving a New Hash Table Type -SUBSUBSECTION - Write other derived routines - - You will want to write other routines for your new hash table, - as well. - - You will want an initialization routine which calls the - initialization routine of the hash table you are deriving from - and initializes any other local fields. For the linker hash - table, this is <<_bfd_link_hash_table_init>> in <>. - - You will want a lookup routine which calls the lookup routine - of the hash table you are deriving from and casts the result. - The linker hash table uses <> in - <> (this actually takes an additional argument which - it uses to decide how to return the looked up value). - - You may want a traversal routine. This should just call the - traversal routine of the hash table you are deriving from with - appropriate casts. The linker hash table uses - <> in <>. - - These routines may simply be defined as macros. For example, - the a.out backend linker hash table, which is derived from the - linker hash table, uses macros for the lookup and traversal - routines. These are <> and - <> in aoutx.h. -*/ - -/* Obstack allocation and deallocation routines. */ -#define obstack_chunk_alloc malloc -#define obstack_chunk_free free - -/* The default number of entries to use when creating a hash table. */ -#define DEFAULT_SIZE (4051) - -/* Create a new hash table, given a number of entries. */ - -boolean -bfd_hash_table_init_n (table, newfunc, size) - struct bfd_hash_table *table; - struct bfd_hash_entry *(*newfunc) PARAMS ((struct bfd_hash_entry *, - struct bfd_hash_table *, - const char *)); - unsigned int size; -{ - unsigned int alloc; - - alloc = size * sizeof (struct bfd_hash_entry *); - if (!obstack_begin (&table->memory, alloc)) - { - bfd_set_error (bfd_error_no_memory); - return false; - } - table->table = ((struct bfd_hash_entry **) - obstack_alloc (&table->memory, alloc)); - if (!table->table) - { - bfd_set_error (bfd_error_no_memory); - return false; - } - memset ((PTR) table->table, 0, alloc); - table->size = size; - table->newfunc = newfunc; - return true; -} - -/* Create a new hash table with the default number of entries. */ - -boolean -bfd_hash_table_init (table, newfunc) - struct bfd_hash_table *table; - struct bfd_hash_entry *(*newfunc) PARAMS ((struct bfd_hash_entry *, - struct bfd_hash_table *, - const char *)); -{ - return bfd_hash_table_init_n (table, newfunc, DEFAULT_SIZE); -} - -/* Free a hash table. */ - -void -bfd_hash_table_free (table) - struct bfd_hash_table *table; -{ - obstack_free (&table->memory, (PTR) NULL); -} - -/* Look up a string in a hash table. */ - -struct bfd_hash_entry * -bfd_hash_lookup (table, string, create, copy) - struct bfd_hash_table *table; - const char *string; - boolean create; - boolean copy; -{ - register const unsigned char *s; - register unsigned long hash; - register unsigned int c; - struct bfd_hash_entry *hashp; - unsigned int len; - unsigned int index; - - hash = 0; - len = 0; - s = (const unsigned char *) string; - while ((c = *s++) != '\0') - { - hash += c + (c << 17); - hash ^= hash >> 2; - ++len; - } - hash += len + (len << 17); - hash ^= hash >> 2; - - index = hash % table->size; - for (hashp = table->table[index]; - hashp != (struct bfd_hash_entry *) NULL; - hashp = hashp->next) - { - if (hashp->hash == hash - && strcmp (hashp->string, string) == 0) - return hashp; - } - - if (! create) - return (struct bfd_hash_entry *) NULL; - - hashp = (*table->newfunc) ((struct bfd_hash_entry *) NULL, table, string); - if (hashp == (struct bfd_hash_entry *) NULL) - return (struct bfd_hash_entry *) NULL; - if (copy) - { - char *new; - - new = (char *) obstack_alloc (&table->memory, len + 1); - if (!new) - { - bfd_set_error (bfd_error_no_memory); - return (struct bfd_hash_entry *) NULL; - } - strcpy (new, string); - string = new; - } - hashp->string = string; - hashp->hash = hash; - hashp->next = table->table[index]; - table->table[index] = hashp; - - return hashp; -} - -/* Replace an entry in a hash table. */ - -void -bfd_hash_replace (table, old, nw) - struct bfd_hash_table *table; - struct bfd_hash_entry *old; - struct bfd_hash_entry *nw; -{ - unsigned int index; - struct bfd_hash_entry **pph; - - index = old->hash % table->size; - for (pph = &table->table[index]; - (*pph) != (struct bfd_hash_entry *) NULL; - pph = &(*pph)->next) - { - if (*pph == old) - { - *pph = nw; - return; - } - } - - abort (); -} - -/* Base method for creating a new hash table entry. */ - -/*ARGSUSED*/ -struct bfd_hash_entry * -bfd_hash_newfunc (entry, table, string) - struct bfd_hash_entry *entry; - struct bfd_hash_table *table; - const char *string; -{ - if (entry == (struct bfd_hash_entry *) NULL) - entry = ((struct bfd_hash_entry *) - bfd_hash_allocate (table, sizeof (struct bfd_hash_entry))); - return entry; -} - -/* Allocate space in a hash table. */ - -PTR -bfd_hash_allocate (table, size) - struct bfd_hash_table *table; - unsigned int size; -{ - PTR ret; - - ret = obstack_alloc (&table->memory, size); - if (ret == NULL && size != 0) - bfd_set_error (bfd_error_no_memory); - return ret; -} - -/* Traverse a hash table. */ - -void -bfd_hash_traverse (table, func, info) - struct bfd_hash_table *table; - boolean (*func) PARAMS ((struct bfd_hash_entry *, PTR)); - PTR info; -{ - unsigned int i; - - for (i = 0; i < table->size; i++) - { - struct bfd_hash_entry *p; - - for (p = table->table[i]; p != NULL; p = p->next) - { - if (! (*func) (p, info)) - return; - } - } -} - -/* A few different object file formats (a.out, COFF, ELF) use a string - table. These functions support adding strings to a string table, - returning the byte offset, and writing out the table. - - Possible improvements: - + look for strings matching trailing substrings of other strings - + better data structures? balanced trees? - + look at reducing memory use elsewhere -- maybe if we didn't have - to construct the entire symbol table at once, we could get by - with smaller amounts of VM? (What effect does that have on the - string table reductions?) */ - -/* An entry in the strtab hash table. */ - -struct strtab_hash_entry -{ - struct bfd_hash_entry root; - /* Index in string table. */ - bfd_size_type index; - /* Next string in strtab. */ - struct strtab_hash_entry *next; -}; - -/* The strtab hash table. */ - -struct bfd_strtab_hash -{ - struct bfd_hash_table table; - /* Size of strtab--also next available index. */ - bfd_size_type size; - /* First string in strtab. */ - struct strtab_hash_entry *first; - /* Last string in strtab. */ - struct strtab_hash_entry *last; - /* Whether to precede strings with a two byte length, as in the - XCOFF .debug section. */ - boolean xcoff; -}; - -static struct bfd_hash_entry *strtab_hash_newfunc - PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); - -/* Routine to create an entry in a strtab. */ - -static struct bfd_hash_entry * -strtab_hash_newfunc (entry, table, string) - struct bfd_hash_entry *entry; - struct bfd_hash_table *table; - const char *string; -{ - struct strtab_hash_entry *ret = (struct strtab_hash_entry *) entry; - - /* Allocate the structure if it has not already been allocated by a - subclass. */ - if (ret == (struct strtab_hash_entry *) NULL) - ret = ((struct strtab_hash_entry *) - bfd_hash_allocate (table, sizeof (struct strtab_hash_entry))); - if (ret == (struct strtab_hash_entry *) NULL) - return NULL; - - /* Call the allocation method of the superclass. */ - ret = ((struct strtab_hash_entry *) - bfd_hash_newfunc ((struct bfd_hash_entry *) ret, table, string)); - - if (ret) - { - /* Initialize the local fields. */ - ret->index = (bfd_size_type) -1; - ret->next = NULL; - } - - return (struct bfd_hash_entry *) ret; -} - -/* Look up an entry in an strtab. */ - -#define strtab_hash_lookup(t, string, create, copy) \ - ((struct strtab_hash_entry *) \ - bfd_hash_lookup (&(t)->table, (string), (create), (copy))) - -/* Create a new strtab. */ - -struct bfd_strtab_hash * -_bfd_stringtab_init () -{ - struct bfd_strtab_hash *table; - - table = ((struct bfd_strtab_hash *) - bfd_malloc (sizeof (struct bfd_strtab_hash))); - if (table == NULL) - return NULL; - - if (! bfd_hash_table_init (&table->table, strtab_hash_newfunc)) - { - free (table); - return NULL; - } - - table->size = 0; - table->first = NULL; - table->last = NULL; - table->xcoff = false; - - return table; -} - -/* Create a new strtab in which the strings are output in the format - used in the XCOFF .debug section: a two byte length precedes each - string. */ - -struct bfd_strtab_hash * -_bfd_xcoff_stringtab_init () -{ - struct bfd_strtab_hash *ret; - - ret = _bfd_stringtab_init (); - if (ret != NULL) - ret->xcoff = true; - return ret; -} - -/* Free a strtab. */ - -void -_bfd_stringtab_free (table) - struct bfd_strtab_hash *table; -{ - bfd_hash_table_free (&table->table); - free (table); -} - -/* Get the index of a string in a strtab, adding it if it is not - already present. If HASH is false, we don't really use the hash - table, and we don't eliminate duplicate strings. */ - -bfd_size_type -_bfd_stringtab_add (tab, str, hash, copy) - struct bfd_strtab_hash *tab; - const char *str; - boolean hash; - boolean copy; -{ - register struct strtab_hash_entry *entry; - - if (hash) - { - entry = strtab_hash_lookup (tab, str, true, copy); - if (entry == NULL) - return (bfd_size_type) -1; - } - else - { - entry = ((struct strtab_hash_entry *) - bfd_hash_allocate (&tab->table, - sizeof (struct strtab_hash_entry))); - if (entry == NULL) - return (bfd_size_type) -1; - if (! copy) - entry->root.string = str; - else - { - char *n; - - n = (char *) bfd_hash_allocate (&tab->table, strlen (str) + 1); - if (n == NULL) - return (bfd_size_type) -1; - entry->root.string = n; - } - entry->index = (bfd_size_type) -1; - entry->next = NULL; - } - - if (entry->index == (bfd_size_type) -1) - { - entry->index = tab->size; - tab->size += strlen (str) + 1; - if (tab->xcoff) - { - entry->index += 2; - tab->size += 2; - } - if (tab->first == NULL) - tab->first = entry; - else - tab->last->next = entry; - tab->last = entry; - } - - return entry->index; -} - -/* Get the number of bytes in a strtab. */ - -bfd_size_type -_bfd_stringtab_size (tab) - struct bfd_strtab_hash *tab; -{ - return tab->size; -} - -/* Write out a strtab. ABFD must already be at the right location in - the file. */ - -boolean -_bfd_stringtab_emit (abfd, tab) - register bfd *abfd; - struct bfd_strtab_hash *tab; -{ - register boolean xcoff; - register struct strtab_hash_entry *entry; - - xcoff = tab->xcoff; - - for (entry = tab->first; entry != NULL; entry = entry->next) - { - register const char *str; - register size_t len; - - str = entry->root.string; - len = strlen (str) + 1; - - if (xcoff) - { - bfd_byte buf[2]; - - /* The output length includes the null byte. */ - bfd_put_16 (abfd, len, buf); - if (bfd_write ((PTR) buf, 1, 2, abfd) != 2) - return false; - } - - if (bfd_write ((PTR) str, 1, len, abfd) != len) - return false; - } - - return true; -} diff --git a/contrib/gdb/bfd/hosts/alphalinux.h b/contrib/gdb/bfd/hosts/alphalinux.h deleted file mode 100644 index d9ba1b7..0000000 --- a/contrib/gdb/bfd/hosts/alphalinux.h +++ /dev/null @@ -1,6 +0,0 @@ -/* Linux dumps "struct task_struct" at the end of the core-file. This - structure is currently 920 bytes long, but we allow up to 1024 - bytes to allow for some future growth. */ -#define TRAD_CORE_EXTRA_SIZE_ALLOWED 1024 -#define TRAD_UNIX_CORE_FILE_FAILING_SIGNAL(abfd) \ - ((abfd)->tdata.trad_core_data->u.signal) diff --git a/contrib/gdb/bfd/hosts/decstation.h b/contrib/gdb/bfd/hosts/decstation.h deleted file mode 100644 index a80c143..0000000 --- a/contrib/gdb/bfd/hosts/decstation.h +++ /dev/null @@ -1,17 +0,0 @@ -/* Hopefully this should include either machine/param.h (Ultrix) or - machine/machparam.h (Mach), whichever is its name on this system. */ -#include - -#include - -#define HOST_PAGE_SIZE NBPG -/* #define HOST_SEGMENT_SIZE NBPG -- we use HOST_DATA_START_ADDR */ -#define HOST_MACHINE_ARCH bfd_arch_mips -/* #define HOST_MACHINE_MACHINE */ - -#define HOST_TEXT_START_ADDR USRTEXT -#define HOST_DATA_START_ADDR USRDATA -#define HOST_STACK_END_ADDR USRSTACK - -#define TRAD_UNIX_CORE_FILE_FAILING_SIGNAL(core_bfd) \ - ((core_bfd)->tdata.trad_core_data->u.u_arg[0]) diff --git a/contrib/gdb/bfd/hosts/delta68.h b/contrib/gdb/bfd/hosts/delta68.h deleted file mode 100644 index 1a6a6e6..0000000 --- a/contrib/gdb/bfd/hosts/delta68.h +++ /dev/null @@ -1,18 +0,0 @@ -/* Definitions for a Motorola Delta 3300 box running System V R3.0. - Contributed by manfred@lts.sel.alcatel.de. */ - -#include - -/* Definitions used by trad-core.c. */ -#define NBPG NBPC -#define HOST_DATA_START_ADDR u.u_exdata.ux_datorg -#define HOST_TEXT_START_ADDR u.u_exdata.ux_txtorg -#if 0 -#define HOST_STACK_END_ADDR 0x40000000 -#else -/* User's stack, copied from sys/param.h */ -#define HOST_STACK_END_ADDR USRSTACK -#endif -#define UPAGES USIZE -#define TRAD_UNIX_CORE_FILE_FAILING_SIGNAL(abfd) \ - abfd->tdata.trad_core_data->u.u_abort diff --git a/contrib/gdb/bfd/hosts/dpx2.h b/contrib/gdb/bfd/hosts/dpx2.h deleted file mode 100644 index ea6395f..0000000 --- a/contrib/gdb/bfd/hosts/dpx2.h +++ /dev/null @@ -1,8 +0,0 @@ -/* Definitions that are needed for core files. Core section sizes for - the DPX2 are in bytes. */ - -#include -#define NBPG 1 -#define UPAGES (USIZE * NBPP) -#define HOST_DATA_START_ADDR (u.u_exdata.ux_datorg) -#define HOST_STACK_END_ADDR (USERSTACK) diff --git a/contrib/gdb/bfd/hosts/hp300bsd.h b/contrib/gdb/bfd/hosts/hp300bsd.h deleted file mode 100644 index 9828717..0000000 --- a/contrib/gdb/bfd/hosts/hp300bsd.h +++ /dev/null @@ -1,13 +0,0 @@ -#include -#ifdef BSD4_4 -#define NO_CORE_COMMAND -#endif - -#define HOST_PAGE_SIZE NBPG -#define HOST_SEGMENT_SIZE NBPG /* Data seg start addr rounds to NBPG */ -#define HOST_MACHINE_ARCH bfd_arch_m68k -/* #define HOST_MACHINE_MACHINE */ - -#define HOST_TEXT_START_ADDR 0 -#define HOST_STACK_END_ADDR 0xfff00000 -#define HOST_BIG_ENDIAN_P diff --git a/contrib/gdb/bfd/hosts/i386bsd.h b/contrib/gdb/bfd/hosts/i386bsd.h deleted file mode 100644 index ac0d840..0000000 --- a/contrib/gdb/bfd/hosts/i386bsd.h +++ /dev/null @@ -1,25 +0,0 @@ -/* Intel 386 running any BSD Unix */ - -#include -#include - -#define HOST_PAGE_SIZE NBPG -#define HOST_MACHINE_ARCH bfd_arch_i386 -#define HOST_TEXT_START_ADDR USRTEXT - -/* Jolitz suggested defining HOST_STACK_END_ADDR to - (u.u_kproc.kp_eproc.e_vm.vm_maxsaddr + MAXSSIZ), which should work on - both BSDI and 386BSD, but that is believed not to work for BSD 4.4. */ - -#ifdef __bsdi__ -/* This seems to be the right thing for BSDI. */ -#define HOST_STACK_END_ADDR USRSTACK -#define HOST_DATA_START_ADDR ((bfd_vma)u.u_kproc.kp_eproc.e_vm.vm_daddr) -#else -/* This seems to be the right thing for 386BSD release 0.1. */ -#define HOST_STACK_END_ADDR (USRSTACK - MAXSSIZ) -#endif - -#define TRAD_UNIX_CORE_FILE_FAILING_SIGNAL(core_bfd) \ - ((core_bfd)->tdata.trad_core_data->u.u_sig) -#define u_comm u_kproc.kp_proc.p_comm diff --git a/contrib/gdb/bfd/hosts/i386linux.h b/contrib/gdb/bfd/hosts/i386linux.h deleted file mode 100644 index 13a51f1..0000000 --- a/contrib/gdb/bfd/hosts/i386linux.h +++ /dev/null @@ -1,8 +0,0 @@ -/* Linux writes the task structure at the end of the core file. Currently it - is 2912 bytes. It is possible that this should be a pickier check, but - we should probably not be too picky (the size of the task structure might - vary, and if it's not the length we expect it to be, it doesn't affect - our ability to process the core file). So allow 0-4096 extra bytes at - the end. */ - -#define TRAD_CORE_EXTRA_SIZE_ALLOWED 4096 diff --git a/contrib/gdb/bfd/hosts/i386mach3.h b/contrib/gdb/bfd/hosts/i386mach3.h deleted file mode 100644 index dcc61e3..0000000 --- a/contrib/gdb/bfd/hosts/i386mach3.h +++ /dev/null @@ -1,25 +0,0 @@ -#include -#include - -/* This is an ugly way to hack around the incorrect - * definition of UPAGES in i386/machparam.h. - * - * The definition should specify the size reserved - * for "struct user" in core files in PAGES, - * but instead it gives it in 512-byte core-clicks - * for i386 and i860. UPAGES is used only in trad-core.c. - */ -#if UPAGES == 16 -#undef UPAGES -#define UPAGES 2 -#endif - -#if UPAGES != 2 -FIXME!! UPAGES is neither 2 nor 16 -#endif - -#define HOST_PAGE_SIZE 1 -#define HOST_SEGMENT_SIZE NBPG -#define HOST_MACHINE_ARCH bfd_arch_i386 -#define HOST_TEXT_START_ADDR USRTEXT -#define HOST_STACK_END_ADDR USRSTACK diff --git a/contrib/gdb/bfd/hosts/i386sco.h b/contrib/gdb/bfd/hosts/i386sco.h deleted file mode 100644 index ec8608c..0000000 --- a/contrib/gdb/bfd/hosts/i386sco.h +++ /dev/null @@ -1,19 +0,0 @@ -/* Core file stuff. At least some, perhaps all, of the following - defines work on many more systems than just SCO. */ - -#define NBPG NBPC -#define UPAGES USIZE -#define HOST_DATA_START_ADDR u.u_exdata.ux_datorg -#define HOST_STACK_START_ADDR u.u_sub -#define TRAD_UNIX_CORE_FILE_FAILING_SIGNAL(abfd) \ - ((core_upage(abfd)->u_sysabort != 0) \ - ? core_upage(abfd)->u_sysabort \ - : -1) - -/* According to the manpage, a version 2 SCO corefile can contain - various additional sections (it is cleverly arranged so the u area, - data, and stack are first where we can find them). So without - writing lots of code to parse all their headers and stuff, we can't - know whether a corefile is bigger than it should be. */ - -#define TRAD_CORE_ALLOW_ANY_EXTRA_SIZE 1 diff --git a/contrib/gdb/bfd/hosts/i860mach3.h b/contrib/gdb/bfd/hosts/i860mach3.h deleted file mode 100644 index edd2aa1..0000000 --- a/contrib/gdb/bfd/hosts/i860mach3.h +++ /dev/null @@ -1,27 +0,0 @@ -/* This file was hacked from i386mach3.h [dolan@ssd.intel.com] */ - -#include -#include - -/* This is an ugly way to hack around the incorrect - * definition of UPAGES in i386/machparam.h. - * - * The definition should specify the size reserved - * for "struct user" in core files in PAGES, - * but instead it gives it in 512-byte core-clicks - * for i386 and i860. UPAGES is used only in trad-core.c. - */ -#if UPAGES == 16 -#undef UPAGES -#define UPAGES 2 -#endif - -#if UPAGES != 2 -FIXME!! UPAGES is neither 2 nor 16 -#endif - -#define HOST_PAGE_SIZE 1 -#define HOST_SEGMENT_SIZE NBPG -#define HOST_MACHINE_ARCH bfd_arch_i860 -#define HOST_TEXT_START_ADDR USRTEXT -#define HOST_STACK_END_ADDR USRSTACK diff --git a/contrib/gdb/bfd/hosts/m68kaux.h b/contrib/gdb/bfd/hosts/m68kaux.h deleted file mode 100644 index 6237755..0000000 --- a/contrib/gdb/bfd/hosts/m68kaux.h +++ /dev/null @@ -1,16 +0,0 @@ -/* Definitions for an Apple Macintosh running A/UX 3.x. */ - -#include -#include - -/* Definitions used by trad-core.c. */ -#define NBPG NBPP - -#define HOST_DATA_START_ADDR u.u_exdata.ux_datorg -#define HOST_TEXT_START_ADDR u.u_exdata.ux_txtorg -#define HOST_STACK_END_ADDR 0x100000000 - -#define UPAGES USIZE - -#define TRAD_UNIX_CORE_FILE_FAILING_SIGNAL(abfd) \ - (abfd->tdata.trad_core_data->u.u_arg[0]) diff --git a/contrib/gdb/bfd/hosts/m68klinux.h b/contrib/gdb/bfd/hosts/m68klinux.h deleted file mode 100644 index 0067dfa..0000000 --- a/contrib/gdb/bfd/hosts/m68klinux.h +++ /dev/null @@ -1,6 +0,0 @@ -/* Linux dumps "struct task_struct" at the end of the core-file. This - structure is currently 2512 bytes long, but we allow up to 4096 - bytes to allow for some future growth. */ -#define TRAD_CORE_EXTRA_SIZE_ALLOWED 4096 -#define TRAD_UNIX_CORE_FILE_FAILING_SIGNAL(abfd) \ - ((abfd)->tdata.trad_core_data->u.signal) diff --git a/contrib/gdb/bfd/hosts/m88kmach3.h b/contrib/gdb/bfd/hosts/m88kmach3.h deleted file mode 100644 index 4215538..0000000 --- a/contrib/gdb/bfd/hosts/m88kmach3.h +++ /dev/null @@ -1,11 +0,0 @@ -#include -#include - -#undef UPAGES -#define UPAGES 3 - -#define HOST_PAGE_SIZE NBPG -#define HOST_SEGMENT_SIZE NBPG -#define HOST_MACHINE_ARCH bfd_arch_m88k -#define HOST_TEXT_START_ADDR USRTEXT -#define HOST_STACK_END_ADDR USRSTACK diff --git a/contrib/gdb/bfd/hosts/mipsbsd.h b/contrib/gdb/bfd/hosts/mipsbsd.h deleted file mode 100644 index a2fad21..0000000 --- a/contrib/gdb/bfd/hosts/mipsbsd.h +++ /dev/null @@ -1,12 +0,0 @@ -#include -#include -#undef ALIGN - -#define HOST_PAGE_SIZE NBPG -/* #define HOST_SEGMENT_SIZE NBPG -- we use HOST_DATA_START_ADDR */ -#define HOST_MACHINE_ARCH bfd_arch_mips -/* #define HOST_MACHINE_MACHINE */ - -#define HOST_TEXT_START_ADDR USRTEXT -#define HOST_STACK_END_ADDR USRSTACK -#define NO_CORE_COMMAND diff --git a/contrib/gdb/bfd/hosts/mipsmach3.h b/contrib/gdb/bfd/hosts/mipsmach3.h deleted file mode 100644 index c5c468d..0000000 --- a/contrib/gdb/bfd/hosts/mipsmach3.h +++ /dev/null @@ -1,10 +0,0 @@ -#include -#include -#include - -#define HOST_PAGE_SIZE NBPG -/* #define HOST_SEGMENT_SIZE NBPG */ -#define HOST_MACHINE_ARCH bfd_arch_mips -#define HOST_TEXT_START_ADDR USRTEXT -#define HOST_DATA_START_ADDR USRDATA -#define HOST_STACK_END_ADDR USRSTACK diff --git a/contrib/gdb/bfd/hosts/news-mips.h b/contrib/gdb/bfd/hosts/news-mips.h deleted file mode 100644 index 9e799be..0000000 --- a/contrib/gdb/bfd/hosts/news-mips.h +++ /dev/null @@ -1,12 +0,0 @@ -/* Sony News running NewsOS 3.2. */ - -#include -#include - -#define HOST_PAGE_SIZE NBPG - -#define HOST_MACHINE_ARCH bfd_arch_mips - -#define HOST_TEXT_START_ADDR USRTEXT -#define HOST_DATA_START_ADDR USRDATA -#define HOST_STACK_END_ADDR USRSTACK diff --git a/contrib/gdb/bfd/hosts/news.h b/contrib/gdb/bfd/hosts/news.h deleted file mode 100644 index bf7946c..0000000 --- a/contrib/gdb/bfd/hosts/news.h +++ /dev/null @@ -1,9 +0,0 @@ -/* Sony News running NewsOS 3.2. */ - -#include - -#define HOST_PAGE_SIZE NBPG -#define HOST_SEGMENT_SIZE NBPG -#define HOST_MACHINE_ARCH bfd_arch_m68k -#define HOST_TEXT_START_ADDR 0 -#define HOST_STACK_END_ADDR (KERNBASE - (UPAGES * NBPG)) diff --git a/contrib/gdb/bfd/hosts/pc532mach.h b/contrib/gdb/bfd/hosts/pc532mach.h deleted file mode 100644 index ab96f59..0000000 --- a/contrib/gdb/bfd/hosts/pc532mach.h +++ /dev/null @@ -1,24 +0,0 @@ -#include -#include - -/* This is an ugly way to hack around the incorrect - * definition of UPAGES in ns532/machparam.h. - * - * The definition should specify the size reserved - * for "struct user" in core files in PAGES, - * but instead it gives it in 512-byte core-clicks - * for ns532, i386 and i860. UPAGES is used only in trad-core.c. - */ -#if UPAGES == 16 -#undef UPAGES -#define UPAGES 2 -#endif - -#if UPAGES != 2 -#error UPAGES is neither 2 nor 16 -#endif - -#define HOST_PAGE_SIZE 1 -#define HOST_SEGMENT_SIZE NBPG -#define HOST_TEXT_START_ADDR USRTEXT -#define HOST_STACK_END_ADDR USRSTACK diff --git a/contrib/gdb/bfd/hosts/riscos.h b/contrib/gdb/bfd/hosts/riscos.h deleted file mode 100644 index 8ffa826..0000000 --- a/contrib/gdb/bfd/hosts/riscos.h +++ /dev/null @@ -1,10 +0,0 @@ -/* RISC/os 4.52C, and presumably other versions. */ - -#include -#include - -#define NBPG BSD43_NBPG -#define UPAGES BSD43_UPAGES -#define HOST_TEXT_START_ADDR BSD43_USRTEXT -#define HOST_DATA_START_ADDR BSD43_USRDATA -#define HOST_STACK_END_ADDR BSD43_USRSTACK diff --git a/contrib/gdb/bfd/hosts/symmetry.h b/contrib/gdb/bfd/hosts/symmetry.h deleted file mode 100644 index 75717b3..0000000 --- a/contrib/gdb/bfd/hosts/symmetry.h +++ /dev/null @@ -1,20 +0,0 @@ -/* Symmetry running either dynix 3.1 (bsd) or ptx (sysv). */ - -#define NBPG 4096 -#define UPAGES 1 - -#ifdef _SEQUENT_ -/* ptx */ -#define HOST_TEXT_START_ADDR 0 -#define HOST_STACK_END_ADDR 0x3fffe000 -#define TRAD_CORE_USER_OFFSET ((UPAGES * NBPG) - sizeof (struct user)) -#else -/* dynix */ -#define HOST_TEXT_START_ADDR 0x1000 -#define HOST_DATA_START_ADDR (NBPG * u.u_tsize) -#define HOST_STACK_END_ADDR 0x3ffff000 -#define TRAD_UNIX_CORE_FILE_FAILING_SIGNAL(core_bfd) \ - ((core_bfd)->tdata.trad_core_data->u.u_arg[0]) -#endif - -#define TRAD_CORE_DSIZE_INCLUDES_TSIZE diff --git a/contrib/gdb/bfd/hosts/tahoe.h b/contrib/gdb/bfd/hosts/tahoe.h deleted file mode 100644 index 716cee2..0000000 --- a/contrib/gdb/bfd/hosts/tahoe.h +++ /dev/null @@ -1,12 +0,0 @@ -#define NO_CORE_COMMAND - -#undef ALIGN /* They use it, we use it too */ -#include -#undef ALIGN /* They use it, we use it too */ - -#define HOST_PAGE_SIZE NBPG -#define HOST_MACHINE_ARCH bfd_arch_tahoe - -#define HOST_TEXT_START_ADDR 0 -#define HOST_STACK_END_ADDR (KERNBASE - (UPAGES * NBPG)) -#define HOST_BIG_ENDIAN_P diff --git a/contrib/gdb/bfd/hosts/vaxbsd.h b/contrib/gdb/bfd/hosts/vaxbsd.h deleted file mode 100644 index ceb9cce..0000000 --- a/contrib/gdb/bfd/hosts/vaxbsd.h +++ /dev/null @@ -1,19 +0,0 @@ -#define NO_CORE_COMMAND /* No command name in core file */ - -#if 0 -#undef ALIGN /* They use it, we use it too */ -/* Does not exist on BSD 4.3, it uses machine/machparam.h. - Whatever it is, it's included by , which trad-core.c, - the only place that uses this (I think), already includes. */ -#include -#endif -#undef ALIGN /* They use it, we use it too */ - -/* Note that HOST_PAGE_SIZE -- the page size as far as executable files - are concerned -- is not the same as NBPG, because of page clustering. */ -#define HOST_PAGE_SIZE 1024 -#define HOST_MACHINE_ARCH bfd_arch_vax - -#define HOST_TEXT_START_ADDR 0 -#define HOST_STACK_END_ADDR (0x80000000 - (UPAGES * NBPG)) -#undef HOST_BIG_ENDIAN_P diff --git a/contrib/gdb/bfd/hosts/vaxult.h b/contrib/gdb/bfd/hosts/vaxult.h deleted file mode 100644 index 13731b7..0000000 --- a/contrib/gdb/bfd/hosts/vaxult.h +++ /dev/null @@ -1,8 +0,0 @@ -#include -#include -#define HOST_PAGE_SIZE (NBPG*CLSIZE) -#define HOST_MACHINE_ARCH bfd_arch_vax - -#define HOST_TEXT_START_ADDR USRTEXT -#define HOST_STACK_END_ADDR USRSTACK -#undef HOST_BIG_ENDIAN_P diff --git a/contrib/gdb/bfd/hosts/vaxult2.h b/contrib/gdb/bfd/hosts/vaxult2.h deleted file mode 100644 index 13731b7..0000000 --- a/contrib/gdb/bfd/hosts/vaxult2.h +++ /dev/null @@ -1,8 +0,0 @@ -#include -#include -#define HOST_PAGE_SIZE (NBPG*CLSIZE) -#define HOST_MACHINE_ARCH bfd_arch_vax - -#define HOST_TEXT_START_ADDR USRTEXT -#define HOST_STACK_END_ADDR USRSTACK -#undef HOST_BIG_ENDIAN_P diff --git a/contrib/gdb/bfd/i386aout.c b/contrib/gdb/bfd/i386aout.c deleted file mode 100644 index 0801832..0000000 --- a/contrib/gdb/bfd/i386aout.c +++ /dev/null @@ -1,68 +0,0 @@ -/* BFD back-end for i386 a.out binaries. - Copyright 1990, 1991, 1992 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. */ - - -/* The only 386 aout system we have here is GO32 from DJ. - These numbers make BFD work with that. If your aout 386 system - doesn't work with these, we'll have to split them into different - files. Send me (sac@cygnus.com) the runes to make it work on your - system, and I'll stick it in for the next release. */ - -#define N_HEADER_IN_TEXT(x) 0 -#define BYTES_IN_WORD 4 - -#define N_TXTOFF(x) 0x20 -#define N_TXTADDR(x) (N_MAGIC(x)==ZMAGIC ? 0x1020 : 0) - -#define N_TXTSIZE(x) ((x).a_text) -#if 0 -#define N_DATADDR(x) (N_MAGIC(x)==OMAGIC? (N_TXTADDR(x)+(x).a_text) : (SEGMENT_SIZE + ((0x1020+(x).a_text-1) & ~(SEGMENT_SIZE-1)))) -#define NOSUBEXECB - -#endif -#define TARGET_PAGE_SIZE 4096 -#define SEGMENT_SIZE 0x400000 -#define DEFAULT_ARCH bfd_arch_i386 - -#define MY(OP) CAT(i386aout_,OP) -#define TARGETNAME "a.out-i386" -#define NO_WRITE_HEADER_KLUDGE 1 - -#include "bfd.h" -#include "sysdep.h" -#include "libbfd.h" -#include "libaout.h" -static boolean MY(set_sizes)(); -#define MY_backend_data &MY(backend_data) -static CONST struct aout_backend_data MY(backend_data) = { - 0, /* zmagic contiguous */ - 1, /* text incl header */ - 0, /* exec_hdr_flags */ - 0, /* text vma? */ - MY(set_sizes), - 1, /* exec header not counted */ - 0, /* add_dynamic_symbols */ - 0, /* add_one_symbol */ - 0, /* link_dynamic_object */ - 0, /* write_dynamic_symbol */ - 0, /* check_dynamic_reloc */ - 0 /* finish_dynamic_link */ -}; - -#include "aout-target.h" diff --git a/contrib/gdb/bfd/i386bsd.c b/contrib/gdb/bfd/i386bsd.c deleted file mode 100644 index 2328fe3..0000000 --- a/contrib/gdb/bfd/i386bsd.c +++ /dev/null @@ -1,46 +0,0 @@ -/* BFD back-end for i386 a.out binaries under BSD. - Copyright (C) 1990, 1991, 1992 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. */ - -/* This data should be correct for the format used under all the various - BSD ports for 386 machines. */ - -#define BYTES_IN_WORD 4 - -/* ZMAGIC files never have the header in the text. */ -#define N_HEADER_IN_TEXT(x) 0 - -/* ZMAGIC files start at address 0. This does not apply to QMAGIC. */ -#define TEXT_START_ADDR 0 -#define N_SHARED_LIB(x) 0 - -#define TARGET_PAGE_SIZE 4096 -#define SEGMENT_SIZE TARGET_PAGE_SIZE - -#define DEFAULT_ARCH bfd_arch_i386 -#define MACHTYPE_OK(mtype) ((mtype) == M_386 || (mtype) == M_UNKNOWN) - -#define MY(OP) CAT(i386bsd_,OP) -#define TARGETNAME "a.out-i386-bsd" - -#include "bfd.h" -#include "sysdep.h" -#include "libbfd.h" -#include "libaout.h" - -#include "aout-target.h" diff --git a/contrib/gdb/bfd/i386freebsd.c b/contrib/gdb/bfd/i386freebsd.c deleted file mode 100644 index 7a6371b..0000000 --- a/contrib/gdb/bfd/i386freebsd.c +++ /dev/null @@ -1,33 +0,0 @@ -/* BFD back-end for FreeBSD/386 a.out-ish binaries. - Copyright (C) 1990, 1991, 1992, 1996 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 4096 -#define SEGMENT_SIZE TARGET_PAGE_SIZE - -#define DEFAULT_ARCH bfd_arch_i386 -#define MACHTYPE_OK(mtype) ((mtype) == M_386_NETBSD || (mtype) == M_UNKNOWN) - -#define MY(OP) CAT(i386freebsd_,OP) -/* This needs to start with a.out so GDB knows it is an a.out variant. */ -#define TARGETNAME "a.out-i386-freebsd" - -#include "freebsd.h" diff --git a/contrib/gdb/bfd/ihex.c b/contrib/gdb/bfd/ihex.c deleted file mode 100644 index 80140da..0000000 --- a/contrib/gdb/bfd/ihex.c +++ /dev/null @@ -1,1005 +0,0 @@ -/* BFD back-end for Intel Hex objects. - Copyright 1995 Free Software Foundation, Inc. - Written by Ian Lance Taylor of Cygnus Support . - -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. */ - -/* This is what Intel Hex files look like: - -1. INTEL FORMATS - -A. Intel 1 - - 16-bit address-field format, for files 64k bytes in length or less. - - DATA RECORD - Byte 1 Header = colon(:) - 2..3 The number of data bytes in hex notation - 4..5 High byte of the record load address - 6..7 Low byte of the record load address - 8..9 Record type, must be "00" - 10..x Data bytes in hex notation: - x = (number of bytes - 1) * 2 + 11 - x+1..x+2 Checksum in hex notation - x+3..x+4 Carriage return, line feed - - END RECORD - Byte 1 Header = colon (:) - 2..3 The byte count, must be "00" - 4..7 Transfer-address (usually "0000") - the jump-to address, execution start address - 8..9 Record type, must be "01" - 10..11 Checksum, in hex notation - 12..13 Carriage return, line feed - -B. INTEL 2 - - MCS-86 format, using a 20-bit address for files larger than 64K bytes. - - DATA RECORD - Byte 1 Header = colon (:) - 2..3 The byte count of this record, hex notation - 4..5 High byte of the record load address - 6..7 Low byte of the record load address - 8..9 Record type, must be "00" - 10..x The data bytes in hex notation: - x = (number of data bytes - 1) * 2 + 11 - x+1..x+2 Checksum in hex notation - x+3..x+4 Carriage return, line feed - - EXTENDED ADDRESS RECORD - Byte 1 Header = colon(:) - 2..3 The byte count, must be "02" - 4..7 Load address, must be "0000" - 8..9 Record type, must be "02" - 10..11 High byte of the offset address - 12..13 Low byte of the offset address - 14..15 Checksum in hex notation - 16..17 Carriage return, line feed - - The checksums are the two's complement of the 8-bit sum - without carry of the byte count, offset address, and the - record type. - - START ADDRESS RECORD - Byte 1 Header = colon (:) - 2..3 The byte count, must be "04" - 4..7 Load address, must be "0000" - 8..9 Record type, must be "03" - 10..13 8086 CS value - 14..17 8086 IP value - 18..19 Checksum in hex notation - 20..21 Carriage return, line feed - -Another document reports these additional types: - - EXTENDED LINEAR ADDRESS RECORD - Byte 1 Header = colon (:) - 2..3 The byte count, must be "02" - 4..7 Load address, must be "0000" - 8..9 Record type, must be "04" - 10..13 Upper 16 bits of address of subsequent records - 14..15 Checksum in hex notation - 16..17 Carriage return, line feed - - START LINEAR ADDRESS RECORD - Byte 1 Header = colon (:) - 2..3 The byte count, must be "02" - 4..7 Load address, must be "0000" - 8..9 Record type, must be "05" - 10..13 Upper 16 bits of start address - 14..15 Checksum in hex notation - 16..17 Carriage return, line feed -*/ - -#include "bfd.h" -#include "sysdep.h" -#include "libbfd.h" -#include "libiberty.h" - -#include - -static void ihex_init PARAMS ((void)); -static boolean ihex_mkobject PARAMS ((bfd *)); -static INLINE int ihex_get_byte PARAMS ((bfd *, boolean *)); -static void ihex_bad_byte PARAMS ((bfd *, unsigned int, int, boolean)); -static boolean ihex_scan PARAMS ((bfd *)); -static const bfd_target *ihex_object_p PARAMS ((bfd *)); -static boolean ihex_read_section PARAMS ((bfd *, asection *, bfd_byte *)); -static boolean ihex_get_section_contents - PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type)); -static boolean ihex_set_section_contents - PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type)); -static boolean ihex_write_record - PARAMS ((bfd *, bfd_size_type, bfd_vma, unsigned int, bfd_byte *)); -static boolean ihex_write_object_contents PARAMS ((bfd *)); -static asymbol *ihex_make_empty_symbol PARAMS ((bfd *)); -static boolean ihex_set_arch_mach - PARAMS ((bfd *, enum bfd_architecture, unsigned long)); - -/* The number of bytes we put on one line during output. */ - -#define CHUNK (21) - -/* Macros for converting between hex and binary. */ - -#define NIBBLE(x) (hex_value (x)) -#define HEX2(buffer) ((NIBBLE ((buffer)[0]) << 4) + NIBBLE ((buffer)[1])) -#define HEX4(buffer) ((HEX2 (buffer) << 8) + HEX2 ((buffer) + 2)) -#define ISHEX(x) (hex_p (x)) - -/* When we write out an ihex value, the values can not be output as - they are seen. Instead, we hold them in memory in this structure. */ - -struct ihex_data_list -{ - struct ihex_data_list *next; - bfd_byte *data; - bfd_vma where; - bfd_size_type size; -}; - -/* The ihex tdata information. */ - -struct ihex_data_struct -{ - struct ihex_data_list *head; - struct ihex_data_list *tail; -}; - -/* Initialize by filling in the hex conversion array. */ - -static void -ihex_init () -{ - static boolean inited; - - if (! inited) - { - inited = true; - hex_init (); - } -} - -/* Create an ihex object. */ - -static boolean -ihex_mkobject (abfd) - bfd *abfd; -{ - if (abfd->tdata.ihex_data == NULL) - { - struct ihex_data_struct *tdata; - - tdata = ((struct ihex_data_struct *) - bfd_alloc (abfd, sizeof (struct ihex_data_struct))); - if (tdata == NULL) - return false; - abfd->tdata.ihex_data = tdata; - tdata->head = NULL; - tdata->tail = NULL; - } - - return true; -} - -/* Read a byte from a BFD. Set *ERRORPTR if an error occurred. - Return EOF on error or end of file. */ - -static INLINE int -ihex_get_byte (abfd, errorptr) - bfd *abfd; - boolean *errorptr; -{ - bfd_byte c; - - if (bfd_read (&c, 1, 1, abfd) != 1) - { - if (bfd_get_error () != bfd_error_file_truncated) - *errorptr = true; - return EOF; - } - - return (int) (c & 0xff); -} - -/* Report a problem in an Intel Hex file. */ - -static void -ihex_bad_byte (abfd, lineno, c, error) - bfd *abfd; - unsigned int lineno; - int c; - boolean error; -{ - if (c == EOF) - { - if (! error) - bfd_set_error (bfd_error_file_truncated); - } - else - { - char buf[10]; - - if (! isprint (c)) - sprintf (buf, "\\%03o", (unsigned int) c); - else - { - buf[0] = c; - buf[1] = '\0'; - } - (*_bfd_error_handler) - ("%s:%d: unexpected character `%s' in Intel Hex file\n", - bfd_get_filename (abfd), lineno, buf); - bfd_set_error (bfd_error_bad_value); - } -} - -/* Read an Intel hex file and turn it into sections. We create a new - section for each contiguous set of bytes. */ - -static boolean -ihex_scan (abfd) - bfd *abfd; -{ - bfd_vma segbase; - bfd_vma extbase; - asection *sec; - int lineno; - boolean error; - bfd_byte *buf; - size_t bufsize; - int c; - - if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) - goto error_return; - - abfd->start_address = 0; - - extbase = 0; - segbase = 0; - sec = NULL; - lineno = 1; - error = false; - buf = NULL; - bufsize = 0; - while ((c = ihex_get_byte (abfd, &error)) != EOF) - { - if (c == '\r') - continue; - else if (c == '\n') - { - ++lineno; - continue; - } - else if (c != ':') - { - ihex_bad_byte (abfd, lineno, c, error); - goto error_return; - } - else - { - file_ptr pos; - char hdr[8]; - unsigned int i; - unsigned int len; - bfd_vma addr; - unsigned int type; - unsigned int chars; - unsigned int chksum; - - /* This is a data record. */ - - pos = bfd_tell (abfd) - 1; - - /* Read the header bytes. */ - - if (bfd_read (hdr, 1, 8, abfd) != 8) - goto error_return; - - for (i = 0; i < 8; i++) - { - if (! ISHEX (hdr[i])) - { - ihex_bad_byte (abfd, lineno, hdr[i], error); - goto error_return; - } - } - - len = HEX2 (hdr); - addr = HEX4 (hdr + 2); - type = HEX2 (hdr + 6); - - /* Read the data bytes. */ - - chars = len * 2 + 2; - if (chars >= bufsize) - { - buf = (bfd_byte *) bfd_realloc (buf, chars); - if (buf == NULL) - goto error_return; - bufsize = chars; - } - - if (bfd_read (buf, 1, chars, abfd) != chars) - goto error_return; - - for (i = 0; i < chars; i++) - { - if (! ISHEX (buf[i])) - { - ihex_bad_byte (abfd, lineno, hdr[i], error); - goto error_return; - } - } - - /* Check the checksum. */ - chksum = len + addr + (addr >> 8) + type; - for (i = 0; i < len; i++) - chksum += HEX2 (buf + 2 * i); - if (((- chksum) & 0xff) != (unsigned int) HEX2 (buf + 2 * i)) - { - (*_bfd_error_handler) - ("%s:%d: bad checksum in Intel Hex file (expected %u, found %u)", - bfd_get_filename (abfd), lineno, - (- chksum) & 0xff, (unsigned int) HEX2 (buf + 2 * i)); - bfd_set_error (bfd_error_bad_value); - goto error_return; - } - - switch (type) - { - case 0: - /* This is a data record. */ - if (sec != NULL - && sec->vma + sec->_raw_size == extbase + segbase + addr) - { - /* This data goes at the end of the section we are - currently building. */ - sec->_raw_size += len; - } - else if (len > 0) - { - char secbuf[20]; - char *secname; - - sprintf (secbuf, ".sec%d", bfd_count_sections (abfd) + 1); - secname = (char *) bfd_alloc (abfd, strlen (secbuf) + 1); - if (secname == NULL) - goto error_return; - strcpy (secname, secbuf); - sec = bfd_make_section (abfd, secname); - if (sec == NULL) - goto error_return; - sec->flags = SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC; - sec->vma = extbase + segbase + addr; - sec->lma = extbase + segbase + addr; - sec->_raw_size = len; - sec->filepos = pos; - } - break; - - case 1: - /* An end record. */ - if (abfd->start_address == 0) - abfd->start_address = addr; - if (buf != NULL) - free (buf); - return true; - - case 2: - /* An extended address record. */ - if (len != 2) - { - (*_bfd_error_handler) - ("%s:%d: bad extended address record length in Intel Hex file", - bfd_get_filename (abfd), lineno); - bfd_set_error (bfd_error_bad_value); - goto error_return; - } - - segbase = HEX4 (buf) << 4; - - sec = NULL; - - break; - - case 3: - /* An extended start address record. */ - if (len != 4) - { - (*_bfd_error_handler) - ("%s:%d: bad extended start address length in Intel Hex file", - bfd_get_filename (abfd), lineno); - bfd_set_error (bfd_error_bad_value); - goto error_return; - } - - abfd->start_address += (HEX4 (buf) << 4) + HEX4 (buf + 4); - - sec = NULL; - - break; - - case 4: - /* An extended linear address record. */ - if (len != 2) - { - (*_bfd_error_handler) - ("%s:%d: bad extended linear address record length in Intel Hex file", - bfd_get_filename (abfd), lineno); - bfd_set_error (bfd_error_bad_value); - goto error_return; - } - - segbase = HEX4 (buf) << 16; - - sec = NULL; - - break; - - case 5: - /* An extended linear start address record. */ - if (len != 2) - { - (*_bfd_error_handler) - ("%s:%d: bad extended linear start address length in Intel Hex file", - bfd_get_filename (abfd), lineno); - bfd_set_error (bfd_error_bad_value); - goto error_return; - } - - abfd->start_address += HEX4 (buf) << 16; - - sec = NULL; - - break; - - default: - (*_bfd_error_handler) - ("%s:%d: unrecognized ihex type %u in Intel Hex file\n", - bfd_get_filename (abfd), lineno, type); - bfd_set_error (bfd_error_bad_value); - goto error_return; - } - } - } - - if (error) - goto error_return; - - if (buf != NULL) - free (buf); - - return true; - - error_return: - if (buf != NULL) - free (buf); - return false; -} - -/* Try to recognize an Intel Hex file. */ - -static const bfd_target * -ihex_object_p (abfd) - bfd *abfd; -{ - bfd_byte b[9]; - unsigned int i; - unsigned int type; - - ihex_init (); - - if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) - return NULL; - if (bfd_read (b, 1, 9, abfd) != 9) - { - if (bfd_get_error () == bfd_error_file_truncated) - bfd_set_error (bfd_error_wrong_format); - return NULL; - } - - if (b[0] != ':') - { - bfd_set_error (bfd_error_wrong_format); - return NULL; - } - - for (i = 1; i < 9; i++) - { - if (! ISHEX (b[i])) - { - bfd_set_error (bfd_error_wrong_format); - return NULL; - } - } - - type = HEX2 (b + 7); - if (type > 5) - { - bfd_set_error (bfd_error_wrong_format); - return NULL; - } - - /* OK, it looks like it really is an Intel Hex file. */ - - if (! ihex_mkobject (abfd) - || ! ihex_scan (abfd)) - return NULL; - - return abfd->xvec; -} - -/* Read the contents of a section in an Intel Hex file. */ - -static boolean -ihex_read_section (abfd, section, contents) - bfd *abfd; - asection *section; - bfd_byte *contents; -{ - int c; - bfd_byte *p; - bfd_byte *buf; - size_t bufsize; - boolean error; - - if (bfd_seek (abfd, section->filepos, SEEK_SET) != 0) - goto error_return; - - p = contents; - buf = NULL; - bufsize = 0; - error = false; - while ((c = ihex_get_byte (abfd, &error)) != EOF) - { - char hdr[8]; - unsigned int len; - bfd_vma addr; - unsigned int type; - unsigned int i; - - if (c == '\r' || c == '\n') - continue; - - /* This is called after ihex_scan has succeeded, so we ought to - know the exact format. */ - BFD_ASSERT (c == ':'); - - if (bfd_read (hdr, 1, 8, abfd) != 8) - goto error_return; - - len = HEX2 (hdr); - addr = HEX4 (hdr + 2); - type = HEX2 (hdr + 6); - - /* We should only see type 0 records here. */ - if (type != 0) - { - (*_bfd_error_handler) - ("%s: internal error in ihex_read_section", - bfd_get_filename (abfd)); - bfd_set_error (bfd_error_bad_value); - goto error_return; - } - - if (len * 2 > bufsize) - { - buf = (bfd_byte *) bfd_realloc (buf, len * 2); - if (buf == NULL) - goto error_return; - bufsize = len * 2; - } - - if (bfd_read (buf, 1, len * 2, abfd) != len * 2) - goto error_return; - - for (i = 0; i < len; i++) - *p++ = HEX2 (buf + 2 * i); - if ((bfd_size_type) (p - contents) >= section->_raw_size) - { - /* We've read everything in the section. */ - if (buf != NULL) - free (buf); - return true; - } - - /* Skip the checksum. */ - if (bfd_read (buf, 1, 2, abfd) != 2) - goto error_return; - } - - if ((bfd_size_type) (p - contents) < section->_raw_size) - { - (*_bfd_error_handler) - ("%s: bad section length in ihex_read_section", - bfd_get_filename (abfd)); - bfd_set_error (bfd_error_bad_value); - goto error_return; - } - - if (buf != NULL) - free (buf); - - return true; - - error_return: - if (buf != NULL) - free (buf); - return false; -} - -/* Get the contents of a section in an Intel Hex file. */ - -static boolean -ihex_get_section_contents (abfd, section, location, offset, count) - bfd *abfd; - asection *section; - PTR location; - file_ptr offset; - bfd_size_type count; -{ - if (section->used_by_bfd == NULL) - { - section->used_by_bfd = bfd_alloc (abfd, section->_raw_size); - if (section->used_by_bfd == NULL) - return false; - if (! ihex_read_section (abfd, section, section->used_by_bfd)) - return false; - } - - memcpy (location, (bfd_byte *) section->used_by_bfd + offset, - (size_t) count); - - return true; -} - -/* Set the contents of a section in an Intel Hex file. */ - -static boolean -ihex_set_section_contents (abfd, section, location, offset, count) - bfd *abfd; - asection *section; - PTR location; - file_ptr offset; - bfd_size_type count; -{ - struct ihex_data_list *n; - bfd_byte *data; - struct ihex_data_struct *tdata; - - if (count == 0 - || (section->flags & SEC_ALLOC) == 0 - || (section->flags & SEC_LOAD) == 0) - return true; - - n = ((struct ihex_data_list *) - bfd_alloc (abfd, sizeof (struct ihex_data_list))); - if (n == NULL) - return false; - - data = (bfd_byte *) bfd_alloc (abfd, count); - if (data == NULL) - return false; - memcpy (data, location, (size_t) count); - - n->data = data; - n->where = section->lma + offset; - n->size = count; - - /* Sort the records by address. Optimize for the common case of - adding a record to the end of the list. */ - tdata = abfd->tdata.ihex_data; - if (tdata->tail != NULL - && n->where >= tdata->tail->where) - { - tdata->tail->next = n; - n->next = NULL; - tdata->tail = n; - } - else - { - register struct ihex_data_list **pp; - - for (pp = &tdata->head; - *pp != NULL && (*pp)->where < n->where; - pp = &(*pp)->next) - ; - n->next = *pp; - *pp = n; - if (n->next == NULL) - tdata->tail = n; - } - - return true; -} - -/* Write a record out to an Intel Hex file. */ - -static boolean -ihex_write_record (abfd, count, addr, type, data) - bfd *abfd; - bfd_size_type count; - bfd_vma addr; - unsigned int type; - bfd_byte *data; -{ - static const char digs[] = "0123456789ABCDEF"; - char buf[9 + CHUNK * 2 + 4]; - char *p; - unsigned int chksum; - unsigned int i; - -#define TOHEX(buf, v) \ - ((buf)[0] = digs[((v) >> 4) & 0xf], (buf)[1] = digs[(v) & 0xf]) - - buf[0] = ':'; - TOHEX (buf + 1, count); - TOHEX (buf + 3, (addr >> 8) & 0xff); - TOHEX (buf + 5, addr & 0xff); - TOHEX (buf + 7, type); - - chksum = count + addr + (addr >> 8) + type; - - for (i = 0, p = buf + 9; i < count; i++, p += 2, data++) - { - TOHEX (p, *data); - chksum += *data; - } - - TOHEX (p, (- chksum) & 0xff); - p[2] = '\r'; - p[3] = '\n'; - - if (bfd_write (buf, 1, 9 + count * 2 + 4, abfd) != 9 + count * 2 + 4) - return false; - - return true; -} - -/* Write out an Intel Hex file. */ - -static boolean -ihex_write_object_contents (abfd) - bfd *abfd; -{ - bfd_vma extbase; - bfd_vma segbase; - struct ihex_data_list *l; - - extbase = 0; - segbase = 0; - for (l = abfd->tdata.ihex_data->head; l != NULL; l = l->next) - { - bfd_vma where; - bfd_byte *p; - bfd_size_type count; - - where = l->where; - p = l->data; - count = l->size; - while (count > 0) - { - bfd_size_type now; - - now = count; - if (now > CHUNK) - now = CHUNK; - - if (where > extbase + segbase + 0xffff) - { - bfd_byte addr[2]; - - /* We need a new base address. */ - if (where <= 0xfffff) - { - segbase = where & 0xf0000; - addr[0] = (segbase >> 12) & 0xff; - addr[1] = (segbase >> 4) & 0xff; - if (! ihex_write_record (abfd, 2, 0, 2, addr)) - return false; - } - else - { - extbase = where & 0xffff0000; - if (where > extbase + 0xffff) - { - char buf[20]; - - sprintf_vma (buf, where); - (*_bfd_error_handler) - ("%s: address 0x%s out of range for Intex Hex file", - bfd_get_filename (abfd), buf); - bfd_set_error (bfd_error_bad_value); - return false; - } - addr[0] = (extbase >> 24) & 0xff; - addr[1] = (extbase >> 16) & 0xff; - if (! ihex_write_record (abfd, 2, 0, 4, addr)) - return false; - } - } - - if (! ihex_write_record (abfd, now, where - (extbase + segbase), - 0, p)) - return false; - - where += now; - p += now; - count -= now; - } - } - - if (abfd->start_address != 0) - { - bfd_vma start; - bfd_byte startbuf[4]; - - start = abfd->start_address; - - if (start > 0xfffff) - { - startbuf[0] = (start >> 24) & 0xff; - startbuf[1] = (start >> 16) & 0xff; - if (! ihex_write_record (abfd, 2, 0, 5, startbuf)) - return false; - start &= 0xffff; - } - - startbuf[0] = ((start & 0xf0000) >> 12) & 0xff; - startbuf[1] = 0; - startbuf[2] = (start >> 8) & 0xff; - startbuf[3] = start & 0xff; - if (! ihex_write_record (abfd, 4, 0, 3, startbuf)) - return false; - } - - if (! ihex_write_record (abfd, 0, 0, 1, NULL)) - return false; - - return true; -} - -/* Make an empty symbol. This is required only because - bfd_make_section_anyway wants to create a symbol for the section. */ - -static asymbol * -ihex_make_empty_symbol (abfd) - bfd *abfd; -{ - asymbol *new; - - new = (asymbol *) bfd_zalloc (abfd, sizeof (asymbol)); - if (new != NULL) - new->the_bfd = abfd; - return new; -} - -/* Set the architecture for the output file. The architecture is - irrelevant, so we ignore errors about unknown architectures. */ - -static boolean -ihex_set_arch_mach (abfd, arch, mach) - bfd *abfd; - enum bfd_architecture arch; - unsigned long mach; -{ - if (! bfd_default_set_arch_mach (abfd, arch, mach)) - { - if (arch != bfd_arch_unknown) - return false; - } - return true; -} - -/* Get the size of the headers, for the linker. */ - -/*ARGSUSED*/ -static int -ihex_sizeof_headers (abfd, exec) - bfd *abfd; - boolean exec; -{ - return 0; -} - -/* Some random definitions for the target vector. */ - -#define ihex_close_and_cleanup _bfd_generic_close_and_cleanup -#define ihex_bfd_free_cached_info _bfd_generic_bfd_free_cached_info -#define ihex_new_section_hook _bfd_generic_new_section_hook -#define ihex_get_section_contents_in_window \ - _bfd_generic_get_section_contents_in_window - -#define ihex_get_symtab_upper_bound bfd_0l -#define ihex_get_symtab \ - ((long (*) PARAMS ((bfd *, asymbol **))) bfd_0l) -#define ihex_print_symbol _bfd_nosymbols_print_symbol -#define ihex_get_symbol_info _bfd_nosymbols_get_symbol_info -#define ihex_bfd_is_local_label _bfd_nosymbols_bfd_is_local_label -#define ihex_get_lineno _bfd_nosymbols_get_lineno -#define ihex_find_nearest_line _bfd_nosymbols_find_nearest_line -#define ihex_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol -#define ihex_read_minisymbols _bfd_nosymbols_read_minisymbols -#define ihex_minisymbol_to_symbol _bfd_nosymbols_minisymbol_to_symbol - -#define ihex_get_reloc_upper_bound \ - ((long (*) PARAMS ((bfd *, asection *))) bfd_0l) -#define ihex_canonicalize_reloc \ - ((long (*) PARAMS ((bfd *, asection *, arelent **, asymbol **))) bfd_0l) -#define ihex_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup - -#define ihex_bfd_get_relocated_section_contents \ - bfd_generic_get_relocated_section_contents -#define ihex_bfd_relax_section bfd_generic_relax_section -#define ihex_bfd_link_hash_table_create _bfd_generic_link_hash_table_create -#define ihex_bfd_link_add_symbols _bfd_generic_link_add_symbols -#define ihex_bfd_final_link _bfd_generic_final_link -#define ihex_bfd_link_split_section _bfd_generic_link_split_section - -/* The Intel Hex target vector. */ - -const bfd_target ihex_vec = -{ - "ihex", /* name */ - bfd_target_ihex_flavour, - BFD_ENDIAN_UNKNOWN, /* target byte order */ - BFD_ENDIAN_UNKNOWN, /* target headers byte order */ - 0, /* object flags */ - (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD), /* section flags */ - 0, /* leading underscore */ - ' ', /* ar_pad_char */ - 16, /* ar_max_namelen */ - bfd_getb64, bfd_getb_signed_64, bfd_putb64, - bfd_getb32, bfd_getb_signed_32, bfd_putb32, - bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */ - bfd_getb64, bfd_getb_signed_64, bfd_putb64, - bfd_getb32, bfd_getb_signed_32, bfd_putb32, - bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */ - - { - _bfd_dummy_target, - ihex_object_p, /* bfd_check_format */ - _bfd_dummy_target, - _bfd_dummy_target, - }, - { - bfd_false, - ihex_mkobject, - _bfd_generic_mkarchive, - bfd_false, - }, - { /* bfd_write_contents */ - bfd_false, - ihex_write_object_contents, - _bfd_write_archive_contents, - bfd_false, - }, - - BFD_JUMP_TABLE_GENERIC (ihex), - BFD_JUMP_TABLE_COPY (_bfd_generic), - BFD_JUMP_TABLE_CORE (_bfd_nocore), - BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive), - BFD_JUMP_TABLE_SYMBOLS (ihex), - BFD_JUMP_TABLE_RELOCS (ihex), - BFD_JUMP_TABLE_WRITE (ihex), - BFD_JUMP_TABLE_LINK (ihex), - BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), - - (PTR) 0 -}; diff --git a/contrib/gdb/bfd/init.c b/contrib/gdb/bfd/init.c deleted file mode 100644 index 1fa1d50..0000000 --- a/contrib/gdb/bfd/init.c +++ /dev/null @@ -1,50 +0,0 @@ -/* bfd initialization stuff - Copyright (C) 1990, 91, 92, 93, 94, 1995 Free Software Foundation, Inc. - Written by Steve Chamberlain of Cygnus Support. - -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" - -/* -SECTION - Initialization - - These are the functions that handle initializing a BFD. -*/ - -/* -FUNCTION - bfd_init - -SYNOPSIS - void bfd_init(void); - -DESCRIPTION - This routine must be called before any other BFD function to - initialize magical internal data structures. -*/ - -/* Actually, there is currently nothing for this function to do. - However, someday it may be needed, so keep it around. */ - -void -bfd_init () -{ -} diff --git a/contrib/gdb/bfd/libaout.h b/contrib/gdb/bfd/libaout.h deleted file mode 100644 index 76c1dff..0000000 --- a/contrib/gdb/bfd/libaout.h +++ /dev/null @@ -1,608 +0,0 @@ -/* BFD back-end data structures for a.out (and similar) files. - Copyright 1990, 1991, 1992 Free Software Foundation, Inc. - Written by Cygnus Support. - -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 LIBAOUT_H -#define LIBAOUT_H - -/* We try to encapsulate the differences in the various a.out file - variants in a few routines, and otherwise share large masses of code. - This means we only have to fix bugs in one place, most of the time. */ - -#include "bfdlink.h" - -/* Parameterize the a.out code based on whether it is being built - for a 32-bit architecture or a 64-bit architecture. */ -#if ARCH_SIZE==64 -#define GET_WORD bfd_h_get_64 -#define GET_SWORD bfd_h_get_signed_64 -#define PUT_WORD bfd_h_put_64 -#ifndef NAME -#define NAME(x,y) CAT3(x,_64_,y) -#endif -#define JNAME(x) CAT(x,_64) -#define BYTES_IN_WORD 8 -#else /* ARCH_SIZE == 32 */ -#define GET_WORD bfd_h_get_32 -#define GET_SWORD bfd_h_get_signed_32 -#define PUT_WORD bfd_h_put_32 -#ifndef NAME -#define NAME(x,y) CAT3(x,_32_,y) -#endif -#define JNAME(x) CAT(x,_32) -#define BYTES_IN_WORD 4 -#endif /* ARCH_SIZE==32 */ - -/* Declare at file level, since used in parameter lists, which have - weird scope. */ -struct external_exec; -struct external_nlist; -struct reloc_ext_external; -struct reloc_std_external; - -/* a.out backend linker hash table entries. */ - -struct aout_link_hash_entry -{ - struct bfd_link_hash_entry root; - /* Whether this symbol has been written out. */ - boolean written; - /* Symbol index in output file. */ - int indx; -}; - -/* a.out backend linker hash table. */ - -struct aout_link_hash_table -{ - struct bfd_link_hash_table root; -}; - -/* Look up an entry in an a.out link hash table. */ - -#define aout_link_hash_lookup(table, string, create, copy, follow) \ - ((struct aout_link_hash_entry *) \ - bfd_link_hash_lookup (&(table)->root, (string), (create), (copy), (follow))) - -/* Traverse an a.out link hash table. */ - -#define aout_link_hash_traverse(table, func, info) \ - (bfd_link_hash_traverse \ - (&(table)->root, \ - (boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func), \ - (info))) - -/* Get the a.out link hash table from the info structure. This is - just a cast. */ - -#define aout_hash_table(p) ((struct aout_link_hash_table *) ((p)->hash)) - -/* Back-end information for various a.out targets. */ -struct aout_backend_data -{ - /* Are ZMAGIC files mapped contiguously? If so, the text section may - need more padding, if the segment size (granularity for memory access - control) is larger than the page size. */ - unsigned char zmagic_mapped_contiguous; - /* If this flag is set, ZMAGIC/NMAGIC file headers get mapped in with the - text section, which starts immediately after the file header. - If not, the text section starts on the next page. */ - unsigned char text_includes_header; - - /* The value to pass to N_SET_FLAGS. */ - unsigned char exec_hdr_flags; - - /* If the text section VMA isn't specified, and we need an absolute - address, use this as the default. If we're producing a relocatable - file, zero is always used. */ - /* ?? Perhaps a callback would be a better choice? Will this do anything - reasonable for a format that handles multiple CPUs with different - load addresses for each? */ - bfd_vma default_text_vma; - - /* Callback for setting the page and segment sizes, if they can't be - trivially determined from the architecture. */ - boolean (*set_sizes) PARAMS ((bfd *)); - - /* zmagic files only. For go32, the length of the exec header contributes - to the size of the text section in the file for alignment purposes but - does *not* get counted in the length of the text section. */ - unsigned char exec_header_not_counted; - - /* Callback from the add symbols phase of the linker code to handle - a dynamic object. */ - boolean (*add_dynamic_symbols) PARAMS ((bfd *, struct bfd_link_info *, - struct external_nlist **, - bfd_size_type *, char **)); - - /* Callback from the add symbols phase of the linker code to handle - adding a single symbol to the global linker hash table. */ - boolean (*add_one_symbol) PARAMS ((struct bfd_link_info *, bfd *, - const char *, flagword, asection *, - bfd_vma, const char *, boolean, - boolean, - struct bfd_link_hash_entry **)); - - /* Called to handle linking a dynamic object. */ - boolean (*link_dynamic_object) PARAMS ((struct bfd_link_info *, bfd *)); - - /* Called for each global symbol being written out by the linker. - This should write out the dynamic symbol information. */ - boolean (*write_dynamic_symbol) PARAMS ((bfd *, struct bfd_link_info *, - struct aout_link_hash_entry *)); - - /* If this callback is not NULL, the linker calls it for each reloc. - RELOC is a pointer to the unswapped reloc. If *SKIP is set to - true, the reloc will be skipped. *RELOCATION may be changed to - change the effects of the relocation. */ - boolean (*check_dynamic_reloc) PARAMS ((struct bfd_link_info *info, - bfd *input_bfd, - asection *input_section, - struct aout_link_hash_entry *h, - PTR reloc, bfd_byte *contents, - boolean *skip, - bfd_vma *relocation)); - - /* Called at the end of a link to finish up any dynamic linking - information. */ - boolean (*finish_dynamic_link) PARAMS ((bfd *, struct bfd_link_info *)); -}; -#define aout_backend_info(abfd) \ - ((CONST struct aout_backend_data *)((abfd)->xvec->backend_data)) - -/* This is the layout in memory of a "struct exec" while we process it. - All 'lengths' are given as a number of bytes. - All 'alignments' are for relinkable files only; an alignment of - 'n' indicates the corresponding segment must begin at an - address that is a multiple of (2**n). */ - -struct internal_exec -{ - long a_info; /* Magic number and flags, packed */ - bfd_vma a_text; /* length of text, in bytes */ - bfd_vma a_data; /* length of data, in bytes */ - bfd_vma a_bss; /* length of uninitialized data area in mem */ - bfd_vma a_syms; /* length of symbol table data in file */ - bfd_vma a_entry; /* start address */ - bfd_vma a_trsize; /* length of text's relocation info, in bytes */ - bfd_vma a_drsize; /* length of data's relocation info, in bytes */ - /* Added for i960 */ - bfd_vma a_tload; /* Text runtime load address */ - bfd_vma a_dload; /* Data runtime load address */ - unsigned char a_talign; /* Alignment of text segment */ - unsigned char a_dalign; /* Alignment of data segment */ - unsigned char a_balign; /* Alignment of bss segment */ - char a_relaxable; /* Enough info for linker relax */ -}; - -/* Magic number is written -< MSB > -3130292827262524232221201918171615141312111009080706050403020100 -< FLAGS >< MACHINE TYPE >< MAGIC NUMBER > -*/ -/* Magic number for NetBSD is - -3130292827262524232221201918171615141312111009080706050403020100 -< FLAGS >< >< MAGIC NUMBER > -*/ - -enum machine_type { - M_UNKNOWN = 0, - M_68010 = 1, - M_68020 = 2, - M_SPARC = 3, - /* skip a bunch so we don't run into any of suns numbers */ - /* make these up for the ns32k*/ - M_NS32032 = (64), /* ns32032 running ? */ - M_NS32532 = (64 + 5), /* ns32532 running mach */ - - M_386 = 100, - M_29K = 101, /* AMD 29000 */ - M_386_DYNIX = 102, /* Sequent running dynix */ - M_ARM = 103, /* Advanced Risc Machines ARM */ - M_386_NETBSD = 134, /* NetBSD/i386 binary */ - M_68K_NETBSD = 135, /* NetBSD/m68k binary */ - M_68K4K_NETBSD = 136, /* NetBSD/m68k4k binary */ - M_532_NETBSD = 137, /* NetBSD/ns32k binary */ - M_SPARC_NETBSD = 138, /* NetBSD/sparc binary */ - M_MIPS1 = 151, /* MIPS R2000/R3000 binary */ - M_MIPS2 = 152, /* MIPS R4000/R6000 binary */ - M_HP200 = 200, /* HP 200 (68010) BSD binary */ - M_HP300 = (300 % 256), /* HP 300 (68020+68881) BSD binary */ - M_HPUX = (0x20c % 256)/* HP 200/300 HPUX binary */ -}; - -#define N_DYNAMIC(exec) ((exec).a_info & 0x80000000) - -#ifndef N_MAGIC -# define N_MAGIC(exec) ((exec).a_info & 0xffff) -#endif - -#ifndef N_MACHTYPE -# define N_MACHTYPE(exec) ((enum machine_type)(((exec).a_info >> 16) & 0xff)) -#endif - -#ifndef N_FLAGS -# define N_FLAGS(exec) (((exec).a_info >> 24) & 0xff) -#endif - -#ifndef N_SET_INFO -# define N_SET_INFO(exec, magic, type, flags) \ -((exec).a_info = ((magic) & 0xffff) \ - | (((int)(type) & 0xff) << 16) \ - | (((flags) & 0xff) << 24)) -#endif - -#ifndef N_SET_DYNAMIC -# define N_SET_DYNAMIC(exec, dynamic) \ -((exec).a_info = (dynamic) ? ((exec).a_info | 0x80000000) : \ -((exec).a_info & 0x7fffffff)) -#endif - -#ifndef N_SET_MAGIC -# define N_SET_MAGIC(exec, magic) \ -((exec).a_info = (((exec).a_info & 0xffff0000) | ((magic) & 0xffff))) -#endif - -#ifndef N_SET_MACHTYPE -# define N_SET_MACHTYPE(exec, machtype) \ -((exec).a_info = \ - ((exec).a_info&0xff00ffff) | ((((int)(machtype))&0xff) << 16)) -#endif - -#ifndef N_SET_FLAGS -# define N_SET_FLAGS(exec, flags) \ -((exec).a_info = \ - ((exec).a_info&0x00ffffff) | (((flags) & 0xff) << 24)) -#endif - -typedef struct aout_symbol { - asymbol symbol; - short desc; - char other; - unsigned char type; -} aout_symbol_type; - -/* The `tdata' struct for all a.out-like object file formats. - Various things depend on this struct being around any time an a.out - file is being handled. An example is dbxread.c in GDB. */ - -struct aoutdata { - struct internal_exec *hdr; /* exec file header */ - aout_symbol_type *symbols; /* symtab for input bfd */ - - /* For ease, we do this */ - asection *textsec; - asection *datasec; - asection *bsssec; - - /* We remember these offsets so that after check_file_format, we have - no dependencies on the particular format of the exec_hdr. */ - file_ptr sym_filepos; - file_ptr str_filepos; - - /* Size of a relocation entry in external form */ - unsigned reloc_entry_size; - - /* Size of a symbol table entry in external form */ - unsigned symbol_entry_size; - - /* Page size - needed for alignment of demand paged files. */ - unsigned long page_size; - - /* Segment size - needed for alignment of demand paged files. */ - unsigned long segment_size; - - /* Zmagic disk block size - need to align the start of the text - section in ZMAGIC binaries. Normally the same as page_size. */ - unsigned long zmagic_disk_block_size; - - unsigned exec_bytes_size; - unsigned vma_adjusted : 1; - - /* used when a bfd supports several highly similar formats */ - enum - { - default_format = 0, - /* Used on HP 9000/300 running HP/UX. See hp300hpux.c. */ - gnu_encap_format, - /* Used on Linux, 386BSD, etc. See include/aout/aout64.h. */ - q_magic_format - } subformat; - - enum - { - undecided_magic = 0, - z_magic, - o_magic, - n_magic - } magic; - - /* A buffer for find_nearest_line. */ - char *line_buf; - - /* The external symbol information. */ - struct external_nlist *external_syms; - bfd_size_type external_sym_count; - bfd_window sym_window; - char *external_strings; - bfd_size_type external_string_size; - bfd_window string_window; - struct aout_link_hash_entry **sym_hashes; - - /* A pointer for shared library information. */ - PTR dynamic_info; - - /* A mapping from local symbols to offsets into the global offset - table, used when linking on SunOS. This is indexed by the symbol - index. */ - bfd_vma *local_got_offsets; -}; - -struct aout_data_struct { - struct aoutdata a; - struct internal_exec e; -}; - -#define adata(bfd) ((bfd)->tdata.aout_data->a) -#define exec_hdr(bfd) (adata(bfd).hdr) -#define obj_aout_symbols(bfd) (adata(bfd).symbols) -#define obj_textsec(bfd) (adata(bfd).textsec) -#define obj_datasec(bfd) (adata(bfd).datasec) -#define obj_bsssec(bfd) (adata(bfd).bsssec) -#define obj_sym_filepos(bfd) (adata(bfd).sym_filepos) -#define obj_str_filepos(bfd) (adata(bfd).str_filepos) -#define obj_reloc_entry_size(bfd) (adata(bfd).reloc_entry_size) -#define obj_symbol_entry_size(bfd) (adata(bfd).symbol_entry_size) -#define obj_aout_subformat(bfd) (adata(bfd).subformat) -#define obj_aout_external_syms(bfd) (adata(bfd).external_syms) -#define obj_aout_external_sym_count(bfd) (adata(bfd).external_sym_count) -#define obj_aout_sym_window(bfd) (adata(bfd).sym_window) -#define obj_aout_external_strings(bfd) (adata(bfd).external_strings) -#define obj_aout_external_string_size(bfd) (adata(bfd).external_string_size) -#define obj_aout_string_window(bfd) (adata(bfd).string_window) -#define obj_aout_sym_hashes(bfd) (adata(bfd).sym_hashes) -#define obj_aout_dynamic_info(bfd) (adata(bfd).dynamic_info) - -/* We take the address of the first element of an asymbol to ensure that the - macro is only ever applied to an asymbol */ -#define aout_symbol(asymbol) ((aout_symbol_type *)(&(asymbol)->the_bfd)) - -/* Information we keep for each a.out section. This is currently only - used by the a.out backend linker. */ - -struct aout_section_data_struct -{ - /* The unswapped relocation entries for this section. */ - PTR relocs; -}; - -#define aout_section_data(s) \ - ((struct aout_section_data_struct *) (s)->used_by_bfd) - -#define set_aout_section_data(s,v) \ - ((s)->used_by_bfd = (PTR)&(v)->relocs) - -/* Prototype declarations for functions defined in aoutx.h */ - -boolean -NAME(aout,squirt_out_relocs) PARAMS ((bfd *abfd, asection *section)); - -boolean -NAME(aout,make_sections) PARAMS ((bfd *)); - -const bfd_target * -NAME(aout,some_aout_object_p) PARAMS ((bfd *abfd, - struct internal_exec *execp, - const bfd_target *(*callback)(bfd *))); - -boolean -NAME(aout,mkobject) PARAMS ((bfd *abfd)); - -enum machine_type -NAME(aout,machine_type) PARAMS ((enum bfd_architecture arch, - unsigned long machine, - boolean *unknown)); - -boolean -NAME(aout,set_arch_mach) PARAMS ((bfd *abfd, enum bfd_architecture arch, - unsigned long machine)); - -boolean -NAME(aout,new_section_hook) PARAMS ((bfd *abfd, asection *newsect)); - -boolean -NAME(aout,set_section_contents) PARAMS ((bfd *abfd, sec_ptr section, - PTR location, file_ptr offset, bfd_size_type count)); - -asymbol * -NAME(aout,make_empty_symbol) PARAMS ((bfd *abfd)); - -boolean -NAME(aout,translate_symbol_table) PARAMS ((bfd *, aout_symbol_type *, - struct external_nlist *, - bfd_size_type, char *, - bfd_size_type, - boolean dynamic)); - -boolean -NAME(aout,slurp_symbol_table) PARAMS ((bfd *abfd)); - -boolean -NAME(aout,write_syms) PARAMS ((bfd *abfd)); - -void -NAME(aout,reclaim_symbol_table) PARAMS ((bfd *abfd)); - -long -NAME(aout,get_symtab_upper_bound) PARAMS ((bfd *abfd)); - -long -NAME(aout,get_symtab) PARAMS ((bfd *abfd, asymbol **location)); - -void -NAME(aout,swap_ext_reloc_in) PARAMS ((bfd *, struct reloc_ext_external *, - arelent *, asymbol **, bfd_size_type)); -void -NAME(aout,swap_std_reloc_in) PARAMS ((bfd *, struct reloc_std_external *, - arelent *, asymbol **, bfd_size_type)); - -reloc_howto_type * -NAME(aout,reloc_type_lookup) PARAMS ((bfd *abfd, - bfd_reloc_code_real_type code)); - -boolean -NAME(aout,slurp_reloc_table) PARAMS ((bfd *abfd, sec_ptr asect, - asymbol **symbols)); - -long -NAME(aout,canonicalize_reloc) PARAMS ((bfd *abfd, sec_ptr section, - arelent **relptr, asymbol **symbols)); - -long -NAME(aout,get_reloc_upper_bound) PARAMS ((bfd *abfd, sec_ptr asect)); - -void -NAME(aout,reclaim_reloc) PARAMS ((bfd *ignore_abfd, sec_ptr ignore)); - -alent * -NAME(aout,get_lineno) PARAMS ((bfd *ignore_abfd, asymbol *ignore_symbol)); - -void -NAME(aout,print_symbol) PARAMS ((bfd *ignore_abfd, PTR file, - asymbol *symbol, bfd_print_symbol_type how)); - -void -NAME(aout,get_symbol_info) PARAMS ((bfd *ignore_abfd, - asymbol *symbol, symbol_info *ret)); - -boolean -NAME(aout,find_nearest_line) PARAMS ((bfd *abfd, asection *section, - asymbol **symbols, bfd_vma offset, CONST char **filename_ptr, - CONST char **functionname_ptr, unsigned int *line_ptr)); - -long -NAME(aout,read_minisymbols) PARAMS ((bfd *, boolean, PTR *, unsigned int *)); - -asymbol * -NAME(aout,minisymbol_to_symbol) PARAMS ((bfd *, boolean, const PTR, - asymbol *)); - -int -NAME(aout,sizeof_headers) PARAMS ((bfd *abfd, boolean exec)); - -boolean -NAME(aout,adjust_sizes_and_vmas) PARAMS ((bfd *abfd, - bfd_size_type *text_size, file_ptr *text_end)); - -void -NAME(aout,swap_exec_header_in) PARAMS ((bfd *abfd, - struct external_exec *raw_bytes, struct internal_exec *execp)); - -void -NAME(aout,swap_exec_header_out) PARAMS ((bfd *abfd, - struct internal_exec *execp, struct external_exec *raw_bytes)); - -struct bfd_hash_entry * -NAME(aout,link_hash_newfunc) - PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); - -boolean -NAME(aout,link_hash_table_init) - PARAMS ((struct aout_link_hash_table *, bfd *, - struct bfd_hash_entry *(*) (struct bfd_hash_entry *, - struct bfd_hash_table *, - const char *))); - -struct bfd_link_hash_table * -NAME(aout,link_hash_table_create) PARAMS ((bfd *)); - -boolean -NAME(aout,link_add_symbols) PARAMS ((bfd *, struct bfd_link_info *)); - -boolean -NAME(aout,final_link) PARAMS ((bfd *, struct bfd_link_info *, - void (*) (bfd *, file_ptr *, file_ptr *, - file_ptr *))); - -boolean -NAME(aout,bfd_free_cached_info) PARAMS ((bfd *)); - -/* A.out uses the generic versions of these routines... */ - -#define aout_32_get_section_contents _bfd_generic_get_section_contents - -#define aout_64_get_section_contents _bfd_generic_get_section_contents -#ifndef NO_WRITE_HEADER_KLUDGE -#define NO_WRITE_HEADER_KLUDGE 0 -#endif - -#ifndef aout_32_bfd_is_local_label -#define aout_32_bfd_is_local_label bfd_generic_is_local_label -#endif - -#ifndef WRITE_HEADERS -#define WRITE_HEADERS(abfd, execp) \ - { \ - bfd_size_type text_size; /* dummy vars */ \ - file_ptr text_end; \ - if (adata(abfd).magic == undecided_magic) \ - NAME(aout,adjust_sizes_and_vmas) (abfd, &text_size, &text_end); \ - \ - execp->a_syms = bfd_get_symcount (abfd) * EXTERNAL_NLIST_SIZE; \ - execp->a_entry = bfd_get_start_address (abfd); \ - \ - execp->a_trsize = ((obj_textsec (abfd)->reloc_count) * \ - obj_reloc_entry_size (abfd)); \ - execp->a_drsize = ((obj_datasec (abfd)->reloc_count) * \ - obj_reloc_entry_size (abfd)); \ - NAME(aout,swap_exec_header_out) (abfd, execp, &exec_bytes); \ - \ - if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) return false; \ - if (bfd_write ((PTR) &exec_bytes, 1, EXEC_BYTES_SIZE, abfd) \ - != EXEC_BYTES_SIZE) \ - return false; \ - /* Now write out reloc info, followed by syms and strings */ \ - \ - if (bfd_get_outsymbols (abfd) != (asymbol **) NULL \ - && bfd_get_symcount (abfd) != 0) \ - { \ - if (bfd_seek (abfd, (file_ptr)(N_SYMOFF(*execp)), SEEK_SET) \ - != 0) \ - return false; \ - \ - if (! NAME(aout,write_syms)(abfd)) return false; \ - \ - if (bfd_seek (abfd, (file_ptr)(N_TRELOFF(*execp)), SEEK_SET) \ - != 0) \ - return false; \ - \ - if (!NAME(aout,squirt_out_relocs) (abfd, obj_textsec (abfd))) \ - return false; \ - if (bfd_seek (abfd, (file_ptr)(N_DRELOFF(*execp)), SEEK_SET) \ - != 0) \ - return false; \ - \ - if (!NAME(aout,squirt_out_relocs)(abfd, obj_datasec (abfd))) \ - return false; \ - } \ - } -#endif - -#endif /* ! defined (LIBAOUT_H) */ diff --git a/contrib/gdb/bfd/libbfd.c b/contrib/gdb/bfd/libbfd.c deleted file mode 100644 index 1052a3a1..0000000 --- a/contrib/gdb/bfd/libbfd.c +++ /dev/null @@ -1,1197 +0,0 @@ -/* Assorted BFD support routines, only used internally. - Copyright 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. - Written by Cygnus Support. - -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" - -static int real_read PARAMS ((PTR, size_t, size_t, FILE *)); - -/* -SECTION - Internal functions - -DESCRIPTION - These routines are used within BFD. - They are not intended for export, but are documented here for - completeness. -*/ - -/* A routine which is used in target vectors for unsupported - operations. */ - -/*ARGSUSED*/ -boolean -bfd_false (ignore) - bfd *ignore; -{ - bfd_set_error (bfd_error_invalid_operation); - return false; -} - -/* A routine which is used in target vectors for supported operations - which do not actually do anything. */ - -/*ARGSUSED*/ -boolean -bfd_true (ignore) - bfd *ignore; -{ - return true; -} - -/* A routine which is used in target vectors for unsupported - operations which return a pointer value. */ - -/*ARGSUSED*/ -PTR -bfd_nullvoidptr (ignore) - bfd *ignore; -{ - bfd_set_error (bfd_error_invalid_operation); - return NULL; -} - -/*ARGSUSED*/ -int -bfd_0 (ignore) - bfd *ignore; -{ - return 0; -} - -/*ARGSUSED*/ -unsigned int -bfd_0u (ignore) - bfd *ignore; -{ - return 0; -} - -/*ARGUSED*/ -long -bfd_0l (ignore) - bfd *ignore; -{ - return 0; -} - -/* A routine which is used in target vectors for unsupported - operations which return -1 on error. */ - -/*ARGSUSED*/ -long -_bfd_n1 (ignore_abfd) - bfd *ignore_abfd; -{ - bfd_set_error (bfd_error_invalid_operation); - return -1; -} - -/*ARGSUSED*/ -void -bfd_void (ignore) - bfd *ignore; -{ -} - -/*ARGSUSED*/ -boolean -_bfd_nocore_core_file_matches_executable_p (ignore_core_bfd, ignore_exec_bfd) - bfd *ignore_core_bfd; - bfd *ignore_exec_bfd; -{ - bfd_set_error (bfd_error_invalid_operation); - return false; -} - -/* Routine to handle core_file_failing_command entry point for targets - without core file support. */ - -/*ARGSUSED*/ -char * -_bfd_nocore_core_file_failing_command (ignore_abfd) - bfd *ignore_abfd; -{ - bfd_set_error (bfd_error_invalid_operation); - return (char *)NULL; -} - -/* Routine to handle core_file_failing_signal entry point for targets - without core file support. */ - -/*ARGSUSED*/ -int -_bfd_nocore_core_file_failing_signal (ignore_abfd) - bfd *ignore_abfd; -{ - bfd_set_error (bfd_error_invalid_operation); - return 0; -} - -/*ARGSUSED*/ -const bfd_target * -_bfd_dummy_target (ignore_abfd) - bfd *ignore_abfd; -{ - bfd_set_error (bfd_error_wrong_format); - return 0; -} - -/* Allocate memory using malloc. */ - -PTR -bfd_malloc (size) - size_t size; -{ - PTR ptr; - - ptr = (PTR) malloc (size); - if (ptr == NULL && size != 0) - bfd_set_error (bfd_error_no_memory); - return ptr; -} - -/* Reallocate memory using realloc. */ - -PTR -bfd_realloc (ptr, size) - PTR ptr; - size_t size; -{ - PTR ret; - - if (ptr == NULL) - ret = malloc (size); - else - ret = realloc (ptr, size); - - if (ret == NULL) - bfd_set_error (bfd_error_no_memory); - - return ret; -} - -/* Allocate memory using malloc and clear it. */ - -PTR -bfd_zmalloc (size) - size_t size; -{ - PTR ptr; - - ptr = (PTR) malloc (size); - - if (size != 0) - { - if (ptr == NULL) - bfd_set_error (bfd_error_no_memory); - else - memset (ptr, 0, size); - } - - return ptr; -} - -/* Some IO code */ - - -/* Note that archive entries don't have streams; they share their parent's. - This allows someone to play with the iostream behind BFD's back. - - Also, note that the origin pointer points to the beginning of a file's - contents (0 for non-archive elements). For archive entries this is the - first octet in the file, NOT the beginning of the archive header. */ - -static int -real_read (where, a,b, file) - PTR where; - size_t a; - size_t b; - FILE *file; -{ - return fread (where, a, b, file); -} - -/* Return value is amount read (FIXME: how are errors and end of file dealt - with? We never call bfd_set_error, which is probably a mistake). */ - -bfd_size_type -bfd_read (ptr, size, nitems, abfd) - PTR ptr; - bfd_size_type size; - bfd_size_type nitems; - bfd *abfd; -{ - int nread; - - if ((abfd->flags & BFD_IN_MEMORY) != 0) - { - struct bfd_in_memory *bim; - bfd_size_type get; - - bim = (struct bfd_in_memory *) abfd->iostream; - get = size * nitems; - if (abfd->where + get > bim->size) - { - get = bim->size - abfd->where; - bfd_set_error (bfd_error_file_truncated); - } - memcpy (ptr, bim->buffer + abfd->where, get); - abfd->where += get; - return get; - } - - nread = real_read (ptr, 1, (size_t)(size*nitems), bfd_cache_lookup(abfd)); -#ifdef FILE_OFFSET_IS_CHAR_INDEX - if (nread > 0) - abfd->where += nread; -#endif - - /* Set bfd_error if we did not read as much data as we expected. - - If the read failed due to an error set the bfd_error_system_call, - else set bfd_error_file_truncated. - - A BFD backend may wish to override bfd_error_file_truncated to - provide something more useful (eg. no_symbols or wrong_format). */ - if (nread < (int)(size * nitems)) - { - if (ferror (bfd_cache_lookup (abfd))) - bfd_set_error (bfd_error_system_call); - else - bfd_set_error (bfd_error_file_truncated); - } - - return nread; -} - -/* The window support stuff should probably be broken out into - another file.... */ -/* The idea behind the next and refcount fields is that one mapped - region can suffice for multiple read-only windows or multiple - non-overlapping read-write windows. It's not implemented yet - though. */ -struct _bfd_window_internal { - struct _bfd_window_internal *next; - PTR data; - bfd_size_type size; - int refcount : 31; /* should be enough... */ - unsigned mapped : 1; /* 1 = mmap, 0 = malloc */ -}; - -void -bfd_init_window (windowp) - bfd_window *windowp; -{ - windowp->data = 0; - windowp->i = 0; - windowp->size = 0; -} - -#undef HAVE_MPROTECT /* code's not tested yet */ - -#if HAVE_MMAP || HAVE_MPROTECT || HAVE_MADVISE -#include -#include -#endif - -#ifndef MAP_FILE -#define MAP_FILE 0 -#endif - -static int debug_windows; - -/* Currently, if USE_MMAP is undefined, none if the window stuff is - used. Okay, so it's mis-named. At least the command-line option - "--without-mmap" is more obvious than "--without-windows" or some - such. */ -#ifdef USE_MMAP - -void -bfd_free_window (windowp) - bfd_window *windowp; -{ - bfd_window_internal *i = windowp->i; - windowp->i = 0; - windowp->data = 0; - if (i == 0) - return; - i->refcount--; - if (debug_windows) - fprintf (stderr, "freeing window @%p<%p,%lx,%p>\n", - windowp, windowp->data, windowp->size, windowp->i); - if (i->refcount != 0) - return; - - if (i->mapped) - { -#ifdef HAVE_MMAP - munmap (i->data, i->size); - goto no_free; -#else - abort (); -#endif - } -#ifdef HAVE_MPROTECT - mprotect (i->data, i->size, PROT_READ | PROT_WRITE); -#endif - free (i->data); -#ifdef HAVE_MMAP - no_free: -#endif - i->data = 0; - /* There should be no more references to i at this point. */ - free (i); -} -#endif - -static int ok_to_map = 1; - -boolean -bfd_get_file_window (abfd, offset, size, windowp, writable) - bfd *abfd; - file_ptr offset; - bfd_size_type size; - bfd_window *windowp; - boolean writable; -{ - static size_t pagesize; - bfd_window_internal *i = windowp->i; - size_t size_to_alloc = size; - -#ifndef USE_MMAP - abort (); -#endif - - if (debug_windows) - fprintf (stderr, "bfd_get_file_window (%p, %6ld, %6ld, %p<%p,%lx,%p>, %d)", - abfd, (long) offset, (long) size, - windowp, windowp->data, windowp->size, windowp->i, - writable); - - /* Make sure we know the page size, so we can be friendly to mmap. */ - if (pagesize == 0) - pagesize = getpagesize (); - if (pagesize == 0) - abort (); - - if (i == 0) - { - windowp->i = i = (bfd_window_internal *) bfd_zmalloc (sizeof (bfd_window_internal)); - if (i == 0) - return false; - i->data = 0; - } -#ifdef HAVE_MMAP - if (ok_to_map - && (i->data == 0 || i->mapped == 1) - && (abfd->flags & BFD_IN_MEMORY) == 0) - { - file_ptr file_offset, offset2; - size_t real_size; - int fd; - FILE *f; - - /* Find the real file and the real offset into it. */ - while (abfd->my_archive != NULL) - { - offset += abfd->origin; - abfd = abfd->my_archive; - } - f = bfd_cache_lookup (abfd); - fd = fileno (f); - - /* Compute offsets and size for mmap and for the user's data. */ - offset2 = offset % pagesize; - if (offset2 < 0) - abort (); - file_offset = offset - offset2; - real_size = offset + size - file_offset; - real_size = real_size + pagesize - 1; - real_size -= real_size % pagesize; - - /* If we're re-using a memory region, make sure it's big enough. */ - if (i->data && i->size < size) - { - munmap (i->data, i->size); - i->data = 0; - } - i->data = mmap (i->data, real_size, - writable ? PROT_WRITE | PROT_READ : PROT_READ, - (writable - ? MAP_FILE | MAP_PRIVATE - : MAP_FILE | MAP_SHARED), - fd, file_offset); - if (i->data == (PTR) -1) - { - /* An error happened. Report it, or try using malloc, or - something. */ - bfd_set_error (bfd_error_system_call); - i->data = 0; - windowp->data = 0; - if (debug_windows) - fprintf (stderr, "\t\tmmap failed!\n"); - return false; - } - if (debug_windows) - fprintf (stderr, "\n\tmapped %ld at %p, offset is %ld\n", - (long) real_size, i->data, (long) offset2); - i->size = real_size; - windowp->data = (PTR) ((bfd_byte *) i->data + offset2); - windowp->size = size; - i->mapped = 1; - return true; - } - else if (debug_windows) - { - if (ok_to_map) - fprintf (stderr, "not mapping: data=%lx mapped=%d\n", - (unsigned long) i->data, (int) i->mapped); - else - fprintf (stderr, "not mapping: env var not set\n"); - } -#else - ok_to_map = 0; -#endif - -#ifdef HAVE_MPROTECT - if (!writable) - { - size_to_alloc += pagesize - 1; - size_to_alloc -= size_to_alloc % pagesize; - } -#endif - if (debug_windows) - fprintf (stderr, "\n\t%s(%6ld)", - i->data ? "realloc" : " malloc", (long) size_to_alloc); - i->data = (PTR) bfd_realloc (i->data, size_to_alloc); - if (debug_windows) - fprintf (stderr, "\t-> %p\n", i->data); - i->refcount = 1; - if (i->data == NULL) - { - if (size_to_alloc == 0) - return true; - bfd_set_error (bfd_error_no_memory); - return false; - } - if (bfd_seek (abfd, offset, SEEK_SET) != 0) - return false; - i->size = bfd_read (i->data, size, 1, abfd); - if (i->size != size) - return false; - i->mapped = 0; -#ifdef HAVE_MPROTECT - if (!writable) - { - if (debug_windows) - fprintf (stderr, "\tmprotect (%p, %ld, PROT_READ)\n", i->data, - (long) i->size); - mprotect (i->data, i->size, PROT_READ); - } -#endif - windowp->data = i->data; - windowp->size = i->size; - return true; -} - -bfd_size_type -bfd_write (ptr, size, nitems, abfd) - CONST PTR ptr; - bfd_size_type size; - bfd_size_type nitems; - bfd *abfd; -{ - long nwrote; - - if ((abfd->flags & BFD_IN_MEMORY) != 0) - abort (); - - nwrote = fwrite (ptr, 1, (size_t) (size * nitems), - bfd_cache_lookup (abfd)); -#ifdef FILE_OFFSET_IS_CHAR_INDEX - if (nwrote > 0) - abfd->where += nwrote; -#endif - if ((bfd_size_type) nwrote != size * nitems) - { -#ifdef ENOSPC - if (nwrote >= 0) - errno = ENOSPC; -#endif - bfd_set_error (bfd_error_system_call); - } - return nwrote; -} - -/* -INTERNAL_FUNCTION - bfd_write_bigendian_4byte_int - -SYNOPSIS - void bfd_write_bigendian_4byte_int(bfd *abfd, int i); - -DESCRIPTION - Write a 4 byte integer @var{i} to the output BFD @var{abfd}, in big - endian order regardless of what else is going on. This is useful in - archives. - -*/ -void -bfd_write_bigendian_4byte_int (abfd, i) - bfd *abfd; - int i; -{ - bfd_byte buffer[4]; - bfd_putb32(i, buffer); - if (bfd_write((PTR)buffer, 4, 1, abfd) != 4) - abort (); -} - -long -bfd_tell (abfd) - bfd *abfd; -{ - file_ptr ptr; - - if ((abfd->flags & BFD_IN_MEMORY) != 0) - return abfd->where; - - ptr = ftell (bfd_cache_lookup(abfd)); - - if (abfd->my_archive) - ptr -= abfd->origin; - abfd->where = ptr; - return ptr; -} - -int -bfd_flush (abfd) - bfd *abfd; -{ - if ((abfd->flags & BFD_IN_MEMORY) != 0) - return 0; - return fflush (bfd_cache_lookup(abfd)); -} - -/* Returns 0 for success, negative value for failure (in which case - bfd_get_error can retrieve the error code). */ -int -bfd_stat (abfd, statbuf) - bfd *abfd; - struct stat *statbuf; -{ - FILE *f; - int result; - - if ((abfd->flags & BFD_IN_MEMORY) != 0) - abort (); - - f = bfd_cache_lookup (abfd); - if (f == NULL) - { - bfd_set_error (bfd_error_system_call); - return -1; - } - result = fstat (fileno (f), statbuf); - if (result < 0) - bfd_set_error (bfd_error_system_call); - return result; -} - -/* Returns 0 for success, nonzero for failure (in which case bfd_get_error - can retrieve the error code). */ - -int -bfd_seek (abfd, position, direction) - bfd *abfd; - file_ptr position; - int direction; -{ - int result; - FILE *f; - file_ptr file_position; - /* For the time being, a BFD may not seek to it's end. The problem - is that we don't easily have a way to recognize the end of an - element in an archive. */ - - BFD_ASSERT (direction == SEEK_SET || direction == SEEK_CUR); - - if (direction == SEEK_CUR && position == 0) - return 0; - - if ((abfd->flags & BFD_IN_MEMORY) != 0) - { - if (direction == SEEK_SET) - abfd->where = position; - else - abfd->where += position; - return 0; - } - -#ifdef FILE_OFFSET_IS_CHAR_INDEX - if (abfd->format != bfd_archive && abfd->my_archive == 0) - { -#if 0 - /* Explanation for this code: I'm only about 95+% sure that the above - conditions are sufficient and that all i/o calls are properly - adjusting the `where' field. So this is sort of an `assert' - that the `where' field is correct. If we can go a while without - tripping the abort, we can probably safely disable this code, - so that the real optimizations happen. */ - file_ptr where_am_i_now; - where_am_i_now = ftell (bfd_cache_lookup (abfd)); - if (abfd->my_archive) - where_am_i_now -= abfd->origin; - if (where_am_i_now != abfd->where) - abort (); -#endif - if (direction == SEEK_SET && position == abfd->where) - return 0; - } - else - { - /* We need something smarter to optimize access to archives. - Currently, anything inside an archive is read via the file - handle for the archive. Which means that a bfd_seek on one - component affects the `current position' in the archive, as - well as in any other component. - - It might be sufficient to put a spike through the cache - abstraction, and look to the archive for the file position, - but I think we should try for something cleaner. - - In the meantime, no optimization for archives. */ - } -#endif - - f = bfd_cache_lookup (abfd); - file_position = position; - if (direction == SEEK_SET && abfd->my_archive != NULL) - file_position += abfd->origin; - - result = fseek (f, file_position, direction); - - if (result != 0) - { - /* Force redetermination of `where' field. */ - bfd_tell (abfd); - bfd_set_error (bfd_error_system_call); - } - else - { -#ifdef FILE_OFFSET_IS_CHAR_INDEX - /* Adjust `where' field. */ - if (direction == SEEK_SET) - abfd->where = position; - else - abfd->where += position; -#endif - } - return result; -} - -/** The do-it-yourself (byte) sex-change kit */ - -/* The middle letter e.g. getshort indicates Big or Little endian - target machine. It doesn't matter what the byte order of the host - machine is; these routines work for either. */ - -/* FIXME: Should these take a count argument? - Answer (gnu@cygnus.com): No, but perhaps they should be inline - functions in swap.h #ifdef __GNUC__. - Gprof them later and find out. */ - -/* -FUNCTION - bfd_put_size -FUNCTION - bfd_get_size - -DESCRIPTION - These macros as used for reading and writing raw data in - sections; each access (except for bytes) is vectored through - the target format of the BFD and mangled accordingly. The - mangling performs any necessary endian translations and - removes alignment restrictions. Note that types accepted and - returned by these macros are identical so they can be swapped - around in macros---for example, @file{libaout.h} defines <> - to either <> or <>. - - In the put routines, @var{val} must be a <>. If we are on a - system without prototypes, the caller is responsible for making - sure that is true, with a cast if necessary. We don't cast - them in the macro definitions because that would prevent <> - or <> from detecting sins such as passing a pointer. - To detect calling these with less than a <>, use - <> on a host with 64 bit <>'s. - -. -.{* Byte swapping macros for user section data. *} -. -.#define bfd_put_8(abfd, val, ptr) \ -. (*((unsigned char *)(ptr)) = (unsigned char)(val)) -.#define bfd_put_signed_8 \ -. bfd_put_8 -.#define bfd_get_8(abfd, ptr) \ -. (*(unsigned char *)(ptr)) -.#define bfd_get_signed_8(abfd, ptr) \ -. ((*(unsigned char *)(ptr) ^ 0x80) - 0x80) -. -.#define bfd_put_16(abfd, val, ptr) \ -. BFD_SEND(abfd, bfd_putx16, ((val),(ptr))) -.#define bfd_put_signed_16 \ -. bfd_put_16 -.#define bfd_get_16(abfd, ptr) \ -. BFD_SEND(abfd, bfd_getx16, (ptr)) -.#define bfd_get_signed_16(abfd, ptr) \ -. BFD_SEND (abfd, bfd_getx_signed_16, (ptr)) -. -.#define bfd_put_32(abfd, val, ptr) \ -. BFD_SEND(abfd, bfd_putx32, ((val),(ptr))) -.#define bfd_put_signed_32 \ -. bfd_put_32 -.#define bfd_get_32(abfd, ptr) \ -. BFD_SEND(abfd, bfd_getx32, (ptr)) -.#define bfd_get_signed_32(abfd, ptr) \ -. BFD_SEND(abfd, bfd_getx_signed_32, (ptr)) -. -.#define bfd_put_64(abfd, val, ptr) \ -. BFD_SEND(abfd, bfd_putx64, ((val), (ptr))) -.#define bfd_put_signed_64 \ -. bfd_put_64 -.#define bfd_get_64(abfd, ptr) \ -. BFD_SEND(abfd, bfd_getx64, (ptr)) -.#define bfd_get_signed_64(abfd, ptr) \ -. BFD_SEND(abfd, bfd_getx_signed_64, (ptr)) -. -*/ - -/* -FUNCTION - bfd_h_put_size - bfd_h_get_size - -DESCRIPTION - These macros have the same function as their <> - bretheren, except that they are used for removing information - for the header records of object files. Believe it or not, - some object files keep their header records in big endian - order and their data in little endian order. -. -.{* Byte swapping macros for file header data. *} -. -.#define bfd_h_put_8(abfd, val, ptr) \ -. bfd_put_8 (abfd, val, ptr) -.#define bfd_h_put_signed_8(abfd, val, ptr) \ -. bfd_put_8 (abfd, val, ptr) -.#define bfd_h_get_8(abfd, ptr) \ -. bfd_get_8 (abfd, ptr) -.#define bfd_h_get_signed_8(abfd, ptr) \ -. bfd_get_signed_8 (abfd, ptr) -. -.#define bfd_h_put_16(abfd, val, ptr) \ -. BFD_SEND(abfd, bfd_h_putx16,(val,ptr)) -.#define bfd_h_put_signed_16 \ -. bfd_h_put_16 -.#define bfd_h_get_16(abfd, ptr) \ -. BFD_SEND(abfd, bfd_h_getx16,(ptr)) -.#define bfd_h_get_signed_16(abfd, ptr) \ -. BFD_SEND(abfd, bfd_h_getx_signed_16, (ptr)) -. -.#define bfd_h_put_32(abfd, val, ptr) \ -. BFD_SEND(abfd, bfd_h_putx32,(val,ptr)) -.#define bfd_h_put_signed_32 \ -. bfd_h_put_32 -.#define bfd_h_get_32(abfd, ptr) \ -. BFD_SEND(abfd, bfd_h_getx32,(ptr)) -.#define bfd_h_get_signed_32(abfd, ptr) \ -. BFD_SEND(abfd, bfd_h_getx_signed_32, (ptr)) -. -.#define bfd_h_put_64(abfd, val, ptr) \ -. BFD_SEND(abfd, bfd_h_putx64,(val, ptr)) -.#define bfd_h_put_signed_64 \ -. bfd_h_put_64 -.#define bfd_h_get_64(abfd, ptr) \ -. BFD_SEND(abfd, bfd_h_getx64,(ptr)) -.#define bfd_h_get_signed_64(abfd, ptr) \ -. BFD_SEND(abfd, bfd_h_getx_signed_64, (ptr)) -. -*/ - -/* Sign extension to bfd_signed_vma. */ -#define COERCE16(x) (((bfd_signed_vma) (x) ^ 0x8000) - 0x8000) -#define COERCE32(x) (((bfd_signed_vma) (x) ^ 0x80000000) - 0x80000000) -#define EIGHT_GAZILLION (((BFD_HOST_64_BIT)0x80000000) << 32) -#define COERCE64(x) \ - (((bfd_signed_vma) (x) ^ EIGHT_GAZILLION) - EIGHT_GAZILLION) - -bfd_vma -bfd_getb16 (addr) - register const bfd_byte *addr; -{ - return (addr[0] << 8) | addr[1]; -} - -bfd_vma -bfd_getl16 (addr) - register const bfd_byte *addr; -{ - return (addr[1] << 8) | addr[0]; -} - -bfd_signed_vma -bfd_getb_signed_16 (addr) - register const bfd_byte *addr; -{ - return COERCE16((addr[0] << 8) | addr[1]); -} - -bfd_signed_vma -bfd_getl_signed_16 (addr) - register const bfd_byte *addr; -{ - return COERCE16((addr[1] << 8) | addr[0]); -} - -void -bfd_putb16 (data, addr) - bfd_vma data; - register bfd_byte *addr; -{ - addr[0] = (bfd_byte)(data >> 8); - addr[1] = (bfd_byte )data; -} - -void -bfd_putl16 (data, addr) - bfd_vma data; - register bfd_byte *addr; -{ - addr[0] = (bfd_byte )data; - addr[1] = (bfd_byte)(data >> 8); -} - -bfd_vma -bfd_getb32 (addr) - register const bfd_byte *addr; -{ - return (((((bfd_vma)addr[0] << 8) | addr[1]) << 8) - | addr[2]) << 8 | addr[3]; -} - -bfd_vma -bfd_getl32 (addr) - register const bfd_byte *addr; -{ - return (((((bfd_vma)addr[3] << 8) | addr[2]) << 8) - | addr[1]) << 8 | addr[0]; -} - -bfd_signed_vma -bfd_getb_signed_32 (addr) - register const bfd_byte *addr; -{ - return COERCE32((((((bfd_vma)addr[0] << 8) | addr[1]) << 8) - | addr[2]) << 8 | addr[3]); -} - -bfd_signed_vma -bfd_getl_signed_32 (addr) - register const bfd_byte *addr; -{ - return COERCE32((((((bfd_vma)addr[3] << 8) | addr[2]) << 8) - | addr[1]) << 8 | addr[0]); -} - -bfd_vma -bfd_getb64 (addr) - register const bfd_byte *addr; -{ -#ifdef BFD64 - bfd_vma low, high; - - high= ((((((((addr[0]) << 8) | - addr[1]) << 8) | - addr[2]) << 8) | - addr[3]) ); - - low = (((((((((bfd_vma)addr[4]) << 8) | - addr[5]) << 8) | - addr[6]) << 8) | - addr[7])); - - return high << 32 | low; -#else - BFD_FAIL(); - return 0; -#endif -} - -bfd_vma -bfd_getl64 (addr) - register const bfd_byte *addr; -{ -#ifdef BFD64 - bfd_vma low, high; - high= (((((((addr[7] << 8) | - addr[6]) << 8) | - addr[5]) << 8) | - addr[4])); - - low = ((((((((bfd_vma)addr[3] << 8) | - addr[2]) << 8) | - addr[1]) << 8) | - addr[0]) ); - - return high << 32 | low; -#else - BFD_FAIL(); - return 0; -#endif - -} - -bfd_signed_vma -bfd_getb_signed_64 (addr) - register const bfd_byte *addr; -{ -#ifdef BFD64 - bfd_vma low, high; - - high= ((((((((addr[0]) << 8) | - addr[1]) << 8) | - addr[2]) << 8) | - addr[3]) ); - - low = (((((((((bfd_vma)addr[4]) << 8) | - addr[5]) << 8) | - addr[6]) << 8) | - addr[7])); - - return COERCE64(high << 32 | low); -#else - BFD_FAIL(); - return 0; -#endif -} - -bfd_signed_vma -bfd_getl_signed_64 (addr) - register const bfd_byte *addr; -{ -#ifdef BFD64 - bfd_vma low, high; - high= (((((((addr[7] << 8) | - addr[6]) << 8) | - addr[5]) << 8) | - addr[4])); - - low = ((((((((bfd_vma)addr[3] << 8) | - addr[2]) << 8) | - addr[1]) << 8) | - addr[0]) ); - - return COERCE64(high << 32 | low); -#else - BFD_FAIL(); - return 0; -#endif -} - -void -bfd_putb32 (data, addr) - bfd_vma data; - register bfd_byte *addr; -{ - addr[0] = (bfd_byte)(data >> 24); - addr[1] = (bfd_byte)(data >> 16); - addr[2] = (bfd_byte)(data >> 8); - addr[3] = (bfd_byte)data; -} - -void -bfd_putl32 (data, addr) - bfd_vma data; - register bfd_byte *addr; -{ - addr[0] = (bfd_byte)data; - addr[1] = (bfd_byte)(data >> 8); - addr[2] = (bfd_byte)(data >> 16); - addr[3] = (bfd_byte)(data >> 24); -} - -void -bfd_putb64 (data, addr) - bfd_vma data; - register bfd_byte *addr; -{ -#ifdef BFD64 - addr[0] = (bfd_byte)(data >> (7*8)); - addr[1] = (bfd_byte)(data >> (6*8)); - addr[2] = (bfd_byte)(data >> (5*8)); - addr[3] = (bfd_byte)(data >> (4*8)); - addr[4] = (bfd_byte)(data >> (3*8)); - addr[5] = (bfd_byte)(data >> (2*8)); - addr[6] = (bfd_byte)(data >> (1*8)); - addr[7] = (bfd_byte)(data >> (0*8)); -#else - BFD_FAIL(); -#endif -} - -void -bfd_putl64 (data, addr) - bfd_vma data; - register bfd_byte *addr; -{ -#ifdef BFD64 - addr[7] = (bfd_byte)(data >> (7*8)); - addr[6] = (bfd_byte)(data >> (6*8)); - addr[5] = (bfd_byte)(data >> (5*8)); - addr[4] = (bfd_byte)(data >> (4*8)); - addr[3] = (bfd_byte)(data >> (3*8)); - addr[2] = (bfd_byte)(data >> (2*8)); - addr[1] = (bfd_byte)(data >> (1*8)); - addr[0] = (bfd_byte)(data >> (0*8)); -#else - BFD_FAIL(); -#endif -} - -/* Default implementation */ - -boolean -_bfd_generic_get_section_contents (abfd, section, location, offset, count) - bfd *abfd; - sec_ptr section; - PTR location; - file_ptr offset; - bfd_size_type count; -{ - if (count == 0) - return true; - if ((bfd_size_type)(offset+count) > section->_raw_size - || bfd_seek(abfd, (file_ptr)(section->filepos + offset), SEEK_SET) == -1 - || bfd_read(location, (bfd_size_type)1, count, abfd) != count) - return (false); /* on error */ - return (true); -} - -boolean -_bfd_generic_get_section_contents_in_window (abfd, section, w, offset, count) - bfd *abfd; - sec_ptr section; - bfd_window *w; - file_ptr offset; - bfd_size_type count; -{ -#ifdef USE_MMAP - if (count == 0) - return true; - if (abfd->xvec->_bfd_get_section_contents != _bfd_generic_get_section_contents) - { - /* We don't know what changes the bfd's get_section_contents - method may have to make. So punt trying to map the file - window, and let get_section_contents do its thing. */ - /* @@ FIXME : If the internal window has a refcount of 1 and was - allocated with malloc instead of mmap, just reuse it. */ - bfd_free_window (w); - w->i = (bfd_window_internal *) bfd_zmalloc (sizeof (bfd_window_internal)); - if (w->i == NULL) - return false; - w->i->data = (PTR) bfd_malloc ((size_t) count); - if (w->i->data == NULL) - { - free (w->i); - w->i = NULL; - return false; - } - w->i->mapped = 0; - w->i->refcount = 1; - w->size = w->i->size = count; - w->data = w->i->data; - return bfd_get_section_contents (abfd, section, w->data, offset, count); - } - if ((bfd_size_type) (offset+count) > section->_raw_size - || (bfd_get_file_window (abfd, section->filepos + offset, count, w, true) - == false)) - return false; - return true; -#else - abort (); -#endif -} - -/* This generic function can only be used in implementations where creating - NEW sections is disallowed. It is useful in patching existing sections - in read-write files, though. See other set_section_contents functions - to see why it doesn't work for new sections. */ -boolean -_bfd_generic_set_section_contents (abfd, section, location, offset, count) - bfd *abfd; - sec_ptr section; - PTR location; - file_ptr offset; - bfd_size_type count; -{ - if (count == 0) - return true; - - if (bfd_seek (abfd, (file_ptr) (section->filepos + offset), SEEK_SET) == -1 - || bfd_write (location, (bfd_size_type) 1, count, abfd) != count) - return false; - - return true; -} - -/* -INTERNAL_FUNCTION - bfd_log2 - -SYNOPSIS - unsigned int bfd_log2(bfd_vma x); - -DESCRIPTION - Return the log base 2 of the value supplied, rounded up. E.g., an - @var{x} of 1025 returns 11. -*/ - -unsigned -bfd_log2(x) - bfd_vma x; -{ - unsigned result = 0; - while ( (bfd_vma)(1<< result) < x) - result++; - return result; -} - -boolean -bfd_generic_is_local_label (abfd, sym) - bfd *abfd; - asymbol *sym; -{ - char locals_prefix = (bfd_get_symbol_leading_char (abfd) == '_') ? 'L' : '.'; - - return (sym->name[0] == locals_prefix); -} - diff --git a/contrib/gdb/bfd/libbfd.h b/contrib/gdb/bfd/libbfd.h deleted file mode 100644 index 5cf504c..0000000 --- a/contrib/gdb/bfd/libbfd.h +++ /dev/null @@ -1,735 +0,0 @@ -/* libbfd.h -- Declarations used by bfd library *implementation*. - (This include file is not for users of the library.) - Copyright 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. - Written by Cygnus Support. - -** NOTE: libbfd.h is a GENERATED file. Don't change it; instead, -** change libbfd-in.h or the other BFD source files processed to -** generate this file. - -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. */ - -/* Align an address upward to a boundary, expressed as a number of bytes. - E.g. align to an 8-byte boundary with argument of 8. */ -#define BFD_ALIGN(this, boundary) \ - ((( (this) + ((boundary) -1)) & (~((boundary)-1)))) - -/* If you want to read and write large blocks, you might want to do it - in quanta of this amount */ -#define DEFAULT_BUFFERSIZE 8192 - -/* Set a tdata field. Can't use the other macros for this, since they - do casts, and casting to the left of assignment isn't portable. */ -#define set_tdata(bfd, v) ((bfd)->tdata.any = (PTR) (v)) - -/* If BFD_IN_MEMORY is set for a BFD, then the iostream fields points - to an instance of this structure. */ - -struct bfd_in_memory -{ - /* Size of buffer. */ - bfd_size_type size; - /* Buffer holding contents of BFD. */ - bfd_byte *buffer; -}; - -/* tdata for an archive. For an input archive, cache - needs to be free()'d. For an output archive, symdefs do. */ - -struct artdata { - file_ptr first_file_filepos; - /* Speed up searching the armap */ - struct ar_cache *cache; - bfd *archive_head; /* Only interesting in output routines */ - carsym *symdefs; /* the symdef entries */ - symindex symdef_count; /* how many there are */ - char *extended_names; /* clever intel extension */ - /* when more compilers are standard C, this can be a time_t */ - long armap_timestamp; /* Timestamp value written into armap. - This is used for BSD archives to check - that the timestamp is recent enough - for the BSD linker to not complain, - just before we finish writing an - archive. */ - file_ptr armap_datepos; /* Position within archive to seek to - rewrite the date field. */ - PTR tdata; /* Backend specific information. */ -}; - -#define bfd_ardata(bfd) ((bfd)->tdata.aout_ar_data) - -/* Goes in bfd's arelt_data slot */ -struct areltdata { - char * arch_header; /* it's actually a string */ - unsigned int parsed_size; /* octets of filesize not including ar_hdr */ - char *filename; /* null-terminated */ -}; - -#define arelt_size(bfd) (((struct areltdata *)((bfd)->arelt_data))->parsed_size) - -extern PTR bfd_malloc PARAMS ((size_t)); -extern PTR bfd_realloc PARAMS ((PTR, size_t)); -extern PTR bfd_zmalloc PARAMS ((size_t)); - -extern bfd_error_handler_type _bfd_error_handler; - -/* These routines allocate and free things on the BFD's obstack. */ - -PTR bfd_alloc PARAMS ((bfd *abfd, size_t size)); -PTR bfd_zalloc PARAMS ((bfd *abfd, size_t size)); -void bfd_alloc_grow PARAMS ((bfd *abfd, PTR thing, size_t size)); -PTR bfd_alloc_finish PARAMS ((bfd *abfd)); -PTR bfd_alloc_by_size_t PARAMS ((bfd *abfd, size_t wanted)); - -#define bfd_release(x,y) (void) obstack_free(&(x->memory),y) - -bfd * _bfd_create_empty_archive_element_shell PARAMS ((bfd *obfd)); -bfd * _bfd_look_for_bfd_in_cache PARAMS ((bfd *arch_bfd, file_ptr index)); -boolean _bfd_add_bfd_to_archive_cache PARAMS ((bfd *, file_ptr, bfd *)); -boolean _bfd_generic_mkarchive PARAMS ((bfd *abfd)); -const bfd_target *bfd_generic_archive_p PARAMS ((bfd *abfd)); -boolean bfd_slurp_armap PARAMS ((bfd *abfd)); -boolean bfd_slurp_bsd_armap_f2 PARAMS ((bfd *abfd)); -#define bfd_slurp_bsd_armap bfd_slurp_armap -#define bfd_slurp_coff_armap bfd_slurp_armap -boolean _bfd_slurp_extended_name_table PARAMS ((bfd *abfd)); -extern boolean _bfd_construct_extended_name_table - PARAMS ((bfd *, boolean, char **, bfd_size_type *)); -boolean _bfd_write_archive_contents PARAMS ((bfd *abfd)); -boolean _bfd_compute_and_write_armap PARAMS ((bfd *, unsigned int elength)); -bfd *_bfd_get_elt_at_filepos PARAMS ((bfd *archive, file_ptr filepos)); -extern bfd *_bfd_generic_get_elt_at_index PARAMS ((bfd *, symindex)); -bfd * _bfd_new_bfd PARAMS ((void)); - -boolean bfd_false PARAMS ((bfd *ignore)); -boolean bfd_true PARAMS ((bfd *ignore)); -PTR bfd_nullvoidptr PARAMS ((bfd *ignore)); -int bfd_0 PARAMS ((bfd *ignore)); -unsigned int bfd_0u PARAMS ((bfd *ignore)); -long bfd_0l PARAMS ((bfd *ignore)); -long _bfd_n1 PARAMS ((bfd *ignore)); -void bfd_void PARAMS ((bfd *ignore)); - -bfd *_bfd_new_bfd_contained_in PARAMS ((bfd *)); -const bfd_target *_bfd_dummy_target PARAMS ((bfd *abfd)); - -void bfd_dont_truncate_arname PARAMS ((bfd *abfd, CONST char *filename, - char *hdr)); -void bfd_bsd_truncate_arname PARAMS ((bfd *abfd, CONST char *filename, - char *hdr)); -void bfd_gnu_truncate_arname PARAMS ((bfd *abfd, CONST char *filename, - char *hdr)); - -boolean bsd_write_armap PARAMS ((bfd *arch, unsigned int elength, - struct orl *map, unsigned int orl_count, int stridx)); - -boolean coff_write_armap PARAMS ((bfd *arch, unsigned int elength, - struct orl *map, unsigned int orl_count, int stridx)); - -extern PTR _bfd_generic_read_ar_hdr PARAMS ((bfd *)); - -extern PTR _bfd_generic_read_ar_hdr_mag PARAMS ((bfd *, const char *)); - -bfd * bfd_generic_openr_next_archived_file PARAMS ((bfd *archive, - bfd *last_file)); - -int bfd_generic_stat_arch_elt PARAMS ((bfd *, struct stat *)); - -#define _bfd_read_ar_hdr(abfd) \ - BFD_SEND (abfd, _bfd_read_ar_hdr_fn, (abfd)) - -/* Generic routines to use for BFD_JUMP_TABLE_GENERIC. Use - BFD_JUMP_TABLE_GENERIC (_bfd_generic). */ - -#define _bfd_generic_close_and_cleanup bfd_true -#define _bfd_generic_bfd_free_cached_info bfd_true -#define _bfd_generic_new_section_hook \ - ((boolean (*) PARAMS ((bfd *, asection *))) bfd_true) -extern boolean _bfd_generic_get_section_contents - PARAMS ((bfd *, asection *, PTR location, file_ptr offset, - bfd_size_type count)); -extern boolean _bfd_generic_get_section_contents_in_window - PARAMS ((bfd *, asection *, bfd_window *, file_ptr, bfd_size_type)); - -/* Generic routines to use for BFD_JUMP_TABLE_COPY. Use - BFD_JUMP_TABLE_COPY (_bfd_generic). */ - -#define _bfd_generic_bfd_copy_private_bfd_data \ - ((boolean (*) PARAMS ((bfd *, bfd *))) bfd_true) -#define _bfd_generic_bfd_merge_private_bfd_data \ - ((boolean (*) PARAMS ((bfd *, bfd *))) bfd_true) -#define _bfd_generic_bfd_set_private_flags \ - ((boolean (*) PARAMS ((bfd *, flagword))) bfd_true) -#define _bfd_generic_bfd_copy_private_section_data \ - ((boolean (*) PARAMS ((bfd *, asection *, bfd *, asection *))) bfd_true) -#define _bfd_generic_bfd_copy_private_symbol_data \ - ((boolean (*) PARAMS ((bfd *, asymbol *, bfd *, asymbol *))) bfd_true) -#define _bfd_generic_bfd_print_private_bfd_data \ - ((boolean (*) PARAMS ((bfd *, PTR))) bfd_true) - -/* Routines to use for BFD_JUMP_TABLE_CORE when there is no core file - support. Use BFD_JUMP_TABLE_CORE (_bfd_nocore). */ - -extern char *_bfd_nocore_core_file_failing_command PARAMS ((bfd *)); -extern int _bfd_nocore_core_file_failing_signal PARAMS ((bfd *)); -extern boolean _bfd_nocore_core_file_matches_executable_p - PARAMS ((bfd *, bfd *)); - -/* Routines to use for BFD_JUMP_TABLE_ARCHIVE when there is no archive - file support. Use BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive). */ - -#define _bfd_noarchive_slurp_armap bfd_false -#define _bfd_noarchive_slurp_extended_name_table bfd_false -#define _bfd_noarchive_construct_extended_name_table \ - ((boolean (*) PARAMS ((bfd *, char **, bfd_size_type *, const char **))) \ - bfd_false) -#define _bfd_noarchive_truncate_arname \ - ((void (*) PARAMS ((bfd *, const char *, char *))) bfd_void) -#define _bfd_noarchive_write_armap \ - ((boolean (*) \ - PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int))) \ - bfd_false) -#define _bfd_noarchive_read_ar_hdr bfd_nullvoidptr -#define _bfd_noarchive_openr_next_archived_file \ - ((bfd *(*) PARAMS ((bfd *, bfd *))) bfd_nullvoidptr) -#define _bfd_noarchive_get_elt_at_index \ - ((bfd *(*) PARAMS ((bfd *, symindex))) bfd_nullvoidptr) -#define _bfd_noarchive_generic_stat_arch_elt bfd_generic_stat_arch_elt -#define _bfd_noarchive_update_armap_timestamp bfd_false - -/* Routines to use for BFD_JUMP_TABLE_ARCHIVE to get BSD style - archives. Use BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_bsd). */ - -#define _bfd_archive_bsd_slurp_armap bfd_slurp_bsd_armap -#define _bfd_archive_bsd_slurp_extended_name_table \ - _bfd_slurp_extended_name_table -extern boolean _bfd_archive_bsd_construct_extended_name_table - PARAMS ((bfd *, char **, bfd_size_type *, const char **)); -#define _bfd_archive_bsd_truncate_arname bfd_bsd_truncate_arname -#define _bfd_archive_bsd_write_armap bsd_write_armap -#define _bfd_archive_bsd_read_ar_hdr _bfd_generic_read_ar_hdr -#define _bfd_archive_bsd_openr_next_archived_file \ - bfd_generic_openr_next_archived_file -#define _bfd_archive_bsd_get_elt_at_index _bfd_generic_get_elt_at_index -#define _bfd_archive_bsd_generic_stat_arch_elt \ - bfd_generic_stat_arch_elt -extern boolean _bfd_archive_bsd_update_armap_timestamp PARAMS ((bfd *)); - -/* Routines to use for BFD_JUMP_TABLE_ARCHIVE to get COFF style - archives. Use BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff). */ - -#define _bfd_archive_coff_slurp_armap bfd_slurp_coff_armap -#define _bfd_archive_coff_slurp_extended_name_table \ - _bfd_slurp_extended_name_table -extern boolean _bfd_archive_coff_construct_extended_name_table - PARAMS ((bfd *, char **, bfd_size_type *, const char **)); -#define _bfd_archive_coff_truncate_arname bfd_dont_truncate_arname -#define _bfd_archive_coff_write_armap coff_write_armap -#define _bfd_archive_coff_read_ar_hdr _bfd_generic_read_ar_hdr -#define _bfd_archive_coff_openr_next_archived_file \ - bfd_generic_openr_next_archived_file -#define _bfd_archive_coff_get_elt_at_index _bfd_generic_get_elt_at_index -#define _bfd_archive_coff_generic_stat_arch_elt \ - bfd_generic_stat_arch_elt -#define _bfd_archive_coff_update_armap_timestamp bfd_true - -/* Routines to use for BFD_JUMP_TABLE_SYMBOLS where there is no symbol - support. Use BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols). */ - -#define _bfd_nosymbols_get_symtab_upper_bound _bfd_n1 -#define _bfd_nosymbols_get_symtab \ - ((long (*) PARAMS ((bfd *, asymbol **))) _bfd_n1) -#define _bfd_nosymbols_make_empty_symbol \ - ((asymbol *(*) PARAMS ((bfd *))) bfd_nullvoidptr) -#define _bfd_nosymbols_print_symbol \ - ((void (*) PARAMS ((bfd *, PTR, asymbol *, bfd_print_symbol_type))) bfd_void) -#define _bfd_nosymbols_get_symbol_info \ - ((void (*) PARAMS ((bfd *, asymbol *, symbol_info *))) bfd_void) -#define _bfd_nosymbols_bfd_is_local_label \ - ((boolean (*) PARAMS ((bfd *, asymbol *))) bfd_false) -#define _bfd_nosymbols_get_lineno \ - ((alent *(*) PARAMS ((bfd *, asymbol *))) bfd_nullvoidptr) -#define _bfd_nosymbols_find_nearest_line \ - ((boolean (*) \ - PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **, \ - const char **, unsigned int *))) \ - bfd_false) -#define _bfd_nosymbols_bfd_make_debug_symbol \ - ((asymbol *(*) PARAMS ((bfd *, PTR, unsigned long))) bfd_nullvoidptr) -#define _bfd_nosymbols_read_minisymbols \ - ((long (*) PARAMS ((bfd *, boolean, PTR *, unsigned int *))) _bfd_n1) -#define _bfd_nosymbols_minisymbol_to_symbol \ - ((asymbol *(*) PARAMS ((bfd *, boolean, const PTR, asymbol *))) \ - bfd_nullvoidptr) - -/* Routines to use for BFD_JUMP_TABLE_RELOCS when there is no reloc - support. Use BFD_JUMP_TABLE_RELOCS (_bfd_norelocs). */ - -#define _bfd_norelocs_get_reloc_upper_bound \ - ((long (*) PARAMS ((bfd *, asection *))) _bfd_n1) -#define _bfd_norelocs_canonicalize_reloc \ - ((long (*) PARAMS ((bfd *, asection *, arelent **, asymbol **))) _bfd_n1) -#define _bfd_norelocs_bfd_reloc_type_lookup \ - ((reloc_howto_type *(*) PARAMS ((bfd *, bfd_reloc_code_real_type))) \ - bfd_nullvoidptr) - -/* Routines to use for BFD_JUMP_TABLE_WRITE for targets which may not - be written. Use BFD_JUMP_TABLE_WRITE (_bfd_nowrite). */ - -#define _bfd_nowrite_set_arch_mach \ - ((boolean (*) PARAMS ((bfd *, enum bfd_architecture, unsigned long))) \ - bfd_false) -#define _bfd_nowrite_set_section_contents \ - ((boolean (*) PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type))) \ - bfd_false) - -/* Generic routines to use for BFD_JUMP_TABLE_WRITE. Use - BFD_JUMP_TABLE_WRITE (_bfd_generic). */ - -#define _bfd_generic_set_arch_mach bfd_default_set_arch_mach -extern boolean _bfd_generic_set_section_contents - PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type)); - -/* Routines to use for BFD_JUMP_TABLE_LINK for targets which do not - support linking. Use BFD_JUMP_TABLE_LINK (_bfd_nolink). */ - -#define _bfd_nolink_sizeof_headers ((int (*) PARAMS ((bfd *, boolean))) bfd_0) -#define _bfd_nolink_bfd_get_relocated_section_contents \ - ((bfd_byte *(*) \ - PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, \ - bfd_byte *, boolean, asymbol **))) \ - bfd_nullvoidptr) -#define _bfd_nolink_bfd_relax_section \ - ((boolean (*) \ - PARAMS ((bfd *, asection *, struct bfd_link_info *, boolean *))) \ - bfd_false) -#define _bfd_nolink_bfd_link_hash_table_create \ - ((struct bfd_link_hash_table *(*) PARAMS ((bfd *))) bfd_nullvoidptr) -#define _bfd_nolink_bfd_link_add_symbols \ - ((boolean (*) PARAMS ((bfd *, struct bfd_link_info *))) bfd_false) -#define _bfd_nolink_bfd_final_link \ - ((boolean (*) PARAMS ((bfd *, struct bfd_link_info *))) bfd_false) -#define _bfd_nolink_bfd_link_split_section \ - ((boolean (*) PARAMS ((bfd *, struct sec *))) bfd_false) - -/* Routines to use for BFD_JUMP_TABLE_DYNAMIC for targets which do not - have dynamic symbols or relocs. Use BFD_JUMP_TABLE_DYNAMIC - (_bfd_nodynamic). */ - -#define _bfd_nodynamic_get_dynamic_symtab_upper_bound _bfd_n1 -#define _bfd_nodynamic_canonicalize_dynamic_symtab \ - ((long (*) PARAMS ((bfd *, asymbol **))) _bfd_n1) -#define _bfd_nodynamic_get_dynamic_reloc_upper_bound _bfd_n1 -#define _bfd_nodynamic_canonicalize_dynamic_reloc \ - ((long (*) PARAMS ((bfd *, arelent **, asymbol **))) _bfd_n1) - -/* Generic routine to determine of the given symbol is a local - label. */ -extern boolean bfd_generic_is_local_label PARAMS ((bfd *, asymbol *)); - -/* Generic minisymbol routines. */ -extern long _bfd_generic_read_minisymbols - PARAMS ((bfd *, boolean, PTR *, unsigned int *)); -extern asymbol *_bfd_generic_minisymbol_to_symbol - PARAMS ((bfd *, boolean, const PTR, asymbol *)); - -/* Find the nearest line using .stab/.stabstr sections. */ -extern boolean _bfd_stab_section_find_nearest_line - PARAMS ((bfd *, asymbol **, asection *, bfd_vma, boolean *, const char **, - const char **, unsigned int *, PTR *)); - -/* A routine to create entries for a bfd_link_hash_table. */ -extern struct bfd_hash_entry *_bfd_link_hash_newfunc - PARAMS ((struct bfd_hash_entry *entry, - struct bfd_hash_table *table, - const char *string)); - -/* Initialize a bfd_link_hash_table. */ -extern boolean _bfd_link_hash_table_init - PARAMS ((struct bfd_link_hash_table *, bfd *, - struct bfd_hash_entry *(*) (struct bfd_hash_entry *, - struct bfd_hash_table *, - const char *))); - -/* Generic link hash table creation routine. */ -extern struct bfd_link_hash_table *_bfd_generic_link_hash_table_create - PARAMS ((bfd *)); - -/* Generic add symbol routine. */ -extern boolean _bfd_generic_link_add_symbols - PARAMS ((bfd *, struct bfd_link_info *)); - -/* Generic add symbol routine. This version is used by targets for - which the linker must collect constructors and destructors by name, - as the collect2 program does. */ -extern boolean _bfd_generic_link_add_symbols_collect - PARAMS ((bfd *, struct bfd_link_info *)); - -/* Generic archive add symbol routine. */ -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; - -/* Generic routine to add a single symbol. */ -extern boolean _bfd_generic_link_add_one_symbol - PARAMS ((struct bfd_link_info *, bfd *, const char *name, flagword, - asection *, bfd_vma, const char *, boolean copy, - boolean constructor, struct bfd_link_hash_entry **)); - -/* Generic link routine. */ -extern boolean _bfd_generic_final_link - PARAMS ((bfd *, struct bfd_link_info *)); - -extern boolean _bfd_generic_link_split_section - PARAMS ((bfd *, struct sec *)); - -/* Generic reloc_link_order processing routine. */ -extern boolean _bfd_generic_reloc_link_order - PARAMS ((bfd *, struct bfd_link_info *, asection *, - struct bfd_link_order *)); - -/* Default link order processing routine. */ -extern boolean _bfd_default_link_order - PARAMS ((bfd *, struct bfd_link_info *, asection *, - struct bfd_link_order *)); - -/* Count the number of reloc entries in a link order list. */ -extern unsigned int _bfd_count_link_order_relocs - PARAMS ((struct bfd_link_order *)); - -/* Final link relocation routine. */ -extern bfd_reloc_status_type _bfd_final_link_relocate - PARAMS ((reloc_howto_type *, bfd *, asection *, bfd_byte *, - bfd_vma address, bfd_vma value, bfd_vma addend)); - -/* Relocate a particular location by a howto and a value. */ -extern bfd_reloc_status_type _bfd_relocate_contents - PARAMS ((reloc_howto_type *, bfd *, bfd_vma, bfd_byte *)); - -/* Create a string table. */ -extern struct bfd_strtab_hash *_bfd_stringtab_init PARAMS ((void)); - -/* Create an XCOFF .debug section style string table. */ -extern struct bfd_strtab_hash *_bfd_xcoff_stringtab_init PARAMS ((void)); - -/* Free a string table. */ -extern void _bfd_stringtab_free PARAMS ((struct bfd_strtab_hash *)); - -/* Get the size of a string table. */ -extern bfd_size_type _bfd_stringtab_size PARAMS ((struct bfd_strtab_hash *)); - -/* Add a string to a string table. */ -extern bfd_size_type _bfd_stringtab_add - PARAMS ((struct bfd_strtab_hash *, const char *, boolean hash, - boolean copy)); - -/* Write out a string table. */ -extern boolean _bfd_stringtab_emit PARAMS ((bfd *, struct bfd_strtab_hash *)); - -/* Macros to tell if bfds are read or write enabled. - - Note that bfds open for read may be scribbled into if the fd passed - to bfd_fdopenr is actually open both for read and write - simultaneously. However an output bfd will never be open for - read. Therefore sometimes you want to check bfd_read_p or - !bfd_read_p, and only sometimes bfd_write_p. -*/ - -#define bfd_read_p(abfd) ((abfd)->direction == read_direction || (abfd)->direction == both_direction) -#define bfd_write_p(abfd) ((abfd)->direction == write_direction || (abfd)->direction == both_direction) - -void bfd_assert PARAMS ((const char*,int)); - -#define BFD_ASSERT(x) \ -{ if (!(x)) bfd_assert(__FILE__,__LINE__); } - -#define BFD_FAIL() \ -{ bfd_assert(__FILE__,__LINE__); } - -FILE * bfd_cache_lookup_worker PARAMS ((bfd *)); - -extern bfd *bfd_last_cache; - -/* Now Steve, what's the story here? */ -#ifdef lint -#define itos(x) "l" -#define stoi(x) 1 -#else -#define itos(x) ((char*)(x)) -#define stoi(x) ((int)(x)) -#endif - -/* List of supported target vectors, and the default vector (if - bfd_default_vector[0] is NULL, there is no default). */ -extern const bfd_target * const bfd_target_vector[]; -extern const bfd_target * const bfd_default_vector[]; - -/* Functions shared by the ECOFF and MIPS ELF backends, which have no - other common header files. */ - -#if defined(__STDC__) || defined(ALMOST_STDC) -struct ecoff_find_line; -#endif - -extern boolean _bfd_ecoff_locate_line - PARAMS ((bfd *, asection *, bfd_vma, struct ecoff_debug_info * const, - const struct ecoff_debug_swap * const, struct ecoff_find_line *, - const char **, const char **, unsigned int *)); -extern boolean _bfd_ecoff_get_accumulated_pdr PARAMS ((PTR, bfd_byte *)); -extern boolean _bfd_ecoff_get_accumulated_sym PARAMS ((PTR, bfd_byte *)); -extern boolean _bfd_ecoff_get_accumulated_ss PARAMS ((PTR, bfd_byte *)); - -extern bfd_vma _bfd_get_gp_value PARAMS ((bfd *)); -extern void _bfd_set_gp_value PARAMS ((bfd *, bfd_vma)); - -/* And more follows */ - -void -bfd_write_bigendian_4byte_int PARAMS ((bfd *abfd, int i)); - -unsigned int -bfd_log2 PARAMS ((bfd_vma x)); - -#define BFD_CACHE_MAX_OPEN 10 -extern bfd *bfd_last_cache; - -#define bfd_cache_lookup(x) \ - ((x)==bfd_last_cache? \ - (FILE*)(bfd_last_cache->iostream): \ - bfd_cache_lookup_worker(x)) -boolean -bfd_cache_init PARAMS ((bfd *abfd)); - -boolean -bfd_cache_close PARAMS ((bfd *abfd)); - -FILE* -bfd_open_file PARAMS ((bfd *abfd)); - -FILE * -bfd_cache_lookup_worker PARAMS ((bfd *abfd)); - -#ifdef _BFD_MAKE_TABLE_bfd_reloc_code_real - -static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", - - "BFD_RELOC_64", - "BFD_RELOC_32", - "BFD_RELOC_26", - "BFD_RELOC_16", - "BFD_RELOC_14", - "BFD_RELOC_8", - "BFD_RELOC_64_PCREL", - "BFD_RELOC_32_PCREL", - "BFD_RELOC_24_PCREL", - "BFD_RELOC_16_PCREL", - "BFD_RELOC_12_PCREL", - "BFD_RELOC_8_PCREL", - "BFD_RELOC_32_GOT_PCREL", - "BFD_RELOC_16_GOT_PCREL", - "BFD_RELOC_8_GOT_PCREL", - "BFD_RELOC_32_GOTOFF", - "BFD_RELOC_16_GOTOFF", - "BFD_RELOC_LO16_GOTOFF", - "BFD_RELOC_HI16_GOTOFF", - "BFD_RELOC_HI16_S_GOTOFF", - "BFD_RELOC_8_GOTOFF", - "BFD_RELOC_32_PLT_PCREL", - "BFD_RELOC_24_PLT_PCREL", - "BFD_RELOC_16_PLT_PCREL", - "BFD_RELOC_8_PLT_PCREL", - "BFD_RELOC_32_PLTOFF", - "BFD_RELOC_16_PLTOFF", - "BFD_RELOC_LO16_PLTOFF", - "BFD_RELOC_HI16_PLTOFF", - "BFD_RELOC_HI16_S_PLTOFF", - "BFD_RELOC_8_PLTOFF", - "BFD_RELOC_68K_GLOB_DAT", - "BFD_RELOC_68K_JMP_SLOT", - "BFD_RELOC_68K_RELATIVE", - "BFD_RELOC_32_BASEREL", - "BFD_RELOC_16_BASEREL", - "BFD_RELOC_LO16_BASEREL", - "BFD_RELOC_HI16_BASEREL", - "BFD_RELOC_HI16_S_BASEREL", - "BFD_RELOC_8_BASEREL", - "BFD_RELOC_RVA", - "BFD_RELOC_8_FFnn", - "BFD_RELOC_32_PCREL_S2", - "BFD_RELOC_16_PCREL_S2", - "BFD_RELOC_23_PCREL_S2", - "BFD_RELOC_HI22", - "BFD_RELOC_LO10", - "BFD_RELOC_GPREL16", - "BFD_RELOC_GPREL32", - "BFD_RELOC_I960_CALLJ", - "BFD_RELOC_NONE", - "BFD_RELOC_SPARC_WDISP22", - "BFD_RELOC_SPARC22", - "BFD_RELOC_SPARC13", - "BFD_RELOC_SPARC_GOT10", - "BFD_RELOC_SPARC_GOT13", - "BFD_RELOC_SPARC_GOT22", - "BFD_RELOC_SPARC_PC10", - "BFD_RELOC_SPARC_PC22", - "BFD_RELOC_SPARC_WPLT30", - "BFD_RELOC_SPARC_COPY", - "BFD_RELOC_SPARC_GLOB_DAT", - "BFD_RELOC_SPARC_JMP_SLOT", - "BFD_RELOC_SPARC_RELATIVE", - "BFD_RELOC_SPARC_UA32", - "BFD_RELOC_SPARC_BASE13", - "BFD_RELOC_SPARC_BASE22", - "BFD_RELOC_SPARC_10", - "BFD_RELOC_SPARC_11", - "BFD_RELOC_SPARC_OLO10", - "BFD_RELOC_SPARC_HH22", - "BFD_RELOC_SPARC_HM10", - "BFD_RELOC_SPARC_LM22", - "BFD_RELOC_SPARC_PC_HH22", - "BFD_RELOC_SPARC_PC_HM10", - "BFD_RELOC_SPARC_PC_LM22", - "BFD_RELOC_SPARC_WDISP16", - "BFD_RELOC_SPARC_WDISP19", - "BFD_RELOC_SPARC_GLOB_JMP", - "BFD_RELOC_SPARC_7", - "BFD_RELOC_SPARC_6", - "BFD_RELOC_SPARC_5", - "BFD_RELOC_ALPHA_GPDISP_HI16", - "BFD_RELOC_ALPHA_GPDISP_LO16", - "BFD_RELOC_ALPHA_LITERAL", - "BFD_RELOC_ALPHA_LITUSE", - "BFD_RELOC_ALPHA_HINT", - "BFD_RELOC_MIPS_JMP", - "BFD_RELOC_HI16", - "BFD_RELOC_HI16_S", - "BFD_RELOC_LO16", - "BFD_RELOC_PCREL_HI16_S", - "BFD_RELOC_PCREL_LO16", - "BFD_RELOC_MIPS_LITERAL", - "BFD_RELOC_MIPS_GOT16", - "BFD_RELOC_MIPS_CALL16", - "BFD_RELOC_MIPS_GOT_HI16", - "BFD_RELOC_MIPS_GOT_LO16", - "BFD_RELOC_MIPS_CALL_HI16", - "BFD_RELOC_MIPS_CALL_LO16", - "BFD_RELOC_386_GOT32", - "BFD_RELOC_386_PLT32", - "BFD_RELOC_386_COPY", - "BFD_RELOC_386_GLOB_DAT", - "BFD_RELOC_386_JUMP_SLOT", - "BFD_RELOC_386_RELATIVE", - "BFD_RELOC_386_GOTOFF", - "BFD_RELOC_386_GOTPC", - "BFD_RELOC_NS32K_IMM_8", - "BFD_RELOC_NS32K_IMM_16", - "BFD_RELOC_NS32K_IMM_32", - "BFD_RELOC_NS32K_IMM_8_PCREL", - "BFD_RELOC_NS32K_IMM_16_PCREL", - "BFD_RELOC_NS32K_IMM_32_PCREL", - "BFD_RELOC_NS32K_DISP_8", - "BFD_RELOC_NS32K_DISP_16", - "BFD_RELOC_NS32K_DISP_32", - "BFD_RELOC_NS32K_DISP_8_PCREL", - "BFD_RELOC_NS32K_DISP_16_PCREL", - "BFD_RELOC_NS32K_DISP_32_PCREL", - "BFD_RELOC_PPC_B26", - "BFD_RELOC_PPC_BA26", - "BFD_RELOC_PPC_TOC16", - "BFD_RELOC_PPC_B16", - "BFD_RELOC_PPC_B16_BRTAKEN", - "BFD_RELOC_PPC_B16_BRNTAKEN", - "BFD_RELOC_PPC_BA16", - "BFD_RELOC_PPC_BA16_BRTAKEN", - "BFD_RELOC_PPC_BA16_BRNTAKEN", - "BFD_RELOC_PPC_COPY", - "BFD_RELOC_PPC_GLOB_DAT", - "BFD_RELOC_PPC_JMP_SLOT", - "BFD_RELOC_PPC_RELATIVE", - "BFD_RELOC_PPC_LOCAL24PC", - "BFD_RELOC_PPC_EMB_NADDR32", - "BFD_RELOC_PPC_EMB_NADDR16", - "BFD_RELOC_PPC_EMB_NADDR16_LO", - "BFD_RELOC_PPC_EMB_NADDR16_HI", - "BFD_RELOC_PPC_EMB_NADDR16_HA", - "BFD_RELOC_PPC_EMB_SDAI16", - "BFD_RELOC_PPC_EMB_SDA2I16", - "BFD_RELOC_PPC_EMB_SDA2REL", - "BFD_RELOC_PPC_EMB_SDA21", - "BFD_RELOC_PPC_EMB_MRKREF", - "BFD_RELOC_PPC_EMB_RELSEC16", - "BFD_RELOC_PPC_EMB_RELST_LO", - "BFD_RELOC_PPC_EMB_RELST_HI", - "BFD_RELOC_PPC_EMB_RELST_HA", - "BFD_RELOC_PPC_EMB_BIT_FLD", - "BFD_RELOC_PPC_EMB_RELSDA", - "BFD_RELOC_CTOR", - "BFD_RELOC_ARM_PCREL_BRANCH", - "BFD_RELOC_ARM_IMMEDIATE", - "BFD_RELOC_ARM_OFFSET_IMM", - "BFD_RELOC_ARM_SHIFT_IMM", - "BFD_RELOC_ARM_SWI", - "BFD_RELOC_ARM_MULTI", - "BFD_RELOC_ARM_CP_OFF_IMM", - "BFD_RELOC_ARM_ADR_IMM", - "BFD_RELOC_ARM_LDR_IMM", - "BFD_RELOC_ARM_LITERAL", - "BFD_RELOC_ARM_IN_POOL", - "@@overflow: BFD_RELOC_UNUSED@@", -}; -#endif - -reloc_howto_type * -bfd_default_reloc_type_lookup - PARAMS ((bfd *abfd, bfd_reloc_code_real_type code)); - -boolean -bfd_generic_relax_section - PARAMS ((bfd *abfd, - asection *section, - struct bfd_link_info *, - boolean *)); - -bfd_byte * - -bfd_generic_get_relocated_section_contents PARAMS ((bfd *abfd, - struct bfd_link_info *link_info, - struct bfd_link_order *link_order, - bfd_byte *data, - boolean relocateable, - asymbol **symbols)); - -extern const bfd_arch_info_type bfd_default_arch_struct; -boolean -bfd_default_set_arch_mach PARAMS ((bfd *abfd, - enum bfd_architecture arch, - unsigned long mach)); - -const bfd_arch_info_type * -bfd_default_compatible - PARAMS ((const bfd_arch_info_type *a, - const bfd_arch_info_type *b)); - -boolean -bfd_default_scan PARAMS ((const struct bfd_arch_info *info, const char *string)); - -struct elf_internal_shdr * -bfd_elf_find_section PARAMS ((bfd *abfd, char *name)); - diff --git a/contrib/gdb/bfd/libcoff.h b/contrib/gdb/bfd/libcoff.h deleted file mode 100644 index daa39b5..0000000 --- a/contrib/gdb/bfd/libcoff.h +++ /dev/null @@ -1,823 +0,0 @@ -/* BFD COFF object file private structure. - Copyright (C) 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. - Written by Cygnus Support. - -** NOTE: libcoff.h is a GENERATED file. Don't change it; instead, -** change libcoff-in.h or coffcode.h. - -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 "bfdlink.h" - -/* Object file tdata; access macros */ - -#define coff_data(bfd) ((bfd)->tdata.coff_obj_data) -#define exec_hdr(bfd) (coff_data(bfd)->hdr) -#define obj_pe(bfd) (coff_data(bfd)->pe) -#define obj_symbols(bfd) (coff_data(bfd)->symbols) -#define obj_sym_filepos(bfd) (coff_data(bfd)->sym_filepos) - -#define obj_relocbase(bfd) (coff_data(bfd)->relocbase) -#define obj_raw_syments(bfd) (coff_data(bfd)->raw_syments) -#define obj_raw_syment_count(bfd) (coff_data(bfd)->raw_syment_count) -#define obj_convert(bfd) (coff_data(bfd)->conversion_table) -#define obj_conv_table_size(bfd) (coff_data(bfd)->conv_table_size) - -#define obj_coff_external_syms(bfd) (coff_data (bfd)->external_syms) -#define obj_coff_keep_syms(bfd) (coff_data (bfd)->keep_syms) -#define obj_coff_strings(bfd) (coff_data (bfd)->strings) -#define obj_coff_keep_strings(bfd) (coff_data (bfd)->keep_strings) -#define obj_coff_sym_hashes(bfd) (coff_data (bfd)->sym_hashes) - -#define obj_coff_local_toc_table(bfd) (coff_data(bfd)->local_toc_sym_map) - -/* `Tdata' information kept for COFF files. */ - -typedef struct coff_tdata -{ - struct coff_symbol_struct *symbols; /* symtab for input bfd */ - unsigned int *conversion_table; - int conv_table_size; - file_ptr sym_filepos; - - struct coff_ptr_struct *raw_syments; - unsigned int raw_syment_count; - - /* These are only valid once writing has begun */ - long int relocbase; - - /* These members communicate important constants about the symbol table - to GDB's symbol-reading code. These `constants' unfortunately vary - from coff implementation to implementation... */ - unsigned local_n_btmask; - unsigned local_n_btshft; - unsigned local_n_tmask; - unsigned local_n_tshift; - unsigned local_symesz; - unsigned local_auxesz; - unsigned local_linesz; - - /* The unswapped external symbols. May be NULL. Read by - _bfd_coff_get_external_symbols. */ - PTR external_syms; - /* If this is true, the external_syms may not be freed. */ - boolean keep_syms; - - /* The string table. May be NULL. Read by - _bfd_coff_read_string_table. */ - char *strings; - /* If this is true, the strings may not be freed. */ - boolean keep_strings; - - /* is this a PE format coff file */ - int pe; - /* Used by the COFF backend linker. */ - struct coff_link_hash_entry **sym_hashes; - - /* used by the pe linker for PowerPC */ - int *local_toc_sym_map; - - struct bfd_link_info *link_info; - - /* Used by coff_find_nearest_line. */ - PTR line_info; -} coff_data_type; - -/* Tdata for pe image files. */ -typedef struct pe_tdata -{ - coff_data_type coff; - struct internal_extra_pe_aouthdr pe_opthdr; - int dll; - int has_reloc_section; - boolean (*in_reloc_p) PARAMS((bfd *, reloc_howto_type *)); - flagword real_flags; -} pe_data_type; - -#define pe_data(bfd) ((bfd)->tdata.pe_obj_data) - -/* Tdata for XCOFF files. */ - -struct xcoff_tdata -{ - /* Basic COFF information. */ - coff_data_type coff; - - /* True if a large a.out header should be generated. */ - boolean full_aouthdr; - - /* TOC value. */ - bfd_vma toc; - - /* Index of section holding TOC. */ - int sntoc; - - /* Index of section holding entry point. */ - int snentry; - - /* .text alignment from optional header. */ - int text_align_power; - - /* .data alignment from optional header. */ - int data_align_power; - - /* modtype from optional header. */ - short modtype; - - /* cputype from optional header. */ - short cputype; - - /* maxdata from optional header. */ - bfd_size_type maxdata; - - /* maxstack from optional header. */ - bfd_size_type maxstack; - - /* Used by the XCOFF backend linker. */ - asection **csects; - unsigned long *debug_indices; - unsigned int import_file_id; -}; - -#define xcoff_data(abfd) ((abfd)->tdata.xcoff_obj_data) - -/* We take the address of the first element of a asymbol to ensure that the - * macro is only ever applied to an asymbol. */ -#define coffsymbol(asymbol) ((coff_symbol_type *)(&((asymbol)->the_bfd))) - -/* The used_by_bfd field of a section may be set to a pointer to this - structure. */ - -struct coff_section_tdata -{ - /* The relocs, swapped into COFF internal form. This may be NULL. */ - struct internal_reloc *relocs; - /* If this is true, the relocs entry may not be freed. */ - boolean keep_relocs; - /* The section contents. This may be NULL. */ - bfd_byte *contents; - /* If this is true, the contents entry may not be freed. */ - boolean keep_contents; - /* Information cached by coff_find_nearest_line. */ - bfd_vma offset; - unsigned int i; - const char *function; - int line_base; - /* Available for individual backends. */ - PTR tdata; -}; - -/* An accessor macro for the coff_section_tdata structure. */ -#define coff_section_data(abfd, sec) \ - ((struct coff_section_tdata *) (sec)->used_by_bfd) - -/* Tdata for sections in XCOFF files. This is used by the linker. */ - -struct xcoff_section_tdata -{ - /* Used for XCOFF csects created by the linker; points to the real - XCOFF section which contains this csect. */ - asection *enclosing; - /* The lineno_count field for the enclosing section, because we are - going to clobber it there. */ - unsigned int lineno_count; - /* The first and one past the last symbol indices for symbols used - by this csect. */ - unsigned long first_symndx; - unsigned long last_symndx; -}; - -/* An accessor macro the xcoff_section_tdata structure. */ -#define xcoff_section_data(abfd, sec) \ - ((struct xcoff_section_tdata *) coff_section_data ((abfd), (sec))->tdata) - -/* COFF linker hash table entries. */ - -struct coff_link_hash_entry -{ - struct bfd_link_hash_entry root; - - /* Symbol index in output file. Set to -1 initially. Set to -2 if - there is a reloc against this symbol. */ - long indx; - - /* Symbol type. */ - unsigned short type; - - /* Symbol class. */ - unsigned char class; - - /* Number of auxiliary entries. */ - char numaux; - - /* BFD to take auxiliary entries from. */ - bfd *auxbfd; - - /* Pointer to array of auxiliary entries, if any. */ - union internal_auxent *aux; -}; - -/* COFF linker hash table. */ - -struct coff_link_hash_table -{ - struct bfd_link_hash_table root; -}; - -/* Look up an entry in a COFF linker hash table. */ - -#define coff_link_hash_lookup(table, string, create, copy, follow) \ - ((struct coff_link_hash_entry *) \ - bfd_link_hash_lookup (&(table)->root, (string), (create), \ - (copy), (follow))) - -/* Traverse a COFF linker hash table. */ - -#define coff_link_hash_traverse(table, func, info) \ - (bfd_link_hash_traverse \ - (&(table)->root, \ - (boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func), \ - (info))) - -/* Get the COFF linker hash table from a link_info structure. */ - -#define coff_hash_table(p) ((struct coff_link_hash_table *) ((p)->hash)) - -/* Functions in coffgen.c. */ -extern const bfd_target *coff_object_p PARAMS ((bfd *)); -extern struct sec *coff_section_from_bfd_index PARAMS ((bfd *, int)); -extern long coff_get_symtab_upper_bound PARAMS ((bfd *)); -extern long coff_get_symtab PARAMS ((bfd *, asymbol **)); -extern int coff_count_linenumbers PARAMS ((bfd *)); -extern struct coff_symbol_struct *coff_symbol_from PARAMS ((bfd *, asymbol *)); -extern boolean coff_renumber_symbols PARAMS ((bfd *, int *)); -extern void coff_mangle_symbols PARAMS ((bfd *)); -extern boolean coff_write_symbols PARAMS ((bfd *)); -extern boolean coff_write_linenumbers PARAMS ((bfd *)); -extern alent *coff_get_lineno PARAMS ((bfd *, asymbol *)); -extern asymbol *coff_section_symbol PARAMS ((bfd *, char *)); -extern boolean _bfd_coff_get_external_symbols PARAMS ((bfd *)); -extern const char *_bfd_coff_read_string_table PARAMS ((bfd *)); -extern boolean _bfd_coff_free_symbols PARAMS ((bfd *)); -extern struct coff_ptr_struct *coff_get_normalized_symtab PARAMS ((bfd *)); -extern long coff_get_reloc_upper_bound PARAMS ((bfd *, sec_ptr)); -extern asymbol *coff_make_empty_symbol PARAMS ((bfd *)); -extern void coff_print_symbol PARAMS ((bfd *, PTR filep, asymbol *, - bfd_print_symbol_type how)); -extern void coff_get_symbol_info PARAMS ((bfd *, asymbol *, - symbol_info *ret)); -extern asymbol *coff_bfd_make_debug_symbol PARAMS ((bfd *, PTR, - unsigned long)); -extern boolean coff_find_nearest_line PARAMS ((bfd *, - asection *, - asymbol **, - bfd_vma offset, - CONST char **filename_ptr, - CONST char **functionname_ptr, - unsigned int *line_ptr)); -extern int coff_sizeof_headers PARAMS ((bfd *, boolean reloc)); -extern boolean bfd_coff_reloc16_relax_section - PARAMS ((bfd *, asection *, struct bfd_link_info *, boolean *)); -extern bfd_byte *bfd_coff_reloc16_get_relocated_section_contents - PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, - bfd_byte *, boolean relocateable, asymbol **)); -extern bfd_vma bfd_coff_reloc16_get_value PARAMS ((arelent *, - struct bfd_link_info *, - asection *)); -extern void bfd_perform_slip PARAMS ((bfd *abfd, unsigned int slip, - asection *input_section, - bfd_vma val)); - -/* Functions and types in cofflink.c. */ - -#define STRING_SIZE_SIZE (4) - -/* We use a hash table to merge identical enum, struct, and union - definitions in the linker. */ - -/* Information we keep for a single element (an enum value, a - structure or union field) in the debug merge hash table. */ - -struct coff_debug_merge_element -{ - /* Next element. */ - struct coff_debug_merge_element *next; - - /* Name. */ - const char *name; - - /* Type. */ - unsigned int type; - - /* Symbol index for complex type. */ - long tagndx; -}; - -/* A linked list of debug merge entries for a given name. */ - -struct coff_debug_merge_type -{ - /* Next type with the same name. */ - struct coff_debug_merge_type *next; - - /* Class of type. */ - int class; - - /* Symbol index where this type is defined. */ - long indx; - - /* List of elements. */ - struct coff_debug_merge_element *elements; -}; - -/* Information we store in the debug merge hash table. */ - -struct coff_debug_merge_hash_entry -{ - struct bfd_hash_entry root; - - /* A list of types with this name. */ - struct coff_debug_merge_type *types; -}; - -/* The debug merge hash table. */ - -struct coff_debug_merge_hash_table -{ - struct bfd_hash_table root; -}; - -/* Initialize a COFF debug merge hash table. */ - -#define coff_debug_merge_hash_table_init(table) \ - (bfd_hash_table_init (&(table)->root, _bfd_coff_debug_merge_hash_newfunc)) - -/* Free a COFF debug merge hash table. */ - -#define coff_debug_merge_hash_table_free(table) \ - (bfd_hash_table_free (&(table)->root)) - -/* Look up an entry in a COFF debug merge hash table. */ - -#define coff_debug_merge_hash_lookup(table, string, create, copy) \ - ((struct coff_debug_merge_hash_entry *) \ - bfd_hash_lookup (&(table)->root, (string), (create), (copy))) - -/* Information we keep for each section in the output file when doing - a relocateable link. */ - -struct coff_link_section_info -{ - /* The relocs to be output. */ - struct internal_reloc *relocs; - /* For each reloc against a global symbol whose index was not known - when the reloc was handled, the global hash table entry. */ - struct coff_link_hash_entry **rel_hashes; -}; - -/* Information that we pass around while doing the final link step. */ - -struct coff_final_link_info -{ - /* General link information. */ - struct bfd_link_info *info; - /* Output BFD. */ - bfd *output_bfd; - /* Used to indicate failure in traversal routine. */ - boolean failed; - /* Hash table for long symbol names. */ - struct bfd_strtab_hash *strtab; - /* When doing a relocateable link, an array of information kept for - each output section, indexed by the target_index field. */ - struct coff_link_section_info *section_info; - /* Symbol index of last C_FILE symbol (-1 if none). */ - long last_file_index; - /* Contents of last C_FILE symbol. */ - struct internal_syment last_file; - /* Hash table used to merge debug information. */ - struct coff_debug_merge_hash_table debug_merge; - /* Buffer large enough to hold swapped symbols of any input file. */ - struct internal_syment *internal_syms; - /* Buffer large enough to hold sections of symbols of any input file. */ - asection **sec_ptrs; - /* Buffer large enough to hold output indices of symbols of any - input file. */ - long *sym_indices; - /* Buffer large enough to hold output symbols for any input file. */ - bfd_byte *outsyms; - /* Buffer large enough to hold external line numbers for any input - section. */ - bfd_byte *linenos; - /* Buffer large enough to hold any input section. */ - bfd_byte *contents; - /* Buffer large enough to hold external relocs of any input section. */ - bfd_byte *external_relocs; - /* Buffer large enough to hold swapped relocs of any input section. */ - struct internal_reloc *internal_relocs; -}; - -extern struct bfd_hash_entry *_bfd_coff_link_hash_newfunc - PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); -extern boolean _bfd_coff_link_hash_table_init - PARAMS ((struct coff_link_hash_table *, bfd *, - struct bfd_hash_entry *(*) (struct bfd_hash_entry *, - struct bfd_hash_table *, - const char *))); -extern struct bfd_link_hash_table *_bfd_coff_link_hash_table_create - PARAMS ((bfd *)); -extern const char *_bfd_coff_internal_syment_name - PARAMS ((bfd *, const struct internal_syment *, char *)); -extern boolean _bfd_coff_link_add_symbols - PARAMS ((bfd *, struct bfd_link_info *)); -extern boolean _bfd_coff_final_link - PARAMS ((bfd *, struct bfd_link_info *)); -extern struct internal_reloc *_bfd_coff_read_internal_relocs - PARAMS ((bfd *, asection *, boolean, bfd_byte *, boolean, - struct internal_reloc *)); -extern boolean _bfd_coff_generic_relocate_section - PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, - struct internal_reloc *, struct internal_syment *, asection **)); - -extern struct bfd_hash_entry *_bfd_coff_debug_merge_hash_newfunc - PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); -extern boolean _bfd_coff_write_global_sym - PARAMS ((struct coff_link_hash_entry *, PTR)); -extern boolean _bfd_coff_link_input_bfd - PARAMS ((struct coff_final_link_info *, bfd *)); -extern boolean _bfd_coff_reloc_link_order - PARAMS ((bfd *, struct coff_final_link_info *, asection *, - struct bfd_link_order *)); - - -#define coff_get_section_contents_in_window \ - _bfd_generic_get_section_contents_in_window - -/* Functions in xcofflink.c. */ - -extern struct bfd_link_hash_table *_bfd_xcoff_bfd_link_hash_table_create - PARAMS ((bfd *)); -extern boolean _bfd_xcoff_bfd_link_add_symbols - PARAMS ((bfd *, struct bfd_link_info *)); -extern boolean _bfd_xcoff_bfd_final_link - PARAMS ((bfd *, struct bfd_link_info *)); -extern boolean _bfd_ppc_xcoff_relocate_section - PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, - struct internal_reloc *, struct internal_syment *, asection **)); - -/* And more taken from the source .. */ - -typedef struct coff_ptr_struct -{ - - /* Remembers the offset from the first symbol in the file for - this symbol. Generated by coff_renumber_symbols. */ -unsigned int offset; - - /* Should the value of this symbol be renumbered. Used for - XCOFF C_BSTAT symbols. Set by coff_slurp_symbol_table. */ -unsigned int fix_value : 1; - - /* Should the tag field of this symbol be renumbered. - Created by coff_pointerize_aux. */ -unsigned int fix_tag : 1; - - /* Should the endidx field of this symbol be renumbered. - Created by coff_pointerize_aux. */ -unsigned int fix_end : 1; - - /* Should the x_csect.x_scnlen field be renumbered. - Created by coff_pointerize_aux. */ -unsigned int fix_scnlen : 1; - - /* Fix up an XCOFF C_BINCL/C_EINCL symbol. The value is the - index into the line number entries. Set by - coff_slurp_symbol_table. */ -unsigned int fix_line : 1; - - /* The container for the symbol structure as read and translated - from the file. */ - -union { - union internal_auxent auxent; - struct internal_syment syment; - } u; -} combined_entry_type; - - - /* Each canonical asymbol really looks like this: */ - -typedef struct coff_symbol_struct -{ - /* The actual symbol which the rest of BFD works with */ -asymbol symbol; - - /* A pointer to the hidden information for this symbol */ -combined_entry_type *native; - - /* A pointer to the linenumber information for this symbol */ -struct lineno_cache_entry *lineno; - - /* Have the line numbers been relocated yet ? */ -boolean done_lineno; -} coff_symbol_type; -typedef struct -{ - void (*_bfd_coff_swap_aux_in) PARAMS (( - bfd *abfd, - PTR ext, - int type, - int class, - int indaux, - int numaux, - PTR in)); - - void (*_bfd_coff_swap_sym_in) PARAMS (( - bfd *abfd , - PTR ext, - PTR in)); - - void (*_bfd_coff_swap_lineno_in) PARAMS (( - bfd *abfd, - PTR ext, - PTR in)); - - unsigned int (*_bfd_coff_swap_aux_out) PARAMS (( - bfd *abfd, - PTR in, - int type, - int class, - int indaux, - int numaux, - PTR ext)); - - unsigned int (*_bfd_coff_swap_sym_out) PARAMS (( - bfd *abfd, - PTR in, - PTR ext)); - - unsigned int (*_bfd_coff_swap_lineno_out) PARAMS (( - bfd *abfd, - PTR in, - PTR ext)); - - unsigned int (*_bfd_coff_swap_reloc_out) PARAMS (( - bfd *abfd, - PTR src, - PTR dst)); - - unsigned int (*_bfd_coff_swap_filehdr_out) PARAMS (( - bfd *abfd, - PTR in, - PTR out)); - - unsigned int (*_bfd_coff_swap_aouthdr_out) PARAMS (( - bfd *abfd, - PTR in, - PTR out)); - - unsigned int (*_bfd_coff_swap_scnhdr_out) PARAMS (( - bfd *abfd, - PTR in, - PTR out)); - - unsigned int _bfd_filhsz; - unsigned int _bfd_aoutsz; - unsigned int _bfd_scnhsz; - unsigned int _bfd_symesz; - unsigned int _bfd_auxesz; - unsigned int _bfd_relsz; - unsigned int _bfd_linesz; - boolean _bfd_coff_long_filenames; - void (*_bfd_coff_swap_filehdr_in) PARAMS (( - bfd *abfd, - PTR ext, - PTR in)); - void (*_bfd_coff_swap_aouthdr_in) PARAMS (( - bfd *abfd, - PTR ext, - PTR in)); - void (*_bfd_coff_swap_scnhdr_in) PARAMS (( - bfd *abfd, - PTR ext, - PTR in)); - void (*_bfd_coff_swap_reloc_in) PARAMS (( - bfd *abfd, - PTR ext, - PTR in)); - boolean (*_bfd_coff_bad_format_hook) PARAMS (( - bfd *abfd, - PTR internal_filehdr)); - boolean (*_bfd_coff_set_arch_mach_hook) PARAMS (( - bfd *abfd, - PTR internal_filehdr)); - PTR (*_bfd_coff_mkobject_hook) PARAMS (( - bfd *abfd, - PTR internal_filehdr, - PTR internal_aouthdr)); - flagword (*_bfd_styp_to_sec_flags_hook) PARAMS (( - bfd *abfd, - PTR internal_scnhdr, - const char *name)); - void (*_bfd_set_alignment_hook) PARAMS (( - bfd *abfd, - asection *sec, - PTR internal_scnhdr)); - boolean (*_bfd_coff_slurp_symbol_table) PARAMS (( - bfd *abfd)); - boolean (*_bfd_coff_symname_in_debug) PARAMS (( - bfd *abfd, - struct internal_syment *sym)); - boolean (*_bfd_coff_pointerize_aux_hook) PARAMS (( - bfd *abfd, - combined_entry_type *table_base, - combined_entry_type *symbol, - unsigned int indaux, - combined_entry_type *aux)); - boolean (*_bfd_coff_print_aux) PARAMS (( - bfd *abfd, - FILE *file, - combined_entry_type *table_base, - combined_entry_type *symbol, - combined_entry_type *aux, - unsigned int indaux)); - void (*_bfd_coff_reloc16_extra_cases) PARAMS (( - bfd *abfd, - struct bfd_link_info *link_info, - struct bfd_link_order *link_order, - arelent *reloc, - bfd_byte *data, - unsigned int *src_ptr, - unsigned int *dst_ptr)); - int (*_bfd_coff_reloc16_estimate) PARAMS (( - bfd *abfd, - asection *input_section, - arelent *r, - unsigned int shrink, - struct bfd_link_info *link_info)); - boolean (*_bfd_coff_sym_is_global) PARAMS (( - bfd *abfd, - struct internal_syment *)); - void (*_bfd_coff_compute_section_file_positions) PARAMS (( - bfd *abfd)); - boolean (*_bfd_coff_start_final_link) PARAMS (( - bfd *output_bfd, - struct bfd_link_info *info)); - boolean (*_bfd_coff_relocate_section) PARAMS (( - bfd *output_bfd, - struct bfd_link_info *info, - bfd *input_bfd, - asection *input_section, - bfd_byte *contents, - struct internal_reloc *relocs, - struct internal_syment *syms, - asection **sections)); - reloc_howto_type *(*_bfd_coff_rtype_to_howto) PARAMS (( - bfd *abfd, - asection *sec, - struct internal_reloc *rel, - struct coff_link_hash_entry *h, - struct internal_syment *sym, - bfd_vma *addendp)); - boolean (*_bfd_coff_adjust_symndx) PARAMS (( - bfd *obfd, - struct bfd_link_info *info, - bfd *ibfd, - asection *sec, - struct internal_reloc *reloc, - boolean *adjustedp)); - boolean (*_bfd_coff_link_add_one_symbol) PARAMS (( - struct bfd_link_info *info, - bfd *abfd, - const char *name, - flagword flags, - asection *section, - bfd_vma value, - const char *string, - boolean copy, - boolean collect, - struct bfd_link_hash_entry **hashp)); - -} bfd_coff_backend_data; - -#define coff_backend_info(abfd) ((bfd_coff_backend_data *) (abfd)->xvec->backend_data) - -#define bfd_coff_swap_aux_in(a,e,t,c,ind,num,i) \ - ((coff_backend_info (a)->_bfd_coff_swap_aux_in) (a,e,t,c,ind,num,i)) - -#define bfd_coff_swap_sym_in(a,e,i) \ - ((coff_backend_info (a)->_bfd_coff_swap_sym_in) (a,e,i)) - -#define bfd_coff_swap_lineno_in(a,e,i) \ - ((coff_backend_info ( a)->_bfd_coff_swap_lineno_in) (a,e,i)) - -#define bfd_coff_swap_reloc_out(abfd, i, o) \ - ((coff_backend_info (abfd)->_bfd_coff_swap_reloc_out) (abfd, i, o)) - -#define bfd_coff_swap_lineno_out(abfd, i, o) \ - ((coff_backend_info (abfd)->_bfd_coff_swap_lineno_out) (abfd, i, o)) - -#define bfd_coff_swap_aux_out(a,i,t,c,ind,num,o) \ - ((coff_backend_info (a)->_bfd_coff_swap_aux_out) (a,i,t,c,ind,num,o)) - -#define bfd_coff_swap_sym_out(abfd, i,o) \ - ((coff_backend_info (abfd)->_bfd_coff_swap_sym_out) (abfd, i, o)) - -#define bfd_coff_swap_scnhdr_out(abfd, i,o) \ - ((coff_backend_info (abfd)->_bfd_coff_swap_scnhdr_out) (abfd, i, o)) - -#define bfd_coff_swap_filehdr_out(abfd, i,o) \ - ((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_out) (abfd, i, o)) - -#define bfd_coff_swap_aouthdr_out(abfd, i,o) \ - ((coff_backend_info (abfd)->_bfd_coff_swap_aouthdr_out) (abfd, i, o)) - -#define bfd_coff_filhsz(abfd) (coff_backend_info (abfd)->_bfd_filhsz) -#define bfd_coff_aoutsz(abfd) (coff_backend_info (abfd)->_bfd_aoutsz) -#define bfd_coff_scnhsz(abfd) (coff_backend_info (abfd)->_bfd_scnhsz) -#define bfd_coff_symesz(abfd) (coff_backend_info (abfd)->_bfd_symesz) -#define bfd_coff_auxesz(abfd) (coff_backend_info (abfd)->_bfd_auxesz) -#define bfd_coff_relsz(abfd) (coff_backend_info (abfd)->_bfd_relsz) -#define bfd_coff_linesz(abfd) (coff_backend_info (abfd)->_bfd_linesz) -#define bfd_coff_long_filenames(abfd) (coff_backend_info (abfd)->_bfd_coff_long_filenames) -#define bfd_coff_swap_filehdr_in(abfd, i,o) \ - ((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_in) (abfd, i, o)) - -#define bfd_coff_swap_aouthdr_in(abfd, i,o) \ - ((coff_backend_info (abfd)->_bfd_coff_swap_aouthdr_in) (abfd, i, o)) - -#define bfd_coff_swap_scnhdr_in(abfd, i,o) \ - ((coff_backend_info (abfd)->_bfd_coff_swap_scnhdr_in) (abfd, i, o)) - -#define bfd_coff_swap_reloc_in(abfd, i, o) \ - ((coff_backend_info (abfd)->_bfd_coff_swap_reloc_in) (abfd, i, o)) - -#define bfd_coff_bad_format_hook(abfd, filehdr) \ - ((coff_backend_info (abfd)->_bfd_coff_bad_format_hook) (abfd, filehdr)) - -#define bfd_coff_set_arch_mach_hook(abfd, filehdr)\ - ((coff_backend_info (abfd)->_bfd_coff_set_arch_mach_hook) (abfd, filehdr)) -#define bfd_coff_mkobject_hook(abfd, filehdr, aouthdr)\ - ((coff_backend_info (abfd)->_bfd_coff_mkobject_hook) (abfd, filehdr, aouthdr)) - -#define bfd_coff_styp_to_sec_flags_hook(abfd, scnhdr, name)\ - ((coff_backend_info (abfd)->_bfd_styp_to_sec_flags_hook) (abfd, scnhdr, name)) - -#define bfd_coff_set_alignment_hook(abfd, sec, scnhdr)\ - ((coff_backend_info (abfd)->_bfd_set_alignment_hook) (abfd, sec, scnhdr)) - -#define bfd_coff_slurp_symbol_table(abfd)\ - ((coff_backend_info (abfd)->_bfd_coff_slurp_symbol_table) (abfd)) - -#define bfd_coff_symname_in_debug(abfd, sym)\ - ((coff_backend_info (abfd)->_bfd_coff_symname_in_debug) (abfd, sym)) - -#define bfd_coff_print_aux(abfd, file, base, symbol, aux, indaux)\ - ((coff_backend_info (abfd)->_bfd_coff_print_aux)\ - (abfd, file, base, symbol, aux, indaux)) - -#define bfd_coff_reloc16_extra_cases(abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr)\ - ((coff_backend_info (abfd)->_bfd_coff_reloc16_extra_cases)\ - (abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr)) - -#define bfd_coff_reloc16_estimate(abfd, section, reloc, shrink, link_info)\ - ((coff_backend_info (abfd)->_bfd_coff_reloc16_estimate)\ - (abfd, section, reloc, shrink, link_info)) - -#define bfd_coff_sym_is_global(abfd, sym)\ - ((coff_backend_info (abfd)->_bfd_coff_sym_is_global)\ - (abfd, sym)) - -#define bfd_coff_compute_section_file_positions(abfd)\ - ((coff_backend_info (abfd)->_bfd_coff_compute_section_file_positions)\ - (abfd)) - -#define bfd_coff_start_final_link(obfd, info)\ - ((coff_backend_info (obfd)->_bfd_coff_start_final_link)\ - (obfd, info)) -#define bfd_coff_relocate_section(obfd,info,ibfd,o,con,rel,isyms,secs)\ - ((coff_backend_info (ibfd)->_bfd_coff_relocate_section)\ - (obfd, info, ibfd, o, con, rel, isyms, secs)) -#define bfd_coff_rtype_to_howto(abfd, sec, rel, h, sym, addendp)\ - ((coff_backend_info (abfd)->_bfd_coff_rtype_to_howto)\ - (abfd, sec, rel, h, sym, addendp)) -#define bfd_coff_adjust_symndx(obfd, info, ibfd, sec, rel, adjustedp)\ - ((coff_backend_info (abfd)->_bfd_coff_adjust_symndx)\ - (obfd, info, ibfd, sec, rel, adjustedp)) -#define bfd_coff_link_add_one_symbol(info,abfd,name,flags,section,value,string,cp,coll,hashp)\ - ((coff_backend_info (abfd)->_bfd_coff_link_add_one_symbol)\ - (info, abfd, name, flags, section, value, string, cp, coll, hashp)) - diff --git a/contrib/gdb/bfd/libecoff.h b/contrib/gdb/bfd/libecoff.h deleted file mode 100644 index 169610d..0000000 --- a/contrib/gdb/bfd/libecoff.h +++ /dev/null @@ -1,352 +0,0 @@ -/* BFD ECOFF object file private structure. - Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc. - Written by Ian Lance Taylor, Cygnus Support. - -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 "bfdlink.h" - -#ifndef ECOFF_H -#include "coff/ecoff.h" -#endif - -/* This is the backend information kept for ECOFF files. This - structure is constant for a particular backend. The first element - is the COFF backend data structure, so that ECOFF targets can use - the generic COFF code. */ - -#define ecoff_backend(abfd) \ - ((struct ecoff_backend_data *) (abfd)->xvec->backend_data) - -struct ecoff_backend_data -{ - /* COFF backend information. This must be the first field. */ - bfd_coff_backend_data coff; - /* Supported architecture. */ - enum bfd_architecture arch; - /* Initial portion of armap string. */ - const char *armap_start; - /* The page boundary used to align sections in a demand-paged - executable file. E.g., 0x1000. */ - bfd_vma round; - /* True if the .rdata section is part of the text segment, as on the - Alpha. False if .rdata is part of the data segment, as on the - MIPS. */ - boolean rdata_in_text; - /* Bitsize of constructor entries. */ - unsigned int constructor_bitsize; - /* Reloc to use for constructor entries. */ - reloc_howto_type *constructor_reloc; - /* How to swap debugging information. */ - struct ecoff_debug_swap debug_swap; - /* External reloc size. */ - bfd_size_type external_reloc_size; - /* Reloc swapping functions. */ - void (*swap_reloc_in) PARAMS ((bfd *, PTR, struct internal_reloc *)); - void (*swap_reloc_out) PARAMS ((bfd *, const struct internal_reloc *, PTR)); - /* Backend reloc tweaking. */ - void (*adjust_reloc_in) PARAMS ((bfd *, const struct internal_reloc *, - arelent *)); - void (*adjust_reloc_out) PARAMS ((bfd *, const arelent *, - struct internal_reloc *)); - /* Relocate section contents while linking. */ - boolean (*relocate_section) PARAMS ((bfd *output_bfd, struct bfd_link_info *, - bfd *input_bfd, asection *input_section, - bfd_byte *contents, - PTR external_relocs)); - /* Do final adjustments to filehdr and aouthdr. */ - boolean (*adjust_headers) PARAMS ((bfd *, struct internal_filehdr *, - struct internal_aouthdr *)); - /* Read an element from an archive at a given file position. This - is needed because OSF/1 3.2 uses a weird archive format. */ - bfd *(*get_elt_at_filepos) PARAMS ((bfd *, file_ptr)); -}; - -/* This is the target specific information kept for ECOFF files. */ - -#define ecoff_data(abfd) ((abfd)->tdata.ecoff_obj_data) - -typedef struct ecoff_tdata -{ - /* The reloc file position, set by - ecoff_compute_section_file_positions. */ - file_ptr reloc_filepos; - - /* The symbol table file position, set by _bfd_ecoff_mkobject_hook. */ - file_ptr sym_filepos; - - /* The start and end of the text segment. Only valid for an - existing file, not for one we are creating. */ - unsigned long text_start; - unsigned long text_end; - - /* The cached gp value. This is used when relocating. */ - bfd_vma gp; - - /* The maximum size of objects to optimize using gp. This is - typically set by the -G option to the compiler, assembler or - linker. */ - unsigned int gp_size; - - /* The register masks. When linking, all the masks found in the - input files are combined into the masks of the output file. - These are not all used for all targets, but that's OK, because - the relevant ones are the only ones swapped in and out. */ - unsigned long gprmask; - unsigned long fprmask; - unsigned long cprmask[4]; - - /* The ECOFF symbolic debugging information. */ - struct ecoff_debug_info debug_info; - - /* The unswapped ECOFF symbolic information. */ - PTR raw_syments; - - /* The canonical BFD symbols. */ - struct ecoff_symbol_struct *canonical_symbols; - - /* A mapping from external symbol numbers to entries in the linker - hash table, used when linking. */ - struct ecoff_link_hash_entry **sym_hashes; - - /* A mapping from reloc symbol indices to sections, used when - linking. */ - asection **symndx_to_section; - - /* True if this BFD was written by the backend linker. */ - boolean linker; - - /* True if a warning that multiple global pointer values are - needed in the output binary was issued already. */ - boolean issued_multiple_gp_warning; - - /* Used by find_nearest_line entry point. The structure could be - included directly in this one, but there's no point to wasting - the memory just for the infrequently called find_nearest_line. */ - struct ecoff_find_line *find_line_info; - -} ecoff_data_type; - -/* Each canonical asymbol really looks like this. */ - -typedef struct ecoff_symbol_struct -{ - /* The actual symbol which the rest of BFD works with */ - asymbol symbol; - - /* The fdr for this symbol. */ - FDR *fdr; - - /* true if this is a local symbol rather than an external one. */ - boolean local; - - /* A pointer to the unswapped hidden information for this symbol. - This is either a struct sym_ext or a struct ext_ext, depending on - the value of the local field above. */ - PTR native; -} ecoff_symbol_type; - -/* We take the address of the first element of a asymbol to ensure that the - macro is only ever applied to an asymbol. */ -#define ecoffsymbol(asymbol) ((ecoff_symbol_type *) (&((asymbol)->the_bfd))) - -/* We need to save the index of an external symbol when we write it - out so that can set the symbol index correctly when we write out - the relocs. */ -#define ecoff_get_sym_index(symbol) ((symbol)->udata.i) -#define ecoff_set_sym_index(symbol, idx) ((symbol)->udata.i = (idx)) - -/* When generating MIPS embedded PIC code, the linker relaxes the code - to turn PC relative branches into longer code sequences when the PC - relative branch is out of range. This involves reading the relocs - in bfd_relax_section as well as in bfd_final_link, and requires the - code to keep track of which relocs have been expanded. A pointer - to this structure is put in the used_by_bfd pointer of a section to - keep track of this information. The user_by_bfd pointer will be - NULL if the information was not needed. */ - -struct ecoff_section_tdata -{ - /* The unswapped relocs for this section. These are stored in - memory so the input file does not have to be read twice. */ - PTR external_relocs; - - /* The contents of the section. These bytes may or may not be saved - in memory, but if it is this is a pointer to them. */ - bfd_byte *contents; - - /* Offset adjustments for PC relative branches. A number other than - 1 is an addend for a PC relative branch, or a switch table entry - which is the difference of two .text locations; this addend - arises because the branch or difference crosses one or more - branches which were expanded into a larger code sequence. A 1 - means that this branch was itself expanded into a larger code - sequence. 1 is not a possible offset, since all offsets must be - multiples of the instruction size, which is 4; also, the only - relocs with non-zero offsets will be PC relative branches or - switch table entries within the same object file. If this field - is NULL, no branches were expanded and no offsets are required. - Otherwise there are as many entries as there are relocs in the - section, and the entry for any reloc that is not PC relative is - zero. */ - long *offsets; - - /* When producing an executable (i.e., final, non-relocatable link) - on the Alpha, we may need to use multiple global pointer values - to span the entire .lita section. In essence, we allow each - input .lita section to have its own gp value. To support this, - we need to keep track of the gp values that we picked for each - input .lita section . */ - bfd_vma gp; -}; - -/* An accessor macro for the ecoff_section_tdata structure. */ -#define ecoff_section_data(abfd, sec) \ - ((struct ecoff_section_tdata *) (sec)->used_by_bfd) - -/* ECOFF linker hash table entries. */ - -struct ecoff_link_hash_entry -{ - struct bfd_link_hash_entry root; - /* Symbol index in output file. */ - long indx; - /* BFD that ext field value came from. */ - bfd *abfd; - /* ECOFF external symbol information. */ - EXTR esym; - /* Nonzero if this symbol has been written out. */ - char written; - /* Nonzero if this symbol was referred to as small undefined. */ - char small; -}; - -/* ECOFF linker hash table. */ - -struct ecoff_link_hash_table -{ - struct bfd_link_hash_table root; -}; - -/* Make an ECOFF object. */ -extern boolean _bfd_ecoff_mkobject PARAMS ((bfd *)); - -/* Read in the ECOFF symbolic debugging information. */ -extern boolean _bfd_ecoff_slurp_symbolic_info - PARAMS ((bfd *, asection *, struct ecoff_debug_info *)); - -/* Generic ECOFF BFD backend vectors. */ - -extern boolean _bfd_ecoff_write_object_contents PARAMS ((bfd *abfd)); -extern const bfd_target *_bfd_ecoff_archive_p PARAMS ((bfd *abfd)); - -#define _bfd_ecoff_close_and_cleanup _bfd_generic_close_and_cleanup -#define _bfd_ecoff_bfd_free_cached_info _bfd_generic_bfd_free_cached_info -extern boolean _bfd_ecoff_new_section_hook - PARAMS ((bfd *, asection *)); -extern boolean _bfd_ecoff_get_section_contents - PARAMS ((bfd *, asection *, PTR location, file_ptr, bfd_size_type)); - -#define _bfd_ecoff_bfd_link_split_section _bfd_generic_link_split_section - -extern boolean _bfd_ecoff_bfd_copy_private_bfd_data PARAMS ((bfd *, bfd *)); -#define _bfd_ecoff_bfd_copy_private_section_data \ - _bfd_generic_bfd_copy_private_section_data - -#define _bfd_ecoff_bfd_copy_private_symbol_data \ - _bfd_generic_bfd_copy_private_symbol_data - -#define _bfd_ecoff_bfd_print_private_bfd_data \ - _bfd_generic_bfd_print_private_bfd_data - -#define _bfd_ecoff_bfd_merge_private_bfd_data \ - _bfd_generic_bfd_merge_private_bfd_data - -#define _bfd_ecoff_bfd_set_private_flags _bfd_generic_bfd_set_private_flags -extern boolean _bfd_ecoff_slurp_armap PARAMS ((bfd *abfd)); -#define _bfd_ecoff_slurp_extended_name_table _bfd_slurp_extended_name_table -#define _bfd_ecoff_construct_extended_name_table \ - _bfd_archive_bsd_construct_extended_name_table -#define _bfd_ecoff_truncate_arname bfd_dont_truncate_arname -extern boolean _bfd_ecoff_write_armap - PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int)); -#define _bfd_ecoff_read_ar_hdr _bfd_generic_read_ar_hdr -#define _bfd_ecoff_openr_next_archived_file \ - bfd_generic_openr_next_archived_file -#define _bfd_ecoff_get_elt_at_index _bfd_generic_get_elt_at_index -#define _bfd_ecoff_generic_stat_arch_elt bfd_generic_stat_arch_elt -#define _bfd_ecoff_update_armap_timestamp bfd_true - -extern long _bfd_ecoff_get_symtab_upper_bound PARAMS ((bfd *abfd)); -extern long _bfd_ecoff_get_symtab PARAMS ((bfd *abfd, asymbol **alocation)); -extern asymbol *_bfd_ecoff_make_empty_symbol PARAMS ((bfd *abfd)); -extern void _bfd_ecoff_print_symbol - PARAMS ((bfd *, PTR filep, asymbol *, bfd_print_symbol_type)); -extern void _bfd_ecoff_get_symbol_info - PARAMS ((bfd *, asymbol *, symbol_info *)); -extern boolean _bfd_ecoff_bfd_is_local_label - PARAMS ((bfd *, asymbol *)); -#define _bfd_ecoff_get_lineno _bfd_nosymbols_get_lineno -extern boolean _bfd_ecoff_find_nearest_line - PARAMS ((bfd *, asection *, asymbol **, bfd_vma offset, - const char **filename_ptr, const char **fnname_ptr, - unsigned int *retline_ptr)); -#define _bfd_ecoff_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol -#define _bfd_ecoff_read_minisymbols _bfd_generic_read_minisymbols -#define _bfd_ecoff_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol - -#define _bfd_ecoff_get_reloc_upper_bound coff_get_reloc_upper_bound -extern long _bfd_ecoff_canonicalize_reloc - PARAMS ((bfd *, asection *, arelent **, asymbol **symbols)); -/* ecoff_bfd_reloc_type_lookup defined by backend. */ - -extern boolean _bfd_ecoff_set_arch_mach - PARAMS ((bfd *, enum bfd_architecture, unsigned long machine)); -extern boolean _bfd_ecoff_set_section_contents - PARAMS ((bfd *, asection *, PTR location, file_ptr, bfd_size_type)); - -extern int _bfd_ecoff_sizeof_headers PARAMS ((bfd *abfd, boolean reloc)); -/* ecoff_bfd_get_relocated_section_contents defined by backend. */ -/* ecoff_bfd_relax_section defined by backend. */ -extern struct bfd_link_hash_table *_bfd_ecoff_bfd_link_hash_table_create - PARAMS ((bfd *)); -extern boolean _bfd_ecoff_bfd_link_add_symbols - PARAMS ((bfd *, struct bfd_link_info *)); -extern boolean _bfd_ecoff_bfd_final_link - PARAMS ((bfd *, struct bfd_link_info *)); - -/* Hook functions for the generic COFF section reading code. */ - -extern PTR _bfd_ecoff_mkobject_hook PARAMS ((bfd *, PTR filehdr, PTR aouthdr)); -#define _bfd_ecoff_set_alignment_hook \ - ((void (*) PARAMS ((bfd *, asection *, PTR))) bfd_void) -extern boolean _bfd_ecoff_set_arch_mach_hook PARAMS ((bfd *abfd, PTR filehdr)); -extern flagword _bfd_ecoff_styp_to_sec_flags - PARAMS ((bfd *abfd, PTR hdr, const char *name)); -extern boolean _bfd_ecoff_slurp_symbol_table PARAMS ((bfd *abfd)); - -/* ECOFF auxiliary information swapping routines. These are the same - for all ECOFF targets, so they are defined in ecofflink.c. */ - -extern void _bfd_ecoff_swap_tir_in - PARAMS ((int, const struct tir_ext *, TIR *)); -extern void _bfd_ecoff_swap_tir_out - PARAMS ((int, const TIR *, struct tir_ext *)); -extern void _bfd_ecoff_swap_rndx_in - PARAMS ((int, const struct rndx_ext *, RNDXR *)); -extern void _bfd_ecoff_swap_rndx_out - PARAMS ((int, const RNDXR *, struct rndx_ext *)); diff --git a/contrib/gdb/bfd/linker.c b/contrib/gdb/bfd/linker.c deleted file mode 100644 index 4decc88..0000000 --- a/contrib/gdb/bfd/linker.c +++ /dev/null @@ -1,2781 +0,0 @@ -/* linker.c -- BFD linker routines - Copyright (C) 1993, 1994, 1995 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 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 "bfdlink.h" -#include "genlink.h" - -/* -SECTION - Linker Functions - -@cindex Linker - The linker uses three special entry points in the BFD target - vector. It is not necessary to write special routines for - these entry points when creating a new BFD back end, since - generic versions are provided. However, writing them can - speed up linking and make it use significantly less runtime - memory. - - The first routine creates a hash table used by the other - routines. The second routine adds the symbols from an object - file to the hash table. The third routine takes all the - object files and links them together to create the output - file. These routines are designed so that the linker proper - does not need to know anything about the symbols in the object - files that it is linking. The linker merely arranges the - sections as directed by the linker script and lets BFD handle - the details of symbols and relocs. - - The second routine and third routines are passed a pointer to - a <> structure (defined in - <>) which holds information relevant to the link, - including the linker hash table (which was created by the - first routine) and a set of callback functions to the linker - proper. - - The generic linker routines are in <>, and use the - header file <>. As of this writing, the only back - ends which have implemented versions of these routines are - a.out (in <>) and ECOFF (in <>). The a.out - routines are used as examples throughout this section. - -@menu -@* Creating a Linker Hash Table:: -@* Adding Symbols to the Hash Table:: -@* Performing the Final Link:: -@end menu - -INODE -Creating a Linker Hash Table, Adding Symbols to the Hash Table, Linker Functions, Linker Functions -SUBSECTION - Creating a linker hash table - -@cindex _bfd_link_hash_table_create in target vector -@cindex target vector (_bfd_link_hash_table_create) - The linker routines must create a hash table, which must be - derived from <> described in - <>. @xref{Hash Tables} for information on how to - create a derived hash table. This entry point is called using - the target vector of the linker output file. - - The <<_bfd_link_hash_table_create>> entry point must allocate - and initialize an instance of the desired hash table. If the - back end does not require any additional information to be - stored with the entries in the hash table, the entry point may - simply create a <>. Most likely, - however, some additional information will be needed. - - For example, with each entry in the hash table the a.out - linker keeps the index the symbol has in the final output file - (this index number is used so that when doing a relocateable - link the symbol index used in the output file can be quickly - filled in when copying over a reloc). The a.out linker code - defines the required structures and functions for a hash table - derived from <>. The a.out linker - hash table is created by the function - <>; it simply allocates - space for the hash table, initializes it, and returns a - pointer to it. - - When writing the linker routines for a new back end, you will - generally not know exactly which fields will be required until - you have finished. You should simply create a new hash table - which defines no additional fields, and then simply add fields - as they become necessary. - -INODE -Adding Symbols to the Hash Table, Performing the Final Link, Creating a Linker Hash Table, Linker Functions -SUBSECTION - Adding symbols to the hash table - -@cindex _bfd_link_add_symbols in target vector -@cindex target vector (_bfd_link_add_symbols) - The linker proper will call the <<_bfd_link_add_symbols>> - entry point for each object file or archive which is to be - linked (typically these are the files named on the command - line, but some may also come from the linker script). The - entry point is responsible for examining the file. For an - object file, BFD must add any relevant symbol information to - the hash table. For an archive, BFD must determine which - elements of the archive should be used and adding them to the - link. - - The a.out version of this entry point is - <>. - -@menu -@* Differing file formats:: -@* Adding symbols from an object file:: -@* Adding symbols from an archive:: -@end menu - -INODE -Differing file formats, Adding symbols from an object file, Adding Symbols to the Hash Table, Adding Symbols to the Hash Table -SUBSUBSECTION - Differing file formats - - Normally all the files involved in a link will be of the same - format, but it is also possible to link together different - format object files, and the back end must support that. The - <<_bfd_link_add_symbols>> entry point is called via the target - vector of the file to be added. This has an important - consequence: the function may not assume that the hash table - is the type created by the corresponding - <<_bfd_link_hash_table_create>> vector. All the - <<_bfd_link_add_symbols>> function can assume about the hash - table is that it is derived from <>. - - Sometimes the <<_bfd_link_add_symbols>> function must store - some information in the hash table entry to be used by the - <<_bfd_final_link>> function. In such a case the <> - field of the hash table must be checked to make sure that the - hash table was created by an object file of the same format. - - The <<_bfd_final_link>> routine must be prepared to handle a - hash entry without any extra information added by the - <<_bfd_link_add_symbols>> function. A hash entry without - extra information will also occur when the linker script - directs the linker to create a symbol. Note that, regardless - of how a hash table entry is added, all the fields will be - initialized to some sort of null value by the hash table entry - initialization function. - - See <> for an example of how to - check the <> field before saving information (in this - case, the ECOFF external symbol debugging information) in a - hash table entry. - -INODE -Adding symbols from an object file, Adding symbols from an archive, Differing file formats, Adding Symbols to the Hash Table -SUBSUBSECTION - Adding symbols from an object file - - When the <<_bfd_link_add_symbols>> routine is passed an object - file, it must add all externally visible symbols in that - object file to the hash table. The actual work of adding the - symbol to the hash table is normally handled by the function - <<_bfd_generic_link_add_one_symbol>>. The - <<_bfd_link_add_symbols>> routine is responsible for reading - all the symbols from the object file and passing the correct - information to <<_bfd_generic_link_add_one_symbol>>. - - The <<_bfd_link_add_symbols>> routine should not use - <> to read the symbols. The point of - providing this routine is to avoid the overhead of converting - the symbols into generic <> structures. - -@findex _bfd_generic_link_add_one_symbol - <<_bfd_generic_link_add_one_symbol>> handles the details of - combining common symbols, warning about multiple definitions, - and so forth. It takes arguments which describe the symbol to - add, notably symbol flags, a section, and an offset. The - symbol flags include such things as <> or - <>. The section is a section in the object - file, or something like <> for an undefined - symbol or <> for a common symbol. - - If the <<_bfd_final_link>> routine is also going to need to - read the symbol information, the <<_bfd_link_add_symbols>> - routine should save it somewhere attached to the object file - BFD. However, the information should only be saved if the - <> field of the <> argument is true, so - that the <<-no-keep-memory>> linker switch is effective. - - The a.out function which adds symbols from an object file is - <>, and most of the interesting - work is in <>. The latter saves - pointers to the hash tables entries created by - <<_bfd_generic_link_add_one_symbol>> indexed by symbol number, - so that the <<_bfd_final_link>> routine does not have to call - the hash table lookup routine to locate the entry. - -INODE -Adding symbols from an archive, , Adding symbols from an object file, Adding Symbols to the Hash Table -SUBSUBSECTION - Adding symbols from an archive - - When the <<_bfd_link_add_symbols>> routine is passed an - archive, it must look through the symbols defined by the - archive and decide which elements of the archive should be - included in the link. For each such element it must call the - <> linker callback, and it must add the - symbols from the object file to the linker hash table. - -@findex _bfd_generic_link_add_archive_symbols - In most cases the work of looking through the symbols in the - archive should be done by the - <<_bfd_generic_link_add_archive_symbols>> function. This - function builds a hash table from the archive symbol table and - looks through the list of undefined symbols to see which - elements should be included. - <<_bfd_generic_link_add_archive_symbols>> is passed a function - to call to make the final decision about adding an archive - element to the link and to do the actual work of adding the - symbols to the linker hash table. - - The function passed to - <<_bfd_generic_link_add_archive_symbols>> must read the - symbols of the archive element and decide whether the archive - element should be included in the link. If the element is to - be included, the <> linker callback - routine must be called with the element as an argument, and - the elements symbols must be added to the linker hash table - just as though the element had itself been passed to the - <<_bfd_link_add_symbols>> function. - - When the a.out <<_bfd_link_add_symbols>> function receives an - archive, it calls <<_bfd_generic_link_add_archive_symbols>> - passing <> as the function - argument. <> calls - <>. If the latter decides to add - the element (an element is only added if it provides a real, - non-common, definition for a previously undefined or common - symbol) it calls the <> callback and then - <> calls - <> to actually add the symbols to the - linker hash table. - - The ECOFF back end is unusual in that it does not normally - call <<_bfd_generic_link_add_archive_symbols>>, because ECOFF - archives already contain a hash table of symbols. The ECOFF - back end searches the archive itself to avoid the overhead of - creating a new hash table. - -INODE -Performing the Final Link, , Adding Symbols to the Hash Table, Linker Functions -SUBSECTION - Performing the final link - -@cindex _bfd_link_final_link in target vector -@cindex target vector (_bfd_final_link) - When all the input files have been processed, the linker calls - the <<_bfd_final_link>> entry point of the output BFD. This - routine is responsible for producing the final output file, - which has several aspects. It must relocate the contents of - the input sections and copy the data into the output sections. - It must build an output symbol table including any local - symbols from the input files and the global symbols from the - hash table. When producing relocateable output, it must - modify the input relocs and write them into the output file. - There may also be object format dependent work to be done. - - The linker will also call the <> entry - point when the BFD is closed. The two entry points must work - together in order to produce the correct output file. - - The details of how this works are inevitably dependent upon - the specific object file format. The a.out - <<_bfd_final_link>> routine is <>. - -@menu -@* Information provided by the linker:: -@* Relocating the section contents:: -@* Writing the symbol table:: -@end menu - -INODE -Information provided by the linker, Relocating the section contents, Performing the Final Link, Performing the Final Link -SUBSUBSECTION - Information provided by the linker - - Before the linker calls the <<_bfd_final_link>> entry point, - it sets up some data structures for the function to use. - - The <> field of the <> structure - will point to a list of all the input files included in the - link. These files are linked through the <> field - of the <> structure. - - Each section in the output file will have a list of - <> structures attached to the <> - field (the <> structure is defined in - <>). These structures describe how to create the - contents of the output section in terms of the contents of - various input sections, fill constants, and, eventually, other - types of information. They also describe relocs that must be - created by the BFD backend, but do not correspond to any input - file; this is used to support -Ur, which builds constructors - while generating a relocateable object file. - -INODE -Relocating the section contents, Writing the symbol table, Information provided by the linker, Performing the Final Link -SUBSUBSECTION - Relocating the section contents - - The <<_bfd_final_link>> function should look through the - <> structures attached to each section of the - output file. Each <> structure should either be - handled specially, or it should be passed to the function - <<_bfd_default_link_order>> which will do the right thing - (<<_bfd_default_link_order>> is defined in <>). - - For efficiency, a <> of type - <> whose associated section belongs - to a BFD of the same format as the output BFD must be handled - specially. This type of <> describes part of an - output section in terms of a section belonging to one of the - input files. The <<_bfd_final_link>> function should read the - contents of the section and any associated relocs, apply the - relocs to the section contents, and write out the modified - section contents. If performing a relocateable link, the - relocs themselves must also be modified and written out. - -@findex _bfd_relocate_contents -@findex _bfd_final_link_relocate - The functions <<_bfd_relocate_contents>> and - <<_bfd_final_link_relocate>> provide some general support for - performing the actual relocations, notably overflow checking. - Their arguments include information about the symbol the - relocation is against and a <> argument - which describes the relocation to perform. These functions - are defined in <>. - - The a.out function which handles reading, relocating, and - writing section contents is <>. The - actual relocation is done in <> - and <>. - -INODE -Writing the symbol table, , Relocating the section contents, Performing the Final Link -SUBSUBSECTION - Writing the symbol table - - The <<_bfd_final_link>> function must gather all the symbols - in the input files and write them out. It must also write out - all the symbols in the global hash table. This must be - controlled by the <> and <> fields of the - <> structure. - - The local symbols of the input files will not have been - entered into the linker hash table. The <<_bfd_final_link>> - routine must consider each input file and include the symbols - in the output file. It may be convenient to do this when - looking through the <> structures, or it may be - done by stepping through the <> list. - - The <<_bfd_final_link>> routine must also traverse the global - hash table to gather all the externally visible symbols. It - is possible that most of the externally visible symbols may be - written out when considering the symbols of each input file, - but it is still necessary to traverse the hash table since the - linker script may have defined some symbols that are not in - any of the input files. - - The <> field of the <> structure - controls which symbols are written out. The possible values - are listed in <>. If the value is <>, - then the <> field of the <> - structure is a hash table of symbols to keep; each symbol - should be looked up in this hash table, and only symbols which - are present should be included in the output file. - - If the <> field of the <> structure - permits local symbols to be written out, the <> field - is used to further controls which local symbols are included - in the output file. If the value is <>, then all - local symbols which begin with a certain prefix are discarded; - this prefix is described by the <> and - <> fields of the <> structure. - - The a.out backend handles symbols by calling - <> on each input BFD and then - traversing the global hash table with the function - <>. It builds a string table - while writing out the symbols, which is written to the output - file at the end of <>. -*/ - -static struct bfd_hash_entry *generic_link_hash_newfunc - PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, - const char *)); -static boolean generic_link_read_symbols - PARAMS ((bfd *)); -static boolean generic_link_add_symbols - PARAMS ((bfd *, struct bfd_link_info *, boolean collect)); -static boolean generic_link_add_object_symbols - PARAMS ((bfd *, struct bfd_link_info *, boolean collect)); -static boolean generic_link_check_archive_element_no_collect - PARAMS ((bfd *, struct bfd_link_info *, boolean *pneeded)); -static boolean generic_link_check_archive_element_collect - PARAMS ((bfd *, struct bfd_link_info *, boolean *pneeded)); -static boolean generic_link_check_archive_element - PARAMS ((bfd *, struct bfd_link_info *, boolean *pneeded, boolean collect)); -static boolean generic_link_add_symbol_list - PARAMS ((bfd *, struct bfd_link_info *, bfd_size_type count, asymbol **, - boolean collect)); -static bfd *hash_entry_bfd PARAMS ((struct bfd_link_hash_entry *)); -static void set_symbol_from_hash - PARAMS ((asymbol *, struct bfd_link_hash_entry *)); -static boolean generic_add_output_symbol - PARAMS ((bfd *, size_t *psymalloc, asymbol *)); -static boolean default_fill_link_order - PARAMS ((bfd *, struct bfd_link_info *, asection *, - struct bfd_link_order *)); -static boolean default_indirect_link_order - PARAMS ((bfd *, struct bfd_link_info *, asection *, - struct bfd_link_order *, boolean)); - -/* The link hash table structure is defined in bfdlink.h. It provides - a base hash table which the backend specific hash tables are built - upon. */ - -/* Routine to create an entry in the link hash table. */ - -struct bfd_hash_entry * -_bfd_link_hash_newfunc (entry, table, string) - struct bfd_hash_entry *entry; - struct bfd_hash_table *table; - const char *string; -{ - struct bfd_link_hash_entry *ret = (struct bfd_link_hash_entry *) entry; - - /* Allocate the structure if it has not already been allocated by a - subclass. */ - if (ret == (struct bfd_link_hash_entry *) NULL) - ret = ((struct bfd_link_hash_entry *) - bfd_hash_allocate (table, sizeof (struct bfd_link_hash_entry))); - if (ret == (struct bfd_link_hash_entry *) NULL) - return NULL; - - /* Call the allocation method of the superclass. */ - ret = ((struct bfd_link_hash_entry *) - bfd_hash_newfunc ((struct bfd_hash_entry *) ret, table, string)); - - if (ret) - { - /* Initialize the local fields. */ - ret->type = bfd_link_hash_new; - ret->next = NULL; - } - - return (struct bfd_hash_entry *) ret; -} - -/* Initialize a link hash table. The BFD argument is the one - responsible for creating this table. */ - -boolean -_bfd_link_hash_table_init (table, abfd, newfunc) - struct bfd_link_hash_table *table; - bfd *abfd; - struct bfd_hash_entry *(*newfunc) PARAMS ((struct bfd_hash_entry *, - struct bfd_hash_table *, - const char *)); -{ - table->creator = abfd->xvec; - table->undefs = NULL; - table->undefs_tail = NULL; - return bfd_hash_table_init (&table->table, newfunc); -} - -/* Look up a symbol in a link hash table. If follow is true, we - follow bfd_link_hash_indirect and bfd_link_hash_warning links to - the real symbol. */ - -struct bfd_link_hash_entry * -bfd_link_hash_lookup (table, string, create, copy, follow) - struct bfd_link_hash_table *table; - const char *string; - boolean create; - boolean copy; - boolean follow; -{ - struct bfd_link_hash_entry *ret; - - ret = ((struct bfd_link_hash_entry *) - bfd_hash_lookup (&table->table, string, create, copy)); - - if (follow && ret != (struct bfd_link_hash_entry *) NULL) - { - while (ret->type == bfd_link_hash_indirect - || ret->type == bfd_link_hash_warning) - ret = ret->u.i.link; - } - - return ret; -} - -/* Look up a symbol in the main linker hash table if the symbol might - be wrapped. This should only be used for references to an - undefined symbol, not for definitions of a symbol. */ - -struct bfd_link_hash_entry * -bfd_wrapped_link_hash_lookup (abfd, info, string, create, copy, follow) - bfd *abfd; - struct bfd_link_info *info; - const char *string; - boolean create; - boolean copy; - boolean follow; -{ - if (info->wrap_hash != NULL) - { - const char *l; - - l = string; - if (*l == bfd_get_symbol_leading_char (abfd)) - ++l; - -#undef WRAP -#define WRAP "__wrap_" - - if (bfd_hash_lookup (info->wrap_hash, l, false, false) != NULL) - { - char *n; - struct bfd_link_hash_entry *h; - - /* This symbol is being wrapped. We want to replace all - references to SYM with references to __wrap_SYM. */ - - n = (char *) bfd_malloc (strlen (l) + sizeof WRAP + 1); - if (n == NULL) - return NULL; - - /* Note that symbol_leading_char may be '\0'. */ - n[0] = bfd_get_symbol_leading_char (abfd); - n[1] = '\0'; - strcat (n, WRAP); - strcat (n, l); - h = bfd_link_hash_lookup (info->hash, n, create, true, follow); - free (n); - return h; - } - -#undef WRAP - -#undef REAL -#define REAL "__real_" - - if (*l == '_' - && strncmp (l, REAL, sizeof REAL - 1) == 0 - && bfd_hash_lookup (info->wrap_hash, l + sizeof REAL - 1, - false, false) != NULL) - { - char *n; - struct bfd_link_hash_entry *h; - - /* This is a reference to __real_SYM, where SYM is being - wrapped. We want to replace all references to __real_SYM - with references to SYM. */ - - n = (char *) bfd_malloc (strlen (l + sizeof REAL - 1) + 2); - if (n == NULL) - return NULL; - - /* Note that symbol_leading_char may be '\0'. */ - n[0] = bfd_get_symbol_leading_char (abfd); - n[1] = '\0'; - strcat (n, l + sizeof REAL - 1); - h = bfd_link_hash_lookup (info->hash, n, create, true, follow); - free (n); - return h; - } - -#undef REAL - } - - return bfd_link_hash_lookup (info->hash, string, create, copy, follow); -} - -/* Traverse a generic link hash table. The only reason this is not a - macro is to do better type checking. This code presumes that an - argument passed as a struct bfd_hash_entry * may be caught as a - struct bfd_link_hash_entry * with no explicit cast required on the - call. */ - -void -bfd_link_hash_traverse (table, func, info) - struct bfd_link_hash_table *table; - boolean (*func) PARAMS ((struct bfd_link_hash_entry *, PTR)); - PTR info; -{ - bfd_hash_traverse (&table->table, - ((boolean (*) PARAMS ((struct bfd_hash_entry *, PTR))) - func), - info); -} - -/* Add a symbol to the linker hash table undefs list. */ - -INLINE void -bfd_link_add_undef (table, h) - struct bfd_link_hash_table *table; - struct bfd_link_hash_entry *h; -{ - BFD_ASSERT (h->next == NULL); - if (table->undefs_tail != (struct bfd_link_hash_entry *) NULL) - table->undefs_tail->next = h; - if (table->undefs == (struct bfd_link_hash_entry *) NULL) - table->undefs = h; - table->undefs_tail = h; -} - -/* Routine to create an entry in an generic link hash table. */ - -static struct bfd_hash_entry * -generic_link_hash_newfunc (entry, table, string) - struct bfd_hash_entry *entry; - struct bfd_hash_table *table; - const char *string; -{ - struct generic_link_hash_entry *ret = - (struct generic_link_hash_entry *) entry; - - /* Allocate the structure if it has not already been allocated by a - subclass. */ - if (ret == (struct generic_link_hash_entry *) NULL) - ret = ((struct generic_link_hash_entry *) - bfd_hash_allocate (table, sizeof (struct generic_link_hash_entry))); - if (ret == (struct generic_link_hash_entry *) NULL) - return NULL; - - /* Call the allocation method of the superclass. */ - ret = ((struct generic_link_hash_entry *) - _bfd_link_hash_newfunc ((struct bfd_hash_entry *) ret, - table, string)); - - if (ret) - { - /* Set local fields. */ - ret->written = false; - ret->sym = NULL; - } - - return (struct bfd_hash_entry *) ret; -} - -/* Create an generic link hash table. */ - -struct bfd_link_hash_table * -_bfd_generic_link_hash_table_create (abfd) - bfd *abfd; -{ - struct generic_link_hash_table *ret; - - ret = ((struct generic_link_hash_table *) - bfd_alloc (abfd, sizeof (struct generic_link_hash_table))); - if (ret == NULL) - return (struct bfd_link_hash_table *) NULL; - if (! _bfd_link_hash_table_init (&ret->root, abfd, - generic_link_hash_newfunc)) - { - free (ret); - return (struct bfd_link_hash_table *) NULL; - } - return &ret->root; -} - -/* Grab the symbols for an object file when doing a generic link. We - store the symbols in the outsymbols field. We need to keep them - around for the entire link to ensure that we only read them once. - If we read them multiple times, we might wind up with relocs and - the hash table pointing to different instances of the symbol - structure. */ - -static boolean -generic_link_read_symbols (abfd) - bfd *abfd; -{ - if (abfd->outsymbols == (asymbol **) NULL) - { - long symsize; - long symcount; - - symsize = bfd_get_symtab_upper_bound (abfd); - if (symsize < 0) - return false; - abfd->outsymbols = (asymbol **) bfd_alloc (abfd, symsize); - if (abfd->outsymbols == NULL && symsize != 0) - return false; - symcount = bfd_canonicalize_symtab (abfd, abfd->outsymbols); - if (symcount < 0) - return false; - abfd->symcount = symcount; - } - - return true; -} - -/* Generic function to add symbols to from an object file to the - global hash table. This version does not automatically collect - constructors by name. */ - -boolean -_bfd_generic_link_add_symbols (abfd, info) - bfd *abfd; - struct bfd_link_info *info; -{ - return generic_link_add_symbols (abfd, info, false); -} - -/* Generic function to add symbols from an object file to the global - hash table. This version automatically collects constructors by - name, as the collect2 program does. It should be used for any - target which does not provide some other mechanism for setting up - constructors and destructors; these are approximately those targets - for which gcc uses collect2 and do not support stabs. */ - -boolean -_bfd_generic_link_add_symbols_collect (abfd, info) - bfd *abfd; - struct bfd_link_info *info; -{ - return generic_link_add_symbols (abfd, info, true); -} - -/* Add symbols from an object file to the global hash table. */ - -static boolean -generic_link_add_symbols (abfd, info, collect) - bfd *abfd; - struct bfd_link_info *info; - boolean collect; -{ - boolean ret; - - switch (bfd_get_format (abfd)) - { - case bfd_object: - ret = generic_link_add_object_symbols (abfd, info, collect); - break; - case bfd_archive: - ret = (_bfd_generic_link_add_archive_symbols - (abfd, info, - (collect - ? generic_link_check_archive_element_collect - : generic_link_check_archive_element_no_collect))); - break; - default: - bfd_set_error (bfd_error_wrong_format); - ret = false; - } - - return ret; -} - -/* Add symbols from an object file to the global hash table. */ - -static boolean -generic_link_add_object_symbols (abfd, info, collect) - bfd *abfd; - struct bfd_link_info *info; - boolean collect; -{ - if (! generic_link_read_symbols (abfd)) - return false; - return generic_link_add_symbol_list (abfd, info, - _bfd_generic_link_get_symcount (abfd), - _bfd_generic_link_get_symbols (abfd), - collect); -} - -/* We build a hash table of all symbols defined in an archive. */ - -/* An archive symbol may be defined by multiple archive elements. - This linked list is used to hold the elements. */ - -struct archive_list -{ - struct archive_list *next; - int indx; -}; - -/* An entry in an archive hash table. */ - -struct archive_hash_entry -{ - struct bfd_hash_entry root; - /* Where the symbol is defined. */ - struct archive_list *defs; -}; - -/* An archive hash table itself. */ - -struct archive_hash_table -{ - struct bfd_hash_table table; -}; - -static struct bfd_hash_entry *archive_hash_newfunc - PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); -static boolean archive_hash_table_init - PARAMS ((struct archive_hash_table *, - struct bfd_hash_entry *(*) (struct bfd_hash_entry *, - struct bfd_hash_table *, - const char *))); - -/* Create a new entry for an archive hash table. */ - -static struct bfd_hash_entry * -archive_hash_newfunc (entry, table, string) - struct bfd_hash_entry *entry; - struct bfd_hash_table *table; - const char *string; -{ - struct archive_hash_entry *ret = (struct archive_hash_entry *) entry; - - /* Allocate the structure if it has not already been allocated by a - subclass. */ - if (ret == (struct archive_hash_entry *) NULL) - ret = ((struct archive_hash_entry *) - bfd_hash_allocate (table, sizeof (struct archive_hash_entry))); - if (ret == (struct archive_hash_entry *) NULL) - return NULL; - - /* Call the allocation method of the superclass. */ - ret = ((struct archive_hash_entry *) - bfd_hash_newfunc ((struct bfd_hash_entry *) ret, table, string)); - - if (ret) - { - /* Initialize the local fields. */ - ret->defs = (struct archive_list *) NULL; - } - - return (struct bfd_hash_entry *) ret; -} - -/* Initialize an archive hash table. */ - -static boolean -archive_hash_table_init (table, newfunc) - struct archive_hash_table *table; - struct bfd_hash_entry *(*newfunc) PARAMS ((struct bfd_hash_entry *, - struct bfd_hash_table *, - const char *)); -{ - return bfd_hash_table_init (&table->table, newfunc); -} - -/* Look up an entry in an archive hash table. */ - -#define archive_hash_lookup(t, string, create, copy) \ - ((struct archive_hash_entry *) \ - bfd_hash_lookup (&(t)->table, (string), (create), (copy))) - -/* Allocate space in an archive hash table. */ - -#define archive_hash_allocate(t, size) bfd_hash_allocate (&(t)->table, (size)) - -/* Free an archive hash table. */ - -#define archive_hash_table_free(t) bfd_hash_table_free (&(t)->table) - -/* Generic function to add symbols from an archive file to the global - hash file. This function presumes that the archive symbol table - has already been read in (this is normally done by the - bfd_check_format entry point). It looks through the undefined and - common symbols and searches the archive symbol table for them. If - it finds an entry, it includes the associated object file in the - link. - - The old linker looked through the archive symbol table for - undefined symbols. We do it the other way around, looking through - undefined symbols for symbols defined in the archive. The - advantage of the newer scheme is that we only have to look through - the list of undefined symbols once, whereas the old method had to - re-search the symbol table each time a new object file was added. - - The CHECKFN argument is used to see if an object file should be - included. CHECKFN should set *PNEEDED to true if the object file - should be included, and must also call the bfd_link_info - add_archive_element callback function and handle adding the symbols - to the global hash table. CHECKFN should only return false if some - sort of error occurs. - - For some formats, such as a.out, it is possible to look through an - object file but not actually include it in the link. The - archive_pass field in a BFD is used to avoid checking the symbols - of an object files too many times. When an object is included in - the link, archive_pass is set to -1. If an object is scanned but - not included, archive_pass is set to the pass number. The pass - number is incremented each time a new object file is included. The - pass number is used because when a new object file is included it - may create new undefined symbols which cause a previously examined - object file to be included. */ - -boolean -_bfd_generic_link_add_archive_symbols (abfd, info, checkfn) - bfd *abfd; - struct bfd_link_info *info; - boolean (*checkfn) PARAMS ((bfd *, struct bfd_link_info *, - boolean *pneeded)); -{ - carsym *arsyms; - carsym *arsym_end; - register carsym *arsym; - int pass; - struct archive_hash_table arsym_hash; - int indx; - struct bfd_link_hash_entry **pundef; - - if (! bfd_has_map (abfd)) - { - /* An empty archive is a special case. */ - if (bfd_openr_next_archived_file (abfd, (bfd *) NULL) == NULL) - return true; - bfd_set_error (bfd_error_no_armap); - return false; - } - - arsyms = bfd_ardata (abfd)->symdefs; - arsym_end = arsyms + bfd_ardata (abfd)->symdef_count; - - /* In order to quickly determine whether an symbol is defined in - this archive, we build a hash table of the symbols. */ - if (! archive_hash_table_init (&arsym_hash, archive_hash_newfunc)) - return false; - for (arsym = arsyms, indx = 0; arsym < arsym_end; arsym++, indx++) - { - struct archive_hash_entry *arh; - struct archive_list *l, **pp; - - arh = archive_hash_lookup (&arsym_hash, arsym->name, true, false); - if (arh == (struct archive_hash_entry *) NULL) - goto error_return; - l = ((struct archive_list *) - archive_hash_allocate (&arsym_hash, sizeof (struct archive_list))); - if (l == NULL) - goto error_return; - l->indx = indx; - for (pp = &arh->defs; - *pp != (struct archive_list *) NULL; - pp = &(*pp)->next) - ; - *pp = l; - l->next = NULL; - } - - /* The archive_pass field in the archive itself is used to - initialize PASS, sine we may search the same archive multiple - times. */ - pass = abfd->archive_pass + 1; - - /* New undefined symbols are added to the end of the list, so we - only need to look through it once. */ - pundef = &info->hash->undefs; - while (*pundef != (struct bfd_link_hash_entry *) NULL) - { - struct bfd_link_hash_entry *h; - struct archive_hash_entry *arh; - struct archive_list *l; - - h = *pundef; - - /* When a symbol is defined, it is not necessarily removed from - the list. */ - if (h->type != bfd_link_hash_undefined - && h->type != bfd_link_hash_common) - { - /* Remove this entry from the list, for general cleanliness - and because we are going to look through the list again - if we search any more libraries. We can't remove the - entry if it is the tail, because that would lose any - entries we add to the list later on (it would also cause - us to lose track of whether the symbol has been - referenced). */ - if (*pundef != info->hash->undefs_tail) - *pundef = (*pundef)->next; - else - pundef = &(*pundef)->next; - continue; - } - - /* Look for this symbol in the archive symbol map. */ - arh = archive_hash_lookup (&arsym_hash, h->root.string, false, false); - if (arh == (struct archive_hash_entry *) NULL) - { - pundef = &(*pundef)->next; - continue; - } - - /* Look at all the objects which define this symbol. */ - for (l = arh->defs; l != (struct archive_list *) NULL; l = l->next) - { - bfd *element; - boolean needed; - - /* If the symbol has gotten defined along the way, quit. */ - if (h->type != bfd_link_hash_undefined - && h->type != bfd_link_hash_common) - break; - - element = bfd_get_elt_at_index (abfd, l->indx); - if (element == (bfd *) NULL) - goto error_return; - - /* If we've already included this element, or if we've - already checked it on this pass, continue. */ - if (element->archive_pass == -1 - || element->archive_pass == pass) - continue; - - /* If we can't figure this element out, just ignore it. */ - if (! bfd_check_format (element, bfd_object)) - { - element->archive_pass = -1; - continue; - } - - /* CHECKFN will see if this element should be included, and - go ahead and include it if appropriate. */ - if (! (*checkfn) (element, info, &needed)) - goto error_return; - - if (! needed) - element->archive_pass = pass; - else - { - element->archive_pass = -1; - - /* Increment the pass count to show that we may need to - recheck object files which were already checked. */ - ++pass; - } - } - - pundef = &(*pundef)->next; - } - - archive_hash_table_free (&arsym_hash); - - /* Save PASS in case we are called again. */ - abfd->archive_pass = pass; - - return true; - - error_return: - archive_hash_table_free (&arsym_hash); - return false; -} - -/* See if we should include an archive element. This version is used - when we do not want to automatically collect constructors based on - the symbol name, presumably because we have some other mechanism - for finding them. */ - -static boolean -generic_link_check_archive_element_no_collect (abfd, info, pneeded) - bfd *abfd; - struct bfd_link_info *info; - boolean *pneeded; -{ - return generic_link_check_archive_element (abfd, info, pneeded, false); -} - -/* See if we should include an archive element. This version is used - when we want to automatically collect constructors based on the - symbol name, as collect2 does. */ - -static boolean -generic_link_check_archive_element_collect (abfd, info, pneeded) - bfd *abfd; - struct bfd_link_info *info; - boolean *pneeded; -{ - return generic_link_check_archive_element (abfd, info, pneeded, true); -} - -/* See if we should include an archive element. Optionally collect - constructors. */ - -static boolean -generic_link_check_archive_element (abfd, info, pneeded, collect) - bfd *abfd; - struct bfd_link_info *info; - boolean *pneeded; - boolean collect; -{ - asymbol **pp, **ppend; - - *pneeded = false; - - if (! generic_link_read_symbols (abfd)) - return false; - - pp = _bfd_generic_link_get_symbols (abfd); - ppend = pp + _bfd_generic_link_get_symcount (abfd); - for (; pp < ppend; pp++) - { - asymbol *p; - struct bfd_link_hash_entry *h; - - p = *pp; - - /* We are only interested in globally visible symbols. */ - if (! bfd_is_com_section (p->section) - && (p->flags & (BSF_GLOBAL | BSF_INDIRECT | BSF_WEAK)) == 0) - continue; - - /* We are only interested if we know something about this - symbol, and it is undefined or common. An undefined weak - symbol (type bfd_link_hash_undefweak) is not considered to be - a reference when pulling files out of an archive. See the - SVR4 ABI, p. 4-27. */ - h = bfd_link_hash_lookup (info->hash, bfd_asymbol_name (p), false, - false, true); - if (h == (struct bfd_link_hash_entry *) NULL - || (h->type != bfd_link_hash_undefined - && h->type != bfd_link_hash_common)) - continue; - - /* P is a symbol we are looking for. */ - - if (! bfd_is_com_section (p->section)) - { - bfd_size_type symcount; - asymbol **symbols; - - /* This object file defines this symbol, so pull it in. */ - if (! (*info->callbacks->add_archive_element) (info, abfd, - bfd_asymbol_name (p))) - return false; - symcount = _bfd_generic_link_get_symcount (abfd); - symbols = _bfd_generic_link_get_symbols (abfd); - if (! generic_link_add_symbol_list (abfd, info, symcount, - symbols, collect)) - return false; - *pneeded = true; - return true; - } - - /* P is a common symbol. */ - - if (h->type == bfd_link_hash_undefined) - { - bfd *symbfd; - bfd_vma size; - unsigned int power; - - symbfd = h->u.undef.abfd; - if (symbfd == (bfd *) NULL) - { - /* This symbol was created as undefined from outside - BFD. We assume that we should link in the object - file. This is for the -u option in the linker. */ - if (! (*info->callbacks->add_archive_element) - (info, abfd, bfd_asymbol_name (p))) - return false; - *pneeded = true; - return true; - } - - /* Turn the symbol into a common symbol but do not link in - the object file. This is how a.out works. Object - formats that require different semantics must implement - this function differently. This symbol is already on the - undefs list. We add the section to a common section - attached to symbfd to ensure that it is in a BFD which - will be linked in. */ - h->type = bfd_link_hash_common; - h->u.c.p = - ((struct bfd_link_hash_common_entry *) - bfd_hash_allocate (&info->hash->table, - sizeof (struct bfd_link_hash_common_entry))); - if (h->u.c.p == NULL) - return false; - - size = bfd_asymbol_value (p); - h->u.c.size = size; - - power = bfd_log2 (size); - if (power > 4) - power = 4; - h->u.c.p->alignment_power = power; - - if (p->section == bfd_com_section_ptr) - h->u.c.p->section = bfd_make_section_old_way (symbfd, "COMMON"); - else - h->u.c.p->section = bfd_make_section_old_way (symbfd, - p->section->name); - h->u.c.p->section->flags = SEC_ALLOC; - } - else - { - /* Adjust the size of the common symbol if necessary. This - is how a.out works. Object formats that require - different semantics must implement this function - differently. */ - if (bfd_asymbol_value (p) > h->u.c.size) - h->u.c.size = bfd_asymbol_value (p); - } - } - - /* This archive element is not needed. */ - return true; -} - -/* Add the symbols from an object file to the global hash table. ABFD - is the object file. INFO is the linker information. SYMBOL_COUNT - is the number of symbols. SYMBOLS is the list of symbols. COLLECT - is true if constructors should be automatically collected by name - as is done by collect2. */ - -static boolean -generic_link_add_symbol_list (abfd, info, symbol_count, symbols, collect) - bfd *abfd; - struct bfd_link_info *info; - bfd_size_type symbol_count; - asymbol **symbols; - boolean collect; -{ - asymbol **pp, **ppend; - - pp = symbols; - ppend = symbols + symbol_count; - for (; pp < ppend; pp++) - { - asymbol *p; - - p = *pp; - - if ((p->flags & (BSF_INDIRECT - | BSF_WARNING - | BSF_GLOBAL - | BSF_CONSTRUCTOR - | BSF_WEAK)) != 0 - || bfd_is_und_section (bfd_get_section (p)) - || bfd_is_com_section (bfd_get_section (p)) - || bfd_is_ind_section (bfd_get_section (p))) - { - const char *name; - const char *string; - struct generic_link_hash_entry *h; - - name = bfd_asymbol_name (p); - if (((p->flags & BSF_INDIRECT) != 0 - || bfd_is_ind_section (p->section)) - && pp + 1 < ppend) - { - pp++; - string = bfd_asymbol_name (*pp); - } - else if ((p->flags & BSF_WARNING) != 0 - && pp + 1 < ppend) - { - /* The name of P is actually the warning string, and the - next symbol is the one to warn about. */ - string = name; - pp++; - name = bfd_asymbol_name (*pp); - } - else - string = NULL; - - h = NULL; - if (! (_bfd_generic_link_add_one_symbol - (info, abfd, name, p->flags, bfd_get_section (p), - p->value, string, false, collect, - (struct bfd_link_hash_entry **) &h))) - return false; - - /* If this is a constructor symbol, and the linker didn't do - anything with it, then we want to just pass the symbol - through to the output file. This will happen when - linking with -r. */ - if ((p->flags & BSF_CONSTRUCTOR) != 0 - && (h == NULL || h->root.type == bfd_link_hash_new)) - { - p->udata.p = NULL; - continue; - } - - /* Save the BFD symbol so that we don't lose any backend - specific information that may be attached to it. We only - want this one if it gives more information than the - existing one; we don't want to replace a defined symbol - with an undefined one. This routine may be called with a - hash table other than the generic hash table, so we only - do this if we are certain that the hash table is a - generic one. */ - if (info->hash->creator == abfd->xvec) - { - if (h->sym == (asymbol *) NULL - || (! bfd_is_und_section (bfd_get_section (p)) - && (! bfd_is_com_section (bfd_get_section (p)) - || bfd_is_und_section (bfd_get_section (h->sym))))) - { - h->sym = p; - /* BSF_OLD_COMMON is a hack to support COFF reloc - reading, and it should go away when the COFF - linker is switched to the new version. */ - if (bfd_is_com_section (bfd_get_section (p))) - p->flags |= BSF_OLD_COMMON; - } - - /* Store a back pointer from the symbol to the hash - table entry for the benefit of relaxation code until - it gets rewritten to not use asymbol structures. - Setting this is also used to check whether these - symbols were set up by the generic linker. */ - p->udata.p = (PTR) h; - } - } - } - - return true; -} - -/* We use a state table to deal with adding symbols from an object - file. The first index into the state table describes the symbol - from the object file. The second index into the state table is the - type of the symbol in the hash table. */ - -/* The symbol from the object file is turned into one of these row - values. */ - -enum link_row -{ - UNDEF_ROW, /* Undefined. */ - UNDEFW_ROW, /* Weak undefined. */ - DEF_ROW, /* Defined. */ - DEFW_ROW, /* Weak defined. */ - COMMON_ROW, /* Common. */ - INDR_ROW, /* Indirect. */ - WARN_ROW, /* Warning. */ - SET_ROW /* Member of set. */ -}; - -/* apparently needed for Hitachi 3050R(HI-UX/WE2)? */ -#undef FAIL - -/* The actions to take in the state table. */ - -enum link_action -{ - FAIL, /* Abort. */ - UND, /* Mark symbol undefined. */ - WEAK, /* Mark symbol weak undefined. */ - DEF, /* Mark symbol defined. */ - DEFW, /* Mark symbol weak defined. */ - COM, /* Mark symbol common. */ - REF, /* Mark defined symbol referenced. */ - CREF, /* Possibly warn about common reference to defined symbol. */ - CDEF, /* Define existing common symbol. */ - NOACT, /* No action. */ - BIG, /* Mark symbol common using largest size. */ - MDEF, /* Multiple definition error. */ - MIND, /* Multiple indirect symbols. */ - IND, /* Make indirect symbol. */ - CIND, /* Make indirect symbol from existing common symbol. */ - SET, /* Add value to set. */ - MWARN, /* Make warning symbol. */ - WARN, /* Issue warning. */ - CWARN, /* Warn if referenced, else MWARN. */ - CYCLE, /* Repeat with symbol pointed to. */ - REFC, /* Mark indirect symbol referenced and then CYCLE. */ - WARNC /* Issue warning and then CYCLE. */ -}; - -/* The state table itself. The first index is a link_row and the - second index is a bfd_link_hash_type. */ - -static const enum link_action link_action[8][8] = -{ - /* current\prev new undef undefw def defw com indr warn */ - /* UNDEF_ROW */ {UND, NOACT, UND, REF, REF, NOACT, REFC, WARNC }, - /* UNDEFW_ROW */ {WEAK, NOACT, NOACT, REF, REF, NOACT, REFC, WARNC }, - /* DEF_ROW */ {DEF, DEF, DEF, MDEF, DEF, CDEF, MDEF, CYCLE }, - /* DEFW_ROW */ {DEFW, DEFW, DEFW, NOACT, NOACT, NOACT, NOACT, CYCLE }, - /* COMMON_ROW */ {COM, COM, COM, CREF, CREF, BIG, CREF, WARNC }, - /* INDR_ROW */ {IND, IND, IND, MDEF, IND, CIND, MIND, CYCLE }, - /* WARN_ROW */ {MWARN, WARN, WARN, CWARN, CWARN, WARN, CWARN, CYCLE }, - /* SET_ROW */ {SET, SET, SET, SET, SET, SET, CYCLE, CYCLE } -}; - -/* Most of the entries in the LINK_ACTION table are straightforward, - but a few are somewhat subtle. - - A reference to an indirect symbol (UNDEF_ROW/indr or - UNDEFW_ROW/indr) is counted as a reference both to the indirect - symbol and to the symbol the indirect symbol points to. - - A reference to a warning symbol (UNDEF_ROW/warn or UNDEFW_ROW/warn) - causes the warning to be issued. - - A common definition of an indirect symbol (COMMON_ROW/indr) is - treated as a multiple definition error. Likewise for an indirect - definition of a common symbol (INDR_ROW/com). - - An indirect definition of a warning (INDR_ROW/warn) does not cause - the warning to be issued. - - If a warning is created for an indirect symbol (WARN_ROW/indr) no - warning is created for the symbol the indirect symbol points to. - - Adding an entry to a set does not count as a reference to a set, - and no warning is issued (SET_ROW/warn). */ - -/* Return the BFD in which a hash entry has been defined, if known. */ - -static bfd * -hash_entry_bfd (h) - struct bfd_link_hash_entry *h; -{ - while (h->type == bfd_link_hash_warning) - h = h->u.i.link; - switch (h->type) - { - default: - return NULL; - case bfd_link_hash_undefined: - case bfd_link_hash_undefweak: - return h->u.undef.abfd; - case bfd_link_hash_defined: - case bfd_link_hash_defweak: - return h->u.def.section->owner; - case bfd_link_hash_common: - return h->u.c.p->section->owner; - } - /*NOTREACHED*/ -} - -/* Add a symbol to the global hash table. - ABFD is the BFD the symbol comes from. - NAME is the name of the symbol. - FLAGS is the BSF_* bits associated with the symbol. - SECTION is the section in which the symbol is defined; this may be - bfd_und_section_ptr or bfd_com_section_ptr. - VALUE is the value of the symbol, relative to the section. - STRING is used for either an indirect symbol, in which case it is - the name of the symbol to indirect to, or a warning symbol, in - which case it is the warning string. - COPY is true if NAME or STRING must be copied into locally - allocated memory if they need to be saved. - COLLECT is true if we should automatically collect gcc constructor - or destructor names as collect2 does. - HASHP, if not NULL, is a place to store the created hash table - entry; if *HASHP is not NULL, the caller has already looked up - the hash table entry, and stored it in *HASHP. */ - -boolean -_bfd_generic_link_add_one_symbol (info, abfd, name, flags, section, value, - string, copy, collect, hashp) - struct bfd_link_info *info; - bfd *abfd; - const char *name; - flagword flags; - asection *section; - bfd_vma value; - const char *string; - boolean copy; - boolean collect; - struct bfd_link_hash_entry **hashp; -{ - enum link_row row; - struct bfd_link_hash_entry *h; - boolean cycle; - - if (bfd_is_ind_section (section) - || (flags & BSF_INDIRECT) != 0) - row = INDR_ROW; - else if ((flags & BSF_WARNING) != 0) - row = WARN_ROW; - else if ((flags & BSF_CONSTRUCTOR) != 0) - row = SET_ROW; - else if (bfd_is_und_section (section)) - { - if ((flags & BSF_WEAK) != 0) - row = UNDEFW_ROW; - else - row = UNDEF_ROW; - } - else if ((flags & BSF_WEAK) != 0) - row = DEFW_ROW; - else if (bfd_is_com_section (section)) - row = COMMON_ROW; - else - row = DEF_ROW; - - if (hashp != NULL && *hashp != NULL) - h = *hashp; - else - { - if (row == UNDEF_ROW || row == UNDEFW_ROW) - h = bfd_wrapped_link_hash_lookup (abfd, info, name, true, copy, false); - else - h = bfd_link_hash_lookup (info->hash, name, true, copy, false); - if (h == NULL) - { - if (hashp != NULL) - *hashp = NULL; - return false; - } - } - - if (info->notice_hash != (struct bfd_hash_table *) NULL - && (bfd_hash_lookup (info->notice_hash, name, false, false) - != (struct bfd_hash_entry *) NULL)) - { - if (! (*info->callbacks->notice) (info, name, abfd, section, value)) - return false; - } - - if (hashp != (struct bfd_link_hash_entry **) NULL) - *hashp = h; - - do - { - enum link_action action; - - cycle = false; - action = link_action[(int) row][(int) h->type]; - switch (action) - { - case FAIL: - abort (); - - case NOACT: - /* Do nothing. */ - break; - - case UND: - /* Make a new undefined symbol. */ - h->type = bfd_link_hash_undefined; - h->u.undef.abfd = abfd; - bfd_link_add_undef (info->hash, h); - break; - - case WEAK: - /* Make a new weak undefined symbol. */ - h->type = bfd_link_hash_undefweak; - h->u.undef.abfd = abfd; - break; - - case CDEF: - /* We have found a definition for a symbol which was - previously common. */ - BFD_ASSERT (h->type == bfd_link_hash_common); - if (! ((*info->callbacks->multiple_common) - (info, name, - h->u.c.p->section->owner, bfd_link_hash_common, h->u.c.size, - abfd, bfd_link_hash_defined, (bfd_vma) 0))) - return false; - /* Fall through. */ - case DEF: - case DEFW: - { - enum bfd_link_hash_type oldtype; - - /* Define a symbol. */ - oldtype = h->type; - if (action == DEFW) - h->type = bfd_link_hash_defweak; - else - h->type = bfd_link_hash_defined; - h->u.def.section = section; - h->u.def.value = value; - - /* If we have been asked to, we act like collect2 and - identify all functions that might be global - constructors and destructors and pass them up in a - callback. We only do this for certain object file - types, since many object file types can handle this - automatically. */ - if (collect && name[0] == '_') - { - const char *s; - - /* A constructor or destructor name starts like this: - _+GLOBAL_[_.$][ID][_.$] where the first [_.$] and - the second are the same character (we accept any - character there, in case a new object file format - comes along with even worse naming restrictions). */ - -#define CONS_PREFIX "GLOBAL_" -#define CONS_PREFIX_LEN (sizeof CONS_PREFIX - 1) - - s = name + 1; - while (*s == '_') - ++s; - if (s[0] == 'G' - && strncmp (s, CONS_PREFIX, CONS_PREFIX_LEN - 1) == 0) - { - char c; - - c = s[CONS_PREFIX_LEN + 1]; - if ((c == 'I' || c == 'D') - && s[CONS_PREFIX_LEN] == s[CONS_PREFIX_LEN + 2]) - { - /* If this is a definition of a symbol which - was previously weakly defined, we are in - trouble. We have already added a - constructor entry for the weak defined - symbol, and now we are trying to add one - for the new symbol. Fortunately, this case - should never arise in practice. */ - if (oldtype == bfd_link_hash_defweak) - abort (); - - if (! ((*info->callbacks->constructor) - (info, - c == 'I' ? true : false, - name, abfd, section, value))) - return false; - } - } - } - } - - break; - - case COM: - /* We have found a common definition for a symbol. */ - if (h->type == bfd_link_hash_new) - bfd_link_add_undef (info->hash, h); - h->type = bfd_link_hash_common; - h->u.c.p = - ((struct bfd_link_hash_common_entry *) - bfd_hash_allocate (&info->hash->table, - sizeof (struct bfd_link_hash_common_entry))); - if (h->u.c.p == NULL) - return false; - - h->u.c.size = value; - - /* Select a default alignment based on the size. This may - be overridden by the caller. */ - { - unsigned int power; - - power = bfd_log2 (value); - if (power > 4) - power = 4; - h->u.c.p->alignment_power = power; - } - - /* The section of a common symbol is only used if the common - symbol is actually allocated. It basically provides a - hook for the linker script to decide which output section - the common symbols should be put in. In most cases, the - section of a common symbol will be bfd_com_section_ptr, - the code here will choose a common symbol section named - "COMMON", and the linker script will contain *(COMMON) in - the appropriate place. A few targets use separate common - sections for small symbols, and they require special - handling. */ - if (section == bfd_com_section_ptr) - { - h->u.c.p->section = bfd_make_section_old_way (abfd, "COMMON"); - h->u.c.p->section->flags = SEC_ALLOC; - } - else if (section->owner != abfd) - { - h->u.c.p->section = bfd_make_section_old_way (abfd, - section->name); - h->u.c.p->section->flags = SEC_ALLOC; - } - else - h->u.c.p->section = section; - break; - - case REF: - /* A reference to a defined symbol. */ - if (h->next == NULL && info->hash->undefs_tail != h) - h->next = h; - break; - - case BIG: - /* We have found a common definition for a symbol which - already had a common definition. Use the maximum of the - two sizes. */ - BFD_ASSERT (h->type == bfd_link_hash_common); - if (! ((*info->callbacks->multiple_common) - (info, name, - h->u.c.p->section->owner, bfd_link_hash_common, h->u.c.size, - abfd, bfd_link_hash_common, value))) - return false; - if (value > h->u.c.size) - { - unsigned int power; - - h->u.c.size = value; - - /* Select a default alignment based on the size. This may - be overridden by the caller. */ - power = bfd_log2 (value); - if (power > 4) - power = 4; - h->u.c.p->alignment_power = power; - } - break; - - case CREF: - { - bfd *obfd; - - /* We have found a common definition for a symbol which - was already defined. FIXME: It would nice if we could - report the BFD which defined an indirect symbol, but we - don't have anywhere to store the information. */ - if (h->type == bfd_link_hash_defined - || h->type == bfd_link_hash_defweak) - obfd = h->u.def.section->owner; - else - obfd = NULL; - if (! ((*info->callbacks->multiple_common) - (info, name, obfd, h->type, (bfd_vma) 0, - abfd, bfd_link_hash_common, value))) - return false; - } - break; - - case MIND: - /* Multiple indirect symbols. This is OK if they both point - to the same symbol. */ - if (strcmp (h->u.i.link->root.string, string) == 0) - break; - /* Fall through. */ - case MDEF: - /* Handle a multiple definition. */ - { - asection *msec; - bfd_vma mval; - - 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; - - if (! ((*info->callbacks->multiple_definition) - (info, name, msec->owner, msec, mval, abfd, section, - value))) - return false; - } - break; - - case CIND: - /* Create an indirect symbol from an existing common symbol. */ - BFD_ASSERT (h->type == bfd_link_hash_common); - if (! ((*info->callbacks->multiple_common) - (info, name, - h->u.c.p->section->owner, bfd_link_hash_common, h->u.c.size, - abfd, bfd_link_hash_indirect, (bfd_vma) 0))) - return false; - /* Fall through. */ - case IND: - /* Create an indirect symbol. */ - { - struct bfd_link_hash_entry *inh; - - /* STRING is the name of the symbol we want to indirect - to. */ - inh = bfd_wrapped_link_hash_lookup (abfd, info, string, true, - copy, false); - if (inh == (struct bfd_link_hash_entry *) NULL) - return false; - if (inh->type == bfd_link_hash_new) - { - inh->type = bfd_link_hash_undefined; - inh->u.undef.abfd = abfd; - bfd_link_add_undef (info->hash, inh); - } - - /* If the indirect symbol has been referenced, we need to - push the reference down to the symbol we are - referencing. */ - if (h->type != bfd_link_hash_new) - { - row = UNDEF_ROW; - cycle = true; - } - - h->type = bfd_link_hash_indirect; - h->u.i.link = inh; - } - break; - - case SET: - /* Add an entry to a set. */ - if (! (*info->callbacks->add_to_set) (info, h, BFD_RELOC_CTOR, - abfd, section, value)) - return false; - break; - - case WARNC: - /* Issue a warning and cycle. */ - if (h->u.i.warning != NULL) - { - if (! (*info->callbacks->warning) (info, h->u.i.warning, name, - abfd, (asection *) NULL, - (bfd_vma) 0)) - return false; - /* Only issue a warning once. */ - h->u.i.warning = NULL; - } - /* Fall through. */ - case CYCLE: - /* Try again with the referenced symbol. */ - h = h->u.i.link; - cycle = true; - break; - - case REFC: - /* A reference to an indirect symbol. */ - if (h->next == NULL && info->hash->undefs_tail != h) - h->next = h; - h = h->u.i.link; - cycle = true; - break; - - case WARN: - /* Issue a warning. */ - if (! (*info->callbacks->warning) (info, string, name, - hash_entry_bfd (h), - (asection *) NULL, (bfd_vma) 0)) - return false; - break; - - case CWARN: - /* Warn if this symbol has been referenced already, - otherwise add a warning. A symbol has been referenced if - the next field is not NULL, or it is the tail of the - undefined symbol list. The REF case above helps to - ensure this. */ - if (h->next != NULL || info->hash->undefs_tail == h) - { - if (! (*info->callbacks->warning) (info, string, name, - hash_entry_bfd (h), - (asection *) NULL, - (bfd_vma) 0)) - return false; - break; - } - /* Fall through. */ - case MWARN: - /* Make a warning symbol. */ - { - struct bfd_link_hash_entry *sub; - - /* STRING is the warning to give. */ - sub = ((struct bfd_link_hash_entry *) - ((*info->hash->table.newfunc) - ((struct bfd_hash_entry *) NULL, &info->hash->table, - h->root.string))); - if (sub == NULL) - return false; - *sub = *h; - sub->type = bfd_link_hash_warning; - sub->u.i.link = h; - if (! copy) - sub->u.i.warning = string; - else - { - char *w; - - w = bfd_hash_allocate (&info->hash->table, - strlen (string) + 1); - if (w == NULL) - return false; - strcpy (w, string); - sub->u.i.warning = w; - } - - bfd_hash_replace (&info->hash->table, - (struct bfd_hash_entry *) h, - (struct bfd_hash_entry *) sub); - if (hashp != NULL) - *hashp = sub; - } - break; - } - } - while (cycle); - - return true; -} - -/* Generic final link routine. */ - -boolean -_bfd_generic_final_link (abfd, info) - bfd *abfd; - struct bfd_link_info *info; -{ - bfd *sub; - asection *o; - struct bfd_link_order *p; - size_t outsymalloc; - struct generic_write_global_symbol_info wginfo; - - abfd->outsymbols = (asymbol **) NULL; - abfd->symcount = 0; - outsymalloc = 0; - - /* Build the output symbol table. */ - for (sub = info->input_bfds; sub != (bfd *) NULL; sub = sub->link_next) - if (! _bfd_generic_link_output_symbols (abfd, sub, info, &outsymalloc)) - return false; - - /* Accumulate the global symbols. */ - wginfo.info = info; - wginfo.output_bfd = abfd; - wginfo.psymalloc = &outsymalloc; - _bfd_generic_link_hash_traverse (_bfd_generic_hash_table (info), - _bfd_generic_link_write_global_symbol, - (PTR) &wginfo); - - if (info->relocateable) - { - /* Allocate space for the output relocs for each section. */ - for (o = abfd->sections; - o != (asection *) NULL; - o = o->next) - { - o->reloc_count = 0; - for (p = o->link_order_head; - p != (struct bfd_link_order *) NULL; - p = p->next) - { - if (p->type == bfd_section_reloc_link_order - || p->type == bfd_symbol_reloc_link_order) - ++o->reloc_count; - else if (p->type == bfd_indirect_link_order) - { - asection *input_section; - bfd *input_bfd; - long relsize; - arelent **relocs; - asymbol **symbols; - long reloc_count; - - input_section = p->u.indirect.section; - input_bfd = input_section->owner; - relsize = bfd_get_reloc_upper_bound (input_bfd, - input_section); - if (relsize < 0) - return false; - relocs = (arelent **) bfd_malloc ((size_t) relsize); - if (!relocs && relsize != 0) - return false; - symbols = _bfd_generic_link_get_symbols (input_bfd); - reloc_count = bfd_canonicalize_reloc (input_bfd, - input_section, - relocs, - symbols); - if (reloc_count < 0) - return false; - BFD_ASSERT ((unsigned long) reloc_count - == input_section->reloc_count); - o->reloc_count += reloc_count; - free (relocs); - } - } - if (o->reloc_count > 0) - { - o->orelocation = ((arelent **) - bfd_alloc (abfd, - (o->reloc_count - * sizeof (arelent *)))); - if (!o->orelocation) - return false; - o->flags |= SEC_RELOC; - /* Reset the count so that it can be used as an index - when putting in the output relocs. */ - o->reloc_count = 0; - } - } - } - - /* Handle all the link order information for the sections. */ - for (o = abfd->sections; - o != (asection *) NULL; - o = o->next) - { - for (p = o->link_order_head; - p != (struct bfd_link_order *) NULL; - p = p->next) - { - switch (p->type) - { - case bfd_section_reloc_link_order: - case bfd_symbol_reloc_link_order: - if (! _bfd_generic_reloc_link_order (abfd, info, o, p)) - return false; - break; - case bfd_indirect_link_order: - if (! default_indirect_link_order (abfd, info, o, p, true)) - return false; - break; - default: - if (! _bfd_default_link_order (abfd, info, o, p)) - return false; - break; - } - } - } - - return true; -} - -/* Add an output symbol to the output BFD. */ - -static boolean -generic_add_output_symbol (output_bfd, psymalloc, sym) - bfd *output_bfd; - size_t *psymalloc; - asymbol *sym; -{ - if (output_bfd->symcount >= *psymalloc) - { - asymbol **newsyms; - - if (*psymalloc == 0) - *psymalloc = 124; - else - *psymalloc *= 2; - newsyms = (asymbol **) bfd_realloc (output_bfd->outsymbols, - *psymalloc * sizeof (asymbol *)); - if (newsyms == (asymbol **) NULL) - return false; - output_bfd->outsymbols = newsyms; - } - - output_bfd->outsymbols[output_bfd->symcount] = sym; - ++output_bfd->symcount; - - return true; -} - -/* Handle the symbols for an input BFD. */ - -boolean -_bfd_generic_link_output_symbols (output_bfd, input_bfd, info, psymalloc) - bfd *output_bfd; - bfd *input_bfd; - struct bfd_link_info *info; - size_t *psymalloc; -{ - asymbol **sym_ptr; - asymbol **sym_end; - - if (! generic_link_read_symbols (input_bfd)) - return false; - - /* Create a filename symbol if we are supposed to. */ - if (info->create_object_symbols_section != (asection *) NULL) - { - asection *sec; - - for (sec = input_bfd->sections; - sec != (asection *) NULL; - sec = sec->next) - { - if (sec->output_section == info->create_object_symbols_section) - { - asymbol *newsym; - - newsym = bfd_make_empty_symbol (input_bfd); - if (!newsym) - return false; - newsym->name = input_bfd->filename; - newsym->value = 0; - newsym->flags = BSF_LOCAL | BSF_FILE; - newsym->section = sec; - - if (! generic_add_output_symbol (output_bfd, psymalloc, - newsym)) - return false; - - break; - } - } - } - - /* Adjust the values of the globally visible symbols, and write out - local symbols. */ - sym_ptr = _bfd_generic_link_get_symbols (input_bfd); - sym_end = sym_ptr + _bfd_generic_link_get_symcount (input_bfd); - for (; sym_ptr < sym_end; sym_ptr++) - { - asymbol *sym; - struct generic_link_hash_entry *h; - boolean output; - - h = (struct generic_link_hash_entry *) NULL; - sym = *sym_ptr; - if ((sym->flags & (BSF_INDIRECT - | BSF_WARNING - | BSF_GLOBAL - | BSF_CONSTRUCTOR - | BSF_WEAK)) != 0 - || bfd_is_und_section (bfd_get_section (sym)) - || bfd_is_com_section (bfd_get_section (sym)) - || bfd_is_ind_section (bfd_get_section (sym))) - { - if (sym->udata.p != NULL) - h = (struct generic_link_hash_entry *) sym->udata.p; - else if ((sym->flags & BSF_CONSTRUCTOR) != 0) - { - /* This case normally means that the main linker code - deliberately ignored this constructor symbol. We - should just pass it through. This will screw up if - the constructor symbol is from a different, - non-generic, object file format, but the case will - only arise when linking with -r, which will probably - fail anyhow, since there will be no way to represent - the relocs in the output format being used. */ - h = NULL; - } - else if (bfd_is_und_section (bfd_get_section (sym))) - h = ((struct generic_link_hash_entry *) - bfd_wrapped_link_hash_lookup (output_bfd, info, - bfd_asymbol_name (sym), - false, false, true)); - else - h = _bfd_generic_link_hash_lookup (_bfd_generic_hash_table (info), - bfd_asymbol_name (sym), - false, false, true); - - if (h != (struct generic_link_hash_entry *) NULL) - { - /* Force all references to this symbol to point to - the same area in memory. It is possible that - this routine will be called with a hash table - other than a generic hash table, so we double - check that. */ - if (info->hash->creator == input_bfd->xvec) - { - if (h->sym != (asymbol *) NULL) - *sym_ptr = sym = h->sym; - } - - switch (h->root.type) - { - default: - case bfd_link_hash_new: - abort (); - case bfd_link_hash_undefined: - break; - case bfd_link_hash_undefweak: - sym->flags |= BSF_WEAK; - break; - case bfd_link_hash_indirect: - h = (struct generic_link_hash_entry *) h->root.u.i.link; - /* fall through */ - case bfd_link_hash_defined: - sym->flags |= BSF_GLOBAL; - sym->flags &=~ BSF_CONSTRUCTOR; - sym->value = h->root.u.def.value; - sym->section = h->root.u.def.section; - break; - case bfd_link_hash_defweak: - sym->flags |= BSF_WEAK; - sym->flags &=~ BSF_CONSTRUCTOR; - sym->value = h->root.u.def.value; - sym->section = h->root.u.def.section; - break; - case bfd_link_hash_common: - sym->value = h->root.u.c.size; - sym->flags |= BSF_GLOBAL; - if (! bfd_is_com_section (sym->section)) - { - BFD_ASSERT (bfd_is_und_section (sym->section)); - sym->section = bfd_com_section_ptr; - } - /* We do not set the section of the symbol to - h->root.u.c.p->section. That value was saved so - that we would know where to allocate the symbol - if it was defined. In this case the type is - still bfd_link_hash_common, so we did not define - it, so we do not want to use that section. */ - break; - } - } - } - - /* This switch is straight from the old code in - write_file_locals in ldsym.c. */ - if (info->strip == strip_some - && (bfd_hash_lookup (info->keep_hash, bfd_asymbol_name (sym), - false, false) - == (struct bfd_hash_entry *) NULL)) - output = false; - else if ((sym->flags & (BSF_GLOBAL | BSF_WEAK)) != 0) - { - /* If this symbol is marked as occurring now, rather - than at the end, output it now. This is used for - COFF C_EXT FCN symbols. FIXME: There must be a - better way. */ - if (bfd_asymbol_bfd (sym) == input_bfd - && (sym->flags & BSF_NOT_AT_END) != 0) - output = true; - else - output = false; - } - else if (bfd_is_ind_section (sym->section)) - output = false; - else if ((sym->flags & BSF_DEBUGGING) != 0) - { - if (info->strip == strip_none) - output = true; - else - output = false; - } - else if (bfd_is_und_section (sym->section) - || bfd_is_com_section (sym->section)) - output = false; - else if ((sym->flags & BSF_LOCAL) != 0) - { - if ((sym->flags & BSF_WARNING) != 0) - output = false; - else - { - switch (info->discard) - { - default: - case discard_all: - output = false; - break; - case discard_l: - if (bfd_asymbol_name (sym)[0] == info->lprefix[0] - && (info->lprefix_len == 1 - || strncmp (bfd_asymbol_name (sym), info->lprefix, - info->lprefix_len) == 0)) - output = false; - else - output = true; - break; - case discard_none: - output = true; - break; - } - } - } - else if ((sym->flags & BSF_CONSTRUCTOR)) - { - if (info->strip != strip_all) - output = true; - else - output = false; - } - else - abort (); - - if (output) - { - if (! generic_add_output_symbol (output_bfd, psymalloc, sym)) - return false; - if (h != (struct generic_link_hash_entry *) NULL) - h->written = true; - } - } - - return true; -} - -/* Set the section and value of a generic BFD symbol based on a linker - hash table entry. */ - -static void -set_symbol_from_hash (sym, h) - asymbol *sym; - struct bfd_link_hash_entry *h; -{ - switch (h->type) - { - default: - abort (); - break; - case bfd_link_hash_new: - /* This can happen when a constructor symbol is seen but we are - not building constructors. */ - if (sym->section != NULL) - { - BFD_ASSERT ((sym->flags & BSF_CONSTRUCTOR) != 0); - } - else - { - sym->flags |= BSF_CONSTRUCTOR; - sym->section = bfd_abs_section_ptr; - sym->value = 0; - } - break; - case bfd_link_hash_undefined: - sym->section = bfd_und_section_ptr; - sym->value = 0; - break; - case bfd_link_hash_undefweak: - sym->section = bfd_und_section_ptr; - sym->value = 0; - sym->flags |= BSF_WEAK; - break; - case bfd_link_hash_defined: - sym->section = h->u.def.section; - sym->value = h->u.def.value; - break; - case bfd_link_hash_defweak: - sym->flags |= BSF_WEAK; - sym->section = h->u.def.section; - sym->value = h->u.def.value; - break; - case bfd_link_hash_common: - sym->value = h->u.c.size; - if (sym->section == NULL) - sym->section = bfd_com_section_ptr; - else if (! bfd_is_com_section (sym->section)) - { - BFD_ASSERT (bfd_is_und_section (sym->section)); - sym->section = bfd_com_section_ptr; - } - /* Do not set the section; see _bfd_generic_link_output_symbols. */ - break; - case bfd_link_hash_indirect: - case bfd_link_hash_warning: - /* FIXME: What should we do here? */ - break; - } -} - -/* Write out a global symbol, if it hasn't already been written out. - This is called for each symbol in the hash table. */ - -boolean -_bfd_generic_link_write_global_symbol (h, data) - struct generic_link_hash_entry *h; - PTR data; -{ - struct generic_write_global_symbol_info *wginfo = - (struct generic_write_global_symbol_info *) data; - asymbol *sym; - - if (h->written) - return true; - - h->written = true; - - if (wginfo->info->strip == strip_all - || (wginfo->info->strip == strip_some - && bfd_hash_lookup (wginfo->info->keep_hash, h->root.root.string, - false, false) == NULL)) - return true; - - if (h->sym != (asymbol *) NULL) - sym = h->sym; - else - { - sym = bfd_make_empty_symbol (wginfo->output_bfd); - if (!sym) - return false; - sym->name = h->root.root.string; - sym->flags = 0; - } - - set_symbol_from_hash (sym, &h->root); - - sym->flags |= BSF_GLOBAL; - - if (! generic_add_output_symbol (wginfo->output_bfd, wginfo->psymalloc, - sym)) - { - /* FIXME: No way to return failure. */ - abort (); - } - - return true; -} - -/* Create a relocation. */ - -boolean -_bfd_generic_reloc_link_order (abfd, info, sec, link_order) - bfd *abfd; - struct bfd_link_info *info; - asection *sec; - struct bfd_link_order *link_order; -{ - arelent *r; - - if (! info->relocateable) - abort (); - if (sec->orelocation == (arelent **) NULL) - abort (); - - r = (arelent *) bfd_alloc (abfd, sizeof (arelent)); - if (r == (arelent *) NULL) - return false; - - r->address = link_order->offset; - r->howto = bfd_reloc_type_lookup (abfd, link_order->u.reloc.p->reloc); - if (r->howto == 0) - { - bfd_set_error (bfd_error_bad_value); - return false; - } - - /* Get the symbol to use for the relocation. */ - if (link_order->type == bfd_section_reloc_link_order) - r->sym_ptr_ptr = link_order->u.reloc.p->u.section->symbol_ptr_ptr; - else - { - struct generic_link_hash_entry *h; - - h = ((struct generic_link_hash_entry *) - bfd_wrapped_link_hash_lookup (abfd, info, - link_order->u.reloc.p->u.name, - false, false, true)); - if (h == (struct generic_link_hash_entry *) NULL - || ! h->written) - { - if (! ((*info->callbacks->unattached_reloc) - (info, link_order->u.reloc.p->u.name, - (bfd *) NULL, (asection *) NULL, (bfd_vma) 0))) - return false; - bfd_set_error (bfd_error_bad_value); - return false; - } - r->sym_ptr_ptr = &h->sym; - } - - /* If this is an inplace reloc, write the addend to the object file. - Otherwise, store it in the reloc addend. */ - if (! r->howto->partial_inplace) - r->addend = link_order->u.reloc.p->addend; - else - { - bfd_size_type size; - bfd_reloc_status_type rstat; - bfd_byte *buf; - boolean ok; - - size = bfd_get_reloc_size (r->howto); - buf = (bfd_byte *) bfd_zmalloc (size); - if (buf == (bfd_byte *) NULL) - return false; - rstat = _bfd_relocate_contents (r->howto, abfd, - link_order->u.reloc.p->addend, buf); - switch (rstat) - { - case bfd_reloc_ok: - break; - default: - case bfd_reloc_outofrange: - abort (); - case bfd_reloc_overflow: - if (! ((*info->callbacks->reloc_overflow) - (info, - (link_order->type == bfd_section_reloc_link_order - ? bfd_section_name (abfd, link_order->u.reloc.p->u.section) - : link_order->u.reloc.p->u.name), - r->howto->name, link_order->u.reloc.p->addend, - (bfd *) NULL, (asection *) NULL, (bfd_vma) 0))) - { - free (buf); - return false; - } - break; - } - ok = bfd_set_section_contents (abfd, sec, (PTR) buf, - (file_ptr) link_order->offset, size); - free (buf); - if (! ok) - return false; - - r->addend = 0; - } - - sec->orelocation[sec->reloc_count] = r; - ++sec->reloc_count; - - return true; -} - -/* Allocate a new link_order for a section. */ - -struct bfd_link_order * -bfd_new_link_order (abfd, section) - bfd *abfd; - asection *section; -{ - struct bfd_link_order *new; - - new = ((struct bfd_link_order *) - bfd_alloc_by_size_t (abfd, sizeof (struct bfd_link_order))); - if (!new) - return NULL; - - new->type = bfd_undefined_link_order; - new->offset = 0; - new->size = 0; - new->next = (struct bfd_link_order *) NULL; - - if (section->link_order_tail != (struct bfd_link_order *) NULL) - section->link_order_tail->next = new; - else - section->link_order_head = new; - section->link_order_tail = new; - - return new; -} - -/* Default link order processing routine. Note that we can not handle - the reloc_link_order types here, since they depend upon the details - of how the particular backends generates relocs. */ - -boolean -_bfd_default_link_order (abfd, info, sec, link_order) - bfd *abfd; - struct bfd_link_info *info; - asection *sec; - struct bfd_link_order *link_order; -{ - switch (link_order->type) - { - case bfd_undefined_link_order: - case bfd_section_reloc_link_order: - case bfd_symbol_reloc_link_order: - default: - abort (); - case bfd_indirect_link_order: - return default_indirect_link_order (abfd, info, sec, link_order, - false); - case bfd_fill_link_order: - return default_fill_link_order (abfd, info, sec, link_order); - case bfd_data_link_order: - return bfd_set_section_contents (abfd, sec, - (PTR) link_order->u.data.contents, - (file_ptr) link_order->offset, - link_order->size); - } -} - -/* Default routine to handle a bfd_fill_link_order. */ - -/*ARGSUSED*/ -static boolean -default_fill_link_order (abfd, info, sec, link_order) - bfd *abfd; - struct bfd_link_info *info; - asection *sec; - struct bfd_link_order *link_order; -{ - size_t size; - char *space; - size_t i; - int fill; - boolean result; - - BFD_ASSERT ((sec->flags & SEC_HAS_CONTENTS) != 0); - - size = (size_t) link_order->size; - space = (char *) bfd_malloc (size); - if (space == NULL && size != 0) - return false; - - fill = link_order->u.fill.value; - for (i = 0; i < size; i += 2) - space[i] = fill >> 8; - for (i = 1; i < size; i += 2) - space[i] = fill; - result = bfd_set_section_contents (abfd, sec, space, - (file_ptr) link_order->offset, - link_order->size); - free (space); - return result; -} - -/* Default routine to handle a bfd_indirect_link_order. */ - -static boolean -default_indirect_link_order (output_bfd, info, output_section, link_order, - generic_linker) - bfd *output_bfd; - struct bfd_link_info *info; - asection *output_section; - struct bfd_link_order *link_order; - boolean generic_linker; -{ - asection *input_section; - bfd *input_bfd; - bfd_byte *contents = NULL; - bfd_byte *new_contents; - - BFD_ASSERT ((output_section->flags & SEC_HAS_CONTENTS) != 0); - - if (link_order->size == 0) - return true; - - input_section = link_order->u.indirect.section; - input_bfd = input_section->owner; - - BFD_ASSERT (input_section->output_section == output_section); - BFD_ASSERT (input_section->output_offset == link_order->offset); - BFD_ASSERT (input_section->_cooked_size == link_order->size); - - if (info->relocateable - && input_section->reloc_count > 0 - && output_section->orelocation == (arelent **) NULL) - { - /* Space has not been allocated for the output relocations. - This can happen when we are called by a specific backend - because somebody is attempting to link together different - types of object files. Handling this case correctly is - difficult, and sometimes impossible. */ - abort (); - } - - if (! generic_linker) - { - asymbol **sympp; - asymbol **symppend; - - /* Get the canonical symbols. The generic linker will always - have retrieved them by this point, but we are being called by - a specific linker, presumably because we are linking - different types of object files together. */ - if (! generic_link_read_symbols (input_bfd)) - return false; - - /* Since we have been called by a specific linker, rather than - the generic linker, the values of the symbols will not be - right. They will be the values as seen in the input file, - not the values of the final link. We need to fix them up - before we can relocate the section. */ - sympp = _bfd_generic_link_get_symbols (input_bfd); - symppend = sympp + _bfd_generic_link_get_symcount (input_bfd); - for (; sympp < symppend; sympp++) - { - asymbol *sym; - struct bfd_link_hash_entry *h; - - sym = *sympp; - - if ((sym->flags & (BSF_INDIRECT - | BSF_WARNING - | BSF_GLOBAL - | BSF_CONSTRUCTOR - | BSF_WEAK)) != 0 - || bfd_is_und_section (bfd_get_section (sym)) - || bfd_is_com_section (bfd_get_section (sym)) - || bfd_is_ind_section (bfd_get_section (sym))) - { - /* sym->udata may have been set by - generic_link_add_symbol_list. */ - if (sym->udata.p != NULL) - h = (struct bfd_link_hash_entry *) sym->udata.p; - else if (bfd_is_und_section (bfd_get_section (sym))) - h = bfd_wrapped_link_hash_lookup (output_bfd, info, - bfd_asymbol_name (sym), - false, false, true); - else - h = bfd_link_hash_lookup (info->hash, - bfd_asymbol_name (sym), - false, false, true); - if (h != NULL) - set_symbol_from_hash (sym, h); - } - } - } - - /* Get and relocate the section contents. */ - contents = ((bfd_byte *) - bfd_malloc (bfd_section_size (input_bfd, input_section))); - if (contents == NULL && bfd_section_size (input_bfd, input_section) != 0) - goto error_return; - new_contents = (bfd_get_relocated_section_contents - (output_bfd, info, link_order, contents, info->relocateable, - _bfd_generic_link_get_symbols (input_bfd))); - if (!new_contents) - goto error_return; - - /* Output the section contents. */ - if (! bfd_set_section_contents (output_bfd, output_section, - (PTR) new_contents, - link_order->offset, link_order->size)) - goto error_return; - - if (contents != NULL) - free (contents); - return true; - - error_return: - if (contents != NULL) - free (contents); - return false; -} - -/* A little routine to count the number of relocs in a link_order - list. */ - -unsigned int -_bfd_count_link_order_relocs (link_order) - struct bfd_link_order *link_order; -{ - register unsigned int c; - register struct bfd_link_order *l; - - c = 0; - for (l = link_order; l != (struct bfd_link_order *) NULL; l = l->next) - { - if (l->type == bfd_section_reloc_link_order - || l->type == bfd_symbol_reloc_link_order) - ++c; - } - - return c; -} - -/* -FUNCTION - bfd_link_split_section - -SYNOPSIS - boolean bfd_link_split_section(bfd *abfd, asection *sec); - -DESCRIPTION - Return nonzero if @var{sec} should be split during a - reloceatable or final link. - -.#define bfd_link_split_section(abfd, sec) \ -. BFD_SEND (abfd, _bfd_link_split_section, (abfd, sec)) -. - -*/ - - - -boolean -_bfd_generic_link_split_section (abfd, sec) - bfd *abfd; - asection *sec; -{ - return false; -} diff --git a/contrib/gdb/bfd/opncls.c b/contrib/gdb/bfd/opncls.c deleted file mode 100644 index 54528db..0000000 --- a/contrib/gdb/bfd/opncls.c +++ /dev/null @@ -1,604 +0,0 @@ -/* opncls.c -- open and close a BFD. - Copyright (C) 1990 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. - Written by Cygnus Support. - -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 "obstack.h" - -#ifndef S_IXUSR -#define S_IXUSR 0100 /* Execute by owner. */ -#endif -#ifndef S_IXGRP -#define S_IXGRP 0010 /* Execute by group. */ -#endif -#ifndef S_IXOTH -#define S_IXOTH 0001 /* Execute by others. */ -#endif - -/* fdopen is a loser -- we should use stdio exclusively. Unfortunately - if we do that we can't use fcntl. */ - - -#define obstack_chunk_alloc malloc -#define obstack_chunk_free free - -#ifndef HAVE_GETPAGESIZE -#define getpagesize() 2048 -#endif - -long _bfd_chunksize = -1; - -/* Return a new BFD. All BFD's are allocated through this routine. */ - -bfd * -_bfd_new_bfd () -{ - bfd *nbfd; - - nbfd = (bfd *)bfd_zmalloc (sizeof (bfd)); - if (!nbfd) - return 0; - - if (_bfd_chunksize <= 0) - { - _bfd_chunksize = getpagesize (); - if (_bfd_chunksize <= 0) - _bfd_chunksize = 2048; - /* Leave some slush space, since many malloc implementations - prepend a header, and may wind up wasting another page - because of it. */ - _bfd_chunksize -= 32; - } - - if (!obstack_begin(&nbfd->memory, _bfd_chunksize)) - { - bfd_set_error (bfd_error_no_memory); - return 0; - } - - nbfd->arch_info = &bfd_default_arch_struct; - - nbfd->direction = no_direction; - nbfd->iostream = NULL; - nbfd->where = 0; - nbfd->sections = (asection *)NULL; - nbfd->format = bfd_unknown; - nbfd->my_archive = (bfd *)NULL; - nbfd->origin = 0; - nbfd->opened_once = false; - nbfd->output_has_begun = false; - nbfd->section_count = 0; - nbfd->usrdata = (PTR)NULL; - nbfd->cacheable = false; - nbfd->flags = NO_FLAGS; - nbfd->mtime_set = false; - - return nbfd; -} - -/* Allocate a new BFD as a member of archive OBFD. */ - -bfd * -_bfd_new_bfd_contained_in (obfd) - bfd *obfd; -{ - bfd *nbfd; - - nbfd = _bfd_new_bfd(); - nbfd->xvec = obfd->xvec; - nbfd->my_archive = obfd; - nbfd->direction = read_direction; - nbfd->target_defaulted = obfd->target_defaulted; - return nbfd; -} - -/* -SECTION - Opening and closing BFDs - -*/ - -/* -FUNCTION - bfd_openr - -SYNOPSIS - bfd *bfd_openr(CONST char *filename, CONST char *target); - -DESCRIPTION - Open the file @var{filename} (using <>) with the target - @var{target}. Return a pointer to the created BFD. - - Calls <>, so @var{target} is interpreted as by - that function. - - If <> is returned then an error has occured. Possible errors - are <>, <> or <> error. -*/ - -bfd * -bfd_openr (filename, target) - CONST char *filename; - CONST char *target; -{ - bfd *nbfd; - const bfd_target *target_vec; - - nbfd = _bfd_new_bfd(); - if (nbfd == NULL) - return NULL; - - target_vec = bfd_find_target (target, nbfd); - if (target_vec == NULL) { - bfd_set_error (bfd_error_invalid_target); - return NULL; - } - - nbfd->filename = filename; - nbfd->direction = read_direction; - - if (bfd_open_file (nbfd) == NULL) { - bfd_set_error (bfd_error_system_call); /* File didn't exist, or some such */ - bfd_release(nbfd,0); - return NULL; - } - return nbfd; -} - - -/* Don't try to `optimize' this function: - - o - We lock using stack space so that interrupting the locking - won't cause a storage leak. - o - We open the file stream last, since we don't want to have to - close it if anything goes wrong. Closing the stream means closing - the file descriptor too, even though we didn't open it. - */ -/* -FUNCTION - bfd_fdopenr - -SYNOPSIS - bfd *bfd_fdopenr(CONST char *filename, CONST char *target, int fd); - -DESCRIPTION - <> is to <> much like <> is to <>. - It opens a BFD on a file already described by the @var{fd} - supplied. - - When the file is later <>d, the file descriptor will be closed. - - If the caller desires that this file descriptor be cached by BFD - (opened as needed, closed as needed to free descriptors for - other opens), with the supplied @var{fd} used as an initial - file descriptor (but subject to closure at any time), call - bfd_set_cacheable(bfd, 1) on the returned BFD. The default is to - assume no cacheing; the file descriptor will remain open until - <>, and will not be affected by BFD operations on other - files. - - Possible errors are <>, <> and <>. -*/ - -bfd * -bfd_fdopenr (filename, target, fd) - CONST char *filename; - CONST char *target; - int fd; -{ - bfd *nbfd; - const bfd_target *target_vec; - int fdflags; - - bfd_set_error (bfd_error_system_call); -#if ! defined(HAVE_FCNTL) || ! defined(F_GETFL) - fdflags = O_RDWR; /* Assume full access */ -#else - fdflags = fcntl (fd, F_GETFL, NULL); -#endif - if (fdflags == -1) return NULL; - - nbfd = _bfd_new_bfd(); - - if (nbfd == NULL) - return NULL; - - target_vec = bfd_find_target (target, nbfd); - if (target_vec == NULL) { - bfd_set_error (bfd_error_invalid_target); - return NULL; - } -#if defined(VMS) || defined(__GO32__) || defined (WINGDB) - nbfd->iostream = (PTR)fopen(filename, FOPEN_RB); -#else - /* (O_ACCMODE) parens are to avoid Ultrix header file bug */ - switch (fdflags & (O_ACCMODE)) { - case O_RDONLY: nbfd->iostream = (PTR) fdopen (fd, FOPEN_RB); break; - case O_WRONLY: nbfd->iostream = (PTR) fdopen (fd, FOPEN_RUB); break; - case O_RDWR: nbfd->iostream = (PTR) fdopen (fd, FOPEN_RUB); break; - default: abort (); - } -#endif - if (nbfd->iostream == NULL) { - (void) obstack_free (&nbfd->memory, (PTR)0); - return NULL; - } - - /* OK, put everything where it belongs */ - - nbfd->filename = filename; - - /* As a special case we allow a FD open for read/write to - be written through, although doing so requires that we end - the previous clause with a preposition. */ - /* (O_ACCMODE) parens are to avoid Ultrix header file bug */ - switch (fdflags & (O_ACCMODE)) { - case O_RDONLY: nbfd->direction = read_direction; break; - case O_WRONLY: nbfd->direction = write_direction; break; - case O_RDWR: nbfd->direction = both_direction; break; - default: abort (); - } - - if (! bfd_cache_init (nbfd)) - return NULL; - - return nbfd; -} - -/* -FUNCTION - bfd_openstreamr - -SYNOPSIS - bfd *bfd_openstreamr(); - -DESCRIPTION - - Open a BFD for read access on an existing stdio stream. When - the BFD is passed to <>, the stream will be closed. -*/ - -bfd * -bfd_openstreamr (filename, target, stream) - const char *filename; - const char *target; - FILE *stream; -{ - bfd *nbfd; - const bfd_target *target_vec; - - nbfd = _bfd_new_bfd (); - if (nbfd == NULL) - return NULL; - - target_vec = bfd_find_target (target, nbfd); - if (target_vec == NULL) - { - bfd_set_error (bfd_error_invalid_target); - return NULL; - } - - nbfd->iostream = (PTR) stream; - nbfd->filename = filename; - nbfd->direction = read_direction; - - if (! bfd_cache_init (nbfd)) - return NULL; - - return nbfd; -} - -/** bfd_openw -- open for writing. - Returns a pointer to a freshly-allocated BFD on success, or NULL. - - See comment by bfd_fdopenr before you try to modify this function. */ - -/* -FUNCTION - bfd_openw - -SYNOPSIS - bfd *bfd_openw(CONST char *filename, CONST char *target); - -DESCRIPTION - Create a BFD, associated with file @var{filename}, using the - file format @var{target}, and return a pointer to it. - - Possible errors are <>, <>, - <>. -*/ - -bfd * -bfd_openw (filename, target) - CONST char *filename; - CONST char *target; -{ - bfd *nbfd; - const bfd_target *target_vec; - - bfd_set_error (bfd_error_system_call); - - /* nbfd has to point to head of malloc'ed block so that bfd_close may - reclaim it correctly. */ - - nbfd = _bfd_new_bfd(); - if (nbfd == NULL) - return NULL; - - target_vec = bfd_find_target (target, nbfd); - if (target_vec == NULL) return NULL; - - nbfd->filename = filename; - nbfd->direction = write_direction; - - if (bfd_open_file (nbfd) == NULL) { - bfd_set_error (bfd_error_system_call); /* File not writeable, etc */ - (void) obstack_free (&nbfd->memory, (PTR)0); - return NULL; - } - return nbfd; -} - -/* - -FUNCTION - bfd_close - -SYNOPSIS - boolean bfd_close(bfd *abfd); - -DESCRIPTION - - Close a BFD. If the BFD was open for writing, - then pending operations are completed and the file written out - and closed. If the created file is executable, then - <> is called to mark it as such. - - All memory attached to the BFD's obstacks is released. - - The file descriptor associated with the BFD is closed (even - if it was passed in to BFD by <>). - -RETURNS - <> is returned if all is ok, otherwise <>. -*/ - - -boolean -bfd_close (abfd) - bfd *abfd; -{ - boolean ret; - - if (!bfd_read_p (abfd)) - { - if (! BFD_SEND_FMT (abfd, _bfd_write_contents, (abfd))) - return false; - } - - if (! BFD_SEND (abfd, _close_and_cleanup, (abfd))) - return false; - - ret = bfd_cache_close (abfd); - - /* If the file was open for writing and is now executable, - make it so */ - if (ret - && abfd->direction == write_direction - && abfd->flags & EXEC_P) - { - struct stat buf; - - if (stat (abfd->filename, &buf) == 0) - { - int mask = umask (0); - umask (mask); - chmod (abfd->filename, - (0777 - & (buf.st_mode | ((S_IXUSR | S_IXGRP | S_IXOTH) &~ mask)))); - } - } - - (void) obstack_free (&abfd->memory, (PTR)0); - (void) free (abfd); - - return ret; -} - -/* -FUNCTION - bfd_close_all_done - -SYNOPSIS - boolean bfd_close_all_done(bfd *); - -DESCRIPTION - Close a BFD. Differs from <> - since it does not complete any pending operations. This - routine would be used if the application had just used BFD for - swapping and didn't want to use any of the writing code. - - If the created file is executable, then <> is called - to mark it as such. - - All memory attached to the BFD's obstacks is released. - -RETURNS - <> is returned if all is ok, otherwise <>. - -*/ - -boolean -bfd_close_all_done (abfd) - bfd *abfd; -{ - boolean ret; - - ret = bfd_cache_close (abfd); - - /* If the file was open for writing and is now executable, - make it so */ - if (ret - && abfd->direction == write_direction - && abfd->flags & EXEC_P) - { - struct stat buf; - - if (stat (abfd->filename, &buf) == 0) - { - int mask = umask (0); - umask (mask); - chmod (abfd->filename, - (0x777 - & (buf.st_mode | ((S_IXUSR | S_IXGRP | S_IXOTH) &~ mask)))); - } - } - (void) obstack_free (&abfd->memory, (PTR)0); - (void) free(abfd); - return ret; -} - - -/* -FUNCTION - bfd_alloc_size - -SYNOPSIS - bfd_size_type bfd_alloc_size(bfd *abfd); - -DESCRIPTION - Return the number of bytes in the obstacks connected to @var{abfd}. - -*/ - -bfd_size_type -bfd_alloc_size (abfd) - bfd *abfd; -{ - struct _obstack_chunk *chunk = abfd->memory.chunk; - size_t size = 0; - while (chunk) { - size += chunk->limit - &(chunk->contents[0]); - chunk = chunk->prev; - } - return size; -} - - - -/* -FUNCTION - bfd_create - -SYNOPSIS - bfd *bfd_create(CONST char *filename, bfd *templ); - -DESCRIPTION - Create a new BFD in the manner of - <>, but without opening a file. The new BFD - takes the target from the target used by @var{template}. The - format is always set to <>. - -*/ - -bfd * -bfd_create (filename, templ) - CONST char *filename; - bfd *templ; -{ - bfd *nbfd = _bfd_new_bfd(); - if (nbfd == (bfd *)NULL) - return (bfd *)NULL; - nbfd->filename = filename; - if(templ) { - nbfd->xvec = templ->xvec; - } - nbfd->direction = no_direction; - bfd_set_format(nbfd, bfd_object); - return nbfd; -} - -/* -INTERNAL_FUNCTION - bfd_alloc_by_size_t - -SYNOPSIS - PTR bfd_alloc_by_size_t(bfd *abfd, size_t wanted); - -DESCRIPTION - Allocate a block of @var{wanted} bytes of memory in the obstack - attatched to <> and return a pointer to it. -*/ - - -PTR -bfd_alloc_by_size_t (abfd, size) - bfd *abfd; - size_t size; -{ - PTR ret; - - ret = obstack_alloc (&(abfd->memory), size); - if (ret == NULL) - bfd_set_error (bfd_error_no_memory); - return ret; -} - -void -bfd_alloc_grow (abfd, ptr, size) - bfd *abfd; - PTR ptr; - size_t size; -{ - (void) obstack_grow(&(abfd->memory), ptr, size); -} - -PTR -bfd_alloc_finish (abfd) - bfd *abfd; -{ - PTR ret; - - ret = obstack_finish (&(abfd->memory)); - if (ret == NULL) - bfd_set_error (bfd_error_no_memory); - return ret; -} - -PTR -bfd_alloc (abfd, size) - bfd *abfd; - size_t size; -{ - return bfd_alloc_by_size_t(abfd, (size_t)size); -} - -PTR -bfd_zalloc (abfd, size) - bfd *abfd; - size_t size; -{ - PTR res; - res = bfd_alloc(abfd, size); - if (res) - memset(res, 0, (size_t)size); - return res; -} diff --git a/contrib/gdb/bfd/reloc.c b/contrib/gdb/bfd/reloc.c deleted file mode 100644 index 46ed5c2..0000000 --- a/contrib/gdb/bfd/reloc.c +++ /dev/null @@ -1,2391 +0,0 @@ -/* BFD support for handling relocation entries. - Copyright (C) 1990, 91, 92, 93, 94, 1995 Free Software Foundation, Inc. - Written by Cygnus Support. - -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. */ - -/* -SECTION - Relocations - - BFD maintains relocations in much the same way it maintains - symbols: they are left alone until required, then read in - en-mass and translated into an internal form. A common - routine <> acts upon the - canonical form to do the fixup. - - Relocations are maintained on a per section basis, - while symbols are maintained on a per BFD basis. - - All that a back end has to do to fit the BFD interface is to create - a <> for each relocation - in a particular section, and fill in the right bits of the structures. - -@menu -@* typedef arelent:: -@* howto manager:: -@end menu - -*/ - -/* DO compile in the reloc_code name table from libbfd.h. */ -#define _BFD_MAKE_TABLE_bfd_reloc_code_real - -#include "bfd.h" -#include "sysdep.h" -#include "bfdlink.h" -#include "libbfd.h" -/* -DOCDD -INODE - typedef arelent, howto manager, Relocations, Relocations - -SUBSECTION - typedef arelent - - This is the structure of a relocation entry: - -CODE_FRAGMENT -. -.typedef enum bfd_reloc_status -.{ -. {* No errors detected *} -. bfd_reloc_ok, -. -. {* The relocation was performed, but there was an overflow. *} -. bfd_reloc_overflow, -. -. {* The address to relocate was not within the section supplied. *} -. bfd_reloc_outofrange, -. -. {* Used by special functions *} -. bfd_reloc_continue, -. -. {* Unsupported relocation size requested. *} -. bfd_reloc_notsupported, -. -. {* Unused *} -. bfd_reloc_other, -. -. {* The symbol to relocate against was undefined. *} -. bfd_reloc_undefined, -. -. {* The relocation was performed, but may not be ok - presently -. generated only when linking i960 coff files with i960 b.out -. symbols. If this type is returned, the error_message argument -. to bfd_perform_relocation will be set. *} -. bfd_reloc_dangerous -. } -. bfd_reloc_status_type; -. -. -.typedef struct reloc_cache_entry -.{ -. {* A pointer into the canonical table of pointers *} -. struct symbol_cache_entry **sym_ptr_ptr; -. -. {* offset in section *} -. bfd_size_type address; -. -. {* addend for relocation value *} -. bfd_vma addend; -. -. {* Pointer to how to perform the required relocation *} -. reloc_howto_type *howto; -. -.} arelent; - -*/ - -/* -DESCRIPTION - - Here is a description of each of the fields within an <>: - - o <> - - The symbol table pointer points to a pointer to the symbol - associated with the relocation request. It is - the pointer into the table returned by the back end's - <> action. @xref{Symbols}. The symbol is referenced - through a pointer to a pointer so that tools like the linker - can fix up all the symbols of the same name by modifying only - one pointer. The relocation routine looks in the symbol and - uses the base of the section the symbol is attached to and the - value of the symbol as the initial relocation offset. If the - symbol pointer is zero, then the section provided is looked up. - - o <
> - - The <
> field gives the offset in bytes from the base of - the section data which owns the relocation record to the first - byte of relocatable information. The actual data relocated - will be relative to this point; for example, a relocation - type which modifies the bottom two bytes of a four byte word - would not touch the first byte pointed to in a big endian - world. - - o <> - - The <> is a value provided by the back end to be added (!) - to the relocation offset. Its interpretation is dependent upon - the howto. For example, on the 68k the code: - - -| char foo[]; -| main() -| { -| return foo[0x12345678]; -| } - - Could be compiled into: - -| linkw fp,#-4 -| moveb @@#12345678,d0 -| extbl d0 -| unlk fp -| rts - - - This could create a reloc pointing to <>, but leave the - offset in the data, something like: - - -|RELOCATION RECORDS FOR [.text]: -|offset type value -|00000006 32 _foo -| -|00000000 4e56 fffc ; linkw fp,#-4 -|00000004 1039 1234 5678 ; moveb @@#12345678,d0 -|0000000a 49c0 ; extbl d0 -|0000000c 4e5e ; unlk fp -|0000000e 4e75 ; rts - - - Using coff and an 88k, some instructions don't have enough - space in them to represent the full address range, and - pointers have to be loaded in two parts. So you'd get something like: - - -| or.u r13,r0,hi16(_foo+0x12345678) -| ld.b r2,r13,lo16(_foo+0x12345678) -| jmp r1 - - - This should create two relocs, both pointing to <<_foo>>, and with - 0x12340000 in their addend field. The data would consist of: - - -|RELOCATION RECORDS FOR [.text]: -|offset type value -|00000002 HVRT16 _foo+0x12340000 -|00000006 LVRT16 _foo+0x12340000 -| -|00000000 5da05678 ; or.u r13,r0,0x5678 -|00000004 1c4d5678 ; ld.b r2,r13,0x5678 -|00000008 f400c001 ; jmp r1 - - - The relocation routine digs out the value from the data, adds - it to the addend to get the original offset, and then adds the - value of <<_foo>>. Note that all 32 bits have to be kept around - somewhere, to cope with carry from bit 15 to bit 16. - - One further example is the sparc and the a.out format. The - sparc has a similar problem to the 88k, in that some - instructions don't have room for an entire offset, but on the - sparc the parts are created in odd sized lumps. The designers of - the a.out format chose to not use the data within the section - for storing part of the offset; all the offset is kept within - the reloc. Anything in the data should be ignored. - -| save %sp,-112,%sp -| sethi %hi(_foo+0x12345678),%g2 -| ldsb [%g2+%lo(_foo+0x12345678)],%i0 -| ret -| restore - - Both relocs contain a pointer to <>, and the offsets - contain junk. - - -|RELOCATION RECORDS FOR [.text]: -|offset type value -|00000004 HI22 _foo+0x12345678 -|00000008 LO10 _foo+0x12345678 -| -|00000000 9de3bf90 ; save %sp,-112,%sp -|00000004 05000000 ; sethi %hi(_foo+0),%g2 -|00000008 f048a000 ; ldsb [%g2+%lo(_foo+0)],%i0 -|0000000c 81c7e008 ; ret -|00000010 81e80000 ; restore - - - o <> - - The <> field can be imagined as a - relocation instruction. It is a pointer to a structure which - contains information on what to do with all of the other - information in the reloc record and data section. A back end - would normally have a relocation instruction set and turn - relocations into pointers to the correct structure on input - - but it would be possible to create each howto field on demand. - -*/ - -/* -SUBSUBSECTION - <> - - Indicates what sort of overflow checking should be done when - performing a relocation. - -CODE_FRAGMENT -. -.enum complain_overflow -.{ -. {* Do not complain on overflow. *} -. complain_overflow_dont, -. -. {* Complain if the bitfield overflows, whether it is considered -. as signed or unsigned. *} -. complain_overflow_bitfield, -. -. {* Complain if the value overflows when considered as signed -. number. *} -. complain_overflow_signed, -. -. {* Complain if the value overflows when considered as an -. unsigned number. *} -. complain_overflow_unsigned -.}; - -*/ - -/* -SUBSUBSECTION - <> - - The <> is a structure which contains all the - information that libbfd needs to know to tie up a back end's data. - -CODE_FRAGMENT -.struct symbol_cache_entry; {* Forward declaration *} -. -.struct reloc_howto_struct -.{ -. {* The type field has mainly a documetary use - the back end can -. do what it wants with it, though normally the back end's -. external idea of what a reloc number is stored -. in this field. For example, a PC relative word relocation -. in a coff environment has the type 023 - because that's -. what the outside world calls a R_PCRWORD reloc. *} -. unsigned int type; -. -. {* The value the final relocation is shifted right by. This drops -. unwanted data from the relocation. *} -. unsigned int rightshift; -. -. {* The size of the item to be relocated. This is *not* a -. power-of-two measure. To get the number of bytes operated -. on by a type of relocation, use bfd_get_reloc_size. *} -. int size; -. -. {* The number of bits in the item to be relocated. This is used -. when doing overflow checking. *} -. unsigned int bitsize; -. -. {* Notes that the relocation is relative to the location in the -. data section of the addend. The relocation function will -. subtract from the relocation value the address of the location -. being relocated. *} -. boolean pc_relative; -. -. {* The bit position of the reloc value in the destination. -. The relocated value is left shifted by this amount. *} -. unsigned int bitpos; -. -. {* What type of overflow error should be checked for when -. relocating. *} -. enum complain_overflow complain_on_overflow; -. -. {* If this field is non null, then the supplied function is -. called rather than the normal function. This allows really -. strange relocation methods to be accomodated (e.g., i960 callj -. instructions). *} -. bfd_reloc_status_type (*special_function) -. PARAMS ((bfd *abfd, -. arelent *reloc_entry, -. struct symbol_cache_entry *symbol, -. PTR data, -. asection *input_section, -. bfd *output_bfd, -. char **error_message)); -. -. {* The textual name of the relocation type. *} -. char *name; -. -. {* When performing a partial link, some formats must modify the -. relocations rather than the data - this flag signals this.*} -. boolean partial_inplace; -. -. {* The src_mask selects which parts of the read in data -. are to be used in the relocation sum. E.g., if this was an 8 bit -. bit of data which we read and relocated, this would be -. 0x000000ff. When we have relocs which have an addend, such as -. sun4 extended relocs, the value in the offset part of a -. relocating field is garbage so we never use it. In this case -. the mask would be 0x00000000. *} -. bfd_vma src_mask; -. -. {* The dst_mask selects which parts of the instruction are replaced -. into the instruction. In most cases src_mask == dst_mask, -. except in the above special case, where dst_mask would be -. 0x000000ff, and src_mask would be 0x00000000. *} -. bfd_vma dst_mask; -. -. {* When some formats create PC relative instructions, they leave -. the value of the pc of the place being relocated in the offset -. slot of the instruction, so that a PC relative relocation can -. be made just by adding in an ordinary offset (e.g., sun3 a.out). -. Some formats leave the displacement part of an instruction -. empty (e.g., m88k bcs); this flag signals the fact.*} -. boolean pcrel_offset; -. -.}; - -*/ - -/* -FUNCTION - The HOWTO Macro - -DESCRIPTION - The HOWTO define is horrible and will go away. - - -.#define HOWTO(C, R,S,B, P, BI, O, SF, NAME, INPLACE, MASKSRC, MASKDST, PC) \ -. {(unsigned)C,R,S,B, P, BI, O,SF,NAME,INPLACE,MASKSRC,MASKDST,PC} - -DESCRIPTION - And will be replaced with the totally magic way. But for the - moment, we are compatible, so do it this way. - - -.#define NEWHOWTO( FUNCTION, NAME,SIZE,REL,IN) HOWTO(0,0,SIZE,0,REL,0,complain_overflow_dont,FUNCTION, NAME,false,0,0,IN) -. -DESCRIPTION - Helper routine to turn a symbol into a relocation value. - -.#define HOWTO_PREPARE(relocation, symbol) \ -. { \ -. if (symbol != (asymbol *)NULL) { \ -. if (bfd_is_com_section (symbol->section)) { \ -. relocation = 0; \ -. } \ -. else { \ -. relocation = symbol->value; \ -. } \ -. } \ -.} - -*/ - -/* -FUNCTION - bfd_get_reloc_size - -SYNOPSIS - int bfd_get_reloc_size (reloc_howto_type *); - -DESCRIPTION - For a reloc_howto_type that operates on a fixed number of bytes, - this returns the number of bytes operated on. - */ - -int -bfd_get_reloc_size (howto) - reloc_howto_type *howto; -{ - switch (howto->size) - { - case 0: return 1; - case 1: return 2; - case 2: return 4; - case 3: return 0; - case 4: return 8; - case -2: return 4; - default: abort (); - } -} - -/* -TYPEDEF - arelent_chain - -DESCRIPTION - - How relocs are tied together in an <>: - -.typedef struct relent_chain { -. arelent relent; -. struct relent_chain *next; -.} arelent_chain; - -*/ - - - -/* -FUNCTION - bfd_perform_relocation - -SYNOPSIS - bfd_reloc_status_type - bfd_perform_relocation - (bfd *abfd, - arelent *reloc_entry, - PTR data, - asection *input_section, - bfd *output_bfd, - char **error_message); - -DESCRIPTION - If @var{output_bfd} is supplied to this function, the - generated image will be relocatable; the relocations are - copied to the output file after they have been changed to - reflect the new state of the world. There are two ways of - reflecting the results of partial linkage in an output file: - by modifying the output data in place, and by modifying the - relocation record. Some native formats (e.g., basic a.out and - basic coff) have no way of specifying an addend in the - relocation type, so the addend has to go in the output data. - This is no big deal since in these formats the output data - slot will always be big enough for the addend. Complex reloc - types with addends were invented to solve just this problem. - The @var{error_message} argument is set to an error message if - this return @code{bfd_reloc_dangerous}. - -*/ - - -bfd_reloc_status_type -bfd_perform_relocation (abfd, reloc_entry, data, input_section, output_bfd, - error_message) - bfd *abfd; - arelent *reloc_entry; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message; -{ - bfd_vma relocation; - bfd_reloc_status_type flag = bfd_reloc_ok; - bfd_size_type addr = reloc_entry->address; - bfd_vma output_base = 0; - reloc_howto_type *howto = reloc_entry->howto; - asection *reloc_target_output_section; - asymbol *symbol; - - symbol = *(reloc_entry->sym_ptr_ptr); - if (bfd_is_abs_section (symbol->section) - && output_bfd != (bfd *) NULL) - { - reloc_entry->address += input_section->output_offset; - return bfd_reloc_ok; - } - - /* If we are not producing relocateable output, return an error if - the symbol is not defined. An undefined weak symbol is - considered to have a value of zero (SVR4 ABI, p. 4-27). */ - if (bfd_is_und_section (symbol->section) - && (symbol->flags & BSF_WEAK) == 0 - && output_bfd == (bfd *) NULL) - flag = bfd_reloc_undefined; - - /* If there is a function supplied to handle this relocation type, - call it. It'll return `bfd_reloc_continue' if further processing - can be done. */ - if (howto->special_function) - { - bfd_reloc_status_type cont; - cont = howto->special_function (abfd, reloc_entry, symbol, data, - input_section, output_bfd, - error_message); - if (cont != bfd_reloc_continue) - return cont; - } - - /* Is the address of the relocation really within the section? */ - if (reloc_entry->address > input_section->_cooked_size) - return bfd_reloc_outofrange; - - /* Work out which section the relocation is targetted at and the - initial relocation command value. */ - - /* Get symbol value. (Common symbols are special.) */ - if (bfd_is_com_section (symbol->section)) - relocation = 0; - else - relocation = symbol->value; - - - reloc_target_output_section = symbol->section->output_section; - - /* Convert input-section-relative symbol value to absolute. */ - if (output_bfd && howto->partial_inplace == false) - output_base = 0; - else - output_base = reloc_target_output_section->vma; - - relocation += output_base + symbol->section->output_offset; - - /* Add in supplied addend. */ - relocation += reloc_entry->addend; - - /* Here the variable relocation holds the final address of the - symbol we are relocating against, plus any addend. */ - - if (howto->pc_relative == true) - { - /* This is a PC relative relocation. We want to set RELOCATION - to the distance between the address of the symbol and the - location. RELOCATION is already the address of the symbol. - - We start by subtracting the address of the section containing - the location. - - If pcrel_offset is set, we must further subtract the position - of the location within the section. Some targets arrange for - the addend to be the negative of the position of the location - within the section; for example, i386-aout does this. For - i386-aout, pcrel_offset is false. Some other targets do not - include the position of the location; for example, m88kbcs, - or ELF. For those targets, pcrel_offset is true. - - If we are producing relocateable output, then we must ensure - that this reloc will be correctly computed when the final - relocation is done. If pcrel_offset is false we want to wind - up with the negative of the location within the section, - which means we must adjust the existing addend by the change - in the location within the section. If pcrel_offset is true - we do not want to adjust the existing addend at all. - - FIXME: This seems logical to me, but for the case of - producing relocateable output it is not what the code - actually does. I don't want to change it, because it seems - far too likely that something will break. */ - - relocation -= - input_section->output_section->vma + input_section->output_offset; - - if (howto->pcrel_offset == true) - relocation -= reloc_entry->address; - } - - if (output_bfd != (bfd *) NULL) - { - if (howto->partial_inplace == false) - { - /* This is a partial relocation, and we want to apply the relocation - to the reloc entry rather than the raw data. Modify the reloc - inplace to reflect what we now know. */ - reloc_entry->addend = relocation; - reloc_entry->address += input_section->output_offset; - return flag; - } - else - { - /* This is a partial relocation, but inplace, so modify the - reloc record a bit. - - If we've relocated with a symbol with a section, change - into a ref to the section belonging to the symbol. */ - - reloc_entry->address += input_section->output_offset; - - /* WTF?? */ - if (abfd->xvec->flavour == bfd_target_coff_flavour - && strcmp (abfd->xvec->name, "aixcoff-rs6000") != 0 - && strcmp (abfd->xvec->name, "coff-Intel-little") != 0 - && strcmp (abfd->xvec->name, "coff-Intel-big") != 0) - { -#if 1 - /* For m68k-coff, the addend was being subtracted twice during - relocation with -r. Removing the line below this comment - fixes that problem; see PR 2953. - -However, Ian wrote the following, regarding removing the line below, -which explains why it is still enabled: --djm - -If you put a patch like that into BFD you need to check all the COFF -linkers. I am fairly certain that patch will break coff-i386 (e.g., -SCO); see coff_i386_reloc in coff-i386.c where I worked around the -problem in a different way. There may very well be a reason that the -code works as it does. - -Hmmm. The first obvious point is that bfd_perform_relocation should -not have any tests that depend upon the flavour. It's seem like -entirely the wrong place for such a thing. The second obvious point -is that the current code ignores the reloc addend when producing -relocateable output for COFF. That's peculiar. In fact, I really -have no idea what the point of the line you want to remove is. - -A typical COFF reloc subtracts the old value of the symbol and adds in -the new value to the location in the object file (if it's a pc -relative reloc it adds the difference between the symbol value and the -location). When relocating we need to preserve that property. - -BFD handles this by setting the addend to the negative of the old -value of the symbol. Unfortunately it handles common symbols in a -non-standard way (it doesn't subtract the old value) but that's a -different story (we can't change it without losing backward -compatibility with old object files) (coff-i386 does subtract the old -value, to be compatible with existing coff-i386 targets, like SCO). - -So everything works fine when not producing relocateable output. When -we are producing relocateable output, logically we should do exactly -what we do when not producing relocateable output. Therefore, your -patch is correct. In fact, it should probably always just set -reloc_entry->addend to 0 for all cases, since it is, in fact, going to -add the value into the object file. This won't hurt the COFF code, -which doesn't use the addend; I'm not sure what it will do to other -formats (the thing to check for would be whether any formats both use -the addend and set partial_inplace). - -When I wanted to make coff-i386 produce relocateable output, I ran -into the problem that you are running into: I wanted to remove that -line. Rather than risk it, I made the coff-i386 relocs use a special -function; it's coff_i386_reloc in coff-i386.c. The function -specifically adds the addend field into the object file, knowing that -bfd_perform_relocation is not going to. If you remove that line, then -coff-i386.c will wind up adding the addend field in twice. It's -trivial to fix; it just needs to be done. - -The problem with removing the line is just that it may break some -working code. With BFD it's hard to be sure of anything. The right -way to deal with this is simply to build and test at least all the -supported COFF targets. It should be straightforward if time and disk -space consuming. For each target: - 1) build the linker - 2) generate some executable, and link it using -r (I would - probably use paranoia.o and link against newlib/libc.a, which - for all the supported targets would be available in - /usr/cygnus/progressive/H-host/target/lib/libc.a). - 3) make the change to reloc.c - 4) rebuild the linker - 5) repeat step 2 - 6) if the resulting object files are the same, you have at least - made it no worse - 7) if they are different you have to figure out which version is - right -*/ - relocation -= reloc_entry->addend; -#endif - reloc_entry->addend = 0; - } - else - { - reloc_entry->addend = relocation; - } - } - } - else - { - reloc_entry->addend = 0; - } - - /* FIXME: This overflow checking is incomplete, because the value - might have overflowed before we get here. For a correct check we - need to compute the value in a size larger than bitsize, but we - can't reasonably do that for a reloc the same size as a host - machine word. - FIXME: We should also do overflow checking on the result after - adding in the value contained in the object file. */ - if (howto->complain_on_overflow != complain_overflow_dont - && flag == bfd_reloc_ok) - { - bfd_vma check; - - /* Get the value that will be used for the relocation, but - starting at bit position zero. */ - check = relocation >> howto->rightshift; - switch (howto->complain_on_overflow) - { - case complain_overflow_signed: - { - /* Assumes two's complement. */ - bfd_signed_vma reloc_signed_max = (1 << (howto->bitsize - 1)) - 1; - bfd_signed_vma reloc_signed_min = ~reloc_signed_max; - - /* The above right shift is incorrect for a signed value. - Fix it up by forcing on the upper bits. */ - if (howto->rightshift > 0 - && (bfd_signed_vma) relocation < 0) - check |= ((bfd_vma) - 1 - & ~((bfd_vma) - 1 - >> howto->rightshift)); - if ((bfd_signed_vma) check > reloc_signed_max - || (bfd_signed_vma) check < reloc_signed_min) - flag = bfd_reloc_overflow; - } - break; - case complain_overflow_unsigned: - { - /* Assumes two's complement. This expression avoids - overflow if howto->bitsize is the number of bits in - bfd_vma. */ - bfd_vma reloc_unsigned_max = - (((1 << (howto->bitsize - 1)) - 1) << 1) | 1; - - if ((bfd_vma) check > reloc_unsigned_max) - flag = bfd_reloc_overflow; - } - break; - case complain_overflow_bitfield: - { - /* Assumes two's complement. This expression avoids - overflow if howto->bitsize is the number of bits in - bfd_vma. */ - bfd_vma reloc_bits = (((1 << (howto->bitsize - 1)) - 1) << 1) | 1; - - if (((bfd_vma) check & ~reloc_bits) != 0 - && ((bfd_vma) check & ~reloc_bits) != (-1 & ~reloc_bits)) - { - /* The above right shift is incorrect for a signed - value. See if turning on the upper bits fixes the - overflow. */ - if (howto->rightshift > 0 - && (bfd_signed_vma) relocation < 0) - { - check |= ((bfd_vma) - 1 - & ~((bfd_vma) - 1 - >> howto->rightshift)); - if (((bfd_vma) check & ~reloc_bits) != (-1 & ~reloc_bits)) - flag = bfd_reloc_overflow; - } - else - flag = bfd_reloc_overflow; - } - } - break; - default: - abort (); - } - } - - /* - Either we are relocating all the way, or we don't want to apply - the relocation to the reloc entry (probably because there isn't - any room in the output format to describe addends to relocs) - */ - - /* The cast to bfd_vma avoids a bug in the Alpha OSF/1 C compiler - (OSF version 1.3, compiler version 3.11). It miscompiles the - following program: - - struct str - { - unsigned int i0; - } s = { 0 }; - - int - main () - { - unsigned long x; - - x = 0x100000000; - x <<= (unsigned long) s.i0; - if (x == 0) - printf ("failed\n"); - else - printf ("succeeded (%lx)\n", x); - } - */ - - relocation >>= (bfd_vma) howto->rightshift; - - /* Shift everything up to where it's going to be used */ - - relocation <<= (bfd_vma) howto->bitpos; - - /* Wait for the day when all have the mask in them */ - - /* What we do: - i instruction to be left alone - o offset within instruction - r relocation offset to apply - S src mask - D dst mask - N ~dst mask - A part 1 - B part 2 - R result - - Do this: - i i i i i o o o o o from bfd_get - and S S S S S to get the size offset we want - + r r r r r r r r r r to get the final value to place - and D D D D D to chop to right size - ----------------------- - A A A A A - And this: - ... i i i i i o o o o o from bfd_get - and N N N N N get instruction - ----------------------- - ... B B B B B - - And then: - B B B B B - or A A A A A - ----------------------- - R R R R R R R R R R put into bfd_put - */ - -#define DOIT(x) \ - x = ( (x & ~howto->dst_mask) | (((x & howto->src_mask) + relocation) & howto->dst_mask)) - - switch (howto->size) - { - case 0: - { - char x = bfd_get_8 (abfd, (char *) data + addr); - DOIT (x); - bfd_put_8 (abfd, x, (unsigned char *) data + addr); - } - break; - - case 1: - if (relocation) - { - short x = bfd_get_16 (abfd, (bfd_byte *) data + addr); - DOIT (x); - bfd_put_16 (abfd, x, (unsigned char *) data + addr); - } - break; - case 2: - if (relocation) - { - long x = bfd_get_32 (abfd, (bfd_byte *) data + addr); - DOIT (x); - bfd_put_32 (abfd, x, (bfd_byte *) data + addr); - } - break; - case -2: - { - long x = bfd_get_32 (abfd, (bfd_byte *) data + addr); - relocation = -relocation; - DOIT (x); - bfd_put_32 (abfd, x, (bfd_byte *) data + addr); - } - break; - - case -1: - { - long x = bfd_get_16 (abfd, (bfd_byte *) data + addr); - relocation = -relocation; - DOIT (x); - bfd_put_16 (abfd, x, (bfd_byte *) data + addr); - } - break; - - case 3: - /* Do nothing */ - break; - - case 4: -#ifdef BFD64 - if (relocation) - { - bfd_vma x = bfd_get_64 (abfd, (bfd_byte *) data + addr); - DOIT (x); - bfd_put_64 (abfd, x, (bfd_byte *) data + addr); - } -#else - abort (); -#endif - break; - default: - return bfd_reloc_other; - } - - return flag; -} - -/* -FUNCTION - bfd_install_relocation - -SYNOPSIS - bfd_reloc_status_type - bfd_install_relocation - (bfd *abfd, - arelent *reloc_entry, - PTR data, bfd_vma data_start, - asection *input_section, - char **error_message); - -DESCRIPTION - This looks remarkably like <>, except it - does not expect that the section contents have been filled in. - I.e., it's suitable for use when creating, rather than applying - a relocation. - - For now, this function should be considered reserved for the - assembler. - -*/ - - -bfd_reloc_status_type -bfd_install_relocation (abfd, reloc_entry, data_start, data_start_offset, - input_section, error_message) - bfd *abfd; - arelent *reloc_entry; - PTR data_start; - bfd_vma data_start_offset; - asection *input_section; - char **error_message; -{ - bfd_vma relocation; - bfd_reloc_status_type flag = bfd_reloc_ok; - bfd_size_type addr = reloc_entry->address; - bfd_vma output_base = 0; - reloc_howto_type *howto = reloc_entry->howto; - asection *reloc_target_output_section; - asymbol *symbol; - bfd_byte *data; - - symbol = *(reloc_entry->sym_ptr_ptr); - if (bfd_is_abs_section (symbol->section)) - { - reloc_entry->address += input_section->output_offset; - return bfd_reloc_ok; - } - - /* If there is a function supplied to handle this relocation type, - call it. It'll return `bfd_reloc_continue' if further processing - can be done. */ - if (howto->special_function) - { - bfd_reloc_status_type cont; - /* XXX - The special_function calls haven't been fixed up to deal - with creating new relocations and section contents. */ - cont = howto->special_function (abfd, reloc_entry, symbol, - /* XXX - Non-portable! */ - ((bfd_byte *) data_start - - data_start_offset), - input_section, abfd, error_message); - if (cont != bfd_reloc_continue) - return cont; - } - - /* Is the address of the relocation really within the section? */ - if (reloc_entry->address > input_section->_cooked_size) - return bfd_reloc_outofrange; - - /* Work out which section the relocation is targetted at and the - initial relocation command value. */ - - /* Get symbol value. (Common symbols are special.) */ - if (bfd_is_com_section (symbol->section)) - relocation = 0; - else - relocation = symbol->value; - - - reloc_target_output_section = symbol->section->output_section; - - /* Convert input-section-relative symbol value to absolute. */ - if (howto->partial_inplace == false) - output_base = 0; - else - output_base = reloc_target_output_section->vma; - - relocation += output_base + symbol->section->output_offset; - - /* Add in supplied addend. */ - relocation += reloc_entry->addend; - - /* Here the variable relocation holds the final address of the - symbol we are relocating against, plus any addend. */ - - if (howto->pc_relative == true) - { - /* This is a PC relative relocation. We want to set RELOCATION - to the distance between the address of the symbol and the - location. RELOCATION is already the address of the symbol. - - We start by subtracting the address of the section containing - the location. - - If pcrel_offset is set, we must further subtract the position - of the location within the section. Some targets arrange for - the addend to be the negative of the position of the location - within the section; for example, i386-aout does this. For - i386-aout, pcrel_offset is false. Some other targets do not - include the position of the location; for example, m88kbcs, - or ELF. For those targets, pcrel_offset is true. - - If we are producing relocateable output, then we must ensure - that this reloc will be correctly computed when the final - relocation is done. If pcrel_offset is false we want to wind - up with the negative of the location within the section, - which means we must adjust the existing addend by the change - in the location within the section. If pcrel_offset is true - we do not want to adjust the existing addend at all. - - FIXME: This seems logical to me, but for the case of - producing relocateable output it is not what the code - actually does. I don't want to change it, because it seems - far too likely that something will break. */ - - relocation -= - input_section->output_section->vma + input_section->output_offset; - - if (howto->pcrel_offset == true && howto->partial_inplace == true) - relocation -= reloc_entry->address; - } - - if (howto->partial_inplace == false) - { - /* This is a partial relocation, and we want to apply the relocation - to the reloc entry rather than the raw data. Modify the reloc - inplace to reflect what we now know. */ - reloc_entry->addend = relocation; - reloc_entry->address += input_section->output_offset; - return flag; - } - else - { - /* This is a partial relocation, but inplace, so modify the - reloc record a bit. - - If we've relocated with a symbol with a section, change - into a ref to the section belonging to the symbol. */ - - reloc_entry->address += input_section->output_offset; - - /* WTF?? */ - if (abfd->xvec->flavour == bfd_target_coff_flavour - && strcmp (abfd->xvec->name, "aixcoff-rs6000") != 0 - && strcmp (abfd->xvec->name, "coff-Intel-little") != 0 - && strcmp (abfd->xvec->name, "coff-Intel-big") != 0) - { -#if 1 -/* For m68k-coff, the addend was being subtracted twice during - relocation with -r. Removing the line below this comment - fixes that problem; see PR 2953. - -However, Ian wrote the following, regarding removing the line below, -which explains why it is still enabled: --djm - -If you put a patch like that into BFD you need to check all the COFF -linkers. I am fairly certain that patch will break coff-i386 (e.g., -SCO); see coff_i386_reloc in coff-i386.c where I worked around the -problem in a different way. There may very well be a reason that the -code works as it does. - -Hmmm. The first obvious point is that bfd_install_relocation should -not have any tests that depend upon the flavour. It's seem like -entirely the wrong place for such a thing. The second obvious point -is that the current code ignores the reloc addend when producing -relocateable output for COFF. That's peculiar. In fact, I really -have no idea what the point of the line you want to remove is. - -A typical COFF reloc subtracts the old value of the symbol and adds in -the new value to the location in the object file (if it's a pc -relative reloc it adds the difference between the symbol value and the -location). When relocating we need to preserve that property. - -BFD handles this by setting the addend to the negative of the old -value of the symbol. Unfortunately it handles common symbols in a -non-standard way (it doesn't subtract the old value) but that's a -different story (we can't change it without losing backward -compatibility with old object files) (coff-i386 does subtract the old -value, to be compatible with existing coff-i386 targets, like SCO). - -So everything works fine when not producing relocateable output. When -we are producing relocateable output, logically we should do exactly -what we do when not producing relocateable output. Therefore, your -patch is correct. In fact, it should probably always just set -reloc_entry->addend to 0 for all cases, since it is, in fact, going to -add the value into the object file. This won't hurt the COFF code, -which doesn't use the addend; I'm not sure what it will do to other -formats (the thing to check for would be whether any formats both use -the addend and set partial_inplace). - -When I wanted to make coff-i386 produce relocateable output, I ran -into the problem that you are running into: I wanted to remove that -line. Rather than risk it, I made the coff-i386 relocs use a special -function; it's coff_i386_reloc in coff-i386.c. The function -specifically adds the addend field into the object file, knowing that -bfd_install_relocation is not going to. If you remove that line, then -coff-i386.c will wind up adding the addend field in twice. It's -trivial to fix; it just needs to be done. - -The problem with removing the line is just that it may break some -working code. With BFD it's hard to be sure of anything. The right -way to deal with this is simply to build and test at least all the -supported COFF targets. It should be straightforward if time and disk -space consuming. For each target: - 1) build the linker - 2) generate some executable, and link it using -r (I would - probably use paranoia.o and link against newlib/libc.a, which - for all the supported targets would be available in - /usr/cygnus/progressive/H-host/target/lib/libc.a). - 3) make the change to reloc.c - 4) rebuild the linker - 5) repeat step 2 - 6) if the resulting object files are the same, you have at least - made it no worse - 7) if they are different you have to figure out which version is - right -*/ - relocation -= reloc_entry->addend; -#endif - reloc_entry->addend = 0; - } - else - { - reloc_entry->addend = relocation; - } - } - - /* FIXME: This overflow checking is incomplete, because the value - might have overflowed before we get here. For a correct check we - need to compute the value in a size larger than bitsize, but we - can't reasonably do that for a reloc the same size as a host - machine word. - - FIXME: We should also do overflow checking on the result after - adding in the value contained in the object file. */ - if (howto->complain_on_overflow != complain_overflow_dont) - { - bfd_vma check; - - /* Get the value that will be used for the relocation, but - starting at bit position zero. */ - check = relocation >> howto->rightshift; - switch (howto->complain_on_overflow) - { - case complain_overflow_signed: - { - /* Assumes two's complement. */ - bfd_signed_vma reloc_signed_max = (1 << (howto->bitsize - 1)) - 1; - bfd_signed_vma reloc_signed_min = ~reloc_signed_max; - - /* The above right shift is incorrect for a signed value. - Fix it up by forcing on the upper bits. */ - if (howto->rightshift > 0 - && (bfd_signed_vma) relocation < 0) - check |= ((bfd_vma) - 1 - & ~((bfd_vma) - 1 - >> howto->rightshift)); - if ((bfd_signed_vma) check > reloc_signed_max - || (bfd_signed_vma) check < reloc_signed_min) - flag = bfd_reloc_overflow; - } - break; - case complain_overflow_unsigned: - { - /* Assumes two's complement. This expression avoids - overflow if howto->bitsize is the number of bits in - bfd_vma. */ - bfd_vma reloc_unsigned_max = - (((1 << (howto->bitsize - 1)) - 1) << 1) | 1; - - if ((bfd_vma) check > reloc_unsigned_max) - flag = bfd_reloc_overflow; - } - break; - case complain_overflow_bitfield: - { - /* Assumes two's complement. This expression avoids - overflow if howto->bitsize is the number of bits in - bfd_vma. */ - bfd_vma reloc_bits = (((1 << (howto->bitsize - 1)) - 1) << 1) | 1; - - if (((bfd_vma) check & ~reloc_bits) != 0 - && ((bfd_vma) check & ~reloc_bits) != (-1 & ~reloc_bits)) - { - /* The above right shift is incorrect for a signed - value. See if turning on the upper bits fixes the - overflow. */ - if (howto->rightshift > 0 - && (bfd_signed_vma) relocation < 0) - { - check |= ((bfd_vma) - 1 - & ~((bfd_vma) - 1 - >> howto->rightshift)); - if (((bfd_vma) check & ~reloc_bits) != (-1 & ~reloc_bits)) - flag = bfd_reloc_overflow; - } - else - flag = bfd_reloc_overflow; - } - } - break; - default: - abort (); - } - } - - /* - Either we are relocating all the way, or we don't want to apply - the relocation to the reloc entry (probably because there isn't - any room in the output format to describe addends to relocs) - */ - - /* The cast to bfd_vma avoids a bug in the Alpha OSF/1 C compiler - (OSF version 1.3, compiler version 3.11). It miscompiles the - following program: - - struct str - { - unsigned int i0; - } s = { 0 }; - - int - main () - { - unsigned long x; - - x = 0x100000000; - x <<= (unsigned long) s.i0; - if (x == 0) - printf ("failed\n"); - else - printf ("succeeded (%lx)\n", x); - } - */ - - relocation >>= (bfd_vma) howto->rightshift; - - /* Shift everything up to where it's going to be used */ - - relocation <<= (bfd_vma) howto->bitpos; - - /* Wait for the day when all have the mask in them */ - - /* What we do: - i instruction to be left alone - o offset within instruction - r relocation offset to apply - S src mask - D dst mask - N ~dst mask - A part 1 - B part 2 - R result - - Do this: - i i i i i o o o o o from bfd_get - and S S S S S to get the size offset we want - + r r r r r r r r r r to get the final value to place - and D D D D D to chop to right size - ----------------------- - A A A A A - And this: - ... i i i i i o o o o o from bfd_get - and N N N N N get instruction - ----------------------- - ... B B B B B - - And then: - B B B B B - or A A A A A - ----------------------- - R R R R R R R R R R put into bfd_put - */ - -#define DOIT(x) \ - x = ( (x & ~howto->dst_mask) | (((x & howto->src_mask) + relocation) & howto->dst_mask)) - - data = (bfd_byte *) data_start + (addr - data_start_offset); - - switch (howto->size) - { - case 0: - { - char x = bfd_get_8 (abfd, (char *) data); - DOIT (x); - bfd_put_8 (abfd, x, (unsigned char *) data); - } - break; - - case 1: - if (relocation) - { - short x = bfd_get_16 (abfd, (bfd_byte *) data); - DOIT (x); - bfd_put_16 (abfd, x, (unsigned char *) data); - } - break; - case 2: - if (relocation) - { - long x = bfd_get_32 (abfd, (bfd_byte *) data); - DOIT (x); - bfd_put_32 (abfd, x, (bfd_byte *) data); - } - break; - case -2: - { - long x = bfd_get_32 (abfd, (bfd_byte *) data); - relocation = -relocation; - DOIT (x); - bfd_put_32 (abfd, x, (bfd_byte *) data); - } - break; - - case 3: - /* Do nothing */ - break; - - case 4: - if (relocation) - { - bfd_vma x = bfd_get_64 (abfd, (bfd_byte *) data); - DOIT (x); - bfd_put_64 (abfd, x, (bfd_byte *) data); - } - break; - default: - return bfd_reloc_other; - } - - return flag; -} - -/* This relocation routine is used by some of the backend linkers. - They do not construct asymbol or arelent structures, so there is no - reason for them to use bfd_perform_relocation. Also, - bfd_perform_relocation is so hacked up it is easier to write a new - function than to try to deal with it. - - This routine does a final relocation. It should not be used when - generating relocateable output. - - FIXME: This routine ignores any special_function in the HOWTO, - since the existing special_function values have been written for - bfd_perform_relocation. - - HOWTO is the reloc howto information. - INPUT_BFD is the BFD which the reloc applies to. - INPUT_SECTION is the section which the reloc applies to. - CONTENTS is the contents of the section. - ADDRESS is the address of the reloc within INPUT_SECTION. - VALUE is the value of the symbol the reloc refers to. - ADDEND is the addend of the reloc. */ - -bfd_reloc_status_type -_bfd_final_link_relocate (howto, input_bfd, input_section, contents, address, - value, addend) - reloc_howto_type *howto; - bfd *input_bfd; - asection *input_section; - bfd_byte *contents; - bfd_vma address; - bfd_vma value; - bfd_vma addend; -{ - bfd_vma relocation; - - /* Sanity check the address. */ - if (address > input_section->_cooked_size) - return bfd_reloc_outofrange; - - /* This function assumes that we are dealing with a basic relocation - against a symbol. We want to compute the value of the symbol to - relocate to. This is just VALUE, the value of the symbol, plus - ADDEND, any addend associated with the reloc. */ - relocation = value + addend; - - /* If the relocation is PC relative, we want to set RELOCATION to - the distance between the symbol (currently in RELOCATION) and the - location we are relocating. Some targets (e.g., i386-aout) - arrange for the contents of the section to be the negative of the - offset of the location within the section; for such targets - pcrel_offset is false. Other targets (e.g., m88kbcs or ELF) - simply leave the contents of the section as zero; for such - targets pcrel_offset is true. If pcrel_offset is false we do not - need to subtract out the offset of the location within the - section (which is just ADDRESS). */ - if (howto->pc_relative) - { - relocation -= (input_section->output_section->vma - + input_section->output_offset); - if (howto->pcrel_offset) - relocation -= address; - } - - return _bfd_relocate_contents (howto, input_bfd, relocation, - contents + address); -} - -/* Relocate a given location using a given value and howto. */ - -bfd_reloc_status_type -_bfd_relocate_contents (howto, input_bfd, relocation, location) - reloc_howto_type *howto; - bfd *input_bfd; - bfd_vma relocation; - bfd_byte *location; -{ - int size; - bfd_vma x; - boolean overflow; - - /* If the size is negative, negate RELOCATION. This isn't very - general. */ - if (howto->size < 0) - relocation = -relocation; - - /* Get the value we are going to relocate. */ - size = bfd_get_reloc_size (howto); - switch (size) - { - default: - case 0: - abort (); - case 1: - x = bfd_get_8 (input_bfd, location); - break; - case 2: - x = bfd_get_16 (input_bfd, location); - break; - case 4: - x = bfd_get_32 (input_bfd, location); - break; - case 8: -#ifdef BFD64 - x = bfd_get_64 (input_bfd, location); -#else - abort (); -#endif - break; - } - - /* Check for overflow. FIXME: We may drop bits during the addition - which we don't check for. We must either check at every single - operation, which would be tedious, or we must do the computations - in a type larger than bfd_vma, which would be inefficient. */ - overflow = false; - if (howto->complain_on_overflow != complain_overflow_dont) - { - bfd_vma check; - bfd_signed_vma signed_check; - bfd_vma add; - bfd_signed_vma signed_add; - - if (howto->rightshift == 0) - { - check = relocation; - signed_check = (bfd_signed_vma) relocation; - } - else - { - /* Drop unwanted bits from the value we are relocating to. */ - check = relocation >> howto->rightshift; - - /* If this is a signed value, the rightshift just dropped - leading 1 bits (assuming twos complement). */ - if ((bfd_signed_vma) relocation >= 0) - signed_check = check; - else - signed_check = (check - | ((bfd_vma) - 1 - & ~((bfd_vma) - 1 >> howto->rightshift))); - } - - /* Get the value from the object file. */ - add = x & howto->src_mask; - - /* Get the value from the object file with an appropriate sign. - The expression involving howto->src_mask isolates the upper - bit of src_mask. If that bit is set in the value we are - adding, it is negative, and we subtract out that number times - two. If src_mask includes the highest possible bit, then we - can not get the upper bit, but that does not matter since - signed_add needs no adjustment to become negative in that - case. */ - signed_add = add; - if ((add & (((~howto->src_mask) >> 1) & howto->src_mask)) != 0) - signed_add -= (((~howto->src_mask) >> 1) & howto->src_mask) << 1; - - /* Add the value from the object file, shifted so that it is a - straight number. */ - if (howto->bitpos == 0) - { - check += add; - signed_check += signed_add; - } - else - { - check += add >> howto->bitpos; - - /* For the signed case we use ADD, rather than SIGNED_ADD, - to avoid warnings from SVR4 cc. This is OK since we - explictly handle the sign bits. */ - if (signed_add >= 0) - signed_check += add >> howto->bitpos; - else - signed_check += ((add >> howto->bitpos) - | ((bfd_vma) - 1 - & ~((bfd_vma) - 1 >> howto->bitpos))); - } - - switch (howto->complain_on_overflow) - { - case complain_overflow_signed: - { - /* Assumes two's complement. */ - bfd_signed_vma reloc_signed_max = (1 << (howto->bitsize - 1)) - 1; - bfd_signed_vma reloc_signed_min = ~reloc_signed_max; - - if (signed_check > reloc_signed_max - || signed_check < reloc_signed_min) - overflow = true; - } - break; - case complain_overflow_unsigned: - { - /* Assumes two's complement. This expression avoids - overflow if howto->bitsize is the number of bits in - bfd_vma. */ - bfd_vma reloc_unsigned_max = - (((1 << (howto->bitsize - 1)) - 1) << 1) | 1; - - if (check > reloc_unsigned_max) - overflow = true; - } - break; - case complain_overflow_bitfield: - { - /* Assumes two's complement. This expression avoids - overflow if howto->bitsize is the number of bits in - bfd_vma. */ - bfd_vma reloc_bits = (((1 << (howto->bitsize - 1)) - 1) << 1) | 1; - - if ((check & ~reloc_bits) != 0 - && (((bfd_vma) signed_check & ~reloc_bits) - != (-1 & ~reloc_bits))) - overflow = true; - } - break; - default: - abort (); - } - } - - /* Put RELOCATION in the right bits. */ - relocation >>= (bfd_vma) howto->rightshift; - relocation <<= (bfd_vma) howto->bitpos; - - /* Add RELOCATION to the right bits of X. */ - x = ((x & ~howto->dst_mask) - | (((x & howto->src_mask) + relocation) & howto->dst_mask)); - - /* Put the relocated value back in the object file. */ - switch (size) - { - default: - case 0: - abort (); - case 1: - bfd_put_8 (input_bfd, x, location); - break; - case 2: - bfd_put_16 (input_bfd, x, location); - break; - case 4: - bfd_put_32 (input_bfd, x, location); - break; - case 8: -#ifdef BFD64 - bfd_put_64 (input_bfd, x, location); -#else - abort (); -#endif - break; - } - - return overflow ? bfd_reloc_overflow : bfd_reloc_ok; -} - -/* -DOCDD -INODE - howto manager, , typedef arelent, Relocations - -SECTION - The howto manager - - When an application wants to create a relocation, but doesn't - know what the target machine might call it, it can find out by - using this bit of code. - -*/ - -/* -TYPEDEF - bfd_reloc_code_type - -DESCRIPTION - The insides of a reloc code. The idea is that, eventually, there - will be one enumerator for every type of relocation we ever do. - Pass one of these values to <>, and it'll - return a howto pointer. - - This does mean that the application must determine the correct - enumerator value; you can't get a howto pointer from a random set - of attributes. - -SENUM - bfd_reloc_code_real - -ENUM - BFD_RELOC_64 -ENUMX - BFD_RELOC_32 -ENUMX - BFD_RELOC_26 -ENUMX - BFD_RELOC_16 -ENUMX - BFD_RELOC_14 -ENUMX - BFD_RELOC_8 -ENUMDOC - Basic absolute relocations of N bits. - -ENUM - BFD_RELOC_64_PCREL -ENUMX - BFD_RELOC_32_PCREL -ENUMX - BFD_RELOC_24_PCREL -ENUMX - BFD_RELOC_16_PCREL -ENUMX - BFD_RELOC_12_PCREL -ENUMX - BFD_RELOC_8_PCREL -ENUMDOC - PC-relative relocations. Sometimes these are relative to the address -of the relocation itself; sometimes they are relative to the start of -the section containing the relocation. It depends on the specific target. - -The 24-bit relocation is used in some Intel 960 configurations. - -ENUM - BFD_RELOC_32_GOT_PCREL -ENUMX - BFD_RELOC_16_GOT_PCREL -ENUMX - BFD_RELOC_8_GOT_PCREL -ENUMX - BFD_RELOC_32_GOTOFF -ENUMX - BFD_RELOC_16_GOTOFF -ENUMX - BFD_RELOC_LO16_GOTOFF -ENUMX - BFD_RELOC_HI16_GOTOFF -ENUMX - BFD_RELOC_HI16_S_GOTOFF -ENUMX - BFD_RELOC_8_GOTOFF -ENUMX - BFD_RELOC_32_PLT_PCREL -ENUMX - BFD_RELOC_24_PLT_PCREL -ENUMX - BFD_RELOC_16_PLT_PCREL -ENUMX - BFD_RELOC_8_PLT_PCREL -ENUMX - BFD_RELOC_32_PLTOFF -ENUMX - BFD_RELOC_16_PLTOFF -ENUMX - BFD_RELOC_LO16_PLTOFF -ENUMX - BFD_RELOC_HI16_PLTOFF -ENUMX - BFD_RELOC_HI16_S_PLTOFF -ENUMX - BFD_RELOC_8_PLTOFF -ENUMDOC - For ELF. - -ENUM - BFD_RELOC_68K_GLOB_DAT -ENUMX - BFD_RELOC_68K_JMP_SLOT -ENUMX - BFD_RELOC_68K_RELATIVE -ENUMDOC - Relocations used by 68K ELF. - -ENUM - BFD_RELOC_32_BASEREL -ENUMX - BFD_RELOC_16_BASEREL -ENUMX - BFD_RELOC_LO16_BASEREL -ENUMX - BFD_RELOC_HI16_BASEREL -ENUMX - BFD_RELOC_HI16_S_BASEREL -ENUMX - BFD_RELOC_8_BASEREL -ENUMX - BFD_RELOC_RVA -ENUMDOC - Linkage-table relative. - -ENUM - BFD_RELOC_8_FFnn -ENUMDOC - Absolute 8-bit relocation, but used to form an address like 0xFFnn. - -ENUM - BFD_RELOC_32_PCREL_S2 -ENUMX - BFD_RELOC_16_PCREL_S2 -ENUMX - BFD_RELOC_23_PCREL_S2 -ENUMDOC - These PC-relative relocations are stored as word displacements -- -i.e., byte displacements shifted right two bits. The 30-bit word -displacement (<<32_PCREL_S2>> -- 32 bits, shifted 2) is used on the -SPARC. (SPARC tools generally refer to this as <>.) The -signed 16-bit displacement is used on the MIPS, and the 23-bit -displacement is used on the Alpha. - -ENUM - BFD_RELOC_HI22 -ENUMX - BFD_RELOC_LO10 -ENUMDOC - High 22 bits and low 10 bits of 32-bit value, placed into lower bits of -the target word. These are used on the SPARC. - -ENUM - BFD_RELOC_GPREL16 -ENUMX - BFD_RELOC_GPREL32 -ENUMDOC - For systems that allocate a Global Pointer register, these are -displacements off that register. These relocation types are -handled specially, because the value the register will have is -decided relatively late. - - -ENUM - BFD_RELOC_I960_CALLJ -ENUMDOC - Reloc types used for i960/b.out. - -ENUM - BFD_RELOC_NONE -ENUMX - BFD_RELOC_SPARC_WDISP22 -ENUMX - BFD_RELOC_SPARC22 -ENUMX - BFD_RELOC_SPARC13 -ENUMX - BFD_RELOC_SPARC_GOT10 -ENUMX - BFD_RELOC_SPARC_GOT13 -ENUMX - BFD_RELOC_SPARC_GOT22 -ENUMX - BFD_RELOC_SPARC_PC10 -ENUMX - BFD_RELOC_SPARC_PC22 -ENUMX - BFD_RELOC_SPARC_WPLT30 -ENUMX - BFD_RELOC_SPARC_COPY -ENUMX - BFD_RELOC_SPARC_GLOB_DAT -ENUMX - BFD_RELOC_SPARC_JMP_SLOT -ENUMX - BFD_RELOC_SPARC_RELATIVE -ENUMX - BFD_RELOC_SPARC_UA32 -ENUMDOC - SPARC ELF relocations. There is probably some overlap with other - relocation types already defined. - -ENUM - BFD_RELOC_SPARC_BASE13 -ENUMX - BFD_RELOC_SPARC_BASE22 -ENUMDOC - I think these are specific to SPARC a.out (e.g., Sun 4). - -ENUMEQ - BFD_RELOC_SPARC_64 - BFD_RELOC_64 -ENUMX - BFD_RELOC_SPARC_10 -ENUMX - BFD_RELOC_SPARC_11 -ENUMX - BFD_RELOC_SPARC_OLO10 -ENUMX - BFD_RELOC_SPARC_HH22 -ENUMX - BFD_RELOC_SPARC_HM10 -ENUMX - BFD_RELOC_SPARC_LM22 -ENUMX - BFD_RELOC_SPARC_PC_HH22 -ENUMX - BFD_RELOC_SPARC_PC_HM10 -ENUMX - BFD_RELOC_SPARC_PC_LM22 -ENUMX - BFD_RELOC_SPARC_WDISP16 -ENUMX - BFD_RELOC_SPARC_WDISP19 -ENUMX - BFD_RELOC_SPARC_GLOB_JMP -ENUMX - BFD_RELOC_SPARC_7 -ENUMX - BFD_RELOC_SPARC_6 -ENUMX - BFD_RELOC_SPARC_5 -ENUMDOC - Some relocations we're using for SPARC V9 -- subject to change. - -ENUM - BFD_RELOC_ALPHA_GPDISP_HI16 -ENUMDOC - Alpha ECOFF relocations. Some of these treat the symbol or "addend" - in some special way. - For GPDISP_HI16 ("gpdisp") relocations, the symbol is ignored when - writing; when reading, it will be the absolute section symbol. The - addend is the displacement in bytes of the "lda" instruction from - the "ldah" instruction (which is at the address of this reloc). -ENUM - BFD_RELOC_ALPHA_GPDISP_LO16 -ENUMDOC - For GPDISP_LO16 ("ignore") relocations, the symbol is handled as - with GPDISP_HI16 relocs. The addend is ignored when writing the - relocations out, and is filled in with the file's GP value on - reading, for convenience. - -ENUM - BFD_RELOC_ALPHA_LITERAL -ENUMX - BFD_RELOC_ALPHA_LITUSE -ENUMDOC - The Alpha LITERAL/LITUSE relocs are produced by a symbol reference; - the assembler turns it into a LDQ instruction to load the address of - the symbol, and then fills in a register in the real instruction. - - The LITERAL reloc, at the LDQ instruction, refers to the .lita - section symbol. The addend is ignored when writing, but is filled - in with the file's GP value on reading, for convenience, as with the - GPDISP_LO16 reloc. - - The LITUSE reloc, on the instruction using the loaded address, gives - information to the linker that it might be able to use to optimize - away some literal section references. The symbol is ignored (read - as the absolute section symbol), and the "addend" indicates the type - of instruction using the register: - 1 - "memory" fmt insn - 2 - byte-manipulation (byte offset reg) - 3 - jsr (target of branch) - - The GNU linker currently doesn't do any of this optimizing. - -ENUM - BFD_RELOC_ALPHA_HINT -ENUMDOC - The HINT relocation indicates a value that should be filled into the - "hint" field of a jmp/jsr/ret instruction, for possible branch- - prediction logic which may be provided on some processors. - -ENUM - BFD_RELOC_MIPS_JMP -ENUMDOC - Bits 27..2 of the relocation address shifted right 2 bits; - simple reloc otherwise. - -ENUM - BFD_RELOC_HI16 -ENUMDOC - High 16 bits of 32-bit value; simple reloc. -ENUM - BFD_RELOC_HI16_S -ENUMDOC - High 16 bits of 32-bit value but the low 16 bits will be sign - extended and added to form the final result. If the low 16 - bits form a negative number, we need to add one to the high value - to compensate for the borrow when the low bits are added. -ENUM - BFD_RELOC_LO16 -ENUMDOC - Low 16 bits. -ENUM - BFD_RELOC_PCREL_HI16_S -ENUMDOC - Like BFD_RELOC_HI16_S, but PC relative. -ENUM - BFD_RELOC_PCREL_LO16 -ENUMDOC - Like BFD_RELOC_LO16, but PC relative. - -ENUMEQ - BFD_RELOC_MIPS_GPREL - BFD_RELOC_GPREL16 -ENUMDOC - Relocation relative to the global pointer. - -ENUM - BFD_RELOC_MIPS_LITERAL -ENUMDOC - Relocation against a MIPS literal section. - -ENUM - BFD_RELOC_MIPS_GOT16 -ENUMX - BFD_RELOC_MIPS_CALL16 -ENUMEQX - BFD_RELOC_MIPS_GPREL32 - BFD_RELOC_GPREL32 -ENUMX - BFD_RELOC_MIPS_GOT_HI16 -ENUMX - BFD_RELOC_MIPS_GOT_LO16 -ENUMX - BFD_RELOC_MIPS_CALL_HI16 -ENUMX - BFD_RELOC_MIPS_CALL_LO16 -ENUMDOC - MIPS ELF relocations. - -ENUM - BFD_RELOC_386_GOT32 -ENUMX - BFD_RELOC_386_PLT32 -ENUMX - BFD_RELOC_386_COPY -ENUMX - BFD_RELOC_386_GLOB_DAT -ENUMX - BFD_RELOC_386_JUMP_SLOT -ENUMX - BFD_RELOC_386_RELATIVE -ENUMX - BFD_RELOC_386_GOTOFF -ENUMX - BFD_RELOC_386_GOTPC -ENUMDOC - i386/elf relocations - -ENUM - BFD_RELOC_NS32K_IMM_8 -ENUMX - BFD_RELOC_NS32K_IMM_16 -ENUMX - BFD_RELOC_NS32K_IMM_32 -ENUMX - BFD_RELOC_NS32K_IMM_8_PCREL -ENUMX - BFD_RELOC_NS32K_IMM_16_PCREL -ENUMX - BFD_RELOC_NS32K_IMM_32_PCREL -ENUMX - BFD_RELOC_NS32K_DISP_8 -ENUMX - BFD_RELOC_NS32K_DISP_16 -ENUMX - BFD_RELOC_NS32K_DISP_32 -ENUMX - BFD_RELOC_NS32K_DISP_8_PCREL -ENUMX - BFD_RELOC_NS32K_DISP_16_PCREL -ENUMX - BFD_RELOC_NS32K_DISP_32_PCREL -ENUMDOC - ns32k relocations - -ENUM - BFD_RELOC_PPC_B26 -ENUMX - BFD_RELOC_PPC_BA26 -ENUMX - BFD_RELOC_PPC_TOC16 -ENUMX - BFD_RELOC_PPC_B16 -ENUMX - BFD_RELOC_PPC_B16_BRTAKEN -ENUMX - BFD_RELOC_PPC_B16_BRNTAKEN -ENUMX - BFD_RELOC_PPC_BA16 -ENUMX - BFD_RELOC_PPC_BA16_BRTAKEN -ENUMX - BFD_RELOC_PPC_BA16_BRNTAKEN -ENUMX - BFD_RELOC_PPC_COPY -ENUMX - BFD_RELOC_PPC_GLOB_DAT -ENUMX - BFD_RELOC_PPC_JMP_SLOT -ENUMX - BFD_RELOC_PPC_RELATIVE -ENUMX - BFD_RELOC_PPC_LOCAL24PC -ENUMX - BFD_RELOC_PPC_EMB_NADDR32 -ENUMX - BFD_RELOC_PPC_EMB_NADDR16 -ENUMX - BFD_RELOC_PPC_EMB_NADDR16_LO -ENUMX - BFD_RELOC_PPC_EMB_NADDR16_HI -ENUMX - BFD_RELOC_PPC_EMB_NADDR16_HA -ENUMX - BFD_RELOC_PPC_EMB_SDAI16 -ENUMX - BFD_RELOC_PPC_EMB_SDA2I16 -ENUMX - BFD_RELOC_PPC_EMB_SDA2REL -ENUMX - BFD_RELOC_PPC_EMB_SDA21 -ENUMX - BFD_RELOC_PPC_EMB_MRKREF -ENUMX - BFD_RELOC_PPC_EMB_RELSEC16 -ENUMX - BFD_RELOC_PPC_EMB_RELST_LO -ENUMX - BFD_RELOC_PPC_EMB_RELST_HI -ENUMX - BFD_RELOC_PPC_EMB_RELST_HA -ENUMX - BFD_RELOC_PPC_EMB_BIT_FLD -ENUMX - BFD_RELOC_PPC_EMB_RELSDA -ENUMDOC - Power(rs6000) and PowerPC relocations. - -ENUM - BFD_RELOC_CTOR -ENUMDOC - The type of reloc used to build a contructor table - at the moment - probably a 32 bit wide absolute relocation, but the target can choose. - It generally does map to one of the other relocation types. - -ENUM - BFD_RELOC_ARM_PCREL_BRANCH -ENUMDOC - ARM 26 bit pc-relative branch. The lowest two bits must be zero and are - not stored in the instruction. -ENUM - BFD_RELOC_ARM_IMMEDIATE -ENUMX - BFD_RELOC_ARM_OFFSET_IMM -ENUMX - BFD_RELOC_ARM_SHIFT_IMM -ENUMX - BFD_RELOC_ARM_SWI -ENUMX - BFD_RELOC_ARM_MULTI -ENUMX - BFD_RELOC_ARM_CP_OFF_IMM -ENUMX - BFD_RELOC_ARM_ADR_IMM -ENUMX - BFD_RELOC_ARM_LDR_IMM -ENUMX - BFD_RELOC_ARM_LITERAL -ENUMX - BFD_RELOC_ARM_IN_POOL -ENUMDOC - These relocs are only used within the ARM assembler. They are not - (at present) written to any object files. - -COMMENT -ENDSENUM - BFD_RELOC_UNUSED -CODE_FRAGMENT -. -.typedef enum bfd_reloc_code_real bfd_reloc_code_real_type; -*/ - - -/* -FUNCTION - bfd_reloc_type_lookup - -SYNOPSIS - reloc_howto_type * - bfd_reloc_type_lookup (bfd *abfd, bfd_reloc_code_real_type code); - -DESCRIPTION - Return a pointer to a howto structure which, when - invoked, will perform the relocation @var{code} on data from the - architecture noted. - -*/ - - -reloc_howto_type * -bfd_reloc_type_lookup (abfd, code) - bfd *abfd; - bfd_reloc_code_real_type code; -{ - return BFD_SEND (abfd, reloc_type_lookup, (abfd, code)); -} - -static reloc_howto_type bfd_howto_32 = -HOWTO (0, 00, 2, 32, false, 0, complain_overflow_bitfield, 0, "VRT32", false, 0xffffffff, 0xffffffff, true); - - -/* -INTERNAL_FUNCTION - bfd_default_reloc_type_lookup - -SYNOPSIS - reloc_howto_type *bfd_default_reloc_type_lookup - (bfd *abfd, bfd_reloc_code_real_type code); - -DESCRIPTION - Provides a default relocation lookup routine for any architecture. - - -*/ - -reloc_howto_type * -bfd_default_reloc_type_lookup (abfd, code) - bfd *abfd; - bfd_reloc_code_real_type code; -{ - switch (code) - { - case BFD_RELOC_CTOR: - /* The type of reloc used in a ctor, which will be as wide as the - address - so either a 64, 32, or 16 bitter. */ - switch (bfd_get_arch_info (abfd)->bits_per_address) - { - case 64: - BFD_FAIL (); - case 32: - return &bfd_howto_32; - case 16: - BFD_FAIL (); - default: - BFD_FAIL (); - } - default: - BFD_FAIL (); - } - return (reloc_howto_type *) NULL; -} - -/* -FUNCTION - bfd_get_reloc_code_name - -SYNOPSIS - const char *bfd_get_reloc_code_name (bfd_reloc_code_real_type code); - -DESCRIPTION - Provides a printable name for the supplied relocation code. - Useful mainly for printing error messages. -*/ - -const char * -bfd_get_reloc_code_name (code) - bfd_reloc_code_real_type code; -{ - if (code > BFD_RELOC_UNUSED) - return 0; - return bfd_reloc_code_real_names[(int)code]; -} - -/* -INTERNAL_FUNCTION - bfd_generic_relax_section - -SYNOPSIS - boolean bfd_generic_relax_section - (bfd *abfd, - asection *section, - struct bfd_link_info *, - boolean *); - -DESCRIPTION - Provides default handling for relaxing for back ends which - don't do relaxing -- i.e., does nothing. -*/ - -/*ARGSUSED*/ -boolean -bfd_generic_relax_section (abfd, section, link_info, again) - bfd *abfd; - asection *section; - struct bfd_link_info *link_info; - boolean *again; -{ - *again = false; - return true; -} - -/* -INTERNAL_FUNCTION - bfd_generic_get_relocated_section_contents - -SYNOPSIS - bfd_byte * - bfd_generic_get_relocated_section_contents (bfd *abfd, - struct bfd_link_info *link_info, - struct bfd_link_order *link_order, - bfd_byte *data, - boolean relocateable, - asymbol **symbols); - -DESCRIPTION - Provides default handling of relocation effort for back ends - which can't be bothered to do it efficiently. - -*/ - -bfd_byte * -bfd_generic_get_relocated_section_contents (abfd, link_info, link_order, data, - relocateable, symbols) - bfd *abfd; - struct bfd_link_info *link_info; - struct bfd_link_order *link_order; - bfd_byte *data; - boolean relocateable; - asymbol **symbols; -{ - /* Get enough memory to hold the stuff */ - bfd *input_bfd = link_order->u.indirect.section->owner; - asection *input_section = link_order->u.indirect.section; - - long reloc_size = bfd_get_reloc_upper_bound (input_bfd, input_section); - arelent **reloc_vector = NULL; - long reloc_count; - - if (reloc_size < 0) - goto error_return; - - reloc_vector = (arelent **) bfd_malloc ((size_t) reloc_size); - if (reloc_vector == NULL && reloc_size != 0) - goto error_return; - - /* read in the section */ - if (!bfd_get_section_contents (input_bfd, - input_section, - (PTR) data, - 0, - input_section->_raw_size)) - goto error_return; - - /* We're not relaxing the section, so just copy the size info */ - input_section->_cooked_size = input_section->_raw_size; - input_section->reloc_done = true; - - reloc_count = bfd_canonicalize_reloc (input_bfd, - input_section, - reloc_vector, - symbols); - if (reloc_count < 0) - goto error_return; - - if (reloc_count > 0) - { - arelent **parent; - for (parent = reloc_vector; *parent != (arelent *) NULL; - parent++) - { - char *error_message = (char *) NULL; - bfd_reloc_status_type r = - bfd_perform_relocation (input_bfd, - *parent, - (PTR) data, - input_section, - relocateable ? abfd : (bfd *) NULL, - &error_message); - - if (relocateable) - { - asection *os = input_section->output_section; - - /* A partial link, so keep the relocs */ - os->orelocation[os->reloc_count] = *parent; - os->reloc_count++; - } - - if (r != bfd_reloc_ok) - { - switch (r) - { - case bfd_reloc_undefined: - if (!((*link_info->callbacks->undefined_symbol) - (link_info, bfd_asymbol_name (*(*parent)->sym_ptr_ptr), - input_bfd, input_section, (*parent)->address))) - goto error_return; - break; - case bfd_reloc_dangerous: - BFD_ASSERT (error_message != (char *) NULL); - if (!((*link_info->callbacks->reloc_dangerous) - (link_info, error_message, input_bfd, input_section, - (*parent)->address))) - goto error_return; - break; - case bfd_reloc_overflow: - if (!((*link_info->callbacks->reloc_overflow) - (link_info, bfd_asymbol_name (*(*parent)->sym_ptr_ptr), - (*parent)->howto->name, (*parent)->addend, - input_bfd, input_section, (*parent)->address))) - goto error_return; - break; - case bfd_reloc_outofrange: - default: - abort (); - break; - } - - } - } - } - if (reloc_vector != NULL) - free (reloc_vector); - return data; - -error_return: - if (reloc_vector != NULL) - free (reloc_vector); - return NULL; -} diff --git a/contrib/gdb/bfd/section.c b/contrib/gdb/bfd/section.c deleted file mode 100644 index ac9a449..0000000 --- a/contrib/gdb/bfd/section.c +++ /dev/null @@ -1,976 +0,0 @@ -/* Object file "section" support for the BFD library. - Copyright (C) 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. - Written by Cygnus Support. - -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. */ - -/* -SECTION - Sections - - The raw data contained within a BFD is maintained through the - section abstraction. A single BFD may have any number of - sections. It keeps hold of them by pointing to the first; - each one points to the next in the list. - - Sections are supported in BFD in <>. - -@menu -@* Section Input:: -@* Section Output:: -@* typedef asection:: -@* section prototypes:: -@end menu - -INODE -Section Input, Section Output, Sections, Sections -SUBSECTION - Section input - - When a BFD is opened for reading, the section structures are - created and attached to the BFD. - - Each section has a name which describes the section in the - outside world---for example, <> would contain at least - three sections, called <<.text>>, <<.data>> and <<.bss>>. - - Names need not be unique; for example a COFF file may have several - sections named <<.data>>. - - Sometimes a BFD will contain more than the ``natural'' number of - sections. A back end may attach other sections containing - constructor data, or an application may add a section (using - <>) to the sections attached to an already open - BFD. For example, the linker creates an extra section - <> for each input file's BFD to hold information about - common storage. - - The raw data is not necessarily read in when - the section descriptor is created. Some targets may leave the - data in place until a <> call is - made. Other back ends may read in all the data at once. For - example, an S-record file has to be read once to determine the - size of the data. An IEEE-695 file doesn't contain raw data in - sections, but data and relocation expressions intermixed, so - the data area has to be parsed to get out the data and - relocations. - -INODE -Section Output, typedef asection, Section Input, Sections - -SUBSECTION - Section output - - To write a new object style BFD, the various sections to be - written have to be created. They are attached to the BFD in - the same way as input sections; data is written to the - sections using <>. - - Any program that creates or combines sections (e.g., the assembler - and linker) must use the <> fields <> and - <> to indicate the file sections to which each - section must be written. (If the section is being created from - scratch, <> should probably point to the section - itself and <> should probably be zero.) - - The data to be written comes from input sections attached - (via <> pointers) to - the output sections. The output section structure can be - considered a filter for the input section: the output section - determines the vma of the output data and the name, but the - input section determines the offset into the output section of - the data to be written. - - E.g., to create a section "O", starting at 0x100, 0x123 long, - containing two subsections, "A" at offset 0x0 (i.e., at vma - 0x100) and "B" at offset 0x20 (i.e., at vma 0x120) the <> - structures would look like: - -| section name "A" -| output_offset 0x00 -| size 0x20 -| output_section -----------> section name "O" -| | vma 0x100 -| section name "B" | size 0x123 -| output_offset 0x20 | -| size 0x103 | -| output_section --------| - - -SUBSECTION - Link orders - - The data within a section is stored in a @dfn{link_order}. - These are much like the fixups in <>. The link_order - abstraction allows a section to grow and shrink within itself. - - A link_order knows how big it is, and which is the next - link_order and where the raw data for it is; it also points to - a list of relocations which apply to it. - - The link_order is used by the linker to perform relaxing on - final code. The compiler creates code which is as big as - necessary to make it work without relaxing, and the user can - select whether to relax. Sometimes relaxing takes a lot of - time. The linker runs around the relocations to see if any - are attached to data which can be shrunk, if so it does it on - a link_order by link_order basis. - -*/ - - -#include "bfd.h" -#include "sysdep.h" -#include "libbfd.h" - - -/* -DOCDD -INODE -typedef asection, section prototypes, Section Output, Sections -SUBSECTION - typedef asection - - Here is the section structure: - -CODE_FRAGMENT -. -.typedef struct sec -.{ -. {* The name of the section; the name isn't a copy, the pointer is -. the same as that passed to bfd_make_section. *} -. -. CONST char *name; -. -. {* Which section is it; 0..nth. *} -. -. int index; -. -. {* The next section in the list belonging to the BFD, or NULL. *} -. -. struct sec *next; -. -. {* The field flags contains attributes of the section. Some -. flags are read in from the object file, and some are -. synthesized from other information. *} -. -. flagword flags; -. -.#define SEC_NO_FLAGS 0x000 -. -. {* Tells the OS to allocate space for this section when loading. -. This is clear for a section containing debug information -. only. *} -.#define SEC_ALLOC 0x001 -. -. {* Tells the OS to load the section from the file when loading. -. This is clear for a .bss section. *} -.#define SEC_LOAD 0x002 -. -. {* The section contains data still to be relocated, so there is -. some relocation information too. *} -.#define SEC_RELOC 0x004 -. -.#if 0 {* Obsolete ? *} -.#define SEC_BALIGN 0x008 -.#endif -. -. {* A signal to the OS that the section contains read only -. data. *} -.#define SEC_READONLY 0x010 -. -. {* The section contains code only. *} -.#define SEC_CODE 0x020 -. -. {* The section contains data only. *} -.#define SEC_DATA 0x040 -. -. {* The section will reside in ROM. *} -.#define SEC_ROM 0x080 -. -. {* The section contains constructor information. This section -. type is used by the linker to create lists of constructors and -. destructors used by <>. When a back end sees a symbol -. which should be used in a constructor list, it creates a new -. section for the type of name (e.g., <<__CTOR_LIST__>>), attaches -. the symbol to it, and builds a relocation. To build the lists -. of constructors, all the linker has to do is catenate all the -. sections called <<__CTOR_LIST__>> and relocate the data -. contained within - exactly the operations it would peform on -. standard data. *} -.#define SEC_CONSTRUCTOR 0x100 -. -. {* The section is a constuctor, 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 -. <> | <>; a debug section could be -. <> *} -.#define SEC_HAS_CONTENTS 0x200 -. -. {* An instruction to the linker to not output the section -. even if it has information which would normally be written. *} -.#define SEC_NEVER_LOAD 0x400 -. -. {* The section is a COFF shared library section. This flag is -. only for the linker. If this type of section appears in -. the input file, the linker must copy it to the output file -. without changing the vma or size. FIXME: Although this -. was originally intended to be general, it really is COFF -. specific (and the flag was renamed to indicate this). It -. might be cleaner to have some more general mechanism to -. allow the back end to control what the linker does with -. sections. *} -.#define SEC_COFF_SHARED_LIBRARY 0x800 -. -. {* The section is a common section (symbols may be defined -. multiple times, the value of a symbol is the amount of -. space it requires, and the largest symbol value is the one -. used). Most targets have exactly one of these (which we -. translate to bfd_com_section_ptr), but ECOFF has two. *} -.#define SEC_IS_COMMON 0x8000 -. -. {* The section contains only debugging information. For -. example, this is set for ELF .debug and .stab sections. -. strip tests this flag to see if a section can be -. discarded. *} -.#define SEC_DEBUGGING 0x10000 -. -. {* The contents of this section are held in memory pointed to -. by the contents field. This is checked by -. bfd_get_section_contents, and the data is retrieved from -. memory if appropriate. *} -.#define SEC_IN_MEMORY 0x20000 -. -. {* The contents of this section are to be excluded by the -. linker for executable and shared objects unless those -. objects are to be further relocated. *} -.#define SEC_EXCLUDE 0x40000 -. -. {* The contents of this section are to be sorted by the -. based on the address specified in the associated symbol -. table. *} -.#define SEC_SORT_ENTRIES 0x80000 -. -. {* End of section flags. *} -. -. {* The virtual memory address of the section - where it will be -. at run time. The symbols are relocated against this. The -. user_set_vma flag is maintained by bfd; if it's not set, the -. backend can assign addresses (for example, in <>, where -. the default address for <<.data>> is dependent on the specific -. target and various flags). *} -. -. bfd_vma vma; -. boolean user_set_vma; -. -. {* The load address of the section - where it would be in a -. rom image; really only used for writing section header -. information. *} -. -. bfd_vma lma; -. -. {* The size of the section in bytes, as it will be output. -. contains a value even if the section has no contents (e.g., the -. size of <<.bss>>). This will be filled in after relocation *} -. -. bfd_size_type _cooked_size; -. -. {* The original size on disk of the section, in bytes. Normally this -. value is the same as the size, but if some relaxing has -. been done, then this value will be bigger. *} -. -. bfd_size_type _raw_size; -. -. {* If this section is going to be output, then this value is the -. offset into the output section of the first byte in the input -. section. E.g., if this was going to start at the 100th byte in -. the output section, this value would be 100. *} -. -. bfd_vma output_offset; -. -. {* The output section through which to map on output. *} -. -. struct sec *output_section; -. -. {* The alignment requirement of the section, as an exponent of 2 - -. e.g., 3 aligns to 2^3 (or 8). *} -. -. unsigned int alignment_power; -. -. {* If an input section, a pointer to a vector of relocation -. records for the data in this section. *} -. -. struct reloc_cache_entry *relocation; -. -. {* If an output section, a pointer to a vector of pointers to -. relocation records for the data in this section. *} -. -. struct reloc_cache_entry **orelocation; -. -. {* The number of relocation records in one of the above *} -. -. unsigned reloc_count; -. -. {* Information below is back end specific - and not always used -. or updated. *} -. -. {* File position of section data *} -. -. file_ptr filepos; -. -. {* File position of relocation info *} -. -. file_ptr rel_filepos; -. -. {* File position of line data *} -. -. file_ptr line_filepos; -. -. {* Pointer to data for applications *} -. -. PTR userdata; -. -. {* If the SEC_IN_MEMORY flag is set, this points to the actual -. contents. *} -. unsigned char *contents; -. -. {* Attached line number information *} -. -. alent *lineno; -. -. {* Number of line number records *} -. -. unsigned int lineno_count; -. -. {* When a section is being output, this value changes as more -. linenumbers are written out *} -. -. file_ptr moving_line_filepos; -. -. {* What the section number is in the target world *} -. -. int target_index; -. -. PTR used_by_bfd; -. -. {* If this is a constructor section then here is a list of the -. relocations created to relocate items within it. *} -. -. struct relent_chain *constructor_chain; -. -. {* The BFD which owns the section. *} -. -. bfd *owner; -. -. boolean reloc_done; -. {* A symbol which points at this section only *} -. struct symbol_cache_entry *symbol; -. struct symbol_cache_entry **symbol_ptr_ptr; -. -. struct bfd_link_order *link_order_head; -. struct bfd_link_order *link_order_tail; -.} asection ; -. -. {* These sections are global, and are managed by BFD. The application -. and target back end are not permitted to change the values in -. these sections. New code should use the section_ptr macros rather -. than referring directly to the const sections. The const sections -. may eventually vanish. *} -.#define BFD_ABS_SECTION_NAME "*ABS*" -.#define BFD_UND_SECTION_NAME "*UND*" -.#define BFD_COM_SECTION_NAME "*COM*" -.#define BFD_IND_SECTION_NAME "*IND*" -. -. {* the absolute section *} -.extern const asection bfd_abs_section; -.#define bfd_abs_section_ptr ((asection *) &bfd_abs_section) -.#define bfd_is_abs_section(sec) ((sec) == bfd_abs_section_ptr) -. {* Pointer to the undefined section *} -.extern const asection bfd_und_section; -.#define bfd_und_section_ptr ((asection *) &bfd_und_section) -.#define bfd_is_und_section(sec) ((sec) == bfd_und_section_ptr) -. {* Pointer to the common section *} -.extern const asection bfd_com_section; -.#define bfd_com_section_ptr ((asection *) &bfd_com_section) -. {* Pointer to the indirect section *} -.extern const asection bfd_ind_section; -.#define bfd_ind_section_ptr ((asection *) &bfd_ind_section) -.#define bfd_is_ind_section(sec) ((sec) == bfd_ind_section_ptr) -. -.extern const struct symbol_cache_entry * const bfd_abs_symbol; -.extern const struct symbol_cache_entry * const bfd_com_symbol; -.extern const struct symbol_cache_entry * const bfd_und_symbol; -.extern const struct symbol_cache_entry * const bfd_ind_symbol; -.#define bfd_get_section_size_before_reloc(section) \ -. (section->reloc_done ? (abort(),1): (section)->_raw_size) -.#define bfd_get_section_size_after_reloc(section) \ -. ((section->reloc_done) ? (section)->_cooked_size: (abort(),1)) -*/ - -/* These symbols are global, not specific to any BFD. Therefore, anything - that tries to change them is broken, and should be repaired. */ -static const asymbol global_syms[] = -{ - /* the_bfd, name, value, attr, section [, udata] */ - {0, BFD_COM_SECTION_NAME, 0, BSF_SECTION_SYM, (asection *) &bfd_com_section}, - {0, BFD_UND_SECTION_NAME, 0, BSF_SECTION_SYM, (asection *) &bfd_und_section}, - {0, BFD_ABS_SECTION_NAME, 0, BSF_SECTION_SYM, (asection *) &bfd_abs_section}, - {0, BFD_IND_SECTION_NAME, 0, BSF_SECTION_SYM, (asection *) &bfd_ind_section}, -}; - -#define STD_SECTION(SEC, FLAGS, SYM, NAME, IDX) \ - const asymbol * const SYM = (asymbol *) &global_syms[IDX]; \ - const asection SEC = \ - { NAME, 0, 0, FLAGS, 0, false, 0, 0, 0, 0, (asection *) &SEC, \ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (boolean) 0, \ - (asymbol *) &global_syms[IDX], (asymbol **) &SYM, } - -STD_SECTION (bfd_com_section, SEC_IS_COMMON, bfd_com_symbol, - BFD_COM_SECTION_NAME, 0); -STD_SECTION (bfd_und_section, 0, bfd_und_symbol, BFD_UND_SECTION_NAME, 1); -STD_SECTION (bfd_abs_section, 0, bfd_abs_symbol, BFD_ABS_SECTION_NAME, 2); -STD_SECTION (bfd_ind_section, 0, bfd_ind_symbol, BFD_IND_SECTION_NAME, 3); -#undef STD_SECTION - -/* -DOCDD -INODE -section prototypes, , typedef asection, Sections -SUBSECTION - Section prototypes - -These are the functions exported by the section handling part of BFD. -*/ - -/* -FUNCTION - bfd_get_section_by_name - -SYNOPSIS - asection *bfd_get_section_by_name(bfd *abfd, CONST char *name); - -DESCRIPTION - Run through @var{abfd} and return the one of the - <>s whose name matches @var{name}, otherwise <>. - @xref{Sections}, for more information. - - This should only be used in special cases; the normal way to process - all sections of a given name is to use <> and - <> on the name (or better yet, base it on the section flags - or something else) for each section. -*/ - -asection * -bfd_get_section_by_name (abfd, name) - bfd *abfd; - CONST char *name; -{ - asection *sect; - - for (sect = abfd->sections; sect != NULL; sect = sect->next) - if (!strcmp (sect->name, name)) - return sect; - return NULL; -} - - -/* -FUNCTION - bfd_make_section_old_way - -SYNOPSIS - asection *bfd_make_section_old_way(bfd *abfd, CONST char *name); - -DESCRIPTION - Create a new empty section called @var{name} - and attach it to the end of the chain of sections for the - BFD @var{abfd}. An attempt to create a section with a name which - is already in use returns its pointer without changing the - section chain. - - It has the funny name since this is the way it used to be - before it was rewritten.... - - Possible errors are: - o <> - - If output has already started for this BFD. - o <> - - If obstack alloc fails. - -*/ - - -asection * -bfd_make_section_old_way (abfd, name) - bfd *abfd; - CONST char *name; -{ - asection *sec = bfd_get_section_by_name (abfd, name); - if (sec == (asection *) NULL) - { - sec = bfd_make_section (abfd, name); - } - return sec; -} - -/* -FUNCTION - bfd_make_section_anyway - -SYNOPSIS - asection *bfd_make_section_anyway(bfd *abfd, CONST char *name); - -DESCRIPTION - Create a new empty section called @var{name} and attach it to the end of - the chain of sections for @var{abfd}. Create a new section even if there - is already a section with that name. - - Return <> and set <> on error; possible errors are: - o <> - If output has already started for @var{abfd}. - o <> - If obstack alloc fails. -*/ - -sec_ptr -bfd_make_section_anyway (abfd, name) - bfd *abfd; - CONST char *name; -{ - asection *newsect; - asection **prev = &abfd->sections; - asection *sect = abfd->sections; - - if (abfd->output_has_begun) - { - bfd_set_error (bfd_error_invalid_operation); - return NULL; - } - - while (sect) - { - prev = §->next; - sect = sect->next; - } - - newsect = (asection *) bfd_zalloc (abfd, sizeof (asection)); - if (newsect == NULL) - return NULL; - - newsect->name = name; - newsect->index = abfd->section_count++; - newsect->flags = SEC_NO_FLAGS; - - newsect->userdata = NULL; - newsect->contents = NULL; - newsect->next = (asection *) NULL; - newsect->relocation = (arelent *) NULL; - newsect->reloc_count = 0; - newsect->line_filepos = 0; - newsect->owner = abfd; - - /* Create a symbol whos only job is to point to this section. This is - useful for things like relocs which are relative to the base of a - section. */ - newsect->symbol = bfd_make_empty_symbol (abfd); - if (newsect->symbol == NULL) - return NULL; - newsect->symbol->name = name; - newsect->symbol->value = 0; - newsect->symbol->section = newsect; - newsect->symbol->flags = BSF_SECTION_SYM; - - newsect->symbol_ptr_ptr = &newsect->symbol; - - if (BFD_SEND (abfd, _new_section_hook, (abfd, newsect)) != true) - { - free (newsect); - return NULL; - } - - *prev = newsect; - return newsect; -} - -/* -FUNCTION - bfd_make_section - -SYNOPSIS - asection *bfd_make_section(bfd *, CONST char *name); - -DESCRIPTION - Like <>, but return <> (without calling - bfd_set_error ()) without changing the section chain if there is already a - section named @var{name}. If there is an error, return <> and set - <>. -*/ - -asection * -bfd_make_section (abfd, name) - bfd *abfd; - CONST char *name; -{ - asection *sect = abfd->sections; - - if (strcmp (name, BFD_ABS_SECTION_NAME) == 0) - { - return bfd_abs_section_ptr; - } - if (strcmp (name, BFD_COM_SECTION_NAME) == 0) - { - return bfd_com_section_ptr; - } - if (strcmp (name, BFD_UND_SECTION_NAME) == 0) - { - return bfd_und_section_ptr; - } - - if (strcmp (name, BFD_IND_SECTION_NAME) == 0) - { - return bfd_ind_section_ptr; - } - - while (sect) - { - if (!strcmp (sect->name, name)) - return NULL; - sect = sect->next; - } - - /* The name is not already used; go ahead and make a new section. */ - return bfd_make_section_anyway (abfd, name); -} - - -/* -FUNCTION - bfd_set_section_flags - -SYNOPSIS - boolean bfd_set_section_flags(bfd *abfd, asection *sec, flagword flags); - -DESCRIPTION - Set the attributes of the section @var{sec} in the BFD - @var{abfd} to the value @var{flags}. Return <> on success, - <> on error. Possible error returns are: - - o <> - - The section cannot have one or more of the attributes - requested. For example, a .bss section in <> may not - have the <> field set. - -*/ - -/*ARGSUSED*/ -boolean -bfd_set_section_flags (abfd, section, flags) - bfd *abfd; - sec_ptr section; - flagword flags; -{ -#if 0 - /* If you try to copy a text section from an input file (where it - has the SEC_CODE flag set) to an output file, this loses big if - the bfd_applicable_section_flags (abfd) doesn't have the SEC_CODE - set - which it doesn't, at least not for a.out. FIXME */ - - if ((flags & bfd_applicable_section_flags (abfd)) != flags) - { - bfd_set_error (bfd_error_invalid_operation); - return false; - } -#endif - - section->flags = flags; - return true; -} - - -/* -FUNCTION - bfd_map_over_sections - -SYNOPSIS - void bfd_map_over_sections(bfd *abfd, - void (*func)(bfd *abfd, - asection *sect, - PTR obj), - PTR obj); - -DESCRIPTION - Call the provided function @var{func} for each section - attached to the BFD @var{abfd}, passing @var{obj} as an - argument. The function will be called as if by - -| func(abfd, the_section, obj); - - This is the prefered method for iterating over sections; an - alternative would be to use a loop: - -| section *p; -| for (p = abfd->sections; p != NULL; p = p->next) -| func(abfd, p, ...) - - -*/ - -/*VARARGS2*/ -void -bfd_map_over_sections (abfd, operation, user_storage) - bfd *abfd; - void (*operation) PARAMS ((bfd * abfd, asection * sect, PTR obj)); - PTR user_storage; -{ - asection *sect; - unsigned int i = 0; - - for (sect = abfd->sections; sect != NULL; i++, sect = sect->next) - (*operation) (abfd, sect, user_storage); - - if (i != abfd->section_count) /* Debugging */ - abort (); -} - - -/* -FUNCTION - bfd_set_section_size - -SYNOPSIS - boolean bfd_set_section_size(bfd *abfd, asection *sec, bfd_size_type val); - -DESCRIPTION - Set @var{sec} to the size @var{val}. If the operation is - ok, then <> is returned, else <>. - - Possible error returns: - o <> - - Writing has started to the BFD, so setting the size is invalid. - -*/ - -boolean -bfd_set_section_size (abfd, ptr, val) - bfd *abfd; - sec_ptr ptr; - bfd_size_type val; -{ - /* Once you've started writing to any section you cannot create or change - the size of any others. */ - - if (abfd->output_has_begun) - { - bfd_set_error (bfd_error_invalid_operation); - return false; - } - - ptr->_cooked_size = val; - ptr->_raw_size = val; - - return true; -} - -/* -FUNCTION - bfd_set_section_contents - -SYNOPSIS - boolean bfd_set_section_contents - (bfd *abfd, - asection *section, - PTR data, - file_ptr offset, - bfd_size_type count); - - -DESCRIPTION - Sets the contents of the section @var{section} in BFD - @var{abfd} to the data starting in memory at @var{data}. The - data is written to the output section starting at offset - @var{offset} for @var{count} bytes. - - - - Normally <> is returned, else <>. Possible error - returns are: - o <> - - The output section does not have the <> - attribute, so nothing can be written to it. - o and some more too - - This routine is front end to the back end function - <<_bfd_set_section_contents>>. - - -*/ - -#define bfd_get_section_size_now(abfd,sec) \ -(sec->reloc_done \ - ? bfd_get_section_size_after_reloc (sec) \ - : bfd_get_section_size_before_reloc (sec)) - -boolean -bfd_set_section_contents (abfd, section, location, offset, count) - bfd *abfd; - sec_ptr section; - PTR location; - file_ptr offset; - bfd_size_type count; -{ - bfd_size_type sz; - - if (!(bfd_get_section_flags (abfd, section) & SEC_HAS_CONTENTS)) - { - bfd_set_error (bfd_error_no_contents); - return (false); - } - - if (offset < 0) - { - bad_val: - bfd_set_error (bfd_error_bad_value); - return false; - } - sz = bfd_get_section_size_now (abfd, section); - if ((bfd_size_type) offset > sz - || count > sz - || offset + count > sz) - goto bad_val; - - switch (abfd->direction) - { - case read_direction: - case no_direction: - bfd_set_error (bfd_error_invalid_operation); - return false; - - case write_direction: - break; - - case both_direction: - /* File is opened for update. `output_has_begun' some time ago when - the file was created. Do not recompute sections sizes or alignments - in _bfd_set_section_content. */ - abfd->output_has_begun = true; - break; - } - - if (BFD_SEND (abfd, _bfd_set_section_contents, - (abfd, section, location, offset, count))) - { - abfd->output_has_begun = true; - return true; - } - - return false; -} - -/* -FUNCTION - bfd_get_section_contents - -SYNOPSIS - boolean bfd_get_section_contents - (bfd *abfd, asection *section, PTR location, - file_ptr offset, bfd_size_type count); - -DESCRIPTION - Read data from @var{section} in BFD @var{abfd} - into memory starting at @var{location}. The data is read at an - offset of @var{offset} from the start of the input section, - and is read for @var{count} bytes. - - If the contents of a constructor with the <> - flag set are requested or if the section does not have the - <> flag set, then the @var{location} is filled - with zeroes. If no errors occur, <> is returned, else - <>. - - - -*/ -boolean -bfd_get_section_contents (abfd, section, location, offset, count) - bfd *abfd; - sec_ptr section; - PTR location; - file_ptr offset; - bfd_size_type count; -{ - bfd_size_type sz; - - if (section->flags & SEC_CONSTRUCTOR) - { - memset (location, 0, (unsigned) count); - return true; - } - - if (offset < 0) - { - bad_val: - bfd_set_error (bfd_error_bad_value); - return false; - } - /* Even if reloc_done is true, this function reads unrelocated - contents, so we want the raw size. */ - sz = section->_raw_size; - if ((bfd_size_type) offset > sz || count > sz || offset + count > sz) - goto bad_val; - - if (count == 0) - /* Don't bother. */ - return true; - - if ((section->flags & SEC_HAS_CONTENTS) == 0) - { - memset (location, 0, (unsigned) count); - return true; - } - - if ((section->flags & SEC_IN_MEMORY) != 0) - { - memcpy (location, section->contents + offset, (size_t) count); - return true; - } - - return BFD_SEND (abfd, _bfd_get_section_contents, - (abfd, section, location, offset, count)); -} - -/* -FUNCTION - bfd_copy_private_section_data - -SYNOPSIS - boolean bfd_copy_private_section_data(bfd *ibfd, asection *isec, bfd *obfd, asection *osec); - -DESCRIPTION - Copy private section information from @var{isec} in the BFD - @var{ibfd} to the section @var{osec} in the BFD @var{obfd}. - Return <> on success, <> on error. Possible error - returns are: - - o <> - - Not enough memory exists to create private data for @var{osec}. - -.#define bfd_copy_private_section_data(ibfd, isection, obfd, osection) \ -. BFD_SEND (ibfd, _bfd_copy_private_section_data, \ -. (ibfd, isection, obfd, osection)) -*/ diff --git a/contrib/gdb/bfd/srec.c b/contrib/gdb/bfd/srec.c deleted file mode 100644 index 33d28d5..0000000 --- a/contrib/gdb/bfd/srec.c +++ /dev/null @@ -1,1324 +0,0 @@ -/* BFD back-end for s-record objects. - Copyright 1990, 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc. - Written by Steve Chamberlain of Cygnus Support . - -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. */ - -/* -SUBSECTION - S-Record handling - -DESCRIPTION - - Ordinary S-Records cannot hold anything but addresses and - data, so that's all that we implement. - - The only interesting thing is that S-Records may come out of - order and there is no header, so an initial scan is required - to discover the minimum and maximum addresses used to create - the vma and size of the only section we create. We - arbitrarily call this section ".text". - - When bfd_get_section_contents is called the file is read - again, and this time the data is placed into a bfd_alloc'd - area. - - Any number of sections may be created for output, we save them - up and output them when it's time to close the bfd. - - An s record looks like: - -EXAMPLE - S
- -DESCRIPTION - Where - o length - is the number of bytes following upto the checksum. Note that - this is not the number of chars following, since it takes two - chars to represent a byte. - o type - is one of: - 0) header record - 1) two byte address data record - 2) three byte address data record - 3) four byte address data record - 7) four byte address termination record - 8) three byte address termination record - 9) two byte address termination record - - o address - is the start address of the data following, or in the case of - a termination record, the start address of the image - o data - is the data. - o checksum - is the sum of all the raw byte data in the record, from the length - upwards, modulo 256 and subtracted from 255. - - -SUBSECTION - Symbol S-Record handling - -DESCRIPTION - Some ICE equipment understands an addition to the standard - S-Record format; symbols and their addresses can be sent - before the data. - - The format of this is: - ($$ - (
)*) - $$ - - so a short symbol table could look like: - -EXAMPLE - $$ flash.x - $$ flash.c - _port6 $0 - _delay $4 - _start $14 - _etext $8036 - _edata $8036 - _end $8036 - $$ - -DESCRIPTION - We allow symbols to be anywhere in the data stream - the module names - are always ignored. - -*/ - -#include "bfd.h" -#include "sysdep.h" -#include "libbfd.h" -#include "libiberty.h" -#include - -static void srec_init PARAMS ((void)); -static boolean srec_mkobject PARAMS ((bfd *)); -static int srec_get_byte PARAMS ((bfd *, boolean *)); -static void srec_bad_byte PARAMS ((bfd *, unsigned int, int, boolean)); -static boolean srec_scan PARAMS ((bfd *)); -static const bfd_target *srec_object_p PARAMS ((bfd *)); -static const bfd_target *symbolsrec_object_p PARAMS ((bfd *)); -static boolean srec_read_section PARAMS ((bfd *, asection *, bfd_byte *)); - -static boolean srec_write_record PARAMS ((bfd *, int, bfd_vma, - const bfd_byte *, - const bfd_byte *)); -static boolean srec_write_header PARAMS ((bfd *)); -static boolean srec_write_symbols PARAMS ((bfd *)); - -/* Macros for converting between hex and binary. */ - -static CONST char digs[] = "0123456789ABCDEF"; - -#define NIBBLE(x) hex_value(x) -#define HEX(buffer) ((NIBBLE((buffer)[0])<<4) + NIBBLE((buffer)[1])) -#define TOHEX(d, x, ch) \ - d[1] = digs[(x) & 0xf]; \ - d[0] = digs[((x)>>4)&0xf]; \ - ch += ((x) & 0xff); -#define ISHEX(x) hex_p(x) - -/* Initialize by filling in the hex conversion array. */ - -static void -srec_init () -{ - static boolean inited = false; - - if (inited == false) - { - inited = true; - hex_init (); - } -} - -/* The maximum number of bytes on a line is FF */ -#define MAXCHUNK 0xff -/* The number of bytes we fit onto a line on output */ -#define CHUNK 21 - -/* When writing an S-record file, the S-records can not be output as - they are seen. This structure is used to hold them in memory. */ - -struct srec_data_list_struct -{ - struct srec_data_list_struct *next; - bfd_byte *data; - bfd_vma where; - bfd_size_type size; -}; - -typedef struct srec_data_list_struct srec_data_list_type; - -/* When scanning the S-record file, a linked list of srec_symbol - structures is built to represent the symbol table (if there is - one). */ - -struct srec_symbol -{ - struct srec_symbol *next; - const char *name; - bfd_vma val; -}; - -/* The S-record tdata information. */ - -typedef struct srec_data_struct - { - srec_data_list_type *head; - srec_data_list_type *tail; - unsigned int type; - struct srec_symbol *symbols; - struct srec_symbol *symtail; - asymbol *csymbols; - } -tdata_type; - -static boolean srec_write_section PARAMS ((bfd *, tdata_type *, - srec_data_list_type *)); -static boolean srec_write_terminator PARAMS ((bfd *, tdata_type *)); - -/* Set up the S-record tdata information. */ - -static boolean -srec_mkobject (abfd) - bfd *abfd; -{ - srec_init (); - - if (abfd->tdata.srec_data == NULL) - { - tdata_type *tdata = (tdata_type *) bfd_alloc (abfd, sizeof (tdata_type)); - if (tdata == NULL) - return false; - abfd->tdata.srec_data = tdata; - tdata->type = 1; - tdata->head = NULL; - tdata->tail = NULL; - tdata->symbols = NULL; - tdata->symtail = NULL; - tdata->csymbols = NULL; - } - - return true; -} - -/* Read a byte from an S record file. Set *ERRORPTR if an error - occurred. Return EOF on error or end of file. */ - -static int -srec_get_byte (abfd, errorptr) - bfd *abfd; - boolean *errorptr; -{ - bfd_byte c; - - if (bfd_read (&c, 1, 1, abfd) != 1) - { - if (bfd_get_error () != bfd_error_file_truncated) - *errorptr = true; - return EOF; - } - - return (int) (c & 0xff); -} - -/* Report a problem in an S record file. FIXME: This probably should - not call fprintf, but we really do need some mechanism for printing - error messages. */ - -static void -srec_bad_byte (abfd, lineno, c, error) - bfd *abfd; - unsigned int lineno; - int c; - boolean error; -{ - if (c == EOF) - { - if (! error) - bfd_set_error (bfd_error_file_truncated); - } - else - { - char buf[10]; - - if (! isprint (c)) - sprintf (buf, "\\%03o", (unsigned int) c); - else - { - buf[0] = c; - buf[1] = '\0'; - } - (*_bfd_error_handler) - ("%s:%d: Unexpected character `%s' in S-record file\n", - bfd_get_filename (abfd), lineno, buf); - bfd_set_error (bfd_error_bad_value); - } -} - -/* Add a new symbol found in an S-record file. */ - -static boolean -srec_new_symbol (abfd, name, val) - bfd *abfd; - const char *name; - bfd_vma val; -{ - struct srec_symbol *n; - - n = (struct srec_symbol *) bfd_alloc (abfd, sizeof (struct srec_symbol)); - if (n == NULL) - return false; - - n->name = name; - n->val = val; - - if (abfd->tdata.srec_data->symbols == NULL) - abfd->tdata.srec_data->symbols = n; - else - abfd->tdata.srec_data->symtail->next = n; - abfd->tdata.srec_data->symtail = n; - n->next = NULL; - - ++abfd->symcount; - - return true; -} - -/* Read the S record file and turn it into sections. We create a new - section for each contiguous set of bytes. */ - -static boolean -srec_scan (abfd) - bfd *abfd; -{ - int c; - unsigned int lineno = 1; - boolean error = false; - bfd_byte *buf = NULL; - size_t bufsize = 0; - asection *sec = NULL; - - if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) - goto error_return; - - while ((c = srec_get_byte (abfd, &error)) != EOF) - { - /* We only build sections from contiguous S-records, so if this - is not an S-record, then stop building a section. */ - if (c != 'S' && c != '\r' && c != '\n') - sec = NULL; - - switch (c) - { - default: - srec_bad_byte (abfd, lineno, c, error); - goto error_return; - - case '\n': - ++lineno; - break; - - case '\r': - break; - - case '$': - /* Starting a module name, which we ignore. */ - while ((c = srec_get_byte (abfd, &error)) != '\n' - && c != EOF) - ; - if (c == EOF) - { - srec_bad_byte (abfd, lineno, c, error); - goto error_return; - } - - ++lineno; - - break; - - case ' ': - { - char *symname; - bfd_vma symval; - - /* Starting a symbol definition. */ - while ((c = srec_get_byte (abfd, &error)) != EOF - && (c == ' ' || c == '\t')) - ; - if (c == EOF) - { - srec_bad_byte (abfd, lineno, c, error); - goto error_return; - } - - obstack_1grow (&abfd->memory, c); - while ((c = srec_get_byte (abfd, &error)) != EOF - && ! isspace (c)) - obstack_1grow (&abfd->memory, c); - if (c == EOF) - { - srec_bad_byte (abfd, lineno, c, error); - goto error_return; - } - - symname = obstack_finish (&abfd->memory); - if (symname == NULL) - { - bfd_set_error (bfd_error_no_memory); - goto error_return; - } - - while ((c = srec_get_byte (abfd, &error)) != EOF - && (c == ' ' || c == '\t')) - ; - if (c == EOF) - { - srec_bad_byte (abfd, lineno, c, error); - goto error_return; - } - - /* Skip a dollar sign before the hex value. */ - if (c == '$') - { - c = srec_get_byte (abfd, &error); - if (c == EOF) - { - srec_bad_byte (abfd, lineno, c, error); - goto error_return; - } - } - - symval = 0; - while (ISHEX (c)) - { - symval <<= 4; - symval += NIBBLE (c); - c = srec_get_byte (abfd, &error); - } - - if (c == EOF || ! isspace (c)) - { - srec_bad_byte (abfd, lineno, c, error); - goto error_return; - } - - if (! srec_new_symbol (abfd, symname, symval)) - goto error_return; - - if (c == '\n') - ++lineno; - - } - break; - - case 'S': - { - file_ptr pos; - char hdr[3]; - unsigned int bytes; - bfd_vma address; - bfd_byte *data; - - /* Starting an S-record. */ - - pos = bfd_tell (abfd) - 1; - - if (bfd_read (hdr, 1, 3, abfd) != 3) - goto error_return; - - if (! ISHEX (hdr[1]) || ! ISHEX (hdr[2])) - { - if (! ISHEX (hdr[1])) - c = hdr[1]; - else - c = hdr[2]; - srec_bad_byte (abfd, lineno, c, error); - goto error_return; - } - - bytes = HEX (hdr + 1); - if (bytes * 2 > bufsize) - { - if (buf != NULL) - free (buf); - buf = (bfd_byte *) bfd_malloc (bytes * 2); - if (buf == NULL) - goto error_return; - bufsize = bytes * 2; - } - - if (bfd_read (buf, 1, bytes * 2, abfd) != bytes * 2) - goto error_return; - - /* Ignore the checksum byte. */ - --bytes; - - address = 0; - data = buf; - switch (hdr[0]) - { - case '0': - case '5': - /* Prologue--ignore the file name, but stop building a - section at this point. */ - sec = NULL; - break; - - case '3': - address = HEX (data); - data += 2; - --bytes; - /* Fall through. */ - case '2': - address = (address << 8) | HEX (data); - data += 2; - --bytes; - /* Fall through. */ - case '1': - address = (address << 8) | HEX (data); - data += 2; - address = (address << 8) | HEX (data); - data += 2; - bytes -= 2; - - if (sec != NULL - && sec->vma + sec->_raw_size == address) - { - /* This data goes at the end of the section we are - currently building. */ - sec->_raw_size += bytes; - } - else - { - char secbuf[20]; - char *secname; - - sprintf (secbuf, ".sec%d", bfd_count_sections (abfd) + 1); - secname = (char *) bfd_alloc (abfd, strlen (secbuf) + 1); - strcpy (secname, secbuf); - sec = bfd_make_section (abfd, secname); - if (sec == NULL) - goto error_return; - sec->flags = SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC; - sec->vma = address; - sec->lma = address; - sec->_raw_size = bytes; - sec->filepos = pos; - } - - break; - - case '7': - address = HEX (data); - data += 2; - /* Fall through. */ - case '8': - address = (address << 8) | HEX (data); - data += 2; - /* Fall through. */ - case '9': - address = (address << 8) | HEX (data); - data += 2; - address = (address << 8) | HEX (data); - data += 2; - - /* This is a termination record. */ - abfd->start_address = address; - - if (buf != NULL) - free (buf); - - return true; - } - } - break; - } - } - - if (error) - goto error_return; - - if (buf != NULL) - free (buf); - - return true; - - error_return: - if (buf != NULL) - free (buf); - return false; -} - -/* Check whether an existing file is an S-record file. */ - -static const bfd_target * -srec_object_p (abfd) - bfd *abfd; -{ - bfd_byte b[4]; - - srec_init (); - - if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0 - || bfd_read (b, 1, 4, abfd) != 4) - return NULL; - - if (b[0] != 'S' || !ISHEX (b[1]) || !ISHEX (b[2]) || !ISHEX (b[3])) - { - bfd_set_error (bfd_error_wrong_format); - return NULL; - } - - if (! srec_mkobject (abfd) - || ! srec_scan (abfd)) - return NULL; - - return abfd->xvec; -} - -/* Check whether an existing file is an S-record file with symbols. */ - -static const bfd_target * -symbolsrec_object_p (abfd) - bfd *abfd; -{ - char b[2]; - - srec_init (); - - if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0 - || bfd_read (b, 1, 2, abfd) != 2) - return NULL; - - if (b[0] != '$' || b[1] != '$') - { - bfd_set_error (bfd_error_wrong_format); - return NULL; - } - - if (! srec_mkobject (abfd) - || ! srec_scan (abfd)) - return NULL; - - return abfd->xvec; -} - -/* Read in the contents of a section in an S-record file. */ - -static boolean -srec_read_section (abfd, section, contents) - bfd *abfd; - asection *section; - bfd_byte *contents; -{ - int c; - bfd_size_type sofar = 0; - boolean error = false; - bfd_byte *buf = NULL; - size_t bufsize = 0; - - if (bfd_seek (abfd, section->filepos, SEEK_SET) != 0) - goto error_return; - - while ((c = srec_get_byte (abfd, &error)) != EOF) - { - bfd_byte hdr[3]; - unsigned int bytes; - bfd_vma address; - bfd_byte *data; - - if (c == '\r' || c == '\n') - continue; - - /* This is called after srec_scan has already been called, so we - ought to know the exact format. */ - BFD_ASSERT (c == 'S'); - - if (bfd_read (hdr, 1, 3, abfd) != 3) - goto error_return; - - BFD_ASSERT (ISHEX (hdr[1]) && ISHEX (hdr[2])); - - bytes = HEX (hdr + 1); - - if (bytes * 2 > bufsize) - { - if (buf != NULL) - free (buf); - buf = (bfd_byte *) bfd_malloc (bytes * 2); - if (buf == NULL) - goto error_return; - bufsize = bytes * 2; - } - - if (bfd_read (buf, 1, bytes * 2, abfd) != bytes * 2) - goto error_return; - - address = 0; - data = buf; - switch (hdr[0]) - { - default: - BFD_ASSERT (sofar == section->_raw_size); - if (buf != NULL) - free (buf); - return true; - - case '3': - address = HEX (data); - data += 2; - --bytes; - /* Fall through. */ - case '2': - address = (address << 8) | HEX (data); - data += 2; - --bytes; - /* Fall through. */ - case '1': - address = (address << 8) | HEX (data); - data += 2; - address = (address << 8) | HEX (data); - data += 2; - bytes -= 2; - - if (address != section->vma + sofar) - { - /* We've come to the end of this section. */ - BFD_ASSERT (sofar == section->_raw_size); - if (buf != NULL) - free (buf); - return true; - } - - /* Don't consider checksum. */ - --bytes; - - while (bytes-- != 0) - { - contents[sofar] = HEX (data); - data += 2; - ++sofar; - } - - break; - } - } - - if (error) - goto error_return; - - BFD_ASSERT (sofar == section->_raw_size); - - if (buf != NULL) - free (buf); - - return true; - - error_return: - if (buf != NULL) - free (buf); - return false; -} - -/* Get the contents of a section in an S-record file. */ - -static boolean -srec_get_section_contents (abfd, section, location, offset, count) - bfd *abfd; - asection *section; - PTR location; - file_ptr offset; - bfd_size_type count; -{ - if (section->used_by_bfd == NULL) - { - section->used_by_bfd = bfd_alloc (abfd, section->_raw_size); - if (section->used_by_bfd == NULL - && section->_raw_size != 0) - return false; - - if (! srec_read_section (abfd, section, section->used_by_bfd)) - return false; - } - - memcpy (location, (bfd_byte *) section->used_by_bfd + offset, - (size_t) count); - - return true; -} - -/* we have to save up all the Srecords for a splurge before output */ - -static boolean -srec_set_section_contents (abfd, section, location, offset, bytes_to_do) - bfd *abfd; - sec_ptr section; - PTR location; - file_ptr offset; - bfd_size_type bytes_to_do; -{ - tdata_type *tdata = abfd->tdata.srec_data; - register srec_data_list_type *entry; - - entry = ((srec_data_list_type *) - bfd_alloc (abfd, sizeof (srec_data_list_type))); - if (entry == NULL) - return false; - - if (bytes_to_do - && (section->flags & SEC_ALLOC) - && (section->flags & SEC_LOAD)) - { - bfd_byte *data = (bfd_byte *) bfd_alloc (abfd, bytes_to_do); - if (data == NULL) - return false; - memcpy ((PTR) data, location, (size_t) bytes_to_do); - - if ((section->lma + offset + bytes_to_do - 1) <= 0xffff) - { - - } - else if ((section->lma + offset + bytes_to_do - 1) <= 0xffffff - && tdata->type < 2) - { - tdata->type = 2; - } - else - { - tdata->type = 3; - } - - entry->data = data; - entry->where = section->lma + offset; - entry->size = bytes_to_do; - - /* Sort the records by address. Optimize for the common case of - adding a record to the end of the list. */ - if (tdata->tail != NULL - && entry->where >= tdata->tail->where) - { - tdata->tail->next = entry; - entry->next = NULL; - tdata->tail = entry; - } - else - { - register srec_data_list_type **look; - - for (look = &tdata->head; - *look != NULL && (*look)->where < entry->where; - look = &(*look)->next) - ; - entry->next = *look; - *look = entry; - if (entry->next == NULL) - tdata->tail = entry; - } - } - return true; -} - -/* Write a record of type, of the supplied number of bytes. The - supplied bytes and length don't have a checksum. That's worked out - here -*/ -static boolean -srec_write_record (abfd, type, address, data, end) - bfd *abfd; - int type; - bfd_vma address; - const bfd_byte *data; - const bfd_byte *end; -{ - char buffer[MAXCHUNK]; - unsigned int check_sum = 0; - CONST bfd_byte *src = data; - char *dst = buffer; - char *length; - bfd_size_type wrlen; - - *dst++ = 'S'; - *dst++ = '0' + type; - - length = dst; - dst += 2; /* leave room for dst*/ - - switch (type) - { - case 3: - case 7: - TOHEX (dst, (address >> 24), check_sum); - dst += 2; - case 8: - case 2: - TOHEX (dst, (address >> 16), check_sum); - dst += 2; - case 9: - case 1: - case 0: - TOHEX (dst, (address >> 8), check_sum); - dst += 2; - TOHEX (dst, (address), check_sum); - dst += 2; - break; - - } - for (src = data; src < end; src++) - { - TOHEX (dst, *src, check_sum); - dst += 2; - } - - /* Fill in the length */ - TOHEX (length, (dst - length) / 2, check_sum); - check_sum &= 0xff; - check_sum = 255 - check_sum; - TOHEX (dst, check_sum, check_sum); - dst += 2; - - *dst++ = '\r'; - *dst++ = '\n'; - wrlen = dst - buffer; - if (bfd_write ((PTR) buffer, 1, wrlen, abfd) != wrlen) - return false; - return true; -} - - - -static boolean -srec_write_header (abfd) - bfd *abfd; -{ - bfd_byte buffer[MAXCHUNK]; - bfd_byte *dst = buffer; - unsigned int i; - - /* I'll put an arbitary 40 char limit on header size */ - for (i = 0; i < 40 && abfd->filename[i]; i++) - { - *dst++ = abfd->filename[i]; - } - return srec_write_record (abfd, 0, 0, buffer, dst); -} - -static boolean -srec_write_section (abfd, tdata, list) - bfd *abfd; - tdata_type *tdata; - srec_data_list_type *list; -{ - unsigned int bytes_written = 0; - bfd_byte *location = list->data; - - while (bytes_written < list->size) - { - bfd_vma address; - - unsigned int bytes_this_chunk = list->size - bytes_written; - - if (bytes_this_chunk > CHUNK) - { - bytes_this_chunk = CHUNK; - } - - address = list->where + bytes_written; - - if (! srec_write_record (abfd, - tdata->type, - address, - location, - location + bytes_this_chunk)) - return false; - - bytes_written += bytes_this_chunk; - location += bytes_this_chunk; - } - - return true; -} - -static boolean -srec_write_terminator (abfd, tdata) - bfd *abfd; - tdata_type *tdata; -{ - bfd_byte buffer[2]; - - return srec_write_record (abfd, 10 - tdata->type, - abfd->start_address, buffer, buffer); -} - - - -static boolean -srec_write_symbols (abfd) - bfd *abfd; -{ - char buffer[MAXCHUNK]; - /* Dump out the symbols of a bfd */ - int i; - int count = bfd_get_symcount (abfd); - - if (count) - { - size_t len; - asymbol **table = bfd_get_outsymbols (abfd); - sprintf (buffer, "$$ %s\r\n", abfd->filename); - - len = strlen (buffer); - if (bfd_write (buffer, len, 1, abfd) != len) - return false; - - for (i = 0; i < count; i++) - { - asymbol *s = table[i]; -#if 0 - int len = strlen (s->name); - - /* If this symbol has a .[ocs] in it, it's probably a file name - and we'll output that as the module name */ - - if (len > 3 && s->name[len - 2] == '.') - { - int l; - sprintf (buffer, "$$ %s\r\n", s->name); - l = strlen (buffer); - if (bfd_write (buffer, l, 1, abfd) != l) - return false; - } - else -#endif - if (s->flags & (BSF_GLOBAL | BSF_LOCAL) - && (s->flags & BSF_DEBUGGING) == 0 - && s->name[0] != '.' - && s->name[0] != 't') - { - /* Just dump out non debug symbols */ - bfd_size_type l; - char buf2[40], *p; - - sprintf_vma (buf2, - s->value + s->section->output_section->lma - + s->section->output_offset); - p = buf2; - while (p[0] == '0' && p[1] != 0) - p++; - sprintf (buffer, " %s $%s\r\n", s->name, p); - l = strlen (buffer); - if (bfd_write (buffer, l, 1, abfd) != l) - return false; - } - } - sprintf (buffer, "$$ \r\n"); - len = strlen (buffer); - if (bfd_write (buffer, len, 1, abfd) != len) - return false; - } - - return true; -} - -static boolean -internal_srec_write_object_contents (abfd, symbols) - bfd *abfd; - int symbols; -{ - tdata_type *tdata = abfd->tdata.srec_data; - srec_data_list_type *list; - - if (symbols) - { - if (! srec_write_symbols (abfd)) - return false; - } - - if (! srec_write_header (abfd)) - return false; - - /* Now wander though all the sections provided and output them */ - list = tdata->head; - - while (list != (srec_data_list_type *) NULL) - { - if (! srec_write_section (abfd, tdata, list)) - return false; - list = list->next; - } - return srec_write_terminator (abfd, tdata); -} - -static boolean -srec_write_object_contents (abfd) - bfd *abfd; -{ - return internal_srec_write_object_contents (abfd, 0); -} - -static boolean -symbolsrec_write_object_contents (abfd) - bfd *abfd; -{ - return internal_srec_write_object_contents (abfd, 1); -} - -/*ARGSUSED*/ -static int -srec_sizeof_headers (abfd, exec) - bfd *abfd; - boolean exec; -{ - return 0; -} - -static asymbol * -srec_make_empty_symbol (abfd) - bfd *abfd; -{ - asymbol *new = (asymbol *) bfd_zalloc (abfd, sizeof (asymbol)); - if (new) - new->the_bfd = abfd; - return new; -} - -/* Return the amount of memory needed to read the symbol table. */ - -static long -srec_get_symtab_upper_bound (abfd) - bfd *abfd; -{ - return (bfd_get_symcount (abfd) + 1) * sizeof (asymbol *); -} - -/* Return the symbol table. */ - -static long -srec_get_symtab (abfd, alocation) - bfd *abfd; - asymbol **alocation; -{ - unsigned int symcount = bfd_get_symcount (abfd); - asymbol *csymbols; - unsigned int i; - - csymbols = abfd->tdata.srec_data->csymbols; - if (csymbols == NULL) - { - asymbol *c; - struct srec_symbol *s; - - csymbols = (asymbol *) bfd_alloc (abfd, symcount * sizeof (asymbol)); - if (csymbols == NULL && symcount != 0) - return false; - abfd->tdata.srec_data->csymbols = csymbols; - - for (s = abfd->tdata.srec_data->symbols, c = csymbols; - s != NULL; - s = s->next, ++c) - { - c->the_bfd = abfd; - c->name = s->name; - c->value = s->val; - c->flags = BSF_GLOBAL; - c->section = bfd_abs_section_ptr; - c->udata.p = NULL; - } - } - - for (i = 0; i < symcount; i++) - *alocation++ = csymbols++; - *alocation = NULL; - - return symcount; -} - -/*ARGSUSED*/ -void -srec_get_symbol_info (ignore_abfd, symbol, ret) - bfd *ignore_abfd; - asymbol *symbol; - symbol_info *ret; -{ - bfd_symbol_info (symbol, ret); -} - -/*ARGSUSED*/ -void -srec_print_symbol (ignore_abfd, afile, symbol, how) - bfd *ignore_abfd; - PTR afile; - asymbol *symbol; - bfd_print_symbol_type how; -{ - FILE *file = (FILE *) afile; - switch (how) - { - case bfd_print_symbol_name: - fprintf (file, "%s", symbol->name); - break; - default: - bfd_print_symbol_vandf ((PTR) file, symbol); - fprintf (file, " %-5s %s", - symbol->section->name, - symbol->name); - - } -} - -#define srec_close_and_cleanup _bfd_generic_close_and_cleanup -#define srec_bfd_free_cached_info _bfd_generic_bfd_free_cached_info -#define srec_new_section_hook _bfd_generic_new_section_hook - -#define srec_bfd_is_local_label bfd_generic_is_local_label -#define srec_get_lineno _bfd_nosymbols_get_lineno -#define srec_find_nearest_line _bfd_nosymbols_find_nearest_line -#define srec_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol -#define srec_read_minisymbols _bfd_generic_read_minisymbols -#define srec_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol - -#define srec_get_reloc_upper_bound \ - ((long (*) PARAMS ((bfd *, asection *))) bfd_0l) -#define srec_canonicalize_reloc \ - ((long (*) PARAMS ((bfd *, asection *, arelent **, asymbol **))) bfd_0l) -#define srec_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup - -#define srec_get_section_contents_in_window \ - _bfd_generic_get_section_contents_in_window - -#define srec_set_arch_mach bfd_default_set_arch_mach - -#define srec_bfd_get_relocated_section_contents \ - bfd_generic_get_relocated_section_contents -#define srec_bfd_relax_section bfd_generic_relax_section -#define srec_bfd_link_hash_table_create _bfd_generic_link_hash_table_create -#define srec_bfd_link_add_symbols _bfd_generic_link_add_symbols -#define srec_bfd_final_link _bfd_generic_final_link -#define srec_bfd_link_split_section _bfd_generic_link_split_section - -const bfd_target srec_vec = -{ - "srec", /* name */ - bfd_target_srec_flavour, - BFD_ENDIAN_UNKNOWN, /* target byte order */ - BFD_ENDIAN_UNKNOWN, /* target headers byte order */ - (HAS_RELOC | EXEC_P | /* object flags */ - HAS_LINENO | HAS_DEBUG | - HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED), - (SEC_CODE | SEC_DATA | SEC_ROM | SEC_HAS_CONTENTS - | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */ - 0, /* leading underscore */ - ' ', /* ar_pad_char */ - 16, /* ar_max_namelen */ - bfd_getb64, bfd_getb_signed_64, bfd_putb64, - bfd_getb32, bfd_getb_signed_32, bfd_putb32, - bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */ - bfd_getb64, bfd_getb_signed_64, bfd_putb64, - bfd_getb32, bfd_getb_signed_32, bfd_putb32, - bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */ - - { - _bfd_dummy_target, - srec_object_p, /* bfd_check_format */ - _bfd_dummy_target, - _bfd_dummy_target, - }, - { - bfd_false, - srec_mkobject, - _bfd_generic_mkarchive, - bfd_false, - }, - { /* bfd_write_contents */ - bfd_false, - srec_write_object_contents, - _bfd_write_archive_contents, - bfd_false, - }, - - BFD_JUMP_TABLE_GENERIC (srec), - BFD_JUMP_TABLE_COPY (_bfd_generic), - BFD_JUMP_TABLE_CORE (_bfd_nocore), - BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive), - BFD_JUMP_TABLE_SYMBOLS (srec), - BFD_JUMP_TABLE_RELOCS (srec), - BFD_JUMP_TABLE_WRITE (srec), - BFD_JUMP_TABLE_LINK (srec), - BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), - - (PTR) 0 -}; - - - -const bfd_target symbolsrec_vec = -{ - "symbolsrec", /* name */ - bfd_target_srec_flavour, - BFD_ENDIAN_UNKNOWN, /* target byte order */ - BFD_ENDIAN_UNKNOWN, /* target headers byte order */ - (HAS_RELOC | EXEC_P | /* object flags */ - HAS_LINENO | HAS_DEBUG | - HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED), - (SEC_CODE | SEC_DATA | SEC_ROM | SEC_HAS_CONTENTS - | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */ - 0, /* leading underscore */ - ' ', /* ar_pad_char */ - 16, /* ar_max_namelen */ - bfd_getb64, bfd_getb_signed_64, bfd_putb64, - bfd_getb32, bfd_getb_signed_32, bfd_putb32, - bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */ - bfd_getb64, bfd_getb_signed_64, bfd_putb64, - bfd_getb32, bfd_getb_signed_32, bfd_putb32, - bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */ - - { - _bfd_dummy_target, - symbolsrec_object_p, /* bfd_check_format */ - _bfd_dummy_target, - _bfd_dummy_target, - }, - { - bfd_false, - srec_mkobject, - _bfd_generic_mkarchive, - bfd_false, - }, - { /* bfd_write_contents */ - bfd_false, - symbolsrec_write_object_contents, - _bfd_write_archive_contents, - bfd_false, - }, - - BFD_JUMP_TABLE_GENERIC (srec), - BFD_JUMP_TABLE_COPY (_bfd_generic), - BFD_JUMP_TABLE_CORE (_bfd_nocore), - BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive), - BFD_JUMP_TABLE_SYMBOLS (srec), - BFD_JUMP_TABLE_RELOCS (srec), - BFD_JUMP_TABLE_WRITE (srec), - BFD_JUMP_TABLE_LINK (srec), - BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), - - (PTR) 0 -}; diff --git a/contrib/gdb/bfd/stab-syms.c b/contrib/gdb/bfd/stab-syms.c deleted file mode 100644 index f4fe6c8..0000000 --- a/contrib/gdb/bfd/stab-syms.c +++ /dev/null @@ -1,57 +0,0 @@ -/* Table of stab names for the BFD library. - Copyright (C) 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. - Written by Cygnus Support. - -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" - -#define ARCH_SIZE 32 /* Value doesn't matter. */ -#include "libaout.h" -#include "aout/aout64.h" - -/* Ignore duplicate stab codes; just return the string for the first - one. */ -#define __define_stab(NAME, CODE, STRING) __define_name(CODE, STRING) -#define __define_stab_duplicate(NAME, CODE, STRING) - -/* These are not really stab symbols, but it is - convenient to have them here for the sake of nm. - For completeness, we could also add N_TEXT etc, but those - are never needed, since nm treats those specially. */ -#define EXTRA_SYMBOLS \ - __define_name (N_SETA, "SETA")/* Absolute set element symbol */ \ - __define_name (N_SETT, "SETT")/* Text set element symbol */ \ - __define_name (N_SETD, "SETD")/* Data set element symbol */ \ - __define_name (N_SETB, "SETB")/* Bss set element symbol */ \ - __define_name (N_SETV, "SETV")/* Pointer to set vector in data area. */ \ - __define_name (N_INDR, "INDR") \ - __define_name (N_WARNING, "WARNING") - -const char * -bfd_get_stab_name (code) - int code; -{ - switch (code) - { -#define __define_name(val, str) case val: return str; -#include "aout/stab.def" - EXTRA_SYMBOLS - } - - return (const char *) 0; -} diff --git a/contrib/gdb/bfd/syms.c b/contrib/gdb/bfd/syms.c deleted file mode 100644 index e3007e4..0000000 --- a/contrib/gdb/bfd/syms.c +++ /dev/null @@ -1,1084 +0,0 @@ -/* Generic symbol-table support for the BFD library. - Copyright (C) 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. - Written by Cygnus Support. - -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. */ - -/* -SECTION - Symbols - - BFD tries to maintain as much symbol information as it can when - it moves information from file to file. BFD passes information - to applications though the <> structure. When the - application requests the symbol table, BFD reads the table in - the native form and translates parts of it into the internal - format. To maintain more than the information passed to - applications, some targets keep some information ``behind the - scenes'' in a structure only the particular back end knows - about. For example, the coff back end keeps the original - symbol table structure as well as the canonical structure when - a BFD is read in. On output, the coff back end can reconstruct - the output symbol table so that no information is lost, even - information unique to coff which BFD doesn't know or - understand. If a coff symbol table were read, but were written - through an a.out back end, all the coff specific information - would be lost. The symbol table of a BFD - is not necessarily read in until a canonicalize request is - made. Then the BFD back end fills in a table provided by the - application with pointers to the canonical information. To - output symbols, the application provides BFD with a table of - pointers to pointers to <>s. This allows applications - like the linker to output a symbol as it was read, since the ``behind - the scenes'' information will be still available. -@menu -@* Reading Symbols:: -@* Writing Symbols:: -@* Mini Symbols:: -@* typedef asymbol:: -@* symbol handling functions:: -@end menu - -INODE -Reading Symbols, Writing Symbols, Symbols, Symbols -SUBSECTION - Reading symbols - - There are two stages to reading a symbol table from a BFD: - allocating storage, and the actual reading process. This is an - excerpt from an application which reads the symbol table: - -| long storage_needed; -| asymbol **symbol_table; -| long number_of_symbols; -| long i; -| -| storage_needed = bfd_get_symtab_upper_bound (abfd); -| -| if (storage_needed < 0) -| FAIL -| -| if (storage_needed == 0) { -| return ; -| } -| symbol_table = (asymbol **) xmalloc (storage_needed); -| ... -| number_of_symbols = -| bfd_canonicalize_symtab (abfd, symbol_table); -| -| if (number_of_symbols < 0) -| FAIL -| -| for (i = 0; i < number_of_symbols; i++) { -| process_symbol (symbol_table[i]); -| } - - All storage for the symbols themselves is in an obstack - connected to the BFD; it is freed when the BFD is closed. - - -INODE -Writing Symbols, Mini Symbols, Reading Symbols, Symbols -SUBSECTION - Writing symbols - - Writing of a symbol table is automatic when a BFD open for - writing is closed. The application attaches a vector of - pointers to pointers to symbols to the BFD being written, and - fills in the symbol count. The close and cleanup code reads - through the table provided and performs all the necessary - operations. The BFD output code must always be provided with an - ``owned'' symbol: one which has come from another BFD, or one - which has been created using <>. Here is an - example showing the creation of a symbol table with only one element: - -| #include "bfd.h" -| main() -| { -| bfd *abfd; -| asymbol *ptrs[2]; -| asymbol *new; -| -| abfd = bfd_openw("foo","a.out-sunos-big"); -| bfd_set_format(abfd, bfd_object); -| new = bfd_make_empty_symbol(abfd); -| new->name = "dummy_symbol"; -| new->section = bfd_make_section_old_way(abfd, ".text"); -| new->flags = BSF_GLOBAL; -| new->value = 0x12345; -| -| ptrs[0] = new; -| ptrs[1] = (asymbol *)0; -| -| bfd_set_symtab(abfd, ptrs, 1); -| bfd_close(abfd); -| } -| -| ./makesym -| nm foo -| 00012345 A dummy_symbol - - Many formats cannot represent arbitary symbol information; for - instance, the <> object format does not allow an - arbitary number of sections. A symbol pointing to a section - which is not one of <<.text>>, <<.data>> or <<.bss>> cannot - be described. - -INODE -Mini Symbols, typedef asymbol, Writing Symbols, Symbols -SUBSECTION - Mini Symbols - - Mini symbols provide read-only access to the symbol table. - They use less memory space, but require more time to access. - They can be useful for tools like nm or objdump, which may - have to handle symbol tables of extremely large executables. - - The <> function will read the symbols - into memory in an internal form. It will return a <> - pointer to a block of memory, a symbol count, and the size of - each symbol. The pointer is allocated using <>, and - should be freed by the caller when it is no longer needed. - - The function <> will take a pointer - to a minisymbol, and a pointer to a structure returned by - <>, and return a <> structure. - The return value may or may not be the same as the value from - <> which was passed in. - -*/ - - - -/* -DOCDD -INODE -typedef asymbol, symbol handling functions, Mini Symbols, Symbols - -*/ -/* -SUBSECTION - typedef asymbol - - An <> has the form: - -*/ - -/* -CODE_FRAGMENT - -. -.typedef struct symbol_cache_entry -.{ -. {* A pointer to the BFD which owns the symbol. This information -. is necessary so that a back end can work out what additional -. information (invisible to the application writer) is carried -. with the symbol. -. -. This field is *almost* redundant, since you can use section->owner -. instead, except that some symbols point to the global sections -. bfd_{abs,com,und}_section. This could be fixed by making -. these globals be per-bfd (or per-target-flavor). FIXME. *} -. -. struct _bfd *the_bfd; {* Use bfd_asymbol_bfd(sym) to access this field. *} -. -. {* The text of the symbol. The name is left alone, and not copied; the -. application may not alter it. *} -. CONST char *name; -. -. {* The value of the symbol. This really should be a union of a -. numeric value with a pointer, since some flags indicate that -. a pointer to another symbol is stored here. *} -. symvalue value; -. -. {* Attributes of a symbol: *} -. -.#define BSF_NO_FLAGS 0x00 -. -. {* The symbol has local scope; <> in <>. The value -. is the offset into the section of the data. *} -.#define BSF_LOCAL 0x01 -. -. {* The symbol has global scope; initialized data in <>. The -. value is the offset into the section of the data. *} -.#define BSF_GLOBAL 0x02 -. -. {* The symbol has global scope and is exported. The value is -. the offset into the section of the data. *} -.#define BSF_EXPORT BSF_GLOBAL {* no real difference *} -. -. {* A normal C symbol would be one of: -. <>, <>, <> or -. <> *} -. -. {* The symbol is a debugging record. The value has an arbitary -. meaning. *} -.#define BSF_DEBUGGING 0x08 -. -. {* The symbol denotes a function entry point. Used in ELF, -. perhaps others someday. *} -.#define BSF_FUNCTION 0x10 -. -. {* Used by the linker. *} -.#define BSF_KEEP 0x20 -.#define BSF_KEEP_G 0x40 -. -. {* A weak global symbol, overridable without warnings by -. a regular global symbol of the same name. *} -.#define BSF_WEAK 0x80 -. -. {* This symbol was created to point to a section, e.g. ELF's -. STT_SECTION symbols. *} -.#define BSF_SECTION_SYM 0x100 -. -. {* The symbol used to be a common symbol, but now it is -. allocated. *} -.#define BSF_OLD_COMMON 0x200 -. -. {* The default value for common data. *} -.#define BFD_FORT_COMM_DEFAULT_VALUE 0 -. -. {* In some files the type of a symbol sometimes alters its -. location in an output file - ie in coff a <> symbol -. which is also <> symbol appears where it was -. declared and not at the end of a section. This bit is set -. by the target BFD part to convey this information. *} -. -.#define BSF_NOT_AT_END 0x400 -. -. {* Signal that the symbol is the label of constructor section. *} -.#define BSF_CONSTRUCTOR 0x800 -. -. {* Signal that the symbol is a warning symbol. The name is a -. warning. The name of the next symbol is the one to warn about; -. if a reference is made to a symbol with the same name as the next -. symbol, a warning is issued by the linker. *} -.#define BSF_WARNING 0x1000 -. -. {* Signal that the symbol is indirect. This symbol is an indirect -. pointer to the symbol with the same name as the next symbol. *} -.#define BSF_INDIRECT 0x2000 -. -. {* BSF_FILE marks symbols that contain a file name. This is used -. for ELF STT_FILE symbols. *} -.#define BSF_FILE 0x4000 -. -. {* Symbol is from dynamic linking information. *} -.#define BSF_DYNAMIC 0x8000 -. -. {* The symbol denotes a data object. Used in ELF, and perhaps -. others someday. *} -.#define BSF_OBJECT 0x10000 -. -. flagword flags; -. -. {* A pointer to the section to which this symbol is -. relative. This will always be non NULL, there are special -. sections for undefined and absolute symbols. *} -. struct sec *section; -. -. {* Back end special data. *} -. union -. { -. PTR p; -. bfd_vma i; -. } udata; -. -.} asymbol; -*/ - -#include "bfd.h" -#include "sysdep.h" -#include "libbfd.h" -#include "bfdlink.h" -#include "aout/stab_gnu.h" - -/* -DOCDD -INODE -symbol handling functions, , typedef asymbol, Symbols -SUBSECTION - Symbol handling functions -*/ - -/* -FUNCTION - bfd_get_symtab_upper_bound - -DESCRIPTION - Return the number of bytes required to store a vector of pointers - to <> for all the symbols in the BFD @var{abfd}, - including a terminal NULL pointer. If there are no symbols in - the BFD, then return 0. If an error occurs, return -1. - -.#define bfd_get_symtab_upper_bound(abfd) \ -. BFD_SEND (abfd, _bfd_get_symtab_upper_bound, (abfd)) - -*/ - -/* -FUNCTION - bfd_is_local_label - -SYNOPSIS - boolean bfd_is_local_label(bfd *abfd, asymbol *sym); - -DESCRIPTION - Return true if the given symbol @var{sym} in the BFD @var{abfd} is - a compiler generated local label, else return false. -.#define bfd_is_local_label(abfd, sym) \ -. BFD_SEND (abfd, _bfd_is_local_label,(abfd, sym)) -*/ - -/* -FUNCTION - bfd_canonicalize_symtab - -DESCRIPTION - Read the symbols from the BFD @var{abfd}, and fills in - the vector @var{location} with pointers to the symbols and - a trailing NULL. - Return the actual number of symbol pointers, not - including the NULL. - - -.#define bfd_canonicalize_symtab(abfd, location) \ -. BFD_SEND (abfd, _bfd_canonicalize_symtab,\ -. (abfd, location)) - -*/ - - -/* -FUNCTION - bfd_set_symtab - -SYNOPSIS - boolean bfd_set_symtab (bfd *abfd, asymbol **location, unsigned int count); - -DESCRIPTION - Arrange that when the output BFD @var{abfd} is closed, - the table @var{location} of @var{count} pointers to symbols - will be written. -*/ - -boolean -bfd_set_symtab (abfd, location, symcount) - bfd *abfd; - asymbol **location; - unsigned int symcount; -{ - if ((abfd->format != bfd_object) || (bfd_read_p (abfd))) - { - bfd_set_error (bfd_error_invalid_operation); - return false; - } - - bfd_get_outsymbols (abfd) = location; - bfd_get_symcount (abfd) = symcount; - return true; -} - -/* -FUNCTION - bfd_print_symbol_vandf - -SYNOPSIS - void bfd_print_symbol_vandf(PTR file, asymbol *symbol); - -DESCRIPTION - Print the value and flags of the @var{symbol} supplied to the - stream @var{file}. -*/ -void -bfd_print_symbol_vandf (arg, symbol) - PTR arg; - asymbol *symbol; -{ - FILE *file = (FILE *) arg; - flagword type = symbol->flags; - if (symbol->section != (asection *) NULL) - { - fprintf_vma (file, symbol->value + symbol->section->vma); - } - else - { - fprintf_vma (file, symbol->value); - } - - /* This presumes that a symbol can not be both BSF_DEBUGGING and - BSF_DYNAMIC, nor more than one of BSF_FUNCTION, BSF_FILE, and - BSF_OBJECT. */ - fprintf (file, " %c%c%c%c%c%c%c", - ((type & BSF_LOCAL) - ? (type & BSF_GLOBAL) ? '!' : 'l' - : (type & BSF_GLOBAL) ? 'g' : ' '), - (type & BSF_WEAK) ? 'w' : ' ', - (type & BSF_CONSTRUCTOR) ? 'C' : ' ', - (type & BSF_WARNING) ? 'W' : ' ', - (type & BSF_INDIRECT) ? 'I' : ' ', - (type & BSF_DEBUGGING) ? 'd' : (type & BSF_DYNAMIC) ? 'D' : ' ', - ((type & BSF_FUNCTION) - ? 'F' - : ((type & BSF_FILE) - ? 'f' - : ((type & BSF_OBJECT) ? 'O' : ' ')))); -} - - -/* -FUNCTION - bfd_make_empty_symbol - -DESCRIPTION - Create a new <> structure for the BFD @var{abfd} - and return a pointer to it. - - This routine is necessary because each back end has private - information surrounding the <>. Building your own - <> and pointing to it will not create the private - information, and will cause problems later on. - -.#define bfd_make_empty_symbol(abfd) \ -. BFD_SEND (abfd, _bfd_make_empty_symbol, (abfd)) -*/ - -/* -FUNCTION - bfd_make_debug_symbol - -DESCRIPTION - Create a new <> structure for the BFD @var{abfd}, - to be used as a debugging symbol. Further details of its use have - yet to be worked out. - -.#define bfd_make_debug_symbol(abfd,ptr,size) \ -. BFD_SEND (abfd, _bfd_make_debug_symbol, (abfd, ptr, size)) -*/ - -struct section_to_type -{ - CONST char *section; - char type; -}; - -/* Map section names to POSIX/BSD single-character symbol types. - This table is probably incomplete. It is sorted for convenience of - adding entries. Since it is so short, a linear search is used. */ -static CONST struct section_to_type stt[] = -{ - {"*DEBUG*", 'N'}, - {".bss", 'b'}, - {"zerovars", 'b'}, /* MRI .bss */ - {".data", 'd'}, - {"vars", 'd'}, /* MRI .data */ - {".rdata", 'r'}, /* Read only data. */ - {".rodata", 'r'}, /* Read only data. */ - {".sbss", 's'}, /* Small BSS (uninitialized data). */ - {".scommon", 'c'}, /* Small common. */ - {".sdata", 'g'}, /* Small initialized data. */ - {".text", 't'}, - {"code", 't'}, /* MRI .text */ - {0, 0} -}; - -/* Return the single-character symbol type corresponding to - section S, or '?' for an unknown COFF section. - - Check for any leading string which matches, so .text5 returns - 't' as well as .text */ - -static char -coff_section_type (s) - char *s; -{ - CONST struct section_to_type *t; - - for (t = &stt[0]; t->section; t++) - if (!strncmp (s, t->section, strlen (t->section))) - return t->type; - - return '?'; -} - -#ifndef islower -#define islower(c) ((c) >= 'a' && (c) <= 'z') -#endif -#ifndef toupper -#define toupper(c) (islower(c) ? ((c) & ~0x20) : (c)) -#endif - -/* -FUNCTION - bfd_decode_symclass - -DESCRIPTION - Return a character corresponding to the symbol - class of @var{symbol}, or '?' for an unknown class. - -SYNOPSIS - int bfd_decode_symclass(asymbol *symbol); -*/ -int -bfd_decode_symclass (symbol) - asymbol *symbol; -{ - char c; - - if (bfd_is_com_section (symbol->section)) - return 'C'; - if (bfd_is_und_section (symbol->section)) - return 'U'; - if (bfd_is_ind_section (symbol->section)) - return 'I'; - if (symbol->flags & BSF_WEAK) - return 'W'; - if (!(symbol->flags & (BSF_GLOBAL | BSF_LOCAL))) - return '?'; - - if (bfd_is_abs_section (symbol->section)) - c = 'a'; - else if (symbol->section) - c = coff_section_type (symbol->section->name); - else - return '?'; - if (symbol->flags & BSF_GLOBAL) - c = toupper (c); - return c; - - /* We don't have to handle these cases just yet, but we will soon: - N_SETV: 'v'; - N_SETA: 'l'; - N_SETT: 'x'; - N_SETD: 'z'; - N_SETB: 's'; - N_INDR: 'i'; - */ -} - -/* -FUNCTION - bfd_symbol_info - -DESCRIPTION - Fill in the basic info about symbol that nm needs. - Additional info may be added by the back-ends after - calling this function. - -SYNOPSIS - void bfd_symbol_info(asymbol *symbol, symbol_info *ret); -*/ - -void -bfd_symbol_info (symbol, ret) - asymbol *symbol; - symbol_info *ret; -{ - ret->type = bfd_decode_symclass (symbol); - if (ret->type != 'U') - ret->value = symbol->value + symbol->section->vma; - else - ret->value = 0; - ret->name = symbol->name; -} - -void -bfd_symbol_is_absolute () -{ - abort (); -} - -/* -FUNCTION - bfd_copy_private_symbol_data - -SYNOPSIS - boolean bfd_copy_private_symbol_data(bfd *ibfd, asymbol *isym, bfd *obfd, asymbol *osym); - -DESCRIPTION - Copy private symbol information from @var{isym} in the BFD - @var{ibfd} to the symbol @var{osym} in the BFD @var{obfd}. - Return <> on success, <> on error. Possible error - returns are: - - o <> - - Not enough memory exists to create private data for @var{osec}. - -.#define bfd_copy_private_symbol_data(ibfd, isymbol, obfd, osymbol) \ -. BFD_SEND (ibfd, _bfd_copy_private_symbol_data, \ -. (ibfd, isymbol, obfd, osymbol)) - -*/ - -/* The generic version of the function which returns mini symbols. - This is used when the backend does not provide a more efficient - version. It just uses BFD asymbol structures as mini symbols. */ - -long -_bfd_generic_read_minisymbols (abfd, dynamic, minisymsp, sizep) - bfd *abfd; - boolean dynamic; - PTR *minisymsp; - unsigned int *sizep; -{ - long storage; - asymbol **syms = NULL; - long symcount; - - if (dynamic) - storage = bfd_get_dynamic_symtab_upper_bound (abfd); - else - storage = bfd_get_symtab_upper_bound (abfd); - if (storage < 0) - goto error_return; - - syms = (asymbol **) bfd_malloc ((size_t) storage); - if (syms == NULL) - goto error_return; - - if (dynamic) - symcount = bfd_canonicalize_dynamic_symtab (abfd, syms); - else - symcount = bfd_canonicalize_symtab (abfd, syms); - if (symcount < 0) - goto error_return; - - *minisymsp = (PTR) syms; - *sizep = sizeof (asymbol *); - return symcount; - - error_return: - if (syms != NULL) - free (syms); - return -1; -} - -/* The generic version of the function which converts a minisymbol to - an asymbol. We don't worry about the sym argument we are passed; - we just return the asymbol the minisymbol points to. */ - -/*ARGSUSED*/ -asymbol * -_bfd_generic_minisymbol_to_symbol (abfd, dynamic, minisym, sym) - bfd *abfd; - boolean dynamic; - const PTR minisym; - asymbol *sym; -{ - return *(asymbol **) minisym; -} - -/* Look through stabs debugging information in .stab and .stabstr - sections to find the source file and line closest to a desired - location. This is used by COFF and ELF targets. It sets *pfound - to true if it finds some information. The *pinfo field is used to - pass cached information in and out of this routine; this first time - the routine is called for a BFD, *pinfo should be NULL. The value - placed in *pinfo should be saved with the BFD, and passed back each - time this function is called. */ - -/* A pointer to this structure is stored in *pinfo. */ - -struct stab_find_info -{ - /* The .stab section. */ - asection *stabsec; - /* The .stabstr section. */ - asection *strsec; - /* The contents of the .stab section. */ - bfd_byte *stabs; - /* The contents of the .stabstr section. */ - bfd_byte *strs; - /* An malloc buffer to hold the file name. */ - char *filename; - /* Cached values to restart quickly. */ - bfd_vma cached_offset; - bfd_byte *cached_stab; - bfd_byte *cached_str; - bfd_size_type cached_stroff; -}; - -boolean -_bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, pfound, - pfilename, pfnname, pline, pinfo) - bfd *abfd; - asymbol **symbols; - asection *section; - bfd_vma offset; - boolean *pfound; - const char **pfilename; - const char **pfnname; - unsigned int *pline; - PTR *pinfo; -{ - struct stab_find_info *info; - bfd_size_type stabsize, strsize; - bfd_byte *stab, *stabend, *str; - bfd_size_type stroff; - bfd_vma fnaddr; - char *directory_name, *main_file_name, *current_file_name, *line_file_name; - char *fnname; - bfd_vma low_func_vma, low_line_vma; - - *pfound = false; - *pfilename = bfd_get_filename (abfd); - *pfnname = NULL; - *pline = 0; - - info = (struct stab_find_info *) *pinfo; - if (info != NULL) - { - if (info->stabsec == NULL || info->strsec == NULL) - { - /* No stabs debugging information. */ - return true; - } - - stabsize = info->stabsec->_raw_size; - strsize = info->strsec->_raw_size; - } - else - { - long reloc_size, reloc_count; - arelent **reloc_vector; - - info = (struct stab_find_info *) bfd_zalloc (abfd, sizeof *info); - if (info == NULL) - return false; - - /* FIXME: When using the linker --split-by-file or - --split-by-reloc options, it is possible for the .stab and - .stabstr sections to be split. We should handle that. */ - - info->stabsec = bfd_get_section_by_name (abfd, ".stab"); - info->strsec = bfd_get_section_by_name (abfd, ".stabstr"); - - if (info->stabsec == NULL || info->strsec == NULL) - { - /* No stabs debugging information. Set *pinfo so that we - can return quickly in the info != NULL case above. */ - *pinfo = (PTR) info; - return true; - } - - stabsize = info->stabsec->_raw_size; - strsize = info->strsec->_raw_size; - - info->stabs = (bfd_byte *) bfd_alloc (abfd, stabsize); - info->strs = (bfd_byte *) bfd_alloc (abfd, strsize); - if (info->stabs == NULL || info->strs == NULL) - return false; - - if (! bfd_get_section_contents (abfd, info->stabsec, info->stabs, 0, - stabsize) - || ! bfd_get_section_contents (abfd, info->strsec, info->strs, 0, - strsize)) - return false; - - /* If this is a relocateable object file, we have to relocate - the entries in .stab. This should always be simple 32 bit - relocations against symbols defined in this object file, so - this should be no big deal. */ - reloc_size = bfd_get_reloc_upper_bound (abfd, info->stabsec); - if (reloc_size < 0) - return false; - reloc_vector = (arelent **) bfd_malloc (reloc_size); - if (reloc_vector == NULL && reloc_size != 0) - return false; - reloc_count = bfd_canonicalize_reloc (abfd, info->stabsec, reloc_vector, - symbols); - if (reloc_count < 0) - { - if (reloc_vector != NULL) - free (reloc_vector); - return false; - } - if (reloc_count > 0) - { - arelent **pr; - - for (pr = reloc_vector; *pr != NULL; pr++) - { - arelent *r; - unsigned long val; - asymbol *sym; - - r = *pr; - if (r->howto->rightshift != 0 - || r->howto->size != 2 - || r->howto->bitsize != 32 - || r->howto->pc_relative - || r->howto->bitpos != 0 - || r->howto->dst_mask != 0xffffffff) - { - (*_bfd_error_handler) - ("Unsupported .stab relocation"); - bfd_set_error (bfd_error_invalid_operation); - if (reloc_vector != NULL) - free (reloc_vector); - return false; - } - - val = bfd_get_32 (abfd, info->stabs + r->address); - val &= r->howto->src_mask; - sym = *r->sym_ptr_ptr; - val += sym->value + sym->section->vma + r->addend; - bfd_put_32 (abfd, val, info->stabs + r->address); - } - } - - if (reloc_vector != NULL) - free (reloc_vector); - - *pinfo = (PTR) info; - } - - /* We are passed a section relative offset. The offsets in the - stabs information are absolute. */ - offset += bfd_get_section_vma (abfd, section); - - /* Stabs entries use a 12 byte format: - 4 byte string table index - 1 byte stab type - 1 byte stab other field - 2 byte stab desc field - 4 byte stab value - FIXME: This will have to change for a 64 bit object format. - - The stabs symbols are divided into compilation units. For the - first entry in each unit, the type of 0, the value is the length - of the string table for this unit, and the desc field is the - number of stabs symbols for this unit. */ - -#define STRDXOFF (0) -#define TYPEOFF (4) -#define OTHEROFF (5) -#define DESCOFF (6) -#define VALOFF (8) -#define STABSIZE (12) - - /* It would be nice if we could skip ahead to the stabs symbols for - the next compilation unit to quickly scan through the compilation - units. Unfortunately, since each line number gets a separate - stabs entry, it is entirely plausible that a large source file - will overflow the 16 bit count of stabs entries. */ - fnaddr = 0; - directory_name = NULL; - main_file_name = NULL; - current_file_name = NULL; - line_file_name = NULL; - fnname = NULL; - low_func_vma = 0; - low_line_vma = 0; - - stabend = info->stabs + stabsize; - - if (info->cached_stab == NULL || offset < info->cached_offset) - { - stab = info->stabs; - str = info->strs; - stroff = 0; - } - else - { - stab = info->cached_stab; - str = info->cached_str; - stroff = info->cached_stroff; - } - - info->cached_offset = offset; - - for (; stab < stabend; stab += STABSIZE) - { - boolean done; - bfd_vma val; - char *name; - - done = false; - - switch (stab[TYPEOFF]) - { - case 0: - /* This is the first entry in a compilation unit. */ - if ((bfd_size_type) ((info->strs + strsize) - str) < stroff) - { - done = true; - break; - } - str += stroff; - stroff = bfd_get_32 (abfd, stab + VALOFF); - break; - - case N_SO: - /* The main file name. */ - - val = bfd_get_32 (abfd, stab + VALOFF); - if (val > offset) - { - done = true; - break; - } - - name = (char *) str + bfd_get_32 (abfd, stab + STRDXOFF); - - /* An empty string indicates the end of the compilation - unit. */ - if (*name == '\0') - { - /* If there are functions in different sections, they - may have addresses larger than val, but we don't want - to forget the file name. When there are functions in - different cases, there is supposed to be an N_FUN at - the end of the function indicating where it ends. */ - if (low_func_vma < val || fnname == NULL) - main_file_name = NULL; - break; - } - - /* We know that we have to get to at least this point in the - stabs entries for this offset. */ - info->cached_stab = stab; - info->cached_str = str; - info->cached_stroff = stroff; - - current_file_name = name; - - /* Look ahead to the next symbol. Two consecutive N_SO - symbols are a directory and a file name. */ - if (stab + STABSIZE >= stabend - || *(stab + STABSIZE + TYPEOFF) != N_SO) - directory_name = NULL; - else - { - stab += STABSIZE; - directory_name = current_file_name; - current_file_name = ((char *) str - + bfd_get_32 (abfd, stab + STRDXOFF)); - } - - main_file_name = current_file_name; - - break; - - case N_SOL: - /* The name of an include file. */ - current_file_name = ((char *) str - + bfd_get_32 (abfd, stab + STRDXOFF)); - break; - - case N_SLINE: - case N_DSLINE: - case N_BSLINE: - /* A line number. The value is relative to the start of the - current function. */ - val = fnaddr + bfd_get_32 (abfd, stab + VALOFF); - if (val >= low_line_vma && val <= offset) - { - *pline = bfd_get_16 (abfd, stab + DESCOFF); - low_line_vma = val; - line_file_name = current_file_name; - } - break; - - case N_FUN: - /* A function name. */ - val = bfd_get_32 (abfd, stab + VALOFF); - name = (char *) str + bfd_get_32 (abfd, stab + STRDXOFF); - - /* An empty string here indicates the end of a function, and - the value is relative to fnaddr. */ - - if (*name == '\0') - { - val += fnaddr; - if (val >= low_func_vma && val < offset) - fnname = NULL; - } - else - { - if (val >= low_func_vma && val <= offset) - { - fnname = name; - low_func_vma = val; - } - - fnaddr = val; - } - - break; - } - - if (done) - break; - } - - if (main_file_name == NULL) - { - /* No information found. */ - return true; - } - - *pfound = true; - - if (*pline != 0) - main_file_name = line_file_name; - - if (main_file_name != NULL) - { - if (main_file_name[0] == '/' || directory_name == NULL) - *pfilename = main_file_name; - else - { - size_t dirlen; - - dirlen = strlen (directory_name); - if (info->filename == NULL - || strncmp (info->filename, directory_name, dirlen) != 0 - || strcmp (info->filename + dirlen, main_file_name) != 0) - { - if (info->filename != NULL) - free (info->filename); - info->filename = (char *) bfd_malloc (dirlen + - strlen (main_file_name) - + 1); - if (info->filename == NULL) - return false; - strcpy (info->filename, directory_name); - strcpy (info->filename + dirlen, main_file_name); - } - - *pfilename = info->filename; - } - } - - if (fnname != NULL) - { - char *s; - - /* This will typically be something like main:F(0,1), so we want - to clobber the colon. It's OK to change the name, since the - string is in our own local storage anyhow. */ - - s = strchr (fnname, ':'); - if (s != NULL) - *s = '\0'; - - *pfnname = fnname; - } - - return true; -} diff --git a/contrib/gdb/bfd/sysdep.h b/contrib/gdb/bfd/sysdep.h deleted file mode 100644 index dd8146a..0000000 --- a/contrib/gdb/bfd/sysdep.h +++ /dev/null @@ -1,114 +0,0 @@ -/* sysdep.h -- handle host dependencies for the BFD library - Copyright 1995 Free Software Foundation, Inc. - Written by Cygnus Support. - -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 BFD_SYSDEP_H -#define BFD_SYSDEP_H - -#include "ansidecl.h" - -#include "config.h" - -#ifdef HAVE_STDDEF_H -#include -#endif - -#include -#include -#include - -#include -#ifndef errno -extern int errno; -#endif - -#ifdef HAVE_STRING_H -#include -#else -#ifdef HAVE_STRINGS_H -#include -#else -extern char *strchr (); -extern char *strrchr (); -extern char *strstr (); -#endif -#endif - -#ifdef HAVE_STDLIB_H -#include -#endif - -#if TIME_WITH_SYS_TIME -#include -#include -#else -#if HAVE_SYS_TIME_H -#include -#else -#include -#endif -#endif - -#ifdef HAVE_UNISTD_H -#include -#endif - -#ifdef USE_BINARY_FOPEN -#include "fopen-bin.h" -#else -#include "fopen-same.h" -#endif - -#ifdef HAVE_FCNTL_H -#include -#else -#ifdef HAVE_SYS_FILE_H -#include -#endif -#endif - -#ifndef O_RDONLY -#define O_RDONLY 0 -#endif -#ifndef O_WRONLY -#define O_WRONLY 1 -#endif -#ifndef O_RDWR -#define O_RDWR 2 -#endif -#ifndef O_ACCMODE -#define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR) -#endif - -#ifndef SEEK_SET -#define SEEK_SET 0 -#endif -#ifndef SEEK_CUR -#define SEEK_CUR 1 -#endif - -#ifdef NEED_DECLARATION_MALLOC -extern PTR malloc (); -#endif - -#ifdef NEED_DECLARATION_FREE -extern void free (); -#endif - -#endif /* ! defined (BFD_SYSDEP_H) */ diff --git a/contrib/gdb/bfd/targets.c b/contrib/gdb/bfd/targets.c deleted file mode 100644 index e1e6468..0000000 --- a/contrib/gdb/bfd/targets.c +++ /dev/null @@ -1,886 +0,0 @@ -/* Generic target-file-type support for the BFD library. - Copyright 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. - Written by Cygnus Support. - -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" - -/* -SECTION - Targets - -DESCRIPTION - Each port of BFD to a different machine requries the creation - of a target back end. All the back end provides to the root - part of BFD is a structure containing pointers to functions - which perform certain low level operations on files. BFD - translates the applications's requests through a pointer into - calls to the back end routines. - - When a file is opened with <>, its format and - target are unknown. BFD uses various mechanisms to determine - how to interpret the file. The operations performed are: - - o Create a BFD by calling the internal routine - <<_bfd_new_bfd>>, then call <> with the - target string supplied to <> and the new BFD pointer. - - o If a null target string was provided to <>, - look up the environment variable <> and use - that as the target string. - - o If the target string is still <>, or the target string is - <>, then use the first item in the target vector - as the target type, and set <> in the BFD to - cause <> to loop through all the targets. - @xref{bfd_target}. @xref{Formats}. - - o Otherwise, inspect the elements in the target vector - one by one, until a match on target name is found. When found, - use it. - - o Otherwise return the error <> to - <>. - - o <> attempts to open the file using - <>, and returns the BFD. - - Once the BFD has been opened and the target selected, the file - format may be determined. This is done by calling - <> on the BFD with a suggested format. - If <> has been set, each possible target - type is tried to see if it recognizes the specified format. - <> returns <> when the caller guesses right. -@menu -@* bfd_target:: -@end menu -*/ - - -/* - -INODE - bfd_target, , Targets, Targets -DOCDD -SUBSECTION - bfd_target - -DESCRIPTION - This structure contains everything that BFD knows about a - target. It includes things like its byte order, name, and which - routines to call to do various operations. - - Every BFD points to a target structure with its <> - member. - - The macros below are used to dispatch to functions through the - <> vector. They are used in a number of macros further - down in @file{bfd.h}, and are also used when calling various - routines by hand inside the BFD implementation. The @var{arglist} - argument must be parenthesized; it contains all the arguments - to the called function. - - They make the documentation (more) unpleasant to read, so if - someone wants to fix this and not break the above, please do. - -.#define BFD_SEND(bfd, message, arglist) \ -. ((*((bfd)->xvec->message)) arglist) -. -.#ifdef DEBUG_BFD_SEND -.#undef BFD_SEND -.#define BFD_SEND(bfd, message, arglist) \ -. (((bfd) && (bfd)->xvec && (bfd)->xvec->message) ? \ -. ((*((bfd)->xvec->message)) arglist) : \ -. (bfd_assert (__FILE__,__LINE__), NULL)) -.#endif - - For operations which index on the BFD format: - -.#define BFD_SEND_FMT(bfd, message, arglist) \ -. (((bfd)->xvec->message[(int)((bfd)->format)]) arglist) -. -.#ifdef DEBUG_BFD_SEND -.#undef BFD_SEND_FMT -.#define BFD_SEND_FMT(bfd, message, arglist) \ -. (((bfd) && (bfd)->xvec && (bfd)->xvec->message) ? \ -. (((bfd)->xvec->message[(int)((bfd)->format)]) arglist) : \ -. (bfd_assert (__FILE__,__LINE__), NULL)) -.#endif - - This is the structure which defines the type of BFD this is. The - <> member of the struct <> itself points here. Each - module that implements access to a different target under BFD, - defines one of these. - - - FIXME, these names should be rationalised with the names of - the entry points which call them. Too bad we can't have one - macro to define them both! - -.enum bfd_flavour { -. bfd_target_unknown_flavour, -. bfd_target_aout_flavour, -. bfd_target_coff_flavour, -. bfd_target_ecoff_flavour, -. bfd_target_elf_flavour, -. bfd_target_ieee_flavour, -. bfd_target_nlm_flavour, -. bfd_target_oasys_flavour, -. bfd_target_tekhex_flavour, -. bfd_target_srec_flavour, -. bfd_target_ihex_flavour, -. bfd_target_som_flavour, -. bfd_target_os9k_flavour, -. bfd_target_versados_flavour, -. bfd_target_msdos_flavour -.}; -. -.enum bfd_endian { BFD_ENDIAN_BIG, BFD_ENDIAN_LITTLE, BFD_ENDIAN_UNKNOWN }; -. -.{* Forward declaration. *} -.typedef struct bfd_link_info _bfd_link_info; -. -.typedef struct bfd_target -.{ - -Identifies the kind of target, e.g., SunOS4, Ultrix, etc. - -. char *name; - -The "flavour" of a back end is a general indication about the contents -of a file. - -. enum bfd_flavour flavour; - -The order of bytes within the data area of a file. - -. enum bfd_endian byteorder; - -The order of bytes within the header parts of a file. - -. enum bfd_endian header_byteorder; - -A mask of all the flags which an executable may have set - -from the set <>, <>, ...<>. - -. flagword object_flags; - -A mask of all the flags which a section may have set - from -the set <>, <>, ...<>. - -. flagword section_flags; - -The character normally found at the front of a symbol -(if any), perhaps `_'. - -. char symbol_leading_char; - -The pad character for file names within an archive header. - -. char ar_pad_char; - -The maximum number of characters in an archive header. - -. unsigned short ar_max_namelen; - -Entries for byte swapping for data. These are different from the other -entry points, since they don't take a BFD asthe first argument. -Certain other handlers could do the same. - -. bfd_vma (*bfd_getx64) PARAMS ((const bfd_byte *)); -. bfd_signed_vma (*bfd_getx_signed_64) PARAMS ((const bfd_byte *)); -. void (*bfd_putx64) PARAMS ((bfd_vma, bfd_byte *)); -. bfd_vma (*bfd_getx32) PARAMS ((const bfd_byte *)); -. bfd_signed_vma (*bfd_getx_signed_32) PARAMS ((const bfd_byte *)); -. void (*bfd_putx32) PARAMS ((bfd_vma, bfd_byte *)); -. bfd_vma (*bfd_getx16) PARAMS ((const bfd_byte *)); -. bfd_signed_vma (*bfd_getx_signed_16) PARAMS ((const bfd_byte *)); -. void (*bfd_putx16) PARAMS ((bfd_vma, bfd_byte *)); - -Byte swapping for the headers - -. bfd_vma (*bfd_h_getx64) PARAMS ((const bfd_byte *)); -. bfd_signed_vma (*bfd_h_getx_signed_64) PARAMS ((const bfd_byte *)); -. void (*bfd_h_putx64) PARAMS ((bfd_vma, bfd_byte *)); -. bfd_vma (*bfd_h_getx32) PARAMS ((const bfd_byte *)); -. bfd_signed_vma (*bfd_h_getx_signed_32) PARAMS ((const bfd_byte *)); -. void (*bfd_h_putx32) PARAMS ((bfd_vma, bfd_byte *)); -. bfd_vma (*bfd_h_getx16) PARAMS ((const bfd_byte *)); -. bfd_signed_vma (*bfd_h_getx_signed_16) PARAMS ((const bfd_byte *)); -. void (*bfd_h_putx16) PARAMS ((bfd_vma, bfd_byte *)); - -Format dependent routines: these are vectors of entry points -within the target vector structure, one for each format to check. - -Check the format of a file being read. Return a <> or zero. - -. const struct bfd_target *(*_bfd_check_format[bfd_type_end]) PARAMS ((bfd *)); - -Set the format of a file being written. - -. boolean (*_bfd_set_format[bfd_type_end]) PARAMS ((bfd *)); - -Write cached information into a file being written, at <>. - -. boolean (*_bfd_write_contents[bfd_type_end]) PARAMS ((bfd *)); - -The general target vector. - -. -. {* Generic entry points. *} -.#define BFD_JUMP_TABLE_GENERIC(NAME)\ -.CAT(NAME,_close_and_cleanup),\ -.CAT(NAME,_bfd_free_cached_info),\ -.CAT(NAME,_new_section_hook),\ -.CAT(NAME,_get_section_contents),\ -.CAT(NAME,_get_section_contents_in_window) -. -. {* Called when the BFD is being closed to do any necessary cleanup. *} -. boolean (*_close_and_cleanup) PARAMS ((bfd *)); -. {* Ask the BFD to free all cached information. *} -. boolean (*_bfd_free_cached_info) PARAMS ((bfd *)); -. {* Called when a new section is created. *} -. boolean (*_new_section_hook) PARAMS ((bfd *, sec_ptr)); -. {* Read the contents of a section. *} -. boolean (*_bfd_get_section_contents) PARAMS ((bfd *, sec_ptr, PTR, -. file_ptr, bfd_size_type)); -. boolean (*_bfd_get_section_contents_in_window) -. PARAMS ((bfd *, sec_ptr, bfd_window *, -. file_ptr, bfd_size_type)); -. -. {* Entry points to copy private data. *} -.#define BFD_JUMP_TABLE_COPY(NAME)\ -.CAT(NAME,_bfd_copy_private_bfd_data),\ -.CAT(NAME,_bfd_merge_private_bfd_data),\ -.CAT(NAME,_bfd_copy_private_section_data),\ -.CAT(NAME,_bfd_copy_private_symbol_data),\ -.CAT(NAME,_bfd_set_private_flags),\ -.CAT(NAME,_bfd_print_private_bfd_data)\ -. {* Called to copy BFD general private data from one object file -. to another. *} -. boolean (*_bfd_copy_private_bfd_data) PARAMS ((bfd *, bfd *)); -. {* Called to merge BFD general private data from one object file -. to a common output file when linking. *} -. boolean (*_bfd_merge_private_bfd_data) PARAMS ((bfd *, bfd *)); -. {* Called to copy BFD private section data from one object file -. to another. *} -. boolean (*_bfd_copy_private_section_data) PARAMS ((bfd *, sec_ptr, -. bfd *, sec_ptr)); -. {* Called to copy BFD private symbol data from one symbol -. to another. *} -. boolean (*_bfd_copy_private_symbol_data) PARAMS ((bfd *, asymbol *, -. bfd *, asymbol *)); -. {* Called to set private backend flags *} -. boolean (*_bfd_set_private_flags) PARAMS ((bfd *, flagword)); -. -. {* Called to print private BFD data *} -. boolean (*_bfd_print_private_bfd_data) PARAMS ((bfd *, PTR)); -. -. {* Core file entry points. *} -.#define BFD_JUMP_TABLE_CORE(NAME)\ -.CAT(NAME,_core_file_failing_command),\ -.CAT(NAME,_core_file_failing_signal),\ -.CAT(NAME,_core_file_matches_executable_p) -. char * (*_core_file_failing_command) PARAMS ((bfd *)); -. int (*_core_file_failing_signal) PARAMS ((bfd *)); -. boolean (*_core_file_matches_executable_p) PARAMS ((bfd *, bfd *)); -. -. {* Archive entry points. *} -.#define BFD_JUMP_TABLE_ARCHIVE(NAME)\ -.CAT(NAME,_slurp_armap),\ -.CAT(NAME,_slurp_extended_name_table),\ -.CAT(NAME,_construct_extended_name_table),\ -.CAT(NAME,_truncate_arname),\ -.CAT(NAME,_write_armap),\ -.CAT(NAME,_read_ar_hdr),\ -.CAT(NAME,_openr_next_archived_file),\ -.CAT(NAME,_get_elt_at_index),\ -.CAT(NAME,_generic_stat_arch_elt),\ -.CAT(NAME,_update_armap_timestamp) -. boolean (*_bfd_slurp_armap) PARAMS ((bfd *)); -. boolean (*_bfd_slurp_extended_name_table) PARAMS ((bfd *)); -. boolean (*_bfd_construct_extended_name_table) -. PARAMS ((bfd *, char **, bfd_size_type *, const char **)); -. void (*_bfd_truncate_arname) PARAMS ((bfd *, CONST char *, char *)); -. boolean (*write_armap) PARAMS ((bfd *arch, -. unsigned int elength, -. struct orl *map, -. unsigned int orl_count, -. int stridx)); -. PTR (*_bfd_read_ar_hdr_fn) PARAMS ((bfd *)); -. bfd * (*openr_next_archived_file) PARAMS ((bfd *arch, bfd *prev)); -.#define bfd_get_elt_at_index(b,i) BFD_SEND(b, _bfd_get_elt_at_index, (b,i)) -. bfd * (*_bfd_get_elt_at_index) PARAMS ((bfd *, symindex)); -. int (*_bfd_stat_arch_elt) PARAMS ((bfd *, struct stat *)); -. boolean (*_bfd_update_armap_timestamp) PARAMS ((bfd *)); -. -. {* Entry points used for symbols. *} -.#define BFD_JUMP_TABLE_SYMBOLS(NAME)\ -.CAT(NAME,_get_symtab_upper_bound),\ -.CAT(NAME,_get_symtab),\ -.CAT(NAME,_make_empty_symbol),\ -.CAT(NAME,_print_symbol),\ -.CAT(NAME,_get_symbol_info),\ -.CAT(NAME,_bfd_is_local_label),\ -.CAT(NAME,_get_lineno),\ -.CAT(NAME,_find_nearest_line),\ -.CAT(NAME,_bfd_make_debug_symbol),\ -.CAT(NAME,_read_minisymbols),\ -.CAT(NAME,_minisymbol_to_symbol) -. long (*_bfd_get_symtab_upper_bound) PARAMS ((bfd *)); -. long (*_bfd_canonicalize_symtab) PARAMS ((bfd *, -. struct symbol_cache_entry **)); -. struct symbol_cache_entry * -. (*_bfd_make_empty_symbol) PARAMS ((bfd *)); -. void (*_bfd_print_symbol) PARAMS ((bfd *, PTR, -. struct symbol_cache_entry *, -. bfd_print_symbol_type)); -.#define bfd_print_symbol(b,p,s,e) BFD_SEND(b, _bfd_print_symbol, (b,p,s,e)) -. void (*_bfd_get_symbol_info) PARAMS ((bfd *, -. struct symbol_cache_entry *, -. symbol_info *)); -.#define bfd_get_symbol_info(b,p,e) BFD_SEND(b, _bfd_get_symbol_info, (b,p,e)) -. boolean (*_bfd_is_local_label) PARAMS ((bfd *, asymbol *)); -. -. alent * (*_get_lineno) PARAMS ((bfd *, struct symbol_cache_entry *)); -. boolean (*_bfd_find_nearest_line) PARAMS ((bfd *abfd, -. struct sec *section, struct symbol_cache_entry **symbols, -. bfd_vma offset, CONST char **file, CONST char **func, -. unsigned int *line)); -. {* Back-door to allow format-aware applications to create debug symbols -. while using BFD for everything else. Currently used by the assembler -. when creating COFF files. *} -. asymbol * (*_bfd_make_debug_symbol) PARAMS (( -. bfd *abfd, -. void *ptr, -. unsigned long size)); -.#define bfd_read_minisymbols(b, d, m, s) \ -. BFD_SEND (b, _read_minisymbols, (b, d, m, s)) -. long (*_read_minisymbols) PARAMS ((bfd *, boolean, PTR *, -. unsigned int *)); -.#define bfd_minisymbol_to_symbol(b, d, m, f) \ -. BFD_SEND (b, _minisymbol_to_symbol, (b, d, m, f)) -. asymbol *(*_minisymbol_to_symbol) PARAMS ((bfd *, boolean, const PTR, -. asymbol *)); -. -. {* Routines for relocs. *} -.#define BFD_JUMP_TABLE_RELOCS(NAME)\ -.CAT(NAME,_get_reloc_upper_bound),\ -.CAT(NAME,_canonicalize_reloc),\ -.CAT(NAME,_bfd_reloc_type_lookup) -. long (*_get_reloc_upper_bound) PARAMS ((bfd *, sec_ptr)); -. long (*_bfd_canonicalize_reloc) PARAMS ((bfd *, sec_ptr, arelent **, -. struct symbol_cache_entry **)); -. {* See documentation on reloc types. *} -. reloc_howto_type * -. (*reloc_type_lookup) PARAMS ((bfd *abfd, -. bfd_reloc_code_real_type code)); -. -. {* Routines used when writing an object file. *} -.#define BFD_JUMP_TABLE_WRITE(NAME)\ -.CAT(NAME,_set_arch_mach),\ -.CAT(NAME,_set_section_contents) -. boolean (*_bfd_set_arch_mach) PARAMS ((bfd *, enum bfd_architecture, -. unsigned long)); -. boolean (*_bfd_set_section_contents) PARAMS ((bfd *, sec_ptr, PTR, -. file_ptr, bfd_size_type)); -. -. {* Routines used by the linker. *} -.#define BFD_JUMP_TABLE_LINK(NAME)\ -.CAT(NAME,_sizeof_headers),\ -.CAT(NAME,_bfd_get_relocated_section_contents),\ -.CAT(NAME,_bfd_relax_section),\ -.CAT(NAME,_bfd_link_hash_table_create),\ -.CAT(NAME,_bfd_link_add_symbols),\ -.CAT(NAME,_bfd_final_link),\ -.CAT(NAME,_bfd_link_split_section) -. int (*_bfd_sizeof_headers) PARAMS ((bfd *, boolean)); -. bfd_byte * (*_bfd_get_relocated_section_contents) PARAMS ((bfd *, -. struct bfd_link_info *, struct bfd_link_order *, -. bfd_byte *data, boolean relocateable, -. struct symbol_cache_entry **)); -. -. boolean (*_bfd_relax_section) PARAMS ((bfd *, struct sec *, -. struct bfd_link_info *, boolean *again)); -. -. {* Create a hash table for the linker. Different backends store -. different information in this table. *} -. struct bfd_link_hash_table *(*_bfd_link_hash_table_create) PARAMS ((bfd *)); -. -. {* Add symbols from this object file into the hash table. *} -. boolean (*_bfd_link_add_symbols) PARAMS ((bfd *, 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 *)); -. -. {* Should this section be split up into smaller pieces during linking. *} -. boolean (*_bfd_link_split_section) PARAMS ((bfd *, struct sec *)); -. -. {* Routines to handle dynamic symbols and relocs. *} -.#define BFD_JUMP_TABLE_DYNAMIC(NAME)\ -.CAT(NAME,_get_dynamic_symtab_upper_bound),\ -.CAT(NAME,_canonicalize_dynamic_symtab),\ -.CAT(NAME,_get_dynamic_reloc_upper_bound),\ -.CAT(NAME,_canonicalize_dynamic_reloc) -. {* Get the amount of memory required to hold the dynamic symbols. *} -. long (*_bfd_get_dynamic_symtab_upper_bound) PARAMS ((bfd *)); -. {* Read in the dynamic symbols. *} -. long (*_bfd_canonicalize_dynamic_symtab) -. PARAMS ((bfd *, struct symbol_cache_entry **)); -. {* Get the amount of memory required to hold the dynamic relocs. *} -. long (*_bfd_get_dynamic_reloc_upper_bound) PARAMS ((bfd *)); -. {* Read in the dynamic relocs. *} -. long (*_bfd_canonicalize_dynamic_reloc) -. PARAMS ((bfd *, arelent **, struct symbol_cache_entry **)); -. - -Data for use by back-end routines, which isn't generic enough to belong -in this structure. - -. PTR backend_data; -.} bfd_target; - -*/ - -/* All known xvecs (even those that don't compile on all systems). - Alphabetized for easy reference. - They are listed a second time below, since - we can't intermix extern's and initializers. */ -extern const bfd_target a29kcoff_big_vec; -extern const bfd_target a_out_adobe_vec; -extern const bfd_target aout_arm_big_vec; -extern const bfd_target aout_arm_little_vec; -extern const bfd_target aout_mips_big_vec; -extern const bfd_target aout_mips_little_vec; -extern const bfd_target aout0_big_vec; -extern const bfd_target apollocoff_vec; -extern const bfd_target armcoff_little_vec; -extern const bfd_target armcoff_big_vec; -extern const bfd_target armpe_little_vec; -extern const bfd_target armpe_big_vec; -extern const bfd_target armpei_little_vec; -extern const bfd_target armpei_big_vec; -extern const bfd_target b_out_vec_big_host; -extern const bfd_target b_out_vec_little_host; -extern const bfd_target bfd_elf32_big_generic_vec; -extern const bfd_target bfd_elf32_bigmips_vec; -extern const bfd_target bfd_elf32_hppa_vec; -extern const bfd_target bfd_elf32_i386_vec; -extern const bfd_target bfd_elf32_i860_vec; -extern const bfd_target bfd_elf32_little_generic_vec; -extern const bfd_target bfd_elf32_littlemips_vec; -extern const bfd_target bfd_elf32_m68k_vec; -extern const bfd_target bfd_elf32_m88k_vec; -extern const bfd_target bfd_elf32_powerpc_vec; -extern const bfd_target bfd_elf32_powerpcle_vec; -extern const bfd_target bfd_elf32_sparc_vec; -extern const bfd_target bfd_elf64_big_generic_vec; -extern const bfd_target bfd_elf64_little_generic_vec; -extern const bfd_target bfd_elf64_sparc_vec; -extern const bfd_target demo_64_vec; -extern const bfd_target ecoff_big_vec; -extern const bfd_target ecoff_little_vec; -extern const bfd_target ecoffalpha_little_vec; -extern const bfd_target h8300coff_vec; -extern const bfd_target h8500coff_vec; -extern const bfd_target host_aout_vec; -extern const bfd_target hp300bsd_vec; -extern const bfd_target hp300hpux_vec; -extern const bfd_target som_vec; -extern const bfd_target i386aout_vec; -extern const bfd_target i386bsd_vec; -extern const bfd_target i386dynix_vec; -extern const bfd_target i386freebsd_vec; -extern const bfd_target i386os9k_vec; -extern const bfd_target i386coff_vec; -extern const bfd_target bfd_powerpc_pe_vec; -extern const bfd_target bfd_powerpcle_pe_vec; -extern const bfd_target bfd_powerpc_pei_vec; -extern const bfd_target bfd_powerpcle_pei_vec; -extern const bfd_target i386pe_vec; -extern const bfd_target i386pei_vec; -extern const bfd_target go32coff_vec; -extern const bfd_target i386linux_vec; -extern const bfd_target i386lynx_aout_vec; -extern const bfd_target i386lynx_coff_vec; -extern const bfd_target i386mach3_vec; -extern const bfd_target i386msdos_vec; -extern const bfd_target i386netbsd_vec; -extern const bfd_target i860coff_vec; -extern const bfd_target icoff_big_vec; -extern const bfd_target icoff_little_vec; -extern const bfd_target ieee_vec; -extern const bfd_target m68kaux_coff_vec; -extern const bfd_target m68kcoff_vec; -extern const bfd_target m68kcoffun_vec; -extern const bfd_target m68klinux_vec; -extern const bfd_target m68klynx_aout_vec; -extern const bfd_target m68klynx_coff_vec; -extern const bfd_target m68knetbsd_vec; -extern const bfd_target m68k4knetbsd_vec; -extern const bfd_target m88kbcs_vec; -extern const bfd_target m88kmach3_vec; -extern const bfd_target newsos3_vec; -extern const bfd_target nlm32_i386_vec; -extern const bfd_target nlm32_sparc_vec; -extern const bfd_target nlm32_alpha_vec; -extern const bfd_target nlm32_powerpc_vec; -extern const bfd_target pc532netbsd_vec; -extern const bfd_target oasys_vec; -extern const bfd_target pc532machaout_vec; -extern const bfd_target riscix_vec; -extern const bfd_target pmac_xcoff_vec; -extern const bfd_target rs6000coff_vec; -extern const bfd_target shcoff_vec; -extern const bfd_target shlcoff_vec; -extern const bfd_target sparclynx_aout_vec; -extern const bfd_target sparclynx_coff_vec; -extern const bfd_target sparcnetbsd_vec; -extern const bfd_target sparccoff_vec; -extern const bfd_target sunos_big_vec; -extern const bfd_target tekhex_vec; -extern const bfd_target versados_vec; -extern const bfd_target we32kcoff_vec; -extern const bfd_target w65_vec; -extern const bfd_target z8kcoff_vec; - -/* srec is always included. */ -extern const bfd_target srec_vec; -extern const bfd_target symbolsrec_vec; - -/* binary is always included. */ -extern const bfd_target binary_vec; - -/* ihex is always included. */ -extern const bfd_target ihex_vec; - -/* All of the xvecs for core files. */ -extern const bfd_target aix386_core_vec; -extern const bfd_target cisco_core_vec; -extern const bfd_target hpux_core_vec; -extern const bfd_target hppabsd_core_vec; -extern const bfd_target irix_core_vec; -extern const bfd_target osf_core_vec; -extern const bfd_target sco_core_vec; -extern const bfd_target trad_core_vec; -extern const bfd_target ptrace_core_vec; - -const bfd_target * const bfd_target_vector[] = { - -#ifdef SELECT_VECS - - SELECT_VECS, - -#else /* not SELECT_VECS */ - -#ifdef DEFAULT_VECTOR - &DEFAULT_VECTOR, -#endif - /* This list is alphabetized to make it easy to compare - with other vector lists -- the decls above and - the case statement in configure.in. - Vectors that don't compile on all systems, or aren't finished, - should have an entry here with #if 0 around it, to show that - it wasn't omitted by mistake. */ - &a29kcoff_big_vec, - &a_out_adobe_vec, -#if 0 /* No one seems to use this. */ - &aout_mips_big_vec, -#endif - &aout_mips_little_vec, - &b_out_vec_big_host, - &b_out_vec_little_host, - - /* This, and other vectors, may not be used in any *.mt configuration. - But that does not mean they are unnecessary. If configured with - --enable-targets=all, objdump or gdb should be able to examine - the file even if we don't recognize the machine type. */ - &bfd_elf32_big_generic_vec, - &bfd_elf32_bigmips_vec, - &bfd_elf32_hppa_vec, - &bfd_elf32_i386_vec, - &bfd_elf32_i860_vec, - &bfd_elf32_little_generic_vec, - &bfd_elf32_littlemips_vec, - &bfd_elf32_m68k_vec, - &bfd_elf32_m88k_vec, - &bfd_elf32_sparc_vec, - &bfd_elf32_powerpc_vec, -#ifdef BFD64 /* No one seems to use this. */ - &bfd_elf64_big_generic_vec, - &bfd_elf64_little_generic_vec, -#endif -#if 0 - &bfd_elf64_sparc_vec, -#endif - /* We don't include cisco_core_vec. Although it has a magic number, - the magic number isn't at the beginning of the file, and thus - might spuriously match other kinds of files. */ -#ifdef BFD64 - &demo_64_vec, /* Only compiled if host has long-long support */ -#endif - &ecoff_big_vec, - &ecoff_little_vec, -#if 0 - &ecoffalpha_little_vec, -#endif - &h8300coff_vec, - &h8500coff_vec, -#if 0 - /* Since a.out files lack decent magic numbers, no way to recognize - which kind of a.out file it is. */ - &host_aout_vec, -#endif -#if 0 /* Clashes with sunos_big_vec magic no. */ - &hp300bsd_vec, -#endif - &hp300hpux_vec, -#if defined (HOST_HPPAHPUX) || defined (HOST_HPPABSD) || defined (HOST_HPPAOSF) - &som_vec, -#endif - &i386aout_vec, - &i386bsd_vec, - &i386coff_vec, - &i386freebsd_vec, - &i860coff_vec, - &bfd_powerpc_pe_vec, - &bfd_powerpcle_pe_vec, - &bfd_powerpc_pei_vec, - &bfd_powerpcle_pei_vec, - &go32coff_vec, -#if 0 - /* Since a.out files lack decent magic numbers, no way to recognize - which kind of a.out file it is. */ - &i386linux_vec, -#endif - &i386lynx_aout_vec, - &i386lynx_coff_vec, -#if 0 - /* No distinguishing features for Mach 3 executables. */ - &i386mach3_vec, -#endif - &i386msdos_vec, - &i386netbsd_vec, - &i386os9k_vec, - &i386pe_vec, - &i386pei_vec, - &armcoff_little_vec, - &armcoff_big_vec, - &armpe_little_vec, - &armpe_big_vec, - &armpei_little_vec, - &armpei_big_vec, - &icoff_big_vec, - &icoff_little_vec, - &ieee_vec, - &m68kcoff_vec, - &m68kcoffun_vec, -#if 0 - /* Since a.out files lack decent magic numbers, no way to recognize - which kind of a.out file it is. */ - &m68klinux_vec, -#endif - &m68klynx_aout_vec, - &m68klynx_coff_vec, - &m68knetbsd_vec, - &m88kbcs_vec, - &m88kmach3_vec, - &newsos3_vec, - &nlm32_i386_vec, - &nlm32_sparc_vec, -#ifdef BFD64 - &nlm32_alpha_vec, -#endif - &pc532netbsd_vec, -#if 0 - /* We have no oasys tools anymore, so we can't test any of this - anymore. If you want to test the stuff yourself, go ahead... - steve@cygnus.com - Worse, since there is no magic number for archives, there - can be annoying target mis-matches. */ - &oasys_vec, -#endif - &pc532machaout_vec, -#if 0 - /* We have no way of distinguishing these from other a.out variants */ - &aout_arm_big_vec, - &aout_arm_little_vec, - &riscix_vec, -#endif -#if 0 - /* This has the same magic number as RS/6000. */ - &pmac_xcoff_vec, -#endif - &rs6000coff_vec, - &shcoff_vec, - &shlcoff_vec, - &sparclynx_aout_vec, - &sparclynx_coff_vec, - &sparcnetbsd_vec, - &sunos_big_vec, - &aout0_big_vec, - &tekhex_vec, - &we32kcoff_vec, - &versados_vec, - &z8kcoff_vec, - -#endif /* not SELECT_VECS */ - -/* Always support S-records, for convenience. */ - &srec_vec, - &symbolsrec_vec, -/* And tekhex */ - &tekhex_vec, -/* Likewise for binary output. */ - &binary_vec, -/* Likewise for ihex. */ - &ihex_vec, - -/* Add any required traditional-core-file-handler. */ - -#ifdef AIX386_CORE - &aix386_core_vec, -#endif -#ifdef HPUX_CORE - &hpux_core_vec, -#endif -#ifdef HPPABSD_CORE - &hppabsd_core_vec, -#endif -#ifdef IRIX_CORE - &irix_core_vec, -#endif -#ifdef OSF_CORE - &osf_core_vec, -#endif -#ifdef TRAD_CORE - &trad_core_vec, -#endif - -#ifdef PTRACE_CORE - &ptrace_core_vec, -#endif - - NULL /* end of list marker */ -}; - -/* bfd_default_vector[0] contains either the address of the default vector, - if there is one, or zero if there isn't. */ - -const bfd_target * const bfd_default_vector[] = { -#ifdef DEFAULT_VECTOR - &DEFAULT_VECTOR, -#endif - NULL -}; - -/* When there is an ambiguous match, bfd_check_format_matches puts the - names of the matching targets in an array. This variable is the maximum - number of entries that the array could possibly need. */ -const size_t _bfd_target_vector_entries = sizeof(bfd_target_vector)/sizeof(*bfd_target_vector); - -/* -FUNCTION - bfd_find_target - -SYNOPSIS - const bfd_target *bfd_find_target(CONST char *target_name, bfd *abfd); - -DESCRIPTION - Return a pointer to the transfer vector for the object target - named @var{target_name}. If @var{target_name} is <>, choose the - one in the environment variable <>; if that is null or not - defined, then choose the first entry in the target list. - Passing in the string "default" or setting the environment - variable to "default" will cause the first entry in the target - list to be returned, and "target_defaulted" will be set in the - BFD. This causes <> to loop over all the - targets to find the one that matches the file being read. -*/ - -const bfd_target * -bfd_find_target (target_name, abfd) - CONST char *target_name; - bfd *abfd; -{ - const bfd_target * const *target; - extern char *getenv (); - CONST char *targname = (target_name ? target_name : - (CONST char *) getenv ("GNUTARGET")); - - /* This is safe; the vector cannot be null */ - if (targname == NULL || !strcmp (targname, "default")) { - abfd->target_defaulted = true; - return abfd->xvec = bfd_target_vector[0]; - } - - abfd->target_defaulted = false; - - for (target = &bfd_target_vector[0]; *target != NULL; target++) { - if (!strcmp (targname, (*target)->name)) - return abfd->xvec = *target; - } - - bfd_set_error (bfd_error_invalid_target); - return NULL; -} - - -/* -FUNCTION - bfd_target_list - -SYNOPSIS - const char **bfd_target_list(void); - -DESCRIPTION - Return a freshly malloced NULL-terminated - vector of the names of all the valid BFD targets. Do not - modify the names. - -*/ - -const char ** -bfd_target_list () -{ - int vec_length= 0; -#if defined (HOST_HPPAHPUX) && ! defined (__STDC__) - /* The native compiler on the HP9000/700 has a bug which causes it - to loop endlessly when compiling this file. This avoids it. */ - volatile -#endif - const bfd_target * const *target; - CONST char **name_list, **name_ptr; - - for (target = &bfd_target_vector[0]; *target != NULL; target++) - vec_length++; - - name_ptr = name_list = (CONST char **) - bfd_zmalloc ((vec_length + 1) * sizeof (char **)); - - if (name_list == NULL) - return NULL; - - for (target = &bfd_target_vector[0]; *target != NULL; target++) - *(name_ptr++) = (*target)->name; - - return name_list; -} diff --git a/contrib/gdb/bfd/tekhex.c b/contrib/gdb/bfd/tekhex.c deleted file mode 100644 index bf7957e..0000000 --- a/contrib/gdb/bfd/tekhex.c +++ /dev/null @@ -1,1031 +0,0 @@ -/* BFD backend for Extended Tektronix Hex Format objects. - Copyright (C) 1992, 1993, 1994, 1995 Free Software Foundation, Inc. - - Written by Steve Chamberlain of Cygnus Support . - -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. */ - -/* -SUBSECTION - Tektronix Hex Format handling - -DESCRIPTION - - Tek Hex records can hold symbols and data, but not - relocations. Their main application is communication with - devices like PROM programmers and ICE equipment. - - It seems that the sections are descibed as being really big, - the example I have says that the text section is 0..ffffffff. - BFD would barf with this, many apps would try to alloc 4GB to - read in the file. - - Tex Hex may contain many sections, but the data which comes in - has no tag saying which section it belongs to, so we create - one section for each block of data, called "blknnnn" which we - stick all the data into. - - TekHex may come out of order and there is no header, so an - initial scan is required to discover the minimum and maximum - addresses used to create the vma and size of the sections we - create. - We read in the data into pages of CHUNK_MASK+1 size and read - them out from that whenever we need to. - - Any number of sections may be created for output, we save them - up and output them when it's time to close the bfd. - - - A TekHex record looks like: -EXAMPLE - % - -DESCRIPTION - Where - o length - is the number of bytes in the record not including the % sign. - o type - is one of: - 3) symbol record - 6) data record - 8) termination record - - -The data can come out of order, and may be discontigous. This is a -serial protocol, so big files are unlikely, so we keep a list of 8k chunks -*/ - -#include "bfd.h" -#include "sysdep.h" -#include "libbfd.h" -#include "libiberty.h" - -typedef struct - { - bfd_vma low; - bfd_vma high; - } addr_range_type; - -typedef struct tekhex_symbol_struct - { - - asymbol symbol; - struct tekhex_symbol_struct *prev; - - } tekhex_symbol_type; - -static const char digs[] = "0123456789ABCDEF"; - -static char sum_block[256]; - -#define NOT_HEX 20 -#define NIBBLE(x) hex_value(x) -#define HEX(buffer) ((NIBBLE((buffer)[0])<<4) + NIBBLE((buffer)[1])) -#define TOHEX(d,x) \ -(d)[1] = digs[(x) & 0xf]; \ -(d)[0] = digs[((x)>>4)&0xf]; -#define ISHEX(x) hex_p(x) - -/* -Here's an example -%3A6C6480004E56FFFC4E717063B0AEFFFC6D0652AEFFFC60F24E5E4E75 -%1B3709T_SEGMENT1108FFFFFFFF -%2B3AB9T_SEGMENT7Dgcc_compiled$1087hello$c10 -%373829T_SEGMENT80int$t1$r1$$214741080char$t2$r2$0$12710 -%373769T_SEGMENT80long$int$t3$r1$$1080unsigned$int$t4$10 -%373CA9T_SEGMENT80long$unsigned$in1080short$int$t6$r1$10 -%373049T_SEGMENT80long$long$int$t71080short$unsigned$i10 -%373A29T_SEGMENT80long$long$unsign1080signed$char$t10$10 -%373D69T_SEGMENT80unsigned$char$t11080float$t12$r1$4$010 -%373D19T_SEGMENT80double$t13$r1$8$1080long$double$t14$10 -%2734D9T_SEGMENT8Bvoid$t15$151035_main10 -%2F3CA9T_SEGMENT81$1081$1681$1E81$21487main$F110 -%2832F9T_SEGMENT83i$18FFFFFFFC81$1481$214 -%07 8 10 10 - -explanation: -%3A6C6480004E56FFFC4E717063B0AEFFFC6D0652AEFFFC60F24E5E4E75 - ^ ^^ ^ ^-data - | || +------ 4 char integer 0x8000 - | |+-------- checksum - | +--------- type 6 (data record) - +----------- length 3a chars - <---------------------- 3a (58 chars) -------------------> - -%1B3709T_SEGMENT1108FFFFFFFF - ^ ^^ ^- 8 character integer 0xffffffff - | |+- 1 character integer 0 - | +-- type 1 symbol (section definition) - +------------ 9 char symbol T_SEGMENT - -%2B3AB9T_SEGMENT7Dgcc_compiled$1087hello$c10 -%373829T_SEGMENT80int$t1$r1$$214741080char$t2$r2$0$12710 -%373769T_SEGMENT80long$int$t3$r1$$1080unsigned$int$t4$10 -%373CA9T_SEGMENT80long$unsigned$in1080short$int$t6$r1$10 -%373049T_SEGMENT80long$long$int$t71080short$unsigned$i10 -%373A29T_SEGMENT80long$long$unsign1080signed$char$t10$10 -%373D69T_SEGMENT80unsigned$char$t11080float$t12$r1$4$010 -%373D19T_SEGMENT80double$t13$r1$8$1080long$double$t14$10 -%2734D9T_SEGMENT8Bvoid$t15$151035_main10 -%2F3CA9T_SEGMENT81$1081$1681$1E81$21487main$F110 -%2832F9T_SEGMENT83i$18FFFFFFFC81$1481$214 -%0781010 - -Turns into -sac@thepub$ ./objdump -dx -m m68k f - -f: file format tekhex ------x--- 9/55728 -134219416 Sep 29 15:13 1995 f -architecture: UNKNOWN!, flags 0x00000010: -HAS_SYMS -start address 0x00000000 -SECTION 0 [D00000000] : size 00020000 vma 00000000 align 2**0 - ALLOC, LOAD -SECTION 1 [D00008000] : size 00002001 vma 00008000 align 2**0 - -SECTION 2 [T_SEGMENT] : size ffffffff vma 00000000 align 2**0 - -SYMBOL TABLE: -00000000 g T_SEGMENT gcc_compiled$ -00000000 g T_SEGMENT hello$c -00000000 g T_SEGMENT int$t1$r1$$21474 -00000000 g T_SEGMENT char$t2$r2$0$127 -00000000 g T_SEGMENT long$int$t3$r1$$ -00000000 g T_SEGMENT unsigned$int$t4$ -00000000 g T_SEGMENT long$unsigned$in -00000000 g T_SEGMENT short$int$t6$r1$ -00000000 g T_SEGMENT long$long$int$t7 -00000000 g T_SEGMENT short$unsigned$i -00000000 g T_SEGMENT long$long$unsign -00000000 g T_SEGMENT signed$char$t10$ -00000000 g T_SEGMENT unsigned$char$t1 -00000000 g T_SEGMENT float$t12$r1$4$0 -00000000 g T_SEGMENT double$t13$r1$8$ -00000000 g T_SEGMENT long$double$t14$ -00000000 g T_SEGMENT void$t15$15 -00000000 g T_SEGMENT _main -00000000 g T_SEGMENT $ -00000000 g T_SEGMENT $ -00000000 g T_SEGMENT $ -00000010 g T_SEGMENT $ -00000000 g T_SEGMENT main$F1 -fcffffff g T_SEGMENT i$1 -00000000 g T_SEGMENT $ -00000010 g T_SEGMENT $ - - -RELOCATION RECORDS FOR [D00000000]: (none) - -RELOCATION RECORDS FOR [D00008000]: (none) - -RELOCATION RECORDS FOR [T_SEGMENT]: (none) - -Disassembly of section D00000000: -... -00008000 ($+)7ff0 linkw fp,#-4 -00008004 ($+)7ff4 nop -00008006 ($+)7ff6 movel #99,d0 -00008008 ($+)7ff8 cmpl fp@(-4),d0 -0000800c ($+)7ffc blts 00008014 ($+)8004 -0000800e ($+)7ffe addql #1,fp@(-4) -00008012 ($+)8002 bras 00008006 ($+)7ff6 -00008014 ($+)8004 unlk fp -00008016 ($+)8006 rts -... - -*/ - -static void -tekhex_init () -{ - unsigned int i; - static boolean inited = false; - int val; - - if (inited == false) - { - inited = true; - hex_init (); - val = 0; - for (i = 0; i < 10; i++) - { - sum_block[i + '0'] = val++; - } - for (i = 'A'; i <= 'Z'; i++) - { - sum_block[i] = val++; - } - sum_block['$'] = val++; - sum_block['%'] = val++; - sum_block['.'] = val++; - sum_block['_'] = val++; - for (i = 'a'; i <= 'z'; i++) - { - sum_block[i] = val++; - } - } -} - -/* The maximum number of bytes on a line is FF */ -#define MAXCHUNK 0xff -/* The number of bytes we fit onto a line on output */ -#define CHUNK 21 - -/* We cannot output our tekhexords as we see them, we have to glue them - together, this is done in this structure : */ - -struct tekhex_data_list_struct -{ - unsigned char *data; - bfd_vma where; - bfd_size_type size; - struct tekhex_data_list_struct *next; - -}; -typedef struct tekhex_data_list_struct tekhex_data_list_type; - -#define CHUNK_MASK 0x1fff - -struct data_struct - { - char chunk_data[CHUNK_MASK + 1]; - char chunk_init[CHUNK_MASK + 1]; - bfd_vma vma; - struct data_struct *next; - }; - -typedef struct tekhex_data_struct -{ - tekhex_data_list_type *head; - unsigned int type; - struct tekhex_symbol_struct *symbols; - struct data_struct *data; -} tdata_type; - -#define enda(x) (x->vma + x->size) - -static bfd_vma -getvalue (srcp) - char **srcp; -{ - char *src = *srcp; - bfd_vma value = 0; - unsigned int len = hex_value(*src++); - - if (len == 0) - len = 16; - while (len--) - { - value = value << 4 | hex_value(*src++); - } - *srcp = src; - return value; -} - -static unsigned int -getsym (dstp, srcp) - char *dstp; - char **srcp; -{ - char *src = *srcp; - unsigned int i; - unsigned int len = hex_value(*src++); - - if (len == 0) - len = 16; - for (i = 0; i < len; i++) - dstp[i] = src[i]; - dstp[i] = 0; - *srcp = src + i; - return len; -} - -struct data_struct * -find_chunk (abfd, vma) - bfd *abfd; - bfd_vma vma; -{ - struct data_struct *d = abfd->tdata.tekhex_data->data; - - vma &= ~CHUNK_MASK; - while (d && (d->vma) != vma) - { - d = d->next; - } - if (!d) - { - char *sname = bfd_alloc (abfd, 12); - - /* No chunk for this address, so make one up */ - d = (struct data_struct *) - bfd_alloc (abfd, sizeof (struct data_struct)); - - if (!sname || !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; - } - return d; -} - -static void -insert_byte (abfd, value, addr) - bfd *abfd; - int value; - bfd_vma addr; -{ - /* Find the chunk that this byte needs and put it in */ - struct data_struct *d = find_chunk (abfd, addr); - - d->chunk_data[addr & CHUNK_MASK] = value; - d->chunk_init[addr & CHUNK_MASK] = 1; -} - -/* The first pass is to find the names of all the sections, and see - how big the data is */ -static void -first_phase (abfd, type, src) - bfd *abfd; - char type; - char *src; -{ - asection *section = bfd_abs_section_ptr; - int len; - char sym[17]; /* A symbol can only be 16chars long */ - - switch (type) - { - case '6': - /* Data record - read it and store it */ - { - bfd_vma addr = getvalue (&src); - - while (*src) - { - insert_byte (abfd, HEX (src), addr); - src += 2; - addr++; - } - } - - return; - case '3': - /* Symbol record, read the segment */ - len = getsym (sym, &src); - section = bfd_get_section_by_name (abfd, sym); - if (section == (asection *) NULL) - { - char *n = bfd_alloc (abfd, len + 1); - - if (!n) - abort(); /* FIXME */ - memcpy (n, sym, len + 1); - section = bfd_make_section (abfd, n); - } - while (*src) - { - switch (*src) - { - case '1': /* section range */ - src++; - section->vma = getvalue (&src); - section->_raw_size = getvalue (&src) - section->vma; - section->flags = SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC; - break; - case '0': - case '2': - case '3': - case '4': - case '6': - case '7': - case '8': - /* Symbols, add to section */ - { - tekhex_symbol_type *new = - (tekhex_symbol_type *) bfd_alloc (abfd, - sizeof (tekhex_symbol_type)); - char type = (*src); - - if (!new) - abort(); /* FIXME */ - new->symbol.the_bfd = abfd; - src++; - abfd->symcount++; - abfd->flags |= HAS_SYMS; - new->prev = abfd->tdata.tekhex_data->symbols; - abfd->tdata.tekhex_data->symbols = new; - len = getsym (sym, &src); - new->symbol.name = bfd_alloc (abfd, len + 1); - if (!new->symbol.name) - abort(); /* FIXME */ - memcpy ((char *) (new->symbol.name), sym, len + 1); - new->symbol.section = section; - if (type <= '4') - new->symbol.flags = (BSF_GLOBAL | BSF_EXPORT); - else - new->symbol.flags = BSF_LOCAL; - new->symbol.value = getvalue (&src) - section->vma; - } - } - } - } -} - -/* Pass over an tekhex, calling one of the above functions on each - record. */ - -static void - pass_over (abfd, func) - bfd *abfd; - void (*func) (); -{ - unsigned int chars_on_line; - boolean eof = false; - - /* To the front of the file */ - if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) - abort (); - while (eof == false) - { - char buffer[MAXCHUNK]; - char *src = buffer; - char type; - - /* Find first '%' */ - eof = (boolean) (bfd_read (src, 1, 1, abfd) != 1); - while (*src != '%' && !eof) - { - eof = (boolean) (bfd_read (src, 1, 1, abfd) != 1); - } - if (eof) - break; - src++; - - /* Fetch the type and the length and the checksum */ - if (bfd_read (src, 1, 5, abfd) != 5) - abort (); /* FIXME */ - - type = src[2]; - - if (!ISHEX (src[0]) || !ISHEX (src[1])) - break; - - chars_on_line = HEX (src) - 5; /* Already read five char */ - - if (bfd_read (src, 1, chars_on_line, abfd) != chars_on_line) - abort (); /* FIXME */ - src[chars_on_line] = 0; /* put a null at the end */ - - func (abfd, type, src); - } - -} - -long -tekhex_get_symtab (abfd, table) - bfd *abfd; - asymbol **table; - -{ - tekhex_symbol_type *p = abfd->tdata.tekhex_data->symbols; - unsigned int c = bfd_get_symcount (abfd); - - table[c] = 0; - while (p) - { - table[--c] = &(p->symbol); - p = p->prev; - } - - return bfd_get_symcount (abfd); -} - -long -tekhex_get_symtab_upper_bound (abfd) - bfd *abfd; -{ - return (abfd->symcount + 1) * (sizeof (struct tekhex_asymbol_struct *)); - -} - -static boolean -tekhex_mkobject (abfd) - bfd *abfd; -{ - tdata_type *tdata = (tdata_type *) bfd_alloc (abfd, sizeof (tdata_type)); - - if (!tdata) - return false; - abfd->tdata.tekhex_data = tdata; - tdata->type = 1; - tdata->head = (tekhex_data_list_type *) NULL; - tdata->symbols = (struct tekhex_symbol_struct *) NULL; - tdata->data = (struct data_struct *) NULL; - return true; -} - -/* - Return true if the file looks like it's in TekHex format. Just look - for a percent sign and some hex digits */ - -static const bfd_target * -tekhex_object_p (abfd) - bfd *abfd; -{ - char b[4]; - - tekhex_init (); - - if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0 - || bfd_read (b, 1, 4, abfd) != 4) - return NULL; - - if (b[0] != '%' || !ISHEX (b[1]) || !ISHEX (b[2]) || !ISHEX (b[3])) - return (const bfd_target *) NULL; - - tekhex_mkobject (abfd); - - pass_over (abfd, first_phase); - return abfd->xvec; -} - -static void -move_section_contents (abfd, section, locationp, offset, count, get) - bfd *abfd; - asection *section; - PTR locationp; - file_ptr offset; - bfd_size_type count; - boolean get; -{ - bfd_vma addr; - char *location = (char *) locationp; - bfd_vma prev_number = 1; /* Nothing can have this as a high bit*/ - struct data_struct *d = (struct data_struct *) NULL; - - for (addr = section->vma; count != 0; count--, addr++) - { - - bfd_vma chunk_number = addr & ~CHUNK_MASK; /* Get high bits of address */ - bfd_vma low_bits = addr & CHUNK_MASK; - - if (chunk_number != prev_number) - { - /* Different chunk, so move pointer */ - d = find_chunk (abfd, chunk_number); - } - - if (get) - { - if (d->chunk_init[low_bits]) - { - *location = d->chunk_data[low_bits]; - } - else - { - *location = 0; - } - } - else - { - d->chunk_data[low_bits] = *location; - d->chunk_init[low_bits] = (*location != 0); - } - - location++; - - } - -} -static boolean -tekhex_get_section_contents (abfd, section, locationp, offset, count) - bfd *abfd; - asection *section; - PTR locationp; - file_ptr offset; - bfd_size_type count; -{ - if (section->flags & (SEC_LOAD | SEC_ALLOC)) - { - move_section_contents (abfd, section, locationp, offset, count, true); - return true; - } - else - return false; -} - -boolean -tekhex_set_arch_mach (abfd, arch, machine) - bfd *abfd; - enum bfd_architecture arch; - unsigned long machine; -{ - return bfd_default_set_arch_mach (abfd, arch, machine); -} - -/* we have to save up all the Tekhexords for a splurge before output, - */ - -static boolean -tekhex_set_section_contents (abfd, section, locationp, offset, bytes_to_do) - bfd *abfd; - sec_ptr section; - PTR locationp; - file_ptr offset; - bfd_size_type bytes_to_do; -{ - - if (abfd->output_has_begun == false) - { - /* The first time around, allocate enough sections to hold all the chunks */ - asection *s = abfd->sections; - bfd_vma vma; - - for (s = abfd->sections; s; s = s->next) - { - if (s->flags & SEC_LOAD) - { - for (vma = s->vma & ~CHUNK_MASK; - vma < s->vma + s->_raw_size; - vma += CHUNK_MASK) - find_chunk (abfd, vma); - } - } - - } - if (section->flags & (SEC_LOAD | SEC_ALLOC)) - { - move_section_contents (abfd, section, locationp, offset, bytes_to_do, false); - return true; - } - else - return false; - -} - -static void -writevalue (dst, value) - char **dst; - bfd_vma value; -{ - char *p = *dst; - int len; - int shift; - - for (len = 8, shift = 28; shift; shift -= 4, len--) - { - if ((value >> shift) & 0xf) - { - *p++ = len + '0'; - while (len) - { - *p++ = digs[(value >> shift) & 0xf]; - shift -= 4; - len--; - } - *dst = p; - return; - - } - } - *p++ = '1'; - *p++ = '0'; - *dst = p; -} - -static void -writesym (dst, sym) - char **dst; - CONST char *sym; -{ - char *p = *dst; - int len = (sym ? strlen (sym) : 0); - - if (len >= 16) - { - *p++ = '0'; - len = 16; - } - - else - { - if (len == 0) - { - *p++ = '1'; - sym = "$"; - len = 1; - } - else - { - *p++ = digs[len]; - } - } - - while (len--) - { - *p++ = *sym++; - } - *dst = p; -} - -static void -out (abfd, type, start, end) - bfd *abfd; - char type; - char *start; - char *end; -{ - int sum = 0; - char *s; - char front[6]; - bfd_size_type wrlen; - - front[0] = '%'; - TOHEX (front + 1, end - start + 5); - front[3] = type; - - for (s = start; s < end; s++) - { - sum += sum_block[(unsigned char) *s]; - } - - sum += sum_block[(unsigned char) front[1]]; /* length */ - sum += sum_block[(unsigned char) front[2]]; - sum += sum_block[(unsigned char) front[3]]; /* type */ - TOHEX (front + 4, sum); - if (bfd_write (front, 1, 6, abfd) != 6) - abort (); - end[0] = '\n'; - wrlen = end - start + 1; - if (bfd_write (start, 1, wrlen, abfd) != wrlen) - abort (); -} - -static boolean -tekhex_write_object_contents (abfd) - bfd *abfd; -{ - int bytes_written; - char buffer[100]; - asymbol **p; - asection *s; - struct data_struct *d; - - bytes_written = 0; - - /* And the raw data */ - for (d = abfd->tdata.tekhex_data->data; - d != (struct data_struct *) NULL; - d = d->next) - { - int low; - - CONST int span = 32; - int addr; - - /* Write it in blocks of 32 bytes */ - - for (addr = 0; addr < CHUNK_MASK + 1; addr += span) - { - int need = 0; - - /* Check to see if necessary */ - for (low = 0; !need && low < span; low++) - { - if (d->chunk_init[addr + low]) - need = 1; - } - if (need) - { - char *dst = buffer; - - writevalue (&dst, addr + d->vma); - for (low = 0; low < span; low++) - { - TOHEX (dst, d->chunk_data[addr + low]); - dst += 2; - } - out (abfd, '6', buffer, dst); - } - } - } - /* write all the section headers for the sections */ - for (s = abfd->sections; s != (asection *) NULL; s = s->next) - { - char *dst = buffer; - - writesym (&dst, s->name); - *dst++ = '1'; - writevalue (&dst, s->vma); - writevalue (&dst, s->vma + s->_raw_size); - out (abfd, '3', buffer, dst); - } - - /* And the symbols */ - for (p = abfd->outsymbols; *p; p++) - { - int section_code = bfd_decode_symclass (*p); - - if (section_code != '?') - { /* do not include debug symbols */ - asymbol *s = *p; - char *dst = buffer; - - writesym (&dst, s->section->name); - - switch (section_code) - { - case 'A': - *dst++ = '2'; - break; - case 'a': - *dst++ = '6'; - break; - case 'D': - case 'B': - case 'O': - *dst++ = '4'; - break; - case 'd': - case 'b': - case 'o': - *dst++ = '8'; - break; - case 'T': - *dst++ = '3'; - break; - case 't': - *dst++ = '7'; - break; - case 'C': - case 'U': - bfd_set_error (bfd_error_wrong_format); - return false; - } - - writesym (&dst, s->name); - writevalue (&dst, s->value + s->section->vma); - out (abfd, '3', buffer, dst); - } - } - - /* And the terminator */ - if (bfd_write ("%0781010\n", 1, 9, abfd) != 9) - abort (); - return true; -} - -static int - tekhex_sizeof_headers (abfd, exec) - bfd *abfd; - boolean exec; - -{ - return 0; -} - -static asymbol * -tekhex_make_empty_symbol (abfd) - bfd *abfd; -{ - tekhex_symbol_type *new = - (tekhex_symbol_type *) bfd_zalloc (abfd, sizeof (struct tekhex_symbol_struct)); - - if (!new) - return NULL; - new->symbol.the_bfd = abfd; - new->prev = (struct tekhex_symbol_struct *) NULL; - return &(new->symbol); -} - -static void -tekhex_get_symbol_info (ignore_abfd, symbol, ret) - bfd *ignore_abfd; - asymbol *symbol; - symbol_info *ret; -{ - bfd_symbol_info (symbol, ret); -} - -static void -tekhex_print_symbol (ignore_abfd, filep, symbol, how) - bfd *ignore_abfd; - PTR filep; - asymbol *symbol; - bfd_print_symbol_type how; -{ - FILE *file = (FILE *) filep; - - switch (how) - { - case bfd_print_symbol_name: - fprintf (file, "%s", symbol->name); - break; - case bfd_print_symbol_more: - break; - - case bfd_print_symbol_all: - { - CONST char *section_name = symbol->section->name; - - bfd_print_symbol_vandf ((PTR) file, symbol); - - fprintf (file, " %-5s %s", - section_name, - symbol->name); - } - } -} - -#define tekhex_close_and_cleanup _bfd_generic_close_and_cleanup -#define tekhex_bfd_free_cached_info _bfd_generic_bfd_free_cached_info -#define tekhex_new_section_hook _bfd_generic_new_section_hook - -#define tekhex_bfd_is_local_label bfd_generic_is_local_label -#define tekhex_get_lineno _bfd_nosymbols_get_lineno -#define tekhex_find_nearest_line _bfd_nosymbols_find_nearest_line -#define tekhex_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol -#define tekhex_read_minisymbols _bfd_generic_read_minisymbols -#define tekhex_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol - -#define tekhex_bfd_get_relocated_section_contents \ - bfd_generic_get_relocated_section_contents -#define tekhex_bfd_relax_section bfd_generic_relax_section -#define tekhex_bfd_link_hash_table_create _bfd_generic_link_hash_table_create -#define tekhex_bfd_link_add_symbols _bfd_generic_link_add_symbols -#define tekhex_bfd_final_link _bfd_generic_final_link -#define tekhex_bfd_link_split_section _bfd_generic_link_split_section - -#define tekhex_get_section_contents_in_window \ - _bfd_generic_get_section_contents_in_window - -const bfd_target tekhex_vec = -{ - "tekhex", /* name */ - bfd_target_tekhex_flavour, - BFD_ENDIAN_UNKNOWN, /* target byte order */ - BFD_ENDIAN_UNKNOWN, /* target headers byte order */ - (EXEC_P | /* object flags */ - HAS_SYMS | HAS_LINENO | HAS_DEBUG | HAS_RELOC | HAS_LOCALS | - WP_TEXT | D_PAGED), - (SEC_CODE | SEC_DATA | SEC_ROM | SEC_HAS_CONTENTS - | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */ - 0, /* leading underscore */ - ' ', /* ar_pad_char */ - 16, /* ar_max_namelen */ - bfd_getb64, bfd_getb_signed_64, bfd_putb64, - bfd_getb32, bfd_getb_signed_32, bfd_putb32, - bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */ - bfd_getb64, bfd_getb_signed_64, bfd_putb64, - bfd_getb32, bfd_getb_signed_32, bfd_putb32, - bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */ - - { - _bfd_dummy_target, - tekhex_object_p, /* bfd_check_format */ - _bfd_dummy_target, - _bfd_dummy_target, - }, - { - bfd_false, - tekhex_mkobject, - _bfd_generic_mkarchive, - bfd_false, - }, - { /* bfd_write_contents */ - bfd_false, - tekhex_write_object_contents, - _bfd_write_archive_contents, - bfd_false, - }, - - BFD_JUMP_TABLE_GENERIC (tekhex), - BFD_JUMP_TABLE_COPY (_bfd_generic), - BFD_JUMP_TABLE_CORE (_bfd_nocore), - BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive), - BFD_JUMP_TABLE_SYMBOLS (tekhex), - BFD_JUMP_TABLE_RELOCS (_bfd_norelocs), - BFD_JUMP_TABLE_WRITE (tekhex), - BFD_JUMP_TABLE_LINK (tekhex), - BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), - - (PTR) 0 -}; diff --git a/contrib/gdb/bfd/trad-core.c b/contrib/gdb/bfd/trad-core.c deleted file mode 100644 index 62d6192..0000000 --- a/contrib/gdb/bfd/trad-core.c +++ /dev/null @@ -1,315 +0,0 @@ -/* BFD back end for traditional Unix core files (U-area and raw sections) - Copyright 1988, 1989, 1991, 1992, 1993, 1994 Free Software Foundation, Inc. - Written by John Gilmore of Cygnus Support. - -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 "libaout.h" /* BFD a.out internal data structures */ - -#include -#include -#include -#include - -#include /* After a.out.h */ - -#ifdef TRAD_HEADER -#include TRAD_HEADER -#endif - - struct trad_core_struct - { - asection *data_section; - asection *stack_section; - asection *reg_section; - struct user u; - }; - -#define core_upage(bfd) (&((bfd)->tdata.trad_core_data->u)) -#define core_datasec(bfd) ((bfd)->tdata.trad_core_data->data_section) -#define core_stacksec(bfd) ((bfd)->tdata.trad_core_data->stack_section) -#define core_regsec(bfd) ((bfd)->tdata.trad_core_data->reg_section) - -/* forward declarations */ - -const bfd_target *trad_unix_core_file_p PARAMS ((bfd *abfd)); -char * trad_unix_core_file_failing_command PARAMS ((bfd *abfd)); -int trad_unix_core_file_failing_signal PARAMS ((bfd *abfd)); -boolean trad_unix_core_file_matches_executable_p - PARAMS ((bfd *core_bfd, bfd *exec_bfd)); - -/* Handle 4.2-style (and perhaps also sysV-style) core dump file. */ - -/* ARGSUSED */ -const bfd_target * -trad_unix_core_file_p (abfd) - bfd *abfd; - -{ - int val; - struct user u; - struct trad_core_struct *rawptr; - -#ifdef TRAD_CORE_USER_OFFSET - /* If defined, this macro is the file position of the user struct. */ - if (bfd_seek (abfd, TRAD_CORE_USER_OFFSET, SEEK_SET) != 0) - return 0; -#endif - - val = bfd_read ((void *)&u, 1, sizeof u, abfd); - if (val != sizeof u) - { - /* Too small to be a core file */ - bfd_set_error (bfd_error_wrong_format); - return 0; - } - - /* Sanity check perhaps??? */ - if (u.u_dsize > 0x1000000) /* Remember, it's in pages... */ - { - bfd_set_error (bfd_error_wrong_format); - return 0; - } - if (u.u_ssize > 0x1000000) - { - bfd_set_error (bfd_error_wrong_format); - return 0; - } - - /* Check that the size claimed is no greater than the file size. */ - { - FILE *stream = bfd_cache_lookup (abfd); - struct stat statbuf; - if (stream == NULL) - return 0; - if (fstat (fileno (stream), &statbuf) < 0) - { - bfd_set_error (bfd_error_system_call); - return 0; - } - if (NBPG * (UPAGES + u.u_dsize -#ifdef TRAD_CORE_DSIZE_INCLUDES_TSIZE - - u.u_tsize -#endif - + u.u_ssize) > statbuf.st_size) - { - bfd_set_error (bfd_error_file_truncated); - return 0; - } -#ifndef TRAD_CORE_ALLOW_ANY_EXTRA_SIZE - if (NBPG * (UPAGES + u.u_dsize + u.u_ssize) -#ifdef TRAD_CORE_EXTRA_SIZE_ALLOWED - /* Some systems write the file too big. */ - + TRAD_CORE_EXTRA_SIZE_ALLOWED -#endif - < statbuf.st_size) - { - /* The file is too big. Maybe it's not a core file - or we otherwise have bad values for u_dsize and u_ssize). */ - bfd_set_error (bfd_error_wrong_format); - return 0; - } -#endif - } - - /* OK, we believe you. You're a core file (sure, sure). */ - - /* Allocate both the upage and the struct core_data at once, so - a single free() will free them both. */ - rawptr = (struct trad_core_struct *) - bfd_zmalloc (sizeof (struct trad_core_struct)); - if (rawptr == NULL) - return 0; - - abfd->tdata.trad_core_data = rawptr; - - rawptr->u = u; /*Copy the uarea into the tdata part of the bfd */ - - /* Create the sections. This is raunchy, but bfd_close wants to free - them separately. */ - - core_stacksec(abfd) = (asection *) bfd_zalloc (abfd, sizeof (asection)); - if (core_stacksec (abfd) == NULL) - return NULL; - core_datasec (abfd) = (asection *) bfd_zalloc (abfd, sizeof (asection)); - if (core_datasec (abfd) == NULL) - return NULL; - core_regsec (abfd) = (asection *) bfd_zalloc (abfd, sizeof (asection)); - if (core_regsec (abfd) == NULL) - return NULL; - - core_stacksec (abfd)->name = ".stack"; - core_datasec (abfd)->name = ".data"; - core_regsec (abfd)->name = ".reg"; - - core_stacksec (abfd)->flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS; - core_datasec (abfd)->flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS; - core_regsec (abfd)->flags = SEC_HAS_CONTENTS; - - core_datasec (abfd)->_raw_size = NBPG * u.u_dsize -#ifdef TRAD_CORE_DSIZE_INCLUDES_TSIZE - - NBPG * u.u_tsize -#endif - ; - core_stacksec (abfd)->_raw_size = NBPG * u.u_ssize; - core_regsec (abfd)->_raw_size = NBPG * UPAGES; /* Larger than sizeof struct u */ - - /* What a hack... we'd like to steal it from the exec file, - since the upage does not seem to provide it. FIXME. */ -#ifdef HOST_DATA_START_ADDR - core_datasec (abfd)->vma = HOST_DATA_START_ADDR; -#else - core_datasec (abfd)->vma = HOST_TEXT_START_ADDR + (NBPG * u.u_tsize); -#endif - -#ifdef HOST_STACK_START_ADDR - core_stacksec (abfd)->vma = HOST_STACK_START_ADDR; -#else - core_stacksec (abfd)->vma = HOST_STACK_END_ADDR - (NBPG * u.u_ssize); -#endif - - /* This is tricky. As the "register section", we give them the entire - upage and stack. u.u_ar0 points to where "register 0" is stored. - There are two tricks with this, though. One is that the rest of the - registers might be at positive or negative (or both) displacements - from *u_ar0. The other is that u_ar0 is sometimes an absolute address - in kernel memory, and on other systems it is an offset from the beginning - of the `struct user'. - - As a practical matter, we don't know where the registers actually are, - so we have to pass the whole area to GDB. We encode the value of u_ar0 - by setting the .regs section up so that its virtual memory address - 0 is at the place pointed to by u_ar0 (by setting the vma of the start - of the section to -u_ar0). GDB uses this info to locate the regs, - using minor trickery to get around the offset-or-absolute-addr problem. */ - core_regsec (abfd)->vma = 0 - (bfd_vma) u.u_ar0; - - core_datasec (abfd)->filepos = NBPG * UPAGES; - core_stacksec (abfd)->filepos = (NBPG * UPAGES) + NBPG * u.u_dsize -#ifdef TRAD_CORE_DSIZE_INCLUDES_TSIZE - - NBPG * u.u_tsize -#endif - ; - core_regsec (abfd)->filepos = 0; /* Register segment is the upage */ - - /* Align to word at least */ - core_stacksec (abfd)->alignment_power = 2; - core_datasec (abfd)->alignment_power = 2; - core_regsec (abfd)->alignment_power = 2; - - abfd->sections = core_stacksec (abfd); - core_stacksec (abfd)->next = core_datasec (abfd); - core_datasec (abfd)->next = core_regsec (abfd); - abfd->section_count = 3; - - return abfd->xvec; -} - -char * -trad_unix_core_file_failing_command (abfd) - bfd *abfd; -{ -#ifndef NO_CORE_COMMAND - char *com = abfd->tdata.trad_core_data->u.u_comm; - if (*com) - return com; - else -#endif - return 0; -} - -/* ARGSUSED */ -int -trad_unix_core_file_failing_signal (ignore_abfd) - bfd *ignore_abfd; -{ -#ifdef TRAD_UNIX_CORE_FILE_FAILING_SIGNAL - return TRAD_UNIX_CORE_FILE_FAILING_SIGNAL(ignore_abfd); -#else - return -1; /* FIXME, where is it? */ -#endif -} - -/* ARGSUSED */ -boolean -trad_unix_core_file_matches_executable_p (core_bfd, exec_bfd) - bfd *core_bfd, *exec_bfd; -{ - return true; /* FIXME, We have no way of telling at this point */ -} - -/* If somebody calls any byte-swapping routines, shoot them. */ -void -swap_abort() -{ - abort(); /* This way doesn't require any declaration for ANSI to fuck up */ -} -#define NO_GET ((bfd_vma (*) PARAMS (( const bfd_byte *))) swap_abort ) -#define NO_PUT ((void (*) PARAMS ((bfd_vma, bfd_byte *))) swap_abort ) -#define NO_SIGNED_GET \ - ((bfd_signed_vma (*) PARAMS ((const bfd_byte *))) swap_abort ) - -const bfd_target trad_core_vec = - { - "trad-core", - bfd_target_unknown_flavour, - BFD_ENDIAN_UNKNOWN, /* target byte order */ - BFD_ENDIAN_UNKNOWN, /* target headers byte order */ - (HAS_RELOC | EXEC_P | /* object flags */ - HAS_LINENO | HAS_DEBUG | - HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED), - (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */ - 0, /* symbol prefix */ - ' ', /* ar_pad_char */ - 16, /* ar_max_namelen */ - NO_GET, NO_SIGNED_GET, NO_PUT, /* 64 bit data */ - NO_GET, NO_SIGNED_GET, NO_PUT, /* 32 bit data */ - NO_GET, NO_SIGNED_GET, NO_PUT, /* 16 bit data */ - NO_GET, NO_SIGNED_GET, NO_PUT, /* 64 bit hdrs */ - NO_GET, NO_SIGNED_GET, NO_PUT, /* 32 bit hdrs */ - NO_GET, NO_SIGNED_GET, NO_PUT, /* 16 bit hdrs */ - - { /* bfd_check_format */ - _bfd_dummy_target, /* unknown format */ - _bfd_dummy_target, /* object file */ - _bfd_dummy_target, /* archive */ - trad_unix_core_file_p /* a core file */ - }, - { /* bfd_set_format */ - bfd_false, bfd_false, - bfd_false, bfd_false - }, - { /* bfd_write_contents */ - bfd_false, bfd_false, - bfd_false, bfd_false - }, - - BFD_JUMP_TABLE_GENERIC (_bfd_generic), - BFD_JUMP_TABLE_COPY (_bfd_generic), - BFD_JUMP_TABLE_CORE (trad_unix), - BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive), - BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols), - BFD_JUMP_TABLE_RELOCS (_bfd_norelocs), - BFD_JUMP_TABLE_WRITE (_bfd_generic), - BFD_JUMP_TABLE_LINK (_bfd_nolink), - BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), - - (PTR) 0 /* backend_data */ -}; diff --git a/contrib/gdb/include/COPYING b/contrib/gdb/include/COPYING deleted file mode 100644 index a43ea21..0000000 --- a/contrib/gdb/include/COPYING +++ /dev/null @@ -1,339 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 675 Mass Ave, Cambridge, MA 02139, USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - Appendix: How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) 19yy - - 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. - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) 19yy name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/contrib/gdb/include/ChangeLog b/contrib/gdb/include/ChangeLog deleted file mode 100644 index 3594591..0000000 --- a/contrib/gdb/include/ChangeLog +++ /dev/null @@ -1,973 +0,0 @@ -Tue Mar 12 17:29:46 1996 Ian Lance Taylor - - * bfdlink.h (bfd_wrapped_link_hash_lookup): Declare. - (struct bfd_link_info): Add wrap_hash field. - -Wed Feb 14 16:49:17 1996 Martin Anantharaman - - * ieee.h (ieee_record_enum_type): Define - ieee_external_reference_info_enum. - -Fri Feb 2 17:09:25 1996 Doug Evans - - * dis-asm.h (DISASM_RAW_INSN): Delete. - -Tue Jan 23 09:21:47 1996 Doug Evans - - * dis-asm.h (INIT_DISASSEMBLE_INFO): Set endian to BFD_ENDIAN_UNKNOWN. - New argument FPRINTF_FUNC. - -Mon Jan 22 16:37:59 1996 Doug Evans - - * dis-asm.h (disassemble_info): New members arch, mach, endian. - (INIT_DISASSEMBLE_INFO): Initialize them. - (DISASM_RAW_INSN{,FLAG}): Define. - -Thu Jan 18 11:32:38 1996 Ian Lance Taylor - - * demangle.h (cplus_demangle_opname): Change opname parameter to - const char *. - (cplus_mangle_opname): Change return type and opname parameter to - const char *. - -Fri Jan 5 00:01:22 1996 Ian Lance Taylor - - * ieee.h (enum ieee_record): Add ieee_asn_record_enum, - ieee_at_record_enum, ieee_ty_record_enum, ieee_atn_record_enum, - ieee_bb_record_enum, and ieee_be_record_enum. - -Wed Jan 3 13:12:09 1996 Fred Fish - - * obstack.h: Update copyright to 1996. - (_obstack_memory_used): Declare. - (obstack_memory_used): Define macro. - -Thu Dec 28 11:42:12 1995 Ian Lance Taylor - - * libiberty.h (xstrdup): Declare. - -Thu Dec 21 14:47:17 1995 Michael Meissner - - * wait.h: Protect all macros with #ifndef. - -Tue Oct 24 21:45:40 1995 Ian Lance Taylor - - * bfdlink.h (struct bfd_link_info): Add static_link field. - -Tue Sep 12 16:28:04 1995 Ian Lance Taylor - - * bfdlink.h (struct bfd_link_callbacks): Add symbol parameter to - warning callback. - -Fri Sep 1 13:11:51 1995 Ian Lance Taylor - - * bfdlink.h (struct bfd_link_callbacks): Change warning callback - to take BFD, section, and address arguments. - -Thu Aug 31 16:45:12 1995 steve chamberlain - - * bfdlink.h (struct bfd_link_info): Remove PE stuff. - -Tue Aug 22 03:18:23 1995 Ken Raeburn - - * libiberty.h: Declare xstrerror. From Pat Rankin. - -Mon Aug 21 18:11:36 1995 steve chamberlain - - * bfdlink.h (struct bfd_link_info): Remove PE stuff. - -Wed Aug 2 08:14:12 1995 Doug Evans - - * dis-asm.h (print_insn_sparc64): Declare. - -Mon Jul 10 13:26:49 1995 Eric Youngdale - - * bfdlink.h (struct bfd_link_info): Add new field symbolic. - -Sun Jul 2 17:48:40 1995 Ian Lance Taylor - - * bfdlink.h (struct bfd_link_info): Change type of base_file to - PTR. - -Thu Jun 29 00:02:45 1995 Steve Chamberlain - - * bfdlink.h (struct bfd_link_info): Added base_file member. - -Tue Jun 20 16:40:04 1995 Steve Chamberlain - - * ansidecl.h: win32s is ANSI enough. - -Thu May 18 04:25:50 1995 Ken Raeburn - - Wed May 10 14:28:16 1995 Richard Earnshaw (rearnsha@armltd.co.uk) - - * dis-asm.h (print_insn_arm): Delete declaration. - (print_insn_{little,big}_arm): New declarations. - - * floatformat.h (floatformat_arm_ext): Declare. - -Sat May 13 10:14:08 1995 Steve Chamberlain - - * coff/pe.h: New file. - * bfdlink.h (subsytem, stack_heap_parameters): New. - * coff/i386.h (NT_SECTION_ALIGNMENT, NT_FILE_ALIGNMENT, - NT_DEF_RESERVE, NT_DEF_COMMIT): New. - * coff/internal.h (internal_filehdr): New fields for PE. - (IMAGE_DATA_DIRECTORY): New. - (internal_aouthdr): New fields for PE. - -Thu May 4 14:36:42 1995 Jason Merrill - - * demangle.h: Don't include ansidecl.h if IN_GCC. - - -Tue Feb 21 00:37:28 1995 Jeff Law (law@snake.cs.utah.edu) - - * hp-symtab.h: Don't use bitfield enumerations, the HP C compiler - does not handle them correctly. - - -Thu Feb 9 14:20:27 1995 Ian Lance Taylor - - * libiberty.h (basename): Don't declare parameter type; some - systems have this in their header files. - -Wed Feb 8 17:35:38 1995 Ian Lance Taylor - - * bfdlink.h (struct bfd_link_hash_entry): Change format of common - symbol information, to remove restrictions on maximum size and - alignment power, by using a pointer to a structure instead. - -Mon Feb 6 14:55:32 1995 Ian Lance Taylor - - * bfdlink.h (enum bfd_link_hash_type): Rename bfd_link_hash_weak - to bfd_link_hash_undefweak. Add bfd_link_hash_defweak. - -Mon Jan 16 21:00:23 1995 Stan Shebs - - * dis-asm.h (GDB_INIT_DISASSEMBLE_INFO, etc): Remove all - GDB-specific definitions. - -Sun Jan 15 18:39:35 1995 Steve Chamberlain - - * dis-asm.h (print_insn_w65): Declare. - -Thu Jan 12 17:51:17 1995 Ken Raeburn - - * libiberty.h (hex_p): Fix sense of test. - -Wed Jan 11 22:36:40 1995 Ken Raeburn - - * libiberty.h (_hex_array_size, _hex_bad, _hex_value, hex_init, - hex_p, hex_value): New macros and declarations, for hex.c. - -Fri Jan 6 17:44:14 1995 Ian Lance Taylor - - * dis-asm.h: Make idempotent. - -Wed Dec 14 13:08:43 1994 Stan Shebs - - * progress.h: New file, empty definitions for progress macros. - - -Fri Nov 25 00:14:05 1994 Jeff Law (law@snake.cs.utah.edu) - - * hp-symtab.h: New file describing the debug symbols emitted - by the HP C compilers. - -Fri Nov 11 15:48:37 1994 Ian Lance Taylor - - * bfdlink.h (struct bfd_link_hash_entry): Change u.c.size from 24 - to 26 bits, and change u.c.alignment_power from 8 to 6 bits. 6 - bit in the alignment power is enough for a 64 bit address space. - -Mon Oct 31 13:02:51 1994 Stan Shebs (shebs@andros.cygnus.com) - - * demangle.h (cplus_mangle_opname): Declare. - -Tue Oct 25 11:38:02 1994 Ian Lance Taylor - - * bfdlink.h (struct bfd_link_callbacks): Fix comments for - multiple_common field. - -Sun Sep 04 17:58:10 1994 Richard Earnshaw (rwe@pegasus.esprit.ec.org) - - * aout/aout64.h: Only define QMAGIC if it isn't already defined. - - * dis-asm.h: Add support for the ARM. - -Wed Aug 10 12:51:41 1994 Doug Evans (dje@canuck.cygnus.com) - - * libiberty.h (strsignal): Document its existence even if we - can't declare it. - -Tue Aug 2 14:40:03 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * os9k.h: Remove u_int16, u_int32, and owner_id typedefs and - expand their uses. Those names conflict with Mach headers. - -Fri Jul 22 14:17:12 1994 Ian Lance Taylor (ian@sanguine.cygnus.com) - - * bfdlink.h (struct bfd_link_hash_entry): Change u.c.size into a - bitfield. Add field u.c.alignment_power. - -Sun Jul 10 00:26:39 1994 Ian Dall (dall@hfrd.dsto.gov.au) - - * dis-asm.h: Add print_insn_ns32k declaration. - -Mon Jun 20 17:13:29 1994 Ian Lance Taylor (ian@sanguine.cygnus.com) - - * bfdlink.h (bfd_link_hash_table): Make creator a const pointer. - -Sat Jun 18 16:09:32 1994 Stan Shebs (shebs@andros.cygnus.com) - - * demangle.h (cplus_demangle_opname): Declare. - -Thu Jun 16 15:19:03 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * bfdlink.h (struct bfd_link_info): Add new field shared. - -Mon Jun 6 14:39:44 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * bfdlink.h (struct bfd_link_hash_entry): Remove written field: - not needed for all backends. - -Thu Apr 28 19:06:50 1994 Ken Raeburn (raeburn@cujo.cygnus.com) - - * dis-asm.h (disassembler): Declare. - -Fri Apr 1 00:38:17 1994 Jim Wilson (wilson@mole.gnu.ai.mit.edu) - - * obstack.h: Delete use of IN_GCC to control whether - stddef.h or gstddef.h is included. - -Tue Mar 22 13:06:02 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * bfdlink.h (enum bfd_link_order_type): Add bfd_data_link_order. - (struct bfd_link_order): Add data field to union. - -Mon Mar 21 18:45:26 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * bfdlink.h (struct bfd_link_callbacks): Change bitsize argument - to add_to_set to reloc. Remove bitsize argument from constructor. - Comment that reloc_overflow, reloc_dangerous and unattached_reloc - must handle NULL pointers for reloc location. - (enum bfd_link_order_type): Add bfd_section_reloc_link_order and - bfd_symbol_reloc_link_order. - (struct bfd_link_order): Add reloc field to union. - (struct bfd_link_order_reloc): Define. - -Mon Mar 14 12:27:50 1994 Ian Lance Taylor (ian@cygnus.com) - - * ieee-float.h: Removed; no longer used. - -Tue Mar 1 18:10:49 1994 Kung Hsu (kung@mexican.cygnus.com) - - * os9k.h: os9000 target specific header file, the header of the - object file is used now. - -Sun Feb 27 21:52:26 1994 Jim Kingdon (kingdon@deneb.cygnus.com) - - * floatformat.h: New file, intended to replace ieee-float.h. - -Sun Feb 20 17:15:42 1994 Ian Lance Taylor (ian@lisa.cygnus.com) - - * ansidecl.h (ANSI_PROTOTYPES): Define if using ANSI prototypes. - -Wed Feb 16 01:07:12 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * libiberty.h: Don't declare strsignal, to avoid conflicts with - Solaris system header files. - -Sat Feb 12 22:11:32 1994 Jeffrey A. Law (law@snake.cs.utah.edu) - - * libiberty.h (xexit): Use __volatile__ to avoid losing if - compiling with gcc -traditional. - -Thu Feb 10 14:05:41 1994 Ian Lance Taylor (ian@cygnus.com) - - * libiberty.h: New file. Declares functions provided by - libiberty. - -Tue Feb 8 05:19:52 1994 David J. Mackenzie (djm@thepub.cygnus.com) - - Handle obstack_chunk_alloc returning NULL. This allows - obstacks to be used by libraries, without forcing them - to call exit or longjmp. - * obstack.h (struct obstack): Add alloc_failed flag. - _obstack_begin, _obstack_begin_1): Declare to return int, not void. - (obstack_finish): If alloc_failed, return NULL. - (obstack_base, obstack_next_free, objstack_object_size): - If alloc_failed, return 0. - (obstack_grow, obstack_grow0, obstack_1grow, obstack_ptr_grow, - obstack_int_grow, obstack_blank): If alloc_failed, do nothing that - could corrupt the obstack. - -Mon Jan 24 15:06:05 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * bfdlink.h (struct bfd_link_callbacks): Add name, reloc_name and - addend argments to reloc_overflow callback. - -Fri Jan 21 19:13:12 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * dis-asm.h (print_insn_big_powerpc, print_insn_little_powerpc, - print_insn_rs6000): Declare. - -Thu Jan 6 14:15:55 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * bfdlink.h (struct bfd_link_callbacks): Add bitsize argument to - add_to_set field. Add new callback named constructor. - -Thu Dec 30 10:44:06 1993 Ian Lance Taylor (ian@rtl.cygnus.com) - - * bfdlink.h: New file for new BFD linker backend routines. - -Mon Nov 29 10:43:57 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * dis-asm.h (enum dis_insn_tyupe): Remove non-ANSI trailing comma. - -Sat Oct 2 20:42:26 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * dis-asm.h: Move comment to right place. - -Mon Aug 9 19:03:35 1993 David J. Mackenzie (djm@thepub.cygnus.com) - - * obstack.h (obstack_chunkfun, obstack_freefun): Add defns from - previous version. Are these Cygnus local changes? - -Fri Aug 6 17:05:47 1993 David J. Mackenzie (djm@thepub.cygnus.com) - - * getopt.h, obstack.h: Update to latest FSF version. - -Mon Aug 2 16:37:14 1993 Stu Grossman (grossman at cygnus.com) - - * coff/i386.h: Add Lynx magic number. - -Mon Aug 2 14:45:29 1993 John Gilmore (gnu@cygnus.com) - - * dis-asm.h: Move enum outside of struct defn to avoid warnings. - -Mon Aug 2 08:49:30 1993 Stu Grossman (grossman at cygnus.com) - - * wait.h (WEXITSTATUS, WSTOPSIG): Mask down to 8 bits. This is - for systems that store stuff into the high 16 bits of a wait - status. - -Fri Jul 30 18:38:02 1993 John Gilmore (gnu@cygnus.com) - - * dis-asm.h: Add new fields insn_info_valid, branch_delay_insns, - data_size, insn_type, target, target2. These are used to return - information from the instruction decoders back to the calling - program. Add comments, make more readable. - -Mon Jul 19 22:14:14 1993 Fred Fish (fnf@deneb.cygnus.com) - - * nlm: New directory containing NLM/NetWare includes. - -Thu Jul 15 12:10:04 1993 Ken Raeburn (raeburn@cambridge.cygnus.com) - - * dis-asm.h (struct disassemble_info): New field application_data. - -Thu Jul 15 12:41:15 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * dis-asm.h: Added declaration of print_insn_m88k. - -Thu Jul 8 09:05:26 1993 Doug Evans (dje@canuck.cygnus.com) - - * opcode/h8300.h: Lots of little fixes for the h8/300h. - -Fri Jul 2 10:31:59 1993 Ian Lance Taylor (ian@cygnus.com) - - * ansidecl.h: Use ANSI macros if __mips and _SYSTYPE_SVR4 are - defined, since RISC/OS cc handles ANSI declarations in SVR4 mode - but does not define __STDC__. - -Sun Jun 20 18:27:52 1993 Ken Raeburn (raeburn@poseidon.cygnus.com) - - * dis-asm.h: Don't need to include ansidecl.h any more. - -Fri Jun 18 03:22:10 1993 John Gilmore (gnu@cygnus.com) - - * oasys.h: Eliminate "int8_type", "int16_type", "int32_type", and - their variants. These changes are coordinated with corresponding - changes in ../bfd/oasys.c. - -Wed Jun 16 10:43:08 1993 Fred Fish (fnf@cygnus.com) - - * bfd.h: Note that it has been removed. - -Tue Jun 8 12:16:03 1993 Steve Chamberlain (sac@phydeaux.cygnus.com) - - Support for H8/300-H - * dis-asm.h (print_insn_h8300, print_insn_h8300h): Declare it. - * coff/h8300.h: New magic number. - * coff/internal.h: New relocations. - * opcode/h8300.h: Lots of new opcodes. - -Tue Jun 1 07:35:03 1993 Ken Raeburn (raeburn@kr-pc.cygnus.com) - - * ansidecl.h (const): Don't define it if it's already defined. - -Thu May 27 18:19:51 1993 Ken Raeburn (raeburn@cambridge.cygnus.com) - - * dis-asm.h (print_insn_hppa): Declare it. - - * bfd.h: Moved to bfd directory. Small stub here includes it - without requiring "-I../bfd". - -Thu Apr 29 12:06:13 1993 Ken Raeburn (raeburn@deneb.cygnus.com) - - * bfd.h: Updated with BSF_FUNCTION. - -Mon Apr 26 18:15:50 1993 Steve Chamberlain (sac@thepub.cygnus.com) - - * bfd.h, dis-asm.h: Updated with Hitachi SH. - -Fri Apr 23 18:41:38 1993 Steve Chamberlain (sac@thepub.cygnus.com) - - * bfd.h: Updated with alpha changes. - * dis-asm.h: Added alpha. - -Fri Apr 16 17:35:30 1993 Jim Kingdon (kingdon@cygnus.com) - - * bfd.h: Update for signed bfd_*get_*. - -Thu Apr 15 09:24:21 1993 Jim Kingdon (kingdon@cygnus.com) - - * bfd.h: Updated for file_truncated error. - -Thu Apr 8 10:53:47 1993 Ian Lance Taylor (ian@cygnus.com) - - * ansidecl.h: If no ANSI, define const to be empty. - -Thu Apr 1 09:00:10 1993 Jim Kingdon (kingdon@cygnus.com) - - * dis-asm.h: Declare a29k and i960 print_insn_*. - - * dis-asm.h: Add print_address_func and related stuff. - - * dis-asm.h (dis_asm_read_memory): Fix prototype. - -Wed Mar 31 17:40:16 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * dis-asm.h: Add print_insn_sparc. - -Wed Mar 31 17:51:42 1993 Ian Lance Taylor (ian@cygnus.com) - - * bfd.h: Updated for BFD_RELOC_MIPS_GPREL and bfd_[gs]et_gp_size - prototypes. - -Wed Mar 31 16:35:12 1993 Stu Grossman (grossman@cygnus.com) - - * dis-asm.h: (disassemble_info): Fix typo in prototype of - dis_asm_memory_error(). - -Tue Mar 30 19:09:23 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * dis-asm.h (disassembler_info): Add read_memory_func, - memory_error_func, buffer, and length. - ({GDB_,}INIT_DISASSEMBLE_INFO): Set them. - print_insn_*: Remove second argument. - -Tue Mar 30 14:48:55 1993 Steve Chamberlain (sac@thepub.cygnus.com) - - * bfd.h: Update for lma field of section. - -Tue Mar 30 12:22:55 1993 Jim Kingdon (kingdon@cygnus.com) - - * ansidecl.h: Use ANSI versions on AIX regardless of __STDC__. - -Fri Mar 19 14:49:49 1993 Steve Chamberlain (sac@thepub.cygnus.com) - - * dis-asm.h: Add h8500. - -Thu Mar 18 13:49:09 1993 Per Bothner (bothner@rtl.cygnus.com) - - * ieee-float.h: Moved from ../gdb. - * dis-asm.h: New file. Interface to dis-assembler. - -Thu Mar 11 10:52:57 1993 Fred Fish (fnf@cygnus.com) - - * demangle.h (DMGL_NO_OPTS): Add define (set to 0) to use - in place of bare 0, for readability reasons. - -Tue Mar 2 17:50:11 1993 Fred Fish (fnf@cygnus.com) - - * demangle.h: Replace all references to cfront with ARM. - -Tue Feb 23 12:21:14 1993 Ian Lance Taylor (ian@cygnus.com) - - * bfd.h: Update for new elements in JUMP_TABLE. - -Tue Feb 16 00:51:30 1993 John Gilmore (gnu@cygnus.com) - - * bfd.h: Update for BFD_VERSION 2.1. - -Tue Jan 26 11:49:20 1993 Ian Lance Taylor (ian@cygnus.com) - - * bfd.h: Update for SEC_IS_COMMON flag. - -Tue Jan 19 12:25:12 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * bfd.h: Update for bfd_asymbol_value bug fix. - -Fri Jan 8 16:37:18 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * bfd.h: Update to include ECOFF tdata and target_flavour. - -Sun Dec 27 17:52:30 1992 Fred Fish (fnf@cygnus.com) - - * bfd.h: Add declaration for bfd_get_size(). - -Tue Dec 22 22:42:46 1992 Fred Fish (fnf@cygnus.com) - - * demangle.h: Protect file from multiple inclusions with - #if !defined(DEMANGLE_H)...#define DEMANGLE_H...#endif. - -Mon Dec 21 21:25:50 1992 Stu Grossman (grossman at cygnus.com) - - * bfd.h: Update to get hppa_core_struct from bfd.c. - -Thu Dec 17 00:42:35 1992 John Gilmore (gnu@cygnus.com) - - * bfd.h: Update to get tekhex tdata name change from bfd. - -Mon Nov 9 23:55:42 1992 John Gilmore (gnu@cygnus.com) - - * ansidecl.h: Update comments to discourage use of EXFUN. - -Thu Nov 5 16:35:44 1992 Ian Lance Taylor (ian@cygnus.com) - - * bfd.h: Update to bring in SEC_SHARED_LIBRARY. - -Thu Nov 5 03:21:32 1992 John Gilmore (gnu@cygnus.com) - - * bfd.h: Update to match EXFUN, bfd_seclet_struct, and SDEF - cleanups in bfd. - -Wed Nov 4 07:28:05 1992 Ken Raeburn (raeburn@cygnus.com) - - * bout.h (N_CALLNAME, N_BALNAME): Define as char-type values, so - widening works consistently. - -Fri Oct 16 03:17:08 1992 John Gilmore (gnu@cygnus.com) - - * getopt.h: Update to Revised Standard FSF Version. - -Thu Oct 15 21:43:22 1992 K. Richard Pixley (rich@sendai.cygnus.com) - - * getopt.h (struct option): use the provided enum for has_arg. - - * demangle.h (AUTO_DEMANGLING, GNU_DEMANGLING, - LUCID_DEMANGLING): ultrix compilers require enums to be - enums and ints to be ints and casts where they meet. cast some - enums into ints. - -Thu Oct 15 04:35:51 1992 John Gilmore (gnu@cygnus.com) - - * bfd.h: Update after comment changes. - -Thu Oct 8 09:03:02 1992 Steve Chamberlain (sac@thepub.cygnus.com) - - * bfd.h (bfd_get_symbol_leading_char): new macro for getting in xvec - -Thu Sep 3 09:10:50 1992 Stu Grossman (grossman at cygnus.com) - - * bfd.h (struct reloc_howto_struct): size needs to be signed if - it's going to hold negative values. - -Sun Aug 30 17:50:27 1992 Per Bothner (bothner@rtl.cygnus.com) - - * demangle.h: New file, moved from ../gdb. Made independent - of gdb. Allow demangling style option to be passed as a - parameter to cplus_demangle(), but using the - current_demangling_style global as the default. - -Sat Aug 29 10:07:55 1992 Fred Fish (fnf@cygnus.com) - - * obstack.h: Merge comment change from current FSF version. - -Thu Aug 27 12:59:29 1992 Brendan Kehoe (brendan@cygnus.com) - - * bfd.h: add we32k - -Tue Aug 25 15:07:47 1992 Steve Chamberlain (sac@thepub.cygnus.com) - - * bfd.h: new after Z8000 stuff - -Mon Aug 17 09:01:23 1992 Ken Raeburn (raeburn@cygnus.com) - - * bfd.h: Regenerated after page/segment size changes. - -Sat Aug 1 13:46:31 1992 Fred Fish (fnf@cygnus.com) - - * obstack.h: Merge changes from current FSF version. - -Mon Jul 20 21:06:23 1992 Fred Fish (fnf@cygnus.com) - - * obstack.h (area_id, flags): Remove, replace with extra_arg, - use_extra_arg, and maybe_empty_object. - * obstack.h (OBSTACK_MAYBE_EMPTY_OBJECT, OBSTACK_MMALLOC_LIKE): - Remove, replaced by maybe_empty_object and use_extra_arg bitfields. - * obstack.h (obstack_full_begin, _obstack_begin): Remove area_id - and flags arguments. - * obstack.h (obstack_alloc_arg): New macro to set extra_arg. - -Thu Jul 16 08:12:44 1992 Steve Chamberlain (sac@thepub.cygnus.com) - - * bfd.h: new after adding BFD_IS_RELAXABLE - -Sat Jul 4 03:22:23 1992 John Gilmore (gnu at cygnus.com) - - * bfd.h: Regen after adding BSF_FILE. - -Mon Jun 29 14:18:36 1992 Fred Fish (fnf at sunfish) - - * obstack.h: Convert bcopy() use to memcpy(), which is more - portable, more standard, and can take advantage of gcc's builtin - functions for increased performance. - -Thu Jun 25 04:46:08 1992 John Gilmore (gnu at cygnus.com) - - * ansidecl.h (PARAMS): Incorporate this macro from gdb's defs.h. - It's a cleaner way to forward-declare function prototypes. - -Fri Jun 19 15:46:32 1992 Stu Grossman (grossman at cygnus.com) - - * bfd.h: HPPA merge. - -Tue Jun 16 21:30:56 1992 K. Richard Pixley (rich@cygnus.com) - - * getopt.h: gratuitous white space changes merged from other prep - releases. - -Thu Jun 11 01:10:55 1992 John Gilmore (gnu at cygnus.com) - - * bfd.h: Regen'd from bfd.c after removing elf_core_tdata_struct. - -Mon May 18 17:29:03 1992 K. Richard Pixley (rich@cygnus.com) - - * getopt.h: merged changes from make-3.62.11. - - * getopt.h: merged changes from grep-1.6 (alpha). - -Fri May 8 14:53:32 1992 K. Richard Pixley (rich@cygnus.com) - - * getopt.h: merged changes from bison-1.18. - -Sat Mar 14 17:25:20 1992 Fred Fish (fnf@cygnus.com) - - * obstack.h: Add "area_id" and "flags" members to obstack - structure. Add obstack_chunkfun() and obstack_freefun() to - set functions explicitly. Convert maybe_empty_object to - a bit in "flags". - -Thu Feb 27 22:01:02 1992 Per Bothner (bothner@cygnus.com) - - * wait.h (WIFSTOPPED): Add IBM rs6000-specific version. - -Fri Feb 21 20:49:20 1992 John Gilmore (gnu at cygnus.com) - - * obstack.h: Add obstack_full_begin. - * bfd.h, obstack.h: Protolint. - -Thu Jan 30 01:18:42 1992 John Gilmore (gnu at cygnus.com) - - * bfd.h: Remove comma from enum declaration. - -Mon Jan 27 22:01:13 1992 Steve Chamberlain (sac at cygnus.com) - - * bfd.h : new target entr, bfd_relax_section - -Wed Dec 18 17:19:44 1991 Stu Grossman (grossman at cygnus.com) - - * bfd.h, ieee.h, opcode/m68k.h, opcode/sparc.h: ANSIfy enums. - -Thu Dec 12 20:59:56 1991 John Gilmore (gnu at cygnus.com) - - * fopen-same.h, fopen-bin.h: New files for configuring - whether fopen distinguishes binary files or not. For use - by host-dependent config files. - -Sat Nov 30 20:46:43 1991 Steve Chamberlain (sac at rtl.cygnus.com) - - * bfd.h: change the documentation format. - - * created coff, elf and opcode and aout directories. Moved: - - aout64.h ==> aout/aout64.h - ar.h ==> aout/ar.h - a.out.encap.h ==> aout/encap.h - a.out.host.h ==> aout/host.h - a.out.hp.h ==> aout/hp.h - a.out.sun4.h ==> aout/sun4.h - ranlib.h ==> aout/ranlib.h - reloc.h ==> aout/reloc.h - stab.def ==> aout/stab.def - stab.gnu.h ==> aout/stab_gnu.h - - coff-a29k.h ==> coff/a29k.h - coff-h8300.h ==> coff/h8300.h - coff-i386.h ==> coff/i386.h - coff-i960.h ==> coff/i960.h - internalcoff.h ==> coff/internal.h - coff-m68k.h ==> coff/m68k.h - coff-m88k.h ==> coff/m88k.h - coff-mips.h ==> coff/mips.h - coff-rs6000.h ==> coff/rs6000.h - - elf-common.h ==> elf/common.h - dwarf.h ==> elf/dwarf.h - elf-external.h ==> elf/external.h - elf-internal.h ==> elf/internal.h - - a29k-opcode.h ==> opcode/a29k.h - arm-opcode.h ==> opcode/arm.h - h8300-opcode.h ==> opcode/h8300.h - i386-opcode.h ==> opcode/i386.h - i860-opcode.h ==> opcode/i860.h - i960-opcode.h ==> opcode/i960.h - m68k-opcode.h ==> opcode/m68k.h - m88k-opcode.h ==> opcode/m88k.h - mips-opcode.h ==> opcode/mips.h - np1-opcode.h ==> opcode/np1.h - ns32k-opcode.h ==> opcode/ns32k.h - pn-opcode.h ==> opcode/pn.h - pyr-opcode.h ==> opcode/pyr.h - sparc-opcode.h ==> opcode/sparc.h - tahoe-opcode.h ==> opcode/tahoe.h - vax-opcode.h ==> opcode/vax.h - - - -Wed Nov 27 10:38:31 1991 Steve Chamberlain (sac at rtl.cygnus.com) - - * internalcoff.h: (internal_scnhdr) took out #def dependency, now - s_nreloc and s_nlnno are always long. (internal_reloc): allways - has an offset field now. - -Fri Nov 22 08:12:58 1991 John Gilmore (gnu at cygnus.com) - - * coff-rs6000.h: Lint; use unsigned chars for external fields. - * internalcoff.h: Lint; cast storage classes to signed char. - -Thu Nov 21 21:01:05 1991 Per Bothner (bothner at cygnus.com) - - * stab.def: Remove the GNU extended type codes (e.g. N_SETT). - * aout64.h: The heuristic for distinguishing between - sunos-style and bsd-style ZMAGIC files (wrt. where the - text segment starts) is moved into (the default definition of) - the macro N_HEADER_IN_TEXT. This definition is only used - if no other definition is used - e.g. bfd/newsos3.c defines - N_HEADER_IN_TEXT(x) to be always 0 (as before). - -Thu Nov 21 11:53:03 1991 John Gilmore (gnu at cygnus.com) - - * aout64.h (N_TXTADDR, N_TXTOFF, N_TXTSIZE): New definitions - that should handle all uses. LOGICAL_ versions deleted. - Eliminate N_HEADER_IN_TEXT, using a_entry to determine which - kind of zmagic a.out file we are looking at. - * coff-rs6000.h: Typo. - -Tue Nov 19 18:43:37 1991 Per Bothner (bothner at cygnus.com) - - (Note: This is a revised entry, as was aout64.h.) - * aout64.h: Some cleanups of N_TXTADDR and N_TXTOFF: - Will now work for both old- and new-style ZMAGIC files, - depending on N_HEADER_IN_TEXT macro. - Add LOGICAL_TXTADDR, LOICAL_TXTOFF and LOGICAL_TXTSIZE - that don't count the exec header as part - of the text segment, to be consistent with bfd. - * a.out.sun4.h: Simplified/fixed for previous change. - -Mon Nov 18 00:02:06 1991 Fred Fish (fnf at cygnus.com) - - * dwarf.h: Update to DWARF draft 5 version from gcc2. - -Thu Nov 14 19:44:59 1991 Per Bothner (bothner at cygnus.com) - - * stab.def: Added defs for extended GNU symbol types, - such as N_SETT. These are normally ifdef'd out (because - of conflicts with a.out.gnu.h), but are used by bfb_stab_name(). - -Thu Nov 14 19:17:03 1991 Fred Fish (fnf at cygnus.com) - - * elf-common.h: Add defines to support ELF symbol table code. - -Mon Nov 11 19:01:06 1991 Fred Fish (fnf at cygnus.com) - - * elf-internal.h, elf-external.h, elf-common.h: Add support for - note sections, which are used in ELF core files to hold copies - of various /proc structures. - -Thu Nov 7 08:58:26 1991 Steve Chamberlain (sac at cygnus.com) - - * internalcoff.h: took out the M88 dependency in the lineno - struct. - * coff-m88k.h: defines GET_LINENO_LNNO and PUT_LINENO_LNNO to use - 32bit linno entries. - * a29k-opcode.h: fixed encoding of mtacc - -Sun Nov 3 11:54:22 1991 Per Bothner (bothner at cygnus.com) - - * bfd.h: Updated from ../bfd/bfd-in.h (q.v). - -Fri Nov 1 11:13:53 1991 John Gilmore (gnu at cygnus.com) - - * internalcoff.h: Add x_csect defines. - -Fri Oct 25 03:18:20 1991 John Gilmore (gnu at cygnus.com) - - * Rename COFF-related files in `coff-ARCH.h' form. - coff-a29k.h, coff-i386.h, coff-i960.h, coff-m68k.h, coff-m88k.h, - coff-mips.h, coff-rs6000.h to be exact. - -Thu Oct 24 22:11:11 1991 John Gilmore (gnu at cygnus.com) - - RS/6000 support, by Metin G. Ozisik, Mimi Phûông-Thåo Võ, and - John Gilmore. - - * a.out.gnu.h: Update slightly. - * bfd.h: Add new error code, fix doc, add bfd_arch_rs6000. - * internalcoff.h: Add more F_ codes for filehdr. Add - rs/6000-dependent fields to aouthdr. Add storage classes - to syments. Add 6000-specific auxent. Add r_size in reloc. - * rs6000coff.c: New file. - -Thu Oct 24 04:13:20 1991 Fred Fish (fnf at cygnus.com) - - * dwarf.h: New file for dwarf support. Copied from gcc2 - distribution. - -Wed Oct 16 13:31:45 1991 John Gilmore (gnu at cygnus.com) - - * aout64.h: Remove PAGE_SIZE defines; they are target-dependent. - Add N_FN_SEQ for N_FN symbol type used on Sequent machines. - * stab.def: Include N_FN_SEQ in table. - * bout.h: External formats of structures use unsigned chars. - -Fri Oct 11 12:40:43 1991 Steve Chamberlain (steve at cygnus.com) - - * bfd.h:upgrade from bfd.c - * internalcoff.h: add n_name, n_zeroes and n_offset macros - * amdcoff.h: Define OMAGIC and AOUTHDRSZ. - -Fri Oct 11 10:58:06 1991 Per Bothner (bothner at cygnus.com) - - * a.out.host.h: Change SEGMENT_SIZE to 0x1000 for Sony. - * bfd.h (align_power): Add (actually move) comment. - -Tue Oct 8 15:29:32 1991 Per Bothner (bothner at cygnus.com) - - * sys/h-rtbsd.h: Define MISSING_VFPRINT (for binutils/bucomm.c). - -Sun Oct 6 19:24:39 1991 John Gilmore (gnu at cygnus.com) - - * aout64.h: Move struct internal_exec to ../bfd/libaout.h so - it can be shared by all `a.out-family' code. Rename - EXTERNAL_LIST_SIZE to EXTERNAL_NLIST_SIZE. Use basic types - for nlist members, and make strx integral rather than pointer. - More commentary on n_type values. - * bout.h: Provide a struct external_exec rather than an - internal_exec. - * m68kcoff.h: Remove `tagentries' which snuck in from the i960 - COFF port. - -Fri Oct 4 01:25:59 1991 John Gilmore (gnu at cygnus.com) - - * h8300-opcode.h: Remove `_enum' from the typedef for an enum. - * bfd.h: Update to match bfd changes. - - * sys/h-i386mach.h, sysdep.h: Add 386 Mach host support. - -Tue Oct 1 04:58:42 1991 John Gilmore (gnu at cygnus.com) - - * bfd.h, elf-common.h, elf-external.h, elf-internal.h: - Add preliminary ELF support, sufficient for GDB, from Fred Fish. - * sysdep.h, sys/h-amix.h: Support Amiga SVR4. - - * sys/h-vaxult.h: Make it work. (David Taylor ) - * a.out.vax.h: Remove unused and confusing file. - -Mon Sep 30 12:52:35 1991 Per Bothner (bothner at cygnus.com) - - * sysdep.h: Define NEWSOS3_SYS, and use it. - -Fri Sep 20 13:38:21 1991 John Gilmore (gnu at cygnus.com) - - * a.out.gnu.h (N_FN): Its value *really is* 0x1F. - Fix it, and add comments warning about or-ing N_EXT with it - and/or N_WARNING. - * aout64.h (N_FN): Fix value, add comments about N_EXT. - * stab.def (table at end): Update to show all the type - values <0x20, including low order bits. Move N_FN to - its rightful place. - -Tue Sep 17 17:41:37 1991 Stu Grossman (grossman at cygnus.com) - - * sys/h-irix3.h: sgi/irix support. - -Tue Sep 17 07:52:59 1991 John Gilmore (gnu at cygint.cygnus.com) - - * stab.def (N_DEFD): Add GNU Modula-2 debug stab, from Andrew - Beers. - -Thu Sep 12 14:12:59 1991 John Gilmore (gnu at cygint.cygnus.com) - - * internalcoff.h (SYMNMLEN, FILNMLEN, DIMNUM): Define these - for internalcoff, separately from the various external coff's. - * amdcoff.h, bcs88kcoff.h, i386coff.h, intel-coff.h, m68kcoff.h, - m88k-bcs.h: Prefix SYMNMLEN, FILNMLEN, and DIMNUM with E_'s for - the external struct definitions. - * ecoff.h: Remove these #define's, kludge no longer needed. - - * sys/h-ultra3.h: Add new Ultracomputer host. - * sysdep.h: Add ULTRA3_SYM1_SYS and use it. - -Tue Sep 10 10:11:46 1991 John Gilmore (gnu at cygint.cygnus.com) - - * i386coff.h (LINESZ): Always 6, not based on sizeof(). - (Fix from Peter Schauer .) - -Wed Sep 4 08:58:37 1991 John Gilmore (gnu at cygint.cygnus.com) - - * a.out.gnu.h, aout64.h: Add N_WARNING. Change N_FN to 0x0E, - to match SunOS and BSD. Add N_COMM as 0x12 for SunOS shared lib - support. - * stab.def: Add N_COMM to table, fix overlap comment. - -Tue Sep 3 06:29:20 1991 John Gilmore (gnu at cygint.cygnus.com) - - Merge with latest FSF versions of these files. - - * stab.gnu.h: Add LAST_UNUSED_STAB_CODE. - * stab.def: Update to GPL2. Move N_WARNING out, since not a - debug symbol. Change comments, and reorder table to numeric - order. Update final table comment. - (N_DSLINE, N_BSLINE): Renumber from 0x66 and 0x68, to 0x46 and 0x48. - - * obstack.h: GPL2. Merge. - -Fri Aug 23 01:54:23 1991 John Gilmore (gnu at cygint.cygnus.com) - - * a.out.gnu.h, a.out.sun4.h: Make SEGMENT_SIZE able to depend - on the particular a.out being examined. - * a.out.sun4.h: Define segment sizes for Sun-3's and Sun-4's. - * FIXME: a.out.gnu.h is almost obsolete. - * FIXME: a.out.sun4.h should be renamed a.out.sun.h now. - -Wed Aug 21 20:32:13 1991 John Gilmore (gnu at cygint.cygnus.com) - - * Start a ChangeLog for the includes directory. - - * a.out.gnu.h (N_FN): Fix value -- was 15, should be 0x1E. - * stab.def: Update allocation table in comments at end, - to reflect reality as I know it. - - -Local Variables: -mode: indented-text -left-margin: 8 -fill-column: 74 -version-control: never -End: diff --git a/contrib/gdb/include/ansidecl.h b/contrib/gdb/include/ansidecl.h deleted file mode 100644 index be04e42..0000000 --- a/contrib/gdb/include/ansidecl.h +++ /dev/null @@ -1,141 +0,0 @@ -/* ANSI and traditional C compatability macros - Copyright 1991, 1992 Free Software Foundation, Inc. - This file is part of the GNU C 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. */ - -/* ANSI and traditional C compatibility macros - - ANSI C is assumed if __STDC__ is #defined. - - Macro ANSI C definition Traditional C definition - ----- ---- - ---------- ----------- - ---------- - PTR `void *' `char *' - LONG_DOUBLE `long double' `double' - VOLATILE `volatile' `' - SIGNED `signed' `' - PTRCONST `void *const' `char *' - ANSI_PROTOTYPES 1 not defined - - CONST is also defined, but is obsolete. Just use const. - - DEFUN (name, arglist, args) - - Defines function NAME. - - ARGLIST lists the arguments, separated by commas and enclosed in - parentheses. ARGLIST becomes the argument list in traditional C. - - ARGS list the arguments with their types. It becomes a prototype in - ANSI C, and the type declarations in traditional C. Arguments should - be separated with `AND'. For functions with a variable number of - arguments, the last thing listed should be `DOTS'. - - DEFUN_VOID (name) - - Defines a function NAME, which takes no arguments. - - obsolete -- EXFUN (name, (prototype)) -- obsolete. - - Replaced by PARAMS. Do not use; will disappear someday soon. - Was used in external function declarations. - In ANSI C it is `NAME PROTOTYPE' (so PROTOTYPE should be enclosed in - parentheses). In traditional C it is `NAME()'. - For a function that takes no arguments, PROTOTYPE should be `(void)'. - - PARAMS ((args)) - - We could use the EXFUN macro to handle prototype declarations, but - the name is misleading and the result is ugly. So we just define a - simple macro to handle the parameter lists, as in: - - static int foo PARAMS ((int, char)); - - This produces: `static int foo();' or `static int foo (int, char);' - - EXFUN would have done it like this: - - static int EXFUN (foo, (int, char)); - - but the function is not external...and it's hard to visually parse - the function name out of the mess. EXFUN should be considered - obsolete; new code should be written to use PARAMS. - - For example: - extern int printf PARAMS ((CONST char *format DOTS)); - int DEFUN(fprintf, (stream, format), - FILE *stream AND CONST char *format DOTS) { ... } - void DEFUN_VOID(abort) { ... } -*/ - -#ifndef _ANSIDECL_H - -#define _ANSIDECL_H 1 - - -/* Every source file includes this file, - so they will all get the switch for lint. */ -/* LINTLIBRARY */ - - -#if defined (__STDC__) || defined (_AIX) || (defined (__mips) && defined (_SYSTYPE_SVR4)) || defined(WIN32) -/* All known AIX compilers implement these things (but don't always - define __STDC__). The RISC/OS MIPS compiler defines these things - in SVR4 mode, but does not define __STDC__. */ - -#define PTR void * -#define PTRCONST void *CONST -#define LONG_DOUBLE long double - -#define AND , -#define NOARGS void -#define CONST const -#define VOLATILE volatile -#define SIGNED signed -#define DOTS , ... - -#define EXFUN(name, proto) name proto -#define DEFUN(name, arglist, args) name(args) -#define DEFUN_VOID(name) name(void) - -#define PROTO(type, name, arglist) type name arglist -#define PARAMS(paramlist) paramlist -#define ANSI_PROTOTYPES 1 - -#else /* Not ANSI C. */ - -#define PTR char * -#define PTRCONST PTR -#define LONG_DOUBLE double - -#define AND ; -#define NOARGS -#define CONST -#ifndef const /* some systems define it in header files for non-ansi mode */ -#define const -#endif -#define VOLATILE -#define SIGNED -#define DOTS - -#define EXFUN(name, proto) name() -#define DEFUN(name, arglist, args) name arglist args; -#define DEFUN_VOID(name) name() -#define PROTO(type, name, arglist) type name () -#define PARAMS(paramlist) () - -#endif /* ANSI C. */ - -#endif /* ansidecl.h */ diff --git a/contrib/gdb/include/aout/ChangeLog b/contrib/gdb/include/aout/ChangeLog deleted file mode 100644 index 307448b..0000000 --- a/contrib/gdb/include/aout/ChangeLog +++ /dev/null @@ -1,174 +0,0 @@ -Mon Mar 11 12:15:52 1996 Ian Lance Taylor - - * stab.def: Use __define_stab_duplicate rather than __define_stab - for duplicate entries N_BROWS and N_MOD2. - * stab_gnu.h (__define_stab_duplicate): Define before including - stab.def. - -Fri Oct 27 17:47:16 1995 Niklas Hallqvist - - * aout64.h, host.h, hp300hpux.h, sun4.h: Changed PAGE_SIZE to - TARGET_PAGE_SIZE. - -Tue Sep 12 12:07:02 1995 Ian Lance Taylor - - * sun4.h (struct internal_sun4_dynamic_link): Change all fields - from long to unsigned long. - -Wed Jul 12 00:15:13 1995 Ken Raeburn - - * sun4.h (PAGE_SIZE): Undefine before defining. - -Thu Jun 16 14:22:55 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * aout64.h (BMAGIC): Define. - -Sat Jun 11 16:16:09 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - Add weak symbols as an extension to a.out. - * aout64.h (N_WEAKU, N_WEAKA, N_WEAKT, N_WEAKD, N_WEAKB): Define. - * stab.def: Update symbol value table. - -Thu Jun 2 17:13:38 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * sun4.h (EXTERNAL_SUN4_DYNAMIC_DEBUGGER_SIZE): Correct from 28 to - 24. Fix up ld_got comment. - -Wed Mar 30 00:31:49 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * dynix3.h: Cleanup, adapt to current bfd version. - -Sat Feb 26 10:25:53 1994 Ian Lance Taylor (ian@cygnus.com) - - * aout64.h: Add casts to avoid warnings from SVR4 cc. - -Fri Feb 11 12:56:04 1994 Stan Shebs (shebs@andros.cygnus.com) - - * ar.h (ARMAG, ARMAGB, ARFMAG): Change '\n' to '\012', for greater - portability. - -Fri Jan 21 00:59:06 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * sun4.h: Added information about SunOS shared libraries. - -Fri Jan 7 08:20:13 1994 Jim Kingdon (kingdon@deneb.cygnus.com) - - * aout64.h (N_TXTADDR): Add comment regarding OMAGIC and NMAGIC. - -Sat Dec 25 14:55:41 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * aout64.h (N_DATOFF): Don't pad (revert change of 8 Jul 1993). - -Tue Nov 16 15:43:46 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * aout64.h: New macros ZMAGIC_DISK_BLOCK_SIZE and N_DISK_BLOCK_SIZE - for Linux ZMAGIC. - (N_TXTOFF, N_DATOFF): Use them. - -Thu Nov 4 00:33:48 1993 Ken Raeburn (raeburn@kr-pc.cygnus.com) - - * aout64.h (RELOC_STD_BITS_RELATIVE_LITTLE): Fixed value to match - sun3 system; used to overlap other fields. - (RELOC_STD_BITS_JMPTABLE_LITTLE): Likewise. - -Wed Nov 3 13:48:27 1993 David J. Mackenzie (djm@thepub.cygnus.com) - - * aout64.h (RELOC_STD_BITS_BASEREL_LITTLE): Make it 0x10 (Ken's - suggestion) to avoid conflict with RELOC_STD_BITS_EXTERN_LITTLE. - -Fri Oct 29 15:09:52 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * hp300hpux.h (N_SHARED_LIB): Define to be 0. - -Mon Sep 13 21:00:56 1993 John Gilmore (gnu@cygnus.com) - - * ar.h (ARMAP_TIME_OFFSET): Add and describe. - -Mon Aug 23 Sean Fagan (sef@cygnus.com) - - * aout64.h [ARCH_SIZE != 64]: Allow N_BADMAG to be overridden. - -Mon Aug 16 14:30:14 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * stab_gnu.h: Include aout/stab.def not just stab.def. - -Sun Jul 18 21:41:47 1993 Jim Kingdon (kingdon@rtl.cygnus.com) - - * dynix3.h: New, for symmetry running dynix. - -Thu Jul 8 12:52:22 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * aout64.h (N_BADMAG): Recognize QMAGIC. - N_TXTOFF, N_TXTADDR, N_TXTSIZE: Special code for QMAGIC. - N_DATOFF: Pad text size if we need to. - -Fri Jun 18 19:19:38 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * stab.def (N_ECOML): Fix comment. - -Mon May 31 09:21:30 1993 Jim Kingdon (kingdon@cygnus.com) - - * stab.def: Remove Solaris information on N_FUN stabstring grammar; - I've transferred it to gdb/doc/stabs.texinfo, where it belongs. - -Mon May 10 05:48:43 1993 Ken Raeburn (raeburn@kr-pc.cygnus.com) - - * hp300hpux.h: Patch from Glenn Engel for linker problem and - compatibility fix: - (OMAGIC, NMAGIC): New definitions. - (SHAREMAGIC): Deleted. - (HPUX_DOT_O_MAGIC): New macro. - (_N_BADMAG): Adjusted. - (N_HEADER_IN_TEXT, N_DATADDR): New macros. - -Thu Apr 29 12:07:37 1993 Ken Raeburn (raeburn@deneb.cygnus.com) - - * hp300hpux.h: New file from Glenn Engel, glenne@lsid.hp.com. - -Tue Apr 27 05:51:04 1993 Ken Raeburn (raeburn@kr-pc.cygnus.com) - - * aout64.h (struct external_exec, *MAGIC, N_BADMAG): Don't define - if `external_exec' is already defined as a macro. - (N_DATOFF, N_TRELOFF, N_DRELOFF, N_SYMOFF, N_STROFF): Don't define - if already defined. - (struct external_nlist, EXTERNAL_NLIST_SIZE): Don't define if - `external_nlist' is already defined as a macro. - -Sat Aug 15 04:23:02 1992 John Gilmore (gnu@cygnus.com) - - * adobe.h: Add description of a.out.adobe format. - -Fri Jul 3 00:36:52 1992 John Gilmore (gnu at cygnus.com) - - * stab.def: Update more Solaris definitions. - * stab_gnu.h: Add N_SO language types, and Solaris basic float types. - -Sun Jun 14 10:53:53 1992 John Gilmore (gnu at cygnus.com) - - * stab.def: Update descriptions of Solaris-2 stabs; add N_UNDF. - -Thu Jun 11 01:12:07 1992 John Gilmore (gnu at cygnus.com) - - * stab.def: Add N_OBJ and N_OPT from Solaris-2. - -Thu Jan 30 18:12:44 1992 John Gilmore (gnu at cygnus.com) - - * aout/aout64.h: N_TXTSIZE needs some more parentheses. - I don't trust C precedence. - -Wed Dec 18 14:32:01 1991 Per Bothner (bothner at cygnus.com) - - * aout/aout64.h: Move common sunos-specific test - to recognize shared libraries into new macro N_SHARED_LIB. - Use it to simplify&reformat N_TXTADDR, N_TXTOFF, N_TXTSIZE. - -Sat Nov 30 20:34:52 1991 Steve Chamberlain (sac at rtl.cygnus.com) - - * ChangeLog, aout64.h, ar.h, encap.h, host.h, hp.h, ranlib.h, - reloc.h, stab.def, stab_gnu.h, sun4.h: All moved from the - devo/include directory - - -Local Variables: -version-control: never -End: diff --git a/contrib/gdb/include/aout/adobe.h b/contrib/gdb/include/aout/adobe.h deleted file mode 100644 index 3d2f15c..0000000 --- a/contrib/gdb/include/aout/adobe.h +++ /dev/null @@ -1,297 +0,0 @@ -/* `a.out.adobe' differences from standard a.out files */ - -#ifndef __A_OUT_ADOBE_H__ -#define __A_OUT_ADOBE_H__ - -#define BYTES_IN_WORD 4 - -/* Struct external_exec is the same. */ - -/* This is the layout on disk of the 32-bit or 64-bit exec header. */ - -struct external_exec -{ - bfd_byte e_info[4]; /* magic number and stuff */ - bfd_byte e_text[BYTES_IN_WORD]; /* length of text section in bytes */ - bfd_byte e_data[BYTES_IN_WORD]; /* length of data section in bytes */ - bfd_byte e_bss[BYTES_IN_WORD]; /* length of bss area in bytes */ - bfd_byte e_syms[BYTES_IN_WORD]; /* length of symbol table in bytes */ - bfd_byte e_entry[BYTES_IN_WORD]; /* start address */ - bfd_byte e_trsize[BYTES_IN_WORD]; /* length of text relocation info */ - bfd_byte e_drsize[BYTES_IN_WORD]; /* length of data relocation info */ -}; - -#define EXEC_BYTES_SIZE (4 + BYTES_IN_WORD * 7) - -/* Magic numbers for a.out files */ - -#undef ZMAGIC -#define ZMAGIC 0xAD0BE /* Cute, eh? */ -#undef OMAGIC -#undef NMAGIC - -#define N_BADMAG(x) ((x).a_info != ZMAGIC) - -/* By default, segment size is constant. But some machines override this - to be a function of the a.out header (e.g. machine type). */ -#ifndef N_SEGSIZE -#define N_SEGSIZE(x) SEGMENT_SIZE -#endif -#undef N_SEGSIZE /* FIXMEXXXX */ - -/* Segment information for the a.out.Adobe format is specified after the - file header. It contains N segment descriptors, followed by one with - a type of zero. - - The actual text of the segments starts at N_TXTOFF in the file, - regardless of how many or how few segment headers there are. */ - -struct external_segdesc { - unsigned char e_type[1]; - unsigned char e_size[3]; - unsigned char e_virtbase[4]; - unsigned char e_filebase[4]; -}; - -struct internal_segdesc { - unsigned int a_type:8; /* Segment type N_TEXT, N_DATA, 0 */ - unsigned int a_size:24; /* Segment size */ - bfd_vma a_virtbase; /* Virtual address */ - unsigned int a_filebase; /* Base address in object file */ -}; - -#define N_TXTADDR(x) \ - -/* This is documented to be at 1024, but appears to really be at 2048. - FIXME?! */ -#define N_TXTOFF(x) 2048 - -#define N_TXTSIZE(x) ((x).a_text) - -#define N_DATADDR(x) - -#define N_BSSADDR(x) - -/* Offsets of the various portions of the file after the text segment. */ - -#define N_DATOFF(x) ( N_TXTOFF(x) + N_TXTSIZE(x) ) -#define N_TRELOFF(x) ( N_DATOFF(x) + (x).a_data ) -#define N_DRELOFF(x) ( N_TRELOFF(x) + (x).a_trsize ) -#define N_SYMOFF(x) ( N_DRELOFF(x) + (x).a_drsize ) -#define N_STROFF(x) ( N_SYMOFF(x) + (x).a_syms ) - -/* Symbols */ -struct external_nlist { - bfd_byte e_strx[BYTES_IN_WORD]; /* index into string table of name */ - bfd_byte e_type[1]; /* type of symbol */ - bfd_byte e_other[1]; /* misc info (usually empty) */ - bfd_byte e_desc[2]; /* description field */ - bfd_byte e_value[BYTES_IN_WORD]; /* value of symbol */ -}; - -#define EXTERNAL_NLIST_SIZE (BYTES_IN_WORD+4+BYTES_IN_WORD) - -struct internal_nlist { - unsigned long n_strx; /* index into string table of name */ - unsigned char n_type; /* type of symbol */ - unsigned char n_other; /* misc info (usually empty) */ - unsigned short n_desc; /* description field */ - bfd_vma n_value; /* value of symbol */ -}; - -/* The n_type field is the symbol type, containing: */ - -#define N_UNDF 0 /* Undefined symbol */ -#define N_ABS 2 /* Absolute symbol -- defined at particular addr */ -#define N_TEXT 4 /* Text sym -- defined at offset in text seg */ -#define N_DATA 6 /* Data sym -- defined at offset in data seg */ -#define N_BSS 8 /* BSS sym -- defined at offset in zero'd seg */ -#define N_COMM 0x12 /* Common symbol (visible after shared lib dynlink) */ -#define N_FN 0x1f /* File name of .o file */ -#define N_FN_SEQ 0x0C /* N_FN from Sequent compilers (sigh) */ -/* Note: N_EXT can only be usefully OR-ed with N_UNDF, N_ABS, N_TEXT, - N_DATA, or N_BSS. When the low-order bit of other types is set, - (e.g. N_WARNING versus N_FN), they are two different types. */ -#define N_EXT 1 /* External symbol (as opposed to local-to-this-file) */ -#define N_TYPE 0x1e -#define N_STAB 0xe0 /* If any of these bits are on, it's a debug symbol */ - -#define N_INDR 0x0a - -/* The following symbols refer to set elements. - All the N_SET[ATDB] symbols with the same name form one set. - Space is allocated for the set in the text section, and each set - elements value is stored into one word of the space. - The first word of the space is the length of the set (number of elements). - - The address of the set is made into an N_SETV symbol - whose name is the same as the name of the set. - This symbol acts like a N_DATA global symbol - in that it can satisfy undefined external references. */ - -/* These appear as input to LD, in a .o file. */ -#define N_SETA 0x14 /* Absolute set element symbol */ -#define N_SETT 0x16 /* Text set element symbol */ -#define N_SETD 0x18 /* Data set element symbol */ -#define N_SETB 0x1A /* Bss set element symbol */ - -/* This is output from LD. */ -#define N_SETV 0x1C /* Pointer to set vector in data area. */ - -/* Warning symbol. The text gives a warning message, the next symbol - in the table will be undefined. When the symbol is referenced, the - message is printed. */ - -#define N_WARNING 0x1e - -/* Relocations - - There are two types of relocation flavours for a.out systems, - standard and extended. The standard form is used on systems where the - instruction has room for all the bits of an offset to the operand, whilst - the extended form is used when an address operand has to be split over n - instructions. Eg, on the 68k, each move instruction can reference - the target with a displacement of 16 or 32 bits. On the sparc, move - instructions use an offset of 14 bits, so the offset is stored in - the reloc field, and the data in the section is ignored. -*/ - -/* This structure describes a single relocation to be performed. - The text-relocation section of the file is a vector of these structures, - all of which apply to the text section. - Likewise, the data-relocation section applies to the data section. */ - -struct reloc_std_external { - bfd_byte r_address[BYTES_IN_WORD]; /* offset of of data to relocate */ - bfd_byte r_index[3]; /* symbol table index of symbol */ - bfd_byte r_type[1]; /* relocation type */ -}; - -#define RELOC_STD_BITS_PCREL_BIG 0x80 -#define RELOC_STD_BITS_PCREL_LITTLE 0x01 - -#define RELOC_STD_BITS_LENGTH_BIG 0x60 -#define RELOC_STD_BITS_LENGTH_SH_BIG 5 /* To shift to units place */ -#define RELOC_STD_BITS_LENGTH_LITTLE 0x06 -#define RELOC_STD_BITS_LENGTH_SH_LITTLE 1 - -#define RELOC_STD_BITS_EXTERN_BIG 0x10 -#define RELOC_STD_BITS_EXTERN_LITTLE 0x08 - -#define RELOC_STD_BITS_BASEREL_BIG 0x08 -#define RELOC_STD_BITS_BASEREL_LITTLE 0x08 - -#define RELOC_STD_BITS_JMPTABLE_BIG 0x04 -#define RELOC_STD_BITS_JMPTABLE_LITTLE 0x04 - -#define RELOC_STD_BITS_RELATIVE_BIG 0x02 -#define RELOC_STD_BITS_RELATIVE_LITTLE 0x02 - -#define RELOC_STD_SIZE (BYTES_IN_WORD + 3 + 1) /* Bytes per relocation entry */ - -struct reloc_std_internal -{ - bfd_vma r_address; /* Address (within segment) to be relocated. */ - /* The meaning of r_symbolnum depends on r_extern. */ - unsigned int r_symbolnum:24; - /* Nonzero means value is a pc-relative offset - and it should be relocated for changes in its own address - as well as for changes in the symbol or section specified. */ - unsigned int r_pcrel:1; - /* Length (as exponent of 2) of the field to be relocated. - Thus, a value of 2 indicates 1<<2 bytes. */ - unsigned int r_length:2; - /* 1 => relocate with value of symbol. - r_symbolnum is the index of the symbol - in files the symbol table. - 0 => relocate with the address of a segment. - r_symbolnum is N_TEXT, N_DATA, N_BSS or N_ABS - (the N_EXT bit may be set also, but signifies nothing). */ - unsigned int r_extern:1; - /* The next three bits are for SunOS shared libraries, and seem to - be undocumented. */ - unsigned int r_baserel:1; /* Linkage table relative */ - unsigned int r_jmptable:1; /* pc-relative to jump table */ - unsigned int r_relative:1; /* "relative relocation" */ - /* unused */ - unsigned int r_pad:1; /* Padding -- set to zero */ -}; - - -/* EXTENDED RELOCS */ - -struct reloc_ext_external { - bfd_byte r_address[BYTES_IN_WORD]; /* offset of of data to relocate */ - bfd_byte r_index[3]; /* symbol table index of symbol */ - bfd_byte r_type[1]; /* relocation type */ - bfd_byte r_addend[BYTES_IN_WORD]; /* datum addend */ -}; - -#define RELOC_EXT_BITS_EXTERN_BIG 0x80 -#define RELOC_EXT_BITS_EXTERN_LITTLE 0x01 - -#define RELOC_EXT_BITS_TYPE_BIG 0x1F -#define RELOC_EXT_BITS_TYPE_SH_BIG 0 -#define RELOC_EXT_BITS_TYPE_LITTLE 0xF8 -#define RELOC_EXT_BITS_TYPE_SH_LITTLE 3 - -/* Bytes per relocation entry */ -#define RELOC_EXT_SIZE (BYTES_IN_WORD + 3 + 1 + BYTES_IN_WORD) - -enum reloc_type -{ - /* simple relocations */ - RELOC_8, /* data[0:7] = addend + sv */ - RELOC_16, /* data[0:15] = addend + sv */ - RELOC_32, /* data[0:31] = addend + sv */ - /* pc-rel displacement */ - RELOC_DISP8, /* data[0:7] = addend - pc + sv */ - RELOC_DISP16, /* data[0:15] = addend - pc + sv */ - RELOC_DISP32, /* data[0:31] = addend - pc + sv */ - /* Special */ - RELOC_WDISP30, /* data[0:29] = (addend + sv - pc)>>2 */ - RELOC_WDISP22, /* data[0:21] = (addend + sv - pc)>>2 */ - RELOC_HI22, /* data[0:21] = (addend + sv)>>10 */ - RELOC_22, /* data[0:21] = (addend + sv) */ - RELOC_13, /* data[0:12] = (addend + sv) */ - RELOC_LO10, /* data[0:9] = (addend + sv) */ - RELOC_SFA_BASE, - RELOC_SFA_OFF13, - /* P.I.C. (base-relative) */ - RELOC_BASE10, /* Not sure - maybe we can do this the */ - RELOC_BASE13, /* right way now */ - RELOC_BASE22, - /* for some sort of pc-rel P.I.C. (?) */ - RELOC_PC10, - RELOC_PC22, - /* P.I.C. jump table */ - RELOC_JMP_TBL, - /* reputedly for shared libraries somehow */ - RELOC_SEGOFF16, - RELOC_GLOB_DAT, - RELOC_JMP_SLOT, - RELOC_RELATIVE, - - RELOC_11, - RELOC_WDISP2_14, - RELOC_WDISP19, - RELOC_HHI22, /* data[0:21] = (addend + sv) >> 42 */ - RELOC_HLO10, /* data[0:9] = (addend + sv) >> 32 */ - - /* 29K relocation types */ - RELOC_JUMPTARG, - RELOC_CONST, - RELOC_CONSTH, - - NO_RELOC - }; - - -struct reloc_internal { - bfd_vma r_address; /* offset of of data to relocate */ - long r_index; /* symbol table index of symbol */ - enum reloc_type r_type; /* relocation type */ - bfd_vma r_addend; /* datum addend */ -}; - -#endif /* __A_OUT_ADOBE_H__ */ diff --git a/contrib/gdb/include/aout/aout64.h b/contrib/gdb/include/aout/aout64.h deleted file mode 100644 index 76f1140..0000000 --- a/contrib/gdb/include/aout/aout64.h +++ /dev/null @@ -1,475 +0,0 @@ -/* `a.out' object-file definitions, including extensions to 64-bit fields */ - -#ifndef __A_OUT_64_H__ -#define __A_OUT_64_H__ - -/* This is the layout on disk of the 32-bit or 64-bit exec header. */ - -#ifndef external_exec -struct external_exec -{ - bfd_byte e_info[4]; /* magic number and stuff */ - bfd_byte e_text[BYTES_IN_WORD]; /* length of text section in bytes */ - bfd_byte e_data[BYTES_IN_WORD]; /* length of data section in bytes */ - bfd_byte e_bss[BYTES_IN_WORD]; /* length of bss area in bytes */ - bfd_byte e_syms[BYTES_IN_WORD]; /* length of symbol table in bytes */ - bfd_byte e_entry[BYTES_IN_WORD]; /* start address */ - bfd_byte e_trsize[BYTES_IN_WORD]; /* length of text relocation info */ - bfd_byte e_drsize[BYTES_IN_WORD]; /* length of data relocation info */ -}; - -#define EXEC_BYTES_SIZE (4 + BYTES_IN_WORD * 7) - -/* Magic numbers for a.out files */ - -#if ARCH_SIZE==64 -#define OMAGIC 0x1001 /* Code indicating object file */ -#define ZMAGIC 0x1002 /* Code indicating demand-paged executable. */ -#define NMAGIC 0x1003 /* Code indicating pure executable. */ - -/* There is no 64-bit QMAGIC as far as I know. */ - -#define N_BADMAG(x) (N_MAGIC(x) != OMAGIC \ - && N_MAGIC(x) != NMAGIC \ - && N_MAGIC(x) != ZMAGIC) -#else -#define OMAGIC 0407 /* ...object file or impure executable. */ -#define NMAGIC 0410 /* Code indicating pure executable. */ -#define ZMAGIC 0413 /* Code indicating demand-paged executable. */ -#define BMAGIC 0415 /* Used by a b.out object. */ - -/* This indicates a demand-paged executable with the header in the text. - It is used by 386BSD (and variants) and Linux, at least. */ -#ifndef QMAGIC -#define QMAGIC 0314 -#endif -# ifndef N_BADMAG -# define N_BADMAG(x) (N_MAGIC(x) != OMAGIC \ - && N_MAGIC(x) != NMAGIC \ - && N_MAGIC(x) != ZMAGIC \ - && N_MAGIC(x) != QMAGIC) -# endif /* N_BADMAG */ -#endif - -#endif - -#ifdef QMAGIC -#define N_IS_QMAGIC(x) (N_MAGIC (x) == QMAGIC) -#else -#define N_IS_QMAGIC(x) (0) -#endif - -/* The difference between TARGET_PAGE_SIZE and N_SEGSIZE is that TARGET_PAGE_SIZE is - the finest granularity at which you can page something, thus it - controls the padding (if any) before the text segment of a ZMAGIC - file. N_SEGSIZE is the resolution at which things can be marked as - read-only versus read/write, so it controls the padding between the - text segment and the data segment (in memory; on disk the padding - between them is TARGET_PAGE_SIZE). TARGET_PAGE_SIZE and N_SEGSIZE are the same - for most machines, but different for sun3. */ - -/* By default, segment size is constant. But some machines override this - to be a function of the a.out header (e.g. machine type). */ - -#ifndef N_SEGSIZE -#define N_SEGSIZE(x) SEGMENT_SIZE -#endif - -/* Virtual memory address of the text section. - This is getting very complicated. A good reason to discard a.out format - for something that specifies these fields explicitly. But til then... - - * OMAGIC and NMAGIC files: - (object files: text for "relocatable addr 0" right after the header) - start at 0, offset is EXEC_BYTES_SIZE, size as stated. - * The text address, offset, and size of ZMAGIC files depend - on the entry point of the file: - * entry point below TEXT_START_ADDR: - (hack for SunOS shared libraries) - start at 0, offset is 0, size as stated. - * If N_HEADER_IN_TEXT(x) is true (which defaults to being the - case when the entry point is EXEC_BYTES_SIZE or further into a page): - no padding is needed; text can start after exec header. Sun - considers the text segment of such files to include the exec header; - for BFD's purposes, we don't, which makes more work for us. - start at TEXT_START_ADDR + EXEC_BYTES_SIZE, offset is EXEC_BYTES_SIZE, - size as stated minus EXEC_BYTES_SIZE. - * If N_HEADER_IN_TEXT(x) is false (which defaults to being the case when - the entry point is less than EXEC_BYTES_SIZE into a page (e.g. page - aligned)): (padding is needed so that text can start at a page boundary) - start at TEXT_START_ADDR, offset TARGET_PAGE_SIZE, size as stated. - - Specific configurations may want to hardwire N_HEADER_IN_TEXT, - for efficiency or to allow people to play games with the entry point. - In that case, you would #define N_HEADER_IN_TEXT(x) as 1 for sunos, - and as 0 for most other hosts (Sony News, Vax Ultrix, etc). - (Do this in the appropriate bfd target file.) - (The default is a heuristic that will break if people try changing - the entry point, perhaps with the ld -e flag.) - - * QMAGIC is always like a ZMAGIC for which N_HEADER_IN_TEXT is true, - and for which the starting address is TARGET_PAGE_SIZE (or should this be - SEGMENT_SIZE?) (TEXT_START_ADDR only applies to ZMAGIC, not to QMAGIC). - */ - -/* This macro is only relevant for ZMAGIC files; QMAGIC always has the header - in the text. */ -#ifndef N_HEADER_IN_TEXT -#define N_HEADER_IN_TEXT(x) (((x).a_entry & (TARGET_PAGE_SIZE-1)) >= EXEC_BYTES_SIZE) -#endif - -/* Sun shared libraries, not linux. This macro is only relevant for ZMAGIC - files. */ -#ifndef N_SHARED_LIB -#define N_SHARED_LIB(x) ((x).a_entry < TEXT_START_ADDR) -#endif - -/* Returning 0 not TEXT_START_ADDR for OMAGIC and NMAGIC is based on - the assumption that we are dealing with a .o file, not an - executable. This is necessary for OMAGIC (but means we don't work - right on the output from ld -N); more questionable for NMAGIC. */ - -#ifndef N_TXTADDR -#define N_TXTADDR(x) \ - (/* The address of a QMAGIC file is always one page in, */ \ - /* with the header in the text. */ \ - N_IS_QMAGIC (x) ? TARGET_PAGE_SIZE + EXEC_BYTES_SIZE : \ - N_MAGIC(x) != ZMAGIC ? 0 : /* object file or NMAGIC */\ - N_SHARED_LIB(x) ? 0 : \ - N_HEADER_IN_TEXT(x) ? \ - TEXT_START_ADDR + EXEC_BYTES_SIZE : /* no padding */\ - TEXT_START_ADDR /* a page of padding */\ - ) -#endif - -/* If N_HEADER_IN_TEXT is not true for ZMAGIC, there is some padding - to make the text segment start at a certain boundary. For most - systems, this boundary is TARGET_PAGE_SIZE. But for Linux, in the - time-honored tradition of crazy ZMAGIC hacks, it is 1024 which is - not what TARGET_PAGE_SIZE needs to be for QMAGIC. */ - -#ifndef ZMAGIC_DISK_BLOCK_SIZE -#define ZMAGIC_DISK_BLOCK_SIZE TARGET_PAGE_SIZE -#endif - -#define N_DISK_BLOCK_SIZE(x) \ - (N_MAGIC(x) == ZMAGIC ? ZMAGIC_DISK_BLOCK_SIZE : TARGET_PAGE_SIZE) - -/* Offset in an a.out of the start of the text section. */ -#ifndef N_TXTOFF -#define N_TXTOFF(x) \ - (/* For {O,N,Q}MAGIC, no padding. */ \ - N_MAGIC(x) != ZMAGIC ? EXEC_BYTES_SIZE : \ - N_SHARED_LIB(x) ? 0 : \ - N_HEADER_IN_TEXT(x) ? \ - EXEC_BYTES_SIZE : /* no padding */\ - ZMAGIC_DISK_BLOCK_SIZE /* a page of padding */\ - ) -#endif -/* Size of the text section. It's always as stated, except that we - offset it to `undo' the adjustment to N_TXTADDR and N_TXTOFF - for ZMAGIC files that nominally include the exec header - as part of the first page of text. (BFD doesn't consider the - exec header to be part of the text segment.) */ -#ifndef N_TXTSIZE -#define N_TXTSIZE(x) \ - (/* For QMAGIC, we don't consider the header part of the text section. */\ - N_IS_QMAGIC (x) ? (x).a_text - EXEC_BYTES_SIZE : \ - (N_MAGIC(x) != ZMAGIC || N_SHARED_LIB(x)) ? (x).a_text : \ - N_HEADER_IN_TEXT(x) ? \ - (x).a_text - EXEC_BYTES_SIZE: /* no padding */\ - (x).a_text /* a page of padding */\ - ) -#endif -/* The address of the data segment in virtual memory. - It is the text segment address, plus text segment size, rounded - up to a N_SEGSIZE boundary for pure or pageable files. */ -#ifndef N_DATADDR -#define N_DATADDR(x) \ - (N_MAGIC(x)==OMAGIC? (N_TXTADDR(x)+N_TXTSIZE(x)) \ - : (N_SEGSIZE(x) + ((N_TXTADDR(x)+N_TXTSIZE(x)-1) & ~(N_SEGSIZE(x)-1)))) -#endif -/* The address of the BSS segment -- immediately after the data segment. */ - -#define N_BSSADDR(x) (N_DATADDR(x) + (x).a_data) - -/* Offsets of the various portions of the file after the text segment. */ - -/* For {Q,Z}MAGIC, there is padding to make the data segment start on - a page boundary. Most of the time the a_text field (and thus - N_TXTSIZE) already contains this padding. It is possible that for - BSDI and/or 386BSD it sometimes doesn't contain the padding, and - perhaps we should be adding it here. But this seems kind of - questionable and probably should be BSDI/386BSD-specific if we do - do it. - - For NMAGIC (at least for hp300 BSD, probably others), there is - padding in memory only, not on disk, so we must *not* ever pad here - for NMAGIC. */ - -#ifndef N_DATOFF -#define N_DATOFF(x) \ - (N_TXTOFF(x) + N_TXTSIZE(x)) -#endif - -#ifndef N_TRELOFF -#define N_TRELOFF(x) ( N_DATOFF(x) + (x).a_data ) -#endif -#ifndef N_DRELOFF -#define N_DRELOFF(x) ( N_TRELOFF(x) + (x).a_trsize ) -#endif -#ifndef N_SYMOFF -#define N_SYMOFF(x) ( N_DRELOFF(x) + (x).a_drsize ) -#endif -#ifndef N_STROFF -#define N_STROFF(x) ( N_SYMOFF(x) + (x).a_syms ) -#endif - -/* Symbols */ -#ifndef external_nlist -struct external_nlist { - bfd_byte e_strx[BYTES_IN_WORD]; /* index into string table of name */ - bfd_byte e_type[1]; /* type of symbol */ - bfd_byte e_other[1]; /* misc info (usually empty) */ - bfd_byte e_desc[2]; /* description field */ - bfd_byte e_value[BYTES_IN_WORD]; /* value of symbol */ -}; -#define EXTERNAL_NLIST_SIZE (BYTES_IN_WORD+4+BYTES_IN_WORD) -#endif - -struct internal_nlist { - unsigned long n_strx; /* index into string table of name */ - unsigned char n_type; /* type of symbol */ - unsigned char n_other; /* misc info (usually empty) */ - unsigned short n_desc; /* description field */ - bfd_vma n_value; /* value of symbol */ -}; - -/* The n_type field is the symbol type, containing: */ - -#define N_UNDF 0 /* Undefined symbol */ -#define N_ABS 2 /* Absolute symbol -- defined at particular addr */ -#define N_TEXT 4 /* Text sym -- defined at offset in text seg */ -#define N_DATA 6 /* Data sym -- defined at offset in data seg */ -#define N_BSS 8 /* BSS sym -- defined at offset in zero'd seg */ -#define N_COMM 0x12 /* Common symbol (visible after shared lib dynlink) */ -#define N_FN 0x1f /* File name of .o file */ -#define N_FN_SEQ 0x0C /* N_FN from Sequent compilers (sigh) */ -/* Note: N_EXT can only be usefully OR-ed with N_UNDF, N_ABS, N_TEXT, - N_DATA, or N_BSS. When the low-order bit of other types is set, - (e.g. N_WARNING versus N_FN), they are two different types. */ -#define N_EXT 1 /* External symbol (as opposed to local-to-this-file) */ -#define N_TYPE 0x1e -#define N_STAB 0xe0 /* If any of these bits are on, it's a debug symbol */ - -#define N_INDR 0x0a - -/* The following symbols refer to set elements. - All the N_SET[ATDB] symbols with the same name form one set. - Space is allocated for the set in the text section, and each set - elements value is stored into one word of the space. - The first word of the space is the length of the set (number of elements). - - The address of the set is made into an N_SETV symbol - whose name is the same as the name of the set. - This symbol acts like a N_DATA global symbol - in that it can satisfy undefined external references. */ - -/* These appear as input to LD, in a .o file. */ -#define N_SETA 0x14 /* Absolute set element symbol */ -#define N_SETT 0x16 /* Text set element symbol */ -#define N_SETD 0x18 /* Data set element symbol */ -#define N_SETB 0x1A /* Bss set element symbol */ - -/* This is output from LD. */ -#define N_SETV 0x1C /* Pointer to set vector in data area. */ - -/* Warning symbol. The text gives a warning message, the next symbol - in the table will be undefined. When the symbol is referenced, the - message is printed. */ - -#define N_WARNING 0x1e - -/* Weak symbols. These are a GNU extension to the a.out format. The - semantics are those of ELF weak symbols. Weak symbols are always - externally visible. The N_WEAK? values are squeezed into the - available slots. The value of a N_WEAKU symbol is 0. The values - of the other types are the definitions. */ -#define N_WEAKU 0x0d /* Weak undefined symbol. */ -#define N_WEAKA 0x0e /* Weak absolute symbol. */ -#define N_WEAKT 0x0f /* Weak text symbol. */ -#define N_WEAKD 0x10 /* Weak data symbol. */ -#define N_WEAKB 0x11 /* Weak bss symbol. */ - -/* Relocations - - There are two types of relocation flavours for a.out systems, - standard and extended. The standard form is used on systems where the - instruction has room for all the bits of an offset to the operand, whilst - the extended form is used when an address operand has to be split over n - instructions. Eg, on the 68k, each move instruction can reference - the target with a displacement of 16 or 32 bits. On the sparc, move - instructions use an offset of 14 bits, so the offset is stored in - the reloc field, and the data in the section is ignored. -*/ - -/* This structure describes a single relocation to be performed. - The text-relocation section of the file is a vector of these structures, - all of which apply to the text section. - Likewise, the data-relocation section applies to the data section. */ - -struct reloc_std_external { - bfd_byte r_address[BYTES_IN_WORD]; /* offset of of data to relocate */ - bfd_byte r_index[3]; /* symbol table index of symbol */ - bfd_byte r_type[1]; /* relocation type */ -}; - -#define RELOC_STD_BITS_PCREL_BIG ((unsigned int) 0x80) -#define RELOC_STD_BITS_PCREL_LITTLE ((unsigned int) 0x01) - -#define RELOC_STD_BITS_LENGTH_BIG ((unsigned int) 0x60) -#define RELOC_STD_BITS_LENGTH_SH_BIG 5 -#define RELOC_STD_BITS_LENGTH_LITTLE ((unsigned int) 0x06) -#define RELOC_STD_BITS_LENGTH_SH_LITTLE 1 - -#define RELOC_STD_BITS_EXTERN_BIG ((unsigned int) 0x10) -#define RELOC_STD_BITS_EXTERN_LITTLE ((unsigned int) 0x08) - -#define RELOC_STD_BITS_BASEREL_BIG ((unsigned int) 0x08) -#define RELOC_STD_BITS_BASEREL_LITTLE ((unsigned int) 0x10) - -#define RELOC_STD_BITS_JMPTABLE_BIG ((unsigned int) 0x04) -#define RELOC_STD_BITS_JMPTABLE_LITTLE ((unsigned int) 0x20) - -#define RELOC_STD_BITS_RELATIVE_BIG ((unsigned int) 0x02) -#define RELOC_STD_BITS_RELATIVE_LITTLE ((unsigned int) 0x40) - -#define RELOC_STD_SIZE (BYTES_IN_WORD + 3 + 1) /* Bytes per relocation entry */ - -struct reloc_std_internal -{ - bfd_vma r_address; /* Address (within segment) to be relocated. */ - /* The meaning of r_symbolnum depends on r_extern. */ - unsigned int r_symbolnum:24; - /* Nonzero means value is a pc-relative offset - and it should be relocated for changes in its own address - as well as for changes in the symbol or section specified. */ - unsigned int r_pcrel:1; - /* Length (as exponent of 2) of the field to be relocated. - Thus, a value of 2 indicates 1<<2 bytes. */ - unsigned int r_length:2; - /* 1 => relocate with value of symbol. - r_symbolnum is the index of the symbol - in files the symbol table. - 0 => relocate with the address of a segment. - r_symbolnum is N_TEXT, N_DATA, N_BSS or N_ABS - (the N_EXT bit may be set also, but signifies nothing). */ - unsigned int r_extern:1; - /* The next three bits are for SunOS shared libraries, and seem to - be undocumented. */ - unsigned int r_baserel:1; /* Linkage table relative */ - unsigned int r_jmptable:1; /* pc-relative to jump table */ - unsigned int r_relative:1; /* "relative relocation" */ - /* unused */ - unsigned int r_pad:1; /* Padding -- set to zero */ -}; - - -/* EXTENDED RELOCS */ - -struct reloc_ext_external { - bfd_byte r_address[BYTES_IN_WORD]; /* offset of of data to relocate */ - bfd_byte r_index[3]; /* symbol table index of symbol */ - bfd_byte r_type[1]; /* relocation type */ - bfd_byte r_addend[BYTES_IN_WORD]; /* datum addend */ -}; - -#define RELOC_EXT_BITS_EXTERN_BIG ((unsigned int) 0x80) -#define RELOC_EXT_BITS_EXTERN_LITTLE ((unsigned int) 0x01) - -#define RELOC_EXT_BITS_TYPE_BIG ((unsigned int) 0x1F) -#define RELOC_EXT_BITS_TYPE_SH_BIG 0 -#define RELOC_EXT_BITS_TYPE_LITTLE ((unsigned int) 0xF8) -#define RELOC_EXT_BITS_TYPE_SH_LITTLE 3 - -/* Bytes per relocation entry */ -#define RELOC_EXT_SIZE (BYTES_IN_WORD + 3 + 1 + BYTES_IN_WORD) - -enum reloc_type -{ - /* simple relocations */ - RELOC_8, /* data[0:7] = addend + sv */ - RELOC_16, /* data[0:15] = addend + sv */ - RELOC_32, /* data[0:31] = addend + sv */ - /* pc-rel displacement */ - RELOC_DISP8, /* data[0:7] = addend - pc + sv */ - RELOC_DISP16, /* data[0:15] = addend - pc + sv */ - RELOC_DISP32, /* data[0:31] = addend - pc + sv */ - /* Special */ - RELOC_WDISP30, /* data[0:29] = (addend + sv - pc)>>2 */ - RELOC_WDISP22, /* data[0:21] = (addend + sv - pc)>>2 */ - RELOC_HI22, /* data[0:21] = (addend + sv)>>10 */ - RELOC_22, /* data[0:21] = (addend + sv) */ - RELOC_13, /* data[0:12] = (addend + sv) */ - RELOC_LO10, /* data[0:9] = (addend + sv) */ - RELOC_SFA_BASE, - RELOC_SFA_OFF13, - /* P.I.C. (base-relative) */ - RELOC_BASE10, /* Not sure - maybe we can do this the */ - RELOC_BASE13, /* right way now */ - RELOC_BASE22, - /* for some sort of pc-rel P.I.C. (?) */ - RELOC_PC10, - RELOC_PC22, - /* P.I.C. jump table */ - RELOC_JMP_TBL, - /* reputedly for shared libraries somehow */ - RELOC_SEGOFF16, - RELOC_GLOB_DAT, - RELOC_JMP_SLOT, - RELOC_RELATIVE, - - RELOC_11, - RELOC_WDISP2_14, - RELOC_WDISP19, - RELOC_HHI22, /* data[0:21] = (addend + sv) >> 42 */ - RELOC_HLO10, /* data[0:9] = (addend + sv) >> 32 */ - - /* 29K relocation types */ - RELOC_JUMPTARG, - RELOC_CONST, - RELOC_CONSTH, - - /* All the new ones I can think of, for sparc v9 */ - - RELOC_64, /* data[0:63] = addend + sv */ - RELOC_DISP64, /* data[0:63] = addend - pc + sv */ - RELOC_WDISP21, /* data[0:20] = (addend + sv - pc)>>2 */ - RELOC_DISP21, /* data[0:20] = addend - pc + sv */ - RELOC_DISP14, /* data[0:13] = addend - pc + sv */ - /* Q . - What are the other ones, - Since this is a clean slate, can we throw away the ones we dont - understand ? Should we sort the values ? What about using a - microcode format like the 68k ? - */ - NO_RELOC - }; - - -struct reloc_internal { - bfd_vma r_address; /* offset of of data to relocate */ - long r_index; /* symbol table index of symbol */ - enum reloc_type r_type; /* relocation type */ - bfd_vma r_addend; /* datum addend */ -}; - -/* Q. - Should the length of the string table be 4 bytes or 8 bytes ? - - Q. - What about archive indexes ? - - */ - -#endif /* __A_OUT_64_H__ */ diff --git a/contrib/gdb/include/aout/ar.h b/contrib/gdb/include/aout/ar.h deleted file mode 100644 index 7b5dcda..0000000 --- a/contrib/gdb/include/aout/ar.h +++ /dev/null @@ -1,36 +0,0 @@ -/* archive file definition for GNU software */ - -/* So far this is correct for BSDish archives. Don't forget that - files must begin on an even byte boundary. */ - -#ifndef __GNU_AR_H__ -#define __GNU_AR_H__ - -/* Note that the usual '\n' in magic strings may translate to different - characters, as allowed by ANSI. '\012' has a fixed value, and remains - compatible with existing BSDish archives. */ - -#define ARMAG "!\012" /* For COFF and a.out archives */ -#define ARMAGB "!\012" /* For b.out archives */ -#define SARMAG 8 -#define ARFMAG "`\012" - -/* The ar_date field of the armap (__.SYMDEF) member of an archive - must be greater than the modified date of the entire file, or - BSD-derived linkers complain. We originally write the ar_date with - this offset from the real file's mod-time. After finishing the - file, we rewrite ar_date if it's not still greater than the mod date. */ - -#define ARMAP_TIME_OFFSET 60 - -struct ar_hdr { - char ar_name[16]; /* name of this member */ - char ar_date[12]; /* file mtime */ - char ar_uid[6]; /* owner uid; printed as decimal */ - char ar_gid[6]; /* owner gid; printed as decimal */ - char ar_mode[8]; /* file mode, printed as octal */ - char ar_size[10]; /* file size, printed as decimal */ - char ar_fmag[2]; /* should contain ARFMAG */ -}; - -#endif /* __GNU_AR_H__ */ diff --git a/contrib/gdb/include/aout/dynix3.h b/contrib/gdb/include/aout/dynix3.h deleted file mode 100644 index efeeebf..0000000 --- a/contrib/gdb/include/aout/dynix3.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * a.out specifics for Sequent Symmetry running Dynix 3.x - */ -#ifndef A_OUT_DYNIX3_H -#define A_OUT_DYNIX3_H - -#define external_exec dynix_external_exec - -/* struct exec for Dynix 3 - * - * a_gdtbl and a_bootstrap are only for standalone binaries. - * Shared data fields are not supported by the kernel as of Dynix 3.1, - * but are supported by Dynix compiler programs. - */ -struct dynix_external_exec { - unsigned char e_info[4]; - unsigned char e_text[4]; - unsigned char e_data[4]; - unsigned char e_bss[4]; - unsigned char e_syms[4]; - unsigned char e_entry[4]; - unsigned char e_trsize[4]; - unsigned char e_drsize[4]; - unsigned char e_g_code[8], e_g_data[8], e_g_desc[8]; - unsigned char e_shdata[4]; - unsigned char e_shbss[4]; - unsigned char e_shdrsize[4]; - unsigned char e_bootstrap[44]; - unsigned char e_reserved[12]; - unsigned char e_version[4]; -}; - -#define EXEC_BYTES_SIZE (128) - -/* - * All executables under Dynix are demand paged with read-only text, - * Thus no NMAGIC. - * - * ZMAGIC has a page of 0s at virtual 0, - * XMAGIC has an invalid page at virtual 0 - */ -#define OMAGIC 0x12eb /* .o */ -#define ZMAGIC 0x22eb /* zero @ 0, demand load */ -#define XMAGIC 0x32eb /* invalid @ 0, demand load */ -#define SMAGIC 0x42eb /* standalone, not supported here */ - -#define N_BADMAG(x) ((OMAGIC != N_MAGIC(x)) && \ - (ZMAGIC != N_MAGIC(x)) && \ - (XMAGIC != N_MAGIC(x)) && \ - (SMAGIC != N_MAGIC(x))) - -#define N_ADDRADJ(x) ((ZMAGIC == N_MAGIC(x) || XMAGIC == N_MAGIC(x)) ? 0x1000 : 0) - -#define N_TXTOFF(x) (EXEC_BYTES_SIZE) -#define N_DATOFF(x) (N_TXTOFF(x) + N_TXTSIZE(x)) -#define N_SHDATOFF(x) (N_DATOFF(x) + (x).a_data) -#define N_TRELOFF(x) (N_SHDATOFF(x) + (x).a_shdata) -#define N_DRELOFF(x) (N_TRELOFF(x) + (x).a_trsize) -#define N_SHDRELOFF(x) (N_DRELOFF(x) + (x).a_drsize) -#define N_SYMOFF(x) (N_SHDRELOFF(x) + (x).a_shdrsize) -#define N_STROFF(x) (N_SYMOFF(x) + (x).a_syms) - -#define N_TXTADDR(x) \ - (((OMAGIC == N_MAGIC(x)) || (SMAGIC == N_MAGIC(x))) ? 0 \ - : TEXT_START_ADDR + EXEC_BYTES_SIZE) - -#define N_TXTSIZE(x) \ - (((OMAGIC == N_MAGIC(x)) || (SMAGIC == N_MAGIC(x))) ? ((x).a_text) \ - : ((x).a_text - N_ADDRADJ(x) - EXEC_BYTES_SIZE)) - -#endif /* A_OUT_DYNIX3_H */ diff --git a/contrib/gdb/include/aout/encap.h b/contrib/gdb/include/aout/encap.h deleted file mode 100644 index b215d49..0000000 --- a/contrib/gdb/include/aout/encap.h +++ /dev/null @@ -1,135 +0,0 @@ -/* Yet Another Try at encapsulating bsd object files in coff. - Copyright (C) 1988, 1989, 1991 Free Software Foundation, Inc. - Written by Pace Willisson 12/9/88 - - This file is obsolete. It needs to be converted to just define a bunch - of stuff that BFD can use to do coff-encapsulated files. --gnu@cygnus.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. - -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. */ - -/* - * We only use the coff headers to tell the kernel - * how to exec the file. Therefore, the only fields that need to - * be filled in are the scnptr and vaddr for the text and data - * sections, and the vaddr for the bss. As far as coff is concerned, - * there is no symbol table, relocation, or line numbers. - * - * A normal bsd header (struct exec) is placed after the coff headers, - * and before the real text. I defined a the new fields 'a_machtype' - * and a_flags. If a_machtype is M_386, and a_flags & A_ENCAP is - * true, then the bsd header is preceeded by a coff header. Macros - * like N_TXTOFF and N_TXTADDR use this field to find the bsd header. - * - * The only problem is to track down the bsd exec header. The - * macros HEADER_OFFSET, etc do this. - */ - -#define N_FLAGS_COFF_ENCAPSULATE 0x20 /* coff header precedes bsd header */ - -/* Describe the COFF header used for encapsulation. */ - -struct coffheader -{ - /* filehdr */ - unsigned short f_magic; - unsigned short f_nscns; - long f_timdat; - long f_symptr; - long f_nsyms; - unsigned short f_opthdr; - unsigned short f_flags; - /* aouthdr */ - short magic; - short vstamp; - long tsize; - long dsize; - long bsize; - long entry; - long text_start; - long data_start; - struct coffscn - { - char s_name[8]; - long s_paddr; - long s_vaddr; - long s_size; - long s_scnptr; - long s_relptr; - long s_lnnoptr; - unsigned short s_nreloc; - unsigned short s_nlnno; - long s_flags; - } scns[3]; -}; - -/* Describe some of the parameters of the encapsulation, - including how to find the encapsulated BSD header. */ - -/* FIXME, this is dumb. The same tools can't handle a.outs for different - architectures, just because COFF_MAGIC is different; so you need a - separate GNU nm for every architecture!!? Unfortunately, it needs to - be this way, since the COFF_MAGIC value is determined by the kernel - we're trying to fool here. */ - -#define COFF_MAGIC_I386 0514 /* I386MAGIC */ -#define COFF_MAGIC_M68K 0520 /* MC68MAGIC */ -#define COFF_MAGIC_A29K 0x17A /* Used by asm29k cross-tools */ - -#ifdef COFF_MAGIC -short __header_offset_temp; -#define HEADER_OFFSET(f) \ - (__header_offset_temp = 0, \ - fread ((char *)&__header_offset_temp, sizeof (short), 1, (f)), \ - fseek ((f), -sizeof (short), 1), \ - __header_offset_temp==COFF_MAGIC ? sizeof(struct coffheader) : 0) -#else -#define HEADER_OFFSET(f) 0 -#endif - -#define HEADER_SEEK(f) (fseek ((f), HEADER_OFFSET((f)), 1)) - -/* Describe the characteristics of the BSD header - that appears inside the encapsulation. */ - -/* Encapsulated coff files that are linked ZMAGIC have a text segment - offset just past the header (and a matching TXTADDR), excluding - the headers from the text segment proper but keeping the physical - layout and the virtual memory layout page-aligned. - - Non-encapsulated a.out files that are linked ZMAGIC have a text - segment that starts at 0 and an N_TXTADR similarly offset to 0. - They too are page-aligned with each other, but they include the - a.out header as part of the text. - - The _N_HDROFF gets sizeof struct exec added to it, so we have - to compensate here. See . */ - -#undef _N_HDROFF -#undef N_TXTADDR -#undef N_DATADDR - -#define _N_HDROFF(x) ((N_FLAGS(x) & N_FLAGS_COFF_ENCAPSULATE) ? \ - sizeof (struct coffheader) : 0) - -/* Address of text segment in memory after it is loaded. */ -#define N_TXTADDR(x) \ - ((N_FLAGS(x) & N_FLAGS_COFF_ENCAPSULATE) ? \ - sizeof (struct coffheader) + sizeof (struct exec) : 0) -#define SEGMENT_SIZE 0x400000 - -#define N_DATADDR(x) \ - ((N_FLAGS(x) & N_FLAGS_COFF_ENCAPSULATE) ? \ - (SEGMENT_SIZE + ((N_TXTADDR(x)+(x).a_text-1) & ~(SEGMENT_SIZE-1))) : \ - (N_TXTADDR(x)+(x).a_text)) diff --git a/contrib/gdb/include/aout/host.h b/contrib/gdb/include/aout/host.h deleted file mode 100644 index 8e36212..0000000 --- a/contrib/gdb/include/aout/host.h +++ /dev/null @@ -1,22 +0,0 @@ -/* Parameters about the a.out format, based on the host system on which - the program is compiled. */ - -/* Address of data segment in memory after it is loaded. - It is up to you to define SEGMENT_SIZE - on machines not listed here. */ -#ifndef SEGMENT_SIZE -#if defined(hp300) || defined(pyr) -#define SEGMENT_SIZE page_size -#endif -#ifdef sony -#define SEGMENT_SIZE 0x1000 -#endif /* Sony. */ -#ifdef is68k -#define SEGMENT_SIZE 0x20000 -#endif -#if defined(m68k) && defined(PORTAR) -#define TARGET_PAGE_SIZE 0x400 -#define SEGMENT_SIZE TARGET_PAGE_SIZE -#endif -#endif /*!defined(SEGMENT_SIZE)*/ - diff --git a/contrib/gdb/include/aout/hp.h b/contrib/gdb/include/aout/hp.h deleted file mode 100644 index 002f49c..0000000 --- a/contrib/gdb/include/aout/hp.h +++ /dev/null @@ -1,82 +0,0 @@ -/* Special version of for use under hp-ux. - Copyright 1988, 1991 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. */ - -/* THIS FILE IS OBSOLETE. It needs to be revised as a variant "external" - a.out format for use with BFD. */ - -/* The `exec' structure and overall layout must be close to HP's when - we are running on an HP system, otherwise we will not be able to - execute the resulting file. */ - -/* Allow this file to be included twice. */ -#ifndef __GNU_EXEC_MACROS__ - -struct exec -{ - unsigned short a_machtype; /* machine type */ - unsigned short a_magic; /* magic number */ - unsigned long a_spare1; - unsigned long a_spare2; - unsigned long a_text; /* length of text, in bytes */ - unsigned long a_data; /* length of data, in bytes */ - unsigned long a_bss; /* length of uninitialized data area for file, in bytes */ - unsigned long a_trsize; /* length of relocation info for text, in bytes */ - unsigned long a_drsize; /* length of relocation info for data, in bytes */ - unsigned long a_spare3; /* HP = pascal interface size */ - unsigned long a_spare4; /* HP = symbol table size */ - unsigned long a_spare5; /* HP = debug name table size */ - unsigned long a_entry; /* start address */ - unsigned long a_spare6; /* HP = source line table size */ - unsigned long a_spare7; /* HP = value table size */ - unsigned long a_syms; /* length of symbol table data in file, in bytes */ - unsigned long a_spare8; -}; - -/* Tell a.out.gnu.h not to define `struct exec'. */ -#define __STRUCT_EXEC_OVERRIDE__ - -#include "../a.out.gnu.h" - -#undef N_MAGIC -#undef N_MACHTYPE -#undef N_FLAGS -#undef N_SET_INFO -#undef N_SET_MAGIC -#undef N_SET_MACHTYPE -#undef N_SET_FLAGS - -#define N_MAGIC(exec) ((exec) . a_magic) -#define N_MACHTYPE(exec) ((exec) . a_machtype) -#define N_SET_MAGIC(exec, magic) (((exec) . a_magic) = (magic)) -#define N_SET_MACHTYPE(exec, machtype) (((exec) . a_machtype) = (machtype)) - -#undef N_BADMAG -#define N_BADMAG(x) ((_N_BADMAG (x)) || (_N_BADMACH (x))) - -#define _N_BADMACH(x) \ -(((N_MACHTYPE (x)) != HP9000S200_ID) && \ - ((N_MACHTYPE (x)) != HP98x6_ID)) - -#define HP98x6_ID 0x20A -#define HP9000S200_ID 0x20C - -#undef _N_HDROFF -#define _N_HDROFF(x) (SEGMENT_SIZE - (sizeof (struct exec))) - -#define SEGMENT_SIZE 0x1000 - -#endif /* __GNU_EXEC_MACROS__ */ diff --git a/contrib/gdb/include/aout/hp300hpux.h b/contrib/gdb/include/aout/hp300hpux.h deleted file mode 100644 index 44d5196..0000000 --- a/contrib/gdb/include/aout/hp300hpux.h +++ /dev/null @@ -1,119 +0,0 @@ -/* Special version of for use under hp-ux. - Copyright (C) 1988,1993 Free Software Foundation, Inc. */ - -struct hp300hpux_exec_bytes -{ - unsigned char e_info[4]; /* a_machtype/a_magic */ - unsigned char e_spare1[4]; - unsigned char e_spare2[4]; - unsigned char e_text[4]; /* length of text, in bytes */ - unsigned char e_data[4]; /* length of data, in bytes */ - unsigned char e_bss[4]; /* length of uninitialized data area , in bytes */ - unsigned char e_trsize[4]; /* length of relocation info for text, in bytes*/ - unsigned char e_drsize[4]; /* length of relocation info for data, in bytes*/ - unsigned char e_passize[4];/* HP = pascal interface size */ - unsigned char e_syms[4]; /* HP = symbol table size */ - unsigned char e_spare5[4]; /* HP = debug name table size */ - unsigned char e_entry[4]; /* start address */ - unsigned char e_spare6[4]; /* HP = source line table size */ - unsigned char e_supsize[4];/* HP = value table size */ - unsigned char e_drelocs[4]; - unsigned char e_extension[4]; /* file offset of extension */ -}; -#define EXEC_BYTES_SIZE 64 - -struct hp300hpux_nlist_bytes - { - unsigned char e_value[4]; - unsigned char e_type[1]; - unsigned char e_length[1]; /* length of ascii symbol name */ - unsigned char e_almod[2]; /* alignment mod */ - unsigned char e_shlib[2]; /* info about dynamic linking */ - }; -#define EXTERNAL_NLIST_SIZE 10 - -struct hp300hpux_reloc - { - unsigned char r_address[4];/* offset of of data to relocate */ - unsigned char r_index[2]; /* symbol table index of symbol */ - unsigned char r_type[1]; /* relocation type */ - unsigned char r_length[1]; /* length of item to reloc */ - }; - -struct hp300hpux_header_extension -{ - unsigned char e_syms[4]; - unsigned char unique_headers[12*4]; - unsigned char e_header[2]; /* type of header */ - unsigned char e_version[2]; /* version */ - unsigned char e_size[4]; /* bytes following*/ - unsigned char e_extension[4];/* file offset of next extension */ -}; -#define EXTERNAL_EXTENSION_HEADER_SIZE (16*4) - -/* hpux separates object files (0x106) and impure executables (0x107) */ -/* but the bfd code does not distinguish between them. Since we want to*/ -/* read hpux .o files, we add an special define and use it below in */ -/* offset and address calculations. */ - -#define HPUX_DOT_O_MAGIC 0x106 -#define OMAGIC 0x107 /* object file or impure executable. */ -#define NMAGIC 0x108 /* Code indicating pure executable. */ -#define ZMAGIC 0x10B /* demand-paged executable. */ - -#define N_HEADER_IN_TEXT(x) 0 - -#if 0 /* libaout.h only uses the lower 8 bits */ -#define HP98x6_ID 0x20A -#define HP9000S200_ID 0x20C -#endif -#define HP98x6_ID 0x0A -#define HP9000S200_ID 0x0C - -#define N_BADMAG(x) ((_N_BADMAG (x)) || (_N_BADMACH (x))) - -#define N_DATADDR(x) \ - ((N_MAGIC(x)==OMAGIC || N_MAGIC(x)==HPUX_DOT_O_MAGIC) ? \ - (N_TXTADDR(x)+N_TXTSIZE(x)) \ - : (N_SEGSIZE(x) + ((N_TXTADDR(x)+N_TXTSIZE(x)-1) & ~(N_SEGSIZE(x)-1)))) - -#define _N_BADMACH(x) \ -(((N_MACHTYPE (x)) != HP9000S200_ID) && \ - ((N_MACHTYPE (x)) != HP98x6_ID)) - -#define _N_BADMAG(x) (N_MAGIC(x) != HPUX_DOT_O_MAGIC \ - && N_MAGIC(x) != OMAGIC \ - && N_MAGIC(x) != NMAGIC \ - && N_MAGIC(x) != ZMAGIC ) - -#undef _N_HDROFF -#define _N_HDROFF(x) (SEGMENT_SIZE - (sizeof (struct exec))) - -#undef N_DATOFF -#undef N_PASOFF -#undef N_SYMOFF -#undef N_SUPOFF -#undef N_TRELOFF -#undef N_DRELOFF -#undef N_STROFF - -#define N_DATOFF(x) ( N_TXTOFF(x) + N_TXTSIZE(x) ) -#define N_PASOFF(x) ( N_DATOFF(x) + (x).a_data) -#define N_SYMOFF(x) ( N_PASOFF(x) /* + (x).a_passize*/ ) -#define N_SUPOFF(x) ( N_SYMOFF(x) + (x).a_syms ) -#define N_TRELOFF(x) ( N_SUPOFF(x) /* + 0 (x).a_supsize*/ ) -#define N_DRELOFF(x) ( N_TRELOFF(x) + (x).a_trsize ) -#define N_EXTHOFF(x) ( N_DRELOFF(x) /* + 0 (x).a_drsize */) -#define N_STROFF(x) ( 0 /* no string table */ ) - -/* use these when the file has gnu symbol tables */ -#define N_GNU_TRELOFF(x) (N_DATOFF(x) + (x).a_data) -#define N_GNU_DRELOFF(x) (N_GNU_TRELOFF(x) + (x).a_trsize) -#define N_GNU_SYMOFF(x) (N_GNU_DRELOFF(x) + (x).a_drsize) - -#define TARGET_PAGE_SIZE 0x1000 -#define SEGMENT_SIZE 0x1000 -#define TEXT_START_ADDR 0 - -#undef N_SHARED_LIB -#define N_SHARED_LIB(x) ( 0 /* no shared libraries */ ) diff --git a/contrib/gdb/include/aout/hppa.h b/contrib/gdb/include/aout/hppa.h deleted file mode 100644 index 7e185de..0000000 --- a/contrib/gdb/include/aout/hppa.h +++ /dev/null @@ -1,7 +0,0 @@ -#include "filehdr.h" -#include "aouthdr.h" -#include "scnhdr.h" -#include "spacehdr.h" -#include "syms.h" - - diff --git a/contrib/gdb/include/aout/ranlib.h b/contrib/gdb/include/aout/ranlib.h deleted file mode 100644 index 9826005..0000000 --- a/contrib/gdb/include/aout/ranlib.h +++ /dev/null @@ -1,62 +0,0 @@ -/* ranlib.h -- archive library index member definition for GNU. - Copyright 1990-1991 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. */ - -/* The Symdef member of an archive contains two things: - a table that maps symbol-string offsets to file offsets, - and a symbol-string table. All the symbol names are - run together (each with trailing null) in the symbol-string - table. There is a single longword bytecount on the front - of each of these tables. Thus if we have two symbols, - "foo" and "_bar", that are in archive members at offsets - 200 and 900, it would look like this: - 16 ; byte count of index table - 0 ; offset of "foo" in string table - 200 ; offset of foo-module in file - 4 ; offset of "bar" in string table - 900 ; offset of bar-module in file - 9 ; byte count of string table - "foo\0_bar\0" ; string table */ - -#define RANLIBMAG "__.SYMDEF" /* Archive file name containing index */ -#define RANLIBSKEW 3 /* Creation time offset */ - -/* Format of __.SYMDEF: - First, a longword containing the size of the 'symdef' data that follows. - Second, zero or more 'symdef' structures. - Third, a longword containing the length of symbol name strings. - Fourth, zero or more symbol name strings (each followed by a null). */ - -struct symdef - { - union - { - unsigned long string_offset; /* In the file */ - char *name; /* In memory, sometimes */ - } s; - /* this points to the front of the file header (AKA member header -- - a struct ar_hdr), not to the front of the file or into the file). - in other words it only tells you which file to read */ - unsigned long file_offset; - }; - -/* Compatability with BSD code */ - -#define ranlib symdef -#define ran_un s -#define ran_strx string_offset -#define ran_name name -#define ran_off file_offset diff --git a/contrib/gdb/include/aout/reloc.h b/contrib/gdb/include/aout/reloc.h deleted file mode 100644 index 563c552..0000000 --- a/contrib/gdb/include/aout/reloc.h +++ /dev/null @@ -1,66 +0,0 @@ -/* reloc.h -- Header file for relocation information. - Copyright 1989-1991 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. */ - -/* Relocation types for a.out files using reloc_info_extended - (SPARC and AMD 29000). */ - -#ifndef _RELOC_H_READ_ -#define _RELOC_H_READ_ 1 - -enum reloc_type - { - RELOC_8, RELOC_16, RELOC_32, /* simple relocations */ - RELOC_DISP8, RELOC_DISP16, RELOC_DISP32, /* pc-rel displacement */ - RELOC_WDISP30, RELOC_WDISP22, - RELOC_HI22, RELOC_22, - RELOC_13, RELOC_LO10, - RELOC_SFA_BASE, RELOC_SFA_OFF13, - RELOC_BASE10, RELOC_BASE13, RELOC_BASE22, /* P.I.C. (base-relative) */ - RELOC_PC10, RELOC_PC22, /* for some sort of pc-rel P.I.C. (?) */ - RELOC_JMP_TBL, /* P.I.C. jump table */ - RELOC_SEGOFF16, /* reputedly for shared libraries somehow */ - RELOC_GLOB_DAT, RELOC_JMP_SLOT, RELOC_RELATIVE, - RELOC_11, - RELOC_WDISP2_14, - RELOC_WDISP19, - RELOC_HHI22, - RELOC_HLO10, - - /* 29K relocation types */ - RELOC_JUMPTARG, RELOC_CONST, RELOC_CONSTH, - - RELOC_WDISP14, RELOC_WDISP21, - - NO_RELOC - }; - -#define RELOC_TYPE_NAMES \ -"8", "16", "32", "DISP8", \ -"DISP16", "DISP32", "WDISP30", "WDISP22", \ -"HI22", "22", "13", "LO10", \ -"SFA_BASE", "SFAOFF13", "BASE10", "BASE13", \ -"BASE22", "PC10", "PC22", "JMP_TBL", \ -"SEGOFF16", "GLOB_DAT", "JMP_SLOT", "RELATIVE", \ -"11", "WDISP2_14", "WDISP19", "HHI22", \ -"HLO10", \ -"JUMPTARG", "CONST", "CONSTH", "WDISP14", \ -"WDISP21", \ -"NO_RELOC" - -#endif /* _RELOC_H_READ_ */ - -/* end of reloc.h */ diff --git a/contrib/gdb/include/aout/stab.def b/contrib/gdb/include/aout/stab.def deleted file mode 100644 index 3c6b456..0000000 --- a/contrib/gdb/include/aout/stab.def +++ /dev/null @@ -1,264 +0,0 @@ -/* Table of DBX symbol codes for the GNU system. - Copyright (C) 1988, 91, 92, 93, 94, 95, 1996 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. */ - -/* New stab from Solaris 2. This uses an n_type of 0, which in a.out files - overlaps the N_UNDF used for ordinary symbols. In ELF files, the - debug information is in a different file section, so there is no conflict. - This symbol's n_value gives the size of the string section associated - with this file. The symbol's n_strx (relative to the just-updated - string section start address) gives the name of the source file, - e.g. "foo.c", without any path information. The symbol's n_desc gives - the count of upcoming symbols associated with this file (not including - this one). */ -/* __define_stab (N_UNDF, 0x00, "UNDF") */ - -/* Global variable. Only the name is significant. - To find the address, look in the corresponding external symbol. */ -__define_stab (N_GSYM, 0x20, "GSYM") - -/* Function name for BSD Fortran. Only the name is significant. - To find the address, look in the corresponding external symbol. */ -__define_stab (N_FNAME, 0x22, "FNAME") - -/* Function name or text-segment variable for C. Value is its address. - Desc is supposedly starting line number, but GCC doesn't set it - and DBX seems not to miss it. */ -__define_stab (N_FUN, 0x24, "FUN") - -/* Data-segment variable with internal linkage. Value is its address. - "Static Sym". */ -__define_stab (N_STSYM, 0x26, "STSYM") - -/* BSS-segment variable with internal linkage. Value is its address. */ -__define_stab (N_LCSYM, 0x28, "LCSYM") - -/* Name of main routine. Only the name is significant. */ -__define_stab (N_MAIN, 0x2a, "MAIN") - -/* Solaris2: Read-only data symbols. */ -__define_stab (N_ROSYM, 0x2c, "ROSYM") - -/* Global symbol in Pascal. - Supposedly the value is its line number; I'm skeptical. */ -__define_stab (N_PC, 0x30, "PC") - -/* Number of symbols: 0, files,,funcs,lines according to Ultrix V4.0. */ -__define_stab (N_NSYMS, 0x32, "NSYMS") - -/* "No DST map for sym: name, ,0,type,ignored" according to Ultrix V4.0. */ -__define_stab (N_NOMAP, 0x34, "NOMAP") - -/* New stab from Solaris 2. Like N_SO, but for the object file. Two in - a row provide the build directory and the relative path of the .o from it. - Solaris2 uses this to avoid putting the stabs info into the linked - executable; this stab goes into the ".stab.index" section, and the debugger - reads the real stabs directly from the .o files instead. */ -__define_stab (N_OBJ, 0x38, "OBJ") - -/* New stab from Solaris 2. Options for the debugger, related to the - source language for this module. E.g. whether to use ANSI - integral promotions or traditional integral promotions. */ -__define_stab (N_OPT, 0x3c, "OPT") - -/* Register variable. Value is number of register. */ -__define_stab (N_RSYM, 0x40, "RSYM") - -/* Modula-2 compilation unit. Can someone say what info it contains? */ -__define_stab (N_M2C, 0x42, "M2C") - -/* Line number in text segment. Desc is the line number; - value is corresponding address. On Solaris2, the line number is - relative to the start of the current function. */ -__define_stab (N_SLINE, 0x44, "SLINE") - -/* Similar, for data segment. */ -__define_stab (N_DSLINE, 0x46, "DSLINE") - -/* Similar, for bss segment. */ -__define_stab (N_BSLINE, 0x48, "BSLINE") - -/* Sun's source-code browser stabs. ?? Don't know what the fields are. - Supposedly the field is "path to associated .cb file". THIS VALUE - OVERLAPS WITH N_BSLINE! */ -__define_stab_duplicate (N_BROWS, 0x48, "BROWS") - -/* GNU Modula-2 definition module dependency. Value is the modification time - of the definition file. Other is non-zero if it is imported with the - GNU M2 keyword %INITIALIZE. Perhaps N_M2C can be used if there - are enough empty fields? */ -__define_stab(N_DEFD, 0x4a, "DEFD") - -/* New in Solaris2. Function start/body/end line numbers. */ -__define_stab(N_FLINE, 0x4C, "FLINE") - -/* THE FOLLOWING TWO STAB VALUES CONFLICT. Happily, one is for Modula-2 - and one is for C++. Still,... */ -/* GNU C++ exception variable. Name is variable name. */ -__define_stab (N_EHDECL, 0x50, "EHDECL") -/* Modula2 info "for imc": name,,0,0,0 according to Ultrix V4.0. */ -__define_stab_duplicate (N_MOD2, 0x50, "MOD2") - -/* GNU C++ `catch' clause. Value is its address. Desc is nonzero if - this entry is immediately followed by a CAUGHT stab saying what exception - was caught. Multiple CAUGHT stabs means that multiple exceptions - can be caught here. If Desc is 0, it means all exceptions are caught - here. */ -__define_stab (N_CATCH, 0x54, "CATCH") - -/* Structure or union element. Value is offset in the structure. */ -__define_stab (N_SSYM, 0x60, "SSYM") - -/* Solaris2: Last stab emitted for module. */ -__define_stab (N_ENDM, 0x62, "ENDM") - -/* Name of main source file. - Value is starting text address of the compilation. - If multiple N_SO's appear, the first to contain a trailing / is the - compilation directory. The first to not contain a trailing / is the - source file name, relative to the compilation directory. Others (perhaps - resulting from cfront) are ignored. - On Solaris2, value is undefined, but desc is a source-language code. */ - -__define_stab (N_SO, 0x64, "SO") - -/* Automatic variable in the stack. Value is offset from frame pointer. - Also used for type descriptions. */ -__define_stab (N_LSYM, 0x80, "LSYM") - -/* Beginning of an include file. Only Sun uses this. - In an object file, only the name is significant. - The Sun linker puts data into some of the other fields. */ -__define_stab (N_BINCL, 0x82, "BINCL") - -/* Name of sub-source file (#include file). - Value is starting text address of the compilation. */ -__define_stab (N_SOL, 0x84, "SOL") - -/* Parameter variable. Value is offset from argument pointer. - (On most machines the argument pointer is the same as the frame pointer. */ -__define_stab (N_PSYM, 0xa0, "PSYM") - -/* End of an include file. No name. - This and N_BINCL act as brackets around the file's output. - In an object file, there is no significant data in this entry. - The Sun linker puts data into some of the fields. */ -__define_stab (N_EINCL, 0xa2, "EINCL") - -/* Alternate entry point. Value is its address. */ -__define_stab (N_ENTRY, 0xa4, "ENTRY") - -/* Beginning of lexical block. - The desc is the nesting level in lexical blocks. - The value is the address of the start of the text for the block. - The variables declared inside the block *precede* the N_LBRAC symbol. - On Solaris2, the value is relative to the start of the current function. */ -__define_stab (N_LBRAC, 0xc0, "LBRAC") - -/* Place holder for deleted include file. Replaces a N_BINCL and everything - up to the corresponding N_EINCL. The Sun linker generates these when - it finds multiple identical copies of the symbols from an include file. - This appears only in output from the Sun linker. */ -__define_stab (N_EXCL, 0xc2, "EXCL") - -/* Modula-2 scope information. Can someone say what info it contains? */ -__define_stab (N_SCOPE, 0xc4, "SCOPE") - -/* End of a lexical block. Desc matches the N_LBRAC's desc. - The value is the address of the end of the text for the block. - On Solaris2, the value is relative to the start of the current function. */ -__define_stab (N_RBRAC, 0xe0, "RBRAC") - -/* Begin named common block. Only the name is significant. */ -__define_stab (N_BCOMM, 0xe2, "BCOMM") - -/* End named common block. Only the name is significant - (and it should match the N_BCOMM). */ -__define_stab (N_ECOMM, 0xe4, "ECOMM") - -/* Member of a common block; value is offset within the common block. - This should occur within a BCOMM/ECOMM pair. */ -__define_stab (N_ECOML, 0xe8, "ECOML") - -/* Solaris2: Pascal "with" statement: type,,0,0,offset */ -__define_stab (N_WITH, 0xea, "WITH") - -/* These STAB's are used on Gould systems for Non-Base register symbols - or something like that. FIXME. I have assigned the values at random - since I don't have a Gould here. Fixups from Gould folk welcome... */ -__define_stab (N_NBTEXT, 0xF0, "NBTEXT") -__define_stab (N_NBDATA, 0xF2, "NBDATA") -__define_stab (N_NBBSS, 0xF4, "NBBSS") -__define_stab (N_NBSTS, 0xF6, "NBSTS") -__define_stab (N_NBLCS, 0xF8, "NBLCS") - -/* Second symbol entry containing a length-value for the preceding entry. - The value is the length. */ -__define_stab (N_LENG, 0xfe, "LENG") - -/* The above information, in matrix format. - - STAB MATRIX - _________________________________________________ - | 00 - 1F are not dbx stab symbols | - | In most cases, the low bit is the EXTernal bit| - - | 00 UNDEF | 02 ABS | 04 TEXT | 06 DATA | - | 01 |EXT | 03 |EXT | 05 |EXT | 07 |EXT | - - | 08 BSS | 0A INDR | 0C FN_SEQ | 0E WEAKA | - | 09 |EXT | 0B | 0D WEAKU | 0F WEAKT | - - | 10 WEAKD | 12 COMM | 14 SETA | 16 SETT | - | 11 WEAKB | 13 | 15 | 17 | - - | 18 SETD | 1A SETB | 1C SETV | 1E WARNING| - | 19 | 1B | 1D | 1F FN | - - |_______________________________________________| - | Debug entries with bit 01 set are unused. | - | 20 GSYM | 22 FNAME | 24 FUN | 26 STSYM | - | 28 LCSYM | 2A MAIN | 2C ROSYM | 2E | - | 30 PC | 32 NSYMS | 34 NOMAP | 36 | - | 38 OBJ | 3A | 3C OPT | 3E | - | 40 RSYM | 42 M2C | 44 SLINE | 46 DSLINE | - | 48 BSLINE*| 4A DEFD | 4C FLINE | 4E | - | 50 EHDECL*| 52 | 54 CATCH | 56 | - | 58 | 5A | 5C | 5E | - | 60 SSYM | 62 ENDM | 64 SO | 66 | - | 68 | 6A | 6C | 6E | - | 70 | 72 | 74 | 76 | - | 78 | 7A | 7C | 7E | - | 80 LSYM | 82 BINCL | 84 SOL | 86 | - | 88 | 8A | 8C | 8E | - | 90 | 92 | 94 | 96 | - | 98 | 9A | 9C | 9E | - | A0 PSYM | A2 EINCL | A4 ENTRY | A6 | - | A8 | AA | AC | AE | - | B0 | B2 | B4 | B6 | - | B8 | BA | BC | BE | - | C0 LBRAC | C2 EXCL | C4 SCOPE | C6 | - | C8 | CA | CC | CE | - | D0 | D2 | D4 | D6 | - | D8 | DA | DC | DE | - | E0 RBRAC | E2 BCOMM | E4 ECOMM | E6 | - | E8 ECOML | EA WITH | EC | EE | - | F0 | F2 | F4 | F6 | - | F8 | FA | FC | FE LENG | - +-----------------------------------------------+ - * 50 EHDECL is also MOD2. - * 48 BSLINE is also BROWS. - */ diff --git a/contrib/gdb/include/aout/stab_gnu.h b/contrib/gdb/include/aout/stab_gnu.h deleted file mode 100644 index 7d18e14..0000000 --- a/contrib/gdb/include/aout/stab_gnu.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef __GNU_STAB__ - -/* Indicate the GNU stab.h is in use. */ - -#define __GNU_STAB__ - -#define __define_stab(NAME, CODE, STRING) NAME=CODE, -#define __define_stab_duplicate(NAME, CODE, STRING) NAME=CODE, - -enum __stab_debug_code -{ -#include "aout/stab.def" -LAST_UNUSED_STAB_CODE -}; - -#undef __define_stab - -/* Definitions of "desc" field for N_SO stabs in Solaris2. */ - -#define N_SO_AS 1 -#define N_SO_C 2 -#define N_SO_ANSI_C 3 -#define N_SO_CC 4 /* C++ */ -#define N_SO_FORTRAN 5 -#define N_SO_PASCAL 6 - -/* Solaris2: Floating point type values in basic types. */ - -#define NF_NONE 0 -#define NF_SINGLE 1 /* IEEE 32-bit */ -#define NF_DOUBLE 2 /* IEEE 64-bit */ -#define NF_COMPLEX 3 /* Fortran complex */ -#define NF_COMPLEX16 4 /* Fortran double complex */ -#define NF_COMPLEX32 5 /* Fortran complex*16 */ -#define NF_LDOUBLE 6 /* Long double (whatever that is) */ - -#endif /* __GNU_STAB_ */ diff --git a/contrib/gdb/include/aout/sun4.h b/contrib/gdb/include/aout/sun4.h deleted file mode 100644 index f42a0dd..0000000 --- a/contrib/gdb/include/aout/sun4.h +++ /dev/null @@ -1,219 +0,0 @@ -/* SPARC-specific values for a.out files */ - -/* Some systems, e.g., AIX, may have defined this in header files already - included. */ -#undef TARGET_PAGE_SIZE -#define TARGET_PAGE_SIZE 0x2000 /* 8K. aka NBPG in */ -/* Note that some SPARCs have 4K pages, some 8K, some others. */ - -#define SEG_SIZE_SPARC TARGET_PAGE_SIZE -#define SEG_SIZE_SUN3 0x20000 /* Resolution of r/w protection hw */ - -#define TEXT_START_ADDR TARGET_PAGE_SIZE /* Location 0 is not accessible */ -#define N_HEADER_IN_TEXT(x) 1 - -/* Non-default definitions of the accessor macros... */ - -/* Segment size varies on Sun-3 versus Sun-4. */ - -#define N_SEGSIZE(x) (N_MACHTYPE(x) == M_SPARC? SEG_SIZE_SPARC: \ - N_MACHTYPE(x) == M_68020? SEG_SIZE_SUN3: \ - /* Guess? */ TARGET_PAGE_SIZE) - -/* Virtual Address of text segment from the a.out file. For OMAGIC, - (almost always "unlinked .o's" these days), should be zero. - Sun added a kludge so that shared libraries linked ZMAGIC get - an address of zero if a_entry (!!!) is lower than the otherwise - expected text address. These kludges have gotta go! - For linked files, should reflect reality if we know it. */ - -/* This differs from the version in aout64.h (which we override by defining - it here) only for NMAGIC (we return TEXT_START_ADDR+EXEC_BYTES_SIZE; - they return 0). */ - -#define N_TXTADDR(x) \ - (N_MAGIC(x)==OMAGIC? 0 \ - : (N_MAGIC(x) == ZMAGIC && (x).a_entry < TEXT_START_ADDR)? 0 \ - : TEXT_START_ADDR+EXEC_BYTES_SIZE) - -/* When a file is linked against a shared library on SunOS 4, the - dynamic bit in the exec header is set, and the first symbol in the - symbol table is __DYNAMIC. Its value is the address of the - following structure. */ - -struct external_sun4_dynamic -{ - /* The version number of the structure. SunOS 4.1.x creates files - with version number 3, which is what this structure is based on. - According to gdb, version 2 is similar. I believe that version 2 - used a different type of procedure linkage table, and there may - have been other differences. */ - bfd_byte ld_version[4]; - /* The virtual address of a 28 byte structure used in debugging. - The contents are filled in at run time by ld.so. */ - bfd_byte ldd[4]; - /* The virtual address of another structure with information about - how to relocate the executable at run time. */ - bfd_byte ld[4]; -}; - -/* The size of the debugging structure pointed to by the debugger - field of __DYNAMIC. */ -#define EXTERNAL_SUN4_DYNAMIC_DEBUGGER_SIZE (24) - -/* The structure pointed to by the linker field of __DYNAMIC. As far - as I can tell, most of the addresses in this structure are offsets - within the file, but some are actually virtual addresses. */ - -struct internal_sun4_dynamic_link -{ - /* Linked list of loaded objects. This is filled in at runtime by - ld.so and probably by dlopen. */ - unsigned long ld_loaded; - - /* The address of the list of names of shared objects which must be - included at runtime. Each entry in the list is 16 bytes: the 4 - byte address of the string naming the object (e.g., for -lc this - is "c"); 4 bytes of flags--the high bit is whether to search for - the object using the library path; the 2 byte major version - number; the 2 byte minor version number; the 4 byte address of - the next entry in the list (zero if this is the last entry). The - version numbers seem to only be non-zero when doing library - searching. */ - unsigned long ld_need; - - /* The address of the path to search for the shared objects which - must be included. This points to a string in PATH format which - is generated from the -L arguments to the linker. According to - the man page, ld.so implicitly adds ${LD_LIBRARY_PATH} to the - beginning of this string and /lib:/usr/lib:/usr/local/lib to the - end. The string is terminated by a null byte. This field is - zero if there is no additional path. */ - unsigned long ld_rules; - - /* The address of the global offset table. This appears to be a - virtual address, not a file offset. The first entry in the - global offset table seems to be the virtual address of the - sun4_dynamic structure (the same value as the __DYNAMIC symbol). - The global offset table is used for PIC code to hold the - addresses of variables. A dynamically linked file which does not - itself contain PIC code has a four byte global offset table. */ - unsigned long ld_got; - - /* The address of the procedure linkage table. This appears to be a - virtual address, not a file offset. - - On a SPARC, the table is composed of 12 byte entries, each of - which consists of three instructions. The first entry is - sethi %hi(0),%g1 - jmp %g1 - nop - These instructions are changed by ld.so into a jump directly into - ld.so itself. Each subsequent entry is - save %sp, -96, %sp - call
- - The reloc_number is the number of the reloc to use to resolve - this entry. The reloc will be a JMP_SLOT reloc against some - symbol that is not defined in this object file but should be - defined in a shared object (if it is not, ld.so will report a - runtime error and exit). The constant 0x010000000 turns the - reloc number into a sethi of %g0, which does nothing since %g0 is - hardwired to zero. - - When one of these entries is executed, it winds up calling into - ld.so. ld.so looks at the reloc number, available via the return - address, to determine which entry this is. It then looks at the - reloc and patches up the entry in the table into a sethi and jmp - to the real address followed by a nop. This means that the reloc - lookup only has to happen once, and it also means that the - relocation only needs to be done if the function is actually - called. The relocation is expensive because ld.so must look up - the symbol by name. - - The size of the procedure linkage table is given by the ld_plt_sz - field. */ - unsigned long ld_plt; - - /* The address of the relocs. These are in the same format as - ordinary relocs. Symbol index numbers refer to the symbols - pointed to by ld_stab. I think the only way to determine the - number of relocs is to assume that all the bytes from ld_rel to - ld_hash contain reloc entries. */ - unsigned long ld_rel; - - /* The address of a hash table of symbols. The hash table has - roughly the same number of entries as there are dynamic symbols; - I think the only way to get the exact size is to assume that - every byte from ld_hash to ld_stab is devoted to the hash table. - - Each entry in the hash table is eight bytes. The first four - bytes are a symbol index into the dynamic symbols. The second - four bytes are the index of the next hash table entry in the - bucket. The ld_buckets field gives the number of buckets, say B. - The first B entries in the hash table each start a bucket which - is chained through the second four bytes of each entry. A value - of zero ends the chain. - - The hash function is simply - h = 0; - while (*string != '\0') - h = (h << 1) + *string++; - h &= 0x7fffffff; - - To look up a symbol, compute the hash value of the name. Take - the modulos of hash value and the number of buckets. Start at - that entry in the hash table. See if the symbol (from the first - four bytes of the hash table entry) has the name you are looking - for. If not, use the chain field (the second four bytes of the - hash table entry) to move on to the next entry in this bucket. - If the chain field is zero you have reached the end of the - bucket, and the symbol is not in the hash table. */ - unsigned long ld_hash; - - /* The address of the symbol table. This is a list of - external_nlist structures. The string indices are relative to - the ld_symbols field. I think the only way to determine the - number of symbols is to assume that all the bytes between ld_stab - and ld_symbols are external_nlist structures. */ - unsigned long ld_stab; - - /* I don't know what this is for. It seems to always be zero. */ - unsigned long ld_stab_hash; - - /* The number of buckets in the hash table. */ - unsigned long ld_buckets; - - /* The address of the symbol string table. The first string in this - string table need not be the empty string. */ - unsigned long ld_symbols; - - /* The size in bytes of the symbol string table. */ - unsigned long ld_symb_size; - - /* The size in bytes of the text segment. */ - unsigned long ld_text; - - /* The size in bytes of the procedure linkage table. */ - unsigned long ld_plt_sz; -}; - -/* The external form of the structure. */ - -struct external_sun4_dynamic_link -{ - bfd_byte ld_loaded[4]; - bfd_byte ld_need[4]; - bfd_byte ld_rules[4]; - bfd_byte ld_got[4]; - bfd_byte ld_plt[4]; - bfd_byte ld_rel[4]; - bfd_byte ld_hash[4]; - bfd_byte ld_stab[4]; - bfd_byte ld_stab_hash[4]; - bfd_byte ld_buckets[4]; - bfd_byte ld_symbols[4]; - bfd_byte ld_symb_size[4]; - bfd_byte ld_text[4]; - bfd_byte ld_plt_sz[4]; -}; diff --git a/contrib/gdb/include/bfdlink.h b/contrib/gdb/include/bfdlink.h deleted file mode 100644 index 47d80b8..0000000 --- a/contrib/gdb/include/bfdlink.h +++ /dev/null @@ -1,452 +0,0 @@ -/* bfdlink.h -- header file for BFD link routines - Copyright 1993 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 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 BFDLINK_H -#define BFDLINK_H - -/* Which symbols to strip during a link. */ -enum bfd_link_strip -{ - strip_none, /* Don't strip any symbols. */ - strip_debugger, /* Strip debugging symbols. */ - strip_some, /* keep_hash is the list of symbols to keep. */ - strip_all /* Strip all symbols. */ -}; - -/* Which local symbols to discard during a link. This is irrelevant - if strip_all is used. */ -enum bfd_link_discard -{ - discard_none, /* Don't discard any locals. */ - discard_l, /* Discard locals with a certain prefix. */ - discard_all /* Discard all locals. */ -}; - -/* These are the possible types of an entry in the BFD link hash - table. */ - -enum bfd_link_hash_type -{ - bfd_link_hash_new, /* Symbol is new. */ - bfd_link_hash_undefined, /* Symbol seen before, but undefined. */ - bfd_link_hash_undefweak, /* Symbol is weak and undefined. */ - bfd_link_hash_defined, /* Symbol is defined. */ - bfd_link_hash_defweak, /* Symbol is weak and defined. */ - bfd_link_hash_common, /* Symbol is common. */ - bfd_link_hash_indirect, /* Symbol is an indirect link. */ - bfd_link_hash_warning /* Like indirect, but warn if referenced. */ -}; - -/* The linking routines use a hash table which uses this structure for - its elements. */ - -struct bfd_link_hash_entry -{ - /* Base hash table entry structure. */ - struct bfd_hash_entry root; - /* Type of this entry. */ - enum bfd_link_hash_type type; - - /* Undefined and common symbols are kept in a linked list through - this field. This field is not in the union because that would - force us to remove entries from the list when we changed their - type, which would force the list to be doubly linked, which would - waste more memory. When an undefined or common symbol is - created, it should be added to this list, the head of which is in - the link hash table itself. As symbols are defined, they need - not be removed from the list; anything which reads the list must - doublecheck the symbol type. - - Weak symbols are not kept on this list. - - Defined and defweak symbols use this field as a reference marker. - If the field is not NULL, or this structure is the tail of the - undefined symbol list, the symbol has been referenced. If the - symbol is undefined and becomes defined, this field will - automatically be non-NULL since the symbol will have been on the - undefined symbol list. */ - struct bfd_link_hash_entry *next; - /* A union of information depending upon the type. */ - union - { - /* Nothing is kept for bfd_hash_new. */ - /* bfd_link_hash_undefined, bfd_link_hash_undefweak. */ - struct - { - bfd *abfd; /* BFD symbol was found in. */ - } undef; - /* bfd_link_hash_defined, bfd_link_hash_defweak. */ - struct - { - bfd_vma value; /* Symbol value. */ - asection *section; /* Symbol section. */ - } def; - /* bfd_link_hash_indirect, bfd_link_hash_warning. */ - struct - { - struct bfd_link_hash_entry *link; /* Real symbol. */ - const char *warning; /* Warning (bfd_link_hash_warning only). */ - } i; - /* bfd_link_hash_common. */ - struct - { - /* The linker needs to know three things about common - symbols: the size, the alignment, and the section in - which the symbol should be placed. We store the size - here, and we allocate a small structure to hold the - section and the alignment. The alignment is stored as a - power of two. We don't store all the information - directly because we don't want to increase the size of - the union; this structure is a major space user in the - linker. */ - bfd_size_type size; /* Common symbol size. */ - struct bfd_link_hash_common_entry - { - unsigned int alignment_power; /* Alignment. */ - asection *section; /* Symbol section. */ - } *p; - } c; - } u; -}; - -/* This is the link hash table. It is a derived class of - bfd_hash_table. */ - -struct bfd_link_hash_table -{ - /* The hash table itself. */ - struct bfd_hash_table table; - /* The back end which created this hash table. This indicates the - type of the entries in the hash table, which is sometimes - important information when linking object files of different - types together. */ - const bfd_target *creator; - /* A linked list of undefined and common symbols, linked through the - next field in the bfd_link_hash_entry structure. */ - struct bfd_link_hash_entry *undefs; - /* Entries are added to the tail of the undefs list. */ - struct bfd_link_hash_entry *undefs_tail; -}; - -/* Look up an entry in a link hash table. If FOLLOW is true, this - follows bfd_link_hash_indirect and bfd_link_hash_warning links to - the real symbol. */ -extern struct bfd_link_hash_entry *bfd_link_hash_lookup - PARAMS ((struct bfd_link_hash_table *, const char *, boolean create, - boolean copy, boolean follow)); - -/* Look up an entry in the main linker hash table if the symbol might - be wrapped. This should only be used for references to an - undefined symbol, not for definitions of a symbol. */ - -extern struct bfd_link_hash_entry *bfd_wrapped_link_hash_lookup - PARAMS ((bfd *, struct bfd_link_info *, const char *, boolean, boolean, - boolean)); - -/* Traverse a link hash table. */ -extern void bfd_link_hash_traverse - PARAMS ((struct bfd_link_hash_table *, - boolean (*) (struct bfd_link_hash_entry *, PTR), - PTR)); - -/* Add an entry to the undefs list. */ -extern void bfd_link_add_undef - PARAMS ((struct bfd_link_hash_table *, struct bfd_link_hash_entry *)); - -/* This structure holds all the information needed to communicate - between BFD and the linker when doing a link. */ - -struct bfd_link_info -{ - /* Function callbacks. */ - const struct bfd_link_callbacks *callbacks; - /* true if BFD should generate a relocateable object file. */ - boolean relocateable; - /* true if BFD should generate a shared object. */ - boolean shared; - /* true if BFD should pre-bind symbols in a shared object. */ - boolean symbolic; - /* true if shared objects should be linked directly, not shared. */ - boolean static_link; - /* Which symbols to strip. */ - enum bfd_link_strip strip; - /* Which local symbols to discard. */ - enum bfd_link_discard discard; - /* The local symbol prefix to discard if using discard_l. */ - unsigned int lprefix_len; - const char *lprefix; - /* true if symbols should be retained in memory, false if they - should be freed and reread. */ - boolean keep_memory; - /* The list of input BFD's involved in the link. These are chained - together via the link_next field. */ - bfd *input_bfds; - /* If a symbol should be created for each input BFD, this is section - where those symbols should be placed. It must be a section in - the output BFD. It may be NULL, in which case no such symbols - will be created. This is to support CREATE_OBJECT_SYMBOLS in the - linker command language. */ - asection *create_object_symbols_section; - /* Hash table handled by BFD. */ - struct bfd_link_hash_table *hash; - /* Hash table of symbols to keep. This is NULL unless strip is - strip_some. */ - struct bfd_hash_table *keep_hash; - /* Hash table of symbols to report back via notice_callback. If - this is NULL no symbols are reported back. */ - struct bfd_hash_table *notice_hash; - /* Hash table of symbols which are being wrapped (the --wrap linker - option). If this is NULL, no symbols are being wrapped. */ - struct bfd_hash_table *wrap_hash; - - /* If a base output file is wanted, then this points to it */ - PTR base_file; -}; - -/* This structures holds a set of callback functions. These are - called by the BFD linker routines. The first argument to each - callback function is the bfd_link_info structure being used. Each - function returns a boolean value. If the function returns false, - then the BFD function which called it will return with a failure - indication. */ - -struct bfd_link_callbacks -{ - /* A function which is called when an object is added from an - archive. ABFD is the archive element being added. NAME is the - name of the symbol which caused the archive element to be pulled - in. */ - boolean (*add_archive_element) PARAMS ((struct bfd_link_info *, - bfd *abfd, - const char *name)); - /* A function which is called when a symbol is found with multiple - definitions. NAME is the symbol which is defined multiple times. - OBFD is the old BFD, OSEC is the old section, OVAL is the old - value, NBFD is the new BFD, NSEC is the new section, and NVAL is - the new value. OBFD may be NULL. OSEC and NSEC may be - bfd_com_section or bfd_ind_section. */ - boolean (*multiple_definition) PARAMS ((struct bfd_link_info *, - const char *name, - bfd *obfd, - asection *osec, - bfd_vma oval, - bfd *nbfd, - asection *nsec, - bfd_vma nval)); - /* A function which is called when a common symbol is defined - multiple times. NAME is the symbol appearing multiple times. - OBFD is the BFD of the existing symbol; it may be NULL if this is - not known. OTYPE is the type of the existing symbol, which may - be bfd_link_hash_defined, bfd_link_hash_defweak, - bfd_link_hash_common, or bfd_link_hash_indirect. If OTYPE is - bfd_link_hash_common, OSIZE is the size of the existing symbol. - NBFD is the BFD of the new symbol. NTYPE is the type of the new - symbol, one of bfd_link_hash_defined, bfd_link_hash_common, or - bfd_link_hash_indirect. If NTYPE is bfd_link_hash_common, NSIZE - is the size of the new symbol. */ - boolean (*multiple_common) PARAMS ((struct bfd_link_info *, - const char *name, - bfd *obfd, - enum bfd_link_hash_type otype, - bfd_vma osize, - bfd *nbfd, - enum bfd_link_hash_type ntype, - bfd_vma nsize)); - /* A function which is called to add a symbol to a set. ENTRY is - the link hash table entry for the set itself (e.g., - __CTOR_LIST__). RELOC is the relocation to use for an entry in - the set when generating a relocateable file, and is also used to - get the size of the entry when generating an executable file. - ABFD, SEC and VALUE identify the value to add to the set. */ - boolean (*add_to_set) PARAMS ((struct bfd_link_info *, - struct bfd_link_hash_entry *entry, - bfd_reloc_code_real_type reloc, - bfd *abfd, asection *sec, bfd_vma value)); - /* A function which is called when the name of a g++ constructor or - destructor is found. This is only called by some object file - formats. CONSTRUCTOR is true for a constructor, false for a - destructor. This will use BFD_RELOC_CTOR when generating a - relocateable file. NAME is the name of the symbol found. ABFD, - SECTION and VALUE are the value of the symbol. */ - boolean (*constructor) PARAMS ((struct bfd_link_info *, - boolean constructor, - const char *name, bfd *abfd, asection *sec, - bfd_vma value)); - /* A function which is called to issue a linker warning. For - example, this is called when there is a reference to a warning - symbol. WARNING is the warning to be issued. SYMBOL is the name - of the symbol which triggered the warning; it may be NULL if - there is none. ABFD, SECTION and ADDRESS identify the location - which trigerred the warning; either ABFD or SECTION or both may - be NULL if the location is not known. */ - boolean (*warning) PARAMS ((struct bfd_link_info *, - const char *warning, const char *symbol, - bfd *abfd, asection *section, - bfd_vma address)); - /* A function which is called when a relocation is attempted against - an undefined symbol. NAME is the symbol which is undefined. - ABFD, SECTION and ADDRESS identify the location from which the - reference is made. In some cases SECTION may be NULL. */ - boolean (*undefined_symbol) PARAMS ((struct bfd_link_info *, - const char *name, bfd *abfd, - asection *section, bfd_vma address)); - /* A function which is called when a reloc overflow occurs. NAME is - the name of the symbol or section the reloc is against, - RELOC_NAME is the name of the relocation, and ADDEND is any - addend that is used. ABFD, SECTION and ADDRESS identify the - location at which the overflow occurs; if this is the result of a - bfd_section_reloc_link_order or bfd_symbol_reloc_link_order, then - ABFD will be NULL. */ - boolean (*reloc_overflow) PARAMS ((struct bfd_link_info *, - const char *name, - const char *reloc_name, bfd_vma addend, - bfd *abfd, asection *section, - bfd_vma address)); - /* A function which is called when a dangerous reloc is performed. - The canonical example is an a29k IHCONST reloc which does not - follow an IHIHALF reloc. MESSAGE is an appropriate message. - ABFD, SECTION and ADDRESS identify the location at which the - problem occurred; if this is the result of a - bfd_section_reloc_link_order or bfd_symbol_reloc_link_order, then - ABFD will be NULL. */ - boolean (*reloc_dangerous) PARAMS ((struct bfd_link_info *, - const char *message, - bfd *abfd, asection *section, - bfd_vma address)); - /* A function which is called when a reloc is found to be attached - to a symbol which is not being written out. NAME is the name of - the symbol. ABFD, SECTION and ADDRESS identify the location of - the reloc; if this is the result of a - bfd_section_reloc_link_order or bfd_symbol_reloc_link_order, then - ABFD will be NULL. */ - boolean (*unattached_reloc) PARAMS ((struct bfd_link_info *, - const char *name, - bfd *abfd, asection *section, - bfd_vma address)); - /* A function which is called when a symbol in notice_hash is - defined or referenced. NAME is the symbol. ABFD, SECTION and - ADDRESS are the value of the symbol. If SECTION is - bfd_und_section, this is a reference. */ - boolean (*notice) PARAMS ((struct bfd_link_info *, const char *name, - bfd *abfd, asection *section, bfd_vma address)); -}; - -/* The linker builds link_order structures which tell the code how to - include input data in the output file. */ - -/* These are the types of link_order structures. */ - -enum bfd_link_order_type -{ - bfd_undefined_link_order, /* Undefined. */ - bfd_indirect_link_order, /* Built from a section. */ - bfd_fill_link_order, /* Fill with a 16 bit constant. */ - bfd_data_link_order, /* Set to explicit data. */ - bfd_section_reloc_link_order, /* Relocate against a section. */ - bfd_symbol_reloc_link_order /* Relocate against a symbol. */ -}; - -/* This is the link_order structure itself. These form a chain - attached to the section whose contents they are describing. */ - -struct bfd_link_order -{ - /* Next link_order in chain. */ - struct bfd_link_order *next; - /* Type of link_order. */ - enum bfd_link_order_type type; - /* Offset within output section. */ - bfd_vma offset; - /* Size within output section. */ - bfd_size_type size; - /* Type specific information. */ - union - { - struct - { - /* Section to include. If this is used, then - section->output_section must be the section the - link_order is attached to, section->output_offset must - equal the link_order offset field, and section->_raw_size - must equal the link_order size field. Maybe these - restrictions should be relaxed someday. */ - asection *section; - } indirect; - struct - { - /* Value to fill with. */ - unsigned int value; - } fill; - struct - { - /* Data to put into file. The size field gives the number - of bytes which this field points to. */ - bfd_byte *contents; - } data; - struct - { - /* Description of reloc to generate. Used for - bfd_section_reloc_link_order and - bfd_symbol_reloc_link_order. */ - struct bfd_link_order_reloc *p; - } reloc; - } u; -}; - -/* A linker order of type bfd_section_reloc_link_order or - bfd_symbol_reloc_link_order means to create a reloc against a - section or symbol, respectively. This is used to implement -Ur to - generate relocs for the constructor tables. The - bfd_link_order_reloc structure describes the reloc that BFD should - create. It is similar to a arelent, but I didn't use arelent - because the linker does not know anything about most symbols, and - any asymbol structure it creates will be partially meaningless. - This information could logically be in the bfd_link_order struct, - but I didn't want to waste the space since these types of relocs - are relatively rare. */ - -struct bfd_link_order_reloc -{ - /* Reloc type. */ - bfd_reloc_code_real_type reloc; - - union - { - /* For type bfd_section_reloc_link_order, this is the section - the reloc should be against. This must be a section in the - output BFD, not any of the input BFDs. */ - asection *section; - /* For type bfd_symbol_reloc_link_order, this is the name of the - symbol the reloc should be against. */ - const char *name; - } u; - - /* Addend to use. The object file should contain zero. The BFD - backend is responsible for filling in the contents of the object - file correctly. For some object file formats (e.g., COFF) the - addend must be stored into in the object file, and for some - (e.g., SPARC a.out) it is kept in the reloc. */ - bfd_vma addend; -}; - -/* Allocate a new link_order for a section. */ -extern struct bfd_link_order *bfd_new_link_order PARAMS ((bfd *, asection *)); - -#endif diff --git a/contrib/gdb/include/bout.h b/contrib/gdb/include/bout.h deleted file mode 100644 index 8fc28cc..0000000 --- a/contrib/gdb/include/bout.h +++ /dev/null @@ -1,182 +0,0 @@ -/* - * This file is a modified version of 'a.out.h'. It is to be used in all - * GNU tools modified to support the i80960 (or tools that operate on - * object files created by such tools). - * - * All i80960 development is done in a CROSS-DEVELOPMENT environment. I.e., - * object code is generated on, and executed under the direction of a symbolic - * debugger running on, a host system. We do not want to be subject to the - * vagaries of which host it is or whether it supports COFF or a.out format, - * or anything else. We DO want to: - * - * o always generate the same format object files, regardless of host. - * - * o have an 'a.out' header that we can modify for our own purposes - * (the 80960 is typically an embedded processor and may require - * enhanced linker support that the normal a.out.h header can't - * accommodate). - * - * As for byte-ordering, the following rules apply: - * - * o Text and data that is actually downloaded to the target is always - * in i80960 (little-endian) order. - * - * o All other numbers (in the header, symbols, relocation directives) - * are in host byte-order: object files CANNOT be lifted from a - * little-end host and used on a big-endian (or vice versa) without - * modification. - * ==> THIS IS NO LONGER TRUE USING BFD. WE CAN GENERATE ANY BYTE ORDER - * FOR THE HEADER, AND READ ANY BYTE ORDER. PREFERENCE WOULD BE TO - * USE LITTLE-ENDIAN BYTE ORDER THROUGHOUT, REGARDLESS OF HOST. <== - * - * o The downloader ('comm960') takes care to generate a pseudo-header - * with correct (i80960) byte-ordering before shipping text and data - * off to the NINDY monitor in the target systems. Symbols and - * relocation info are never sent to the target. - */ - - -#define BMAGIC 0415 -/* We don't accept the following (see N_BADMAG macro). - * They're just here so GNU code will compile. - */ -#define OMAGIC 0407 /* old impure format */ -#define NMAGIC 0410 /* read-only text */ -#define ZMAGIC 0413 /* demand load format */ - -/* FILE HEADER - * All 'lengths' are given as a number of bytes. - * All 'alignments' are for relinkable files only; an alignment of - * 'n' indicates the corresponding segment must begin at an - * address that is a multiple of (2**n). - */ -struct external_exec { - /* Standard stuff */ - unsigned char e_info[4]; /* Identifies this as a b.out file */ - unsigned char e_text[4]; /* Length of text */ - unsigned char e_data[4]; /* Length of data */ - unsigned char e_bss[4]; /* Length of uninitialized data area */ - unsigned char e_syms[4]; /* Length of symbol table */ - unsigned char e_entry[4]; /* Runtime start address */ - unsigned char e_trsize[4]; /* Length of text relocation info */ - unsigned char e_drsize[4]; /* Length of data relocation info */ - - /* Added for i960 */ - unsigned char e_tload[4]; /* Text runtime load address */ - unsigned char e_dload[4]; /* Data runtime load address */ - unsigned char e_talign[1]; /* Alignment of text segment */ - unsigned char e_dalign[1]; /* Alignment of data segment */ - unsigned char e_balign[1]; /* Alignment of bss segment */ - unsigned char e_relaxable[1]; /* Assembled with enough info to allow linker to relax */ -}; - -#define EXEC_BYTES_SIZE (sizeof (struct external_exec)) - -/* These macros use the a_xxx field names, since they operate on the exec - structure after it's been byte-swapped and realigned on the host machine. */ -#define N_BADMAG(x) (((x).a_info)!=BMAGIC) -#define N_TXTOFF(x) EXEC_BYTES_SIZE -#define N_DATOFF(x) ( N_TXTOFF(x) + (x).a_text ) -#define N_TROFF(x) ( N_DATOFF(x) + (x).a_data ) -#define N_TRELOFF N_TROFF -#define N_DROFF(x) ( N_TROFF(x) + (x).a_trsize ) -#define N_DRELOFF N_DROFF -#define N_SYMOFF(x) ( N_DROFF(x) + (x).a_drsize ) -#define N_STROFF(x) ( N_SYMOFF(x) + (x).a_syms ) -#define N_DATADDR(x) ( (x).a_dload ) - -/* Address of text segment in memory after it is loaded. */ -#if !defined (N_TXTADDR) -#define N_TXTADDR(x) 0 -#endif - -/* A single entry in the symbol table - */ -struct nlist { - union { - char *n_name; - struct nlist *n_next; - long n_strx; /* Index into string table */ - } n_un; - unsigned char n_type; /* See below */ - char n_other; /* Used in i80960 support -- see below */ - short n_desc; - unsigned long n_value; -}; - - -/* Legal values of n_type - */ -#define N_UNDF 0 /* Undefined symbol */ -#define N_ABS 2 /* Absolute symbol */ -#define N_TEXT 4 /* Text symbol */ -#define N_DATA 6 /* Data symbol */ -#define N_BSS 8 /* BSS symbol */ -#define N_FN 31 /* Filename symbol */ - -#define N_EXT 1 /* External symbol (OR'd in with one of above) */ -#define N_TYPE 036 /* Mask for all the type bits */ -#define N_STAB 0340 /* Mask for all bits used for SDB entries */ - -/* MEANING OF 'n_other' - * - * If non-zero, the 'n_other' fields indicates either a leaf procedure or - * a system procedure, as follows: - * - * 1 <= n_other <= 32 : - * The symbol is the entry point to a system procedure. - * 'n_value' is the address of the entry, as for any other - * procedure. The system procedure number (which can be used in - * a 'calls' instruction) is (n_other-1). These entries come from - * '.sysproc' directives. - * - * n_other == N_CALLNAME - * the symbol is the 'call' entry point to a leaf procedure. - * The *next* symbol in the symbol table must be the corresponding - * 'bal' entry point to the procedure (see following). These - * entries come from '.leafproc' directives in which two different - * symbols are specified (the first one is represented here). - * - * - * n_other == N_BALNAME - * the symbol is the 'bal' entry point to a leaf procedure. - * These entries result from '.leafproc' directives in which only - * one symbol is specified, or in which the same symbol is - * specified twice. - * - * Note that an N_CALLNAME entry *must* have a corresponding N_BALNAME entry, - * but not every N_BALNAME entry must have an N_CALLNAME entry. - */ -#define N_CALLNAME ((char)-1) -#define N_BALNAME ((char)-2) -#define IS_CALLNAME(x) (N_CALLNAME == (x)) -#define IS_BALNAME(x) (N_BALNAME == (x)) -#define IS_OTHER(x) ((x)>0 && (x) <=32) - -#define b_out_relocation_info relocation_info -struct relocation_info { - int r_address; /* File address of item to be relocated */ - unsigned -#define r_index r_symbolnum - r_symbolnum:24,/* Index of symbol on which relocation is based, - * if r_extern is set. Otherwise set to - * either N_TEXT, N_DATA, or N_BSS to - * indicate section on which relocation is - * based. - */ - r_pcrel:1, /* 1 => relocate PC-relative; else absolute - * On i960, pc-relative implies 24-bit - * address, absolute implies 32-bit. - */ - r_length:2, /* Number of bytes to relocate: - * 0 => 1 byte - * 1 => 2 bytes -- used for 13 bit pcrel - * 2 => 4 bytes - */ - r_extern:1, - r_bsr:1, /* Something for the GNU NS32K assembler */ - r_disp:1, /* Something for the GNU NS32K assembler */ - r_callj:1, /* 1 if relocation target is an i960 'callj' */ - r_relaxable:1; /* 1 if enough info is left to relax - the data */ -}; diff --git a/contrib/gdb/include/coff/ChangeLog b/contrib/gdb/include/coff/ChangeLog deleted file mode 100644 index 06c7f80..0000000 --- a/contrib/gdb/include/coff/ChangeLog +++ /dev/null @@ -1,622 +0,0 @@ -Thu Mar 14 15:22:44 1996 Jeffrey A Law (law@cygnus.com) - - * internal.h (R_MEM_INDIRECT): New reloc for the h8300. - -Fri Feb 9 10:44:11 1996 Ian Lance Taylor - - * aux-coff.h: Rename from aux.h, to avoid problems on hapless DOS - systems which think that aux is a com port. - -Mon Feb 5 18:35:00 1996 Ian Lance Taylor - - * i960.h (F_I960HX): Define. - -Wed Jan 31 13:11:54 1996 Richard Henderson - - * aux.h: New file. - * internal.h, m68k.h: Protect against multiple inclusion. - -Wed Nov 22 13:48:39 1995 Ian Lance Taylor - - * ecoff.h (_RCONST, STYP_RCONST, RELOC_SECTION_RCONST): Define. - (NUM_RELOC_SECTIONS): Update. - * symconst.h (scRConst): Define. - -Tue Nov 14 18:54:29 1995 Ian Lance Taylor - - * internal.h (C_NT_WEAK): Define. - -Thu Nov 9 14:08:30 1995 Ian Lance Taylor - - * rs6000.h (STYP_OVRFLO): Define. - -Tue Nov 7 14:38:45 1995 Kim Knuttila - - * coff/powerpc.h (IMAGE_NT_OPTIONAL_HDR_MAGIC): Added define. - * coff/pe.h: Added defines for file level flags - -Mon Nov 6 17:28:01 1995 Harry Dolan - - * i860.h: New file, based on i386.h. - -Wed Nov 1 15:25:18 1995 Manfred Hollstein KS/EF4A 60/1F/110 #40283 - - * m68k.h (PAGEMAGICEXECSWAPPED): Define. - (PAGEMAGICPEXECSWAPPED): Define. - (PAGEMAGICPEXECTSHLIB): Define. - (PAGEMAGICPEXECPAGED): Define. - (_COMMENT): DEFINE. - * m88k.h (_COMMENT): Define. - -Wed Oct 18 18:36:19 1995 Geoffrey Noer - - * sym.h: #if 0'd out runtime_pdr struct because it chokes - Visual C++ and there aren't any references to it elsewhere in gdb. - -Mon Oct 16 11:12:24 1995 Ian Lance Taylor - - * rs6000.h (SMALL_AOUTSZ): Define. - - * internal.h (XMC_TD): Define. - -Tue Oct 10 18:41:03 1995 Ian Lance Taylor - - * internal.h (struct internal_aouthdr): Add o_cputype field. - * rs6000.h (AOUTHDR): Rename o_resv1 to o_cputype. - -Mon Oct 9 14:45:46 1995 Ian Lance Taylor - - * rs6000.h (AOUTHDR): Add o_maxdata field. Add comments. - (_PAD, _LOADER): Define. - (STYP_LOADER): Define. - * internal.h (struct internal_aouthdr): Add o_maxdata field. - -Thu Oct 5 10:02:57 1995 Ian Lance Taylor - - * ecoff.h: Define section name macros and STYP macros for various - Alpha sections: .got, .hash, .dynsym, .dynstr, .rel.dyn, .conflic, - .comment, .liblist, .dynamic. - -Wed Oct 4 10:56:35 1995 Kim Knuttila - - * pe.h: Moved DOSMAGIC and NT_SIGNATURE defines here - * powerpc.h: removed DOSMAGIC, NT_SIGNATURE, and DEFAULT_* defines - Also removed other unused defines (various MAGIC ones) - * i386.h: removed DOSMAGIC, NT_SIGNATURE, and DEFAULT_* defines - * arm.h: removed DOSMAGIC, NT_SIGNATURE, and DEFAULT_* defines - * apollo.h: removed unused DEFAULT_* defines - * alpha.h: removed unused DEFAULT_* defines - * h8500.h: removed unused DEFAULT_* defines - * h8300.h: removed unused DEFAULT_* defines - * i960.h: removed unused DEFAULT_* defines - * m88k.h: removed unused DEFAULT_* defines - * we32k.h: removed unused DEFAULT_* defines - * rs6000.h: removed unused DEFAULT_* defines - * mips.h: removed unused DEFAULT_* defines - * m68k.h: removed unused DEFAULT_* defines - * z8k.h: removed unused DEFAULT_* defines - * w65.h: removed unused DEFAULT_* defines - * sparc.h: removed unused DEFAULT_* defines - * sh.h: removed unused DEFAULT_* defines - -Fri Sep 29 08:40:08 1995 Kim Knuttila - - * powerpc.h: Reformatted to GNU coding conventions. - -Wed Sep 27 06:50:50 1995 Kim Knuttila - - * pe.h: added defines for more section characteristics - * powerpc.h (new file): base coff definitions for ppc PE - -Tue Sep 12 12:08:20 1995 Ian Lance Taylor - - * internal.h (struct internal_syment): Change n_numaux field from - char to unsigned char. - -Fri Sep 1 15:39:36 1995 Kazumoto Kojima - - * mips.h (struct rpdr_ext): Define. - -Thu Aug 31 16:51:50 1995 steve chamberlain - - * internal.h (internal_aouthdr, internal_filehdr): - don't indirect the pe stuff. - -Tue Aug 29 14:16:07 1995 steve chamberlain - - * i386.h (NT_DEF_RESERVE, NT_DEF_COMMIT): Make the same - as 'the other' compiler. - * internal.h (NT_IMAGE_BASE): Deleted. - (NT_EXE_IMAGE_BASE, NT_DLL_IMAGE_BASE): New. - (PE_DEF_SECTION_ALIGNMENT, PE_DEF_FILE_ALIGNMENT): New. - (R_IMAGEBASE): New. - -Mon Aug 21 18:12:19 1995 steve chamberlain - - * internal.h: (internal_filehdr): Moved PE stuff into - internal_extra_pe_filehdr. - (internal_aouthdr): Moved PE stuff into - interanl_extra_pe_aouthdr. - -Mon Jul 24 14:05:39 1995 Ian Lance Taylor - - * internal.h: Move R_SH_* relocs from here... - * sh.h: ...to here. - (R_SH_SWITCH16, R_SH_SWITCH32): Define. - (R_SH_USES, R_SH_COUNT, R_SH_ALIGN): Define. - -Thu Jun 29 00:04:25 1995 Steve Chamberlain - - * internal.h (NT_DEF_RESERVE, NT_DEF_COMMIT): Increase a lot. - -Tue May 16 15:08:20 1995 Ken Raeburn - - * internal.h (NT_subsystem, NT_stack_heap): Delete - -Tue May 16 15:08:20 1995 Ken Raeburn - - * internal.h (NT_subsystem, NT_stack_heap): Now extern. - -Tue Feb 14 17:59:37 1995 Ian Lance Taylor - - * ecoff.h (struct ecoff_fdrtab_entry): Define. - (struct ecoff_find_line): Define. - -Sat Feb 4 14:38:03 1995 David Mosberger-Tang - - * sym.h (struct pdr): field "prof" added. - - * alpha.h (PDR_BITS1_PROF_*): added, macros for PDR_BITS*_RESERVED_* - updated accordingly. - -Sun Jan 15 18:38:33 1995 Steve Chamberlain - - * w65.h: New file. - -Wed Nov 23 22:43:38 1994 Steve Chamberlain (sac@jonny.cygnus.com) - - * sh.h (SH_ARCH_MAGIC_BIG, SH_ARCH_MAGIC_LITTLE): New. - (SHBADMAG): Changed to suit. - -Tue Jul 26 17:46:08 1994 Ken Raeburn (raeburn@cujo.cygnus.com) - - * i960.h (F_I960JX): New macro. - -Wed Jul 6 00:48:57 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * alpha.h: Add definitions for alpha file header flags, encoding - the object type of the file. - -Mon Jun 20 13:47:01 1994 Ian Lance Taylor (ian@sanguine.cygnus.com) - - * ecoff.h (ecoff_swap_tir_in): Remove declaration. - (ecoff_swap_tir_out): Likewise. - (ecoff_swap_rndx_in, ecoff_swap_rndx_out): Likewise. - (struct ecoff_debug_swap): Add new fields: swap_tir_in, - swap_rndx_in, swap_tir_out, swap_rndx_out, read_debug_info. - -Sun Jun 12 03:51:52 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * symconst.h: Pick up SGI define for stIndirect. - -Fri Apr 22 13:05:28 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * ecoff.h (REGINFO): Don't define. - (struct ecoff_reginfo): Don't define. - - * sh.h (SH_ARCH_MAGIC): Rename from SHMAGIC. SHMAGIC is used by - several targets to mean a shared library. - (SHBADMAG): Corresponding change. - -Thu Apr 14 13:00:53 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * mips.h (RELOC_BITS3_TYPE_BIG): Changed from 0x1e to 0x3e. - (RELOC_BITS3_TYPEHI_LITTLE): Define. - (RELOC_BITS3_TYPEHI_SH_LITTLE): Define. - (MIPS_R_PCREL16): Change value from 8 to 12 to match Irix 4. - (MIPS_R_RELHI): Define. - (MIPS_R_RELLO): Define. - (MIPS_R_SWITCH): Change value from 9 to 22. - -Thu Apr 7 14:19:35 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * mips.h (MIPS_R_SWITCH): Define. - -Thu Mar 31 19:28:33 1994 Ken Raeburn (raeburn@cujo.cygnus.com) - - * internal.h (internal_aouthdr): Added comments for Apollo fields. - -Thu Mar 31 16:28:02 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * ecoff.h (STYP_ECOFF_LIB): Define as used on Irix 4. - -Fri Mar 25 17:16:55 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * ecoff.h (struct ecoff_debug_info): Add adjust field. - (struct ecoff_value_adjust): Define. - -Tue Mar 22 13:22:47 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * mips.h (MIPS_R_PCREL16): Define. - -Sat Feb 26 10:26:38 1994 Ian Lance Taylor (ian@cygnus.com) - - * ecoff.h: Add casts to avoid warnings from SVR4 cc. - -Mon Feb 21 09:48:46 1994 Ian Lance Taylor (ian@lisa.cygnus.com) - - * sym.h (struct runtime_pdr): Make field adr bfd_vma, not unsigned - long. - (SYMR): Make field value bfd_vma, not long. - -Fri Feb 4 23:35:53 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * rs6000.h (STYP_DEBUG): Define. - -Wed Feb 2 14:31:37 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * internal.h (union internal_auxent): Change x_csect.x_scnlen into - a union of a long and a pointer to a symbol. XCOFF sometimes uses - this field as a symbol index. - -Mon Jan 10 23:54:25 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * ecoff.h (ecoff_debug_info): Remove fields line_end, - external_dnr_end, external_pdr_end, external_sym_end, - external_opt_end, external_aux_end, ss_end, external_fdr_end. - Replace ifdbase with ifdmap. - -Wed Jan 5 17:05:36 1994 Ken Raeburn (raeburn@deneb.cygnus.com) - - * ecoff.h (STYP_EXTENDESC, STYP_COMMENT, STYP_XDATA, STYP_PDATA): - Define. - -Wed Jan 5 16:58:24 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * ecoff.h (NUM_RELOC_SECTIONS): Define. - -Tue Dec 21 09:24:56 1993 Ken Raeburn (raeburn@rtl.cygnus.com) - - * sparc.h (struct external_reloc): Rename field r_addend to - r_offset. - -Sat Dec 11 16:12:32 1993 Steve Chamberlain (sac@thepub.cygnus.com) - - * internal.h (R_DISP7, R_SH_IMM16): New reloc types. - -Tue Nov 23 14:23:19 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * ecoff.h (struct ecoff_debug_swap): Added *_end fields for all - the symbolic information pointers. - - * sym.h: Named the EXTR structure ecoff_extr. - -Fri Nov 19 08:21:18 1993 Ken Raeburn (raeburn@rover.cygnus.com) - - * sparc.h (RELSZ): Use correct size. - -Wed Nov 17 17:18:16 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * mips.h (struct ecoff_debug_info): Define. - -Tue Nov 2 17:56:57 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * ecoff.h (struct ecoff_debug_swap): Define. - -Thu Oct 28 17:07:50 1993 Stan Shebs (shebs@rtl.cygnus.com) - - * i386.h (I386LYNXMAGIC): Rename to LYNXCOFFMAGIC. - * m68k.h (LYNXCOFFMAGIC): Define. - * sparc.h: New file. - -Tue Oct 19 15:34:50 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * alpha.h (external_aouthdr): Split four byte padding field into - two byte bldrev field and two byte padding field. - - * ecoff.h (_LITA, _PDATA, _XDATA, STYP_LITA): Defined. - -Wed Oct 13 15:52:34 1993 Ken Raeburn (raeburn@cygnus.com) - - Sun Oct 10 17:27:10 1993 Troy Rollo (troy@cbme.unsw.edu.au) - - * coff/internal.h: Added o_sri, o_inlib and o_vid for Apollos - as well as R_DIR16. - - * coff/apollo.h: New file - -Mon Oct 11 17:16:48 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * ecoff.h (REGINFO, struct ecoff_reginfo): Define. - -Tue Oct 5 10:52:53 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * rs6000.h: Change non-ASCII characters in comment to octal - escapes. - -Tue Sep 28 03:27:04 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * ecoff.h (_FINI, STYP_ECOFF_FINI): Add to support .fini section. - -Fri Sep 24 11:53:53 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * mips.h (BADMAG): Recognize MIPS_MAGIC_LITTLE3 and MIPS_MAGIC_BIG3. - * ecoff.h: Define MIPS_MAGIC_LITTLE3 and MIPS_MAGIC_BIG3. - -Thu Sep 23 21:07:14 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * mips.h (BADMAG): Recognize MIPS_MAGIC_LITTLE2 and MIPS_MAGIC_BIG2. - * ecoff.h: Define MIPS_MAGIC_LITTLE2 and MIPS_MAGIC_BIG2. - -Thu Sep 16 20:27:21 1993 Jim Kingdon (kingdon@cirdan.cygnus.com) - - * sym.h, symconst.h: Add comment stating these files are not part - of GDB, GAS, etc. In 1991, when we asked rms whether we could - include these files in GDB (although they are copyrighted by - someone besides the FSF), he said it was OK if they were not - considered part of GDB. - -Fri Sep 10 17:40:35 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * ecoff.h (AUX_PUT_ANY): Cast val argument to bfd_vma. - - * alpha.c (external_aouthdr): Need four bytes of padding between - vstamp and tsize. - -Tue Sep 7 14:20:43 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * ecoff.h (AUX_GET_ANY, AUX_PUT_ANY): Changed to reflect further - change in bfd swapping routine names. - -Tue Sep 7 10:15:17 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * ecoff.h (AUX_GET_ANY): Change name of _do_getb32 to reflect bfd - changes. - -Fri Aug 13 14:30:32 1993 Ian Lance Taylor (ian@cygnus.com) - - * ecoff.h (RELOC_SECTION_NONE): Define. - -Thu Aug 12 11:24:42 1993 Ian Lance Taylor (ian@cygnus.com) - - * alpha.h (struct external_reloc): Add r_symndx field. - (RELSZ): Correct. - (RELOC_BITS*): Correct. - (ALPHA_R_*): Define. - * ecoff.h (RELOC_SECTION_{XDATA,PDATA,FINI,LITA,ABS}): Define. - (r_extern): Undefine. - * internal.h (struct internal_reloc): Make r_vaddr bfd_vma rather - than long. Add r_extern field. - - * alpha.h (PDR_BITS*): Define. - * sym.h (PDR): Give correct names to new fields. - - * ecoff.h: Moved MIPS reloc definitions from here... - * mips.h: to here. - -Tue Aug 3 11:17:53 1993 Ian Lance Taylor (ian@cygnus.com) - - * alpha.h: Corrected external symbolic debugging structures to - match actual usage. - * internal.h (internal_filehdr, internal_aouthdr, - internal_scnhdr): Changed type of some fields to bfd_vma so they - can hold 64 bits. - * sym.h (HDRR, FDR, PDR, EXTR): Likewise. - (PDR): Added new fields found on Alpha. - * symconst.h (magicSym2): Define; new value found on Alpha. - - * ecoff.h: New file. - * alpha.h, mips.h: Moved common information into ecoff.h. Moved - external structure definitions in from ecoff-ext.h. - * ecoff-ext.h: Removed; information now in alpha.h and mips.h. - -Sun Jul 18 21:43:59 1993 Jim Kingdon (kingdon@rtl.cygnus.com) - - * i386.h: Recognize I386PTXMAGIC. - -Fri Jul 16 09:54:35 1993 Ian Lance Taylor (ian@cygnus.com) - - * mips.h (MIPS_AOUT_{OZ}MAGIC): Renamed from {OZ}MAGIC. - -Thu Jul 15 12:23:55 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * m88k.h (union external_auxent): Move x_fcn back inside x_fcnary. - ({GET,PUT}_FCN_{LNNOPTR,ENDNDX}): Adjust accordingly. - -Sun Jul 11 18:00:18 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * m68k.h: Define MC68KBCSMAGIC. - -Thu Jun 10 11:46:28 1993 Ian Lance Taylor (ian@cygnus.com) - - * mips.h (_INIT, STYP_MIPS_INIT): Define (used on Irix4). - (STYP_OTHER_LOAD): Define as STYP_MIPS_INIT. - -Wed Jun 9 15:09:09 1993 Ian Lance Taylor (ian@cygnus.com) - - * mips.h (OMAGIC): Define. - -Mon Apr 26 18:04:47 1993 Steve Chamberlain (sac@thepub.cygnus.com) - - * internal.h, sh.h: Support for SH. - -Sat Apr 24 21:34:59 1993 Jim Kingdon (kingdon@cygnus.com) - - * a29k.h: Define _LIT. - -Fri Apr 23 18:41:23 1993 Steve Chamberlain (sac@thepub.cygnus.com) - - * alpha.h: New file. - -Thu Apr 8 12:36:34 1993 Ian Lance Taylor (ian@cygnus.com) - - * internal.h (C_SHADOW, C_VERSION): Copied in from m88k.h. - * m88k.h, i386.h, we32k.h: Don't define all the storage classes; - they're already in internal.h. - -Wed Apr 7 11:51:24 1993 Jim Kingdon (kingdon@cygnus.com) - - * internal.h: Change n_sclass to unsigned char. - Change C_EFCN to 0xff, change RS/6000 dbx symbols - to no longer be signed. - -Fri Mar 19 14:52:56 1993 Steve Chamberlain (sac@thepub.cygnus.com) - - * internal.h: Add H8/500 reloc types. - -Wed Mar 17 09:46:03 1993 Ian Lance Taylor (ian@cygnus.com) - - * ecoff-ext.h (AUX_PUT_ANY): Don't use void values in branches of - conditional expression. - -Thu Mar 4 14:12:06 1993 Ian Lance Taylor (ian@cygnus.com) - - * ecoff-ext.h (AUX_GET_*): Rewrote to use new macro AUX_GET_ANY. - (AUX_PUT_*): New macros corresponding to the AUX_GET macros. - (ecoff_swap_tir_out): Added prototype. - - * mips.h (N_BTMASK, N_TMASK, N_BTSHFT, N_TSHIFT): Define; these - are needed to interpret gcc debugging output. - -Tue Feb 9 07:43:27 1993 Ian Lance Taylor (ian@cygnus.com) - - * we32k.h (BTYPE, ISPTR, ISFCN, ISARY, DECREF): Removed - more definitions duplicated in internal.h. - -Wed Feb 3 09:18:24 1993 Ian Lance Taylor (ian@cygnus.com) - - * mips.h (RELOC_BITS3_TYPE_*): Correct for big endian machines. - -Mon Jan 25 11:35:51 1993 Ian Lance Taylor (ian@cygnus.com) - - * internal.h (internal_aouthdr): Added additional fields used only - by MIPS ECOFF. - -Thu Jan 21 10:28:38 1993 Ian Lance Taylor (ian@cygnus.com) - - * mips.h (AOUTHDR): Added additional fields used by ECOFF. - -Tue Jan 19 12:21:19 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * i386.h, we32k.h (N_*, T_*, DT_*): Removed still more definitions - duplicated in internal.h. - - * mips.h (RELOC_SECTION_*, ECOFF_R_*): Defined constants for ECOFF - relocs. - -Fri Jan 15 18:17:00 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * ecoff-ext.h: Added prototypes for new ECOFF swapping functions. - (opt_ext): New structure. - * mips.h (ZMAGIC): Defined to be 0413. - (_LIB): Defined to be ".lib" - (external_reloc): MIPS ECOFF relocs are only 8 bytes. Added - macros to aid in swapping. - -Fri Jan 8 16:19:26 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * ecoff-ext.h: Added prototypes for ECOFF swapping functions. - * internal.h (internal_scnhdr): Always provide s_align field, not - just on i960. - (internal_reloc): Always provide r_size field, not just on - RS/6000. - * mips.h (_RDATA, _SDATA, _SBSS, _LIT4, _LIT8, STYP_RDATA, - STYP_SDATA, STYP_SBSS, STYP_LIT4, STYP_LIT8): Defined. - (CODE_MASK, MIPS_IS_STAB, MIPS_MARK_STAB, MIPS_UNMARK_STAB, - STABS_SYMBOL): Moved in from gdb/mipsread.c. - -Wed Jan 6 14:01:46 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * i386.h, we32k.h: removed STYP_* defines, since they duplicated - those in internal.h. - -Tue Dec 29 15:40:07 1992 Ian Lance Taylor (ian@cygnus.com) - - * i386.h: define I386AIXMAGIC for Danbury AIX PS/2 compiler. - -Sat Dec 12 16:07:57 1992 Ian Lance Taylor (ian@cygnus.com) - - * i386.h: don't define BTYPE, ISPTR, ISFCN, ISARY, DECREF: they - are defined in internal.h. - -Thu Nov 12 09:52:01 1992 Steve Chamberlain (sac@thepub.cygnus.com) - - * internal.h: (internal_reloc): r_offset is now a long. - * z8k.h: slight comment enhancement - -Wed Sep 30 07:46:08 1992 Steve Chamberlain (sac@thepub.cygnus.com) - - * internal.h: changed z8k reloc types - -Fri Aug 28 10:16:31 1992 Brendan Kehoe (brendan@cygnus.com) - - * we32k.h: new file - -Thu Aug 27 13:00:01 1992 Brendan Kehoe (brendan@cygnus.com) - - * symconst.h: comment out cruft at the end of #endif - -Tue Aug 25 15:06:49 1992 Steve Chamberlain (sac@thepub.cygnus.com) - - * internal.h: added #define for STYP_LIT, removed from a29k and - h8300. - - * z8k.h: added z8000 support - -Thu Jul 16 16:32:00 1992 Steve Chamberlain (sac@thepub.cygnus.com) - - * internal.h: added R_RELLONG_NEG reloc type - -Fri Jun 12 20:11:04 1992 John Gilmore (gnu at cygnus.com) - - * symconst.h: Fix unterminated comment. - -Wed Jun 10 07:57:49 1992 Steve Chamberlain (sac@thepub.cygnus.com) - - * i386.h: a.out magic numbers from - mohring@informatik.tu-muenchen.de - -Mon Jun 8 20:13:33 1992 John Gilmore (gnu at cygnus.com) - - * ecoff-ext.h, mips.h: Use unsigned chars everywhere. - (Suggested by Antti Miettinen.) - -Tue Apr 14 15:18:44 1992 John Gilmore (gnu at cygnus.com) - - * sym.h: Add comments. - * symconst.h: Merge with Fred's changes. - -Tue Apr 14 14:30:05 1992 Fred Fish (fnf@cygnus.com) - - * symconst.h: Pick up SGI defines for stStruct, stUnion, stEnum, - langCplusplus, and langCplusplusV2. - -Thu Apr 2 19:47:43 1992 John Gilmore (gnu at cygnus.com) - - * sym.h, symconst.h: MIPS has provided redistributable versions - of these files. Thanks! - * ecoff-ext.h: Add weakext bit to match new sym.h. - -Fri Mar 6 00:10:46 1992 John Gilmore (gnu at cygnus.com) - - * ecoff-ext.h: Add relative file descriptors. - -Thu Feb 27 11:53:04 1992 John Gilmore (gnu at cygnus.com) - - * ecoff-ext.h: New file for external (in-file) form of ecoff - symbol structures. - -Thu Feb 6 11:33:32 1992 Steve Chamberlain (sac at rtl.cygnus.com) - - * h8300.h: made the external_lineno l_lnno field 4 bytes wide. - andded GET/PUT_LINENO_LNNO macros - -Sat Nov 30 20:38:35 1991 Steve Chamberlain (sac at rtl.cygnus.com) - - * ChangeLog, a29k.h, h8300.h, i386.h, i960.h, internal.h, m68k.h, - m88k.h, mips.h, rs6000.h: move from above coff-.h - - -Local Variables: -version-control: never -End: diff --git a/contrib/gdb/include/coff/a29k.h b/contrib/gdb/include/coff/a29k.h deleted file mode 100644 index 13b35f2..0000000 --- a/contrib/gdb/include/coff/a29k.h +++ /dev/null @@ -1,305 +0,0 @@ -/* COFF spec for AMD 290*0 - Contributed by David Wood @ New York University. - */ - -#ifndef AMD -# define AMD -#endif - -/****************************************************************/ - -/* -** File Header and related definitions -*/ - -struct external_filehdr -{ - char f_magic[2]; /* magic number */ - char f_nscns[2]; /* number of sections */ - char f_timdat[4]; /* time & date stamp */ - char f_symptr[4]; /* file pointer to symtab */ - char f_nsyms[4]; /* number of symtab entries */ - char f_opthdr[2]; /* sizeof(optional hdr) */ - char f_flags[2]; /* flags */ -}; - -#define FILHDR struct external_filehdr -#define FILHSZ sizeof (FILHDR) - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - -/* -** Magic numbers for Am29000 -** (AT&T will assign the "real" magic number) -*/ - -#define SIPFBOMAGIC 0572 /* Am29000 (Byte 0 is MSB) */ -#define SIPRBOMAGIC 0573 /* Am29000 (Byte 0 is LSB) */ - - -#define A29K_MAGIC_BIG SIPFBOMAGIC -#define A29K_MAGIC_LITTLE SIPRBOMAGIC -#define A29KBADMAG(x) (((x).f_magic!=A29K_MAGIC_BIG) && \ - ((x).f_magic!=A29K_MAGIC_LITTLE)) - -#define OMAGIC A29K_MAGIC_BIG -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - -/* -** File header flags currently known to us. -** -** Am29000 will use the F_AR32WR and F_AR32W flags to indicate -** the byte ordering in the file. -*/ - -/*--------------------------------------------------------------*/ - -/* -** Optional (a.out) header -*/ - -typedef struct external_aouthdr -{ - char magic[2]; /* type of file */ - char vstamp[2]; /* version stamp */ - char tsize[4]; /* text size in bytes, padded to FW bdry*/ - char dsize[4]; /* initialized data " " */ - char bsize[4]; /* uninitialized data " " */ - char entry[4]; /* entry pt. */ - char text_start[4]; /* base of text used for this file */ - char data_start[4]; /* base of data used for this file */ -} AOUTHDR; - -#define AOUTSZ (sizeof(AOUTHDR)) -#define AOUTHDRSZ (sizeof(AOUTHDR)) - -/* aouthdr magic numbers */ -#define NMAGIC 0410 /* separate i/d executable */ -#define SHMAGIC 0406 /* NYU/Ultra3 shared data executable - (writable text) */ - -#define _ETEXT "_etext" - -/*--------------------------------------------------------------*/ - -/* -** Section header and related definitions -*/ - -struct external_scnhdr -{ - char s_name[8]; /* section name */ - char s_paddr[4]; /* physical address, aliased s_nlib */ - char s_vaddr[4]; /* virtual address */ - char s_size[4]; /* section size */ - char s_scnptr[4]; /* file ptr to raw data for section */ - char s_relptr[4]; /* file ptr to relocation */ - char s_lnnoptr[4]; /* file ptr to line numbers */ - char s_nreloc[2]; /* number of relocation entries */ - char s_nlnno[2]; /* number of line number entries*/ - char s_flags[4]; /* flags */ -}; - -#define SCNHDR struct external_scnhdr -#define SCNHSZ sizeof (SCNHDR) - -/* - * names of "special" sections - */ -#define _TEXT ".text" -#define _DATA ".data" -#define _BSS ".bss" -#define _LIT ".lit" - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - -/* -** Section types - with additional section type for global -** registers which will be relocatable for the Am29000. -** -** In instances where it is necessary for a linker to produce an -** output file which contains text or data not based at virtual -** address 0, e.g. for a ROM, then the linker should accept -** address base information as command input and use PAD sections -** to skip over unused addresses. -*/ - -#define STYP_BSSREG 0x1200 /* Global register area (like STYP_INFO) */ -#define STYP_ENVIR 0x2200 /* Environment (like STYP_INFO) */ -#define STYP_ABS 0x4000 /* Absolute (allocated, not reloc, loaded) */ - -/*--------------------------------------------------------------*/ - -/* -** Relocation information declaration and related definitions -*/ - -struct external_reloc { - char r_vaddr[4]; /* (virtual) address of reference */ - char r_symndx[4]; /* index into symbol table */ - char r_type[2]; /* relocation type */ -}; - -#define RELOC struct external_reloc -#define RELSZ 10 /* sizeof (RELOC) */ - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - -/* -** Relocation types for the Am29000 -*/ - -#define R_ABS 0 /* reference is absolute */ - -#define R_IREL 030 /* instruction relative (jmp/call) */ -#define R_IABS 031 /* instruction absolute (jmp/call) */ -#define R_ILOHALF 032 /* instruction low half (const) */ -#define R_IHIHALF 033 /* instruction high half (consth) part 1 */ -#define R_IHCONST 034 /* instruction high half (consth) part 2 */ - /* constant offset of R_IHIHALF relocation */ -#define R_BYTE 035 /* relocatable byte value */ -#define R_HWORD 036 /* relocatable halfword value */ -#define R_WORD 037 /* relocatable word value */ - -#define R_IGLBLRC 040 /* instruction global register RC */ -#define R_IGLBLRA 041 /* instruction global register RA */ -#define R_IGLBLRB 042 /* instruction global register RB */ - -/* -NOTE: -All the "I" forms refer to 29000 instruction formats. The linker is -expected to know how the numeric information is split and/or aligned -within the instruction word(s). R_BYTE works for instructions, too. - -If the parameter to a CONSTH instruction is a relocatable type, two -relocation records are written. The first has an r_type of R_IHIHALF -(33 octal) and a normal r_vaddr and r_symndx. The second relocation -record has an r_type of R_IHCONST (34 octal), a normal r_vaddr (which -is redundant), and an r_symndx containing the 32-bit constant offset -to the relocation instead of the actual symbol table index. This -second record is always written, even if the constant offset is zero. -The constant fields of the instruction are set to zero. -*/ - -/*--------------------------------------------------------------*/ - -/* -** Line number entry declaration and related definitions -*/ - -struct external_lineno -{ - union { - char l_symndx[4]; /* function name symbol index, iff l_lnno == 0*/ - char l_paddr[4]; /* (physical) address of line number */ - } l_addr; - char l_lnno[2]; /* line number */ -}; - -#define LINENO struct external_lineno -#define LINESZ 6 /* sizeof (LINENO) */ - -/*--------------------------------------------------------------*/ - -/* -** Symbol entry declaration and related definitions -*/ - -#define E_SYMNMLEN 8 /* Number of characters in a symbol name */ - -struct external_syment -{ - union { - char e_name[E_SYMNMLEN]; - struct { - char e_zeroes[4]; - char e_offset[4]; - } e; - } e; - char e_value[4]; - char e_scnum[2]; - char e_type[2]; - char e_sclass[1]; - char e_numaux[1]; -}; - -#define SYMENT struct external_syment -#define SYMESZ sizeof(SYMENT) - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - -/* -** Storage class definitions - new classes for global registers. -*/ - -#define C_GLBLREG 19 /* global register */ -#define C_EXTREG 20 /* external global register */ -#define C_DEFREG 21 /* ext. def. of global register */ - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - -/* -** Derived symbol mask/shifts. -*/ - -#define N_BTMASK (0xf) -#define N_BTSHFT (4) -#define N_TMASK (0x30) -#define N_TSHIFT (2) - -/*--------------------------------------------------------------*/ - -/* -** Auxiliary symbol table entry declaration and related -** definitions. -*/ - -#define E_FILNMLEN 14 /* # characters in a file name */ -#define E_DIMNUM 4 /* # array dimensions in auxiliary entry */ - -union external_auxent { - struct { - char x_tagndx[4]; /* str, un, or enum tag indx */ - union { - struct { - char x_lnno[2]; /* declaration line number */ - char x_size[2]; /* str/union/array size */ - } x_lnsz; - char x_fsize[4]; /* size of function */ - } x_misc; - union { - struct { /* if ISFCN, tag, or .bb */ - char x_lnnoptr[4]; /* ptr to fcn line # */ - char x_endndx[4]; /* entry ndx past block end */ - } x_fcn; - struct { /* if ISARY, up to 4 dimen. */ - char x_dimen[E_DIMNUM][2]; - } x_ary; - } x_fcnary; - char x_tvndx[2]; /* tv index */ - } x_sym; - - union { - char x_fname[E_FILNMLEN]; - struct { - char x_zeroes[4]; - char x_offset[4]; - } x_n; - } x_file; - - struct { - char x_scnlen[4]; /* section length */ - char x_nreloc[2]; /* # relocation entries */ - char x_nlinno[2]; /* # line numbers */ - } x_scn; - - struct { - char x_tvfill[4]; /* tv fill value */ - char x_tvlen[2]; /* length of .tv */ - char x_tvran[2][2]; /* tv range */ - } x_tv; /* info about .tv section (in auxent of symbol .tv)) */ -}; - -#define AUXENT union external_auxent -#define AUXESZ 18 diff --git a/contrib/gdb/include/coff/alpha.h b/contrib/gdb/include/coff/alpha.h deleted file mode 100644 index 1f1bfb6..0000000 --- a/contrib/gdb/include/coff/alpha.h +++ /dev/null @@ -1,342 +0,0 @@ -/* ECOFF support on Alpha machines. - coff/ecoff.h must be included before this file. */ - -/********************** FILE HEADER **********************/ - -struct external_filehdr { - unsigned char f_magic[2]; /* magic number */ - unsigned char f_nscns[2]; /* number of sections */ - unsigned char f_timdat[4]; /* time & date stamp */ - unsigned char f_symptr[8]; /* file pointer to symtab */ - unsigned char f_nsyms[4]; /* number of symtab entries */ - unsigned char f_opthdr[2]; /* sizeof(optional hdr) */ - unsigned char f_flags[2]; /* flags */ -}; - -/* Magic numbers are defined in coff/ecoff.h. */ -#define ALPHA_ECOFF_BADMAG(x) ((x).f_magic!=ALPHA_MAGIC) - -/* The object type is encoded in the f_flags. */ -#define F_ALPHA_OBJECT_TYPE_MASK 0x3000 -#define F_ALPHA_NO_SHARED 0x1000 -#define F_ALPHA_SHARABLE 0x2000 -#define F_ALPHA_CALL_SHARED 0x3000 - -#define FILHDR struct external_filehdr -#define FILHSZ sizeof(FILHDR) - -/********************** AOUT "OPTIONAL HEADER" **********************/ - - -typedef struct external_aouthdr -{ - unsigned char magic[2]; /* type of file */ - unsigned char vstamp[2]; /* version stamp */ - unsigned char bldrev[2]; /* ?? */ - unsigned char padding[2]; /* pad to quadword boundary */ - unsigned char tsize[8]; /* text size in bytes */ - unsigned char dsize[8]; /* initialized data " " */ - unsigned char bsize[8]; /* uninitialized data " " */ - unsigned char entry[8]; /* entry pt. */ - unsigned char text_start[8]; /* base of text used for this file */ - unsigned char data_start[8]; /* base of data used for this file */ - unsigned char bss_start[8]; /* base of bss used for this file */ - unsigned char gprmask[4]; /* bitmask of general registers used */ - unsigned char fprmask[4]; /* bitmask of floating point registers used */ - unsigned char gp_value[8]; /* value for gp register */ -} AOUTHDR; - -/* compute size of a header */ - -#define AOUTSZ (sizeof(AOUTHDR)) - -/********************** SECTION HEADER **********************/ - -struct external_scnhdr { - unsigned char s_name[8]; /* section name */ - unsigned char s_paddr[8]; /* physical address, aliased s_nlib */ - unsigned char s_vaddr[8]; /* virtual address */ - unsigned char s_size[8]; /* section size */ - unsigned char s_scnptr[8]; /* file ptr to raw data for section */ - unsigned char s_relptr[8]; /* file ptr to relocation */ - unsigned char s_lnnoptr[8]; /* file ptr to line numbers */ - unsigned char s_nreloc[2]; /* number of relocation entries */ - unsigned char s_nlnno[2]; /* number of line number entries*/ - unsigned char s_flags[4]; /* flags */ -}; - -#define SCNHDR struct external_scnhdr -#define SCNHSZ sizeof(SCNHDR) - -/********************** RELOCATION DIRECTIVES **********************/ - -struct external_reloc { - unsigned char r_vaddr[8]; - unsigned char r_symndx[4]; - unsigned char r_bits[4]; -}; - -#define RELOC struct external_reloc -#define RELSZ 16 - -/* Constants to unpack the r_bits field. The Alpha seems to always be - little endian, so I haven't bothered to define big endian variants - of these. */ - -#define RELOC_BITS0_TYPE_LITTLE 0xff -#define RELOC_BITS0_TYPE_SH_LITTLE 0 - -#define RELOC_BITS1_EXTERN_LITTLE 0x01 - -#define RELOC_BITS1_OFFSET_LITTLE 0x7e -#define RELOC_BITS1_OFFSET_SH_LITTLE 1 - -#define RELOC_BITS1_RESERVED_LITTLE 0x80 -#define RELOC_BITS1_RESERVED_SH_LITTLE 7 -#define RELOC_BITS2_RESERVED_LITTLE 0xff -#define RELOC_BITS2_RESERVED_SH_LEFT_LITTLE 1 -#define RELOC_BITS3_RESERVED_LITTLE 0x03 -#define RELOC_BITS3_RESERVED_SH_LEFT_LITTLE 9 - -#define RELOC_BITS3_SIZE_LITTLE 0xfc -#define RELOC_BITS3_SIZE_SH_LITTLE 2 - -/* The r_type field in a reloc is one of the following values. */ -#define ALPHA_R_IGNORE 0 -#define ALPHA_R_REFLONG 1 -#define ALPHA_R_REFQUAD 2 -#define ALPHA_R_GPREL32 3 -#define ALPHA_R_LITERAL 4 -#define ALPHA_R_LITUSE 5 -#define ALPHA_R_GPDISP 6 -#define ALPHA_R_BRADDR 7 -#define ALPHA_R_HINT 8 -#define ALPHA_R_SREL16 9 -#define ALPHA_R_SREL32 10 -#define ALPHA_R_SREL64 11 -#define ALPHA_R_OP_PUSH 12 -#define ALPHA_R_OP_STORE 13 -#define ALPHA_R_OP_PSUB 14 -#define ALPHA_R_OP_PRSHIFT 15 -#define ALPHA_R_GPVALUE 16 - -/********************** SYMBOLIC INFORMATION **********************/ - -/* Written by John Gilmore. */ - -/* ECOFF uses COFF-like section structures, but its own symbol format. - This file defines the symbol format in fields whose size and alignment - will not vary on different host systems. */ - -/* File header as a set of bytes */ - -struct hdr_ext { - unsigned char h_magic[2]; - unsigned char h_vstamp[2]; - unsigned char h_ilineMax[4]; - unsigned char h_idnMax[4]; - unsigned char h_ipdMax[4]; - unsigned char h_isymMax[4]; - unsigned char h_ioptMax[4]; - unsigned char h_iauxMax[4]; - unsigned char h_issMax[4]; - unsigned char h_issExtMax[4]; - unsigned char h_ifdMax[4]; - unsigned char h_crfd[4]; - unsigned char h_iextMax[4]; - unsigned char h_cbLine[8]; - unsigned char h_cbLineOffset[8]; - unsigned char h_cbDnOffset[8]; - unsigned char h_cbPdOffset[8]; - unsigned char h_cbSymOffset[8]; - unsigned char h_cbOptOffset[8]; - unsigned char h_cbAuxOffset[8]; - unsigned char h_cbSsOffset[8]; - unsigned char h_cbSsExtOffset[8]; - unsigned char h_cbFdOffset[8]; - unsigned char h_cbRfdOffset[8]; - unsigned char h_cbExtOffset[8]; -}; - -/* File descriptor external record */ - -struct fdr_ext { - unsigned char f_adr[8]; - unsigned char f_cbLineOffset[8]; - unsigned char f_cbLine[8]; - unsigned char f_cbSs[8]; - unsigned char f_rss[4]; - unsigned char f_issBase[4]; - unsigned char f_isymBase[4]; - unsigned char f_csym[4]; - unsigned char f_ilineBase[4]; - unsigned char f_cline[4]; - unsigned char f_ioptBase[4]; - unsigned char f_copt[4]; - unsigned char f_ipdFirst[4]; - unsigned char f_cpd[4]; - unsigned char f_iauxBase[4]; - unsigned char f_caux[4]; - unsigned char f_rfdBase[4]; - unsigned char f_crfd[4]; - unsigned char f_bits1[1]; - unsigned char f_bits2[3]; - unsigned char f_padding[4]; -}; - -#define FDR_BITS1_LANG_BIG 0xF8 -#define FDR_BITS1_LANG_SH_BIG 3 -#define FDR_BITS1_LANG_LITTLE 0x1F -#define FDR_BITS1_LANG_SH_LITTLE 0 - -#define FDR_BITS1_FMERGE_BIG 0x04 -#define FDR_BITS1_FMERGE_LITTLE 0x20 - -#define FDR_BITS1_FREADIN_BIG 0x02 -#define FDR_BITS1_FREADIN_LITTLE 0x40 - -#define FDR_BITS1_FBIGENDIAN_BIG 0x01 -#define FDR_BITS1_FBIGENDIAN_LITTLE 0x80 - -#define FDR_BITS2_GLEVEL_BIG 0xC0 -#define FDR_BITS2_GLEVEL_SH_BIG 6 -#define FDR_BITS2_GLEVEL_LITTLE 0x03 -#define FDR_BITS2_GLEVEL_SH_LITTLE 0 - -/* We ignore the `reserved' field in bits2. */ - -/* Procedure descriptor external record */ - -struct pdr_ext { - unsigned char p_adr[8]; - unsigned char p_cbLineOffset[8]; - unsigned char p_isym[4]; - unsigned char p_iline[4]; - unsigned char p_regmask[4]; - unsigned char p_regoffset[4]; - unsigned char p_iopt[4]; - unsigned char p_fregmask[4]; - unsigned char p_fregoffset[4]; - unsigned char p_frameoffset[4]; - unsigned char p_lnLow[4]; - unsigned char p_lnHigh[4]; - unsigned char p_gp_prologue[1]; - unsigned char p_bits1[1]; - unsigned char p_bits2[1]; - unsigned char p_localoff[1]; - unsigned char p_framereg[2]; - unsigned char p_pcreg[2]; -}; - -#define PDR_BITS1_GP_USED_BIG 0x80 -#define PDR_BITS1_REG_FRAME_BIG 0x40 -#define PDR_BITS1_PROF_BIG 0x20 -#define PDR_BITS1_RESERVED_BIG 0x1f -#define PDR_BITS1_RESERVED_SH_LEFT_BIG 8 -#define PDR_BITS2_RESERVED_BIG 0xff -#define PDR_BITS2_RESERVED_SH_BIG 0 - -#define PDR_BITS1_GP_USED_LITTLE 0x01 -#define PDR_BITS1_REG_FRAME_LITTLE 0x02 -#define PDR_BITS1_PROF_LITTLE 0x04 -#define PDR_BITS1_RESERVED_LITTLE 0xf8 -#define PDR_BITS1_RESERVED_SH_LITTLE 3 -#define PDR_BITS2_RESERVED_LITTLE 0xff -#define PDR_BITS2_RESERVED_SH_LEFT_LITTLE 5 - -/* Line numbers */ - -struct line_ext { - unsigned char l_line[4]; -}; - -/* Symbol external record */ - -struct sym_ext { - unsigned char s_value[8]; - unsigned char s_iss[4]; - unsigned char s_bits1[1]; - unsigned char s_bits2[1]; - unsigned char s_bits3[1]; - unsigned char s_bits4[1]; -}; - -#define SYM_BITS1_ST_BIG 0xFC -#define SYM_BITS1_ST_SH_BIG 2 -#define SYM_BITS1_ST_LITTLE 0x3F -#define SYM_BITS1_ST_SH_LITTLE 0 - -#define SYM_BITS1_SC_BIG 0x03 -#define SYM_BITS1_SC_SH_LEFT_BIG 3 -#define SYM_BITS1_SC_LITTLE 0xC0 -#define SYM_BITS1_SC_SH_LITTLE 6 - -#define SYM_BITS2_SC_BIG 0xE0 -#define SYM_BITS2_SC_SH_BIG 5 -#define SYM_BITS2_SC_LITTLE 0x07 -#define SYM_BITS2_SC_SH_LEFT_LITTLE 2 - -#define SYM_BITS2_RESERVED_BIG 0x10 -#define SYM_BITS2_RESERVED_LITTLE 0x08 - -#define SYM_BITS2_INDEX_BIG 0x0F -#define SYM_BITS2_INDEX_SH_LEFT_BIG 16 -#define SYM_BITS2_INDEX_LITTLE 0xF0 -#define SYM_BITS2_INDEX_SH_LITTLE 4 - -#define SYM_BITS3_INDEX_SH_LEFT_BIG 8 -#define SYM_BITS3_INDEX_SH_LEFT_LITTLE 4 - -#define SYM_BITS4_INDEX_SH_LEFT_BIG 0 -#define SYM_BITS4_INDEX_SH_LEFT_LITTLE 12 - -/* External symbol external record */ - -struct ext_ext { - struct sym_ext es_asym; - unsigned char es_bits1[1]; - unsigned char es_bits2[3]; - unsigned char es_ifd[4]; -}; - -#define EXT_BITS1_JMPTBL_BIG 0x80 -#define EXT_BITS1_JMPTBL_LITTLE 0x01 - -#define EXT_BITS1_COBOL_MAIN_BIG 0x40 -#define EXT_BITS1_COBOL_MAIN_LITTLE 0x02 - -#define EXT_BITS1_WEAKEXT_BIG 0x20 -#define EXT_BITS1_WEAKEXT_LITTLE 0x04 - -/* Dense numbers external record */ - -struct dnr_ext { - unsigned char d_rfd[4]; - unsigned char d_index[4]; -}; - -/* Relative file descriptor */ - -struct rfd_ext { - unsigned char rfd[4]; -}; - -/* Optimizer symbol external record */ - -struct opt_ext { - unsigned char o_bits1[1]; - unsigned char o_bits2[1]; - unsigned char o_bits3[1]; - unsigned char o_bits4[1]; - struct rndx_ext o_rndx; - unsigned char o_offset[4]; -}; - -#define OPT_BITS2_VALUE_SH_LEFT_BIG 16 -#define OPT_BITS2_VALUE_SH_LEFT_LITTLE 0 - -#define OPT_BITS3_VALUE_SH_LEFT_BIG 8 -#define OPT_BITS3_VALUE_SH_LEFT_LITTLE 8 - -#define OPT_BITS4_VALUE_SH_LEFT_BIG 0 -#define OPT_BITS4_VALUE_SH_LEFT_LITTLE 16 diff --git a/contrib/gdb/include/coff/apollo.h b/contrib/gdb/include/coff/apollo.h deleted file mode 100644 index c481d48..0000000 --- a/contrib/gdb/include/coff/apollo.h +++ /dev/null @@ -1,248 +0,0 @@ -/*** coff information for Apollo M68K */ - -/********************** FILE HEADER **********************/ - -struct external_filehdr { - char f_magic[2]; /* magic number */ - char f_nscns[2]; /* number of sections */ - char f_timdat[4]; /* time & date stamp */ - char f_symptr[4]; /* file pointer to symtab */ - char f_nsyms[4]; /* number of symtab entries */ - char f_opthdr[2]; /* sizeof(optional hdr) */ - char f_flags[2]; /* flags */ -}; - - -/* Motorola 68000/68008/68010/68020 */ -#define MC68MAGIC 0520 -#define MC68KWRMAGIC 0520 /* writeable text segments */ -#define MC68TVMAGIC 0521 -#define MC68KROMAGIC 0521 /* readonly shareable text segments */ -#define MC68KPGMAGIC 0522 /* demand paged text segments */ -#define M68MAGIC 0210 -#define M68TVMAGIC 0211 - -/* Apollo 68000-based machines have a different magic number. This comes - * from /usr/include/apollo/filehdr.h - */ -#define APOLLOM68KMAGIC 0627 - -#define OMAGIC M68MAGIC -#define M68KBADMAG(x) (((x).f_magic!=MC68MAGIC) && ((x).f_magic!=MC68KWRMAGIC) && ((x).f_magic!=MC68TVMAGIC) && \ - ((x).f_magic!=MC68KROMAGIC) && ((x).f_magic!=MC68KPGMAGIC) && ((x).f_magic!=M68MAGIC) && ((x).f_magic!=M68TVMAGIC) && \ - ((x).f_magic!=APOLLOM68KMAGIC) ) - - -#define FILHDR struct external_filehdr -#define FILHSZ sizeof(FILHDR) - - -/********************** AOUT "OPTIONAL HEADER" **********************/ - -typedef struct -{ - char magic[2]; /* type of file */ - char vstamp[2]; /* version stamp */ - char tsize[4]; /* text size in bytes, padded to FW bdry*/ - char dsize[4]; /* initialized data " " */ - char bsize[4]; /* uninitialized data " " */ - char entry[4]; /* entry pt. */ - char text_start[4]; /* base of text used for this file */ - char data_start[4]; /* base of data used for this file */ - char o_sri[4]; /* Apollo specific - .sri data pointer */ - char o_inlib[4]; /* Apollo specific - .inlib data pointer */ - char vid[8]; /* Apollo specific - 64 bit version ID */ -} -AOUTHDR; - -#define APOLLO_COFF_VERSION_NUMBER 1 /* the value of the aouthdr magic */ -#define AOUTHDRSZ (sizeof(AOUTHDR)) -#define AOUTSZ (sizeof(AOUTHDR)) - - - -/********************** SECTION HEADER **********************/ - -struct external_scnhdr { - /* Apollo allow for larger section names by allowing it to be in - * the string table. - */ - char s_name[8]; - char s_paddr[4]; /* physical address, aliased s_nlib */ - char s_vaddr[4]; /* virtual address */ - char s_size[4]; /* section size */ - char s_scnptr[4]; /* file ptr to raw data for section */ - char s_relptr[4]; /* file ptr to relocation */ - char s_lnnoptr[4]; /* file ptr to line numbers */ - char s_nreloc[2]; /* number of relocation entries */ - char s_nlnno[2]; /* number of line number entries*/ - char s_flags[4]; /* flags */ -}; - -/* If s_zeores is all zeroes, s_offset gives the real location of the name - * in the string table. - */ - -#define s_zeroes section_name.s_name -#define s_offset (section_name.s_name+4) - -/* - * names of "special" sections - */ -#define _TEXT ".text" -#define _DATA ".data" -#define _BSS ".bss" -#define _TV ".tv" -#define _INIT ".init" -#define _FINI ".fini" -#define _LINES ".lines" -#define _BLOCKS ".blocks" -#define _SRI ".sri" /* Static Resource Information (systype, - et al.) */ -#define _MIR ".mir" /* Module Information Records */ -#define _APTV ".aptv" /* Apollo-style transfer vectors. */ -#define _INLIB ".inlib" /* Shared Library information */ -#define _RWDI ".rwdi" /* Read/write data initialization directives for - compressed sections */ -#define _UNWIND ".unwind" /* Stack unwind information */ - -#define SCNHDR struct external_scnhdr -#define SCNHSZ sizeof(SCNHDR) - - -/********************** LINE NUMBERS **********************/ - -/* 1 line number entry for every "breakpointable" source line in a section. - * Line numbers are grouped on a per function basis; first entry in a function - * grouping will have l_lnno = 0 and in place of physical address will be the - * symbol table index of the function name. - */ -struct external_lineno { - union { - char l_symndx[4]; /* function name symbol index, iff l_lnno == 0*/ - char l_paddr[4]; /* (physical) address of line number */ - } l_addr; - char l_lnno[2]; /* line number */ -}; - - -#define LINENO struct external_lineno -#define LINESZ sizeof(LINENO) - - -/********************** SYMBOLS **********************/ - -#define E_SYMNMLEN 8 /* # characters in a symbol name */ -#define E_FILNMLEN 14 /* # characters in a file name */ -#define E_DIMNUM 4 /* # array dimensions in auxiliary entry */ - -struct external_syment -{ - union { - char e_name[E_SYMNMLEN]; - struct { - char e_zeroes[4]; - char e_offset[4]; - } e; - } e; - char e_value[4]; - char e_scnum[2]; - char e_type[2]; - char e_sclass[1]; - char e_numaux[1]; -}; - - - -#define N_BTMASK (017) -#define N_TMASK (060) -#define N_BTSHFT (4) -#define N_TSHIFT (2) - - -union external_auxent { - struct { - char x_tagndx[4]; /* str, un, or enum tag indx */ - union { - struct { - char x_lnno[2]; /* declaration line number */ - char x_size[2]; /* str/union/array size */ - } x_lnsz; - char x_fsize[4]; /* size of function */ - } x_misc; - union { - struct { /* if ISFCN, tag, or .bb */ - char x_lnnoptr[4]; /* ptr to fcn line # */ - char x_endndx[4]; /* entry ndx past block end */ - } x_fcn; - struct { /* if ISARY, up to 4 dimen. */ - char x_dimen[E_DIMNUM][2]; - } x_ary; - } x_fcnary; - char x_tvndx[2]; /* tv index */ - } x_sym; - - union { - char x_fname[E_FILNMLEN]; - struct { - char x_zeroes[4]; - char x_offset[4]; - } x_n; - } x_file; - - struct { - char x_scnlen[4]; /* section length */ - char x_nreloc[2]; /* # relocation entries */ - char x_nlinno[2]; /* # line numbers */ - } x_scn; - - struct { - char x_tvfill[4]; /* tv fill value */ - char x_tvlen[2]; /* length of .tv */ - char x_tvran[2][2]; /* tv range */ - } x_tv; /* info about .tv section (in auxent of symbol .tv)) */ - - -}; - -#define SYMENT struct external_syment -#define SYMESZ 18 -#define AUXENT union external_auxent -#define AUXESZ 18 - - - -/********************** RELOCATION DIRECTIVES **********************/ - - -struct external_reloc { - char r_vaddr[4]; - char r_symndx[4]; - char r_type[2]; -#ifdef M68K_COFF_OFFSET - char r_offset[4]; -#endif - -}; - - -#define RELOC struct external_reloc - -#define RELSZ sizeof(struct external_reloc) - -/* Apollo specific STYP flags */ - -#define STYP_RELOCATED_NOT_LOADED 0x00010000 /* Section is relocated normally during linking, but need - not be loaded during program execution */ -#define STYP_DEBUG 0x00020000 /* debug section */ -#define STYP_OVERLAY 0x00040000 /* Section is overlayed */ -#define STYP_INSTRUCTION 0x00200000 /* Section contains executable code */ - -#define STYP_ZERO 0x00800000 /* Section is initialized to zero */ -#define STYP_INSTALLED 0x02000000 /* Section should be installable in KGT */ -#define STYP_LOOK_INSTALLED 0x04000000 /* Look for section in KGT */ -#define STYP_SECALIGN1 0x08000000 /* Specially aligned section */ -#define STYP_SECALIGN2 0x10000000 /* " " " */ -#define STYP_COMPRESSED 0x20000000 /* No section data per se (s_scnptr = 0), but there are - initialization directives for it in .rwdi section - (used in conjunction with STYP_BSS) */ diff --git a/contrib/gdb/include/coff/arm.h b/contrib/gdb/include/coff/arm.h deleted file mode 100644 index 33b11cb..0000000 --- a/contrib/gdb/include/coff/arm.h +++ /dev/null @@ -1,215 +0,0 @@ -/*** coff information for the ARM */ - - -/********************** FILE HEADER **********************/ - -struct external_filehdr { - char f_magic[2]; /* magic number */ - char f_nscns[2]; /* number of sections */ - char f_timdat[4]; /* time & date stamp */ - char f_symptr[4]; /* file pointer to symtab */ - char f_nsyms[4]; /* number of symtab entries */ - char f_opthdr[2]; /* sizeof(optional hdr) */ - char f_flags[2]; /* flags */ -}; - -/* Bits for f_flags: - * F_RELFLG relocation info stripped from file - * F_EXEC file is executable (no unresolved external references) - * F_LNNO line numbers stripped from file - * F_LSYMS local symbols stripped from file - * F_AR32WR file has byte ordering of an AR32WR machine (e.g. vax) - */ - -#define F_RELFLG (0x0001) -#define F_EXEC (0x0002) -#define F_LNNO (0x0004) -#define F_LSYMS (0x0008) - - - -#define ARMMAGIC 0xa00 /* I just made these up */ - -#define ARMBADMAG(x) (((x).f_magic != ARMMAGIC)) - -#define FILHDR struct external_filehdr -#define FILHSZ sizeof(FILHDR) - - -/********************** AOUT "OPTIONAL HEADER" **********************/ - - -typedef struct -{ - char magic[2]; /* type of file */ - char vstamp[2]; /* version stamp */ - char tsize[4]; /* text size in bytes, padded to FW bdry*/ - char dsize[4]; /* initialized data " " */ - char bsize[4]; /* uninitialized data " " */ - char entry[4]; /* entry pt. */ - char text_start[4]; /* base of text used for this file */ - char data_start[4]; /* base of data used for this file */ - - -} -AOUTHDR; - - -#define AOUTSZ (sizeof(AOUTHDR)) - -#define OMAGIC 0404 /* object files, eg as output */ -#define ZMAGIC 0413 /* demand load format, eg normal ld output */ -#define STMAGIC 0401 /* target shlib */ -#define SHMAGIC 0443 /* host shlib */ - - -/* define some NT default values */ -/* #define NT_IMAGE_BASE 0x400000 moved to internal.h */ -#define NT_SECTION_ALIGNMENT 0x1000 -#define NT_FILE_ALIGNMENT 0x200 -#define NT_DEF_RESERVE 0x100000 -#define NT_DEF_COMMIT 0x1000 - -/********************** SECTION HEADER **********************/ - - -struct external_scnhdr { - char s_name[8]; /* section name */ - char s_paddr[4]; /* physical address, aliased s_nlib */ - char s_vaddr[4]; /* virtual address */ - char s_size[4]; /* section size */ - char s_scnptr[4]; /* file ptr to raw data for section */ - char s_relptr[4]; /* file ptr to relocation */ - char s_lnnoptr[4]; /* file ptr to line numbers */ - char s_nreloc[2]; /* number of relocation entries */ - char s_nlnno[2]; /* number of line number entries*/ - char s_flags[4]; /* flags */ -}; - -#define SCNHDR struct external_scnhdr -#define SCNHSZ sizeof(SCNHDR) - -/* - * names of "special" sections - */ -#define _TEXT ".text" -#define _DATA ".data" -#define _BSS ".bss" -#define _COMMENT ".comment" -#define _LIB ".lib" - -/********************** LINE NUMBERS **********************/ - -/* 1 line number entry for every "breakpointable" source line in a section. - * Line numbers are grouped on a per function basis; first entry in a function - * grouping will have l_lnno = 0 and in place of physical address will be the - * symbol table index of the function name. - */ -struct external_lineno { - union { - char l_symndx[4]; /* function name symbol index, iff l_lnno == 0*/ - char l_paddr[4]; /* (physical) address of line number */ - } l_addr; - char l_lnno[2]; /* line number */ -}; - - -#define LINENO struct external_lineno -#define LINESZ 6 - - -/********************** SYMBOLS **********************/ - -#define E_SYMNMLEN 8 /* # characters in a symbol name */ -#define E_FILNMLEN 14 /* # characters in a file name */ -#define E_DIMNUM 4 /* # array dimensions in auxiliary entry */ - -struct external_syment -{ - union { - char e_name[E_SYMNMLEN]; - struct { - char e_zeroes[4]; - char e_offset[4]; - } e; - } e; - char e_value[4]; - char e_scnum[2]; - char e_type[2]; - char e_sclass[1]; - char e_numaux[1]; -}; - -#define N_BTMASK (0xf) -#define N_TMASK (0x30) -#define N_BTSHFT (4) -#define N_TSHIFT (2) - -union external_auxent { - struct { - char x_tagndx[4]; /* str, un, or enum tag indx */ - union { - struct { - char x_lnno[2]; /* declaration line number */ - char x_size[2]; /* str/union/array size */ - } x_lnsz; - char x_fsize[4]; /* size of function */ - } x_misc; - union { - struct { /* if ISFCN, tag, or .bb */ - char x_lnnoptr[4]; /* ptr to fcn line # */ - char x_endndx[4]; /* entry ndx past block end */ - } x_fcn; - struct { /* if ISARY, up to 4 dimen. */ - char x_dimen[E_DIMNUM][2]; - } x_ary; - } x_fcnary; - char x_tvndx[2]; /* tv index */ - } x_sym; - - union { - char x_fname[E_FILNMLEN]; - struct { - char x_zeroes[4]; - char x_offset[4]; - } x_n; - } x_file; - - struct { - char x_scnlen[4]; /* section length */ - char x_nreloc[2]; /* # relocation entries */ - char x_nlinno[2]; /* # line numbers */ - } x_scn; - - struct { - char x_tvfill[4]; /* tv fill value */ - char x_tvlen[2]; /* length of .tv */ - char x_tvran[2][2]; /* tv range */ - } x_tv; /* info about .tv section (in auxent of symbol .tv)) */ - - -}; - -#define SYMENT struct external_syment -#define SYMESZ 18 -#define AUXENT union external_auxent -#define AUXESZ 18 - - -# define _ETEXT "etext" - - -/********************** RELOCATION DIRECTIVES **********************/ - - - -struct external_reloc { - char r_vaddr[4]; - char r_symndx[4]; - char r_type[2]; - char r_offset[4]; -}; - - -#define RELOC struct external_reloc -#define RELSZ sizeof (RELOC) diff --git a/contrib/gdb/include/coff/aux-coff.h b/contrib/gdb/include/coff/aux-coff.h deleted file mode 100644 index c89c124..0000000 --- a/contrib/gdb/include/coff/aux-coff.h +++ /dev/null @@ -1,31 +0,0 @@ -/* Modifications of internal.h and m68k.h needed by A/UX - Suggested by Ian Lance Taylor */ - -#ifndef GNU_COFF_AUX_H -#define GNU_COFF_AUX_H 1 - -#include "coff/internal.h" -#include "coff/m68k.h" - -/* Section contains 64-byte padded pathnames of shared libraries */ -#undef STYP_LIB -#define STYP_LIB 0x200 - -/* Section contains shared library initialization code */ -#undef STYP_INIT -#define STYP_INIT 0x400 - -/* Section contains .ident information */ -#undef STYP_IDENT -#define STYP_IDENT 0x800 - -/* Section types used by bfd and gas not defined (directly) by A/UX */ -#undef STYP_OVER -#define STYP_OVER 0 -#undef STYP_INFO -#define STYP_INFO STYP_IDENT - -/* Traditional name of the section tagged with STYP_LIB */ -#define _LIB ".lib" - -#endif /* GNU_COFF_AUX_H */ diff --git a/contrib/gdb/include/coff/ecoff.h b/contrib/gdb/include/coff/ecoff.h deleted file mode 100644 index 120f888..0000000 --- a/contrib/gdb/include/coff/ecoff.h +++ /dev/null @@ -1,408 +0,0 @@ -#ifndef ECOFF_H -#define ECOFF_H - -/* Generic ECOFF support. - This does not include symbol information, found in sym.h and - symconst.h. */ - -/* Mips magic numbers used in filehdr. MIPS_MAGIC_LITTLE is used on - little endian machines. MIPS_MAGIC_BIG is used on big endian - machines. Where is MIPS_MAGIC_1 from? */ -#define MIPS_MAGIC_1 0x0180 -#define MIPS_MAGIC_LITTLE 0x0162 -#define MIPS_MAGIC_BIG 0x0160 - -/* These are the magic numbers used for MIPS code compiled at ISA - level 2. */ -#define MIPS_MAGIC_LITTLE2 0x0166 -#define MIPS_MAGIC_BIG2 0x0163 - -/* These are the magic numbers used for MIPS code compiled at ISA - level 3. */ -#define MIPS_MAGIC_LITTLE3 0x142 -#define MIPS_MAGIC_BIG3 0x140 - -/* Alpha magic numbers used in filehdr. */ -#define ALPHA_MAGIC 0x183 - -/* Magic numbers used in a.out header. */ -#define ECOFF_AOUT_OMAGIC 0407 /* not demand paged (ld -N). */ -#define ECOFF_AOUT_ZMAGIC 0413 /* demand load format, eg normal ld output */ - -/* Names of special sections. */ -#define _TEXT ".text" -#define _DATA ".data" -#define _BSS ".bss" -#define _RDATA ".rdata" -#define _SDATA ".sdata" -#define _SBSS ".sbss" -#define _LITA ".lita" -#define _LIT4 ".lit4" -#define _LIT8 ".lit8" -#define _LIB ".lib" -#define _INIT ".init" -#define _FINI ".fini" -#define _PDATA ".pdata" -#define _XDATA ".xdata" -#define _GOT ".got" -#define _HASH ".hash" -#define _DYNSYM ".dynsym" -#define _DYNSTR ".dynstr" -#define _RELDYN ".rel.dyn" -#define _CONFLIC ".conflic" -#define _COMMENT ".comment" -#define _LIBLIST ".liblist" -#define _DYNAMIC ".dynamic" -#define _RCONST ".rconst" - -/* ECOFF uses some additional section flags. */ -#define STYP_RDATA 0x100 -#define STYP_SDATA 0x200 -#define STYP_SBSS 0x400 -#define STYP_GOT 0x1000 -#define STYP_DYNAMIC 0x2000 -#define STYP_DYNSYM 0x4000 -#define STYP_RELDYN 0x8000 -#define STYP_DYNSTR 0x10000 -#define STYP_HASH 0x20000 -#define STYP_LIBLIST 0x40000 -#define STYP_CONFLIC 0x100000 -#define STYP_ECOFF_FINI 0x1000000 -#define STYP_EXTENDESC 0x2000000 /* 0x02FFF000 bits => scn type, rest clr */ -#define STYP_LITA 0x4000000 -#define STYP_LIT8 0x8000000 -#define STYP_LIT4 0x10000000 -#define STYP_ECOFF_LIB 0x40000000 -#define STYP_ECOFF_INIT 0x80000000 -#define STYP_OTHER_LOAD (STYP_ECOFF_INIT | STYP_ECOFF_FINI) - -/* extended section types */ -#define STYP_COMMENT 0x2100000 -#define STYP_RCONST 0x2200000 -#define STYP_XDATA 0x2400000 -#define STYP_PDATA 0x2800000 - -/* The linker needs a section to hold small common variables while - linking. There is no convenient way to create it when the linker - needs it, so we always create one for each BFD. We then avoid - writing it out. */ -#define SCOMMON ".scommon" - -/* If the extern bit in a reloc is 1, then r_symndx is an index into - the external symbol table. If the extern bit is 0, then r_symndx - indicates a section, and is one of the following values. */ -#define RELOC_SECTION_NONE 0 -#define RELOC_SECTION_TEXT 1 -#define RELOC_SECTION_RDATA 2 -#define RELOC_SECTION_DATA 3 -#define RELOC_SECTION_SDATA 4 -#define RELOC_SECTION_SBSS 5 -#define RELOC_SECTION_BSS 6 -#define RELOC_SECTION_INIT 7 -#define RELOC_SECTION_LIT8 8 -#define RELOC_SECTION_LIT4 9 -#define RELOC_SECTION_XDATA 10 -#define RELOC_SECTION_PDATA 11 -#define RELOC_SECTION_FINI 12 -#define RELOC_SECTION_LITA 13 -#define RELOC_SECTION_ABS 14 -#define RELOC_SECTION_RCONST 15 - -#define NUM_RELOC_SECTIONS 16 - -/********************** STABS **********************/ - -/* gcc uses mips-tfile to output type information in special stabs - entries. These must match the corresponding definition in - gcc/config/mips.h. At some point, these should probably go into a - shared include file, but currently gcc and gdb do not share any - directories. */ -#define CODE_MASK 0x8F300 -#define ECOFF_IS_STAB(sym) (((sym)->index & 0xFFF00) == CODE_MASK) -#define ECOFF_MARK_STAB(code) ((code)+CODE_MASK) -#define ECOFF_UNMARK_STAB(code) ((code)-CODE_MASK) -#define STABS_SYMBOL "@stabs" - -/********************** COFF **********************/ - -/* gcc also uses mips-tfile to output COFF debugging information. - These are the values it uses when outputting the .type directive. - These should also be in a shared include file. */ -#define N_BTMASK (017) -#define N_TMASK (060) -#define N_BTSHFT (4) -#define N_TSHIFT (2) - -/********************** AUX **********************/ - -/* The auxiliary type information is the same on all known ECOFF - targets. I can't see any reason that it would ever change, so I am - going to gamble and define the external structures here, in the - target independent ECOFF header file. The internal forms are - defined in coff/sym.h, which was originally donated by MIPS - Computer Systems. */ - -/* Type information external record */ - -struct tir_ext { - unsigned char t_bits1[1]; - unsigned char t_tq45[1]; - unsigned char t_tq01[1]; - unsigned char t_tq23[1]; -}; - -#define TIR_BITS1_FBITFIELD_BIG ((unsigned int) 0x80) -#define TIR_BITS1_FBITFIELD_LITTLE ((unsigned int) 0x01) - -#define TIR_BITS1_CONTINUED_BIG ((unsigned int) 0x40) -#define TIR_BITS1_CONTINUED_LITTLE ((unsigned int) 0x02) - -#define TIR_BITS1_BT_BIG ((unsigned int) 0x3F) -#define TIR_BITS1_BT_SH_BIG 0 -#define TIR_BITS1_BT_LITTLE ((unsigned int) 0xFC) -#define TIR_BITS1_BT_SH_LITTLE 2 - -#define TIR_BITS_TQ4_BIG ((unsigned int) 0xF0) -#define TIR_BITS_TQ4_SH_BIG 4 -#define TIR_BITS_TQ5_BIG ((unsigned int) 0x0F) -#define TIR_BITS_TQ5_SH_BIG 0 -#define TIR_BITS_TQ4_LITTLE ((unsigned int) 0x0F) -#define TIR_BITS_TQ4_SH_LITTLE 0 -#define TIR_BITS_TQ5_LITTLE ((unsigned int) 0xF0) -#define TIR_BITS_TQ5_SH_LITTLE 4 - -#define TIR_BITS_TQ0_BIG ((unsigned int) 0xF0) -#define TIR_BITS_TQ0_SH_BIG 4 -#define TIR_BITS_TQ1_BIG ((unsigned int) 0x0F) -#define TIR_BITS_TQ1_SH_BIG 0 -#define TIR_BITS_TQ0_LITTLE ((unsigned int) 0x0F) -#define TIR_BITS_TQ0_SH_LITTLE 0 -#define TIR_BITS_TQ1_LITTLE ((unsigned int) 0xF0) -#define TIR_BITS_TQ1_SH_LITTLE 4 - -#define TIR_BITS_TQ2_BIG ((unsigned int) 0xF0) -#define TIR_BITS_TQ2_SH_BIG 4 -#define TIR_BITS_TQ3_BIG ((unsigned int) 0x0F) -#define TIR_BITS_TQ3_SH_BIG 0 -#define TIR_BITS_TQ2_LITTLE ((unsigned int) 0x0F) -#define TIR_BITS_TQ2_SH_LITTLE 0 -#define TIR_BITS_TQ3_LITTLE ((unsigned int) 0xF0) -#define TIR_BITS_TQ3_SH_LITTLE 4 - -/* Relative symbol external record */ - -struct rndx_ext { - unsigned char r_bits[4]; -}; - -#define RNDX_BITS0_RFD_SH_LEFT_BIG 4 -#define RNDX_BITS1_RFD_BIG ((unsigned int) 0xF0) -#define RNDX_BITS1_RFD_SH_BIG 4 - -#define RNDX_BITS0_RFD_SH_LEFT_LITTLE 0 -#define RNDX_BITS1_RFD_LITTLE ((unsigned int) 0x0F) -#define RNDX_BITS1_RFD_SH_LEFT_LITTLE 8 - -#define RNDX_BITS1_INDEX_BIG ((unsigned int) 0x0F) -#define RNDX_BITS1_INDEX_SH_LEFT_BIG 16 -#define RNDX_BITS2_INDEX_SH_LEFT_BIG 8 -#define RNDX_BITS3_INDEX_SH_LEFT_BIG 0 - -#define RNDX_BITS1_INDEX_LITTLE ((unsigned int) 0xF0) -#define RNDX_BITS1_INDEX_SH_LITTLE 4 -#define RNDX_BITS2_INDEX_SH_LEFT_LITTLE 4 -#define RNDX_BITS3_INDEX_SH_LEFT_LITTLE 12 - -/* Auxiliary symbol information external record */ - -union aux_ext { - struct tir_ext a_ti; - struct rndx_ext a_rndx; - unsigned char a_dnLow[4]; - unsigned char a_dnHigh[4]; - unsigned char a_isym[4]; - unsigned char a_iss[4]; - unsigned char a_width[4]; - unsigned char a_count[4]; -}; - -#define AUX_GET_ANY(bigend, ax, field) \ - ((bigend) ? bfd_getb32 ((ax)->field) : bfd_getl32 ((ax)->field)) - -#define AUX_GET_DNLOW(bigend, ax) AUX_GET_ANY ((bigend), (ax), a_dnLow) -#define AUX_GET_DNHIGH(bigend, ax) AUX_GET_ANY ((bigend), (ax), a_dnHigh) -#define AUX_GET_ISYM(bigend, ax) AUX_GET_ANY ((bigend), (ax), a_isym) -#define AUX_GET_ISS(bigend, ax) AUX_GET_ANY ((bigend), (ax), a_iss) -#define AUX_GET_WIDTH(bigend, ax) AUX_GET_ANY ((bigend), (ax), a_width) -#define AUX_GET_COUNT(bigend, ax) AUX_GET_ANY ((bigend), (ax), a_count) - -#define AUX_PUT_ANY(bigend, val, ax, field) \ - ((bigend) \ - ? (bfd_putb32 ((bfd_vma) (val), (ax)->field), 0) \ - : (bfd_putl32 ((bfd_vma) (val), (ax)->field), 0)) - -#define AUX_PUT_DNLOW(bigend, val, ax) \ - AUX_PUT_ANY ((bigend), (val), (ax), a_dnLow) -#define AUX_PUT_DNHIGH(bigend, val, ax) \ - AUX_PUT_ANY ((bigend), (val), (ax), a_dnHigh) -#define AUX_PUT_ISYM(bigend, val, ax) \ - AUX_PUT_ANY ((bigend), (val), (ax), a_isym) -#define AUX_PUT_ISS(bigend, val, ax) \ - AUX_PUT_ANY ((bigend), (val), (ax), a_iss) -#define AUX_PUT_WIDTH(bigend, val, ax) \ - AUX_PUT_ANY ((bigend), (val), (ax), a_width) -#define AUX_PUT_COUNT(bigend, val, ax) \ - AUX_PUT_ANY ((bigend), (val), (ax), a_count) - -/********************** SYMBOLS **********************/ - -/* For efficiency, gdb deals directly with the unswapped symbolic - information (that way it only takes the time to swap information - that it really needs to read). gdb originally retrieved the - information directly from the BFD backend information, but that - strategy, besides being sort of ugly, does not work for MIPS ELF, - which also uses ECOFF debugging information. This structure holds - pointers to the (mostly) unswapped symbolic information. */ - -struct ecoff_debug_info -{ - /* The swapped ECOFF symbolic header. */ - HDRR symbolic_header; - - /* Pointers to the unswapped symbolic information. Note that the - pointers to external structures point to different sorts of - information on different ECOFF targets. The ecoff_debug_swap - structure provides the sizes of the structures and the functions - needed to swap the information in and out. These pointers are - all pointers to arrays, not single structures. They will be NULL - if there are no instances of the relevant structure. These - fields are also used by the assembler to output ECOFF debugging - information. */ - unsigned char *line; - PTR external_dnr; /* struct dnr_ext */ - PTR external_pdr; /* struct pdr_ext */ - PTR external_sym; /* struct sym_ext */ - PTR external_opt; /* struct opt_ext */ - union aux_ext *external_aux; - char *ss; - char *ssext; - PTR external_fdr; /* struct fdr_ext */ - PTR external_rfd; /* struct rfd_ext */ - PTR external_ext; /* struct ext_ext */ - - /* These fields are used when linking. They may disappear at some - point. */ - char *ssext_end; - PTR external_ext_end; - - /* When linking, this field holds a mapping from the input FDR - numbers to the output numbers, and is used when writing out the - external symbols. It is NULL if no mapping is required. */ - RFDT *ifdmap; - - /* The swapped FDR information. Currently this is never NULL, but - code using this structure should probably double-check in case - this changes in the future. This is a pointer to an array, not a - single structure. */ - FDR *fdr; - - /* When relaxing MIPS embedded PIC code, we may need to adjust - symbol values when they are output. This is a linked list of - structures indicating how values should be adjusted. There is no - requirement that the entries be in any order, or that they not - overlap. This field is normally NULL, in which case no - adjustments need to be made. */ - struct ecoff_value_adjust *adjust; -}; - -/* This structure describes how to adjust symbol values when - outputting MIPS embedded PIC code. These adjustments only apply to - the internal symbols, as the external symbol values will come from - the hash table and have already been adjusted. */ - -struct ecoff_value_adjust -{ - /* Next entry on adjustment list. */ - struct ecoff_value_adjust *next; - /* Starting VMA of adjustment. This is the VMA in the ECOFF file, - not the offset from the start of the section. Thus it should - indicate a particular section. */ - bfd_vma start; - /* Ending VMA of adjustment. */ - bfd_vma end; - /* Adjustment. This should be added to the value of the symbol, or - FDR. This is zero for the last entry in the array. */ - long adjust; -}; - -/* These structures are used by the ECOFF find_nearest_line function. */ - -struct ecoff_fdrtab_entry -{ - /* Base address in .text of this FDR. */ - bfd_vma base_addr; - FDR *fdr; -}; - -struct ecoff_find_line -{ - /* Allocated memory to hold function and file names. */ - char *find_buffer; - - /* FDR table, sorted by address: */ - long fdrtab_len; - struct ecoff_fdrtab_entry *fdrtab; -}; - -/********************** SWAPPING **********************/ - -/* The generic ECOFF code needs to be able to swap debugging - information in and out in the specific format used by a particular - ECOFF implementation. This structure provides the information - needed to do this. */ - -struct ecoff_debug_swap -{ - /* Symbol table magic number. */ - int sym_magic; - /* Alignment of debugging information. E.g., 4. */ - bfd_size_type debug_align; - /* Sizes of external symbolic information. */ - bfd_size_type external_hdr_size; - bfd_size_type external_dnr_size; - bfd_size_type external_pdr_size; - bfd_size_type external_sym_size; - bfd_size_type external_opt_size; - bfd_size_type external_fdr_size; - bfd_size_type external_rfd_size; - bfd_size_type external_ext_size; - /* Functions to swap in external symbolic data. */ - void (*swap_hdr_in) PARAMS ((bfd *, PTR, HDRR *)); - void (*swap_dnr_in) PARAMS ((bfd *, PTR, DNR *)); - void (*swap_pdr_in) PARAMS ((bfd *, PTR, PDR *)); - void (*swap_sym_in) PARAMS ((bfd *, PTR, SYMR *)); - void (*swap_opt_in) PARAMS ((bfd *, PTR, OPTR *)); - void (*swap_fdr_in) PARAMS ((bfd *, PTR, FDR *)); - void (*swap_rfd_in) PARAMS ((bfd *, PTR, RFDT *)); - void (*swap_ext_in) PARAMS ((bfd *, PTR, EXTR *)); - void (*swap_tir_in) PARAMS ((int, const struct tir_ext *, TIR *)); - void (*swap_rndx_in) PARAMS ((int, const struct rndx_ext *, RNDXR *)); - /* Functions to swap out external symbolic data. */ - void (*swap_hdr_out) PARAMS ((bfd *, const HDRR *, PTR)); - void (*swap_dnr_out) PARAMS ((bfd *, const DNR *, PTR)); - void (*swap_pdr_out) PARAMS ((bfd *, const PDR *, PTR)); - void (*swap_sym_out) PARAMS ((bfd *, const SYMR *, PTR)); - void (*swap_opt_out) PARAMS ((bfd *, const OPTR *, PTR)); - void (*swap_fdr_out) PARAMS ((bfd *, const FDR *, PTR)); - void (*swap_rfd_out) PARAMS ((bfd *, const RFDT *, PTR)); - void (*swap_ext_out) PARAMS ((bfd *, const EXTR *, PTR)); - void (*swap_tir_out) PARAMS ((int, const TIR *, struct tir_ext *)); - void (*swap_rndx_out) PARAMS ((int, const RNDXR *, struct rndx_ext *)); - /* Function to read symbol data and set up pointers in - ecoff_debug_info structure. The section argument is used for - ELF, not straight ECOFF. */ - boolean (*read_debug_info) PARAMS ((bfd *, asection *, - struct ecoff_debug_info *)); -}; - -#endif /* ! defined (ECOFF_H) */ diff --git a/contrib/gdb/include/coff/h8300.h b/contrib/gdb/include/coff/h8300.h deleted file mode 100644 index 8fe8f61..0000000 --- a/contrib/gdb/include/coff/h8300.h +++ /dev/null @@ -1,203 +0,0 @@ -/*** coff information for Hitachi H8/300 and H8/300-H */ - -/********************** FILE HEADER **********************/ - -struct external_filehdr { - char f_magic[2]; /* magic number */ - char f_nscns[2]; /* number of sections */ - char f_timdat[4]; /* time & date stamp */ - char f_symptr[4]; /* file pointer to symtab */ - char f_nsyms[4]; /* number of symtab entries */ - char f_opthdr[2]; /* sizeof(optional hdr) */ - char f_flags[2]; /* flags */ -}; - - - -#define H8300MAGIC 0x8300 -#define H8300HMAGIC 0x8301 - - -#define H8300BADMAG(x) (((x).f_magic!=H8300MAGIC)) -#define H8300HBADMAG(x) (((x).f_magic!=H8300HMAGIC)) - -#define FILHDR struct external_filehdr -#define FILHSZ sizeof(FILHDR) - - -/********************** AOUT "OPTIONAL HEADER" **********************/ - - -typedef struct -{ - char magic[2]; /* type of file */ - char vstamp[2]; /* version stamp */ - char tsize[4]; /* text size in bytes, padded to FW bdry*/ - char dsize[4]; /* initialized data " " */ - char bsize[4]; /* uninitialized data " " */ - char entry[4]; /* entry pt. */ - char text_start[4]; /* base of text used for this file */ - char data_start[4]; /* base of data used for this file */ -} -AOUTHDR; - - -#define AOUTHDRSZ (sizeof(AOUTHDR)) -#define AOUTSZ (sizeof(AOUTHDR)) - - - - -/********************** SECTION HEADER **********************/ - - -struct external_scnhdr { - char s_name[8]; /* section name */ - char s_paddr[4]; /* physical address, aliased s_nlib */ - char s_vaddr[4]; /* virtual address */ - char s_size[4]; /* section size */ - char s_scnptr[4]; /* file ptr to raw data for section */ - char s_relptr[4]; /* file ptr to relocation */ - char s_lnnoptr[4]; /* file ptr to line numbers */ - char s_nreloc[2]; /* number of relocation entries */ - char s_nlnno[2]; /* number of line number entries*/ - char s_flags[4]; /* flags */ -}; - -/* - * names of "special" sections - */ -#define _TEXT ".text" -#define _DATA ".data" -#define _BSS ".bss" - - -#define SCNHDR struct external_scnhdr -#define SCNHSZ sizeof(SCNHDR) - - -/********************** LINE NUMBERS **********************/ - -/* 1 line number entry for every "breakpointable" source line in a section. - * Line numbers are grouped on a per function basis; first entry in a function - * grouping will have l_lnno = 0 and in place of physical address will be the - * symbol table index of the function name. - */ -struct external_lineno { - union { - char l_symndx[4]; /* function name symbol index, iff l_lnno == 0*/ - char l_paddr[4]; /* (physical) address of line number */ - } l_addr; - char l_lnno[4]; /* line number */ -}; - -#define GET_LINENO_LNNO(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *) (ext->l_lnno)); -#define PUT_LINENO_LNNO(abfd,val, ext) bfd_h_put_32(abfd,val, (bfd_byte *) (ext->l_lnno)); - -#define LINENO struct external_lineno -#define LINESZ sizeof(LINENO) - - -/********************** SYMBOLS **********************/ - -#define E_SYMNMLEN 8 /* # characters in a symbol name */ -#define E_FILNMLEN 14 /* # characters in a file name */ -#define E_DIMNUM 4 /* # array dimensions in auxiliary entry */ - -struct external_syment -{ - union { - char e_name[E_SYMNMLEN]; - struct { - char e_zeroes[4]; - char e_offset[4]; - } e; - } e; - char e_value[4]; - char e_scnum[2]; - char e_type[2]; - char e_sclass[1]; - char e_numaux[1]; -}; - - - -#define N_BTMASK (017) -#define N_TMASK (060) -#define N_BTSHFT (4) -#define N_TSHIFT (2) - - -union external_auxent { - struct { - char x_tagndx[4]; /* str, un, or enum tag indx */ - union { - struct { - char x_lnno[2]; /* declaration line number */ - char x_size[2]; /* str/union/array size */ - } x_lnsz; - char x_fsize[4]; /* size of function */ - } x_misc; - union { - struct { /* if ISFCN, tag, or .bb */ - char x_lnnoptr[4]; /* ptr to fcn line # */ - char x_endndx[4]; /* entry ndx past block end */ - } x_fcn; - struct { /* if ISARY, up to 4 dimen. */ - char x_dimen[E_DIMNUM][2]; - } x_ary; - } x_fcnary; - char x_tvndx[2]; /* tv index */ - } x_sym; - - union { - char x_fname[E_FILNMLEN]; - struct { - char x_zeroes[4]; - char x_offset[4]; - } x_n; - } x_file; - - struct { - char x_scnlen[4]; /* section length */ - char x_nreloc[2]; /* # relocation entries */ - char x_nlinno[2]; /* # line numbers */ - } x_scn; - - struct { - char x_tvfill[4]; /* tv fill value */ - char x_tvlen[2]; /* length of .tv */ - char x_tvran[2][2]; /* tv range */ - } x_tv; /* info about .tv section (in auxent of symbol .tv)) */ - - -}; - -#define SYMENT struct external_syment -#define SYMESZ 18 -#define AUXENT union external_auxent -#define AUXESZ 18 - - - -/********************** RELOCATION DIRECTIVES **********************/ - -/* The external reloc has an offset field, because some of the reloc - types on the h8 don't have room in the instruction for the entire - offset - eg the strange jump and high page addressing modes */ - -struct external_reloc { - char r_vaddr[4]; - char r_symndx[4]; - char r_offset[4]; - char r_type[2]; - char r_stuff[2]; -}; - - -#define RELOC struct external_reloc -#define RELSZ 16 - - - - diff --git a/contrib/gdb/include/coff/h8500.h b/contrib/gdb/include/coff/h8500.h deleted file mode 100644 index 5a8c9fe..0000000 --- a/contrib/gdb/include/coff/h8500.h +++ /dev/null @@ -1,201 +0,0 @@ -/*** coff information for Hitachi H8/500 */ - -/********************** FILE HEADER **********************/ - -struct external_filehdr { - char f_magic[2]; /* magic number */ - char f_nscns[2]; /* number of sections */ - char f_timdat[4]; /* time & date stamp */ - char f_symptr[4]; /* file pointer to symtab */ - char f_nsyms[4]; /* number of symtab entries */ - char f_opthdr[2]; /* sizeof(optional hdr) */ - char f_flags[2]; /* flags */ -}; - - - -#define H8500MAGIC 0x8500 - - -#define H8500BADMAG(x) ((0xffff && ((x).f_magic)!=H8500MAGIC)) - -#define FILHDR struct external_filehdr -#define FILHSZ sizeof(FILHDR) - - -/********************** AOUT "OPTIONAL HEADER" **********************/ - - -typedef struct -{ - char magic[2]; /* type of file */ - char vstamp[2]; /* version stamp */ - char tsize[4]; /* text size in bytes, padded to FW bdry*/ - char dsize[4]; /* initialized data " " */ - char bsize[4]; /* uninitialized data " " */ - char entry[4]; /* entry pt. */ - char text_start[4]; /* base of text used for this file */ - char data_start[4]; /* base of data used for this file */ -} -AOUTHDR; - - -#define AOUTHDRSZ (sizeof(AOUTHDR)) -#define AOUTSZ (sizeof(AOUTHDR)) - - - - -/********************** SECTION HEADER **********************/ - - -struct external_scnhdr { - char s_name[8]; /* section name */ - char s_paddr[4]; /* physical address, aliased s_nlib */ - char s_vaddr[4]; /* virtual address */ - char s_size[4]; /* section size */ - char s_scnptr[4]; /* file ptr to raw data for section */ - char s_relptr[4]; /* file ptr to relocation */ - char s_lnnoptr[4]; /* file ptr to line numbers */ - char s_nreloc[2]; /* number of relocation entries */ - char s_nlnno[2]; /* number of line number entries*/ - char s_flags[4]; /* flags */ -}; - -/* - * names of "special" sections - */ -#define _TEXT ".text" -#define _DATA ".data" -#define _BSS ".bss" - - -#define SCNHDR struct external_scnhdr -#define SCNHSZ sizeof(SCNHDR) - - -/********************** LINE NUMBERS **********************/ - -/* 1 line number entry for every "breakpointable" source line in a section. - * Line numbers are grouped on a per function basis; first entry in a function - * grouping will have l_lnno = 0 and in place of physical address will be the - * symbol table index of the function name. - */ -struct external_lineno { - union { - char l_symndx[4]; /* function name symbol index, iff l_lnno == 0*/ - char l_paddr[4]; /* (physical) address of line number */ - } l_addr; - char l_lnno[4]; /* line number */ -}; - -#define GET_LINENO_LNNO(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *) (ext->l_lnno)); -#define PUT_LINENO_LNNO(abfd,val, ext) bfd_h_put_32(abfd,val, (bfd_byte *) (ext->l_lnno)); - -#define LINENO struct external_lineno -#define LINESZ sizeof(LINENO) - - -/********************** SYMBOLS **********************/ - -#define E_SYMNMLEN 8 /* # characters in a symbol name */ -#define E_FILNMLEN 14 /* # characters in a file name */ -#define E_DIMNUM 4 /* # array dimensions in auxiliary entry */ - -struct external_syment -{ - union { - char e_name[E_SYMNMLEN]; - struct { - char e_zeroes[4]; - char e_offset[4]; - } e; - } e; - char e_value[4]; - char e_scnum[2]; - char e_type[2]; - char e_sclass[1]; - char e_numaux[1]; -}; - - - -#define N_BTMASK (017) -#define N_TMASK (060) -#define N_BTSHFT (4) -#define N_TSHIFT (2) - - -union external_auxent { - struct { - char x_tagndx[4]; /* str, un, or enum tag indx */ - union { - struct { - char x_lnno[2]; /* declaration line number */ - char x_size[2]; /* str/union/array size */ - } x_lnsz; - char x_fsize[4]; /* size of function */ - } x_misc; - union { - struct { /* if ISFCN, tag, or .bb */ - char x_lnnoptr[4]; /* ptr to fcn line # */ - char x_endndx[4]; /* entry ndx past block end */ - } x_fcn; - struct { /* if ISARY, up to 4 dimen. */ - char x_dimen[E_DIMNUM][2]; - } x_ary; - } x_fcnary; - char x_tvndx[2]; /* tv index */ - } x_sym; - - union { - char x_fname[E_FILNMLEN]; - struct { - char x_zeroes[4]; - char x_offset[4]; - } x_n; - } x_file; - - struct { - char x_scnlen[4]; /* section length */ - char x_nreloc[2]; /* # relocation entries */ - char x_nlinno[2]; /* # line numbers */ - } x_scn; - - struct { - char x_tvfill[4]; /* tv fill value */ - char x_tvlen[2]; /* length of .tv */ - char x_tvran[2][2]; /* tv range */ - } x_tv; /* info about .tv section (in auxent of symbol .tv)) */ - - -}; - -#define SYMENT struct external_syment -#define SYMESZ 18 -#define AUXENT union external_auxent -#define AUXESZ 18 - - - -/********************** RELOCATION DIRECTIVES **********************/ - -/* The external reloc has an offset field, because some of the reloc - types on the h8 don't have room in the instruction for the entire - offset - eg the strange jump and high page addressing modes */ - -struct external_reloc { - char r_vaddr[4]; - char r_symndx[4]; - char r_offset[4]; - char r_type[2]; - char r_stuff[2]; -}; - - -#define RELOC struct external_reloc -#define RELSZ 16 - - - - diff --git a/contrib/gdb/include/coff/i386.h b/contrib/gdb/include/coff/i386.h deleted file mode 100644 index b7ecf0b..0000000 --- a/contrib/gdb/include/coff/i386.h +++ /dev/null @@ -1,224 +0,0 @@ -/*** coff information for Intel 386/486. */ - - -/********************** FILE HEADER **********************/ - -struct external_filehdr { - char f_magic[2]; /* magic number */ - char f_nscns[2]; /* number of sections */ - char f_timdat[4]; /* time & date stamp */ - char f_symptr[4]; /* file pointer to symtab */ - char f_nsyms[4]; /* number of symtab entries */ - char f_opthdr[2]; /* sizeof(optional hdr) */ - char f_flags[2]; /* flags */ -}; - -/* Bits for f_flags: - * F_RELFLG relocation info stripped from file - * F_EXEC file is executable (no unresolved external references) - * F_LNNO line numbers stripped from file - * F_LSYMS local symbols stripped from file - * F_AR32WR file has byte ordering of an AR32WR machine (e.g. vax) - */ - -#define F_RELFLG (0x0001) -#define F_EXEC (0x0002) -#define F_LNNO (0x0004) -#define F_LSYMS (0x0008) - - - -#define I386MAGIC 0x14c -#define I386PTXMAGIC 0x154 -#define I386AIXMAGIC 0x175 - -/* This is Lynx's all-platform magic number for executables. */ - -#define LYNXCOFFMAGIC 0415 - -#define I386BADMAG(x) (((x).f_magic != I386MAGIC) \ - && (x).f_magic != I386AIXMAGIC \ - && (x).f_magic != I386PTXMAGIC \ - && (x).f_magic != LYNXCOFFMAGIC) - -#define FILHDR struct external_filehdr -#define FILHSZ sizeof(FILHDR) - - -/********************** AOUT "OPTIONAL HEADER" **********************/ - - -typedef struct -{ - char magic[2]; /* type of file */ - char vstamp[2]; /* version stamp */ - char tsize[4]; /* text size in bytes, padded to FW bdry*/ - char dsize[4]; /* initialized data " " */ - char bsize[4]; /* uninitialized data " " */ - char entry[4]; /* entry pt. */ - char text_start[4]; /* base of text used for this file */ - char data_start[4]; /* base of data used for this file */ - - -} -AOUTHDR; - - -#define AOUTSZ (sizeof(AOUTHDR)) - -#define OMAGIC 0404 /* object files, eg as output */ -#define ZMAGIC 0413 /* demand load format, eg normal ld output */ -#define STMAGIC 0401 /* target shlib */ -#define SHMAGIC 0443 /* host shlib */ - - -/* define some NT default values */ -/* #define NT_IMAGE_BASE 0x400000 moved to internal.h */ -#define NT_SECTION_ALIGNMENT 0x1000 -#define NT_FILE_ALIGNMENT 0x200 -#define NT_DEF_RESERVE 0x100000 -#define NT_DEF_COMMIT 0x1000 - -/********************** SECTION HEADER **********************/ - - -struct external_scnhdr { - char s_name[8]; /* section name */ - char s_paddr[4]; /* physical address, aliased s_nlib */ - char s_vaddr[4]; /* virtual address */ - char s_size[4]; /* section size */ - char s_scnptr[4]; /* file ptr to raw data for section */ - char s_relptr[4]; /* file ptr to relocation */ - char s_lnnoptr[4]; /* file ptr to line numbers */ - char s_nreloc[2]; /* number of relocation entries */ - char s_nlnno[2]; /* number of line number entries*/ - char s_flags[4]; /* flags */ -}; - -#define SCNHDR struct external_scnhdr -#define SCNHSZ sizeof(SCNHDR) - -/* - * names of "special" sections - */ -#define _TEXT ".text" -#define _DATA ".data" -#define _BSS ".bss" -#define _COMMENT ".comment" -#define _LIB ".lib" - -/********************** LINE NUMBERS **********************/ - -/* 1 line number entry for every "breakpointable" source line in a section. - * Line numbers are grouped on a per function basis; first entry in a function - * grouping will have l_lnno = 0 and in place of physical address will be the - * symbol table index of the function name. - */ -struct external_lineno { - union { - char l_symndx[4]; /* function name symbol index, iff l_lnno == 0*/ - char l_paddr[4]; /* (physical) address of line number */ - } l_addr; - char l_lnno[2]; /* line number */ -}; - - -#define LINENO struct external_lineno -#define LINESZ 6 - - -/********************** SYMBOLS **********************/ - -#define E_SYMNMLEN 8 /* # characters in a symbol name */ -#define E_FILNMLEN 14 /* # characters in a file name */ -#define E_DIMNUM 4 /* # array dimensions in auxiliary entry */ - -struct external_syment -{ - union { - char e_name[E_SYMNMLEN]; - struct { - char e_zeroes[4]; - char e_offset[4]; - } e; - } e; - char e_value[4]; - char e_scnum[2]; - char e_type[2]; - char e_sclass[1]; - char e_numaux[1]; -}; - -#define N_BTMASK (0xf) -#define N_TMASK (0x30) -#define N_BTSHFT (4) -#define N_TSHIFT (2) - -union external_auxent { - struct { - char x_tagndx[4]; /* str, un, or enum tag indx */ - union { - struct { - char x_lnno[2]; /* declaration line number */ - char x_size[2]; /* str/union/array size */ - } x_lnsz; - char x_fsize[4]; /* size of function */ - } x_misc; - union { - struct { /* if ISFCN, tag, or .bb */ - char x_lnnoptr[4]; /* ptr to fcn line # */ - char x_endndx[4]; /* entry ndx past block end */ - } x_fcn; - struct { /* if ISARY, up to 4 dimen. */ - char x_dimen[E_DIMNUM][2]; - } x_ary; - } x_fcnary; - char x_tvndx[2]; /* tv index */ - } x_sym; - - union { - char x_fname[E_FILNMLEN]; - struct { - char x_zeroes[4]; - char x_offset[4]; - } x_n; - } x_file; - - struct { - char x_scnlen[4]; /* section length */ - char x_nreloc[2]; /* # relocation entries */ - char x_nlinno[2]; /* # line numbers */ - } x_scn; - - struct { - char x_tvfill[4]; /* tv fill value */ - char x_tvlen[2]; /* length of .tv */ - char x_tvran[2][2]; /* tv range */ - } x_tv; /* info about .tv section (in auxent of symbol .tv)) */ - - -}; - -#define SYMENT struct external_syment -#define SYMESZ 18 -#define AUXENT union external_auxent -#define AUXESZ 18 - - -# define _ETEXT "etext" - - -/********************** RELOCATION DIRECTIVES **********************/ - - - -struct external_reloc { - char r_vaddr[4]; - char r_symndx[4]; - char r_type[2]; -}; - - -#define RELOC struct external_reloc -#define RELSZ 10 - diff --git a/contrib/gdb/include/coff/i860.h b/contrib/gdb/include/coff/i860.h deleted file mode 100644 index e09ec5f0..0000000 --- a/contrib/gdb/include/coff/i860.h +++ /dev/null @@ -1,204 +0,0 @@ -/* This file was hacked from i386.h [dolan@ssd.intel.com] */ - -/*** coff information for Intel 860. */ - - -/********************** FILE HEADER **********************/ - -struct external_filehdr { - char f_magic[2]; /* magic number */ - char f_nscns[2]; /* number of sections */ - char f_timdat[4]; /* time & date stamp */ - char f_symptr[4]; /* file pointer to symtab */ - char f_nsyms[4]; /* number of symtab entries */ - char f_opthdr[2]; /* sizeof(optional hdr) */ - char f_flags[2]; /* flags */ -}; - - -/* Bits for f_flags: - * F_RELFLG relocation info stripped from file - * F_EXEC file is executable (no unresolved external references) - * F_LNNO line numbers stripped from file - * F_LSYMS local symbols stripped from file - * F_AR32WR file has byte ordering of an AR32WR machine (e.g. vax) - */ - -#define F_RELFLG (0x0001) -#define F_EXEC (0x0002) -#define F_LNNO (0x0004) -#define F_LSYMS (0x0008) - - - -#define I860MAGIC 0x14d - -#define I860BADMAG(x) ((x).f_magic != I860MAGIC) - -#define FILHDR struct external_filehdr -#define FILHSZ sizeof(FILHDR) - - -/********************** AOUT "OPTIONAL HEADER" **********************/ - - -typedef struct -{ - char magic[2]; /* type of file */ - char vstamp[2]; /* version stamp */ - char tsize[4]; /* text size in bytes, padded to FW bdry*/ - char dsize[4]; /* initialized data " " */ - char bsize[4]; /* uninitialized data " " */ - char entry[4]; /* entry pt. */ - char text_start[4]; /* base of text used for this file */ - char data_start[4]; /* base of data used for this file */ -} -AOUTHDR; - - -#define AOUTSZ (sizeof(AOUTHDR)) - -/* FIXME: What are the a.out magic numbers? */ - -/********************** SECTION HEADER **********************/ - - -struct external_scnhdr { - char s_name[8]; /* section name */ - char s_paddr[4]; /* physical address, aliased s_nlib */ - char s_vaddr[4]; /* virtual address */ - char s_size[4]; /* section size */ - char s_scnptr[4]; /* file ptr to raw data for section */ - char s_relptr[4]; /* file ptr to relocation */ - char s_lnnoptr[4]; /* file ptr to line numbers */ - char s_nreloc[2]; /* number of relocation entries */ - char s_nlnno[2]; /* number of line number entries*/ - char s_flags[4]; /* flags */ -}; - -#define SCNHDR struct external_scnhdr -#define SCNHSZ sizeof(SCNHDR) - -/* - * names of "special" sections - */ -#define _TEXT ".text" -#define _DATA ".data" -#define _BSS ".bss" -#define _COMMENT ".comment" -#define _LIB ".lib" - -/********************** LINE NUMBERS **********************/ - -/* 1 line number entry for every "breakpointable" source line in a section. - * Line numbers are grouped on a per function basis; first entry in a function - * grouping will have l_lnno = 0 and in place of physical address will be the - * symbol table index of the function name. - */ -struct external_lineno { - union { - char l_symndx[4]; /* function name symbol index, iff l_lnno == 0*/ - char l_paddr[4]; /* (physical) address of line number */ - } l_addr; - char l_lnno[2]; /* line number */ -}; - - -#define LINENO struct external_lineno -#define LINESZ 6 - - -/********************** SYMBOLS **********************/ - -#define E_SYMNMLEN 8 /* # characters in a symbol name */ -#define E_FILNMLEN 14 /* # characters in a file name */ -#define E_DIMNUM 4 /* # array dimensions in auxiliary entry */ - -struct external_syment -{ - union { - char e_name[E_SYMNMLEN]; - struct { - char e_zeroes[4]; - char e_offset[4]; - } e; - } e; - char e_value[4]; - char e_scnum[2]; - char e_type[2]; - char e_sclass[1]; - char e_numaux[1]; -}; - -#define N_BTMASK (0xf) -#define N_TMASK (0x30) -#define N_BTSHFT (4) -#define N_TSHIFT (2) - -union external_auxent { - struct { - char x_tagndx[4]; /* str, un, or enum tag indx */ - union { - struct { - char x_lnno[2]; /* declaration line number */ - char x_size[2]; /* str/union/array size */ - } x_lnsz; - char x_fsize[4]; /* size of function */ - } x_misc; - union { - struct { /* if ISFCN, tag, or .bb */ - char x_lnnoptr[4]; /* ptr to fcn line # */ - char x_endndx[4]; /* entry ndx past block end */ - } x_fcn; - struct { /* if ISARY, up to 4 dimen. */ - char x_dimen[E_DIMNUM][2]; - } x_ary; - } x_fcnary; - char x_tvndx[2]; /* tv index */ - } x_sym; - - union { - char x_fname[E_FILNMLEN]; - struct { - char x_zeroes[4]; - char x_offset[4]; - } x_n; - } x_file; - - struct { - char x_scnlen[4]; /* section length */ - char x_nreloc[2]; /* # relocation entries */ - char x_nlinno[2]; /* # line numbers */ - } x_scn; - - struct { - char x_tvfill[4]; /* tv fill value */ - char x_tvlen[2]; /* length of .tv */ - char x_tvran[2][2]; /* tv range */ - } x_tv; /* info about .tv section (in auxent of symbol .tv)) */ - - -}; - -#define SYMENT struct external_syment -#define SYMESZ 18 -#define AUXENT union external_auxent -#define AUXESZ 18 - - -# define _ETEXT "etext" - - -/********************** RELOCATION DIRECTIVES **********************/ - - - -struct external_reloc { - char r_vaddr[4]; - char r_symndx[4]; - char r_type[2]; -}; - - -#define RELOC struct external_reloc -#define RELSZ 10 diff --git a/contrib/gdb/include/coff/i960.h b/contrib/gdb/include/coff/i960.h deleted file mode 100644 index c20893c..0000000 --- a/contrib/gdb/include/coff/i960.h +++ /dev/null @@ -1,251 +0,0 @@ -/*** coff information for 80960. Origins: Intel corp, natch. */ - -/* NOTE: Tagentries (cf TAGBITS) are no longer used by the 960 */ - -/********************** FILE HEADER **********************/ - -struct external_filehdr { - char f_magic[2]; /* magic number */ - char f_nscns[2]; /* number of sections */ - char f_timdat[4]; /* time & date stamp */ - char f_symptr[4]; /* file pointer to symtab */ - char f_nsyms[4]; /* number of symtab entries */ - char f_opthdr[2]; /* sizeof(optional hdr) */ - char f_flags[2]; /* flags */ -}; - -#define OMAGIC (0407) /* old impure format. data immediately - follows text. both sections are rw. */ -#define NMAGIC (0410) /* split i&d, read-only text */ - -/* -* Intel 80960 (I960) processor flags. -* F_I960TYPE == mask for processor type field. -*/ - -#define F_I960TYPE (0xf000) -#define F_I960CORE (0x1000) -#define F_I960KB (0x2000) -#define F_I960SB (0x2000) -#define F_I960MC (0x3000) -#define F_I960XA (0x4000) -#define F_I960CA (0x5000) -#define F_I960KA (0x6000) -#define F_I960SA (0x6000) -#define F_I960JX (0x7000) -#define F_I960HX (0x8000) - - -/** i80960 Magic Numbers -*/ - -#define I960ROMAGIC (0x160) /* read-only text segments */ -#define I960RWMAGIC (0x161) /* read-write text segments */ - -#define I960BADMAG(x) (((x).f_magic!=I960ROMAGIC) && ((x).f_magic!=I960RWMAGIC)) - -#define FILHDR struct external_filehdr -#define FILHSZ 20 - -/********************** AOUT "OPTIONAL HEADER" **********************/ - -typedef struct { - unsigned long phys_addr; - unsigned long bitarray; -} TAGBITS; - - - -typedef struct -{ - char magic[2]; /* type of file */ - char vstamp[2]; /* version stamp */ - char tsize[4]; /* text size in bytes, padded to FW bdry*/ - char dsize[4]; /* initialized data " " */ - char bsize[4]; /* uninitialized data " " */ - char entry[4]; /* entry pt. */ - char text_start[4]; /* base of text used for this file */ - char data_start[4]; /* base of data used for this file */ - char tagentries[4]; /* number of tag entries to follow */ -} -AOUTHDR; - -/* return a pointer to the tag bits array */ - -#define TAGPTR(aout) ((TAGBITS *) (&(aout.tagentries)+1)) - -/* compute size of a header */ - -/*#define AOUTSZ(aout) (sizeof(AOUTHDR)+(aout.tagentries*sizeof(TAGBITS)))*/ -#define AOUTSZ (sizeof(AOUTHDR)) - - - -/********************** SECTION HEADER **********************/ - - -struct external_scnhdr { - char s_name[8]; /* section name */ - char s_paddr[4]; /* physical address, aliased s_nlib */ - char s_vaddr[4]; /* virtual address */ - char s_size[4]; /* section size */ - char s_scnptr[4]; /* file ptr to raw data for section */ - char s_relptr[4]; /* file ptr to relocation */ - char s_lnnoptr[4]; /* file ptr to line numbers */ - char s_nreloc[2]; /* number of relocation entries */ - char s_nlnno[2]; /* number of line number entries*/ - char s_flags[4]; /* flags */ - char s_align[4]; /* section alignment */ -}; - - -#define SCNHDR struct external_scnhdr -#define SCNHSZ sizeof(SCNHDR) - -/* - * names of "special" sections - */ -#define _TEXT ".text" -#define _DATA ".data" -#define _BSS ".bss" - -/********************** LINE NUMBERS **********************/ - -/* 1 line number entry for every "breakpointable" source line in a section. - * Line numbers are grouped on a per function basis; first entry in a function - * grouping will have l_lnno = 0 and in place of physical address will be the - * symbol table index of the function name. - */ -struct external_lineno { - union { - char l_symndx[4]; /* function name symbol index, iff l_lnno == 0*/ - char l_paddr[4]; /* (physical) address of line number */ - } l_addr; - char l_lnno[2]; /* line number */ - char padding[2]; /* force alignment */ -}; - - -#define LINENO struct external_lineno -#define LINESZ 8 - - -/********************** SYMBOLS **********************/ - -#define E_SYMNMLEN 8 /* # characters in a symbol name */ -#define E_FILNMLEN 14 /* # characters in a file name */ -#define E_DIMNUM 4 /* # array dimensions in auxiliary entry */ - -struct external_syment -{ - union { - char e_name[E_SYMNMLEN]; - struct { - char e_zeroes[4]; - char e_offset[4]; - } e; - } e; - char e_value[4]; - char e_scnum[2]; - char e_flags[2]; - char e_type[4]; - char e_sclass[1]; - char e_numaux[1]; - char pad2[2]; -}; - - - - -#define N_BTMASK (0x1f) -#define N_TMASK (0x60) -#define N_BTSHFT (5) -#define N_TSHIFT (2) - -union external_auxent { - struct { - char x_tagndx[4]; /* str, un, or enum tag indx */ - union { - struct { - char x_lnno[2]; /* declaration line number */ - char x_size[2]; /* str/union/array size */ - } x_lnsz; - char x_fsize[4]; /* size of function */ - } x_misc; - union { - struct { /* if ISFCN, tag, or .bb */ - char x_lnnoptr[4]; /* ptr to fcn line # */ - char x_endndx[4]; /* entry ndx past block end */ - } x_fcn; - struct { /* if ISARY, up to 4 dimen. */ - char x_dimen[E_DIMNUM][2]; - } x_ary; - } x_fcnary; - char x_tvndx[2]; /* tv index */ - } x_sym; - - union { - char x_fname[E_FILNMLEN]; - struct { - char x_zeroes[4]; - char x_offset[4]; - } x_n; - } x_file; - - struct { - char x_scnlen[4]; /* section length */ - char x_nreloc[2]; /* # relocation entries */ - char x_nlinno[2]; /* # line numbers */ - } x_scn; - - struct { - char x_tvfill[4]; /* tv fill value */ - char x_tvlen[2]; /* length of .tv */ - char x_tvran[2][2]; /* tv range */ - } x_tv; /* info about .tv section (in auxent of symbol .tv)) */ - - /****************************************** - * I960-specific *2nd* aux. entry formats - ******************************************/ - struct { - /* This is a very old typo that keeps getting propagated. */ -#define x_stdindx x_stindx - char x_stindx[4]; /* sys. table entry */ - } x_sc; /* system call entry */ - - struct { - char x_balntry[4]; /* BAL entry point */ - } x_bal; /* BAL-callable function */ - - struct { - char x_timestamp[4]; /* time stamp */ - char x_idstring[20]; /* producer identity string */ - } x_ident; /* Producer ident info */ - -}; - - - -#define SYMENT struct external_syment -#define SYMESZ sizeof(SYMENT) /* FIXME - calc by hand */ -#define AUXENT union external_auxent -#define AUXESZ sizeof(AUXENT) /* FIXME - calc by hand */ - -# define _ETEXT "_etext" - -/********************** RELOCATION DIRECTIVES **********************/ - -struct external_reloc { - char r_vaddr[4]; - char r_symndx[4]; - char r_type[2]; - char pad[2]; -}; - - -/* Relevent values for r_type and i960. Would someone please document them */ - - -#define RELOC struct external_reloc -#define RELSZ 12 - diff --git a/contrib/gdb/include/coff/internal.h b/contrib/gdb/include/coff/internal.h deleted file mode 100644 index b43cf76..0000000 --- a/contrib/gdb/include/coff/internal.h +++ /dev/null @@ -1,648 +0,0 @@ -/* Internal format of COFF object file data structures, for GNU BFD. - This file is part of BFD, the Binary File Descriptor library. */ - -#ifndef GNU_COFF_INTERNAL_H -#define GNU_COFF_INTERNAL_H 1 - -/* First, make "signed char" work, even on old compilers. */ -#ifndef signed -#ifndef __STDC__ -#define signed /**/ -#endif -#endif - -/********************** FILE HEADER **********************/ - -/* extra stuff in a PE header. */ - -struct internal_extra_pe_filehdr -{ - /* DOS header data follows for PE stuff */ - unsigned short e_magic; /* Magic number, 0x5a4d */ - unsigned short e_cblp; /* Bytes on last page of file, 0x90 */ - unsigned short e_cp; /* Pages in file, 0x3 */ - unsigned short e_crlc; /* Relocations, 0x0 */ - unsigned short e_cparhdr; /* Size of header in paragraphs, 0x4 */ - unsigned short e_minalloc; /* Minimum extra paragraphs needed, 0x0 */ - unsigned short e_maxalloc; /* Maximum extra paragraphs needed, 0xFFFF */ - unsigned short e_ss; /* Initial (relative) SS value, 0x0 */ - unsigned short e_sp; /* Initial SP value, 0xb8 */ - unsigned short e_csum; /* Checksum, 0x0 */ - unsigned short e_ip; /* Initial IP value, 0x0 */ - unsigned short e_cs; /* Initial (relative) CS value, 0x0 */ - unsigned short e_lfarlc; /* File address of relocation table, 0x40 */ - unsigned short e_ovno; /* Overlay number, 0x0 */ - unsigned short e_res[4]; /* Reserved words, all 0x0 */ - unsigned short e_oemid; /* OEM identifier (for e_oeminfo), 0x0 */ - unsigned short e_oeminfo; /* OEM information; e_oemid specific, 0x0 */ - unsigned short e_res2[10]; /* Reserved words, all 0x0 */ - bfd_vma e_lfanew; /* File address of new exe header, 0x80 */ - unsigned long dos_message[16]; /* text which always follows dos header */ - bfd_vma nt_signature; /* required NT signature, 0x4550 */ -}; - -struct internal_filehdr -{ - struct internal_extra_pe_filehdr pe; - - /* standard coff internal info */ - unsigned short f_magic; /* magic number */ - unsigned short f_nscns; /* number of sections */ - long f_timdat; /* time & date stamp */ - bfd_vma f_symptr; /* file pointer to symtab */ - long f_nsyms; /* number of symtab entries */ - unsigned short f_opthdr; /* sizeof(optional hdr) */ - unsigned short f_flags; /* flags */ -}; - - -/* Bits for f_flags: - * F_RELFLG relocation info stripped from file - * F_EXEC file is executable (no unresolved external references) - * F_LNNO line numbers stripped from file - * F_LSYMS local symbols stripped from file - * F_AR16WR file is 16-bit little-endian - * F_AR32WR file is 32-bit little-endian - * F_AR32W file is 32-bit big-endian - * F_DYNLOAD rs/6000 aix: dynamically loadable w/imports & exports - * F_SHROBJ rs/6000 aix: file is a shared object - * F_DLL PE format DLL - */ - -#define F_RELFLG (0x0001) -#define F_EXEC (0x0002) -#define F_LNNO (0x0004) -#define F_LSYMS (0x0008) -#define F_AR16WR (0x0080) -#define F_AR32WR (0x0100) -#define F_AR32W (0x0200) -#define F_DYNLOAD (0x1000) -#define F_SHROBJ (0x2000) -#define F_DLL (0x2000) - -/* extra structure which is used in the optional header */ -typedef struct _IMAGE_DATA_DIRECTORY -{ - bfd_vma VirtualAddress; - long Size; -} IMAGE_DATA_DIRECTORY; -#define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16 - -/* default image base for NT */ -#define NT_EXE_IMAGE_BASE 0x400000 -#define NT_DLL_IMAGE_BASE 0x10000000 - -/* Extra stuff in a PE aouthdr */ - -#define PE_DEF_SECTION_ALIGNMENT 0x1000 -#define PE_DEF_FILE_ALIGNMENT 0x200 - -struct internal_extra_pe_aouthdr -{ - /* PE stuff */ - bfd_vma ImageBase; /* address of specific location in memory that - file is located, NT default 0x10000 */ - - bfd_vma SectionAlignment; /* section alignment default 0x1000 */ - bfd_vma FileAlignment; /* file alignment default 0x200 */ - short MajorOperatingSystemVersion; /* minimum version of the operating */ - short MinorOperatingSystemVersion; /* system req'd for exe, default to 1*/ - short MajorImageVersion; /* user defineable field to store version of */ - short MinorImageVersion; /* exe or dll being created, default to 0 */ - short MajorSubsystemVersion; /* minimum subsystem version required to */ - short MinorSubsystemVersion; /* run exe; default to 3.1 */ - long Reserved1; /* seems to be 0 */ - long SizeOfImage; /* size of memory to allocate for prog */ - long SizeOfHeaders; /* size of PE header and section table */ - long CheckSum; /* set to 0 */ - short Subsystem; - - /* type of subsystem exe uses for user interface, - possible values: - 1 - NATIVE Doesn't require a subsystem - 2 - WINDOWS_GUI runs in Windows GUI subsystem - 3 - WINDOWS_CUI runs in Windows char sub. (console app) - 5 - OS2_CUI runs in OS/2 character subsystem - 7 - POSIX_CUI runs in Posix character subsystem */ - short DllCharacteristics; /* flags for DLL init, use 0 */ - bfd_vma SizeOfStackReserve; /* amount of memory to reserve */ - bfd_vma SizeOfStackCommit; /* amount of memory initially committed for - initial thread's stack, default is 0x1000 */ - bfd_vma SizeOfHeapReserve; /* amount of virtual memory to reserve and */ - bfd_vma SizeOfHeapCommit; /* commit, don't know what to defaut it to */ - long LoaderFlags; /* can probably set to 0 */ - long NumberOfRvaAndSizes; /* number of entries in next entry, 16 */ - IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]; -}; - -/********************** AOUT "OPTIONAL HEADER" **********************/ -struct internal_aouthdr -{ - short magic; /* type of file */ - short vstamp; /* version stamp */ - bfd_vma tsize; /* text size in bytes, padded to FW bdry*/ - bfd_vma dsize; /* initialized data " " */ - bfd_vma bsize; /* uninitialized data " " */ - bfd_vma entry; /* entry pt. */ - bfd_vma text_start; /* base of text used for this file */ - bfd_vma data_start; /* base of data used for this file */ - - /* i960 stuff */ - unsigned long tagentries; /* number of tag entries to follow */ - - /* RS/6000 stuff */ - unsigned long o_toc; /* address of TOC */ - short o_snentry; /* section number for entry point */ - short o_sntext; /* section number for text */ - short o_sndata; /* section number for data */ - short o_sntoc; /* section number for toc */ - short o_snloader; /* section number for loader section */ - short o_snbss; /* section number for bss */ - short o_algntext; /* max alignment for text */ - short o_algndata; /* max alignment for data */ - short o_modtype; /* Module type field, 1R,RE,RO */ - short o_cputype; /* Encoded CPU type */ - unsigned long o_maxstack; /* max stack size allowed. */ - unsigned long o_maxdata; /* max data size allowed. */ - - /* ECOFF stuff */ - bfd_vma bss_start; /* Base of bss section. */ - bfd_vma gp_value; /* GP register value. */ - unsigned long gprmask; /* General registers used. */ - unsigned long cprmask[4]; /* Coprocessor registers used. */ - unsigned long fprmask; /* Floating pointer registers used. */ - - /* Apollo stuff */ - long o_inlib; /* inlib data */ - long o_sri; /* Static Resource Information */ - long vid[2]; /* Version id */ - - - struct internal_extra_pe_aouthdr pe; - -}; - -/********************** STORAGE CLASSES **********************/ - -/* This used to be defined as -1, but now n_sclass is unsigned. */ -#define C_EFCN 0xff /* physical end of function */ -#define C_NULL 0 -#define C_AUTO 1 /* automatic variable */ -#define C_EXT 2 /* external symbol */ -#define C_STAT 3 /* static */ -#define C_REG 4 /* register variable */ -#define C_EXTDEF 5 /* external definition */ -#define C_LABEL 6 /* label */ -#define C_ULABEL 7 /* undefined label */ -#define C_MOS 8 /* member of structure */ -#define C_ARG 9 /* function argument */ -#define C_STRTAG 10 /* structure tag */ -#define C_MOU 11 /* member of union */ -#define C_UNTAG 12 /* union tag */ -#define C_TPDEF 13 /* type definition */ -#define C_USTATIC 14 /* undefined static */ -#define C_ENTAG 15 /* enumeration tag */ -#define C_MOE 16 /* member of enumeration */ -#define C_REGPARM 17 /* register parameter */ -#define C_FIELD 18 /* bit field */ -#define C_AUTOARG 19 /* auto argument */ -#define C_LASTENT 20 /* dummy entry (end of block) */ -#define C_BLOCK 100 /* ".bb" or ".eb" */ -#define C_FCN 101 /* ".bf" or ".ef" */ -#define C_EOS 102 /* end of structure */ -#define C_FILE 103 /* file name */ -#define C_LINE 104 /* line # reformatted as symbol table entry */ -#define C_ALIAS 105 /* duplicate tag */ -#define C_HIDDEN 106 /* ext symbol in dmert public lib */ - -/* New storage classes for WINDOWS_NT */ -#define C_SECTION 104 /* section name */ -#define C_NT_WEAK 105 /* weak external */ - - /* New storage classes for 80960 */ - -/* C_LEAFPROC is obsolete. Use C_LEAFEXT or C_LEAFSTAT */ -#define C_LEAFPROC 108 /* Leaf procedure, "call" via BAL */ - -#define C_SCALL 107 /* Procedure reachable via system call */ -#define C_LEAFEXT 108 /* External leaf */ -#define C_LEAFSTAT 113 /* Static leaf */ -#define C_OPTVAR 109 /* Optimized variable */ -#define C_DEFINE 110 /* Preprocessor #define */ -#define C_PRAGMA 111 /* Advice to compiler or linker */ -#define C_SEGMENT 112 /* 80960 segment name */ - - /* Storage classes for m88k */ -#define C_SHADOW 107 /* shadow symbol */ -#define C_VERSION 108 /* coff version symbol */ - - /* New storage classes for RS/6000 */ -#define C_HIDEXT 107 /* Un-named external symbol */ -#define C_BINCL 108 /* Marks beginning of include file */ -#define C_EINCL 109 /* Marks ending of include file */ - - /* storage classes for stab symbols for RS/6000 */ -#define C_GSYM (0x80) -#define C_LSYM (0x81) -#define C_PSYM (0x82) -#define C_RSYM (0x83) -#define C_RPSYM (0x84) -#define C_STSYM (0x85) -#define C_TCSYM (0x86) -#define C_BCOMM (0x87) -#define C_ECOML (0x88) -#define C_ECOMM (0x89) -#define C_DECL (0x8c) -#define C_ENTRY (0x8d) -#define C_FUN (0x8e) -#define C_BSTAT (0x8f) -#define C_ESTAT (0x90) - -/********************** SECTION HEADER **********************/ -struct internal_scnhdr -{ - char s_name[8]; /* section name */ - bfd_vma s_paddr; /* physical address, aliased s_nlib */ - bfd_vma s_vaddr; /* virtual address */ - bfd_vma s_size; /* section size */ - bfd_vma s_scnptr; /* file ptr to raw data for section */ - bfd_vma s_relptr; /* file ptr to relocation */ - bfd_vma s_lnnoptr; /* file ptr to line numbers */ - unsigned long s_nreloc; /* number of relocation entries */ - unsigned long s_nlnno; /* number of line number entries*/ - long s_flags; /* flags */ - long s_align; /* used on I960 */ -}; - -/* - * s_flags "type" - */ -#define STYP_REG (0x0000) /* "regular": allocated, relocated, loaded */ -#define STYP_DSECT (0x0001) /* "dummy": relocated only*/ -#define STYP_NOLOAD (0x0002) /* "noload": allocated, relocated, not loaded */ -#define STYP_GROUP (0x0004) /* "grouped": formed of input sections */ -#define STYP_PAD (0x0008) /* "padding": not allocated, not relocated, loaded */ -#define STYP_COPY (0x0010) /* "copy": for decision function used by field update; not allocated, not relocated, - loaded; reloc & lineno entries processed normally */ -#define STYP_TEXT (0x0020) /* section contains text only */ -#define S_SHRSEG (0x0020) /* In 3b Update files (output of ogen), sections which appear in SHARED segments of the Pfile - will have the S_SHRSEG flag set by ogen, to inform dufr that updating 1 copy of the proc. will - update all process invocations. */ -#define STYP_DATA (0x0040) /* section contains data only */ -#define STYP_BSS (0x0080) /* section contains bss only */ -#define S_NEWFCN (0x0100) /* In a minimal file or an update file, a new function (as compared with a replaced function) */ -#define STYP_INFO (0x0200) /* comment: not allocated not relocated, not loaded */ -#define STYP_OVER (0x0400) /* overlay: relocated not allocated or loaded */ -#define STYP_LIB (0x0800) /* for .lib: same as INFO */ -#define STYP_MERGE (0x2000) /* merge section -- combines with text, data or bss sections only */ -#define STYP_REVERSE_PAD (0x4000) /* section will be padded with no-op instructions wherever padding is necessary and there is a - - word of contiguous bytes - beginning on a word boundary. */ - -#define STYP_LIT 0x8020 /* Literal data (like STYP_TEXT) */ - - - -/********************** LINE NUMBERS **********************/ - -/* 1 line number entry for every "breakpointable" source line in a section. - * Line numbers are grouped on a per function basis; first entry in a function - * grouping will have l_lnno = 0 and in place of physical address will be the - * symbol table index of the function name. - */ - -struct internal_lineno -{ - union - { - long l_symndx; /* function name symbol index, iff l_lnno == 0*/ - long l_paddr; /* (physical) address of line number */ - } l_addr; - unsigned long l_lnno; /* line number */ -}; - -/********************** SYMBOLS **********************/ - -#define SYMNMLEN 8 /* # characters in a symbol name */ -#define FILNMLEN 14 /* # characters in a file name */ -#define DIMNUM 4 /* # array dimensions in auxiliary entry */ - -struct internal_syment -{ - union - { - char _n_name[SYMNMLEN]; /* old COFF version */ - struct - { - long _n_zeroes; /* new == 0 */ - long _n_offset; /* offset into string table */ - } _n_n; - char *_n_nptr[2]; /* allows for overlaying */ - } _n; - long n_value; /* value of symbol */ - short n_scnum; /* section number */ - unsigned short n_flags; /* copy of flags from filhdr */ - unsigned short n_type; /* type and derived type */ - unsigned char n_sclass; /* storage class */ - unsigned char n_numaux; /* number of aux. entries */ -}; - -#define n_name _n._n_name -#define n_zeroes _n._n_n._n_zeroes -#define n_offset _n._n_n._n_offset - - -/* Relocatable symbols have number of the section in which they are defined, - or one of the following: */ - -#define N_UNDEF ((short)0) /* undefined symbol */ -#define N_ABS ((short)-1) /* value of symbol is absolute */ -#define N_DEBUG ((short)-2) /* debugging symbol -- value is meaningless */ -#define N_TV ((short)-3) /* indicates symbol needs preload transfer vector */ -#define P_TV ((short)-4) /* indicates symbol needs postload transfer vector*/ - -/* - * Type of a symbol, in low N bits of the word - */ -#define T_NULL 0 -#define T_VOID 1 /* function argument (only used by compiler) */ -#define T_CHAR 2 /* character */ -#define T_SHORT 3 /* short integer */ -#define T_INT 4 /* integer */ -#define T_LONG 5 /* long integer */ -#define T_FLOAT 6 /* floating point */ -#define T_DOUBLE 7 /* double word */ -#define T_STRUCT 8 /* structure */ -#define T_UNION 9 /* union */ -#define T_ENUM 10 /* enumeration */ -#define T_MOE 11 /* member of enumeration*/ -#define T_UCHAR 12 /* unsigned character */ -#define T_USHORT 13 /* unsigned short */ -#define T_UINT 14 /* unsigned integer */ -#define T_ULONG 15 /* unsigned long */ -#define T_LNGDBL 16 /* long double */ - -/* - * derived types, in n_type -*/ -#define DT_NON (0) /* no derived type */ -#define DT_PTR (1) /* pointer */ -#define DT_FCN (2) /* function */ -#define DT_ARY (3) /* array */ - -#define BTYPE(x) ((x) & N_BTMASK) - -#define ISPTR(x) (((x) & N_TMASK) == (DT_PTR << N_BTSHFT)) -#define ISFCN(x) (((x) & N_TMASK) == (DT_FCN << N_BTSHFT)) -#define ISARY(x) (((x) & N_TMASK) == (DT_ARY << N_BTSHFT)) -#define ISTAG(x) ((x)==C_STRTAG||(x)==C_UNTAG||(x)==C_ENTAG) -#define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK)) - - -union internal_auxent -{ - struct - { - - union - { - long l; /* str, un, or enum tag indx */ - struct coff_ptr_struct *p; - } x_tagndx; - - union - { - struct - { - unsigned short x_lnno; /* declaration line number */ - unsigned short x_size; /* str/union/array size */ - } x_lnsz; - long x_fsize; /* size of function */ - } x_misc; - - union - { - struct - { /* if ISFCN, tag, or .bb */ - long x_lnnoptr; /* ptr to fcn line # */ - union - { /* entry ndx past block end */ - long l; - struct coff_ptr_struct *p; - } x_endndx; - } x_fcn; - - struct - { /* if ISARY, up to 4 dimen. */ - unsigned short x_dimen[DIMNUM]; - } x_ary; - } x_fcnary; - - unsigned short x_tvndx; /* tv index */ - } x_sym; - - union - { - char x_fname[FILNMLEN]; - struct - { - long x_zeroes; - long x_offset; - } x_n; - } x_file; - - struct - { - long x_scnlen; /* section length */ - unsigned short x_nreloc; /* # relocation entries */ - unsigned short x_nlinno; /* # line numbers */ - } x_scn; - - struct - { - long x_tvfill; /* tv fill value */ - unsigned short x_tvlen; /* length of .tv */ - unsigned short x_tvran[2]; /* tv range */ - } x_tv; /* info about .tv section (in auxent of symbol .tv)) */ - - /****************************************** - * RS/6000-specific auxent - last auxent for every external symbol - ******************************************/ - struct - { - union - { /* csect length or enclosing csect */ - long l; - struct coff_ptr_struct *p; - } x_scnlen; - long x_parmhash; /* parm type hash index */ - unsigned short x_snhash; /* sect num with parm hash */ - unsigned char x_smtyp; /* symbol align and type */ - /* 0-4 - Log 2 of alignment */ - /* 5-7 - symbol type */ - unsigned char x_smclas; /* storage mapping class */ - long x_stab; /* dbx stab info index */ - unsigned short x_snstab; /* sect num with dbx stab */ - } x_csect; /* csect definition information */ - -/* x_smtyp values: */ - -#define SMTYP_ALIGN(x) ((x) >> 3) /* log2 of alignment */ -#define SMTYP_SMTYP(x) ((x) & 0x7) /* symbol type */ -/* Symbol type values: */ -#define XTY_ER 0 /* External reference */ -#define XTY_SD 1 /* Csect definition */ -#define XTY_LD 2 /* Label definition */ -#define XTY_CM 3 /* .BSS */ -#define XTY_EM 4 /* Error message */ -#define XTY_US 5 /* "Reserved for internal use" */ - -/* x_smclas values: */ - -#define XMC_PR 0 /* Read-only program code */ -#define XMC_RO 1 /* Read-only constant */ -#define XMC_DB 2 /* Read-only debug dictionary table */ -#define XMC_TC 3 /* Read-write general TOC entry */ -#define XMC_UA 4 /* Read-write unclassified */ -#define XMC_RW 5 /* Read-write data */ -#define XMC_GL 6 /* Read-only global linkage */ -#define XMC_XO 7 /* Read-only extended operation */ -#define XMC_SV 8 /* Read-only supervisor call */ -#define XMC_BS 9 /* Read-write BSS */ -#define XMC_DS 10 /* Read-write descriptor csect */ -#define XMC_UC 11 /* Read-write unnamed Fortran common */ -#define XMC_TI 12 /* Read-only traceback index csect */ -#define XMC_TB 13 /* Read-only traceback table csect */ -/* 14 ??? */ -#define XMC_TC0 15 /* Read-write TOC anchor */ -#define XMC_TD 16 /* Read-write data in TOC */ - - /****************************************** - * I960-specific *2nd* aux. entry formats - ******************************************/ - struct - { - /* This is a very old typo that keeps getting propagated. */ -#define x_stdindx x_stindx - long x_stindx; /* sys. table entry */ - } x_sc; /* system call entry */ - - struct - { - unsigned long x_balntry; /* BAL entry point */ - } x_bal; /* BAL-callable function */ - - struct - { - unsigned long x_timestamp; /* time stamp */ - char x_idstring[20]; /* producer identity string */ - } x_ident; /* Producer ident info */ - -}; - -/********************** RELOCATION DIRECTIVES **********************/ - -struct internal_reloc -{ - bfd_vma r_vaddr; /* Virtual address of reference */ - long r_symndx; /* Index into symbol table */ - unsigned short r_type; /* Relocation type */ - unsigned char r_size; /* Used by RS/6000 and ECOFF */ - unsigned char r_extern; /* Used by ECOFF */ - unsigned long r_offset; /* Used by Alpha ECOFF, SPARC, others */ -}; - -#define R_RELBYTE 017 -#define R_RELWORD 020 -#define R_PCRBYTE 022 -#define R_PCRWORD 023 -#define R_PCRLONG 024 - -#define R_DIR16 01 -#define R_DIR32 06 -#define R_PCLONG 020 -#define R_RELBYTE 017 -#define R_RELWORD 020 -#define R_IMAGEBASE 07 - - -#define R_PCR16L 128 -#define R_PCR26L 129 -#define R_VRT16 130 -#define R_HVRT16 131 -#define R_LVRT16 132 -#define R_VRT32 133 -#define R_RELLONG (0x11) /* Direct 32-bit relocation */ -#define R_IPRSHORT (0x18) -#define R_IPRMED (0x19) /* 24-bit ip-relative relocation */ -#define R_IPRLONG (0x1a) -#define R_OPTCALL (0x1b) /* 32-bit optimizable call (leafproc/sysproc) */ -#define R_OPTCALLX (0x1c) /* 64-bit optimizable call (leafproc/sysproc) */ -#define R_GETSEG (0x1d) -#define R_GETPA (0x1e) -#define R_TAGWORD (0x1f) -#define R_JUMPTARG 0x20 /* strange 29k 00xx00xx reloc */ - - -#define R_MOVB1 0x41 /* Special h8 16bit or 8 bit reloc for mov.b */ -#define R_MOVB2 0x42 /* Special h8 opcode for 8bit which could be 16 */ -#define R_JMP1 0x43 /* Special h8 16bit jmp which could be pcrel */ -#define R_JMP2 0x44 /* a branch which used to be a jmp */ -#define R_RELLONG_NEG 0x45 - -#define R_JMPL1 0x46 /* Special h8 24bit jmp which could be pcrel */ -#define R_JMPL_B8 0x47 /* a 8 bit pcrel which used to be a jmp */ - -#define R_MOVLB1 0x48 /* Special h8 24bit or 8 bit reloc for mov.b */ -#define R_MOVLB2 0x49 /* Special h8 opcode for 8bit which could be 24 */ - -/* An h8300 memory indirect jump/call. Forces the address of the jump/call - target into the function vector (in page zero), and the address of the - vector entry to be placed in the jump/call instruction. */ -#define R_MEM_INDIRECT 0x4a - -/* Z8k modes */ -#define R_IMM16 0x01 /* 16 bit abs */ -#define R_JR 0x02 /* jr 8 bit disp */ -#define R_IMM4L 0x23 /* low nibble */ -#define R_IMM8 0x22 /* 8 bit abs */ -#define R_IMM32 R_RELLONG /* 32 bit abs */ -#define R_CALL R_DA /* Absolute address which could be a callr */ -#define R_JP R_DA /* Absolute address which could be a jp */ -#define R_REL16 0x04 /* 16 bit PC rel */ -#define R_CALLR 0x05 /* callr 12 bit disp */ -#define R_SEG 0x10 /* set if in segmented mode */ -#define R_IMM4H 0x24 /* high nibble */ -#define R_DISP7 0x25 /* djnz displacement */ - -/* H8500 modes */ - -#define R_H8500_IMM8 1 /* 8 bit immediate */ -#define R_H8500_IMM16 2 /* 16 bit immediate */ -#define R_H8500_PCREL8 3 /* 8 bit pcrel */ -#define R_H8500_PCREL16 4 /* 16 bit pcrel */ -#define R_H8500_HIGH8 5 /* high 8 bits of 24 bit address */ -#define R_H8500_LOW16 7 /* low 16 bits of 24 bit immediate */ -#define R_H8500_IMM24 6 /* 24 bit immediate */ -#define R_H8500_IMM32 8 /* 32 bit immediate */ -#define R_H8500_HIGH16 9 /* high 16 bits of 32 bit immediate */ - -/* W65 modes */ - -#define R_W65_ABS8 1 /* addr & 0xff */ -#define R_W65_ABS16 2 /* addr & 0xffff */ -#define R_W65_ABS24 3 /* addr & 0xffffff */ - -#define R_W65_ABS8S8 4 /* (addr >> 8) & 0xff */ -#define R_W65_ABS8S16 5 /* (addr >> 16) & 0xff */ - -#define R_W65_ABS16S8 6 /* (addr >> 8) & 0ffff */ -#define R_W65_ABS16S16 7 /* (addr >> 16) & 0ffff */ - -#define R_W65_PCR8 8 -#define R_W65_PCR16 9 - -#define R_W65_DP 10 /* direct page 8 bits only */ - -#endif /* GNU_COFF_INTERNAL_H */ diff --git a/contrib/gdb/include/coff/m68k.h b/contrib/gdb/include/coff/m68k.h deleted file mode 100644 index a3c15be..0000000 --- a/contrib/gdb/include/coff/m68k.h +++ /dev/null @@ -1,221 +0,0 @@ -/*** coff information for M68K */ - -#ifndef GNU_COFF_M68K_H -#define GNU_COFF_M68K_H 1 - -/********************** FILE HEADER **********************/ - -struct external_filehdr { - char f_magic[2]; /* magic number */ - char f_nscns[2]; /* number of sections */ - char f_timdat[4]; /* time & date stamp */ - char f_symptr[4]; /* file pointer to symtab */ - char f_nsyms[4]; /* number of symtab entries */ - char f_opthdr[2]; /* sizeof(optional hdr) */ - char f_flags[2]; /* flags */ -}; - - -/* Motorola 68000/68008/68010/68020 */ -#define MC68MAGIC 0520 -#define MC68KWRMAGIC 0520 /* writeable text segments */ -#define MC68TVMAGIC 0521 -#define MC68KROMAGIC 0521 /* readonly shareable text segments */ -#define MC68KPGMAGIC 0522 /* demand paged text segments */ -#define M68MAGIC 0210 -#define M68TVMAGIC 0211 - -/* this is the magic of the Bull dpx/2 */ -#define MC68KBCSMAGIC 0526 - -/* This is Lynx's all-platform magic number for executables. */ - -#define LYNXCOFFMAGIC 0415 - -#define OMAGIC M68MAGIC - -/* This intentionally does not include MC68KBCSMAGIC; it only includes - magic numbers which imply that names do not have underscores. */ -#define M68KBADMAG(x) (((x).f_magic!=MC68MAGIC) && ((x).f_magic!=MC68KWRMAGIC) && ((x).f_magic!=MC68TVMAGIC) && \ - ((x).f_magic!=MC68KROMAGIC) && ((x).f_magic!=MC68KPGMAGIC) && ((x).f_magic!=M68MAGIC) && ((x).f_magic!=M68TVMAGIC) && ((x).f_magic!=LYNXCOFFMAGIC) ) - -/* Magic numbers for the a.out header. */ - -#define PAGEMAGICEXECSWAPPED 0407 /* executable (swapped) */ -#define PAGEMAGICPEXECSWAPPED 0410 /* pure executable (swapped) */ -#define PAGEMAGICPEXECTSHLIB 0443 /* pure executable (target shared library) */ -#define PAGEMAGICPEXECPAGED 0413 /* pure executable (paged) */ - -#define FILHDR struct external_filehdr -#define FILHSZ sizeof(FILHDR) - - -/********************** AOUT "OPTIONAL HEADER" **********************/ - - -typedef struct -{ - char magic[2]; /* type of file */ - char vstamp[2]; /* version stamp */ - char tsize[4]; /* text size in bytes, padded to FW bdry*/ - char dsize[4]; /* initialized data " " */ - char bsize[4]; /* uninitialized data " " */ - char entry[4]; /* entry pt. */ - char text_start[4]; /* base of text used for this file */ - char data_start[4]; /* base of data used for this file */ -} -AOUTHDR; - -#define AOUTSZ (sizeof(AOUTHDR)) - - - -/********************** SECTION HEADER **********************/ - - -struct external_scnhdr { - char s_name[8]; /* section name */ - char s_paddr[4]; /* physical address, aliased s_nlib */ - char s_vaddr[4]; /* virtual address */ - char s_size[4]; /* section size */ - char s_scnptr[4]; /* file ptr to raw data for section */ - char s_relptr[4]; /* file ptr to relocation */ - char s_lnnoptr[4]; /* file ptr to line numbers */ - char s_nreloc[2]; /* number of relocation entries */ - char s_nlnno[2]; /* number of line number entries*/ - char s_flags[4]; /* flags */ -}; - -/* - * names of "special" sections - */ -#define _TEXT ".text" -#define _DATA ".data" -#define _BSS ".bss" -#define _COMMENT ".comment" - -#define SCNHDR struct external_scnhdr -#define SCNHSZ sizeof(SCNHDR) - - -/********************** LINE NUMBERS **********************/ - -/* 1 line number entry for every "breakpointable" source line in a section. - * Line numbers are grouped on a per function basis; first entry in a function - * grouping will have l_lnno = 0 and in place of physical address will be the - * symbol table index of the function name. - */ -struct external_lineno { - union { - char l_symndx[4]; /* function name symbol index, iff l_lnno == 0*/ - char l_paddr[4]; /* (physical) address of line number */ - } l_addr; - char l_lnno[2]; /* line number */ -}; - - -#define LINENO struct external_lineno -#define LINESZ sizeof(LINENO) - - -/********************** SYMBOLS **********************/ - -#define E_SYMNMLEN 8 /* # characters in a symbol name */ -#define E_FILNMLEN 14 /* # characters in a file name */ -#define E_DIMNUM 4 /* # array dimensions in auxiliary entry */ - -struct external_syment -{ - union { - char e_name[E_SYMNMLEN]; - struct { - char e_zeroes[4]; - char e_offset[4]; - } e; - } e; - char e_value[4]; - char e_scnum[2]; - char e_type[2]; - char e_sclass[1]; - char e_numaux[1]; -}; - - - -#define N_BTMASK (017) -#define N_TMASK (060) -#define N_BTSHFT (4) -#define N_TSHIFT (2) - - -union external_auxent { - struct { - char x_tagndx[4]; /* str, un, or enum tag indx */ - union { - struct { - char x_lnno[2]; /* declaration line number */ - char x_size[2]; /* str/union/array size */ - } x_lnsz; - char x_fsize[4]; /* size of function */ - } x_misc; - union { - struct { /* if ISFCN, tag, or .bb */ - char x_lnnoptr[4]; /* ptr to fcn line # */ - char x_endndx[4]; /* entry ndx past block end */ - } x_fcn; - struct { /* if ISARY, up to 4 dimen. */ - char x_dimen[E_DIMNUM][2]; - } x_ary; - } x_fcnary; - char x_tvndx[2]; /* tv index */ - } x_sym; - - union { - char x_fname[E_FILNMLEN]; - struct { - char x_zeroes[4]; - char x_offset[4]; - } x_n; - } x_file; - - struct { - char x_scnlen[4]; /* section length */ - char x_nreloc[2]; /* # relocation entries */ - char x_nlinno[2]; /* # line numbers */ - } x_scn; - - struct { - char x_tvfill[4]; /* tv fill value */ - char x_tvlen[2]; /* length of .tv */ - char x_tvran[2][2]; /* tv range */ - } x_tv; /* info about .tv section (in auxent of symbol .tv)) */ - - -}; - -#define SYMENT struct external_syment -#define SYMESZ 18 -#define AUXENT union external_auxent -#define AUXESZ 18 - - - -/********************** RELOCATION DIRECTIVES **********************/ - - -struct external_reloc { - char r_vaddr[4]; - char r_symndx[4]; - char r_type[2]; -#ifdef M68K_COFF_OFFSET - char r_offset[4]; -#endif - -}; - - -#define RELOC struct external_reloc - -#define RELSZ sizeof(struct external_reloc) - -#endif /* GNU_COFF_M68K_H */ diff --git a/contrib/gdb/include/coff/m88k.h b/contrib/gdb/include/coff/m88k.h deleted file mode 100644 index 9068dd3..0000000 --- a/contrib/gdb/include/coff/m88k.h +++ /dev/null @@ -1,218 +0,0 @@ -/*** coff information for 88k bcs */ - -/********************** FILE HEADER **********************/ -struct external_filehdr { - char f_magic[2]; /* magic number */ - char f_nscns[2]; /* number of sections */ - char f_timdat[4]; /* time & date stamp */ - char f_symptr[4]; /* file pointer to symtab */ - char f_nsyms[4]; /* number of symtab entries */ - char f_opthdr[2]; /* sizeof(optional hdr) */ - char f_flags[2]; /* flags */ -}; - -#define MC88MAGIC 0540 /* 88k BCS executable */ -#define MC88DMAGIC 0541 /* DG/UX executable */ -#define MC88OMAGIC 0555 /* Object file */ - -#define MC88BADMAG(x) (((x).f_magic!=MC88MAGIC) &&((x).f_magic!=MC88DMAGIC) && ((x).f_magic != MC88OMAGIC)) - -#define FILHDR struct external_filehdr -#define FILHSZ sizeof(FILHDR) - - -/********************** AOUT "OPTIONAL HEADER" **********************/ - - -#define PAGEMAGIC3 0414 /* Split i&d, zero mapped */ -#define PAGEMAGICBCS 0413 - - -typedef struct -{ - char magic[2]; /* type of file */ - char vstamp[2]; /* version stamp */ - char tsize[4]; /* text size in bytes, padded to FW bdry*/ - char dsize[4]; /* initialized data " " */ - char bsize[4]; /* uninitialized data " " */ - char entry[4]; /* entry pt. */ - char text_start[4]; /* base of text used for this file */ - char data_start[4]; /* base of data used for this file */ -} -AOUTHDR; - - -/* compute size of a header */ - -#define AOUTSZ (sizeof(AOUTHDR)) - - -/********************** SECTION HEADER **********************/ - - -struct external_scnhdr -{ - char s_name[8]; /* section name */ - char s_paddr[4]; /* physical address, aliased s_nlib */ - char s_vaddr[4]; /* virtual address */ - char s_size[4]; /* section size */ - char s_scnptr[4]; /* file ptr to raw data for section */ - char s_relptr[4]; /* file ptr to relocation */ - char s_lnnoptr[4]; /* file ptr to line numbers */ - char s_nreloc[4]; /* number of relocation entries */ - char s_nlnno[4]; /* number of line number entries*/ - char s_flags[4]; /* flags */ -}; - - -#define SCNHDR struct external_scnhdr -#define SCNHSZ sizeof(SCNHDR) - -/* - * names of "special" sections - */ -#define _TEXT ".text" -#define _DATA ".data" -#define _BSS ".bss" -#define _COMMENT ".comment" - -/********************** LINE NUMBERS **********************/ - -/* 1 line number entry for every "breakpointable" source line in a section. - * Line numbers are grouped on a per function basis; first entry in a function - * grouping will have l_lnno = 0 and in place of physical address will be the - * symbol table index of the function name. - */ -struct external_lineno{ - union { - char l_symndx[4]; /* function name symbol index, iff l_lnno == 0*/ - char l_paddr[4]; /* (physical) address of line number */ - } l_addr; - - char l_lnno[4]; - -}; - -#define LINENO struct external_lineno -#define LINESZ 8 - - -/********************** SYMBOLS **********************/ - -#define E_SYMNMLEN 8 /* # characters in a symbol name */ -#define E_FILNMLEN 14 /* # characters in a file name */ -#define E_DIMNUM 4 /* # array dimensions in auxiliary entry */ - -struct external_syment -{ - union { - char e_name[E_SYMNMLEN]; - struct { - char e_zeroes[4]; - char e_offset[4]; - } e; - } e; - char e_value[4]; - char e_scnum[2]; - char e_type[2]; - char e_sclass[1]; - char e_numaux[1]; - char pad2[2]; -}; - - - - -#define N_BTMASK 017 -#define N_TMASK 060 -#define N_BTSHFT 4 -#define N_TSHIFT 2 - - -/* Note that this isn't the same shape as other coffs */ -union external_auxent { - struct { - char x_tagndx[4]; /* str, un, or enum tag indx */ - /* 4 */ - union { - char x_fsize[4]; /* size of function */ - struct { - char x_lnno[4]; /* declaration line number */ - char x_size[4]; /* str/union/array size */ - } x_lnsz; - } x_misc; - - /* 12 */ - union { - struct { /* if ISFCN, tag, or .bb */ - char x_lnnoptr[4]; /* ptr to fcn line # */ - char x_endndx[4]; /* entry ndx past block end */ - } x_fcn; - struct { /* if ISARY, up to 4 dimen. */ - char x_dimen[E_DIMNUM][2]; - } x_ary; - } x_fcnary; - /* 20 */ - - } x_sym; - - union { - char x_fname[E_FILNMLEN]; - struct { - char x_zeroes[4]; - char x_offset[4]; - } x_n; - } x_file; - - struct { - char x_scnlen[4]; /* section length */ - char x_nreloc[4]; /* # relocation entries */ - char x_nlinno[4]; /* # line numbers */ - } x_scn; - - struct { - char x_tvfill[4]; /* tv fill value */ - char x_tvlen[2]; /* length of .tv */ - char x_tvran[2][2]; /* tv range */ - } x_tv; /* info about .tv section (in auxent of symbol .tv)) */ - -}; - -#define GET_FCN_LNNOPTR(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *)ext->x_sym.x_fcnary.x_fcn.x_lnnoptr) -#define GET_FCN_ENDNDX(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_endndx) -#define PUT_FCN_LNNOPTR(abfd, in, ext) bfd_h_put_32(abfd, in, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_lnnoptr) -#define PUT_FCN_ENDNDX(abfd, in, ext) bfd_h_put_32(abfd, in, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_endndx) -#define GET_LNSZ_SIZE(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *) ext->x_sym.x_misc.x_lnsz.x_size) -#define GET_LNSZ_LNNO(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *) ext->x_sym.x_misc.x_lnsz.x_lnno) -#define PUT_LNSZ_LNNO(abfd, in, ext) bfd_h_put_32(abfd, in, (bfd_byte *) ext->x_sym.x_misc.x_lnsz.x_lnno) -#define PUT_LNSZ_SIZE(abfd, in, ext) bfd_h_put_32(abfd, in, (bfd_byte *) ext->x_sym.x_misc.x_lnsz.x_size) -#define GET_SCN_SCNLEN(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *) ext->x_scn.x_scnlen) -#define GET_SCN_NRELOC(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *) ext->x_scn.x_nreloc) -#define GET_SCN_NLINNO(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *) ext->x_scn.x_nlinno) -#define PUT_SCN_SCNLEN(abfd,in, ext) bfd_h_put_32(abfd, in, (bfd_byte *) ext->x_scn.x_scnlen) -#define PUT_SCN_NRELOC(abfd,in, ext) bfd_h_put_32(abfd, in, (bfd_byte *)ext->x_scn.x_nreloc) -#define PUT_SCN_NLINNO(abfd,in, ext) bfd_h_put_32(abfd,in, (bfd_byte *) ext->x_scn.x_nlinno) -#define GET_LINENO_LNNO(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *) (ext->l_lnno)) -#define PUT_LINENO_LNNO(abfd,val, ext) bfd_h_put_32(abfd,val, (bfd_byte *) (ext->l_lnno)); - - - -#define SYMENT struct external_syment -#define SYMESZ 20 -#define AUXENT union external_auxent -#define AUXESZ 20 - - -/********************** RELOCATION DIRECTIVES **********************/ - -struct external_reloc { - char r_vaddr[4]; - char r_symndx[4]; - char r_type[2]; - char r_offset[2]; -}; - -#define RELOC struct external_reloc -#define RELSZ 12 - -#define NO_TVNDX diff --git a/contrib/gdb/include/coff/mips.h b/contrib/gdb/include/coff/mips.h deleted file mode 100644 index f35187e..0000000 --- a/contrib/gdb/include/coff/mips.h +++ /dev/null @@ -1,368 +0,0 @@ -/* ECOFF support on MIPS machines. - coff/ecoff.h must be included before this file. */ - -/********************** FILE HEADER **********************/ - -struct external_filehdr { - unsigned char f_magic[2]; /* magic number */ - unsigned char f_nscns[2]; /* number of sections */ - unsigned char f_timdat[4]; /* time & date stamp */ - unsigned char f_symptr[4]; /* file pointer to symtab */ - unsigned char f_nsyms[4]; /* number of symtab entries */ - unsigned char f_opthdr[2]; /* sizeof(optional hdr) */ - unsigned char f_flags[2]; /* flags */ -}; - -/* Magic numbers are defined in coff/ecoff.h. */ -#define MIPS_ECOFF_BADMAG(x) (((x).f_magic!=MIPS_MAGIC_1) && \ - ((x).f_magic!=MIPS_MAGIC_LITTLE) &&\ - ((x).f_magic!=MIPS_MAGIC_BIG) && \ - ((x).f_magic!=MIPS_MAGIC_LITTLE2) && \ - ((x).f_magic!=MIPS_MAGIC_BIG2) && \ - ((x).f_magic!=MIPS_MAGIC_LITTLE3) && \ - ((x).f_magic!=MIPS_MAGIC_BIG3)) - -#define FILHDR struct external_filehdr -#define FILHSZ 20 - -/********************** AOUT "OPTIONAL HEADER" **********************/ - - -typedef struct external_aouthdr -{ - unsigned char magic[2]; /* type of file */ - unsigned char vstamp[2]; /* version stamp */ - unsigned char tsize[4]; /* text size in bytes, padded to FW bdry*/ - unsigned char dsize[4]; /* initialized data " " */ - unsigned char bsize[4]; /* uninitialized data " " */ - unsigned char entry[4]; /* entry pt. */ - unsigned char text_start[4]; /* base of text used for this file */ - unsigned char data_start[4]; /* base of data used for this file */ - unsigned char bss_start[4]; /* base of bss used for this file */ - unsigned char gprmask[4]; /* ?? */ - unsigned char cprmask[4][4]; /* ?? */ - unsigned char gp_value[4]; /* value for gp register */ -} AOUTHDR; - -/* compute size of a header */ - -#define AOUTSZ (sizeof(AOUTHDR)) - -/********************** SECTION HEADER **********************/ - -struct external_scnhdr { - unsigned char s_name[8]; /* section name */ - unsigned char s_paddr[4]; /* physical address, aliased s_nlib */ - unsigned char s_vaddr[4]; /* virtual address */ - unsigned char s_size[4]; /* section size */ - unsigned char s_scnptr[4]; /* file ptr to raw data for section */ - unsigned char s_relptr[4]; /* file ptr to relocation */ - unsigned char s_lnnoptr[4]; /* file ptr to line numbers */ - unsigned char s_nreloc[2]; /* number of relocation entries */ - unsigned char s_nlnno[2]; /* number of line number entries*/ - unsigned char s_flags[4]; /* flags */ -}; - -#define SCNHDR struct external_scnhdr -#define SCNHSZ sizeof(SCNHDR) - -/********************** RELOCATION DIRECTIVES **********************/ - -struct external_reloc { - unsigned char r_vaddr[4]; - unsigned char r_bits[4]; -}; - -#define RELOC struct external_reloc -#define RELSZ 8 - -/* MIPS ECOFF uses a packed 8 byte format for relocs. These constants - are used to unpack the r_bits field. */ - -#define RELOC_BITS0_SYMNDX_SH_LEFT_BIG 16 -#define RELOC_BITS0_SYMNDX_SH_LEFT_LITTLE 0 - -#define RELOC_BITS1_SYMNDX_SH_LEFT_BIG 8 -#define RELOC_BITS1_SYMNDX_SH_LEFT_LITTLE 8 - -#define RELOC_BITS2_SYMNDX_SH_LEFT_BIG 0 -#define RELOC_BITS2_SYMNDX_SH_LEFT_LITTLE 16 - -/* Originally, ECOFF used four bits for the reloc type and had three - reserved bits. Irix 4 added another bit for the reloc type, which - was easy because it was big endian and one of the spare bits became - the new most significant bit. To make this also work for little - endian ECOFF, we need to wrap one of the reserved bits around to - become the most significant bit of the reloc type. */ -#define RELOC_BITS3_TYPE_BIG 0x3E -#define RELOC_BITS3_TYPE_SH_BIG 1 -#define RELOC_BITS3_TYPE_LITTLE 0x78 -#define RELOC_BITS3_TYPE_SH_LITTLE 3 -#define RELOC_BITS3_TYPEHI_LITTLE 0x04 -#define RELOC_BITS3_TYPEHI_SH_LITTLE 2 - -#define RELOC_BITS3_EXTERN_BIG 0x01 -#define RELOC_BITS3_EXTERN_LITTLE 0x80 - -/* The r_type field in a reloc is one of the following values. I - don't know if any other values can appear. These seem to be all - that occur in the Ultrix 4.2 libraries. */ -#define MIPS_R_IGNORE 0 -#define MIPS_R_REFHALF 1 -#define MIPS_R_REFWORD 2 -#define MIPS_R_JMPADDR 3 -#define MIPS_R_REFHI 4 -#define MIPS_R_REFLO 5 -#define MIPS_R_GPREL 6 -#define MIPS_R_LITERAL 7 - -/* These reloc types are a Cygnus extension used when generating - position independent code for embedded systems. The numbers are - taken from Irix 4, but at least for internal relocs Irix 5 does not - give them the same meaning. For an internal reloc the symbol index - of RELHI and RELLO is modified as described below for - MIPS_R_SWITCH. */ -#define MIPS_R_PCREL16 12 -#define MIPS_R_RELHI 13 -#define MIPS_R_RELLO 14 - -/* This reloc type is a Cygnus extension used when generating position - independent code for embedded systems. It is used for an entry in - a switch table, which looks like this: - .word $L3-$LS12 - The object file will contain the correct difference, and does not - require adjustment. However, when the linker is relaxing PC - relative calls, it is possible for $L3 to move farther away. This - reloc always appears in the .text section, and is always against - the .text section. However, the symbol index is not - RELOC_SECTION_TEXT. It is, instead, the distance between this - switch table entry and $LS12. Thus, the original value of $L12 is - vaddr - symndx - and the original value of $L3 is - vaddr - symndx + addend - where addend is the value in the object file. Knowing this, the - linker can know whether the addend in the object file must be - adjusted. */ -#define MIPS_R_SWITCH 22 - -/********************** STABS **********************/ - -#define MIPS_IS_STAB ECOFF_IS_STAB -#define MIPS_MARK_STAB ECOFF_MARK_STAB -#define MIPS_UNMARK_STAB ECOFF_UNMARK_STAB - -/********************** SYMBOLIC INFORMATION **********************/ - -/* Written by John Gilmore. */ - -/* ECOFF uses COFF-like section structures, but its own symbol format. - This file defines the symbol format in fields whose size and alignment - will not vary on different host systems. */ - -/* File header as a set of bytes */ - -struct hdr_ext { - unsigned char h_magic[2]; - unsigned char h_vstamp[2]; - unsigned char h_ilineMax[4]; - unsigned char h_cbLine[4]; - unsigned char h_cbLineOffset[4]; - unsigned char h_idnMax[4]; - unsigned char h_cbDnOffset[4]; - unsigned char h_ipdMax[4]; - unsigned char h_cbPdOffset[4]; - unsigned char h_isymMax[4]; - unsigned char h_cbSymOffset[4]; - unsigned char h_ioptMax[4]; - unsigned char h_cbOptOffset[4]; - unsigned char h_iauxMax[4]; - unsigned char h_cbAuxOffset[4]; - unsigned char h_issMax[4]; - unsigned char h_cbSsOffset[4]; - unsigned char h_issExtMax[4]; - unsigned char h_cbSsExtOffset[4]; - unsigned char h_ifdMax[4]; - unsigned char h_cbFdOffset[4]; - unsigned char h_crfd[4]; - unsigned char h_cbRfdOffset[4]; - unsigned char h_iextMax[4]; - unsigned char h_cbExtOffset[4]; -}; - -/* File descriptor external record */ - -struct fdr_ext { - unsigned char f_adr[4]; - unsigned char f_rss[4]; - unsigned char f_issBase[4]; - unsigned char f_cbSs[4]; - unsigned char f_isymBase[4]; - unsigned char f_csym[4]; - unsigned char f_ilineBase[4]; - unsigned char f_cline[4]; - unsigned char f_ioptBase[4]; - unsigned char f_copt[4]; - unsigned char f_ipdFirst[2]; - unsigned char f_cpd[2]; - unsigned char f_iauxBase[4]; - unsigned char f_caux[4]; - unsigned char f_rfdBase[4]; - unsigned char f_crfd[4]; - unsigned char f_bits1[1]; - unsigned char f_bits2[3]; - unsigned char f_cbLineOffset[4]; - unsigned char f_cbLine[4]; -}; - -#define FDR_BITS1_LANG_BIG 0xF8 -#define FDR_BITS1_LANG_SH_BIG 3 -#define FDR_BITS1_LANG_LITTLE 0x1F -#define FDR_BITS1_LANG_SH_LITTLE 0 - -#define FDR_BITS1_FMERGE_BIG 0x04 -#define FDR_BITS1_FMERGE_LITTLE 0x20 - -#define FDR_BITS1_FREADIN_BIG 0x02 -#define FDR_BITS1_FREADIN_LITTLE 0x40 - -#define FDR_BITS1_FBIGENDIAN_BIG 0x01 -#define FDR_BITS1_FBIGENDIAN_LITTLE 0x80 - -#define FDR_BITS2_GLEVEL_BIG 0xC0 -#define FDR_BITS2_GLEVEL_SH_BIG 6 -#define FDR_BITS2_GLEVEL_LITTLE 0x03 -#define FDR_BITS2_GLEVEL_SH_LITTLE 0 - -/* We ignore the `reserved' field in bits2. */ - -/* Procedure descriptor external record */ - -struct pdr_ext { - unsigned char p_adr[4]; - unsigned char p_isym[4]; - unsigned char p_iline[4]; - unsigned char p_regmask[4]; - unsigned char p_regoffset[4]; - unsigned char p_iopt[4]; - unsigned char p_fregmask[4]; - unsigned char p_fregoffset[4]; - unsigned char p_frameoffset[4]; - unsigned char p_framereg[2]; - unsigned char p_pcreg[2]; - unsigned char p_lnLow[4]; - unsigned char p_lnHigh[4]; - unsigned char p_cbLineOffset[4]; -}; - -/* Runtime procedure table */ - -struct rpdr_ext { - unsigned char p_adr[4]; - unsigned char p_regmask[4]; - unsigned char p_regoffset[4]; - unsigned char p_fregmask[4]; - unsigned char p_fregoffset[4]; - unsigned char p_frameoffset[4]; - unsigned char p_framereg[2]; - unsigned char p_pcreg[2]; - unsigned char p_irpss[4]; - unsigned char p_reserved[4]; - unsigned char p_exception_info[4]; -}; - -/* Line numbers */ - -struct line_ext { - unsigned char l_line[4]; -}; - -/* Symbol external record */ - -struct sym_ext { - unsigned char s_iss[4]; - unsigned char s_value[4]; - unsigned char s_bits1[1]; - unsigned char s_bits2[1]; - unsigned char s_bits3[1]; - unsigned char s_bits4[1]; -}; - -#define SYM_BITS1_ST_BIG 0xFC -#define SYM_BITS1_ST_SH_BIG 2 -#define SYM_BITS1_ST_LITTLE 0x3F -#define SYM_BITS1_ST_SH_LITTLE 0 - -#define SYM_BITS1_SC_BIG 0x03 -#define SYM_BITS1_SC_SH_LEFT_BIG 3 -#define SYM_BITS1_SC_LITTLE 0xC0 -#define SYM_BITS1_SC_SH_LITTLE 6 - -#define SYM_BITS2_SC_BIG 0xE0 -#define SYM_BITS2_SC_SH_BIG 5 -#define SYM_BITS2_SC_LITTLE 0x07 -#define SYM_BITS2_SC_SH_LEFT_LITTLE 2 - -#define SYM_BITS2_RESERVED_BIG 0x10 -#define SYM_BITS2_RESERVED_LITTLE 0x08 - -#define SYM_BITS2_INDEX_BIG 0x0F -#define SYM_BITS2_INDEX_SH_LEFT_BIG 16 -#define SYM_BITS2_INDEX_LITTLE 0xF0 -#define SYM_BITS2_INDEX_SH_LITTLE 4 - -#define SYM_BITS3_INDEX_SH_LEFT_BIG 8 -#define SYM_BITS3_INDEX_SH_LEFT_LITTLE 4 - -#define SYM_BITS4_INDEX_SH_LEFT_BIG 0 -#define SYM_BITS4_INDEX_SH_LEFT_LITTLE 12 - -/* External symbol external record */ - -struct ext_ext { - unsigned char es_bits1[1]; - unsigned char es_bits2[1]; - unsigned char es_ifd[2]; - struct sym_ext es_asym; -}; - -#define EXT_BITS1_JMPTBL_BIG 0x80 -#define EXT_BITS1_JMPTBL_LITTLE 0x01 - -#define EXT_BITS1_COBOL_MAIN_BIG 0x40 -#define EXT_BITS1_COBOL_MAIN_LITTLE 0x02 - -#define EXT_BITS1_WEAKEXT_BIG 0x20 -#define EXT_BITS1_WEAKEXT_LITTLE 0x04 - -/* Dense numbers external record */ - -struct dnr_ext { - unsigned char d_rfd[4]; - unsigned char d_index[4]; -}; - -/* Relative file descriptor */ - -struct rfd_ext { - unsigned char rfd[4]; -}; - -/* Optimizer symbol external record */ - -struct opt_ext { - unsigned char o_bits1[1]; - unsigned char o_bits2[1]; - unsigned char o_bits3[1]; - unsigned char o_bits4[1]; - struct rndx_ext o_rndx; - unsigned char o_offset[4]; -}; - -#define OPT_BITS2_VALUE_SH_LEFT_BIG 16 -#define OPT_BITS2_VALUE_SH_LEFT_LITTLE 0 - -#define OPT_BITS3_VALUE_SH_LEFT_BIG 8 -#define OPT_BITS3_VALUE_SH_LEFT_LITTLE 8 - -#define OPT_BITS4_VALUE_SH_LEFT_BIG 0 -#define OPT_BITS4_VALUE_SH_LEFT_LITTLE 16 diff --git a/contrib/gdb/include/coff/pe.h b/contrib/gdb/include/coff/pe.h deleted file mode 100644 index f13b8b9..0000000 --- a/contrib/gdb/include/coff/pe.h +++ /dev/null @@ -1,161 +0,0 @@ -/* PE COFF header information */ - -#ifndef _PE_H -#define _PE_H - -/* NT specific file attributes */ -#define IMAGE_FILE_RELOCS_STRIPPED 0x0001 -#define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002 -#define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004 -#define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008 -#define IMAGE_FILE_BYTES_REVERSED_LO 0x0080 -#define IMAGE_FILE_32BIT_MACHINE 0x0100 -#define IMAGE_FILE_DEBUG_STRIPPED 0x0200 -#define IMAGE_FILE_SYSTEM 0x1000 -#define IMAGE_FILE_DLL 0x2000 -#define IMAGE_FILE_BYTES_REVERSED_HI 0x8000 - -/* additional flags to be set for section headers to allow the NT loader to - read and write to the section data (to replace the addresses of data in - dlls for one thing); also to execute the section in .text's case */ -#define IMAGE_SCN_MEM_DISCARDABLE 0x02000000 -#define IMAGE_SCN_MEM_EXECUTE 0x20000000 -#define IMAGE_SCN_MEM_READ 0x40000000 -#define IMAGE_SCN_MEM_WRITE 0x80000000 - -/* - * Section characteristics added for ppc-nt - */ - -#define IMAGE_SCN_TYPE_NO_PAD 0x00000008 /* Reserved. */ - -#define IMAGE_SCN_CNT_CODE 0x00000020 /* Section contains code. */ -#define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040 /* Section contains initialized data. */ -#define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080 /* Section contains uninitialized data. */ - -#define IMAGE_SCN_LNK_OTHER 0x00000100 /* Reserved. */ -#define IMAGE_SCN_LNK_INFO 0x00000200 /* Section contains comments or some other type of information. */ -#define IMAGE_SCN_LNK_REMOVE 0x00000800 /* Section contents will not become part of image. */ -#define IMAGE_SCN_LNK_COMDAT 0x00001000 /* Section contents comdat. */ - -#define IMAGE_SCN_MEM_FARDATA 0x00008000 - -#define IMAGE_SCN_MEM_PURGEABLE 0x00020000 -#define IMAGE_SCN_MEM_16BIT 0x00020000 -#define IMAGE_SCN_MEM_LOCKED 0x00040000 -#define IMAGE_SCN_MEM_PRELOAD 0x00080000 - -#define IMAGE_SCN_ALIGN_1BYTES 0x00100000 -#define IMAGE_SCN_ALIGN_2BYTES 0x00200000 -#define IMAGE_SCN_ALIGN_4BYTES 0x00300000 -#define IMAGE_SCN_ALIGN_8BYTES 0x00400000 -#define IMAGE_SCN_ALIGN_16BYTES 0x00500000 /* Default alignment if no others are specified. */ -#define IMAGE_SCN_ALIGN_32BYTES 0x00600000 -#define IMAGE_SCN_ALIGN_64BYTES 0x00700000 - - -#define IMAGE_SCN_LNK_NRELOC_OVFL 0x01000000 /* Section contains extended relocations. */ -#define IMAGE_SCN_MEM_NOT_CACHED 0x04000000 /* Section is not cachable. */ -#define IMAGE_SCN_MEM_NOT_PAGED 0x08000000 /* Section is not pageable. */ -#define IMAGE_SCN_MEM_SHARED 0x10000000 /* Section is shareable. */ - - -/* Magic values that are true for all dos/nt implementations */ -#define DOSMAGIC 0x5a4d -#define NT_SIGNATURE 0x00004550 - - /* NT allows long filenames, we want to accommodate this. This may break - some of the bfd functions */ -#undef FILNMLEN -#define FILNMLEN 18 /* # characters in a file name */ - - -#ifdef COFF_IMAGE_WITH_PE -/* The filehdr is only weired in images */ - -#undef FILHDR -struct external_PE_filehdr -{ - /* DOS header fields */ - char e_magic[2]; /* Magic number, 0x5a4d */ - char e_cblp[2]; /* Bytes on last page of file, 0x90 */ - char e_cp[2]; /* Pages in file, 0x3 */ - char e_crlc[2]; /* Relocations, 0x0 */ - char e_cparhdr[2]; /* Size of header in paragraphs, 0x4 */ - char e_minalloc[2]; /* Minimum extra paragraphs needed, 0x0 */ - char e_maxalloc[2]; /* Maximum extra paragraphs needed, 0xFFFF */ - char e_ss[2]; /* Initial (relative) SS value, 0x0 */ - char e_sp[2]; /* Initial SP value, 0xb8 */ - char e_csum[2]; /* Checksum, 0x0 */ - char e_ip[2]; /* Initial IP value, 0x0 */ - char e_cs[2]; /* Initial (relative) CS value, 0x0 */ - char e_lfarlc[2]; /* File address of relocation table, 0x40 */ - char e_ovno[2]; /* Overlay number, 0x0 */ - char e_res[4][2]; /* Reserved words, all 0x0 */ - char e_oemid[2]; /* OEM identifier (for e_oeminfo), 0x0 */ - char e_oeminfo[2]; /* OEM information; e_oemid specific, 0x0 */ - char e_res2[10][2]; /* Reserved words, all 0x0 */ - char e_lfanew[4]; /* File address of new exe header, 0x80 */ - char dos_message[16][4]; /* other stuff, always follow DOS header */ - char nt_signature[4]; /* required NT signature, 0x4550 */ - - /* From standard header */ - - - char f_magic[2]; /* magic number */ - char f_nscns[2]; /* number of sections */ - char f_timdat[4]; /* time & date stamp */ - char f_symptr[4]; /* file pointer to symtab */ - char f_nsyms[4]; /* number of symtab entries */ - char f_opthdr[2]; /* sizeof(optional hdr) */ - char f_flags[2]; /* flags */ - -}; - - -#define FILHDR struct external_PE_filehdr - - -#endif - -typedef struct -{ - AOUTHDR standard; - - /* NT extra fields; see internal.h for descriptions */ - char ImageBase[4]; - char SectionAlignment[4]; - char FileAlignment[4]; - char MajorOperatingSystemVersion[2]; - char MinorOperatingSystemVersion[2]; - char MajorImageVersion[2]; - char MinorImageVersion[2]; - char MajorSubsystemVersion[2]; - char MinorSubsystemVersion[2]; - char Reserved1[4]; - char SizeOfImage[4]; - char SizeOfHeaders[4]; - char CheckSum[4]; - char Subsystem[2]; - char DllCharacteristics[2]; - char SizeOfStackReserve[4]; - char SizeOfStackCommit[4]; - char SizeOfHeapReserve[4]; - char SizeOfHeapCommit[4]; - char LoaderFlags[4]; - char NumberOfRvaAndSizes[4]; - /* IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]; */ - char DataDirectory[16][2][4]; /* 16 entries, 2 elements/entry, 4 chars */ - -} PEAOUTHDR; - - -#undef AOUTSZ -#define AOUTSZ sizeof(PEAOUTHDR) - -#undef E_FILNMLEN -#define E_FILNMLEN 18 /* # characters in a file name */ -#endif - - - diff --git a/contrib/gdb/include/coff/powerpc.h b/contrib/gdb/include/coff/powerpc.h deleted file mode 100644 index 6866fc8..0000000 --- a/contrib/gdb/include/coff/powerpc.h +++ /dev/null @@ -1,196 +0,0 @@ -/* Basic coff information for the PowerPC - * - * Based on coff/rs6000.h, coff/i386.h and others. - * - * Initial release: Kim Knuttila (krk@cygnus.com) - */ - -/********************** FILE HEADER **********************/ - -struct external_filehdr { - char f_magic[2]; /* magic number */ - char f_nscns[2]; /* number of sections */ - char f_timdat[4]; /* time & date stamp */ - char f_symptr[4]; /* file pointer to symtab */ - char f_nsyms[4]; /* number of symtab entries */ - char f_opthdr[2]; /* sizeof(optional hdr) */ - char f_flags[2]; /* flags */ -}; - -#define FILHDR struct external_filehdr -#define FILHSZ sizeof(FILHDR) - -/* Bits for f_flags: - * F_RELFLG relocation info stripped from file - * F_EXEC file is executable (no unresolved external references) - * F_LNNO line numbers stripped from file - * F_LSYMS local symbols stripped from file - * F_AR32WR file has byte ordering of an AR32WR machine (e.g. vax) - */ - -#define F_RELFLG (0x0001) -#define F_EXEC (0x0002) -#define F_LNNO (0x0004) -#define F_LSYMS (0x0008) - -/* extra NT defines */ -#define PPCMAGIC 0760 /* peeked on aa PowerPC Windows NT box */ -#define DOSMAGIC 0x5a4d /* from arm.h, i386.h */ -#define NT_SIGNATURE 0x00004550 /* from arm.h, i386.h */ - -/* from winnt.h */ -#define IMAGE_NT_OPTIONAL_HDR_MAGIC 0x10b - -#define PPCBADMAG(x) ((x).f_magic != PPCMAGIC) - -/********************** AOUT "OPTIONAL HEADER" **********************/ - -typedef struct -{ - char magic[2]; /* type of file */ - char vstamp[2]; /* version stamp */ - char tsize[4]; /* text size in bytes, padded to FW bdry*/ - char dsize[4]; /* initialized data " " */ - char bsize[4]; /* uninitialized data " " */ - char entry[4]; /* entry pt. */ - char text_start[4]; /* base of text used for this file */ - char data_start[4]; /* base of data used for this file */ -} -AOUTHDR; - -#define AOUTSZ (sizeof(AOUTHDR)) - - -/********************** SECTION HEADER **********************/ - -struct external_scnhdr { - char s_name[8]; /* section name */ - char s_paddr[4]; /* physical address, aliased s_nlib */ - char s_vaddr[4]; /* virtual address */ - char s_size[4]; /* section size */ - char s_scnptr[4]; /* file ptr to raw data for section */ - char s_relptr[4]; /* file ptr to relocation */ - char s_lnnoptr[4]; /* file ptr to line numbers */ - char s_nreloc[2]; /* number of relocation entries */ - char s_nlnno[2]; /* number of line number entries */ - char s_flags[4]; /* flags */ -}; - -#define SCNHDR struct external_scnhdr -#define SCNHSZ sizeof(SCNHDR) - -/* - * names of "special" sections - */ -#define _TEXT ".text" -#define _DATA ".data" -#define _BSS ".bss" -#define _COMMENT ".comment" -#define _LIB ".lib" - -/********************** LINE NUMBERS **********************/ - -/* 1 line number entry for every "breakpointable" source line in a section. - * Line numbers are grouped on a per function basis; first entry in a function - * grouping will have l_lnno = 0 and in place of physical address will be the - * symbol table index of the function name. - */ -struct external_lineno { - union { - char l_symndx[4]; /* function name symbol index, iff l_lnno == 0 */ - char l_paddr[4]; /* (physical) address of line number */ - } l_addr; - char l_lnno[2]; /* line number */ -}; - -#define LINENO struct external_lineno -#define LINESZ 6 - -/********************** SYMBOLS **********************/ - -#define E_SYMNMLEN 8 /* # characters in a symbol name */ - -/* Allow the file name length to be overridden in the including file */ -#ifndef E_FILNMLEN -#define E_FILNMLEN 14 -#endif - -#define E_DIMNUM 4 /* # array dimensions in auxiliary entry */ - -struct external_syment -{ - union { - char e_name[E_SYMNMLEN]; - struct { - char e_zeroes[4]; - char e_offset[4]; - } e; - } e; - char e_value[4]; - char e_scnum[2]; - char e_type[2]; - char e_sclass[1]; - char e_numaux[1]; -}; - -#define SYMENT struct external_syment -#define SYMESZ 18 - -#define N_BTMASK (0xf) -#define N_TMASK (0x30) -#define N_BTSHFT (4) -#define N_TSHIFT (2) - -union external_auxent { - struct { - char x_tagndx[4]; /* str, un, or enum tag indx */ - union { - struct { - char x_lnno[2]; /* declaration line number */ - char x_size[2]; /* str/union/array size */ - } x_lnsz; - char x_fsize[4]; /* size of function */ - } x_misc; - union { - struct { /* if ISFCN, tag, or .bb */ - char x_lnnoptr[4]; /* ptr to fcn line # */ - char x_endndx[4]; /* entry ndx past block end */ - } x_fcn; - struct { /* if ISARY, up to 4 dimen. */ - char x_dimen[E_DIMNUM][2]; - } x_ary; - } x_fcnary; - char x_tvndx[2]; /* tv index */ - } x_sym; - - union { - char x_fname[E_FILNMLEN]; - struct { - char x_zeroes[4]; - char x_offset[4]; - } x_n; - } x_file; - - struct { - char x_scnlen[4]; /* section length */ - char x_nreloc[2]; /* # relocation entries */ - char x_nlinno[2]; /* # line numbers */ - } x_scn; -}; - -#define AUXENT union external_auxent -#define AUXESZ 18 - -#define _ETEXT "etext" - -/********************** RELOCATION DIRECTIVES **********************/ - -struct external_reloc { - char r_vaddr[4]; - char r_symndx[4]; - char r_type[2]; -}; - -#define RELOC struct external_reloc -#define RELSZ 10 - diff --git a/contrib/gdb/include/coff/rs6000.h b/contrib/gdb/include/coff/rs6000.h deleted file mode 100644 index 62a6f86..0000000 --- a/contrib/gdb/include/coff/rs6000.h +++ /dev/null @@ -1,242 +0,0 @@ -/* IBM RS/6000 "XCOFF" file definitions for BFD. - Copyright (C) 1990, 1991 Free Software Foundation, Inc. - FIXME: Can someone provide a transliteration of this name into ASCII? - Using the following chars caused a compiler warning on HIUX (so I replaced - them with octal escapes), and isn't useful without an understanding of what - character set it is. - Written by Mimi Ph\373\364ng-Th\345o V\365 of IBM - and John Gilmore of Cygnus Support. */ - -/********************** FILE HEADER **********************/ - -struct external_filehdr { - char f_magic[2]; /* magic number */ - char f_nscns[2]; /* number of sections */ - char f_timdat[4]; /* time & date stamp */ - char f_symptr[4]; /* file pointer to symtab */ - char f_nsyms[4]; /* number of symtab entries */ - char f_opthdr[2]; /* sizeof(optional hdr) */ - char f_flags[2]; /* flags */ -}; - - /* IBM RS/6000 */ -#define U802WRMAGIC 0730 /* writeable text segments **chh** */ -#define U802ROMAGIC 0735 /* readonly sharable text segments */ -#define U802TOCMAGIC 0737 /* readonly text segments and TOC */ - -#define BADMAG(x) \ - ((x).f_magic != U802ROMAGIC && (x).f_magic != U802WRMAGIC && \ - (x).f_magic != U802TOCMAGIC) - -#define FILHDR struct external_filehdr -#define FILHSZ sizeof(FILHDR) - - -/********************** AOUT "OPTIONAL HEADER" **********************/ - - -typedef struct -{ - unsigned char magic[2]; /* type of file */ - unsigned char vstamp[2]; /* version stamp */ - unsigned char tsize[4]; /* text size in bytes, padded to FW bdry */ - unsigned char dsize[4]; /* initialized data " " */ - unsigned char bsize[4]; /* uninitialized data " " */ - unsigned char entry[4]; /* entry pt. */ - unsigned char text_start[4]; /* base of text used for this file */ - unsigned char data_start[4]; /* base of data used for this file */ - unsigned char o_toc[4]; /* address of TOC */ - unsigned char o_snentry[2]; /* section number of entry point */ - unsigned char o_sntext[2]; /* section number of .text section */ - unsigned char o_sndata[2]; /* section number of .data section */ - unsigned char o_sntoc[2]; /* section number of TOC */ - unsigned char o_snloader[2]; /* section number of .loader section */ - unsigned char o_snbss[2]; /* section number of .bss section */ - unsigned char o_algntext[2]; /* .text alignment */ - unsigned char o_algndata[2]; /* .data alignment */ - unsigned char o_modtype[2]; /* module type (??) */ - unsigned char o_cputype[2]; /* cpu type */ - unsigned char o_maxstack[4]; /* max stack size (??) */ - unsigned char o_maxdata[4]; /* max data size (??) */ - unsigned char o_resv2[12]; /* reserved */ -} -AOUTHDR; - -#define AOUTSZ (sizeof(AOUTHDR)) -#define SMALL_AOUTSZ (28) - -#define RS6K_AOUTHDR_OMAGIC 0x0107 /* old: text & data writeable */ -#define RS6K_AOUTHDR_NMAGIC 0x0108 /* new: text r/o, data r/w */ -#define RS6K_AOUTHDR_ZMAGIC 0x010B /* paged: text r/o, both page-aligned */ - - -/********************** SECTION HEADER **********************/ - - -struct external_scnhdr { - char s_name[8]; /* section name */ - char s_paddr[4]; /* physical address, aliased s_nlib */ - char s_vaddr[4]; /* virtual address */ - char s_size[4]; /* section size */ - char s_scnptr[4]; /* file ptr to raw data for section */ - char s_relptr[4]; /* file ptr to relocation */ - char s_lnnoptr[4]; /* file ptr to line numbers */ - char s_nreloc[2]; /* number of relocation entries */ - char s_nlnno[2]; /* number of line number entries*/ - char s_flags[4]; /* flags */ -}; - -/* - * names of "special" sections - */ -#define _TEXT ".text" -#define _DATA ".data" -#define _BSS ".bss" -#define _PAD ".pad" -#define _LOADER ".loader" - -#define SCNHDR struct external_scnhdr -#define SCNHSZ sizeof(SCNHDR) - -/* XCOFF uses a special .loader section with type STYP_LOADER. */ -#define STYP_LOADER 0x1000 - -/* XCOFF uses a special .debug section with type STYP_DEBUG. */ -#define STYP_DEBUG 0x2000 - -/* XCOFF handles line number or relocation overflow by creating - another section header with STYP_OVRFLO set. */ -#define STYP_OVRFLO 0x8000 - -/********************** LINE NUMBERS **********************/ - -/* 1 line number entry for every "breakpointable" source line in a section. - * Line numbers are grouped on a per function basis; first entry in a function - * grouping will have l_lnno = 0 and in place of physical address will be the - * symbol table index of the function name. - */ -struct external_lineno { - union { - char l_symndx[4]; /* function name symbol index, iff l_lnno == 0*/ - char l_paddr[4]; /* (physical) address of line number */ - } l_addr; - char l_lnno[2]; /* line number */ -}; - - -#define LINENO struct external_lineno -#define LINESZ sizeof(LINENO) - - -/********************** SYMBOLS **********************/ - -#define E_SYMNMLEN 8 /* # characters in a symbol name */ -#define E_FILNMLEN 14 /* # characters in a file name */ -#define E_DIMNUM 4 /* # array dimensions in auxiliary entry */ - -struct external_syment -{ - union { - char e_name[E_SYMNMLEN]; - struct { - char e_zeroes[4]; - char e_offset[4]; - } e; - } e; - char e_value[4]; - char e_scnum[2]; - char e_type[2]; - char e_sclass[1]; - char e_numaux[1]; -}; - - - -#define N_BTMASK (017) -#define N_TMASK (060) -#define N_BTSHFT (4) -#define N_TSHIFT (2) - - -union external_auxent { - struct { - char x_tagndx[4]; /* str, un, or enum tag indx */ - union { - struct { - char x_lnno[2]; /* declaration line number */ - char x_size[2]; /* str/union/array size */ - } x_lnsz; - char x_fsize[4]; /* size of function */ - } x_misc; - union { - struct { /* if ISFCN, tag, or .bb */ - char x_lnnoptr[4]; /* ptr to fcn line # */ - char x_endndx[4]; /* entry ndx past block end */ - } x_fcn; - struct { /* if ISARY, up to 4 dimen. */ - char x_dimen[E_DIMNUM][2]; - } x_ary; - } x_fcnary; - char x_tvndx[2]; /* tv index */ - } x_sym; - - union { - char x_fname[E_FILNMLEN]; - struct { - char x_zeroes[4]; - char x_offset[4]; - } x_n; - } x_file; - - struct { - char x_scnlen[4]; /* section length */ - char x_nreloc[2]; /* # relocation entries */ - char x_nlinno[2]; /* # line numbers */ - } x_scn; - - struct { - char x_tvfill[4]; /* tv fill value */ - char x_tvlen[2]; /* length of .tv */ - char x_tvran[2][2]; /* tv range */ - } x_tv; /* info about .tv section (in auxent of symbol .tv)) */ - - struct { - unsigned char x_scnlen[4]; - unsigned char x_parmhash[4]; - unsigned char x_snhash[2]; - unsigned char x_smtyp[1]; - unsigned char x_smclas[1]; - unsigned char x_stab[4]; - unsigned char x_snstab[2]; - } x_csect; - -}; - -#define SYMENT struct external_syment -#define SYMESZ 18 -#define AUXENT union external_auxent -#define AUXESZ 18 -#define DBXMASK 0x80 /* for dbx storage mask */ -#define SYMNAME_IN_DEBUG(symptr) ((symptr)->n_sclass & DBXMASK) - - - -/********************** RELOCATION DIRECTIVES **********************/ - - -struct external_reloc { - char r_vaddr[4]; - char r_symndx[4]; - char r_size[1]; - char r_type[1]; -}; - - -#define RELOC struct external_reloc -#define RELSZ 10 - -#define DEFAULT_DATA_SECTION_ALIGNMENT 4 -#define DEFAULT_BSS_SECTION_ALIGNMENT 4 -#define DEFAULT_TEXT_SECTION_ALIGNMENT 4 -/* For new sections we havn't heard of before */ -#define DEFAULT_SECTION_ALIGNMENT 4 diff --git a/contrib/gdb/include/coff/sh.h b/contrib/gdb/include/coff/sh.h deleted file mode 100644 index af49674..0000000 --- a/contrib/gdb/include/coff/sh.h +++ /dev/null @@ -1,253 +0,0 @@ -/*** coff information for Hitachi SH */ - -/********************** FILE HEADER **********************/ - -struct external_filehdr { - char f_magic[2]; /* magic number */ - char f_nscns[2]; /* number of sections */ - char f_timdat[4]; /* time & date stamp */ - char f_symptr[4]; /* file pointer to symtab */ - char f_nsyms[4]; /* number of symtab entries */ - char f_opthdr[2]; /* sizeof(optional hdr) */ - char f_flags[2]; /* flags */ -}; - - - -#define SH_ARCH_MAGIC_BIG 0x0500 -#define SH_ARCH_MAGIC_LITTLE 0x0550 /* Little endian SH */ - - -#define SHBADMAG(x) \ - (((x).f_magic!=SH_ARCH_MAGIC_BIG) && \ - ((x).f_magic!=SH_ARCH_MAGIC_LITTLE)) - -#define FILHDR struct external_filehdr -#define FILHSZ sizeof(FILHDR) - - -/********************** AOUT "OPTIONAL HEADER" **********************/ - - -typedef struct -{ - char magic[2]; /* type of file */ - char vstamp[2]; /* version stamp */ - char tsize[4]; /* text size in bytes, padded to FW bdry*/ - char dsize[4]; /* initialized data " " */ - char bsize[4]; /* uninitialized data " " */ - char entry[4]; /* entry pt. */ - char text_start[4]; /* base of text used for this file */ - char data_start[4]; /* base of data used for this file */ -} -AOUTHDR; - - -#define AOUTHDRSZ (sizeof(AOUTHDR)) -#define AOUTSZ (sizeof(AOUTHDR)) - - - - -/********************** SECTION HEADER **********************/ - - -struct external_scnhdr { - char s_name[8]; /* section name */ - char s_paddr[4]; /* physical address, aliased s_nlib */ - char s_vaddr[4]; /* virtual address */ - char s_size[4]; /* section size */ - char s_scnptr[4]; /* file ptr to raw data for section */ - char s_relptr[4]; /* file ptr to relocation */ - char s_lnnoptr[4]; /* file ptr to line numbers */ - char s_nreloc[2]; /* number of relocation entries */ - char s_nlnno[2]; /* number of line number entries*/ - char s_flags[4]; /* flags */ -}; - -/* - * names of "special" sections - */ -#define _TEXT ".text" -#define _DATA ".data" -#define _BSS ".bss" - - -#define SCNHDR struct external_scnhdr -#define SCNHSZ sizeof(SCNHDR) - - -/********************** LINE NUMBERS **********************/ - -/* 1 line number entry for every "breakpointable" source line in a section. - * Line numbers are grouped on a per function basis; first entry in a function - * grouping will have l_lnno = 0 and in place of physical address will be the - * symbol table index of the function name. - */ -struct external_lineno { - union { - char l_symndx[4]; /* function name symbol index, iff l_lnno == 0*/ - char l_paddr[4]; /* (physical) address of line number */ - } l_addr; - char l_lnno[4]; /* line number */ -}; - -#define GET_LINENO_LNNO(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *) (ext->l_lnno)); -#define PUT_LINENO_LNNO(abfd,val, ext) bfd_h_put_32(abfd,val, (bfd_byte *) (ext->l_lnno)); - -#define LINENO struct external_lineno -#define LINESZ sizeof(LINENO) - - -/********************** SYMBOLS **********************/ - -#define E_SYMNMLEN 8 /* # characters in a symbol name */ -#define E_FILNMLEN 14 /* # characters in a file name */ -#define E_DIMNUM 4 /* # array dimensions in auxiliary entry */ - -struct external_syment -{ - union { - char e_name[E_SYMNMLEN]; - struct { - char e_zeroes[4]; - char e_offset[4]; - } e; - } e; - char e_value[4]; - char e_scnum[2]; - char e_type[2]; - char e_sclass[1]; - char e_numaux[1]; -}; - - - -#define N_BTMASK (017) -#define N_TMASK (060) -#define N_BTSHFT (4) -#define N_TSHIFT (2) - - -union external_auxent { - struct { - char x_tagndx[4]; /* str, un, or enum tag indx */ - union { - struct { - char x_lnno[2]; /* declaration line number */ - char x_size[2]; /* str/union/array size */ - } x_lnsz; - char x_fsize[4]; /* size of function */ - } x_misc; - union { - struct { /* if ISFCN, tag, or .bb */ - char x_lnnoptr[4]; /* ptr to fcn line # */ - char x_endndx[4]; /* entry ndx past block end */ - } x_fcn; - struct { /* if ISARY, up to 4 dimen. */ - char x_dimen[E_DIMNUM][2]; - } x_ary; - } x_fcnary; - char x_tvndx[2]; /* tv index */ - } x_sym; - - union { - char x_fname[E_FILNMLEN]; - struct { - char x_zeroes[4]; - char x_offset[4]; - } x_n; - } x_file; - - struct { - char x_scnlen[4]; /* section length */ - char x_nreloc[2]; /* # relocation entries */ - char x_nlinno[2]; /* # line numbers */ - } x_scn; - - struct { - char x_tvfill[4]; /* tv fill value */ - char x_tvlen[2]; /* length of .tv */ - char x_tvran[2][2]; /* tv range */ - } x_tv; /* info about .tv section (in auxent of symbol .tv)) */ - - -}; - -#define SYMENT struct external_syment -#define SYMESZ 18 -#define AUXENT union external_auxent -#define AUXESZ 18 - - - -/********************** RELOCATION DIRECTIVES **********************/ - -/* The external reloc has an offset field, because some of the reloc - types on the h8 don't have room in the instruction for the entire - offset - eg the strange jump and high page addressing modes */ - -struct external_reloc { - char r_vaddr[4]; - char r_symndx[4]; - char r_offset[4]; - char r_type[2]; - char r_stuff[2]; -}; - - -#define RELOC struct external_reloc -#define RELSZ 16 - -/* SH relocation types. Not all of these are actually used. */ - -#define R_SH_UNUSED 0 /* only used internally */ -#define R_SH_PCREL8 3 /* 8 bit pcrel */ -#define R_SH_PCREL16 4 /* 16 bit pcrel */ -#define R_SH_HIGH8 5 /* high 8 bits of 24 bit address */ -#define R_SH_LOW16 7 /* low 16 bits of 24 bit immediate */ -#define R_SH_IMM24 6 /* 24 bit immediate */ -#define R_SH_PCDISP8BY4 9 /* PC rel 8 bits *4 +ve */ -#define R_SH_PCDISP8BY2 10 /* PC rel 8 bits *2 +ve */ -#define R_SH_PCDISP8 11 /* 8 bit branch */ -#define R_SH_PCDISP 12 /* 12 bit branch */ -#define R_SH_IMM32 14 /* 32 bit immediate */ -#define R_SH_IMM8 16 /* 8 bit immediate */ -#define R_SH_IMM8BY2 17 /* 8 bit immediate *2 */ -#define R_SH_IMM8BY4 18 /* 8 bit immediate *4 */ -#define R_SH_IMM4 19 /* 4 bit immediate */ -#define R_SH_IMM4BY2 20 /* 4 bit immediate *2 */ -#define R_SH_IMM4BY4 21 /* 4 bit immediate *4 */ -#define R_SH_PCRELIMM8BY2 22 /* PC rel 8 bits *2 unsigned */ -#define R_SH_PCRELIMM8BY4 23 /* PC rel 8 bits *4 unsigned */ -#define R_SH_IMM16 24 /* 16 bit immediate */ - -/* The switch table reloc types are used for relaxing. They are - generated for expressions such as - .word L1 - L2 - The r_offset field holds the difference between the reloc address - and L2. */ -#define R_SH_SWITCH16 25 /* 16 bit switch table entry */ -#define R_SH_SWITCH32 26 /* 16 bit switch table entry */ - -/* The USES reloc type is used for relaxing. The compiler will - generate .uses pseudo-ops when it finds a function call which it - can relax. The r_offset field of the USES reloc holds the PC - relative offset to the instruction which loads the register used in - the function call. */ -#define R_SH_USES 27 /* .uses pseudo-op */ - -/* The COUNT reloc type is used for relaxing. The assembler will - generate COUNT relocs for addresses referred to by the register - loads associated with USES relocs. The r_offset field of the COUNT - reloc holds the number of times the address is references in the - object file. */ -#define R_SH_COUNT 28 /* Count of constant pool uses */ - -/* The ALIGN reloc type is used for relaxing. The r_offset field is - the power of two to which subsequent portions of the object file - must be aligned. */ -#define R_SH_ALIGN 29 /* .align pseudo-op */ - - - diff --git a/contrib/gdb/include/coff/sparc.h b/contrib/gdb/include/coff/sparc.h deleted file mode 100644 index 0e3217b..0000000 --- a/contrib/gdb/include/coff/sparc.h +++ /dev/null @@ -1,209 +0,0 @@ -/*** coff information for Sparc. */ - -/* This file is an amalgamation of several standard include files that - define coff format, such as filehdr.h, aouthdr.h, and so forth. In - addition, all datatypes have been translated into character arrays of - (presumed) equivalent size. This is necessary so that this file can - be used with different systems while still yielding the same results. */ - -/********************** FILE HEADER **********************/ - -struct external_filehdr -{ - char f_magic[2]; /* magic number */ - char f_nscns[2]; /* number of sections */ - char f_timdat[4]; /* time & date stamp */ - char f_symptr[4]; /* file pointer to symtab */ - char f_nsyms[4]; /* number of symtab entries */ - char f_opthdr[2]; /* sizeof(optional hdr) */ - char f_flags[2]; /* flags */ -}; - -#define F_RELFLG (0x0001) /* relocation info stripped */ -#define F_EXEC (0x0002) /* file is executable */ -#define F_LNNO (0x0004) /* line numbers stripped */ -#define F_LSYMS (0x0008) /* local symbols stripped */ - -#define SPARCMAGIC (0540) - -/* This is Lynx's all-platform magic number for executables. */ - -#define LYNXCOFFMAGIC (0415) - -#define FILHDR struct external_filehdr -#define FILHSZ sizeof(FILHDR) - -/********************** AOUT "OPTIONAL HEADER" **********************/ - -typedef struct -{ - char magic[2]; /* type of file */ - char vstamp[2]; /* version stamp */ - char tsize[4]; /* text size in bytes, padded to FW bdry*/ - char dsize[4]; /* initialized data " " */ - char bsize[4]; /* uninitialized data " " */ - char entry[4]; /* entry pt. */ - char text_start[4]; /* base of text used for this file */ - char data_start[4]; /* base of data used for this file */ -} -AOUTHDR; - -#define AOUTSZ (sizeof(AOUTHDR)) - -#define OMAGIC 0404 /* object files, eg as output */ -#define ZMAGIC 0413 /* demand load format, eg normal ld output */ -#define STMAGIC 0401 /* target shlib */ -#define SHMAGIC 0443 /* host shlib */ - -/********************** SECTION HEADER **********************/ - -struct external_scnhdr -{ - char s_name[8]; /* section name */ - char s_paddr[4]; /* physical address, aliased s_nlib */ - char s_vaddr[4]; /* virtual address */ - char s_size[4]; /* section size */ - char s_scnptr[4]; /* file ptr to raw data for section */ - char s_relptr[4]; /* file ptr to relocation */ - char s_lnnoptr[4]; /* file ptr to line numbers */ - char s_nreloc[2]; /* number of relocation entries */ - char s_nlnno[2]; /* number of line number entries*/ - char s_flags[4]; /* flags */ -}; - -#define SCNHDR struct external_scnhdr -#define SCNHSZ sizeof(SCNHDR) - -/* Names of "special" sections. */ - -#define _TEXT ".text" -#define _DATA ".data" -#define _BSS ".bss" -#define _TV ".tv" -#define _INIT ".init" -#define _FINI ".fini" -#define _COMMENT ".comment" -#define _LIB ".lib" - -/********************** LINE NUMBERS **********************/ - -/* 1 line number entry for every "breakpointable" source line in a section. - Line numbers are grouped on a per function basis; first entry in a function - grouping will have l_lnno = 0 and in place of physical address will be the - symbol table index of the function name. */ - -struct external_lineno -{ - union { - char l_symndx[4]; /* fn name symbol index, iff l_lnno == 0 */ - char l_paddr[4]; /* (physical) address of line number */ - } l_addr; - char l_lnno[2]; /* line number */ -}; - -#define LINENO struct external_lineno -#define LINESZ (6) - -/********************** SYMBOLS **********************/ - -#define E_SYMNMLEN (8) /* # characters in a symbol name */ -#define E_FILNMLEN (14) /* # characters in a file name */ -#define E_DIMNUM (4) /* # array dimensions in auxiliary entry */ - -struct external_syment -{ - union { - char e_name[E_SYMNMLEN]; - struct { - char e_zeroes[4]; - char e_offset[4]; - } e; -#if 0 /* of doubtful value */ - char e_nptr[2][4]; - struct { - char e_leading_zero[1]; - char e_dbx_type[1]; - char e_dbx_desc[2]; - } e_dbx; -#endif - } e; - - char e_value[4]; - char e_scnum[2]; - char e_type[2]; - char e_sclass[1]; - char e_numaux[1]; - char padding[2]; -}; - -#define N_BTMASK (0xf) -#define N_TMASK (0x30) -#define N_BTSHFT (4) -#define N_TSHIFT (2) - -union external_auxent -{ - struct { - char x_tagndx[4]; /* str, un, or enum tag indx */ - union { - struct { - char x_lnno[2]; /* declaration line number */ - char x_size[2]; /* str/union/array size */ - } x_lnsz; - char x_fsize[4]; /* size of function */ - } x_misc; - union { - struct { /* if ISFCN, tag, or .bb */ - char x_lnnoptr[4]; /* ptr to fcn line # */ - char x_endndx[4]; /* entry ndx past block end */ - } x_fcn; - struct { /* if ISARY, up to 4 dimen. */ - char x_dimen[E_DIMNUM][2]; - } x_ary; - } x_fcnary; - char x_tvndx[2]; /* tv index */ - } x_sym; - - union { - char x_fname[E_FILNMLEN]; - struct { - char x_zeroes[4]; - char x_offset[4]; - } x_n; - } x_file; - - struct { - char x_scnlen[4]; /* section length */ - char x_nreloc[2]; /* # relocation entries */ - char x_nlinno[2]; /* # line numbers */ - } x_scn; - - struct { - char x_tvfill[4]; /* tv fill value */ - char x_tvlen[2]; /* length of .tv */ - char x_tvran[2][2]; /* tv range */ - } x_tv; /* .tv section info (in auxent of sym .tv)) */ - - char x_fill[20]; /* forces to 20-byte size */ -}; - -#define SYMENT struct external_syment -#define SYMESZ 20 -#define AUXENT union external_auxent -#define AUXESZ 20 - -#define _ETEXT "etext" - -/********************** RELOCATION DIRECTIVES **********************/ - -struct external_reloc { - char r_vaddr[4]; - char r_symndx[4]; - char r_type[2]; - char r_spare[2]; - char r_offset[4]; -}; - -#define RELOC struct external_reloc -#define RELSZ sizeof (RELOC) - diff --git a/contrib/gdb/include/coff/sym.h b/contrib/gdb/include/coff/sym.h deleted file mode 100644 index 76204af..0000000 --- a/contrib/gdb/include/coff/sym.h +++ /dev/null @@ -1,484 +0,0 @@ -/* Declarations of internal format of MIPS ECOFF symbols. - Originally contributed by MIPS Computer Systems and Third Eye Software. - Changes contributed by Cygnus Support are in the public domain. - - This file is just aggregated with the files that make up the GNU - release; it is not considered part of GAS, GDB, or other GNU - programs. */ - -/* - * |-----------------------------------------------------------| - * | Copyright (c) 1992, 1991, 1990 MIPS Computer Systems, Inc.| - * | MIPS Computer Systems, Inc. grants reproduction and use | - * | rights to all parties, PROVIDED that this comment is | - * | maintained in the copy. | - * |-----------------------------------------------------------| - */ -#ifndef _SYM_H -#define _SYM_H - -/* (C) Copyright 1984 by Third Eye Software, Inc. - * - * Third Eye Software, Inc. grants reproduction and use rights to - * all parties, PROVIDED that this comment is maintained in the copy. - * - * Third Eye makes no claims about the applicability of this - * symbol table to a particular use. - */ - -/* - * This file contains the definition of the Third Eye Symbol Table. - * - * Symbols are assumed to be in 'encounter order' - i.e. the order that - * the things they represent were encountered by the compiler/assembler/loader. - * EXCEPT for globals! These are assumed to be bunched together, - * probably right after the last 'normal' symbol. Globals ARE sorted - * in ascending order. - * - * ----------------------------------------------------------------------- - * A brief word about Third Eye naming/use conventions: - * - * All arrays and index's are 0 based. - * All "ifooMax" values are the highest legal value PLUS ONE. This makes - * them good for allocating arrays, etc. All checks are "ifoo < ifooMax". - * - * "isym" Index into the SYMbol table. - * "ipd" Index into the Procedure Descriptor array. - * "ifd" Index into the File Descriptor array. - * "iss" Index into String Space. - * "cb" Count of Bytes. - * "rgPd" array whose domain is "0..ipdMax-1" and RanGe is PDR. - * "rgFd" array whose domain is "0..ifdMax-1" and RanGe is FDR. - */ - - -/* - * Symbolic Header (HDR) structure. - * As long as all the pointers are set correctly, - * we don't care WHAT order the various sections come out in! - * - * A file produced solely for the use of CDB will probably NOT have - * any instructions or data areas in it, as these are available - * in the original. - */ - -typedef struct { - short magic; /* to verify validity of the table */ - short vstamp; /* version stamp */ - long ilineMax; /* number of line number entries */ - bfd_vma cbLine; /* number of bytes for line number entries */ - bfd_vma cbLineOffset; /* offset to start of line number entries*/ - long idnMax; /* max index into dense number table */ - bfd_vma cbDnOffset; /* offset to start dense number table */ - long ipdMax; /* number of procedures */ - bfd_vma cbPdOffset; /* offset to procedure descriptor table */ - long isymMax; /* number of local symbols */ - bfd_vma cbSymOffset; /* offset to start of local symbols*/ - long ioptMax; /* max index into optimization symbol entries */ - bfd_vma cbOptOffset; /* offset to optimization symbol entries */ - long iauxMax; /* number of auxillary symbol entries */ - bfd_vma cbAuxOffset; /* offset to start of auxillary symbol entries*/ - long issMax; /* max index into local strings */ - bfd_vma cbSsOffset; /* offset to start of local strings */ - long issExtMax; /* max index into external strings */ - bfd_vma cbSsExtOffset; /* offset to start of external strings */ - long ifdMax; /* number of file descriptor entries */ - bfd_vma cbFdOffset; /* offset to file descriptor table */ - long crfd; /* number of relative file descriptor entries */ - bfd_vma cbRfdOffset; /* offset to relative file descriptor table */ - long iextMax; /* max index into external symbols */ - bfd_vma cbExtOffset; /* offset to start of external symbol entries*/ - /* If you add machine dependent fields, add them here */ - } HDRR, *pHDRR; -#define cbHDRR sizeof(HDRR) -#define hdrNil ((pHDRR)0) - -/* - * The FDR and PDR structures speed mapping of address <-> name. - * They are sorted in ascending memory order and are kept in - * memory by CDB at runtime. - */ - -/* - * File Descriptor - * - * There is one of these for EVERY FILE, whether compiled with - * full debugging symbols or not. The name of a file should be - * the path name given to the compiler. This allows the user - * to simply specify the names of the directories where the COMPILES - * were done, and we will be able to find their files. - * A field whose comment starts with "R - " indicates that it will be - * setup at runtime. - */ -typedef struct fdr { - bfd_vma adr; /* memory address of beginning of file */ - long rss; /* file name (of source, if known) */ - long issBase; /* file's string space */ - bfd_vma cbSs; /* number of bytes in the ss */ - long isymBase; /* beginning of symbols */ - long csym; /* count file's of symbols */ - long ilineBase; /* file's line symbols */ - long cline; /* count of file's line symbols */ - long ioptBase; /* file's optimization entries */ - long copt; /* count of file's optimization entries */ - unsigned short ipdFirst;/* start of procedures for this file */ - short cpd; /* count of procedures for this file */ - long iauxBase; /* file's auxiliary entries */ - long caux; /* count of file's auxiliary entries */ - long rfdBase; /* index into the file indirect table */ - long crfd; /* count file indirect entries */ - unsigned lang: 5; /* language for this file */ - unsigned fMerge : 1; /* whether this file can be merged */ - unsigned fReadin : 1; /* true if it was read in (not just created) */ - unsigned fBigendian : 1;/* if set, was compiled on big endian machine */ - /* aux's will be in compile host's sex */ - unsigned glevel : 2; /* level this file was compiled with */ - unsigned reserved : 22; /* reserved for future use */ - bfd_vma cbLineOffset; /* byte offset from header for this file ln's */ - bfd_vma cbLine; /* size of lines for this file */ - } FDR, *pFDR; -#define cbFDR sizeof(FDR) -#define fdNil ((pFDR)0) -#define ifdNil -1 -#define ifdTemp 0 -#define ilnNil -1 - - -/* - * Procedure Descriptor - * - * There is one of these for EVERY TEXT LABEL. - * If a procedure is in a file with full symbols, then isym - * will point to the PROC symbols, else it will point to the - * global symbol for the label. - */ - -typedef struct pdr { - bfd_vma adr; /* memory address of start of procedure */ - long isym; /* start of local symbol entries */ - long iline; /* start of line number entries*/ - long regmask; /* save register mask */ - long regoffset; /* save register offset */ - long iopt; /* start of optimization symbol entries*/ - long fregmask; /* save floating point register mask */ - long fregoffset; /* save floating point register offset */ - long frameoffset; /* frame size */ - short framereg; /* frame pointer register */ - short pcreg; /* offset or reg of return pc */ - long lnLow; /* lowest line in the procedure */ - long lnHigh; /* highest line in the procedure */ - bfd_vma cbLineOffset; /* byte offset for this procedure from the fd base */ - /* These fields are new for 64 bit ECOFF. */ - unsigned gp_prologue : 8; /* byte size of GP prologue */ - unsigned gp_used : 1; /* true if the procedure uses GP */ - unsigned reg_frame : 1; /* true if register frame procedure */ - unsigned prof : 1; /* true if compiled with -pg */ - unsigned reserved : 13; /* reserved: must be zero */ - unsigned localoff : 8; /* offset of local variables from vfp */ - } PDR, *pPDR; -#define cbPDR sizeof(PDR) -#define pdNil ((pPDR) 0) -#define ipdNil -1 - -/* - * The structure of the runtime procedure descriptor created by the loader - * for use by the static exception system. - */ -/* - * If 0'd out because exception_info chokes Visual C++ and because there - * don't seem to be any references to this structure elsewhere in gdb. - */ -#if 0 -typedef struct runtime_pdr { - bfd_vma adr; /* memory address of start of procedure */ - long regmask; /* save register mask */ - long regoffset; /* save register offset */ - long fregmask; /* save floating point register mask */ - long fregoffset; /* save floating point register offset */ - long frameoffset; /* frame size */ - short framereg; /* frame pointer register */ - short pcreg; /* offset or reg of return pc */ - long irpss; /* index into the runtime string table */ - long reserved; - struct exception_info *exception_info;/* pointer to exception array */ -} RPDR, *pRPDR; -#define cbRPDR sizeof(RPDR) -#define rpdNil ((pRPDR) 0) -#endif - -/* - * Line Numbers - * - * Line Numbers are segregated from the normal symbols because they - * are [1] smaller , [2] are of no interest to your - * average loader, and [3] are never needed in the middle of normal - * scanning and therefore slow things down. - * - * By definition, the first LINER for any given procedure will have - * the first line of a procedure and represent the first address. - */ - -typedef long LINER, *pLINER; -#define lineNil ((pLINER)0) -#define cbLINER sizeof(LINER) -#define ilineNil -1 - - - -/* - * The Symbol Structure (GFW, to those who Know!) - */ - -typedef struct { - long iss; /* index into String Space of name */ - bfd_vma value; /* value of symbol */ - unsigned st : 6; /* symbol type */ - unsigned sc : 5; /* storage class - text, data, etc */ - unsigned reserved : 1; /* reserved */ - unsigned index : 20; /* index into sym/aux table */ - } SYMR, *pSYMR; -#define symNil ((pSYMR)0) -#define cbSYMR sizeof(SYMR) -#define isymNil -1 -#define indexNil 0xfffff -#define issNil -1 -#define issNull 0 - - -/* The following converts a memory resident string to an iss. - * This hack is recognized in SbFIss, in sym.c of the debugger. - */ -#define IssFSb(sb) (0x80000000 | ((unsigned long)(sb))) - -/* E X T E R N A L S Y M B O L R E C O R D - * - * Same as the SYMR except it contains file context to determine where - * the index is. - */ -typedef struct ecoff_extr { - unsigned jmptbl:1; /* symbol is a jump table entry for shlibs */ - unsigned cobol_main:1; /* symbol is a cobol main procedure */ - unsigned weakext:1; /* symbol is weak external */ - unsigned reserved:13; /* reserved for future use */ - int ifd; /* where the iss and index fields point into */ - SYMR asym; /* symbol for the external */ - } EXTR, *pEXTR; -#define extNil ((pEXTR)0) -#define cbEXTR sizeof(EXTR) - - -/* A U X I L L A R Y T Y P E I N F O R M A T I O N */ - -/* - * Type Information Record - */ -typedef struct { - unsigned fBitfield : 1; /* set if bit width is specified */ - unsigned continued : 1; /* indicates additional TQ info in next AUX */ - unsigned bt : 6; /* basic type */ - unsigned tq4 : 4; - unsigned tq5 : 4; - /* ---- 16 bit boundary ---- */ - unsigned tq0 : 4; - unsigned tq1 : 4; /* 6 type qualifiers - tqPtr, etc. */ - unsigned tq2 : 4; - unsigned tq3 : 4; - } TIR, *pTIR; -#define cbTIR sizeof(TIR) -#define tiNil ((pTIR)0) -#define itqMax 6 - -/* - * Relative symbol record - * - * If the rfd field is 4095, the index field indexes into the global symbol - * table. - */ - -typedef struct { - unsigned rfd : 12; /* index into the file indirect table */ - unsigned index : 20; /* index int sym/aux/iss tables */ - } RNDXR, *pRNDXR; -#define cbRNDXR sizeof(RNDXR) -#define rndxNil ((pRNDXR)0) - -/* dense numbers or sometimes called block numbers are stored in this type, - * a rfd of 0xffffffff is an index into the global table. - */ -typedef struct { - unsigned long rfd; /* index into the file table */ - unsigned long index; /* index int sym/aux/iss tables */ - } DNR, *pDNR; -#define cbDNR sizeof(DNR) -#define dnNil ((pDNR)0) - - - -/* - * Auxillary information occurs only if needed. - * It ALWAYS occurs in this order when present. - - isymMac used by stProc only - TIR type info - TIR additional TQ info (if first TIR was not enough) - rndx if (bt == btStruct,btUnion,btEnum,btSet,btRange, - btTypedef): - rsym.index == iaux for btSet or btRange - else rsym.index == isym - dimLow btRange, btSet - dimMac btRange, btSet - rndx0 As many as there are tq arrays - dimLow0 - dimHigh0 - ... - rndxMax-1 - dimLowMax-1 - dimHighMax-1 - width in bits if (bit field), width in bits. - */ -#define cAuxMax (6 + (idimMax*3)) - -/* a union of all possible info in the AUX universe */ -typedef union { - TIR ti; /* type information record */ - RNDXR rndx; /* relative index into symbol table */ - long dnLow; /* low dimension */ - long dnHigh; /* high dimension */ - long isym; /* symbol table index (end of proc) */ - long iss; /* index into string space (not used) */ - long width; /* width for non-default sized struc fields */ - long count; /* count of ranges for variant arm */ - } AUXU, *pAUXU; -#define cbAUXU sizeof(AUXU) -#define auxNil ((pAUXU)0) -#define iauxNil -1 - - -/* - * Optimization symbols - * - * Optimization symbols contain some overlap information with the normal - * symbol table. In particular, the proc information - * is somewhat redundant but necessary to easily find the other information - * present. - * - * All of the offsets are relative to the beginning of the last otProc - */ - -typedef struct { - unsigned ot: 8; /* optimization type */ - unsigned value: 24; /* address where we are moving it to */ - RNDXR rndx; /* points to a symbol or opt entry */ - unsigned long offset; /* relative offset this occured */ - } OPTR, *pOPTR; -#define optNil ((pOPTR) 0) -#define cbOPTR sizeof(OPTR) -#define ioptNil -1 - -/* - * File Indirect - * - * When a symbol is referenced across files the following procedure is used: - * 1) use the file index to get the File indirect entry. - * 2) use the file indirect entry to get the File descriptor. - * 3) add the sym index to the base of that file's sym table - * - */ - -typedef long RFDT, *pRFDT; -#define cbRFDT sizeof(RFDT) -#define rfdNil -1 - -/* - * The file indirect table in the mips loader is known as an array of FITs. - * This is done to keep the code in the loader readable in the area where - * these tables are merged. Note this is only a name change. - */ -typedef long FIT, *pFIT; -#define cbFIT sizeof(FIT) -#define ifiNil -1 -#define fiNil ((pFIT) 0) - -#ifdef _LANGUAGE_PASCAL -#define ifdNil -1 -#define ilnNil -1 -#define ipdNil -1 -#define ilineNil -1 -#define isymNil -1 -#define indexNil 16#fffff -#define issNil -1 -#define issNull 0 -#define itqMax 6 -#define iauxNil -1 -#define ioptNil -1 -#define rfdNil -1 -#define ifiNil -1 -#endif /* _LANGUAGE_PASCAL */ - - -/* Dense numbers - * - * Rather than use file index, symbol index pairs to represent symbols - * and globals, we use dense number so that they can be easily embeded - * in intermediate code and the programs that process them can - * use direct access tabls instead of hash table (which would be - * necesary otherwise because of the sparse name space caused by - * file index, symbol index pairs. Dense number are represented - * by RNDXRs. - */ - -/* - * The following table defines the meaning of each SYM field as - * a function of the "st". (scD/B == scData OR scBss) - * - * Note: the value "isymMac" is used by symbols that have the concept - * of enclosing a block of related information. This value is the - * isym of the first symbol AFTER the end associated with the primary - * symbol. For example if a procedure was at isym==90 and had an - * isymMac==155, the associated end would be at isym==154, and the - * symbol at 155 would probably (although not necessarily) be the - * symbol for the next procedure. This allows rapid skipping over - * internal information of various sorts. "stEnd"s ALWAYS have the - * isym of the primary symbol that started the block. - * - -ST SC VALUE INDEX --------- ------ -------- ------ -stFile scText address isymMac -stLabel scText address --- -stGlobal scD/B address iaux -stStatic scD/B address iaux -stParam scAbs offset iaux -stLocal scAbs offset iaux -stProc scText address iaux (isymMac is first AUX) -stStaticProc scText address iaux (isymMac is first AUX) - -stMember scNil ordinal --- (if member of enum) - (mipsread thinks the case below has a bit, not byte, offset.) -stMember scNil byte offset iaux (if member of struct/union) -stMember scBits bit offset iaux (bit field spec) - -stBlock scText address isymMac (text block) - (the code seems to think that rather than scNil, we see scInfo for - the two cases below.) -stBlock scNil cb isymMac (struct/union member define) -stBlock scNil cMembers isymMac (enum member define) - - (New types added by SGI to simplify things:) -stStruct scInfo cb isymMac (struct type define) -stUnion scInfo cb isymMac (union type define) -stEnum scInfo cMembers isymMac (enum type define) - -stEnd scText address isymStart -stEnd scNil ------- isymStart (struct/union/enum) - -stTypedef scNil ------- iaux -stRegReloc sc??? value old register number -stForward sc??? new address isym to original symbol - -stConstant scInfo value --- (scalar) -stConstant scInfo iss --- (complex, e.g. string) - - * - */ -#endif diff --git a/contrib/gdb/include/coff/symconst.h b/contrib/gdb/include/coff/symconst.h deleted file mode 100644 index f40eef2..0000000 --- a/contrib/gdb/include/coff/symconst.h +++ /dev/null @@ -1,177 +0,0 @@ -/* Declarations of constants for internal format of MIPS ECOFF symbols. - Originally contributed by MIPS Computer Systems and Third Eye Software. - Changes contributed by Cygnus Support are in the public domain. - - This file is just aggregated with the files that make up the GNU - release; it is not considered part of GAS, GDB, or other GNU - programs. */ - -/* - * |-----------------------------------------------------------| - * | Copyright (c) 1992, 1991, 1990 MIPS Computer Systems, Inc.| - * | MIPS Computer Systems, Inc. grants reproduction and use | - * | rights to all parties, PROVIDED that this comment is | - * | maintained in the copy. | - * |-----------------------------------------------------------| - */ - -/* (C) Copyright 1984 by Third Eye Software, Inc. - * - * Third Eye Software, Inc. grants reproduction and use rights to - * all parties, PROVIDED that this comment is maintained in the copy. - * - * Third Eye makes no claims about the applicability of this - * symbol table to a particular use. - */ - -/* glevels for field in FDR */ -#define GLEVEL_0 2 -#define GLEVEL_1 1 -#define GLEVEL_2 0 /* for upward compat reasons. */ -#define GLEVEL_3 3 - -/* magic number fo symheader */ -#define magicSym 0x7009 -/* The Alpha uses this value instead, for some reason. */ -#define magicSym2 0x1992 - -/* Language codes */ -#define langC 0 -#define langPascal 1 -#define langFortran 2 -#define langAssembler 3 /* one Assembley inst might map to many mach */ -#define langMachine 4 -#define langNil 5 -#define langAda 6 -#define langPl1 7 -#define langCobol 8 -#define langStdc 9 /* FIXME: Collides with SGI langCplusplus */ -#define langCplusplus 9 /* FIXME: Collides with langStdc */ -#define langCplusplusV2 10 /* SGI addition */ -#define langMax 11 /* maximun allowed 32 -- 5 bits */ - -/* The following are value definitions for the fields in the SYMR */ - -/* - * Storage Classes - */ - -#define scNil 0 -#define scText 1 /* text symbol */ -#define scData 2 /* initialized data symbol */ -#define scBss 3 /* un-initialized data symbol */ -#define scRegister 4 /* value of symbol is register number */ -#define scAbs 5 /* value of symbol is absolute */ -#define scUndefined 6 /* who knows? */ -#define scCdbLocal 7 /* variable's value is IN se->va.?? */ -#define scBits 8 /* this is a bit field */ -#define scCdbSystem 9 /* variable's value is IN CDB's address space */ -#define scDbx 9 /* overlap dbx internal use */ -#define scRegImage 10 /* register value saved on stack */ -#define scInfo 11 /* symbol contains debugger information */ -#define scUserStruct 12 /* address in struct user for current process */ -#define scSData 13 /* load time only small data */ -#define scSBss 14 /* load time only small common */ -#define scRData 15 /* load time only read only data */ -#define scVar 16 /* Var parameter (fortran,pascal) */ -#define scCommon 17 /* common variable */ -#define scSCommon 18 /* small common */ -#define scVarRegister 19 /* Var parameter in a register */ -#define scVariant 20 /* Variant record */ -#define scSUndefined 21 /* small undefined(external) data */ -#define scInit 22 /* .init section symbol */ -#define scBasedVar 23 /* Fortran or PL/1 ptr based var */ -#define scXData 24 /* exception handling data */ -#define scPData 25 /* Procedure section */ -#define scFini 26 /* .fini section */ -#define scRConst 27 /* .rconst section */ -#define scMax 32 - - -/* - * Symbol Types - */ - -#define stNil 0 /* Nuthin' special */ -#define stGlobal 1 /* external symbol */ -#define stStatic 2 /* static */ -#define stParam 3 /* procedure argument */ -#define stLocal 4 /* local variable */ -#define stLabel 5 /* label */ -#define stProc 6 /* " " Procedure */ -#define stBlock 7 /* beginnning of block */ -#define stEnd 8 /* end (of anything) */ -#define stMember 9 /* member (of anything - struct/union/enum */ -#define stTypedef 10 /* type definition */ -#define stFile 11 /* file name */ -#define stRegReloc 12 /* register relocation */ -#define stForward 13 /* forwarding address */ -#define stStaticProc 14 /* load time only static procs */ -#define stConstant 15 /* const */ -#define stStaParam 16 /* Fortran static parameters */ - /* These new symbol types have been recently added to SGI machines. */ -#define stStruct 26 /* Beginning of block defining a struct type */ -#define stUnion 27 /* Beginning of block defining a union type */ -#define stEnum 28 /* Beginning of block defining an enum type */ -#define stIndirect 34 /* Indirect type specification */ - /* Pseudo-symbols - internal to debugger */ -#define stStr 60 /* string */ -#define stNumber 61 /* pure number (ie. 4 NOR 2+2) */ -#define stExpr 62 /* 2+2 vs. 4 */ -#define stType 63 /* post-coersion SER */ -#define stMax 64 - -/* definitions for fields in TIR */ - -/* type qualifiers for ti.tq0 -> ti.(itqMax-1) */ -#define tqNil 0 /* bt is what you see */ -#define tqPtr 1 /* pointer */ -#define tqProc 2 /* procedure */ -#define tqArray 3 /* duh */ -#define tqFar 4 /* longer addressing - 8086/8 land */ -#define tqVol 5 /* volatile */ -#define tqConst 6 /* const */ -#define tqMax 8 - -/* basic types as seen in ti.bt */ -#define btNil 0 /* undefined (also, enum members) */ -#define btAdr 1 /* address - integer same size as pointer */ -#define btChar 2 /* character */ -#define btUChar 3 /* unsigned character */ -#define btShort 4 /* short */ -#define btUShort 5 /* unsigned short */ -#define btInt 6 /* int */ -#define btUInt 7 /* unsigned int */ -#define btLong 8 /* long */ -#define btULong 9 /* unsigned long */ -#define btFloat 10 /* float (real) */ -#define btDouble 11 /* Double (real) */ -#define btStruct 12 /* Structure (Record) */ -#define btUnion 13 /* Union (variant) */ -#define btEnum 14 /* Enumerated */ -#define btTypedef 15 /* defined via a typedef, isymRef points */ -#define btRange 16 /* subrange of int */ -#define btSet 17 /* pascal sets */ -#define btComplex 18 /* fortran complex */ -#define btDComplex 19 /* fortran double complex */ -#define btIndirect 20 /* forward or unnamed typedef */ -#define btFixedDec 21 /* Fixed Decimal */ -#define btFloatDec 22 /* Float Decimal */ -#define btString 23 /* Varying Length Character String */ -#define btBit 24 /* Aligned Bit String */ -#define btPicture 25 /* Picture */ -#define btVoid 26 /* void */ -#define btLongLong 27 /* long long */ -#define btULongLong 28 /* unsigned long long */ -#define btMax 64 - -#if (_MFG == _MIPS) -/* optimization type codes */ -#define otNil 0 -#define otReg 1 /* move var to reg */ -#define otBlock 2 /* begin basic block */ -#define otProc 3 /* procedure */ -#define otInline 4 /* inline procedure */ -#define otEnd 5 /* whatever you started */ -#define otMax 6 /* KEEP UP TO DATE */ -#endif /* (_MFG == _MIPS) */ diff --git a/contrib/gdb/include/coff/w65.h b/contrib/gdb/include/coff/w65.h deleted file mode 100644 index c80b9fe..0000000 --- a/contrib/gdb/include/coff/w65.h +++ /dev/null @@ -1,201 +0,0 @@ -/*** coff information for WDC 65816 */ - -/********************** FILE HEADER **********************/ - -struct external_filehdr { - char f_magic[2]; /* magic number */ - char f_nscns[2]; /* number of sections */ - char f_timdat[4]; /* time & date stamp */ - char f_symptr[4]; /* file pointer to symtab */ - char f_nsyms[4]; /* number of symtab entries */ - char f_opthdr[2]; /* sizeof(optional hdr) */ - char f_flags[2]; /* flags */ -}; - - - -#define W65MAGIC 0x6500 - - -#define W65BADMAG(x) (((x).f_magic!=W65MAGIC)) - -#define FILHDR struct external_filehdr -#define FILHSZ sizeof(FILHDR) - - -/********************** AOUT "OPTIONAL HEADER" **********************/ - - -typedef struct -{ - char magic[2]; /* type of file */ - char vstamp[2]; /* version stamp */ - char tsize[4]; /* text size in bytes, padded to FW bdry*/ - char dsize[4]; /* initialized data " " */ - char bsize[4]; /* uninitialized data " " */ - char entry[4]; /* entry pt. */ - char text_start[4]; /* base of text used for this file */ - char data_start[4]; /* base of data used for this file */ -} -AOUTHDR; - - -#define AOUTHDRSZ (sizeof(AOUTHDR)) -#define AOUTSZ (sizeof(AOUTHDR)) - - - - -/********************** SECTION HEADER **********************/ - - -struct external_scnhdr { - char s_name[8]; /* section name */ - char s_paddr[4]; /* physical address, aliased s_nlib */ - char s_vaddr[4]; /* virtual address */ - char s_size[4]; /* section size */ - char s_scnptr[4]; /* file ptr to raw data for section */ - char s_relptr[4]; /* file ptr to relocation */ - char s_lnnoptr[4]; /* file ptr to line numbers */ - char s_nreloc[2]; /* number of relocation entries */ - char s_nlnno[2]; /* number of line number entries*/ - char s_flags[4]; /* flags */ -}; - -/* - * names of "special" sections - */ -#define _TEXT ".text" -#define _DATA ".data" -#define _BSS ".bss" - - -#define SCNHDR struct external_scnhdr -#define SCNHSZ sizeof(SCNHDR) - - -/********************** LINE NUMBERS **********************/ - -/* 1 line number entry for every "breakpointable" source line in a section. - * Line numbers are grouped on a per function basis; first entry in a function - * grouping will have l_lnno = 0 and in place of physical address will be the - * symbol table index of the function name. - */ -struct external_lineno { - union { - char l_symndx[4]; /* function name symbol index, iff l_lnno == 0*/ - char l_paddr[4]; /* (physical) address of line number */ - } l_addr; - char l_lnno[4]; /* line number */ -}; - -#define GET_LINENO_LNNO(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *) (ext->l_lnno)); -#define PUT_LINENO_LNNO(abfd,val, ext) bfd_h_put_32(abfd,val, (bfd_byte *) (ext->l_lnno)); - -#define LINENO struct external_lineno -#define LINESZ sizeof(LINENO) - - -/********************** SYMBOLS **********************/ - -#define E_SYMNMLEN 8 /* # characters in a symbol name */ -#define E_FILNMLEN 14 /* # characters in a file name */ -#define E_DIMNUM 4 /* # array dimensions in auxiliary entry */ - -struct external_syment -{ - union { - char e_name[E_SYMNMLEN]; - struct { - char e_zeroes[4]; - char e_offset[4]; - } e; - } e; - char e_value[4]; - char e_scnum[2]; - char e_type[2]; - char e_sclass[1]; - char e_numaux[1]; -}; - - - -#define N_BTMASK (017) -#define N_TMASK (060) -#define N_BTSHFT (4) -#define N_TSHIFT (2) - - -union external_auxent { - struct { - char x_tagndx[4]; /* str, un, or enum tag indx */ - union { - struct { - char x_lnno[2]; /* declaration line number */ - char x_size[2]; /* str/union/array size */ - } x_lnsz; - char x_fsize[4]; /* size of function */ - } x_misc; - union { - struct { /* if ISFCN, tag, or .bb */ - char x_lnnoptr[4]; /* ptr to fcn line # */ - char x_endndx[4]; /* entry ndx past block end */ - } x_fcn; - struct { /* if ISARY, up to 4 dimen. */ - char x_dimen[E_DIMNUM][2]; - } x_ary; - } x_fcnary; - char x_tvndx[2]; /* tv index */ - } x_sym; - - union { - char x_fname[E_FILNMLEN]; - struct { - char x_zeroes[4]; - char x_offset[4]; - } x_n; - } x_file; - - struct { - char x_scnlen[4]; /* section length */ - char x_nreloc[2]; /* # relocation entries */ - char x_nlinno[2]; /* # line numbers */ - } x_scn; - - struct { - char x_tvfill[4]; /* tv fill value */ - char x_tvlen[2]; /* length of .tv */ - char x_tvran[2][2]; /* tv range */ - } x_tv; /* info about .tv section (in auxent of symbol .tv)) */ - - -}; - -#define SYMENT struct external_syment -#define SYMESZ 18 -#define AUXENT union external_auxent -#define AUXESZ 18 - - - -/********************** RELOCATION DIRECTIVES **********************/ - -/* The external reloc has an offset field, because some of the reloc - types on the w65 don't have room in the instruction for the entire - offset - eg the strange jump and high page addressing modes */ - -struct external_reloc { - char r_vaddr[4]; - char r_symndx[4]; - char r_offset[4]; - char r_type[2]; - char r_stuff[2]; -}; - - -#define RELOC struct external_reloc -#define RELSZ 16 - - - - diff --git a/contrib/gdb/include/coff/we32k.h b/contrib/gdb/include/coff/we32k.h deleted file mode 100644 index 414c450..0000000 --- a/contrib/gdb/include/coff/we32k.h +++ /dev/null @@ -1,206 +0,0 @@ -/*** coff information for we32k */ - -/********************** FILE HEADER **********************/ - -struct external_filehdr { - char f_magic[2]; /* magic number */ - char f_nscns[2]; /* number of sections */ - char f_timdat[4]; /* time & date stamp */ - char f_symptr[4]; /* file pointer to symtab */ - char f_nsyms[4]; /* number of symtab entries */ - char f_opthdr[2]; /* sizeof(optional hdr) */ - char f_flags[2]; /* flags */ -}; - - -/* Bits for f_flags: - * F_RELFLG relocation info stripped from file - * F_EXEC file is executable (no unresolved external references) - * F_LNNO line numbers stripped from file - * F_LSYMS local symbols stripped from file - * F_AR32WR file has byte ordering of an AR32WR machine (e.g. vax) - */ - -#define F_RELFLG (0x0001) -#define F_EXEC (0x0002) -#define F_LNNO (0x0004) -#define F_LSYMS (0x0008) -#define F_BM32B (0020000) -#define F_BM32MAU (0040000) - -#define WE32KMAGIC 0x170 /* we32k sans transfer vector */ -#define FBOMAGIC 0x170 /* we32k sans transfer vector */ -#define MTVMAGIC 0x171 /* we32k with transfer vector */ -#define RBOMAGIC 0x172 /* reserved */ -#define WE32KBADMAG(x) (((x).f_magic != WE32KMAGIC) \ - && ((x).f_magic != FBOMAGIC) \ - && ((x).f_magic != RBOMAGIC) \ - && ((x).f_magic != MTVMAGIC)) - -#define FILHDR struct external_filehdr -#define FILHSZ sizeof(FILHDR) - - -/********************** AOUT "OPTIONAL HEADER" **********************/ - - -typedef struct -{ - char magic[2]; /* type of file */ - char vstamp[2]; /* version stamp */ - char tsize[4]; /* text size in bytes, padded to FW bdry*/ - char dsize[4]; /* initialized data " " */ - char bsize[4]; /* uninitialized data " " */ - char entry[4]; /* entry pt. */ - char text_start[4]; /* base of text used for this file */ - char data_start[4]; /* base of data used for this file */ -} -AOUTHDR; - -#define AOUTSZ (sizeof(AOUTHDR)) - - -/********************** SECTION HEADER **********************/ - - -struct external_scnhdr { - char s_name[8]; /* section name */ - char s_paddr[4]; /* physical address, aliased s_nlib */ - char s_vaddr[4]; /* virtual address */ - char s_size[4]; /* section size */ - char s_scnptr[4]; /* file ptr to raw data for section */ - char s_relptr[4]; /* file ptr to relocation */ - char s_lnnoptr[4]; /* file ptr to line numbers */ - char s_nreloc[2]; /* number of relocation entries */ - char s_nlnno[2]; /* number of line number entries*/ - char s_flags[4]; /* flags */ -}; - -#define SCNHDR struct external_scnhdr -#define SCNHSZ sizeof(SCNHDR) - -/* - * names of "special" sections - */ -#define _TEXT ".text" -#define _DATA ".data" -#define _BSS ".bss" -#define _TV ".tv" -#define _INIT ".init" -#define _FINI ".fini" - -/********************** LINE NUMBERS **********************/ - -/* 1 line number entry for every "breakpointable" source line in a section. - * Line numbers are grouped on a per function basis; first entry in a function - * grouping will have l_lnno = 0 and in place of physical address will be the - * symbol table index of the function name. - */ -struct external_lineno { - union { - char l_symndx[4]; /* function name symbol index, iff l_lnno == 0*/ - char l_paddr[4]; /* (physical) address of line number */ - } l_addr; - char l_lnno[2]; /* line number */ -}; - - -#define LINENO struct external_lineno -#define LINESZ sizeof(LINENO) - - -/********************** SYMBOLS **********************/ - -#define E_SYMNMLEN 8 /* # characters in a symbol name */ -#define E_FILNMLEN 14 /* # characters in a file name */ -#define E_DIMNUM 4 /* # array dimensions in auxiliary entry */ - -struct external_syment -{ - union { - char e_name[E_SYMNMLEN]; - struct { - char e_zeroes[4]; - char e_offset[4]; - } e; - } e; - char e_value[4]; - char e_scnum[2]; - char e_type[2]; - char e_sclass[1]; - char e_numaux[1]; -}; - -#define N_BTMASK (0xf) -#define N_TMASK (0x30) -#define N_BTSHFT (4) -#define N_TSHIFT (2) - -union external_auxent { - struct { - char x_tagndx[4]; /* str, un, or enum tag indx */ - union { - struct { - char x_lnno[2]; /* declaration line number */ - char x_size[2]; /* str/union/array size */ - } x_lnsz; - char x_fsize[4]; /* size of function */ - } x_misc; - union { - struct { /* if ISFCN, tag, or .bb */ - char x_lnnoptr[4]; /* ptr to fcn line # */ - char x_endndx[4]; /* entry ndx past block end */ - } x_fcn; - struct { /* if ISARY, up to 4 dimen. */ - char x_dimen[E_DIMNUM][2]; - } x_ary; - } x_fcnary; - char x_tvndx[2]; /* tv index */ - } x_sym; - - union { - char x_fname[E_FILNMLEN]; - struct { - char x_zeroes[4]; - char x_offset[4]; - } x_n; - } x_file; - - struct { - char x_scnlen[4]; /* section length */ - char x_nreloc[2]; /* # relocation entries */ - char x_nlinno[2]; /* # line numbers */ - } x_scn; - - struct { - char x_tvfill[4]; /* tv fill value */ - char x_tvlen[2]; /* length of .tv */ - char x_tvran[2][2]; /* tv range */ - } x_tv; /* info about .tv section (in auxent of symbol .tv)) */ - - -}; - -#define SYMENT struct external_syment -#define SYMESZ 18 -#define AUXENT union external_auxent -#define AUXESZ 18 - - -# define _ETEXT "etext" - - -/********************** RELOCATION DIRECTIVES **********************/ - - - -struct external_reloc { - char r_vaddr[4]; - char r_symndx[4]; - char r_type[2]; -}; - - -#define RELOC struct external_reloc -#define RELSZ sizeof(RELOC) - diff --git a/contrib/gdb/include/coff/z8k.h b/contrib/gdb/include/coff/z8k.h deleted file mode 100644 index 4881795..0000000 --- a/contrib/gdb/include/coff/z8k.h +++ /dev/null @@ -1,201 +0,0 @@ -/*** coff information for Zilog Z800N */ - -/********************** FILE HEADER **********************/ - -struct external_filehdr { - char f_magic[2]; /* magic number */ - char f_nscns[2]; /* number of sections */ - char f_timdat[4]; /* time & date stamp */ - char f_symptr[4]; /* file pointer to symtab */ - char f_nsyms[4]; /* number of symtab entries */ - char f_opthdr[2]; /* sizeof(optional hdr) */ - char f_flags[2]; /* flags */ -}; - - -/* Type of cpu is stored in flags */ -#define F_Z8001 0x1000 -#define F_Z8002 0x2000 -#define F_MACHMASK 0xf000 - -#define Z8KMAGIC 0x8000 - -#define Z8KBADMAG(x) (((x).f_magic!=Z8KMAGIC)) - -#define FILHDR struct external_filehdr -#define FILHSZ sizeof(FILHDR) - - -/********************** AOUT "OPTIONAL HEADER" **********************/ - - -typedef struct -{ - char magic[2]; /* type of file */ - char vstamp[2]; /* version stamp */ - char tsize[4]; /* text size in bytes, padded to FW bdry*/ - char dsize[4]; /* initialized data " " */ - char bsize[4]; /* uninitialized data " " */ - char entry[4]; /* entry pt. */ - char text_start[4]; /* base of text used for this file */ - char data_start[4]; /* base of data used for this file */ -} -AOUTHDR; - - -#define AOUTHDRSZ (sizeof(AOUTHDR)) -#define AOUTSZ (sizeof(AOUTHDR)) - - - - -/********************** SECTION HEADER **********************/ - - -struct external_scnhdr { - char s_name[8]; /* section name */ - char s_paddr[4]; /* physical address, aliased s_nlib */ - char s_vaddr[4]; /* virtual address */ - char s_size[4]; /* section size */ - char s_scnptr[4]; /* file ptr to raw data for section */ - char s_relptr[4]; /* file ptr to relocation */ - char s_lnnoptr[4]; /* file ptr to line numbers */ - char s_nreloc[2]; /* number of relocation entries */ - char s_nlnno[2]; /* number of line number entries*/ - char s_flags[4]; /* flags */ -}; - -/* - * names of "special" sections - */ -#define _TEXT ".text" -#define _DATA ".data" -#define _BSS ".bss" - - -#define SCNHDR struct external_scnhdr -#define SCNHSZ sizeof(SCNHDR) - - -/********************** LINE NUMBERS **********************/ - -/* 1 line number entry for every "breakpointable" source line in a section. - * Line numbers are grouped on a per function basis; first entry in a function - * grouping will have l_lnno = 0 and in place of physical address will be the - * symbol table index of the function name. - */ -struct external_lineno { - union { - char l_symndx[4]; /* function name symbol index, iff l_lnno == 0*/ - char l_paddr[4]; /* (physical) address of line number */ - } l_addr; - char l_lnno[4]; /* line number */ -}; - -#define GET_LINENO_LNNO(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *) (ext->l_lnno)); -#define PUT_LINENO_LNNO(abfd,val, ext) bfd_h_put_32(abfd,val, (bfd_byte *) (ext->l_lnno)); - -#define LINENO struct external_lineno -#define LINESZ sizeof(LINENO) - - -/********************** SYMBOLS **********************/ - -#define E_SYMNMLEN 8 /* # characters in a symbol name */ -#define E_FILNMLEN 14 /* # characters in a file name */ -#define E_DIMNUM 4 /* # array dimensions in auxiliary entry */ - -struct external_syment -{ - union { - char e_name[E_SYMNMLEN]; - struct { - char e_zeroes[4]; - char e_offset[4]; - } e; - } e; - char e_value[4]; - char e_scnum[2]; - char e_type[2]; - char e_sclass[1]; - char e_numaux[1]; -}; - - - -#define N_BTMASK (017) -#define N_TMASK (060) -#define N_BTSHFT (4) -#define N_TSHIFT (2) - - -union external_auxent { - struct { - char x_tagndx[4]; /* str, un, or enum tag indx */ - union { - struct { - char x_lnno[2]; /* declaration line number */ - char x_size[2]; /* str/union/array size */ - } x_lnsz; - char x_fsize[4]; /* size of function */ - } x_misc; - union { - struct { /* if ISFCN, tag, or .bb */ - char x_lnnoptr[4]; /* ptr to fcn line # */ - char x_endndx[4]; /* entry ndx past block end */ - } x_fcn; - struct { /* if ISARY, up to 4 dimen. */ - char x_dimen[E_DIMNUM][2]; - } x_ary; - } x_fcnary; - char x_tvndx[2]; /* tv index */ - } x_sym; - - union { - char x_fname[E_FILNMLEN]; - struct { - char x_zeroes[4]; - char x_offset[4]; - } x_n; - } x_file; - - struct { - char x_scnlen[4]; /* section length */ - char x_nreloc[2]; /* # relocation entries */ - char x_nlinno[2]; /* # line numbers */ - } x_scn; - - struct { - char x_tvfill[4]; /* tv fill value */ - char x_tvlen[2]; /* length of .tv */ - char x_tvran[2][2]; /* tv range */ - } x_tv; /* info about .tv section (in auxent of symbol .tv)) */ - - -}; - -#define SYMENT struct external_syment -#define SYMESZ 18 -#define AUXENT union external_auxent -#define AUXESZ 18 - - - -/********************** RELOCATION DIRECTIVES **********************/ - -/* The external reloc has an offset field, because some of the reloc - types on the z8k don't have room in the instruction for the entire - offset - eg with segments */ - -struct external_reloc { - char r_vaddr[4]; - char r_symndx[4]; - char r_offset[4]; - char r_type[2]; - char r_stuff[2]; -}; - - -#define RELOC struct external_reloc -#define RELSZ 16 - diff --git a/contrib/gdb/include/demangle.h b/contrib/gdb/include/demangle.h deleted file mode 100644 index d4d0a3f..0000000 --- a/contrib/gdb/include/demangle.h +++ /dev/null @@ -1,108 +0,0 @@ -/* Defs for interface to demanglers. - Copyright 1992, 1995, 1996 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. */ - - -#if !defined (DEMANGLE_H) -#define DEMANGLE_H - -#ifdef IN_GCC - -/* Add prototype support. */ -#ifndef PROTO -#if defined (USE_PROTOTYPES) ? USE_PROTOTYPES : defined (__STDC__) -#define PROTO(ARGS) ARGS -#else -#define PROTO(ARGS) () -#endif -#endif - -#define PARAMS(ARGS) PROTO(ARGS) - -#ifdef __STDC__ -#define PTR void * -#else -#ifndef const -#define const -#endif -#define PTR char * -#endif - -#else /* ! IN_GCC */ -#include -#endif /* IN_GCC */ - -/* Options passed to cplus_demangle (in 2nd parameter). */ - -#define DMGL_NO_OPTS 0 /* For readability... */ -#define DMGL_PARAMS (1 << 0) /* Include function args */ -#define DMGL_ANSI (1 << 1) /* Include const, volatile, etc */ - -#define DMGL_AUTO (1 << 8) -#define DMGL_GNU (1 << 9) -#define DMGL_LUCID (1 << 10) -#define DMGL_ARM (1 << 11) -/* If none of these are set, use 'current_demangling_style' as the default. */ -#define DMGL_STYLE_MASK (DMGL_AUTO|DMGL_GNU|DMGL_LUCID|DMGL_ARM) - -/* Enumeration of possible demangling styles. - - Lucid and ARM styles are still kept logically distinct, even though - they now both behave identically. The resulting style is actual the - union of both. I.E. either style recognizes both "__pt__" and "__rf__" - for operator "->", even though the first is lucid style and the second - is ARM style. (FIXME?) */ - -extern enum demangling_styles -{ - unknown_demangling = 0, - auto_demangling = DMGL_AUTO, - gnu_demangling = DMGL_GNU, - lucid_demangling = DMGL_LUCID, - arm_demangling = DMGL_ARM -} current_demangling_style; - -/* Define string names for the various demangling styles. */ - -#define AUTO_DEMANGLING_STYLE_STRING "auto" -#define GNU_DEMANGLING_STYLE_STRING "gnu" -#define LUCID_DEMANGLING_STYLE_STRING "lucid" -#define ARM_DEMANGLING_STYLE_STRING "arm" - -/* Some macros to test what demangling style is active. */ - -#define CURRENT_DEMANGLING_STYLE current_demangling_style -#define AUTO_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_AUTO) -#define GNU_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_GNU) -#define LUCID_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_LUCID) -#define ARM_DEMANGLING (CURRENT_DEMANGLING_STYLE & DMGL_ARM) - -extern char * -cplus_demangle PARAMS ((const char *mangled, int options)); - -extern int -cplus_demangle_opname PARAMS ((const char *opname, char *result, int options)); - -extern const char * -cplus_mangle_opname PARAMS ((const char *opname, int options)); - -/* Note: This sets global state. FIXME if you care about multi-threading. */ - -extern void -set_cplus_marker_for_demangling PARAMS ((int ch)); - -#endif /* DEMANGLE_H */ diff --git a/contrib/gdb/include/dis-asm.h b/contrib/gdb/include/dis-asm.h deleted file mode 100644 index d70bd51..0000000 --- a/contrib/gdb/include/dis-asm.h +++ /dev/null @@ -1,175 +0,0 @@ -/* Interface between the opcode library and its callers. - Written by Cygnus Support, 1993. - - The opcode library (libopcodes.a) provides instruction decoders for - a large variety of instruction sets, callable with an identical - interface, for making instruction-processing programs more independent - of the instruction set being processed. */ - -#ifndef DIS_ASM_H -#define DIS_ASM_H - -#include -#include "bfd.h" - -typedef int (*fprintf_ftype) PARAMS((FILE*, const char*, ...)); - -enum dis_insn_type { - dis_noninsn, /* Not a valid instruction */ - dis_nonbranch, /* Not a branch instruction */ - dis_branch, /* Unconditional branch */ - dis_condbranch, /* Conditional branch */ - dis_jsr, /* Jump to subroutine */ - dis_condjsr, /* Conditional jump to subroutine */ - dis_dref, /* Data reference instruction */ - dis_dref2 /* Two data references in instruction */ -}; - -/* This struct is passed into the instruction decoding routine, - and is passed back out into each callback. The various fields are used - for conveying information from your main routine into your callbacks, - for passing information into the instruction decoders (such as the - addresses of the callback functions), or for passing information - back from the instruction decoders to their callers. - - It must be initialized before it is first passed; this can be done - by hand, or using one of the initialization macros below. */ - -typedef struct disassemble_info { - fprintf_ftype fprintf_func; - FILE *stream; - PTR application_data; - - /* Target description. We could replace this with a pointer to the bfd, - but that would require one. There currently isn't any such requirement - so to avoid introducing one we record these explicitly. */ - /* The bfd_arch value. */ - enum bfd_architecture arch; - /* The bfd_mach value. */ - unsigned long mach; - /* Endianness (for bi-endian cpus). Mono-endian cpus can ignore this. */ - enum bfd_endian endian; - - /* For use by the disassembler. - The top 16 bits are reserved for public use (and are documented here). - The bottom 16 bits are for the internal use of the disassembler. */ - unsigned long flags; - PTR private_data; - - /* Function used to get bytes to disassemble. MEMADDR is the - address of the stuff to be disassembled, MYADDR is the address to - put the bytes in, and LENGTH is the number of bytes to read. - INFO is a pointer to this struct. - Returns an errno value or 0 for success. */ - int (*read_memory_func) - PARAMS ((bfd_vma memaddr, bfd_byte *myaddr, int length, - struct disassemble_info *info)); - - /* Function which should be called if we get an error that we can't - recover from. STATUS is the errno value from read_memory_func and - MEMADDR is the address that we were trying to read. INFO is a - pointer to this struct. */ - void (*memory_error_func) - PARAMS ((int status, bfd_vma memaddr, struct disassemble_info *info)); - - /* Function called to print ADDR. */ - void (*print_address_func) - PARAMS ((bfd_vma addr, struct disassemble_info *info)); - - /* These are for buffer_read_memory. */ - bfd_byte *buffer; - bfd_vma buffer_vma; - int buffer_length; - - /* Results from instruction decoders. Not all decoders yet support - this information. This info is set each time an instruction is - decoded, and is only valid for the last such instruction. - - To determine whether this decoder supports this information, set - insn_info_valid to 0, decode an instruction, then check it. */ - - char insn_info_valid; /* Branch info has been set. */ - char branch_delay_insns; /* How many sequential insn's will run before - a branch takes effect. (0 = normal) */ - char data_size; /* Size of data reference in insn, in bytes */ - enum dis_insn_type insn_type; /* Type of instruction */ - bfd_vma target; /* Target address of branch or dref, if known; - zero if unknown. */ - bfd_vma target2; /* Second target address for dref2 */ - -} disassemble_info; - - -/* Standard disassemblers. Disassemble one instruction at the given - target address. Return number of bytes processed. */ -typedef int (*disassembler_ftype) - PARAMS((bfd_vma, disassemble_info *)); - -extern int print_insn_big_mips PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_little_mips PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_i386 PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_m68k PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_z8001 PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_z8002 PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_h8300 PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_h8300h PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_h8500 PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_alpha PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_big_arm PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_little_arm PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_sparc PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_sparc64 PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_big_a29k PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_little_a29k PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_i960 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_hppa PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_m88k PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_ns32k PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_big_powerpc PARAMS ((bfd_vma, disassemble_info*)); -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_w65 PARAMS ((bfd_vma, disassemble_info*)); - -/* Fetch the disassembler for a given BFD, if that support is available. */ -extern disassembler_ftype disassembler PARAMS ((bfd *)); - - -/* This block of definitions is for particular callers who read instructions - into a buffer before calling the instruction decoder. */ - -/* Here is a function which callers may wish to use for read_memory_func. - It gets bytes from a buffer. */ -extern int buffer_read_memory - PARAMS ((bfd_vma, bfd_byte *, int, struct disassemble_info *)); - -/* This function goes with buffer_read_memory. - It prints a message using info->fprintf_func and info->stream. */ -extern void perror_memory PARAMS ((int, bfd_vma, struct disassemble_info *)); - - -/* Just print the address in hex. This is included for completeness even - though both GDB and objdump provide their own (to print symbolic - addresses). */ -extern void generic_print_address - PARAMS ((bfd_vma, struct disassemble_info *)); - -/* Macro to initialize a disassemble_info struct. This should be called - by all applications creating such a struct. */ -#define INIT_DISASSEMBLE_INFO(INFO, STREAM, FPRINTF_FUNC) \ - (INFO).fprintf_func = (FPRINTF_FUNC), \ - (INFO).stream = (STREAM), \ - (INFO).buffer = NULL, \ - (INFO).buffer_vma = 0, \ - (INFO).buffer_length = 0, \ - (INFO).read_memory_func = buffer_read_memory, \ - (INFO).memory_error_func = perror_memory, \ - (INFO).print_address_func = generic_print_address, \ - (INFO).arch = bfd_arch_unknown, \ - (INFO).mach = 0, \ - (INFO).endian = BFD_ENDIAN_UNKNOWN, \ - (INFO).flags = 0, \ - (INFO).insn_info_valid = 0 - -#endif /* ! defined (DIS_ASM_H) */ diff --git a/contrib/gdb/include/elf/ChangeLog b/contrib/gdb/include/elf/ChangeLog deleted file mode 100644 index b56f9bb..0000000 --- a/contrib/gdb/include/elf/ChangeLog +++ /dev/null @@ -1,195 +0,0 @@ -Mon Feb 19 01:55:56 1996 Doug Evans - - * sparc.h (R_SPARC_{PLT32,HIPLT22,LOPLT10,PCPLT32,PCPLT22, - PCPLT10,5,6}): Don't define ifdef SPARC64_OLD_RELOCS. - -Tue Feb 6 11:33:58 1996 Doug Evans - - * sparc.h (enum sparc_elf_reloc_type): Define. - -Wed Jan 17 09:09:16 1996 Doug Evans - - * common.h: Define EM_SPARC32PLUS. - * sparc.h: New file. - -Thu Jan 11 16:27:34 1996 Michael Meissner - - * ppc.h (SHF_EXCLUDE, SHT_ORDERED): New fields from the abi. - -Thu Nov 30 16:47:18 1995 Ian Lance Taylor - - * internal.h (struct elf_segment_map): Add includes_filehdr and - includes_phdrs fields. - -Tue Nov 28 16:58:10 1995 Ian Lance Taylor - - * internal.h (struct elf_segment_map): Define. - -Tue Oct 31 15:19:36 1995 Fred Fish - - * common.h, dwarf.h, external.h, hppa.h, internal.h, - mips.h, ppc.h: Protect against multiple inclusions. - -Thu Sep 21 13:51:58 1995 Michael Meissner - - * ppc.h (EF_PPC_RELOCATABLE_LIB): Add new flag bit. - -Fri Sep 1 15:32:17 1995 Kazumoto Kojima - - * mips.h: Add some definitions used on Irix 5. - -Tue Jun 20 10:18:28 1995 Jeff Law (law@snake.cs.utah.edu) - - * hppa.h (CPU_PA_RISC1_0): Protect from redefinitions. - (CPU_PA_RISC1_1): Likewise. - -Wed Mar 8 18:14:37 1995 Michael Meissner - - * ppc.h: New file for PowerPC support. - -Tue Feb 14 13:59:13 1995 Michael Meissner - - * common.h (EM_PPC): Use offical value of 20, not 17. - (EM_PPC_OLD): Define this to be the old value of EM_PPC. - - -Tue Jan 24 09:40:59 1995 Michael Meissner - - * common.h (EM_PPC): New macro, PowerPC machine id. - -Tue Jan 17 10:51:38 1995 Ian Lance Taylor - - * mips.h (SHT_MIPS_MSYM, SHT_MIPS_DWARF, SHT_MIPS_EVENTS): Define. - - -Mon Oct 17 13:43:59 1994 Ian Lance Taylor - - * internal.h (Elf_Internal_Shdr): Remove rawdata and size fields. - Add bfd_section field. - -Tue May 24 16:11:50 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * mips.h (Elf32_External_gptab): Define. - -Mon May 16 13:22:04 1994 Jeff Law (law@snake.cs.utah.edu) - - * common.h (EM_HPPA): Delete. - (EM_PARISC): Add. - * hppa.h: New file. - -Mon May 9 13:27:03 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * common.h (SHN_LORESERVE): Rename from SHN_LORESERV. - (ELF32_R_TYPE, ELF32_R_INFO): Don't rely on size of unsigned char. - (ELF64_R_TYPE): Don't rely on size of unsigned long. - -Mon Apr 25 15:53:09 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * internal.h (Elf_Internal_Shdr): Use PTR, not void *. - -Fri Mar 11 00:34:59 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * mips.h (SHN_MIPS_TEXT, SHN_MIPS_DATA): Define. - -Sat Mar 5 14:08:54 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * internal.h: Remove Elf32_*, Elf64_* typedefs. These names - cause conflicts with system headers, e.g. link.h in gdb/solib.c. - Combine 32- and 64-bit versions of *_Internal_Dyn. - * common.h: Replace uses of Elf64_Word, Elf64_Xword typedefs - by their expansion. - * mips.h: Replace uses of Elf32_Word, Elf32_Sword, Elf32_Addr - typedefs by their expansion. Add DT_MIPS_RLD_MAP definition. - -Fri Feb 18 10:39:54 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * common.h (EM_CYGNUS_POWERPC): Define. This may be temporary, - depending upon how quickly I can find a real PowerPC ABI. - -Mon Feb 7 08:27:13 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * internal.h: Change HOST_64_BIT to BFD_HOST_64_BIT. - -Wed Feb 2 14:12:18 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * common.h: Add comments regarding value of EM_HPPA and how to - pick an unofficial value. - -Wed Nov 17 17:14:26 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * mips.h (SHT_MIPS_OPTIONS): Define. - -Mon Nov 8 17:57:00 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * mips.h: Added some more MIPS ABI macro definitions. - -Wed Nov 3 22:07:17 1993 Ken Raeburn (raeburn@rtl.cygnus.com) - - * common.h (EM_MIPS_RS4_BE): New macro. - -Tue Oct 12 07:28:18 1993 Ian Lance Taylor (ian@cygnus.com) - - * mips.h: New file. MIPS ABI specific information. - -Mon Jun 21 13:13:43 1993 Ken Raeburn (raeburn@poseidon.cygnus.com) - - * internal.h: Combined 32- and 64-bit versions of all structures - except *_Internal_Dyn. This will simply the assembler interface, - and some bfd code. - -Tue May 25 02:00:16 1993 Ken Raeburn (raeburn@cambridge.cygnus.com) - - * external.h, internal.h, common.h: Added 64-bit versions of some - structures and macros. Renamed old versions to put "32" in the - name. Some are unchanged. - -Thu Apr 29 12:12:20 1993 Ken Raeburn (raeburn@deneb.cygnus.com) - - * common.h (EM_HPPA, NT_VERSION, STN_UNDEF, DT_*): New macros. - * external.h (Elf_External_Dyn): New type. - - * internal.h (Elf_Intenral_Shdr): New field `size'. - (Elf_Internal_Dyn): New type. - -Tue Apr 20 16:03:45 1993 Fred Fish (fnf@cygnus.com) - - * dwarf.h (LANG_CHILL): Change value to one randomly picked in - the user defined range, to reduce probability of collisions. - -Sun Nov 15 09:34:02 1992 Fred Fish (fnf@cygnus.com) - - * dwarf.h (AT_src_coords): Whitespace change only. - * dwarf.h (AT_body_begin, AT_body_end, LANG_MODULA2): - Add from latest gcc. - * dwarf.h (LANG_CHILL): Add as GNU extension. - -Sat Aug 1 13:46:53 1992 Fred Fish (fnf@cygnus.com) - - * dwarf.h: Replace with current version from gcc distribution. - -Fri Jun 19 19:05:09 1992 John Gilmore (gnu at cygnus.com) - - * internal.h: Add real struct tags to all the Type_Defs, so they - can be used in prototypes where the Type_Defs are not known. - -Fri Apr 3 20:58:58 1992 Mark Eichin (eichin at cygnus.com) - - * common.h: added ELF_R_{SYM,TYPE,INFO} for handling relocation - info - added EM_MIPS, and corrected value of EM_860 based on System V ABI - manual. - - * external.h: added Elf_External_{Rel,Rela}. - - * internal.h: added Elf_Internal_{Rel,Rela}. - added rawdata to Elf_Internal_Shdr. - -Sat Nov 30 20:43:59 1991 Steve Chamberlain (sac at rtl.cygnus.com) - - * common.h, dwarf.h, external.h, internal.h, ChangeLog; moved from - ../elf- - - -Local Variables: -version-control: never -End: diff --git a/contrib/gdb/include/elf/common.h b/contrib/gdb/include/elf/common.h deleted file mode 100644 index c9e7474..0000000 --- a/contrib/gdb/include/elf/common.h +++ /dev/null @@ -1,239 +0,0 @@ -/* ELF support for BFD. - Copyright (C) 1991, 1992, 1993, 1994, 1996 Free Software Foundation, Inc. - - Written by Fred Fish @ Cygnus Support, from information published - in "UNIX System V Release 4, Programmers Guide: ANSI C and - Programming Support Tools". - -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. */ - - -/* This file is part of ELF support for BFD, and contains the portions - that are common to both the internal and external representations. - For example, ELFMAG0 is the byte 0x7F in both the internal (in-memory) - and external (in-file) representations. */ - -#ifndef _ELF_COMMON_H -#define _ELF_COMMON_H - -/* Fields in e_ident[] */ - -#define EI_MAG0 0 /* File identification byte 0 index */ -#define ELFMAG0 0x7F /* Magic number byte 0 */ - -#define EI_MAG1 1 /* File identification byte 1 index */ -#define ELFMAG1 'E' /* Magic number byte 1 */ - -#define EI_MAG2 2 /* File identification byte 2 index */ -#define ELFMAG2 'L' /* Magic number byte 2 */ - -#define EI_MAG3 3 /* File identification byte 3 index */ -#define ELFMAG3 'F' /* Magic number byte 3 */ - -#define EI_CLASS 4 /* File class */ -#define ELFCLASSNONE 0 /* Invalid class */ -#define ELFCLASS32 1 /* 32-bit objects */ -#define ELFCLASS64 2 /* 64-bit objects */ - -#define EI_DATA 5 /* Data encoding */ -#define ELFDATANONE 0 /* Invalid data encoding */ -#define ELFDATA2LSB 1 /* 2's complement, little endian */ -#define ELFDATA2MSB 2 /* 2's complement, big endian */ - -#define EI_VERSION 6 /* File version */ - -#define EI_PAD 7 /* Start of padding bytes */ - - -/* Values for e_type, which identifies the object file type */ - -#define ET_NONE 0 /* No file type */ -#define ET_REL 1 /* Relocatable file */ -#define ET_EXEC 2 /* Executable file */ -#define ET_DYN 3 /* Shared object file */ -#define ET_CORE 4 /* Core file */ -#define ET_LOPROC 0xFF00 /* Processor-specific */ -#define ET_HIPROC 0xFFFF /* Processor-specific */ - -/* Values for e_machine, which identifies the architecture */ - -#define EM_NONE 0 /* No machine */ -#define EM_M32 1 /* AT&T WE 32100 */ -#define EM_SPARC 2 /* SUN SPARC */ -#define EM_386 3 /* Intel 80386 */ -#define EM_68K 4 /* Motorola m68k family */ -#define EM_88K 5 /* Motorola m88k family */ -#define EM_860 7 /* Intel 80860 */ -#define EM_MIPS 8 /* MIPS R3000 (officially, big-endian only) */ - -#define EM_MIPS_RS4_BE 10 /* MIPS R4000 big-endian */ - -#define EM_SPARC64 11 /* SPARC v9 (not official) 64-bit */ - -#define EM_PARISC 15 /* HPPA */ - -#define EM_SPARC32PLUS 18 /* Sun's "v8plus" */ - -#define EM_PPC 20 /* PowerPC */ - -/* If it is necessary to assign new unofficial EM_* values, please pick large - random numbers (0x8523, 0xa7f2, etc.) to minimize the chances of collision - with official or non-GNU unofficial values. */ - -/* Cygnus PowerPC ELF backend. Written in the absence of an ABI. */ -#define EM_CYGNUS_POWERPC 0x9025 - -/* Old version of PowerPC, this should be removed shortly. */ -#define EM_PPC_OLD 17 - - -/* Values for e_version */ - -#define EV_NONE 0 /* Invalid ELF version */ -#define EV_CURRENT 1 /* Current version */ - -/* Values for program header, p_type field */ - -#define PT_NULL 0 /* Program header table entry unused */ -#define PT_LOAD 1 /* Loadable program segment */ -#define PT_DYNAMIC 2 /* Dynamic linking information */ -#define PT_INTERP 3 /* Program interpreter */ -#define PT_NOTE 4 /* Auxiliary information */ -#define PT_SHLIB 5 /* Reserved, unspecified semantics */ -#define PT_PHDR 6 /* Entry for header table itself */ -#define PT_LOPROC 0x70000000 /* Processor-specific */ -#define PT_HIPROC 0x7FFFFFFF /* Processor-specific */ - -/* Program segment permissions, in program header p_flags field */ - -#define PF_X (1 << 0) /* Segment is executable */ -#define PF_W (1 << 1) /* Segment is writable */ -#define PF_R (1 << 2) /* Segment is readable */ -#define PF_MASKPROC 0xF0000000 /* Processor-specific reserved bits */ - -/* Values for section header, sh_type field */ - -#define SHT_NULL 0 /* Section header table entry unused */ -#define SHT_PROGBITS 1 /* Program specific (private) data */ -#define SHT_SYMTAB 2 /* Link editing symbol table */ -#define SHT_STRTAB 3 /* A string table */ -#define SHT_RELA 4 /* Relocation entries with addends */ -#define SHT_HASH 5 /* A symbol hash table */ -#define SHT_DYNAMIC 6 /* Information for dynamic linking */ -#define SHT_NOTE 7 /* Information that marks file */ -#define SHT_NOBITS 8 /* Section occupies no space in file */ -#define SHT_REL 9 /* Relocation entries, no addends */ -#define SHT_SHLIB 10 /* Reserved, unspecified semantics */ -#define SHT_DYNSYM 11 /* Dynamic linking symbol table */ -#define SHT_LOPROC 0x70000000 /* Processor-specific semantics, lo */ -#define SHT_HIPROC 0x7FFFFFFF /* Processor-specific semantics, hi */ -#define SHT_LOUSER 0x80000000 /* Application-specific semantics */ -#define SHT_HIUSER 0x8FFFFFFF /* Application-specific semantics */ - -/* Values for section header, sh_flags field */ - -#define SHF_WRITE (1 << 0) /* Writable data during execution */ -#define SHF_ALLOC (1 << 1) /* Occupies memory during execution */ -#define SHF_EXECINSTR (1 << 2) /* Executable machine instructions */ -#define SHF_MASKPROC 0xF0000000 /* Processor-specific semantics */ - -/* Values of note segment descriptor types for core files. */ - -#define NT_PRSTATUS 1 /* Contains copy of prstatus struct */ -#define NT_FPREGSET 2 /* Contains copy of fpregset struct */ -#define NT_PRPSINFO 3 /* Contains copy of prpsinfo struct */ - -/* Values of note segment descriptor types for object files. */ -/* (Only for hppa right now. Should this be moved elsewhere?) */ - -#define NT_VERSION 1 /* Contains a version string. */ - -/* These three macros disassemble and assemble a symbol table st_info field, - which contains the symbol binding and symbol type. The STB_ and STT_ - defines identify the binding and type. */ - -#define ELF_ST_BIND(val) (((unsigned int)(val)) >> 4) -#define ELF_ST_TYPE(val) ((val) & 0xF) -#define ELF_ST_INFO(bind,type) (((bind) << 4) + ((type) & 0xF)) - -#define STN_UNDEF 0 /* undefined symbol index */ - -#define STB_LOCAL 0 /* Symbol not visible outside obj */ -#define STB_GLOBAL 1 /* Symbol visible outside obj */ -#define STB_WEAK 2 /* Like globals, lower precedence */ -#define STB_LOPROC 13 /* Application-specific semantics */ -#define STB_HIPROC 15 /* Application-specific semantics */ - -#define STT_NOTYPE 0 /* Symbol type is unspecified */ -#define STT_OBJECT 1 /* Symbol is a data object */ -#define STT_FUNC 2 /* Symbol is a code object */ -#define STT_SECTION 3 /* Symbol associated with a section */ -#define STT_FILE 4 /* Symbol gives a file name */ -#define STT_LOPROC 13 /* Application-specific semantics */ -#define STT_HIPROC 15 /* Application-specific semantics */ - -/* Special section indices, which may show up in st_shndx fields, among - other places. */ - -#define SHN_UNDEF 0 /* Undefined section reference */ -#define SHN_LORESERVE 0xFF00 /* Begin range of reserved indices */ -#define SHN_LOPROC 0xFF00 /* Begin range of appl-specific */ -#define SHN_HIPROC 0xFF1F /* End range of appl-specific */ -#define SHN_ABS 0xFFF1 /* Associated symbol is absolute */ -#define SHN_COMMON 0xFFF2 /* Associated symbol is in common */ -#define SHN_HIRESERVE 0xFFFF /* End range of reserved indices */ - -/* relocation info handling macros */ - -#define ELF32_R_SYM(i) ((i) >> 8) -#define ELF32_R_TYPE(i) ((i) & 0xff) -#define ELF32_R_INFO(s,t) (((s) << 8) + ((t) & 0xff)) - -#define ELF64_R_SYM(i) ((i) >> 32) -#define ELF64_R_TYPE(i) ((i) & 0xffffffff) -#define ELF64_R_INFO(s,t) (((bfd_vma) (s) << 32) + (bfd_vma) (t)) - -/* Dynamic section tags */ - -#define DT_NULL 0 -#define DT_NEEDED 1 -#define DT_PLTRELSZ 2 -#define DT_PLTGOT 3 -#define DT_HASH 4 -#define DT_STRTAB 5 -#define DT_SYMTAB 6 -#define DT_RELA 7 -#define DT_RELASZ 8 -#define DT_RELAENT 9 -#define DT_STRSZ 10 -#define DT_SYMENT 11 -#define DT_INIT 12 -#define DT_FINI 13 -#define DT_SONAME 14 -#define DT_RPATH 15 -#define DT_SYMBOLIC 16 -#define DT_REL 17 -#define DT_RELSZ 18 -#define DT_RELENT 19 -#define DT_PLTREL 20 -#define DT_DEBUG 21 -#define DT_TEXTREL 22 -#define DT_JMPREL 23 -#define DT_LOPROC 0x70000000 -#define DT_HIPROC 0x7fffffff - -#endif /* _ELF_COMMON_H */ diff --git a/contrib/gdb/include/elf/dwarf.h b/contrib/gdb/include/elf/dwarf.h deleted file mode 100644 index 4333d5e..0000000 --- a/contrib/gdb/include/elf/dwarf.h +++ /dev/null @@ -1,319 +0,0 @@ -/* Declarations and definitions of codes relating to the DWARF symbolic - debugging information format. - - Written by Ron Guilmette (rfg@ncd.com) - -Copyright (C) 1992 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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 GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -/* This file is derived from the DWARF specification (a public document) - Revision 1.0.1 (April 8, 1992) developed by the UNIX International - Programming Languages Special Interest Group (UI/PLSIG) and distributed - by UNIX International. Copies of this specification are available from - UNIX International, 20 Waterview Boulevard, Parsippany, NJ, 07054. -*/ - -#ifndef _ELF_DWARF_H -#define _ELF_DWARF_H - -/* Tag names and codes. */ - -enum dwarf_tag { - TAG_padding = 0x0000, - TAG_array_type = 0x0001, - TAG_class_type = 0x0002, - TAG_entry_point = 0x0003, - TAG_enumeration_type = 0x0004, - TAG_formal_parameter = 0x0005, - TAG_global_subroutine = 0x0006, - TAG_global_variable = 0x0007, - /* 0x0008 -- reserved */ - /* 0x0009 -- reserved */ - TAG_label = 0x000a, - TAG_lexical_block = 0x000b, - TAG_local_variable = 0x000c, - TAG_member = 0x000d, - /* 0x000e -- reserved */ - TAG_pointer_type = 0x000f, - TAG_reference_type = 0x0010, - TAG_compile_unit = 0x0011, - TAG_string_type = 0x0012, - TAG_structure_type = 0x0013, - TAG_subroutine = 0x0014, - TAG_subroutine_type = 0x0015, - TAG_typedef = 0x0016, - TAG_union_type = 0x0017, - TAG_unspecified_parameters = 0x0018, - TAG_variant = 0x0019, - TAG_common_block = 0x001a, - TAG_common_inclusion = 0x001b, - TAG_inheritance = 0x001c, - TAG_inlined_subroutine = 0x001d, - TAG_module = 0x001e, - TAG_ptr_to_member_type = 0x001f, - TAG_set_type = 0x0020, - TAG_subrange_type = 0x0021, - TAG_with_stmt = 0x0022, - - /* GNU extensions */ - - TAG_format_label = 0x8000, /* for FORTRAN 77 and Fortran 90 */ - TAG_namelist = 0x8001, /* For Fortran 90 */ - TAG_function_template = 0x8002, /* for C++ */ - TAG_class_template = 0x8003 /* for C++ */ -}; - -#define TAG_lo_user 0x8000 /* implementation-defined range start */ -#define TAG_hi_user 0xffff /* implementation-defined range end */ -#define TAG_source_file TAG_compile_unit /* for backward compatibility */ - -/* Form names and codes. */ - -enum dwarf_form { - FORM_ADDR = 0x1, - FORM_REF = 0x2, - FORM_BLOCK2 = 0x3, - FORM_BLOCK4 = 0x4, - FORM_DATA2 = 0x5, - FORM_DATA4 = 0x6, - FORM_DATA8 = 0x7, - FORM_STRING = 0x8 -}; - -/* Attribute names and codes. */ - -enum dwarf_attribute { - AT_sibling = (0x0010|FORM_REF), - AT_location = (0x0020|FORM_BLOCK2), - AT_name = (0x0030|FORM_STRING), - AT_fund_type = (0x0050|FORM_DATA2), - AT_mod_fund_type = (0x0060|FORM_BLOCK2), - AT_user_def_type = (0x0070|FORM_REF), - AT_mod_u_d_type = (0x0080|FORM_BLOCK2), - AT_ordering = (0x0090|FORM_DATA2), - AT_subscr_data = (0x00a0|FORM_BLOCK2), - AT_byte_size = (0x00b0|FORM_DATA4), - AT_bit_offset = (0x00c0|FORM_DATA2), - AT_bit_size = (0x00d0|FORM_DATA4), - /* (0x00e0|FORM_xxxx) -- reserved */ - AT_element_list = (0x00f0|FORM_BLOCK4), - AT_stmt_list = (0x0100|FORM_DATA4), - AT_low_pc = (0x0110|FORM_ADDR), - AT_high_pc = (0x0120|FORM_ADDR), - AT_language = (0x0130|FORM_DATA4), - AT_member = (0x0140|FORM_REF), - AT_discr = (0x0150|FORM_REF), - AT_discr_value = (0x0160|FORM_BLOCK2), - /* (0x0170|FORM_xxxx) -- reserved */ - /* (0x0180|FORM_xxxx) -- reserved */ - AT_string_length = (0x0190|FORM_BLOCK2), - AT_common_reference = (0x01a0|FORM_REF), - AT_comp_dir = (0x01b0|FORM_STRING), - AT_const_value_string = (0x01c0|FORM_STRING), - AT_const_value_data2 = (0x01c0|FORM_DATA2), - AT_const_value_data4 = (0x01c0|FORM_DATA4), - AT_const_value_data8 = (0x01c0|FORM_DATA8), - AT_const_value_block2 = (0x01c0|FORM_BLOCK2), - AT_const_value_block4 = (0x01c0|FORM_BLOCK4), - AT_containing_type = (0x01d0|FORM_REF), - AT_default_value_addr = (0x01e0|FORM_ADDR), - AT_default_value_data2 = (0x01e0|FORM_DATA2), - AT_default_value_data4 = (0x01e0|FORM_DATA4), - AT_default_value_data8 = (0x01e0|FORM_DATA8), - AT_default_value_string = (0x01e0|FORM_STRING), - AT_friends = (0x01f0|FORM_BLOCK2), - AT_inline = (0x0200|FORM_STRING), - AT_is_optional = (0x0210|FORM_STRING), - AT_lower_bound_ref = (0x0220|FORM_REF), - AT_lower_bound_data2 = (0x0220|FORM_DATA2), - AT_lower_bound_data4 = (0x0220|FORM_DATA4), - AT_lower_bound_data8 = (0x0220|FORM_DATA8), - AT_private = (0x0240|FORM_STRING), - AT_producer = (0x0250|FORM_STRING), - AT_program = (0x0230|FORM_STRING), - AT_protected = (0x0260|FORM_STRING), - AT_prototyped = (0x0270|FORM_STRING), - AT_public = (0x0280|FORM_STRING), - AT_pure_virtual = (0x0290|FORM_STRING), - AT_return_addr = (0x02a0|FORM_BLOCK2), - AT_abstract_origin = (0x02b0|FORM_REF), - AT_start_scope = (0x02c0|FORM_DATA4), - AT_stride_size = (0x02e0|FORM_DATA4), - AT_upper_bound_ref = (0x02f0|FORM_REF), - AT_upper_bound_data2 = (0x02f0|FORM_DATA2), - AT_upper_bound_data4 = (0x02f0|FORM_DATA4), - AT_upper_bound_data8 = (0x02f0|FORM_DATA8), - AT_virtual = (0x0300|FORM_STRING), - - /* GNU extensions. */ - - AT_sf_names = (0x8000|FORM_DATA4), - AT_src_info = (0x8010|FORM_DATA4), - AT_mac_info = (0x8020|FORM_DATA4), - AT_src_coords = (0x8030|FORM_DATA4), - AT_body_begin = (0x8040|FORM_ADDR), - AT_body_end = (0x8050|FORM_ADDR) -}; - -#define AT_lo_user 0x8000 /* implementation-defined range start */ -#define AT_hi_user 0xffff /* implementation-defined range end */ - -/* Location atom names and codes. */ - -enum dwarf_location_atom { - OP_REG = 0x01, - OP_BASEREG = 0x02, - OP_ADDR = 0x03, - OP_CONST = 0x04, - OP_DEREF2 = 0x05, - OP_DEREF4 = 0x06, - OP_ADD = 0x07 -}; - -#define OP_LO_USER 0x80 /* implementation-defined range start */ -#define OP_HI_USER 0xff /* implementation-defined range end */ - -/* Fundamental type names and codes. */ - -enum dwarf_fundamental_type { - FT_char = 0x0001, - FT_signed_char = 0x0002, - FT_unsigned_char = 0x0003, - FT_short = 0x0004, - FT_signed_short = 0x0005, - FT_unsigned_short = 0x0006, - FT_integer = 0x0007, - FT_signed_integer = 0x0008, - FT_unsigned_integer = 0x0009, - FT_long = 0x000a, - FT_signed_long = 0x000b, - FT_unsigned_long = 0x000c, - FT_pointer = 0x000d, /* an alias for (void *) */ - FT_float = 0x000e, - FT_dbl_prec_float = 0x000f, - FT_ext_prec_float = 0x0010, /* breaks "classic" svr4 SDB */ - FT_complex = 0x0011, /* breaks "classic" svr4 SDB */ - FT_dbl_prec_complex = 0x0012, /* breaks "classic" svr4 SDB */ - /* 0x0013 -- reserved */ - FT_void = 0x0014, - FT_boolean = 0x0015, /* breaks "classic" svr4 SDB */ - FT_ext_prec_complex = 0x0016, /* breaks "classic" svr4 SDB */ - FT_label = 0x0017, - - /* GNU extensions - The low order byte must indicate the size (in bytes) for the type. - All of these types will probably break "classic" svr4 SDB */ - - FT_long_long = 0x8008, - FT_signed_long_long = 0x8108, - FT_unsigned_long_long = 0x8208, - - FT_int8 = 0x9001, - FT_signed_int8 = 0x9101, - FT_unsigned_int8 = 0x9201, - FT_int16 = 0x9302, - FT_signed_int16 = 0x9402, - FT_unsigned_int16 = 0x9502, - FT_int32 = 0x9604, - FT_signed_int32 = 0x9704, - FT_unsigned_int32 = 0x9804, - FT_int64 = 0x9908, - FT_signed_int64 = 0x9a08, - FT_unsigned_int64 = 0x9b08, - - FT_real32 = 0xa004, - FT_real64 = 0xa108, - FT_real96 = 0xa20c, - FT_real128 = 0xa310 -}; - -#define FT_lo_user 0x8000 /* implementation-defined range start */ -#define FT_hi_user 0xffff /* implementation defined range end */ - -/* Type modifier names and codes. */ - -enum dwarf_type_modifier { - MOD_pointer_to = 0x01, - MOD_reference_to = 0x02, - MOD_const = 0x03, - MOD_volatile = 0x04 -}; - -#define MOD_lo_user 0x80 /* implementation-defined range start */ -#define MOD_hi_user 0xff /* implementation-defined range end */ - -/* Array ordering names and codes. */ - -enum dwarf_array_dim_ordering { - ORD_row_major = 0, - ORD_col_major = 1 -}; - -/* Array subscript format names and codes. */ - -enum dwarf_subscr_data_formats { - FMT_FT_C_C = 0x0, - FMT_FT_C_X = 0x1, - FMT_FT_X_C = 0x2, - FMT_FT_X_X = 0x3, - FMT_UT_C_C = 0x4, - FMT_UT_C_X = 0x5, - FMT_UT_X_C = 0x6, - FMT_UT_X_X = 0x7, - FMT_ET = 0x8 -}; - -/* Derived from above for ease of use. */ - -#define FMT_CODE(_FUNDAMENTAL_TYPE_P, _UB_CONST_P, _LB_CONST_P) \ - (((_FUNDAMENTAL_TYPE_P) ? 0 : 4) \ - | ((_UB_CONST_P) ? 0 : 2) \ - | ((_LB_CONST_P) ? 0 : 1)) - -/* Source language names and codes. */ - -enum dwarf_source_language { - LANG_C89 = 0x00000001, - LANG_C = 0x00000002, - LANG_ADA83 = 0x00000003, - LANG_C_PLUS_PLUS = 0x00000004, - LANG_COBOL74 = 0x00000005, - LANG_COBOL85 = 0x00000006, - LANG_FORTRAN77 = 0x00000007, - LANG_FORTRAN90 = 0x00000008, - LANG_PASCAL83 = 0x00000009, - LANG_MODULA2 = 0x0000000a, - - /* GNU extensions */ - - LANG_CHILL = 0x00009af3 /* random value for GNU Chill */ -}; - -#define LANG_lo_user 0x00008000 /* implementation-defined range start */ -#define LANG_hi_user 0x0000ffff /* implementation-defined range end */ - -/* Names and codes for GNU "macinfo" extension. */ - -enum dwarf_macinfo_record_type { - MACINFO_start = 's', - MACINFO_resume = 'r', - MACINFO_define = 'd', - MACINFO_undef = 'u' -}; - -#endif /* _ELF_DWARF_H */ diff --git a/contrib/gdb/include/elf/external.h b/contrib/gdb/include/elf/external.h deleted file mode 100644 index e6618cb..0000000 --- a/contrib/gdb/include/elf/external.h +++ /dev/null @@ -1,195 +0,0 @@ -/* ELF support for BFD. - Copyright (C) 1991, 1992 Free Software Foundation, Inc. - - Written by Fred Fish @ Cygnus Support, from information published - in "UNIX System V Release 4, Programmers Guide: ANSI C and - Programming Support Tools". - -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. */ - - -/* This file is part of ELF support for BFD, and contains the portions - that describe how ELF is represented externally by the BFD library. - I.E. it describes the in-file representation of ELF. It requires - the elf-common.h file which contains the portions that are common to - both the internal and external representations. */ - -/* The 64-bit stuff is kind of random. Perhaps someone will publish a - spec someday. */ - -#ifndef _ELF_EXTERNAL_H -#define _ELF_EXTERNAL_H - -/* ELF Header (32-bit implementations) */ - -typedef struct { - unsigned char e_ident[16]; /* ELF "magic number" */ - unsigned char e_type[2]; /* Identifies object file type */ - unsigned char e_machine[2]; /* Specifies required architecture */ - unsigned char e_version[4]; /* Identifies object file version */ - unsigned char e_entry[4]; /* Entry point virtual address */ - unsigned char e_phoff[4]; /* Program header table file offset */ - unsigned char e_shoff[4]; /* Section header table file offset */ - unsigned char e_flags[4]; /* Processor-specific flags */ - unsigned char e_ehsize[2]; /* ELF header size in bytes */ - unsigned char e_phentsize[2]; /* Program header table entry size */ - unsigned char e_phnum[2]; /* Program header table entry count */ - unsigned char e_shentsize[2]; /* Section header table entry size */ - unsigned char e_shnum[2]; /* Section header table entry count */ - unsigned char e_shstrndx[2]; /* Section header string table index */ -} Elf32_External_Ehdr; - -typedef struct { - unsigned char e_ident[16]; /* ELF "magic number" */ - unsigned char e_type[2]; /* Identifies object file type */ - unsigned char e_machine[2]; /* Specifies required architecture */ - unsigned char e_version[4]; /* Identifies object file version */ - unsigned char e_entry[8]; /* Entry point virtual address */ - unsigned char e_phoff[8]; /* Program header table file offset */ - unsigned char e_shoff[8]; /* Section header table file offset */ - unsigned char e_flags[4]; /* Processor-specific flags */ - unsigned char e_ehsize[2]; /* ELF header size in bytes */ - unsigned char e_phentsize[2]; /* Program header table entry size */ - unsigned char e_phnum[2]; /* Program header table entry count */ - unsigned char e_shentsize[2]; /* Section header table entry size */ - unsigned char e_shnum[2]; /* Section header table entry count */ - unsigned char e_shstrndx[2]; /* Section header string table index */ -} Elf64_External_Ehdr; - -/* Program header */ - -typedef struct { - unsigned char p_type[4]; /* Identifies program segment type */ - unsigned char p_offset[4]; /* Segment file offset */ - unsigned char p_vaddr[4]; /* Segment virtual address */ - unsigned char p_paddr[4]; /* Segment physical address */ - unsigned char p_filesz[4]; /* Segment size in file */ - unsigned char p_memsz[4]; /* Segment size in memory */ - unsigned char p_flags[4]; /* Segment flags */ - unsigned char p_align[4]; /* Segment alignment, file & memory */ -} Elf32_External_Phdr; - -typedef struct { - unsigned char p_type[4]; /* Identifies program segment type */ - unsigned char p_flags[4]; /* Segment flags */ - unsigned char p_offset[8]; /* Segment file offset */ - unsigned char p_vaddr[8]; /* Segment virtual address */ - unsigned char p_paddr[8]; /* Segment physical address */ - unsigned char p_filesz[8]; /* Segment size in file */ - unsigned char p_memsz[8]; /* Segment size in memory */ - unsigned char p_align[8]; /* Segment alignment, file & memory */ -} Elf64_External_Phdr; - -/* Section header */ - -typedef struct { - unsigned char sh_name[4]; /* Section name, index in string tbl */ - unsigned char sh_type[4]; /* Type of section */ - unsigned char sh_flags[4]; /* Miscellaneous section attributes */ - unsigned char sh_addr[4]; /* Section virtual addr at execution */ - unsigned char sh_offset[4]; /* Section file offset */ - unsigned char sh_size[4]; /* Size of section in bytes */ - unsigned char sh_link[4]; /* Index of another section */ - unsigned char sh_info[4]; /* Additional section information */ - unsigned char sh_addralign[4]; /* Section alignment */ - unsigned char sh_entsize[4]; /* Entry size if section holds table */ -} Elf32_External_Shdr; - -typedef struct { - unsigned char sh_name[4]; /* Section name, index in string tbl */ - unsigned char sh_type[4]; /* Type of section */ - unsigned char sh_flags[8]; /* Miscellaneous section attributes */ - unsigned char sh_addr[8]; /* Section virtual addr at execution */ - unsigned char sh_offset[8]; /* Section file offset */ - unsigned char sh_size[8]; /* Size of section in bytes */ - unsigned char sh_link[4]; /* Index of another section */ - unsigned char sh_info[4]; /* Additional section information */ - unsigned char sh_addralign[8]; /* Section alignment */ - unsigned char sh_entsize[8]; /* Entry size if section holds table */ -} Elf64_External_Shdr; - -/* Symbol table entry */ - -typedef struct { - unsigned char st_name[4]; /* Symbol name, index in string tbl */ - unsigned char st_value[4]; /* Value of the symbol */ - unsigned char st_size[4]; /* Associated symbol size */ - unsigned char st_info[1]; /* Type and binding attributes */ - unsigned char st_other[1]; /* No defined meaning, 0 */ - unsigned char st_shndx[2]; /* Associated section index */ -} Elf32_External_Sym; - -typedef struct { - unsigned char st_name[4]; /* Symbol name, index in string tbl */ - unsigned char st_info[1]; /* Type and binding attributes */ - unsigned char st_other[1]; /* No defined meaning, 0 */ - unsigned char st_shndx[2]; /* Associated section index */ - unsigned char st_value[8]; /* Value of the symbol */ - unsigned char st_size[8]; /* Associated symbol size */ -} Elf64_External_Sym; - -/* Note segments */ - -typedef struct { - unsigned char namesz[4]; /* Size of entry's owner string */ - unsigned char descsz[4]; /* Size of the note descriptor */ - unsigned char type[4]; /* Interpretation of the descriptor */ - char name[1]; /* Start of the name+desc data */ -} Elf_External_Note; - -/* Relocation Entries */ -typedef struct { - unsigned char r_offset[4]; /* Location at which to apply the action */ - unsigned char r_info[4]; /* index and type of relocation */ -} Elf32_External_Rel; - -typedef struct { - unsigned char r_offset[4]; /* Location at which to apply the action */ - unsigned char r_info[4]; /* index and type of relocation */ - unsigned char r_addend[4]; /* Constant addend used to compute value */ -} Elf32_External_Rela; - -typedef struct { - unsigned char r_offset[8]; /* Location at which to apply the action */ - unsigned char r_info[8]; /* index and type of relocation */ -} Elf64_External_Rel; - -typedef struct { - unsigned char r_offset[8]; /* Location at which to apply the action */ - unsigned char r_info[8]; /* index and type of relocation */ - unsigned char r_addend[8]; /* Constant addend used to compute value */ -} Elf64_External_Rela; - -/* dynamic section structure */ - -typedef struct { - unsigned char d_tag[4]; /* entry tag value */ - union { - unsigned char d_val[4]; - unsigned char d_ptr[4]; - } d_un; -} Elf32_External_Dyn; - -typedef struct { - unsigned char d_tag[8]; /* entry tag value */ - union { - unsigned char d_val[8]; - unsigned char d_ptr[8]; - } d_un; -} Elf64_External_Dyn; - -#endif /* _ELF_EXTERNAL_H */ diff --git a/contrib/gdb/include/elf/hppa.h b/contrib/gdb/include/elf/hppa.h deleted file mode 100644 index c34077f..0000000 --- a/contrib/gdb/include/elf/hppa.h +++ /dev/null @@ -1,94 +0,0 @@ -/* HPPA ELF support for BFD. - Copyright (C) 1993, 1994 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. */ - -/* This file holds definitions specific to the HPPA ELF ABI. Note - that most of this is not actually implemented by BFD. */ - -#ifndef _ELF_HPPA_H -#define _ELF_HPPA_H - -/* Processor specific flags for the ELF header e_flags field. */ - -/* Target processor IDs to be placed in the low 16 bits of the flags - field. Note these names are shared with SOM, and therefore do not - follow ELF naming conventions. */ - -/* PA 1.0 big endian. */ -#ifndef CPU_PA_RISC1_0 -#define CPU_PA_RISC1_0 0x0000020b -#endif - -/* PA 1.1 big endian. */ -#ifndef CPU_PA_RISC1_1 -#define CPU_PA_RISC1_1 0x00000210 -#endif - -/* PA 1.0 little endian (unsupported) is 0x0000028b. */ -/* PA 1.1 little endian (unsupported) is 0x00000290. */ - -/* Trap null address dereferences. */ -#define ELF_PARISC_TRAPNIL 0x00010000 - -/* .PARISC.archext section is present. */ -#define EF_PARISC_EXT 0x00020000 - -/* Processor specific section types. */ - -/* Holds the global offset table, a table of pointers to external - data. */ -#define SHT_PARISC_GOT SHT_LOPROC+0 - -/* Nonloadable section containing information in architecture - extensions used by the code. */ -#define SHT_PARISC_ARCH SHT_LOPROC+1 - -/* Section in which $global$ is defined. */ -#define SHT_PARISC_GLOBAL SHT_LOPROC+2 - -/* Section holding millicode routines (mul, div, rem, dyncall, etc. */ -#define SHT_PARISC_MILLI SHT_LOPROC+3 - -/* Section holding unwind information for use by debuggers. */ -#define SHT_PARISC_UNWIND SHT_LOPROC+4 - -/* Section holding the procedure linkage table. */ -#define SHT_PARISC_PLT SHT_LOPROC+5 - -/* Short initialized and uninitialized data. */ -#define SHT_PARISC_SDATA SHT_LOPROC+6 -#define SHT_PARISC_SBSS SHT_LOPROC+7 - -/* Optional section holding argument location/relocation info. */ -#define SHT_PARISC_SYMEXTN SHT_LOPROC+8 - -/* Option section for linker stubs. */ -#define SHT_PARISC_STUBS SHT_LOPROC+9 - -/* Processor specific section flags. */ - -/* This section is near the global data pointer and thus allows short - addressing modes to be used. */ -#define SHF_PARISC_SHORT 0x20000000 - -/* Processor specific symbol types. */ - -/* Millicode function entry point. */ -#define STT_PARISC_MILLICODE STT_LOPROC+0 - -#endif /* _ELF_HPPA_H */ diff --git a/contrib/gdb/include/elf/internal.h b/contrib/gdb/include/elf/internal.h deleted file mode 100644 index 6375e89..0000000 --- a/contrib/gdb/include/elf/internal.h +++ /dev/null @@ -1,207 +0,0 @@ -/* ELF support for BFD. - Copyright (C) 1991, 1992, 1993, 1994 Free Software Foundation, Inc. - - Written by Fred Fish @ Cygnus Support, from information published - in "UNIX System V Release 4, Programmers Guide: ANSI C and - Programming Support Tools". - -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. */ - - -/* This file is part of ELF support for BFD, and contains the portions - that describe how ELF is represented internally in the BFD library. - I.E. it describes the in-memory representation of ELF. It requires - the elf-common.h file which contains the portions that are common to - both the internal and external representations. */ - - -/* NOTE that these structures are not kept in the same order as they appear - in the object file. In some cases they've been reordered for more optimal - packing under various circumstances. */ - -#ifndef _ELF_INTERNAL_H -#define _ELF_INTERNAL_H - -/* ELF Header */ - -#define EI_NIDENT 16 /* Size of e_ident[] */ - -typedef struct elf_internal_ehdr { - unsigned char e_ident[EI_NIDENT]; /* ELF "magic number" */ - bfd_vma e_entry; /* Entry point virtual address */ - bfd_signed_vma e_phoff; /* Program header table file offset */ - bfd_signed_vma e_shoff; /* Section header table file offset */ - unsigned long e_version; /* Identifies object file version */ - unsigned long e_flags; /* Processor-specific flags */ - unsigned short e_type; /* Identifies object file type */ - unsigned short e_machine; /* Specifies required architecture */ - unsigned short e_ehsize; /* ELF header size in bytes */ - unsigned short e_phentsize; /* Program header table entry size */ - unsigned short e_phnum; /* Program header table entry count */ - unsigned short e_shentsize; /* Section header table entry size */ - unsigned short e_shnum; /* Section header table entry count */ - unsigned short e_shstrndx; /* Section header string table index */ -} Elf_Internal_Ehdr; - -#define elf32_internal_ehdr elf_internal_ehdr -#define Elf32_Internal_Ehdr Elf_Internal_Ehdr -#define elf64_internal_ehdr elf_internal_ehdr -#define Elf64_Internal_Ehdr Elf_Internal_Ehdr - -/* Program header */ - -struct elf_internal_phdr { - unsigned long p_type; /* Identifies program segment type */ - unsigned long p_flags; /* Segment flags */ - bfd_vma p_offset; /* Segment file offset */ - bfd_vma p_vaddr; /* Segment virtual address */ - bfd_vma p_paddr; /* Segment physical address */ - bfd_vma p_filesz; /* Segment size in file */ - bfd_vma p_memsz; /* Segment size in memory */ - bfd_vma p_align; /* Segment alignment, file & memory */ -}; - -typedef struct elf_internal_phdr Elf_Internal_Phdr; -#define elf32_internal_phdr elf_internal_phdr -#define Elf32_Internal_Phdr Elf_Internal_Phdr -#define elf64_internal_phdr elf_internal_phdr -#define Elf64_Internal_Phdr Elf_Internal_Phdr - -/* Section header */ - -typedef struct elf_internal_shdr { - unsigned int sh_name; /* Section name, index in string tbl */ - unsigned int sh_type; /* Type of section */ - bfd_vma sh_flags; /* Miscellaneous section attributes */ - bfd_vma sh_addr; /* Section virtual addr at execution */ - bfd_size_type sh_size; /* Size of section in bytes */ - bfd_size_type sh_entsize; /* Entry size if section holds table */ - unsigned long sh_link; /* Index of another section */ - unsigned long sh_info; /* Additional section information */ - file_ptr sh_offset; /* Section file offset */ - unsigned int sh_addralign; /* Section alignment */ - - /* The internal rep also has some cached info associated with it. */ - asection * bfd_section; /* Associated BFD section. */ - PTR contents; /* Section contents. */ -} Elf_Internal_Shdr; - -#define elf32_internal_shdr elf_internal_shdr -#define Elf32_Internal_Shdr Elf_Internal_Shdr -#define elf64_internal_shdr elf_internal_shdr -#define Elf64_Internal_Shdr Elf_Internal_Shdr - -/* Symbol table entry */ - -struct elf_internal_sym { - bfd_vma st_value; /* Value of the symbol */ - bfd_vma st_size; /* Associated symbol size */ - unsigned long st_name; /* Symbol name, index in string tbl */ - unsigned char st_info; /* Type and binding attributes */ - unsigned char st_other; /* No defined meaning, 0 */ - unsigned short st_shndx; /* Associated section index */ -}; - -typedef struct elf_internal_sym Elf_Internal_Sym; - -#define elf32_internal_sym elf_internal_sym -#define elf64_internal_sym elf_internal_sym -#define Elf32_Internal_Sym Elf_Internal_Sym -#define Elf64_Internal_Sym Elf_Internal_Sym - -/* Note segments */ - -typedef struct elf_internal_note { - unsigned long namesz; /* Size of entry's owner string */ - unsigned long descsz; /* Size of the note descriptor */ - unsigned long type; /* Interpretation of the descriptor */ - char name[1]; /* Start of the name+desc data */ -} Elf_Internal_Note; -#define Elf32_Internal_Note Elf_Internal_Note -#define elf32_internal_note elf_internal_note - -/* Relocation Entries */ - -typedef struct elf_internal_rel { - bfd_vma r_offset; /* Location at which to apply the action */ - /* This needs to support 64-bit values in elf64. */ - bfd_vma r_info; /* index and type of relocation */ -} Elf_Internal_Rel; - -#define elf32_internal_rel elf_internal_rel -#define Elf32_Internal_Rel Elf_Internal_Rel -#define elf64_internal_rel elf_internal_rel -#define Elf64_Internal_Rel Elf_Internal_Rel - -typedef struct elf_internal_rela { - bfd_vma r_offset; /* Location at which to apply the action */ - bfd_vma r_info; /* Index and Type of relocation */ - bfd_signed_vma r_addend; /* Constant addend used to compute value */ -} Elf_Internal_Rela; - -#define elf32_internal_rela elf_internal_rela -#define elf64_internal_rela elf_internal_rela -#define Elf32_Internal_Rela Elf_Internal_Rela -#define Elf64_Internal_Rela Elf_Internal_Rela - -/* dynamic section structure */ - -typedef struct elf_internal_dyn { - /* This needs to support 64-bit values in elf64. */ - bfd_vma d_tag; /* entry tag value */ - union { - /* This needs to support 64-bit values in elf64. */ - bfd_vma d_val; - bfd_vma d_ptr; - } d_un; -} Elf_Internal_Dyn; - -#define elf32_internal_dyn elf_internal_dyn -#define elf64_internal_dyn elf_internal_dyn -#define Elf32_Internal_Dyn Elf_Internal_Dyn -#define Elf64_Internal_Dyn Elf_Internal_Dyn - -/* This structure is used to describe how sections should be assigned - to program segments. */ - -struct elf_segment_map -{ - /* Next program segment. */ - struct elf_segment_map *next; - /* Program segment type. */ - unsigned long p_type; - /* Program segment flags. */ - unsigned long p_flags; - /* Program segment physical address. */ - bfd_vma p_paddr; - /* Whether the p_flags field is valid; if not, the flags are based - on the section flags. */ - unsigned int p_flags_valid : 1; - /* Whether the p_paddr field is valid; if not, the physical address - is based on the section lma values. */ - unsigned int p_paddr_valid : 1; - /* Whether this segment includes the file header. */ - unsigned int includes_filehdr : 1; - /* Whether this segment includes the program headers. */ - unsigned int includes_phdrs : 1; - /* Number of sections (may be 0). */ - unsigned int count; - /* Sections. Actual number of elements is in count field. */ - asection *sections[1]; -}; - -#endif /* _ELF_INTERNAL_H */ diff --git a/contrib/gdb/include/elf/mips.h b/contrib/gdb/include/elf/mips.h deleted file mode 100644 index f0d8cd7..0000000 --- a/contrib/gdb/include/elf/mips.h +++ /dev/null @@ -1,298 +0,0 @@ -/* MIPS ELF support for BFD. - Copyright (C) 1993, 1994 Free Software Foundation, Inc. - - By Ian Lance Taylor, Cygnus Support, , from - information in the System V Application Binary Interface, MIPS - Processor Supplement. - -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. */ - -/* This file holds definitions specific to the MIPS ELF ABI. Note - that most of this is not actually implemented by BFD. */ - -#ifndef _ELF_MIPS_H -#define _ELF_MIPS_H - -/* Processor specific flags for the ELF header e_flags field. */ - -/* At least one .noreorder directive appears in the source. */ -#define EF_MIPS_NOREORDER 0x00000001 - -/* File contains position independent code. */ -#define EF_MIPS_PIC 0x00000002 - -/* Code in file uses the standard calling sequence for calling - position independent code. */ -#define EF_MIPS_CPIC 0x00000004 - -/* Four bit MIPS architecture field. */ -#define EF_MIPS_ARCH 0xf0000000 - -/* -mips1 code. */ -#define E_MIPS_ARCH_1 0x00000000 - -/* -mips2 code. */ -#define E_MIPS_ARCH_2 0x10000000 - -/* -mips3 code. */ -#define E_MIPS_ARCH_3 0x20000000 - -/* Processor specific section indices. These sections do not actually - exist. Symbols with a st_shndx field corresponding to one of these - values have a special meaning. */ - -/* Defined and allocated common symbol. Value is virtual address. If - relocated, alignment must be preserved. */ -#define SHN_MIPS_ACOMMON 0xff00 - -/* Defined and allocated text symbol. Value is virtual address. - Occur in the dynamic symbol table of Alpha OSF/1 and Irix 5 executables. */ -#define SHN_MIPS_TEXT 0xff01 - -/* Defined and allocated data symbol. Value is virtual address. - Occur in the dynamic symbol table of Alpha OSF/1 and Irix 5 executables. */ -#define SHN_MIPS_DATA 0xff02 - -/* Small common symbol. */ -#define SHN_MIPS_SCOMMON 0xff03 - -/* Small undefined symbol. */ -#define SHN_MIPS_SUNDEFINED 0xff04 - -/* Processor specific section types. */ - -/* Section contains the set of dynamic shared objects used when - statically linking. */ -#define SHT_MIPS_LIBLIST 0x70000000 - -/* I'm not sure what this is, but it's used on Irix 5. */ -#define SHT_MIPS_MSYM 0x70000001 - -/* Section contains list of symbols whose definitions conflict with - symbols defined in shared objects. */ -#define SHT_MIPS_CONFLICT 0x70000002 - -/* Section contains the global pointer table. */ -#define SHT_MIPS_GPTAB 0x70000003 - -/* Section contains microcode information. The exact format is - unspecified. */ -#define SHT_MIPS_UCODE 0x70000004 - -/* Section contains some sort of debugging information. The exact - format is unspecified. It's probably ECOFF symbols. */ -#define SHT_MIPS_DEBUG 0x70000005 - -/* Section contains register usage information. */ -#define SHT_MIPS_REGINFO 0x70000006 - -/* Section contains miscellaneous options (used on Irix). */ -#define SHT_MIPS_OPTIONS 0x7000000d - -/* DWARF debugging section (used on Irix 6). */ -#define SHT_MIPS_DWARF 0x7000001e - -/* Events section. This appears on Irix 6. I don't know what it - means. */ -#define SHT_MIPS_EVENTS 0x70000021 - -/* A section of type SHT_MIPS_LIBLIST contains an array of the - following structure. The sh_link field is the section index of the - string table. The sh_info field is the number of entries in the - section. */ -typedef struct -{ - /* String table index for name of shared object. */ - unsigned long l_name; - /* Time stamp. */ - unsigned long l_time_stamp; - /* Checksum of symbol names and common sizes. */ - unsigned long l_checksum; - /* String table index for version. */ - unsigned long l_version; - /* Flags. */ - unsigned long l_flags; -} Elf32_Lib; - -/* The l_flags field of an Elf32_Lib structure may contain the - following flags. */ - -/* Require an exact match at runtime. */ -#define LL_EXACT_MATCH 0x00000001 - -/* Ignore version incompatibilities at runtime. */ -#define LL_IGNORE_INT_VER 0x00000002 - -/* A section of type SHT_MIPS_CONFLICT is an array of indices into the - .dynsym section. Each element has the following type. */ -typedef unsigned long Elf32_Conflict; - -/* A section of type SHT_MIPS_GPTAB contains information about how - much GP space would be required for different -G arguments. This - information is only used so that the linker can provide informative - suggestions as to the best -G value to use. The sh_info field is - the index of the section for which this information applies. The - contents of the section are an array of the following union. The - first element uses the gt_header field. The remaining elements use - the gt_entry field. */ -typedef union -{ - struct - { - /* -G value actually used for this object file. */ - unsigned long gt_current_g_value; - /* Unused. */ - unsigned long gt_unused; - } gt_header; - struct - { - /* If this -G argument has been used... */ - unsigned long gt_g_value; - /* ...this many GP section bytes would be required. */ - unsigned long gt_bytes; - } gt_entry; -} Elf32_gptab; - -/* The external version of Elf32_gptab. */ - -typedef union -{ - struct - { - unsigned char gt_current_g_value[4]; - unsigned char gt_unused[4]; - } gt_header; - struct - { - unsigned char gt_g_value[4]; - unsigned char gt_bytes[4]; - } gt_entry; -} Elf32_External_gptab; - -/* A section of type SHT_MIPS_REGINFO contains the following - structure. */ -typedef struct -{ - /* Mask of general purpose registers used. */ - unsigned long ri_gprmask; - /* Mask of co-processor registers used. */ - unsigned long ri_cprmask[4]; - /* GP register value for this object file. */ - long ri_gp_value; -} Elf32_RegInfo; - -/* The external version of the Elf_RegInfo structure. */ -typedef struct -{ - unsigned char ri_gprmask[4]; - unsigned char ri_cprmask[4][4]; - unsigned char ri_gp_value[4]; -} Elf32_External_RegInfo; - -/* MIPS ELF .reginfo swapping routines. */ -extern void bfd_mips_elf32_swap_reginfo_in - PARAMS ((bfd *, const Elf32_External_RegInfo *, Elf32_RegInfo *)); -extern void bfd_mips_elf32_swap_reginfo_out - PARAMS ((bfd *, const Elf32_RegInfo *, Elf32_External_RegInfo *)); - -/* Processor specific section flags. */ - -/* This section must be in the global data area. */ -#define SHF_MIPS_GPREL 0x10000000 - -/* Processor specific program header types. */ - -/* Register usage information. Identifies one .reginfo section. */ -#define PT_MIPS_REGINFO 0x70000000 - -/* Runtime procedure table. */ -#define PT_MIPS_RTPROC 0x70000001 - -/* Processor specific dynamic array tags. */ - -/* 32 bit version number for runtime linker interface. */ -#define DT_MIPS_RLD_VERSION 0x70000001 - -/* Time stamp. */ -#define DT_MIPS_TIME_STAMP 0x70000002 - -/* Checksum of external strings and common sizes. */ -#define DT_MIPS_ICHECKSUM 0x70000003 - -/* Index of version string in string table. */ -#define DT_MIPS_IVERSION 0x70000004 - -/* 32 bits of flags. */ -#define DT_MIPS_FLAGS 0x70000005 - -/* Base address of the segment. */ -#define DT_MIPS_BASE_ADDRESS 0x70000006 - -/* Address of .conflict section. */ -#define DT_MIPS_CONFLICT 0x70000008 - -/* Address of .liblist section. */ -#define DT_MIPS_LIBLIST 0x70000009 - -/* Number of local global offset table entries. */ -#define DT_MIPS_LOCAL_GOTNO 0x7000000a - -/* Number of entries in the .conflict section. */ -#define DT_MIPS_CONFLICTNO 0x7000000b - -/* Number of entries in the .liblist section. */ -#define DT_MIPS_LIBLISTNO 0x70000010 - -/* Number of entries in the .dynsym section. */ -#define DT_MIPS_SYMTABNO 0x70000011 - -/* Index of first external dynamic symbol not referenced locally. */ -#define DT_MIPS_UNREFEXTNO 0x70000012 - -/* Index of first dynamic symbol in global offset table. */ -#define DT_MIPS_GOTSYM 0x70000013 - -/* Number of page table entries in global offset table. */ -#define DT_MIPS_HIPAGENO 0x70000014 - -/* Address of run time loader map, used for debugging. */ -#define DT_MIPS_RLD_MAP 0x70000016 - -/* Flags which may appear in a DT_MIPS_FLAGS entry. */ - -/* No flags. */ -#define RHF_NONE 0x00000000 - -/* Uses shortcut pointers. */ -#define RHF_QUICKSTART 0x00000001 - -/* Hash size is not a power of two. */ -#define RHF_NOTPOT 0x00000002 - -/* Ignore LD_LIBRARY_PATH. */ -#define RHS_NO_LIBRARY_REPLACEMENT \ - 0x00000004 - -/* Special values for the st_other field in the symbol table. These - are used in an Irix 5 dynamic symbol table. */ - -#define STO_DEFAULT 0x00 -#define STO_INTERNAL 0x01 -#define STO_HIDDEN 0x02 -#define STO_PROTECTED 0x03 - -#endif /* _ELF_MIPS_H */ diff --git a/contrib/gdb/include/elf/ppc.h b/contrib/gdb/include/elf/ppc.h deleted file mode 100644 index 1da118d..0000000 --- a/contrib/gdb/include/elf/ppc.h +++ /dev/null @@ -1,54 +0,0 @@ -/* PPC ELF support for BFD. - Copyright (C) 1995 Free Software Foundation, Inc. - - By Michael Meissner, Cygnus Support, , from information - in the System V Application Binary Interface, PowerPC Processor Supplement - and the PowerPC Embedded Application Binary Interface (eabi). - -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. */ - -/* This file holds definitions specific to the PPC ELF ABI. Note - that most of this is not actually implemented by BFD. */ - -#ifndef _ELF_PPC_H -#define _ELF_PPC_H - -/* Processor specific flags for the ELF header e_flags field. */ - -#define EF_PPC_EMB 0x80000000 /* PowerPC embedded flag */ - - /* CYGNUS local bits below */ -#define EF_PPC_RELOCATABLE 0x00010000 /* PowerPC -mrelocatable flag */ -#define EF_PPC_RELOCATABLE_LIB 0x00008000 /* PowerPC -mrelocatable-lib flag */ - -/* Processor specific section headers, sh_type field */ - -#define SHT_ORDERED SHT_HIPROC /* Link editor is to sort the \ - entries in this section \ - based on the address \ - specified in the associated \ - symbol table entry. */ - -/* Processor specific section flags, sh_flags field */ - -#define SHF_EXCLUDE 0x80000000 /* Link editor is to exclude \ - this section from executable \ - and shared objects that it \ - builds when those objects \ - are not to be furhter \ - relocated. */ -#endif /* _ELF_PPC_H */ diff --git a/contrib/gdb/include/elf/sparc.h b/contrib/gdb/include/elf/sparc.h deleted file mode 100644 index 84408e3..0000000 --- a/contrib/gdb/include/elf/sparc.h +++ /dev/null @@ -1,73 +0,0 @@ -/* SPARC ELF support for BFD. - Copyright (C) 1996 Free Software Foundation, Inc. - - By Doug Evans, Cygnus Support, . - -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_SPARC_H -#define _ELF_SPARC_H - -/* Processor specific flags for the ELF header e_flags field. */ - -/* These are defined by Sun. */ - -#define EF_SPARC_32PLUS_MASK 0xffff00 /* bits indicating V8+ type */ -#define EF_SPARC_32PLUS 0x000100 /* generic V8+ features */ -#define EF_SPARC_SUN_US1 0x000200 /* Sun UltraSPARC1 extensions */ - -/* Relocation types. */ - -enum elf_sparc_reloc_type { - R_SPARC_NONE = 0, - R_SPARC_8, R_SPARC_16, R_SPARC_32, - R_SPARC_DISP8, R_SPARC_DISP16, R_SPARC_DISP32, - R_SPARC_WDISP30, R_SPARC_WDISP22, - R_SPARC_HI22, R_SPARC_22, - R_SPARC_13, R_SPARC_LO10, - R_SPARC_GOT10, R_SPARC_GOT13, R_SPARC_GOT22, - R_SPARC_PC10, R_SPARC_PC22, - R_SPARC_WPLT30, - R_SPARC_COPY, - R_SPARC_GLOB_DAT, R_SPARC_JMP_SLOT, - R_SPARC_RELATIVE, - R_SPARC_UA32, - - /* ??? These 6 relocs are new but not currently used. For binary - compatility in the sparc64-elf toolchain, we leave them out. - A non-binary upward compatible change is expected for sparc64-elf. */ -#ifndef SPARC64_OLD_RELOCS - /* ??? New relocs on the UltraSPARC. Not sure what they're for yet. */ - R_SPARC_PLT32, R_SPARC_HIPLT22, R_SPARC_LOPLT10, - R_SPARC_PCPLT32, R_SPARC_PCPLT22, R_SPARC_PCPLT10, -#endif - - /* v9 relocs */ - R_SPARC_10, R_SPARC_11, R_SPARC_64, - R_SPARC_OLO10, R_SPARC_HH22, R_SPARC_HM10, R_SPARC_LM22, - R_SPARC_PC_HH22, R_SPARC_PC_HM10, R_SPARC_PC_LM22, - R_SPARC_WDISP16, R_SPARC_WDISP19, - R_SPARC_GLOB_JMP, - R_SPARC_7, -#ifndef SPARC64_OLD_RELOCS - R_SPARC_5, R_SPARC_6, -#endif - - R_SPARC_max -}; - -#endif /* _ELF_SPARC_H */ diff --git a/contrib/gdb/include/floatformat.h b/contrib/gdb/include/floatformat.h deleted file mode 100644 index 01e3dcb..0000000 --- a/contrib/gdb/include/floatformat.h +++ /dev/null @@ -1,88 +0,0 @@ -/* IEEE floating point support declarations, for GDB, the GNU Debugger. - Copyright (C) 1991 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. */ - -#if !defined (FLOATFORMAT_H) -#define FLOATFORMAT_H 1 - -#include "ansidecl.h" - -/* A floatformat consists of a sign bit, an exponent and a mantissa. Once the - bytes are concatenated according to the byteorder flag, then each of those - fields is contiguous. We number the bits with 0 being the most significant - (i.e. BITS_BIG_ENDIAN type numbering), and specify which bits each field - contains with the *_start and *_len fields. */ - -enum floatformat_byteorders { floatformat_little, floatformat_big }; - -enum floatformat_intbit { floatformat_intbit_yes, floatformat_intbit_no }; - -struct floatformat -{ - enum floatformat_byteorders byteorder; - unsigned int totalsize; /* Total size of number in bits */ - - /* Sign bit is always one bit long. 1 means negative, 0 means positive. */ - unsigned int sign_start; - - unsigned int exp_start; - unsigned int exp_len; - /* Amount added to "true" exponent. 0x3fff for many IEEE extendeds. */ - unsigned int exp_bias; - /* Exponent value which indicates NaN. This is the actual value stored in - the float, not adjusted by the exp_bias. This usually consists of all - one bits. */ - unsigned int exp_nan; - - unsigned int man_start; - unsigned int man_len; - - /* Is the integer bit explicit or implicit? */ - enum floatformat_intbit intbit; -}; - -/* floatformats for IEEE single and double, big and little endian. */ - -extern const struct floatformat floatformat_ieee_single_big; -extern const struct floatformat floatformat_ieee_single_little; -extern const struct floatformat floatformat_ieee_double_big; -extern const struct floatformat floatformat_ieee_double_little; - -/* floatformats for various extendeds. */ - -extern const struct floatformat floatformat_i387_ext; -extern const struct floatformat floatformat_m68881_ext; -extern const struct floatformat floatformat_i960_ext; -extern const struct floatformat floatformat_m88110_ext; -extern const struct floatformat floatformat_arm_ext; - -/* Convert from FMT to a double. - FROM is the address of the extended float. - Store the double in *TO. */ - -extern void -floatformat_to_double PARAMS ((const struct floatformat *, char *, double *)); - -/* The converse: convert the double *FROM to FMT - and store where TO points. */ - -extern void -floatformat_from_double PARAMS ((const struct floatformat *, - double *, char *)); - -#endif /* defined (FLOATFORMAT_H) */ diff --git a/contrib/gdb/include/fopen-bin.h b/contrib/gdb/include/fopen-bin.h deleted file mode 100644 index b868f63..0000000 --- a/contrib/gdb/include/fopen-bin.h +++ /dev/null @@ -1,27 +0,0 @@ -/* Macros for the 'type' part of an fopen, freopen or fdopen. - - [Update] - - This version is for "binary" systems, where text and binary files are - different. An example is Mess-Dose. Many Unix systems could also - cope with a "b" in the string, indicating binary files, but some reject this - (and thereby don't conform to ANSI C, but what else is new?). - - This file is designed for inclusion by host-dependent .h files. No - user application should include it directly, since that would make - the application unable to be configured for both "same" and "binary" - variant systems. */ - -#define FOPEN_RB "rb" -#define FOPEN_WB "wb" -#define FOPEN_AB "ab" -#define FOPEN_RUB "r+b" -#define FOPEN_WUB "w+b" -#define FOPEN_AUB "a+b" - -#define FOPEN_RT "r" -#define FOPEN_WT "w" -#define FOPEN_AT "a" -#define FOPEN_RUT "r+" -#define FOPEN_WUT "w+" -#define FOPEN_AUT "a+" diff --git a/contrib/gdb/include/fopen-same.h b/contrib/gdb/include/fopen-same.h deleted file mode 100644 index 0f37529..0000000 --- a/contrib/gdb/include/fopen-same.h +++ /dev/null @@ -1,27 +0,0 @@ -/* Macros for the 'type' part of an fopen, freopen or fdopen. - - [Update] - - This version is for "same" systems, where text and binary files are - the same. An example is Unix. Many Unix systems could also add a - "b" to the string, indicating binary files, but some reject this - (and thereby don't conform to ANSI C, but what else is new?). - - This file is designed for inclusion by host-dependent .h files. No - user application should include it directly, since that would make - the application unable to be configured for both "same" and "binary" - variant systems. */ - -#define FOPEN_RB "r" -#define FOPEN_WB "w" -#define FOPEN_AB "a" -#define FOPEN_RUB "r+" -#define FOPEN_WUB "w+" -#define FOPEN_AUB "a+" - -#define FOPEN_RT "r" -#define FOPEN_WT "w" -#define FOPEN_AT "a" -#define FOPEN_RUT "r+" -#define FOPEN_WUT "w+" -#define FOPEN_AUT "a+" diff --git a/contrib/gdb/include/gdbm.h b/contrib/gdb/include/gdbm.h deleted file mode 100644 index 3ebc26d..0000000 --- a/contrib/gdb/include/gdbm.h +++ /dev/null @@ -1,91 +0,0 @@ -/* GNU DBM - DataBase Manager include file - Copyright 1989, 1991 Free Software Foundation, Inc. - Written by Philip A. Nelson. - -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. */ - -/* You may contact the author by: - e-mail: phil@wwu.edu - us-mail: Philip A. Nelson - Computer Science Department - Western Washington University - Bellingham, WA 98226 - phone: (206) 676-3035 - -*************************************************************************/ - -/* Parameters to gdbm_open for READERS, WRITERS, and WRITERS who - can create the database. */ -#define GDBM_READER 0 -#define GDBM_WRITER 1 -#define GDBM_WRCREAT 2 -#define GDBM_NEWDB 3 - -/* Parameters to gdbm_store for simple insertion or replacement. */ -#define GDBM_INSERT 0 -#define GDBM_REPLACE 1 - - -/* The data and key structure. This structure is defined for compatibility. */ -typedef struct { - char *dptr; - int dsize; - } datum; - - -/* The file information header. This is good enough for most applications. */ -typedef struct {int dummy[10];} *GDBM_FILE; - - -/* These are the routines! */ - -extern GDBM_FILE gdbm_open (); - -extern void gdbm_close (); - -extern datum gdbm_fetch (); - -extern int gdbm_store (); - -extern int gdbm_delete (); - -extern datum gdbm_firstkey (); - -extern datum gdbm_nextkey (); - -extern int gdbm_reorganize (); - - -/* gdbm sends back the following error codes in the variable gdbm_errno. */ -typedef enum { NO_ERROR, - MALLOC_ERROR, - BLOCK_SIZE_ERROR, - FILE_OPEN_ERROR, - FILE_WRITE_ERROR, - FILE_SEEK_ERROR, - FILE_READ_ERROR, - BAD_MAGIC_NUMBER, - EMPTY_DATABASE, - CANT_BE_READER, - CANT_BE_WRITER, - READER_CANT_RECOVER, - READER_CANT_DELETE, - READER_CANT_STORE, - READER_CANT_REORGANIZE, - UNKNOWN_UPDATE, - ITEM_NOT_FOUND, - REORGANIZE_FAILED, - CANNOT_REPLACE} - gdbm_error; diff --git a/contrib/gdb/include/getopt.h b/contrib/gdb/include/getopt.h deleted file mode 100644 index abf9153..0000000 --- a/contrib/gdb/include/getopt.h +++ /dev/null @@ -1,129 +0,0 @@ -/* Declarations for getopt. - Copyright (C) 1989, 1990, 1991, 1992, 1993 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU Library 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 Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this program; if not, write to the Free Software - Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#ifndef _GETOPT_H -#define _GETOPT_H 1 - -#ifdef __cplusplus -extern "C" { -#endif - -/* For communication from `getopt' to the caller. - When `getopt' finds an option that takes an argument, - the argument value is returned here. - Also, when `ordering' is RETURN_IN_ORDER, - each non-option ARGV-element is returned here. */ - -extern char *optarg; - -/* Index in ARGV of the next element to be scanned. - This is used for communication to and from the caller - and for communication between successive calls to `getopt'. - - On entry to `getopt', zero means this is the first call; initialize. - - When `getopt' returns EOF, this is the index of the first of the - non-option elements that the caller should itself scan. - - Otherwise, `optind' communicates from one call to the next - how much of ARGV has been scanned so far. */ - -extern int optind; - -/* Callers store zero here to inhibit the error message `getopt' prints - for unrecognized options. */ - -extern int opterr; - -/* Set to an option character which was unrecognized. */ - -extern int optopt; - -/* Describe the long-named options requested by the application. - The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector - of `struct option' terminated by an element containing a name which is - zero. - - The field `has_arg' is: - no_argument (or 0) if the option does not take an argument, - required_argument (or 1) if the option requires an argument, - optional_argument (or 2) if the option takes an optional argument. - - If the field `flag' is not NULL, it points to a variable that is set - to the value given in the field `val' when the option is found, but - left unchanged if the option is not found. - - To have a long-named option do something other than set an `int' to - a compiled-in constant, such as set a value from `optarg', set the - option's `flag' field to zero and its `val' field to a nonzero - value (the equivalent single-letter option character, if there is - one). For long options that have a zero `flag' field, `getopt' - returns the contents of the `val' field. */ - -struct option -{ -#if __STDC__ - const char *name; -#else - char *name; -#endif - /* has_arg can't be an enum because some compilers complain about - type mismatches in all the code that assumes it is an int. */ - int has_arg; - int *flag; - int val; -}; - -/* Names for the values of the `has_arg' field of `struct option'. */ - -#define no_argument 0 -#define required_argument 1 -#define optional_argument 2 - -#if __STDC__ -#if defined(__GNU_LIBRARY__) -/* Many other libraries have conflicting prototypes for getopt, with - differences in the consts, in stdlib.h. To avoid compilation - errors, only prototype getopt for the GNU C library. */ -extern int getopt (int argc, char *const *argv, const char *shortopts); -#else /* not __GNU_LIBRARY__ */ -extern int getopt (); -#endif /* not __GNU_LIBRARY__ */ -extern int getopt_long (int argc, char *const *argv, const char *shortopts, - const struct option *longopts, int *longind); -extern int getopt_long_only (int argc, char *const *argv, - const char *shortopts, - const struct option *longopts, int *longind); - -/* Internal only. Users should not call this directly. */ -extern int _getopt_internal (int argc, char *const *argv, - const char *shortopts, - const struct option *longopts, int *longind, - int long_only); -#else /* not __STDC__ */ -extern int getopt (); -extern int getopt_long (); -extern int getopt_long_only (); - -extern int _getopt_internal (); -#endif /* not __STDC__ */ - -#ifdef __cplusplus -} -#endif - -#endif /* _GETOPT_H */ diff --git a/contrib/gdb/include/hp-symtab.h b/contrib/gdb/include/hp-symtab.h deleted file mode 100644 index 051c4c6..0000000 --- a/contrib/gdb/include/hp-symtab.h +++ /dev/null @@ -1,983 +0,0 @@ -/* Definitions and structures for reading debug symbols from the - native HP C compiler. - - Written by the Center for Software Science at the University of Utah - and by Cygnus Support. - - Copyright 1994 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. */ - -#ifndef HP_SYMTAB_INCLUDED -#define HP_SYMTAB_INCLUDED - -/* General information: - - This header file defines and describes only the basic data structures - necessary to read debug symbols produced by the HP C compiler using the - SOM object file format. Definitions and structures used by other compilers - for other languages or object file formats may be missing. - (For a full description of the debug format, ftp hpux-symtab.h from - jaguar.cs.utah.edu:/dist). - - - Debug symbols are contained entirely within an unloadable space called - $DEBUG$. $DEBUG$ contains several subspaces which group related - debug symbols. - - $GNTT$ contains information for global variables, types and contants. - - $LNTT$ contains information for procedures (including nesting), scoping - information, local variables, types, and constants. - - $SLT$ contains source line information so that code addresses may be - mapped to source lines. - - $VT$ contains various strings and constants for named objects (variables, - typedefs, functions, etc). Strings are stored as null-terminated character - lists. Constants always begin on word boundaries. The first byte of - the VT must be zero (a null string). - - $XT$ is not currently used by GDB. - - Many structures within the subspaces point to other structures within - the same subspace, or to structures within a different subspace. These - pointers are represented as a structure index from the beginning of - the appropriate subspace. */ - -/* Used to describe where a constant is stored. */ -enum location_type -{ - LOCATION_IMMEDIATE, - LOCATION_PTR, - LOCATION_VT, -}; - -/* Languages supported by this debug format. Within the data structures - this type is limited to 4 bits for a maximum of 16 languages. */ -enum hp_language -{ - HP_LANGUAGE_UNKNOWN, - HP_LANGUAGE_C, - HP_LANGUAGE_F77, - HP_LANGUAGE_PASCAL, - HP_LANGUAGE_COBOL, - HP_LANGUAGE_BASIC, - HP_LANGUAGE_ADA, - HP_LANGUAGE_CPLUSPLUS, -}; - - -/* Basic data types available in this debug format. Within the data - structures this type is limited to 5 bits for a maximum of 32 basic - data types. */ -enum hp_type -{ - HP_TYPE_UNDEFINED, - HP_TYPE_BOOLEAN, - HP_TYPE_CHAR, - HP_TYPE_INT, - HP_TYPE_UNSIGNED_INT, - HP_TYPE_REAL, - HP_TYPE_COMPLEX, - HP_TYPE_STRING200, - HP_TYPE_LONGSTRING200, - HP_TYPE_TEXT, - HP_TYPE_FLABEL, - HP_TYPE_FTN_STRING_SPEC, - HP_TYPE_MOD_STRING_SPEC, - HP_TYPE_PACKED_DECIMAL, - HP_TYPE_REAL_3000, - HP_TYPE_MOD_STRING_3000, - HP_TYPE_ANYPOINTER, - HP_TYPE_GLOBAL_ANYPOINTER, - HP_TYPE_LOCAL_ANYPOINTER, - HP_TYPE_COMPLEXS3000, - HP_TYPE_FTN_STRING_S300_COMPAT, - HP_TYPE_FTN_STRING_VAX_COMPAT, - HP_TYPE_BOOLEAN_S300_COMPAT, - HP_TYPE_BOOLEAN_VAX_COMPAT, - HP_TYPE_WIDE_CHAR, - HP_TYPE_LONG, - HP_TYPE_UNSIGNED_LONG, - HP_TYPE_DOUBLE, - HP_TYPE_TEMPLATE_ARG, -}; - -/* An immediate name and type table entry. - - extension and immediate will always be one. - global will always be zero. - hp_type is the basic type this entry describes. - bitlength is the length in bits for the basic type. */ -struct dnttp_immediate -{ - unsigned int extension: 1; - unsigned int immediate: 1; - unsigned int global: 1; - unsigned int type: 5; - unsigned int bitlength: 24; -}; - -/* A nonimmediate name and type table entry. - - extension will always be one. - immediate will always be zero. - if global is zero, this entry points into the LNTT - if global is one, this entry points into the GNTT - index is the index within the GNTT or LNTT for this entry. */ -struct dnttp_nonimmediate -{ - unsigned int extension: 1; - unsigned int immediate: 1; - unsigned int global: 1; - unsigned int index: 29; -}; - -/* A pointer to an entry in the GNTT and LNTT tables. It has two - forms depending on the type being described. - - The immediate form is used for simple entries and is one - word. - - The nonimmediate form is used for complex entries and contains - an index into the LNTT or GNTT which describes the entire type. - - If a dnttpointer is -1, then it is a NIL entry. */ - -#define DNTTNIL (-1) -typedef union dnttpointer -{ - struct dnttp_immediate dntti; - struct dnttp_nonimmediate dnttp; - int word; -} dnttpointer; - -/* An index into the source line table. As with dnttpointers, a sltpointer - of -1 indicates a NIL entry. */ -#define SLTNIL (-1) -typedef int sltpointer; - -/* Unsigned byte offset into the VT. */ -typedef unsigned int vtpointer; - -/* A DNTT entry (used within the GNTT and LNTT). - - DNTT entries are variable sized objects, but are always a multiple - of 3 words (we call each group of 3 words a "block"). - - The first bit in each block is an extension bit. This bit is zero - for the first block of a DNTT entry. If the entry requires more - than one block, then this bit is set to one in all blocks after - the first one. */ - -/* Each DNTT entry describes a particular debug symbol (beginning of - a source file, a function, variables, structures, etc. - - The type of the DNTT entry is stored in the "kind" field within the - DNTT entry itself. */ - -enum dntt_entry_type -{ - DNTT_TYPE_NIL = -1, - DNTT_TYPE_SRCFILE, - DNTT_TYPE_MODULE, - DNTT_TYPE_FUNCTION, - DNTT_TYPE_ENTRY, - DNTT_TYPE_BEGIN, - DNTT_TYPE_END, - DNTT_TYPE_IMPORT, - DNTT_TYPE_LABEL, - DNTT_TYPE_FPARAM, - DNTT_TYPE_SVAR, - DNTT_TYPE_DVAR, - DNTT_TYPE_HOLE1, - DNTT_TYPE_CONST, - DNTT_TYPE_TYPEDEF, - DNTT_TYPE_TAGDEF, - DNTT_TYPE_POINTER, - DNTT_TYPE_ENUM, - DNTT_TYPE_MEMENUM, - DNTT_TYPE_SET, - DNTT_TYPE_SUBRANGE, - DNTT_TYPE_ARRAY, - DNTT_TYPE_STRUCT, - DNTT_TYPE_UNION, - DNTT_TYPE_FIELD, - DNTT_TYPE_VARIANT, - DNTT_TYPE_FILE, - DNTT_TYPE_FUNCTYPE, - DNTT_TYPE_WITH, - DNTT_TYPE_COMMON, - DNTT_TYPE_COBSTRUCT, - DNTT_TYPE_XREF, - DNTT_TYPE_SA, - DNTT_TYPE_MACRO, - DNTT_TYPE_BLOCKDATA, - DNTT_TYPE_CLASS_SCOPE, - DNTT_TYPE_REFERENCE, - DNTT_TYPE_PTRMEM, - DNTT_TYPE_PTRMEMFUNC, - DNTT_TYPE_CLASS, - DNTT_TYPE_GENFIELD, - DNTT_TYPE_VFUNC, - DNTT_TYPE_MEMACCESS, - DNTT_TYPE_INHERITANCE, - DNTT_TYPE_FRIEND_CLASS, - DNTT_TYPE_FRIEND_FUNC, - DNTT_TYPE_MODIFIER, - DNTT_TYPE_OBJECT_ID, - DNTT_TYPE_MEMFUNC, - DNTT_TYPE_TEMPLATE, - DNTT_TYPE_TEMPLATE_ARG, - DNTT_TYPE_FUNC_TEMPLATE, - DNTT_TYPE_LINK, - DNTT_TYPE_MAX, -}; - -/* DNTT_TYPE_SRCFILE: - - One DNTT_TYPE_SRCFILE symbol is output for the start of each source - file and at the begin and end of an included file. A DNTT_TYPE_SRCFILE - entry is also output before each DNTT_TYPE_FUNC symbol so that debuggers - can determine what file a function was defined in. - - LANGUAGE describes the source file's language. - - NAME points to an VT entry providing the source file's name. - - Note the name used for DNTT_TYPE_SRCFILE entries are exactly as seen - by the compiler (ie they may be relative or absolute). C include files - via <> inclusion must use absolute paths. - - ADDRESS points to an SLT entry from which line number and code locations - may be determined. */ - -struct dntt_type_srcfile -{ - unsigned int extension: 1; - unsigned int kind: 10; - unsigned int language: 4; - unsigned int unused: 17; - vtpointer name; - sltpointer address; -}; - -/* DNTT_TYPE_MODULE: - - A DNTT_TYPE_MODULE symbol is emitted for the start of a pascal - module or C source file. - - Each DNTT_TYPE_MODULE must have an associated DNTT_TYPE_END symbol. - - NAME points to a VT entry providing the module's name. Note C - source files are considered nameless modules. - - ALIAS point to a VT entry providing a secondary name. - - ADDRESS points to an SLT entry from which line number and code locations - may be determined. */ - -struct dntt_type_module -{ - unsigned int extension: 1; - unsigned int kind: 10; - unsigned int unused: 21; - vtpointer name; - vtpointer alias; - dnttpointer unused2; - sltpointer address; -}; - -/* DNTT_TYPE_FUNCTION: - - A DNTT_TYPE_FUNCTION symbol is emitted for each function definition; - a DNTT_TYPE_ENTRY symbols is used for secondary entry points. Both - symbols used the dntt_type_function structure. - - Each DNTT_TYPE_FUNCTION must have a matching DNTT_TYPE_END. - - GLOBAL is nonzero if the function has global scope. - - LANGUAGE describes the function's source language. - - OPT_LEVEL describes the optimization level the function was compiled - with. - - VARARGS is nonzero if the function uses varargs. - - NAME points to a VT entry providing the function's name. - - ALIAS points to a VT entry providing a secondary name for the function. - - FIRSTPARAM points to a LNTT entry which describes the parameter list. - - ADDRESS points to an SLT entry from which line number and code locations - may be determined. - - ENTRYADDR is the memory address corresponding the the function's entry point - - RETVAL points to a LNTT entry describing the function's return value. - - LOWADDR is the lowest memory address associated with this function. - - HIADDR is the highest memory address associated with this function. */ - -struct dntt_type_function -{ - unsigned int extension: 1; - unsigned int kind: 10; - unsigned int global: 1; - unsigned int language: 4; - unsigned int nest_level: 5; - unsigned int opt_level: 2; - unsigned int varargs: 1; - unsigned int lang_info: 4; - unsigned int inlined: 1; - unsigned int localalloc: 1; - unsigned int expansion: 1; - unsigned int unused: 1; - vtpointer name; - vtpointer alias; - dnttpointer firstparam; - sltpointer address; - CORE_ADDR entryaddr; - dnttpointer retval; - CORE_ADDR lowaddr; - CORE_ADDR hiaddr; -}; - -/* DNTT_TYPE_BEGIN: - - A DNTT_TYPE_BEGIN symbol is emitted to begin a new nested scope. - Every DNTT_TYPE_BEGIN symbol must have a matching DNTT_TYPE_END symbol. - - CLASSFLAG is nonzero if this is the beginning of a c++ class definition. - - ADDRESS points to an SLT entry from which line number and code locations - may be determined. */ - -struct dntt_type_begin -{ - unsigned int extension: 1; - unsigned int kind: 10; - unsigned int classflag: 1; - unsigned int unused: 20; - sltpointer address; -}; - -/* DNTT_TYPE_END: - - A DNTT_TYPE_END symbol is emitted when closing a scope started by - a DNTT_TYPE_MODULE, DNTT_TYPE_FUNCTION, and DNTT_TYPE_BEGIN symbols. - - ENDKIND describes what type of scope the DNTT_TYPE_END is closing - (DNTT_TYPE_MODULE, DNTT_TYPE_BEGIN, etc). - - CLASSFLAG is nonzero if this is the end of a c++ class definition. - - ADDRESS points to an SLT entry from which line number and code locations - may be determined. - - BEGINSCOPE points to the LNTT entry which opened the scope. */ - -struct dntt_type_end -{ - unsigned int extension: 1; - unsigned int kind: 10; - unsigned int endkind: 10; - unsigned int classflag: 1; - unsigned int unused: 10; - sltpointer address; - dnttpointer beginscope; -}; - -/* DNTT_TYPE_IMPORT is unused by GDB. */ -/* DNTT_TYPE_LABEL is unused by GDB. */ - -/* DNTT_TYPE_FPARAM: - - A DNTT_TYPE_FPARAM symbol is emitted for a function argument. When - chained together the symbols represent an argument list for a function. - - REGPARAM is nonzero if this parameter was passed in a register. - - INDIRECT is nonzero if this parameter is a pointer to the parameter - (pass by reference or pass by value for large items). - - LONGADDR is nonzero if the parameter is a 64bit pointer. - - NAME is a pointer into the VT for the parameter's name. - - LOCATION describes where the parameter is stored. Depending on the - parameter type LOCATION could be a register number, or an offset - from the stack pointer. - - TYPE points to a NTT entry describing the type of this parameter. - - NEXTPARAM points to the LNTT entry describing the next parameter. */ - -struct dntt_type_fparam -{ - unsigned int extension: 1; - unsigned int kind: 10; - unsigned int regparam: 1; - unsigned int indirect: 1; - unsigned int longaddr: 1; - unsigned int copyparam: 1; - unsigned int dflt: 1; - unsigned int unused: 16; - vtpointer name; - int location; - dnttpointer type; - dnttpointer nextparam; - int misc; -}; - -/* DNTT_TYPE_SVAR: - - A DNTT_TYPE_SVAR is emitted to describe a variable in static storage. - - GLOBAL is nonzero if the variable has global scope. - - INDIRECT is nonzero if the variable is a pointer to an object. - - LONGADDR is nonzero if the variable is in long pointer space. - - STATICMEM is nonzero if the variable is a member of a class. - - A_UNION is nonzero if the variable is an anonymous union member. - - NAME is a pointer into the VT for the variable's name. - - LOCATION provides the memory address for the variable. - - TYPE is a pointer into either the GNTT or LNTT which describes - the type of this variable. */ - -struct dntt_type_svar -{ - unsigned int extension: 1; - unsigned int kind: 10; - unsigned int global: 1; - unsigned int indirect: 1; - unsigned int longaddr: 1; - unsigned int staticmem: 1; - unsigned int a_union: 1; - unsigned int unused: 16; - vtpointer name; - CORE_ADDR location; - dnttpointer type; - unsigned int offset; - unsigned int displacement; -}; - -/* DNTT_TYPE_DVAR: - - A DNTT_TYPE_DVAR is emitted to describe automatic variables and variables - held in registers. - - GLOBAL is nonzero if the variable has global scope. - - INDIRECT is nonzero if the variable is a pointer to an object. - - REGVAR is nonzero if the variable is in a register. - - A_UNION is nonzero if the variable is an anonymous union member. - - NAME is a pointer into the VT for the variable's name. - - LOCATION provides the memory address or register number for the variable. - - TYPE is a pointer into either the GNTT or LNTT which describes - the type of this variable. */ - -struct dntt_type_dvar -{ - unsigned int extension: 1; - unsigned int kind: 10; - unsigned int global: 1; - unsigned int indirect: 1; - unsigned int regvar: 1; - unsigned int a_union: 1; - unsigned int unused: 17; - vtpointer name; - int location; - dnttpointer type; - unsigned int offset; -}; - -/* DNTT_TYPE_CONST: - - A DNTT_TYPE_CONST symbol is emitted for program constants. - - GLOBAL is nonzero if the constant has global scope. - - INDIRECT is nonzero if the constant is a pointer to an object. - - LOCATION_TYPE describes where to find the constant's value - (in the VT, memory, or embedded in an instruction). - - CLASSMEM is nonzero if the constant is a member of a class. - - NAME is a pointer into the VT for the constant's name. - - LOCATION provides the memory address, register number or pointer - into the VT for the constant's value. - - TYPE is a pointer into either the GNTT or LNTT which describes - the type of this variable. */ - -struct dntt_type_const -{ - unsigned int extension: 1; - unsigned int kind: 10; - unsigned int global: 1; - unsigned int indirect: 1; - unsigned int: 3; - unsigned int classmem: 1; - unsigned int unused: 15; - vtpointer name; - CORE_ADDR location; - dnttpointer type; - unsigned int offset; - unsigned int displacement; -}; - -/* DNTT_TYPE_TYPEDEF and DNTT_TYPE_TAGDEF: - - The same structure is used to describe typedefs and tagdefs. - - DNTT_TYPE_TYPEDEFS are associated with C "typedefs". - - DNTT_TYPE_TAGDEFs are associated with C "struct", "union", and "enum" - tags, which may have the same name as a typedef in the same scope. - - GLOBAL is nonzero if the typedef/tagdef has global scope. - - TYPEINFO is used to determine if full type information is available - for a tag. (usually 1, but can be zero for opaque types in C). - - NAME is a pointer into the VT for the constant's name. - - TYPE points to the underlying type for the typedef/tagdef in the - GNTT or LNTT. */ - -struct dntt_type_type -{ - unsigned int extension: 1; - unsigned int kind: 10; - unsigned int global: 1; - unsigned int typeinfo: 1; - unsigned int unused: 19; - vtpointer name; - dnttpointer type; -}; - -/* DNTT_TYPE_POINTER: - - Used to describe a pointer to an underlying type. - - POINTSTO is a pointer into the GNTT or LNTT for the type which this - pointer points to. - - BITLENGTH is the length of the pointer (not the underlying type). */ - -struct dntt_type_pointer -{ - unsigned int extension: 1; - unsigned int kind: 10; - unsigned int unused: 21; - dnttpointer pointsto; - unsigned int bitlength; -}; - - -/* DNTT_TYPE_ENUM: - - Used to describe enumerated types. - - FIRSTMEM is a pointer to a DNTT_TYPE_MEMENUM in the GNTT/LNTT which - describes the first member (and contains a pointer to the chain of - members). - - BITLENGTH is the number of bits used to hold the values of the enum's - members. */ - -struct dntt_type_enum -{ - unsigned int extension: 1; - unsigned int kind: 10; - unsigned int unused: 21; - dnttpointer firstmem; - unsigned int bitlength; -}; - -/* DNTT_TYPE_MEMENUM - - Used to describe members of an enumerated type. - - CLASSMEM is nonzero if this member is part of a class. - - NAME points into the VT for the name of this member. - - VALUE is the value of this enumeration member. - - NEXTMEM points to the next DNTT_TYPE_MEMENUM in the chain. */ - -struct dntt_type_memenum -{ - unsigned int extension: 1; - unsigned int kind: 10; - unsigned int classmem: 1; - unsigned int unused: 20; - vtpointer name; - unsigned int value; - dnttpointer nextmem; -}; - -/* DNTT_TYPE_SET - - DECLARATION describes the bitpacking of the set. - - SUBTYPE points to a DNTT entry describing the type of the members. - - BITLENGTH is the size of the set. */ - -struct dntt_type_set -{ - unsigned int extension: 1; - unsigned int kind: 10; - unsigned int declaration: 2; - unsigned int unused: 19; - dnttpointer subtype; - unsigned int bitlength; -}; - -/* DNTT_TYPE_SUBRANGE - - DYN_LOW describes the lower bound of the subrange: - - 00 for a constant lower bound (found in LOWBOUND). - - 01 for a dynamic lower bound with the lower bound found in the the - memory address pointed to by LOWBOUND. - - 10 for a dynamic lower bound described by an variable found in the - DNTT/LNTT (LOWBOUND would be a pointer into the DNTT/LNTT). - - DYN_HIGH is similar to DYN_LOW, except it describes the upper bound. - - SUBTYPE points to the type of the subrange. - - BITLENGTH is the length in bits needed to describe the subrange's - values. */ - -struct dntt_type_subrange -{ - unsigned int extension: 1; - unsigned int kind: 10; - unsigned int dyn_low: 2; - unsigned int dyn_high: 2; - unsigned int unused: 17; - int lowbound; - int highbound; - dnttpointer subtype; - unsigned int bitlength; -}; - -/* DNTT_TYPE_ARRAY - - DECLARATION describes the bit packing used in the array. - - ARRAYISBYTES is nonzero if the field in arraylength describes the - length in bytes rather than in bits. A value of zero is used to - describe an array with size 2**32. - - ELEMISBYTES is nonzero if the length if each element in the array - is describes in bytes rather than bits. A value of zero is used - to an element with size 2**32. - - ELEMORDER is nonzero if the elements are indexed in increasing order. - - JUSTIFIED if the elements are left justified to index zero. - - ARRAYLENGTH is the length of the array. - - INDEXTYPE is a DNTT pointer to the type used to index the array. - - ELEMTYPE is a DNTT pointer to the type for the array elements. - - ELEMLENGTH is the length of each element in the array (including - any padding). - - Multi-dimensional arrays are represented by ELEMTYPE pointing to - another DNTT_TYPE_ARRAY. */ - -struct dntt_type_array -{ - unsigned int extension: 1; - unsigned int kind: 10; - unsigned int declaration: 2; - unsigned int dyn_low: 2; - unsigned int dyn_high: 2; - unsigned int arrayisbytes: 1; - unsigned int elemisbytes: 1; - unsigned int elemorder: 1; - unsigned int justified: 1; - unsigned int unused: 11; - unsigned int arraylength; - dnttpointer indextype; - dnttpointer elemtype; - unsigned int elemlength; -}; - -/* DNTT_TYPE_STRUCT - - DNTT_TYPE_STRUCT is used to describe a C structure. - - DECLARATION describes the bitpacking used. - - FIRSTFIELD is a DNTT pointer to the first field of the structure - (each field contains a pointer to the next field, walk the list - to access all fields of the structure). - - VARTAGFIELD and VARLIST are used for Pascal variant records. - - BITLENGTH is the size of the structure in bits. */ - -struct dntt_type_struct -{ - unsigned int extension: 1; - unsigned int kind: 10; - unsigned int declaration: 2; - unsigned int unused: 19; - dnttpointer firstfield; - dnttpointer vartagfield; - dnttpointer varlist; - unsigned int bitlength; -}; - -/* DNTT_TYPE_UNION - - DNTT_TYPE_UNION is used to describe a C union. - - FIRSTFIELD is a DNTT pointer to the beginning of the field chain. - - BITLENGTH is the size of the union in bits. */ - -struct dntt_type_union -{ - unsigned int extension: 1; - unsigned int kind: 10; - unsigned int unused: 21; - dnttpointer firstfield; - unsigned int bitlength; -}; - -/* DNTT_TYPE_FIELD - - DNTT_TYPE_FIELD describes one field in a structure or union. - - VISIBILITY is used to describe the visibility of the field - (for c++. public = 0, protected = 1, private = 2). - - A_UNION is nonzero if this field is a member of an anonymous union. - - STATICMEM is nonzero if this field is a static member of a template. - - NAME is a pointer into the VT for the name of the field. - - BITOFFSET gives the offset of this field in bits from the beginning - of the structure or union this field is a member of. - - TYPE is a DNTT pointer to the type describing this field. - - BITLENGTH is the size of the entry in bits. - - NEXTFIELD is a DNTT pointer to the next field in the chain. */ - -struct dntt_type_field -{ - unsigned int extension: 1; - unsigned int kind: 10; - unsigned int visibility: 2; - unsigned int a_union: 1; - unsigned int staticmem: 1; - unsigned int unused: 17; - vtpointer name; - unsigned int bitoffset; - dnttpointer type; - unsigned int bitlength; - dnttpointer nextfield; -}; - -/* DNTT_TYPE_VARIANT is unused by GDB. */ -/* DNTT_TYPE_FILE is unused by GDB. */ - -/* DNTT_TYPE_COMMON is unused by GDB. */ -/* DNTT_TYPE_LINK is unused by GDB. */ -/* DNTT_TYPE_FFUNC_LINK is unused by GDB. */ -/* DNTT_TYPE_TEMPLATE is unused by GDB. */ - -/* DNTT_TYPE_FUNCTYPE - - VARARGS is nonzero if this function uses varargs. - - FIRSTPARAM is a DNTT pointer to the first entry in the parameter - chain. - - RETVAL is a DNTT pointer to the type of the return value. */ - -struct dntt_type_functype -{ - unsigned int extension: 1; - unsigned int kind: 10; - unsigned int varargs: 1; - unsigned int info: 4; - unsigned int unused: 16; - unsigned int bitlength; - dnttpointer firstparam; - dnttpointer retval; -}; - -/* DNTT_TYPE_WITH is unued by GDB. */ -/* DNTT_TYPE_COBSTRUCT is unused by GDB. */ -/* DNTT_TYPE_MODIFIER is unused by GDB. */ -/* DNTT_TYPE_GENFIELD is unused by GDB. */ -/* DNTT_TYPE_MEMACCESS is unused by GDB. */ -/* DNTT_TYPE_VFUNC is unused by GDB. */ -/* DNTT_TYPE_CLASS_SCOPE is unused by GDB. */ -/* DNTT_TYPE_FRIEND_CLASS is unused by GDB. */ -/* DNTT_TYPE_FRIEND_FUNC is unused by GDB. */ -/* DNTT_TYPE_CLASS unused by GDB. */ -/* DNTT_TYPE_TEMPLATE unused by GDB. */ -/* DNTT_TYPE_TEMPL_ARG is unused by GDB. */ -/* DNTT_TYPE_PTRMEM not used by GDB */ -/* DNTT_TYPE_INHERITANCE is unused by GDB. */ -/* DNTT_TYPE_OBJECT_ID is unused by GDB. */ -/* DNTT_TYPE_XREF is unused by GDB. */ -/* DNTT_TYPE_SA is unused by GDB. */ - -/* DNTT_TYPE_GENERIC and DNTT_TYPE_BLOCK are convience structures - so we can examine a DNTT entry in a generic fashion. */ -struct dntt_type_generic -{ - unsigned int word[9]; -}; - -struct dntt_type_block -{ - unsigned int extension: 1; - unsigned int kind: 10; - unsigned int unused: 21; - unsigned int word[2]; -}; - -/* One entry in a DNTT (either the LNTT or GNTT). */ -union dnttentry -{ - struct dntt_type_srcfile dsfile; - struct dntt_type_module dmodule; - struct dntt_type_function dfunc; - struct dntt_type_function dentry; - struct dntt_type_begin dbegin; - struct dntt_type_end dend; - struct dntt_type_fparam dfparam; - struct dntt_type_svar dsvar; - struct dntt_type_dvar ddvar; - struct dntt_type_const dconst; - struct dntt_type_type dtype; - struct dntt_type_type dtag; - struct dntt_type_pointer dptr; - struct dntt_type_enum denum; - struct dntt_type_memenum dmember; - struct dntt_type_set dset; - struct dntt_type_subrange dsubr; - struct dntt_type_array darray; - struct dntt_type_struct dstruct; - struct dntt_type_union dunion; - struct dntt_type_field dfield; - struct dntt_type_functype dfunctype; - struct dntt_type_generic dgeneric; - struct dntt_type_block dblock; -}; - -/* Source line entry types. */ -enum slttype -{ - SLT_NORMAL, - SLT_SRCFILE, - SLT_MODULE, - SLT_FUNCTION, - SLT_ENTRY, - SLT_BEGIN, - SLT_END, - SLT_WITH, - SLT_EXIT, - SLT_ASSIST, - SLT_MARKER, -}; - -/* A normal source line entry. Simply provides a mapping of a source - line number to a code address. - - SLTDESC will always be SLT_NORMAL or SLT_EXIT. */ - -struct slt_normal -{ - unsigned int sltdesc: 4; - unsigned int line: 28; - CORE_ADDR address; -}; - -/* A special source line entry. Provides a mapping of a declaration - to a line number. These entries point back into the DNTT which - references them. */ - -struct slt_special -{ - unsigned int sltdesc: 4; - unsigned int line: 28; - dnttpointer backptr; -}; - -/* Used to describe nesting. - - For nested languages, an slt_assist entry must follow each SLT_FUNC - entry in the SLT. The address field will point forward to the - first slt_normal entry within the function's scope. */ - -struct slt_assist -{ - unsigned int sltdesc: 4; - unsigned int unused: 28; - sltpointer address; -}; - -struct slt_generic -{ - unsigned int word[2]; -}; - -union sltentry -{ - struct slt_normal snorm; - struct slt_special sspec; - struct slt_assist sasst; - struct slt_generic sgeneric; -}; - -#endif /* HP_SYMTAB_INCLUDED */ diff --git a/contrib/gdb/include/ieee.h b/contrib/gdb/include/ieee.h deleted file mode 100644 index 5ade39d..0000000 --- a/contrib/gdb/include/ieee.h +++ /dev/null @@ -1,139 +0,0 @@ -/* IEEE Standard 695-1980 "Universal Format for Object Modules" header file - Contributed by Cygnus Support. */ - -#define N_W_VARIABLES 8 -#define Module_Beginning 0xe0 - -typedef struct ieee_module { - char *processor; - char *module_name; -} ieee_module_begin_type; - -#define Address_Descriptor 0xec -typedef struct ieee_address { -bfd_vma number_of_bits_mau; - bfd_vma number_of_maus_in_address; - - unsigned char byte_order; -#define IEEE_LITTLE 0xcc -#define IEEE_BIG 0xcd -} ieee_address_descriptor_type; - -typedef union ieee_w_variable { - file_ptr offset[N_W_VARIABLES]; - struct { - file_ptr extension_record; - file_ptr environmental_record; - file_ptr section_part; - file_ptr external_part; - file_ptr debug_information_part; - file_ptr data_part; - file_ptr trailer_part; - file_ptr me_record; - } r; -} ieee_w_variable_type; - - - - - -typedef enum ieee_record -{ - ieee_number_start_enum = 0x00, - ieee_number_end_enum=0x7f, - ieee_number_repeat_start_enum = 0x80, - ieee_number_repeat_end_enum = 0x88, - ieee_number_repeat_4_enum = 0x84, - ieee_number_repeat_3_enum = 0x83, - ieee_number_repeat_2_enum = 0x82, - ieee_number_repeat_1_enum = 0x81, - ieee_module_beginning_enum = 0xe0, - ieee_module_end_enum = 0xe1, - ieee_extension_length_1_enum = 0xde, - ieee_extension_length_2_enum = 0xdf, - ieee_section_type_enum = 0xe6, - ieee_section_alignment_enum = 0xe7, - ieee_external_symbol_enum = 0xe8, - ieee_comma = 0x90, - ieee_external_reference_enum = 0xe9, - ieee_set_current_section_enum = 0xe5, - ieee_address_descriptor_enum = 0xec, - ieee_load_constant_bytes_enum = 0xed, - ieee_load_with_relocation_enum = 0xe4, - - ieee_variable_A_enum = 0xc1, - ieee_variable_B_enum = 0xc2, - ieee_variable_C_enum = 0xc3, - ieee_variable_D_enum = 0xc4, - ieee_variable_E_enum = 0xc5, - ieee_variable_F_enum = 0xc6, - ieee_variable_G_enum = 0xc7, - ieee_variable_H_enum = 0xc8, - ieee_variable_I_enum = 0xc9, - ieee_variable_J_enum = 0xca, - ieee_variable_K_enum = 0xcb, - ieee_variable_L_enum = 0xcc, - ieee_variable_M_enum = 0xcd, - ieee_variable_N_enum = 0xce, - ieee_variable_O_enum = 0xcf, - ieee_variable_P_enum = 0xd0, - ieee_variable_Q_enum = 0xd1, - ieee_variable_R_enum = 0xd2, - ieee_variable_S_enum = 0xd3, - ieee_variable_T_enum = 0xd4, - ieee_variable_U_enum = 0xd5, - ieee_variable_V_enum = 0xd6, - ieee_variable_W_enum = 0xd7, - ieee_variable_X_enum = 0xd8, - ieee_variable_Y_enum = 0xd9, - ieee_variable_Z_enum = 0xda, - ieee_function_plus_enum = 0xa5, - ieee_function_minus_enum = 0xa6, - ieee_function_signed_open_b_enum = 0xba, - ieee_function_signed_close_b_enum = 0xbb, - - ieee_function_unsigned_open_b_enum = 0xbc, - ieee_function_unsigned_close_b_enum = 0xbd, - - ieee_function_either_open_b_enum = 0xbe, - ieee_function_either_close_b_enum = 0xbf, - ieee_record_seperator_enum = 0xdb, - - ieee_e2_first_byte_enum = 0xe2, - ieee_section_size_enum = 0xe2d3, - ieee_physical_region_size_enum = 0xe2c1, - ieee_region_base_address_enum = 0xe2c2, - ieee_mau_size_enum = 0xe2c6, - ieee_m_value_enum = 0xe2cd, - ieee_section_base_address_enum = 0xe2cc, - ieee_asn_record_enum = 0xe2ce, - ieee_section_offset_enum = 0xe2d2, - ieee_value_starting_address_enum = 0xe2c7, - ieee_assign_value_to_variable_enum = 0xe2d7, - ieee_set_current_pc_enum = 0xe2d0, - ieee_value_record_enum = 0xe2c9, - ieee_nn_record = 0xf0, - ieee_at_record_enum = 0xf1, - ieee_ty_record_enum = 0xf2, - ieee_attribute_record_enum = 0xf1c9, - ieee_atn_record_enum = 0xf1ce, - ieee_external_reference_info_record_enum = 0xf1d8, - ieee_weak_external_reference_enum= 0xf4, - ieee_repeat_data_enum = 0xf7, - ieee_bb_record_enum = 0xf8, - ieee_be_record_enum = 0xf9 -} ieee_record_enum_type; - - -typedef struct ieee_section { - unsigned int section_index; - unsigned int section_type; - char *section_name; - unsigned int parent_section_index; - unsigned int sibling_section_index; - unsigned int context_index; -} ieee_section_type; -#define IEEE_REFERENCE_BASE 11 -#define IEEE_PUBLIC_BASE 32 -#define IEEE_SECTION_NUMBER_BASE 1 - diff --git a/contrib/gdb/include/libiberty.h b/contrib/gdb/include/libiberty.h deleted file mode 100644 index dc083c8..0000000 --- a/contrib/gdb/include/libiberty.h +++ /dev/null @@ -1,133 +0,0 @@ -/* Function declarations for libiberty. - Written by Cygnus Support, 1994. - - The libiberty library provides a number of functions which are - missing on some operating systems. We do not declare those here, - to avoid conflicts with the system header files on operating - systems that do support those functions. In this file we only - declare those functions which are specific to libiberty. */ - -#ifndef LIBIBERTY_H -#define LIBIBERTY_H - -#include "ansidecl.h" - -/* Build an argument vector from a string. Allocates memory using - malloc. Use freeargv to free the vector. */ - -extern char **buildargv PARAMS ((char *)); - -/* Free a vector returned by buildargv. */ - -extern void freeargv PARAMS ((char **)); - -/* Return the last component of a path name. */ - -extern char *basename (); - -/* Concatenate an arbitrary number of strings, up to (char *) NULL. - Allocates memory using xmalloc. */ - -extern char *concat PARAMS ((const char *, ...)); - -/* Check whether two file descriptors refer to the same file. */ - -extern int fdmatch PARAMS ((int fd1, int fd2)); - -/* Get the amount of time the process has run, in microseconds. */ - -extern long get_run_time PARAMS ((void)); - -/* Allocate memory filled with spaces. Allocates using malloc. */ - -extern const char *spaces PARAMS ((int count)); - -/* Return the maximum error number for which strerror will return a - string. */ - -extern int errno_max PARAMS ((void)); - -/* Return the name of an errno value (e.g., strerrno (EINVAL) returns - "EINVAL"). */ - -extern const char *strerrno PARAMS ((int)); - -/* Given the name of an errno value, return the value. */ - -extern int strtoerrno PARAMS ((const char *)); - -/* ANSI's strerror(), but more robust. */ - -extern char *xstrerror PARAMS ((int)); - -/* Return the maximum signal number for which strsignal will return a - string. */ - -extern int signo_max PARAMS ((void)); - -/* Return a signal message string for a signal number - (e.g., strsignal (SIGHUP) returns something like "Hangup"). */ -/* This is commented out as it can conflict with one in system headers. - We still document its existence though. */ - -/*extern const char *strsignal PARAMS ((int));*/ - -/* Return the name of a signal number (e.g., strsigno (SIGHUP) returns - "SIGHUP"). */ - -extern const char *strsigno PARAMS ((int)); - -/* Given the name of a signal, return its number. */ - -extern int strtosigno PARAMS ((const char *)); - -/* Register a function to be run by xexit. Returns 0 on success. */ - -extern int xatexit PARAMS ((void (*fn) (void))); - -/* Exit, calling all the functions registered with xatexit. */ - -#ifndef __GNUC__ -extern void xexit PARAMS ((int status)); -#else -typedef void libiberty_voidfn PARAMS ((int status)); -__volatile__ libiberty_voidfn xexit; -#endif - -/* Set the program name used by xmalloc. */ - -extern void xmalloc_set_program_name PARAMS ((const char *)); - -/* Allocate memory without fail. If malloc fails, this will print a - message to stderr (using the name set by xmalloc_set_program_name, - if any) and then call xexit. - - FIXME: We do not declare the parameter type (size_t) in order to - avoid conflicts with other declarations of xmalloc that exist in - programs which use libiberty. */ - -extern PTR xmalloc (); - -/* Reallocate memory without fail. This works like xmalloc. - - FIXME: We do not declare the parameter types for the same reason as - xmalloc. */ - -extern PTR xrealloc (); - -/* Copy a string into a memory buffer without fail. */ - -extern char *xstrdup PARAMS ((const char *)); - -/* hex character manipulation routines */ - -#define _hex_array_size 256 -#define _hex_bad 99 -extern char _hex_value[_hex_array_size]; -extern void hex_init PARAMS ((void)); -#define hex_p(c) (hex_value (c) != _hex_bad) -/* If you change this, note well: Some code relies on side effects in - the argument being performed exactly once. */ -#define hex_value(c) (_hex_value[(unsigned char) (c)]) - -#endif /* ! defined (LIBIBERTY_H) */ diff --git a/contrib/gdb/include/mpw/ChangeLog b/contrib/gdb/include/mpw/ChangeLog deleted file mode 100644 index 8dbad87..0000000 --- a/contrib/gdb/include/mpw/ChangeLog +++ /dev/null @@ -1,61 +0,0 @@ -Tue Feb 27 12:23:04 1996 Raymond Jou - - * mpw.h (HAVE_VPRINTF): Add and define to have the value 1. - -Fri Dec 29 14:40:46 1995 Stan Shebs - - * mpw.h (HAVE_STDLIB_H, etc): Define to have the value 1. - (HAVE_FCNTL_H): Define. - -Mon Dec 11 15:39:06 1995 Stan Shebs - - * mpw.h (open, access): Define as mpw_open and mpw_access. - -Thu Nov 9 15:38:37 1995 Stan Shebs - - * mpw.h: Include unix.h if USE_MW_HEADERS, otherwise include - various original MPW include files (ioctl.h, etc). - (EIO): Define if not defined. - * sys/ioctl.h: Remove, not needed. - -Wed Oct 25 12:30:44 1995 Stan Shebs - - * mpw.h: Don't include errno.h or ioctl.h. - (ENOENT, EACCES, ENOSYS): Define if not defined. - (fdopen): Declare if __STDC__. - (R_OK, W_OK, X_OK): Define if not defined. - -Tue Sep 26 14:57:21 1995 Stan Shebs - - * mpw.h: New file, universally useful MPW host definitions. - Many of these used to live in bfd/hosts/mpw.h. - * grp.h: Remove RCS comment. - * sys/ioctl.h: Add a comment line. - -Wed Dec 14 13:12:14 1994 Stan Shebs - - * spin.h: New file, cursor spinning for progress. - -Thu Jun 30 15:32:07 1994 Stan Shebs (shebs@andros.cygnus.com) - - * fcntl.h (open): Allow optional third arg. - -Thu Apr 14 12:54:51 1994 Stan Shebs (shebs@andros.cygnus.com) - - * dir.h, dirent.h, fcntl.h, grp.h, pwd.h, stat.h: New files. - * sys/ioctl.h: New file. - -Mon Feb 21 09:44:45 1994 Stan Shebs (shebs@andros.cygnus.com) - - * sys/stat.h (struct stat): New field st_rsize. - (S_IFMT, etc): Use different bit positions. - (fstat): Add parameter names to prototype. - -Mon Jan 31 19:30:16 1994 Stan Shebs (shebs@andros.cygnus.com) - - * README: New file. - * utime.h, varargs.h: New files, simulated Posix. - * sys/{file,param,resource,stat,time,types}.h: New files, more - simulated Posix. - - diff --git a/contrib/gdb/include/mpw/README b/contrib/gdb/include/mpw/README deleted file mode 100644 index 10e92de..0000000 --- a/contrib/gdb/include/mpw/README +++ /dev/null @@ -1 +0,0 @@ -This is a collection of include files that help imitate Posix in MPW. diff --git a/contrib/gdb/include/mpw/dir.h b/contrib/gdb/include/mpw/dir.h deleted file mode 100644 index e6ccd2d..0000000 --- a/contrib/gdb/include/mpw/dir.h +++ /dev/null @@ -1,23 +0,0 @@ -/* The header gives the layout of a directory. */ - -#pragma once - -#ifndef _DIR_H -#define _DIR_H - -#ifndef _TYPES_H /* not quite right */ -#include -#endif - -#define DIRBLKSIZ 512 /* size of directory block */ - -#ifndef DIRSIZ -#define DIRSIZ 14 -#endif - -struct direct { - ino_t d_ino; - char d_name[DIRSIZ]; -}; - -#endif /* _DIR_H */ diff --git a/contrib/gdb/include/mpw/dirent.h b/contrib/gdb/include/mpw/dirent.h deleted file mode 100644 index 38000b2..0000000 --- a/contrib/gdb/include/mpw/dirent.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef __dirent_h -#define __dirent_h - -#include "sys/dir.h" - -struct dirent { - long d_ino; /* inode number of entry */ - off_t d_off; /* offset of disk directory entry */ - unsigned short d_reclen; /* length of this record */ - char d_name[1]; /* name of file */ -}; - -/* -#define DIRENTBASESIZE \ - (((struct dirent *) 0)->d_name - (char *) 0) -#define DIRENTSIZE(namelen) \ - ((DIRENTBASESIZE + (namelen) + NBPW) & ~(NBPW - 1)) -*/ - -/* from Mips posix/dirent.h */ - -/* -#undef rewinddir -*/ - -extern DIR *opendir(); -extern struct dirent *readdir(); -extern void rewinddir(); -extern int closedir(); - -#endif /* ! __dirent_h */ diff --git a/contrib/gdb/include/mpw/fcntl.h b/contrib/gdb/include/mpw/fcntl.h deleted file mode 100644 index 30999b4..0000000 --- a/contrib/gdb/include/mpw/fcntl.h +++ /dev/null @@ -1,124 +0,0 @@ -/* - * FCntl.h -- faccess(), fcntl(), and open() mode flags - * - * Portions copyright American Telephone & Telegraph - * Used with permission, Apple Computer Inc. (1985,1988,1990,1992) - * All rights reserved. - */ - -#ifndef __FCNTL__ -#define __FCNTL__ - -#ifndef __TYPES__ -#include -#endif - -/* - * For use by lseek(): - */ - -#ifndef __STDIO__ /* these defns exactly paralled in StdIO.h for fseek() */ -#define SEEK_CUR 1 -#define SEEK_END 2 -#define SEEK_SET 0 -#endif - -/* - * faccess() commands; for general use - */ - /* 'd' => "directory" ops */ -#define F_DELETE (('d'<<8)|0x01) -#define F_RENAME (('d'<<8)|0x02) - -/* - * more faccess() commands; for use only by MPW tools - */ - -#define F_OPEN (('d'<<8)|0x00) /* reserved for operating system use */ - /* 'e' => "editor" ops */ -#define F_GTABINFO (('e'<<8)|0x00) /* get tab offset for file */ -#define F_STABINFO (('e'<<8)|0x01) /* set " " " " */ -#define F_GFONTINFO (('e'<<8)|0x02) /* get font number and size for file */ -#define F_SFONTINFO (('e'<<8)|0x03) /* set " " " " " " */ -#define F_GPRINTREC (('e'<<8)|0x04) /* get print record for file */ -#define F_SPRINTREC (('e'<<8)|0x05) /* set " " " " */ -#define F_GSELINFO (('e'<<8)|0x06) /* get selection information for file */ -#define F_SSELINFO (('e'<<8)|0x07) /* set " " " " */ -#define F_GWININFO (('e'<<8)|0x08) /* get current window position */ -#define F_SWININFO (('e'<<8)|0x09) /* set " " " */ -#define F_GSCROLLINFO (('e'<<8)|0x0A) /* get scroll information */ -#define F_SSCROLLINFO (('e'<<8)|0x0B) /* set " " */ -#define F_GMARKER (('e'<<8)|0x0D) /* Get Marker */ -#define F_SMARKER (('e'<<8)|0x0C) /* Set " */ -#define F_GSAVEONCLOSE (('e'<<8)|0x0F) /* Get Save on close */ -#define F_SSAVEONCLOSE (('e'<<8)|0x0E) /* Set " " " */ - -/* - * argument structures used by various faccess() commands - */ - -struct MarkElement { - int start; /* start position of mark */ - int end; /* end position */ - unsigned char charCount; /* number of chars in mark name */ - char name[64]; /* mark name */ -} ; /* note: marker names may be up to 64 characters long */ - -#ifndef __cplusplus -typedef struct MarkElement MarkElement; -#endif - -struct SelectionRecord { - long startingPos; - long endingPos; - long displayTop; -}; - -#ifndef __cplusplus -typedef struct SelectionRecord SelectionRecord; -#endif - - -/* - * Mode values accessible to open() - */ -#define O_RDONLY 0 /* Bits 0 and 1 are used internally */ -#define O_WRONLY 1 /* Values 0..2 are historical */ -#define O_RDWR 2 /* NOTE: it goes 0, 1, 2, *!* 8, 16, 32, ... */ -#define O_APPEND (1<< 3) /* append (writes guaranteed at the end) */ -#define O_RSRC (1<< 4) /* Open the resource fork */ -#define O_ALIAS (1<< 5) /* Open alias file */ -#define O_CREAT (1<< 8) /* Open with file create */ -#define O_TRUNC (1<< 9) /* Open with truncation */ -#define O_EXCL (1<<10) /* w/ O_CREAT: Exclusive "create-only" */ -#define O_BINARY (1<<11) /* Open as a binary stream */ -#define O_NRESOLVE (1<<14) /* Don't resolve any aliases */ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * function prototypes - */ -int close(int); -int creat(const char*); -int dup(int filedes); /* OBSOLETE: fcntl(filedes, F_DUPFD, 0) is preferred */ -int faccess(char*, unsigned int, long*); -int fcntl(int, unsigned int, int); -long lseek(int, long, int); -int open(const char*, int, ...); -int read(int, char*, unsigned); -int unlink(char*); -int write(int, const char*, unsigned); - -#ifdef __cplusplus -} -#endif - -/* - * fcntl() commands - */ -#define F_DUPFD 0 /* Duplicate files (file descriptor) */ - -#endif __FCNTL__ diff --git a/contrib/gdb/include/mpw/grp.h b/contrib/gdb/include/mpw/grp.h deleted file mode 100644 index faf2c6a..0000000 --- a/contrib/gdb/include/mpw/grp.h +++ /dev/null @@ -1,10 +0,0 @@ -#pragma once - -#include "sys/types.h" - -struct group { - char *gr_name; - gid_t gr_gid; - char *gr_passwd; - char **gr_mem; -}; diff --git a/contrib/gdb/include/mpw/mpw.h b/contrib/gdb/include/mpw/mpw.h deleted file mode 100644 index 58702e7..0000000 --- a/contrib/gdb/include/mpw/mpw.h +++ /dev/null @@ -1,130 +0,0 @@ -/* Mac MPW host-specific definitions. */ - -#ifndef __INCLUDE_MPW_H -#define __INCLUDE_MPW_H - -#ifndef MPW -#define MPW -#endif - -/* MPW C is basically ANSI, but doesn't actually enable __STDC__, - nor does it allow __STDC__ to be #defined. */ - -#ifndef ALMOST_STDC -#define ALMOST_STDC -#endif - -#include -#include -#include - -#define HAVE_TIME_T_IN_TIME_H 1 - -#define HAVE_STDLIB_H 1 - -#define HAVE_ERRNO_H 1 - -#define HAVE_STDDEF_H 1 - -#define HAVE_STRING_H 1 - -#define HAVE_STDARG_H 1 - -#define HAVE_VPRINTF 1 - -#ifdef USE_MW_HEADERS - -#include - -#else - -#include -#include -#include - -#define HAVE_FCNTL_H 1 - -#ifndef O_ACCMODE -#define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR) -#endif - -#ifndef fileno -#define fileno(fp) ((fp)->_file) -#endif - -/* stdio.h does not define this if __STDC__, so define here. */ - -#ifdef __STDC__ -FILE *fdopen(int fildes, const char *mode); -#endif - -#endif /* USE_MW_HEADERS */ - -/* Add ersatz definitions, for systems that lack them. */ - -#ifndef EIO -#define EIO 96 -#endif -#ifndef ENOENT -#define ENOENT 97 -#endif -#ifndef EACCES -#define EACCES 98 -#endif -#ifndef ENOSYS -#define ENOSYS 99 -#endif - -#ifndef R_OK -#define R_OK 4 -#define W_OK 2 -#define X_OK 1 -#endif - -/* Binary files have different characteristics; for instance, no cr/nl - translation. */ - -#define USE_BINARY_FOPEN - -#include - -#ifdef MPW_C -#undef __PTR_TO_INT -#define __PTR_TO_INT(P) ((int)(P)) -#undef __INT_TO_PTR -#define __INT_TO_PTR(P) ((char *)(P)) -#endif /* MPW_C */ - -#define NO_FCNTL - -int fstat (); - -FILE *mpw_fopen (); -int mpw_fseek (); -int mpw_fread (); -int mpw_fwrite (); -int mpw_access (); -int mpw_open (); -int mpw_creat (); -void mpw_abort (void); - -/* Map these standard functions to improved versions in libiberty. */ - -#define fopen mpw_fopen -#define fseek mpw_fseek -#define fread mpw_fread -#define fwrite mpw_fwrite -#define open mpw_open -#define access mpw_access -#define creat mpw_creat -#define abort mpw_abort - -#define POSIX_UTIME - -#define LOSING_TOTALLY - -/* Define this so that files will be closed before being unlinked. */ - -#define CLOSE_BEFORE_UNLINK - -#endif /* __INCLUDE_MPW_H */ diff --git a/contrib/gdb/include/mpw/pwd.h b/contrib/gdb/include/mpw/pwd.h deleted file mode 100644 index 2d4fb70..0000000 --- a/contrib/gdb/include/mpw/pwd.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef __pwd_h -#define __pwd_h - -#include - -struct passwd { - char *pw_name; - uid_t pw_uid; - gid_t pw_gid; - char *pw_dir; - char *pw_shell; - char *pw_passwd; -}; - -#endif /* ! __pwd_h */ diff --git a/contrib/gdb/include/mpw/spin.h b/contrib/gdb/include/mpw/spin.h deleted file mode 100644 index 867d145..0000000 --- a/contrib/gdb/include/mpw/spin.h +++ /dev/null @@ -1,64 +0,0 @@ -/* Progress macros that use SpinCursor in MPW. - Copyright (C) 1994 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. */ - -#ifndef _SPIN_H -#define _SPIN_H - -/* For MPW, progress macros just need to "spin the cursor" frequently, - preferably several times per second on a 68K Mac. */ - -/* In order to determine if we're meeting the goal, define this macro - and information about frequency of spinning will be collected and - displayed. */ - -#define SPIN_MEASUREMENT - -#include - -/* Programs use this macro to indicate the start of a lengthy - activity. STR identifies the particular activity, while N - indicates the expected duration, in unspecified units. If N is - zero, then the expected time to completion is unknown. */ - -#undef START_PROGRESS -#define START_PROGRESS(STR,N) mpw_start_progress (STR, N, __FILE__, __LINE__); - -/* Programs use this macro to indicate that progress has been made on a - lengthy activity. */ - -#undef PROGRESS -#ifdef SPIN_MEASUREMENT -#define PROGRESS(X) mpw_progress_measured (X, __FILE__, __LINE__); -#else -#define PROGRESS(X) mpw_progress (X); -#endif - -/* Programs use this macro to indicate the end of a lengthy activity. - STR must match a STR passed to START_PROGRESS previously. */ - -#undef END_PROGRESS -#define END_PROGRESS(STR) mpw_end_progress (STR, __FILE__, __LINE__); - -extern void mpw_start_progress (char *, int, char *, int); - -extern void mpw_progress (int); - -extern void mpw_progress_measured (int, char *, int); - -extern void mpw_end_progress (char *, char *, int); - -#endif /* _SPIN_H */ diff --git a/contrib/gdb/include/mpw/stat.h b/contrib/gdb/include/mpw/stat.h deleted file mode 100644 index 057b8d5..0000000 --- a/contrib/gdb/include/mpw/stat.h +++ /dev/null @@ -1,75 +0,0 @@ -/* The header defines a struct that is used in the stat() and - * fstat functions. The information in this struct comes from the i-node of - * some file. These calls are the only approved way to inspect i-nodes. - */ - -#ifndef _STAT_H -#define _STAT_H - -#ifndef _TYPES_H /* not quite right */ -#include -#endif - -struct stat { - dev_t st_dev; /* major/minor device number */ - ino_t st_ino; /* i-node number */ - mode_t st_mode; /* file mode, protection bits, etc. */ - short int st_nlink; /* # links; TEMPORARY HACK: should be nlink_t*/ - uid_t st_uid; /* uid of the file's owner */ - short int st_gid; /* gid; TEMPORARY HACK: should be gid_t */ - dev_t st_rdev; - off_t st_size; /* file size */ - time_t st_atime; /* time of last access */ - time_t st_mtime; /* time of last data modification */ - time_t st_ctime; /* time of last file status change */ -}; - -/* Traditional mask definitions for st_mode. */ -#define S_IFMT 0170000 /* type of file */ -#define S_IFREG 0100000 /* regular */ -#define S_IFBLK 0060000 /* block special */ -#define S_IFDIR 0040000 /* directory */ -#define S_IFCHR 0020000 /* character special */ -#define S_IFIFO 0010000 /* this is a FIFO */ -#define S_ISUID 0004000 /* set user id on execution */ -#define S_ISGID 0002000 /* set group id on execution */ - /* next is reserved for future use */ -#define S_ISVTX 01000 /* save swapped text even after use */ - -/* POSIX masks for st_mode. */ -#define S_IRWXU 00700 /* owner: rwx------ */ -#define S_IRUSR 00400 /* owner: r-------- */ -#define S_IWUSR 00200 /* owner: -w------- */ -#define S_IXUSR 00100 /* owner: --x------ */ - -#define S_IRWXG 00070 /* group: ---rwx--- */ -#define S_IRGRP 00040 /* group: ---r----- */ -#define S_IWGRP 00020 /* group: ----w---- */ -#define S_IXGRP 00010 /* group: -----x--- */ - -#define S_IRWXO 00007 /* others: ------rwx */ -#define S_IROTH 00004 /* others: ------r-- */ -#define S_IWOTH 00002 /* others: -------w- */ -#define S_IXOTH 00001 /* others: --------x */ - -/* The following macros test st_mode (from POSIX Sec. 5.6.1.1. */ -#define S_ISREG(m) ((m & S_IFMT) == S_IFREG) /* is a reg file */ -#define S_ISDIR(m) ((m & S_IFMT) == S_IFDIR) /* is a directory */ -#define S_ISCHR(m) ((m & S_IFMT) == S_IFCHR) /* is a char spec */ -#define S_ISBLK(m) ((m & S_IFMT) == S_IFBLK) /* is a block spec */ -#define S_ISFIFO(m) ((m & S_IFMT) == S_IFIFO) /* is a pipe/FIFO */ - - -/* Function Prototypes. */ -#ifndef _ANSI_H -#include -#endif - -_PROTOTYPE( int chmod, (const char *_path, int _mode) ); -_PROTOTYPE( int fstat, (int _fildes, struct stat *_buf) ); -_PROTOTYPE( int mkdir, (const char *_path, int _mode) ); -_PROTOTYPE( int mkfifo, (const char *_path, int _mode) ); -_PROTOTYPE( int stat , (const char *_path, struct stat *_buf) ); -_PROTOTYPE( mode_t umask, (int _cmask) ); - -#endif /* _STAT_H */ diff --git a/contrib/gdb/include/mpw/sys/file.h b/contrib/gdb/include/mpw/sys/file.h deleted file mode 100644 index 40a8c17..0000000 --- a/contrib/gdb/include/mpw/sys/file.h +++ /dev/null @@ -1 +0,0 @@ -/* empty */ diff --git a/contrib/gdb/include/mpw/sys/param.h b/contrib/gdb/include/mpw/sys/param.h deleted file mode 100644 index 40a8c17..0000000 --- a/contrib/gdb/include/mpw/sys/param.h +++ /dev/null @@ -1 +0,0 @@ -/* empty */ diff --git a/contrib/gdb/include/mpw/sys/resource.h b/contrib/gdb/include/mpw/sys/resource.h deleted file mode 100644 index d39439d..0000000 --- a/contrib/gdb/include/mpw/sys/resource.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef __SYS_RESOURCE_H__ -#define __SYS_RESOURCE_H__ - -struct rusage { - struct timeval ru_utime; - struct timeval ru_stime; -}; - -#endif /* __SYS_RESOURCE_H__ */ diff --git a/contrib/gdb/include/mpw/sys/stat.h b/contrib/gdb/include/mpw/sys/stat.h deleted file mode 100644 index b65c72e..0000000 --- a/contrib/gdb/include/mpw/sys/stat.h +++ /dev/null @@ -1,44 +0,0 @@ -/* Imitation sys/stat.h. */ - -#ifndef __SYS_STAT_H__ -#define __SYS_STAT_H__ - -#include -#include - -struct stat { - dev_t st_dev; - ino_t st_ino; - mode_t st_mode; - short st_nlink; - uid_t st_uid; - gid_t st_gid; - dev_t st_rdev; - off_t st_size; - off_t st_rsize; - time_t st_atime; - int st_spare1; - time_t st_mtime; - int st_spare2; - time_t st_ctime; - int st_spare3; - long st_blksize; - long st_blocks; - long st_spare4[2]; -}; - -#define S_IFMT 0170000L -#define S_IFDIR 0040000L -#define S_IFREG 0100000L -#define S_IREAD 0400 -#define S_IWRITE 0200 -#define S_IEXEC 0100 - -#define S_IFIFO 010000 /* FIFO special */ -#define S_IFCHR 020000 /* character special */ -#define S_IFBLK 030000 /* block special */ - -int stat (char *path, struct stat *buf); -int fstat (int fd, struct stat *buf); - -#endif /* __SYS_STAT_H___ */ diff --git a/contrib/gdb/include/mpw/sys/time.h b/contrib/gdb/include/mpw/sys/time.h deleted file mode 100644 index f9e4852..0000000 --- a/contrib/gdb/include/mpw/sys/time.h +++ /dev/null @@ -1,13 +0,0 @@ -/* Imitation sys/time.h. */ - -#ifndef __SYS_TIME_H__ -#define __SYS_TIME_H__ - -#include - -struct timeval { - long tv_sec; - long tv_usec; -}; - -#endif /* __SYS_TIME_H__ */ diff --git a/contrib/gdb/include/mpw/sys/types.h b/contrib/gdb/include/mpw/sys/types.h deleted file mode 100644 index d7d9c9f..0000000 --- a/contrib/gdb/include/mpw/sys/types.h +++ /dev/null @@ -1,15 +0,0 @@ -/* Imitation sys/types.h. */ - -#ifndef __SYS_TYPES_H__ -#define __SYS_TYPES_H__ - -#include - -typedef short dev_t; -typedef short ino_t; -typedef unsigned short mode_t; -typedef unsigned short uid_t; -typedef unsigned short gid_t; -typedef long off_t; - -#endif /* __SYS_TYPES_H__ */ diff --git a/contrib/gdb/include/mpw/utime.h b/contrib/gdb/include/mpw/utime.h deleted file mode 100644 index e8bf66f..0000000 --- a/contrib/gdb/include/mpw/utime.h +++ /dev/null @@ -1,7 +0,0 @@ - -struct utimbuf { - time_t actime; - time_t modtime; -}; - -int utime (char *, struct utimbuf *); diff --git a/contrib/gdb/include/mpw/varargs.h b/contrib/gdb/include/mpw/varargs.h deleted file mode 100644 index acb9e45..0000000 --- a/contrib/gdb/include/mpw/varargs.h +++ /dev/null @@ -1,9 +0,0 @@ -/* varargs.h. */ -#ifndef __va_list__ -#define __va_list__ -typedef char *va_list; -#endif -#define va_dcl int va_alist; -#define va_start(list) list = (char *) &va_alist -#define va_end(list) -#define va_arg(list,mode) ((mode *)(list += sizeof(mode)))[-1] diff --git a/contrib/gdb/include/nlm/ChangeLog b/contrib/gdb/include/nlm/ChangeLog deleted file mode 100644 index d9ea3d0..0000000 --- a/contrib/gdb/include/nlm/ChangeLog +++ /dev/null @@ -1,83 +0,0 @@ -Fri May 6 13:31:04 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * external.h (nlmNAME(External_Custom_Header)): Add length, - dataOffset, and dataStamp field. - (nlmNAME(External_Cygnus_Ext_Header)): Remove. - * internal.h (Nlm_Internal_Custom_Header): Add hdrLength, - dataOffset, dataStamp and hdr fields. - -Fri Apr 22 11:12:39 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * external.h (struct nlmNAME(external_cygnus_ext_header)): Rename - from nlmNAME(external_cygnus_section_header). Change stamp field - to 8 bytes. Add bytes field. - * internal.h (nlm_internal_cygnus_ext_header): Rename from - nlm_internal_cygnus_section_header. Change stamp field to 8 - bytes. - -Thu Apr 21 11:57:09 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * internal.h (struct nlm_internal_cygnus_section_header): Define. - * external.h (struct nlmNAME(external_cygnus_section_header): - Define. - -Wed Apr 20 14:27:43 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * internal.h (struct nlm_internal_custom_header): Remove - debugRecOffset and debugRecLength fields. Add data field. - * external.h (struct nlmNAME(external_custom_header)): Remove - debugRecOffset and debugRecLength fields. - -Mon Feb 7 08:28:40 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * internal.h: Change HOST_64_BIT to BFD_HOST_64_BIT. - -Thu Dec 2 14:14:48 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * alpha-ext.h: New file describing formats of information in Alpha - NetWare files. - * common.h: Define some non-external Alpha information. - -Wed Nov 17 17:38:58 1993 Sean Eric Fagan (sef@cygnus.com) - - * external.h: Don't define external_fixed_header here. - * i386-ext.h, sparc32-ext.h: New header files to define - external_fixed_header for particular CPU's. - -Wed Oct 27 11:45:56 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * internal.h (Nlm_Internal_Extended_Header): Added fields - sharedDebugRecordOffset and sharedDebugRecordCount. - * external.h (NlmNAME(External_Extended_Header)): Likewise. - - * common.h (NLM_SIGNATURE): Do not define (it's different for each - backend). - -Tue Aug 31 13:24:15 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * internal.h: Change length fields of type char to type unsigned - char. - -Sat Jul 31 02:12:14 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * common.h (NLM_HIBIT, NLM_HEADER_VERSION): Define. - -Thu Jul 22 16:09:47 1993 Fred Fish (fnf@deneb.cygnus.com) - - * common.h (NLM_CAT*, NLM_ARCH_SIZE, NLM_TARGET_LONG_SIZE, - NLM_TARGET_ADDRESS_SIZE, NLM_NAME, NlmNAME, nlmNAME): New - macros. - * external.h (TARGET_LONG_SIZE, TARGET_ADDRESS_SIZE): Remove - macros, convert usages to NLM_ equivalents. - * external.h: Use nlmNAME and NlmNAME macros to derive both - 32 and 64 bit versions. - -Mon Jul 19 22:12:40 1993 Fred Fish (fnf@deneb.cygnus.com) - - * (common.h, external.h, internal.h): New files for NLM/NetWare - support. - - -Local Variables: -version-control: never -End: diff --git a/contrib/gdb/include/nlm/alpha-ext.h b/contrib/gdb/include/nlm/alpha-ext.h deleted file mode 100644 index 37199dd..0000000 --- a/contrib/gdb/include/nlm/alpha-ext.h +++ /dev/null @@ -1,166 +0,0 @@ -/* Alpha NLM (NetWare Loadable Module) support for BFD. - Copyright (C) 1993 Free Software Foundation, Inc. - By Ian Lance Taylor, Cygnus Support - -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. */ - -/* An Alpha NLM starts with an instance of this structure. */ - -struct nlm32_alpha_external_prefix_header -{ - /* Magic number. Must be NLM32_ALPHA_MAGIC. */ - unsigned char magic[4]; - /* Format descriptor. Current value is 2. */ - unsigned char format[4]; - /* Size of prefix header. */ - unsigned char size[4]; - /* Padding. */ - unsigned char pad1[4]; - /* More fields may be added later, supposedly. */ -}; - -/* The external format of an Alpha NLM reloc. This is the same as an - Alpha ECOFF reloc. */ - -struct nlm32_alpha_external_reloc -{ - unsigned char r_vaddr[8]; - unsigned char r_symndx[4]; - unsigned char r_bits[4]; -}; - -/* Constants to unpack the r_bits field of a reloc. */ - -#define RELOC_BITS0_TYPE_LITTLE 0xff -#define RELOC_BITS0_TYPE_SH_LITTLE 0 - -#define RELOC_BITS1_EXTERN_LITTLE 0x01 - -#define RELOC_BITS1_OFFSET_LITTLE 0x7e -#define RELOC_BITS1_OFFSET_SH_LITTLE 1 - -#define RELOC_BITS1_RESERVED_LITTLE 0x80 -#define RELOC_BITS1_RESERVED_SH_LITTLE 7 -#define RELOC_BITS2_RESERVED_LITTLE 0xff -#define RELOC_BITS2_RESERVED_SH_LEFT_LITTLE 1 -#define RELOC_BITS3_RESERVED_LITTLE 0x03 -#define RELOC_BITS3_RESERVED_SH_LEFT_LITTLE 9 - -#define RELOC_BITS3_SIZE_LITTLE 0xfc -#define RELOC_BITS3_SIZE_SH_LITTLE 2 - -/* The external format of the fixed header. */ - -typedef struct nlm32_alpha_external_fixed_header -{ - - /* The signature field identifies the file as an NLM. It must contain - the signature string, which depends upon the NLM target. */ - - unsigned char signature[24]; - - /* The version of the header. At this time, the highest version number - is 4. */ - - unsigned char version[4]; - - /* The name of the module, which must be a DOS name (1-8 characters followed - by a period and a 1-3 character extension). The first byte is the byte - length of the name and the last byte is a null terminator byte. This - field is fixed length, and any unused bytes should be null bytes. The - value is set by the OUTPUT keyword to NLMLINK. */ - - unsigned char moduleName[14]; - - /* Padding to make it come out correct. */ - - unsigned char pad1[2]; - - /* The byte offset of the code image from the start of the file. */ - - unsigned char codeImageOffset[4]; - - /* The size of the code image, in bytes. */ - - unsigned char codeImageSize[4]; - - /* The byte offset of the data image from the start of the file. */ - - unsigned char dataImageOffset[4]; - - /* The size of the data image, in bytes. */ - - unsigned char dataImageSize[4]; - - /* The size of the uninitialized data region that the loader is to be - allocated at load time. Uninitialized data follows the initialized - data in the NLM address space. */ - - unsigned char uninitializedDataSize[4]; - - /* The byte offset of the custom data from the start of the file. The - custom data is set by the CUSTOM keyword to NLMLINK. It is possible - for this to be EOF if there is no custom data. */ - - unsigned char customDataOffset[4]; - - /* The size of the custom data, in bytes. */ - - unsigned char customDataSize[4]; - - /* The byte offset of the module dependencies from the start of the file. - The module dependencies are determined by the MODULE keyword in - NLMLINK. */ - - unsigned char moduleDependencyOffset[4]; - - /* The number of module dependencies at the moduleDependencyOffset. */ - - unsigned char numberOfModuleDependencies[4]; - - /* The byte offset of the relocation fixup data from the start of the file */ - - unsigned char relocationFixupOffset[4]; - - unsigned char numberOfRelocationFixups[4]; - - unsigned char externalReferencesOffset[4]; - - unsigned char numberOfExternalReferences[4]; - - unsigned char publicsOffset[4]; - - unsigned char numberOfPublics[4]; - - /* The byte offset of the internal debug info from the start of the file. - It is possible for this to be EOF if there is no debug info. */ - - unsigned char debugInfoOffset[4]; - - unsigned char numberOfDebugRecords[4]; - - unsigned char codeStartOffset[4]; - - unsigned char exitProcedureOffset[4]; - - unsigned char checkUnloadProcedureOffset[4]; - - unsigned char moduleType[4]; - - unsigned char flags[4]; - -} Nlm32_alpha_External_Fixed_Header; diff --git a/contrib/gdb/include/nlm/common.h b/contrib/gdb/include/nlm/common.h deleted file mode 100644 index e96550a..0000000 --- a/contrib/gdb/include/nlm/common.h +++ /dev/null @@ -1,124 +0,0 @@ -/* NLM (NetWare Loadable Module) support for BFD. - Copyright (C) 1993 Free Software Foundation, Inc. - - Written by Fred Fish @ Cygnus Support - -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. */ - - -/* This file is part of NLM support for BFD, and contains the portions - that are common to both the internal and external representations. */ - -/* Semi-portable string concatenation in cpp. - The NLM_CAT4 hack is to avoid a problem with some strict ANSI C - preprocessors. The problem is, "32_" or "64_" are not a valid - preprocessing tokens, and we don't want extra underscores (e.g., - "nlm_32_"). The XNLM_CAT2 macro will cause the inner NLM_CAT macros - to be evaluated first, producing still-valid pp-tokens. Then the - final concatenation can be done. (Sigh.) */ - -#ifdef SABER -# define NLM_CAT(a,b) a##b -# define NLM_CAT3(a,b,c) a##b##c -# define NLM_CAT4(a,b,c,d) a##b##c##d -#else -# ifdef __STDC__ -# define NLM_CAT(a,b) a##b -# define NLM_CAT3(a,b,c) a##b##c -# define XNLM_CAT2(a,b) NLM_CAT(a,b) -# define NLM_CAT4(a,b,c,d) XNLM_CAT2(NLM_CAT(a,b),NLM_CAT(c,d)) -# else -# define NLM_CAT(a,b) a/**/b -# define NLM_CAT3(a,b,c) a/**/b/**/c -# define NLM_CAT4(a,b,c,d) a/**/b/**/c/**/d -# endif -#endif - -/* If NLM_ARCH_SIZE is not defined, default to 32. NLM_ARCH_SIZE is - optionally defined by the application. */ - -#ifndef NLM_ARCH_SIZE -# define NLM_ARCH_SIZE 32 -#endif - -#if NLM_ARCH_SIZE == 32 -# define NLM_TARGET_LONG_SIZE 4 -# define NLM_TARGET_ADDRESS_SIZE 4 -# define NLM_NAME(x,y) NLM_CAT4(x,32,_,y) -# define NLM_HIBIT (((bfd_vma) 1) << 31) -#endif -#if NLM_ARCH_SIZE == 64 -# define NLM_TARGET_LONG_SIZE 8 -# define NLM_TARGET_ADDRESS_SIZE 8 -# define NLM_NAME(x,y) NLM_CAT4(x,64,_,y) -# define NLM_HIBIT (((bfd_vma) 1) << 63) -#endif - -#define NlmNAME(X) NLM_NAME(Nlm,X) -#define nlmNAME(X) NLM_NAME(nlm,X) - -/* Give names to things that should not change. */ - -#define NLM_MAX_DESCRIPTION_LENGTH 127 -#define NLM_MAX_SCREEN_NAME_LENGTH 71 -#define NLM_MAX_THREAD_NAME_LENGTH 71 -#define NLM_MAX_COPYRIGHT_MESSAGE_LENGTH 255 -#define NLM_OTHER_DATA_LENGTH 400 /* FIXME */ -#define NLM_OLD_THREAD_NAME_LENGTH 5 -#define NLM_SIGNATURE_SIZE 24 -#define NLM_HEADER_VERSION 4 -#define NLM_MODULE_NAME_SIZE 14 -#define NLM_DEFAULT_STACKSIZE (8 * 1024) - -/* Alpha information. This should probably be in a separate Alpha - header file, but it can't go in alpha-ext.h because some of it is - needed by nlmconv.c. */ - -/* Magic number in Alpha prefix header. */ -#define NLM32_ALPHA_MAGIC (0x83561840) - -/* The r_type field in an Alpha reloc is one of the following values. */ -#define ALPHA_R_IGNORE 0 -#define ALPHA_R_REFLONG 1 -#define ALPHA_R_REFQUAD 2 -#define ALPHA_R_GPREL32 3 -#define ALPHA_R_LITERAL 4 -#define ALPHA_R_LITUSE 5 -#define ALPHA_R_GPDISP 6 -#define ALPHA_R_BRADDR 7 -#define ALPHA_R_HINT 8 -#define ALPHA_R_SREL16 9 -#define ALPHA_R_SREL32 10 -#define ALPHA_R_SREL64 11 -#define ALPHA_R_OP_PUSH 12 -#define ALPHA_R_OP_STORE 13 -#define ALPHA_R_OP_PSUB 14 -#define ALPHA_R_OP_PRSHIFT 15 -#define ALPHA_R_GPVALUE 16 -#define ALPHA_R_NW_RELOC 250 - -/* A local reloc, other than ALPHA_R_GPDISP or ALPHA_R_IGNORE, must be - against one of these symbol indices. */ -#define ALPHA_RELOC_SECTION_TEXT 1 -#define ALPHA_RELOC_SECTION_DATA 3 - -/* An ALPHA_R_NW_RELOC has one of these values in the size field. If - it is SETGP, the r_vaddr field holds the GP value to use. If it is - LITA, the r_vaddr field holds the address of the .lita section and - the r_symndx field holds the size of the .lita section. */ -#define ALPHA_R_NW_RELOC_SETGP 1 -#define ALPHA_R_NW_RELOC_LITA 2 diff --git a/contrib/gdb/include/nlm/external.h b/contrib/gdb/include/nlm/external.h deleted file mode 100644 index f77a5bb..0000000 --- a/contrib/gdb/include/nlm/external.h +++ /dev/null @@ -1,174 +0,0 @@ -/* NLM (NetWare Loadable Module) support for BFD. - Copyright (C) 1993 Free Software Foundation, Inc. - - Written by Fred Fish @ Cygnus Support - -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. */ - - -/* This file is part of NLM support for BFD, and contains the portions - that describe how NLM is represented externally by the BFD library. - I.E. it describes the in-file representation of NLM. It requires - the nlm/common.h file which contains the portions that are common to - both the internal and external representations. - - Note that an NLM header consists of three parts: - - (1) A fixed length header that has specific fields of known length, - at specific offsets in the file. - - (2) A variable length header that has specific fields in a specific - order, but some fields may be variable length. - - (3) A auxiliary header that has various optional fields in no specific - order. There is no way to identify the end of the auxiliary headers - except by finding a header without a recognized 'stamp'. - - The exact format of the fixed length header unfortunately varies - from one NLM target to another, due to padding. Each target - defines the correct external format in a separate header file. - -*/ - -/* NLM Header */ - -/* The version header is one of the optional auxiliary headers and - follows the fixed length and variable length NLM headers. */ - -typedef struct nlmNAME(external_version_header) -{ - - /* The header is recognized by "VeRsIoN#" in the stamp field. */ - char stamp[8]; - - unsigned char majorVersion[NLM_TARGET_LONG_SIZE]; - - unsigned char minorVersion[NLM_TARGET_LONG_SIZE]; - - unsigned char revision[NLM_TARGET_LONG_SIZE]; - - unsigned char year[NLM_TARGET_LONG_SIZE]; - - unsigned char month[NLM_TARGET_LONG_SIZE]; - - unsigned char day[NLM_TARGET_LONG_SIZE]; - -} NlmNAME(External_Version_Header); - - -typedef struct nlmNAME(external_copyright_header) -{ - - /* The header is recognized by "CoPyRiGhT=" in the stamp field. */ - - char stamp[10]; - - unsigned char copyrightMessageLength[1]; - - /* There is a variable length field here called 'copyrightMessage' - that is the length specified by copyrightMessageLength. */ - -} NlmNAME(External_Copyright_Header); - - -typedef struct nlmNAME(external_extended_header) -{ - - /* The header is recognized by "MeSsAgEs" in the stamp field. */ - - char stamp[8]; - - unsigned char languageID[NLM_TARGET_LONG_SIZE]; - - unsigned char messageFileOffset[NLM_TARGET_LONG_SIZE]; - - unsigned char messageFileLength[NLM_TARGET_LONG_SIZE]; - - unsigned char messageCount[NLM_TARGET_LONG_SIZE]; - - unsigned char helpFileOffset[NLM_TARGET_LONG_SIZE]; - - unsigned char helpFileLength[NLM_TARGET_LONG_SIZE]; - - unsigned char RPCDataOffset[NLM_TARGET_LONG_SIZE]; - - unsigned char RPCDataLength[NLM_TARGET_LONG_SIZE]; - - unsigned char sharedCodeOffset[NLM_TARGET_LONG_SIZE]; - - unsigned char sharedCodeLength[NLM_TARGET_LONG_SIZE]; - - unsigned char sharedDataOffset[NLM_TARGET_LONG_SIZE]; - - unsigned char sharedDataLength[NLM_TARGET_LONG_SIZE]; - - unsigned char sharedRelocationFixupOffset[NLM_TARGET_LONG_SIZE]; - - unsigned char sharedRelocationFixupCount[NLM_TARGET_LONG_SIZE]; - - unsigned char sharedExternalReferenceOffset[NLM_TARGET_LONG_SIZE]; - - unsigned char sharedExternalReferenceCount[NLM_TARGET_LONG_SIZE]; - - unsigned char sharedPublicsOffset[NLM_TARGET_LONG_SIZE]; - - unsigned char sharedPublicsCount[NLM_TARGET_LONG_SIZE]; - - unsigned char sharedDebugRecordOffset[NLM_TARGET_LONG_SIZE]; - - unsigned char sharedDebugRecordCount[NLM_TARGET_LONG_SIZE]; - - unsigned char sharedInitializationOffset[NLM_TARGET_ADDRESS_SIZE]; - - unsigned char SharedExitProcedureOffset[NLM_TARGET_ADDRESS_SIZE]; - - unsigned char productID[NLM_TARGET_LONG_SIZE]; - - unsigned char reserved0[NLM_TARGET_LONG_SIZE]; - - unsigned char reserved1[NLM_TARGET_LONG_SIZE]; - - unsigned char reserved2[NLM_TARGET_LONG_SIZE]; - - unsigned char reserved3[NLM_TARGET_LONG_SIZE]; - - unsigned char reserved4[NLM_TARGET_LONG_SIZE]; - - unsigned char reserved5[NLM_TARGET_LONG_SIZE]; - -} NlmNAME(External_Extended_Header); - - -typedef struct nlmNAME(external_custom_header) -{ - - /* The header is recognized by "CuStHeAd" in the stamp field. */ - char stamp[8]; - - /* Length of this header. */ - unsigned char length[NLM_TARGET_LONG_SIZE]; - - /* Offset to data. */ - unsigned char dataOffset[NLM_TARGET_LONG_SIZE]; - - /* Length of data. */ - unsigned char dataLength[NLM_TARGET_LONG_SIZE]; - - /* Stamp for this customer header--we recognize "CyGnUsEx". */ - char dataStamp[8]; - -} NlmNAME(External_Custom_Header); diff --git a/contrib/gdb/include/nlm/i386-ext.h b/contrib/gdb/include/nlm/i386-ext.h deleted file mode 100644 index d33ad2d..0000000 --- a/contrib/gdb/include/nlm/i386-ext.h +++ /dev/null @@ -1,116 +0,0 @@ -/* i386 NLM (NetWare Loadable Module) support for BFD. - Copyright (C) 1993 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. */ - -/* The external format of the fixed header. */ - -typedef struct nlm32_i386_external_fixed_header -{ - - /* The signature field identifies the file as an NLM. It must contain - the signature string, which depends upon the NLM target. */ - - unsigned char signature[24]; - - /* The version of the header. At this time, the highest version number - is 4. */ - - unsigned char version[4]; - - /* The name of the module, which must be a DOS name (1-8 characters followed - by a period and a 1-3 character extension). The first byte is the byte - length of the name and the last byte is a null terminator byte. This - field is fixed length, and any unused bytes should be null bytes. The - value is set by the OUTPUT keyword to NLMLINK. */ - - unsigned char moduleName[14]; - - /* The byte offset of the code image from the start of the file. */ - - unsigned char codeImageOffset[4]; - - /* The size of the code image, in bytes. */ - - unsigned char codeImageSize[4]; - - /* The byte offset of the data image from the start of the file. */ - - unsigned char dataImageOffset[4]; - - /* The size of the data image, in bytes. */ - - unsigned char dataImageSize[4]; - - /* The size of the uninitialized data region that the loader is to be - allocated at load time. Uninitialized data follows the initialized - data in the NLM address space. */ - - unsigned char uninitializedDataSize[4]; - - /* The byte offset of the custom data from the start of the file. The - custom data is set by the CUSTOM keyword to NLMLINK. It is possible - for this to be EOF if there is no custom data. */ - - unsigned char customDataOffset[4]; - - /* The size of the custom data, in bytes. */ - - unsigned char customDataSize[4]; - - /* The byte offset of the module dependencies from the start of the file. - The module dependencies are determined by the MODULE keyword in - NLMLINK. */ - - unsigned char moduleDependencyOffset[4]; - - /* The number of module dependencies at the moduleDependencyOffset. */ - - unsigned char numberOfModuleDependencies[4]; - - /* The byte offset of the relocation fixup data from the start of the file */ - - unsigned char relocationFixupOffset[4]; - - unsigned char numberOfRelocationFixups[4]; - - unsigned char externalReferencesOffset[4]; - - unsigned char numberOfExternalReferences[4]; - - unsigned char publicsOffset[4]; - - unsigned char numberOfPublics[4]; - - /* The byte offset of the internal debug info from the start of the file. - It is possible for this to be EOF if there is no debug info. */ - - unsigned char debugInfoOffset[4]; - - unsigned char numberOfDebugRecords[4]; - - unsigned char codeStartOffset[4]; - - unsigned char exitProcedureOffset[4]; - - unsigned char checkUnloadProcedureOffset[4]; - - unsigned char moduleType[4]; - - unsigned char flags[4]; - -} Nlm32_i386_External_Fixed_Header; diff --git a/contrib/gdb/include/nlm/internal.h b/contrib/gdb/include/nlm/internal.h deleted file mode 100644 index dd27dc4..0000000 --- a/contrib/gdb/include/nlm/internal.h +++ /dev/null @@ -1,309 +0,0 @@ -/* NLM (NetWare Loadable Module) support for BFD. - Copyright (C) 1993 Free Software Foundation, Inc. - - Written by Fred Fish @ Cygnus Support. - -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. */ - - -/* This file is part of NLM support for BFD, and contains the portions - that describe how NLM is represented internally in the BFD library. - I.E. it describes the in-memory representation of NLM. It requires - the nlm/common.h file which contains the portions that are common to - both the internal and external representations. */ - -#if 0 - -/* Types used by various structures, functions, etc. */ - -typedef unsigned long Nlm32_Addr; /* Unsigned program address */ -typedef unsigned long Nlm32_Off; /* Unsigned file offset */ -typedef long Nlm32_Sword; /* Signed large integer */ -typedef unsigned long Nlm32_Word; /* Unsigned large integer */ -typedef unsigned short Nlm32_Half; /* Unsigned medium integer */ -typedef unsigned char Nlm32_Char; /* Unsigned tiny integer */ - -#ifdef BFD_HOST_64_BIT -typedef unsigned BFD_HOST_64_BIT Nlm64_Addr; -typedef unsigned BFD_HOST_64_BIT Nlm64_Off; -typedef BFD_HOST_64_BIT Nlm64_Sxword; -typedef unsigned BFD_HOST_64_BIT Nlm64_Xword; -#endif -typedef long Nlm64_Sword; -typedef unsigned long Nlm64_Word; -typedef unsigned short Nlm64_Half; - -#endif /* 0 */ - -/* This structure contains the internal form of the portion of the NLM - header that is fixed length. */ - -typedef struct nlm_internal_fixed_header -{ - /* The signature field identifies the file as an NLM. It must contain - the signature string, which depends upon the NLM target. */ - - char signature[NLM_SIGNATURE_SIZE]; - - /* The version of the header. At this time, the highest version number - is 4. */ - - long version; - - /* The name of the module, which must be a DOS name (1-8 characters followed - by a period and a 1-3 character extension. The first byte is the byte - length of the name and the last byte is a null terminator byte. This - field is fixed length, and any unused bytes should be null bytes. The - value is set by the OUTPUT keyword to NLMLINK. */ - - char moduleName[NLM_MODULE_NAME_SIZE]; - - /* The byte offset of the code image from the start of the file. */ - - file_ptr codeImageOffset; - - /* The size of the code image, in bytes. */ - - bfd_size_type codeImageSize; - - /* The byte offset of the data image from the start of the file. */ - - file_ptr dataImageOffset; - - /* The size of the data image, in bytes. */ - - bfd_size_type dataImageSize; - - /* The size of the uninitialized data region that the loader is to be - allocated at load time. Uninitialized data follows the initialized - data in the NLM address space. */ - - bfd_size_type uninitializedDataSize; - - /* The byte offset of the custom data from the start of the file. The - custom data is set by the CUSTOM keyword to NLMLINK. */ - - file_ptr customDataOffset; - - /* The size of the custom data, in bytes. */ - - bfd_size_type customDataSize; - - /* The byte offset of the module dependencies from the start of the file. - The module dependencies are determined by the MODULE keyword in - NLMLINK. */ - - file_ptr moduleDependencyOffset; - - /* The number of module dependencies at the moduleDependencyOffset. */ - - long numberOfModuleDependencies; - - /* The byte offset of the relocation fixup data from the start of the file */ - - file_ptr relocationFixupOffset; - long numberOfRelocationFixups; - file_ptr externalReferencesOffset; - long numberOfExternalReferences; - file_ptr publicsOffset; - long numberOfPublics; - file_ptr debugInfoOffset; - long numberOfDebugRecords; - file_ptr codeStartOffset; - file_ptr exitProcedureOffset; - file_ptr checkUnloadProcedureOffset; - long moduleType; - long flags; -} Nlm_Internal_Fixed_Header; - -#define nlm32_internal_fixed_header nlm_internal_fixed_header -#define Nlm32_Internal_Fixed_Header Nlm_Internal_Fixed_Header -#define nlm64_internal_fixed_header nlm_internal_fixed_header -#define Nlm64_Internal_Fixed_Header Nlm_Internal_Fixed_Header - -/* This structure contains the portions of the NLM header that are either - variable in size in the external representation, or else are not at a - fixed offset relative to the start of the NLM header due to preceding - variable sized fields. - - Note that all the fields must exist in the external header, and in - the order used here (the same order is used in the internal form - for consistency, not out of necessity). */ - -typedef struct nlm_internal_variable_header -{ - - /* The descriptionLength field contains the length of the text in - descriptionText, excluding the null terminator. The descriptionText - field contains the NLM description obtained from the DESCRIPTION - keyword in NLMLINK plus the null byte terminator. The descriptionText - can be up to NLM_MAX_DESCRIPTION_LENGTH characters. */ - - unsigned char descriptionLength; - char descriptionText[NLM_MAX_DESCRIPTION_LENGTH + 1]; - - /* The stackSize field contains the size of the stack in bytes, as - specified by the STACK or STACKSIZE keyword in NLMLINK. If no size - is specified, the default is NLM_DEFAULT_STACKSIZE. */ - - long stackSize; - - /* The reserved field is included only for completeness. It should contain - zero. */ - - long reserved; - - /* This field is fixed length, should contain " LONG" (note leading - space), and is unused. */ - - char oldThreadName[NLM_OLD_THREAD_NAME_LENGTH]; - - /* The screenNameLength field contains the length of the actual text stored - in the screenName field, excluding the null byte terminator. The - screenName field contains the screen name as specified by the SCREENNAME - keyword in NLMLINK, and can be up to NLM_MAX_SCREEN_NAME_LENGTH - characters. */ - - unsigned char screenNameLength; - char screenName[NLM_MAX_SCREEN_NAME_LENGTH + 1]; - - /* The threadNameLength field contains the length of the actual text stored - in the threadName field, excluding the null byte terminator. The - threadName field contains the thread name as specified by the THREADNAME - keyword in NLMLINK, and can be up to NLM_MAX_THREAD_NAME_LENGTH - characters. */ - - unsigned char threadNameLength; - char threadName[NLM_MAX_THREAD_NAME_LENGTH + 1]; - -} Nlm_Internal_Variable_Header; - -#define nlm32_internal_variable_header nlm_internal_variable_header -#define Nlm32_Internal_Variable_Header Nlm_Internal_Variable_Header -#define nlm64_internal_variable_header nlm_internal_variable_header -#define Nlm64_Internal_Variable_Header Nlm_Internal_Variable_Header - -/* The version header is one of the optional auxiliary headers and - follows the fixed length and variable length NLM headers. */ - -typedef struct nlm_internal_version_header -{ - /* The header is recognized by "VeRsIoN#" in the stamp field. */ - char stamp[8]; - long majorVersion; - long minorVersion; - long revision; - long year; - long month; - long day; -} Nlm_Internal_Version_Header; - -#define nlm32_internal_version_header nlm_internal_version_header -#define Nlm32_Internal_Version_Header Nlm_Internal_Version_Header -#define nlm64_internal_version_header nlm_internal_version_header -#define Nlm64_Internal_Version_Header Nlm_Internal_Version_Header - -typedef struct nlm_internal_copyright_header -{ - /* The header is recognized by "CoPyRiGhT=" in the stamp field. */ - char stamp[10]; - unsigned char copyrightMessageLength; - char copyrightMessage[NLM_MAX_COPYRIGHT_MESSAGE_LENGTH]; -} Nlm_Internal_Copyright_Header; - -#define nlm32_internal_copyright_header nlm_internal_copyright_header -#define Nlm32_Internal_Copyright_Header Nlm_Internal_Copyright_Header -#define nlm64_internal_copyright_header nlm_internal_copyright_header -#define Nlm64_Internal_Copyright_Header Nlm_Internal_Copyright_Header - -typedef struct nlm_internal_extended_header -{ - /* The header is recognized by "MeSsAgEs" in the stamp field. */ - char stamp[8]; - long languageID; - file_ptr messageFileOffset; - bfd_size_type messageFileLength; - long messageCount; - file_ptr helpFileOffset; - bfd_size_type helpFileLength; - file_ptr RPCDataOffset; - bfd_size_type RPCDataLength; - file_ptr sharedCodeOffset; - bfd_size_type sharedCodeLength; - file_ptr sharedDataOffset; - bfd_size_type sharedDataLength; - file_ptr sharedRelocationFixupOffset; - long sharedRelocationFixupCount; - file_ptr sharedExternalReferenceOffset; - long sharedExternalReferenceCount; - file_ptr sharedPublicsOffset; - long sharedPublicsCount; - file_ptr sharedDebugRecordOffset; - long sharedDebugRecordCount; - bfd_vma SharedInitializationOffset; - bfd_vma SharedExitProcedureOffset; - long productID; - long reserved0; - long reserved1; - long reserved2; - long reserved3; - long reserved4; - long reserved5; -} Nlm_Internal_Extended_Header; - -#define nlm32_internal_extended_header nlm_internal_extended_header -#define Nlm32_Internal_Extended_Header Nlm_Internal_Extended_Header -#define nlm64_internal_extended_header nlm_internal_extended_header -#define Nlm64_Internal_Extended_Header Nlm_Internal_Extended_Header - -/* The format of a custom header as stored internally is different - from the external format. This is how we store a custom header - which we do not recognize. */ - -typedef struct nlm_internal_custom_header -{ - /* The header is recognized by "CuStHeAd" in the stamp field. */ - char stamp[8]; - bfd_size_type hdrLength; - file_ptr dataOffset; - bfd_size_type dataLength; - char dataStamp[8]; - PTR hdr; -} Nlm_Internal_Custom_Header; - -#define nlm32_internal_custom_header nlm_internal_custom_header -#define Nlm32_Internal_Custom_Header Nlm_Internal_Custom_Header -#define nlm64_internal_custom_header nlm_internal_custom_header -#define Nlm64_Internal_Custom_Header Nlm_Internal_Custom_Header - -/* The internal Cygnus header is written out externally as a custom - header. We don't try to replicate that structure here. */ - -typedef struct nlm_internal_cygnus_ext_header -{ - /* The header is recognized by "CyGnUsEx" in the stamp field. */ - char stamp[8]; - /* File location of debugging information. */ - file_ptr offset; - /* Length of debugging information. */ - bfd_size_type length; -} Nlm_Internal_Cygnus_Ext_Header; - -#define nlm32_internal_cygnus_ext_header nlm_internal_cygnus_ext_header -#define Nlm32_Internal_Cygnus_Ext_Header Nlm_Internal_Cygnus_Ext_Header -#define nlm64_internal_cygnus_ext_header nlm_internal_cygnus_ext_header -#define Nlm64_Internal_Cygnus_Ext_Header Nlm_Internal_Cygnus_Ext_Header diff --git a/contrib/gdb/include/nlm/ppc-ext.h b/contrib/gdb/include/nlm/ppc-ext.h deleted file mode 100644 index 0aae107..0000000 --- a/contrib/gdb/include/nlm/ppc-ext.h +++ /dev/null @@ -1,163 +0,0 @@ -/* PowerPC NLM (NetWare Loadable Module) support for BFD. - Copyright (C) 1994 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. */ - -#ifdef OLDFORMAT - -/* The format of a PowerPC NLM changed. These structures are only - used in the old format. */ - -/* A PowerPC NLM starts with an instance of this structure. */ - -struct nlm32_powerpc_external_prefix_header -{ - /* Signature. Must be "AppleNLM". */ - char signature[8]; - /* Version number. Current value is 1. */ - unsigned char headerVersion[4]; - /* ??. Should be set to 0. */ - unsigned char origins[4]; - /* File creation date in standard Unix time format (seconds since - 1/1/70). */ - unsigned char date[4]; -}; - -#define NLM32_POWERPC_SIGNATURE "AppleNLM" -#define NLM32_POWERPC_HEADER_VERSION 1 - -/* The external format of a PowerPC NLM reloc. This is the same as an - XCOFF dynamic reloc. */ - -struct nlm32_powerpc_external_reloc -{ - /* Address. */ - unsigned char l_vaddr[4]; - /* Symbol table index. This is 0 for .text and 1 for .data. 2 - means .bss, but I don't know if it is used. In XCOFF, larger - numbers are indices into the dynamic symbol table, but they are - presumably not used in an NLM. */ - unsigned char l_symndx[4]; - /* Relocation type. */ - unsigned char l_rtype[2]; - /* Section number being relocated. */ - unsigned char l_rsecnm[2]; -}; - -#endif /* OLDFORMAT */ - -/* The external format of the fixed header. */ - -typedef struct nlm32_powerpc_external_fixed_header -{ - - /* The signature field identifies the file as an NLM. It must contain - the signature string, which depends upon the NLM target. */ - - unsigned char signature[24]; - - /* The version of the header. At this time, the highest version number - is 4. */ - - unsigned char version[4]; - - /* The name of the module, which must be a DOS name (1-8 characters followed - by a period and a 1-3 character extension). The first byte is the byte - length of the name and the last byte is a null terminator byte. This - field is fixed length, and any unused bytes should be null bytes. The - value is set by the OUTPUT keyword to NLMLINK. */ - - unsigned char moduleName[14]; - - /* Padding to make it come out correct. */ - - unsigned char pad1[2]; - - /* The byte offset of the code image from the start of the file. */ - - unsigned char codeImageOffset[4]; - - /* The size of the code image, in bytes. */ - - unsigned char codeImageSize[4]; - - /* The byte offset of the data image from the start of the file. */ - - unsigned char dataImageOffset[4]; - - /* The size of the data image, in bytes. */ - - unsigned char dataImageSize[4]; - - /* The size of the uninitialized data region that the loader is to be - allocated at load time. Uninitialized data follows the initialized - data in the NLM address space. */ - - unsigned char uninitializedDataSize[4]; - - /* The byte offset of the custom data from the start of the file. The - custom data is set by the CUSTOM keyword to NLMLINK. It is possible - for this to be EOF if there is no custom data. */ - - unsigned char customDataOffset[4]; - - /* The size of the custom data, in bytes. */ - - unsigned char customDataSize[4]; - - /* The byte offset of the module dependencies from the start of the file. - The module dependencies are determined by the MODULE keyword in - NLMLINK. */ - - unsigned char moduleDependencyOffset[4]; - - /* The number of module dependencies at the moduleDependencyOffset. */ - - unsigned char numberOfModuleDependencies[4]; - - /* The byte offset of the relocation fixup data from the start of the file */ - - unsigned char relocationFixupOffset[4]; - - unsigned char numberOfRelocationFixups[4]; - - unsigned char externalReferencesOffset[4]; - - unsigned char numberOfExternalReferences[4]; - - unsigned char publicsOffset[4]; - - unsigned char numberOfPublics[4]; - - /* The byte offset of the internal debug info from the start of the file. - It is possible for this to be EOF if there is no debug info. */ - - unsigned char debugInfoOffset[4]; - - unsigned char numberOfDebugRecords[4]; - - unsigned char codeStartOffset[4]; - - unsigned char exitProcedureOffset[4]; - - unsigned char checkUnloadProcedureOffset[4]; - - unsigned char moduleType[4]; - - unsigned char flags[4]; - -} Nlm32_powerpc_External_Fixed_Header; diff --git a/contrib/gdb/include/nlm/sparc32-ext.h b/contrib/gdb/include/nlm/sparc32-ext.h deleted file mode 100644 index 0deb2de..0000000 --- a/contrib/gdb/include/nlm/sparc32-ext.h +++ /dev/null @@ -1,120 +0,0 @@ -/* SPARC NLM (NetWare Loadable Module) support for BFD. - Copyright (C) 1993 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. */ - -/* The external format of the fixed header. */ - -typedef struct nlm32_sparc_external_fixed_header -{ - - /* The signature field identifies the file as an NLM. It must contain - the signature string, which depends upon the NLM target. */ - - unsigned char signature[24]; - - /* The version of the header. At this time, the highest version number - is 4. */ - - unsigned char version[4]; - - /* The name of the module, which must be a DOS name (1-8 characters followed - by a period and a 1-3 character extension). The first byte is the byte - length of the name and the last byte is a null terminator byte. This - field is fixed length, and any unused bytes should be null bytes. The - value is set by the OUTPUT keyword to NLMLINK. */ - - unsigned char moduleName[14]; - - /* Padding to make it come out correct. */ - - unsigned char pad1[2]; - - /* The byte offset of the code image from the start of the file. */ - - unsigned char codeImageOffset[4]; - - /* The size of the code image, in bytes. */ - - unsigned char codeImageSize[4]; - - /* The byte offset of the data image from the start of the file. */ - - unsigned char dataImageOffset[4]; - - /* The size of the data image, in bytes. */ - - unsigned char dataImageSize[4]; - - /* The size of the uninitialized data region that the loader is to be - allocated at load time. Uninitialized data follows the initialized - data in the NLM address space. */ - - unsigned char uninitializedDataSize[4]; - - /* The byte offset of the custom data from the start of the file. The - custom data is set by the CUSTOM keyword to NLMLINK. It is possible - for this to be EOF if there is no custom data. */ - - unsigned char customDataOffset[4]; - - /* The size of the custom data, in bytes. */ - - unsigned char customDataSize[4]; - - /* The byte offset of the module dependencies from the start of the file. - The module dependencies are determined by the MODULE keyword in - NLMLINK. */ - - unsigned char moduleDependencyOffset[4]; - - /* The number of module dependencies at the moduleDependencyOffset. */ - - unsigned char numberOfModuleDependencies[4]; - - /* The byte offset of the relocation fixup data from the start of the file */ - - unsigned char relocationFixupOffset[4]; - - unsigned char numberOfRelocationFixups[4]; - - unsigned char externalReferencesOffset[4]; - - unsigned char numberOfExternalReferences[4]; - - unsigned char publicsOffset[4]; - - unsigned char numberOfPublics[4]; - - /* The byte offset of the internal debug info from the start of the file. - It is possible for this to be EOF if there is no debug info. */ - - unsigned char debugInfoOffset[4]; - - unsigned char numberOfDebugRecords[4]; - - unsigned char codeStartOffset[4]; - - unsigned char exitProcedureOffset[4]; - - unsigned char checkUnloadProcedureOffset[4]; - - unsigned char moduleType[4]; - - unsigned char flags[4]; - -} Nlm32_sparc_External_Fixed_Header; diff --git a/contrib/gdb/include/oasys.h b/contrib/gdb/include/oasys.h deleted file mode 100644 index 867d250..0000000 --- a/contrib/gdb/include/oasys.h +++ /dev/null @@ -1,152 +0,0 @@ -/* Oasys object format header file for BFD. - Contributed by Cygnus Support. */ - -#define OASYS_MAX_SEC_COUNT 16 -/* **** */ - -typedef struct oasys_archive_header { - unsigned int version; - char create_date[12]; - char revision_date[12]; - unsigned int mod_count; - file_ptr mod_tbl_offset; - unsigned int sym_tbl_size; - unsigned int sym_count; - file_ptr sym_tbl_offset; - unsigned int xref_count; - file_ptr xref_lst_offset; -} oasys_archive_header_type; - -typedef struct oasys_extarchive_header { - bfd_byte version[4]; - bfd_byte create_date[12]; - bfd_byte revision_date[12]; - bfd_byte mod_count[4]; - bfd_byte mod_tbl_offset[4]; - bfd_byte sym_tbl_size[4]; - bfd_byte sym_count[4]; - bfd_byte sym_tbl_offset[4]; - bfd_byte xref_count[4]; - bfd_byte xref_lst_offset[4]; -} oasys_extarchive_header_type; - -typedef struct oasys_module_table { - int mod_number; - char mod_date[12]; - unsigned int mod_size; - unsigned int dep_count; - unsigned int depee_count; - file_ptr file_offset; - unsigned int sect_count; - char *module_name; - unsigned int module_name_size; -} oasys_module_table_type; - - -typedef struct oasys_extmodule_table_a { - bfd_byte mod_number[4]; - bfd_byte mod_date[12]; - bfd_byte mod_size[4]; - bfd_byte dep_count[4]; - bfd_byte depee_count[4]; - bfd_byte sect_count[4]; - bfd_byte file_offset[4]; - bfd_byte mod_name[32]; -} oasys_extmodule_table_type_a_type; - -typedef struct oasys_extmodule_table_b { - bfd_byte mod_number[4]; - bfd_byte mod_date[12]; - bfd_byte mod_size[4]; - bfd_byte dep_count[4]; - bfd_byte depee_count[4]; - bfd_byte sect_count[4]; - bfd_byte file_offset[4]; - bfd_byte mod_name_length[4]; -} oasys_extmodule_table_type_b_type; - - -typedef enum oasys_record { - oasys_record_is_end_enum = 0, - oasys_record_is_data_enum = 1, - oasys_record_is_symbol_enum = 2, - oasys_record_is_header_enum = 3, - oasys_record_is_named_section_enum = 4, - oasys_record_is_com_enum = 5, - oasys_record_is_debug_enum = 6, - oasys_record_is_section_enum = 7, - oasys_record_is_debug_file_enum = 8, - oasys_record_is_module_enum = 9, - oasys_record_is_local_enum = 10 -} oasys_record_enum_type; - - - -typedef struct oasys_record_header { - unsigned char length; - unsigned char check_sum; - unsigned char type; - unsigned char fill; -} oasys_record_header_type; - -typedef struct oasys_data_record { - oasys_record_header_type header; - unsigned char relb; - bfd_byte addr[4]; - /* maximum total size of data record is 255 bytes */ - bfd_byte data[246]; -} oasys_data_record_type; - -typedef struct oasys_header_record { - oasys_record_header_type header; - unsigned char version_number; - unsigned char rev_number; - char module_name[26-6]; - char description[64-26]; -} oasys_header_record_type; - -#define OASYS_VERSION_NUMBER 0 -#define OASYS_REV_NUMBER 0 - -typedef struct oasys_symbol_record { - oasys_record_header_type header; - unsigned char relb; - bfd_byte value[4]; - bfd_byte refno[2]; - char name[64]; -} oasys_symbol_record_type; - -#define RELOCATION_PCREL_BIT 0x80 -#define RELOCATION_32BIT_BIT 0x40 -#define RELOCATION_TYPE_BITS 0x30 -#define RELOCATION_TYPE_ABS 0x00 -#define RELOCATION_TYPE_REL 0x10 -#define RELOCATION_TYPE_UND 0x20 -#define RELOCATION_TYPE_COM 0x30 -#define RELOCATION_SECT_BITS 0x0f - -typedef struct oasys_section_record { - oasys_record_header_type header; - unsigned char relb; - bfd_byte value[4]; - bfd_byte vma[4]; - bfd_byte fill[3]; -} oasys_section_record_type; - -typedef struct oasys_end_record { - oasys_record_header_type header; - unsigned char relb; - bfd_byte entry[4]; - bfd_byte fill[2]; - bfd_byte zero; -} oasys_end_record_type; - -typedef union oasys_record_union { - oasys_record_header_type header; - oasys_data_record_type data; - oasys_section_record_type section; - oasys_symbol_record_type symbol; - oasys_header_record_type first; - oasys_end_record_type end; - bfd_byte pad[256]; -} oasys_record_union_type; diff --git a/contrib/gdb/include/obstack.h b/contrib/gdb/include/obstack.h deleted file mode 100644 index 416b8bf..0000000 --- a/contrib/gdb/include/obstack.h +++ /dev/null @@ -1,518 +0,0 @@ -/* obstack.h - object stack macros - Copyright (C) 1988, 89, 90, 91, 92, 93, 94, 95, 96 Free Software Foundation, Inc. - -This program is free software; you can redistribute it and/or modify it -under the terms of the GNU Library 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 Library General Public License for more details. - -You should have received a copy of the GNU Library General Public License -along with this program; if not, write to the Free Software -Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -/* Summary: - -All the apparent functions defined here are macros. The idea -is that you would use these pre-tested macros to solve a -very specific set of problems, and they would run fast. -Caution: no side-effects in arguments please!! They may be -evaluated MANY times!! - -These macros operate a stack of objects. Each object starts life -small, and may grow to maturity. (Consider building a word syllable -by syllable.) An object can move while it is growing. Once it has -been "finished" it never changes address again. So the "top of the -stack" is typically an immature growing object, while the rest of the -stack is of mature, fixed size and fixed address objects. - -These routines grab large chunks of memory, using a function you -supply, called `obstack_chunk_alloc'. On occasion, they free chunks, -by calling `obstack_chunk_free'. You must define them and declare -them before using any obstack macros. - -Each independent stack is represented by a `struct obstack'. -Each of the obstack macros expects a pointer to such a structure -as the first argument. - -One motivation for this package is the problem of growing char strings -in symbol tables. Unless you are "fascist pig with a read-only mind" ---Gosper's immortal quote from HAKMEM item 154, out of context--you -would not like to put any arbitrary upper limit on the length of your -symbols. - -In practice this often means you will build many short symbols and a -few long symbols. At the time you are reading a symbol you don't know -how long it is. One traditional method is to read a symbol into a -buffer, realloc()ating the buffer every time you try to read a symbol -that is longer than the buffer. This is beaut, but you still will -want to copy the symbol from the buffer to a more permanent -symbol-table entry say about half the time. - -With obstacks, you can work differently. Use one obstack for all symbol -names. As you read a symbol, grow the name in the obstack gradually. -When the name is complete, finalize it. Then, if the symbol exists already, -free the newly read name. - -The way we do this is to take a large chunk, allocating memory from -low addresses. When you want to build a symbol in the chunk you just -add chars above the current "high water mark" in the chunk. When you -have finished adding chars, because you got to the end of the symbol, -you know how long the chars are, and you can create a new object. -Mostly the chars will not burst over the highest address of the chunk, -because you would typically expect a chunk to be (say) 100 times as -long as an average object. - -In case that isn't clear, when we have enough chars to make up -the object, THEY ARE ALREADY CONTIGUOUS IN THE CHUNK (guaranteed) -so we just point to it where it lies. No moving of chars is -needed and this is the second win: potentially long strings need -never be explicitly shuffled. Once an object is formed, it does not -change its address during its lifetime. - -When the chars burst over a chunk boundary, we allocate a larger -chunk, and then copy the partly formed object from the end of the old -chunk to the beginning of the new larger chunk. We then carry on -accreting characters to the end of the object as we normally would. - -A special macro is provided to add a single char at a time to a -growing object. This allows the use of register variables, which -break the ordinary 'growth' macro. - -Summary: - We allocate large chunks. - We carve out one object at a time from the current chunk. - Once carved, an object never moves. - We are free to append data of any size to the currently - growing object. - Exactly one object is growing in an obstack at any one time. - You can run one obstack per control block. - You may have as many control blocks as you dare. - Because of the way we do it, you can `unwind' an obstack - back to a previous state. (You may remove objects much - as you would with a stack.) -*/ - - -/* Don't do the contents of this file more than once. */ - -#ifndef __OBSTACK_H__ -#define __OBSTACK_H__ - -/* We use subtraction of (char *)0 instead of casting to int - because on word-addressable machines a simple cast to int - may ignore the byte-within-word field of the pointer. */ - -#ifndef __PTR_TO_INT -#define __PTR_TO_INT(P) ((P) - (char *)0) -#endif - -#ifndef __INT_TO_PTR -#define __INT_TO_PTR(P) ((P) + (char *)0) -#endif - -/* We need the type of the resulting object. In ANSI C it is ptrdiff_t - but in traditional C it is usually long. If we are in ANSI C and - don't already have ptrdiff_t get it. */ - -#if defined (__STDC__) && ! defined (offsetof) -#if defined (__GNUC__) && defined (IN_GCC) -/* On Next machine, the system's stddef.h screws up if included - after we have defined just ptrdiff_t, so include all of stddef.h. - Otherwise, define just ptrdiff_t, which is all we need. */ -#ifndef __NeXT__ -#define __need_ptrdiff_t -#endif -#endif - -#include -#endif - -#ifdef __STDC__ -#define PTR_INT_TYPE ptrdiff_t -#else -#define PTR_INT_TYPE long -#endif - -struct _obstack_chunk /* Lives at front of each chunk. */ -{ - char *limit; /* 1 past end of this chunk */ - struct _obstack_chunk *prev; /* address of prior chunk or NULL */ - char contents[4]; /* objects begin here */ -}; - -struct obstack /* control current object in current chunk */ -{ - long chunk_size; /* preferred size to allocate chunks in */ - struct _obstack_chunk* chunk; /* address of current struct obstack_chunk */ - char *object_base; /* address of object we are building */ - char *next_free; /* where to add next char to current object */ - char *chunk_limit; /* address of char after current chunk */ - PTR_INT_TYPE temp; /* Temporary for some macros. */ - int alignment_mask; /* Mask of alignment for each object. */ - struct _obstack_chunk *(*chunkfun) (); /* User's fcn to allocate a chunk. */ - void (*freefun) (); /* User's function to free a chunk. */ - char *extra_arg; /* first arg for chunk alloc/dealloc funcs */ - unsigned use_extra_arg:1; /* chunk alloc/dealloc funcs take extra arg */ - unsigned maybe_empty_object:1;/* There is a possibility that the current - chunk contains a zero-length object. This - prevents freeing the chunk if we allocate - a bigger chunk to replace it. */ - unsigned alloc_failed:1; /* chunk alloc func returned 0 */ -}; - -/* Declare the external functions we use; they are in obstack.c. */ - -#ifdef __STDC__ -extern void _obstack_newchunk (struct obstack *, int); -extern void _obstack_free (struct obstack *, void *); -extern int _obstack_begin (struct obstack *, int, int, - void *(*) (), void (*) ()); -extern int _obstack_begin_1 (struct obstack *, int, int, - void *(*) (), void (*) (), void *); -extern int _obstack_memory_used (struct obstack *); -#else -extern void _obstack_newchunk (); -extern void _obstack_free (); -extern int _obstack_begin (); -extern int _obstack_begin_1 (); -extern int _obstack_memory_used (); -#endif - -#ifdef __STDC__ - -/* Do the function-declarations after the structs - but before defining the macros. */ - -void obstack_init (struct obstack *obstack); - -void * obstack_alloc (struct obstack *obstack, int size); - -void * obstack_copy (struct obstack *obstack, void *address, int size); -void * obstack_copy0 (struct obstack *obstack, void *address, int size); - -void obstack_free (struct obstack *obstack, void *block); - -void obstack_blank (struct obstack *obstack, int size); - -void obstack_grow (struct obstack *obstack, void *data, int size); -void obstack_grow0 (struct obstack *obstack, void *data, int size); - -void obstack_1grow (struct obstack *obstack, int data_char); -void obstack_ptr_grow (struct obstack *obstack, void *data); -void obstack_int_grow (struct obstack *obstack, int data); - -void * obstack_finish (struct obstack *obstack); - -int obstack_object_size (struct obstack *obstack); - -int obstack_room (struct obstack *obstack); -void obstack_1grow_fast (struct obstack *obstack, int data_char); -void obstack_ptr_grow_fast (struct obstack *obstack, void *data); -void obstack_int_grow_fast (struct obstack *obstack, int data); -void obstack_blank_fast (struct obstack *obstack, int size); - -void * obstack_base (struct obstack *obstack); -void * obstack_next_free (struct obstack *obstack); -int obstack_alignment_mask (struct obstack *obstack); -int obstack_chunk_size (struct obstack *obstack); -int obstack_memory_used (struct obstack *obstack); - -#endif /* __STDC__ */ - -/* Non-ANSI C cannot really support alternative functions for these macros, - so we do not declare them. */ - -/* Pointer to beginning of object being allocated or to be allocated next. - Note that this might not be the final address of the object - because a new chunk might be needed to hold the final size. */ - -#define obstack_base(h) ((h)->alloc_failed ? 0 : (h)->object_base) - -/* Size for allocating ordinary chunks. */ - -#define obstack_chunk_size(h) ((h)->chunk_size) - -/* Pointer to next byte not yet allocated in current chunk. */ - -#define obstack_next_free(h) ((h)->alloc_failed ? 0 : (h)->next_free) - -/* Mask specifying low bits that should be clear in address of an object. */ - -#define obstack_alignment_mask(h) ((h)->alignment_mask) - -#define obstack_init(h) \ - _obstack_begin ((h), 0, 0, \ - (void *(*) ()) obstack_chunk_alloc, (void (*) ()) obstack_chunk_free) - -#define obstack_begin(h, size) \ - _obstack_begin ((h), (size), 0, \ - (void *(*) ()) obstack_chunk_alloc, (void (*) ()) obstack_chunk_free) - -#define obstack_specify_allocation(h, size, alignment, chunkfun, freefun) \ - _obstack_begin ((h), (size), (alignment), \ - (void *(*) ()) (chunkfun), (void (*) ()) (freefun)) - -#define obstack_specify_allocation_with_arg(h, size, alignment, chunkfun, freefun, arg) \ - _obstack_begin_1 ((h), (size), (alignment), \ - (void *(*) ()) (chunkfun), (void (*) ()) (freefun), (arg)) - -#define obstack_chunkfun(h, newchunkfun) \ - ((h) -> chunkfun = (struct _obstack_chunk *(*)()) (newchunkfun)) - -#define obstack_freefun(h, newfreefun) \ - ((h) -> freefun = (void (*)()) (newfreefun)) - -#define obstack_1grow_fast(h,achar) (*((h)->next_free)++ = achar) - -#define obstack_blank_fast(h,n) ((h)->next_free += (n)) - -#define obstack_memory_used(h) _obstack_memory_used (h) - -#if defined (__GNUC__) && defined (__STDC__) -#if __GNUC__ < 2 -#define __extension__ -#endif - -/* For GNU C, if not -traditional, - we can define these macros to compute all args only once - without using a global variable. - Also, we can avoid using the `temp' slot, to make faster code. */ - -#define obstack_object_size(OBSTACK) \ - __extension__ \ - ({ struct obstack *__o = (OBSTACK); \ - __o->alloc_failed ? 0 : \ - (unsigned) (__o->next_free - __o->object_base); }) - -#define obstack_room(OBSTACK) \ - __extension__ \ - ({ struct obstack *__o = (OBSTACK); \ - (unsigned) (__o->chunk_limit - __o->next_free); }) - -#define obstack_grow(OBSTACK,where,length) \ -__extension__ \ -({ struct obstack *__o = (OBSTACK); \ - int __len = (length); \ - if (__o->next_free + __len > __o->chunk_limit) \ - _obstack_newchunk (__o, __len); \ - if (!__o->alloc_failed) \ - { \ - bcopy (where, __o->next_free, __len); \ - __o->next_free += __len; \ - } \ - (void) 0; }) - -#define obstack_grow0(OBSTACK,where,length) \ -__extension__ \ -({ struct obstack *__o = (OBSTACK); \ - int __len = (length); \ - if (__o->next_free + __len + 1 > __o->chunk_limit) \ - _obstack_newchunk (__o, __len + 1); \ - if (!__o->alloc_failed) \ - { \ - bcopy (where, __o->next_free, __len); \ - __o->next_free += __len; \ - *(__o->next_free)++ = 0; \ - } \ - (void) 0; }) - -#define obstack_1grow(OBSTACK,datum) \ -__extension__ \ -({ struct obstack *__o = (OBSTACK); \ - if (__o->next_free + 1 > __o->chunk_limit) \ - _obstack_newchunk (__o, 1); \ - if (!__o->alloc_failed) \ - *(__o->next_free)++ = (datum); \ - (void) 0; }) - -/* These assume that the obstack alignment is good enough for pointers or ints, - and that the data added so far to the current object - shares that much alignment. */ - -#define obstack_ptr_grow(OBSTACK,datum) \ -__extension__ \ -({ struct obstack *__o = (OBSTACK); \ - if (__o->next_free + sizeof (void *) > __o->chunk_limit) \ - _obstack_newchunk (__o, sizeof (void *)); \ - if (!__o->alloc_failed) \ - *((void **)__o->next_free)++ = ((void *)datum); \ - (void) 0; }) - -#define obstack_int_grow(OBSTACK,datum) \ -__extension__ \ -({ struct obstack *__o = (OBSTACK); \ - if (__o->next_free + sizeof (int) > __o->chunk_limit) \ - _obstack_newchunk (__o, sizeof (int)); \ - if (!__o->alloc_failed) \ - *((int *)__o->next_free)++ = ((int)datum); \ - (void) 0; }) - -#define obstack_ptr_grow_fast(h,aptr) (*((void **)(h)->next_free)++ = (void *)aptr) -#define obstack_int_grow_fast(h,aint) (*((int *)(h)->next_free)++ = (int)aint) - -#define obstack_blank(OBSTACK,length) \ -__extension__ \ -({ struct obstack *__o = (OBSTACK); \ - int __len = (length); \ - if (__o->chunk_limit - __o->next_free < __len) \ - _obstack_newchunk (__o, __len); \ - if (!__o->alloc_failed) \ - __o->next_free += __len; \ - (void) 0; }) - -#define obstack_alloc(OBSTACK,length) \ -__extension__ \ -({ struct obstack *__h = (OBSTACK); \ - obstack_blank (__h, (length)); \ - obstack_finish (__h); }) - -#define obstack_copy(OBSTACK,where,length) \ -__extension__ \ -({ struct obstack *__h = (OBSTACK); \ - obstack_grow (__h, (where), (length)); \ - obstack_finish (__h); }) - -#define obstack_copy0(OBSTACK,where,length) \ -__extension__ \ -({ struct obstack *__h = (OBSTACK); \ - obstack_grow0 (__h, (where), (length)); \ - obstack_finish (__h); }) - -/* The local variable is named __o1 to avoid a name conflict - when obstack_blank is called. */ -#define obstack_finish(OBSTACK) \ -__extension__ \ -({ struct obstack *__o1 = (OBSTACK); \ - void *value; \ - if (__o1->alloc_failed) \ - value = 0; \ - else \ - { \ - value = (void *) __o1->object_base; \ - if (__o1->next_free == value) \ - __o1->maybe_empty_object = 1; \ - __o1->next_free \ - = __INT_TO_PTR ((__PTR_TO_INT (__o1->next_free)+__o1->alignment_mask)\ - & ~ (__o1->alignment_mask)); \ - if (__o1->next_free - (char *)__o1->chunk \ - > __o1->chunk_limit - (char *)__o1->chunk) \ - __o1->next_free = __o1->chunk_limit; \ - __o1->object_base = __o1->next_free; \ - } \ - value; }) - -#define obstack_free(OBSTACK, OBJ) \ -__extension__ \ -({ struct obstack *__o = (OBSTACK); \ - void *__obj = (OBJ); \ - if (__obj > (void *)__o->chunk && __obj < (void *)__o->chunk_limit) \ - __o->next_free = __o->object_base = __obj; \ - else (obstack_free) (__o, __obj); }) - -#else /* not __GNUC__ or not __STDC__ */ - -#define obstack_object_size(h) \ - (unsigned) ((h)->alloc_failed ? 0 : (h)->next_free - (h)->object_base) - -#define obstack_room(h) \ - (unsigned) ((h)->chunk_limit - (h)->next_free) - -/* Note that the call to _obstack_newchunk is enclosed in (..., 0) - so that we can avoid having void expressions - in the arms of the conditional expression. - Casting the third operand to void was tried before, - but some compilers won't accept it. */ - -#define obstack_grow(h,where,length) \ -( (h)->temp = (length), \ - (((h)->next_free + (h)->temp > (h)->chunk_limit) \ - ? (_obstack_newchunk ((h), (h)->temp), 0) : 0), \ - ((h)->alloc_failed ? 0 : \ - (bcopy (where, (h)->next_free, (h)->temp), \ - (h)->next_free += (h)->temp))) - -#define obstack_grow0(h,where,length) \ -( (h)->temp = (length), \ - (((h)->next_free + (h)->temp + 1 > (h)->chunk_limit) \ - ? (_obstack_newchunk ((h), (h)->temp + 1), 0) : 0), \ - ((h)->alloc_failed ? 0 : \ - (bcopy (where, (h)->next_free, (h)->temp), \ - (h)->next_free += (h)->temp, \ - *((h)->next_free)++ = 0))) - -#define obstack_1grow(h,datum) \ -( (((h)->next_free + 1 > (h)->chunk_limit) \ - ? (_obstack_newchunk ((h), 1), 0) : 0), \ - ((h)->alloc_failed ? 0 : \ - (*((h)->next_free)++ = (datum)))) - -#define obstack_ptr_grow(h,datum) \ -( (((h)->next_free + sizeof (char *) > (h)->chunk_limit) \ - ? (_obstack_newchunk ((h), sizeof (char *)), 0) : 0), \ - ((h)->alloc_failed ? 0 : \ - (*((char **)(((h)->next_free+=sizeof(char *))-sizeof(char *))) = ((char *)datum)))) - -#define obstack_int_grow(h,datum) \ -( (((h)->next_free + sizeof (int) > (h)->chunk_limit) \ - ? (_obstack_newchunk ((h), sizeof (int)), 0) : 0), \ - ((h)->alloc_failed ? 0 : \ - (*((int *)(((h)->next_free+=sizeof(int))-sizeof(int))) = ((int)datum)))) - -#define obstack_ptr_grow_fast(h,aptr) (*((char **)(h)->next_free)++ = (char *)aptr) -#define obstack_int_grow_fast(h,aint) (*((int *)(h)->next_free)++ = (int)aint) - -#define obstack_blank(h,length) \ -( (h)->temp = (length), \ - (((h)->chunk_limit - (h)->next_free < (h)->temp) \ - ? (_obstack_newchunk ((h), (h)->temp), 0) : 0), \ - ((h)->alloc_failed ? 0 : \ - ((h)->next_free += (h)->temp))) - -#define obstack_alloc(h,length) \ - (obstack_blank ((h), (length)), obstack_finish ((h))) - -#define obstack_copy(h,where,length) \ - (obstack_grow ((h), (where), (length)), obstack_finish ((h))) - -#define obstack_copy0(h,where,length) \ - (obstack_grow0 ((h), (where), (length)), obstack_finish ((h))) - -#define obstack_finish(h) \ -( (h)->alloc_failed ? 0 : \ - (((h)->next_free == (h)->object_base \ - ? (((h)->maybe_empty_object = 1), 0) \ - : 0), \ - (h)->temp = __PTR_TO_INT ((h)->object_base), \ - (h)->next_free \ - = __INT_TO_PTR ((__PTR_TO_INT ((h)->next_free)+(h)->alignment_mask) \ - & ~ ((h)->alignment_mask)), \ - (((h)->next_free - (char *)(h)->chunk \ - > (h)->chunk_limit - (char *)(h)->chunk) \ - ? ((h)->next_free = (h)->chunk_limit) : 0), \ - (h)->object_base = (h)->next_free, \ - __INT_TO_PTR ((h)->temp))) - -#ifdef __STDC__ -#define obstack_free(h,obj) \ -( (h)->temp = (char *)(obj) - (char *) (h)->chunk, \ - (((h)->temp > 0 && (h)->temp < (h)->chunk_limit - (char *) (h)->chunk)\ - ? (int) ((h)->next_free = (h)->object_base \ - = (h)->temp + (char *) (h)->chunk) \ - : (((obstack_free) ((h), (h)->temp + (char *) (h)->chunk), 0), 0))) -#else -#define obstack_free(h,obj) \ -( (h)->temp = (char *)(obj) - (char *) (h)->chunk, \ - (((h)->temp > 0 && (h)->temp < (h)->chunk_limit - (char *) (h)->chunk)\ - ? (int) ((h)->next_free = (h)->object_base \ - = (h)->temp + (char *) (h)->chunk) \ - : (_obstack_free ((h), (h)->temp + (char *) (h)->chunk), 0))) -#endif - -#endif /* not __GNUC__ or not __STDC__ */ - -#endif /* not __OBSTACK_H__ */ diff --git a/contrib/gdb/include/opcode/ChangeLog b/contrib/gdb/include/opcode/ChangeLog deleted file mode 100644 index f56df4b..0000000 --- a/contrib/gdb/include/opcode/ChangeLog +++ /dev/null @@ -1,812 +0,0 @@ -Thu Mar 7 15:08:23 1996 Doug Evans - - * sparc.h (O): Mark operand letter as in use. - -Tue Feb 20 20:46:21 1996 Doug Evans - - * sparc.h (sparc_{encode,decode}_sparclet_cpreg): Declare. - Mark operand letters uU as in use. - -Mon Feb 19 01:59:08 1996 Doug Evans - - * sparc.h (sparc_opcode_arch_val): Add SPARC_OPCODE_ARCH_SPARCLET. - (sparc_opcode_arch): Delete member `conflicts'. Add `supported'. - (SPARC_OPCODE_SUPPORTED): New macro. - (SPARC_OPCODE_CONFLICT_P): Rewrite. - (F_NOTV9): Delete. - -Fri Feb 16 12:23:34 1996 Jeffrey A Law (law@cygnus.com) - - * sparc.h (sparc_opcode_lookup_arch) Make return type in - declaration consistent with return type in definition. - -Wed Feb 14 18:14:11 1996 Alan Modra - - * i386.h (i386_optab): Remove Data32 from pushf and popf. - -Thu Feb 8 14:27:21 1996 James Carlson - - * i386.h (i386_regtab): Add 80486 test registers. - -Mon Feb 5 18:35:46 1996 Ian Lance Taylor - - * i960.h (I_HX): Define. - (i960_opcodes): Add HX instruction. - -Mon Jan 29 12:43:39 1996 Ken Raeburn - - * i386.h: Fix waiting forms of finit, fstenv, fsave, fstsw, fstcw, - and fclex. - -Wed Jan 24 22:36:59 1996 Doug Evans - - * sparc.h (enum sparc_opcode_arch_val): Replaces sparc_architecture. - (SPARC_OPCODE_CONFLICT_P): Renamed from ARCHITECTURES_CONFLICT_P. - (bfd_* defines): Delete. - (sparc_opcode_archs): Replaces architecture_pname. - (sparc_opcode_lookup_arch): Declare. - (NUMOPCODES): Delete. - -Mon Jan 22 08:24:32 1996 Doug Evans - - * sparc.h (enum sparc_architecture): Add v9a. - (ARCHITECTURES_CONFLICT_P): Update. - -Thu Dec 28 13:27:53 1995 John Hassey - - * i386.h: Added Pentium Pro instructions. - -Thu Nov 2 22:59:22 1995 Ian Lance Taylor - - * m68k.h: Document new 'W' operand place. - -Tue Oct 24 10:49:10 1995 Jeffrey A Law (law@cygnus.com) - - * hppa.h: Add lci and syncdma instructions. - -Mon Oct 23 11:09:16 1995 James G. Smith - - * mips.h: Added INSN_4100 flag to mark NEC VR4100 specific - instructions. - -Mon Oct 16 10:28:15 1995 Michael Meissner - - * ppc.h (PPC_OPCODE_{COMMON,ANY}): New opcode flags for - assembler's -mcom and -many switches. - -Wed Oct 11 16:56:33 1995 Ken Raeburn - - * i386.h: Fix cmpxchg8b extension opcode description. - -Thu Oct 5 18:03:36 1995 Ken Raeburn - - * i386.h: Add Pentium instructions wrmsr, rdtsc, rdmsr, cmpxchg8b, - and register cr4. - -Tue Sep 19 15:26:43 1995 Ian Lance Taylor - - * m68k.h: Change comment: split type P into types 0, 1 and 2. - -Wed Aug 30 13:50:55 1995 Doug Evans - - * sparc.h (sparc_{encode,decode}_prefetch): Declare. - -Tue Aug 29 15:34:58 1995 Doug Evans - - * sparc.h (sparc_{encode,decode}_{asi,membar}): Declare. - -Wed Aug 2 18:32:19 1995 Ian Lance Taylor - - * m68kmri.h: Remove. - - * m68k.h: Move tables into opcodes/m68k-opc.c, leaving just the - declarations. Remove F_ALIAS and flag field of struct - m68k_opcode. Change arch field of struct m68k_opcode to unsigned - int. Make name and args fields of struct m68k_opcode const. - -Wed Aug 2 08:16:46 1995 Doug Evans - - * sparc.h (F_NOTV9): Define. - -Tue Jul 11 14:20:42 1995 Jeff Spiegel - - * mips.h (INSN_4010): Define. - -Wed Jun 21 18:49:51 1995 Ken Raeburn - - * m68k.h (TBL1): Reverse sense of "round" argument in result. - - Changes from Andreas Schwab : - * m68k.h: Fix argument descriptions of coprocessor - instructions to allow only alterable operands where appropriate. - [!NO_DEFAULT_SIZES]: An omitted size defaults to `w'. - (m68k_opcode_aliases): Add more aliases. - - -Fri Apr 14 22:15:34 1995 Ken Raeburn - - * m68k.h: Added explcitly short-sized conditional branches, and a - bunch of aliases (fmov*, ftest*, tdivul) to support gcc's - svr4-based configurations. - - -Mon Mar 13 21:30:01 1995 Ken Raeburn - - Mon Feb 27 08:36:39 1995 Bryan Ford - * i386.h: added missing Data16/Data32 flags to a few instructions. - -Wed Mar 8 15:19:53 1995 Ian Lance Taylor - - * mips.h (OP_MASK_FR, OP_SH_FR): Define. - (OP_MASK_BCC, OP_SH_BCC): Define. - (OP_MASK_PREFX, OP_SH_PREFX): Define. - (OP_MASK_CCC, OP_SH_CCC): Define. - (INSN_READ_FPR_R): Define. - (INSN_RFE): Delete. - -Wed Mar 8 03:13:23 1995 Ken Raeburn - - * m68k.h (enum m68k_architecture): Deleted. - (struct m68k_opcode_alias): New type. - (m68k_opcodes): Now const. Deleted opcode aliases with exactly - matching constraints, values and flags. As a side effect of this, - the MOTOROLA_SYNTAX_ONLY and MIT_SYNTAX_ONLY macros, which so far - as I know were never used, now may need re-examining. - (numopcodes): Now const. - (m68k_opcode_aliases, numaliases): New variables. - (endop): Deleted. - [DONT_DEFINE_TABLE]: Declare numopcodes, numaliases, and - m68k_opcode_aliases; update declaration of m68k_opcodes. - - -Mon Mar 6 10:02:00 1995 Jeff Law (law@snake.cs.utah.edu) - - * hppa.h (delay_type): Delete unused enumeration. - (pa_opcode): Replace unused delayed field with an architecture - field. - (pa_opcodes): Mark each instruction as either PA1.0 or PA1.1. - -Fri Mar 3 16:10:24 1995 Ian Lance Taylor - - * mips.h (INSN_ISA4): Define. - -Fri Feb 24 19:13:37 1995 Ian Lance Taylor - - * mips.h (M_DLA_AB, M_DLI): Define. - -Thu Feb 23 17:33:09 1995 Jeff Law (law@snake.cs.utah.edu) - - * hppa.h (fstwx): Fix single-bit error. - -Wed Feb 15 12:19:52 1995 Ian Lance Taylor - - * mips.h (M_ULD, M_ULD_A, M_USD, M_USD_A): Define. - - -Mon Feb 6 10:35:23 1995 J.T. Conklin - - * i386.h: added cpuid instruction , and dr[0-7] aliases for the - debug registers. From Charles Hannum (mycroft@netbsd.org). - -Mon Feb 6 03:31:54 1995 Ken Raeburn - - Changes from Bryan Ford for 16-bit - i386 support: - * i386.h (MOV_AX_DISP32): New macro. - (i386_optab): Added Data16 and Data32 as needed. Added "w" forms - of several call/return instructions. - (ADDR_PREFIX_OPCODE): New macro. - -Mon Jan 23 16:45:43 1995 Ken Raeburn - - Sat Jan 21 17:50:38 1995 Pat Rankin (rankin@eql.caltech.edu) - - * ../include/opcode/vax.h (struct vot_wot, field `args'): make - it pointer to const char; - (struct vot, field `name'): ditto. - -Thu Jan 19 14:47:53 1995 Ken Raeburn - - * vax.h: Supply and properly group all values in end sentinel. - -Tue Jan 17 10:55:30 1995 Ian Lance Taylor - - * mips.h (INSN_ISA, INSN_4650): Define. - - - -Wed Oct 19 13:34:17 1994 Ian Lance Taylor - - * a29k.h: Add operand type 'I' for `inv' and `iretinv'. On - systems with a separate instruction and data cache, such as the - 29040, these instructions take an optional argument. - -Wed Sep 14 17:44:20 1994 Ian Lance Taylor (ian@sanguine.cygnus.com) - - * mips.h (INSN_STORE_MEMORY): Correct value to not conflict with - INSN_TRAP. - -Tue Sep 6 11:39:08 1994 Ian Lance Taylor (ian@sanguine.cygnus.com) - - * mips.h (INSN_STORE_MEMORY): Define. - -Thu Jul 28 19:28:07 1994 Ken Raeburn (raeburn@cujo.cygnus.com) - - * sparc.h: Document new operand type 'x'. - -Tue Jul 26 17:48:05 1994 Ken Raeburn (raeburn@cujo.cygnus.com) - - * i960.h (I_CX2): New instruction category. It includes - instructions available on Cx and Jx processors. - (I_JX): New instruction category, for JX-only instructions. - (i960_opcodes): Put eshro and sysctl in I_CX2 category. Added - Jx-only instructions, in I_JX category. - -Wed Jul 13 18:43:47 1994 Ken Raeburn (raeburn@cujo.cygnus.com) - - * ns32k.h (endop): Made pointer const too. - -Sun Jul 10 11:01:09 1994 Ian Dall (dall@hfrd.dsto.gov.au) - - * ns32k.h: Drop Q operand type as there is no correct use - for it. Add I and Z operand types which allow better checking. - -Thu Jul 7 12:34:48 1994 Steve Chamberlain (sac@jonny.cygnus.com) - - * h8300.h (xor.l) :fix bit pattern. - (L_2): New size of operand. - (trapa): Use it. - -Fri Jun 10 16:38:11 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * m68k.h: Move "trap" before "tpcc" to change disassembly. - -Fri Jun 3 15:57:36 1994 Ken Raeburn (raeburn@cujo.cygnus.com) - - * sparc.h: Include v9 definitions. - -Thu Jun 2 12:23:17 1994 Ken Raeburn (raeburn@cujo.cygnus.com) - - * m68k.h (m68060): Defined. - (m68040up, mfloat, mmmu): Include it. - (struct m68k_opcode): Widen `arch' field. - (m68k_opcodes): Updated for M68060. Removed comments that were - instructions commented out by "JF" years ago. - -Thu Apr 28 18:31:14 1994 Ken Raeburn (raeburn@cujo.cygnus.com) - - * m68k.h (struct m68k_opcode): Shorten `arch' field to 8 bits, and - add a one-bit `flags' field. - (F_ALIAS): New macro. - -Wed Apr 27 11:29:52 1994 Steve Chamberlain (sac@cygnus.com) - - * h8300.h (dec, inc): Get encoding right. - -Mon Apr 4 13:12:43 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * ppc.h (struct powerpc_operand): Removed signedp field; just use - a flag instead. - (PPC_OPERAND_SIGNED): Define. - (PPC_OPERAND_SIGNOPT): Define. - -Thu Mar 31 19:34:08 1994 Ken Raeburn (raeburn@cujo.cygnus.com) - - * i386.h (IS_JUMP_ON_ECX_ZERO, "jcxz" pattern): Operand size - prefix is 0x66, not 0x67. Patch from H.J. Lu (hlu@nynexst.com). - -Thu Mar 3 15:51:05 1994 Ken Raeburn (raeburn@cujo.cygnus.com) - - * i386.h: Reverse last change. It'll be handled in gas instead. - -Thu Feb 24 15:29:05 1994 Ken Raeburn (raeburn@cujo.cygnus.com) - - * i386.h (sar): Disabled the two-operand Imm1 form, since it was - slower on the 486 and used the implicit shift count despite the - explicit operand. The one-operand form is still available to get - the shorter form with the implicit shift count. - -Thu Feb 17 12:27:52 1994 Torbjorn Granlund (tege@mexican.cygnus.com) - - * hppa.h: Fix typo in fstws arg string. - -Wed Feb 9 21:23:52 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * ppc.h (struct powerpc_opcode): Make operands field unsigned. - -Mon Feb 7 19:14:58 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * ppc.h (PPC_OPCODE_601): Define. - -Fri Feb 4 23:43:50 1994 Jeffrey A. Law (law@snake.cs.utah.edu) - - * hppa.h (addb): Use '@' for addb and addib pseudo ops. - (so we can determine valid completers for both addb and addb[tf].) - - * hppa.h (xmpyu): No floating point format specifier for the - xmpyu instruction. - -Fri Feb 4 23:36:52 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * ppc.h (PPC_OPERAND_NEXT): Define. - (PPC_OPERAND_NEGATIVE): Change value to make room for above. - (struct powerpc_macro): Define. - (powerpc_macros, powerpc_num_macros): Declare. - -Fri Jan 21 19:13:50 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * ppc.h: New file. Header file for PowerPC opcode table. - -Mon Jan 17 00:14:23 1994 Jeffrey A. Law (law@snake.cs.utah.edu) - - * hppa.h: More minor template fixes for sfu and copr (to allow - for easier disassembly). - - * hppa.h: Fix templates for all the sfu and copr instructions. - -Wed Dec 15 15:12:42 1993 Ken Raeburn (raeburn@cujo.cygnus.com) - - * i386.h (push): Permit Imm16 operand too. - -Sat Dec 11 16:14:06 1993 Steve Chamberlain (sac@thepub.cygnus.com) - - * h8300.h (andc): Exists in base arch. - -Wed Dec 1 12:15:32 1993 Jeffrey A. Law (law@snake.cs.utah.edu) - - * From Hisashi MINAMINO - * hppa.h: #undef NONE to avoid conflict with hiux include files. - -Sun Nov 21 22:06:57 1993 Jeffrey A. Law (law@snake.cs.utah.edu) - - * hppa.h: Add FP quadword store instructions. - -Wed Nov 17 17:13:16 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * mips.h: (M_J_A): Added. - (M_LA): Removed. - -Mon Nov 8 12:12:47 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * mips.h (OP_MASK_CACHE, OP_SH_CACHE): Define. From Ted Lemon - . - -Sun Nov 7 00:30:11 1993 Jeffrey A. Law (law@snake.cs.utah.edu) - - * hppa.h: Immediate field in probei instructions is unsigned, - not low-sign extended. - -Wed Nov 3 10:30:00 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * m88k.h (RRI10MASK): Change from 0xfc00ffe0 to 0xfc00fc00. - -Tue Nov 2 12:41:30 1993 Ken Raeburn (raeburn@rover.cygnus.com) - - * i386.h: Add "fxch" without operand. - -Mon Nov 1 18:13:03 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * mips.h (M_JAL_1, M_JAL_2, M_JAL_A): Added. - -Sat Oct 2 22:26:11 1993 Jeffrey A Law (law@snake.cs.utah.edu) - - * hppa.h: Add gfw and gfr to the opcode table. - -Wed Sep 29 16:23:00 1993 K. Richard Pixley (rich@sendai.cygnus.com) - - * m88k.h: extended to handle m88110. - -Tue Sep 28 19:19:08 1993 Jeffrey A Law (law@snake.cs.utah.edu) - - * hppa.h (be, ble): Use operand type 'z' to denote absolute branch - addresses. - -Tue Sep 14 14:04:35 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * i960.h (i960_opcodes): Properly bracket initializers. - -Mon Sep 13 12:50:52 1993 K. Richard Pixley (rich@sendai.cygnus.com) - - * m88k.h (BOFLAG): rewrite to avoid nested comment. - -Mon Sep 13 15:46:06 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * m68k.h (two): Protect second argument with parentheses. - -Fri Sep 10 16:29:47 1993 Ken Raeburn (raeburn@cambridge.cygnus.com) - - * i386.h (i386_optab): Added new instruction "rsm" (for i386sl). - Deleted old in/out instructions in "#if 0" section. - -Thu Sep 9 17:42:19 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * i386.h (i386_optab): Properly bracket initializers. - -Wed Aug 25 13:50:56 1993 Ken Raeburn (raeburn@cambridge.cygnus.com) - - * hppa.h (pa_opcode): Use '|' for movb and movib insns. (From - Jeff Law, law@cs.utah.edu). - -Mon Aug 23 16:55:03 1993 Ken Raeburn (raeburn@cambridge.cygnus.com) - - * i386.h (lcall): Accept Imm32 operand also. - -Mon Aug 23 12:43:11 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * mips.h (M_ABSU): Removed (absolute value of unsigned number??). - (M_DABS): Added. - -Thu Aug 19 15:08:37 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * mips.h (INSN_*): Changed values. Removed unused definitions. - Added INSN_COND_BRANCH_LIKELY, INSN_ISA2 and INSN_ISA3. Split - INSN_LOAD_DELAY into INSN_LOAD_MEMORY_DELAY and - INSN_LOAD_COPROC_DELAY. Split INSN_COPROC_DELAY into - INSN_COPROC_MOVE_DELAY and INSN_COPROC_MEMORY_DELAY. - (M_*): Added new values for r6000 and r4000 macros. - (ANY_DELAY): Removed. - -Wed Aug 18 15:37:48 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * mips.h: Added M_LI_S and M_LI_SS. - -Tue Aug 17 07:08:08 1993 Steve Chamberlain (sac@phydeaux.cygnus.com) - - * h8300.h: Get some rare mov.bs correct. - -Thu Aug 5 09:15:17 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * sparc.h: Don't define const ourself; rely on ansidecl.h having - been included. - -Fri Jul 30 18:41:11 1993 John Gilmore (gnu@cygnus.com) - - * sparc.h (F_JSR, F_UNBR, F_CONDBR): Add new flags to mark - jump instructions, for use in disassemblers. - -Thu Jul 22 07:25:27 1993 Ian Lance Taylor (ian@cygnus.com) - - * m88k.h: Make bitfields just unsigned, not unsigned long or - unsigned short. - -Wed Jul 21 11:55:31 1993 Jim Kingdon (kingdon@deneb.cygnus.com) - - * hppa.h: New argument type 'y'. Use in various float instructions. - -Mon Jul 19 17:17:03 1993 Jim Kingdon (kingdon@deneb.cygnus.com) - - * hppa.h (break): First immediate field is unsigned. - - * hppa.h: Add rfir instruction. - -Sun Jul 18 16:28:08 1993 Jim Kingdon (kingdon@rtl.cygnus.com) - - * mips.h: Split the actual table out into ../../opcodes/mips-opc.c. - -Fri Jul 16 09:59:29 1993 Ian Lance Taylor (ian@cygnus.com) - - * mips.h: Reworked the hazard information somewhat, and fixed some - bugs in the instruction hazard descriptions. - -Thu Jul 15 12:42:01 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * m88k.h: Corrected a couple of opcodes. - -Tue Jul 6 15:17:35 1993 Ian Lance Taylor (ian@cygnus.com) - - * mips.h: Replaced with version from Ralph Campbell and OSF. The - new version includes instruction hazard information, but is - otherwise reasonably similar. - -Thu Jul 1 20:36:17 1993 Doug Evans (dje@canuck.cygnus.com) - - * h8300.h: Fix typo in UNOP3 (affected sh[al][lr].l). - -Fri Jun 11 18:38:44 1993 Ken Raeburn (raeburn@cygnus.com) - - Patches from Jeff Law, law@cs.utah.edu: - * hppa.h: Clean up some of the OLD_TABLE, non-OLD_TABLE braindamage. - Make the tables be the same for the following instructions: - "bb", "addb[tf]", "addib[tf]", "add", "add[loc]", "addco", - "sh[123]add", "sh[123]add[lo]", "sub", "sub[obt]", "sub[bt]o", - "ds", "comclr", "addi", "addi[ot]", "addito", "subi", "subio", - "comiclr", "fadd", "fsub", "fmpy", "fdiv", "fsqrt", "fabs", - "frnd", "fcpy", "fcnvff", "fcnvxf", "fcnvfx", "fcnvfxt", - "fcmp", and "ftest". - - * hppa.h: Make new and old tables the same for "break", "mtctl", - "mfctl", "bb", "ssm", "rsm", "xmpyu", "fmpyadd", "fmpysub". - Fix typo in last patch. Collapse several #ifdefs into a - single #ifdef. - - * hppa.h: Delete remaining OLD_TABLE code. Bring some - of the comments up-to-date. - - * hppa.h: Update "free list" of letters and update - comments describing each letter's function. - -Fri Jun 4 15:41:37 1993 Steve Chamberlain (sac@phydeaux.cygnus.com) - - * h8300.h: checkpoint, includes H8/300-H opcodes. - -Thu Jun 3 15:42:59 1993 Stu Grossman (grossman@cygnus.com) - - * Patches from Jeffrey Law . - * hppa.h: Rework single precision FP - instructions so that they correctly disassemble code - PA1.1 code. - -Thu May 27 19:21:22 1993 Bruce Bauman (boot@osf.org) - - * i386.h (i386_optab, mov pattern): Remove Mem16 restriction from - mov to allow instructions like mov ss,xyz(ecx) to assemble. - -Tue May 25 00:39:40 1993 Ken Raeburn (raeburn@cygnus.com) - - * hppa.h: Use new version from Utah if OLD_TABLE isn't defined; - gdb will define it for now. - -Mon May 24 15:20:06 1993 Ken Raeburn (raeburn@cambridge.cygnus.com) - - * sparc.h: Don't end enumerator list with comma. - -Fri May 14 15:15:50 1993 Ian Lance Taylor (ian@cygnus.com) - - * Based on patches from davidj@ICSI.Berkeley.EDU (David Johnson): - * mips.h (OP_MASK_COPZ, OP_SH_COPZ): Define. - ("bc2t"): Correct typo. - ("[ls]wc[023]"): Use T rather than t. - ("c[0123]"): Define general coprocessor instructions. - -Mon May 10 06:02:25 1993 Ken Raeburn (raeburn@kr-pc.cygnus.com) - - * m68k.h: Move split point for gcc compilation more towards - middle. - -Fri Apr 9 13:26:16 1993 Jim Kingdon (kingdon@cygnus.com) - - * rs6k.h: Clean up instructions for primary opcode 19 (many were - simply wrong, ics, rfi, & rfsvc were missing). - Add "a" to opr_ext for "bb". Doc fix. - -Thu Mar 18 13:45:31 1993 Per Bothner (bothner@rtl.cygnus.com) - - * i386.h: 486 extensions from John Hassey (hassey@dg-rtp.dg.com). - * mips.h: Add casts, to suppress warnings about shifting too much. - * m68k.h: Document the placement code '9'. - -Thu Feb 18 02:03:14 1993 John Gilmore (gnu@cygnus.com) - - * m68k.h (BREAK_UP_BIG_DECL, AND_OTHER_PART): Add kludge which - allows callers to break up the large initialized struct full of - opcodes into two half-sized ones. This permits GCC to compile - this module, since it takes exponential space for initializers. - (numopcodes, endop): Revise to use AND_OTHER_PART in size calcs. - -Thu Feb 4 02:06:56 1993 John Gilmore (gnu@cygnus.com) - - * a29k.h: Remove RCS crud, update GPL to v2, update copyrights. - * convex.h: Added, from GDB's convx-opcode.h. Added CONST to all - initialized structs in it. - -Thu Jan 28 21:32:22 1993 John Gilmore (gnu@cygnus.com) - - Delta 88 changes inspired by Carl Greco, : - * m88k.h (PMEM): Avoid previous definition from . - (AND): Change to AND_ to avoid ansidecl.h `AND' conflict. - -Sat Jan 23 18:10:49 PST 1993 Ralph Campbell (ralphc@pyramid.com) - - * mips.h: document "i" and "j" operands correctly. - -Thu Jan 7 15:58:13 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * mips.h: Removed endianness dependency. - -Sun Jan 3 14:13:35 1993 Steve Chamberlain (sac@thepub.cygnus.com) - - * h8300.h: include info on number of cycles per instruction. - -Mon Dec 21 21:29:08 1992 Stu Grossman (grossman at cygnus.com) - - * hppa.h: Move handy aliases to the front. Fix masks for extract - and deposit instructions. - -Sat Dec 12 16:09:48 1992 Ian Lance Taylor (ian@cygnus.com) - - * i386.h: accept shld and shrd both with and without the shift - count argument, which is always %cl. - -Fri Nov 27 17:13:18 1992 Ken Raeburn (raeburn at cygnus.com) - - * i386.h (i386_optab_end, i386_regtab_end): Now const. - (one_byte_segment_defaults, two_byte_segment_defaults, - i386_prefixtab_end): Ditto. - -Mon Nov 23 10:47:25 1992 Ken Raeburn (raeburn@cygnus.com) - - * vax.h (bb*): Use "v" (bitfield type), not "a" (address operand) - for operand 2; from John Carr, jfc@dsg.dec.com. - -Wed Nov 4 07:36:49 1992 Ken Raeburn (raeburn@cygnus.com) - - * m68k.h: Define FIXED_SIZE_BRANCH, so bsr and bra instructions - always use 16-bit offsets. Makes calculated-size jump tables - feasible. - -Fri Oct 16 22:52:43 1992 Ken Raeburn (raeburn@cygnus.com) - - * i386.h: Fix one-operand forms of in* and out* patterns. - -Tue Sep 22 14:08:14 1992 Ken Raeburn (raeburn@cambridge.cygnus.com) - - * m68k.h: Added CPU32 support. - -Tue Sep 22 00:38:41 1992 John Gilmore (gnu@cygnus.com) - - * mips.h (break): Disassemble the argument. Patch from - jonathan@cs.stanford.edu (Jonathan Stone). - -Wed Sep 9 11:25:28 1992 Ian Lance Taylor (ian@cygnus.com) - - * m68k.h: merged Motorola and MIT syntax. - -Thu Sep 3 09:33:22 1992 Steve Chamberlain (sac@thepub.cygnus.com) - - * m68k.h (pmove): make the tests less strict, the 68k book is - wrong. - -Tue Aug 25 23:25:19 1992 Ken Raeburn (raeburn@cambridge.cygnus.com) - - * m68k.h (m68ec030): Defined as alias for 68030. - (m68k_opcodes): New type characters "3" for 68030 MMU regs and "t" - for immediate 0-7 added. Set up some opcodes (ptest, bkpt) to use - them. Tightened description of "fmovex" to distinguish it from - some "pmove" encodings. Added "pmove" for 68030 MMU regs, cleaned - up descriptions that claimed versions were available for chips not - supporting them. Added "pmovefd". - -Mon Aug 24 12:04:51 1992 Steve Chamberlain (sac@thepub.cygnus.com) - - * m68k.h: fix where the . goes in divull - -Wed Aug 19 11:22:24 1992 Ian Lance Taylor (ian@cygnus.com) - - * m68k.h: the cas2 instruction is supposed to be written with - indirection on the last two operands, which can be either data or - address registers. Added a new operand type 'r' which accepts - either register type. Added new cases for cas2l and cas2w which - use them. Corrected masks for cas2 which failed to recognize use - of address register. - -Fri Aug 14 14:20:38 1992 Per Bothner (bothner@cygnus.com) - - * m68k.h: Merged in patches (mostly m68040-specific) from - Colin Smith . - - * m68k.h: Merged m68kmri.h and m68k.h (using the former as a - base). Also cleaned up duplicates, re-ordered instructions for - the sake of dis-assembling (so aliases come after standard names). - * m68kmri.h: Now just defines some macros, and #includes m68k.h. - -Wed Aug 12 16:38:15 1992 Steve Chamberlain (sac@thepub.cygnus.com) - - * m68kmri.h: added various opcodes. Moved jbxx to bxxes. Filled in - all missing .s - -Mon Aug 10 23:22:33 1992 Ken Raeburn (raeburn@cygnus.com) - - * sparc.h: Moved tables to BFD library. - - * i386.h (i386_optab): Add fildq, fistpq aliases used by gcc. - -Sun Jun 28 13:29:03 1992 Fred Fish (fnf@cygnus.com) - - * h8300.h: Finish filling in all the holes in the opcode table, - so that the Lucid C compiler can digest this as well... - -Fri Jun 26 21:27:17 1992 John Gilmore (gnu at cygnus.com) - - * i386.h: Add setc, setnc, addr16, data16, repz, repnz aliases. - Fix opcodes on various sizes of fild/fist instructions - (16bit=no suffix, 32bit="l" suffix, 64bit="ll" suffix). - Use tabs to indent for comments. Fixes suggested by Minh Tran-Le. - -Thu Jun 25 16:13:26 1992 Stu Grossman (grossman at cygnus.com) - - * h8300.h: Fill in all the holes in the opcode table so that the - losing HPUX C compiler can digest this... - -Thu Jun 11 12:15:25 1992 John Gilmore (gnu at cygnus.com) - - * mips.h: Fix decoding of coprocessor instructions, somewhat. - (Fix by Eric Anderson, 3jean@maas-neotek.arc.nasa.gov.) - -Thu May 28 11:17:44 1992 Jim Wilson (wilson@sphagnum.cygnus.com) - - * sparc.h: Add new architecture variant sparclite; add its scan - and divscc opcodes. Define ARCHITECTURES_CONFLICT_P macro. - -Tue May 5 14:23:27 1992 Per Bothner (bothner@rtl.cygnus.com) - - * mips.h: Add some more opcode synonyms (from Frank Yellin, - fy@lucid.com). - -Thu Apr 16 18:25:26 1992 Per Bothner (bothner@cygnus.com) - - * rs6k.h: New version from IBM (Metin). - -Thu Apr 9 00:31:19 1992 Per Bothner (bothner@rtl.cygnus.com) - - * rs6k.h: Fix incorrect extended opcode for instructions `fm' - and `fd'. (From metin@ibmpa.awdpa.ibm.com (Metin G. Ozisik).) - -Tue Apr 7 13:38:47 1992 Stu Grossman (grossman at cygnus.com) - - * rs6k.h: Move from ../../gdb/rs6k-opcode.h. - -Fri Apr 3 11:30:20 1992 Fred Fish (fnf@cygnus.com) - - * m68k.h (one, two): Cast macro args to unsigned to suppress - complaints from compiler and lint about integer overflow during - shift. - -Sun Mar 29 12:22:08 1992 John Gilmore (gnu at cygnus.com) - - * sparc.h (OP): Avoid signed overflow when shifting to high order bit. - -Fri Mar 6 00:22:38 1992 John Gilmore (gnu at cygnus.com) - - * mips.h: Make bitfield layout depend on the HOST compiler, - not on the TARGET system. - -Fri Feb 21 01:29:51 1992 K. Richard Pixley (rich@cygnus.com) - - * i386.h: added inb, inw, outb, outw opcodes, added att syntax for - scmp, slod, smov, ssca, ssto. Curtesy Minh Tran-Le - . - -Thu Jan 30 07:31:44 1992 Steve Chamberlain (sac at rtl.cygnus.com) - - * h8300.h: turned op_type enum into #define list - -Thu Jan 30 01:07:24 1992 John Gilmore (gnu at cygnus.com) - - * sparc.h: Remove "cypress" architecture. Remove "fitox" and - similar instructions -- they've been renamed to "fitoq", etc. - REALLY fix tsubcctv. Fix "fcmpeq" and "fcmpq" which had wrong - number of arguments. - * h8300.h: Remove extra ; which produces compiler warning. - -Tue Jan 28 22:59:22 1992 Stu Grossman (grossman at cygnus.com) - - * sparc.h: fix opcode for tsubcctv. - -Tue Jan 7 17:19:39 1992 K. Richard Pixley (rich at cygnus.com) - - * sparc.h: fba and cba are now aliases for fb and cb respectively. - -Fri Dec 27 10:55:50 1991 Per Bothner (bothner at cygnus.com) - - * sparc.h (nop): Made the 'lose' field be even tighter, - so only a standard 'nop' is disassembled as a nop. - -Sun Dec 22 12:18:18 1991 Michael Tiemann (tiemann at cygnus.com) - - * sparc.h (nop): Add RD_GO to `lose' so that only %g0 in dest is - disassembled as a nop. - -Tue Dec 10 00:22:20 1991 K. Richard Pixley (rich at rtl.cygnus.com) - - * sparc.h: fix a typo. - -Sat Nov 30 20:40:51 1991 Steve Chamberlain (sac at rtl.cygnus.com) - - * a29k.h, arm.h, h8300.h, i386.h, i860.h, i960.h , m68k.h, - m88k.h, mips.h , np1.h, ns32k.h, pn.h, pyr.h, sparc.h, tahoe.h, - vax.h, ChangeLog: renamed from ../-opcode.h - - -Local Variables: -version-control: never -End: diff --git a/contrib/gdb/include/opcode/a29k.h b/contrib/gdb/include/opcode/a29k.h deleted file mode 100644 index 002e127..0000000 --- a/contrib/gdb/include/opcode/a29k.h +++ /dev/null @@ -1,285 +0,0 @@ -/* Table of opcodes for the AMD 29000 family. - Copyright 1990, 1991, 1992, 1993 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. */ - -struct a29k_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 RA. The register number is in bits 8-15 of the instruction. - b RB. The register number is in bits 0-7 of the instruction. - c RC. The register number is in bits 16-23 of the instruction. - i An immediate operand is in bits 0-7 of the instruction. - x Bits 0-7 and 16-23 of the instruction are bits 0-7 and 8-15 - (respectively) of the immediate operand. - h Same as x but the instruction contains bits 16-31 of the - immediate operand. - X Same as x but bits 16-31 of the signed immediate operand - are set to 1 (thus the operand is always negative). - P,A Bits 0-7 and 16-23 of the instruction are bits 2-9 and 10-17 - (respectively) of the immediate operand. - P=PC-relative, sign-extended to 32 bits. - A=Absolute, zero-extended to 32 bits. - e CE bit (bit 23) for a load/store instruction. - n Control field (bits 16-22) for a load/store instruction. - v Immediate operand in bits 16-23 of the instruction. - (used for trap numbers). - s SA. Special-purpose register number in bits 8-15 - of the instruction. - u UI--bit 7 of the instruction. - r RND--bits 4-6 of the instruction. - d FD--bits 2-3 of the instruction. - f FS--bits 0-1 of the instruction. - I ID--bits 16-17 of the instruction. - - Extensions for 29050: - - d FMT--bits 2-3 of the instruction (not really new). - f ACN--bits 0-1 of the instruction (not really new). - F FUNC--Special function in bits 18-21 of the instruction. - C ACN--bits 16-17 specifying the accumlator register. */ - char *args; -}; - -#ifndef CONST -#define CONST -#endif /* CONST */ - -static CONST struct a29k_opcode a29k_opcodes[] = -{ - -{ "add", 0x14000000, "c,a,b" }, -{ "add", 0x15000000, "c,a,i" }, -{ "addc", 0x1c000000, "c,a,b" }, -{ "addc", 0x1d000000, "c,a,i" }, -{ "addcs", 0x18000000, "c,a,b" }, -{ "addcs", 0x19000000, "c,a,i" }, -{ "addcu", 0x1a000000, "c,a,b" }, -{ "addcu", 0x1b000000, "c,a,i" }, -{ "adds", 0x10000000, "c,a,b" }, -{ "adds", 0x11000000, "c,a,i" }, -{ "addu", 0x12000000, "c,a,b" }, -{ "addu", 0x13000000, "c,a,i" }, -{ "and", 0x90000000, "c,a,b" }, -{ "and", 0x91000000, "c,a,i" }, -{ "andn", 0x9c000000, "c,a,b" }, -{ "andn", 0x9d000000, "c,a,i" }, -{ "aseq", 0x70000000, "v,a,b" }, -{ "aseq", 0x71000000, "v,a,i" }, -{ "asge", 0x5c000000, "v,a,b" }, -{ "asge", 0x5d000000, "v,a,i" }, -{ "asgeu", 0x5e000000, "v,a,b" }, -{ "asgeu", 0x5f000000, "v,a,i" }, -{ "asgt", 0x58000000, "v,a,b" }, -{ "asgt", 0x59000000, "v,a,i" }, -{ "asgtu", 0x5a000000, "v,a,b" }, -{ "asgtu", 0x5b000000, "v,a,i" }, -{ "asle", 0x54000000, "v,a,b" }, -{ "asle", 0x55000000, "v,a,i" }, -{ "asleu", 0x56000000, "v,a,b" }, -{ "asleu", 0x57000000, "v,a,i" }, -{ "aslt", 0x50000000, "v,a,b" }, -{ "aslt", 0x51000000, "v,a,i" }, -{ "asltu", 0x52000000, "v,a,b" }, -{ "asltu", 0x53000000, "v,a,i" }, -{ "asneq", 0x72000000, "v,a,b" }, -{ "asneq", 0x73000000, "v,a,i" }, -{ "call", 0xa8000000, "a,P" }, -{ "call", 0xa9000000, "a,A" }, -{ "calli", 0xc8000000, "a,b" }, -{ "class", 0xe6000000, "c,a,f" }, -{ "clz", 0x08000000, "c,b" }, -{ "clz", 0x09000000, "c,i" }, -{ "const", 0x03000000, "a,x" }, -{ "consth", 0x02000000, "a,h" }, -{ "consthz", 0x05000000, "a,h" }, -{ "constn", 0x01000000, "a,X" }, -{ "convert", 0xe4000000, "c,a,u,r,d,f" }, -{ "cpbyte", 0x2e000000, "c,a,b" }, -{ "cpbyte", 0x2f000000, "c,a,i" }, -{ "cpeq", 0x60000000, "c,a,b" }, -{ "cpeq", 0x61000000, "c,a,i" }, -{ "cpge", 0x4c000000, "c,a,b" }, -{ "cpge", 0x4d000000, "c,a,i" }, -{ "cpgeu", 0x4e000000, "c,a,b" }, -{ "cpgeu", 0x4f000000, "c,a,i" }, -{ "cpgt", 0x48000000, "c,a,b" }, -{ "cpgt", 0x49000000, "c,a,i" }, -{ "cpgtu", 0x4a000000, "c,a,b" }, -{ "cpgtu", 0x4b000000, "c,a,i" }, -{ "cple", 0x44000000, "c,a,b" }, -{ "cple", 0x45000000, "c,a,i" }, -{ "cpleu", 0x46000000, "c,a,b" }, -{ "cpleu", 0x47000000, "c,a,i" }, -{ "cplt", 0x40000000, "c,a,b" }, -{ "cplt", 0x41000000, "c,a,i" }, -{ "cpltu", 0x42000000, "c,a,b" }, -{ "cpltu", 0x43000000, "c,a,i" }, -{ "cpneq", 0x62000000, "c,a,b" }, -{ "cpneq", 0x63000000, "c,a,i" }, -{ "dadd", 0xf1000000, "c,a,b" }, -{ "ddiv", 0xf7000000, "c,a,b" }, -{ "deq", 0xeb000000, "c,a,b" }, -{ "dge", 0xef000000, "c,a,b" }, -{ "dgt", 0xed000000, "c,a,b" }, -{ "div", 0x6a000000, "c,a,b" }, -{ "div", 0x6b000000, "c,a,i" }, -{ "div0", 0x68000000, "c,b" }, -{ "div0", 0x69000000, "c,i" }, -{ "divide", 0xe1000000, "c,a,b" }, -{ "dividu", 0xe3000000, "c,a,b" }, -{ "divl", 0x6c000000, "c,a,b" }, -{ "divl", 0x6d000000, "c,a,i" }, -{ "divrem", 0x6e000000, "c,a,b" }, -{ "divrem", 0x6f000000, "c,a,i" }, -{ "dmac", 0xd9000000, "F,C,a,b" }, -{ "dmsm", 0xdb000000, "c,a,b" }, -{ "dmul", 0xf5000000, "c,a,b" }, -{ "dsub", 0xf3000000, "c,a,b" }, -{ "emulate", 0xd7000000, "v,a,b" }, -{ "exbyte", 0x0a000000, "c,a,b" }, -{ "exbyte", 0x0b000000, "c,a,i" }, -{ "exhw", 0x7c000000, "c,a,b" }, -{ "exhw", 0x7d000000, "c,a,i" }, -{ "exhws", 0x7e000000, "c,a" }, -{ "extract", 0x7a000000, "c,a,b" }, -{ "extract", 0x7b000000, "c,a,i" }, -{ "fadd", 0xf0000000, "c,a,b" }, -{ "fdiv", 0xf6000000, "c,a,b" }, -{ "fdmul", 0xf9000000, "c,a,b" }, -{ "feq", 0xea000000, "c,a,b" }, -{ "fge", 0xee000000, "c,a,b" }, -{ "fgt", 0xec000000, "c,a,b" }, -{ "fmac", 0xd8000000, "F,C,a,b" }, -{ "fmsm", 0xda000000, "c,a,b" }, -{ "fmul", 0xf4000000, "c,a,b" }, -{ "fsub", 0xf2000000, "c,a,b" }, -{ "halt", 0x89000000, "" }, -{ "inbyte", 0x0c000000, "c,a,b" }, -{ "inbyte", 0x0d000000, "c,a,i" }, -{ "inhw", 0x78000000, "c,a,b" }, -{ "inhw", 0x79000000, "c,a,i" }, -{ "inv", 0x9f000000, "I" }, -{ "iret", 0x88000000, "" }, -{ "iretinv", 0x8c000000, "I" }, -{ "jmp", 0xa0000000, "P" }, -{ "jmp", 0xa1000000, "A" }, -{ "jmpf", 0xa4000000, "a,P" }, -{ "jmpf", 0xa5000000, "a,A" }, -{ "jmpfdec", 0xb4000000, "a,P" }, -{ "jmpfdec", 0xb5000000, "a,A" }, -{ "jmpfi", 0xc4000000, "a,b" }, -{ "jmpi", 0xc0000000, "b" }, -{ "jmpt", 0xac000000, "a,P" }, -{ "jmpt", 0xad000000, "a,A" }, -{ "jmpti", 0xcc000000, "a,b" }, -{ "load", 0x16000000, "e,n,a,b" }, -{ "load", 0x17000000, "e,n,a,i" }, -{ "loadl", 0x06000000, "e,n,a,b" }, -{ "loadl", 0x07000000, "e,n,a,i" }, -{ "loadm", 0x36000000, "e,n,a,b" }, -{ "loadm", 0x37000000, "e,n,a,i" }, -{ "loadset", 0x26000000, "e,n,a,b" }, -{ "loadset", 0x27000000, "e,n,a,i" }, -{ "mfacc", 0xe9000100, "c,d,f" }, -{ "mfsr", 0xc6000000, "c,s" }, -{ "mftlb", 0xb6000000, "c,a" }, -{ "mtacc", 0xe8010000, "a,d,f" }, -{ "mtsr", 0xce000000, "s,b" }, -{ "mtsrim", 0x04000000, "s,x" }, -{ "mttlb", 0xbe000000, "a,b" }, -{ "mul", 0x64000000, "c,a,b" }, -{ "mul", 0x65000000, "c,a,i" }, -{ "mull", 0x66000000, "c,a,b" }, -{ "mull", 0x67000000, "c,a,i" }, -{ "multiplu", 0xe2000000, "c,a,b" }, -{ "multiply", 0xe0000000, "c,a,b" }, -{ "multm", 0xde000000, "c,a,b" }, -{ "multmu", 0xdf000000, "c,a,b" }, -{ "mulu", 0x74000000, "c,a,b" }, -{ "mulu", 0x75000000, "c,a,i" }, -{ "nand", 0x9a000000, "c,a,b" }, -{ "nand", 0x9b000000, "c,a,i" }, -{ "nop", 0x70400101, "" }, -{ "nor", 0x98000000, "c,a,b" }, -{ "nor", 0x99000000, "c,a,i" }, -{ "or", 0x92000000, "c,a,b" }, -{ "or", 0x93000000, "c,a,i" }, -{ "orn", 0xaa000000, "c,a,b" }, -{ "orn", 0xab000000, "c,a,i" }, - -/* The description of "setip" in Chapter 8 ("instruction set") of the user's - manual claims that these are absolute register numbers. But section - 7.2.1 explains that they are not. The latter is correct, so print - these normally ("lr0", "lr5", etc.). */ -{ "setip", 0x9e000000, "c,a,b" }, - -{ "sll", 0x80000000, "c,a,b" }, -{ "sll", 0x81000000, "c,a,i" }, -{ "sqrt", 0xe5000000, "c,a,f" }, -{ "sra", 0x86000000, "c,a,b" }, -{ "sra", 0x87000000, "c,a,i" }, -{ "srl", 0x82000000, "c,a,b" }, -{ "srl", 0x83000000, "c,a,i" }, -{ "store", 0x1e000000, "e,n,a,b" }, -{ "store", 0x1f000000, "e,n,a,i" }, -{ "storel", 0x0e000000, "e,n,a,b" }, -{ "storel", 0x0f000000, "e,n,a,i" }, -{ "storem", 0x3e000000, "e,n,a,b" }, -{ "storem", 0x3f000000, "e,n,a,i" }, -{ "sub", 0x24000000, "c,a,b" }, -{ "sub", 0x25000000, "c,a,i" }, -{ "subc", 0x2c000000, "c,a,b" }, -{ "subc", 0x2d000000, "c,a,i" }, -{ "subcs", 0x28000000, "c,a,b" }, -{ "subcs", 0x29000000, "c,a,i" }, -{ "subcu", 0x2a000000, "c,a,b" }, -{ "subcu", 0x2b000000, "c,a,i" }, -{ "subr", 0x34000000, "c,a,b" }, -{ "subr", 0x35000000, "c,a,i" }, -{ "subrc", 0x3c000000, "c,a,b" }, -{ "subrc", 0x3d000000, "c,a,i" }, -{ "subrcs", 0x38000000, "c,a,b" }, -{ "subrcs", 0x39000000, "c,a,i" }, -{ "subrcu", 0x3a000000, "c,a,b" }, -{ "subrcu", 0x3b000000, "c,a,i" }, -{ "subrs", 0x30000000, "c,a,b" }, -{ "subrs", 0x31000000, "c,a,i" }, -{ "subru", 0x32000000, "c,a,b" }, -{ "subru", 0x33000000, "c,a,i" }, -{ "subs", 0x20000000, "c,a,b" }, -{ "subs", 0x21000000, "c,a,i" }, -{ "subu", 0x22000000, "c,a,b" }, -{ "subu", 0x23000000, "c,a,i" }, -{ "xnor", 0x96000000, "c,a,b" }, -{ "xnor", 0x97000000, "c,a,i" }, -{ "xor", 0x94000000, "c,a,b" }, -{ "xor", 0x95000000, "c,a,i" }, - -{ "", 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_opcodes = (((sizeof a29k_opcodes) / (sizeof a29k_opcodes[0])) - 1); diff --git a/contrib/gdb/include/opcode/arm.h b/contrib/gdb/include/opcode/arm.h deleted file mode 100644 index c7087eb..0000000 --- a/contrib/gdb/include/opcode/arm.h +++ /dev/null @@ -1,294 +0,0 @@ -/* ARM opcode list. - Copyright (C) 1989, Free Software Foundation, Inc. - -This file is part of GDB and GAS. - -GDB and GAS are 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 1, or (at your option) -any later version. - -GDB and GAS are 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 GDB or GAS; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -/* types of instruction (encoded in bits 26 and 27 of the instruction) */ - -#define TYPE_ARITHMETIC 0 -#define TYPE_LDR_STR 1 -#define TYPE_BLOCK_BRANCH 2 -#define TYPE_SWI 3 - -/* bit 25 decides whether an instruction is a block move or a branch */ -#define SUBTYPE_BLOCK 0 -#define SUBTYPE_BRANCH 1 - -/* codes to distinguish the arithmetic instructions */ - -#define OPCODE_AND 0 -#define OPCODE_EOR 1 -#define OPCODE_SUB 2 -#define OPCODE_RSB 3 -#define OPCODE_ADD 4 -#define OPCODE_ADC 5 -#define OPCODE_SBC 6 -#define OPCODE_RSC 7 -#define OPCODE_TST 8 -#define OPCODE_TEQ 9 -#define OPCODE_CMP 10 -#define OPCODE_CMN 11 -#define OPCODE_ORR 12 -#define OPCODE_MOV 13 -#define OPCODE_BIC 14 -#define OPCODE_MVN 15 - -/* condition codes */ - -#define COND_EQ 0 -#define COND_NE 1 -#define COND_CS 2 -#define COND_CC 3 -#define COND_MI 4 -#define COND_PL 5 -#define COND_VS 6 -#define COND_VC 7 -#define COND_HI 8 -#define COND_LS 9 -#define COND_GE 10 -#define COND_LT 11 -#define COND_GT 12 -#define COND_LE 13 -#define COND_AL 14 -#define COND_NV 15 - -/* Describes the format of an ARM machine instruction */ - -struct generic_fmt { - unsigned rest :25; /* the rest of the instruction */ - unsigned subtype :1; /* used to decide between block and branch */ - unsigned type :2; /* one of TYPE_* */ - unsigned cond :4; /* one of COND_* defined above */ -}; - -struct arith_fmt { - unsigned operand2 :12; /* #nn or rn or rn shift #m or rn shift rm */ - unsigned dest :4; /* place where the answer goes */ - unsigned operand1 :4; /* first operand to instruction */ - unsigned set :1; /* == 1 means set processor flags */ - unsigned opcode :4; /* one of OPCODE_* defined above */ - unsigned immed :1; /* operand2 is an immediate value */ - unsigned type :2; /* == TYPE_ARITHMETIC */ - unsigned cond :4; /* one of COND_* defined above */ -}; - -struct ldr_str_fmt { - unsigned offset :12; /* #nn or rn or rn shift #m */ - unsigned reg :4; /* destination for LDR, source for STR */ - unsigned base :4; /* base register */ - unsigned is_load :1; /* == 1 for LDR */ - unsigned writeback :1; /* == 1 means write back (base+offset) into base */ - unsigned byte :1; /* == 1 means byte access else word */ - unsigned up :1; /* == 1 means add offset else subtract it */ - unsigned pre_index :1; /* == 1 means [a,b] form else [a],b form */ - unsigned immed :1; /* == 0 means immediate offset */ - unsigned type :2; /* == TYPE_LDR_STR */ - unsigned cond :4; /* one of COND_* defined above */ -}; - -struct block_fmt { - unsigned mask :16; /* register mask */ - unsigned base :4; /* register used as base of move */ - unsigned is_load :1; /* == 1 for LDM */ - unsigned writeback :1; /* == 1 means update base after move */ - unsigned set :1; /* == 1 means set flags in pc if included in mask */ - unsigned increment :1; /* == 1 means increment base register */ - unsigned before :1; /* == 1 means inc/dec before each move */ - unsigned is_block :1; /* == SUBTYPE_BLOCK */ - unsigned type :2; /* == TYPE_BLOCK_BRANCH */ - unsigned cond :4; /* one of COND_* defined above */ -}; - -struct branch_fmt { - unsigned dest :24; /* destination of the branch */ - unsigned link :1; /* branch with link (function call) */ - unsigned is_branch :1; /* == SUBTYPE_BRANCH */ - unsigned type :2; /* == TYPE_BLOCK_BRANCH */ - unsigned cond :4; /* one of COND_* defined above */ -}; - -#define ROUND_N 0 -#define ROUND_P 1 -#define ROUND_M 2 -#define ROUND_Z 3 - -#define FLOAT2_MVF 0 -#define FLOAT2_MNF 1 -#define FLOAT2_ABS 2 -#define FLOAT2_RND 3 -#define FLOAT2_SQT 4 -#define FLOAT2_LOG 5 -#define FLOAT2_LGN 6 -#define FLOAT2_EXP 7 -#define FLOAT2_SIN 8 -#define FLOAT2_COS 9 -#define FLOAT2_TAN 10 -#define FLOAT2_ASN 11 -#define FLOAT2_ACS 12 -#define FLOAT2_ATN 13 - -#define FLOAT3_ADF 0 -#define FLOAT3_MUF 1 -#define FLOAT3_SUF 2 -#define FLOAT3_RSF 3 -#define FLOAT3_DVF 4 -#define FLOAT3_RDF 5 -#define FLOAT3_POW 6 -#define FLOAT3_RPW 7 -#define FLOAT3_RMF 8 -#define FLOAT3_FML 9 -#define FLOAT3_FDV 10 -#define FLOAT3_FRD 11 -#define FLOAT3_POL 12 - -struct float2_fmt { - unsigned operand2 :3; /* second operand */ - unsigned immed :1; /* == 1 if second operand is a constant */ - unsigned pad1 :1; /* == 0 */ - unsigned rounding :2; /* ROUND_* */ - unsigned is_double :1; /* == 1 if precision is double (only if not extended) */ - unsigned pad2 :4; /* == 1 */ - unsigned dest :3; /* destination */ - unsigned is_2_op :1; /* == 1 if 2 operand ins */ - unsigned operand1 :3; /* first operand (only of is_2_op == 0) */ - unsigned is_extended :1; /* == 1 if precision is extended */ - unsigned opcode :4; /* FLOAT2_* or FLOAT3_* depending on is_2_op */ - unsigned must_be_2 :2; /* == 2 */ - unsigned type :2; /* == TYPE_SWI */ - unsigned cond :4; /* COND_* */ -}; - -struct swi_fmt { - unsigned argument :24; /* argument to SWI (syscall number) */ - unsigned must_be_3 :2; /* == 3 */ - unsigned type :2; /* == TYPE_SWI */ - unsigned cond :4; /* one of COND_* defined above */ -}; - -union insn_fmt { - struct generic_fmt generic; - struct arith_fmt arith; - struct ldr_str_fmt ldr_str; - struct block_fmt block; - struct branch_fmt branch; - struct swi_fmt swi; - unsigned long ins; -}; - -struct opcode { - unsigned long value, mask; /* recognise instruction if (op&mask)==value */ - char *assembler; /* how to disassemble this instruction */ -}; - -/* format of the assembler string : - - %% % - %d print the bitfield in decimal - %x print the bitfield in hex - %r print as an ARM register - %f print a floating point constant if >7 else an fp register - %c print condition code (always bits 28-31) - %P print floating point precision in arithmetic insn - %Q print floating point precision in ldf/stf insn - %R print floating point rounding mode - %'c print specified char iff bit is one - %`c print specified char iff bit is zero - %?ab print a if bit is one else print b - %p print 'p' iff bits 12-15 are 15 - %o print operand2 (immediate or register + shift) - %a print address for ldr/str instruction - %b print branch destination - %A print address for ldc/stc/ldf/stf instruction - %m print register mask for ldm/stm instruction -*/ - -static struct opcode opcodes[] = { - /* ARM instructions */ - 0x00000090, 0x0fe000f0, "mul%20's %12-15r, %16-19r, %0-3r", - 0x00200090, 0x0fe000f0, "mla%20's %12-15r, %16-19r, %0-3r, %8-11r", - 0x00000000, 0x0de00000, "and%c%20's %12-15r, %16-19r, %o", - 0x00200000, 0x0de00000, "eor%c%20's %12-15r, %16-19r, %o", - 0x00400000, 0x0de00000, "sub%c%20's %12-15r, %16-19r, %o", - 0x00600000, 0x0de00000, "rsb%c%20's %12-15r, %16-19r, %o", - 0x00800000, 0x0de00000, "add%c%20's %12-15r, %16-19r, %o", - 0x00a00000, 0x0de00000, "adc%c%20's %12-15r, %16-19r, %o", - 0x00c00000, 0x0de00000, "sbc%c%20's %12-15r, %16-19r, %o", - 0x00e00000, 0x0de00000, "rsc%c%20's %12-15r, %16-19r, %o", - 0x01000000, 0x0de00000, "tst%c%p %16-19r, %o", - 0x01200000, 0x0de00000, "teq%c%p %16-19r, %o", - 0x01400000, 0x0de00000, "cmp%c%p %16-19r, %o", - 0x01600000, 0x0de00000, "cmn%c%p %16-19r, %o", - 0x01800000, 0x0de00000, "orr%c%20's %12-15r, %16-19r, %o", - 0x01a00000, 0x0de00000, "mov%c%20's %12-15r, %o", - 0x01c00000, 0x0de00000, "bic%c%20's %12-15r, %16-19r, %o", - 0x01e00000, 0x0de00000, "mvn%c%20's %12-15r, %o", - 0x04000000, 0x0c100000, "str%c%22'b %12-15r, %a", - 0x04100000, 0x0c100000, "ldr%c%22'b %12-15r, %a", - 0x08000000, 0x0e100000, "stm%c%23?id%24?ba %16-19r%22`!, %m", - 0x08100000, 0x0e100000, "ldm%c%23?id%24?ba %16-19r%22`!, %m%22'^", - 0x0a000000, 0x0e000000, "b%c%24'l %b", - 0x0f000000, 0x0f000000, "swi%c %0-23x", - /* Floating point coprocessor instructions */ - 0x0e000100, 0x0ff08f10, "adf%c%P%R %12-14f, %16-18f, %0-3f", - 0x0e100100, 0x0ff08f10, "muf%c%P%R %12-14f, %16-18f, %0-3f", - 0x0e200100, 0x0ff08f10, "suf%c%P%R %12-14f, %16-18f, %0-3f", - 0x0e300100, 0x0ff08f10, "rsf%c%P%R %12-14f, %16-18f, %0-3f", - 0x0e400100, 0x0ff08f10, "dvf%c%P%R %12-14f, %16-18f, %0-3f", - 0x0e500100, 0x0ff08f10, "rdf%c%P%R %12-14f, %16-18f, %0-3f", - 0x0e600100, 0x0ff08f10, "pow%c%P%R %12-14f, %16-18f, %0-3f", - 0x0e700100, 0x0ff08f10, "rpw%c%P%R %12-14f, %16-18f, %0-3f", - 0x0e800100, 0x0ff08f10, "rmf%c%P%R %12-14f, %16-18f, %0-3f", - 0x0e900100, 0x0ff08f10, "fml%c%P%R %12-14f, %16-18f, %0-3f", - 0x0ea00100, 0x0ff08f10, "fdv%c%P%R %12-14f, %16-18f, %0-3f", - 0x0eb00100, 0x0ff08f10, "frd%c%P%R %12-14f, %16-18f, %0-3f", - 0x0ec00100, 0x0ff08f10, "pol%c%P%R %12-14f, %16-18f, %0-3f", - 0x0e008100, 0x0ff08f10, "mvf%c%P%R %12-14f, %0-3f", - 0x0e108100, 0x0ff08f10, "mnf%c%P%R %12-14f, %0-3f", - 0x0e208100, 0x0ff08f10, "abs%c%P%R %12-14f, %0-3f", - 0x0e308100, 0x0ff08f10, "rnd%c%P%R %12-14f, %0-3f", - 0x0e408100, 0x0ff08f10, "sqt%c%P%R %12-14f, %0-3f", - 0x0e508100, 0x0ff08f10, "log%c%P%R %12-14f, %0-3f", - 0x0e608100, 0x0ff08f10, "lgn%c%P%R %12-14f, %0-3f", - 0x0e708100, 0x0ff08f10, "exp%c%P%R %12-14f, %0-3f", - 0x0e808100, 0x0ff08f10, "sin%c%P%R %12-14f, %0-3f", - 0x0e908100, 0x0ff08f10, "cos%c%P%R %12-14f, %0-3f", - 0x0ea08100, 0x0ff08f10, "tan%c%P%R %12-14f, %0-3f", - 0x0eb08100, 0x0ff08f10, "asn%c%P%R %12-14f, %0-3f", - 0x0ec08100, 0x0ff08f10, "acs%c%P%R %12-14f, %0-3f", - 0x0ed08100, 0x0ff08f10, "atn%c%P%R %12-14f, %0-3f", - 0x0e000110, 0x0ff00f1f, "flt%c%P%R %16-18f, %12-15r", - 0x0e100110, 0x0fff0f98, "fix%c%R %12-15r, %0-2f", - 0x0e200110, 0x0fff0fff, "wfs%c %12-15r", - 0x0e300110, 0x0fff0fff, "rfs%c %12-15r", - 0x0e400110, 0x0fff0fff, "wfc%c %12-15r", - 0x0e500110, 0x0fff0fff, "rfc%c %12-15r", - 0x0e90f110, 0x0ff8fff0, "cmf%c %16-18f, %0-3f", - 0x0eb0f110, 0x0ff8fff0, "cnf%c %16-18f, %0-3f", - 0x0ed0f110, 0x0ff8fff0, "cmfe%c %16-18f, %0-3f", - 0x0ef0f110, 0x0ff8fff0, "cnfe%c %16-18f, %0-3f", - 0x0c000100, 0x0e100f00, "stf%c%Q %12-14f, %A", - 0x0c100100, 0x0e100f00, "ldf%c%Q %12-14f, %A", - /* Generic coprocessor instructions */ - 0x0e000000, 0x0f000010, "cdp%c %8-11d, %20-23d, cr%12-15d, cr%16-19d, cr%0-3d, {%5-7d}", - 0x0e000010, 0x0f100010, "mrc%c %8-11d, %21-23d, %12-15r, cr%16-19d, cr%0-3d, {%5-7d}", - 0x0e100010, 0x0f100010, "mcr%c %8-11d, %21-23d, %12-15r, cr%16-19d, cr%0-3d, {%5-7d}", - 0x0c000000, 0x0e100000, "stc%c%22`l %8-11d, cr%12-15d, %A", - 0x0c100000, 0x0e100000, "ldc%c%22`l %8-11d, cr%12-15d, %A", - /* the rest */ - 0x00000000, 0x00000000, "undefined instruction %0-31x", -}; -#define N_OPCODES (sizeof opcodes / sizeof opcodes[0]) diff --git a/contrib/gdb/include/opcode/convex.h b/contrib/gdb/include/opcode/convex.h deleted file mode 100644 index efaeebb..0000000 --- a/contrib/gdb/include/opcode/convex.h +++ /dev/null @@ -1,1711 +0,0 @@ -/* Information for instruction disassembly on the Convex. - Copyright 1989, 1993 Free Software Foundation. - -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 CONST -#define CONST -#endif /* CONST */ - -#define xxx 0 -#define rrr 1 -#define rr 2 -#define rxr 3 -#define r 4 -#define nops 5 -#define nr 6 -#define pcrel 7 -#define lr 8 -#define rxl 9 -#define rlr 10 -#define rrl 11 -#define iml 12 -#define imr 13 -#define a1r 14 -#define a1l 15 -#define a2r 16 -#define a2l 17 -#define a3 18 -#define a4 19 -#define a5 20 -#define V 1 -#define S 2 -#define VM 3 -#define A 4 -#define VL 5 -#define VS 6 -#define VLS 7 -#define PSW 8 -/* Prevent an error during "make depend". */ -#if !defined (PC) -#define PC 9 -#endif -#define ITR 10 -#define VV 11 -#define ITSR 12 -#define TOC 13 -#define CIR 14 -#define TTR 15 -#define VMU 16 -#define VML 17 -#define ICR 18 -#define TCPU 19 -#define CPUID 20 -#define TID 21 - -CONST char *op[] = { - "", - "v0\0v1\0v2\0v3\0v4\0v5\0v6\0v7", - "s0\0s1\0s2\0s3\0s4\0s5\0s6\0s7", - "vm", - "sp\0a1\0a2\0a3\0a4\0a5\0ap\0fp", - "vl", - "vs", - "vls", - "psw", - "pc", - "itr", - "vv", - "itsr", - "toc", - "cir", - "ttr", - "vmu", - "vml", - "icr", - "tcpu", - "cpuid", - "tid", -}; - -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 */ - {2,1,rrr,V,V,V}, /* mask.t */ - {1,2,rrr,V,S,V}, /* merg.f */ - {2,2,rrr,V,S,V}, /* mask.f */ - {1,1,rrr,V,S,V}, /* merg.t */ - {2,1,rrr,V,S,V}, /* mask.t */ - {3,3,rrr,V,V,V}, /* mul.s */ - {3,4,rrr,V,V,V}, /* mul.d */ - {4,3,rrr,V,V,V}, /* div.s */ - {4,4,rrr,V,V,V}, /* div.d */ - {3,3,rrr,V,S,V}, /* mul.s */ - {3,4,rrr,V,S,V}, /* mul.d */ - {4,3,rrr,V,S,V}, /* div.s */ - {4,4,rrr,V,S,V}, /* div.d */ - {5,0,rrr,V,V,V}, /* and */ - {6,0,rrr,V,V,V}, /* or */ - {7,0,rrr,V,V,V}, /* xor */ - {8,0,rrr,V,V,V}, /* shf */ - {5,0,rrr,V,S,V}, /* and */ - {6,0,rrr,V,S,V}, /* or */ - {7,0,rrr,V,S,V}, /* xor */ - {8,0,rrr,V,S,V}, /* shf */ - {9,3,rrr,V,V,V}, /* add.s */ - {9,4,rrr,V,V,V}, /* add.d */ - {10,3,rrr,V,V,V}, /* sub.s */ - {10,4,rrr,V,V,V}, /* sub.d */ - {9,3,rrr,V,S,V}, /* add.s */ - {9,4,rrr,V,S,V}, /* add.d */ - {10,3,rrr,V,S,V}, /* sub.s */ - {10,4,rrr,V,S,V}, /* sub.d */ - {9,5,rrr,V,V,V}, /* add.b */ - {9,6,rrr,V,V,V}, /* add.h */ - {9,7,rrr,V,V,V}, /* add.w */ - {9,8,rrr,V,V,V}, /* add.l */ - {9,5,rrr,V,S,V}, /* add.b */ - {9,6,rrr,V,S,V}, /* add.h */ - {9,7,rrr,V,S,V}, /* add.w */ - {9,8,rrr,V,S,V}, /* add.l */ - {10,5,rrr,V,V,V}, /* sub.b */ - {10,6,rrr,V,V,V}, /* sub.h */ - {10,7,rrr,V,V,V}, /* sub.w */ - {10,8,rrr,V,V,V}, /* sub.l */ - {10,5,rrr,V,S,V}, /* sub.b */ - {10,6,rrr,V,S,V}, /* sub.h */ - {10,7,rrr,V,S,V}, /* sub.w */ - {10,8,rrr,V,S,V}, /* sub.l */ - {3,5,rrr,V,V,V}, /* mul.b */ - {3,6,rrr,V,V,V}, /* mul.h */ - {3,7,rrr,V,V,V}, /* mul.w */ - {3,8,rrr,V,V,V}, /* mul.l */ - {3,5,rrr,V,S,V}, /* mul.b */ - {3,6,rrr,V,S,V}, /* mul.h */ - {3,7,rrr,V,S,V}, /* mul.w */ - {3,8,rrr,V,S,V}, /* mul.l */ - {4,5,rrr,V,V,V}, /* div.b */ - {4,6,rrr,V,V,V}, /* div.h */ - {4,7,rrr,V,V,V}, /* div.w */ - {4,8,rrr,V,V,V}, /* div.l */ - {4,5,rrr,V,S,V}, /* div.b */ - {4,6,rrr,V,S,V}, /* div.h */ - {4,7,rrr,V,S,V}, /* div.w */ - {4,8,rrr,V,S,V}, /* div.l */ -}; - -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 */ - {13,1,a3,0,0,0}, /* jmpi.t */ - {14,2,a3,0,0,0}, /* jmpa.f */ - {14,1,a3,0,0,0}, /* jmpa.t */ - {15,2,a3,0,0,0}, /* jmps.f */ - {15,1,a3,0,0,0}, /* jmps.t */ - {16,0,a3,0,0,0}, /* tac */ - {17,0,a1r,A,0,0}, /* ldea */ - {18,8,a1l,VLS,0,0}, /* ld.l */ - {18,9,a1l,VM,0,0}, /* ld.x */ - {19,0,a3,0,0,0}, /* tas */ - {20,0,a3,0,0,0}, /* pshea */ - {21,8,a2l,VLS,0,0}, /* st.l */ - {21,9,a2l,VM,0,0}, /* st.x */ - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {22,0,a3,0,0,0}, /* call */ - {23,0,a3,0,0,0}, /* calls */ - {24,0,a3,0,0,0}, /* callq */ - {25,0,a1r,A,0,0}, /* pfork */ - {26,5,a2r,S,0,0}, /* ste.b */ - {26,6,a2r,S,0,0}, /* ste.h */ - {26,7,a2r,S,0,0}, /* ste.w */ - {26,8,a2r,S,0,0}, /* ste.l */ - {18,5,a1r,A,0,0}, /* ld.b */ - {18,6,a1r,A,0,0}, /* ld.h */ - {18,7,a1r,A,0,0}, /* ld.w */ - {27,7,a1r,A,0,0}, /* incr.w */ - {21,5,a2r,A,0,0}, /* st.b */ - {21,6,a2r,A,0,0}, /* st.h */ - {21,7,a2r,A,0,0}, /* st.w */ - {27,8,a1r,S,0,0}, /* incr.l */ - {18,5,a1r,S,0,0}, /* ld.b */ - {18,6,a1r,S,0,0}, /* ld.h */ - {18,7,a1r,S,0,0}, /* ld.w */ - {18,8,a1r,S,0,0}, /* ld.l */ - {21,5,a2r,S,0,0}, /* st.b */ - {21,6,a2r,S,0,0}, /* st.h */ - {21,7,a2r,S,0,0}, /* st.w */ - {21,8,a2r,S,0,0}, /* st.l */ - {18,5,a1r,V,0,0}, /* ld.b */ - {18,6,a1r,V,0,0}, /* ld.h */ - {18,7,a1r,V,0,0}, /* ld.w */ - {18,8,a1r,V,0,0}, /* ld.l */ - {21,5,a2r,V,0,0}, /* st.b */ - {21,6,a2r,V,0,0}, /* st.h */ - {21,7,a2r,V,0,0}, /* st.w */ - {21,8,a2r,V,0,0}, /* st.l */ -}; - -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 */ - {30,7,rr,A,A,0}, /* cvth.w */ - {28,5,rr,S,S,0}, /* cvtw.b */ - {28,6,rr,S,S,0}, /* cvtw.h */ - {29,7,rr,S,S,0}, /* cvtb.w */ - {30,7,rr,S,S,0}, /* cvth.w */ - {28,3,rr,S,S,0}, /* cvtw.s */ - {31,7,rr,S,S,0}, /* cvts.w */ - {32,3,rr,S,S,0}, /* cvtd.s */ - {31,4,rr,S,S,0}, /* cvts.d */ - {31,8,rr,S,S,0}, /* cvts.l */ - {32,8,rr,S,S,0}, /* cvtd.l */ - {33,3,rr,S,S,0}, /* cvtl.s */ - {33,4,rr,S,S,0}, /* cvtl.d */ - {34,0,rr,A,A,0}, /* ldpa */ - {8,0,nr,A,0,0}, /* shf */ - {18,6,nr,A,0,0}, /* ld.h */ - {18,7,nr,A,0,0}, /* ld.w */ - {33,7,rr,S,S,0}, /* cvtl.w */ - {28,8,rr,S,S,0}, /* cvtw.l */ - {35,1,rr,S,S,0}, /* plc.t */ - {36,0,rr,S,S,0}, /* tzc */ - {37,6,rr,A,A,0}, /* eq.h */ - {37,7,rr,A,A,0}, /* eq.w */ - {37,6,nr,A,0,0}, /* eq.h */ - {37,7,nr,A,0,0}, /* eq.w */ - {37,5,rr,S,S,0}, /* eq.b */ - {37,6,rr,S,S,0}, /* eq.h */ - {37,7,rr,S,S,0}, /* eq.w */ - {37,8,rr,S,S,0}, /* eq.l */ - {38,6,rr,A,A,0}, /* leu.h */ - {38,7,rr,A,A,0}, /* leu.w */ - {38,6,nr,A,0,0}, /* leu.h */ - {38,7,nr,A,0,0}, /* leu.w */ - {38,5,rr,S,S,0}, /* leu.b */ - {38,6,rr,S,S,0}, /* leu.h */ - {38,7,rr,S,S,0}, /* leu.w */ - {38,8,rr,S,S,0}, /* leu.l */ - {39,6,rr,A,A,0}, /* ltu.h */ - {39,7,rr,A,A,0}, /* ltu.w */ - {39,6,nr,A,0,0}, /* ltu.h */ - {39,7,nr,A,0,0}, /* ltu.w */ - {39,5,rr,S,S,0}, /* ltu.b */ - {39,6,rr,S,S,0}, /* ltu.h */ - {39,7,rr,S,S,0}, /* ltu.w */ - {39,8,rr,S,S,0}, /* ltu.l */ - {40,6,rr,A,A,0}, /* le.h */ - {40,7,rr,A,A,0}, /* le.w */ - {40,6,nr,A,0,0}, /* le.h */ - {40,7,nr,A,0,0}, /* le.w */ - {40,5,rr,S,S,0}, /* le.b */ - {40,6,rr,S,S,0}, /* le.h */ - {40,7,rr,S,S,0}, /* le.w */ - {40,8,rr,S,S,0}, /* le.l */ - {41,6,rr,A,A,0}, /* lt.h */ - {41,7,rr,A,A,0}, /* lt.w */ - {41,6,nr,A,0,0}, /* lt.h */ - {41,7,nr,A,0,0}, /* lt.w */ - {41,5,rr,S,S,0}, /* lt.b */ - {41,6,rr,S,S,0}, /* lt.h */ - {41,7,rr,S,S,0}, /* lt.w */ - {41,8,rr,S,S,0}, /* lt.l */ - {9,7,rr,S,A,0}, /* add.w */ - {8,0,rr,A,A,0}, /* shf */ - {0,0,rr,A,A,0}, /* mov */ - {0,0,rr,S,A,0}, /* mov */ - {0,7,rr,S,S,0}, /* mov.w */ - {8,0,rr,S,S,0}, /* shf */ - {0,0,rr,S,S,0}, /* mov */ - {0,0,rr,A,S,0}, /* mov */ - {5,0,rr,A,A,0}, /* and */ - {6,0,rr,A,A,0}, /* or */ - {7,0,rr,A,A,0}, /* xor */ - {42,0,rr,A,A,0}, /* not */ - {5,0,rr,S,S,0}, /* and */ - {6,0,rr,S,S,0}, /* or */ - {7,0,rr,S,S,0}, /* xor */ - {42,0,rr,S,S,0}, /* not */ - {40,3,rr,S,S,0}, /* le.s */ - {40,4,rr,S,S,0}, /* le.d */ - {41,3,rr,S,S,0}, /* lt.s */ - {41,4,rr,S,S,0}, /* lt.d */ - {9,3,rr,S,S,0}, /* add.s */ - {9,4,rr,S,S,0}, /* add.d */ - {10,3,rr,S,S,0}, /* sub.s */ - {10,4,rr,S,S,0}, /* sub.d */ - {37,3,rr,S,S,0}, /* eq.s */ - {37,4,rr,S,S,0}, /* eq.d */ - {43,6,rr,A,A,0}, /* neg.h */ - {43,7,rr,A,A,0}, /* neg.w */ - {3,3,rr,S,S,0}, /* mul.s */ - {3,4,rr,S,S,0}, /* mul.d */ - {4,3,rr,S,S,0}, /* div.s */ - {4,4,rr,S,S,0}, /* div.d */ - {9,6,rr,A,A,0}, /* add.h */ - {9,7,rr,A,A,0}, /* add.w */ - {9,6,nr,A,0,0}, /* add.h */ - {9,7,nr,A,0,0}, /* add.w */ - {9,5,rr,S,S,0}, /* add.b */ - {9,6,rr,S,S,0}, /* add.h */ - {9,7,rr,S,S,0}, /* add.w */ - {9,8,rr,S,S,0}, /* add.l */ - {10,6,rr,A,A,0}, /* sub.h */ - {10,7,rr,A,A,0}, /* sub.w */ - {10,6,nr,A,0,0}, /* sub.h */ - {10,7,nr,A,0,0}, /* sub.w */ - {10,5,rr,S,S,0}, /* sub.b */ - {10,6,rr,S,S,0}, /* sub.h */ - {10,7,rr,S,S,0}, /* sub.w */ - {10,8,rr,S,S,0}, /* sub.l */ - {3,6,rr,A,A,0}, /* mul.h */ - {3,7,rr,A,A,0}, /* mul.w */ - {3,6,nr,A,0,0}, /* mul.h */ - {3,7,nr,A,0,0}, /* mul.w */ - {3,5,rr,S,S,0}, /* mul.b */ - {3,6,rr,S,S,0}, /* mul.h */ - {3,7,rr,S,S,0}, /* mul.w */ - {3,8,rr,S,S,0}, /* mul.l */ - {4,6,rr,A,A,0}, /* div.h */ - {4,7,rr,A,A,0}, /* div.w */ - {4,6,nr,A,0,0}, /* div.h */ - {4,7,nr,A,0,0}, /* div.w */ - {4,5,rr,S,S,0}, /* div.b */ - {4,6,rr,S,S,0}, /* div.h */ - {4,7,rr,S,S,0}, /* div.w */ - {4,8,rr,S,S,0}, /* div.l */ -}; - -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 */ - {32,8,rr,V,V,0}, /* cvtd.l */ - {0,0,rrl,S,S,VM}, /* mov */ - {0,0,rlr,S,VM,S}, /* mov */ - {0,0,0,0,0,0}, - {44,0,rr,S,S,0}, /* lop */ - {36,0,rr,V,V,0}, /* tzc */ - {44,0,rr,V,V,0}, /* lop */ - {0,0,0,0,0,0}, - {42,0,rr,V,V,0}, /* not */ - {8,0,rr,S,V,0}, /* shf */ - {35,1,rr,V,V,0}, /* plc.t */ - {45,2,rr,V,V,0}, /* cprs.f */ - {45,1,rr,V,V,0}, /* cprs.t */ - {37,3,rr,V,V,0}, /* eq.s */ - {37,4,rr,V,V,0}, /* eq.d */ - {43,3,rr,V,V,0}, /* neg.s */ - {43,4,rr,V,V,0}, /* neg.d */ - {37,3,rr,S,V,0}, /* eq.s */ - {37,4,rr,S,V,0}, /* eq.d */ - {43,3,rr,S,S,0}, /* neg.s */ - {43,4,rr,S,S,0}, /* neg.d */ - {40,3,rr,V,V,0}, /* le.s */ - {40,4,rr,V,V,0}, /* le.d */ - {41,3,rr,V,V,0}, /* lt.s */ - {41,4,rr,V,V,0}, /* lt.d */ - {40,3,rr,S,V,0}, /* le.s */ - {40,4,rr,S,V,0}, /* le.d */ - {41,3,rr,S,V,0}, /* lt.s */ - {41,4,rr,S,V,0}, /* lt.d */ - {37,5,rr,V,V,0}, /* eq.b */ - {37,6,rr,V,V,0}, /* eq.h */ - {37,7,rr,V,V,0}, /* eq.w */ - {37,8,rr,V,V,0}, /* eq.l */ - {37,5,rr,S,V,0}, /* eq.b */ - {37,6,rr,S,V,0}, /* eq.h */ - {37,7,rr,S,V,0}, /* eq.w */ - {37,8,rr,S,V,0}, /* eq.l */ - {40,5,rr,V,V,0}, /* le.b */ - {40,6,rr,V,V,0}, /* le.h */ - {40,7,rr,V,V,0}, /* le.w */ - {40,8,rr,V,V,0}, /* le.l */ - {40,5,rr,S,V,0}, /* le.b */ - {40,6,rr,S,V,0}, /* le.h */ - {40,7,rr,S,V,0}, /* le.w */ - {40,8,rr,S,V,0}, /* le.l */ - {41,5,rr,V,V,0}, /* lt.b */ - {41,6,rr,V,V,0}, /* lt.h */ - {41,7,rr,V,V,0}, /* lt.w */ - {41,8,rr,V,V,0}, /* lt.l */ - {41,5,rr,S,V,0}, /* lt.b */ - {41,6,rr,S,V,0}, /* lt.h */ - {41,7,rr,S,V,0}, /* lt.w */ - {41,8,rr,S,V,0}, /* lt.l */ - {43,5,rr,V,V,0}, /* neg.b */ - {43,6,rr,V,V,0}, /* neg.h */ - {43,7,rr,V,V,0}, /* neg.w */ - {43,8,rr,V,V,0}, /* neg.l */ - {43,5,rr,S,S,0}, /* neg.b */ - {43,6,rr,S,S,0}, /* neg.h */ - {43,7,rr,S,S,0}, /* neg.w */ - {43,8,rr,S,S,0}, /* neg.l */ -}; - -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 */ - {48,1,pcrel,0,0,0}, /* bri.t */ - {49,2,pcrel,0,0,0}, /* bra.f */ - {49,1,pcrel,0,0,0}, /* bra.t */ - {50,2,pcrel,0,0,0}, /* brs.f */ - {50,1,pcrel,0,0,0}, /* brs.t */ -}; - -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 */ - {51,8,rr,V,V,0}, /* ldvi.l */ - {28,3,rr,V,V,0}, /* cvtw.s */ - {31,7,rr,V,V,0}, /* cvts.w */ - {28,8,rr,V,V,0}, /* cvtw.l */ - {33,7,rr,V,V,0}, /* cvtl.w */ - {52,5,rxr,V,V,0}, /* stvi.b */ - {52,6,rxr,V,V,0}, /* stvi.h */ - {52,7,rxr,V,V,0}, /* stvi.w */ - {52,8,rxr,V,V,0}, /* stvi.l */ - {52,5,rxr,S,V,0}, /* stvi.b */ - {52,6,rxr,S,V,0}, /* stvi.h */ - {52,7,rxr,S,V,0}, /* stvi.w */ - {52,8,rxr,S,V,0}, /* stvi.l */ -}; - -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 */ - {55,4,r,S,0,0}, /* ln.d */ - {56,0,nops,0,0,0}, /* patu */ - {57,0,r,A,0,0}, /* pate */ - {58,0,nops,0,0,0}, /* pich */ - {59,0,nops,0,0,0}, /* plch */ - {0,0,lr,PSW,A,0}, /* mov */ - {0,0,rxl,A,PSW,0}, /* mov */ - {0,0,lr,PC,A,0}, /* mov */ - {60,0,r,S,0,0}, /* idle */ - {0,0,lr,ITR,S,0}, /* mov */ - {0,0,rxl,S,ITR,0}, /* mov */ - {0,0,0,0,0,0}, - {0,0,rxl,S,ITSR,0}, /* mov */ - {61,0,nops,0,0,0}, /* rtnq */ - {62,0,nops,0,0,0}, /* cfork */ - {63,0,nops,0,0,0}, /* rtn */ - {64,0,nops,0,0,0}, /* wfork */ - {65,0,nops,0,0,0}, /* join */ - {66,0,nops,0,0,0}, /* rtnc */ - {67,3,r,S,0,0}, /* exp.s */ - {67,4,r,S,0,0}, /* exp.d */ - {68,3,r,S,0,0}, /* sin.s */ - {68,4,r,S,0,0}, /* sin.d */ - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {69,3,r,S,0,0}, /* cos.s */ - {69,4,r,S,0,0}, /* cos.d */ - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {70,7,r,A,0,0}, /* psh.w */ - {0,0,0,0,0,0}, - {71,7,r,A,0,0}, /* pop.w */ - {0,0,0,0,0,0}, - {70,7,r,S,0,0}, /* psh.w */ - {70,8,r,S,0,0}, /* psh.l */ - {71,7,r,S,0,0}, /* pop.w */ - {71,8,r,S,0,0}, /* pop.l */ - {72,0,nops,0,0,0}, /* eni */ - {73,0,nops,0,0,0}, /* dsi */ - {74,0,nops,0,0,0}, /* bkpt */ - {75,0,nops,0,0,0}, /* msync */ - {76,0,r,S,0,0}, /* mski */ - {77,0,r,S,0,0}, /* xmti */ - {0,0,rxl,S,VV,0}, /* mov */ - {78,0,nops,0,0,0}, /* tstvv */ - {0,0,lr,VS,A,0}, /* mov */ - {0,0,rxl,A,VS,0}, /* mov */ - {0,0,lr,VL,A,0}, /* mov */ - {0,0,rxl,A,VL,0}, /* mov */ - {0,7,lr,VS,S,0}, /* mov.w */ - {0,7,rxl,S,VS,0}, /* mov.w */ - {0,7,lr,VL,S,0}, /* mov.w */ - {0,7,rxl,S,VL,0}, /* mov.w */ - {79,0,r,A,0,0}, /* diag */ - {80,0,nops,0,0,0}, /* pbkpt */ - {81,3,r,S,0,0}, /* sqrt.s */ - {81,4,r,S,0,0}, /* sqrt.d */ - {82,0,nops,0,0,0}, /* casr */ - {0,0,0,0,0,0}, - {83,3,r,S,0,0}, /* atan.s */ - {83,4,r,S,0,0}, /* atan.d */ -}; - -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 */ - {84,8,r,V,0,0}, /* sum.l */ - {85,0,r,V,0,0}, /* all */ - {86,0,r,V,0,0}, /* any */ - {87,0,r,V,0,0}, /* parity */ - {0,0,0,0,0,0}, - {88,5,r,V,0,0}, /* max.b */ - {88,6,r,V,0,0}, /* max.h */ - {88,7,r,V,0,0}, /* max.w */ - {88,8,r,V,0,0}, /* max.l */ - {89,5,r,V,0,0}, /* min.b */ - {89,6,r,V,0,0}, /* min.h */ - {89,7,r,V,0,0}, /* min.w */ - {89,8,r,V,0,0}, /* min.l */ - {84,3,r,V,0,0}, /* sum.s */ - {84,4,r,V,0,0}, /* sum.d */ - {90,3,r,V,0,0}, /* prod.s */ - {90,4,r,V,0,0}, /* prod.d */ - {88,3,r,V,0,0}, /* max.s */ - {88,4,r,V,0,0}, /* max.d */ - {89,3,r,V,0,0}, /* min.s */ - {89,4,r,V,0,0}, /* min.d */ - {90,5,r,V,0,0}, /* prod.b */ - {90,6,r,V,0,0}, /* prod.h */ - {90,7,r,V,0,0}, /* prod.w */ - {90,8,r,V,0,0}, /* prod.l */ - {35,2,lr,VM,S,0}, /* plc.f */ - {35,1,lr,VM,S,0}, /* plc.t */ - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, -}; - -CONST struct formstr formatx[] = { - {0,0,0,0,0,0}, -}; - -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 */ - {18,7,imr,A,0,0}, /* ld.w */ - {5,0,imr,A,0,0}, /* and */ - {6,0,imr,A,0,0}, /* or */ - {7,0,imr,A,0,0}, /* xor */ - {8,0,imr,A,0,0}, /* shf */ - {9,6,imr,A,0,0}, /* add.h */ - {9,7,imr,A,0,0}, /* add.w */ - {10,6,imr,A,0,0}, /* sub.h */ - {10,7,imr,A,0,0}, /* sub.w */ - {3,6,imr,A,0,0}, /* mul.h */ - {3,7,imr,A,0,0}, /* mul.w */ - {4,6,imr,A,0,0}, /* div.h */ - {4,7,imr,A,0,0}, /* div.w */ - {18,7,iml,VL,0,0}, /* ld.w */ - {18,7,iml,VS,0,0}, /* ld.w */ - {0,0,0,0,0,0}, - {8,7,imr,S,0,0}, /* shf.w */ - {93,0,a5,0,0,0}, /* trap */ - {0,0,0,0,0,0}, - {37,6,imr,A,0,0}, /* eq.h */ - {37,7,imr,A,0,0}, /* eq.w */ - {38,6,imr,A,0,0}, /* leu.h */ - {38,7,imr,A,0,0}, /* leu.w */ - {39,6,imr,A,0,0}, /* ltu.h */ - {39,7,imr,A,0,0}, /* ltu.w */ - {40,6,imr,A,0,0}, /* le.h */ - {40,7,imr,A,0,0}, /* le.w */ - {41,6,imr,A,0,0}, /* lt.h */ - {41,7,imr,A,0,0}, /* lt.w */ -}; - -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 */ - {18,7,imr,S,0,0}, /* ld.w */ - {5,0,imr,S,0,0}, /* and */ - {6,0,imr,S,0,0}, /* or */ - {7,0,imr,S,0,0}, /* xor */ - {8,0,imr,S,0,0}, /* shf */ - {9,6,imr,S,0,0}, /* add.h */ - {9,7,imr,S,0,0}, /* add.w */ - {10,6,imr,S,0,0}, /* sub.h */ - {10,7,imr,S,0,0}, /* sub.w */ - {3,6,imr,S,0,0}, /* mul.h */ - {3,7,imr,S,0,0}, /* mul.w */ - {4,6,imr,S,0,0}, /* div.h */ - {4,7,imr,S,0,0}, /* div.w */ - {9,3,imr,S,0,0}, /* add.s */ - {10,3,imr,S,0,0}, /* sub.s */ - {3,3,imr,S,0,0}, /* mul.s */ - {4,3,imr,S,0,0}, /* div.s */ - {40,3,imr,S,0,0}, /* le.s */ - {41,3,imr,S,0,0}, /* lt.s */ - {37,6,imr,S,0,0}, /* eq.h */ - {37,7,imr,S,0,0}, /* eq.w */ - {38,6,imr,S,0,0}, /* leu.h */ - {38,7,imr,S,0,0}, /* leu.w */ - {39,6,imr,S,0,0}, /* ltu.h */ - {39,7,imr,S,0,0}, /* ltu.w */ - {40,6,imr,S,0,0}, /* le.h */ - {40,7,imr,S,0,0}, /* le.w */ - {41,6,imr,S,0,0}, /* lt.h */ - {41,7,imr,S,0,0}, /* lt.w */ -}; - -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 */ - {4,4,rrr,S,V,V}, /* div.d */ - {10,11,rrr,S,V,V}, /* sub.s.f */ - {10,12,rrr,S,V,V}, /* sub.d.f */ - {4,11,rrr,S,V,V}, /* div.s.f */ - {4,12,rrr,S,V,V}, /* div.d.f */ - {3,11,rrr,V,V,V}, /* mul.s.f */ - {3,12,rrr,V,V,V}, /* mul.d.f */ - {4,11,rrr,V,V,V}, /* div.s.f */ - {4,12,rrr,V,V,V}, /* div.d.f */ - {3,11,rrr,V,S,V}, /* mul.s.f */ - {3,12,rrr,V,S,V}, /* mul.d.f */ - {4,11,rrr,V,S,V}, /* div.s.f */ - {4,12,rrr,V,S,V}, /* div.d.f */ - {5,2,rrr,V,V,V}, /* and.f */ - {6,2,rrr,V,V,V}, /* or.f */ - {7,2,rrr,V,V,V}, /* xor.f */ - {8,2,rrr,V,V,V}, /* shf.f */ - {5,2,rrr,V,S,V}, /* and.f */ - {6,2,rrr,V,S,V}, /* or.f */ - {7,2,rrr,V,S,V}, /* xor.f */ - {8,2,rrr,V,S,V}, /* shf.f */ - {9,11,rrr,V,V,V}, /* add.s.f */ - {9,12,rrr,V,V,V}, /* add.d.f */ - {10,11,rrr,V,V,V}, /* sub.s.f */ - {10,12,rrr,V,V,V}, /* sub.d.f */ - {9,11,rrr,V,S,V}, /* add.s.f */ - {9,12,rrr,V,S,V}, /* add.d.f */ - {10,11,rrr,V,S,V}, /* sub.s.f */ - {10,12,rrr,V,S,V}, /* sub.d.f */ - {9,13,rrr,V,V,V}, /* add.b.f */ - {9,14,rrr,V,V,V}, /* add.h.f */ - {9,15,rrr,V,V,V}, /* add.w.f */ - {9,16,rrr,V,V,V}, /* add.l.f */ - {9,13,rrr,V,S,V}, /* add.b.f */ - {9,14,rrr,V,S,V}, /* add.h.f */ - {9,15,rrr,V,S,V}, /* add.w.f */ - {9,16,rrr,V,S,V}, /* add.l.f */ - {10,13,rrr,V,V,V}, /* sub.b.f */ - {10,14,rrr,V,V,V}, /* sub.h.f */ - {10,15,rrr,V,V,V}, /* sub.w.f */ - {10,16,rrr,V,V,V}, /* sub.l.f */ - {10,13,rrr,V,S,V}, /* sub.b.f */ - {10,14,rrr,V,S,V}, /* sub.h.f */ - {10,15,rrr,V,S,V}, /* sub.w.f */ - {10,16,rrr,V,S,V}, /* sub.l.f */ - {3,13,rrr,V,V,V}, /* mul.b.f */ - {3,14,rrr,V,V,V}, /* mul.h.f */ - {3,15,rrr,V,V,V}, /* mul.w.f */ - {3,16,rrr,V,V,V}, /* mul.l.f */ - {3,13,rrr,V,S,V}, /* mul.b.f */ - {3,14,rrr,V,S,V}, /* mul.h.f */ - {3,15,rrr,V,S,V}, /* mul.w.f */ - {3,16,rrr,V,S,V}, /* mul.l.f */ - {4,13,rrr,V,V,V}, /* div.b.f */ - {4,14,rrr,V,V,V}, /* div.h.f */ - {4,15,rrr,V,V,V}, /* div.w.f */ - {4,16,rrr,V,V,V}, /* div.l.f */ - {4,13,rrr,V,S,V}, /* div.b.f */ - {4,14,rrr,V,S,V}, /* div.h.f */ - {4,15,rrr,V,S,V}, /* div.w.f */ - {4,16,rrr,V,S,V}, /* div.l.f */ -}; - -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 */ - {96,0,a3,0,0,0}, /* ulk */ - {17,0,a1r,S,0,0}, /* ldea */ - {97,0,a1r,A,0,0}, /* spawn */ - {98,0,a1r,A,0,0}, /* ldcmr */ - {99,0,a2r,A,0,0}, /* stcmr */ - {100,0,a1r,A,0,0}, /* popr */ - {101,0,a2r,A,0,0}, /* pshr */ - {102,7,a1r,A,0,0}, /* rcvr.w */ - {103,7,a2r,A,0,0}, /* matm.w */ - {104,7,a2r,A,0,0}, /* sndr.w */ - {104,8,a2r,S,0,0}, /* sndr.l */ - {102,8,a1r,S,0,0}, /* rcvr.l */ - {103,8,a2r,S,0,0}, /* matm.l */ - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {105,7,a2r,A,0,0}, /* putr.w */ - {105,8,a2r,S,0,0}, /* putr.l */ - {106,7,a1r,A,0,0}, /* getr.w */ - {106,8,a1r,S,0,0}, /* getr.l */ - {26,13,a2r,S,0,0}, /* ste.b.f */ - {26,14,a2r,S,0,0}, /* ste.h.f */ - {26,15,a2r,S,0,0}, /* ste.w.f */ - {26,16,a2r,S,0,0}, /* ste.l.f */ - {107,7,a2r,A,0,0}, /* matr.w */ - {108,7,a2r,A,0,0}, /* mat.w */ - {109,7,a1r,A,0,0}, /* get.w */ - {110,7,a1r,A,0,0}, /* rcv.w */ - {0,0,0,0,0,0}, - {111,7,a1r,A,0,0}, /* inc.w */ - {112,7,a2r,A,0,0}, /* put.w */ - {113,7,a2r,A,0,0}, /* snd.w */ - {107,8,a2r,S,0,0}, /* matr.l */ - {108,8,a2r,S,0,0}, /* mat.l */ - {109,8,a1r,S,0,0}, /* get.l */ - {110,8,a1r,S,0,0}, /* rcv.l */ - {0,0,0,0,0,0}, - {111,8,a1r,S,0,0}, /* inc.l */ - {112,8,a2r,S,0,0}, /* put.l */ - {113,8,a2r,S,0,0}, /* snd.l */ - {18,13,a1r,V,0,0}, /* ld.b.f */ - {18,14,a1r,V,0,0}, /* ld.h.f */ - {18,15,a1r,V,0,0}, /* ld.w.f */ - {18,16,a1r,V,0,0}, /* ld.l.f */ - {21,13,a2r,V,0,0}, /* st.b.f */ - {21,14,a2r,V,0,0}, /* st.h.f */ - {21,15,a2r,V,0,0}, /* st.w.f */ - {21,16,a2r,V,0,0}, /* st.l.f */ -}; - -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 */ - {30,7,rr,V,V,0}, /* cvth.w */ - {28,13,rr,V,V,0}, /* cvtw.b.f */ - {28,14,rr,V,V,0}, /* cvtw.h.f */ - {29,15,rr,V,V,0}, /* cvtb.w.f */ - {30,15,rr,V,V,0}, /* cvth.w.f */ - {31,8,rr,V,V,0}, /* cvts.l */ - {32,7,rr,V,V,0}, /* cvtd.w */ - {33,3,rr,V,V,0}, /* cvtl.s */ - {28,4,rr,V,V,0}, /* cvtw.d */ - {31,16,rr,V,V,0}, /* cvts.l.f */ - {32,15,rr,V,V,0}, /* cvtd.w.f */ - {33,11,rr,V,V,0}, /* cvtl.s.f */ - {28,12,rr,V,V,0}, /* cvtw.d.f */ - {114,0,rr,S,S,0}, /* enal */ - {8,7,rr,S,S,0}, /* shf.w */ - {115,0,rr,S,S,0}, /* enag */ - {0,0,0,0,0,0}, - {28,4,rr,S,S,0}, /* cvtw.d */ - {32,7,rr,S,S,0}, /* cvtd.w */ - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {116,3,rr,S,S,0}, /* frint.s */ - {116,4,rr,S,S,0}, /* frint.d */ - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {116,3,rr,V,V,0}, /* frint.s */ - {116,4,rr,V,V,0}, /* frint.d */ - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {116,11,rr,V,V,0}, /* frint.s.f */ - {116,12,rr,V,V,0}, /* frint.d.f */ - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {81,3,rr,V,V,0}, /* sqrt.s */ - {81,4,rr,V,V,0}, /* sqrt.d */ - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {81,11,rr,V,V,0}, /* sqrt.s.f */ - {81,12,rr,V,V,0}, /* sqrt.d.f */ - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, -}; - -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 */ - {32,16,rr,V,V,0}, /* cvtd.l.f */ - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {36,2,rr,V,V,0}, /* tzc.f */ - {44,2,rr,V,V,0}, /* lop.f */ - {117,2,rr,V,V,0}, /* xpnd.f */ - {42,2,rr,V,V,0}, /* not.f */ - {8,2,rr,S,V,0}, /* shf.f */ - {35,17,rr,V,V,0}, /* plc.t.f */ - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {37,11,rr,V,V,0}, /* eq.s.f */ - {37,12,rr,V,V,0}, /* eq.d.f */ - {43,11,rr,V,V,0}, /* neg.s.f */ - {43,12,rr,V,V,0}, /* neg.d.f */ - {37,11,rr,S,V,0}, /* eq.s.f */ - {37,12,rr,S,V,0}, /* eq.d.f */ - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {40,11,rr,V,V,0}, /* le.s.f */ - {40,12,rr,V,V,0}, /* le.d.f */ - {41,11,rr,V,V,0}, /* lt.s.f */ - {41,12,rr,V,V,0}, /* lt.d.f */ - {40,11,rr,S,V,0}, /* le.s.f */ - {40,12,rr,S,V,0}, /* le.d.f */ - {41,11,rr,S,V,0}, /* lt.s.f */ - {41,12,rr,S,V,0}, /* lt.d.f */ - {37,13,rr,V,V,0}, /* eq.b.f */ - {37,14,rr,V,V,0}, /* eq.h.f */ - {37,15,rr,V,V,0}, /* eq.w.f */ - {37,16,rr,V,V,0}, /* eq.l.f */ - {37,13,rr,S,V,0}, /* eq.b.f */ - {37,14,rr,S,V,0}, /* eq.h.f */ - {37,15,rr,S,V,0}, /* eq.w.f */ - {37,16,rr,S,V,0}, /* eq.l.f */ - {40,13,rr,V,V,0}, /* le.b.f */ - {40,14,rr,V,V,0}, /* le.h.f */ - {40,15,rr,V,V,0}, /* le.w.f */ - {40,16,rr,V,V,0}, /* le.l.f */ - {40,13,rr,S,V,0}, /* le.b.f */ - {40,14,rr,S,V,0}, /* le.h.f */ - {40,15,rr,S,V,0}, /* le.w.f */ - {40,16,rr,S,V,0}, /* le.l.f */ - {41,13,rr,V,V,0}, /* lt.b.f */ - {41,14,rr,V,V,0}, /* lt.h.f */ - {41,15,rr,V,V,0}, /* lt.w.f */ - {41,16,rr,V,V,0}, /* lt.l.f */ - {41,13,rr,S,V,0}, /* lt.b.f */ - {41,14,rr,S,V,0}, /* lt.h.f */ - {41,15,rr,S,V,0}, /* lt.w.f */ - {41,16,rr,S,V,0}, /* lt.l.f */ - {43,13,rr,V,V,0}, /* neg.b.f */ - {43,14,rr,V,V,0}, /* neg.h.f */ - {43,15,rr,V,V,0}, /* neg.w.f */ - {43,16,rr,V,V,0}, /* neg.l.f */ - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, -}; - -CONST struct formstr e0_format4[] = { - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, -}; - -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 */ - {51,16,rr,V,V,0}, /* ldvi.l.f */ - {28,11,rr,V,V,0}, /* cvtw.s.f */ - {31,15,rr,V,V,0}, /* cvts.w.f */ - {28,16,rr,V,V,0}, /* cvtw.l.f */ - {33,15,rr,V,V,0}, /* cvtl.w.f */ - {52,13,rxr,V,V,0}, /* stvi.b.f */ - {52,14,rxr,V,V,0}, /* stvi.h.f */ - {52,15,rxr,V,V,0}, /* stvi.w.f */ - {52,16,rxr,V,V,0}, /* stvi.l.f */ - {52,13,rxr,S,V,0}, /* stvi.b.f */ - {52,14,rxr,S,V,0}, /* stvi.h.f */ - {52,15,rxr,S,V,0}, /* stvi.w.f */ - {52,16,rxr,S,V,0}, /* stvi.l.f */ -}; - -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 */ - {0,0,lr,CPUID,S,0}, /* mov */ - {0,0,rxl,S,TTR,0}, /* mov */ - {0,0,lr,TTR,S,0}, /* mov */ - {118,0,nops,0,0,0}, /* ctrsl */ - {119,0,nops,0,0,0}, /* ctrsg */ - {0,0,rxl,S,VMU,0}, /* mov */ - {0,0,lr,VMU,S,0}, /* mov */ - {0,0,rxl,S,VML,0}, /* mov */ - {0,0,lr,VML,S,0}, /* mov */ - {0,0,rxl,S,ICR,0}, /* mov */ - {0,0,lr,ICR,S,0}, /* mov */ - {0,0,rxl,S,TCPU,0}, /* mov */ - {0,0,lr,TCPU,S,0}, /* mov */ - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {120,0,nops,0,0,0}, /* stop */ - {0,0,0,0,0,0}, - {0,0,rxl,S,TID,0}, /* mov */ - {0,0,lr,TID,S,0}, /* mov */ - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, -}; - -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 */ - {84,16,r,V,0,0}, /* sum.l.f */ - {85,2,r,V,0,0}, /* all.f */ - {86,2,r,V,0,0}, /* any.f */ - {87,2,r,V,0,0}, /* parity.f */ - {0,0,0,0,0,0}, - {88,13,r,V,0,0}, /* max.b.f */ - {88,14,r,V,0,0}, /* max.h.f */ - {88,15,r,V,0,0}, /* max.w.f */ - {88,16,r,V,0,0}, /* max.l.f */ - {89,13,r,V,0,0}, /* min.b.f */ - {89,14,r,V,0,0}, /* min.h.f */ - {89,15,r,V,0,0}, /* min.w.f */ - {89,16,r,V,0,0}, /* min.l.f */ - {84,11,r,V,0,0}, /* sum.s.f */ - {84,12,r,V,0,0}, /* sum.d.f */ - {90,11,r,V,0,0}, /* prod.s.f */ - {90,12,r,V,0,0}, /* prod.d.f */ - {88,11,r,V,0,0}, /* max.s.f */ - {88,12,r,V,0,0}, /* max.d.f */ - {89,11,r,V,0,0}, /* min.s.f */ - {89,12,r,V,0,0}, /* min.d.f */ - {90,13,r,V,0,0}, /* prod.b.f */ - {90,14,r,V,0,0}, /* prod.h.f */ - {90,15,r,V,0,0}, /* prod.w.f */ - {90,16,r,V,0,0}, /* prod.l.f */ - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, -}; - -CONST struct formstr e1_format0[] = { - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {10,18,rrr,S,V,V}, /* sub.s.t */ - {10,19,rrr,S,V,V}, /* sub.d.t */ - {4,18,rrr,S,V,V}, /* div.s.t */ - {4,19,rrr,S,V,V}, /* div.d.t */ - {3,18,rrr,V,V,V}, /* mul.s.t */ - {3,19,rrr,V,V,V}, /* mul.d.t */ - {4,18,rrr,V,V,V}, /* div.s.t */ - {4,19,rrr,V,V,V}, /* div.d.t */ - {3,18,rrr,V,S,V}, /* mul.s.t */ - {3,19,rrr,V,S,V}, /* mul.d.t */ - {4,18,rrr,V,S,V}, /* div.s.t */ - {4,19,rrr,V,S,V}, /* div.d.t */ - {5,1,rrr,V,V,V}, /* and.t */ - {6,1,rrr,V,V,V}, /* or.t */ - {7,1,rrr,V,V,V}, /* xor.t */ - {8,1,rrr,V,V,V}, /* shf.t */ - {5,1,rrr,V,S,V}, /* and.t */ - {6,1,rrr,V,S,V}, /* or.t */ - {7,1,rrr,V,S,V}, /* xor.t */ - {8,1,rrr,V,S,V}, /* shf.t */ - {9,18,rrr,V,V,V}, /* add.s.t */ - {9,19,rrr,V,V,V}, /* add.d.t */ - {10,18,rrr,V,V,V}, /* sub.s.t */ - {10,19,rrr,V,V,V}, /* sub.d.t */ - {9,18,rrr,V,S,V}, /* add.s.t */ - {9,19,rrr,V,S,V}, /* add.d.t */ - {10,18,rrr,V,S,V}, /* sub.s.t */ - {10,19,rrr,V,S,V}, /* sub.d.t */ - {9,20,rrr,V,V,V}, /* add.b.t */ - {9,21,rrr,V,V,V}, /* add.h.t */ - {9,22,rrr,V,V,V}, /* add.w.t */ - {9,23,rrr,V,V,V}, /* add.l.t */ - {9,20,rrr,V,S,V}, /* add.b.t */ - {9,21,rrr,V,S,V}, /* add.h.t */ - {9,22,rrr,V,S,V}, /* add.w.t */ - {9,23,rrr,V,S,V}, /* add.l.t */ - {10,20,rrr,V,V,V}, /* sub.b.t */ - {10,21,rrr,V,V,V}, /* sub.h.t */ - {10,22,rrr,V,V,V}, /* sub.w.t */ - {10,23,rrr,V,V,V}, /* sub.l.t */ - {10,20,rrr,V,S,V}, /* sub.b.t */ - {10,21,rrr,V,S,V}, /* sub.h.t */ - {10,22,rrr,V,S,V}, /* sub.w.t */ - {10,23,rrr,V,S,V}, /* sub.l.t */ - {3,20,rrr,V,V,V}, /* mul.b.t */ - {3,21,rrr,V,V,V}, /* mul.h.t */ - {3,22,rrr,V,V,V}, /* mul.w.t */ - {3,23,rrr,V,V,V}, /* mul.l.t */ - {3,20,rrr,V,S,V}, /* mul.b.t */ - {3,21,rrr,V,S,V}, /* mul.h.t */ - {3,22,rrr,V,S,V}, /* mul.w.t */ - {3,23,rrr,V,S,V}, /* mul.l.t */ - {4,20,rrr,V,V,V}, /* div.b.t */ - {4,21,rrr,V,V,V}, /* div.h.t */ - {4,22,rrr,V,V,V}, /* div.w.t */ - {4,23,rrr,V,V,V}, /* div.l.t */ - {4,20,rrr,V,S,V}, /* div.b.t */ - {4,21,rrr,V,S,V}, /* div.h.t */ - {4,22,rrr,V,S,V}, /* div.w.t */ - {4,23,rrr,V,S,V}, /* div.l.t */ -}; - -CONST struct formstr e1_format1[] = { - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {26,20,a2r,S,0,0}, /* ste.b.t */ - {26,21,a2r,S,0,0}, /* ste.h.t */ - {26,22,a2r,S,0,0}, /* ste.w.t */ - {26,23,a2r,S,0,0}, /* ste.l.t */ - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {18,20,a1r,V,0,0}, /* ld.b.t */ - {18,21,a1r,V,0,0}, /* ld.h.t */ - {18,22,a1r,V,0,0}, /* ld.w.t */ - {18,23,a1r,V,0,0}, /* ld.l.t */ - {21,20,a2r,V,0,0}, /* st.b.t */ - {21,21,a2r,V,0,0}, /* st.h.t */ - {21,22,a2r,V,0,0}, /* st.w.t */ - {21,23,a2r,V,0,0}, /* st.l.t */ -}; - -CONST struct formstr e1_format2[] = { - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {28,20,rr,V,V,0}, /* cvtw.b.t */ - {28,21,rr,V,V,0}, /* cvtw.h.t */ - {29,22,rr,V,V,0}, /* cvtb.w.t */ - {30,22,rr,V,V,0}, /* cvth.w.t */ - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {31,23,rr,V,V,0}, /* cvts.l.t */ - {32,22,rr,V,V,0}, /* cvtd.w.t */ - {33,18,rr,V,V,0}, /* cvtl.s.t */ - {28,19,rr,V,V,0}, /* cvtw.d.t */ - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {116,18,rr,V,V,0}, /* frint.s.t */ - {116,19,rr,V,V,0}, /* frint.d.t */ - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {81,18,rr,V,V,0}, /* sqrt.s.t */ - {81,19,rr,V,V,0}, /* sqrt.d.t */ - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, -}; - -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 */ - {32,23,rr,V,V,0}, /* cvtd.l.t */ - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {36,1,rr,V,V,0}, /* tzc.t */ - {44,1,rr,V,V,0}, /* lop.t */ - {117,1,rr,V,V,0}, /* xpnd.t */ - {42,1,rr,V,V,0}, /* not.t */ - {8,1,rr,S,V,0}, /* shf.t */ - {35,24,rr,V,V,0}, /* plc.t.t */ - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {37,18,rr,V,V,0}, /* eq.s.t */ - {37,19,rr,V,V,0}, /* eq.d.t */ - {43,18,rr,V,V,0}, /* neg.s.t */ - {43,19,rr,V,V,0}, /* neg.d.t */ - {37,18,rr,S,V,0}, /* eq.s.t */ - {37,19,rr,S,V,0}, /* eq.d.t */ - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {40,18,rr,V,V,0}, /* le.s.t */ - {40,19,rr,V,V,0}, /* le.d.t */ - {41,18,rr,V,V,0}, /* lt.s.t */ - {41,19,rr,V,V,0}, /* lt.d.t */ - {40,18,rr,S,V,0}, /* le.s.t */ - {40,19,rr,S,V,0}, /* le.d.t */ - {41,18,rr,S,V,0}, /* lt.s.t */ - {41,19,rr,S,V,0}, /* lt.d.t */ - {37,20,rr,V,V,0}, /* eq.b.t */ - {37,21,rr,V,V,0}, /* eq.h.t */ - {37,22,rr,V,V,0}, /* eq.w.t */ - {37,23,rr,V,V,0}, /* eq.l.t */ - {37,20,rr,S,V,0}, /* eq.b.t */ - {37,21,rr,S,V,0}, /* eq.h.t */ - {37,22,rr,S,V,0}, /* eq.w.t */ - {37,23,rr,S,V,0}, /* eq.l.t */ - {40,20,rr,V,V,0}, /* le.b.t */ - {40,21,rr,V,V,0}, /* le.h.t */ - {40,22,rr,V,V,0}, /* le.w.t */ - {40,23,rr,V,V,0}, /* le.l.t */ - {40,20,rr,S,V,0}, /* le.b.t */ - {40,21,rr,S,V,0}, /* le.h.t */ - {40,22,rr,S,V,0}, /* le.w.t */ - {40,23,rr,S,V,0}, /* le.l.t */ - {41,20,rr,V,V,0}, /* lt.b.t */ - {41,21,rr,V,V,0}, /* lt.h.t */ - {41,22,rr,V,V,0}, /* lt.w.t */ - {41,23,rr,V,V,0}, /* lt.l.t */ - {41,20,rr,S,V,0}, /* lt.b.t */ - {41,21,rr,S,V,0}, /* lt.h.t */ - {41,22,rr,S,V,0}, /* lt.w.t */ - {41,23,rr,S,V,0}, /* lt.l.t */ - {43,20,rr,V,V,0}, /* neg.b.t */ - {43,21,rr,V,V,0}, /* neg.h.t */ - {43,22,rr,V,V,0}, /* neg.w.t */ - {43,23,rr,V,V,0}, /* neg.l.t */ - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, -}; - -CONST struct formstr e1_format4[] = { - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, -}; - -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 */ - {51,23,rr,V,V,0}, /* ldvi.l.t */ - {28,18,rr,V,V,0}, /* cvtw.s.t */ - {31,22,rr,V,V,0}, /* cvts.w.t */ - {28,23,rr,V,V,0}, /* cvtw.l.t */ - {33,22,rr,V,V,0}, /* cvtl.w.t */ - {52,20,rxr,V,V,0}, /* stvi.b.t */ - {52,21,rxr,V,V,0}, /* stvi.h.t */ - {52,22,rxr,V,V,0}, /* stvi.w.t */ - {52,23,rxr,V,V,0}, /* stvi.l.t */ - {52,20,rxr,S,V,0}, /* stvi.b.t */ - {52,21,rxr,S,V,0}, /* stvi.h.t */ - {52,22,rxr,S,V,0}, /* stvi.w.t */ - {52,23,rxr,S,V,0}, /* stvi.l.t */ -}; - -CONST struct formstr e1_format6[] = { - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, -}; - -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 */ - {84,23,r,V,0,0}, /* sum.l.t */ - {85,1,r,V,0,0}, /* all.t */ - {86,1,r,V,0,0}, /* any.t */ - {87,1,r,V,0,0}, /* parity.t */ - {0,0,0,0,0,0}, - {88,20,r,V,0,0}, /* max.b.t */ - {88,21,r,V,0,0}, /* max.h.t */ - {88,22,r,V,0,0}, /* max.w.t */ - {88,23,r,V,0,0}, /* max.l.t */ - {89,20,r,V,0,0}, /* min.b.t */ - {89,21,r,V,0,0}, /* min.h.t */ - {89,22,r,V,0,0}, /* min.w.t */ - {89,23,r,V,0,0}, /* min.l.t */ - {84,18,r,V,0,0}, /* sum.s.t */ - {84,19,r,V,0,0}, /* sum.d.t */ - {90,18,r,V,0,0}, /* prod.s.t */ - {90,19,r,V,0,0}, /* prod.d.t */ - {88,18,r,V,0,0}, /* max.s.t */ - {88,19,r,V,0,0}, /* max.d.t */ - {89,18,r,V,0,0}, /* min.s.t */ - {89,19,r,V,0,0}, /* min.d.t */ - {90,20,r,V,0,0}, /* prod.b.t */ - {90,21,r,V,0,0}, /* prod.h.t */ - {90,22,r,V,0,0}, /* prod.w.t */ - {90,23,r,V,0,0}, /* prod.l.t */ - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, -}; - -char *lop[] = { - "mov", /* 0 */ - "merg", /* 1 */ - "mask", /* 2 */ - "mul", /* 3 */ - "div", /* 4 */ - "and", /* 5 */ - "or", /* 6 */ - "xor", /* 7 */ - "shf", /* 8 */ - "add", /* 9 */ - "sub", /* 10 */ - "exit", /* 11 */ - "jmp", /* 12 */ - "jmpi", /* 13 */ - "jmpa", /* 14 */ - "jmps", /* 15 */ - "tac", /* 16 */ - "ldea", /* 17 */ - "ld", /* 18 */ - "tas", /* 19 */ - "pshea", /* 20 */ - "st", /* 21 */ - "call", /* 22 */ - "calls", /* 23 */ - "callq", /* 24 */ - "pfork", /* 25 */ - "ste", /* 26 */ - "incr", /* 27 */ - "cvtw", /* 28 */ - "cvtb", /* 29 */ - "cvth", /* 30 */ - "cvts", /* 31 */ - "cvtd", /* 32 */ - "cvtl", /* 33 */ - "ldpa", /* 34 */ - "plc", /* 35 */ - "tzc", /* 36 */ - "eq", /* 37 */ - "leu", /* 38 */ - "ltu", /* 39 */ - "le", /* 40 */ - "lt", /* 41 */ - "not", /* 42 */ - "neg", /* 43 */ - "lop", /* 44 */ - "cprs", /* 45 */ - "nop", /* 46 */ - "br", /* 47 */ - "bri", /* 48 */ - "bra", /* 49 */ - "brs", /* 50 */ - "ldvi", /* 51 */ - "stvi", /* 52 */ - "ldsdr", /* 53 */ - "ldkdr", /* 54 */ - "ln", /* 55 */ - "patu", /* 56 */ - "pate", /* 57 */ - "pich", /* 58 */ - "plch", /* 59 */ - "idle", /* 60 */ - "rtnq", /* 61 */ - "cfork", /* 62 */ - "rtn", /* 63 */ - "wfork", /* 64 */ - "join", /* 65 */ - "rtnc", /* 66 */ - "exp", /* 67 */ - "sin", /* 68 */ - "cos", /* 69 */ - "psh", /* 70 */ - "pop", /* 71 */ - "eni", /* 72 */ - "dsi", /* 73 */ - "bkpt", /* 74 */ - "msync", /* 75 */ - "mski", /* 76 */ - "xmti", /* 77 */ - "tstvv", /* 78 */ - "diag", /* 79 */ - "pbkpt", /* 80 */ - "sqrt", /* 81 */ - "casr", /* 82 */ - "atan", /* 83 */ - "sum", /* 84 */ - "all", /* 85 */ - "any", /* 86 */ - "parity", /* 87 */ - "max", /* 88 */ - "min", /* 89 */ - "prod", /* 90 */ - "halt", /* 91 */ - "sysc", /* 92 */ - "trap", /* 93 */ - "tst", /* 94 */ - "lck", /* 95 */ - "ulk", /* 96 */ - "spawn", /* 97 */ - "ldcmr", /* 98 */ - "stcmr", /* 99 */ - "popr", /* 100 */ - "pshr", /* 101 */ - "rcvr", /* 102 */ - "matm", /* 103 */ - "sndr", /* 104 */ - "putr", /* 105 */ - "getr", /* 106 */ - "matr", /* 107 */ - "mat", /* 108 */ - "get", /* 109 */ - "rcv", /* 110 */ - "inc", /* 111 */ - "put", /* 112 */ - "snd", /* 113 */ - "enal", /* 114 */ - "enag", /* 115 */ - "frint", /* 116 */ - "xpnd", /* 117 */ - "ctrsl", /* 118 */ - "ctrsg", /* 119 */ - "stop", /* 120 */ -}; - -char *rop[] = { - "", /* 0 */ - ".t", /* 1 */ - ".f", /* 2 */ - ".s", /* 3 */ - ".d", /* 4 */ - ".b", /* 5 */ - ".h", /* 6 */ - ".w", /* 7 */ - ".l", /* 8 */ - ".x", /* 9 */ - ".u", /* 10 */ - ".s.f", /* 11 */ - ".d.f", /* 12 */ - ".b.f", /* 13 */ - ".h.f", /* 14 */ - ".w.f", /* 15 */ - ".l.f", /* 16 */ - ".t.f", /* 17 */ - ".s.t", /* 18 */ - ".d.t", /* 19 */ - ".b.t", /* 20 */ - ".h.t", /* 21 */ - ".w.t", /* 22 */ - ".l.t", /* 23 */ - ".t.t", /* 24 */ -}; diff --git a/contrib/gdb/include/opcode/h8300.h b/contrib/gdb/include/opcode/h8300.h deleted file mode 100644 index 9d726e2..0000000 --- a/contrib/gdb/include/opcode/h8300.h +++ /dev/null @@ -1,550 +0,0 @@ -/* Opcode table for the H8-300 - Copyright (C) 1991,1992 Free Software Foundation. - Written by Steve Chamberlain, sac@cygnus.com. - - This file is part of GDB, the GNU Debugger and GAS, the GNU Assembler. - - 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. */ - -/* Instructions are stored as a sequence of nibbles. - If the nibble has value 15 or less then the representation is complete. - Otherwise, we record what it contains with several flags. */ - -typedef int op_type; - -#define Hex0 0 -#define Hex1 1 -#define Hex2 2 -#define Hex3 3 -#define Hex4 4 -#define Hex5 5 -#define Hex6 6 -#define Hex7 7 -#define Hex8 8 -#define Hex9 9 -#define HexA 10 -#define HexB 11 -#define HexC 12 -#define HexD 13 -#define HexE 14 -#define HexF 15 - -#define START 0x20 -#define SRC 0x40 -#define DST 0x80 -#define L_8 0x01 -#define L_16 0x02 -#define L_32 0x04 -#define L_P 0x08 -#define L_24 0x10 - -#define REG 0x100 -#define IMM 0x1000 -#define DISP 0x2000 -#define IND 0x4000 -#define INC 0x8000 -#define DEC 0x10000 -#define L_3 0x20000 -#define KBIT 0x40000 -#define DBIT 0x80000 -#define DISPREG 0x100000 -#define IGNORE 0x200000 -#define E 0x400000 /* FIXME: end of nibble sequence? */ -#define L_2 0x800000 -#define CCR 0x4000000 -#define ABS 0x8000000 -#define B30 0x1000000 /* bit 3 must be low */ -#define B31 0x2000000 /* bit 3 must be high */ -#define ABSJMP 0x10000000 -#define ABSMOV 0x20000000 -#define PCREL 0x40000000 -#define MEMIND 0x80000000 - -#define IMM3 IMM|L_3 -#define IMM2 IMM|L_2 - -#define SIZE (L_2|L_3|L_8|L_16|L_32|L_P|L_24) -#define MODE (REG|IMM|DISP|IND|INC|DEC|CCR|ABS|MEMIND) - -#define RD8 (DST|L_8|REG) -#define RD16 (DST|L_16|REG) -#define RD32 (DST|L_32|REG) -#define RS8 (SRC|L_8|REG) -#define RS16 (SRC|L_16|REG) -#define RS32 (SRC|L_32|REG) - -#define RSP (SRC|L_P|REG) -#define RDP (DST|L_P|REG) - -#define IMM8 (IMM|SRC|L_8) -#define IMM16 (IMM|SRC|L_16) -#define IMM32 (IMM|SRC|L_32) - -#define ABS8SRC (SRC|ABS|L_8) -#define ABS8DST (DST|ABS|L_8) - -#define DISP8 (PCREL|L_8) -#define DISP16 (PCREL|L_16) - -#define DISP8SRC (DISP|L_8|SRC) -#define DISP16SRC (DISP|L_16|SRC) - -#define DISP8DST (DISP|L_8|DST) -#define DISP16DST (DISP|L_16|DST) - -#define ABS16SRC (SRC|ABS|L_16) -#define ABS16DST (DST|ABS|L_16) -#define ABS24SRC (SRC|ABS|L_24) -#define ABS24DST (DST|ABS|L_24) - -#define RDDEC (DST|DEC) -#define RSINC (SRC|INC) - -#define RDIND (DST|IND) -#define RSIND (SRC|IND) - -#if 1 -#define OR8 RS8 /* ??? OR as in One Register? */ -#define OR16 RS16 -#define OR32 RS32 -#else -#define OR8 RD8 -#define OR16 RD16 -#define OR32 RD32 -#endif - -struct code -{ - op_type nib[30]; -}; - -struct arg -{ - op_type nib[3]; -}; - -struct h8_opcode -{ - int how; - int inbase; - int time; - char *name; - struct arg args; - struct code data; - int length; - int noperands; - int idx; - int size; -}; - -#ifdef DEFINE_TABLE - -#define BITOP(code, imm, name, op00, op01,op10,op11, op20,op21)\ -{ code, 1, 2, name, {imm,RD8,E}, {op00, op01, imm, RD8, E, 0, 0, 0, 0}, 0, 0, 0, 0},\ -{ code, 1, 6, name, {imm,RDIND,E}, {op10, op11, B30|RDIND, 0, op00,op01, imm, 0, E}, 0, 0, 0, 0},\ -{ code, 1, 6, name, {imm,ABS8DST,E},{op20, op21, ABS8DST, IGNORE, op00,op01, imm, 0,E}, 0, 0, 0, 0} - -#define EBITOP(code, imm, name, op00, op01,op10,op11, op20,op21)\ - BITOP(code,imm, name, op00+1, op01, op10,op11, op20,op21),\ - BITOP(code,RS8, name, op00, op01, op10,op11, op20,op21) - -#define WTWOP(code,name, op1, op2) \ -{ code, 1, 2, name, {RS16, RD16, E}, { op1, op2, RS16, RD16, E, 0, 0, 0, 0}, 0, 0, 0, 0} - -#define BRANCH(code, name, op) \ -{ code, 1, 4,name,{DISP8,E,0}, { 0x4, op, DISP8, IGNORE, E, 0, 0, 0, 0}, 0, 0, 0, 0}, \ -{ code, 0, 6,name,{DISP16,E,0}, { 0x5, 0x8, op, 0x0, DISP16, IGNORE, IGNORE, IGNORE, E,0}, 0, 0, 0, 0} - -#define SOP(code, x,name) \ -{code, 1, x, name - -#define NEW_SOP(code, in,x,name) \ -{code, in, x, name -#define EOP ,0,0,0 } - -#define TWOOP(code, name, op1, op2,op3) \ -{ code,1, 2,name, {IMM8, RD8, E}, { op1, RD8, IMM8, IGNORE, E, 0, 0, 0, 0}, 0, 0, 0, 0},\ -{ code, 1, 2,name, {RS8, RD8, E}, { op2, op3, RS8, RD8, E, 0, 0, 0, 0}, 0, 0, 0, 0} - -#define UNOP(code,name, op1, op2) \ -{ code, 1, 2, name, {OR8, E, 0}, { op1, op2, 0, OR8, E, 0, 0, 0, 0}, 0, 0, 0, 0} - -#define UNOP3(code, name, op1, op2, op3) \ -{ O(code,SB), 1, 2, name, {OR8, E, 0}, {op1, op2, op3+0, OR8, E, 0, 0, 0, 0}, 0, 0, 0, 0}, \ -{ O(code,SW), 0, 2, name, {OR16, E, 0}, {op1, op2, op3+1, OR16, E, 0, 0, 0, 0}, 0, 0, 0, 0}, \ -{ O(code,SL), 0, 2, name, {OR32, E, 0}, {op1, op2, op3+3, OR32|B30, E, 0, 0, 0, 0}, 0, 0, 0, 0} - -#define IMM32LIST IMM32,IGNORE,IGNORE,IGNORE,IGNORE,IGNORE,IGNORE,IGNORE -#define IMM24LIST IMM24,IGNORE,IGNORE,IGNORE,IGNORE,IGNORE -#define IMM16LIST IMM16,IGNORE,IGNORE,IGNORE -#define A16LIST L_16,IGNORE,IGNORE,IGNORE -#define DISP24LIST DISP|L_24,IGNORE,IGNORE,IGNORE,IGNORE,IGNORE -#define ABS24LIST ABS|L_24,IGNORE,IGNORE,IGNORE,IGNORE,IGNORE -#define A24LIST L_24,IGNORE,IGNORE,IGNORE,IGNORE,IGNORE -#define PREFIX32 0x0,0x1,0x0,0x0 -#define PREFIXLDC 0x0,0x1,0x4,0x0 - - -#define O(op, size) (op*4+size) - -#define O_RECOMPILE 0 -#define O_ADD 1 -#define O_ADDX 2 -#define O_AND 3 -#define O_BAND 4 -#define O_BRA 5 -#define O_BRN 6 -#define O_BHI 7 -#define O_BLS 8 -#define O_BCC 9 -#define O_BCS 10 -#define O_BNE 11 -#define O_BVC 12 -#define O_BVS 13 -#define O_BPL 14 -#define O_BMI 15 -#define O_BGE 16 -#define O_BLT 17 -#define O_BGT 18 -#define O_BLE 19 -#define O_ANDC 20 -#define O_BEQ 21 -#define O_BCLR 22 -#define O_BIAND 23 -#define O_BILD 24 -#define O_BIOR 25 -#define O_BIXOR 26 -#define O_BIST 27 -#define O_BLD 28 -#define O_BNOT 29 -#define O_BSET 30 -#define O_BSR 31 -#define O_BXOR 32 -#define O_CMP 33 -#define O_DAA 34 -#define O_DAS 35 -#define O_DEC 36 -#define O_DIVU 37 -#define O_DIVS 38 -#define O_INC 39 -#define O_LDC 40 -#define O_MOV_TO_MEM 41 -#define O_OR 42 -#define O_ROTL 43 -#define O_ROTR 44 -#define O_ROTXL 45 -#define O_ROTXR 46 -#define O_BPT 47 -#define O_SHAL 48 -#define O_SHAR 49 -#define O_SHLL 50 -#define O_SHLR 51 -#define O_SUB 52 -#define O_SUBS 53 -#define O_TRAPA 54 -#define O_XOR 55 -#define O_XORC 56 -#define O_BOR 57 -#define O_BST 58 -#define O_BTST 59 -#define O_EEPMOV 60 -#define O_EXTS 61 -#define O_EXTU 62 -#define O_JMP 63 -#define O_JSR 64 -#define O_MULU 65 -#define O_MULS 66 -#define O_NOP 67 -#define O_NOT 68 -#define O_ORC 69 -#define O_RTE 70 -#define O_STC 71 -#define O_SUBX 72 -#define O_NEG 73 -#define O_RTS 74 -#define O_SLEEP 75 -#define O_ILL 76 -#define O_ADDS 77 -#define O_SYSCALL 78 -#define O_MOV_TO_REG 79 -#define O_LAST 80 -#define SB 0 -#define SW 1 -#define SL 2 - - -/* FIXME: Lots of insns have "E, 0, 0, 0, 0" in the nibble code sequences. - Methinks the zeroes aren't necessary. Once confirmed, nuke 'em. */ - -struct h8_opcode h8_opcodes[] = -{ - TWOOP(O(O_ADD,SB),"add.b", 0x8, 0x0,0x8), - - NEW_SOP(O(O_ADD,SW),1,2,"add.w"),{RS16,RD16,E },{0x0,0x9,RS16,RD16,E} EOP, - NEW_SOP(O(O_ADD,SW),0,4,"add.w"),{IMM16,RD16,E },{0x7,0x9,0x1,RD16,IMM16,IGNORE,IGNORE,IGNORE,E} EOP, - NEW_SOP(O(O_ADD,SL),0,2,"add.l"),{RS32,RD32,E }, {0x0,0xA,B31|RS32,B30|RD32,E} EOP, - NEW_SOP(O(O_ADD,SL),0,6,"add.l"),{IMM32,RD32,E },{0x7,0xA,0x1,B30|RD32,IMM32LIST,E} EOP, - NEW_SOP(O(O_ADDS,SL),1,2,"adds"), {KBIT,RDP,E}, {0x0,0xB,KBIT,RDP,E,0,0,0,0} EOP, - - TWOOP(O(O_ADDX,SB),"addx",0x9,0x0,0xE), - TWOOP(O(O_AND,SB), "and.b",0xE,0x1,0x6), - - NEW_SOP(O(O_AND,SW),0,2,"and.w"),{RS16,RD16,E },{0x6,0x6,RS16,RD16,E} EOP, - NEW_SOP(O(O_AND,SW),0,4,"and.w"),{IMM16,RD16,E },{0x7,0x9,0x6,RD16,IMM16,IGNORE,IGNORE,IGNORE,E} EOP, - - 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, - - BITOP(O(O_BAND,SB), IMM3,"band",0x7,0x6,0x7,0xC,0x7,0xE), - BRANCH(O(O_BRA,SB),"bra",0x0), - BRANCH(O(O_BRA,SB),"bt",0x0), - BRANCH(O(O_BRN,SB),"brn",0x1), - BRANCH(O(O_BRN,SB),"bf",0x1), - BRANCH(O(O_BHI,SB),"bhi",0x2), - BRANCH(O(O_BLS,SB),"bls",0x3), - BRANCH(O(O_BCC,SB),"bcc",0x4), - BRANCH(O(O_BCC,SB),"bhs",0x4), - BRANCH(O(O_BCS,SB),"bcs",0x5), - BRANCH(O(O_BCS,SB),"blo",0x5), - BRANCH(O(O_BNE,SB),"bne",0x6), - BRANCH(O(O_BEQ,SB),"beq",0x7), - BRANCH(O(O_BVC,SB),"bvc",0x8), - BRANCH(O(O_BVS,SB),"bvs",0x9), - BRANCH(O(O_BPL,SB),"bpl",0xA), - BRANCH(O(O_BMI,SB),"bmi",0xB), - BRANCH(O(O_BGE,SB),"bge",0xC), - BRANCH(O(O_BLT,SB),"blt",0xD), - BRANCH(O(O_BGT,SB),"bgt",0xE), - BRANCH(O(O_BLE,SB),"ble",0xF), - - EBITOP(O(O_BCLR,SB),IMM3, "bclr", 0x6,0x2,0x7,0xD,0x7,0xF), - BITOP(O(O_BIAND,SB),IMM3|B31,"biand",0x7,0x6,0x7,0xC,0x7,0xE), - BITOP(O(O_BILD,SB), IMM3|B31,"bild", 0x7,0x7,0x7,0xC,0x7,0xE), - BITOP(O(O_BIOR,SB), IMM3|B31,"bior", 0x7,0x4,0x7,0xC,0x7,0xE), - BITOP(O(O_BIST,SB), IMM3|B31,"bist", 0x6,0x7,0x7,0xD,0x7,0xF), - BITOP(O(O_BIXOR,SB),IMM3|B31,"bixor",0x7,0x5,0x7,0xC,0x7,0xE), - BITOP(O(O_BLD,SB), IMM3|B30,"bld", 0x7,0x7,0x7,0xC,0x7,0xE), - EBITOP(O(O_BNOT,SB),IMM3|B30,"bnot", 0x6,0x1,0x7,0xD,0x7,0xF), - BITOP(O(O_BOR,SB), IMM3|B30,"bor", 0x7,0x4,0x7,0xC,0x7,0xE), - EBITOP(O(O_BSET,SB),IMM3|B30,"bset", 0x6,0x0,0x7,0xD,0x7,0xF), - - SOP(O(O_BSR,SB),6,"bsr"),{DISP8,E,0},{ 0x5,0x5,DISP8,IGNORE,E,0,0,0,0} EOP, - SOP(O(O_BSR,SB),6,"bsr"),{DISP16,E,0},{ 0x5,0xC,0x0,0x0,DISP16,IGNORE,IGNORE,IGNORE,E,0,0,0,0} EOP, - BITOP(O(O_BST,SB), IMM3|B30,"bst",0x6,0x7,0x7,0xD,0x7,0xF), - EBITOP(O(O_BTST,SB), IMM3|B30,"btst",0x6,0x3,0x7,0xC,0x7,0xE), - BITOP(O(O_BXOR,SB), IMM3|B30,"bxor",0x7,0x5,0x7,0xC,0x7,0xE), - - TWOOP(O(O_CMP,SB), "cmp.b",0xA,0x1,0xC), - WTWOP(O(O_CMP,SW), "cmp.w",0x1,0xD), - - NEW_SOP(O(O_CMP,SW),1,2,"cmp.w"),{RS16,RD16,E },{0x1,0xD,RS16,RD16,E} EOP, - NEW_SOP(O(O_CMP,SW),0,4,"cmp.w"),{IMM16,RD16,E },{0x7,0x9,0x2,RD16,IMM16,IGNORE,IGNORE,IGNORE,E} EOP, - - NEW_SOP(O(O_CMP,SL),0,6,"cmp.l"),{IMM32,RD32,E },{0x7,0xA,0x2,B30|RD32,IMM32LIST,E} EOP, - NEW_SOP(O(O_CMP,SL),0,2,"cmp.l") ,{RS32,RD32,E },{0x1,0xF,B31|RS32,B30|RD32,E} EOP, - - UNOP(O(O_DAA,SB), "daa",0x0,0xF), - UNOP(O(O_DAS,SB), "das",0x1,0xF), - UNOP(O(O_DEC,SB), "dec.b",0x1,0xA), - - 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_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_EEPMOV,SB),1,50,"eepmov"),{ E,0,0},{0x7,0xB,0x5,0xC,0x5,0x9,0x8,0xF,E}EOP, - NEW_SOP(O(O_EEPMOV,SW),0,50,"eepmovw"),{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, - - NEW_SOP(O(O_EXTU,SW),0,2,"extu.w"),{OR16,E,0},{0x1,0x7,0x5,OR16,E }EOP, - NEW_SOP(O(O_EXTU,SL),0,2,"extu.l"),{OR32,E,0},{0x1,0x7,0x7,OR32|B30,E }EOP, - - UNOP(O(O_INC,SB), "inc",0x0,0xA), - - NEW_SOP(O(O_INC,SW),0,2,"inc.w") ,{DBIT,RD16,E },{0x0,0xB,0x5|DBIT,RD16,E} EOP, - NEW_SOP(O(O_INC,SL),0,2,"inc.l") ,{DBIT,RD32,E },{0x0,0xB,0x7|DBIT,RD32|B30,E} EOP, - - SOP(O(O_JMP,SB),4,"jmp"),{RSIND,E,0},{0x5,0x9,B30|RSIND,0x0,E,0,0,0,0}EOP, - SOP(O(O_JMP,SB),6,"jmp"),{SRC|ABSJMP,E,0},{0x5,0xA,SRC|ABSJMP,IGNORE,IGNORE,IGNORE,IGNORE,IGNORE,E}EOP, - SOP(O(O_JMP,SB),8,"jmp"),{SRC|MEMIND,E,0},{0x5,0xB,SRC|MEMIND,IGNORE,E,0,0,0,0}EOP, - - SOP(O(O_JSR,SB),6,"jsr"),{SRC|RSIND,E,0}, {0x5,0xD,B30|RSIND,0x0,E,0,0,0,0}EOP, - 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"),{ABS24SRC,CCR,E}, {PREFIXLDC,0x6,0xB,0x2,0x0,0x0,0x0,SRC|ABS24LIST,E}EOP, - NEW_SOP(O(O_LDC,SB),0,2,"ldc"),{DISP|SRC|L_16,CCR,E},{PREFIXLDC,0x6,0x9,B30|DISPREG,0,DISP|L_16,IGNORE,IGNORE,IGNORE,E}EOP, - NEW_SOP(O(O_LDC,SB),0,2,"ldc"),{DISP|SRC|L_24,CCR,E},{PREFIXLDC,0x7,0x8,B30|DISPREG,0,0x6,0xB,0x2,0x0,0x0,0x0,SRC|DISP24LIST,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, - - - SOP(O(O_MOV_TO_REG,SB),4,"mov.b"),{ABSMOV|ABS|SRC|L_16,RD8,E}, { 0x6,0xA,0x0,RD8,ABSMOV|SRC|ABS|A16LIST,E}EOP, - SOP(O(O_MOV_TO_REG,SB),6,"mov.b"),{ABSMOV|ABS|SRC|L_24,RD8,E }, { 0x6,0xA,0x2,RD8,0x0,0x0,SRC|ABSMOV|ABS|A24LIST,E }EOP, - SOP(O(O_MOV_TO_MEM,SB),4,"mov.b"),{RS8,ABSMOV|ABS|L_16|DST,E}, { 0x6,0xA,0x8,RS8,ABSMOV|DST|ABS|A16LIST,E}EOP, - SOP(O(O_MOV_TO_MEM,SB),6,"mov.b"),{RS8,ABSMOV|ABS|DST|L_24,E }, { 0x6,0xA,0xA,RS8,0x0,0x0,DST|ABSMOV|ABS|A24LIST,E }EOP, - - SOP(O(O_MOV_TO_REG,SB),6,"mov.b"),{DISP|L_24|SRC,RD8,E}, { 0x7,0x8,B30|DISPREG,0x0,0x6,0xA,0x2,RD8,0x0,0x0,SRC|DISP24LIST,E}EOP, - SOP(O(O_MOV_TO_MEM,SB),6,"mov.b"),{RS8,DISP|L_24|DST,E}, { 0x7,0x8,B30|DISPREG,0x0,0x6,0xA,0xA,RS8,0x0,0x0,DST|DISP24LIST,E}EOP, - - - - SOP(O(O_MOV_TO_REG,SB),2,"mov.b"),{RS8,RD8,E}, { 0x0,0xC,RS8,RD8,E,0,0,0,0}EOP, - SOP(O(O_MOV_TO_REG,SB),2,"mov.b"),{IMM8,RD8,E}, { 0xF,RD8,IMM8,IGNORE,E,0,0,0,0}EOP, - SOP(O(O_MOV_TO_REG,SB),4,"mov.b"),{RSIND,RD8,E}, { 0x6,0x8,B30|RSIND,RD8,E,0,0,0,0}EOP, - SOP(O(O_MOV_TO_REG,SB),6,"mov.b"),{DISP16SRC,RD8,E}, { 0x6,0xE,B30|DISPREG,RD8,DISP16SRC,IGNORE,IGNORE,IGNORE,E}EOP, - SOP(O(O_MOV_TO_REG,SB),6,"mov.b"),{RSINC,RD8,E}, { 0x6,0xC,B30|RSINC,RD8,E,0,0,0,0}EOP, - - SOP(O(O_MOV_TO_REG,SB),4,"mov.b"),{ABS8SRC,RD8,E}, { 0x2,RD8,ABS8SRC,IGNORE,E,0,0,0,0}EOP, - SOP(O(O_MOV_TO_MEM,SB),4,"mov.b"),{RS8,RDIND,E}, { 0x6,0x8,RDIND|B31,RS8,E,0,0,0,0}EOP, - SOP(O(O_MOV_TO_MEM,SB),6,"mov.b"),{RS8,DISP16DST,E}, { 0x6,0xE,DISPREG|B31,RS8,DISP16DST,IGNORE,IGNORE,IGNORE,E}EOP, - SOP(O(O_MOV_TO_MEM,SB),6,"mov.b"),{RS8,RDDEC|B31,E}, { 0x6,0xC,RDDEC|B31,RS8,E,0,0,0,0}EOP, - - SOP(O(O_MOV_TO_MEM,SB),4,"mov.b"),{RS8,ABS8DST,E}, { 0x3,RS8,ABS8DST,IGNORE,E,0,0,0,0}EOP, - - SOP(O(O_MOV_TO_MEM,SW),6,"mov.w"),{RS16,RDIND,E}, { 0x6,0x9,RDIND|B31,RS16,E,0,0,0,0}EOP, - SOP(O(O_MOV_TO_REG,SW),6,"mov.w"),{DISP|L_24|SRC,RD16,E},{ 0x7,0x8,B30|DISPREG,0x0,0x6,0xB,0x2,RD16,0x0,0x0,SRC|DISP24LIST,E}EOP, - SOP(O(O_MOV_TO_MEM,SW),6,"mov.w"),{RS16,DISP|L_24|DST,E},{ 0x7,0x8,B30|DISPREG,0x0,0x6,0xB,0xA,RS16,0x0,0x0,DST|DISP24LIST,E}EOP, - SOP(O(O_MOV_TO_REG,SW),6,"mov.w"),{ABS|L_24|SRC,RD16,E },{ 0x6,0xB,0x2,RD16,0x0,0x0,SRC|ABS24LIST,E }EOP, - SOP(O(O_MOV_TO_MEM,SW),6,"mov.w"),{RS16,ABS|L_24|DST,E },{ 0x6,0xB,0xA,RS16,0x0,0x0,DST|ABS24LIST,E }EOP, - SOP(O(O_MOV_TO_REG,SW),2,"mov.w"),{RS16,RD16,E}, { 0x0,0xD,RS16, RD16,E,0,0,0,0}EOP, - SOP(O(O_MOV_TO_REG,SW),4,"mov.w"),{IMM16,RD16,E}, { 0x7,0x9,0x0,RD16,IMM16,IGNORE,IGNORE,IGNORE,E}EOP, - SOP(O(O_MOV_TO_REG,SW),4,"mov.w"),{RSIND,RD16,E}, { 0x6,0x9,B30|RSIND,RD16,E,0,0,0,0}EOP, - SOP(O(O_MOV_TO_REG,SW),6,"mov.w"),{DISP16SRC,RD16,E}, { 0x6,0xF,B30|DISPREG,RD16,DISP16SRC,IGNORE,IGNORE,IGNORE,E}EOP, - SOP(O(O_MOV_TO_REG,SW),6,"mov.w"),{RSINC,RD16,E}, { 0x6,0xD,B30|RSINC,RD16,E,0,0,0,0}EOP, - SOP(O(O_MOV_TO_REG,SW),6,"mov.w"),{ABS16SRC,RD16,E}, { 0x6,0xB,0x0,RD16,ABS16SRC,IGNORE,IGNORE,IGNORE,E}EOP, - - SOP(O(O_MOV_TO_MEM,SW),6,"mov.w"),{RS16,DISP16DST,E}, { 0x6,0xF,DISPREG|B31,RS16,DISP16DST,IGNORE,IGNORE,IGNORE,E}EOP, - SOP(O(O_MOV_TO_MEM,SW),6,"mov.w"),{RS16,RDDEC,E}, { 0x6,0xD,RDDEC|B31,RS16,E,0,0,0,0}EOP, - SOP(O(O_MOV_TO_MEM,SW),6,"mov.w"),{RS16,ABS16DST,E}, { 0x6,0xB,0x8,RS16,ABS16DST,IGNORE,IGNORE,IGNORE,E}EOP, - - SOP(O(O_MOV_TO_REG,SL),4,"mov.l"),{IMM32,RD32,E}, { 0x7,0xA,0x0,B30|RD32,IMM32LIST,E}EOP, - SOP(O(O_MOV_TO_REG,SL),2,"mov.l"),{RS32,RD32,E}, { 0x0,0xF,B31|RS32,B30|RD32,E,0,0,0,0}EOP, - - SOP(O(O_MOV_TO_REG,SL),4,"mov.l"),{RSIND,RD32,E}, { PREFIX32,0x6,0x9,RSIND|B30,B30|RD32,E,0,0,0,0 }EOP, - SOP(O(O_MOV_TO_REG,SL),6,"mov.l"),{DISP16SRC,RD32,E}, { PREFIX32,0x6,0xF,DISPREG|B30,B30|RD32,DISP16SRC,IGNORE,IGNORE,IGNORE,E }EOP, - SOP(O(O_MOV_TO_REG,SL),6,"mov.l"),{DISP|L_24|SRC,RD32,E},{ PREFIX32,0x7,0x8,B30|DISPREG,0x0,0x6,0xB,0x2,B30|RD32,0x0,0x0,SRC|DISP24LIST,E }EOP, - SOP(O(O_MOV_TO_REG,SL),6,"mov.l"),{RSINC,RD32,E}, { PREFIX32,0x6,0xD,B30|RSINC,B30|RD32,E,0,0,0,0 }EOP, - SOP(O(O_MOV_TO_REG,SL),6,"mov.l"),{ABS16SRC,RD32,E}, { PREFIX32,0x6,0xB,0x0,B30|RD32,ABS16SRC,IGNORE,IGNORE,IGNORE,E }EOP, - SOP(O(O_MOV_TO_REG,SL),6,"mov.l"),{ABS24SRC,RD32,E }, { PREFIX32,0x6,0xB,0x2,B30|RD32,0x0,0x0,SRC|ABS24LIST,E }EOP, - SOP(O(O_MOV_TO_MEM,SL),6,"mov.l"),{RS32,RDIND,E}, { PREFIX32,0x6,0x9,RDIND|B31,B30|RS32,E,0,0,0,0 }EOP, - SOP(O(O_MOV_TO_MEM,SL),6,"mov.l"),{RS32,DISP16DST,E}, { PREFIX32,0x6,0xF,DISPREG|B31,B30|RS32,DISP16DST,IGNORE,IGNORE,IGNORE,E }EOP, - SOP(O(O_MOV_TO_MEM,SL),6,"mov.l"),{RS32,DISP|L_24|DST,E},{ PREFIX32,0x7,0x8,B31|DISPREG,0x0,0x6,0xB,0xA,B30|RS32,0x0,0x0,DST|DISP24LIST,E }EOP, - SOP(O(O_MOV_TO_MEM,SL),6,"mov.l"),{RS32,RDDEC,E}, { PREFIX32,0x6,0xD,RDDEC|B31,B30|RS32,E,0,0,0,0 }EOP, - SOP(O(O_MOV_TO_MEM,SL),6,"mov.l"),{RS32,ABS16DST,E}, { PREFIX32,0x6,0xB,0x8,B30|RS32,ABS16DST,IGNORE,IGNORE,IGNORE,E }EOP, - SOP(O(O_MOV_TO_MEM,SL),6,"mov.l"),{RS32,ABS24DST,E }, { PREFIX32,0x6,0xB,0xA,B30|RS32,0x0,0x0,DST|ABS24LIST,E }EOP, - - SOP(O(O_MOV_TO_REG,SB),10,"movfpe"),{ABS16SRC,RD8,E},{ 0x6,0xA,0x4,RD8,ABS16SRC,IGNORE,IGNORE,IGNORE,E}EOP, - SOP(O(O_MOV_TO_MEM,SB),10,"movtpe"),{RS8,ABS16DST,E},{ 0x6,0xA,0xC,RS8,ABS16DST,IGNORE,IGNORE,IGNORE,E}EOP, - - NEW_SOP(O(O_MULU,SB),1,14,"mulxu.b"),{RS8,RD16,E}, { 0x5,0x0,RS8,RD16,E,0,0,0,0}EOP, - NEW_SOP(O(O_MULU,SW),0,14,"mulxu.w"),{RS16,RD32,E},{ 0x5,0x2,RS16,B30|RD32,E,0,0,0,0}EOP, - - NEW_SOP(O(O_MULS,SB),0,20,"mulxs.b"),{RS8,RD16,E}, { 0x0,0x1,0xc,0x0,0x5,0x0,RS8,RD16,E}EOP, - NEW_SOP(O(O_MULS,SW),0,20,"mulxs.w"),{RS16,RD32,E},{ 0x0,0x1,0xc,0x0,0x5,0x2,RS16,B30|RD32,E}EOP, - - /* ??? This can use UNOP3. */ - NEW_SOP(O(O_NEG,SB),1,2,"neg.b"),{ OR8,E, 0},{ 0x1,0x7,0x8,OR8,E,0,0,0,0}EOP, - NEW_SOP(O(O_NEG,SW),0,2,"neg.w"),{ OR16,E,0},{ 0x1,0x7,0x9,OR16,E}EOP, - NEW_SOP(O(O_NEG,SL),0,2,"neg.l"),{ OR32,E,0},{ 0x1,0x7,0xB,B30|OR32,E}EOP, - - NEW_SOP(O(O_NOP,SB),1,2,"nop"),{E,0,0},{ 0x0,0x0,0x0,0x0,E,0,0,0,0}EOP, - - /* ??? This can use UNOP3. */ - NEW_SOP(O(O_NOT,SB),1,2,"not.b"),{ OR8,E, 0},{ 0x1,0x7,0x0,OR8,E,0,0,0,0}EOP, - NEW_SOP(O(O_NOT,SW),0,2,"not.w"),{ OR16,E,0},{ 0x1,0x7,0x1,OR16,E}EOP, - NEW_SOP(O(O_NOT,SL),0,2,"not.l"),{ OR32,E,0},{ 0x1,0x7,0x3,B30|OR32,E}EOP, - - TWOOP(O(O_OR, SB),"or.b",0xC,0x1,0x4), - NEW_SOP(O(O_OR,SW),0,4,"or.w"),{IMM16,RD16,E },{0x7,0x9,0x4,RD16,IMM16,IGNORE,IGNORE,IGNORE,E} EOP, - NEW_SOP(O(O_OR,SW),0,2,"or.w"),{RS16,RD16,E },{0x6,0x4,RS16,RD16,E} EOP, - - 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_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, - NEW_SOP(O(O_MOV_TO_MEM,SW),1,6,"push.w"),{OR16,E,0},{ 0x6,0xD,0xF,OR16,E,0,0,0,0}EOP, - NEW_SOP(O(O_MOV_TO_MEM,SL),0,6,"push.l"),{OR32,E,0},{ PREFIX32,0x6,0xD,0xF,OR32|B30,E,0,0,0,0}EOP, - - UNOP3(O_ROTL, "rotl", 0x1,0x2,0x8), - UNOP3(O_ROTR, "rotr", 0x1,0x3,0x8), - UNOP3(O_ROTXL, "rotxl",0x1,0x2,0x0), - UNOP3(O_ROTXR, "rotxr",0x1,0x3,0x0), - - SOP(O(O_BPT,SB), 10,"bpt"),{E,0,0},{ 0x7,0xA,0xF,0xF,E,0,0,0,0}EOP, - SOP(O(O_RTE,SB), 10,"rte"),{E,0,0},{ 0x5,0x6,0x7,0x0,E,0,0,0,0}EOP, - SOP(O(O_RTS,SB), 8,"rts"),{E,0,0},{ 0x5,0x4,0x7,0x0,E,0,0,0,0}EOP, - - UNOP3(O_SHAL, "shal",0x1,0x0,0x8), - UNOP3(O_SHAR, "shar",0x1,0x1,0x8), - UNOP3(O_SHLL, "shll",0x1,0x0,0x0), - UNOP3(O_SHLR, "shlr",0x1,0x1,0x0), - - SOP(O(O_SLEEP,SB),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),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,0x9,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_24,E},{PREFIXLDC,0x7,0x8,B31|DISPREG,0,0x6,0xB,0x2,0x0,0x0,0x0,DST|DISP24LIST,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,ABS16SRC,E}, {PREFIXLDC,0x6,0xB,0x8,0x0,ABS16DST,IGNORE,IGNORE,IGNORE,E}EOP, - NEW_SOP(O(O_STC,SB),0,2,"stc"),{CCR,ABS24SRC,E}, {PREFIXLDC,0x6,0xB,0xA,0x0,0x0,0x0,DST|ABS24LIST,E}EOP, - - SOP(O(O_SUB,SB),2,"sub.b"),{RS8,RD8,E},{ 0x1,0x8,RS8,RD8,E,0,0,0,0}EOP, - - NEW_SOP(O(O_SUB,SW),1,2,"sub.w"),{RS16,RD16,E }, {0x1,0x9,RS16,RD16,E} EOP, - NEW_SOP(O(O_SUB,SW),0,4,"sub.w"),{IMM16,RD16,E }, {0x7,0x9,0x3,RD16,IMM16,IGNORE,IGNORE,IGNORE,E} EOP, - NEW_SOP(O(O_SUB,SL),0,2,"sub.l") ,{RS32,RD32,E }, {0x1,0xA,B31|RS32,B30|RD32,E} EOP, - NEW_SOP(O(O_SUB,SL),0,6,"sub.l"), {IMM32,RD32,E },{0x7,0xA,0x3,B30|RD32,IMM32LIST,E} EOP, - - SOP(O(O_SUBS,SL),2,"subs"),{KBIT,RDP,E},{ 0x1,0xB,KBIT,RDP,E,0,0,0,0}EOP, - TWOOP(O(O_SUBX,SB),"subx",0xB,0x1,0xE), - - NEW_SOP(O(O_TRAPA,SB),0,2,"trapa"),{ IMM2,E}, {0x5,0x7,IMM2,IGNORE,E }EOP, - - TWOOP(O(O_XOR, SB),"xor",0xD,0x1,0x5), - - NEW_SOP(O(O_XOR,SW),0,4,"xor.w"),{IMM16,RD16,E },{0x7,0x9,0x5,RD16,IMM16,IGNORE,IGNORE,IGNORE,E} EOP, - NEW_SOP(O(O_XOR,SW),0,2,"xor.w"),{RS16,RD16,E },{0x6,0x5,RS16,RD16,E} EOP, - - 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, - 0 -}; -#else -extern struct h8_opcode h8_opcodes[] ; -#endif - - - - diff --git a/contrib/gdb/include/opcode/hppa.h b/contrib/gdb/include/opcode/hppa.h deleted file mode 100644 index 6f50e6b..0000000 --- a/contrib/gdb/include/opcode/hppa.h +++ /dev/null @@ -1,471 +0,0 @@ -/* Table of opcodes for the PA-RISC. - Copyright (C) 1990, 1991, 1993, 1995 Free Software Foundation, Inc. - - Contributed by the Center for Software Science at the - University of Utah (pa-gdb-bugs@cs.utah.edu). - -This file is part of GAS, the GNU Assembler, and GDB, the GNU disassembler. - -GAS/GDB 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 1, or (at your option) -any later version. - -GAS/GDB 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 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. */ - -#if !defined(__STDC__) && !defined(const) -#define const -#endif - -/* - * Structure of an opcode table entry. - */ - -/* There are two kinds of delay slot nullification: normal which is - * controled by the nullification bit, and conditional, which depends - * on the direction of the branch and its success or failure. - * - * NONE is unfortunately #defined in the hiux system include files. - * #undef it away. - */ -#undef NONE -struct pa_opcode -{ - const char *name; - unsigned long int match; /* Bits that must be set... */ - unsigned long int mask; /* ... in these bits. */ - char *args; - enum pa_arch arch; -}; - -/* - All hppa opcodes are 32 bits. - - The match component is a mask saying which bits must match a - particular opcode in order for an instruction to be an instance - of that opcode. - - The args component is a string containing one character - for each operand of the instruction. - - Bit positions in this description follow HP usage of lsb = 31, - "at" is lsb of field. - - In the args field, the following characters must match exactly: - - '+,() ' - - In the args field, the following characters are unused: - - ' "#$% *+- ./ 3 :; = ' - ' B L [\] _' - ' e gh lm qr { } ' - - Here are all the characters: - - ' !"#$%&'()*+-,./0123456789:;<=>?@' - 'ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_' - 'abcdefghijklmnopqrstuvwxyz{|}~' - -Kinds of operands: - x integer register field at 15. - b integer register field at 10. - t integer register field at 31. - y floating point register field at 31 - 5 5 bit immediate at 15. - s 2 bit space specifier at 17. - S 3 bit space specifier at 18. - c indexed load completer. - C short load and store completer. - Y Store Bytes Short completer - < non-negated compare/subtract conditions. - a compare/subtract conditions - d non-negated add conditions - & logical instruction conditions - U unit instruction conditions - > shift/extract/deposit conditions. - ~ bvb,bb conditions - V 5 bit immediate value at 31 - i 11 bit immediate value at 31 - j 14 bit immediate value at 31 - k 21 bit immediate value at 31 - n nullification for branch instructions - N nullification for spop and copr instructions - w 12 bit branch displacement - W 17 bit branch displacement (PC relative) - z 17 bit branch displacement (just a number, not an address) - -Also these: - - p 5 bit shift count at 26 (to support the SHD instruction) encoded as - 31-p - P 5 bit bit position at 26 - T 5 bit field length at 31 (encoded as 32-T) - A 13 bit immediate at 18 (to support the BREAK instruction) - ^ like b, but describes a control register - Z System Control Completer (to support LPA, LHA, etc.) - D 26 bit immediate at 31 (to support the DIAG instruction) - - f 3 bit Special Function Unit identifier at 25 - O 20 bit Special Function Unit operation split between 15 bits at 20 - and 5 bits at 31 - o 15 bit Special Function Unit operation at 20 - 2 22 bit Special Function Unit operation split between 17 bits at 20 - and 5 bits at 31 - 1 15 bit Special Function Unit operation split between 10 bits at 20 - and 5 bits at 31 - 0 10 bit Special Function Unit operation split between 5 bits at 20 - and 5 bits at 31 - u 3 bit coprocessor unit identifier at 25 - F Source Floating Point Operand Format Completer encoded 2 bits at 20 - I Source Floating Point Operand Format Completer encoded 1 bits at 20 - (for 0xe format FP instructions) - G Destination Floating Point Operand Format Completer encoded 2 bits at 18 - M Floating-Point Compare Conditions (encoded as 5 bits at 31) - ? non-negated/negated compare/subtract conditions. - @ non-negated/negated add conditions. - ! non-negated add conditions. - - s 2 bit space specifier at 17. - b register field at 10. - r 5 bit immediate value at 31 (for the break instruction) - (very similar to V above, except the value is unsigned instead of - low_sign_ext) - R 5 bit immediate value at 15 (for the ssm, rsm, probei instructions) - (same as r above, except the value is in a different location) - Q 5 bit immediate value at 10 (a bit position specified in - the bb instruction. It's the same as r above, except the - value is in a different location) - | shift/extract/deposit conditions when used in a conditional branch - -And these (PJH) for PA-89 F.P. registers and instructions: - - v a 't' operand type extended to handle L/R register halves. - E a 'b' operand type extended to handle L/R register halves. - X an 'x' operand type extended to handle L/R register halves. - J a 'b' operand type further extended to handle extra 1.1 registers - K a 'x' operand type further extended to handle extra 1.1 registers - 4 a variation of the 'b' operand type for 'fmpyadd' and 'fmpysub' - 6 a variation of the 'x' operand type for 'fmpyadd' and 'fmpysub' - 7 a variation of the 't' operand type for 'fmpyadd' and 'fmpysub' - 8 5 bit register field at 20 (used in 'fmpyadd' and 'fmpysub') - 9 5 bit register field at 25 (used in 'fmpyadd' and 'fmpysub') - H Floating Point Operand Format at 26 for 'fmpyadd' and 'fmpysub' - (very similar to 'F') -*/ - -/* The order of the opcodes in this table is significant: - - * The assembler requires that all instances of the same mnemonic must be - consecutive. If they aren't, the assembler will bomb at runtime. - - * The disassembler should not care about the order of the opcodes. */ - -static const struct pa_opcode pa_opcodes[] = -{ - -/* pseudo-instructions */ - -{ "b", 0xe8000000, 0xffe0e000, "nW", pa10}, /* bl foo,r0 */ -{ "ldi", 0x34000000, 0xffe0c000, "j,x", pa10}, /* ldo val(r0),r */ -{ "comib", 0x84000000, 0xfc000000, "?n5,b,w", pa10}, /* comib{tf}*/ -{ "comb", 0x80000000, 0xfc000000, "?nx,b,w", pa10}, /* comb{tf} */ -{ "addb", 0xa0000000, 0xfc000000, "@nx,b,w", pa10}, /* addb{tf} */ -{ "addib", 0xa4000000, 0xfc000000, "@n5,b,w", pa10}, /* addib{tf}*/ -{ "nop", 0x08000240, 0xffffffff, "", pa10}, /* or 0,0,0 */ -{ "copy", 0x08000240, 0xffe0ffe0, "x,t", pa10}, /* or r,0,t */ -{ "mtsar", 0x01601840, 0xffe0ffff, "x", pa10}, /* mtctl r,cr11 */ - -/* Loads and Stores for integer registers. */ -{ "ldw", 0x48000000, 0xfc000000, "j(s,b),x", pa10}, -{ "ldw", 0x48000000, 0xfc000000, "j(b),x", pa10}, -{ "ldh", 0x44000000, 0xfc000000, "j(s,b),x", pa10}, -{ "ldh", 0x44000000, 0xfc000000, "j(b),x", pa10}, -{ "ldb", 0x40000000, 0xfc000000, "j(s,b),x", pa10}, -{ "ldb", 0x40000000, 0xfc000000, "j(b),x", pa10}, -{ "stw", 0x68000000, 0xfc000000, "x,j(s,b)", pa10}, -{ "stw", 0x68000000, 0xfc000000, "x,j(b)", pa10}, -{ "sth", 0x64000000, 0xfc000000, "x,j(s,b)", pa10}, -{ "sth", 0x64000000, 0xfc000000, "x,j(b)", pa10}, -{ "stb", 0x60000000, 0xfc000000, "x,j(s,b)", pa10}, -{ "stb", 0x60000000, 0xfc000000, "x,j(b)", pa10}, -{ "ldwm", 0x4c000000, 0xfc000000, "j(s,b),x", pa10}, -{ "ldwm", 0x4c000000, 0xfc000000, "j(b),x", pa10}, -{ "stwm", 0x6c000000, 0xfc000000, "x,j(s,b)", pa10}, -{ "stwm", 0x6c000000, 0xfc000000, "x,j(b)", pa10}, -{ "ldwx", 0x0c000080, 0xfc001fc0, "cx(s,b),t", pa10}, -{ "ldwx", 0x0c000080, 0xfc001fc0, "cx(b),t", pa10}, -{ "ldhx", 0x0c000040, 0xfc001fc0, "cx(s,b),t", pa10}, -{ "ldhx", 0x0c000040, 0xfc001fc0, "cx(b),t", pa10}, -{ "ldbx", 0x0c000000, 0xfc001fc0, "cx(s,b),t", pa10}, -{ "ldbx", 0x0c000000, 0xfc001fc0, "cx(b),t", pa10}, -{ "ldwax", 0x0c000180, 0xfc00dfc0, "cx(b),t", pa10}, -{ "ldcwx", 0x0c0001c0, 0xfc001fc0, "cx(s,b),t", pa10}, -{ "ldcwx", 0x0c0001c0, 0xfc001fc0, "cx(b),t", pa10}, -{ "ldws", 0x0c001080, 0xfc001fc0, "C5(s,b),t", pa10}, -{ "ldws", 0x0c001080, 0xfc001fc0, "C5(b),t", pa10}, -{ "ldhs", 0x0c001040, 0xfc001fc0, "C5(s,b),t", pa10}, -{ "ldhs", 0x0c001040, 0xfc001fc0, "C5(b),t", pa10}, -{ "ldbs", 0x0c001000, 0xfc001fc0, "C5(s,b),t", pa10}, -{ "ldbs", 0x0c001000, 0xfc001fc0, "C5(b),t", pa10}, -{ "ldwas", 0x0c001180, 0xfc00dfc0, "C5(b),t", pa10}, -{ "ldcws", 0x0c0011c0, 0xfc001fc0, "C5(s,b),t", pa10}, -{ "ldcws", 0x0c0011c0, 0xfc001fc0, "C5(b),t", pa10}, -{ "stws", 0x0c001280, 0xfc001fc0, "Cx,V(s,b)", pa10}, -{ "stws", 0x0c001280, 0xfc001fc0, "Cx,V(b)", pa10}, -{ "sths", 0x0c001240, 0xfc001fc0, "Cx,V(s,b)", pa10}, -{ "sths", 0x0c001240, 0xfc001fc0, "Cx,V(b)", pa10}, -{ "stbs", 0x0c001200, 0xfc001fc0, "Cx,V(s,b)", pa10}, -{ "stbs", 0x0c001200, 0xfc001fc0, "Cx,V(b)", pa10}, -{ "stwas", 0x0c001380, 0xfc00dfc0, "Cx,V(b)", pa10}, -{ "stbys", 0x0c001300, 0xfc001fc0, "Yx,V(s,b)", pa10}, -{ "stbys", 0x0c001300, 0xfc001fc0, "Yx,V(b)", pa10}, - -/* Immediate instructions. */ -{ "ldo", 0x34000000, 0xfc00c000, "j(b),x", pa10}, -{ "ldil", 0x20000000, 0xfc000000, "k,b", pa10}, -{ "addil", 0x28000000, 0xfc000000, "k,b", pa10}, - -/* Branching instructions. */ -{ "bl", 0xe8000000, 0xfc00e000, "nW,b", pa10}, -{ "gate", 0xe8002000, 0xfc00e000, "nW,b", pa10}, -{ "blr", 0xe8004000, 0xfc00e001, "nx,b", pa10}, -{ "bv", 0xe800c000, 0xfc00e001, "nx(b)", pa10}, -{ "bv", 0xe800c000, 0xfc00e001, "n(b)", pa10}, -{ "be", 0xe0000000, 0xfc000000, "nz(S,b)", pa10}, -{ "ble", 0xe4000000, 0xfc000000, "nz(S,b)", pa10}, -{ "movb", 0xc8000000, 0xfc000000, "|nx,b,w", pa10}, -{ "movib", 0xcc000000, 0xfc000000, "|n5,b,w", pa10}, -{ "combt", 0x80000000, 0xfc000000, "x,b,t", pa10}, -{ "shd", 0xd0000800, 0xfc001c00, ">x,b,p,t", pa10}, -{ "vextru", 0xd0001000, 0xfc001fe0, ">b,T,x", pa10}, -{ "vextrs", 0xd0001400, 0xfc001fe0, ">b,T,x", pa10}, -{ "extru", 0xd0001800, 0xfc001c00, ">b,P,T,x", pa10}, -{ "extrs", 0xd0001c00, 0xfc001c00, ">b,P,T,x", pa10}, -{ "zvdep", 0xd4000000, 0xfc001fe0, ">x,T,b", pa10}, -{ "vdep", 0xd4000400, 0xfc001fe0, ">x,T,b", pa10}, -{ "zdep", 0xd4000800, 0xfc001c00, ">x,p,T,b", pa10}, -{ "dep", 0xd4000c00, 0xfc001c00, ">x,p,T,b", pa10}, -{ "zvdepi", 0xd4001000, 0xfc001fe0, ">5,T,b", pa10}, -{ "vdepi", 0xd4001400, 0xfc001fe0, ">5,T,b", pa10}, -{ "zdepi", 0xd4001800, 0xfc001c00, ">5,p,T,b", pa10}, -{ "depi", 0xd4001c00, 0xfc001c00, ">5,p,T,b", pa10}, - -/* System Control Instructions */ - -{ "break", 0x00000000, 0xfc001fe0, "r,A", pa10}, -{ "rfi", 0x00000c00, 0xffffffff, "", pa10}, -{ "rfir", 0x00000ca0, 0xffffffff, "", pa11}, -{ "ssm", 0x00000d60, 0xffe0ffe0, "R,t", pa10}, -{ "rsm", 0x00000e60, 0xffe0ffe0, "R,t", pa10}, -{ "mtsm", 0x00001860, 0xffe0ffff, "x", pa10}, -{ "ldsid", 0x000010a0, 0xfc1f3fe0, "(s,b),t", pa10}, -{ "ldsid", 0x000010a0, 0xfc1f3fe0, "(b),t", pa10}, -{ "mtsp", 0x00001820, 0xffe01fff, "x,S", pa10}, -{ "mtctl", 0x00001840, 0xfc00ffff, "x,^", pa10}, -{ "mfsp", 0x000004a0, 0xffff1fe0, "S,t", pa10}, -{ "mfctl", 0x000008a0, 0xfc1fffe0, "^,t", pa10}, -{ "sync", 0x00000400, 0xffffffff, "", pa10}, -{ "syncdma", 0x00100400, 0xffffffff, "", pa10}, -{ "prober", 0x04001180, 0xfc003fe0, "(s,b),x,t", pa10}, -{ "prober", 0x04001180, 0xfc003fe0, "(b),x,t", pa10}, -{ "proberi", 0x04003180, 0xfc003fe0, "(s,b),R,t", pa10}, -{ "proberi", 0x04003180, 0xfc003fe0, "(b),R,t", pa10}, -{ "probew", 0x040011c0, 0xfc003fe0, "(s,b),x,t", pa10}, -{ "probew", 0x040011c0, 0xfc003fe0, "(b),x,t", pa10}, -{ "probewi", 0x040031c0, 0xfc003fe0, "(s,b),R,t", pa10}, -{ "probewi", 0x040031c0, 0xfc003fe0, "(b),R,t", pa10}, -{ "lpa", 0x04001340, 0xfc003fc0, "Zx(s,b),t", pa10}, -{ "lpa", 0x04001340, 0xfc003fc0, "Zx(b),t", pa10}, -{ "lha", 0x04001300, 0xfc003fc0, "Zx(s,b),t", pa10}, -{ "lha", 0x04001300, 0xfc003fc0, "Zx(b),t", pa10}, -{ "lci", 0x04001300, 0xfc003fe0, "x(s,b),t", pa10}, -{ "lci", 0x04001300, 0xfc003fe0, "x(b),t", pa10}, -{ "pdtlb", 0x04001200, 0xfc003fdf, "Zx(s,b)", pa10}, -{ "pdtlb", 0x04001200, 0xfc003fdf, "Zx(b)", pa10}, -{ "pitlb", 0x04000200, 0xfc003fdf, "Zx(s,b)", pa10}, -{ "pitlb", 0x04000200, 0xfc003fdf, "Zx(b)", pa10}, -{ "pdtlbe", 0x04001240, 0xfc003fdf, "Zx(s,b)", pa10}, -{ "pdtlbe", 0x04001240, 0xfc003fdf, "Zx(b)", pa10}, -{ "pitlbe", 0x04000240, 0xfc003fdf, "Zx(s,b)", pa10}, -{ "pitlbe", 0x04000240, 0xfc003fdf, "Zx(b)", pa10}, -{ "idtlba", 0x04001040, 0xfc003fff, "x,(s,b)", pa10}, -{ "idtlba", 0x04001040, 0xfc003fff, "x,(b)", pa10}, -{ "iitlba", 0x04000040, 0xfc003fff, "x,(s,b)", pa10}, -{ "iitlba", 0x04000040, 0xfc003fff, "x,(b)", pa10}, -{ "idtlbp", 0x04001000, 0xfc003fff, "x,(s,b)", pa10}, -{ "idtlbp", 0x04001000, 0xfc003fff, "x,(b)", pa10}, -{ "iitlbp", 0x04000000, 0xfc003fff, "x,(s,b)", pa10}, -{ "iitlbp", 0x04000000, 0xfc003fff, "x,(b)", pa10}, -{ "pdc", 0x04001380, 0xfc003fdf, "Zx(s,b)", pa10}, -{ "pdc", 0x04001380, 0xfc003fdf, "Zx(b)", pa10}, -{ "fdc", 0x04001280, 0xfc003fdf, "Zx(s,b)", pa10}, -{ "fdc", 0x04001280, 0xfc003fdf, "Zx(b)", pa10}, -{ "fic", 0x04000280, 0xfc003fdf, "Zx(s,b)", pa10}, -{ "fic", 0x04000280, 0xfc003fdf, "Zx(b)", pa10}, -{ "fdce", 0x040012c0, 0xfc003fdf, "Zx(s,b)", pa10}, -{ "fdce", 0x040012c0, 0xfc003fdf, "Zx(b)", pa10}, -{ "fice", 0x040002c0, 0xfc003fdf, "Zx(s,b)", pa10}, -{ "fice", 0x040002c0, 0xfc003fdf, "Zx(b)", pa10}, -{ "diag", 0x14000000, 0xfc000000, "D", pa10}, - -/* gfw and gfr are not in the HP PA 1.1 manual, but they are in either - the Timex FPU or the Mustang ERS (not sure which) manual. */ -{ "gfw", 0x04001680, 0xfc003fdf, "Zx(s,b)", pa11}, -{ "gfw", 0x04001680, 0xfc003fdf, "Zx(b)", pa11}, -{ "gfr", 0x04001a80, 0xfc003fdf, "Zx(s,b)", pa11}, -{ "gfr", 0x04001a80, 0xfc003fdf, "Zx(b)", pa11}, - -/* Floating Point Coprocessor Instructions */ - -{ "fldwx", 0x24000000, 0xfc001f80, "cx(s,b),v", pa10}, -{ "fldwx", 0x24000000, 0xfc001f80, "cx(b),v", pa10}, -{ "flddx", 0x2c000000, 0xfc001fc0, "cx(s,b),y", pa10}, -{ "flddx", 0x2c000000, 0xfc001fc0, "cx(b),y", pa10}, -{ "fstwx", 0x24000200, 0xfc001f80, "cv,x(s,b)", pa10}, -{ "fstwx", 0x24000200, 0xfc001f80, "cv,x(b)", pa10}, -{ "fstdx", 0x2c000200, 0xfc001fc0, "cy,x(s,b)", pa10}, -{ "fstdx", 0x2c000200, 0xfc001fc0, "cy,x(b)", pa10}, -{ "fstqx", 0x3c000200, 0xfc001fc0, "cy,x(s,b)", pa10}, -{ "fstqx", 0x3c000200, 0xfc001fc0, "cy,x(b)", pa10}, -{ "fldws", 0x24001000, 0xfc001f80, "C5(s,b),v", pa10}, -{ "fldws", 0x24001000, 0xfc001f80, "C5(b),v", pa10}, -{ "fldds", 0x2c001000, 0xfc001fc0, "C5(s,b),y", pa10}, -{ "fldds", 0x2c001000, 0xfc001fc0, "C5(b),y", pa10}, -{ "fstws", 0x24001200, 0xfc001f80, "Cv,5(s,b)", pa10}, -{ "fstws", 0x24001200, 0xfc001f80, "Cv,5(b)", pa10}, -{ "fstds", 0x2c001200, 0xfc001fc0, "Cy,5(s,b)", pa10}, -{ "fstds", 0x2c001200, 0xfc001fc0, "Cy,5(b)", pa10}, -{ "fstqs", 0x3c001200, 0xfc001fc0, "Cy,5(s,b)", pa10}, -{ "fstqs", 0x3c001200, 0xfc001fc0, "Cy,5(b)", pa10}, -{ "fadd", 0x30000600, 0xfc00e7e0, "FE,X,v", pa10}, -{ "fadd", 0x38000600, 0xfc00e720, "IJ,K,v", pa10}, -{ "fsub", 0x30002600, 0xfc00e7e0, "FE,X,v", pa10}, -{ "fsub", 0x38002600, 0xfc00e720, "IJ,K,v", pa10}, -{ "fmpy", 0x30004600, 0xfc00e7e0, "FE,X,v", pa10}, -{ "fmpy", 0x38004600, 0xfc00e720, "IJ,K,v", pa10}, -{ "fdiv", 0x30006600, 0xfc00e7e0, "FE,X,v", pa10}, -{ "fdiv", 0x38006600, 0xfc00e720, "IJ,K,v", pa10}, -{ "fsqrt", 0x30008000, 0xfc1fe7e0, "FE,v", pa10}, -{ "fsqrt", 0x38008000, 0xfc1fe720, "FJ,v", pa10}, -{ "fabs", 0x30006000, 0xfc1fe7e0, "FE,v", pa10}, -{ "fabs", 0x38006000, 0xfc1fe720, "FJ,v", pa10}, -{ "frem", 0x30008600, 0xfc00e7e0, "FE,X,v", pa10}, -{ "frem", 0x38008600, 0xfc00e720, "FJ,K,v", pa10}, -{ "frnd", 0x3000a000, 0xfc1fe7e0, "FE,v", pa10}, -{ "frnd", 0x3800a000, 0xfc1fe720, "FJ,v", pa10}, -{ "fcpy", 0x30004000, 0xfc1fe7e0, "FE,v", pa10}, -{ "fcpy", 0x38004000, 0xfc1fe720, "FJ,v", pa10}, -{ "fcnvff", 0x30000200, 0xfc1f87e0, "FGE,v", pa10}, -{ "fcnvff", 0x38000200, 0xfc1f8720, "FGJ,v", pa10}, -{ "fcnvxf", 0x30008200, 0xfc1f87e0, "FGE,v", pa10}, -{ "fcnvxf", 0x38008200, 0xfc1f8720, "FGJ,v", pa10}, -{ "fcnvfx", 0x30010200, 0xfc1f87e0, "FGE,v", pa10}, -{ "fcnvfx", 0x38010200, 0xfc1f8720, "FGJ,v", pa10}, -{ "fcnvfxt", 0x30018200, 0xfc1f87e0, "FGE,v", pa10}, -{ "fcnvfxt", 0x38018200, 0xfc1f8720, "FGJ,v", pa10}, -{ "fcmp", 0x30000400, 0xfc00e7e0, "FME,X", pa10}, -{ "fcmp", 0x38000400, 0xfc00e720, "IMJ,K", pa10}, -{ "xmpyu", 0x38004700, 0xfc00e720, "E,X,v", pa11}, -{ "fmpyadd", 0x18000000, 0xfc000000, "H4,6,7,9,8", pa11}, -{ "fmpysub", 0x98000000, 0xfc000000, "H4,6,7,9,8", pa11}, -{ "ftest", 0x30002420, 0xffffffff, "", pa10}, - - -/* Assist Instructions */ - -{ "spop0", 0x10000000, 0xfc000600, "f,ON", pa10}, -{ "spop1", 0x10000200, 0xfc000600, "f,oNt", pa10}, -{ "spop2", 0x10000400, 0xfc000600, "f,1Nb", pa10}, -{ "spop3", 0x10000600, 0xfc000600, "f,0Nx,b", pa10}, -{ "copr", 0x30000000, 0xfc000000, "u,2N", pa10}, -{ "cldwx", 0x24000000, 0xfc001e00, "ucx(s,b),t", pa10}, -{ "cldwx", 0x24000000, 0xfc001e00, "ucx(b),t", pa10}, -{ "clddx", 0x2c000000, 0xfc001e00, "ucx(s,b),t", pa10}, -{ "clddx", 0x2c000000, 0xfc001e00, "ucx(b),t", pa10}, -{ "cstwx", 0x24000200, 0xfc001e00, "uct,x(s,b)", pa10}, -{ "cstwx", 0x24000200, 0xfc001e00, "uct,x(b)", pa10}, -{ "cstdx", 0x2c000200, 0xfc001e00, "uct,x(s,b)", pa10}, -{ "cstdx", 0x2c000200, 0xfc001e00, "uct,x(b)", pa10}, -{ "cldws", 0x24001000, 0xfc001e00, "uC5(s,b),t", pa10}, -{ "cldws", 0x24001000, 0xfc001e00, "uC5(b),t", pa10}, -{ "cldds", 0x2c001000, 0xfc001e00, "uC5(s,b),t", pa10}, -{ "cldds", 0x2c001000, 0xfc001e00, "uC5(b),t", pa10}, -{ "cstws", 0x24001200, 0xfc001e00, "uCt,5(s,b)", pa10}, -{ "cstws", 0x24001200, 0xfc001e00, "uCt,5(b)", pa10}, -{ "cstds", 0x2c001200, 0xfc001e00, "uCt,5(s,b)", pa10}, -{ "cstds", 0x2c001200, 0xfc001e00, "uCt,5(b)", pa10}, -}; - -#define NUMOPCODES ((sizeof pa_opcodes)/(sizeof pa_opcodes[0])) - -/* SKV 12/18/92. Added some denotations for various operands. */ - -#define PA_IMM11_AT_31 'i' -#define PA_IMM14_AT_31 'j' -#define PA_IMM21_AT_31 'k' -#define PA_DISP12 'w' -#define PA_DISP17 'W' - -#define N_HPPA_OPERAND_FORMATS 5 diff --git a/contrib/gdb/include/opcode/i386.h b/contrib/gdb/include/opcode/i386.h deleted file mode 100644 index 849a86f..0000000 --- a/contrib/gdb/include/opcode/i386.h +++ /dev/null @@ -1,898 +0,0 @@ -/* i386-opcode.h -- Intel 80386 opcode table - Copyright 1989, 1991, 1992, 1995 Free Software Foundation. - -This file is part of GAS, the GNU Assembler, and 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 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 const template i386_optab[] = { - -#define _ None -/* move instructions */ -#define MOV_AX_DISP32 0xa0 -{ "mov", 2, 0xa0, _, DW|NoModrm, { Disp32, Acc, 0 } }, -{ "mov", 2, 0x88, _, DW|Modrm, { Reg, Reg|Mem, 0 } }, -{ "mov", 2, 0xb0, _, ShortFormW, { Imm, Reg, 0 } }, -{ "mov", 2, 0xc6, _, W|Modrm, { Imm, Reg|Mem, 0 } }, -{ "mov", 2, 0x8c, _, D|Modrm, { SReg3|SReg2, Reg16|Mem, 0 } }, -/* move to/from control debug registers */ -{ "mov", 2, 0x0f20, _, D|Modrm, { Control, Reg32, 0} }, -{ "mov", 2, 0x0f21, _, D|Modrm, { Debug, Reg32, 0} }, -{ "mov", 2, 0x0f24, _, D|Modrm, { Test, Reg32, 0} }, - -/* move with sign extend */ -/* "movsbl" & "movsbw" must not be unified into "movsb" to avoid - conflict with the "movs" string move instruction. Thus, - {"movsb", 2, 0x0fbe, _, ReverseRegRegmem|Modrm, { Reg8|Mem, Reg16|Reg32, 0} }, - is not kosher; we must seperate the two instructions. */ -{"movsbl", 2, 0x0fbe, _, ReverseRegRegmem|Modrm|Data32, { Reg8|Mem, Reg32, 0} }, -{"movsbw", 2, 0x0fbe, _, ReverseRegRegmem|Modrm|Data16, { Reg8|Mem, Reg16, 0} }, -{"movswl", 2, 0x0fbf, _, ReverseRegRegmem|Modrm, { Reg16|Mem, Reg32, 0} }, - -/* move with zero extend */ -{"movzb", 2, 0x0fb6, _, ReverseRegRegmem|Modrm, { Reg8|Mem, Reg16|Reg32, 0} }, -{"movzwl", 2, 0x0fb7, _, ReverseRegRegmem|Modrm, { Reg16|Mem, Reg32, 0} }, - -/* push instructions */ -{"push", 1, 0x50, _, ShortForm, { WordReg,0,0 } }, -{"push", 1, 0xff, 0x6, Modrm, { WordReg|WordMem, 0, 0 } }, -{"push", 1, 0x6a, _, NoModrm, { Imm8S, 0, 0} }, -{"push", 1, 0x68, _, NoModrm, { Imm16|Imm32, 0, 0} }, -{"push", 1, 0x06, _, Seg2ShortForm, { SReg2,0,0 } }, -{"push", 1, 0x0fa0, _, Seg3ShortForm, { SReg3,0,0 } }, -/* push all */ -{"pusha", 0, 0x60, _, NoModrm, { 0, 0, 0 } }, - -/* pop instructions */ -{"pop", 1, 0x58, _, ShortForm, { WordReg,0,0 } }, -{"pop", 1, 0x8f, 0x0, Modrm, { WordReg|WordMem, 0, 0 } }, -#define POP_SEG_SHORT 0x7 -{"pop", 1, 0x07, _, Seg2ShortForm, { SReg2,0,0 } }, -{"pop", 1, 0x0fa1, _, Seg3ShortForm, { SReg3,0,0 } }, -/* pop all */ -{"popa", 0, 0x61, _, NoModrm, { 0, 0, 0 } }, - -/* xchg exchange instructions - xchg commutes: we allow both operand orders */ -{"xchg", 2, 0x90, _, ShortForm, { WordReg, Acc, 0 } }, -{"xchg", 2, 0x90, _, ShortForm, { Acc, WordReg, 0 } }, -{"xchg", 2, 0x86, _, W|Modrm, { Reg, Reg|Mem, 0 } }, -{"xchg", 2, 0x86, _, W|Modrm, { Reg|Mem, Reg, 0 } }, - -/* in/out from ports */ -{"in", 2, 0xe4, _, W|NoModrm, { Imm8, Acc, 0 } }, -{"in", 2, 0xec, _, W|NoModrm, { InOutPortReg, Acc, 0 } }, -{"in", 1, 0xe4, _, W|NoModrm, { Imm8, 0, 0 } }, -{"in", 1, 0xec, _, W|NoModrm, { InOutPortReg, 0, 0 } }, -{"out", 2, 0xe6, _, W|NoModrm, { Acc, Imm8, 0 } }, -{"out", 2, 0xee, _, W|NoModrm, { Acc, InOutPortReg, 0 } }, -{"out", 1, 0xe6, _, W|NoModrm, { Imm8, 0, 0 } }, -{"out", 1, 0xee, _, W|NoModrm, { InOutPortReg, 0, 0 } }, - -/* load effective address */ -{"lea", 2, 0x8d, _, Modrm, { WordMem, WordReg, 0 } }, - -/* load segment registers from memory */ -{"lds", 2, 0xc5, _, Modrm, { Mem, Reg32, 0} }, -{"les", 2, 0xc4, _, Modrm, { Mem, Reg32, 0} }, -{"lfs", 2, 0x0fb4, _, Modrm, { Mem, Reg32, 0} }, -{"lgs", 2, 0x0fb5, _, Modrm, { Mem, Reg32, 0} }, -{"lss", 2, 0x0fb2, _, Modrm, { Mem, Reg32, 0} }, - -/* flags register instructions */ -{"clc", 0, 0xf8, _, NoModrm, { 0, 0, 0} }, -{"cld", 0, 0xfc, _, NoModrm, { 0, 0, 0} }, -{"cli", 0, 0xfa, _, NoModrm, { 0, 0, 0} }, -{"clts", 0, 0x0f06, _, NoModrm, { 0, 0, 0} }, -{"cmc", 0, 0xf5, _, NoModrm, { 0, 0, 0} }, -{"lahf", 0, 0x9f, _, NoModrm, { 0, 0, 0} }, -{"sahf", 0, 0x9e, _, NoModrm, { 0, 0, 0} }, -{"pushfl", 0, 0x9c, _, NoModrm|Data32, { 0, 0, 0} }, -{"popfl", 0, 0x9d, _, NoModrm|Data32, { 0, 0, 0} }, -{"pushfw", 0, 0x9c, _, NoModrm|Data16, { 0, 0, 0} }, -{"popfw", 0, 0x9d, _, NoModrm|Data16, { 0, 0, 0} }, -{"pushf", 0, 0x9c, _, NoModrm, { 0, 0, 0} }, -{"popf", 0, 0x9d, _, NoModrm, { 0, 0, 0} }, -{"stc", 0, 0xf9, _, NoModrm, { 0, 0, 0} }, -{"std", 0, 0xfd, _, NoModrm, { 0, 0, 0} }, -{"sti", 0, 0xfb, _, NoModrm, { 0, 0, 0} }, - -{"add", 2, 0x0, _, DW|Modrm, { Reg, Reg|Mem, 0} }, -{"add", 2, 0x83, 0, Modrm, { Imm8S, WordReg|WordMem, 0} }, -{"add", 2, 0x4, _, W|NoModrm, { Imm, Acc, 0} }, -{"add", 2, 0x80, 0, W|Modrm, { Imm, Reg|Mem, 0} }, - -{"inc", 1, 0x40, _, ShortForm, { WordReg, 0, 0} }, -{"inc", 1, 0xfe, 0, W|Modrm, { Reg|Mem, 0, 0} }, - -{"sub", 2, 0x28, _, DW|Modrm, { Reg, Reg|Mem, 0} }, -{"sub", 2, 0x83, 5, Modrm, { Imm8S, WordReg|WordMem, 0} }, -{"sub", 2, 0x2c, _, W|NoModrm, { Imm, Acc, 0} }, -{"sub", 2, 0x80, 5, W|Modrm, { Imm, Reg|Mem, 0} }, - -{"dec", 1, 0x48, _, ShortForm, { WordReg, 0, 0} }, -{"dec", 1, 0xfe, 1, W|Modrm, { Reg|Mem, 0, 0} }, - -{"sbb", 2, 0x18, _, DW|Modrm, { Reg, Reg|Mem, 0} }, -{"sbb", 2, 0x83, 3, Modrm, { Imm8S, WordReg|WordMem, 0} }, -{"sbb", 2, 0x1c, _, W|NoModrm, { Imm, Acc, 0} }, -{"sbb", 2, 0x80, 3, W|Modrm, { Imm, Reg|Mem, 0} }, - -{"cmp", 2, 0x38, _, DW|Modrm, { Reg, Reg|Mem, 0} }, -{"cmp", 2, 0x83, 7, Modrm, { Imm8S, WordReg|WordMem, 0} }, -{"cmp", 2, 0x3c, _, W|NoModrm, { Imm, Acc, 0} }, -{"cmp", 2, 0x80, 7, W|Modrm, { Imm, Reg|Mem, 0} }, - -{"test", 2, 0x84, _, W|Modrm, { Reg|Mem, Reg, 0} }, -{"test", 2, 0x84, _, W|Modrm, { Reg, Reg|Mem, 0} }, -{"test", 2, 0xa8, _, W|NoModrm, { Imm, Acc, 0} }, -{"test", 2, 0xf6, 0, W|Modrm, { Imm, Reg|Mem, 0} }, - -{"and", 2, 0x20, _, DW|Modrm, { Reg, Reg|Mem, 0} }, -{"and", 2, 0x83, 4, Modrm, { Imm8S, WordReg|WordMem, 0} }, -{"and", 2, 0x24, _, W|NoModrm, { Imm, Acc, 0} }, -{"and", 2, 0x80, 4, W|Modrm, { Imm, Reg|Mem, 0} }, - -{"or", 2, 0x08, _, DW|Modrm, { Reg, Reg|Mem, 0} }, -{"or", 2, 0x83, 1, Modrm, { Imm8S, WordReg|WordMem, 0} }, -{"or", 2, 0x0c, _, W|NoModrm, { Imm, Acc, 0} }, -{"or", 2, 0x80, 1, W|Modrm, { Imm, Reg|Mem, 0} }, - -{"xor", 2, 0x30, _, DW|Modrm, { Reg, Reg|Mem, 0} }, -{"xor", 2, 0x83, 6, Modrm, { Imm8S, WordReg|WordMem, 0} }, -{"xor", 2, 0x34, _, W|NoModrm, { Imm, Acc, 0} }, -{"xor", 2, 0x80, 6, W|Modrm, { Imm, Reg|Mem, 0} }, - -{"adc", 2, 0x10, _, DW|Modrm, { Reg, Reg|Mem, 0} }, -{"adc", 2, 0x83, 2, Modrm, { Imm8S, WordReg|WordMem, 0} }, -{"adc", 2, 0x14, _, W|NoModrm, { Imm, Acc, 0} }, -{"adc", 2, 0x80, 2, W|Modrm, { Imm, Reg|Mem, 0} }, - -{"neg", 1, 0xf6, 3, W|Modrm, { Reg|Mem, 0, 0} }, -{"not", 1, 0xf6, 2, W|Modrm, { Reg|Mem, 0, 0} }, - -{"aaa", 0, 0x37, _, NoModrm, { 0, 0, 0} }, -{"aas", 0, 0x3f, _, NoModrm, { 0, 0, 0} }, -{"daa", 0, 0x27, _, NoModrm, { 0, 0, 0} }, -{"das", 0, 0x2f, _, NoModrm, { 0, 0, 0} }, -{"aad", 0, 0xd50a, _, NoModrm, { 0, 0, 0} }, -{"aam", 0, 0xd40a, _, NoModrm, { 0, 0, 0} }, - -/* conversion insns */ -/* conversion: intel naming */ -{"cbw", 0, 0x98, _, NoModrm|Data16, { 0, 0, 0} }, -{"cwd", 0, 0x99, _, NoModrm|Data16, { 0, 0, 0} }, -{"cwde", 0, 0x98, _, NoModrm|Data32, { 0, 0, 0} }, -{"cdq", 0, 0x99, _, NoModrm|Data32, { 0, 0, 0} }, -/* att naming */ -{"cbtw", 0, 0x98, _, NoModrm|Data16, { 0, 0, 0} }, -{"cwtl", 0, 0x98, _, NoModrm|Data32, { 0, 0, 0} }, -{"cwtd", 0, 0x99, _, NoModrm|Data16, { 0, 0, 0} }, -{"cltd", 0, 0x99, _, NoModrm|Data32, { 0, 0, 0} }, - -/* Warning! the mul/imul (opcode 0xf6) must only have 1 operand! They are - expanding 64-bit multiplies, and *cannot* be selected to accomplish - 'imul %ebx, %eax' (opcode 0x0faf must be used in this case) - These multiplies can only be selected with single operand forms. */ -{"mul", 1, 0xf6, 4, W|Modrm, { Reg|Mem, 0, 0} }, -{"imul", 1, 0xf6, 5, W|Modrm, { Reg|Mem, 0, 0} }, - - - - -/* imulKludge here is needed to reverse the i.rm.reg & i.rm.regmem fields. - These instructions are exceptions: 'imul $2, %eax, %ecx' would put - '%eax' in the reg field and '%ecx' in the regmem field if we did not - switch them. */ -{"imul", 2, 0x0faf, _, Modrm|ReverseRegRegmem, { WordReg|Mem, WordReg, 0} }, -{"imul", 3, 0x6b, _, Modrm|ReverseRegRegmem, { Imm8S, WordReg|Mem, WordReg} }, -{"imul", 3, 0x69, _, Modrm|ReverseRegRegmem, { Imm16|Imm32, WordReg|Mem, WordReg} }, -/* - imul with 2 operands mimicks imul with 3 by puting register both - in i.rm.reg & i.rm.regmem fields -*/ -{"imul", 2, 0x6b, _, Modrm|imulKludge, { Imm8S, WordReg, 0} }, -{"imul", 2, 0x69, _, Modrm|imulKludge, { Imm16|Imm32, WordReg, 0} }, -{"div", 1, 0xf6, 6, W|Modrm, { Reg|Mem, 0, 0} }, -{"div", 2, 0xf6, 6, W|Modrm, { Reg|Mem, Acc, 0} }, -{"idiv", 1, 0xf6, 7, W|Modrm, { Reg|Mem, 0, 0} }, -{"idiv", 2, 0xf6, 7, W|Modrm, { Reg|Mem, Acc, 0} }, - -{"rol", 2, 0xd0, 0, W|Modrm, { Imm1, Reg|Mem, 0} }, -{"rol", 2, 0xc0, 0, W|Modrm, { Imm8, Reg|Mem, 0} }, -{"rol", 2, 0xd2, 0, W|Modrm, { ShiftCount, Reg|Mem, 0} }, -{"rol", 1, 0xd0, 0, W|Modrm, { Reg|Mem, 0, 0} }, - -{"ror", 2, 0xd0, 1, W|Modrm, { Imm1, Reg|Mem, 0} }, -{"ror", 2, 0xc0, 1, W|Modrm, { Imm8, Reg|Mem, 0} }, -{"ror", 2, 0xd2, 1, W|Modrm, { ShiftCount, Reg|Mem, 0} }, -{"ror", 1, 0xd0, 1, W|Modrm, { Reg|Mem, 0, 0} }, - -{"rcl", 2, 0xd0, 2, W|Modrm, { Imm1, Reg|Mem, 0} }, -{"rcl", 2, 0xc0, 2, W|Modrm, { Imm8, Reg|Mem, 0} }, -{"rcl", 2, 0xd2, 2, W|Modrm, { ShiftCount, Reg|Mem, 0} }, -{"rcl", 1, 0xd0, 2, W|Modrm, { Reg|Mem, 0, 0} }, - -{"rcr", 2, 0xd0, 3, W|Modrm, { Imm1, Reg|Mem, 0} }, -{"rcr", 2, 0xc0, 3, W|Modrm, { Imm8, Reg|Mem, 0} }, -{"rcr", 2, 0xd2, 3, W|Modrm, { ShiftCount, Reg|Mem, 0} }, -{"rcr", 1, 0xd0, 3, W|Modrm, { Reg|Mem, 0, 0} }, - -{"sal", 2, 0xd0, 4, W|Modrm, { Imm1, Reg|Mem, 0} }, -{"sal", 2, 0xc0, 4, W|Modrm, { Imm8, Reg|Mem, 0} }, -{"sal", 2, 0xd2, 4, W|Modrm, { ShiftCount, Reg|Mem, 0} }, -{"sal", 1, 0xd0, 4, W|Modrm, { Reg|Mem, 0, 0} }, -{"shl", 2, 0xd0, 4, W|Modrm, { Imm1, Reg|Mem, 0} }, -{"shl", 2, 0xc0, 4, W|Modrm, { Imm8, Reg|Mem, 0} }, -{"shl", 2, 0xd2, 4, W|Modrm, { ShiftCount, Reg|Mem, 0} }, -{"shl", 1, 0xd0, 4, W|Modrm, { Reg|Mem, 0, 0} }, - -{"shld", 3, 0x0fa4, _, Modrm, { Imm8, WordReg, WordReg|Mem} }, -{"shld", 3, 0x0fa5, _, Modrm, { ShiftCount, WordReg, WordReg|Mem} }, -{"shld", 2, 0x0fa5, _, Modrm, { WordReg, WordReg|Mem, 0} }, - -{"shr", 2, 0xd0, 5, W|Modrm, { Imm1, Reg|Mem, 0} }, -{"shr", 2, 0xc0, 5, W|Modrm, { Imm8, Reg|Mem, 0} }, -{"shr", 2, 0xd2, 5, W|Modrm, { ShiftCount, Reg|Mem, 0} }, -{"shr", 1, 0xd0, 5, W|Modrm, { Reg|Mem, 0, 0} }, - -{"shrd", 3, 0x0fac, _, Modrm, { Imm8, WordReg, WordReg|Mem} }, -{"shrd", 3, 0x0fad, _, Modrm, { ShiftCount, WordReg, WordReg|Mem} }, -{"shrd", 2, 0x0fad, _, Modrm, { WordReg, WordReg|Mem, 0} }, - -{"sar", 2, 0xd0, 7, W|Modrm, { Imm1, Reg|Mem, 0} }, -{"sar", 2, 0xc0, 7, W|Modrm, { Imm8, Reg|Mem, 0} }, -{"sar", 2, 0xd2, 7, W|Modrm, { ShiftCount, Reg|Mem, 0} }, -{"sar", 1, 0xd0, 7, W|Modrm, { Reg|Mem, 0, 0} }, - -/* control transfer instructions */ -#define CALL_PC_RELATIVE 0xe8 -{"call", 1, 0xe8, _, JumpDword, { Disp32, 0, 0} }, -{"call", 1, 0xff, 2, Modrm|Data32, { Reg|Mem|JumpAbsolute, 0, 0} }, -{"callw", 1, 0xff, 2, Modrm|Data16, { Reg|Mem|JumpAbsolute, 0, 0} }, -#define CALL_FAR_IMMEDIATE 0x9a -{"lcall", 2, 0x9a, _, JumpInterSegment, { Imm16, Abs32|Imm32, 0} }, -{"lcall", 1, 0xff, 3, Modrm|Data32, { Mem, 0, 0} }, -{"lcallw", 1, 0xff, 3, Modrm|Data16, { Mem, 0, 0} }, - -#define JUMP_PC_RELATIVE 0xeb -{"jmp", 1, 0xeb, _, Jump, { Disp, 0, 0} }, -{"jmp", 1, 0xff, 4, Modrm, { Reg32|Mem|JumpAbsolute, 0, 0} }, -#define JUMP_FAR_IMMEDIATE 0xea -{"ljmp", 2, 0xea, _, JumpInterSegment, { Imm16, Imm32, 0} }, -{"ljmp", 1, 0xff, 5, Modrm|Data32, { Mem, 0, 0} }, - -{"ret", 0, 0xc3, _, NoModrm|Data32, { 0, 0, 0} }, -{"ret", 1, 0xc2, _, NoModrm|Data32, { Imm16, 0, 0} }, -{"retw", 0, 0xc3, _, NoModrm|Data16, { 0, 0, 0} }, -{"retw", 1, 0xc2, _, NoModrm|Data16, { Imm16, 0, 0} }, -{"lret", 0, 0xcb, _, NoModrm|Data32, { 0, 0, 0} }, -{"lret", 1, 0xca, _, NoModrm|Data32, { Imm16, 0, 0} }, -{"lretw", 0, 0xcb, _, NoModrm|Data16, { 0, 0, 0} }, -{"lretw", 1, 0xca, _, NoModrm|Data16, { Imm16, 0, 0} }, -{"enter", 2, 0xc8, _, NoModrm|Data32, { Imm16, Imm8, 0} }, -{"leave", 0, 0xc9, _, NoModrm|Data32, { 0, 0, 0} }, -{"enterw", 2, 0xc8, _, NoModrm|Data16, { Imm16, Imm8, 0} }, -{"leavew", 0, 0xc9, _, NoModrm|Data16, { 0, 0, 0} }, - -/* conditional jumps */ -{"jo", 1, 0x70, _, Jump, { Disp, 0, 0} }, - -{"jno", 1, 0x71, _, Jump, { Disp, 0, 0} }, - -{"jb", 1, 0x72, _, Jump, { Disp, 0, 0} }, -{"jc", 1, 0x72, _, Jump, { Disp, 0, 0} }, -{"jnae", 1, 0x72, _, Jump, { Disp, 0, 0} }, - -{"jnb", 1, 0x73, _, Jump, { Disp, 0, 0} }, -{"jnc", 1, 0x73, _, Jump, { Disp, 0, 0} }, -{"jae", 1, 0x73, _, Jump, { Disp, 0, 0} }, - -{"je", 1, 0x74, _, Jump, { Disp, 0, 0} }, -{"jz", 1, 0x74, _, Jump, { Disp, 0, 0} }, - -{"jne", 1, 0x75, _, Jump, { Disp, 0, 0} }, -{"jnz", 1, 0x75, _, Jump, { Disp, 0, 0} }, - -{"jbe", 1, 0x76, _, Jump, { Disp, 0, 0} }, -{"jna", 1, 0x76, _, Jump, { Disp, 0, 0} }, - -{"jnbe", 1, 0x77, _, Jump, { Disp, 0, 0} }, -{"ja", 1, 0x77, _, Jump, { Disp, 0, 0} }, - -{"js", 1, 0x78, _, Jump, { Disp, 0, 0} }, - -{"jns", 1, 0x79, _, Jump, { Disp, 0, 0} }, - -{"jp", 1, 0x7a, _, Jump, { Disp, 0, 0} }, -{"jpe", 1, 0x7a, _, Jump, { Disp, 0, 0} }, - -{"jnp", 1, 0x7b, _, Jump, { Disp, 0, 0} }, -{"jpo", 1, 0x7b, _, Jump, { Disp, 0, 0} }, - -{"jl", 1, 0x7c, _, Jump, { Disp, 0, 0} }, -{"jnge", 1, 0x7c, _, Jump, { Disp, 0, 0} }, - -{"jnl", 1, 0x7d, _, Jump, { Disp, 0, 0} }, -{"jge", 1, 0x7d, _, Jump, { Disp, 0, 0} }, - -{"jle", 1, 0x7e, _, Jump, { Disp, 0, 0} }, -{"jng", 1, 0x7e, _, Jump, { Disp, 0, 0} }, - -{"jnle", 1, 0x7f, _, Jump, { Disp, 0, 0} }, -{"jg", 1, 0x7f, _, Jump, { Disp, 0, 0} }, - -#if 0 /* XXX where are these macros used? - To get them working again, they need to take - an entire template as the parameter, - and check for Data16/Data32 flags. */ -/* these turn into pseudo operations when disp is larger than 8 bits */ -#define IS_JUMP_ON_CX_ZERO(o) \ - (o == 0x66e3) -#define IS_JUMP_ON_ECX_ZERO(o) \ - (o == 0xe3) -#endif - -{"jcxz", 1, 0xe3, _, JumpByte|Data16, { Disp, 0, 0} }, -{"jecxz", 1, 0xe3, _, JumpByte|Data32, { Disp, 0, 0} }, - -#define IS_LOOP_ECX_TIMES(o) \ - (o == 0xe2 || o == 0xe1 || o == 0xe0) - -{"loop", 1, 0xe2, _, JumpByte, { Disp, 0, 0} }, - -{"loopz", 1, 0xe1, _, JumpByte, { Disp, 0, 0} }, -{"loope", 1, 0xe1, _, JumpByte, { Disp, 0, 0} }, - -{"loopnz", 1, 0xe0, _, JumpByte, { Disp, 0, 0} }, -{"loopne", 1, 0xe0, _, JumpByte, { Disp, 0, 0} }, - -/* set byte on flag instructions */ -{"seto", 1, 0x0f90, 0, Modrm, { Reg8|Mem, 0, 0} }, - -{"setno", 1, 0x0f91, 0, Modrm, { Reg8|Mem, 0, 0} }, - -{"setb", 1, 0x0f92, 0, Modrm, { Reg8|Mem, 0, 0} }, -{"setc", 1, 0x0f92, 0, Modrm, { Reg8|Mem, 0, 0} }, -{"setnae", 1, 0x0f92, 0, Modrm, { Reg8|Mem, 0, 0} }, - -{"setnb", 1, 0x0f93, 0, Modrm, { Reg8|Mem, 0, 0} }, -{"setnc", 1, 0x0f93, 0, Modrm, { Reg8|Mem, 0, 0} }, -{"setae", 1, 0x0f93, 0, Modrm, { Reg8|Mem, 0, 0} }, - -{"sete", 1, 0x0f94, 0, Modrm, { Reg8|Mem, 0, 0} }, -{"setz", 1, 0x0f94, 0, Modrm, { Reg8|Mem, 0, 0} }, - -{"setne", 1, 0x0f95, 0, Modrm, { Reg8|Mem, 0, 0} }, -{"setnz", 1, 0x0f95, 0, Modrm, { Reg8|Mem, 0, 0} }, - -{"setbe", 1, 0x0f96, 0, Modrm, { Reg8|Mem, 0, 0} }, -{"setna", 1, 0x0f96, 0, Modrm, { Reg8|Mem, 0, 0} }, - -{"setnbe", 1, 0x0f97, 0, Modrm, { Reg8|Mem, 0, 0} }, -{"seta", 1, 0x0f97, 0, Modrm, { Reg8|Mem, 0, 0} }, - -{"sets", 1, 0x0f98, 0, Modrm, { Reg8|Mem, 0, 0} }, - -{"setns", 1, 0x0f99, 0, Modrm, { Reg8|Mem, 0, 0} }, - -{"setp", 1, 0x0f9a, 0, Modrm, { Reg8|Mem, 0, 0} }, -{"setpe", 1, 0x0f9a, 0, Modrm, { Reg8|Mem, 0, 0} }, - -{"setnp", 1, 0x0f9b, 0, Modrm, { Reg8|Mem, 0, 0} }, -{"setpo", 1, 0x0f9b, 0, Modrm, { Reg8|Mem, 0, 0} }, - -{"setl", 1, 0x0f9c, 0, Modrm, { Reg8|Mem, 0, 0} }, -{"setnge", 1, 0x0f9c, 0, Modrm, { Reg8|Mem, 0, 0} }, - -{"setnl", 1, 0x0f9d, 0, Modrm, { Reg8|Mem, 0, 0} }, -{"setge", 1, 0x0f9d, 0, Modrm, { Reg8|Mem, 0, 0} }, - -{"setle", 1, 0x0f9e, 0, Modrm, { Reg8|Mem, 0, 0} }, -{"setng", 1, 0x0f9e, 0, Modrm, { Reg8|Mem, 0, 0} }, - -{"setnle", 1, 0x0f9f, 0, Modrm, { Reg8|Mem, 0, 0} }, -{"setg", 1, 0x0f9f, 0, Modrm, { Reg8|Mem, 0, 0} }, - -#define IS_STRING_INSTRUCTION(o) \ - ((o) == 0xa6 || (o) == 0x6c || (o) == 0x6e || (o) == 0x6e || \ - (o) == 0xac || (o) == 0xa4 || (o) == 0xae || (o) == 0xaa || \ - (o) == 0xd7) - -/* string manipulation */ -{"cmps", 0, 0xa6, _, W|NoModrm, { 0, 0, 0} }, -{"scmp", 0, 0xa6, _, W|NoModrm, { 0, 0, 0} }, -{"ins", 0, 0x6c, _, W|NoModrm, { 0, 0, 0} }, -{"outs", 0, 0x6e, _, W|NoModrm, { 0, 0, 0} }, -{"lods", 0, 0xac, _, W|NoModrm, { 0, 0, 0} }, -{"slod", 0, 0xac, _, W|NoModrm, { 0, 0, 0} }, -{"movs", 0, 0xa4, _, W|NoModrm, { 0, 0, 0} }, -{"smov", 0, 0xa4, _, W|NoModrm, { 0, 0, 0} }, -{"scas", 0, 0xae, _, W|NoModrm, { 0, 0, 0} }, -{"ssca", 0, 0xae, _, W|NoModrm, { 0, 0, 0} }, -{"stos", 0, 0xaa, _, W|NoModrm, { 0, 0, 0} }, -{"ssto", 0, 0xaa, _, W|NoModrm, { 0, 0, 0} }, -{"xlat", 0, 0xd7, _, NoModrm, { 0, 0, 0} }, - -/* bit manipulation */ -{"bsf", 2, 0x0fbc, _, Modrm|ReverseRegRegmem, { Reg|Mem, Reg, 0} }, -{"bsr", 2, 0x0fbd, _, Modrm|ReverseRegRegmem, { Reg|Mem, Reg, 0} }, -{"bt", 2, 0x0fa3, _, Modrm, { Reg, Reg|Mem, 0} }, -{"bt", 2, 0x0fba, 4, Modrm, { Imm8, Reg|Mem, 0} }, -{"btc", 2, 0x0fbb, _, Modrm, { Reg, Reg|Mem, 0} }, -{"btc", 2, 0x0fba, 7, Modrm, { Imm8, Reg|Mem, 0} }, -{"btr", 2, 0x0fb3, _, Modrm, { Reg, Reg|Mem, 0} }, -{"btr", 2, 0x0fba, 6, Modrm, { Imm8, Reg|Mem, 0} }, -{"bts", 2, 0x0fab, _, Modrm, { Reg, Reg|Mem, 0} }, -{"bts", 2, 0x0fba, 5, Modrm, { Imm8, Reg|Mem, 0} }, - -/* interrupts & op. sys insns */ -/* See gas/config/tc-i386.c for conversion of 'int $3' into the special - int 3 insn. */ -#define INT_OPCODE 0xcd -#define INT3_OPCODE 0xcc -{"int", 1, 0xcd, _, NoModrm, { Imm8, 0, 0} }, -{"int3", 0, 0xcc, _, NoModrm, { 0, 0, 0} }, -{"into", 0, 0xce, _, NoModrm, { 0, 0, 0} }, -{"iret", 0, 0xcf, _, NoModrm|Data32, { 0, 0, 0} }, -{"iretw", 0, 0xcf, _, NoModrm|Data16, { 0, 0, 0} }, -/* i386sl, i486sl, later 486, and Pentium */ -{"rsm", 0, 0x0faa, _, NoModrm,{ 0, 0, 0} }, - -{"boundl", 2, 0x62, _, Modrm|Data32, { Reg32, Mem, 0} }, -{"boundw", 2, 0x62, _, Modrm|Data16, { Reg16, Mem, 0} }, - -{"hlt", 0, 0xf4, _, NoModrm, { 0, 0, 0} }, -{"wait", 0, 0x9b, _, NoModrm, { 0, 0, 0} }, -/* nop is actually 'xchgl %eax, %eax' */ -{"nop", 0, 0x90, _, NoModrm, { 0, 0, 0} }, - -/* protection control */ -{"arpl", 2, 0x63, _, Modrm, { Reg16, Reg16|Mem, 0} }, -{"lar", 2, 0x0f02, _, Modrm|ReverseRegRegmem, { WordReg|Mem, WordReg, 0} }, -{"lgdt", 1, 0x0f01, 2, Modrm, { Mem, 0, 0} }, -{"lidt", 1, 0x0f01, 3, Modrm, { Mem, 0, 0} }, -{"lldt", 1, 0x0f00, 2, Modrm, { WordReg|Mem, 0, 0} }, -{"lmsw", 1, 0x0f01, 6, Modrm, { WordReg|Mem, 0, 0} }, -{"lsl", 2, 0x0f03, _, Modrm|ReverseRegRegmem, { WordReg|Mem, WordReg, 0} }, -{"ltr", 1, 0x0f00, 3, Modrm, { WordReg|Mem, 0, 0} }, - -{"sgdt", 1, 0x0f01, 0, Modrm, { Mem, 0, 0} }, -{"sidt", 1, 0x0f01, 1, Modrm, { Mem, 0, 0} }, -{"sldt", 1, 0x0f00, 0, Modrm, { WordReg|Mem, 0, 0} }, -{"smsw", 1, 0x0f01, 4, Modrm, { WordReg|Mem, 0, 0} }, -{"str", 1, 0x0f00, 1, Modrm, { Reg16|Mem, 0, 0} }, - -{"verr", 1, 0x0f00, 4, Modrm, { WordReg|Mem, 0, 0} }, -{"verw", 1, 0x0f00, 5, Modrm, { WordReg|Mem, 0, 0} }, - -/* floating point instructions */ - -/* load */ -{"fld", 1, 0xd9c0, _, ShortForm, { FloatReg, 0, 0} }, /* register */ -{"flds", 1, 0xd9, 0, Modrm, { Mem, 0, 0} }, /* %st0 <-- mem float */ -{"fldl", 1, 0xdd, 0, Modrm, { Mem, 0, 0} }, /* %st0 <-- mem double */ -{"fldl", 1, 0xd9c0, _, ShortForm, { FloatReg, 0, 0} }, /* register */ -{"fild", 1, 0xdf, 0, Modrm, { Mem, 0, 0} }, /* %st0 <-- mem word (16) */ -{"fildl", 1, 0xdb, 0, Modrm, { Mem, 0, 0} }, /* %st0 <-- mem dword (32) */ -{"fildq",1, 0xdf, 5, Modrm, { Mem, 0, 0} }, /* %st0 <-- mem qword (64) */ -{"fildll",1, 0xdf, 5, Modrm, { Mem, 0, 0} }, /* %st0 <-- mem qword (64) */ -{"fldt", 1, 0xdb, 5, Modrm, { Mem, 0, 0} }, /* %st0 <-- mem efloat */ -{"fbld", 1, 0xdf, 4, Modrm, { Mem, 0, 0} }, /* %st0 <-- mem bcd */ - -/* store (no pop) */ -{"fst", 1, 0xddd0, _, ShortForm, { FloatReg, 0, 0} }, /* register */ -{"fsts", 1, 0xd9, 2, Modrm, { Mem, 0, 0} }, /* %st0 --> mem float */ -{"fstl", 1, 0xdd, 2, Modrm, { Mem, 0, 0} }, /* %st0 --> mem double */ -{"fstl", 1, 0xddd0, _, ShortForm, { FloatReg, 0, 0} }, /* register */ -{"fist", 1, 0xdf, 2, Modrm, { Mem, 0, 0} }, /* %st0 --> mem word (16) */ -{"fistl", 1, 0xdb, 2, Modrm, { Mem, 0, 0} }, /* %st0 --> mem dword (32) */ - -/* store (with pop) */ -{"fstp", 1, 0xddd8, _, ShortForm, { FloatReg, 0, 0} }, /* register */ -{"fstps", 1, 0xd9, 3, Modrm, { Mem, 0, 0} }, /* %st0 --> mem float */ -{"fstpl", 1, 0xdd, 3, Modrm, { Mem, 0, 0} }, /* %st0 --> mem double */ -{"fstpl", 1, 0xddd8, _, ShortForm, { FloatReg, 0, 0} }, /* register */ -{"fistp", 1, 0xdf, 3, Modrm, { Mem, 0, 0} }, /* %st0 --> mem word (16) */ -{"fistpl",1, 0xdb, 3, Modrm, { Mem, 0, 0} }, /* %st0 --> mem dword (32) */ -{"fistpq",1, 0xdf, 7, Modrm, { Mem, 0, 0} }, /* %st0 --> mem qword (64) */ -{"fistpll",1,0xdf, 7, Modrm, { Mem, 0, 0} }, /* %st0 --> mem qword (64) */ -{"fstpt", 1, 0xdb, 7, Modrm, { Mem, 0, 0} }, /* %st0 --> mem efloat */ -{"fbstp", 1, 0xdf, 6, Modrm, { Mem, 0, 0} }, /* %st0 --> mem bcd */ - -/* exchange %st with %st0 */ -{"fxch", 1, 0xd9c8, _, ShortForm, { FloatReg, 0, 0} }, -{"fxch", 0, 0xd9c9, _, NoModrm, { 0, 0, 0} }, /* alias for fxch %st, %st(1) */ - -/* comparison (without pop) */ -{"fcom", 1, 0xd8d0, _, ShortForm, { FloatReg, 0, 0} }, -{"fcoms", 1, 0xd8, 2, Modrm, { Mem, 0, 0} }, /* compare %st0, mem float */ -{"ficoml", 1, 0xda, 2, Modrm, { Mem, 0, 0} }, /* compare %st0, mem word */ -{"fcoml", 1, 0xdc, 2, Modrm, { Mem, 0, 0} }, /* compare %st0, mem double */ -{"fcoml", 1, 0xd8d0, _, ShortForm, { FloatReg, 0, 0} }, -{"ficoms", 1, 0xde, 2, Modrm, { Mem, 0, 0} }, /* compare %st0, mem dword */ - -/* comparison (with pop) */ -{"fcomp", 1, 0xd8d8, _, ShortForm, { FloatReg, 0, 0} }, -{"fcomps", 1, 0xd8, 3, Modrm, { Mem, 0, 0} }, /* compare %st0, mem float */ -{"ficompl", 1, 0xda, 3, Modrm, { Mem, 0, 0} }, /* compare %st0, mem word */ -{"fcompl", 1, 0xdc, 3, Modrm, { Mem, 0, 0} }, /* compare %st0, mem double */ -{"fcompl", 1, 0xd8d8, _, ShortForm, { FloatReg, 0, 0} }, -{"ficomps", 1, 0xde, 3, Modrm, { Mem, 0, 0} }, /* compare %st0, mem dword */ -{"fcompp", 0, 0xded9, _, NoModrm, { 0, 0, 0} }, /* compare %st0, %st1 & pop 2 */ - -/* unordered comparison (with pop) */ -{"fucom", 1, 0xdde0, _, ShortForm, { FloatReg, 0, 0} }, -{"fucomp", 1, 0xdde8, _, ShortForm, { FloatReg, 0, 0} }, -{"fucompp", 0, 0xdae9, _, NoModrm, { 0, 0, 0} }, /* ucompare %st0, %st1 & pop twice */ - -{"ftst", 0, 0xd9e4, _, NoModrm, { 0, 0, 0} }, /* test %st0 */ -{"fxam", 0, 0xd9e5, _, NoModrm, { 0, 0, 0} }, /* examine %st0 */ - -/* load constants into %st0 */ -{"fld1", 0, 0xd9e8, _, NoModrm, { 0, 0, 0} }, /* %st0 <-- 1.0 */ -{"fldl2t", 0, 0xd9e9, _, NoModrm, { 0, 0, 0} }, /* %st0 <-- log2(10) */ -{"fldl2e", 0, 0xd9ea, _, NoModrm, { 0, 0, 0} }, /* %st0 <-- log2(e) */ -{"fldpi", 0, 0xd9eb, _, NoModrm, { 0, 0, 0} }, /* %st0 <-- pi */ -{"fldlg2", 0, 0xd9ec, _, NoModrm, { 0, 0, 0} }, /* %st0 <-- log10(2) */ -{"fldln2", 0, 0xd9ed, _, NoModrm, { 0, 0, 0} }, /* %st0 <-- ln(2) */ -{"fldz", 0, 0xd9ee, _, NoModrm, { 0, 0, 0} }, /* %st0 <-- 0.0 */ - -/* arithmetic */ - -/* add */ -{"fadd", 1, 0xd8c0, _, ShortForm, { FloatReg, 0, 0} }, -{"fadd", 2, 0xd8c0, _, ShortForm|FloatD, { FloatReg, FloatAcc, 0} }, -{"fadd", 0, 0xdcc1, _, NoModrm, { 0, 0, 0} }, /* alias for fadd %st, %st(1) */ -{"faddp", 1, 0xdac0, _, ShortForm, { FloatReg, 0, 0} }, -{"faddp", 2, 0xdac0, _, ShortForm|FloatD, { FloatReg, FloatAcc, 0} }, -{"faddp", 0, 0xdec1, _, NoModrm, { 0, 0, 0} }, /* alias for faddp %st, %st(1) */ -{"fadds", 1, 0xd8, 0, Modrm, { Mem, 0, 0} }, -{"fiaddl", 1, 0xda, 0, Modrm, { Mem, 0, 0} }, -{"faddl", 1, 0xdc, 0, Modrm, { Mem, 0, 0} }, -{"fiadds", 1, 0xde, 0, Modrm, { Mem, 0, 0} }, - -/* sub */ -/* Note: intel has decided that certain of these operations are reversed - in assembler syntax. */ -{"fsub", 1, 0xd8e0, _, ShortForm, { FloatReg, 0, 0} }, -{"fsub", 2, 0xd8e0, _, ShortForm, { FloatReg, FloatAcc, 0} }, -#ifdef NON_BROKEN_OPCODES -{"fsub", 2, 0xdce8, _, ShortForm, { FloatAcc, FloatReg, 0} }, -#else -{"fsub", 2, 0xdce0, _, ShortForm, { FloatAcc, FloatReg, 0} }, -#endif -{"fsub", 0, 0xdce1, _, NoModrm, { 0, 0, 0} }, -{"fsubp", 1, 0xdae0, _, ShortForm, { FloatReg, 0, 0} }, -{"fsubp", 2, 0xdae0, _, ShortForm, { FloatReg, FloatAcc, 0} }, -#ifdef NON_BROKEN_OPCODES -{"fsubp", 2, 0xdee8, _, ShortForm, { FloatAcc, FloatReg, 0} }, -#else -{"fsubp", 2, 0xdee0, _, ShortForm, { FloatAcc, FloatReg, 0} }, -#endif -{"fsubp", 0, 0xdee1, _, NoModrm, { 0, 0, 0} }, -{"fsubs", 1, 0xd8, 4, Modrm, { Mem, 0, 0} }, -{"fisubl", 1, 0xda, 4, Modrm, { Mem, 0, 0} }, -{"fsubl", 1, 0xdc, 4, Modrm, { Mem, 0, 0} }, -{"fisubs", 1, 0xde, 4, Modrm, { Mem, 0, 0} }, - -/* sub reverse */ -{"fsubr", 1, 0xd8e8, _, ShortForm, { FloatReg, 0, 0} }, -{"fsubr", 2, 0xd8e8, _, ShortForm, { FloatReg, FloatAcc, 0} }, -#ifdef NON_BROKEN_OPCODES -{"fsubr", 2, 0xdce0, _, ShortForm, { FloatAcc, FloatReg, 0} }, -#else -{"fsubr", 2, 0xdce8, _, ShortForm, { FloatAcc, FloatReg, 0} }, -#endif -{"fsubr", 0, 0xdce9, _, NoModrm, { 0, 0, 0} }, -{"fsubrp", 1, 0xdae8, _, ShortForm, { FloatReg, 0, 0} }, -{"fsubrp", 2, 0xdae8, _, ShortForm, { FloatReg, FloatAcc, 0} }, -#ifdef NON_BROKEN_OPCODES -{"fsubrp", 2, 0xdee0, _, ShortForm, { FloatAcc, FloatReg, 0} }, -#else -{"fsubrp", 2, 0xdee8, _, ShortForm, { FloatAcc, FloatReg, 0} }, -#endif -{"fsubrp", 0, 0xdee9, _, NoModrm, { 0, 0, 0} }, -{"fsubrs", 1, 0xd8, 5, Modrm, { Mem, 0, 0} }, -{"fisubrl", 1, 0xda, 5, Modrm, { Mem, 0, 0} }, -{"fsubrl", 1, 0xdc, 5, Modrm, { Mem, 0, 0} }, -{"fisubrs", 1, 0xde, 5, Modrm, { Mem, 0, 0} }, - -/* mul */ -{"fmul", 1, 0xd8c8, _, ShortForm, { FloatReg, 0, 0} }, -{"fmul", 2, 0xd8c8, _, ShortForm|FloatD, { FloatReg, FloatAcc, 0} }, -{"fmul", 0, 0xdcc9, _, NoModrm, { 0, 0, 0} }, -{"fmulp", 1, 0xdac8, _, ShortForm, { FloatReg, 0, 0} }, -{"fmulp", 2, 0xdac8, _, ShortForm|FloatD, { FloatReg, FloatAcc, 0} }, -{"fmulp", 0, 0xdec9, _, NoModrm, { 0, 0, 0} }, -{"fmuls", 1, 0xd8, 1, Modrm, { Mem, 0, 0} }, -{"fimull", 1, 0xda, 1, Modrm, { Mem, 0, 0} }, -{"fmull", 1, 0xdc, 1, Modrm, { Mem, 0, 0} }, -{"fimuls", 1, 0xde, 1, Modrm, { Mem, 0, 0} }, - -/* div */ -/* Note: intel has decided that certain of these operations are reversed - in assembler syntax. */ -{"fdiv", 1, 0xd8f0, _, ShortForm, { FloatReg, 0, 0} }, -{"fdiv", 2, 0xd8f0, _, ShortForm, { FloatReg, FloatAcc, 0} }, -#ifdef NON_BROKEN_OPCODES -{"fdiv", 2, 0xdcf8, _, ShortForm, { FloatAcc, FloatReg, 0} }, -#else -{"fdiv", 2, 0xdcf0, _, ShortForm, { FloatAcc, FloatReg, 0} }, -#endif -{"fdiv", 0, 0xdcf1, _, NoModrm, { 0, 0, 0} }, -{"fdivp", 1, 0xdaf0, _, ShortForm, { FloatReg, 0, 0} }, -{"fdivp", 2, 0xdaf0, _, ShortForm, { FloatReg, FloatAcc, 0} }, -#ifdef NON_BROKEN_OPCODES -{"fdivp", 2, 0xdef8, _, ShortForm, { FloatAcc, FloatReg, 0} }, -#else -{"fdivp", 2, 0xdef0, _, ShortForm, { FloatAcc, FloatReg, 0} }, -#endif -{"fdivp", 0, 0xdef1, _, NoModrm, { 0, 0, 0} }, -{"fdivs", 1, 0xd8, 6, Modrm, { Mem, 0, 0} }, -{"fidivl", 1, 0xda, 6, Modrm, { Mem, 0, 0} }, -{"fdivl", 1, 0xdc, 6, Modrm, { Mem, 0, 0} }, -{"fidivs", 1, 0xde, 6, Modrm, { Mem, 0, 0} }, - -/* div reverse */ -{"fdivr", 1, 0xd8f8, _, ShortForm, { FloatReg, 0, 0} }, -{"fdivr", 2, 0xd8f8, _, ShortForm, { FloatReg, FloatAcc, 0} }, -#ifdef NON_BROKEN_OPCODES -{"fdivr", 2, 0xdcf0, _, ShortForm, { FloatAcc, FloatReg, 0} }, -#else -{"fdivr", 2, 0xdcf8, _, ShortForm, { FloatAcc, FloatReg, 0} }, -#endif -{"fdivr", 0, 0xdcf9, _, NoModrm, { 0, 0, 0} }, -{"fdivrp", 1, 0xdaf8, _, ShortForm, { FloatReg, 0, 0} }, -{"fdivrp", 2, 0xdaf8, _, ShortForm, { FloatReg, FloatAcc, 0} }, -#ifdef NON_BROKEN_OPCODES -{"fdivrp", 2, 0xdef0, _, ShortForm, { FloatAcc, FloatReg, 0} }, -#else -{"fdivrp", 2, 0xdef8, _, ShortForm, { FloatAcc, FloatReg, 0} }, -#endif -{"fdivrp", 0, 0xdef9, _, NoModrm, { 0, 0, 0} }, -{"fdivrs", 1, 0xd8, 7, Modrm, { Mem, 0, 0} }, -{"fidivrl", 1, 0xda, 7, Modrm, { Mem, 0, 0} }, -{"fdivrl", 1, 0xdc, 7, Modrm, { Mem, 0, 0} }, -{"fidivrs", 1, 0xde, 7, Modrm, { Mem, 0, 0} }, - -{"f2xm1", 0, 0xd9f0, _, NoModrm, { 0, 0, 0} }, -{"fyl2x", 0, 0xd9f1, _, NoModrm, { 0, 0, 0} }, -{"fptan", 0, 0xd9f2, _, NoModrm, { 0, 0, 0} }, -{"fpatan", 0, 0xd9f3, _, NoModrm, { 0, 0, 0} }, -{"fxtract", 0, 0xd9f4, _, NoModrm, { 0, 0, 0} }, -{"fprem1", 0, 0xd9f5, _, NoModrm, { 0, 0, 0} }, -{"fdecstp", 0, 0xd9f6, _, NoModrm, { 0, 0, 0} }, -{"fincstp", 0, 0xd9f7, _, NoModrm, { 0, 0, 0} }, -{"fprem", 0, 0xd9f8, _, NoModrm, { 0, 0, 0} }, -{"fyl2xp1", 0, 0xd9f9, _, NoModrm, { 0, 0, 0} }, -{"fsqrt", 0, 0xd9fa, _, NoModrm, { 0, 0, 0} }, -{"fsincos", 0, 0xd9fb, _, NoModrm, { 0, 0, 0} }, -{"frndint", 0, 0xd9fc, _, NoModrm, { 0, 0, 0} }, -{"fscale", 0, 0xd9fd, _, NoModrm, { 0, 0, 0} }, -{"fsin", 0, 0xd9fe, _, NoModrm, { 0, 0, 0} }, -{"fcos", 0, 0xd9ff, _, NoModrm, { 0, 0, 0} }, - -{"fchs", 0, 0xd9e0, _, NoModrm, { 0, 0, 0} }, -{"fabs", 0, 0xd9e1, _, NoModrm, { 0, 0, 0} }, - -/* processor control */ -{"fninit", 0, 0xdbe3, _, NoModrm, { 0, 0, 0} }, -{"finit", 0, 0x9bdbe3, _, NoModrm, { 0, 0, 0} }, -{"fldcw", 1, 0xd9, 5, Modrm, { Mem, 0, 0} }, -{"fnstcw", 1, 0xd9, 7, Modrm, { Mem, 0, 0} }, -{"fstcw", 1, 0x9bd9, 7, Modrm, { Mem, 0, 0} }, -{"fnstsw", 1, 0xdfe0, _, NoModrm, { Acc, 0, 0} }, -{"fnstsw", 1, 0xdd, 7, Modrm, { Mem, 0, 0} }, -{"fnstsw", 0, 0xdfe0, _, NoModrm, { 0, 0, 0} }, -{"fstsw", 1, 0x9bdfe0, _, NoModrm, { Acc, 0, 0} }, -{"fstsw", 1, 0x9bdd, 7, Modrm, { Mem, 0, 0} }, -{"fstsw", 0, 0x9bdfe0, _, NoModrm, { 0, 0, 0} }, -{"fnclex", 0, 0xdbe2, _, NoModrm, { 0, 0, 0} }, -{"fclex", 0, 0x9bdbe2, _, NoModrm, { 0, 0, 0} }, -/* - We ignore the short format (287) versions of fstenv/fldenv & fsave/frstor - instructions; i'm not sure how to add them or how they are different. - My 386/387 book offers no details about this. -*/ -{"fnstenv", 1, 0xd9, 6, Modrm, { Mem, 0, 0} }, -{"fstenv", 1, 0x9bd9, 6, Modrm, { Mem, 0, 0} }, -{"fldenv", 1, 0xd9, 4, Modrm, { Mem, 0, 0} }, -{"fnsave", 1, 0xdd, 6, Modrm, { Mem, 0, 0} }, -{"fsave", 1, 0x9bdd, 6, Modrm, { Mem, 0, 0} }, -{"frstor", 1, 0xdd, 4, Modrm, { Mem, 0, 0} }, - -{"ffree", 1, 0xddc0, _, ShortForm, { FloatReg, 0, 0} }, -{"fnop", 0, 0xd9d0, _, NoModrm, { 0, 0, 0} }, -{"fwait", 0, 0x9b, _, NoModrm, { 0, 0, 0} }, - -/* - opcode prefixes; we allow them as seperate insns too - (see prefix table below) -*/ -{"aword", 0, 0x67, _, NoModrm, { 0, 0, 0} }, -{"addr16", 0, 0x67, _, NoModrm, { 0, 0, 0} }, -{"word", 0, 0x66, _, NoModrm, { 0, 0, 0} }, -{"data16", 0, 0x66, _, NoModrm, { 0, 0, 0} }, -{"lock", 0, 0xf0, _, NoModrm, { 0, 0, 0} }, -{"cs", 0, 0x2e, _, NoModrm, { 0, 0, 0} }, -{"ds", 0, 0x3e, _, NoModrm, { 0, 0, 0} }, -{"es", 0, 0x26, _, NoModrm, { 0, 0, 0} }, -{"fs", 0, 0x64, _, NoModrm, { 0, 0, 0} }, -{"gs", 0, 0x65, _, NoModrm, { 0, 0, 0} }, -{"ss", 0, 0x36, _, NoModrm, { 0, 0, 0} }, -{"rep", 0, 0xf3, _, NoModrm, { 0, 0, 0} }, -{"repe", 0, 0xf3, _, NoModrm, { 0, 0, 0} }, -{"repz", 0, 0xf3, _, NoModrm, { 0, 0, 0} }, -{"repne", 0, 0xf2, _, NoModrm, { 0, 0, 0} }, -{"repnz", 0, 0xf2, _, NoModrm, { 0, 0, 0} }, - -/* 486 extensions */ - -{"bswap", 1, 0x0fc8, _, ShortForm, { Reg32,0,0 } }, -{"xadd", 2, 0x0fc0, _, DW|Modrm, { Reg, Reg|Mem, 0 } }, -{"cmpxchg", 2, 0x0fb0, _, DW|Modrm, { Reg, Reg|Mem, 0 } }, -{"invd", 0, 0x0f08, _, NoModrm, { 0, 0, 0} }, -{"wbinvd", 0, 0x0f09, _, NoModrm, { 0, 0, 0} }, -{"invlpg", 1, 0x0f01, 7, Modrm, { Mem, 0, 0} }, - -/* 586 and late 486 extensions */ -{"cpuid", 0, 0x0fa2, _, NoModrm, { 0, 0, 0} }, - -/* Pentium extensions */ -{"wrmsr", 0, 0x0f30, _, NoModrm, { 0, 0, 0} }, -{"rdtsc", 0, 0x0f31, _, NoModrm, { 0, 0, 0} }, -{"rdmsr", 0, 0x0f32, _, NoModrm, { 0, 0, 0} }, -{"cmpxchg8b", 1, 0x0fc7, 1, Modrm, { Mem, 0, 0} }, - -/* Pentium Pro extensions */ -{"rdpmc", 0, 0x0f33, _, NoModrm, { 0, 0, 0} }, - -{"cmovo", 2, 0x0f40, _, W|Modrm|ReverseRegRegmem, { WordReg|WordMem, WordReg, 0} }, -{"cmovno", 2, 0x0f41, _, W|Modrm|ReverseRegRegmem, { WordReg|WordMem, WordReg, 0} }, -{"cmovb", 2, 0x0f42, _, W|Modrm|ReverseRegRegmem, { WordReg|WordMem, WordReg, 0} }, -{"cmovae", 2, 0x0f43, _, W|Modrm|ReverseRegRegmem, { WordReg|WordMem, WordReg, 0} }, -{"cmove", 2, 0x0f44, _, W|Modrm|ReverseRegRegmem, { WordReg|WordMem, WordReg, 0} }, -{"cmovne", 2, 0x0f45, _, W|Modrm|ReverseRegRegmem, { WordReg|WordMem, WordReg, 0} }, -{"cmovbe", 2, 0x0f46, _, W|Modrm|ReverseRegRegmem, { WordReg|WordMem, WordReg, 0} }, -{"cmova", 2, 0x0f47, _, W|Modrm|ReverseRegRegmem, { WordReg|WordMem, WordReg, 0} }, -{"cmovs", 2, 0x0f48, _, W|Modrm|ReverseRegRegmem, { WordReg|WordMem, WordReg, 0} }, -{"cmovns", 2, 0x0f49, _, W|Modrm|ReverseRegRegmem, { WordReg|WordMem, WordReg, 0} }, -{"cmovp", 2, 0x0f4a, _, W|Modrm|ReverseRegRegmem, { WordReg|WordMem, WordReg, 0} }, -{"cmovnp", 2, 0x0f4b, _, W|Modrm|ReverseRegRegmem, { WordReg|WordMem, WordReg, 0} }, -{"cmovl", 2, 0x0f4c, _, W|Modrm|ReverseRegRegmem, { WordReg|WordMem, WordReg, 0} }, -{"cmovge", 2, 0x0f4d, _, W|Modrm|ReverseRegRegmem, { WordReg|WordMem, WordReg, 0} }, -{"cmovle", 2, 0x0f4e, _, W|Modrm|ReverseRegRegmem, { WordReg|WordMem, WordReg, 0} }, -{"cmovg", 2, 0x0f4f, _, W|Modrm|ReverseRegRegmem, { WordReg|WordMem, WordReg, 0} }, - -{"fcmovb", 2, 0xdac0, _, ShortForm, { FloatReg, FloatAcc, 0} }, -{"fcmove", 2, 0xdac8, _, ShortForm, { FloatReg, FloatAcc, 0} }, -{"fcmovbe",2, 0xdad0, _, ShortForm, { FloatReg, FloatAcc, 0} }, -{"fcmovu", 2, 0xdad8, _, ShortForm, { FloatReg, FloatAcc, 0} }, -{"fcmovnb", 2, 0xdbc0, _, ShortForm, { FloatReg, FloatAcc, 0} }, -{"fcmovne", 2, 0xdbc8, _, ShortForm, { FloatReg, FloatAcc, 0} }, -{"fcmovnbe",2, 0xdbd0, _, ShortForm, { FloatReg, FloatAcc, 0} }, -{"fcmovnu", 2, 0xdbd8, _, ShortForm, { FloatReg, FloatAcc, 0} }, - -{"fcomi", 2, 0xdbf0, _, ShortForm, { FloatReg, FloatAcc, 0} }, -{"fucomi", 2, 0xdbe8, _, ShortForm, { FloatReg, FloatAcc, 0} }, -{"fcomip", 2, 0xdff0, _, ShortForm, { FloatReg, FloatAcc, 0} }, -{"fucomip",2, 0xdfe8, _, ShortForm, { FloatReg, FloatAcc, 0} }, - -{"", 0, 0, 0, 0, { 0, 0, 0} } /* sentinel */ -}; -#undef _ - -static const template *const i386_optab_end - = i386_optab + sizeof (i386_optab)/sizeof(i386_optab[0]); - -/* 386 register table */ - -static const reg_entry i386_regtab[] = { - /* 8 bit regs */ - {"al", Reg8|Acc, 0}, {"cl", Reg8|ShiftCount, 1}, {"dl", Reg8, 2}, - {"bl", Reg8, 3}, - {"ah", Reg8, 4}, {"ch", Reg8, 5}, {"dh", Reg8, 6}, {"bh", Reg8, 7}, - /* 16 bit regs */ - {"ax", Reg16|Acc, 0}, {"cx", Reg16, 1}, {"dx", Reg16|InOutPortReg, 2}, {"bx", Reg16, 3}, - {"sp", Reg16, 4}, {"bp", Reg16, 5}, {"si", Reg16, 6}, {"di", Reg16, 7}, - /* 32 bit regs */ - {"eax", Reg32|Acc, 0}, {"ecx", Reg32, 1}, {"edx", Reg32, 2}, {"ebx", Reg32, 3}, - {"esp", Reg32, 4}, {"ebp", Reg32, 5}, {"esi", Reg32, 6}, {"edi", Reg32, 7}, - /* segment registers */ - {"es", SReg2, 0}, {"cs", SReg2, 1}, {"ss", SReg2, 2}, - {"ds", SReg2, 3}, {"fs", SReg3, 4}, {"gs", SReg3, 5}, - /* control registers */ - {"cr0", Control, 0}, {"cr2", Control, 2}, {"cr3", Control, 3}, - {"cr4", Control, 4}, - /* debug registers */ - {"db0", Debug, 0}, {"db1", Debug, 1}, {"db2", Debug, 2}, - {"db3", Debug, 3}, {"db6", Debug, 6}, {"db7", Debug, 7}, - {"dr0", Debug, 0}, {"dr1", Debug, 1}, {"dr2", Debug, 2}, - {"dr3", Debug, 3}, {"dr6", Debug, 6}, {"dr7", Debug, 7}, - /* test registers */ - {"tr3", Test, 3}, {"tr4", Test, 4}, {"tr5", Test, 5}, - {"tr6", Test, 6}, {"tr7", Test, 7}, - /* float registers */ - {"st(0)", FloatReg|FloatAcc, 0}, - {"st", FloatReg|FloatAcc, 0}, - {"st(1)", FloatReg, 1}, {"st(2)", FloatReg, 2}, - {"st(3)", FloatReg, 3}, {"st(4)", FloatReg, 4}, {"st(5)", FloatReg, 5}, - {"st(6)", FloatReg, 6}, {"st(7)", FloatReg, 7} -}; - -#define MAX_REG_NAME_SIZE 8 /* for parsing register names from input */ - -static const reg_entry *const i386_regtab_end - = i386_regtab + sizeof(i386_regtab)/sizeof(i386_regtab[0]); - -/* segment stuff */ -static const seg_entry cs = { "cs", 0x2e }; -static const seg_entry ds = { "ds", 0x3e }; -static const seg_entry ss = { "ss", 0x36 }; -static const seg_entry es = { "es", 0x26 }; -static const seg_entry fs = { "fs", 0x64 }; -static const seg_entry gs = { "gs", 0x65 }; -static const seg_entry null = { "", 0x0 }; - -/* - This table is used to store the default segment register implied by all - possible memory addressing modes. - It is indexed by the mode & modrm entries of the modrm byte as follows: - index = (mode<<3) | modrm; -*/ -static const seg_entry *const one_byte_segment_defaults[] = { - /* mode 0 */ - &ds, &ds, &ds, &ds, &null, &ds, &ds, &ds, - /* mode 1 */ - &ds, &ds, &ds, &ds, &null, &ss, &ds, &ds, - /* mode 2 */ - &ds, &ds, &ds, &ds, &null, &ss, &ds, &ds, - /* mode 3 --- not a memory reference; never referenced */ -}; - -static const seg_entry *const two_byte_segment_defaults[] = { - /* mode 0 */ - &ds, &ds, &ds, &ds, &ss, &ds, &ds, &ds, - /* mode 1 */ - &ds, &ds, &ds, &ds, &ss, &ds, &ds, &ds, - /* mode 2 */ - &ds, &ds, &ds, &ds, &ss, &ds, &ds, &ds, - /* mode 3 --- not a memory reference; never referenced */ -}; - -static const prefix_entry i386_prefixtab[] = { -#define ADDR_PREFIX_OPCODE 0x67 - { "addr16", 0x67 }, /* address size prefix ==> 16bit addressing - * (How is this useful?) */ -#define WORD_PREFIX_OPCODE 0x66 - { "data16", 0x66 }, /* operand size prefix */ - { "lock", 0xf0 }, /* bus lock prefix */ - { "wait", 0x9b }, /* wait for coprocessor */ - { "cs", 0x2e }, { "ds", 0x3e }, /* segment overrides ... */ - { "es", 0x26 }, { "fs", 0x64 }, - { "gs", 0x65 }, { "ss", 0x36 }, -/* REPE & REPNE used to detect rep/repne with a non-string instruction */ -#define REPNE 0xf2 -#define REPE 0xf3 - { "rep", 0xf3 }, /* repeat string instructions */ - { "repe", 0xf3 }, { "repz", 0xf3 }, - { "repne", 0xf2 }, { "repnz", 0xf2 } -}; - -static const prefix_entry *const i386_prefixtab_end - = i386_prefixtab + sizeof(i386_prefixtab)/sizeof(i386_prefixtab[0]); - -/* end of i386-opcode.h */ diff --git a/contrib/gdb/include/opcode/i860.h b/contrib/gdb/include/opcode/i860.h deleted file mode 100644 index b6ebd25..0000000 --- a/contrib/gdb/include/opcode/i860.h +++ /dev/null @@ -1,491 +0,0 @@ -/* Table of opcodes for the i860. - Copyright (C) 1989 Free Software Foundation, Inc. - -This file is part of GAS, the GNU Assembler, and GDB, the GNU disassembler. - -GAS/GDB 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 1, or (at your option) -any later version. - -GAS/GDB 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 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. */ - -#if !defined(__STDC__) && !defined(const) -#define const -#endif - -/* - * Structure of an opcode table entry. - */ -struct i860_opcode -{ - const char *name; - unsigned long match; /* Bits that must be set. */ - unsigned long lose; /* Bits that must not be set. */ - const char *args; - /* Nonzero if this is a possible expand-instruction. */ - char expand; -}; - -enum expand_type -{ - E_MOV = 1, E_ADDR, E_U32, E_AND, E_S32, E_DELAY -}; - -/* - All i860 opcodes are 32 bits, except for the pseudoinstructions - and the operations utilizing a 32-bit address expression, an - unsigned 32-bit constant, or a signed 32-bit constant. - These opcodes are expanded into a two-instruction sequence for - any situation where the immediate operand does not fit in 32 bits. - In the case of the add and subtract operations the expansion is - to a three-instruction sequence (ex: orh, or, adds). In cases - where the address is to be relocated, the instruction is - expanded to handle the worse case, this could be optimized at - the final link if the actual address were known. - - The pseudoinstructions are: mov, fmov, pmov, nop, and fnop. - These instructions are implemented as a one or two instruction - sequence of other operations. - - The match component is a mask saying which bits must match a - particular opcode in order for an instruction to be an instance - of that opcode. - - The args component is a string containing one character - for each operand of the instruction. - -Kinds of operands: - # Number used by optimizer. It is ignored. - 1 src1 integer register. - 2 src2 integer register. - d dest register. - c ctrlreg control register. - i 16 bit immediate. - I 16 bit immediate, aligned. - 5 5 bit immediate. - l lbroff 26 bit PC relative immediate. - r sbroff 16 bit PC relative immediate. - s split 16 bit immediate. - S split 16 bit immediate, aligned. - e src1 floating point register. - f src2 floating point register. - g dest floating point register. - -*/ - -/* The order of the opcodes in this table is significant: - - * The assembler requires that all instances of the same mnemonic must be - consecutive. If they aren't, the assembler will bomb at runtime. - - * The disassembler should not care about the order of the opcodes. */ - -static struct i860_opcode i860_opcodes[] = -{ - -/* REG-Format Instructions */ -{ "ld.c", 0x30000000, 0xcc000000, "c,d", 0 }, /* ld.c csrc2,idest */ -{ "ld.b", 0x00000000, 0xfc000000, "1(2),d", 0 }, /* ld.b isrc1(isrc2),idest */ -{ "ld.b", 0x04000000, 0xf8000000, "I(2),d", E_ADDR }, /* ld.b #const(isrc2),idest */ -{ "ld.s", 0x10000000, 0xec000001, "1(2),d", 0 }, /* ld.s isrc1(isrc2),idest */ -{ "ld.s", 0x14000001, 0xe8000000, "I(2),d", E_ADDR }, /* ld.s #const(isrc2),idest */ -{ "ld.l", 0x10000001, 0xec000000, "1(2),d", 0 }, /* ld.l isrc1(isrc2),idest */ -{ "ld.l", 0x14000001, 0xe8000000, "I(2),d", E_ADDR }, /* ld.l #const(isrc2),idest */ - -{ "st.c", 0x38000000, 0xc4000000, "1,c", 0 }, /* st.c isrc1ni,csrc2 */ -{ "st.b", 0x0c000000, 0xf0000000, "1,S(2)", E_ADDR }, /* st.b isrc1ni,#const(isrc2) */ -{ "st.s", 0x1c000000, 0xe0000000, "1,S(2)", E_ADDR }, /* st.s isrc1ni,#const(isrc2) */ -{ "st.l", 0x1c000001, 0xe0000000, "1,S(2)", E_ADDR }, /* st.l isrc1ni,#const(isrc2) */ - -{ "ixfr", 0x08000000, 0xf4000000, "1,g", 0 }, /* ixfr isrc1ni,fdest */ - -{ "fld.l", 0x20000002, 0xdc000001, "1(2),g", 0 }, /* fld.l isrc1(isrc2),fdest */ -{ "fld.l", 0x24000002, 0xd8000001, "i(2),g", E_ADDR }, /* fld.l #const(isrc2),fdest */ -{ "fld.l", 0x20000003, 0xdc000000, "1(2)++,g", 0 }, /* fld.l isrc1(isrc2)++,fdest */ -{ "fld.l", 0x24000003, 0xd8000000, "i(2)++,g", E_ADDR }, /* fld.l #const(isrc2)++,fdest */ -{ "fld.d", 0x20000000, 0xdc000007, "1(2),g", 0 }, /* fld.d isrc1(isrc2),fdest */ -{ "fld.d", 0x24000000, 0xd8000007, "i(2),g", E_ADDR }, /* fld.d #const(isrc2),fdest */ -{ "fld.d", 0x20000001, 0xdc000006, "1(2)++,g", 0 }, /* fld.d isrc1(isrc2)++,fdest */ -{ "fld.d", 0x24000001, 0xd8000006, "i(2)++,g", E_ADDR }, /* fld.d #const(isrc2)++,fdest */ -{ "fld.q", 0x20000004, 0xdc000003, "1(2),g", 0 }, /* fld.q isrc1(isrc2),fdest */ -{ "fld.q", 0x24000004, 0xd8000003, "i(2),g", E_ADDR }, /* fld.q #const(isrc2),fdest */ -{ "fld.q", 0x20000005, 0xdc000002, "1(2)++,g", 0 }, /* fld.q isrc1(isrc2)++,fdest */ -{ "fld.q", 0x24000005, 0xd8000002, "i(2)++,g", E_ADDR }, /* fld.q #const(isrc2)++,fdest */ - -{ "pfld.l", 0x60000000, 0x9c000003, "1(2),g", 0 }, /* pfld.l isrc1(isrc2),fdest */ -{ "pfld.l", 0x64000000, 0x98000003, "i(2),g", E_ADDR }, /* pfld.l #const(isrc2),fdest */ -{ "pfld.l", 0x60000001, 0x9c000002, "1(2)++,g", 0 }, /* pfld.l isrc1(isrc2)++,fdest */ -{ "pfld.l", 0x64000001, 0x98000002, "i(2)++,g", E_ADDR }, /* pfld.l #const(isrc2)++,fdest */ -{ "pfld.d", 0x60000000, 0x9c000007, "1(2),g", 0 }, /* pfld.d isrc1(isrc2),fdest */ -{ "pfld.d", 0x64000000, 0x98000007, "i(2),g", E_ADDR }, /* pfld.d #const(isrc2),fdest */ -{ "pfld.d", 0x60000001, 0x9c000006, "1(2)++,g", 0 }, /* pfld.d isrc1(isrc2)++,fdest */ -{ "pfld.d", 0x64000001, 0x98000006, "i(2)++,g", E_ADDR }, /* pfld.d #const(isrc2)++,fdest */ - -{ "fst.l", 0x28000002, 0xd4000001, "g,1(2)", 0 }, /* fst.l fdest,isrc1(isrc2) */ -{ "fst.l", 0x2c000002, 0xd0000001, "g,i(2)", E_ADDR }, /* fst.l fdest,#const(isrc2) */ -{ "fst.l", 0x28000003, 0xd4000000, "g,1(2)++", 0 }, /* fst.l fdest,isrc1(isrc2)++ */ -{ "fst.l", 0x2c000003, 0xd0000000, "g,i(2)++", E_ADDR }, /* fst.l fdest,#const(isrc2)++ */ -{ "fst.d", 0x28000000, 0xd4000007, "g,1(2)", 0 }, /* fst.d fdest,isrc1(isrc2) */ -{ "fst.d", 0x2c000000, 0xd0000007, "g,i(2)", E_ADDR }, /* fst.d fdest,#const(isrc2) */ -{ "fst.d", 0x28000001, 0xd4000006, "g,1(2)++", 0 }, /* fst.d fdest,isrc1(isrc2)++ */ -{ "fst.d", 0x2c000001, 0xd0000006, "g,i(2)++", E_ADDR }, /* fst.d fdest,#const(isrc2)++ */ - -{ "pst.d", 0x3c000000, 0xc0000007, "g,i(2)", E_ADDR }, /* pst.d fdest,#const(isrc2) */ -{ "pst.d", 0x3c000001, 0xc0000006, "g,i(2)++", E_ADDR }, /* pst.d fdest,#const(isrc2)++ */ - -{ "addu", 0x80000000, 0x7c000000, "1,2,d", 0 }, /* addu isrc1,isrc2,idest */ -{ "addu", 0x84000000, 0x78000000, "i,2,d", E_S32 }, /* addu #const,isrc2,idest */ -{ "adds", 0x90000000, 0x6c000000, "1,2,d", 0 }, /* adds isrc1,isrc2,idest */ -{ "adds", 0x94000000, 0x68000000, "i,2,d", E_S32 }, /* adds #const,isrc2,idest */ -{ "subu", 0x88000000, 0x74000000, "1,2,d", 0 }, /* subu isrc1,isrc2,idest */ -{ "subu", 0x8c000000, 0x70000000, "i,2,d", E_S32 }, /* subu #const,isrc2,idest */ -{ "subs", 0x98000000, 0x64000000, "1,2,d", 0 }, /* subs isrc1,isrc2,idest */ -{ "subs", 0x9c000000, 0x60000000, "i,2,d", E_S32 }, /* subs #const,isrc2,idest */ - -{ "shl", 0xa0000000, 0x5c000000, "1,2,d", 0 }, /* shl isrc1,isrc2,idest */ -{ "shl", 0xa4000000, 0x58000000, "i,2,d", 0 }, /* shl #const,isrc2,idest */ -{ "shr", 0xa8000000, 0x54000000, "1,2,d", 0 }, /* shr isrc1,isrc2,idest */ -{ "shr", 0xac000000, 0x50000000, "i,2,d", 0 }, /* shr #const,isrc2,idest */ -{ "shrd", 0xb0000000, 0x4c000000, "1,2,d", 0 }, /* shrd isrc1,isrc2,idest */ -{ "shra", 0xb8000000, 0x44000000, "1,2,d", 0 }, /* shra isrc1,isrc2,idest */ -{ "shra", 0xbc000000, 0x40000000, "i,2,d", 0 }, /* shra #const,isrc2,idest */ - -{ "mov", 0xa0000000, 0x5c00f800, "2,d", 0 }, /* shl r0,isrc2,idest */ -{ "mov", 0x94000000, 0x69e00000, "i,d", E_MOV }, /* adds #const,r0,idest */ -{ "nop", 0xa0000000, 0x5ffff800, "", 0 }, /* shl r0,r0,r0 */ -{ "fnop", 0xb0000000, 0x4ffff800, "", 0 }, /* shrd r0,r0,r0 */ - -{ "trap", 0x44000000, 0xb8000000, "1,2,d", 0 }, /* trap isrc1ni,isrc2,idest */ - -{ "flush", 0x34000000, 0xc81f0001, "i(2)", E_ADDR }, /* flush #const(isrc2) */ -{ "flush", 0x34000001, 0xc81f0000, "i(2)++", E_ADDR }, /* flush #const(isrc2)++ */ - -{ "and", 0xc0000000, 0x3c000000, "1,2,d", 0 }, /* and isrc1,isrc2,idest */ -{ "and", 0xc4000000, 0x38000000, "i,2,d", E_AND }, /* and #const,isrc2,idest */ -{ "andh", 0xc8000000, 0x34000000, "1,2,d", 0 }, /* andh isrc1,isrc2,idest */ -{ "andh", 0xcc000000, 0x30000000, "i,2,d", 0 }, /* andh #const,isrc2,idest */ -{ "andnot", 0xd0000000, 0x2c000000, "1,2,d", 0 }, /* andnot isrc1,isrc2,idest */ -{ "andnot", 0xd4000000, 0x28000000, "i,2,d", E_U32 }, /* andnot #const,isrc2,idest */ -{ "andnoth", 0xd8000000, 0x24000000, "1,2,d", 0 }, /* andnoth isrc1,isrc2,idest */ -{ "andnoth", 0xdc000000, 0x20000000, "i,2,d", 0 }, /* andnoth #const,isrc2,idest */ -{ "or", 0xe0000000, 0x1c000000, "1,2,d", 0 }, /* or isrc1,isrc2,idest */ -{ "or", 0xe4000000, 0x18000000, "i,2,d", E_U32 }, /* or #const,isrc2,idest */ -{ "orh", 0xe8000000, 0x14000000, "1,2,d", 0 }, /* orh isrc1,isrc2,idest */ -{ "orh", 0xec000000, 0x10000000, "i,2,d", 0 }, /* orh #const,isrc2,idest */ -{ "xor", 0xf0000000, 0x0c000000, "1,2,d", 0 }, /* xor isrc1,isrc2,idest */ -{ "xor", 0xf4000000, 0x08000000, "i,2,d", E_U32 }, /* xor #const,isrc2,idest */ -{ "xorh", 0xf8000000, 0x04000000, "1,2,d", 0 }, /* xorh isrc1,isrc2,idest */ -{ "xorh", 0xfc000000, 0x00000000, "i,2,d", 0 }, /* xorh #const,isrc2,idest */ - -{ "bte", 0x58000000, 0xa4000000, "1,2,s", 0 }, /* bte isrc1s,isrc2,sbroff */ -{ "bte", 0x5c000000, 0xa0000000, "5,2,s", 0 }, /* bte #const5,isrc2,sbroff */ -{ "btne", 0x50000000, 0xac000000, "1,2,s", 0 }, /* btne isrc1s,isrc2,sbroff */ -{ "btne", 0x54000000, 0xa8000000, "5,2,s", 0 }, /* btne #const5,isrc2,sbroff */ -{ "bla", 0xb4000000, 0x48000000, "1,2,s", E_DELAY }, /* bla isrc1s,isrc2,sbroff */ -{ "bri", 0x40000000, 0xbc000000, "1", E_DELAY }, /* bri isrc1ni */ - -/* Core Escape Instruction Format */ -{ "lock", 0x4c000001, 0xb000001e, "", 0 }, /* lock set BL in dirbase */ -{ "calli", 0x4c000002, 0xb000001d, "1", E_DELAY }, /* calli isrc1ni */ -{ "intovr", 0x4c000004, 0xb000001b, "", 0 }, /* intovr trap on integer overflow */ -{ "unlock", 0x4c000007, 0xb0000018, "", 0 }, /* unlock clear BL in dirbase */ - -/* CTRL-Format Instructions */ -{ "br", 0x68000000, 0x94000000, "l", E_DELAY }, /* br lbroff */ -{ "call", 0x6c000000, 0x90000000, "l", E_DELAY }, /* call lbroff */ -{ "bc", 0x70000000, 0x8c000000, "l", 0 }, /* bc lbroff */ -{ "bc.t", 0x74000000, 0x88000000, "l", E_DELAY }, /* bc.t lbroff */ -{ "bnc", 0x78000000, 0x84000000, "l", 0 }, /* bnc lbroff */ -{ "bnc.t", 0x7c000000, 0x80000000, "l", E_DELAY }, /* bnc.t lbroff */ - -/* Floating Point Escape Instruction Format - pfam.p fsrc1,fsrc2,fdest */ -{ "r2p1.ss", 0x48000400, 0xb40003ff, "e,f,g", 0 }, -{ "r2p1.sd", 0x48000480, 0xb400037f, "e,f,g", 0 }, -{ "r2p1.dd", 0x48000580, 0xb400027f, "e,f,g", 0 }, -{ "r2pt.ss", 0x48000401, 0xb40003fe, "e,f,g", 0 }, -{ "r2pt.sd", 0x48000481, 0xb400037e, "e,f,g", 0 }, -{ "r2pt.dd", 0x48000581, 0xb400027e, "e,f,g", 0 }, -{ "r2ap1.ss", 0x48000402, 0xb40003fd, "e,f,g", 0 }, -{ "r2ap1.sd", 0x48000482, 0xb400037d, "e,f,g", 0 }, -{ "r2ap1.dd", 0x48000582, 0xb400027d, "e,f,g", 0 }, -{ "r2apt.ss", 0x48000403, 0xb40003fc, "e,f,g", 0 }, -{ "r2apt.sd", 0x48000483, 0xb400037c, "e,f,g", 0 }, -{ "r2apt.dd", 0x48000583, 0xb400027c, "e,f,g", 0 }, -{ "i2p1.ss", 0x48000404, 0xb40003fb, "e,f,g", 0 }, -{ "i2p1.sd", 0x48000484, 0xb400037b, "e,f,g", 0 }, -{ "i2p1.dd", 0x48000584, 0xb400027b, "e,f,g", 0 }, -{ "i2pt.ss", 0x48000405, 0xb40003fa, "e,f,g", 0 }, -{ "i2pt.sd", 0x48000485, 0xb400037a, "e,f,g", 0 }, -{ "i2pt.dd", 0x48000585, 0xb400027a, "e,f,g", 0 }, -{ "i2ap1.ss", 0x48000406, 0xb40003f9, "e,f,g", 0 }, -{ "i2ap1.sd", 0x48000486, 0xb4000379, "e,f,g", 0 }, -{ "i2ap1.dd", 0x48000586, 0xb4000279, "e,f,g", 0 }, -{ "i2apt.ss", 0x48000407, 0xb40003f8, "e,f,g", 0 }, -{ "i2apt.sd", 0x48000487, 0xb4000378, "e,f,g", 0 }, -{ "i2apt.dd", 0x48000587, 0xb4000278, "e,f,g", 0 }, -{ "rat1p2.ss", 0x48000408, 0xb40003f7, "e,f,g", 0 }, -{ "rat1p2.sd", 0x48000488, 0xb4000377, "e,f,g", 0 }, -{ "rat1p2.dd", 0x48000588, 0xb4000277, "e,f,g", 0 }, -{ "m12apm.ss", 0x48000409, 0xb40003f6, "e,f,g", 0 }, -{ "m12apm.sd", 0x48000489, 0xb4000376, "e,f,g", 0 }, -{ "m12apm.dd", 0x48000589, 0xb4000276, "e,f,g", 0 }, -{ "ra1p2.ss", 0x4800040a, 0xb40003f5, "e,f,g", 0 }, -{ "ra1p2.sd", 0x4800048a, 0xb4000375, "e,f,g", 0 }, -{ "ra1p2.dd", 0x4800058a, 0xb4000275, "e,f,g", 0 }, -{ "m12ttpa.ss", 0x4800040b, 0xb40003f4, "e,f,g", 0 }, -{ "m12ttpa.sd", 0x4800048b, 0xb4000374, "e,f,g", 0 }, -{ "m12ttpa.dd", 0x4800058b, 0xb4000274, "e,f,g", 0 }, -{ "iat1p2.ss", 0x4800040c, 0xb40003f3, "e,f,g", 0 }, -{ "iat1p2.sd", 0x4800048c, 0xb4000373, "e,f,g", 0 }, -{ "iat1p2.dd", 0x4800058c, 0xb4000273, "e,f,g", 0 }, -{ "m12tpm.ss", 0x4800040d, 0xb40003f2, "e,f,g", 0 }, -{ "m12tpm.sd", 0x4800048d, 0xb4000372, "e,f,g", 0 }, -{ "m12tpm.dd", 0x4800058d, 0xb4000272, "e,f,g", 0 }, -{ "ia1p2.ss", 0x4800040e, 0xb40003f1, "e,f,g", 0 }, -{ "ia1p2.sd", 0x4800048e, 0xb4000371, "e,f,g", 0 }, -{ "ia1p2.dd", 0x4800058e, 0xb4000271, "e,f,g", 0 }, -{ "m12tpa.ss", 0x4800040f, 0xb40003f0, "e,f,g", 0 }, -{ "m12tpa.sd", 0x4800048f, 0xb4000370, "e,f,g", 0 }, -{ "m12tpa.dd", 0x4800058f, 0xb4000270, "e,f,g", 0 }, - -/* Floating Point Escape Instruction Format - pfsm.p fsrc1,fsrc2,fdest */ -{ "r2s1.ss", 0x48000410, 0xb40003ef, "e,f,g", 0 }, -{ "r2s1.sd", 0x48000490, 0xb400036f, "e,f,g", 0 }, -{ "r2s1.dd", 0x48000590, 0xb400026f, "e,f,g", 0 }, -{ "r2st.ss", 0x48000411, 0xb40003ee, "e,f,g", 0 }, -{ "r2st.sd", 0x48000491, 0xb400036e, "e,f,g", 0 }, -{ "r2st.dd", 0x48000591, 0xb400026e, "e,f,g", 0 }, -{ "r2as1.ss", 0x48000412, 0xb40003ed, "e,f,g", 0 }, -{ "r2as1.sd", 0x48000492, 0xb400036d, "e,f,g", 0 }, -{ "r2as1.dd", 0x48000592, 0xb400026d, "e,f,g", 0 }, -{ "r2ast.ss", 0x48000413, 0xb40003ec, "e,f,g", 0 }, -{ "r2ast.sd", 0x48000493, 0xb400036c, "e,f,g", 0 }, -{ "r2ast.dd", 0x48000593, 0xb400026c, "e,f,g", 0 }, -{ "i2s1.ss", 0x48000414, 0xb40003eb, "e,f,g", 0 }, -{ "i2s1.sd", 0x48000494, 0xb400036b, "e,f,g", 0 }, -{ "i2s1.dd", 0x48000594, 0xb400026b, "e,f,g", 0 }, -{ "i2st.ss", 0x48000415, 0xb40003ea, "e,f,g", 0 }, -{ "i2st.sd", 0x48000495, 0xb400036a, "e,f,g", 0 }, -{ "i2st.dd", 0x48000595, 0xb400026a, "e,f,g", 0 }, -{ "i2as1.ss", 0x48000416, 0xb40003e9, "e,f,g", 0 }, -{ "i2as1.sd", 0x48000496, 0xb4000369, "e,f,g", 0 }, -{ "i2as1.dd", 0x48000596, 0xb4000269, "e,f,g", 0 }, -{ "i2ast.ss", 0x48000417, 0xb40003e8, "e,f,g", 0 }, -{ "i2ast.sd", 0x48000497, 0xb4000368, "e,f,g", 0 }, -{ "i2ast.dd", 0x48000597, 0xb4000268, "e,f,g", 0 }, -{ "rat1s2.ss", 0x48000418, 0xb40003e7, "e,f,g", 0 }, -{ "rat1s2.sd", 0x48000498, 0xb4000367, "e,f,g", 0 }, -{ "rat1s2.dd", 0x48000598, 0xb4000267, "e,f,g", 0 }, -{ "m12asm.ss", 0x48000419, 0xb40003e6, "e,f,g", 0 }, -{ "m12asm.sd", 0x48000499, 0xb4000366, "e,f,g", 0 }, -{ "m12asm.dd", 0x48000599, 0xb4000266, "e,f,g", 0 }, -{ "ra1s2.ss", 0x4800041a, 0xb40003e5, "e,f,g", 0 }, -{ "ra1s2.sd", 0x4800049a, 0xb4000365, "e,f,g", 0 }, -{ "ra1s2.dd", 0x4800059a, 0xb4000265, "e,f,g", 0 }, -{ "m12ttsa.ss", 0x4800041b, 0xb40003e4, "e,f,g", 0 }, -{ "m12ttsa.sd", 0x4800049b, 0xb4000364, "e,f,g", 0 }, -{ "m12ttsa.dd", 0x4800059b, 0xb4000264, "e,f,g", 0 }, -{ "iat1s2.ss", 0x4800041c, 0xb40003e3, "e,f,g", 0 }, -{ "iat1s2.sd", 0x4800049c, 0xb4000363, "e,f,g", 0 }, -{ "iat1s2.dd", 0x4800059c, 0xb4000263, "e,f,g", 0 }, -{ "m12tsm.ss", 0x4800041d, 0xb40003e2, "e,f,g", 0 }, -{ "m12tsm.sd", 0x4800049d, 0xb4000362, "e,f,g", 0 }, -{ "m12tsm.dd", 0x4800059d, 0xb4000262, "e,f,g", 0 }, -{ "ia1s2.ss", 0x4800041e, 0xb40003e1, "e,f,g", 0 }, -{ "ia1s2.sd", 0x4800049e, 0xb4000361, "e,f,g", 0 }, -{ "ia1s2.dd", 0x4800059e, 0xb4000261, "e,f,g", 0 }, -{ "m12tsa.ss", 0x4800041f, 0xb40003e0, "e,f,g", 0 }, -{ "m12tsa.sd", 0x4800049f, 0xb4000360, "e,f,g", 0 }, -{ "m12tsa.dd", 0x4800059f, 0xb4000260, "e,f,g", 0 }, - -/* Floating Point Escape Instruction Format - pfmam.p fsrc1,fsrc2,fdest */ -{ "mr2p1.ss", 0x48000000, 0xb40007ff, "e,f,g", 0 }, -{ "mr2p1.sd", 0x48000080, 0xb400077f, "e,f,g", 0 }, -{ "mr2p1.dd", 0x48000180, 0xb400067f, "e,f,g", 0 }, -{ "mr2pt.ss", 0x48000001, 0xb40007fe, "e,f,g", 0 }, -{ "mr2pt.sd", 0x48000081, 0xb400077e, "e,f,g", 0 }, -{ "mr2pt.dd", 0x48000181, 0xb400067e, "e,f,g", 0 }, -{ "mr2mp1.ss", 0x48000002, 0xb40007fd, "e,f,g", 0 }, -{ "mr2mp1.sd", 0x48000082, 0xb400077d, "e,f,g", 0 }, -{ "mr2mp1.dd", 0x48000182, 0xb400067d, "e,f,g", 0 }, -{ "mr2mpt.ss", 0x48000003, 0xb40007fc, "e,f,g", 0 }, -{ "mr2mpt.sd", 0x48000083, 0xb400077c, "e,f,g", 0 }, -{ "mr2mpt.dd", 0x48000183, 0xb400067c, "e,f,g", 0 }, -{ "mi2p1.ss", 0x48000004, 0xb40007fb, "e,f,g", 0 }, -{ "mi2p1.sd", 0x48000084, 0xb400077b, "e,f,g", 0 }, -{ "mi2p1.dd", 0x48000184, 0xb400067b, "e,f,g", 0 }, -{ "mi2pt.ss", 0x48000005, 0xb40007fa, "e,f,g", 0 }, -{ "mi2pt.sd", 0x48000085, 0xb400077a, "e,f,g", 0 }, -{ "mi2pt.dd", 0x48000185, 0xb400067a, "e,f,g", 0 }, -{ "mi2mp1.ss", 0x48000006, 0xb40007f9, "e,f,g", 0 }, -{ "mi2mp1.sd", 0x48000086, 0xb4000779, "e,f,g", 0 }, -{ "mi2mp1.dd", 0x48000186, 0xb4000679, "e,f,g", 0 }, -{ "mi2mpt.ss", 0x48000007, 0xb40007f8, "e,f,g", 0 }, -{ "mi2mpt.sd", 0x48000087, 0xb4000778, "e,f,g", 0 }, -{ "mi2mpt.dd", 0x48000187, 0xb4000678, "e,f,g", 0 }, -{ "mrmt1p2.ss", 0x48000008, 0xb40007f7, "e,f,g", 0 }, -{ "mrmt1p2.sd", 0x48000088, 0xb4000777, "e,f,g", 0 }, -{ "mrmt1p2.dd", 0x48000188, 0xb4000677, "e,f,g", 0 }, -{ "mm12mpm.ss", 0x48000009, 0xb40007f6, "e,f,g", 0 }, -{ "mm12mpm.sd", 0x48000089, 0xb4000776, "e,f,g", 0 }, -{ "mm12mpm.dd", 0x48000189, 0xb4000676, "e,f,g", 0 }, -{ "mrm1p2.ss", 0x4800000a, 0xb40007f5, "e,f,g", 0 }, -{ "mrm1p2.sd", 0x4800008a, 0xb4000775, "e,f,g", 0 }, -{ "mrm1p2.dd", 0x4800018a, 0xb4000675, "e,f,g", 0 }, -{ "mm12ttpm.ss",0x4800000b, 0xb40007f4, "e,f,g", 0 }, -{ "mm12ttpm.sd",0x4800008b, 0xb4000774, "e,f,g", 0 }, -{ "mm12ttpm.dd",0x4800018b, 0xb4000674, "e,f,g", 0 }, -{ "mimt1p2.ss", 0x4800000c, 0xb40007f3, "e,f,g", 0 }, -{ "mimt1p2.sd", 0x4800008c, 0xb4000773, "e,f,g", 0 }, -{ "mimt1p2.dd", 0x4800018c, 0xb4000673, "e,f,g", 0 }, -{ "mm12tpm.ss", 0x4800000d, 0xb40007f2, "e,f,g", 0 }, -{ "mm12tpm.sd", 0x4800008d, 0xb4000772, "e,f,g", 0 }, -{ "mm12tpm.dd", 0x4800018d, 0xb4000672, "e,f,g", 0 }, -{ "mim1p2.ss", 0x4800000e, 0xb40007f1, "e,f,g", 0 }, -{ "mim1p2.sd", 0x4800008e, 0xb4000771, "e,f,g", 0 }, -{ "mim1p2.dd", 0x4800018e, 0xb4000671, "e,f,g", 0 }, - -/* Floating Point Escape Instruction Format - pfmsm.p fsrc1,fsrc2,fdest */ -{ "mr2s1.ss", 0x48000010, 0xb40007ef, "e,f,g", 0 }, -{ "mr2s1.sd", 0x48000090, 0xb400076f, "e,f,g", 0 }, -{ "mr2s1.dd", 0x48000190, 0xb400066f, "e,f,g", 0 }, -{ "mr2st.ss", 0x48000011, 0xb40007ee, "e,f,g", 0 }, -{ "mr2st.sd", 0x48000091, 0xb400076e, "e,f,g", 0 }, -{ "mr2st.dd", 0x48000191, 0xb400066e, "e,f,g", 0 }, -{ "mr2ms1.ss", 0x48000012, 0xb40007ed, "e,f,g", 0 }, -{ "mr2ms1.sd", 0x48000092, 0xb400076d, "e,f,g", 0 }, -{ "mr2ms1.dd", 0x48000192, 0xb400066d, "e,f,g", 0 }, -{ "mr2mst.ss", 0x48000013, 0xb40007ec, "e,f,g", 0 }, -{ "mr2mst.sd", 0x48000093, 0xb400076c, "e,f,g", 0 }, -{ "mr2mst.dd", 0x48000193, 0xb400066c, "e,f,g", 0 }, -{ "mi2s1.ss", 0x48000014, 0xb40007eb, "e,f,g", 0 }, -{ "mi2s1.sd", 0x48000094, 0xb400076b, "e,f,g", 0 }, -{ "mi2s1.dd", 0x48000194, 0xb400066b, "e,f,g", 0 }, -{ "mi2st.ss", 0x48000015, 0xb40007ea, "e,f,g", 0 }, -{ "mi2st.sd", 0x48000095, 0xb400076a, "e,f,g", 0 }, -{ "mi2st.dd", 0x48000195, 0xb400066a, "e,f,g", 0 }, -{ "mi2ms1.ss", 0x48000016, 0xb40007e9, "e,f,g", 0 }, -{ "mi2ms1.sd", 0x48000096, 0xb4000769, "e,f,g", 0 }, -{ "mi2ms1.dd", 0x48000196, 0xb4000669, "e,f,g", 0 }, -{ "mi2mst.ss", 0x48000017, 0xb40007e8, "e,f,g", 0 }, -{ "mi2mst.sd", 0x48000097, 0xb4000768, "e,f,g", 0 }, -{ "mi2mst.dd", 0x48000197, 0xb4000668, "e,f,g", 0 }, -{ "mrmt1s2.ss", 0x48000018, 0xb40007e7, "e,f,g", 0 }, -{ "mrmt1s2.sd", 0x48000098, 0xb4000767, "e,f,g", 0 }, -{ "mrmt1s2.dd", 0x48000198, 0xb4000667, "e,f,g", 0 }, -{ "mm12msm.ss", 0x48000019, 0xb40007e6, "e,f,g", 0 }, -{ "mm12msm.sd", 0x48000099, 0xb4000766, "e,f,g", 0 }, -{ "mm12msm.dd", 0x48000199, 0xb4000666, "e,f,g", 0 }, -{ "mrm1s2.ss", 0x4800001a, 0xb40007e5, "e,f,g", 0 }, -{ "mrm1s2.sd", 0x4800009a, 0xb4000765, "e,f,g", 0 }, -{ "mrm1s2.dd", 0x4800019a, 0xb4000665, "e,f,g", 0 }, -{ "mm12ttsm.ss",0x4800001b, 0xb40007e4, "e,f,g", 0 }, -{ "mm12ttsm.sd",0x4800009b, 0xb4000764, "e,f,g", 0 }, -{ "mm12ttsm.dd",0x4800019b, 0xb4000664, "e,f,g", 0 }, -{ "mimt1s2.ss", 0x4800001c, 0xb40007e3, "e,f,g", 0 }, -{ "mimt1s2.sd", 0x4800009c, 0xb4000763, "e,f,g", 0 }, -{ "mimt1s2.dd", 0x4800019c, 0xb4000663, "e,f,g", 0 }, -{ "mm12tsm.ss", 0x4800001d, 0xb40007e2, "e,f,g", 0 }, -{ "mm12tsm.sd", 0x4800009d, 0xb4000762, "e,f,g", 0 }, -{ "mm12tsm.dd", 0x4800019d, 0xb4000662, "e,f,g", 0 }, -{ "mim1s2.ss", 0x4800001e, 0xb40007e1, "e,f,g", 0 }, -{ "mim1s2.sd", 0x4800009e, 0xb4000761, "e,f,g", 0 }, -{ "mim1s2.dd", 0x4800019e, 0xb4000661, "e,f,g", 0 }, - - -{ "fmul.ss", 0x48000020, 0xb40007df, "e,f,g", 0 }, /* fmul.p fsrc1,fsrc2,fdest */ -{ "fmul.sd", 0x480000a0, 0xb400075f, "e,f,g", 0 }, /* fmul.p fsrc1,fsrc2,fdest */ -{ "fmul.dd", 0x480001a0, 0xb400065f, "e,f,g", 0 }, /* fmul.p fsrc1,fsrc2,fdest */ -{ "pfmul.ss", 0x48000420, 0xb40003df, "e,f,g", 0 }, /* pfmul.p fsrc1,fsrc2,fdest */ -{ "pfmul.sd", 0x480004a0, 0xb400035f, "e,f,g", 0 }, /* pfmul.p fsrc1,fsrc2,fdest */ -{ "pfmul.dd", 0x480005a0, 0xb400025f, "e,f,g", 0 }, /* pfmul.p fsrc1,fsrc2,fdest */ -{ "pfmul3.dd", 0x480005a4, 0xb400025b, "e,f,g", 0 }, /* pfmul3.p fsrc1,fsrc2,fdest */ -{ "fmlow.dd", 0x480001a1, 0xb400065e, "e,f,g", 0 }, /* fmlow.dd fsrc1,fsrc2,fdest */ -{ "frcp.ss", 0x48000022, 0xb40007dd, "f,g", 0 }, /* frcp.p fsrc2,fdest */ -{ "frcp.sd", 0x480000a2, 0xb400075d, "f,g", 0 }, /* frcp.p fsrc2,fdest */ -{ "frcp.dd", 0x480001a2, 0xb400065d, "f,g", 0 }, /* frcp.p fsrc2,fdest */ -{ "frsqr.ss", 0x48000023, 0xb40007dc, "f,g", 0 }, /* frsqr.p fsrc2,fdest */ -{ "frsqr.sd", 0x480000a3, 0xb400075c, "f,g", 0 }, /* frsqr.p fsrc2,fdest */ -{ "frsqr.dd", 0x480001a3, 0xb400065c, "f,g", 0 }, /* frsqr.p fsrc2,fdest */ -{ "fadd.ss", 0x48000030, 0xb40007cf, "e,f,g", 0 }, /* fadd.p fsrc1,fsrc2,fdest */ -{ "fadd.sd", 0x480000b0, 0xb400074f, "e,f,g", 0 }, /* fadd.p fsrc1,fsrc2,fdest */ -{ "fadd.dd", 0x480001b0, 0xb400064f, "e,f,g", 0 }, /* fadd.p fsrc1,fsrc2,fdest */ -{ "pfadd.ss", 0x48000430, 0xb40003cf, "e,f,g", 0 }, /* pfadd.p fsrc1,fsrc2,fdest */ -{ "pfadd.sd", 0x480004b0, 0xb400034f, "e,f,g", 0 }, /* pfadd.p fsrc1,fsrc2,fdest */ -{ "pfadd.dd", 0x480005b0, 0xb400024f, "e,f,g", 0 }, /* pfadd.p fsrc1,fsrc2,fdest */ -{ "fsub.ss", 0x48000031, 0xb40007ce, "e,f,g", 0 }, /* fsub.p fsrc1,fsrc2,fdest */ -{ "fsub.sd", 0x480000b1, 0xb400074e, "e,f,g", 0 }, /* fsub.p fsrc1,fsrc2,fdest */ -{ "fsub.dd", 0x480001b1, 0xb400064e, "e,f,g", 0 }, /* fsub.p fsrc1,fsrc2,fdest */ -{ "pfsub.ss", 0x48000431, 0xb40003ce, "e,f,g", 0 }, /* pfsub.p fsrc1,fsrc2,fdest */ -{ "pfsub.sd", 0x480004b1, 0xb400034e, "e,f,g", 0 }, /* pfsub.p fsrc1,fsrc2,fdest */ -{ "pfsub.dd", 0x480005b1, 0xb400024e, "e,f,g", 0 }, /* pfsub.p fsrc1,fsrc2,fdest */ -{ "fix.ss", 0x48000032, 0xb40007cd, "e,g", 0 }, /* fix.p fsrc1,fdest */ -{ "fix.sd", 0x480000b2, 0xb400074d, "e,g", 0 }, /* fix.p fsrc1,fdest */ -{ "fix.dd", 0x480001b2, 0xb400064d, "e,g", 0 }, /* fix.p fsrc1,fdest */ -{ "pfix.ss", 0x48000432, 0xb40003cd, "e,g", 0 }, /* pfix.p fsrc1,fdest */ -{ "pfix.sd", 0x480004b2, 0xb400034d, "e,g", 0 }, /* pfix.p fsrc1,fdest */ -{ "pfix.dd", 0x480005b2, 0xb400024d, "e,g", 0 }, /* pfix.p fsrc1,fdest */ -{ "famov.ss", 0x48000033, 0xb40007cc, "e,g", 0 }, /* famov.p fsrc1,fdest */ -{ "famov.ds", 0x48000133, 0xb40006cc, "e,g", 0 }, /* famov.p fsrc1,fdest */ -{ "famov.sd", 0x480000b3, 0xb400074c, "e,g", 0 }, /* famov.p fsrc1,fdest */ -{ "famov.dd", 0x480001b3, 0xb400064c, "e,g", 0 }, /* famov.p fsrc1,fdest */ -{ "pfamov.ss", 0x48000433, 0xb40003cc, "e,g", 0 }, /* pfamov.p fsrc1,fdest */ -{ "pfamov.ds", 0x48000533, 0xb40002cc, "e,g", 0 }, /* pfamov.p fsrc1,fdest */ -{ "pfamov.sd", 0x480004b3, 0xb400034c, "e,g", 0 }, /* pfamov.p fsrc1,fdest */ -{ "pfamov.dd", 0x480005b3, 0xb400024c, "e,g", 0 }, /* pfamov.p fsrc1,fdest */ -/* pfgt has R bit cleared; pfle has R bit set */ -{ "pfgt.ss", 0x48000434, 0xb40003cb, "e,f,g", 0 }, /* pfgt.p fsrc1,fsrc2,fdest */ -{ "pfgt.sd", 0x48000434, 0xb40003cb, "e,f,g", 0 }, /* pfgt.p fsrc1,fsrc2,fdest */ -{ "pfgt.dd", 0x48000534, 0xb40002cb, "e,f,g", 0 }, /* pfgt.p fsrc1,fsrc2,fdest */ -/* pfgt has R bit cleared; pfle has R bit set */ -{ "pfle.ss", 0x480004b4, 0xb400034b, "e,f,g", 0 }, /* pfle.p fsrc1,fsrc2,fdest */ -{ "pfle.sd", 0x480004b4, 0xb400034b, "e,f,g", 0 }, /* pfle.p fsrc1,fsrc2,fdest */ -{ "pfle.dd", 0x480005b4, 0xb400024b, "e,f,g", 0 }, /* pfle.p fsrc1,fsrc2,fdest */ -{ "ftrunc.ss", 0x4800003a, 0xb40007c5, "e,g", 0 }, /* ftrunc.p fsrc1,fdest */ -{ "ftrunc.sd", 0x480000ba, 0xb4000745, "e,g", 0 }, /* ftrunc.p fsrc1,fdest */ -{ "ftrunc.dd", 0x480001ba, 0xb4000645, "e,g", 0 }, /* ftrunc.p fsrc1,fdest */ -{ "pftrunc.ss", 0x4800043a, 0xb40003c5, "e,g", 0 }, /* pftrunc.p fsrc1,fdest */ -{ "pftrunc.sd", 0x480004ba, 0xb4000345, "e,g", 0 }, /* pftrunc.p fsrc1,fdest */ -{ "pftrunc.dd", 0x480005ba, 0xb4000245, "e,g", 0 }, /* pftrunc.p fsrc1,fdest */ -{ "fxfr", 0x48000040, 0xb40007bf, "e,d", 0 }, /* fxfr fsrc1,idest */ -{ "fiadd.ss", 0x48000049, 0xb40007b6, "e,f,g", 0 }, /* fiadd.w fsrc1,fsrc2,fdest */ -{ "fiadd.dd", 0x480001c9, 0xb4000636, "e,f,g", 0 }, /* fiadd.w fsrc1,fsrc2,fdest */ -{ "pfiadd.ss", 0x48000449, 0xb40003b6, "e,f,g", 0 }, /* pfiadd.w fsrc1,fsrc2,fdest */ -{ "pfiadd.dd", 0x480005c9, 0xb4000236, "e,f,g", 0 }, /* pfiadd.w fsrc1,fsrc2,fdest */ -{ "fisub.ss", 0x4800004d, 0xb40007b2, "e,f,g", 0 }, /* fisub.w fsrc1,fsrc2,fdest */ -{ "fisub.dd", 0x480001cd, 0xb4000632, "e,f,g", 0 }, /* fisub.w fsrc1,fsrc2,fdest */ -{ "pfisub.ss", 0x4800044d, 0xb40003b2, "e,f,g", 0 }, /* pfisub.w fsrc1,fsrc2,fdest */ -{ "pfisub.dd", 0x480005cd, 0xb4000232, "e,f,g", 0 }, /* pfisub.w fsrc1,fsrc2,fdest */ -{ "fzchkl", 0x48000057, 0xb40007a8, "e,f,g", 0 }, /* fzchkl fsrc1,fsrc2,fdest */ -{ "pfzchkl", 0x48000457, 0xb40003a8, "e,f,g", 0 }, /* pfzchkl fsrc1,fsrc2,fdest */ -{ "fzchks", 0x4800005f, 0xb40007a0, "e,f,g", 0 }, /* fzchks fsrc1,fsrc2,fdest */ -{ "pfzchks", 0x4800045f, 0xb40003a0, "e,f,g", 0 }, /* pfzchks fsrc1,fsrc2,fdest */ -{ "faddp", 0x48000050, 0xb40007af, "e,f,g", 0 }, /* faddp fsrc1,fsrc2,fdest */ -{ "pfaddp", 0x48000450, 0xb40003af, "e,f,g", 0 }, /* pfaddp fsrc1,fsrc2,fdest */ -{ "faddz", 0x48000051, 0xb40007ae, "e,f,g", 0 }, /* faddz fsrc1,fsrc2,fdest */ -{ "pfaddz", 0x48000451, 0xb40003ae, "e,f,g", 0 }, /* pfaddz fsrc1,fsrc2,fdest */ -{ "form", 0x4800005a, 0xb40007a5, "e,g", 0 }, /* form fsrc1,fdest */ -{ "pform", 0x4800045a, 0xb40003a5, "e,g", 0 }, /* pform fsrc1,fdest */ - -/* Floating point pseudo-instructions */ -{ "fmov.ss", 0x48000049, 0xb7e007b6, "e,g", 0 }, /* fiadd.ss fsrc1,f0,fdest */ -{ "fmov.dd", 0x480001c9, 0xb7e00636, "e,g", 0 }, /* fiadd.dd fsrc1,f0,fdest */ -{ "fmov.sd", 0x480000b0, 0xb7e0074f, "e,g", 0 }, /* fadd.sd fsrc1,f0,fdest */ -{ "fmov.ds", 0x48000130, 0xb7e006cf, "e,g", 0 }, /* fadd.ds fsrc1,f0,fdest */ -{ "pfmov.ds", 0x48000530, 0xb73002cf, "e,g", 0 }, /* pfadd.ds fsrc1,f0,fdest */ -{ "pfmov.dd", 0x480005c9, 0xb7e00236, "e,g", 0 }, /* pfiadd.dd fsrc1,f0,fdest */ - - -}; - -#define NUMOPCODES ((sizeof i860_opcodes)/(sizeof i860_opcodes[0])) - - diff --git a/contrib/gdb/include/opcode/i960.h b/contrib/gdb/include/opcode/i960.h deleted file mode 100644 index 8030ad8..0000000 --- a/contrib/gdb/include/opcode/i960.h +++ /dev/null @@ -1,509 +0,0 @@ -/* Basic 80960 instruction formats. - * - * The 'COJ' instructions are actually COBR instructions with the 'b' in - * the mnemonic replaced by a 'j'; they are ALWAYS "de-optimized" if necessary: - * if the displacement will not fit in 13 bits, the assembler will replace them - * with the corresponding compare and branch instructions. - * - * All of the 'MEMn' instructions are the same format; the 'n' in the name - * indicates the default index scale factor (the size of the datum operated on). - * - * The FBRA formats are not actually an instruction format. They are the - * "convenience directives" for branching on floating-point comparisons, - * each of which generates 2 instructions (a 'bno' and one other branch). - * - * The CALLJ format is not actually an instruction format. It indicates that - * the instruction generated (a CTRL-format 'call') should have its relocation - * specially flagged for link-time replacement with a 'bal' or 'calls' if - * appropriate. - */ - -#define CTRL 0 -#define COBR 1 -#define COJ 2 -#define REG 3 -#define MEM1 4 -#define MEM2 5 -#define MEM4 6 -#define MEM8 7 -#define MEM12 8 -#define MEM16 9 -#define FBRA 10 -#define CALLJ 11 - -/* Masks for the mode bits in REG format instructions */ -#define M1 0x0800 -#define M2 0x1000 -#define M3 0x2000 - -/* Generate the 12-bit opcode for a REG format instruction by placing the - * high 8 bits in instruction bits 24-31, the low 4 bits in instruction bits - * 7-10. - */ - -#define REG_OPC(opc) ((opc & 0xff0) << 20) | ((opc & 0xf) << 7) - -/* Generate a template for a REG format instruction: place the opcode bits - * in the appropriate fields and OR in mode bits for the operands that will not - * be used. I.e., - * set m1=1, if src1 will not be used - * set m2=1, if src2 will not be used - * set m3=1, if dst will not be used - * - * Setting the "unused" mode bits to 1 speeds up instruction execution(!). - * The information is also useful to us because some 1-operand REG instructions - * use the src1 field, others the dst field; and some 2-operand REG instructions - * use src1/src2, others src1/dst. The set mode bits enable us to distinguish. - */ -#define R_0(opc) ( REG_OPC(opc) | M1 | M2 | M3 ) /* No operands */ -#define R_1(opc) ( REG_OPC(opc) | M2 | M3 ) /* 1 operand: src1 */ -#define R_1D(opc) ( REG_OPC(opc) | M1 | M2 ) /* 1 operand: dst */ -#define R_2(opc) ( REG_OPC(opc) | M3 ) /* 2 ops: src1/src2 */ -#define R_2D(opc) ( REG_OPC(opc) | M2 ) /* 2 ops: src1/dst */ -#define R_3(opc) ( REG_OPC(opc) ) /* 3 operands */ - -/* DESCRIPTOR BYTES FOR REGISTER OPERANDS - * - * Interpret names as follows: - * R: global or local register only - * RS: global, local, or (if target allows) special-function register only - * RL: global or local register, or integer literal - * RSL: global, local, or (if target allows) special-function register; - * or integer literal - * F: global, local, or floating-point register - * FL: global, local, or floating-point register; or literal (including - * floating point) - * - * A number appended to a name indicates that registers must be aligned, - * as follows: - * 2: register number must be multiple of 2 - * 4: register number must be multiple of 4 - */ - -#define SFR 0x10 /* Mask for the "sfr-OK" bit */ -#define LIT 0x08 /* Mask for the "literal-OK" bit */ -#define FP 0x04 /* Mask for "floating-point-OK" bit */ - -/* This macro ors the bits together. Note that 'align' is a mask - * for the low 0, 1, or 2 bits of the register number, as appropriate. - */ -#define OP(align,lit,fp,sfr) ( align | lit | fp | sfr ) - -#define R OP( 0, 0, 0, 0 ) -#define RS OP( 0, 0, 0, SFR ) -#define RL OP( 0, LIT, 0, 0 ) -#define RSL OP( 0, LIT, 0, SFR ) -#define F OP( 0, 0, FP, 0 ) -#define FL OP( 0, LIT, FP, 0 ) -#define R2 OP( 1, 0, 0, 0 ) -#define RL2 OP( 1, LIT, 0, 0 ) -#define F2 OP( 1, 0, FP, 0 ) -#define FL2 OP( 1, LIT, FP, 0 ) -#define R4 OP( 3, 0, 0, 0 ) -#define RL4 OP( 3, LIT, 0, 0 ) -#define F4 OP( 3, 0, FP, 0 ) -#define FL4 OP( 3, LIT, FP, 0 ) - -#define M 0x7f /* Memory operand (MEMA & MEMB format instructions) */ - -/* Macros to extract info from the register operand descriptor byte 'od'. - */ -#define SFR_OK(od) (od & SFR) /* TRUE if sfr operand allowed */ -#define LIT_OK(od) (od & LIT) /* TRUE if literal operand allowed */ -#define FP_OK(od) (od & FP) /* TRUE if floating-point op allowed */ -#define REG_ALIGN(od,n) ((od & 0x3 & n) == 0) - /* TRUE if reg #n is properly aligned */ -#define MEMOP(od) (od == M) /* TRUE if operand is a memory operand*/ - -/* Description of a single i80960 instruction */ -struct i960_opcode { - long opcode; /* 32 bits, constant fields filled in, rest zeroed */ - char *name; /* Assembler mnemonic */ - short iclass; /* Class: see #defines below */ - char format; /* REG, COBR, CTRL, MEMn, COJ, FBRA, or CALLJ */ - char num_ops; /* Number of operands */ - char operand[3];/* Operand descriptors; same order as assembler instr */ -}; - -/* Classes of 960 intructions: - * - each instruction falls into one class. - * - each target architecture supports one or more classes. - * - * EACH CONSTANT MUST CONTAIN 1 AND ONLY 1 SET BIT!: see targ_has_iclass(). - */ -#define I_BASE 0x01 /* 80960 base instruction set */ -#define I_CX 0x02 /* 80960Cx instruction */ -#define I_DEC 0x04 /* Decimal instruction */ -#define I_FP 0x08 /* Floating point instruction */ -#define I_KX 0x10 /* 80960Kx instruction */ -#define I_MIL 0x20 /* Military instruction */ -#define I_CASIM 0x40 /* CA simulator instruction */ -#define I_CX2 0x80 /* Cx/Jx/Hx instructions */ -#define I_JX 0x100 /* Jx/Hx instruction */ -#define I_HX 0x200 /* Hx instructions */ - -/****************************************************************************** - * - * TABLE OF i960 INSTRUCTION DESCRIPTIONS - * - ******************************************************************************/ - -const struct i960_opcode i960_opcodes[] = { - - /* if a CTRL instruction has an operand, it's always a displacement */ - - /* callj default=='call' */ - { 0x09000000, "callj", I_BASE, CALLJ, 1, { 0, 0, 0 } }, - { 0x08000000, "b", I_BASE, CTRL, 1, { 0, 0, 0 } }, - { 0x09000000, "call", I_BASE, CTRL, 1, { 0, 0, 0 } }, - { 0x0a000000, "ret", I_BASE, CTRL, 0, { 0, 0, 0 } }, - { 0x0b000000, "bal", I_BASE, CTRL, 1, { 0, 0, 0 } }, - { 0x10000000, "bno", I_BASE, CTRL, 1, { 0, 0, 0 } }, - /* bf same as bno */ - { 0x10000000, "bf", I_BASE, CTRL, 1, { 0, 0, 0 } }, - /* bru same as bno */ - { 0x10000000, "bru", I_BASE, CTRL, 1, { 0, 0, 0 } }, - { 0x11000000, "bg", I_BASE, CTRL, 1, { 0, 0, 0 } }, - /* brg same as bg */ - { 0x11000000, "brg", I_BASE, CTRL, 1, { 0, 0, 0 } }, - { 0x12000000, "be", I_BASE, CTRL, 1, { 0, 0, 0 } }, - /* bre same as be */ - { 0x12000000, "bre", I_BASE, CTRL, 1, { 0, 0, 0 } }, - { 0x13000000, "bge", I_BASE, CTRL, 1, { 0, 0, 0 } }, - /* brge same as bge */ - { 0x13000000, "brge", I_BASE, CTRL, 1, { 0, 0, 0 } }, - { 0x14000000, "bl", I_BASE, CTRL, 1, { 0, 0, 0 } }, - /* brl same as bl */ - { 0x14000000, "brl", I_BASE, CTRL, 1, { 0, 0, 0 } }, - { 0x15000000, "bne", I_BASE, CTRL, 1, { 0, 0, 0 } }, - /* brlg same as bne */ - { 0x15000000, "brlg", I_BASE, CTRL, 1, { 0, 0, 0 } }, - { 0x16000000, "ble", I_BASE, CTRL, 1, { 0, 0, 0 } }, - /* brle same as ble */ - { 0x16000000, "brle", I_BASE, CTRL, 1, { 0, 0, 0 } }, - { 0x17000000, "bo", I_BASE, CTRL, 1, { 0, 0, 0 } }, - /* bt same as bo */ - { 0x17000000, "bt", I_BASE, CTRL, 1, { 0, 0, 0 } }, - /* bro same as bo */ - { 0x17000000, "bro", I_BASE, CTRL, 1, { 0, 0, 0 } }, - { 0x18000000, "faultno", I_BASE, CTRL, 0, { 0, 0, 0 } }, - /* faultf same as faultno */ - { 0x18000000, "faultf", I_BASE, CTRL, 0, { 0, 0, 0 } }, - { 0x19000000, "faultg", I_BASE, CTRL, 0, { 0, 0, 0 } }, - { 0x1a000000, "faulte", I_BASE, CTRL, 0, { 0, 0, 0 } }, - { 0x1b000000, "faultge", I_BASE, CTRL, 0, { 0, 0, 0 } }, - { 0x1c000000, "faultl", I_BASE, CTRL, 0, { 0, 0, 0 } }, - { 0x1d000000, "faultne", I_BASE, CTRL, 0, { 0, 0, 0 } }, - { 0x1e000000, "faultle", I_BASE, CTRL, 0, { 0, 0, 0 } }, - { 0x1f000000, "faulto", I_BASE, CTRL, 0, { 0, 0, 0 } }, - /* faultt syn for faulto */ - { 0x1f000000, "faultt", I_BASE, CTRL, 0, { 0, 0, 0 } }, - - { 0x01000000, "syscall", I_CASIM,CTRL, 0, { 0, 0, 0 } }, - - /* If a COBR (or COJ) has 3 operands, the last one is always a - * displacement and does not appear explicitly in the table. - */ - - { 0x20000000, "testno", I_BASE, COBR, 1, { R, 0, 0 } }, - { 0x21000000, "testg", I_BASE, COBR, 1, { R, 0, 0 } }, - { 0x22000000, "teste", I_BASE, COBR, 1, { R, 0, 0 } }, - { 0x23000000, "testge", I_BASE, COBR, 1, { R, 0, 0 } }, - { 0x24000000, "testl", I_BASE, COBR, 1, { R, 0, 0 } }, - { 0x25000000, "testne", I_BASE, COBR, 1, { R, 0, 0 } }, - { 0x26000000, "testle", I_BASE, COBR, 1, { R, 0, 0 } }, - { 0x27000000, "testo", I_BASE, COBR, 1, { R, 0, 0 } }, - { 0x30000000, "bbc", I_BASE, COBR, 3, { RL, RS, 0 } }, - { 0x31000000, "cmpobg", I_BASE, COBR, 3, { RL, RS, 0 } }, - { 0x32000000, "cmpobe", I_BASE, COBR, 3, { RL, RS, 0 } }, - { 0x33000000, "cmpobge", I_BASE, COBR, 3, { RL, RS, 0 } }, - { 0x34000000, "cmpobl", I_BASE, COBR, 3, { RL, RS, 0 } }, - { 0x35000000, "cmpobne", I_BASE, COBR, 3, { RL, RS, 0 } }, - { 0x36000000, "cmpoble", I_BASE, COBR, 3, { RL, RS, 0 } }, - { 0x37000000, "bbs", I_BASE, COBR, 3, { RL, RS, 0 } }, - { 0x38000000, "cmpibno", I_BASE, COBR, 3, { RL, RS, 0 } }, - { 0x39000000, "cmpibg", I_BASE, COBR, 3, { RL, RS, 0 } }, - { 0x3a000000, "cmpibe", I_BASE, COBR, 3, { RL, RS, 0 } }, - { 0x3b000000, "cmpibge", I_BASE, COBR, 3, { RL, RS, 0 } }, - { 0x3c000000, "cmpibl", I_BASE, COBR, 3, { RL, RS, 0 } }, - { 0x3d000000, "cmpibne", I_BASE, COBR, 3, { RL, RS, 0 } }, - { 0x3e000000, "cmpible", I_BASE, COBR, 3, { RL, RS, 0 } }, - { 0x3f000000, "cmpibo", I_BASE, COBR, 3, { RL, RS, 0 } }, - { 0x31000000, "cmpojg", I_BASE, COJ, 3, { RL, RS, 0 } }, - { 0x32000000, "cmpoje", I_BASE, COJ, 3, { RL, RS, 0 } }, - { 0x33000000, "cmpojge", I_BASE, COJ, 3, { RL, RS, 0 } }, - { 0x34000000, "cmpojl", I_BASE, COJ, 3, { RL, RS, 0 } }, - { 0x35000000, "cmpojne", I_BASE, COJ, 3, { RL, RS, 0 } }, - { 0x36000000, "cmpojle", I_BASE, COJ, 3, { RL, RS, 0 } }, - { 0x38000000, "cmpijno", I_BASE, COJ, 3, { RL, RS, 0 } }, - { 0x39000000, "cmpijg", I_BASE, COJ, 3, { RL, RS, 0 } }, - { 0x3a000000, "cmpije", I_BASE, COJ, 3, { RL, RS, 0 } }, - { 0x3b000000, "cmpijge", I_BASE, COJ, 3, { RL, RS, 0 } }, - { 0x3c000000, "cmpijl", I_BASE, COJ, 3, { RL, RS, 0 } }, - { 0x3d000000, "cmpijne", I_BASE, COJ, 3, { RL, RS, 0 } }, - { 0x3e000000, "cmpijle", I_BASE, COJ, 3, { RL, RS, 0 } }, - { 0x3f000000, "cmpijo", I_BASE, COJ, 3, { RL, RS, 0 } }, - - { 0x80000000, "ldob", I_BASE, MEM1, 2, { M, R, 0 } }, - { 0x82000000, "stob", I_BASE, MEM1, 2, { R, M, 0 } }, - { 0x84000000, "bx", I_BASE, MEM1, 1, { M, 0, 0 } }, - { 0x85000000, "balx", I_BASE, MEM1, 2, { M, R, 0 } }, - { 0x86000000, "callx", I_BASE, MEM1, 1, { M, 0, 0 } }, - { 0x88000000, "ldos", I_BASE, MEM2, 2, { M, R, 0 } }, - { 0x8a000000, "stos", I_BASE, MEM2, 2, { R, M, 0 } }, - { 0x8c000000, "lda", I_BASE, MEM1, 2, { M, R, 0 } }, - { 0x90000000, "ld", I_BASE, MEM4, 2, { M, R, 0 } }, - { 0x92000000, "st", I_BASE, MEM4, 2, { R, M, 0 } }, - { 0x98000000, "ldl", I_BASE, MEM8, 2, { M, R2, 0 } }, - { 0x9a000000, "stl", I_BASE, MEM8, 2, { R2, M, 0 } }, - { 0xa0000000, "ldt", I_BASE, MEM12, 2, { M, R4, 0 } }, - { 0xa2000000, "stt", I_BASE, MEM12, 2, { R4, M, 0 } }, - { 0xb0000000, "ldq", I_BASE, MEM16, 2, { M, R4, 0 } }, - { 0xb2000000, "stq", I_BASE, MEM16, 2, { R4, M, 0 } }, - { 0xc0000000, "ldib", I_BASE, MEM1, 2, { M, R, 0 } }, - { 0xc2000000, "stib", I_BASE, MEM1, 2, { R, M, 0 } }, - { 0xc8000000, "ldis", I_BASE, MEM2, 2, { M, R, 0 } }, - { 0xca000000, "stis", I_BASE, MEM2, 2, { R, M, 0 } }, - - { R_3(0x580), "notbit", I_BASE, REG, 3, { RSL,RSL,RS } }, - { R_3(0x581), "and", I_BASE, REG, 3, { RSL,RSL,RS } }, - { R_3(0x582), "andnot", I_BASE, REG, 3, { RSL,RSL,RS } }, - { R_3(0x583), "setbit", I_BASE, REG, 3, { RSL,RSL,RS } }, - { R_3(0x584), "notand", I_BASE, REG, 3, { RSL,RSL,RS } }, - { R_3(0x586), "xor", I_BASE, REG, 3, { RSL,RSL,RS } }, - { R_3(0x587), "or", I_BASE, REG, 3, { RSL,RSL,RS } }, - { R_3(0x588), "nor", I_BASE, REG, 3, { RSL,RSL,RS } }, - { R_3(0x589), "xnor", I_BASE, REG, 3, { RSL,RSL,RS } }, - { R_2D(0x58a), "not", I_BASE, REG, 2, { RSL,RS, 0 } }, - { R_3(0x58b), "ornot", I_BASE, REG, 3, { RSL,RSL,RS } }, - { R_3(0x58c), "clrbit", I_BASE, REG, 3, { RSL,RSL,RS } }, - { R_3(0x58d), "notor", I_BASE, REG, 3, { RSL,RSL,RS } }, - { R_3(0x58e), "nand", I_BASE, REG, 3, { RSL,RSL,RS } }, - { R_3(0x58f), "alterbit", I_BASE, REG, 3, { RSL,RSL,RS } }, - { R_3(0x590), "addo", I_BASE, REG, 3, { RSL,RSL,RS } }, - { R_3(0x591), "addi", I_BASE, REG, 3, { RSL,RSL,RS } }, - { R_3(0x592), "subo", I_BASE, REG, 3, { RSL,RSL,RS } }, - { R_3(0x593), "subi", I_BASE, REG, 3, { RSL,RSL,RS } }, - { R_3(0x598), "shro", I_BASE, REG, 3, { RSL,RSL,RS } }, - { R_3(0x59a), "shrdi", I_BASE, REG, 3, { RSL,RSL,RS } }, - { R_3(0x59b), "shri", I_BASE, REG, 3, { RSL,RSL,RS } }, - { R_3(0x59c), "shlo", I_BASE, REG, 3, { RSL,RSL,RS } }, - { R_3(0x59d), "rotate", I_BASE, REG, 3, { RSL,RSL,RS } }, - { R_3(0x59e), "shli", I_BASE, REG, 3, { RSL,RSL,RS } }, - { R_2(0x5a0), "cmpo", I_BASE, REG, 2, { RSL,RSL, 0 } }, - { R_2(0x5a1), "cmpi", I_BASE, REG, 2, { RSL,RSL, 0 } }, - { R_2(0x5a2), "concmpo", I_BASE, REG, 2, { RSL,RSL, 0 } }, - { R_2(0x5a3), "concmpi", I_BASE, REG, 2, { RSL,RSL, 0 } }, - { R_3(0x5a4), "cmpinco", I_BASE, REG, 3, { RSL,RSL,RS } }, - { R_3(0x5a5), "cmpinci", I_BASE, REG, 3, { RSL,RSL,RS } }, - { R_3(0x5a6), "cmpdeco", I_BASE, REG, 3, { RSL,RSL,RS } }, - { R_3(0x5a7), "cmpdeci", I_BASE, REG, 3, { RSL,RSL,RS } }, - { R_2(0x5ac), "scanbyte", I_BASE, REG, 2, { RSL,RSL, 0 } }, - { R_2(0x5ae), "chkbit", I_BASE, REG, 2, { RSL,RSL, 0 } }, - { R_3(0x5b0), "addc", I_BASE, REG, 3, { RSL,RSL,RS } }, - { R_3(0x5b2), "subc", I_BASE, REG, 3, { RSL,RSL,RS } }, - { R_2D(0x5cc), "mov", I_BASE, REG, 2, { RSL,RS, 0 } }, - { R_2D(0x5dc), "movl", I_BASE, REG, 2, { RL2,R2, 0 } }, - { R_2D(0x5ec), "movt", I_BASE, REG, 2, { RL4,R4, 0 } }, - { R_2D(0x5fc), "movq", I_BASE, REG, 2, { RL4,R4, 0 } }, - { R_3(0x610), "atmod", I_BASE, REG, 3, { RS, RSL,R } }, - { R_3(0x612), "atadd", I_BASE, REG, 3, { RS, RSL,RS } }, - { R_2D(0x640), "spanbit", I_BASE, REG, 2, { RSL,RS, 0 } }, - { R_2D(0x641), "scanbit", I_BASE, REG, 2, { RSL,RS, 0 } }, - { R_3(0x645), "modac", I_BASE, REG, 3, { RSL,RSL,RS } }, - { R_3(0x650), "modify", I_BASE, REG, 3, { RSL,RSL,R } }, - { R_3(0x651), "extract", I_BASE, REG, 3, { RSL,RSL,R } }, - { R_3(0x654), "modtc", I_BASE, REG, 3, { RSL,RSL,RS } }, - { R_3(0x655), "modpc", I_BASE, REG, 3, { RSL,RSL,R } }, - { R_1(0x660), "calls", I_BASE, REG, 1, { RSL, 0, 0 } }, - { R_0(0x66b), "mark", I_BASE, REG, 0, { 0, 0, 0 } }, - { R_0(0x66c), "fmark", I_BASE, REG, 0, { 0, 0, 0 } }, - { R_0(0x66d), "flushreg", I_BASE, REG, 0, { 0, 0, 0 } }, - { R_0(0x66f), "syncf", I_BASE, REG, 0, { 0, 0, 0 } }, - { R_3(0x670), "emul", I_BASE, REG, 3, { RSL,RSL,R2 } }, - { R_3(0x671), "ediv", I_BASE, REG, 3, { RSL,RL2,RS } }, - { R_2D(0x672), "cvtadr", I_CASIM,REG, 2, { RL, R2, 0 } }, - { R_3(0x701), "mulo", I_BASE, REG, 3, { RSL,RSL,RS } }, - { R_3(0x708), "remo", I_BASE, REG, 3, { RSL,RSL,RS } }, - { R_3(0x70b), "divo", I_BASE, REG, 3, { RSL,RSL,RS } }, - { R_3(0x741), "muli", I_BASE, REG, 3, { RSL,RSL,RS } }, - { R_3(0x748), "remi", I_BASE, REG, 3, { RSL,RSL,RS } }, - { R_3(0x749), "modi", I_BASE, REG, 3, { RSL,RSL,RS } }, - { R_3(0x74b), "divi", I_BASE, REG, 3, { RSL,RSL,RS } }, - - /* Floating-point instructions */ - - { R_2D(0x674), "cvtir", I_FP, REG, 2, { RL, F, 0 } }, - { R_2D(0x675), "cvtilr", I_FP, REG, 2, { RL, F, 0 } }, - { R_3(0x676), "scalerl", I_FP, REG, 3, { RL, FL2,F2 } }, - { R_3(0x677), "scaler", I_FP, REG, 3, { RL, FL, F } }, - { R_3(0x680), "atanr", I_FP, REG, 3, { FL, FL, F } }, - { R_3(0x681), "logepr", I_FP, REG, 3, { FL, FL, F } }, - { R_3(0x682), "logr", I_FP, REG, 3, { FL, FL, F } }, - { R_3(0x683), "remr", I_FP, REG, 3, { FL, FL, F } }, - { R_2(0x684), "cmpor", I_FP, REG, 2, { FL, FL, 0 } }, - { R_2(0x685), "cmpr", I_FP, REG, 2, { FL, FL, 0 } }, - { R_2D(0x688), "sqrtr", I_FP, REG, 2, { FL, F, 0 } }, - { R_2D(0x689), "expr", I_FP, REG, 2, { FL, F, 0 } }, - { R_2D(0x68a), "logbnr", I_FP, REG, 2, { FL, F, 0 } }, - { R_2D(0x68b), "roundr", I_FP, REG, 2, { FL, F, 0 } }, - { R_2D(0x68c), "sinr", I_FP, REG, 2, { FL, F, 0 } }, - { R_2D(0x68d), "cosr", I_FP, REG, 2, { FL, F, 0 } }, - { R_2D(0x68e), "tanr", I_FP, REG, 2, { FL, F, 0 } }, - { R_1(0x68f), "classr", I_FP, REG, 1, { FL, 0, 0 } }, - { R_3(0x690), "atanrl", I_FP, REG, 3, { FL2,FL2,F2 } }, - { R_3(0x691), "logeprl", I_FP, REG, 3, { FL2,FL2,F2 } }, - { R_3(0x692), "logrl", I_FP, REG, 3, { FL2,FL2,F2 } }, - { R_3(0x693), "remrl", I_FP, REG, 3, { FL2,FL2,F2 } }, - { R_2(0x694), "cmporl", I_FP, REG, 2, { FL2,FL2, 0 } }, - { R_2(0x695), "cmprl", I_FP, REG, 2, { FL2,FL2, 0 } }, - { R_2D(0x698), "sqrtrl", I_FP, REG, 2, { FL2,F2, 0 } }, - { R_2D(0x699), "exprl", I_FP, REG, 2, { FL2,F2, 0 } }, - { R_2D(0x69a), "logbnrl", I_FP, REG, 2, { FL2,F2, 0 } }, - { R_2D(0x69b), "roundrl", I_FP, REG, 2, { FL2,F2, 0 } }, - { R_2D(0x69c), "sinrl", I_FP, REG, 2, { FL2,F2, 0 } }, - { R_2D(0x69d), "cosrl", I_FP, REG, 2, { FL2,F2, 0 } }, - { R_2D(0x69e), "tanrl", I_FP, REG, 2, { FL2,F2, 0 } }, - { R_1(0x69f), "classrl", I_FP, REG, 1, { FL2, 0, 0 } }, - { R_2D(0x6c0), "cvtri", I_FP, REG, 2, { FL, R, 0 } }, - { R_2D(0x6c1), "cvtril", I_FP, REG, 2, { FL, R2, 0 } }, - { R_2D(0x6c2), "cvtzri", I_FP, REG, 2, { FL, R, 0 } }, - { R_2D(0x6c3), "cvtzril", I_FP, REG, 2, { FL, R2, 0 } }, - { R_2D(0x6c9), "movr", I_FP, REG, 2, { FL, F, 0 } }, - { R_2D(0x6d9), "movrl", I_FP, REG, 2, { FL2,F2, 0 } }, - { R_2D(0x6e1), "movre", I_FP, REG, 2, { FL4,F4, 0 } }, - { R_3(0x6e2), "cpysre", I_FP, REG, 3, { FL4,FL4,F4 } }, - { R_3(0x6e3), "cpyrsre", I_FP, REG, 3, { FL4,FL4,F4 } }, - { R_3(0x78b), "divr", I_FP, REG, 3, { FL, FL, F } }, - { R_3(0x78c), "mulr", I_FP, REG, 3, { FL, FL, F } }, - { R_3(0x78d), "subr", I_FP, REG, 3, { FL, FL, F } }, - { R_3(0x78f), "addr", I_FP, REG, 3, { FL, FL, F } }, - { R_3(0x79b), "divrl", I_FP, REG, 3, { FL2,FL2,F2 } }, - { R_3(0x79c), "mulrl", I_FP, REG, 3, { FL2,FL2,F2 } }, - { R_3(0x79d), "subrl", I_FP, REG, 3, { FL2,FL2,F2 } }, - { R_3(0x79f), "addrl", I_FP, REG, 3, { FL2,FL2,F2 } }, - - /* These are the floating point branch instructions. Each actually - * generates 2 branch instructions: the first a CTRL instruction with - * the indicated opcode, and the second a 'bno'. - */ - - { 0x12000000, "brue", I_FP, FBRA, 1, { 0, 0, 0 } }, - { 0x11000000, "brug", I_FP, FBRA, 1, { 0, 0, 0 } }, - { 0x13000000, "bruge", I_FP, FBRA, 1, { 0, 0, 0 } }, - { 0x14000000, "brul", I_FP, FBRA, 1, { 0, 0, 0 } }, - { 0x16000000, "brule", I_FP, FBRA, 1, { 0, 0, 0 } }, - { 0x15000000, "brulg", I_FP, FBRA, 1, { 0, 0, 0 } }, - - - /* Decimal instructions */ - - { R_3(0x642), "daddc", I_DEC, REG, 3, { RSL,RSL,RS } }, - { R_3(0x643), "dsubc", I_DEC, REG, 3, { RSL,RSL,RS } }, - { R_2D(0x644), "dmovt", I_DEC, REG, 2, { RSL,RS, 0 } }, - - - /* KX extensions */ - - { R_2(0x600), "synmov", I_KX, REG, 2, { R, R, 0 } }, - { R_2(0x601), "synmovl", I_KX, REG, 2, { R, R, 0 } }, - { R_2(0x602), "synmovq", I_KX, REG, 2, { R, R, 0 } }, - { R_2D(0x615), "synld", I_KX, REG, 2, { R, R, 0 } }, - - - /* MC extensions */ - - { R_3(0x603), "cmpstr", I_MIL, REG, 3, { R, R, RL } }, - { R_3(0x604), "movqstr", I_MIL, REG, 3, { R, R, RL } }, - { R_3(0x605), "movstr", I_MIL, REG, 3, { R, R, RL } }, - { R_2D(0x613), "inspacc", I_MIL, REG, 2, { R, R, 0 } }, - { R_2D(0x614), "ldphy", I_MIL, REG, 2, { R, R, 0 } }, - { R_3(0x617), "fill", I_MIL, REG, 3, { R, RL, RL } }, - { R_2D(0x646), "condrec", I_MIL, REG, 2, { R, R, 0 } }, - { R_2D(0x656), "receive", I_MIL, REG, 2, { R, R, 0 } }, - { R_3(0x662), "send", I_MIL, REG, 3, { R, RL, R } }, - { R_1(0x663), "sendserv", I_MIL, REG, 1, { R, 0, 0 } }, - { R_1(0x664), "resumprcs", I_MIL, REG, 1, { R, 0, 0 } }, - { R_1(0x665), "schedprcs", I_MIL, REG, 1, { R, 0, 0 } }, - { R_0(0x666), "saveprcs", I_MIL, REG, 0, { 0, 0, 0 } }, - { R_1(0x668), "condwait", I_MIL, REG, 1, { R, 0, 0 } }, - { R_1(0x669), "wait", I_MIL, REG, 1, { R, 0, 0 } }, - { R_1(0x66a), "signal", I_MIL, REG, 1, { R, 0, 0 } }, - { R_1D(0x673), "ldtime", I_MIL, REG, 1, { R2, 0, 0 } }, - - - /* CX extensions */ - - { R_3(0x5d8), "eshro", I_CX2, REG, 3, { RSL,RSL,RS } }, - { R_3(0x630), "sdma", I_CX, REG, 3, { RSL,RSL,RL } }, - { R_3(0x631), "udma", I_CX, REG, 0, { 0, 0, 0 } }, - { R_3(0x659), "sysctl", I_CX2, REG, 3, { RSL,RSL,RL } }, - - - /* Jx extensions. */ - { R_3(0x780), "addono", I_JX, REG, 3, { RSL,RSL,RS } }, - { R_3(0x790), "addog", I_JX, REG, 3, { RSL,RSL,RS } }, - { R_3(0x7a0), "addoe", I_JX, REG, 3, { RSL,RSL,RS } }, - { R_3(0x7b0), "addoge", I_JX, REG, 3, { RSL,RSL,RS } }, - { R_3(0x7c0), "addol", I_JX, REG, 3, { RSL,RSL,RS } }, - { R_3(0x7d0), "addone", I_JX, REG, 3, { RSL,RSL,RS } }, - { R_3(0x7e0), "addole", I_JX, REG, 3, { RSL,RSL,RS } }, - { R_3(0x7f0), "addoo", I_JX, REG, 3, { RSL,RSL,RS } }, - { R_3(0x781), "addino", I_JX, REG, 3, { RSL,RSL,RS } }, - { R_3(0x791), "addig", I_JX, REG, 3, { RSL,RSL,RS } }, - { R_3(0x7a1), "addie", I_JX, REG, 3, { RSL,RSL,RS } }, - { R_3(0x7b1), "addige", I_JX, REG, 3, { RSL,RSL,RS } }, - { R_3(0x7c1), "addil", I_JX, REG, 3, { RSL,RSL,RS } }, - { R_3(0x7d1), "addine", I_JX, REG, 3, { RSL,RSL,RS } }, - { R_3(0x7e1), "addile", I_JX, REG, 3, { RSL,RSL,RS } }, - { R_3(0x7f1), "addio", I_JX, REG, 3, { RSL,RSL,RS } }, - - { R_2D(0x5ad), "bswap", I_JX, REG, 2, { RSL, RS, 0 } }, - - { R_2(0x594), "cmpob", I_JX, REG, 2, { RSL,RSL, 0 } }, - { R_2(0x595), "cmpib", I_JX, REG, 2, { RSL,RSL, 0 } }, - { R_2(0x596), "cmpos", I_JX, REG, 2, { RSL,RSL, 0 } }, - { R_2(0x597), "cmpis", I_JX, REG, 2, { RSL,RSL, 0 } }, - - { R_3(0x784), "selno", I_JX, REG, 3, { RSL,RSL,RS } }, - { R_3(0x794), "selg", I_JX, REG, 3, { RSL,RSL,RS } }, - { R_3(0x7a4), "sele", I_JX, REG, 3, { RSL,RSL,RS } }, - { R_3(0x7b4), "selge", I_JX, REG, 3, { RSL,RSL,RS } }, - { R_3(0x7c4), "sell", I_JX, REG, 3, { RSL,RSL,RS } }, - { R_3(0x7d4), "selne", I_JX, REG, 3, { RSL,RSL,RS } }, - { R_3(0x7e4), "selle", I_JX, REG, 3, { RSL,RSL,RS } }, - { R_3(0x7f4), "selo", I_JX, REG, 3, { RSL,RSL,RS } }, - - { R_3(0x782), "subono", I_JX, REG, 3, { RSL,RSL,RS } }, - { R_3(0x792), "subog", I_JX, REG, 3, { RSL,RSL,RS } }, - { R_3(0x7a2), "suboe", I_JX, REG, 3, { RSL,RSL,RS } }, - { R_3(0x7b2), "suboge", I_JX, REG, 3, { RSL,RSL,RS } }, - { R_3(0x7c2), "subol", I_JX, REG, 3, { RSL,RSL,RS } }, - { R_3(0x7d2), "subone", I_JX, REG, 3, { RSL,RSL,RS } }, - { R_3(0x7e2), "subole", I_JX, REG, 3, { RSL,RSL,RS } }, - { R_3(0x7f2), "suboo", I_JX, REG, 3, { RSL,RSL,RS } }, - { R_3(0x783), "subino", I_JX, REG, 3, { RSL,RSL,RS } }, - { R_3(0x793), "subig", I_JX, REG, 3, { RSL,RSL,RS } }, - { R_3(0x7a3), "subie", I_JX, REG, 3, { RSL,RSL,RS } }, - { R_3(0x7b3), "subige", I_JX, REG, 3, { RSL,RSL,RS } }, - { R_3(0x7c3), "subil", I_JX, REG, 3, { RSL,RSL,RS } }, - { R_3(0x7d3), "subine", I_JX, REG, 3, { RSL,RSL,RS } }, - { R_3(0x7e3), "subile", I_JX, REG, 3, { RSL,RSL,RS } }, - { R_3(0x7f3), "subio", I_JX, REG, 3, { RSL,RSL,RS } }, - - { R_3(0x65c), "dcctl", I_JX, REG, 3, { RSL,RSL,RL } }, - { R_3(0x65b), "icctl", I_JX, REG, 3, { RSL,RSL,RS } }, - { R_2D(0x658), "intctl", I_JX, REG, 2, { RSL, RS, 0 } }, - { R_0(0x5b4), "intdis", I_JX, REG, 0, { 0, 0, 0 } }, - { R_0(0x5b5), "inten", I_JX, REG, 0, { 0, 0, 0 } }, - { R_0(0x65d), "halt", I_JX, REG, 0, { 0, 0, 0 } }, - - /* Hx extensions. */ - { 0xac000000, "dcinva", I_HX, MEM1, 1, { M, 0, 0 } }, - - /* END OF TABLE */ - - { 0, NULL, 0, 0, 0, { 0, 0, 0 } } -}; - - /* end of i960-opcode.h */ diff --git a/contrib/gdb/include/opcode/m68k.h b/contrib/gdb/include/opcode/m68k.h deleted file mode 100644 index e0b371c..0000000 --- a/contrib/gdb/include/opcode/m68k.h +++ /dev/null @@ -1,297 +0,0 @@ -/* Opcode table header for m680[01234]0/m6888[12]/m68851. - Copyright 1989, 1991, 1992, 1993, 1994, 1995 Free Software Foundation. - -This file is part of GDB, GAS, and the GNU binutils. - -GDB, GAS, and the GNU binutils are free software; you can redistribute -them and/or modify them under the terms of the GNU General Public -License as published by the Free Software Foundation; either version -1, or (at your option) any later version. - -GDB, GAS, and the GNU binutils are distributed in the hope that they -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 file; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ - -/* These are used as bit flags for the arch field in the m68k_opcode - structure. */ -#define _m68k_undef 0 -#define m68000 0x001 -#define m68008 m68000 /* synonym for -m68000. otherwise unused. */ -#define m68010 0x002 -#define m68020 0x004 -#define m68030 0x008 -#define m68ec030 m68030 /* similar enough to -m68030 to ignore differences; - gas will deal with the few differences. */ -#define m68040 0x010 -/* there is no 68050 */ -#define m68060 0x020 -#define m68881 0x040 -#define m68882 m68881 /* synonym for -m68881. otherwise unused. */ -#define m68851 0x080 -#define cpu32 0x100 /* e.g., 68332 */ - - /* handy aliases */ -#define m68040up (m68040 | m68060) -#define m68030up (m68030 | m68040up) -#define m68020up (m68020 | m68030up) -#define m68010up (m68010 | cpu32 | m68020up) -#define m68000up (m68000 | m68010up) - -#define mfloat (m68881 | m68882 | m68040 | m68060) -#define mmmu (m68851 | m68030 | m68040 | m68060) - -/* The structure used to hold information for an opcode. */ - -struct m68k_opcode -{ - /* The opcode name. */ - const char *name; - /* The opcode itself. */ - unsigned long opcode; - /* The mask used by the disassembler. */ - unsigned long match; - /* The arguments. */ - const char *args; - /* The architectures which support this opcode. */ - unsigned int arch; -}; - -/* The structure used to hold information for an opcode alias. */ - -struct m68k_opcode_alias -{ - /* The alias name. */ - const char *alias; - /* The instruction for which this is an alias. */ - const char *primary; -}; - -/* We store four bytes of opcode for all opcodes because that is the - most any of them need. The actual length of an instruction is - always at least 2 bytes, and is as much longer as necessary to hold - the operands it has. - - The match field is a mask saying which bits must match particular - opcode in order for an instruction to be an instance of that - opcode. - - The args field is a string containing two characters for each - operand of the instruction. The first specifies the kind of - operand; the second, the place it is stored. */ - -/* Kinds of operands: - Characters used: AaBCcDdFfIJkLlMOQRrSsTtUVWXYZ0123|*~%;@!&$?/#^+- - - D data register only. Stored as 3 bits. - A address register only. Stored as 3 bits. - a address register indirect only. Stored as 3 bits. - R either kind of register. Stored as 4 bits. - r either kind of register indirect only. Stored as 4 bits. - At the moment, used only for cas2 instruction. - F floating point coprocessor register only. Stored as 3 bits. - O an offset (or width): immediate data 0-31 or data register. - Stored as 6 bits in special format for BF... insns. - + autoincrement only. Stored as 3 bits (number of the address register). - - autodecrement only. Stored as 3 bits (number of the address register). - Q quick immediate data. Stored as 3 bits. - This matches an immediate operand only when value is in range 1 .. 8. - M moveq immediate data. Stored as 8 bits. - This matches an immediate operand only when value is in range -128..127 - T trap vector immediate data. Stored as 4 bits. - - k K-factor for fmove.p instruction. Stored as a 7-bit constant or - a three bit register offset, depending on the field type. - - # immediate data. Stored in special places (b, w or l) - which say how many bits to store. - ^ immediate data for floating point instructions. Special places - are offset by 2 bytes from '#'... - B pc-relative address, converted to an offset - that is treated as immediate data. - d displacement and register. Stores the register as 3 bits - and stores the displacement in the entire second word. - - C the CCR. No need to store it; this is just for filtering validity. - S the SR. No need to store, just as with CCR. - U the USP. No need to store, just as with CCR. - - I Coprocessor ID. Not printed if 1. The Coprocessor ID is always - extracted from the 'd' field of word one, which means that an extended - coprocessor opcode can be skipped using the 'i' place, if needed. - - s System Control register for the floating point coprocessor. - - J Misc register for movec instruction, stored in 'j' format. - Possible values: - 0x000 SFC Source Function Code reg [60, 40, 30, 20, 10] - 0x001 DFC Data Function Code reg [60, 40, 30, 20, 10] - 0x002 CACR Cache Control Register [60, 40, 30, 20] - 0x003 TC MMU Translation Control [60, 40] - 0x004 ITT0 Instruction Transparent - Translation reg 0 [60, 40] - 0x005 ITT1 Instruction Transparent - Translation reg 1 [60, 40] - 0x006 DTT0 Data Transparent - Translation reg 0 [60, 40] - 0x007 DTT1 Data Transparent - Translation reg 1 [60, 40] - 0x008 BUSCR Bus Control Register [60] - 0x800 USP User Stack Pointer [60, 40, 30, 20, 10] - 0x801 VBR Vector Base reg [60, 40, 30, 20, 10] - 0x802 CAAR Cache Address Register [ 30, 20] - 0x803 MSP Master Stack Pointer [ 40, 30, 20] - 0x804 ISP Interrupt Stack Pointer [ 40, 30, 20] - 0x805 MMUSR MMU Status reg [ 40] - 0x806 URP User Root Pointer [60, 40] - 0x807 SRP Supervisor Root Pointer [60, 40] - 0x808 PCR Processor Configuration reg [60] - - L Register list of the type d0-d7/a0-a7 etc. - (New! Improved! Can also hold fp0-fp7, as well!) - The assembler tries to see if the registers match the insn by - looking at where the insn wants them stored. - - l Register list like L, but with all the bits reversed. - Used for going the other way. . . - - c cache identifier which may be "nc" for no cache, "ic" - for instruction cache, "dc" for data cache, or "bc" - for both caches. Used in cinv and cpush. Always - stored in position "d". - - The remainder are all stored as 6 bits using an address mode and a - register number; they differ in which addressing modes they match. - - * all (modes 0-6,7.*) - ~ alterable memory (modes 2-6,7.0,7.1) - (not 0,1,7.~) - % alterable (modes 0-6,7.0,7.1)(not 7.~) - ; data (modes 0,2-6,7.*)(not 1) - @ data, but not immediate (modes 0,2-6,7.? ? ?) - (not 1,7.?) - This may really be ;, - the 68020 book says it is - ! control (modes 2,5,6,7.*-) - (not 0,1,3,4,7.4) - & alterable control (modes 2,5,6,7.0,7.1) - (not 0,1,7.? ? ?) - $ alterable data (modes 0,2-6,7.0,7.1) - (not 1,7.~) - ? alterable control, or data register (modes 0,2,5,6,7.0,7.1) - (not 1,3,4,7.~) - / control, or data register (modes 0,2,5,6,7.0,7.1,7.2,7.3) - (not 1,3,4,7.4) - ` control, plus pre-dec, not simple indir. (modes 4,5,6,7.*-) - (not 0,1,2,3,7.4) */ - -/* For the 68851: */ -/* - I didn't use much imagination in choosing the - following codes, so many of them aren't very - mnemonic. -rab - - 0 32 bit pmmu register - Possible values: - 000 TC Translation Control Register (68030, 68851) - - 1 16 bit pmmu register - 111 AC Access Control (68851) - - 2 8 bit pmmu register - 100 CAL Current Access Level (68851) - 101 VAL Validate Access Level (68851) - 110 SCC Stack Change Control (68851) - - 3 68030-only pmmu registers (32 bit) - 010 TT0 Transparent Translation reg 0 - (aka Access Control reg 0 -- AC0 -- on 68ec030) - 011 TT1 Transparent Translation reg 1 - (aka Access Control reg 1 -- AC1 -- on 68ec030) - - W wide pmmu registers - Possible values: - 001 DRP Dma Root Pointer (68851) - 010 SRP Supervisor Root Pointer (68030, 68851) - 011 CRP Cpu Root Pointer (68030, 68851) - - f function code register (68030, 68851) - 0 SFC - 1 DFC - - V VAL register only (68851) - - X BADx, BACx (16 bit) - 100 BAD Breakpoint Acknowledge Data (68851) - 101 BAC Breakpoint Acknowledge Control (68851) - - Y PSR (68851) (MMUSR on 68030) (ACUSR on 68ec030) - Z PCSR (68851) - - | memory (modes 2-6, 7.*) - - t address test level (68030 only) - Stored as 3 bits, range 0-7. - Also used for breakpoint instruction now. - -*/ - -/* Places to put an operand, for non-general operands: - s source, low bits of first word. - d dest, shifted 9 in first word - 1 second word, shifted 12 - 2 second word, shifted 6 - 3 second word, shifted 0 - 4 third word, shifted 12 - 5 third word, shifted 6 - 6 third word, shifted 0 - 7 second word, shifted 7 - 8 second word, shifted 10 - 9 second word, shifted 5 - D store in both place 1 and place 3; for divul and divsl. - B first word, low byte, for branch displacements - W second word (entire), for branch displacements - L second and third words (entire), for branch displacements - (also overloaded for move16) - b second word, low byte - w second word (entire) [variable word/long branch offset for dbra] - W second word (entire) (must be signed 16 bit value) - l second and third word (entire) - g variable branch offset for bra and similar instructions. - The place to store depends on the magnitude of offset. - t store in both place 7 and place 8; for floating point operations - c branch offset for cpBcc operations. - The place to store is word two if bit six of word one is zero, - and words two and three if bit six of word one is one. - i Increment by two, to skip over coprocessor extended operands. Only - works with the 'I' format. - k Dynamic K-factor field. Bits 6-4 of word 2, used as a register number. - Also used for dynamic fmovem instruction. - C floating point coprocessor constant - 7 bits. Also used for static - K-factors... - j Movec register #, stored in 12 low bits of second word. - - Places to put operand, for general operands: - d destination, shifted 6 bits in first word - b source, at low bit of first word, and immediate uses one byte - w source, at low bit of first word, and immediate uses two bytes - l source, at low bit of first word, and immediate uses four bytes - s source, at low bit of first word. - Used sometimes in contexts where immediate is not allowed anyway. - f single precision float, low bit of 1st word, immediate uses 4 bytes - F double precision float, low bit of 1st word, immediate uses 8 bytes - x extended precision float, low bit of 1st word, immediate uses 12 bytes - p packed float, low bit of 1st word, immediate uses 12 bytes -*/ - -extern const struct m68k_opcode m68k_opcodes[]; -extern const struct m68k_opcode_alias m68k_opcode_aliases[]; - -extern const int m68k_numopcodes, m68k_numaliases; - -/* end of m68k-opcode.h */ diff --git a/contrib/gdb/include/opcode/m88k.h b/contrib/gdb/include/opcode/m88k.h deleted file mode 100644 index a17fa03..0000000 --- a/contrib/gdb/include/opcode/m88k.h +++ /dev/null @@ -1,923 +0,0 @@ -/* Table of opcodes for the motorola 88k family. - Copyright 1989, 1990, 1991, 1992, 1993 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. */ - -/* - * Disassembler Instruction Table - * - * The first field of the table is the opcode field. If an opcode - * is specified which has any non-opcode bits on, a system error - * will occur when the system attempts the install it into the - * instruction table. The second parameter is a pointer to the - * instruction mnemonic. Each operand is specified by offset, width, - * and type. The offset is the bit number of the least significant - * bit of the operand with bit 0 being the least significant bit of - * the instruction. The width is the number of bits used to specify - * the operand. The type specifies the output format to be used for - * the operand. The valid formats are: register, register indirect, - * hex constant, and bit field specification. The last field is a - * pointer to the next instruction in the linked list. These pointers - * are initialized by init_disasm(). - * - * Structure Format - * - * struct INSTAB { - * UPINT opcode; - * char *mnemonic; - * struct OPSPEC op1,op2,op3; - * struct SIM_FLAGS flgs; - * struct INSTAB *next; - * } - * - * struct OPSPEC { - * UPINT offset:5; - * UPINT width:6; - * UPINT type:5; - * } - * - * Revision History - * - * Revision 1.0 11/08/85 Creation date - * 1.1 02/05/86 Updated instruction mnemonic table MD - * 1.2 06/16/86 Updated SIM_FLAGS for floating point - * 1.3 09/20/86 Updated for new encoding - * 05/11/89 R. Trawick adapted from Motorola disassembler - */ - -#include - - -/* - * This file contains the structures and constants needed to build the M88000 - * simulator. It is the main include file, containing all the - * structures, macros and definitions except for the floating point - * instruction set. - */ - -/* - * The following flag informs the Simulator as to what type of byte ordering - * will be used. For instance, a BOFLAG = 1 indicates a DEC VAX and IBM type - * of ordering shall be used. -*/ - -/* # define BOFLAG 1 */ /* BYTE ORDERING FLAG */ - -/* define the number of bits in the primary opcode field of the instruction, - * the destination field, the source 1 and source 2 fields. - */ -# define OP 8 /* size of opcode field */ -# define DEST 6 /* size of destination */ -# define SOURCE1 6 /* size of source1 */ -# define SOURCE2 6 /* size of source2 */ - -# define REGs 32 /* number of registers */ - -# define WORD long -# define FLAG unsigned -# define STATE short - -# define TRUE 1 -# define FALSE 0 - -# define READ 0 -# define WRITE 1 - -/* The next four equates define the priorities that the various classes - * of instructions have regarding writing results back into registers and - * signalling exceptions. - */ -/* PMEM is also defined in on Delta 88's. Sigh! */ -#undef PMEM - -# define PINT 0 /* Integer Priority */ -# define PFLT 1 /* Floating Point Priority */ -# define PMEM 2 /* Memory Priority */ -# define NA 3 /* Not Applicable, instruction doesnt write to regs */ -# define HIPRI 3 /* highest of these priorities */ - -/* The instruction registers are an artificial mechanism to speed up - * simulator execution. In the real processor, an instruction register - * is 32 bits wide. In the simulator, the 32 bit instruction is kept in - * a structure field called rawop, and the instruction is partially decoded, - * and split into various fields and flags which make up the other fields - * of the structure. - * The partial decode is done when the instructions are initially loaded - * into simulator memory. The simulator code memory is not an array of - * 32 bit words, but is an array of instruction register structures. - * Yes this wastes memory, but it executes much quicker. - */ - -struct IR_FIELDS { - unsigned op:OP, - dest: DEST, - src1: SOURCE1, - src2: SOURCE2; - int ltncy, - extime, - wb_pri; /* writeback priority */ - unsigned imm_flags:2,/* immediate size */ - rs1_used:1, /* register source 1 used */ - rs2_used:1, /* register source 2 used */ - rsd_used:1, /* register source/dest. used */ - c_flag:1, /* complement */ - u_flag:1, /* upper half word */ - n_flag:1, /* execute next */ - wb_flag:1, /* uses writeback slot */ - dest_64:1, /* dest size */ - s1_64:1, /* source 1 size */ - s2_64:1, /* source 2 size */ - scale_flag:1, /* scaled register */ - brk_flg:1; - }; - -struct mem_segs { - struct mem_wrd *seg; /* pointer (returned by calloc) to segment */ - unsigned long baseaddr; /* base load address from file headers */ - unsigned long endaddr; /* Ending address of segment */ - int flags; /* segment control flags (none defined 12/5/86) */ -}; - -#define MAXSEGS (10) /* max number of segment allowed */ -#define MEMSEGSIZE (sizeof(struct mem_segs))/* size of mem_segs structure */ - - -#define BRK_RD (0x01) /* break on memory read */ -#define BRK_WR (0x02) /* break on memory write */ -#define BRK_EXEC (0x04) /* break on execution */ -#define BRK_CNT (0x08) /* break on terminal count */ - - -struct mem_wrd { - struct IR_FIELDS opcode; /* simulator instruction break down */ - union { - unsigned long l; /* memory element break down */ - unsigned short s[2]; - unsigned char c[4]; - } mem; -}; - -#define MEMWRDSIZE (sizeof(struct mem_wrd)) /* size of each 32 bit memory model */ - -/* External declarations */ - -extern struct mem_segs memory[]; -extern struct PROCESSOR m78000; - -struct PROCESSOR { - unsigned WORD - ip, /* execute instruction pointer */ - vbr, /* vector base register */ - psr; /* processor status register */ - - WORD S1bus, /* source 1 */ - S2bus, /* source 2 */ - Dbus, /* destination */ - DAbus, /* data address bus */ - ALU, - Regs[REGs], /* data registers */ - time_left[REGs], /* max clocks before reg is available */ - wb_pri[REGs], /* writeback priority of reg */ - SFU0_regs[REGs], /* integer unit control regs */ - SFU1_regs[REGs], /* floating point control regs */ - Scoreboard[REGs], - Vbr; - unsigned WORD scoreboard, - Psw, - Tpsw; - FLAG jump_pending:1; /* waiting for a jump instr. */ - }; - -# define i26bit 1 /* size of immediate field */ -# define i16bit 2 -# define i10bit 3 - -/* Definitions for fields in psr */ - -# define mode 31 -# define rbo 30 -# define ser 29 -# define carry 28 -# define sf7m 11 -# define sf6m 10 -# define sf5m 9 -# define sf4m 8 -# define sf3m 7 -# define sf2m 6 -# define sf1m 5 -# define mam 4 -# define inm 3 -# define exm 2 -# define trm 1 -# define ovfm 0 - -#define MODEMASK (1<<(mode-1)) -# define SILENT 0 /* simulate without output to crt */ -# define VERBOSE 1 /* simulate in verbose mode */ -# define PR_INSTR 2 /* only print instructions */ - -# define RESET 16 /* reset phase */ - -# define PHASE1 0 /* data path phases */ -# define PHASE2 1 - -/* the 1 clock operations */ - -# define ADDU 1 -# define ADDC 2 -# define ADDUC 3 -# define ADD 4 - -# define SUBU ADD+1 -# define SUBB ADD+2 -# define SUBUB ADD+3 -# define SUB ADD+4 - -# define AND_ ADD+5 -# define OR ADD+6 -# define XOR ADD+7 -# define CMP ADD+8 - -/* the LOADS */ - -# define LDAB CMP+1 -# define LDAH CMP+2 -# define LDA CMP+3 -# define LDAD CMP+4 - -# define LDB LDAD+1 -# define LDH LDAD+2 -# define LD LDAD+3 -# define LDD LDAD+4 -# define LDBU LDAD+5 -# define LDHU LDAD+6 - -/* the STORES */ - -# define STB LDHU+1 -# define STH LDHU+2 -# define ST LDHU+3 -# define STD LDHU+4 - -/* the exchange */ - -# define XMEMBU LDHU+5 -# define XMEM LDHU+6 - -/* the branches */ -# define JSR STD+1 -# define BSR STD+2 -# define BR STD+3 -# define JMP STD+4 -# define BB1 STD+5 -# define BB0 STD+6 -# define RTN STD+7 -# define BCND STD+8 - -/* the TRAPS */ -# define TB1 BCND+1 -# define TB0 BCND+2 -# define TCND BCND+3 -# define RTE BCND+4 -# define TBND BCND+5 - -/* the MISC instructions */ -# define MUL TBND + 1 -# define DIV MUL +2 -# define DIVU MUL +3 -# define MASK MUL +4 -# define FF0 MUL +5 -# define FF1 MUL +6 -# define CLR MUL +7 -# define SET MUL +8 -# define EXT MUL +9 -# define EXTU MUL +10 -# define MAK MUL +11 -# define ROT MUL +12 - -/* control register manipulations */ - -# define LDCR ROT +1 -# define STCR ROT +2 -# define XCR ROT +3 - -# define FLDCR ROT +4 -# define FSTCR ROT +5 -# define FXCR ROT +6 - - -# define NOP XCR +1 - -/* floating point instructions */ - -# define FADD NOP +1 -# define FSUB NOP +2 -# define FMUL NOP +3 -# define FDIV NOP +4 -# define FSQRT NOP +5 -# define FCMP NOP +6 -# define FIP NOP +7 -# define FLT NOP +8 -# define INT NOP +9 -# define NINT NOP +10 -# define TRNC NOP +11 -# define FLDC NOP +12 -# define FSTC NOP +13 -# define FXC NOP +14 - -# define UEXT(src,off,wid) ((((unsigned int)(src))>>(off)) & ((1<<(wid)) - 1)) -# define SEXT(src,off,wid) (((((int)(src))<<(32-((off)+(wid)))) >>(32-(wid))) ) -# define MAKE(src,off,wid) \ - ((((unsigned int)(src)) & ((1<<(wid)) - 1)) << (off)) - -# define opword(n) (unsigned long) (memaddr->mem.l) - -/* Constants and Masks */ - -#define SFU0 0x80000000 -#define SFU1 0x84000000 -#define SFU7 0x9c000000 -#define RRI10 0xf0000000 -#define RRR 0xf4000000 -#define SFUMASK 0xfc00ffe0 -#define RRRMASK 0xfc00ffe0 -#define RRI10MASK 0xfc00fc00 -#define DEFMASK 0xfc000000 -#define CTRL 0x0000f000 -#define CTRLMASK 0xfc00f800 - -/* Operands types */ - -enum operand_type { - HEX = 1, - REG = 2, - CONT = 3, - IND = 3, - BF = 4, - REGSC = 5 /* scaled register */, - CRREG = 6 /* control register */, - FCRREG = 7 /* floating point control register */, - PCREL = 8, - CONDMASK = 9, - XREG = 10, /* extended register */ - DEC = 11, /* decimal */ -}; - -/* Hashing Specification */ - -#define HASHVAL 79 - -/* Type definitions */ - -typedef unsigned int UINT; - -/* Structure templates */ - -#if never -typedef struct { - unsigned int offset:5; - unsigned int width:6; - unsigned int type:5; -} OPSPEC; -#endif - -typedef struct { - unsigned int offset; - unsigned int width; - enum operand_type type; -} OPSPEC; - - struct SIM_FLAGS { - int ltncy, /* latency (max number of clocks needed to execute) */ - extime, /* execution time (min number of clocks needed to execute) */ - wb_pri; /* writeback slot priority */ - unsigned op:OP, /* simulator version of opcode */ - imm_flags:2, /* 10,16 or 26 bit immediate flags */ - rs1_used:1, /* register source 1 used */ - rs2_used:1, /* register source 2 used */ - rsd_used:1, /* register source/dest used */ - c_flag:1, /* complement */ - u_flag:1, /* upper half word */ - n_flag:1, /* execute next */ - wb_flag:1, /* uses writeback slot */ - dest_64:1, /* double precision dest */ - s1_64:1, /* double precision source 1 */ - s2_64:1, /* double precision source 2 */ - scale_flag:1; /* register is scaled */ -}; - -typedef struct INSTRUCTAB { - unsigned int opcode; - char *mnemonic; - OPSPEC op1,op2,op3; - struct SIM_FLAGS flgs; - struct INSTRUCTAB *next; -} INSTAB; - - -#define NO_OPERAND {0,0,0} - -/* Opcode Mnemonic Op 1 Spec Op 2 Spec Op 3 Spec Simflags Next */ - -static INSTAB instructions[] = { - {0xf400c800,"jsr ",{0,5,REG} ,NO_OPERAND ,NO_OPERAND , {2,2,NA,JSR , 0,0,1,0,0,0,0,1,0,0,0,0}, NULL }, - {0xf400cc00,"jsr.n ",{0,5,REG} ,NO_OPERAND ,NO_OPERAND , {1,1,NA,JSR , 0,0,1,0,0,0,1,1,0,0,0,0}, NULL }, - {0xf400c000,"jmp ",{0,5,REG} ,NO_OPERAND ,NO_OPERAND , {2,2,NA,JMP , 0,0,1,0,0,0,0,1,0,0,0,0}, NULL }, - {0xf400c400,"jmp.n ",{0,5,REG} ,NO_OPERAND ,NO_OPERAND , {1,1,NA,JMP , 0,0,1,0,0,0,1,1,0,0,0,0}, NULL }, - {0xc8000000,"bsr ",{0,26,PCREL},NO_OPERAND ,NO_OPERAND , {2,2,NA,BSR , i26bit,0,0,0,0,0,0,1,0,0,0,0}, NULL }, - {0xcc000000,"bsr.n ",{0,26,PCREL},NO_OPERAND ,NO_OPERAND , {1,1,NA,BSR , i26bit,0,0,0,0,0,1,1,0,0,0,0}, NULL }, - {0xc0000000,"br ",{0,26,PCREL},NO_OPERAND ,NO_OPERAND , {2,2,NA,BR , i26bit,0,0,0,0,0,0,1,0,0,0,0}, NULL }, - {0xc4000000,"br.n ",{0,26,PCREL},NO_OPERAND ,NO_OPERAND , {1,1,NA,BR , i26bit,0,0,0,0,0,1,1,0,0,0,0}, NULL }, - {0xd0000000,"bb0 ",{21,5,HEX} ,{16,5,REG} ,{0,16,PCREL},{2,2,NA,BB0, i16bit,0,1,0,0,0,0,1,0,0,0,0}, NULL }, - {0xd4000000,"bb0.n ",{21,5,HEX} ,{16,5,REG} ,{0,16,PCREL},{1,1,NA,BB0, i16bit,0,1,0,0,0,1,1,0,0,0,0}, NULL }, - {0xd8000000,"bb1 ",{21,5,HEX},{16,5,REG} ,{0,16,PCREL},{2,2,NA,BB1, i16bit,0,1,0,0,0,0,1,0,0,0,0}, NULL }, - {0xdc000000,"bb1.n ",{21,5,HEX},{16,5,REG} ,{0,16,PCREL},{1,1,NA,BB1, i16bit,0,1,0,0,0,1,1,0,0,0,0}, NULL }, - {0xf000d000,"tb0 ",{21,5,HEX} ,{16,5,REG} ,{0,10,HEX}, {2,2,NA,TB0 , i10bit,0,1,0,0,0,0,1,0,0,0,0}, NULL }, - {0xf000d800,"tb1 ",{21,5,HEX} ,{16,5,REG} ,{0,10,HEX}, {2,2,NA,TB1 , i10bit,0,1,0,0,0,0,1,0,0,0,0}, NULL }, - {0xe8000000,"bcnd ",{21,5,CONDMASK},{16,5,REG},{0,16,PCREL},{2,2,NA,BCND, i16bit,0,1,0,0,0,0,1,0,0,0,0}, NULL }, - {0xec000000,"bcnd.n ",{21,5,CONDMASK},{16,5,REG},{0,16,PCREL},{1,1,NA,BCND, i16bit,0,1,0,0,0,1,1,0,0,0,0}, NULL }, - {0xf000e800,"tcnd ",{21,5,CONDMASK},{16,5,REG},{0,10,HEX}, {2,2,NA,TCND, i10bit,0,1,0,0,0,0,1,0,0,0,0}, NULL }, - {0xf8000000,"tbnd ",{16,5,REG} ,{0,16,HEX} ,NO_OPERAND , {2,2,NA,TBND, i10bit,1,0,0,0,0,0,1,0,0,0,0}, NULL }, - {0xf400f800,"tbnd ",{16,5,REG} ,{0,5,REG} ,NO_OPERAND , {2,2,NA,TBND, 0,1,1,0,0,0,0,1,0,0,0,0}, NULL }, - {0xf400fc00,"rte ",NO_OPERAND ,NO_OPERAND ,NO_OPERAND , {2,2,NA,RTE , 0,0,0,0,0,0,0,1,0,0,0,0}, NULL }, - {0x1c000000,"ld.b ",{21,5,REG} ,{16,5,REG} ,{0,16,HEX}, {3,1,PMEM,LDB ,i16bit,1,0,1,0,0,0,1,0,0,0,0}, NULL }, - {0xf4001c00,"ld.b ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {3,1,PMEM,LDB , 0,1,1,1,0,0,0,1,0,0,0,0}, NULL }, - {0x0c000000,"ld.bu ",{21,5,REG} ,{16,5,REG} ,{0,16,HEX}, {3,1,PMEM,LDBU, i16bit,1,0,1,0,0,0,1,0,0,0,0}, NULL }, - {0xf4000c00,"ld.bu ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {3,1,PMEM,LDBU ,0,1,1,1,0,0,0,1,0,0,0,0}, NULL }, - {0x18000000,"ld.h ",{21,5,REG} ,{16,5,REG} ,{0,16,HEX}, {3,1,PMEM,LDH ,i16bit,1,0,1,0,0,0,1,0,0,0,0}, NULL }, - {0xf4001800,"ld.h ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {3,1,PMEM,LDH ,0,1,1,1,0,0,0,1,0,0,0,0}, NULL }, - {0xf4001a00,"ld.h ",{21,5,REG} ,{16,5,REG} ,{0,5,REGSC},{3,1,PMEM,LDH ,0,1,1,1,0,0,0,1,0,0,0,1}, NULL }, - {0x08000000,"ld.hu ",{21,5,REG} ,{16,5,REG} ,{0,16,HEX}, {3,1,PMEM,LDHU, i16bit,1,0,1,0,0,0,1,0,0,0,0}, NULL }, - {0xf4000800,"ld.hu ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {3,1,PMEM,LDHU ,0,1,1,1,0,0,0,1,0,0,0,0}, NULL }, - {0xf4000a00,"ld.hu ",{21,5,REG} ,{16,5,REG} ,{0,5,REGSC},{3,1,PMEM,LDHU ,0,1,1,1,0,0,0,1,0,0,0,1}, NULL }, - {0x14000000,"ld ",{21,5,REG} ,{16,5,REG} ,{0,16,HEX}, {3,1,PMEM,LD ,i16bit,1,0,1,0,0,0,1,0,0,0,0}, NULL }, - {0xf4001400,"ld ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {3,1,PMEM,LD ,0,1,1,1,0,0,0,1,0,0,0,0}, NULL }, - {0xf4001600,"ld ",{21,5,REG} ,{16,5,REG} ,{0,5,REGSC},{3,1,PMEM,LD ,0,1,1,1,0,0,0,1,0,0,0,1}, NULL }, - {0x10000000,"ld.d ",{21,5,REG} ,{16,5,REG} ,{0,16,HEX}, {3,1,PMEM,LDD ,i16bit,1,0,1,0,0,0,1,0,0,0,0}, NULL }, - {0xf4001000,"ld.d ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {3,1,PMEM,LDD ,0,1,1,1,0,0,0,1,0,0,0,0}, NULL }, - {0xf4001200,"ld.d ",{21,5,REG} ,{16,5,REG} ,{0,5,REGSC},{3,1,PMEM,LDD ,0,1,1,1,0,0,0,1,0,0,0,1}, NULL }, - {0xf4001500,"ld.usr ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {3,1,PMEM,LD ,0,1,1,1,0,0,0,1,0,0,0,0}, NULL }, - {0xf4001700,"ld.usr ",{21,5,REG} ,{16,5,REG} ,{0,5,REGSC},{3,1,PMEM,LD ,0,1,1,1,0,0,0,1,0,0,0,1}, NULL }, - {0x2c000000,"st.b ",{21,5,REG} ,{16,5,REG} ,{0,16,HEX}, {1,1,NA,STB ,i16bit,1,0,1,0,0,0,1,0,0,0,0}, NULL }, - {0xf4002c00,"st.b ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {1,1,NA,STB ,0,1,1,1,0,0,0,1,0,0,0,0}, NULL }, - {0x28000000,"st.h ",{21,5,REG} ,{16,5,REG} ,{0,16,HEX}, {1,1,NA,STH ,i16bit,1,0,1,0,0,0,1,0,0,0,0}, NULL }, - {0xf4002800,"st.h ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {1,1,NA,STH ,0,1,1,1,0,0,0,1,0,0,0,0}, NULL }, - {0xf4002a00,"st.h ",{21,5,REG} ,{16,5,REG} ,{0,5,REGSC},{1,1,NA,STH ,0,1,1,1,0,0,0,1,0,0,0,1}, NULL }, - {0x24000000,"st ",{21,5,REG} ,{16,5,REG} ,{0,16,HEX}, {1,1,NA,ST ,i16bit,1,0,1,0,0,0,1,0,0,0,0}, NULL }, - {0xf4002400,"st ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {1,1,NA,ST ,0,1,1,1,0,0,0,1,0,0,0,0} ,NULL }, - {0xf4002600,"st ",{21,5,REG} ,{16,5,REG} ,{0,5,REGSC},{1,1,NA,ST ,0,1,1,1,0,0,0,1,0,0,0,1} ,NULL }, - {0x20000000,"st.d ",{21,5,REG} ,{16,5,REG} ,{0,16,HEX}, {1,1,NA,STD ,i16bit,0,1,0,0,0,0,1,0,0,0,0} ,NULL }, - {0xf4002000,"st.d ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {1,1,NA,STD ,0,1,1,1,0,0,0,1,0,0,0,0} ,NULL }, - {0xf4002200,"st.d ",{21,5,REG} ,{16,5,REG} ,{0,5,REGSC},{1,1,NA,STD ,0,1,1,1,0,0,0,1,0,0,0,1} ,NULL }, - {0xf4002500,"st.usr ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {1,1,NA,ST ,0,1,1,1,0,0,0,1,0,0,0,0} ,NULL }, - {0xf4002700,"st.usr ",{21,5,REG} ,{16,5,REG} ,{0,5,REGSC},{1,1,NA,ST ,0,1,1,1,0,0,0,1,0,0,0,1} ,NULL }, -/* m88100 only: - {0x00000000,"xmem.bu ",{21,5,REG} ,{16,5,REG} ,{0,16,HEX}, {3,1,PMEM,XMEMBU ,i16bit,1,1,1,0,0,0,1,0,0,0,0} ,NULL }, - */ - {0xf4000000,"xmem.bu ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {3,1,PMEM,XMEM ,0,1,1,1,0,0,0,1,0,0,0,0} ,NULL }, -/* m88100 only: - {0x04000000,"xmem ",{21,5,REG} ,{16,5,REG} ,{0,16,HEX}, {3,1,PMEM,XMEM ,i16bit,1,1,1,0,0,0,1,0,0,0,0} ,NULL }, - */ - {0xf4000400,"xmem ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {3,1,PMEM,XMEM ,0,1,1,1,0,0,0,1,0,0,0,0} ,NULL }, - {0xf4000600,"xmem ",{21,5,REG} ,{16,5,REG} ,{0,5,REGSC},{3,1,PMEM,XMEM ,0,1,1,1,0,0,0,1,0,0,0,1} ,NULL }, - {0xf4000500,"xmem.usr ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {3,1,PMEM,XMEM ,0,1,1,1,0,0,0,1,0,0,0,0} ,NULL }, - {0xf4000700,"xmem.usr ",{21,5,REG} ,{16,5,REG} ,{0,5,REGSC},{3,1,PMEM,XMEM ,0,1,1,1,0,0,0,1,0,0,0,1} ,NULL }, -/* m88100 only: - {0xf4003e00,"lda.b ",{21,5,REG} ,{16,5,REG} ,{0,5,REGSC},{1,1,PINT,LDAH, 0,1,1,1,0,0,0,0,0,0,0,1} ,NULL }, - */ - {0xf4003e00,"lda.x ",{21,5,REG} ,{16,5,REG} ,{0,5,REGSC},{1,1,PINT,LDAH, 0,1,1,1,0,0,0,0,0,0,0,1} ,NULL }, - {0xf4003a00,"lda.h ",{21,5,REG} ,{16,5,REG} ,{0,5,REGSC},{1,1,PINT,LDAH, 0,1,1,1,0,0,0,0,0,0,0,1} ,NULL }, - {0xf4003600,"lda ",{21,5,REG} ,{16,5,REG} ,{0,5,REGSC},{1,1,PINT,LDA , 0,1,1,1,0,0,0,0,0,0,0,1} ,NULL }, - {0xf4003200,"lda.d ",{21,5,REG} ,{16,5,REG} ,{0,5,REGSC},{1,1,PINT,LDAD, 0,1,1,1,0,0,0,0,0,0,0,1} ,NULL }, - - {0x80004000,"ldcr ",{21,5,REG} ,{5,6,CRREG} ,NO_OPERAND ,{1,1,PINT,LDCR, 0,1,1,1,0,0,0,0,0,0,0,0} ,NULL }, - {0x80008000,"stcr ",{16,5,REG} ,{5,6,CRREG} ,NO_OPERAND ,{1,1,PINT,STCR, 0,1,1,1,0,0,0,0,0,0,0,0} ,NULL }, - {0x8000c000,"xcr ",{21,5,REG} ,{16,5,REG} ,{5,6,CRREG},{1,1,PINT,XCR, 0,1,1,1,0,0,0,0,0,0,0,0} ,NULL }, - - {0xf4006000,"addu ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {1,1,PINT,ADDU, 0,1,1,1,0,0,0,0,0,0,0,0} ,NULL }, - {0xf4006200,"addu.ci ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {1,1,PINT,ADDU, 0,1,1,1,0,0,0,0,0,0,0,0} ,NULL }, - {0xf4006100,"addu.co ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {1,1,PINT,ADDU, 0,1,1,1,0,0,0,0,0,0,0,0} ,NULL }, - {0xf4006300,"addu.cio ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {1,1,PINT,ADDU, 0,1,1,1,0,0,0,0,0,0,0,0} ,NULL }, - {0xf4006400,"subu ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {1,1,PINT,SUBU, 0,1,1,1,0,0,0,0,0,0,0,0} ,NULL }, - {0xf4006600,"subu.ci ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {1,1,PINT,SUBU, 0,1,1,1,0,0,0,0,0,0,0,0} ,NULL }, - {0xf4006500,"subu.co ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {1,1,PINT,SUBU, 0,1,1,1,0,0,0,0,0,0,0,0} ,NULL }, - {0xf4006700,"subu.cio ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {1,1,PINT,SUBU, 0,1,1,1,0,0,0,0,0,0,0,0} ,NULL }, - {0xf4006800,"divu ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {32,32,PINT,DIVU, 0,1,1,1,0,0,0,0,0,0,0,0} ,NULL }, - {0xf4006900,"divu.d ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,}, NULL }, - {0xf4006e00,"muls ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,}, NULL }, - {0xf4006c00,"mulu ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {1,4,PINT,MUL, 0,1,1,1,0,0,0,0,0,0,0,0} ,NULL }, - {0xf4007000,"add ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {1,1,PINT,ADD , 0,1,1,1,0,0,0,0,0,0,0,0} ,NULL }, - {0xf4007200,"add.ci ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {1,1,PINT,ADD , 0,1,1,1,0,0,0,0,0,0,0,0} ,NULL }, - {0xf4007100,"add.co ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {1,1,PINT,ADD , 0,1,1,1,0,0,0,0,0,0,0,0} ,NULL }, - {0xf4007300,"add.cio ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {1,1,PINT,ADD , 0,1,1,1,0,0,0,0,0,0,0,0} ,NULL }, - {0xf4007400,"sub ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {1,1,PINT,SUB , 0,1,1,1,0,0,0,0,0,0,0,0} ,NULL }, - {0xf4007600,"sub.ci ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {1,1,PINT,SUB , 0,1,1,1,0,0,0,0,0,0,0,0} ,NULL }, - {0xf4007500,"sub.co ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {1,1,PINT,SUB , 0,1,1,1,0,0,0,0,0,0,0,0} ,NULL }, - {0xf4007700,"sub.cio ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {1,1,PINT,SUB , 0,1,1,1,0,0,0,0,0,0,0,0} ,NULL }, - {0xf4007800,"divs ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {32,32,PINT,DIV , 0,1,1,1,0,0,0,0,0,0,0,0} ,NULL }, - {0xf4007c00,"cmp ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {1,1,PINT,CMP, 0,1,1,1,0,0,0,0,0,0,0,0} ,NULL }, - - {0x60000000,"addu ",{21,5,REG} ,{16,5,REG} ,{0,16,HEX}, {1,1,PINT,ADDU, i16bit,1,0,1,0,0,0,0,0,0,0,0} ,NULL }, - {0x64000000,"subu ",{21,5,REG} ,{16,5,REG} ,{0,16,HEX}, {1,1,PINT,SUBU, i16bit,1,0,1,0,0,0,0,0,0,0,0} ,NULL }, - - {0x68000000,"divu ",{21,5,REG} ,{16,5,REG} ,{0,16,HEX}, {32,32,PINT,DIVU, i16bit,1,0,1,0,0,0,0,0,0,0,0} ,NULL }, - {0x6c000000,"mulu ",{21,5,REG} ,{16,5,REG} ,{0,16,HEX}, {4,1,PINT,MUL, i16bit,1,0,1,0,0,0,0,0,0,0,0} ,NULL }, - {0x70000000,"add ",{21,5,REG} ,{16,5,REG} ,{0,16,HEX}, {1,1,PINT,ADD, i16bit,1,0,1,0,0,0,0,0,0,0,0} ,NULL }, - {0x74000000,"sub ",{21,5,REG} ,{16,5,REG} ,{0,16,HEX}, {1,1,PINT,SUB, i16bit,1,0,1,0,0,0,0,0,0,0,0} ,NULL }, - {0x78000000,"divs ",{21,5,REG} ,{16,5,REG} ,{0,16,HEX}, {32,32,PINT,DIV, i16bit,1,0,1,0,0,0,0,0,0,0,0} ,NULL }, - {0x7c000000,"cmp ",{21,5,REG} ,{16,5,REG} ,{0,16,HEX}, {1,1,PINT,CMP, i16bit,1,0,1,0,0,0,0,0,0,0,0} ,NULL }, - - {0xf4004000,"and ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {1,1,PINT,AND_ ,0,1,1,1,0,0,0,0,0,0,0,0} ,NULL }, - {0xf4004400,"and.c ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {1,1,PINT,AND_ ,0,1,1,1,1,0,0,0,0,0,0,0} ,NULL }, - {0xf4005800,"or ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {1,1,PINT,OR ,0,1,1,1,0,0,0,0,0,0,0,0} ,NULL }, - {0xf4005c00,"or.c ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {1,1,PINT,OR ,0,1,1,1,1,0,0,0,0,0,0,0} ,NULL }, - {0xf4005000,"xor ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {1,1,PINT,XOR ,0,1,1,1,0,0,0,0,0,0,0,0} ,NULL }, - {0xf4005400,"xor.c ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {1,1,PINT,XOR ,0,1,1,1,1,0,0,0,0,0,0,0} ,NULL }, - {0x40000000,"and ",{21,5,REG} ,{16,5,REG} ,{0,16,HEX}, {1,1,PINT,AND_ ,i16bit,1,0,1,0,0,0,0,0,0,0,0} ,NULL }, - {0x44000000,"and.u ",{21,5,REG} ,{16,5,REG} ,{0,16,HEX}, {1,1,PINT,AND_ ,i16bit,1,0,1,0,1,0,0,0,0,0,0} ,NULL }, - {0x58000000,"or ",{21,5,REG} ,{16,5,REG} ,{0,16,HEX}, {1,1,PINT,OR ,i16bit,1,0,1,0,0,0,0,0,0,0,0} ,NULL }, - {0x5c000000,"or.u ",{21,5,REG} ,{16,5,REG} ,{0,16,HEX}, {1,1,PINT,OR ,i16bit,1,0,1,0,1,0,0,0,0,0,0} ,NULL }, - {0x50000000,"xor ",{21,5,REG} ,{16,5,REG} ,{0,16,HEX}, {1,1,PINT,XOR ,i16bit,1,0,1,0,0,0,0,0,0,0,0} ,NULL }, - {0x54000000,"xor.u ",{21,5,REG} ,{16,5,REG} ,{0,16,HEX}, {1,1,PINT,XOR ,i16bit,1,0,1,0,1,0,0,0,0,0,0} ,NULL }, - {0x48000000,"mask ",{21,5,REG} ,{16,5,REG} ,{0,16,HEX}, {1,1,PINT,MASK ,i16bit,1,0,1,0,0,0,0,0,0,0,0} ,NULL }, - {0x4c000000,"mask.u ",{21,5,REG} ,{16,5,REG} ,{0,16,HEX}, {1,1,PINT,MASK ,i16bit,1,0,1,0,1,0,0,0,0,0,0} ,NULL }, - {0xf400ec00,"ff0 ",{21,5,REG} ,{0,5,REG} ,NO_OPERAND , {1,1,PINT,FF0 ,0,0,1,1,0,0,0,0,0,0,0,0} ,NULL }, - {0xf400e800,"ff1 ",{21,5,REG} ,{0,5,REG} ,NO_OPERAND , {1,1,PINT,FF1 ,0,0,1,1,0,0,0,0,0,0,0,0} ,NULL }, - {0xf0008000,"clr ",{21,5,REG} ,{16,5,REG} ,{0,10,BF} , {1,1,PINT,CLR ,i10bit,1,0,1,0,0,0,0,0,0,0,0} ,NULL }, - {0xf0008800,"set ",{21,5,REG} ,{16,5,REG} ,{0,10,BF} , {1,1,PINT,SET ,i10bit,1,0,1,0,0,0,0,0,0,0,0} ,NULL }, - {0xf0009000,"ext ",{21,5,REG} ,{16,5,REG} ,{0,10,BF} , {1,1,PINT,EXT ,i10bit,1,0,1,0,0,0,0,0,0,0,0} ,NULL }, - {0xf0009800,"extu ",{21,5,REG} ,{16,5,REG} ,{0,10,BF} , {1,1,PINT,EXTU ,i10bit,1,0,1,0,0,0,0,0,0,0,0} ,NULL }, - {0xf000a000,"mak ",{21,5,REG} ,{16,5,REG} ,{0,10,BF} , {1,1,PINT,MAK ,i10bit,1,0,1,0,0,0,0,0,0,0,0} ,NULL }, - {0xf000a800,"rot ",{21,5,REG} ,{16,5,REG} ,{0,10,BF} , {1,1,PINT,ROT ,i10bit,1,0,1,0,0,0,0,0,0,0,0} ,NULL }, - {0xf4008000,"clr ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {1,1,PINT,CLR ,0,1,1,1,0,0,0,0,0,0,0,0} ,NULL }, - {0xf4008800,"set ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {1,1,PINT,SET ,0,1,1,1,0,0,0,0,0,0,0,0} ,NULL }, - {0xf4009000,"ext ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {1,1,PINT,EXT ,0,1,1,1,0,0,0,0,0,0,0,0} ,NULL }, - {0xf4009800,"extu ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {1,1,PINT,EXTU ,0,1,1,1,0,0,0,0,0,0,0,0} ,NULL }, - {0xf400a000,"mak ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {1,1,PINT,MAK ,0,1,1,1,0,0,0,0,0,0,0,0} ,NULL }, - {0xf400a800,"rot ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {1,1,PINT,ROT ,0,1,1,1,0,0,0,0,0,0,0,0} ,NULL }, - - {0x84002800,"fadd.sss ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {5,1,PFLT,FADD ,0,1,1,1,0,0,0,1,0,0,0,0} ,NULL }, - {0x84002880,"fadd.ssd ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {6,2,PFLT,FADD ,0,1,1,1,0,0,0,1,0,0,1,0} ,NULL }, - {0x84002a00,"fadd.sds ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {6,2,PFLT,FADD ,0,1,1,1,0,0,0,1,0,1,0,0} ,NULL }, - {0x84002a80,"fadd.sdd ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {6,2,PFLT,FADD ,0,1,1,1,0,0,0,1,0,1,1,0} ,NULL }, - {0x84002820,"fadd.dss ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {6,2,PFLT,FADD ,0,1,1,1,0,0,0,1,1,0,0,0} ,NULL }, - {0x840028a0,"fadd.dsd ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {6,2,PFLT,FADD ,0,1,1,1,0,0,0,1,1,0,1,0} ,NULL }, - {0x84002a20,"fadd.dds ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {6,2,PFLT,FADD ,0,1,1,1,0,0,0,1,1,1,0,0} ,NULL }, - {0x84002aa0,"fadd.ddd ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {6,2,PFLT,FADD ,0,1,1,1,0,0,0,1,1,1,1,0} ,NULL }, - {0x84003000,"fsub.sss ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {5,1,PFLT,FSUB ,0,1,1,1,0,0,0,1,0,0,0,0} ,NULL }, - {0x84003080,"fsub.ssd ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {6,2,PFLT,FSUB ,0,1,1,1,0,0,0,1,0,0,1,0} ,NULL }, - {0x84003200,"fsub.sds ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {6,2,PFLT,FSUB ,0,1,1,1,0,0,0,1,0,1,0,0} ,NULL }, - {0x84003280,"fsub.sdd ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {6,2,PFLT,FSUB ,0,1,1,1,0,0,0,1,0,1,1,0} ,NULL }, - {0x84003020,"fsub.dss ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {6,2,PFLT,FSUB ,0,1,1,1,0,0,0,1,1,0,0,0} ,NULL }, - {0x840030a0,"fsub.dsd ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {6,2,PFLT,FSUB ,0,1,1,1,0,0,0,1,1,0,1,0} ,NULL }, - {0x84003220,"fsub.dds ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {6,2,PFLT,FSUB ,0,1,1,1,0,0,0,1,1,1,0,0} ,NULL }, - {0x840032a0,"fsub.ddd ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {6,2,PFLT,FSUB ,0,1,1,1,0,0,0,1,1,1,1,0} ,NULL }, - {0x84000000,"fmul.sss ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {6,1,PFLT,FMUL ,0,1,1,1,0,0,0,1,0,0,0,0} ,NULL }, - {0x84000080,"fmul.ssd ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {9,2,PFLT,FMUL ,0,1,1,1,0,0,0,1,0,0,1,0} ,NULL }, - {0x84000200,"fmul.sds ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {9,2,PFLT,FMUL ,0,1,1,1,0,0,0,1,0,1,0,0} ,NULL }, - {0x84000280,"fmul.sdd ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {9,2,PFLT,FMUL ,0,1,1,1,0,0,0,1,0,1,1,0} ,NULL }, - {0x84000020,"fmul.dss ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {9,2,PFLT,FMUL ,0,1,1,1,0,0,0,1,1,0,0,0} ,NULL }, - {0x840000a0,"fmul.dsd ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {9,2,PFLT,FMUL ,0,1,1,1,0,0,0,1,1,0,1,0} ,NULL }, - {0x84000220,"fmul.dds ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {9,2,PFLT,FMUL ,0,1,1,1,0,0,0,1,1,1,0,0} ,NULL }, - {0x840002a0,"fmul.ddd ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {9,2,PFLT,FMUL ,0,1,1,1,0,0,0,1,1,1,1,0} ,NULL }, - {0x84007000,"fdiv.sss ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {30,30,PFLT,FDIV ,0,1,1,1,0,0,0,1,0,0,0,0} ,NULL }, - {0x84007080,"fdiv.ssd ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {60,60,PFLT,FDIV ,0,1,1,1,0,0,0,1,0,0,1,0} ,NULL }, - {0x84007200,"fdiv.sds ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {60,60,PFLT,FDIV ,0,1,1,1,0,0,0,1,0,1,0,0} ,NULL }, - {0x84007280,"fdiv.sdd ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {60,60,PFLT,FDIV ,0,1,1,1,0,0,0,1,0,1,1,0} ,NULL }, - {0x84007020,"fdiv.dss ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {60,60,PFLT,FDIV ,0,1,1,1,0,0,0,1,1,0,0,0} ,NULL }, - {0x840070a0,"fdiv.dsd ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {60,60,PFLT,FDIV ,0,1,1,1,0,0,0,1,1,0,1,0} ,NULL }, - {0x84007220,"fdiv.dds ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {60,60,PFLT,FDIV ,0,1,1,1,0,0,0,1,1,1,0,0} ,NULL }, - {0x840072a0,"fdiv.ddd ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {60,60,PFLT,FDIV ,0,1,1,1,0,0,0,1,1,1,1,0} ,NULL }, - {0x84007800,"fsqrt.ss ",{21,5,REG} ,{0,5,REG} ,NO_OPERAND , {5,1,PFLT,FLT ,0,0,1,1,0,0,0,1,0,0,0,0} ,NULL }, - {0x84007820,"fsqrt.sd ",{21,5,REG} ,{0,5,REG} ,NO_OPERAND , {5,1,PFLT,FLT ,0,0,1,1,0,0,0,1,0,0,0,0} ,NULL }, - {0x84007880,"fsqrt.ds ",{21,5,REG} ,{0,5,REG} ,NO_OPERAND , {5,1,PFLT,FLT ,0,0,1,1,0,0,0,1,0,0,0,0} ,NULL }, - {0x840078a0,"fsqrt.dd ",{21,5,REG} ,{0,5,REG} ,NO_OPERAND , {6,1,PFLT,FLT ,0,0,1,1,0,0,0,1,1,0,0,0} ,NULL }, - {0x84003800,"fcmp.ss ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {5,1,PFLT,FCMP ,0,1,1,1,0,0,0,1,0,0,0,0} ,NULL }, - {0x84003880,"fcmp.sd ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {6,1,PFLT,FCMP ,0,1,1,1,0,0,0,1,0,1,0,0} ,NULL }, - {0x84003a00,"fcmp.ds ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {6,1,PFLT,FCMP ,0,1,1,1,0,0,0,1,1,0,0,0} ,NULL }, - {0x84003a80,"fcmp.dd ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {6,1,PFLT,FCMP ,0,1,1,1,0,0,0,1,1,1,0,0} ,NULL }, - {0x84002000,"flt.s ",{21,5,REG} ,{0,5,REG} ,NO_OPERAND , {5,1,PFLT,FLT ,0,0,1,1,0,0,0,1,0,0,0,0} ,NULL }, - {0x84002020,"flt.d ",{21,5,REG} ,{0,5,REG} ,NO_OPERAND , {6,1,PFLT,FLT ,0,0,1,1,0,0,0,1,1,0,0,0} ,NULL }, - {0x84004800,"int.s ",{21,5,REG} ,{0,5,REG} ,NO_OPERAND , {5,1,PFLT,INT ,0,0,1,1,0,0,0,1,0,0,0,0} ,NULL }, - {0x84004880,"int.d ",{21,5,REG} ,{0,5,REG} ,NO_OPERAND , {6,1,PFLT,INT ,0,0,1,1,0,0,0,1,1,0,0,0} ,NULL }, - {0x84005000,"nint.s ",{21,5,REG} ,{0,5,REG} ,NO_OPERAND , {5,1,PFLT,INT ,0,0,1,1,0,0,0,1,0,0,0,0} ,NULL }, - {0x84005080,"nint.d ",{21,5,REG} ,{0,5,REG} ,NO_OPERAND , {6,1,PFLT,INT ,0,0,1,1,0,0,0,1,1,0,0,0} ,NULL }, - {0x84005800,"trnc.s ",{21,5,REG} ,{0,5,REG} ,NO_OPERAND , {5,1,PFLT,TRNC ,0,0,1,1,0,0,0,1,0,0,0,0} ,NULL }, - {0x84005880,"trnc.d ",{21,5,REG} ,{0,5,REG} ,NO_OPERAND , {6,1,PFLT,TRNC ,0,0,1,1,0,0,0,1,1,0,0,0} ,NULL }, - - {0x80004800,"fldcr ",{21,5,REG} ,{5,6,FCRREG} ,NO_OPERAND , {1,1,PFLT,FLDC ,0,0,1,1,0,0,0,1,0,0,0,0} ,NULL }, - {0x80008800,"fstcr ",{16,5,REG} ,{5,6,FCRREG} ,NO_OPERAND , {1,1,PFLT,FSTC ,0,0,1,1,0,0,0,1,0,0,0,0} ,NULL }, - {0x8000c800,"fxcr ",{21,5,REG} ,{16,5,REG} ,{5,6,FCRREG} , {1,1,PFLT,FXC ,0,0,1,1,0,0,0,1,0,0,0,0} ,NULL }, - -/* The following are new for the 88110. */ - - {0x8400aaa0,"fadd.ddd ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400aa80,"fadd.dds ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400aac0,"fadd.ddx ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400aa20,"fadd.dsd ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400aa00,"fadd.dss ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400aa40,"fadd.dsx ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400ab20,"fadd.dxd ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400ab00,"fadd.dxs ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400ab40,"fadd.dxx ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400a8a0,"fadd.sdd ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400a880,"fadd.sds ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400a8c0,"fadd.sdx ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400a820,"fadd.ssd ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400a800,"fadd.sss ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400a840,"fadd.ssx ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400a920,"fadd.sxd ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400a900,"fadd.sxs ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400a940,"fadd.sxx ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400aca0,"fadd.xdd ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400ac80,"fadd.xds ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400acc0,"fadd.xdx ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400ac20,"fadd.xsd ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400ac00,"fadd.xss ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400ac40,"fadd.xsx ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400ad20,"fadd.xxd ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400ad00,"fadd.xxs ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400ad40,"fadd.xxx ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - - {0x8400ba80,"fcmp.sdd ",{21,5,REG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400ba00,"fcmp.sds ",{21,5,REG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400bb00,"fcmp.sdx ",{21,5,REG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400b880,"fcmp.ssd ",{21,5,REG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400b800,"fcmp.sss ",{21,5,REG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400b900,"fcmp.ssx ",{21,5,REG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400bc80,"fcmp.sxd ",{21,5,REG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400bc00,"fcmp.sxs ",{21,5,REG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400bd00,"fcmp.sxx ",{21,5,REG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - - {0x8400baa0,"fcmpu.sdd ",{21,5,REG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400ba20,"fcmpu.sds ",{21,5,REG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400bb20,"fcmpu.sdx ",{21,5,REG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400b8a0,"fcmpu.ssd ",{21,5,REG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400b820,"fcmpu.sss ",{21,5,REG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400b920,"fcmpu.ssx ",{21,5,REG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400bca0,"fcmpu.sxd ",{21,5,REG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400bc20,"fcmpu.sxs ",{21,5,REG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400bd20,"fcmpu.sxx ",{21,5,REG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - - {0x84000820,"fcvt.sd ",{21,5,REG} ,{0,5,REG} ,NO_OPERAND, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x84000880,"fcvt.ds ",{21,5,REG} ,{0,5,REG} ,NO_OPERAND, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - - {0x84008880,"fcvt.ds ",{21,5,XREG} ,{0,5,XREG} ,NO_OPERAND, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x840088c0,"fcvt.dx ",{21,5,XREG} ,{0,5,XREG} ,NO_OPERAND, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x84008820,"fcvt.sd ",{21,5,XREG} ,{0,5,XREG} ,NO_OPERAND, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x84008840,"fcvt.sx ",{21,5,XREG} ,{0,5,XREG} ,NO_OPERAND, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x84008920,"fcvt.xd ",{21,5,XREG} ,{0,5,XREG} ,NO_OPERAND, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x84008900,"fcvt.xs ",{21,5,XREG} ,{0,5,XREG} ,NO_OPERAND, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - - {0x8400f2a0,"fdiv.ddd ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400f280,"fdiv.dds ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400f2c0,"fdiv.ddx ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400f220,"fdiv.dsd ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400f200,"fdiv.dss ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400f240,"fdiv.dsx ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400f320,"fdiv.dxd ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400f300,"fdiv.dxs ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400f340,"fdiv.dxx ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400f0a0,"fdiv.sdd ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400f080,"fdiv.sds ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400f0c0,"fdiv.sdx ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400f020,"fdiv.ssd ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400f000,"fdiv.sss ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400f040,"fdiv.ssx ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400f120,"fdiv.sxd ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400f100,"fdiv.sxs ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400f140,"fdiv.sxx ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400f4a0,"fdiv.xdd ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400f480,"fdiv.xds ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400f4c0,"fdiv.xdx ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400f420,"fdiv.xsd ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400f400,"fdiv.xss ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400f440,"fdiv.xsx ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400f520,"fdiv.xxd ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400f500,"fdiv.xxs ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400f540,"fdiv.xxx ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - - {0x84002220,"flt.ds ",{21,5,XREG} ,{0,5,REG} ,NO_OPERAND, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x84002200,"flt.ss ",{21,5,XREG} ,{0,5,REG} ,NO_OPERAND, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x84002240,"flt.xs ",{21,5,XREG} ,{0,5,REG} ,NO_OPERAND, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - - {0x840082a0,"fmul.ddd ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x84008280,"fmul.dds ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x840082c0,"fmul.ddx ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x84008220,"fmul.dsd ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x84008200,"fmul.dss ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x84008240,"fmul.dsx ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x84008320,"fmul.dxd ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x84008300,"fmul.dxs ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x84008340,"fmul.dxx ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x840080a0,"fmul.sdd ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x84008080,"fmul.sds ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x840080c0,"fmul.sdx ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x84008020,"fmul.ssd ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x84008000,"fmul.sss ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x84008040,"fmul.ssx ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x84008120,"fmul.sxd ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x84008100,"fmul.sxs ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x84008140,"fmul.sxx ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x840084a0,"fmul.xdd ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x84008480,"fmul.xds ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x840084c0,"fmul.xdx ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x84008420,"fmul.xsd ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x84008400,"fmul.xss ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x84008440,"fmul.xsx ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x84008520,"fmul.xxd ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x84008500,"fmul.xxs ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x84008540,"fmul.xxx ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - - {0x8400f8a0,"fsqrt.dd ",{21,5,XREG}, {0,5,XREG}, NO_OPERAND, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400f880,"fsqrt.ds ",{21,5,XREG}, {0,5,XREG}, NO_OPERAND, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400f8c0,"fsqrt.dx ",{21,5,XREG}, {0,5,XREG}, NO_OPERAND, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400f820,"fsqrt.sd ",{21,5,XREG}, {0,5,XREG}, NO_OPERAND, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400f800,"fsqrt.ss ",{21,5,XREG}, {0,5,XREG}, NO_OPERAND, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400f840,"fsqrt.sx ",{21,5,XREG}, {0,5,XREG}, NO_OPERAND, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400f920,"fsqrt.xd ",{21,5,XREG}, {0,5,XREG}, NO_OPERAND, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400f900,"fsqrt.xs ",{21,5,XREG}, {0,5,XREG}, NO_OPERAND, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400f940,"fsqrt.xx ",{21,5,XREG}, {0,5,XREG}, NO_OPERAND, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - - {0x8400b2a0,"fsub.ddd ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400b280,"fsub.dds ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400b2c0,"fsub.ddx ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400b220,"fsub.dsd ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400b200,"fsub.dss ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400b240,"fsub.dsx ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400b320,"fsub.dxd ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400b300,"fsub.dxs ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400b340,"fsub.dxx ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400b0a0,"fsub.sdd ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400b080,"fsub.sds ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400b0c0,"fsub.sdx ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400b020,"fsub.ssd ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400b000,"fsub.sss ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400b040,"fsub.ssx ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400b120,"fsub.sxd ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400b100,"fsub.sxs ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400b140,"fsub.sxx ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400b4a0,"fsub.xdd ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400b480,"fsub.xds ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400b4c0,"fsub.xdx ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400b420,"fsub.xsd ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400b400,"fsub.xss ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400b440,"fsub.xsx ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400b520,"fsub.xxd ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400b500,"fsub.xxs ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400b540,"fsub.xxx ",{21,5,XREG} ,{16,5,XREG} ,{0,5,XREG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - - {0x8400fc00,"illop", {0,2,DEC}, NO_OPERAND, NO_OPERAND, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - - {0x8400c800,"int.ss ", {21,5,REG}, {0,5,XREG}, NO_OPERAND, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400c880,"int.sd ", {21,5,REG}, {0,5,XREG}, NO_OPERAND, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400c900,"int.sx ", {21,5,REG}, {0,5,XREG}, NO_OPERAND, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - - {0x04000000,"ld ", {21,5,XREG}, {16,5,REG}, {0,16,HEX}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x00000000,"ld.d ", {21,5,XREG}, {16,5,REG}, {0,16,HEX}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x3c000000,"ld.x ", {21,5,XREG}, {16,5,REG}, {0,16,HEX}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - - {0xf0001400,"ld ", {21,5,XREG}, {16,5,REG}, {0,5,REG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0xf0001000,"ld.d ", {21,5,XREG}, {16,5,REG}, {0,5,REG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0xf0001800,"ld.x ", {21,5,XREG}, {16,5,REG}, {0,5,REG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0xf0001500,"ld.usr ", {21,5,XREG}, {16,5,REG}, {0,5,REG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0xf0001100,"ld.d.usr ", {21,5,XREG}, {16,5,REG}, {0,5,REG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0xf0001900,"ld.x.usr ", {21,5,XREG}, {16,5,REG}, {0,5,REG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - - {0xf0001600,"ld ", {21,5,XREG}, {16,5,REG}, {0,5,REGSC}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0xf0001200,"ld.d ", {21,5,XREG}, {16,5,REG}, {0,5,REGSC}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0xf0001a00,"ld.x ", {21,5,XREG}, {16,5,REG}, {0,5,REGSC}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0xf0001700,"ld.usr ", {21,5,XREG}, {16,5,REG}, {0,5,REGSC}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0xf0001300,"ld.d.usr ", {21,5,XREG}, {16,5,REG}, {0,5,REGSC}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0xf0001b00,"ld.x.usr ", {21,5,XREG}, {16,5,REG}, {0,5,REGSC}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - - {0x8400c000,"mov.s ", {21,5,REG}, {0,5,XREG}, NO_OPERAND, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400c080,"mov.d ", {21,5,REG}, {0,5,XREG}, NO_OPERAND, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x84004200,"mov.s ", {21,5,XREG}, {0,5,REG}, NO_OPERAND, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x84004280,"mov.d ", {21,5,XREG}, {0,5,REG}, NO_OPERAND, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400c300,"mov ", {21,5,XREG}, {0,5,XREG}, NO_OPERAND, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - - {0xf4006d00,"mulu.d ", {21,5,REG}, {16,5,REG}, {0,5,REG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - - {0x8400d080,"nint.sd ", {21,5,REG}, {0,5,XREG}, NO_OPERAND, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400d000,"nint.ss ", {21,5,REG}, {0,5,XREG}, NO_OPERAND, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400d100,"nint.sx ", {21,5,REG}, {0,5,XREG}, NO_OPERAND, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - - {0x88002020,"padd.b ", {21,5,REG}, {16,5,REG}, {0,5,REG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x88002040,"padd.h ", {21,5,REG}, {16,5,REG}, {0,5,REG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x88002060,"padd ", {21,5,REG}, {16,5,REG}, {0,5,REG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - - {0x880021e0,"padds.s ", {21,5,REG}, {16,5,REG}, {0,5,REG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x880021a0,"padds.s.b ", {21,5,REG}, {16,5,REG}, {0,5,REG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x880021c0,"padds.s.h ", {21,5,REG}, {16,5,REG}, {0,5,REG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x880020e0,"padds.u ", {21,5,REG}, {16,5,REG}, {0,5,REG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x880020a0,"padds.u.b ", {21,5,REG}, {16,5,REG}, {0,5,REG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x880020c0,"padds.u.h ", {21,5,REG}, {16,5,REG}, {0,5,REG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x88002160,"padds.us ", {21,5,REG}, {16,5,REG}, {0,5,REG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x88002120,"padds.us.b ", {21,5,REG}, {16,5,REG}, {0,5,REG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x88002140,"padds.us.h ", {21,5,REG}, {16,5,REG}, {0,5,REG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - - {0x88003860,"pcmp ", {21,5,REG}, {16,5,REG}, {0,5,REG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - - {0x88000000,"pmul ", {21,5,REG}, {16,5,REG}, {0,5,REG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - - {0x88006260,"ppack.16 ", {21,5,REG}, {16,5,REG}, {0,5,REG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x88006240,"ppack.16.h ", {21,5,REG}, {16,5,REG}, {0,5,REG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x88006460,"ppack.32 ", {21,5,REG}, {16,5,REG}, {0,5,REG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x88006420,"ppack.32.b ", {21,5,REG}, {16,5,REG}, {0,5,REG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x88006440,"ppack.32.h ", {21,5,REG}, {16,5,REG}, {0,5,REG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x88006160,"ppack.8 ", {21,5,REG}, {16,5,REG}, {0,5,REG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - - {0x88007200,"prot ", {21,5,REG}, {16,5,REG}, {5,6,HEX}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x88007800,"prot ", {21,5,REG}, {16,5,REG}, {0,5,REG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - - {0x88003020,"psub.b ", {21,5,REG}, {16,5,REG}, {0,5,REG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x88003040,"psub.h ", {21,5,REG}, {16,5,REG}, {0,5,REG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x88003060,"psub ", {21,5,REG}, {16,5,REG}, {0,5,REG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - - {0x880031e0,"psubs.s ", {21,5,REG}, {16,5,REG}, {0,5,REG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x880031a0,"psubs.s.b ", {21,5,REG}, {16,5,REG}, {0,5,REG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x880031c0,"psubs.s.h ", {21,5,REG}, {16,5,REG}, {0,5,REG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x880030e0,"psubs.u ", {21,5,REG}, {16,5,REG}, {0,5,REG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x880030a0,"psubs.u.b ", {21,5,REG}, {16,5,REG}, {0,5,REG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x880030c0,"psubs.u.h ", {21,5,REG}, {16,5,REG}, {0,5,REG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x88003160,"psubs.us ", {21,5,REG}, {16,5,REG}, {0,5,REG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x88003120,"psubs.us.b ", {21,5,REG}, {16,5,REG}, {0,5,REG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x88003140,"psubs.us.h ", {21,5,REG}, {16,5,REG}, {0,5,REG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - - {0x88006800,"punpk.n ", {21,5,REG}, {16,5,REG}, NO_OPERAND, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x88006820,"punpk.b ", {21,5,REG}, {16,5,REG}, NO_OPERAND, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - - {0x34000000,"st ", {21,5,XREG}, {16,5,REG}, {0,16,HEX}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x30000000,"st.d ", {21,5,XREG}, {16,5,REG}, {0,16,HEX}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x38000000,"st.x ", {21,5,XREG}, {16,5,REG}, {0,16,HEX}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - - {0xf4002c80,"st.b.wt ", {21,5,REG}, {16,5,REG}, {0,5,REG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0xf4002880,"st.h.wt ", {21,5,REG}, {16,5,REG}, {0,5,REG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0xf4002480,"st.wt ", {21,5,REG}, {16,5,REG}, {0,5,REG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0xf4002080,"st.d.wt ", {21,5,REG}, {16,5,REG}, {0,5,REG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0xf4002d80,"st.b.usr.wt ", {21,5,REG}, {16,5,REG}, {0,5,REG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0xf4002980,"st.h.usr.wt ", {21,5,REG}, {16,5,REG}, {0,5,REG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0xf4002580,"st.usr.wt ", {21,5,REG}, {16,5,REG}, {0,5,REG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0xf4002180,"st.d.usr.wt ", {21,5,REG}, {16,5,REG}, {0,5,REG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - - {0xf0002400,"st ", {21,5,XREG}, {16,5,REG}, {0,5,REG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0xf0002000,"st.d ", {21,5,XREG}, {16,5,REG}, {0,5,REG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0xf0002100,"st.d.usr ", {21,5,XREG}, {16,5,REG}, {0,5,REG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0xf0002180,"st.d.usr.wt ", {21,5,XREG}, {16,5,REG}, {0,5,REG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0xf0002080,"st.d.wt ", {21,5,XREG}, {16,5,REG}, {0,5,REG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0xf0002500,"st.usr ", {21,5,XREG}, {16,5,REG}, {0,5,REG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0xf0002580,"st.usr.wt ", {21,5,XREG}, {16,5,REG}, {0,5,REG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0xf0002480,"st.wt ", {21,5,XREG}, {16,5,REG}, {0,5,REG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0xf0002800,"st.x ", {21,5,XREG}, {16,5,REG}, {0,5,REG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0xf0002900,"st.x.usr ", {21,5,XREG}, {16,5,REG}, {0,5,REG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0xf0002980,"st.x.usr.wt ", {21,5,XREG}, {16,5,REG}, {0,5,REG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0xf0002880,"st.x.wt ", {21,5,XREG}, {16,5,REG}, {0,5,REG}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - - {0xf4002f80,"st.b.usr.wt ", {21,5,REG}, {16,5,REG}, {0,5,REGSC}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0xf4002e80,"st.b.wt ", {21,5,REG}, {16,5,REG}, {0,5,REGSC}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0xf4002380,"st.d.usr.wt ", {21,5,REG}, {16,5,REG}, {0,5,REGSC}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0xf4002280,"st.d.wt ", {21,5,REG}, {16,5,REG}, {0,5,REGSC}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0xf4002b80,"st.h.usr.wt ", {21,5,REG}, {16,5,REG}, {0,5,REGSC}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0xf4002a80,"st.h.wt ", {21,5,REG}, {16,5,REG}, {0,5,REGSC}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0xf4002780,"st.usr.wt ", {21,5,REG}, {16,5,REG}, {0,5,REGSC}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0xf4002680,"st.wt ", {21,5,REG}, {16,5,REG}, {0,5,REGSC}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - - {0xf0002600,"st ", {21,5,XREG}, {16,5,REG}, {0,5,REGSC}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0xf0002200,"st.d ", {21,5,XREG}, {16,5,REG}, {0,5,REGSC}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0xf0002300,"st.d.usr ", {21,5,XREG}, {16,5,REG}, {0,5,REGSC}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0xf0002380,"st.d.usr.wt ", {21,5,XREG}, {16,5,REG}, {0,5,REGSC}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0xf0002280,"st.d.wt ", {21,5,XREG}, {16,5,REG}, {0,5,REGSC}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0xf0002700,"st.usr ", {21,5,XREG}, {16,5,REG}, {0,5,REGSC}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0xf0002780,"st.usr.wt ", {21,5,XREG}, {16,5,REG}, {0,5,REGSC}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0xf0002680,"st.wt ", {21,5,XREG}, {16,5,REG}, {0,5,REGSC}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0xf0002a00,"st.x ", {21,5,XREG}, {16,5,REG}, {0,5,REGSC}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0xf0002b00,"st.x.usr ", {21,5,XREG}, {16,5,REG}, {0,5,REGSC}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0xf0002b80,"st.x.usr.wt ", {21,5,XREG}, {16,5,REG}, {0,5,REGSC}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0xf0002a80,"st.x.wt ", {21,5,XREG}, {16,5,REG}, {0,5,REGSC}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - - {0x8400d880,"trnc.sd ", {21,5,REG}, {0,5,XREG}, NO_OPERAND, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400d800,"trnc.ss ", {21,5,REG}, {0,5,XREG}, NO_OPERAND, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - {0x8400d900,"trnc.sx ", {21,5,REG}, {0,5,XREG}, NO_OPERAND, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL }, - -}; - -/* - * Local Variables: - * fill-column: 131 - * End: - */ diff --git a/contrib/gdb/include/opcode/mips.h b/contrib/gdb/include/opcode/mips.h deleted file mode 100644 index 14ceec9..0000000 --- a/contrib/gdb/include/opcode/mips.h +++ /dev/null @@ -1,481 +0,0 @@ -/* mips.h. Mips opcode list for GDB, the GNU debugger. - Copyright 1993, 1995 Free Software Foundation, Inc. - Contributed by Ralph Campbell and OSF - Commented and modified by Ian Lance Taylor, Cygnus Support - -This file is part of GDB, GAS, and the GNU binutils. - -GDB, GAS, and the GNU binutils are free software; you can redistribute -them and/or modify them under the terms of the GNU General Public -License as published by the Free Software Foundation; either version -1, or (at your option) any later version. - -GDB, GAS, and the GNU binutils are distributed in the hope that they -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 file; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -/* These are bit masks and shift counts to use to access the various - fields of an instruction. To retrieve the X field of an - instruction, use the expression - (i >> OP_SH_X) & OP_MASK_X - To set the same field (to j), use - i = (i &~ (OP_MASK_X << OP_SH_X)) | (j << OP_SH_X) - - Make sure you use fields that are appropriate for the instruction, - of course. - - The 'i' format uses OP, RS, RT and IMMEDIATE. - - The 'j' format uses OP and TARGET. - - The 'r' format uses OP, RS, RT, RD, SHAMT and FUNCT. - - The 'b' format uses OP, RS, RT and DELTA. - - The floating point 'i' format uses OP, RS, RT and IMMEDIATE. - - The floating point 'r' format uses OP, FMT, FT, FS, FD and FUNCT. - - A breakpoint instruction uses OP, CODE and SPEC (10 bits of the - breakpoint instruction are not defined; Kane says the breakpoint - code field in BREAK is 20 bits; yet MIPS assemblers and debuggers - only use ten bits). - - The syscall instruction uses SYSCALL. - - The general coprocessor instructions use COPZ. */ - -#define OP_MASK_OP 0x3f -#define OP_SH_OP 26 -#define OP_MASK_RS 0x1f -#define OP_SH_RS 21 -#define OP_MASK_FR 0x1f -#define OP_SH_FR 21 -#define OP_MASK_FMT 0x1f -#define OP_SH_FMT 21 -#define OP_MASK_BCC 0x7 -#define OP_SH_BCC 18 -#define OP_MASK_CODE 0x3ff -#define OP_SH_CODE 16 -#define OP_MASK_RT 0x1f -#define OP_SH_RT 16 -#define OP_MASK_FT 0x1f -#define OP_SH_FT 16 -#define OP_MASK_CACHE 0x1f -#define OP_SH_CACHE 16 -#define OP_MASK_RD 0x1f -#define OP_SH_RD 11 -#define OP_MASK_FS 0x1f -#define OP_SH_FS 11 -#define OP_MASK_PREFX 0x1f -#define OP_SH_PREFX 11 -#define OP_MASK_CCC 0x7 -#define OP_SH_CCC 8 -#define OP_MASK_SYSCALL 0xfffff -#define OP_SH_SYSCALL 6 -#define OP_MASK_SHAMT 0x1f -#define OP_SH_SHAMT 6 -#define OP_MASK_FD 0x1f -#define OP_SH_FD 6 -#define OP_MASK_TARGET 0x3ffffff -#define OP_SH_TARGET 0 -#define OP_MASK_COPZ 0x1ffffff -#define OP_SH_COPZ 0 -#define OP_MASK_IMMEDIATE 0xffff -#define OP_SH_IMMEDIATE 0 -#define OP_MASK_DELTA 0xffff -#define OP_SH_DELTA 0 -#define OP_MASK_FUNCT 0x3f -#define OP_SH_FUNCT 0 -#define OP_MASK_SPEC 0x3f -#define OP_SH_SPEC 0 - -/* This structure holds information for a particular instruction. */ - -struct mips_opcode -{ - /* The name of the instruction. */ - const char *name; - /* A string describing the arguments for this instruction. */ - const char *args; - /* The basic opcode for the instruction. When assembling, this - opcode is modified by the arguments to produce the actual opcode - that is used. If pinfo is INSN_MACRO, then this is instead the - ISA level of the macro (0 or 1 is always supported, 2 is ISA 2, - etc.). */ - unsigned long match; - /* If pinfo is not INSN_MACRO, then this is a bit mask for the - relevant portions of the opcode when disassembling. If the - actual opcode anded with the match field equals the opcode field, - then we have found the correct instruction. If pinfo is - INSN_MACRO, then this field is the macro identifier. */ - unsigned long mask; - /* For a macro, this is INSN_MACRO. Otherwise, it is a collection - of bits describing the instruction, notably any relevant hazard - information. */ - unsigned long pinfo; -}; - -/* These are the characters which may appears in the args field of an - instruction. They appear in the order in which the fields appear - when the instruction is used. Commas and parentheses in the args - string are ignored when assembling, and written into the output - when disassembling. - - Each of these characters corresponds to a mask field defined above. - - "<" 5 bit shift amount (OP_*_SHAMT) - ">" shift amount between 32 and 63, stored after subtracting 32 (OP_*_SHAMT) - "a" 26 bit target address (OP_*_TARGET) - "b" 5 bit base register (OP_*_RS) - "c" 10 bit breakpoint code (OP_*_CODE) - "d" 5 bit destination register specifier (OP_*_RD) - "h" 5 bit prefx hint (OP_*_PREFX) - "i" 16 bit unsigned immediate (OP_*_IMMEDIATE) - "j" 16 bit signed immediate (OP_*_DELTA) - "k" 5 bit cache opcode in target register position (OP_*_CACHE) - "o" 16 bit signed offset (OP_*_DELTA) - "p" 16 bit PC relative branch target address (OP_*_DELTA) - "r" 5 bit same register used as both source and target (OP_*_RS) - "s" 5 bit source register specifier (OP_*_RS) - "t" 5 bit target register (OP_*_RT) - "u" 16 bit upper 16 bits of address (OP_*_IMMEDIATE) - "v" 5 bit same register used as both source and destination (OP_*_RS) - "w" 5 bit same register used as both target and destination (OP_*_RT) - "C" 25 bit coprocessor function code (OP_*_COPZ) - "B" 20 bit syscall function code (OP_*_SYSCALL) - "x" accept and ignore register name - "z" must be zero register - - Floating point instructions: - "D" 5 bit destination register (OP_*_FD) - "M" 3 bit compare condition code (OP_*_CCC) (only used for mips4 and up) - "N" 3 bit branch condition code (OP_*_BCC) (only used for mips4 and up) - "S" 5 bit fs source 1 register (OP_*_FS) - "T" 5 bit ft source 2 register (OP_*_FT) - "R" 5 bit fr source 3 register (OP_*_FR) - "V" 5 bit same register used as floating source and destination (OP_*_FS) - "W" 5 bit same register used as floating target and destination (OP_*_FT) - - Coprocessor instructions: - "E" 5 bit target register (OP_*_RT) - "G" 5 bit destination register (OP_*_RD) - - Macro instructions: - "A" General 32 bit expression - "I" 32 bit immediate - "F" 64 bit floating point constant in .rdata - "L" 64 bit floating point constant in .lit8 - "f" 32 bit floating point constant - "l" 32 bit floating point constant in .lit4 -*/ - -/* These are the bits which may be set in the pinfo field of an - instructions, if it is not equal to INSN_MACRO. */ - -/* Modifies the general purpose register in OP_*_RD. */ -#define INSN_WRITE_GPR_D 0x00000001 -/* Modifies the general purpose register in OP_*_RT. */ -#define INSN_WRITE_GPR_T 0x00000002 -/* Modifies general purpose register 31. */ -#define INSN_WRITE_GPR_31 0x00000004 -/* Modifies the floating point register in OP_*_FD. */ -#define INSN_WRITE_FPR_D 0x00000008 -/* Modifies the floating point register in OP_*_FS. */ -#define INSN_WRITE_FPR_S 0x00000010 -/* Modifies the floating point register in OP_*_FT. */ -#define INSN_WRITE_FPR_T 0x00000020 -/* Reads the general purpose register in OP_*_RS. */ -#define INSN_READ_GPR_S 0x00000040 -/* Reads the general purpose register in OP_*_RT. */ -#define INSN_READ_GPR_T 0x00000080 -/* Reads the floating point register in OP_*_FS. */ -#define INSN_READ_FPR_S 0x00000100 -/* Reads the floating point register in OP_*_FT. */ -#define INSN_READ_FPR_T 0x00000200 -/* Reads the floating point register in OP_*_FR. */ -#define INSN_READ_FPR_R 0x00000400 -/* Modifies coprocessor condition code. */ -#define INSN_WRITE_COND_CODE 0x00000800 -/* Reads coprocessor condition code. */ -#define INSN_READ_COND_CODE 0x00001000 -/* TLB operation. */ -#define INSN_TLB 0x00002000 -/* Reads coprocessor register other than floating point register. */ -#define INSN_COP 0x00004000 -/* Instruction loads value from memory, requiring delay. */ -#define INSN_LOAD_MEMORY_DELAY 0x00008000 -/* Instruction loads value from coprocessor, requiring delay. */ -#define INSN_LOAD_COPROC_DELAY 0x00010000 -/* Instruction has unconditional branch delay slot. */ -#define INSN_UNCOND_BRANCH_DELAY 0x00020000 -/* Instruction has conditional branch delay slot. */ -#define INSN_COND_BRANCH_DELAY 0x00040000 -/* Conditional branch likely: if branch not taken, insn nullified. */ -#define INSN_COND_BRANCH_LIKELY 0x00080000 -/* Moves to coprocessor register, requiring delay. */ -#define INSN_COPROC_MOVE_DELAY 0x00100000 -/* Loads coprocessor register from memory, requiring delay. */ -#define INSN_COPROC_MEMORY_DELAY 0x00200000 -/* Reads the HI register. */ -#define INSN_READ_HI 0x00400000 -/* Reads the LO register. */ -#define INSN_READ_LO 0x00800000 -/* Modifies the HI register. */ -#define INSN_WRITE_HI 0x01000000 -/* Modifies the LO register. */ -#define INSN_WRITE_LO 0x02000000 -/* Takes a trap (easier to keep out of delay slot). */ -#define INSN_TRAP 0x04000000 -/* Instruction stores value into memory. */ -#define INSN_STORE_MEMORY 0x08000000 -/* MIPS ISA field--CPU level at which insn is supported. */ -#define INSN_ISA 0x70000000 -/* MIPS ISA 2 instruction (R6000 or R4000). */ -#define INSN_ISA2 0x10000000 -/* MIPS ISA 3 instruction (R4000). */ -#define INSN_ISA3 0x20000000 -/* MIPS R4650 instruction. */ -#define INSN_4650 0x30000000 -/* MIPS ISA 4 instruction (R8000). */ -#define INSN_ISA4 0x40000000 -/* LSI R4010 instruction. */ -#define INSN_4010 0x50000000 -/* NEC VR4100 instruction. */ -#define INSN_4100 0x60000000 - -/* Instruction is actually a macro. It should be ignored by the - disassembler, and requires special treatment by the assembler. */ -#define INSN_MACRO 0xffffffff - -/* This is a list of macro expanded instructions. - * - * _I appended means immediate - * _A appended means address - * _AB appended means address with base register - * _D appended means 64 bit floating point constant - * _S appended means 32 bit floating point constant - */ -enum { - M_ABS, - M_ADD_I, - M_ADDU_I, - M_AND_I, - M_BEQ_I, - M_BEQL_I, - M_BGE, - M_BGEL, - M_BGE_I, - M_BGEL_I, - M_BGEU, - M_BGEUL, - M_BGEU_I, - M_BGEUL_I, - M_BGT, - M_BGTL, - M_BGT_I, - M_BGTL_I, - M_BGTU, - M_BGTUL, - M_BGTU_I, - M_BGTUL_I, - M_BLE, - M_BLEL, - M_BLE_I, - M_BLEL_I, - M_BLEU, - M_BLEUL, - M_BLEU_I, - M_BLEUL_I, - M_BLT, - M_BLTL, - M_BLT_I, - M_BLTL_I, - M_BLTU, - M_BLTUL, - M_BLTU_I, - M_BLTUL_I, - M_BNE_I, - M_BNEL_I, - M_DABS, - M_DADD_I, - M_DADDU_I, - M_DDIV_3, - M_DDIV_3I, - M_DDIVU_3, - M_DDIVU_3I, - M_DIV_3, - M_DIV_3I, - M_DIVU_3, - M_DIVU_3I, - M_DLA_AB, - M_DLI, - M_DMUL, - M_DMUL_I, - M_DMULO, - M_DMULO_I, - M_DMULOU, - M_DMULOU_I, - M_DREM_3, - M_DREM_3I, - M_DREMU_3, - M_DREMU_3I, - M_DSUB_I, - M_DSUBU_I, - M_J_A, - M_JAL_1, - M_JAL_2, - M_JAL_A, - M_L_DOB, - M_L_DAB, - M_LA_AB, - M_LB_A, - M_LB_AB, - M_LBU_A, - M_LBU_AB, - M_LD_A, - M_LD_OB, - M_LD_AB, - M_LDC1_AB, - M_LDC2_AB, - M_LDC3_AB, - M_LDL_AB, - M_LDR_AB, - M_LH_A, - M_LH_AB, - M_LHU_A, - M_LHU_AB, - M_LI, - M_LI_D, - M_LI_DD, - M_LI_S, - M_LI_SS, - M_LL_AB, - M_LLD_AB, - M_LS_A, - M_LW_A, - M_LW_AB, - M_LWC0_A, - M_LWC0_AB, - M_LWC1_A, - M_LWC1_AB, - M_LWC2_A, - M_LWC2_AB, - M_LWC3_A, - M_LWC3_AB, - M_LWL_A, - M_LWL_AB, - M_LWR_A, - M_LWR_AB, - M_LWU_AB, - M_MUL, - M_MUL_I, - M_MULO, - M_MULO_I, - M_MULOU, - M_MULOU_I, - M_NOR_I, - M_OR_I, - M_REM_3, - M_REM_3I, - M_REMU_3, - M_REMU_3I, - M_ROL, - M_ROL_I, - M_ROR, - M_ROR_I, - M_S_DA, - M_S_DOB, - M_S_DAB, - M_S_S, - M_SC_AB, - M_SCD_AB, - M_SD_A, - M_SD_OB, - M_SD_AB, - M_SDC1_AB, - M_SDC2_AB, - M_SDC3_AB, - M_SDL_AB, - M_SDR_AB, - M_SEQ, - M_SEQ_I, - M_SGE, - M_SGE_I, - M_SGEU, - M_SGEU_I, - M_SGT, - M_SGT_I, - M_SGTU, - M_SGTU_I, - M_SLE, - M_SLE_I, - M_SLEU, - M_SLEU_I, - M_SLT_I, - M_SLTU_I, - M_SNE, - M_SNE_I, - M_SB_A, - M_SB_AB, - M_SH_A, - M_SH_AB, - M_SW_A, - M_SW_AB, - M_SWC0_A, - M_SWC0_AB, - M_SWC1_A, - M_SWC1_AB, - M_SWC2_A, - M_SWC2_AB, - M_SWC3_A, - M_SWC3_AB, - M_SWL_A, - M_SWL_AB, - M_SWR_A, - M_SWR_AB, - M_SUB_I, - M_SUBU_I, - M_TEQ_I, - M_TGE_I, - M_TGEU_I, - M_TLT_I, - M_TLTU_I, - M_TNE_I, - M_TRUNCWD, - M_TRUNCWS, - M_ULD, - M_ULD_A, - M_ULH, - M_ULH_A, - M_ULHU, - M_ULHU_A, - M_ULW, - M_ULW_A, - M_USH, - M_USH_A, - M_USW, - M_USW_A, - M_USD, - M_USD_A, - M_XOR_I -}; - -/* The order of overloaded instructions matters. Label arguments and - register arguments look the same. Instructions that can have either - for arguments must apear in the correct order in this table for the - assembler to pick the right one. In other words, entries with - immediate operands must apear after the same instruction with - registers. - - Many instructions are short hand for other instructions (i.e., The - jal instruction is short for jalr ). */ - -extern const struct mips_opcode mips_opcodes[]; -extern const int bfd_mips_num_opcodes; -#define NUMOPCODES bfd_mips_num_opcodes diff --git a/contrib/gdb/include/opcode/np1.h b/contrib/gdb/include/opcode/np1.h deleted file mode 100644 index d23adc7..0000000 --- a/contrib/gdb/include/opcode/np1.h +++ /dev/null @@ -1,422 +0,0 @@ -/* Print GOULD NPL instructions for GDB, the GNU debugger. - Copyright (C) 1986, 1987, 1989 Free Software Foundation, Inc. - -This file is part of GDB. - -GDB 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 1, or (at your option) -any later version. - -GDB 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 GDB; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -struct gld_opcode -{ - char *name; - unsigned long opcode; - unsigned long mask; - char *args; - int length; -}; - -/* We store four bytes of opcode for all opcodes because that - is the most any of them need. The actual length of an instruction - is always at least 2 bytes, and at most four. The length of the - instruction is based on the opcode. - - The mask component is a mask saying which bits must match - particular opcode in order for an instruction to be an instance - of that opcode. - - The args component is a string containing characters - that are used to format the arguments to the instruction. */ - -/* Kinds of operands: - r Register in first field - R Register in second field - b Base register in first field - B Base register in second field - v Vector register in first field - V Vector register in first field - A Optional address register (base register) - X Optional index register - I Immediate data (16bits signed) - O Offset field (16bits signed) - h Offset field (15bits signed) - d Offset field (14bits signed) - S Shift count field - - any other characters are printed as is... -*/ - -/* The assembler requires that this array be sorted as follows: - all instances of the same mnemonic must be consecutive. - All instances of the same mnemonic with the same number of operands - must be consecutive. - */ -struct gld_opcode gld_opcodes[] = -{ -{ "lb", 0xb4080000, 0xfc080000, "r,xOA,X", 4 }, -{ "lnb", 0xb8080000, 0xfc080000, "r,xOA,X", 4 }, -{ "lbs", 0xec080000, 0xfc080000, "r,xOA,X", 4 }, -{ "lh", 0xb4000001, 0xfc080001, "r,xOA,X", 4 }, -{ "lnh", 0xb8000001, 0xfc080001, "r,xOA,X", 4 }, -{ "lw", 0xb4000000, 0xfc080000, "r,xOA,X", 4 }, -{ "lnw", 0xb8000000, 0xfc080000, "r,xOA,X", 4 }, -{ "ld", 0xb4000002, 0xfc080002, "r,xOA,X", 4 }, -{ "lnd", 0xb8000002, 0xfc080002, "r,xOA,X", 4 }, -{ "li", 0xf8000000, 0xfc7f0000, "r,I", 4 }, -{ "lpa", 0x50080000, 0xfc080000, "r,xOA,X", 4 }, -{ "la", 0x50000000, 0xfc080000, "r,xOA,X", 4 }, -{ "labr", 0x58080000, 0xfc080000, "b,xOA,X", 4 }, -{ "lbp", 0x90080000, 0xfc080000, "r,xOA,X", 4 }, -{ "lhp", 0x90000001, 0xfc080001, "r,xOA,X", 4 }, -{ "lwp", 0x90000000, 0xfc080000, "r,xOA,X", 4 }, -{ "ldp", 0x90000002, 0xfc080002, "r,xOA,X", 4 }, -{ "suabr", 0x58000000, 0xfc080000, "b,xOA,X", 4 }, -{ "lf", 0xbc000000, 0xfc080000, "r,xOA,X", 4 }, -{ "lfbr", 0xbc080000, 0xfc080000, "b,xOA,X", 4 }, -{ "lwbr", 0x5c000000, 0xfc080000, "b,xOA,X", 4 }, -{ "stb", 0xd4080000, 0xfc080000, "r,xOA,X", 4 }, -{ "sth", 0xd4000001, 0xfc080001, "r,xOA,X", 4 }, -{ "stw", 0xd4000000, 0xfc080000, "r,xOA,X", 4 }, -{ "std", 0xd4000002, 0xfc080002, "r,xOA,X", 4 }, -{ "stf", 0xdc000000, 0xfc080000, "r,xOA,X", 4 }, -{ "stfbr", 0xdc080000, 0xfc080000, "b,xOA,X", 4 }, -{ "stwbr", 0x54000000, 0xfc080000, "b,xOA,X", 4 }, -{ "zmb", 0xd8080000, 0xfc080000, "r,xOA,X", 4 }, -{ "zmh", 0xd8000001, 0xfc080001, "r,xOA,X", 4 }, -{ "zmw", 0xd8000000, 0xfc080000, "r,xOA,X", 4 }, -{ "zmd", 0xd8000002, 0xfc080002, "r,xOA,X", 4 }, -{ "stbp", 0x94080000, 0xfc080000, "r,xOA,X", 4 }, -{ "sthp", 0x94000001, 0xfc080001, "r,xOA,X", 4 }, -{ "stwp", 0x94000000, 0xfc080000, "r,xOA,X", 4 }, -{ "stdp", 0x94000002, 0xfc080002, "r,xOA,X", 4 }, -{ "lil", 0xf80b0000, 0xfc7f0000, "r,D", 4 }, -{ "lwsl1", 0xec000000, 0xfc080000, "r,xOA,X", 4 }, -{ "lwsl2", 0xfc000000, 0xfc080000, "r,xOA,X", 4 }, -{ "lwsl3", 0xfc080000, 0xfc080000, "r,xOA,X", 4 }, - -{ "lvb", 0xb0080000, 0xfc080000, "v,xOA,X", 4 }, -{ "lvh", 0xb0000001, 0xfc080001, "v,xOA,X", 4 }, -{ "lvw", 0xb0000000, 0xfc080000, "v,xOA,X", 4 }, -{ "lvd", 0xb0000002, 0xfc080002, "v,xOA,X", 4 }, -{ "liv", 0x3c040000, 0xfc0f0000, "v,R", 2 }, -{ "livf", 0x3c080000, 0xfc0f0000, "v,R", 2 }, -{ "stvb", 0xd0080000, 0xfc080000, "v,xOA,X", 4 }, -{ "stvh", 0xd0000001, 0xfc080001, "v,xOA,X", 4 }, -{ "stvw", 0xd0000000, 0xfc080000, "v,xOA,X", 4 }, -{ "stvd", 0xd0000002, 0xfc080002, "v,xOA,X", 4 }, - -{ "trr", 0x2c000000, 0xfc0f0000, "r,R", 2 }, -{ "trn", 0x2c040000, 0xfc0f0000, "r,R", 2 }, -{ "trnd", 0x2c0c0000, 0xfc0f0000, "r,R", 2 }, -{ "trabs", 0x2c010000, 0xfc0f0000, "r,R", 2 }, -{ "trabsd", 0x2c090000, 0xfc0f0000, "r,R", 2 }, -{ "trc", 0x2c030000, 0xfc0f0000, "r,R", 2 }, -{ "xcr", 0x28040000, 0xfc0f0000, "r,R", 2 }, -{ "cxcr", 0x2c060000, 0xfc0f0000, "r,R", 2 }, -{ "cxcrd", 0x2c0e0000, 0xfc0f0000, "r,R", 2 }, -{ "tbrr", 0x2c020000, 0xfc0f0000, "r,B", 2 }, -{ "trbr", 0x28030000, 0xfc0f0000, "b,R", 2 }, -{ "xcbr", 0x28020000, 0xfc0f0000, "b,B", 2 }, -{ "tbrbr", 0x28010000, 0xfc0f0000, "b,B", 2 }, - -{ "trvv", 0x28050000, 0xfc0f0000, "v,V", 2 }, -{ "trvvn", 0x2c050000, 0xfc0f0000, "v,V", 2 }, -{ "trvvnd", 0x2c0d0000, 0xfc0f0000, "v,V", 2 }, -{ "trvab", 0x2c070000, 0xfc0f0000, "v,V", 2 }, -{ "trvabd", 0x2c0f0000, 0xfc0f0000, "v,V", 2 }, -{ "cmpv", 0x14060000, 0xfc0f0000, "v,V", 2 }, -{ "expv", 0x14070000, 0xfc0f0000, "v,V", 2 }, -{ "mrvvlt", 0x10030000, 0xfc0f0000, "v,V", 2 }, -{ "mrvvle", 0x10040000, 0xfc0f0000, "v,V", 2 }, -{ "mrvvgt", 0x14030000, 0xfc0f0000, "v,V", 2 }, -{ "mrvvge", 0x14040000, 0xfc0f0000, "v,V", 2 }, -{ "mrvveq", 0x10050000, 0xfc0f0000, "v,V", 2 }, -{ "mrvvne", 0x10050000, 0xfc0f0000, "v,V", 2 }, -{ "mrvrlt", 0x100d0000, 0xfc0f0000, "v,R", 2 }, -{ "mrvrle", 0x100e0000, 0xfc0f0000, "v,R", 2 }, -{ "mrvrgt", 0x140d0000, 0xfc0f0000, "v,R", 2 }, -{ "mrvrge", 0x140e0000, 0xfc0f0000, "v,R", 2 }, -{ "mrvreq", 0x100f0000, 0xfc0f0000, "v,R", 2 }, -{ "mrvrne", 0x140f0000, 0xfc0f0000, "v,R", 2 }, -{ "trvr", 0x140b0000, 0xfc0f0000, "r,V", 2 }, -{ "trrv", 0x140c0000, 0xfc0f0000, "v,R", 2 }, - -{ "bu", 0x40000000, 0xff880000, "xOA,X", 4 }, -{ "bns", 0x70080000, 0xff880000, "xOA,X", 4 }, -{ "bnco", 0x70880000, 0xff880000, "xOA,X", 4 }, -{ "bge", 0x71080000, 0xff880000, "xOA,X", 4 }, -{ "bne", 0x71880000, 0xff880000, "xOA,X", 4 }, -{ "bunge", 0x72080000, 0xff880000, "xOA,X", 4 }, -{ "bunle", 0x72880000, 0xff880000, "xOA,X", 4 }, -{ "bgt", 0x73080000, 0xff880000, "xOA,X", 4 }, -{ "bnany", 0x73880000, 0xff880000, "xOA,X", 4 }, -{ "bs" , 0x70000000, 0xff880000, "xOA,X", 4 }, -{ "bco", 0x70800000, 0xff880000, "xOA,X", 4 }, -{ "blt", 0x71000000, 0xff880000, "xOA,X", 4 }, -{ "beq", 0x71800000, 0xff880000, "xOA,X", 4 }, -{ "buge", 0x72000000, 0xff880000, "xOA,X", 4 }, -{ "bult", 0x72800000, 0xff880000, "xOA,X", 4 }, -{ "ble", 0x73000000, 0xff880000, "xOA,X", 4 }, -{ "bany", 0x73800000, 0xff880000, "xOA,X", 4 }, -{ "brlnk", 0x44000000, 0xfc080000, "r,xOA,X", 4 }, -{ "bib", 0x48000000, 0xfc080000, "r,xOA,X", 4 }, -{ "bih", 0x48080000, 0xfc080000, "r,xOA,X", 4 }, -{ "biw", 0x4c000000, 0xfc080000, "r,xOA,X", 4 }, -{ "bid", 0x4c080000, 0xfc080000, "r,xOA,X", 4 }, -{ "bivb", 0x60000000, 0xfc080000, "r,xOA,X", 4 }, -{ "bivh", 0x60080000, 0xfc080000, "r,xOA,X", 4 }, -{ "bivw", 0x64000000, 0xfc080000, "r,xOA,X", 4 }, -{ "bivd", 0x64080000, 0xfc080000, "r,xOA,X", 4 }, -{ "bvsb", 0x68000000, 0xfc080000, "r,xOA,X", 4 }, -{ "bvsh", 0x68080000, 0xfc080000, "r,xOA,X", 4 }, -{ "bvsw", 0x6c000000, 0xfc080000, "r,xOA,X", 4 }, -{ "bvsd", 0x6c080000, 0xfc080000, "r,xOA,X", 4 }, - -{ "camb", 0x80080000, 0xfc080000, "r,xOA,X", 4 }, -{ "camh", 0x80000001, 0xfc080001, "r,xOA,X", 4 }, -{ "camw", 0x80000000, 0xfc080000, "r,xOA,X", 4 }, -{ "camd", 0x80000002, 0xfc080002, "r,xOA,X", 4 }, -{ "car", 0x10000000, 0xfc0f0000, "r,R", 2 }, -{ "card", 0x14000000, 0xfc0f0000, "r,R", 2 }, -{ "ci", 0xf8050000, 0xfc7f0000, "r,I", 4 }, -{ "chkbnd", 0x5c080000, 0xfc080000, "r,xOA,X", 4 }, - -{ "cavv", 0x10010000, 0xfc0f0000, "v,V", 2 }, -{ "cavr", 0x10020000, 0xfc0f0000, "v,R", 2 }, -{ "cavvd", 0x10090000, 0xfc0f0000, "v,V", 2 }, -{ "cavrd", 0x100b0000, 0xfc0f0000, "v,R", 2 }, - -{ "anmb", 0x84080000, 0xfc080000, "r,xOA,X", 4 }, -{ "anmh", 0x84000001, 0xfc080001, "r,xOA,X", 4 }, -{ "anmw", 0x84000000, 0xfc080000, "r,xOA,X", 4 }, -{ "anmd", 0x84000002, 0xfc080002, "r,xOA,X", 4 }, -{ "anr", 0x04000000, 0xfc0f0000, "r,R", 2 }, -{ "ani", 0xf8080000, 0xfc7f0000, "r,I", 4 }, -{ "ormb", 0xb8080000, 0xfc080000, "r,xOA,X", 4 }, -{ "ormh", 0xb8000001, 0xfc080001, "r,xOA,X", 4 }, -{ "ormw", 0xb8000000, 0xfc080000, "r,xOA,X", 4 }, -{ "ormd", 0xb8000002, 0xfc080002, "r,xOA,X", 4 }, -{ "orr", 0x08000000, 0xfc0f0000, "r,R", 2 }, -{ "oi", 0xf8090000, 0xfc7f0000, "r,I", 4 }, -{ "eomb", 0x8c080000, 0xfc080000, "r,xOA,X", 4 }, -{ "eomh", 0x8c000001, 0xfc080001, "r,xOA,X", 4 }, -{ "eomw", 0x8c000000, 0xfc080000, "r,xOA,X", 4 }, -{ "eomd", 0x8c000002, 0xfc080002, "r,xOA,X", 4 }, -{ "eor", 0x0c000000, 0xfc0f0000, "r,R", 2 }, -{ "eoi", 0xf80a0000, 0xfc7f0000, "r,I", 4 }, - -{ "anvv", 0x04010000, 0xfc0f0000, "v,V", 2 }, -{ "anvr", 0x04020000, 0xfc0f0000, "v,R", 2 }, -{ "orvv", 0x08010000, 0xfc0f0000, "v,V", 2 }, -{ "orvr", 0x08020000, 0xfc0f0000, "v,R", 2 }, -{ "eovv", 0x0c010000, 0xfc0f0000, "v,V", 2 }, -{ "eovr", 0x0c020000, 0xfc0f0000, "v,R", 2 }, - -{ "sacz", 0x100c0000, 0xfc0f0000, "r,R", 2 }, -{ "sla", 0x1c400000, 0xfc600000, "r,S", 2 }, -{ "sll", 0x1c600000, 0xfc600000, "r,S", 2 }, -{ "slc", 0x24400000, 0xfc600000, "r,S", 2 }, -{ "slad", 0x20400000, 0xfc600000, "r,S", 2 }, -{ "slld", 0x20600000, 0xfc600000, "r,S", 2 }, -{ "sra", 0x1c000000, 0xfc600000, "r,S", 2 }, -{ "srl", 0x1c200000, 0xfc600000, "r,S", 2 }, -{ "src", 0x24000000, 0xfc600000, "r,S", 2 }, -{ "srad", 0x20000000, 0xfc600000, "r,S", 2 }, -{ "srld", 0x20200000, 0xfc600000, "r,S", 2 }, -{ "sda", 0x3c030000, 0xfc0f0000, "r,R", 2 }, -{ "sdl", 0x3c020000, 0xfc0f0000, "r,R", 2 }, -{ "sdc", 0x3c010000, 0xfc0f0000, "r,R", 2 }, -{ "sdad", 0x3c0b0000, 0xfc0f0000, "r,R", 2 }, -{ "sdld", 0x3c0a0000, 0xfc0f0000, "r,R", 2 }, - -{ "svda", 0x3c070000, 0xfc0f0000, "v,R", 2 }, -{ "svdl", 0x3c060000, 0xfc0f0000, "v,R", 2 }, -{ "svdc", 0x3c050000, 0xfc0f0000, "v,R", 2 }, -{ "svdad", 0x3c0e0000, 0xfc0f0000, "v,R", 2 }, -{ "svdld", 0x3c0d0000, 0xfc0f0000, "v,R", 2 }, - -{ "sbm", 0xac080000, 0xfc080000, "f,xOA,X", 4 }, -{ "zbm", 0xac000000, 0xfc080000, "f,xOA,X", 4 }, -{ "tbm", 0xa8080000, 0xfc080000, "f,xOA,X", 4 }, -{ "incmb", 0xa0000000, 0xfc080000, "xOA,X", 4 }, -{ "incmh", 0xa0080000, 0xfc080000, "xOA,X", 4 }, -{ "incmw", 0xa4000000, 0xfc080000, "xOA,X", 4 }, -{ "incmd", 0xa4080000, 0xfc080000, "xOA,X", 4 }, -{ "sbmd", 0x7c080000, 0xfc080000, "r,xOA,X", 4 }, -{ "zbmd", 0x7c000000, 0xfc080000, "r,xOA,X", 4 }, -{ "tbmd", 0x78080000, 0xfc080000, "r,xOA,X", 4 }, - -{ "ssm", 0x9c080000, 0xfc080000, "f,xOA,X", 4 }, -{ "zsm", 0x9c000000, 0xfc080000, "f,xOA,X", 4 }, -{ "tsm", 0x98080000, 0xfc080000, "f,xOA,X", 4 }, - -{ "admb", 0xc8080000, 0xfc080000, "r,xOA,X", 4 }, -{ "admh", 0xc8000001, 0xfc080001, "r,xOA,X", 4 }, -{ "admw", 0xc8000000, 0xfc080000, "r,xOA,X", 4 }, -{ "admd", 0xc8000002, 0xfc080002, "r,xOA,X", 4 }, -{ "adr", 0x38000000, 0xfc0f0000, "r,R", 2 }, -{ "armb", 0xe8080000, 0xfc080000, "r,xOA,X", 4 }, -{ "armh", 0xe8000001, 0xfc080001, "r,xOA,X", 4 }, -{ "armw", 0xe8000000, 0xfc080000, "r,xOA,X", 4 }, -{ "armd", 0xe8000002, 0xfc080002, "r,xOA,X", 4 }, -{ "adi", 0xf8010000, 0xfc0f0000, "r,I", 4 }, -{ "sumb", 0xcc080000, 0xfc080000, "r,xOA,X", 4 }, -{ "sumh", 0xcc000001, 0xfc080001, "r,xOA,X", 4 }, -{ "sumw", 0xcc000000, 0xfc080000, "r,xOA,X", 4 }, -{ "sumd", 0xcc000002, 0xfc080002, "r,xOA,X", 4 }, -{ "sur", 0x3c000000, 0xfc0f0000, "r,R", 2 }, -{ "sui", 0xf8020000, 0xfc0f0000, "r,I", 4 }, -{ "mpmb", 0xc0080000, 0xfc080000, "r,xOA,X", 4 }, -{ "mpmh", 0xc0000001, 0xfc080001, "r,xOA,X", 4 }, -{ "mpmw", 0xc0000000, 0xfc080000, "r,xOA,X", 4 }, -{ "mpr", 0x38020000, 0xfc0f0000, "r,R", 2 }, -{ "mprd", 0x3c0f0000, 0xfc0f0000, "r,R", 2 }, -{ "mpi", 0xf8030000, 0xfc0f0000, "r,I", 4 }, -{ "dvmb", 0xc4080000, 0xfc080000, "r,xOA,X", 4 }, -{ "dvmh", 0xc4000001, 0xfc080001, "r,xOA,X", 4 }, -{ "dvmw", 0xc4000000, 0xfc080000, "r,xOA,X", 4 }, -{ "dvr", 0x380a0000, 0xfc0f0000, "r,R", 2 }, -{ "dvi", 0xf8040000, 0xfc0f0000, "r,I", 4 }, -{ "exs", 0x38080000, 0xfc0f0000, "r,R", 2 }, - -{ "advv", 0x30000000, 0xfc0f0000, "v,V", 2 }, -{ "advvd", 0x30080000, 0xfc0f0000, "v,V", 2 }, -{ "adrv", 0x34000000, 0xfc0f0000, "v,R", 2 }, -{ "adrvd", 0x34080000, 0xfc0f0000, "v,R", 2 }, -{ "suvv", 0x30010000, 0xfc0f0000, "v,V", 2 }, -{ "suvvd", 0x30090000, 0xfc0f0000, "v,V", 2 }, -{ "surv", 0x34010000, 0xfc0f0000, "v,R", 2 }, -{ "survd", 0x34090000, 0xfc0f0000, "v,R", 2 }, -{ "mpvv", 0x30020000, 0xfc0f0000, "v,V", 2 }, -{ "mprv", 0x34020000, 0xfc0f0000, "v,R", 2 }, - -{ "adfw", 0xe0080000, 0xfc080000, "r,xOA,X", 4 }, -{ "adfd", 0xe0080002, 0xfc080002, "r,xOA,X", 4 }, -{ "adrfw", 0x38010000, 0xfc0f0000, "r,R", 2 }, -{ "adrfd", 0x38090000, 0xfc0f0000, "r,R", 2 }, -{ "surfw", 0xe0000000, 0xfc080000, "r,xOA,X", 4 }, -{ "surfd", 0xe0000002, 0xfc080002, "r,xOA,X", 4 }, -{ "surfw", 0x38030000, 0xfc0f0000, "r,R", 2 }, -{ "surfd", 0x380b0000, 0xfc0f0000, "r,R", 2 }, -{ "mpfw", 0xe4080000, 0xfc080000, "r,xOA,X", 4 }, -{ "mpfd", 0xe4080002, 0xfc080002, "r,xOA,X", 4 }, -{ "mprfw", 0x38060000, 0xfc0f0000, "r,R", 2 }, -{ "mprfd", 0x380e0000, 0xfc0f0000, "r,R", 2 }, -{ "rfw", 0xe4000000, 0xfc080000, "r,xOA,X", 4 }, -{ "rfd", 0xe4000002, 0xfc080002, "r,xOA,X", 4 }, -{ "rrfw", 0x0c0e0000, 0xfc0f0000, "r", 2 }, -{ "rrfd", 0x0c0f0000, 0xfc0f0000, "r", 2 }, - -{ "advvfw", 0x30040000, 0xfc0f0000, "v,V", 2 }, -{ "advvfd", 0x300c0000, 0xfc0f0000, "v,V", 2 }, -{ "adrvfw", 0x34040000, 0xfc0f0000, "v,R", 2 }, -{ "adrvfd", 0x340c0000, 0xfc0f0000, "v,R", 2 }, -{ "suvvfw", 0x30050000, 0xfc0f0000, "v,V", 2 }, -{ "suvvfd", 0x300d0000, 0xfc0f0000, "v,V", 2 }, -{ "survfw", 0x34050000, 0xfc0f0000, "v,R", 2 }, -{ "survfd", 0x340d0000, 0xfc0f0000, "v,R", 2 }, -{ "mpvvfw", 0x30060000, 0xfc0f0000, "v,V", 2 }, -{ "mpvvfd", 0x300e0000, 0xfc0f0000, "v,V", 2 }, -{ "mprvfw", 0x34060000, 0xfc0f0000, "v,R", 2 }, -{ "mprvfd", 0x340e0000, 0xfc0f0000, "v,R", 2 }, -{ "rvfw", 0x30070000, 0xfc0f0000, "v", 2 }, -{ "rvfd", 0x300f0000, 0xfc0f0000, "v", 2 }, - -{ "fltw", 0x38070000, 0xfc0f0000, "r,R", 2 }, -{ "fltd", 0x380f0000, 0xfc0f0000, "r,R", 2 }, -{ "fixw", 0x38050000, 0xfc0f0000, "r,R", 2 }, -{ "fixd", 0x380d0000, 0xfc0f0000, "r,R", 2 }, -{ "cfpds", 0x3c090000, 0xfc0f0000, "r,R", 2 }, - -{ "fltvw", 0x080d0000, 0xfc0f0000, "v,V", 2 }, -{ "fltvd", 0x080f0000, 0xfc0f0000, "v,V", 2 }, -{ "fixvw", 0x080c0000, 0xfc0f0000, "v,V", 2 }, -{ "fixvd", 0x080e0000, 0xfc0f0000, "v,V", 2 }, -{ "cfpvds", 0x0c0d0000, 0xfc0f0000, "v,V", 2 }, - -{ "orvrn", 0x000a0000, 0xfc0f0000, "r,V", 2 }, -{ "andvrn", 0x00080000, 0xfc0f0000, "r,V", 2 }, -{ "frsteq", 0x04090000, 0xfc0f0000, "r,V", 2 }, -{ "sigma", 0x0c080000, 0xfc0f0000, "r,V", 2 }, -{ "sigmad", 0x0c0a0000, 0xfc0f0000, "r,V", 2 }, -{ "sigmf", 0x08080000, 0xfc0f0000, "r,V", 2 }, -{ "sigmfd", 0x080a0000, 0xfc0f0000, "r,V", 2 }, -{ "prodf", 0x04080000, 0xfc0f0000, "r,V", 2 }, -{ "prodfd", 0x040a0000, 0xfc0f0000, "r,V", 2 }, -{ "maxv", 0x10080000, 0xfc0f0000, "r,V", 2 }, -{ "maxvd", 0x100a0000, 0xfc0f0000, "r,V", 2 }, -{ "minv", 0x14080000, 0xfc0f0000, "r,V", 2 }, -{ "minvd", 0x140a0000, 0xfc0f0000, "r,V", 2 }, - -{ "lpsd", 0xf0000000, 0xfc080000, "xOA,X", 4 }, -{ "ldc", 0xf0080000, 0xfc080000, "xOA,X", 4 }, -{ "spm", 0x040c0000, 0xfc0f0000, "r", 2 }, -{ "rpm", 0x040d0000, 0xfc0f0000, "r", 2 }, -{ "tritr", 0x00070000, 0xfc0f0000, "r", 2 }, -{ "trrit", 0x00060000, 0xfc0f0000, "r", 2 }, -{ "rpswt", 0x04080000, 0xfc0f0000, "r", 2 }, -{ "exr", 0xf8070000, 0xfc0f0000, "", 4 }, -{ "halt", 0x00000000, 0xfc0f0000, "", 2 }, -{ "wait", 0x00010000, 0xfc0f0000, "", 2 }, -{ "nop", 0x00020000, 0xfc0f0000, "", 2 }, -{ "eiae", 0x00030000, 0xfc0f0000, "", 2 }, -{ "efae", 0x000d0000, 0xfc0f0000, "", 2 }, -{ "diae", 0x000e0000, 0xfc0f0000, "", 2 }, -{ "dfae", 0x000f0000, 0xfc0f0000, "", 2 }, -{ "spvc", 0xf8060000, 0xfc0f0000, "r,T,N", 4 }, -{ "rdsts", 0x00090000, 0xfc0f0000, "r", 2 }, -{ "setcpu", 0x000c0000, 0xfc0f0000, "r", 2 }, -{ "cmc", 0x000b0000, 0xfc0f0000, "r", 2 }, -{ "trrcu", 0x00040000, 0xfc0f0000, "r", 2 }, -{ "attnio", 0x00050000, 0xfc0f0000, "", 2 }, -{ "fudit", 0x28080000, 0xfc0f0000, "", 2 }, -{ "break", 0x28090000, 0xfc0f0000, "", 2 }, -{ "frzss", 0x280a0000, 0xfc0f0000, "", 2 }, -{ "ripi", 0x04040000, 0xfc0f0000, "r,R", 2 }, -{ "xcp", 0x04050000, 0xfc0f0000, "r", 2 }, -{ "block", 0x04060000, 0xfc0f0000, "", 2 }, -{ "unblock", 0x04070000, 0xfc0f0000, "", 2 }, -{ "trsc", 0x08060000, 0xfc0f0000, "r,R", 2 }, -{ "tscr", 0x08070000, 0xfc0f0000, "r,R", 2 }, -{ "fq", 0x04080000, 0xfc0f0000, "r", 2 }, -{ "flupte", 0x2c080000, 0xfc0f0000, "r", 2 }, -{ "rviu", 0x040f0000, 0xfc0f0000, "", 2 }, -{ "ldel", 0x280c0000, 0xfc0f0000, "r,R", 2 }, -{ "ldu", 0x280d0000, 0xfc0f0000, "r,R", 2 }, -{ "stdecc", 0x280b0000, 0xfc0f0000, "r,R", 2 }, -{ "trpc", 0x08040000, 0xfc0f0000, "r", 2 }, -{ "tpcr", 0x08050000, 0xfc0f0000, "r", 2 }, -{ "ghalt", 0x0c050000, 0xfc0f0000, "r", 2 }, -{ "grun", 0x0c040000, 0xfc0f0000, "", 2 }, -{ "tmpr", 0x2c0a0000, 0xfc0f0000, "r,R", 2 }, -{ "trmp", 0x2c0b0000, 0xfc0f0000, "r,R", 2 }, - -{ "trrve", 0x28060000, 0xfc0f0000, "r", 2 }, -{ "trver", 0x28070000, 0xfc0f0000, "r", 2 }, -{ "trvlr", 0x280f0000, 0xfc0f0000, "r", 2 }, - -{ "linkfl", 0x18000000, 0xfc0f0000, "r,R", 2 }, -{ "linkbl", 0x18020000, 0xfc0f0000, "r,R", 2 }, -{ "linkfp", 0x18010000, 0xfc0f0000, "r,R", 2 }, -{ "linkbp", 0x18030000, 0xfc0f0000, "r,R", 2 }, -{ "linkpl", 0x18040000, 0xfc0f0000, "r,R", 2 }, -{ "ulinkl", 0x18080000, 0xfc0f0000, "r,R", 2 }, -{ "ulinkp", 0x18090000, 0xfc0f0000, "r,R", 2 }, -{ "ulinktl", 0x180a0000, 0xfc0f0000, "r,R", 2 }, -{ "ulinktp", 0x180b0000, 0xfc0f0000, "r,R", 2 }, -}; - -int numopcodes = sizeof(gld_opcodes) / sizeof(gld_opcodes[0]); - -struct gld_opcode *endop = gld_opcodes + sizeof(gld_opcodes) / - sizeof(gld_opcodes[0]); diff --git a/contrib/gdb/include/opcode/ns32k.h b/contrib/gdb/include/opcode/ns32k.h deleted file mode 100644 index 42bb8b8..0000000 --- a/contrib/gdb/include/opcode/ns32k.h +++ /dev/null @@ -1,491 +0,0 @@ -/* ns32k-opcode.h -- Opcode table for National Semi 32k processor - Copyright (C) 1987 Free Software Foundation, Inc. - -This file is part of GAS, the GNU Assembler. - -GAS 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 1, or (at your option) -any later version. - -GAS 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 GAS; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - - -#ifdef SEQUENT_COMPATABILITY -#define DEF_MODEC 20 -#define DEF_MODEL 21 -#endif - -#ifndef DEF_MODEC -#define DEF_MODEC 20 -#endif - -#ifndef DEF_MODEL -#define DEF_MODEL 20 -#endif -/* - After deciding the instruction entry (via hash.c) the instruction parser - will try to match the operands after the instruction to the required set - given in the entry operandfield. Every operand will result in a change in - the opcode or the addition of data to the opcode. - The operands in the source instruction are checked for inconsistent - semantics. - - F : 32 bit float general form - L : 64 bit float " - B : byte " - W : word " - D : double-word " - A : double-word gen-address-form ie no regs, no immediate - I : integer writeable gen int except immediate (A + reg) - Z : floating writeable gen float except immediate (Z + freg) - d : displacement - b : displacement - pc relative addressing acb - p : displacement - pc relative addressing br bcond bsr cxp - q : quick - i : immediate (8 bits) - This is not a standard ns32k operandtype, it is used to build - instructions like svc arg1,arg2 - Svc is the instruction SuperVisorCall and is sometimes used to - call OS-routines from usermode. Some args might be handy! - r : register number (3 bits) - O : setcfg instruction optionslist - C : cinv instruction optionslist - S : stringinstruction optionslist - U : registerlist save,enter - u : registerlist restore,exit - M : mmu register - P : cpu register - g : 3:rd operand of inss or exts instruction - G : 4:th operand of inss or exts instruction - Those operands are encoded in the same byte. - This byte is placed last in the instruction. - f : operand of sfsr - H : sequent-hack for bsr (Warning) - -column 1 instructions - 2 number of bits in opcode. - 3 number of bits in opcode explicitly - determined by the instruction type. - 4 opcodeseed, the number we build our opcode - from. - 5 operandtypes, used by operandparser. - 6 size in bytes of immediate -*/ -struct ns32k_opcode { - char *name; - unsigned char opcode_id_size; /* not used by the assembler */ - unsigned char opcode_size; - unsigned long opcode_seed; - char *operands; - unsigned char im_size; /* not used by dissassembler */ - char *default_args; /* default to those args when none given */ - char default_modec; /* default to this addr-mode when ambigous - ie when the argument of a general addr-mode - is a plain constant */ - char default_model; /* is a plain label */ -}; - -#ifdef comment -/* This section was from the gdb version of this file. */ - -#ifndef ns32k_opcodeT -#define ns32k_opcodeT int -#endif /* no ns32k_opcodeT */ - -struct not_wot /* ns32k opcode table: wot to do with this */ - /* particular opcode */ -{ - int obits; /* number of opcode bits */ - int ibits; /* number of instruction bits */ - ns32k_opcodeT code; /* op-code (may be > 8 bits!) */ - char *args; /* how to compile said opcode */ -}; - -struct not /* ns32k opcode text */ -{ - char * name; /* opcode name: lowercase string [key] */ - struct not_wot detail; /* rest of opcode table [datum] */ -}; - -/* Instructions look like this: - - basic instruction--1, 2, or 3 bytes - index byte for operand A, if operand A is indexed--1 byte - index byte for operand B, if operand B is indexed--1 byte - addressing extension for operand A - addressing extension for operand B - implied operands - - Operand A is the operand listed first in the following opcode table. - Operand B is the operand listed second in the following opcode table. - All instructions have at most 2 general operands, so this is enough. - The implied operands are associated with operands other than A and B. - - Each operand has a digit and a letter. - - The digit gives the position in the assembly language. The letter, - one of the following, tells us what kind of operand it is. */ - -/* F : 32 bit float - * L : 64 bit float - * B : byte - * W : word - * D : double-word - * I : integer not immediate - * Z : floating not immediate - * d : displacement - * q : quick - * i : immediate (8 bits) - * r : register number (3 bits) - * p : displacement - pc relative addressing -*/ - - -#endif /* comment */ - -static const struct ns32k_opcode ns32k_opcodes[]= -{ - { "absf", 14,24, 0x35be, "1F2Z", 4, "", DEF_MODEC,DEF_MODEL }, - { "absl", 14,24, 0x34be, "1L2Z", 8, "", DEF_MODEC,DEF_MODEL }, - { "absb", 14,24, 0x304e, "1B2I", 1, "", DEF_MODEC,DEF_MODEL }, - { "absw", 14,24, 0x314e, "1W2I", 2, "", DEF_MODEC,DEF_MODEL }, - { "absd", 14,24, 0x334e, "1D2I", 4, "", DEF_MODEC,DEF_MODEL }, - { "acbb", 7,16, 0x4c, "2I1q3p", 1, "", DEF_MODEC,DEF_MODEL }, - { "acbw", 7,16, 0x4d, "2I1q3p", 2, "", DEF_MODEC,DEF_MODEL }, - { "acbd", 7,16, 0x4f, "2I1q3p", 4, "", DEF_MODEC,DEF_MODEL }, - { "addf", 14,24, 0x01be, "1F2Z", 4, "", DEF_MODEC,DEF_MODEL }, - { "addl", 14,24, 0x00be, "1L2Z", 8, "", DEF_MODEC,DEF_MODEL }, - { "addb", 6,16, 0x00, "1B2I", 1, "", DEF_MODEC,DEF_MODEL }, - { "addw", 6,16, 0x01, "1W2I", 2, "", DEF_MODEC,DEF_MODEL }, - { "addd", 6,16, 0x03, "1D2I", 4, "", DEF_MODEC,DEF_MODEL }, - { "addcb", 6,16, 0x10, "1B2I", 1, "", DEF_MODEC,DEF_MODEL }, - { "addcw", 6,16, 0x11, "1W2I", 2, "", DEF_MODEC,DEF_MODEL }, - { "addcd", 6,16, 0x13, "1D2I", 4, "", DEF_MODEC,DEF_MODEL }, - { "addpb", 14,24, 0x3c4e, "1B2I", 1, "", DEF_MODEC,DEF_MODEL }, - { "addpw", 14,24, 0x3d4e, "1W2I", 2, "", DEF_MODEC,DEF_MODEL }, - { "addpd", 14,24, 0x3f4e, "1D2I", 4, "", DEF_MODEC,DEF_MODEL }, - { "addqb", 7,16, 0x0c, "2I1q", 1, "", DEF_MODEC,DEF_MODEL }, - { "addqw", 7,16, 0x0d, "2I1q", 2, "", DEF_MODEC,DEF_MODEL }, - { "addqd", 7,16, 0x0f, "2I1q", 4, "", DEF_MODEC,DEF_MODEL }, - { "addr", 6,16, 0x27, "1A2I", 4, "", 21,21 }, - { "adjspb", 11,16, 0x057c, "1B", 1, "", DEF_MODEC,DEF_MODEL }, - { "adjspw", 11,16, 0x057d, "1W", 2, "", DEF_MODEC,DEF_MODEL }, - { "adjspd", 11,16, 0x057f, "1D", 4, "", DEF_MODEC,DEF_MODEL }, - { "andb", 6,16, 0x28, "1B2I", 1, "", DEF_MODEC,DEF_MODEL }, - { "andw", 6,16, 0x29, "1W2I", 2, "", DEF_MODEC,DEF_MODEL }, - { "andd", 6,16, 0x2b, "1D2I", 4, "", DEF_MODEC,DEF_MODEL }, - { "ashb", 14,24, 0x044e, "1B2I", 1, "", DEF_MODEC,DEF_MODEL }, - { "ashw", 14,24, 0x054e, "1B2I", 1, "", DEF_MODEC,DEF_MODEL }, - { "ashd", 14,24, 0x074e, "1B2I", 1, "", DEF_MODEC,DEF_MODEL }, - { "beq", 8,8, 0x0a, "1p", 0, "", 21,21 }, - { "bne", 8,8, 0x1a, "1p", 0, "", 21,21 }, - { "bcs", 8,8, 0x2a, "1p", 0, "", 21,21 }, - { "bcc", 8,8, 0x3a, "1p", 0, "", 21,21 }, - { "bhi", 8,8, 0x4a, "1p", 0, "", 21,21 }, - { "bls", 8,8, 0x5a, "1p", 0, "", 21,21 }, - { "bgt", 8,8, 0x6a, "1p", 0, "", 21,21 }, - { "ble", 8,8, 0x7a, "1p", 0, "", 21,21 }, - { "bfs", 8,8, 0x8a, "1p", 0, "", 21,21 }, - { "bfc", 8,8, 0x9a, "1p", 0, "", 21,21 }, - { "blo", 8,8, 0xaa, "1p", 0, "", 21,21 }, - { "bhs", 8,8, 0xba, "1p", 0, "", 21,21 }, - { "blt", 8,8, 0xca, "1p", 0, "", 21,21 }, - { "bge", 8,8, 0xda, "1p", 0, "", 21,21 }, - { "but", 8,8, 0xea, "1p", 0, "", 21,21 }, - { "buf", 8,8, 0xfa, "1p", 0, "", 21,21 }, - { "bicb", 6,16, 0x08, "1B2I", 1, "", DEF_MODEC,DEF_MODEL }, - { "bicw", 6,16, 0x09, "1W2I", 2, "", DEF_MODEC,DEF_MODEL }, - { "bicd", 6,16, 0x0b, "1D2I", 4, "", DEF_MODEC,DEF_MODEL }, - { "bicpsrb", 11,16, 0x17c, "1B", 1, "", DEF_MODEC,DEF_MODEL }, - { "bicpsrw", 11,16, 0x17d, "1W", 2, "", DEF_MODEC,DEF_MODEL }, - { "bispsrb", 11,16, 0x37c, "1B", 1, "", DEF_MODEC,DEF_MODEL }, - { "bispsrw", 11,16, 0x37d, "1W", 2, "", DEF_MODEC,DEF_MODEL }, - { "bpt", 8,8, 0xf2, "", 0, "", DEF_MODEC,DEF_MODEL }, - { "br", 8,8, 0xea, "1p", 0, "", 21,21 }, -#ifdef SEQUENT_COMPATABILITY - { "bsr", 8,8, 0x02, "1H", 0, "", 21,21 }, -#else - { "bsr", 8,8, 0x02, "1p", 0, "", 21,21 }, -#endif - { "caseb", 11,16, 0x77c, "1B", 1, "", DEF_MODEC,DEF_MODEL }, - { "casew", 11,16, 0x77d, "1W", 2, "", DEF_MODEC,DEF_MODEL }, - { "cased", 11,16, 0x77f, "1D", 4, "", DEF_MODEC,DEF_MODEL }, - { "cbitb", 14,24, 0x084e, "1B2I", 1, "", DEF_MODEC,DEF_MODEL }, - { "cbitw", 14,24, 0x094e, "1W2I", 2, "", DEF_MODEC,DEF_MODEL }, - { "cbitd", 14,24, 0x0b4e, "1D2I", 4, "", DEF_MODEC,DEF_MODEL }, - { "cbitib", 14,24, 0x0c4e, "1B2I", 1, "", DEF_MODEC,DEF_MODEL }, - { "cbitiw", 14,24, 0x0d4e, "1W2I", 2, "", DEF_MODEC,DEF_MODEL }, - { "cbitid", 14,24, 0x0f4e, "1D2I", 4, "", DEF_MODEC,DEF_MODEL }, - { "checkb", 11,24, 0x0ee, "2A3B1r", 1, "", DEF_MODEC,DEF_MODEL }, - { "checkw", 11,24, 0x1ee, "2A3W1r", 2, "", DEF_MODEC,DEF_MODEL }, - { "checkd", 11,24, 0x3ee, "2A3D1r", 4, "", DEF_MODEC,DEF_MODEL }, - { "cinv", 14,24, 0x271e, "2D1C", 4, "", DEF_MODEC,DEF_MODEL }, - { "cmpf", 14,24, 0x09be, "1F2F", 4, "", DEF_MODEC,DEF_MODEL }, - { "cmpl", 14,24, 0x08be, "1L2L", 8, "", DEF_MODEC,DEF_MODEL }, - { "cmpb", 6,16, 0x04, "1B2B", 1, "", DEF_MODEC,DEF_MODEL }, - { "cmpw", 6,16, 0x05, "1W2W", 2, "", DEF_MODEC,DEF_MODEL }, - { "cmpd", 6,16, 0x07, "1D2D", 4, "", DEF_MODEC,DEF_MODEL }, - { "cmpmb", 14,24, 0x04ce, "1A2A3b", 1, "", DEF_MODEC,DEF_MODEL }, - { "cmpmw", 14,24, 0x05ce, "1A2A3b", 2, "", DEF_MODEC,DEF_MODEL }, - { "cmpmd", 14,24, 0x07ce, "1A2A3b", 4, "", DEF_MODEC,DEF_MODEL }, - { "cmpqb", 7,16, 0x1c, "2B1q", 1, "", DEF_MODEC,DEF_MODEL }, - { "cmpqw", 7,16, 0x1d, "2W1q", 2, "", DEF_MODEC,DEF_MODEL }, - { "cmpqd", 7,16, 0x1f, "2D1q", 4, "", DEF_MODEC,DEF_MODEL }, - { "cmpsb", 16,24, 0x040e, "1S", 0, "[]", DEF_MODEC,DEF_MODEL }, - { "cmpsw", 16,24, 0x050e, "1S", 0, "[]", DEF_MODEC,DEF_MODEL }, - { "cmpsd", 16,24, 0x070e, "1S", 0, "[]", DEF_MODEC,DEF_MODEL }, - { "cmpst", 16,24, 0x840e, "1S", 0, "[]", DEF_MODEC,DEF_MODEL }, - { "comb", 14,24, 0x344e, "1B2I", 1, "", DEF_MODEC,DEF_MODEL }, - { "comw", 14,24, 0x354e, "1W2I", 2, "", DEF_MODEC,DEF_MODEL }, - { "comd", 14,24, 0x374e, "1D2I", 4, "", DEF_MODEC,DEF_MODEL }, - { "cvtp", 11,24, 0x036e, "2A3D1r", 4, "", DEF_MODEC,DEF_MODEL }, - { "cxp", 8,8, 0x22, "1p", 0, "", 21,21 }, - { "cxpd", 11,16, 0x07f, "1A", 4, "", DEF_MODEC,DEF_MODEL }, - { "deib", 14,24, 0x2cce, "1B2I", 1, "", DEF_MODEC,DEF_MODEL }, - { "deiw", 14,24, 0x2dce, "1W2I", 2, "", DEF_MODEC,DEF_MODEL }, - { "deid", 14,24, 0x2fce, "1D2I", 4, "", DEF_MODEC,DEF_MODEL }, - { "dia", 8,8, 0xc2, "", 1, "", DEF_MODEC,DEF_MODEL }, - { "divf", 14,24, 0x21be, "1F2Z", 4, "", DEF_MODEC,DEF_MODEL }, - { "divl", 14,24, 0x20be, "1L2Z", 8, "", DEF_MODEC,DEF_MODEL }, - { "divb", 14,24, 0x3cce, "1B2I", 1, "", DEF_MODEC,DEF_MODEL }, - { "divw", 14,24, 0x3dce, "1W2I", 2, "", DEF_MODEC,DEF_MODEL }, - { "divd", 14,24, 0x3fce, "1D2I", 4, "", DEF_MODEC,DEF_MODEL }, - { "enter", 8,8, 0x82, "1U2d", 0, "", DEF_MODEC,DEF_MODEL }, - { "exit", 8,8, 0x92, "1u", 0, "", DEF_MODEC,DEF_MODEL }, - { "extb", 11,24, 0x02e, "2I3B1r4d", 1, "", DEF_MODEC,DEF_MODEL }, - { "extw", 11,24, 0x12e, "2I3W1r4d", 2, "", DEF_MODEC,DEF_MODEL }, - { "extd", 11,24, 0x32e, "2I3D1r4d", 4, "", DEF_MODEC,DEF_MODEL }, - { "extsb", 14,24, 0x0cce, "1I2I4G3g", 1, "", DEF_MODEC,DEF_MODEL }, - { "extsw", 14,24, 0x0dce, "1I2I4G3g", 2, "", DEF_MODEC,DEF_MODEL }, - { "extsd", 14,24, 0x0fce, "1I2I4G3g", 4, "", DEF_MODEC,DEF_MODEL }, - { "ffsb", 14,24, 0x046e, "1B2I", 1, "", DEF_MODEC,DEF_MODEL }, - { "ffsw", 14,24, 0x056e, "1W2I", 2, "", DEF_MODEC,DEF_MODEL }, - { "ffsd", 14,24, 0x076e, "1D2I", 4, "", DEF_MODEC,DEF_MODEL }, - { "flag", 8,8, 0xd2, "", 0, "", DEF_MODEC,DEF_MODEL }, - { "floorfb", 14,24, 0x3c3e, "1F2I", 4, "", DEF_MODEC,DEF_MODEL }, - { "floorfw", 14,24, 0x3d3e, "1F2I", 4, "", DEF_MODEC,DEF_MODEL }, - { "floorfd", 14,24, 0x3f3e, "1F2I", 4, "", DEF_MODEC,DEF_MODEL }, - { "floorlb", 14,24, 0x383e, "1L2I", 8, "", DEF_MODEC,DEF_MODEL }, - { "floorlw", 14,24, 0x393e, "1L2I", 8, "", DEF_MODEC,DEF_MODEL }, - { "floorld", 14,24, 0x3b3e, "1L2I", 8, "", DEF_MODEC,DEF_MODEL }, - { "ibitb", 14,24, 0x384e, "1B2I", 1, "", DEF_MODEC,DEF_MODEL }, - { "ibitw", 14,24, 0x394e, "1W2I", 2, "", DEF_MODEC,DEF_MODEL }, - { "ibitd", 14,24, 0x3b4e, "1D2I", 4, "", DEF_MODEC,DEF_MODEL }, - { "indexb", 11,24, 0x42e, "2B3B1r", 1, "", DEF_MODEC,DEF_MODEL }, - { "indexw", 11,24, 0x52e, "2W3W1r", 2, "", DEF_MODEC,DEF_MODEL }, - { "indexd", 11,24, 0x72e, "2D3D1r", 4, "", DEF_MODEC,DEF_MODEL }, - { "insb", 11,24, 0x0ae, "2B3I1r4d", 1, "", DEF_MODEC,DEF_MODEL }, - { "insw", 11,24, 0x1ae, "2W3I1r4d", 2, "", DEF_MODEC,DEF_MODEL }, - { "insd", 11,24, 0x3ae, "2D3I1r4d", 4, "", DEF_MODEC,DEF_MODEL }, - { "inssb", 14,24, 0x08ce, "1B2I4G3g", 1, "", DEF_MODEC,DEF_MODEL }, - { "inssw", 14,24, 0x09ce, "1W2I4G3g", 2, "", DEF_MODEC,DEF_MODEL }, - { "inssd", 14,24, 0x0bce, "1D2I4G3g", 4, "", DEF_MODEC,DEF_MODEL }, - { "jsr", 11,16, 0x67f, "1A", 4, "", 21,21 }, - { "jump", 11,16, 0x27f, "1A", 4, "", 21,21 }, - { "lfsr", 19,24, 0x00f3e,"1D", 4, "", DEF_MODEC,DEF_MODEL }, - { "lmr", 15,24, 0x0b1e, "2D1M", 4, "", DEF_MODEC,DEF_MODEL }, - { "lprb", 7,16, 0x6c, "2B1P", 1, "", DEF_MODEC,DEF_MODEL }, - { "lprw", 7,16, 0x6d, "2W1P", 2, "", DEF_MODEC,DEF_MODEL }, - { "lprd", 7,16, 0x6f, "2D1P", 4, "", DEF_MODEC,DEF_MODEL }, - { "lshb", 14,24, 0x144e, "1B2I", 1, "", DEF_MODEC,DEF_MODEL }, - { "lshw", 14,24, 0x154e, "1B2I", 1, "", DEF_MODEC,DEF_MODEL }, - { "lshd", 14,24, 0x174e, "1B2I", 1, "", DEF_MODEC,DEF_MODEL }, - { "meib", 14,24, 0x24ce, "1B2I", 1, "", DEF_MODEC,DEF_MODEL }, - { "meiw", 14,24, 0x25ce, "1W2I", 2, "", DEF_MODEC,DEF_MODEL }, - { "meid", 14,24, 0x27ce, "1D2I", 4, "", DEF_MODEC,DEF_MODEL }, - { "modb", 14,24, 0x38ce, "1B2I", 1, "", DEF_MODEC,DEF_MODEL }, - { "modw", 14,24, 0x39ce, "1W2I", 2, "", DEF_MODEC,DEF_MODEL }, - { "modd", 14,24, 0x3bce, "1D2I", 4, "", DEF_MODEC,DEF_MODEL }, - { "movf", 14,24, 0x05be, "1F2Z", 4, "", DEF_MODEC,DEF_MODEL }, - { "movl", 14,24, 0x04be, "1L2Z", 8, "", DEF_MODEC,DEF_MODEL }, - { "movb", 6,16, 0x14, "1B2I", 1, "", DEF_MODEC,DEF_MODEL }, - { "movw", 6,16, 0x15, "1W2I", 2, "", DEF_MODEC,DEF_MODEL }, - { "movd", 6,16, 0x17, "1D2I", 4, "", DEF_MODEC,DEF_MODEL }, - { "movbf", 14,24, 0x043e, "1B2Z", 1, "", DEF_MODEC,DEF_MODEL }, - { "movwf", 14,24, 0x053e, "1W2Z", 2, "", DEF_MODEC,DEF_MODEL }, - { "movdf", 14,24, 0x073e, "1D2Z", 4, "", DEF_MODEC,DEF_MODEL }, - { "movbl", 14,24, 0x003e, "1B2Z", 1, "", DEF_MODEC,DEF_MODEL }, - { "movwl", 14,24, 0x013e, "1W2Z", 2, "", DEF_MODEC,DEF_MODEL }, - { "movdl", 14,24, 0x033e, "1D2Z", 4, "", DEF_MODEC,DEF_MODEL }, - { "movfl", 14,24, 0x1b3e, "1F2Z", 4, "", DEF_MODEC,DEF_MODEL }, - { "movlf", 14,24, 0x163e, "1L2Z", 8, "", DEF_MODEC,DEF_MODEL }, - { "movmb", 14,24, 0x00ce, "1A2A3b", 1, "", DEF_MODEC,DEF_MODEL }, - { "movmw", 14,24, 0x01ce, "1A2A3b", 2, "", DEF_MODEC,DEF_MODEL }, - { "movmd", 14,24, 0x03ce, "1A2A3b", 4, "", DEF_MODEC,DEF_MODEL }, - { "movqb", 7,16, 0x5c, "2I1q", 1, "", DEF_MODEC,DEF_MODEL }, - { "movqw", 7,16, 0x5d, "2I1q", 2, "", DEF_MODEC,DEF_MODEL }, - { "movqd", 7,16, 0x5f, "2I1q", 4, "", DEF_MODEC,DEF_MODEL }, - { "movsb", 16,24, 0x000e, "1S", 0, "[]", DEF_MODEC,DEF_MODEL }, - { "movsw", 16,24, 0x010e, "1S", 0, "[]", DEF_MODEC,DEF_MODEL }, - { "movsd", 16,24, 0x030e, "1S", 0, "[]", DEF_MODEC,DEF_MODEL }, - { "movst", 16,24, 0x800e, "1S", 0, "[]", DEF_MODEC,DEF_MODEL }, - { "movsub", 14,24, 0x0cae, "1A2A", 1, "", DEF_MODEC,DEF_MODEL }, - { "movsuw", 14,24, 0x0dae, "1A2A", 2, "", DEF_MODEC,DEF_MODEL }, - { "movsud", 14,24, 0x0fae, "1A2A", 4, "", DEF_MODEC,DEF_MODEL }, - { "movusb", 14,24, 0x1cae, "1A2A", 1, "", DEF_MODEC,DEF_MODEL }, - { "movusw", 14,24, 0x1dae, "1A2A", 2, "", DEF_MODEC,DEF_MODEL }, - { "movusd", 14,24, 0x1fae, "1A2A", 4, "", DEF_MODEC,DEF_MODEL }, - { "movxbd", 14,24, 0x1cce, "1B2I", 1, "", DEF_MODEC,DEF_MODEL }, - { "movxwd", 14,24, 0x1dce, "1W2I", 2, "", DEF_MODEC,DEF_MODEL }, - { "movxbw", 14,24, 0x10ce, "1B2I", 1, "", DEF_MODEC,DEF_MODEL }, - { "movzbd", 14,24, 0x18ce, "1B2I", 1, "", DEF_MODEC,DEF_MODEL }, - { "movzwd", 14,24, 0x19ce, "1W2I", 2, "", DEF_MODEC,DEF_MODEL }, - { "movzbw", 14,24, 0x14ce, "1B2I", 1, "", DEF_MODEC,DEF_MODEL }, - { "mulf", 14,24, 0x31be, "1F2Z", 4, "", DEF_MODEC,DEF_MODEL }, - { "mull", 14,24, 0x30be, "1L2Z", 8, "", DEF_MODEC,DEF_MODEL }, - { "mulb", 14,24, 0x20ce, "1B2I", 1, "", DEF_MODEC,DEF_MODEL }, - { "mulw", 14,24, 0x21ce, "1W2I", 2, "", DEF_MODEC,DEF_MODEL }, - { "muld", 14,24, 0x23ce, "1D2I", 4, "", DEF_MODEC,DEF_MODEL }, - { "negf", 14,24, 0x15be, "1F2Z", 4, "", DEF_MODEC,DEF_MODEL }, - { "negl", 14,24, 0x14be, "1L2Z", 8, "", DEF_MODEC,DEF_MODEL }, - { "negb", 14,24, 0x204e, "1B2I", 1, "", DEF_MODEC,DEF_MODEL }, - { "negw", 14,24, 0x214e, "1W2I", 2, "", DEF_MODEC,DEF_MODEL }, - { "negd", 14,24, 0x234e, "1D2I", 4, "", DEF_MODEC,DEF_MODEL }, - { "nop", 8,8, 0xa2, "", 0, "", DEF_MODEC,DEF_MODEL }, - { "notb", 14,24, 0x244e, "1B2I", 1, "", DEF_MODEC,DEF_MODEL }, - { "notw", 14,24, 0x254e, "1W2I", 2, "", DEF_MODEC,DEF_MODEL }, - { "notd", 14,24, 0x274e, "1D2I", 4, "", DEF_MODEC,DEF_MODEL }, - { "orb", 6,16, 0x18, "1B2I", 1, "", DEF_MODEC,DEF_MODEL }, - { "orw", 6,16, 0x19, "1W2I", 2, "", DEF_MODEC,DEF_MODEL }, - { "ord", 6,16, 0x1b, "1D2I", 4, "", DEF_MODEC,DEF_MODEL }, - { "quob", 14,24, 0x30ce, "1B2I", 1, "", DEF_MODEC,DEF_MODEL }, - { "quow", 14,24, 0x31ce, "1W2I", 2, "", DEF_MODEC,DEF_MODEL }, - { "quod", 14,24, 0x33ce, "1D2I", 4, "", DEF_MODEC,DEF_MODEL }, - { "rdval", 19,24, 0x0031e,"1A", 4, "", DEF_MODEC,DEF_MODEL }, - { "remb", 14,24, 0x34ce, "1B2I", 1, "", DEF_MODEC,DEF_MODEL }, - { "remw", 14,24, 0x35ce, "1W2I", 2, "", DEF_MODEC,DEF_MODEL }, - { "remd", 14,24, 0x37ce, "1D2I", 4, "", DEF_MODEC,DEF_MODEL }, - { "restore", 8,8, 0x72, "1u", 0, "", DEF_MODEC,DEF_MODEL }, - { "ret", 8,8, 0x12, "1d", 0, "", DEF_MODEC,DEF_MODEL }, - { "reti", 8,8, 0x52, "", 0, "", DEF_MODEC,DEF_MODEL }, - { "rett", 8,8, 0x42, "1d", 0, "", DEF_MODEC,DEF_MODEL }, - { "rotb", 14,24, 0x004e, "1B2I", 1, "", DEF_MODEC,DEF_MODEL }, - { "rotw", 14,24, 0x014e, "1B2I", 1, "", DEF_MODEC,DEF_MODEL }, - { "rotd", 14,24, 0x034e, "1B2I", 1, "", DEF_MODEC,DEF_MODEL }, - { "roundfb", 14,24, 0x243e, "1F2I", 4, "", DEF_MODEC,DEF_MODEL }, - { "roundfw", 14,24, 0x253e, "1F2I", 4, "", DEF_MODEC,DEF_MODEL }, - { "roundfd", 14,24, 0x273e, "1F2I", 4, "", DEF_MODEC,DEF_MODEL }, - { "roundlb", 14,24, 0x203e, "1L2I", 8, "", DEF_MODEC,DEF_MODEL }, - { "roundlw", 14,24, 0x213e, "1L2I", 8, "", DEF_MODEC,DEF_MODEL }, - { "roundld", 14,24, 0x233e, "1L2I", 8, "", DEF_MODEC,DEF_MODEL }, - { "rxp", 8,8, 0x32, "1d", 0, "", DEF_MODEC,DEF_MODEL }, - { "seqb", 11,16, 0x3c, "1B", 0, "", DEF_MODEC,DEF_MODEL }, - { "seqw", 11,16, 0x3d, "1W", 0, "", DEF_MODEC,DEF_MODEL }, - { "seqd", 11,16, 0x3f, "1D", 0, "", DEF_MODEC,DEF_MODEL }, - { "sneb", 11,16, 0xbc, "1B", 0, "", DEF_MODEC,DEF_MODEL }, - { "snew", 11,16, 0xbd, "1W", 0, "", DEF_MODEC,DEF_MODEL }, - { "sned", 11,16, 0xbf, "1D", 0, "", DEF_MODEC,DEF_MODEL }, - { "scsb", 11,16, 0x13c, "1B", 0, "", DEF_MODEC,DEF_MODEL }, - { "scsw", 11,16, 0x13d, "1W", 0, "", DEF_MODEC,DEF_MODEL }, - { "scsd", 11,16, 0x13f, "1D", 0, "", DEF_MODEC,DEF_MODEL }, - { "sccb", 11,16, 0x1bc, "1B", 0, "", DEF_MODEC,DEF_MODEL }, - { "sccw", 11,16, 0x1bd, "1W", 0, "", DEF_MODEC,DEF_MODEL }, - { "sccd", 11,16, 0x1bf, "1D", 0, "", DEF_MODEC,DEF_MODEL }, - { "shib", 11,16, 0x23c, "1B", 0, "", DEF_MODEC,DEF_MODEL }, - { "shiw", 11,16, 0x23d, "1W", 0, "", DEF_MODEC,DEF_MODEL }, - { "shid", 11,16, 0x23f, "1D", 0, "", DEF_MODEC,DEF_MODEL }, - { "slsb", 11,16, 0x2bc, "1B", 0, "", DEF_MODEC,DEF_MODEL }, - { "slsw", 11,16, 0x2bd, "1W", 0, "", DEF_MODEC,DEF_MODEL }, - { "slsd", 11,16, 0x2bf, "1D", 0, "", DEF_MODEC,DEF_MODEL }, - { "sgtb", 11,16, 0x33c, "1B", 0, "", DEF_MODEC,DEF_MODEL }, - { "sgtw", 11,16, 0x33d, "1W", 0, "", DEF_MODEC,DEF_MODEL }, - { "sgtd", 11,16, 0x33f, "1D", 0, "", DEF_MODEC,DEF_MODEL }, - { "sleb", 11,16, 0x3bc, "1B", 0, "", DEF_MODEC,DEF_MODEL }, - { "slew", 11,16, 0x3bd, "1W", 0, "", DEF_MODEC,DEF_MODEL }, - { "sled", 11,16, 0x3bf, "1D", 0, "", DEF_MODEC,DEF_MODEL }, - { "sfsb", 11,16, 0x43c, "1B", 0, "", DEF_MODEC,DEF_MODEL }, - { "sfsw", 11,16, 0x43d, "1W", 0, "", DEF_MODEC,DEF_MODEL }, - { "sfsd", 11,16, 0x43f, "1D", 0, "", DEF_MODEC,DEF_MODEL }, - { "sfcb", 11,16, 0x4bc, "1B", 0, "", DEF_MODEC,DEF_MODEL }, - { "sfcw", 11,16, 0x4bd, "1W", 0, "", DEF_MODEC,DEF_MODEL }, - { "sfcd", 11,16, 0x4bf, "1D", 0, "", DEF_MODEC,DEF_MODEL }, - { "slob", 11,16, 0x53c, "1B", 0, "", DEF_MODEC,DEF_MODEL }, - { "slow", 11,16, 0x53d, "1W", 0, "", DEF_MODEC,DEF_MODEL }, - { "slod", 11,16, 0x53f, "1D", 0, "", DEF_MODEC,DEF_MODEL }, - { "shsb", 11,16, 0x5bc, "1B", 0, "", DEF_MODEC,DEF_MODEL }, - { "shsw", 11,16, 0x5bd, "1W", 0, "", DEF_MODEC,DEF_MODEL }, - { "shsd", 11,16, 0x5bf, "1D", 0, "", DEF_MODEC,DEF_MODEL }, - { "sltb", 11,16, 0x63c, "1B", 0, "", DEF_MODEC,DEF_MODEL }, - { "sltw", 11,16, 0x63d, "1W", 0, "", DEF_MODEC,DEF_MODEL }, - { "sltd", 11,16, 0x63f, "1D", 0, "", DEF_MODEC,DEF_MODEL }, - { "sgeb", 11,16, 0x6bc, "1B", 0, "", DEF_MODEC,DEF_MODEL }, - { "sgew", 11,16, 0x6bd, "1W", 0, "", DEF_MODEC,DEF_MODEL }, - { "sged", 11,16, 0x6bf, "1D", 0, "", DEF_MODEC,DEF_MODEL }, - { "sutb", 11,16, 0x73c, "1B", 0, "", DEF_MODEC,DEF_MODEL }, - { "sutw", 11,16, 0x73d, "1W", 0, "", DEF_MODEC,DEF_MODEL }, - { "sutd", 11,16, 0x73f, "1D", 0, "", DEF_MODEC,DEF_MODEL }, - { "sufb", 11,16, 0x7bc, "1B", 0, "", DEF_MODEC,DEF_MODEL }, - { "sufw", 11,16, 0x7bd, "1W", 0, "", DEF_MODEC,DEF_MODEL }, - { "sufd", 11,16, 0x7bf, "1D", 0, "", DEF_MODEC,DEF_MODEL }, - { "save", 8,8, 0x62, "1U", 0, "", DEF_MODEC,DEF_MODEL }, - { "sbitb", 14,24, 0x184e, "1B2A", 1, "", DEF_MODEC,DEF_MODEL }, - { "sbitw", 14,24, 0x194e, "1W2A", 2, "", DEF_MODEC,DEF_MODEL }, - { "sbitd", 14,24, 0x1b4e, "1D2A", 4, "", DEF_MODEC,DEF_MODEL }, - { "sbitib", 14,24, 0x1c4e, "1B2A", 1, "", DEF_MODEC,DEF_MODEL }, - { "sbitiw", 14,24, 0x1d4e, "1W2A", 2, "", DEF_MODEC,DEF_MODEL }, - { "sbitid", 14,24, 0x1f4e, "1D2A", 4, "", DEF_MODEC,DEF_MODEL }, - { "setcfg", 15,24, 0x0b0e, "1O", 0, "", DEF_MODEC,DEF_MODEL }, - { "sfsr", 14,24, 0x373e, "1f", 0, "", DEF_MODEC,DEF_MODEL }, - { "skpsb", 16,24, 0x0c0e, "1S", 0, "[]", DEF_MODEC,DEF_MODEL }, - { "skpsw", 16,24, 0x0d0e, "1S", 0, "[]", DEF_MODEC,DEF_MODEL }, - { "skpsd", 16,24, 0x0f0e, "1S", 0, "[]", DEF_MODEC,DEF_MODEL }, - { "skpst", 16,24, 0x8c0e, "1S", 0, "[]", DEF_MODEC,DEF_MODEL }, - { "smr", 15,24, 0x0f1e, "2I1M", 4, "", DEF_MODEC,DEF_MODEL }, - { "sprb", 7,16, 0x2c, "2I1P", 1, "", DEF_MODEC,DEF_MODEL }, - { "sprw", 7,16, 0x2d, "2I1P", 2, "", DEF_MODEC,DEF_MODEL }, - { "sprd", 7,16, 0x2f, "2I1P", 4, "", DEF_MODEC,DEF_MODEL }, - { "subf", 14,24, 0x11be, "1F2Z", 4, "", DEF_MODEC,DEF_MODEL }, - { "subl", 14,24, 0x10be, "1L2Z", 8, "", DEF_MODEC,DEF_MODEL }, - { "subb", 6,16, 0x20, "1B2I", 1, "", DEF_MODEC,DEF_MODEL }, - { "subw", 6,16, 0x21, "1W2I", 2, "", DEF_MODEC,DEF_MODEL }, - { "subd", 6,16, 0x23, "1D2I", 4, "", DEF_MODEC,DEF_MODEL }, - { "subcb", 6,16, 0x30, "1B2I", 1, "", DEF_MODEC,DEF_MODEL }, - { "subcw", 6,16, 0x31, "1W2I", 2, "", DEF_MODEC,DEF_MODEL }, - { "subcd", 6,16, 0x33, "1D2I", 4, "", DEF_MODEC,DEF_MODEL }, - { "subpb", 14,24, 0x2c4e, "1B2I", 1, "", DEF_MODEC,DEF_MODEL }, - { "subpw", 14,24, 0x2d4e, "1W2I", 2, "", DEF_MODEC,DEF_MODEL }, - { "subpd", 14,24, 0x2f4e, "1D2I", 4, "", DEF_MODEC,DEF_MODEL }, -#ifdef NS32K_SVC_IMMED_OPERANDS - { "svc", 8,8, 0xe2, "2i1i", 1, "", DEF_MODEC,DEF_MODEL }, /* not really, but some unix uses it */ -#else - { "svc", 8,8, 0xe2, "", 0, "", DEF_MODEC,DEF_MODEL }, -#endif - { "tbitb", 6,16, 0x34, "1B2A", 1, "", DEF_MODEC,DEF_MODEL }, - { "tbitw", 6,16, 0x35, "1W2A", 2, "", DEF_MODEC,DEF_MODEL }, - { "tbitd", 6,16, 0x37, "1D2A", 4, "", DEF_MODEC,DEF_MODEL }, - { "truncfb", 14,24, 0x2c3e, "1F2I", 4, "", DEF_MODEC,DEF_MODEL }, - { "truncfw", 14,24, 0x2d3e, "1F2I", 4, "", DEF_MODEC,DEF_MODEL }, - { "truncfd", 14,24, 0x2f3e, "1F2I", 4, "", DEF_MODEC,DEF_MODEL }, - { "trunclb", 14,24, 0x283e, "1L2I", 8, "", DEF_MODEC,DEF_MODEL }, - { "trunclw", 14,24, 0x293e, "1L2I", 8, "", DEF_MODEC,DEF_MODEL }, - { "truncld", 14,24, 0x2b3e, "1L2I", 8, "", DEF_MODEC,DEF_MODEL }, - { "wait", 8,8, 0xb2, "", 0, "", DEF_MODEC,DEF_MODEL }, - { "wrval", 19,24, 0x0071e,"1A", 0, "", DEF_MODEC,DEF_MODEL }, - { "xorb", 6,16, 0x38, "1B2I", 1, "", DEF_MODEC,DEF_MODEL }, - { "xorw", 6,16, 0x39, "1W2I", 2, "", DEF_MODEC,DEF_MODEL }, - { "xord", 6,16, 0x3b, "1D2I", 4, "", DEF_MODEC,DEF_MODEL }, - { "dotf", 14,24, 0x0dfe, "1F2F", 4, "", DEF_MODEC,DEF_MODEL }, - { "dotl", 14,24, 0x0cfe, "1L2L", 8, "", DEF_MODEC,DEF_MODEL }, - { "logbf", 14,24, 0x15fe, "1F2Z", 4, "", DEF_MODEC,DEF_MODEL }, - { "logbl", 14,24, 0x14fe, "1L2Z", 8, "", DEF_MODEC,DEF_MODEL }, - { "polyf", 14,24, 0x09fe, "1F2F", 4, "", DEF_MODEC,DEF_MODEL }, - { "polyl", 14,24, 0x08fe, "1L2L", 8, "", DEF_MODEC,DEF_MODEL }, - { "scalbf", 14,24, 0x11fe, "1F2Z", 4, "", DEF_MODEC,DEF_MODEL }, - { "scalbl", 14,24, 0x10fe, "1L2Z", 8, "", DEF_MODEC,DEF_MODEL }, -}; - -static const int numopcodes=sizeof(ns32k_opcodes)/sizeof(ns32k_opcodes[0]); - -static const struct ns32k_opcode *const endop = ns32k_opcodes+sizeof(ns32k_opcodes)/sizeof(ns32k_opcodes[0]); - -#define MAX_ARGS 4 -#define ARG_LEN 50 - diff --git a/contrib/gdb/include/opcode/pn.h b/contrib/gdb/include/opcode/pn.h deleted file mode 100644 index 0f59a2a..0000000 --- a/contrib/gdb/include/opcode/pn.h +++ /dev/null @@ -1,282 +0,0 @@ -/* Print GOULD PN (PowerNode) instructions for GDB, the GNU debugger. - Copyright (C) 1986, 1987, 1989 Free Software Foundation, Inc. - -This file is part of GDB. - -GDB 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 1, or (at your option) -any later version. - -GDB 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 GDB; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -struct gld_opcode -{ - char *name; - unsigned long opcode; - unsigned long mask; - char *args; - int length; -}; - -/* We store four bytes of opcode for all opcodes because that - is the most any of them need. The actual length of an instruction - is always at least 2 bytes, and at most four. The length of the - instruction is based on the opcode. - - The mask component is a mask saying which bits must match - particular opcode in order for an instruction to be an instance - of that opcode. - - The args component is a string containing characters - that are used to format the arguments to the instruction. */ - -/* Kinds of operands: - r Register in first field - R Register in second field - b Base register in first field - B Base register in second field - v Vector register in first field - V Vector register in first field - A Optional address register (base register) - X Optional index register - I Immediate data (16bits signed) - O Offset field (16bits signed) - h Offset field (15bits signed) - d Offset field (14bits signed) - S Shift count field - - any other characters are printed as is... -*/ - -/* The assembler requires that this array be sorted as follows: - all instances of the same mnemonic must be consecutive. - All instances of the same mnemonic with the same number of operands - must be consecutive. - */ -struct gld_opcode gld_opcodes[] = -{ -{ "abm", 0xa0080000, 0xfc080000, "f,xOA,X", 4 }, -{ "abr", 0x18080000, 0xfc0c0000, "r,f", 2 }, -{ "aci", 0xfc770000, 0xfc7f8000, "r,I", 4 }, -{ "adfd", 0xe0080002, 0xfc080002, "r,xOA,X", 4 }, -{ "adfw", 0xe0080000, 0xfc080000, "r,xOA,X", 4 }, -{ "adi", 0xc8010000, 0xfc7f0000, "r,I", 4 }, -{ "admb", 0xb8080000, 0xfc080000, "r,xOA,X", 4 }, -{ "admd", 0xb8000002, 0xfc080002, "r,xOA,X", 4 }, -{ "admh", 0xb8000001, 0xfc080001, "r,xOA,X", 4 }, -{ "admw", 0xb8000000, 0xfc080000, "r,xOA,X", 4 }, -{ "adr", 0x38000000, 0xfc0f0000, "r,R", 2 }, -{ "adrfd", 0x38090000, 0xfc0f0000, "r,R", 2 }, -{ "adrfw", 0x38010000, 0xfc0f0000, "r,R", 2 }, -{ "adrm", 0x38080000, 0xfc0f0000, "r,R", 2 }, -{ "ai", 0xfc030000, 0xfc07ffff, "I", 4 }, -{ "anmb", 0x84080000, 0xfc080000, "r,xOA,X", 4 }, -{ "anmd", 0x84000002, 0xfc080002, "r,xOA,X", 4 }, -{ "anmh", 0x84000001, 0xfc080001, "r,xOA,X", 4 }, -{ "anmw", 0x84000000, 0xfc080000, "r,xOA,X", 4 }, -{ "anr", 0x04000000, 0xfc0f0000, "r,R", 2 }, -{ "armb", 0xe8080000, 0xfc080000, "r,xOA,X", 4 }, -{ "armd", 0xe8000002, 0xfc080002, "r,xOA,X", 4 }, -{ "armh", 0xe8000001, 0xfc080001, "r,xOA,X", 4 }, -{ "armw", 0xe8000000, 0xfc080000, "r,xOA,X", 4 }, -{ "bcf", 0xf0000000, 0xfc080000, "I,xOA,X", 4 }, -{ "bct", 0xec000000, 0xfc080000, "I,xOA,X", 4 }, -{ "bei", 0x00060000, 0xffff0000, "", 2 }, -{ "bft", 0xf0000000, 0xff880000, "xOA,X", 4 }, -{ "bib", 0xf4000000, 0xfc780000, "r,xOA", 4 }, -{ "bid", 0xf4600000, 0xfc780000, "r,xOA", 4 }, -{ "bih", 0xf4200000, 0xfc780000, "r,xOA", 4 }, -{ "biw", 0xf4400000, 0xfc780000, "r,xOA", 4 }, -{ "bl", 0xf8800000, 0xff880000, "xOA,X", 4 }, -{ "bsub", 0x5c080000, 0xff8f0000, "", 2 }, -{ "bsubm", 0x28080000, 0xfc080000, "", 4 }, -{ "bu", 0xec000000, 0xff880000, "xOA,X", 4 }, -{ "call", 0x28080000, 0xfc0f0000, "", 2 }, -{ "callm", 0x5c080000, 0xff880000, "", 4 }, -{ "camb", 0x90080000, 0xfc080000, "r,xOA,X", 4 }, -{ "camd", 0x90000002, 0xfc080002, "r,xOA,X", 4 }, -{ "camh", 0x90000001, 0xfc080001, "r,xOA,X", 4 }, -{ "camw", 0x90000000, 0xfc080000, "r.xOA,X", 4 }, -{ "car", 0x10000000, 0xfc0f0000, "r,R", 2 }, -{ "cd", 0xfc060000, 0xfc070000, "r,f", 4 }, -{ "cea", 0x000f0000, 0xffff0000, "", 2 }, -{ "ci", 0xc8050000, 0xfc7f0000, "r,I", 4 }, -{ "cmc", 0x040a0000, 0xfc7f0000, "r", 2 }, -{ "cmmb", 0x94080000, 0xfc080000, "r,xOA,X", 4 }, -{ "cmmd", 0x94000002, 0xfc080002, "r,xOA,X", 4 }, -{ "cmmh", 0x94000001, 0xfc080001, "r,xOA,X", 4 }, -{ "cmmw", 0x94000000, 0xfc080000, "r,xOA,X", 4 }, -{ "cmr", 0x14000000, 0xfc0f0000, "r,R", 2 }, -{ "daci", 0xfc7f0000, 0xfc7f8000, "r,I", 4 }, -{ "dae", 0x000e0000, 0xffff0000, "", 2 }, -{ "dai", 0xfc040000, 0xfc07ffff, "I", 4 }, -{ "dci", 0xfc6f0000, 0xfc7f8000, "r,I", 4 }, -{ "di", 0xfc010000, 0xfc07ffff, "I", 4 }, -{ "dvfd", 0xe4000002, 0xfc080002, "r,xOA,X", 4 }, -{ "dvfw", 0xe4000000, 0xfc080000, "r,xOA,X", 4 }, -{ "dvi", 0xc8040000, 0xfc7f0000, "r,I", 4 }, -{ "dvmb", 0xc4080000, 0xfc080000, "r,xOA,X", 4 }, -{ "dvmh", 0xc4000001, 0xfc080001, "r,xOA,X", 4 }, -{ "dvmw", 0xc4000000, 0xfc080000, "r,xOA,X", 4 }, -{ "dvr", 0x380a0000, 0xfc0f0000, "r,R", 2 }, -{ "dvrfd", 0x380c0000, 0xfc0f0000, "r,R", 4 }, -{ "dvrfw", 0x38040000, 0xfc0f0000, "r,xOA,X", 4 }, -{ "eae", 0x00080000, 0xffff0000, "", 2 }, -{ "eci", 0xfc670000, 0xfc7f8080, "r,I", 4 }, -{ "ecwcs", 0xfc4f0000, 0xfc7f8000, "", 4 }, -{ "ei", 0xfc000000, 0xfc07ffff, "I", 4 }, -{ "eomb", 0x8c080000, 0xfc080000, "r,xOA,X", 4 }, -{ "eomd", 0x8c000002, 0xfc080002, "r,xOA,X", 4 }, -{ "eomh", 0x8c000001, 0xfc080001, "r,xOA,X", 4 }, -{ "eomw", 0x8c000000, 0xfc080000, "r,xOA,X", 4 }, -{ "eor", 0x0c000000, 0xfc0f0000, "r,R", 2 }, -{ "eorm", 0x0c080000, 0xfc0f0000, "r,R", 2 }, -{ "es", 0x00040000, 0xfc7f0000, "r", 2 }, -{ "exm", 0xa8000000, 0xff880000, "xOA,X", 4 }, -{ "exr", 0xc8070000, 0xfc7f0000, "r", 2 }, -{ "exrr", 0xc8070002, 0xfc7f0002, "r", 2 }, -{ "fixd", 0x380d0000, 0xfc0f0000, "r,R", 2 }, -{ "fixw", 0x38050000, 0xfc0f0000, "r,R", 2 }, -{ "fltd", 0x380f0000, 0xfc0f0000, "r,R", 2 }, -{ "fltw", 0x38070000, 0xfc0f0000, "r,R", 2 }, -{ "grio", 0xfc3f0000, 0xfc7f8000, "r,I", 4 }, -{ "halt", 0x00000000, 0xffff0000, "", 2 }, -{ "hio", 0xfc370000, 0xfc7f8000, "r,I", 4 }, -{ "jwcs", 0xfa080000, 0xff880000, "xOA,X", 4 }, -{ "la", 0x50000000, 0xfc000000, "r,xOA,X", 4 }, -{ "labr", 0x58080000, 0xfc080000, "b,xOA,X", 4 }, -{ "lb", 0xac080000, 0xfc080000, "r,xOA,X", 4 }, -{ "lcs", 0x00030000, 0xfc7f0000, "r", 2 }, -{ "ld", 0xac000002, 0xfc080002, "r,xOA,X", 4 }, -{ "lear", 0x80000000, 0xfc080000, "r,xOA,X", 4 }, -{ "lf", 0xcc000000, 0xfc080000, "r,xOA,X", 4 }, -{ "lfbr", 0xcc080000, 0xfc080000, "b,xOA,X", 4 }, -{ "lh", 0xac000001, 0xfc080001, "r,xOA,X", 4 }, -{ "li", 0xc8000000, 0xfc7f0000, "r,I", 4 }, -{ "lmap", 0x2c070000, 0xfc7f0000, "r", 2 }, -{ "lmb", 0xb0080000, 0xfc080000, "r,xOA,X", 4 }, -{ "lmd", 0xb0000002, 0xfc080002, "r,xOA,X", 4 }, -{ "lmh", 0xb0000001, 0xfc080001, "r,xOA,X", 4 }, -{ "lmw", 0xb0000000, 0xfc080000, "r,xOA,X", 4 }, -{ "lnb", 0xb4080000, 0xfc080000, "r,xOA,X", 4 }, -{ "lnd", 0xb4000002, 0xfc080002, "r,xOA,X", 4 }, -{ "lnh", 0xb4000001, 0xfc080001, "r,xOA,X", 4 }, -{ "lnw", 0xb4000000, 0xfc080000, "r,xOA,X", 4 }, -{ "lpsd", 0xf9800000, 0xff880000, "r,xOA,X", 4 }, -{ "lpsdcm", 0xfa800000, 0xff880000, "r,xOA,X", 4 }, -{ "lw", 0xac000000, 0xfc080000, "r,xOA,X", 4 }, -{ "lwbr", 0x5c000000, 0xfc080000, "b,xOA,X", 4 }, -{ "mpfd", 0xe4080002, 0xfc080002, "r,xOA,X", 4 }, -{ "mpfw", 0xe4080000, 0xfc080000, "r,xOA,X", 4 }, -{ "mpi", 0xc8030000, 0xfc7f0000, "r,I", 4 }, -{ "mpmb", 0xc0080000, 0xfc080000, "r,xOA,X", 4 }, -{ "mpmh", 0xc0000001, 0xfc080001, "r,xOA,X", 4 }, -{ "mpmw", 0xc0000000, 0xfc080000, "r,xOA,X", 4 }, -{ "mpr", 0x38020000, 0xfc0f0000, "r,R", 2 }, -{ "mprfd", 0x380e0000, 0xfc0f0000, "r,R", 2 }, -{ "mprfw", 0x38060000, 0xfc0f0000, "r,R", 2 }, -{ "nop", 0x00020000, 0xffff0000, "", 2 }, -{ "ormb", 0x88080000, 0xfc080000, "r,xOA,X", 4 }, -{ "ormd", 0x88000002, 0xfc080002, "r,xOA,X", 4 }, -{ "ormh", 0x88000001, 0xfc080001, "r,xOA,X", 4 }, -{ "ormw", 0x88000000, 0xfc080000, "r,xOA,X", 4 }, -{ "orr", 0x08000000, 0xfc0f0000, "r,R", 2 }, -{ "orrm", 0x08080000, 0xfc0f0000, "r,R", 2 }, -{ "rdsts", 0x00090000, 0xfc7f0000, "r", 2 }, -{ "return", 0x280e0000, 0xfc7f0000, "", 2 }, -{ "ri", 0xfc020000, 0xfc07ffff, "I", 4 }, -{ "rnd", 0x00050000, 0xfc7f0000, "r", 2 }, -{ "rpswt", 0x040b0000, 0xfc7f0000, "r", 2 }, -{ "rschnl", 0xfc2f0000, 0xfc7f8000, "r,I", 4 }, -{ "rsctl", 0xfc470000, 0xfc7f8000, "r,I", 4 }, -{ "rwcs", 0x000b0000, 0xfc0f0000, "r,R", 2 }, -{ "sacz", 0x10080000, 0xfc0f0000, "r,R", 2 }, -{ "sbm", 0x98080000, 0xfc080000, "f,xOA,X", 4 }, -{ "sbr", 0x18000000, 0xfc0c0000, "r,f", 4 }, -{ "sea", 0x000d0000, 0xffff0000, "", 2 }, -{ "setcpu", 0x2c090000, 0xfc7f0000, "r", 2 }, -{ "sio", 0xfc170000, 0xfc7f8000, "r,I", 4 }, -{ "sipu", 0x000a0000, 0xffff0000, "", 2 }, -{ "sla", 0x1c400000, 0xfc600000, "r,S", 2 }, -{ "slad", 0x20400000, 0xfc600000, "r,S", 2 }, -{ "slc", 0x24400000, 0xfc600000, "r,S", 2 }, -{ "sll", 0x1c600000, 0xfc600000, "r,S", 2 }, -{ "slld", 0x20600000, 0xfc600000, "r,S", 2 }, -{ "smc", 0x04070000, 0xfc070000, "", 2 }, -{ "sra", 0x1c000000, 0xfc600000, "r,S", 2 }, -{ "srad", 0x20000000, 0xfc600000, "r,S", 2 }, -{ "src", 0x24000000, 0xfc600000, "r,S", 2 }, -{ "srl", 0x1c200000, 0xfc600000, "r,S", 2 }, -{ "srld", 0x20200000, 0xfc600000, "r,S", 2 }, -{ "stb", 0xd4080000, 0xfc080000, "r,xOA,X", 4 }, -{ "std", 0xd4000002, 0xfc080002, "r,xOA,X", 4 }, -{ "stf", 0xdc000000, 0xfc080000, "r,xOA,X", 4 }, -{ "stfbr", 0x54000000, 0xfc080000, "b,xOA,X", 4 }, -{ "sth", 0xd4000001, 0xfc080001, "r,xOA,X", 4 }, -{ "stmb", 0xd8080000, 0xfc080000, "r,xOA,X", 4 }, -{ "stmd", 0xd8000002, 0xfc080002, "r,xOA,X", 4 }, -{ "stmh", 0xd8000001, 0xfc080001, "r,xOA,X", 4 }, -{ "stmw", 0xd8000000, 0xfc080000, "r,xOA,X", 4 }, -{ "stpio", 0xfc270000, 0xfc7f8000, "r,I", 4 }, -{ "stw", 0xd4000000, 0xfc080000, "r,xOA,X", 4 }, -{ "stwbr", 0x54000000, 0xfc080000, "b,xOA,X", 4 }, -{ "suabr", 0x58000000, 0xfc080000, "b,xOA,X", 4 }, -{ "sufd", 0xe0000002, 0xfc080002, "r,xOA,X", 4 }, -{ "sufw", 0xe0000000, 0xfc080000, "r,xOA,X", 4 }, -{ "sui", 0xc8020000, 0xfc7f0000, "r,I", 4 }, -{ "sumb", 0xbc080000, 0xfc080000, "r,xOA,X", 4 }, -{ "sumd", 0xbc000002, 0xfc080002, "r,xOA,X", 4 }, -{ "sumh", 0xbc000001, 0xfc080001, "r,xOA,X", 4 }, -{ "sumw", 0xbc000000, 0xfc080000, "r,xOA,X", 4 }, -{ "sur", 0x3c000000, 0xfc0f0000, "r,R", 2 }, -{ "surfd", 0x380b0000, 0xfc0f0000, "r,xOA,X", 4 }, -{ "surfw", 0x38030000, 0xfc0f0000, "r,R", 2 }, -{ "surm", 0x3c080000, 0xfc0f0000, "r,R", 2 }, -{ "svc", 0xc8060000, 0xffff0000, "", 4 }, -{ "tbm", 0xa4080000, 0xfc080000, "f,xOA,X", 4 }, -{ "tbr", 0x180c0000, 0xfc0c0000, "r,f", 2 }, -{ "tbrr", 0x2c020000, 0xfc0f0000, "r,B", 2 }, -{ "tccr", 0x28040000, 0xfc7f0000, "", 2 }, -{ "td", 0xfc050000, 0xfc070000, "r,f", 4 }, -{ "tio", 0xfc1f0000, 0xfc7f8000, "r,I", 4 }, -{ "tmapr", 0x2c0a0000, 0xfc0f0000, "r,R", 2 }, -{ "tpcbr", 0x280c0000, 0xfc7f0000, "r", 2 }, -{ "trbr", 0x2c010000, 0xfc0f0000, "b,R", 2 }, -{ "trc", 0x2c030000, 0xfc0f0000, "r,R", 2 }, -{ "trcc", 0x28050000, 0xfc7f0000, "", 2 }, -{ "trcm", 0x2c0b0000, 0xfc0f0000, "r,R", 2 }, -{ "trn", 0x2c040000, 0xfc0f0000, "r,R", 2 }, -{ "trnm", 0x2c0c0000, 0xfc0f0000, "r,R", 2 }, -{ "trr", 0x2c000000, 0xfc0f0000, "r,R", 2 }, -{ "trrm", 0x2c080000, 0xfc0f0000, "r,R", 2 }, -{ "trsc", 0x2c0e0000, 0xfc0f0000, "r,R", 2 }, -{ "trsw", 0x28000000, 0xfc7f0000, "r", 2 }, -{ "tscr", 0x2c0f0000, 0xfc0f0000, "r,R", 2 }, -{ "uei", 0x00070000, 0xffff0000, "", 2 }, -{ "wait", 0x00010000, 0xffff0000, "", 2 }, -{ "wcwcs", 0xfc5f0000, 0xfc7f8000, "", 4 }, -{ "wwcs", 0x000c0000, 0xfc0f0000, "r,R", 2 }, -{ "xcbr", 0x28020000, 0xfc0f0000, "b,B", 2 }, -{ "xcr", 0x2c050000, 0xfc0f0000, "r,R", 2 }, -{ "xcrm", 0x2c0d0000, 0xfc0f0000, "r,R", 2 }, -{ "zbm", 0x9c080000, 0xfc080000, "f,xOA,X", 4 }, -{ "zbr", 0x18040000, 0xfc0c0000, "r,f", 2 }, -{ "zmb", 0xf8080000, 0xfc080000, "r,xOA,X", 4 }, -{ "zmd", 0xf8000002, 0xfc080002, "r,xOA,X", 4 }, -{ "zmh", 0xf8000001, 0xfc080001, "r,xOA,X", 4 }, -{ "zmw", 0xf8000000, 0xfc080000, "r,xOA,X", 4 }, -{ "zr", 0x0c000000, 0xfc0f0000, "r", 2 }, -}; - -int numopcodes = sizeof(gld_opcodes) / sizeof(gld_opcodes[0]); - -struct gld_opcode *endop = gld_opcodes + sizeof(gld_opcodes) / - sizeof(gld_opcodes[0]); diff --git a/contrib/gdb/include/opcode/ppc.h b/contrib/gdb/include/opcode/ppc.h deleted file mode 100644 index a9e3b24..0000000 --- a/contrib/gdb/include/opcode/ppc.h +++ /dev/null @@ -1,248 +0,0 @@ -/* ppc.h -- Header file for PowerPC opcode table - Copyright 1994, 1995 Free Software Foundation, Inc. - Written by Ian Lance Taylor, Cygnus Support - -This file is part of GDB, GAS, and the GNU binutils. - -GDB, GAS, and the GNU binutils are free software; you can redistribute -them and/or modify them under the terms of the GNU General Public -License as published by the Free Software Foundation; either version -1, or (at your option) any later version. - -GDB, GAS, and the GNU binutils are distributed in the hope that they -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 file; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#ifndef PPC_H -#define PPC_H - -/* The opcode table is an array of struct powerpc_opcode. */ - -struct powerpc_opcode -{ - /* The opcode name. */ - const char *name; - - /* The opcode itself. Those bits which will be filled in with - operands are zeroes. */ - unsigned long opcode; - - /* The opcode mask. This is used by the disassembler. This is a - mask containing ones indicating those bits which must match the - opcode field, and zeroes indicating those bits which need not - match (and are presumably filled in by operands). */ - unsigned long mask; - - /* One bit flags for the opcode. These are used to indicate which - specific processors support the instructions. The defined values - are listed below. */ - unsigned long flags; - - /* An array of operand codes. Each code is an index into the - operand table. They appear in the order which the operands must - appear in assembly code, and are terminated by a zero. */ - unsigned char operands[8]; -}; - -/* The table itself is sorted by major opcode number, and is otherwise - in the order in which the disassembler should consider - instructions. */ -extern const struct powerpc_opcode powerpc_opcodes[]; -extern const int powerpc_num_opcodes; - -/* Values defined for the flags field of a struct powerpc_opcode. */ - -/* Opcode is defined for the PowerPC architecture. */ -#define PPC_OPCODE_PPC (01) - -/* Opcode is defined for the POWER (RS/6000) architecture. */ -#define PPC_OPCODE_POWER (02) - -/* Opcode is defined for the POWER2 (Rios 2) architecture. */ -#define PPC_OPCODE_POWER2 (04) - -/* Opcode is only defined on 32 bit architectures. */ -#define PPC_OPCODE_32 (010) - -/* Opcode is only defined on 64 bit architectures. */ -#define PPC_OPCODE_64 (020) - -/* Opcode is supported by the Motorola PowerPC 601 processor. The 601 - is assumed to support all PowerPC (PPC_OPCODE_PPC) instructions, - but it also supports many additional POWER instructions. */ -#define PPC_OPCODE_601 (040) - -/* Opcode is supported in both the Power and PowerPC architectures - (ie, compiler's -mcpu=common or assembler's -mcom). */ -#define PPC_OPCODE_COMMON (0100) - -/* Opcode is supported for any Power or PowerPC platform (this is - for the assembler's -many option, and it eliminates duplicates). */ -#define PPC_OPCODE_ANY (0200) - -/* A macro to extract the major opcode from an instruction. */ -#define PPC_OP(i) (((i) >> 26) & 0x3f) - -/* The operands table is an array of struct powerpc_operand. */ - -struct powerpc_operand -{ - /* The number of bits in the operand. */ - int bits; - - /* How far the operand is left shifted in the instruction. */ - int shift; - - /* Insertion function. This is used by the assembler. To insert an - operand value into an instruction, check this field. - - If it is NULL, execute - i |= (op & ((1 << o->bits) - 1)) << o->shift; - (i is the instruction which we are filling in, o is a pointer to - this structure, and op is the opcode value; this assumes twos - complement arithmetic). - - If this field is not NULL, then simply call it with the - instruction and the operand value. It will return the new value - of the instruction. If the ERRMSG argument is not NULL, then if - the operand value is illegal, *ERRMSG will be set to a warning - string (the operand will be inserted in any case). If the - operand value is legal, *ERRMSG will be unchanged (most operands - can accept any value). */ - unsigned long (*insert) PARAMS ((unsigned long instruction, long op, - const char **errmsg)); - - /* Extraction function. This is used by the disassembler. To - extract this operand type from an instruction, check this field. - - If it is NULL, compute - op = ((i) >> o->shift) & ((1 << o->bits) - 1); - if ((o->flags & PPC_OPERAND_SIGNED) != 0 - && (op & (1 << (o->bits - 1))) != 0) - op -= 1 << o->bits; - (i is the instruction, o is a pointer to this structure, and op - is the result; this assumes twos complement arithmetic). - - If this field is not NULL, then simply call it with the - instruction value. It will return the value of the operand. If - the INVALID argument is not NULL, *INVALID will be set to - non-zero if this operand type can not actually be extracted from - this operand (i.e., the instruction does not match). If the - operand is valid, *INVALID will not be changed. */ - long (*extract) PARAMS ((unsigned long instruction, int *invalid)); - - /* One bit syntax flags. */ - unsigned long flags; -}; - -/* Elements in the table are retrieved by indexing with values from - the operands field of the powerpc_opcodes table. */ - -extern const struct powerpc_operand powerpc_operands[]; - -/* Values defined for the flags field of a struct powerpc_operand. */ - -/* This operand takes signed values. */ -#define PPC_OPERAND_SIGNED (01) - -/* This operand takes signed values, but also accepts a full positive - range of values when running in 32 bit mode. That is, if bits is - 16, it takes any value from -0x8000 to 0xffff. In 64 bit mode, - this flag is ignored. */ -#define PPC_OPERAND_SIGNOPT (02) - -/* This operand does not actually exist in the assembler input. This - is used to support extended mnemonics such as mr, for which two - operands fields are identical. The assembler should call the - insert function with any op value. The disassembler should call - the extract function, ignore the return value, and check the value - placed in the valid argument. */ -#define PPC_OPERAND_FAKE (04) - -/* The next operand should be wrapped in parentheses rather than - separated from this one by a comma. This is used for the load and - store instructions which want their operands to look like - reg,displacement(reg) - */ -#define PPC_OPERAND_PARENS (010) - -/* This operand may use the symbolic names for the CR fields, which - are - lt 0 gt 1 eq 2 so 3 un 3 - cr0 0 cr1 1 cr2 2 cr3 3 - cr4 4 cr5 5 cr6 6 cr7 7 - These may be combined arithmetically, as in cr2*4+gt. These are - only supported on the PowerPC, not the POWER. */ -#define PPC_OPERAND_CR (020) - -/* This operand names a register. The disassembler uses this to print - register names with a leading 'r'. */ -#define PPC_OPERAND_GPR (040) - -/* This operand names a floating point register. The disassembler - prints these with a leading 'f'. */ -#define PPC_OPERAND_FPR (0100) - -/* This operand is a relative branch displacement. The disassembler - prints these symbolically if possible. */ -#define PPC_OPERAND_RELATIVE (0200) - -/* This operand is an absolute branch address. The disassembler - prints these symbolically if possible. */ -#define PPC_OPERAND_ABSOLUTE (0400) - -/* This operand is optional, and is zero if omitted. This is used for - the optional BF and L fields in the comparison instructions. The - assembler must count the number of operands remaining on the line, - and the number of operands remaining for the opcode, and decide - whether this operand is present or not. The disassembler should - print this operand out only if it is not zero. */ -#define PPC_OPERAND_OPTIONAL (01000) - -/* This flag is only used with PPC_OPERAND_OPTIONAL. If this operand - is omitted, then for the next operand use this operand value plus - 1, ignoring the next operand field for the opcode. This wretched - hack is needed because the Power rotate instructions can take - either 4 or 5 operands. The disassembler should print this operand - out regardless of the PPC_OPERAND_OPTIONAL field. */ -#define PPC_OPERAND_NEXT (02000) - -/* This operand should be regarded as a negative number for the - purposes of overflow checking (i.e., the normal most negative - number is disallowed and one more than the normal most positive - number is allowed). This flag will only be set for a signed - operand. */ -#define PPC_OPERAND_NEGATIVE (04000) - -/* The POWER and PowerPC assemblers use a few macros. We keep them - with the operands table for simplicity. The macro table is an - array of struct powerpc_macro. */ - -struct powerpc_macro -{ - /* The macro name. */ - const char *name; - - /* The number of operands the macro takes. */ - unsigned int operands; - - /* One bit flags for the opcode. These are used to indicate which - specific processors support the instructions. The values are the - same as those for the struct powerpc_opcode flags field. */ - unsigned long flags; - - /* A format string to turn the macro into a normal instruction. - Each %N in the string is replaced with operand number N (zero - based). */ - const char *format; -}; - -extern const struct powerpc_macro powerpc_macros[]; -extern const int powerpc_num_macros; - -#endif /* PPC_H */ diff --git a/contrib/gdb/include/opcode/pyr.h b/contrib/gdb/include/opcode/pyr.h deleted file mode 100644 index 06632b8..0000000 --- a/contrib/gdb/include/opcode/pyr.h +++ /dev/null @@ -1,287 +0,0 @@ -/* pyramid.opcode.h -- gdb initial attempt. */ - -/* pyramid opcode table: wot to do with this - particular opcode */ - -struct pyr_datum -{ - char nargs; - char * args; /* how to compile said opcode */ - unsigned long mask; /* Bit vector: which operand modes are valid - for this opcode */ - unsigned char code; /* op-code (always 6(?) bits */ -}; - -typedef struct pyr_insn_format { - unsigned int mode :4; - unsigned int operator :8; - unsigned int index_scale :2; - unsigned int index_reg :6; - unsigned int operand_1 :6; - unsigned int operand_2:6; -} pyr_insn_format; - - -/* We store four bytes of opcode for all opcodes. - Pyramid is sufficiently RISCy that: - - insns are always an integral number of words; - - the length of any insn can be told from the first word of - the insn. (ie, if there are zero, one, or two words of - immediate operand/offset). - - - The args component is a string containing two characters for each - operand of the instruction. The first specifies the kind of operand; - the second, the place it is stored. */ - -/* Kinds of operands: - mask assembler syntax description - 0x0001: movw Rn,Rn register to register - 0x0002: movw K,Rn quick immediate to register - 0x0004: movw I,Rn long immediate to register - 0x0008: movw (Rn),Rn register indirect to register - movw (Rn)[x],Rn register indirect to register - 0x0010: movw I(Rn),Rn offset register indirect to register - movw I(Rn)[x],Rn offset register indirect, indexed, to register - - 0x0020: movw Rn,(Rn) register to register indirect - 0x0040: movw K,(Rn) quick immediate to register indirect - 0x0080: movw I,(Rn) long immediate to register indirect - 0x0100: movw (Rn),(Rn) register indirect to-register indirect - 0x0100: movw (Rn),(Rn) register indirect to-register indirect - 0x0200: movw I(Rn),(Rn) register indirect+offset to register indirect - 0x0200: movw I(Rn),(Rn) register indirect+offset to register indirect - - 0x0400: movw Rn,I(Rn) register to register indirect+offset - 0x0800: movw K,I(Rn) quick immediate to register indirect+offset - 0x1000: movw I,I(Rn) long immediate to register indirect+offset - 0x1000: movw (Rn),I(Rn) register indirect to-register indirect+offset - 0x1000: movw I(Rn),I(Rn) register indirect+offset to register indirect - +offset - 0x0000: (irregular) ??? - - - Each insn has a four-bit field encoding the type(s) of its operands. -*/ - -/* Some common combinations - */ - -/* the first 5,(0x1|0x2|0x4|0x8|0x10) ie (1|2|4|8|16), ie ( 32 -1)*/ -#define GEN_TO_REG (31) - -#define UNKNOWN ((unsigned long)-1) -#define ANY (GEN_TO_REG | (GEN_TO_REG << 5) | (GEN_TO_REG << 15)) - -#define CONVERT (1|8|0x10|0x20|0x200) - -#define K_TO_REG (2) -#define I_TO_REG (4) -#define NOTK_TO_REG (GEN_TO_REG & ~K_TO_REG) -#define NOTI_TO_REG (GEN_TO_REG & ~I_TO_REG) - -/* The assembler requires that this array be sorted as follows: - all instances of the same mnemonic must be consecutive. - All instances of the same mnemonic with the same number of operands - must be consecutive. - */ - -struct pyr_opcode /* pyr opcode text */ -{ - char * name; /* opcode name: lowercase string [key] */ - struct pyr_datum datum; /* rest of opcode table [datum] */ -}; - -#define pyr_how args -#define pyr_nargs nargs -#define pyr_mask mask -#define pyr_name name - -struct pyr_opcode pyr_opcodes[] = -{ - {"movb", { 2, "", UNKNOWN, 0x11}, }, - {"movh", { 2, "", UNKNOWN, 0x12} }, - {"movw", { 2, "", ANY, 0x10} }, - {"movl", { 2, "", ANY, 0x13} }, - {"mnegw", { 2, "", (0x1|0x8|0x10), 0x14} }, - {"mnegf", { 2, "", 0x1, 0x15} }, - {"mnegd", { 2, "", 0x1, 0x16} }, - {"mcomw", { 2, "", (0x1|0x8|0x10), 0x17} }, - {"mabsw", { 2, "", (0x1|0x8|0x10), 0x18} }, - {"mabsf", { 2, "", 0x1, 0x19} }, - {"mabsd", { 2, "", 0x1, 0x1a} }, - {"mtstw", { 2, "", (0x1|0x8|0x10), 0x1c} }, - {"mtstf", { 2, "", 0x1, 0x1d} }, - {"mtstd", { 2, "", 0x1, 0x1e} }, - {"mova", { 2, "", 0x8|0x10, 0x1f} }, - {"movzbw", { 2, "", (0x1|0x8|0x10), 0x20} }, - {"movzhw", { 2, "", (0x1|0x8|0x10), 0x21} }, - /* 2 insns out of order here */ - {"movbl", { 2, "", 1, 0x4f} }, - {"filbl", { 2, "", 1, 0x4e} }, - - {"cvtbw", { 2, "", CONVERT, 0x22} }, - {"cvthw", { 2, "", CONVERT, 0x23} }, - {"cvtwb", { 2, "", CONVERT, 0x24} }, - {"cvtwh", { 2, "", CONVERT, 0x25} }, - {"cvtwf", { 2, "", CONVERT, 0x26} }, - {"cvtwd", { 2, "", CONVERT, 0x27} }, - {"cvtfw", { 2, "", CONVERT, 0x28} }, - {"cvtfd", { 2, "", CONVERT, 0x29} }, - {"cvtdw", { 2, "", CONVERT, 0x2a} }, - {"cvtdf", { 2, "", CONVERT, 0x2b} }, - - {"addw", { 2, "", GEN_TO_REG, 0x40} }, - {"addwc", { 2, "", GEN_TO_REG, 0x41} }, - {"subw", { 2, "", GEN_TO_REG, 0x42} }, - {"subwb", { 2, "", GEN_TO_REG, 0x43} }, - {"rsubw", { 2, "", GEN_TO_REG, 0x44} }, - {"mulw", { 2, "", GEN_TO_REG, 0x45} }, - {"emul", { 2, "", GEN_TO_REG, 0x47} }, - {"umulw", { 2, "", GEN_TO_REG, 0x46} }, - {"divw", { 2, "", GEN_TO_REG, 0x48} }, - {"ediv", { 2, "", GEN_TO_REG, 0x4a} }, - {"rdivw", { 2, "", GEN_TO_REG, 0x4b} }, - {"udivw", { 2, "", GEN_TO_REG, 0x49} }, - {"modw", { 2, "", GEN_TO_REG, 0x4c} }, - {"umodw", { 2, "", GEN_TO_REG, 0x4d} }, - - - {"addf", { 2, "", 1, 0x50} }, - {"addd", { 2, "", 1, 0x51} }, - {"subf", { 2, "", 1, 0x52} }, - {"subd", { 2, "", 1, 0x53} }, - {"mulf", { 2, "", 1, 0x56} }, - {"muld", { 2, "", 1, 0x57} }, - {"divf", { 2, "", 1, 0x58} }, - {"divd", { 2, "", 1, 0x59} }, - - - {"cmpb", { 2, "", UNKNOWN, 0x61} }, - {"cmph", { 2, "", UNKNOWN, 0x62} }, - {"cmpw", { 2, "", UNKNOWN, 0x60} }, - {"ucmpb", { 2, "", UNKNOWN, 0x66} }, - /* WHY no "ucmph"??? */ - {"ucmpw", { 2, "", UNKNOWN, 0x65} }, - {"xchw", { 2, "", UNKNOWN, 0x0f} }, - - - {"andw", { 2, "", GEN_TO_REG, 0x30} }, - {"orw", { 2, "", GEN_TO_REG, 0x31} }, - {"xorw", { 2, "", GEN_TO_REG, 0x32} }, - {"bicw", { 2, "", GEN_TO_REG, 0x33} }, - {"lshlw", { 2, "", GEN_TO_REG, 0x38} }, - {"ashlw", { 2, "", GEN_TO_REG, 0x3a} }, - {"ashll", { 2, "", GEN_TO_REG, 0x3c} }, - {"ashrw", { 2, "", GEN_TO_REG, 0x3b} }, - {"ashrl", { 2, "", GEN_TO_REG, 0x3d} }, - {"rotlw", { 2, "", GEN_TO_REG, 0x3e} }, - {"rotrw", { 2, "", GEN_TO_REG, 0x3f} }, - - /* push and pop insns are "going away next release". */ - {"pushw", { 2, "", GEN_TO_REG, 0x0c} }, - {"popw", { 2, "", (0x1|0x8|0x10), 0x0d} }, - {"pusha", { 2, "", (0x8|0x10), 0x0e} }, - - {"bitsw", { 2, "", UNKNOWN, 0x35} }, - {"bitcw", { 2, "", UNKNOWN, 0x36} }, - /* some kind of ibra/dbra insns??*/ - {"icmpw", { 2, "", UNKNOWN, 0x67} }, - {"dcmpw", { 2, "", (1|4|0x20|0x80|0x400|0x1000), 0x69} },/*FIXME*/ - {"acmpw", { 2, "", 1, 0x6b} }, - - /* Call is written as a 1-op insn, but is always (dis)assembled as a 2-op - insn with a 2nd op of tr14. The assembler will have to grok this. */ - {"call", { 2, "", GEN_TO_REG, 0x04} }, - {"call", { 1, "", GEN_TO_REG, 0x04} }, - - {"callk", { 1, "", UNKNOWN, 0x06} },/* system call?*/ - /* Ret is usually written as a 0-op insn, but gets disassembled as a - 1-op insn. The operand is always tr15. */ - {"ret", { 0, "", UNKNOWN, 0x09} }, - {"ret", { 1, "", UNKNOWN, 0x09} }, - {"adsf", { 2, "", (1|2|4), 0x08} }, - {"retd", { 2, "", UNKNOWN, 0x0a} }, - {"btc", { 2, "", UNKNOWN, 0x01} }, - {"bfc", { 2, "", UNKNOWN, 0x02} }, - /* Careful: halt is 0x00000000. Jump must have some other (mode?)bit set?? */ - {"jump", { 1, "", UNKNOWN, 0x00} }, - {"btp", { 2, "", UNKNOWN, 0xf00} }, - /* read control-stack pointer is another 1-or-2 operand insn. */ - {"rcsp", { 2, "", UNKNOWN, 0x01f} }, - {"rcsp", { 1, "", UNKNOWN, 0x01f} } -}; - -/* end: pyramid.opcode.h */ -/* One day I will have to take the time to find out what operands - are valid for these insns, and guess at what they mean. - - I can't imagine what the "I???" insns (iglob, etc) do. - - the arithmetic-sounding insns ending in "p" sound awfully like BCD - arithmetic insns: - dshlp -> Decimal SHift Left Packed - dshrp -> Decimal SHift Right Packed - and cvtlp would be convert long to packed. - I have no idea how the operands are interpreted; but having them be - a long register with (address, length) of an in-memory packed BCD operand - would not be surprising. - They are unlikely to be a packed bcd string: 64 bits of long give - is only 15 digits+sign, which isn't enough for COBOL. - */ -#if 0 - {"wcsp", { 2, "", UNKNOWN, 0x00} }, /*write csp?*/ - /* The OSx Operating System Porting Guide claims SSL does things - with tr12 (a register reserved to it) to do with static block-structure - references. SSL=Set Static Link? It's "Going away next release". */ - {"ssl", { 2, "", UNKNOWN, 0x00} }, - {"ccmps", { 2, "", UNKNOWN, 0x00} }, - {"lcd", { 2, "", UNKNOWN, 0x00} }, - {"uemul", { 2, "", UNKNOWN, 0x00} }, /*unsigned emul*/ - {"srf", { 2, "", UNKNOWN, 0x00} }, /*Gidget time???*/ - {"mnegp", { 2, "", UNKNOWN, 0x00} }, /move-neg phys?*/ - {"ldp", { 2, "", UNKNOWN, 0x00} }, /*load phys?*/ - {"ldti", { 2, "", UNKNOWN, 0x00} }, - {"ldb", { 2, "", UNKNOWN, 0x00} }, - {"stp", { 2, "", UNKNOWN, 0x00} }, - {"stti", { 2, "", UNKNOWN, 0x00} }, - {"stb", { 2, "", UNKNOWN, 0x00} }, - {"stu", { 2, "", UNKNOWN, 0x00} }, - {"addp", { 2, "", UNKNOWN, 0x00} }, - {"subp", { 2, "", UNKNOWN, 0x00} }, - {"mulp", { 2, "", UNKNOWN, 0x00} }, - {"divp", { 2, "", UNKNOWN, 0x00} }, - {"dshlp", { 2, "", UNKNOWN, 0x00} }, /* dec shl packed? */ - {"dshrp", { 2, "", UNKNOWN, 0x00} }, /* dec shr packed? */ - {"movs", { 2, "", UNKNOWN, 0x00} }, /*move (string?)?*/ - {"cmpp", { 2, "", UNKNOWN, 0x00} }, /* cmp phys?*/ - {"cmps", { 2, "", UNKNOWN, 0x00} }, /* cmp (string?)?*/ - {"cvtlp", { 2, "", UNKNOWN, 0x00} }, /* cvt long to p??*/ - {"cvtpl", { 2, "", UNKNOWN, 0x00} }, /* cvt p to l??*/ - {"dintr", { 2, "", UNKNOWN, 0x00} }, /* ?? intr ?*/ - {"rphysw", { 2, "", UNKNOWN, 0x00} }, /* read phys word?*/ - {"wphysw", { 2, "", UNKNOWN, 0x00} }, /* write phys word?*/ - {"cmovs", { 2, "", UNKNOWN, 0x00} }, - {"rsubw", { 2, "", UNKNOWN, 0x00} }, - {"bicpsw", { 2, "", UNKNOWN, 0x00} }, /* clr bit in psw? */ - {"bispsw", { 2, "", UNKNOWN, 0x00} }, /* set bit in psw? */ - {"eio", { 2, "", UNKNOWN, 0x00} }, /* ?? ?io ? */ - {"callp", { 2, "", UNKNOWN, 0x00} }, /* call phys?*/ - {"callr", { 2, "", UNKNOWN, 0x00} }, - {"lpcxt", { 2, "", UNKNOWN, 0x00} }, /*load proc context*/ - {"rei", { 2, "", UNKNOWN, 0x00} }, /*ret from intrpt*/ - {"rport", { 2, "", UNKNOWN, 0x00} }, /*read-port?*/ - {"rtod", { 2, "", UNKNOWN, 0x00} }, /*read-time-of-day?*/ - {"ssi", { 2, "", UNKNOWN, 0x00} }, - {"vtpa", { 2, "", UNKNOWN, 0x00} }, /*virt-to-phys-addr?*/ - {"wicl", { 2, "", UNKNOWN, 0x00} }, /* write icl ? */ - {"wport", { 2, "", UNKNOWN, 0x00} }, /*write-port?*/ - {"wtod", { 2, "", UNKNOWN, 0x00} }, /*write-time-of-day?*/ - {"flic", { 2, "", UNKNOWN, 0x00} }, - {"iglob", { 2, "", UNKNOWN, 0x00} }, /* I global? */ - {"iphys", { 2, "", UNKNOWN, 0x00} }, /* I physical? */ - {"ipid", { 2, "", UNKNOWN, 0x00} }, /* I pid? */ - {"ivect", { 2, "", UNKNOWN, 0x00} }, /* I vector? */ - {"lamst", { 2, "", UNKNOWN, 0x00} }, - {"tio", { 2, "", UNKNOWN, 0x00} }, -#endif diff --git a/contrib/gdb/include/opcode/rs6k.h b/contrib/gdb/include/opcode/rs6k.h deleted file mode 100644 index fac9cf4..0000000 --- a/contrib/gdb/include/opcode/rs6k.h +++ /dev/null @@ -1,254 +0,0 @@ -/* IBM RS/6000 instruction set definitions, for GNU software. */ - -/* These are all possible instruction formats as used in IBM Assembler - Language Reference, Appendix A. */ - -typedef enum { A=0, B, D, I, M, SC, X, XL, XO, XFL, XFX } InsnFmt; - -/* Extended opcode masks. Used for extracting extended opcode values from - instructions. Each instruction's format decides which mask applies. - They *should* retain the same order as the above formats. */ - -static int eopMask[] = - { 0x1f, 0, 0, 0, 0, 0, 0x3ff, 0x3ff, 0x1ff, 0x3ff, 0x3ff }; - -/* All the things you need to know about an opcode. */ - -typedef struct rs6000_insn { - char *operator; /* opcode name */ - char *opr_ext; /* opcode name extension */ - InsnFmt format; /* opcode format */ - char p_opcode; /* primary opcode */ - int e_opcode; /* extended opcode */ - char oprnd_format[6]; /* operand format */ -} OPCODE; - -/* operand format specifiers */ - -#define TO 1 -#define RA 2 -#define SI 3 -#define RT 4 -#define UI 5 -#define BF 6 -#define BFA 7 -#define BT 8 -#define BA 9 -#define BB 10 -#define BO 11 -#define BI 12 -#define RB 13 -#define RS 14 -#define SH 15 -#define MB 16 -#define ME 17 -#define SPR 18 -#define DIS 19 -#define FXM 21 -#define FRT 22 -#define NB 23 -#define FRS 24 -#define FRA 25 -#define FRB 26 -#define FRC 27 -#define FLM 28 -#define I 29 -#define LI 30 -#define A2 31 -#define TA14 32 /* 14 bit representation of target address */ -#define TA24 33 /* 24 bit representation of target address */ -#define FL1 34 -#define FL2 35 -#define LEV 36 - -/* RS/6000 INSTRUCTION SET - (sorted on primary and extended opcode) - - oprtr primary ext. -operator ext format opcode opcode operand format -------- ------- ------ ------- ------ --------------- */ - -struct rs6000_insn rs6k_ops [] = { - -{"ti", 0, D, 3, -1, {TO,RA,SI,0} }, -{"muli", 0, D, 7, -1, {RT,RA,SI,0} }, -{"sfi", 0, D, 8, -1, {RT,RA,SI,0} }, -{"dozi", 0, D, 9, -1, {RT,RA,SI,0} }, -{"cmpli", 0, D, 10, -1, {BF,RA,UI,0} }, -{"cmpi", 0, D, 11, -1, {BF,RA,SI,0} }, -{"ai", 0, D, 12, -1, {RT,RA,SI,0} }, -{"ai.", 0, D, 13, -1, {RT,RA,SI,0} }, -{"lil", 0, D, 14, -1, {RT,SI,0} }, /* same as `cal' */ -{"cal", 0, D, 14, -1, {RT,DIS,RA,0} }, -{"liu", 0, D, 15, -1, {RT, UI,0} }, /* same as `cau' */ -{"cau", 0, D, 15, -1, {RT,RA,UI,0} }, - -/* "1" indicates an exception--"bb" is only usable for some values of - BO, so the disassembler first matches this instruction and then changes - it to "bc" if that is the case. */ -{"bb", "1tfla", B, 16, -1, {LI,A2,0} }, -{"bc", "la", B, 16, -1, {BO,BI,TA14,0} }, - -{"svc", "la", SC, 17, -1, {LEV,FL1,FL2,0} }, -{"b", "la", I, 18, -1, {TA24,0} }, -{"mcrf", 0, XL, 19, 0, {BF,BFA,0} }, -{"bcr", "l", XL, 19, 16, {BO,BI,0} }, -{"crnor", 0, XL, 19, 33, {BT,BA,BB,0} }, -{"rfi", 0, X, 19, 50, {0} }, -{"rfsvc", 0, X, 19, 82, {0} }, -{"crandc", 0, XL, 19, 129, {BT,BA,BB,0} }, -{"ics", 0, X, 19, 150, {0} }, -{"crxor", 0, XL, 19, 193, {BT,BA,BB,0} }, -{"crnand", 0, XL, 19, 225, {BT,BA,BB,0} }, -{"crand", 0, XL, 19, 257, {BT,BA,BB,0} }, -{"creqv", 0, XL, 19, 289, {BT,BA,BB,0} }, -{"crorc", 0, XL, 19, 417, {BT,BA,BB,0} }, -{"cror", 0, XL, 19, 449, {BT,BA,BB,0} }, -{"bcc", "l", XL, 19, 528, {BO,BI,0} }, -{"rlimi", ".", M, 20, -1, {RA,RS,SH,MB,ME,0} /*??*/}, -{"rlinm", ".", M, 21, -1, {RA,RS,SH,MB,ME,0} /*??*/}, -{"rlmi", ".", M, 22, -1, {RA,RS,RB,MB,ME,0} /*??*/}, -{"rlnm", ".", M, 23, -1, {RA,RS,RB,MB,ME,0} /*??*/}, -{"oril", 0, D, 24, -1, {RA,RS,UI,0} }, -{"oriu", 0, D, 25, -1, {RA,RS,UI,0} }, -{"xoril", 0, D, 26, -1, {RA,RS,UI,0} }, -{"xoriu", 0, D, 27, -1, {RA,RS,UI,0} }, -{"andil.", 0, D, 28, -1, {RA,RS,UI,0} }, -{"andiu.", 0, D, 29, -1, {RA,RS,UI,0} }, -{"cmp", 0, X, 31, 0, {BF,RA,RB,0} }, -{"t", 0, X, 31, 4, {TO,RA,RB,0} }, -{"sf", "o.", XO, 31, 8, {RT,RA,RB,0} }, -{"a", "o.", XO, 31, 10, {RT,RA,RB,0} }, -{"mfcr", 0, X, 31, 19, {RT,0} }, -{"lx", 0, X, 31, 23, {RT,RA,RB,0} }, -{"sl", ".", X, 31, 24, {RA,RS,RB,0} }, -{"cntlz", ".", XO, 31, 26, {RA,RS,0} }, -{"and", ".", X, 31, 28, {RA,RS,RB,0} }, -{"maskg", ".", X, 31, 29, {RA,RS,RB,0} }, -{"cmpl", 0, X, 31, 32, {BF,RA,RB,0} }, -{"sfe", "o.", XO, 31, 136, {RT,RA,RB,0} }, -{"lux", 0, X, 31, 55, {RT,RA,RB,0} }, -{"andc", ".", X, 31, 60, {RA,RS,RB,0} }, -{"mfmsr", 0, X, 31, 83, {RT,0} }, -{"lbzx", 0, X, 31, 87, {RT,RA,RB,0} }, -{"neg", "o.", XO, 31, 104, {RT,RA,0} }, -{"mul", "o.", XO, 31, 107, {RT,RA,RB,0} }, -{"lbzux", 0, X, 31, 119, {RT,RA,RB,0} }, -{"nor", ".", X, 31, 124, {RA,RS,RB,0} }, -{"ae", "o.", XO, 31, 138, {RT,RA,RB,0} }, -{"mtcrf", 0, XFX, 31, 144, {FXM,RS,0} }, -{"stx", 0, X, 31, 151, {RS,RA,RB,0} }, -{"slq", ".", X, 31, 152, {RA,RS,RB,0} }, -{"sle", ".", X, 31, 153, {RA,RS,RB,0} }, -{"stux", 0, X, 31, 183, {RS,RA,RB,0} }, -{"sliq", ".", X, 31, 184, {RA,RS,SH,0} }, -{"sfze", "o.", XO, 31, 200, {RT,RA,0} }, -{"aze", "o.", XO, 31, 202, {RT,RA,0} }, -{"stbx", 0, X, 31, 215, {RS,RA,RB,0} }, -{"sllq", ".", X, 31, 216, {RA,RS,RB,0} }, -{"sleq", ".", X, 31, 217, {RA,RS,RB,0} }, -{"sfme", "o.", XO, 31, 232, {RT,RA,0} }, -{"ame", "o.", XO, 31, 234, {RT,RA,0} }, -{"muls", "o.", XO, 31, 235, {RT,RA,RB,0} }, -{"stbux", 0, X, 31, 247, {RS,RA,RB,0} }, -{"slliq", ".", X, 31, 248, {RA,RS,SH,0} }, -{"doz", "o.", X, 31, 264, {RT,RA,RB,0} }, -{"cax", "o.", XO, 31, 266, {RT,RA,RB,0} }, -{"lscbx", ".", X, 31, 277, {RT,RA,RB,0} }, -{"lhzx", 0, X, 31, 279, {RT,RA,RB,0} }, -{"eqv", ".", X, 31, 284, {RA,RS,RB,0} }, -{"lhzux", 0, X, 31, 311, {RT,RA,RB,0} }, -{"xor", ".", X, 31, 316, {RA,RS,RB,0} }, -{"div", "o.", XO, 31, 331, {RT,RA,RB,0} }, -{"mfspr", 0, X, 31, 339, {RT,SPR,0} }, -{"lhax", 0, X, 31, 343, {RT,RA,RB,0} }, -{"abs", "o.", XO, 31, 360, {RT,RA,0} }, -{"divs", "o.", XO, 31, 363, {RT,RA,RB,0} }, -{"lhaux", 0, X, 31, 375, {RT,RA,RB,0} }, -{"sthx", 0, X, 31, 407, {RS,RA,RB,0} }, -{"orc", ".", X, 31, 412, {RA,RS,RB,0} }, -{"sthux", 0, X, 31, 439, {RS,RA,RB,0} }, -{"or", ".", X, 31, 444, {RA,RS,RB,0} }, -{"mtspr", 0, X, 31, 467, {SPR,RS,0} }, -{"nand", ".", X, 31, 476, {RA,RS,RB,0} }, -{"nabs", "o.", XO, 31, 488, {RT,RA,0} }, -{"mcrxr", 0, X, 31, 512, {BF,0} }, -{"lsx", 0, X, 31, 533, {RT,RA,RB,0} }, -{"lbrx", 0, X, 31, 534, {RT,RA,RB,0} }, -{"lfsx", 0, X, 31, 535, {FRT,RA,RB,0} }, -{"sr", ".", X, 31, 536, {RA,RS,RB,0} }, -{"rrib", ".", X, 31, 537, {RA,RS,RB,0} }, -{"maskir", ".", X, 31, 541, {RA,RS,RB,0} }, -{"lfsux", 0, X, 31, 567, {FRT,RA,RB,0} }, -{"lsi", 0, X, 31, 597, {RT,RA,NB,0} }, -{"lfdx", 0, X, 31, 599, {FRT,RA,RB,0} }, -{"lfdux", 0, X, 31, 631, {FRT,RA,RB,0} }, -{"stsx", 0, X, 31, 661, {RS,RA,RB,0} }, -{"stbrx", 0, X, 31, 662, {RS,RA,RB,0} }, -{"stfsx", 0, X, 31, 663, {FRS,RA,RB,0} }, -{"srq", ".", X, 31, 664, {RA,RS,RB,0} }, -{"sre", ".", X, 31, 665, {RA,RS,RB,0} }, -{"stfsux", 0, X, 31, 695, {FRS,RA,RB,0} }, -{"sriq", ".", X, 31, 696, {RA,RS,SH,0} }, -{"stsi", 0, X, 31, 725, {RS,RA,NB,0} }, -{"stfdx", 0, X, 31, 727, {FRS,RA,RB,0} }, -{"srlq", ".", X, 31, 728, {RA,RS,RB,0} }, -{"sreq", ".", X, 31, 729, {RA,RS,RB,0} }, -{"stfdux", 0, X, 31, 759, {FRS,RA,RB,0} }, -{"srliq", ".", X, 31, 760, {RA,RS,SH,0} }, -{"lhbrx", 0, X, 31, 790, {RT,RA,RB,0} }, -{"sra", ".", X, 31, 792, {RA,RS,RB,0} }, -{"srai", ".", X, 31, 824, {RA,RS,SH,0} }, -{"sthbrx", 0, X, 31, 918, {RS,RA,RB,0} }, -{"sraq", ".", X, 31, 920, {RA,RS,RB,0} }, -{"srea", ".", X, 31, 921, {RA,RS,RB,0} }, -{"exts", ".", X, 31, 922, {RA,RS,0} }, -{"sraiq", ".", X, 31, 952, {RA,RS,SH,0} }, -{"l", 0, D, 32, -1, {RT,DIS,RA,0} }, -{"lu", 0, D, 33, -1, {RT,DIS,RA,0} }, -{"lbz", 0, D, 34, -1, {RT,DIS,RA,0} }, -{"lbzu", 0, D, 35, -1, {RT,DIS,RA,0} }, -{"st", 0, D, 36, -1, {RS,DIS,RA,0} }, -{"stu", 0, D, 37, -1, {RS,DIS,RA,0} }, -{"stb", 0, D, 38, -1, {RS,DIS,RA,0} }, -{"stbu", 0, D, 39, -1, {RS,DIS,RA,0} }, -{"lhz", 0, D, 40, -1, {RT,DIS,RA,0} }, -{"lhzu", 0, D, 41, -1, {RT,DIS,RA,0} }, -{"lha", 0, D, 42, -1, {RT,DIS,RA,0} }, -{"lhau", 0, D, 43, -1, {RT,DIS,RA,0} }, -{"sth", 0, D, 44, -1, {RS,DIS,RA,0} }, -{"sthu", 0, D, 45, -1, {RS,DIS,RA,0} }, -{"lm", 0, D, 46, -1, {RT,DIS,RA,0} }, -{"stm", 0, D, 47, -1, {RS,DIS,RA,0} }, -{"lfs", 0, D, 48, -1, {FRT,DIS,RA,0} }, -{"lfsu", 0, D, 49, -1, {FRT,DIS,RA,0} }, -{"lfd", 0, D, 50, -1, {FRT,DIS,RA,0} }, -{"lfdu", 0, D, 51, -1, {FRT,DIS,RA,0} }, -{"stfs", 0, D, 52, -1, {FRS,DIS,RA,0} }, -{"stfsu", 0, D, 53, -1, {FRS,DIS,RA,0} }, -{"stfd", 0, D, 54, -1, {FRS,DIS,RA,0} }, -{"stfdu", 0, D, 55, -1, {FRS,DIS,RA,0} }, -{"fcmpu", 0, X, 63, 0, {BF,FRA,FRB,0} }, -{"frsp", ".", X, 63, 12, {FRT,FRB,0} }, -{"fd", ".", A, 63, 18, {FRT,FRA,FRB,0} }, -{"fs", ".", A, 63, 20, {FRT,FRA,FRB,0} }, -{"fa", ".", A, 63, 21, {FRT,FRA,FRB,0} }, -{"fm", ".", A, 63, 25, {FRT,FRA,FRC,0} }, -{"fms", ".", A, 63, 28, {FRT,FRA,FRC,FRB,0} }, -{"fma", ".", A, 63, 29, {FRT,FRA,FRC,FRB,0} }, -{"fnms", ".", A, 63, 30, {FRT,FRA,FRC,FRB,0} }, -{"fnma", ".", A, 63, 31, {FRT,FRA,FRC,FRB,0} }, -{"fcmpo", 0, X, 63, 32, {BF,FRA,FRB,0} }, -{"mtfsb1", ".", X, 63, 38, {BT,0} }, -{"fneg", ".", X, 63, 40, {FRT,FRB,0} }, -{"mcrfs", 0, X, 63, 64, {BF,BFA,0} }, -{"mtfsb0", ".", X, 63, 70, {BT,0} }, -{"fmr", ".", X, 63, 72, {FRT,FRB,0} }, -{"mtfsfi", ".", X, 63, 134, {BF,I,0} }, -{"fnabs", ".", X, 63, 136, {FRT,FRB,0} }, -{"fabs", ".", X, 63, 264, {FRT,FRB,0} }, -{"mffs", ".", X, 63, 583, {FRT,0} }, -{"mtfsf", ".", XFL, 63, 711, {FLM,FRB,0} }, -}; - -#define NOPCODES (sizeof (rs6k_ops) / sizeof (struct rs6000_insn)) diff --git a/contrib/gdb/include/opcode/sparc.h b/contrib/gdb/include/opcode/sparc.h deleted file mode 100644 index b9281e6..0000000 --- a/contrib/gdb/include/opcode/sparc.h +++ /dev/null @@ -1,220 +0,0 @@ -/* Definitions for opcode table for the sparc. - Copyright (C) 1989, 1991, 1992, 1995, 1996 Free Software Foundation, Inc. - -This file is part of GAS, the GNU Assembler, GDB, the GNU debugger, and -the GNU Binutils. - -GAS/GDB 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. - -GAS/GDB 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 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. */ - -/* The SPARC opcode table (and other related data) is defined in - the opcodes library in sparc-opc.c. If you change anything here, make - sure you fix up that file, and vice versa. */ - - /* FIXME-someday: perhaps the ,a's and such should be embedded in the - instruction's name rather than the args. This would make gas faster, pinsn - slower, but would mess up some macros a bit. xoxorich. */ - -/* List of instruction sets variations. - These values are such that each element is either a superset of a - preceding each one or they conflict in which case SPARC_OPCODE_CONFLICT_P - returns non-zero. - The values are indices into `sparc_opcode_archs' defined in sparc-opc.c. - Don't change this without updating sparc-opc.c. */ - -enum sparc_opcode_arch_val { - SPARC_OPCODE_ARCH_V6 = 0, - SPARC_OPCODE_ARCH_V7, - SPARC_OPCODE_ARCH_V8, - SPARC_OPCODE_ARCH_SPARCLET, - SPARC_OPCODE_ARCH_SPARCLITE, - /* v9 variants must appear last */ - SPARC_OPCODE_ARCH_V9, - SPARC_OPCODE_ARCH_V9A, /* v9 with ultrasparc additions */ - SPARC_OPCODE_ARCH_BAD /* error return from sparc_opcode_lookup_arch */ -}; - -/* The highest architecture in the table. */ -#define SPARC_OPCODE_ARCH_MAX (SPARC_OPCODE_ARCH_BAD - 1) - -/* Table of cpu variants. */ - -struct sparc_opcode_arch { - const char *name; - /* Mask of sparc_opcode_arch_val's supported. - EG: For v7 this would be ((1 << v6) | (1 << v7)). */ - /* These are short's because sparc_opcode.architecture is. */ - short supported; -}; - -extern const struct sparc_opcode_arch sparc_opcode_archs[]; - -/* Given architecture name, look up it's sparc_opcode_arch_val value. */ -extern enum sparc_opcode_arch_val sparc_opcode_lookup_arch (); - -/* Return the bitmask of supported architectures for ARCH. */ -#define SPARC_OPCODE_SUPPORTED(ARCH) (sparc_opcode_archs[ARCH].supported) - -/* Non-zero if ARCH1 conflicts with ARCH2. - IE: ARCH1 as a supported bit set that ARCH2 doesn't, and vice versa. */ -#define SPARC_OPCODE_CONFLICT_P(ARCH1, ARCH2) \ -(((SPARC_OPCODE_SUPPORTED (ARCH1) & SPARC_OPCODE_SUPPORTED (ARCH2)) \ - != SPARC_OPCODE_SUPPORTED (ARCH1)) \ - && ((SPARC_OPCODE_SUPPORTED (ARCH1) & SPARC_OPCODE_SUPPORTED (ARCH2)) \ - != SPARC_OPCODE_SUPPORTED (ARCH2))) - -/* Structure of an opcode table entry. */ - -struct sparc_opcode { - const char *name; - unsigned long match; /* Bits that must be set. */ - unsigned long lose; /* Bits that must not be set. */ - const char *args; - /* This was called "delayed" in versions before the flags. */ - char flags; - short architecture; /* Bitmask of sparc_opcode_arch_val's. */ -}; - -#define F_DELAYED 1 /* Delayed branch */ -#define F_ALIAS 2 /* Alias for a "real" instruction */ -#define F_UNBR 4 /* Unconditional branch */ -#define F_CONDBR 8 /* Conditional branch */ -#define F_JSR 16 /* Subroutine call */ -/* FIXME: Add F_ANACHRONISTIC flag for v9. */ - -/* - -All sparc opcodes are 32 bits, except for the `set' instruction (really a -macro), which is 64 bits. It is handled as a special case. - -The match component is a mask saying which bits must match a particular -opcode in order for an instruction to be an instance of that opcode. - -The args component is a string containing one character for each operand of the -instruction. - -Kinds of operands: - # Number used by optimizer. It is ignored. - 1 rs1 register. - 2 rs2 register. - d rd register. - e frs1 floating point register. - v frs1 floating point register (double/even). - V frs1 floating point register (quad/multiple of 4). - f frs2 floating point register. - B frs2 floating point register (double/even). - R frs2 floating point register (quad/multiple of 4). - g frsd floating point register. - H frsd floating point register (double/even). - J frsd floating point register (quad/multiple of 4). - b crs1 coprocessor register - c crs2 coprocessor register - D crsd coprocessor register - m alternate space register (asr) in rd - M alternate space register (asr) in rs1 - h 22 high bits. - K MEMBAR mask (7 bits). (v9) - j 10 bit Immediate. (v9) - I 11 bit Immediate. (v9) - i 13 bit Immediate. - n 22 bit immediate. - k 2+14 bit PC relative immediate. (v9) - G 19 bit PC relative immediate. (v9) - l 22 bit PC relative immediate. - L 30 bit PC relative immediate. - a Annul. The annul bit is set. - A Alternate address space. Stored as 8 bits. - C Coprocessor state register. - F floating point state register. - p Processor state register. - N Branch predict clear ",pn" (v9) - T Branch predict set ",pt" (v9) - z %icc. (v9) - Z %xcc. (v9) - q Floating point queue. - r Single register that is both rs1 and rd. - O Single register that is both rs2 and rd. - Q Coprocessor queue. - S Special case. - t Trap base register. - w Window invalid mask register. - y Y register. - u sparclet coprocessor registers in rd position - U sparclet coprocessor registers in rs1 position - E %ccr. (v9) - s %fprs. (v9) - P %pc. (v9) - W %tick. (v9) - o %asi. (v9) - 6 %fcc0. (v9) - 7 %fcc1. (v9) - 8 %fcc2. (v9) - 9 %fcc3. (v9) - ! Privileged Register in rd (v9) - ? Privileged Register in rs1 (v9) - * Prefetch function constant. (v9) - x OPF field (v9 impdep). - -The following chars are unused: (note: ,[] are used as punctuation) -[XY3450] - -*/ - -#define OP2(x) (((x)&0x7) << 22) /* op2 field of format2 insns */ -#define OP3(x) (((x)&0x3f) << 19) /* op3 field of format3 insns */ -#define OP(x) ((unsigned)((x)&0x3) << 30) /* op field of all insns */ -#define OPF(x) (((x)&0x1ff) << 5) /* opf field of float insns */ -#define OPF_LOW5(x) OPF((x)&0x1f) /* v9 */ -#define F3F(x, y, z) (OP(x) | OP3(y) | OPF(z)) /* format3 float insns */ -#define F3I(x) (((x)&0x1) << 13) /* immediate field of format 3 insns */ -#define F2(x, y) (OP(x) | OP2(y)) /* format 2 insns */ -#define F3(x, y, z) (OP(x) | OP3(y) | F3I(z)) /* format3 insns */ -#define F1(x) (OP(x)) -#define DISP30(x) ((x)&0x3fffffff) -#define ASI(x) (((x)&0xff) << 5) /* asi field of format3 insns */ -#define RS2(x) ((x)&0x1f) /* rs2 field */ -#define SIMM13(x) ((x)&0x1fff) /* simm13 field */ -#define RD(x) (((x)&0x1f) << 25) /* destination register field */ -#define RS1(x) (((x)&0x1f) << 14) /* rs1 field */ -#define ASI_RS2(x) (SIMM13(x)) -#define MEMBAR(x) ((x)&0x7f) - -#define ANNUL (1<<29) -#define BPRED (1<<19) /* v9 */ -#define IMMED F3I(1) -#define RD_G0 RD(~0) -#define RS1_G0 RS1(~0) -#define RS2_G0 RS2(~0) - -extern struct sparc_opcode sparc_opcodes[]; -extern const int sparc_num_opcodes; - -int sparc_encode_asi (); -char *sparc_decode_asi (); -int sparc_encode_membar (); -char *sparc_decode_membar (); -int sparc_encode_prefetch (); -char *sparc_decode_prefetch (); -int sparc_encode_sparclet_cpreg (); -char *sparc_decode_sparclet_cpreg (); - -/* - * Local Variables: - * fill-column: 131 - * comment-column: 0 - * End: - */ - -/* end of sparc.h */ diff --git a/contrib/gdb/include/opcode/tahoe.h b/contrib/gdb/include/opcode/tahoe.h deleted file mode 100644 index b5cee24..0000000 --- a/contrib/gdb/include/opcode/tahoe.h +++ /dev/null @@ -1,213 +0,0 @@ -/* - * Ported by the State University of New York at Buffalo by the Distributed - * Computer Systems Lab, Department of Computer Science, 1991. - */ - -#ifndef tahoe_opcodeT -#define tahoe_opcodeT int -#endif /* no tahoe_opcodeT */ - -struct vot_wot /* tahoe opcode table: wot to do with this */ - /* particular opcode */ -{ - char * args; /* how to compile said opcode */ - tahoe_opcodeT code; /* op-code (may be > 8 bits!) */ -}; - -struct vot /* tahoe opcode text */ -{ - char * name; /* opcode name: lowercase string [key] */ - struct vot_wot detail; /* rest of opcode table [datum] */ -}; - -#define vot_how args -#define vot_code code -#define vot_detail detail -#define vot_name name - -static struct vot -votstrs[] = -{ -{ "halt", {"", 0x00 } }, -{ "sinf", {"", 0x05 } }, -{ "ldf", {"rl", 0x06 } }, -{ "ldd", {"rq", 0x07 } }, -{ "addb2", {"rbmb", 0x08 } }, -{ "movb", {"rbwb", 0x09 } }, -{ "addw2", {"rwmw", 0x0a } }, -{ "movw", {"rwww", 0x0b } }, -{ "addl2", {"rlml", 0x0c } }, -{ "movl", {"rlwl", 0x0d } }, -{ "bbs", {"rlvlbw", 0x0e } }, -{ "nop", {"", 0x10 } }, -{ "brb", {"bb", 0x11 } }, -{ "brw", {"bw", 0x13 } }, -{ "cosf", {"", 0x15 } }, -{ "lnf", {"rl", 0x16 } }, -{ "lnd", {"rq", 0x17 } }, -{ "addb3", {"rbrbwb", 0x18 } }, -{ "cmpb", {"rbwb", 0x19 } }, -{ "addw3", {"rwrwww", 0x1a } }, -{ "cmpw", {"rwww", 0x1b } }, -{ "addl3", {"rlrlwl", 0x1c } }, -{ "cmpl", {"rlwl", 0x1d } }, -{ "bbc", {"rlvlbw", 0x1e } }, -{ "rei", {"", 0x20 } }, -{ "bneq", {"bb", 0x21 } }, -{ "bnequ", {"bb", 0x21 } }, -{ "cvtwl", {"rwwl", 0x23 } }, -{ "stf", {"wl", 0x26 } }, -{ "std", {"wq", 0x27 } }, -{ "subb2", {"rbmb", 0x28 } }, -{ "mcomb", {"rbwb", 0x29 } }, -{ "subw2", {"rwmw", 0x2a } }, -{ "mcomw", {"rwww", 0x2b } }, -{ "subl2", {"rlml", 0x2c } }, -{ "mcoml", {"rlwl", 0x2d } }, -{ "emul", {"rlrlrlwq", 0x2e } }, -{ "aoblss", {"rlmlbw", 0x2f } }, -{ "bpt", {"", 0x30 } }, -{ "beql", {"bb", 0x31 } }, -{ "beqlu", {"bb", 0x31 } }, -{ "cvtwb", {"rwwb", 0x33 } }, -{ "logf", {"", 0x35 } }, -{ "cmpf", {"rl", 0x36 } }, -{ "cmpd", {"rq", 0x37 } }, -{ "subb3", {"rbrbwb", 0x38 } }, -{ "bitb", {"rbrb", 0x39 } }, -{ "subw3", {"rwrwww", 0x3a } }, -{ "bitw", {"rwrw", 0x3b } }, -{ "subl3", {"rlrlwl", 0x3c } }, -{ "bitl", {"rlrl", 0x3d } }, -{ "ediv", {"rlrqwlwl", 0x3e } }, -{ "aobleq", {"rlmlbw", 0x3f } }, -{ "ret", {"", 0x40 } }, -{ "bgtr", {"bb", 0x41 } }, -{ "sqrtf", {"", 0x45 } }, -{ "cmpf2", {"rl", 0x46 } }, -{ "cmpd2", {"rqrq", 0x47 } }, -{ "shll", {"rbrlwl", 0x48 } }, -{ "clrb", {"wb", 0x49 } }, -{ "shlq", {"rbrqwq", 0x4a } }, -{ "clrw", {"ww", 0x4b } }, -{ "mull2", {"rlml", 0x4c } }, -{ "clrl", {"wl", 0x4d } }, -{ "shal", {"rbrlwl", 0x4e } }, -{ "bleq", {"bb", 0x51 } }, -{ "expf", {"", 0x55 } }, -{ "tstf", {"", 0x56 } }, -{ "tstd", {"", 0x57 } }, -{ "shrl", {"rbrlwl", 0x58 } }, -{ "tstb", {"rb", 0x59 } }, -{ "shrq", {"rbrqwq", 0x5a } }, -{ "tstw", {"rw", 0x5b } }, -{ "mull3", {"rlrlwl", 0x5c } }, -{ "tstl", {"rl", 0x5d } }, -{ "shar", {"rbrlwl", 0x5e } }, -{ "bbssi", {"rlmlbw", 0x5f } }, -{ "ldpctx", {"", 0x60 } }, -{ "pushd", {"", 0x67 } }, -{ "incb", {"mb", 0x69 } }, -{ "incw", {"mw", 0x6b } }, -{ "divl2", {"rlml", 0x6c } }, -{ "incl", {"ml", 0x6d } }, -{ "cvtlb", {"rlwb", 0x6f } }, -{ "svpctx", {"", 0x70 } }, -{ "jmp", {"ab", 0x71 } }, -{ "cvlf", {"rl", 0x76 } }, -{ "cvld", {"rl", 0x77 } }, -{ "decb", {"mb", 0x79 } }, -{ "decw", {"mw", 0x7b } }, -{ "divl3", {"rlrlwl", 0x7c } }, -{ "decl", {"ml", 0x7d } }, -{ "cvtlw", {"rlww", 0x7f } }, -{ "bgeq", {"bb", 0x81 } }, -{ "movs2", {"abab", 0x82 } }, -{ "cvfl", {"wl", 0x86 } }, -{ "cvdl", {"wl", 0x87 } }, -{ "orb2", {"rbmb", 0x88 } }, -{ "cvtbl", {"rbwl", 0x89 } }, -{ "orw2", {"rwmw", 0x8a } }, -{ "bispsw", {"rw", 0x8b } }, -{ "orl2", {"rlml", 0x8c } }, -{ "adwc", {"rlml", 0x8d } }, -{ "adda", {"rlml", 0x8e } }, -{ "blss", {"bb", 0x91 } }, -{ "cmps2", {"abab", 0x92 } }, -{ "ldfd", {"rl", 0x97 } }, -{ "orb3", {"rbrbwb", 0x98 } }, -{ "cvtbw", {"rbww", 0x99 } }, -{ "orw3", {"rwrwww", 0x9a } }, -{ "bicpsw", {"rw", 0x9b } }, -{ "orl3", {"rlrlwl", 0x9c } }, -{ "sbwc", {"rlml", 0x9d } }, -{ "suba", {"rlml", 0x9e } }, -{ "bgtru", {"bb", 0xa1 } }, -{ "cvdf", {"", 0xa6 } }, -{ "andb2", {"rbmb", 0xa8 } }, -{ "movzbl", {"rbwl", 0xa9 } }, -{ "andw2", {"rwmw", 0xaa } }, -{ "loadr", {"rwal", 0xab } }, -{ "andl2", {"rlml", 0xac } }, -{ "mtpr", {"rlrl", 0xad } }, -{ "ffs", {"rlwl", 0xae } }, -{ "blequ", {"bb", 0xb1 } }, -{ "negf", {"", 0xb6 } }, -{ "negd", {"", 0xb7 } }, -{ "andb3", {"rbrbwb", 0xb8 } }, -{ "movzbw", {"rbww", 0xb9 } }, -{ "andw3", {"rwrwww", 0xba } }, -{ "storer", {"rwal", 0xbb } }, -{ "andl3", {"rlrlwl", 0xbc } }, -{ "mfpr", {"rlwl", 0xbd } }, -{ "ffc", {"rlwl", 0xbe } }, -{ "calls", {"rbab", 0xbf } }, -{ "prober", {"rbabrl", 0xc0 } }, -{ "bvc", {"bb", 0xc1 } }, -{ "movs3", {"ababrw", 0xc2 } }, -{ "movzwl", {"rwwl", 0xc3 } }, -{ "addf", {"rl", 0xc6 } }, -{ "addd", {"rq", 0xc7 } }, -{ "xorb2", {"rbmb", 0xc8 } }, -{ "movob", {"rbwb", 0xc9 } }, -{ "xorw2", {"rwmw", 0xca } }, -{ "movow", {"rwww", 0xcb } }, -{ "xorl2", {"rlml", 0xcc } }, -{ "movpsl", {"wl", 0xcd } }, -{ "kcall", {"rw", 0xcf } }, -{ "probew", {"rbabrl", 0xd0 } }, -{ "bvs", {"bb", 0xd1 } }, -{ "cmps3", {"ababrw", 0xd2 } }, -{ "subf", {"rq", 0xd6 } }, -{ "subd", {"rq", 0xd7 } }, -{ "xorb3", {"rbrbwb", 0xd8 } }, -{ "pushb", {"rb", 0xd9 } }, -{ "xorw3", {"rwrwww", 0xda } }, -{ "pushw", {"rw", 0xdb } }, -{ "xorl3", {"rlrlwl", 0xdc } }, -{ "pushl", {"rl", 0xdd } }, -{ "insque", {"abab", 0xe0 } }, -{ "bcs", {"bb", 0xe1 } }, -{ "bgequ", {"bb", 0xe1 } }, -{ "mulf", {"rq", 0xe6 } }, -{ "muld", {"rq", 0xe7 } }, -{ "mnegb", {"rbwb", 0xe8 } }, -{ "movab", {"abwl", 0xe9 } }, -{ "mnegw", {"rwww", 0xea } }, -{ "movaw", {"awwl", 0xeb } }, -{ "mnegl", {"rlwl", 0xec } }, -{ "moval", {"alwl", 0xed } }, -{ "remque", {"ab", 0xf0 } }, -{ "bcc", {"bb", 0xf1 } }, -{ "blssu", {"bb", 0xf1 } }, -{ "divf", {"rq", 0xf6 } }, -{ "divd", {"rq", 0xf7 } }, -{ "movblk", {"alalrw", 0xf8 } }, -{ "pushab", {"ab", 0xf9 } }, -{ "pushaw", {"aw", 0xfb } }, -{ "casel", {"rlrlrl", 0xfc } }, -{ "pushal", {"al", 0xfd } }, -{ "callf", {"rbab", 0xfe } }, -{ "" , "" } /* empty is end sentinel */ - -}; diff --git a/contrib/gdb/include/opcode/vax.h b/contrib/gdb/include/opcode/vax.h deleted file mode 100644 index f3afebd..0000000 --- a/contrib/gdb/include/opcode/vax.h +++ /dev/null @@ -1,382 +0,0 @@ -/* Vax opcde list. - Copyright (C) 1989, 1995 Free Software Foundation, Inc. - -This file is part of GDB and GAS. - -GDB and GAS are 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 1, or (at your option) -any later version. - -GDB and GAS are 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 GDB or GAS; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#ifndef vax_opcodeT -#define vax_opcodeT int -#endif /* no vax_opcodeT */ - -struct vot_wot /* vax opcode table: wot to do with this */ - /* particular opcode */ -{ - const char *args; /* how to compile said opcode */ - vax_opcodeT code; /* op-code (may be > 8 bits!) */ -}; - -struct vot /* vax opcode text */ -{ - const char *name; /* opcode name: lowercase string [key] */ - struct vot_wot detail; /* rest of opcode table [datum] */ -}; - -#define vot_how args -#define vot_code code -#define vot_detail detail -#define vot_name name - -static const struct vot -votstrs[] = -{ -{ "halt", {"", 0x00 } }, -{ "nop", {"", 0x01 } }, -{ "rei", {"", 0x02 } }, -{ "bpt", {"", 0x03 } }, -{ "ret", {"", 0x04 } }, -{ "rsb", {"", 0x05 } }, -{ "ldpctx", {"", 0x06 } }, -{ "svpctx", {"", 0x07 } }, -{ "cvtps", {"rwabrwab", 0x08 } }, -{ "cvtsp", {"rwabrwab", 0x09 } }, -{ "index", {"rlrlrlrlrlwl", 0x0a } }, -{ "crc", {"abrlrwab", 0x0b } }, -{ "prober", {"rbrwab", 0x0c } }, -{ "probew", {"rbrwab", 0x0d } }, -{ "insque", {"abab", 0x0e } }, -{ "remque", {"abwl", 0x0f } }, -{ "bsbb", {"bb", 0x10 } }, -{ "brb", {"bb", 0x11 } }, -{ "bneq", {"bb", 0x12 } }, -{ "bnequ", {"bb", 0x12 } }, -{ "beql", {"bb", 0x13 } }, -{ "beqlu", {"bb", 0x13 } }, -{ "bgtr", {"bb", 0x14 } }, -{ "bleq", {"bb", 0x15 } }, -{ "jsb", {"ab", 0x16 } }, -{ "jmp", {"ab", 0x17 } }, -{ "bgeq", {"bb", 0x18 } }, -{ "blss", {"bb", 0x19 } }, -{ "bgtru", {"bb", 0x1a } }, -{ "blequ", {"bb", 0x1b } }, -{ "bvc", {"bb", 0x1c } }, -{ "bvs", {"bb", 0x1d } }, -{ "bcc", {"bb", 0x1e } }, -{ "bgequ", {"bb", 0x1e } }, -{ "blssu", {"bb", 0x1f } }, -{ "bcs", {"bb", 0x1f } }, -{ "addp4", {"rwabrwab", 0x20 } }, -{ "addp6", {"rwabrwabrwab", 0x21 } }, -{ "subp4", {"rwabrwab", 0x22 } }, -{ "subp6", {"rwabrwabrwab", 0x23 } }, -{ "cvtpt", {"rwababrwab", 0x24 } }, -{ "mulp", {"rwabrwabrwab", 0x25 } }, -{ "cvttp", {"rwababrwab", 0x26 } }, -{ "divp", {"rwabrwabrwab", 0x27 } }, -{ "movc3", {"rwabab", 0x28 } }, -{ "cmpc3", {"rwabab", 0x29 } }, -{ "scanc", {"rwababrb", 0x2a } }, -{ "spanc", {"rwababrb", 0x2b } }, -{ "movc5", {"rwabrbrwab", 0x2c } }, -{ "cmpc5", {"rwabrbrwab", 0x2d } }, -{ "movtc", {"rwabrbabrwab", 0x2e } }, -{ "movtuc", {"rwabrbabrwab", 0x2f } }, -{ "bsbw", {"bw", 0x30 } }, -{ "brw", {"bw", 0x31 } }, -{ "cvtwl", {"rwwl", 0x32 } }, -{ "cvtwb", {"rwwb", 0x33 } }, -{ "movp", {"rwabab", 0x34 } }, -{ "cmpp3", {"rwabab", 0x35 } }, -{ "cvtpl", {"rwabwl", 0x36 } }, -{ "cmpp4", {"rwabrwab", 0x37 } }, -{ "editpc", {"rwababab", 0x38 } }, -{ "matchc", {"rwabrwab", 0x39 } }, -{ "locc", {"rbrwab", 0x3a } }, -{ "skpc", {"rbrwab", 0x3b } }, -{ "movzwl", {"rwwl", 0x3c } }, -{ "acbw", {"rwrwmwbw", 0x3d } }, -{ "movaw", {"awwl", 0x3e } }, -{ "pushaw", {"aw", 0x3f } }, -{ "addf2", {"rfmf", 0x40 } }, -{ "addf3", {"rfrfwf", 0x41 } }, -{ "subf2", {"rfmf", 0x42 } }, -{ "subf3", {"rfrfwf", 0x43 } }, -{ "mulf2", {"rfmf", 0x44 } }, -{ "mulf3", {"rfrfwf", 0x45 } }, -{ "divf2", {"rfmf", 0x46 } }, -{ "divf3", {"rfrfwf", 0x47 } }, -{ "cvtfb", {"rfwb", 0x48 } }, -{ "cvtfw", {"rfww", 0x49 } }, -{ "cvtfl", {"rfwl", 0x4a } }, -{ "cvtrfl", {"rfwl", 0x4b } }, -{ "cvtbf", {"rbwf", 0x4c } }, -{ "cvtwf", {"rwwf", 0x4d } }, -{ "cvtlf", {"rlwf", 0x4e } }, -{ "acbf", {"rfrfmfbw", 0x4f } }, -{ "movf", {"rfwf", 0x50 } }, -{ "cmpf", {"rfrf", 0x51 } }, -{ "mnegf", {"rfwf", 0x52 } }, -{ "tstf", {"rf", 0x53 } }, -{ "emodf", {"rfrbrfwlwf", 0x54 } }, -{ "polyf", {"rfrwab", 0x55 } }, -{ "cvtfd", {"rfwd", 0x56 } }, - /* opcode 57 is not defined yet */ -{ "adawi", {"rwmw", 0x58 } }, - /* opcode 59 is not defined yet */ - /* opcode 5a is not defined yet */ - /* opcode 5b is not defined yet */ -{ "insqhi", {"abaq", 0x5c } }, -{ "insqti", {"abaq", 0x5d } }, -{ "remqhi", {"aqwl", 0x5e } }, -{ "remqti", {"aqwl", 0x5f } }, -{ "addd2", {"rdmd", 0x60 } }, -{ "addd3", {"rdrdwd", 0x61 } }, -{ "subd2", {"rdmd", 0x62 } }, -{ "subd3", {"rdrdwd", 0x63 } }, -{ "muld2", {"rdmd", 0x64 } }, -{ "muld3", {"rdrdwd", 0x65 } }, -{ "divd2", {"rdmd", 0x66 } }, -{ "divd3", {"rdrdwd", 0x67 } }, -{ "cvtdb", {"rdwb", 0x68 } }, -{ "cvtdw", {"rdww", 0x69 } }, -{ "cvtdl", {"rdwl", 0x6a } }, -{ "cvtrdl", {"rdwl", 0x6b } }, -{ "cvtbd", {"rbwd", 0x6c } }, -{ "cvtwd", {"rwwd", 0x6d } }, -{ "cvtld", {"rlwd", 0x6e } }, -{ "acbd", {"rdrdmdbw", 0x6f } }, -{ "movd", {"rdwd", 0x70 } }, -{ "cmpd", {"rdrd", 0x71 } }, -{ "mnegd", {"rdwd", 0x72 } }, -{ "tstd", {"rd", 0x73 } }, -{ "emodd", {"rdrbrdwlwd", 0x74 } }, -{ "polyd", {"rdrwab", 0x75 } }, -{ "cvtdf", {"rdwf", 0x76 } }, - /* opcode 77 is not defined yet */ -{ "ashl", {"rbrlwl", 0x78 } }, -{ "ashq", {"rbrqwq", 0x79 } }, -{ "emul", {"rlrlrlwq", 0x7a } }, -{ "ediv", {"rlrqwlwl", 0x7b } }, -{ "clrd", {"wd", 0x7c } }, -{ "clrg", {"wg", 0x7c } }, -{ "clrq", {"wd", 0x7c } }, -{ "movq", {"rqwq", 0x7d } }, -{ "movaq", {"aqwl", 0x7e } }, -{ "movad", {"adwl", 0x7e } }, -{ "pushaq", {"aq", 0x7f } }, -{ "pushad", {"ad", 0x7f } }, -{ "addb2", {"rbmb", 0x80 } }, -{ "addb3", {"rbrbwb", 0x81 } }, -{ "subb2", {"rbmb", 0x82 } }, -{ "subb3", {"rbrbwb", 0x83 } }, -{ "mulb2", {"rbmb", 0x84 } }, -{ "mulb3", {"rbrbwb", 0x85 } }, -{ "divb2", {"rbmb", 0x86 } }, -{ "divb3", {"rbrbwb", 0x87 } }, -{ "bisb2", {"rbmb", 0x88 } }, -{ "bisb3", {"rbrbwb", 0x89 } }, -{ "bicb2", {"rbmb", 0x8a } }, -{ "bicb3", {"rbrbwb", 0x8b } }, -{ "xorb2", {"rbmb", 0x8c } }, -{ "xorb3", {"rbrbwb", 0x8d } }, -{ "mnegb", {"rbwb", 0x8e } }, -{ "caseb", {"rbrbrb", 0x8f } }, -{ "movb", {"rbwb", 0x90 } }, -{ "cmpb", {"rbrb", 0x91 } }, -{ "mcomb", {"rbwb", 0x92 } }, -{ "bitb", {"rbrb", 0x93 } }, -{ "clrb", {"wb", 0x94 } }, -{ "tstb", {"rb", 0x95 } }, -{ "incb", {"mb", 0x96 } }, -{ "decb", {"mb", 0x97 } }, -{ "cvtbl", {"rbwl", 0x98 } }, -{ "cvtbw", {"rbww", 0x99 } }, -{ "movzbl", {"rbwl", 0x9a } }, -{ "movzbw", {"rbww", 0x9b } }, -{ "rotl", {"rbrlwl", 0x9c } }, -{ "acbb", {"rbrbmbbw", 0x9d } }, -{ "movab", {"abwl", 0x9e } }, -{ "pushab", {"ab", 0x9f } }, -{ "addw2", {"rwmw", 0xa0 } }, -{ "addw3", {"rwrwww", 0xa1 } }, -{ "subw2", {"rwmw", 0xa2 } }, -{ "subw3", {"rwrwww", 0xa3 } }, -{ "mulw2", {"rwmw", 0xa4 } }, -{ "mulw3", {"rwrwww", 0xa5 } }, -{ "divw2", {"rwmw", 0xa6 } }, -{ "divw3", {"rwrwww", 0xa7 } }, -{ "bisw2", {"rwmw", 0xa8 } }, -{ "bisw3", {"rwrwww", 0xa9 } }, -{ "bicw2", {"rwmw", 0xaa } }, -{ "bicw3", {"rwrwww", 0xab } }, -{ "xorw2", {"rwmw", 0xac } }, -{ "xorw3", {"rwrwww", 0xad } }, -{ "mnegw", {"rwww", 0xae } }, -{ "casew", {"rwrwrw", 0xaf } }, -{ "movw", {"rwww", 0xb0 } }, -{ "cmpw", {"rwrw", 0xb1 } }, -{ "mcomw", {"rwww", 0xb2 } }, -{ "bitw", {"rwrw", 0xb3 } }, -{ "clrw", {"ww", 0xb4 } }, -{ "tstw", {"rw", 0xb5 } }, -{ "incw", {"mw", 0xb6 } }, -{ "decw", {"mw", 0xb7 } }, -{ "bispsw", {"rw", 0xb8 } }, -{ "bicpsw", {"rw", 0xb9 } }, -{ "popr", {"rw", 0xba } }, -{ "pushr", {"rw", 0xbb } }, -{ "chmk", {"rw", 0xbc } }, -{ "chme", {"rw", 0xbd } }, -{ "chms", {"rw", 0xbe } }, -{ "chmu", {"rw", 0xbf } }, -{ "addl2", {"rlml", 0xc0 } }, -{ "addl3", {"rlrlwl", 0xc1 } }, -{ "subl2", {"rlml", 0xc2 } }, -{ "subl3", {"rlrlwl", 0xc3 } }, -{ "mull2", {"rlml", 0xc4 } }, -{ "mull3", {"rlrlwl", 0xc5 } }, -{ "divl2", {"rlml", 0xc6 } }, -{ "divl3", {"rlrlwl", 0xc7 } }, -{ "bisl2", {"rlml", 0xc8 } }, -{ "bisl3", {"rlrlwl", 0xc9 } }, -{ "bicl2", {"rlml", 0xca } }, -{ "bicl3", {"rlrlwl", 0xcb } }, -{ "xorl2", {"rlml", 0xcc } }, -{ "xorl3", {"rlrlwl", 0xcd } }, -{ "mnegl", {"rlwl", 0xce } }, -{ "casel", {"rlrlrl", 0xcf } }, -{ "movl", {"rlwl", 0xd0 } }, -{ "cmpl", {"rlrl", 0xd1 } }, -{ "mcoml", {"rlwl", 0xd2 } }, -{ "bitl", {"rlrl", 0xd3 } }, -{ "clrf", {"wf", 0xd4 } }, -{ "clrl", {"wl", 0xd4 } }, -{ "tstl", {"rl", 0xd5 } }, -{ "incl", {"ml", 0xd6 } }, -{ "decl", {"ml", 0xd7 } }, -{ "adwc", {"rlml", 0xd8 } }, -{ "sbwc", {"rlml", 0xd9 } }, -{ "mtpr", {"rlrl", 0xda } }, -{ "mfpr", {"rlwl", 0xdb } }, -{ "movpsl", {"wl", 0xdc } }, -{ "pushl", {"rl", 0xdd } }, -{ "moval", {"alwl", 0xde } }, -{ "movaf", {"afwl", 0xde } }, -{ "pushal", {"al", 0xdf } }, -{ "pushaf", {"af", 0xdf } }, -{ "bbs", {"rlvbbb", 0xe0 } }, -{ "bbc", {"rlvbbb", 0xe1 } }, -{ "bbss", {"rlvbbb", 0xe2 } }, -{ "bbcs", {"rlvbbb", 0xe3 } }, -{ "bbsc", {"rlvbbb", 0xe4 } }, -{ "bbcc", {"rlvbbb", 0xe5 } }, -{ "bbssi", {"rlvbbb", 0xe6 } }, -{ "bbcci", {"rlvbbb", 0xe7 } }, -{ "blbs", {"rlbb", 0xe8 } }, -{ "blbc", {"rlbb", 0xe9 } }, -{ "ffs", {"rlrbvbwl", 0xea } }, -{ "ffc", {"rlrbvbwl", 0xeb } }, -{ "cmpv", {"rlrbvbrl", 0xec } }, -{ "cmpzv", {"rlrbvbrl", 0xed } }, -{ "extv", {"rlrbvbwl", 0xee } }, -{ "extzv", {"rlrbvbwl", 0xef } }, -{ "insv", {"rlrlrbvb", 0xf0 } }, -{ "acbl", {"rlrlmlbw", 0xf1 } }, -{ "aoblss", {"rlmlbb", 0xf2 } }, -{ "aobleq", {"rlmlbb", 0xf3 } }, -{ "sobgeq", {"mlbb", 0xf4 } }, -{ "sobgtr", {"mlbb", 0xf5 } }, -{ "cvtlb", {"rlwb", 0xf6 } }, -{ "cvtlw", {"rlww", 0xf7 } }, -{ "ashp", {"rbrwabrbrwab", 0xf8 } }, -{ "cvtlp", {"rlrwab", 0xf9 } }, -{ "callg", {"abab", 0xfa } }, -{ "calls", {"rlab", 0xfb } }, -{ "xfc", {"", 0xfc } }, - /* undefined opcodes here */ -{ "cvtdh", {"rdwh", 0x32fd } }, -{ "cvtgf", {"rgwh", 0x33fd } }, -{ "addg2", {"rgmg", 0x40fd } }, -{ "addg3", {"rgrgwg", 0x41fd } }, -{ "subg2", {"rgmg", 0x42fd } }, -{ "subg3", {"rgrgwg", 0x43fd } }, -{ "mulg2", {"rgmg", 0x44fd } }, -{ "mulg3", {"rgrgwg", 0x45fd } }, -{ "divg2", {"rgmg", 0x46fd } }, -{ "divg3", {"rgrgwg", 0x47fd } }, -{ "cvtgb", {"rgwb", 0x48fd } }, -{ "cvtgw", {"rgww", 0x49fd } }, -{ "cvtgl", {"rgwl", 0x4afd } }, -{ "cvtrgl", {"rgwl", 0x4bfd } }, -{ "cvtbg", {"rbwg", 0x4cfd } }, -{ "cvtwg", {"rwwg", 0x4dfd } }, -{ "cvtlg", {"rlwg", 0x4efd } }, -{ "acbg", {"rgrgmgbw", 0x4ffd } }, -{ "movg", {"rgwg", 0x50fd } }, -{ "cmpg", {"rgrg", 0x51fd } }, -{ "mnegg", {"rgwg", 0x52fd } }, -{ "tstg", {"rg", 0x53fd } }, -{ "emodg", {"rgrwrgwlwg", 0x54fd } }, -{ "polyg", {"rgrwab", 0x55fd } }, -{ "cvtgh", {"rgwh", 0x56fd } }, - /* undefined opcodes here */ -{ "addh2", {"rhmh", 0x60fd } }, -{ "addh3", {"rhrhwh", 0x61fd } }, -{ "subh2", {"rhmh", 0x62fd } }, -{ "subh3", {"rhrhwh", 0x63fd } }, -{ "mulh2", {"rhmh", 0x64fd } }, -{ "mulh3", {"rhrhwh", 0x65fd } }, -{ "divh2", {"rhmh", 0x66fd } }, -{ "divh3", {"rhrhwh", 0x67fd } }, -{ "cvthb", {"rhwb", 0x68fd } }, -{ "cvthw", {"rhww", 0x69fd } }, -{ "cvthl", {"rhwl", 0x6afd } }, -{ "cvtrhl", {"rhwl", 0x6bfd } }, -{ "cvtbh", {"rbwh", 0x6cfd } }, -{ "cvtwh", {"rwwh", 0x6dfd } }, -{ "cvtlh", {"rlwh", 0x6efd } }, -{ "acbh", {"rhrhmhbw", 0x6ffd } }, -{ "movh", {"rhwh", 0x70fd } }, -{ "cmph", {"rhrh", 0x71fd } }, -{ "mnegh", {"rhwh", 0x72fd } }, -{ "tsth", {"rh", 0x73fd } }, -{ "emodh", {"rhrwrhwlwh", 0x74fd } }, -{ "polyh", {"rhrwab", 0x75fd } }, -{ "cvthg", {"rhwg", 0x76fd } }, - /* undefined opcodes here */ -{ "clrh", {"wh", 0x7cfd } }, -{ "clro", {"wo", 0x7cfd } }, -{ "movo", {"rowo", 0x7dfd } }, -{ "movah", {"ahwl", 0x7efd } }, -{ "movao", {"aowl", 0x7efd } }, -{ "pushah", {"ah", 0x7ffd } }, -{ "pushao", {"ao", 0x7ffd } }, - /* undefined opcodes here */ -{ "cvtfh", {"rfwh", 0x98fd } }, -{ "cvtfg", {"rfwg", 0x99fd } }, - /* undefined opcodes here */ -{ "cvthf", {"rhwf", 0xf6fd } }, -{ "cvthd", {"rhwd", 0xf7fd } }, - /* undefined opcodes here */ -{ "bugl", {"rl", 0xfdff } }, -{ "bugw", {"rw", 0xfeff } }, - /* undefined opcodes here */ - -{ "", {"", 0} } /* empty is end sentinel */ - -}; /* votstrs */ - -/* end: vax.opcode.h */ diff --git a/contrib/gdb/include/os9k.h b/contrib/gdb/include/os9k.h deleted file mode 100644 index 0f2eed2..0000000 --- a/contrib/gdb/include/os9k.h +++ /dev/null @@ -1,169 +0,0 @@ -#if !defined(_MODULE_H) -#define _MODULE_H - -/* OS-9000 i386 module header definitions */ -#define _MPF386 - -/* sizeof common header less parity field */ -#define N_M_PARITY (sizeof(mh_com)-sizeof(unisgned short)) -#define OLD_M_PARITY 46 -#define M_PARITY N_M_PARITY - -#ifdef _MPF68K -#define MODSYNC 0x4afd /* module header sync code for 680x0 processors */ -#endif - -#ifdef _MPF386 -#define MODSYNC 0x4afc /* module header sync code for 80386 processors */ -#endif - -#define MODREV 1 /* module format revision 1 */ -#define CRCCON 0x800fe3 /* crc polynomial constant */ - -/* Module access permission values */ -#define MP_OWNER_READ 0x0001 -#define MP_OWNER_WRITE 0x0002 -#define MP_OWNER_EXEC 0x0004 -#define MP_GROUP_READ 0x0010 -#define MP_GROUP_WRITE 0x0020 -#define MP_GROUP_EXEC 0x0040 -#define MP_WORLD_READ 0x0100 -#define MP_WORLD_WRITE 0x0200 -#define MP_WORLD_EXEC 0x0400 -#define MP_WORLD_ACCESS 0x0777 -#define MP_OWNER_MASK 0x000f -#define MP_GROUP_MASK 0x00f0 -#define MP_WORLD_MASK 0x0f00 -#define MP_SYSTM_MASK 0xf000 - -/* Module Type/Language values */ -#define MT_ANY 0 -#define MT_PROGRAM 0x0001 -#define MT_SUBROUT 0x0002 -#define MT_MULTI 0x0003 -#define MT_DATA 0x0004 -#define MT_TRAPLIB 0x000b -#define MT_SYSTEM 0x000c -#define MT_FILEMAN 0x000d -#define MT_DEVDRVR 0x000e -#define MT_DEVDESC 0x000f -#define MT_MASK 0xff00 - -#define ML_ANY 0 -#define ML_OBJECT 1 -#define ML_ICODE 2 -#define ML_PCODE 3 -#define ML_CCODE 4 -#define ML_CBLCODE 5 -#define ML_FRTNCODE 6 -#define ML_MASK 0x00ff - -#define mktypelang(type,lang) (((type)<<8)|(lang)) - -/* Module Attribute values */ -#define MA_REENT 0x80 -#define MA_GHOST 0x40 -#define MA_SUPER 0x20 -#define MA_MASK 0xff00 -#define MR_MASK 0x00ff - -#define mkattrevs(attr, revs) (((attr)<<8)|(revs)) - -#define m_user m_owner.grp_usr.usr -#define m_group m_owner.grp_usr.grp -#define m_group_user m_owner.group_user - -/* macro definitions for accessing module header fields */ -#define MODNAME(mod) ((u_char*)((u_char*)mod + ((Mh_com)mod)->m_name)) -#if 0 -/* Appears not to be used, and the u_int32 typedef is gone (because it - conflicted with a Mach header. */ -#define MODSIZE(mod) ((u_int32)((Mh_com)mod)->m_size) -#endif /* 0 */ -#define MHCOM_BYTES_SIZE 80 -#define N_BADMAG(a) (((a).a_info) != MODSYNC) - -typedef struct mh_com { - /* sync bytes ($4afc). */ - unsigned char m_sync[2]; - unsigned char m_sysrev[2]; /* system revision check value */ - unsigned char - m_size[4]; /* module size */ - unsigned char - m_owner[4]; /* group/user id */ - unsigned char - m_name[4]; /* offset to module name */ - unsigned char - m_access[2], /* access permissions */ - m_tylan[2], /* type/lang */ - m_attrev[2], /* rev/attr */ - m_edit[2]; /* edition */ - unsigned char - m_needs[4], /* module hardware requirements flags. (reserved) */ - m_usage[4], /* comment string offset */ - m_symbol[4], /* symbol table offset */ - m_exec[4], /* offset to execution entry point */ - m_excpt[4], /* offset to exception entry point */ - m_data[4], /* data storage requirement */ - m_stack[4], /* stack size */ - m_idata[4], /* offset to initialized data */ - m_idref[4], /* offset to data reference lists */ - m_init[4], /* initialization routine offset */ - m_term[4]; /* termination routine offset */ - unsigned char - m_ident[2]; /* ident code for ident program */ - char - m_spare[8]; /* reserved bytes */ - unsigned char - m_parity[2]; /* header parity */ -} mh_com,*Mh_com; - -/* Executable memory module */ -typedef mh_com *Mh_exec,mh_exec; - -/* Data memory module */ -typedef mh_com *Mh_data,mh_data; - -/* File manager memory module */ -typedef mh_com *Mh_fman,mh_fman; - -/* device driver module */ -typedef mh_com *Mh_drvr,mh_drvr; - -/* trap handler module */ -typedef mh_com mh_trap, *Mh_trap; - -/* Device descriptor module */ -typedef mh_com *Mh_dev,mh_dev; - -/* Configuration module */ -typedef mh_com *Mh_config, mh_config; - -#if 0 - -#if !defined(_MODDIR_H) -/* go get _os_fmod (and others) */ -#include -#endif - -error_code _os_crc(void *, u_int32, int *); -error_code _os_datmod(char *, u_int32, u_int16 *, u_int16 *, u_int32, void **, mh_data **); -error_code _os_get_moddir(void *, u_int32 *); -error_code _os_initdata(mh_com *, void *); -error_code _os_link(char **, mh_com **, void **, u_int16 *, u_int16 *); -error_code _os_linkm(mh_com *, void **, u_int16 *, u_int16 *); -error_code _os_load(char *, mh_com **, void **, u_int32, u_int16 *, u_int16 *, u_int32); -error_code _os_mkmodule(char *, u_int32, u_int16 *, u_int16 *, u_int32, void **, mh_com **, u_int32); -error_code _os_modaddr(void *, mh_com **); -error_code _os_setcrc(mh_com *); -error_code _os_slink(u_int32, char *, void **, void **, mh_com **); -error_code _os_slinkm(u_int32, mh_com *, void **, void **); -error_code _os_unlink(mh_com *); -error_code _os_unload(char *, u_int32); -error_code _os_tlink(u_int32, char *, void **, mh_trap **, void *, u_int32); -error_code _os_tlinkm(u_int32, mh_com *, void **, void *, u_int32); -error_code _os_iodel(mh_com *); -error_code _os_vmodul(mh_com *, mh_com *, u_int32); -#endif /* 0 */ - -#endif diff --git a/contrib/gdb/include/progress.h b/contrib/gdb/include/progress.h deleted file mode 100644 index f18318a..0000000 --- a/contrib/gdb/include/progress.h +++ /dev/null @@ -1,37 +0,0 @@ -/* Default definitions for progress macros. - Copyright (C) 1994 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. */ - -/* The default definitions below are intended to be replaced by real - definitions, if building the tools for an interactive programming - environment. */ - -#ifndef _PROGRESS_H -#define _PROGRESS_H - -#ifndef START_PROGRESS -#define START_PROGRESS(STR,N) -#endif - -#ifndef PROGRESS -#define PROGRESS(X) -#endif - -#ifndef END_PROGRESS -#define END_PROGRESS(STR) -#endif - -#endif /* _PROGRESS_H */ diff --git a/contrib/gdb/include/wait.h b/contrib/gdb/include/wait.h deleted file mode 100644 index fa3c9cc..0000000 --- a/contrib/gdb/include/wait.h +++ /dev/null @@ -1,63 +0,0 @@ -/* Define how to access the int that the wait system call stores. - This has been compatible in all Unix systems since time immemorial, - but various well-meaning people have defined various different - words for the same old bits in the same old int (sometimes claimed - to be a struct). We just know it's an int and we use these macros - to access the bits. */ - -/* The following macros are defined equivalently to their definitions - in POSIX.1. We fail to define WNOHANG and WUNTRACED, which POSIX.1 - defines, since our code does not use waitpid(). We - also fail to declare wait() and waitpid(). */ - -#ifndef WIFEXITED -#define WIFEXITED(w) (((w)&0377) == 0) -#endif - -#ifndef WIFSIGNALED -#define WIFSIGNALED(w) (((w)&0377) != 0177 && ((w)&~0377) == 0) -#endif - -#ifndef WIFSTOPPED -#ifdef IBM6000 - -/* Unfortunately, the above comment (about being compatible in all Unix - systems) is not quite correct for AIX, sigh. And AIX 3.2 can generate - status words like 0x57c (sigtrap received after load), and gdb would - choke on it. */ - -#define WIFSTOPPED(w) ((w)&0x40) - -#else -#define WIFSTOPPED(w) (((w)&0377) == 0177) -#endif -#endif - -#ifndef WEXITSTATUS -#define WEXITSTATUS(w) (((w) >> 8) & 0377) /* same as WRETCODE */ -#endif - -#ifndef WTERMSIG -#define WTERMSIG(w) ((w) & 0177) -#endif - -#ifndef WSTOPSIG -#define WSTOPSIG WEXITSTATUS -#endif - -/* These are not defined in POSIX, but are used by our programs. */ - -#define WAITTYPE int - -#ifndef WCOREDUMP -#define WCOREDUMP(w) (((w)&0200) != 0) -#endif - -#ifndef WSETEXIT -#define WSETEXIT(w,status) ((w) = (0 | ((status) << 8))) -#endif - -#ifndef WSETSTOP -#define WSETSTOP(w,sig) ((w) = (0177 | ((sig) << 8))) -#endif - diff --git a/contrib/gdb/libiberty/COPYING.LIB b/contrib/gdb/libiberty/COPYING.LIB deleted file mode 100644 index eb685a5..0000000 --- a/contrib/gdb/libiberty/COPYING.LIB +++ /dev/null @@ -1,481 +0,0 @@ - GNU LIBRARY GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1991 Free Software Foundation, Inc. - 675 Mass Ave, Cambridge, MA 02139, USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the library GPL. It is - numbered 2 because it goes with version 2 of the ordinary GPL.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Library General Public License, applies to some -specially designated Free Software Foundation software, and to any -other libraries whose authors decide to use it. You can use it for -your libraries, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if -you distribute copies of the library, or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link a program with the library, you must provide -complete object files to the recipients so that they can relink them -with the library, after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - Our method of protecting your rights has two steps: (1) copyright -the library, and (2) offer you this license which gives you legal -permission to copy, distribute and/or modify the library. - - Also, for each distributor's protection, we want to make certain -that everyone understands that there is no warranty for this free -library. If the library is modified by someone else and passed on, we -want its recipients to know that what they have is not the original -version, so that any problems introduced by others will not reflect on -the original authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that companies distributing free -software will individually obtain patent licenses, thus in effect -transforming the program into proprietary software. To prevent this, -we have made it clear that any patent must be licensed for everyone's -free use or not licensed at all. - - Most GNU software, including some libraries, is covered by the ordinary -GNU General Public License, which was designed for utility programs. This -license, the GNU Library General Public License, applies to certain -designated libraries. This license is quite different from the ordinary -one; be sure to read it in full, and don't assume that anything in it is -the same as in the ordinary license. - - The reason we have a separate public license for some libraries is that -they blur the distinction we usually make between modifying or adding to a -program and simply using it. Linking a program with a library, without -changing the library, is in some sense simply using the library, and is -analogous to running a utility program or application program. However, in -a textual and legal sense, the linked executable is a combined work, a -derivative of the original library, and the ordinary General Public License -treats it as such. - - Because of this blurred distinction, using the ordinary General -Public License for libraries did not effectively promote software -sharing, because most developers did not use the libraries. We -concluded that weaker conditions might promote sharing better. - - However, unrestricted linking of non-free programs would deprive the -users of those programs of all benefit from the free status of the -libraries themselves. This Library General Public License is intended to -permit developers of non-free programs to use free libraries, while -preserving your freedom as a user of such programs to change the free -libraries that are incorporated in them. (We have not seen how to achieve -this as regards changes in header files, but we have achieved it as regards -changes in the actual functions of the Library.) The hope is that this -will lead to faster development of free libraries. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, while the latter only -works together with the library. - - Note that it is possible for a library to be covered by the ordinary -General Public License rather than by this special one. - - GNU LIBRARY GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library which -contains a notice placed by the copyright holder or other authorized -party saying it may be distributed under the terms of this Library -General Public License (also called "this License"). Each licensee is -addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also compile or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - c) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - d) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the source code distributed need not include anything that is normally -distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Library General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - Appendix: How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! diff --git a/contrib/gdb/libiberty/ChangeLog b/contrib/gdb/libiberty/ChangeLog deleted file mode 100644 index b28ef2f..0000000 --- a/contrib/gdb/libiberty/ChangeLog +++ /dev/null @@ -1,1815 +0,0 @@ -Tue Mar 19 22:02:07 1996 Jason Merrill - - * cplus-dem.c (demangle_template): Fix for non-mangled pointer - arguments. - -Fri Mar 8 17:24:18 1996 Ian Lance Taylor - - * configure.in: If srcdir is `.' and with_target_subdir is not - `.', then set MULTISRCTOP before calling config-ml.in. - -Thu Mar 7 13:37:10 1996 Stan Shebs - - * mpw.c (mpw_open): Add debugging output option. - -Wed Mar 6 17:36:03 1996 Jason Merrill - - * cplus-dem.c (demangle_template): Fix for address-of-extern arguments. - -Tue Feb 27 12:00:50 1996 Raymond Jou - - * mpw.c (mpwify_filename): Change 6 to 5 in - strncmp (unixname, "/tmp/", 5). - -Tue Feb 20 10:55:53 1996 Ian Lance Taylor - - * cplus-dem.c (demangle_template): Initialize is_bool. Correctly - handle 0 as a pointer value parameter. - -Mon Feb 5 16:41:44 1996 Ian Lance Taylor - - * Makefile.in (all): Depend upon required-list. - (required-list): New target. - (clean): Remove required-list. - -Wed Jan 31 10:19:41 1996 Steve Chamberlain - - * win32.c: Deleted. - * config.table (i386-*-win32): Deleted. - * config/mh-i386win32: Deleted. - -Thu Jan 18 11:34:17 1996 Ian Lance Taylor - - * cplus-dem.c (cplus_demangle_opname): Change opname parameter to - const char *. - (cplus_mangle_opname): Change return type and opname parameter to - const char *. Don't cast return value. - -Tue Jan 16 12:13:11 1996 Stan Shebs - - * mpw.c: Include Timer.h, in order to get m68k Microseconds trap - definition. - -Wed Jan 3 13:15:04 1996 Fred Fish - - * obstack.c: Update copyright to 1996. - (_obstack_memory_used): Define new function. Called via - obstack_memory_used macro. - -Thu Dec 28 11:39:40 1995 Ian Lance Taylor - - * xstrdup.c: New file. - * Makefile.in (CFILES): Add xstrdup.c. - (REQUIRED_OFILES): Add xstrdup.o. - (xstrdup.o): New target. - -Mon Dec 11 18:18:52 1995 Mike Stump - - * atexit.c: New stub to provide atexit on systems that have - on_exit, like SunOS 4.1.x systems. - * functions.def (on_exit, atexit): Ditto. - -Mon Dec 11 15:42:14 1995 Stan Shebs - - * mpw.c (mpw_abort): Remove decl. - (mpw_access): Move debugging printf. - -Sat Dec 2 01:25:23 1995 Ian Lance Taylor - - * config.table: Consistently use ${host} rather than ${xhost} or - ${target}. - * configure.in: Don't bother to set ${xhost} before calling - config.table. - -Tue Nov 28 14:16:57 1995 Brendan Kehoe - - * Makefile.in (.c.o): Use test instead of the left bracket, to - avoid problems with some versions of make. - -Tue Nov 28 11:45:17 1995 Stan Shebs - - * mpw-make.sed: Fix INCDIR edit to work with Nov 14 change. - -Tue Nov 21 11:26:34 1995 Fred Fish - - * config/mh-hpux: Remove. It was only used to define EXTRA_OFILES, - which was set to just alloca.o, which is now automatically marked - as needed by the autoconfiguration process. - -Tue Nov 21 14:15:06 1995 Ian Lance Taylor - - * config.table: Check ${with_cross_host} rather than comparing - ${host} and ${target}. - -Thu Nov 16 14:34:42 1995 Ian Lance Taylor - - * configure.in: If with_target_subdir is empty, set xhost to - ${host} rather than ${target} before calling config.table. - -Tue Nov 14 01:38:30 1995 Doug Evans - - * Makefile.in (MULTITOP): Deleted. - (MULTISRCTOP, MULTIBUILDTOP): New. - (FLAGS_TO_PASS): Delete INCDIR. - (INCDIR): Add $(MULTISRCTOP). - (install_to_libdir): Add $(MULTISUBDIR). Call $(MULTIDO). - * configure.in: Delete call to cfg-ml-com.in. Call config-ml.in - instead of cfg-ml-pos.in. - (cross-compile check): Change to test for with_target_subdir. - (EXTRA_LINKS): Delete. - -Sun Nov 12 12:13:04 1995 Stan Shebs - - * mpw-make.sed: Add getpagesize.c.o to needed-list. - * mpw.c [USE_MW_HEADERS]: Conditionalize compiling of - functions that are supplied by Metrowerks libraries. - (fstat): Clean up descriptor->pointer conversion code. - (InstallConsole, etc): Empty definitions, for when linking - with SIOUX. - -Sun Nov 5 19:25:27 1995 Per Bothner - - * Makefile.in (FLAGS_TO_PASS): Also pass PICFLAGS. - (.c.o): Stylistic change. - -Thu Nov 2 12:06:29 1995 Ian Lance Taylor - - * strtol.c, strtoul.c: Don't include . From - phdm@info.ucl.ac.be (Philippe De Muyter). - -Wed Nov 1 11:59:36 1995 Ian Lance Taylor - - * configure.in: Correct sed call. - -Mon Oct 30 13:03:45 1995 Per Bothner - - * configure.in: Clean up / simplify for native. - - * configure.in: Merge in stuff from ../xiberty/configure.in. - * Makefile.in (CC): Add definition (so it can be overrridden - by ../configure). - -Tue Oct 24 17:57:27 1995 Stan Shebs - - * mpw-make.sed: Leave strerror.c.o in standard list of functions. - * mpw.c (R_OK, ENOENT, EACCESS, ENOSYS): Remove. - (link): Remove useless definition with error return. - (last_microseconds, warn_if_spin_delay, record_for_spin_delay): - Use UnsignedWide type for microsecond counts. - -Thu Oct 19 10:52:07 1995 Michael Meissner - - * memcmp.c (memcmp): Argument types are const void *, not void - *const. - - * strncasecmp.c (strncasecmp): Include ansidecl.h/stdarg.h, not - sys/types.h. - * strcasecmp.c (strcasecmp): Ditto. - -Tue Oct 10 11:03:24 1995 Fred Fish - - * Makefile.in (BISON): Remove macro. - -Tue Sep 26 15:06:46 1995 Stan Shebs - - * Makefile.in (HFILES): Add default empty definition. - * mpw-config.in (config.h): Only update if changed. - * mpw-make.in: Remove. - * mpw-make.sed: New file, edits Makefile.in into MPW makefile. - * mpw.c: Remove semi-clone of strerror code. - (sys_nerr, sys_errlist): Define here. - (Microseconds): Only define as A-line trap if m68k Mac. - -Wed Sep 20 12:53:32 1995 Ian Lance Taylor - - * Makefile.in (maintainer-clean): New synonym for distclean. - -Mon Aug 28 19:47:52 1995 Per Bothner - - * config.table: For host, generalize rs6000-ibm-aix* - to *-ibm-aix* so we also include powerpc. - -Tue Aug 22 03:18:05 1995 Ken Raeburn - - Fri Jun 16 18:35:40 1995 Pat Rankin (rankin@eql.caltech.edu) - - * xstrerror.c: New file. - * Makefile.in, vmsbuild.com: Compile it. - -Mon Jul 31 12:16:32 1995 steve chamberlain - - * config.table (i386-*-win32): New. - -Fri Jul 21 11:35:52 1995 Doug Evans - - * Makefile.in (MULTITOP): New variable. - (MULTIDIRS, MULTISUBDIR, MULTIDO, MULTICLEAN): Likewise. - (all): Add multilib support. - (install_to_tooldir, *clean): Likewise. - -Mon Jul 10 11:47:27 1995 Ken Raeburn - - * makefile.dos (OBJS): Add hex.o. From DJ Delorie. - -Fri Jun 30 17:28:59 1995 Pat Rankin (rankin@eql.caltech.edu) - - * vmsbuild.com: create "new-lib.olb", build libiberty under that - name, and then make it become "liberty.olb" when done, so that an - incomplete build attempt never leaves behind something which looks - like a complete library. - -Thu Jun 29 00:22:02 1995 Steve Chamberlain - - * config/mh-i386pe: New file for PE hosts. - * config.table: Understand PE hosts. - -Wed Jun 28 19:13:23 1995 Jason Merrill - - * cplus-dem.c: Update from gcc. - - * argv.c, dummy.c: If __STDC__, #include "alloca-conf.h" after - . - * alloca-norm.h: If __STDC__, declare alloca with its parameter. - -Thu Jun 22 18:57:47 1995 Stan Shebs - - * mpw-make.in (ALL_CFLAGS): Define NEED_basename. - * mpw.c: Only test DebugPI once whenever printing debug info. - (mpwify_filename): If filename is /tmp/foo, change it into :_foo, - also fix to not write on input filename buffer. - (mpw_access): Use stat() instead of open(), works for directories - as well as files. - -Mon Jun 19 00:33:22 1995 Jason Merrill - - * Makefile.in: Massage broken shells that require 'else true'. - -Sat Jun 17 23:21:58 1995 Fred Fish - - * alloca-norm.h: Declare alloca as type "PTR" to match functions.def. - Declare __builtin_alloca in the sparc case, as argv.c did. - * argv.c: Replace inline version of alloca-norm.h at start of file with - a #include of alloca-conf.h. Precede it with an include of ansidecl.h - because alloca-norm.h needs to declare alloca as "PTR". - -Mon Jun 12 14:24:26 1995 Steve Chamberlain - - * win32.c: New file. - -Fri Jun 9 15:16:14 1995 Jason Merrill - - * dummy.c: #include "alloca-conf.h". - -Wed Jun 7 11:46:23 1995 Jason Merrill - - * Makefile.in (mostlyclean): Remove stamp-picdir. - (clean): Don't. - -Mon Jun 5 18:46:06 1995 Jason Merrill - - * config.table (frags): Use toplevel pic frags. - - * Makefile.in (PICFLAG): New macro. - (all): Depend on stamp-picdir. - (needed-list): Ditto. - (.c.o): Also build pic object. - (stamp-picdir): New rule. - (mostlyclean): Remove pic. - (clean): Remove stamp-picdir. - -Fri Mar 24 16:55:48 1995 Pat Rankin (rankin@eql.caltech.edu) - - * vmsbuild.com (config.h): Add `#define NEED_basename'. - -Tue May 23 10:12:46 1995 Per Bothner - - * clock.c, getopt.c, strtod.c, vsprintf.c: Change from using LGPL - to libio-style copyright. - * getpagesize.c: Remove FSF copyright. - -Sat May 20 12:30:23 1995 Ken Raeburn - - Added improved VMS support from Pat Rankin: - - Fri Mar 17 18:40:36 1995 Pat Rankin (rankin@eql.caltech.edu) - - * vmsbuild.com: new file. - - * getpagesize.c (getpagesize): implement for VMS; - * strerror.c (strerror, strerrno, strtoerrno): add rudimentary - support for EVMSERR. - -Thu May 18 17:01:42 1995 Ken Raeburn - - Wed May 10 14:28:16 1995 Richard Earnshaw (rearnsha@armltd.co.uk) - - * floatformat.c (floatformat_arm_ext): Define. - -Tue May 16 13:30:59 1995 Per Bothner - - * basename.c, bcmp.c, getcwd.c, insque.c, rename.c, sigsetmask.c, - strerror.c, strsignal.c: Remove FSF copyright. - * sigsetmask.c: #include - seems to be needed by ISC. - -Mon May 15 19:53:17 1995 Per Bothner - - * bcopy.c, bzero.c, memcmp.c, memcpy.c, memset.c, strchr.c, - strrchr.c, strstr.c, vfork.c: Remove FSF Copyright, because this - might contaminate libstdc++ with the LGPL. (OK'd by RMS 11 Oct 94.) - * strchr.c, strrchr.c: Add cast to suppress const warning. - -Thu May 4 14:36:42 1995 Jason Merrill - - * cplus-dem.c: Use const instead of CONST. Don't include - ansidecl.h directly. - -Wed Apr 19 01:30:27 1995 Jason Merrill - - * cplus-dem.c: Don't include libiberty.h. Do declare xmalloc and - xrealloc. - (-DMAIN): Don't rely on an externally-defined version number; - instead, require the version number to be defined as a - preprocessor macro. Handle the RS/6000 leading dot. Define - xmalloc, xrealloc and fatal. Don't strip a leading underscore - if we couldn't demangle the word. - -Tue Apr 4 13:03:51 1995 Stan Shebs - - (Old mpw.c change descriptions retained for informational value.) - * mpw.c (warning_threshold): Default to .4 sec. - (overflow_count, current_progress): New globals. - (warn_if_spin_delay): Include current progress type, - such as program name, in message. - (mpw_start_progress): Set current_progress variable from arg. - (mpw_end_progress): Report spin delays by power-of-two-size - buckets instead of constant-size buckets. - - * mpw.c: Clean up formatting, types, returns, etc. - (ENOSYS): Define. - (mpw_fread, mpw_fwrite): Define. - (sleep): Define correctly. - - * mpw.c: New code to implement cursor spinning support. - (umask): New function. - (mpw_fopen, mpw_fseek, stat, fstat): Call PROGRESS. - - * mpw.c (mpw_basename, mpw_mixed_basename): New functions, find - basenames for MPW and MPW/Unix filenames. - (mpw_special_init): New function, calls Macsbug if desired. - - * mpw.c: Add GPL notice. - (mpwify_filename): Add more transformations. - (mpw_fopen): Call mpwify_filename on file names. - (rename): Remove. - (chdir, getcwd): Add simple definitions. - - * mpw.c: Random cleanups, remove unused code bits. - Added copy of strerror.c for gcc's use. - (stat, fstat, _stat): New versions based on Guido van Rossum code. - - * mpw.c (mpw_fseek): Make it work correctly when doing SEEK_CUR. - - * mpw.c (stat): Remove hack definition, get from sys/stat.h. - (fork, vfork, etc): Print error messages if called. - (getrusage, sbrk, environ, isatty, link, utime, mkdir, rmdir, - rename, chown): Define. - - * mpw-config.in: New file, MPW version of configure.in. - * mpw-make.in: New file, MPW version of Makefile.in. - * mpw.c: New file, MPW compatibility routines. - -Fri Mar 24 14:10:30 1995 Jim Kingdon (kingdon@lioth.cygnus.com) - - * basename.c: Include config.h before checking for NEED_basename. - -Thu Mar 23 19:09:54 1995 Jason Merrill - - * functions.def: Add DEFFUNC for basename. - - * basename.c: Only define basename if NEED_basename. - -Thu Mar 16 13:36:05 1995 Jason Merrill - - * config.table: Fix --enable-shared logic for native builds. - -Mon Mar 13 11:05:11 1995 Jason Merrill - - * cplus-dem.c (demangle_template): Demangle bool literals properly. - -Mon Mar 6 23:57:28 1995 Stu Grossman (grossman@cygnus.com) - - * strtol.c strtoul.c: Replace these with less buggy versions from - NetBSD. (strtoul in particular couldn't handle base 16.) - -Wed Mar 1 15:59:01 1995 Ian Lance Taylor - - * config/mt-vxworks5 (HDEFINES): Define NO_SYS_PARAM_H. - - * clock.c: If NO_SYS_PARAM_H is defined, don't include - . - * getcwd.c, getpagesize.c, getruntime.c: Likewise. - -Fri Feb 17 15:40:55 1995 Ian Lance Taylor - - * getruntime.c (get_run_time): Don't assume that CLOCKS_PER_SEC is - a number; ANSI appears to permit any expression, including a - function call. - - * config.table (*-*-vxworks5*): Use mt-vxworks5 when configuring - xiberty. - * config/mt-vxworks5: New file. - -Thu Feb 9 14:19:45 1995 Ian Lance Taylor - - * basename.c (basename): Change argument to be const. - -Wed Feb 8 18:06:52 1995 Jason Merrill - - * Makefile.in (lneeded-list): Don't worry about xmalloc. - -Sun Jan 15 00:40:36 1995 Jeff Law (law@snake.cs.utah.edu) - - * Makefile.in (distclean): Delete xhost-mkfrag. - -Thu Jan 12 16:54:18 1995 Jason Merrill - - * Makefile.in (lneeded-list): If alloca.o is needed, so is xmalloc.o. - -Wed Jan 11 22:39:56 1995 Ken Raeburn - - * hex.c: New file. - * Makefile.in (REQUIRED_OFILES, CFILES): List it. - (hex.o): Add dependencies. - - * cplus-dem.c (demangle_prefix): For GNU style constructor and - destructor names, try demangling the remainder of the string. - -Wed Dec 28 00:49:15 1994 Ian Lance Taylor - - * vasprintf.c (int_vasprintf): New static function. - (vasprintf): Use int_vasprintf. Removes assumption that va_list - is assignment compatible. - -Sat Nov 5 19:29:12 1994 Jason Merrill (jason@phydeaux.cygnus.com) - - * Makefile.in (LIBCFLAGS): New variable. - (FLAGS_TO_PASS): Pass it. - (.c.o): Use it. - -Thu Nov 3 19:09:47 1994 Ken Raeburn - - * getopt.c, getopt1.c: Do compile these functions under Linux, - since many native versions are based on glibc but are buggy. - -Mon Oct 24 15:16:46 1994 Per Bothner - - * vasprintf.c: Make 'format' arg be const, to avoid a mismatch - with prototype in GNU libc. Support stdarg.h as well as varargs.h. - -Tue Oct 11 17:48:27 1994 Jason Merrill (jason@phydeaux.cygnus.com) - - * Makefile.in (REQUIRED_OFILES): Add vasprintf.o. - * functions.def: Remove vasprintf. - -Wed Sep 14 17:04:55 1994 Ian Lance Taylor (ian@sanguine.cygnus.com) - - * xmalloc.c (first_break): New static variable. - (xmalloc_set_program_name): Record sbrk (0) in first_break. - (xmalloc): If memory allocation fails, try to report how much - memory was allocated by the program up to this point. - (xrealloc): Likewise. - -Sun Sep 04 17:58:10 1994 Richard Earnshaw (rwe@pegasus.esprit.ec.org) - - * Makefile.in (ERRORS_CC): New variable, defaulted to $(CC). Use it - when linking dummy. - * config.table: Add host RISCiX Makefile frag. - * config/mh-riscix: New file. - -Thu Aug 25 17:29:44 1994 Ian Lance Taylor (ian@sanguine.cygnus.com) - - * Makefile.in (FLAGS_TO_PASS): Define. - ($(RULE1)): Use $(FLAGS_TO_PASS). - -Wed Aug 24 17:08:47 1994 Ian Lance Taylor (ian@sanguine.cygnus.com) - - * vasprintf.c: Include . - (vasprintf): Add casts to void for va_arg to avoid gcc warnings. - * xatexit.c: Declare malloc. - -Fri Aug 19 15:29:12 1994 Kung Hsu (kung@mexican.cygnus.com) - - * cplus-dem.c (demangle_args): Fix a bug in previous patch (the - one below). - -Thu Aug 18 14:37:14 1994 Kung Hsu (kung@mexican.cygnus.com) - - * cplus-dem.c (demangle args): Handle ARM repeat encoding where - the type index is greater than 9. - -Wed Aug 17 16:13:49 1994 Kung Hsu (kung@mexican.cygnus.com) - - * cplus-dem.c (demangle_qualified): accept optional '_' between - qualified name. This is baecause the template name may end with - numeric and can mixed up with the length of next qualified name. - -Wed Aug 3 05:52:14 1994 D. V. Henkel-Wallace (gumby@cygnus.com) - - * config/mt-sunos4: Use our standard location for cross-includes - and cross-libs when the target is also a "host" environment (ie no - newlib; includes and such don't belong to us). This is specific - to the Cygnus Support environment. - -Tue Aug 2 15:25:12 1994 Kung Hsu (kung@mexican.cygnus.com) - - * cplus-dem.c (demangle_template): demangle as xxx<'Q'> not - xxx. - -Mon Aug 1 17:02:48 1994 Kung Hsu (kung@mexican.cygnus.com) - - * cplus-dem.c (main): flush stdout to make pipe work. - -Sat Jul 16 12:56:32 1994 Stan Shebs (shebs@andros.cygnus.com) - - * config.table (*-*-cxux7*): Recognize. - * floatformat.c (floatformat_m88110_ext) [HARRIS_FLOAT_FORMAT]: - Harris-specific float format. - * config/mh-cxux7: New file. - -Wed Jun 29 00:26:17 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * cplus-dem.c (demangle_template): Make sure that the result of - consume_count doesn't index beyond the end of the string. - -Mon Jun 20 23:54:37 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * cplus-dem.c (gnu_special): Handle vtable mangling of gcc-2.4.5 and - earlier. Improve test for new vtable mangling. Change output back - to `virtual table'. - -Mon Jun 20 11:37:30 1994 Ian Lance Taylor (ian@sanguine.cygnus.com) - - * obstack.c: Always compile this code, even if using the GNU - library. Avoids problems with relatively recent binary - incompatibility. - -Thu Jun 16 17:54:01 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * cplus-dem.c: Include libiberty.h. - (xmalloc, xrealloc, free): Don't declare. - (strstr): Don't declare parameters. - (xmalloc, xrealloc): Don't define. - (long_options): Add no-strip-underscores. - (main): Call xmalloc_set_program_name. Pass n in short options to - getopt_long. Handle option 'n' to not strip underscores. - (usage): Mention -n and --no-strip-underscores. - -Sun Jun 12 01:37:09 1994 Jason Merrill (jason@deneb.cygnus.com) - - * cplus-dem.c (demangle_template): Separate consecutive >'s with a - space. - (gnu_special): Demangle template and qualified names in a vtable name. - -Fri May 27 12:27:52 1994 Ken Raeburn (raeburn@cujo.cygnus.com) - - From gas-2.3 and binutils-2.4 net releases: - - Wed May 11 22:32:00 1994 DJ Delorie (dj@ctron.com) - - * makefile.dos: [new] Makefile for dos/go32 - * configure.bat: update for latest files - * msdos.c: remove some functions now in libc.a - -Fri May 20 18:53:32 1994 Per Bothner (bothner@kalessin.cygnus.com) - - * cplus-dem.c (gnu_special): Recognize thunks, as well as - the new naming style for vtables (when -fvtable-thunks). - -Wed May 18 13:34:06 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * Makefile.in (XTRAFLAGS): Don't define. - (.c.o, dummy.o): Don't use XTRAFLAGS. - ($(RULE1)): Don't pass XTRAFLAGS down in recursive call. - -Fri May 13 16:02:12 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * vasprintf.c: New file. - * Makefile.in, functions.def: Add it. - -Fri May 13 16:20:28 1994 Jason Merrill (jason@deneb.cygnus.com) - - * cplus-dem.c (demangle_fund_type): Grok bool. - -Fri May 6 14:44:21 1994 Steve Chamberlain (sac@cygnus.com) - - * config.table: Add go32 - * config/mh-go32: New template. - -Fri May 6 11:01:59 1994 D. V. Henkel-Wallace (gumby@rtl.cygnus.com) - - * config.table, config/mt-sunos4: config for when sun4 is cross target. - -Mon Apr 11 00:54:33 1994 Richard Stallman (rms@mole.gnu.ai.mit.edu) - - * getopt.c [not __GNU_LIBRARY__] [__GCC__] [not __STDC__]: - Declare strlen to return int. Don't include stddef.h. - -Fri Apr 1 00:38:17 1994 Jim Wilson (wilson@mole.gnu.ai.mit.edu) - - * getopt.c: Delete use of IN_GCC to control whether - stddef.h or gstddef.h is included. - -Thu Apr 14 14:00:56 1994 Kung Hsu (kung@mexican.cygnus.com) - - * cplus-dem.c (demangle_signature): Fix a bug in template function - type numbering. - -Wed Apr 13 17:23:03 1994 Kung Hsu (kung@mexican.cygnus.com) - - * cplus-dem.c (demangle_signature): Fix template function with arm - style argument type number, Tn. - -Wed Apr 13 17:11:15 1994 Jason Merrill (jason@deneb.cygnus.com) - - * cplus-dem.c (optable): Add new[] and delete[]. - -Fri Apr 8 11:21:42 1994 Jim Kingdon (kingdon@deneb.cygnus.com) - - * argv.c (buildargv): Don't produce empty argument just because - there is trailing whitespace. - -Wed Apr 6 11:42:14 1994 Kung Hsu (kung@mexican.cygnus.com) - - * cplus-dem.c (demangle_template): fix 'Q' qualified name bug. - Handle 'p' same as 'P'. - * cplus-dem.c (do_type): Handle 'p' same as 'P'. - -Sat Mar 26 12:00:13 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * floatformat.c (get_field, put_field): Fix off by one error in - little endian case. - -Thu Mar 24 10:40:19 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * floatformat.c (floatformat_from_double): Pass unsigned char *, - not char *, to put_field. - -Fri Mar 18 12:34:33 1994 Per Bothner (bothner@kalessin.cygnus.com) - - * memmove.c: Re-wrote; placed in public domain. - -Wed Mar 16 10:33:07 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * cplus-dem.c (demangle_prefix): If ARM demangling, don't treat - __Q* as a constructor. - -Mon Mar 14 12:26:02 1994 Ian Lance Taylor (ian@cygnus.com) - - * ieee-float.c: Removed; no longer used. - * Makefile.in: Changed accordingly. - -Mon Mar 7 12:28:17 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * floatformat.c (get_field): Removed unused local variable i. - (put_field): Removed unused local variable i. - -Sun Feb 27 21:50:11 1994 Jim Kingdon (kingdon@deneb.cygnus.com) - - * floatformat.c: New file, intended to replace ieee-float.c. - * Makefile.in: Change accordingly. - -Thu Feb 24 11:51:12 1994 David J. Mackenzie (djm@rtl.cygnus.com) - - * getopt.c: Remove #ifdef GETOPT_COMPAT and #if 0 code. - (_getopt_initialize): New function, broken out of _getopt_internal. - (_getopt_internal): - If long_only and the ARGV-element has the form "-f", where f is - a valid short option, don't consider it an abbreviated form of - a long option that starts with f. Otherwise there would be no - way to give the -f short option. - -Thu Feb 10 14:44:16 1994 Richard Stallman (rms@mole.gnu.ai.mit.edu) - - * getopt.c [not __GNU_LIBRARY__] [__GNUC__] [not IN_GCC]: - Test just __STDC__, not emacs. - -Wed Feb 9 00:14:00 1994 Richard Stallman (rms@mole.gnu.ai.mit.edu) - - * getopt.c [not __GNU_LIBRARY__] [__GNUC__] [not IN_GCC] - [emacs] [not __STDC__]: Don't include stddef.h. Don't declare strlen. - -Fri Dec 24 19:43:00 1993 Noah Friedman (friedman@nutrimat.gnu.ai.mit.edu) - - * getopt.c (_NO_PROTO): Define before config.h is included. - -Mon Sep 20 15:59:03 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) - - * getopt.c, getopt1.c [emacs || CONFIG_BROKETS]: Include - only under these, else "config.h". - -Thu Aug 12 18:16:49 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) - - * getopt.c, getopt1.c [HAVE_CONFIG_H]: Include - instead of "config.h". - -Sun Feb 20 17:17:01 1994 Ian Lance Taylor (ian@lisa.cygnus.com) - - * concat.c: Check ANSI_PROTOTYPES rather than __STDC__ to decide - whether to use prototypes or not. - * strerror.c (const): Never undefine; let ansidecl.h handle it. - * strsignal.c (const): Likewise. - -Thu Feb 17 13:27:35 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * xatexit.c (_xexit_cleanup): Declare as extern; don't initialize. - Merging common and initialized variables need not be supported by - ANSI C compilers. - (xatexit): Initialize _xexit_cleanup if not already set. - * xexit.c: Comment fix. - -Wed Feb 16 01:15:36 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * xmalloc.c: Don't declare xexit; it's declared in libiberty.h. - (xrealloc): If oldmem is NULL, allocate with malloc, rather than - assuming that realloc works correctly. - -Tue Feb 15 09:26:16 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * concat.c, ieee-float.c: Replace inclusion of - with explicit function declarations, as recommended by Ian Taylor. - -Sat Feb 12 10:31:11 1994 David J. Mackenzie (djm@rtl.cygnus.com) - - * xmalloc.c (xmalloc, xrealloc): Use PTR and size_t throughout. - (malloc, realloc): Declare. - -Thu Feb 10 17:08:19 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * argv.c, basename.c: Include ansidecl.h and libiberty.h. - * concat.c, fdmatch.c, getruntime.c, spaces.c: Likewise. - * strerror.c, strsignal.c, xatexit.c, xexit.c: Likewise. - * xmalloc.c: Likewise. - * concat.c: Don't declare xmalloc. If __STDC__, use - macros, not macros. - * spaces.c (spaces): Make return type const. Don't crash if - malloc returns NULL. - * strerror.c (struct error_info): Make name and msg fields const. - (error_names): Make const. - (strerrno): Make const. - (strtoerrno): Make argument const. - * strsignal.c (struct signal_info): Make name and msg fields - const. - (signal_names, sys_siglist): Make const. - (strsignal, strsigno): Make const. - (strtosigno): Make argument const. - * xatexit.c: Declare parameter types. - * xmalloc.c (name): Make const. - (xmalloc_set_program_name): Make argument const. - * Makefile.in (INCDIR): Define. - (.c.o): Use $(INCDIR). - (dummy.o): Likewise. - (argv.o, basename.o): New targets; depend on libiberty.h. - (concat.o, fdmatch.o, getruntime.o, spaces.o): Likewise. - (strerror.o, strsignal.o, xatexit.o, xexit.o): Likewise. - (xmalloc.o): Likewise. - (cplus-dem.o): New target; depend on demangle.h. - (getopt.o, getopt1.o): New targets; depend on getopt.h. - (ieee-float.o): New target; depend on ieee-float.h. - (obstack.o): New target; depend on obstack.h. - -Tue Feb 8 05:29:08 1994 David J. Mackenzie (djm@thepub.cygnus.com) - - Handle obstack_chunk_alloc returning NULL. This allows - obstacks to be used by libraries, without forcing them - to call exit or longjmp. - * obstack.c (_obstack_begin, _obstack_begin_1, _obstack_newchunk): - If CALL_CHUNKFUN returns NULL, set alloc_failed, else clear it. - (_obstack_begin, _obstack_begin_1): Return 1 if successful, 0 if not. - -Tue Feb 8 00:32:28 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * concat.c, ieee-float.c: Include . - -Sun Feb 6 21:28:46 1994 David J. Mackenzie (djm@thepub.cygnus.com) - - * xmalloc.c (xmalloc_set_program_name): New function. - (xmalloc, xrealloc): Include the name in the error message, if set. - - * Replace atexit.c with xatexit.c. - * Makefile.in (CFILES), functions.def: Change references. - -Sat Feb 5 14:02:32 1994 Stan Shebs (shebs@andros.cygnus.com) - - * getruntime.c (get_run_time): Use getrusage or times if - HAVE_GETRUSAGE or HAVE_TIMES are defined. - -Fri Feb 4 15:49:38 1994 David J. Mackenzie (djm@thepub.cygnus.com) - - * atexit.c: New file. - * Makefile.in (CFILES), functions.def: Add it. - * xexit.c: New file. - * Makefile.in (CFILES, REQUIRED_OFILES): Add it. - * xmalloc.c (xmalloc, xrealloc): Call xexit instead of exit. - Change request for 0 bytes into request for 1 byte. - -Wed Feb 2 11:36:49 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * xmalloc.c (xmalloc, xrealloc): Print size using %lu, and cast to - unsigned long, to avoid warnings. - -Fri Jan 28 17:49:06 1994 Ken Raeburn (raeburn@cujo.cygnus.com) - - * dummy.c: Don't include time.h ever; always define clock_t as - "unsigned long". Until gcc/fixincludes ensures that clock_t - exists, __STDC__ isn't a sufficient test. And if clock() doesn't - exist, clock_t probably doesn't either. - -Mon Jan 24 11:52:31 1994 Stan Shebs (shebs@andros.cygnus.com) - - * clock.c, getruntime.c: New files. - * Makefile.in: Add to file lists. - * functions.def (clock): Add to list. - * dummy.c (time.h): Add if __STDC__. - (clock_t): #define as "unsigned long" if not __STDC__. - -Tue Jan 11 11:27:44 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * strtod.c: Declare atof. From edler@jan.ultra.nyu.edu (Jan - Edler). - -Tue Dec 28 14:17:30 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * Makefile.in (errors): Use CFLAGS as well as LDFLAGS when - linking. - -Fri Dec 17 12:26:07 1993 Kung Hsu (kung@cirdan.cygnus.com) - - * cplus-dem.c (demangle_arm_pt): New function. Common code - for ARM template demangling. - * cplus-dem.c (demangle_class_name): Use demangle_arm_pt. - * cplus-dem.c (demangle_prefix): Likewise. - -Tue Nov 30 15:47:48 1993 Jason Merrill (jason@deneb.cygnus.com) - - * cplus-dem.c (cplus_demangle_opname): Add CONST to please gcc. - -Sat Nov 27 11:05:50 1993 Fred Fish (fnf@cygnus.com) - - Merge changes from tom@basil.icce.rug.nl (Tom R.Hageman) - * strerror.c, strsignal.c: As a small space optimization, don't - include messages when they aren't actually used. - - Merge changes from takefive.co.at!joe (Josef Leherbauer) - * cplus-dem.c (demangle_prefix, demangle_function_name, - cplus_demangle_opname): Fixes for systems where cplus_marker - is something other than '$'. - -Fri Nov 26 13:51:11 1993 Per Bothner (bothner@kalessin.cygnus.com) - - * waitpid.c: Simple-minded approcimation to waitpid - using vanilla wait. - * functions.def, Makefile.in: Update accordingly, - -Thu Nov 18 18:01:15 1993 Kung Hsu (kung@cirdan.cygnus.com) - - * cplus-dem.c(demangle_template): fix bug template instantiation - with value of user defined type. - -Wed Nov 17 18:30:21 1993 Kung Hsu (kung@cirdan.cygnus.com) - - * cplus-dem.c(cplus_demangle_opname): add the subject new function - to support unified search of operator in class. - -Wed Nov 10 09:47:22 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - gcc -Wall lint: - * strtoul.c (strtoul): use "(digit = *s) != '\0'" not just - "digit = *s" as condition in while loop. - -Tue Nov 9 15:52:22 1993 Mark Eichin (eichin@cygnus.com) - - * Makefile.in: pass SHELL to recursive make - -Thu Nov 4 12:09:26 1993 Per Bothner (bothner@kalessin.cygnus.com) - - * vfprintf.c, vprintf.c, vsprintf.c: Make format arg - be (const char*), for ANSI (and gcc w/fixproto) consistency. - -Thu Nov 4 08:29:04 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * config.table: Make *-*-hiux* use mh-hpux. - -Fri Oct 22 07:53:15 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * config.table: Add * to end of all OS names. - -Tue Oct 19 17:12:01 1993 david d `zoo' zuhn (zoo@rtl.cygnus.com) - - * Makefile.in (lneeded-list): ensure that object file names are - not duplicated, as multiple instances of the same object file in - a library causes problems on some machines - -Mon Oct 18 21:59:28 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * strcasecmp.c, strncasecmp.c: Change u_char to unsigned char. - -Fri Oct 15 22:17:11 1993 david d `zoo' zuhn (zoo@rtl.cygnus.com) - - * strncasecmp.c: new file, implements strncasecmp - * strcasecmp.c: new file, implement strcasecmp - - * Makefile.in (CFILES): list these two new source files - - * functions.def: add strcasecmp and strncasecmp entries - -Fri Oct 15 14:53:05 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * strtoul.c (strtoul), strtol.c (strtol): Handle overflow - according to ANSI C. - -Thu Oct 14 16:34:19 1993 Kung Hsu (kung@cirdan.cygnus.com) - - * cplus-dem.c: add support of ARM global constructor/destructor, - and 'G' for passing record or union in parameter. - -Wed Oct 13 13:36:19 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * Makefile.in: Fix comment to clarify that stuff in REQUIRED_OFILES - should not be in functions.def. - -Wed Oct 13 13:13:38 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * functions.def: Removed xmalloc. Stuff in REQUIRED_OFILES should - not be in functions.def. - -Mon Oct 4 18:26:39 1993 Kung Hsu (kung@cirdan.cygnus.com) - - * cplus-dem.c: change globl constructor/destructor to proper name - -Tue Sep 28 18:11:07 1993 Kung Hsu (kung@cirdan.cygnus.com) - - * cplus-dem.c: fix bug in constructor/destructor - -Tue Sep 28 16:20:49 1993 Kung Hsu (kung@cirdan.cygnus.com) - - * cplus-dem.c: support both old and new _vt$... vtbl mangled names - -Fri Sep 24 19:07:16 1993 Jason Merrill (jason@deneb.cygnus.com) - - * cplus-dem.c: Fix demangle_template prototype - -Fri Sep 24 17:32:55 1993 Kung Hsu (kung@cirdan.cygnus.com) - - * cplus-dem.c: fix template demangling - * cplus-dem.c: fix const type demangling - * cplus-dem.c: fix constructor/destructor, virtual table, - qualifier, global constructor/destructor demangling - -Wed Sep 1 23:13:11 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * strsignal.c, strerror.c: Use fully-bracketed initializer to - keep gcc -Wall happy. - -Fri Aug 27 10:30:09 1993 Jason Merrill (jason@deneb.cygnus.com) - - * cplus-dem.c (do_type): Add CONSTS to make gcc happy with last - patch. - -Fri Aug 27 11:24:54 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - Patch from Paul Flinders: - * cplus-dem.c (do_type): Deal with arrays. - -Tue Aug 24 14:23:50 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * cplus-dem.c (demangle_qualified: Deal with GNU format for more - than 9 classes. - -Wed Aug 18 19:50:29 1993 Jason Merrill (jason@deneb.cygnus.com) - - * Makefile.in (dummy.o): Redirect to /dev/null to avoid "variable - not initialized" warnings under HP/UX - -Sun Aug 15 20:42:40 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * strerror.c: Move include of stdio.h after sys_errlist #define. - Also remove NULL definition (stdio.h always defines NULL, so it - never did anything but clutter up the code). - -Sat Aug 14 14:21:49 1993 david d `zoo' zuhn (zoo@rtl.cygnus.com) - - * Makefile.in, functions.def: handle xmalloc.c - - * xmalloc.c: provide xmalloc and xrealloc functions - -Thu Aug 12 17:38:57 1993 David J. Mackenzie (djm@thepub.cygnus.com) - - * cplus-dem.c: Fix a comment. - -Sat Aug 7 13:56:35 1993 David J. Mackenzie (djm@thepub.cygnus.com) - - * getopt1.c: Declare const the way getopt.c does. - -Fri Aug 6 17:03:13 1993 David J. Mackenzie (djm@thepub.cygnus.com) - - * obstack.c, alloca.c: Update from FSF. - * getopt.c, getopt1.c: Update to current FSF version, which - doesn't use alloca. - -Tue Jul 27 14:03:57 1993 Brendan Kehoe (brendan@lisa.cygnus.com) - - * Makefile.in (demangle): Add the target with a message saying - where demangle went. - -Mon Jul 26 15:49:54 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * Makefile.in: Remove obsolete `demangle' target. - -Thu Jul 22 08:31:01 1993 Fred Fish (fnf@deneb.cygnus.com) - - * cplus-dem.c (arm_special): Apply patch from arg@lucid.com to - avoid infinite loop on vtbl symbols with disambiguating "junk" - tacked on the end. - -Mon Jul 19 14:10:37 1993 david d `zoo' zuhn (zoo@rtl.cygnus.com) - - * strsignal.c: work around some systems losing definitions of - sys_siglist - - * config/mh-lynxos: this system has a losing definition of - sys_siglist - - * config.table: use mh-lynxos for *-*-lynxos - -Mon Jul 19 17:08:52 1993 Ken Raeburn (raeburn@rtl.cygnus.com) - - * config.table: Add support for HPPA BSD hosts. - - * config/mh-hpbsd: New file. - -Mon Jul 12 18:00:40 1993 K. Richard Pixley (rich@cygnus.com) - - * Makefile.in (TAGS): make work when srcdir != objdir. - -Sun Jun 27 15:35:31 1993 David J. Mackenzie (djm@thepub.cygnus.com) - - * cplus-dem.c (main): Add long options, including --help and - --version. - (usage): New function from code in main. - -Tue Jun 22 11:37:38 1993 Per Bothner (bothner@deneb.cygnus.com) - - * config.table: New shell scipt, sourced by both ./configure,in - and ../xiberty/configure.in, to avoid maintainance lossages. - * configure.in and ../xiberty/configure.in: Use config.table. - - * configure.in: Don't use mh-aix for AIX 3.2, only for 3.1. - * configure.in: Map *-*-irix* (except irix4) to mh-sysv. - * ../xiberty/configure.in: Update from ./configure.in. - -Tue Jun 15 17:05:31 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * Makefile.in: remove parentdir support - -Wed May 26 12:59:09 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * cplus-dem.c (xrealloc): Match definition with prototype. - -Tue May 25 14:27:51 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * cplus-dem.c (demangle_prefix): Demangle cfront - local variables as an extension to ARM demangling. - -Fri May 21 09:53:57 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * ieee-float.c: Don't require pointers to double to be aligned. - -Tue May 18 17:12:10 1993 Fred Fish (fnf@cygnus.com) - - (merge changes from dlong@cse.ucsc.edu) - * cplus-dem.c (consume_count): Simplify. - * cplus-dem.c (arm_pt, demangle_class_name): New functions. - * cplus-dem.c (various): Calls to arm_pt, demangle_class_name. - - * cplus-dem.c (xmalloc, xrealloc, strstr): Make extern decls into - full prototypes. - * cplus-dem.c (free): Add prototype. - * cplus-dem.c (optable): Fully bracketize initializer. - -Fri May 14 17:13:05 1993 Per Bothner (bothner@cygnus.com) - - * cplus-dem.c: Whether initial underscores are stripped - depends on the external variable prepends_underscore - (which is generated by the binutils Makefile). - -Fri May 14 07:32:20 1993 Ken Raeburn (raeburn@deneb.cygnus.com) - - * cplus-dem.c (mop_up, arm_special): Remove some unused variables. - -Tue May 4 20:31:59 1993 Fred Fish (fnf@cygnus.com) - - * cplus-dem.c (consume_count): Return zero if arg does not - start with digit, and don't consume any input. - -Tue May 4 08:10:28 1993 Jim Kingdon (kingdon@cygnus.com) - - * Makefile.in (demangle): Use ${srcdir} not $^. - - * strtod.c: New file, needed at least for BSD 4.3. - -Sun May 2 11:30:42 1993 Fred Fish (fnf@cygnus.com) - - * strsignal.c (sys_siglist): For ANSI compilations, type is - "const char *const". Also remove conditionalization on __STDC__ - since const is defined away for non-ANSI. - -Wed Apr 28 19:29:55 1993 Ken Raeburn (raeburn@deneb.cygnus.com) - - * configure.in: Recognize *-*-hpux. - * config/mh-hpux: New file. - -Tue Apr 27 15:22:19 1993 Per Bothner (bothner@cygnus.com) - - * tmpnam.c: Added ANSI tmpnam() function. - * functions.def, Makefile.in: Update accordingly. - -Tue Apr 27 13:38:38 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * cplus-dem.c (demangle_function_name): Get the demangling of - stop__1A right. - -Fri Apr 16 23:48:24 1993 Jim Kingdon (kingdon at calvin) - - * cplus-dem.c: Declare strstr return type. - -Fri Mar 26 12:01:26 1993 Jim Kingdon (kingdon@cygnus.com) - - * strsignal.c: Add some AIX signals. - -Thu Mar 25 15:17:23 1993 Ian Lance Taylor (ian@cygnus.com) - - * Makefile.in (MAKEOVERRIDES): Define to be empty. - -Wed Mar 24 01:59:25 1993 david d `zoo' zuhn (zoo at poseidon.cygnus.com) - - * Makefile.in: add installcheck & dvi targets - -Thu Mar 18 14:05:44 1993 Per Bothner (bothner@rtl.cygnus.com) - - * ieee-float.c: New file, moved from ../gdb (since it is - needed by ../opcode/m68k-dis.c). - -Tue Mar 2 17:47:31 1993 Fred Fish (fnf@cygnus.com) - - * cplus-dem.c: Replace all references to cfront with ARM. - -Fri Feb 26 00:17:07 1993 Per Bothner (bothner@rtl.cygnus.com) - - * cplus-dem.c: Fix main program (when compiled with -DMAIN) - to be more useful as a filter. - -Sat Feb 20 21:41:39 1993 Brendan Kehoe (brendan@lisa.cygnus.com) - - * Makefile.in (install_to_libdir, install_to_tooldir): Go into the - destination directory before running $(RANLIB), in case that - program tries to create a file in the current directory as part of - its work. - -Thu Feb 18 23:00:19 1993 John Gilmore (gnu@cygnus.com) - - * strsignal.c (sys_siglist): Remove yet another *%^&%&$# "const" - because BSD 4.4 lacks one. Isn't this fun? - -Thu Feb 18 11:24:25 1993 Fred Fish (fnf@cygnus.com) - - * cplus-dem.c (demangle_signature): Set func_done after - demangling a template. - * cplus-dem.c (demangle_template): Fix several small bugs - in demangling GNU style templates. - * cplus-dem.c (demangle_prefix): Fix for templates in GNU - style constructors. - * cplus-dem.c (gnu_special): Fix for templates in GNU style - static data members. - -Tue Feb 16 17:28:35 1993 Fred Fish (fnf@cygnus.com) - - * cplus-dem.c (demangle_signature): Modify to include type - modifiers like static and const in remembered types. - -Thu Feb 11 22:20:47 1993 Fred Fish (fnf@cygnus.com) - - * cplus-dem.c (demangled_qualified): Add new parameter that tells - whether to prepend or append the qualifiers. - * cplus-dem.c (string_prepends): Used now, remove #if 0. - * cplus-dem.c (demangle_signature): Call demangle_qualified - with prepending. - * cplus_dem.c (gnu_special): Recognize static data members that - use qualified names. - * cplus-dem.c (demangle_qualified): Accumulate qualifiers in a - temporary buffer and the prepend or append them to the result, - as specified by the new "append" flag. - * cplus-dem.c (do_type): Call demangled_qualified with - appending. - -Mon Dec 28 10:47:19 1992 Ken Raeburn (raeburn@cygnus.com) - - * strsignal.c (signal_table): Now const. - (init_signal_tables): Variable eip now points to const. - - * strerror.c (error_table): Now const. - (init_error_tables): Variable eip now points to const. - -Tue Dec 15 15:36:50 1992 Per Bothner (bothner@cygnus.com) - - * memchr.c (memchr): New (ANSI standard) function. - * Makefile.in, functions.def: Added memchr. - * Makefile.in (AR_FLAGS): Use rc instad of non-standard cq. - -Wed Dec 2 22:49:10 1992 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * getopt.c: remove use of USG around , which never meant - anything anyway - - * config/mh-{aix,apollo68,ncr3000,sysv,sysv4}: removed definitions - of USG and USGr4 - -Thu Nov 19 03:09:33 1992 Brendan Kehoe (brendan@lisa.cygnus.com) - - * cplus-dem.c (demangle_fund_type): Recognize `w', a wide character; - it's now a type according to the ANSI X3J16 working paper; output - "wchar_t" for it. - (demangle_template): Accept `w' as an integral type. - (xmalloc, xrealloc): Use `char *', not `PTR'. Cast calls to their - counterparts malloc and realloc to `char *'. - (main): Exit with a 0 status. - * Makefile.in (demangle): Don't expect the user to define - DEMANGLE, instead force to be cplus-dem.c. Look in $(srcdir)/../include - for demangle.h. Pass it any HDEFINES or XTRAFLAGS. - -Wed Nov 18 18:56:20 1992 John Gilmore (gnu@cygnus.com) - - * Makefile.in (AR_FLAGS): Avoid verbosity. - * config/mh-sysv4: Remove AR_FLAGS override, use INSTALL=cp, - replace USGr4 with HAVE_SYSCONF. - * config/mh-solaris: Remove; mh-sysv4 works now. - * getpagesize.c: Replace USGr4 with HAVE_SYSCONF. - * configure.in: Simplify host matching table, remove separate - solaris config file. - -Sun Nov 15 09:35:16 1992 Fred Fish (fnf@cygnus.com) - - * configure.in (i[34]86-*-solaris2*): Add, use mh-sysv4. - -Tue Nov 3 21:27:03 1992 Brendan Kehoe (brendan@cygnus.com) - - * cplus-dem.c (xmalloc, xrealloc): Add decls. - (remember_type): Don't cast xmalloc. - (string_need): Likewise; don't cast xrealloc either. - -Fri Oct 23 08:52:01 1992 Ian Lance Taylor (ian@cygnus.com) - - * Makefile.in, functions.defs, rename.c: added simple - implementation of rename, since some binutils programs use it. - -Thu Oct 15 15:18:22 1992 Per Bothner (bothner@cygnus.com) - - * strsignal.c: Add appropriate 'const' to sys_siglist - extern declaration (if __STDC__). (Needed for Linux.) - * strsignal.c (strsignal): Add cast to remove const-ness. - -Fri Oct 9 03:22:55 1992 John Gilmore (gnu@cygnus.com) - - * Makefile.in (needed.awk, needed2.awk): Remove erroneous \'s - before "'s, diagnosed by BSD 4.4 awk. - -Thu Oct 8 15:25:12 1992 Ian Lance Taylor (ian@cygnus.com) - - * Makefile.in: create config.h and needed-list through $(CONFIG_H) - and $(NEEDED_LIST), to give some hooks for xiberty. - -Thu Oct 1 23:31:42 1992 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * configure.in: use cpu-vendor-triple instead of nested cases - -Wed Sep 30 11:26:59 1992 Per Bothner (bothner@rtl.cygnus.com) - - * Makefile.in, argv.c, basename.c, bcmp.c, bcopy.c, bzero.c, - concat.c, cplus-dem.c, fdmatch.c, getcwd.c, getopt.c, getopt1.c, - getpagesize.c, insque.c, memcmp.c, memcpy.c, memmove.c, memset.c, - obstack.c, sigsetmask.c, spaces.c, strchr.c, strerror.c, - strrchr.c, strsignal.c, strstr.c, vfork.c, vsprintf.c: - Convert from using GPL to LGPL. - -Sat Sep 26 04:01:30 1992 John Gilmore (gnu@cygnus.com) - - * Makefile.in (errors): Leave dummy.o and dummy around so that - we can see how the needed list was generated (it's sometimes wrong). - (mostlyclean): Remove them. - -Mon Sep 21 14:50:42 1992 Ian Lance Taylor (ian@cygnus.com) - - * getcwd.c: supply a default if MAXPATHLEN is not defined. - - * config/mh-irix4: set EXTRA_OFILES to alloca.o, from WRS. - -Wed Sep 9 12:41:48 1992 Ian Lance Taylor (ian@cygnus.com) - - * Makefile.in: Use XTRAFLAGS when compiling, so that xiberty works - when cross-compiling. - -Thu Sep 3 13:29:39 1992 K. Richard Pixley (rich@sendai.cygnus.com) - - * cplus-dem.c: (demangle_prefix): reduction in strength of strstr - as a time optimization. - - * cplus-dem.c (cplus_demangle): remove strpbrk test. Appears to - be more expensive than simply demangling. - - * cplus-dem.c (cplus_match): new function. - -Tue Sep 1 15:24:04 1992 Per Bothner (bothner@rtl.cygnus.com) - - * cplus-dem.c: #include , to define NULL. - Define current_demangling_style. - -Sun Aug 30 17:58:19 1992 Per Bothner (bothner@rtl.cygnus.com) - - * cplus-dem.c: New file, moved from ../gdb. - * cplus-dem.c (set_cplus_marker_for_demangling): New exported - function, to avoid compiling in target-dependency for CPLUS_MARKER. - * cplus-dem.c (cplus_demangle): Allow demangling style option - to be passed as a parameter, but using the global variable - current_demangling_style as a default. - * Makefile.in: Update for cplus-dem.c - -Sat Aug 29 10:44:09 1992 Fred Fish (fnf@cygnus.com) - - * obstack.c: Merge in comment changes from FSF version. Now - matches the FSF version exactly. - -Fri Aug 28 18:39:08 1992 John Gilmore (gnu@cygnus.com) - - * obstack.c (CALL_FREEFUN): Can't use ?: with void values (at - least on losing DECstations!); use if-then-else instead. - -Wed Aug 19 14:40:34 1992 Ian Lance Taylor (ian@cygnus.com) - - * Makefile.in: always create installation directories. - -Mon Aug 10 17:33:40 1992 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * Makefile.in: clean up definition of CFILES, more comments - -Sat Aug 8 23:10:59 1992 Fred Fish (fnf@cygnus.com) - - * getopt.c (my_index): Make first arg const to match strchr, - which it sometimes is remapped to. - -Sat Aug 1 13:48:50 1992 Fred Fish (fnf@cygnus.com) - - * obstack.c (DEFAULT_ALIGNMENT): Update to match FSF version. - * obstack.c (_obstack_begin): Initialize use_extra_arg. - * obstack.c (_obstack_begin_1): New, from FSF version. - -Mon Jul 20 21:07:58 1992 Fred Fish (fnf@cygnus.com) - - * obstack.c (CALL_CHECKFUN, CALL_FREEFUN): Use use_extra_arg and - extra_arg. - * obstack.c (_obstack_begin): Remove area_id and flags arguments - (previously added for mmalloc support, interface has changed). - Also convert flags usage to use use_extra_arg and maybe_empty_object. - -Fri Jul 10 00:41:53 1992 Fred Fish (fnf@cygnus.com) - - * argv.c: Move expandargv inline and eliminate static variables. - Rewrite to always allocate in powers of two. Fix to return an - argv with a single null string arg if passed a null string. - -Fri Jul 3 20:27:29 1992 Fred Fish (fnf@cygnus.com) - - * random.c, sigsetmask.c, strerror.c, strsignal.c: Remove - "(void)" casts from function calls where the return value is - ignored, in accordance with GNU coding standards. - -Mon Jun 29 10:54:19 1992 Fred Fish (fnf at cygnus.com) - - * bcopy.c, strerror.c, strsignal.c: Lint. - -Thu Jun 25 09:18:41 1992 K. Richard Pixley (rich@rtl.cygnus.com) - - * getopt.c: merge changes from make. - -Thu Jun 25 04:43:22 1992 John Gilmore (gnu at cygnus.com) - - * alloca.c: Incorporate fixes from gdb/alloca.c. - FIXME: Eventually move gdb's alloca configuration files here, - and remove gdb/alloca.c and its Makefile.in support. - -Tue Jun 23 21:56:30 1992 Fred Fish (fnf@cygnus.com) - - * dummy.c: Define NOTHING to /*nothing*/, change return type - of main to int and return zero. - * functions.def: Supply NOTHING as the fourth arg to macros - that don't have an explicit arg, to satisfy picky preprocessors. - -Wed Jun 17 18:13:58 1992 Per Bothner (bothner@rtl.cygnus.com) - - * Makefile.in: Clean up *clean rules, as per standards.texi. - -Tue Jun 16 16:11:59 1992 K. Richard Pixley (rich@rtl.cygnus.com) - - * getopt.c, getopt1.c: merged largely gratuitous, mostly - whitespace diffs from other prep distributions. - -Mon Jun 15 12:25:46 1992 Fred Fish (fnf@cygnus.com) - - * config/mh-ncr3000 (INSTALL): Don't use /usr/ucb/install, - it is broken on ncr 3000's. - -Mon Jun 15 01:03:26 1992 John Gilmore (gnu at cygnus.com) - - * sigsetmask.c: Rewrite. Old one was very confused about its - arguments and result. New one can't do much, but at least knows - what it can't do, and it's good enough for GDB's use. - -Sun Jun 14 15:17:40 1992 Stu Grossman (grossman at cygnus.com) - - * functions.def: Use proper prototype for strtoul. - -Fri Jun 12 19:22:40 1992 John Gilmore (gnu at cygnus.com) - - * Makefile.in: Add random.c. - * config/mh-*: Use "true" rather than "echo >/dev/null" for ranlib. - * configure.in: update solaris2 config. - -Wed Jun 10 16:31:29 1992 Fred Fish (fnf@cygnus.com) - - * random.c: Add for random() and srandom(). - * functions.def: Add random - -Tue Jun 9 17:27:18 1992 Fred Fish (fnf@cygnus.com) - - * config/{mh-ncr3000, mh-sysv4}: Add definition for INSTALL - using /usr/ucb/install. - -Mon Jun 1 13:20:17 1992 Per Bothner (bothner@rtl.cygnus.com) - - * strerror.c: Kludge to guard against a conflict with - possible declaration of sys_errlist in errno.h. - -Sun May 31 15:07:47 1992 Mark Eichin (eichin at cygnus.com) - - * configure.in, config/mh-solaris: add solaris2 config support. - -Fri May 29 17:23:23 1992 Per Bothner (bothner@rtl.cygnus.com) - - * sigsetmask.c: #ifdef out sigsetmask if SIG_SETMASK - is not defined (should be defined in signal.h, says Posix.). - -Mon May 18 17:35:04 1992 K. Richard Pixley (rich@cygnus.com) - - * getopt.c: merged changes from make-3.62.11. - -Fri May 8 14:53:07 1992 K. Richard Pixley (rich@cygnus.com) - - * getopt.c: merged changes from bison-1.18. - -Tue May 5 11:51:40 1992 Per Bothner (bothner@rtl.cygnus.com) - - * Makefile.in: Don't have $(EXTRA_OFILES) depend on config.h, - since that introduces a circular dependency. - ($(EXTRA_OFILES) are used to build config.h.) - - * strtoul.c: Fixes to handle non-decimal bases better. - -Wed Apr 22 09:27:51 1992 Fred Fish (fnf@cygnus.com) - - * config/mh-ncr3000: Replace MINUS_G with CFLAGS. - * Makefile.dos: Finish MINUS_G eradication. - * Makefile.in (CFILES): Add strsignal.c. - * Makefile.in (REQUIRED_OFILES): Add strerror.o strsignal.o - * Makefile.in (needed-list): Split creation of errors file to - separate make target. - * Makefile.in (config.h, needed2.awk, errors): New targets. - * Makefile.in (clean): Split to multiple lines, add needed2.awk - and config.h. - * dummy.c (DEFFUNC, DEFVAR): Add defines and undefs. - * functions.def (strerror): Remove from optional list. - * functions.def (sys_nerr, sys_errlist, sys_siglist): DEFVAR's - * functions.def (strerror, psignal): DEFFUNC's - * strerror.c: Rewrite from scratch to use sys_errlist only if - available, add errno_max(), add strerrno(), add strtoerrno(), - add test driver. - * strsignal.c: New file, signal equivalent to strerror.c. - Uses sys_siglist if available, defines signo_max(), strsignal(), - strsigno(), strtosigno(), psignal(), and test driver. - -Mon Apr 20 20:49:32 1992 K. Richard Pixley (rich@cygnus.com) - - * Makefile.in: do not print recursion line. - - * Makefile.in: allow CFLAGS to be passed in from command line. - Removed MINUS_G. Default CFLAGS to -g. - -Mon Apr 20 12:57:46 1992 Per Bothner (bothner@rtl.cygnus.com) - - * config/mh-aix: New. EXTRA_OFILES lists copysign.o, - so libg++ users don't have to be inconvenienced by a - libc.a bug (libc.a needs copysign, but doesn't define it!). - * configure.in: Use config/mh-aix. - * strtoul.c: Handle '-' as required by ANSI. - Clean up radix handling. - * strstr.c: Fix buggy algorithm. - * Makefile.in: Change so that ${EXTRA_OFILES} is - appended to needed-list (which is used by libg++). - -Fri Apr 10 22:51:41 1992 Fred Fish (fnf@cygnus.com) - - * configure.in: Recognize new ncr3000 config. - * config/mh-ncr3000: New config file. - -Wed Apr 1 23:31:43 1992 John Gilmore (gnu at cygnus.com) - - * argv.c, dummy.c: Lint. - -Tue Mar 31 18:46:44 1992 Fred Fish (fnf@cygnus.com) - - * config/mh-sysv4: New config file. - * configure.in (host_makefile_frag): Set to config/mh-sysv4 for - host_os == sysv4. - * getpagesize.c: For SVR4, use sysconf(_SC_PAGESIZE) to get - pagesize. - -Sun Mar 29 12:26:42 1992 John Gilmore (gnu at cygnus.com) - - * getopt.c: Lint. - -Fri Mar 27 08:32:55 1992 Fred Fish (fnf@cygnus.com) - - * functions.def (alloca): Fix return type and args to avoid - type clash with gcc's builtin alloca. - -Tue Mar 24 23:33:42 1992 K. Richard Pixley (rich@cygnus.com) - - * configure.in, config/mh-irix4: irix4 support. - - * Makefile.in, functions.def, alloca.c: added alloca. - -Tue Mar 24 17:34:46 1992 Stu Grossman (grossman at cygnus.com) - - * obstack.c (CALL_FREEFUN): Make it compile on DECstations. - -Thu Mar 19 13:57:42 1992 Fred Fish (fnf@cygnus.com) - - * argv.c: Fix various external function definitions to be - correct in an ANSI compilation environment. - -Sat Mar 14 17:28:17 1992 Fred Fish (fnf@cygnus.com) - - * obstack.c: Changes to support calling mmalloc functions, - which take an additional argument over malloc functions. - -Fri Mar 6 22:01:10 1992 K. Richard Pixley (rich@cygnus.com) - - * added check target. - -Thu Feb 27 22:19:39 1992 Per Bothner (bothner@cygnus.com) - - * argv.c: #include alloca-conf.h (needed by AIX). - -Wed Feb 26 18:04:40 1992 K. Richard Pixley (rich@cygnus.com) - - * Makefile.in, configure.in: removed traces of namesubdir, - -subdirs, $(subdir), $(unsubdir), some rcs triggers. Forced - copyrights to '92, changed some from Cygnus to FSF. - -Sat Feb 22 01:09:21 1992 Stu Grossman (grossman at cygnus.com) - - * argv.c: Check in Fred's version which fixes problems with - alloca(). - -Fri Feb 7 21:46:08 1992 Stu Grossman (grossman at cygnus.com) - - * makefile.dos: Remove NUL to keep patch from failing. - -Thu Jan 30 22:48:41 1992 Stu Grossman (grossman at cygnus.com) - - * getopt.c (_getopt_internal): Fix usage of enum has_arg. - -Mon Jan 20 18:53:23 1992 Stu Grossman (grossman at cygnus.com) - - * getopt.c, getopt1.c, ../include/getopt.h: Get latest versions. - -Sat Jan 18 16:53:01 1992 Fred Fish (fnf at cygnus.com) - - * argv.c: New file to build and destroy standard argument - vectors from a command string. - - * Makefile.in: Add argv.c and argv.o to appropriate macros. - -Fri Dec 20 12:12:57 1991 Fred Fish (fnf at cygnus.com) - - * configure.in: Change svr4 references to sysv4. - - * rindex.c: Declare return type of externally used function - strrchr(). - -Thu Dec 19 18:35:03 1991 John Gilmore (gnu at cygnus.com) - - * Makefile.in: Remove "***" in normal output, since Make produces - this on errors, and it's convenient to search for. - -Tue Dec 17 23:21:30 1991 Per Bothner (bothner at cygnus.com) - - * memcmp.c, memcpy.c, memmove.c, memset.c, strchr.c, strrchr.c: - New ANSI functions. The old non-ANSI functions (such as bcopy) - should be avoided. - * bcopy.c: Fix to correctly handle overlapping regions. - * index.c, rindex.c: Re-write in terms of strchr() and strrchr(). - * functions.def: Add the new functions. - * functions.def: Add 4th parameter to DEF macro, - an ansidecl.h-style prototype. - * dummy.c: Use expanded DEF macro to create a dummy function - call, with correct parameter types. (This avoids some - complaints from gcc about predefined builtins.) - - Move the functionality of config/mh-default into Makefile.in. - This avoid duplication, and simplifies things slightly. - * Makefile.in: Tweak so we don't need config/mh-default. - * README: Update. - * configure.in: No longer need config/mh-default. - * config/mh-default: Deleted. - * config/mh-sysv: Remove lines copied from old mh-default. - -Tue Dec 17 05:46:46 1991 John Gilmore (gnu at cygnus.com) - - * fdmatch.c (fdmatch): Don't compare st_rdev, which is for - 'mknod' device numbers. - -Mon Dec 16 12:25:34 1991 Fred Fish (fnf at cygnus.com) - - * fdmatch.c, Makefile.in: Add new function that takes two - open file descriptors and returns nonzero if they refer to - the same file, zero otherwise. (used in gdb) - -Wed Dec 11 17:40:39 1991 Steve Chamberlain (sac at rtl.cygnus.com) - From DJ: - * msdos.c: stub functions for dos. - * makefile.dos, configdj.bat: new. - * getopt.c: Don't include alloca-conf.h in a GO32 world. - - -Tue Dec 10 04:14:49 1991 K. Richard Pixley (rich at rtl.cygnus.com) - - * Makefile.in: infodir belongs in datadir. - -Fri Dec 6 23:26:45 1991 K. Richard Pixley (rich at rtl.cygnus.com) - - * Makefile.in: remove spaces following hyphens because bsd make - can't cope. added standards.text support. install using - INSTALL_DATA. - - * configure.in: remove commontargets as it is no longer a - recognized hook. - -Thu Dec 5 22:46:46 1991 K. Richard Pixley (rich at rtl.cygnus.com) - - * Makefile.in: idestdir and ddestdir go away. Added copyrights - and shift gpl to v2. Added ChangeLog if it didn't exist. docdir - and mandir now keyed off datadir by default. - -Fri Nov 22 19:15:29 1991 John Gilmore (gnu at cygnus.com) - - * Makefile.in: find-needed.awk does not fit in 14 chars. - - * Makefile.in: Suppress error checking when compiling the test - program, because Ultrix make/sh aborts there due to a bug. - -Fri Nov 22 12:23:17 1991 Per Bothner (bothner at cygnus.com) - - * Makefile.in: Re-did how EXTRA_OFILES is used to be more useful. - * README: Explained how the auto-configuration works, - and how to add new files and/or configurations. - -Fri Nov 22 09:45:23 1991 John Gilmore (gnu at cygnus.com) - - * strtoul.c: Avoid defining ULONG_MAX if already defined; - cast a const char * to char * for pedants. - - * getopt.c: Only define "const" after local include files get to, - and only if they haven't defined it. - -Thu Nov 21 16:58:53 1991 John Gilmore (gnu at cygnus.com) - - * getcwd.c (remove getwd.c): GNU code should call getcwd(). We - emulate it with getwd() if available. This avoids callers having - to find a MAXPATHLEN or PATH_MAX value from somewhere. - * Makefile.in, functions.def: getwd->getcwd. - * configure.in: Use generic case for every system. - * config/mh-{delta88,mach,rs6000,svr4}: Remove. - * config/mh-sysv: Use default handling, just add -DUSG. - -Thu Nov 14 10:58:05 1991 Per Bothner (bothner at cygnus.com) - - * Makefile.in, config/mh-default: Re-do make magic - so that for the default ("automatic") mode we only - compile the files we actually need. Do this using - a recursive make: The top-level generates the list - of needed files (loosely, the ones missing in libc), - and then passes that list to the recursive make. - * config/mh-mach: Remove obsolete STRERROR-{C,O} macros. - -Tue Nov 12 19:10:57 1991 John Gilmore (gnu at cygnus.com) - - RS/6000 host support (grumble). - - * configure.in: Build alloca-conf.h file from alloca-norm.h - (everything else) or alloca-botch.h (rs/6000). - * Makefile.in: Include . on the include path. - * getopt.c: Use alloca-conf.h. - * alloca-norm.h: How to declare alloca on reasonable machines. - * alloca-botch.h: How to declare alloca on braindead machines. - -Tue Nov 12 09:21:48 1991 Fred Fish (fnf at cygnus.com) - - * concat.c : New file, like concat() in gdb but can take a - variable number of arguments rather than fixed at 3 args. For - now, client applications must supply an xmalloc(), which is a - front end function to malloc() that deals with out-of-memory - conditions. - - * Makefile.in: Add concat.c and concat.o to appropriate macros. - -Sat Nov 9 13:29:59 1991 Fred Fish (fnf at cygnus.com) - - * config/mh-svr4: Add sigsetmask to list of required functions. - -Sun Nov 3 11:57:56 1991 Per Bothner (bothner at cygnus.com) - - * vsprintf.c: New file. - * functions.def, Makefile.in: Add vsprintf. - -Sun Oct 27 16:31:22 1991 John Gilmore (gnu at cygnus.com) - - * configure.in, config/mh-rs6000: Add rs/6000 host support. - * Makefile.in: Compile with debug info. - -Fri Oct 25 17:01:12 1991 Per Bothner (bothner at cygnus.com) - - * Makefile.in, configure.in, and new files: dummy.c, functions.def, - config/mf-default: Added a default configuration mode, - which includes into libiberty.a functions that are "missing" in libc. - * strdup.c, vprintf.c, vfprintf.c: New files. - -Thu Oct 24 02:29:26 1991 Fred Fish (fnf at cygnus.com) - - * config/hmake-svr4: New file. - - * config/hmake-sysv: Add HOST_CFILES and HOST_OFILES. - - * basename.c, bcmp.c, bcopy.c, bzero.c, getpagesize.c getwd.c, - index.c, insque.c, rindex.c, spaces.c, strstr.c, vfork.c: New - files containing either portable C versions or emulations using - native library calls. - - * strerror.c: Add copyright, internal documentation, etc. - - * strtol.c: Replace hardwired hex constants with some more - portable macros. Remove illegal (according to gcc) cast. - - * strtoul.c: Replace hardwired hex constant with more portable - macro. - - * Makefile.in: Move TARGETLIB and CFLAGS where makefile fragments - can override them. Add new source and object file names to CFILES - and OFILES respectively. - - * configure.in: Add support for SVR4 makefile fragments. - -Tue Oct 22 19:00:23 1991 Steve Chamberlain (steve at cygnus.com) - - * Makefile.in: Move RANLIB, AR and AR_FLAGS to where they can be - over-ridden by config/hmake-* - * configure.in: added m88kcvs to sysv list - -Fri Oct 4 01:29:08 1991 John Gilmore (gnu at cygnus.com) - - * Makefile.in: Most hosts need strerror, but one or two don't, - and they override these definitions in the host-dependent makefile - fragment. - * config/hmake-mach: The odd man out on strerror -- it's supplied. - * strerror.c: New file. - - * strtol.c, strtoul.c: Add strtol to libiberty, since Mach lacks - it and bfd uses it. - * configure.in, Makefile.in, config/hmake-mach: Only configure - strtol & strotoul in on Mach. - -Tue Sep 3 06:36:23 1991 John Gilmore (gnu at cygint.cygnus.com) - - * obstack.c: Merge with latest FSF version. - - -Local Variables: -version-control: never -End: diff --git a/contrib/gdb/libiberty/Makefile.in b/contrib/gdb/libiberty/Makefile.in deleted file mode 100644 index 7f11d51..0000000 --- a/contrib/gdb/libiberty/Makefile.in +++ /dev/null @@ -1,321 +0,0 @@ -# -# Makefile -# Copyright (C) 1990, 1991, 1992, 1995 Free Software Foundation -# -# This file is part of the libiberty library. -# Libiberty is free software; you can redistribute it and/or -# modify it under the terms of the GNU Library General Public -# License as published by the Free Software Foundation; either -# version 2 of the License, or (at your option) any later version. -# -# Libiberty 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 -# Library General Public License for more details. -# -# You should have received a copy of the GNU Library General Public -# License along with libiberty; see the file COPYING.LIB. If -# not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -# Boston, MA 02111-1307, USA. -# - -# This file was written, and is maintained by K. Richard Pixley -# . - -# -# Makefile for libiberty directory -# - -srcdir = . - -prefix = /usr/local - -exec_prefix = $(prefix) -bindir = $(exec_prefix)/bin -libdir = $(exec_prefix)/lib - -datadir = $(prefix)/lib - -mandir = $(prefix)/man -man1dir = $(mandir)/man1 -man2dir = $(mandir)/man2 -man3dir = $(mandir)/man3 -man4dir = $(mandir)/man4 -man5dir = $(mandir)/man5 -man6dir = $(mandir)/man6 -man7dir = $(mandir)/man7 -man8dir = $(mandir)/man8 -man9dir = $(mandir)/man9 -infodir = $(prefix)/info -includedir = $(prefix)/include -oldincludedir = -docdir = $(datadir)/doc - -SHELL = /bin/sh - -# Multilib support variables. -MULTISRCTOP = -MULTIBUILDTOP = -MULTIDIRS = -MULTISUBDIR = -MULTIDO = true -MULTICLEAN = true - -INSTALL = install -c -INSTALL_PROGRAM = $(INSTALL) -INSTALL_DATA = $(INSTALL) - -AR = ar -AR_FLAGS = rc - -ERRORS_CC = $(CC) -CC = cc -CFLAGS = -g -LIBCFLAGS = $(CFLAGS) -MAKEINFO = makeinfo -RANLIB = ranlib - -PICFLAG = - -MAKEOVERRIDES = - -TARGETLIB = libiberty.a - -CONFIG_H = lconfig.h -NEEDED_LIST = lneeded-list - -# HOST_OFILES contains the list of objects that should be in the -# library (in addition to the REQUIRED_OFILES and EXTRA_OFILES). -# A configuration may override this with a fixed list a object files -# names (hard to maintain), or some other way to generate a list. -HOST_OFILES=`cat needed-list` - -# Extra targets that the top-level target depends on. -# Specifically, what needs to be made before HOST_OFILES can be used. -# Can be empty if HOST_OFILES is just a list of file names. -DO_ALSO = needed-list - -# A configuration can specify extra .o files that should be included, -# even if they are in libc. (Perhaps the libc version is buggy.) -EXTRA_OFILES = - -# Flags to pass to a recursive make. -FLAGS_TO_PASS = \ - "AR=$(AR)" \ - "AR_FLAGS=$(AR_FLAGS)" \ - "CC=$(CC)" \ - "CFLAGS=$(CFLAGS)" \ - "LIBCFLAGS=$(LIBCFLAGS)" \ - "EXTRA_OFILES=$(EXTRA_OFILES)" \ - "HDEFINES=$(HDEFINES)" \ - "LDFLAGS=$(LDFLAGS)" \ - "LOADLIBES=$(LOADLIBES)" \ - "PICFLAG=$(PICFLAG)" \ - "RANLIB=$(RANLIB)" \ - "SHELL=$(SHELL)" - -all: stamp-picdir $(TARGETLIB) required-list - @if [ "$(RULE1)" != "not-used" ]; then \ - $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=all; \ - else true; \ - fi - -.PHONY: check installcheck -check installcheck: - - -#### Host, target, and site specific Makefile fragments come in here. -### - -INCDIR=$(srcdir)/$(MULTISRCTOP)../include - -COMPILE.c = $(CC) -c $(LIBCFLAGS) -I. -I$(INCDIR) $(HDEFINES) -.c.o: - test -z "$(PICFLAG)" || \ - $(COMPILE.c) $(PICFLAG) $< -o pic/$@ - $(COMPILE.c) $< - -# The default target just invokes make recursively. -# However, the automatic configuration (in config/mh_default). -# first causes it to figure out the objects missing in libc. -info install-info clean-info dvi: - -# Include files that are in this directory. -HFILES = - -# NOTE: If you add new files to the library, add them to this list -# (alphabetical), and add them to REQUIRED_OFILES or 'functions.def'. -CFILES = alloca.c argv.c basename.c bcmp.c bcopy.c bzero.c \ - clock.c concat.c cplus-dem.c fdmatch.c \ - getcwd.c getopt.c getopt1.c getpagesize.c getruntime.c \ - floatformat.c hex.c index.c insque.c \ - memchr.c memcmp.c memcpy.c memmove.c memset.c \ - obstack.c random.c rename.c rindex.c sigsetmask.c spaces.c \ - strcasecmp.c strncasecmp.c \ - strchr.c strdup.c strerror.c strrchr.c strsignal.c \ - strstr.c strtod.c strtol.c strtoul.c tmpnam.c \ - vasprintf.c vfork.c vfprintf.c vprintf.c vsprintf.c waitpid.c \ - xatexit.c xexit.c xmalloc.c xstrdup.c xstrerror.c -# These are always included in the library. -REQUIRED_OFILES = argv.o basename.o concat.o cplus-dem.o fdmatch.o \ - getopt.o getopt1.o getruntime.o hex.o \ - floatformat.o obstack.o spaces.o strerror.o strsignal.o \ - vasprintf.o xatexit.o xexit.o xmalloc.o xstrdup.o xstrerror.o - -# Do we want/need any config overrides? -# - -STAGESTUFF = $(TARGETLIB) *.o - -INSTALL_DEST = libdir -install: install_to_$(INSTALL_DEST) - -install_to_libdir: all - $(INSTALL_DATA) $(TARGETLIB) $(libdir)/$(TARGETLIB).n - ( cd $(libdir) ; $(RANLIB) $(libdir)/$(TARGETLIB).n ) - mv -f $(libdir)/$(TARGETLIB).n $(libdir)$(MULTISUBDIR)/$(TARGETLIB) - @$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=install - -install_to_tooldir: all - $(INSTALL_DATA) $(TARGETLIB) $(tooldir)/lib/$(TARGETLIB).n - ( cd $(tooldir) ; $(RANLIB) $(tooldir)/lib/$(TARGETLIB).n ) - mv -f $(tooldir)/lib/$(TARGETLIB).n $(tooldir)/lib$(MULTISUBDIR)/$(TARGETLIB) - @$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=install - -# The default configuration adds to libiberty all those functions that are -# missing in libc. More precisely, it includes whatever $(CC) fails to find. -# Then a sed+awk combination translates the ld error messages into -# a list of .o files. - -needed-list: stamp-picdir $(NEEDED_LIST) - cp $(NEEDED_LIST) needed-list - -lneeded-list: $(EXTRA_OFILES) needed.awk errors - rm -f lneeded-list - f=""; \ - for i in `awk -f needed.awk >lneeded-list - -# Generate an awk script that looks for functions in functions.def - -needed.awk: $(srcdir)/functions.def Makefile - echo "# !Automatically generated from $(srcdir)/functions.def"\ - "- DO NOT EDIT!" >needed.awk - grep '^DEF(' < $(srcdir)/functions.def \ - | sed -e '/DEF/s|DEF.\([^,]*\).*|/\1/ { printf "\1.o " }|' \ - >>needed.awk - -config.h: $(CONFIG_H) - cp $(CONFIG_H) config.h - -lconfig.h: needed2.awk errors - echo "/* !Automatically generated from $(srcdir)/functions.def"\ - "- DO NOT EDIT! */" >lconfig.h - awk -f needed2.awk >lconfig.h - -# Generate an awk script that looks for variables in functions.def - -needed2.awk: $(srcdir)/functions.def Makefile - echo "# !Automatically generated from $(srcdir)/functions.def"\ - "- DO NOT EDIT!" >needed2.awk - grep '^DEFVAR(' < $(srcdir)/functions.def \ - | sed -e '/DEFVAR/s|DEFVAR.\([^,]*\).*|/\1/ { printf "#ifndef NEED_\1\\n#define NEED_\1\\n#endif\\n" }|' \ - >>needed2.awk - grep '^DEFFUNC(' < $(srcdir)/functions.def \ - | sed -e '/DEFFUNC/s|DEFFUNC.\([^,]*\).*|/\1/ { printf "#ifndef NEED_\1\\n#define NEED_\1\\n#endif\\n" }|' \ - >>needed2.awk - -dummy.o: $(srcdir)/dummy.c $(srcdir)/functions.def - $(CC) -c $(CFLAGS) -I. -I$(INCDIR) $(HDEFINES) $(srcdir)/dummy.c 2>/dev/null - -errors: dummy.o $(EXTRA_OFILES) - -($(ERRORS_CC) -o dummy $(CFLAGS) $(LDFLAGS) $(ERRORS_LDFLAGS) dummy.o $(EXTRA_OFILES) $(LOADLIBES)) >errors 2>&1 || true - -# required-list is used when building a shared bfd/opcodes/libiberty library. -required-list: Makefile - echo $(REQUIRED_OFILES) > required-list - -$(HOST_OFILES) $(REQUIRED_OFILES) : config.h - -RULE1 = $(TARGETLIB) -$(RULE1): $(REQUIRED_OFILES) $(DO_ALSO) .always. - @$(MAKE) RULE1=not-used RULE2=$(TARGETLIB) $(FLAGS_TO_PASS) \ - "HOST_OFILES=$(HOST_OFILES)" - -# Rule invoked by recursive make in $(RULE1). -RULE2 = not-used -$(RULE2): $(REQUIRED_OFILES) $(HOST_OFILES) - rm -rf $(TARGETLIB) - $(AR) $(AR_FLAGS) $(TARGETLIB) \ - $(REQUIRED_OFILES) $(HOST_OFILES) - $(RANLIB) $(TARGETLIB) - -stamp-picdir: - if [ -n "$(PICFLAG)" ] && [ ! -d pic ]; then \ - mkdir pic; \ - else true; fi - touch stamp-picdir - -.always.: -# Do nothing. - -.PHONY: all etags tags ls clean stage1 stage2 .always. - -etags tags: TAGS - -TAGS: $(CFILES) $(HFILES) - etags `for i in $(HFILES) $(CFILES); do echo $(srcdir)/$$i ; done` - -# The standalone demangler (c++filt) has been moved to binutils. -demangle: - @echo "The standalone demangler, now named c++filt, is now" - @echo "a part of binutils." - @false - -ls: - @echo Makefile $(HFILES) $(CFILES) - -# Need to deal with profiled libraries, too. - -mostlyclean: - rm -rf *.o pic core errs \#* *.E a.out - rm -f needed.awk needed2.awk errors dummy needed-list config.h - rm -f $(CONFIG_H) $(NEEDED_LIST) stamp-picdir - @$(MULTICLEAN) multi-clean DO=mostlyclean -clean: mostlyclean - rm -f *.a required-list - @$(MULTICLEAN) multi-clean DO=clean -distclean: clean - rm -f *~ Makefile config.status alloca-conf.h xhost-mkfrag TAGS - @$(MULTICLEAN) multi-clean DO=distclean -maintainer-clean realclean: distclean - -force: - -Makefile: $(srcdir)/Makefile.in $(host_makefile_frag) $(target_makefile_frag) - $(SHELL) ./config.status - -argv.o: $(INCDIR)/libiberty.h -basename.o: $(INCDIR)/libiberty.h -concat.o: $(INCDIR)/libiberty.h -cplus-dem.o: $(INCDIR)/demangle.h -fdmatch.o: $(INCDIR)/libiberty.h -getopt.o: $(INCDIR)/getopt.h -getopt1.o: $(INCDIR)/getopt.h -getruntime.o: $(INCDIR)/libiberty.h -hex.o: $(INCDIR)/libiberty.h -floatformat.o: $(INCDIR)/floatformat.h -obstack.o: $(INCDIR)/obstack.h -spaces.o: $(INCDIR)/libiberty.h -strerror.o: $(INCDIR)/libiberty.h -strsignal.o: $(INCDIR)/libiberty.h -xatexit.o: $(INCDIR)/libiberty.h -xexit.o: $(INCDIR)/libiberty.h -xmalloc.o: $(INCDIR)/libiberty.h -xstrdup.o: $(INCDIR)/libiberty.h -xstrerror.o: $(INCDIR)/libiberty.h diff --git a/contrib/gdb/libiberty/README b/contrib/gdb/libiberty/README deleted file mode 100644 index 5081bba..0000000 --- a/contrib/gdb/libiberty/README +++ /dev/null @@ -1,129 +0,0 @@ -This directory contains the -liberty library of free software. -It is a collection of subroutines used by various GNU programs. -Current members include: - - getopt -- get options from command line - obstack -- stacks of arbitrarily-sized objects - strerror -- error message strings corresponding to errno - strtol -- string-to-long conversion - strtoul -- string-to-unsigned-long conversion - -We expect many of the GNU subroutines that are floating around to -eventually arrive here. - -To build the library, do: - - ./configure HOSTTYPE - make - -Please report bugs and fixes to "bug-gnu-utils@prep.ai.mit.edu". Thank you. - -ADDING A NEW FILE -================= - -There are two sets of files: Those that are "required" will be -included in the library for all configurations, while those -that are "optional" will be included in the library only if "needed." - -To add a new required file, edit Makefile to add the source file -name to CFILES and the object file to REQUIRED_OFILES. - -Adding a new optional file is more fragile. As a general rule, -an optional file will be included in the library if it provides -functionality missing in the "standard" C library. -For most hosts, the Makefile automatically figures out which -functionality is missing by compiling and linking a dummy test -program, and examining the error messages. - -So to get this to work, you should do the following: - -1) Select one function defined in the file you're adding. -For example, the getcwd function. -2) Add that function to the list in the file functions.def. -3) The name of the new file must be the same as the function -you've chosen with the .c suffix added. E.g. getcwd() must be -defined in getcwd.c. (The file can define other functions as well.) -4) In Makefile.in, add the name of the source file (e.g. getcwd.c) -to CFILES. - -The file you've added (e.g. getcwd.c) should compile and work -on all hosts where it is needed (e.g. not found when linking -the dummy.c program). It does not have to work or even -compile on hosts where it is not needed. - -HOW THE AUTOMATIC CONFIGURATION WORKS -===================================== - -The libiberty.a target (in RULE1) depends on $(DO_ALSO). -For normal configurations, DO_ALSO=needed-list. - -So needed-list is first made. The needed-list rule compiles -dummy.c. Because dummy.c includes functions.def, the -resulting object file will contain a call to each of the -optional functions (for simplicity assume each optional file -defines a single function). This object file will be linked -against the standard libraries (as defined by using $(CC) -and various flags). Any function missing will causes the -linker to emit an error message. We assume the name -of the missing function(s) are in the error message(s). -The awk script find-needed.awk has been generated from -functions.def. It is used to search the linker output -messages for words that match the functions listed in -functions.def. The list of functions found is written -on a single line to the file needed-list. - -After needed-list has been generated, the libiberty.a -target (in RULE1) just calls 'make' recursively. -It passes the contents of needed-list using the -definition (expanded) HOST_OFILES="`cat needed-list`". -It also tells the inferior 'make' to use RULE2. - -The inferior 'make' is very conventional: The main -rule is $(RULE2) (which is libiberty.a). It depends -on a list of object files: $(REQUIRED_OFILES) $(HOST_OFILES) -(and $(EXTRA_OFILES), which is usually empty). The superior -'make' passes in $(HOST_OFILES); the others are fixed -in the Makefile. - -ADDING A NEW CONFIGURATION -========================== - -On most hosts you should be able to use the scheme for automatically -figuring out which files are needed. In that case, you probably -don't need a special Makefile stub for that configuration. - -If the fully automatic scheme doesn't work, you may be able to get -by with defining EXTRA_OFILES in your Makefile stub. This is -a list of object file names that should be treated as required -for this configuration - they will be included in libiberty.a, -regardless of whatever might be in the C library. Moreover, -when the dummy.c program is linked, it will be linked with -$(EXTRA_OFILES). Therefore, if a function in functions.def -is defined by one of the EXTRA_OFILES, it will not be listed as -"needed". Thus if your hal9000 host needs a special implementation -of getcwd, you can just create hal9000-getcwd.c, and define: - EXTRA_OFILES=hal9000-getcwd.o -Or if you want to use the libiberty version of strstr(), -even though there is a version in the C library (it might be -buggy or slow), just define: - EXTRA_OFILES=strstr.o - -You can create a "manual" host configuration FOO with a file -config/mh-FOO. In it, the HOST_OFILES macro should explicitly -list that subset of the optional files that should be in the -library. You should also set: - DO_ALSO = -This overrides all of the magic needed to automatically -determine which files are "needed." However, keeping that list -up to date is another matter... - -HOW THE MANUAL CONFIGURATION WORKS -================================== - -This also uses a recursive make, but the superior make -does not do anything interesting - it just calls the -inferior make with HOST_OFILES defined as $(HOST_OFILES), -which is the list you created in your configuration. - -You probably don't want to depend on manual configuration, -because keeping the HOST_OFILES list up-to-date will be a pain. diff --git a/contrib/gdb/libiberty/alloca-botch.h b/contrib/gdb/libiberty/alloca-botch.h deleted file mode 100644 index c909573..0000000 --- a/contrib/gdb/libiberty/alloca-botch.h +++ /dev/null @@ -1,5 +0,0 @@ -/* RS/6000 AIX botched alloca and requires a pragma, which ordinary compilers - throw up about, so we have to put it in a specially-configured file. - Like this one. */ - -#pragma alloca diff --git a/contrib/gdb/libiberty/alloca-norm.h b/contrib/gdb/libiberty/alloca-norm.h deleted file mode 100644 index 8d91b5a..0000000 --- a/contrib/gdb/libiberty/alloca-norm.h +++ /dev/null @@ -1,16 +0,0 @@ -/* "Normal" configuration for alloca. */ - -#ifdef __GNUC__ -#define alloca __builtin_alloca -#else /* not __GNUC__ */ -#ifdef sparc -#include -extern char *__builtin_alloca(); /* Stupid include file doesn't declare it */ -#else -#ifdef __STDC__ -PTR alloca (size_t); -#else -PTR alloca (); /* must agree with functions.def */ -#endif -#endif /* sparc */ -#endif /* not __GNUC__ */ diff --git a/contrib/gdb/libiberty/alloca.c b/contrib/gdb/libiberty/alloca.c deleted file mode 100644 index 9c472ea..0000000 --- a/contrib/gdb/libiberty/alloca.c +++ /dev/null @@ -1,475 +0,0 @@ -/* alloca.c -- allocate automatically reclaimed memory - (Mostly) portable public-domain implementation -- D A Gwyn - - This implementation of the PWB library alloca function, - which is used to allocate space off the run-time stack so - that it is automatically reclaimed upon procedure exit, - was inspired by discussions with J. Q. Johnson of Cornell. - J.Otto Tennant contributed the Cray support. - - There are some preprocessor constants that can - be defined when compiling for your specific system, for - improved efficiency; however, the defaults should be okay. - - The general concept of this implementation is to keep - track of all alloca-allocated blocks, and reclaim any - that are found to be deeper in the stack than the current - invocation. This heuristic does not reclaim storage as - soon as it becomes invalid, but it will do so eventually. - - As a special case, alloca(0) reclaims storage without - allocating any. It is a good idea to use alloca(0) in - your main control loop, etc. to force garbage collection. */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -/* If compiling with GCC, this file's not needed. */ -#ifndef alloca - -#ifdef emacs -#ifdef static -/* actually, only want this if static is defined as "" - -- this is for usg, in which emacs must undefine static - in order to make unexec workable - */ -#ifndef STACK_DIRECTION -you -lose --- must know STACK_DIRECTION at compile-time -#endif /* STACK_DIRECTION undefined */ -#endif /* static */ -#endif /* emacs */ - -/* If your stack is a linked list of frames, you have to - provide an "address metric" ADDRESS_FUNCTION macro. */ - -#if defined (CRAY) && defined (CRAY_STACKSEG_END) -long i00afunc (); -#define ADDRESS_FUNCTION(arg) (char *) i00afunc (&(arg)) -#else -#define ADDRESS_FUNCTION(arg) &(arg) -#endif - -#if __STDC__ -typedef void *pointer; -#else -typedef char *pointer; -#endif - -#define NULL 0 - -/* Different portions of Emacs need to call different versions of - malloc. The Emacs executable needs alloca to call xmalloc, because - ordinary malloc isn't protected from input signals. On the other - hand, the utilities in lib-src need alloca to call malloc; some of - them are very simple, and don't have an xmalloc routine. - - Non-Emacs programs expect this to call use xmalloc. - - Callers below should use malloc. */ - -#ifndef emacs -#define malloc xmalloc -extern pointer xmalloc (); -#endif - -/* Define STACK_DIRECTION 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 */ - -#ifndef STACK_DIRECTION -#define STACK_DIRECTION 0 /* Direction unknown. */ -#endif - -#if STACK_DIRECTION != 0 - -#define STACK_DIR STACK_DIRECTION /* Known at compile-time. */ - -#else /* STACK_DIRECTION == 0; need run-time code. */ - -static int stack_dir; /* 1 or -1 once known. */ -#define STACK_DIR stack_dir - -static void -find_stack_direction () -{ - static char *addr = NULL; /* Address of first `dummy', once known. */ - auto char dummy; /* To get stack address. */ - - if (addr == NULL) - { /* Initial entry. */ - addr = ADDRESS_FUNCTION (dummy); - - find_stack_direction (); /* Recurse once. */ - } - else - { - /* Second entry. */ - if (ADDRESS_FUNCTION (dummy) > addr) - stack_dir = 1; /* Stack grew upward. */ - else - stack_dir = -1; /* Stack grew downward. */ - } -} - -#endif /* STACK_DIRECTION == 0 */ - -/* An "alloca header" is used to: - (a) chain together all alloca'ed blocks; - (b) keep track of stack depth. - - It is very important that sizeof(header) agree with malloc - alignment chunk size. The following default should work okay. */ - -#ifndef ALIGN_SIZE -#define ALIGN_SIZE sizeof(double) -#endif - -typedef union hdr -{ - char align[ALIGN_SIZE]; /* To force sizeof(header). */ - struct - { - union hdr *next; /* For chaining headers. */ - char *deep; /* For stack depth measure. */ - } h; -} header; - -static header *last_alloca_header = NULL; /* -> last alloca header. */ - -/* Return a pointer to at least SIZE bytes of storage, - which will be automatically reclaimed upon exit from - the procedure that called alloca. Originally, this space - was supposed to be taken from the current stack frame of the - caller, but that method cannot be made to work for some - implementations of C, for example under Gould's UTX/32. */ - -pointer -alloca (size) - unsigned size; -{ - auto char probe; /* Probes stack depth: */ - register char *depth = ADDRESS_FUNCTION (probe); - -#if STACK_DIRECTION == 0 - if (STACK_DIR == 0) /* Unknown growth direction. */ - find_stack_direction (); -#endif - - /* Reclaim garbage, defined as all alloca'd storage that - was allocated from deeper in the stack than currently. */ - - { - register header *hp; /* Traverses linked list. */ - - for (hp = last_alloca_header; hp != NULL;) - if ((STACK_DIR > 0 && hp->h.deep > depth) - || (STACK_DIR < 0 && hp->h.deep < depth)) - { - register header *np = hp->h.next; - - free ((pointer) hp); /* Collect garbage. */ - - hp = np; /* -> next header. */ - } - else - break; /* Rest are not deeper. */ - - last_alloca_header = hp; /* -> last valid storage. */ - } - - if (size == 0) - return NULL; /* No allocation required. */ - - /* Allocate combined header + user data storage. */ - - { - register pointer new = malloc (sizeof (header) + size); - /* Address of header. */ - - ((header *) new)->h.next = last_alloca_header; - ((header *) new)->h.deep = depth; - - last_alloca_header = (header *) new; - - /* User storage begins just after header. */ - - return (pointer) ((char *) new + sizeof (header)); - } -} - -#if defined (CRAY) && defined (CRAY_STACKSEG_END) - -#ifdef DEBUG_I00AFUNC -#include -#endif - -#ifndef CRAY_STACK -#define CRAY_STACK -#ifndef CRAY2 -/* Stack structures for CRAY-1, CRAY X-MP, and CRAY Y-MP */ -struct stack_control_header - { - long shgrow:32; /* Number of times stack has grown. */ - long shaseg:32; /* Size of increments to stack. */ - long shhwm:32; /* High water mark of stack. */ - long shsize:32; /* Current size of stack (all segments). */ - }; - -/* The stack segment linkage control information occurs at - the high-address end of a stack segment. (The stack - grows from low addresses to high addresses.) The initial - part of the stack segment linkage control information is - 0200 (octal) words. This provides for register storage - for the routine which overflows the stack. */ - -struct stack_segment_linkage - { - long ss[0200]; /* 0200 overflow words. */ - long sssize:32; /* Number of words in this segment. */ - long ssbase:32; /* Offset to stack base. */ - long:32; - long sspseg:32; /* Offset to linkage control of previous - segment of stack. */ - long:32; - long sstcpt:32; /* Pointer to task common address block. */ - long sscsnm; /* Private control structure number for - microtasking. */ - long ssusr1; /* Reserved for user. */ - long ssusr2; /* Reserved for user. */ - long sstpid; /* Process ID for pid based multi-tasking. */ - long ssgvup; /* Pointer to multitasking thread giveup. */ - long sscray[7]; /* Reserved for Cray Research. */ - long ssa0; - long ssa1; - long ssa2; - long ssa3; - long ssa4; - long ssa5; - long ssa6; - long ssa7; - long sss0; - long sss1; - long sss2; - long sss3; - long sss4; - long sss5; - long sss6; - long sss7; - }; - -#else /* CRAY2 */ -/* The following structure defines the vector of words - returned by the STKSTAT library routine. */ -struct stk_stat - { - long now; /* Current total stack size. */ - long maxc; /* Amount of contiguous space which would - be required to satisfy the maximum - stack demand to date. */ - long high_water; /* Stack high-water mark. */ - long overflows; /* Number of stack overflow ($STKOFEN) calls. */ - long hits; /* Number of internal buffer hits. */ - long extends; /* Number of block extensions. */ - long stko_mallocs; /* Block allocations by $STKOFEN. */ - long underflows; /* Number of stack underflow calls ($STKRETN). */ - long stko_free; /* Number of deallocations by $STKRETN. */ - long stkm_free; /* Number of deallocations by $STKMRET. */ - long segments; /* Current number of stack segments. */ - long maxs; /* Maximum number of stack segments so far. */ - long pad_size; /* Stack pad size. */ - long current_address; /* Current stack segment address. */ - long current_size; /* Current stack segment size. This - number is actually corrupted by STKSTAT to - include the fifteen word trailer area. */ - long initial_address; /* Address of initial segment. */ - long initial_size; /* Size of initial segment. */ - }; - -/* The following structure describes the data structure which trails - any stack segment. I think that the description in 'asdef' is - out of date. I only describe the parts that I am sure about. */ - -struct stk_trailer - { - long this_address; /* Address of this block. */ - long this_size; /* Size of this block (does not include - this trailer). */ - long unknown2; - long unknown3; - long link; /* Address of trailer block of previous - segment. */ - long unknown5; - long unknown6; - long unknown7; - long unknown8; - long unknown9; - long unknown10; - long unknown11; - long unknown12; - long unknown13; - long unknown14; - }; - -#endif /* CRAY2 */ -#endif /* not CRAY_STACK */ - -#ifdef CRAY2 -/* Determine a "stack measure" for an arbitrary ADDRESS. - I doubt that "lint" will like this much. */ - -static long -i00afunc (long *address) -{ - struct stk_stat status; - struct stk_trailer *trailer; - long *block, size; - long result = 0; - - /* We want to iterate through all of the segments. The first - step is to get the stack status structure. We could do this - more quickly and more directly, perhaps, by referencing the - $LM00 common block, but I know that this works. */ - - STKSTAT (&status); - - /* Set up the iteration. */ - - trailer = (struct stk_trailer *) (status.current_address - + status.current_size - - 15); - - /* There must be at least one stack segment. Therefore it is - a fatal error if "trailer" is null. */ - - if (trailer == 0) - abort (); - - /* Discard segments that do not contain our argument address. */ - - while (trailer != 0) - { - block = (long *) trailer->this_address; - size = trailer->this_size; - if (block == 0 || size == 0) - abort (); - trailer = (struct stk_trailer *) trailer->link; - if ((block <= address) && (address < (block + size))) - break; - } - - /* Set the result to the offset in this segment and add the sizes - of all predecessor segments. */ - - result = address - block; - - if (trailer == 0) - { - return result; - } - - do - { - if (trailer->this_size <= 0) - abort (); - result += trailer->this_size; - trailer = (struct stk_trailer *) trailer->link; - } - while (trailer != 0); - - /* We are done. Note that if you present a bogus address (one - not in any segment), you will get a different number back, formed - from subtracting the address of the first block. This is probably - not what you want. */ - - return (result); -} - -#else /* not CRAY2 */ -/* Stack address function for a CRAY-1, CRAY X-MP, or CRAY Y-MP. - Determine the number of the cell within the stack, - given the address of the cell. The purpose of this - routine is to linearize, in some sense, stack addresses - for alloca. */ - -static long -i00afunc (long address) -{ - long stkl = 0; - - long size, pseg, this_segment, stack; - long result = 0; - - struct stack_segment_linkage *ssptr; - - /* Register B67 contains the address of the end of the - current stack segment. If you (as a subprogram) store - your registers on the stack and find that you are past - the contents of B67, you have overflowed the segment. - - B67 also points to the stack segment linkage control - area, which is what we are really interested in. */ - - stkl = CRAY_STACKSEG_END (); - ssptr = (struct stack_segment_linkage *) stkl; - - /* If one subtracts 'size' from the end of the segment, - one has the address of the first word of the segment. - - If this is not the first segment, 'pseg' will be - nonzero. */ - - pseg = ssptr->sspseg; - size = ssptr->sssize; - - this_segment = stkl - size; - - /* It is possible that calling this routine itself caused - a stack overflow. Discard stack segments which do not - contain the target address. */ - - while (!(this_segment <= address && address <= stkl)) - { -#ifdef DEBUG_I00AFUNC - fprintf (stderr, "%011o %011o %011o\n", this_segment, address, stkl); -#endif - if (pseg == 0) - break; - stkl = stkl - pseg; - ssptr = (struct stack_segment_linkage *) stkl; - size = ssptr->sssize; - pseg = ssptr->sspseg; - this_segment = stkl - size; - } - - result = address - this_segment; - - /* If you subtract pseg from the current end of the stack, - you get the address of the previous stack segment's end. - This seems a little convoluted to me, but I'll bet you save - a cycle somewhere. */ - - while (pseg != 0) - { -#ifdef DEBUG_I00AFUNC - fprintf (stderr, "%011o %011o\n", pseg, size); -#endif - stkl = stkl - pseg; - ssptr = (struct stack_segment_linkage *) stkl; - size = ssptr->sssize; - pseg = ssptr->sspseg; - result += size; - } - return (result); -} - -#endif /* not CRAY2 */ -#endif /* CRAY */ - -#endif /* no alloca */ diff --git a/contrib/gdb/libiberty/argv.c b/contrib/gdb/libiberty/argv.c deleted file mode 100644 index 40582ab..0000000 --- a/contrib/gdb/libiberty/argv.c +++ /dev/null @@ -1,328 +0,0 @@ -/* Create and destroy argument vectors (argv's) - Copyright (C) 1992 Free Software Foundation, Inc. - Written by Fred Fish @ Cygnus Support - -This file is part of the libiberty library. -Libiberty is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public -License as published by the Free Software Foundation; either -version 2 of the License, or (at your option) any later version. - -Libiberty 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 -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with libiberty; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - - -/* Create and destroy argument vectors. An argument vector is simply an - array of string pointers, terminated by a NULL pointer. */ - -#include "ansidecl.h" -#include "libiberty.h" - -#define isspace(ch) ((ch) == ' ' || (ch) == '\t') - -/* Routines imported from standard C runtime libraries. */ - -#ifdef __STDC__ - -#include -extern void *memcpy (void *s1, const void *s2, size_t n); /* 4.11.2.1 */ -extern size_t strlen (const char *s); /* 4.11.6.3 */ -extern void *malloc (size_t size); /* 4.10.3.3 */ -extern void *realloc (void *ptr, size_t size); /* 4.10.3.4 */ -extern void free (void *ptr); /* 4.10.3.2 */ -extern char *strdup (const char *s); /* Non-ANSI */ - -#else /* !__STDC__ */ - -extern char *memcpy (); /* Copy memory region */ -extern int strlen (); /* Count length of string */ -extern char *malloc (); /* Standard memory allocater */ -extern char *realloc (); /* Standard memory reallocator */ -extern void free (); /* Free malloc'd memory */ -extern char *strdup (); /* Duplicate a string */ - -#endif /* __STDC__ */ - -#include "alloca-conf.h" - -#ifndef NULL -#define NULL 0 -#endif - -#ifndef EOS -#define EOS '\0' -#endif - -#define INITIAL_MAXARGC 8 /* Number of args + NULL in initial argv */ - - -/* - -NAME - - freeargv -- free an argument vector - -SYNOPSIS - - void freeargv (vector) - char **vector; - -DESCRIPTION - - Free an argument vector that was built using buildargv. Simply scans - through the vector, freeing the memory for each argument until the - terminating NULL is found, and then frees the vector itself. - -RETURNS - - No value. - -*/ - -void freeargv (vector) -char **vector; -{ - register char **scan; - - if (vector != NULL) - { - for (scan = vector; *scan != NULL; scan++) - { - free (*scan); - } - free (vector); - } -} - -/* - -NAME - - buildargv -- build an argument vector from a string - -SYNOPSIS - - char **buildargv (sp) - char *sp; - -DESCRIPTION - - Given a pointer to a string, parse the string extracting fields - separated by whitespace and optionally enclosed within either single - or double quotes (which are stripped off), and build a vector of - pointers to copies of the string for each field. The input string - remains unchanged. - - All of the memory for the pointer array and copies of the string - is obtained from malloc. All of the memory can be returned to the - system with the single function call freeargv, which takes the - returned result of buildargv, as it's argument. - - The memory for the argv array is dynamically expanded as necessary. - -RETURNS - - Returns a pointer to the argument vector if successful. Returns NULL - if the input string pointer is NULL or if there is insufficient - memory to complete building the argument vector. - -NOTES - - In order to provide a working buffer for extracting arguments into, - with appropriate stripping of quotes and translation of backslash - sequences, we allocate a working buffer at least as long as the input - string. This ensures that we always have enough space in which to - work, since the extracted arg is never larger than the input string. - - If the input is a null string (as opposed to a NULL pointer), then - buildarg returns an argv that has one arg, a null string. - - Argv is always kept terminated with a NULL arg pointer, so it can - be passed to freeargv at any time, or returned, as appropriate. -*/ - -char **buildargv (input) -char *input; -{ - char *arg; - char *copybuf; - int squote = 0; - int dquote = 0; - int bsquote = 0; - int argc = 0; - int maxargc = 0; - char **argv = NULL; - char **nargv; - - if (input != NULL) - { - copybuf = alloca (strlen (input) + 1); - /* Is a do{}while to always execute the loop once. Always return an - argv, even for null strings. See NOTES above, test case below. */ - do - { - /* Pick off argv[argc] */ - while (isspace (*input)) - { - input++; - } - if ((maxargc == 0) || (argc >= (maxargc - 1))) - { - /* argv needs initialization, or expansion */ - if (argv == NULL) - { - maxargc = INITIAL_MAXARGC; - nargv = (char **) malloc (maxargc * sizeof (char *)); - } - else - { - maxargc *= 2; - nargv = (char **) realloc (argv, maxargc * sizeof (char *)); - } - if (nargv == NULL) - { - if (argv != NULL) - { - freeargv (argv); - argv = NULL; - } - break; - } - argv = nargv; - argv[argc] = NULL; - } - /* Begin scanning arg */ - arg = copybuf; - while (*input != EOS) - { - if (isspace (*input) && !squote && !dquote && !bsquote) - { - break; - } - else - { - if (bsquote) - { - bsquote = 0; - *arg++ = *input; - } - else if (*input == '\\') - { - bsquote = 1; - } - else if (squote) - { - if (*input == '\'') - { - squote = 0; - } - else - { - *arg++ = *input; - } - } - else if (dquote) - { - if (*input == '"') - { - dquote = 0; - } - else - { - *arg++ = *input; - } - } - else - { - if (*input == '\'') - { - squote = 1; - } - else if (*input == '"') - { - dquote = 1; - } - else - { - *arg++ = *input; - } - } - input++; - } - } - *arg = EOS; - argv[argc] = strdup (copybuf); - if (argv[argc] == NULL) - { - freeargv (argv); - argv = NULL; - break; - } - argc++; - argv[argc] = NULL; - - while (isspace (*input)) - { - input++; - } - } - while (*input != EOS); - } - return (argv); -} - -#ifdef MAIN - -/* Simple little test driver. */ - -static char *tests[] = -{ - "a simple command line", - "arg 'foo' is single quoted", - "arg \"bar\" is double quoted", - "arg \"foo bar\" has embedded whitespace", - "arg 'Jack said \\'hi\\'' has single quotes", - "arg 'Jack said \\\"hi\\\"' has double quotes", - "a b c d e f g h i j k l m n o p q r s t u v w x y z 1 2 3 4 5 6 7 8 9", - - /* This should be expanded into only one argument. */ - "trailing-whitespace ", - - "", - NULL -}; - -main () -{ - char **argv; - char **test; - char **targs; - - for (test = tests; *test != NULL; test++) - { - printf ("buildargv(\"%s\")\n", *test); - if ((argv = buildargv (*test)) == NULL) - { - printf ("failed!\n\n"); - } - else - { - for (targs = argv; *targs != NULL; targs++) - { - printf ("\t\"%s\"\n", *targs); - } - printf ("\n"); - } - freeargv (argv); - } - -} - -#endif /* MAIN */ diff --git a/contrib/gdb/libiberty/atexit.c b/contrib/gdb/libiberty/atexit.c deleted file mode 100644 index 4463cb6..0000000 --- a/contrib/gdb/libiberty/atexit.c +++ /dev/null @@ -1,14 +0,0 @@ -/* Wrapper to implement ANSI C's atexit using SunOS's on_exit. */ -/* This function is in the public domain. --Mike Stump. */ - -#ifndef NEED_on_exit -int -atexit(f) - void (*f)(); -{ - /* If the system doesn't provide a definition for atexit, use on_exit - if the system provides that. */ - on_exit (f, 0); - return 0; -} -#endif diff --git a/contrib/gdb/libiberty/basename.c b/contrib/gdb/libiberty/basename.c deleted file mode 100644 index 689b0c2..0000000 --- a/contrib/gdb/libiberty/basename.c +++ /dev/null @@ -1,43 +0,0 @@ -/* Return the basename of a pathname. - This file is in the public domain. */ - -/* -NAME - basename -- return pointer to last component of a pathname - -SYNOPSIS - char *basename (const char *name) - -DESCRIPTION - Given a pointer to a string containing a typical pathname - (/usr/src/cmd/ls/ls.c for example), returns a pointer to the - last component of the pathname ("ls.c" in this case). - -BUGS - Presumes a UNIX style path with UNIX style separators. -*/ - -#include "ansidecl.h" -#include "libiberty.h" - -#include "config.h" - -#ifdef NEED_basename - -char * -basename (name) - const char *name; -{ - const char *base = name; - - while (*name) - { - if (*name++ == '/') - { - base = name; - } - } - return (char *) base; -} - -#endif diff --git a/contrib/gdb/libiberty/bcmp.c b/contrib/gdb/libiberty/bcmp.c deleted file mode 100644 index 11e4417..0000000 --- a/contrib/gdb/libiberty/bcmp.c +++ /dev/null @@ -1,49 +0,0 @@ -/* bcmp - This function is in the public domain. */ - -/* - -NAME - - bcmp -- compare two memory regions - -SYNOPSIS - - int bcmp (char *from, char *to, int count) - -DESCRIPTION - - Compare two memory regions and return zero if they are identical, - non-zero otherwise. If count is zero, return zero. - -NOTES - - No guarantee is made about the non-zero returned value. In - particular, the results may be signficantly different than - strcmp(), where the return value is guaranteed to be less than, - equal to, or greater than zero, according to lexicographical - sorting of the compared regions. - -BUGS - -*/ - - -int -bcmp (from, to, count) - char *from, *to; - int count; -{ - int rtnval = 0; - - while (count-- > 0) - { - if (*from++ != *to++) - { - rtnval = 1; - break; - } - } - return (rtnval); -} - diff --git a/contrib/gdb/libiberty/bcopy.c b/contrib/gdb/libiberty/bcopy.c deleted file mode 100644 index b655363..0000000 --- a/contrib/gdb/libiberty/bcopy.c +++ /dev/null @@ -1,35 +0,0 @@ -/* bcopy -- copy memory regions of arbitary length - -NAME - bcopy -- copy memory regions of arbitrary length - -SYNOPSIS - void bcopy (char *in, char *out, int length) - -DESCRIPTION - Copy LENGTH bytes from memory region pointed to by IN to memory - region pointed to by OUT. - -BUGS - Significant speed improvements can be made in some cases by - implementing copies of multiple bytes simultaneously, or unrolling - the copy loop. - -*/ - -void -bcopy (src, dest, len) - register char *src, *dest; - int len; -{ - if (dest < src) - while (len--) - *dest++ = *src++; - else - { - char *lasts = src + (len-1); - char *lastd = dest + (len-1); - while (len--) - *(char *)lastd-- = *(char *)lasts--; - } -} diff --git a/contrib/gdb/libiberty/bzero.c b/contrib/gdb/libiberty/bzero.c deleted file mode 100644 index d01644b7..0000000 --- a/contrib/gdb/libiberty/bzero.c +++ /dev/null @@ -1,31 +0,0 @@ -/* Portable version of bzero for systems without it. - This function is in the public domain. */ - -/* -NAME - bzero -- zero the contents of a specified memory region - -SYNOPSIS - void bzero (char *to, int count) - -DESCRIPTION - Zero COUNT bytes of memory pointed to by TO. - -BUGS - Significant speed enhancements may be made in some environments - by zeroing more than a single byte at a time, or by unrolling the - loop. - -*/ - - -void -bzero (to, count) - char *to; - int count; -{ - while (count-- > 0) - { - *to++ = 0; - } -} diff --git a/contrib/gdb/libiberty/clock.c b/contrib/gdb/libiberty/clock.c deleted file mode 100644 index b60de16..0000000 --- a/contrib/gdb/libiberty/clock.c +++ /dev/null @@ -1,73 +0,0 @@ -/* ANSI-compatible clock function. - Copyright (C) 1994, 1995 Free Software Foundation, Inc. - -This file is part of the libiberty library. This library 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 library 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 GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ - -#ifdef HAVE_GETRUSAGE -#include -#include -#endif - -#ifdef HAVE_TIMES -#ifndef NO_SYS_PARAM_H -#include -#endif -#include -#endif - -/* FIXME: should be able to declare as clock_t. */ - -long -clock () -{ -#ifdef HAVE_GETRUSAGE - struct rusage rusage; - - getrusage (0, &rusage); - return (rusage.ru_utime.tv_sec * 1000000 + rusage.ru_utime.tv_usec - + rusage.ru_stime.tv_sec * 1000000 + rusage.ru_stime.tv_usec); -#else -#ifdef HAVE_TIMES - struct tms tms; - - times (&tms); - return (tms.tms_utime + tms.tms_stime) * (1000000 / HZ); -#else -#ifdef VMS - struct - { - int proc_user_time; - int proc_system_time; - int child_user_time; - int child_system_time; - } vms_times; - - times (&vms_times); - return (vms_times.proc_user_time + vms_times.proc_system_time) * 10000; -#else - /* A fallback, if nothing else available. */ - return 0; -#endif /* VMS */ -#endif /* HAVE_TIMES */ -#endif /* HAVE_GETRUSAGE */ -} - diff --git a/contrib/gdb/libiberty/concat.c b/contrib/gdb/libiberty/concat.c deleted file mode 100644 index 5b132c8..0000000 --- a/contrib/gdb/libiberty/concat.c +++ /dev/null @@ -1,167 +0,0 @@ -/* Concatenate variable number of strings. - Copyright (C) 1991, 1994 Free Software Foundation, Inc. - Written by Fred Fish @ Cygnus Support - -This file is part of the libiberty library. -Libiberty is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public -License as published by the Free Software Foundation; either -version 2 of the License, or (at your option) any later version. - -Libiberty 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 -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with libiberty; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - - -/* - -NAME - - concat -- concatenate a variable number of strings - -SYNOPSIS - - #include - - char *concat (s1, s2, s3, ..., NULL) - -DESCRIPTION - - Concatenate a variable number of strings and return the result - in freshly malloc'd memory. - - Returns NULL if insufficient memory is available. The argument - list is terminated by the first NULL pointer encountered. Pointers - to empty strings are ignored. - -NOTES - - This function uses xmalloc() which is expected to be a front end - function to malloc() that deals with low memory situations. In - typical use, if malloc() returns NULL then xmalloc() diverts to an - error handler routine which never returns, and thus xmalloc will - never return a NULL pointer. If the client application wishes to - deal with low memory situations itself, it should supply an xmalloc - that just directly invokes malloc and blindly returns whatever - malloc returns. -*/ - - -#include "ansidecl.h" -#include "libiberty.h" - -#ifdef ANSI_PROTOTYPES -#include -#else -#include -#endif - -#ifdef __STDC__ -#include -extern size_t strlen (const char *s); -#else -extern int strlen (); -#endif - -#define NULLP (char *)0 - -/* VARARGS */ -#ifdef ANSI_PROTOTYPES -char * -concat (const char *first, ...) -#else -char * -concat (va_alist) - va_dcl -#endif -{ - register int length; - register char *newstr; - register char *end; - register const char *arg; - va_list args; -#ifndef ANSI_PROTOTYPES - const char *first; -#endif - - /* First compute the size of the result and get sufficient memory. */ - -#ifdef ANSI_PROTOTYPES - va_start (args, first); -#else - va_start (args); - first = va_arg (args, const char *); -#endif - - if (first == NULLP) - length = 0; - else - { - length = strlen (first); - while ((arg = va_arg (args, const char *)) != NULLP) - { - length += strlen (arg); - } - } - newstr = (char *) xmalloc (length + 1); - va_end (args); - - /* Now copy the individual pieces to the result string. */ - - if (newstr != NULLP) - { -#ifdef ANSI_PROTOTYPES - va_start (args, first); -#else - va_start (args); - first = va_arg (args, const char *); -#endif - end = newstr; - if (first != NULLP) - { - arg = first; - while (*arg) - { - *end++ = *arg++; - } - while ((arg = va_arg (args, const char *)) != NULLP) - { - while (*arg) - { - *end++ = *arg++; - } - } - } - *end = '\000'; - va_end (args); - } - - return (newstr); -} - -#ifdef MAIN - -/* Simple little test driver. */ - -#include - -int -main () -{ - printf ("\"\" = \"%s\"\n", concat (NULLP)); - printf ("\"a\" = \"%s\"\n", concat ("a", NULLP)); - printf ("\"ab\" = \"%s\"\n", concat ("a", "b", NULLP)); - printf ("\"abc\" = \"%s\"\n", concat ("a", "b", "c", NULLP)); - printf ("\"abcd\" = \"%s\"\n", concat ("ab", "cd", NULLP)); - printf ("\"abcde\" = \"%s\"\n", concat ("ab", "c", "de", NULLP)); - printf ("\"abcdef\" = \"%s\"\n", concat ("", "a", "", "bcd", "ef", NULLP)); - return 0; -} - -#endif diff --git a/contrib/gdb/libiberty/config.table b/contrib/gdb/libiberty/config.table deleted file mode 100644 index 1b67dd5..0000000 --- a/contrib/gdb/libiberty/config.table +++ /dev/null @@ -1,63 +0,0 @@ -case "${host}" in - rs6000-ibm-aix3.1 | rs6000-ibm-aix) - frag=mh-aix - files=${xsrcdir}alloca-botch.h ;; - *-ibm-aix*) files=${xsrcdir}alloca-botch.h ;; - arm-*-riscix*) frag=mh-riscix ;; - m68k-apollo-bsd*) frag=mh-a68bsd ;; - m68k-apollo-sysv*) frag=mh-apollo68 ;; - i[345]86-ncr-sysv4*) frag=mh-ncr3000 ;; - *-*-cxux7*) frag=mh-cxux7 ;; - *-*-lynxos*) frag=mh-lynxos ;; - *-*-dgux*) frag=mh-sysv ;; - hppa*-hp-bsd*) frag=mh-hpbsd ;; - *-*-hpux*) frag=mh-hpux ;; - *-*-hiux*) frag=mh-hpux ;; - *-*-irix4*) frag=mh-irix4 ;; - *-*-irix*) frag=mh-sysv ;; - *-*-m88kbcs*) frag=mh-sysv ;; - *-*-solaris2*) frag=mh-sysv4 ;; - *-*-sysv4*) frag=mh-sysv4 ;; - *-*-sysv*) frag=mh-sysv ;; - *-*-go32) frag=mh-go32 ;; - - *-*-vxworks5*) - # VxWorks 5 needs special action, because the usual - # autoconfiguration scheme does not work. - frag=mt-vxworks5 - ;; -esac - -# Try to handle funky case of solaris 2 -> sun 4. -case "${host}" in - sparc-sun-sunos4.1.3) - if [ "${with_cross_host}" != "${host}" ] ; then - frag=mt-sunos4 - fi - ;; -esac - -frags=$frag - -# If they didn't specify --enable-shared, don't generate shared libs. -if [ "${enable_shared}" = "yes" ]; then - case "${host}" in - hppa*-*-*) frags="${frags} ../../config/mh-papic" ;; - i[345]86-*-*) frags="${frags} ../../config/mh-x86pic" ;; - *-*-*) frags="${frags} ../../config/mh-${host_cpu}pic" ;; - esac -fi - -echo "# Warning: this fragment is automatically generated" > temp-frag - -for frag in ${frags}; do - frag=${srcdir}/${xsrcdir}config/$frag - if [ -f ${frag} ]; then - echo "Appending ${frag} to xhost-mkfrag" - echo "# Following fragment copied from ${frag}" >> temp-frag - cat ${frag} >> temp-frag - fi -done - -frag=xhost-mkfrag -${moveifchange} temp-frag xhost-mkfrag diff --git a/contrib/gdb/libiberty/config/mh-a68bsd b/contrib/gdb/libiberty/config/mh-a68bsd deleted file mode 100644 index 3c5a237..0000000 --- a/contrib/gdb/libiberty/config/mh-a68bsd +++ /dev/null @@ -1,2 +0,0 @@ -RANLIB=ranlib -CC= cc -A ansi -A runtype,any -A systype,any -U__STDC__ diff --git a/contrib/gdb/libiberty/config/mh-aix b/contrib/gdb/libiberty/config/mh-aix deleted file mode 100644 index c7b848d..0000000 --- a/contrib/gdb/libiberty/config/mh-aix +++ /dev/null @@ -1,10 +0,0 @@ -HDEFINES = -D__IEEE_BIG_ENDIAN -RANLIB=true -INSTALL=cp - -# Most releases of AIX 3.1 include an incorrect internal version of copysign -# in libc.a for use by some libc public functions including modf. The public -# version of copysign in libm.a is usable. For the sake of libg++ (which -# uses modf), we add copysign here. Supposedly, this problem is fixed in AIX -# 3.1.8 and above, including all releases of AIX 3.2. -EXTRA_OFILES = copysign.o diff --git a/contrib/gdb/libiberty/config/mh-apollo68 b/contrib/gdb/libiberty/config/mh-apollo68 deleted file mode 100644 index 651770c..0000000 --- a/contrib/gdb/libiberty/config/mh-apollo68 +++ /dev/null @@ -1,2 +0,0 @@ -RANLIB=true -CC= cc -A ansi -A runtype,any -A systype,any -U__STDC__ diff --git a/contrib/gdb/libiberty/config/mh-cxux7 b/contrib/gdb/libiberty/config/mh-cxux7 deleted file mode 100644 index 6d4d30b..0000000 --- a/contrib/gdb/libiberty/config/mh-cxux7 +++ /dev/null @@ -1,3 +0,0 @@ -HDEFINES = -DHAVE_SYSCONF -DHARRIS_FLOAT_FORMAT -RANLIB=true -INSTALL = cp diff --git a/contrib/gdb/libiberty/config/mh-go32 b/contrib/gdb/libiberty/config/mh-go32 deleted file mode 100644 index 7c9fe4f..0000000 --- a/contrib/gdb/libiberty/config/mh-go32 +++ /dev/null @@ -1,4 +0,0 @@ -HDEFINES=-DHAVE_GETRUSAGE -CC=i386-go32-gcc -O2 -fno-omit-frame-pointer -AR=i386-go32-ar -RANLIB=i386-go32-ranlib diff --git a/contrib/gdb/libiberty/config/mh-hpbsd b/contrib/gdb/libiberty/config/mh-hpbsd deleted file mode 100644 index ce11dcd..0000000 --- a/contrib/gdb/libiberty/config/mh-hpbsd +++ /dev/null @@ -1,2 +0,0 @@ -# HPPA hosts using BSD -RANLIB=true diff --git a/contrib/gdb/libiberty/config/mh-irix4 b/contrib/gdb/libiberty/config/mh-irix4 deleted file mode 100644 index ace7678..0000000 --- a/contrib/gdb/libiberty/config/mh-irix4 +++ /dev/null @@ -1,4 +0,0 @@ -CC = cc -cckr -RANLIB = true -INSTALL = cp -EXTRA_OFILES = alloca.o diff --git a/contrib/gdb/libiberty/config/mh-lynxos b/contrib/gdb/libiberty/config/mh-lynxos deleted file mode 100644 index 2f22110..0000000 --- a/contrib/gdb/libiberty/config/mh-lynxos +++ /dev/null @@ -1 +0,0 @@ -HDEFINES = -DLOSING_SYS_SIGLIST diff --git a/contrib/gdb/libiberty/config/mh-ncr3000 b/contrib/gdb/libiberty/config/mh-ncr3000 deleted file mode 100644 index 3a45c22..0000000 --- a/contrib/gdb/libiberty/config/mh-ncr3000 +++ /dev/null @@ -1,19 +0,0 @@ -# Host configuration file for an NCR 3000 (i486/SVR4) system. - -# The NCR 3000 ships with a MetaWare compiler installed as /bin/cc. -# This compiler not only emits obnoxious copyright messages every time -# 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. -# Unfortunately though, the AT&T compiler sometimes generates code that -# the assembler barfs on if -g is used, so disable it by default as well. -CC = /usr/ccs/ATT/cc -CFLAGS = - -RANLIB = true - -# The /usr/ucb/install program is incompatible (complains about unknown -# group staff). Use good old cp... -INSTALL = cp - -# The l flag generates a warning from the SVR4 archiver, remove it. -AR_FLAGS = cq diff --git a/contrib/gdb/libiberty/config/mh-riscix b/contrib/gdb/libiberty/config/mh-riscix deleted file mode 100644 index 0209279..0000000 --- a/contrib/gdb/libiberty/config/mh-riscix +++ /dev/null @@ -1,6 +0,0 @@ -# The native linker only reports the first undefined symbol if linking with a -# shared library. So build using gcc and link statically (this requires -# gcc 2.6.0 or above). - -ERRORS_CC = gcc -ERRORS_LDFLAGS = -static diff --git a/contrib/gdb/libiberty/config/mh-sysv b/contrib/gdb/libiberty/config/mh-sysv deleted file mode 100644 index eb102d5..0000000 --- a/contrib/gdb/libiberty/config/mh-sysv +++ /dev/null @@ -1 +0,0 @@ -RANLIB=true diff --git a/contrib/gdb/libiberty/config/mh-sysv4 b/contrib/gdb/libiberty/config/mh-sysv4 deleted file mode 100644 index 4d1aa3c..0000000 --- a/contrib/gdb/libiberty/config/mh-sysv4 +++ /dev/null @@ -1,3 +0,0 @@ -HDEFINES = -DHAVE_SYSCONF -RANLIB=true -INSTALL = cp diff --git a/contrib/gdb/libiberty/config/mt-sunos4 b/contrib/gdb/libiberty/config/mt-sunos4 deleted file mode 100644 index c25baa6..0000000 --- a/contrib/gdb/libiberty/config/mt-sunos4 +++ /dev/null @@ -1,2 +0,0 @@ -XTRAFLAGS = -isystem /s1/cygnus/dejagnu/sparc-sun-sunos4.1.3/include/ -LOADLIBES = -L/s1/cygnus/dejagnu/sparc-sun-sunos4.1.3/lib diff --git a/contrib/gdb/libiberty/config/mt-vxworks5 b/contrib/gdb/libiberty/config/mt-vxworks5 deleted file mode 100644 index f1a46d3..0000000 --- a/contrib/gdb/libiberty/config/mt-vxworks5 +++ /dev/null @@ -1,27 +0,0 @@ -# VxWorks 5.x target Makefile fragment. -# The autoconfiguration fails for a VxWorks target, because the -# libraries are actually on the target board, not in the file system. -# Therefore, we compute the dependencies by hand. - -HDEFINES = -DNO_SYS_PARAM_H -CONFIG_H = vxconfig.h -NEEDED_LIST = vxneeded-list - -vxconfig.h: Makefile - if [ -f ../newlib/Makefile ]; then \ - $(MAKE) $(FLAGS_TO_PASS) xconfig.h; \ - cp xconfig.h vxconfig.h; \ - else \ - echo "#define NEED_sys_nerr 1" >vxconfig.h; \ - echo "#define NEED_sys_errlist 1" >>vxconfig.h; \ - echo "#define NEED_sys_siglist 1" >>vxconfig.h; \ - echo "#define NEED_psignal 1" >>vxconfig.h; \ - fi - -vxneeded-list: Makefile - if [ -f ../newlib/Makefile ]; then \ - $(MAKE) $(FLAGS_TO_PASS) xneeded-list; \ - cp xneeded-list vxneeded-list; \ - else \ - echo getopt.o getpagesize.o insque.o random.o strcasecmp.o strncasecmp.o strdup.o vfork.o sigsetmask.o waitpid.o >vxneeded-list; \ - fi diff --git a/contrib/gdb/libiberty/configure.bat b/contrib/gdb/libiberty/configure.bat deleted file mode 100644 index ed33777..0000000 --- a/contrib/gdb/libiberty/configure.bat +++ /dev/null @@ -1,15 +0,0 @@ -@echo off -if "%1" == "h8/300" goto h8300 - -echo Configuring libiberty for go32 -copy Makefile.dos Makefile -echo #define NEED_sys_siglist 1 >> config.h -echo #define NEED_psignal 1 >> config.h -update alloca-normal.h alloca-conf.h -goto exit - -:h8300 -echo Configuring libiberty for H8/300 -copy Makefile.dos Makefile - -:exit diff --git a/contrib/gdb/libiberty/configure.in b/contrib/gdb/libiberty/configure.in deleted file mode 100644 index 84e4eac..0000000 --- a/contrib/gdb/libiberty/configure.in +++ /dev/null @@ -1,77 +0,0 @@ -# This file is a shell script fragment that supplies the information -# necessary for a configure script to process the program in -# this directory. For more information, look at ../configure. - -configdirs= -srctrigger=getopt1.c -srcname="-liberty library" - -# per-host: - -files="alloca-norm.h" -links="alloca-conf.h" - -. ${srcdir}/config.table -host_makefile_frag=${frag} - -# per-target: - -# post-target: - -# If this is the target libiberty, check at compile time whether we are using -# newlib. If we are, we already know the files we need, since the linker -# will fail when run on some of the newlib targets. -if [ -n "${with_target_subdir}" ] ; then - cat > Makefile.tem <<'!EOF!' -CONFIG_H = xconfig.h -NEEDED_LIST = xneeded-list - -xconfig.h: Makefile - if [ -f ../newlib/Makefile ]; then \ - echo "#define NEED_sys_nerr 1" >xconfig.h; \ - echo "#define NEED_sys_errlist 1" >>xconfig.h; \ - echo "#define NEED_sys_siglist 1" >>xconfig.h; \ - echo "#define NEED_psignal 1" >>xconfig.h; \ - else \ - $(MAKE) $(FLAGS_TO_PASS) lconfig.h; \ - cp lconfig.h xconfig.h; \ - fi - -xneeded-list: Makefile - if [ -f ../newlib/Makefile ]; then \ - echo insque.o random.o strdup.o alloca.o >xneeded-list; \ - else \ - $(MAKE) $(FLAGS_TO_PASS) lneeded-list; \ - cp lneeded-list xneeded-list; \ - fi -!EOF! -sed -e "/^####/ r Makefile.tem" \ - -e '/INSTALL_DEST =/s/libdir/tooldir/' ${Makefile} > Makefile.tem3 -mv Makefile.tem3 ${Makefile} -rm -f Makefile.tem -fi - -# We need multilib support, but only if configuring for the target. -if [ -n "${with_target_subdir}" ] ; then - case ${srcdir} in - .) - if [ "${with_target_subdir}" != "." ] ; then - - # Set MULTISRCTOP to the value we need if we are not doing - # multilib. This will be overridden if --enable-multilib was - # used. - sed -e "s:^MULTISRCTOP[ ]*=.*$:MULTISRCTOP = ../:" \ - ${Makefile} > Makefile.tem - rm -f ${Makefile} - mv Makefile.tem ${Makefile} - - . ${srcdir}/${with_multisrctop}../../config-ml.in - else - . ${srcdir}/${with_multisrctop}../config-ml.in - fi - ;; - *) - . ${srcdir}/../config-ml.in - ;; - esac -fi diff --git a/contrib/gdb/libiberty/copysign.c b/contrib/gdb/libiberty/copysign.c deleted file mode 100644 index 0b5f8c3..0000000 --- a/contrib/gdb/libiberty/copysign.c +++ /dev/null @@ -1,140 +0,0 @@ -#include - -#ifdef __IEEE_BIG_ENDIAN - -typedef union -{ - double value; - struct - { - unsigned int sign : 1; - unsigned int exponent: 11; - unsigned int fraction0:4; - unsigned int fraction1:16; - unsigned int fraction2:16; - unsigned int fraction3:16; - - } number; - struct - { - unsigned int sign : 1; - unsigned int exponent: 11; - unsigned int quiet:1; - unsigned int function0:3; - unsigned int function1:16; - unsigned int function2:16; - unsigned int function3:16; - } nan; - struct - { - unsigned long msw; - unsigned long lsw; - } parts; - long aslong[2]; -} __ieee_double_shape_type; - -#endif - -#ifdef __IEEE_LITTLE_ENDIAN - -typedef union -{ - double value; - struct - { -#ifdef __SMALL_BITFIELDS - unsigned int fraction3:16; - unsigned int fraction2:16; - unsigned int fraction1:16; - unsigned int fraction0: 4; -#else - unsigned int fraction1:32; - unsigned int fraction0:20; -#endif - unsigned int exponent :11; - unsigned int sign : 1; - } number; - struct - { -#ifdef __SMALL_BITFIELDS - unsigned int function3:16; - unsigned int function2:16; - unsigned int function1:16; - unsigned int function0:3; -#else - unsigned int function1:32; - unsigned int function0:19; -#endif - unsigned int quiet:1; - unsigned int exponent: 11; - unsigned int sign : 1; - } nan; - struct - { - unsigned long lsw; - unsigned long msw; - } parts; - - long aslong[2]; - -} __ieee_double_shape_type; - -#endif - -#ifdef __IEEE_BIG_ENDIAN -typedef union -{ - float value; - struct - { - unsigned int sign : 1; - unsigned int exponent: 8; - unsigned int fraction0: 7; - unsigned int fraction1: 16; - } number; - struct - { - unsigned int sign:1; - unsigned int exponent:8; - unsigned int quiet:1; - unsigned int function0:6; - unsigned int function1:16; - } nan; - long p1; - -} __ieee_float_shape_type; -#endif - -#ifdef __IEEE_LITTLE_ENDIAN -typedef union -{ - float value; - struct - { - unsigned int fraction0: 7; - unsigned int fraction1: 16; - unsigned int exponent: 8; - unsigned int sign : 1; - } number; - struct - { - unsigned int function1:16; - unsigned int function0:6; - unsigned int quiet:1; - unsigned int exponent:8; - unsigned int sign:1; - } nan; - long p1; - -} __ieee_float_shape_type; -#endif - - -double DEFUN(copysign, (x, y), double x AND double y) -{ - __ieee_double_shape_type a,b; - b.value = y; - a.value = x; - a.number.sign =b.number.sign; - return a.value; -} diff --git a/contrib/gdb/libiberty/cplus-dem.c b/contrib/gdb/libiberty/cplus-dem.c deleted file mode 100644 index a7f8680..0000000 --- a/contrib/gdb/libiberty/cplus-dem.c +++ /dev/null @@ -1,3019 +0,0 @@ -/* Demangler for GNU C++ - Copyright 1989, 1991, 1994, 1995, 1996 Free Software Foundation, Inc. - Written by James Clark (jjc@jclark.uucp) - Rewritten by Fred Fish (fnf@cygnus.com) for ARM and Lucid demangling - -This file is part of the libiberty library. -Libiberty is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public -License as published by the Free Software Foundation; either -version 2 of the License, or (at your option) any later version. - -Libiberty 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 -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with libiberty; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* This file exports two functions; cplus_mangle_opname and cplus_demangle. - - This file imports xmalloc and xrealloc, which are like malloc and - realloc except that they generate a fatal error if there is no - available memory. */ - -#include -#include -#include - -#include -#undef CURRENT_DEMANGLING_STYLE -#define CURRENT_DEMANGLING_STYLE work->options - -extern char *xmalloc PARAMS((unsigned)); -extern char *xrealloc PARAMS((char *, unsigned)); - -char * -mystrstr (s1, s2) - char *s1, *s2; -{ - register char *p = s1; - register int len = strlen (s2); - - for (; (p = strchr (p, *s2)) != 0; p++) - { - if (strncmp (p, s2, len) == 0) - { - return (p); - } - } - return (0); -} - -/* In order to allow a single demangler executable to demangle strings - using various common values of CPLUS_MARKER, as well as any specific - one set at compile time, we maintain a string containing all the - commonly used ones, and check to see if the marker we are looking for - is in that string. CPLUS_MARKER is usually '$' on systems where the - assembler can deal with that. Where the assembler can't, it's usually - '.' (but on many systems '.' is used for other things). We put the - current defined CPLUS_MARKER first (which defaults to '$'), followed - by the next most common value, followed by an explicit '$' in case - the value of CPLUS_MARKER is not '$'. - - We could avoid this if we could just get g++ to tell us what the actual - cplus marker character is as part of the debug information, perhaps by - ensuring that it is the character that terminates the gcc_compiled - marker symbol (FIXME). */ - -#if !defined (CPLUS_MARKER) -#define CPLUS_MARKER '$' -#endif - -enum demangling_styles current_demangling_style = gnu_demangling; - -static char cplus_markers[] = { CPLUS_MARKER, '.', '$', '\0' }; - -void -set_cplus_marker_for_demangling (ch) - int ch; -{ - cplus_markers[0] = ch; -} - -/* Stuff that is shared between sub-routines. - * Using a shared structure allows cplus_demangle to be reentrant. */ - -struct work_stuff -{ - int options; - char **typevec; - int ntypes; - int typevec_size; - int constructor; - int destructor; - int static_type; /* A static member function */ - int const_type; /* A const member function */ -}; - -#define PRINT_ANSI_QUALIFIERS (work -> options & DMGL_ANSI) -#define PRINT_ARG_TYPES (work -> options & DMGL_PARAMS) - -static const struct optable -{ - const char *in; - const char *out; - int flags; -} optable[] = { - {"nw", " new", DMGL_ANSI}, /* new (1.92, ansi) */ - {"dl", " delete", DMGL_ANSI}, /* new (1.92, ansi) */ - {"new", " new", 0}, /* old (1.91, and 1.x) */ - {"delete", " delete", 0}, /* old (1.91, and 1.x) */ - {"vn", " new []", DMGL_ANSI}, /* GNU, pending ansi */ - {"vd", " delete []", DMGL_ANSI}, /* GNU, pending ansi */ - {"as", "=", DMGL_ANSI}, /* ansi */ - {"ne", "!=", DMGL_ANSI}, /* old, ansi */ - {"eq", "==", DMGL_ANSI}, /* old, ansi */ - {"ge", ">=", DMGL_ANSI}, /* old, ansi */ - {"gt", ">", DMGL_ANSI}, /* old, ansi */ - {"le", "<=", DMGL_ANSI}, /* old, ansi */ - {"lt", "<", DMGL_ANSI}, /* old, ansi */ - {"plus", "+", 0}, /* old */ - {"pl", "+", DMGL_ANSI}, /* ansi */ - {"apl", "+=", DMGL_ANSI}, /* ansi */ - {"minus", "-", 0}, /* old */ - {"mi", "-", DMGL_ANSI}, /* ansi */ - {"ami", "-=", DMGL_ANSI}, /* ansi */ - {"mult", "*", 0}, /* old */ - {"ml", "*", DMGL_ANSI}, /* ansi */ - {"amu", "*=", DMGL_ANSI}, /* ansi (ARM/Lucid) */ - {"aml", "*=", DMGL_ANSI}, /* ansi (GNU/g++) */ - {"convert", "+", 0}, /* old (unary +) */ - {"negate", "-", 0}, /* old (unary -) */ - {"trunc_mod", "%", 0}, /* old */ - {"md", "%", DMGL_ANSI}, /* ansi */ - {"amd", "%=", DMGL_ANSI}, /* ansi */ - {"trunc_div", "/", 0}, /* old */ - {"dv", "/", DMGL_ANSI}, /* ansi */ - {"adv", "/=", DMGL_ANSI}, /* ansi */ - {"truth_andif", "&&", 0}, /* old */ - {"aa", "&&", DMGL_ANSI}, /* ansi */ - {"truth_orif", "||", 0}, /* old */ - {"oo", "||", DMGL_ANSI}, /* ansi */ - {"truth_not", "!", 0}, /* old */ - {"nt", "!", DMGL_ANSI}, /* ansi */ - {"postincrement","++", 0}, /* old */ - {"pp", "++", DMGL_ANSI}, /* ansi */ - {"postdecrement","--", 0}, /* old */ - {"mm", "--", DMGL_ANSI}, /* ansi */ - {"bit_ior", "|", 0}, /* old */ - {"or", "|", DMGL_ANSI}, /* ansi */ - {"aor", "|=", DMGL_ANSI}, /* ansi */ - {"bit_xor", "^", 0}, /* old */ - {"er", "^", DMGL_ANSI}, /* ansi */ - {"aer", "^=", DMGL_ANSI}, /* ansi */ - {"bit_and", "&", 0}, /* old */ - {"ad", "&", DMGL_ANSI}, /* ansi */ - {"aad", "&=", DMGL_ANSI}, /* ansi */ - {"bit_not", "~", 0}, /* old */ - {"co", "~", DMGL_ANSI}, /* ansi */ - {"call", "()", 0}, /* old */ - {"cl", "()", DMGL_ANSI}, /* ansi */ - {"alshift", "<<", 0}, /* old */ - {"ls", "<<", DMGL_ANSI}, /* ansi */ - {"als", "<<=", DMGL_ANSI}, /* ansi */ - {"arshift", ">>", 0}, /* old */ - {"rs", ">>", DMGL_ANSI}, /* ansi */ - {"ars", ">>=", DMGL_ANSI}, /* ansi */ - {"component", "->", 0}, /* old */ - {"pt", "->", DMGL_ANSI}, /* ansi; Lucid C++ form */ - {"rf", "->", DMGL_ANSI}, /* ansi; ARM/GNU form */ - {"indirect", "*", 0}, /* old */ - {"method_call", "->()", 0}, /* old */ - {"addr", "&", 0}, /* old (unary &) */ - {"array", "[]", 0}, /* old */ - {"vc", "[]", DMGL_ANSI}, /* ansi */ - {"compound", ", ", 0}, /* old */ - {"cm", ", ", DMGL_ANSI}, /* ansi */ - {"cond", "?:", 0}, /* old */ - {"cn", "?:", DMGL_ANSI}, /* pseudo-ansi */ - {"max", ">?", 0}, /* old */ - {"mx", ">?", DMGL_ANSI}, /* pseudo-ansi */ - {"min", "*", DMGL_ANSI} /* ansi */ -}; - - -typedef struct string /* Beware: these aren't required to be */ -{ /* '\0' terminated. */ - char *b; /* pointer to start of string */ - char *p; /* pointer after last character */ - char *e; /* pointer after end of allocated space */ -} string; - -#define STRING_EMPTY(str) ((str) -> b == (str) -> p) -#define PREPEND_BLANK(str) {if (!STRING_EMPTY(str)) \ - string_prepend(str, " ");} -#define APPEND_BLANK(str) {if (!STRING_EMPTY(str)) \ - string_append(str, " ");} - -#define ARM_VTABLE_STRING "__vtbl__" /* Lucid/ARM virtual table prefix */ -#define ARM_VTABLE_STRLEN 8 /* strlen (ARM_VTABLE_STRING) */ - -/* Prototypes for local functions */ - -static char * -mop_up PARAMS ((struct work_stuff *, string *, int)); - -#if 0 -static int -demangle_method_args PARAMS ((struct work_stuff *work, const char **, string *)); -#endif - -static int -demangle_template PARAMS ((struct work_stuff *work, const char **, string *, - string *)); - -static int -demangle_qualified PARAMS ((struct work_stuff *, const char **, string *, - int, int)); - -static int -demangle_class PARAMS ((struct work_stuff *, const char **, string *)); - -static int -demangle_fund_type PARAMS ((struct work_stuff *, const char **, string *)); - -static int -demangle_signature PARAMS ((struct work_stuff *, const char **, string *)); - -static int -demangle_prefix PARAMS ((struct work_stuff *, const char **, string *)); - -static int -gnu_special PARAMS ((struct work_stuff *, const char **, string *)); - -static int -arm_special PARAMS ((struct work_stuff *, const char **, string *)); - -static void -string_need PARAMS ((string *, int)); - -static void -string_delete PARAMS ((string *)); - -static void -string_init PARAMS ((string *)); - -static void -string_clear PARAMS ((string *)); - -#if 0 -static int -string_empty PARAMS ((string *)); -#endif - -static void -string_append PARAMS ((string *, const char *)); - -static void -string_appends PARAMS ((string *, string *)); - -static void -string_appendn PARAMS ((string *, const char *, int)); - -static void -string_prepend PARAMS ((string *, const char *)); - -static void -string_prependn PARAMS ((string *, const char *, int)); - -static int -get_count PARAMS ((const char **, int *)); - -static int -consume_count PARAMS ((const char **)); - -static int -demangle_args PARAMS ((struct work_stuff *, const char **, string *)); - -static int -do_type PARAMS ((struct work_stuff *, const char **, string *)); - -static int -do_arg PARAMS ((struct work_stuff *, const char **, string *)); - -static void -demangle_function_name PARAMS ((struct work_stuff *, const char **, string *, - const char *)); - -static void -remember_type PARAMS ((struct work_stuff *, const char *, int)); - -static void -forget_types PARAMS ((struct work_stuff *)); - -static void -string_prepends PARAMS ((string *, string *)); - -/* Translate count to integer, consuming tokens in the process. - Conversion terminates on the first non-digit character. - Trying to consume something that isn't a count results in - no consumption of input and a return of 0. */ - -static int -consume_count (type) - const char **type; -{ - int count = 0; - - while (isdigit (**type)) - { - count *= 10; - count += **type - '0'; - (*type)++; - } - return (count); -} - -int -cplus_demangle_opname (opname, result, options) - const char *opname; - char *result; - int options; -{ - int len, i, len1, ret; - string type; - struct work_stuff work[1]; - const char *tem; - - len = strlen(opname); - result[0] = '\0'; - ret = 0; - work->options = options; - - if (opname[0] == '_' && opname[1] == '_' - && opname[2] == 'o' && opname[3] == 'p') - { - /* ANSI. */ - /* type conversion operator. */ - tem = opname + 4; - if (do_type (work, &tem, &type)) - { - strcat (result, "operator "); - strncat (result, type.b, type.p - type.b); - string_delete (&type); - ret = 1; - } - } - else if (opname[0] == '_' && opname[1] == '_' - && opname[2] >= 'a' && opname[2] <= 'z' - && opname[3] >= 'a' && opname[3] <= 'z') - { - if (opname[4] == '\0') - { - /* Operator. */ - for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++) - { - if (strlen (optable[i].in) == 2 - && memcmp (optable[i].in, opname + 2, 2) == 0) - { - strcat (result, "operator"); - strcat (result, optable[i].out); - ret = 1; - break; - } - } - } - else - { - if (opname[2] == 'a' && opname[5] == '\0') - { - /* Assignment. */ - for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++) - { - if (strlen (optable[i].in) == 3 - && memcmp (optable[i].in, opname + 2, 3) == 0) - { - strcat (result, "operator"); - strcat (result, optable[i].out); - ret = 1; - break; - } - } - } - } - } - else if (len >= 3 - && opname[0] == 'o' - && opname[1] == 'p' - && strchr (cplus_markers, opname[2]) != NULL) - { - /* see if it's an assignment expression */ - if (len >= 10 /* op$assign_ */ - && memcmp (opname + 3, "assign_", 7) == 0) - { - for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++) - { - len1 = len - 10; - if (strlen (optable[i].in) == len1 - && memcmp (optable[i].in, opname + 10, len1) == 0) - { - strcat (result, "operator"); - strcat (result, optable[i].out); - strcat (result, "="); - ret = 1; - break; - } - } - } - else - { - for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++) - { - len1 = len - 3; - if (strlen (optable[i].in) == len1 - && memcmp (optable[i].in, opname + 3, len1) == 0) - { - strcat (result, "operator"); - strcat (result, optable[i].out); - ret = 1; - break; - } - } - } - } - else if (len >= 5 && memcmp (opname, "type", 4) == 0 - && strchr (cplus_markers, opname[4]) != NULL) - { - /* type conversion operator */ - tem = opname + 5; - if (do_type (work, &tem, &type)) - { - strcat (result, "operator "); - strncat (result, type.b, type.p - type.b); - string_delete (&type); - ret = 1; - } - } - return ret; - -} -/* Takes operator name as e.g. "++" and returns mangled - operator name (e.g. "postincrement_expr"), or NULL if not found. - - If OPTIONS & DMGL_ANSI == 1, return the ANSI name; - if OPTIONS & DMGL_ANSI == 0, return the old GNU name. */ - -const char * -cplus_mangle_opname (opname, options) - const char *opname; - int options; -{ - int i; - int len; - - len = strlen (opname); - for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++) - { - if (strlen (optable[i].out) == len - && (options & DMGL_ANSI) == (optable[i].flags & DMGL_ANSI) - && memcmp (optable[i].out, opname, len) == 0) - return optable[i].in; - } - return (0); -} - -/* check to see whether MANGLED can match TEXT in the first TEXT_LEN - characters. */ - -int cplus_match (mangled, text, text_len) - const char *mangled; - char *text; - int text_len; -{ - if (strncmp (mangled, text, text_len) != 0) { - return(0); /* cannot match either */ - } else { - return(1); /* matches mangled, may match demangled */ - } -} - -/* char *cplus_demangle (const char *mangled, int options) - - If MANGLED is a mangled function name produced by GNU C++, then - a pointer to a malloced string giving a C++ representation - of the name will be returned; otherwise NULL will be returned. - It is the caller's responsibility to free the string which - is returned. - - The OPTIONS arg may contain one or more of the following bits: - - DMGL_ANSI ANSI qualifiers such as `const' and `void' are - included. - DMGL_PARAMS Function parameters are included. - - For example, - - cplus_demangle ("foo__1Ai", DMGL_PARAMS) => "A::foo(int)" - cplus_demangle ("foo__1Ai", DMGL_PARAMS | DMGL_ANSI) => "A::foo(int)" - cplus_demangle ("foo__1Ai", 0) => "A::foo" - - cplus_demangle ("foo__1Afe", DMGL_PARAMS) => "A::foo(float,...)" - cplus_demangle ("foo__1Afe", DMGL_PARAMS | DMGL_ANSI)=> "A::foo(float,...)" - cplus_demangle ("foo__1Afe", 0) => "A::foo" - - Note that any leading underscores, or other such characters prepended by - the compilation system, are presumed to have already been stripped from - MANGLED. */ - -char * -cplus_demangle (mangled, options) - const char *mangled; - int options; -{ - string decl; - int success = 0; - struct work_stuff work[1]; - char *demangled = NULL; - - if ((mangled != NULL) && (*mangled != '\0')) - { - memset ((char *) work, 0, sizeof (work)); - work -> options = options; - if ((work->options & DMGL_STYLE_MASK) == 0) - work->options |= (int)current_demangling_style & DMGL_STYLE_MASK; - - string_init (&decl); - - /* First check to see if gnu style demangling is active and if the - string to be demangled contains a CPLUS_MARKER. If so, attempt to - recognize one of the gnu special forms rather than looking for a - standard prefix. In particular, don't worry about whether there - is a "__" string in the mangled string. Consider "_$_5__foo" for - example. */ - - if ((AUTO_DEMANGLING || GNU_DEMANGLING)) - { - success = gnu_special (work, &mangled, &decl); - } - if (!success) - { - success = demangle_prefix (work, &mangled, &decl); - } - if (success && (*mangled != '\0')) - { - success = demangle_signature (work, &mangled, &decl); - } - if (work->constructor == 2) - { - string_prepend(&decl, "global constructors keyed to "); - work->constructor = 0; - } - else if (work->destructor == 2) - { - string_prepend(&decl, "global destructors keyed to "); - work->destructor = 0; - } - demangled = mop_up (work, &decl, success); - } - return (demangled); -} - -static char * -mop_up (work, declp, success) - struct work_stuff *work; - string *declp; - int success; -{ - char *demangled = NULL; - - /* Discard the remembered types, if any. */ - - forget_types (work); - if (work -> typevec != NULL) - { - free ((char *) work -> typevec); - } - - /* If demangling was successful, ensure that the demangled string is null - terminated and return it. Otherwise, free the demangling decl. */ - - if (!success) - { - string_delete (declp); - } - else - { - string_appendn (declp, "", 1); - demangled = declp -> b; - } - return (demangled); -} - -/* - -LOCAL FUNCTION - - demangle_signature -- demangle the signature part of a mangled name - -SYNOPSIS - - static int - demangle_signature (struct work_stuff *work, const char **mangled, - string *declp); - -DESCRIPTION - - Consume and demangle the signature portion of the mangled name. - - DECLP is the string where demangled output is being built. At - entry it contains the demangled root name from the mangled name - prefix. I.E. either a demangled operator name or the root function - name. In some special cases, it may contain nothing. - - *MANGLED points to the current unconsumed location in the mangled - name. As tokens are consumed and demangling is performed, the - pointer is updated to continuously point at the next token to - be consumed. - - Demangling GNU style mangled names is nasty because there is no - explicit token that marks the start of the outermost function - argument list. -*/ - -static int -demangle_signature (work, mangled, declp) - struct work_stuff *work; - const char **mangled; - string *declp; -{ - int success = 1; - int func_done = 0; - int expect_func = 0; - const char *oldmangled = NULL; - string trawname; - string tname; - - while (success && (**mangled != '\0')) - { - switch (**mangled) - { - case 'Q': - oldmangled = *mangled; - success = demangle_qualified (work, mangled, declp, 1, 0); - if (success) - { - remember_type (work, oldmangled, *mangled - oldmangled); - } - if (AUTO_DEMANGLING || GNU_DEMANGLING) - { - expect_func = 1; - } - oldmangled = NULL; - break; - - case 'S': - /* Static member function */ - if (oldmangled == NULL) - { - oldmangled = *mangled; - } - (*mangled)++; - work -> static_type = 1; - break; - - case 'C': - /* a const member function */ - if (oldmangled == NULL) - { - oldmangled = *mangled; - } - (*mangled)++; - work -> const_type = 1; - break; - - case '0': case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': - if (oldmangled == NULL) - { - oldmangled = *mangled; - } - success = demangle_class (work, mangled, declp); - if (success) - { - remember_type (work, oldmangled, *mangled - oldmangled); - } - if (AUTO_DEMANGLING || GNU_DEMANGLING) - { - expect_func = 1; - } - oldmangled = NULL; - break; - - case 'F': - /* Function */ - /* ARM style demangling includes a specific 'F' character after - the class name. For GNU style, it is just implied. So we can - safely just consume any 'F' at this point and be compatible - with either style. */ - - oldmangled = NULL; - func_done = 1; - (*mangled)++; - - /* For lucid/ARM style we have to forget any types we might - have remembered up to this point, since they were not argument - types. GNU style considers all types seen as available for - back references. See comment in demangle_args() */ - - if (LUCID_DEMANGLING || ARM_DEMANGLING) - { - forget_types (work); - } - success = demangle_args (work, mangled, declp); - break; - - case 't': - /* G++ Template */ - string_init(&trawname); - string_init(&tname); - if (oldmangled == NULL) - { - oldmangled = *mangled; - } - success = demangle_template (work, mangled, &tname, &trawname); - if (success) - { - remember_type (work, oldmangled, *mangled - oldmangled); - } - string_append(&tname, "::"); - string_prepends(declp, &tname); - if (work -> destructor & 1) - { - string_prepend (&trawname, "~"); - string_appends (declp, &trawname); - work->destructor -= 1; - } - if ((work->constructor & 1) || (work->destructor & 1)) - { - string_appends (declp, &trawname); - work->constructor -= 1; - } - string_delete(&trawname); - string_delete(&tname); - oldmangled = NULL; - expect_func = 1; - break; - - case '_': - /* At the outermost level, we cannot have a return type specified, - so if we run into another '_' at this point we are dealing with - a mangled name that is either bogus, or has been mangled by - some algorithm we don't know how to deal with. So just - reject the entire demangling. */ - success = 0; - break; - - default: - if (AUTO_DEMANGLING || GNU_DEMANGLING) - { - /* Assume we have stumbled onto the first outermost function - argument token, and start processing args. */ - func_done = 1; - success = demangle_args (work, mangled, declp); - } - else - { - /* Non-GNU demanglers use a specific token to mark the start - of the outermost function argument tokens. Typically 'F', - for ARM-demangling, for example. So if we find something - we are not prepared for, it must be an error. */ - success = 0; - } - break; - } -/* - if (AUTO_DEMANGLING || GNU_DEMANGLING) -*/ - { - if (success && expect_func) - { - func_done = 1; - success = demangle_args (work, mangled, declp); - } - } - } - if (success && !func_done) - { - if (AUTO_DEMANGLING || GNU_DEMANGLING) - { - /* With GNU style demangling, bar__3foo is 'foo::bar(void)', and - bar__3fooi is 'foo::bar(int)'. We get here when we find the - first case, and need to ensure that the '(void)' gets added to - the current declp. Note that with ARM, the first case - represents the name of a static data member 'foo::bar', - which is in the current declp, so we leave it alone. */ - success = demangle_args (work, mangled, declp); - } - } - if (success && work -> static_type && PRINT_ARG_TYPES) - { - string_append (declp, " static"); - } - if (success && work -> const_type && PRINT_ARG_TYPES) - { - string_append (declp, " const"); - } - return (success); -} - -#if 0 - -static int -demangle_method_args (work, mangled, declp) - struct work_stuff *work; - const char **mangled; - string *declp; -{ - int success = 0; - - if (work -> static_type) - { - string_append (declp, *mangled + 1); - *mangled += strlen (*mangled); - success = 1; - } - else - { - success = demangle_args (work, mangled, declp); - } - return (success); -} - -#endif - -static int -demangle_template (work, mangled, tname, trawname) - struct work_stuff *work; - const char **mangled; - string *tname; - string *trawname; -{ - int i; - int is_pointer; - int is_real; - int is_integral; - int is_char; - int is_bool; - int r; - int need_comma = 0; - int success = 0; - int done; - const char *old_p; - const char *start; - int symbol_len; - string temp; - - (*mangled)++; - start = *mangled; - /* get template name */ - if ((r = consume_count (mangled)) == 0 || strlen (*mangled) < r) - { - return (0); - } - if (trawname) - string_appendn (trawname, *mangled, r); - string_appendn (tname, *mangled, r); - *mangled += r; - string_append (tname, "<"); - /* get size of template parameter list */ - if (!get_count (mangled, &r)) - { - return (0); - } - for (i = 0; i < r; i++) - { - if (need_comma) - { - string_append (tname, ", "); - } - /* Z for type parameters */ - if (**mangled == 'Z') - { - (*mangled)++; - /* temp is initialized in do_type */ - success = do_type (work, mangled, &temp); - if (success) - { - string_appends (tname, &temp); - } - string_delete(&temp); - if (!success) - { - break; - } - } - else - { - /* otherwise, value parameter */ - old_p = *mangled; - is_pointer = 0; - is_real = 0; - is_integral = 0; - is_char = 0; - is_bool = 0; - done = 0; - /* temp is initialized in do_type */ - success = do_type (work, mangled, &temp); -/* - if (success) - { - string_appends (tname, &temp); - } -*/ - string_delete(&temp); - if (!success) - { - break; - } -/* - string_append (tname, "="); -*/ - while (*old_p && !done) - { - switch (*old_p) - { - case 'P': - case 'p': - case 'R': - done = is_pointer = 1; - break; - case 'C': /* const */ - case 'S': /* explicitly signed [char] */ - case 'U': /* unsigned */ - case 'V': /* volatile */ - case 'F': /* function */ - case 'M': /* member function */ - case 'O': /* ??? */ - old_p++; - continue; - case 'Q': /* qualified name */ - done = is_integral = 1; - break; - case 'T': /* remembered type */ - abort (); - break; - case 'v': /* void */ - abort (); - break; - case 'x': /* long long */ - case 'l': /* long */ - case 'i': /* int */ - case 's': /* short */ - case 'w': /* wchar_t */ - done = is_integral = 1; - break; - case 'b': /* bool */ - done = is_bool = 1; - break; - case 'c': /* char */ - done = is_char = 1; - break; - case 'r': /* long double */ - case 'd': /* double */ - case 'f': /* float */ - done = is_real = 1; - break; - default: - /* it's probably user defined type, let's assume - it's integral, it seems hard to figure out - what it really is */ - done = is_integral = 1; - } - } - if (is_integral) - { - if (**mangled == 'm') - { - string_appendn (tname, "-", 1); - (*mangled)++; - } - while (isdigit (**mangled)) - { - string_appendn (tname, *mangled, 1); - (*mangled)++; - } - } - else if (is_char) - { - char tmp[2]; - int val; - if (**mangled == 'm') - { - string_appendn (tname, "-", 1); - (*mangled)++; - } - string_appendn (tname, "'", 1); - val = consume_count(mangled); - if (val == 0) - { - success = 0; - break; - } - tmp[0] = (char)val; - tmp[1] = '\0'; - string_appendn (tname, &tmp[0], 1); - string_appendn (tname, "'", 1); - } - else if (is_bool) - { - int val = consume_count (mangled); - if (val == 0) - string_appendn (tname, "false", 5); - else if (val == 1) - string_appendn (tname, "true", 4); - else - success = 0; - } - else if (is_real) - { - if (**mangled == 'm') - { - string_appendn (tname, "-", 1); - (*mangled)++; - } - while (isdigit (**mangled)) - { - string_appendn (tname, *mangled, 1); - (*mangled)++; - } - if (**mangled == '.') /* fraction */ - { - string_appendn (tname, ".", 1); - (*mangled)++; - while (isdigit (**mangled)) - { - string_appendn (tname, *mangled, 1); - (*mangled)++; - } - } - if (**mangled == 'e') /* exponent */ - { - string_appendn (tname, "e", 1); - (*mangled)++; - while (isdigit (**mangled)) - { - string_appendn (tname, *mangled, 1); - (*mangled)++; - } - } - } - else if (is_pointer) - { - if (!get_count (mangled, &symbol_len)) - { - success = 0; - break; - } - if (symbol_len == 0) - string_appendn (tname, "0", 1); - else - { - char *p = xmalloc (symbol_len + 1), *q; - strncpy (p, *mangled, symbol_len); - p [symbol_len] = '\0'; - q = cplus_demangle (p, work->options); - string_appendn (tname, "&", 1); - if (q) - { - string_append (tname, q); - free (q); - } - else - string_append (tname, p); - free (p); - } - *mangled += symbol_len; - } - } - need_comma = 1; - } - if (tname->p[-1] == '>') - string_append (tname, " "); - string_append (tname, ">"); - -/* - if (work -> static_type) - { - string_append (declp, *mangled + 1); - *mangled += strlen (*mangled); - success = 1; - } - else - { - success = demangle_args (work, mangled, declp); - } - } -*/ - return (success); -} - -static int -arm_pt (work, mangled, n, anchor, args) - struct work_stuff *work; - const char *mangled; - int n; - const char **anchor, **args; -{ - /* ARM template? */ - if (ARM_DEMANGLING && (*anchor = mystrstr (mangled, "__pt__"))) - { - int len; - *args = *anchor + 6; - len = consume_count (args); - if (*args + len == mangled + n && **args == '_') - { - ++*args; - return 1; - } - } - return 0; -} - -static void -demangle_arm_pt (work, mangled, n, declp) - struct work_stuff *work; - const char **mangled; - int n; - string *declp; -{ - const char *p; - const char *args; - const char *e = *mangled + n; - - /* ARM template? */ - if (arm_pt (work, *mangled, n, &p, &args)) - { - string arg; - string_init (&arg); - string_appendn (declp, *mangled, p - *mangled); - string_append (declp, "<"); - /* should do error checking here */ - while (args < e) { - string_clear (&arg); - do_type (work, &args, &arg); - string_appends (declp, &arg); - string_append (declp, ","); - } - string_delete (&arg); - --declp->p; - string_append (declp, ">"); - } - else - { - string_appendn (declp, *mangled, n); - } - *mangled += n; -} - -static int -demangle_class_name (work, mangled, declp) - struct work_stuff *work; - const char **mangled; - string *declp; -{ - int n; - int success = 0; - - n = consume_count (mangled); - if (strlen (*mangled) >= n) - { - demangle_arm_pt (work, mangled, n, declp); - success = 1; - } - - return (success); -} - -/* - -LOCAL FUNCTION - - demangle_class -- demangle a mangled class sequence - -SYNOPSIS - - static int - demangle_class (struct work_stuff *work, const char **mangled, - strint *declp) - -DESCRIPTION - - DECLP points to the buffer into which demangling is being done. - - *MANGLED points to the current token to be demangled. On input, - it points to a mangled class (I.E. "3foo", "13verylongclass", etc.) - On exit, it points to the next token after the mangled class on - success, or the first unconsumed token on failure. - - If the CONSTRUCTOR or DESTRUCTOR flags are set in WORK, then - we are demangling a constructor or destructor. In this case - we prepend "class::class" or "class::~class" to DECLP. - - Otherwise, we prepend "class::" to the current DECLP. - - Reset the constructor/destructor flags once they have been - "consumed". This allows demangle_class to be called later during - the same demangling, to do normal class demangling. - - Returns 1 if demangling is successful, 0 otherwise. - -*/ - -static int -demangle_class (work, mangled, declp) - struct work_stuff *work; - const char **mangled; - string *declp; -{ - int success = 0; - string class_name; - - string_init (&class_name); - if (demangle_class_name (work, mangled, &class_name)) - { - if ((work->constructor & 1) || (work->destructor & 1)) - { - string_prepends (declp, &class_name); - if (work -> destructor & 1) - { - string_prepend (declp, "~"); - work -> destructor -= 1; - } - else - { - work -> constructor -= 1; - } - } - string_prepend (declp, "::"); - string_prepends (declp, &class_name); - success = 1; - } - string_delete (&class_name); - return (success); -} - -/* - -LOCAL FUNCTION - - demangle_prefix -- consume the mangled name prefix and find signature - -SYNOPSIS - - static int - demangle_prefix (struct work_stuff *work, const char **mangled, - string *declp); - -DESCRIPTION - - Consume and demangle the prefix of the mangled name. - - DECLP points to the string buffer into which demangled output is - placed. On entry, the buffer is empty. On exit it contains - the root function name, the demangled operator name, or in some - special cases either nothing or the completely demangled result. - - MANGLED points to the current pointer into the mangled name. As each - token of the mangled name is consumed, it is updated. Upon entry - the current mangled name pointer points to the first character of - the mangled name. Upon exit, it should point to the first character - of the signature if demangling was successful, or to the first - unconsumed character if demangling of the prefix was unsuccessful. - - Returns 1 on success, 0 otherwise. - */ - -static int -demangle_prefix (work, mangled, declp) - struct work_stuff *work; - const char **mangled; - string *declp; -{ - int success = 1; - const char *scan; - int i; - - if (strlen(*mangled) >= 11 && strncmp(*mangled, "_GLOBAL_", 8) == 0) - { - char *marker = strchr (cplus_markers, (*mangled)[8]); - if (marker != NULL && *marker == (*mangled)[10]) - { - if ((*mangled)[9] == 'D') - { - /* it's a GNU global destructor to be executed at program exit */ - (*mangled) += 11; - work->destructor = 2; - if (gnu_special (work, mangled, declp)) - return success; - } - else if ((*mangled)[9] == 'I') - { - /* it's a GNU global constructor to be executed at program init */ - (*mangled) += 11; - work->constructor = 2; - if (gnu_special (work, mangled, declp)) - return success; - } - } - } - else if (ARM_DEMANGLING && strncmp(*mangled, "__std__", 7) == 0) - { - /* it's a ARM global destructor to be executed at program exit */ - (*mangled) += 7; - work->destructor = 2; - } - else if (ARM_DEMANGLING && strncmp(*mangled, "__sti__", 7) == 0) - { - /* it's a ARM global constructor to be executed at program initial */ - (*mangled) += 7; - work->constructor = 2; - } - -/* This block of code is a reduction in strength time optimization - of: - scan = mystrstr (*mangled, "__"); */ - - { - scan = *mangled; - - do { - scan = strchr (scan, '_'); - } while (scan != NULL && *++scan != '_'); - - if (scan != NULL) --scan; - } - - if (scan != NULL) - { - /* We found a sequence of two or more '_', ensure that we start at - the last pair in the sequence. */ - i = strspn (scan, "_"); - if (i > 2) - { - scan += (i - 2); - } - } - - if (scan == NULL) - { - success = 0; - } - else if (work -> static_type) - { - if (!isdigit (scan[0]) && (scan[0] != 't')) - { - success = 0; - } - } - else if ((scan == *mangled) && - (isdigit (scan[2]) || (scan[2] == 'Q') || (scan[2] == 't'))) - { - /* The ARM says nothing about the mangling of local variables. - But cfront mangles local variables by prepending __ - to them. As an extension to ARM demangling we handle this case. */ - if ((LUCID_DEMANGLING || ARM_DEMANGLING) && isdigit (scan[2])) - { - *mangled = scan + 2; - consume_count (mangled); - string_append (declp, *mangled); - *mangled += strlen (*mangled); - success = 1; - } - else - { - /* A GNU style constructor starts with __[0-9Qt]. But cfront uses - names like __Q2_3foo3bar for nested type names. So don't accept - this style of constructor for cfront demangling. */ - if (!(LUCID_DEMANGLING || ARM_DEMANGLING)) - work -> constructor += 1; - *mangled = scan + 2; - } - } - else if ((scan == *mangled) && !isdigit (scan[2]) && (scan[2] != 't')) - { - /* Mangled name starts with "__". Skip over any leading '_' characters, - then find the next "__" that separates the prefix from the signature. - */ - if (!(ARM_DEMANGLING || LUCID_DEMANGLING) - || (arm_special (work, mangled, declp) == 0)) - { - while (*scan == '_') - { - scan++; - } - if ((scan = mystrstr (scan, "__")) == NULL || (*(scan + 2) == '\0')) - { - /* No separator (I.E. "__not_mangled"), or empty signature - (I.E. "__not_mangled_either__") */ - success = 0; - } - else - { - demangle_function_name (work, mangled, declp, scan); - } - } - } - else if (ARM_DEMANGLING && scan[2] == 'p' && scan[3] == 't') - { - /* Cfront-style parameterized type. Handled later as a signature. */ - success = 1; - - /* ARM template? */ - demangle_arm_pt (work, mangled, strlen (*mangled), declp); - } - else if (*(scan + 2) != '\0') - { - /* Mangled name does not start with "__" but does have one somewhere - in there with non empty stuff after it. Looks like a global - function name. */ - demangle_function_name (work, mangled, declp, scan); - } - else - { - /* Doesn't look like a mangled name */ - success = 0; - } - - if (!success && (work->constructor == 2 || work->destructor == 2)) - { - string_append (declp, *mangled); - *mangled += strlen (*mangled); - success = 1; - } - return (success); -} - -/* - -LOCAL FUNCTION - - gnu_special -- special handling of gnu mangled strings - -SYNOPSIS - - static int - gnu_special (struct work_stuff *work, const char **mangled, - string *declp); - - -DESCRIPTION - - Process some special GNU style mangling forms that don't fit - the normal pattern. For example: - - _$_3foo (destructor for class foo) - _vt$foo (foo virtual table) - _vt$foo$bar (foo::bar virtual table) - __vt_foo (foo virtual table, new style with thunks) - _3foo$varname (static data member) - _Q22rs2tu$vw (static data member) - __t6vector1Zii (constructor with template) - __thunk_4__$_7ostream (virtual function thunk) - */ - -static int -gnu_special (work, mangled, declp) - struct work_stuff *work; - const char **mangled; - string *declp; -{ - int n; - int success = 1; - const char *p; - - if ((*mangled)[0] == '_' - && strchr (cplus_markers, (*mangled)[1]) != NULL - && (*mangled)[2] == '_') - { - /* Found a GNU style destructor, get past "__" */ - (*mangled) += 3; - work -> destructor += 1; - } - else if ((*mangled)[0] == '_' - && (((*mangled)[1] == '_' - && (*mangled)[2] == 'v' - && (*mangled)[3] == 't' - && (*mangled)[4] == '_') - || ((*mangled)[1] == 'v' - && (*mangled)[2] == 't' - && strchr (cplus_markers, (*mangled)[3]) != NULL))) - { - /* Found a GNU style virtual table, get past "_vt" - and create the decl. Note that we consume the entire mangled - input string, which means that demangle_signature has no work - to do. */ - if ((*mangled)[2] == 'v') - (*mangled) += 5; /* New style, with thunks: "__vt_" */ - else - (*mangled) += 4; /* Old style, no thunks: "_vt" */ - while (**mangled != '\0') - { - p = strpbrk (*mangled, cplus_markers); - switch (**mangled) - { - case 'Q': - success = demangle_qualified (work, mangled, declp, 0, 1); - break; - case 't': - success = demangle_template (work, mangled, declp, 0); - break; - default: - if (isdigit(*mangled[0])) - { - n = consume_count(mangled); - } - else - { - n = strcspn (*mangled, cplus_markers); - } - string_appendn (declp, *mangled, n); - (*mangled) += n; - } - - if (success && ((p == NULL) || (p == *mangled))) - { - if (p != NULL) - { - string_append (declp, "::"); - (*mangled)++; - } - } - else - { - success = 0; - break; - } - } - if (success) - string_append (declp, " virtual table"); - } - else if ((*mangled)[0] == '_' - && (strchr("0123456789Qt", (*mangled)[1]) != NULL) - && (p = strpbrk (*mangled, cplus_markers)) != NULL) - { - /* static data member, "_3foo$varname" for example */ - (*mangled)++; - switch (**mangled) - { - case 'Q': - success = demangle_qualified (work, mangled, declp, 0, 1); - break; - case 't': - success = demangle_template (work, mangled, declp, 0); - break; - default: - n = consume_count (mangled); - string_appendn (declp, *mangled, n); - (*mangled) += n; - } - if (success && (p == *mangled)) - { - /* Consumed everything up to the cplus_marker, append the - variable name. */ - (*mangled)++; - string_append (declp, "::"); - n = strlen (*mangled); - string_appendn (declp, *mangled, n); - (*mangled) += n; - } - else - { - success = 0; - } - } - else if (strncmp (*mangled, "__thunk_", 8) == 0) - { - int delta = ((*mangled) += 8, consume_count (mangled)); - char *method = cplus_demangle (++*mangled, work->options); - if (method) - { - char buf[50]; - sprintf (buf, "virtual function thunk (delta:%d) for ", -delta); - string_append (declp, buf); - string_append (declp, method); - free (method); - n = strlen (*mangled); - (*mangled) += n; - } - else - { - success = 0; - } - } - else - { - success = 0; - } - return (success); -} - -/* - -LOCAL FUNCTION - - arm_special -- special handling of ARM/lucid mangled strings - -SYNOPSIS - - static int - arm_special (struct work_stuff *work, const char **mangled, - string *declp); - - -DESCRIPTION - - Process some special ARM style mangling forms that don't fit - the normal pattern. For example: - - __vtbl__3foo (foo virtual table) - __vtbl__3foo__3bar (bar::foo virtual table) - - */ - -static int -arm_special (work, mangled, declp) - struct work_stuff *work; - const char **mangled; - string *declp; -{ - int n; - int success = 1; - const char *scan; - - if (strncmp (*mangled, ARM_VTABLE_STRING, ARM_VTABLE_STRLEN) == 0) - { - /* Found a ARM style virtual table, get past ARM_VTABLE_STRING - and create the decl. Note that we consume the entire mangled - input string, which means that demangle_signature has no work - to do. */ - scan = *mangled + ARM_VTABLE_STRLEN; - while (*scan != '\0') /* first check it can be demangled */ - { - n = consume_count (&scan); - if (n==0) - { - return (0); /* no good */ - } - scan += n; - if (scan[0] == '_' && scan[1] == '_') - { - scan += 2; - } - } - (*mangled) += ARM_VTABLE_STRLEN; - while (**mangled != '\0') - { - n = consume_count (mangled); - string_prependn (declp, *mangled, n); - (*mangled) += n; - if ((*mangled)[0] == '_' && (*mangled)[1] == '_') - { - string_prepend (declp, "::"); - (*mangled) += 2; - } - } - string_append (declp, " virtual table"); - } - else - { - success = 0; - } - return (success); -} - -/* - -LOCAL FUNCTION - - demangle_qualified -- demangle 'Q' qualified name strings - -SYNOPSIS - - static int - demangle_qualified (struct work_stuff *, const char *mangled, - string *result, int isfuncname, int append); - -DESCRIPTION - - Demangle a qualified name, such as "Q25Outer5Inner" which is - the mangled form of "Outer::Inner". The demangled output is - prepended or appended to the result string according to the - state of the append flag. - - If isfuncname is nonzero, then the qualified name we are building - is going to be used as a member function name, so if it is a - constructor or destructor function, append an appropriate - constructor or destructor name. I.E. for the above example, - the result for use as a constructor is "Outer::Inner::Inner" - and the result for use as a destructor is "Outer::Inner::~Inner". - -BUGS - - Numeric conversion is ASCII dependent (FIXME). - - */ - -static int -demangle_qualified (work, mangled, result, isfuncname, append) - struct work_stuff *work; - const char **mangled; - string *result; - int isfuncname; - int append; -{ - int qualifiers; - int namelength; - int success = 1; - const char *p; - char num[2]; - string temp; - - string_init (&temp); - switch ((*mangled)[1]) - { - case '_': - /* GNU mangled name with more than 9 classes. The count is preceded - by an underscore (to distinguish it from the <= 9 case) and followed - by an underscore. */ - p = *mangled + 2; - qualifiers = atoi (p); - if (!isdigit (*p) || *p == '0') - success = 0; - - /* Skip the digits. */ - while (isdigit (*p)) - ++p; - - if (*p != '_') - success = 0; - - *mangled = p + 1; - break; - - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - /* The count is in a single digit. */ - num[0] = (*mangled)[1]; - num[1] = '\0'; - qualifiers = atoi (num); - - /* If there is an underscore after the digit, skip it. This is - said to be for ARM-qualified names, but the ARM makes no - mention of such an underscore. Perhaps cfront uses one. */ - if ((*mangled)[2] == '_') - { - (*mangled)++; - } - (*mangled) += 2; - break; - - case '0': - default: - success = 0; - } - - if (!success) - return success; - - /* Pick off the names and collect them in the temp buffer in the order - in which they are found, separated by '::'. */ - - while (qualifiers-- > 0) - { - if (*mangled[0] == '_') - *mangled = *mangled + 1; - if (*mangled[0] == 't') - { - success = demangle_template(work, mangled, &temp, 0); - if (!success) break; - } - else - { - namelength = consume_count (mangled); - if (strlen (*mangled) < namelength) - { - /* Simple sanity check failed */ - success = 0; - break; - } - string_appendn (&temp, *mangled, namelength); - *mangled += namelength; - } - if (qualifiers > 0) - { - string_appendn (&temp, "::", 2); - } - } - - /* If we are using the result as a function name, we need to append - the appropriate '::' separated constructor or destructor name. - We do this here because this is the most convenient place, where - we already have a pointer to the name and the length of the name. */ - - if (isfuncname && (work->constructor & 1 || work->destructor & 1)) - { - string_appendn (&temp, "::", 2); - if (work -> destructor & 1) - { - string_append (&temp, "~"); - } - string_appendn (&temp, (*mangled) - namelength, namelength); - } - - /* Now either prepend the temp buffer to the result, or append it, - depending upon the state of the append flag. */ - - if (append) - { - string_appends (result, &temp); - } - else - { - if (!STRING_EMPTY (result)) - { - string_appendn (&temp, "::", 2); - } - string_prepends (result, &temp); - } - - string_delete (&temp); - return (success); -} - -/* - -LOCAL FUNCTION - - get_count -- convert an ascii count to integer, consuming tokens - -SYNOPSIS - - static int - get_count (const char **type, int *count) - -DESCRIPTION - - Return 0 if no conversion is performed, 1 if a string is converted. -*/ - -static int -get_count (type, count) - const char **type; - int *count; -{ - const char *p; - int n; - - if (!isdigit (**type)) - { - return (0); - } - else - { - *count = **type - '0'; - (*type)++; - if (isdigit (**type)) - { - p = *type; - n = *count; - do - { - n *= 10; - n += *p - '0'; - p++; - } - while (isdigit (*p)); - if (*p == '_') - { - *type = p + 1; - *count = n; - } - } - } - return (1); -} - -/* result will be initialised here; it will be freed on failure */ - -static int -do_type (work, mangled, result) - struct work_stuff *work; - const char **mangled; - string *result; -{ - int n; - int done; - int success; - string decl; - const char *remembered_type; - int constp; - int volatilep; - - string_init (&decl); - string_init (result); - - done = 0; - success = 1; - while (success && !done) - { - int member; - switch (**mangled) - { - - /* A pointer type */ - case 'P': - case 'p': - (*mangled)++; - string_prepend (&decl, "*"); - break; - - /* A reference type */ - case 'R': - (*mangled)++; - string_prepend (&decl, "&"); - break; - - /* An array */ - case 'A': - { - const char *p = ++(*mangled); - - string_prepend (&decl, "("); - string_append (&decl, ")["); - /* Copy anything up until the next underscore (the size of the - array). */ - while (**mangled && **mangled != '_') - ++(*mangled); - if (**mangled == '_') - { - string_appendn (&decl, p, *mangled - p); - string_append (&decl, "]"); - *mangled += 1; - } - else - success = 0; - break; - } - - /* A back reference to a previously seen type */ - case 'T': - (*mangled)++; - if (!get_count (mangled, &n) || n >= work -> ntypes) - { - success = 0; - } - else - { - remembered_type = work -> typevec[n]; - mangled = &remembered_type; - } - break; - - /* A function */ - case 'F': - (*mangled)++; - if (!STRING_EMPTY (&decl) && decl.b[0] == '*') - { - string_prepend (&decl, "("); - string_append (&decl, ")"); - } - /* After picking off the function args, we expect to either find the - function return type (preceded by an '_') or the end of the - string. */ - if (!demangle_args (work, mangled, &decl) - || (**mangled != '_' && **mangled != '\0')) - { - success = 0; - } - if (success && (**mangled == '_')) - { - (*mangled)++; - } - break; - - case 'M': - case 'O': - { - constp = 0; - volatilep = 0; - - member = **mangled == 'M'; - (*mangled)++; - if (!isdigit (**mangled)) - { - success = 0; - break; - } - n = consume_count (mangled); - if (strlen (*mangled) < n) - { - success = 0; - break; - } - string_append (&decl, ")"); - string_prepend (&decl, "::"); - string_prependn (&decl, *mangled, n); - string_prepend (&decl, "("); - *mangled += n; - if (member) - { - if (**mangled == 'C') - { - (*mangled)++; - constp = 1; - } - if (**mangled == 'V') - { - (*mangled)++; - volatilep = 1; - } - if (*(*mangled)++ != 'F') - { - success = 0; - break; - } - } - if ((member && !demangle_args (work, mangled, &decl)) - || **mangled != '_') - { - success = 0; - break; - } - (*mangled)++; - if (! PRINT_ANSI_QUALIFIERS) - { - break; - } - if (constp) - { - APPEND_BLANK (&decl); - string_append (&decl, "const"); - } - if (volatilep) - { - APPEND_BLANK (&decl); - string_append (&decl, "volatile"); - } - break; - } - case 'G': - (*mangled)++; - break; - - case 'C': - (*mangled)++; -/* - if ((*mangled)[1] == 'P') - { -*/ - if (PRINT_ANSI_QUALIFIERS) - { - if (!STRING_EMPTY (&decl)) - { - string_prepend (&decl, " "); - } - string_prepend (&decl, "const"); - } - break; -/* - } -*/ - - /* fall through */ - default: - done = 1; - break; - } - } - - switch (**mangled) - { - /* A qualified name, such as "Outer::Inner". */ - case 'Q': - success = demangle_qualified (work, mangled, result, 0, 1); - break; - - default: - success = demangle_fund_type (work, mangled, result); - break; - } - - if (success) - { - if (!STRING_EMPTY (&decl)) - { - string_append (result, " "); - string_appends (result, &decl); - } - } - else - { - string_delete (result); - } - string_delete (&decl); - return (success); -} - -/* Given a pointer to a type string that represents a fundamental type - argument (int, long, unsigned int, etc) in TYPE, a pointer to the - string in which the demangled output is being built in RESULT, and - the WORK structure, decode the types and add them to the result. - - For example: - - "Ci" => "const int" - "Sl" => "signed long" - "CUs" => "const unsigned short" - - */ - -static int -demangle_fund_type (work, mangled, result) - struct work_stuff *work; - const char **mangled; - string *result; -{ - int done = 0; - int success = 1; - - /* First pick off any type qualifiers. There can be more than one. */ - - while (!done) - { - switch (**mangled) - { - case 'C': - (*mangled)++; - if (PRINT_ANSI_QUALIFIERS) - { - APPEND_BLANK (result); - string_append (result, "const"); - } - break; - case 'U': - (*mangled)++; - APPEND_BLANK (result); - string_append (result, "unsigned"); - break; - case 'S': /* signed char only */ - (*mangled)++; - APPEND_BLANK (result); - string_append (result, "signed"); - break; - case 'V': - (*mangled)++; - if (PRINT_ANSI_QUALIFIERS) - { - APPEND_BLANK (result); - string_append (result, "volatile"); - } - break; - default: - done = 1; - break; - } - } - - /* Now pick off the fundamental type. There can be only one. */ - - switch (**mangled) - { - case '\0': - case '_': - break; - case 'v': - (*mangled)++; - APPEND_BLANK (result); - string_append (result, "void"); - break; - case 'x': - (*mangled)++; - APPEND_BLANK (result); - string_append (result, "long long"); - break; - case 'l': - (*mangled)++; - APPEND_BLANK (result); - string_append (result, "long"); - break; - case 'i': - (*mangled)++; - APPEND_BLANK (result); - string_append (result, "int"); - break; - case 's': - (*mangled)++; - APPEND_BLANK (result); - string_append (result, "short"); - break; - case 'b': - (*mangled)++; - APPEND_BLANK (result); - string_append (result, "bool"); - break; - case 'c': - (*mangled)++; - APPEND_BLANK (result); - string_append (result, "char"); - break; - case 'w': - (*mangled)++; - APPEND_BLANK (result); - string_append (result, "wchar_t"); - break; - case 'r': - (*mangled)++; - APPEND_BLANK (result); - string_append (result, "long double"); - break; - case 'd': - (*mangled)++; - APPEND_BLANK (result); - string_append (result, "double"); - break; - case 'f': - (*mangled)++; - APPEND_BLANK (result); - string_append (result, "float"); - break; - case 'G': - (*mangled)++; - if (!isdigit (**mangled)) - { - success = 0; - break; - } - /* fall through */ - /* An explicit type, such as "6mytype" or "7integer" */ - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - APPEND_BLANK (result); - if (!demangle_class_name (work, mangled, result)) { - --result->p; - success = 0; - } - break; - case 't': - success = demangle_template(work,mangled, result, 0); - break; - default: - success = 0; - break; - } - - return (success); -} - -/* `result' will be initialized in do_type; it will be freed on failure */ - -static int -do_arg (work, mangled, result) - struct work_stuff *work; - const char **mangled; - string *result; -{ - const char *start = *mangled; - - if (!do_type (work, mangled, result)) - { - return (0); - } - else - { - remember_type (work, start, *mangled - start); - return (1); - } -} - -static void -remember_type (work, start, len) - struct work_stuff *work; - const char *start; - int len; -{ - char *tem; - - if (work -> ntypes >= work -> typevec_size) - { - if (work -> typevec_size == 0) - { - work -> typevec_size = 3; - work -> typevec = - (char **) xmalloc (sizeof (char *) * work -> typevec_size); - } - else - { - work -> typevec_size *= 2; - work -> typevec = - (char **) xrealloc ((char *)work -> typevec, - sizeof (char *) * work -> typevec_size); - } - } - tem = xmalloc (len + 1); - memcpy (tem, start, len); - tem[len] = '\0'; - work -> typevec[work -> ntypes++] = tem; -} - -/* Forget the remembered types, but not the type vector itself. */ - -static void -forget_types (work) - struct work_stuff *work; -{ - int i; - - while (work -> ntypes > 0) - { - i = --(work -> ntypes); - if (work -> typevec[i] != NULL) - { - free (work -> typevec[i]); - work -> typevec[i] = NULL; - } - } -} - -/* Process the argument list part of the signature, after any class spec - has been consumed, as well as the first 'F' character (if any). For - example: - - "__als__3fooRT0" => process "RT0" - "complexfunc5__FPFPc_PFl_i" => process "PFPc_PFl_i" - - DECLP must be already initialised, usually non-empty. It won't be freed - on failure. - - Note that g++ differs significantly from ARM and lucid style mangling - with regards to references to previously seen types. For example, given - the source fragment: - - class foo { - public: - foo::foo (int, foo &ia, int, foo &ib, int, foo &ic); - }; - - foo::foo (int, foo &ia, int, foo &ib, int, foo &ic) { ia = ib = ic; } - void foo (int, foo &ia, int, foo &ib, int, foo &ic) { ia = ib = ic; } - - g++ produces the names: - - __3fooiRT0iT2iT2 - foo__FiR3fooiT1iT1 - - while lcc (and presumably other ARM style compilers as well) produces: - - foo__FiR3fooT1T2T1T2 - __ct__3fooFiR3fooT1T2T1T2 - - Note that g++ bases it's type numbers starting at zero and counts all - previously seen types, while lucid/ARM bases it's type numbers starting - at one and only considers types after it has seen the 'F' character - indicating the start of the function args. For lucid/ARM style, we - account for this difference by discarding any previously seen types when - we see the 'F' character, and subtracting one from the type number - reference. - - */ - -static int -demangle_args (work, mangled, declp) - struct work_stuff *work; - const char **mangled; - string *declp; -{ - string arg; - int need_comma = 0; - int r; - int t; - const char *tem; - char temptype; - - if (PRINT_ARG_TYPES) - { - string_append (declp, "("); - if (**mangled == '\0') - { - string_append (declp, "void"); - } - } - - while (**mangled != '_' && **mangled != '\0' && **mangled != 'e') - { - if ((**mangled == 'N') || (**mangled == 'T')) - { - temptype = *(*mangled)++; - - if (temptype == 'N') - { - if (!get_count (mangled, &r)) - { - return (0); - } - } - else - { - r = 1; - } - if (ARM_DEMANGLING && work -> ntypes >= 10) - { - /* If we have 10 or more types we might have more than a 1 digit - index so we'll have to consume the whole count here. This - will lose if the next thing is a type name preceded by a - count but it's impossible to demangle that case properly - anyway. Eg if we already have 12 types is T12Pc "(..., type1, - Pc, ...)" or "(..., type12, char *, ...)" */ - if ((t = consume_count(mangled)) == 0) - { - return (0); - } - } - else - { - if (!get_count (mangled, &t)) - { - return (0); - } - } - if (LUCID_DEMANGLING || ARM_DEMANGLING) - { - t--; - } - /* Validate the type index. Protect against illegal indices from - malformed type strings. */ - if ((t < 0) || (t >= work -> ntypes)) - { - return (0); - } - while (--r >= 0) - { - tem = work -> typevec[t]; - if (need_comma && PRINT_ARG_TYPES) - { - string_append (declp, ", "); - } - if (!do_arg (work, &tem, &arg)) - { - return (0); - } - if (PRINT_ARG_TYPES) - { - string_appends (declp, &arg); - } - string_delete (&arg); - need_comma = 1; - } - } - else - { - if (need_comma & PRINT_ARG_TYPES) - { - string_append (declp, ", "); - } - if (!do_arg (work, mangled, &arg)) - { - return (0); - } - if (PRINT_ARG_TYPES) - { - string_appends (declp, &arg); - } - string_delete (&arg); - need_comma = 1; - } - } - - if (**mangled == 'e') - { - (*mangled)++; - if (PRINT_ARG_TYPES) - { - if (need_comma) - { - string_append (declp, ","); - } - string_append (declp, "..."); - } - } - - if (PRINT_ARG_TYPES) - { - string_append (declp, ")"); - } - return (1); -} - -static void -demangle_function_name (work, mangled, declp, scan) - struct work_stuff *work; - const char **mangled; - string *declp; - const char *scan; -{ - int i; - int len; - string type; - const char *tem; - - string_appendn (declp, (*mangled), scan - (*mangled)); - string_need (declp, 1); - *(declp -> p) = '\0'; - - /* Consume the function name, including the "__" separating the name - from the signature. We are guaranteed that SCAN points to the - separator. */ - - (*mangled) = scan + 2; - - if (LUCID_DEMANGLING || ARM_DEMANGLING) - { - - /* See if we have an ARM style constructor or destructor operator. - If so, then just record it, clear the decl, and return. - We can't build the actual constructor/destructor decl until later, - when we recover the class name from the signature. */ - - if (strcmp (declp -> b, "__ct") == 0) - { - work -> constructor += 1; - string_clear (declp); - return; - } - else if (strcmp (declp -> b, "__dt") == 0) - { - work -> destructor += 1; - string_clear (declp); - return; - } - } - - if (declp->p - declp->b >= 3 - && declp->b[0] == 'o' - && declp->b[1] == 'p' - && strchr (cplus_markers, declp->b[2]) != NULL) - { - /* see if it's an assignment expression */ - if (declp->p - declp->b >= 10 /* op$assign_ */ - && memcmp (declp->b + 3, "assign_", 7) == 0) - { - for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++) - { - len = declp->p - declp->b - 10; - if (strlen (optable[i].in) == len - && memcmp (optable[i].in, declp->b + 10, len) == 0) - { - string_clear (declp); - string_append (declp, "operator"); - string_append (declp, optable[i].out); - string_append (declp, "="); - break; - } - } - } - else - { - for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++) - { - int len = declp->p - declp->b - 3; - if (strlen (optable[i].in) == len - && memcmp (optable[i].in, declp->b + 3, len) == 0) - { - string_clear (declp); - string_append (declp, "operator"); - string_append (declp, optable[i].out); - break; - } - } - } - } - else if (declp->p - declp->b >= 5 && memcmp (declp->b, "type", 4) == 0 - && strchr (cplus_markers, declp->b[4]) != NULL) - { - /* type conversion operator */ - tem = declp->b + 5; - if (do_type (work, &tem, &type)) - { - string_clear (declp); - string_append (declp, "operator "); - string_appends (declp, &type); - string_delete (&type); - } - } - else if (declp->b[0] == '_' && declp->b[1] == '_' - && declp->b[2] == 'o' && declp->b[3] == 'p') - { - /* ANSI. */ - /* type conversion operator. */ - tem = declp->b + 4; - if (do_type (work, &tem, &type)) - { - string_clear (declp); - string_append (declp, "operator "); - string_appends (declp, &type); - string_delete (&type); - } - } - else if (declp->b[0] == '_' && declp->b[1] == '_' - && declp->b[2] >= 'a' && declp->b[2] <= 'z' - && declp->b[3] >= 'a' && declp->b[3] <= 'z') - { - if (declp->b[4] == '\0') - { - /* Operator. */ - for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++) - { - if (strlen (optable[i].in) == 2 - && memcmp (optable[i].in, declp->b + 2, 2) == 0) - { - string_clear (declp); - string_append (declp, "operator"); - string_append (declp, optable[i].out); - break; - } - } - } - else - { - if (declp->b[2] == 'a' && declp->b[5] == '\0') - { - /* Assignment. */ - for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++) - { - if (strlen (optable[i].in) == 3 - && memcmp (optable[i].in, declp->b + 2, 3) == 0) - { - string_clear (declp); - string_append (declp, "operator"); - string_append (declp, optable[i].out); - break; - } - } - } - } - } -} - -/* a mini string-handling package */ - -static void -string_need (s, n) - string *s; - int n; -{ - int tem; - - if (s->b == NULL) - { - if (n < 32) - { - n = 32; - } - s->p = s->b = xmalloc (n); - s->e = s->b + n; - } - else if (s->e - s->p < n) - { - tem = s->p - s->b; - n += tem; - n *= 2; - s->b = xrealloc (s->b, n); - s->p = s->b + tem; - s->e = s->b + n; - } -} - -static void -string_delete (s) - string *s; -{ - if (s->b != NULL) - { - free (s->b); - s->b = s->e = s->p = NULL; - } -} - -static void -string_init (s) - string *s; -{ - s->b = s->p = s->e = NULL; -} - -static void -string_clear (s) - string *s; -{ - s->p = s->b; -} - -#if 0 - -static int -string_empty (s) - string *s; -{ - return (s->b == s->p); -} - -#endif - -static void -string_append (p, s) - string *p; - const char *s; -{ - int n; - if (s == NULL || *s == '\0') - return; - n = strlen (s); - string_need (p, n); - memcpy (p->p, s, n); - p->p += n; -} - -static void -string_appends (p, s) - string *p, *s; -{ - int n; - - if (s->b != s->p) - { - n = s->p - s->b; - string_need (p, n); - memcpy (p->p, s->b, n); - p->p += n; - } -} - -static void -string_appendn (p, s, n) - string *p; - const char *s; - int n; -{ - if (n != 0) - { - string_need (p, n); - memcpy (p->p, s, n); - p->p += n; - } -} - -static void -string_prepend (p, s) - string *p; - const char *s; -{ - if (s != NULL && *s != '\0') - { - string_prependn (p, s, strlen (s)); - } -} - -static void -string_prepends (p, s) - string *p, *s; -{ - if (s->b != s->p) - { - string_prependn (p, s->b, s->p - s->b); - } -} - -static void -string_prependn (p, s, n) - string *p; - const char *s; - int n; -{ - char *q; - - if (n != 0) - { - string_need (p, n); - for (q = p->p - 1; q >= p->b; q--) - { - q[n] = q[0]; - } - memcpy (p->b, s, n); - p->p += n; - } -} - -/* To generate a standalone demangler program for testing purposes, - just compile and link this file with -DMAIN and libiberty.a. When - run, it demangles each command line arg, or each stdin string, and - prints the result on stdout. */ - -#ifdef MAIN - -static void -demangle_it (mangled_name) - char *mangled_name; -{ - char *result; - - result = cplus_demangle (mangled_name, DMGL_PARAMS | DMGL_ANSI); - if (result == NULL) - { - printf ("%s\n", mangled_name); - } - else - { - printf ("%s\n", result); - free (result); - } -} - -#include "getopt.h" - -static char *program_name; -static char *program_version = VERSION; - -static void -usage (stream, status) - FILE *stream; - int status; -{ - fprintf (stream, "\ -Usage: %s [-_] [-n] [-s {gnu,lucid,arm}] [--strip-underscores]\n\ - [--no-strip-underscores] [--format={gnu,lucid,arm}]\n\ - [--help] [--version] [arg...]\n", - program_name); - exit (status); -} - -#define MBUF_SIZE 512 -char mbuffer[MBUF_SIZE]; - -/* Defined in the automatically-generated underscore.c. */ -extern int prepends_underscore; - -int strip_underscore = 0; - -static struct option long_options[] = { - {"strip-underscores", no_argument, 0, '_'}, - {"format", required_argument, 0, 's'}, - {"help", no_argument, 0, 'h'}, - {"no-strip-underscores", no_argument, 0, 'n'}, - {"version", no_argument, 0, 'v'}, - {0, no_argument, 0, 0} -}; - -int -main (argc, argv) - int argc; - char **argv; -{ - char *result; - int c; - - program_name = argv[0]; - - strip_underscore = prepends_underscore; - - while ((c = getopt_long (argc, argv, "_ns:", long_options, (int *) 0)) != EOF) - { - switch (c) - { - case '?': - usage (stderr, 1); - break; - case 'h': - usage (stdout, 0); - case 'n': - strip_underscore = 0; - break; - case 'v': - printf ("GNU %s version %s\n", program_name, program_version); - exit (0); - case '_': - strip_underscore = 1; - break; - case 's': - if (strcmp (optarg, "gnu") == 0) - { - current_demangling_style = gnu_demangling; - } - else if (strcmp (optarg, "lucid") == 0) - { - current_demangling_style = lucid_demangling; - } - else if (strcmp (optarg, "arm") == 0) - { - current_demangling_style = arm_demangling; - } - else - { - fprintf (stderr, "%s: unknown demangling style `%s'\n", - program_name, optarg); - exit (1); - } - break; - } - } - - if (optind < argc) - { - for ( ; optind < argc; optind++) - { - demangle_it (argv[optind]); - } - } - else - { - for (;;) - { - int i = 0; - c = getchar (); - /* Try to read a label. */ - while (c != EOF && (isalnum(c) || c == '_' || c == '$' || c == '.')) - { - if (i >= MBUF_SIZE-1) - break; - mbuffer[i++] = c; - c = getchar (); - } - if (i > 0) - { - int skip_first = 0; - - if (mbuffer[0] == '.') - ++skip_first; - if (strip_underscore && mbuffer[skip_first] == '_') - ++skip_first; - - if (skip_first > i) - skip_first = i; - - mbuffer[i] = 0; - - result = cplus_demangle (mbuffer + skip_first, - DMGL_PARAMS | DMGL_ANSI); - if (result) - { - if (mbuffer[0] == '.') - putc ('.', stdout); - fputs (result, stdout); - free (result); - } - else - fputs (mbuffer, stdout); - - fflush (stdout); - } - if (c == EOF) - break; - putchar (c); - } - } - - exit (0); -} - -static void -fatal (str) - char *str; -{ - fprintf (stderr, "%s: %s\n", program_name, str); - exit (1); -} - -char * malloc (); -char * realloc (); - -char * -xmalloc (size) - unsigned size; -{ - register char *value = (char *) malloc (size); - if (value == 0) - fatal ("virtual memory exhausted"); - return value; -} - -char * -xrealloc (ptr, size) - char *ptr; - unsigned size; -{ - register char *value = (char *) realloc (ptr, size); - if (value == 0) - fatal ("virtual memory exhausted"); - return value; -} -#endif /* main */ diff --git a/contrib/gdb/libiberty/dummy.c b/contrib/gdb/libiberty/dummy.c deleted file mode 100644 index 08da647..0000000 --- a/contrib/gdb/libiberty/dummy.c +++ /dev/null @@ -1,49 +0,0 @@ -#include - -#ifdef __STDC__ -#include -#define clock_t unsigned long -#define DEF(NAME, RETURN_TYPE, ARGLIST, ARGS) extern RETURN_TYPE NAME (ARGS); -#define DEFFUNC(NAME, RETURN_TYPE, ARGLIST, ARGS) extern RETURN_TYPE NAME (ARGS); -#else -#define void int -#define size_t unsigned long -#define clock_t unsigned long -#define DEF(NAME, RETURN_TYPE, ARGLIST, ARGS) extern RETURN_TYPE NAME (); -#define DEFFUNC(NAME, RETURN_TYPE, ARGLIST, ARGS) extern RETURN_TYPE NAME (); -#endif - -#define DEFVAR(NAME,DECL,USE) extern DECL; - -#define NOTHING /*nothing*/ - -#include "alloca-conf.h" -#include "functions.def" - -/* Always use our: getopt.o getopt1.o obstack.o spaces.o */ - -int -main (argc, argv) - int argc; char **argv; -{ - -/* Create a dummy function call for each DEF-defined function. */ - -#undef DEF -#undef DEFVAR -#undef DEFFUNC -#undef AND -#define AND = 0; -/* ARGS expands into a set of declaration. NAME ARG_LIST expands - info a function call that uses those variables as actual parameters. - If the function has been DEF'ed correctly, we can pass the right - number and types of parameters, which is nice. (E.g. gcc may - otherwise complain about the wrong number of parameters to certain - builtins.) */ -#define DEF(NAME, RETURN_TYPE, ARG_LIST, ARGS) { ARGS; NAME ARG_LIST; } -#define DEFVAR(NAME, DECL, USE) { USE; } -#define DEFFUNC(NAME, RETURN_TYPE, ARG_LIST, ARGS) { ARGS; NAME ARG_LIST; } -#include "functions.def" - - return (0); -} diff --git a/contrib/gdb/libiberty/fdmatch.c b/contrib/gdb/libiberty/fdmatch.c deleted file mode 100644 index 7af039f..0000000 --- a/contrib/gdb/libiberty/fdmatch.c +++ /dev/null @@ -1,73 +0,0 @@ -/* Compare two open file descriptors to see if they refer to the same file. - Copyright (C) 1991 Free Software Foundation, Inc. - -This file is part of the libiberty library. -Libiberty is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public -License as published by the Free Software Foundation; either -version 2 of the License, or (at your option) any later version. - -Libiberty 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 -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with libiberty; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - - -/* - -NAME - - fdmatch -- see if two file descriptors refer to same file - -SYNOPSIS - - int fdmatch (int fd1, int fd2) - -DESCRIPTION - - Check to see if two open file descriptors refer to the same file. - This is useful, for example, when we have an open file descriptor - for an unnamed file, and the name of a file that we believe to - correspond to that fd. This can happen when we are exec'd with - an already open file (stdout for example) or from the SVR4 /proc - calls that return open file descriptors for mapped address spaces. - All we have to do is open the file by name and check the two file - descriptors for a match, which is done by comparing major&minor - device numbers and inode numbers. - -BUGS - - (FIXME: does this work for networks?) - It works for NFS, which assigns a device number to each mount. - -*/ - -#include "ansidecl.h" -#include "libiberty.h" -#include -#include - -int fdmatch (fd1, fd2) - int fd1; - int fd2; -{ - struct stat sbuf1; - struct stat sbuf2; - - if ((fstat (fd1, &sbuf1) == 0) && - (fstat (fd2, &sbuf2) == 0) && - (sbuf1.st_dev == sbuf2.st_dev) && - (sbuf1.st_ino == sbuf2.st_ino)) - { - return (1); - } - else - { - return (0); - } -} diff --git a/contrib/gdb/libiberty/floatformat.c b/contrib/gdb/libiberty/floatformat.c deleted file mode 100644 index 655f4ea..0000000 --- a/contrib/gdb/libiberty/floatformat.c +++ /dev/null @@ -1,385 +0,0 @@ -/* IEEE floating point support routines, for GDB, the GNU Debugger. - Copyright (C) 1991, 1994 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#include "floatformat.h" -#include /* ldexp */ -#ifdef __STDC__ -#include -extern void *memcpy (void *s1, const void *s2, size_t n); -extern void *memset (void *s, int c, size_t n); -#else -extern char *memcpy (); -extern char *memset (); -#endif - -/* The odds that CHAR_BIT will be anything but 8 are low enough that I'm not - going to bother with trying to muck around with whether it is defined in - a system header, what we do if not, etc. */ -#define FLOATFORMAT_CHAR_BIT 8 - -/* floatformats for IEEE single and double, big and little endian. */ -const struct floatformat floatformat_ieee_single_big = -{ - floatformat_big, 32, 0, 1, 8, 127, 255, 9, 23, floatformat_intbit_no -}; -const struct floatformat floatformat_ieee_single_little = -{ - floatformat_little, 32, 0, 1, 8, 127, 255, 9, 23, floatformat_intbit_no -}; -const struct floatformat floatformat_ieee_double_big = -{ - floatformat_big, 64, 0, 1, 11, 1023, 2047, 12, 52, floatformat_intbit_no -}; -const struct floatformat floatformat_ieee_double_little = -{ - floatformat_little, 64, 0, 1, 11, 1023, 2047, 12, 52, floatformat_intbit_no -}; - -const struct floatformat floatformat_i387_ext = -{ - floatformat_little, 80, 0, 1, 15, 0x3fff, 0x7fff, 16, 64, - floatformat_intbit_yes -}; -const struct floatformat floatformat_m68881_ext = -{ - /* Note that the bits from 16 to 31 are unused. */ - floatformat_big, 96, 0, 1, 15, 0x3fff, 0x7fff, 32, 64, floatformat_intbit_yes -}; -const struct floatformat floatformat_i960_ext = -{ - /* Note that the bits from 0 to 15 are unused. */ - floatformat_little, 96, 16, 17, 15, 0x3fff, 0x7fff, 32, 64, - floatformat_intbit_yes -}; -const struct floatformat floatformat_m88110_ext = -{ -#ifdef HARRIS_FLOAT_FORMAT - /* Harris uses raw format 128 bytes long, but the number is just an ieee - double, and the last 64 bits are wasted. */ - floatformat_big,128, 0, 1, 11, 0x3ff, 0x7ff, 12, 52, - floatformat_intbit_no -#else - floatformat_big, 80, 0, 1, 15, 0x3fff, 0x7fff, 16, 64, - floatformat_intbit_yes -#endif /* HARRIS_FLOAT_FORMAT */ -}; -const struct floatformat floatformat_arm_ext = -{ - /* Bits 1 to 16 are unused. */ - floatformat_big, 96, 0, 17, 15, 0x3fff, 0x7fff, 32, 64, - floatformat_intbit_yes -}; - -static unsigned long get_field PARAMS ((unsigned char *, - enum floatformat_byteorders, - unsigned int, - unsigned int, - unsigned int)); - -/* Extract a field which starts at START and is LEN bytes long. DATA and - TOTAL_LEN are the thing we are extracting it from, in byteorder ORDER. */ -static unsigned long -get_field (data, order, total_len, start, len) - unsigned char *data; - enum floatformat_byteorders order; - unsigned int total_len; - unsigned int start; - unsigned int len; -{ - unsigned long result; - unsigned int cur_byte; - int cur_bitshift; - - /* Start at the least significant part of the field. */ - cur_byte = (start + len) / FLOATFORMAT_CHAR_BIT; - if (order == floatformat_little) - cur_byte = (total_len / FLOATFORMAT_CHAR_BIT) - cur_byte - 1; - cur_bitshift = - ((start + len) % FLOATFORMAT_CHAR_BIT) - FLOATFORMAT_CHAR_BIT; - result = *(data + cur_byte) >> (-cur_bitshift); - cur_bitshift += FLOATFORMAT_CHAR_BIT; - if (order == floatformat_little) - ++cur_byte; - else - --cur_byte; - - /* Move towards the most significant part of the field. */ - while (cur_bitshift < len) - { - if (len - cur_bitshift < FLOATFORMAT_CHAR_BIT) - /* This is the last byte; zero out the bits which are not part of - this field. */ - result |= - (*(data + cur_byte) & ((1 << (len - cur_bitshift)) - 1)) - << cur_bitshift; - else - result |= *(data + cur_byte) << cur_bitshift; - cur_bitshift += FLOATFORMAT_CHAR_BIT; - if (order == floatformat_little) - ++cur_byte; - else - --cur_byte; - } - return result; -} - -/* Convert from FMT to a double. - FROM is the address of the extended float. - Store the double in *TO. */ - -void -floatformat_to_double (fmt, from, to) - const struct floatformat *fmt; - char *from; - double *to; -{ - unsigned char *ufrom = (unsigned char *)from; - double dto; - long exponent; - unsigned long mant; - unsigned int mant_bits, mant_off; - int mant_bits_left; - - exponent = get_field (ufrom, fmt->byteorder, fmt->totalsize, - fmt->exp_start, fmt->exp_len); - /* Note that if exponent indicates a NaN, we can't really do anything useful - (not knowing if the host has NaN's, or how to build one). So it will - end up as an infinity or something close; that is OK. */ - - mant_bits_left = fmt->man_len; - mant_off = fmt->man_start; - dto = 0.0; - exponent -= fmt->exp_bias; - - /* Build the result algebraically. Might go infinite, underflow, etc; - who cares. */ - while (mant_bits_left > 0) - { - int exp_bits; - exp_bits = mant_bits_left < 32 ? mant_bits_left : 32; - if (mant_bits_left == fmt->man_len - && exp_bits == 32 - && fmt->intbit == floatformat_intbit_no) - { - /* If there is no integer bit, we need to get only 31 bits - so we have room for an integer bit that we create. */ - mant_bits = 31; - } - else - mant_bits = exp_bits; - - mant = get_field (ufrom, fmt->byteorder, fmt->totalsize, - mant_off, mant_bits); - if (mant_bits_left == fmt->man_len) - mant |= 0x80000000; - dto += ldexp ((double)mant, exponent - (exp_bits - 1)); - exponent -= exp_bits; - mant_off += mant_bits; - mant_bits_left -= mant_bits; - } - - /* Negate it if negative. */ - if (get_field (ufrom, fmt->byteorder, fmt->totalsize, fmt->sign_start, 1)) - dto = -dto; - memcpy (to, &dto, sizeof (dto)); -} - -static void put_field PARAMS ((unsigned char *, enum floatformat_byteorders, - unsigned int, - unsigned int, - unsigned int, - unsigned long)); - -/* Set a field which starts at START and is LEN bytes long. DATA and - TOTAL_LEN are the thing we are extracting it from, in byteorder ORDER. */ -static void -put_field (data, order, total_len, start, len, stuff_to_put) - unsigned char *data; - enum floatformat_byteorders order; - unsigned int total_len; - unsigned int start; - unsigned int len; - unsigned long stuff_to_put; -{ - unsigned int cur_byte; - int cur_bitshift; - - /* Start at the least significant part of the field. */ - cur_byte = (start + len) / FLOATFORMAT_CHAR_BIT; - if (order == floatformat_little) - cur_byte = (total_len / FLOATFORMAT_CHAR_BIT) - cur_byte - 1; - cur_bitshift = - ((start + len) % FLOATFORMAT_CHAR_BIT) - FLOATFORMAT_CHAR_BIT; - *(data + cur_byte) &= - ~(((1 << ((start + len) % FLOATFORMAT_CHAR_BIT)) - 1) << (-cur_bitshift)); - *(data + cur_byte) |= - (stuff_to_put & ((1 << FLOATFORMAT_CHAR_BIT) - 1)) << (-cur_bitshift); - cur_bitshift += FLOATFORMAT_CHAR_BIT; - if (order == floatformat_little) - ++cur_byte; - else - --cur_byte; - - /* Move towards the most significant part of the field. */ - while (cur_bitshift < len) - { - if (len - cur_bitshift < FLOATFORMAT_CHAR_BIT) - { - /* This is the last byte. */ - *(data + cur_byte) &= - ~((1 << (len - cur_bitshift)) - 1); - *(data + cur_byte) |= (stuff_to_put >> cur_bitshift); - } - else - *(data + cur_byte) = ((stuff_to_put >> cur_bitshift) - & ((1 << FLOATFORMAT_CHAR_BIT) - 1)); - cur_bitshift += FLOATFORMAT_CHAR_BIT; - if (order == floatformat_little) - ++cur_byte; - else - --cur_byte; - } -} - -/* The converse: convert the double *FROM to an extended float - and store where TO points. Neither FROM nor TO have any alignment - restrictions. */ - -void -floatformat_from_double (fmt, from, to) - CONST struct floatformat *fmt; - double *from; - char *to; -{ - double dfrom; - int exponent; - double mant; - unsigned int mant_bits, mant_off; - int mant_bits_left; - unsigned char *uto = (unsigned char *)to; - - memcpy (&dfrom, from, sizeof (dfrom)); - memset (uto, 0, fmt->totalsize / FLOATFORMAT_CHAR_BIT); - if (dfrom == 0) - return; /* Result is zero */ - if (dfrom != dfrom) - { - /* From is NaN */ - put_field (uto, fmt->byteorder, fmt->totalsize, fmt->exp_start, - fmt->exp_len, fmt->exp_nan); - /* Be sure it's not infinity, but NaN value is irrel */ - put_field (uto, fmt->byteorder, fmt->totalsize, fmt->man_start, - 32, 1); - return; - } - - /* If negative, set the sign bit. */ - if (dfrom < 0) - { - put_field (uto, fmt->byteorder, fmt->totalsize, fmt->sign_start, 1, 1); - dfrom = -dfrom; - } - - /* How to tell an infinity from an ordinary number? FIXME-someday */ - - mant = frexp (dfrom, &exponent); - put_field (uto, fmt->byteorder, fmt->totalsize, fmt->exp_start, fmt->exp_len, - exponent + fmt->exp_bias - 1); - - mant_bits_left = fmt->man_len; - mant_off = fmt->man_start; - while (mant_bits_left > 0) - { - unsigned long mant_long; - mant_bits = mant_bits_left < 32 ? mant_bits_left : 32; - - mant *= 4294967296.0; - mant_long = (unsigned long)mant; - mant -= mant_long; - - /* If the integer bit is implicit, then we need to discard it. - If we are discarding a zero, we should be (but are not) creating - a denormalized number which means adjusting the exponent - (I think). */ - if (mant_bits_left == fmt->man_len - && fmt->intbit == floatformat_intbit_no) - { - mant_long &= 0x7fffffff; - mant_bits -= 1; - } - else if (mant_bits < 32) - { - /* The bits we want are in the most significant MANT_BITS bits of - mant_long. Move them to the least significant. */ - mant_long >>= 32 - mant_bits; - } - - put_field (uto, fmt->byteorder, fmt->totalsize, - mant_off, mant_bits, mant_long); - mant_off += mant_bits; - mant_bits_left -= mant_bits; - } -} - - -#ifdef IEEE_DEBUG - -/* This is to be run on a host which uses IEEE floating point. */ - -void -ieee_test (n) - double n; -{ - double result; - char exten[16]; - - floatformat_to_double (&floatformat_ieee_double_big, &n, &result); - if (n != result) - printf ("Differ(to): %.20g -> %.20g\n", n, result); - floatformat_from_double (&floatformat_ieee_double_big, &n, &result); - if (n != result) - printf ("Differ(from): %.20g -> %.20g\n", n, result); - - floatformat_from_double (&floatformat_m68881_ext, &n, exten); - floatformat_to_double (&floatformat_m68881_ext, exten, &result); - if (n != result) - printf ("Differ(to+from): %.20g -> %.20g\n", n, result); - -#if IEEE_DEBUG > 1 - /* This is to be run on a host which uses 68881 format. */ - { - long double ex = *(long double *)exten; - if (ex != n) - printf ("Differ(from vs. extended): %.20g\n", n); - } -#endif -} - -int -main () -{ - ieee_test (0.5); - ieee_test (256.0); - ieee_test (0.12345); - ieee_test (234235.78907234); - ieee_test (-512.0); - ieee_test (-0.004321); - return 0; -} -#endif diff --git a/contrib/gdb/libiberty/functions.def b/contrib/gdb/libiberty/functions.def deleted file mode 100644 index 8becc89..0000000 --- a/contrib/gdb/libiberty/functions.def +++ /dev/null @@ -1,67 +0,0 @@ -/* - * List of function definitions that may *optionally* be included - * in libiberty.a. The function names must match the filenames, - * e.g. bzero() is defined in bzero.c. (While each file can contain - * extra functions, do not list them.) - * - * In the default libiberty configuration, these object files - * (e.g bzero.o) are included if and only if cc fails to find - * the corresponding function in libc. - */ - -DEF(atexit, int, (f), void (*f)()) -DEF(bcmp, int, (s1, s2, length), char *s1 AND char *s2 AND int length ) -DEF(bcopy, void, (s1, s2, length), char *s1 AND char *s2 AND int length ) -DEF(bzero, void, (s, length), char *s AND int length) -DEF(clock, clock_t, (), NOTHING) -DEF(getopt, int, (argc, argv, optstring), - int argc AND char **argv AND CONST char *optstring) -DEF(getpagesize, int , (), NOTHING) -DEF(getcwd, char*, (buf, len), char *buf AND int len) -DEF(index, char*, (s, c), char *s AND int c) -DEF(insque, void, (), NOTHING) -DEF(memchr, PTR, (s, c, length), CONST PTR s AND int c AND size_t length) -DEF(memcmp, int, (s1, s2, length), - CONST PTR s1 AND CONST PTR s2 AND size_t length) -DEF(memcpy, PTR, (s1, s2, length), PTR s1 AND CONST PTR s2 AND size_t length) -DEF(memmove, PTR, (s1, s2, length), PTR s1 AND CONST PTR s2 AND size_t length) -DEF(memset, PTR, (s, val, length), PTR s AND int val AND size_t length ) -DEF(random, long int, (), NOTHING) -DEF(rename, int, (f, t), char *f AND char *t) -DEF(rindex, char*, (s, c), char *s AND int c) -DEF(strcasecmp, int, (s1, s2), char *s1 AND char *s2) -DEF(strncasecmp, int, (s1, s2, n), char *s1 AND char *s2 AND int n) -DEF(strchr, char*, (s, c), CONST char *s AND int c) -DEF(strdup, char*, (s1), char * s1) -DEF(strrchr, char*, (s, c), CONST char *s AND int c) -DEF(strstr, char*, (), NOTHING) -DEF(strtod, double, (), NOTHING) -DEF(strtol, long, (), NOTHING) -DEF(strtoul, unsigned long, (), NOTHING) -DEF(tmpnam, char *, (s), char * s) -DEF(vfork, int, (), NOTHING) -DEF(vfprintf, int, (), NOTHING) -DEF(vprintf, int, (), NOTHING) -DEF(vsprintf, int, (), NOTHING) -DEF(sigsetmask, int, (), NOTHING) -DEF(alloca, PTR, (size), size_t size) -DEF(waitpid, int, (pid, statp, opts), int pid AND int* statp AND int opts ) - -/* List of global variables that we want to look for in the host - environment, and to generate an entry NEED_ in config.h - if they are not found. The first arg is the variable name, the - second arg is how to declare the variable, and the third is how to - use it. */ - -DEFVAR(sys_nerr, int sys_nerr, sys_nerr = 0) -DEFVAR(sys_errlist, char *sys_errlist[], sys_errlist[0] = 0) -DEFVAR(sys_siglist, char *sys_siglist[], sys_siglist[0] = 0) - -/* List of global functions that we want to look for in the host - environment, and to generate an entry NEED_ in config.h - if they are not found. */ - -DEFFUNC(strerror, char*, (), NOTHING) -DEFFUNC(psignal, void, (signo, message), unsigned signo AND char *message) -DEFFUNC(basename, char *, (name), CONST char *name) -DEFFUNC(on_exit, void, (f, arg), void (*f)() AND char *arg) diff --git a/contrib/gdb/libiberty/getcwd.c b/contrib/gdb/libiberty/getcwd.c deleted file mode 100644 index 60c1dd8..0000000 --- a/contrib/gdb/libiberty/getcwd.c +++ /dev/null @@ -1,52 +0,0 @@ -/* Emulate getcwd using getwd. - This function is in the public domain. */ - -/* -NAME - getcwd -- get absolute pathname for current working directory - -SYNOPSIS - char *getcwd (char pathname[len], len) - -DESCRIPTION - Copy the absolute pathname for the current working directory into - the supplied buffer and return a pointer to the buffer. If the - current directory's path doesn't fit in LEN characters, the result - is NULL and errno is set. - -BUGS - Emulated via the getwd() call, which is reasonable for most - systems that do not have getcwd(). - -*/ - -#ifndef NO_SYS_PARAM_H -#include -#endif -#include - -extern char *getwd (); -extern int errno; - -#ifndef MAXPATHLEN -#define MAXPATHLEN 1024 -#endif - -char * -getcwd (buf, len) - char *buf; - int len; -{ - char ourbuf[MAXPATHLEN]; - char *result; - - result = getwd (ourbuf); - if (result) { - if (strlen (ourbuf) >= len) { - errno = ERANGE; - return 0; - } - strcpy (buf, ourbuf); - } - return buf; -} diff --git a/contrib/gdb/libiberty/getopt.c b/contrib/gdb/libiberty/getopt.c deleted file mode 100644 index 458dca2..0000000 --- a/contrib/gdb/libiberty/getopt.c +++ /dev/null @@ -1,757 +0,0 @@ -/* Getopt for GNU. - NOTE: getopt is now part of the C library, so if you don't know what - "Keep this file name-space clean" means, talk to roland@gnu.ai.mit.edu - before changing it! - - Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95 - Free Software Foundation, Inc. - -This file is part of the libiberty library. This library 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 library 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 GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ - -/* This tells Alpha OSF/1 not to define a getopt prototype in . - Ditto for AIX 3.2 and . */ -#ifndef _NO_PROTO -#define _NO_PROTO -#endif - -#ifdef HAVE_CONFIG_H -#if defined (emacs) || defined (CONFIG_BROKETS) -/* We use instead of "config.h" so that a compilation - using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h - (which it would do because it found this file in $srcdir). */ -#include -#else -#include "config.h" -#endif -#endif - -#ifndef __STDC__ -/* This is a separate conditional since some stdc systems - reject `defined (const)'. */ -#ifndef const -#define const -#endif -#endif - -#include - -/* Comment out all this code if we are using the GNU C Library, and are not - actually compiling the library itself. This code is part of the GNU C - Library, but also included in many other GNU distributions. Compiling - and linking in this code is a waste when using the GNU C library - (especially if it is a shared library). Rather than having every GNU - program understand `configure --with-gnu-libc' and omit the object files, - it is simpler to just do this in the source for each such file. */ -/* Many versions of the Linux C library include older, broken versions - of these routines, which will break the linker's command-line - parsing. */ - -#if defined (_LIBC) || !defined (__GNU_LIBRARY__) || defined (__linux__) - - -/* This needs to come after some library #include - to get __GNU_LIBRARY__ defined. */ -#ifdef __GNU_LIBRARY__ -/* Don't include stdlib.h for non-GNU C libraries because some of them - contain conflicting prototypes for getopt. */ -#include -#endif /* GNU C library. */ - -/* This version of `getopt' appears to the caller like standard Unix `getopt' - but it behaves differently for the user, since it allows the user - to intersperse the options with the other arguments. - - As `getopt' works, it permutes the elements of ARGV so that, - when it is done, all the options precede everything else. Thus - all application programs are extended to handle flexible argument order. - - Setting the environment variable POSIXLY_CORRECT disables permutation. - Then the behavior is completely standard. - - GNU application programs can use a third alternative mode in which - they can distinguish the relative order of options and other arguments. */ - -#include "getopt.h" - -/* For communication from `getopt' to the caller. - When `getopt' finds an option that takes an argument, - the argument value is returned here. - Also, when `ordering' is RETURN_IN_ORDER, - each non-option ARGV-element is returned here. */ - -char *optarg = NULL; - -/* Index in ARGV of the next element to be scanned. - This is used for communication to and from the caller - and for communication between successive calls to `getopt'. - - On entry to `getopt', zero means this is the first call; initialize. - - When `getopt' returns EOF, this is the index of the first of the - non-option elements that the caller should itself scan. - - Otherwise, `optind' communicates from one call to the next - how much of ARGV has been scanned so far. */ - -/* XXX 1003.2 says this must be 1 before any call. */ -int optind = 0; - -/* The next char to be scanned in the option-element - in which the last option character we returned was found. - This allows us to pick up the scan where we left off. - - If this is zero, or a null string, it means resume the scan - by advancing to the next ARGV-element. */ - -static char *nextchar; - -/* Callers store zero here to inhibit the error message - for unrecognized options. */ - -int opterr = 1; - -/* Set to an option character which was unrecognized. - This must be initialized on some systems to avoid linking in the - system's own getopt implementation. */ - -int optopt = '?'; - -/* Describe how to deal with options that follow non-option ARGV-elements. - - If the caller did not specify anything, - the default is REQUIRE_ORDER if the environment variable - POSIXLY_CORRECT is defined, PERMUTE otherwise. - - REQUIRE_ORDER means don't recognize them as options; - stop option processing when the first non-option is seen. - This is what Unix does. - This mode of operation is selected by either setting the environment - variable POSIXLY_CORRECT, or using `+' as the first character - of the list of option characters. - - PERMUTE is the default. We permute the contents of ARGV as we scan, - so that eventually all the non-options are at the end. This allows options - to be given in any order, even with programs that were not written to - expect this. - - RETURN_IN_ORDER is an option available to programs that were written - to expect options and other ARGV-elements in any order and that care about - the ordering of the two. We describe each non-option ARGV-element - as if it were the argument of an option with character code 1. - Using `-' as the first character of the list of option characters - selects this mode of operation. - - The special argument `--' forces an end of option-scanning regardless - of the value of `ordering'. In the case of RETURN_IN_ORDER, only - `--' can cause `getopt' to return EOF with `optind' != ARGC. */ - -static enum -{ - REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER -} ordering; - -#ifdef __GNU_LIBRARY__ -/* We want to avoid inclusion of string.h with non-GNU libraries - because there are many ways it can cause trouble. - On some systems, it contains special magic macros that don't work - in GCC. */ -#include -#define my_index strchr -#else - -/* Avoid depending on library functions or files - whose names are inconsistent. */ - -char *getenv (); - -static char * -my_index (str, chr) - const char *str; - int chr; -{ - while (*str) - { - if (*str == chr) - return (char *) str; - str++; - } - return 0; -} - -/* If using GCC, we can safely declare strlen this way. - If not using GCC, it is ok not to declare it. */ -#ifdef __GNUC__ -/* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h. - That was relevant to code that was here before. */ -#ifndef __STDC__ -/* gcc with -traditional declares the built-in strlen to return int, - and has done so at least since version 2.4.5. -- rms. */ -extern int strlen (const char *); -#endif /* not __STDC__ */ -#endif /* __GNUC__ */ - -#endif /* not __GNU_LIBRARY__ */ - -/* Handle permutation of arguments. */ - -/* Describe the part of ARGV that contains non-options that have - been skipped. `first_nonopt' is the index in ARGV of the first of them; - `last_nonopt' is the index after the last of them. */ - -static int first_nonopt; -static int last_nonopt; - -/* Exchange two adjacent subsequences of ARGV. - One subsequence is elements [first_nonopt,last_nonopt) - which contains all the non-options that have been skipped so far. - The other is elements [last_nonopt,optind), which contains all - the options processed since those non-options were skipped. - - `first_nonopt' and `last_nonopt' are relocated so that they describe - the new indices of the non-options in ARGV after they are moved. */ - -static void -exchange (argv) - char **argv; -{ - int bottom = first_nonopt; - int middle = last_nonopt; - int top = optind; - char *tem; - - /* Exchange the shorter segment with the far end of the longer segment. - That puts the shorter segment into the right place. - It leaves the longer segment in the right place overall, - but it consists of two parts that need to be swapped next. */ - - while (top > middle && middle > bottom) - { - if (top - middle > middle - bottom) - { - /* Bottom segment is the short one. */ - int len = middle - bottom; - register int i; - - /* Swap it with the top part of the top segment. */ - for (i = 0; i < len; i++) - { - tem = argv[bottom + i]; - argv[bottom + i] = argv[top - (middle - bottom) + i]; - argv[top - (middle - bottom) + i] = tem; - } - /* Exclude the moved bottom segment from further swapping. */ - top -= len; - } - else - { - /* Top segment is the short one. */ - int len = top - middle; - register int i; - - /* Swap it with the bottom part of the bottom segment. */ - for (i = 0; i < len; i++) - { - tem = argv[bottom + i]; - argv[bottom + i] = argv[middle + i]; - argv[middle + i] = tem; - } - /* Exclude the moved top segment from further swapping. */ - bottom += len; - } - } - - /* Update records for the slots the non-options now occupy. */ - - first_nonopt += (optind - last_nonopt); - last_nonopt = optind; -} - -/* Initialize the internal data when the first call is made. */ - -static const char * -_getopt_initialize (optstring) - const char *optstring; -{ - /* Start processing options with ARGV-element 1 (since ARGV-element 0 - is the program name); the sequence of previously skipped - non-option ARGV-elements is empty. */ - - first_nonopt = last_nonopt = optind = 1; - - nextchar = NULL; - - /* Determine how to handle the ordering of options and nonoptions. */ - - if (optstring[0] == '-') - { - ordering = RETURN_IN_ORDER; - ++optstring; - } - else if (optstring[0] == '+') - { - ordering = REQUIRE_ORDER; - ++optstring; - } - else if (getenv ("POSIXLY_CORRECT") != NULL) - ordering = REQUIRE_ORDER; - else - ordering = PERMUTE; - - return optstring; -} - -/* Scan elements of ARGV (whose length is ARGC) for option characters - given in OPTSTRING. - - If an element of ARGV starts with '-', and is not exactly "-" or "--", - then it is an option element. The characters of this element - (aside from the initial '-') are option characters. If `getopt' - is called repeatedly, it returns successively each of the option characters - from each of the option elements. - - If `getopt' finds another option character, it returns that character, - updating `optind' and `nextchar' so that the next call to `getopt' can - resume the scan with the following option character or ARGV-element. - - If there are no more option characters, `getopt' returns `EOF'. - Then `optind' is the index in ARGV of the first ARGV-element - that is not an option. (The ARGV-elements have been permuted - so that those that are not options now come last.) - - OPTSTRING is a string containing the legitimate option characters. - If an option character is seen that is not listed in OPTSTRING, - return '?' after printing an error message. If you set `opterr' to - zero, the error message is suppressed but we still return '?'. - - If a char in OPTSTRING is followed by a colon, that means it wants an arg, - so the following text in the same ARGV-element, or the text of the following - ARGV-element, is returned in `optarg'. Two colons mean an option that - wants an optional arg; if there is text in the current ARGV-element, - it is returned in `optarg', otherwise `optarg' is set to zero. - - If OPTSTRING starts with `-' or `+', it requests different methods of - handling the non-option ARGV-elements. - See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above. - - Long-named options begin with `--' instead of `-'. - Their names may be abbreviated as long as the abbreviation is unique - or is an exact match for some defined option. If they have an - argument, it follows the option name in the same ARGV-element, separated - from the option name by a `=', or else the in next ARGV-element. - When `getopt' finds a long-named option, it returns 0 if that option's - `flag' field is nonzero, the value of the option's `val' field - if the `flag' field is zero. - - The elements of ARGV aren't really const, because we permute them. - But we pretend they're const in the prototype to be compatible - with other systems. - - LONGOPTS is a vector of `struct option' terminated by an - element containing a name which is zero. - - LONGIND returns the index in LONGOPT of the long-named option found. - It is only valid when a long-named option has been found by the most - recent call. - - If LONG_ONLY is nonzero, '-' as well as '--' can introduce - long-named options. */ - -int -_getopt_internal (argc, argv, optstring, longopts, longind, long_only) - int argc; - char *const *argv; - const char *optstring; - const struct option *longopts; - int *longind; - int long_only; -{ - optarg = NULL; - - if (optind == 0) - optstring = _getopt_initialize (optstring); - - if (nextchar == NULL || *nextchar == '\0') - { - /* Advance to the next ARGV-element. */ - - if (ordering == PERMUTE) - { - /* If we have just processed some options following some non-options, - exchange them so that the options come first. */ - - if (first_nonopt != last_nonopt && last_nonopt != optind) - exchange ((char **) argv); - else if (last_nonopt != optind) - first_nonopt = optind; - - /* Skip any additional non-options - and extend the range of non-options previously skipped. */ - - while (optind < argc - && (argv[optind][0] != '-' || argv[optind][1] == '\0')) - optind++; - last_nonopt = optind; - } - - /* The special ARGV-element `--' means premature end of options. - Skip it like a null option, - then exchange with previous non-options as if it were an option, - then skip everything else like a non-option. */ - - if (optind != argc && !strcmp (argv[optind], "--")) - { - optind++; - - if (first_nonopt != last_nonopt && last_nonopt != optind) - exchange ((char **) argv); - else if (first_nonopt == last_nonopt) - first_nonopt = optind; - last_nonopt = argc; - - optind = argc; - } - - /* If we have done all the ARGV-elements, stop the scan - and back over any non-options that we skipped and permuted. */ - - if (optind == argc) - { - /* Set the next-arg-index to point at the non-options - that we previously skipped, so the caller will digest them. */ - if (first_nonopt != last_nonopt) - optind = first_nonopt; - return EOF; - } - - /* If we have come to a non-option and did not permute it, - either stop the scan or describe it to the caller and pass it by. */ - - if ((argv[optind][0] != '-' || argv[optind][1] == '\0')) - { - if (ordering == REQUIRE_ORDER) - return EOF; - optarg = argv[optind++]; - return 1; - } - - /* We have found another option-ARGV-element. - Skip the initial punctuation. */ - - nextchar = (argv[optind] + 1 - + (longopts != NULL && argv[optind][1] == '-')); - } - - /* Decode the current option-ARGV-element. */ - - /* Check whether the ARGV-element is a long option. - - If long_only and the ARGV-element has the form "-f", where f is - a valid short option, don't consider it an abbreviated form of - a long option that starts with f. Otherwise there would be no - way to give the -f short option. - - On the other hand, if there's a long option "fubar" and - the ARGV-element is "-fu", do consider that an abbreviation of - the long option, just like "--fu", and not "-f" with arg "u". - - This distinction seems to be the most useful approach. */ - - if (longopts != NULL - && (argv[optind][1] == '-' - || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1]))))) - { - char *nameend; - const struct option *p; - const struct option *pfound = NULL; - int exact = 0; - int ambig = 0; - int indfound; - int option_index; - - for (nameend = nextchar; *nameend && *nameend != '='; nameend++) - /* Do nothing. */ ; - - /* Test all long options for either exact match - or abbreviated matches. */ - for (p = longopts, option_index = 0; p->name; p++, option_index++) - if (!strncmp (p->name, nextchar, nameend - nextchar)) - { - if (nameend - nextchar == strlen (p->name)) - { - /* Exact match found. */ - pfound = p; - indfound = option_index; - exact = 1; - break; - } - else if (pfound == NULL) - { - /* First nonexact match found. */ - pfound = p; - indfound = option_index; - } - else - /* Second or later nonexact match found. */ - ambig = 1; - } - - if (ambig && !exact) - { - if (opterr) - fprintf (stderr, "%s: option `%s' is ambiguous\n", - argv[0], argv[optind]); - nextchar += strlen (nextchar); - optind++; - return '?'; - } - - if (pfound != NULL) - { - option_index = indfound; - optind++; - if (*nameend) - { - /* Don't test has_arg with >, because some C compilers don't - allow it to be used on enums. */ - if (pfound->has_arg) - optarg = nameend + 1; - else - { - if (opterr) - { - if (argv[optind - 1][1] == '-') - /* --option */ - fprintf (stderr, - "%s: option `--%s' doesn't allow an argument\n", - argv[0], pfound->name); - else - /* +option or -option */ - fprintf (stderr, - "%s: option `%c%s' doesn't allow an argument\n", - argv[0], argv[optind - 1][0], pfound->name); - } - nextchar += strlen (nextchar); - return '?'; - } - } - else if (pfound->has_arg == 1) - { - if (optind < argc) - optarg = argv[optind++]; - else - { - if (opterr) - fprintf (stderr, "%s: option `%s' requires an argument\n", - argv[0], argv[optind - 1]); - nextchar += strlen (nextchar); - return optstring[0] == ':' ? ':' : '?'; - } - } - nextchar += strlen (nextchar); - if (longind != NULL) - *longind = option_index; - if (pfound->flag) - { - *(pfound->flag) = pfound->val; - return 0; - } - return pfound->val; - } - - /* Can't find it as a long option. If this is not getopt_long_only, - or the option starts with '--' or is not a valid short - option, then it's an error. - Otherwise interpret it as a short option. */ - if (!long_only || argv[optind][1] == '-' - || my_index (optstring, *nextchar) == NULL) - { - if (opterr) - { - if (argv[optind][1] == '-') - /* --option */ - fprintf (stderr, "%s: unrecognized option `--%s'\n", - argv[0], nextchar); - else - /* +option or -option */ - fprintf (stderr, "%s: unrecognized option `%c%s'\n", - argv[0], argv[optind][0], nextchar); - } - nextchar = (char *) ""; - optind++; - return '?'; - } - } - - /* Look at and handle the next short option-character. */ - - { - char c = *nextchar++; - char *temp = my_index (optstring, c); - - /* Increment `optind' when we start to process its last character. */ - if (*nextchar == '\0') - ++optind; - - if (temp == NULL || c == ':') - { - if (opterr) - { - /* 1003.2 specifies the format of this message. */ - fprintf (stderr, "%s: illegal option -- %c\n", argv[0], c); - } - optopt = c; - return '?'; - } - if (temp[1] == ':') - { - if (temp[2] == ':') - { - /* This is an option that accepts an argument optionally. */ - if (*nextchar != '\0') - { - optarg = nextchar; - optind++; - } - else - optarg = NULL; - nextchar = NULL; - } - else - { - /* This is an option that requires an argument. */ - if (*nextchar != '\0') - { - optarg = nextchar; - /* If we end this ARGV-element by taking the rest as an arg, - we must advance to the next element now. */ - optind++; - } - else if (optind == argc) - { - if (opterr) - { - /* 1003.2 specifies the format of this message. */ - fprintf (stderr, "%s: option requires an argument -- %c\n", - argv[0], c); - } - optopt = c; - if (optstring[0] == ':') - c = ':'; - else - c = '?'; - } - else - /* We already incremented `optind' once; - increment it again when taking next ARGV-elt as argument. */ - optarg = argv[optind++]; - nextchar = NULL; - } - } - return c; - } -} - -int -getopt (argc, argv, optstring) - int argc; - char *const *argv; - const char *optstring; -{ - return _getopt_internal (argc, argv, optstring, - (const struct option *) 0, - (int *) 0, - 0); -} - -#endif /* _LIBC or not __GNU_LIBRARY__. */ - -#ifdef TEST - -/* Compile with -DTEST to make an executable for use in testing - the above definition of `getopt'. */ - -int -main (argc, argv) - int argc; - char **argv; -{ - int c; - int digit_optind = 0; - - while (1) - { - int this_option_optind = optind ? optind : 1; - - c = getopt (argc, argv, "abc:d:0123456789"); - if (c == EOF) - break; - - switch (c) - { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - if (digit_optind != 0 && digit_optind != this_option_optind) - printf ("digits occur in two different argv-elements.\n"); - digit_optind = this_option_optind; - printf ("option %c\n", c); - break; - - case 'a': - printf ("option a\n"); - break; - - case 'b': - printf ("option b\n"); - break; - - case 'c': - printf ("option c with value `%s'\n", optarg); - break; - - case '?': - break; - - default: - printf ("?? getopt returned character code 0%o ??\n", c); - } - } - - if (optind < argc) - { - printf ("non-option ARGV-elements: "); - while (optind < argc) - printf ("%s ", argv[optind++]); - printf ("\n"); - } - - exit (0); -} - -#endif /* TEST */ diff --git a/contrib/gdb/libiberty/getopt1.c b/contrib/gdb/libiberty/getopt1.c deleted file mode 100644 index c3400e5..0000000 --- a/contrib/gdb/libiberty/getopt1.c +++ /dev/null @@ -1,190 +0,0 @@ -/* getopt_long and getopt_long_only entry points for GNU getopt. - Copyright (C) 1987, 88, 89, 90, 91, 92, 1993 - Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU Library 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 Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this program; if not, write to the Free Software - Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#ifdef HAVE_CONFIG_H -#if defined (emacs) || defined (CONFIG_BROKETS) -/* We use instead of "config.h" so that a compilation - using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h - (which it would do because it found this file in $srcdir). */ -#include -#else -#include "config.h" -#endif -#endif - -#include "getopt.h" - -#ifndef __STDC__ -/* This is a separate conditional since some stdc systems - reject `defined (const)'. */ -#ifndef const -#define const -#endif -#endif - -#include - -/* Comment out all this code if we are using the GNU C Library, and are not - actually compiling the library itself. This code is part of the GNU C - Library, but also included in many other GNU distributions. Compiling - and linking in this code is a waste when using the GNU C library - (especially if it is a shared library). Rather than having every GNU - program understand `configure --with-gnu-libc' and omit the object files, - it is simpler to just do this in the source for each such file. */ -/* Many versions of the Linux C library include older, broken versions - of these routines, which will break the linker's command-line - parsing. */ - -#if defined (_LIBC) || !defined (__GNU_LIBRARY__) || defined (__linux__) - - -/* This needs to come after some library #include - to get __GNU_LIBRARY__ defined. */ -#ifdef __GNU_LIBRARY__ -#include -#else -char *getenv (); -#endif - -#ifndef NULL -#define NULL 0 -#endif - -int -getopt_long (argc, argv, options, long_options, opt_index) - int argc; - char *const *argv; - const char *options; - const struct option *long_options; - int *opt_index; -{ - return _getopt_internal (argc, argv, options, long_options, opt_index, 0); -} - -/* Like getopt_long, but '-' as well as '--' can indicate a long option. - If an option that starts with '-' (not '--') doesn't match a long option, - but does match a short option, it is parsed as a short option - instead. */ - -int -getopt_long_only (argc, argv, options, long_options, opt_index) - int argc; - char *const *argv; - const char *options; - const struct option *long_options; - int *opt_index; -{ - return _getopt_internal (argc, argv, options, long_options, opt_index, 1); -} - - -#endif /* _LIBC or not __GNU_LIBRARY__. */ - -#ifdef TEST - -#include - -int -main (argc, argv) - int argc; - char **argv; -{ - int c; - int digit_optind = 0; - - while (1) - { - int this_option_optind = optind ? optind : 1; - int option_index = 0; - static struct option long_options[] = - { - {"add", 1, 0, 0}, - {"append", 0, 0, 0}, - {"delete", 1, 0, 0}, - {"verbose", 0, 0, 0}, - {"create", 0, 0, 0}, - {"file", 1, 0, 0}, - {0, 0, 0, 0} - }; - - c = getopt_long (argc, argv, "abc:d:0123456789", - long_options, &option_index); - if (c == EOF) - break; - - switch (c) - { - case 0: - printf ("option %s", long_options[option_index].name); - if (optarg) - printf (" with arg %s", optarg); - printf ("\n"); - break; - - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - if (digit_optind != 0 && digit_optind != this_option_optind) - printf ("digits occur in two different argv-elements.\n"); - digit_optind = this_option_optind; - printf ("option %c\n", c); - break; - - case 'a': - printf ("option a\n"); - break; - - case 'b': - printf ("option b\n"); - break; - - case 'c': - printf ("option c with value `%s'\n", optarg); - break; - - case 'd': - printf ("option d with value `%s'\n", optarg); - break; - - case '?': - break; - - default: - printf ("?? getopt returned character code 0%o ??\n", c); - } - } - - if (optind < argc) - { - printf ("non-option ARGV-elements: "); - while (optind < argc) - printf ("%s ", argv[optind++]); - printf ("\n"); - } - - exit (0); -} - -#endif /* TEST */ diff --git a/contrib/gdb/libiberty/getpagesize.c b/contrib/gdb/libiberty/getpagesize.c deleted file mode 100644 index e9784b8..0000000 --- a/contrib/gdb/libiberty/getpagesize.c +++ /dev/null @@ -1,89 +0,0 @@ -/* Emulation of getpagesize() for systems that need it. */ - -/* - -NAME - - getpagesize -- return the number of bytes in page of memory - -SYNOPSIS - - int getpagesize (void) - -DESCRIPTION - - Returns the number of bytes in a page of memory. This is the - granularity of many of the system memory management routines. - No guarantee is made as to whether or not it is the same as the - basic memory management hardware page size. - -BUGS - - Is intended as a reasonable replacement for systems where this - is not provided as a system call. The value of 4096 may or may - not be correct for the systems where it is returned as the default - value. - -*/ - -#ifndef VMS - -#include -#ifndef NO_SYS_PARAM_H -#include -#endif - -#ifdef HAVE_SYSCONF -#include -#define GNU_OUR_PAGESIZE sysconf(_SC_PAGESIZE) -#else -#ifdef PAGESIZE -#define GNU_OUR_PAGESIZE PAGESIZE -#else /* no PAGESIZE */ -#ifdef EXEC_PAGESIZE -#define GNU_OUR_PAGESIZE EXEC_PAGESIZE -#else /* no EXEC_PAGESIZE */ -#ifdef NBPG -#define GNU_OUR_PAGESIZE (NBPG * CLSIZE) -#ifndef CLSIZE -#define CLSIZE 1 -#endif /* CLSIZE */ -#else /* no NBPG */ -#ifdef NBPC -#define GNU_OUR_PAGESIZE NBPC -#else /* no NBPC */ -#define GNU_OUR_PAGESIZE 4096 /* Just punt and use reasonable value */ -#endif /* NBPC */ -#endif /* NBPG */ -#endif /* EXEC_PAGESIZE */ -#endif /* PAGESIZE */ -#endif /* HAVE_SYSCONF */ - -int -getpagesize () -{ - return (GNU_OUR_PAGESIZE); -} - -#else /* VMS */ - -#if 0 /* older distributions of gcc-vms are missing */ -#include -#endif -#ifndef SYI$_PAGE_SIZE /* VMS V5.4 and earlier didn't have this yet */ -#define SYI$_PAGE_SIZE 4452 -#endif -extern unsigned long lib$getsyi(const unsigned short *,...); - -int getpagesize () -{ - long pagsiz = 0L; - unsigned short itmcod = SYI$_PAGE_SIZE; - - (void) lib$getsyi (&itmcod, (void *) &pagsiz); - if (pagsiz == 0L) - pagsiz = 512L; /* VAX default */ - return (int) pagsiz; -} - -#endif /* VMS */ diff --git a/contrib/gdb/libiberty/getruntime.c b/contrib/gdb/libiberty/getruntime.c deleted file mode 100644 index 1be3b4c..0000000 --- a/contrib/gdb/libiberty/getruntime.c +++ /dev/null @@ -1,82 +0,0 @@ -/* Return time used so far, in microseconds. - Copyright (C) 1994 Free Software Foundation, Inc. - -This file is part of the libiberty library. -Libiberty is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public -License as published by the Free Software Foundation; either -version 2 of the License, or (at your option) any later version. - -Libiberty 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 -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with libiberty; see the file COPYING.LIB. 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" - -/* There are several ways to get elapsed execution time; unfortunately no - single way is available for all host systems, nor are there reliable - ways to find out which way is correct for a given host. */ - -#include - -/* These should go away when libiberty uses autoconf. */ - -#if defined(__sun__) && !defined(__svr4__) -#define HAVE_GETRUSAGE -#endif - -#ifdef HAVE_SYSCONF -#define HAVE_TIMES -#endif - -#ifdef HAVE_GETRUSAGE -#include -#include -#endif - -#ifdef HAVE_TIMES -#ifndef NO_SYS_PARAM_H -#include -#endif -#include -#endif - -/* This is a fallback; if wrong, it will likely make obviously wrong - results. */ - -#ifndef CLOCKS_PER_SEC -#define CLOCKS_PER_SEC 1 -#endif - -long -get_run_time () -{ -#ifdef HAVE_GETRUSAGE - struct rusage rusage; - - getrusage (0, &rusage); - return (rusage.ru_utime.tv_sec * 1000000 + rusage.ru_utime.tv_usec - + rusage.ru_stime.tv_sec * 1000000 + rusage.ru_stime.tv_usec); -#else /* ! HAVE_GETRUSAGE */ -#ifdef HAVE_TIMES - struct tms tms; - - times (&tms); - return (tms.tms_utime + tms.tms_stime) * (1000000 / HZ); -#else /* ! HAVE_TIMES */ - /* Fall back on clock and hope it's correctly implemented. */ - const long clocks_per_sec = CLOCKS_PER_SEC; - if (clocks_per_sec <= 1000000) - return clock () * (1000000 / clocks_per_sec); - else - return clock () / clocks_per_sec; -#endif /* HAVE_TIMES */ -#endif /* HAVE_GETRUSAGE */ -} diff --git a/contrib/gdb/libiberty/hex.c b/contrib/gdb/libiberty/hex.c deleted file mode 100644 index 3a2eef0..0000000 --- a/contrib/gdb/libiberty/hex.c +++ /dev/null @@ -1,33 +0,0 @@ -/* Hex character manipulation support. - Copyright (C) 1995 Free Software Foundation, Inc. - -This file is part of the libiberty library. -Libiberty is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public -License as published by the Free Software Foundation; either -version 2 of the License, or (at your option) any later version. - -Libiberty 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 -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with libiberty; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include "libiberty.h" - -char _hex_value[_hex_array_size]; - -void hex_init () -{ - int i; - for (i = 0; i < _hex_array_size; i++) - _hex_value[i] = _hex_bad; - for (i = 0; i < 10; i++) - _hex_value['0' + i] = i; - for (i = 0; i < 6; i++) - _hex_value['a' + i] = _hex_value['A' + i] = 10 + i; -} diff --git a/contrib/gdb/libiberty/index.c b/contrib/gdb/libiberty/index.c deleted file mode 100644 index e5a00f5..0000000 --- a/contrib/gdb/libiberty/index.c +++ /dev/null @@ -1,11 +0,0 @@ -/* Stub implementation of (obsolete) index(). */ - -extern char * strchr(); - -char * -index (s, c) - char *s; - int c; -{ - return strchr (s, c); -} diff --git a/contrib/gdb/libiberty/insque.c b/contrib/gdb/libiberty/insque.c deleted file mode 100644 index 775019f..0000000 --- a/contrib/gdb/libiberty/insque.c +++ /dev/null @@ -1,50 +0,0 @@ -/* insque(3C) routines - This file is in the public domain. */ - -/* -NAME - insque, remque -- insert, remove an element from a queue - -SYNOPSIS - struct qelem { - struct qelem *q_forw; - struct qelem *q_back; - char q_data[]; - }; - - void insque (struct qelem *elem, struct qelem *pred) - - void remque (struct qelem *elem) - -DESCRIPTION - Routines to manipulate queues built from doubly linked lists. - The insque routine inserts ELEM in the queue immediately after - PRED. The remque routine removes ELEM from its containing queue. -*/ - - -struct qelem { - struct qelem *q_forw; - struct qelem *q_back; -}; - - -void -insque (elem, pred) - struct qelem *elem; - struct qelem *pred; -{ - elem -> q_forw = pred -> q_forw; - pred -> q_forw -> q_back = elem; - elem -> q_back = pred; - pred -> q_forw = elem; -} - - -void -remque (elem) - struct qelem *elem; -{ - elem -> q_forw -> q_back = elem -> q_back; - elem -> q_back -> q_forw = elem -> q_forw; -} diff --git a/contrib/gdb/libiberty/makefile.dos b/contrib/gdb/libiberty/makefile.dos deleted file mode 100644 index 7eba62c..0000000 --- a/contrib/gdb/libiberty/makefile.dos +++ /dev/null @@ -1,29 +0,0 @@ -CFLAGS=-O2 - -OBJS = \ - argv.o \ - basename.o \ - concat.o \ - cplus-dem.o \ - fdmatch.o \ - floatformat.o \ - getopt.o \ - getopt1.o \ - getruntime.o \ - hex.o \ - msdos.o \ - obstack.o \ - spaces.o \ - strerror.o \ - strsignal.o \ - xatexit.o \ - xexit.o \ - xmalloc.o \ - $E - -.c.o: - gcc -I../include $(CFLAGS) -c $< - -libiberty.a : $(OBJS) - -rm libiberty.a - ar rvs libiberty.a $(OBJS) diff --git a/contrib/gdb/libiberty/memchr.c b/contrib/gdb/libiberty/memchr.c deleted file mode 100644 index 93ef43d..0000000 --- a/contrib/gdb/libiberty/memchr.c +++ /dev/null @@ -1,60 +0,0 @@ -/* -FUNCTION - <>---find character in memory - -INDEX - memchr - -ANSI_SYNOPSIS - #include - void *memchr(const void *<[src]>, int <[c]>, size_t <[length]>); - -TRAD_SYNOPSIS - #include - void *memchr(<[src]>, <[c]>, <[length]>) - void *<[src]>; - void *<[c]>; - size_t <[length]>; - -DESCRIPTION - This function searches memory starting at <<*<[src]>>> for the - character <[c]>. The search only ends with the first - occurrence of <[c]>, or after <[length]> characters; in - particular, <> does not terminate the search. - -RETURNS - If the character <[c]> is found within <[length]> characters - of <<*<[src]>>>, a pointer to the character is returned. If - <[c]> is not found, then <> is returned. - -PORTABILITY -<> requires no supporting OS subroutines. - -QUICKREF - memchr ansi pure - -*/ - -#include -#ifdef __STDC__ -#include -#else -#define size_t unsigned long -#endif - -PTR -memchr (src_void, c, length) - register CONST PTR src_void; - int c; - size_t length; -{ - CONST unsigned char *src = (CONST unsigned char *)src_void; - - while (--length >= 0) - { - if (*src == c) - return (PTR)src; - src++; - } - return NULL; -} diff --git a/contrib/gdb/libiberty/memcmp.c b/contrib/gdb/libiberty/memcmp.c deleted file mode 100644 index 127ae0c..0000000 --- a/contrib/gdb/libiberty/memcmp.c +++ /dev/null @@ -1,38 +0,0 @@ -/* memcmp -- compare two memory regions. - This function is in the public domain. */ - -/* -NAME - memcmp -- compare two memory regions - -SYNOPSIS - int memcmp (const void *from, const void *to, size_t count) - -DESCRIPTION - Compare two memory regions and return less than, - equal to, or greater than zero, according to lexicographical - ordering of the compared regions. -*/ - -#include -#ifdef __STDC__ -#include -#else -#define size_t unsigned long -#endif - -int -DEFUN(memcmp, (str1, str2, count), - const PTR str1 AND const PTR str2 AND size_t count) -{ - register unsigned char *s1 = (unsigned char*)str1; - register unsigned char *s2 = (unsigned char*)str2; - - while (count-- > 0) - { - if (*s1++ != *s2++) - return s1[-1] < s2[-1] ? -1 : 1; - } - return 0; -} - diff --git a/contrib/gdb/libiberty/memcpy.c b/contrib/gdb/libiberty/memcpy.c deleted file mode 100644 index c28208a0..0000000 --- a/contrib/gdb/libiberty/memcpy.c +++ /dev/null @@ -1,28 +0,0 @@ -/* memcpy (the standard C function) - This function is in the public domain. */ - -/* -NAME - memcpy -- copy memory regions of arbitary length - -SYNOPSIS - void* memcpy (void *out, const void *in, size_t n); - -DESCRIPTION - Copy LENGTH bytes from memory region pointed to by IN to memory - region pointed to by OUT. -*/ - -#include -#ifdef __STDC__ -#include -#else -#define size_t unsigned long -#endif - -PTR -DEFUN(memcpy, (out, in, length), PTR out AND CONST PTR in AND size_t length) -{ - bcopy(in, out, length); - return out; -} diff --git a/contrib/gdb/libiberty/memmove.c b/contrib/gdb/libiberty/memmove.c deleted file mode 100644 index 818fc24..0000000 --- a/contrib/gdb/libiberty/memmove.c +++ /dev/null @@ -1,18 +0,0 @@ -/* Wrapper to implement ANSI C's memmove using BSD's bcopy. */ -/* This function is in the public domain. --Per Bothner. */ -#include -#ifdef __STDC__ -#include -#else -#define size_t unsigned long -#endif - -PTR -memmove (s1, s2, n) - PTR s1; - CONST PTR s2; - size_t n; -{ - bcopy (s2, s1, n); - return s1; -} diff --git a/contrib/gdb/libiberty/memset.c b/contrib/gdb/libiberty/memset.c deleted file mode 100644 index 5f54831..0000000 --- a/contrib/gdb/libiberty/memset.c +++ /dev/null @@ -1,19 +0,0 @@ -/* memset - This implementation is in the public domain. */ - -#include -#ifdef __STDC__ -#include -#else -#define size_t unsigned long -#endif - -PTR -DEFUN(memset, (dest, val, len), - PTR dest AND register int val AND register size_t len) -{ - register unsigned char *ptr = (unsigned char*)dest; - while (len-- > 0) - *ptr++ = val; - return dest; -} diff --git a/contrib/gdb/libiberty/mpw-config.in b/contrib/gdb/libiberty/mpw-config.in deleted file mode 100644 index 829d8e7..0000000 --- a/contrib/gdb/libiberty/mpw-config.in +++ /dev/null @@ -1,9 +0,0 @@ -# MPW configuration fragment for libiberty. - -forward-include "{srcdir}"alloca-norm.h alloca-conf.h - -Echo '/* config.h. Generated by mpw-configure. */' > "{o}"config.new - -MoveIfChange "{o}"config.new "{o}"config.h - - diff --git a/contrib/gdb/libiberty/mpw-make.sed b/contrib/gdb/libiberty/mpw-make.sed deleted file mode 100644 index f99eb1a..0000000 --- a/contrib/gdb/libiberty/mpw-make.sed +++ /dev/null @@ -1,49 +0,0 @@ -# Sed commands to finish translating libiberty's Unix makefile to MPW syntax. - -# Comment out a useless thing. -/^\.always\./s/^/#/ - -# Replace the auto-generated list with the list of what we know we need. -s/`cat needed-list`/"{o}"alloca.c.o "{o}"bcopy.c.o "{o}"getpagesize.c.o "{o}"insque.c.o "{o}"mpw.c.o "{o}"strcasecmp.c.o "{o}"strdup.c.o "{o}"strncasecmp.c.o/ - -# Paste in some desirable definitions. -/^###$/a\ -\ -HDEFINES = -d NEED_sys_siglist -d NEED_sys_errlist -d NEED_basename -d NEED_strcasecmp -d NEED_strncasecmp\ -INCLUDES = -i : -i {INCDIR}: -i {INCDIR}:mpw: -i ::extra-include: -i "{s}"\ -\ -.c.o \\Option-f .c\ - {CC} {DepDir}{Default}.c {LIBCFLAGS} {INCLUDES} {HDEFINES} @SEGMENT_FLAG@ -o {TargDir}{Default}.c.o\ - -# Remove dependency on needed-list, which we don't use. -/DO_ALSO =/s/needed-list// - -/INCDIR=/s/"{srcdir}"{MULTISRCTOP}::/"{topsrcdir}"/ - -# Whack out the COMPILE.c trickiness. -/^COMPILE.c /,/^$/d - -# Remove the multido trickiness from the "all" target. -/^all \\Option-f/,/^$/c\ -all \\Option-f {TARGETLIB}\ - - -# Remove the RULE1/RULE2 crud. -/if \[/,/fi/d -/^RULE1 =/,/RULE2 =/d -/RULE2/s/RULE2/TARGETLIB/ - -# Don't want fdmatch ever. -s/ "{o}"fdmatch.c.o// - -# Fix paths to generated files. -/config.h/s/"{s}"config.h/"{o}"config.h/ - -# Whack out config rebuild rules. -/^"{o}"config.h \\Option-f/,/^$/d - - - - - - diff --git a/contrib/gdb/libiberty/mpw.c b/contrib/gdb/libiberty/mpw.c deleted file mode 100644 index b93e100..0000000 --- a/contrib/gdb/libiberty/mpw.c +++ /dev/null @@ -1,1010 +0,0 @@ -/* MPW-Unix compatibility library. - Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc. - -This file is part of the libiberty library. -Libiberty is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public -License as published by the Free Software Foundation; either -version 2 of the License, or (at your option) any later version. - -Libiberty 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 -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with libiberty; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* This should only be compiled and linked under MPW. */ - -#include "mpw.h" - -#include - -#ifndef USE_MW_HEADERS -#include -#include -#endif - -#include -#include - -#include - -/* Initialize to 0 at first, then set to errno_max() later. */ - -int sys_nerr = 0; - -/* Debug flag for pathname hacking. Set this to one and rebuild. */ - -int DebugPI = 0; - -void -mpwify_filename(char *unixname, char *macname) -{ - int i, j, in_middle, terminate = 0; - - /* (should truncate 255 chars from end of name, not beginning) */ - if (strlen (unixname) > 255) - { - fprintf (stderr, "Pathname \"%s\" is too long for Macs, truncating\n", - unixname); - terminate = 1; - } - /* Abs Unix path to abs Mac path. */ - if (*unixname == '/') - { - if (strncmp (unixname, "/tmp/", 5) == 0) - { - /* A temporary name, make a more Mac-flavored tmpname. */ - /* A better choice would be {Boot}Trash:foo, but that would - require being able to identify the boot disk's and trashcan's - name. Another option would be to have an env var, so user - can point it at a ramdisk. */ - strncpy (macname, unixname, 255); - if (terminate) - macname[255] = '\0'; - macname[0] = ':'; - macname[4] = '_'; - } - else - { - /* Assume that the leading component is a valid disk name. */ - strncpy (macname, unixname + 1, 255); - } - } - else - { - /* If this is a "Unix-only" pathname, assume relative. */ - if (strchr (unixname, '/') && ! strchr (unixname, ':')) - { - macname[0] = ':'; - strncpy (macname + 1, unixname, 255); - } - else - { - /* Otherwise copy it verbatim. */ - /* ... but if of the form ":/foo", lose the extra colon; - the slash will be made into a colon shortly. */ - if (unixname[0] == ':' && unixname[1] == '/') - ++unixname; - strncpy (macname, unixname, 255); - } - } - if (terminate) - macname[255] = '\0'; - for (i = 0; macname[i] != '\0'; ++i) - { - if (macname[i] == '/') - macname[i] = ':'; - } - in_middle = 0; - j = 0; - for (i = 0; macname[i] != '\0'; ++i) - { - /* We're in the middle of the name when a char is not a colon. */ - if (macname[i] != ':') - in_middle = 1; - /* Copy chars verbatim, *unless* the char is the first of a pair - of colons in the middle of a pathname. */ - if (!(in_middle && macname[i] == ':' && macname[i+1] == ':')) - macname[j++] = macname[i]; - } - macname[j] = '\0'; - /* If we have a trailing ":.", make it into a ":". */ - if (j >= 2 && macname[j-2] == ':' && macname[j-1] == '.') - macname[j-1] = '\0'; - if (DebugPI) - { - fprintf (stderr, "# Made \"%s\"\n", unixname); - fprintf (stderr, "# into \"%s\"\n", macname); - } -} - -/* MPW-flavored basename finder. */ - -char * -mpw_basename (name) - char *name; -{ - char *base = name; - - while (*name) - { - if (*name++ == ':') - { - base = name; - } - } - return base; -} - -/* Mixed MPW/Unix basename finder. This can be led astray by - filenames with slashes in them and come up with a basename that - either corresponds to no file or (worse) to some other file, so - should only be tried if other methods of finding a file via a - basename have failed. */ - -char * -mpw_mixed_basename (name) - char *name; -{ - char *base = name; - - while (*name) - { - if (*name == '/' || *name == ':') - { - base = name + 1; - } - ++name; - } - return base; -} - -/* This function is fopen() modified to create files that are type TEXT - or 'BIN ', and always of type 'MPS '. */ - -FILE * -mpw_fopen (char *name, char *mode) -{ -#undef fopen - int errnum; - FILE *fp; - char tmpname[256]; - - mpwify_filename (name, tmpname); - PROGRESS (1); - fp = fopen (tmpname, mode); - errnum = errno; - - /* If writing, need to set type and creator usefully. */ - if (strchr (mode, 'w')) - { - char *pname = (char *) malloc (strlen (tmpname) + 2); - OSErr e; - struct FInfo fi; - - pname[0] = strlen (tmpname); - strcpy (pname+1, tmpname); - - e = GetFInfo ((ConstStr255Param) pname, 0, &fi); - /* should do spiffier error handling */ - if (e != 0) - fprintf(stderr, "GetFInfo returns %d\n", e); - if (strchr (mode, 'b')) - { - fi.fdType = (OSType) 'BIN '; - } - else - { - fi.fdType = (OSType) 'TEXT'; - } - fi.fdCreator = (OSType) 'MPS '; - e = SetFInfo ((ConstStr255Param) pname, 0, &fi); - if (e != 0) - fprintf(stderr, "SetFInfo returns %d\n", e); - free (pname); - } - if (fp == NULL) - errno = errnum; - return fp; -} - -/* This is a version of fseek() modified to fill the file with zeros - if seeking past the end of it. */ - -#define ZEROBLKSIZE 4096 - -char zeros[ZEROBLKSIZE]; - -int -mpw_fseek (FILE *fp, int offset, int whence) -{ -#undef fseek - int cursize, numleft; - - PROGRESS (1); - if (whence == SEEK_SET) - { - fseek (fp, 0, SEEK_END); - cursize = ftell (fp); - if (offset > cursize) - { - numleft = offset - cursize; - while (numleft > ZEROBLKSIZE) - { - /* This might fail, should check for that. */ - PROGRESS (1); - fwrite (zeros, 1, ZEROBLKSIZE, fp); - numleft -= ZEROBLKSIZE; - } - PROGRESS (1); - fwrite (zeros, 1, numleft, fp); - fflush (fp); - } - } - return fseek (fp, offset, whence); -} - -int -mpw_fread (char *ptr, int size, int nitems, FILE *stream) -{ -#undef fread - int rslt; - - PROGRESS (1); - rslt = fread (ptr, size, nitems, stream); - PROGRESS (1); - return rslt; -} - -int -mpw_fwrite (char *ptr, int size, int nitems, FILE *stream) -{ -#undef fwrite - int rslt; - - PROGRESS (1); - rslt = fwrite (ptr, size, nitems, stream); - PROGRESS (1); - return rslt; -} - -int -link () -{ - fprintf (stderr, "link not available!\n"); - mpw_abort (); -} - -int -fork () -{ - fprintf (stderr, "fork not available!\n"); - mpw_abort (); -} - -int -vfork () -{ - fprintf (stderr, "vfork not available!\n"); - mpw_abort (); - return (-1); -} - -int -pipe (int *fd) -{ - fprintf (stderr, "pipe not available!\n"); - mpw_abort (); - return (-1); -} - -#ifndef USE_MW_HEADERS -int -execvp (char *file, char **argv) -{ - fprintf (stderr, "execvp not available!\n"); - mpw_abort (); - return (-1); -} - -int -execv (char *path, char **argv) -{ - fprintf (stderr, "execv not available!\n"); - mpw_abort (); - return (-1); -} -#endif - -int -kill (int pid, int sig) -{ - fprintf (stderr, "kill not available!\n"); - mpw_abort (); - return (-1); -} - -int -wait (int *status) -{ - *status = 0; - return 0; -} - -#ifndef USE_MW_HEADERS -int -sleep (int seconds) -{ - unsigned long start_time, now; - - time (&start_time); - - while (1) - { - PROGRESS (1); - time (&now); - if (now > start_time + seconds) - return 0; - } -} -#endif - -void -putenv (char *str) -{ - /* The GCC driver calls this to do things for collect2, but we - don't care about collect2. */ -} - -int -chmod (char *path, int mode) -{ - /* Pretend it was all OK. */ - return 0; -} - -#ifndef USE_MW_HEADERS -int -getuid () -{ - /* One value is as good as another... */ - return 0; -} - -int -getgid () -{ - /* One value is as good as another... */ - return 0; -} -#endif - -/* Instead of coredumping, which is not a normal Mac facility, we - drop into Macsbug. If we then "g" from Macsbug, the program will - exit cleanly. */ - -void -mpw_abort () -{ - /* Make sure no output still buffered up, then zap into MacsBug. */ - fflush(stdout); - fflush(stderr); - printf("## Abort! ##\n"); -#ifdef MPW_SADE - SysError(8005); -#else - Debugger(); -#endif - /* "g" in MacsBug will then cause a regular error exit. */ - exit (1); -} - -/* Imitation getrusage based on the ANSI clock() function. */ - -int -getrusage (int who, struct rusage *rusage) -{ - int clk = clock (); - -#if 0 - rusage->ru_utime.tv_sec = clk / CLOCKS_PER_SEC; - rusage->ru_utime.tv_usec = ((clk * 1000) / CLOCKS_PER_SEC) * 1000; - rusage->ru_stime.tv_sec = 0; - rusage->ru_stime.tv_usec = 0; -#endif -} - -int -sbrk () -{ - return 0; -} - -#ifndef USE_MW_HEADERS -int -isatty (int fd) -{ - return 0; -} - -/* This is inherited from Timothy Murray's Posix library. */ - -#include "utime.h" - -int -utime (char *filename, struct utimbuf *times) -{ - CInfoPBRec cipbr; - HFileInfo *fpb = (HFileInfo *) &cipbr; - DirInfo *dpb = (DirInfo *) &cipbr; - unsigned char pname[256]; - short err; - - strcpy ((char *) pname, filename); - c2pstr (pname); - - dpb->ioDrDirID = 0L; - fpb->ioNamePtr = pname; - fpb->ioVRefNum = 0; - fpb->ioFDirIndex = 0; - fpb->ioFVersNum = 0; - err = PBGetCatInfo (&cipbr, 0); - if (err != noErr) { - errno = ENOENT; - return -1; - } - dpb->ioDrDirID = 0L; - fpb->ioFlMdDat = times->modtime; - fpb->ioFlCrDat = times->actime; - err = PBSetCatInfo (&cipbr, 0); - if (err != noErr) { - errno = EACCES; - return -1; - } - return 0; -} - -int -mkdir (char *path, int mode) -{ - errno = ENOSYS; - return -1; -} - -int -rmdir () -{ - errno = ENOSYS; - return -1; -} -#endif - -chown () -{ - errno = ENOSYS; - return -1; -} - -char *myenviron[] = {NULL}; - -char **environ = myenviron; - -#ifndef USE_MW_HEADERS - -/* Minimal 'stat' emulation: tells directories from files and - gives length and mtime. - - Derived from code written by Guido van Rossum, CWI, Amsterdam - and placed by him in the public domain. */ - -extern int __uid, __gid; - -int __uid = 0; -int __gid = 0; - -/* Bits in ioFlAttrib: */ -#define LOCKBIT (1<<0) /* File locked */ -#define DIRBIT (1<<4) /* It's a directory */ - -/* Macified "stat" in which filename is given relative to a directory, - specified by long DirID. */ - -static int -_stat (char *name, long dirid, struct stat *buf) -{ - CInfoPBRec cipbr; - HFileInfo *fpb = (HFileInfo*) &cipbr; - DirInfo *dpb = (DirInfo*) &cipbr; - Str255 pname; - short err; - - /* Make a temp copy of the name and pascalize. */ - strcpy ((char *) pname, name); - c2pstr (pname); - - cipbr.dirInfo.ioDrDirID = dirid; - cipbr.hFileInfo.ioNamePtr = pname; - cipbr.hFileInfo.ioVRefNum = 0; - cipbr.hFileInfo.ioFDirIndex = 0; - cipbr.hFileInfo.ioFVersNum = 0; - err = PBGetCatInfo (&cipbr, 0); - if (err != noErr) - { - errno = ENOENT; - return -1; - } - /* Mac files are readable if they can be accessed at all. */ - buf->st_mode = 0444; - /* Mark unlocked files as writeable. */ - if (!(fpb->ioFlAttrib & LOCKBIT)) - buf->st_mode |= 0222; - if (fpb->ioFlAttrib & DIRBIT) - { - /* Mark directories as "executable". */ - buf->st_mode |= 0111 | S_IFDIR; - buf->st_size = dpb->ioDrNmFls; - buf->st_rsize = 0; - } - else - { - buf->st_mode |= S_IFREG; - /* Mark apps as "executable". */ - if (fpb->ioFlFndrInfo.fdType == 'APPL') - buf->st_mode |= 0111; - /* Fill in the sizes of data and resource forks. */ - buf->st_size = fpb->ioFlLgLen; - buf->st_rsize = fpb->ioFlRLgLen; - } - /* Fill in various times. */ - buf->st_atime = fpb->ioFlCrDat; - buf->st_mtime = fpb->ioFlMdDat; - buf->st_ctime = fpb->ioFlCrDat; - /* Set up an imitation inode number. */ - buf->st_ino = (unsigned short) fpb->ioDirID; - /* Set up an imitation device. */ - GetVRefNum (buf->st_ino, &buf->st_dev); - buf->st_uid = __uid; - buf->st_gid = __gid; -/* buf->st_FlFndrInfo = fpb->ioFlFndrInfo; */ - return 0; -} - -/* stat() sets up an empty dirid. */ - -int -stat (char *path, struct stat *buf) -{ - long rslt, errnum; - char tmpname[256]; - - mpwify_filename (path, tmpname); - if (DebugPI) - fprintf (stderr, "# stat (%s, %x)", tmpname, buf); - PROGRESS (1); - rslt = _stat (tmpname, 0L, buf); - errnum = errno; - if (DebugPI) - { - fprintf (stderr, " -> %d", rslt); - if (rslt != 0) - fprintf (stderr, " (errno is %d)", errnum); - fprintf (stderr, "\n"); - fflush (stderr); - } - if (rslt != 0) - errno = errnum; - return rslt; -} - -int -fstat (int fd, struct stat *buf) -{ - FCBPBRec fcb; - FILE *fp; - Str255 pathname; - long dirid = 0L, temp; - long rslt, errnum; - short err; - - if (DebugPI) - fprintf (stderr, "# fstat (%d, %x)", fd, buf); - PROGRESS (1); - pathname[0] = 0; -#ifdef FIOFNAME - /* Use an MPW-specific ioctl to get the pathname associated with - the file descriptor. */ - ioctl (fd, FIOFNAME, (long *) pathname); -#else - you lose -#endif - if (DebugPI) - fprintf (stderr, " (name is %s)", pathname); - dirid = 0L /* fcb.ioFCBParID */ ; - rslt = _stat ((char *) pathname, dirid, buf); - errnum = errno; - if (DebugPI) - { - fprintf (stderr, " -> %d", rslt); - if (rslt != 0) - fprintf (stderr, " (errno is %d)", errnum); - fprintf (stderr, "\n"); - fflush (stderr); - } - if (rslt != 0) - errno = errnum; - return rslt; -} - -#endif /* n USE_MW_HEADERS */ - -chdir () -{ - errno = ENOSYS; - return (-1); -} - -char * -getcwd (char *buf, int size) -{ - if (buf == NULL) - buf = (char *) malloc (size); - strcpy(buf, ":"); - return buf; -} - -/* This should probably be more elaborate for MPW. */ - -char * -getpwd () -{ - return ":"; -} - -int -mpw_open (char *filename, int arg2, int arg3) -{ -#undef open - int fd, errnum = 0; - char tmpname[256]; - - mpwify_filename (filename, tmpname); - fd = open (tmpname, arg2); - errnum = errno; - - if (DebugPI) - { - fprintf (stderr, "# open (%s, %d, %d)", tmpname, arg2, arg3); - fprintf (stderr, " -> %d", fd); - if (fd == -1) - fprintf (stderr, " (errno is %d)", errnum); - fprintf (stderr, "\n"); - } - if (fd == -1) - errno = errnum; - return fd; -} - -int -mpw_access (char *filename, unsigned int cmd) -{ -#undef access - - int rslt, errnum = 0; - struct stat st; - char tmpname[256]; - - mpwify_filename (filename, tmpname); - if (cmd & R_OK || cmd & X_OK) - { - rslt = stat (tmpname, &st); - errnum = errno; - if (rslt >= 0) - { - if (((st.st_mode & 004 == 0) && (cmd & R_OK)) - || ((st.st_mode & 002 == 0) && (cmd & W_OK)) - || ((st.st_mode & 001 == 0) && (cmd & X_OK))) - { - rslt = -1; - errnum = EACCES; - } - } - } - if (DebugPI) - { - fprintf (stderr, "# mpw_access (%s, %d)", tmpname, cmd); - fprintf (stderr, " -> %d", rslt); - if (rslt != 0) - fprintf (stderr, " (errno is %d)", errnum); - fprintf (stderr, "\n"); - } - if (rslt != 0) - errno = errnum; - return rslt; -} - -/* The MPW library creat() has no mode argument. */ - -int -mpw_creat (char *path, /* mode_t */ int mode) -{ -#undef creat - -#ifdef USE_MW_HEADERS - return creat (path, mode); -#else - return creat (path); -#endif -} - -/* This is a hack to get control in an MPW tool before it crashes the - machine. */ - -mpw_special_init (name) - char *name; -{ - if (strstr (name, "DEBUG")) - DebugStr("\pat beginning of program"); -} - -static int current_umask; - -int -umask(int mask) -{ - int oldmask = current_umask; - - current_umask = mask; - return oldmask; -} - -/* Cursor-spinning stuff that includes metering of spin rate and delays. */ - -/* Nonzero when cursor spinning has been set up properly. */ - -int cursor_inited; - -/* Nonzero if spin should be measured and excessive delays reported. */ - -int measure_spin; - -/* Nonzero if spin histogram and rate data should be written out. */ - -int dump_spin_data; - -long warning_threshold = 400000; - -long bucket_size = 1024; - -long bucket_power = 10; - -long numbuckets = 300; - -int *delay_counts; - -int overflow_count; - -char *current_progress; - -static UnsignedWide last_microseconds; - -static char *last_spin_file = ""; - -static int last_spin_line; - -void -warn_if_spin_delay (char *file, int line) -{ - long diff, ix; - UnsignedWide now; - - Microseconds(&now); - - diff = now.lo - last_microseconds.lo; - - if (diff > warning_threshold) - fprintf (stderr, "# %s: %ld.%06ld sec delay getting from %s:%d to %s:%d\n", - (current_progress ? current_progress : ""), - diff / 1000000, diff % 1000000, - last_spin_file, last_spin_line, file, line); - if (dump_spin_data) - { - if (diff >= 0) - { - ix = diff >> bucket_power; - if (ix >= 0 && ix < numbuckets && delay_counts != NULL) - ++delay_counts[ix]; - else - ++overflow_count; - } - else - fprintf (stderr, "raw diff is %ld (?)\n", diff); - } -} - -void -record_for_spin_delay (char *file, int line) -{ - Microseconds (&last_microseconds); - last_spin_file = file; - last_spin_line = line; -} - -void -mpw_start_progress (char *str, int n, char *file, int line) -{ - int i; - char *measure, *threshold; - - if (!cursor_inited) - { - InitCursorCtl (nil); - cursor_inited = 1; - record_for_spin_delay (file, line); - measure = getenv ("MEASURE_SPIN"); - if (measure != NULL && measure[0] != '\0') - { - measure_spin = 1; - if (strcmp (measure, "all") == 0) - dump_spin_data = 1; - } - threshold = getenv ((const char *) "SPIN_WARN_THRESHOLD"); - if (threshold != NULL && threshold[0] != '\0') - warning_threshold = atol (threshold); - if (dump_spin_data) - { - if (delay_counts == NULL) - delay_counts = (int *) malloc (numbuckets * sizeof (int)); - for (i = 0; i < numbuckets; ++i) - delay_counts[i] = 0; - overflow_count = 0; - } - } - current_progress = str; - - sys_nerr = errno_max (); - - mpw_special_init (str); -} - -void -mpw_progress (int n) -{ - SpinCursor (32); -} - -void -mpw_progress_measured (int n, char *file, int line) -{ - if (measure_spin) - warn_if_spin_delay (file, line); - SpinCursor (32); - if (measure_spin) - record_for_spin_delay (file, line); -} - -void -mpw_end_progress (char *str, char *file, int line) -{ - long i, delay, count = 0, sum = 0, avgdelay, spinrate; - long curpower = 0, curgroup = 0; - - /* Warn if it's been a while since the last spin. */ - if (measure_spin) - warn_if_spin_delay (file, line); - - /* Dump all the nonzero delay counts and an approximation of the delay. */ - if (dump_spin_data && delay_counts != NULL) - { - for (i = 0; i < numbuckets; ++i) - { - delay = (i + 1) * bucket_size; - sum += delay_counts[i] * (i + 1); - count += delay_counts[i]; - if (delay <= (1 << curpower)) - { - curgroup += delay_counts[i]; - } - else - { - if (curgroup > 0) - fprintf (stderr, - "# %s: %d delays between %ld.%06ld and %ld.%06ld sec\n", - (str ? str : ""), - curgroup, - (1 << curpower) / 1000000, - (1 << curpower) % 1000000, - (1 << (curpower + 1)) / 1000000, - (1 << (curpower + 1)) % 1000000); - ++curpower; - curgroup = 0; - } - } - if (count > 0) - { - avgdelay = (sum * bucket_size) / count; - spinrate = 1000000 / avgdelay; - fprintf (stderr, "# %s: Average spin rate is %d times/sec\n", - (str ? str : ""), spinrate); - } - } -} - -#ifdef PROGRESS_TEST - -/* Test program. */ - -main () -{ - int i, j; - double x = 1.0, y = 2.4; - long start = Microseconds (), tm; FIXME - - START_PROGRESS ("hi", 0); - - for (i = 0; i < 1000; ++i) - { - PROGRESS (1); - - for (j = 0; j < (i * 100); ++j) - { - x += (x * y) / j; - } - } - - END_PROGRESS ("hi"); - - tm = Microseconds () - start; - - printf ("Total time is %d.%d secs\n", tm / 1000000, tm % 1000000); -} - -#endif - -#ifdef USE_MW_HEADERS -/* Empty definitions for Metrowerks' SIOUX console library. */ - -#ifndef __CONSOLE__ -#include -#endif - -short -InstallConsole(short fd) -{ -#pragma unused (fd) - return 0; -} - -void -RemoveConsole(void) -{ -} - -long -WriteCharsToConsole(char *buf, long n) -{ -#pragma unused (buf, n) - return 0; -} - -long ReadCharsFromConsole(char *buf, long n) -{ -#pragma unused (buf, n) - return 0; -} - -extern char * -__ttyname(long fd) -{ - static char *__devicename = "null device"; - - if (fd >= 0 && fd <= 2) - return (__devicename); - return NULL; -} - -#endif diff --git a/contrib/gdb/libiberty/msdos.c b/contrib/gdb/libiberty/msdos.c deleted file mode 100644 index 923e64d..0000000 --- a/contrib/gdb/libiberty/msdos.c +++ /dev/null @@ -1,15 +0,0 @@ -char msg[] = "No vfork available - aborting\n"; -vfork() -{ - write(1, msg, sizeof(msg)); -} - -sigsetmask() -{ - /* no signals support in go32 (yet) */ -} - -waitpid() -{ - return -1; -} diff --git a/contrib/gdb/libiberty/obstack.c b/contrib/gdb/libiberty/obstack.c deleted file mode 100644 index 2d38094..0000000 --- a/contrib/gdb/libiberty/obstack.c +++ /dev/null @@ -1,507 +0,0 @@ -/* obstack.c - subroutines used implicitly by object stack macros - Copyright (C) 1988, 89, 90, 91, 92, 93, 94, 95, 96 Free Software Foundation, Inc. - -This program is free software; you can redistribute it and/or modify it -under the terms of the GNU Library 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 Library General Public License for more details. - -You should have received a copy of the GNU Library General Public License -along with this program; if not, write to the Free Software -Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#include "obstack.h" - -/* This is just to get __GNU_LIBRARY__ defined. */ -#include - -/* Comment out all this code if we are using the GNU C Library, and are not - actually compiling the library itself. This code is part of the GNU C - Library, but also included in many other GNU distributions. Compiling - and linking in this code is a waste when using the GNU C library - (especially if it is a shared library). Rather than having every GNU - program understand `configure --with-gnu-libc' and omit the object files, - it is simpler to just do this in the source for each such file. */ - -/* CYGNUS LOCAL. No, don't comment the code out. We will be using - ../include/obstack.h, which was changed relatively recently in a - way that is not binary compatible. Until we feel confident that - nobody is using the old obstack.c code, force the use of this code. - This issue will arise anytime a change is made which is not binary - compatible. -#if defined (_LIBC) || !defined (__GNU_LIBRARY__) -*/ -#if 1 - - -#ifdef __STDC__ -#define POINTER void * -#else -#define POINTER char * -#endif - -/* Determine default alignment. */ -struct fooalign {char x; double d;}; -#define DEFAULT_ALIGNMENT \ - ((PTR_INT_TYPE) ((char *)&((struct fooalign *) 0)->d - (char *)0)) -/* If malloc were really smart, it would round addresses to DEFAULT_ALIGNMENT. - But in fact it might be less smart and round addresses to as much as - DEFAULT_ROUNDING. So we prepare for it to do that. */ -union fooround {long x; double d;}; -#define DEFAULT_ROUNDING (sizeof (union fooround)) - -/* When we copy a long block of data, this is the unit to do it with. - On some machines, copying successive ints does not work; - in such a case, redefine COPYING_UNIT to `long' (if that works) - or `char' as a last resort. */ -#ifndef COPYING_UNIT -#define COPYING_UNIT int -#endif - -/* The non-GNU-C macros copy the obstack into this global variable - to avoid multiple evaluation. */ - -struct obstack *_obstack; - -/* Define a macro that either calls functions with the traditional malloc/free - calling interface, or calls functions with the mmalloc/mfree interface - (that adds an extra first argument), based on the state of use_extra_arg. - For free, do not use ?:, since some compilers, like the MIPS compilers, - do not allow (expr) ? void : void. */ - -#define CALL_CHUNKFUN(h, size) \ - (((h) -> use_extra_arg) \ - ? (*(h)->chunkfun) ((h)->extra_arg, (size)) \ - : (*(h)->chunkfun) ((size))) - -#define CALL_FREEFUN(h, old_chunk) \ - do { \ - if ((h) -> use_extra_arg) \ - (*(h)->freefun) ((h)->extra_arg, (old_chunk)); \ - else \ - (*(h)->freefun) ((old_chunk)); \ - } while (0) - - -/* Initialize an obstack H for use. Specify chunk size SIZE (0 means default). - Objects start on multiples of ALIGNMENT (0 means use default). - CHUNKFUN is the function to use to allocate chunks, - and FREEFUN the function to free them. - - Return nonzero if successful, zero if out of memory. - To recover from an out of memory error, - free up some memory, then call this again. */ - -int -_obstack_begin (h, size, alignment, chunkfun, freefun) - struct obstack *h; - int size; - int alignment; - POINTER (*chunkfun) (); - void (*freefun) (); -{ - register struct _obstack_chunk* chunk; /* points to new chunk */ - - if (alignment == 0) - alignment = DEFAULT_ALIGNMENT; - if (size == 0) - /* Default size is what GNU malloc can fit in a 4096-byte block. */ - { - /* 12 is sizeof (mhead) and 4 is EXTRA from GNU malloc. - Use the values for range checking, because if range checking is off, - the extra bytes won't be missed terribly, but if range checking is on - and we used a larger request, a whole extra 4096 bytes would be - allocated. - - These number are irrelevant to the new GNU malloc. I suspect it is - less sensitive to the size of the request. */ - int extra = ((((12 + DEFAULT_ROUNDING - 1) & ~(DEFAULT_ROUNDING - 1)) - + 4 + DEFAULT_ROUNDING - 1) - & ~(DEFAULT_ROUNDING - 1)); - size = 4096 - extra; - } - - h->chunkfun = (struct _obstack_chunk * (*)()) chunkfun; - h->freefun = freefun; - h->chunk_size = size; - h->alignment_mask = alignment - 1; - h->use_extra_arg = 0; - - chunk = h->chunk = CALL_CHUNKFUN (h, h -> chunk_size); - if (!chunk) - { - h->alloc_failed = 1; - return 0; - } - h->alloc_failed = 0; - h->next_free = h->object_base = chunk->contents; - h->chunk_limit = chunk->limit - = (char *) chunk + h->chunk_size; - chunk->prev = 0; - /* The initial chunk now contains no empty object. */ - h->maybe_empty_object = 0; - return 1; -} - -int -_obstack_begin_1 (h, size, alignment, chunkfun, freefun, arg) - struct obstack *h; - int size; - int alignment; - POINTER (*chunkfun) (); - void (*freefun) (); - POINTER arg; -{ - register struct _obstack_chunk* chunk; /* points to new chunk */ - - if (alignment == 0) - alignment = DEFAULT_ALIGNMENT; - if (size == 0) - /* Default size is what GNU malloc can fit in a 4096-byte block. */ - { - /* 12 is sizeof (mhead) and 4 is EXTRA from GNU malloc. - Use the values for range checking, because if range checking is off, - the extra bytes won't be missed terribly, but if range checking is on - and we used a larger request, a whole extra 4096 bytes would be - allocated. - - These number are irrelevant to the new GNU malloc. I suspect it is - less sensitive to the size of the request. */ - int extra = ((((12 + DEFAULT_ROUNDING - 1) & ~(DEFAULT_ROUNDING - 1)) - + 4 + DEFAULT_ROUNDING - 1) - & ~(DEFAULT_ROUNDING - 1)); - size = 4096 - extra; - } - - h->chunkfun = (struct _obstack_chunk * (*)()) chunkfun; - h->freefun = freefun; - h->chunk_size = size; - h->alignment_mask = alignment - 1; - h->extra_arg = arg; - h->use_extra_arg = 1; - - chunk = h->chunk = CALL_CHUNKFUN (h, h -> chunk_size); - if (!chunk) - { - h->alloc_failed = 1; - return 0; - } - h->alloc_failed = 0; - h->next_free = h->object_base = chunk->contents; - h->chunk_limit = chunk->limit - = (char *) chunk + h->chunk_size; - chunk->prev = 0; - /* The initial chunk now contains no empty object. */ - h->maybe_empty_object = 0; - return 1; -} - -/* Allocate a new current chunk for the obstack *H - on the assumption that LENGTH bytes need to be added - to the current object, or a new object of length LENGTH allocated. - Copies any partial object from the end of the old chunk - to the beginning of the new one. */ - -void -_obstack_newchunk (h, length) - struct obstack *h; - int length; -{ - register struct _obstack_chunk* old_chunk = h->chunk; - register struct _obstack_chunk* new_chunk; - register long new_size; - register int obj_size = h->next_free - h->object_base; - register int i; - int already; - - /* Compute size for new chunk. */ - new_size = (obj_size + length) + (obj_size >> 3) + 100; - if (new_size < h->chunk_size) - new_size = h->chunk_size; - - /* Allocate and initialize the new chunk. */ - new_chunk = CALL_CHUNKFUN (h, new_size); - if (!new_chunk) - { - h->alloc_failed = 1; - return; - } - h->alloc_failed = 0; - h->chunk = new_chunk; - new_chunk->prev = old_chunk; - new_chunk->limit = h->chunk_limit = (char *) new_chunk + new_size; - - /* Move the existing object to the new chunk. - Word at a time is fast and is safe if the object - is sufficiently aligned. */ - if (h->alignment_mask + 1 >= DEFAULT_ALIGNMENT) - { - for (i = obj_size / sizeof (COPYING_UNIT) - 1; - i >= 0; i--) - ((COPYING_UNIT *)new_chunk->contents)[i] - = ((COPYING_UNIT *)h->object_base)[i]; - /* We used to copy the odd few remaining bytes as one extra COPYING_UNIT, - but that can cross a page boundary on a machine - which does not do strict alignment for COPYING_UNITS. */ - already = obj_size / sizeof (COPYING_UNIT) * sizeof (COPYING_UNIT); - } - else - already = 0; - /* Copy remaining bytes one by one. */ - for (i = already; i < obj_size; i++) - new_chunk->contents[i] = h->object_base[i]; - - /* If the object just copied was the only data in OLD_CHUNK, - free that chunk and remove it from the chain. - But not if that chunk might contain an empty object. */ - if (h->object_base == old_chunk->contents && ! h->maybe_empty_object) - { - new_chunk->prev = old_chunk->prev; - CALL_FREEFUN (h, old_chunk); - } - - h->object_base = new_chunk->contents; - h->next_free = h->object_base + obj_size; - /* The new chunk certainly contains no empty object yet. */ - h->maybe_empty_object = 0; -} - -/* Return nonzero if object OBJ has been allocated from obstack H. - This is here for debugging. - If you use it in a program, you are probably losing. */ - -#ifdef __STDC__ -/* Suppress -Wmissing-prototypes warning. We don't want to declare this in - obstack.h because it is just for debugging. */ -int _obstack_allocated_p (struct obstack *h, POINTER obj); -#endif - -int -_obstack_allocated_p (h, obj) - struct obstack *h; - POINTER obj; -{ - register struct _obstack_chunk* lp; /* below addr of any objects in this chunk */ - register struct _obstack_chunk* plp; /* point to previous chunk if any */ - - lp = (h)->chunk; - /* We use >= rather than > since the object cannot be exactly at - the beginning of the chunk but might be an empty object exactly - at the end of an adjacent chunk. */ - while (lp != 0 && ((POINTER)lp >= obj || (POINTER)(lp)->limit < obj)) - { - plp = lp->prev; - lp = plp; - } - return lp != 0; -} - -/* Free objects in obstack H, including OBJ and everything allocate - more recently than OBJ. If OBJ is zero, free everything in H. */ - -#undef obstack_free - -/* This function has two names with identical definitions. - This is the first one, called from non-ANSI code. */ - -void -_obstack_free (h, obj) - struct obstack *h; - POINTER obj; -{ - register struct _obstack_chunk* lp; /* below addr of any objects in this chunk */ - register struct _obstack_chunk* plp; /* point to previous chunk if any */ - - lp = h->chunk; - /* We use >= because there cannot be an object at the beginning of a chunk. - But there can be an empty object at that address - at the end of another chunk. */ - while (lp != 0 && ((POINTER)lp >= obj || (POINTER)(lp)->limit < obj)) - { - plp = lp->prev; - CALL_FREEFUN (h, lp); - lp = plp; - /* If we switch chunks, we can't tell whether the new current - chunk contains an empty object, so assume that it may. */ - h->maybe_empty_object = 1; - } - if (lp) - { - h->object_base = h->next_free = (char *)(obj); - h->chunk_limit = lp->limit; - h->chunk = lp; - } - else if (obj != 0) - /* obj is not in any of the chunks! */ - abort (); -} - -/* This function is used from ANSI code. */ - -void -obstack_free (h, obj) - struct obstack *h; - POINTER obj; -{ - register struct _obstack_chunk* lp; /* below addr of any objects in this chunk */ - register struct _obstack_chunk* plp; /* point to previous chunk if any */ - - lp = h->chunk; - /* We use >= because there cannot be an object at the beginning of a chunk. - But there can be an empty object at that address - at the end of another chunk. */ - while (lp != 0 && ((POINTER)lp >= obj || (POINTER)(lp)->limit < obj)) - { - plp = lp->prev; - CALL_FREEFUN (h, lp); - lp = plp; - /* If we switch chunks, we can't tell whether the new current - chunk contains an empty object, so assume that it may. */ - h->maybe_empty_object = 1; - } - if (lp) - { - h->object_base = h->next_free = (char *)(obj); - h->chunk_limit = lp->limit; - h->chunk = lp; - } - else if (obj != 0) - /* obj is not in any of the chunks! */ - abort (); -} - -int -_obstack_memory_used (h) - struct obstack *h; -{ - register struct _obstack_chunk* lp; - register int nbytes = 0; - - for (lp = h->chunk; lp != 0; lp = lp->prev) - { - nbytes += lp->limit - (char *) lp; - } - return nbytes; -} - -#if 0 -/* These are now turned off because the applications do not use it - and it uses bcopy via obstack_grow, which causes trouble on sysV. */ - -/* Now define the functional versions of the obstack macros. - Define them to simply use the corresponding macros to do the job. */ - -#ifdef __STDC__ -/* These function definitions do not work with non-ANSI preprocessors; - they won't pass through the macro names in parentheses. */ - -/* The function names appear in parentheses in order to prevent - the macro-definitions of the names from being expanded there. */ - -POINTER (obstack_base) (obstack) - struct obstack *obstack; -{ - return obstack_base (obstack); -} - -POINTER (obstack_next_free) (obstack) - struct obstack *obstack; -{ - return obstack_next_free (obstack); -} - -int (obstack_object_size) (obstack) - struct obstack *obstack; -{ - return obstack_object_size (obstack); -} - -int (obstack_room) (obstack) - struct obstack *obstack; -{ - return obstack_room (obstack); -} - -void (obstack_grow) (obstack, pointer, length) - struct obstack *obstack; - POINTER pointer; - int length; -{ - obstack_grow (obstack, pointer, length); -} - -void (obstack_grow0) (obstack, pointer, length) - struct obstack *obstack; - POINTER pointer; - int length; -{ - obstack_grow0 (obstack, pointer, length); -} - -void (obstack_1grow) (obstack, character) - struct obstack *obstack; - int character; -{ - obstack_1grow (obstack, character); -} - -void (obstack_blank) (obstack, length) - struct obstack *obstack; - int length; -{ - obstack_blank (obstack, length); -} - -void (obstack_1grow_fast) (obstack, character) - struct obstack *obstack; - int character; -{ - obstack_1grow_fast (obstack, character); -} - -void (obstack_blank_fast) (obstack, length) - struct obstack *obstack; - int length; -{ - obstack_blank_fast (obstack, length); -} - -POINTER (obstack_finish) (obstack) - struct obstack *obstack; -{ - return obstack_finish (obstack); -} - -POINTER (obstack_alloc) (obstack, length) - struct obstack *obstack; - int length; -{ - return obstack_alloc (obstack, length); -} - -POINTER (obstack_copy) (obstack, pointer, length) - struct obstack *obstack; - POINTER pointer; - int length; -{ - return obstack_copy (obstack, pointer, length); -} - -POINTER (obstack_copy0) (obstack, pointer, length) - struct obstack *obstack; - POINTER pointer; - int length; -{ - return obstack_copy0 (obstack, pointer, length); -} - -#endif /* __STDC__ */ - -#endif /* 0 */ - -#endif /* _LIBC or not __GNU_LIBRARY__. */ diff --git a/contrib/gdb/libiberty/random.c b/contrib/gdb/libiberty/random.c deleted file mode 100644 index e205719..0000000 --- a/contrib/gdb/libiberty/random.c +++ /dev/null @@ -1,373 +0,0 @@ -/* - * Copyright (c) 1983 Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms are permitted - * provided that the above copyright notice and this paragraph are - * duplicated in all such forms and that any documentation, - * advertising materials, and other materials related to such - * distribution and use acknowledge that the software was developed - * by the University of California, Berkeley. The name of the - * University may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED - * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. - */ - -/* - * This is derived from the Berkeley source: - * @(#)random.c 5.5 (Berkeley) 7/6/88 - * It was reworked for the GNU C Library by Roland McGrath. - */ - -#include - -#if 0 - -#include -#include -#include -#include - -#else - -#define ULONG_MAX ((unsigned long)(~0L)) /* 0xFFFFFFFF for 32-bits */ -#define LONG_MAX ((long)(ULONG_MAX >> 1)) /* 0x7FFFFFFF for 32-bits*/ - -#ifdef __STDC__ -# define PTR void * -# define NULL (void *) 0 -#else -# define PTR char * -# define NULL 0 -#endif - -#endif - -long int random (); - -/* An improved random number generation package. In addition to the standard - rand()/srand() like interface, this package also has a special state info - interface. The initstate() routine is called with a seed, an array of - bytes, and a count of how many bytes are being passed in; this array is - then initialized to contain information for random number generation with - that much state information. Good sizes for the amount of state - information are 32, 64, 128, and 256 bytes. The state can be switched by - calling the setstate() function with the same array as was initiallized - with initstate(). By default, the package runs with 128 bytes of state - information and generates far better random numbers than a linear - congruential generator. If the amount of state information is less than - 32 bytes, a simple linear congruential R.N.G. is used. Internally, the - state information is treated as an array of longs; the zeroeth element of - the array is the type of R.N.G. being used (small integer); the remainder - of the array is the state information for the R.N.G. Thus, 32 bytes of - state information will give 7 longs worth of state information, which will - allow a degree seven polynomial. (Note: The zeroeth word of state - information also has some other information stored in it; see setstate - for details). The random number generation technique is a linear feedback - shift register approach, employing trinomials (since there are fewer terms - to sum up that way). In this approach, the least significant bit of all - the numbers in the state table will act as a linear feedback shift register, - and will have period 2^deg - 1 (where deg is the degree of the polynomial - being used, assuming that the polynomial is irreducible and primitive). - The higher order bits will have longer periods, since their values are - also influenced by pseudo-random carries out of the lower bits. The - total period of the generator is approximately deg*(2**deg - 1); thus - doubling the amount of state information has a vast influence on the - period of the generator. Note: The deg*(2**deg - 1) is an approximation - only good for large deg, when the period of the shift register is the - dominant factor. With deg equal to seven, the period is actually much - longer than the 7*(2**7 - 1) predicted by this formula. */ - - - -/* For each of the currently supported random number generators, we have a - break value on the amount of state information (you need at least thi - bytes of state info to support this random number generator), a degree for - the polynomial (actually a trinomial) that the R.N.G. is based on, and - separation between the two lower order coefficients of the trinomial. */ - -/* Linear congruential. */ -#define TYPE_0 0 -#define BREAK_0 8 -#define DEG_0 0 -#define SEP_0 0 - -/* x**7 + x**3 + 1. */ -#define TYPE_1 1 -#define BREAK_1 32 -#define DEG_1 7 -#define SEP_1 3 - -/* x**15 + x + 1. */ -#define TYPE_2 2 -#define BREAK_2 64 -#define DEG_2 15 -#define SEP_2 1 - -/* x**31 + x**3 + 1. */ -#define TYPE_3 3 -#define BREAK_3 128 -#define DEG_3 31 -#define SEP_3 3 - -/* x**63 + x + 1. */ -#define TYPE_4 4 -#define BREAK_4 256 -#define DEG_4 63 -#define SEP_4 1 - - -/* Array versions of the above information to make code run faster. - Relies on fact that TYPE_i == i. */ - -#define MAX_TYPES 5 /* Max number of types above. */ - -static int degrees[MAX_TYPES] = { DEG_0, DEG_1, DEG_2, DEG_3, DEG_4 }; -static int seps[MAX_TYPES] = { SEP_0, SEP_1, SEP_2, SEP_3, SEP_4 }; - - - -/* Initially, everything is set up as if from: - initstate(1, randtbl, 128); - Note that this initialization takes advantage of the fact that srandom - advances the front and rear pointers 10*rand_deg times, and hence the - rear pointer which starts at 0 will also end up at zero; thus the zeroeth - element of the state information, which contains info about the current - position of the rear pointer is just - (MAX_TYPES * (rptr - state)) + TYPE_3 == TYPE_3. */ - -static long int randtbl[DEG_3 + 1] = - { TYPE_3, - 0x9a319039, 0x32d9c024, 0x9b663182, 0x5da1f342, - 0xde3b81e0, 0xdf0a6fb5, 0xf103bc02, 0x48f340fb, - 0x7449e56b, 0xbeb1dbb0, 0xab5c5918, 0x946554fd, - 0x8c2e680f, 0xeb3d799f, 0xb11ee0b7, 0x2d436b86, - 0xda672e2a, 0x1588ca88, 0xe369735d, 0x904f35f7, - 0xd7158fd6, 0x6fa6f051, 0x616e6b96, 0xac94efdc, - 0x36413f93, 0xc622c298, 0xf5a42ab8, 0x8a88d77b, - 0xf5ad9d0e, 0x8999220b, 0x27fb47b9 - }; - -/* FPTR and RPTR are two pointers into the state info, a front and a rear - pointer. These two pointers are always rand_sep places aparts, as they - cycle through the state information. (Yes, this does mean we could get - away with just one pointer, but the code for random is more efficient - this way). The pointers are left positioned as they would be from the call: - initstate(1, randtbl, 128); - (The position of the rear pointer, rptr, is really 0 (as explained above - in the initialization of randtbl) because the state table pointer is set - to point to randtbl[1] (as explained below).) */ - -static long int *fptr = &randtbl[SEP_3 + 1]; -static long int *rptr = &randtbl[1]; - - - -/* The following things are the pointer to the state information table, - the type of the current generator, the degree of the current polynomial - being used, and the separation between the two pointers. - Note that for efficiency of random, we remember the first location of - the state information, not the zeroeth. Hence it is valid to access - state[-1], which is used to store the type of the R.N.G. - Also, we remember the last location, since this is more efficient than - indexing every time to find the address of the last element to see if - the front and rear pointers have wrapped. */ - -static long int *state = &randtbl[1]; - -static int rand_type = TYPE_3; -static int rand_deg = DEG_3; -static int rand_sep = SEP_3; - -static long int *end_ptr = &randtbl[sizeof(randtbl) / sizeof(randtbl[0])]; - -/* Initialize the random number generator based on the given seed. If the - type is the trivial no-state-information type, just remember the seed. - Otherwise, initializes state[] based on the given "seed" via a linear - congruential generator. Then, the pointers are set to known locations - that are exactly rand_sep places apart. Lastly, it cycles the state - information a given number of times to get rid of any initial dependencies - introduced by the L.C.R.N.G. Note that the initialization of randtbl[] - for default usage relies on values produced by this routine. */ -void -srandom (x) - unsigned int x; -{ - state[0] = x; - if (rand_type != TYPE_0) - { - register long int i; - for (i = 1; i < rand_deg; ++i) - state[i] = (1103515145 * state[i - 1]) + 12345; - fptr = &state[rand_sep]; - rptr = &state[0]; - for (i = 0; i < 10 * rand_deg; ++i) - random(); - } -} - -/* Initialize the state information in the given array of N bytes for - future random number generation. Based on the number of bytes we - are given, and the break values for the different R.N.G.'s, we choose - the best (largest) one we can and set things up for it. srandom is - then called to initialize the state information. Note that on return - from srandom, we set state[-1] to be the type multiplexed with the current - value of the rear pointer; this is so successive calls to initstate won't - lose this information and will be able to restart with setstate. - Note: The first thing we do is save the current state, if any, just like - setstate so that it doesn't matter when initstate is called. - Returns a pointer to the old state. */ -PTR -initstate (seed, arg_state, n) - unsigned int seed; - PTR arg_state; - unsigned long n; -{ - PTR ostate = (PTR) &state[-1]; - - if (rand_type == TYPE_0) - state[-1] = rand_type; - else - state[-1] = (MAX_TYPES * (rptr - state)) + rand_type; - if (n < BREAK_1) - { - if (n < BREAK_0) - { - errno = EINVAL; - return NULL; - } - rand_type = TYPE_0; - rand_deg = DEG_0; - rand_sep = SEP_0; - } - else if (n < BREAK_2) - { - rand_type = TYPE_1; - rand_deg = DEG_1; - rand_sep = SEP_1; - } - else if (n < BREAK_3) - { - rand_type = TYPE_2; - rand_deg = DEG_2; - rand_sep = SEP_2; - } - else if (n < BREAK_4) - { - rand_type = TYPE_3; - rand_deg = DEG_3; - rand_sep = SEP_3; - } - else - { - rand_type = TYPE_4; - rand_deg = DEG_4; - rand_sep = SEP_4; - } - - state = &((long int *) arg_state)[1]; /* First location. */ - /* Must set END_PTR before srandom. */ - end_ptr = &state[rand_deg]; - srandom(seed); - if (rand_type == TYPE_0) - state[-1] = rand_type; - else - state[-1] = (MAX_TYPES * (rptr - state)) + rand_type; - - return ostate; -} - -/* Restore the state from the given state array. - Note: It is important that we also remember the locations of the pointers - in the current state information, and restore the locations of the pointers - from the old state information. This is done by multiplexing the pointer - location into the zeroeth word of the state information. Note that due - to the order in which things are done, it is OK to call setstate with the - same state as the current state - Returns a pointer to the old state information. */ - -PTR -setstate (arg_state) - PTR arg_state; -{ - register long int *new_state = (long int *) arg_state; - register int type = new_state[0] % MAX_TYPES; - register int rear = new_state[0] / MAX_TYPES; - PTR ostate = (PTR) &state[-1]; - - if (rand_type == TYPE_0) - state[-1] = rand_type; - else - state[-1] = (MAX_TYPES * (rptr - state)) + rand_type; - - switch (type) - { - case TYPE_0: - case TYPE_1: - case TYPE_2: - case TYPE_3: - case TYPE_4: - rand_type = type; - rand_deg = degrees[type]; - rand_sep = seps[type]; - break; - default: - /* State info munged. */ - errno = EINVAL; - return NULL; - } - - state = &new_state[1]; - if (rand_type != TYPE_0) - { - rptr = &state[rear]; - fptr = &state[(rear + rand_sep) % rand_deg]; - } - /* Set end_ptr too. */ - end_ptr = &state[rand_deg]; - - return ostate; -} - -/* If we are using the trivial TYPE_0 R.N.G., just do the old linear - congruential bit. Otherwise, we do our fancy trinomial stuff, which is the - same in all ther other cases due to all the global variables that have been - set up. The basic operation is to add the number at the rear pointer into - the one at the front pointer. Then both pointers are advanced to the next - location cyclically in the table. The value returned is the sum generated, - reduced to 31 bits by throwing away the "least random" low bit. - Note: The code takes advantage of the fact that both the front and - rear pointers can't wrap on the same call by not testing the rear - pointer if the front one has wrapped. Returns a 31-bit random number. */ - -long int -random () -{ - if (rand_type == TYPE_0) - { - state[0] = ((state[0] * 1103515245) + 12345) & LONG_MAX; - return state[0]; - } - else - { - long int i; - *fptr += *rptr; - /* Chucking least random bit. */ - i = (*fptr >> 1) & LONG_MAX; - ++fptr; - if (fptr >= end_ptr) - { - fptr = state; - ++rptr; - } - else - { - ++rptr; - if (rptr >= end_ptr) - rptr = state; - } - return i; - } -} diff --git a/contrib/gdb/libiberty/rename.c b/contrib/gdb/libiberty/rename.c deleted file mode 100644 index ae26e2d..0000000 --- a/contrib/gdb/libiberty/rename.c +++ /dev/null @@ -1,22 +0,0 @@ -/* rename -- rename a file - This function is in the public domain. */ - -/* Rename a file. */ - -#include - -int -rename (zfrom, zto) - char *zfrom; - char *zto; -{ - if (link (zfrom, zto) < 0) - { - if (errno != EEXIST) - return -1; - if (unlink (zto) < 0 - || link (zfrom, zto) < 0) - return -1; - } - return unlink (zfrom); -} diff --git a/contrib/gdb/libiberty/rindex.c b/contrib/gdb/libiberty/rindex.c deleted file mode 100644 index 061d126..0000000 --- a/contrib/gdb/libiberty/rindex.c +++ /dev/null @@ -1,11 +0,0 @@ -/* Stub implementation of (obsolete) rindex(). */ - -extern char *strrchr (); - -char * -rindex (s, c) - char *s; - int c; -{ - return strrchr (s, c); -} diff --git a/contrib/gdb/libiberty/sigsetmask.c b/contrib/gdb/libiberty/sigsetmask.c deleted file mode 100644 index 2a09e6a..0000000 --- a/contrib/gdb/libiberty/sigsetmask.c +++ /dev/null @@ -1,30 +0,0 @@ -/* Version of sigsetmask.c - Written by Steve Chamberlain (sac@cygnus.com). - Contributed by Cygnus Support. - This file is in the public doamin. */ - -/* Set the current signal mask to the set provided, and return the - previous value */ - -#define _POSIX_SOURCE -#include -/* Including seems to be needed by ISC. */ -#include -#include - -#ifdef SIG_SETMASK -int -DEFUN(sigsetmask,(set), - int set) -{ - sigset_t new; - sigset_t old; - - sigemptyset (&new); - if (set != 0) { - abort(); /* FIXME, we don't know how to translate old mask to new */ - } - sigprocmask(SIG_SETMASK, &new, &old); - return 1; /* FIXME, we always return 1 as old value. */ -} -#endif diff --git a/contrib/gdb/libiberty/spaces.c b/contrib/gdb/libiberty/spaces.c deleted file mode 100644 index 7ea8532..0000000 --- a/contrib/gdb/libiberty/spaces.c +++ /dev/null @@ -1,71 +0,0 @@ -/* Allocate memory region filled with spaces. - Copyright (C) 1991 Free Software Foundation, Inc. - -This file is part of the libiberty library. -Libiberty is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public -License as published by the Free Software Foundation; either -version 2 of the License, or (at your option) any later version. - -Libiberty 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 -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with libiberty; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* - -NAME - - spaces -- return a pointer to a buffer full of spaces - -SYNOPSIS - - char *spaces (int count) - -DESCRIPTION - - Returns a pointer to a memory region filled with the specified - number of spaces and null terminated. The returned pointer is - valid until at least the next call. - -BUGS - -*/ - -#include "ansidecl.h" -#include "libiberty.h" - -const char * -spaces (count) - int count; -{ - register char *t; - static char *buf; - static int maxsize; - extern char *malloc (); - extern void free (); - - if (count > maxsize) - { - if (buf) - { - free (buf); - } - buf = malloc (count + 1); - if (buf == (char *) 0) - return 0; - for (t = buf + count ; t != buf ; ) - { - *--t = ' '; - } - maxsize = count; - buf[count] = '\0'; - } - return (const char *) (buf + maxsize - count); -} - diff --git a/contrib/gdb/libiberty/strcasecmp.c b/contrib/gdb/libiberty/strcasecmp.c deleted file mode 100644 index 53387ca..0000000 --- a/contrib/gdb/libiberty/strcasecmp.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 1987 Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms are permitted - * provided that this notice is preserved and that due credit is given - * to the University of California at Berkeley. The name of the University - * may not be used to endorse or promote products derived from this - * software without specific written prior permission. This software - * is provided ``as is'' without express or implied warranty. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)strcasecmp.c 5.5 (Berkeley) 11/24/87"; -#endif /* LIBC_SCCS and not lint */ - -#include -#ifdef __STDC__ -#include -#else -#define size_t unsigned long -#endif - -/* - * This array is designed for mapping upper and lower case letter - * together for a case independent comparison. The mappings are - * based upon ascii character sequences. - */ -static unsigned char charmap[] = { - '\000', '\001', '\002', '\003', '\004', '\005', '\006', '\007', - '\010', '\011', '\012', '\013', '\014', '\015', '\016', '\017', - '\020', '\021', '\022', '\023', '\024', '\025', '\026', '\027', - '\030', '\031', '\032', '\033', '\034', '\035', '\036', '\037', - '\040', '\041', '\042', '\043', '\044', '\045', '\046', '\047', - '\050', '\051', '\052', '\053', '\054', '\055', '\056', '\057', - '\060', '\061', '\062', '\063', '\064', '\065', '\066', '\067', - '\070', '\071', '\072', '\073', '\074', '\075', '\076', '\077', - '\100', '\141', '\142', '\143', '\144', '\145', '\146', '\147', - '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157', - '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167', - '\170', '\171', '\172', '\133', '\134', '\135', '\136', '\137', - '\140', '\141', '\142', '\143', '\144', '\145', '\146', '\147', - '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157', - '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167', - '\170', '\171', '\172', '\173', '\174', '\175', '\176', '\177', - '\200', '\201', '\202', '\203', '\204', '\205', '\206', '\207', - '\210', '\211', '\212', '\213', '\214', '\215', '\216', '\217', - '\220', '\221', '\222', '\223', '\224', '\225', '\226', '\227', - '\230', '\231', '\232', '\233', '\234', '\235', '\236', '\237', - '\240', '\241', '\242', '\243', '\244', '\245', '\246', '\247', - '\250', '\251', '\252', '\253', '\254', '\255', '\256', '\257', - '\260', '\261', '\262', '\263', '\264', '\265', '\266', '\267', - '\270', '\271', '\272', '\273', '\274', '\275', '\276', '\277', - '\300', '\341', '\342', '\343', '\344', '\345', '\346', '\347', - '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357', - '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367', - '\370', '\371', '\372', '\333', '\334', '\335', '\336', '\337', - '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347', - '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357', - '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367', - '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\377', -}; - -int -strcasecmp(s1, s2) - const char *s1, *s2; -{ - register unsigned char u1, u2; - - for (;;) { - u1 = (unsigned char) *s1++; - u2 = (unsigned char) *s2++; - if (charmap[u1] != charmap[u2]) { - return charmap[u1] - charmap[u2]; - } - if (u1 == '\0') { - return 0; - } - } -} - diff --git a/contrib/gdb/libiberty/strchr.c b/contrib/gdb/libiberty/strchr.c deleted file mode 100644 index 22976ce..0000000 --- a/contrib/gdb/libiberty/strchr.c +++ /dev/null @@ -1,34 +0,0 @@ -/* Portable version of strchr() - This function is in the public domain. */ - -/* -NAME - strchr -- return pointer to first occurance of a character - -SYNOPSIS - char *strchr (const char *s, int c) - -DESCRIPTION - Returns a pointer to the first occurance of character C in - string S, or a NULL pointer if no occurance is found. - -BUGS - Behavior when character is the null character is implementation - dependent. -*/ - -#include - -char * -strchr (s, c) - register CONST char *s; - int c; -{ - do { - if (*s == c) - { - return (char*)s; - } - } while (*s++); - return (0); -} diff --git a/contrib/gdb/libiberty/strdup.c b/contrib/gdb/libiberty/strdup.c deleted file mode 100644 index 1785b34..0000000 --- a/contrib/gdb/libiberty/strdup.c +++ /dev/null @@ -1,10 +0,0 @@ -char * -strdup(s) - char *s; -{ - char *result = (char*)malloc(strlen(s) + 1); - if (result == (char*)0) - return (char*)0; - strcpy(result, s); - return result; -} diff --git a/contrib/gdb/libiberty/strerror.c b/contrib/gdb/libiberty/strerror.c deleted file mode 100644 index 9f3f92b..0000000 --- a/contrib/gdb/libiberty/strerror.c +++ /dev/null @@ -1,829 +0,0 @@ -/* Extended support for using errno values. - Written by Fred Fish. fnf@cygnus.com - This file is in the public domain. --Per Bothner. */ - -#include "ansidecl.h" -#include "libiberty.h" - -#include "config.h" - -#ifndef NEED_sys_errlist -/* Note that errno.h (not sure what OS) or stdio.h (BSD 4.4, at least) - might declare sys_errlist in a way that the compiler might consider - incompatible with our later declaration, perhaps by using const - attributes. So we hide the declaration in errno.h (if any) using a - macro. */ -#define sys_errlist sys_errlist__ -#endif - -#include -#include - -#ifndef NEED_sys_errlist -#undef sys_errlist -#endif - -/* Routines imported from standard C runtime libraries. */ - -#ifdef __STDC__ -#include -extern void *malloc (size_t size); /* 4.10.3.3 */ -extern void *memset (void *s, int c, size_t n); /* 4.11.6.1 */ -#else /* !__STDC__ */ -extern char *malloc (); /* Standard memory allocater */ -extern char *memset (); -#endif /* __STDC__ */ - -#ifndef MAX -# define MAX(a,b) ((a) > (b) ? (a) : (b)) -#endif - -/* Translation table for errno values. See intro(2) in most UNIX systems - Programmers Reference Manuals. - - Note that this table is generally only accessed when it is used at runtime - to initialize errno name and message tables that are indexed by errno - value. - - Not all of these errnos will exist on all systems. This table is the only - thing that should have to be updated as new error numbers are introduced. - It's sort of ugly, but at least its portable. */ - -struct error_info -{ - int value; /* The numeric value from */ - const char *name; /* The equivalent symbolic value */ -#ifdef NEED_sys_errlist - const char *msg; /* Short message about this value */ -#endif -}; - -#ifdef NEED_sys_errlist -# define ENTRY(value, name, msg) {value, name, msg} -#else -# define ENTRY(value, name, msg) {value, name} -#endif - -static const struct error_info error_table[] = -{ -#if defined (EPERM) - ENTRY(EPERM, "EPERM", "Not owner"), -#endif -#if defined (ENOENT) - ENTRY(ENOENT, "ENOENT", "No such file or directory"), -#endif -#if defined (ESRCH) - ENTRY(ESRCH, "ESRCH", "No such process"), -#endif -#if defined (EINTR) - ENTRY(EINTR, "EINTR", "Interrupted system call"), -#endif -#if defined (EIO) - ENTRY(EIO, "EIO", "I/O error"), -#endif -#if defined (ENXIO) - ENTRY(ENXIO, "ENXIO", "No such device or address"), -#endif -#if defined (E2BIG) - ENTRY(E2BIG, "E2BIG", "Arg list too long"), -#endif -#if defined (ENOEXEC) - ENTRY(ENOEXEC, "ENOEXEC", "Exec format error"), -#endif -#if defined (EBADF) - ENTRY(EBADF, "EBADF", "Bad file number"), -#endif -#if defined (ECHILD) - ENTRY(ECHILD, "ECHILD", "No child processes"), -#endif -#if defined (EWOULDBLOCK) /* Put before EAGAIN, sometimes aliased */ - ENTRY(EWOULDBLOCK, "EWOULDBLOCK", "Operation would block"), -#endif -#if defined (EAGAIN) - ENTRY(EAGAIN, "EAGAIN", "No more processes"), -#endif -#if defined (ENOMEM) - ENTRY(ENOMEM, "ENOMEM", "Not enough space"), -#endif -#if defined (EACCES) - ENTRY(EACCES, "EACCES", "Permission denied"), -#endif -#if defined (EFAULT) - ENTRY(EFAULT, "EFAULT", "Bad address"), -#endif -#if defined (ENOTBLK) - ENTRY(ENOTBLK, "ENOTBLK", "Block device required"), -#endif -#if defined (EBUSY) - ENTRY(EBUSY, "EBUSY", "Device busy"), -#endif -#if defined (EEXIST) - ENTRY(EEXIST, "EEXIST", "File exists"), -#endif -#if defined (EXDEV) - ENTRY(EXDEV, "EXDEV", "Cross-device link"), -#endif -#if defined (ENODEV) - ENTRY(ENODEV, "ENODEV", "No such device"), -#endif -#if defined (ENOTDIR) - ENTRY(ENOTDIR, "ENOTDIR", "Not a directory"), -#endif -#if defined (EISDIR) - ENTRY(EISDIR, "EISDIR", "Is a directory"), -#endif -#if defined (EINVAL) - ENTRY(EINVAL, "EINVAL", "Invalid argument"), -#endif -#if defined (ENFILE) - ENTRY(ENFILE, "ENFILE", "File table overflow"), -#endif -#if defined (EMFILE) - ENTRY(EMFILE, "EMFILE", "Too many open files"), -#endif -#if defined (ENOTTY) - ENTRY(ENOTTY, "ENOTTY", "Not a typewriter"), -#endif -#if defined (ETXTBSY) - ENTRY(ETXTBSY, "ETXTBSY", "Text file busy"), -#endif -#if defined (EFBIG) - ENTRY(EFBIG, "EFBIG", "File too large"), -#endif -#if defined (ENOSPC) - ENTRY(ENOSPC, "ENOSPC", "No space left on device"), -#endif -#if defined (ESPIPE) - ENTRY(ESPIPE, "ESPIPE", "Illegal seek"), -#endif -#if defined (EROFS) - ENTRY(EROFS, "EROFS", "Read-only file system"), -#endif -#if defined (EMLINK) - ENTRY(EMLINK, "EMLINK", "Too many links"), -#endif -#if defined (EPIPE) - ENTRY(EPIPE, "EPIPE", "Broken pipe"), -#endif -#if defined (EDOM) - ENTRY(EDOM, "EDOM", "Math argument out of domain of func"), -#endif -#if defined (ERANGE) - ENTRY(ERANGE, "ERANGE", "Math result not representable"), -#endif -#if defined (ENOMSG) - ENTRY(ENOMSG, "ENOMSG", "No message of desired type"), -#endif -#if defined (EIDRM) - ENTRY(EIDRM, "EIDRM", "Identifier removed"), -#endif -#if defined (ECHRNG) - ENTRY(ECHRNG, "ECHRNG", "Channel number out of range"), -#endif -#if defined (EL2NSYNC) - ENTRY(EL2NSYNC, "EL2NSYNC", "Level 2 not synchronized"), -#endif -#if defined (EL3HLT) - ENTRY(EL3HLT, "EL3HLT", "Level 3 halted"), -#endif -#if defined (EL3RST) - ENTRY(EL3RST, "EL3RST", "Level 3 reset"), -#endif -#if defined (ELNRNG) - ENTRY(ELNRNG, "ELNRNG", "Link number out of range"), -#endif -#if defined (EUNATCH) - ENTRY(EUNATCH, "EUNATCH", "Protocol driver not attached"), -#endif -#if defined (ENOCSI) - ENTRY(ENOCSI, "ENOCSI", "No CSI structure available"), -#endif -#if defined (EL2HLT) - ENTRY(EL2HLT, "EL2HLT", "Level 2 halted"), -#endif -#if defined (EDEADLK) - ENTRY(EDEADLK, "EDEADLK", "Deadlock condition"), -#endif -#if defined (ENOLCK) - ENTRY(ENOLCK, "ENOLCK", "No record locks available"), -#endif -#if defined (EBADE) - ENTRY(EBADE, "EBADE", "Invalid exchange"), -#endif -#if defined (EBADR) - ENTRY(EBADR, "EBADR", "Invalid request descriptor"), -#endif -#if defined (EXFULL) - ENTRY(EXFULL, "EXFULL", "Exchange full"), -#endif -#if defined (ENOANO) - ENTRY(ENOANO, "ENOANO", "No anode"), -#endif -#if defined (EBADRQC) - ENTRY(EBADRQC, "EBADRQC", "Invalid request code"), -#endif -#if defined (EBADSLT) - ENTRY(EBADSLT, "EBADSLT", "Invalid slot"), -#endif -#if defined (EDEADLOCK) - ENTRY(EDEADLOCK, "EDEADLOCK", "File locking deadlock error"), -#endif -#if defined (EBFONT) - ENTRY(EBFONT, "EBFONT", "Bad font file format"), -#endif -#if defined (ENOSTR) - ENTRY(ENOSTR, "ENOSTR", "Device not a stream"), -#endif -#if defined (ENODATA) - ENTRY(ENODATA, "ENODATA", "No data available"), -#endif -#if defined (ETIME) - ENTRY(ETIME, "ETIME", "Timer expired"), -#endif -#if defined (ENOSR) - ENTRY(ENOSR, "ENOSR", "Out of streams resources"), -#endif -#if defined (ENONET) - ENTRY(ENONET, "ENONET", "Machine is not on the network"), -#endif -#if defined (ENOPKG) - ENTRY(ENOPKG, "ENOPKG", "Package not installed"), -#endif -#if defined (EREMOTE) - ENTRY(EREMOTE, "EREMOTE", "Object is remote"), -#endif -#if defined (ENOLINK) - ENTRY(ENOLINK, "ENOLINK", "Link has been severed"), -#endif -#if defined (EADV) - ENTRY(EADV, "EADV", "Advertise error"), -#endif -#if defined (ESRMNT) - ENTRY(ESRMNT, "ESRMNT", "Srmount error"), -#endif -#if defined (ECOMM) - ENTRY(ECOMM, "ECOMM", "Communication error on send"), -#endif -#if defined (EPROTO) - ENTRY(EPROTO, "EPROTO", "Protocol error"), -#endif -#if defined (EMULTIHOP) - ENTRY(EMULTIHOP, "EMULTIHOP", "Multihop attempted"), -#endif -#if defined (EDOTDOT) - ENTRY(EDOTDOT, "EDOTDOT", "RFS specific error"), -#endif -#if defined (EBADMSG) - ENTRY(EBADMSG, "EBADMSG", "Not a data message"), -#endif -#if defined (ENAMETOOLONG) - ENTRY(ENAMETOOLONG, "ENAMETOOLONG", "File name too long"), -#endif -#if defined (EOVERFLOW) - ENTRY(EOVERFLOW, "EOVERFLOW", "Value too large for defined data type"), -#endif -#if defined (ENOTUNIQ) - ENTRY(ENOTUNIQ, "ENOTUNIQ", "Name not unique on network"), -#endif -#if defined (EBADFD) - ENTRY(EBADFD, "EBADFD", "File descriptor in bad state"), -#endif -#if defined (EREMCHG) - ENTRY(EREMCHG, "EREMCHG", "Remote address changed"), -#endif -#if defined (ELIBACC) - ENTRY(ELIBACC, "ELIBACC", "Can not access a needed shared library"), -#endif -#if defined (ELIBBAD) - ENTRY(ELIBBAD, "ELIBBAD", "Accessing a corrupted shared library"), -#endif -#if defined (ELIBSCN) - ENTRY(ELIBSCN, "ELIBSCN", ".lib section in a.out corrupted"), -#endif -#if defined (ELIBMAX) - ENTRY(ELIBMAX, "ELIBMAX", "Attempting to link in too many shared libraries"), -#endif -#if defined (ELIBEXEC) - ENTRY(ELIBEXEC, "ELIBEXEC", "Cannot exec a shared library directly"), -#endif -#if defined (EILSEQ) - ENTRY(EILSEQ, "EILSEQ", "Illegal byte sequence"), -#endif -#if defined (ENOSYS) - ENTRY(ENOSYS, "ENOSYS", "Operation not applicable"), -#endif -#if defined (ELOOP) - ENTRY(ELOOP, "ELOOP", "Too many symbolic links encountered"), -#endif -#if defined (ERESTART) - ENTRY(ERESTART, "ERESTART", "Interrupted system call should be restarted"), -#endif -#if defined (ESTRPIPE) - ENTRY(ESTRPIPE, "ESTRPIPE", "Streams pipe error"), -#endif -#if defined (ENOTEMPTY) - ENTRY(ENOTEMPTY, "ENOTEMPTY", "Directory not empty"), -#endif -#if defined (EUSERS) - ENTRY(EUSERS, "EUSERS", "Too many users"), -#endif -#if defined (ENOTSOCK) - ENTRY(ENOTSOCK, "ENOTSOCK", "Socket operation on non-socket"), -#endif -#if defined (EDESTADDRREQ) - ENTRY(EDESTADDRREQ, "EDESTADDRREQ", "Destination address required"), -#endif -#if defined (EMSGSIZE) - ENTRY(EMSGSIZE, "EMSGSIZE", "Message too long"), -#endif -#if defined (EPROTOTYPE) - ENTRY(EPROTOTYPE, "EPROTOTYPE", "Protocol wrong type for socket"), -#endif -#if defined (ENOPROTOOPT) - ENTRY(ENOPROTOOPT, "ENOPROTOOPT", "Protocol not available"), -#endif -#if defined (EPROTONOSUPPORT) - ENTRY(EPROTONOSUPPORT, "EPROTONOSUPPORT", "Protocol not supported"), -#endif -#if defined (ESOCKTNOSUPPORT) - ENTRY(ESOCKTNOSUPPORT, "ESOCKTNOSUPPORT", "Socket type not supported"), -#endif -#if defined (EOPNOTSUPP) - ENTRY(EOPNOTSUPP, "EOPNOTSUPP", "Operation not supported on transport endpoint"), -#endif -#if defined (EPFNOSUPPORT) - ENTRY(EPFNOSUPPORT, "EPFNOSUPPORT", "Protocol family not supported"), -#endif -#if defined (EAFNOSUPPORT) - ENTRY(EAFNOSUPPORT, "EAFNOSUPPORT", "Address family not supported by protocol"), -#endif -#if defined (EADDRINUSE) - ENTRY(EADDRINUSE, "EADDRINUSE", "Address already in use"), -#endif -#if defined (EADDRNOTAVAIL) - ENTRY(EADDRNOTAVAIL, "EADDRNOTAVAIL","Cannot assign requested address"), -#endif -#if defined (ENETDOWN) - ENTRY(ENETDOWN, "ENETDOWN", "Network is down"), -#endif -#if defined (ENETUNREACH) - ENTRY(ENETUNREACH, "ENETUNREACH", "Network is unreachable"), -#endif -#if defined (ENETRESET) - ENTRY(ENETRESET, "ENETRESET", "Network dropped connection because of reset"), -#endif -#if defined (ECONNABORTED) - ENTRY(ECONNABORTED, "ECONNABORTED", "Software caused connection abort"), -#endif -#if defined (ECONNRESET) - ENTRY(ECONNRESET, "ECONNRESET", "Connection reset by peer"), -#endif -#if defined (ENOBUFS) - ENTRY(ENOBUFS, "ENOBUFS", "No buffer space available"), -#endif -#if defined (EISCONN) - ENTRY(EISCONN, "EISCONN", "Transport endpoint is already connected"), -#endif -#if defined (ENOTCONN) - ENTRY(ENOTCONN, "ENOTCONN", "Transport endpoint is not connected"), -#endif -#if defined (ESHUTDOWN) - ENTRY(ESHUTDOWN, "ESHUTDOWN", "Cannot send after transport endpoint shutdown"), -#endif -#if defined (ETOOMANYREFS) - ENTRY(ETOOMANYREFS, "ETOOMANYREFS", "Too many references: cannot splice"), -#endif -#if defined (ETIMEDOUT) - ENTRY(ETIMEDOUT, "ETIMEDOUT", "Connection timed out"), -#endif -#if defined (ECONNREFUSED) - ENTRY(ECONNREFUSED, "ECONNREFUSED", "Connection refused"), -#endif -#if defined (EHOSTDOWN) - ENTRY(EHOSTDOWN, "EHOSTDOWN", "Host is down"), -#endif -#if defined (EHOSTUNREACH) - ENTRY(EHOSTUNREACH, "EHOSTUNREACH", "No route to host"), -#endif -#if defined (EALREADY) - ENTRY(EALREADY, "EALREADY", "Operation already in progress"), -#endif -#if defined (EINPROGRESS) - ENTRY(EINPROGRESS, "EINPROGRESS", "Operation now in progress"), -#endif -#if defined (ESTALE) - ENTRY(ESTALE, "ESTALE", "Stale NFS file handle"), -#endif -#if defined (EUCLEAN) - ENTRY(EUCLEAN, "EUCLEAN", "Structure needs cleaning"), -#endif -#if defined (ENOTNAM) - ENTRY(ENOTNAM, "ENOTNAM", "Not a XENIX named type file"), -#endif -#if defined (ENAVAIL) - ENTRY(ENAVAIL, "ENAVAIL", "No XENIX semaphores available"), -#endif -#if defined (EISNAM) - ENTRY(EISNAM, "EISNAM", "Is a named type file"), -#endif -#if defined (EREMOTEIO) - ENTRY(EREMOTEIO, "EREMOTEIO", "Remote I/O error"), -#endif - ENTRY(0, NULL, NULL) -}; - -#ifdef EVMSERR -/* This is not in the table, because the numeric value of EVMSERR (32767) - lies outside the range of sys_errlist[]. */ -static struct { int value; const char *name, *msg; } - evmserr = { EVMSERR, "EVMSERR", "VMS-specific error" }; -#endif - -/* Translation table allocated and initialized at runtime. Indexed by the - errno value to find the equivalent symbolic value. */ - -static const char **error_names; -static int num_error_names = 0; - -/* Translation table allocated and initialized at runtime, if it does not - already exist in the host environment. Indexed by the errno value to find - the descriptive string. - - We don't export it for use in other modules because even though it has the - same name, it differs from other implementations in that it is dynamically - initialized rather than statically initialized. */ - -#ifdef NEED_sys_errlist - -static int sys_nerr; -static const char **sys_errlist; - -#else - -extern int sys_nerr; -extern char *sys_errlist[]; - -#endif - - -/* - -NAME - - init_error_tables -- initialize the name and message tables - -SYNOPSIS - - static void init_error_tables (); - -DESCRIPTION - - Using the error_table, which is initialized at compile time, generate - the error_names and the sys_errlist (if needed) tables, which are - indexed at runtime by a specific errno value. - -BUGS - - The initialization of the tables may fail under low memory conditions, - in which case we don't do anything particularly useful, but we don't - bomb either. Who knows, it might succeed at a later point if we free - some memory in the meantime. In any case, the other routines know - how to deal with lack of a table after trying to initialize it. This - may or may not be considered to be a bug, that we don't specifically - warn about this particular failure mode. - -*/ - -static void -init_error_tables () -{ - const struct error_info *eip; - int nbytes; - - /* If we haven't already scanned the error_table once to find the maximum - errno value, then go find it now. */ - - if (num_error_names == 0) - { - for (eip = error_table; eip -> name != NULL; eip++) - { - if (eip -> value >= num_error_names) - { - num_error_names = eip -> value + 1; - } - } - } - - /* Now attempt to allocate the error_names table, zero it out, and then - initialize it from the statically initialized error_table. */ - - if (error_names == NULL) - { - nbytes = num_error_names * sizeof (char *); - if ((error_names = (const char **) malloc (nbytes)) != NULL) - { - memset (error_names, 0, nbytes); - for (eip = error_table; eip -> name != NULL; eip++) - { - error_names[eip -> value] = eip -> name; - } - } - } - -#ifdef NEED_sys_errlist - - /* Now attempt to allocate the sys_errlist table, zero it out, and then - initialize it from the statically initialized error_table. */ - - if (sys_errlist == NULL) - { - nbytes = num_error_names * sizeof (char *); - if ((sys_errlist = (const char **) malloc (nbytes)) != NULL) - { - memset (sys_errlist, 0, nbytes); - sys_nerr = num_error_names; - for (eip = error_table; eip -> name != NULL; eip++) - { - sys_errlist[eip -> value] = eip -> msg; - } - } - } - -#endif - -} - -/* - -NAME - - errno_max -- return the max errno value - -SYNOPSIS - - int errno_max (); - -DESCRIPTION - - Returns the maximum errno value for which a corresponding symbolic - name or message is available. Note that in the case where - we use the sys_errlist supplied by the system, it is possible for - there to be more symbolic names than messages, or vice versa. - In fact, the manual page for perror(3C) explicitly warns that one - should check the size of the table (sys_nerr) before indexing it, - since new error codes may be added to the system before they are - added to the table. Thus sys_nerr might be smaller than value - implied by the largest errno value defined in . - - We return the maximum value that can be used to obtain a meaningful - symbolic name or message. - -*/ - -int -errno_max () -{ - int maxsize; - - if (error_names == NULL) - { - init_error_tables (); - } - maxsize = MAX (sys_nerr, num_error_names); - return (maxsize - 1); -} - -#ifdef NEED_strerror - -/* - -NAME - - strerror -- map an error number to an error message string - -SYNOPSIS - - char *strerror (int errnoval) - -DESCRIPTION - - Maps an errno number to an error message string, the contents of - which are implementation defined. On systems which have the external - variables sys_nerr and sys_errlist, these strings will be the same - as the ones used by perror(). - - If the supplied error number is within the valid range of indices - for the sys_errlist, but no message is available for the particular - error number, then returns the string "Error NUM", where NUM is the - error number. - - If the supplied error number is not a valid index into sys_errlist, - returns NULL. - - The returned string is only guaranteed to be valid only until the - next call to strerror. - -*/ - -char * -strerror (errnoval) - int errnoval; -{ - char *msg; - static char buf[32]; - -#ifdef NEED_sys_errlist - - if (error_names == NULL) - { - init_error_tables (); - } - -#endif - - if ((errnoval < 0) || (errnoval >= sys_nerr)) - { -#ifdef EVMSERR - if (errnoval == evmserr.value) - msg = evmserr.msg; - else -#endif - /* Out of range, just return NULL */ - msg = NULL; - } - else if ((sys_errlist == NULL) || (sys_errlist[errnoval] == NULL)) - { - /* In range, but no sys_errlist or no entry at this index. */ - sprintf (buf, "Error %d", errnoval); - msg = buf; - } - else - { - /* In range, and a valid message. Just return the message. */ - msg = (char *) sys_errlist[errnoval]; - } - - return (msg); -} - -#endif /* NEED_strerror */ - - -/* - -NAME - - strerrno -- map an error number to a symbolic name string - -SYNOPSIS - - const char *strerrno (int errnoval) - -DESCRIPTION - - Given an error number returned from a system call (typically - returned in errno), returns a pointer to a string containing the - symbolic name of that error number, as found in . - - If the supplied error number is within the valid range of indices - for symbolic names, but no name is available for the particular - error number, then returns the string "Error NUM", where NUM is - the error number. - - If the supplied error number is not within the range of valid - indices, then returns NULL. - -BUGS - - The contents of the location pointed to are only guaranteed to be - valid until the next call to strerrno. - -*/ - -const char * -strerrno (errnoval) - int errnoval; -{ - const char *name; - static char buf[32]; - - if (error_names == NULL) - { - init_error_tables (); - } - - if ((errnoval < 0) || (errnoval >= num_error_names)) - { -#ifdef EVMSERR - if (errnoval == evmserr.value) - name = evmserr.name; - else -#endif - /* Out of range, just return NULL */ - name = NULL; - } - else if ((error_names == NULL) || (error_names[errnoval] == NULL)) - { - /* In range, but no error_names or no entry at this index. */ - sprintf (buf, "Error %d", errnoval); - name = (const char *) buf; - } - else - { - /* In range, and a valid name. Just return the name. */ - name = error_names[errnoval]; - } - - return (name); -} - -/* - -NAME - - strtoerrno -- map a symbolic errno name to a numeric value - -SYNOPSIS - - int strtoerrno (char *name) - -DESCRIPTION - - Given the symbolic name of a error number, map it to an errno value. - If no translation is found, returns 0. - -*/ - -int -strtoerrno (name) - const char *name; -{ - int errnoval = 0; - - if (name != NULL) - { - if (error_names == NULL) - { - init_error_tables (); - } - for (errnoval = 0; errnoval < num_error_names; errnoval++) - { - if ((error_names[errnoval] != NULL) && - (strcmp (name, error_names[errnoval]) == 0)) - { - break; - } - } - if (errnoval == num_error_names) - { -#ifdef EVMSERR - if (strcmp (name, evmserr.name) == 0) - errnoval = evmserr.value; - else -#endif - errnoval = 0; - } - } - return (errnoval); -} - - -/* A simple little main that does nothing but print all the errno translations - if MAIN is defined and this file is compiled and linked. */ - -#ifdef MAIN - -#include - -int -main () -{ - int errn; - int errnmax; - const char *name; - char *msg; - char *strerror (); - - errnmax = errno_max (); - printf ("%d entries in names table.\n", num_error_names); - printf ("%d entries in messages table.\n", sys_nerr); - printf ("%d is max useful index.\n", errnmax); - - /* Keep printing values until we get to the end of *both* tables, not - *either* table. Note that knowing the maximum useful index does *not* - relieve us of the responsibility of testing the return pointer for - NULL. */ - - for (errn = 0; errn <= errnmax; errn++) - { - name = strerrno (errn); - name = (name == NULL) ? "" : name; - msg = strerror (errn); - msg = (msg == NULL) ? "" : msg; - printf ("%-4d%-18s%s\n", errn, name, msg); - } - - return 0; -} - -#endif diff --git a/contrib/gdb/libiberty/strncasecmp.c b/contrib/gdb/libiberty/strncasecmp.c deleted file mode 100644 index 4485cac..0000000 --- a/contrib/gdb/libiberty/strncasecmp.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 1987 Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms are permitted - * provided that this notice is preserved and that due credit is given - * to the University of California at Berkeley. The name of the University - * may not be used to endorse or promote products derived from this - * software without specific written prior permission. This software - * is provided ``as is'' without express or implied warranty. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)strcasecmp.c 5.5 (Berkeley) 11/24/87"; -#endif /* LIBC_SCCS and not lint */ - -#include -#ifdef __STDC__ -#include -#else -#define size_t unsigned long -#endif - -/* - * This array is designed for mapping upper and lower case letter - * together for a case independent comparison. The mappings are - * based upon ascii character sequences. - */ -static unsigned char charmap[] = { - '\000', '\001', '\002', '\003', '\004', '\005', '\006', '\007', - '\010', '\011', '\012', '\013', '\014', '\015', '\016', '\017', - '\020', '\021', '\022', '\023', '\024', '\025', '\026', '\027', - '\030', '\031', '\032', '\033', '\034', '\035', '\036', '\037', - '\040', '\041', '\042', '\043', '\044', '\045', '\046', '\047', - '\050', '\051', '\052', '\053', '\054', '\055', '\056', '\057', - '\060', '\061', '\062', '\063', '\064', '\065', '\066', '\067', - '\070', '\071', '\072', '\073', '\074', '\075', '\076', '\077', - '\100', '\141', '\142', '\143', '\144', '\145', '\146', '\147', - '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157', - '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167', - '\170', '\171', '\172', '\133', '\134', '\135', '\136', '\137', - '\140', '\141', '\142', '\143', '\144', '\145', '\146', '\147', - '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157', - '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167', - '\170', '\171', '\172', '\173', '\174', '\175', '\176', '\177', - '\200', '\201', '\202', '\203', '\204', '\205', '\206', '\207', - '\210', '\211', '\212', '\213', '\214', '\215', '\216', '\217', - '\220', '\221', '\222', '\223', '\224', '\225', '\226', '\227', - '\230', '\231', '\232', '\233', '\234', '\235', '\236', '\237', - '\240', '\241', '\242', '\243', '\244', '\245', '\246', '\247', - '\250', '\251', '\252', '\253', '\254', '\255', '\256', '\257', - '\260', '\261', '\262', '\263', '\264', '\265', '\266', '\267', - '\270', '\271', '\272', '\273', '\274', '\275', '\276', '\277', - '\300', '\341', '\342', '\343', '\344', '\345', '\346', '\347', - '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357', - '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367', - '\370', '\371', '\372', '\333', '\334', '\335', '\336', '\337', - '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347', - '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357', - '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367', - '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\377', -}; - -int -strncasecmp(s1, s2, n) - const char *s1, *s2; - register size_t n; -{ - register unsigned char u1, u2; - - for (; n != 0; --n) { - u1 = (unsigned char) *s1++; - u2 = (unsigned char) *s2++; - if (charmap[u1] != charmap[u2]) { - return charmap[u1] - charmap[u2]; - } - if (u1 == '\0') { - return 0; - } - } - return 0; -} diff --git a/contrib/gdb/libiberty/strrchr.c b/contrib/gdb/libiberty/strrchr.c deleted file mode 100644 index 30f9e8a..0000000 --- a/contrib/gdb/libiberty/strrchr.c +++ /dev/null @@ -1,34 +0,0 @@ -/* Portable version of strrchr(). - This function is in the public domain. */ - -/* -NAME - strrchr -- return pointer to last occurance of a character - -SYNOPSIS - char *strrchr (const char *s, int c) - -DESCRIPTION - Returns a pointer to the last occurance of character C in - string S, or a NULL pointer if no occurance is found. - -BUGS - Behavior when character is the null character is implementation - dependent. -*/ - -#include - -char * -strrchr (s, c) - register CONST char *s; - int c; -{ - char *rtnval = 0; - - do { - if (*s == c) - rtnval = (char*) s; - } while (*s++); - return (rtnval); -} diff --git a/contrib/gdb/libiberty/strsignal.c b/contrib/gdb/libiberty/strsignal.c deleted file mode 100644 index c4dd63c..0000000 --- a/contrib/gdb/libiberty/strsignal.c +++ /dev/null @@ -1,627 +0,0 @@ -/* Extended support for using signal values. - Written by Fred Fish. fnf@cygnus.com - This file is in the public domain. */ - -#include "ansidecl.h" -#include "libiberty.h" - -#include "config.h" - -#ifdef LOSING_SYS_SIGLIST -#define sys_siglist no_such_symbol -#endif - -#include -#include - -/* Routines imported from standard C runtime libraries. */ - -#ifdef __STDC__ -#include -extern void *malloc (size_t size); /* 4.10.3.3 */ -extern void *memset (void *s, int c, size_t n); /* 4.11.6.1 */ -#else /* !__STDC__ */ -extern char *malloc (); /* Standard memory allocater */ -extern char *memset (); -#endif /* __STDC__ */ - -#ifdef LOSING_SYS_SIGLIST -#undef sys_siglist -#endif - - -#ifndef NULL -# ifdef __STDC__ -# define NULL (void *) 0 -# else -# define NULL 0 -# endif -#endif - -#ifndef MAX -# define MAX(a,b) ((a) > (b) ? (a) : (b)) -#endif - -/* Translation table for signal values. - - Note that this table is generally only accessed when it is used at runtime - to initialize signal name and message tables that are indexed by signal - value. - - Not all of these signals will exist on all systems. This table is the only - thing that should have to be updated as new signal numbers are introduced. - It's sort of ugly, but at least its portable. */ - -struct signal_info -{ - int value; /* The numeric value from */ - const char *name; /* The equivalent symbolic value */ -#ifdef NEED_sys_siglist - const char *msg; /* Short message about this value */ -#endif -}; - -#ifdef NEED_sys_siglist -# define ENTRY(value, name, msg) {value, name, msg} -#else -# define ENTRY(value, name, msg) {value, name} -#endif - -static const struct signal_info signal_table[] = -{ -#if defined (SIGHUP) - ENTRY(SIGHUP, "SIGHUP", "Hangup"), -#endif -#if defined (SIGINT) - ENTRY(SIGINT, "SIGINT", "Interrupt"), -#endif -#if defined (SIGQUIT) - ENTRY(SIGQUIT, "SIGQUIT", "Quit"), -#endif -#if defined (SIGILL) - ENTRY(SIGILL, "SIGILL", "Illegal instruction"), -#endif -#if defined (SIGTRAP) - ENTRY(SIGTRAP, "SIGTRAP", "Trace/breakpoint trap"), -#endif -/* Put SIGIOT before SIGABRT, so that if SIGIOT==SIGABRT then SIGABRT - overrides SIGIOT. SIGABRT is in ANSI and POSIX.1, and SIGIOT isn't. */ -#if defined (SIGIOT) - ENTRY(SIGIOT, "SIGIOT", "IOT trap"), -#endif -#if defined (SIGABRT) - ENTRY(SIGABRT, "SIGABRT", "Aborted"), -#endif -#if defined (SIGEMT) - ENTRY(SIGEMT, "SIGEMT", "Emulation trap"), -#endif -#if defined (SIGFPE) - ENTRY(SIGFPE, "SIGFPE", "Arithmetic exception"), -#endif -#if defined (SIGKILL) - ENTRY(SIGKILL, "SIGKILL", "Killed"), -#endif -#if defined (SIGBUS) - ENTRY(SIGBUS, "SIGBUS", "Bus error"), -#endif -#if defined (SIGSEGV) - ENTRY(SIGSEGV, "SIGSEGV", "Segmentation fault"), -#endif -#if defined (SIGSYS) - ENTRY(SIGSYS, "SIGSYS", "Bad system call"), -#endif -#if defined (SIGPIPE) - ENTRY(SIGPIPE, "SIGPIPE", "Broken pipe"), -#endif -#if defined (SIGALRM) - ENTRY(SIGALRM, "SIGALRM", "Alarm clock"), -#endif -#if defined (SIGTERM) - ENTRY(SIGTERM, "SIGTERM", "Terminated"), -#endif -#if defined (SIGUSR1) - ENTRY(SIGUSR1, "SIGUSR1", "User defined signal 1"), -#endif -#if defined (SIGUSR2) - ENTRY(SIGUSR2, "SIGUSR2", "User defined signal 2"), -#endif -/* Put SIGCLD before SIGCHLD, so that if SIGCLD==SIGCHLD then SIGCHLD - overrides SIGCLD. SIGCHLD is in POXIX.1 */ -#if defined (SIGCLD) - ENTRY(SIGCLD, "SIGCLD", "Child status changed"), -#endif -#if defined (SIGCHLD) - ENTRY(SIGCHLD, "SIGCHLD", "Child status changed"), -#endif -#if defined (SIGPWR) - ENTRY(SIGPWR, "SIGPWR", "Power fail/restart"), -#endif -#if defined (SIGWINCH) - ENTRY(SIGWINCH, "SIGWINCH", "Window size changed"), -#endif -#if defined (SIGURG) - ENTRY(SIGURG, "SIGURG", "Urgent I/O condition"), -#endif -#if defined (SIGIO) - /* "I/O pending" has also been suggested, but is misleading since the - signal only happens when the process has asked for it, not everytime - I/O is pending. */ - ENTRY(SIGIO, "SIGIO", "I/O possible"), -#endif -#if defined (SIGPOLL) - ENTRY(SIGPOLL, "SIGPOLL", "Pollable event occurred"), -#endif -#if defined (SIGSTOP) - ENTRY(SIGSTOP, "SIGSTOP", "Stopped (signal)"), -#endif -#if defined (SIGTSTP) - ENTRY(SIGTSTP, "SIGTSTP", "Stopped (user)"), -#endif -#if defined (SIGCONT) - ENTRY(SIGCONT, "SIGCONT", "Continued"), -#endif -#if defined (SIGTTIN) - ENTRY(SIGTTIN, "SIGTTIN", "Stopped (tty input)"), -#endif -#if defined (SIGTTOU) - ENTRY(SIGTTOU, "SIGTTOU", "Stopped (tty output)"), -#endif -#if defined (SIGVTALRM) - ENTRY(SIGVTALRM, "SIGVTALRM", "Virtual timer expired"), -#endif -#if defined (SIGPROF) - ENTRY(SIGPROF, "SIGPROF", "Profiling timer expired"), -#endif -#if defined (SIGXCPU) - ENTRY(SIGXCPU, "SIGXCPU", "CPU time limit exceeded"), -#endif -#if defined (SIGXFSZ) - ENTRY(SIGXFSZ, "SIGXFSZ", "File size limit exceeded"), -#endif -#if defined (SIGWIND) - ENTRY(SIGWIND, "SIGWIND", "SIGWIND"), -#endif -#if defined (SIGPHONE) - ENTRY(SIGPHONE, "SIGPHONE", "SIGPHONE"), -#endif -#if defined (SIGLOST) - ENTRY(SIGLOST, "SIGLOST", "Resource lost"), -#endif -#if defined (SIGWAITING) - ENTRY(SIGWAITING, "SIGWAITING", "Process's LWPs are blocked"), -#endif -#if defined (SIGLWP) - ENTRY(SIGLWP, "SIGLWP", "Signal LWP"), -#endif -#if defined (SIGDANGER) - ENTRY(SIGDANGER, "SIGDANGER", "Swap space dangerously low"), -#endif -#if defined (SIGGRANT) - ENTRY(SIGGRANT, "SIGGRANT", "Monitor mode granted"), -#endif -#if defined (SIGRETRACT) - ENTRY(SIGRETRACT, "SIGRETRACT", "Need to relinguish monitor mode"), -#endif -#if defined (SIGMSG) - ENTRY(SIGMSG, "SIGMSG", "Monitor mode data available"), -#endif -#if defined (SIGSOUND) - ENTRY(SIGSOUND, "SIGSOUND", "Sound completed"), -#endif -#if defined (SIGSAK) - ENTRY(SIGSAK, "SIGSAK", "Secure attention"), -#endif - ENTRY(0, NULL, NULL) -}; - -/* Translation table allocated and initialized at runtime. Indexed by the - signal value to find the equivalent symbolic value. */ - -static const char **signal_names; -static int num_signal_names = 0; - -/* Translation table allocated and initialized at runtime, if it does not - already exist in the host environment. Indexed by the signal value to find - the descriptive string. - - We don't export it for use in other modules because even though it has the - same name, it differs from other implementations in that it is dynamically - initialized rather than statically initialized. */ - -#ifdef NEED_sys_siglist - -static int sys_nsig; -static const char **sys_siglist; - -#else - -static int sys_nsig = NSIG; -extern const char * const sys_siglist[]; - -#endif - - -/* - -NAME - - init_signal_tables -- initialize the name and message tables - -SYNOPSIS - - static void init_signal_tables (); - -DESCRIPTION - - Using the signal_table, which is initialized at compile time, generate - the signal_names and the sys_siglist (if needed) tables, which are - indexed at runtime by a specific signal value. - -BUGS - - The initialization of the tables may fail under low memory conditions, - in which case we don't do anything particularly useful, but we don't - bomb either. Who knows, it might succeed at a later point if we free - some memory in the meantime. In any case, the other routines know - how to deal with lack of a table after trying to initialize it. This - may or may not be considered to be a bug, that we don't specifically - warn about this particular failure mode. - -*/ - -static void -init_signal_tables () -{ - const struct signal_info *eip; - int nbytes; - - /* If we haven't already scanned the signal_table once to find the maximum - signal value, then go find it now. */ - - if (num_signal_names == 0) - { - for (eip = signal_table; eip -> name != NULL; eip++) - { - if (eip -> value >= num_signal_names) - { - num_signal_names = eip -> value + 1; - } - } - } - - /* Now attempt to allocate the signal_names table, zero it out, and then - initialize it from the statically initialized signal_table. */ - - if (signal_names == NULL) - { - nbytes = num_signal_names * sizeof (char *); - if ((signal_names = (const char **) malloc (nbytes)) != NULL) - { - memset (signal_names, 0, nbytes); - for (eip = signal_table; eip -> name != NULL; eip++) - { - signal_names[eip -> value] = eip -> name; - } - } - } - -#ifdef NEED_sys_siglist - - /* Now attempt to allocate the sys_siglist table, zero it out, and then - initialize it from the statically initialized signal_table. */ - - if (sys_siglist == NULL) - { - nbytes = num_signal_names * sizeof (char *); - if ((sys_siglist = (const char **) malloc (nbytes)) != NULL) - { - memset (sys_siglist, 0, nbytes); - sys_nsig = num_signal_names; - for (eip = signal_table; eip -> name != NULL; eip++) - { - sys_siglist[eip -> value] = eip -> msg; - } - } - } - -#endif - -} - - -/* - -NAME - - signo_max -- return the max signo value - -SYNOPSIS - - int signo_max (); - -DESCRIPTION - - Returns the maximum signo value for which a corresponding symbolic - name or message is available. Note that in the case where - we use the sys_siglist supplied by the system, it is possible for - there to be more symbolic names than messages, or vice versa. - In fact, the manual page for psignal(3b) explicitly warns that one - should check the size of the table (NSIG) before indexing it, - since new signal codes may be added to the system before they are - added to the table. Thus NSIG might be smaller than value - implied by the largest signo value defined in . - - We return the maximum value that can be used to obtain a meaningful - symbolic name or message. - -*/ - -int -signo_max () -{ - int maxsize; - - if (signal_names == NULL) - { - init_signal_tables (); - } - maxsize = MAX (sys_nsig, num_signal_names); - return (maxsize - 1); -} - - -/* - -NAME - - strsignal -- map a signal number to a signal message string - -SYNOPSIS - - const char *strsignal (int signo) - -DESCRIPTION - - Maps an signal number to an signal message string, the contents of - which are implementation defined. On systems which have the external - variable sys_siglist, these strings will be the same as the ones used - by psignal(). - - If the supplied signal number is within the valid range of indices - for the sys_siglist, but no message is available for the particular - signal number, then returns the string "Signal NUM", where NUM is the - signal number. - - If the supplied signal number is not a valid index into sys_siglist, - returns NULL. - - The returned string is only guaranteed to be valid only until the - next call to strsignal. - -*/ - -const char * -strsignal (signo) - int signo; -{ - const char *msg; - static char buf[32]; - -#ifdef NEED_sys_siglist - - if (signal_names == NULL) - { - init_signal_tables (); - } - -#endif - - if ((signo < 0) || (signo >= sys_nsig)) - { - /* Out of range, just return NULL */ - msg = NULL; - } - else if ((sys_siglist == NULL) || (sys_siglist[signo] == NULL)) - { - /* In range, but no sys_siglist or no entry at this index. */ - sprintf (buf, "Signal %d", signo); - msg = (const char *) buf; - } - else - { - /* In range, and a valid message. Just return the message. */ - msg = (const char *) sys_siglist[signo]; - } - - return (msg); -} - - -/* - -NAME - - strsigno -- map an signal number to a symbolic name string - -SYNOPSIS - - const char *strsigno (int signo) - -DESCRIPTION - - Given an signal number, returns a pointer to a string containing - the symbolic name of that signal number, as found in . - - If the supplied signal number is within the valid range of indices - for symbolic names, but no name is available for the particular - signal number, then returns the string "Signal NUM", where NUM is - the signal number. - - If the supplied signal number is not within the range of valid - indices, then returns NULL. - -BUGS - - The contents of the location pointed to are only guaranteed to be - valid until the next call to strsigno. - -*/ - -const char * -strsigno (signo) - int signo; -{ - const char *name; - static char buf[32]; - - if (signal_names == NULL) - { - init_signal_tables (); - } - - if ((signo < 0) || (signo >= num_signal_names)) - { - /* Out of range, just return NULL */ - name = NULL; - } - else if ((signal_names == NULL) || (signal_names[signo] == NULL)) - { - /* In range, but no signal_names or no entry at this index. */ - sprintf (buf, "Signal %d", signo); - name = (const char *) buf; - } - else - { - /* In range, and a valid name. Just return the name. */ - name = signal_names[signo]; - } - - return (name); -} - - -/* - -NAME - - strtosigno -- map a symbolic signal name to a numeric value - -SYNOPSIS - - int strtosigno (char *name) - -DESCRIPTION - - Given the symbolic name of a signal, map it to a signal number. - If no translation is found, returns 0. - -*/ - -int -strtosigno (name) - const char *name; -{ - int signo = 0; - - if (name != NULL) - { - if (signal_names == NULL) - { - init_signal_tables (); - } - for (signo = 0; signo < num_signal_names; signo++) - { - if ((signal_names[signo] != NULL) && - (strcmp (name, signal_names[signo]) == 0)) - { - break; - } - } - if (signo == num_signal_names) - { - signo = 0; - } - } - return (signo); -} - - -/* - -NAME - - psignal -- print message about signal to stderr - -SYNOPSIS - - void psignal (unsigned signo, char *message); - -DESCRIPTION - - Print to the standard error the message, followed by a colon, - followed by the description of the signal specified by signo, - followed by a newline. -*/ - -#ifdef NEED_psignal - -void -psignal (signo, message) - unsigned signo; - char *message; -{ - if (signal_names == NULL) - { - init_signal_tables (); - } - if ((signo <= 0) || (signo >= sys_nsig)) - { - fprintf (stderr, "%s: unknown signal\n", message); - } - else - { - fprintf (stderr, "%s: %s\n", message, sys_siglist[signo]); - } -} - -#endif /* NEED_psignal */ - - -/* A simple little main that does nothing but print all the signal translations - if MAIN is defined and this file is compiled and linked. */ - -#ifdef MAIN - -#include - -int -main () -{ - int signo; - int maxsigno; - const char *name; - const char *msg; - - maxsigno = signo_max (); - printf ("%d entries in names table.\n", num_signal_names); - printf ("%d entries in messages table.\n", sys_nsig); - printf ("%d is max useful index.\n", maxsigno); - - /* Keep printing values until we get to the end of *both* tables, not - *either* table. Note that knowing the maximum useful index does *not* - relieve us of the responsibility of testing the return pointer for - NULL. */ - - for (signo = 0; signo <= maxsigno; signo++) - { - name = strsigno (signo); - name = (name == NULL) ? "" : name; - msg = strsignal (signo); - msg = (msg == NULL) ? "" : msg; - printf ("%-4d%-18s%s\n", signo, name, msg); - } - - return 0; -} - -#endif diff --git a/contrib/gdb/libiberty/strstr.c b/contrib/gdb/libiberty/strstr.c deleted file mode 100644 index fab36e3..0000000 --- a/contrib/gdb/libiberty/strstr.c +++ /dev/null @@ -1,51 +0,0 @@ -/* Simple implementation of strstr for systems without it. - This function is in the public domain. */ - -/* - -NAME - - strstr -- locate first occurance of a substring - -SYNOPSIS - - #include - - char *strstr (char *s1, char *s2) - -DESCRIPTION - - Locates the first occurance in the string pointed to by S1 of - the string pointed to by S2. Returns a pointer to the substring - found, or a NULL pointer if not found. If S2 points to a string - with zero length, the function returns S1. - -BUGS - -*/ - - -/* FIXME: The above description is ANSI compiliant. This routine has not - been validated to comply with it. -fnf */ - -char * -strstr (s1, s2) - char *s1, *s2; -{ - register char *p = s1; - extern char *strchr (); - extern int strncmp (); -#if __GNUC__==2 - extern __SIZE_TYPE__ strlen (); -#endif - register int len = strlen (s2); - - for (; (p = strchr (p, *s2)) != 0; p++) - { - if (strncmp (p, s2, len) == 0) - { - return (p); - } - } - return (0); -} diff --git a/contrib/gdb/libiberty/strtod.c b/contrib/gdb/libiberty/strtod.c deleted file mode 100644 index c86c73d..0000000 --- a/contrib/gdb/libiberty/strtod.c +++ /dev/null @@ -1,122 +0,0 @@ -/* Implementation of strtod for systems with atof. - Copyright (C) 1991, 1995 Free Software Foundation, Inc. - -This file is part of the libiberty library. This library 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 library 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 GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ - -#include - -extern double atof (); - -/* Disclaimer: this is currently just used by CHILL in GDB and therefore - has not been tested well. It may have been tested for nothing except - that it compiles. */ - -double -strtod (str, ptr) - char *str; - char **ptr; -{ - char *p; - - if (ptr == (char **)0) - return atof (str); - - p = str; - - while (isspace (*p)) - ++p; - - if (*p == '+' || *p == '-') - ++p; - - /* INF or INFINITY. */ - if ((p[0] == 'i' || p[0] == 'I') - && (p[1] == 'n' || p[1] == 'N') - && (p[2] == 'f' || p[2] == 'F')) - { - if ((p[3] == 'i' || p[3] == 'I') - && (p[4] == 'n' || p[4] == 'N') - && (p[5] == 'i' || p[5] == 'I') - && (p[6] == 't' || p[6] == 'T') - && (p[7] == 'y' || p[7] == 'Y')) - { - *ptr = p + 7; - return atof (str); - } - else - { - *ptr = p + 3; - return atof (str); - } - } - - /* NAN or NAN(foo). */ - if ((p[0] == 'n' || p[0] == 'N') - && (p[1] == 'a' || p[1] == 'A') - && (p[2] == 'n' || p[2] == 'N')) - { - p += 3; - if (*p == '(') - { - ++p; - while (*p != '\0' && *p != ')') - ++p; - if (*p == ')') - ++p; - } - *ptr = p; - return atof (str); - } - - /* digits, with 0 or 1 periods in it. */ - if (isdigit (*p) || *p == '.') - { - int got_dot = 0; - while (isdigit (*p) || (!got_dot && *p == '.')) - { - if (*p == '.') - got_dot = 1; - ++p; - } - - /* Exponent. */ - if (*p == 'e' || *p == 'E') - { - int i; - i = 1; - if (p[i] == '+' || p[i] == '-') - ++i; - if (isdigit (p[i])) - { - while (isdigit (p[i])) - ++i; - *ptr = p + i; - return atof (str); - } - } - *ptr = p; - return atof (str); - } - /* Didn't find any digits. Doesn't look like a number. */ - *ptr = str; - return 0.0; -} diff --git a/contrib/gdb/libiberty/strtol.c b/contrib/gdb/libiberty/strtol.c deleted file mode 100644 index db27ee0..0000000 --- a/contrib/gdb/libiberty/strtol.c +++ /dev/null @@ -1,143 +0,0 @@ -/*- - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -#include -#include -#if 0 -#include -#endif -#include "ansidecl.h" - -/* FIXME: It'd be nice to configure around these, but the include files are too - painful. These macros should at least be more portable than hardwired hex - constants. */ - -#ifndef ULONG_MAX -#define ULONG_MAX ((unsigned long)(~0L)) /* 0xFFFFFFFF */ -#endif - -#ifndef LONG_MAX -#define LONG_MAX ((long)(ULONG_MAX >> 1)) /* 0x7FFFFFFF */ -#endif - -#ifndef LONG_MIN -#define LONG_MIN ((long)(~LONG_MAX)) /* 0x80000000 */ -#endif - -/* - * Convert a string to a long integer. - * - * Ignores `locale' stuff. Assumes that the upper and lower case - * alphabets and digits are each contiguous. - */ -long -strtol(nptr, endptr, base) - CONST char *nptr; - char **endptr; - register int base; -{ - register CONST char *s = nptr; - register unsigned long acc; - register int c; - register unsigned long cutoff; - register int neg = 0, any, cutlim; - - /* - * Skip white space and pick up leading +/- sign if any. - * If base is 0, allow 0x for hex and 0 for octal, else - * assume decimal; if base is already 16, allow 0x. - */ - do { - c = *s++; - } while (isspace(c)); - if (c == '-') { - neg = 1; - c = *s++; - } else if (c == '+') - c = *s++; - if ((base == 0 || base == 16) && - c == '0' && (*s == 'x' || *s == 'X')) { - c = s[1]; - s += 2; - base = 16; - } - if (base == 0) - base = c == '0' ? 8 : 10; - - /* - * Compute the cutoff value between legal numbers and illegal - * numbers. That is the largest legal value, divided by the - * base. An input number that is greater than this value, if - * followed by a legal input character, is too big. One that - * is equal to this value may be valid or not; the limit - * between valid and invalid numbers is then based on the last - * digit. For instance, if the range for longs is - * [-2147483648..2147483647] and the input base is 10, - * cutoff will be set to 214748364 and cutlim to either - * 7 (neg==0) or 8 (neg==1), meaning that if we have accumulated - * a value > 214748364, or equal but the next digit is > 7 (or 8), - * the number is too big, and we will return a range error. - * - * Set any if any `digits' consumed; make it negative to indicate - * overflow. - */ - cutoff = neg ? -(unsigned long)LONG_MIN : LONG_MAX; - cutlim = cutoff % (unsigned long)base; - cutoff /= (unsigned long)base; - for (acc = 0, any = 0;; c = *s++) { - if (isdigit(c)) - c -= '0'; - else if (isalpha(c)) - c -= isupper(c) ? 'A' - 10 : 'a' - 10; - else - break; - if (c >= base) - break; - if (any < 0 || acc > cutoff || acc == cutoff && c > cutlim) - any = -1; - else { - any = 1; - acc *= base; - acc += c; - } - } - if (any < 0) { - acc = neg ? LONG_MIN : LONG_MAX; - errno = ERANGE; - } else if (neg) - acc = -acc; - if (endptr != 0) - *endptr = (char *) (any ? s - 1 : nptr); - return (acc); -} diff --git a/contrib/gdb/libiberty/strtoul.c b/contrib/gdb/libiberty/strtoul.c deleted file mode 100644 index 4090245..0000000 --- a/contrib/gdb/libiberty/strtoul.c +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (c) 1990 Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -#include -#include -#if 0 -#include -#endif -#include "ansidecl.h" - -#ifndef ULONG_MAX -#define ULONG_MAX ((unsigned long)(~0L)) /* 0xFFFFFFFF */ -#endif - -/* - * Convert a string to an unsigned long integer. - * - * Ignores `locale' stuff. Assumes that the upper and lower case - * alphabets and digits are each contiguous. - */ -unsigned long -strtoul(nptr, endptr, base) - CONST char *nptr; - char **endptr; - register int base; -{ - register CONST char *s = nptr; - register unsigned long acc; - register int c; - register unsigned long cutoff; - register int neg = 0, any, cutlim; - - /* - * See strtol for comments as to the logic used. - */ - do { - c = *s++; - } while (isspace(c)); - if (c == '-') { - neg = 1; - c = *s++; - } else if (c == '+') - c = *s++; - if ((base == 0 || base == 16) && - c == '0' && (*s == 'x' || *s == 'X')) { - c = s[1]; - s += 2; - base = 16; - } - if (base == 0) - base = c == '0' ? 8 : 10; - cutoff = (unsigned long)ULONG_MAX / (unsigned long)base; - cutlim = (unsigned long)ULONG_MAX % (unsigned long)base; - for (acc = 0, any = 0;; c = *s++) { - if (isdigit(c)) - c -= '0'; - else if (isalpha(c)) - c -= isupper(c) ? 'A' - 10 : 'a' - 10; - else - break; - if (c >= base) - break; - if (any < 0 || acc > cutoff || acc == cutoff && c > cutlim) - any = -1; - else { - any = 1; - acc *= base; - acc += c; - } - } - if (any < 0) { - acc = ULONG_MAX; - errno = ERANGE; - } else if (neg) - acc = -acc; - if (endptr != 0) - *endptr = (char *) (any ? s - 1 : nptr); - return (acc); -} diff --git a/contrib/gdb/libiberty/tmpnam.c b/contrib/gdb/libiberty/tmpnam.c deleted file mode 100644 index c061467..0000000 --- a/contrib/gdb/libiberty/tmpnam.c +++ /dev/null @@ -1,39 +0,0 @@ -#include - -#ifndef L_tmpnam -#define L_tmpname 100 -#endif -#ifndef P_tmpdir -#define P_tmpdir "/usr/tmp" -#endif - -static char tmpnam_buffer[L_tmpnam]; -static int tmpnam_counter; - -extern int getpid (); - -char * -tmpnam (s) - char *s; -{ - int pid = getpid (); - - if (s == NULL) - s = tmpnam_buffer; - - /* Generate the filename and make sure that there isn't one called - it already. */ - - while (1) - { - FILE *f; - sprintf (s, "%s/%s%x.%x", P_tmpdir, "t", pid, tmpnam_counter); - f = fopen (s, "r"); - if (f == NULL) - break; - tmpnam_counter++; - fclose (f); - } - - return s; -} diff --git a/contrib/gdb/libiberty/vasprintf.c b/contrib/gdb/libiberty/vasprintf.c deleted file mode 100644 index 3794cbd..0000000 --- a/contrib/gdb/libiberty/vasprintf.c +++ /dev/null @@ -1,165 +0,0 @@ -/* Like vsprintf but provides a pointer to malloc'd storage, which must - be freed by the caller. - Copyright (C) 1994 Free Software Foundation, Inc. - -This file is part of the libiberty library. -Libiberty is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public -License as published by the Free Software Foundation; either -version 2 of the License, or (at your option) any later version. - -Libiberty 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 -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with libiberty; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include -#include -#include -#ifdef __STDC__ -#include -#else -#include -#endif - -#ifdef TEST -int global_total_width; -#endif - -unsigned long strtoul (); -char *malloc (); - -static int -int_vasprintf (result, format, args) - char **result; - const char *format; - va_list *args; -{ - const char *p = format; - /* Add one to make sure that it is never zero, which might cause malloc - to return NULL. */ - int total_width = strlen (format) + 1; - va_list ap; - - memcpy ((PTR) &ap, (PTR) args, sizeof (va_list)); - - while (*p != '\0') - { - if (*p++ == '%') - { - while (strchr ("-+ #0", *p)) - ++p; - if (*p == '*') - { - ++p; - total_width += abs (va_arg (ap, int)); - } - else - total_width += strtoul (p, &p, 10); - if (*p == '.') - { - ++p; - if (*p == '*') - { - ++p; - total_width += abs (va_arg (ap, int)); - } - else - total_width += strtoul (p, &p, 10); - } - while (strchr ("hlL", *p)) - ++p; - /* Should be big enough for any format specifier except %s. */ - total_width += 30; - switch (*p) - { - case 'd': - case 'i': - case 'o': - case 'u': - case 'x': - case 'X': - case 'c': - (void) va_arg (ap, int); - break; - case 'f': - case 'e': - case 'E': - case 'g': - case 'G': - (void) va_arg (ap, double); - break; - case 's': - total_width += strlen (va_arg (ap, char *)); - break; - case 'p': - case 'n': - (void) va_arg (ap, char *); - break; - } - } - } -#ifdef TEST - global_total_width = total_width; -#endif - *result = malloc (total_width); - if (*result != NULL) - return vsprintf (*result, format, *args); - else - return 0; -} - -int -vasprintf (result, format, args) - char **result; - const char *format; - va_list args; -{ - return int_vasprintf (result, format, &args); -} - -#ifdef TEST -void -checkit -#ifdef __STDC__ - (const char* format, ...) -#else - (va_alist) - va_dcl -#endif -{ - va_list args; - char *result; - -#ifdef __STDC__ - va_start (args, format); -#else - char *format; - va_start (args); - format = va_arg (args, char *); -#endif - vasprintf (&result, format, args); - if (strlen (result) < global_total_width) - printf ("PASS: "); - else - printf ("FAIL: "); - printf ("%d %s\n", global_total_width, result); -} - -int -main () -{ - checkit ("%d", 0x12345678); - checkit ("%200d", 5); - checkit ("%.300d", 6); - checkit ("%100.150d", 7); - checkit ("%s", "jjjjjjjjjiiiiiiiiiiiiiiioooooooooooooooooppppppppppppaa\n\ -777777777777777777333333333333366666666666622222222222777777777777733333"); - checkit ("%f%s%d%s", 1.0, "foo", 77, "asdjffffffffffffffiiiiiiiiiiixxxxx"); -} -#endif /* TEST */ diff --git a/contrib/gdb/libiberty/vfork.c b/contrib/gdb/libiberty/vfork.c deleted file mode 100644 index 86c4591..0000000 --- a/contrib/gdb/libiberty/vfork.c +++ /dev/null @@ -1,8 +0,0 @@ -/* Emulate vfork using just plain fork, for systems without a real vfork. - This function is in the public domain. */ - -int -vfork () -{ - return (fork ()); -} diff --git a/contrib/gdb/libiberty/vfprintf.c b/contrib/gdb/libiberty/vfprintf.c deleted file mode 100644 index ce3fdf9..0000000 --- a/contrib/gdb/libiberty/vfprintf.c +++ /dev/null @@ -1,13 +0,0 @@ -#include -#include -#include -#undef vfprintf - -int -vfprintf (file, format, ap) - FILE *file; - const char *format; - va_list ap; -{ - return _doprnt (format, ap, file); -} diff --git a/contrib/gdb/libiberty/vmsbuild.com b/contrib/gdb/libiberty/vmsbuild.com deleted file mode 100644 index e1c203f..0000000 --- a/contrib/gdb/libiberty/vmsbuild.com +++ /dev/null @@ -1,142 +0,0 @@ -$! libiberty/vmsbuild.com -- build liberty.olb for VMS host, VMS target -$! -$ CC = "gcc /noVerbose/Debug/Incl=([],[-.include])" -$ LIBR = "library /Obj" -$ LINK = "link" -$ DELETE= "delete /noConfirm" -$ SEARCH= "search /Exact" -$ ECHO = "write sys$output" -$ ABORT = "exit %x002C" -$! -$ LIB_NAME = "liberty.olb" !this is what we're going to construct -$ WORK_LIB = "new-lib.olb" !used to guard against an incomplete build -$ -$! manually copied from Makefile.in -$ REQUIRED_OFILES = "argv.o basename.o concat.o cplus-dem.o fdmatch.o "- - + "getopt.o getopt1.o getruntime.o hex.o "- - + "floatformat.o obstack.o spaces.o strerror.o strsignal.o "- - + "vasprintf.o xatexit.o xexit.o xmalloc.o xstrerror.o" -$! anything not caught by link+search of dummy.* should be added here -$ EXTRA_OFILES = "" -$! -$! move to the directory which contains this command procedure -$ old_dir = f$environ("DEFAULT") -$ new_dir = f$parse("_._;",f$environ("PROCEDURE")) - "_._;" -$ set default 'new_dir' -$ -$ ECHO "Starting libiberty build..." -$ create config.h -/* libiberty config.h for VMS */ -#define NEED_sys_siglist -#define NEED_psignal -#define NEED_basename -$ if f$search("alloca-conf.h").eqs."" then - - copy alloca-norm.h alloca-conf.h -$ LIBR 'WORK_LIB' /Create -$ -$! first pass: compile "required" modules -$ ofiles = REQUIRED_OFILES + " " + EXTRA_OFILES -$ gosub do_ofiles -$ -$! second pass: process dummy.c, using the first pass' results -$ ECHO " now checking run-time library for missing functionality" -$ if f$search("dummy.obj").nes."" then DELETE dummy.obj;* -$ define/noLog sys$error _NL: !can't use /User_Mode here due to gcc -$ define/noLog sys$output _NL: ! driver's use of multiple image activation -$ on error then continue -$ 'CC' dummy.c -$ deassign sys$error !restore, more or less -$ deassign sys$output -$ if f$search("dummy.obj").eqs."" then goto pass2_failure1 -$! link dummy.obj, capturing full linker feedback in dummy.map -$ oldmsg = f$environ("MESSAGE") -$ set message /Facility/Severity/Identification/Text -$ define/User sys$output _NL: -$ define/User sys$error _NL: -$ LINK/Map=dummy.map/noExe dummy.obj,'WORK_LIB'/Libr,- - gnu_cc:[000000]gcclib.olb/Libr,sys$library:vaxcrtl.olb/Libr -$ set message 'oldmsg' -$ if f$search("dummy.map").eqs."" then goto pass2_failure2 -$ DELETE dummy.obj;* -$ SEARCH dummy.map "%LINK-I-UDFSYM" /Output=dummy.list -$ DELETE dummy.map;* -$ ECHO " check completed" -$! we now have a file with one entry per line of unresolvable symbols -$ ofiles = "" -$ if f$trnlnm("IFILE$").nes."" then close/noLog ifile$ -$ open/Read ifile$ dummy.list -$iloop: read/End=idone ifile$ iline -$ iline = f$edit(iline,"COMPRESS,TRIM,LOWERCASE") -$ ofiles = ofiles + " " + f$element(1," ",iline) + ".o" -$ goto iloop -$idone: close ifile$ -$ DELETE dummy.list;* -$ -$! third pass: compile "missing" modules collected in pass 2 -$ gosub do_ofiles -$ -$! finish up -$ LIBR 'WORK_LIB' /Compress /Output='LIB_NAME' !new-lib.olb -> liberty.olb -$ DELETE 'WORK_LIB';* -$ -$! all done -$ ECHO "Completed libiberty build." -$ type sys$input: - - You many wish to do - $ COPY LIBERTY.OLB GNU_CC:[000000] - so that this run-time library resides in the same location as gcc's - support library. When building gas, be sure to leave the original - copy of liberty.olb here so that gas's build procedure can find it. - -$ set default 'old_dir' -$ exit -$ -$! -$! compile each element of the space-delimited list 'ofiles' -$! -$do_ofiles: -$ ofiles = f$edit(ofiles,"COMPRESS,TRIM") -$ i = 0 -$oloop: -$ f = f$element(i," ",ofiles) -$ if f.eqs." " then goto odone -$ f = f - ".o" !strip dummy suffix -$ ECHO " ''f'" -$ 'CC' 'f'.c -$ LIBR 'WORK_LIB' 'f'.obj /Insert -$ DELETE 'f'.obj;* -$ i = i + 1 -$ goto oloop -$odone: -$ return -$ -$! -$pass2_failure1: -$! if we reach here, dummy.c failed to compile and we're really stuck -$ type sys$input: - - Cannot compile the library contents checker (dummy.c + functions.def), - so cannot continue! - -$! attempt the compile again, without suppressing diagnostic messages this time -$ on error then ABORT +0*f$verify(v) -$ v = f$verify(1) -$ 'CC' dummy.c -$ ABORT +0*f$verify(v) !'f$verify(0)' -$! -$pass2_failure2: -$! should never reach here.. -$ type sys$input: - - Cannot link the library contents checker (dummy.obj), so cannot continue! - -$! attempt the link again, without suppressing diagnostic messages this time -$ on error then ABORT +0*f$verify(v) -$ v = f$verify(1) -$ LINK/Map=dummy.map/noExe dummy.obj,'WORK_LIB'/Libr,- - gnu_cc:[000000]gcclib.olb/Libr,sys$library:vaxcrtl.olb/Libr -$ ABORT +0*f$verify(v) !'f$verify(0)' -$ -$! not reached -$ exit diff --git a/contrib/gdb/libiberty/vprintf.c b/contrib/gdb/libiberty/vprintf.c deleted file mode 100644 index 63ac53c..0000000 --- a/contrib/gdb/libiberty/vprintf.c +++ /dev/null @@ -1,11 +0,0 @@ -#include -#include -#include -#undef vprintf -int -vprintf (format, ap) - const char *format; - va_list ap; -{ - return vfprintf (stdout, format, ap); -} diff --git a/contrib/gdb/libiberty/vsprintf.c b/contrib/gdb/libiberty/vsprintf.c deleted file mode 100644 index bf0760c..0000000 --- a/contrib/gdb/libiberty/vsprintf.c +++ /dev/null @@ -1,55 +0,0 @@ -/* Simple implementation of vsprintf for systems without it. - Highly system-dependent, but should work on most "traditional" - implementations of stdio; newer ones should already have vsprintf. - Written by Per Bothner of Cygnus Support. - Based on libg++'s "form" (written by Doug Lea; dl@rocky.oswego.edu). - Copyright (C) 1991, 1995 Free Software Foundation, Inc. - -This file is part of the libiberty library. This library 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 library 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 GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ - -#include -#include -#include -#undef vsprintf - -int -vsprintf (buf, format, ap) - char *buf; - const char *format; - va_list ap; -{ - FILE b; - int ret; -#ifdef VMS - b->_flag = _IOWRT|_IOSTRG; - b->_ptr = buf; - b->_cnt = 12000; -#else - b._flag = _IOWRT|_IOSTRG; - b._ptr = buf; - b._cnt = 12000; -#endif - ret = _doprnt(format, ap, &b); - putc('\0', &b); - return ret; - -} diff --git a/contrib/gdb/libiberty/waitpid.c b/contrib/gdb/libiberty/waitpid.c deleted file mode 100644 index 23db0b9..0000000 --- a/contrib/gdb/libiberty/waitpid.c +++ /dev/null @@ -1,11 +0,0 @@ -int -waitpid (pid, stat_loc, options) - int pid, *stat_loc, options; -{ - for (;;) - { - int wpid = wait(stat_loc); - if (wpid == pid || wpid == -1) - return wpid; - } -} diff --git a/contrib/gdb/libiberty/xatexit.c b/contrib/gdb/libiberty/xatexit.c deleted file mode 100644 index 7dd27e1..0000000 --- a/contrib/gdb/libiberty/xatexit.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 1990 Regents of the University of California. - * All rights reserved. - * - * %sccs.include.redist.c% - */ - -/* Adapted from newlib/libc/stdlib/{,at}exit.[ch]. - If you use xatexit, you must call xexit instead of exit. */ - -#include "ansidecl.h" -#include "libiberty.h" - -#include - -#ifdef __STDC__ -#include -#else -#define size_t unsigned long -#endif - -/* For systems with larger pointers than ints, this must be declared. */ -PTR malloc PARAMS ((size_t)); - -static void xatexit_cleanup PARAMS ((void)); - -/* Pointer to function run by xexit. */ -extern void (*_xexit_cleanup) (); - -#define XATEXIT_SIZE 32 - -struct xatexit { - struct xatexit *next; /* next in list */ - int ind; /* next index in this table */ - void (*fns[XATEXIT_SIZE]) PARAMS ((void)); /* the table itself */ -}; - -/* Allocate one struct statically to guarantee that we can register - at least a few handlers. */ -static struct xatexit xatexit_first; - -/* Points to head of LIFO stack. */ -static struct xatexit *xatexit_head = &xatexit_first; - -/* Register function FN to be run by xexit. - Return 0 if successful, -1 if not. */ - -int -xatexit (fn) - void (*fn) PARAMS ((void)); -{ - register struct xatexit *p; - - /* Tell xexit to call xatexit_cleanup. */ - if (!_xexit_cleanup) - _xexit_cleanup = xatexit_cleanup; - - p = xatexit_head; - if (p->ind >= XATEXIT_SIZE) - { - if ((p = (struct xatexit *) malloc (sizeof *p)) == NULL) - return -1; - p->ind = 0; - p->next = xatexit_head; - xatexit_head = p; - } - p->fns[p->ind++] = fn; - return 0; -} - -/* Call any cleanup functions. */ - -static void -xatexit_cleanup () -{ - register struct xatexit *p; - register int n; - - for (p = xatexit_head; p; p = p->next) - for (n = p->ind; --n >= 0;) - (*p->fns[n]) (); -} diff --git a/contrib/gdb/libiberty/xexit.c b/contrib/gdb/libiberty/xexit.c deleted file mode 100644 index 98baeca..0000000 --- a/contrib/gdb/libiberty/xexit.c +++ /dev/null @@ -1,36 +0,0 @@ -/* xexit.c -- Run any exit handlers, then exit. - Copyright (C) 1994 Free Software Foundation, Inc. - -This file is part of the libiberty library. -Libiberty is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public -License as published by the Free Software Foundation; either -version 2 of the License, or (at your option) any later version. - -Libiberty 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 -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with libiberty; see the file COPYING.LIB. 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 - -/* This variable is set by xatexit if it is called. This way, xmalloc - doesn't drag xatexit into the link. */ -void (*_xexit_cleanup) (); - -void -xexit (code) - int code; -{ - if (_xexit_cleanup != NULL) - (*_xexit_cleanup) (); - exit (code); -} diff --git a/contrib/gdb/libiberty/xmalloc.c b/contrib/gdb/libiberty/xmalloc.c deleted file mode 100644 index 95967ab..0000000 --- a/contrib/gdb/libiberty/xmalloc.c +++ /dev/null @@ -1,106 +0,0 @@ -/* memory allocation routines with error checking. - Copyright 1989, 90, 91, 92, 93, 94 Free Software Foundation, Inc. - -This file is part of the libiberty library. -Libiberty is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public -License as published by the Free Software Foundation; either -version 2 of the License, or (at your option) any later version. - -Libiberty 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 -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with libiberty; see the file COPYING.LIB. 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 - -#ifdef __STDC__ -#include -#else -#define size_t unsigned long -#endif - -/* For systems with larger pointers than ints, these must be declared. */ -PTR malloc PARAMS ((size_t)); -PTR realloc PARAMS ((PTR, size_t)); - -/* The program name if set. */ -static const char *name = ""; - -/* The initial sbrk, set when the program name is set. */ -static char *first_break = NULL; - -void -xmalloc_set_program_name (s) - const char *s; -{ - name = s; - if (first_break == NULL) - first_break = (char *) sbrk (0); -} - -PTR -xmalloc (size) - size_t size; -{ - PTR newmem; - - if (size == 0) - size = 1; - newmem = malloc (size); - if (!newmem) - { - extern char **environ; - size_t allocated; - - if (first_break != NULL) - allocated = (char *) sbrk (0) - first_break; - else - allocated = (char *) sbrk (0) - (char *) &environ; - fprintf (stderr, - "\n%s%sCan not allocate %lu bytes after allocating %lu bytes\n", - name, *name ? ": " : "", - (unsigned long) size, (unsigned long) allocated); - xexit (1); - } - return (newmem); -} - -PTR -xrealloc (oldmem, size) - PTR oldmem; - size_t size; -{ - PTR newmem; - - if (size == 0) - size = 1; - if (!oldmem) - newmem = malloc (size); - else - newmem = realloc (oldmem, size); - if (!newmem) - { - extern char **environ; - size_t allocated; - - if (first_break != NULL) - allocated = (char *) sbrk (0) - first_break; - else - allocated = (char *) sbrk (0) - (char *) &environ; - fprintf (stderr, - "\n%s%sCan not reallocate %lu bytes after allocating %lu bytes\n", - name, *name ? ": " : "", - (unsigned long) size, (unsigned long) allocated); - xexit (1); - } - return (newmem); -} diff --git a/contrib/gdb/libiberty/xstrdup.c b/contrib/gdb/libiberty/xstrdup.c deleted file mode 100644 index 9d08bc7..0000000 --- a/contrib/gdb/libiberty/xstrdup.c +++ /dev/null @@ -1,17 +0,0 @@ -/* xstrdup.c -- Duplicate a string in memory, using xmalloc. - This trivial function is in the public domain. - Ian Lance Taylor, Cygnus Support, December 1995. */ - -#include "ansidecl.h" -#include "libiberty.h" - -char * -xstrdup (s) - const char *s; -{ - char *ret; - - ret = xmalloc (strlen (s) + 1); - strcpy (ret, s); - return ret; -} diff --git a/contrib/gdb/libiberty/xstrerror.c b/contrib/gdb/libiberty/xstrerror.c deleted file mode 100644 index d05369a..0000000 --- a/contrib/gdb/libiberty/xstrerror.c +++ /dev/null @@ -1,54 +0,0 @@ -/* xstrerror.c -- jacket routine for more robust strerror() usage. - Fri Jun 16 18:30:00 1995 Pat Rankin - This code is in the public domain. */ - -#include "libiberty.h" -#include "config.h" - -#ifdef VMS -#include -#if !defined (__STRICT_ANSI__) && !defined (__HIDE_FORBIDDEN_NAMES) -extern char *strerror PARAMS ((int,...)); -#define DONT_DECLARE_STRERROR -#endif -#endif /* VMS */ - -#ifndef DONT_DECLARE_STRERROR -extern char *strerror PARAMS ((int)); -#endif - -/* If strerror returns NULL, we'll format the number into a static buffer. */ - -#define ERRSTR_FMT "undocumented error #%d" -static char xstrerror_buf[sizeof ERRSTR_FMT + 20]; - -/* Like strerror, but result is never a null pointer. */ - -char * -xstrerror (errnum) - int errnum; -{ - char *errstr; -#ifdef VMS - char *(*vmslib_strerror) PARAMS ((int,...)); - - /* Override any possibly-conflicting declaration from system header. */ - vmslib_strerror = (char *(*) PARAMS ((int,...))) strerror; - /* Second argument matters iff first is EVMSERR, but it's simpler to - pass it unconditionally. `vaxc$errno' is declared in - and maintained by the run-time library in parallel to `errno'. - We assume that `errnum' corresponds to the last value assigned to - errno by the run-time library, hence vaxc$errno will be relevant. */ - errstr = (*vmslib_strerror) (errnum, vaxc$errno); -#else - errstr = strerror (errnum); -#endif - - /* If `errnum' is out of range, result might be NULL. We'll fix that. */ - if (!errstr) - { - sprintf (xstrerror_buf, ERRSTR_FMT, errnum); - errstr = xstrerror_buf; - } - return errstr; -} diff --git a/contrib/gdb/opcodes/ChangeLog b/contrib/gdb/opcodes/ChangeLog deleted file mode 100644 index 589c1a2..0000000 --- a/contrib/gdb/opcodes/ChangeLog +++ /dev/null @@ -1,1772 +0,0 @@ -Sun Apr 7 15:06:17 1996 Fred Fish - - From: Miles Bader - * configure.in: Use AC_CHECK_TOOL to find AR & RANLIB. - * configure: Regenerate with autoconf. - -Sat Mar 16 13:04:07 1996 Fred Fish - - * z8kgen.c (internal, gas): Call xmalloc rather than unchecked - malloc. - -Tue Mar 12 12:14:10 1996 Ian Lance Taylor - - * configure: Rebuild with autoconf 2.8. - -Thu Mar 7 15:11:10 1996 Doug Evans - - * sparc-dis.c (print_insn_sparc): Handle 'O' operand char like 'r'. - * sparc-opc.c (sparc_opcodes): Use 'O' operand char for `neg reg'. - -Tue Mar 5 15:51:57 1996 Ian Lance Taylor - - * configure.in: Don't set SHLIB or SHLINK to an empty string, - since they appear as targets in Makefile.in. - * configure: Rebuild. - -Mon Feb 26 13:03:40 1996 Stan Shebs - - * mpw-make.sed: Edit out shared library support bits. - -Tue Feb 20 20:48:28 1996 Doug Evans - - * sparc-opc.c (v8,v6notv9): Add MASK_SPARCLET. - (sparc_opcode_archs): Add MASK_V8 to sparclet entry. - (sparc_opcodes): Add sparclet insns. - (sparclet_cpreg_table): New static local. - (sparc_{encode,decode}_sparclet_cpreg): New functions. - * sparc-dis.c (print_insn_sparc): Handle sparclet cpregs. - -Tue Feb 20 11:02:44 1996 Alan Modra - - * i386-dis.c (index16): New static variable. - (putop): Print jecxz for 32 bit case, jcxz for 16 bit, not the - other way around. - (OP_indirE): Return result of OP_E. - (OP_E): Check for 16 bit addressing mode, and disassemble - correctly. Optimised 32 bit case a little. Don't print - "(base,index,scale)" when sib specifies only an offset. - -Mon Feb 19 12:32:17 1996 Ian Lance Taylor - - * configure.in: Set and substitute SHLIB_DEP. - * configure: Rebuild. - * Makefile.in (SHLIB_DEP): New variable. - (LIBIBERTY_LISTS, BFD_LIST): New variables. - (stamp-piclist): Depend upon LIBIBERTY_LISTS and BFD_LIST. If - COMMON_SHLIB, add them to piclist with appropriate modifications. - ($(SHLIB)): Depend upon $(SHLIB_DEP). Don't check COMMON_SHLIB - here: just use piclist. - -Mon Feb 19 02:03:50 1996 Doug Evans - - * sparc-dis.c (MASK_V9,V9_ONLY_P,V9_P): Define. - (print_insn_sparc): Rewrite v9/not-v9 tests. - (compare_opcodes): Likewise. - * sparc-opc.c (MASK_): Define. - (v6,v7,v8,sparclite,v9,v9a): Redefine. - (sparclet,v6notv9): Define. - (sparc_opcode_archs): Delete member `conflicts'. Add `supported'. - (sparc_opcodes): Delete F_NOTV9, use v6notv9 instead. - -Thu Feb 15 14:45:05 1996 Ian Lance Taylor - - * configure.in: Call AC_PROG_CC before configure.host. - * configure: Rebuild. - - * Makefile.in (SONAME): Remove leading ../bfd/ from $(SHLIB). - -Wed Feb 14 19:01:27 1996 Alan Modra - - * i386-dis.c (onebyte_has_modrm): New static array. - (twobyte_has_modrm): New static array. - (print_insn_i386): Only fetch the mod/reg/rm byte if it is needed. - -Tue Feb 13 15:15:01 1996 Ian Lance Taylor - - * Makefile.in ($(SHLINK)): Check ts against $(SHLIB), not - $(SHLINK). - -Mon Feb 12 16:26:06 1996 Michael Meissner - - * ppc-opc.c (PPC): Undef, so default defination on Windows NT - doesn't conflict. - -Wed Feb 7 13:59:54 1996 Ian Lance Taylor - - * m68k-opc.c (m68k_opcodes): The bkpt instruction is supported on - m68010up, not just m68020up | cpu32. - - * Makefile.in (SONAME): New variable. - ($(SHLINK)): Make a link to the transformed name, as well. - (stamp-tshlink): New target. - (install): Skip stamp-tshlink during install. - -Tue Feb 6 12:28:54 1996 Ian Lance Taylor - - * configure.in: Call AC_ARG_PROGRAM. - * configure: Rebuild. - * Makefile.in (program_transform_name): New variable. - (install): Transform library name before installing it. - -Mon Feb 5 16:14:42 1996 Ian Lance Taylor - - * i960-dis.c (mem): Add HX dcinva instruction. - - Support for building as a shared library, based on patches from - Alan Modra : - * configure.in: Add AC_ARG_ENABLE for shared and commonbfdlib. - New substitutions: ALLLIBS, PICFLAG, SHLIB, SHLIB_CC, - SHLIB_CFLAGS, COMMON_SHLIB, SHLINK. - * configure: Rebuild. - * Makefile.in (ALLLIBS): New variable. - (PICFLAG, SHLIB, SHLIB_CC, SHLIB_CFLAGS): New variables. - (COMMON_SHLIB, SHLINK): New variables. - (.c.o): If PICFLAG is set, compile twice, once PIC, once normal. - (STAGESTUFF): Remove variable. - (all): Depend upon $(ALLLIBS) rather than $(TARGETLIB). - (stamp-piclist, piclist): New targets. - ($(SHLIB), $(SHLINK)): New targets. - ($(OFILES)): Depend upon stamp-picdir. - (disassemble.o): Build twice if PICFLAG is set. - (MOSTLYCLEAN): Add pic/*.o. - (clean): Remove $(SHLIB), $(SHLINK), piclist, and stamp-piclist. - (distclean): Remove pic and stamp-picdir. - (install): Install shared libraries. - (stamp-picdir): New target. - -Fri Feb 2 17:15:25 1996 Doug Evans - - * sparc-dis.c (print_insn_sparc): Delete DISASM_RAW_INSN support. - Print unknown instruction as "unknown", rather than in hex. - -Tue Jan 30 14:06:08 1996 Ian Lance Taylor - - * dis-buf.c: Include "sysdep.h" before "dis-asm.h". - -Thu Jan 25 20:24:07 1996 Doug Evans - - * sparc-opc.c (sparc_opcode_archs): Mark v8/sparclite as conflicting. - -Thu Jan 25 11:56:49 1996 Ian Lance Taylor - - * i386-dis.c (print_insn_i386): Only fetch the mod/reg/rm byte - when necessary. From Ulrich Drepper - . - -Thu Jan 25 03:39:10 1996 Doug Evans - - * sparc-dis.c (print_insn_sparc): NUMOPCODES replaced with - sparc_num_opcodes. Update architecture enum values. - * sparc-opc.c (sparc_opcode_archs): Replaces architecture_pname. - (sparc_opcode_lookup_arch): New function. - (sparc_num_opcodes): Renamed from bfd_sparc_num_opcodes. - (sparc_opcodes): Add v9a shutdown insn. - -Mon Jan 22 08:29:59 1996 Doug Evans - - * sparc-dis.c (print_insn_sparc): Renamed from print_insn. - If DISASM_RAW_INSN, print insn in hex. Handle v9a as opcode - architecture. - (print_insn_sparc64): Deleted. - * disassemble.c (disassembler, case bfd_arch_sparc): Always use - print_insn_sparc. - - * sparc-opc.c (architecture_pname): Add v9a. - -Fri Jan 12 14:35:58 1996 David Mosberger-Tang - - * alpha-opc.h (alpha_insn_set): VAX floating point opcode was - incorrectly defined as 0x16 when it should be 0x15. - (FLOAT_FORMAT_MASK): function code is 11 bits, not just 7 bits! - (alpha_insn_set): added cvtst and cvttq float ops. Also added - excb (exception barrier) which is defined in the Alpha - Architecture Handbook version 2. - * alpha-dis.c (print_insn_alpha): Fixed special-case decoding for - OPERATE_FORMAT_CODE type instructions. The bug caused mulq to be - disassembled as or, for example. - -Wed Jan 10 12:37:22 1996 Ian Lance Taylor - - * mips-dis.c (print_insn_arg): Print cases 'i' and 'u' in hex. - (_print_insn_mips): Change i from int to unsigned int. - -Thu Jan 4 17:21:10 1996 David Edelsohn - - * ppc-opc.c (powerpc_opcodes): tlbi POWER opcode form different - from tlbie PowerPC opcode. Add PPC603 tlbld and tlbli. - -Thu Dec 28 13:29:19 1995 John Hassey - - * i386-dis.c: Added Pentium Pro instructions. - -Tue Dec 19 22:56:35 1995 Michael Meissner - - * ppc-opc.c (fsqrt{,.}): Duplicate for PowerPC in addition to - being for Power2. - -Fri Dec 15 14:14:15 1995 J.T. Conklin - - * sh-opc.h (sh_nibble_type): Added REG_B. - (sh_arg_type): Added A_REG_B. - (sh_table): Added pref and bank reg versions of ldc, ldc.l, stc - and stc.l opcodes. - * sh-dis.c (print_insn_shx): Added cases for REG_B and A_REG_B. - -Fri Dec 15 16:44:31 1995 Ian Lance Taylor - - * disassemble.c (disassembler): Use new bfd_big_endian macro. - -Tue Dec 12 12:22:24 1995 Ian Lance Taylor - - * Makefile.in (distclean): Remove stamp-h. From Ronald - F. Guilmette . - -Tue Dec 5 13:42:44 1995 Stan Shebs - - From David Mosberger-Tang : - * alpha-dis.c (print_insn_alpha): fixed decoding of cpys - instruction. - -Mon Dec 4 12:29:05 1995 J.T. Conklin - - * sh-opc.h (sh_arg_type): Added A_SSR and A_SPC. - (sh_table): Added many SH3 opcodes. - * sh-dis.c (print_insn_shx): Added cases for A_SSR and A_SPC. - -Fri Dec 1 07:42:18 1995 Michael Meissner - - * ppc-opc.c (subfc., subfco): Mark this PPCCOM, not PPC. - (subco,subco.): Mark this PPC, not PPCCOM. - -Mon Nov 27 13:09:52 1995 Ian Lance Taylor - - * configure: Rebuild with autoconf 2.7. - -Tue Nov 21 18:28:06 1995 Ian Lance Taylor - - * configure: Rebuild with autoconf 2.6. - -Wed Nov 15 19:02:53 1995 Ken Raeburn - - * configure.in: Sort list of architectures. Accept but do nothing - for alliant, convex, pyramid, romp, and tahoe. - -Wed Nov 8 20:18:59 1995 Ian Lance Taylor - - * a29k-dis.c (print_special): Change num to unsigned int. - -Wed Nov 8 20:10:35 1995 Eric Freudenthal - - * a29k-dis.c (print_insn): Cast insn24 to unsigned long when - shifting it. - -Tue Nov 7 15:21:06 1995 Ian Lance Taylor - - * configure.in: Call AC_CHECK_PROG to find and cache AR. - * configure: Rebuilt. - -Mon Nov 6 17:39:47 1995 Harry Dolan - - * configure.in: Add case for bfd_i860_arch. - * configure: Rebuild. - -Fri Nov 3 12:45:31 1995 Ian Lance Taylor - - * m68k-opc.c (m68k_opcodes): Correct fmoveml operands. - * m68k-dis.c (NEXTSINGLE): Change i to unsigned int. - (NEXTDOUBLE): Likewise. - (print_insn_m68k): Don't match fmoveml if there is more than one - register in the list. - (print_insn_arg): Handle a place of '8' for a type of 'L'. - -Thu Nov 2 23:06:33 1995 Ian Lance Taylor - - * m68k-opc.c: Use #W rather than #w. - * m68k-dis.c (print_insn_arg): Handle new 'W' place. - -Wed Nov 1 13:30:24 1995 Ian Lance Taylor - - * m68k-opc.c (m68k_opcode_aliases): Add dbfw as an alias for dbf, - and likewise for all the dbxx opcodes. - -Mon Oct 30 20:50:40 1995 Fred Fish - - * arc-dis.c: Include elf-bfd.h rather than libelf.h. - -Mon Oct 23 11:11:34 1995 James G. Smith - - * mips-opc.c: Added shorthand (V1) for INSN_4100 manifest. Added - the VR4100 specific instructions to the mips_opcodes structure. - -Thu Oct 19 11:05:23 1995 Stan Shebs - - * mpw-config.in, mpw-make.sed: Remove ugly workaround for - ugly Metrowerks bug in CW6, is fixed in CW7. - -Mon Oct 16 12:59:01 1995 Michael Meissner - - * ppc-opc.c (whole file): Add flags for common/any support. - -Tue Oct 10 11:06:07 1995 Fred Fish - - * Makefile.in (BISON): Remove macro. - (FLAGS_TO_PASS): Remove BISON. - -Fri Oct 6 16:26:45 1995 Ken Raeburn - - Mon Sep 25 22:49:32 1995 Andreas Schwab - - * m68k-dis.c (print_insn_m68k): Recognize all two-word - instructions that take no args by looking at the match mask. - (print_insn_arg): Always print "%" before register names. - [case 'c']: Use "nc" for the no-cache case, as recognized by gas. - [case '_']: Don't print "@#" before address. - [case 'J']: Use "%s" as format string, not register name. - [case 'B']: Treat place == 'C' like 'l' and 'L'. - -Thu Oct 5 22:16:20 1995 Ken Raeburn - - * i386-dis.c: Describe cmpxchg8b operand, and spell the opcode - name correctly. - -Tue Oct 3 08:30:20 1995 steve chamberlain - - From David Mosberger-Tang - - * alpha-opc.h (MEMORY_FUNCTION_FORMAT_MASK): added. - (alpha_insn_set): added definitions for VAX floating point - instructions (Unix compilers don't generate these, but handcoded - assembly might still use them). - - * alpha-dis.c (print_insn_alpha): added support for disassembling - the miscellaneous instructions in the Alpha instruction set. - -Tue Sep 26 18:47:20 1995 Stan Shebs - - * mpw-config.in: Add m68k-opc.c.o to BFD_MACHINES for m68k, - no longer create sysdep.h, sed ppc-opc.c to work around a - serious Metrowerks C bug. - * mpw-make.in: Remove. - * mpw-make.sed: New file, used by mpw-configure to edit - Makefile.in into an MPW makefile. - -Wed Sep 20 12:55:28 1995 Ian Lance Taylor - - * Makefile.in (maintainer-clean): New synonym for realclean. - -Tue Sep 19 15:28:36 1995 Ian Lance Taylor - - * m68k-opc.c: Split pmove patterns which use 'P' into patterns - which use '0', '1', and '2' instead. Specify the proper size for - a pmove immediate operand. Correct the pmovefd patterns to be - moves to a register, not from a register. - * m68k-dis.c (print_insn_arg): Replace 'P' with '0', '1', '2'. - -Thu Sep 14 11:58:22 1995 Doug Evans - - * sparc-opc.c (sparc_opcodes): Mark all insns that reference - %psr, %wim, %tbr as F_NOTV9. - -Fri Sep 8 01:07:38 1995 Ian Lance Taylor - - * Makefile.in (Makefile): Just rebuild Makefile when running - config.status. - (config.h, stamp-h): New targets. - * configure.in: Call AC_CONFIG_HEADER and AC_CANONICAL_SYSTEM - earlier. Don't bother to call AC_ARG_PROGRAM. Touch stamp-h when - rebuilding config.h. - * configure: Rebuild. - - * mips-opc.c: Change unaligned loads and stores with "t,A" - operands to use "t,A(b)". - -Thu Sep 7 19:02:46 1995 Jim Wilson - - * sh-dis.c (print_insn_shx): Add F_FR0 support. - -Thu Sep 7 19:02:46 1995 Jim Wilson - - * sh-dis.c (print_insn_shx): Change loop over op->arg[n] to iterate - until 3 instead of until 2. - -Wed Sep 6 21:21:33 1995 Ian Lance Taylor - - * Makefile.in (ALL_CFLAGS): Define. - (.c.o, disassemble.o): Use $(ALL_CFLAGS). - (MOSTLYCLEAN): Add config.log. - (distclean): Don't remove config.log. - * configure.in: Substitute HDEFINES. - * configure: Rebuild. - -Wed Sep 6 15:08:09 1995 Jim Wilson - - * sh-opc.h (sh_arg_type): Add F_FR0. - (sh_table, case fmac): Add F_FR0 as first argument. - -Wed Sep 6 15:08:09 1995 Jim Wilson - - * sh-opc.h (sh_opcode_info): Increase arg array size to 4. - -Tue Sep 5 18:28:10 1995 Doug Evans - - * sparc-dis.c: Remove all references to NO_V9. - -Tue Sep 5 20:03:26 1995 Ian Lance Taylor - - * aclocal.m4: Just include ../bfd/aclocal.m4. - * configure: Rebuild. - -Tue Sep 5 16:09:59 1995 Doug Evans - - * sparc-dis.c (X_DISP19): Define. - (print_insn, case 'G'): Use it. - (print_insn, case 'L'): Sign extend displacement. - -Mon Sep 4 14:28:46 1995 Ian Lance Taylor - - * configure.in: Run ../bfd/configure.host before AC_PROG_CC. - Subsitute CFLAGS and AR. Call AC_PROG_INSTALL. Don't substitute - host_makefile_frag or frags. - * aclocal.m4: New file. - * configure: Rebuild. - * Makefile.in (INSTALL): Set to @INSTALL@. - (INSTALL_PROGRAM): Set to @INSTALL_PROGRAM@. - (INSTALL_DATA): Set to @INSTALL_DATA@. - (AR): Set to @AR@. - (AR_FLAGS): Set to rc rather than qc. - (CC): Define as @CC@. - (CFLAGS): Set to @CFLAGS@. - (@host_makefile_frag@): Remove. - (config.status): Remove dependency upon @frags@. - - * configure.in: ../bfd/config.bfd now just sets shell variables. - Use them rather than looking through target Makefile fragments. - * configure: Rebuild. - -Thu Aug 31 12:35:32 1995 Jim Wilson - - * sh-opc.h (ftrc): Change FPUL_N to FPUL_M. - -Wed Aug 30 13:52:28 1995 Doug Evans - - * sparc-opc.c (sparc_opcodes): Delete duplicate wr %y insn. - Add clrx, iprefetch, signx, clruw, cas, casl, casx, casxl synthetic - sparc64 insns. - - * sparc-opc.c (sparc_opcodes): Fix prefetcha insn. - (lookup_{name,value}): New functions. - (prefetch_table): New static local. - (sparc_{encode,decode}_prefetch): New functions. - * sparc-dis.c (print_insn): Handle '*' arg (prefetch function). - -Wed Aug 30 11:11:58 1995 Jim Wilson - - * sh-opc.h: Add blank lines to improve readabililty of sh3e - instructions. - -Wed Aug 30 11:09:38 1995 Jim Wilson - - * sh-dis.c: Correct comment on first line of file. - -Tue Aug 29 15:37:18 1995 Doug Evans - - * disassemble.c (disassembler): Handle bfd_mach_sparc64. - - * sparc-opc.c (asi, membar): New static locals. - (sparc_{encode,decode}_{asi,membar}): New functions. - (sparc_opcodes, membar insn): Fix. - * sparc-dis.c (print_insn): Call sparc_decode_asi. - Support decoding of membar masks. - (X_MEMBAR): Define. - -Sat Aug 26 21:22:48 1995 Ian Lance Taylor - - * m68k-opc.c (m68k_opcode_aliases): Add br, brs, brb, brw, brl. - -Mon Aug 21 17:33:36 1995 Ian Lance Taylor - - * m68k-opc.c (m68k_opcode_aliases): Add bhib as an alias for bhis, - and likewise for the other branches. Add bhs as an alias for bcc, - and likewise for the size variants. Add dbhs as an alias for - dbcc. - -Fri Aug 11 13:40:24 1995 Jeff Law (law@snake.cs.utah.edu) - - * sh-opc.h (FP sts instructions): Update to match reality. - -Mon Aug 7 16:12:58 1995 Ian Lance Taylor - - * m68k-dis.c: (fpcr_names): Add % before all register names. - (reg_names): Likewise. - (print_insn_arg): Don't explicitly print % before register names. - Add % before register names in static array names. In case 'r', - print data registers as `@(Dn)', not `Dn@'. When printing a - memory address, don't print @# before it. - (print_indexed): Change base_disp and outer_disp from int to - bfd_vma. Print using MIT syntax, not mutant invalid Motorola - syntax. Sign extend 8 byte displacement correctly. - (print_base): Print using MIT syntax. Print zpc when appropriate. - Change parameter disp from int to bfd_vma. - - * m68k-opc.c (m68k_opcode_aliases): Add jsrl and jsrs as aliases - for jsr. - -Mon Aug 7 02:21:40 1995 Jeff Law (law@snake.cs.utah.edu) - - * sh-dis.c (print_insn_shx): Handle new operand types F_REG_N, - F_REG_M, FPSCR_M, FPSCR_N, FPUL_M and FPUL_N. - * sh-opc.h (sh_arg_type): Add new operand types. - (sh_table): Add new opcodes from SH3E Floating Point ISA. - -Sat Aug 5 16:50:14 1995 Fred Fish - - * Makefile.in (distclean): Remove generated file config.h. - -Sat Aug 5 16:50:14 1995 Fred Fish - - * Makefile.in (distclean): Remove generated file config.h. - -Wed Aug 2 18:33:40 1995 Ian Lance Taylor - - * m68k-opc.c: New file, holding tables from include/opcode/m68k.h. - Clean up tables. - * m68k-dis.c: Remove BREAK_UP_BIG_DECL stuff. - (opcode): Remove. - (print_insn_m68k): Change d to be const. Use m68k_numopcodes - rather than numopcodes. Use m68k_opcodes rather than removed - opcode function. Don't check F_ALIAS. - (print_insn_arg): Change first parameter to be const char *. - * Makefile.in (ALL_MACHINES): Add m68k-opc.o. - (m68k-opc.o): New target. - * configure.in: Build m68k-opc.o for bfd_m68k_arch. - * configure: Rebuild. - -Wed Aug 2 08:23:38 1995 Doug Evans - - * sparc-dis.c (HASH_SIZE, HASH_INSN): Define. - (opcode_bits, opcode_hash_table): New variables. - (opcodes_initialized): Renamed from opcodes_sorted. - (build_hash_table): New function. - (is_delayed_branch): Use hash table. - (print_insn): Renamed from print_insn_sparc, made static. - Build and use hash table. If !sparc64, ignore sparc64 insns, - and vice-versa if sparc64. - (print_insn_sparc, print_insn_sparc64): New functions. - (compare_opcodes): Move sparc64 opcodes to end. - Print commutative insns with constant second. - * sparc-opc.c (all non-v9 insns): Use flag F_NOTV9 instead of F_ALIAS. - -Tue Aug 1 00:12:49 1995 Ian Lance Taylor - - * sh-dis.c (print_insn_shx): Remove unused local dslot. Use - print_address_func for A_BDISP12 and A_BDISP8. Correct test which - avoids printing a delay slot in a delay slot. - * sh-opc.h (sh_table): Fully bracket last entry. - -Mon Jul 31 12:04:47 1995 Doug Evans - - * sparc-opc.c (sllx, srax, srlx): Fix disassembly. - -Wed Jul 12 00:59:34 1995 Ken Raeburn - - * configure.in: Get host_makefile_frag from ${srcdir}. - - * configure.in: Autoconfiscated. Check for string[s].h. Create - config.h from config.in. Don't set up sysdep.h link. - * sysdep.h: New file. - * configure, config.in: New files, generated from configure.in. - * Makefile.in: Updated to be processed autoconf-style. - (distclean): Keep sysdep.h. Remove config.log and config.cache. - (Makefile): Depend on config.status. - (config.status): New rule. - * configure.bat: Update Makefile substitutions. - -Tue Jul 11 14:23:37 1995 Jeff Spiegel - - * mips-opc.c (L1): Define. - (mips_opcodes): Add R4010 instructions: flushi, flushd, flushid, - addciu, madd, maddu, ffc, ffs, msub, msubu, selsi, selsr, waiti, - and wb. - -Tue Jul 11 11:49:49 1995 Ian Lance Taylor - - * mips-opc.c (mips_opcodes): For the move pseudo-op, prefer daddu - if ISA 3 and addu otherwise, replacing or, since some MIPS chips - have multiple add units but only a single logical unit. - - * ppc-opc.c (powerpc_operands): Change CR to use a bitsize of 3, - shifted by 18, without any insertion or extraction function. - (insert_cr, extract_cr): Remove. - -Wed Jun 21 20:05:39 1995 Ken Raeburn - - * m68k-dis.c (print_insn_arg, print_indexed): Print "%" before - register names. - -Thu Jun 15 17:23:31 1995 Stan Shebs - - * mpw-config.in: Add sh and i386 configs, remove sparc config. - * sh-opc.h: Add copyright. - -Mon Jun 5 03:30:43 1995 Ken Raeburn - - * Makefile.in (crunch-m68k): Delete extra target accidentally - checked in a while ago. - -Wed May 24 16:22:13 1995 Jim Wilson - - * sh-opc.h (sh_table): Add SH3 support. - -Wed May 24 14:16:08 1995 Steve Chamberlain - - * sh-opc.h: Added bsrf and braf. - -Wed May 10 14:28:16 1995 Richard Earnshaw (rearnsha@armltd.co.uk) - - * arm-opc.h (arm_opcodes): Add 64-bit multiply patterns. Delete - bogus [ls]fm{ea,fd} patterns. - - * arm-opc.h (arm_opcodes): Correct typos in stm, ldm, std, and ldc. - * arm-dis.c (print_insn_arm): Make GIVEN a parameter, don't try and - initialize it from memory. Make function static. - (print_insn_{big,little}_arm): New functions. - * disassemble.c (disassembler, case bfd_arch_arm): Disassemble for - the correct endianness. - - -Mon Apr 24 14:18:05 1995 Jason Molenda (crash@phydeaux.cygnus.com> - - * sh-opc.h (sh_nibble_type, sh_arg_type): remove trailing , from - enum list. - -Wed Apr 19 14:07:03 1995 Michael Meissner - - * m68k-dis.c (opcode): Finish change made by Kung Hsu on April - 17th, so that it builds again using GCC as the compiler. - -Tue Apr 18 12:14:51 1995 Ken Raeburn - - * mips-dis.c (print_insn_little_mips): Cast return value from - bfd_getl32 from bfd_vma to unsigned long, because _print_insn_mips - expects an unsigned long, and that might be fewer words of - argument storage (e.g., if bfd_vma is long long on a 32-bit - machine). - (print_insn_big_mips): Likewise with bfd_getb32 value. - (_print_insn_mips): Now static. - -Mon Apr 17 12:23:28 1995 Kung Hsu - - * m68k-dis.c: Take out #define BREAK_UP_BIG_DECL kludge, because - gcc memory hog problem with initializer is fixed. - - -Mon Apr 10 15:55:01 1995 Stan Shebs - - Merge in support for Mac MPW as a host. - (Old change descriptions retained for informational value.) - - * mpw-config.in (archname): Compute from the config. - (BFD_MACHINES, ARCHDEFS): Put into mk.tmp. - - * mpw-config.in (target_arch): Compute from canonical target. - (m68k, mips, powerpc, sparc): Add architectures. - * mpw-make.in (disassemble.c.o): Add. - (ALL_CFLAGS): Remove special flags (-mc68020 -mc68881 -model far). - - * mpw-config.in (BFD_MACHINES): Set to a default value. - * mpw-make.in (BFD_MACHINES): Remove wired-in value. - - * mpw-make.in (CSEARCH): Add extra-include to search path. - - * mpw-config.in (varargs.h): Don't create. - (sysdep.h): Create using forward-include. - * mpw-make.in (CSEARCH): Add include/mpw to search path. - - * mpw-config.in: New file, MPW version of configure.in. - * mpw-make.in: New file, MPW version of Makefile.in. - - -Fri Mar 31 14:23:38 1995 Ken Raeburn - - * alpha-dis.c (print_insn_alpha): Put empty statement after - default label. - -Tue Mar 21 10:51:40 1995 Jeff Law (law@snake.cs.utah.edu) - - * hppa-dis.c (sign_extend): Delete, redundant with libhppa.h version. - (low_sign_extend): Likewise. - (get_field): Delete unused function. - (set_field, deposit_14, deposit_21): Likewise. - -Fri Mar 17 15:55:53 1995 J.T. Conklin - - * i386-dis.c: Support for more pentium opcodes. From Guy Harris - (guy@netapp.com). - -Tue Mar 14 00:52:57 1995 Ken Raeburn (raeburn@kr-pc.cygnus.com) - - Sat Feb 11 17:22:41 1995 Klaus Kaempf (kkaempf@didymus.rmi.de) - - * alpha-opc.h (OSF_ASMCODE): define - print pal-code names as defined in App C of the - Alpha Architecture Reference Manual - - * alpha-dis.c: cleaned up output - print stylized code forms as defined in App A.4.3 of the - Alpha Architecture Reference Manual - -Wed Mar 8 15:21:14 1995 Ian Lance Taylor - - * mips-opc.c: Add new mips4 instructions. Don't set INSN_RFE for - `rfe'. - * mips-dis.c (print_insn_arg): Handle new argument types 'h', 'R', - 'N', and 'M'. - -Wed Mar 8 02:54:05 1995 Ken Raeburn - - * m68k-dis.c (opcode): New function. Returns address of opcode - table entry given index, even if the opcode table was split to - work around gcc bugs. - (print_insn_m68k): Call opcode instead of referencing m68k_opcodes - directly. - (BREAK_UP_BIG_DECL): Make secondary array static and const. - (reg_names): Now const. - (print_insn_arg): Arrays cacheFieldName and names now const. - (print_indexed): Array scales now const. - - -Tue Mar 7 16:41:21 1995 Ian Lance Taylor - - * ppc-opc.c: Sort recently added instructions by minor opcode - number within major opcode number. - -Mon Mar 6 10:04:36 1995 Jeff Law (law@snake.cs.utah.edu) - - * hppa-dis.c: Include libhppa.h. - -Fri Feb 24 19:15:36 1995 Ian Lance Taylor - - * mips-opc.c: Change dli to use M_DLI, and add dla. - -Mon Feb 20 23:54:38 1995 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * Makefile.in (ALL_MACHINES): Add w65-dis.o. - - -Thu Feb 16 17:34:41 1995 Ian Lance Taylor - - * mips-opc.c: Add r4650 mul instruction. - -Wed Feb 15 15:45:20 1995 Ian Lance Taylor - - * mips-opc.c: Add uld and usd macros for unaligned double load and - store. - -Tue Feb 14 13:17:37 1995 Michael Meissner - - * ppc-opc.c (powerpc_opcodes): Add 403GA opcodes rfci, dccci, - mfdcr, mtdcr, icbt, iccci. - - -Thu Feb 9 12:28:13 1995 Stan Shebs - - * i960-dis.c (struct tabent, struct sparse_tabent): Change the - signed char fields to shorts, more portable. - -Wed Feb 8 17:29:29 1995 Stan Shebs - - * i960-dis.c (struct tabent, struct sparse_tabent): Declare the - char fields as signed chars, since they may have negative values. - -Mon Feb 6 10:52:06 1995 J.T. Conklin - - * i386-dis.c (dis386_twobyte): Add cpuid, From Charles Hannum - (mycroft@netbsd.org). - -Mon Jan 30 12:38:00 1995 Ian Lance Taylor - - From "Logg, Ed" : - * ppc-opc.c (extract_bdm): Correct parenthezisation. - * ppc-dis.c (print_insn_powerpc): Print .long before unrecognized - value. - -Thu Jan 26 18:32:08 1995 Ian Lance Taylor - - * ppc-opc.c: Changes based on patch from David Edelsohn - . - (powerpc_operands): Add operands SPRBAT and SPRG. Split TBR out of - SPR. - (FXM_MASK): Define. - (insert_tbr): New static function. - (extract_tbr): New static function. - (XFXFXM_MASK, XFXM): Define. - (XSPRBAT_MASK, XSPRG_MASK): Define. - (powerpc_opcodes): Add instructions to access special registers by - name. Add mtcr and mftbu. - -Tue Jan 17 10:56:43 1995 Ian Lance Taylor - - * mips-opc.c (P3): Define. - (mips_opcodes): Add mad and madu. - -Sun Jan 15 16:32:59 1995 Steve Chamberlain - - * configure.in: Add W65 support. - * disassemble.c: Likewise. - * w65-opc.h, w65-dis.c: New files. - -Wed Dec 28 22:15:33 1994 Steve Chamberlain (sac@jonny.cygnus.com) - - * h8300-dis.c (bfd_h8_disassemble): Add support for 2 bit - immediates. - - -Tue Dec 20 11:25:12 1994 Ian Lance Taylor - - * mips-opc.c: Add dli as a synonym for li. - - -Thu Dec 8 18:23:31 1994 Ken Raeburn - - * alpha-dis.c (print_insn_alpha): Handle call_pal instruction, and - print something for reserved opcode values, even if it won't - assemble again. - - * mips-dis.c (_print_insn_mips): When initializing, shift right - and mask, to avoid sign extension problems on the Alpha. - - * m68k-dis.c (print_insn_arg, case 'J'): Handle buscr and pcr - control registers. - - -Wed Nov 23 22:34:51 1994 Steve Chamberlain (sac@jonny.cygnus.com) - - * sh-opc.h (mov.l gbr): Get direction right. - * sh-dis.c (print_insn_shx): New function. - (print_insn_shl, print_insn_sh): Call print_insn_shx to - print opcodes with right byte order. - -Thu Nov 3 19:32:22 1994 Ken Raeburn - - * ns32k-dis.c (struct ns32k_option): Renamed from struct option, - to avoid conflicts with getopt. - -Mon Oct 31 18:48:10 1994 Ian Lance Taylor - - * hppa-dis.c (print_insn_hppa): Read the instruction using - bfd_getb32, so that it works on a little endian or 64 bit host. - Remove unused local variable op. - -Tue Oct 25 17:07:57 1994 Ian Lance Taylor - - * mips-opc.c: Use or instead of addu for pseudo-op move, since - addu does not work correctly if -mips3. - -Wed Oct 19 13:40:16 1994 Ian Lance Taylor - - * a29k-dis.c (print_special): Add special register names defined - on 29030, 29040 and 29050. - (print_insn): Handle new operand type 'I'. - -Wed Oct 12 11:59:55 1994 Ian Lance Taylor - - * Makefile.in (INSTALL): Use top level install.sh script. - -Wed Oct 5 19:16:29 1994 Ian Lance Taylor - - * sparc-dis.c: Rewrite to use bitfields, rather than a union, so - that it works on a little endian host. - -Tue Oct 4 12:14:21 1994 Ian Lance Taylor - - * configure.in: Use ${config_shell} when running config.bfd. - -Wed Sep 21 18:49:12 1994 Ian Lance Taylor (ian@sanguine.cygnus.com) - - * mips-opc.c (mips_opcodes): "dabs" is only available with -mips3. - -Thu Sep 15 16:30:22 1994 Ian Lance Taylor (ian@sanguine.cygnus.com) - - * a29k-dis.c (print_insn): Print the opcode. - -Wed Sep 14 17:52:14 1994 Ian Lance Taylor (ian@sanguine.cygnus.com) - - * mips-opc.c (mips_opcodes): Set WR_t for sc and scd. - -Sun Sep 11 22:32:17 1994 Jeff Law (law@snake.cs.utah.edu) - - * hppa-dis.c (reg_names): Use r26-r23 for arg0-arg3. - -Tue Sep 6 11:37:12 1994 Ian Lance Taylor (ian@sanguine.cygnus.com) - - * mips-opc.c: Set INSN_STORE_MEMORY flag for all instructions - which store a value into memory. - -Sun Sep 04 17:58:10 1994 Richard Earnshaw (rwe@pegasus.esprit.ec.org) - - * configure.in, Makefile.in, disassemble.c: Add support for the ARM. - * arm-dis.c, arm-opc.h: New files. - -Fri Aug 5 14:00:05 1994 Stan Shebs (shebs@andros.cygnus.com) - - * Makefile.in (ns32k-dis.o): Add dependency. - * ns32k-dis.c (print_insn_arg): Declare initialized local as - string, not as array of chars. - -Thu Jul 28 18:14:16 1994 Ken Raeburn (raeburn@cujo.cygnus.com) - - * sparc-dis.c (print_insn_sparc): Handle new operand type 'x'. - - * sparc-opc.c: Added sparclite extended FP operations, and - versions of v9 impdep* instructions permitting specification of - the OPF field. - -Tue Jul 26 16:36:03 1994 Ken Raeburn (raeburn@cujo.cygnus.com) - - * i960-dis.c (reg_names): Now const. - (struct sparse_tabent): New type, copied from array type in mem - function. - (ctrl): Local static array ctrl_tab now const. - (cobr): Local static array cobr_tab now const. - (mem): Local variables reg1, reg2, reg3 now point to const. Local - static variable mem_tab no longer explicitly initialized. Changed - mem_init to const array of struct sparse_tabent. - (reg): Local static variable reg_tab no longer explicitly - initialized. Changed reg_init to const array of struct - sparse_tabent. - (ea): Local static array scale_tab now const. - - * i960-dis.c (reg): Added i960JX instructions to reg_init table. - (REG_MAX): Updated. - -Tue Jul 19 21:00:00 1994 DJ Delorie (dj@ctron.com) - - * configure.bat: the disassember needs to be enabled for - "objdump -d" to work in djgpp. - -Wed Jul 13 18:01:58 1994 Ken Raeburn (raeburn@cujo.cygnus.com) - - * ns32k-dis.c: Deleted all code in "#ifdef GDB". - (invalid_float): Enabled general version, doesn't require running - on ns32k host. Changed to take char* argument, and test for - explicitly specified sizes, instead of using sizeof() on host CPU - types. - (INVALID_FLOAT): Cast first argument. - (opt_u, opt_U, opt_O, opt_C, opt_S, list_P532, list_M532, - list_P032, list_M032): Now const. - (optlist, list_search): Made appropriate arguments now point to - const. - (print_insn_arg): Changed static array of one-character-string - pointers into a static const array of characters; fixed sprintf - statement accordingly. - -Sun Jul 10 00:27:47 1994 Ian Dall (dall@hfrd.dsto.gov.au) - - * opcodes/ns32k-dis.c: Semi-new file. Had apparently been dropped - from distribution. A ns32k-dis.c from a previous distribution has - been brought up to date and supports the new interface. - - * disassemble.c: define ARCH_ns32k and add case bfd_arch_ns32k. - - * configure.in: add bfd_ns32k_arch target support. - - * Makefile.in: add ns32k-dis.o to ALL_MACHINES. - Add ns32k-dis.c to CFILES. Add dependencies for ns32k-dis.o. - -Wed Jun 29 22:10:37 1994 Steve Chamberlain (sac@cygnus.com) - - * h8300-dis.c (bfd_h8_disassemble): Get 16bit branch - disassembly right. - -Tue Jun 28 13:22:06 1994 Stan Shebs (shebs@andros.cygnus.com) - - * h8300-dis.c, mips-dis.c: Don't use true and false. - -Thu Jun 23 12:53:19 1994 David J. Mackenzie (djm@rtl.cygnus.com) - - * configure.in: Change --with-targets to --enable-targets. - -Wed Jun 22 13:38:32 1994 Ian Lance Taylor (ian@sanguine.cygnus.com) - - * mips-dis.c (_print_insn_mips): Build a static hash table mapping - opcodes to the first instruction with that opcode, to speed - disassembly of large files. From ralphc@pyramid.com (Ralph - Campbell). - -Tue Jun 7 12:49:44 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * Makefile.in (mostlyclean): Fix typo (was mostyclean). - -Wed May 11 22:32:00 1994 DJ Delorie (dj@ctron.com) - - * configure.bat: update to latest makefile.in - -Sat May 7 17:13:21 1994 Steve Chamberlain (sac@cygnus.com) - - * a29k-dis.c (print_insn): Print 'x' type operand in hex. - * h8300-dis.c (bfd_h8_disassemble): Print 16bit rels correctly. - * sh-dis.c (print_insn_sh): Don't recur endlessly if delay - slot insn is in a delay slot. - * z8k-opc.h: (resflg): Fix patterns. - * h8500-opc.h Fix CR insn patterns. - -Fri May 6 14:34:46 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * ppc-opc.c (powerpc_opcodes): Put PowerPC versions of "cmp" and - "cmpl" before POWER versions, so that gas -many uses them. - -Thu Apr 28 18:32:36 1994 Ken Raeburn (raeburn@cujo.cygnus.com) - - * disassemble.c: New file. - * Makefile.in (OFILES): Add disassemble.o. - (disassemble.o): Provide dependencies; compile with $(ARCHDEFS). - * configure.in: Define ARCHDEFS in Makefile. Code taken from - binutils/configure.in. - - * m68k-dis.c (print_insn_m68k): If F_ALIAS flag is set, skip the - opcode being examined. - -Thu Apr 21 17:08:40 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * ppc-opc.c (powerpc_operands): Added RAL, RAM and RAS. - (insert_ral, insert_ram, insert_ras): New functions. - (powerpc_opcodes): Use RAL for load with update, RAM for lmw, and - RAS for store with update. - -Sat Apr 16 23:41:44 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * ppc-opc.c (powerpc_opcodes): Correct fcir. From David Edelsohn - (edelsohn@npac.syr.edu). - -Wed Apr 6 17:11:45 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * mips-opc.c (mips_opcodes): Correct operands of "nor" with an - immediate argument. - -Mon Apr 4 16:30:46 1994 Doug Evans (dje@canuck.cygnus.com) - - * sparc-opc.c (sparc_opcodes): Fix "rd %fprs,%l0". - -Mon Apr 4 13:22:00 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * ppc-opc.c (powerpc_operands): The signedp field has been - removed, so don't initialize it. Set the PPC_OPERAND_SIGNED flag - instead. Add new operand SISIGNOPT. - (powerpc_opcodes): For lis, liu, addis, and cau use SISIGNOPT. - Based on patch from David Edelsohn (edelsohn@npac.syr.edu). - * ppc-dis.c (print_insn_powerpc): Check PPC_OPERAND_SIGNED rather - than signedp field. - -Wed Mar 30 00:31:49 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * i386-dis.c (struct private): Renamed to dis_private. `private' - is a reserved word for dynix cc. - -Mon Mar 28 13:00:15 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * configure.in: Change error message to refer to bfd/config.bfd - rather than bfd/configure.in. - -Mon Mar 28 12:28:30 1994 David Edelsohn (edelsohn@npac.syr.edu) - - * ppc-opc.c: Define POWER2 as short alias flag. - (powerpc_opcodes): Add POWER/2 opcodes lfq*, stfq*, fcir[z], and - fsqrt. - -Wed Mar 23 12:23:05 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * i960-dis.c (print_insn_i960): Don't read a second word for - opcodes 0, 1, 2 and 3. - -Wed Mar 16 15:37:58 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * configure.in: Don't build m68881-ext.o for bfd_m68k_arch. - -Mon Mar 14 14:53:50 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * m68881-ext.c: Removed; no longer used. - * Makefile.in: Changed accordingly. - - * m68k-dis.c (ext_format_68881): Don't declare. - (print_insn_m68k): If an instruction uses place 'i', it uses at - least four fixed bytes. - (print_insn_arg): Don't bump p by 2 for case 'I', place 'i'. For - extended float, convert to double using floatformat_to_double, not - ieee_extended_to_double, and fetch the data before converting it. - -Tue Mar 8 18:12:25 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * mips-opc.c: It's sqrt.s, not sqrt.w. From - davidj@ICSI.Berkeley.EDU (David Johnson). - -Tue Feb 8 16:55:27 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * ppc-opc.c (powerpc_opcodes): The POWER uses bdn[l][a] where the - PowerPC uses bdnz[l][a]. - -Tue Feb 8 00:32:28 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * dis-buf.c, i386-dis.c: Include sysdep.h. - -Mon Feb 7 19:22:23 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * configure.in (bfd_powerpc_arch): Use ppc-dis.o and ppc-opc.o. - - * ppc-opc.c (powerpc_opcodes): Mark POWER instructions supported - by Motorola PowerPC 601 with PPC_OPCODE_601. - * ppc-dis.c (print_insn_big_powerpc, print_insn_little_powerpc): - Disassemble Motorola PowerPC 601 instructions as well as normal - PowerPC instructions. - -Sun Feb 6 07:45:17 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * i960-dis.c (reg, mem): Just use a static array instead of - calling xmalloc. - -Sat Feb 5 00:04:02 1994 Jeffrey A. Law (law@snake.cs.utah.edu) - - * hppa-dis.c (print_insn_hppa): For '?' and '@' only adjust the - condition name index if this is for a negated condition. - - * hppa-dis.c (print_insn_hppa): No space before 'H' operand. - Floating point format for 'H' operand is backwards from normal - case (0 == double, 1 == single). For '4', '6', '7', '9', and '8' - operands (fmpyadd and fmpysub), handle bizarre register - translation correctly for single precision format. - - * hppa-dis.c (print_insn_hppa): Do not emit a space after 'F' - or 'I' operands if the next format specifier is 'M' (fcmp - condition completer). - -Feb 4 23:38:03 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * ppc-opc.c (powerpc_operands): New operand type MBE to handle a - single number giving a bitmask for the MB and ME fields of an M - form instruction. Change NB to accept 32, and turn it into 0; - also turn 0 into 32 when disassembling. Seperated SH from NB. - (insert_mbe, extract_mbe): New functions. - (insert_nb, extract_nb): New functions. - (SC_MASK): Mask out SA and LK bits. - (powerpc_opcodes): Change "cal" to use RT, D, RA rather than RT, - RA, SI. Change "liu" and "cau" to use UI rather than SI. Mark - "bctr" and "bctrl" as accepted by POWER. Change "rlwimi", - "rlimi", "rlwimi.", "rlimi.", "rlwinm", "rlinm", "rlwinm.", - "rlinm.", "rlmi", "rlmi.", "rlwnm", "rlnm", "rlwnm.", "rlnm." to - use MBE rather than MB. Add "mfmq" and "mtmq" POWER instructions. - (powerpc_macros): Define table of macro definitions. - (powerpc_num_macros): Define. - - * ppc-dis.c (print_insn_powerpc): Don't skip optional operands - if PPC_OPERAND_NEXT is set. - -Sat Jan 22 23:10:07 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * i960-dis.c (print_insn_i960): Make buffer bfd_byte instead of - char. Retrieve contents using bfd_getl32 instead of shifting. - -Fri Jan 21 19:01:39 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * ppc-opc.c: New file. Opcode table for PowerPC, including - opcodes for POWER (RS/6000). - * ppc-dis.c: New file. PowerPC and Power (RS/6000) disassembler. - * Makefile.in (ALL_MACHINES): Add ppc-dis.o and ppc-opc.o. - (CFILES): Add ppc-dis.c. - (ppc-dis.o, ppc-opc.o): New targets. - * configure.in: Build ppc-dis.o and ppc-opc.o for bfd_rs6000_arch. - -Mon Jan 17 20:05:49 1994 Jeffrey A. Law (law@snake.cs.utah.edu) - - * hppa-dis.c (print_insn_hppa): Handle 'N' in assembler template. - No space before 'u', 'f', or 'N'. - -Sun Jan 16 14:20:16 1994 Jim Kingdon (kingdon@deneb.cygnus.com) - - * i386-dis.c (print_insn_i386): Add FIXME comment regarding reading - farther than we should. - - * i386-dis.c (dis386): Use Yb and Yv for scasb and scasS. - -Thu Jan 6 12:38:05 1994 David J. Mackenzie (djm@thepub.cygnus.com) - - * sparc-dis.c m68k-dis.c alpha-dis.c a29k-dis.c: Fix comments. - -Wed Jan 5 11:56:21 1994 David J. Mackenzie (djm@thepub.cygnus.com) - - * i960-dis.c (print_insn_i960): Only read word2 if the instruction - needs it, to prevent reading past the end of a section. - -Wed Nov 17 17:20:12 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * mips-opc.h: Use macro for j instruction, to support SVR4 PIC. - Removed t,A case for la; always use t,A(b) case. - -Mon Nov 8 12:37:36 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - From Ted Lemen - * mips-dis.c (print_insn_arg): Handle 'k'. - * mips-opc.c: Make cache use k, not t. - -Sun Nov 7 23:52:34 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * alpha-opc.h, alpha-dis.c (print_insn_alpha): Add - FLOAT_MEMORY_FORMAT_CODE, FLOAT_BRANCH_FORMAT_CODE, correct - FLOAT_FORMAT_CODE to put out floating point register names. - -Mon Nov 1 18:17:51 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * mips-opc.c: Use macros for jal variants, to support SVR4 PIC. - -Thu Oct 28 17:42:23 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * a29k-dis.c (print_insn): Use 0x%08x, not 0x%8x. - -Wed Oct 27 11:48:01 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * mips-opc.c (dsll, dsra, dsrl): Added '>' cases for shift counts - larger than 32. Moved dsxx32 variants first for disassembler. - -Mon Oct 25 11:33:14 1993 Steve Chamberlain (sac@phydeaux.cygnus.com) - - * z8kgen.c, z8k-opc.h: Add full lda information. - -Tue Oct 19 12:39:25 1993 Jeffrey A Law (law@cs.utah.edu) - - * hppa-dis.c (print_insn_hppa): Do not emit a space after - movb instructions. Any necessary space will be emitted by - the code to handle nullification completers. - -Wed Oct 13 16:19:07 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * mips-opc.c: Moved l.d down so that it disassembles as ldc1. - -Fri Oct 8 02:34:21 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * alpha-opc.h: Add ldl_l, fix typo for ldq_u. - * alpha-dis.c (print_insn_alpha): Add code for PAL_FORMAT_CODE. - -Tue Oct 5 17:47:53 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * mips-opc.c: Correct lwu opcode value (book had it wrong). - -Thu Sep 30 11:26:18 1993 Steve Chamberlain (sac@phydeaux.cygnus.com) - - * z8k-dis.c (FETCH_DATA): get just the right amount of data. - (unpack_instr): Cope with ARG_IMM4M1 type instructions. - -Wed Sep 29 16:24:49 1993 K. Richard Pixley (rich@sendai.cygnus.com) - - * m88k-dis.c (m88kdis): comment change. Remove space after - printing mnemonic. - (printop): handle new arg types DEC and XREG for m88110. - -Tue Sep 28 19:20:16 1993 Jeffrey A Law (law@snake.cs.utah.edu) - - * hppa-dis.c (print_insn_hppa): Handle 'z' operand - type for absolute branch addresses. Delete special - "ble" and "be" code in 'W' operand code. - -Fri Sep 24 14:08:33 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * mips-opc.c: Set hazard information correctly for branch - likely instructions. - -Fri Sep 17 04:41:17 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * alpha-dis.c (print_insn_alpha), alpha-opc.h: Fix bugs, use - info->fprintf_func for printing and info->print_address_func for - address output. - -Wed Sep 15 12:12:07 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * mips-opc.c: Set INSN_TRAP for tXX instructions. - -Thu Sep 9 10:11:27 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * mips-opc.c: From davidj@ICSI.Berkeley.EDU (David Johnson): - Corrected second case of "b" for disassembler. - -Tue Sep 7 14:25:15 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * mips-dis.c, m88k-dis.c: Don't include libbfd.h. Changed calls - to BFD swapping routines to correspond to BFD name changes. - -Thu Sep 2 10:35:25 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * mips-opc.c: Change div machine instruction to be z,s,t rather - than s,t. Change div macro to be d,v,t rather than d,s,t. - Likewise for divu, ddiv, ddivu. Added z,s,t case for drem, dremu, - rem and remu which generates only the corresponding div - instruction. This is for compatibility with the MIPS assembler, - which only generates the simple machine instruction when an - explicit destination of $0 is used. - * mips-dis.c (print_insn_arg): Handle 'z' (always register zero). - -Thu Aug 26 17:41:44 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * mips-opc.c: From davidj@ICSI.Berkeley.EDU (David Johnson): Set - WR_31 hazard for bal, bgezal, bltzal. - -Thu Aug 26 17:20:02 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * hppa-dis.c (print_insn_hppa): Use print function - from within the disassemble_info, not fprintf_filtered. - -Wed Aug 25 13:51:40 1993 Ken Raeburn (raeburn@cambridge.cygnus.com) - - * hppa-dis.c (print_insn_hppa): Handle '|' like '>'. (From Jeff - Law, law@cs.utah.edu.) - -Mon Aug 23 12:44:05 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * mips-opc.c ("absu"): Removed. - ("dabs"): Added. - -Fri Aug 20 10:52:52 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * mips-opc.c: Added r6000 and r4000 instructions and macros. - Changed hazard information to distinguish between memory load - delays and coprocessor load delays. - -Wed Aug 18 15:39:23 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * mips-opc.c: li.d uses "T,L", not "S,F". Added li.s. - -Tue Aug 17 09:44:42 1993 David J. Mackenzie (djm@thepub.cygnus.com) - - * configure.in: Don't pass cpu to config.bfd. - -Tue Aug 17 12:23:52 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * m88k-dis.c (m88kdis): Make class unsigned. - -Thu Aug 12 15:08:18 1993 Ian Lance Taylor (ian@cygnus.com) - - * alpha-dis.c (print_insn_alpha): One branch format case was - missing the instruction name. - -Wed Aug 11 19:29:39 1993 David J. Mackenzie (djm@thepub.cygnus.com) - - * Makefile.in (ALL_MACHINES): Renamed from DIS_LIBS. - Add the arch-specific auxiliary files. - (OFILES): Remove the arch-specific auxiliary files - and use BFD_MACHINES instead of DIS_LIBS. - * configure.in: Set BFD_MACHINES based on --with-targets option. - -Thu Aug 12 12:04:53 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * mips-opc.c: Added lwc1 E,A(b) to go with lwc1 T,A(b). Similarly - for swc1. - -Sun Aug 8 15:09:30 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * sparc-opc.c: Change CONST to const to deal with gcc - -Dconst=__const -traditional. - -Fri Aug 6 10:58:55 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * mips-opc.c: From davidj@ICSI.Berkeley.EDU (David Johnson): Took - coprocessor instructions out of #if 0, and made them use new - argument type "C". - -Thu Aug 5 17:11:06 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * sparc-dis.c: Include ansidecl.h before opcodes/sparc.h. - -Fri Jul 30 18:48:15 1993 John Gilmore (gnu@cygnus.com) - - * sparc-opc.c: Add F_JSR, F_UNBR, or F_CONDBR flags to each branch - instruction, for use by the disassembler. - - * sparc-dis.c (SEX): Add sign extension macro. Replace many - hand-coded sign extensions that depended on 32-bit host ints. - FIXME, we still depend on big-endian host bitfield ordering. - (sparc_print_insn): Set the insn_info_valid field, and the - other fields that describe the instruction being printed. - -Tue Jul 27 17:04:58 1993 Jim Wilson (wilson@sphagnum.cygnus.com) - - * sparc-opc.c (call): Accept all 6 addressing modes valid for - `jmp' instead of just one of them. - -Wed Jul 21 11:43:32 1993 Jim Kingdon (kingdon@deneb.cygnus.com) - - * hppa-dis.c: Move floating registers from reg_names to fp_reg_names. - (fput_fp_reg_r): Renamed from fput_reg_r. - (fput_fp_reg): New function. - (print_insn_hppa): Use fput_fp_reg{,_r} where appropriate. - - * hppa-dis.c (print_insn_hppa, cases 'a', 'd'): Print space afterwards. - - * hppa-dis.c (print_insn_hppa, case 'd'): Use GET_COND not GET_FIELD. - -Mon Jul 19 13:52:21 1993 Jim Kingdon (kingdon@deneb.cygnus.com) - - * hppa-dis.c (print_insn_hppa): Use extract_5r_store for 'r'. - - * hppa-dis.c (print_insn_hppa, case '>'): If next character is 'n', - don't output a space. - - * hppa-dis.c (float_format_names): 10 is undefined, and 11 is quad. - -Sun Jul 18 16:30:02 1993 Jim Kingdon (kingdon@rtl.cygnus.com) - - * mips-opc.c: New file, containing opcode table from - ../include/opcode/mips.h. - * Makefile.in: Add it. - -Thu Jul 15 12:37:05 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * m88k-dis.c: New file, moved in from gdb and changed to use the - new dis-asm.h disassembler interface. - * Makefile.in (DIS_LIBS): Added m88k-dis.o. - (m88k-dis.o): New target. - -Tue Jul 13 10:04:16 1993 Ian Lance Taylor (ian@cygnus.com) - - * mips-dis.c (print_insn_arg, _print_insn_mips): Made pointer to - argument string const char * to correspond to opcode/mips.h. - -Tue Jul 6 15:18:37 1993 Ian Lance Taylor (ian@cygnus.com) - - * mips-dis.c: Updated to account for name changes in new version - of opcode/mips.h. - * Makefile.in: Added header file dependencies. - -Sat Jul 3 23:47:56 1993 Doug Evans (dje@canuck.cygnus.com) - - * h8300-dis.c (bfd_h8_disassemble): Correct fetching of instruction. - -Thu Jul 1 12:23:38 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * m68k-dis.c (NEXTWORD, NEXTLONG): Use ((x) ^ 0x8000) - 0x8000 to sign - extend, rather than shifts. - -Sun Jun 20 20:56:56 1993 Ken Raeburn (raeburn@poseidon.cygnus.com) - - * Makefile.in: Undo 15 June change. - -Fri Jun 18 14:15:15 1993 Per Bothner (bothner@deneb.cygnus.com) - - * m68k-dis.c (print_insn_arg): Change return value to byte count - or error code. - * m68k-dis.c: Re-write to detect invalid operands before - printing anything, so we can handle this the same way we - handle invalid opcodes. - -Thu Jun 17 15:01:36 1993 Steve Chamberlain (sac@phydeaux.cygnus.com) - - * sh-dis.c, sh-opc.h: Understand some more opcodes. - -Wed Jun 16 13:48:05 1993 Ian Lance Taylor (ian@cygnus.com) - - * hppa-dis.c: Include and sysdep.h before other - header files. - -Tue Jun 15 21:45:26 1993 Ken Raeburn (raeburn@cambridge.cygnus.com) - - * sparc-dis.c: Don't declare qsort, since sysdep.h might. - - * configure.in: Do make sysdep.h link. - * Makefile.in: Search ../include. Don't search ../bfd. - -Tue Jun 15 13:36:10 1993 Stu Grossman (grossman@cygnus.com) - - Changes from Jeff Law, law@cs.utah.edu: - * hppa-dis.c: Fix typo. 'a' and 'd' were reversed. - Do not print a space before the completers specified by - 'a' and 'd'. - -Fri Jun 11 18:40:21 1993 Ken Raeburn (raeburn@cygnus.com) - - * mips-dis.c: No longer need to bomb out if HOST_64_BIT is - defined, since gdb has been fixed. - - Changes from Jeff Law, law@cs.utah.edu: - * hppa-dis.c (print_insn_hppa): Last argument to fput_reg, - fput_reg_r, fput_creg, fput_const, and fputs_filtered should - be a *disassemble_info, not a *FILE. - * hppa-dis.c: Support 'd', '!', and 'a'. - * hppa-dis.c: Support 's' to extract a 2 bit space register. - * hppa-dis.c: Delete cases which are no longer needed. - -Fri Jun 11 07:53:48 1993 Jim Kingdon (kingdon@cygnus.com) - - * m68k-dis.c (print_insn_{m68k,arg}): Add MMU codes. - -Tue Jun 8 12:25:01 1993 Steve Chamberlain (sac@phydeaux.cygnus.com) - - * h8300-dis.c: New file, removed from bfd/cpu-h8300.c, with - H8/300-H opcodes. - -Mon Jun 7 12:58:49 1993 Per Bothner (bothner@rtl.cygnus.com) - - * Makefile.in (CSEARCH): Add -I../bfd for sysdep.h and bfd.h. - * configure.in: No longer need to configure to get sysdep.h. - -Thu Jun 3 15:56:49 1993 Stu Grossman (grossman@cygnus.com) - - * Patches from Jeffrey Law . - * hppa-dis.c: Support 'I', 'J', and 'K' in output - templates for 1.1 FP computational instructions. - -Tue May 25 13:05:48 1993 Ken Raeburn (raeburn@cambridge.cygnus.com) - - * h8500-dis.c (print_insn_h8500): Address argument is type - bfd_vma. - * z8k-dis.c (print_insn_z8k, print_insn_z8001, print_insn_z8002): - Ditto. - - * h8500-opc.h (addr_class_type): No comma at end of enumerator. - * sh-opc.h (sh_nibble_type, sh_arg_type): Ditto. - - * sparc-dis.c (compare_opcodes): Move static declaration to - top-level. - -Fri May 21 14:17:37 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * sparc-dis.c (print_insn_sparc): Implement 'n' argument for unimp - instruction, remove unimp hack from 'l' argument. - -Wed May 19 15:35:54 1993 Stu Grossman (grossman@cygnus.com) - - * z8k-dis.c (fetch_data): Use unsigned char to make ancient gcc's - happy. - -Fri May 14 15:22:46 1993 Ian Lance Taylor (ian@cygnus.com) - - * Based on patches from davidj@ICSI.Berkeley.EDU (David Johnson): - * mips-dis.c (print_insn_arg): Handle 'C' for general coprocessor - instructions. - -Fri May 14 00:09:14 1993 Ken Raeburn (raeburn@cambridge.cygnus.com) - - * hppa-dis.c: Include dis-asm.h before sysdep.h. Changed some - arrays of string pointers to 2-d arrays of chars, to save - space. - -Thu May 6 20:51:17 1993 Fred Fish (fnf@cygnus.com) - - * a29k-dis.c, alpha-dis.c, i960-dis.c, sparc-dis.c, z8k-dis.c: - Cast second arg to read_memory_func to "bfd_byte *", as necessary. - -Tue May 4 20:31:10 1993 Ken Raeburn (raeburn@cambridge.cygnus.com) - - * hppa-dis.c: New file from Utah, adapted to new disassembler - calling interface. - * Makefile.in: Include it. - -Mon Apr 26 18:17:42 1993 Steve Chamberlain (sac@thepub.cygnus.com) - - * sh-dis.c, sh-opc.h: New files. - -Fri Apr 23 18:51:22 1993 Steve Chamberlain (sac@thepub.cygnus.com) - - * alpha-dis.c, alpha-opc.h: New files. - -Tue Apr 6 12:54:08 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * mips-dis.c: Sign extend 'j' and 'b' arguments, delta is a signed - value. - -Mon Apr 5 17:37:37 1993 John Gilmore (gnu@cygnus.com) - - * sparc-dis.c: Make "ta" the default trap instruction, "t" the alias. - -Fri Apr 2 07:24:27 1993 Ian Lance Taylor (ian@cygnus.com) - - * a29k-dis.c, sparc-dis.c, sparc-opc.c: Use CONST rather than - const. - -Thu Apr 1 11:20:43 1993 Jim Kingdon (kingdon@cygnus.com) - - * sparc-dis.c: Use fprintf_func a few places where I forgot, - and double percent signs a few places. - - * a29k-dis.c, i960-dis.c: New, merged from gdb and binutils. - - * i386-dis.c, m68k-dis.c, mips-dis.c, sparc-dis.c: - Use info->print_address_func not print_address. - - * dis-buf.c (generic_print_address): New function. - -Wed Mar 31 10:07:04 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * Makefile.in: Add sparc-dis.c. - sparc-dis.c: New file, merges binutils and gdb versions as follows: - From GDB: - Add `add' instruction to the set that get checked - for a preceding `sethi' in order to print an absolute address. - * (print_insn): Disassembly prefers real instructions. - (is_delayed_branch): Speed up. - * sparc-opcode.h: Add ALIAS bit to aliases. Fix up opcode tables. - Still missing some float ops, and needs testing. - * sparc-pinsn.c (print_insn): Eliminate 'set' test, subsumed by - F_ALIAS. Use printf, not fprintf, when not passing a file - pointer... - (compare_opcodes): Check that identical instructions have - identical opcodes, complain otherwise. - From binutils: - * New 'm' arg. - * Include reg_names. - From neither: - Use dis-asm.h/read_memory_func interface. - -Wed Mar 31 20:49:06 1993 K. Richard Pixley (rich@rtl.cygnus.com) - - * h8500-dis.c, i386-dis.c, m68k-dis.c, z8k-dis.c (fetch_data): - deliberately return non-zero to setjmp from longjmp. Otherwise - this code fails to compile. - -Wed Mar 31 17:04:31 1993 Stu Grossman (grossman@cygnus.com) - - * m68k-dis.c: Fix prototype for fetch_arg(). - -Wed Mar 31 10:07:04 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * dis-buf.c: New file, for new read_memory_func interface. - Makefile.in (OFILES): Include it. - m68k-dis.c, i386-dis.c, h8500-dis.c, mips-dis.c, z8k-dis.c: - Use new read_memory_func interface. - -Mon Mar 29 14:02:17 1993 Steve Chamberlain (sac@thepub.cygnus.com) - - * h8500-dis.c (print_insn_h8500): Get sign of fp offsets right. - * h8500-opc.h: Fix couple of opcodes. - -Wed Mar 24 02:03:36 1993 david d `zoo' zuhn (zoo at poseidon.cygnus.com) - - * Makefile.in: add dvi & installcheck targets - -Mon Mar 22 18:55:04 1993 John Gilmore (gnu@cygnus.com) - - * Makefile.in: Update for h8500-dis.c. - -Fri Mar 19 14:27:17 1993 Steve Chamberlain (sac@thepub.cygnus.com) - - * h8500-dis.c, h8500-opc.h: New files - -Thu Mar 18 14:12:37 1993 Per Bothner (bothner@rtl.cygnus.com) - - * mips-dis.c, z8k-dis.c: Converted to use interface defined in - ../include/dis-asm.h. - * m68k-dis.c: New file (merge of ../binutils/m68k-pinsn.c - and ../gdb/m68k-pinsn.c). - * i386-dis.c: New file (merge of ../binutils/i386-pinsn.c - and ../gdb/i386-pinsn.c). - * m68881-ext.c: New file. Moved definition of - ext_format ext_format_68881 from ../gdb/m68k-tdep.c. - * Makefile.in: Adjust for new files. - * i386-dis.c: Patches from John Hassey (hassey@dg-rtp.dg.com). - * m68k-dis.c: Recognize '9' placement code, so (say) pflush - can be dis-assembled. - -Wed Feb 17 09:19:47 1993 Ken Raeburn (raeburn@cambridge.cygnus.com) - - * mips-dis.c (print_insn_arg): Now returns void. - -Mon Jan 11 16:09:16 1993 Fred Fish (fnf@cygnus.com) - - * mips-dis.c (ansidecl.h): Include for benefit of sysdep.h - files that use the macros. - -Thu Jan 7 13:15:17 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * mips-dis.c: New file, from gdb/mips-pinsn.c. - * Makefile.in (DIS_LIBS): Added mips-dis.o. - (CFILES): Added mips-dis.c. - -Thu Jan 7 07:36:33 1993 Steve Chamberlain (sac@thepub.cygnus.com) - - * z8k-dis.c (print_insn_z8001, print_insn_z8002): new routines - * z8kgen.c, z8k-opc.h: fix sizes of some shifts. - -Tue Dec 22 15:42:44 1992 Per Bothner (bothner@rtl.cygnus.com) - - * Makefile.in: Improve *clean rules. - * configure.in: Allow a default host. - -Tue Nov 17 19:53:54 1992 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * Makefile.in: also use -I$(srcdir)/../bfd, since some sysdep - files include other sysdep files - -Thu Nov 12 16:10:37 1992 Steve Chamberlain (sac@thepub.cygnus.com) - - * z8k-dis.c z8k-opc.h z8kgen.c: checkpoint - -Fri Oct 9 04:56:05 1992 John Gilmore (gnu@cygnus.com) - - * configure.in: For host support, use ../bfd/configure.host - so it stays in sync with the ../bfd/hosts database. - -Thu Oct 1 23:38:54 1992 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * configure.in: use cpu-vendor-os triple instead of nested cases - -Wed Sep 30 16:09:20 1992 Michael Werner (mtw@cygnus.com) - - * z8k-dis.c (unparse_instr): fix bug where opcode returned was - *always* the wrong one. - -Wed Sep 30 07:42:17 1992 Steve Chamberlain (sac@thepub.cygnus.com) - - * z8kgen.c: added copyright info - -Tue Sep 29 12:20:21 1992 Steve Chamberlain (sac@thepub.cygnus.com) - - * z8k-dis.c (unparse_instr): prettier tabs - * z8kgen.c -> z8k-opc.h: bug fixes in tables - -Fri Sep 25 12:50:32 1992 Stu Grossman (grossman at cygnus.com) - - * configure.in: Add ncr* configuration. - * z8k-dis.c (struct instr_data_s): Make instr_asmsrc char to make - picayune ANSI compilers happy. - -Sep 20 08:50:55 1992 Fred Fish (fnf@cygnus.com) - - * configure.in (i386): Make i386 and i486 synonymous for now. - * configure.in (i[34]86-*-sysv4): Add my_host definition. - -Fri Sep 18 17:01:23 1992 Ken Raeburn (raeburn@cambridge.cygnus.com) - - * Makefile.in (install): Fix typo. - -Fri Sep 18 02:04:24 1992 John Gilmore (gnu@cygnus.com) - - * Makefile.in (make): Remove obsolete crud. - (sparc-opc.o): Avoid Sun Make VPATH bug. - -Tue Sep 8 17:29:27 1992 K. Richard Pixley (rich@sendai.cygnus.com) - - * Makefile.in: since there are no SUBDIRS, remove rule and - references of subdir_do. - -Tue Sep 8 17:02:58 1992 Ken Raeburn (raeburn@cambridge.cygnus.com) - - * Makefile.in (install): Get the library name right here too. - Don't install bfd.h, since it's unrelated to this library. No - subdirs to recurse into, either. - (CFILES): The source file has a .c suffix, not .o. - - * sparc-opc.c: New file, moved from BFD. - * Makefile.in (OFILES): Build it. - -Thu Sep 3 16:59:20 1992 Michael Werner (mtw@cygnus.com) - - * z8k-dis.c: fixed forward refferences of some declarations. - -Mon Aug 31 16:09:45 1992 Michael Werner (mtw@cygnus.com) - - * Makefile.in: get the name of the library right - -Mon Aug 31 13:47:35 1992 Steve Chamberlain (sac@thepub.cygnus.com) - - * z8k-dis.c: knows how to disassemble z8k stuff - * z8k-opc.h: new file full of z8000 opcodes - - -Local Variables: -version-control: never -End: diff --git a/contrib/gdb/opcodes/Makefile.in b/contrib/gdb/opcodes/Makefile.in deleted file mode 100644 index c274cb1..0000000 --- a/contrib/gdb/opcodes/Makefile.in +++ /dev/null @@ -1,305 +0,0 @@ -# Makefile template for Configure for the opcodes library. -# Copyright (C) 1990, 1991, 1992, 1995 Free Software Foundation, Inc. -# Written by Cygnus Support. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 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. - -VPATH = @srcdir@ -srcdir = @srcdir@ - -prefix = @prefix@ - -program_transform_name = @program_transform_name@ -exec_prefix = @exec_prefix@ -bindir = $(exec_prefix)/bin -libdir = $(exec_prefix)/lib - -datadir = $(prefix)/lib -mandir = $(prefix)/man -man1dir = $(mandir)/man1 -man2dir = $(mandir)/man2 -man3dir = $(mandir)/man3 -man4dir = $(mandir)/man4 -man5dir = $(mandir)/man5 -man6dir = $(mandir)/man6 -man7dir = $(mandir)/man7 -man8dir = $(mandir)/man8 -man9dir = $(mandir)/man9 -infodir = $(prefix)/info -includedir = $(prefix)/include -oldincludedir = -docdir = $(srcdir)/doc - -SHELL = /bin/sh - -INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_DATA = @INSTALL_DATA@ - -AR = @AR@ -AR_FLAGS = rc -CC = @CC@ -CFLAGS = @CFLAGS@ -MAKEINFO = makeinfo -RANLIB = @RANLIB@ - -ALLLIBS = @ALLLIBS@ - -PICFLAG = @PICFLAG@ -SHLIB = @SHLIB@ -SHLIB_CC = @SHLIB_CC@ -SHLIB_CFLAGS = @SHLIB_CFLAGS@ -COMMON_SHLIB = @COMMON_SHLIB@ -SHLIB_DEP = @SHLIB_DEP@ -SHLINK = @SHLINK@ - -SONAME = lib`echo $(SHLIB) | sed -e 's,^\.\./bfd/,,' -e 's/^lib//' | sed '$(program_transform_name)'` - -INCDIR = $(srcdir)/../include -BFDDIR = $(srcdir)/../bfd -CSEARCH = -I. -I$(srcdir) -I../bfd -I$(INCDIR) -I$(BFDDIR) -DEP = mkdep - -TARGETLIB = libopcodes.a - -# To circumvent a Sun make VPATH bug, each file listed here -# should also have a foo.o: foo.c line further along in this file. - -ALL_MACHINES = a29k-dis.o alpha-dis.o h8300-dis.o h8500-dis.o \ - hppa-dis.o i386-dis.o i960-dis.o m68k-dis.o m68k-opc.o \ - m88k-dis.o mips-dis.o mips-opc.o sh-dis.o sparc-dis.o \ - sparc-opc.o z8k-dis.o ns32k-dis.o ppc-dis.o ppc-opc.o \ - arm-dis.o w65-dis.o - -OFILES = @BFD_MACHINES@ dis-buf.o disassemble.o - -FLAGS_TO_PASS = \ - "against=$(against)" \ - "AR=$(AR)" \ - "AR_FLAGS=$(AR_FLAGS)" \ - "CC=$(CC)" \ - "CFLAGS=$(CFLAGS)" \ - "RANLIB=$(RANLIB)" \ - "MAKEINFO=$(MAKEINFO)" \ - "INSTALL=$(INSTALL)" \ - "INSTALL_DATA=$(INSTALL_DATA)" \ - "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" - -ALL_CFLAGS = $(CSEARCH) @HDEFINES@ $(CFLAGS) - -.c.o: - if [ -n "$(PICFLAG)" ]; then \ - $(CC) -c $(PICFLAG) $(ALL_CFLAGS) $< -o pic/$@; \ - else true; fi - $(CC) -c $(ALL_CFLAGS) $< - -# C source files that correspond to .o's. -CFILES = i386-dis.c z8k-dis.c m68k-dis.c mips-dis.c ns32k-dis.c ppc-dis.c - -all: $(ALLLIBS) - -.NOEXPORT: - -installcheck check: - -info: -clean-info: -install-info: -dvi: - -# HDEPFILES comes from the host config; TDEPFILES from the target config. - - -$(TARGETLIB): $(OFILES) - rm -f $(TARGETLIB) - $(AR) $(AR_FLAGS) $(TARGETLIB) $(OFILES) - $(RANLIB) $(TARGETLIB) - -LIBIBERTY_LISTS = ../libiberty/required-list ../libiberty/needed-list -BFD_LIST = ../bfd/piclist - -stamp-piclist: Makefile $(LIBIBERTY_LISTS) $(BFD_LIST) - rm -f tpiclist - if [ -n "$(PICFLAG)" ]; then \ - echo $(OFILES) | sed -e 's,\([^ ][^ ]*\),pic/\1,g' > tpiclist; \ - else \ - echo $(OFILES) > tpiclist; \ - fi - if [ "$(COMMON_SHLIB)" = "yes" ]; then \ - lobjs=`cat $(LIBIBERTY_LISTS)`; \ - if [ -n "$(PICFLAG)" ]; then \ - lobjs=`echo $$lobjs | sed -e 's,\([^ ][^ ]*\),pic/\1,g'`; \ - fi; \ - lobjs=`echo $$lobjs | sed -e 's,\([^ ][^ ]*\),../libiberty/\1,g'`; \ - echo $$lobjs >> tpiclist; \ - sed -e 's,\([^ ][^ ]*\),../bfd/\1,g' $(BFD_LIST) >> tpiclist; \ - else true; fi - $(srcdir)/../move-if-change tpiclist piclist - touch stamp-piclist - -piclist: stamp-piclist ; @true - -$(SHLIB): stamp-picdir $(OFILES) piclist $(SHLIB_DEP) - rm -f $(SHLIB) - $(SHLIB_CC) $(SHLIB_CFLAGS) -o $(SHLIB) `cat piclist` - -$(SHLINK): $(SHLIB) - ts=lib`echo $(SHLIB) | sed -e 's,^\.\./bfd/,,' -e 's/^lib//' | sed -e '$(program_transform_name)'`; \ - if [ "$(COMMON_SHLIB)" = "yes" ]; then \ - ts=../bfd/$$ts; \ - fi; \ - if [ "$$ts" != "$(SHLIB)" ]; then \ - rm -f $$ts; \ - ln -sf `echo $(SHLIB) | sed -e 's,^\.\./bfd/,,'` $$ts; \ - else true; fi - rm -f $(SHLINK) - ln -sf `echo $(SHLIB) | sed -e 's,^\.\./bfd/,,'` $(SHLINK) - -# This target creates libTARGET-opcodes.so.VERSION as a symlink to -# libopcodes.so.VERSION. It is used on SunOS, which does not have SONAME. -stamp-tshlink: $(SHLIB) - tf=lib`echo $(SHLIB) | sed -e 's,\.\./bfd/,,' -e 's/^lib//' | sed '$(program_transform_name)'`; \ - if [ "$(COMMON_SHLIB)" = "yes" ]; then \ - tf=../bfd/$$tf; \ - fi; \ - if [ "$$tf" != "$(SHLIB)" ]; then \ - rm -f $$tf; \ - ln -sf $(SHLIB) $$tf; \ - else true; fi - if [ "$(COMMON_SHLIB)" = "yes" ]; then \ - tf=lib`echo $(TARGETLIB) | sed -e 's/^lib//' | sed '$(program_transform_name)'`; \ - if [ "$$tf" != "$(TARGETLIB)" ]; then \ - rm -f $$tf; \ - ln -sf $(TARGETLIB) $$tf; \ - else true; fi; \ - else true; fi - touch stamp-tshlink - -$(OFILES): stamp-picdir - -disassemble.o: disassemble.c $(INCDIR)/dis-asm.h - if [ -n "$(PICFLAG)" ]; then \ - $(CC) -c @archdefs@ $(PICFLAG) $(ALL_CFLAGS) $(srcdir)/disassemble.c -o pic/disassemble.o; \ - else true; fi - $(CC) -c @archdefs@ $(ALL_CFLAGS) $(srcdir)/disassemble.c - -a29k-dis.o: a29k-dis.c $(INCDIR)/dis-asm.h $(INCDIR)/opcode/a29k.h -dis-buf.o: dis-buf.c $(INCDIR)/dis-asm.h -h8500-dis.o: h8500-dis.c h8500-opc.h $(INCDIR)/dis-asm.h -h8300-dis.o: h8300-dis.c $(INCDIR)/dis-asm.h $(INCDIR)/opcode/h8300.h -i386-dis.o: i386-dis.c $(INCDIR)/dis-asm.h -i960-dis.o: i960-dis.c $(INCDIR)/dis-asm.h -w65-dis.o: w65-dis.c -m68k-dis.o: m68k-dis.c $(INCDIR)/dis-asm.h $(INCDIR)/floatformat.h \ - $(INCDIR)/opcode/m68k.h -m68k-opc.o: m68k-opc.c $(INCDIR)/dis-asm.h $(INCDIR)/opcode/m68k.h -mips-dis.o: mips-dis.c $(INCDIR)/dis-asm.h $(INCDIR)/opcode/mips.h -mips-opc.o: mips-opc.c $(INCDIR)/opcode/mips.h -ppc-dis.o: ppc-dis.c $(INCDIR)/dis-asm.h $(INCDIR)/opcode/ppc.h -ppc-opc.o: ppc-opc.c $(INCDIR)/opcode/ppc.h -sparc-dis.o: sparc-dis.c $(INCDIR)/dis-asm.h $(INCDIR)/opcode/sparc.h -sparc-opc.o: sparc-opc.c $(INCDIR)/opcode/sparc.h -z8k-dis.o: z8k-dis.c z8k-opc.h $(INCDIR)/dis-asm.h -ns32k-dis.o: ns32k-dis.c $(INCDIR)/dis-asm.h $(INCDIR)/opcode/ns32k.h -sh-dis.o: sh-dis.c sh-opc.h $(INCDIR)/dis-asm.h -alpha-dis.o: alpha-dis.c alpha-opc.h $(INCDIR)/dis-asm.h -hppa-dis.o: hppa-dis.c $(INCDIR)/dis-asm.h $(INCDIR)/opcode/hppa.h -m88k-dis.o: m88k-dis.c $(INCDIR)/dis-asm.h $(INCDIR)/opcode/m88k.h -arm-dis.o: arm-dis.c arm-opc.h $(INCDIR)/dis-asm.h - -tags etags: TAGS - -TAGS: force - etags $(INCDIR)/*.h $(srcdir)/*.h $(srcdir)/*.c - -MOSTLYCLEAN = *.o core *.E *.p *.ip config.log pic/*.o -mostlyclean: - rm -rf $(MOSTLYCLEAN) -clean: - rm -f *.a $(MOSTLYCLEAN) $(SHLIB) $(SHLINK) piclist stamp-piclist -distclean: clean - rm -rf Makefile config.status TAGS config.cache config.h stamp-h \ - pic stamp-picdir -clobber realclean maintainer-clean: distclean - -# Mark everything as depending on config.status, since the timestamp on -# sysdep.h might actually move backwards if we reconfig and relink it -# to a different hosts/h-xxx.h file. This will force a recompile anyway. -RECONFIG = config.status - - - -# This target should be invoked before building a new release. -# 'VERSION' file must be present and contain a string of the form "x.y" -# -roll: - @V=`cat VERSION` ; \ - MAJ=`sed 's/\..*//' VERSION` ; \ - MIN=`sed 's/.*\.//' VERSION` ; \ - V=$$MAJ.`expr $$MIN + 1` ; \ - rm -f VERSION ; \ - echo $$V >VERSION ; \ - echo Version $$V - -# Dummy target to force execution of dependent targets. -# -force: - -install: $(ALLLIBS) - for f in $(ALLLIBS); do \ - if [ "$$f" = "stamp-tshlink" ]; then \ - continue; \ - fi; \ - tf=lib`echo $$f | sed -e 's,^\.\./bfd/,,' -e 's/^lib//' | sed '$(program_transform_name)'`; \ - rm -f $(libdir)/$$tf; \ - if [ "$$f" = "$(SHLINK)" ]; then \ - ts=lib`echo $(SHLIB) | sed -e 's,^\.\./bfd/,,' -e 's/^lib//' | sed '$(program_transform_name)'`; \ - ln -sf $$ts $(libdir)/$$tf; \ - elif [ "$$f" = "$(SHLIB)" ]; then \ - $(INSTALL_PROGRAM) $$f $(libdir)/$$tf; \ - else \ - $(INSTALL_DATA) $$f $(libdir)/$$tf; \ - $(RANLIB) $(libdir)/$$tf; \ - chmod a-x $(libdir)/$$tf; \ - fi; \ - done - -Makefile: Makefile.in config.status - CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) ./config.status - -config.h: stamp-h ; @true -stamp-h: config.in config.status - CONFIG_FILES= CONFIG_HEADERS=config.h:config.in $(SHELL) ./config.status - -config.status : configure $(srcdir)/../bfd/configure.host $(srcdir)/../bfd/config.bfd - $(SHELL) config.status --recheck - -dep: $(CFILES) - mkdep $(CFLAGS) $? - -stamp-picdir: - if [ -n "$(PICFLAG)" ] && [ ! -d pic ]; then \ - mkdir pic; \ - else true; fi - touch stamp-picdir - -# What appears below is generated by a hacked mkdep using gcc -MM. - -# DO NOT DELETE THIS LINE -- mkdep uses it. -# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. - - -# IF YOU PUT ANYTHING HERE IT WILL GO AWAY - diff --git a/contrib/gdb/opcodes/config.in b/contrib/gdb/opcodes/config.in deleted file mode 100644 index ea534ec..0000000 --- a/contrib/gdb/opcodes/config.in +++ /dev/null @@ -1,7 +0,0 @@ -/* config.in. Generated automatically from configure.in by autoheader. */ - -/* Define if you have the header file. */ -#undef HAVE_STRING_H - -/* Define if you have the header file. */ -#undef HAVE_STRINGS_H diff --git a/contrib/gdb/opcodes/configure b/contrib/gdb/opcodes/configure deleted file mode 100755 index 5f19335..0000000 --- a/contrib/gdb/opcodes/configure +++ /dev/null @@ -1,1538 +0,0 @@ -#! /bin/sh - -# Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.8 -# Copyright (C) 1992, 1993, 1994 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 - --enable-targets alternative target configurations" -ac_help="$ac_help - --enable-shared build shared opcodes library" -ac_help="$ac_help - --enable-commonbfdlib build shared BFD/opcodes/libiberty library" - -# Initialize some variables set by options. -# The variables have the same names as the options, with -# dashes changed to underlines. -build=NONE -cache_file=./config.cache -exec_prefix=NONE -host=NONE -no_create= -nonopt=NONE -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -srcdir= -target=NONE -verbose= -x_includes=NONE -x_libraries=NONE -bindir='${exec_prefix}/bin' -sbindir='${exec_prefix}/sbin' -libexecdir='${exec_prefix}/libexec' -datadir='${prefix}/share' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -libdir='${exec_prefix}/lib' -includedir='${prefix}/include' -oldincludedir='/usr/include' -infodir='${prefix}/info' -mandir='${prefix}/man' - -# Initialize some other variables. -subdirs= -MFLAGS= MAKEFLAGS= - -ac_prev= -for ac_option -do - - # If the previous option needs an argument, assign it. - if test -n "$ac_prev"; then - eval "$ac_prev=\$ac_option" - ac_prev= - continue - fi - - case "$ac_option" in - -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; - *) ac_optarg= ;; - esac - - # Accept the important Cygnus configure options, so we can diagnose typos. - - case "$ac_option" in - - -bindir | --bindir | --bindi | --bind | --bin | --bi) - ac_prev=bindir ;; - -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir="$ac_optarg" ;; - - -build | --build | --buil | --bui | --bu) - ac_prev=build ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build="$ac_optarg" ;; - - -cache-file | --cache-file | --cache-fil | --cache-fi \ - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) - ac_prev=cache_file ;; - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ - | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file="$ac_optarg" ;; - - -datadir | --datadir | --datadi | --datad | --data | --dat | --da) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ - | --da=*) - datadir="$ac_optarg" ;; - - -disable-* | --disable-*) - ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then - { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } - fi - ac_feature=`echo $ac_feature| sed 's/-/_/g'` - eval "enable_${ac_feature}=no" ;; - - -enable-* | --enable-*) - ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then - { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } - fi - ac_feature=`echo $ac_feature| sed 's/-/_/g'` - case "$ac_option" in - *=*) ;; - *) ac_optarg=yes ;; - esac - eval "enable_${ac_feature}='$ac_optarg'" ;; - - -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ - | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ - | --exec | --exe | --ex) - ac_prev=exec_prefix ;; - -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ - | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ - | --exec=* | --exe=* | --ex=*) - exec_prefix="$ac_optarg" ;; - - -gas | --gas | --ga | --g) - # Obsolete; use --with-gas. - with_gas=yes ;; - - -help | --help | --hel | --he) - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat << EOF -Usage: configure [options] [host] -Options: [defaults in brackets after descriptions] -Configuration: - --cache-file=FILE cache test results in FILE - --help print this message - --no-create do not create output files - --quiet, --silent do not print \`checking...' messages - --version print the version of autoconf that created configure -Directory and file names: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [same as prefix] - --bindir=DIR user executables in DIR [EPREFIX/bin] - --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] - --libexecdir=DIR program executables in DIR [EPREFIX/libexec] - --datadir=DIR read-only architecture-independent data in DIR - [PREFIX/share] - --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data in DIR - [PREFIX/com] - --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] - --libdir=DIR object code libraries in DIR [EPREFIX/lib] - --includedir=DIR C header files in DIR [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] - --infodir=DIR info documentation in DIR [PREFIX/info] - --mandir=DIR man documentation in DIR [PREFIX/man] - --srcdir=DIR find the sources in DIR [configure dir or ..] - --program-prefix=PREFIX prepend PREFIX to installed program names - --program-suffix=SUFFIX append SUFFIX to installed program names - --program-transform-name=PROGRAM - run sed PROGRAM on installed program names -EOF - cat << EOF -Host type: - --build=BUILD configure for building on BUILD [BUILD=HOST] - --host=HOST configure for HOST [guessed] - --target=TARGET configure for TARGET [TARGET=HOST] -Features and packages: - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --x-includes=DIR X include files are in DIR - --x-libraries=DIR X library files are in DIR -EOF - if test -n "$ac_help"; then - echo "--enable and --with options recognized:$ac_help" - fi - exit 0 ;; - - -host | --host | --hos | --ho) - ac_prev=host ;; - -host=* | --host=* | --hos=* | --ho=*) - host="$ac_optarg" ;; - - -includedir | --includedir | --includedi | --included | --include \ - | --includ | --inclu | --incl | --inc) - ac_prev=includedir ;; - -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ - | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir="$ac_optarg" ;; - - -infodir | --infodir | --infodi | --infod | --info | --inf) - ac_prev=infodir ;; - -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir="$ac_optarg" ;; - - -libdir | --libdir | --libdi | --libd) - ac_prev=libdir ;; - -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir="$ac_optarg" ;; - - -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ - | --libexe | --libex | --libe) - ac_prev=libexecdir ;; - -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ - | --libexe=* | --libex=* | --libe=*) - libexecdir="$ac_optarg" ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst \ - | --locals | --local | --loca | --loc | --lo) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* \ - | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) - localstatedir="$ac_optarg" ;; - - -mandir | --mandir | --mandi | --mand | --man | --ma | --m) - ac_prev=mandir ;; - -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir="$ac_optarg" ;; - - -nfp | --nfp | --nf) - # Obsolete; use --without-fp. - with_fp=no ;; - - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c) - no_create=yes ;; - - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) - no_recursion=yes ;; - - -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ - | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ - | --oldin | --oldi | --old | --ol | --o) - ac_prev=oldincludedir ;; - -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ - | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ - | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir="$ac_optarg" ;; - - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) - ac_prev=prefix ;; - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix="$ac_optarg" ;; - - -program-prefix | --program-prefix | --program-prefi | --program-pref \ - | --program-pre | --program-pr | --program-p) - ac_prev=program_prefix ;; - -program-prefix=* | --program-prefix=* | --program-prefi=* \ - | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix="$ac_optarg" ;; - - -program-suffix | --program-suffix | --program-suffi | --program-suff \ - | --program-suf | --program-su | --program-s) - ac_prev=program_suffix ;; - -program-suffix=* | --program-suffix=* | --program-suffi=* \ - | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix="$ac_optarg" ;; - - -program-transform-name | --program-transform-name \ - | --program-transform-nam | --program-transform-na \ - | --program-transform-n | --program-transform- \ - | --program-transform | --program-transfor \ - | --program-transfo | --program-transf \ - | --program-trans | --program-tran \ - | --progr-tra | --program-tr | --program-t) - ac_prev=program_transform_name ;; - -program-transform-name=* | --program-transform-name=* \ - | --program-transform-nam=* | --program-transform-na=* \ - | --program-transform-n=* | --program-transform-=* \ - | --program-transform=* | --program-transfor=* \ - | --program-transfo=* | --program-transf=* \ - | --program-trans=* | --program-tran=* \ - | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name="$ac_optarg" ;; - - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - silent=yes ;; - - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) - ac_prev=sbindir ;; - -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ - | --sbi=* | --sb=*) - sbindir="$ac_optarg" ;; - - -sharedstatedir | --sharedstatedir | --sharedstatedi \ - | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ - | --sharedst | --shareds | --shared | --share | --shar \ - | --sha | --sh) - ac_prev=sharedstatedir ;; - -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ - | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ - | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ - | --sha=* | --sh=*) - sharedstatedir="$ac_optarg" ;; - - -site | --site | --sit) - ac_prev=site ;; - -site=* | --site=* | --sit=*) - site="$ac_optarg" ;; - - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir="$ac_optarg" ;; - - -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ - | --syscon | --sysco | --sysc | --sys | --sy) - ac_prev=sysconfdir ;; - -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ - | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir="$ac_optarg" ;; - - -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target="$ac_optarg" ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 2.8" - 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 LANG and LC_ALL to C if already set. -# These must not be set unconditionally because not all systems understand -# e.g. LANG=C (notably SCO). -if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi -if test "${LANG+set}" = set; then LANG=C; export LANG; 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=z8k-dis.c - -# Find the source files, if location was not specified. -if test -z "$srcdir"; then - ac_srcdir_defaulted=yes - # Try the directory containing this script, then its parent. - ac_prog=$0 - ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` - test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. - srcdir=$ac_confdir - if test ! -r $srcdir/$ac_unique_file; then - srcdir=.. - fi -else - ac_srcdir_defaulted=no -fi -if test ! -r $srcdir/$ac_unique_file; then - if test "$ac_srcdir_defaulted" = yes; then - { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } - else - { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } - fi -fi -srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` - -# Prefer explicitly selected file to automatically selected ones. -if test -z "$CONFIG_SITE"; then - if test "x$prefix" != xNONE; then - CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" - else - CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" - fi -fi -for ac_site_file in $CONFIG_SITE; do - if test -r "$ac_site_file"; then - echo "loading site script $ac_site_file" - . "$ac_site_file" - fi -done - -if test -r "$cache_file"; then - echo "loading cache $cache_file" - . $cache_file -else - echo "creating cache $cache_file" - > $cache_file -fi - -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' - -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 - - -# configure.in script for the opcodes library. -# Copyright (C) 1995, 1996 Free Software Foundation, Inc. -# Written by Cygnus Support. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 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. - -# Check whether --enable-targets or --disable-targets was given. -if test "${enable_targets+set}" = set; then - enableval="$enable_targets" - case "${enableval}" in - yes | "") { echo "configure: error: enable-targets option must specify target names or 'all'" 1>&2; exit 1; } - ;; - no) enable_targets= ;; - *) enable_targets=$enableval ;; -esac -fi -# Check whether --enable-shared or --disable-shared was given. -if test "${enable_shared+set}" = set; then - enableval="$enable_shared" - case "${enableval}" in - yes) shared=true ;; - no) shared=false ;; - *) { echo "configure: error: bad value ${enableval} for opcodes shared option" 1>&2; exit 1; } ;; -esac -fi -# Check whether --enable-commonbfdlib or --disable-commonbfdlib was given. -if test "${enable_commonbfdlib+set}" = set; then - enableval="$enable_commonbfdlib" - case "${enableval}" in - yes) commonbfdlib=true ;; - no) commonbfdlib=false ;; - *) { echo "configure: error: bad value ${enableval} for opcodes commonbfdlib option" 1>&2; exit 1; } ;; -esac -fi - - - -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 $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 - -host_alias=$host -case "$host_alias" in -NONE) - case $nonopt in - NONE) - if host_alias=`$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=`$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 - -target_alias=$target -case "$target_alias" in -NONE) - case $nonopt in - NONE) target_alias=$host_alias ;; - *) target_alias=$nonopt ;; - esac ;; -esac - -target=`$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 - -build_alias=$build -case "$build_alias" in -NONE) - case $nonopt in - NONE) build_alias=$host_alias ;; - *) build_alias=$nonopt ;; - esac ;; -esac - -build=`$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 -z "$target" ; then - { echo "configure: error: Unrecognized target system type; please check config.sub." 1>&2; exit 1; } -fi -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," - - -# host-specific stuff: - -ALLLIBS='$(TARGETLIB)' -PICFLAG= -SHLIB=unused-shlib -SHLINK=unused-shlink -if test "${shared}" = "true"; then - ALLLIBS='$(TARGETLIB) $(SHLIB) $(SHLINK)' - PICFLAG=-fpic - if test "${commonbfdlib}" = "true"; then - SHLIB=../bfd/libbfd.so.`sed -e 's/[^0-9]*\([0-9.]*\).*/\1/' ${srcdir}/../bfd/VERSION` - SHLINK=../bfd/libbfd.so - else - SHLIB=libopcodes.so.`sed -e 's/[^0-9]*\([0-9.]*\).*/\1/' ${srcdir}/../bfd/VERSION` - SHLINK=libopcodes.so - fi -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 -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="${IFS}:" - for ac_dir in $PATH; 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 -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="${IFS}:" - ac_prog_rejected=no - for ac_dir in $PATH; 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 - - test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } -fi - -echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then - ac_cv_prog_gcc=yes -else - ac_cv_prog_gcc=no -fi -fi - -echo "$ac_t""$ac_cv_prog_gcc" 1>&6 -if test $ac_cv_prog_gcc = yes; then - GCC=yes - if test "${CFLAGS+set}" != set; then - echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -if eval "test \"`echo '$''{'ac_cv_prog_gcc_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_gcc_g=yes -else - ac_cv_prog_gcc_g=no -fi -rm -f conftest* - -fi - -echo "$ac_t""$ac_cv_prog_gcc_g" 1>&6 - if test $ac_cv_prog_gcc_g = yes; then - CFLAGS="-g -O" - else - CFLAGS="-O" - fi - fi -else - GCC= - test "${CFLAGS+set}" = set || CFLAGS="-g" -fi - - -. ${srcdir}/../bfd/configure.host - - -if test $host != $build; then - ac_tool_prefix=${host_alias}- -else - ac_tool_prefix= -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 -if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$AR"; then - ac_cv_prog_AR="$AR" # Let the user override the test. -else - 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 - ac_cv_prog_AR="${ac_tool_prefix}ar" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_prog_AR" && ac_cv_prog_AR="ar" -fi -fi -AR="$ac_cv_prog_AR" -if test -n "$AR"; then - echo "$ac_t""$AR" 1>&6 -else - echo "$ac_t""no" 1>&6 -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 -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="${IFS}:" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" - break - fi - done - IFS="$ac_save_ifs" -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 - - -if test -z "$ac_cv_prog_RANLIB"; then -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 -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="${IFS}:" - for ac_dir in $PATH; 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 - -else - RANLIB=":" -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 -# 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 -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="${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. - for ac_prog in ginstall installbsd 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. - # OSF/1 installbsd also uses dspmsg, but is usable. - : - 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_DATA" && INSTALL_DATA='${INSTALL} -m 644' - - -if test "${shared}" = "true"; then - if test "${GCC}" != "yes" && test "${shared_non_gcc}" != "yes"; then - echo "configure: warning: opcodes --enable-shared only supported when using gcc" 1>&2 - shared=false - ALLLIBS='$(TARGETLIB)' - PICFLAG= - SHLIB=unused-shlib - fi -fi - - - - - - -if test "${commonbfdlib}" = "true"; then - COMMON_SHLIB=yes - # Rebuild the shared library if libiberty or libbfd changes. - SHLIB_DEP="../libiberty/libiberty.a ../bfd/libbfd.a" -else - COMMON_SHLIB= - SHLIB_DEP= -fi - - - - -echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -# 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 < -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1051: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out` -if test -z "$ac_err"; then - : -else - echo "$ac_err" >&5 - rm -rf conftest* - CPP="${CC-cc} -E -traditional-cpp" - cat > conftest.$ac_ext < -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1066: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out` -if test -z "$ac_err"; then - : -else - echo "$ac_err" >&5 - rm -rf conftest* - CPP=/lib/cpp -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 - -for ac_hdr in string.h strings.h -do -ac_safe=`echo "$ac_hdr" | tr './\055' '___'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1099: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&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 | tr 'abcdefghijklmnopqrstuvwxyz./\055' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ___'` - cat >> confdefs.h <&6 -fi -done - - -# target-specific stuff: - -# Canonicalize the secondary target names. -if test -n "$enable_targets" ; then - for targ in `echo $enable_targets | sed 's/,/ /g'` - do - result=`$ac_config_sub $targ 2>/dev/null` - if test -n "$result" ; then - canon_targets="$canon_targets $result" - else - # Allow targets that config.sub doesn't recognize, like "all". - canon_targets="$canon_targets $targ" - fi - done -fi - -all_targets=false -selarchs= -for targ in $target $canon_targets -do - if test "x$targ" = "xall" ; then - all_targets=true - else - . $srcdir/../bfd/config.bfd - selarchs="$selarchs $targ_archs" - fi -done - -# We don't do any links based on the target system, just makefile config. - -if test x${all_targets} = xfalse ; then - - # Target architecture .o files. - ta= - - for arch in $selarchs - do - ad=`echo $arch | sed -e s/bfd_//g -e s/_arch//g` - archdefs="$archdefs -DARCH_$ad" - case "$arch" in - bfd_a29k_arch) ta="$ta a29k-dis.o" ;; - bfd_alliant_arch) ;; - bfd_alpha_arch) ta="$ta alpha-dis.o" ;; - bfd_arm_arch) ta="$ta arm-dis.o" ;; - bfd_convex_arch) ;; - bfd_h8300_arch) ta="$ta h8300-dis.o" ;; - bfd_h8500_arch) ta="$ta h8500-dis.o" ;; - bfd_hppa_arch) ta="$ta hppa-dis.o" ;; - bfd_i386_arch) ta="$ta i386-dis.o" ;; - bfd_i860_arch) ;; - bfd_i960_arch) ta="$ta i960-dis.o" ;; - bfd_m68k_arch) ta="$ta m68k-dis.o m68k-opc.o" ;; - bfd_m88k_arch) ta="$ta m88k-dis.o" ;; - bfd_mips_arch) ta="$ta mips-dis.o mips-opc.o" ;; - bfd_ns32k_arch) ta="$ta ns32k-dis.o" ;; - bfd_powerpc_arch) ta="$ta ppc-dis.o ppc-opc.o" ;; - bfd_pyramid_arch) ;; - bfd_romp_arch) ;; - bfd_rs6000_arch) ta="$ta ppc-dis.o ppc-opc.o" ;; - bfd_sh_arch) ta="$ta sh-dis.o" ;; - bfd_sparc_arch) ta="$ta sparc-dis.o sparc-opc.o" ;; - bfd_tahoe_arch) ;; - bfd_vax_arch) ;; - bfd_w65_arch) ta="$ta w65-dis.o" ;; - bfd_we32k_arch) ;; - bfd_z8k_arch) ta="$ta z8k-dis.o" ;; - - "") ;; - *) { echo "configure: error: *** unknown target architecture $arch" 1>&2; exit 1; } ;; - esac - done - - # Weed out duplicate .o files. - f="" - for i in $ta ; do - case " $f " in - *" $i "*) ;; - *) f="$f $i" ;; - esac - done - ta="$f" - - # And duplicate -D flags. - f="" - for i in $archdefs ; do - case " $f " in - *" $i "*) ;; - *) f="$f $i" ;; - esac - done - archdefs="$f" - - BFD_MACHINES="$ta" - -else # all_targets is true - archdefs=-DARCH_all - BFD_MACHINES='$(ALL_MACHINES)' -fi - - - - -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 -# 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 | - sed -n "s/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=\${\1='\2'}/p" \ - >> 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 </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.8" - 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 config.h:config.in" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 -EOF -cat >> $CONFIG_STATUS < conftest.subs <<\\CEOF -$ac_vpsub -$extrasub -s%@CFLAGS@%$CFLAGS%g -s%@CPPFLAGS@%$CPPFLAGS%g -s%@CXXFLAGS@%$CXXFLAGS%g -s%@DEFS@%$DEFS%g -s%@LDFLAGS@%$LDFLAGS%g -s%@LIBS@%$LIBS%g -s%@exec_prefix@%$exec_prefix%g -s%@prefix@%$prefix%g -s%@program_transform_name@%$program_transform_name%g -s%@bindir@%$bindir%g -s%@sbindir@%$sbindir%g -s%@libexecdir@%$libexecdir%g -s%@datadir@%$datadir%g -s%@sysconfdir@%$sysconfdir%g -s%@sharedstatedir@%$sharedstatedir%g -s%@localstatedir@%$localstatedir%g -s%@libdir@%$libdir%g -s%@includedir@%$includedir%g -s%@oldincludedir@%$oldincludedir%g -s%@infodir@%$infodir%g -s%@mandir@%$mandir%g -s%@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%@HDEFINES@%$HDEFINES%g -s%@AR@%$AR%g -s%@RANLIB@%$RANLIB%g -s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g -s%@INSTALL_DATA@%$INSTALL_DATA%g -s%@ALLLIBS@%$ALLLIBS%g -s%@PICFLAG@%$PICFLAG%g -s%@SHLIB@%$SHLIB%g -s%@SHLIB_CC@%$SHLIB_CC%g -s%@SHLIB_CFLAGS@%$SHLIB_CFLAGS%g -s%@COMMON_SHLIB@%$COMMON_SHLIB%g -s%@SHLIB_DEP@%$SHLIB_DEP%g -s%@SHLINK@%$SHLINK%g -s%@CPP@%$CPP%g -s%@archdefs@%$archdefs%g -s%@BFD_MACHINES@%$BFD_MACHINES%g - -CEOF -EOF -cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF -for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then - # Support "outfile[: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 relative srcdir, etc. 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 - sed -e "$ac_comsub -s%@configure_input@%$configure_input%g -s%@srcdir@%$srcdir%g -s%@top_srcdir@%$top_srcdir%g -s%@INSTALL@%$INSTALL%g -" -f conftest.subs $ac_given_srcdir/$ac_file_in > $ac_file -fi; done -rm -f conftest.subs - -# 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' - -CONFIG_HEADERS=${CONFIG_HEADERS-"config.h:config.in"} -for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then - # Support "outfile[: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 - cp $ac_given_srcdir/$ac_file_in 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. -# Maximum number of lines to put in a single here document. -ac_max_here_lines=12 - -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 <> $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 - rm -f $ac_file - mv conftest.h $ac_file - fi -fi; done - - -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/contrib/gdb/opcodes/configure.in b/contrib/gdb/opcodes/configure.in deleted file mode 100644 index e0c4f58..0000000 --- a/contrib/gdb/opcodes/configure.in +++ /dev/null @@ -1,216 +0,0 @@ -AC_PREREQ(2.0) -AC_INIT(z8k-dis.c) -# configure.in script for the opcodes library. -# Copyright (C) 1995, 1996 Free Software Foundation, Inc. -# Written by Cygnus Support. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 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. - -AC_ARG_ENABLE(targets, -[ --enable-targets alternative target configurations], -[case "${enableval}" in - yes | "") AC_ERROR(enable-targets option must specify target names or 'all') - ;; - no) enable_targets= ;; - *) enable_targets=$enableval ;; -esac])dnl -AC_ARG_ENABLE(shared, -[ --enable-shared build shared opcodes library], -[case "${enableval}" in - yes) shared=true ;; - no) shared=false ;; - *) AC_MSG_ERROR([bad value ${enableval} for opcodes shared option]) ;; -esac])dnl -AC_ARG_ENABLE(commonbfdlib, -[ --enable-commonbfdlib build shared BFD/opcodes/libiberty library], -[case "${enableval}" in - yes) commonbfdlib=true ;; - no) commonbfdlib=false ;; - *) AC_MSG_ERROR([bad value ${enableval} for opcodes commonbfdlib option]) ;; -esac])dnl - -AC_CONFIG_HEADER(config.h:config.in) - -AC_CONFIG_AUX_DIR(`cd $srcdir/..;pwd`) -AC_CANONICAL_SYSTEM -if test -z "$target" ; then - AC_MSG_ERROR(Unrecognized target system type; please check config.sub.) -fi -AC_ARG_PROGRAM - -# host-specific stuff: - -ALLLIBS='$(TARGETLIB)' -PICFLAG= -SHLIB=unused-shlib -SHLINK=unused-shlink -if test "${shared}" = "true"; then - ALLLIBS='$(TARGETLIB) $(SHLIB) $(SHLINK)' - PICFLAG=-fpic - if test "${commonbfdlib}" = "true"; then -changequote(,)dnl - SHLIB=../bfd/libbfd.so.`sed -e 's/[^0-9]*\([0-9.]*\).*/\1/' ${srcdir}/../bfd/VERSION` -changequote([,])dnl - SHLINK=../bfd/libbfd.so - else -changequote(,)dnl - SHLIB=libopcodes.so.`sed -e 's/[^0-9]*\([0-9.]*\).*/\1/' ${srcdir}/../bfd/VERSION` -changequote([,])dnl - SHLINK=libopcodes.so - fi -fi - -AC_PROG_CC - -. ${srcdir}/../bfd/configure.host - -AC_SUBST(HDEFINES) -AC_CHECK_TOOL(AR, ar) -AC_CHECK_TOOL(RANLIB, ranlib, :) -AC_PROG_INSTALL - -if test "${shared}" = "true"; then - if test "${GCC}" != "yes" && test "${shared_non_gcc}" != "yes"; then - AC_MSG_WARN([opcodes --enable-shared only supported when using gcc]) - shared=false - ALLLIBS='$(TARGETLIB)' - PICFLAG= - SHLIB=unused-shlib - fi -fi - -AC_SUBST(ALLLIBS) -AC_SUBST(PICFLAG) -AC_SUBST(SHLIB) -AC_SUBST(SHLIB_CC) -AC_SUBST(SHLIB_CFLAGS) -if test "${commonbfdlib}" = "true"; then - COMMON_SHLIB=yes - # Rebuild the shared library if libiberty or libbfd changes. - SHLIB_DEP="../libiberty/libiberty.a ../bfd/libbfd.a" -else - COMMON_SHLIB= - SHLIB_DEP= -fi -AC_SUBST(COMMON_SHLIB) -AC_SUBST(SHLIB_DEP) -AC_SUBST(SHLINK) - -AC_CHECK_HEADERS(string.h strings.h) - -# target-specific stuff: - -# Canonicalize the secondary target names. -if test -n "$enable_targets" ; then - for targ in `echo $enable_targets | sed 's/,/ /g'` - do - result=`$ac_config_sub $targ 2>/dev/null` - if test -n "$result" ; then - canon_targets="$canon_targets $result" - else - # Allow targets that config.sub doesn't recognize, like "all". - canon_targets="$canon_targets $targ" - fi - done -fi - -all_targets=false -selarchs= -for targ in $target $canon_targets -do - if test "x$targ" = "xall" ; then - all_targets=true - else - . $srcdir/../bfd/config.bfd - selarchs="$selarchs $targ_archs" - fi -done - -# We don't do any links based on the target system, just makefile config. - -if test x${all_targets} = xfalse ; then - - # Target architecture .o files. - ta= - - for arch in $selarchs - do - ad=`echo $arch | sed -e s/bfd_//g -e s/_arch//g` - archdefs="$archdefs -DARCH_$ad" - case "$arch" in - bfd_a29k_arch) ta="$ta a29k-dis.o" ;; - bfd_alliant_arch) ;; - bfd_alpha_arch) ta="$ta alpha-dis.o" ;; - bfd_arm_arch) ta="$ta arm-dis.o" ;; - bfd_convex_arch) ;; - bfd_h8300_arch) ta="$ta h8300-dis.o" ;; - bfd_h8500_arch) ta="$ta h8500-dis.o" ;; - bfd_hppa_arch) ta="$ta hppa-dis.o" ;; - bfd_i386_arch) ta="$ta i386-dis.o" ;; - bfd_i860_arch) ;; - bfd_i960_arch) ta="$ta i960-dis.o" ;; - bfd_m68k_arch) ta="$ta m68k-dis.o m68k-opc.o" ;; - bfd_m88k_arch) ta="$ta m88k-dis.o" ;; - bfd_mips_arch) ta="$ta mips-dis.o mips-opc.o" ;; - bfd_ns32k_arch) ta="$ta ns32k-dis.o" ;; - bfd_powerpc_arch) ta="$ta ppc-dis.o ppc-opc.o" ;; - bfd_pyramid_arch) ;; - bfd_romp_arch) ;; - bfd_rs6000_arch) ta="$ta ppc-dis.o ppc-opc.o" ;; - bfd_sh_arch) ta="$ta sh-dis.o" ;; - bfd_sparc_arch) ta="$ta sparc-dis.o sparc-opc.o" ;; - bfd_tahoe_arch) ;; - bfd_vax_arch) ;; - bfd_w65_arch) ta="$ta w65-dis.o" ;; - bfd_we32k_arch) ;; - bfd_z8k_arch) ta="$ta z8k-dis.o" ;; - - "") ;; - *) AC_MSG_ERROR(*** unknown target architecture $arch) ;; - esac - done - - # Weed out duplicate .o files. - f="" - for i in $ta ; do - case " $f " in - *" $i "*) ;; - *) f="$f $i" ;; - esac - done - ta="$f" - - # And duplicate -D flags. - f="" - for i in $archdefs ; do - case " $f " in - *" $i "*) ;; - *) f="$f $i" ;; - esac - done - archdefs="$f" - - BFD_MACHINES="$ta" - -else # all_targets is true - archdefs=-DARCH_all - BFD_MACHINES='$(ALL_MACHINES)' -fi - -AC_SUBST(archdefs) -AC_SUBST(BFD_MACHINES) - -AC_OUTPUT(Makefile, -[case x$CONFIG_HEADERS in xconfig.h:config.in) echo > stamp-h ;; esac]) diff --git a/contrib/gdb/opcodes/dis-buf.c b/contrib/gdb/opcodes/dis-buf.c deleted file mode 100644 index 47a2e33..0000000 --- a/contrib/gdb/opcodes/dis-buf.c +++ /dev/null @@ -1,70 +0,0 @@ -/* Disassemble from a buffer, for GNU. - Copyright (C) 1993, 1994 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. */ - -#include "sysdep.h" -#include "dis-asm.h" -#include - -/* Get LENGTH bytes from info's buffer, at target address memaddr. - Transfer them to myaddr. */ -int -buffer_read_memory (memaddr, myaddr, length, info) - bfd_vma memaddr; - bfd_byte *myaddr; - int length; - struct disassemble_info *info; -{ - if (memaddr < info->buffer_vma - || memaddr + length > info->buffer_vma + info->buffer_length) - /* Out of bounds. Use EIO because GDB uses it. */ - return EIO; - memcpy (myaddr, info->buffer + (memaddr - info->buffer_vma), length); - return 0; -} - -/* Print an error message. We can assume that this is in response to - an error return from buffer_read_memory. */ -void -perror_memory (status, memaddr, info) - int status; - bfd_vma memaddr; - struct disassemble_info *info; -{ - if (status != EIO) - /* Can't happen. */ - (*info->fprintf_func) (info->stream, "Unknown error %d\n", status); - else - /* Actually, address between memaddr and memaddr + len was - out of bounds. */ - (*info->fprintf_func) (info->stream, - "Address 0x%x is out of bounds.\n", memaddr); -} - -/* This could be in a separate file, to save miniscule amounts of space - in statically linked executables. */ - -/* Just print the address is hex. This is included for completeness even - though both GDB and objdump provide their own (to print symbolic - addresses). */ - -void -generic_print_address (addr, info) - bfd_vma addr; - struct disassemble_info *info; -{ - (*info->fprintf_func) (info->stream, "0x%x", addr); -} diff --git a/contrib/gdb/opcodes/disassemble.c b/contrib/gdb/opcodes/disassemble.c deleted file mode 100644 index b5d37ae..0000000 --- a/contrib/gdb/opcodes/disassemble.c +++ /dev/null @@ -1,166 +0,0 @@ -/* Select disassembly routine for specified architecture. - Copyright (C) 1994, 1995 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. */ - -#include "ansidecl.h" -#include "dis-asm.h" - -#ifdef ARCH_all -#define ARCH_a29k -#define ARCH_alpha -#define ARCH_arm -#define ARCH_h8300 -#define ARCH_h8500 -#define ARCH_hppa -#define ARCH_i386 -#define ARCH_i960 -#define ARCH_m68k -#define ARCH_m88k -#define ARCH_mips -#define ARCH_ns32k -#define ARCH_powerpc -#define ARCH_rs6000 -#define ARCH_sh -#define ARCH_sparc -#define ARCH_w65 -#define ARCH_z8k -#endif - -disassembler_ftype -disassembler (abfd) - bfd *abfd; -{ - enum bfd_architecture a = bfd_get_arch (abfd); - disassembler_ftype disassemble; - - switch (a) - { - /* If you add a case to this table, also add it to the - ARCH_all definition right above this function. */ -#ifdef ARCH_a29k - case bfd_arch_a29k: - /* As far as I know we only handle big-endian 29k objects. */ - disassemble = print_insn_big_a29k; - break; -#endif -#ifdef ARCH_alpha - case bfd_arch_alpha: - disassemble = print_insn_alpha; - break; -#endif -#ifdef ARCH_arm - case bfd_arch_arm: - if (bfd_big_endian (abfd)) - disassemble = print_insn_big_arm; - else - disassemble = print_insn_little_arm; - break; -#endif -#ifdef ARCH_h8300 - case bfd_arch_h8300: - if (bfd_get_mach(abfd) == bfd_mach_h8300h) - disassemble = print_insn_h8300h; - else - disassemble = print_insn_h8300; - break; -#endif -#ifdef ARCH_h8500 - case bfd_arch_h8500: - disassemble = print_insn_h8500; - break; -#endif -#ifdef ARCH_hppa - case bfd_arch_hppa: - disassemble = print_insn_hppa; - break; -#endif -#ifdef ARCH_i386 - case bfd_arch_i386: - disassemble = print_insn_i386; - break; -#endif -#ifdef ARCH_i960 - case bfd_arch_i960: - disassemble = print_insn_i960; - break; -#endif -#ifdef ARCH_m68k - case bfd_arch_m68k: - disassemble = print_insn_m68k; - break; -#endif -#ifdef ARCH_m88k - case bfd_arch_m88k: - disassemble = print_insn_m88k; - break; -#endif -#ifdef ARCH_ns32k - case bfd_arch_ns32k: - disassemble = print_insn_ns32k; - break; -#endif -#ifdef ARCH_mips - case bfd_arch_mips: - if (bfd_big_endian (abfd)) - disassemble = print_insn_big_mips; - else - disassemble = print_insn_little_mips; - break; -#endif -#ifdef ARCH_powerpc - case bfd_arch_powerpc: - if (bfd_big_endian (abfd)) - disassemble = print_insn_big_powerpc; - else - disassemble = print_insn_little_powerpc; - break; -#endif -#ifdef ARCH_rs6000 - case bfd_arch_rs6000: - disassemble = print_insn_rs6000; - break; -#endif -#ifdef ARCH_sh - case bfd_arch_sh: - if (bfd_big_endian (abfd)) - disassemble = print_insn_sh; - else - disassemble = print_insn_shl; - break; -#endif -#ifdef ARCH_sparc - case bfd_arch_sparc: - disassemble = print_insn_sparc; - break; -#endif -#ifdef ARCH_w65 - case bfd_arch_w65: - disassemble = print_insn_w65; - break; -#endif -#ifdef ARCH_z8k - case bfd_arch_z8k: - if (bfd_get_mach(abfd) == bfd_mach_z8001) - disassemble = print_insn_z8001; - else - disassemble = print_insn_z8002; - break; -#endif - default: - return 0; - } - return disassemble; -} diff --git a/contrib/gdb/opcodes/i386-dis.c b/contrib/gdb/opcodes/i386-dis.c deleted file mode 100644 index b781edc..0000000 --- a/contrib/gdb/opcodes/i386-dis.c +++ /dev/null @@ -1,2031 +0,0 @@ -/* Print i386 instructions for GDB, the GNU debugger. - Copyright (C) 1988, 89, 91, 93, 94, 95, 1996 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -/* - * 80386 instruction printer by Pace Willisson (pace@prep.ai.mit.edu) - * July 1988 - * modified by John Hassey (hassey@dg-rtp.dg.com) - */ - -/* - * The main tables describing the instructions is essentially a copy - * of the "Opcode Map" chapter (Appendix A) of the Intel 80386 - * Programmers Manual. Usually, there is a capital letter, followed - * by a small letter. The capital letter tell the addressing mode, - * and the small letter tells about the operand size. Refer to - * the Intel manual for details. - */ - -#include "dis-asm.h" -#include "sysdep.h" - -#define MAXLEN 20 - -#include - -struct dis_private -{ - /* Points to first byte not fetched. */ - bfd_byte *max_fetched; - bfd_byte the_buffer[MAXLEN]; - bfd_vma insn_start; - jmp_buf bailout; -}; - -/* Make sure that bytes from INFO->PRIVATE_DATA->BUFFER (inclusive) - to ADDR (exclusive) are valid. Returns 1 for success, longjmps - on error. */ -#define FETCH_DATA(info, addr) \ - ((addr) <= ((struct dis_private *)(info->private_data))->max_fetched \ - ? 1 : fetch_data ((info), (addr))) - -static int -fetch_data (info, addr) - struct disassemble_info *info; - bfd_byte *addr; -{ - int status; - struct dis_private *priv = (struct dis_private *)info->private_data; - bfd_vma start = priv->insn_start + (priv->max_fetched - priv->the_buffer); - - status = (*info->read_memory_func) (start, - priv->max_fetched, - addr - priv->max_fetched, - info); - if (status != 0) - { - (*info->memory_error_func) (status, start, info); - longjmp (priv->bailout, 1); - } - else - priv->max_fetched = addr; - return 1; -} - -#define Eb OP_E, b_mode -#define indirEb OP_indirE, b_mode -#define Gb OP_G, b_mode -#define Ev OP_E, v_mode -#define indirEv OP_indirE, v_mode -#define Ew OP_E, w_mode -#define Ma OP_E, v_mode -#define M OP_E, 0 -#define Mp OP_E, 0 /* ? */ -#define Gv OP_G, v_mode -#define Gw OP_G, w_mode -#define Rw OP_rm, w_mode -#define Rd OP_rm, d_mode -#define Ib OP_I, b_mode -#define sIb OP_sI, b_mode /* sign extened byte */ -#define Iv OP_I, v_mode -#define Iw OP_I, w_mode -#define Jb OP_J, b_mode -#define Jv OP_J, v_mode -#define ONE OP_ONE, 0 -#define Cd OP_C, d_mode -#define Dd OP_D, d_mode -#define Td OP_T, d_mode - -#define eAX OP_REG, eAX_reg -#define eBX OP_REG, eBX_reg -#define eCX OP_REG, eCX_reg -#define eDX OP_REG, eDX_reg -#define eSP OP_REG, eSP_reg -#define eBP OP_REG, eBP_reg -#define eSI OP_REG, eSI_reg -#define eDI OP_REG, eDI_reg -#define AL OP_REG, al_reg -#define CL OP_REG, cl_reg -#define DL OP_REG, dl_reg -#define BL OP_REG, bl_reg -#define AH OP_REG, ah_reg -#define CH OP_REG, ch_reg -#define DH OP_REG, dh_reg -#define BH OP_REG, bh_reg -#define AX OP_REG, ax_reg -#define DX OP_REG, dx_reg -#define indirDX OP_REG, indir_dx_reg - -#define Sw OP_SEG, w_mode -#define Ap OP_DIR, lptr -#define Av OP_DIR, v_mode -#define Ob OP_OFF, b_mode -#define Ov OP_OFF, v_mode -#define Xb OP_DSSI, b_mode -#define Xv OP_DSSI, v_mode -#define Yb OP_ESDI, b_mode -#define Yv OP_ESDI, v_mode - -#define es OP_REG, es_reg -#define ss OP_REG, ss_reg -#define cs OP_REG, cs_reg -#define ds OP_REG, ds_reg -#define fs OP_REG, fs_reg -#define gs OP_REG, gs_reg - -int OP_E(), OP_indirE(), OP_G(), OP_I(), OP_sI(), OP_REG(); -int OP_J(), OP_SEG(); -int OP_DIR(), OP_OFF(), OP_DSSI(), OP_ESDI(), OP_ONE(), OP_C(); -int OP_D(), OP_T(), OP_rm(); - -static void dofloat (), putop (), append_prefix (), set_op (); -static int get16 (), get32 (); - -#define b_mode 1 -#define v_mode 2 -#define w_mode 3 -#define d_mode 4 - -#define es_reg 100 -#define cs_reg 101 -#define ss_reg 102 -#define ds_reg 103 -#define fs_reg 104 -#define gs_reg 105 -#define eAX_reg 107 -#define eCX_reg 108 -#define eDX_reg 109 -#define eBX_reg 110 -#define eSP_reg 111 -#define eBP_reg 112 -#define eSI_reg 113 -#define eDI_reg 114 - -#define lptr 115 - -#define al_reg 116 -#define cl_reg 117 -#define dl_reg 118 -#define bl_reg 119 -#define ah_reg 120 -#define ch_reg 121 -#define dh_reg 122 -#define bh_reg 123 - -#define ax_reg 124 -#define cx_reg 125 -#define dx_reg 126 -#define bx_reg 127 -#define sp_reg 128 -#define bp_reg 129 -#define si_reg 130 -#define di_reg 131 - -#define indir_dx_reg 150 - -#define GRP1b NULL, NULL, 0 -#define GRP1S NULL, NULL, 1 -#define GRP1Ss NULL, NULL, 2 -#define GRP2b NULL, NULL, 3 -#define GRP2S NULL, NULL, 4 -#define GRP2b_one NULL, NULL, 5 -#define GRP2S_one NULL, NULL, 6 -#define GRP2b_cl NULL, NULL, 7 -#define GRP2S_cl NULL, NULL, 8 -#define GRP3b NULL, NULL, 9 -#define GRP3S NULL, NULL, 10 -#define GRP4 NULL, NULL, 11 -#define GRP5 NULL, NULL, 12 -#define GRP6 NULL, NULL, 13 -#define GRP7 NULL, NULL, 14 -#define GRP8 NULL, NULL, 15 -#define GRP9 NULL, NULL, 16 - -#define FLOATCODE 50 -#define FLOAT NULL, NULL, FLOATCODE - -struct dis386 { - char *name; - int (*op1)(); - int bytemode1; - int (*op2)(); - int bytemode2; - int (*op3)(); - int bytemode3; -}; - -struct dis386 dis386[] = { - /* 00 */ - { "addb", Eb, Gb }, - { "addS", Ev, Gv }, - { "addb", Gb, Eb }, - { "addS", Gv, Ev }, - { "addb", AL, Ib }, - { "addS", eAX, Iv }, - { "pushl", es }, - { "popl", es }, - /* 08 */ - { "orb", Eb, Gb }, - { "orS", Ev, Gv }, - { "orb", Gb, Eb }, - { "orS", Gv, Ev }, - { "orb", AL, Ib }, - { "orS", eAX, Iv }, - { "pushl", cs }, - { "(bad)" }, /* 0x0f extended opcode escape */ - /* 10 */ - { "adcb", Eb, Gb }, - { "adcS", Ev, Gv }, - { "adcb", Gb, Eb }, - { "adcS", Gv, Ev }, - { "adcb", AL, Ib }, - { "adcS", eAX, Iv }, - { "pushl", ss }, - { "popl", ss }, - /* 18 */ - { "sbbb", Eb, Gb }, - { "sbbS", Ev, Gv }, - { "sbbb", Gb, Eb }, - { "sbbS", Gv, Ev }, - { "sbbb", AL, Ib }, - { "sbbS", eAX, Iv }, - { "pushl", ds }, - { "popl", ds }, - /* 20 */ - { "andb", Eb, Gb }, - { "andS", Ev, Gv }, - { "andb", Gb, Eb }, - { "andS", Gv, Ev }, - { "andb", AL, Ib }, - { "andS", eAX, Iv }, - { "(bad)" }, /* SEG ES prefix */ - { "daa" }, - /* 28 */ - { "subb", Eb, Gb }, - { "subS", Ev, Gv }, - { "subb", Gb, Eb }, - { "subS", Gv, Ev }, - { "subb", AL, Ib }, - { "subS", eAX, Iv }, - { "(bad)" }, /* SEG CS prefix */ - { "das" }, - /* 30 */ - { "xorb", Eb, Gb }, - { "xorS", Ev, Gv }, - { "xorb", Gb, Eb }, - { "xorS", Gv, Ev }, - { "xorb", AL, Ib }, - { "xorS", eAX, Iv }, - { "(bad)" }, /* SEG SS prefix */ - { "aaa" }, - /* 38 */ - { "cmpb", Eb, Gb }, - { "cmpS", Ev, Gv }, - { "cmpb", Gb, Eb }, - { "cmpS", Gv, Ev }, - { "cmpb", AL, Ib }, - { "cmpS", eAX, Iv }, - { "(bad)" }, /* SEG DS prefix */ - { "aas" }, - /* 40 */ - { "incS", eAX }, - { "incS", eCX }, - { "incS", eDX }, - { "incS", eBX }, - { "incS", eSP }, - { "incS", eBP }, - { "incS", eSI }, - { "incS", eDI }, - /* 48 */ - { "decS", eAX }, - { "decS", eCX }, - { "decS", eDX }, - { "decS", eBX }, - { "decS", eSP }, - { "decS", eBP }, - { "decS", eSI }, - { "decS", eDI }, - /* 50 */ - { "pushS", eAX }, - { "pushS", eCX }, - { "pushS", eDX }, - { "pushS", eBX }, - { "pushS", eSP }, - { "pushS", eBP }, - { "pushS", eSI }, - { "pushS", eDI }, - /* 58 */ - { "popS", eAX }, - { "popS", eCX }, - { "popS", eDX }, - { "popS", eBX }, - { "popS", eSP }, - { "popS", eBP }, - { "popS", eSI }, - { "popS", eDI }, - /* 60 */ - { "pusha" }, - { "popa" }, - { "boundS", Gv, Ma }, - { "arpl", Ew, Gw }, - { "(bad)" }, /* seg fs */ - { "(bad)" }, /* seg gs */ - { "(bad)" }, /* op size prefix */ - { "(bad)" }, /* adr size prefix */ - /* 68 */ - { "pushS", Iv }, /* 386 book wrong */ - { "imulS", Gv, Ev, Iv }, - { "pushl", sIb }, /* push of byte really pushes 4 bytes */ - { "imulS", Gv, Ev, Ib }, - { "insb", Yb, indirDX }, - { "insS", Yv, indirDX }, - { "outsb", indirDX, Xb }, - { "outsS", indirDX, Xv }, - /* 70 */ - { "jo", Jb }, - { "jno", Jb }, - { "jb", Jb }, - { "jae", Jb }, - { "je", Jb }, - { "jne", Jb }, - { "jbe", Jb }, - { "ja", Jb }, - /* 78 */ - { "js", Jb }, - { "jns", Jb }, - { "jp", Jb }, - { "jnp", Jb }, - { "jl", Jb }, - { "jnl", Jb }, - { "jle", Jb }, - { "jg", Jb }, - /* 80 */ - { GRP1b }, - { GRP1S }, - { "(bad)" }, - { GRP1Ss }, - { "testb", Eb, Gb }, - { "testS", Ev, Gv }, - { "xchgb", Eb, Gb }, - { "xchgS", Ev, Gv }, - /* 88 */ - { "movb", Eb, Gb }, - { "movS", Ev, Gv }, - { "movb", Gb, Eb }, - { "movS", Gv, Ev }, - { "movw", Ew, Sw }, - { "leaS", Gv, M }, - { "movw", Sw, Ew }, - { "popS", Ev }, - /* 90 */ - { "nop" }, - { "xchgS", eCX, eAX }, - { "xchgS", eDX, eAX }, - { "xchgS", eBX, eAX }, - { "xchgS", eSP, eAX }, - { "xchgS", eBP, eAX }, - { "xchgS", eSI, eAX }, - { "xchgS", eDI, eAX }, - /* 98 */ - { "cwtl" }, - { "cltd" }, - { "lcall", Ap }, - { "(bad)" }, /* fwait */ - { "pushf" }, - { "popf" }, - { "sahf" }, - { "lahf" }, - /* a0 */ - { "movb", AL, Ob }, - { "movS", eAX, Ov }, - { "movb", Ob, AL }, - { "movS", Ov, eAX }, - { "movsb", Yb, Xb }, - { "movsS", Yv, Xv }, - { "cmpsb", Yb, Xb }, - { "cmpsS", Yv, Xv }, - /* a8 */ - { "testb", AL, Ib }, - { "testS", eAX, Iv }, - { "stosb", Yb, AL }, - { "stosS", Yv, eAX }, - { "lodsb", AL, Xb }, - { "lodsS", eAX, Xv }, - { "scasb", AL, Yb }, - { "scasS", eAX, Yv }, - /* b0 */ - { "movb", AL, Ib }, - { "movb", CL, Ib }, - { "movb", DL, Ib }, - { "movb", BL, Ib }, - { "movb", AH, Ib }, - { "movb", CH, Ib }, - { "movb", DH, Ib }, - { "movb", BH, Ib }, - /* b8 */ - { "movS", eAX, Iv }, - { "movS", eCX, Iv }, - { "movS", eDX, Iv }, - { "movS", eBX, Iv }, - { "movS", eSP, Iv }, - { "movS", eBP, Iv }, - { "movS", eSI, Iv }, - { "movS", eDI, Iv }, - /* c0 */ - { GRP2b }, - { GRP2S }, - { "ret", Iw }, - { "ret" }, - { "lesS", Gv, Mp }, - { "ldsS", Gv, Mp }, - { "movb", Eb, Ib }, - { "movS", Ev, Iv }, - /* c8 */ - { "enter", Iw, Ib }, - { "leave" }, - { "lret", Iw }, - { "lret" }, - { "int3" }, - { "int", Ib }, - { "into" }, - { "iret" }, - /* d0 */ - { GRP2b_one }, - { GRP2S_one }, - { GRP2b_cl }, - { GRP2S_cl }, - { "aam", Ib }, - { "aad", Ib }, - { "(bad)" }, - { "xlat" }, - /* d8 */ - { FLOAT }, - { FLOAT }, - { FLOAT }, - { FLOAT }, - { FLOAT }, - { FLOAT }, - { FLOAT }, - { FLOAT }, - /* e0 */ - { "loopne", Jb }, - { "loope", Jb }, - { "loop", Jb }, - { "jCcxz", Jb }, - { "inb", AL, Ib }, - { "inS", eAX, Ib }, - { "outb", Ib, AL }, - { "outS", Ib, eAX }, - /* e8 */ - { "call", Av }, - { "jmp", Jv }, - { "ljmp", Ap }, - { "jmp", Jb }, - { "inb", AL, indirDX }, - { "inS", eAX, indirDX }, - { "outb", indirDX, AL }, - { "outS", indirDX, eAX }, - /* f0 */ - { "(bad)" }, /* lock prefix */ - { "(bad)" }, - { "(bad)" }, /* repne */ - { "(bad)" }, /* repz */ - { "hlt" }, - { "cmc" }, - { GRP3b }, - { GRP3S }, - /* f8 */ - { "clc" }, - { "stc" }, - { "cli" }, - { "sti" }, - { "cld" }, - { "std" }, - { GRP4 }, - { GRP5 }, -}; - -struct dis386 dis386_twobyte[] = { - /* 00 */ - { GRP6 }, - { GRP7 }, - { "larS", Gv, Ew }, - { "lslS", Gv, Ew }, - { "(bad)" }, - { "(bad)" }, - { "clts" }, - { "(bad)" }, - /* 08 */ - { "invd" }, - { "wbinvd" }, - { "(bad)" }, { "ud2a" }, - { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" }, - /* 10 */ - { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" }, - { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" }, - /* 18 */ - { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" }, - { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" }, - /* 20 */ - /* these are all backward in appendix A of the intel book */ - { "movl", Rd, Cd }, - { "movl", Rd, Dd }, - { "movl", Cd, Rd }, - { "movl", Dd, Rd }, - { "movl", Rd, Td }, - { "(bad)" }, - { "movl", Td, Rd }, - { "(bad)" }, - /* 28 */ - { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" }, - { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" }, - /* 30 */ - { "wrmsr" }, { "rdtsc" }, { "rdmsr" }, { "rdpmc" }, - { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" }, - /* 38 */ - { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" }, - { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" }, - /* 40 */ - { "cmovo", Gv,Ev }, { "cmovno", Gv,Ev }, { "cmovb", Gv,Ev }, { "cmovae", Gv,Ev }, - { "cmove", Gv,Ev }, { "cmovne", Gv,Ev }, { "cmovbe", Gv,Ev }, { "cmova", Gv,Ev }, - /* 48 */ - { "cmovs", Gv,Ev }, { "cmovns", Gv,Ev }, { "cmovp", Gv,Ev }, { "cmovnp", Gv,Ev }, - { "cmovl", Gv,Ev }, { "cmovge", Gv,Ev }, { "cmovle", Gv,Ev }, { "cmovg", Gv,Ev }, - /* 50 */ - { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" }, - { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" }, - /* 58 */ - { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" }, - { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" }, - /* 60 */ - { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" }, - { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" }, - /* 68 */ - { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" }, - { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" }, - /* 70 */ - { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" }, - { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" }, - /* 78 */ - { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" }, - { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" }, - /* 80 */ - { "jo", Jv }, - { "jno", Jv }, - { "jb", Jv }, - { "jae", Jv }, - { "je", Jv }, - { "jne", Jv }, - { "jbe", Jv }, - { "ja", Jv }, - /* 88 */ - { "js", Jv }, - { "jns", Jv }, - { "jp", Jv }, - { "jnp", Jv }, - { "jl", Jv }, - { "jge", Jv }, - { "jle", Jv }, - { "jg", Jv }, - /* 90 */ - { "seto", Eb }, - { "setno", Eb }, - { "setb", Eb }, - { "setae", Eb }, - { "sete", Eb }, - { "setne", Eb }, - { "setbe", Eb }, - { "seta", Eb }, - /* 98 */ - { "sets", Eb }, - { "setns", Eb }, - { "setp", Eb }, - { "setnp", Eb }, - { "setl", Eb }, - { "setge", Eb }, - { "setle", Eb }, - { "setg", Eb }, - /* a0 */ - { "pushl", fs }, - { "popl", fs }, - { "cpuid" }, - { "btS", Ev, Gv }, - { "shldS", Ev, Gv, Ib }, - { "shldS", Ev, Gv, CL }, - { "(bad)" }, - { "(bad)" }, - /* a8 */ - { "pushl", gs }, - { "popl", gs }, - { "rsm" }, - { "btsS", Ev, Gv }, - { "shrdS", Ev, Gv, Ib }, - { "shrdS", Ev, Gv, CL }, - { "(bad)" }, - { "imulS", Gv, Ev }, - /* b0 */ - { "cmpxchgb", Eb, Gb }, - { "cmpxchgS", Ev, Gv }, - { "lssS", Gv, Mp }, /* 386 lists only Mp */ - { "btrS", Ev, Gv }, - { "lfsS", Gv, Mp }, /* 386 lists only Mp */ - { "lgsS", Gv, Mp }, /* 386 lists only Mp */ - { "movzbS", Gv, Eb }, - { "movzwS", Gv, Ew }, - /* b8 */ - { "ud2b" }, - { "(bad)" }, - { GRP8 }, - { "btcS", Ev, Gv }, - { "bsfS", Gv, Ev }, - { "bsrS", Gv, Ev }, - { "movsbS", Gv, Eb }, - { "movswS", Gv, Ew }, - /* c0 */ - { "xaddb", Eb, Gb }, - { "xaddS", Ev, Gv }, - { "(bad)" }, - { "(bad)" }, - { "(bad)" }, - { "(bad)" }, - { "(bad)" }, - { GRP9 }, - /* c8 */ - { "bswap", eAX }, - { "bswap", eCX }, - { "bswap", eDX }, - { "bswap", eBX }, - { "bswap", eSP }, - { "bswap", eBP }, - { "bswap", eSI }, - { "bswap", eDI }, - /* d0 */ - { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" }, - { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" }, - /* d8 */ - { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" }, - { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" }, - /* e0 */ - { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" }, - { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" }, - /* e8 */ - { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" }, - { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" }, - /* f0 */ - { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" }, - { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" }, - /* f8 */ - { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" }, - { "(bad)" }, { "(bad)" }, { "(bad)" }, { "(bad)" }, -}; - -static const unsigned char onebyte_has_modrm[256] = { - 1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0, - 1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0, - 1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0, - 1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,1,1,0,0,0,0,0,1,0,1,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 1,1,0,0,1,1,1,1,0,0,0,0,0,0,0,0, - 1,1,1,1,0,0,0,0,1,1,1,1,1,1,1,1, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1 -}; - -static const unsigned char twobyte_has_modrm[256] = { - 1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, - 0,0,0,1,1,1,1,1,0,0,0,1,1,1,1,1, - 1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1, - 1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -}; - -static char obuf[100]; -static char *obufp; -static char scratchbuf[100]; -static unsigned char *start_codep; -static unsigned char *codep; -static disassemble_info *the_info; -static int mod; -static int rm; -static int reg; -static void oappend (); - -static char *names32[]={ - "%eax","%ecx","%edx","%ebx", "%esp","%ebp","%esi","%edi", -}; -static char *names16[] = { - "%ax","%cx","%dx","%bx","%sp","%bp","%si","%di", -}; -static char *names8[] = { - "%al","%cl","%dl","%bl","%ah","%ch","%dh","%bh", -}; -static char *names_seg[] = { - "%es","%cs","%ss","%ds","%fs","%gs","%?","%?", -}; -static char *index16[] = { - "bx+si","bx+di","bp+si","bp+di","si","di","bp","bx" -}; - -struct dis386 grps[][8] = { - /* GRP1b */ - { - { "addb", Eb, Ib }, - { "orb", Eb, Ib }, - { "adcb", Eb, Ib }, - { "sbbb", Eb, Ib }, - { "andb", Eb, Ib }, - { "subb", Eb, Ib }, - { "xorb", Eb, Ib }, - { "cmpb", Eb, Ib } - }, - /* GRP1S */ - { - { "addS", Ev, Iv }, - { "orS", Ev, Iv }, - { "adcS", Ev, Iv }, - { "sbbS", Ev, Iv }, - { "andS", Ev, Iv }, - { "subS", Ev, Iv }, - { "xorS", Ev, Iv }, - { "cmpS", Ev, Iv } - }, - /* GRP1Ss */ - { - { "addS", Ev, sIb }, - { "orS", Ev, sIb }, - { "adcS", Ev, sIb }, - { "sbbS", Ev, sIb }, - { "andS", Ev, sIb }, - { "subS", Ev, sIb }, - { "xorS", Ev, sIb }, - { "cmpS", Ev, sIb } - }, - /* GRP2b */ - { - { "rolb", Eb, Ib }, - { "rorb", Eb, Ib }, - { "rclb", Eb, Ib }, - { "rcrb", Eb, Ib }, - { "shlb", Eb, Ib }, - { "shrb", Eb, Ib }, - { "(bad)" }, - { "sarb", Eb, Ib }, - }, - /* GRP2S */ - { - { "rolS", Ev, Ib }, - { "rorS", Ev, Ib }, - { "rclS", Ev, Ib }, - { "rcrS", Ev, Ib }, - { "shlS", Ev, Ib }, - { "shrS", Ev, Ib }, - { "(bad)" }, - { "sarS", Ev, Ib }, - }, - /* GRP2b_one */ - { - { "rolb", Eb }, - { "rorb", Eb }, - { "rclb", Eb }, - { "rcrb", Eb }, - { "shlb", Eb }, - { "shrb", Eb }, - { "(bad)" }, - { "sarb", Eb }, - }, - /* GRP2S_one */ - { - { "rolS", Ev }, - { "rorS", Ev }, - { "rclS", Ev }, - { "rcrS", Ev }, - { "shlS", Ev }, - { "shrS", Ev }, - { "(bad)" }, - { "sarS", Ev }, - }, - /* GRP2b_cl */ - { - { "rolb", Eb, CL }, - { "rorb", Eb, CL }, - { "rclb", Eb, CL }, - { "rcrb", Eb, CL }, - { "shlb", Eb, CL }, - { "shrb", Eb, CL }, - { "(bad)" }, - { "sarb", Eb, CL }, - }, - /* GRP2S_cl */ - { - { "rolS", Ev, CL }, - { "rorS", Ev, CL }, - { "rclS", Ev, CL }, - { "rcrS", Ev, CL }, - { "shlS", Ev, CL }, - { "shrS", Ev, CL }, - { "(bad)" }, - { "sarS", Ev, CL } - }, - /* GRP3b */ - { - { "testb", Eb, Ib }, - { "(bad)", Eb }, - { "notb", Eb }, - { "negb", Eb }, - { "mulb", AL, Eb }, - { "imulb", AL, Eb }, - { "divb", AL, Eb }, - { "idivb", AL, Eb } - }, - /* GRP3S */ - { - { "testS", Ev, Iv }, - { "(bad)" }, - { "notS", Ev }, - { "negS", Ev }, - { "mulS", eAX, Ev }, - { "imulS", eAX, Ev }, - { "divS", eAX, Ev }, - { "idivS", eAX, Ev }, - }, - /* GRP4 */ - { - { "incb", Eb }, - { "decb", Eb }, - { "(bad)" }, - { "(bad)" }, - { "(bad)" }, - { "(bad)" }, - { "(bad)" }, - { "(bad)" }, - }, - /* GRP5 */ - { - { "incS", Ev }, - { "decS", Ev }, - { "call", indirEv }, - { "lcall", indirEv }, - { "jmp", indirEv }, - { "ljmp", indirEv }, - { "pushS", Ev }, - { "(bad)" }, - }, - /* GRP6 */ - { - { "sldt", Ew }, - { "str", Ew }, - { "lldt", Ew }, - { "ltr", Ew }, - { "verr", Ew }, - { "verw", Ew }, - { "(bad)" }, - { "(bad)" } - }, - /* GRP7 */ - { - { "sgdt", Ew }, - { "sidt", Ew }, - { "lgdt", Ew }, - { "lidt", Ew }, - { "smsw", Ew }, - { "(bad)" }, - { "lmsw", Ew }, - { "invlpg", Ew }, - }, - /* GRP8 */ - { - { "(bad)" }, - { "(bad)" }, - { "(bad)" }, - { "(bad)" }, - { "btS", Ev, Ib }, - { "btsS", Ev, Ib }, - { "btrS", Ev, Ib }, - { "btcS", Ev, Ib }, - }, - /* GRP9 */ - { - { "(bad)" }, - { "cmpxchg8b", Ev }, - { "(bad)" }, - { "(bad)" }, - { "(bad)" }, - { "(bad)" }, - { "(bad)" }, - { "(bad)" }, - } -}; - -#define PREFIX_REPZ 1 -#define PREFIX_REPNZ 2 -#define PREFIX_LOCK 4 -#define PREFIX_CS 8 -#define PREFIX_SS 0x10 -#define PREFIX_DS 0x20 -#define PREFIX_ES 0x40 -#define PREFIX_FS 0x80 -#define PREFIX_GS 0x100 -#define PREFIX_DATA 0x200 -#define PREFIX_ADR 0x400 -#define PREFIX_FWAIT 0x800 - -static int prefixes; - -static void -ckprefix () -{ - prefixes = 0; - while (1) - { - FETCH_DATA (the_info, codep + 1); - switch (*codep) - { - case 0xf3: - prefixes |= PREFIX_REPZ; - break; - case 0xf2: - prefixes |= PREFIX_REPNZ; - break; - case 0xf0: - prefixes |= PREFIX_LOCK; - break; - case 0x2e: - prefixes |= PREFIX_CS; - break; - case 0x36: - prefixes |= PREFIX_SS; - break; - case 0x3e: - prefixes |= PREFIX_DS; - break; - case 0x26: - prefixes |= PREFIX_ES; - break; - case 0x64: - prefixes |= PREFIX_FS; - break; - case 0x65: - prefixes |= PREFIX_GS; - break; - case 0x66: - prefixes |= PREFIX_DATA; - break; - case 0x67: - prefixes |= PREFIX_ADR; - break; - case 0x9b: - prefixes |= PREFIX_FWAIT; - break; - default: - return; - } - codep++; - } -} - -static int dflag; -static int aflag; - -static char op1out[100], op2out[100], op3out[100]; -static int op_address[3], op_ad, op_index[3]; -static int start_pc; - - -/* - * On the 386's of 1988, the maximum length of an instruction is 15 bytes. - * (see topic "Redundant prefixes" in the "Differences from 8086" - * section of the "Virtual 8086 Mode" chapter.) - * 'pc' should be the address of this instruction, it will - * be used to print the target address if this is a relative jump or call - * The function returns the length of this instruction in bytes. - */ - -int -print_insn_i386 (pc, info) - bfd_vma pc; - disassemble_info *info; -{ - struct dis386 *dp; - int i; - int enter_instruction; - char *first, *second, *third; - int needcomma; - unsigned char need_modrm; - - struct dis_private priv; - bfd_byte *inbuf = priv.the_buffer; - - info->private_data = (PTR) &priv; - priv.max_fetched = priv.the_buffer; - priv.insn_start = pc; - if (setjmp (priv.bailout) != 0) - /* Error return. */ - return -1; - - obuf[0] = 0; - op1out[0] = 0; - op2out[0] = 0; - op3out[0] = 0; - - op_index[0] = op_index[1] = op_index[2] = -1; - - the_info = info; - start_pc = pc; - start_codep = inbuf; - codep = inbuf; - - ckprefix (); - - FETCH_DATA (info, codep + 1); - if (*codep == 0xc8) - enter_instruction = 1; - else - enter_instruction = 0; - - obufp = obuf; - - if (prefixes & PREFIX_REPZ) - oappend ("repz "); - if (prefixes & PREFIX_REPNZ) - oappend ("repnz "); - if (prefixes & PREFIX_LOCK) - oappend ("lock "); - - if ((prefixes & PREFIX_FWAIT) - && ((*codep < 0xd8) || (*codep > 0xdf))) - { - /* fwait not followed by floating point instruction */ - (*info->fprintf_func) (info->stream, "fwait"); - return (1); - } - - /* these would be initialized to 0 if disassembling for 8086 or 286 */ - dflag = 1; - aflag = 1; - - if (prefixes & PREFIX_DATA) - dflag ^= 1; - - if (prefixes & PREFIX_ADR) - { - aflag ^= 1; - oappend ("addr16 "); - } - - if (*codep == 0x0f) - { - FETCH_DATA (info, codep + 2); - dp = &dis386_twobyte[*++codep]; - need_modrm = twobyte_has_modrm[*codep]; - } - else - { - dp = &dis386[*codep]; - need_modrm = onebyte_has_modrm[*codep]; - } - codep++; - - if (need_modrm) - { - FETCH_DATA (info, codep + 1); - mod = (*codep >> 6) & 3; - reg = (*codep >> 3) & 7; - rm = *codep & 7; - } - - if (dp->name == NULL && dp->bytemode1 == FLOATCODE) - { - dofloat (); - } - else - { - if (dp->name == NULL) - dp = &grps[dp->bytemode1][reg]; - - putop (dp->name); - - obufp = op1out; - op_ad = 2; - if (dp->op1) - (*dp->op1)(dp->bytemode1); - - obufp = op2out; - op_ad = 1; - if (dp->op2) - (*dp->op2)(dp->bytemode2); - - obufp = op3out; - op_ad = 0; - if (dp->op3) - (*dp->op3)(dp->bytemode3); - } - - obufp = obuf + strlen (obuf); - for (i = strlen (obuf); i < 6; i++) - oappend (" "); - oappend (" "); - (*info->fprintf_func) (info->stream, "%s", obuf); - - /* enter instruction is printed with operands in the - * same order as the intel book; everything else - * is printed in reverse order - */ - if (enter_instruction) - { - first = op1out; - second = op2out; - third = op3out; - op_ad = op_index[0]; - op_index[0] = op_index[2]; - op_index[2] = op_ad; - } - else - { - first = op3out; - second = op2out; - third = op1out; - } - needcomma = 0; - if (*first) - { - if (op_index[0] != -1) - (*info->print_address_func) (op_address[op_index[0]], info); - else - (*info->fprintf_func) (info->stream, "%s", first); - needcomma = 1; - } - if (*second) - { - if (needcomma) - (*info->fprintf_func) (info->stream, ","); - if (op_index[1] != -1) - (*info->print_address_func) (op_address[op_index[1]], info); - else - (*info->fprintf_func) (info->stream, "%s", second); - needcomma = 1; - } - if (*third) - { - if (needcomma) - (*info->fprintf_func) (info->stream, ","); - if (op_index[2] != -1) - (*info->print_address_func) (op_address[op_index[2]], info); - else - (*info->fprintf_func) (info->stream, "%s", third); - } - return (codep - inbuf); -} - -char *float_mem[] = { - /* d8 */ - "fadds", - "fmuls", - "fcoms", - "fcomps", - "fsubs", - "fsubrs", - "fdivs", - "fdivrs", - /* d9 */ - "flds", - "(bad)", - "fsts", - "fstps", - "fldenv", - "fldcw", - "fNstenv", - "fNstcw", - /* da */ - "fiaddl", - "fimull", - "ficoml", - "ficompl", - "fisubl", - "fisubrl", - "fidivl", - "fidivrl", - /* db */ - "fildl", - "(bad)", - "fistl", - "fistpl", - "(bad)", - "fldt", - "(bad)", - "fstpt", - /* dc */ - "faddl", - "fmull", - "fcoml", - "fcompl", - "fsubl", - "fsubrl", - "fdivl", - "fdivrl", - /* dd */ - "fldl", - "(bad)", - "fstl", - "fstpl", - "frstor", - "(bad)", - "fNsave", - "fNstsw", - /* de */ - "fiadd", - "fimul", - "ficom", - "ficomp", - "fisub", - "fisubr", - "fidiv", - "fidivr", - /* df */ - "fild", - "(bad)", - "fist", - "fistp", - "fbld", - "fildll", - "fbstp", - "fistpll", -}; - -#define ST OP_ST, 0 -#define STi OP_STi, 0 -int OP_ST(), OP_STi(); - -#define FGRPd9_2 NULL, NULL, 0 -#define FGRPd9_4 NULL, NULL, 1 -#define FGRPd9_5 NULL, NULL, 2 -#define FGRPd9_6 NULL, NULL, 3 -#define FGRPd9_7 NULL, NULL, 4 -#define FGRPda_5 NULL, NULL, 5 -#define FGRPdb_4 NULL, NULL, 6 -#define FGRPde_3 NULL, NULL, 7 -#define FGRPdf_4 NULL, NULL, 8 - -struct dis386 float_reg[][8] = { - /* d8 */ - { - { "fadd", ST, STi }, - { "fmul", ST, STi }, - { "fcom", STi }, - { "fcomp", STi }, - { "fsub", ST, STi }, - { "fsubr", ST, STi }, - { "fdiv", ST, STi }, - { "fdivr", ST, STi }, - }, - /* d9 */ - { - { "fld", STi }, - { "fxch", STi }, - { FGRPd9_2 }, - { "(bad)" }, - { FGRPd9_4 }, - { FGRPd9_5 }, - { FGRPd9_6 }, - { FGRPd9_7 }, - }, - /* da */ - { - { "fcmovb", ST, STi }, - { "fcmove", ST, STi }, - { "fcmovbe",ST, STi }, - { "fcmovu", ST, STi }, - { "(bad)" }, - { FGRPda_5 }, - { "(bad)" }, - { "(bad)" }, - }, - /* db */ - { - { "fcmovnb",ST, STi }, - { "fcmovne",ST, STi }, - { "fcmovnbe",ST, STi }, - { "fcmovnu",ST, STi }, - { FGRPdb_4 }, - { "fucomi", ST, STi }, - { "fcomi", ST, STi }, - { "(bad)" }, - }, - /* dc */ - { - { "fadd", STi, ST }, - { "fmul", STi, ST }, - { "(bad)" }, - { "(bad)" }, - { "fsub", STi, ST }, - { "fsubr", STi, ST }, - { "fdiv", STi, ST }, - { "fdivr", STi, ST }, - }, - /* dd */ - { - { "ffree", STi }, - { "(bad)" }, - { "fst", STi }, - { "fstp", STi }, - { "fucom", STi }, - { "fucomp", STi }, - { "(bad)" }, - { "(bad)" }, - }, - /* de */ - { - { "faddp", STi, ST }, - { "fmulp", STi, ST }, - { "(bad)" }, - { FGRPde_3 }, - { "fsubp", STi, ST }, - { "fsubrp", STi, ST }, - { "fdivp", STi, ST }, - { "fdivrp", STi, ST }, - }, - /* df */ - { - { "(bad)" }, - { "(bad)" }, - { "(bad)" }, - { "(bad)" }, - { FGRPdf_4 }, - { "fucomip",ST, STi }, - { "fcomip", ST, STi }, - { "(bad)" }, - }, -}; - - -char *fgrps[][8] = { - /* d9_2 0 */ - { - "fnop","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)", - }, - - /* d9_4 1 */ - { - "fchs","fabs","(bad)","(bad)","ftst","fxam","(bad)","(bad)", - }, - - /* d9_5 2 */ - { - "fld1","fldl2t","fldl2e","fldpi","fldlg2","fldln2","fldz","(bad)", - }, - - /* d9_6 3 */ - { - "f2xm1","fyl2x","fptan","fpatan","fxtract","fprem1","fdecstp","fincstp", - }, - - /* d9_7 4 */ - { - "fprem","fyl2xp1","fsqrt","fsincos","frndint","fscale","fsin","fcos", - }, - - /* da_5 5 */ - { - "(bad)","fucompp","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)", - }, - - /* db_4 6 */ - { - "feni(287 only)","fdisi(287 only)","fNclex","fNinit", - "fNsetpm(287 only)","(bad)","(bad)","(bad)", - }, - - /* de_3 7 */ - { - "(bad)","fcompp","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)", - }, - - /* df_4 8 */ - { - "fNstsw","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)", - }, -}; - -static void -dofloat () -{ - struct dis386 *dp; - unsigned char floatop; - - floatop = codep[-1]; - - if (mod != 3) - { - putop (float_mem[(floatop - 0xd8) * 8 + reg]); - obufp = op1out; - OP_E (v_mode); - return; - } - codep++; - - dp = &float_reg[floatop - 0xd8][reg]; - if (dp->name == NULL) - { - putop (fgrps[dp->bytemode1][rm]); - /* instruction fnstsw is only one with strange arg */ - if (floatop == 0xdf - && FETCH_DATA (the_info, codep + 1) - && *codep == 0xe0) - strcpy (op1out, "%eax"); - } - else - { - putop (dp->name); - obufp = op1out; - if (dp->op1) - (*dp->op1)(dp->bytemode1); - obufp = op2out; - if (dp->op2) - (*dp->op2)(dp->bytemode2); - } -} - -/* ARGSUSED */ -int -OP_ST (ignore) - int ignore; -{ - oappend ("%st"); - return (0); -} - -/* ARGSUSED */ -int -OP_STi (ignore) - int ignore; -{ - sprintf (scratchbuf, "%%st(%d)", rm); - oappend (scratchbuf); - return (0); -} - - -/* capital letters in template are macros */ -static void -putop (template) - char *template; -{ - char *p; - - for (p = template; *p; p++) - { - switch (*p) - { - default: - *obufp++ = *p; - break; - case 'C': /* For jcxz/jecxz */ - if (aflag) - *obufp++ = 'e'; - break; - case 'N': - if ((prefixes & PREFIX_FWAIT) == 0) - *obufp++ = 'n'; - break; - case 'S': - /* operand size flag */ - if (dflag) - *obufp++ = 'l'; - else - *obufp++ = 'w'; - break; - } - } - *obufp = 0; -} - -static void -oappend (s) - char *s; -{ - strcpy (obufp, s); - obufp += strlen (s); - *obufp = 0; -} - -static void -append_prefix () -{ - if (prefixes & PREFIX_CS) - oappend ("%cs:"); - if (prefixes & PREFIX_DS) - oappend ("%ds:"); - if (prefixes & PREFIX_SS) - oappend ("%ss:"); - if (prefixes & PREFIX_ES) - oappend ("%es:"); - if (prefixes & PREFIX_FS) - oappend ("%fs:"); - if (prefixes & PREFIX_GS) - oappend ("%gs:"); -} - -int -OP_indirE (bytemode) - int bytemode; -{ - oappend ("*"); - return OP_E (bytemode); -} - -int -OP_E (bytemode) - int bytemode; -{ - int disp; - - /* skip mod/rm byte */ - codep++; - - if (mod == 3) - { - switch (bytemode) - { - case b_mode: - oappend (names8[rm]); - break; - case w_mode: - oappend (names16[rm]); - break; - case v_mode: - if (dflag) - oappend (names32[rm]); - else - oappend (names16[rm]); - break; - default: - oappend (""); - break; - } - return 0; - } - - disp = 0; - append_prefix (); - - if (aflag) /* 32 bit address mode */ - { - int havesib; - int havebase; - int base; - int index; - int scale; - - havesib = 0; - havebase = 1; - base = rm; - - if (base == 4) - { - havesib = 1; - FETCH_DATA (the_info, codep + 1); - scale = (*codep >> 6) & 3; - index = (*codep >> 3) & 7; - base = *codep & 7; - codep++; - } - - switch (mod) - { - case 0: - if (base == 5) - { - havebase = 0; - disp = get32 (); - } - break; - case 1: - FETCH_DATA (the_info, codep + 1); - disp = *(char *)codep++; - break; - case 2: - disp = get32 (); - break; - } - - if (mod != 0 || base == 5) - { - sprintf (scratchbuf, "0x%x", disp); - oappend (scratchbuf); - } - - if (havebase || (havesib && (index != 4 || scale != 0))) - { - oappend ("("); - if (havebase) - oappend (names32[base]); - if (havesib) - { - if (index != 4) - { - sprintf (scratchbuf, ",%s", names32[index]); - oappend (scratchbuf); - } - sprintf (scratchbuf, ",%d", 1 << scale); - oappend (scratchbuf); - } - oappend (")"); - } - } - else - { /* 16 bit address mode */ - switch (mod) - { - case 0: - if (rm == 6) - disp = (short) get16 (); - break; - case 1: - FETCH_DATA (the_info, codep + 1); - disp = *(char *)codep++; - break; - case 2: - disp = (short) get16 (); - break; - } - - if (mod != 0 || rm == 6) - { - sprintf (scratchbuf, "0x%x", disp); - oappend (scratchbuf); - } - - if (mod != 0 || rm != 6) - { - oappend ("("); - oappend (index16[rm]); - oappend (")"); - } - } - return 0; -} - -int -OP_G (bytemode) - int bytemode; -{ - switch (bytemode) - { - case b_mode: - oappend (names8[reg]); - break; - case w_mode: - oappend (names16[reg]); - break; - case d_mode: - oappend (names32[reg]); - break; - case v_mode: - if (dflag) - oappend (names32[reg]); - else - oappend (names16[reg]); - break; - default: - oappend (""); - break; - } - return (0); -} - -static int -get32 () -{ - int x = 0; - - FETCH_DATA (the_info, codep + 4); - x = *codep++ & 0xff; - x |= (*codep++ & 0xff) << 8; - x |= (*codep++ & 0xff) << 16; - x |= (*codep++ & 0xff) << 24; - return (x); -} - -static int -get16 () -{ - int x = 0; - - FETCH_DATA (the_info, codep + 2); - x = *codep++ & 0xff; - x |= (*codep++ & 0xff) << 8; - return (x); -} - -static void -set_op (op) - int op; -{ - op_index[op_ad] = op_ad; - op_address[op_ad] = op; -} - -int -OP_REG (code) - int code; -{ - char *s; - - switch (code) - { - case indir_dx_reg: s = "(%dx)"; break; - case ax_reg: case cx_reg: case dx_reg: case bx_reg: - case sp_reg: case bp_reg: case si_reg: case di_reg: - s = names16[code - ax_reg]; - break; - case es_reg: case ss_reg: case cs_reg: - case ds_reg: case fs_reg: case gs_reg: - s = names_seg[code - es_reg]; - break; - case al_reg: case ah_reg: case cl_reg: case ch_reg: - case dl_reg: case dh_reg: case bl_reg: case bh_reg: - s = names8[code - al_reg]; - break; - case eAX_reg: case eCX_reg: case eDX_reg: case eBX_reg: - case eSP_reg: case eBP_reg: case eSI_reg: case eDI_reg: - if (dflag) - s = names32[code - eAX_reg]; - else - s = names16[code - eAX_reg]; - break; - default: - s = ""; - break; - } - oappend (s); - return (0); -} - -int -OP_I (bytemode) - int bytemode; -{ - int op; - - switch (bytemode) - { - case b_mode: - FETCH_DATA (the_info, codep + 1); - op = *codep++ & 0xff; - break; - case v_mode: - if (dflag) - op = get32 (); - else - op = get16 (); - break; - case w_mode: - op = get16 (); - break; - default: - oappend (""); - return (0); - } - sprintf (scratchbuf, "$0x%x", op); - oappend (scratchbuf); - return (0); -} - -int -OP_sI (bytemode) - int bytemode; -{ - int op; - - switch (bytemode) - { - case b_mode: - FETCH_DATA (the_info, codep + 1); - op = *(char *)codep++; - break; - case v_mode: - if (dflag) - op = get32 (); - else - op = (short)get16(); - break; - case w_mode: - op = (short)get16 (); - break; - default: - oappend (""); - return (0); - } - sprintf (scratchbuf, "$0x%x", op); - oappend (scratchbuf); - return (0); -} - -int -OP_J (bytemode) - int bytemode; -{ - int disp; - int mask = -1; - - switch (bytemode) - { - case b_mode: - FETCH_DATA (the_info, codep + 1); - disp = *(char *)codep++; - break; - case v_mode: - if (dflag) - disp = get32 (); - else - { - disp = (short)get16 (); - /* for some reason, a data16 prefix on a jump instruction - means that the pc is masked to 16 bits after the - displacement is added! */ - mask = 0xffff; - } - break; - default: - oappend (""); - return (0); - } - disp = (start_pc + codep - start_codep + disp) & mask; - set_op (disp); - sprintf (scratchbuf, "0x%x", disp); - oappend (scratchbuf); - return (0); -} - -/* ARGSUSED */ -int -OP_SEG (dummy) - int dummy; -{ - static char *sreg[] = { - "%es","%cs","%ss","%ds","%fs","%gs","%?","%?", - }; - - oappend (sreg[reg]); - return (0); -} - -int -OP_DIR (size) - int size; -{ - int seg, offset; - - switch (size) - { - case lptr: - if (aflag) - { - offset = get32 (); - seg = get16 (); - } - else - { - offset = get16 (); - seg = get16 (); - } - sprintf (scratchbuf, "0x%x,0x%x", seg, offset); - oappend (scratchbuf); - break; - case v_mode: - if (aflag) - offset = get32 (); - else - offset = (short)get16 (); - - offset = start_pc + codep - start_codep + offset; - set_op (offset); - sprintf (scratchbuf, "0x%x", offset); - oappend (scratchbuf); - break; - default: - oappend (""); - break; - } - return (0); -} - -/* ARGSUSED */ -int -OP_OFF (bytemode) - int bytemode; -{ - int off; - - if (aflag) - off = get32 (); - else - off = get16 (); - - sprintf (scratchbuf, "0x%x", off); - oappend (scratchbuf); - return (0); -} - -/* ARGSUSED */ -int -OP_ESDI (dummy) - int dummy; -{ - oappend ("%es:("); - oappend (aflag ? "%edi" : "%di"); - oappend (")"); - return (0); -} - -/* ARGSUSED */ -int -OP_DSSI (dummy) - int dummy; -{ - oappend ("%ds:("); - oappend (aflag ? "%esi" : "%si"); - oappend (")"); - return (0); -} - -/* ARGSUSED */ -int -OP_ONE (dummy) - int dummy; -{ - oappend ("1"); - return (0); -} - -/* ARGSUSED */ -int -OP_C (dummy) - int dummy; -{ - codep++; /* skip mod/rm */ - sprintf (scratchbuf, "%%cr%d", reg); - oappend (scratchbuf); - return (0); -} - -/* ARGSUSED */ -int -OP_D (dummy) - int dummy; -{ - codep++; /* skip mod/rm */ - sprintf (scratchbuf, "%%db%d", reg); - oappend (scratchbuf); - return (0); -} - -/* ARGSUSED */ -int -OP_T (dummy) - int dummy; -{ - codep++; /* skip mod/rm */ - sprintf (scratchbuf, "%%tr%d", reg); - oappend (scratchbuf); - return (0); -} - -int -OP_rm (bytemode) - int bytemode; -{ - switch (bytemode) - { - case d_mode: - oappend (names32[rm]); - break; - case w_mode: - oappend (names16[rm]); - break; - } - return (0); -} diff --git a/contrib/gdb/opcodes/sysdep.h b/contrib/gdb/opcodes/sysdep.h deleted file mode 100644 index f1556da..0000000 --- a/contrib/gdb/opcodes/sysdep.h +++ /dev/null @@ -1,38 +0,0 @@ -/* Random host-dependent support code. - Copyright (C) 1995 Free Software Foundation, Inc. - Written by Ken Raeburn. - -This file is part of libopcodes, the opcodes 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. */ - -/* Do system-dependent stuff, mainly driven by autoconf-detected info. - - Well, some generic common stuff is done here too, like including - ansidecl.h. That's because the .h files in bfd/hosts files I'm - trying to replace often did that. If it can be dropped from this - file (check in a non-ANSI environment!), it should be. */ - -#include "config.h" - -#include - -#ifdef HAVE_STRING_H -#include -#else -#ifdef HAVE_STRINGS_H -#include -#endif -#endif diff --git a/contrib/gdb/opcodes/z8k-dis.c b/contrib/gdb/opcodes/z8k-dis.c deleted file mode 100644 index 8890e12..0000000 --- a/contrib/gdb/opcodes/z8k-dis.c +++ /dev/null @@ -1,571 +0,0 @@ -/* -This file is part of GNU Binutils. - -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 -#include "sysdep.h" -#include "dis-asm.h" - -#define DEFINE_TABLE -#include "z8k-opc.h" - - -#include - - -typedef struct -{ - /* These are all indexed by nibble number (i.e only every other entry - of bytes is used, and every 4th entry of words). */ - unsigned char nibbles[24]; - unsigned char bytes[24]; - unsigned short words[24]; - - /* Nibble number of first word not yet fetched. */ - int max_fetched; - bfd_vma insn_start; - jmp_buf bailout; - - long tabl_index; - char instr_asmsrc[80]; - unsigned long arg_reg[0x0f]; - unsigned long immediate; - unsigned long displacement; - unsigned long address; - unsigned long cond_code; - unsigned long ctrl_code; - unsigned long flags; - unsigned long interrupts; -} -instr_data_s; - -/* Make sure that bytes from INFO->PRIVATE_DATA->BUFFER (inclusive) - to ADDR (exclusive) are valid. Returns 1 for success, longjmps - on error. */ -#define FETCH_DATA(info, nibble) \ - ((nibble) < ((instr_data_s *)(info->private_data))->max_fetched \ - ? 1 : fetch_data ((info), (nibble))) - -static int -fetch_data (info, nibble) - struct disassemble_info *info; - int nibble; -{ - unsigned char mybuf[20]; - int status; - instr_data_s *priv = (instr_data_s *)info->private_data; - bfd_vma start; - - if ((nibble % 4) != 0) - abort (); - - status = (*info->read_memory_func) (priv->insn_start, - (bfd_byte *) mybuf, - nibble / 2, - info); - if (status != 0) - { - (*info->memory_error_func) (status, priv->insn_start, info); - longjmp (priv->bailout, 1); - } - - { - int i; - unsigned char *p = mybuf ; - - for (i = 0; i < nibble;) - { - priv->words[i] = (p[0] << 8) | p[1]; - - priv->bytes[i] = *p; - priv->nibbles[i++] = *p >> 4; - priv->nibbles[i++] = *p &0xf; - - ++p; - priv->bytes[i] = *p; - priv->nibbles[i++] = *p >> 4; - priv->nibbles[i++] = *p & 0xf; - - ++p; - } - } - priv->max_fetched = nibble; - return 1; -} - -static char *codes[16] = -{ - "f", - "lt", - "le", - "ule", - "ov/pe", - "mi", - "eq", - "c/ult", - "t", - "ge", - "gt", - "ugt", - "nov/po", - "pl", - "ne", - "nc/uge" -}; - -int z8k_lookup_instr PARAMS ((unsigned char*, disassemble_info *)); -static void output_instr - PARAMS ((instr_data_s *, unsigned long, disassemble_info *)); -static void unpack_instr PARAMS ((instr_data_s *, int, disassemble_info *)); -static void unparse_instr PARAMS ((instr_data_s *)); - -static int -print_insn_z8k (addr, info, is_segmented) - bfd_vma addr; - disassemble_info *info; - int is_segmented; -{ - instr_data_s instr_data; - - info->private_data = (PTR) &instr_data; - instr_data.max_fetched = 0; - instr_data.insn_start = addr; - if (setjmp (instr_data.bailout) != 0) - /* Error return. */ - return -1; - - instr_data.tabl_index = z8k_lookup_instr (instr_data.nibbles, info); - if (instr_data.tabl_index > 0) - { - unpack_instr (&instr_data, is_segmented, info); - unparse_instr (&instr_data); - output_instr (&instr_data, addr, info); - return z8k_table[instr_data.tabl_index].length; - } - else - { - FETCH_DATA (info, 4); - (*info->fprintf_func) (info->stream, ".word %02x%02x", - instr_data.bytes[0], instr_data.bytes[2]); - return 2; - } -} - -print_insn_z8001 (addr, info) - bfd_vma addr; - disassemble_info *info; -{ - return print_insn_z8k (addr, info, 1); -} - -print_insn_z8002 (addr, info) - bfd_vma addr; - disassemble_info *info; -{ - return print_insn_z8k (addr, info, 0); -} - -int -z8k_lookup_instr (nibbles, info) - unsigned char *nibbles; - disassemble_info *info; -{ - - int nibl_index, tabl_index; - int nibl_matched; - unsigned short instr_nibl; - unsigned short tabl_datum, datum_class, datum_value; - - nibl_matched = 0; - tabl_index = 0; - while (!nibl_matched && z8k_table[tabl_index].name) - { - nibl_matched = 1; - for (nibl_index = 0; nibl_index < z8k_table[tabl_index].length * 2 && nibl_matched; nibl_index++) - { - if ((nibl_index % 4) == 0) - /* Fetch one word at a time. */ - FETCH_DATA (info, nibl_index + 4); - instr_nibl = nibbles[nibl_index]; - - tabl_datum = z8k_table[tabl_index].byte_info[nibl_index]; - datum_class = tabl_datum & CLASS_MASK; - datum_value = ~CLASS_MASK & tabl_datum; - - switch (datum_class) - { - case CLASS_BIT: - if (datum_value != instr_nibl) - nibl_matched = 0; - break; - case CLASS_00II: - if (!((~instr_nibl) & 0x4)) - nibl_matched = 0; - break; - case CLASS_01II: - if (!(instr_nibl & 0x4)) - nibl_matched = 0; - break; - case CLASS_0CCC: - if (!((~instr_nibl) & 0x8)) - nibl_matched = 0; - break; - case CLASS_1CCC: - if (!(instr_nibl & 0x8)) - nibl_matched = 0; - break; - case CLASS_0DISP7: - if (!((~instr_nibl) & 0x8)) - nibl_matched = 0; - nibl_index += 1; - break; - case CLASS_1DISP7: - if (!(instr_nibl & 0x8)) - nibl_matched = 0; - nibl_index += 1; - break; - case CLASS_REGN0: - if (instr_nibl == 0) - nibl_matched = 0; - break; - case CLASS_BIT_1OR2: - if ((instr_nibl | 0x2) != (datum_value | 0x2)) - nibl_matched = 0; - break; - default: - break; - } - } - if (nibl_matched) - { - return tabl_index; - } - - tabl_index++; - } - return -1; - -} - -static void -output_instr (instr_data, addr, info) - instr_data_s *instr_data; - unsigned long addr; - disassemble_info *info; -{ - int loop, loop_limit; - char tmp_str[20]; - char out_str[100]; - - strcpy (out_str, "\t"); - - loop_limit = z8k_table[instr_data->tabl_index].length * 2; - FETCH_DATA (info, loop_limit); - for (loop = 0; loop < loop_limit; loop++) - { - sprintf (tmp_str, "%x", instr_data->nibbles[loop]); - strcat (out_str, tmp_str); - } - - while (loop++ < 8) - { - strcat (out_str, " "); - } - - strcat (out_str, instr_data->instr_asmsrc); - - (*info->fprintf_func) (info->stream, "%s", out_str); -} - -static void -unpack_instr (instr_data, is_segmented, info) - instr_data_s *instr_data; - int is_segmented; - disassemble_info *info; -{ - int nibl_count, loop; - unsigned short instr_nibl, instr_byte, instr_word; - long instr_long; - unsigned short tabl_datum, datum_class, datum_value; - - nibl_count = 0; - loop = 0; - while (z8k_table[instr_data->tabl_index].byte_info[loop] != 0) - { - FETCH_DATA (info, nibl_count + 4 - (nibl_count % 4)); - instr_nibl = instr_data->nibbles[nibl_count]; - instr_byte = instr_data->bytes[nibl_count]; - instr_word = instr_data->words[nibl_count]; - - tabl_datum = z8k_table[instr_data->tabl_index].byte_info[loop]; - datum_class = tabl_datum & CLASS_MASK; - datum_value = tabl_datum & ~CLASS_MASK; - - switch (datum_class) - { - case CLASS_X: - instr_data->address = instr_nibl; - break; - case CLASS_BA: - instr_data->displacement = instr_nibl; - break; - case CLASS_BX: - instr_data->arg_reg[datum_value] = instr_nibl; - break; - case CLASS_DISP: - switch (datum_value) - { - case ARG_DISP16: - instr_data->displacement = instr_word; - nibl_count += 3; - break; - case ARG_DISP12: - instr_data->displacement = instr_word & 0x0fff; - nibl_count += 2; - break; - default: - break; - } - break; - case CLASS_IMM: - switch (datum_value) - { - case ARG_IMM4: - instr_data->immediate = instr_nibl; - break; - case ARG_NIM8: - instr_data->immediate = (-instr_byte); - nibl_count += 1; - break; - case ARG_IMM8: - instr_data->immediate = instr_byte; - nibl_count += 1; - break; - case ARG_IMM16: - instr_data->immediate = instr_word; - nibl_count += 3; - break; - case ARG_IMM32: - FETCH_DATA (info, nibl_count + 8); - instr_long = (instr_data->words[nibl_count] << 16) - | (instr_data->words[nibl_count + 4]); - instr_data->immediate = instr_long; - nibl_count += 7; - break; - case ARG_IMMN: - instr_data->immediate = instr_nibl - 1; - break; - case ARG_IMM4M1: - instr_data->immediate = instr_nibl + 1; - break; - case ARG_IMM_1: - instr_data->immediate = 1; - break; - case ARG_IMM_2: - instr_data->immediate = 2; - break; - case ARG_IMM2: - instr_data->immediate = instr_nibl & 0x3; - break; - default: - break; - } - break; - case CLASS_CC: - instr_data->cond_code = instr_nibl; - break; - case CLASS_CTRL: - instr_data->ctrl_code = instr_nibl; - break; - case CLASS_DA: - case CLASS_ADDRESS: - if (is_segmented) - { - if (instr_nibl & 0x8) - { - FETCH_DATA (info, nibl_count + 8); - instr_long = (instr_data->words[nibl_count] << 16) - | (instr_data->words[nibl_count + 4]); - instr_data->address = ((instr_word & 0x7f00) << 8) + - (instr_long & 0xffff); - nibl_count += 7; - } - else - { - instr_data->address = ((instr_word & 0x7f00) << 8) + - (instr_word & 0x00ff); - nibl_count += 3; - } - } - else - { - instr_data->address = instr_word; - nibl_count += 3; - } - break; - case CLASS_0CCC: - instr_data->cond_code = instr_nibl & 0x7; - break; - case CLASS_1CCC: - instr_data->cond_code = instr_nibl & 0x7; - break; - case CLASS_0DISP7: - instr_data->displacement = instr_byte & 0x7f; - nibl_count += 1; - break; - case CLASS_1DISP7: - instr_data->displacement = instr_byte & 0x7f; - nibl_count += 1; - break; - case CLASS_01II: - instr_data->interrupts = instr_nibl & 0x3; - break; - case CLASS_00II: - instr_data->interrupts = instr_nibl & 0x3; - break; - case CLASS_BIT: - /* do nothing */ - break; - case CLASS_IR: - instr_data->arg_reg[datum_value] = instr_nibl; - break; - case CLASS_FLAGS: - instr_data->flags = instr_nibl; - break; - case CLASS_REG: - instr_data->arg_reg[datum_value] = instr_nibl; - break; - case CLASS_REG_BYTE: - instr_data->arg_reg[datum_value] = instr_nibl; - break; - case CLASS_REG_WORD: - instr_data->arg_reg[datum_value] = instr_nibl; - break; - case CLASS_REG_QUAD: - instr_data->arg_reg[datum_value] = instr_nibl; - break; - case CLASS_REG_LONG: - instr_data->arg_reg[datum_value] = instr_nibl; - break; - case CLASS_REGN0: - instr_data->arg_reg[datum_value] = instr_nibl; - break; - default: - break; - } - - loop += 1; - nibl_count += 1; - } -} - -static void -unparse_instr (instr_data) - instr_data_s *instr_data; -{ - unsigned short tabl_datum, datum_class, datum_value; - int loop, loop_limit; - char out_str[80], tmp_str[25]; - - sprintf (out_str, "\t%s\t", z8k_table[instr_data->tabl_index].name); - - loop_limit = z8k_table[instr_data->tabl_index].noperands; - for (loop = 0; loop < loop_limit; loop++) - { - if (loop) - strcat (out_str, ","); - - tabl_datum = z8k_table[instr_data->tabl_index].arg_info[loop]; - datum_class = tabl_datum & CLASS_MASK; - datum_value = tabl_datum & ~CLASS_MASK; - - switch (datum_class) - { - case CLASS_X: - sprintf (tmp_str, "0x%0x(R%d)", instr_data->address, - instr_data->arg_reg[datum_value]); - strcat (out_str, tmp_str); - break; - case CLASS_BA: - sprintf (tmp_str, "r%d(#%x)", instr_data->arg_reg[datum_value], - instr_data->immediate); - strcat (out_str, tmp_str); - break; - case CLASS_BX: - sprintf (tmp_str, "r%d(R%d)", instr_data->arg_reg[datum_value], - instr_data->arg_reg[ARG_RX]); - strcat (out_str, tmp_str); - break; - case CLASS_DISP: - sprintf (tmp_str, "#0x%0x", instr_data->displacement); - strcat (out_str, tmp_str); - break; - case CLASS_IMM: - sprintf (tmp_str, "#0x%0x", instr_data->immediate); - strcat (out_str, tmp_str); - break; - case CLASS_CC: - sprintf (tmp_str, "%s", codes[instr_data->cond_code]); - strcat (out_str, tmp_str); - break; - case CLASS_CTRL: - sprintf (tmp_str, "0x%0x", instr_data->ctrl_code); - strcat (out_str, tmp_str); - break; - case CLASS_DA: - case CLASS_ADDRESS: - sprintf (tmp_str, "#0x%0x", instr_data->address); - strcat (out_str, tmp_str); - break; - case CLASS_IR: - sprintf (tmp_str, "@R%d", instr_data->arg_reg[datum_value]); - strcat (out_str, tmp_str); - break; - case CLASS_FLAGS: - sprintf (tmp_str, "0x%0x", instr_data->flags); - strcat (out_str, tmp_str); - break; - case CLASS_REG_BYTE: - if (instr_data->arg_reg[datum_value] >= 0x8) - { - sprintf (tmp_str, "rl%d", - instr_data->arg_reg[datum_value] - 0x8); - } - else - { - sprintf (tmp_str, "rh%d", instr_data->arg_reg[datum_value]); - } - strcat (out_str, tmp_str); - break; - case CLASS_REG_WORD: - sprintf (tmp_str, "r%d", instr_data->arg_reg[datum_value]); - strcat (out_str, tmp_str); - break; - case CLASS_REG_QUAD: - sprintf (tmp_str, "rq%d", instr_data->arg_reg[datum_value]); - strcat (out_str, tmp_str); - break; - case CLASS_REG_LONG: - sprintf (tmp_str, "rr%d", instr_data->arg_reg[datum_value]); - strcat (out_str, tmp_str); - break; - default: - break; - } - } - - strcpy (instr_data->instr_asmsrc, out_str); -} -- cgit v1.1