diff options
author | cvs2svn <cvs2svn@FreeBSD.org> | 2001-05-28 05:21:38 +0000 |
---|---|---|
committer | cvs2svn <cvs2svn@FreeBSD.org> | 2001-05-28 05:21:38 +0000 |
commit | aaed0c750bc9cc362fd3502b552c765a1a824b89 (patch) | |
tree | 9b5379638ada041f8ba8bcbc90f3679fcbdc4c5d | |
parent | c9edceadd8a0c5acc1f58da35396d952bdaaf786 (diff) |
This commit was manufactured by cvs2svn to create tagvendor/binutils/2.11.0
'binutils-vendor-binutils_2_11_0'.
Notes
Notes:
svn path=/vendor/binutils/dist/; revision=77298
svn path=/vendor/binutils/2.11.0/; revision=77300; tag=vendor/binutils/2.11.0
96 files changed, 0 insertions, 59901 deletions
diff --git a/contrib/binutils/ChangeLog b/contrib/binutils/ChangeLog deleted file mode 100644 index 8229a66a3813..000000000000 --- a/contrib/binutils/ChangeLog +++ /dev/null @@ -1,6721 +0,0 @@ -2000-11-07 Philip Blundell <pb@futuretv.com> - - * Makefile.in (ETC_SUPPORT): Also add configbuild.* and configdev.*. - -2000-11-03 Philip Blundell <pb@futuretv.com> - - * Makefile.in (ETC_SUPPORT): Add configure.texi and associated info - files. - -2000-03-29 Jason Merrill <jason@casey.cygnus.com> - - * configure.in: -linux-gnu*, not -linux-gnu. - -2000-03-10 H.J. Lu <hjl@gnu.org> - - * Makefile.in (all-gcc): Backed out the last change. - -2000-03-10 H.J. Lu <hjl@gnu.org> - - * Makefile.in (all-gcc): Run ld/ld-new if necessary. - -Fri Mar 3 18:44:08 2000 Andrew Cagney <cagney@b1.cygnus.com> - - * Makefile.in (taz): Set PACKAGE to TOOL when not defined. - (do-tar-bz2): Replace TOOL with PACKAGE. - (gdb.tar.bz2): Remove GDBTK from GDB package. - (gdb+dejagnu.tar.bz2, insight.tar.bz2, insight+dejagnu.tar.bz2, - dejagnu.tar.bz2): New packages. - -2000-02-27 Andreas Jaeger <aj@suse.de> - - * configure.in: Add entry for mips*-*-linux*, move catch all - *-*-*linux* entry below this one. - -2000-02-27 Ian Lance Taylor <ian@zembu.com> - - * ltconfig, ltmain.sh: Update to libtool 1.3.4. - -2000-02-24 Nick Clifton <nickc@cygnus.com> - - * config.sub: Support an OS of "wince". - -Thu Feb 24 16:15:56 2000 Andrew Cagney <cagney@b1.cygnus.com> - - * config.guess, config.sub: Updated to match config's 2000-02-15 - version. - -2000-02-23 Linas Vepstas <linas@linas.org> - - * config.sub: Add support for Linux/IBM 370. - * configure.in: Likewise. - -2000-02-22 Nick Clifton <nickc@cygnus.com> - - * configure.in: Add mips-pe, sh-pe and arm-wince-pe targets. - -2000-02-20 Christopher Faylor <cgf@cygnus.com> - - * config.guess: Guess "cygwin" rather than "cygwin32". - -2000-02-16 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> - - * configure (gcc_version): When setting, narrow search to - lines containing `version_string'. - -2000-01-06 Geoff Keating <geoffk@cygnus.com> - - * configure.in: Use mt-aix43 to handle *_TARGET defs, - not mh-aix43. - -1999-09-04 Steve Chamberlain <sac@pobox.com> - - * config.sub: Add support for configuring for pj. - -1999-08-31 Nick Clifton <nickc@cygnus.com> - - * config.sub (maybe_os): Add support for configuring for fr30. - -1999-08-27 Nick Clifton <nickc@cygnus.com> - - * configure.in: Do not configure or build ld for AIX - platforms. ld is known to be broken on these platforms. - -1999-08-09 Ian Lance Taylor <ian@zembu.com> - - * Makefile.in (LDFLAGS): Define. - -1999-08-08 Mumit Khan <khan@xraylith.wisc.edu> - - * configure.in (i[3456]-*-mingw32*): Don't put gprof in - noconfigdirs. - (*-*-cygwin*): Likewise. - -1999-08-08 Ian Lance Taylor <ian@zembu.com> - - * mkdep: New file. - * Makefile.in (GAS_SUPPORT_DIRS): Add mkdep. - (BINUTILS_SUPPORT_DIRS): Add mkdep. - - From Eli Zaretskii <eliz@is.elta.co.il>: - * configure (tmpfile): Change cONf$$ to cNf$$ to avoid an overly - long file name when using DJGPP on MS-DOS. - -1999-07-30 Alan Modra <alan@spri.levels.unisa.edu.au> - - * Makefile.in (check-target-libio): Remove all-target-libstdc++ - dependency as this causes "make check" to globally "make all" - -1999-07-22 Ian Lance Taylor <ian@zembu.com> - - * Makefile.in (binutils.tar.bz2): Don't pass makeall.bat and - configure.bat in SUPPORT_FILES. - (gas+binutils.tar.bz2): Likewise. - - * makeall.bat: Remove; obsolete. - -1999-07-21 Ian Lance Taylor <ian@zembu.com> - - From Mark Elbrecht: - * configure.bat: Remove; obsolete. - -1999-07-11 Ian Lance Taylor <ian@zembu.com> - - * configure: Add -W -Wall to the default CFLAGS when compiling with - gcc. - -Thu Jul 8 12:32:23 1999 John David Anglin <dave@hiauly1.hia.nrc.ca> - - * configure.in: Build ld, binutils & gas for hppa*-*-linux-gnu*. - -1999-06-30 Mark Mitchell <mark@codesourcery.com> - - * configure.in: Build ld on IRIX6. - -1999-06-12 Ian Lance Taylor <ian@zembu.com> - - * Makefile.in: Change distribution targets to use bzip2 instead of - gzip. - (TEXINFO_SUPPORT): Set to just texinfo/texinfo.tex. - (taz): Don't use texinfo/gpl.texinfo or texinfo/lgpl.texinfo. - -1999-06-04 Nick Clifton <nickc@cygnus.com> - - * config.sub: Add mcore target. - -Sun May 30 16:03:16 1999 Cort Dougan <cort@cs.nmt.edu> - - * config.guess (ppc-*-linux-gnu): Also use ld emul elf32ppclinux. - -1999-05-24 Nick Clifton <nickc@cygnus.com> - - * config.sub: Updated to match latest EGCS version. - -1999-04-30 Tom Tromey <tromey@cygnus.com> - - * ltmain.sh: [mode link] Always use CC given by ltconfig. - -1999-04-23 Tom Tromey <tromey@cygnus.com> - - * ltconfig, ltmain.sh: Update to libtool 1.2f. - -1999-04-20 Drew Moseley <dmoseley@cygnus.com> - - * configure.in (noconfigdirs): Don't build libstub for arm-elf targets. - (noconfigdirs): Don't build any bsp stuff for for arm-oabi targets. - Bad merge removed these two changes. - -1999-04-11 Richard Henderson <rth@cygnus.com> - - * configure.in (i?86-*-beos*): Do config gperf; don't config - gdb, newlib, or libgloss. - -1999-04-08 Nick Clifton <nickc@cygnus.com> - - * config.sub: Add support for mcore targets. - -1999-04-07 Michael Meissner <meissner@cygnus.com> - - * configure.in (d30v-*): Use config/mt-d30v as makefile fragment, - not mt-ospace, in order to shut up assembler warning about using - symbols that are named the same as registers. - -1999-04-07 Drew Moseley <dmoseley@cygnus.com> - - * Makefile.in (all-target-cygmon): Added all-target-bsp to the - dependency list for all-target-cygmon. - -1999-04-05 Doug Evans <devans@casey.cygnus.com> - - * config-ml.in: Check $host, not $target, for selective multilibs. - (arm-*-*): Allow disabling of biendian, h/w fp, 26 bit apcs, - thumb interworking, and underscore prefix multilibs. - -1999-04-04 Ian Lance Taylor <ian@zembu.com> - - * missing: Update to version from current automake. - -Fri Apr 2 15:11:32 1999 H.J. Lu (hjl@gnu.org) - - * configure (gxx_include_dir): Removed. - - * configure.in (gxx_include_dir): Handle it. - * Makefile.in: Likewise. - -1999-03-29 Gavin Romig-Koch <gavin@cygnus.com> - - * config.sub (mips64vr4111,mips64vr4111el) Add. - -1999-03-21 Ben Elliston <bje@cygnus.com> - - * config.guess: Correct typo for detecting ELF on FreeBSD. - -Thu Mar 18 00:17:50 1999 Mark Elbrecht <snowball3@usa.net> - - * config/mh-go32: Delete. - * config/mh-djgpp: New. Renamed from mh-go32. - * configure.in (pc-msdosdjgpp): Set host_makefile_frag to - config/mh-djgpp. - -Thu Mar 11 18:37:23 1999 Drew Moseley <dmoseley@cygnus.com> - - * Makefile.in (all-target-bsp): Added all-gcc all-binutils and - all-target-newlib to dependency list for all-target-bsp. - -Thu Mar 11 01:19:31 1999 Mumit Khan <khan@xraylith.wisc.edu> - - * config.sub: Add i386-uwin support. - * config.guess: Likewise. - -Thu Mar 11 01:07:55 1999 Franz Sirl <Franz.Sirl-kernel@lauterbach.com> - - * configure.in: cleanup, add mh-*pic handling for arm, special - case powerpc*-*-aix* - -Wed Mar 10 18:35:07 1999 Jeff Johnston <jjohnstn@cygnus.com> - - * configure.in (noconfigdirs): Removed target-libgloss so libnosys.a - can be built. - -Wed Mar 10 17:39:09 1999 Drew Moseley <dmoseley@cygnus.com> - - * configure.in: Added bsp support to arm-*-coff and arm-*-elf - targets. - -1999-03-02 Nick Clifton <nickc@cygnus.com> - - * config.sub: Rename CYGNUS LOCAL to EGCS LOCAL - -Sun Feb 28 02:20:00 1999 Geoffrey Noer <noer@cygnus.com> - - * config.sub: Check for "cygwin*" rather than "cygwin32*" - -1999-02-24 Nick Clifton <nickc@cygnus.com> - - * config.sub: Fix typo in arm recognition. - -Wed Feb 24 13:51:40 1999 Drew Moseley <dmoseley@cygnus.com> - - * configure.in (noconfigdirs): Changed target_configdirs to - include target-bsp only for m68k-*-elf* and m68k-*-coff* - rather than m68k-*-* since it is not known to work on - m68k-aout. Ditto for arm-*-*oabi. - -Wed Feb 24 12:52:17 1999 Stan Shebs <shebs@andros.cygnus.com> - - * configure.in (*-*-windows*): Remove, no longer used. - * config/mh-windows: Ditto. - -1999-02-19 Ben Elliston <bje@cygnus.com> - - * config.guess: Automatically recognise ELF on FreeBSD. From Niall - Smart and improved by Andrew Cagney. - -Thu Feb 18 19:55:09 1999 Marc Espie <espie@cvs.openbsd.org> - - * config.guess: Recognize openbsd-*-hppa. - -Wed Feb 17 01:38:59 1999 H.J. Lu (hjl@gnu.org) - - * Makefile.in (REALLY_SET_LIB_PATH): Append $$$(RPATH_ENVVAR) - only if it is not empty. - -1999-02-17 Nick Clifton <nickc@cygnus.com> - - Patch from: Scott Bambrough <scottb@corelcomputer.com> - - * config.guess: Modified to recognize uname's armv* syntax. - - * config.sub: Modified to recognize uname's armv* syntax. - -1999-02-17 Mark Salter <msalter@cygnus.com> - - * configure.in: Added target-bsp for sparclite. - -Mon Feb 8 14:17:24 1999 Richard Henderson <rth@cygnus.com> - - * config.sub: Recognize alphapca5[67] and up to alphaev8. - -1999-02-08 Nick Clifton <nickc@cygnus.com> - - * configure.in: Add support for strongarm port. - * config.sub: Add support for strongarm target. - -Sun Feb 7 18:01:54 1999 Mumit Khan <khan@xraylith.wisc.edu> - - * configure.in (*-*-cygwin32*): Use config/mh-cygwin instead of - the old name config/mh-cygwin32. - Enable texinfo. - -Thu Feb 4 20:43:25 1999 Ian Lance Taylor <ian@cygnus.com> - - * configure.in: Do build ld for ix86 Solaris. - -Tue Feb 2 19:46:40 1999 Jim Wilson <wilson@cygnus.com> - - * Makefile.in (EXTRA_GCC_FLAGS): Set AR to $AR instead of - $AR_FOR_TARGET. Likewise for RANLIB. - -Tue Feb 2 20:05:05 1999 Catherine Moore <clm@cygnus.com> - - * config.sub (oabi): Recognize. - * configure.in (arm-*-oabi): Handle. - -Sat Jan 30 06:09:00 1999 Robert Lipe (robertlipe@usa.net) - - * config.guess: Improve detection of i686 on UnixWare 7. - -Sat Jan 30 08:04:00 1999 Mumit Khan <khan@xraylith.wisc.edu> - - * config.guess: Add support for i386-pc-interix. - * config.sub: Likewise. - * configure.in: Likewise. - * config/mh-interix: New file. - -Mon Jan 18 13:59:20 1999 Christopher Faylor <cgf@cygnus.com> - - * Makefile.in: Remove unneeded all-target-libio from - from all-target-winsup target since it is now unneeded. - Add all-target-libtermcap in its place since it is now - needed. - -Wed Dec 30 20:34:52 1998 Christopher Faylor <cgf@cygnus.com> - - * configure.in: makefile stub for cygwin target is probably - unnecessary. Remove it for now. - * config/mt-cygwin: Remove. - -Wed Dec 30 01:13:03 1998 Christopher Faylor <cgf@cygnus.com> - - * configure.in: libtermcap.a should be built when cygwin is the - target as well as the host. - * config.guess: Allow mixed case in cygwin uname output. - * Makefile.in: Add libtermcap target. - * config/mt-cygwin: New file. libtermcap target info. - -Tue Dec 15 17:02:58 1998 Bob Manson <manson@charmed.cygnus.com> - - * configure.in: Add cygmon for x86-coff and x86-elf. Configure - cygmon for all sparclite targets, regardless of object format. - -1998-12-15 Mark Salter <msalter@cygnus.com> - - * configure.in: Added target-bsp for several target architectures. - - * Makefile.in: Added rules for bsp. - -Wed Dec 23 00:20:50 1998 Jeffrey A Law (law@cygnus.com) - - * config.sub: Clean up handling of hppa2.0. - -Tue Dec 22 23:56:31 1998 Rodney Brown (rodneybrown@pmsc.com) - - * config.guess: Use C code to identify more HP machines. - -Thu Dec 17 01:22:30 1998 Jeffrey A Law (law@cygnus.com) - - * config.sub: Handle hppa2.0. - -Fri Dec 4 01:34:02 1998 Jeffrey A Law (law@cygnus.com) - - * config.guess: Improve detection of hppa2.0 processors. - -Fri Dec 4 01:33:05 1998 Niall Smart <nialls@euristix.ie> - - * config.guess: Recognize FreeBSD using ELF automatically. - -1998-11-26 Manfred Hollstein <manfred@s-direktnet.de> - - * configure (skip-this-dir): Add handling for new shell script, which - might be created by a sub-directory's configure to indicate, this particular - directory is "unwanted". - * Makefile.in ($(CONFIGURE_TARGET_MODULES)): Likewise. - - -Wed Nov 18 18:28:45 1998 Geoffrey Noer <noer@cygnus.com> - - * ltconfig: import from libtool, after changing libtool to - account for the cygwin name change. - -Wed Nov 18 18:09:14 1998 Geoffrey Noer <noer@cygnus.com> - - * Makefile.in: CC_FOR_TARGET and CXX_FOR_TARGET should also - include newlib/libc/sys/cygwin and newlib/libc/sys/cygwin32. - -Wed Nov 18 20:13:29 1998 Christopher Faylor <cgf@cygnus.com> - - * configure.in: Add libtermcap to list of cygwin dependencies. - -Tue Nov 17 16:57:51 1998 Geoffrey Noer <noer@cygnus.com> - - * Makefile.in: modify CC_FOR_TARGET and CXX_FOR_TARGET so that - they include winsup/include when it's a cygwin target. - -1998-11-12 Tom Tromey <tromey@cygnus.com> - - * configure.in (host_tools): Added zip. - * Makefile.in (all-target-libjava): Depend on all-zip. - (all-zip): New target. - (ALL_MODULES): Added all-zip. - (NATIVE_CHECK_MODULES): Added check-zip. - (INSTALL_MODULES): Added install-zip. - (CLEAN_MODULES): Added clean-zip. - -Thu Nov 12 17:27:21 1998 Geoffrey Noer <noer@cygnus.com> - - * Makefile.in: lose "32" from comment about cygwin. - -Thu Nov 5 15:00:31 1998 Nick Clifton <nickc@cygnus.com> - - * configure.in: Use -Os to build target libraries for the fr30. - -Wed Nov 4 18:49:43 1998 Dave Brolley <brolley@cygnus.com> - - * config.sub: Add fr30. - -Mon Nov 2 15:19:33 1998 Geoffrey Noer <noer@cygnus.com> - - * configure.in: drop "32" from config/mh-cygwin32. Check - cygwin* instead of cygwin32*. - * config.sub: Check cygwin* instead of cygwin32*. - -1998-10-20 Syd Polk <spolk@cygnus.com> - - * Makefile.in configure.in: Add the ability to use tcl8.1 and tk8.1 - if desired. - -Sun Oct 18 18:34:50 1998 Jeffrey A Law (law@cygnus.com) - - * config.if (cxx_interface, libstdcxx_interface): Do not try to set - these if the appropriate directories and files to not exist. - -Wed Oct 14 10:29:06 1998 Jeffrey A Law (law@cygnus.com) - - * Makefile.in (DEVO_SUPPORT): Add config.if. - -Tue Oct 13 09:17:06 1998 Jeffrey A Law (law@cygnus.com) - - * config.sub: Bring back lost sparcv9. - -Wed Sep 30 22:20:50 1998 Robert Lipe <robertl@dgii.com> - - * config.sub: Add support for i[34567]86-pc-udk. - * configure.in: Likewise. - -Wed Sep 30 19:23:48 1998 Geoffrey Noer <noer@cygnus.com> - - * Makefile.in: add bzip2 package building bits for user - tools module - * configure.in: ditto - -1998-09-30 Manfred Hollstein <manfred@s-direktnet.de> - - * configure.in (target_subdir): Remove duplicate line. - -Tue Sep 29 22:45:41 1998 Felix Lee <flee@cygnus.com> - - * Makefile.in (all-automake): fix dependencies. - -Mon Sep 28 04:04:27 1998 Jeffrey A Law (law@cygnus.com) - - * configure.in: Minor cleanups for building in the $(target_alias) - subdir. - -1998-09-22 Jim Wilson <wilson@cygnus.com> - - * Makefile.in (bootstrap): Set r and s before make all. Use - BASE_FLAGS_TO_PASS in make all. - (cross): Likewise. - -1998-09-20 Mark Mitchell <mark@markmitchell.com> - - * Makefile.in (bootstrap): Pass TARGET_FLAGS_TO_PASS to `make all'. - - -Sun Sep 20 00:13:02 1998 Richard Henderson <rth@cygnus.com> - - * config.sub: Fix typo in last change. - -1998-09-19 Michael Hayes <m.hayes@elec.canterbury.ac.nz> - - * config.sub: Add support for C4x target. - * configure.in: Likewise. - -1998-09-13 David S. Miller <davem@pierdol.cobaltmicro.com> - - * config.sub: Recognize sparcv9 just like sparc64. - -Wed Sep 9 15:44:52 1998 Robert Lipe <robertl@dgii.com> - - * config.guess: Match "Pent II" or "PentII" for OpenServer. - -Tue Sep 8 01:18:39 1998 Jeffrey A Law (law@cygnus.com) - - * config.guess: Correctly identify Pentium II sco boxes. - - * config.guess: Fix "tr" code. From Weiwen Liu. - -Sat Sep 5 13:56:52 1998 John Hughes <john@Calva.COM> - - * configure.in: Do not assume x86-svr4 or x86-unixware can handle - stabs. - -Sat Sep 5 02:12:02 1998 Jeffrey A Law (law@cygnus.com) - - * Makefile.in (TARGET_CONFIGDIRS): Add libchill. - (ALL_TARGET_MODULES): Add all-target-libchill. - (CONFIGURE_TARGET_MODULES, CHECK_TARGET_MODULES): Similarly. - (INSTALL_TARGET_MODULES, CLEAN_TARGET_MODULES): Similarly. - (all-target-libchill): Add dependencies. - * configure.in (target_libs): Add libchill. - -Sun Aug 30 22:27:02 1998 Lutz Wohlrab <lutz.wohlrab@informatik.tu-chemnitz.de> - - * config.guess: Avoid assumptions about "tr" behaves when - LANG is set to something other than English. - -Sun Aug 30 22:14:44 1998 H.J. Lu (hjl@gnu.org) - - * configure (gxx_include_dir): Changed to - '${prefix}/include/g++'-${libstdcxx_interface}. - - * config.if: New to determine the interfaces. - -Sun Aug 30 21:15:19 1998 Mark Klein (mklein@dis.com) - - * config.guess: Detect and handle MPE/IX. - * config.sub: Deal with MPE/IX. - -Sat Aug 29 14:32:55 1998 David Edelsohn <edelsohn@mhpcc.edu> - - * configure.in: Use mh-aix43. - -1998-07-29 Manfred Hollstein <manfred@s-direktnet.de> - - * configure: Fix --without/--disable cases for gxx-include-dir. - -Fri Aug 28 12:28:26 1998 Per Bothner <bothner@cygnus.com> - - * mdata-sh: Imported. Needed for automake support. - -Thu Aug 13 12:49:29 1998 H.J. Lu <hjl@gnu.org> - - * Makefile.in (taz): Try "chmod -R og=u ." before - "chmod og=u `find . -print`". - -Fri Jul 31 09:38:33 1998 Catherine Moore <clm@cygnus.com> - - * configure.in: Add arm-elf and thumb-elf support. - -Mon Jul 27 16:23:58 1998 Doug Evans <devans@canuck.cygnus.com> - - * Makefile.in: Undo previous patch. - -Fri Jul 24 19:55:24 1998 Doug Evans <devans@canuck.cygnus.com> - - * Makefile.in (INSTALL_TARGET): Move EXTRA_TARGET_HOST_INSTALL_MODULES - to here ... - (install-no-fixedincludes): and here - (INSTALL_MODULES): ... from here. - -Fri Jul 24 17:01:42 1998 Ian Lance Taylor <ian@cygnus.com> - - * config.sub: Merge with FSF. - - * config.guess: Merge with FSF. - -Fri Jul 24 08:43:36 1998 Doug Evans <devans@canuck.cygnus.com> - - * configure (extraconfigdirs): New variable. - (SUBDIRS): Add extraconfigdirs and recurse on them too. - * Makefile.in (all): Move higher in file. - (EXTRA_TARGET_HOST_ALL_MODULES): New variable. - (EXTRA_TARGET_HOST_{INSTALL,CHECK}_MODULES): New variables. - (ALL_MODULES): Add EXTRA_TARGET_HOST_ALL_MODULES. - (CROSS_CHECK_MODULES): Add EXTRA_TARGET_HOST_CHECK_MODULES. - (INSTALL_MODULES): Add EXTRA_TARGET_HOST_INSTALL_MODULES. - -1998-07-23 Brendan Kehoe <brendan@cygnus.com> - - * Makefile.in (all-target-libjava): Depend on all-gcc and - all-target-newlib. - (configure-target-libjava): Depend on $(ALL_GCC). - -Sat Jul 18 14:32:43 CDT 1998 Robert Lipe <robertl@dgii.com> - - * config.guess: (*-pc-sco3.2v5) Add detection for Pentium II. - (*-pc-unixware7) Add detection for Pentium II, Pentium Pro. - -Fri Jul 17 13:30:18 1998 Ian Lance Taylor <ian@cygnus.com> - - * ylwrap: Change absolute path checks to check for DOS style path - names. - - * ylwrap: Don't use a full path name if the source file is in the - same directory. From hjl@lucon.org (H.J. Lu). - - * config-ml.in: Default to being verbose, to match Feb 18 change to - configure. - -Thu Jul 16 12:29:51 1998 Ian Lance Taylor <ian@cygnus.com> - - Brought over from egcs: - - Sat Jun 27 22:46:32 1998 Jeffrey A Law (law@cygnus.com) - - * configure.in (target_subdir): Set to ${target_alias} instead - of "libraries". - - Mon Sep 1 16:45:44 1997 Jim Wilson <wilson@cygnus.com> - - * configure.in (target_subdir): Set to libraries if enable_multilib. - -Wed Jul 15 01:00:54 1998 Ian Lance Taylor <ian@cygnus.com> - - * Makefile.in ($(CONFIGURE_TARGET_MODULES)): If there are any - multilibs, force reconfiguration the first time we create - multilib.out in a subdirectory, in case TARGET_SUBDIR is `.'. - -Tue Jul 14 23:41:03 1998 Ian Lance Taylor <ian@cygnus.com> - - * configure.in: Strip any --no option from CONFIG_ARGUMENTS, to - avoid confusion with --no-recursion. - -Tue Jul 14 15:37:41 1998 Geoffrey Noer <noer@cygnus.com> - - * configure.in: Win32 hosts shouldn't use install -x - * install-sh: remove -x option, and special .exe-handling - hack. - -Tue Jul 14 15:28:41 1998 Richard Henderson <rth@cygnus.com> - - * config.guess: Recognize i586-pc-beos. - * configure.in: Don't build some bits for beos. - -Tue Jul 14 13:22:18 1998 Ian Lance Taylor <ian@cygnus.com> - - * configure: If CC is set but CFLAGS is not, and CC is gcc, make - CFLAGS default to -O2. - - * ltmain.sh: Add some hacks to make SunOS --enable-shared work - when using GNU ld. - -Fri Jul 10 13:18:23 1998 Ian Lance Taylor <ian@cygnus.com> - - * ltmain.sh: Correct install when using a different shell. - -Tue Jul 7 15:24:38 1998 Ian Lance Taylor <ian@cygnus.com> - - * ltconfig, ltmain.sh: Update to libtool 1.2b. - -Thu Jul 2 13:57:36 1998 Klaus Kaempf <kkaempf@rmi.de> - - * makefile.vms: Update to build binutils/makefile.vms. Add install - target. - -Wed Jul 1 16:45:21 1998 Ian Lance Taylor <ian@cygnus.com> - - * ltconfig: Update to correct AIX handling. - -Sat Jun 27 22:46:32 1998 Jeffrey A Law (law@cygnus.com) - - * Makefile.in (BASE_FLAGS_TO_PASS): Add TARGET_SUBDIR. - - * configure.in (target_subdir): Set to ${target_alias} instead - of "libraries". - -1998-06-26 Manfred Hollstein <manfred@s-direktnet.de> - - * Makefile.in (BASE_FLAGS_TO_PASS): Add gcc_version_trigger. - (Makefile): Depend on $(gcc_version_trigger). - - * configure (gcc_version): Change default initializer to empty - string. - (gcc_version_trigger): New variable; pass this variable down - to subdir configures to enable them checking gcc's version - themselves. Emit make macros for both gcc_version vars. - (topsrcdir): Initialize reliably. - (recursion line): Remove --with-gcc-version=${gcc_version}. - -1998-06-24 Manfred Hollstein <manfred@s-direktnet.de> - - * configure (enable_version_specific_runtime_libs): Implement new flag - --enable-version-specific-runtime-libs which installs C++ runtime stuff - in $(libsubdir); emit definition in each generated Makefile. - (gxx_include_dir): Initialize depending on - $enable_version_specific_runtime_libs. - -1998-06-24 Manfred Hollstein <manfred@s-direktnet.de> - - * configure (gcc_version): Initialize properly depending on - how and where configure is started. - (recursion line): Pass a --with-gcc-version=${gcc_version} - to configures in subdirs. - -Wed Jun 24 16:01:59 1998 John Metzler <jmetzler@cygnus.com> - - * configure.in (noconfigdirs): Add configure pattern for mips tx39 - cygmon - -Tue Jun 23 22:42:32 1998 Mark Alexander <marka@cygnus.com> - - * configure.in: Add cygmon and libstub support for mn10200. - -1998-06-19 Manfred Hollstein <manfred@s-direktnet.de> - - * configure (gcc_version): Add new variable describing the - particular gcc version we're building. - * Makefile.in (libsubdir): Add new macro for the directory - in which the compiler finds executables, libraries, etc. - (BASE_FLAGS_TO_PASS): Pass down gcc_version, target_alias - and libsubdir. - -Fri Jun 19 02:36:59 1998 Alexandre Oliva <oliva@dcc.unicamp.br> - - * Makefile.in (local-clean): remove *.log - (warning.log): built with warn_summary from build.log - (mail-report.log): run test_summary - (mail-report-with-warnings.log): run test_summary including - warning.log in the report - -Thu Jun 18 11:26:03 1998 Robert Lipe <robertl@dgii.com> - - * config.guess: Detection of Pentium II for *-sco-3.2v5*. - -Mon Jun 15 14:53:54 1998 Andrew Cagney <cagney@b1.cygnus.com> - - * Makefile.in (grep): Grep no longer depends on libiberty. - -Fri Jun 12 14:03:34 1998 Syd Polk <spolk@cygnus.com> - - * Makefile.in: all-snavigator needs all-libgui. - -Thu Jun 11 19:43:47 1998 Mark Alexander <marka@cygnus.com> - - * configure.in: Add cygmon and libstub support for mn10300. - -Wed Jun 10 11:19:47 1998 Ian Lance Taylor <ian@cygnus.com> - - * missing: Update to version from automake 1.3. - - * ltmain.sh: On installation, don't get confused if the same name - appears more than once in the list of library names. - -Wed Jun 3 14:51:42 1998 Ian Lance Taylor <ian@cygnus.com> - - * config.sub: Accept m68060 and m5200 as CPU names. - -Mon Jun 1 17:25:16 1998 Ian Lance Taylor <ian@cygnus.com> - - * configure: Use && rather than using -a in test, because odd - strings can confuse test. - * configure.in: Likewise. - -Thu May 28 19:31:13 1998 Ian Lance Taylor <ian@cygnus.com> - - * ltconfig, ltmain.sh: Bring in Visual C++ support. - -Sat May 23 23:44:13 1998 Alexandre Oliva <oliva@dcc.unicamp.br> - - * Makefile.in (boostrap2-lean, bootstrap3-lean, - bootstrap4-lean): new targets - -Mon May 11 23:11:34 1998 Jeffrey A Law (law@cygnus.com) - - * COPYING.LIB: Update FSF address. - -Fri May 8 01:30:20 1998 Ian Lance Taylor <ian@cygnus.com> - - * ltconfig, ltmain.sh: Update to libtool 1.2a. - - * Makefile.in (GASB_SUPPORT_DIRS): Remove intl; already included via - GAS_SUPPORT_DIRS. - -Thu May 7 17:27:35 1998 Ian Lance Taylor <ian@cygnus.com> - - * ltconfig, ltmain.sh: Avoid producing a version number if - -version-info was not used. - -Tue May 5 18:02:24 1998 Ian Lance Taylor <ian@cygnus.com> - - * configure.in: Add --with-newlib to CONFIG_ARGUMENTS if we are - building with newlib. - -1998-04-30 Paul Eggert <eggert@twinsun.com> - - * Makefile.in (EXTRA_GCC_FLAGS): Remove backslash at end; - Solaris `make' causes it to continue to next definition. - -Tue Apr 28 16:24:24 1998 Jason Molenda (crash@bugshack.cygnus.com) - - * Makefile.in (install-gdbtk): Call this 'install-gdb' so that - the right GUI libraries and files are installed along with GDB. - -Tue Apr 28 18:11:24 1998 Ian Lance Taylor <ian@cygnus.com> - - * configure.in: Change alpha to alpha* in several places. - -Tue Apr 28 07:42:00 1998 Mark Alexander <marka@cygnus.com> - - * config.sub: Recognize sparc86x. - -Tue Apr 28 07:35:02 1998 Michael Meissner <meissner@cygnus.com> - - * configure.in (--enable-target-optspace): Remove debug echo. - -Thu Apr 23 21:31:16 1998 Jim Wilson <wilson@cygnus.com> - - * configure: Set CXXFLAGS from CXXFLAGS, not CFLAGS. - -Thu Apr 23 12:26:38 1998 Ian Lance Taylor <ian@cygnus.com> - - * ltconfig: Update cygwin32 support. - - * Makefile.in (GAS_SUPPORT_DIRS): Add intl. - (BINUTILS_SUPPORT_DIRS, GASB_SUPPORT_DIRS): Likewise. - (GDB_SUPPORT_DIRS): Likewise. - -Wed Apr 22 12:30:10 1998 Michael Meissner <meissner@cygnus.com> - - * configure.in (target_makefile_frag): If --enable-target-optspace, - use -Os to compile target libraries rather than -O2. Default to - using -Os for d10v and m32r if --{enable,disable}-target-optspace is - not used. - * configure.in (target_cflags): Ditto for d30v. - -Tue Apr 21 23:06:54 1998 Tom Tromey <tromey@cygnus.com> - - * Makefile.in (all-bfd): Depend on all-intl. - (all-binutils): Likewise. - (all-gas): Likewise. - (all-gprof): Likewise. - (all-ld): Likewise. - - -1998-04-19 Brendan Kehoe <brendan@cygnus.com> - - * configure.in (host_tools): Fix typo, lbtool -> libtool. - -Fri Apr 17 16:20:42 1998 Ian Lance Taylor <ian@cygnus.com> - - * Makefile.in (all-bfd): Depend upon all-libiberty. - - * ltconfig, ltmain.sh: Bring in newer cygwin32 support. - -Fri Apr 17 12:22:22 1998 Bob Manson <manson@charmed.cygnus.com> - - * Makefile.in: Add libstub. - - * configure.in: Ditto. Build libstub for targets that have cygmon - support. - -Tue Apr 14 18:01:55 1998 Ian Lance Taylor <ian@cygnus.com> - - * configure.in: Don't set PICFLAG on ix86-cygwin32. - -Tue Apr 14 12:24:45 1998 J. Kean Johnston <jkj@sco.com> - - * configure.in: Recognise i[3456]96-*-sysv5* as a valid host, and - use mh-sysv5 if specified. Support gprof on SCO Open Server. - -Tue Apr 14 11:33:51 1998 Krister Walfridsson <cato@df.lth.se> - - * configure: Define DEFAULT_M4 by searching PATH. - * Makfile.in: Use DEFAULT_M4. - -Mon Apr 13 15:37:24 1998 Ian Lance Taylor <ian@cygnus.com> - - * ltconfig: Add cygwin32 support. - - * Makefile.in, configure.in: Add libtool as a native only directory - to configure and build. - -Wed Apr 8 13:18:56 1998 Philippe De Muyter <phdm@macqel.be> - - * Makefile.in (EXTRA_GCC_FLAGS): XFOO lines shortened. - -Thu Apr 2 14:48:44 1998 Geoffrey Noer <noer@cygnus.com> - - * Makefile.in: add ash make rules - * configure.in: add ash to native_only and host_tools lists - -Thu Mar 26 12:53:20 1998 Tom Tromey <tromey@cygnus.com> - - * Makefile.in (all-gettext, all-intl): New targets. - (ALL_MODULES): Added all-gettext, all-intl. - (CROSS_CHECK_MODULES): Added check-gettext, check-intl. - (INSTALL_MODULES): Added install-gettext, install-intl. - (CLEAN_MODULES): Added clean-gettext, clean-intl. - - * configure.in (host_tools): Added gettext. - (native_only): Likewise. - (noconfigdirs) [various cases]: Likewise. - (host_libs): Added intl. - -Thu Mar 26 15:00:11 1998 Keith Seitz <keiths@onions.cygnus.com> - - * configure: Do not disable building gdbtk for cygwin32 hosts. - -Wed Mar 25 11:49:12 1998 Jason Molenda (crash@bugshack.cygnus.com) - - * Makefile.in: Revert yesterday's change. - (all-target-winsup): all-target-librx stays out of here. - -Tue Mar 24 16:58:29 1998 Jason Molenda (crash@bugshack.cygnus.com) - - * Makefile.in (TARGET_CONFIGDIRS, ALL_TARGET_MODULES, - CONFIGURE_TARGET_MODULES, CHECK_TARGET_MODULES, - INSTALL_TARGET_MODULES, CLEAN_TARGET_MODULES, all-target-winsup): - Remove references to librx and libg++. - -Tue Mar 24 18:28:12 1998 Eric Mumpower <nocturne@cygnus.com> - - * Makefile.in (BASE_FLAGS_TO_PASS): Pass $(lispdir) down to - recursive makes - -Tue Mar 24 11:37:45 1998 Ian Lance Taylor <ian@cygnus.com> - - * Makefile.in (CC_FOR_TARGET): Use $(TARGET_SUBDIR) when passing -B - for newlib directory. - (CXX_FOR_TARGET): Likewise. - -Mon Mar 23 11:30:21 1998 Jeffrey A Law (law@cygnus.com) - - * ltconfig: Update after libtool/ltconfig.in change for - hpux11. - -Fri Mar 20 18:51:43 1998 Ian Lance Taylor <ian@cygnus.com> - - * ltconfig, ltmain.sh: Update to libtool 1.2. - -Fri Mar 20 09:32:14 1998 Manfred Hollstein <manfred@s-direktnet.de> - - * Makefile.in (install-gcc): Don't specify LANGUAGES here. - (install-gcc-cross): Instead, override LANGUAGES here. - -1998-03-18 Dave Love <d.love@dl.ac.uk> - - * Makefile.in ($(CONFIGURE_TARGET_MODULES)): Set CONFIG_SITE to a - non-existent file since /dev/null loses with bash 2.0/autoconf 2.12. - -Wed Mar 18 09:24:59 1998 Nick Clifton <nickc@cygnus.com> - - * configure.in: Add Thumb-pe target. - -Tue Mar 17 16:59:00 1998 Syd Polk <spolk@cygnus.com> - * Makefile.in - changed sn targets to snavigator - * configure.in - changed sn targets to snavigator - -Tue Mar 17 10:33:28 1998 Manfred Hollstein <manfred@s-direktnet.de> - - * config-ml.in: After building symlink tree call make distclean - if a Makefile got linked into ${ml_dir}/${ml_libdir}; this happens - to be the case for libiberty. - -Tue Mar 17 10:22:37 1998 H.J. Lu (hjl@gnu.ai.mit.edu) - - * configure: When making link, also check the current - directory. The configure scripts may create one. - -Fri Mar 6 01:02:03 1998 Richard Henderson <rth@cygnus.com> - - * config.sub: Accept alphapca56 and alphaev6 properly. - -Fri Mar 6 00:14:55 1998 Franz Sirl <Franz.Sirl-kernel@lauterbach.com> - - * configure.in: Revert 3 Jan change for powerpc-linux-gnulibc1. - - -Mon Feb 23 15:09:18 1998 Bruno Haible <bruno@linuix.mathematik.uni-karlsruhe.de - - * config.sub (sco5): Fix typo. - -Mon Feb 23 14:46:06 1998 Ian Lance Taylor <ian@cygnus.com> - - * Makefile.in (INSTALL_MODULES): Move install-tcl before - install-itcl. - (install-itcl): Remove dependency on install-tcl. - -Mon Feb 23 09:53:28 1998 Mark Alexander <marka@cygnus.com> - - * configure.in: Remove libgloss from noconfigdirs for MN10300. - -Fri Feb 20 16:47:24 1998 Tom Tromey <tromey@cygnus.com> - - * configure: Don't let builds be done in source tree. - -Thu Feb 19 13:40:41 1998 Ian Lance Taylor <ian@cygnus.com> - - * configure.in: Don't build libgui for a cygwin32 target when not on - a cygwin32 host. - -Wed Feb 18 12:29:00 1998 Jason Molenda (crash@bugshack.cygnus.com) - - * configure (redirect): Set to null, so default behavior of - configure is now --verbose. - -1998-02-16 Dave Love <d.love@dl.ac.uk> - - * Makefile.in ($(CONFIGURE_TARGET_MODULES)): Run configure with - CONFIG_SITE=/dev/null to forestall lossage with site configuration. - -Mon Feb 16 12:23:53 1998 Manfred Hollstein <Manfred.Hollstein@ks.sel.alcatel.de> - - * Makefile.in (BASE_FLAGS_TO_PASS, EXTRA_TARGET_FLAGS): Really add - this change to sync Makefile.in with its ChangeLog entries. - -Thu Feb 12 15:03:08 1998 H.J. Lu <hjl@gnu.org> - - * ltmain.sh (mkdir): Check that the directory doesn't exist - before we exit with error, so that we don't get races during - parallel builds. - -Sat Feb 7 15:19:18 1998 Ian Lance Taylor <ian@cygnus.com> - - * ltconfig, ltmain.sh: Update from libtool 1.0i. - -Fri Feb 6 01:33:52 1998 Manfred Hollstein <manfred@s-direktnet.de> - - * Makefile.in (BASE_FLAGS_TO_PASS): Don't pass PICFLAG and - PICFLAG_FOR_TARGET. - (EXTRA_TARGET_FLAGS): Don't pass PICFLAG_FOR_TARGET. - - * configure: Emit a definition for the new macro enable_shared - into each Makefile. - - * config/mh-sparcpic (PICFLAG): Define to properly according - to current multilib configuration. - * config/mt-sparcpic (PICFLAG_FOR_TARGET): Define to properly - according to current multilib configuration. - -Thu Feb 5 17:01:12 1998 Jason Molenda (crash@bugshack.cygnus.com) - - * configure.in (host_tools, native_only): Add libtool. - -Wed Feb 4 16:53:58 1998 Geoffrey Noer <noer@cygnus.com> - - * configure.in: add target-gperf to noconfigdirs for Cygwin32. - Fix typo in ming config comment. - -Wed Feb 4 18:56:13 1998 Ian Lance Taylor <ian@cygnus.com> - - * ltconfig, ltmain.sh: Update from libtool 1.0h. - -Mon Feb 2 19:38:19 1998 Ian Lance Taylor <ian@cygnus.com> - - * config.sub: Add tic30 cases, and map c30 to tic30. - -Fri Jan 30 17:18:32 1998 Geoffrey Noer <noer@cygnus.com> - - * configure.in: Remove expect from noconfigdirs when target - is cygwin32. OK to build expect and dejagnu with Canadian - Cross. - -Wed Jan 28 12:58:49 1998 Ian Lance Taylor <ian@cygnus.com> - - * configure.in: Do build expect, dejagnu, and cvssrc for a cygwin32 - host. - - * config.guess: Use ${UNAME_MACHINE} rather than i386 for cygwin32 - and mingw32. - -Wed Jan 28 10:26:37 1998 Manfred Hollstein <manfred@s-direktnet.de> - - * Makefile.in (BASE_FLAGS_TO_PASS): Remove passing $(local_prefix) - here as it is not defined in the toplevel Makefile. - -Tue Jan 27 23:25:06 1998 Manfred Hollstein <manfred@s-direktnet.de> - - * configure (package_makefile_rules_frag): New variable, which names - a file with generic rules, ... - Change comment to mention we now have FIVE parts. - * configure: Undo last change. - -Tue Jan 27 23:15:55 1998 Lassi A. Tuura <lat@iki.fi> - - * config.guess: More accurate determination of HP processor types. - * config.sub: More accurate determination of HP processor types. - -Sat Jan 24 01:59:45 1998 Manfred Hollstein <manfred@s-direktnet.de> - - * configure (package_makefile_frag): Move inserting the - ${package_makefile_frag} to where it should be according - to the comment. - -Fri Jan 23 00:30:21 1998 Philip Blundell <pb@nexus.co.uk> - - * config.guess: Add support for Linux/ARM. - -Thu Jan 22 15:14:01 1998 Fred Fish <fnf@cygnus.com> - - * .cvsignore: Remove *-info and *-install since they match - release-info and mpw-install, which we don't want to just ignore. - -Thu Jan 22 01:38:33 1998 Richard Henderson <rth@cygnus.com> - - * configure.in: Revert 3 Jan change for alpha-linux-gnulibc1. - -Sat Jan 17 21:28:08 1998 Pieter Nagel <pnagel@epiuse.co.za> - - * Makefile.in (FLAGS_TO_PASS): Pass down gcc_include_dir and - local_prefix to sub-make invocations. - -Sat Jan 17 21:04:59 1998 H.J. Lu (hjl@gnu.org) - - * configure.in: Check makefile fragments in the source - directory. - -Fri Jan 16 00:41:37 1998 Alexandre Oliva <oliva@dcc.unicamp.br> - - * configure.in: check whether host and target makefile - fragments exist before adding them to *_makefile_frag - -Wed Jan 14 23:39:10 1998 Bob Manson <manson@charmed.cygnus.com> - - * configure.in (target_configdirs): Add cygmon for sparc64-elf. - -Wed Jan 14 12:48:07 1998 Keith Seitz <keiths@pizza.cygnus.com> - - * configure.in: Make sure we only replace RPATH_ENVVAR on - lines which begin with RPATH_ENVVAR, i.e. add "^" to the - regexp to sed. - - * Makefile.in (BASE_FLAGS_TO_PASS): Pass RRPATH_ENVVAR down - to sub-makes. - -1998-01-13 Lee Iverson (leei@ai.sri.com) - - * config-ml.in (multi-do): LDFLAGS must include multilib - designator. - -Tue Jan 13 01:13:24 1998 Robert Lipe (robertl@dgii.com) - - * config.guess: Recognize i[3456]-i586-UnixWare7-sysv5. - -Sun Jan 4 01:06:55 1998 Mumit Khan <khan@xraylith.wisc.edu> - - * config.sub: Add mingw32 support. - * configure.in: Likewise. - * mh-mingw32: New file. - -Sat Jan 3 12:11:05 1998 Franz Sirl <franz.sirl-kernel@lauterbach.com> - - * configure.in: Finalize support for {alpha|powerpc}*-*-linux-gnulibc1 - -Sun Dec 28 11:28:58 1997 Jeffrey A Law (law@cygnus.com) - - * Makefile.in (INSTALL_TARGET): Do install-gcc first. - * configure (gxx_include_dir): Provide a definition for subdirs - which do not use autoconf. - -Wed Dec 24 22:46:55 1997 Jeffrey A Law (law@cygnus.com) - - * config.guess: Sync with egcs. Picks up new alpha support, - BeOS & some additional linux support. - -Tue Dec 23 12:45:50 1997 Jeffrey A Law (law@cygnus.com) - - * config.guess: HP 9000/803 is a PA1.1 machine. - - -Sun Dec 21 16:53:12 1997 H.J. Lu (hjl@gnu.ai.mit.edu) - - * configure.in (host_makefile_frag, target_makefile_frag): - Handle multiple config files. - (alpha-*-linux*): Treat alpha-*-linux* as alpha-*-linux* and - alpha-*-*. - -Thu Dec 18 13:13:03 1997 Doug Evans <devans@canuck.cygnus.com> - - * mkdep: New file. - -Wed Dec 17 09:53:02 1997 Michael Meissner <meissner@cygnus.com> - - * configure.in (d30v-*-*): Allow configuring of libide, vmake, etc. - -Tue Dec 16 17:36:05 1997 Ian Lance Taylor <ian@cygnus.com> - - * Makefile.in: Add libgui directory. - (GDB_TK): Add all-libgui. - * configure.in: Add libgui directory. - * configure: Add all-libgui to GDB_TK. - -Mon Dec 15 16:12:28 1997 Nick Clifton <nickc@cygnus.com> - - * config-ml.in (multidirs): Add m32r to multilib list. - -Fri Dec 12 10:43:31 1997 Brendan Kehoe <brendan@canuck.cygnus.com> - - * Makefile.in (all-target-gperf): Change dependency to - all-target-libstdc++. - -Thu Dec 11 23:30:51 1997 Fred Fish <fnf@ninemoons.com> - - * config.guess: Add BeOS support. - -Wed Dec 10 15:10:38 1997 Ian Lance Taylor <ian@cygnus.com> - - Source directory cvs renamed to cvssrc: - * configure.in (host_tools): Change cvs to cvssrc. - (native_only): Likewise. - (noconfigdirs) [various cases]: Likewise. - * Makefile.in (ALL_MODULES): Change all-cvs to all-cvssrc. - (CROSS_CHECK_MODULES): Change check-cvs to check-cvssrc. - (INSTALL_MODULES): Change install-cvs to install-cvssrc. - (CLEAN_MODULES): Change clean-cvs to clean-cvssrc. - (all-cvssrc): Rename target from all-cvs. - -Wed Dec 3 07:55:59 1997 Jeffrey A Law (law@cygnus.com) - - * configure (gxx_include_dir): Fix thinko. - -Tue Dec 2 10:55:34 1997 Jeffrey A Law (law@cygnus.com) - - * Makefile.in (INSTALL_TARGET_CROSS): Define. - (install-cross, install-gcc-cross): New targets. - -Tue Dec 2 10:08:31 1997 Nick Clifton <nickc@cygnus.com> - - * configure.in (noconfigdirs): Add support for Thumb target. - - * config.sub (maybe_os): Add support for Thumb target. - -Sun Nov 30 16:12:27 1997 Bob Manson <manson@charmed.cygnus.com> - - * Makefile.in: Add rules for cygmon. - - * configure.in: Build cygmon for sparc-elf and sparclite-aout. - -Thu Nov 27 01:31:30 1997 Jeffrey A Law (law@cygnus.com) - - * Makefile.in (INSTALL_TARGET): Do install-gcc first. - * configure (gxx_include_dir): Provide a definition for subdirs - which do not use autoconf. - -Wed Nov 26 11:53:33 1997 Keith Seitz <keiths@onions.cygnus.com> - - * Makefile.in, configure, configure.in, ChangeLog: merge with foundry's - 11/18/97 build - -Wed Nov 26 16:08:50 1997 Jeffrey A Law (law@cygnus.com) - - * From Franz Sirl. - * config.guess (powerpc*-*-linux): Handle glibc2 beta release - found on RedHat Linux systems. - -Fri Nov 21 09:51:01 1997 Jeffrey A Law (law@cygnus.com) - - * config.guess (alpha stuff): Merge with FSF to avoid incorrect - guesses. - -Thu Nov 13 11:38:37 1997 Jeffrey A Law (law@cygnus.com) - - * configure.in (i[3456]86-ncr-sysv4.3*): Tweak. - -Mon Nov 10 15:23:21 1997 H.J. Lu <hjl@gnu.ai.mit.edu> - - * ltmain.sh: If mkdir fails, check whether the directory was created - anyhow by some other process. - -Mon Nov 10 14:38:03 1997 Michael Meissner <meissner@cygnus.com> - - * configure.in (d30v-*-*): Configure all directories. - -Sun Nov 9 17:36:20 1997 Michael Meissner <meissner@cygnus.com> - - * configure.in (d30v-*-*): Configure newlib, libiberty directories - for the D30V. - -Sat Nov 8 14:42:59 1997 Michael Meissner <meissner@cygnus.com> - - * configure.in (d30v-*-*): Configure target-libgloss on the D30V. - -Fri Nov 7 10:34:09 1997 Rob Savoye <rob@darkstar.cygnus.com> - - * include/libiberty.h: Add extern "C" { so it can be used with C++ - progrms. - * include/remote-sim.h: Add extern "C" { so it can be used with C++ - programs. - -Thu Oct 30 11:09:29 1997 Michael Meissner <meissner@cygnus.com> - - * configure.in (d30v-*-*): Configure GCC now. - -Mon Oct 27 13:17:24 1997 Stan Shebs <shebs@andros.cygnus.com> - - * configure.in: Remove a "second pass" of tweaking noconfigdirs, - is no longer needed. - -Mon Oct 27 12:03:53 1997 Jason Merrill <jason@yorick.cygnus.com> - - * Makefile.in: check-target-libio depends on all-target-libstdc++. - -Sun Oct 26 11:48:27 1997 Manfred Hollstein (manfred@s-direktnet.de) - - * Makefile.in (bootstrap-lean): Combined with `normal' bootstrap - targets using "$@" to provide support for similar but not identical - targets without having to duplicate code. - -Mon Oct 20 15:28:49 1997 Klaus K"ampf <kkaempf@progis.de> - - * makefile.vms: Fix to work with DEC C. - -Tue Oct 7 23:58:57 1997 Gavin Koch <gavin@cygnus.com> - - * config.sub: Add mips-tx39-elf to marketing names. - -Tue Oct 7 14:24:41 1997 Ian Lance Taylor <ian@cygnus.com> - - * ltmain.sh: Handle symlinks in generated script. - -Wed Oct 1 13:11:27 1997 Ian Lance Taylor <ian@cygnus.com> - - * configure: Handle autoconf style directory options: --bindir, - --datadir, --includedir, --infodir, --libdir, --libexecdir, - --mandir, --oldincludedir, --sbindir, --sharedstatedir, - --sysconfdir. - * Makefile.in (sbindir, libexecdir, sysconfdir): New variables. - (sharedstatedir, localstatedir, oldincludedir): New variables. - (BASE_FLAGS_TO_PASS): Pass down bindir, datadir, includedir, - infodir, libdir, libexecdir, localstatedir, mandir, oldincludedir, - sbindir, sharedstatedir, and sysconfdir. - -Mon Sep 29 00:38:08 1997 Aaron Jackson <jackson@negril.msrce.howard.edu> - - * Makefile.in (bootstrap-lean): New target. - -Wed Sep 24 18:06:27 1997 Stu Grossman <grossman@babylon-5.cygnus.com> - - * configure.in (d30v): Remove tcl, tk, expect, gdb, itcl, tix, db, - sn, and gnuserv from noconfigdirs. - -Wed Sep 24 15:18:32 1997 Ian Lance Taylor <ian@cygnus.com> - - * ltmain.sh: Tweak shell pattern to avoid bug in NetBSD /bin/sh. - -Thu Sep 18 23:58:27 1997 Jeffrey A Law (law@cygnus.com) - -* Makefile.in (cross): New target. - -Thu Sep 18 21:43:23 1997 Alexandre Oliva <oliva@dcc.unicamp.br> - Jeff Law <law@cygnus.com> - - * Makefile.in (bootstrap2, bootstrap3): New targets. - (all-bootstrap): Remove outdated and confusing target. - (bootstrap, bootstrap2, bootstrap3): Don't pass BOOT_CFLAGS down. - -Thu Sep 18 15:37:42 1997 Andrew Cagney <cagney@b1.cygnus.com> - - * configure (tooldir): enable_gdbtk=YES for cygwin32, NO for - windows. Consistent with gdb/configure. - - -1997-09-15 02:37 Ulrich Drepper <drepper@cygnus.com> - - * config/mt-linux: Define CXXFLAGS to make sure -fvtable-thunks is - used. - * configure.in: Name Linux target fragment. - - * configure: Rewrite so that project Makefile fragment is inserted - first and appears last in the resulting Makefile. - -Tue Sep 16 09:55:07 1997 Andrew Cagney <cagney@b1.cygnus.com> - - * Makefile.in (install-itcl): Install tcl first. - -Sun Sep 14 20:53:42 1997 Geoffrey Noer <noer@cygnus.com> - - * config/mh-cygwin32: ok to build split texinfo files - -Fri Sep 12 16:19:20 1997 Geoffrey Noer <noer@cygnus.com> - - * configure.in: remove bison from noconfigdirs for Cygwin32 host - -Thu Sep 11 16:40:46 1997 H.J. Lu (hjl@gnu.ai.mit.edu) - - * Makefile.in (local-distclean): Also remove mh-frag mt-frag. - - * configure.in (skipdirs): Add target-librx for Linux. - (alpha-*-linux*): Use config/mh-elfalphapic and config/mt-elfalphapic. - -Wed Sep 10 21:29:54 1997 Jeffrey A Law (law@cygnus.com) - - * Makefile.in (bootstrap): New target. - -Wed Sep 10 15:19:22 1997 Jeffrey A Law (law@cygnus.com) - - * config.sub: Accept 'amigados' for backward compatability. - -Mon Sep 8 20:46:20 1997 Ian Lance Taylor <ian@cygnus.com> - - * config.guess: Merge with FSF. - -Sun Sep 7 15:55:28 1997 Gavin Koch <gavin@cygnus.com> - - * config.sub: Add "marketing-names" patch. - -Fri Sep 5 16:11:28 1997 Joel Sherrill (joel@OARcorp.com) - - * configure.in (*-*-rtems*): Do not build libgloss for rtems. - -Fri Sep 5 12:27:17 1997 Jeffrey A Law (law@cygnus.com) - - * config.sub: Handle v850-elf. - -Wed Sep 3 12:15:24 1997 Chris Provenzano <proven@cygnus.com> - - * ltconfig: Set CONFIG_SHELL in libtool. - * ltmain.sh: Use CONFIG_SHELL instead of /bin/sh - -Mon Sep 1 16:45:44 1997 Jim Wilson <wilson@cygnus.com> - - * configure.in (target_subdir): Set to libraries if enable_multilib. - -Wed Aug 27 16:15:11 1997 Jim Wilson <wilson@cygnus.com> - - * config.guess: Update from gcc directory. - -Tue Aug 26 16:46:46 1997 Andrew Cagney <cagney@b1.cygnus.com> - - * Makefile.in (all-sim): Depends on all-readline. - -Wed Aug 20 19:57:37 1997 Jason Merrill <jason@yorick.cygnus.com> - - * Makefile.in (BISON, YACC): Use $$s. - (all-bison): Depend on all-texinfo. - -Tue Aug 19 01:41:32 1997 Jason Merrill <jason@yorick.cygnus.com> - - * Makefile.in (BISON): Add -L flag. - (YACC): Likewise. - -Mon Aug 18 11:30:50 1997 Nick Clifton <nickc@cygnus.com> - - * configure.in (noconfigdirs): Add support for v850e target. - - * config.sub (maybe_os): Add support for v850e target. - -Mon Aug 18 11:30:50 1997 Nick Clifton <nickc@cygnus.com> - - * configure.in (noconfigdirs): Add support for v850ea target. - - * config.sub (maybe_os): Add support for v850ea target. - -Mon Aug 18 09:24:06 1997 Gavin Koch <gavin@cygnus.com> - - * config.sub: Add mipstx39. Delete r3900. - -Mon Aug 18 17:20:10 1997 Jason Molenda (crash@godzilla.cygnus.co.jp) - - * Makefile.in (all-autoconf): Depends on all-texinfo. - -Fri Aug 15 23:09:26 1997 Michael Meissner <meissner@cygnus.com> - - * config-ml.in ({powerpc,rs6000}*-*-*): Update to current AIX and - eabi targets. - -Thu Aug 14 14:42:17 1997 Ian Lance Taylor <ian@cygnus.com> - - * configure: Get CFLAGS and CXXFLAGS from Makefile, if possible. - - * configure: When handling a Canadian Cross, handle YACC as well as - BISON. Just set BISON to bison. When setting YACC, prefer bison. - * Makefile.in (all-bison): Depend upon all-texinfo. - -Tue Aug 12 20:09:48 1997 Jason Merrill <jason@yorick.cygnus.com> - - * Makefile.in (BISON): bison, not byacc or bison -y. - (YACC): bison -y or byacc or yacc. - (various): Add *-bison as appropriate. - (taz): No need to mess with BISON anymore. - -Tue Aug 12 22:33:08 1997 Ian Lance Taylor <ian@cygnus.com> - - * configure: If OSTYPE matches *win32*, try to find a good value for - CONFIG_SHELL. - -Sun Aug 10 14:41:11 1997 Ian Lance Taylor <ian@cygnus.com> - - * Makefile.in (taz): Get the version number from AM_INIT_AUTOMAKE in - configure.in if it is present. - -Sat Aug 9 00:58:01 1997 Ian Lance Taylor <ian@cygnus.com> - - * Makefile.in (LD_FOR_TARGET): Change ld.new to ld-new. - -Fri Aug 8 16:30:13 1997 Doug Evans <dje@canuck.cygnus.com> - - * config.sub: Recognize `arc' cpu. - * configure.in: Likewise. - * config-ml.in: Likewise. - -Thu Aug 7 11:02:34 1997 Ian Lance Taylor <ian@cygnus.com> - - * Makefile.in ($(INSTALL_X11_MODULES)): Depend upon installdirs. - -Wed Aug 6 16:27:29 1997 Chris Provenzano <proven@cygnus.com> - - * configure: Changed sed delimiter from ':' to '|' when - attempting to substitute ${config_shell} for SHELL. On - NT ${config_shell} may contain a ':' in it. - -Wed Aug 6 12:29:05 1997 Jason Merrill <jason@yorick.cygnus.com> - - * Makefile.in (EXTRA_GCC_FLAGS): Fix for non-bash shells. - -Wed Aug 6 00:42:35 1997 Ian Lance Taylor <ian@cygnus.com> - - * Makefile.in (AS_FOR_TARGET): Change as.new to as-new. - -Tue Aug 5 14:08:51 1997 Ian Lance Taylor <ian@cygnus.com> - - * Makefile.in (NM_FOR_TARGET): Change nm.new to nm-new. - - * ylwrap: If the program is a relative path, force it to be - absolute. - -Tue Aug 5 12:12:44 1997 Andrew Cagney <cagney@b1.cygnus.com> - - * configure (tooldir): Set BISON to `bison -y' and not just bison. - -Mon Aug 4 22:59:02 1997 Andrew Cagney <cagney@b1.cygnus.com> - - * Makefile.in (CC_FOR_TARGET): When winsup/Makefile present, - correctly specify the target build directory $(TARGET_SUBDIR)/winsup - for libraries. - -Mon Aug 4 12:40:24 1997 Jason Merrill <jason@yorick.cygnus.com> - - * Makefile.in (EXTRA_GCC_FLAGS): Fix handling of macros with values - separated by spaces. - -Thu Jul 31 19:49:49 1997 Ian Lance Taylor <ian@cygnus.com> - - * ylwrap: New file. - * Makefile.in (DEVO_SUPPORT): Add ylwrap. - - * ltmain.sh: Handle /bin/sh at start of install program. - - * Makefile.in (DEVO_SUPPORT): Add ltconfig, ltmain.sh, and missing. - - * ltconfig, ltmain.sh: New files, from libtool 1.0. - * missing: New file, from automake 1.2. - -Thu Jul 24 12:57:56 1997 Ian Lance Taylor <ian@cygnus.com> - - * Makefile.in: Treat tix like tk, putting it in X11_MODULES. Add - check-tk to CHECK_X11_MODULES. - -Wed Jul 23 17:03:29 1997 Ian Lance Taylor <ian@cygnus.com> - - * config.sub: Merge with FSF. - -Tue Jul 22 19:08:29 1997 Ian Lance Taylor <ian@cygnus.com> - - * config.guess: Merge with FSF. - -Tue Jul 22 14:50:42 1997 Robert Hoehne <robert.hoehne@Mathematik.TU-Chemnitz.DE> - - * configure: Treat msdosdjgpp like go32. - * configure.in: Likewise. Don't remove gprof for go32. - - * configure: Change Makefile.tem2 to Makefile.tm2. - -Mon Jul 21 10:31:26 1997 Stephen Peters <speters@cygnus.com> - - * configure.in (noconfigdirs): For alpha-dec-osf*, don't ignore grep. - -Tue Jul 15 14:33:03 1997 Brendan Kehoe <brendan@lisa.cygnus.com> - - * install-sh (chmodcmd): Set to null if the DST directory already - exists. Same as Nov 11th change. - -Mon Jul 14 11:01:15 1997 Martin M. Hunt <hunt@cygnus.com> - - * configure (GDB_TK): Needs itcl and tix. - -Mon Jul 14 00:32:10 1997 Jason Merrill <jason@yorick.cygnus.com> - - * config.guess: Update from FSF. - -Fri Jul 11 11:57:11 1997 Martin M. Hunt <hunt@cygnus.com> - - * Makefile.in (GDB_TK): Depend on itcl and tix. - -Fri Jul 4 13:25:31 1997 Ian Lance Taylor <ian@cygnus.com> - - * Makefile.in (INSTALL_PROGRAM_ARGS): New variable. - (INSTALL_PROGRAM): Use $(INSTALL_PROGRAM_ARGS). - (INSTALL_SCRIPT): New variable. - (BASE_FLAGS_TO_PASS): Pass down INSTALL_SCRIPT. - * configure.in: If host is *-*-cygwin32*, set INSTALL_PROGRAM_ARGS - to -x. - * install-sh: Add support for -x option. - -Mon Jun 30 15:51:30 1997 Ian Lance Taylor <ian@cygnus.com> - - * configure.in, Makefile.in: Treat tix like itcl. - -Thu Jun 26 13:59:19 1997 Ian Lance Taylor <ian@cygnus.com> - - * Makefile.in (WINDRES): New variable. - (WINDRES_FOR_TARGET): New variable. - (BASE_FLAGS_TO_PASS): Add WINDRES_FOR_TARGET. - (EXTRA_HOST_FLAGS): Add WINDRES. - (EXTRA_TARGET_FLAGS): Add WINDRES. - (EXTRA_GCC_FLAGS): Add WINDRES. - ($(DO_X)): Pass down WINDRES. - ($(CONFIGURE_TARGET_MODULES)): Set WINDRES when configuring. - * configure: Treat WINDRES like DLLTOOL, and WINDRES_FOR_TARGET like - DLLTOOL_FOR_TARGET. - -Wed Jun 25 15:01:26 1997 Felix Lee <flee@cygnus.com> - - * configure.in: configure sim before gdb for win32-x-ppc - -Wed Jun 25 12:18:54 1997 Brendan Kehoe <brendan@lisa.cygnus.com> - - Move gperf into the toplevel, from libg++. - * configure.in (target_tools): Add target-gperf. - (native_only): Add target-gperf. - * Makefile.in (all-target-gperf): New target, depend on - all-target-libg++. - (configure-target-gperf): Empty rule. - (ALL_TARGET_MODULES): Add all-target-gperf. - (CONFIGURE_TARGET_MODULES): Add configure-target-gperf. - (CHECK_TARGET_MODULES): Add check-target-gperf. - (INSTALL_TARGET_MODULES): Add install-target-gperf. - (CLEAN_TARGET_MODULES): Add clean-target-gperf. - -Mon Jun 23 10:51:53 1997 Jeffrey A Law (law@cygnus.com) - - * config.sub (mn10200): Recognize new basic machine. - -Thu Jun 19 14:16:42 1997 Brendan Kehoe <brendan@lisa.cygnus.com> - - * configure.in: Don't set ENABLE_MULTILIB, so we'll be passing - --enable-multilib down to subdirs; setting TARGET_SUBDIR was enough. - -Tue Jun 17 15:31:20 1997 Brendan Kehoe <brendan@lisa.cygnus.com> - - * configure.in: If we're building mips-sgi-irix6* native, turn on - ENABLE_MULTILIB and set TARGET_SUBDIR. - -Tue Jun 17 12:20:59 1997 Tom Tromey <tromey@cygnus.com> - - * Makefile.in (all-sn): Depend on all-grep. - -Mon Jun 16 11:11:10 1997 Ian Lance Taylor <ian@cygnus.com> - - * configure.in: Use mh-ppcpic and mt-ppcpic for powerpc*-* targets. - - * configure: Set CFLAGS and CXXFLAGS, and substitute them into - Makefile. From Jeff Makey <jeff@cts.com>. - * Makefile.in: Add comment for CFLAGS and CXXFLAGS. - - * Makefile.in (DISTBISONFILES): Remove. - (taz): Don't futz with DISTBISONFILES. Change BISON to use - $(DEFAULT_YACC). - - * configure.in: Build itl, db, sn, etc., when building for native - cygwin32. - - * Makefile.in (LD): New variable. - (EXTRA_HOST_FLAGS): Pass down LD. - ($(DO_X)): Likewise. - -Mon Jun 16 11:10:35 1997 Philip Blundell <Philip.Blundell@pobox.com> - - * Makefile.in (INSTALL): Use $(SHELL) when executing install-sh. - -Fri Jun 13 10:22:56 1997 Bob Manson <manson@charmed.cygnus.com> - - * configure.in (targargs): Strip out any supplied --build argument - before adding our own. Always add --build. - -Thu Jun 12 21:12:28 1997 Bob Manson <manson@charmed.cygnus.com> - - * configure.in (targargs): Pass --build if we're doing - a cross-compile. - -Fri Jun 6 21:38:40 1997 Rob Savoye <rob@chinadoll.cygnus.com> - - * configure: Use '|' instead of ":" as the seperator in - sed. Otherwise sed chokes on NT path names with drive - designators. Also look for "?:*" as the leading characters in an - absolute pathname. - -Mon Jun 2 13:05:20 1997 Gavin Koch <gavin@cygnus.com> - - * config.sub: Support for r3900. - -Wed May 21 17:33:31 1997 Ian Lance Taylor <ian@cygnus.com> - - * configure.in: Use install-sh, not install.sh. - -Wed May 14 16:06:51 1997 Ian Lance Taylor <ian@cygnus.com> - - * Makefile.in (taz): Improve check for BISON so it doesn't try to - apply it twice. - -Fri May 9 17:22:05 1997 Ian Lance Taylor <ian@cygnus.com> - - * Makefile.in (INSTALL_MODULES): Put install-opcodes before - install-binutils. - -Thu May 8 17:29:50 1997 Ian Lance Taylor <ian@cygnus.com> - - * Makefile.in: Add automake targets. - * configure.in (host_tools): Add automake. - -Tue May 6 15:49:52 1997 Ian Lance Taylor <ian@cygnus.com> - - * configure: Default CXX to c++, not gcc. - * Makefile.in (CXX): Set to c++, not gcc. - (CXX_FOR_TARGET): When cross, transform c++, not gcc. - -Thu May 1 10:11:43 1997 Geoffrey Noer <noer@cygnus.com> - - * install-sh: try appending a .exe if source file doesn't - exist - -Wed Apr 30 12:05:36 1997 Jason Merrill <jason@yorick.cygnus.com> - - * configure.in: Turn on multilib by default. - (cross_only): Remove target-libiberty. - - * Makefile.in (all-gcc): Don't depend on libiberty. - -Mon Apr 28 18:39:45 1997 Michael Snyder <msnyder@cleaver.cygnus.com> - - * config.guess: improve algorithm for recognizing Gnu Hurd x86. - -Thu Apr 24 19:30:07 1997 Ian Lance Taylor <ian@cygnus.com> - - * Makefile.in (DEVO_SUPPORT): Add mpw-install. - (DISTBISONFILES): Add ld/Makefile.in - -Tue Apr 22 17:17:28 1997 Geoffrey Noer <noer@pizza.cygnus.com> - - * configure.in: if target is cygwin32 but host isn't cygwin32, - don't configure gdb tcl tk expect, not just gdb. - -Mon Apr 21 13:33:39 1997 Tom Tromey <tromey@cygnus.com> - - * configure.in: Added gnuserv everywhere sn appears. - - * Makefile.in (ALL_MODULES): Added all-gnuserv. - (CROSS_CHECK_MODULES): Added check-gnuserv. - (INSTALL_MODULES): Added install-gnuserv. - (CLEAN_MODULES): Added clean-gnuserv. - (all-gnuserv): New target. - -Thu Apr 17 13:57:06 1997 Per Fogelstrom <pefo@openbsd.org> - - * config.guess: Fixes for MIPS OpenBSD systems. - -Tue Apr 15 12:21:07 1997 Ian Lance Taylor <ian@cygnus.com> - - * Makefile.in (INSTALL_XFORM): Remove. - (BASE_FLAGS_TO_PASS): Remove INSTALL_XFORM. - - * mkinstalldirs: New file, copied from automake. - * Makefile.in (installdirs): Rename from install-dirs. Use - mkinstalldirs. Change all users. - (DEVO_SUPPORT): Add mkinstalldirs. - -Mon Apr 14 11:21:38 1997 Ian Lance Taylor <ian@cygnus.com> - - * install-sh: Rename from install.sh. - * Makefile.in (INSTALL): Change install.sh to install-sh. - (DEVO_SUPPORT): Likewise. - - * configure: Use ${config_shell} with ${moveifchange}. From Thomas - Graichen <graichen@rzpd.de>. - -Fri Apr 11 16:37:10 1997 Niklas Hallqvist <niklas@appli.se> - - * config.guess: Recognize OpenBSD systems correctly. - -Fri Apr 11 17:07:04 1997 Jason Molenda (crash@godzilla.cygnus.co.jp) - - * README, Makefile.in (ETC_SUPPORT): Remove references to - cfg-paper*, configure.{texi,man,info*}._ - -Sun Apr 6 18:47:57 1997 Andrew Cagney <cagney@kremvax.cygnus.com> - - * Makefile.in (all.normal): Ensure that gcc is built after all - the x11 - ie gdb - targets. - -Tue Apr 1 16:28:50 1997 Klaus Kaempf <kkaempf@progis.de> - - * makefile.vms: Don't run conf-a-gas. - -Mon Mar 31 16:26:55 1997 Joel Sherrill <joel@oarcorp.com> - - * configure.in (hppa1.1-*-rtems*): New target, like hppa-*-*elf*. - -Sun Mar 30 12:38:27 1997 Fred Fish <fnf@cygnus.com> - - * configure.in: Remove noconfigdirs case since gdb also - configures and builds for tic80-coff. - -Fri Mar 28 18:28:52 1997 Ian Lance Taylor <ian@cygnus.com> - - * configure: Set cache_file to config.cache. - * Makefile.in (local-distclean): Remove config.cache. - -Wed Mar 26 18:49:39 1997 Ian Lance Taylor <ian@cygnus.com> - - * COPYING: Update FSF address. - -Wed Mar 26 10:38:25 1997 Michael Meissner <meissner@cygnus.com> - - * configure.in (tic80-*-*): Remove G++ libraries and libgloss from - noconfigdirs. - -Mon Mar 24 15:02:39 1997 Ian Lance Taylor <ian@cygnus.com> - - * Makefile.in (install-dirs): Don't crash if prefix, and hence - MAKEDIRS, is empty. - -Mon Mar 24 12:40:55 1997 Doug Evans <dje@canuck.cygnus.com> - - * config.sub: Tweak mn10300 entry. - -Fri Mar 21 15:35:27 1997 Michael Meissner <meissner@cygnus.com> - - * configure.in (host_tools): Put sim before gdb, so gdb's - configure.tgt can determine if the simulator was configured. - -Sun Mar 16 16:07:08 1997 Fred Fish <fnf@cygnus.com> - - * config.sub: Move BeOS $os case to be with other Cygnus - local cases. - -Sun Mar 16 01:34:55 1997 Martin Hunt <hunt@cygnus.com> - - * config.sub: Remove misplaced comment that broke Linux. - -Sat Mar 15 22:50:15 1997 Fred Fish <fnf@cygnus.com> - - * config.sub: Add BeOS support. - -Mon Mar 10 13:30:11 1997 Tom Tromey <tromey@cygnus.com> - - * Makefile.in (CHECK_X11_MODULES): Don't run check-tk. - -Wed Mar 5 12:09:29 1997 Martin <hunt@cygnus.com> - - * configure.in (noconfigdirs): Remove tcl and tk from - noconfigdirs for cygwin32 builds. - -Fri Feb 28 18:20:15 1997 Fred Fish <fnf@cygnus.com> - - * configure.in (tic80-*-*): Remove ld from noconfigdirs. - -Thu Feb 27 14:57:26 1997 Ken Raeburn <raeburn@cygnus.com> - - * Makefile.in (GAS_SUPPORT_DIRS, BINUTILS_SUPPORT_DIRS): Remove - make-all.com, use makefile.vms instead. - -Tue Feb 25 18:46:14 1997 Stan Shebs <shebs@andros.cygnus.com> - - * config.sub: Accept -lnews*. - -Tue Feb 25 13:19:14 1997 Andrew Cagney <cagney@kremvax.tpgi.com.au> - - * configure.in (noconfigdirs): Disable target-newlib, - target-examples and target-libiberty for d30v. - -Fri Feb 21 17:56:25 1997 Martin M. Hunt <hunt@pizza.cygnus.com> - - * configure.in (noconfigdirs): Enable ld for d30v. - -Fri Feb 21 20:58:51 1997 Michael Meissner <meissner@cygnus.com> - - * configure.in (tic80-*-*): Build compiler. - -Sun Feb 16 15:41:09 1997 Andrew Cagney <cagney@critters.cygnus.com> - - * configure.in (d30v-*): Remove sim directory from list of - unsupported d30v directories - -Tue Feb 18 17:32:42 1997 Martin M. Hunt <hunt@pizza.cygnus.com> - - * config.sub, configure.in: Add d30v target cpu. - -Thu Feb 13 22:04:44 1997 Klaus Kaempf <kkaempf@progis.de> - - * makefile.vms: New file. - * make-all.com: Remove. - -Wed Feb 12 12:54:18 1997 Jim Wilson <wilson@cygnus.com> - - * Makefile.in (EXTRA_GCC_FLAGS): Add LIBGCC2_DEBUG_CFLAGS. - -Sat Feb 8 20:36:49 1997 Michael Meissner <meissner@cygnus.com> - - * Makefile.in (all-itcl): The rule is all-itcl, not all-tcl. - -Tue Feb 4 11:39:29 1997 Tom Tromey <tromey@cygnus.com> - - * Makefile.in (ALL_MODULES): Added all-db. - (CROSS_CHECK_MODULES): Addec check-db. - (INSTALL_MODULES): Added install-db. - (CLEAN_MODULES): Added clean-db. - -Mon Feb 3 13:29:36 1997 Ian Lance Taylor <ian@cygnus.com> - - * config.guess: Merge with latest FSF sources. - -Tue Jan 28 09:20:37 1997 Tom Tromey <tromey@cygnus.com> - - * Makefile.in (ALL_MODULES): Added all-itcl. - (CROSS_CHECK_MODULES): Added check-itcl. - (INSTALL_MODULES): Added install-itcl. - (CLEAN_MODULES): Added clean-itcl. - -Thu Jan 23 01:44:27 1997 Geoffrey Noer <noer@cygnus.com> - - * configure.in: build gdb for mn10200 - -Fri Jan 17 15:32:15 1997 Doug Evans <dje@canuck.cygnus.com> - - * Makefile.in (all-target-winsup): Depend on all-target-libio. - -Mon Jan 13 22:46:54 1997 Michael Meissner <meissner@tiktok.cygnus.com> - - * configure.in (tic80-*-*): Turn off most targets right now. - -Fri Jan 3 16:04:03 1997 Ian Lance Taylor <ian@cygnus.com> - - * Makefile.in (MAKEINFO): Check for the existence of the Makefile, - rather than the makeinfo program. - (do-info): Depend upon all-texinfo. - -Tue Dec 31 16:00:31 1996 Ian Lance Taylor <ian@cygnus.com> - - * configure.in: Remove uses of config/mh-linux. - - * config.sub, config.guess: Merge with latest FSF sources. - -Fri Dec 27 23:04:33 1996 Fred Fish <fnf@cygnus.com> - - * config.sub (case $basic_machine): Add tic80 entries. - -Fri Dec 27 12:07:59 1996 Ian Lance Taylor <ian@cygnus.com> - - * config.sub, config.guess: Merge with latest FSF sources. - -Wed Dec 18 22:46:39 1996 Stan Shebs <shebs@andros.cygnus.com> - - * mpw-build.in: Build ld before gcc, use NewFolderRecursive. - * mpw-config.in: Test for NewFolderRecursive. - * mpw-install: Use symbolic name for startup filename. - * mpw-README: Add various additional details. - -Wed Dec 18 13:11:46 1996 Jim Wilson <wilson@cygnus.com> - - * configure.in (mips*-sgi-irix6*): Remove binutils from noconfigdirs. - -Wed Dec 18 10:29:31 1996 Jeffrey A Law (law@cygnus.com) - - * configure.in: Do build gcc and the target libraries for - the mn10200. - -Wed Dec 4 16:53:05 1996 Geoffrey Noer <noer@cygnus.com> - - * configure.in: don't avoid building gdb for mn10300 any more - * Makefile.in: double-quote GCC_FOR_TARGET line in EXTRA_GCC_FLAGS - instead of single-quoting it. - -Tue Dec 3 23:26:50 1996 Jason Merrill <jason@yorick.cygnus.com> - - * configure.in: Don't use --with-stabs on IRIX 6. - -Tue Dec 3 09:05:25 1996 Doug Evans <dje@canuck.cygnus.com> - - * configure.in (m32r): Build gdb, libg++ now. - -Sun Dec 1 00:18:59 1996 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * configure.in (mips*-sgi-irix6*): Remove gdb and related - directories from noconfigdirs. - -Tue Nov 26 11:45:33 1996 Kim Knuttila <krk@cygnus.com> - - * config.sub (basic_machine): added mips16 configuration - -Sat Nov 23 19:26:22 1996 Michael Meissner <meissner@tiktok.cygnus.com> - - * config.sub: Handle d10v-unknown. - -Sat Nov 23 10:23:01 1996 Gavin Koch <gavin@cygnus.com> - - * config.sub: Handle v850-unknown. - -Thu Nov 21 16:19:44 1996 Geoffrey Noer <noer@cygnus.com> - - * Makefile.in: add findutils - * configure.in: add findutils to list of host_tools - -Wed Nov 20 10:09:01 1996 Jeffrey A Law (law@cygnus.com) - - * config.sub: Handle mn10200 and mn10300. - -Tue Nov 19 16:35:14 1996 Michael Meissner <meissner@tiktok.cygnus.com> - - * configure.in (d10v-*): Do not build librx. - -Mon Nov 18 13:28:41 1996 Jeffrey A Law (law@cygnus.com) - - * configure.in (mn10300): Build everything except gdb & libgloss. - -Wed Nov 13 14:59:46 1996 Per Bothner <bothner@deneb.cygnus.com> - - * config.guess: Patch for Dansk Data Elektronik servers, - from Niels Skou Olsen <nso@dde.dk>. - - For ncr, use /bin/uname rather than uname, since GNU uname does not - support -p. Suggested by Mark Mitchell <mmitchell@usa.net>. - - Patch for MIPS R4000 running System V, - from Eric S. Raymond <esr@snark.thyrsus.com>. - - Fix thinko for nextstep. - - Patch for OSF1 in i?86, from Dan Murphy <dlm@osf.org> via Harlan Stenn. - - Sat Jun 24 18:58:17 1995 Morten Welinder <terra+@cs.cmu.edu> - * config.guess: Guess mips-dec-mach_bsd4.3. - - Thu Oct 10 04:07:04 1996 Harlan Stenn <harlan@pfcs.com> - * config.guess (i?86-ncr-sysv*): Emit just enough of the minor - release numbers. - * config.guess (mips-mips-riscos*): Emit just enough of the - release number. - - Tue Oct 8 10:37:22 1996 Frank Vance <fvance@waii.com> - * config.guess (sparc-auspex-sunos*): Added. - (f300-fujitsu-*): Added. - - Wed Sep 25 22:00:35 1996 Jeff Woolsey <woolsey@jlw.com> - * config.guess: Recognize a Tadpole as a sparc. - -Wed Nov 13 00:53:09 1996 David J. MacKenzie <djm@churchy.gnu.ai.mit.edu> - - * config.guess: Don't assume that NextStep version is either 2 or - 3. NextStep 4 (aka OpenStep 4) has come out now. - -Mon Nov 11 23:52:03 1996 David J. MacKenzie <djm@churchy.gnu.ai.mit.edu> - - * config.guess: Support Cray T90 that reports itself as "CRAY TS". - From Rik Faith <faith@cs.unc.edu>. - -Fri Nov 8 11:34:58 1996 David J. MacKenzie <djm@geech.gnu.ai.mit.edu> - - * config.sub: Contributions from bug-gnu-utils to: - Support plain "hppa" (no version given) architecture, reported by - OpenStep. - OpenBSD like NetBSD. - LynxOs is not a hardware supplier. - - * config.guess: Contributions from bug-gnu-utils to add support for: - OpenBSD like NetBSD. - Stratus systems. - More Pyramid systems. - i[n>4]86 Intel chips. - M680[n>4]0 Motorola chips. - Use unknown instead of lynx for hardware manufacturer. - -Mon Nov 11 10:09:08 1996 Brendan Kehoe <brendan@lisa.cygnus.com> - - * install.sh (chmodcmd): Set to null if the DST directory already - exists. - -Mon Nov 11 10:43:41 1996 Michael Meissner <meissner@tiktok.cygnus.com> - - * configure.in (powerpc*-{eabi,elf,linux,rtem,sysv,solaris}*): Do - not use mt-ppc target Makefile fragment any more. - -Sun Nov 3 19:17:07 1996 Stu Grossman (grossman@critters.cygnus.com) - - * configure.in (*-*-windows): Exclude everything but those dirs - needed to build windows. - -Tue Oct 29 16:41:31 1996 Doug Evans <dje@canuck.cygnus.com> - - * Makefile.in (all-target-winsup): Depend on all-target-librx. - -Mon Oct 28 17:32:46 1996 Stu Grossman (grossman@critters.cygnus.com) - - * configure.in: Exclude mmalloc from i386-windows. - * config/mh-windows: Add rules for building MSVC makefiles. - -Thu Oct 24 09:22:46 1996 Stu Grossman (grossman@critters.cygnus.com) - - * Undo my previous change. - -Thu Oct 24 12:12:04 1996 Ian Lance Taylor <ian@cygnus.com> - - * Makefile.in (EXTRA_GCC_FLAGS): Pass down GCC_FOR_TARGET - unconditionally. - (MAKEOVERRIDES): Define (revert this part of October 18 change). - -Thu Oct 24 09:02:07 1996 Stu Grossman (grossman@critters.cygnus.com) - - * Makefile.in (FLAGS_TO_PASS): Add $(HOST_FLAGS) to allow the - host to add it's own flags. - * config/mh-windows (HOST_FLAGS): Set srcroot, which is needed - for MSVC build procedure. - -Tue Oct 22 15:20:26 1996 Ian Lance Taylor <ian@cygnus.com> - - * configure: Handle GCC_FOR_TARGET like CC_FOR_TARGET. - -Fri Oct 18 13:37:13 1996 Ian Lance Taylor <ian@cygnus.com> - - * Makefile.in (CC_FOR_TARGET): Check for xgcc, not Makefile. - (CXX_FOR_TARGET): Likewise. - (GCC_FOR_TARGET): Define. - (BASE_FLAGS_TO_PASS): Remove GCC_FOR_TARGET. - (EXTRA_GCC_FLAGS): Define GCC_FOR_TARGET based on whether - CC_FOR_TARGET was specified on the command line. - (MAKEOVERRIDES): Don't define. - -Thu Oct 17 10:27:56 1996 Doug Evans <dje@canuck.cygnus.com> - - * configure.in (m32r): Fix spelling of libg++ libs. - -Thu Oct 10 10:37:17 1996 Stan Shebs <shebs@andros.cygnus.com> - - * config.sub (-apple*): Remove, now redundant. - -Thu Oct 10 12:30:54 1996 Ian Lance Taylor <ian@cygnus.com> - - * configure: Don't get confused by CPU-VENDOR-linux-gnu. - - * configure: Rework yesterday's sed script patch. - - * config.sub: Merge with FSF. - -Wed Oct 9 17:24:59 1996 Per Bothner <bothner@deneb.cygnus.com> - - * config.guess: Merge from FSF. - - 1996-09-12 Richard Stallman <rms@ethanol.gnu.ai.mit.edu> - * config.guess: Use pc instead of unknown, for pc clone systems. - Change linux to linux-gnu. - - Mon Jul 15 23:51:11 1996 Karl Heuer <kwzh@gnu.ai.mit.edu> - * config.guess: Avoid non-portable tr syntax. - -Wed Oct 9 06:06:46 1996 Jeffrey A Law (law@cygnus.com) - - * test-build.mk (HOLES): Add "xargs" for gdb. - - * configure: Avoid hpux10.20 sed bug. - -Tue Oct 8 08:32:48 1996 Stu Grossman (grossman@critters.cygnus.com) - - * configure.in config/mh-windows: Add support for windows host - (that is a build done under the Microsoft build environment). - -Tue Oct 8 10:39:08 1996 Ian Lance Taylor <ian@cygnus.com> - - * Makefile.in: Replace all uses of srcroot with s, to shrink - command line lengths. - - Patches from Geoffrey Noer <noer@cygnus.com>: - * configure.in: If configuring for newlib, pass --with-newlib to - subdirectories. - * Makefile.in (CC_FOR_TARGET): If winsup/Makefile exists, pass a - -Bnewlib/ and -Lwinsup to gcc. - (CXX_FOR_TARGET): Likewise. - -Mon Oct 7 10:59:35 1996 Ian Lance Taylor <ian@cygnus.com> - - * Makefile.in (ETC_SUPPORT): Add configure. - -Fri Oct 4 12:22:58 1996 Angela Marie Thomas (angela@cygnus.com) - - * configure.in: Use config/mh-dgux386 for i[345]86-dg-dgux - host configuration file. - -Thu Oct 3 09:28:25 1996 Jeffrey A Law (law@cygnus.com) - - * configure.in: Break mn10x00 support into separate - mn10200 and mn10300 configurations. - * config.sub: Likewise. - -Wed Oct 2 22:27:52 1996 Jeffrey A Law (law@cygnus.com) - - * configure.in: Add lots of stuff to noconfigdirs for - the mn10x00 targets. - - * config.sub, configure.in: Add mn10x00 support. - -Wed Oct 2 15:52:36 1996 Klaus Kaempf <kkaempf@progis.de> - - * make-all.com: Call conf-a-gas, not config-a-gas. - -Tue Oct 1 01:28:41 1996 James G. Smith <jsmith@cygnus.co.uk> - - * configure.in (noconfigdirs): Don't build libgloss for arm-coff - targets. - -Mon Sep 30 14:24:01 1996 Stan Shebs <shebs@andros.cygnus.com> - - * mpw-README: Add much more detail for native PowerMac. - * mpw-install: New file. - * mpw-configure: Add --norecursion and --help options. - * mpw-config.in: Translate readme and install files when - copying to objdir. - * mpw-build.in: Don't always depend on byacc and flex. - (install-only-top): New action. - -Fri Sep 27 17:39:44 1996 Stu Grossman (grossman@critters.cygnus.com) - - * configure.in: You can now configure GDB for the v850. - -Tue Sep 24 19:05:12 1996 Stan Shebs <shebs@andros.cygnus.com> - - * configure.in (noconfigdirs): Don't configure any C++ dirs - if targeting D10V. - -Tue Sep 17 12:15:31 1996 Ian Lance Taylor <ian@cygnus.com> - - * config.sub: Recognize mips64vr5000. - -Mon Sep 16 17:00:52 1996 Ian Lance Taylor <ian@cygnus.com> - - * configure.in: Use a single line for host_tools and native_only. - -Mon Sep 9 12:21:30 1996 Doug Evans <dje@canuck.cygnus.com> - - * config.sub, configure.in: Add entries for m32r. - -Thu Sep 5 13:52:47 1996 Tom Tromey <tromey@creche.cygnus.com> - - * Makefile.in (inet-install): Don't run install-gzip. - -Wed Sep 4 17:26:13 1996 Stu Grossman (grossman@critters.cygnus.com) - - * configure.in: Don't config lots of things for *-*-windows*. - -Sat Aug 31 11:45:57 1996 Stan Shebs <shebs@andros.cygnus.com> - - * mpw-config.in: Test for mpw-true, true, and null-command scripts. - (host_libs, host_tools): Copy from configure.in. - * mpw-configure: Don't complain about directories not found. - -Thu Aug 29 16:44:58 1996 Michael Meissner <meissner@tiktok.cygnus.com> - - * configure.in (i[345]86): Recognize i686 for pentium pro. - (i[3456]86-*-dgux*): Use config/mh-sysv for the host configuration - file. - - * config.guess (i[345]86): Ditto. - -Mon Aug 26 18:34:42 1996 Martin M. Hunt <hunt@pizza.cygnus.com> - - * configure.in (noconfigdirs): Removed gdb for D10V. - -Thu Aug 22 17:13:52 1996 Jeffrey A Law (law@cygnus.com) - - * configure.in: Remove ld, target-libio, target-libg++, and - target-libstdc++ from noconfigdirs. - -Wed Aug 21 18:56:38 1996 Fred Fish <fnf@cygnus.com> - - * configure: Fix three locations where shell scripts were - being run directly rather than with config_shell. - -Tue Aug 20 13:08:47 1996 J.T. Conklin <jtc@hippo.cygnus.com> - - * configure.in (v850-*-*): Set up initial $noconfigdirs. - * config.sub (basic_machine): Recognize v850. - -Thu Aug 15 12:19:33 1996 Stan Shebs <shebs@andros.cygnus.com> - - * mpw-configure: Handle multiple enable/disable options and - pass them down recursively, handle -c and -s flags appropriately - depending on choice of compiler, add escape mechanism for - quoted arguments to gC. - -Mon Aug 12 13:15:13 1996 Michael Meissner <meissner@tiktok.cygnus.com> - - * configure.in (powerpc*-*-*): For eabi, system V.4, Linux, and - solaris targets, use config/mt-ppc to set C{,XX}FLAGS_FOR_TARGETS - so that -mrelocatable-lib and -mno-eabi are used. - - * Makefile.in (CONFIGURE_TARGET_MODULES): If target compiler does - not support --print-multi-lib, don't abort. - -Sun Aug 11 20:51:50 1996 Stu Grossman (grossman@critters.cygnus.com) - - * config/mh-cygwin32 (CFLAGS): Define _WIN32 to be compatible - with normal Windows compilation environment. - -Thu Aug 8 12:18:59 1996 Klaus Kaempf <kkaempf@progis.de> - - * make-all.com: Run config-a-gas. - * setup.com: Don't copy subdirectory files around. - -Tue Jul 30 17:49:31 1996 Brendan Kehoe <brendan@cygnus.com> - - * configure.in (*-*-ose): Remove exclusion of libgloss for this - target, it now compiles correctly. - -Sat Jul 27 15:10:43 1996 Stan Shebs <shebs@andros.cygnus.com> - - * mpw-config.in: Generate Mac include for elf/dwarf2.h. - -Tue Jul 23 10:47:04 1996 Martin M. Hunt <hunt@pizza.cygnus.com> - - * configure.in (d10v-*-*): Remove ld from $noconfigdirs. - -Mon Jul 22 13:28:51 1996 Brendan Kehoe <brendan@lisa.cygnus.com> - - * configure.in (native_only): Add prms. - -Mon Jul 22 12:27:58 1996 Ian Lance Taylor <ian@cygnus.com> - - * Makefile.in (GAS_SUPPORT_DIRS): Add make-all.com and setup.com. - (BINUTILS_SUPPORT_DIRS): Likewise. - -Thu Jul 18 12:55:40 1996 Michael Meissner <meissner@tiktok.cygnus.com> - - * configure.in (d10v-*-*): Don't configure ld or gdb until the - d10v support is added. - -Wed Jul 17 14:33:09 1996 Martin M. Hunt <hunt@pizza.cygnus.com> - - * configure.in (d10v-*-*): New target. - -Mon Jul 15 11:53:00 1996 Jeffrey A Law (law@cygnus.com) - - * config.guess (HP 9000/811): Recognize this as a PA1.1 - machine. - -Fri Jul 12 23:21:17 1996 Ken Raeburn <raeburn@cygnus.com> - - * Makefile.in (do-tar-gz): New target, split out from tail end of - taz target. Run each command separately, don't use pipes. - (taz): Use it. - -Fri Jul 12 12:08:04 1996 Stan Shebs <shebs@andros.cygnus.com> - - * mpw-configure: Look for g-mpw-make.sed in config/mpw. - * mpw-build.in: No builds should depend on building byacc or flex, - they are assumed to be installed already. - -Fri Jul 12 09:52:52 1996 Michael Meissner <meissner@tiktok.cygnus.com> - - * Makefile.in (CONFIGURE_TARGET_MODULES): Set r environment - variable that CC_FOR_TARGET needs. - -Thu Jul 11 10:09:45 1996 Michael Meissner <meissner@tiktok.cygnus.com> - - * Makefile.in (CONFIGURE_TARGET_MODULES): Determine if the multlib - options have changed since the last time the subdirectory was - configured, and if it has, reconfigure. - (CLEAN_TARGET_MODULES): Delete multilib.out and tmpmulti.out, which - CONFIGURE_TARGET_MODULES uses to remember the old multilib options. - -Wed Jul 10 18:56:59 1996 Doug Evans <dje@canuck.cygnus.com> - - * Makefile.in (ALL_MODULES,CROSS_CHECK_MODULES,INSTALL_MODULES, - CLEAN_MODULES): Add bash. - (all-bash): New target. - -Mon Jul 8 17:33:14 1996 Jim Wilson <wilson@cygnus.com> - - * configure.in (mips-sgi-irix6*): Use mh-irix6 instead of mh-irix5. - -Mon Jul 1 13:31:35 1996 Michael Meissner <meissner@tiktok.cygnus.com> - - * config.sub (basic_machine): Recognize d10v as a valid processor. - -Fri Jun 28 12:14:35 1996 Stan Shebs <shebs@andros.cygnus.com> - - * mpw-configure: Add support for --bindir. - * mpw-build.in: Use a GCC-specific build script for GCC actions. - -Wed Jun 26 17:20:12 1996 Geoffrey Noer <noer@cygnus.com> - - * configure.in: add bash, time, gawk to list of hosttools and things - to only build for native toolchains - -Tue Jun 25 23:09:03 1996 Jason Molenda (crash@godzilla.cygnus.co.jp) - - * Makefile.in (docdir): Remove. - -Tue Jun 25 19:00:08 1996 Jason Molenda (crash@godzilla.cygnus.co.jp) - - * Makefile.in (datadir): Set to $(prefix)/share. - -Mon Jun 24 23:26:07 1996 Geoffrey Noer <noer@cygnus.com> - - * configure.in: build diff and patch for cygwin32-hosted - toolchains. - -Mon Jun 24 15:01:12 1996 Joel Sherrill <joel@merlin.gcs.redstone.army.mil> - - * config.sub: Accept -rtems*. - -Sun Jun 23 22:41:54 1996 Geoffrey Noer <noer@cygnus.com> - - * configure.in: enable dosrel for cygwin32-hosted builds, - remove diff from the list of things not buildable - via Canadian Cross - -Sat Jun 22 11:39:01 1996 Jason Merrill <jason@yorick.cygnus.com> - - * Makefile.in (TARGET_SUBDIR): Move comment to previous line so we - don't get ". ". - -Fri Jun 21 17:24:48 1996 Jim Wilson <wilson@cygnus.com> - - * configure.in (mips*-sgi-irix6*): Set noconfigdirs appropriately. - -Thu Jun 20 16:57:40 1996 Ken Raeburn <raeburn@cygnus.com> - - * Makefile.in (taz): Handle case where tex3patch didn't even get - checked out. Also, if it was found, put the symlink in a new util - subdirectory. - -Thu Jun 20 12:20:33 1996 Michael Meissner <meissner@tiktok.cygnus.com> - - * config.guess (*:Linux:*:*): Add support for PowerPC Linux. - -Tue Jun 18 14:24:12 1996 Klaus Kaempf (kkaempf@progis.de) - - * config.sub: Recognize -openvms. - * configure.in (alpha*-*-*vms*): Set noconfigdirs. - * make-all.com, setup.com: New files. - -Mon Jun 17 16:34:46 1996 Jason Merrill <jason@yorick.cygnus.com> - - * Makefile.in (taz): tex3patch moved to texinfo/util. - -Sat Jun 15 17:13:25 1996 Geoffrey Noer <noer@cygnus.com> - - * configure: enable_gdbtk=no for cygwin32-hosted toolchains - * configure.in: remove make from disable-if-Can-Cross list - enable gdb if ${host} and ${target} are cygwin32 - -Fri Jun 7 18:16:52 1996 Harlan Stenn <harlan@pfcs.com> - - * config.guess (i?86-ncr-sysv*): Emit minor release numbers. - Recognize the NCR 4850 machine and NCR Pentium-based platforms. - -Wed Jun 5 00:09:17 1996 Per Bothner <bothner@wombat.gnu.ai.mit.edu> - - * config.guess: Combine mips-mips-riscos cases, and use cpp to - distinguish sysv/svr4/bsd variants. - Based on a patch from Harlan Stenn <harlan@pfcs.com>. - -Fri Jun 7 14:24:49 1996 Tom Tromey <tromey@creche.cygnus.com> - - * configure.in: Added copyright notice. - * move-if-change: Added copyright notice. - -Thu Jun 6 16:27:05 1996 Michael Meissner <meissner@tiktok.cygnus.com> - - * configure.in (powerpcle-*-solaris*): Until we get shared - libraries working, don't build gdb, sim, make, tcl, tk, or - expect. - -Tue Jun 4 20:41:45 1996 Per Bothner <bothner@deneb.cygnus.com> - - * config.guess: Merge with FSF: - - Mon Jun 3 08:49:14 1996 Karl Heuer <kwzh@gnu.ai.mit.edu> - * config.guess (*:Linux:*:*): Add guess for sparc-unknown-linux. - - Fri May 24 18:34:53 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> - * config.guess (AViiON:dgux:*:*): Fix typo in recognizing mc88110. - - Fri Apr 12 20:03:59 1996 Per Bothner <bothner@spiff.gnu.ai.mit.edu> - * config.guess: Combine two OSF1 rules. - Also recognize field test versions. From mjr@zk3.dec.com. - * config.guess (dgux): Use /usr/bin/uname rather than uname, - because GNU uname does not support -p. From pmr@pajato.com. - -Tue Jun 4 11:07:25 1996 Tom Tromey <tromey@csk3.cygnus.com> - - * Makefile.in (MAKEDIRS): Removed $(tooldir). - -Tue May 28 12:30:50 1996 Stan Shebs <shebs@andros.cygnus.com> - - * mpw-README: Document GCCIncludes. - -Sun May 26 15:16:27 1996 Fred Fish <fnf@cygnus.com> - - * configure.in (alpha-*-linux*): Set enable_shared to yes. - -Tue May 21 15:41:39 1996 Stan Shebs <shebs@andros.cygnus.com> - - * mpw-configure: Handle --enable-FOO and --disable-FOO. - -Mon May 20 10:12:29 1996 Geoffrey Noer <noer@cygnus.com> - - * configure.in (*-*-cygwin32): Configure make. - -Tue May 7 14:19:42 1996 Tom Tromey <tromey@snuffle.cygnus.com> - - * Makefile.in (inet-install): Quote value of INSTALL_MODULES. - -Fri May 3 08:57:17 1996 Tom Tromey <tromey@lisa.cygnus.com> - - * Makefile.in (all-inet): Depend on all-perl. - - * Makefile.in (inet-install): New target. - - * Makefile.in (all-inet): Depend on all-tcl. - (all-inet): Depend on all-send-pr. - -Tue Apr 30 13:55:51 1996 Michael Meissner <meissner@tiktok.cygnus.com> - - * configure.in (powerpcle-*-solaris*): Turn off tk and tcl - temporarily. - -Thu Apr 25 11:48:20 1996 Ian Lance Taylor <ian@cygnus.com> - - * configure.in: Don't configure --with-gnu-ld on AIX. - -Thu Apr 25 06:33:36 1996 Michael Meissner <meissner@wogglebug.tiac.net> - - * configure.in (powerpcle-*-solaris*): Turn off gdb temporarily. - -Tue Apr 23 09:07:39 1996 Tom Tromey <tromey@creche.cygnus.com> - - * Makefile.in (ALL_MODULES): Added all-inet. - (CROSS_CHECK_MODULES): Added check-inet. - (INSTALL_MODULES): Added install-inet. - (CLEAN_MODULES): Added clean-inet. - (all-indent): New target. - - * configure.in (host_tools): Added inet. - (native_only): Added inet. - (noconfigdirs): Added inet. - -Fri Apr 19 15:35:29 1996 Ian Lance Taylor <ian@cygnus.com> - - * configure.in: Don't configure libgloss if we are not configuring - newlib. - -Wed Apr 17 19:30:01 1996 Rob Savoye <rob@chinadoll.cygnus.com> - - * configure.in: Don't configure libgloss for unsupported - architectures. - -Tue Apr 16 11:17:05 1996 Michael Meissner <meissner@tiktok.cygnus.com> - - * Makefile.in (CLEAN_MODULES): Add clean-apache. - -Mon Apr 15 15:09:05 1996 Tom Tromey <tromey@creche.cygnus.com> - - * Makefile.in (ALL_MODULES): Include all-apache. - (CROSS_CHECK_MODULES): Include check-apache. - (INSTALL_MODULES): Include install-apache. - (all-apache): New target. - - * configure.in: Added apache everywhere perl is seen. - -Mon Apr 15 14:59:13 1996 Michael Meissner <meissner@tiktok.cygnus.com> - - * Makefile.in: Add support for clean-{module} and - clean-target-{module} rules. - -Wed Apr 10 21:37:41 PDT 1996 Marilyn E. Sander <msander@cygnus.com> - - * configure.in (*-*-ose) do not build libgloss. - -Mon Apr 8 16:16:20 1996 Michael Meissner <meissner@tiktok.cygnus.com> - - * config.guess (prep*:SunOS:5.*:*): Turn into - powerpele-unknown-solaris2. - -Mon Apr 8 14:45:41 1996 Ian Lance Taylor <ian@cygnus.com> - - * configure.in: Permit --enable-shared to specify a list of - directories. - -Fri Apr 5 08:17:57 1996 Jason Molenda (crash@phydeaux.cygnus.com) - - * configure.in (host==solaris): Pass only the first word of $CC - to /usr/bin/which when checking if we're using /usr/ccs/bin/cc. - -Fri Apr 5 03:16:13 1996 Jason Molenda (crash@phydeaux.cygnus.com) - - * Makefile.in (BASE_FLAGS_TO_PASS): pass down $(MAKE). - -Thu Mar 28 14:11:11 1996 Tom Tromey <tromey@creche.cygnus.com> - - * Makefile.in (ALL_MODULES): Include all-perl. - (CROSS_CHECK_MODULES): Include check-perl. - (INSTALL_MODULES): Include install-perl. - (ALL_X11_MODULES): Include all-guile. - (CHECK_X11_MODULES): Include check-guile. - (INSTALL_X11_MODULES): Include install-guile. - (all-perl): New target. - (all-guile): New target. - - * configure.in (host_tools): Include perl and guile. - (native_only): Include perl and guile. - (noconfigdirs): Don't build guile and perl; no ports have been - done. - -Tue Mar 26 21:18:50 1996 Andrew Cagney <cagney@kremvax.highland.com.au> - - * configure (--enable-*): Handle quoted option lists such as - --enable-sim-cflags='-g0 -O' better. - -Thu Mar 21 11:53:08 1996 Michael Meissner <meissner@tiktok.cygnus.com> - - * Makefile.in ({,inst}all-target): New rule so we can make and - install all of the target directories easily. - -Wed Mar 20 18:10:57 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> - - * configure.in: Add missing global flag in sed substitution when - deleting `target-' from ${configdirs}. - -Thu Mar 14 19:15:06 1996 Ian Lance Taylor <ian@cygnus.com> - - * Makefile.in (DO_X): Don't get confused if CC contains `=' in an - option. - - * configure.in (mips*-nec-sysvr4*): Use a host_makefile_frag of - config/mh-necv4. - - * install.sh: Correct misspelling of transformbasename. - - * config.guess: Recognize mips-*-sysv*. - -Mon Mar 11 15:36:42 1996 Dawn Perchik <dawn@critters.cygnus.com> - - * config.sub: Recognize mon960. - -Sun Mar 10 13:18:38 1996 Ian Lance Taylor <ian@cygnus.com> - - * configure: Restore Canadian Cross handling of BISON and LEX, - removed in Feb 20 change. - -Fri Mar 8 20:07:09 1996 Per Bothner <bothner@kalessin.cygnus.com> - - * README: Suggestions from Torbjorn Granlund <tege@matematik.su.se>: - Mention make install. Remove the old copyright date as well the - clumsy and rather pointless copyright on the README file. - -Fri Mar 8 17:51:35 1996 Ian Lance Taylor <ian@cygnus.com> - - * Makefile.in ($(CONFIGURE_TARGET_MODULES)): If there is a - Makefile after running symlink-tree, then run `make distclean' to - avoid clobbering any generated files in srcdir. - -Tue Mar 5 08:21:44 1996 J.T. Conklin <jtc@rtl.cygnus.com> - - * configure.in (m68k-*-netbsd*): Build everything now. - -Wed Feb 28 12:25:46 1996 Jason Merrill <jason@yorick.cygnus.com> - - * Makefile.in (taz): Fix quoting. - -Tue Feb 27 11:33:57 1996 Doug Evans <dje@charmed.cygnus.com> - - * configure.in (sparclet-*-*): Build everything now. - -Tue Feb 27 14:31:51 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> - - * configure.in (m68k-*-linux*): New host. - -Mon Feb 26 14:32:44 1996 Ian Lance Taylor <ian@cygnus.com> - - * configure: Check for bison before byacc. - -Tue Feb 20 23:12:35 1996 Stu Grossman (grossman@critters.cygnus.com) - - * Makefile.in configure: Change the way LEX and BISON/YACC are - set. configure now defines DEFAULT_LEX and DEFAULT_YACC by - searching PATH. These are used as fallbacks by Makefile.in if - flex/bison/byacc aren't in objdir. - -Mon Feb 19 11:45:30 1996 Ian Lance Taylor <ian@cygnus.com> - - * Makefile.in: Make everything which depends upon all-bfd also - depend upon all-opcodes, in case --with-commonbfdlib is used. - -Thu Feb 15 19:50:50 1996 Michael Meissner <meissner@tiktok.cygnus.com> - - * configure.in (host *-*-cygwin32): Don't build gdb if we are - building NT native compilers on Unix. - -Thu Feb 15 17:42:25 1996 Ian Lance Taylor <ian@cygnus.com> - - * configure.in: Don't get CC from the host Makefile fragment if we - can find gcc in PATH, or if this is a Canadian Cross. Move the - Solaris test for /usr/ucb/cc to the post target script, just after - the compiler sanity test. - -Wed Feb 14 16:57:40 1996 Ian Lance Taylor <ian@cygnus.com> - - * config.sub: Merge with FSF. - -Tue Feb 13 14:27:48 1996 Ian Lance Taylor <ian@cygnus.com> - - * Makefile.in (RPATH_ENVVAR): New variable. - (REALLY_SET_LIB_PATH): Use it. - * configure.in: On HP/UX, set RPATH_ENVVAR to SHLIB_PATH. - -Mon Feb 12 15:28:49 1996 Doug Evans <dje@charmed.cygnus.com> - - * config.sub, configure.in: Recognize sparclet cpu. - -Mon Feb 12 15:33:59 1996 Christian Bauernfeind <chrisbfd@theorie3.physik.uni-erlangen.de> - - * config.guess: Support m68k-cbm-sysv4. - -Sat Feb 10 12:06:42 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> - - * config.guess (*:Linux:*:*): Guess m68k-unknown-linux and - m68k-unknown-linuxaout from linker help string. Put quotes around - $ld_help_string. - -Thu Dec 7 09:03:24 1995 Tom Horsley <Tom.Horsley@mail.hcsc.com> - - * config.guess (powerpc-harris-powerunix): Add guess for port - to new target. - -Thu Feb 8 15:37:52 1996 Brendan Kehoe <brendan@lisa.cygnus.com> - - * config.guess (UNAME_VERSION): Recognize X4.x as an OSF version. - -Mon Feb 5 16:36:51 1996 Ian Lance Taylor <ian@cygnus.com> - - * configure.in: If --enable-shared was used, set SET_LIB_PATH to - $(REALLY_SET_LIB_PATH) in Makefile. - * Makefile.in (SET_LIB_PATH): New variable. - (REALLY_SET_LIB_PATH): New variable. - ($(DO_X)): Use $(SET_LIB_PATH). - (install.all, gcc-no-fixedincludes, $(ALL_MODULES)): Likewise. - ($(NATIVE_CHECK_MODULES), $(CROSS_CHECK_MODULES)): Likewise. - ($(INSTALL_MODULES), $(CONFIGURE_TARGET_MODULES)): Likewise. - ($(ALL_TARGET_MODULES), $(CHECK_TARGET_MODULES)): Likewise. - ($(INSTALL_TARGET_MODULES), $(ALL_X11_MODULES)): Likewise. - ($(CHECK_X11_MODULES), $(INSTALL_X11_MODULES)): Likewise. - (all-gcc, all-bootstrap, check-gcc, install-gcc): Likewise. - (install-dosrel): Likewise. - (all-opcodes): Depend upon all-libiberty. - -Sun Feb 4 16:51:11 1996 Steve Chamberlain <sac@slash.cygnus.com> - - * config.guess (*:CYGWIN*): New - -Sat Feb 3 10:42:35 1996 Michael Meissner <meissner@tiktok.cygnus.com> - - * Makefile.in (all-target-winsup): All all-target-libiberty. - -Fri Feb 2 17:58:56 1996 Michael Meissner <meissner@tiktok.cygnus.com> - - * configure.in (noconfigdirs): Add missing # in front of comment. - -Thu Feb 1 14:38:13 1996 Geoffrey Noer <noer@cygnus.com> - - * configure.in: add second pass to things added to noconfigdirs - so *-gm-magic can exclude libgloss properly. - -Thu Feb 1 11:10:16 1996 Stan Shebs <shebs@andros.cygnus.com> - - * mpw-configure (extralibs_name, rez_name): Set correctly - for MWC68K compiler. - - * mpw-README: Add more info on the necessary build tools. - -Thu Feb 1 10:22:38 1996 Steve Chamberlain <sac@slash.cygnus.com> - - * configure.in, config.sub: Recognize cygwin32. - -Wed Jan 31 14:17:10 1996 Richard Henderson <rth@tamu.edu> - - * config.guess, config.sub: Recognize A/UX. - -Wed Jan 31 13:52:14 1996 Ian Lance Taylor <ian@cygnus.com> - - * config.sub: Merge with gcc/config.sub. - -Thu Jan 25 11:01:10 1996 Raymond Jou <rjou@mexican.cygnus.com> - - * mpw-build.in (do-binutils): Add build of stamps. - -Thu Jan 25 17:05:26 1996 James G. Smith <jsmith@cygnus.co.uk> - - * config.sub: Add recognition for mips64vr4100*-* targets. - -Wed Jan 24 12:47:55 1996 Brendan Kehoe <brendan@lisa.cygnus.com> - - * test-build.mk: Add checking of `hpux9' rather than just `hpux'. - Add creation of gconfigargs with `--enable-shared' turned on. - ($(host)-stamp-stage2-configured): Pass $(gconfigargs). - ($(host)-stamp-stage3-configured): Likewise. - (HOLES): Add chatr and ldd. - (i386-ncr-sysv4.3*): Add use of /usr/ccs/bin in the PATH and HOLE_DIRS. - -Wed Jan 24 20:32:30 1996 Torbjorn Granlund <tege@noisy.matematik.su.se> - - * configure: Pass --nfp to recursive configures. - -Mon Jan 22 10:41:56 1996 Steve Chamberlain <sac@slash.cygnus.com> - - * Makefile.in (DLLTOOL): New. - (DLLTOOL_FOR_TARGET): New. - (EXTRA_HOST_FLAGS): Pass down DLLTOOL. - (EXTRA_TARGET_FLAGS): Ditto. - (EXTRA_GCC_FLAGS): Ditto. - (CONFIGURE_TARGET_MODULES): Ditto. - (DO_X): Ditto. - * configure: Add DLLTOOL. - -Fri Jan 19 13:30:15 1996 Stan Shebs <shebs@andros.cygnus.com> - - SCO OpenServer 5 changes from Robert Lipe <robertl@dgii.com>: - * configure.in (i[345]86-*-sco3.2v5*): Use mh-sysv instead of - mh-sco, since old workarounds no longer needed, and don't - build ld, since libraries have weak symbols in COFF. - -Sun Jan 14 23:01:31 1996 Fred Fish <fnf@cygnus.com> - - * Makefile.in (CONFIGURE_TARGET_MODULES): Add missing ';'. - -Fri Jan 12 15:25:35 1996 Ian Lance Taylor <ian@cygnus.com> - - * configure.in: Make sure that ${CC} can be used to compile an - executable. - -Sat Jan 6 07:23:33 1996 Michael Meissner <meissner@wogglebug.tiac.net> - - * Makefile.in (all-gdb): Depend on $(GDB_TK). - * configure (GDB_TK): Set GDB_TK to either "all-tcl all-tk" or - nothing depending on whether gdbtk is being built. - -Wed Jan 3 17:54:41 1996 Doug Evans <dje@canuck.cygnus.com> - - * Makefile.in (newlib.tar.gz): Delete building of newlib's info files. - -Mon Jan 1 19:09:14 1996 Brendan Kehoe <brendan@rtl.cygnus.com> - - * configure.in (noconfigdirs): Put ld or gas in this early, if the - user specifically used --with-gnu-ld=no or --with-gnu-as=no. - -Sat Dec 30 16:08:57 1995 Doug Evans <dje@canuck.cygnus.com> - - * config-ml.in: Add support for - --disable-{softfloat,m68881,m68000,m68020} on m68*-*-*. - Simplify setting of multidirs from --disable-foo. - -Fri Dec 29 07:56:11 1995 Michael Meissner <meissner@tiktok.cygnus.com> - - * Makefile.in (EXTRA_GCC_FLAGS): If any of the make variables - LANGUAGES, BOOT_CFLAGS, STMP_FIXPROTO, LIMITS_H_TEST, - LIBGCC1_TEST, LIBGCC2_CFLAGS, LIBGCC2_INCLUDES, and ENQUIRE are - non-empty, pass them on to the GCC make. - (all-bootstrap): New rule that is like all-gcc, except it executes - the GCC bootstrap rule instead of the GCC all rule. - -Wed Dec 27 15:51:48 1995 Doug Evans <dje@canuck.cygnus.com> - - * config-ml.in (ml_realsrcdir): New, to account for ${subdir}. - -Tue Dec 26 11:45:31 1995 Michael Meissner <meissner@tiktok.cygnus.com> - - * config.guess (AViiON:dgux:*:*): Update from FSF to add pentium - DG/UX support. - -Fri Dec 15 10:01:27 1995 Stan Cox <coxs@dg-rtp.dg.com> - - * config.sub (i*86*) Change [345] to [3456] - -Wed Dec 20 17:41:40 1995 Brendan Kehoe <brendan@lisa.cygnus.com> - - * configure.in (noconfigdirs): Add gas or ld if --with-gnu-as=no or - --with-gnu-ld=no. - -Wed Dec 20 15:15:35 1995 Michael Meissner <meissner@tiktok.cygnus.com> - - * config-ml.in (rs6000*, powerpc*): Add switches to control which - AIX multilibs get built. - -Mon Dec 18 17:55:46 1995 Jason Molenda (crash@phydeaux.cygnus.com) - - * configure.in (i386-win32): Don't build expect if we're not - building the tcl subdir. - -Mon Dec 18 11:47:19 1995 Stan Shebs <shebs@andros.cygnus.com> - - * Makefile.in: (configure-target-examples, all-target-examples): - New targets, configure and build example programs. - -Fri Dec 15 16:13:03 1995 Stan Shebs <shebs@andros.cygnus.com> - - * mpw-configure: If an mpw-config.in generated a file mk.sed, - use it as input to sedit the generated MPW makefile. - * mpw-README: Add a suggestion about Gestalt.h. - -Wed Dec 13 16:43:51 1995 Ian Lance Taylor <ian@cygnus.com> - - * config.sub: Accept *-*-ieee*. - -Tue Dec 12 11:52:57 1995 Ian Lance Taylor <ian@cygnus.com> - - * Makefile.in (local-distclean): Remove $(TARGET_SUBDIR). From - Ronald F. Guilmette <rfg@monkeys.com>. - -Mon Dec 11 15:31:58 1995 Jason Molenda (crash@phydeaux.cygnus.com) - - * configure.in (host==powerpc-pe): Add many directories to noconfigdirs - for powerpc-pe native. - (target==i386-win32): add tcl, make to noconfigdirs if canadian cross. - (target==powerpc-pe): duplicate i386-win32 entry. - -Sat Dec 9 14:58:28 1995 Jim Wilson <wilson@chestnut.cygnus.com> - - * configure.in (noconfigdirs): Exclude target-newlib for all versions - of vxworks, not just vxworks5.1. - -Mon Dec 4 12:05:40 1995 Stan Shebs <shebs@andros.cygnus.com> - - * mpw-configure: Add support for exec-prefix. - -Mon Dec 4 10:22:50 1995 Jeffrey A. Law <law@rtl.cygnus.com> - - * config.guess: Recognize HP model 816 machines as having - a PA1.1 processor. - -Mon Dec 4 12:38:15 1995 Ian Lance Taylor <ian@cygnus.com> - - * configure: Ignore new autoconf configure options. - -Thu Nov 30 14:45:25 1995 J.T. Conklin <jtc@rtl.cygnus.com> - - * config/mt-v810 (CC_FOR_TARGET): Add -ansi flag. NEC compiler - defaults to K&R mode, but doesn't have varargs.h, so we have to - compile in ANSI mode. - -Thu Nov 30 16:57:33 1995 Per Bothner <bothner@wombat.gnu.ai.mit.edu> - - * config.guess: Recognize Pentium under SCO. - From Robert Lipe <robertl@arnet.com>. - -Wed Nov 29 13:49:08 1995 J.T. Conklin <jtc@rtl.cygnus.com> - - * configure.in (noconfigdirs): Disable target-libio on v810-*-*. - * config/mt-v810 (CC_FOR_TARGET, AS_FOR_TARGET, AR_FOR_TARGET, - RANLIB_FOR_TARGET): Set as appropriate for NEC v810 toolchain. - -Wed Nov 29 12:12:01 1995 Ian Lance Taylor <ian@cygnus.com> - - * configure.in: Don't configure gas for alpha-dec-osf*. - -Tue Nov 28 17:16:48 1995 Ian Lance Taylor <ian@cygnus.com> - - * configure.in: Default to --with-stabs for some targets for which - it makes sense: mips*-*-*, alpha*-*-osf*, i[345]86*-*-sysv4* and - i[345]86*-*-unixware*. - -Mon Nov 27 13:44:15 1995 Ian Lance Taylor <ian@cygnus.com> - - * config-ml.in: Get list of multidirs using gcc --print-multi-lib - rather than basing it on the target. Simplify handling of options - controlling which directories to configure. Remove extraneous - slash in multi-clean target. - -Fri Nov 24 17:29:29 1995 Doug Evans <dje@deneb.cygnus.com> - - * config-ml.in: Prefix more variables with ml_ so they don't collide - with configure's. - -Wed Nov 22 11:27:02 1995 Ian Lance Taylor <ian@cygnus.com> - - * configure: Don't turn -v into --v. - -Tue Nov 21 16:48:02 1995 Doug Evans <dje@deneb.cygnus.com> - - * configure.in (targargs): Fix typo. - - * Makefile.in (DEVO_SUPPORT): Add symlink-tree. - -Tue Nov 21 14:08:28 1995 Ian Lance Taylor <ian@cygnus.com> - - * configure.in: Strip --host and --target options from - CONFIG_ARGUMENTS, and always configure for --host only. Add - --with-cross-host option when building with a cross-compiler. - * configure: Canonicalize the arguments put into config.status by - always using `=' for an option with an argument. Pass a presumed - --host or --target explicitly. - -Fri Nov 17 17:50:30 1995 Stan Shebs <shebs@andros.cygnus.com> - - * config.sub: Merge -macos*, -magic*, -pe*, and -win32 cases - into general OS recognition case. - -Fri Nov 17 17:42:25 1995 Jason Molenda (crash@phydeaux.cygnus.com) - - * configure.in (target_configdirs): add target-winsup only - for win32 target systems. - -Thu Nov 16 14:04:47 1995 Ian Lance Taylor <ian@cygnus.com> - - * Makefile.in (all-target-libgloss): Depend upon - configure-target-newlib, since when libgloss is built it looks to - see if the newlib directory exists. - -Wed Nov 15 14:47:52 1995 Ken Raeburn <raeburn@cygnus.com> - - * Makefile.in (DEVO_SUPPORT): Use config-ml.in instead of - cfg-ml-*.in. - -Wed Nov 15 11:45:23 1995 Ian Lance Taylor <ian@cygnus.com> - - * configure: Handle LD and LD_FOR_TARGET when configuring a - Canadian Cross. - -Tue Nov 14 15:03:12 1995 Jason Molenda (crash@phydeaux.cygnus.com) - - * config/mh-i386win32: add LD_FOR_TARGET. - -Tue Nov 14 14:56:11 1995 Jason Molenda (crash@phydeaux.cygnus.com) - - * configure.in (target_libs): add target-winsup. - (target==i386-win32): add patch diff flex make to $noconfigdirs. - (target==ppcle-pe): remove ld from $noconfigdirs. - -Tue Nov 14 01:25:50 1995 Doug Evans <dje@canuck.cygnus.com> - - * Makefile.in (CONFIGURE_TARGET_MODULES): Pass --with-target-subdir. - Preserve relative path names in $srcdir. Build symlink tree if - configuring cross target dir and srcdir=. (= no VPATH support). - (configure-target-libg++): Depend on configure-target-librx. - * cfg-ml-com.in, cfg-ml-pos.in: Deleted. - * config-ml.in: New file. - * symlink-tree: New file. - * configure: Ensure srcdir="." if that's what it is. - -Mon Nov 13 12:34:20 1995 Stan Shebs <shebs@andros.cygnus.com> - - * mpw-README: Clarify some phrasing, add notes about CodeWarrior - includes and FLEX_SKELETON setting. - * mpw-configure (--with-gnu-ld): New option, controls whether - to use PPCLink or ld with PowerMac GCC. - * mpw-build.in (all-grez, do-grez, install-grez): New targets. - * mpw-config.in: Configure grez if targeting Mac. - - * config.sub: Accept pmac and pmac-mpw as names for PowerMacs, - accept mpw and mac-mpw as names for m68k Macs, change macos7 to - just macos. - * configure.in: Configure grez resource compiler if targeting Mac. - * Makefile.in (all-grez, install-grez): New targets. - -Wed Nov 8 17:33:51 1995 Jason Merrill <jason@yorick.cygnus.com> - - * configure: CXX defaults to gcc, not g++. If we find - gcc in the path, set CC to gcc -O2. - -Tue Nov 7 15:45:17 1995 Ian Lance Taylor <ian@cygnus.com> - - * configure: Default ${build} correctly. Avoid picking up extra - spaces when reading CC and CXX from Makefile. When doing a - Canadian Cross, use plausible default values for numerous - variables. - * configure.in: When doing a Canadian Cross, don't try to - configure tools whose configure script can't handle it. - -Mon Nov 6 19:32:17 1995 Jim Wilson <wilson@chestnut.cygnus.com> - - * cfg-ml-com.in (sh-*-*): Add m2 and ml/m2 to multidirs. - -Sun Nov 5 00:15:41 1995 Per Bothner <bothner@kalessin.cygnus.com> - - * configure: Remove dubious bug reporting address. - -Fri Nov 3 08:17:54 1995 Per Bothner <bothner@kalessin.cygnus.com> - - * Makefile.in ($(CONFIGURE_TARGET_MODULES)): If subdir has - configure script, run that instead of this directory's configure. - In either case, print a message that we're configuring the sub-dir. - -Thu Nov 2 23:23:36 1995 Per Bothner <bothner@kalessin.cygnus.com> - - * configure.in: Before checking for the existence of various files, - use sed to filter out "target-". - -Thu Nov 2 13:24:56 1995 Ian Lance Taylor <ian@cygnus.com> - - * Makefile.in (DO_X): Split rule to decrease command line length - for systems with small ARG_MAX values. From phdm@info.ucl.ac.be - (Philippe De Muyter). - -Wed Nov 1 15:18:35 1995 Jason Molenda (crash@phydeaux.cygnus.com) - - * Makefile.in (all-patch): depend on all-libiberty. - -Wed Nov 1 12:23:20 1995 Ian Lance Taylor <ian@cygnus.com> - - * configure.in: If the only directory in target_configdirs which - actually exists is libiberty, then set target_configdirs to empty, - to avoid trying to build a target libiberty in a gas or gdb - distribution. - -Tue Oct 31 17:52:39 1995 J.T. Conklin <jtc@slave.cygnus.com> - - * configure.in (host_makefile_frag): Use m68k-sun-sunos* instead - of m68k-sun-* when selecting mh-sun3 to avoid matching NetBSD/sun3 - systems. - -Tue Oct 31 16:57:32 1995 Jim Wilson <wilson@chestnut.cygnus.com> - - * configure.in (copy_dirs): Use sys-include instead of include - for --with-headers option. - -Tue Oct 31 10:29:36 1995 steve chamberlain <sac@slash.cygnus.com> - - * Makefile.in, configure.in: Make winsup builds work with - new scheme. - -Mon Oct 30 18:57:09 1995 Ian Lance Taylor <ian@cygnus.com> - - * configure.in: Build the linker on AIX. - -Mon Oct 30 12:27:16 1995 Per Bothner <bothner@kalessin.cygnus.com> - - * Makefile.in (CC_FOR_TARGET, CXX_FOR_TARGET): Add $(TARGET_SUBDIR) - where needed. - -Mon Oct 30 12:45:25 1995 Doug Evans <dje@cygnus.com> - - * Makefile.in (all-gcc): Fix typo. - -Sat Oct 28 10:27:59 1995 Per Bothner <bothner@kalessin.cygnus.com> - - * Makefile.in ($(CHECK_TARGET_MODULES)): Fix typo. - -Fri Oct 27 23:14:12 1995 Per Bothner <bothner@kalessin.cygnus.com> - - * configure.in: Rename libFOO to target-libFOO, and xiberty - to target-xiberty, to provide more flexibility. - (target_subdir): Define. Create if cross. - Set TARGET_SUBDIR in Makefile to ${target_subdir}. - * Makefile.in: Rename all-libFOO -> all-target-libFOO, all-xiberty - -> all-target-libiberty, configure-libFOO -> configure-target-libFOO, - check-libFOO -> check-target-libFOO, etc. - ($(DO_X)): Iterate over TARGET_CONFIGDIRS after SUBDIRS. - ($(CONFIGURE_TARGET_MODULES), $(CHECK_TARGET_MODULES), - $(ALL_TARGET_MODULES), $(INSTALL_TARGET_MODULES)): Update accordingly. - (configure-target-XXX): Depend on $(ALL_GCC), not all-gcc, to - allow ALL_GCC="" to only configure. - (DEVO_SUPPORT): Add cfg-ml-com.in and cfg-ml-pos.in. - (ETC_SUPPORT, ETC_SUPPORT_PFX): Merge; update 'taz' accordingly. - (LIBGXX_SUPPORT_DIRS): Remove xiberty. - -Sat Oct 28 01:53:49 1995 Ken Raeburn <raeburn@cygnus.com> - - * Makefile.in (taz): Build "info" in etc explicitly. - -Fri Oct 27 09:32:30 1995 Stu Grossman (grossman@cygnus.com) - - * configure.in: Make sure that CC is undefined (as opposed to - null) if toplevel/config/mh-{host} doesn't define it. Fixes a - problem with autoconf trying to configure on a host without GCC. - -Thu Oct 26 22:35:01 1995 Stan Shebs <shebs@andros.cygnus.com> - - * mpw-configure: Set host alias from choice of host compiler, - only use generic MPW Makefile sed if present, edit a file - named "hacked_Makefile.in" instead of "Makefile.in" if present. - * mpw-README: Add problem notes about CW6 and CW7. - -Thu Oct 26 05:45:10 1995 Ken Raeburn <raeburn@kr-pc.cygnus.com> - - * Makefile.in (taz): Use ";" instead of ";;". - -Wed Oct 25 15:18:24 1995 Per Bothner <bothner@kalessin.cygnus.com> - - * Makefile.in (taz): Grep for '^diststuff:' or '^info:' in - sub-directory Makefiles, instead of using DISTSTUFFDIRS and - DISTDOCDIRS. - (DISTSTUFFDIRS, DISTDOCDIRS): Removed - no longer used. - (newlib.tar.gz): Don't pass DISTDOCDIRS to recursive make. - -Wed Oct 25 14:43:55 1995 Per Bothner <bothner@kalessin.cygnus.com> - - * Makefile.in (DISTDOCDIRS): Remove ld gprof bnutils gas libg++ gdb - and gnats, because they are now subsumed by DISTSTUFFDIRS. - Move bfd to DISTSTUFFDIRS. - -Tue Oct 24 18:19:09 1995 Jason Molenda (crash@phydeaux.cygnus.com) - - * Makefile.in (X11_LIB): Removed. - (X11_FLAGS_TO_PASS): pass only X11_EXTRA_CFLAGS and X11_EXTRA_LIBS. - - * configure.in (host_makefile_frag): mh-aix & mh-sun removed. - -Sun Oct 22 13:04:42 1995 Michael Meissner <meissner@tiktok.cygnus.com> - - * cfg-ml-com.in (powerpc*): Shorten some of the multilib directory - names. - -Fri Oct 20 18:02:10 1995 Michael Meissner <meissner@tiktok.cygnus.com> - - * cfg-ml-com.in (powerpc*-eabi*): Add mcall-aixdesc varients. - -Thu Oct 19 10:40:57 1995 steve chamberlain <sac@slash.cygnus.com> - - * configure.in (i[345]86-*-win32): Always build newlib. - Don't configure cvs, autoconf or texinfo. - * Makefile.in (LD_FOR_TARGET): New. - (BASE_FLAGS_TO_PASS, EXTRA_TARGET_FLAGS, CONFIGURE_TARGET_MODULES): - Pass down LD_FOR_TARGET. - -Wed Oct 18 15:53:56 1995 steve chamberlain <sac@slash.cygnus.com> - - * winsup: New directory. - * Makefile.in: Build winsup. - * configure.in: Winsup is configured when target is win32. - Can only build win32 target GDB when native. - -Mon Oct 16 09:42:31 1995 Jeffrey A Law (law@cygnus.com) - - * config.guess: Recognize HP model 819 machines as having - a PA 1.1 processor. - -Mon Oct 16 10:49:43 1995 Ian Lance Taylor <ian@cygnus.com> - - * configure: Fix sed loop which substitutes for CC and CXX to - avoid bug found in various sed implementations. - -Wed Oct 11 16:16:20 1995 Michael Meissner <meissner@tiktok.cygnus.com> - - * cfg-ml-com.in (powerpc-*-eabisim): Delete separate rule for - simulator. Use standard powerpc-*-eabi*. - -Mon Oct 9 17:21:56 1995 Ian Lance Taylor <ian@cygnus.com> - - * configure.in: Stop putting gas and binutils in noconfigdirs for - powerpc-*-aix* and rs6000-*-*. - -Mon Oct 9 12:38:40 1995 Michael Meissner <meissner@cygnus.com> - - * cfg-ml-com.in (powerpc*-*-eabisim*): Add support for building - -mcall-aixdesc libraries. - -Fri Oct 6 16:17:57 1995 Ken Raeburn <raeburn@cygnus.com> - - Mon Sep 25 22:49:32 1995 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> - - * config.sub (arm | armel | armeb): Fix shell syntax. - -Fri Oct 6 14:40:28 1995 Michael Meissner <meissner@tiktok.cygnus.com> - - * cfg-ml-com.in ({powerpc,rs6000}-ibm-aix*): Add multilibs for - -msoft-float and -mcpu=common support. - (powerpc*-*-eabisim*): Add support for building -mcall-aix - libraries. - -Thu Oct 5 13:26:37 1995 Brendan Kehoe <brendan@lisa.cygnus.com> - - * configure.in: Allow configuration and build of emacs19 for the alpha. - -Wed Oct 4 22:05:36 1995 Jason Molenda (crash@phydeaux.cygnus.com) - - * configure.in (CC): Get ^CC, not just any old CC, from - ${host_makefile_frag}. - -Wed Oct 4 21:55:00 1995 Jason Molenda (crash@phydeaux.cygnus.com) - - * configure.in (CC): Try to get CC from - ${srcdir}/${host_makefile_frag}, not ${host_makefile_frag}. - -Wed Oct 4 21:44:12 1995 Jason Molenda (crash@phydeaux.cygnus.com) - - * Makefile.in (TARGET_CONFIGDIRS): configure targetdirs - only if it exists in $(srcdir). - -Wed Oct 4 11:52:31 1995 Ian Lance Taylor <ian@cygnus.com> - - * configure: If CC and CXX are not set in the environment, set - them, based on either an existing Makefile or on searching for gcc - in PATH. Substitute for CC and CXX in Makefile. - * configure.in: Remove libm from target_libs. Separate - target_configdirs from configdirs. If CC is not set in - environment, try to get it from a host Makefile fragment. Rewrite - changes of configdirs to use skipdirs instead. A few minor - tweaks. Take directories out of target_configdirs as they are - taken out of configdirs. Remove existing Makefile files from - subdirectories. Substitute for TARGET_CONFIGDIRS and - CONFIG_ARGUMENTS in Makefile. - * Makefile.in (TARGET_CONFIGDIRS): New variable, automatically set - by configure.in. - (CONFIG_ARGUMENTS): Likewise. - (CONFIGURE_TARGET_MODULES): New variable. - ($(DO_X)): Loop over TARGET_CONFIGDIRS as well as SUBDIRS. - ($(CONFIGURE_TARGET_MODULES)): New target. - (configure-libg++, configure-libio): New targets. - (all-libg++): Depend upon configure-libg++. - (all-libio): Depend upon configure-libio. - (configure-libgloss, all-libgloss): New targets. - (configure-libstdc++): New target. - (all-libstdc++): Depend upon configure-libstdc++. - (configure-librx, all-librx): New targets. - (configure-newlib): New target. - (all-newlib): Depend upon configure-newlib - (configure-xiberty): New target. - (all-xiberty): Depend upon configure-xiberty. - -Sat Sep 30 04:32:59 1995 Jason Molenda (crash@phydeaux.cygnus.com) - - * configure.in (host i[345]86-*-win32): Expand the - noconfigdirs again. - -Thu Sep 28 21:18:49 1995 Stan Shebs <shebs@andros.cygnus.com> - - * mpw-configure: Fix sed command file name. - -Thu Sep 28 17:39:56 1995 steve chamberlain <sac@slash.cygnus.com> - - * configure.in (host i[345]86-*-win32): Reduce the - noconfigdirs again. - -Wed Sep 27 12:24:00 1995 Ian Lance Taylor <ian@cygnus.com> - - * configure.in: Don't configure ld and gdb for powerpc*-*-winnt* - or powerpc*-*-pe*, since they are not yet supported. - -Tue Sep 26 14:30:01 1995 Stan Shebs <shebs@andros.cygnus.com> - - Add PowerMac support and many other enhancements. - * mpw-configure: New option --cc to select compiler to use, - paste options set according to --cc into the generated - Makefile, generate the Makefile by sed'ing the Unix Makefile.in - if mpw-make.sed is present. - * mpw-config.in: Don't test for gC1, test for mpw-touch, - add forward includes for PowerPC include files. - * mpw-build.in: Build using Makefile.PPC if present. - (do-byacc, etc): Remove separate version resource builds. - (do-gas): Build "stamps" before "all". - (do-gcc): Build "stamps-h" and "stamps-c" before "all". - * mpw-README: Update to reflect --cc option, PowerMac support, - and recently-reported compatibility problems. - -Fri Sep 22 12:15:42 1995 Doug Evans <dje@deneb.cygnus.com> - - * cfg-ml-com.in (m68*-*-*): Only build multilibs for - embedded m68k systems (-aout, -coff, -elf, -vxworks). - (--with-multilib-top): Pass to recursive invocations. - -Tue Sep 19 13:51:05 1995 J.T. Conklin <jtc@blues.cygnus.com> - - * configure.in (noconfigdirs): Disable libg++ and libstdc++ on - v810-*-*. - -Mon Sep 18 23:08:26 1995 J.T. Conklin <jtc@rtl.cygnus.com> - - * configure.in (noconfigdirs): Disable bfd, binutils, gas, gcc, - gdb, ld and opcodes on v810-*-*. - -Sat Sep 16 18:31:08 PDT 1995 Angela Marie Thomas <angela@cygnus.com> - - * config/mh-ncrsvr43: Removed AR_FLAGS - -Tue Sep 12 18:03:31 1995 Ian Lance Taylor <ian@cygnus.com> - - * Makefile.in (DO_X): Change do-realclean to do-maintainer-clean. - (local-maintainer-clean): New target. - (maintainer-clean): New target. - (realclean): Just depend upon maintainer-clean. - -Fri Sep 8 17:11:14 1995 J.T. Conklin <jtc@rtl.cygnus.com> - - * configure.in (noconfigdirs): Disable gdb on m68k-*-netbsd*. - -Fri Sep 8 16:46:29 1995 Ian Lance Taylor <ian@cygnus.com> - - * configure.in: Build ld in mips*-*-bsd* case. - -Thu Sep 7 20:03:41 1995 Ken Raeburn <raeburn@cygnus.com> - - * config.sub: Accept -lites* OS. From Ian Dall. - -Fri Sep 1 08:06:58 1995 James G. Smith <jsmith@beauty.cygnus.com> - - * config.sub: recognise mips64vr4300 and mips64vr4300el as valid - targets. - -Wed Aug 30 21:06:50 1995 Jason Molenda (crash@phydeaux.cygnus.com) - - * configure.in: treat i386-win32 canadian cross the same as - i386-go32 canadian cross. - -Thu Aug 24 14:53:20 1995 Michael Meissner <meissner@tiktok.cygnus.com> - - * cfg-ml-com.in (powerpc*-*-eabisim): Add support for PowerPC - running under the simulator to build a reduced set of libraries. - (powerpc-*-eabiaix): Add fine grained multilib support added to - other powerpc targets yesterday. - -Wed Aug 23 09:41:56 1995 Michael Meissner <meissner@tiktok.cygnus.com> - - * cfg-ml-com.in (powerpc*): Add support for -disable-biendian, - -disable-softfloat, -disable-relocatable, -disable-aix, and - -disable-sysv to control which multilib libraries get built. - -Thu Aug 17 16:03:41 1995 Ken Raeburn <raeburn@kr-laptop.cygnus.com> - - * configure: Add Makefile.tem to list of files to remove in trap - handler. - -Mon Aug 14 19:27:56 1995 Per Bothner <bothner@kalessin.cygnus.com> - - * config.guess (*Linux*): Add missing "exit"s. - Also, need specific check for alpha-unknown-linux (uses COFF). - -Fri Aug 11 15:38:20 1995 Per Bothner <bothner@kalessin.cygnus.com> - - * config.guess: Merge with FSF: - - Wed Jun 28 17:57:27 1995 David Edelsohn <edelsohn@mhpcc.edu> - * config.guess (AIX4): More robust release numbering discovery. - - Thu Jun 22 19:01:24 1995 Kenneth Stailey (kstailey@eagle.dol-esa.gov) - * config.guess (i386-sequent-ptx): Properly get version number. - - Thu Jun 22 18:36:42 1995 Uwe Seimet (seimet@iris1.chemie.uni-kl.de) - * config.guess (mips:*:4*:UMIPS): New case. - -Mon Aug 7 09:21:35 1995 Doug Evans <dje@canuck.cygnus.com> - - * configure.in (i386-go32 host): Fix typo (deja-gnu -> dejagnu). - (i386-win32 host): Likewise. Don't build readline. - -Sat Aug 5 09:51:49 1995 Fred Fish <fnf@rtl.cygnus.com> - - * Makefile.in (GDBTK_SUPPORT_DIRS): Define and pass as part of - SUPPORT_FILES to submakes. - -Fri Aug 4 13:04:36 1995 Fred Fish <fnf@cygnus.com> - - * Makefile.in (GDB_SUPPORT_DIRS): Add utils. - (DEVO_SUPPORT): Add mpw-README, mpw-build.in, mpw-config.h and - mpw-configure. - -Wed Aug 2 16:32:40 1995 Ken Raeburn <raeburn@cygnus.com> - - * configure.in (appdirs): Use =, not ==, in test expression when - trying to build the text to print in the warning message for - Solaris users. - -Mon Jul 31 09:56:18 1995 steve chamberlain <sac@slash.cygnus.com> - - * cfg-ml-com.in (z8k-*-coff): Add 'std' multilib build. - -Fri Jul 28 00:16:31 1995 Jeffrey A. Law <law@rtl.cygnus.com> - - * config.guess: Recognize lynx-2.3. - -Thu Jul 27 15:47:59 1995 steve chamberlain <sac@slash.cygnus.com> - - * config.sub (z8ksim): Deleted - (z8k-*-coff): New, this is the one true name of the target. - -Thu Jul 27 14:33:33 1995 Doug Evans <dje@canuck.cygnus.com> - - * cfg-ml-pos.in (dotdot): Work around SunOS sed bug. - -Thu Jul 27 13:31:05 1995 Fred Fish (fnf@cygnus.com) - - * config.guess (*:Linux:*:*): First try asking the linker what the - default object file format is (elf, aout, or coff). Then if this - fails, try previous methods. - -Thu Jul 27 11:28:17 1995 J.T. Conklin <jtc@rtl.cygnus.com> - - * configure.in: Don't build newlib for *-*-vxworks5.1. - -Thu Jul 27 11:18:47 1995 Brendan Kehoe <brendan@lisa.cygnus.com> - - * configure.in: Don't build newlib for a29k-*-vxworks5.1. - * test-build.mk: Add setting of --with-headers for a29k-vxworks5.1. - -Tue Jul 25 21:25:39 1995 Doug Evans <dje@canuck.cygnus.com> - - * cfg-ml-pos.in (MULTITOP): Trim excess trailing "/.". - -Fri Jul 21 10:41:12 1995 Doug Evans <dje@canuck.cygnus.com> - - * cfg-ml-com.in: New file. - * cfg-ml-pos.in: New file. - -Wed Jul 19 00:37:27 1995 Jeffrey A. Law <law@rtl.cygnus.com> - - * COPYING.NEWLIB: Add HP free copyright to list. - -Tue Jul 18 10:58:51 1995 Michael Meissner <meissner@tiktok.cygnus.com> - - * config.sub: Recognize -eabi* for the system, not just -eabi. - -Mon Jul 3 13:44:51 1995 Steve Chamberlain <sac@slash.cygnus.com> - - * Makfile.in (DLLTOOL_FOR_TARGET): New name, pass it down. - * config.sub, configure.in (win32): New target and host. - -Wed Jun 28 23:57:08 1995 Steve Chamberlain <sac@slash.cygnus.com> - - * configure.in: Add i386-pe configuration. - -Fri Jun 23 14:28:44 1995 Stan Shebs <shebs@andros.cygnus.com> - - * mpw-build.in (install): Install GDB after LD. - -Thu Jun 22 17:10:53 1995 Stan Shebs <shebs@andros.cygnus.com> - - * mpw-config.in (elf/mips.h): Always forward-include, needed - for GDB to build. - -Wed Jun 21 15:17:30 1995 Rob Savoye <rob@darkstar.cygnus.com> - - * testsuite: New directory for customer acceptance and whole tool - chain tests. - -Wed Jun 21 16:50:29 1995 Ken Raeburn <raeburn@cujo.cygnus.com> - - * configure: If per-host line isn't found, but AC_OUTPUT is found - and a configure script exists, run it instead. - -Thu Jun 15 21:09:24 1995 Per Bothner <bothner@kalessin.cygnus.com> - - * config.guess: Update from FSF, for alpha-dec-winnt3.5 and Crays. - -Tue Jun 13 21:43:27 1995 Rob Savoye <rob@darkstar.cygnus.com> - - * configure: Set build_{cpu,vendor,os,alias} to host values when - --build isn't specified. - -Mon Jun 5 18:26:36 1995 Jason Merrill <jason@phydeaux.cygnus.com> - - * Makefile.in (PICFLAG, PICFLAG_FOR_TARGET): New macros. - (FLAGS_TO_PASS): Pass them. - (EXTRA_TARGET_FLAGS): Ditto. - - * config/m?-*pic: Define PICFLAG* instead of LIB*FLAGS*. - -Wed May 31 22:27:42 1995 Jim Wilson <wilson@chestnut.cygnus.com> - - * Makefile.in (all-libg++): Depend on all-libstdc++. - -Thu May 25 22:40:59 1995 J.T. Conklin <jtc@rtl.cygnus.com> - - * configure.in (noconfigdirs): Enable all packages for - i386-unknown-netbsd. - -Sat May 20 13:22:31 1995 Angela Marie Thomas <angela@cirdan.cygnus.com> - - * configure.in (noconfigdirs): Don't configure tk for i386-go32 - hosted builds (DOS builds) - -Thu May 18 18:08:49 1995 Ken Raeburn <raeburn@kr-laptop.cygnus.com> - - Changes for ARM based on patches from Richard Earnshaw: - * config.sub: Handle armeb and armel. - * configure.in: Omit arm linker only for riscix. - -Thu May 11 17:23:26 1995 Per Bothner <bothner@kalessin.cygnus.com> - - * config.guess: Update from FSF. - -Tue May 9 15:52:05 1995 Michael Meissner <meissner@cygnus.com> - - * config.sub: Recognize powerpcle as the little endian varient of - the PowerPC. Recgonize ppc as a PowerPC variant, and ppcle as a - powerpcle variant. Convert pentium into i586, not i486. Add p5 - alias for i586. Map new x86 variants p6, k5, nexgen into i586 - temporarily. - -Tue May 2 16:29:41 1995 Jeff Law (law@snake.cs.utah.edu) - - * configure.in (hppa*-*-lites*): Treat like hppa*-*-*elf*. - -Sun Apr 30 21:38:09 1995 Jeff Law (law@snake.cs.utah.edu) - - * config.sub: Accept -lites* as a basic system type. - -Thu Apr 27 11:33:29 1995 Michael Meissner (meissner@cygnus.com) - - * config.guess (*:Linux:*:*): Check for whether the pre-BFD linker is - installed, and if so return linuxoldld as the system name. - -Wed Apr 26 10:59:02 1995 Jeff Law (law@snake.cs.utah.edu) - - * config.guess: Add hppa1.1-hp-lites support. - -Tue Apr 25 11:08:11 1995 Rob Savoye <rob@darkstar.cygnus.com> - - * configure.in: Don't build newlib for m68k-vxworks5.1. - -Wed Apr 19 17:02:43 1995 Jim Wilson <wilson@chestnut.cygnus.com> - - * configure.in (mips-sgi-irix6): Use mh-irix5. - -Fri Apr 14 15:21:17 1995 Doug Evans <dje@chestnut.cygnus.com> - - * Makefile.in (all-gcc): Depend on all-ld (for libgcc1-test). - -Wed Apr 12 16:06:01 1995 Jason Merrill <jason@phydeaux.cygnus.com> - - * test-build.mk: Enable building of shared libraries on IRIX 5 and - OSF/1. Fix compiler flags. - * build-all.mk: Support Linux and OSF/1 3.0. Fix compiler flags. - -Tue Apr 11 18:55:40 1995 Doug Evans <dje@canuck.cygnus.com> - - * configure.in: Recognize --with-newlib. - (sparc-*-sunos4*): Build sim, dejagnu, expect, tcl if cross target. - -Mon Apr 10 14:38:20 1995 Jason Molenda (crash@phydeaux.cygnus.com) - - * Makefile.in: move {all,check,install}-gdb from *_MODULES - to *_X11_MODULES due to gdbtk needing X include files et al. - -Mon Apr 10 11:42:22 1995 Stan Shebs <shebs@andros.cygnus.com> - - Merge in support for Mac MPW as a host. - (Old change descriptions retained for informational value.) - - * mpw-config.in: Add generic include forwards for cpu-specific - include files in aout and elf directories. - - * mpw-configure: Added copyright. - * mpw-config.in: Check for presence of required build tools. - (target_libs): Add newlib. - (target_tools): Add examples. - (Read Me): Generate as "Read Me for MPW" instead. - * mpw-build.in: Base sub-builds on all-foo instead of do-foo. - (all-byacc, do-byacc, all-flex, do-flex, do-newlib): New actions. - (do-gas, do-gcc, do-gdb, do-ld): Build Version.r first. - - * mpw-configure: Remove subdir-specific makefile hackery, - delete mk.tmp after using it. - - * mpw-build.in (all): Display start and end times. - - * mpw-configure (host_canonical): Set. - (target_cpu): Always add to makefiles. - (ARCHDEFS, EMUL): Add to makefile only if nonempty. - (TM_FILE, XM_FILE, NM_FILE): No longer add to makefile. - (mpw-mh-mpw): Look for in srcdir and srcroot. - Use sed instead of mpw-edit-prefix to edit prefix definitions. - - * mpw-build.in: (install-only): New target. - - * mpw-configure (host_alias, target_alias): Rename from hostalias - and targetalias, add into generated Makefile. - (mk.tmp): If present, add into generated Makefile. - * mpw-build.in (all-gas): Build config.h first before gas proper. - - * mpw-configure (config.status): Write only if changed. - * mpw-config.in (readline): Configure it (not built, just used for - definitions). - - * mpw-config.in (elf/mips.h): Add a forward include. - - * mpw-config.in: Forward-include most .h files in include into - extra-include. - (readline): Don't build. - mpw-build.in (install): Install GDB. - - * mpw-configure (prefix, mpw_prefix): Handle it. - * mpw-config.in (mmalloc, readline): Don't configure. - * mpw-build.in (thisscript): Rename to ThisScript. - Use mpw-build instead of BuildProgram everywhere. - (mmalloc, readline): Don't build. - * mpw-README: New file, basic documentation about the MPW port. - - * mpw-config.in: Use forward-include to create include files. - - * mpw-configure: Add more things to the top of each configured - Makefile, including contents of config/mpw-mh-mpw. - * mpw-config.in (extra-include): Create this directory and fill it - with Posix-like include files when configuring. - - * config.sub (apple, mac, mpw): Add various aliases. - - * mpw-build.in: New file, top-level build script fragment for MPW. - * mpw-configure: New file, configure script for MPW. - * mpw-config.in: New file, config fragment for MPW. - -Fri Apr 7 19:33:16 1995 Jim Kingdon (kingdon@lioth.cygnus.com) - - * configure.in (host_libs): Remove glob, since it is gone from the - sources. - -Fri Mar 31 11:36:17 1995 Jason Molenda (crash@phydeaux.cygnus.com) - - * Makefile.in: define empty GDB_NLM_DEPS var. - - * configure.in(target_makefile_frag): use config/mt-netware - for netware targets. - -Thu Mar 30 13:51:43 1995 Ian Lance Taylor <ian@cygnus.com> - - * config.sub: Merge in recent FSF changes. Remove linux special - cases. - -Tue Mar 28 14:47:34 1995 Jason Molenda (crash@phydeaux.cygnus.com) - - build-all.mk,config/mh-solaris: revert these two changes: - - Tue Mar 30 10:03:09 1993 Ian Lance Taylor (ian@cygnus.com) - - * build-all.mk: Use CC=cc -Xs on Solaris. - - Mon Mar 29 19:59:26 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * config/mh-solaris: SunPRO C needs -Xs to be able to get a - working xmakefile for Emacs. - -Tue Mar 21 10:43:32 1995 Jim Kingdon (kingdon@lioth.cygnus.com) - - * glob/*: Removed. Schauer's 24 Feb 1994 readline change made us - stop using it. - * Makefile.in: Nuke all references to glob subdirectory. - -Thu Mar 16 13:35:30 1995 Jason Merrill <jason@phydeaux.cygnus.com> - - * configure.in: Fix --enable-shared logic in per-host. - -Mon Mar 13 12:33:15 1995 Ian Lance Taylor <ian@cygnus.com> - - * configure.in (*-hp-hpux[78]*): Use mh-hpux8. - -Mon Mar 6 10:21:58 1995 Jim Kingdon (kingdon@lioth.cygnus.com) - - * configure.in (noconfigdirs): Don't build gas on AIX, for - powerpc*-*-aix* as well as for rs6000*-*-aix*. - -Wed Mar 1 12:51:53 1995 Ian Lance Taylor <ian@cygnus.com> - - * configure: Fix --cache-file to work if the file argument is a - relative path. - -Tue Feb 28 17:36:07 1995 Ian Lance Taylor <ian@cygnus.com> - - * configure: If the --cache-file is used, pass it down to - configure in subdirectories. - -Mon Feb 27 12:52:46 1995 Kung Hsu <kung@mexican.cygnus.com> - - * config.sub: add vxworks29k configuration. - -Fri Feb 10 16:12:26 1995 Ken Raeburn <raeburn@cujo.cygnus.com> - - * Makefile.in (taz): Do "diststuff" part quietly. - -Sun Feb 5 14:16:35 1995 Doug Evans <dje@canuck.cygnus.com> - - * config.sub: Mini-merge with gcc/config.sub. - -Sat Feb 4 12:11:35 1995 Jim Wilson <wilson@chestnut.cygnus.com> - - * config.guess (IRIX): Sed - to _. - -Fri Feb 3 11:54:42 1995 J.T. Conklin <jtc@rtl.cygnus.com> - - * Makefile.in (source-vault, binary-vault): New targets. - -Thu Jan 26 13:00:11 1995 Michael Meissner <meissner@cygnus.com> - - * config.sub: Recognize -eabi as a basic system type. - -Thu Jan 12 13:13:23 1995 Jason Merrill <jason@phydeaux.cygnus.com> - - * configure.in (enable_shared stuff): Fix typo. - -Thu Jan 12 01:36:51 1995 deanm@medulla.LABS.TEK.COM (Dean Messing) - - * Makefile.in (BASE_FLAGS_TO_PASS): Fix typo in passing LIBCXXFLAGS*. - -Wed Jan 11 16:29:53 1995 Jason Merrill <jason@phydeaux.cygnus.com> - - * Makefile.in (LIBCXXFLAGS_FOR_TARGET): Add -fno-implicit-templates. - -Mon Jan 9 12:48:01 1995 Jim Kingdon <kingdon@lioth.cygnus.com> - - * configure.in (rs6000-*-*): Don't build gas. - -Wed Jan 4 23:53:49 1995 Ian Lance Taylor <ian@tweedledumb.cygnus.com> - - * Makefile.in: Use /x/x/ instead of /brokensed/brokensed/, to - reduce command line length. - (AS_FOR_TARGET): Check for as.new, not Makefile. - (NM_FOR_TARGET): Check for nm.new, not Makefile. - -Wed Jan 4 13:02:39 1995 Per Bothner <bothner@kalessin.cygnus.com> - - * config.guess: Merge from FSF. - -Thu Dec 15 17:11:37 1994 Ian Lance Taylor <ian@sanguine.cygnus.com> - - * configure: Don't use $ when handling program_suffix. - -Mon Dec 12 12:09:37 1994 Stu Grossman (grossman@cygnus.com) - - * configure.in: Configure tk for hppa/hpux. - -Fri Dec 2 15:55:38 1994 Per Bothner <bothner@kalessin.cygnus.com> - - * Makefile.in (LIBGXX_SUPPORT_DIRS): Add libstdc++. - -Tue Nov 29 19:37:56 1994 Per Bothner <bothner@kalessin.cygnus.com> - - * Makefile.in: Move -fno-implicit-template from CXXFLAGS - to LIBCXXFLAGS. Tests are better run without it. - -Wed Nov 23 10:29:25 1994 Brendan Kehoe (brendan@lisa.cygnus.com) - - * Makefile.in (all-ispell): Depend on all-emacs19 instead of all-emacs. - -Mon Nov 21 11:14:01 1994 J.T. Conklin <jtc@rtl.cygnus.com> - - * configure.in (*-*-netware*): Don't configure xiberty. - -Mon Nov 14 08:49:15 1994 Stu Grossman (grossman@cygnus.com) - - * configure.in: Remove tk from native_only list. - -Fri Nov 11 15:31:26 1994 Bill Cox (bill@rtl.cygnus.com) - - * build-all.mk: Add mips-ncd-elf target to sun4 targets - for special NCD build. - -Mon Nov 7 20:58:17 1994 Ken Raeburn <raeburn@cujo.cygnus.com> - - * Makefile.in (DEVO_SUPPORT): Remove configure.bat and - makeall.bat, they're only useful for binutils snapshots. - (binutils.tar.gz, gas+binutils.tar.gz): Add configure.bat and - makeall.bat to specified SUPPORT_FILES. - -Mon Nov 7 17:25:18 1994 Bill Cox (bill@cirdan.cygnus.com) - - * build-all.mk: Add Ericsson targets to sun4 and solaris - hosts. Add BNR's sun4 target to solaris host, so their - build-from-source will be tested in-house first. - -Sat Nov 5 18:43:30 1994 Jason Merrill (jason@phydeaux.cygnus.com) - - * Makefile.in (LIBCFLAGS): New variable. - (CFLAGS_FOR_TARGET): Ditto. - (LIBCFLAGS_FOR_TARGET): Ditto. - (LIBCXXFLAGS): Ditto. - (CXXFLAGS_FOR_TARGET): Ditto. - (LIBCXXFLAGS_FOR_TARGET): Ditto. - (BASE_FLAGS_TO_PASS): Pass them. - (EXTRA_TARGET_FLAGS): Ditto. - - * configure.in, config/m[th]-*pic: Support --enable-shared. - -Sat Nov 5 15:44:00 1994 Per Bothner <bothner@kalessin.cygnus.com> - - * configure.in (target_libs): Include libstdc++ again. - * config.guess: Update from FSF (for FreeBSD). - -Thu Nov 3 16:32:30 1994 Ken Raeburn <raeburn@cujo.cygnus.com> - - * Makefile.in (DEVO_SUPPORT): Include configure.bat and - makeall.bat. - (DISTDOCDIRS): Add `etc'. - (ETC_SUPPORT_PFX): New variable. - (taz): Include anything from etc starting with a word in - ETC_SUPPORT_PFX. - -Wed Oct 26 16:19:35 1994 Ian Lance Taylor <ian@sanguine.cygnus.com> - - * config.sub: Update for recent FSF changes. Remove obsolete - h8300hds entry. Add -windows* and -osx as basic os. Minor - spacing changes. - -Thu Oct 20 18:41:56 1994 Per Bothner <bothner@kalessin.cygnus.com> - - * configure.in (target_libs): Remove libstdc++ for libg++-2.6.1. - - * config.guess: Merge with FSF. - * configure.in: Match on i?86-ncr-sysv4.3, not i?86-ncr-sysv43. - -Thu Oct 20 19:26:56 1994 Ken Raeburn <raeburn@cujo.cygnus.com> - - * configure: Since the "trap 0" handler will override the exit - status on many systems, only use it for "exit 1", and make it set - a non-zero exit status; reset it before "exit 0". Also, check - exit status of config.sub, and error out if it failed. - -Wed Oct 19 18:49:55 1994 Rob Savoye (rob@cygnus.com) - - * Makefile.in: (ALL_TARGET_MODULES,INSTALL_TARGET_MODULES) Build - and install libgloss. - -Tue Oct 18 15:25:24 1994 Ian Lance Taylor <ian@sanguine.cygnus.com> - - * Makefile.in (all-binutils): Depend upon all-byacc. - - * configure.in: Don't build emacs on Irix 5. - -Mon Oct 17 16:22:12 1994 J.T. Conklin (jtc@phishhead.cygnus.com) - - * configure.in (*-*-netware*): Add libio. - -Thu Oct 13 15:51:20 1994 Jason Merrill (jason@phydeaux.cygnus.com) - - * Makefile.in (ALL_TARGET_MODULES): Add libstdc++. - (CHECK_TARGET_MODULES): Ditto. - (INSTALL_TARGET_MODULES): Ditto. - (TARGET_LIBS): Ditto. - (all-libstdc++): Note dependencies. - -Thu Oct 13 01:43:08 1994 Ken Raeburn <raeburn@cujo.cygnus.com> - - * Makefile.in (BINUTILS_SUPPORT_DIRS): Add gas. - -Tue Oct 11 12:12:29 1994 Jason Merrill (jason@phydeaux.cygnus.com) - - * Makefile.in (CXXFLAGS): Use -fno-implicit-templates instead of - -fexternal-templates. - - * configure.in (target_libs): Add libstdc++. - (noconfigdirs): Add libstdc++ as appropriate. - -Thu Oct 6 18:00:54 1994 Per Bothner (bothner@kalessin.cygnus.com) - - * config.guess: Update from FSF. - -Tue Oct 4 12:05:42 1994 Ian Lance Taylor <ian@sanguine.cygnus.com> - - * configure: Use ${config_shell} when running ${configsub}. - -Mon Oct 3 14:28:34 1994 Doug Evans <dje@canuck.cygnus.com> - - * config.sub: No longer recognize h8300h. - -Mon Oct 3 12:40:54 1994 Ian Lance Taylor <ian@sanguine.cygnus.com> - - * config.sub: Remove extraneous differences between config.sub and - gcc/config.sub. - -Sat Oct 1 00:23:12 1994 Ken Raeburn <raeburn@cujo.cygnus.com> - - * Makefile.in (DISTSTUFFDIRS): Add gas. - -Thu Sep 22 19:04:55 1994 Doug Evans (dje@canuck.cygnus.com) - - * COPYING.NEWLIB: New file. - -Mon Sep 19 18:25:40 1994 Per Bothner (bothner@kalessin.cygnus.com) - - * config.guess (HP-UX): Patch from Harlan Stenn - <harlan@landmark.com> to also emit release level. - -Wed Sep 7 13:15:25 1994 Jim Wilson (wilson@sphagnum.cygnus.com) - - * config.guess (sun4*:SunOS:*:*): Change '-JL' to '_JL'. - -Tue Sep 6 23:23:18 1994 Per Bothner (bothner@kalessin.cygnus.com) - - * config.sub: Merge nextstep cleanup from FSF. - -Mon Sep 5 05:01:30 1994 Ken Raeburn (raeburn@kr-pc.cygnus.com) - - * configure.in (arm-*-*): Don't configure ld for this target. - -Thu Sep 1 09:35:00 1994 J.T. Conklin (jtc@phishhead.cygnus.com) - - * configure.in (*-*-netware): don't configure libg++, libio, - librx, or newlib. - -Wed Aug 31 13:52:08 1994 Ian Lance Taylor (ian@sanguine.cygnus.com) - - * configure.in (alpha-dec-osf*): Use osf*, not osf1*. Don't - configure ld--it works, but it doesn't support shared libraries. - -Sun Aug 28 18:13:45 1994 Per Bothner (bothner@kalessin.cygnus.com) - - * config.guess (*-unknown-freebsd*): Get rid of possible - trailing "(Release)" in version string. - Patch from Paul Richards <paul@isl.cf.ac.uk>. - -Sat Aug 27 15:00:49 1994 Per Bothner (bothner@kalessin.cygnus.com) - - * config.guess: Fix i486-ncr-sysv43 -> i486-ncr-sysv4.3. - Fix type: *-next-neststep -> *-next-nextstep. - - * config.guess: Merge from FSF: - - Fri Aug 26 18:45:25 1994 Philippe De Muyter (phdm@info.ucl.ac.be) - - * config.guess: Recognize powerpc-ibm-aix3.2.5. - - Wed Apr 20 06:36:32 1994 Philippe De Muyter (phdm@info.ucl.ac.be) - - * config.guess: Recognize UnixWare 1.1 (UNAME_SYSTEM is SYSTEM_V - instead of UNIX_SV for UnixWare 1.0). - -Sat Aug 27 01:56:30 1994 Stu Grossman (grossman@cygnus.com) - - * Makefile.in (all-gdb): Add dependencies on all-gcc and all-ld - to make gdb/nlm/* build after the compiler and linker. - -Fri Aug 26 14:30:05 1994 Per Bothner (bothner@kalessin.cygnus.com) - - * config.guess (netbsd, freebsd, linux): Accept any machine, - not just i[34]86. - (m68k-atari-sysv4): Relocate to match FSF version. - - * config.guess: More merges from the FSF: - - Add a space before function call or macro invocation. - - Tue May 10 16:53:55 1994 Roland McGrath (roland@churchy.gnu.ai.mit.edu) - - * config.guess: Add trap cmd to remove dummy.c and dummy when - interrupted. - - Wed Apr 20 18:07:13 1994 Roland McGrath (roland@churchy.gnu.ai.mit.edu) - - * config.guess (dummy.c): Redirect stderr for `hostinfo' command. - (dummy): Redirect stderr from compilation of dummy.c. - - Sat Apr 9 14:59:28 1994 Christian Kranz (kranz@sent5.uni-duisburg.de) - - * config.guess: Distinguish between NeXTStep 2.1 and 3.x. - -Fri Aug 26 13:42:20 1994 Ken Raeburn (raeburn@kr-laptop.cygnus.com) - - * configure: Accept and ignore --cache*, for compatibility with - new autoconf. - -Fri Aug 26 13:05:27 1994 Per Bothner (bothner@kalessin.cygnus.com) - - * config.guess: Merge from FSF: - - Thu Aug 25 20:28:51 1994 Richard Stallman <rms@mole.gnu.ai.mit.edu> - - * config.guess (Pyramid*:OSx*:*:*): New case. - (PATH): Add /.attbin at end for finding uname. - (dummy.c): Handle i860-alliant-bsd. Follow whitespace conventions. - - Wed Aug 17 18:21:02 1994 Tor Egge (tegge@pvv.unit.no) - - * config.guess (M88*:DolphinOS:*:*): New case. - - Thu Aug 11 17:00:13 1994 Stan Cox (coxs@dg-rtp.dg.com) - - * config.guess (AViiON:dgux:*:*): Use TARGET_BINARY_INTERFACE - to select whether to use ELF or COFF. - - Sun Jul 24 16:20:53 1994 Richard Stallman <rms@mole.gnu.ai.mit.edu> - - * config.guess: Recognize i860-stardent-sysv and i860-unknown-sysv. - - Sun May 1 10:23:10 1994 Richard Stallman (rms@mole.gnu.ai.mit.edu) - - * config.guess: Guess the OS version for HPUX. - - Tue Mar 1 21:53:03 1994 Karl Heuer (kwzh@hal.gnu.ai.mit.edu) - - * config.guess (UNAME_VERSION): Recognize aix3.2.4 and aix3.2.5. - -Fri Aug 26 11:19:08 1994 Ian Lance Taylor (ian@sanguine.cygnus.com) - - * configure.in: Recognize --with-headers, --with-libs, and - --without-newlib. - * Makefile.in (all-xiberty): Depend upon all-ld. - -Wed Aug 24 12:36:50 1994 Ian Lance Taylor (ian@sanguine.cygnus.com) - - * configure.in: Change i[34]86 to i[345]86. - -Mon Aug 22 10:58:33 1994 Ian Lance Taylor (ian@sanguine.cygnus.com) - - * configure (version): A few more tweaks to help message. - -Fri Aug 19 12:40:25 1994 Per Bothner (bothner@kalessin.cygnus.com) - - * Makefile.in: Remove (for now) librx as a host library, - now that we're building it for target. - -Fri Aug 19 10:49:17 1994 Ian Lance Taylor (ian@sanguine.cygnus.com) - - * configure: Fix up help message; from karl@owl.hq.ileaf.com - (Karl Berry). - -Tue Aug 16 16:11:08 1994 Per Bothner (bothner@kalessin.cygnus.com) - - * configure.in: Also configure librx. - -Mon Aug 15 16:51:45 1994 Per Bothner (bothner@kalessin.cygnus.com) - - * Makefile.in: Update various rules to reflect that librx - is now needed for libg++. - -Fri Aug 12 18:07:21 1994 Ian Lance Taylor (ian@sanguine.cygnus.com) - - * config.sub: Accept mips64orion and mips64orionel as a CPU name. - -Mon Aug 8 11:36:17 1994 Stan Shebs (shebs@andros.cygnus.com) - - * configure.in: Configure the examples directory. - -Thu Aug 4 16:12:36 1994 Ian Lance Taylor (ian@sanguine.cygnus.com) - - * configure: Simplify Jun 2 1994 change. - -Wed Aug 3 04:58:16 1994 D. V. Henkel-Wallace (gumby@cygnus.com) - - * change CC to /usr/latest/bin/gcc for lynx host builds, since - /bin/gcc isn't good enough to build gcc. - -Wed Jul 27 09:07:14 1994 Fred Fish (fnf@cygnus.com) - - * Makefile.in (GDB_SUPPORT_FILES): Remove - (setup-dirs-gdb, gdb.tar.gz, make-gdb.tar.gz): Remove old rules. - (gdb.tar.gz): Add new rule to use standard distribution building - mechanism. - -Mon Jul 25 11:10:06 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * configure.in: Warn about use of /usr/ucb/cc on Solaris. From - Bill Cox <bill@cygnus.com>. - -Sat Jul 23 12:19:46 1994 Per Bothner (bothner@kalessin.cygnus.com) - - * config.guess: Recognize ISC. Patch from kwzh@gnu.ai.mit.edu. - -Fri Jul 22 17:53:59 1994 Stu Grossman (grossman@cygnus.com) - - * configure: Search current dir first in .gdbinit. - -Fri Jul 22 11:28:30 1994 Per Bothner (bothner@kalessin.cygnus.com) - - * config.sub: Recognize freebsd (merged from gcc config.sub). - -Thu Jul 21 14:10:52 1994 Per Bothner (bothner@kalessin.cygnus.com) - - * config.sub: Refer to NeXT's operating system as nextstep. - - * config.sub (case $basic_machine): Re-order the cases, to match - the order in the FSF version (which is mostly alphabethical). - Merge in some additions and changes from the FSF. - -Sat Jul 16 12:03:08 1994 Stan Shebs (shebs@andros.cygnus.com) - - * config.guess: Recognize m68k-atari-sysv4 and m88k-harris-csux7. - * config.sub: Recognize cxux7. - * configure.in: Use mh-cxux for m88k-harris-cxux*. - -Mon Jul 11 14:37:39 1994 Per Bothner (bothner@kalessin.cygnus.com) - - * config.sub: Fix typo powerpc -> powerpc-*. - -Sat Jul 9 13:03:43 1994 Michael Tiemann (tiemann@blues.cygnus.com) - - * Makefile.in: `all-emacs19' depends on `all-byacc'. - - * Makefile.in: Add all-emacs19 and install-emacs19 rules (in - parallel with all-emacs and install-emacs). Top-level command - `make all-emacs19 CC=gcc' now behaves as `make all-emacs CC=gcc'. - -Thu Jun 30 16:53:42 1994 Ian Lance Taylor (ian@sanguine.cygnus.com) - - * test-build.mk ($(host)-stamp-stage2-installed): Remove - $(relbindir)/make before doing ``make install'', and use - $(GNU_MAKE) while doing it. Avoids problem on SunOS with - installing over running make binary. - ($(host)-stamp-stage3-installed): Likewise. - -Tue Jun 28 13:43:25 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * config.guess: Recognize Mach. - -Mon Jun 27 16:41:14 1994 Ian Lance Taylor (ian@sanguine.cygnus.com) - - * configure: Check ${exec_prefixoption}, not ${exec_prefix}, to - see whether --exec-prefix was used. - -Sun Jun 26 21:15:54 1994 Per Bothner (bothner@kalessin.cygnus.com) - - * README: Explicitly mention libg++/README. (Zoo's idea.) - -Tue Jun 21 12:45:55 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * Makefile.in: Add all-librx target similar to all-libproc. - -Wed Jun 8 23:11:55 1994 Stu Grossman (grossman@cygnus.com) - - * config.guess: Rearrange tests for Alpha-OSF1 to properly deal - with post 1.2 uname bogosity. - -Thu Jun 9 00:27:59 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * configure: Remove temporary files on receipt of a signal. - -Tue Jun 7 12:06:24 1994 Ian Lance Taylor (ian@cygnus.com) - - * configure: If there is a package_makefile_frag, remove - ${subdir}/Makefile.tem after copying it in. - -Mon Jun 6 21:35:02 1994 D. V. Henkel-Wallace (gumby@cygnus.com) - - * build_all.mk: support rs6000 lynx identifies itself as - rs6000-lynx-lynxos2.2.2. Also, use /usr/cygnus/progressive/bin/gcc - since /bin/gcc is too feeble to compile a modern gcc. - -Mon Jun 6 16:06:34 1994 Karen Christiansen (karen@cirdan.cygnus.com) - - * brought devo/test-build.mk update-to-date with progressive/ - test-build.mk. Add lynx targets and hppa flag info. - -Sat Jun 4 17:23:54 1994 Per Bothner (bothner@kalessin.cygnus.com) - - * configure.in: Use mh-ncrsvr43. Patch from - Tom McConnell <tmcconne@sedona.intel.com>. - -Fri Jun 3 17:47:24 1994 Per Bothner (bothner@kalessin.cygnus.com) - - * config.guess (i386-unknown-bsdi): No longer need to - check #if defined(__bsdi__) && defined(__i386__). - -Thu Jun 2 18:56:46 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * configure: Set program_transform_nameoption correctly. - -Thu Jun 2 10:57:06 1994 Karen Christiansen (karen@cirdan.cygnus.com) - - * brought build-all.mk update-to-date with progressive build-all.mk, - added new targets and hppa info. - -Thu Jun 2 00:12:44 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * configure: If config.guess result is a prefix of the user - specified target, assume a native build and use the user specified - target as the host alias. Remove SunOS patch suffix removal hack. - * configure.in: Remove SunOS patch suffix removal hack. - - * Makefile.in (CROSS_CHECK_MODULES): Remove check-flex, since it's - in NATIVE_CHECK_MODULES. - -Wed Jun 1 10:49:41 1994 Bill Cox (bill@rtl.cygnus.com) - - * Makefile.in: Rename HOST_ONLY to NATIVE. - * configure: Delete SunOs patch suffix from host_canonical - and build_canonical variables that are prepended to Makefiles. - * configure.in: Add comments for easier maintenance. - -Tue May 31 19:39:47 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * Makefile.in: Add all-libproc target similar to all-gui. - -Tue May 31 17:16:33 1994 Tom Lord (lord@cygnus.com) - - * Makefile.in (CHECK_MODULES): split into - HOST_ONLY_CHECK_MODULES and CROSS_CHECK_MODULES. - -Tue May 31 16:36:36 1994 Paul Eggert (eggert@twinsun.com) - - * config.guess (i386-unknown-bsdi): New system to guess. - -Wed May 25 16:47:10 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * Makefile.in: Add all-gui target (but not yet build by "all"). - -Thu May 26 08:53:19 1994 Bill Cox (bill@rtl.cygnus.com) - - * config.sub: Move deletion of patch suffix from here... - * configure.in: To here, at Ian's suggestion. The top- - level scripts might need to know of a patch level. - -Wed May 25 09:15:54 1994 Bill Cox (bill@rtl.cygnus.com) - - * config.sub: Strip off patch suffix so rtl is recognized - as a sunos4.1.3 machine, even though it's been patched. - -Fri May 20 08:25:49 1994 Steve Chamberlain (sac@deneb.cygnus.com) - - * Makefile.in (INSTALL_LAST): Delete. - (INSTALL_DOSREL): New. - -Thu May 19 17:12:12 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * configure.in: Use ld for i[34]86-*-sysv4* and sparc-*-solaris2*. - Don't set use_gnu_ld to no for *-*-sysv4; that only controls - whether we pass down --with-gnu-ld anyhow. - -Thu May 19 09:29:12 1994 Steve Chamberlain (sac@cygnus.com) - - * Makefile.in (INSTALL_LAST): Change operation so it works - on more flavors of make. - * configure.in (go32): Don't build libg++ or libio. - -Fri May 13 13:28:34 1994 Steve Chamberlain (sac@cygnus.com) - - * Makefile.in (Move HOST_PREFIX_1 and friends up so - they can be overriden by templates. - -Sat May 7 16:46:44 1994 Steve Chamberlain (sac@cygnus.com) - - * configure.in (target==go32): Don't build gdb. - * dosrel: New directory. - -Fri May 6 14:19:25 1994 Steve Chamberlain (sac@cygnus.com) - - * configure.in (host==go32): Configure dosrel too. - * Makefile.in (INTALL_TARGET): Call INSTALL_LAST last. - (HOST_CC, HOST_PREFIX, HOST_PREFIX_1): Undefine, they should - be set by incoming names or templates. - (INSTALL_LAST): New rule. - * config/mh-go32: New fragment. - -Thu May 5 17:35:05 1994 Stan Shebs (shebs@andros.cygnus.com) - - * config.sub (sparclitefrw, sparclitefrwcompat): Don't set the os. - -Thu May 5 20:06:45 1994 Ken Raeburn (raeburn@cujo.cygnus.com) - - * config/mh-lynxrs6k: Renamed from mh-lynxosrs6k, to make it - unique in 8.3 naming schemes. - * configure.in (appdirs): New variable. Currently empty, but will - be used in gas distribution. If nonempty, lists a set of - directories at least one of which must get configured, or top - level configuration is considered to have failed. - (rs6000-*-lynxos*): Use new file name. - -Thu May 5 13:38:36 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - Eliminate XTRAFLAGS. - * Makefile.in (CC_FOR_TARGET): If newlib exists, refer to the - newlib include files using -idirafter, and also use -nostdinc. - (CXX_FOR_TARGET): Likewise. - (XTRAFLAGS): Removed. - (BASE_FLAGS_TO_PASS): Remove XTRAFLAGS_FOR_TARGET. - (EXTRA_HOST_FLAGS): Remove XTRAFLAGS. - (EXTRA_TARGET_FLAGS, EXTRA_GCC_FLAGS): Likewise. - ($(DO_X)): Don't pass down XTRAFLAGS. - -Thu May 5 00:16:36 1994 Ken Raeburn (raeburn@kr-pc.cygnus.com) - - * configure.in (mips*-dec-bsd*): New target; do build linker. - (mips*-*-bsd*): New target; don't build linker. - -Wed May 4 20:10:10 1994 D. V. Henkel-Wallace (gumby@cygnus.com) - - * configure.in: support rs6000-*-lynxos* configuration. - support sunos4 as a cross target. - - * config.sub: look for lynx*, not lynx since the OS version may - legitimately be part of the name. - -Tue May 3 21:48:11 1994 Ken Raeburn (raeburn@cujo.cygnus.com) - - * configure.in (i[34]86-*-sco*): Move to be with other i386 - targets. - (romp-*-*): New target. Skip various binary utilities. - (vax-*-*): New target. Don't build newlib. - (vax-*-vms): Renamed from *-*-vms. Don't build opcodes or newlib. - -Thu Apr 28 15:03:05 1994 David J. Mackenzie (djm@rtl.cygnus.com) - - * configure.in: Only set host_makefile_frag if config - directory exists. - -Wed Apr 27 12:14:30 1994 David J. Mackenzie (djm@rtl.cygnus.com) - - * install.sh: If $dstdir exists, don't check whether each - component does. - -Tue Apr 26 18:11:33 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * test-build.mk (HOLES): Add sleep; used by rcs/src/conf.sh. - -Mon Apr 25 15:06:34 1994 Stan Shebs (shebs@andros.cygnus.com) - - * configure.in (*-*-lynxos*): Don't configure newlib for either - native or cross Lynx. - -Sat Apr 16 11:58:16 1994 Doug Evans (dje@canuck.cygnus.com) - - * config.sub (sparc64-elf): Fix os. - (z8k): Remove duplicate. - -Thu Apr 14 23:33:17 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * Makefile.in (gcc-no-fixedincludes): Touch gcc/include/fixed, not - gcc/stmp-fixproto, to try to prevent fixproto from being run. - -Wed Apr 13 15:14:52 1994 Bill Cox (bill@cygnus.com) - - * configure: Make file links cleanly even if Lynx fails on - an NFS symlink (at least fail cleanly). - -Mon Apr 11 10:58:56 1994 Jim Wilson (wilson@sphagnum.cygnus.com) - - * test-build.mk (CC): For mips-sgi-irix4, change -XNh1500 to - -XNh2000. - -Sat Apr 9 15:10:45 1994 David J. Mackenzie (djm@rtl.cygnus.com) - - * configure: Unknown options are fatal again. - -Fri Apr 8 12:01:41 1994 David J. Mackenzie (djm@cygnus.com) - - * configure: Ignore --x-includes and --x-libraries, for Autoconf - compatibility. - -Thu Apr 7 17:31:43 1994 Doug Evans (dje@canuck.cygnus.com) - - * build-all.mk: Add `clean' target. - -Wed Apr 6 20:44:56 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * config.guess: Add SINIX support. - * configure.in: Add mips-*-sysv4* support. - -Mon Apr 4 17:41:44 1994 Doug Evans (dje@canuck.cygnus.com) - - * build-all.mk: Document all useful targets. - If canonhost is sparc-sun-solaris2.3, change it to sparc-sun-solaris2. - If canonhost is mips-sgi-irix4.0.5H, change it to mips-sgi-irix4. - -Thu Mar 31 04:55:57 1994 David J. Mackenzie (djm@rtl.cygnus.com) - - * configure: Support --silent, --quiet. - -Wed Mar 30 21:37:38 1994 David J. Mackenzie (djm@rtl.cygnus.com) - - * configure: Support --disable-FEATURE. - -Tue Mar 29 19:15:05 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * config.guess: Recognize NCR running SVR4.3. - -Mon Mar 28 14:55:15 1994 Per Bothner (bothner@kalessin.cygnus.com) - - * config.guess: Make BSDI generate i386-unknown-bsd386. - Patch from Paul Eggert <eggert@twinsun.com>. - -Mon Mar 28 12:54:52 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * configure.in (powerpc-*-aix*): Treat like rs6000-*-*. - -Sat Mar 26 11:25:48 1994 David J. Mackenzie (djm@rtl.cygnus.com) - - * configure: Make unrecognized options give nonfatal warnings - instead of fatal errors, and pass them to any subdirectory - configures in case they recognize them. - Make --x equivalent to --with-x. - -Fri Mar 25 21:52:10 1994 David J. Mackenzie (djm@rtl.cygnus.com) - - * configure: Add --enable-* options. Clean up usage message and - some comments. - -Thu Mar 24 09:12:53 1994 Doug Evans (dje@canuck.cygnus.com) - - * Makefile.in (NM_FOR_TARGET): Build tree version is now nm.new. - -Sun Mar 20 11:28:22 1994 Jeffrey A. Law (law@snake.cs.utah.edu) - - * configure.in (hppa*-*-*): Enable binutils. - -Sat Mar 19 11:50:16 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * config.sub: Recognize cisco. - -Fri Mar 18 16:42:32 1994 Jason Merrill (jason@deneb.cygnus.com) - - * Makefile.in (CXXFLAGS): Add -fexternal-templates. - -Tue Mar 15 11:25:55 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * config.guess: about target *-hitachi-hiuxwe2, don't print more - than one configuration name. Add comment. - -Sun Mar 6 23:13:38 1994 Hisashi MINAMINO (minamino@sra.co.jp) - - * config.guess: about target *-hitachi-hiuxwe2, fixed - machine guessing order. [Hitachi's CPU_IS_HP_MC68K - macro is incorrect.] - -Sun Mar 13 09:10:08 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * Makefile.in (TAGS): Just build TAGS in each subdirectory, rather - than the "make ls" stuff which used to be here. - -Fri Mar 11 12:52:39 1994 Per Bothner (bothner@kalessin.cygnus.com) - - * config.guess: Recognize i[34]86-unknown-freebsd. - From Shawn M Carey <smcarey@rodan.syr.edu>. - -Thu Mar 3 14:24:21 1994 Per Bothner (bothner@kalessin.cygnus.com) - - * configure.in (noconfigdirs for alpha): Remove libg++ and libio. - -Wed Mar 2 13:28:48 1994 Jim Kingdon (kingdon@deneb.cygnus.com) - - * config.guess: Check for ptx. - -Mon Feb 28 16:46:50 1994 Kung Hsu (kung@mexican.cygnus.com) - - * config.sub: Add os9k checking. - -Thu Feb 24 07:09:04 1994 Jeffrey A. Law (law@snake.cs.utah.edu) - - * config.guess: Handle OSF1 running on HPPA processors - -Fri Feb 18 14:14:00 1994 Ken Raeburn (raeburn@rtl.cygnus.com) - - * configure: If subdir configure fails, print out a message with - subdirectory name, in case subdir's configure code didn't identify - itself. - -Fri Feb 18 12:50:15 1994 Doug Evans (dje@cygnus.com) - - * configure.in: Remove embedded newlines from configdirs. - Avoid mismatches of substrings. Fix matching strings at end - of configdirs. - -Fri Feb 11 15:33:33 1994 Stu Grossman (grossman at cygnus.com) - - * config.guess: Add Lynx/rs6000 config support. - -Tue Feb 8 13:41:09 1994 Ken Raeburn (raeburn@rtl.cygnus.com) - - * configure.in (alpha-dec-osf1*, alpha*-*-*): Build gas. - -Mon Feb 7 15:42:36 1994 Jeffrey A. Law (law@cygnus.com) - - * configure.in (hppa*-*-osf*): Treat this just like most other - PA configurations (eg no binutils or ld). - (hppa*-*-*elf*): These configurations have binutils and ld. - -Sun Feb 6 16:35:07 1994 Jeffrey A. Law (law@snake.cs.utah.edu) - - * config.sub (hiux): Fix typo. From m-kasahr@sramhc.sra.co.JP. - -Sat Feb 5 01:00:33 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * configure.in (rs6000-*-*): Build gas. - -Wed Feb 2 13:57:57 1994 Jeffrey A. Law (law@snake.cs.utah.edu) - - * Makefile.in: Avoid bug in losing hpux sed. - -Wed Feb 2 14:53:05 1994 Jim Kingdon (kingdon@lioth.cygnus.com) - - * Makefile.in, test-build.mk: Remove MUNCH_NM; it was only needed - for GDB and GDB has been fixed to not need it. - -Mon Jan 31 18:40:55 1994 Stu Grossman (grossman at cygnus.com) - - * config/mh-lynxosrs6k: Account for lack of ranlib! - -Sun Jan 30 17:58:06 1994 Ken Raeburn (raeburn@cujo.cygnus.com) - - * config.guess: Recognize vax hosts. - -Fri Jan 28 15:29:38 1994 Ken Raeburn (raeburn@cujo.cygnus.com) - - * configure (while loop): Don't use "break 2" inside case - statement -- the case statement isn't an enclosing loop. - -Mon Jan 24 18:40:06 1994 Per Bothner (bothner@kalessin.cygnus.com) - - * config.guess: Clean up NeXT support, to allow nextstep - on Intel machines. Make OS be nextstep. - -Sun Jan 23 18:47:22 1994 Richard Kenner (kenner@vlsi1.ultra.nyu.edu) - - * config.guess: Add alternate forms for Convex. - -Thu Jan 20 16:13:41 1994 Stu Grossman (grossman at cygnus.com) - - * configure: Completely rewrite option processing. Take - advantage of pattern-matching to avoid invoking test frequently. - Also clean up host and target defaulting logic. - -Mon Jan 17 15:06:56 1994 Ken Raeburn (raeburn@cujo.cygnus.com) - - * Makefile.in: Replace all occurrances of "rootme" with "r" and - "$${rootme}" with "$$r", to increase the likelihood that the do-* - commands (plus user environment) will fit SCO limits. - -Thu Jan 6 11:20:57 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * configure.in: Don't issue warnings about directories which are - not being configured if -norecursion is set. Correct test for - --with-gnu-as and --with-gnu-ld to not get confused by substring - matches. - - * configure.in: Don't build gas for alpha-dec-osf1*. - -Tue Jan 4 17:10:19 1994 Stu Grossman (grossman at cygnus.com) - - * configure: Back out Per's change of 12/19/1993. It changes the - behavior of configure in unexpected and confusing ways. - - Also, use different delim char when calculating - program_transform_name so that the name can contain slashes. - -Sat Jan 1 13:45:31 1994 Rob Savoye (rob@darkstar.cygnus.com) - - * configure.in, config.sub: Add support for VSTa micro-kernel. - -Sat Dec 25 20:00:47 1993 Jeffrey A. Law (law@snake.cs.utah.edu) - - * configure.in: Nuke hacks which were used to get a special - version of GAS for HPPA configurations. - -Sun Dec 19 20:40:44 1993 Per Bothner (bothner@kalessin.cygnus.com) - - * configure: If only ${target_alias} is given, use that - as the default for ${host_alias}. - * configure: Add missing back-slashes before nested quotes. - -Wed Dec 15 18:07:18 1993 david d `zoo' zuhn (zoo@andros.cygnus.com) - - * Makefile.in (BASE_FLAGS_TO_PASS): add YACC=$(BISON) - -Tue Dec 14 21:25:33 1993 Per Bothner (bothner@cygnus.com) - - * config.guess: Recognize some Tektronix configurations. - From Kaveh R. Ghazi <ghazi@noc.rutgers.edu>. - -Sat Dec 11 11:18:00 1993 Steve Chamberlain (sac@thepub.cygnus.com) - - * config.sub: Match any flavor of SH. - -Thu Dec 2 17:16:58 1993 Ken Raeburn (raeburn@cujo.cygnus.com) - - * configure.in: Don't try to configure newlib for Alpha. - -Thu Dec 2 14:35:54 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * configure.in: Don't build ld for Irix 5. Don't build gas, - libg++ or libio for any Alpha target. - - * configure.in (mips*-sgi-irix5*): New target; use mh-irix5. - * config/mh-irix5. New file for Irix 5. - -Wed Dec 1 17:00:33 1993 Jason Merrill (jason@deneb.cygnus.com) - - * Makefile.in (GZIPPROG): Renamed from GZIP, which gzip uses for - default arguments -- so it tried to compress itself. - -Tue Nov 30 13:45:15 1993 david d `zoo' zuhn (zoo@andros.cygnus.com) - - * configure.in (notsupp): ensure that a space is always at the end - of the configdirs list, since the grep checks for an explicit space - -Tue Nov 16 15:04:27 1993 david d `zoo' zuhn (zoo@rtl.cygnus.com) - - * configure.in (target i386-sysv4.2): don't build ld, since static - versions of many libraries are not available. - -Tue Nov 16 14:28:12 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * config.guess: Recognize Apollos (using environment variables). - * configure.in: Don't configure ld, binutils, or gprof for Apollo. - -Thu Nov 11 12:03:50 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * config.guess: Recognize Sony news mips running newsos. - -Wed Nov 10 16:57:00 1993 Mark Eichin (eichin@cygnus.com) - - * Makefile.in (all-cygnus, build-cygnus): "fi else" needs to be - "fi ; else" for bash. - -Tue Nov 9 15:54:01 1993 Mark Eichin (eichin@cygnus.com) - - * Makefile.in (BASE_FLAGS_TO_PASS): pass SHELL. - -Fri Nov 5 08:07:27 1993 D. V. Henkel-Wallace (gumby@blues.cygnus.com) - - * config.sub: accept unixware as an alias for svr4.2. - Fix some inconsistancies with the gcc version. - -Fri Nov 5 15:14:12 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * Makefile.in (DISTDOCDIRS): Add gdb. - -Fri Nov 5 11:59:42 1993 Per Bothner (bothner@kalessin.cygnus.com) - - * Makefile.in (DISTDOCDIRS): Add libg++ and libio. - -Fri Nov 5 10:35:05 1993 Ken Raeburn (raeburn@rover.cygnus.com) - - * Makefile.in (taz): Only build "info" in DISTDOCDIRS. - (DISTDOCDIRS): Don't assume libg++ and gdb folks necessarily want - this now. - -Thu Nov 4 18:58:23 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * config.sub: Accept hiux* as an OS name. - - * Makefile.in: Change RUNTEST_FLAGS back to RUNTESTFLAGS per - etc/make-stds.texi. The underscore came from gcc, and dje now - agrees that RUNTESTFLAGS is the correct name. - -Thu Nov 4 10:49:01 1993 Per Bothner (bothner@kalessin.cygnus.com) - - * install.sh: Remove 'set -e'. It makes any conditionals - in the script useless. - - * config.guess: Automatically recognize arm-acorn-riscix - Patch from Richard Earnshaw (rwe11@cl.cam.ac.uk). - -Thu Nov 04 08:08:04 1993 Jeffrey Wheat (cassidy@cygnus.com) - - * Makefile.in: Change RUNTESTFLAGS to RUNTEST_FLAGS - -Wed Nov 3 22:09:46 1993 Ken Raeburn (raeburn@rtl.cygnus.com) - - * Makefile.in (DISTDOCDIRS): New variable. - (taz): Edit local Makefile.in sooner, instead of proto-toplev - Makefile.in later. Build "info" and "dvi" in DISTDOCDIRS. - -Wed Nov 3 21:31:52 1993 david d `zoo' zuhn (zoo@rtl.cygnus.com) - - * configure.in (hppa target): check the source directory for the - pagas sub-directory - -Wed Nov 3 11:12:22 1993 Doug Evans (dje@canuck.cygnus.com) - - * config.sub: Allow -aout* and -elf*. - -Wed Nov 3 11:08:33 1993 Ken Raeburn (raeburn@rtl.cygnus.com) - - * configure.in: Don't build ld on i386-solaris2, same as for - sparc-solaris2. - -Tue Nov 2 14:21:25 1993 Per Bothner (bothner@kalessin.cygnus.com) - - * Makefile.in (taz): Add texinfo/lgpl.texinfo (for libg++). - -Tue Nov 2 13:38:30 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * configure.in: Configure gdb for alpha. - -Mon Nov 1 10:42:54 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * Makefile.in (CXXFLAGS): Add -O. - -Wed Oct 27 10:45:06 1993 david d `zoo' zuhn (zoo@rtl.cygnus.com) - - * config.guess: added support for DG Aviion - -Tue Oct 26 14:37:37 1993 Ken Raeburn (raeburn@rover.cygnus.com) - - * configure.in: Produce warning message for subdirectories not - configurable for this host/target combination. Don't try to - configure gdb for vms. - -Mon Oct 25 11:22:15 1993 Ken Raeburn (raeburn@rover.cygnus.com) - - * Makefile.in (taz): Replace "byacc" with "bison -y" in the - appropriate files before making "diststuff". - (DISTBISONFILES): New var: list of files to be edited. - (DISTSTUFFDIRS): Add binutils. - -Fri Oct 22 20:32:15 1993 david d `zoo' zuhn (zoo@rtl.cygnus.com) - - * config.sub: also handle mipsel and mips64el (for little endian mips) - -Fri Oct 22 07:59:20 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * configure.in: Add * to end of all OS names. - -Thu Oct 21 11:38:28 1993 Stan Shebs (shebs@rtl.cygnus.com) - - * configure.in: Build newlib for LynxOS native. - -Wed Oct 20 09:56:12 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * config.guess: Add support for delta 88k running SVR3. - - * configure.in: Add comment about HP compiler vs. emacs. - -Tue Oct 19 16:02:22 1993 david d `zoo' zuhn (zoo@rtl.cygnus.com) - - * configure.in: don't build ld on solaris2 (not a viable option - due to bugs in getpwnam & getpwuid) - -Tue Oct 19 15:13:56 1993 Ken Raeburn (raeburn@rtl.cygnus.com) - - * configure.in: Accept alpha-dec-osf1*, not just -osf1, since - config.guess will produce a full version number. - -Tue Oct 19 15:58:01 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * configure.in: Build linker and binutils for alpha-dec-osf1. - -Tue Oct 19 11:41:55 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * Makefile.in: Remove -O from CXXFLAGS for consistency with CFLAGS, - and gdb/testsuite/Makefile.in. - -Sat Oct 9 18:39:07 1993 david d `zoo' zuhn (zoo@rtl.cygnus.com) - - * configure.in: recognize mips*- instead of mips- - -Fri Oct 8 14:15:39 1993 Ken Raeburn (raeburn@cygnus.com) - - * config.sub: Accept linux*coff and linux*elf as operating - systems. - -Thu Oct 7 12:57:19 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * config.sub: Recognize mips64, and mips3 as an alias for it. - -Wed Oct 6 13:54:21 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) - - * configure.in: Remove alpha-dec-osf*, no longer necessary now that - gdb knows how to handle OSF/1 shared libraries. - -Tue Oct 5 11:55:04 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * configure.in: Recognize hppa*-*-hiux* (currently synonym for hpux). - * config.guess: Recognize Hitachi's HIUX. - * config.sub: Recognize h3050r* and hppahitachi. - Remove redundant cases for hp9k[23]*. - -Mon Oct 4 16:15:09 1993 david d `zoo' zuhn (zoo@rtl.cygnus.com) - - * configure.in: default to '--with-gnu-as' and '--with-gnu-ld' - if gas and ld are in the source tree and are in ${configdirs}. - If ${use_gnu_as} or ${use_gnu_ld} are 'no', then don't set the - the --with options (but still pass them down on the command line, - if they were explicitly specified). - -Fri Sep 24 19:11:13 1993 david d `zoo' zuhn (zoo@rtl.cygnus.com) - - * configure: substitute SHELL value in Makefile.in with - ${CONFIG_SHELL} - -Thu Sep 23 18:05:13 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * configure.in: Build gas, ld, and binutils for *-*-sysv4* and - *-*-solaris2* targets. - -Sun Sep 19 17:01:41 1993 david d `zoo' zuhn (zoo@rtl.cygnus.com) - - * Makefile.in: define M4, and pass it down to sub-makes; - all-autoconf now depends on all-m4 - -Sat Sep 18 00:38:23 1993 david d `zoo' zuhn (zoo@rtl.cygnus.com) - - * Makefile.in ({AR,RANLIB}_FOR_TARGET): make contingent on - presence of {ar,ranlib} instead of a configured directory - -Wed Sep 15 08:41:44 1993 Jim Kingdon (kingdon@cirdan.cygnus.com) - - * config.guess: Accept 34?? as well as 33?? for NCR. - -Mon Sep 13 12:28:43 1993 david d `zoo' zuhn (zoo@rtl.cygnus.com) - - * configure.in: grab mt-hppa for HPPA targets; use 'gas ' instead - of 'gas' in sed commands, since 'gash' is now in the tree as well. - -Fri Sep 10 11:23:52 1993 david d `zoo' zuhn (zoo@rtl.cygnus.com) - - * configure: grab values for $(CC) and $(CXX) from the - environment, so that someone can do "CC=gcc configure; make" and - have it work right (matching the way that autoconf works now) - - * configure.in, Makefile.in: add support for gash, the tcl - interface to Galaxy - - * config.guess: add NetBSD variants (hp300, x86) - -Thu Sep 9 16:48:52 1993 Jason Merrill (jason@deneb.cygnus.com) - - * install.sh: Support -d option (in the manner of SunOS 4 install, - as it is more deterministic than that of GNU install) - (chmodcmd): Set file to mode 755 by default (should also do default - chgrp and chown, but I don't feel like dealing with that now) - -Tue Sep 7 11:59:39 1993 Doug Evans (dje@canuck.cygnus.com) - - * config.sub: Remove h8300hhms alias. - -Tue Aug 31 11:00:09 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * configure.in: Match *-*-solaris2* not *-sun-solaris2*. - -Mon Aug 30 18:29:10 1993 david d `zoo' zuhn (zoo@rtl.cygnus.com) - - * Makefile.in (gcc-no-fixedincludes): touch stmp-fixproto as well - as stmp-fixinc - -Wed Aug 25 16:35:59 1993 K. Richard Pixley (rich@sendai.cygnus.com) - - * config.sub: recognize m88110-bug-coff. - -Tue Aug 24 10:23:24 1993 david d `zoo' zuhn (zoo@rtl.cygnus.com) - - * Makefile.in (all-libio): all dependencies on the toolchain used - to build this (gcc, gas, ld, etc) - -Fri Aug 20 17:24:24 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * config.guess: Deal with OSF/1 1.3 on alpha. - -Thu Aug 19 11:43:04 1993 david d `zoo' zuhn (zoo@rtl.cygnus.com) - - * install.sh: add some 'else true' clauses for portability - - * configure.in: don't build libio for h8[35]00-*-* targets - -Tue Aug 17 19:02:31 1993 Per Bothner (bothner@kalessin.cygnus.com) - - * Makefile.in: Add support for new libio. - -Sun Aug 15 20:48:55 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * install.sh: If one command fails, don't try the rest. Don't try - to remove $dsttmp (via trap) unless we have already created it. - If $src doesn't exist, detect it and exit with an error. - - * config.guess: Recognize BSD on hp300. - -Wed Aug 11 18:35:13 1993 Per Bothner (bothner@kalessin.cygnus.com) - - * config.guess: Map (9000/[34]??:HP-UX:*:*) to m68k-hp-hpux. - Bug report from "Hamish (H.I.) Macdonald" <hamish@bnr.ca>. - -Wed Aug 11 15:37:51 1993 Jason Merrill (jason@deneb.cygnus.com) - - * Makefile.in (all-send-pr): depends on all-prms - -Wed Aug 11 16:56:03 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * config.guess: Fix typo (9000/8??:4.3bsd -> 9000/7??:4.3bsd). - -Fri Aug 6 14:45:02 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) - - * config.guess: From michael@mercury.cs.mun.ca (Michael Rendell): - Added test for mips-mips-riscos5. - -Thu Aug 5 15:45:08 1993 david d `zoo' zuhn (zoo@rtl.cygnus.com) - - * configure.in: use mh-hp300 for 68k HP hosts - -Mon Aug 2 11:56:53 1993 david d `zoo' zuhn (zoo@rtl.cygnus.com) - - * configure: add support for CONFIG_SHELL, so that you can use - some alternate shell for evaluating configure scripts - -Sun Aug 1 11:36:27 1993 Fred Fish (fnf@deneb.cygnus.com) - - * Makefile.in (make-gdb.tar.gz): Sed bug reporting address - in configure script to bug-gdb@prep.ai.mit.edu when building - distribution archive. - * Makefile.in (COMPRESS): Remove def. - * Makefile.in (gdb.tar.gz, make-gdb.tar.gz): Renamed from - gdb.tar.Z and make-gdb.tar.Z respectively. - * Makefile.in (make-gdb.tar.gz): Now only build gzip'd archive. - * Makefile.in (make-gdb.tar.gz): Minor changes to move closer - to convergence with 'taz' target in Makefile.in. - -Fri Jul 30 12:34:57 1993 david d `zoo' zuhn (zoo@rtl.cygnus.com) - - * install.sh (dsttmp): use trap to ensure that tmp files go - away on error conditions - -Wed Jul 28 11:57:36 1993 david d `zoo' zuhn (zoo@rtl.cygnus.com) - - * Makefile.in (BASE_FLAGS_TO_PASS): remove LOADLIBES - -Tue Jul 27 12:43:40 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * Makefile.in (install-dirs): Deal with a prefix like /gnu; - its parent is '/' not ''. - - * Makefile.in (DEVO_SUPPORT): Add comments about ChangeLog. - -Fri Jul 23 09:53:37 1993 Jason Merrill (jason@wahini.cygnus.com) - - * configure: if ${newsrcdir}/configure doesn't exist, don't assume - that ${newsrcdir}/configure.in does. - -Tue Jul 20 11:28:50 1993 david d `zoo' zuhn (zoo@rtl.cygnus.com) - - * test-build.mk: support for CONFIG_SHELL - -Mon Jul 19 21:54:46 1993 Fred Fish (fnf@deneb.cygnus.com) - - * config.sub (netware): Add as a basic system type. - -Wed Jul 14 12:03:11 1993 K. Richard Pixley (rich@sendai.cygnus.com) - - * Makefile.in (Makefile): depend on configure.in. Also drop the - $(srcdir)/ from the dependency on Makefile.in. - -Tue Jul 13 20:10:58 1993 Doug Evans (dje@canuck.cygnus.com) - - * config.sub: Recognize h8300hhms as h8300h-hitachi-hms. - (h8300hhms is temporary until multi-libraries are implemented). - * configure.in: Handle h8300h too. - -Sun Jul 11 17:35:27 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * config.guess: Recognize dpx/2 as m68k-bull-sysv3. - -Thu Jul 8 18:26:12 1993 John Gilmore (gnu@cygnus.com) - - * configure: Remove extraneous output when guessing host type. - * config.guess: Remove extraneous output when guessing using C - compiler rather than uname, or when guessing fails. - -Wed Jul 7 17:58:14 1993 david d `zoo' zuhn (zoo at rtl.cygnus.com) - - * Makefile.in: remove all.cross and install.cross targets - - * configure: remove CROSS=-DCROSS_COMPILE and ALL=all.cross - definitions - -Tue Jul 6 10:39:44 1993 Steve Chamberlain (sac@phydeaux.cygnus.com) - - * configure.in (target sh): Build gprof. - -Thu Jul 1 16:52:56 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * config.sub: change -solaris to -solaris2 - -Thu Jul 1 15:46:16 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * configure.in: Use config/mh-riscos for mips-*-sysv*. - -Wed Jun 30 09:31:58 1993 Ian Lance Taylor (ian@cygnus.com) - - * configure: Correct error message for missing Makefile.in to - print correct directory. - -Tue Jun 29 13:52:16 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * install.sh: kludge around 386BSD shell bug - -Tue Jun 29 13:06:49 1993 Per Bothner (bothner@rtl.cygnus.com) - - * config.guess: Recognize NeXT. - * config.guess: Recognize i486-ncr-sysv4. - * Makefile.in (taz): rm $(TOOL)-$$VER before linking. - -Tue Jun 29 12:50:57 1993 Ian Lance Taylor (ian@cygnus.com) - - * Makefile.in (MAKEINFOFLAGS): New variable. - (FLAGS_TO_PASS): Pass MAKEINFO as MAKEINFO MAKEINFOFLAGS. - * build-all.mk, test-build.mk: Pass down --no-split as - MAKEINFOFLAGS when hosted on DOS. Compile DOS hosted without -g. - -Thu Jun 24 13:39:11 1993 Per Bothner (bothner@rtl.cygnus.com) - - * Makefile.in (DEVO_SUPPORT): Add COPYING COPYING.LIB install.sh. - -Wed Jun 23 12:59:21 1993 Per Bothner (bothner@rtl.cygnus.com) - - * Makefile.in (libg++.tar.z): New rule. - * Makefile.in (taz): Replace 'configure -rm' by 'make distclean'. - * Makefile.in (taz): Only do a single chmod. - -Fri Jun 18 12:03:10 1993 david d `zoo' zuhn (zoo at majipoor.cygnus.com) - - * install.sh: don't use dirname anymore (replaced with sed usage) - -Thu Jun 17 18:43:42 1993 Fred Fish (fnf@cygnus.com) - - * Makefile.in: Change extension for gzip'd files from '.z' to - '.gz' per new FSF standard usage. - -Thu Jun 17 16:58:50 1993 david d `zoo' zuhn (zoo at majipoor.cygnus.com) - - * configure: put quotes around the final value of program_transform_name - -Tue Jun 15 16:48:51 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * Makefile.in: new install.sh support; update install-info rules - -Wed Jun 9 12:31:34 1993 Ian Lance Taylor (ian@cygnus.com) - - * configure.in: Build diff for crosses, but not for go32 host. - - * configure.in: Build gprof only for native, and don't build it - for mips-*-*, rs6000-*-*, or i[34]86-*-sco*. - -Mon Jun 7 13:12:11 1993 david d `zoo' zuhn (zoo at deneb.cygnus.com) - - * configure.in: don't build gas,ld,binutils on for *-*-sysv4 - -Mon Jun 7 11:40:11 1993 Brendan Kehoe (brendan@lisa.cygnus.com) - - * configure.in (host_tools): Add prms. - -Fri Jun 4 13:30:42 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * Makefile.in: install gcc, do installation of $(INSTALL_MODULES) - with $(FLAGS_TO_PASS) on the command line - - * config.sub: Recognize lynx and lynxos - -Fri Jun 4 10:59:56 1993 Ian Lance Taylor (ian@cygnus.com) - - * config.sub: Accept -ecoff*, not just -ecoff. - -Thu Jun 3 17:38:54 1993 Ken Raeburn (raeburn@cambridge.cygnus.com) - - * Makefile.in (taz): Use .gz suffix instead of .z. - (binutils.tar.gz, gas+binutils.tar.gz, gas.tar.gz): Fixed target - names. - -Thu Jun 3 00:27:06 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * Makefile.in (vault-install): add an 'else true' (for Ultrix) - -Wed Jun 2 18:19:16 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * Makefile.in (install-no-fixedincludes): install gcc last, so - that rebuilds that might happen during 'make install' don't get - bogus gcc include files - -Wed Jun 2 16:14:10 1993 Ken Raeburn (raeburn@cambridge.cygnus.com) - - Change from Utah for HPPA support: - * config.guess: Recognize hppa1.x-hp-bsd. - -Wed Jun 2 11:53:33 1993 Per Bothner (bothner@rtl.cygnus.com) - - * config.guess: Add support for Motorola Delta 68k, up to r3v7. - Patch from pot@fly.cnuce.cnr.it (Francesco Potorti`). - -Tue Jun 1 17:48:42 1993 Rob Savoye (rob at darkstar.cygnus.com) - - * config.sub: Add support for rom68k and bug boot monitors. - -Mon May 31 09:36:37 1993 Jim Kingdon (kingdon@cygnus.com) - - * Makefile.in: Make all-opcodes depend on all-bfd. - -Thu May 27 08:05:31 1993 Ian Lance Taylor (ian@cygnus.com) - - * config.guess: Added special check for i[34]86-univel-sysv4*. - -Wed May 26 16:33:40 1993 Ian Lance Taylor (ian@cygnus.com) - - * config.guess: For i[34]86-unknown-sysv4 use UNAME_MACHINE for - the processor rather than assuming i486. - -Wed May 26 09:40:18 1993 Jim Kingdon (kingdon@lioth.cygnus.com) - - * config.guess: Recognize SunOS6 as Solaris3. - -Tue May 25 23:03:11 1993 Per Bothner (bothner@cygnus.com) - - * config.guess: Fix typo. Avoid #elif (not in K&R 1). - Recognize SunOS 5.* only (and not [6-9].*) as being Solaris2. - -Tue May 25 12:44:18 1993 Ian Lance Taylor (ian@cygnus.com) - - * build-all.mk (all-cross): New target for Canadian Cross. - Added Q2 go32 targets. - * test-build.mk: Configure go32 cross sparclite-aout and - mips-idt-ecoff -with-gnu-ld. Moved build binary directory from - PARTIAL_HOLE_DIRS to BUILD_HOLES_DIRS. - -Mon May 24 15:30:06 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * configure.in: fix Alpha GDB typo; also, don't build DejaGnu for - GO32 hosted toolchains - -Mon May 24 14:18:41 1993 Rob Savoye (rob at darkstar.cygnus.com) - - * configure: change so "-exec-prefix" gets passed down rather - than "-exec_prefix" so autoconf generated Makefiles get the - exec_prefix set right. - -Fri May 21 10:42:25 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * config.guess: get the Solaris2 minor version number - - * Makefile.in: add standards.texi and make-stds.texi to ETC_SUPPORT - -Fri May 21 06:20:52 1993 Brendan Kehoe (brendan@lisa.cygnus.com) - - * config.guess: Recognize some Sequent platforms. - -Thu May 20 14:33:48 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * Makefile.in: added the vault-install target - - * configure.in: actually use the Sun3 makefile fragment that's in - config, also added the release dir to configdirs - -Thu May 20 14:19:18 1993 Ken Raeburn (raeburn@cambridge.cygnus.com) - - * Makefile.in (taz): Fix modes on stuff in $(TOOL) dir also. - -Tue May 18 20:26:41 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * configure.in: remove some program from Alpha targetted toolchains - -Tue May 18 15:23:19 1993 Ken Raeburn (raeburn@cygnus.com) - - * Makefile.in (DISTSTUFFDIRS): Renamed from PROTODIRS. Add ld and - gprof. - (taz): Run "make diststuff" in those directories instead of "make - proto-dir". Look for "VERSION=" only at start of line in subdir - Makefile. Use "gzip -9" for compression. - (TEXINFO_SUPPORT, DIST_SUPPORT, BINUTILS_SUPPORT_DIRS): New vars. - (binutils.tar.z): New target. - -Mon May 17 17:01:15 1993 Ken Raeburn (raeburn@deneb.cygnus.com) - - * Makefile.in (taz): Include gpl.texinfo. - -Fri May 14 06:48:38 1993 Ken Raeburn (raeburn@deneb.cygnus.com) - - * Makefile.in (setup-dirs): Merged into "taz" target. - (taz): Only do `proto-dir' stuff if a directory is actually needed - for this target. - -Wed May 12 13:09:44 1993 Ian Lance Taylor (ian@cygnus.com) - - * Makefile.in (MUNCH_NM): New variable, defined to be $(NM). - (FLAGS_TO_PASS): Pass down MUNCH_NM. - (HOST_CC, HOST_PREFIX, HOST_PREFIX_1): New variables. - (EXTRA_GCC_FLAGS): Pass down HOST_* variables. - (gcc-no-fixedincludes): Correct for current gcc Makefile. - -Tue May 11 10:14:25 1993 Fred Fish (fnf@cygnus.com) - - * Makefile.in (make-gdb.tar.Z): Add configure, config.guess, - config.sub, and move-if-change to gdb testsuite distribution - archive, so the testsuite can be extracted, configured, and - run separately from the gdb distribution. Blow away the Chill - tests that require a Chill compiled executable, since GNU Chill - is not yet publically available. - -Mon May 10 17:22:26 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * test-build.mk: set environment variables in a single command, - instead of a list of assignments and exports - - * config.guess: recognize Alpha/OSF1 systems - -Mon May 10 14:55:51 1993 K. Richard Pixley (rich@rtl.cygnus.com) - - * configure: Change help message to prefer --options rather than - -options. - -Mon May 10 05:58:35 1993 Ken Raeburn (raeburn@kr-pc.cygnus.com) - - * config.sub: Convergent Tech. "miniframe" uses m68010, sez - zippy@ecst.csuchico.edu. - * config.guess: Recognize miniframe. - -Sun May 9 17:47:57 1993 Rob Savoye (rob at darkstar.cygnus.com) - - * Makefile.in: Use srcroot to find runtest rather than rootme. - Pass RUNTESTFLAGS and EXPECT down in BASE_FLAGS_TO_PASS. - -Fri May 7 14:55:59 1993 Ian Lance Taylor (ian@cygnus.com) - - * test-build.mk: Extensive additions to support building on a - machine other than the host. - -Wed May 5 08:35:04 1993 Ken Raeburn (raeburn@deneb.cygnus.com) - - * configure (tooldir): Fix for i386-aix again. - -Mon May 3 19:00:27 1993 Per Bothner (bothner@cygnus.com) - - * configure, Makefile.in: Change definition of $(tooldir) - to match the FSF. - -Fri Apr 30 15:55:21 1993 Fred Fish (fnf@cygnus.com) - - * config.guess: Recognize i[34]86/SVR4. - -Fri Apr 30 15:52:46 1993 Steve Chamberlain (sac@thepub.cygnus.com) - - * Makefile.in (all-gdb): gdb depends on sim. - -Thu Apr 29 23:30:48 1993 Fred Fish (fnf@cygnus.com) - - * Makefile.in (gdb.tar.Z): Make prototype gdb testsuite directory - at the same time we make the prototype gdb directory. - * Makefile.in (make-gdb.tar.Z): Make the testsuite distribution - files at the same time as the gdb base release distribution. - -Thu Apr 29 12:50:37 1993 Ian Lance Taylor (ian@cygnus.com) - - * Makefile.in (check): Use individual check targets rather than - DO_X rule. - (check-gcc): Added. - -Thu Apr 29 09:50:07 1993 Jim Kingdon (kingdon@cygnus.com) - - * config.sub: Use sysv3.2 not sysv32 for canonical OS - for System V release 3.2. - -Thu Apr 29 10:33:22 1993 Ken Raeburn (raeburn@cambridge.cygnus.com) - - * config.sub: Recognize hppaosf. - * configure.in: Do configure ld/binutils/gas for it. - -Tue Apr 27 06:25:34 1993 Ken Raeburn (raeburn@kr-pc.cygnus.com) - - * configure (tooldir): Alter syntax used to set this, for systems - where "\$" isn't handled right, like i386-aix. - -Thu Apr 22 08:17:35 1993 Ian Lance Taylor (ian@cygnus.com) - - * configure: Pass program-transform-name, not - program_transform_name, to recursive configures. - -Thu Apr 22 02:58:21 1993 Ken Raeburn (raeburn@cygnus.com) - - * Makefile.in (gas+binutils.tar.z): New rule for building snapshots - of gas+ld+binutils. - -Mon Apr 19 17:41:30 1993 Per Bothner (bothner@cygnus.com) - - * config.guess: Recognize AIX3.2 as distinct from 3.1. - -Sat Apr 17 17:19:50 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * configure.in: rename m88k-motorola-m88kbcs to m88k-motorola-sysv - - * config/mh-delta88: remove extraneous GCC references - -Tue Apr 13 16:52:16 1993 Brendan Kehoe (brendan@lisa.cygnus.com) - - * Makefile.in (PRMS): Set back to all-prms. - -Sat Apr 10 12:04:07 1993 Ian Lance Taylor (ian@cygnus.com) - - * test-build.mk: Pass -with-gnu-as for known MIPS native and MIPS - targets, rather than for MIPS hosts. - -Fri Apr 9 13:51:06 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * configure.in: add comment for --with-x default values - - * config.guess: handle Motorola Delta88 box for SVR3 and SVR4. - - * Makefile.in: add check-* targets for each of the directories in - the tree. Add a definition of RUNTEST that will use the one we - just built, if it exists. Pass this down via FLAGS_TO_PASS. - -Thu Apr 8 09:21:30 1993 Ian Lance Taylor (ian@cygnus.com) - - * configure.in: Removed obsolete references to bfd_target and - target_makefile_frag. - - * build-all.mk: Set assorted targets for Q2. - * config.sub: Recognize z8k-sim and h8300-hms. - * test-build.mk: Really don't pass host to configure. - (HOLES): Added uname. - -Wed Apr 7 15:48:19 1993 Ian Lance Taylor (ian@cygnus.com) - - * configure: Handle an empty program-prefix, program-suffix or - program-transform-name correctly. - -Tue Apr 6 13:48:41 1993 Ian Lance Taylor (ian@cygnus.com) - - * build-all.mk: -G 8 no longer required for MIPS targets. - * test-build.mk: Don't pass host argument to configure; make it - guess. - -Tue Apr 6 10:36:53 1993 Fred Fish (fnf@cygnus.com) - - * Makefile.in (gdb.tar.Z): Fix for building gzip'd distribution. - * Makefile.in (COMPRESS): New macro, like GZIP. - -Fri Apr 2 09:02:31 1993 Ian Lance Taylor (ian@cygnus.com) - - * test-build.mk: Use -with-gnu-as for mips-sgi-irix4 as well. - - * build-all.mk: Set GCC to gcc -O -G 8 for MIPS targets, since gcc - with gas currently defaults to -G 0. - -Thu Apr 1 08:25:42 1993 Ian Lance Taylor (ian@cygnus.com) - - * Makefile.in (all-flex): flex depends on byacc. - - * build-all.mk: If host not specified, use config.guess. Pass TAG - to test-build.mk as RELEASE_TAG. - * test-build.mk (configargs): New variable containing arguments to - pass to configure. Set to -with-gnu-as on mips-dec-ultrix. - (FLAGS_TO_PASS): Pass down RELEASE_TAG. - - * config.guess: Use /bin/uname when checking -X argument on SCO, - to avoid invoking GNU uname which doesn't understand -X. - - * test-build.mk: Don't use /usr/unsupported/bin/as on AIX. - - * configure.in: Build gas for mips-*-*. - -Wed Mar 31 21:20:58 1993 K. Richard Pixley (rich@rtl.cygnus.com) - - * Makefile.in (all.normal): insert missing backslash. - -Wed Mar 31 12:31:56 1993 Ian Lance Taylor (ian@cygnus.com) - - * build-all.mk, config/mh-irix4: Bump -XNh value to 1500 to match - gcc requirements. - - * Makefile.in: Complete overhaul to merge many almost identical - targets. - -Tue Mar 30 20:17:01 1993 Ken Raeburn (raeburn@cambridge.cygnus.com) - - * Makefile.in (setup-dirs-gdb): Renamed from setup-dirs. - (gdb.tar.Z): Adjusted. - - * Makefile.in (setup-dirs, taz): New targets; should be general - enough to adapt for gdb sometime. Build only .z file. - (gas.tar.z): New target. - -Tue Mar 30 10:03:09 1993 Ian Lance Taylor (ian@cygnus.com) - - * build-all.mk: Use CC=cc -Xs on Solaris. - -Mon Mar 29 19:59:26 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * config/mh-sun3: cc needs -J to compile cp-parse.c correctly - - * config/mh-solaris: SunPRO C needs -Xs to be able to get a - working xmakefile for Emacs. - -Thu Mar 25 15:14:30 1993 Fred Fish (fnf@cygnus.com) - - * Makefile.in: Incorporate changes suggested by wilson@cygnus.com - for handling BISON for FSF releases. - -Thu Mar 25 06:19:48 1993 Ken Raeburn (raeburn@kr-pc.cygnus.com) - - * configure: Actually implement the change zoo just documented. - -Wed Mar 24 13:02:44 1993 david d `zoo' zuhn (zoo at poseidon.cygnus.com) - - * configure: when using config.guess, only set target_alias when - it's not already been set (ie, on the command line) - -Mon Mar 22 23:07:39 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * Makefile.in: add installcheck target, set PRMS to install-prms - -Sun Mar 21 16:46:12 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * configure: add support for package_makefile_fragment, handle the - case where a directory has a configure.in file but no Makefile.in - more gracefully (with an actual understandable error message, even); - add support for --without (and add this to the usage message); also - explicitly add a --host=${host_alias} to the command line when - config.guess is used - -Sun Mar 21 12:11:58 1993 Jim Wilson (wilson@sphagnum.cygnus.com) - - * configure: Must use both --host and --target in recursive calls. - -Thu Mar 18 12:31:35 1993 Ian Lance Taylor (ian@cygnus.com) - - * Makefile.in: Change deja-gnu to dejagnu. - -Mon Mar 15 15:44:35 1993 Ian Lance Taylor (ian@cygnus.com) - - * configure.in (h8300-*-*, h8500-*-*): Don't build libg++. - -Fri Mar 12 18:30:14 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * configure.in: canonicalize all instances to *-*-solaris2*, - also strip out a number of tools to not build for go32 host - -Wed Mar 10 12:08:27 1993 K. Richard Pixley (rich@rtl.cygnus.com) - - * config.guess: add GPL. - - * Makefile.in, config.guess, config.sub, configure: bump - copyrights to 93. - -Wed Mar 10 07:12:48 1993 Ian Lance Taylor (ian@cygnus.com) - - * Makefile.in (do-info): Removed obsolete check for existence of - localenv file. - - * Makefile.in (MAKEOVERRIDES): Define to be empty. - -Wed Mar 10 03:11:56 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * Makefile.in: a couple of 'else true' for decstation, - support for TclX - - * configure.in: configure tclX too; don't remove Tk on RS/6000 anymore - -Tue Mar 9 16:06:12 1993 K. Richard Pixley (rich@cygnus.com) - - * Makefile.in (setup-dirs): change invocation of make to $(MAKE). - -Mon Mar 8 14:52:11 1993 Ken Raeburn (raeburn@cambridge) - - * config.guess: Recognize i386-ibm-aix (PS/2). - * configure.in: Use config/mh-aix386 file for it. - -Mon Mar 8 11:12:43 1993 Ian Lance Taylor (ian@cygnus.com) - - * Makefile.in (GCC_FOR_TARGET): Eliminated definition; use - CC_FOR_TARGET instead. - (BASE_FLAGS_TO_PASS): Pass GCC_FOR_TARGET=$(CC_FOR_TARGET). - -Wed Mar 3 16:00:28 1993 Steve Chamberlain (sac@ok.cygnus.com) - - * Makefile.in: Add sim to list of directories sent with gdb - -Wed Mar 3 11:42:39 1993 Ken Raeburn (raeburn@cygnus.com) - - * configure.in: Put back mips-dec-bsd* case. - -Tue Mar 2 21:15:58 1993 Fred Fish (fnf@cygnus.com) - - (Ultrix 2.2 support from Michael Rendell <michael@mercury.cs.mun.ca>) - * configure.in (vax-*-ultrix2*): Add Ultrix 2.2 triplet. - * config.guess: Change 'VAX*:ULTRIX:*:*' to 'VAX*:ULTRIX*:*:*'. - * config/mh-vaxult2: New file. - -Tue Mar 2 18:11:03 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * configure.in: remove no-op mips-dec-bsd* in "case $target" - - * Makefile.in (dir.info): only run gen-info-dir if it exists, - (install-info): install dir.info only if it exists, - (all-expect, install-expect): pass along X11_FLAGS_TO_PASS - -Tue Mar 2 09:01:30 1993 Ken Raeburn (raeburn@cygnus.com) - - * configure.in: For vms target, skip bfd, ld, binutils. Do build - gas for mips-dec-bsd. - -Tue Mar 2 08:35:24 1993 Ian Lance Taylor (ian@cygnus.com) - - * configure (makesrcdir): If ${srcdir} is relative and not ".", - and ${subdir} is not ".", set makesrcdir based on ${invsubdir}. - -Tue Feb 23 14:18:28 1993 Mike Werner (mtw@poseidon.cygnus.com) - - * configure.in: Added "dejagnu" to hosttools list. - -Mon Feb 22 23:28:38 1993 Per Bothner (bothner@rtl.cygnus.com) - - * config.sub, configure.in, config.guess: Add support - for Bosx, an AIX variant from Bull. - Patches from F.Pierresteguy@frcl.bull.fr. - -Sun Feb 21 11:15:22 1993 Mike Werner (mtw@poseidon.cygnus.com) - - * devo/dejagnu: Initial creation of devo/dejagnu. - Migrated dejagnu testcases and support files for testing software - tools to reside as subdirectories, currently called "testsuite", - within the directory of the software tool. Migrated all programs, - support libraries, etc. beloging to dejagnu proper from - devo/deja-gnu to devo/dejagnu. These files were moved "as is" - with no modifications. The changes to these files which will - allow them to configure, build, and execute properly will be made - in a future update. - -Fri Feb 19 20:19:39 1993 Brendan Kehoe (brendan@lisa.cygnus.com) - - * Makefile.in: Change send_pr to send-pr. - * configure.in: Likewise. - * send_pr: Renamed directory to send-pr. - -Fri Feb 19 19:00:13 1993 Per Bothner (bothner@cygnus.com) - - * Makefile.in: Add some extra semi-colons (needed if SHELL=bash). - -Fri Feb 19 00:59:33 1993 John Gilmore (gnu@cygnus.com) - - * README: Update for gdb-4.8 release. - * Makefile.in (gdb.tar.Z): Add texinfo/tex3patch. Build - gdb-xxx.tar.z (gzip'd) file also. - -Thu Feb 18 09:16:17 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * Makefile.in: make all-diff depend on all-libiberty - -Tue Feb 16 16:06:31 1993 K. Richard Pixley (rich@cygnus.com) - - * config.guess: add vax-ultrix in the spirit of mips-ultrix. - -Tue Feb 16 05:57:15 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * configure.in, Makefile.in: add hello, tar, gzip, recode, indent - -Tue Feb 16 00:58:20 1993 John Gilmore (gnu@cygnus.com) - - * Makefile.in (DEVO_SUPPORT): Remove etc directory - (ETC_SUPPORT): Only add the files GDB wants from etc/. - (gdb.tar.Z): Use ETC_SUPPORT. Use byacc when building the file. - -Thu Feb 11 20:14:28 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * Makefile.in: makeinfo binary is in a new location - -Tue Feb 9 12:42:27 1993 Ian Lance Taylor (ian@cygnus.com) - - * config.sub: Accept -ecoff as an OS. - - * Makefile.in: Various changes to eliminate a level of make - recursion and reduce the required command line length. - (BASE_FLAGS_TO_PASS): New variable holding flags passed to all - sub-makes. - (EXTRA_HOST_FLAGS, EXTRA_TARGET_FLAGS, EXTRA_GCC_FLAGS): New - variables holding settings for specific sub-makes. - (FLAGS_TO_PASS, TARGET_FLAGS_TO_PASS, GCC_FLAGS_TO_PASS): Rewrote - in terms of BASE_FLAGS_TO_PASS. - (TARGET_LIBS): New variable listing directories which use - TARGET_FLAGS_TO_PASS. - (subdir_do): Eliminated. - (do-*): New set of targets to replace subdir_do. - (various): All targets which used subdir_do now depend on do-*. - (local-clean): Renamed from do_clean. - (local-distclean): New target, dependency of distclean and - realclean. - (install-info): Don't create directories. Depend on dir.info - rather than calling make recursively. - (install-dir.info): Eliminated. - (install-info-dirs): Create all info directories here. - (dir.info): Depend upon do-install-info. - - * test-build.mk (HOLES): Added false. - -Sat Feb 6 14:05:09 1993 Per Bothner (bothner@rtl.cygnus.com) - - * config.guess: Recognize BSDI and BSDJ (Jolitz 386bsd). - -Thu Feb 4 20:49:18 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * Makefile.in (info): remove dependency on all-texinfo. The - problem was really in texinfo/C, not at this level. - -Thu Feb 4 13:38:41 1993 Ian Lance Taylor (ian@cygnus.com) - - * Makefile.in (info): Added dependency on all-texinfo (PR 2112). - -Thu Feb 4 01:50:53 1993 John Gilmore (gnu@cygnus.com) - - * Makefile.in (make-gdb.tar.Z): Change BISON to 'bison -y' for - GDB releases. - -Wed Feb 3 17:22:16 1993 Ken Raeburn (raeburn@cambridge.cygnus.com) - - * configure: Include srcdir in message about target of link not - being found. Don't convert `-' to `_' in `with' options being - passed to subdirs. - -Tue Feb 2 18:57:59 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * configure.in: add uudecode to host_tools - - * Makefile.in: added {all,install}-uudecode targets, added them to - the appropriate lists - -Tue Feb 2 11:45:53 1993 Ian Lance Taylor (ian@cygnus.com) - - * Makefile.in (all-gcc): Added dependency on all-gas. - - * configure.in (mips-*-*): Build ld and binutils. - -Mon Feb 1 12:35:41 1993 K. Richard Pixley (rich@rtl.cygnus.com) - - * configure: check return code from mkdir, print error message and - exit on failure. - -Sat Jan 30 16:40:28 1993 John Gilmore (gnu@cygnus.com) - - * Makefile.in (make-gdb.tar.Z): New location for texinfo.tex. - -Thu Jan 28 15:09:59 1993 Ian Lance Taylor (ian@cygnus.com) - - * test-build.mk (HOLES): Added tar, cpio and uudecode. - -Wed Jan 27 16:50:32 1993 Jim Wilson (wilson@sphagnum.cygnus.com) - - * config.sub (h8500): Recognize this as a cpu type. - -Sat Jan 23 20:32:01 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * configure: source directory missing is no longer a warning - - * configure.in: recognize irix[34]* instead of irix[34] - - * Makefile.in: define and pass down X11_LIB - - * config/mh-sco: define X11_LIB to the mess that SCO ODT requires - -Sat Jan 23 13:49:40 1993 Per Bothner (bothner@cygnus.com) - - * guess-systype: Renamed to ... - * config.guess: ... by popular request. - * configure.in, Makefile.in: Update accordingly. - -Thu Jan 21 12:20:55 1993 Per Bothner (bothner@cygnus.com) - - * guess-systype: Patches from John Eaton <jwe@che.utexas.edu>: - + Add Convex, Cray/Unicos, and Encore/Multimax support. - + Execute ./dummy instead of assuming . is in PATH. - -Tue Jan 19 17:18:06 1993 Per Bothner (bothner@cygnus.com) - - * guess-systype: New shell script. Attempts to guess the - canonical host name of the executing host. - Only a few hosts are supported so far. - * configure: Call guess-systype if no host is specified. - -Tue Jan 19 08:26:07 1993 Ian Lance Taylor (ian@cygnus.com) - - * Makefile.in (gcc-no-fixedincludes): Made to work with current - gcc Makefile. - - -Fri Jan 15 10:27:02 1993 Ian Lance Taylor (ian@cygnus.com) - - * Makefile.in (GCC_FLAGS_TO_PASS): New variable. - (all-gcc, install-gcc, subdir_do): Use it. - -Wed Jan 13 17:06:45 1993 Jim Wilson (wilson@sphagnum.cygnus.com) - - * Makefile.in: Rename uninstalled gcc driver from gcc to xgcc. - -Wed Jan 6 20:29:16 1993 Mike Werner (mtw@rtl.cygnus.com) - - * Makefile.in: Removed explicit setting of SUBDIRS. SUBDIRS is now - set exclusively by configure, using configure.in . - -Wed Jan 6 13:44:11 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * test-build.mk: set $PATH for all builds - - * Makefile.in: pass TARGET_FLAGS_TO_PASS for xiberty and libm - -Wed Jan 6 11:02:10 1993 Fred Fish (fnf@cygnus.com) - - * Makefile.in (GCC_FOR_TARGET): Supply a default that matches - the one used in gcc/Makefile.in, so that a null expansion doesn't - override the one needed to build gcc with a native cc. - - -Tue Jan 5 07:55:12 1993 Ken Raeburn (raeburn@cambridge.cygnus.com) - - * configure: Accept -with arguments. - -Sun Jan 3 15:15:09 1993 Steve Chamberlain (sac@thepub.cygnus.com) - - * Makefile.in: added h8300sim - -Tue Dec 29 15:06:00 1992 Ian Lance Taylor (ian@cygnus.com) - - * config/mh-sco: Don't override BISON definition. - - * build-all.mk: If canonhost is i386-unknown-sco3.2v4, change it - to i386-sco3.2v4. Set TARGETS and CFLAGS for i386-sco3.2v4. - (all-cygnus, native, build-cygnus): Make - $(canonhost)-stamp-3stage-done, not $(host).... - * test-build.mk (stamp-3stage-compared): Use tail +10c for - i386-sco3.2v4. Added else true to if command. - -Mon Dec 28 12:08:56 1992 Ken Raeburn (raeburn@cygnus.com) - - * config.sub: (from FSF) Sequent uses a BSD-like OS. - -Mon Dec 28 08:32:06 1992 Minh Tran-Le (mtranle@paris.intellicorp.com) - - * configure.in (i[34]86-*-isc*): added; uses mh-sysv. - -Thu Dec 24 17:26:24 1992 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * configure.in: don't remove binutils from Solaris builds - -Thu Dec 24 14:08:38 1992 david d`zoo' zuhn (zoo@cygnus.com) - - * Makefile.in: get rid of earlier definitions for *clean, - also handle the recursive info rule better - -Thu Dec 24 12:40:21 1992 Per Bothner (bothner@rtl.cygnus.com) - - * Makefile.in (mostlyclean, distclean, realclean): Fix to - do more-or-less the right thing. - -Wed Dec 16 10:25:31 1992 Ian Lance Taylor (ian@cygnus.com) - - * Makefile.in: Add lines defining CC and CXX, and use CXX rather - than gcc in definitions of CXX_FOR_BUILD and CXX_FOR_TARGET. - -Tue Dec 15 00:34:32 1992 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * Makefile.in: change all $(host_cpu)-$(host_vendor)-$(host_os) to - $(host_canonical). - - * configure.in: split the configdirs list into 4 categories (native - v. cross, library v. tool) and handle the cross-only and native- - only in more reasonable (and correct!) way. - -Mon Dec 14 17:04:22 1992 Stu Grossman (grossman at cygnus.com) - - * configure.in (hppa*-*-*): Don't remove bfd and gdb from - configdirs anymore. - -Sun Dec 13 00:37:26 1992 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * Makefile.in: extensive cleanup:: removed all of the explicit - clean-* targets, collapsed many wrappers around subdir_do into - one, added additional targets to satisfy standards.texi, deleted - some old targets, some changes for consistency - -Fri Dec 11 20:18:02 1992 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * configure.in: handle some programs as cross-only, and others as - native only - - * test-build.mk: handle partial holes in a more generic manner - - * Makefile.in: m4 depends on libiberty - -Mon Dec 7 06:43:27 1992 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * config/mh-sco: don't default $(CC) to gcc - -Thu Dec 3 21:52:11 1992 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * configure.in: add m4, textutils, fileutils, sed, shellutils, - time, wdiff, and find to configdirs - - * Makefile.in: all, clean, and install rules for the new programs - added to configure.in - -Mon Nov 30 14:54:34 1992 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * configure.in: use mh-sun for all *-sun-* hosts - - * config/mh-solaris: rework standard X location to use - $OPENWINHOME, if defined. - - * config/mh-sun: handle X11 include locations - - * config/mh-decstation: define NeedFunctionPrototypes to 0, to - work around dain-bramaged DECwindows include files - -Fri Nov 27 18:35:54 1992 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * Makefile.in: define flags for X11 include files and library file - locations, pass them down to the programs that need this info - - * build-all.mk: added a 'native' target, to 3stage the native toolchain - - * config/{mh-hpux,mh-solaris}: define the "standard" locations for - the vendor supplied X11 headers and libraries - -Sun Nov 22 18:59:13 1992 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * configure.in: start building libg++ for HP-UX targets - -Wed Nov 18 19:33:11 1992 John Gilmore (gnu@cygnus.com) - - * README: Update references to files moved into etc/. - -Sun Nov 15 09:36:08 1992 Fred Fish (fnf@cygnus.com) - - * config.sub (i386sol2, i486sol2): i[34]86-unknown-solaris2. - * configure.in (i[34]86-*-solaris2*): Use config/mh-sysv4. - -Thu Nov 12 08:50:42 1992 Ian Lance Taylor (ian@cygnus.com) - - * configure: accept dash as well as underscore in long option - names for FSF compatibility. - -Wed Nov 11 08:04:37 1992 Ian Lance Taylor (ian@cygnus.com) - - * config.sub: added -sco3.2v4 support from FSF. - -Sun Nov 8 21:14:30 1992 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * configure.in: expand the section that adds or removes - directories from the list of programs to build, to handle native - vs. cross in addition to host v. native - -Sat Nov 7 18:52:27 1992 Per Bothner (bothner@rtl.cygnus.com) - - * Makefile.in: Replace C++ in macro names with CXX. - This is less likely to break ... - -Sat Nov 7 15:16:58 1992 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * test-build.mk: add -w to GNU_MAKE - -Fri Nov 6 23:10:37 1992 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * config.sub: remove 'sparc'-->'sparc-sun' default transformation, - add 'sparc' to list of recognized cpus. This needed to make - 'sparc-aout' expand to 'sparc-unknown-aout' instead of 'sparc-sun-aout'. - Delete some redundant ose68 variants. Recognize -wrs as an os, - then changes that into $CPU-wrs-vxworks. - - * configure.in: remove most references to gdbtest, regularize - target based program removal - - * test-build.mk: import from p3 tree (many fixes and changes) - -Fri Nov 6 20:59:00 1992 david d `zoo' zuhn (zoo@cygnus.com) - - * Makefile.in: added rules to handle tcl, tk, and expect - - * configure.in: handle those directories if they exist - -Thu Nov 5 14:35:41 1992 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * config.sub: removed bogus hppabsd and hppahpux names, since - "hppa" is not a valid cpu (hppa1.1 or hppa1.0 are, though) - -Thu Oct 29 00:12:41 1992 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * Makefile.in: all-gcc now depends on all-binutils. all-libg++ - depends upon all-xiberty - - * Makefile.in: changes from p3, including: - - Thu Oct 8 15:00:17 1992 Ian Lance Taylor (ian@cygnus.com) - - * Makefile.in (XTRAFLAGS): include newlib directories if - newlib/Makefile exists, rather than if host != target. - - Fri Sep 25 13:41:52 1992 Ian Lance Taylor (ian@cygnus.com) - - * Makefile.in: added -nostdinc to XTRAFLAGS if we are using gcc - from the same source tree and not building a cross-compiler. This - matters for the libg++ configuration if reconfiguring a tree that - has already been installed. - - Thu Sep 10 10:35:51 1992 Ian Lance Taylor (ian@cygnus.com) - - * Makefile.in: added -I for newlib/targ-include to XTRAFLAGS, to - pick up the machine and system specific header files. - - * Makefile.in: added AS_FOR_TARGET, passed down in - TARGET_FLAGS_TO_PASS. Added CC_FOR_BUILD, which is intended to be - the C compiler to use to create programs which are run in the - build environment, set it to default to $(CC), and passed it down - in FLAGS_TO_PASS and TARGET_FLAGS_TO_PASS. - - Mon Sep 7 22:34:42 1992 Ian Lance Taylor (ian@cirdan.cygnus.com) - - * Makefile.in: add $(host) = $(target) tests back to *_FOR_TARGET. - We need them for unusual native builds, like systems without - ranlib. - - * configure: also define $(host_canonical) and - $(target_canonical), which are the full, canonical names for the - given host and target - -Sun Nov 1 16:38:17 1992 Per Bothner (bothner@cygnus.com) - - * Makefile.in: Added separate definitions for C++. - -Fri Oct 30 11:37:52 1992 Fred Fish (fnf@cygnus.com) - - * configure.in (configdirs): Add deja-gnu. - -Fri Oct 23 00:39:18 1992 John Gilmore (gnu@cygnus.com) - - * README: Update for configure.texi and gdb-4.7 release. - -Wed Oct 21 21:54:27 1992 John Gilmore (gnu@cygnus.com) - - * Makefile.in: Move "all" target to top of file. - Previously, first target was ".PHONY" which caused BSD4.4 make - to build .PHONY when make was run without arguments. - -Mon Oct 19 01:17:54 1992 John Gilmore (gnu@cygnus.com) - - * Makefile.in: Add COPYING.LIB to GDB releases, now that there's - Library-copylefted code in libiberty. - -Tue Oct 13 01:22:32 1992 John Gilmore (gnu@cygnus.com) - - * config.sub: Replace m68kmote with plain old m68k. - -Fri Oct 9 03:14:24 1992 John Gilmore (gnu@cygnus.com) - - * Makefile.in: Remove space from blank line, avoid Make complaints. - -Thu Oct 8 18:41:45 1992 Ken Raeburn (raeburn@cygnus.com) - - * config.sub: Complain if no argument is given. Added support for - 386bsd as OS and target alias. - -Thu Oct 8 15:07:22 1992 Ian Lance Taylor (ian@cygnus.com) - - * Makefile.in (XTRAFLAGS): include newlib directories if - newlib/Makefile exists, rather than if host != target. - -Mon Oct 5 03:00:09 1992 Mark Eichin (eichin at tweedledumber.cygnus.com) - - * config.sub: recognize sparclite-wrs-vxworks. - - * Makefile.in (install-xiberty): added *-xiberty make rules (from - p3.) Added clean-xiberty to clean. - -Thu Oct 1 17:59:19 1992 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * configure.in: use *-*-* instead of nested cases for host and target - -Tue Sep 29 14:11:18 1992 Ian Lance Taylor (ian@cygnus.com) - - * Makefile.in: added -nostdinc to XTRAFLAGS if we are using gcc - from the same source tree and not building a cross-compiler. This - matters for the libg++ configuration if reconfiguring a tree that - has already been installed. - -Sep 20 08:53:10 1992 Fred Fish (fnf@cygnus.com) - - * config.sub (i486v/i486v4): Merge in from FSF version. - -Fri Sep 18 00:32:00 1992 Mark Eichin (eichin@cygnus.com) - - * configure: only set PWD if it is already set. - -Thu Sep 17 23:05:53 1992 Mark Eichin (eichin@cygnus.com) - - * configure: just set PWD=`pwd` at the top, since Ultrix sh - doesn't have unset and all success paths (and most error paths) - out set it anyway. (Note: should change all uses of ${PWD=`pwd`} - to just ${PWD} to avoid confusion.) - -Tue Sep 15 16:00:54 1992 Ian Lance Taylor (ian@cygnus.com) - - * configure: always set $(tooldir) to $(libdir)/$(target_alias), - even for a native compilation. - -Tue Sep 15 02:22:56 1992 John Gilmore (gnu@cygnus.com) - - Changes to make the gdb.tar.Z rule work better. - - * Makefile.in (GDB_SUPPORT_DIRS): Add opcodes. - (DEVO_SUPPORT): Add configure.texi. - (bfd-ilrt.tar.Z): Remove ancient rule. - -Thu Sep 10 10:43:19 1992 Ian Lance Taylor (ian@cygnus.com) - - * Makefile.in: added -I for newlib/targ-include to XTRAFLAGS, to - pick up the machine and system specific header files. - - * configure.in, config.sub: added new target m68010-adobe-scout, - with alias of adobe68k. Changed configure.in to check for - -scout before -sco* to avoid a false match. - - * Makefile.in: added AS_FOR_TARGET, passed down in - TARGET_FLAGS_TO_PASS. Added CC_FOR_BUILD, which is intended to be - the C compiler to use to create programs which are run in the - build environment, set it to default to $(CC), and passed it down - in FLAGS_TO_PASS and TARGET_FLAGS_TO_PASS. - -Wed Sep 9 12:21:42 1992 Ian Lance Taylor (ian@cygnus.com) - - * Makefile.in: added TARGET_FLAGS_TO_PASS, CC_FOR_TARGET, - AR_FOR_TARGET, RANLIB_FOR_TARGET, NM_FOR_TARGET. Pass - TARGET_FLAGS_TO_PASS, which defines CC, AR, RANLIB and NM as the - FOR_TARGET variants, to newlib and libg++. - -Tue Sep 8 17:28:30 1992 Ken Raeburn (raeburn@cambridge.cygnus.com) - - * Makefile.in (all-gas, all-gdb): Require all-opcodes to be built - first. - -Wed Sep 2 02:50:05 1992 John Gilmore (gnu@cygnus.com) - - * config.sub: Accept `elf' as an environment. - -Tue Sep 1 15:48:30 1992 Steve Chamberlain (sac@thepub.cygnus.com) - - * Makefile.in (all-opcodes): cd into the right directory - -Sun Aug 30 21:12:11 1992 Ian Lance Taylor (ian@cygnus.com) - - * configure: added -program_transform_name option, used as - argument to sed when installing programs. - configure.texi: added documentation for -program_prefix, - -program_suffix and -program_transform_name. - -Thu Aug 27 21:59:44 1992 John Gilmore (gnu@cygnus.com) - - * config.sub: Accept i486 where i386 ok. - -Thu Aug 27 13:04:42 1992 Brendan Kehoe (brendan@rtl.cygnus.com) - - * config.sub: accept we32k - -Mon Aug 24 14:05:14 1992 Ian Lance Taylor (ian@cygnus.com) - - * config.sub, configure.in: accept OSE68000 and OSE68k. - - * Makefile.in: don't create all directories for ``make install''; - let the subdirectories create the ones they need. - -Tue Aug 11 23:13:17 1992 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * COPYING: new file, GPL v2 - -Tue Aug 4 01:12:43 1992 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * Makefile.in: use the new gen-info-dir, which needs a template - argument (which also lives in texinfo) - - * configure.texi, standards.texi: fix INFO-DIR-ENTRY - -Mon Aug 3 15:41:28 1992 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * config/mh-solaris: removed the -xs from CFLAGS (let the people - with Sun's C compiler deal with it themselved) - -Mon Aug 3 00:34:17 1992 Fred Fish (fnf@cygnus.com) - - * config.sub (ncr3000): Change i386 to i486. - -Thu Jul 23 00:12:17 1992 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * Makefile.in: add install-rcs, install-grep to - install-no-fixedincludes, removed install-bison and install-libgcc - -Tue Jul 21 01:01:50 1992 david d `zoo' zuhn (zoo@cygnus.com) - - * configure.in: grab the HPUX makefile fragment if on HPUX - -Mon Jul 20 11:02:09 1992 D. V. Henkel-Wallace (gumby@cygnus.com) - - * Makefile.in: eradicate bison spoor (ditto libgcc). - configure.in: recognise m68{k,000}-ericsson-OSE. - es1800 is alias for m68k-ericsson-OSE - -Sun Jul 19 17:49:02 1992 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * configure.in: rearrange the parts that remove programs from - configdirs, based now on HOST==TARGET or by canonical triple. - -Fri Jul 17 22:52:49 1992 K. Richard Pixley (rich@rtl.cygnus.com) - - * test-build.mk: recurse explicitly with -f test-build.mk when - appropriate. predicate stage3 and comparison on the existence - of gcc. That is, if gcc isn't around, we aren't three-staging. - On very clean, also remove ...stamp-co. Build in-place before - doing other builds. - -Thu Jul 16 18:33:09 1992 Steve Chamberlain (sac@thepub.cygnus.com) - - * Makefile.in, configure.in: add tgas - -Thu Jul 16 16:05:28 1992 K. Richard Pixley (rich@rtl.cygnus.com) - - * Makefile.in: a number of changes merged in from progressive. - - * configure.in: add libm. - - * .cvsignore: ignore some stuff that comes from test-build.mk. - -Wed Jul 8 00:01:30 1992 Stu Grossman (grossman at cygnus.com) - - * config/mh-solaris: Use -xs when compiling so that Sun-C puts - a symbol-table into the executable. - -Tue Jul 7 00:24:52 1992 Fred Fish (fnf@cygnus.com) - - * config.sub: Add es1800 (m68k-ericsson-es1800). - -Tue Jun 30 20:24:41 1992 D. V. Henkel-Wallace (gumby@cygnus.com) - - * configure: Add program_suffix (parallel to program_prefix) - * Makefile.in: adjust directory-creating script for losing decstation - -Mon Jun 22 23:43:48 1992 Per Bothner (bothner@cygnus.com) - - * configure: Minor $subdir-related fixes. - -Mon Jun 22 18:30:26 1992 Steve Chamberlain (sac@thepub.cygnus.com) - - * configure: fix various problems with propogating - makefile_target_frag in subdirs. - * configure.in: config libgcc if its there - -Fri Jun 19 15:19:40 1992 Stu Grossman (grossman at cygnus.com) - - * config.sub: HPPA merge. - -Mon Jun 15 12:31:52 1992 Fred Fish (fnf@cygnus.com) - - * config/mh-ncr3000 (INSTALL): Don't use /usr/ucb/install, - it is broken on ncr 3000's. - -Sun Jun 14 10:29:19 1992 John Gilmore (gnu at cygnus.com) - - * Makefile.in: Replace all-bison with all-byacc in all - dependency lines for other tools (which now use byacc). - -Fri Jun 12 22:21:57 1992 John Gilmore (gnu at cygnus.com) - - * config.sub: Add sun4sol2 => sparc-sun-solaris2. - -Tue Jun 9 17:18:11 1992 Fred Fish (fnf at cygnus.com) - - * config/{mh-ncr3000, mh-sysv4}: Add INSTALL. - -Thu Jun 4 12:07:32 1992 Mark Eichin (eichin@cygnus.com) - - * Makefile.in: make gprof rules similar to byacc rules (instead of - vestigal $(unsubdir) that didn't work...) - -Thu Jun 4 00:37:05 1992 Per Bothner (bothner@rtl.cygnus.com) - - * config.sub: Add support for Linux. - * Makefile.in: Use $(FLAGS_TO_PASS) more consistently - (at least for libg++). - -Tue Jun 02 20:03:00 1992 david d `zoo' zuhn (zoo@cygnus.com) - - * configure.texi: fix doc for the -nfp option to configure - -Tue Jun 2 17:20:52 1992 Michael Tiemann (tiemann@cygnus.com) - - * Makefile.in (all-binutils): ar needs flex, so depend on all-flex. - -Sun May 31 15:04:08 1992 Mark Eichin (eichin at cygnus.com) - - * config.sub: changed [^-]+ to [^-][^-]* so that it works under - Sun sed. (BSD 4.3 sed doesn't handle [^-]+ either.) - * configure.in: added solaris* host_makefile_frag hook. - -Sun May 31 01:10:34 1992 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * config.sub: changed recognition of m68000 so that various - m68k types can be specified via m680[01234]0 - -Sat May 30 21:01:06 1992 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * config.sub (basic_machine): fix sed so that '-foo' isn't - completely substituted out while .+'-foo' loses the '-foo' - -Wed May 27 23:18:52 1992 Michael Tiemann (tiemann@rtl.cygnus.com) - - * config.sub ($os): Add -aout. - -Fri May 22 14:00:02 1992 Per Bothner (bothner@cygnus.com) - - * configure: If host_makefile_frag is absolute, don't - prefix ${invsubdir} (relevant to libg++ auto-configure). - -Thu May 21 18:00:09 1992 Michael Tiemann (tiemann@rtl.cygnus.com) - - * Makefile.in (tooldir): Define it. - (all-ld): Depend on all-flex. - -Sun May 10 21:45:59 1992 Per Bothner (bothner@rtl.cygnus.com) - - * Makefile.in (check): Fix libg++ special case. - -Fri May 8 08:31:41 1992 K. Richard Pixley (rich@cygnus.com) - - * configure: do not bury `pwd` into config.status, thus do fewer - pwd's. - - * configure: print the "Building in" message only when building in - other than "." AND verbose. - - * configure: remove -s, rework -v to better accomodate guested - configures. - - * standards.texi: updated to 3 may, fixed librid <-> libdir typo. - -Fri May 1 18:00:50 1992 K. Richard Pixley (rich@cygnus.com) - - * Makefile.in: macroize flags passed on recursion. remove - fileutils. - -Thu Apr 30 08:56:20 1992 K. Richard Pixley (rich@cygnus.com) - - * configure: get makesrcdir right for subdirs deeper than 1. - - * Makefile.in: pass INSTALL, INSTALL_DATA, INSTALL_PROGRAM on - install. - -Fri Apr 24 15:51:51 1992 K. Richard Pixley (rich@cygnus.com) - - * Makefile.in: don't print subdir_do or recursion lines. - -Fri Apr 24 15:22:04 1992 K. Richard Pixley (rich@cygnus.com) - - * standards.texi: added menu item. - - * Makefile.in: build and install standards.info. - - * standards.texi: new file. - -Wed Apr 22 18:06:55 1992 K. Richard Pixley (rich@rtl.cygnus.com) - - * configure: test for and move config.status pieces from - ${subdir}/. - -Wed Apr 22 14:38:34 1992 Fred Fish (fnf@cygnus.com) - - * config/mh-delta88, config/mh-ncr3000: Replace MINUS_G with - CFLAGS per new configuration strategy. - * configure: Test for existance of files before trying to mv - them, to avoid numerous non-existance messages. - -Tue Apr 21 12:31:33 1992 K. Richard Pixley (rich@cygnus.com) - - * configure: correct final line of config.status. - - * configure: patch from eggert. Avoids a protection problem if - the original Makefile.in is read only. - - * configure: use move-if-change from gcc to create config.status. - Some makefiles depend on config.status to tell if a directory - has been reconfigured for a different host. This change - prevents those directories from remaking everything in the case - where the reconfig was only intended to rebuild a Makefile. - - * configure: test for config.sub with "config.sub sun4" rather - than "config.sub ${host_alias}". Otherwise we can't tell a bad - host alias from a missing config.sub. - -Mon Apr 20 18:16:36 1992 K. Richard Pixley (rich@rtl.cygnus.com) - - * Makefile.in: explicitly pass CFLAGS on recursion. no longer pass - MINUS_G (this can be done with CFLAGS). Default CFLAGS to -g. - -Fri Apr 17 18:27:51 1992 Per Bothner (bothner@cygnus.com) - - * configure: mkdir ${subdir} as needed. - -Wed Apr 15 17:37:22 1992 K. Richard Pixley (rich@cygnus.com) - - * Makefile.in,configure.in: added autoconf. - -Wed Apr 15 17:27:34 1992 K. Richard Pixley (rich@rtl.cygnus.com) - - * Makefile.in: no longer pass against on recursion. - - * Makefile.in: added .NOEXPORT: so that stray makefile_frag - definitions are not inherited. - - * configure: correct makesrcdir when subdir is . - -Tue Apr 14 11:56:09 1992 Per Bothner (bothner@cygnus.com) - - * configure: Add support for 'subdirs' variable, which is - like 'configdirs', except that configure doesn't re-invoke - itself for subdirs, it just creates a Makefile for each subdir. - * configure.texi: Document subdirs. - -Mon Apr 13 18:50:16 1992 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * configure.in: added flex to configdirs - -Mon Apr 13 18:43:55 1992 K. Richard Pixley (rich@cygnus.com) - - * Makefile.in: remove clean-stamps from clean. - -Sat Apr 11 03:52:03 1992 John Gilmore (gnu at cygnus.com) - - * configure.in: Add gdbtest to configdirs. - -Fri Apr 10 23:11:49 1992 Fred Fish (fnf@cygnus.com) - - * Makefile.in (MINUS_G): Add macro, default to -g, pass on - to recursive makes. - * configure.in: Recognize new ncr3000 config. - -Wed Apr 8 23:08:12 1992 K. Richard Pixley (rich@cygnus.com) - - * Makefile.in, configure.in: removed references to gdbm. - -Tue Apr 7 16:48:20 1992 Per Bothner (bothner@cygnus.com) - - * config.sub: Don't canonicalize os value - newsos* to bsd (readline needs to check for newsos). - (This fix was earlier made Jan 31, but got re-broken.) - -Mon Apr 6 14:34:08 1992 Stu Grossman (grossman at cygnus.com) - - * configure.in: sco is an os, not a vendor! - - * configure: Quote $( better. Keep various shells happy. - -Tue Mar 31 16:32:57 1992 K. Richard Pixley (rich@cygnus.com) - - * Makefile.in: eliminate stamp-files. - -Mon Mar 30 22:20:23 1992 K. Richard Pixley (rich@cygnus.com) - - * Makefile.in: add send_pr. remove "force" from .stmp-gprof rule. - Supress echoing of all the "if [ -d ... $(MAKE)" lines. - -Wed Mar 25 15:20:04 1992 Stu Grossman (grossman@cygnus.com) - - * config.sub: fix iris/iris3. - -Wed Mar 25 10:34:19 1992 K. Richard Pixley (rich@cygnus.com) - - * configure: re-add -rm. - -Tue Mar 24 23:50:16 1992 K. Richard Pixley (rich@cygnus.com) - - * Maskefile.in: add .stmp-rcs to all. - - * configure.in: remove gas from rs6000 build, use aix host fragment. - -Mon Mar 23 19:43:35 1992 K. Richard Pixley (rich@cygnus.com) - - * configure: pass down site_option during recursion. - -Thu Mar 19 16:49:36 1992 Stu Grossman (grossman at cygnus.com) - - * Makefile.in (all.cross): Add .stmp-bfd .stmp-readline. - -Wed Mar 18 15:29:33 1992 Mike Stump (mrs@cygnus.com) - - * configure: Change exec_prefix so that it really defaults to prefix. - -Sat Mar 14 17:20:38 1992 Fred Fish (fnf@cygnus.com) - - * Makefile.in, configure.in: Add support for mmalloc library. - -Fri Mar 13 18:44:18 1992 K. Richard Pixley (rich@cygnus.com) - - * Makefile.in: add stmp dependencies for a few more things. - -Thu Mar 12 04:56:24 1992 K. Richard Pixley (rich@cygnus.com) - - * configure: adjusted error message on objdir/srcdir configure - collision, per john's suggestion. - - * Makefile.in: add libiberty stmp to all and all.cross. - -Wed Mar 11 02:07:52 1992 K. Richard Pixley (rich@cygnus.com) - - * Makefile.in: remove force dependencies, add grep to all. - -Tue Mar 10 21:49:18 1992 K. Richard Pixley (rich@mars.cygnus.com) - - * Makefile.in: drop flex. make stamp files work. - - * configure: added test for conflicting configuration in srcdir, - remove trailing slashes from srcdir. Otherwise emacs gdb mode - gets cranky. use relative paths for configure and srcdir - whenever possible. Send some error messages to stderr that were - going to stdout. - -Tue Mar 10 18:01:55 1992 Per Bothner (bothner@cygnus.com) - - * Makefile.in: Fix libg++ rule to check for gcc directory - before using gcc/gcc. Also pass XTRAFLAGS. - -Thu Mar 5 21:45:07 1992 K. Richard Pixley (rich@sendai) - - * Makefile.in: added stmp-files so that directories aren't polled - when they are already built. - - * configure.texi: fixed a node pointer problem. - -Thu Mar 5 12:05:58 1992 Stu Grossman (grossman at cygnus.com) - - * config.sub configure.in config/mh-irix4 gdb/configure.in - gdb/mips-tdep.c gdb/mipsread.c gdb/procfs.c gdb/signame.h - gdb/tm-irix3.h gdb/tm-mips.h gdb/xm-irix4.h gdb/config/mt-irix3 - gdb/config/mh-irix4 texinfo/configure.in: Port to SGI Irix-4.x. - -Wed Mar 4 02:57:46 1992 K. Richard Pixley (rich@rtl.cygnus.com) - - * configure: -recurring becomes -silent. corrected help message - for -site= option. - - * Makefile.in: mkdir $(exec_prefix) and $(tooldir). - -Tue Mar 3 14:51:21 1992 K. Richard Pixley (rich@rtl.cygnus.com) - - * configure: when building Makefile for crosses, replace - tooldir and program_prefix. default srcdir from location of - config.sub. remove "for host in hosts" and "for target in - targets" loops. - -Wed Feb 26 19:48:25 1992 K. Richard Pixley (rich@rtl.cygnus.com) - - * Makefile.in: Do not pass bindir or mandir to cvs. - -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. - - * configure.texi: remove most references to multiple hosts, - multiple targets, subdirs, etc. - - * configure.man: removed rcsid. reference config.sub not - config.subr. - - * Makefile.in: mkdir $(infodir) on install-info. - -Wed Feb 19 15:41:13 1992 John Gilmore (gnu at cygnus.com) - - * configure.texi: Explain better about .gdbinit and about - the environment that configure.in sections run in. - -Fri Feb 7 07:55:00 1992 John Gilmore (gnu at cygnus.com) - - * configure.in: Ultrix is only a decstation if it's a MIPS. - -Fri Jan 31 21:54:51 1992 John Gilmore (gnu at cygnus.com) - - * README: DOC.configure => cfg-paper.texi. - -Fri Jan 31 21:48:18 1992 Stu Grossman (grossman at cygnus.com) - - * config.sub (near case $os): Don't convert newsos* to bsd! - -Fri Jan 31 02:27:32 1992 John Gilmore (gnu at cygnus.com) - - * Makefile.in: Reinstall change from gdb-4.3 that reduces - the number of copies of COPYING that go into the GDB tar file. - -Thu Jan 30 16:17:30 1992 Stu Grossman (grossman at cygnus.com) - - * bfd/configure.in, config/mh-sco, gdb/config/mh-i386sco, - gdb/config/mt-i386v32, gdb/configure.in, readline/configure.in: - Fix SCO configuration stuff. - -Tue Jan 28 23:51:07 1992 Per Bothner (bothner at cygnus.com) - - * Makefile.in: For libg++, make sure the -I pointing - to the gcc directory goes *after* all the libg++-local -I flags. - Also, move just-gcc dependency from just-libg++ to all-libg++. - -Tue Jan 28 12:56:24 1992 Stu Grossman (grossman at cygnus.com) - - * configure: Change -x to -f to keep Ultrix /bin/test happy. - -Sat Jan 18 17:45:11 1992 Stu Grossman (grossman at cygnus.com) - - * Makefile.in (make-gdb.tar.Z): Remove texinfo targets. - -Sat Jan 18 17:03:21 1992 Fred Fish (fnf at cygnus.com) - - * config.sub: Add stratus configuration frags. Also - submitted to FSF. - -Sat Jan 18 15:35:29 1992 Stu Grossman (grossman at cygnus.com) - - * Makefile.in (DEV_SUPPORT): add configure.man. - - * config.sub(Decode manufacturer-specific): add -none*. - -Fri Jan 17 17:58:05 1992 Stu Grossman (grossman at cygnus.com) - - * Makefile.in: remove form feeds to make Sun's make happy. - (DEVO_SUPPORT): DOC.configure => cfg-paper.texi. - -Sat Jan 4 16:11:44 1992 John Gilmore (gnu at cygnus.com) - - * Makefile.in (AR_FLAGS): Make quieter. - -Thu Jan 2 22:57:12 1992 John Gilmore (gnu at cygnus.com) - - * configure.in: Add libg++. - * configure: When verbose, don't output the command line at each - level; it will be unremarkably the same as the previous version, - which will be the same as what the user typed. - -Fri Dec 27 16:26:47 1991 K. Richard Pixley (rich at cygnus.com) - - * configure.in, Makefile.in: fix clean-info, add flex. add - fileutils. - - * configure: be less sensitive to spaces in Makefile.in. Do not - look for sources in "..". Doing so breaks subdirectories that - might have their own configure. If a subdir has it's own - configure script, use it. - -Thu Dec 26 16:30:26 1991 K. Richard Pixley (rich at cygnus.com) - - * cfg-paper.texi: some changes suggested by rms. - -Thu Dec 26 10:13:36 1991 Fred Fish (fnf at cygnus.com) - - * config.sub: Merge in some small additions from the FSF version, - taken from the gcc distribution, to bring the Cygnus and FSF - versions into closer sync. - -Fri Dec 20 11:34:18 1991 Fred Fish (fnf at cygnus.com) - - * configure.in: Changed svr4 references to sysv4. - -Thu Dec 19 15:54:29 1991 K. Richard Pixley (rich at cygnus.com) - - * configure: added -V for version number option. - -Wed Dec 18 15:39:34 1991 K. Richard Pixley (rich at cygnus.com) - - * DOC.configure, cfg-paper.texi: revised, updated, and texinfo'd. - renamed from DOC.configure to cfg-paper.texi. - -Mon Dec 16 23:05:19 1991 K. Richard Pixley (rich at rtl.cygnus.com) - - * configure, config.subr, config.sub: config.subr is now - config.sub again. - -Fri Dec 13 01:17:06 1991 K. Richard Pixley (rich at cygnus.com) - - * configure.texi: new file, in progress. - - * Makefile.in: build info file and install the man page for - configure. - - * configure.man: new file, first cut. - - * configure: find config.subr again now that configuration "none" - has gone. removed all traces of the -ansi option. removed all - traces of the -languages option. - - * config.subr: resync from rms. - -Wed Dec 11 22:25:20 1991 K. Richard Pixley (rich at rtl.cygnus.com) - - * configure, config.sub, config.subr: merge config.sub into - config.subr, call the result config.subr, remove config.sub, use - config.subr. - - * Makefile.in: revised install for dir.info. - -Tue Dec 10 00:04:35 1991 K. Richard Pixley (rich at rtl.cygnus.com) - - * configure.in: add decstation host makefile frag. - - * Makefile.in: BISON now bison -y again. also install-gcc on - install. clean-gdbm on clean. infodir belongs in datadir. - Make directories for info install. Build dir.info here then - install it. - -Mon Dec 9 16:48:33 1991 K. Richard Pixley (rich at rtl.cygnus.com) - - * Makefile.in: fix for bad directory tests. - -Sat Dec 7 00:17:01 1991 K. Richard Pixley (rich at rtl.cygnus.com) - - * configure: \{1,2\} appears to be a sysv'ism. Use a different - regexp. -srcdir relative was being handled incorrectly. - - * Makefile.in: unwrapped some for loops so that parallel makes - work again and so one can focus one's attention on a particular - package. - -Fri Dec 6 00:22:08 1991 K. Richard Pixley (rich at rtl.cygnus.com) - - * configure: added PWD as a stand in for `pwd` (for speed). use - elif wherever possible. make -srcdir work without -objdir. - -objdir= commented out. - -Thu Dec 5 22:46:52 1991 K. Richard Pixley (rich at rtl.cygnus.com) - - * configure: +options become --options. -subdirs commented out. - added -host, -datadir. Renamed -destdir to -prefix. Comment in - Makefile now at top of generated Makefile. Removed cvs log - entries. added -srcdir. create .gdbinit only if there is one - in ${srcdir}. - - * 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 07:38:11 1991 K. Richard Pixley (rich at rtl.cygnus.com) - - * Freshly created ChangeLog. - - -Local Variables: -mode: change-log -left-margin: 8 -fill-column: 76 -version-control: never -End: diff --git a/contrib/binutils/bfd/VERSION b/contrib/binutils/bfd/VERSION deleted file mode 100644 index dbe590065479..000000000000 --- a/contrib/binutils/bfd/VERSION +++ /dev/null @@ -1 +0,0 @@ -2.8.1 diff --git a/contrib/binutils/bfd/acconfig.h b/contrib/binutils/bfd/acconfig.h deleted file mode 100644 index 1d5e819ec24e..000000000000 --- a/contrib/binutils/bfd/acconfig.h +++ /dev/null @@ -1,34 +0,0 @@ - -/* Name of package. */ -#undef PACKAGE - -/* Version of package. */ -#undef VERSION - -/* Whether strstr must be declared even if <string.h> is included. */ -#undef NEED_DECLARATION_STRSTR - -/* Whether malloc must be declared even if <stdlib.h> is included. */ -#undef NEED_DECLARATION_MALLOC - -/* Whether realloc must be declared even if <stdlib.h> is included. */ -#undef NEED_DECLARATION_REALLOC - -/* Whether free must be declared even if <stdlib.h> is included. */ -#undef NEED_DECLARATION_FREE - -/* Whether getenv must be declared even if <stdlib.h> is included. */ -#undef NEED_DECLARATION_GETENV -@TOP@ - -/* 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 <sys/procfs.h> 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 diff --git a/contrib/binutils/bfd/coff-mips.c b/contrib/binutils/bfd/coff-mips.c deleted file mode 100644 index bb4b15e96c24..000000000000 --- a/contrib/binutils/bfd/coff-mips.c +++ /dev/null @@ -1,2735 +0,0 @@ -/* BFD back-end for MIPS Extended-Coff files. - Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 98, 1999 - 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 "coff/internal.h" -#include "coff/sym.h" -#include "coff/symconst.h" -#include "coff/ecoff.h" -#include "coff/mips.h" -#include "libcoff.h" -#include "libecoff.h" - -/* Prototypes for static functions. */ - -static boolean mips_ecoff_bad_format_hook PARAMS ((bfd *abfd, PTR filehdr)); -static void mips_ecoff_swap_reloc_in PARAMS ((bfd *, PTR, - struct internal_reloc *)); -static void mips_ecoff_swap_reloc_out PARAMS ((bfd *, - const struct internal_reloc *, - PTR)); -static void mips_adjust_reloc_in PARAMS ((bfd *, - const struct internal_reloc *, - arelent *)); -static void mips_adjust_reloc_out PARAMS ((bfd *, const arelent *, - struct internal_reloc *)); -static bfd_reloc_status_type mips_generic_reloc PARAMS ((bfd *abfd, - arelent *reloc, - asymbol *symbol, - PTR data, - asection *section, - bfd *output_bfd, - char **error)); -static bfd_reloc_status_type mips_refhi_reloc PARAMS ((bfd *abfd, - arelent *reloc, - asymbol *symbol, - PTR data, - asection *section, - bfd *output_bfd, - char **error)); -static bfd_reloc_status_type mips_reflo_reloc PARAMS ((bfd *abfd, - arelent *reloc, - asymbol *symbol, - PTR data, - asection *section, - bfd *output_bfd, - char **error)); -static bfd_reloc_status_type mips_gprel_reloc PARAMS ((bfd *abfd, - arelent *reloc, - asymbol *symbol, - PTR data, - asection *section, - bfd *output_bfd, - char **error)); -static bfd_reloc_status_type mips_relhi_reloc PARAMS ((bfd *abfd, - arelent *reloc, - asymbol *symbol, - PTR data, - asection *section, - bfd *output_bfd, - char **error)); -static bfd_reloc_status_type mips_rello_reloc PARAMS ((bfd *abfd, - arelent *reloc, - asymbol *symbol, - PTR data, - asection *section, - bfd *output_bfd, - char **error)); -static bfd_reloc_status_type mips_switch_reloc PARAMS ((bfd *abfd, - arelent *reloc, - asymbol *symbol, - PTR data, - asection *section, - bfd *output_bfd, - char **error)); -static void mips_relocate_hi PARAMS ((struct internal_reloc *refhi, - struct internal_reloc *reflo, - bfd *input_bfd, - asection *input_section, - bfd_byte *contents, - size_t adjust, - bfd_vma relocation, - boolean pcrel)); -static boolean mips_relocate_section PARAMS ((bfd *, struct bfd_link_info *, - bfd *, asection *, - bfd_byte *, PTR)); -static boolean mips_read_relocs PARAMS ((bfd *, asection *)); -static boolean mips_relax_section PARAMS ((bfd *, asection *, - struct bfd_link_info *, - boolean *)); -static boolean mips_relax_pcrel16 PARAMS ((struct bfd_link_info *, bfd *, - asection *, - struct ecoff_link_hash_entry *, - bfd_byte *, bfd_vma)); -static reloc_howto_type *mips_bfd_reloc_type_lookup - PARAMS ((bfd *, bfd_reloc_code_real_type)); - - -/* ECOFF has COFF sections, but the debugging information is stored in - a completely different format. ECOFF targets use some of the - swapping routines from coffswap.h, and some of the generic COFF - routines in coffgen.c, but, unlike the real COFF targets, do not - use coffcode.h itself. - - Get the generic COFF swapping routines, except for the reloc, - symbol, and lineno ones. Give them ECOFF names. */ -#define MIPSECOFF -#define NO_COFF_RELOCS -#define NO_COFF_SYMBOLS -#define NO_COFF_LINENOS -#define coff_swap_filehdr_in mips_ecoff_swap_filehdr_in -#define coff_swap_filehdr_out mips_ecoff_swap_filehdr_out -#define coff_swap_aouthdr_in mips_ecoff_swap_aouthdr_in -#define coff_swap_aouthdr_out mips_ecoff_swap_aouthdr_out -#define coff_swap_scnhdr_in mips_ecoff_swap_scnhdr_in -#define coff_swap_scnhdr_out mips_ecoff_swap_scnhdr_out -#include "coffswap.h" - -/* Get the ECOFF swapping routines. */ -#define ECOFF_32 -#include "ecoffswap.h" - -/* How to process the various relocs types. */ - -static reloc_howto_type mips_howto_table[] = -{ - /* Reloc type 0 is ignored. The reloc reading code ensures that - this is a reference to the .abs section, which will cause - bfd_perform_relocation to do nothing. */ - HOWTO (MIPS_R_IGNORE, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 8, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - 0, /* special_function */ - "IGNORE", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - false), /* pcrel_offset */ - - /* A 16 bit reference to a symbol, normally from a data section. */ - HOWTO (MIPS_R_REFHALF, /* type */ - 0, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - mips_generic_reloc, /* special_function */ - "REFHALF", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* A 32 bit reference to a symbol, normally from a data section. */ - HOWTO (MIPS_R_REFWORD, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - mips_generic_reloc, /* special_function */ - "REFWORD", /* name */ - true, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* A 26 bit absolute jump address. */ - HOWTO (MIPS_R_JMPADDR, /* type */ - 2, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 26, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - /* This needs complex overflow - detection, because the upper four - bits must match the PC. */ - mips_generic_reloc, /* special_function */ - "JMPADDR", /* name */ - true, /* partial_inplace */ - 0x3ffffff, /* src_mask */ - 0x3ffffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* The high 16 bits of a symbol value. Handled by the function - mips_refhi_reloc. */ - HOWTO (MIPS_R_REFHI, /* type */ - 16, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - mips_refhi_reloc, /* special_function */ - "REFHI", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* The low 16 bits of a symbol value. */ - HOWTO (MIPS_R_REFLO, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - mips_reflo_reloc, /* special_function */ - "REFLO", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* A reference to an offset from the gp register. Handled by the - function mips_gprel_reloc. */ - HOWTO (MIPS_R_GPREL, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - mips_gprel_reloc, /* special_function */ - "GPREL", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* A reference to a literal using an offset from the gp register. - Handled by the function mips_gprel_reloc. */ - HOWTO (MIPS_R_LITERAL, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - mips_gprel_reloc, /* special_function */ - "LITERAL", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - EMPTY_HOWTO (8), - EMPTY_HOWTO (9), - EMPTY_HOWTO (10), - EMPTY_HOWTO (11), - - /* This reloc is a Cygnus extension used when generating position - independent code for embedded systems. It represents a 16 bit PC - relative reloc rightshifted twice as used in the MIPS branch - instructions. */ - HOWTO (MIPS_R_PCREL16, /* type */ - 2, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - true, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - mips_generic_reloc, /* special_function */ - "PCREL16", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - true), /* pcrel_offset */ - - /* This reloc is a Cygnus extension used when generating position - independent code for embedded systems. It represents the high 16 - bits of a PC relative reloc. The next reloc must be - MIPS_R_RELLO, and the addend is formed from the addends of the - two instructions, just as in MIPS_R_REFHI and MIPS_R_REFLO. The - final value is actually PC relative to the location of the - MIPS_R_RELLO reloc, not the MIPS_R_RELHI reloc. */ - HOWTO (MIPS_R_RELHI, /* type */ - 16, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - true, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - mips_relhi_reloc, /* special_function */ - "RELHI", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - true), /* pcrel_offset */ - - /* This reloc is a Cygnus extension used when generating position - independent code for embedded systems. It represents the low 16 - bits of a PC relative reloc. */ - HOWTO (MIPS_R_RELLO, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - true, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - mips_rello_reloc, /* special_function */ - "RELLO", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - true), /* pcrel_offset */ - - EMPTY_HOWTO (15), - EMPTY_HOWTO (16), - EMPTY_HOWTO (17), - EMPTY_HOWTO (18), - EMPTY_HOWTO (19), - EMPTY_HOWTO (20), - EMPTY_HOWTO (21), - - /* This reloc is a Cygnus extension used when generating position - independent code for embedded systems. It represents an entry in - a switch table, which is the difference between two symbols in - the .text section. The symndx is actually the offset from the - reloc address to the subtrahend. See include/coff/mips.h for - more details. */ - HOWTO (MIPS_R_SWITCH, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - true, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - mips_switch_reloc, /* special_function */ - "SWITCH", /* name */ - true, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - true) /* pcrel_offset */ -}; - -#define MIPS_HOWTO_COUNT \ - (sizeof mips_howto_table / sizeof mips_howto_table[0]) - -/* When the linker is doing relaxing, it may change a external PCREL16 - reloc. This typically represents an instruction like - bal foo - We change it to - .set noreorder - bal $L1 - lui $at,%hi(foo - $L1) - $L1: - addiu $at,%lo(foo - $L1) - addu $at,$at,$31 - jalr $at - PCREL16_EXPANSION_ADJUSTMENT is the number of bytes this changes the - instruction by. */ - -#define PCREL16_EXPANSION_ADJUSTMENT (4 * 4) - -/* See whether the magic number matches. */ - -static boolean -mips_ecoff_bad_format_hook (abfd, filehdr) - bfd *abfd; - PTR filehdr; -{ - struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr; - - switch (internal_f->f_magic) - { - case MIPS_MAGIC_1: - /* I don't know what endianness this implies. */ - return true; - - case MIPS_MAGIC_BIG: - case MIPS_MAGIC_BIG2: - case MIPS_MAGIC_BIG3: - return bfd_big_endian (abfd); - - case MIPS_MAGIC_LITTLE: - case MIPS_MAGIC_LITTLE2: - case MIPS_MAGIC_LITTLE3: - return bfd_little_endian (abfd); - - default: - return false; - } -} - -/* Reloc handling. MIPS ECOFF relocs are packed into 8 bytes in - external form. They use a bit which indicates whether the symbol - is external. */ - -/* Swap a reloc in. */ - -static void -mips_ecoff_swap_reloc_in (abfd, ext_ptr, intern) - bfd *abfd; - PTR ext_ptr; - struct internal_reloc *intern; -{ - const RELOC *ext = (RELOC *) ext_ptr; - - intern->r_vaddr = bfd_h_get_32 (abfd, (bfd_byte *) ext->r_vaddr); - if (bfd_header_big_endian (abfd)) - { - intern->r_symndx = (((int) ext->r_bits[0] - << RELOC_BITS0_SYMNDX_SH_LEFT_BIG) - | ((int) ext->r_bits[1] - << RELOC_BITS1_SYMNDX_SH_LEFT_BIG) - | ((int) ext->r_bits[2] - << RELOC_BITS2_SYMNDX_SH_LEFT_BIG)); - intern->r_type = ((ext->r_bits[3] & RELOC_BITS3_TYPE_BIG) - >> RELOC_BITS3_TYPE_SH_BIG); - intern->r_extern = (ext->r_bits[3] & RELOC_BITS3_EXTERN_BIG) != 0; - } - else - { - intern->r_symndx = (((int) ext->r_bits[0] - << RELOC_BITS0_SYMNDX_SH_LEFT_LITTLE) - | ((int) ext->r_bits[1] - << RELOC_BITS1_SYMNDX_SH_LEFT_LITTLE) - | ((int) ext->r_bits[2] - << RELOC_BITS2_SYMNDX_SH_LEFT_LITTLE)); - intern->r_type = (((ext->r_bits[3] & RELOC_BITS3_TYPE_LITTLE) - >> RELOC_BITS3_TYPE_SH_LITTLE) - | ((ext->r_bits[3] & RELOC_BITS3_TYPEHI_LITTLE) - << RELOC_BITS3_TYPEHI_SH_LITTLE)); - intern->r_extern = (ext->r_bits[3] & RELOC_BITS3_EXTERN_LITTLE) != 0; - } - - /* If this is a MIPS_R_SWITCH reloc, or an internal MIPS_R_RELHI or - MIPS_R_RELLO reloc, r_symndx is actually the offset from the - reloc address to the base of the difference (see - include/coff/mips.h for more details). We copy symndx into the - r_offset field so as not to confuse ecoff_slurp_reloc_table in - ecoff.c. In adjust_reloc_in we then copy r_offset into the reloc - addend. */ - if (intern->r_type == MIPS_R_SWITCH - || (! intern->r_extern - && (intern->r_type == MIPS_R_RELLO - || intern->r_type == MIPS_R_RELHI))) - { - BFD_ASSERT (! intern->r_extern); - intern->r_offset = intern->r_symndx; - if (intern->r_offset & 0x800000) - intern->r_offset -= 0x1000000; - intern->r_symndx = RELOC_SECTION_TEXT; - } -} - -/* Swap a reloc out. */ - -static void -mips_ecoff_swap_reloc_out (abfd, intern, dst) - bfd *abfd; - const struct internal_reloc *intern; - PTR dst; -{ - RELOC *ext = (RELOC *) dst; - long r_symndx; - - BFD_ASSERT (intern->r_extern - || (intern->r_symndx >= 0 && intern->r_symndx <= 12)); - - /* If this is a MIPS_R_SWITCH reloc, or an internal MIPS_R_RELLO or - MIPS_R_RELHI reloc, we actually want to write the contents of - r_offset out as the symbol index. This undoes the change made by - mips_ecoff_swap_reloc_in. */ - if (intern->r_type != MIPS_R_SWITCH - && (intern->r_extern - || (intern->r_type != MIPS_R_RELHI - && intern->r_type != MIPS_R_RELLO))) - r_symndx = intern->r_symndx; - else - { - BFD_ASSERT (intern->r_symndx == RELOC_SECTION_TEXT); - r_symndx = intern->r_offset & 0xffffff; - } - - bfd_h_put_32 (abfd, intern->r_vaddr, (bfd_byte *) ext->r_vaddr); - if (bfd_header_big_endian (abfd)) - { - ext->r_bits[0] = r_symndx >> RELOC_BITS0_SYMNDX_SH_LEFT_BIG; - ext->r_bits[1] = r_symndx >> RELOC_BITS1_SYMNDX_SH_LEFT_BIG; - ext->r_bits[2] = r_symndx >> RELOC_BITS2_SYMNDX_SH_LEFT_BIG; - ext->r_bits[3] = (((intern->r_type << RELOC_BITS3_TYPE_SH_BIG) - & RELOC_BITS3_TYPE_BIG) - | (intern->r_extern ? RELOC_BITS3_EXTERN_BIG : 0)); - } - else - { - ext->r_bits[0] = r_symndx >> RELOC_BITS0_SYMNDX_SH_LEFT_LITTLE; - ext->r_bits[1] = r_symndx >> RELOC_BITS1_SYMNDX_SH_LEFT_LITTLE; - ext->r_bits[2] = r_symndx >> RELOC_BITS2_SYMNDX_SH_LEFT_LITTLE; - ext->r_bits[3] = (((intern->r_type << RELOC_BITS3_TYPE_SH_LITTLE) - & RELOC_BITS3_TYPE_LITTLE) - | ((intern->r_type >> RELOC_BITS3_TYPEHI_SH_LITTLE - & RELOC_BITS3_TYPEHI_LITTLE)) - | (intern->r_extern ? RELOC_BITS3_EXTERN_LITTLE : 0)); - } -} - -/* Finish canonicalizing a reloc. Part of this is generic to all - ECOFF targets, and that part is in ecoff.c. The rest is done in - this backend routine. It must fill in the howto field. */ - -static void -mips_adjust_reloc_in (abfd, intern, rptr) - bfd *abfd; - const struct internal_reloc *intern; - arelent *rptr; -{ - if (intern->r_type > MIPS_R_SWITCH) - abort (); - - if (! intern->r_extern - && (intern->r_type == MIPS_R_GPREL - || intern->r_type == MIPS_R_LITERAL)) - rptr->addend += ecoff_data (abfd)->gp; - - /* If the type is MIPS_R_IGNORE, make sure this is a reference to - the absolute section so that the reloc is ignored. */ - if (intern->r_type == MIPS_R_IGNORE) - rptr->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; - - /* If this is a MIPS_R_SWITCH reloc, or an internal MIPS_R_RELHI or - MIPS_R_RELLO reloc, we want the addend field of the BFD relocto - hold the value which was originally in the symndx field of the - internal MIPS ECOFF reloc. This value was copied into - intern->r_offset by mips_swap_reloc_in, and here we copy it into - the addend field. */ - if (intern->r_type == MIPS_R_SWITCH - || (! intern->r_extern - && (intern->r_type == MIPS_R_RELHI - || intern->r_type == MIPS_R_RELLO))) - rptr->addend = intern->r_offset; - - rptr->howto = &mips_howto_table[intern->r_type]; -} - -/* Make any adjustments needed to a reloc before writing it out. None - are needed for MIPS. */ - -static void -mips_adjust_reloc_out (abfd, rel, intern) - bfd *abfd ATTRIBUTE_UNUSED; - const arelent *rel; - struct internal_reloc *intern; -{ - /* For a MIPS_R_SWITCH reloc, or an internal MIPS_R_RELHI or - MIPS_R_RELLO reloc, we must copy rel->addend into - intern->r_offset. This will then be written out as the symbol - index by mips_ecoff_swap_reloc_out. This operation parallels the - action of mips_adjust_reloc_in. */ - if (intern->r_type == MIPS_R_SWITCH - || (! intern->r_extern - && (intern->r_type == MIPS_R_RELHI - || intern->r_type == MIPS_R_RELLO))) - intern->r_offset = rel->addend; -} - -/* ECOFF relocs are either against external symbols, or against - sections. If we are producing relocateable output, and the reloc - is against an external symbol, and nothing has given us any - additional addend, the resulting reloc will also be against the - same symbol. In such a case, we don't want to change anything - about the way the reloc is handled, since it will all be done at - final link time. Rather than put special case code into - bfd_perform_relocation, all the reloc types use this howto - function. It just short circuits the reloc if producing - relocateable output against an external symbol. */ - -static bfd_reloc_status_type -mips_generic_reloc (abfd, - reloc_entry, - symbol, - data, - input_section, - output_bfd, - error_message) - bfd *abfd ATTRIBUTE_UNUSED; - arelent *reloc_entry; - asymbol *symbol; - PTR data ATTRIBUTE_UNUSED; - asection *input_section; - bfd *output_bfd; - char **error_message ATTRIBUTE_UNUSED; -{ - if (output_bfd != (bfd *) NULL - && (symbol->flags & BSF_SECTION_SYM) == 0 - && reloc_entry->addend == 0) - { - reloc_entry->address += input_section->output_offset; - return bfd_reloc_ok; - } - - return bfd_reloc_continue; -} - -/* Do a REFHI relocation. This has to be done in combination with a - REFLO reloc, because there is a carry from the REFLO to the REFHI. - Here we just save the information we need; we do the actual - relocation when we see the REFLO. MIPS ECOFF requires that the - REFLO immediately follow the REFHI. As a GNU extension, we permit - an arbitrary number of HI relocs to be associated with a single LO - reloc. This extension permits gcc to output the HI and LO relocs - itself. */ - -struct mips_hi -{ - struct mips_hi *next; - bfd_byte *addr; - bfd_vma addend; -}; - -/* FIXME: This should not be a static variable. */ - -static struct mips_hi *mips_refhi_list; - -static bfd_reloc_status_type -mips_refhi_reloc (abfd, - reloc_entry, - symbol, - data, - input_section, - output_bfd, - error_message) - bfd *abfd ATTRIBUTE_UNUSED; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message ATTRIBUTE_UNUSED; -{ - bfd_reloc_status_type ret; - bfd_vma relocation; - struct mips_hi *n; - - /* If we're relocating, and this an external symbol, we don't want - to change anything. */ - if (output_bfd != (bfd *) NULL - && (symbol->flags & BSF_SECTION_SYM) == 0 - && reloc_entry->addend == 0) - { - reloc_entry->address += input_section->output_offset; - return bfd_reloc_ok; - } - - ret = bfd_reloc_ok; - if (bfd_is_und_section (symbol->section) - && output_bfd == (bfd *) NULL) - ret = bfd_reloc_undefined; - - if (bfd_is_com_section (symbol->section)) - relocation = 0; - else - relocation = symbol->value; - - relocation += symbol->section->output_section->vma; - relocation += symbol->section->output_offset; - relocation += reloc_entry->addend; - - if (reloc_entry->address > input_section->_cooked_size) - return bfd_reloc_outofrange; - - /* Save the information, and let REFLO do the actual relocation. */ - n = (struct mips_hi *) bfd_malloc (sizeof *n); - if (n == NULL) - return bfd_reloc_outofrange; - n->addr = (bfd_byte *) data + reloc_entry->address; - n->addend = relocation; - n->next = mips_refhi_list; - mips_refhi_list = n; - - if (output_bfd != (bfd *) NULL) - reloc_entry->address += input_section->output_offset; - - return ret; -} - -/* Do a REFLO relocation. This is a straightforward 16 bit inplace - relocation; this function exists in order to do the REFHI - relocation described above. */ - -static bfd_reloc_status_type -mips_reflo_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 (mips_refhi_list != NULL) - { - struct mips_hi *l; - - l = mips_refhi_list; - while (l != NULL) - { - unsigned long insn; - unsigned long val; - unsigned long vallo; - struct mips_hi *next; - - /* Do the REFHI relocation. Note that we actually don't - need to know anything about the REFLO itself, except - where to find the low 16 bits of the addend needed by the - REFHI. */ - insn = bfd_get_32 (abfd, l->addr); - vallo = (bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address) - & 0xffff); - val = ((insn & 0xffff) << 16) + vallo; - val += l->addend; - - /* The low order 16 bits are always treated as a signed - value. Therefore, a negative value in the low order bits - requires an adjustment in the high order bits. We need - to make this adjustment in two ways: once for the bits we - took from the data, and once for the bits we are putting - back in to the data. */ - if ((vallo & 0x8000) != 0) - val -= 0x10000; - if ((val & 0x8000) != 0) - val += 0x10000; - - insn = (insn &~ 0xffff) | ((val >> 16) & 0xffff); - bfd_put_32 (abfd, insn, l->addr); - - next = l->next; - free (l); - l = next; - } - - mips_refhi_list = NULL; - } - - /* Now do the REFLO reloc in the usual way. */ - return mips_generic_reloc (abfd, reloc_entry, symbol, data, - input_section, output_bfd, error_message); -} - -/* Do a GPREL relocation. This is a 16 bit value which must become - the offset from the gp register. */ - -static bfd_reloc_status_type -mips_gprel_reloc (abfd, - reloc_entry, - symbol, - data, - input_section, - output_bfd, - error_message) - bfd *abfd; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message; -{ - boolean relocateable; - bfd_vma gp; - bfd_vma relocation; - unsigned long val; - unsigned long insn; - - /* If we're relocating, and this is an external symbol with no - addend, we don't want to change anything. We will only have an - addend if this is a newly created reloc, not read from an ECOFF - file. */ - if (output_bfd != (bfd *) NULL - && (symbol->flags & BSF_SECTION_SYM) == 0 - && reloc_entry->addend == 0) - { - reloc_entry->address += input_section->output_offset; - return bfd_reloc_ok; - } - - if (output_bfd != (bfd *) NULL) - relocateable = true; - else - { - relocateable = false; - output_bfd = symbol->section->output_section->owner; - } - - if (bfd_is_und_section (symbol->section) - && relocateable == false) - return bfd_reloc_undefined; - - /* We have to figure out the gp value, so that we can adjust the - symbol value correctly. We look up the symbol _gp in the output - BFD. If we can't find it, we're stuck. We cache it in the ECOFF - target data. We don't need to adjust the symbol value for an - external symbol if we are producing relocateable output. */ - gp = _bfd_get_gp_value (output_bfd); - if (gp == 0 - && (relocateable == false - || (symbol->flags & BSF_SECTION_SYM) != 0)) - { - if (relocateable != false) - { - /* Make up a value. */ - gp = symbol->section->output_section->vma + 0x4000; - _bfd_set_gp_value (output_bfd, gp); - } - else - { - unsigned int count; - asymbol **sym; - unsigned int i; - - count = bfd_get_symcount (output_bfd); - sym = bfd_get_outsymbols (output_bfd); - - if (sym == (asymbol **) NULL) - i = count; - else - { - for (i = 0; i < count; i++, sym++) - { - register CONST char *name; - - name = bfd_asymbol_name (*sym); - if (*name == '_' && strcmp (name, "_gp") == 0) - { - gp = bfd_asymbol_value (*sym); - _bfd_set_gp_value (output_bfd, gp); - break; - } - } - } - - if (i >= count) - { - /* Only get the error once. */ - gp = 4; - _bfd_set_gp_value (output_bfd, gp); - *error_message = - (char *) _("GP relative relocation when _gp not defined"); - return bfd_reloc_dangerous; - } - } - } - - if (bfd_is_com_section (symbol->section)) - relocation = 0; - else - relocation = symbol->value; - - relocation += symbol->section->output_section->vma; - relocation += symbol->section->output_offset; - - if (reloc_entry->address > input_section->_cooked_size) - return bfd_reloc_outofrange; - - insn = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address); - - /* Set val to the offset into the section or symbol. */ - val = ((insn & 0xffff) + reloc_entry->addend) & 0xffff; - if (val & 0x8000) - val -= 0x10000; - - /* Adjust val for the final section location and GP value. If we - are producing relocateable output, we don't want to do this for - an external symbol. */ - if (relocateable == false - || (symbol->flags & BSF_SECTION_SYM) != 0) - val += relocation - gp; - - insn = (insn &~ 0xffff) | (val & 0xffff); - bfd_put_32 (abfd, insn, (bfd_byte *) data + reloc_entry->address); - - if (relocateable != false) - reloc_entry->address += input_section->output_offset; - - /* Make sure it fit in 16 bits. */ - if (val >= 0x8000 && val < 0xffff8000) - return bfd_reloc_overflow; - - return bfd_reloc_ok; -} - -/* Do a RELHI relocation. We do this in conjunction with a RELLO - reloc, just as REFHI and REFLO are done together. RELHI and RELLO - are Cygnus extensions used when generating position independent - code for embedded systems. */ - -/* FIXME: This should not be a static variable. */ - -static struct mips_hi *mips_relhi_list; - -static bfd_reloc_status_type -mips_relhi_reloc (abfd, - reloc_entry, - symbol, - data, - input_section, - output_bfd, - error_message) - bfd *abfd ATTRIBUTE_UNUSED; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message ATTRIBUTE_UNUSED; -{ - bfd_reloc_status_type ret; - bfd_vma relocation; - struct mips_hi *n; - - /* If this is a reloc against a section symbol, then it is correct - in the object file. The only time we want to change this case is - when we are relaxing, and that is handled entirely by - mips_relocate_section and never calls this function. */ - if ((symbol->flags & BSF_SECTION_SYM) != 0) - { - if (output_bfd != (bfd *) NULL) - reloc_entry->address += input_section->output_offset; - return bfd_reloc_ok; - } - - /* This is an external symbol. If we're relocating, we don't want - to change anything. */ - if (output_bfd != (bfd *) NULL) - { - reloc_entry->address += input_section->output_offset; - return bfd_reloc_ok; - } - - ret = bfd_reloc_ok; - if (bfd_is_und_section (symbol->section) - && output_bfd == (bfd *) NULL) - ret = bfd_reloc_undefined; - - if (bfd_is_com_section (symbol->section)) - relocation = 0; - else - relocation = symbol->value; - - relocation += symbol->section->output_section->vma; - relocation += symbol->section->output_offset; - relocation += reloc_entry->addend; - - if (reloc_entry->address > input_section->_cooked_size) - return bfd_reloc_outofrange; - - /* Save the information, and let RELLO do the actual relocation. */ - n = (struct mips_hi *) bfd_malloc (sizeof *n); - if (n == NULL) - return bfd_reloc_outofrange; - n->addr = (bfd_byte *) data + reloc_entry->address; - n->addend = relocation; - n->next = mips_relhi_list; - mips_relhi_list = n; - - if (output_bfd != (bfd *) NULL) - reloc_entry->address += input_section->output_offset; - - return ret; -} - -/* Do a RELLO relocation. This is a straightforward 16 bit PC - relative relocation; this function exists in order to do the RELHI - relocation described above. */ - -static bfd_reloc_status_type -mips_rello_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 (mips_relhi_list != NULL) - { - struct mips_hi *l; - - l = mips_relhi_list; - while (l != NULL) - { - unsigned long insn; - unsigned long val; - unsigned long vallo; - struct mips_hi *next; - - /* Do the RELHI relocation. Note that we actually don't - need to know anything about the RELLO itself, except - where to find the low 16 bits of the addend needed by the - RELHI. */ - insn = bfd_get_32 (abfd, l->addr); - vallo = (bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address) - & 0xffff); - val = ((insn & 0xffff) << 16) + vallo; - val += l->addend; - - /* If the symbol is defined, make val PC relative. If the - symbol is not defined we don't want to do this, because - we don't want the value in the object file to incorporate - the address of the reloc. */ - if (! bfd_is_und_section (bfd_get_section (symbol)) - && ! bfd_is_com_section (bfd_get_section (symbol))) - val -= (input_section->output_section->vma - + input_section->output_offset - + reloc_entry->address); - - /* The low order 16 bits are always treated as a signed - value. Therefore, a negative value in the low order bits - requires an adjustment in the high order bits. We need - to make this adjustment in two ways: once for the bits we - took from the data, and once for the bits we are putting - back in to the data. */ - if ((vallo & 0x8000) != 0) - val -= 0x10000; - if ((val & 0x8000) != 0) - val += 0x10000; - - insn = (insn &~ 0xffff) | ((val >> 16) & 0xffff); - bfd_put_32 (abfd, insn, l->addr); - - next = l->next; - free (l); - l = next; - } - - mips_relhi_list = NULL; - } - - /* If this is a reloc against a section symbol, then it is correct - in the object file. The only time we want to change this case is - when we are relaxing, and that is handled entirely by - mips_relocate_section and never calls this function. */ - if ((symbol->flags & BSF_SECTION_SYM) != 0) - { - if (output_bfd != (bfd *) NULL) - reloc_entry->address += input_section->output_offset; - return bfd_reloc_ok; - } - - /* bfd_perform_relocation does not handle pcrel_offset relocations - correctly when generating a relocateable file, so handle them - directly here. */ - if (output_bfd != (bfd *) NULL) - { - reloc_entry->address += input_section->output_offset; - return bfd_reloc_ok; - } - - /* Now do the RELLO reloc in the usual way. */ - return mips_generic_reloc (abfd, reloc_entry, symbol, data, - input_section, output_bfd, error_message); -} - -/* This is the special function for the MIPS_R_SWITCH reloc. This - special reloc is normally correct in the object file, and only - requires special handling when relaxing. We don't want - bfd_perform_relocation to tamper with it at all. */ - -/*ARGSUSED*/ -static bfd_reloc_status_type -mips_switch_reloc (abfd, - reloc_entry, - symbol, - data, - input_section, - output_bfd, - error_message) - bfd *abfd ATTRIBUTE_UNUSED; - arelent *reloc_entry ATTRIBUTE_UNUSED; - asymbol *symbol ATTRIBUTE_UNUSED; - PTR data ATTRIBUTE_UNUSED; - asection *input_section ATTRIBUTE_UNUSED; - bfd *output_bfd ATTRIBUTE_UNUSED; - char **error_message ATTRIBUTE_UNUSED; -{ - return bfd_reloc_ok; -} - -/* Get the howto structure for a generic reloc type. */ - -static reloc_howto_type * -mips_bfd_reloc_type_lookup (abfd, code) - bfd *abfd ATTRIBUTE_UNUSED; - bfd_reloc_code_real_type code; -{ - int mips_type; - - switch (code) - { - case BFD_RELOC_16: - mips_type = MIPS_R_REFHALF; - break; - case BFD_RELOC_32: - case BFD_RELOC_CTOR: - mips_type = MIPS_R_REFWORD; - break; - case BFD_RELOC_MIPS_JMP: - mips_type = MIPS_R_JMPADDR; - break; - case BFD_RELOC_HI16_S: - mips_type = MIPS_R_REFHI; - break; - case BFD_RELOC_LO16: - mips_type = MIPS_R_REFLO; - break; - case BFD_RELOC_MIPS_GPREL: - mips_type = MIPS_R_GPREL; - break; - case BFD_RELOC_MIPS_LITERAL: - mips_type = MIPS_R_LITERAL; - break; - case BFD_RELOC_16_PCREL_S2: - mips_type = MIPS_R_PCREL16; - break; - case BFD_RELOC_PCREL_HI16_S: - mips_type = MIPS_R_RELHI; - break; - case BFD_RELOC_PCREL_LO16: - mips_type = MIPS_R_RELLO; - break; - case BFD_RELOC_GPREL32: - mips_type = MIPS_R_SWITCH; - break; - default: - return (reloc_howto_type *) NULL; - } - - return &mips_howto_table[mips_type]; -} - -/* A helper routine for mips_relocate_section which handles the REFHI - and RELHI relocations. The REFHI relocation must be followed by a - REFLO relocation (and RELHI by a RELLO), and the addend used is - formed from the addends of both instructions. */ - -static void -mips_relocate_hi (refhi, reflo, input_bfd, input_section, contents, adjust, - relocation, pcrel) - struct internal_reloc *refhi; - struct internal_reloc *reflo; - bfd *input_bfd; - asection *input_section; - bfd_byte *contents; - size_t adjust; - bfd_vma relocation; - boolean pcrel; -{ - unsigned long insn; - unsigned long val; - unsigned long vallo; - - if (refhi == NULL) - return; - - insn = bfd_get_32 (input_bfd, - contents + adjust + refhi->r_vaddr - input_section->vma); - if (reflo == NULL) - vallo = 0; - else - vallo = (bfd_get_32 (input_bfd, - contents + adjust + reflo->r_vaddr - input_section->vma) - & 0xffff); - - val = ((insn & 0xffff) << 16) + vallo; - val += relocation; - - /* The low order 16 bits are always treated as a signed value. - Therefore, a negative value in the low order bits requires an - adjustment in the high order bits. We need to make this - adjustment in two ways: once for the bits we took from the data, - and once for the bits we are putting back in to the data. */ - if ((vallo & 0x8000) != 0) - val -= 0x10000; - - if (pcrel) - val -= (input_section->output_section->vma - + input_section->output_offset - + (reflo->r_vaddr - input_section->vma + adjust)); - - if ((val & 0x8000) != 0) - val += 0x10000; - - insn = (insn &~ 0xffff) | ((val >> 16) & 0xffff); - bfd_put_32 (input_bfd, (bfd_vma) insn, - contents + adjust + refhi->r_vaddr - input_section->vma); -} - -/* Relocate a section while linking a MIPS ECOFF file. */ - -static boolean -mips_relocate_section (output_bfd, info, input_bfd, input_section, - contents, external_relocs) - bfd *output_bfd; - struct bfd_link_info *info; - bfd *input_bfd; - asection *input_section; - bfd_byte *contents; - PTR external_relocs; -{ - asection **symndx_to_section; - struct ecoff_link_hash_entry **sym_hashes; - bfd_vma gp; - boolean gp_undefined; - size_t adjust; - long *offsets; - struct external_reloc *ext_rel; - struct external_reloc *ext_rel_end; - unsigned int i; - boolean got_lo; - struct internal_reloc lo_int_rel; - - BFD_ASSERT (input_bfd->xvec->byteorder - == output_bfd->xvec->byteorder); - - /* We keep a table mapping the symndx found in an internal reloc to - the appropriate section. This is faster than looking up the - section by name each time. */ - symndx_to_section = ecoff_data (input_bfd)->symndx_to_section; - if (symndx_to_section == (asection **) NULL) - { - symndx_to_section = ((asection **) - bfd_alloc (input_bfd, - (NUM_RELOC_SECTIONS - * sizeof (asection *)))); - if (!symndx_to_section) - return false; - - symndx_to_section[RELOC_SECTION_NONE] = NULL; - symndx_to_section[RELOC_SECTION_TEXT] = - bfd_get_section_by_name (input_bfd, ".text"); - symndx_to_section[RELOC_SECTION_RDATA] = - bfd_get_section_by_name (input_bfd, ".rdata"); - symndx_to_section[RELOC_SECTION_DATA] = - bfd_get_section_by_name (input_bfd, ".data"); - symndx_to_section[RELOC_SECTION_SDATA] = - bfd_get_section_by_name (input_bfd, ".sdata"); - symndx_to_section[RELOC_SECTION_SBSS] = - bfd_get_section_by_name (input_bfd, ".sbss"); - symndx_to_section[RELOC_SECTION_BSS] = - bfd_get_section_by_name (input_bfd, ".bss"); - symndx_to_section[RELOC_SECTION_INIT] = - bfd_get_section_by_name (input_bfd, ".init"); - symndx_to_section[RELOC_SECTION_LIT8] = - bfd_get_section_by_name (input_bfd, ".lit8"); - symndx_to_section[RELOC_SECTION_LIT4] = - bfd_get_section_by_name (input_bfd, ".lit4"); - symndx_to_section[RELOC_SECTION_XDATA] = NULL; - symndx_to_section[RELOC_SECTION_PDATA] = NULL; - symndx_to_section[RELOC_SECTION_FINI] = - bfd_get_section_by_name (input_bfd, ".fini"); - symndx_to_section[RELOC_SECTION_LITA] = NULL; - symndx_to_section[RELOC_SECTION_ABS] = NULL; - - ecoff_data (input_bfd)->symndx_to_section = symndx_to_section; - } - - sym_hashes = ecoff_data (input_bfd)->sym_hashes; - - gp = _bfd_get_gp_value (output_bfd); - if (gp == 0) - gp_undefined = true; - else - gp_undefined = false; - - got_lo = false; - - adjust = 0; - - if (ecoff_section_data (input_bfd, input_section) == NULL) - offsets = NULL; - else - offsets = ecoff_section_data (input_bfd, input_section)->offsets; - - ext_rel = (struct external_reloc *) external_relocs; - ext_rel_end = ext_rel + input_section->reloc_count; - for (i = 0; ext_rel < ext_rel_end; ext_rel++, i++) - { - struct internal_reloc int_rel; - boolean use_lo = false; - bfd_vma addend; - reloc_howto_type *howto; - struct ecoff_link_hash_entry *h = NULL; - asection *s = NULL; - bfd_vma relocation; - bfd_reloc_status_type r; - - if (! got_lo) - mips_ecoff_swap_reloc_in (input_bfd, (PTR) ext_rel, &int_rel); - else - { - int_rel = lo_int_rel; - got_lo = false; - } - - BFD_ASSERT (int_rel.r_type - < sizeof mips_howto_table / sizeof mips_howto_table[0]); - - /* The REFHI and RELHI relocs requires special handling. they - must be followed by a REFLO or RELLO reloc, respectively, and - the addend is formed from both relocs. */ - if (int_rel.r_type == MIPS_R_REFHI - || int_rel.r_type == MIPS_R_RELHI) - { - struct external_reloc *lo_ext_rel; - - /* As a GNU extension, permit an arbitrary number of REFHI - or RELHI relocs before the REFLO or RELLO reloc. This - permits gcc to emit the HI and LO relocs itself. */ - for (lo_ext_rel = ext_rel + 1; - lo_ext_rel < ext_rel_end; - lo_ext_rel++) - { - mips_ecoff_swap_reloc_in (input_bfd, (PTR) lo_ext_rel, - &lo_int_rel); - if (lo_int_rel.r_type != int_rel.r_type) - break; - } - - if (lo_ext_rel < ext_rel_end - && (lo_int_rel.r_type - == (int_rel.r_type == MIPS_R_REFHI - ? MIPS_R_REFLO - : MIPS_R_RELLO)) - && int_rel.r_extern == lo_int_rel.r_extern - && int_rel.r_symndx == lo_int_rel.r_symndx) - { - use_lo = true; - if (lo_ext_rel == ext_rel + 1) - got_lo = true; - } - } - - howto = &mips_howto_table[int_rel.r_type]; - - /* The SWITCH reloc must be handled specially. This reloc is - marks the location of a difference between two portions of an - object file. The symbol index does not reference a symbol, - but is actually the offset from the reloc to the subtrahend - of the difference. This reloc is correct in the object file, - and needs no further adjustment, unless we are relaxing. If - we are relaxing, we may have to add in an offset. Since no - symbols are involved in this reloc, we handle it completely - here. */ - if (int_rel.r_type == MIPS_R_SWITCH) - { - if (offsets != NULL - && offsets[i] != 0) - { - r = _bfd_relocate_contents (howto, input_bfd, - (bfd_vma) offsets[i], - (contents - + adjust - + int_rel.r_vaddr - - input_section->vma)); - BFD_ASSERT (r == bfd_reloc_ok); - } - - continue; - } - - if (int_rel.r_extern) - { - h = sym_hashes[int_rel.r_symndx]; - /* If h is NULL, that means that there is a reloc against an - external symbol which we thought was just a debugging - symbol. This should not happen. */ - if (h == (struct ecoff_link_hash_entry *) NULL) - abort (); - } - else - { - if (int_rel.r_symndx < 0 || int_rel.r_symndx >= NUM_RELOC_SECTIONS) - s = NULL; - else - s = symndx_to_section[int_rel.r_symndx]; - - if (s == (asection *) NULL) - abort (); - } - - /* The GPREL reloc uses an addend: the difference in the GP - values. */ - if (int_rel.r_type != MIPS_R_GPREL - && int_rel.r_type != MIPS_R_LITERAL) - addend = 0; - else - { - if (gp_undefined) - { - if (! ((*info->callbacks->reloc_dangerous) - (info, _("GP relative relocation when GP not defined"), - input_bfd, input_section, - int_rel.r_vaddr - input_section->vma))) - return false; - /* Only give the error once per link. */ - gp = 4; - _bfd_set_gp_value (output_bfd, gp); - gp_undefined = false; - } - if (! int_rel.r_extern) - { - /* This is a relocation against a section. The current - addend in the instruction is the difference between - INPUT_SECTION->vma and the GP value of INPUT_BFD. We - must change this to be the difference between the - final definition (which will end up in RELOCATION) - and the GP value of OUTPUT_BFD (which is in GP). */ - addend = ecoff_data (input_bfd)->gp - gp; - } - else if (! info->relocateable - || h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak) - { - /* This is a relocation against a defined symbol. The - current addend in the instruction is simply the - desired offset into the symbol (normally zero). We - are going to change this into a relocation against a - defined symbol, so we want the instruction to hold - the difference between the final definition of the - symbol (which will end up in RELOCATION) and the GP - value of OUTPUT_BFD (which is in GP). */ - addend = - gp; - } - else - { - /* This is a relocation against an undefined or common - symbol. The current addend in the instruction is - simply the desired offset into the symbol (normally - zero). We are generating relocateable output, and we - aren't going to define this symbol, so we just leave - the instruction alone. */ - addend = 0; - } - } - - /* If we are relaxing, mips_relax_section may have set - offsets[i] to some value. A value of 1 means we must expand - a PC relative branch into a multi-instruction of sequence, - and any other value is an addend. */ - if (offsets != NULL - && offsets[i] != 0) - { - BFD_ASSERT (! info->relocateable); - BFD_ASSERT (int_rel.r_type == MIPS_R_PCREL16 - || int_rel.r_type == MIPS_R_RELHI - || int_rel.r_type == MIPS_R_RELLO); - if (offsets[i] != 1) - addend += offsets[i]; - else - { - bfd_byte *here; - - BFD_ASSERT (int_rel.r_extern - && int_rel.r_type == MIPS_R_PCREL16); - - /* Move the rest of the instructions up. */ - here = (contents - + adjust - + int_rel.r_vaddr - - input_section->vma); - memmove (here + PCREL16_EXPANSION_ADJUSTMENT, here, - (size_t) (input_section->_raw_size - - (int_rel.r_vaddr - input_section->vma))); - - /* Generate the new instructions. */ - if (! mips_relax_pcrel16 (info, input_bfd, input_section, - h, here, - (input_section->output_section->vma - + input_section->output_offset - + (int_rel.r_vaddr - - input_section->vma) - + adjust))) - return false; - - /* We must adjust everything else up a notch. */ - adjust += PCREL16_EXPANSION_ADJUSTMENT; - - /* mips_relax_pcrel16 handles all the details of this - relocation. */ - continue; - } - } - - /* If we are relaxing, and this is a reloc against the .text - segment, we may need to adjust it if some branches have been - expanded. The reloc types which are likely to occur in the - .text section are handled efficiently by mips_relax_section, - and thus do not need to be handled here. */ - if (ecoff_data (input_bfd)->debug_info.adjust != NULL - && ! int_rel.r_extern - && int_rel.r_symndx == RELOC_SECTION_TEXT - && (strcmp (bfd_get_section_name (input_bfd, input_section), - ".text") != 0 - || (int_rel.r_type != MIPS_R_PCREL16 - && int_rel.r_type != MIPS_R_SWITCH - && int_rel.r_type != MIPS_R_RELHI - && int_rel.r_type != MIPS_R_RELLO))) - { - bfd_vma adr; - struct ecoff_value_adjust *a; - - /* We need to get the addend so that we know whether we need - to adjust the address. */ - BFD_ASSERT (int_rel.r_type == MIPS_R_REFWORD); - - adr = bfd_get_32 (input_bfd, - (contents - + adjust - + int_rel.r_vaddr - - input_section->vma)); - - for (a = ecoff_data (input_bfd)->debug_info.adjust; - a != (struct ecoff_value_adjust *) NULL; - a = a->next) - { - if (adr >= a->start && adr < a->end) - addend += a->adjust; - } - } - - if (info->relocateable) - { - /* We are generating relocateable output, and must convert - the existing reloc. */ - if (int_rel.r_extern) - { - if ((h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak) - && ! bfd_is_abs_section (h->root.u.def.section)) - { - const char *name; - - /* This symbol is defined in the output. Convert - the reloc from being against the symbol to being - against the section. */ - - /* Clear the r_extern bit. */ - int_rel.r_extern = 0; - - /* Compute a new r_symndx value. */ - s = h->root.u.def.section; - name = bfd_get_section_name (output_bfd, - s->output_section); - - int_rel.r_symndx = -1; - switch (name[1]) - { - case 'b': - if (strcmp (name, ".bss") == 0) - int_rel.r_symndx = RELOC_SECTION_BSS; - break; - case 'd': - if (strcmp (name, ".data") == 0) - int_rel.r_symndx = RELOC_SECTION_DATA; - break; - case 'f': - if (strcmp (name, ".fini") == 0) - int_rel.r_symndx = RELOC_SECTION_FINI; - break; - case 'i': - if (strcmp (name, ".init") == 0) - int_rel.r_symndx = RELOC_SECTION_INIT; - break; - case 'l': - if (strcmp (name, ".lit8") == 0) - int_rel.r_symndx = RELOC_SECTION_LIT8; - else if (strcmp (name, ".lit4") == 0) - int_rel.r_symndx = RELOC_SECTION_LIT4; - break; - case 'r': - if (strcmp (name, ".rdata") == 0) - int_rel.r_symndx = RELOC_SECTION_RDATA; - break; - case 's': - if (strcmp (name, ".sdata") == 0) - int_rel.r_symndx = RELOC_SECTION_SDATA; - else if (strcmp (name, ".sbss") == 0) - int_rel.r_symndx = RELOC_SECTION_SBSS; - break; - case 't': - if (strcmp (name, ".text") == 0) - int_rel.r_symndx = RELOC_SECTION_TEXT; - break; - } - - if (int_rel.r_symndx == -1) - abort (); - - /* Add the section VMA and the symbol value. */ - relocation = (h->root.u.def.value - + s->output_section->vma - + s->output_offset); - - /* For a PC relative relocation, the object file - currently holds just the addend. We must adjust - by the address to get the right value. */ - if (howto->pc_relative) - { - relocation -= int_rel.r_vaddr - input_section->vma; - - /* If we are converting a RELHI or RELLO reloc - from being against an external symbol to - being against a section, we must put a - special value into the r_offset field. This - value is the old addend. The r_offset for - both the RELHI and RELLO relocs are the same, - and we set both when we see RELHI. */ - if (int_rel.r_type == MIPS_R_RELHI) - { - long addhi, addlo; - - addhi = bfd_get_32 (input_bfd, - (contents - + adjust - + int_rel.r_vaddr - - input_section->vma)); - addhi &= 0xffff; - if (addhi & 0x8000) - addhi -= 0x10000; - addhi <<= 16; - - if (! use_lo) - addlo = 0; - else - { - addlo = bfd_get_32 (input_bfd, - (contents - + adjust - + lo_int_rel.r_vaddr - - input_section->vma)); - addlo &= 0xffff; - if (addlo & 0x8000) - addlo -= 0x10000; - - lo_int_rel.r_offset = addhi + addlo; - } - - int_rel.r_offset = addhi + addlo; - } - } - - h = NULL; - } - else - { - /* Change the symndx value to the right one for the - output BFD. */ - int_rel.r_symndx = h->indx; - if (int_rel.r_symndx == -1) - { - /* This symbol is not being written out. */ - if (! ((*info->callbacks->unattached_reloc) - (info, h->root.root.string, input_bfd, - input_section, - int_rel.r_vaddr - input_section->vma))) - return false; - int_rel.r_symndx = 0; - } - relocation = 0; - } - } - else - { - /* This is a relocation against a section. Adjust the - value by the amount the section moved. */ - relocation = (s->output_section->vma - + s->output_offset - - s->vma); - } - - relocation += addend; - addend = 0; - - /* Adjust a PC relative relocation by removing the reference - to the original address in the section and including the - reference to the new address. However, external RELHI - and RELLO relocs are PC relative, but don't include any - reference to the address. The addend is merely an - addend. */ - if (howto->pc_relative - && (! int_rel.r_extern - || (int_rel.r_type != MIPS_R_RELHI - && int_rel.r_type != MIPS_R_RELLO))) - relocation -= (input_section->output_section->vma - + input_section->output_offset - - input_section->vma); - - /* Adjust the contents. */ - if (relocation == 0) - r = bfd_reloc_ok; - else - { - if (int_rel.r_type != MIPS_R_REFHI - && int_rel.r_type != MIPS_R_RELHI) - r = _bfd_relocate_contents (howto, input_bfd, relocation, - (contents - + adjust - + int_rel.r_vaddr - - input_section->vma)); - else - { - mips_relocate_hi (&int_rel, - use_lo ? &lo_int_rel : NULL, - input_bfd, input_section, contents, - adjust, relocation, - int_rel.r_type == MIPS_R_RELHI); - r = bfd_reloc_ok; - } - } - - /* Adjust the reloc address. */ - int_rel.r_vaddr += (input_section->output_section->vma - + input_section->output_offset - - input_section->vma); - - /* Save the changed reloc information. */ - mips_ecoff_swap_reloc_out (input_bfd, &int_rel, (PTR) ext_rel); - } - else - { - /* We are producing a final executable. */ - if (int_rel.r_extern) - { - /* This is a reloc against a symbol. */ - if (h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak) - { - asection *hsec; - - hsec = h->root.u.def.section; - relocation = (h->root.u.def.value - + hsec->output_section->vma - + hsec->output_offset); - } - else - { - if (! ((*info->callbacks->undefined_symbol) - (info, h->root.root.string, input_bfd, - input_section, - int_rel.r_vaddr - input_section->vma, true))) - return false; - relocation = 0; - } - } - else - { - /* This is a reloc against a section. */ - relocation = (s->output_section->vma - + s->output_offset - - s->vma); - - /* A PC relative reloc is already correct in the object - file. Make it look like a pcrel_offset relocation by - adding in the start address. */ - if (howto->pc_relative) - { - if (int_rel.r_type != MIPS_R_RELHI || ! use_lo) - relocation += int_rel.r_vaddr + adjust; - else - relocation += lo_int_rel.r_vaddr + adjust; - } - } - - if (int_rel.r_type != MIPS_R_REFHI - && int_rel.r_type != MIPS_R_RELHI) - r = _bfd_final_link_relocate (howto, - input_bfd, - input_section, - contents, - (int_rel.r_vaddr - - input_section->vma - + adjust), - relocation, - addend); - else - { - mips_relocate_hi (&int_rel, - use_lo ? &lo_int_rel : NULL, - input_bfd, input_section, contents, adjust, - relocation, - int_rel.r_type == MIPS_R_RELHI); - r = bfd_reloc_ok; - } - } - - /* MIPS_R_JMPADDR requires peculiar overflow detection. The - instruction provides a 28 bit address (the two lower bits are - implicit zeroes) which is combined with the upper four bits - of the instruction address. */ - if (r == bfd_reloc_ok - && int_rel.r_type == MIPS_R_JMPADDR - && (((relocation - + addend - + (int_rel.r_extern ? 0 : s->vma)) - & 0xf0000000) - != ((input_section->output_section->vma - + input_section->output_offset - + (int_rel.r_vaddr - input_section->vma) - + adjust) - & 0xf0000000))) - r = bfd_reloc_overflow; - - if (r != bfd_reloc_ok) - { - switch (r) - { - default: - case bfd_reloc_outofrange: - abort (); - case bfd_reloc_overflow: - { - const char *name; - - if (int_rel.r_extern) - name = h->root.root.string; - else - name = bfd_section_name (input_bfd, s); - if (! ((*info->callbacks->reloc_overflow) - (info, name, howto->name, (bfd_vma) 0, - input_bfd, input_section, - int_rel.r_vaddr - input_section->vma))) - return false; - } - break; - } - } - } - - return true; -} - -/* Read in the relocs for a section. */ - -static boolean -mips_read_relocs (abfd, sec) - bfd *abfd; - asection *sec; -{ - struct ecoff_section_tdata *section_tdata; - - section_tdata = ecoff_section_data (abfd, sec); - if (section_tdata == (struct ecoff_section_tdata *) NULL) - { - sec->used_by_bfd = - (PTR) bfd_alloc (abfd, sizeof (struct ecoff_section_tdata)); - if (sec->used_by_bfd == NULL) - return false; - - section_tdata = ecoff_section_data (abfd, sec); - section_tdata->external_relocs = NULL; - section_tdata->contents = NULL; - section_tdata->offsets = NULL; - } - - if (section_tdata->external_relocs == NULL) - { - bfd_size_type external_relocs_size; - - external_relocs_size = (ecoff_backend (abfd)->external_reloc_size - * sec->reloc_count); - - section_tdata->external_relocs = - (PTR) bfd_alloc (abfd, external_relocs_size); - if (section_tdata->external_relocs == NULL && external_relocs_size != 0) - return false; - - if (bfd_seek (abfd, sec->rel_filepos, SEEK_SET) != 0 - || (bfd_read (section_tdata->external_relocs, 1, - external_relocs_size, abfd) - != external_relocs_size)) - return false; - } - - return true; -} - -/* Relax a section when linking a MIPS ECOFF file. This is used for - embedded PIC code, which always uses PC relative branches which - only have an 18 bit range on MIPS. If a branch is not in range, we - generate a long instruction sequence to compensate. Each time we - find a branch to expand, we have to check all the others again to - make sure they are still in range. This is slow, but it only has - to be done when -relax is passed to the linker. - - This routine figures out which branches need to expand; the actual - expansion is done in mips_relocate_section when the section - contents are relocated. The information is stored in the offsets - field of the ecoff_section_tdata structure. An offset of 1 means - that the branch must be expanded into a multi-instruction PC - relative branch (such an offset will only occur for a PC relative - branch to an external symbol). Any other offset must be a multiple - of four, and is the amount to change the branch by (such an offset - will only occur for a PC relative branch within the same section). - - We do not modify the section relocs or contents themselves so that - if memory usage becomes an issue we can discard them and read them - again. The only information we must save in memory between this - routine and the mips_relocate_section routine is the table of - offsets. */ - -static boolean -mips_relax_section (abfd, sec, info, again) - bfd *abfd; - asection *sec; - struct bfd_link_info *info; - boolean *again; -{ - struct ecoff_section_tdata *section_tdata; - bfd_byte *contents = NULL; - long *offsets; - struct external_reloc *ext_rel; - struct external_reloc *ext_rel_end; - unsigned int i; - - /* Assume we are not going to need another pass. */ - *again = false; - - /* If we are not generating an ECOFF file, this is much too - confusing to deal with. */ - if (info->hash->creator->flavour != bfd_get_flavour (abfd)) - return true; - - /* If there are no relocs, there is nothing to do. */ - if (sec->reloc_count == 0) - return true; - - /* We are only interested in PC relative relocs, and why would there - ever be one from anything but the .text section? */ - if (strcmp (bfd_get_section_name (abfd, sec), ".text") != 0) - return true; - - /* Read in the relocs, if we haven't already got them. */ - section_tdata = ecoff_section_data (abfd, sec); - if (section_tdata == (struct ecoff_section_tdata *) NULL - || section_tdata->external_relocs == NULL) - { - if (! mips_read_relocs (abfd, sec)) - goto error_return; - section_tdata = ecoff_section_data (abfd, sec); - } - - if (sec->_cooked_size == 0) - { - /* We must initialize _cooked_size only the first time we are - called. */ - sec->_cooked_size = sec->_raw_size; - } - - contents = section_tdata->contents; - offsets = section_tdata->offsets; - - /* Look for any external PC relative relocs. Internal PC relative - relocs are already correct in the object file, so they certainly - can not overflow. */ - ext_rel = (struct external_reloc *) section_tdata->external_relocs; - ext_rel_end = ext_rel + sec->reloc_count; - for (i = 0; ext_rel < ext_rel_end; ext_rel++, i++) - { - struct internal_reloc int_rel; - struct ecoff_link_hash_entry *h; - asection *hsec; - bfd_signed_vma relocation; - struct external_reloc *adj_ext_rel; - unsigned int adj_i; - unsigned long ext_count; - struct ecoff_link_hash_entry **adj_h_ptr; - struct ecoff_link_hash_entry **adj_h_ptr_end; - struct ecoff_value_adjust *adjust; - - /* If we have already expanded this reloc, we certainly don't - need to do it again. */ - if (offsets != (long *) NULL && offsets[i] == 1) - continue; - - /* Quickly check that this reloc is external PCREL16. */ - if (bfd_header_big_endian (abfd)) - { - if ((ext_rel->r_bits[3] & RELOC_BITS3_EXTERN_BIG) == 0 - || (((ext_rel->r_bits[3] & RELOC_BITS3_TYPE_BIG) - >> RELOC_BITS3_TYPE_SH_BIG) - != MIPS_R_PCREL16)) - continue; - } - else - { - if ((ext_rel->r_bits[3] & RELOC_BITS3_EXTERN_LITTLE) == 0 - || (((ext_rel->r_bits[3] & RELOC_BITS3_TYPE_LITTLE) - >> RELOC_BITS3_TYPE_SH_LITTLE) - != MIPS_R_PCREL16)) - continue; - } - - mips_ecoff_swap_reloc_in (abfd, (PTR) ext_rel, &int_rel); - - h = ecoff_data (abfd)->sym_hashes[int_rel.r_symndx]; - if (h == (struct ecoff_link_hash_entry *) NULL) - abort (); - - if (h->root.type != bfd_link_hash_defined - && h->root.type != bfd_link_hash_defweak) - { - /* Just ignore undefined symbols. These will presumably - generate an error later in the link. */ - continue; - } - - /* Get the value of the symbol. */ - hsec = h->root.u.def.section; - relocation = (h->root.u.def.value - + hsec->output_section->vma - + hsec->output_offset); - - /* Subtract out the current address. */ - relocation -= (sec->output_section->vma - + sec->output_offset - + (int_rel.r_vaddr - sec->vma)); - - /* The addend is stored in the object file. In the normal case - of ``bal symbol'', the addend will be -4. It will only be - different in the case of ``bal symbol+constant''. To avoid - always reading in the section contents, we don't check the - addend in the object file (we could easily check the contents - if we happen to have already read them in, but I fear that - this could be confusing). This means we will screw up if - there is a branch to a symbol that is in range, but added to - a constant which puts it out of range; in such a case the - link will fail with a reloc overflow error. Since the - compiler will never generate such code, it should be easy - enough to work around it by changing the assembly code in the - source file. */ - relocation -= 4; - - /* Now RELOCATION is the number we want to put in the object - file. See whether it fits. */ - if (relocation >= -0x20000 && relocation < 0x20000) - continue; - - /* Now that we know this reloc needs work, which will rarely - happen, go ahead and grab the section contents. */ - if (contents == (bfd_byte *) NULL) - { - if (info->keep_memory) - contents = (bfd_byte *) bfd_alloc (abfd, sec->_raw_size); - else - contents = (bfd_byte *) bfd_malloc ((size_t) sec->_raw_size); - if (contents == (bfd_byte *) NULL) - goto error_return; - if (! bfd_get_section_contents (abfd, sec, (PTR) contents, - (file_ptr) 0, sec->_raw_size)) - goto error_return; - if (info->keep_memory) - section_tdata->contents = contents; - } - - /* We only support changing the bal instruction. It would be - possible to handle other PC relative branches, but some of - them (the conditional branches) would require a different - length instruction sequence which would complicate both this - routine and mips_relax_pcrel16. It could be written if - somebody felt it were important. Ignoring this reloc will - presumably cause a reloc overflow error later on. */ - if (bfd_get_32 (abfd, contents + int_rel.r_vaddr - sec->vma) - != 0x0411ffff) /* bgezal $0,. == bal . */ - continue; - - /* Bother. We need to expand this reloc, and we will need to - make another relaxation pass since this change may put other - relocs out of range. We need to examine the local branches - and we need to allocate memory to hold the offsets we must - add to them. We also need to adjust the values of all - symbols in the object file following this location. */ - - sec->_cooked_size += PCREL16_EXPANSION_ADJUSTMENT; - *again = true; - - if (offsets == (long *) NULL) - { - size_t size; - - size = sec->reloc_count * sizeof (long); - offsets = (long *) bfd_alloc (abfd, size); - if (offsets == (long *) NULL) - goto error_return; - memset (offsets, 0, size); - section_tdata->offsets = offsets; - } - - offsets[i] = 1; - - /* Now look for all PC relative references that cross this reloc - and adjust their offsets. */ - adj_ext_rel = (struct external_reloc *) section_tdata->external_relocs; - for (adj_i = 0; adj_ext_rel < ext_rel_end; adj_ext_rel++, adj_i++) - { - struct internal_reloc adj_int_rel; - bfd_vma start, stop; - int change; - - mips_ecoff_swap_reloc_in (abfd, (PTR) adj_ext_rel, &adj_int_rel); - - if (adj_int_rel.r_type == MIPS_R_PCREL16) - { - unsigned long insn; - - /* We only care about local references. External ones - will be relocated correctly anyhow. */ - if (adj_int_rel.r_extern) - continue; - - /* We are only interested in a PC relative reloc within - this section. FIXME: Cross section PC relative - relocs may not be handled correctly; does anybody - care? */ - if (adj_int_rel.r_symndx != RELOC_SECTION_TEXT) - continue; - - start = adj_int_rel.r_vaddr; - - insn = bfd_get_32 (abfd, - contents + adj_int_rel.r_vaddr - sec->vma); - - stop = (insn & 0xffff) << 2; - if ((stop & 0x20000) != 0) - stop -= 0x40000; - stop += adj_int_rel.r_vaddr + 4; - } - else if (adj_int_rel.r_type == MIPS_R_RELHI) - { - struct internal_reloc rello; - long addhi, addlo; - - /* The next reloc must be MIPS_R_RELLO, and we handle - them together. */ - BFD_ASSERT (adj_ext_rel + 1 < ext_rel_end); - - mips_ecoff_swap_reloc_in (abfd, (PTR) (adj_ext_rel + 1), &rello); - - BFD_ASSERT (rello.r_type == MIPS_R_RELLO); - - addhi = bfd_get_32 (abfd, - contents + adj_int_rel.r_vaddr - sec->vma); - addhi &= 0xffff; - if (addhi & 0x8000) - addhi -= 0x10000; - addhi <<= 16; - - addlo = bfd_get_32 (abfd, contents + rello.r_vaddr - sec->vma); - addlo &= 0xffff; - if (addlo & 0x8000) - addlo -= 0x10000; - - if (adj_int_rel.r_extern) - { - /* The value we want here is - sym - RELLOaddr + addend - which we can express as - sym - (RELLOaddr - addend) - Therefore if we are expanding the area between - RELLOaddr and RELLOaddr - addend we must adjust - the addend. This is admittedly ambiguous, since - we might mean (sym + addend) - RELLOaddr, but in - practice we don't, and there is no way to handle - that case correctly since at this point we have - no idea whether any reloc is being expanded - between sym and sym + addend. */ - start = rello.r_vaddr - (addhi + addlo); - stop = rello.r_vaddr; - } - else - { - /* An internal RELHI/RELLO pair represents the - difference between two addresses, $LC0 - foo. - The symndx value is actually the difference - between the reloc address and $LC0. This lets us - compute $LC0, and, by considering the addend, - foo. If the reloc we are expanding falls between - those two relocs, we must adjust the addend. At - this point, the symndx value is actually in the - r_offset field, where it was put by - mips_ecoff_swap_reloc_in. */ - start = rello.r_vaddr - adj_int_rel.r_offset; - stop = start + addhi + addlo; - } - } - else if (adj_int_rel.r_type == MIPS_R_SWITCH) - { - /* A MIPS_R_SWITCH reloc represents a word of the form - .word $L3-$LS12 - The value in the object file is correct, assuming the - original value of $L3. The symndx value is actually - the difference between the reloc address and $LS12. - This lets us compute the original value of $LS12 as - vaddr - symndx - and the original value of $L3 as - vaddr - symndx + addend - where addend is the value from the object file. At - this point, the symndx value is actually found in the - r_offset field, since it was moved by - mips_ecoff_swap_reloc_in. */ - start = adj_int_rel.r_vaddr - adj_int_rel.r_offset; - stop = start + bfd_get_32 (abfd, - (contents - + adj_int_rel.r_vaddr - - sec->vma)); - } - else - continue; - - /* If the range expressed by this reloc, which is the - distance between START and STOP crosses the reloc we are - expanding, we must adjust the offset. The sign of the - adjustment depends upon the direction in which the range - crosses the reloc being expanded. */ - if (start <= int_rel.r_vaddr && stop > int_rel.r_vaddr) - change = PCREL16_EXPANSION_ADJUSTMENT; - else if (start > int_rel.r_vaddr && stop <= int_rel.r_vaddr) - change = - PCREL16_EXPANSION_ADJUSTMENT; - else - change = 0; - - offsets[adj_i] += change; - - if (adj_int_rel.r_type == MIPS_R_RELHI) - { - adj_ext_rel++; - adj_i++; - offsets[adj_i] += change; - } - } - - /* Find all symbols in this section defined by this object file - and adjust their values. Note that we decide whether to - adjust the value based on the value stored in the ECOFF EXTR - structure, because the value stored in the hash table may - have been changed by an earlier expanded reloc and thus may - no longer correctly indicate whether the symbol is before or - after the expanded reloc. */ - ext_count = ecoff_data (abfd)->debug_info.symbolic_header.iextMax; - adj_h_ptr = ecoff_data (abfd)->sym_hashes; - adj_h_ptr_end = adj_h_ptr + ext_count; - for (; adj_h_ptr < adj_h_ptr_end; adj_h_ptr++) - { - struct ecoff_link_hash_entry *adj_h; - - adj_h = *adj_h_ptr; - if (adj_h != (struct ecoff_link_hash_entry *) NULL - && (adj_h->root.type == bfd_link_hash_defined - || adj_h->root.type == bfd_link_hash_defweak) - && adj_h->root.u.def.section == sec - && adj_h->esym.asym.value > int_rel.r_vaddr) - adj_h->root.u.def.value += PCREL16_EXPANSION_ADJUSTMENT; - } - - /* Add an entry to the symbol value adjust list. This is used - by bfd_ecoff_debug_accumulate to adjust the values of - internal symbols and FDR's. */ - adjust = ((struct ecoff_value_adjust *) - bfd_alloc (abfd, sizeof (struct ecoff_value_adjust))); - if (adjust == (struct ecoff_value_adjust *) NULL) - goto error_return; - - adjust->start = int_rel.r_vaddr; - adjust->end = sec->vma + sec->_raw_size; - adjust->adjust = PCREL16_EXPANSION_ADJUSTMENT; - - adjust->next = ecoff_data (abfd)->debug_info.adjust; - ecoff_data (abfd)->debug_info.adjust = adjust; - } - - if (contents != (bfd_byte *) NULL && ! info->keep_memory) - free (contents); - - return true; - - error_return: - if (contents != (bfd_byte *) NULL && ! info->keep_memory) - free (contents); - return false; -} - -/* This routine is called from mips_relocate_section when a PC - relative reloc must be expanded into the five instruction sequence. - It handles all the details of the expansion, including resolving - the reloc. */ - -static boolean -mips_relax_pcrel16 (info, input_bfd, input_section, h, location, address) - struct bfd_link_info *info ATTRIBUTE_UNUSED; - bfd *input_bfd; - asection *input_section ATTRIBUTE_UNUSED; - struct ecoff_link_hash_entry *h; - bfd_byte *location; - bfd_vma address; -{ - bfd_vma relocation; - - /* 0x0411ffff is bgezal $0,. == bal . */ - BFD_ASSERT (bfd_get_32 (input_bfd, location) == 0x0411ffff); - - /* We need to compute the distance between the symbol and the - current address plus eight. */ - relocation = (h->root.u.def.value - + h->root.u.def.section->output_section->vma - + h->root.u.def.section->output_offset); - relocation -= address + 8; - - /* If the lower half is negative, increment the upper 16 half. */ - if ((relocation & 0x8000) != 0) - relocation += 0x10000; - - bfd_put_32 (input_bfd, 0x04110001, location); /* bal .+8 */ - bfd_put_32 (input_bfd, - 0x3c010000 | ((relocation >> 16) & 0xffff), /* lui $at,XX */ - location + 4); - bfd_put_32 (input_bfd, - 0x24210000 | (relocation & 0xffff), /* addiu $at,$at,XX */ - location + 8); - bfd_put_32 (input_bfd, 0x003f0821, location + 12); /* addu $at,$at,$ra */ - bfd_put_32 (input_bfd, 0x0020f809, location + 16); /* jalr $at */ - - return true; -} - -/* Given a .sdata section and a .rel.sdata in-memory section, store - relocation information into the .rel.sdata section which can be - used at runtime to relocate the section. This is called by the - linker when the --embedded-relocs switch is used. This is called - after the add_symbols entry point has been called for all the - objects, and before the final_link entry point is called. This - function presumes that the object was compiled using - -membedded-pic. */ - -boolean -bfd_mips_ecoff_create_embedded_relocs (abfd, info, datasec, relsec, errmsg) - bfd *abfd; - struct bfd_link_info *info; - asection *datasec; - asection *relsec; - char **errmsg; -{ - struct ecoff_link_hash_entry **sym_hashes; - struct ecoff_section_tdata *section_tdata; - struct external_reloc *ext_rel; - struct external_reloc *ext_rel_end; - bfd_byte *p; - - BFD_ASSERT (! info->relocateable); - - *errmsg = NULL; - - if (datasec->reloc_count == 0) - return true; - - sym_hashes = ecoff_data (abfd)->sym_hashes; - - if (! mips_read_relocs (abfd, datasec)) - return false; - - relsec->contents = (bfd_byte *) bfd_alloc (abfd, datasec->reloc_count * 4); - if (relsec->contents == NULL) - return false; - - p = relsec->contents; - - section_tdata = ecoff_section_data (abfd, datasec); - ext_rel = (struct external_reloc *) section_tdata->external_relocs; - ext_rel_end = ext_rel + datasec->reloc_count; - for (; ext_rel < ext_rel_end; ext_rel++, p += 4) - { - struct internal_reloc int_rel; - boolean text_relative; - - mips_ecoff_swap_reloc_in (abfd, (PTR) ext_rel, &int_rel); - - /* We are going to write a four byte word into the runtime reloc - section. The word will be the address in the data section - which must be relocated. This must be on a word boundary, - which means the lower two bits must be zero. We use the - least significant bit to indicate how the value in the data - section must be relocated. A 0 means that the value is - relative to the text section, while a 1 indicates that the - value is relative to the data section. Given that we are - assuming the code was compiled using -membedded-pic, there - should not be any other possibilities. */ - - /* We can only relocate REFWORD relocs at run time. */ - if (int_rel.r_type != MIPS_R_REFWORD) - { - *errmsg = _("unsupported reloc type"); - bfd_set_error (bfd_error_bad_value); - return false; - } - - if (int_rel.r_extern) - { - struct ecoff_link_hash_entry *h; - - h = sym_hashes[int_rel.r_symndx]; - /* If h is NULL, that means that there is a reloc against an - external symbol which we thought was just a debugging - symbol. This should not happen. */ - if (h == (struct ecoff_link_hash_entry *) NULL) - abort (); - if ((h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak) - && (h->root.u.def.section->flags & SEC_CODE) != 0) - text_relative = true; - else - text_relative = false; - } - else - { - switch (int_rel.r_symndx) - { - case RELOC_SECTION_TEXT: - text_relative = true; - break; - case RELOC_SECTION_SDATA: - case RELOC_SECTION_SBSS: - case RELOC_SECTION_LIT8: - text_relative = false; - break; - default: - /* No other sections should appear in -membedded-pic - code. */ - *errmsg = _("reloc against unsupported section"); - bfd_set_error (bfd_error_bad_value); - return false; - } - } - - if ((int_rel.r_offset & 3) != 0) - { - *errmsg = _("reloc not properly aligned"); - bfd_set_error (bfd_error_bad_value); - return false; - } - - bfd_put_32 (abfd, - (int_rel.r_vaddr - datasec->vma + datasec->output_offset - + (text_relative ? 0 : 1)), - p); - } - - return true; -} - -/* This is the ECOFF backend structure. The backend field of the - target vector points to this. */ - -static const struct ecoff_backend_data mips_ecoff_backend_data = -{ - /* COFF backend structure. */ - { - (void (*) PARAMS ((bfd *,PTR,int,int,int,int,PTR))) bfd_void, /* aux_in */ - (void (*) PARAMS ((bfd *,PTR,PTR))) bfd_void, /* sym_in */ - (void (*) PARAMS ((bfd *,PTR,PTR))) bfd_void, /* lineno_in */ - (unsigned (*) PARAMS ((bfd *,PTR,int,int,int,int,PTR)))bfd_void,/*aux_out*/ - (unsigned (*) PARAMS ((bfd *,PTR,PTR))) bfd_void, /* sym_out */ - (unsigned (*) PARAMS ((bfd *,PTR,PTR))) bfd_void, /* lineno_out */ - (unsigned (*) PARAMS ((bfd *,PTR,PTR))) bfd_void, /* reloc_out */ - mips_ecoff_swap_filehdr_out, mips_ecoff_swap_aouthdr_out, - mips_ecoff_swap_scnhdr_out, - FILHSZ, AOUTSZ, SCNHSZ, 0, 0, 0, 0, FILNMLEN, true, false, 4, - mips_ecoff_swap_filehdr_in, mips_ecoff_swap_aouthdr_in, - mips_ecoff_swap_scnhdr_in, NULL, - mips_ecoff_bad_format_hook, _bfd_ecoff_set_arch_mach_hook, - _bfd_ecoff_mkobject_hook, _bfd_ecoff_styp_to_sec_flags, - _bfd_ecoff_set_alignment_hook, _bfd_ecoff_slurp_symbol_table, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL - }, - /* Supported architecture. */ - bfd_arch_mips, - /* Initial portion of armap string. */ - "__________", - /* The page boundary used to align sections in a demand-paged - executable file. E.g., 0x1000. */ - 0x1000, - /* 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. */ - false, - /* Bitsize of constructor entries. */ - 32, - /* Reloc to use for constructor entries. */ - &mips_howto_table[MIPS_R_REFWORD], - { - /* Symbol table magic number. */ - magicSym, - /* Alignment of debugging information. E.g., 4. */ - 4, - /* Sizes of external symbolic information. */ - sizeof (struct hdr_ext), - sizeof (struct dnr_ext), - sizeof (struct pdr_ext), - sizeof (struct sym_ext), - sizeof (struct opt_ext), - sizeof (struct fdr_ext), - sizeof (struct rfd_ext), - sizeof (struct ext_ext), - /* Functions to swap in external symbolic data. */ - ecoff_swap_hdr_in, - ecoff_swap_dnr_in, - ecoff_swap_pdr_in, - ecoff_swap_sym_in, - ecoff_swap_opt_in, - ecoff_swap_fdr_in, - ecoff_swap_rfd_in, - ecoff_swap_ext_in, - _bfd_ecoff_swap_tir_in, - _bfd_ecoff_swap_rndx_in, - /* Functions to swap out external symbolic data. */ - ecoff_swap_hdr_out, - ecoff_swap_dnr_out, - ecoff_swap_pdr_out, - ecoff_swap_sym_out, - ecoff_swap_opt_out, - ecoff_swap_fdr_out, - ecoff_swap_rfd_out, - ecoff_swap_ext_out, - _bfd_ecoff_swap_tir_out, - _bfd_ecoff_swap_rndx_out, - /* Function to read in symbolic data. */ - _bfd_ecoff_slurp_symbolic_info - }, - /* External reloc size. */ - RELSZ, - /* Reloc swapping functions. */ - mips_ecoff_swap_reloc_in, - mips_ecoff_swap_reloc_out, - /* Backend reloc tweaking. */ - mips_adjust_reloc_in, - mips_adjust_reloc_out, - /* Relocate section contents while linking. */ - mips_relocate_section, - /* Do final adjustments to filehdr and aouthdr. */ - NULL, - /* Read an element from an archive at a given file position. */ - _bfd_get_elt_at_filepos -}; - -/* Looking up a reloc type is MIPS specific. */ -#define _bfd_ecoff_bfd_reloc_type_lookup mips_bfd_reloc_type_lookup - -/* Getting relocated section contents is generic. */ -#define _bfd_ecoff_bfd_get_relocated_section_contents \ - bfd_generic_get_relocated_section_contents - -/* Handling file windows is generic. */ -#define _bfd_ecoff_get_section_contents_in_window \ - _bfd_generic_get_section_contents_in_window - -/* Relaxing sections is MIPS specific. */ -#define _bfd_ecoff_bfd_relax_section mips_relax_section - -/* GC of sections is not done. */ -#define _bfd_ecoff_bfd_gc_sections bfd_generic_gc_sections - -extern const bfd_target ecoff_big_vec; - -const bfd_target ecoff_little_vec = -{ - "ecoff-littlemips", /* name */ - bfd_target_ecoff_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 | SEC_CODE | SEC_DATA), - 0, /* leading underscore */ - ' ', /* 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 */ - - {_bfd_dummy_target, coff_object_p, /* bfd_check_format */ - _bfd_ecoff_archive_p, _bfd_dummy_target}, - {bfd_false, _bfd_ecoff_mkobject, /* bfd_set_format */ - _bfd_generic_mkarchive, bfd_false}, - {bfd_false, _bfd_ecoff_write_object_contents, /* bfd_write_contents */ - _bfd_write_archive_contents, bfd_false}, - - BFD_JUMP_TABLE_GENERIC (_bfd_ecoff), - BFD_JUMP_TABLE_COPY (_bfd_ecoff), - BFD_JUMP_TABLE_CORE (_bfd_nocore), - BFD_JUMP_TABLE_ARCHIVE (_bfd_ecoff), - BFD_JUMP_TABLE_SYMBOLS (_bfd_ecoff), - BFD_JUMP_TABLE_RELOCS (_bfd_ecoff), - BFD_JUMP_TABLE_WRITE (_bfd_ecoff), - BFD_JUMP_TABLE_LINK (_bfd_ecoff), - BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), - - & ecoff_big_vec, - - (PTR) &mips_ecoff_backend_data -}; - -const bfd_target ecoff_big_vec = -{ - "ecoff-bigmips", /* name */ - bfd_target_ecoff_flavour, - BFD_ENDIAN_BIG, /* data byte order is big */ - BFD_ENDIAN_BIG, /* header byte order is big */ - - (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 | SEC_CODE | SEC_DATA), - 0, /* leading underscore */ - ' ', /* ar_pad_char */ - 15, /* 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, - bfd_getb64, bfd_getb_signed_64, bfd_putb64, - bfd_getb32, bfd_getb_signed_32, bfd_putb32, - bfd_getb16, bfd_getb_signed_16, bfd_putb16, - {_bfd_dummy_target, coff_object_p, /* bfd_check_format */ - _bfd_ecoff_archive_p, _bfd_dummy_target}, - {bfd_false, _bfd_ecoff_mkobject, /* bfd_set_format */ - _bfd_generic_mkarchive, bfd_false}, - {bfd_false, _bfd_ecoff_write_object_contents, /* bfd_write_contents */ - _bfd_write_archive_contents, bfd_false}, - - BFD_JUMP_TABLE_GENERIC (_bfd_ecoff), - BFD_JUMP_TABLE_COPY (_bfd_ecoff), - BFD_JUMP_TABLE_CORE (_bfd_nocore), - BFD_JUMP_TABLE_ARCHIVE (_bfd_ecoff), - BFD_JUMP_TABLE_SYMBOLS (_bfd_ecoff), - BFD_JUMP_TABLE_RELOCS (_bfd_ecoff), - BFD_JUMP_TABLE_WRITE (_bfd_ecoff), - BFD_JUMP_TABLE_LINK (_bfd_ecoff), - BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), - - & ecoff_little_vec, - - (PTR) &mips_ecoff_backend_data -}; - -const bfd_target ecoff_biglittle_vec = -{ - "ecoff-biglittlemips", /* name */ - bfd_target_ecoff_flavour, - BFD_ENDIAN_LITTLE, /* data byte order is little */ - BFD_ENDIAN_BIG, /* header byte order is big */ - - (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 | SEC_CODE | SEC_DATA), - 0, /* leading underscore */ - ' ', /* 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_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, coff_object_p, /* bfd_check_format */ - _bfd_ecoff_archive_p, _bfd_dummy_target}, - {bfd_false, _bfd_ecoff_mkobject, /* bfd_set_format */ - _bfd_generic_mkarchive, bfd_false}, - {bfd_false, _bfd_ecoff_write_object_contents, /* bfd_write_contents */ - _bfd_write_archive_contents, bfd_false}, - - BFD_JUMP_TABLE_GENERIC (_bfd_ecoff), - BFD_JUMP_TABLE_COPY (_bfd_ecoff), - BFD_JUMP_TABLE_CORE (_bfd_nocore), - BFD_JUMP_TABLE_ARCHIVE (_bfd_ecoff), - BFD_JUMP_TABLE_SYMBOLS (_bfd_ecoff), - BFD_JUMP_TABLE_RELOCS (_bfd_ecoff), - BFD_JUMP_TABLE_WRITE (_bfd_ecoff), - BFD_JUMP_TABLE_LINK (_bfd_ecoff), - BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), - - NULL, - - (PTR) &mips_ecoff_backend_data -}; diff --git a/contrib/binutils/bfd/coff-sh.c b/contrib/binutils/bfd/coff-sh.c deleted file mode 100644 index fd4f2180bce3..000000000000 --- a/contrib/binutils/bfd/coff-sh.c +++ /dev/null @@ -1,2944 +0,0 @@ -/* BFD back-end for Hitachi Super-H COFF binaries. - Copyright 1993, 94, 95, 96, 97, 1998 Free Software Foundation, Inc. - Contributed by Cygnus Support. - Written by Steve Chamberlain, <sac@cygnus.com>. - Relaxing code written by Ian Lance Taylor, <ian@cygnus.com>. - -This file is part of BFD, the Binary File Descriptor library. - -This 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 "coff/sh.h" -#include "coff/internal.h" -#include "libcoff.h" - -/* Internal functions. */ -static bfd_reloc_status_type sh_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); -static long get_symbol_value PARAMS ((asymbol *)); -static boolean sh_merge_private_data PARAMS ((bfd *, bfd *)); -static boolean sh_relax_section - PARAMS ((bfd *, asection *, struct bfd_link_info *, boolean *)); -static boolean sh_relax_delete_bytes - PARAMS ((bfd *, asection *, bfd_vma, int)); -static const struct sh_opcode *sh_insn_info PARAMS ((unsigned int)); -static boolean sh_align_loads - PARAMS ((bfd *, asection *, struct internal_reloc *, bfd_byte *, boolean *)); -static boolean sh_swap_insns - PARAMS ((bfd *, asection *, PTR, bfd_byte *, bfd_vma)); -static boolean sh_relocate_section - PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, - struct internal_reloc *, struct internal_syment *, asection **)); -static bfd_byte *sh_coff_get_relocated_section_contents - PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, - bfd_byte *, boolean, asymbol **)); - -/* Default section alignment to 2**4. */ -#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (4) - -/* Generate long file names. */ -#define COFF_LONG_FILENAMES - -/* The supported relocations. There are a lot of relocations defined - in coff/internal.h which we do not expect to ever see. */ -static reloc_howto_type sh_coff_howtos[] = -{ - { 0 }, - { 1 }, - { 2 }, - { 3 }, /* R_SH_PCREL8 */ - { 4 }, /* R_SH_PCREL16 */ - { 5 }, /* R_SH_HIGH8 */ - { 6 }, /* R_SH_IMM24 */ - { 7 }, /* R_SH_LOW16 */ - { 8 }, - { 9 }, /* R_SH_PCDISP8BY4 */ - - HOWTO (R_SH_PCDISP8BY2, /* type */ - 1, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 8, /* bitsize */ - true, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - sh_reloc, /* special_function */ - "r_pcdisp8by2", /* name */ - true, /* partial_inplace */ - 0xff, /* src_mask */ - 0xff, /* dst_mask */ - true), /* pcrel_offset */ - - { 11 }, /* R_SH_PCDISP8 */ - - HOWTO (R_SH_PCDISP, /* type */ - 1, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 12, /* bitsize */ - true, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - sh_reloc, /* special_function */ - "r_pcdisp12by2", /* name */ - true, /* partial_inplace */ - 0xfff, /* src_mask */ - 0xfff, /* dst_mask */ - true), /* pcrel_offset */ - - { 13 }, - - HOWTO (R_SH_IMM32, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - sh_reloc, /* special_function */ - "r_imm32", /* name */ - true, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - false), /* pcrel_offset */ - - { 15 }, - { 16 }, /* R_SH_IMM8 */ - { 17 }, /* R_SH_IMM8BY2 */ - { 18 }, /* R_SH_IMM8BY4 */ - { 19 }, /* R_SH_IMM4 */ - { 20 }, /* R_SH_IMM4BY2 */ - { 21 }, /* R_SH_IMM4BY4 */ - - HOWTO (R_SH_PCRELIMM8BY2, /* type */ - 1, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 8, /* bitsize */ - true, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_unsigned, /* complain_on_overflow */ - sh_reloc, /* special_function */ - "r_pcrelimm8by2", /* name */ - true, /* partial_inplace */ - 0xff, /* src_mask */ - 0xff, /* dst_mask */ - true), /* pcrel_offset */ - - HOWTO (R_SH_PCRELIMM8BY4, /* type */ - 2, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 8, /* bitsize */ - true, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_unsigned, /* complain_on_overflow */ - sh_reloc, /* special_function */ - "r_pcrelimm8by4", /* name */ - true, /* partial_inplace */ - 0xff, /* src_mask */ - 0xff, /* dst_mask */ - true), /* pcrel_offset */ - - HOWTO (R_SH_IMM16, /* type */ - 0, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - sh_reloc, /* special_function */ - "r_imm16", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - HOWTO (R_SH_SWITCH16, /* type */ - 0, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - sh_reloc, /* special_function */ - "r_switch16", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - HOWTO (R_SH_SWITCH32, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - sh_reloc, /* special_function */ - "r_switch32", /* name */ - true, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - false), /* pcrel_offset */ - - HOWTO (R_SH_USES, /* type */ - 0, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - sh_reloc, /* special_function */ - "r_uses", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - HOWTO (R_SH_COUNT, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - sh_reloc, /* special_function */ - "r_count", /* name */ - true, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - false), /* pcrel_offset */ - - HOWTO (R_SH_ALIGN, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - sh_reloc, /* special_function */ - "r_align", /* name */ - true, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - false), /* pcrel_offset */ - - HOWTO (R_SH_CODE, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - sh_reloc, /* special_function */ - "r_code", /* name */ - true, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - false), /* pcrel_offset */ - - HOWTO (R_SH_DATA, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - sh_reloc, /* special_function */ - "r_data", /* name */ - true, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - false), /* pcrel_offset */ - - HOWTO (R_SH_LABEL, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - sh_reloc, /* special_function */ - "r_label", /* name */ - true, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - false), /* pcrel_offset */ - - HOWTO (R_SH_SWITCH8, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 8, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - sh_reloc, /* special_function */ - "r_switch8", /* name */ - true, /* partial_inplace */ - 0xff, /* src_mask */ - 0xff, /* dst_mask */ - false) /* pcrel_offset */ -}; - -#define SH_COFF_HOWTO_COUNT (sizeof sh_coff_howtos / sizeof sh_coff_howtos[0]) - -/* Check for a bad magic number. */ -#define BADMAG(x) SHBADMAG(x) - -/* Customize coffcode.h (this is not currently used). */ -#define SH 1 - -/* FIXME: This should not be set here. */ -#define __A_MAGIC_SET__ - -/* Swap the r_offset field in and out. */ -#define SWAP_IN_RELOC_OFFSET bfd_h_get_32 -#define SWAP_OUT_RELOC_OFFSET bfd_h_put_32 - -/* Swap out extra information in the reloc structure. */ -#define SWAP_OUT_RELOC_EXTRA(abfd, src, dst) \ - do \ - { \ - dst->r_stuff[0] = 'S'; \ - dst->r_stuff[1] = 'C'; \ - } \ - while (0) - -/* Get the value of a symbol, when performing a relocation. */ - -static long -get_symbol_value (symbol) - asymbol *symbol; -{ - bfd_vma relocation; - - if (bfd_is_com_section (symbol->section)) - relocation = 0; - else - relocation = (symbol->value + - symbol->section->output_section->vma + - symbol->section->output_offset); - - return relocation; -} - -/* This macro is used in coffcode.h to get the howto corresponding to - an internal reloc. */ - -#define RTYPE2HOWTO(relent, internal) \ - ((relent)->howto = \ - ((internal)->r_type < SH_COFF_HOWTO_COUNT \ - ? &sh_coff_howtos[(internal)->r_type] \ - : (reloc_howto_type *) NULL)) - -/* This is the same as the macro in coffcode.h, except that it copies - r_offset into reloc_entry->addend for some relocs. */ -#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; \ - if ((reloc).r_type == R_SH_SWITCH8 \ - || (reloc).r_type == R_SH_SWITCH16 \ - || (reloc).r_type == R_SH_SWITCH32 \ - || (reloc).r_type == R_SH_USES \ - || (reloc).r_type == R_SH_COUNT \ - || (reloc).r_type == R_SH_ALIGN) \ - cache_ptr->addend = (reloc).r_offset; \ - } - -/* This is the howto function for the SH relocations. */ - -static bfd_reloc_status_type -sh_reloc (abfd, reloc_entry, symbol_in, data, input_section, output_bfd, - error_message) - bfd *abfd; - arelent *reloc_entry; - asymbol *symbol_in; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message; -{ - unsigned long insn; - bfd_vma sym_value; - unsigned short r_type; - bfd_vma addr = reloc_entry->address; - bfd_byte *hit_data = addr + (bfd_byte *) data; - - r_type = reloc_entry->howto->type; - - if (output_bfd != NULL) - { - /* Partial linking--do nothing. */ - reloc_entry->address += input_section->output_offset; - return bfd_reloc_ok; - } - - /* Almost all relocs have to do with relaxing. If any work must be - done for them, it has been done in sh_relax_section. */ - if (r_type != R_SH_IMM32 - && (r_type != R_SH_PCDISP - || (symbol_in->flags & BSF_LOCAL) != 0)) - return bfd_reloc_ok; - - if (symbol_in != NULL - && bfd_is_und_section (symbol_in->section)) - return bfd_reloc_undefined; - - sym_value = get_symbol_value (symbol_in); - - switch (r_type) - { - case R_SH_IMM32: - insn = bfd_get_32 (abfd, hit_data); - insn += sym_value + reloc_entry->addend; - bfd_put_32 (abfd, insn, hit_data); - break; - case R_SH_PCDISP: - insn = bfd_get_16 (abfd, hit_data); - sym_value += reloc_entry->addend; - sym_value -= (input_section->output_section->vma - + input_section->output_offset - + addr - + 4); - sym_value += (insn & 0xfff) << 1; - if (insn & 0x800) - sym_value -= 0x1000; - insn = (insn & 0xf000) | (sym_value & 0xfff); - bfd_put_16 (abfd, insn, hit_data); - if (sym_value < (bfd_vma) -0x1000 || sym_value >= 0x1000) - return bfd_reloc_overflow; - break; - default: - abort (); - break; - } - - return bfd_reloc_ok; -} - -/* This routine checks for linking big and little endian objects - together. */ - -static boolean -sh_merge_private_data (ibfd, obfd) - bfd *ibfd; - bfd *obfd; -{ - if (ibfd->xvec->byteorder != obfd->xvec->byteorder - && obfd->xvec->byteorder != BFD_ENDIAN_UNKNOWN) - { - (*_bfd_error_handler) - ("%s: compiled for a %s endian system and target is %s endian", - bfd_get_filename (ibfd), - bfd_big_endian (ibfd) ? "big" : "little", - bfd_big_endian (obfd) ? "big" : "little"); - - bfd_set_error (bfd_error_wrong_format); - return false; - } - - return true; -} - -#define coff_bfd_merge_private_bfd_data sh_merge_private_data - -/* We can do relaxing. */ -#define coff_bfd_relax_section sh_relax_section - -/* We use the special COFF backend linker. */ -#define coff_relocate_section sh_relocate_section - -/* When relaxing, we need to use special code to get the relocated - section contents. */ -#define coff_bfd_get_relocated_section_contents \ - sh_coff_get_relocated_section_contents - -#include "coffcode.h" - -/* This function handles relaxing on the SH. - - Function calls on the SH look like this: - - movl L1,r0 - ... - jsr @r0 - ... - L1: - .long function - - The compiler and assembler will cooperate to create R_SH_USES - relocs on the jsr instructions. The r_offset field of the - R_SH_USES reloc is the PC relative offset to the instruction which - loads the register (the r_offset field is computed as though it - were a jump instruction, so the offset value is actually from four - bytes past the instruction). The linker can use this reloc to - determine just which function is being called, and thus decide - whether it is possible to replace the jsr with a bsr. - - If multiple function calls are all based on a single register load - (i.e., the same function is called multiple times), the compiler - guarantees that each function call will have an R_SH_USES reloc. - Therefore, if the linker is able to convert each R_SH_USES reloc - which refers to that address, it can safely eliminate the register - load. - - When the assembler creates an R_SH_USES reloc, it examines it to - determine which address is being loaded (L1 in the above example). - It then counts the number of references to that address, and - creates an R_SH_COUNT reloc at that address. The r_offset field of - the R_SH_COUNT reloc will be the number of references. If the - linker is able to eliminate a register load, it can use the - R_SH_COUNT reloc to see whether it can also eliminate the function - address. - - SH relaxing also handles another, unrelated, matter. On the SH, if - a load or store instruction is not aligned on a four byte boundary, - the memory cycle interferes with the 32 bit instruction fetch, - causing a one cycle bubble in the pipeline. Therefore, we try to - align load and store instructions on four byte boundaries if we - can, by swapping them with one of the adjacent instructions. */ - -static boolean -sh_relax_section (abfd, sec, link_info, again) - bfd *abfd; - asection *sec; - struct bfd_link_info *link_info; - boolean *again; -{ - struct internal_reloc *internal_relocs; - struct internal_reloc *free_relocs = NULL; - boolean have_code; - struct internal_reloc *irel, *irelend; - bfd_byte *contents = NULL; - bfd_byte *free_contents = NULL; - - *again = false; - - if (link_info->relocateable - || (sec->flags & SEC_RELOC) == 0 - || sec->reloc_count == 0) - return true; - - /* If this is the first time we have been called for this section, - initialize the cooked size. */ - if (sec->_cooked_size == 0) - sec->_cooked_size = sec->_raw_size; - - internal_relocs = (_bfd_coff_read_internal_relocs - (abfd, sec, link_info->keep_memory, - (bfd_byte *) NULL, false, - (struct internal_reloc *) NULL)); - if (internal_relocs == NULL) - goto error_return; - if (! link_info->keep_memory) - free_relocs = internal_relocs; - - have_code = false; - - irelend = internal_relocs + sec->reloc_count; - for (irel = internal_relocs; irel < irelend; irel++) - { - bfd_vma laddr, paddr, symval; - unsigned short insn; - struct internal_reloc *irelfn, *irelscan, *irelcount; - struct internal_syment sym; - bfd_signed_vma foff; - - if (irel->r_type == R_SH_CODE) - have_code = true; - - if (irel->r_type != R_SH_USES) - continue; - - /* Get the section contents. */ - if (contents == NULL) - { - if (coff_section_data (abfd, sec) != NULL - && coff_section_data (abfd, sec)->contents != NULL) - contents = coff_section_data (abfd, sec)->contents; - else - { - contents = (bfd_byte *) bfd_malloc (sec->_raw_size); - if (contents == NULL) - goto error_return; - free_contents = contents; - - if (! bfd_get_section_contents (abfd, sec, contents, - (file_ptr) 0, sec->_raw_size)) - goto error_return; - } - } - - /* The r_offset field of the R_SH_USES reloc will point us to - the register load. The 4 is because the r_offset field is - computed as though it were a jump offset, which are based - from 4 bytes after the jump instruction. */ - laddr = irel->r_vaddr - sec->vma + 4; - /* Careful to sign extend the 32-bit offset. */ - laddr += ((irel->r_offset & 0xffffffff) ^ 0x80000000) - 0x80000000; - if (laddr >= sec->_raw_size) - { - (*_bfd_error_handler) ("%s: 0x%lx: warning: bad R_SH_USES offset", - bfd_get_filename (abfd), - (unsigned long) irel->r_vaddr); - continue; - } - insn = bfd_get_16 (abfd, contents + laddr); - - /* If the instruction is not mov.l NN,rN, we don't know what to do. */ - if ((insn & 0xf000) != 0xd000) - { - ((*_bfd_error_handler) - ("%s: 0x%lx: warning: R_SH_USES points to unrecognized insn 0x%x", - bfd_get_filename (abfd), (unsigned long) irel->r_vaddr, insn)); - continue; - } - - /* Get the address from which the register is being loaded. The - displacement in the mov.l instruction is quadrupled. It is a - displacement from four bytes after the movl instruction, but, - before adding in the PC address, two least significant bits - of the PC are cleared. We assume that the section is aligned - on a four byte boundary. */ - paddr = insn & 0xff; - paddr *= 4; - paddr += (laddr + 4) &~ 3; - if (paddr >= sec->_raw_size) - { - ((*_bfd_error_handler) - ("%s: 0x%lx: warning: bad R_SH_USES load offset", - bfd_get_filename (abfd), (unsigned long) irel->r_vaddr)); - continue; - } - - /* Get the reloc for the address from which the register is - being loaded. This reloc will tell us which function is - actually being called. */ - paddr += sec->vma; - for (irelfn = internal_relocs; irelfn < irelend; irelfn++) - if (irelfn->r_vaddr == paddr - && irelfn->r_type == R_SH_IMM32) - break; - if (irelfn >= irelend) - { - ((*_bfd_error_handler) - ("%s: 0x%lx: warning: could not find expected reloc", - bfd_get_filename (abfd), (unsigned long) paddr)); - continue; - } - - /* Get the value of the symbol referred to by the reloc. */ - if (! _bfd_coff_get_external_symbols (abfd)) - goto error_return; - bfd_coff_swap_sym_in (abfd, - ((bfd_byte *) obj_coff_external_syms (abfd) - + (irelfn->r_symndx - * bfd_coff_symesz (abfd))), - &sym); - if (sym.n_scnum != 0 && sym.n_scnum != sec->target_index) - { - ((*_bfd_error_handler) - ("%s: 0x%lx: warning: symbol in unexpected section", - bfd_get_filename (abfd), (unsigned long) paddr)); - continue; - } - - if (sym.n_sclass != C_EXT) - { - symval = (sym.n_value - - sec->vma - + sec->output_section->vma - + sec->output_offset); - } - else - { - struct coff_link_hash_entry *h; - - h = obj_coff_sym_hashes (abfd)[irelfn->r_symndx]; - BFD_ASSERT (h != NULL); - if (h->root.type != bfd_link_hash_defined - && h->root.type != bfd_link_hash_defweak) - { - /* This appears to be a reference to an undefined - symbol. Just ignore it--it will be caught by the - regular reloc processing. */ - continue; - } - - symval = (h->root.u.def.value - + h->root.u.def.section->output_section->vma - + h->root.u.def.section->output_offset); - } - - symval += bfd_get_32 (abfd, contents + paddr - sec->vma); - - /* See if this function call can be shortened. */ - foff = (symval - - (irel->r_vaddr - - sec->vma - + sec->output_section->vma - + sec->output_offset - + 4)); - if (foff < -0x1000 || foff >= 0x1000) - { - /* After all that work, we can't shorten this function call. */ - continue; - } - - /* Shorten the function call. */ - - /* For simplicity of coding, we are going to modify the section - contents, the section relocs, and the BFD symbol table. We - must tell the rest of the code not to free up this - information. It would be possible to instead create a table - of changes which have to be made, as is done in coff-mips.c; - that would be more work, but would require less memory when - the linker is run. */ - - 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)->relocs = internal_relocs; - coff_section_data (abfd, sec)->keep_relocs = true; - free_relocs = NULL; - - coff_section_data (abfd, sec)->contents = contents; - coff_section_data (abfd, sec)->keep_contents = true; - free_contents = NULL; - - obj_coff_keep_syms (abfd) = true; - - /* Replace the jsr with a bsr. */ - - /* Change the R_SH_USES reloc into an R_SH_PCDISP reloc, and - replace the jsr with a bsr. */ - irel->r_type = R_SH_PCDISP; - irel->r_symndx = irelfn->r_symndx; - if (sym.n_sclass != C_EXT) - { - /* If this needs to be changed because of future relaxing, - it will be handled here like other internal PCDISP - relocs. */ - bfd_put_16 (abfd, - 0xb000 | ((foff >> 1) & 0xfff), - contents + irel->r_vaddr - sec->vma); - } - else - { - /* We can't fully resolve this yet, because the external - symbol value may be changed by future relaxing. We let - the final link phase handle it. */ - bfd_put_16 (abfd, 0xb000, contents + irel->r_vaddr - sec->vma); - } - - /* See if there is another R_SH_USES reloc referring to the same - register load. */ - for (irelscan = internal_relocs; irelscan < irelend; irelscan++) - if (irelscan->r_type == R_SH_USES - && laddr == irelscan->r_vaddr - sec->vma + 4 + irelscan->r_offset) - break; - if (irelscan < irelend) - { - /* Some other function call depends upon this register load, - and we have not yet converted that function call. - Indeed, we may never be able to convert it. There is - nothing else we can do at this point. */ - continue; - } - - /* Look for a R_SH_COUNT reloc on the location where the - function address is stored. Do this before deleting any - bytes, to avoid confusion about the address. */ - for (irelcount = internal_relocs; irelcount < irelend; irelcount++) - if (irelcount->r_vaddr == paddr - && irelcount->r_type == R_SH_COUNT) - break; - - /* Delete the register load. */ - if (! sh_relax_delete_bytes (abfd, sec, laddr, 2)) - goto error_return; - - /* That will change things, so, just in case it permits some - other function call to come within range, we should relax - again. Note that this is not required, and it may be slow. */ - *again = true; - - /* Now check whether we got a COUNT reloc. */ - if (irelcount >= irelend) - { - ((*_bfd_error_handler) - ("%s: 0x%lx: warning: could not find expected COUNT reloc", - bfd_get_filename (abfd), (unsigned long) paddr)); - continue; - } - - /* The number of uses is stored in the r_offset field. We've - just deleted one. */ - if (irelcount->r_offset == 0) - { - ((*_bfd_error_handler) ("%s: 0x%lx: warning: bad count", - bfd_get_filename (abfd), - (unsigned long) paddr)); - continue; - } - - --irelcount->r_offset; - - /* If there are no more uses, we can delete the address. Reload - the address from irelfn, in case it was changed by the - previous call to sh_relax_delete_bytes. */ - if (irelcount->r_offset == 0) - { - if (! sh_relax_delete_bytes (abfd, sec, - irelfn->r_vaddr - sec->vma, 4)) - goto error_return; - } - - /* We've done all we can with that function call. */ - } - - /* Look for load and store instructions that we can align on four - byte boundaries. */ - if (have_code) - { - boolean swapped; - - /* Get the section contents. */ - if (contents == NULL) - { - if (coff_section_data (abfd, sec) != NULL - && coff_section_data (abfd, sec)->contents != NULL) - contents = coff_section_data (abfd, sec)->contents; - else - { - contents = (bfd_byte *) bfd_malloc (sec->_raw_size); - if (contents == NULL) - goto error_return; - free_contents = contents; - - if (! bfd_get_section_contents (abfd, sec, contents, - (file_ptr) 0, sec->_raw_size)) - goto error_return; - } - } - - if (! sh_align_loads (abfd, sec, internal_relocs, contents, &swapped)) - goto error_return; - - if (swapped) - { - 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)->relocs = internal_relocs; - coff_section_data (abfd, sec)->keep_relocs = true; - free_relocs = NULL; - - coff_section_data (abfd, sec)->contents = contents; - coff_section_data (abfd, sec)->keep_contents = true; - free_contents = NULL; - - obj_coff_keep_syms (abfd) = true; - } - } - - if (free_relocs != NULL) - { - free (free_relocs); - free_relocs = NULL; - } - - if (free_contents != NULL) - { - if (! link_info->keep_memory) - free (free_contents); - else - { - /* Cache the section contents for coff_link_input_bfd. */ - 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)->relocs = NULL; - } - coff_section_data (abfd, sec)->contents = contents; - } - } - - return true; - - error_return: - if (free_relocs != NULL) - free (free_relocs); - if (free_contents != NULL) - free (free_contents); - return false; -} - -/* Delete some bytes from a section while relaxing. */ - -static boolean -sh_relax_delete_bytes (abfd, sec, addr, count) - bfd *abfd; - asection *sec; - bfd_vma addr; - int count; -{ - bfd_byte *contents; - struct internal_reloc *irel, *irelend; - struct internal_reloc *irelalign; - bfd_vma toaddr; - bfd_byte *esym, *esymend; - bfd_size_type symesz; - struct coff_link_hash_entry **sym_hash; - asection *o; - - contents = coff_section_data (abfd, sec)->contents; - - /* The deletion must stop at the next ALIGN reloc for an aligment - power larger than the number of bytes we are deleting. */ - - irelalign = NULL; - toaddr = sec->_cooked_size; - - irel = coff_section_data (abfd, sec)->relocs; - irelend = irel + sec->reloc_count; - for (; irel < irelend; irel++) - { - if (irel->r_type == R_SH_ALIGN - && irel->r_vaddr - sec->vma > addr - && count < (1 << irel->r_offset)) - { - irelalign = irel; - toaddr = irel->r_vaddr - sec->vma; - break; - } - } - - /* Actually delete the bytes. */ - memmove (contents + addr, contents + addr + count, toaddr - addr - count); - if (irelalign == NULL) - sec->_cooked_size -= count; - else - { - int i; - -#define NOP_OPCODE (0x0009) - - BFD_ASSERT ((count & 1) == 0); - for (i = 0; i < count; i += 2) - bfd_put_16 (abfd, NOP_OPCODE, contents + toaddr - count + i); - } - - /* Adjust all the relocs. */ - for (irel = coff_section_data (abfd, sec)->relocs; irel < irelend; irel++) - { - bfd_vma nraddr, stop; - bfd_vma start = 0; - int insn = 0; - struct internal_syment sym; - int off, adjust, oinsn; - bfd_signed_vma voff = 0; - boolean overflow; - - /* Get the new reloc address. */ - nraddr = irel->r_vaddr - sec->vma; - if ((irel->r_vaddr - sec->vma > addr - && irel->r_vaddr - sec->vma < toaddr) - || (irel->r_type == R_SH_ALIGN - && irel->r_vaddr - sec->vma == toaddr)) - nraddr -= count; - - /* See if this reloc was for the bytes we have deleted, in which - case we no longer care about it. Don't delete relocs which - represent addresses, though. */ - if (irel->r_vaddr - sec->vma >= addr - && irel->r_vaddr - sec->vma < addr + count - && irel->r_type != R_SH_ALIGN - && irel->r_type != R_SH_CODE - && irel->r_type != R_SH_DATA - && irel->r_type != R_SH_LABEL) - irel->r_type = R_SH_UNUSED; - - /* If this is a PC relative reloc, see if the range it covers - includes the bytes we have deleted. */ - switch (irel->r_type) - { - default: - break; - - case R_SH_PCDISP8BY2: - case R_SH_PCDISP: - case R_SH_PCRELIMM8BY2: - case R_SH_PCRELIMM8BY4: - start = irel->r_vaddr - sec->vma; - insn = bfd_get_16 (abfd, contents + nraddr); - break; - } - - switch (irel->r_type) - { - default: - start = stop = addr; - break; - - case R_SH_IMM32: - /* If this reloc is against a symbol defined in this - section, and the symbol will not be adjusted below, we - must check the addend to see it will put the value in - range to be adjusted, and hence must be changed. */ - bfd_coff_swap_sym_in (abfd, - ((bfd_byte *) obj_coff_external_syms (abfd) - + (irel->r_symndx - * bfd_coff_symesz (abfd))), - &sym); - if (sym.n_sclass != C_EXT - && sym.n_scnum == sec->target_index - && ((bfd_vma) sym.n_value <= addr - || (bfd_vma) sym.n_value >= toaddr)) - { - bfd_vma val; - - val = bfd_get_32 (abfd, contents + nraddr); - val += sym.n_value; - if (val >= addr && val < toaddr) - bfd_put_32 (abfd, val - count, contents + nraddr); - } - start = stop = addr; - break; - - case R_SH_PCDISP8BY2: - off = insn & 0xff; - if (off & 0x80) - off -= 0x100; - stop = (bfd_vma) ((bfd_signed_vma) start + 4 + off * 2); - break; - - case R_SH_PCDISP: - bfd_coff_swap_sym_in (abfd, - ((bfd_byte *) obj_coff_external_syms (abfd) - + (irel->r_symndx - * bfd_coff_symesz (abfd))), - &sym); - if (sym.n_sclass == C_EXT) - start = stop = addr; - else - { - off = insn & 0xfff; - if (off & 0x800) - off -= 0x1000; - stop = (bfd_vma) ((bfd_signed_vma) start + 4 + off * 2); - } - break; - - case R_SH_PCRELIMM8BY2: - off = insn & 0xff; - stop = start + 4 + off * 2; - break; - - case R_SH_PCRELIMM8BY4: - off = insn & 0xff; - stop = (start &~ (bfd_vma) 3) + 4 + off * 4; - break; - - case R_SH_SWITCH8: - case R_SH_SWITCH16: - case R_SH_SWITCH32: - /* These relocs types represent - .word L2-L1 - The r_offset field holds the difference between the reloc - address and L1. That is the start of the reloc, and - adding in the contents gives us the top. We must adjust - both the r_offset field and the section contents. */ - - start = irel->r_vaddr - sec->vma; - stop = (bfd_vma) ((bfd_signed_vma) start - (long) irel->r_offset); - - if (start > addr - && start < toaddr - && (stop <= addr || stop >= toaddr)) - irel->r_offset += count; - else if (stop > addr - && stop < toaddr - && (start <= addr || start >= toaddr)) - irel->r_offset -= count; - - start = stop; - - if (irel->r_type == R_SH_SWITCH16) - voff = bfd_get_signed_16 (abfd, contents + nraddr); - else if (irel->r_type == R_SH_SWITCH8) - voff = bfd_get_8 (abfd, contents + nraddr); - else - voff = bfd_get_signed_32 (abfd, contents + nraddr); - stop = (bfd_vma) ((bfd_signed_vma) start + voff); - - break; - - case R_SH_USES: - start = irel->r_vaddr - sec->vma; - stop = (bfd_vma) ((bfd_signed_vma) start - + (long) irel->r_offset - + 4); - break; - } - - if (start > addr - && start < toaddr - && (stop <= addr || stop >= toaddr)) - adjust = count; - else if (stop > addr - && stop < toaddr - && (start <= addr || start >= toaddr)) - adjust = - count; - else - adjust = 0; - - if (adjust != 0) - { - oinsn = insn; - overflow = false; - switch (irel->r_type) - { - default: - abort (); - break; - - case R_SH_PCDISP8BY2: - case R_SH_PCRELIMM8BY2: - insn += adjust / 2; - if ((oinsn & 0xff00) != (insn & 0xff00)) - overflow = true; - bfd_put_16 (abfd, insn, contents + nraddr); - break; - - case R_SH_PCDISP: - insn += adjust / 2; - if ((oinsn & 0xf000) != (insn & 0xf000)) - overflow = true; - bfd_put_16 (abfd, insn, contents + nraddr); - break; - - case R_SH_PCRELIMM8BY4: - BFD_ASSERT (adjust == count || count >= 4); - if (count >= 4) - insn += adjust / 4; - else - { - if ((irel->r_vaddr & 3) == 0) - ++insn; - } - if ((oinsn & 0xff00) != (insn & 0xff00)) - overflow = true; - bfd_put_16 (abfd, insn, contents + nraddr); - break; - - case R_SH_SWITCH8: - voff += adjust; - if (voff < 0 || voff >= 0xff) - overflow = true; - bfd_put_8 (abfd, voff, contents + nraddr); - break; - - case R_SH_SWITCH16: - voff += adjust; - if (voff < - 0x8000 || voff >= 0x8000) - overflow = true; - bfd_put_signed_16 (abfd, voff, contents + nraddr); - break; - - case R_SH_SWITCH32: - voff += adjust; - bfd_put_signed_32 (abfd, voff, contents + nraddr); - break; - - case R_SH_USES: - irel->r_offset += adjust; - break; - } - - if (overflow) - { - ((*_bfd_error_handler) - ("%s: 0x%lx: fatal: reloc overflow while relaxing", - bfd_get_filename (abfd), (unsigned long) irel->r_vaddr)); - bfd_set_error (bfd_error_bad_value); - return false; - } - } - - irel->r_vaddr = nraddr + sec->vma; - } - - /* Look through all the other sections. If there contain any IMM32 - relocs against internal symbols which we are not going to adjust - below, we may need to adjust the addends. */ - for (o = abfd->sections; o != NULL; o = o->next) - { - struct internal_reloc *internal_relocs; - struct internal_reloc *irelscan, *irelscanend; - bfd_byte *ocontents; - - if (o == sec - || (o->flags & SEC_RELOC) == 0 - || o->reloc_count == 0) - continue; - - /* We always cache the relocs. Perhaps, if info->keep_memory is - false, we should free them, if we are permitted to, when we - leave sh_coff_relax_section. */ - internal_relocs = (_bfd_coff_read_internal_relocs - (abfd, o, true, (bfd_byte *) NULL, false, - (struct internal_reloc *) NULL)); - if (internal_relocs == NULL) - return false; - - ocontents = NULL; - irelscanend = internal_relocs + o->reloc_count; - for (irelscan = internal_relocs; irelscan < irelscanend; irelscan++) - { - struct internal_syment sym; - - if (irelscan->r_type != R_SH_IMM32) - continue; - - bfd_coff_swap_sym_in (abfd, - ((bfd_byte *) obj_coff_external_syms (abfd) - + (irelscan->r_symndx - * bfd_coff_symesz (abfd))), - &sym); - if (sym.n_sclass != C_EXT - && sym.n_scnum == sec->target_index - && ((bfd_vma) sym.n_value <= addr - || (bfd_vma) sym.n_value >= toaddr)) - { - bfd_vma val; - - if (ocontents == NULL) - { - if (coff_section_data (abfd, o)->contents != NULL) - ocontents = coff_section_data (abfd, o)->contents; - else - { - /* We always cache the section contents. - Perhaps, if info->keep_memory is false, we - should free them, if we are permitted to, - when we leave sh_coff_relax_section. */ - ocontents = (bfd_byte *) bfd_malloc (o->_raw_size); - if (ocontents == NULL) - return false; - if (! bfd_get_section_contents (abfd, o, ocontents, - (file_ptr) 0, - o->_raw_size)) - return false; - coff_section_data (abfd, o)->contents = ocontents; - } - } - - val = bfd_get_32 (abfd, ocontents + irelscan->r_vaddr - o->vma); - val += sym.n_value; - if (val >= addr && val < toaddr) - bfd_put_32 (abfd, val - count, - ocontents + irelscan->r_vaddr - o->vma); - - coff_section_data (abfd, o)->keep_contents = true; - } - } - } - - /* Adjusting the internal symbols will not work if something has - already retrieved the generic symbols. It would be possible to - make this work by adjusting the generic symbols at the same time. - However, this case should not arise in normal usage. */ - if (obj_symbols (abfd) != NULL - || obj_raw_syments (abfd) != NULL) - { - ((*_bfd_error_handler) - ("%s: fatal: generic symbols retrieved before relaxing", - bfd_get_filename (abfd))); - bfd_set_error (bfd_error_invalid_operation); - return false; - } - - /* Adjust all the symbols. */ - sym_hash = obj_coff_sym_hashes (abfd); - symesz = bfd_coff_symesz (abfd); - esym = (bfd_byte *) obj_coff_external_syms (abfd); - esymend = esym + obj_raw_syment_count (abfd) * symesz; - while (esym < esymend) - { - struct internal_syment isym; - - bfd_coff_swap_sym_in (abfd, (PTR) esym, (PTR) &isym); - - if (isym.n_scnum == sec->target_index - && (bfd_vma) isym.n_value > addr - && (bfd_vma) isym.n_value < toaddr) - { - isym.n_value -= count; - - bfd_coff_swap_sym_out (abfd, (PTR) &isym, (PTR) esym); - - if (*sym_hash != NULL) - { - BFD_ASSERT ((*sym_hash)->root.type == bfd_link_hash_defined - || (*sym_hash)->root.type == bfd_link_hash_defweak); - BFD_ASSERT ((*sym_hash)->root.u.def.value >= addr - && (*sym_hash)->root.u.def.value < toaddr); - (*sym_hash)->root.u.def.value -= count; - } - } - - esym += (isym.n_numaux + 1) * symesz; - sym_hash += isym.n_numaux + 1; - } - - /* See if we can move the ALIGN reloc forward. We have adjusted - r_vaddr for it already. */ - if (irelalign != NULL) - { - bfd_vma alignto, alignaddr; - - alignto = BFD_ALIGN (toaddr, 1 << irelalign->r_offset); - alignaddr = BFD_ALIGN (irelalign->r_vaddr - sec->vma, - 1 << irelalign->r_offset); - if (alignto != alignaddr) - { - /* Tail recursion. */ - return sh_relax_delete_bytes (abfd, sec, alignaddr, - alignto - alignaddr); - } - } - - return true; -} - -/* This is yet another version of the SH opcode table, used to rapidly - get information about a particular instruction. */ - -/* The opcode map is represented by an array of these structures. The - array is indexed by the high order four bits in the instruction. */ - -struct sh_major_opcode -{ - /* A pointer to the instruction list. This is an array which - contains all the instructions with this major opcode. */ - const struct sh_minor_opcode *minor_opcodes; - /* The number of elements in minor_opcodes. */ - unsigned short count; -}; - -/* This structure holds information for a set of SH opcodes. The - instruction code is anded with the mask value, and the resulting - value is used to search the order opcode list. */ - -struct sh_minor_opcode -{ - /* The sorted opcode list. */ - const struct sh_opcode *opcodes; - /* The number of elements in opcodes. */ - unsigned short count; - /* The mask value to use when searching the opcode list. */ - unsigned short mask; -}; - -/* This structure holds information for an SH instruction. An array - of these structures is sorted in order by opcode. */ - -struct sh_opcode -{ - /* The code for this instruction, after it has been anded with the - mask value in the sh_major_opcode structure. */ - unsigned short opcode; - /* Flags for this instruction. */ - unsigned short flags; -}; - -/* Flag which appear in the sh_opcode structure. */ - -/* This instruction loads a value from memory. */ -#define LOAD (0x1) - -/* This instruction stores a value to memory. */ -#define STORE (0x2) - -/* This instruction is a branch. */ -#define BRANCH (0x4) - -/* This instruction has a delay slot. */ -#define DELAY (0x8) - -/* This instruction uses the value in the register in the field at - mask 0x0f00 of the instruction. */ -#define USES1 (0x10) - -/* This instruction uses the value in the register in the field at - mask 0x00f0 of the instruction. */ -#define USES2 (0x20) - -/* This instruction uses the value in register 0. */ -#define USESR0 (0x40) - -/* This instruction sets the value in the register in the field at - mask 0x0f00 of the instruction. */ -#define SETS1 (0x80) - -/* This instruction sets the value in the register in the field at - mask 0x00f0 of the instruction. */ -#define SETS2 (0x100) - -/* This instruction sets register 0. */ -#define SETSR0 (0x200) - -/* This instruction sets a special register. */ -#define SETSSP (0x400) - -/* This instruction uses a special register. */ -#define USESSP (0x800) - -/* This instruction uses the floating point register in the field at - mask 0x0f00 of the instruction. */ -#define USESF1 (0x1000) - -/* This instruction uses the floating point register in the field at - mask 0x00f0 of the instruction. */ -#define USESF2 (0x2000) - -/* This instruction uses floating point register 0. */ -#define USESF0 (0x4000) - -/* This instruction sets the floating point register in the field at - mask 0x0f00 of the instruction. */ -#define SETSF1 (0x8000) - -static boolean sh_insn_uses_reg - PARAMS ((unsigned int, const struct sh_opcode *, unsigned int)); -static boolean sh_insn_uses_freg - PARAMS ((unsigned int, const struct sh_opcode *, unsigned int)); -static boolean sh_insns_conflict - PARAMS ((unsigned int, const struct sh_opcode *, unsigned int, - const struct sh_opcode *)); -static boolean sh_load_use - PARAMS ((unsigned int, const struct sh_opcode *, unsigned int, - const struct sh_opcode *)); - -/* The opcode maps. */ - -#define MAP(a) a, sizeof a / sizeof a[0] - -static const struct sh_opcode sh_opcode00[] = -{ - { 0x0008, SETSSP }, /* clrt */ - { 0x0009, 0 }, /* nop */ - { 0x000b, BRANCH | DELAY | USESSP }, /* rts */ - { 0x0018, SETSSP }, /* sett */ - { 0x0019, SETSSP }, /* div0u */ - { 0x001b, 0 }, /* sleep */ - { 0x0028, SETSSP }, /* clrmac */ - { 0x002b, BRANCH | DELAY | SETSSP }, /* rte */ - { 0x0038, USESSP | SETSSP }, /* ldtlb */ - { 0x0048, SETSSP }, /* clrs */ - { 0x0058, SETSSP } /* sets */ -}; - -static const struct sh_opcode sh_opcode01[] = -{ - { 0x0002, SETS1 | USESSP }, /* stc sr,rn */ - { 0x0003, BRANCH | DELAY | USES1 | SETSSP }, /* bsrf rn */ - { 0x000a, SETS1 | USESSP }, /* sts mach,rn */ - { 0x0012, SETS1 | USESSP }, /* stc gbr,rn */ - { 0x001a, SETS1 | USESSP }, /* sts macl,rn */ - { 0x0022, SETS1 | USESSP }, /* stc vbr,rn */ - { 0x0023, BRANCH | DELAY | USES1 }, /* braf rn */ - { 0x0029, SETS1 | USESSP }, /* movt rn */ - { 0x002a, SETS1 | USESSP }, /* sts pr,rn */ - { 0x0032, SETS1 | USESSP }, /* stc ssr,rn */ - { 0x0042, SETS1 | USESSP }, /* stc spc,rn */ - { 0x005a, SETS1 | USESSP }, /* sts fpul,rn */ - { 0x006a, SETS1 | USESSP }, /* sts fpscr,rn */ - { 0x0082, SETS1 | USESSP }, /* stc r0_bank,rn */ - { 0x0083, LOAD | USES1 }, /* pref @rn */ - { 0x0092, SETS1 | USESSP }, /* stc r1_bank,rn */ - { 0x00a2, SETS1 | USESSP }, /* stc r2_bank,rn */ - { 0x00b2, SETS1 | USESSP }, /* stc r3_bank,rn */ - { 0x00c2, SETS1 | USESSP }, /* stc r4_bank,rn */ - { 0x00d2, SETS1 | USESSP }, /* stc r5_bank,rn */ - { 0x00e2, SETS1 | USESSP }, /* stc r6_bank,rn */ - { 0x00f2, SETS1 | USESSP } /* stc r7_bank,rn */ -}; - -static const struct sh_opcode sh_opcode02[] = -{ - { 0x0004, STORE | USES1 | USES2 | USESR0 }, /* mov.b rm,@(r0,rn) */ - { 0x0005, STORE | USES1 | USES2 | USESR0 }, /* mov.w rm,@(r0,rn) */ - { 0x0006, STORE | USES1 | USES2 | USESR0 }, /* mov.l rm,@(r0,rn) */ - { 0x0007, SETSSP | USES1 | USES2 }, /* mul.l rm,rn */ - { 0x000c, LOAD | SETS1 | USES2 | USESR0 }, /* mov.b @(r0,rm),rn */ - { 0x000d, LOAD | SETS1 | USES2 | USESR0 }, /* mov.w @(r0,rm),rn */ - { 0x000e, LOAD | SETS1 | USES2 | USESR0 }, /* mov.l @(r0,rm),rn */ - { 0x000f, LOAD|SETS1|SETS2|SETSSP|USES1|USES2|USESSP }, /* mac.l @rm+,@rn+ */ -}; - -static const struct sh_minor_opcode sh_opcode0[] = -{ - { MAP (sh_opcode00), 0xffff }, - { MAP (sh_opcode01), 0xf0ff }, - { MAP (sh_opcode02), 0xf00f } -}; - -static const struct sh_opcode sh_opcode10[] = -{ - { 0x1000, STORE | USES1 | USES2 } /* mov.l rm,@(disp,rn) */ -}; - -static const struct sh_minor_opcode sh_opcode1[] = -{ - { MAP (sh_opcode10), 0xf000 } -}; - -static const struct sh_opcode sh_opcode20[] = -{ - { 0x2000, STORE | USES1 | USES2 }, /* mov.b rm,@rn */ - { 0x2001, STORE | USES1 | USES2 }, /* mov.w rm,@rn */ - { 0x2002, STORE | USES1 | USES2 }, /* mov.l rm,@rn */ - { 0x2004, STORE | SETS1 | USES1 | USES2 }, /* mov.b rm,@-rn */ - { 0x2005, STORE | SETS1 | USES1 | USES2 }, /* mov.w rm,@-rn */ - { 0x2006, STORE | SETS1 | USES1 | USES2 }, /* mov.l rm,@-rn */ - { 0x2007, SETSSP | USES1 | USES2 | USESSP }, /* div0s */ - { 0x2008, SETSSP | USES1 | USES2 }, /* tst rm,rn */ - { 0x2009, SETS1 | USES1 | USES2 }, /* and rm,rn */ - { 0x200a, SETS1 | USES1 | USES2 }, /* xor rm,rn */ - { 0x200b, SETS1 | USES1 | USES2 }, /* or rm,rn */ - { 0x200c, SETSSP | USES1 | USES2 }, /* cmp/str rm,rn */ - { 0x200d, SETS1 | USES1 | USES2 }, /* xtrct rm,rn */ - { 0x200e, SETSSP | USES1 | USES2 }, /* mulu.w rm,rn */ - { 0x200f, SETSSP | USES1 | USES2 } /* muls.w rm,rn */ -}; - -static const struct sh_minor_opcode sh_opcode2[] = -{ - { MAP (sh_opcode20), 0xf00f } -}; - -static const struct sh_opcode sh_opcode30[] = -{ - { 0x3000, SETSSP | USES1 | USES2 }, /* cmp/eq rm,rn */ - { 0x3002, SETSSP | USES1 | USES2 }, /* cmp/hs rm,rn */ - { 0x3003, SETSSP | USES1 | USES2 }, /* cmp/ge rm,rn */ - { 0x3004, SETSSP | USESSP | USES1 | USES2 }, /* div1 rm,rn */ - { 0x3005, SETSSP | USES1 | USES2 }, /* dmulu.l rm,rn */ - { 0x3006, SETSSP | USES1 | USES2 }, /* cmp/hi rm,rn */ - { 0x3007, SETSSP | USES1 | USES2 }, /* cmp/gt rm,rn */ - { 0x3008, SETS1 | USES1 | USES2 }, /* sub rm,rn */ - { 0x300a, SETS1 | SETSSP | USES1 | USES2 | USESSP }, /* subc rm,rn */ - { 0x300b, SETS1 | SETSSP | USES1 | USES2 }, /* subv rm,rn */ - { 0x300c, SETS1 | USES1 | USES2 }, /* add rm,rn */ - { 0x300d, SETSSP | USES1 | USES2 }, /* dmuls.l rm,rn */ - { 0x300e, SETS1 | SETSSP | USES1 | USES2 | USESSP }, /* addc rm,rn */ - { 0x300f, SETS1 | SETSSP | USES1 | USES2 } /* addv rm,rn */ -}; - -static const struct sh_minor_opcode sh_opcode3[] = -{ - { MAP (sh_opcode30), 0xf00f } -}; - -static const struct sh_opcode sh_opcode40[] = -{ - { 0x4000, SETS1 | SETSSP | USES1 }, /* shll rn */ - { 0x4001, SETS1 | SETSSP | USES1 }, /* shlr rn */ - { 0x4002, STORE | SETS1 | USES1 | USESSP }, /* sts.l mach,@-rn */ - { 0x4003, STORE | SETS1 | USES1 | USESSP }, /* stc.l sr,@-rn */ - { 0x4004, SETS1 | SETSSP | USES1 }, /* rotl rn */ - { 0x4005, SETS1 | SETSSP | USES1 }, /* rotr rn */ - { 0x4006, LOAD | SETS1 | SETSSP | USES1 }, /* lds.l @rm+,mach */ - { 0x4007, LOAD | SETS1 | SETSSP | USES1 }, /* ldc.l @rm+,sr */ - { 0x4008, SETS1 | USES1 }, /* shll2 rn */ - { 0x4009, SETS1 | USES1 }, /* shlr2 rn */ - { 0x400a, SETSSP | USES1 }, /* lds rm,mach */ - { 0x400b, BRANCH | DELAY | USES1 }, /* jsr @rn */ - { 0x400e, SETSSP | USES1 }, /* ldc rm,sr */ - { 0x4010, SETS1 | SETSSP | USES1 }, /* dt rn */ - { 0x4011, SETSSP | USES1 }, /* cmp/pz rn */ - { 0x4012, STORE | SETS1 | USES1 | USESSP }, /* sts.l macl,@-rn */ - { 0x4013, STORE | SETS1 | USES1 | USESSP }, /* stc.l gbr,@-rn */ - { 0x4015, SETSSP | USES1 }, /* cmp/pl rn */ - { 0x4016, LOAD | SETS1 | SETSSP | USES1 }, /* lds.l @rm+,macl */ - { 0x4017, LOAD | SETS1 | SETSSP | USES1 }, /* ldc.l @rm+,gbr */ - { 0x4018, SETS1 | USES1 }, /* shll8 rn */ - { 0x4019, SETS1 | USES1 }, /* shlr8 rn */ - { 0x401a, SETSSP | USES1 }, /* lds rm,macl */ - { 0x401b, LOAD | SETSSP | USES1 }, /* tas.b @rn */ - { 0x401e, SETSSP | USES1 }, /* ldc rm,gbr */ - { 0x4020, SETS1 | SETSSP | USES1 }, /* shal rn */ - { 0x4021, SETS1 | SETSSP | USES1 }, /* shar rn */ - { 0x4022, STORE | SETS1 | USES1 | USESSP }, /* sts.l pr,@-rn */ - { 0x4023, STORE | SETS1 | USES1 | USESSP }, /* stc.l vbr,@-rn */ - { 0x4024, SETS1 | SETSSP | USES1 | USESSP }, /* rotcl rn */ - { 0x4025, SETS1 | SETSSP | USES1 | USESSP }, /* rotcr rn */ - { 0x4026, LOAD | SETS1 | SETSSP | USES1 }, /* lds.l @rm+,pr */ - { 0x4027, LOAD | SETS1 | SETSSP | USES1 }, /* ldc.l @rm+,vbr */ - { 0x4028, SETS1 | USES1 }, /* shll16 rn */ - { 0x4029, SETS1 | USES1 }, /* shlr16 rn */ - { 0x402a, SETSSP | USES1 }, /* lds rm,pr */ - { 0x402b, BRANCH | DELAY | USES1 }, /* jmp @rn */ - { 0x402e, SETSSP | USES1 }, /* ldc rm,vbr */ - { 0x4033, STORE | SETS1 | USES1 | USESSP }, /* stc.l ssr,@-rn */ - { 0x4037, LOAD | SETS1 | SETSSP | USES1 }, /* ldc.l @rm+,ssr */ - { 0x403e, SETSSP | USES1 }, /* ldc rm,ssr */ - { 0x4043, STORE | SETS1 | USES1 | USESSP }, /* stc.l spc,@-rn */ - { 0x4047, LOAD | SETS1 | SETSSP | USES1 }, /* ldc.l @rm+,spc */ - { 0x404e, SETSSP | USES1 }, /* ldc rm,spc */ - { 0x4052, STORE | SETS1 | USES1 | USESSP }, /* sts.l fpul,@-rn */ - { 0x4056, LOAD | SETS1 | SETSSP | USES1 }, /* lds.l @rm+,fpul */ - { 0x405a, SETSSP | USES1 }, /* lds.l rm,fpul */ - { 0x4062, STORE | SETS1 | USES1 | USESSP }, /* sts.l fpscr,@-rn */ - { 0x4066, LOAD | SETS1 | SETSSP | USES1 }, /* lds.l @rm+,fpscr */ - { 0x406a, SETSSP | USES1 } /* lds rm,fpscr */ -}; - -static const struct sh_opcode sh_opcode41[] = -{ - { 0x4083, STORE | SETS1 | USES1 | USESSP }, /* stc.l rx_bank,@-rn */ - { 0x4087, LOAD | SETS1 | SETSSP | USES1 }, /* ldc.l @rm+,rx_bank */ - { 0x408e, SETSSP | USES1 } /* ldc rm,rx_bank */ -}; - -static const struct sh_opcode sh_opcode42[] = -{ - { 0x400c, SETS1 | USES1 | USES2 }, /* shad rm,rn */ - { 0x400d, SETS1 | USES1 | USES2 }, /* shld rm,rn */ - { 0x400f, LOAD|SETS1|SETS2|SETSSP|USES1|USES2|USESSP }, /* mac.w @rm+,@rn+ */ -}; - -static const struct sh_minor_opcode sh_opcode4[] = -{ - { MAP (sh_opcode40), 0xf0ff }, - { MAP (sh_opcode41), 0xf08f }, - { MAP (sh_opcode42), 0xf00f } -}; - -static const struct sh_opcode sh_opcode50[] = -{ - { 0x5000, LOAD | SETS1 | USES2 } /* mov.l @(disp,rm),rn */ -}; - -static const struct sh_minor_opcode sh_opcode5[] = -{ - { MAP (sh_opcode50), 0xf000 } -}; - -static const struct sh_opcode sh_opcode60[] = -{ - { 0x6000, LOAD | SETS1 | USES2 }, /* mov.b @rm,rn */ - { 0x6001, LOAD | SETS1 | USES2 }, /* mov.w @rm,rn */ - { 0x6002, LOAD | SETS1 | USES2 }, /* mov.l @rm,rn */ - { 0x6003, SETS1 | USES2 }, /* mov rm,rn */ - { 0x6004, LOAD | SETS1 | SETS2 | USES2 }, /* mov.b @rm+,rn */ - { 0x6005, LOAD | SETS1 | SETS2 | USES2 }, /* mov.w @rm+,rn */ - { 0x6006, LOAD | SETS1 | SETS2 | USES2 }, /* mov.l @rm+,rn */ - { 0x6007, SETS1 | USES2 }, /* not rm,rn */ - { 0x6008, SETS1 | USES2 }, /* swap.b rm,rn */ - { 0x6009, SETS1 | USES2 }, /* swap.w rm,rn */ - { 0x600a, SETS1 | SETSSP | USES2 | USESSP }, /* negc rm,rn */ - { 0x600b, SETS1 | USES2 }, /* neg rm,rn */ - { 0x600c, SETS1 | USES2 }, /* extu.b rm,rn */ - { 0x600d, SETS1 | USES2 }, /* extu.w rm,rn */ - { 0x600e, SETS1 | USES2 }, /* exts.b rm,rn */ - { 0x600f, SETS1 | USES2 } /* exts.w rm,rn */ -}; - -static const struct sh_minor_opcode sh_opcode6[] = -{ - { MAP (sh_opcode60), 0xf00f } -}; - -static const struct sh_opcode sh_opcode70[] = -{ - { 0x7000, SETS1 | USES1 } /* add #imm,rn */ -}; - -static const struct sh_minor_opcode sh_opcode7[] = -{ - { MAP (sh_opcode70), 0xf000 } -}; - -static const struct sh_opcode sh_opcode80[] = -{ - { 0x8000, STORE | USES2 | USESR0 }, /* mov.b r0,@(disp,rn) */ - { 0x8100, STORE | USES2 | USESR0 }, /* mov.w r0,@(disp,rn) */ - { 0x8400, LOAD | SETSR0 | USES2 }, /* mov.b @(disp,rm),r0 */ - { 0x8500, LOAD | SETSR0 | USES2 }, /* mov.w @(disp,rn),r0 */ - { 0x8800, SETSSP | USESR0 }, /* cmp/eq #imm,r0 */ - { 0x8900, BRANCH | USESSP }, /* bt label */ - { 0x8b00, BRANCH | USESSP }, /* bf label */ - { 0x8d00, BRANCH | DELAY | USESSP }, /* bt/s label */ - { 0x8f00, BRANCH | DELAY | USESSP } /* bf/s label */ -}; - -static const struct sh_minor_opcode sh_opcode8[] = -{ - { MAP (sh_opcode80), 0xff00 } -}; - -static const struct sh_opcode sh_opcode90[] = -{ - { 0x9000, LOAD | SETS1 } /* mov.w @(disp,pc),rn */ -}; - -static const struct sh_minor_opcode sh_opcode9[] = -{ - { MAP (sh_opcode90), 0xf000 } -}; - -static const struct sh_opcode sh_opcodea0[] = -{ - { 0xa000, BRANCH | DELAY } /* bra label */ -}; - -static const struct sh_minor_opcode sh_opcodea[] = -{ - { MAP (sh_opcodea0), 0xf000 } -}; - -static const struct sh_opcode sh_opcodeb0[] = -{ - { 0xb000, BRANCH | DELAY } /* bsr label */ -}; - -static const struct sh_minor_opcode sh_opcodeb[] = -{ - { MAP (sh_opcodeb0), 0xf000 } -}; - -static const struct sh_opcode sh_opcodec0[] = -{ - { 0xc000, STORE | USESR0 | USESSP }, /* mov.b r0,@(disp,gbr) */ - { 0xc100, STORE | USESR0 | USESSP }, /* mov.w r0,@(disp,gbr) */ - { 0xc200, STORE | USESR0 | USESSP }, /* mov.l r0,@(disp,gbr) */ - { 0xc300, BRANCH | USESSP }, /* trapa #imm */ - { 0xc400, LOAD | SETSR0 | USESSP }, /* mov.b @(disp,gbr),r0 */ - { 0xc500, LOAD | SETSR0 | USESSP }, /* mov.w @(disp,gbr),r0 */ - { 0xc600, LOAD | SETSR0 | USESSP }, /* mov.l @(disp,gbr),r0 */ - { 0xc700, SETSR0 }, /* mova @(disp,pc),r0 */ - { 0xc800, SETSSP | USESR0 }, /* tst #imm,r0 */ - { 0xc900, SETSR0 | USESR0 }, /* and #imm,r0 */ - { 0xca00, SETSR0 | USESR0 }, /* xor #imm,r0 */ - { 0xcb00, SETSR0 | USESR0 }, /* or #imm,r0 */ - { 0xcc00, LOAD | SETSSP | USESR0 | USESSP }, /* tst.b #imm,@(r0,gbr) */ - { 0xcd00, LOAD | STORE | USESR0 | USESSP }, /* and.b #imm,@(r0,gbr) */ - { 0xce00, LOAD | STORE | USESR0 | USESSP }, /* xor.b #imm,@(r0,gbr) */ - { 0xcf00, LOAD | STORE | USESR0 | USESSP } /* or.b #imm,@(r0,gbr) */ -}; - -static const struct sh_minor_opcode sh_opcodec[] = -{ - { MAP (sh_opcodec0), 0xff00 } -}; - -static const struct sh_opcode sh_opcoded0[] = -{ - { 0xd000, LOAD | SETS1 } /* mov.l @(disp,pc),rn */ -}; - -static const struct sh_minor_opcode sh_opcoded[] = -{ - { MAP (sh_opcoded0), 0xf000 } -}; - -static const struct sh_opcode sh_opcodee0[] = -{ - { 0xe000, SETS1 } /* mov #imm,rn */ -}; - -static const struct sh_minor_opcode sh_opcodee[] = -{ - { MAP (sh_opcodee0), 0xf000 } -}; - -static const struct sh_opcode sh_opcodef0[] = -{ - { 0xf000, SETSF1 | USESF1 | USESF2 }, /* fadd fm,fn */ - { 0xf001, SETSF1 | USESF1 | USESF2 }, /* fsub fm,fn */ - { 0xf002, SETSF1 | USESF1 | USESF2 }, /* fmul fm,fn */ - { 0xf003, SETSF1 | USESF1 | USESF2 }, /* fdiv fm,fn */ - { 0xf004, SETSSP | USESF1 | USESF2 }, /* fcmp/eq fm,fn */ - { 0xf005, SETSSP | USESF1 | USESF2 }, /* fcmp/gt fm,fn */ - { 0xf006, LOAD | SETSF1 | USES2 | USESR0 }, /* fmov.s @(r0,rm),fn */ - { 0xf007, STORE | USES1 | USESF2 | USESR0 }, /* fmov.s fm,@(r0,rn) */ - { 0xf008, LOAD | SETSF1 | USES2 }, /* fmov.s @rm,fn */ - { 0xf009, LOAD | SETS2 | SETSF1 | USES2 }, /* fmov.s @rm+,fn */ - { 0xf00a, STORE | USES1 | USESF2 }, /* fmov.s fm,@rn */ - { 0xf00b, STORE | SETS1 | USES1 | USESF2 }, /* fmov.s fm,@-rn */ - { 0xf00c, SETSF1 | USESF2 }, /* fmov fm,fn */ - { 0xf00e, SETSF1 | USESF1 | USESF2 | USESF0 } /* fmac f0,fm,fn */ -}; - -static const struct sh_opcode sh_opcodef1[] = -{ - { 0xf00d, SETSF1 | USESSP }, /* fsts fpul,fn */ - { 0xf01d, SETSSP | USESF1 }, /* flds fn,fpul */ - { 0xf02d, SETSF1 | USESSP }, /* float fpul,fn */ - { 0xf03d, SETSSP | USESF1 }, /* ftrc fn,fpul */ - { 0xf04d, SETSF1 | USESF1 }, /* fneg fn */ - { 0xf05d, SETSF1 | USESF1 }, /* fabs fn */ - { 0xf06d, SETSF1 | USESF1 }, /* fsqrt fn */ - { 0xf07d, SETSSP | USESF1 }, /* ftst/nan fn */ - { 0xf08d, SETSF1 }, /* fldi0 fn */ - { 0xf09d, SETSF1 } /* fldi1 fn */ -}; - -static const struct sh_minor_opcode sh_opcodef[] = -{ - { MAP (sh_opcodef0), 0xf00f }, - { MAP (sh_opcodef1), 0xf0ff } -}; - -static const struct sh_major_opcode sh_opcodes[] = -{ - { MAP (sh_opcode0) }, - { MAP (sh_opcode1) }, - { MAP (sh_opcode2) }, - { MAP (sh_opcode3) }, - { MAP (sh_opcode4) }, - { MAP (sh_opcode5) }, - { MAP (sh_opcode6) }, - { MAP (sh_opcode7) }, - { MAP (sh_opcode8) }, - { MAP (sh_opcode9) }, - { MAP (sh_opcodea) }, - { MAP (sh_opcodeb) }, - { MAP (sh_opcodec) }, - { MAP (sh_opcoded) }, - { MAP (sh_opcodee) }, - { MAP (sh_opcodef) } -}; - -/* Given an instruction, return a pointer to the corresponding - sh_opcode structure. Return NULL if the instruction is not - recognized. */ - -static const struct sh_opcode * -sh_insn_info (insn) - unsigned int insn; -{ - const struct sh_major_opcode *maj; - const struct sh_minor_opcode *min, *minend; - - maj = &sh_opcodes[(insn & 0xf000) >> 12]; - min = maj->minor_opcodes; - minend = min + maj->count; - for (; min < minend; min++) - { - unsigned int l; - const struct sh_opcode *op, *opend; - - l = insn & min->mask; - op = min->opcodes; - opend = op + min->count; - - /* Since the opcodes tables are sorted, we could use a binary - search here if the count were above some cutoff value. */ - for (; op < opend; op++) - if (op->opcode == l) - return op; - } - - return NULL; -} - -/* See whether an instruction uses a general purpose register. */ - -static boolean -sh_insn_uses_reg (insn, op, reg) - unsigned int insn; - const struct sh_opcode *op; - unsigned int reg; -{ - unsigned int f; - - f = op->flags; - - if ((f & USES1) != 0 - && ((insn & 0x0f00) >> 8) == reg) - return true; - if ((f & USES2) != 0 - && ((insn & 0x00f0) >> 4) == reg) - return true; - if ((f & USESR0) != 0 - && reg == 0) - return true; - - return false; -} - -/* See whether an instruction uses a floating point register. */ - -static boolean -sh_insn_uses_freg (insn, op, freg) - unsigned int insn; - const struct sh_opcode *op; - unsigned int freg; -{ - unsigned int f; - - f = op->flags; - - if ((f & USESF1) != 0 - && ((insn & 0x0f00) >> 8) == freg) - return true; - if ((f & USESF2) != 0 - && ((insn & 0x00f0) >> 4) == freg) - return true; - if ((f & USESF0) != 0 - && freg == 0) - return true; - - return false; -} - -/* See whether instructions I1 and I2 conflict, assuming I1 comes - before I2. OP1 and OP2 are the corresponding sh_opcode structures. - This should return true if there is a conflict, or false if the - instructions can be swapped safely. */ - -static boolean -sh_insns_conflict (i1, op1, i2, op2) - unsigned int i1; - const struct sh_opcode *op1; - unsigned int i2; - const struct sh_opcode *op2; -{ - unsigned int f1, f2; - - f1 = op1->flags; - f2 = op2->flags; - - if ((f1 & (BRANCH | DELAY)) != 0 - || (f2 & (BRANCH | DELAY)) != 0) - return true; - - if ((f1 & SETSSP) != 0 && (f2 & USESSP) != 0) - return true; - if ((f2 & SETSSP) != 0 && (f1 & USESSP) != 0) - return true; - - if ((f1 & SETS1) != 0 - && sh_insn_uses_reg (i2, op2, (i1 & 0x0f00) >> 8)) - return true; - if ((f1 & SETS2) != 0 - && sh_insn_uses_reg (i2, op2, (i1 & 0x00f0) >> 4)) - return true; - if ((f1 & SETSR0) != 0 - && sh_insn_uses_reg (i2, op2, 0)) - return true; - if ((f1 & SETSF1) != 0 - && sh_insn_uses_freg (i2, op2, (i1 & 0x0f00) >> 8)) - return true; - - if ((f2 & SETS1) != 0 - && sh_insn_uses_reg (i1, op1, (i2 & 0x0f00) >> 8)) - return true; - if ((f2 & SETS2) != 0 - && sh_insn_uses_reg (i1, op1, (i2 & 0x00f0) >> 4)) - return true; - if ((f2 & SETSR0) != 0 - && sh_insn_uses_reg (i1, op1, 0)) - return true; - if ((f2 & SETSF1) != 0 - && sh_insn_uses_freg (i1, op1, (i2 & 0x0f00) >> 8)) - return true; - - /* The instructions do not conflict. */ - return false; -} - -/* I1 is a load instruction, and I2 is some other instruction. Return - true if I1 loads a register which I2 uses. */ - -static boolean -sh_load_use (i1, op1, i2, op2) - unsigned int i1; - const struct sh_opcode *op1; - unsigned int i2; - const struct sh_opcode *op2; -{ - unsigned int f1; - - f1 = op1->flags; - - if ((f1 & LOAD) == 0) - return false; - - /* If both SETS1 and SETSSP are set, that means a load to a special - register using postincrement addressing mode, which we don't care - about here. */ - if ((f1 & SETS1) != 0 - && (f1 & SETSSP) == 0 - && sh_insn_uses_reg (i2, op2, (i1 & 0x0f00) >> 8)) - return true; - - if ((f1 & SETSR0) != 0 - && sh_insn_uses_reg (i2, op2, 0)) - return true; - - if ((f1 & SETSF1) != 0 - && sh_insn_uses_freg (i2, op2, (i1 & 0x0f00) >> 8)) - return true; - - return false; -} - -/* Try to align loads and stores within a span of memory. This is - called by both the ELF and the COFF sh targets. ABFD and SEC are - the BFD and section we are examining. CONTENTS is the contents of - the section. SWAP is the routine to call to swap two instructions. - RELOCS is a pointer to the internal relocation information, to be - passed to SWAP. PLABEL is a pointer to the current label in a - sorted list of labels; LABEL_END is the end of the list. START and - STOP are the range of memory to examine. If a swap is made, - *PSWAPPED is set to true. */ - -boolean -_bfd_sh_align_load_span (abfd, sec, contents, swap, relocs, - plabel, label_end, start, stop, pswapped) - bfd *abfd; - asection *sec; - bfd_byte *contents; - boolean (*swap) PARAMS ((bfd *, asection *, PTR, bfd_byte *, bfd_vma)); - PTR relocs; - bfd_vma **plabel; - bfd_vma *label_end; - bfd_vma start; - bfd_vma stop; - boolean *pswapped; -{ - bfd_vma i; - - /* Instructions should be aligned on 2 byte boundaries. */ - if ((start & 1) == 1) - ++start; - - /* Now look through the unaligned addresses. */ - i = start; - if ((i & 2) == 0) - i += 2; - for (; i < stop; i += 4) - { - unsigned int insn; - const struct sh_opcode *op; - unsigned int prev_insn = 0; - const struct sh_opcode *prev_op = NULL; - - insn = bfd_get_16 (abfd, contents + i); - op = sh_insn_info (insn); - if (op == NULL - || (op->flags & (LOAD | STORE)) == 0) - continue; - - /* This is a load or store which is not on a four byte boundary. */ - - while (*plabel < label_end && **plabel < i) - ++*plabel; - - if (i > start) - { - prev_insn = bfd_get_16 (abfd, contents + i - 2); - prev_op = sh_insn_info (prev_insn); - - /* If the load/store instruction is in a delay slot, we - can't swap. */ - if (prev_op == NULL - || (prev_op->flags & DELAY) != 0) - continue; - } - if (i > start - && (*plabel >= label_end || **plabel != i) - && prev_op != NULL - && (prev_op->flags & (LOAD | STORE)) == 0 - && ! sh_insns_conflict (prev_insn, prev_op, insn, op)) - { - boolean ok; - - /* The load/store instruction does not have a label, and - there is a previous instruction; PREV_INSN is not - itself a load/store instruction, and PREV_INSN and - INSN do not conflict. */ - - ok = true; - - if (i >= start + 4) - { - unsigned int prev2_insn; - const struct sh_opcode *prev2_op; - - prev2_insn = bfd_get_16 (abfd, contents + i - 4); - prev2_op = sh_insn_info (prev2_insn); - - /* If the instruction before PREV_INSN has a delay - slot--that is, PREV_INSN is in a delay slot--we - can not swap. */ - if (prev2_op == NULL - || (prev2_op->flags & DELAY) != 0) - ok = false; - - /* If the instruction before PREV_INSN is a load, - and it sets a register which INSN uses, then - putting INSN immediately after PREV_INSN will - cause a pipeline bubble, so there is no point to - making the swap. */ - if (ok - && (prev2_op->flags & LOAD) != 0 - && sh_load_use (prev2_insn, prev2_op, insn, op)) - ok = false; - } - - if (ok) - { - if (! (*swap) (abfd, sec, relocs, contents, i - 2)) - return false; - *pswapped = true; - continue; - } - } - - while (*plabel < label_end && **plabel < i + 2) - ++*plabel; - - if (i + 2 < stop - && (*plabel >= label_end || **plabel != i + 2)) - { - unsigned int next_insn; - const struct sh_opcode *next_op; - - /* There is an instruction after the load/store - instruction, and it does not have a label. */ - next_insn = bfd_get_16 (abfd, contents + i + 2); - next_op = sh_insn_info (next_insn); - if (next_op != NULL - && (next_op->flags & (LOAD | STORE)) == 0 - && ! sh_insns_conflict (insn, op, next_insn, next_op)) - { - boolean ok; - - /* NEXT_INSN is not itself a load/store instruction, - and it does not conflict with INSN. */ - - ok = true; - - /* If PREV_INSN is a load, and it sets a register - which NEXT_INSN uses, then putting NEXT_INSN - immediately after PREV_INSN will cause a pipeline - bubble, so there is no reason to make this swap. */ - if (prev_op != NULL - && (prev_op->flags & LOAD) != 0 - && sh_load_use (prev_insn, prev_op, next_insn, next_op)) - ok = false; - - /* If INSN is a load, and it sets a register which - the insn after NEXT_INSN uses, then doing the - swap will cause a pipeline bubble, so there is no - reason to make the swap. However, if the insn - after NEXT_INSN is itself a load or store - instruction, then it is misaligned, so - optimistically hope that it will be swapped - itself, and just live with the pipeline bubble if - it isn't. */ - if (ok - && i + 4 < stop - && (op->flags & LOAD) != 0) - { - unsigned int next2_insn; - const struct sh_opcode *next2_op; - - next2_insn = bfd_get_16 (abfd, contents + i + 4); - next2_op = sh_insn_info (next2_insn); - if ((next2_op->flags & (LOAD | STORE)) == 0 - && sh_load_use (insn, op, next2_insn, next2_op)) - ok = false; - } - - if (ok) - { - if (! (*swap) (abfd, sec, relocs, contents, i)) - return false; - *pswapped = true; - continue; - } - } - } - } - - return true; -} - -/* Look for loads and stores which we can align to four byte - boundaries. See the longer comment above sh_relax_section for why - this is desirable. This sets *PSWAPPED if some instruction was - swapped. */ - -static boolean -sh_align_loads (abfd, sec, internal_relocs, contents, pswapped) - bfd *abfd; - asection *sec; - struct internal_reloc *internal_relocs; - bfd_byte *contents; - boolean *pswapped; -{ - struct internal_reloc *irel, *irelend; - bfd_vma *labels = NULL; - bfd_vma *label, *label_end; - - *pswapped = false; - - irelend = internal_relocs + sec->reloc_count; - - /* Get all the addresses with labels on them. */ - labels = (bfd_vma *) bfd_malloc (sec->reloc_count * sizeof (bfd_vma)); - if (labels == NULL) - goto error_return; - label_end = labels; - for (irel = internal_relocs; irel < irelend; irel++) - { - if (irel->r_type == R_SH_LABEL) - { - *label_end = irel->r_vaddr - sec->vma; - ++label_end; - } - } - - /* Note that the assembler currently always outputs relocs in - address order. If that ever changes, this code will need to sort - the label values and the relocs. */ - - label = labels; - - for (irel = internal_relocs; irel < irelend; irel++) - { - bfd_vma start, stop; - - if (irel->r_type != R_SH_CODE) - continue; - - start = irel->r_vaddr - sec->vma; - - for (irel++; irel < irelend; irel++) - if (irel->r_type == R_SH_DATA) - break; - if (irel < irelend) - stop = irel->r_vaddr - sec->vma; - else - stop = sec->_cooked_size; - - if (! _bfd_sh_align_load_span (abfd, sec, contents, sh_swap_insns, - (PTR) internal_relocs, &label, - label_end, start, stop, pswapped)) - goto error_return; - } - - free (labels); - - return true; - - error_return: - if (labels != NULL) - free (labels); - return false; -} - -/* Swap two SH instructions. */ - -static boolean -sh_swap_insns (abfd, sec, relocs, contents, addr) - bfd *abfd; - asection *sec; - PTR relocs; - bfd_byte *contents; - bfd_vma addr; -{ - struct internal_reloc *internal_relocs = (struct internal_reloc *) relocs; - unsigned short i1, i2; - struct internal_reloc *irel, *irelend; - - /* Swap the instructions themselves. */ - i1 = bfd_get_16 (abfd, contents + addr); - i2 = bfd_get_16 (abfd, contents + addr + 2); - bfd_put_16 (abfd, i2, contents + addr); - bfd_put_16 (abfd, i1, contents + addr + 2); - - /* Adjust all reloc addresses. */ - irelend = internal_relocs + sec->reloc_count; - for (irel = internal_relocs; irel < irelend; irel++) - { - int type, add; - - /* There are a few special types of relocs that we don't want to - adjust. These relocs do not apply to the instruction itself, - but are only associated with the address. */ - type = irel->r_type; - if (type == R_SH_ALIGN - || type == R_SH_CODE - || type == R_SH_DATA - || type == R_SH_LABEL) - continue; - - /* If an R_SH_USES reloc points to one of the addresses being - swapped, we must adjust it. It would be incorrect to do this - for a jump, though, since we want to execute both - instructions after the jump. (We have avoided swapping - around a label, so the jump will not wind up executing an - instruction it shouldn't). */ - if (type == R_SH_USES) - { - bfd_vma off; - - off = irel->r_vaddr - sec->vma + 4 + irel->r_offset; - if (off == addr) - irel->r_offset += 2; - else if (off == addr + 2) - irel->r_offset -= 2; - } - - if (irel->r_vaddr - sec->vma == addr) - { - irel->r_vaddr += 2; - add = -2; - } - else if (irel->r_vaddr - sec->vma == addr + 2) - { - irel->r_vaddr -= 2; - add = 2; - } - else - add = 0; - - if (add != 0) - { - bfd_byte *loc; - unsigned short insn, oinsn; - boolean overflow; - - loc = contents + irel->r_vaddr - sec->vma; - overflow = false; - switch (type) - { - default: - break; - - case R_SH_PCDISP8BY2: - case R_SH_PCRELIMM8BY2: - insn = bfd_get_16 (abfd, loc); - oinsn = insn; - insn += add / 2; - if ((oinsn & 0xff00) != (insn & 0xff00)) - overflow = true; - bfd_put_16 (abfd, insn, loc); - break; - - case R_SH_PCDISP: - insn = bfd_get_16 (abfd, loc); - oinsn = insn; - insn += add / 2; - if ((oinsn & 0xf000) != (insn & 0xf000)) - overflow = true; - bfd_put_16 (abfd, insn, loc); - break; - - case R_SH_PCRELIMM8BY4: - /* This reloc ignores the least significant 3 bits of - the program counter before adding in the offset. - This means that if ADDR is at an even address, the - swap will not affect the offset. If ADDR is an at an - odd address, then the instruction will be crossing a - four byte boundary, and must be adjusted. */ - if ((addr & 3) != 0) - { - insn = bfd_get_16 (abfd, loc); - oinsn = insn; - insn += add / 2; - if ((oinsn & 0xff00) != (insn & 0xff00)) - overflow = true; - bfd_put_16 (abfd, insn, loc); - } - - break; - } - - if (overflow) - { - ((*_bfd_error_handler) - ("%s: 0x%lx: fatal: reloc overflow while relaxing", - bfd_get_filename (abfd), (unsigned long) irel->r_vaddr)); - bfd_set_error (bfd_error_bad_value); - return false; - } - } - } - - return true; -} - -/* This is a modification of _bfd_coff_generic_relocate_section, which - will handle SH relaxing. */ - -static boolean -sh_relocate_section (output_bfd, info, input_bfd, input_section, contents, - relocs, syms, sections) - 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; -{ - struct internal_reloc *rel; - struct internal_reloc *relend; - - rel = relocs; - relend = rel + input_section->reloc_count; - for (; rel < relend; rel++) - { - long symndx; - struct coff_link_hash_entry *h; - struct internal_syment *sym; - bfd_vma addend; - bfd_vma val; - reloc_howto_type *howto; - bfd_reloc_status_type rstat; - - /* Almost all relocs have to do with relaxing. If any work must - be done for them, it has been done in sh_relax_section. */ - if (rel->r_type != R_SH_IMM32 - && rel->r_type != R_SH_PCDISP) - continue; - - symndx = rel->r_symndx; - - if (symndx == -1) - { - h = NULL; - sym = NULL; - } - else - { - if (symndx < 0 - || (unsigned long) symndx >= obj_raw_syment_count (input_bfd)) - { - (*_bfd_error_handler) - ("%s: illegal symbol index %ld in relocs", - bfd_get_filename (input_bfd), symndx); - bfd_set_error (bfd_error_bad_value); - return false; - } - h = obj_coff_sym_hashes (input_bfd)[symndx]; - sym = syms + symndx; - } - - if (sym != NULL && sym->n_scnum != 0) - addend = - sym->n_value; - else - addend = 0; - - if (rel->r_type == R_SH_PCDISP) - addend -= 4; - - if (rel->r_type >= SH_COFF_HOWTO_COUNT) - howto = NULL; - else - howto = &sh_coff_howtos[rel->r_type]; - - if (howto == NULL) - { - bfd_set_error (bfd_error_bad_value); - return false; - } - - val = 0; - - if (h == NULL) - { - asection *sec; - - /* There is nothing to do for an internal PCDISP reloc. */ - if (rel->r_type == R_SH_PCDISP) - continue; - - if (symndx == -1) - { - sec = bfd_abs_section_ptr; - val = 0; - } - else - { - sec = sections[symndx]; - val = (sec->output_section->vma - + sec->output_offset - + sym->n_value - - sec->vma); - } - } - else - { - if (h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak) - { - asection *sec; - - sec = h->root.u.def.section; - val = (h->root.u.def.value - + sec->output_section->vma - + sec->output_offset); - } - else if (! info->relocateable) - { - if (! ((*info->callbacks->undefined_symbol) - (info, h->root.root.string, input_bfd, input_section, - rel->r_vaddr - input_section->vma))) - return false; - } - } - - rstat = _bfd_final_link_relocate (howto, input_bfd, input_section, - contents, - rel->r_vaddr - input_section->vma, - val, addend); - - switch (rstat) - { - default: - abort (); - case bfd_reloc_ok: - break; - case bfd_reloc_overflow: - { - const char *name; - char buf[SYMNMLEN + 1]; - - if (symndx == -1) - name = "*ABS*"; - else if (h != NULL) - name = h->root.root.string; - else if (sym->_n._n_n._n_zeroes == 0 - && sym->_n._n_n._n_offset != 0) - name = obj_coff_strings (input_bfd) + sym->_n._n_n._n_offset; - else - { - strncpy (buf, sym->_n._n_name, SYMNMLEN); - buf[SYMNMLEN] = '\0'; - name = buf; - } - - if (! ((*info->callbacks->reloc_overflow) - (info, name, howto->name, (bfd_vma) 0, input_bfd, - input_section, rel->r_vaddr - input_section->vma))) - return false; - } - } - } - - return true; -} - -/* This is a version of bfd_generic_get_relocated_section_contents - which uses sh_relocate_section. */ - -static bfd_byte * -sh_coff_get_relocated_section_contents (output_bfd, link_info, link_order, - data, relocateable, symbols) - bfd *output_bfd; - struct bfd_link_info *link_info; - struct bfd_link_order *link_order; - bfd_byte *data; - boolean relocateable; - asymbol **symbols; -{ - asection *input_section = link_order->u.indirect.section; - bfd *input_bfd = input_section->owner; - asection **sections = NULL; - struct internal_reloc *internal_relocs = NULL; - struct internal_syment *internal_syms = NULL; - - /* We only need to handle the case of relaxing, or of having a - particular set of section contents, specially. */ - if (relocateable - || coff_section_data (input_bfd, input_section) == NULL - || coff_section_data (input_bfd, input_section)->contents == NULL) - return bfd_generic_get_relocated_section_contents (output_bfd, link_info, - link_order, data, - relocateable, - symbols); - - memcpy (data, coff_section_data (input_bfd, input_section)->contents, - input_section->_raw_size); - - if ((input_section->flags & SEC_RELOC) != 0 - && input_section->reloc_count > 0) - { - bfd_size_type symesz = bfd_coff_symesz (input_bfd); - bfd_byte *esym, *esymend; - struct internal_syment *isymp; - asection **secpp; - - if (! _bfd_coff_get_external_symbols (input_bfd)) - goto error_return; - - internal_relocs = (_bfd_coff_read_internal_relocs - (input_bfd, input_section, false, (bfd_byte *) NULL, - false, (struct internal_reloc *) NULL)); - if (internal_relocs == NULL) - goto error_return; - - internal_syms = ((struct internal_syment *) - bfd_malloc (obj_raw_syment_count (input_bfd) - * sizeof (struct internal_syment))); - if (internal_syms == NULL) - goto error_return; - - sections = (asection **) bfd_malloc (obj_raw_syment_count (input_bfd) - * sizeof (asection *)); - if (sections == NULL) - goto error_return; - - isymp = internal_syms; - secpp = sections; - esym = (bfd_byte *) obj_coff_external_syms (input_bfd); - esymend = esym + obj_raw_syment_count (input_bfd) * symesz; - while (esym < esymend) - { - bfd_coff_swap_sym_in (input_bfd, (PTR) esym, (PTR) isymp); - - if (isymp->n_scnum != 0) - *secpp = coff_section_from_bfd_index (input_bfd, isymp->n_scnum); - else - { - if (isymp->n_value == 0) - *secpp = bfd_und_section_ptr; - else - *secpp = bfd_com_section_ptr; - } - - esym += (isymp->n_numaux + 1) * symesz; - secpp += isymp->n_numaux + 1; - isymp += isymp->n_numaux + 1; - } - - if (! sh_relocate_section (output_bfd, link_info, input_bfd, - input_section, data, internal_relocs, - internal_syms, sections)) - goto error_return; - - free (sections); - sections = NULL; - free (internal_syms); - internal_syms = NULL; - free (internal_relocs); - internal_relocs = NULL; - } - - return data; - - error_return: - if (internal_relocs != NULL) - free (internal_relocs); - if (internal_syms != NULL) - free (internal_syms); - if (sections != NULL) - free (sections); - return NULL; -} - -/* The target vectors. */ - -const bfd_target shcoff_vec = -{ - "coff-sh", /* name */ - bfd_target_coff_flavour, - BFD_ENDIAN_BIG, /* data byte order is big */ - BFD_ENDIAN_BIG, /* header byte order is big */ - - (HAS_RELOC | EXEC_P | /* object flags */ - HAS_LINENO | HAS_DEBUG | - HAS_SYMS | HAS_LOCALS | WP_TEXT | BFD_IS_RELAXABLE), - - (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), - '_', /* leading symbol underscore */ - '/', /* ar_pad_char */ - 15, /* 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, coff_object_p, /* bfd_check_format */ - bfd_generic_archive_p, _bfd_dummy_target}, - {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, -}; - -const bfd_target shlcoff_vec = -{ - "coff-shl", /* name */ - bfd_target_coff_flavour, - BFD_ENDIAN_LITTLE, /* data byte order is little */ - BFD_ENDIAN_LITTLE, /* header byte order is little endian too*/ - - (HAS_RELOC | EXEC_P | /* object flags */ - HAS_LINENO | HAS_DEBUG | - HAS_SYMS | HAS_LOCALS | WP_TEXT | BFD_IS_RELAXABLE), - - (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), - '_', /* leading symbol underscore */ - '/', /* 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 */ - - {_bfd_dummy_target, coff_object_p, /* bfd_check_format */ - bfd_generic_archive_p, _bfd_dummy_target}, - {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, -}; - -/* Some people want versions of the SH COFF target which do not align - to 16 byte boundaries. We implement that by adding a couple of new - target vectors. These are just like the ones above, but they - change the default section alignment. To generate them in the - assembler, use -small. To use them in the linker, use -b - coff-sh{l}-small and -oformat coff-sh{l}-small. - - Yes, this is a horrible hack. A general solution for setting - section alignment in COFF is rather complex. ELF handles this - correctly. */ - -/* Only recognize the small versions if the target was not defaulted. - Otherwise we won't recognize the non default endianness. */ - -static const bfd_target * -coff_small_object_p (abfd) - bfd *abfd; -{ - if (abfd->target_defaulted) - { - bfd_set_error (bfd_error_wrong_format); - return NULL; - } - return coff_object_p (abfd); -} - -/* Set the section alignment for the small versions. */ - -static boolean -coff_small_new_section_hook (abfd, section) - bfd *abfd; - asection *section; -{ - if (! coff_new_section_hook (abfd, section)) - return false; - - /* We must align to at least a four byte boundary, because longword - accesses must be on a four byte boundary. */ - if (section->alignment_power == COFF_DEFAULT_SECTION_ALIGNMENT_POWER) - section->alignment_power = 2; - - return true; -} - -/* This is copied from bfd_coff_std_swap_table so that we can change - the default section alignment power. */ - -static const bfd_coff_backend_data bfd_coff_small_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 -#ifdef COFF_LONG_SECTION_NAMES - true, -#else - false, -#endif - 2, - 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, - coff_link_output_has_begun, coff_final_link_postscript -}; - -#define coff_small_close_and_cleanup \ - coff_close_and_cleanup -#define coff_small_bfd_free_cached_info \ - coff_bfd_free_cached_info -#define coff_small_get_section_contents \ - coff_get_section_contents -#define coff_small_get_section_contents_in_window \ - coff_get_section_contents_in_window - -const bfd_target shcoff_small_vec = -{ - "coff-sh-small", /* name */ - bfd_target_coff_flavour, - BFD_ENDIAN_BIG, /* data byte order is big */ - BFD_ENDIAN_BIG, /* header byte order is big */ - - (HAS_RELOC | EXEC_P | /* object flags */ - HAS_LINENO | HAS_DEBUG | - HAS_SYMS | HAS_LOCALS | WP_TEXT | BFD_IS_RELAXABLE), - - (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), - '_', /* leading symbol underscore */ - '/', /* ar_pad_char */ - 15, /* 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, coff_small_object_p, /* bfd_check_format */ - bfd_generic_archive_p, _bfd_dummy_target}, - {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_small), - 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), - - (PTR) &bfd_coff_small_swap_table -}; - -const bfd_target shlcoff_small_vec = -{ - "coff-shl-small", /* name */ - bfd_target_coff_flavour, - BFD_ENDIAN_LITTLE, /* data byte order is little */ - BFD_ENDIAN_LITTLE, /* header byte order is little endian too*/ - - (HAS_RELOC | EXEC_P | /* object flags */ - HAS_LINENO | HAS_DEBUG | - HAS_SYMS | HAS_LOCALS | WP_TEXT | BFD_IS_RELAXABLE), - - (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), - '_', /* leading symbol underscore */ - '/', /* 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 */ - - {_bfd_dummy_target, coff_small_object_p, /* bfd_check_format */ - bfd_generic_archive_p, _bfd_dummy_target}, - {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_small), - 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), - - (PTR) &bfd_coff_small_swap_table -}; diff --git a/contrib/binutils/bfd/cpu-arc.c b/contrib/binutils/bfd/cpu-arc.c deleted file mode 100644 index bce59d4c99f3..000000000000 --- a/contrib/binutils/bfd/cpu-arc.c +++ /dev/null @@ -1,70 +0,0 @@ -/* BFD support for the ARC processor - Copyright 1994, 1995, 1997 Free Software Foundation, Inc. - Contributed by Doug Evans (dje@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 "libbfd.h" - -#define ARC(mach, print_name, default_p, next) \ -{ \ - 32, /* 32 bits in a word */ \ - 32, /* 32 bits in an address */ \ - 8, /* 8 bits in a byte */ \ - bfd_arch_arc, \ - mach, \ - "arc", \ - print_name, \ - 4, /* section alignment power */ \ - default_p, \ - bfd_default_compatible, \ - bfd_default_scan, \ - next, \ - } - -#if 0 /* ??? Not currently needed, but keep in for future reference. */ -static const bfd_arch_info_type arch_info_struct[] = -{ - ARC (bfd_mach_arc_foo, "arc-foo", false, &arch_info_struct[1]), - ARC (bfd_mach_arc_bar, "arc-bar", false, 0), -}; -#endif - -const bfd_arch_info_type bfd_arc_arch = - ARC (bfd_mach_arc_base, "arc-base", true, 0 /*&arch_info_struct[0]*/); - -/* Utility routines. */ - -/* Given cpu type NAME, return its bfd_mach_arc_xxx value. - Returns -1 if not found. */ - -int -arc_get_mach (name) - char *name; -{ - const bfd_arch_info_type *p; - - for (p = &bfd_arc_arch; p != NULL; p = p->next) - { - /* +4: skip over "arc-" */ - if (strcmp (name, p->printable_name + 4) == 0) - return p->mach; - } - return -1; -} diff --git a/contrib/binutils/bfd/cpu-mips.c b/contrib/binutils/bfd/cpu-mips.c deleted file mode 100644 index a933b8cd10bc..000000000000 --- a/contrib/binutils/bfd/cpu-mips.c +++ /dev/null @@ -1,88 +0,0 @@ -/* bfd back-end for mips support - Copyright (C) 1990, 91-97, 1998 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" - -#define N(BITS_WORD, BITS_ADDR, NUMBER, PRINT, DEFAULT, NEXT) \ - { \ - BITS_WORD, /* bits in a word */ \ - BITS_ADDR, /* bits in an address */ \ - 8, /* 8 bits in a byte */ \ - bfd_arch_mips, \ - NUMBER, \ - "mips", \ - PRINT, \ - 3, \ - DEFAULT, \ - bfd_default_compatible, \ - bfd_default_scan, \ - NEXT, \ - } - -enum { -I_mips3000, -I_mips3900, -I_mips4000, -I_mips4010, -I_mips4100, -I_mips4111, -I_mips4300, -I_mips4400, -I_mips4600, -I_mips4650, -I_mips5000, -I_mips6000, -I_mips8000, -I_mips10000, -I_mips16 -}; - - -#define NN(index) (&arch_info_struct[(index)+1]) - -static const bfd_arch_info_type arch_info_struct[] = -{ - N (32, 32, bfd_mach_mips3000, "mips:3000", false, NN(I_mips3000)), - N (32, 32, bfd_mach_mips3900, "mips:3900", false, NN(I_mips3900)), - N (64, 64, bfd_mach_mips4000, "mips:4000", false, NN(I_mips4000)), - N (64, 64, bfd_mach_mips4010, "mips:4010", false, NN(I_mips4010)), - N (64, 64, bfd_mach_mips4100, "mips:4100", false, NN(I_mips4100)), - N (64, 64, bfd_mach_mips4111, "mips:4111", false, NN(I_mips4111)), - N (64, 64, bfd_mach_mips4300, "mips:4300", false, NN(I_mips4300)), - N (64, 64, bfd_mach_mips4400, "mips:4400", false, NN(I_mips4400)), - N (64, 64, bfd_mach_mips4600, "mips:4600", false, NN(I_mips4600)), - N (64, 64, bfd_mach_mips4650, "mips:4650", false, NN(I_mips4650)), - N (64, 64, bfd_mach_mips5000, "mips:5000", false, NN(I_mips5000)), - N (32, 32, bfd_mach_mips6000, "mips:6000", false, NN(I_mips6000)), - N (64, 64, bfd_mach_mips8000, "mips:8000", false, NN(I_mips8000)), - N (64, 64, bfd_mach_mips10000, "mips:10000", false, NN(I_mips10000)), - - - N (64, 64, bfd_mach_mips16, "mips:16", false, 0), -}; - -/* The default architecture is mips:3000, but with a machine number of - zero. This lets the linker distinguish between a default setting - of mips, and an explicit setting of mips:3000. */ - -const bfd_arch_info_type bfd_mips_arch = -N (32, 32, 0, "mips", true, &arch_info_struct[0]); diff --git a/contrib/binutils/bfd/cpu-sh.c b/contrib/binutils/bfd/cpu-sh.c deleted file mode 100644 index 9f7ef2021421..000000000000 --- a/contrib/binutils/bfd/cpu-sh.c +++ /dev/null @@ -1,117 +0,0 @@ -/* BFD library support routines for the Hitachi-SH architecture. - Copyright (C) 1993 Free Software Foundation, Inc. - Hacked 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" - - -static boolean -scan_mach (info, string) - const struct bfd_arch_info *info; - const char *string; -{ - if (strcasecmp (info->printable_name, string) == 0) - return true; - return false; -} - - -#if 0 -/* This routine is provided two arch_infos and returns whether - they'd be compatible */ - -static const bfd_arch_info_type * -compatible (a,b) - const bfd_arch_info_type *a; - const bfd_arch_info_type *b; -{ - if (a->arch != b->arch || a->mach != b->mach) - return NULL; - return a; -} -#endif - -#define SH_NEXT &arch_info_struct[0] -#define SH3_NEXT &arch_info_struct[1] -#define SH3E_NEXT &arch_info_struct[2] -#define SH4_NEXT NULL - -static const bfd_arch_info_type arch_info_struct[] = -{ - { - 32, /* 32 bits in a word */ - 32, /* 32 bits in an address */ - 8, /* 8 bits in a byte */ - bfd_arch_sh, - bfd_mach_sh3, - "sh", /* arch_name */ - "sh3", /* printable name */ - 1, - false, /* not the default */ - bfd_default_compatible, - scan_mach, - SH3_NEXT - }, - { - 32, /* 32 bits in a word */ - 32, /* 32 bits in an address */ - 8, /* 8 bits in a byte */ - bfd_arch_sh, - bfd_mach_sh3e, - "sh", /* arch_name */ - "sh3e", /* printable name */ - 1, - false, /* not the default */ - bfd_default_compatible, - scan_mach, - SH3E_NEXT - }, - { - 32, /* 32 bits in a word */ - 32, /* 32 bits in an address */ - 8, /* 8 bits in a byte */ - bfd_arch_sh, - bfd_mach_sh4, - "sh", /* arch_name */ - "sh4", /* printable name */ - 1, - false, /* not the default */ - bfd_default_compatible, - scan_mach, - SH4_NEXT - }, -}; - -const bfd_arch_info_type bfd_sh_arch = -{ - 32, /* 32 bits in a word */ - 32, /* 32 bits in an address */ - 8, /* 8 bits in a byte */ - bfd_arch_sh, - bfd_mach_sh, - "sh", /* arch_name */ - "sh", /* printable name */ - 1, - true, /* the default machine */ - bfd_default_compatible, - scan_mach, - SH_NEXT -}; diff --git a/contrib/binutils/bfd/doc/bfd.texi b/contrib/binutils/bfd/doc/bfd.texi deleted file mode 100644 index ea0ca9e56dc9..000000000000 --- a/contrib/binutils/bfd/doc/bfd.texi +++ /dev/null @@ -1,585 +0,0 @@ -@section @code{typedef bfd} -A BFD has type @code{bfd}; 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 @code{bfd}. It -contains the major data about the file and pointers -to the rest of the data. -@* -. -@example -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 `@code{bfd.h}', 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. This is a - struct objalloc *, but we use PTR to avoid requiring the inclusion of - objalloc.h. */ - PTR memory; -@}; - -@end example -@section Error reporting -Most BFD functions return nonzero on success (check their -individual documentation for precise semantics). On an error, -they call @code{bfd_set_error} to set an error condition that callers -can check by calling @code{bfd_get_error}. -If that returns @code{bfd_error_system_call}, then check -@code{errno}. - -The easiest way to report a BFD error to the user is to -use @code{bfd_perror}. -@* -@subsection Type @code{bfd_error_type} -The values returned by @code{bfd_get_error} are defined by the -enumerated type @code{bfd_error_type}. -@* -. -@example -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; - -@end example -@findex bfd_get_error -@subsubsection @code{bfd_get_error} -@strong{Synopsis} -@example -bfd_error_type bfd_get_error (void); -@end example -@strong{Description}@* -Return the current BFD error condition. -@* -@findex bfd_set_error -@subsubsection @code{bfd_set_error} -@strong{Synopsis} -@example -void bfd_set_error (bfd_error_type error_tag); -@end example -@strong{Description}@* -Set the BFD error condition to be @var{error_tag}. -@* -@findex bfd_errmsg -@subsubsection @code{bfd_errmsg} -@strong{Synopsis} -@example -CONST char *bfd_errmsg (bfd_error_type error_tag); -@end example -@strong{Description}@* -Return a string describing the error @var{error_tag}, or -the system error if @var{error_tag} is @code{bfd_error_system_call}. -@* -@findex bfd_perror -@subsubsection @code{bfd_perror} -@strong{Synopsis} -@example -void bfd_perror (CONST char *message); -@end example -@strong{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. -@* -@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. -@* -. -@example -typedef void (*bfd_error_handler_type) PARAMS ((const char *, ...)); - -@end example -@findex bfd_set_error_handler -@subsubsection @code{bfd_set_error_handler} -@strong{Synopsis} -@example -bfd_error_handler_type bfd_set_error_handler (bfd_error_handler_type); -@end example -@strong{Description}@* -Set the BFD error handler function. Returns the previous -function. -@* -@findex bfd_set_error_program_name -@subsubsection @code{bfd_set_error_program_name} -@strong{Synopsis} -@example -void bfd_set_error_program_name (const char *); -@end example -@strong{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. -@* -@section Symbols - -@* -@findex bfd_get_reloc_upper_bound -@subsubsection @code{bfd_get_reloc_upper_bound} -@strong{Synopsis} -@example -long bfd_get_reloc_upper_bound(bfd *abfd, asection *sect); -@end example -@strong{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. -@* -@findex bfd_canonicalize_reloc -@subsubsection @code{bfd_canonicalize_reloc} -@strong{Synopsis} -@example -long bfd_canonicalize_reloc - (bfd *abfd, - asection *sec, - arelent **loc, - asymbol **syms); -@end example -@strong{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 -@code{bfd_get_reloc_upper_bound}. Returns the number of relocs, or --1 on error. - -The @var{syms} table is also needed for horrible internal magic -reasons. -@* -@findex bfd_set_reloc -@subsubsection @code{bfd_set_reloc} -@strong{Synopsis} -@example -void bfd_set_reloc - (bfd *abfd, asection *sec, arelent **rel, unsigned int count) -@end example -@strong{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. -@* -@findex bfd_set_file_flags -@subsubsection @code{bfd_set_file_flags} -@strong{Synopsis} -@example -boolean bfd_set_file_flags(bfd *abfd, flagword flags); -@end example -@strong{Description}@* -Set the flag word in the BFD @var{abfd} to the value @var{flags}. - -Possible errors are: -@itemize @bullet - -@item -@code{bfd_error_wrong_format} - The target bfd was not of object format. -@item -@code{bfd_error_invalid_operation} - The target bfd was open for reading. -@item -@code{bfd_error_invalid_operation} - -The flag word contained a bit which was not applicable to the -type of file. E.g., an attempt was made to set the @code{D_PAGED} bit -on a BFD format which does not support demand paging. -@end itemize -@* -@findex bfd_set_start_address -@subsubsection @code{bfd_set_start_address} -@strong{Synopsis} -@example -boolean bfd_set_start_address(bfd *abfd, bfd_vma vma); -@end example -@strong{Description}@* -Make @var{vma} the entry point of output BFD @var{abfd}. -@* -@strong{Returns}@* -Returns @code{true} on success, @code{false} otherwise. -@* -@findex bfd_get_mtime -@subsubsection @code{bfd_get_mtime} -@strong{Synopsis} -@example -long bfd_get_mtime(bfd *abfd); -@end example -@strong{Description}@* -Return the file modification time (as read from the file system, or -from the archive header for archive members). -@* -@findex bfd_get_size -@subsubsection @code{bfd_get_size} -@strong{Synopsis} -@example -long bfd_get_size(bfd *abfd); -@end example -@strong{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 @code{sizeof(long)} 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?". -@* -@findex bfd_get_gp_size -@subsubsection @code{bfd_get_gp_size} -@strong{Synopsis} -@example -int bfd_get_gp_size(bfd *abfd); -@end example -@strong{Description}@* -Return the maximum size of objects to be optimized using the GP -register under MIPS ECOFF. This is typically set by the @code{-G} -argument to the compiler, assembler or linker. -@* -@findex bfd_set_gp_size -@subsubsection @code{bfd_set_gp_size} -@strong{Synopsis} -@example -void bfd_set_gp_size(bfd *abfd, int i); -@end example -@strong{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 @code{-G} argument to the compiler, assembler or linker. -@* -@findex bfd_scan_vma -@subsubsection @code{bfd_scan_vma} -@strong{Synopsis} -@example -bfd_vma bfd_scan_vma(CONST char *string, CONST char **end, int base); -@end example -@strong{Description}@* -Convert, like @code{strtoul}, a numerical expression -@var{string} into a @code{bfd_vma} integer, and return that integer. -(Though without as many bells and whistles as @code{strtoul}.) -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. -@* -@findex bfd_copy_private_bfd_data -@subsubsection @code{bfd_copy_private_bfd_data} -@strong{Synopsis} -@example -boolean bfd_copy_private_bfd_data(bfd *ibfd, bfd *obfd); -@end example -@strong{Description}@* -Copy private BFD information from the BFD @var{ibfd} to the -the BFD @var{obfd}. Return @code{true} on success, @code{false} on error. -Possible error returns are: - -@itemize @bullet - -@item -@code{bfd_error_no_memory} - -Not enough memory exists to create private data for @var{obfd}. -@end itemize -@example -#define bfd_copy_private_bfd_data(ibfd, obfd) \ - BFD_SEND (obfd, _bfd_copy_private_bfd_data, \ - (ibfd, obfd)) -@end example -@* -@findex bfd_merge_private_bfd_data -@subsubsection @code{bfd_merge_private_bfd_data} -@strong{Synopsis} -@example -boolean bfd_merge_private_bfd_data(bfd *ibfd, bfd *obfd); -@end example -@strong{Description}@* -Merge private BFD information from the BFD @var{ibfd} to the -the output file BFD @var{obfd} when linking. Return @code{true} -on success, @code{false} on error. Possible error returns are: - -@itemize @bullet - -@item -@code{bfd_error_no_memory} - -Not enough memory exists to create private data for @var{obfd}. -@end itemize -@example -#define bfd_merge_private_bfd_data(ibfd, obfd) \ - BFD_SEND (obfd, _bfd_merge_private_bfd_data, \ - (ibfd, obfd)) -@end example -@* -@findex bfd_set_private_flags -@subsubsection @code{bfd_set_private_flags} -@strong{Synopsis} -@example -boolean bfd_set_private_flags(bfd *abfd, flagword flags); -@end example -@strong{Description}@* -Set private BFD flag information in the BFD @var{abfd}. -Return @code{true} on success, @code{false} on error. Possible error -returns are: - -@itemize @bullet - -@item -@code{bfd_error_no_memory} - -Not enough memory exists to create private data for @var{obfd}. -@end itemize -@example -#define bfd_set_private_flags(abfd, flags) \ - BFD_SEND (abfd, _bfd_set_private_flags, \ - (abfd, flags)) -@end example -@* -@findex stuff -@subsubsection @code{stuff} -@strong{Description}@* -Stuff which should be documented: -@example -#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 **)); - -@end example -@* diff --git a/contrib/binutils/bfd/elf32-arc.c b/contrib/binutils/bfd/elf32-arc.c deleted file mode 100644 index 318dc704e06c..000000000000 --- a/contrib/binutils/bfd/elf32-arc.c +++ /dev/null @@ -1,213 +0,0 @@ -/* ARC-specific support for 32-bit ELF - Copyright (C) 1994, 1995, 1997, 1999 Free Software Foundation, Inc. - Contributed by Doug Evans (dje@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 "libbfd.h" -#include "elf-bfd.h" -#include "elf/arc.h" - -static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup - PARAMS ((bfd *abfd, bfd_reloc_code_real_type code)); -static void arc_info_to_howto_rel - PARAMS ((bfd *, arelent *, Elf32_Internal_Rel *)); -static boolean arc_elf_object_p PARAMS ((bfd *)); -static void arc_elf_final_write_processing PARAMS ((bfd *, boolean)); - -/* Try to minimize the amount of space occupied by relocation tables - on the ROM (not that the ROM won't be swamped by other ELF overhead). */ -#define USE_REL - -static reloc_howto_type elf_arc_howto_table[] = -{ - /* This reloc does nothing. */ - HOWTO (R_ARC_NONE, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_ARC_NONE", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - false), /* pcrel_offset */ - - /* A standard 32 bit relocation. */ - HOWTO (R_ARC_32, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_ARC_32", /* name */ - false, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* A 26 bit absolute branch, right shifted by 2. */ - HOWTO (R_ARC_B26, /* type */ - 2, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 26, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_ARC_B26", /* name */ - false, /* partial_inplace */ - 0x00ffffff, /* src_mask */ - 0x00ffffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* A relative 22 bit branch; bits 21-2 are stored in bits 26-7. */ - HOWTO (R_ARC_B22_PCREL, /* type */ - 2, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 22, /* bitsize */ - true, /* pc_relative */ - 7, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_ARC_B22_PCREL", /* name */ - false, /* partial_inplace */ - 0x07ffff80, /* src_mask */ - 0x07ffff80, /* dst_mask */ - true), /* pcrel_offset */ - -}; - -/* Map BFD reloc types to ARC ELF reloc types. */ - -struct arc_reloc_map -{ - bfd_reloc_code_real_type bfd_reloc_val; - unsigned char elf_reloc_val; -}; - -static const struct arc_reloc_map arc_reloc_map[] = -{ - { BFD_RELOC_NONE, R_ARC_NONE, }, - { BFD_RELOC_32, R_ARC_32 }, - { BFD_RELOC_CTOR, R_ARC_32 }, - { BFD_RELOC_ARC_B26, R_ARC_B26 }, - { BFD_RELOC_ARC_B22_PCREL, R_ARC_B22_PCREL }, -}; - -static reloc_howto_type * -bfd_elf32_bfd_reloc_type_lookup (abfd, code) - bfd *abfd ATTRIBUTE_UNUSED; - bfd_reloc_code_real_type code; -{ - unsigned int i; - - for (i = 0; - i < sizeof (arc_reloc_map) / sizeof (struct arc_reloc_map); - i++) - { - if (arc_reloc_map[i].bfd_reloc_val == code) - return &elf_arc_howto_table[arc_reloc_map[i].elf_reloc_val]; - } - - return NULL; -} - -/* Set the howto pointer for an ARC ELF reloc. */ - -static void -arc_info_to_howto_rel (abfd, cache_ptr, dst) - bfd *abfd ATTRIBUTE_UNUSED; - arelent *cache_ptr; - Elf32_Internal_Rel *dst; -{ - unsigned int r_type; - - r_type = ELF32_R_TYPE (dst->r_info); - BFD_ASSERT (r_type < (unsigned int) R_ARC_max); - cache_ptr->howto = &elf_arc_howto_table[r_type]; -} - -/* Set the right machine number for an ARC ELF file. */ - -static boolean -arc_elf_object_p (abfd) - bfd *abfd; -{ - int mach; - unsigned long arch = elf_elfheader (abfd)->e_flags & EF_ARC_MACH; - - switch (arch) - { - case E_ARC_MACH_BASE: - mach = bfd_mach_arc_base; - break; - default: - /* Unknown cpu type. ??? What to do? */ - return false; - } - - (void) bfd_default_set_arch_mach (abfd, bfd_arch_arc, mach); - return true; -} - -/* The final processing done just before writing out an ARC ELF object file. - This gets the ARC architecture right based on the machine number. */ - -static void -arc_elf_final_write_processing (abfd, linker) - bfd *abfd; - boolean linker ATTRIBUTE_UNUSED; -{ - int mach; - unsigned long val; - - switch (mach = bfd_get_mach (abfd)) - { - case bfd_mach_arc_base: - val = E_ARC_MACH_BASE; - break; - default: - return; - } - - elf_elfheader (abfd)->e_flags &=~ EF_ARC_MACH; - elf_elfheader (abfd)->e_flags |= val; -} - -#define TARGET_LITTLE_SYM bfd_elf32_littlearc_vec -#define TARGET_LITTLE_NAME "elf32-littlearc" -#define TARGET_BIG_SYM bfd_elf32_bigarc_vec -#define TARGET_BIG_NAME "elf32-bigarc" -#define ELF_ARCH bfd_arch_arc -#define ELF_MACHINE_CODE EM_CYGNUS_ARC -#define ELF_MAXPAGESIZE 0x1000 - -#define elf_info_to_howto 0 -#define elf_info_to_howto_rel arc_info_to_howto_rel -#define elf_backend_object_p arc_elf_object_p -#define elf_backend_final_write_processing \ - arc_elf_final_write_processing - -#include "elf32-target.h" diff --git a/contrib/binutils/bfd/elf32-mips.c b/contrib/binutils/bfd/elf32-mips.c deleted file mode 100644 index e7e1c2a7ab20..000000000000 --- a/contrib/binutils/bfd/elf32-mips.c +++ /dev/null @@ -1,9049 +0,0 @@ -/* MIPS-specific support for 32-bit ELF - Copyright 1993, 94, 95, 96, 97, 98, 1999 Free Software Foundation, Inc. - - Most of the information added by Ian Lance Taylor, Cygnus Support, - <ian@cygnus.com>. - N32/64 ABI support added by Mark Mitchell, CodeSourcery, LLC. - <mark@codesourcery.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. */ - -/* This file handles MIPS ELF targets. SGI Irix 5 uses a slightly - different MIPS ELF from other targets. This matters when linking. - This file supports both, switching at runtime. */ - -#include "bfd.h" -#include "sysdep.h" -#include "libbfd.h" -#include "bfdlink.h" -#include "genlink.h" -#include "elf-bfd.h" -#include "elf/mips.h" - -/* Get the ECOFF swapping routines. */ -#include "coff/sym.h" -#include "coff/symconst.h" -#include "coff/internal.h" -#include "coff/ecoff.h" -#include "coff/mips.h" -#define ECOFF_32 -#include "ecoffswap.h" - -/* This structure is used to hold .got information when linking. It - is stored in the tdata field of the bfd_elf_section_data structure. */ - -struct mips_got_info -{ - /* The global symbol in the GOT with the lowest index in the dynamic - symbol table. */ - struct elf_link_hash_entry *global_gotsym; - /* The number of global .got entries. */ - unsigned int global_gotno; - /* The number of local .got entries. */ - unsigned int local_gotno; - /* The number of local .got entries we have used. */ - unsigned int assigned_gotno; -}; - -/* The MIPS ELF linker needs additional information for each symbol in - the global hash table. */ - -struct mips_elf_link_hash_entry -{ - struct elf_link_hash_entry root; - - /* External symbol information. */ - EXTR esym; - - /* Number of R_MIPS_32, R_MIPS_REL32, or R_MIPS_64 relocs against - this symbol. */ - unsigned int possibly_dynamic_relocs; - - /* The index of the first dynamic relocation (in the .rel.dyn - section) against this symbol. */ - unsigned int min_dyn_reloc_index; - - /* If there is a stub that 32 bit functions should use to call this - 16 bit function, this points to the section containing the stub. */ - asection *fn_stub; - - /* Whether we need the fn_stub; this is set if this symbol appears - in any relocs other than a 16 bit call. */ - boolean need_fn_stub; - - /* If there is a stub that 16 bit functions should use to call this - 32 bit function, this points to the section containing the stub. */ - asection *call_stub; - - /* This is like the call_stub field, but it is used if the function - being called returns a floating point value. */ - asection *call_fp_stub; -}; - -static bfd_reloc_status_type mips32_64bit_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); -static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup - PARAMS ((bfd *, bfd_reloc_code_real_type)); -static reloc_howto_type *mips_rtype_to_howto - PARAMS ((unsigned int)); -static void mips_info_to_howto_rel - PARAMS ((bfd *, arelent *, Elf32_Internal_Rel *)); -static void mips_info_to_howto_rela - PARAMS ((bfd *, arelent *, Elf32_Internal_Rela *)); -static void bfd_mips_elf32_swap_gptab_in - PARAMS ((bfd *, const Elf32_External_gptab *, Elf32_gptab *)); -static void bfd_mips_elf32_swap_gptab_out - PARAMS ((bfd *, const Elf32_gptab *, Elf32_External_gptab *)); -#if 0 -static void bfd_mips_elf_swap_msym_in - PARAMS ((bfd *, const Elf32_External_Msym *, Elf32_Internal_Msym *)); -#endif -static void bfd_mips_elf_swap_msym_out - PARAMS ((bfd *, const Elf32_Internal_Msym *, Elf32_External_Msym *)); -static boolean mips_elf_sym_is_global PARAMS ((bfd *, asymbol *)); -static boolean mips_elf_create_procedure_table - PARAMS ((PTR, bfd *, struct bfd_link_info *, asection *, - struct ecoff_debug_info *)); -static INLINE int elf_mips_isa PARAMS ((flagword)); -static INLINE int elf_mips_mach PARAMS ((flagword)); -static INLINE char* elf_mips_abi_name PARAMS ((bfd *)); -static boolean mips_elf_is_local_label_name - PARAMS ((bfd *, const char *)); -static struct bfd_hash_entry *mips_elf_link_hash_newfunc - PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); -static int gptab_compare PARAMS ((const void *, const void *)); -static bfd_reloc_status_type mips16_jump_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); -static bfd_reloc_status_type mips16_gprel_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); -static boolean mips_elf_create_compact_rel_section - PARAMS ((bfd *, struct bfd_link_info *)); -static boolean mips_elf_create_got_section - PARAMS ((bfd *, struct bfd_link_info *)); -static bfd_reloc_status_type mips_elf_final_gp - PARAMS ((bfd *, asymbol *, boolean, char **, bfd_vma *)); -static bfd_byte *elf32_mips_get_relocated_section_contents - PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, - bfd_byte *, boolean, asymbol **)); -static asection *mips_elf_create_msym_section - PARAMS ((bfd *)); -static void mips_elf_irix6_finish_dynamic_symbol - PARAMS ((bfd *, const char *, Elf_Internal_Sym *)); -static bfd_vma mips_elf_sign_extend PARAMS ((bfd_vma, int)); -static boolean mips_elf_overflow_p PARAMS ((bfd_vma, int)); -static bfd_vma mips_elf_high PARAMS ((bfd_vma)); -static bfd_vma mips_elf_higher PARAMS ((bfd_vma)); -static bfd_vma mips_elf_highest PARAMS ((bfd_vma)); -static bfd_vma mips_elf_global_got_index - PARAMS ((bfd *, struct elf_link_hash_entry *)); -static bfd_vma mips_elf_local_got_index - PARAMS ((bfd *, struct bfd_link_info *, bfd_vma)); -static bfd_vma mips_elf_got_offset_from_index - PARAMS ((bfd *, bfd *, bfd_vma)); -static boolean mips_elf_record_global_got_symbol - PARAMS ((struct elf_link_hash_entry *, struct bfd_link_info *, - struct mips_got_info *)); -static bfd_vma mips_elf_got_page - PARAMS ((bfd *, struct bfd_link_info *, bfd_vma, bfd_vma *)); -static const Elf_Internal_Rela *mips_elf_next_relocation - PARAMS ((unsigned int, const Elf_Internal_Rela *, - const Elf_Internal_Rela *)); -static bfd_reloc_status_type mips_elf_calculate_relocation - PARAMS ((bfd *, bfd *, asection *, struct bfd_link_info *, - const Elf_Internal_Rela *, bfd_vma, reloc_howto_type *, - Elf_Internal_Sym *, asection **, bfd_vma *, const char **, - boolean *)); -static bfd_vma mips_elf_obtain_contents - PARAMS ((reloc_howto_type *, const Elf_Internal_Rela *, bfd *, bfd_byte *)); -static boolean mips_elf_perform_relocation - PARAMS ((struct bfd_link_info *, reloc_howto_type *, - const Elf_Internal_Rela *, bfd_vma, - bfd *, asection *, bfd_byte *, boolean)); -static boolean mips_elf_assign_gp PARAMS ((bfd *, bfd_vma *)); -static boolean mips_elf_sort_hash_table_f - PARAMS ((struct mips_elf_link_hash_entry *, PTR)); -static boolean mips_elf_sort_hash_table - PARAMS ((struct bfd_link_info *, unsigned long)); -static asection * mips_elf_got_section PARAMS ((bfd *)); -static struct mips_got_info *mips_elf_got_info - PARAMS ((bfd *, asection **)); -static boolean mips_elf_local_relocation_p - PARAMS ((bfd *, const Elf_Internal_Rela *, asection **)); -static bfd_vma mips_elf_create_local_got_entry - PARAMS ((bfd *, struct mips_got_info *, asection *, bfd_vma)); -static bfd_vma mips_elf_got16_entry - PARAMS ((bfd *, struct bfd_link_info *, bfd_vma)); -static boolean mips_elf_create_dynamic_relocation - PARAMS ((bfd *, struct bfd_link_info *, const Elf_Internal_Rela *, - struct mips_elf_link_hash_entry *, asection *, - bfd_vma, bfd_vma *, asection *)); -static void mips_elf_allocate_dynamic_relocations - PARAMS ((bfd *, unsigned int)); -static boolean mips_elf_stub_section_p - PARAMS ((bfd *, asection *)); - -/* The level of IRIX compatibility we're striving for. */ - -typedef enum { - ict_none, - ict_irix5, - ict_irix6 -} irix_compat_t; - -/* Nonzero if ABFD is using the N32 ABI. */ - -#define ABI_N32_P(abfd) \ - ((elf_elfheader (abfd)->e_flags & EF_MIPS_ABI2) != 0) - -/* Nonzero if ABFD is using the 64-bit ABI. FIXME: This is never - true, yet. */ -#define ABI_64_P(abfd) \ - ((elf_elfheader (abfd)->e_ident[EI_CLASS] == ELFCLASS64) != 0) - -/* What version of Irix we are trying to be compatible with. FIXME: - At the moment, we never generate "normal" MIPS ELF ABI executables; - we always use some version of Irix. */ - -#define IRIX_COMPAT(abfd) \ - ((ABI_N32_P (abfd) || ABI_64_P (abfd)) ? ict_irix6 : ict_irix5) - -/* Whether we are trying to be compatible with IRIX at all. */ - -#define SGI_COMPAT(abfd) \ - (IRIX_COMPAT (abfd) != ict_none) - -/* The name of the msym section. */ -#define MIPS_ELF_MSYM_SECTION_NAME(abfd) ".msym" - -/* The name of the srdata section. */ -#define MIPS_ELF_SRDATA_SECTION_NAME(abfd) ".srdata" - -/* The name of the options section. */ -#define MIPS_ELF_OPTIONS_SECTION_NAME(abfd) \ - (IRIX_COMPAT (abfd) == ict_irix6 ? ".MIPS.options" : ".options") - -/* The name of the stub section. */ -#define MIPS_ELF_STUB_SECTION_NAME(abfd) \ - (IRIX_COMPAT (abfd) == ict_irix6 ? ".MIPS.stubs" : ".stub") - -/* The name of the dynamic relocation section. */ -#define MIPS_ELF_REL_DYN_SECTION_NAME(abfd) ".rel.dyn" - -/* The size of an external REL relocation. */ -#define MIPS_ELF_REL_SIZE(abfd) \ - (get_elf_backend_data (abfd)->s->sizeof_rel) - -/* The size of an external dynamic table entry. */ -#define MIPS_ELF_DYN_SIZE(abfd) \ - (get_elf_backend_data (abfd)->s->sizeof_dyn) - -/* The size of a GOT entry. */ -#define MIPS_ELF_GOT_SIZE(abfd) \ - (get_elf_backend_data (abfd)->s->arch_size / 8) - -/* The size of a symbol-table entry. */ -#define MIPS_ELF_SYM_SIZE(abfd) \ - (get_elf_backend_data (abfd)->s->sizeof_sym) - -/* The default alignment for sections, as a power of two. */ -#define MIPS_ELF_LOG_FILE_ALIGN(abfd) \ - (get_elf_backend_data (abfd)->s->file_align == 8 ? 3 : 2) - -/* Get word-sized data. */ -#define MIPS_ELF_GET_WORD(abfd, ptr) \ - (ABI_64_P (abfd) ? bfd_get_64 (abfd, ptr) : bfd_get_32 (abfd, ptr)) - -/* Put out word-sized data. */ -#define MIPS_ELF_PUT_WORD(abfd, val, ptr) \ - (ABI_64_P (abfd) \ - ? bfd_put_64 (abfd, val, ptr) \ - : bfd_put_32 (abfd, val, ptr)) - -/* Add a dynamic symbol table-entry. */ -#ifdef BFD64 -#define MIPS_ELF_ADD_DYNAMIC_ENTRY(info, tag, val) \ - (ABI_64_P (elf_hash_table (info)->dynobj) \ - ? bfd_elf64_add_dynamic_entry (info, tag, val) \ - : bfd_elf32_add_dynamic_entry (info, tag, val)) -#else -#define MIPS_ELF_ADD_DYNAMIC_ENTRY(info, tag, val) \ - (ABI_64_P (elf_hash_table (info)->dynobj) \ - ? (abort (), false) \ - : bfd_elf32_add_dynamic_entry (info, tag, val)) -#endif - -/* The number of local .got entries we reserve. */ -#define MIPS_RESERVED_GOTNO (2) - -/* Instructions which appear in a stub. For some reason the stub is - slightly different on an SGI system. */ -#define ELF_MIPS_GP_OFFSET(abfd) (SGI_COMPAT (abfd) ? 0x7ff0 : 0x8000) -#define STUB_LW(abfd) \ - (SGI_COMPAT (abfd) \ - ? (ABI_64_P (abfd) \ - ? 0xdf998010 /* ld t9,0x8010(gp) */ \ - : 0x8f998010) /* lw t9,0x8010(gp) */ \ - : 0x8f998000) /* lw t9,0x8000(gp) */ -#define STUB_MOVE 0x03e07825 /* move t7,ra */ -#define STUB_JALR 0x0320f809 /* jal t9 */ -#define STUB_LI16 0x34180000 /* ori t8,zero,0 */ -#define MIPS_FUNCTION_STUB_SIZE (16) - -#if 0 -/* We no longer try to identify particular sections for the .dynsym - section. When we do, we wind up crashing if there are other random - sections with relocations. */ - -/* Names of sections which appear in the .dynsym section in an Irix 5 - executable. */ - -static const char * const mips_elf_dynsym_sec_names[] = -{ - ".text", - ".init", - ".fini", - ".data", - ".rodata", - ".sdata", - ".sbss", - ".bss", - NULL -}; - -#define SIZEOF_MIPS_DYNSYM_SECNAMES \ - (sizeof mips_elf_dynsym_sec_names / sizeof mips_elf_dynsym_sec_names[0]) - -/* The number of entries in mips_elf_dynsym_sec_names which go in the - text segment. */ - -#define MIPS_TEXT_DYNSYM_SECNO (3) - -#endif /* 0 */ - -/* The names of the runtime procedure table symbols used on Irix 5. */ - -static const char * const mips_elf_dynsym_rtproc_names[] = -{ - "_procedure_table", - "_procedure_string_table", - "_procedure_table_size", - NULL -}; - -/* These structures are used to generate the .compact_rel section on - Irix 5. */ - -typedef struct -{ - unsigned long id1; /* Always one? */ - unsigned long num; /* Number of compact relocation entries. */ - unsigned long id2; /* Always two? */ - unsigned long offset; /* The file offset of the first relocation. */ - unsigned long reserved0; /* Zero? */ - unsigned long reserved1; /* Zero? */ -} Elf32_compact_rel; - -typedef struct -{ - bfd_byte id1[4]; - bfd_byte num[4]; - bfd_byte id2[4]; - bfd_byte offset[4]; - bfd_byte reserved0[4]; - bfd_byte reserved1[4]; -} Elf32_External_compact_rel; - -typedef struct -{ - unsigned int ctype : 1; /* 1: long 0: short format. See below. */ - unsigned int rtype : 4; /* Relocation types. See below. */ - unsigned int dist2to : 8; - unsigned int relvaddr : 19; /* (VADDR - vaddr of the previous entry)/ 4 */ - unsigned long konst; /* KONST field. See below. */ - unsigned long vaddr; /* VADDR to be relocated. */ -} Elf32_crinfo; - -typedef struct -{ - unsigned int ctype : 1; /* 1: long 0: short format. See below. */ - unsigned int rtype : 4; /* Relocation types. See below. */ - unsigned int dist2to : 8; - unsigned int relvaddr : 19; /* (VADDR - vaddr of the previous entry)/ 4 */ - unsigned long konst; /* KONST field. See below. */ -} Elf32_crinfo2; - -typedef struct -{ - bfd_byte info[4]; - bfd_byte konst[4]; - bfd_byte vaddr[4]; -} Elf32_External_crinfo; - -typedef struct -{ - bfd_byte info[4]; - bfd_byte konst[4]; -} Elf32_External_crinfo2; - -/* These are the constants used to swap the bitfields in a crinfo. */ - -#define CRINFO_CTYPE (0x1) -#define CRINFO_CTYPE_SH (31) -#define CRINFO_RTYPE (0xf) -#define CRINFO_RTYPE_SH (27) -#define CRINFO_DIST2TO (0xff) -#define CRINFO_DIST2TO_SH (19) -#define CRINFO_RELVADDR (0x7ffff) -#define CRINFO_RELVADDR_SH (0) - -/* A compact relocation info has long (3 words) or short (2 words) - formats. A short format doesn't have VADDR field and relvaddr - fields contains ((VADDR - vaddr of the previous entry) >> 2). */ -#define CRF_MIPS_LONG 1 -#define CRF_MIPS_SHORT 0 - -/* There are 4 types of compact relocation at least. The value KONST - has different meaning for each type: - - (type) (konst) - CT_MIPS_REL32 Address in data - CT_MIPS_WORD Address in word (XXX) - CT_MIPS_GPHI_LO GP - vaddr - CT_MIPS_JMPAD Address to jump - */ - -#define CRT_MIPS_REL32 0xa -#define CRT_MIPS_WORD 0xb -#define CRT_MIPS_GPHI_LO 0xc -#define CRT_MIPS_JMPAD 0xd - -#define mips_elf_set_cr_format(x,format) ((x).ctype = (format)) -#define mips_elf_set_cr_type(x,type) ((x).rtype = (type)) -#define mips_elf_set_cr_dist2to(x,v) ((x).dist2to = (v)) -#define mips_elf_set_cr_relvaddr(x,d) ((x).relvaddr = (d)<<2) - -static void bfd_elf32_swap_compact_rel_out - PARAMS ((bfd *, const Elf32_compact_rel *, Elf32_External_compact_rel *)); -static void bfd_elf32_swap_crinfo_out - PARAMS ((bfd *, const Elf32_crinfo *, Elf32_External_crinfo *)); - -#define USE_REL 1 /* MIPS uses REL relocations instead of RELA */ - -/* In case we're on a 32-bit machine, construct a 64-bit "-1" value - from smaller values. Start with zero, widen, *then* decrement. */ -#define MINUS_ONE (((bfd_vma)0) - 1) - -static reloc_howto_type elf_mips_howto_table[] = -{ - /* No relocation. */ - HOWTO (R_MIPS_NONE, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_NONE", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - false), /* pcrel_offset */ - - /* 16 bit relocation. */ - HOWTO (R_MIPS_16, /* type */ - 0, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_16", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* 32 bit relocation. */ - HOWTO (R_MIPS_32, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_32", /* name */ - true, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* 32 bit symbol relative relocation. */ - HOWTO (R_MIPS_REL32, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_REL32", /* name */ - true, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* 26 bit branch address. */ - HOWTO (R_MIPS_26, /* type */ - 2, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 26, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - /* This needs complex overflow - detection, because the upper four - bits must match the PC. */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_26", /* name */ - true, /* partial_inplace */ - 0x3ffffff, /* src_mask */ - 0x3ffffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* High 16 bits of symbol value. */ - HOWTO (R_MIPS_HI16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - _bfd_mips_elf_hi16_reloc, /* special_function */ - "R_MIPS_HI16", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Low 16 bits of symbol value. */ - HOWTO (R_MIPS_LO16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - _bfd_mips_elf_lo16_reloc, /* special_function */ - "R_MIPS_LO16", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* GP relative reference. */ - HOWTO (R_MIPS_GPREL16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - _bfd_mips_elf_gprel16_reloc, /* special_function */ - "R_MIPS_GPREL16", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Reference to literal section. */ - HOWTO (R_MIPS_LITERAL, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - _bfd_mips_elf_gprel16_reloc, /* special_function */ - "R_MIPS_LITERAL", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Reference to global offset table. */ - HOWTO (R_MIPS_GOT16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - _bfd_mips_elf_got16_reloc, /* special_function */ - "R_MIPS_GOT16", /* name */ - false, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* 16 bit PC relative reference. */ - HOWTO (R_MIPS_PC16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - true, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_PC16", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - true), /* pcrel_offset */ - - /* 16 bit call through global offset table. */ - HOWTO (R_MIPS_CALL16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_CALL16", /* name */ - false, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* 32 bit GP relative reference. */ - HOWTO (R_MIPS_GPREL32, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - _bfd_mips_elf_gprel32_reloc, /* special_function */ - "R_MIPS_GPREL32", /* name */ - true, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* The remaining relocs are defined on Irix 5, although they are - not defined by the ABI. */ - EMPTY_HOWTO (13), - EMPTY_HOWTO (14), - EMPTY_HOWTO (15), - - /* A 5 bit shift field. */ - HOWTO (R_MIPS_SHIFT5, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 5, /* bitsize */ - false, /* pc_relative */ - 6, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_SHIFT5", /* name */ - true, /* partial_inplace */ - 0x000007c0, /* src_mask */ - 0x000007c0, /* dst_mask */ - false), /* pcrel_offset */ - - /* A 6 bit shift field. */ - /* FIXME: This is not handled correctly; a special function is - needed to put the most significant bit in the right place. */ - HOWTO (R_MIPS_SHIFT6, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 6, /* bitsize */ - false, /* pc_relative */ - 6, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_SHIFT6", /* name */ - true, /* partial_inplace */ - 0x000007c4, /* src_mask */ - 0x000007c4, /* dst_mask */ - false), /* pcrel_offset */ - - /* A 64 bit relocation. */ - HOWTO (R_MIPS_64, /* type */ - 0, /* rightshift */ - 4, /* size (0 = byte, 1 = short, 2 = long) */ - 64, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - mips32_64bit_reloc, /* special_function */ - "R_MIPS_64", /* name */ - true, /* partial_inplace */ - MINUS_ONE, /* src_mask */ - MINUS_ONE, /* dst_mask */ - false), /* pcrel_offset */ - - /* Displacement in the global offset table. */ - HOWTO (R_MIPS_GOT_DISP, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_GOT_DISP", /* name */ - true, /* partial_inplace */ - 0x0000ffff, /* src_mask */ - 0x0000ffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Displacement to page pointer in the global offset table. */ - HOWTO (R_MIPS_GOT_PAGE, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_GOT_PAGE", /* name */ - true, /* partial_inplace */ - 0x0000ffff, /* src_mask */ - 0x0000ffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Offset from page pointer in the global offset table. */ - HOWTO (R_MIPS_GOT_OFST, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_GOT_OFST", /* name */ - true, /* partial_inplace */ - 0x0000ffff, /* src_mask */ - 0x0000ffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* High 16 bits of displacement in global offset table. */ - HOWTO (R_MIPS_GOT_HI16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_GOT_HI16", /* name */ - true, /* partial_inplace */ - 0x0000ffff, /* src_mask */ - 0x0000ffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Low 16 bits of displacement in global offset table. */ - HOWTO (R_MIPS_GOT_LO16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_GOT_LO16", /* name */ - true, /* partial_inplace */ - 0x0000ffff, /* src_mask */ - 0x0000ffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* 64 bit subtraction. Used in the N32 ABI. */ - HOWTO (R_MIPS_SUB, /* type */ - 0, /* rightshift */ - 4, /* size (0 = byte, 1 = short, 2 = long) */ - 64, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_SUB", /* name */ - true, /* partial_inplace */ - MINUS_ONE, /* src_mask */ - MINUS_ONE, /* dst_mask */ - false), /* pcrel_offset */ - - /* Used to cause the linker to insert and delete instructions? */ - EMPTY_HOWTO (R_MIPS_INSERT_A), - EMPTY_HOWTO (R_MIPS_INSERT_B), - EMPTY_HOWTO (R_MIPS_DELETE), - - /* Get the higher value of a 64 bit addend. */ - HOWTO (R_MIPS_HIGHER, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_HIGHER", /* name */ - true, /* partial_inplace */ - 0, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Get the highest value of a 64 bit addend. */ - HOWTO (R_MIPS_HIGHEST, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_HIGHEST", /* name */ - true, /* partial_inplace */ - 0, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* High 16 bits of displacement in global offset table. */ - HOWTO (R_MIPS_CALL_HI16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_CALL_HI16", /* name */ - true, /* partial_inplace */ - 0x0000ffff, /* src_mask */ - 0x0000ffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Low 16 bits of displacement in global offset table. */ - HOWTO (R_MIPS_CALL_LO16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_CALL_LO16", /* name */ - true, /* partial_inplace */ - 0x0000ffff, /* src_mask */ - 0x0000ffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Section displacement. */ - HOWTO (R_MIPS_SCN_DISP, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_SCN_DISP", /* name */ - false, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - false), /* pcrel_offset */ - - EMPTY_HOWTO (R_MIPS_REL16), - EMPTY_HOWTO (R_MIPS_ADD_IMMEDIATE), - EMPTY_HOWTO (R_MIPS_PJUMP), - EMPTY_HOWTO (R_MIPS_RELGOT), - - /* Protected jump conversion. This is an optimization hint. No - relocation is required for correctness. */ - HOWTO (R_MIPS_JALR, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_JALR", /* name */ - false, /* partial_inplace */ - 0x00000000, /* src_mask */ - 0x00000000, /* dst_mask */ - false), /* pcrel_offset */ -}; - -/* The reloc used for BFD_RELOC_CTOR when doing a 64 bit link. This - is a hack to make the linker think that we need 64 bit values. */ -static reloc_howto_type elf_mips_ctor64_howto = - HOWTO (R_MIPS_64, /* type */ - 0, /* rightshift */ - 4, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - mips32_64bit_reloc, /* special_function */ - "R_MIPS_64", /* name */ - true, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - false); /* pcrel_offset */ - -/* The reloc used for the mips16 jump instruction. */ -static reloc_howto_type elf_mips16_jump_howto = - HOWTO (R_MIPS16_26, /* type */ - 2, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 26, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - /* This needs complex overflow - detection, because the upper four - bits must match the PC. */ - mips16_jump_reloc, /* special_function */ - "R_MIPS16_26", /* name */ - true, /* partial_inplace */ - 0x3ffffff, /* src_mask */ - 0x3ffffff, /* dst_mask */ - false); /* pcrel_offset */ - -/* The reloc used for the mips16 gprel instruction. */ -static reloc_howto_type elf_mips16_gprel_howto = - HOWTO (R_MIPS16_GPREL, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - mips16_gprel_reloc, /* special_function */ - "R_MIPS16_GPREL", /* name */ - true, /* partial_inplace */ - 0x07ff001f, /* src_mask */ - 0x07ff001f, /* dst_mask */ - false); /* pcrel_offset */ - - -/* GNU extensions for embedded-pic. */ -/* High 16 bits of symbol value, pc-relative. */ -static reloc_howto_type elf_mips_gnu_rel_hi16 = - HOWTO (R_MIPS_GNU_REL_HI16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - true, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - _bfd_mips_elf_hi16_reloc, /* special_function */ - "R_MIPS_GNU_REL_HI16", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - true); /* pcrel_offset */ - -/* Low 16 bits of symbol value, pc-relative. */ -static reloc_howto_type elf_mips_gnu_rel_lo16 = - HOWTO (R_MIPS_GNU_REL_LO16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - true, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - _bfd_mips_elf_lo16_reloc, /* special_function */ - "R_MIPS_GNU_REL_LO16", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - true); /* pcrel_offset */ - -/* 16 bit offset for pc-relative branches. */ -static reloc_howto_type elf_mips_gnu_rel16_s2 = - HOWTO (R_MIPS_GNU_REL16_S2, /* type */ - 2, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - true, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_GNU_REL16_S2", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - true); /* pcrel_offset */ - -/* 64 bit pc-relative. */ -static reloc_howto_type elf_mips_gnu_pcrel64 = - HOWTO (R_MIPS_PC64, /* type */ - 0, /* rightshift */ - 4, /* size (0 = byte, 1 = short, 2 = long) */ - 64, /* bitsize */ - true, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_PC64", /* name */ - true, /* partial_inplace */ - MINUS_ONE, /* src_mask */ - MINUS_ONE, /* dst_mask */ - true); /* pcrel_offset */ - -/* 32 bit pc-relative. */ -static reloc_howto_type elf_mips_gnu_pcrel32 = - HOWTO (R_MIPS_PC32, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - true, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_PC32", /* name */ - true, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - true); /* pcrel_offset */ - -/* GNU extension to record C++ vtable hierarchy */ -static reloc_howto_type elf_mips_gnu_vtinherit_howto = - HOWTO (R_MIPS_GNU_VTINHERIT, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - NULL, /* special_function */ - "R_MIPS_GNU_VTINHERIT", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - false); /* pcrel_offset */ - -/* GNU extension to record C++ vtable member usage */ -static reloc_howto_type elf_mips_gnu_vtentry_howto = - HOWTO (R_MIPS_GNU_VTENTRY, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - _bfd_elf_rel_vtable_reloc_fn, /* special_function */ - "R_MIPS_GNU_VTENTRY", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - false); /* pcrel_offset */ - -/* Do a R_MIPS_HI16 relocation. This has to be done in combination - with a R_MIPS_LO16 reloc, because there is a carry from the LO16 to - the HI16. Here we just save the information we need; we do the - actual relocation when we see the LO16. MIPS ELF requires that the - LO16 immediately follow the HI16. As a GNU extension, we permit an - arbitrary number of HI16 relocs to be associated with a single LO16 - reloc. This extension permits gcc to output the HI and LO relocs - itself. */ - -struct mips_hi16 -{ - struct mips_hi16 *next; - bfd_byte *addr; - bfd_vma addend; -}; - -/* FIXME: This should not be a static variable. */ - -static struct mips_hi16 *mips_hi16_list; - -bfd_reloc_status_type -_bfd_mips_elf_hi16_reloc (abfd, - reloc_entry, - symbol, - data, - input_section, - output_bfd, - error_message) - bfd *abfd ATTRIBUTE_UNUSED; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message; -{ - bfd_reloc_status_type ret; - bfd_vma relocation; - struct mips_hi16 *n; - - /* If we're relocating, and this an external symbol, we don't want - to change anything. */ - if (output_bfd != (bfd *) NULL - && (symbol->flags & BSF_SECTION_SYM) == 0 - && reloc_entry->addend == 0) - { - reloc_entry->address += input_section->output_offset; - return bfd_reloc_ok; - } - - ret = bfd_reloc_ok; - - if (strcmp (bfd_asymbol_name (symbol), "_gp_disp") == 0) - { - boolean relocateable; - bfd_vma gp; - - if (ret == bfd_reloc_undefined) - abort (); - - if (output_bfd != NULL) - relocateable = true; - else - { - relocateable = false; - output_bfd = symbol->section->output_section->owner; - } - - ret = mips_elf_final_gp (output_bfd, symbol, relocateable, - error_message, &gp); - if (ret != bfd_reloc_ok) - return ret; - - relocation = gp - reloc_entry->address; - } - else - { - if (bfd_is_und_section (symbol->section) - && output_bfd == (bfd *) NULL) - ret = bfd_reloc_undefined; - - if (bfd_is_com_section (symbol->section)) - relocation = 0; - else - relocation = symbol->value; - } - - relocation += symbol->section->output_section->vma; - relocation += symbol->section->output_offset; - relocation += reloc_entry->addend; - - if (reloc_entry->address > input_section->_cooked_size) - return bfd_reloc_outofrange; - - /* Save the information, and let LO16 do the actual relocation. */ - n = (struct mips_hi16 *) bfd_malloc (sizeof *n); - if (n == NULL) - return bfd_reloc_outofrange; - n->addr = (bfd_byte *) data + reloc_entry->address; - n->addend = relocation; - n->next = mips_hi16_list; - mips_hi16_list = n; - - if (output_bfd != (bfd *) NULL) - reloc_entry->address += input_section->output_offset; - - return ret; -} - -/* Do a R_MIPS_LO16 relocation. This is a straightforward 16 bit - inplace relocation; this function exists in order to do the - R_MIPS_HI16 relocation described above. */ - -bfd_reloc_status_type -_bfd_mips_elf_lo16_reloc (abfd, - reloc_entry, - symbol, - data, - input_section, - output_bfd, - error_message) - bfd *abfd; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message; -{ - arelent gp_disp_relent; - - if (mips_hi16_list != NULL) - { - struct mips_hi16 *l; - - l = mips_hi16_list; - while (l != NULL) - { - unsigned long insn; - unsigned long val; - unsigned long vallo; - struct mips_hi16 *next; - - /* Do the HI16 relocation. Note that we actually don't need - to know anything about the LO16 itself, except where to - find the low 16 bits of the addend needed by the LO16. */ - insn = bfd_get_32 (abfd, l->addr); - vallo = (bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address) - & 0xffff); - val = ((insn & 0xffff) << 16) + vallo; - val += l->addend; - - /* The low order 16 bits are always treated as a signed - value. Therefore, a negative value in the low order bits - requires an adjustment in the high order bits. We need - to make this adjustment in two ways: once for the bits we - took from the data, and once for the bits we are putting - back in to the data. */ - if ((vallo & 0x8000) != 0) - val -= 0x10000; - if ((val & 0x8000) != 0) - val += 0x10000; - - insn = (insn &~ 0xffff) | ((val >> 16) & 0xffff); - bfd_put_32 (abfd, insn, l->addr); - - if (strcmp (bfd_asymbol_name (symbol), "_gp_disp") == 0) - { - gp_disp_relent = *reloc_entry; - reloc_entry = &gp_disp_relent; - reloc_entry->addend = l->addend; - } - - next = l->next; - free (l); - l = next; - } - - mips_hi16_list = NULL; - } - else if (strcmp (bfd_asymbol_name (symbol), "_gp_disp") == 0) - { - bfd_reloc_status_type ret; - bfd_vma gp, relocation; - - /* FIXME: Does this case ever occur? */ - - ret = mips_elf_final_gp (output_bfd, symbol, true, error_message, &gp); - if (ret != bfd_reloc_ok) - return ret; - - relocation = gp - reloc_entry->address; - relocation += symbol->section->output_section->vma; - relocation += symbol->section->output_offset; - relocation += reloc_entry->addend; - - if (reloc_entry->address > input_section->_cooked_size) - return bfd_reloc_outofrange; - - gp_disp_relent = *reloc_entry; - reloc_entry = &gp_disp_relent; - reloc_entry->addend = relocation - 4; - } - - /* Now do the LO16 reloc in the usual way. */ - return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data, - input_section, output_bfd, error_message); -} - -/* Do a R_MIPS_GOT16 reloc. This is a reloc against the global offset - table used for PIC code. If the symbol is an external symbol, the - instruction is modified to contain the offset of the appropriate - entry in the global offset table. If the symbol is a section - symbol, the next reloc is a R_MIPS_LO16 reloc. The two 16 bit - addends are combined to form the real addend against the section - symbol; the GOT16 is modified to contain the offset of an entry in - the global offset table, and the LO16 is modified to offset it - appropriately. Thus an offset larger than 16 bits requires a - modified value in the global offset table. - - This implementation suffices for the assembler, but the linker does - not yet know how to create global offset tables. */ - -bfd_reloc_status_type -_bfd_mips_elf_got16_reloc (abfd, - reloc_entry, - symbol, - data, - input_section, - output_bfd, - error_message) - bfd *abfd; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message; -{ - /* If we're relocating, and this an external symbol, we don't want - to change anything. */ - if (output_bfd != (bfd *) NULL - && (symbol->flags & BSF_SECTION_SYM) == 0 - && reloc_entry->addend == 0) - { - reloc_entry->address += input_section->output_offset; - return bfd_reloc_ok; - } - - /* If we're relocating, and this is a local symbol, we can handle it - just like HI16. */ - if (output_bfd != (bfd *) NULL - && (symbol->flags & BSF_SECTION_SYM) != 0) - return _bfd_mips_elf_hi16_reloc (abfd, reloc_entry, symbol, data, - input_section, output_bfd, error_message); - - abort (); -} - -/* Set the GP value for OUTPUT_BFD. Returns false if this is a - dangerous relocation. */ - -static boolean -mips_elf_assign_gp (output_bfd, pgp) - bfd *output_bfd; - bfd_vma *pgp; -{ - unsigned int count; - asymbol **sym; - unsigned int i; - - /* If we've already figured out what GP will be, just return it. */ - *pgp = _bfd_get_gp_value (output_bfd); - if (*pgp) - return true; - - count = bfd_get_symcount (output_bfd); - sym = bfd_get_outsymbols (output_bfd); - - /* The linker script will have created a symbol named `_gp' with the - appropriate value. */ - if (sym == (asymbol **) NULL) - i = count; - else - { - for (i = 0; i < count; i++, sym++) - { - register CONST char *name; - - name = bfd_asymbol_name (*sym); - if (*name == '_' && strcmp (name, "_gp") == 0) - { - *pgp = bfd_asymbol_value (*sym); - _bfd_set_gp_value (output_bfd, *pgp); - break; - } - } - } - - if (i >= count) - { - /* Only get the error once. */ - *pgp = 4; - _bfd_set_gp_value (output_bfd, *pgp); - return false; - } - - return true; -} - -/* We have to figure out the gp value, so that we can adjust the - symbol value correctly. We look up the symbol _gp in the output - BFD. If we can't find it, we're stuck. We cache it in the ELF - target data. We don't need to adjust the symbol value for an - external symbol if we are producing relocateable output. */ - -static bfd_reloc_status_type -mips_elf_final_gp (output_bfd, symbol, relocateable, error_message, pgp) - bfd *output_bfd; - asymbol *symbol; - boolean relocateable; - char **error_message; - bfd_vma *pgp; -{ - if (bfd_is_und_section (symbol->section) - && ! relocateable) - { - *pgp = 0; - return bfd_reloc_undefined; - } - - *pgp = _bfd_get_gp_value (output_bfd); - if (*pgp == 0 - && (! relocateable - || (symbol->flags & BSF_SECTION_SYM) != 0)) - { - if (relocateable) - { - /* Make up a value. */ - *pgp = symbol->section->output_section->vma + 0x4000; - _bfd_set_gp_value (output_bfd, *pgp); - } - else if (!mips_elf_assign_gp (output_bfd, pgp)) - { - *error_message = - (char *) _("GP relative relocation when _gp not defined"); - return bfd_reloc_dangerous; - } - } - - return bfd_reloc_ok; -} - -/* Do a R_MIPS_GPREL16 relocation. This is a 16 bit value which must - become the offset from the gp register. This function also handles - R_MIPS_LITERAL relocations, although those can be handled more - cleverly because the entries in the .lit8 and .lit4 sections can be - merged. */ - -static bfd_reloc_status_type gprel16_with_gp PARAMS ((bfd *, asymbol *, - arelent *, asection *, - boolean, PTR, bfd_vma)); - -bfd_reloc_status_type -_bfd_mips_elf_gprel16_reloc (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message; -{ - boolean relocateable; - bfd_reloc_status_type ret; - bfd_vma gp; - - /* If we're relocating, and this is an external symbol with no - addend, we don't want to change anything. We will only have an - addend if this is a newly created reloc, not read from an ELF - file. */ - if (output_bfd != (bfd *) NULL - && (symbol->flags & BSF_SECTION_SYM) == 0 - && reloc_entry->addend == 0) - { - reloc_entry->address += input_section->output_offset; - return bfd_reloc_ok; - } - - if (output_bfd != (bfd *) NULL) - relocateable = true; - else - { - relocateable = false; - output_bfd = symbol->section->output_section->owner; - } - - ret = mips_elf_final_gp (output_bfd, symbol, relocateable, error_message, - &gp); - if (ret != bfd_reloc_ok) - return ret; - - return gprel16_with_gp (abfd, symbol, reloc_entry, input_section, - relocateable, data, gp); -} - -static bfd_reloc_status_type -gprel16_with_gp (abfd, symbol, reloc_entry, input_section, relocateable, data, - gp) - bfd *abfd; - asymbol *symbol; - arelent *reloc_entry; - asection *input_section; - boolean relocateable; - PTR data; - bfd_vma gp; -{ - bfd_vma relocation; - unsigned long insn; - unsigned long val; - - if (bfd_is_com_section (symbol->section)) - relocation = 0; - else - relocation = symbol->value; - - relocation += symbol->section->output_section->vma; - relocation += symbol->section->output_offset; - - if (reloc_entry->address > input_section->_cooked_size) - return bfd_reloc_outofrange; - - insn = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address); - - /* Set val to the offset into the section or symbol. */ - if (reloc_entry->howto->src_mask == 0) - { - /* This case occurs with the 64-bit MIPS ELF ABI. */ - val = reloc_entry->addend; - } - else - { - val = ((insn & 0xffff) + reloc_entry->addend) & 0xffff; - if (val & 0x8000) - val -= 0x10000; - } - - /* Adjust val for the final section location and GP value. If we - are producing relocateable output, we don't want to do this for - an external symbol. */ - if (! relocateable - || (symbol->flags & BSF_SECTION_SYM) != 0) - val += relocation - gp; - - insn = (insn &~ 0xffff) | (val & 0xffff); - bfd_put_32 (abfd, insn, (bfd_byte *) data + reloc_entry->address); - - if (relocateable) - reloc_entry->address += input_section->output_offset; - - /* Make sure it fit in 16 bits. */ - if (val >= 0x8000 && val < 0xffff8000) - return bfd_reloc_overflow; - - return bfd_reloc_ok; -} - -/* Do a R_MIPS_GPREL32 relocation. Is this 32 bit value the offset - from the gp register? XXX */ - -static bfd_reloc_status_type gprel32_with_gp PARAMS ((bfd *, asymbol *, - arelent *, asection *, - boolean, PTR, bfd_vma)); - -bfd_reloc_status_type -_bfd_mips_elf_gprel32_reloc (abfd, - reloc_entry, - symbol, - data, - input_section, - output_bfd, - error_message) - bfd *abfd; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message; -{ - boolean relocateable; - bfd_reloc_status_type ret; - bfd_vma gp; - - /* If we're relocating, and this is an external symbol with no - addend, we don't want to change anything. We will only have an - addend if this is a newly created reloc, not read from an ELF - file. */ - if (output_bfd != (bfd *) NULL - && (symbol->flags & BSF_SECTION_SYM) == 0 - && reloc_entry->addend == 0) - { - *error_message = (char *) - _("32bits gp relative relocation occurs for an external symbol"); - return bfd_reloc_outofrange; - } - - if (output_bfd != (bfd *) NULL) - { - relocateable = true; - gp = _bfd_get_gp_value (output_bfd); - } - else - { - relocateable = false; - output_bfd = symbol->section->output_section->owner; - - ret = mips_elf_final_gp (output_bfd, symbol, relocateable, - error_message, &gp); - if (ret != bfd_reloc_ok) - return ret; - } - - return gprel32_with_gp (abfd, symbol, reloc_entry, input_section, - relocateable, data, gp); -} - -static bfd_reloc_status_type -gprel32_with_gp (abfd, symbol, reloc_entry, input_section, relocateable, data, - gp) - bfd *abfd; - asymbol *symbol; - arelent *reloc_entry; - asection *input_section; - boolean relocateable; - PTR data; - bfd_vma gp; -{ - bfd_vma relocation; - unsigned long val; - - if (bfd_is_com_section (symbol->section)) - relocation = 0; - else - relocation = symbol->value; - - relocation += symbol->section->output_section->vma; - relocation += symbol->section->output_offset; - - if (reloc_entry->address > input_section->_cooked_size) - return bfd_reloc_outofrange; - - if (reloc_entry->howto->src_mask == 0) - { - /* This case arises with the 64-bit MIPS ELF ABI. */ - val = 0; - } - else - val = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address); - - /* Set val to the offset into the section or symbol. */ - val += reloc_entry->addend; - - /* Adjust val for the final section location and GP value. If we - are producing relocateable output, we don't want to do this for - an external symbol. */ - if (! relocateable - || (symbol->flags & BSF_SECTION_SYM) != 0) - val += relocation - gp; - - bfd_put_32 (abfd, val, (bfd_byte *) data + reloc_entry->address); - - if (relocateable) - reloc_entry->address += input_section->output_offset; - - return bfd_reloc_ok; -} - -/* Handle a 64 bit reloc in a 32 bit MIPS ELF file. These are - generated when addreses are 64 bits. The upper 32 bits are a simle - sign extension. */ - -static bfd_reloc_status_type -mips32_64bit_reloc (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message; -{ - bfd_reloc_status_type r; - arelent reloc32; - unsigned long val; - bfd_size_type addr; - - r = bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data, - input_section, output_bfd, error_message); - if (r != bfd_reloc_continue) - return r; - - /* Do a normal 32 bit relocation on the lower 32 bits. */ - reloc32 = *reloc_entry; - if (bfd_big_endian (abfd)) - reloc32.address += 4; - reloc32.howto = &elf_mips_howto_table[R_MIPS_32]; - r = bfd_perform_relocation (abfd, &reloc32, data, input_section, - output_bfd, error_message); - - /* Sign extend into the upper 32 bits. */ - val = bfd_get_32 (abfd, (bfd_byte *) data + reloc32.address); - if ((val & 0x80000000) != 0) - val = 0xffffffff; - else - val = 0; - addr = reloc_entry->address; - if (bfd_little_endian (abfd)) - addr += 4; - bfd_put_32 (abfd, val, (bfd_byte *) data + addr); - - return r; -} - -/* Handle a mips16 jump. */ - -static bfd_reloc_status_type -mips16_jump_reloc (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd ATTRIBUTE_UNUSED; - arelent *reloc_entry; - asymbol *symbol; - PTR data ATTRIBUTE_UNUSED; - asection *input_section; - bfd *output_bfd; - char **error_message ATTRIBUTE_UNUSED; -{ - if (output_bfd != (bfd *) NULL - && (symbol->flags & BSF_SECTION_SYM) == 0 - && reloc_entry->addend == 0) - { - reloc_entry->address += input_section->output_offset; - return bfd_reloc_ok; - } - - /* FIXME. */ - { - static boolean warned; - - if (! warned) - (*_bfd_error_handler) - (_("Linking mips16 objects into %s format is not supported"), - bfd_get_target (input_section->output_section->owner)); - warned = true; - } - - return bfd_reloc_undefined; -} - -/* Handle a mips16 GP relative reloc. */ - -static bfd_reloc_status_type -mips16_gprel_reloc (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message; -{ - boolean relocateable; - bfd_reloc_status_type ret; - bfd_vma gp; - unsigned short extend, insn; - unsigned long final; - - /* If we're relocating, and this is an external symbol with no - addend, we don't want to change anything. We will only have an - addend if this is a newly created reloc, not read from an ELF - file. */ - if (output_bfd != NULL - && (symbol->flags & BSF_SECTION_SYM) == 0 - && reloc_entry->addend == 0) - { - reloc_entry->address += input_section->output_offset; - return bfd_reloc_ok; - } - - if (output_bfd != NULL) - relocateable = true; - else - { - relocateable = false; - output_bfd = symbol->section->output_section->owner; - } - - ret = mips_elf_final_gp (output_bfd, symbol, relocateable, error_message, - &gp); - if (ret != bfd_reloc_ok) - return ret; - - if (reloc_entry->address > input_section->_cooked_size) - return bfd_reloc_outofrange; - - /* Pick up the mips16 extend instruction and the real instruction. */ - extend = bfd_get_16 (abfd, (bfd_byte *) data + reloc_entry->address); - insn = bfd_get_16 (abfd, (bfd_byte *) data + reloc_entry->address + 2); - - /* Stuff the current addend back as a 32 bit value, do the usual - relocation, and then clean up. */ - bfd_put_32 (abfd, - (((extend & 0x1f) << 11) - | (extend & 0x7e0) - | (insn & 0x1f)), - (bfd_byte *) data + reloc_entry->address); - - ret = gprel16_with_gp (abfd, symbol, reloc_entry, input_section, - relocateable, data, gp); - - final = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address); - bfd_put_16 (abfd, - ((extend & 0xf800) - | ((final >> 11) & 0x1f) - | (final & 0x7e0)), - (bfd_byte *) data + reloc_entry->address); - bfd_put_16 (abfd, - ((insn & 0xffe0) - | (final & 0x1f)), - (bfd_byte *) data + reloc_entry->address + 2); - - return ret; -} - -/* Return the ISA for a MIPS e_flags value. */ - -static INLINE int -elf_mips_isa (flags) - flagword flags; -{ - switch (flags & EF_MIPS_ARCH) - { - case E_MIPS_ARCH_1: - return 1; - case E_MIPS_ARCH_2: - return 2; - case E_MIPS_ARCH_3: - return 3; - case E_MIPS_ARCH_4: - return 4; - } - return 4; -} - -/* Return the MACH for a MIPS e_flags value. */ - -static INLINE int -elf_mips_mach (flags) - flagword flags; -{ - switch (flags & EF_MIPS_MACH) - { - case E_MIPS_MACH_3900: - return bfd_mach_mips3900; - - case E_MIPS_MACH_4010: - return bfd_mach_mips4010; - - case E_MIPS_MACH_4100: - return bfd_mach_mips4100; - - case E_MIPS_MACH_4111: - return bfd_mach_mips4111; - - case E_MIPS_MACH_4650: - return bfd_mach_mips4650; - - default: - switch (flags & EF_MIPS_ARCH) - { - default: - case E_MIPS_ARCH_1: - return bfd_mach_mips3000; - break; - - case E_MIPS_ARCH_2: - return bfd_mach_mips6000; - break; - - case E_MIPS_ARCH_3: - return bfd_mach_mips4000; - break; - - case E_MIPS_ARCH_4: - return bfd_mach_mips8000; - break; - } - } - - return 0; -} - -/* Return printable name for ABI. */ - -static INLINE char* -elf_mips_abi_name (abfd) - bfd *abfd; -{ - flagword flags; - - if (ABI_N32_P (abfd)) - return "N32"; - else if (ABI_64_P (abfd)) - return "64"; - - flags = elf_elfheader (abfd)->e_flags; - switch (flags & EF_MIPS_ABI) - { - case 0: - return "none"; - case E_MIPS_ABI_O32: - return "O32"; - case E_MIPS_ABI_O64: - return "O64"; - case E_MIPS_ABI_EABI32: - return "EABI32"; - case E_MIPS_ABI_EABI64: - return "EABI64"; - default: - return "unknown abi"; - } -} - -/* A mapping from BFD reloc types to MIPS ELF reloc types. */ - -struct elf_reloc_map { - bfd_reloc_code_real_type bfd_reloc_val; - enum elf_mips_reloc_type elf_reloc_val; -}; - -static CONST struct elf_reloc_map mips_reloc_map[] = -{ - { BFD_RELOC_NONE, R_MIPS_NONE, }, - { BFD_RELOC_16, R_MIPS_16 }, - { BFD_RELOC_32, R_MIPS_32 }, - { BFD_RELOC_64, R_MIPS_64 }, - { BFD_RELOC_MIPS_JMP, R_MIPS_26 }, - { BFD_RELOC_HI16_S, R_MIPS_HI16 }, - { BFD_RELOC_LO16, R_MIPS_LO16 }, - { BFD_RELOC_MIPS_GPREL, R_MIPS_GPREL16 }, - { BFD_RELOC_MIPS_LITERAL, R_MIPS_LITERAL }, - { BFD_RELOC_MIPS_GOT16, R_MIPS_GOT16 }, - { BFD_RELOC_16_PCREL, R_MIPS_PC16 }, - { BFD_RELOC_MIPS_CALL16, R_MIPS_CALL16 }, - { BFD_RELOC_MIPS_GPREL32, R_MIPS_GPREL32 }, - { BFD_RELOC_MIPS_GOT_HI16, R_MIPS_GOT_HI16 }, - { BFD_RELOC_MIPS_GOT_LO16, R_MIPS_GOT_LO16 }, - { BFD_RELOC_MIPS_CALL_HI16, R_MIPS_CALL_HI16 }, - { BFD_RELOC_MIPS_CALL_LO16, R_MIPS_CALL_LO16 }, - { BFD_RELOC_MIPS_SUB, R_MIPS_SUB }, - { BFD_RELOC_MIPS_GOT_PAGE, R_MIPS_GOT_PAGE }, - { BFD_RELOC_MIPS_GOT_OFST, R_MIPS_GOT_OFST }, - { BFD_RELOC_MIPS_GOT_DISP, R_MIPS_GOT_DISP } -}; - -/* Given a BFD reloc type, return a howto structure. */ - -static reloc_howto_type * -bfd_elf32_bfd_reloc_type_lookup (abfd, code) - bfd *abfd; - bfd_reloc_code_real_type code; -{ - unsigned int i; - - for (i = 0; i < sizeof (mips_reloc_map) / sizeof (struct elf_reloc_map); i++) - { - if (mips_reloc_map[i].bfd_reloc_val == code) - return &elf_mips_howto_table[(int) mips_reloc_map[i].elf_reloc_val]; - } - - switch (code) - { - default: - bfd_set_error (bfd_error_bad_value); - return NULL; - - case BFD_RELOC_CTOR: - /* We need to handle BFD_RELOC_CTOR specially. - Select the right relocation (R_MIPS_32 or R_MIPS_64) based on the - size of addresses on this architecture. */ - if (bfd_arch_bits_per_address (abfd) == 32) - return &elf_mips_howto_table[(int) R_MIPS_32]; - else - return &elf_mips_ctor64_howto; - - case BFD_RELOC_MIPS16_JMP: - return &elf_mips16_jump_howto; - case BFD_RELOC_MIPS16_GPREL: - return &elf_mips16_gprel_howto; - case BFD_RELOC_VTABLE_INHERIT: - return &elf_mips_gnu_vtinherit_howto; - case BFD_RELOC_VTABLE_ENTRY: - return &elf_mips_gnu_vtentry_howto; - case BFD_RELOC_PCREL_HI16_S: - return &elf_mips_gnu_rel_hi16; - case BFD_RELOC_PCREL_LO16: - return &elf_mips_gnu_rel_lo16; - case BFD_RELOC_16_PCREL_S2: - return &elf_mips_gnu_rel16_s2; - case BFD_RELOC_64_PCREL: - return &elf_mips_gnu_pcrel64; - case BFD_RELOC_32_PCREL: - return &elf_mips_gnu_pcrel32; - } -} - -/* Given a MIPS Elf32_Internal_Rel, fill in an arelent structure. */ - -static reloc_howto_type * -mips_rtype_to_howto (r_type) - unsigned int r_type; -{ - switch (r_type) - { - case R_MIPS16_26: - return &elf_mips16_jump_howto; - break; - case R_MIPS16_GPREL: - return &elf_mips16_gprel_howto; - break; - case R_MIPS_GNU_VTINHERIT: - return &elf_mips_gnu_vtinherit_howto; - break; - case R_MIPS_GNU_VTENTRY: - return &elf_mips_gnu_vtentry_howto; - break; - case R_MIPS_GNU_REL_HI16: - return &elf_mips_gnu_rel_hi16; - break; - case R_MIPS_GNU_REL_LO16: - return &elf_mips_gnu_rel_lo16; - break; - case R_MIPS_GNU_REL16_S2: - return &elf_mips_gnu_rel16_s2; - break; - case R_MIPS_PC64: - return &elf_mips_gnu_pcrel64; - break; - case R_MIPS_PC32: - return &elf_mips_gnu_pcrel32; - break; - - default: - BFD_ASSERT (r_type < (unsigned int) R_MIPS_max); - return &elf_mips_howto_table[r_type]; - break; - } -} - -/* Given a MIPS Elf32_Internal_Rel, fill in an arelent structure. */ - -static void -mips_info_to_howto_rel (abfd, cache_ptr, dst) - bfd *abfd; - arelent *cache_ptr; - Elf32_Internal_Rel *dst; -{ - unsigned int r_type; - - r_type = ELF32_R_TYPE (dst->r_info); - cache_ptr->howto = mips_rtype_to_howto (r_type); - - /* The addend for a GPREL16 or LITERAL relocation comes from the GP - value for the object file. We get the addend now, rather than - when we do the relocation, because the symbol manipulations done - by the linker may cause us to lose track of the input BFD. */ - if (((*cache_ptr->sym_ptr_ptr)->flags & BSF_SECTION_SYM) != 0 - && (r_type == (unsigned int) R_MIPS_GPREL16 - || r_type == (unsigned int) R_MIPS_LITERAL)) - cache_ptr->addend = elf_gp (abfd); -} - -/* Given a MIPS Elf32_Internal_Rela, fill in an arelent structure. */ - -static void -mips_info_to_howto_rela (abfd, cache_ptr, dst) - bfd *abfd; - arelent *cache_ptr; - Elf32_Internal_Rela *dst; -{ - /* Since an Elf32_Internal_Rel is an initial prefix of an - Elf32_Internal_Rela, we can just use mips_info_to_howto_rel - above. */ - mips_info_to_howto_rel (abfd, cache_ptr, (Elf32_Internal_Rel *) dst); - - /* If we ever need to do any extra processing with dst->r_addend - (the field omitted in an Elf32_Internal_Rel) we can do it here. */ -} - -/* A .reginfo section holds a single Elf32_RegInfo structure. These - routines swap this structure in and out. They are used outside of - BFD, so they are globally visible. */ - -void -bfd_mips_elf32_swap_reginfo_in (abfd, ex, in) - bfd *abfd; - const Elf32_External_RegInfo *ex; - Elf32_RegInfo *in; -{ - in->ri_gprmask = bfd_h_get_32 (abfd, (bfd_byte *) ex->ri_gprmask); - in->ri_cprmask[0] = bfd_h_get_32 (abfd, (bfd_byte *) ex->ri_cprmask[0]); - in->ri_cprmask[1] = bfd_h_get_32 (abfd, (bfd_byte *) ex->ri_cprmask[1]); - in->ri_cprmask[2] = bfd_h_get_32 (abfd, (bfd_byte *) ex->ri_cprmask[2]); - in->ri_cprmask[3] = bfd_h_get_32 (abfd, (bfd_byte *) ex->ri_cprmask[3]); - in->ri_gp_value = bfd_h_get_32 (abfd, (bfd_byte *) ex->ri_gp_value); -} - -void -bfd_mips_elf32_swap_reginfo_out (abfd, in, ex) - bfd *abfd; - const Elf32_RegInfo *in; - Elf32_External_RegInfo *ex; -{ - bfd_h_put_32 (abfd, (bfd_vma) in->ri_gprmask, - (bfd_byte *) ex->ri_gprmask); - bfd_h_put_32 (abfd, (bfd_vma) in->ri_cprmask[0], - (bfd_byte *) ex->ri_cprmask[0]); - bfd_h_put_32 (abfd, (bfd_vma) in->ri_cprmask[1], - (bfd_byte *) ex->ri_cprmask[1]); - bfd_h_put_32 (abfd, (bfd_vma) in->ri_cprmask[2], - (bfd_byte *) ex->ri_cprmask[2]); - bfd_h_put_32 (abfd, (bfd_vma) in->ri_cprmask[3], - (bfd_byte *) ex->ri_cprmask[3]); - bfd_h_put_32 (abfd, (bfd_vma) in->ri_gp_value, - (bfd_byte *) ex->ri_gp_value); -} - -/* In the 64 bit ABI, the .MIPS.options section holds register - information in an Elf64_Reginfo structure. These routines swap - them in and out. They are globally visible because they are used - outside of BFD. These routines are here so that gas can call them - without worrying about whether the 64 bit ABI has been included. */ - -void -bfd_mips_elf64_swap_reginfo_in (abfd, ex, in) - bfd *abfd; - const Elf64_External_RegInfo *ex; - Elf64_Internal_RegInfo *in; -{ - in->ri_gprmask = bfd_h_get_32 (abfd, (bfd_byte *) ex->ri_gprmask); - in->ri_pad = bfd_h_get_32 (abfd, (bfd_byte *) ex->ri_pad); - in->ri_cprmask[0] = bfd_h_get_32 (abfd, (bfd_byte *) ex->ri_cprmask[0]); - in->ri_cprmask[1] = bfd_h_get_32 (abfd, (bfd_byte *) ex->ri_cprmask[1]); - in->ri_cprmask[2] = bfd_h_get_32 (abfd, (bfd_byte *) ex->ri_cprmask[2]); - in->ri_cprmask[3] = bfd_h_get_32 (abfd, (bfd_byte *) ex->ri_cprmask[3]); - in->ri_gp_value = bfd_h_get_64 (abfd, (bfd_byte *) ex->ri_gp_value); -} - -void -bfd_mips_elf64_swap_reginfo_out (abfd, in, ex) - bfd *abfd; - const Elf64_Internal_RegInfo *in; - Elf64_External_RegInfo *ex; -{ - bfd_h_put_32 (abfd, (bfd_vma) in->ri_gprmask, - (bfd_byte *) ex->ri_gprmask); - bfd_h_put_32 (abfd, (bfd_vma) in->ri_pad, - (bfd_byte *) ex->ri_pad); - bfd_h_put_32 (abfd, (bfd_vma) in->ri_cprmask[0], - (bfd_byte *) ex->ri_cprmask[0]); - bfd_h_put_32 (abfd, (bfd_vma) in->ri_cprmask[1], - (bfd_byte *) ex->ri_cprmask[1]); - bfd_h_put_32 (abfd, (bfd_vma) in->ri_cprmask[2], - (bfd_byte *) ex->ri_cprmask[2]); - bfd_h_put_32 (abfd, (bfd_vma) in->ri_cprmask[3], - (bfd_byte *) ex->ri_cprmask[3]); - bfd_h_put_64 (abfd, (bfd_vma) in->ri_gp_value, - (bfd_byte *) ex->ri_gp_value); -} - -/* Swap an entry in a .gptab section. Note that these routines rely - on the equivalence of the two elements of the union. */ - -static void -bfd_mips_elf32_swap_gptab_in (abfd, ex, in) - bfd *abfd; - const Elf32_External_gptab *ex; - Elf32_gptab *in; -{ - in->gt_entry.gt_g_value = bfd_h_get_32 (abfd, ex->gt_entry.gt_g_value); - in->gt_entry.gt_bytes = bfd_h_get_32 (abfd, ex->gt_entry.gt_bytes); -} - -static void -bfd_mips_elf32_swap_gptab_out (abfd, in, ex) - bfd *abfd; - const Elf32_gptab *in; - Elf32_External_gptab *ex; -{ - bfd_h_put_32 (abfd, (bfd_vma) in->gt_entry.gt_g_value, - ex->gt_entry.gt_g_value); - bfd_h_put_32 (abfd, (bfd_vma) in->gt_entry.gt_bytes, - ex->gt_entry.gt_bytes); -} - -static void -bfd_elf32_swap_compact_rel_out (abfd, in, ex) - bfd *abfd; - const Elf32_compact_rel *in; - Elf32_External_compact_rel *ex; -{ - bfd_h_put_32 (abfd, (bfd_vma) in->id1, ex->id1); - bfd_h_put_32 (abfd, (bfd_vma) in->num, ex->num); - bfd_h_put_32 (abfd, (bfd_vma) in->id2, ex->id2); - bfd_h_put_32 (abfd, (bfd_vma) in->offset, ex->offset); - bfd_h_put_32 (abfd, (bfd_vma) in->reserved0, ex->reserved0); - bfd_h_put_32 (abfd, (bfd_vma) in->reserved1, ex->reserved1); -} - -static void -bfd_elf32_swap_crinfo_out (abfd, in, ex) - bfd *abfd; - const Elf32_crinfo *in; - Elf32_External_crinfo *ex; -{ - unsigned long l; - - l = (((in->ctype & CRINFO_CTYPE) << CRINFO_CTYPE_SH) - | ((in->rtype & CRINFO_RTYPE) << CRINFO_RTYPE_SH) - | ((in->dist2to & CRINFO_DIST2TO) << CRINFO_DIST2TO_SH) - | ((in->relvaddr & CRINFO_RELVADDR) << CRINFO_RELVADDR_SH)); - bfd_h_put_32 (abfd, (bfd_vma) l, ex->info); - bfd_h_put_32 (abfd, (bfd_vma) in->konst, ex->konst); - bfd_h_put_32 (abfd, (bfd_vma) in->vaddr, ex->vaddr); -} - -/* Swap in an options header. */ - -void -bfd_mips_elf_swap_options_in (abfd, ex, in) - bfd *abfd; - const Elf_External_Options *ex; - Elf_Internal_Options *in; -{ - in->kind = bfd_h_get_8 (abfd, ex->kind); - in->size = bfd_h_get_8 (abfd, ex->size); - in->section = bfd_h_get_16 (abfd, ex->section); - in->info = bfd_h_get_32 (abfd, ex->info); -} - -/* Swap out an options header. */ - -void -bfd_mips_elf_swap_options_out (abfd, in, ex) - bfd *abfd; - const Elf_Internal_Options *in; - Elf_External_Options *ex; -{ - bfd_h_put_8 (abfd, in->kind, ex->kind); - bfd_h_put_8 (abfd, in->size, ex->size); - bfd_h_put_16 (abfd, in->section, ex->section); - bfd_h_put_32 (abfd, in->info, ex->info); -} -#if 0 -/* Swap in an MSYM entry. */ - -static void -bfd_mips_elf_swap_msym_in (abfd, ex, in) - bfd *abfd; - const Elf32_External_Msym *ex; - Elf32_Internal_Msym *in; -{ - in->ms_hash_value = bfd_h_get_32 (abfd, ex->ms_hash_value); - in->ms_info = bfd_h_get_32 (abfd, ex->ms_info); -} -#endif -/* Swap out an MSYM entry. */ - -static void -bfd_mips_elf_swap_msym_out (abfd, in, ex) - bfd *abfd; - const Elf32_Internal_Msym *in; - Elf32_External_Msym *ex; -{ - bfd_h_put_32 (abfd, in->ms_hash_value, ex->ms_hash_value); - bfd_h_put_32 (abfd, in->ms_info, ex->ms_info); -} - - -/* Determine whether a symbol is global for the purposes of splitting - the symbol table into global symbols and local symbols. At least - on Irix 5, this split must be between section symbols and all other - symbols. On most ELF targets the split is between static symbols - and externally visible symbols. */ - -/*ARGSUSED*/ -static boolean -mips_elf_sym_is_global (abfd, sym) - bfd *abfd ATTRIBUTE_UNUSED; - asymbol *sym; -{ - return (sym->flags & BSF_SECTION_SYM) == 0 ? true : false; -} - -/* Set the right machine number for a MIPS ELF file. This is used for - both the 32-bit and the 64-bit ABI. */ - -boolean -_bfd_mips_elf_object_p (abfd) - bfd *abfd; -{ - /* Irix 5 and 6 is broken. Object file symbol tables are not always - sorted correctly such that local symbols precede global symbols, - and the sh_info field in the symbol table is not always right. */ - elf_bad_symtab (abfd) = true; - - bfd_default_set_arch_mach (abfd, bfd_arch_mips, - elf_mips_mach (elf_elfheader (abfd)->e_flags)); - return true; -} - -/* The final processing done just before writing out a MIPS ELF object - file. This gets the MIPS architecture right based on the machine - number. This is used by both the 32-bit and the 64-bit ABI. */ - -/*ARGSUSED*/ -void -_bfd_mips_elf_final_write_processing (abfd, linker) - bfd *abfd; - boolean linker ATTRIBUTE_UNUSED; -{ - unsigned long val; - unsigned int i; - Elf_Internal_Shdr **hdrpp; - const char *name; - asection *sec; - - switch (bfd_get_mach (abfd)) - { - default: - case bfd_mach_mips3000: - val = E_MIPS_ARCH_1; - break; - - case bfd_mach_mips3900: - val = E_MIPS_ARCH_1 | E_MIPS_MACH_3900; - break; - - case bfd_mach_mips6000: - val = E_MIPS_ARCH_2; - break; - - case bfd_mach_mips4000: - case bfd_mach_mips4300: - val = E_MIPS_ARCH_3; - break; - - case bfd_mach_mips4010: - val = E_MIPS_ARCH_3 | E_MIPS_MACH_4010; - break; - - case bfd_mach_mips4100: - val = E_MIPS_ARCH_3 | E_MIPS_MACH_4100; - break; - - case bfd_mach_mips4111: - val = E_MIPS_ARCH_3 | E_MIPS_MACH_4111; - break; - - case bfd_mach_mips4650: - val = E_MIPS_ARCH_3 | E_MIPS_MACH_4650; - break; - - case bfd_mach_mips8000: - val = E_MIPS_ARCH_4; - break; - } - - elf_elfheader (abfd)->e_flags &= ~ (EF_MIPS_ARCH | EF_MIPS_MACH); - elf_elfheader (abfd)->e_flags |= val; - - /* Set the sh_info field for .gptab sections and other appropriate - info for each special section. */ - for (i = 1, hdrpp = elf_elfsections (abfd) + 1; - i < elf_elfheader (abfd)->e_shnum; - i++, hdrpp++) - { - switch ((*hdrpp)->sh_type) - { - case SHT_MIPS_MSYM: - case SHT_MIPS_LIBLIST: - sec = bfd_get_section_by_name (abfd, ".dynstr"); - if (sec != NULL) - (*hdrpp)->sh_link = elf_section_data (sec)->this_idx; - break; - - case SHT_MIPS_GPTAB: - BFD_ASSERT ((*hdrpp)->bfd_section != NULL); - name = bfd_get_section_name (abfd, (*hdrpp)->bfd_section); - BFD_ASSERT (name != NULL - && strncmp (name, ".gptab.", sizeof ".gptab." - 1) == 0); - sec = bfd_get_section_by_name (abfd, name + sizeof ".gptab" - 1); - BFD_ASSERT (sec != NULL); - (*hdrpp)->sh_info = elf_section_data (sec)->this_idx; - break; - - case SHT_MIPS_CONTENT: - BFD_ASSERT ((*hdrpp)->bfd_section != NULL); - name = bfd_get_section_name (abfd, (*hdrpp)->bfd_section); - BFD_ASSERT (name != NULL - && strncmp (name, ".MIPS.content", - sizeof ".MIPS.content" - 1) == 0); - sec = bfd_get_section_by_name (abfd, - name + sizeof ".MIPS.content" - 1); - BFD_ASSERT (sec != NULL); - (*hdrpp)->sh_link = elf_section_data (sec)->this_idx; - break; - - case SHT_MIPS_SYMBOL_LIB: - sec = bfd_get_section_by_name (abfd, ".dynsym"); - if (sec != NULL) - (*hdrpp)->sh_link = elf_section_data (sec)->this_idx; - sec = bfd_get_section_by_name (abfd, ".liblist"); - if (sec != NULL) - (*hdrpp)->sh_info = elf_section_data (sec)->this_idx; - break; - - case SHT_MIPS_EVENTS: - BFD_ASSERT ((*hdrpp)->bfd_section != NULL); - name = bfd_get_section_name (abfd, (*hdrpp)->bfd_section); - BFD_ASSERT (name != NULL); - if (strncmp (name, ".MIPS.events", sizeof ".MIPS.events" - 1) == 0) - sec = bfd_get_section_by_name (abfd, - name + sizeof ".MIPS.events" - 1); - else - { - BFD_ASSERT (strncmp (name, ".MIPS.post_rel", - sizeof ".MIPS.post_rel" - 1) == 0); - sec = bfd_get_section_by_name (abfd, - (name - + sizeof ".MIPS.post_rel" - 1)); - } - BFD_ASSERT (sec != NULL); - (*hdrpp)->sh_link = elf_section_data (sec)->this_idx; - break; - - } - } -} - -/* Function to keep MIPS specific file flags like as EF_MIPS_PIC. */ - -boolean -_bfd_mips_elf_set_private_flags (abfd, flags) - bfd *abfd; - flagword flags; -{ - BFD_ASSERT (!elf_flags_init (abfd) - || elf_elfheader (abfd)->e_flags == flags); - - elf_elfheader (abfd)->e_flags = flags; - elf_flags_init (abfd) = true; - return true; -} - -/* Copy backend specific data from one object module to another */ - -boolean -_bfd_mips_elf_copy_private_bfd_data (ibfd, obfd) - bfd *ibfd; - bfd *obfd; -{ - if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour - || bfd_get_flavour (obfd) != bfd_target_elf_flavour) - return true; - - BFD_ASSERT (!elf_flags_init (obfd) - || (elf_elfheader (obfd)->e_flags - == elf_elfheader (ibfd)->e_flags)); - - elf_gp (obfd) = elf_gp (ibfd); - elf_elfheader (obfd)->e_flags = elf_elfheader (ibfd)->e_flags; - elf_flags_init (obfd) = true; - return true; -} - -/* Merge backend specific data from an object file to the output - object file when linking. */ - -boolean -_bfd_mips_elf_merge_private_bfd_data (ibfd, obfd) - bfd *ibfd; - bfd *obfd; -{ - flagword old_flags; - flagword new_flags; - boolean ok; - - /* Check if we have the same endianess */ - if (ibfd->xvec->byteorder != obfd->xvec->byteorder - && obfd->xvec->byteorder != BFD_ENDIAN_UNKNOWN) - { - const char *msg; - - if (bfd_big_endian (ibfd)) - msg = _("%s: compiled for a big endian system and target is little endian"); - else - msg = _("%s: compiled for a little endian system and target is big endian"); - - (*_bfd_error_handler) (msg, bfd_get_filename (ibfd)); - - bfd_set_error (bfd_error_wrong_format); - return false; - } - - if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour - || bfd_get_flavour (obfd) != bfd_target_elf_flavour) - return true; - - new_flags = elf_elfheader (ibfd)->e_flags; - elf_elfheader (obfd)->e_flags |= new_flags & EF_MIPS_NOREORDER; - old_flags = elf_elfheader (obfd)->e_flags; - - if (! elf_flags_init (obfd)) - { - elf_flags_init (obfd) = true; - elf_elfheader (obfd)->e_flags = new_flags; - elf_elfheader (obfd)->e_ident[EI_CLASS] - = elf_elfheader (ibfd)->e_ident[EI_CLASS]; - - if (bfd_get_arch (obfd) == bfd_get_arch (ibfd) - && bfd_get_arch_info (obfd)->the_default) - { - if (! bfd_set_arch_mach (obfd, bfd_get_arch (ibfd), - bfd_get_mach (ibfd))) - return false; - } - - return true; - } - - /* Check flag compatibility. */ - - new_flags &= ~EF_MIPS_NOREORDER; - old_flags &= ~EF_MIPS_NOREORDER; - - if (new_flags == old_flags) - return true; - - ok = true; - - if ((new_flags & EF_MIPS_PIC) != (old_flags & EF_MIPS_PIC)) - { - new_flags &= ~EF_MIPS_PIC; - old_flags &= ~EF_MIPS_PIC; - (*_bfd_error_handler) - (_("%s: linking PIC files with non-PIC files"), - bfd_get_filename (ibfd)); - ok = false; - } - - if ((new_flags & EF_MIPS_CPIC) != (old_flags & EF_MIPS_CPIC)) - { - new_flags &= ~EF_MIPS_CPIC; - old_flags &= ~EF_MIPS_CPIC; - (*_bfd_error_handler) - (_("%s: linking abicalls files with non-abicalls files"), - bfd_get_filename (ibfd)); - ok = false; - } - - /* Compare the ISA's. */ - if ((new_flags & (EF_MIPS_ARCH | EF_MIPS_MACH)) - != (old_flags & (EF_MIPS_ARCH | EF_MIPS_MACH))) - { - int new_mach = new_flags & EF_MIPS_MACH; - int old_mach = old_flags & EF_MIPS_MACH; - int new_isa = elf_mips_isa (new_flags); - int old_isa = elf_mips_isa (old_flags); - - /* If either has no machine specified, just compare the general isa's. - Some combinations of machines are ok, if the isa's match. */ - if (! new_mach - || ! old_mach - || new_mach == old_mach - ) - { - /* Don't warn about mixing -mips1 and -mips2 code, or mixing -mips3 - and -mips4 code. They will normally use the same data sizes and - calling conventions. */ - - if ((new_isa == 1 || new_isa == 2) - ? (old_isa != 1 && old_isa != 2) - : (old_isa == 1 || old_isa == 2)) - { - (*_bfd_error_handler) - (_("%s: ISA mismatch (-mips%d) with previous modules (-mips%d)"), - bfd_get_filename (ibfd), new_isa, old_isa); - ok = false; - } - } - - else - { - (*_bfd_error_handler) - (_("%s: ISA mismatch (%d) with previous modules (%d)"), - bfd_get_filename (ibfd), - elf_mips_mach (new_flags), - elf_mips_mach (old_flags)); - ok = false; - } - - new_flags &= ~ (EF_MIPS_ARCH | EF_MIPS_MACH); - old_flags &= ~ (EF_MIPS_ARCH | EF_MIPS_MACH); - } - - /* Compare ABI's. The 64-bit ABI does not use EF_MIPS_ABI. But, it - does set EI_CLASS differently from any 32-bit ABI. */ - if ((new_flags & EF_MIPS_ABI) != (old_flags & EF_MIPS_ABI) - || (elf_elfheader (ibfd)->e_ident[EI_CLASS] - != elf_elfheader (obfd)->e_ident[EI_CLASS])) - { - /* Only error if both are set (to different values). */ - if (((new_flags & EF_MIPS_ABI) && (old_flags & EF_MIPS_ABI)) - || (elf_elfheader (ibfd)->e_ident[EI_CLASS] - != elf_elfheader (obfd)->e_ident[EI_CLASS])) - { - (*_bfd_error_handler) - (_("%s: ABI mismatch: linking %s module with previous %s modules"), - bfd_get_filename (ibfd), - elf_mips_abi_name (ibfd), - elf_mips_abi_name (obfd)); - ok = false; - } - new_flags &= ~EF_MIPS_ABI; - old_flags &= ~EF_MIPS_ABI; - } - - /* Warn about any other mismatches */ - if (new_flags != old_flags) - { - (*_bfd_error_handler) - (_("%s: uses different e_flags (0x%lx) fields than previous modules (0x%lx)"), - bfd_get_filename (ibfd), (unsigned long) new_flags, - (unsigned long) old_flags); - ok = false; - } - - if (! ok) - { - bfd_set_error (bfd_error_bad_value); - return false; - } - - return true; -} - -boolean -_bfd_mips_elf_print_private_bfd_data (abfd, ptr) - bfd *abfd; - PTR ptr; -{ - FILE *file = (FILE *) ptr; - - BFD_ASSERT (abfd != NULL && ptr != NULL); - - /* Print normal ELF private data. */ - _bfd_elf_print_private_bfd_data (abfd, ptr); - - /* xgettext:c-format */ - fprintf (file, _ ("private flags = %lx:"), elf_elfheader (abfd)->e_flags); - - if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ABI) == E_MIPS_ABI_O32) - fprintf (file, _ (" [abi=O32]")); - else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ABI) == E_MIPS_ABI_O64) - fprintf (file, _ (" [abi=O64]")); - else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ABI) == E_MIPS_ABI_EABI32) - fprintf (file, _ (" [abi=EABI32]")); - else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ABI) == E_MIPS_ABI_EABI64) - fprintf (file, _ (" [abi=EABI64]")); - else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ABI)) - fprintf (file, _ (" [abi unknown]")); - else if (ABI_N32_P (abfd)) - fprintf (file, _ (" [abi=N32]")); - else if (ABI_64_P (abfd)) - fprintf (file, _ (" [abi=64]")); - else - fprintf (file, _ (" [no abi set]")); - - if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_1) - fprintf (file, _ (" [mips1]")); - else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_2) - fprintf (file, _ (" [mips2]")); - else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_3) - fprintf (file, _ (" [mips3]")); - else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_4) - fprintf (file, _ (" [mips4]")); - else - fprintf (file, _ (" [unknown ISA]")); - - if (elf_elfheader (abfd)->e_flags & EF_MIPS_32BITMODE) - fprintf (file, _ (" [32bitmode]")); - else - fprintf (file, _ (" [not 32bitmode]")); - - fputc ('\n', file); - - return true; -} - -/* Handle a MIPS specific section when reading an object file. This - is called when elfcode.h finds a section with an unknown type. - This routine supports both the 32-bit and 64-bit ELF ABI. - - FIXME: We need to handle the SHF_MIPS_GPREL flag, but I'm not sure - how to. */ - -boolean -_bfd_mips_elf_section_from_shdr (abfd, hdr, name) - bfd *abfd; - Elf_Internal_Shdr *hdr; - char *name; -{ - flagword flags = 0; - - /* There ought to be a place to keep ELF backend specific flags, but - at the moment there isn't one. We just keep track of the - sections by their name, instead. Fortunately, the ABI gives - suggested names for all the MIPS specific sections, so we will - probably get away with this. */ - switch (hdr->sh_type) - { - case SHT_MIPS_LIBLIST: - if (strcmp (name, ".liblist") != 0) - return false; - break; - case SHT_MIPS_MSYM: - if (strcmp (name, MIPS_ELF_MSYM_SECTION_NAME (abfd)) != 0) - return false; - break; - case SHT_MIPS_CONFLICT: - if (strcmp (name, ".conflict") != 0) - return false; - break; - case SHT_MIPS_GPTAB: - if (strncmp (name, ".gptab.", sizeof ".gptab." - 1) != 0) - return false; - break; - case SHT_MIPS_UCODE: - if (strcmp (name, ".ucode") != 0) - return false; - break; - case SHT_MIPS_DEBUG: - if (strcmp (name, ".mdebug") != 0) - return false; - flags = SEC_DEBUGGING; - break; - case SHT_MIPS_REGINFO: - if (strcmp (name, ".reginfo") != 0 - || hdr->sh_size != sizeof (Elf32_External_RegInfo)) - return false; - flags = (SEC_LINK_ONCE | SEC_LINK_DUPLICATES_SAME_SIZE); - break; - case SHT_MIPS_IFACE: - if (strcmp (name, ".MIPS.interfaces") != 0) - return false; - break; - case SHT_MIPS_CONTENT: - if (strncmp (name, ".MIPS.content", sizeof ".MIPS.content" - 1) != 0) - return false; - break; - case SHT_MIPS_OPTIONS: - if (strcmp (name, MIPS_ELF_OPTIONS_SECTION_NAME (abfd)) != 0) - return false; - break; - case SHT_MIPS_DWARF: - if (strncmp (name, ".debug_", sizeof ".debug_" - 1) != 0) - return false; - break; - case SHT_MIPS_SYMBOL_LIB: - if (strcmp (name, ".MIPS.symlib") != 0) - return false; - break; - case SHT_MIPS_EVENTS: - if (strncmp (name, ".MIPS.events", sizeof ".MIPS.events" - 1) != 0 - && strncmp (name, ".MIPS.post_rel", - sizeof ".MIPS.post_rel" - 1) != 0) - return false; - break; - default: - return false; - } - - if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name)) - return false; - - if (flags) - { - if (! bfd_set_section_flags (abfd, hdr->bfd_section, - (bfd_get_section_flags (abfd, - hdr->bfd_section) - | flags))) - return false; - } - - /* FIXME: We should record sh_info for a .gptab section. */ - - /* For a .reginfo section, set the gp value in the tdata information - from the contents of this section. We need the gp value while - processing relocs, so we just get it now. The .reginfo section - is not used in the 64-bit MIPS ELF ABI. */ - if (hdr->sh_type == SHT_MIPS_REGINFO) - { - Elf32_External_RegInfo ext; - Elf32_RegInfo s; - - if (! bfd_get_section_contents (abfd, hdr->bfd_section, (PTR) &ext, - (file_ptr) 0, sizeof ext)) - return false; - bfd_mips_elf32_swap_reginfo_in (abfd, &ext, &s); - elf_gp (abfd) = s.ri_gp_value; - } - - /* For a SHT_MIPS_OPTIONS section, look for a ODK_REGINFO entry, and - set the gp value based on what we find. We may see both - SHT_MIPS_REGINFO and SHT_MIPS_OPTIONS/ODK_REGINFO; in that case, - they should agree. */ - if (hdr->sh_type == SHT_MIPS_OPTIONS) - { - bfd_byte *contents, *l, *lend; - - contents = (bfd_byte *) bfd_malloc (hdr->sh_size); - if (contents == NULL) - return false; - if (! bfd_get_section_contents (abfd, hdr->bfd_section, contents, - (file_ptr) 0, hdr->sh_size)) - { - free (contents); - return false; - } - l = contents; - lend = contents + hdr->sh_size; - while (l + sizeof (Elf_External_Options) <= lend) - { - Elf_Internal_Options intopt; - - bfd_mips_elf_swap_options_in (abfd, (Elf_External_Options *) l, - &intopt); - if (ABI_64_P (abfd) && intopt.kind == ODK_REGINFO) - { - Elf64_Internal_RegInfo intreg; - - bfd_mips_elf64_swap_reginfo_in - (abfd, - ((Elf64_External_RegInfo *) - (l + sizeof (Elf_External_Options))), - &intreg); - elf_gp (abfd) = intreg.ri_gp_value; - } - else if (intopt.kind == ODK_REGINFO) - { - Elf32_RegInfo intreg; - - bfd_mips_elf32_swap_reginfo_in - (abfd, - ((Elf32_External_RegInfo *) - (l + sizeof (Elf_External_Options))), - &intreg); - elf_gp (abfd) = intreg.ri_gp_value; - } - l += intopt.size; - } - free (contents); - } - - return true; -} - -/* Set the correct type for a MIPS ELF section. We do this by the - section name, which is a hack, but ought to work. This routine is - used by both the 32-bit and the 64-bit ABI. */ - -boolean -_bfd_mips_elf_fake_sections (abfd, hdr, sec) - bfd *abfd; - Elf32_Internal_Shdr *hdr; - asection *sec; -{ - register const char *name; - - name = bfd_get_section_name (abfd, sec); - - if (strcmp (name, ".liblist") == 0) - { - hdr->sh_type = SHT_MIPS_LIBLIST; - hdr->sh_info = sec->_raw_size / sizeof (Elf32_Lib); - /* The sh_link field is set in final_write_processing. */ - } - else if (strcmp (name, ".conflict") == 0) - hdr->sh_type = SHT_MIPS_CONFLICT; - else if (strncmp (name, ".gptab.", sizeof ".gptab." - 1) == 0) - { - hdr->sh_type = SHT_MIPS_GPTAB; - hdr->sh_entsize = sizeof (Elf32_External_gptab); - /* The sh_info field is set in final_write_processing. */ - } - else if (strcmp (name, ".ucode") == 0) - hdr->sh_type = SHT_MIPS_UCODE; - else if (strcmp (name, ".mdebug") == 0) - { - hdr->sh_type = SHT_MIPS_DEBUG; - /* In a shared object on Irix 5.3, the .mdebug section has an - entsize of 0. FIXME: Does this matter? */ - if (SGI_COMPAT (abfd) && (abfd->flags & DYNAMIC) != 0) - hdr->sh_entsize = 0; - else - hdr->sh_entsize = 1; - } - else if (strcmp (name, ".reginfo") == 0) - { - hdr->sh_type = SHT_MIPS_REGINFO; - /* In a shared object on Irix 5.3, the .reginfo section has an - entsize of 0x18. FIXME: Does this matter? */ - if (SGI_COMPAT (abfd) && (abfd->flags & DYNAMIC) != 0) - hdr->sh_entsize = sizeof (Elf32_External_RegInfo); - else - hdr->sh_entsize = 1; - } - else if (SGI_COMPAT (abfd) - && (strcmp (name, ".hash") == 0 - || strcmp (name, ".dynamic") == 0 - || strcmp (name, ".dynstr") == 0)) - { - hdr->sh_entsize = 0; -#if 0 - /* This isn't how the Irix 6 linker behaves. */ - hdr->sh_info = SIZEOF_MIPS_DYNSYM_SECNAMES; -#endif - } - else if (strcmp (name, ".got") == 0 - || strcmp (name, MIPS_ELF_SRDATA_SECTION_NAME (abfd)) == 0 - || strcmp (name, ".sdata") == 0 - || strcmp (name, ".sbss") == 0 - || strcmp (name, ".lit4") == 0 - || strcmp (name, ".lit8") == 0) - hdr->sh_flags |= SHF_MIPS_GPREL; - else if (strcmp (name, ".MIPS.interfaces") == 0) - { - hdr->sh_type = SHT_MIPS_IFACE; - hdr->sh_flags |= SHF_MIPS_NOSTRIP; - } - else if (strncmp (name, ".MIPS.content", strlen (".MIPS.content")) == 0) - { - hdr->sh_type = SHT_MIPS_CONTENT; - hdr->sh_flags |= SHF_MIPS_NOSTRIP; - /* The sh_info field is set in final_write_processing. */ - } - else if (strcmp (name, MIPS_ELF_OPTIONS_SECTION_NAME (abfd)) == 0) - { - hdr->sh_type = SHT_MIPS_OPTIONS; - hdr->sh_entsize = 1; - hdr->sh_flags |= SHF_MIPS_NOSTRIP; - } - else if (strncmp (name, ".debug_", sizeof ".debug_" - 1) == 0) - hdr->sh_type = SHT_MIPS_DWARF; - else if (strcmp (name, ".MIPS.symlib") == 0) - { - hdr->sh_type = SHT_MIPS_SYMBOL_LIB; - /* The sh_link and sh_info fields are set in - final_write_processing. */ - } - else if (strncmp (name, ".MIPS.events", sizeof ".MIPS.events" - 1) == 0 - || strncmp (name, ".MIPS.post_rel", - sizeof ".MIPS.post_rel" - 1) == 0) - { - hdr->sh_type = SHT_MIPS_EVENTS; - hdr->sh_flags |= SHF_MIPS_NOSTRIP; - /* The sh_link field is set in final_write_processing. */ - } - else if (strcmp (name, MIPS_ELF_MSYM_SECTION_NAME (abfd)) == 0) - { - hdr->sh_type = SHT_MIPS_MSYM; - hdr->sh_flags |= SHF_ALLOC; - hdr->sh_entsize = 8; - } - - /* The generic elf_fake_sections will set up REL_HDR using the - default kind of relocations. But, we may actually need both - kinds of relocations, so we set up the second header here. */ - if ((sec->flags & SEC_RELOC) != 0) - { - struct bfd_elf_section_data *esd; - - esd = elf_section_data (sec); - BFD_ASSERT (esd->rel_hdr2 == NULL); - esd->rel_hdr2 - = (Elf_Internal_Shdr *) bfd_zalloc (abfd, sizeof (Elf_Internal_Shdr)); - if (!esd->rel_hdr2) - return false; - _bfd_elf_init_reloc_shdr (abfd, esd->rel_hdr2, sec, - !elf_section_data (sec)->use_rela_p); - } - - return true; -} - -/* Given a BFD section, try to locate the corresponding ELF section - index. This is used by both the 32-bit and the 64-bit ABI. - Actually, it's not clear to me that the 64-bit ABI supports these, - but for non-PIC objects we will certainly want support for at least - the .scommon section. */ - -boolean -_bfd_mips_elf_section_from_bfd_section (abfd, hdr, sec, retval) - bfd *abfd ATTRIBUTE_UNUSED; - Elf32_Internal_Shdr *hdr ATTRIBUTE_UNUSED; - asection *sec; - int *retval; -{ - if (strcmp (bfd_get_section_name (abfd, sec), ".scommon") == 0) - { - *retval = SHN_MIPS_SCOMMON; - return true; - } - if (strcmp (bfd_get_section_name (abfd, sec), ".acommon") == 0) - { - *retval = SHN_MIPS_ACOMMON; - return true; - } - return false; -} - -/* When are writing out the .options or .MIPS.options section, - remember the bytes we are writing out, so that we can install the - GP value in the section_processing routine. */ - -boolean -_bfd_mips_elf_set_section_contents (abfd, section, location, offset, count) - bfd *abfd; - sec_ptr section; - PTR location; - file_ptr offset; - bfd_size_type count; -{ - if (strcmp (section->name, MIPS_ELF_OPTIONS_SECTION_NAME (abfd)) == 0) - { - bfd_byte *c; - - if (elf_section_data (section) == NULL) - { - section->used_by_bfd = - (PTR) bfd_zalloc (abfd, sizeof (struct bfd_elf_section_data)); - if (elf_section_data (section) == NULL) - return false; - } - c = (bfd_byte *) elf_section_data (section)->tdata; - if (c == NULL) - { - bfd_size_type size; - - if (section->_cooked_size != 0) - size = section->_cooked_size; - else - size = section->_raw_size; - c = (bfd_byte *) bfd_zalloc (abfd, size); - if (c == NULL) - return false; - elf_section_data (section)->tdata = (PTR) c; - } - - memcpy (c + offset, location, count); - } - - return _bfd_elf_set_section_contents (abfd, section, location, offset, - count); -} - -/* Work over a section just before writing it out. This routine is - used by both the 32-bit and the 64-bit ABI. FIXME: We recognize - sections that need the SHF_MIPS_GPREL flag by name; there has to be - a better way. */ - -boolean -_bfd_mips_elf_section_processing (abfd, hdr) - bfd *abfd; - Elf_Internal_Shdr *hdr; -{ - if (hdr->sh_type == SHT_MIPS_REGINFO - && hdr->sh_size > 0) - { - bfd_byte buf[4]; - - BFD_ASSERT (hdr->sh_size == sizeof (Elf32_External_RegInfo)); - BFD_ASSERT (hdr->contents == NULL); - - if (bfd_seek (abfd, - hdr->sh_offset + sizeof (Elf32_External_RegInfo) - 4, - SEEK_SET) == -1) - return false; - bfd_h_put_32 (abfd, (bfd_vma) elf_gp (abfd), buf); - if (bfd_write (buf, (bfd_size_type) 1, (bfd_size_type) 4, abfd) != 4) - return false; - } - - if (hdr->sh_type == SHT_MIPS_OPTIONS - && hdr->bfd_section != NULL - && elf_section_data (hdr->bfd_section) != NULL - && elf_section_data (hdr->bfd_section)->tdata != NULL) - { - bfd_byte *contents, *l, *lend; - - /* We stored the section contents in the elf_section_data tdata - field in the set_section_contents routine. We save the - section contents so that we don't have to read them again. - At this point we know that elf_gp is set, so we can look - through the section contents to see if there is an - ODK_REGINFO structure. */ - - contents = (bfd_byte *) elf_section_data (hdr->bfd_section)->tdata; - l = contents; - lend = contents + hdr->sh_size; - while (l + sizeof (Elf_External_Options) <= lend) - { - Elf_Internal_Options intopt; - - bfd_mips_elf_swap_options_in (abfd, (Elf_External_Options *) l, - &intopt); - if (ABI_64_P (abfd) && intopt.kind == ODK_REGINFO) - { - bfd_byte buf[8]; - - if (bfd_seek (abfd, - (hdr->sh_offset - + (l - contents) - + sizeof (Elf_External_Options) - + (sizeof (Elf64_External_RegInfo) - 8)), - SEEK_SET) == -1) - return false; - bfd_h_put_64 (abfd, elf_gp (abfd), buf); - if (bfd_write (buf, 1, 8, abfd) != 8) - return false; - } - else if (intopt.kind == ODK_REGINFO) - { - bfd_byte buf[4]; - - if (bfd_seek (abfd, - (hdr->sh_offset - + (l - contents) - + sizeof (Elf_External_Options) - + (sizeof (Elf32_External_RegInfo) - 4)), - SEEK_SET) == -1) - return false; - bfd_h_put_32 (abfd, elf_gp (abfd), buf); - if (bfd_write (buf, 1, 4, abfd) != 4) - return false; - } - l += intopt.size; - } - } - - if (hdr->bfd_section != NULL) - { - const char *name = bfd_get_section_name (abfd, hdr->bfd_section); - - if (strcmp (name, ".sdata") == 0 - || strcmp (name, ".lit8") == 0 - || strcmp (name, ".lit4") == 0) - { - hdr->sh_flags |= SHF_ALLOC | SHF_WRITE | SHF_MIPS_GPREL; - hdr->sh_type = SHT_PROGBITS; - } - else if (strcmp (name, ".sbss") == 0) - { - hdr->sh_flags |= SHF_ALLOC | SHF_WRITE | SHF_MIPS_GPREL; - hdr->sh_type = SHT_NOBITS; - } - else if (strcmp (name, MIPS_ELF_SRDATA_SECTION_NAME (abfd)) == 0) - { - hdr->sh_flags |= SHF_ALLOC | SHF_MIPS_GPREL; - hdr->sh_type = SHT_PROGBITS; - } - else if (strcmp (name, ".compact_rel") == 0) - { - hdr->sh_flags = 0; - hdr->sh_type = SHT_PROGBITS; - } - else if (strcmp (name, ".rtproc") == 0) - { - if (hdr->sh_addralign != 0 && hdr->sh_entsize == 0) - { - unsigned int adjust; - - adjust = hdr->sh_size % hdr->sh_addralign; - if (adjust != 0) - hdr->sh_size += hdr->sh_addralign - adjust; - } - } - } - - return true; -} - - -/* MIPS ELF 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. This approach is copied from ecoff.c. */ -static asection mips_elf_scom_section; -static asymbol mips_elf_scom_symbol; -static asymbol *mips_elf_scom_symbol_ptr; - -/* MIPS ELF also uses an acommon section, which represents an - allocated common symbol which may be overridden by a - definition in a shared library. */ -static asection mips_elf_acom_section; -static asymbol mips_elf_acom_symbol; -static asymbol *mips_elf_acom_symbol_ptr; - -/* The Irix 5 support uses two virtual sections, which represent - text/data symbols defined in dynamic objects. */ -static asection mips_elf_text_section; -static asection *mips_elf_text_section_ptr; -static asymbol mips_elf_text_symbol; -static asymbol *mips_elf_text_symbol_ptr; - -static asection mips_elf_data_section; -static asection *mips_elf_data_section_ptr; -static asymbol mips_elf_data_symbol; -static asymbol *mips_elf_data_symbol_ptr; - -/* Handle the special MIPS section numbers that a symbol may use. - This is used for both the 32-bit and the 64-bit ABI. */ - -void -_bfd_mips_elf_symbol_processing (abfd, asym) - bfd *abfd; - asymbol *asym; -{ - elf_symbol_type *elfsym; - - elfsym = (elf_symbol_type *) asym; - switch (elfsym->internal_elf_sym.st_shndx) - { - case SHN_MIPS_ACOMMON: - /* This section is used in a dynamically linked executable file. - It is an allocated common section. The dynamic linker can - either resolve these symbols to something in a shared - library, or it can just leave them here. For our purposes, - we can consider these symbols to be in a new section. */ - if (mips_elf_acom_section.name == NULL) - { - /* Initialize the acommon section. */ - mips_elf_acom_section.name = ".acommon"; - mips_elf_acom_section.flags = SEC_ALLOC; - mips_elf_acom_section.output_section = &mips_elf_acom_section; - mips_elf_acom_section.symbol = &mips_elf_acom_symbol; - mips_elf_acom_section.symbol_ptr_ptr = &mips_elf_acom_symbol_ptr; - mips_elf_acom_symbol.name = ".acommon"; - mips_elf_acom_symbol.flags = BSF_SECTION_SYM; - mips_elf_acom_symbol.section = &mips_elf_acom_section; - mips_elf_acom_symbol_ptr = &mips_elf_acom_symbol; - } - asym->section = &mips_elf_acom_section; - break; - - case SHN_COMMON: - /* Common symbols less than the GP size are automatically - treated as SHN_MIPS_SCOMMON symbols on IRIX5. */ - if (asym->value > elf_gp_size (abfd) - || IRIX_COMPAT (abfd) == ict_irix6) - break; - /* Fall through. */ - case SHN_MIPS_SCOMMON: - if (mips_elf_scom_section.name == NULL) - { - /* Initialize the small common section. */ - mips_elf_scom_section.name = ".scommon"; - mips_elf_scom_section.flags = SEC_IS_COMMON; - mips_elf_scom_section.output_section = &mips_elf_scom_section; - mips_elf_scom_section.symbol = &mips_elf_scom_symbol; - mips_elf_scom_section.symbol_ptr_ptr = &mips_elf_scom_symbol_ptr; - mips_elf_scom_symbol.name = ".scommon"; - mips_elf_scom_symbol.flags = BSF_SECTION_SYM; - mips_elf_scom_symbol.section = &mips_elf_scom_section; - mips_elf_scom_symbol_ptr = &mips_elf_scom_symbol; - } - asym->section = &mips_elf_scom_section; - asym->value = elfsym->internal_elf_sym.st_size; - break; - - case SHN_MIPS_SUNDEFINED: - asym->section = bfd_und_section_ptr; - break; - -#if 0 /* for SGI_COMPAT */ - case SHN_MIPS_TEXT: - asym->section = mips_elf_text_section_ptr; - break; - - case SHN_MIPS_DATA: - asym->section = mips_elf_data_section_ptr; - break; -#endif - } -} - -/* When creating an Irix 5 executable, we need REGINFO and RTPROC - segments. */ - -int -_bfd_mips_elf_additional_program_headers (abfd) - bfd *abfd; -{ - asection *s; - int ret = 0; - - if (!SGI_COMPAT (abfd)) - return 0; - - /* See if we need a PT_MIPS_REGINFO segment. */ - s = bfd_get_section_by_name (abfd, ".reginfo"); - if (s && (s->flags & SEC_LOAD)) - ++ret; - - /* See if we need a PT_MIPS_OPTIONS segment. */ - if (IRIX_COMPAT (abfd) == ict_irix6 - && bfd_get_section_by_name (abfd, - MIPS_ELF_OPTIONS_SECTION_NAME (abfd))) - ++ret; - - /* See if we need a PT_MIPS_RTPROC segment. */ - if (IRIX_COMPAT (abfd) == ict_irix5 - && bfd_get_section_by_name (abfd, ".dynamic") - && bfd_get_section_by_name (abfd, ".mdebug")) - ++ret; - - return ret; -} - -/* Modify the segment map for an Irix 5 executable. */ - -boolean -_bfd_mips_elf_modify_segment_map (abfd) - bfd *abfd; -{ - asection *s; - struct elf_segment_map *m, **pm; - - if (! SGI_COMPAT (abfd)) - return true; - - /* If there is a .reginfo section, we need a PT_MIPS_REGINFO - segment. */ - s = bfd_get_section_by_name (abfd, ".reginfo"); - if (s != NULL && (s->flags & SEC_LOAD) != 0) - { - for (m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next) - if (m->p_type == PT_MIPS_REGINFO) - break; - if (m == NULL) - { - m = (struct elf_segment_map *) bfd_zalloc (abfd, sizeof *m); - if (m == NULL) - return false; - - m->p_type = PT_MIPS_REGINFO; - m->count = 1; - m->sections[0] = s; - - /* We want to put it after the PHDR and INTERP segments. */ - pm = &elf_tdata (abfd)->segment_map; - while (*pm != NULL - && ((*pm)->p_type == PT_PHDR - || (*pm)->p_type == PT_INTERP)) - pm = &(*pm)->next; - - m->next = *pm; - *pm = m; - } - } - - /* For IRIX 6, we don't have .mdebug sections, nor does anything but - .dynamic end up in PT_DYNAMIC. However, we do have to insert a - PT_OPTIONS segement immediately following the program header - table. */ - if (IRIX_COMPAT (abfd) == ict_irix6) - { - asection *s; - - for (s = abfd->sections; s; s = s->next) - if (elf_section_data (s)->this_hdr.sh_type == SHT_MIPS_OPTIONS) - break; - - if (s) - { - struct elf_segment_map *options_segment; - - /* Usually, there's a program header table. But, sometimes - there's not (like when running the `ld' testsuite). So, - if there's no program header table, we just put the - options segement at the end. */ - for (pm = &elf_tdata (abfd)->segment_map; - *pm != NULL; - pm = &(*pm)->next) - if ((*pm)->p_type == PT_PHDR) - break; - - options_segment = bfd_zalloc (abfd, - sizeof (struct elf_segment_map)); - options_segment->next = *pm; - options_segment->p_type = PT_MIPS_OPTIONS; - options_segment->p_flags = PF_R; - options_segment->p_flags_valid = true; - options_segment->count = 1; - options_segment->sections[0] = s; - *pm = options_segment; - } - } - else - { - /* If there are .dynamic and .mdebug sections, we make a room - for the RTPROC header. FIXME: Rewrite without section names. */ - if (bfd_get_section_by_name (abfd, ".interp") == NULL - && bfd_get_section_by_name (abfd, ".dynamic") != NULL - && bfd_get_section_by_name (abfd, ".mdebug") != NULL) - { - for (m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next) - if (m->p_type == PT_MIPS_RTPROC) - break; - if (m == NULL) - { - m = (struct elf_segment_map *) bfd_zalloc (abfd, sizeof *m); - if (m == NULL) - return false; - - m->p_type = PT_MIPS_RTPROC; - - s = bfd_get_section_by_name (abfd, ".rtproc"); - if (s == NULL) - { - m->count = 0; - m->p_flags = 0; - m->p_flags_valid = 1; - } - else - { - m->count = 1; - m->sections[0] = s; - } - - /* We want to put it after the DYNAMIC segment. */ - pm = &elf_tdata (abfd)->segment_map; - while (*pm != NULL && (*pm)->p_type != PT_DYNAMIC) - pm = &(*pm)->next; - if (*pm != NULL) - pm = &(*pm)->next; - - m->next = *pm; - *pm = m; - } - } - - /* On Irix 5, the PT_DYNAMIC segment includes the .dynamic, - .dynstr, .dynsym, and .hash sections, and everything in - between. */ - for (pm = &elf_tdata (abfd)->segment_map; *pm != NULL; pm = &(*pm)->next) - if ((*pm)->p_type == PT_DYNAMIC) - break; - m = *pm; - if (m != NULL - && m->count == 1 - && strcmp (m->sections[0]->name, ".dynamic") == 0) - { - static const char *sec_names[] = - { ".dynamic", ".dynstr", ".dynsym", ".hash" }; - bfd_vma low, high; - unsigned int i, c; - struct elf_segment_map *n; - - low = 0xffffffff; - high = 0; - for (i = 0; i < sizeof sec_names / sizeof sec_names[0]; i++) - { - s = bfd_get_section_by_name (abfd, sec_names[i]); - if (s != NULL && (s->flags & SEC_LOAD) != 0) - { - bfd_size_type sz; - - if (low > s->vma) - low = s->vma; - sz = s->_cooked_size; - if (sz == 0) - sz = s->_raw_size; - if (high < s->vma + sz) - high = s->vma + sz; - } - } - - c = 0; - for (s = abfd->sections; s != NULL; s = s->next) - if ((s->flags & SEC_LOAD) != 0 - && s->vma >= low - && ((s->vma - + (s->_cooked_size != 0 ? s->_cooked_size : s->_raw_size)) - <= high)) - ++c; - - n = ((struct elf_segment_map *) - bfd_zalloc (abfd, sizeof *n + (c - 1) * sizeof (asection *))); - if (n == NULL) - return false; - *n = *m; - n->count = c; - - i = 0; - for (s = abfd->sections; s != NULL; s = s->next) - { - if ((s->flags & SEC_LOAD) != 0 - && s->vma >= low - && ((s->vma - + (s->_cooked_size != 0 ? - s->_cooked_size : s->_raw_size)) - <= high)) - { - n->sections[i] = s; - ++i; - } - } - - *pm = n; - } - } - - return true; -} - -/* The structure of the runtime procedure descriptor created by the - loader for use by the static exception system. */ - -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) - -/* Swap RPDR (runtime procedure table entry) for output. */ - -static void ecoff_swap_rpdr_out - PARAMS ((bfd *, const RPDR *, struct rpdr_ext *)); - -static void -ecoff_swap_rpdr_out (abfd, in, ex) - bfd *abfd; - const RPDR *in; - struct rpdr_ext *ex; -{ - /* ecoff_put_off was defined in ecoffswap.h. */ - ecoff_put_off (abfd, in->adr, (bfd_byte *) ex->p_adr); - bfd_h_put_32 (abfd, in->regmask, (bfd_byte *) ex->p_regmask); - bfd_h_put_32 (abfd, in->regoffset, (bfd_byte *) ex->p_regoffset); - bfd_h_put_32 (abfd, in->fregmask, (bfd_byte *) ex->p_fregmask); - bfd_h_put_32 (abfd, in->fregoffset, (bfd_byte *) ex->p_fregoffset); - bfd_h_put_32 (abfd, in->frameoffset, (bfd_byte *) ex->p_frameoffset); - - bfd_h_put_16 (abfd, in->framereg, (bfd_byte *) ex->p_framereg); - bfd_h_put_16 (abfd, in->pcreg, (bfd_byte *) ex->p_pcreg); - - bfd_h_put_32 (abfd, in->irpss, (bfd_byte *) ex->p_irpss); -#if 0 /* FIXME */ - ecoff_put_off (abfd, in->exception_info, (bfd_byte *) ex->p_exception_info); -#endif -} - -/* Read ECOFF debugging information from a .mdebug section into a - ecoff_debug_info structure. */ - -boolean -_bfd_mips_elf_read_ecoff_info (abfd, section, debug) - bfd *abfd; - asection *section; - struct ecoff_debug_info *debug; -{ - HDRR *symhdr; - const struct ecoff_debug_swap *swap; - char *ext_hdr = NULL; - - swap = get_elf_backend_data (abfd)->elf_backend_ecoff_debug_swap; - memset (debug, 0, sizeof(*debug)); - - ext_hdr = (char *) bfd_malloc ((size_t) swap->external_hdr_size); - if (ext_hdr == NULL && swap->external_hdr_size != 0) - goto error_return; - - if (bfd_get_section_contents (abfd, section, ext_hdr, (file_ptr) 0, - swap->external_hdr_size) - == false) - goto error_return; - - symhdr = &debug->symbolic_header; - (*swap->swap_hdr_in) (abfd, ext_hdr, symhdr); - - /* The symbolic header contains absolute file offsets and sizes to - read. */ -#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) \ - goto error_return; \ - if (bfd_seek (abfd, (file_ptr) symhdr->offset, SEEK_SET) != 0 \ - || (bfd_read (debug->ptr, size, symhdr->count, \ - abfd) != size * symhdr->count)) \ - goto error_return; \ - } - - READ (line, cbLineOffset, cbLine, sizeof (unsigned char), unsigned char *); - READ (external_dnr, cbDnOffset, idnMax, swap->external_dnr_size, PTR); - READ (external_pdr, cbPdOffset, ipdMax, swap->external_pdr_size, PTR); - READ (external_sym, cbSymOffset, isymMax, swap->external_sym_size, PTR); - READ (external_opt, cbOptOffset, ioptMax, swap->external_opt_size, PTR); - READ (external_aux, cbAuxOffset, iauxMax, sizeof (union aux_ext), - union aux_ext *); - READ (ss, cbSsOffset, issMax, sizeof (char), char *); - READ (ssext, cbSsExtOffset, issExtMax, sizeof (char), char *); - READ (external_fdr, cbFdOffset, ifdMax, swap->external_fdr_size, PTR); - READ (external_rfd, cbRfdOffset, crfd, swap->external_rfd_size, PTR); - READ (external_ext, cbExtOffset, iextMax, swap->external_ext_size, PTR); -#undef READ - - debug->fdr = NULL; - debug->adjust = NULL; - - return true; - - error_return: - if (ext_hdr != NULL) - free (ext_hdr); - 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->ssext != NULL) - free (debug->ssext); - if (debug->external_fdr != NULL) - free (debug->external_fdr); - if (debug->external_rfd != NULL) - free (debug->external_rfd); - if (debug->external_ext != NULL) - free (debug->external_ext); - return false; -} - -/* MIPS ELF local labels start with '$', not 'L'. */ - -/*ARGSUSED*/ -static boolean -mips_elf_is_local_label_name (abfd, name) - bfd *abfd; - const char *name; -{ - if (name[0] == '$') - return true; - - /* On Irix 6, the labels go back to starting with '.', so we accept - the generic ELF local label syntax as well. */ - return _bfd_elf_is_local_label_name (abfd, name); -} - -/* MIPS ELF uses a special find_nearest_line routine in order the - handle the ECOFF debugging information. */ - -struct mips_elf_find_line -{ - struct ecoff_debug_info d; - struct ecoff_find_line i; -}; - -boolean -_bfd_mips_elf_find_nearest_line (abfd, section, symbols, offset, filename_ptr, - functionname_ptr, line_ptr) - bfd *abfd; - asection *section; - asymbol **symbols; - bfd_vma offset; - const char **filename_ptr; - const char **functionname_ptr; - unsigned int *line_ptr; -{ - asection *msec; - - if (_bfd_dwarf1_find_nearest_line (abfd, section, symbols, offset, - filename_ptr, functionname_ptr, - line_ptr)) - return true; - - if (_bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset, - filename_ptr, functionname_ptr, - line_ptr, - ABI_64_P (abfd) ? 8 : 0)) - return true; - - msec = bfd_get_section_by_name (abfd, ".mdebug"); - if (msec != NULL) - { - flagword origflags; - struct mips_elf_find_line *fi; - const struct ecoff_debug_swap * const swap = - get_elf_backend_data (abfd)->elf_backend_ecoff_debug_swap; - - /* If we are called during a link, mips_elf_final_link may have - cleared the SEC_HAS_CONTENTS field. We force it back on here - if appropriate (which it normally will be). */ - origflags = msec->flags; - if (elf_section_data (msec)->this_hdr.sh_type != SHT_NOBITS) - msec->flags |= SEC_HAS_CONTENTS; - - fi = elf_tdata (abfd)->find_line_info; - if (fi == NULL) - { - bfd_size_type external_fdr_size; - char *fraw_src; - char *fraw_end; - struct fdr *fdr_ptr; - - fi = ((struct mips_elf_find_line *) - bfd_zalloc (abfd, sizeof (struct mips_elf_find_line))); - if (fi == NULL) - { - msec->flags = origflags; - return false; - } - - if (! _bfd_mips_elf_read_ecoff_info (abfd, msec, &fi->d)) - { - msec->flags = origflags; - return false; - } - - /* Swap in the FDR information. */ - fi->d.fdr = ((struct fdr *) - bfd_alloc (abfd, - (fi->d.symbolic_header.ifdMax * - sizeof (struct fdr)))); - if (fi->d.fdr == NULL) - { - msec->flags = origflags; - return false; - } - external_fdr_size = swap->external_fdr_size; - fdr_ptr = fi->d.fdr; - fraw_src = (char *) fi->d.external_fdr; - fraw_end = (fraw_src - + fi->d.symbolic_header.ifdMax * external_fdr_size); - for (; fraw_src < fraw_end; fraw_src += external_fdr_size, fdr_ptr++) - (*swap->swap_fdr_in) (abfd, (PTR) fraw_src, fdr_ptr); - - elf_tdata (abfd)->find_line_info = fi; - - /* Note that we don't bother to ever free this information. - find_nearest_line is either called all the time, as in - objdump -l, so the information should be saved, or it is - rarely called, as in ld error messages, so the memory - wasted is unimportant. Still, it would probably be a - good idea for free_cached_info to throw it away. */ - } - - if (_bfd_ecoff_locate_line (abfd, section, offset, &fi->d, swap, - &fi->i, filename_ptr, functionname_ptr, - line_ptr)) - { - msec->flags = origflags; - return true; - } - - msec->flags = origflags; - } - - /* Fall back on the generic ELF find_nearest_line routine. */ - - return _bfd_elf_find_nearest_line (abfd, section, symbols, offset, - filename_ptr, functionname_ptr, - line_ptr); -} - - /* The mips16 compiler uses a couple of special sections to handle - floating point arguments. - - Section names that look like .mips16.fn.FNNAME contain stubs that - copy floating point arguments from the fp regs to the gp regs and - then jump to FNNAME. If any 32 bit function calls FNNAME, the - call should be redirected to the stub instead. If no 32 bit - function calls FNNAME, the stub should be discarded. We need to - consider any reference to the function, not just a call, because - if the address of the function is taken we will need the stub, - since the address might be passed to a 32 bit function. - - Section names that look like .mips16.call.FNNAME contain stubs - that copy floating point arguments from the gp regs to the fp - regs and then jump to FNNAME. If FNNAME is a 32 bit function, - then any 16 bit function that calls FNNAME should be redirected - to the stub instead. If FNNAME is not a 32 bit function, the - stub should be discarded. - - .mips16.call.fp.FNNAME sections are similar, but contain stubs - which call FNNAME and then copy the return value from the fp regs - to the gp regs. These stubs store the return value in $18 while - calling FNNAME; any function which might call one of these stubs - must arrange to save $18 around the call. (This case is not - needed for 32 bit functions that call 16 bit functions, because - 16 bit functions always return floating point values in both - $f0/$f1 and $2/$3.) - - Note that in all cases FNNAME might be defined statically. - Therefore, FNNAME is not used literally. Instead, the relocation - information will indicate which symbol the section is for. - - We record any stubs that we find in the symbol table. */ - -#define FN_STUB ".mips16.fn." -#define CALL_STUB ".mips16.call." -#define CALL_FP_STUB ".mips16.call.fp." - -/* MIPS ELF linker hash table. */ - -struct mips_elf_link_hash_table -{ - struct elf_link_hash_table root; -#if 0 - /* We no longer use this. */ - /* String section indices for the dynamic section symbols. */ - bfd_size_type dynsym_sec_strindex[SIZEOF_MIPS_DYNSYM_SECNAMES]; -#endif - /* The number of .rtproc entries. */ - bfd_size_type procedure_count; - /* The size of the .compact_rel section (if SGI_COMPAT). */ - bfd_size_type compact_rel_size; - /* This flag indicates that the value of DT_MIPS_RLD_MAP dynamic - entry is set to the address of __rld_obj_head as in Irix 5. */ - boolean use_rld_obj_head; - /* This is the value of the __rld_map or __rld_obj_head symbol. */ - bfd_vma rld_value; - /* This is set if we see any mips16 stub sections. */ - boolean mips16_stubs_seen; -}; - -/* Look up an entry in a MIPS ELF linker hash table. */ - -#define mips_elf_link_hash_lookup(table, string, create, copy, follow) \ - ((struct mips_elf_link_hash_entry *) \ - elf_link_hash_lookup (&(table)->root, (string), (create), \ - (copy), (follow))) - -/* Traverse a MIPS ELF linker hash table. */ - -#define mips_elf_link_hash_traverse(table, func, info) \ - (elf_link_hash_traverse \ - (&(table)->root, \ - (boolean (*) PARAMS ((struct elf_link_hash_entry *, PTR))) (func), \ - (info))) - -/* Get the MIPS ELF linker hash table from a link_info structure. */ - -#define mips_elf_hash_table(p) \ - ((struct mips_elf_link_hash_table *) ((p)->hash)) - -static boolean mips_elf_output_extsym - PARAMS ((struct mips_elf_link_hash_entry *, PTR)); - -/* Create an entry in a MIPS ELF linker hash table. */ - -static struct bfd_hash_entry * -mips_elf_link_hash_newfunc (entry, table, string) - struct bfd_hash_entry *entry; - struct bfd_hash_table *table; - const char *string; -{ - struct mips_elf_link_hash_entry *ret = - (struct mips_elf_link_hash_entry *) entry; - - /* Allocate the structure if it has not already been allocated by a - subclass. */ - if (ret == (struct mips_elf_link_hash_entry *) NULL) - ret = ((struct mips_elf_link_hash_entry *) - bfd_hash_allocate (table, - sizeof (struct mips_elf_link_hash_entry))); - if (ret == (struct mips_elf_link_hash_entry *) NULL) - return (struct bfd_hash_entry *) ret; - - /* Call the allocation method of the superclass. */ - ret = ((struct mips_elf_link_hash_entry *) - _bfd_elf_link_hash_newfunc ((struct bfd_hash_entry *) ret, - table, string)); - if (ret != (struct mips_elf_link_hash_entry *) NULL) - { - /* Set local fields. */ - memset (&ret->esym, 0, sizeof (EXTR)); - /* We use -2 as a marker to indicate that the information has - not been set. -1 means there is no associated ifd. */ - ret->esym.ifd = -2; - ret->possibly_dynamic_relocs = 0; - ret->min_dyn_reloc_index = 0; - ret->fn_stub = NULL; - ret->need_fn_stub = false; - ret->call_stub = NULL; - ret->call_fp_stub = NULL; - } - - return (struct bfd_hash_entry *) ret; -} - -/* Create a MIPS ELF linker hash table. */ - -struct bfd_link_hash_table * -_bfd_mips_elf_link_hash_table_create (abfd) - bfd *abfd; -{ - struct mips_elf_link_hash_table *ret; - - ret = ((struct mips_elf_link_hash_table *) - bfd_alloc (abfd, sizeof (struct mips_elf_link_hash_table))); - if (ret == (struct mips_elf_link_hash_table *) NULL) - return NULL; - - if (! _bfd_elf_link_hash_table_init (&ret->root, abfd, - mips_elf_link_hash_newfunc)) - { - bfd_release (abfd, ret); - return NULL; - } - -#if 0 - /* We no longer use this. */ - for (i = 0; i < SIZEOF_MIPS_DYNSYM_SECNAMES; i++) - ret->dynsym_sec_strindex[i] = (bfd_size_type) -1; -#endif - ret->procedure_count = 0; - ret->compact_rel_size = 0; - ret->use_rld_obj_head = false; - ret->rld_value = 0; - ret->mips16_stubs_seen = false; - - return &ret->root.root; -} - -/* Hook called by the linker routine which adds symbols from an object - file. We must handle the special MIPS section numbers here. */ - -/*ARGSUSED*/ -boolean -_bfd_mips_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) - bfd *abfd; - struct bfd_link_info *info; - const Elf_Internal_Sym *sym; - const char **namep; - flagword *flagsp ATTRIBUTE_UNUSED; - asection **secp; - bfd_vma *valp; -{ - if (SGI_COMPAT (abfd) - && (abfd->flags & DYNAMIC) != 0 - && strcmp (*namep, "_rld_new_interface") == 0) - { - /* Skip Irix 5 rld entry name. */ - *namep = NULL; - return true; - } - - switch (sym->st_shndx) - { - case SHN_COMMON: - /* Common symbols less than the GP size are automatically - treated as SHN_MIPS_SCOMMON symbols. */ - if (sym->st_size > elf_gp_size (abfd) - || IRIX_COMPAT (abfd) == ict_irix6) - break; - /* Fall through. */ - case SHN_MIPS_SCOMMON: - *secp = bfd_make_section_old_way (abfd, ".scommon"); - (*secp)->flags |= SEC_IS_COMMON; - *valp = sym->st_size; - break; - - case SHN_MIPS_TEXT: - /* This section is used in a shared object. */ - if (mips_elf_text_section_ptr == NULL) - { - /* Initialize the section. */ - mips_elf_text_section.name = ".text"; - mips_elf_text_section.flags = SEC_NO_FLAGS; - mips_elf_text_section.output_section = NULL; - mips_elf_text_section.symbol = &mips_elf_text_symbol; - mips_elf_text_section.symbol_ptr_ptr = &mips_elf_text_symbol_ptr; - mips_elf_text_symbol.name = ".text"; - mips_elf_text_symbol.flags = BSF_SECTION_SYM | BSF_DYNAMIC; - mips_elf_text_symbol.section = &mips_elf_text_section; - mips_elf_text_symbol_ptr = &mips_elf_text_symbol; - mips_elf_text_section_ptr = &mips_elf_text_section; - } - /* This code used to do *secp = bfd_und_section_ptr if - info->shared. I don't know why, and that doesn't make sense, - so I took it out. */ - *secp = mips_elf_text_section_ptr; - break; - - case SHN_MIPS_ACOMMON: - /* Fall through. XXX Can we treat this as allocated data? */ - case SHN_MIPS_DATA: - /* This section is used in a shared object. */ - if (mips_elf_data_section_ptr == NULL) - { - /* Initialize the section. */ - mips_elf_data_section.name = ".data"; - mips_elf_data_section.flags = SEC_NO_FLAGS; - mips_elf_data_section.output_section = NULL; - mips_elf_data_section.symbol = &mips_elf_data_symbol; - mips_elf_data_section.symbol_ptr_ptr = &mips_elf_data_symbol_ptr; - mips_elf_data_symbol.name = ".data"; - mips_elf_data_symbol.flags = BSF_SECTION_SYM | BSF_DYNAMIC; - mips_elf_data_symbol.section = &mips_elf_data_section; - mips_elf_data_symbol_ptr = &mips_elf_data_symbol; - mips_elf_data_section_ptr = &mips_elf_data_section; - } - /* This code used to do *secp = bfd_und_section_ptr if - info->shared. I don't know why, and that doesn't make sense, - so I took it out. */ - *secp = mips_elf_data_section_ptr; - break; - - case SHN_MIPS_SUNDEFINED: - *secp = bfd_und_section_ptr; - break; - } - - if (SGI_COMPAT (abfd) - && ! info->shared - && info->hash->creator == abfd->xvec - && strcmp (*namep, "__rld_obj_head") == 0) - { - struct elf_link_hash_entry *h; - - /* Mark __rld_obj_head as dynamic. */ - h = NULL; - if (! (_bfd_generic_link_add_one_symbol - (info, abfd, *namep, BSF_GLOBAL, *secp, - (bfd_vma) *valp, (const char *) NULL, false, - get_elf_backend_data (abfd)->collect, - (struct bfd_link_hash_entry **) &h))) - return false; - h->elf_link_hash_flags &=~ ELF_LINK_NON_ELF; - h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; - h->type = STT_OBJECT; - - if (! bfd_elf32_link_record_dynamic_symbol (info, h)) - return false; - - mips_elf_hash_table (info)->use_rld_obj_head = true; - } - - /* If this is a mips16 text symbol, add 1 to the value to make it - odd. This will cause something like .word SYM to come up with - the right value when it is loaded into the PC. */ - if (sym->st_other == STO_MIPS16) - ++*valp; - - return true; -} - -/* Structure used to pass information to mips_elf_output_extsym. */ - -struct extsym_info -{ - bfd *abfd; - struct bfd_link_info *info; - struct ecoff_debug_info *debug; - const struct ecoff_debug_swap *swap; - boolean failed; -}; - -/* This routine is used to write out ECOFF debugging external symbol - information. It is called via mips_elf_link_hash_traverse. The - ECOFF external symbol information must match the ELF external - symbol information. Unfortunately, at this point we don't know - whether a symbol is required by reloc information, so the two - tables may wind up being different. We must sort out the external - symbol information before we can set the final size of the .mdebug - section, and we must set the size of the .mdebug section before we - can relocate any sections, and we can't know which symbols are - required by relocation until we relocate the sections. - Fortunately, it is relatively unlikely that any symbol will be - stripped but required by a reloc. In particular, it can not happen - when generating a final executable. */ - -static boolean -mips_elf_output_extsym (h, data) - struct mips_elf_link_hash_entry *h; - PTR data; -{ - struct extsym_info *einfo = (struct extsym_info *) data; - boolean strip; - asection *sec, *output_section; - - if (h->root.indx == -2) - strip = false; - else if (((h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0 - || (h->root.elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) != 0) - && (h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0 - && (h->root.elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) == 0) - strip = true; - else if (einfo->info->strip == strip_all - || (einfo->info->strip == strip_some - && bfd_hash_lookup (einfo->info->keep_hash, - h->root.root.root.string, - false, false) == NULL)) - strip = true; - else - strip = false; - - if (strip) - return true; - - if (h->esym.ifd == -2) - { - 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 (SGI_COMPAT (einfo->abfd) - && (h->root.root.type == bfd_link_hash_undefined - || h->root.root.type == bfd_link_hash_undefweak)) - { - const char *name; - - /* Use undefined class. Also, set class and type for some - special symbols. */ - name = h->root.root.root.string; - if (strcmp (name, mips_elf_dynsym_rtproc_names[0]) == 0 - || strcmp (name, mips_elf_dynsym_rtproc_names[1]) == 0) - { - h->esym.asym.sc = scData; - h->esym.asym.st = stLabel; - h->esym.asym.value = 0; - } - else if (strcmp (name, mips_elf_dynsym_rtproc_names[2]) == 0) - { - h->esym.asym.sc = scAbs; - h->esym.asym.st = stLabel; - h->esym.asym.value = - mips_elf_hash_table (einfo->info)->procedure_count; - } - else if (strcmp (name, "_gp_disp") == 0) - { - h->esym.asym.sc = scAbs; - h->esym.asym.st = stLabel; - h->esym.asym.value = elf_gp (einfo->abfd); - } - else - h->esym.asym.sc = scUndefined; - } - else if (h->root.root.type != bfd_link_hash_defined - && h->root.root.type != bfd_link_hash_defweak) - h->esym.asym.sc = scAbs; - else - { - const char *name; - - sec = h->root.root.u.def.section; - output_section = sec->output_section; - - /* When making a shared library and symbol h is the one from - the another shared library, OUTPUT_SECTION may be null. */ - if (output_section == NULL) - h->esym.asym.sc = scUndefined; - else - { - name = bfd_section_name (output_section->owner, output_section); - - if (strcmp (name, ".text") == 0) - h->esym.asym.sc = scText; - else if (strcmp (name, ".data") == 0) - h->esym.asym.sc = scData; - else if (strcmp (name, ".sdata") == 0) - h->esym.asym.sc = scSData; - else if (strcmp (name, ".rodata") == 0 - || strcmp (name, ".rdata") == 0) - h->esym.asym.sc = scRData; - else if (strcmp (name, ".bss") == 0) - h->esym.asym.sc = scBss; - else if (strcmp (name, ".sbss") == 0) - h->esym.asym.sc = scSBss; - else if (strcmp (name, ".init") == 0) - h->esym.asym.sc = scInit; - else if (strcmp (name, ".fini") == 0) - h->esym.asym.sc = scFini; - else - h->esym.asym.sc = scAbs; - } - } - - h->esym.asym.reserved = 0; - h->esym.asym.index = indexNil; - } - - if (h->root.root.type == bfd_link_hash_common) - h->esym.asym.value = h->root.root.u.c.size; - else if (h->root.root.type == bfd_link_hash_defined - || h->root.root.type == bfd_link_hash_defweak) - { - if (h->esym.asym.sc == scCommon) - h->esym.asym.sc = scBss; - else if (h->esym.asym.sc == scSCommon) - h->esym.asym.sc = scSBss; - - sec = h->root.root.u.def.section; - output_section = sec->output_section; - if (output_section != NULL) - h->esym.asym.value = (h->root.root.u.def.value - + sec->output_offset - + output_section->vma); - else - h->esym.asym.value = 0; - } - else if ((h->root.elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0) - { - /* Set type and value for a symbol with a function stub. */ - h->esym.asym.st = stProc; - sec = h->root.root.u.def.section; - if (sec == NULL) - h->esym.asym.value = 0; - else - { - output_section = sec->output_section; - if (output_section != NULL) - h->esym.asym.value = (h->root.plt.offset - + sec->output_offset - + output_section->vma); - else - h->esym.asym.value = 0; - } -#if 0 /* FIXME? */ - h->esym.ifd = 0; -#endif - } - - if (! bfd_ecoff_debug_one_external (einfo->abfd, einfo->debug, einfo->swap, - h->root.root.root.string, - &h->esym)) - { - einfo->failed = true; - return false; - } - - return true; -} - -/* Create a runtime procedure table from the .mdebug section. */ - -static boolean -mips_elf_create_procedure_table (handle, abfd, info, s, debug) - PTR handle; - bfd *abfd; - struct bfd_link_info *info; - asection *s; - struct ecoff_debug_info *debug; -{ - const struct ecoff_debug_swap *swap; - HDRR *hdr = &debug->symbolic_header; - RPDR *rpdr, *rp; - struct rpdr_ext *erp; - PTR rtproc; - struct pdr_ext *epdr; - struct sym_ext *esym; - char *ss, **sv; - char *str; - unsigned long size, count; - unsigned long sindex; - unsigned long i; - PDR pdr; - SYMR sym; - const char *no_name_func = _("static procedure (no name)"); - - epdr = NULL; - rpdr = NULL; - esym = NULL; - ss = NULL; - sv = NULL; - - swap = get_elf_backend_data (abfd)->elf_backend_ecoff_debug_swap; - - sindex = strlen (no_name_func) + 1; - count = hdr->ipdMax; - if (count > 0) - { - size = swap->external_pdr_size; - - epdr = (struct pdr_ext *) bfd_malloc (size * count); - if (epdr == NULL) - goto error_return; - - if (! _bfd_ecoff_get_accumulated_pdr (handle, (PTR) epdr)) - goto error_return; - - size = sizeof (RPDR); - rp = rpdr = (RPDR *) bfd_malloc (size * count); - if (rpdr == NULL) - goto error_return; - - sv = (char **) bfd_malloc (sizeof (char *) * count); - if (sv == NULL) - goto error_return; - - count = hdr->isymMax; - size = swap->external_sym_size; - esym = (struct sym_ext *) bfd_malloc (size * count); - if (esym == NULL) - goto error_return; - - if (! _bfd_ecoff_get_accumulated_sym (handle, (PTR) esym)) - goto error_return; - - count = hdr->issMax; - ss = (char *) bfd_malloc (count); - if (ss == NULL) - goto error_return; - if (! _bfd_ecoff_get_accumulated_ss (handle, (PTR) ss)) - goto error_return; - - count = hdr->ipdMax; - for (i = 0; i < count; i++, rp++) - { - (*swap->swap_pdr_in) (abfd, (PTR) (epdr + i), &pdr); - (*swap->swap_sym_in) (abfd, (PTR) &esym[pdr.isym], &sym); - rp->adr = sym.value; - rp->regmask = pdr.regmask; - rp->regoffset = pdr.regoffset; - rp->fregmask = pdr.fregmask; - rp->fregoffset = pdr.fregoffset; - rp->frameoffset = pdr.frameoffset; - rp->framereg = pdr.framereg; - rp->pcreg = pdr.pcreg; - rp->irpss = sindex; - sv[i] = ss + sym.iss; - sindex += strlen (sv[i]) + 1; - } - } - - size = sizeof (struct rpdr_ext) * (count + 2) + sindex; - size = BFD_ALIGN (size, 16); - rtproc = (PTR) bfd_alloc (abfd, size); - if (rtproc == NULL) - { - mips_elf_hash_table (info)->procedure_count = 0; - goto error_return; - } - - mips_elf_hash_table (info)->procedure_count = count + 2; - - erp = (struct rpdr_ext *) rtproc; - memset (erp, 0, sizeof (struct rpdr_ext)); - erp++; - str = (char *) rtproc + sizeof (struct rpdr_ext) * (count + 2); - strcpy (str, no_name_func); - str += strlen (no_name_func) + 1; - for (i = 0; i < count; i++) - { - ecoff_swap_rpdr_out (abfd, rpdr + i, erp + i); - strcpy (str, sv[i]); - str += strlen (sv[i]) + 1; - } - ecoff_put_off (abfd, (bfd_vma) -1, (bfd_byte *) (erp + count)->p_adr); - - /* Set the size and contents of .rtproc section. */ - s->_raw_size = size; - s->contents = (bfd_byte *) rtproc; - - /* Skip this section later on (I don't think this currently - matters, but someday it might). */ - s->link_order_head = (struct bfd_link_order *) NULL; - - if (epdr != NULL) - free (epdr); - if (rpdr != NULL) - free (rpdr); - if (esym != NULL) - free (esym); - if (ss != NULL) - free (ss); - if (sv != NULL) - free (sv); - - return true; - - error_return: - if (epdr != NULL) - free (epdr); - if (rpdr != NULL) - free (rpdr); - if (esym != NULL) - free (esym); - if (ss != NULL) - free (ss); - if (sv != NULL) - free (sv); - return false; -} - -/* A comparison routine used to sort .gptab entries. */ - -static int -gptab_compare (p1, p2) - const PTR p1; - const PTR p2; -{ - const Elf32_gptab *a1 = (const Elf32_gptab *) p1; - const Elf32_gptab *a2 = (const Elf32_gptab *) p2; - - return a1->gt_entry.gt_g_value - a2->gt_entry.gt_g_value; -} - -/* We need to use a special link routine to handle the .reginfo and - the .mdebug sections. We need to merge all instances of these - sections together, not write them all out sequentially. */ - -boolean -_bfd_mips_elf_final_link (abfd, info) - bfd *abfd; - struct bfd_link_info *info; -{ - asection **secpp; - asection *o; - struct bfd_link_order *p; - asection *reginfo_sec, *mdebug_sec, *gptab_data_sec, *gptab_bss_sec; - asection *rtproc_sec; - Elf32_RegInfo reginfo; - struct ecoff_debug_info debug; - const struct ecoff_debug_swap *swap - = get_elf_backend_data (abfd)->elf_backend_ecoff_debug_swap; - HDRR *symhdr = &debug.symbolic_header; - PTR mdebug_handle = NULL; - - /* If all the things we linked together were PIC, but we're - producing an executable (rather than a shared object), then the - resulting file is CPIC (i.e., it calls PIC code.) */ - if (!info->shared - && !info->relocateable - && elf_elfheader (abfd)->e_flags & EF_MIPS_PIC) - { - elf_elfheader (abfd)->e_flags &= ~EF_MIPS_PIC; - elf_elfheader (abfd)->e_flags |= EF_MIPS_CPIC; - } - - /* We'd carefully arranged the dynamic symbol indices, and then the - generic size_dynamic_sections renumbered them out from under us. - Rather than trying somehow to prevent the renumbering, just do - the sort again. */ - if (elf_hash_table (info)->dynamic_sections_created) - { - bfd *dynobj; - asection *got; - struct mips_got_info *g; - - /* When we resort, we must tell mips_elf_sort_hash_table what - the lowest index it may use is. That's the number of section - symbols we're going to add. The generic ELF linker only - adds these symbols when building a shared object. Note that - we count the sections after (possibly) removing the .options - section above. */ - if (!mips_elf_sort_hash_table (info, (info->shared - ? bfd_count_sections (abfd) + 1 - : 1))) - return false; - - /* Make sure we didn't grow the global .got region. */ - dynobj = elf_hash_table (info)->dynobj; - got = bfd_get_section_by_name (dynobj, ".got"); - g = (struct mips_got_info *) elf_section_data (got)->tdata; - - if (g->global_gotsym != NULL) - BFD_ASSERT ((elf_hash_table (info)->dynsymcount - - g->global_gotsym->dynindx) - <= g->global_gotno); - } - - /* On IRIX5, we omit the .options section. On IRIX6, however, we - include it, even though we don't process it quite right. (Some - entries are supposed to be merged.) Empirically, we seem to be - better off including it then not. */ - if (IRIX_COMPAT (abfd) == ict_irix5) - for (secpp = &abfd->sections; *secpp != NULL; secpp = &(*secpp)->next) - { - if (strcmp ((*secpp)->name, MIPS_ELF_OPTIONS_SECTION_NAME (abfd)) == 0) - { - for (p = (*secpp)->link_order_head; p != NULL; p = p->next) - if (p->type == bfd_indirect_link_order) - p->u.indirect.section->flags &=~ SEC_HAS_CONTENTS; - (*secpp)->link_order_head = NULL; - *secpp = (*secpp)->next; - --abfd->section_count; - - break; - } - } - - /* Get a value for the GP register. */ - if (elf_gp (abfd) == 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) - elf_gp (abfd) = (h->u.def.value - + h->u.def.section->output_section->vma - + h->u.def.section->output_offset); - else if (info->relocateable) - { - bfd_vma lo; - - /* Find the GP-relative section with the lowest offset. */ - lo = (bfd_vma) -1; - for (o = abfd->sections; o != (asection *) NULL; o = o->next) - if (o->vma < lo - && (elf_section_data (o)->this_hdr.sh_flags & SHF_MIPS_GPREL)) - lo = o->vma; - - /* And calculate GP relative to that. */ - elf_gp (abfd) = lo + ELF_MIPS_GP_OFFSET (abfd); - } - 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. */ - } - } - - /* Go through the sections and collect the .reginfo and .mdebug - information. */ - reginfo_sec = NULL; - mdebug_sec = NULL; - gptab_data_sec = NULL; - gptab_bss_sec = NULL; - for (o = abfd->sections; o != (asection *) NULL; o = o->next) - { - if (strcmp (o->name, ".reginfo") == 0) - { - memset (®info, 0, sizeof reginfo); - - /* We have found the .reginfo section in the output file. - Look through all the link_orders comprising it and merge - the information together. */ - for (p = o->link_order_head; - p != (struct bfd_link_order *) NULL; - p = p->next) - { - asection *input_section; - bfd *input_bfd; - Elf32_External_RegInfo ext; - Elf32_RegInfo sub; - - if (p->type != bfd_indirect_link_order) - { - if (p->type == bfd_fill_link_order) - continue; - abort (); - } - - input_section = p->u.indirect.section; - input_bfd = input_section->owner; - - /* The linker emulation code has probably clobbered the - size to be zero bytes. */ - if (input_section->_raw_size == 0) - input_section->_raw_size = sizeof (Elf32_External_RegInfo); - - if (! bfd_get_section_contents (input_bfd, input_section, - (PTR) &ext, - (file_ptr) 0, - sizeof ext)) - return false; - - bfd_mips_elf32_swap_reginfo_in (input_bfd, &ext, &sub); - - reginfo.ri_gprmask |= sub.ri_gprmask; - reginfo.ri_cprmask[0] |= sub.ri_cprmask[0]; - reginfo.ri_cprmask[1] |= sub.ri_cprmask[1]; - reginfo.ri_cprmask[2] |= sub.ri_cprmask[2]; - reginfo.ri_cprmask[3] |= sub.ri_cprmask[3]; - - /* ri_gp_value is set by the function - mips_elf32_section_processing when the section is - finally written out. */ - - /* Hack: reset the SEC_HAS_CONTENTS flag so that - elf_link_input_bfd ignores this section. */ - input_section->flags &=~ SEC_HAS_CONTENTS; - } - - /* Size has been set in mips_elf_always_size_sections */ - BFD_ASSERT(o->_raw_size == sizeof (Elf32_External_RegInfo)); - - /* Skip this section later on (I don't think this currently - matters, but someday it might). */ - o->link_order_head = (struct bfd_link_order *) NULL; - - reginfo_sec = o; - } - - if (strcmp (o->name, ".mdebug") == 0) - { - struct extsym_info einfo; - - /* We have found the .mdebug section in the output file. - Look through all the link_orders comprising it and merge - the information together. */ - symhdr->magic = swap->sym_magic; - /* FIXME: What should the version stamp be? */ - 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; - - mdebug_handle = bfd_ecoff_debug_init (abfd, &debug, swap, info); - if (mdebug_handle == (PTR) NULL) - return false; - - if (SGI_COMPAT (abfd)) - { - asection *s; - EXTR esym; - bfd_vma last; - unsigned int i; - static const char * const name[] = - { ".text", ".init", ".fini", ".data", - ".rodata", ".sdata", ".sbss", ".bss" }; - static const int sc[] = { scText, scInit, scFini, scData, - scRData, scSData, scSBss, scBss }; - - esym.jmptbl = 0; - esym.cobol_main = 0; - esym.weakext = 0; - esym.reserved = 0; - esym.ifd = ifdNil; - esym.asym.iss = issNil; - esym.asym.st = stLocal; - esym.asym.reserved = 0; - esym.asym.index = indexNil; - last = 0; - for (i = 0; i < 8; i++) - { - esym.asym.sc = sc[i]; - s = bfd_get_section_by_name (abfd, name[i]); - if (s != NULL) - { - esym.asym.value = s->vma; - last = s->vma + s->_raw_size; - } - else - esym.asym.value = last; - - if (! bfd_ecoff_debug_one_external (abfd, &debug, swap, - name[i], &esym)) - return false; - } - } - - for (p = o->link_order_head; - p != (struct bfd_link_order *) NULL; - p = p->next) - { - asection *input_section; - bfd *input_bfd; - const struct ecoff_debug_swap *input_swap; - struct ecoff_debug_info input_debug; - char *eraw_src; - char *eraw_end; - - if (p->type != bfd_indirect_link_order) - { - if (p->type == bfd_fill_link_order) - continue; - abort (); - } - - input_section = p->u.indirect.section; - input_bfd = input_section->owner; - - if (bfd_get_flavour (input_bfd) != bfd_target_elf_flavour - || (get_elf_backend_data (input_bfd) - ->elf_backend_ecoff_debug_swap) == NULL) - { - /* I don't know what a non MIPS ELF bfd would be - doing with a .mdebug section, but I don't really - want to deal with it. */ - continue; - } - - input_swap = (get_elf_backend_data (input_bfd) - ->elf_backend_ecoff_debug_swap); - - BFD_ASSERT (p->size == input_section->_raw_size); - - /* The ECOFF linking code expects that we have already - read in the debugging information and set up an - ecoff_debug_info structure, so we do that now. */ - if (! _bfd_mips_elf_read_ecoff_info (input_bfd, input_section, - &input_debug)) - return false; - - if (! (bfd_ecoff_debug_accumulate - (mdebug_handle, abfd, &debug, swap, input_bfd, - &input_debug, input_swap, info))) - return false; - - /* Loop through the external symbols. For each one with - interesting information, try to find the symbol in - the linker global hash table and save the information - for the output external symbols. */ - eraw_src = input_debug.external_ext; - eraw_end = (eraw_src - + (input_debug.symbolic_header.iextMax - * input_swap->external_ext_size)); - for (; - eraw_src < eraw_end; - eraw_src += input_swap->external_ext_size) - { - EXTR ext; - const char *name; - struct mips_elf_link_hash_entry *h; - - (*input_swap->swap_ext_in) (input_bfd, (PTR) eraw_src, &ext); - if (ext.asym.sc == scNil - || ext.asym.sc == scUndefined - || ext.asym.sc == scSUndefined) - continue; - - name = input_debug.ssext + ext.asym.iss; - h = mips_elf_link_hash_lookup (mips_elf_hash_table (info), - name, false, false, true); - if (h == NULL || h->esym.ifd != -2) - continue; - - if (ext.ifd != -1) - { - BFD_ASSERT (ext.ifd - < input_debug.symbolic_header.ifdMax); - ext.ifd = input_debug.ifdmap[ext.ifd]; - } - - h->esym = ext; - } - - /* Free up the information we just read. */ - free (input_debug.line); - free (input_debug.external_dnr); - free (input_debug.external_pdr); - free (input_debug.external_sym); - free (input_debug.external_opt); - free (input_debug.external_aux); - free (input_debug.ss); - free (input_debug.ssext); - free (input_debug.external_fdr); - free (input_debug.external_rfd); - free (input_debug.external_ext); - - /* Hack: reset the SEC_HAS_CONTENTS flag so that - elf_link_input_bfd ignores this section. */ - input_section->flags &=~ SEC_HAS_CONTENTS; - } - - if (SGI_COMPAT (abfd) && info->shared) - { - /* Create .rtproc section. */ - rtproc_sec = bfd_get_section_by_name (abfd, ".rtproc"); - if (rtproc_sec == NULL) - { - flagword flags = (SEC_HAS_CONTENTS | SEC_IN_MEMORY - | SEC_LINKER_CREATED | SEC_READONLY); - - rtproc_sec = bfd_make_section (abfd, ".rtproc"); - if (rtproc_sec == NULL - || ! bfd_set_section_flags (abfd, rtproc_sec, flags) - || ! bfd_set_section_alignment (abfd, rtproc_sec, 4)) - return false; - } - - if (! mips_elf_create_procedure_table (mdebug_handle, abfd, - info, rtproc_sec, &debug)) - return false; - } - - /* Build the external symbol information. */ - einfo.abfd = abfd; - einfo.info = info; - einfo.debug = &debug; - einfo.swap = swap; - einfo.failed = false; - mips_elf_link_hash_traverse (mips_elf_hash_table (info), - mips_elf_output_extsym, - (PTR) &einfo); - if (einfo.failed) - return false; - - /* Set the size of the .mdebug section. */ - o->_raw_size = bfd_ecoff_debug_size (abfd, &debug, swap); - - /* Skip this section later on (I don't think this currently - matters, but someday it might). */ - o->link_order_head = (struct bfd_link_order *) NULL; - - mdebug_sec = o; - } - - if (strncmp (o->name, ".gptab.", sizeof ".gptab." - 1) == 0) - { - const char *subname; - unsigned int c; - Elf32_gptab *tab; - Elf32_External_gptab *ext_tab; - unsigned int i; - - /* The .gptab.sdata and .gptab.sbss sections hold - information describing how the small data area would - change depending upon the -G switch. These sections - not used in executables files. */ - if (! info->relocateable) - { - asection **secpp; - - for (p = o->link_order_head; - p != (struct bfd_link_order *) NULL; - p = p->next) - { - asection *input_section; - - if (p->type != bfd_indirect_link_order) - { - if (p->type == bfd_fill_link_order) - continue; - abort (); - } - - input_section = p->u.indirect.section; - - /* Hack: reset the SEC_HAS_CONTENTS flag so that - elf_link_input_bfd ignores this section. */ - input_section->flags &=~ SEC_HAS_CONTENTS; - } - - /* Skip this section later on (I don't think this - currently matters, but someday it might). */ - o->link_order_head = (struct bfd_link_order *) NULL; - - /* Really remove the section. */ - for (secpp = &abfd->sections; - *secpp != o; - secpp = &(*secpp)->next) - ; - *secpp = (*secpp)->next; - --abfd->section_count; - - continue; - } - - /* There is one gptab for initialized data, and one for - uninitialized data. */ - if (strcmp (o->name, ".gptab.sdata") == 0) - gptab_data_sec = o; - else if (strcmp (o->name, ".gptab.sbss") == 0) - gptab_bss_sec = o; - else - { - (*_bfd_error_handler) - (_("%s: illegal section name `%s'"), - bfd_get_filename (abfd), o->name); - bfd_set_error (bfd_error_nonrepresentable_section); - return false; - } - - /* The linker script always combines .gptab.data and - .gptab.sdata into .gptab.sdata, and likewise for - .gptab.bss and .gptab.sbss. It is possible that there is - no .sdata or .sbss section in the output file, in which - case we must change the name of the output section. */ - subname = o->name + sizeof ".gptab" - 1; - if (bfd_get_section_by_name (abfd, subname) == NULL) - { - if (o == gptab_data_sec) - o->name = ".gptab.data"; - else - o->name = ".gptab.bss"; - subname = o->name + sizeof ".gptab" - 1; - BFD_ASSERT (bfd_get_section_by_name (abfd, subname) != NULL); - } - - /* Set up the first entry. */ - c = 1; - tab = (Elf32_gptab *) bfd_malloc (c * sizeof (Elf32_gptab)); - if (tab == NULL) - return false; - tab[0].gt_header.gt_current_g_value = elf_gp_size (abfd); - tab[0].gt_header.gt_unused = 0; - - /* Combine the input sections. */ - for (p = o->link_order_head; - p != (struct bfd_link_order *) NULL; - p = p->next) - { - asection *input_section; - bfd *input_bfd; - bfd_size_type size; - unsigned long last; - bfd_size_type gpentry; - - if (p->type != bfd_indirect_link_order) - { - if (p->type == bfd_fill_link_order) - continue; - abort (); - } - - input_section = p->u.indirect.section; - input_bfd = input_section->owner; - - /* Combine the gptab entries for this input section one - by one. We know that the input gptab entries are - sorted by ascending -G value. */ - size = bfd_section_size (input_bfd, input_section); - last = 0; - for (gpentry = sizeof (Elf32_External_gptab); - gpentry < size; - gpentry += sizeof (Elf32_External_gptab)) - { - Elf32_External_gptab ext_gptab; - Elf32_gptab int_gptab; - unsigned long val; - unsigned long add; - boolean exact; - unsigned int look; - - if (! (bfd_get_section_contents - (input_bfd, input_section, (PTR) &ext_gptab, - gpentry, sizeof (Elf32_External_gptab)))) - { - free (tab); - return false; - } - - bfd_mips_elf32_swap_gptab_in (input_bfd, &ext_gptab, - &int_gptab); - val = int_gptab.gt_entry.gt_g_value; - add = int_gptab.gt_entry.gt_bytes - last; - - exact = false; - for (look = 1; look < c; look++) - { - if (tab[look].gt_entry.gt_g_value >= val) - tab[look].gt_entry.gt_bytes += add; - - if (tab[look].gt_entry.gt_g_value == val) - exact = true; - } - - if (! exact) - { - Elf32_gptab *new_tab; - unsigned int max; - - /* We need a new table entry. */ - new_tab = ((Elf32_gptab *) - bfd_realloc ((PTR) tab, - (c + 1) * sizeof (Elf32_gptab))); - if (new_tab == NULL) - { - free (tab); - return false; - } - tab = new_tab; - tab[c].gt_entry.gt_g_value = val; - tab[c].gt_entry.gt_bytes = add; - - /* Merge in the size for the next smallest -G - value, since that will be implied by this new - value. */ - max = 0; - for (look = 1; look < c; look++) - { - if (tab[look].gt_entry.gt_g_value < val - && (max == 0 - || (tab[look].gt_entry.gt_g_value - > tab[max].gt_entry.gt_g_value))) - max = look; - } - if (max != 0) - tab[c].gt_entry.gt_bytes += - tab[max].gt_entry.gt_bytes; - - ++c; - } - - last = int_gptab.gt_entry.gt_bytes; - } - - /* Hack: reset the SEC_HAS_CONTENTS flag so that - elf_link_input_bfd ignores this section. */ - input_section->flags &=~ SEC_HAS_CONTENTS; - } - - /* The table must be sorted by -G value. */ - if (c > 2) - qsort (tab + 1, c - 1, sizeof (tab[0]), gptab_compare); - - /* Swap out the table. */ - ext_tab = ((Elf32_External_gptab *) - bfd_alloc (abfd, c * sizeof (Elf32_External_gptab))); - if (ext_tab == NULL) - { - free (tab); - return false; - } - - for (i = 0; i < c; i++) - bfd_mips_elf32_swap_gptab_out (abfd, tab + i, ext_tab + i); - free (tab); - - o->_raw_size = c * sizeof (Elf32_External_gptab); - o->contents = (bfd_byte *) ext_tab; - - /* Skip this section later on (I don't think this currently - matters, but someday it might). */ - o->link_order_head = (struct bfd_link_order *) NULL; - } - } - - /* Invoke the regular ELF backend linker to do all the work. */ - if (ABI_64_P (abfd)) - { -#ifdef BFD64 - if (!bfd_elf64_bfd_final_link (abfd, info)) - return false; -#else - abort (); - return false; -#endif /* BFD64 */ - } - else if (!bfd_elf32_bfd_final_link (abfd, info)) - return false; - - /* Now write out the computed sections. */ - - if (reginfo_sec != (asection *) NULL) - { - Elf32_External_RegInfo ext; - - bfd_mips_elf32_swap_reginfo_out (abfd, ®info, &ext); - if (! bfd_set_section_contents (abfd, reginfo_sec, (PTR) &ext, - (file_ptr) 0, sizeof ext)) - return false; - } - - if (mdebug_sec != (asection *) NULL) - { - BFD_ASSERT (abfd->output_has_begun); - if (! bfd_ecoff_write_accumulated_debug (mdebug_handle, abfd, &debug, - swap, info, - mdebug_sec->filepos)) - return false; - - bfd_ecoff_debug_free (mdebug_handle, abfd, &debug, swap, info); - } - - if (gptab_data_sec != (asection *) NULL) - { - if (! bfd_set_section_contents (abfd, gptab_data_sec, - gptab_data_sec->contents, - (file_ptr) 0, - gptab_data_sec->_raw_size)) - return false; - } - - if (gptab_bss_sec != (asection *) NULL) - { - if (! bfd_set_section_contents (abfd, gptab_bss_sec, - gptab_bss_sec->contents, - (file_ptr) 0, - gptab_bss_sec->_raw_size)) - return false; - } - - if (SGI_COMPAT (abfd)) - { - rtproc_sec = bfd_get_section_by_name (abfd, ".rtproc"); - if (rtproc_sec != NULL) - { - if (! bfd_set_section_contents (abfd, rtproc_sec, - rtproc_sec->contents, - (file_ptr) 0, - rtproc_sec->_raw_size)) - return false; - } - } - - return true; -} - -/* Returns the GOT section for ABFD. */ - -static asection * -mips_elf_got_section (abfd) - bfd *abfd; -{ - return bfd_get_section_by_name (abfd, ".got"); -} - -/* Returns the GOT information associated with the link indicated by - INFO. If SGOTP is non-NULL, it is filled in with the GOT - section. */ - -static struct mips_got_info * -mips_elf_got_info (abfd, sgotp) - bfd *abfd; - asection **sgotp; -{ - asection *sgot; - struct mips_got_info *g; - - sgot = mips_elf_got_section (abfd); - BFD_ASSERT (sgot != NULL); - BFD_ASSERT (elf_section_data (sgot) != NULL); - g = (struct mips_got_info *) elf_section_data (sgot)->tdata; - BFD_ASSERT (g != NULL); - - if (sgotp) - *sgotp = sgot; - return g; -} - -/* Return whether a relocation is against a local symbol. */ - -static boolean -mips_elf_local_relocation_p (input_bfd, relocation, local_sections) - bfd *input_bfd; - const Elf_Internal_Rela *relocation; - asection **local_sections; -{ - unsigned long r_symndx; - Elf_Internal_Shdr *symtab_hdr; - - r_symndx = ELF32_R_SYM (relocation->r_info); - symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; - if (! elf_bad_symtab (input_bfd)) - return r_symndx < symtab_hdr->sh_info; - else - { - /* The symbol table does not follow the rule that local symbols - must come before globals. */ - return local_sections[r_symndx] != NULL; - } -} - -/* Sign-extend VALUE, which has the indicated number of BITS. */ - -static bfd_vma -mips_elf_sign_extend (value, bits) - bfd_vma value; - int bits; -{ - if (value & ((bfd_vma)1 << (bits - 1))) - /* VALUE is negative. */ - value |= ((bfd_vma) - 1) << bits; - - return value; -} - -/* Return non-zero if the indicated VALUE has overflowed the maximum - range expressable by a signed number with the indicated number of - BITS. */ - -static boolean -mips_elf_overflow_p (value, bits) - bfd_vma value; - int bits; -{ - bfd_signed_vma svalue = (bfd_signed_vma) value; - - if (svalue > (1 << (bits - 1)) - 1) - /* The value is too big. */ - return true; - else if (svalue < -(1 << (bits - 1))) - /* The value is too small. */ - return true; - - /* All is well. */ - return false; -} - -/* Calculate the %high function. */ - -static bfd_vma -mips_elf_high (value) - bfd_vma value; -{ - return ((value + (bfd_vma) 0x8000) >> 16) & 0xffff; -} - -/* Calculate the %higher function. */ - -static bfd_vma -mips_elf_higher (value) - bfd_vma value ATTRIBUTE_UNUSED; -{ -#ifdef BFD64 - return ((value + (bfd_vma) 0x80008000) >> 32) & 0xffff; -#else - abort (); - return (bfd_vma) -1; -#endif -} - -/* Calculate the %highest function. */ - -static bfd_vma -mips_elf_highest (value) - bfd_vma value ATTRIBUTE_UNUSED; -{ -#ifdef BFD64 - return ((value + (bfd_vma) 0x800080008000) >> 48) & 0xffff; -#else - abort (); - return (bfd_vma) -1; -#endif -} - -/* Returns the GOT index for the global symbol indicated by H. */ - -static bfd_vma -mips_elf_global_got_index (abfd, h) - bfd *abfd; - struct elf_link_hash_entry *h; -{ - bfd_vma index; - asection *sgot; - struct mips_got_info *g; - - g = mips_elf_got_info (abfd, &sgot); - - /* Once we determine the global GOT entry with the lowest dynamic - symbol table index, we must put all dynamic symbols with greater - indices into the GOT. That makes it easy to calculate the GOT - offset. */ - BFD_ASSERT (h->dynindx >= g->global_gotsym->dynindx); - index = ((h->dynindx - g->global_gotsym->dynindx + g->local_gotno) - * MIPS_ELF_GOT_SIZE (abfd)); - BFD_ASSERT (index < sgot->_raw_size); - - return index; -} - -/* Returns the offset for the entry at the INDEXth position - in the GOT. */ - -static bfd_vma -mips_elf_got_offset_from_index (dynobj, output_bfd, index) - bfd *dynobj; - bfd *output_bfd; - bfd_vma index; -{ - asection *sgot; - bfd_vma gp; - - sgot = mips_elf_got_section (dynobj); - gp = _bfd_get_gp_value (output_bfd); - return (sgot->output_section->vma + sgot->output_offset + index - - gp); -} - -/* If H is a symbol that needs a global GOT entry, but has a dynamic - symbol table index lower than any we've seen to date, record it for - posterity. */ - -static boolean -mips_elf_record_global_got_symbol (h, info, g) - struct elf_link_hash_entry *h; - struct bfd_link_info *info; - struct mips_got_info *g ATTRIBUTE_UNUSED; -{ - /* A global symbol in the GOT must also be in the dynamic symbol - table. */ - if (h->dynindx == -1 - && !bfd_elf32_link_record_dynamic_symbol (info, h)) - return false; - - /* If we've already marked this entry as need GOT space, we don't - need to do it again. */ - if (h->got.offset != (bfd_vma) - 1) - return true; - - /* By setting this to a value other than -1, we are indicating that - there needs to be a GOT entry for H. */ - h->got.offset = 0; - - return true; -} - -/* This structure is passed to mips_elf_sort_hash_table_f when sorting - the dynamic symbols. */ - -struct mips_elf_hash_sort_data -{ - /* The symbol in the global GOT with the lowest dynamic symbol table - index. */ - struct elf_link_hash_entry *low; - /* The least dynamic symbol table index corresponding to a symbol - with a GOT entry. */ - long min_got_dynindx; - /* The greatest dynamic symbol table index not corresponding to a - symbol without a GOT entry. */ - long max_non_got_dynindx; -}; - -/* If H needs a GOT entry, assign it the highest available dynamic - index. Otherwise, assign it the lowest available dynamic - index. */ - -static boolean -mips_elf_sort_hash_table_f (h, data) - struct mips_elf_link_hash_entry *h; - PTR data; -{ - struct mips_elf_hash_sort_data *hsd - = (struct mips_elf_hash_sort_data *) data; - - /* Symbols without dynamic symbol table entries aren't interesting - at all. */ - if (h->root.dynindx == -1) - return true; - - if (h->root.got.offset != 0) - h->root.dynindx = hsd->max_non_got_dynindx++; - else - { - h->root.dynindx = --hsd->min_got_dynindx; - hsd->low = (struct elf_link_hash_entry *) h; - } - - return true; -} - -/* Sort the dynamic symbol table so that symbols that need GOT entries - appear towards the end. This reduces the amount of GOT space - required. MAX_LOCAL is used to set the number of local symbols - known to be in the dynamic symbol table. During - mips_elf_size_dynamic_sections, this value is 1. Afterward, the - section symbols are added and the count is higher. */ - -static boolean -mips_elf_sort_hash_table (info, max_local) - struct bfd_link_info *info; - unsigned long max_local; -{ - struct mips_elf_hash_sort_data hsd; - struct mips_got_info *g; - bfd *dynobj; - - dynobj = elf_hash_table (info)->dynobj; - - hsd.low = NULL; - hsd.min_got_dynindx = elf_hash_table (info)->dynsymcount; - hsd.max_non_got_dynindx = max_local; - mips_elf_link_hash_traverse (((struct mips_elf_link_hash_table *) - elf_hash_table (info)), - mips_elf_sort_hash_table_f, - &hsd); - - /* There shoud have been enough room in the symbol table to - accomodate both the GOT and non-GOT symbols. */ - BFD_ASSERT (hsd.min_got_dynindx == hsd.max_non_got_dynindx); - - /* Now we know which dynamic symbol has the lowest dynamic symbol - table index in the GOT. */ - g = mips_elf_got_info (dynobj, NULL); - g->global_gotsym = hsd.low; - - return true; -} - -/* Create a local GOT entry for VALUE. Return the index of the entry, - or -1 if it could not be created. */ - -static bfd_vma -mips_elf_create_local_got_entry (abfd, g, sgot, value) - bfd *abfd; - struct mips_got_info *g; - asection *sgot; - bfd_vma value; -{ - if (g->assigned_gotno >= g->local_gotno) - { - /* We didn't allocate enough space in the GOT. */ - (*_bfd_error_handler) - (_("not enough GOT space for local GOT entries")); - bfd_set_error (bfd_error_bad_value); - return (bfd_vma) -1; - } - - MIPS_ELF_PUT_WORD (abfd, value, - (sgot->contents - + MIPS_ELF_GOT_SIZE (abfd) * g->assigned_gotno)); - return MIPS_ELF_GOT_SIZE (abfd) * g->assigned_gotno++; -} - -/* Returns the GOT offset at which the indicated address can be found. - If there is not yet a GOT entry for this value, create one. Returns - -1 if no satisfactory GOT offset can be found. */ - -static bfd_vma -mips_elf_local_got_index (abfd, info, value) - bfd *abfd; - struct bfd_link_info *info; - bfd_vma value; -{ - asection *sgot; - struct mips_got_info *g; - bfd_byte *entry; - - g = mips_elf_got_info (elf_hash_table (info)->dynobj, &sgot); - - /* Look to see if we already have an appropriate entry. */ - for (entry = (sgot->contents - + MIPS_ELF_GOT_SIZE (abfd) * MIPS_RESERVED_GOTNO); - entry != sgot->contents + MIPS_ELF_GOT_SIZE (abfd) * g->assigned_gotno; - entry += MIPS_ELF_GOT_SIZE (abfd)) - { - bfd_vma address = MIPS_ELF_GET_WORD (abfd, entry); - if (address == value) - return entry - sgot->contents; - } - - return mips_elf_create_local_got_entry (abfd, g, sgot, value); -} - -/* Find a GOT entry that is within 32KB of the VALUE. These entries - are supposed to be placed at small offsets in the GOT, i.e., - within 32KB of GP. Return the index into the GOT for this page, - and store the offset from this entry to the desired address in - OFFSETP, if it is non-NULL. */ - -static bfd_vma -mips_elf_got_page (abfd, info, value, offsetp) - bfd *abfd; - struct bfd_link_info *info; - bfd_vma value; - bfd_vma *offsetp; -{ - asection *sgot; - struct mips_got_info *g; - bfd_byte *entry; - bfd_byte *last_entry; - bfd_vma index = 0; - bfd_vma address; - - g = mips_elf_got_info (elf_hash_table (info)->dynobj, &sgot); - - /* Look to see if we aleady have an appropriate entry. */ - last_entry = sgot->contents + MIPS_ELF_GOT_SIZE (abfd) * g->assigned_gotno; - for (entry = (sgot->contents - + MIPS_ELF_GOT_SIZE (abfd) * MIPS_RESERVED_GOTNO); - entry != last_entry; - entry += MIPS_ELF_GOT_SIZE (abfd)) - { - address = MIPS_ELF_GET_WORD (abfd, entry); - - if (!mips_elf_overflow_p (value - address, 16)) - { - /* This entry will serve as the page pointer. We can add a - 16-bit number to it to get the actual address. */ - index = entry - sgot->contents; - break; - } - } - - /* If we didn't have an appropriate entry, we create one now. */ - if (entry == last_entry) - index = mips_elf_create_local_got_entry (abfd, g, sgot, value); - - if (offsetp) - { - address = MIPS_ELF_GET_WORD (abfd, entry); - *offsetp = value - address; - } - - return index; -} - -/* Find a GOT entry whose higher-order 16 bits are the same as those - for value. Return the index into the GOT for this entry. */ - -static bfd_vma -mips_elf_got16_entry (abfd, info, value) - bfd *abfd; - struct bfd_link_info *info; - bfd_vma value; -{ - asection *sgot; - struct mips_got_info *g; - bfd_byte *entry; - bfd_byte *last_entry; - bfd_vma index = 0; - bfd_vma address; - - /* Although the ABI says that it is "the high-order 16 bits" that we - want, it is really the %high value. The complete value is - calculated with a `addiu' of a LO16 relocation, just as with a - HI16/LO16 pair. */ - value = mips_elf_high (value) << 16; - g = mips_elf_got_info (elf_hash_table (info)->dynobj, &sgot); - - /* Look to see if we already have an appropriate entry. */ - last_entry = sgot->contents + MIPS_ELF_GOT_SIZE (abfd) * g->assigned_gotno; - for (entry = (sgot->contents - + MIPS_ELF_GOT_SIZE (abfd) * MIPS_RESERVED_GOTNO); - entry != last_entry; - entry += MIPS_ELF_GOT_SIZE (abfd)) - { - address = MIPS_ELF_GET_WORD (abfd, entry); - if ((address & 0xffff0000) == value) - { - /* This entry has the right high-order 16 bits. */ - index = entry - sgot->contents; - break; - } - } - - /* If we didn't have an appropriate entry, we create one now. */ - if (entry == last_entry) - index = mips_elf_create_local_got_entry (abfd, g, sgot, value); - - return index; -} - -/* Returns the first relocation of type r_type found, beginning with - RELOCATION. RELEND is one-past-the-end of the relocation table. */ - -static const Elf_Internal_Rela * -mips_elf_next_relocation (r_type, relocation, relend) - unsigned int r_type; - const Elf_Internal_Rela *relocation; - const Elf_Internal_Rela *relend; -{ - /* According to the MIPS ELF ABI, the R_MIPS_LO16 relocation must be - immediately following. However, for the IRIX6 ABI, the next - relocation may be a composed relocation consisting of several - relocations for the same address. In that case, the R_MIPS_LO16 - relocation may occur as one of these. We permit a similar - extension in general, as that is useful for GCC. */ - while (relocation < relend) - { - if (ELF32_R_TYPE (relocation->r_info) == r_type) - return relocation; - - ++relocation; - } - - /* We didn't find it. */ - bfd_set_error (bfd_error_bad_value); - return NULL; -} - -/* Create a rel.dyn relocation for the dynamic linker to resolve. REL - is the original relocation, which is now being transformed into a - dyanmic relocation. The ADDENDP is adjusted if necessary; the - caller should store the result in place of the original addend. */ - -static boolean -mips_elf_create_dynamic_relocation (output_bfd, info, rel, h, sec, - symbol, addendp, input_section) - bfd *output_bfd; - struct bfd_link_info *info; - const Elf_Internal_Rela *rel; - struct mips_elf_link_hash_entry *h; - asection *sec; - bfd_vma symbol; - bfd_vma *addendp; - asection *input_section; -{ - Elf_Internal_Rel outrel; - boolean skip; - asection *sreloc; - bfd *dynobj; - int r_type; - - r_type = ELF32_R_TYPE (rel->r_info); - dynobj = elf_hash_table (info)->dynobj; - sreloc - = bfd_get_section_by_name (dynobj, - MIPS_ELF_REL_DYN_SECTION_NAME (output_bfd)); - BFD_ASSERT (sreloc != NULL); - - skip = false; - - /* We begin by assuming that the offset for the dynamic relocation - is the same as for the original relocation. We'll adjust this - later to reflect the correct output offsets. */ - if (elf_section_data (input_section)->stab_info == NULL) - outrel.r_offset = rel->r_offset; - else - { - /* Except that in a stab section things are more complex. - Because we compress stab information, the offset given in the - relocation may not be the one we want; we must let the stabs - machinery tell us the offset. */ - outrel.r_offset - = (_bfd_stab_section_offset - (output_bfd, &elf_hash_table (info)->stab_info, - input_section, - &elf_section_data (input_section)->stab_info, - rel->r_offset)); - /* If we didn't need the relocation at all, this value will be - -1. */ - if (outrel.r_offset == (bfd_vma) -1) - skip = true; - } - - /* If we've decided to skip this relocation, just output an emtpy - record. Note that R_MIPS_NONE == 0, so that this call to memset - is a way of setting R_TYPE to R_MIPS_NONE. */ - if (skip) - memset (&outrel, 0, sizeof (outrel)); - else - { - long indx; - bfd_vma section_offset; - - /* We must now calculate the dynamic symbol table index to use - in the relocation. */ - if (h != NULL - && (! info->symbolic || (h->root.elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0)) - { - indx = h->root.dynindx; - BFD_ASSERT (indx != -1); - } - else - { - if (sec != NULL && bfd_is_abs_section (sec)) - indx = 0; - else if (sec == NULL || sec->owner == NULL) - { - bfd_set_error (bfd_error_bad_value); - return false; - } - else - { - indx = elf_section_data (sec->output_section)->dynindx; - if (indx == 0) - abort (); - } - - /* Figure out how far the target of the relocation is from - the beginning of its section. */ - section_offset = symbol - sec->output_section->vma; - /* The relocation we're building is section-relative. - Therefore, the original addend must be adjusted by the - section offset. */ - *addendp += symbol - sec->output_section->vma; - /* Now, the relocation is just against the section. */ - symbol = sec->output_section->vma; - } - - /* If the relocation was previously an absolute relocation, we - must adjust it by the value we give it in the dynamic symbol - table. */ - if (r_type != R_MIPS_REL32) - *addendp += symbol; - - /* The relocation is always an REL32 relocation because we don't - know where the shared library will wind up at load-time. */ - outrel.r_info = ELF32_R_INFO (indx, R_MIPS_REL32); - - /* Adjust the output offset of the relocation to reference the - correct location in the output file. */ - outrel.r_offset += (input_section->output_section->vma - + input_section->output_offset); - } - - /* Put the relocation back out. We have to use the special - relocation outputter in the 64-bit case since the 64-bit - relocation format is non-standard. */ - if (ABI_64_P (output_bfd)) - { - (*get_elf_backend_data (output_bfd)->s->swap_reloc_out) - (output_bfd, &outrel, - (sreloc->contents - + sreloc->reloc_count * sizeof (Elf64_Mips_External_Rel))); - } - else - bfd_elf32_swap_reloc_out (output_bfd, &outrel, - (((Elf32_External_Rel *) - sreloc->contents) - + sreloc->reloc_count)); - - /* Record the index of the first relocation referencing H. This - information is later emitted in the .msym section. */ - if (h != NULL - && (h->min_dyn_reloc_index == 0 - || sreloc->reloc_count < h->min_dyn_reloc_index)) - h->min_dyn_reloc_index = sreloc->reloc_count; - - /* We've now added another relocation. */ - ++sreloc->reloc_count; - - /* Make sure the output section is writable. The dynamic linker - will be writing to it. */ - elf_section_data (input_section->output_section)->this_hdr.sh_flags - |= SHF_WRITE; - - /* On IRIX5, make an entry of compact relocation info. */ - if (! skip && IRIX_COMPAT (output_bfd) == ict_irix5) - { - asection* scpt = bfd_get_section_by_name (dynobj, ".compact_rel"); - bfd_byte *cr; - - if (scpt) - { - Elf32_crinfo cptrel; - - mips_elf_set_cr_format (cptrel, CRF_MIPS_LONG); - cptrel.vaddr = (rel->r_offset - + input_section->output_section->vma - + input_section->output_offset); - if (r_type == R_MIPS_REL32) - mips_elf_set_cr_type (cptrel, CRT_MIPS_REL32); - else - mips_elf_set_cr_type (cptrel, CRT_MIPS_WORD); - mips_elf_set_cr_dist2to (cptrel, 0); - cptrel.konst = *addendp; - - cr = (scpt->contents - + sizeof (Elf32_External_compact_rel)); - bfd_elf32_swap_crinfo_out (output_bfd, &cptrel, - ((Elf32_External_crinfo *) cr - + scpt->reloc_count)); - ++scpt->reloc_count; - } - } - - return true; -} - -/* Calculate the value produced by the RELOCATION (which comes from - the INPUT_BFD). The ADDEND is the addend to use for this - RELOCATION; RELOCATION->R_ADDEND is ignored. - - The result of the relocation calculation is stored in VALUEP. - REQUIRE_JALXP indicates whether or not the opcode used with this - relocation must be JALX. - - This function returns bfd_reloc_continue if the caller need take no - further action regarding this relocation, bfd_reloc_notsupported if - something goes dramatically wrong, bfd_reloc_overflow if an - overflow occurs, and bfd_reloc_ok to indicate success. */ - -static bfd_reloc_status_type -mips_elf_calculate_relocation (abfd, - input_bfd, - input_section, - info, - relocation, - addend, - howto, - local_syms, - local_sections, - valuep, - namep, - require_jalxp) - bfd *abfd; - bfd *input_bfd; - asection *input_section; - struct bfd_link_info *info; - const Elf_Internal_Rela *relocation; - bfd_vma addend; - reloc_howto_type *howto; - Elf_Internal_Sym *local_syms; - asection **local_sections; - bfd_vma *valuep; - const char **namep; - boolean *require_jalxp; -{ - /* The eventual value we will return. */ - bfd_vma value; - /* The address of the symbol against which the relocation is - occurring. */ - bfd_vma symbol = 0; - /* The final GP value to be used for the relocatable, executable, or - shared object file being produced. */ - bfd_vma gp = (bfd_vma) - 1; - /* The place (section offset or address) of the storage unit being - relocated. */ - bfd_vma p; - /* The value of GP used to create the relocatable object. */ - bfd_vma gp0 = (bfd_vma) - 1; - /* The offset into the global offset table at which the address of - the relocation entry symbol, adjusted by the addend, resides - during execution. */ - bfd_vma g = (bfd_vma) - 1; - /* The section in which the symbol referenced by the relocation is - located. */ - asection *sec = NULL; - struct mips_elf_link_hash_entry* h = NULL; - /* True if the symbol referred to by this relocation is a local - symbol. */ - boolean local_p; - /* True if the symbol referred to by this relocation is "_gp_disp". */ - boolean gp_disp_p = false; - Elf_Internal_Shdr *symtab_hdr; - size_t extsymoff; - unsigned long r_symndx; - int r_type; - /* True if overflow occurred during the calculation of the - relocation value. */ - boolean overflowed_p; - /* True if this relocation refers to a MIPS16 function. */ - boolean target_is_16_bit_code_p = false; - - /* Parse the relocation. */ - r_symndx = ELF32_R_SYM (relocation->r_info); - r_type = ELF32_R_TYPE (relocation->r_info); - p = (input_section->output_section->vma - + input_section->output_offset - + relocation->r_offset); - - /* Assume that there will be no overflow. */ - overflowed_p = false; - - /* Figure out whether or not the symbol is local, and get the offset - used in the array of hash table entries. */ - symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; - local_p = mips_elf_local_relocation_p (input_bfd, relocation, - local_sections); - if (! elf_bad_symtab (input_bfd)) - extsymoff = symtab_hdr->sh_info; - else - { - /* The symbol table does not follow the rule that local symbols - must come before globals. */ - extsymoff = 0; - } - - /* Figure out the value of the symbol. */ - if (local_p) - { - Elf_Internal_Sym *sym; - - sym = local_syms + r_symndx; - sec = local_sections[r_symndx]; - - symbol = sec->output_section->vma + sec->output_offset; - if (ELF_ST_TYPE (sym->st_info) != STT_SECTION) - symbol += sym->st_value; - - /* MIPS16 text labels should be treated as odd. */ - if (sym->st_other == STO_MIPS16) - ++symbol; - - /* Record the name of this symbol, for our caller. */ - *namep = bfd_elf_string_from_elf_section (input_bfd, - symtab_hdr->sh_link, - sym->st_name); - if (*namep == '\0') - *namep = bfd_section_name (input_bfd, sec); - - target_is_16_bit_code_p = (sym->st_other == STO_MIPS16); - } - else - { - /* For global symbols we look up the symbol in the hash-table. */ - h = ((struct mips_elf_link_hash_entry *) - elf_sym_hashes (input_bfd) [r_symndx - extsymoff]); - /* Find the real hash-table entry for this symbol. */ - while (h->root.type == bfd_link_hash_indirect - || h->root.type == bfd_link_hash_warning) - h = (struct mips_elf_link_hash_entry *) h->root.root.u.i.link; - - /* Record the name of this symbol, for our caller. */ - *namep = h->root.root.root.string; - - /* See if this is the special _gp_disp symbol. Note that such a - symbol must always be a global symbol. */ - if (strcmp (h->root.root.root.string, "_gp_disp") == 0) - { - /* Relocations against _gp_disp are permitted only with - R_MIPS_HI16 and R_MIPS_LO16 relocations. */ - if (r_type != R_MIPS_HI16 && r_type != R_MIPS_LO16) - return bfd_reloc_notsupported; - - gp_disp_p = true; - } - /* If this symbol is defined, calculate its address. Note that - _gp_disp is a magic symbol, always implicitly defined by the - linker, so it's inappropriate to check to see whether or not - its defined. */ - else if ((h->root.root.type == bfd_link_hash_defined - || h->root.root.type == bfd_link_hash_defweak) - && h->root.root.u.def.section) - { - sec = h->root.root.u.def.section; - if (sec->output_section) - symbol = (h->root.root.u.def.value - + sec->output_section->vma - + sec->output_offset); - else - symbol = h->root.root.u.def.value; - } - else if (h->root.root.type == bfd_link_hash_undefweak) - /* We allow relocations against undefined weak symbols, giving - it the value zero, so that you can undefined weak functions - and check to see if they exist by looking at their - addresses. */ - symbol = 0; - else if (info->shared && !info->symbolic && !info->no_undefined - && ELF_ST_VISIBILITY (h->root.other) == STV_DEFAULT) - symbol = 0; - else if (strcmp (h->root.root.root.string, "_DYNAMIC_LINK") == 0) - { - /* If this is a dynamic link, we should have created a - _DYNAMIC_LINK symbol in mips_elf_create_dynamic_sections. - Otherwise, we should define the symbol with a value of 0. - FIXME: It should probably get into the symbol table - somehow as well. */ - BFD_ASSERT (! info->shared); - BFD_ASSERT (bfd_get_section_by_name (abfd, ".dynamic") == NULL); - symbol = 0; - } - else - { - if (! ((*info->callbacks->undefined_symbol) - (info, h->root.root.root.string, input_bfd, - input_section, relocation->r_offset, - (!info->shared || info->no_undefined - || ELF_ST_VISIBILITY (h->root.other))))) - return bfd_reloc_undefined; - symbol = 0; - } - - target_is_16_bit_code_p = (h->root.other == STO_MIPS16); - } - - /* If this is a 32-bit call to a 16-bit function with a stub, we - need to redirect the call to the stub, unless we're already *in* - a stub. */ - if (r_type != R_MIPS16_26 && !info->relocateable - && ((h != NULL && h->fn_stub != NULL) - || (local_p && elf_tdata (input_bfd)->local_stubs != NULL - && elf_tdata (input_bfd)->local_stubs[r_symndx] != NULL)) - && !mips_elf_stub_section_p (input_bfd, input_section)) - { - /* This is a 32-bit call to a 16-bit function. We should - have already noticed that we were going to need the - stub. */ - if (local_p) - sec = elf_tdata (input_bfd)->local_stubs[r_symndx]; - else - { - BFD_ASSERT (h->need_fn_stub); - sec = h->fn_stub; - } - - symbol = sec->output_section->vma + sec->output_offset; - } - /* If this is a 16-bit call to a 32-bit function with a stub, we - need to redirect the call to the stub. */ - else if (r_type == R_MIPS16_26 && !info->relocateable - && h != NULL - && (h->call_stub != NULL || h->call_fp_stub != NULL) - && !target_is_16_bit_code_p) - { - /* If both call_stub and call_fp_stub are defined, we can figure - out which one to use by seeing which one appears in the input - file. */ - if (h->call_stub != NULL && h->call_fp_stub != NULL) - { - asection *o; - - sec = NULL; - for (o = input_bfd->sections; o != NULL; o = o->next) - { - if (strncmp (bfd_get_section_name (input_bfd, o), - CALL_FP_STUB, sizeof CALL_FP_STUB - 1) == 0) - { - sec = h->call_fp_stub; - break; - } - } - if (sec == NULL) - sec = h->call_stub; - } - else if (h->call_stub != NULL) - sec = h->call_stub; - else - sec = h->call_fp_stub; - - BFD_ASSERT (sec->_raw_size > 0); - symbol = sec->output_section->vma + sec->output_offset; - } - - /* Calls from 16-bit code to 32-bit code and vice versa require the - special jalx instruction. */ - *require_jalxp = (!info->relocateable - && ((r_type == R_MIPS16_26) != target_is_16_bit_code_p)); - - /* If we haven't already determined the GOT offset, or the GP value, - and we're going to need it, get it now. */ - switch (r_type) - { - case R_MIPS_CALL16: - case R_MIPS_GOT16: - case R_MIPS_GOT_DISP: - case R_MIPS_GOT_HI16: - case R_MIPS_CALL_HI16: - case R_MIPS_GOT_LO16: - case R_MIPS_CALL_LO16: - /* Find the index into the GOT where this value is located. */ - if (!local_p) - { - BFD_ASSERT (addend == 0); - g = mips_elf_global_got_index - (elf_hash_table (info)->dynobj, - (struct elf_link_hash_entry*) h); - } - else if (r_type == R_MIPS_GOT16) - /* There's no need to create a local GOT entry here; the - calculation for a local GOT16 entry does not involve G. */ - break; - else - { - g = mips_elf_local_got_index (abfd, info, symbol + addend); - if (g == (bfd_vma) -1) - return false; - } - - /* Convert GOT indices to actual offsets. */ - g = mips_elf_got_offset_from_index (elf_hash_table (info)->dynobj, - abfd, g); - break; - - case R_MIPS_HI16: - case R_MIPS_LO16: - case R_MIPS_GPREL16: - case R_MIPS_GPREL32: - case R_MIPS_LITERAL: - gp0 = _bfd_get_gp_value (input_bfd); - gp = _bfd_get_gp_value (abfd); - break; - - default: - break; - } - - /* Figure out what kind of relocation is being performed. */ - switch (r_type) - { - case R_MIPS_NONE: - return bfd_reloc_continue; - - case R_MIPS_16: - value = symbol + mips_elf_sign_extend (addend, 16); - overflowed_p = mips_elf_overflow_p (value, 16); - break; - - case R_MIPS_32: - case R_MIPS_REL32: - case R_MIPS_64: - if ((info->shared - || (elf_hash_table (info)->dynamic_sections_created - && h != NULL - && ((h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) - == 0))) - && (input_section->flags & SEC_ALLOC) != 0) - { - /* If we're creating a shared library, or this relocation is - against a symbol in a shared library, then we can't know - where the symbol will end up. So, we create a relocation - record in the output, and leave the job up to the dynamic - linker. */ - value = addend; - if (!mips_elf_create_dynamic_relocation (abfd, - info, - relocation, - h, - sec, - symbol, - &value, - input_section)) - return false; - } - else - { - if (r_type != R_MIPS_REL32) - value = symbol + addend; - else - value = addend; - } - value &= howto->dst_mask; - break; - - case R_MIPS_PC32: - case R_MIPS_PC64: - case R_MIPS_GNU_REL_LO16: - value = symbol + addend - p; - value &= howto->dst_mask; - break; - - case R_MIPS_GNU_REL16_S2: - value = symbol + mips_elf_sign_extend (addend << 2, 18) - p; - overflowed_p = mips_elf_overflow_p (value, 18); - value = (value >> 2) & howto->dst_mask; - break; - - case R_MIPS_GNU_REL_HI16: - value = mips_elf_high (addend + symbol - p); - value &= howto->dst_mask; - break; - - case R_MIPS16_26: - /* The calculation for R_MIPS_26 is just the same as for an - R_MIPS_26. It's only the storage of the relocated field into - the output file that's different. That's handled in - mips_elf_perform_relocation. So, we just fall through to the - R_MIPS_26 case here. */ - case R_MIPS_26: - if (local_p) - value = (((addend << 2) | (p & 0xf0000000)) + symbol) >> 2; - else - value = (mips_elf_sign_extend (addend << 2, 28) + symbol) >> 2; - value &= howto->dst_mask; - break; - - case R_MIPS_HI16: - if (!gp_disp_p) - { - value = mips_elf_high (addend + symbol); - value &= howto->dst_mask; - } - else - { - value = mips_elf_high (addend + gp - p); - overflowed_p = mips_elf_overflow_p (value, 16); - } - break; - - case R_MIPS_LO16: - if (!gp_disp_p) - value = (symbol + addend) & howto->dst_mask; - else - { - value = addend + gp - p + 4; - /* The MIPS ABI requires checking the R_MIPS_LO16 relocation - for overflow. But, on, say, Irix 5, relocations against - _gp_disp are normally generated from the .cpload - pseudo-op. It generates code that normally looks like - this: - - lui $gp,%hi(_gp_disp) - addiu $gp,$gp,%lo(_gp_disp) - addu $gp,$gp,$t9 - - Here $t9 holds the address of the function being called, - as required by the MIPS ELF ABI. The R_MIPS_LO16 - relocation can easily overflow in this situation, but the - R_MIPS_HI16 relocation will handle the overflow. - Therefore, we consider this a bug in the MIPS ABI, and do - not check for overflow here. */ - } - break; - - case R_MIPS_LITERAL: - /* Because we don't merge literal sections, we can handle this - just like R_MIPS_GPREL16. In the long run, we should merge - shared literals, and then we will need to additional work - here. */ - - /* Fall through. */ - - case R_MIPS16_GPREL: - /* The R_MIPS16_GPREL performs the same calculation as - R_MIPS_GPREL16, but stores the relocated bits in a different - order. We don't need to do anything special here; the - differences are handled in mips_elf_perform_relocation. */ - case R_MIPS_GPREL16: - if (local_p) - value = mips_elf_sign_extend (addend, 16) + symbol + gp0 - gp; - else - value = mips_elf_sign_extend (addend, 16) + symbol - gp; - overflowed_p = mips_elf_overflow_p (value, 16); - break; - - case R_MIPS_GOT16: - if (local_p) - { - value = mips_elf_got16_entry (abfd, info, symbol + addend); - if (value == (bfd_vma) -1) - return false; - value - = mips_elf_got_offset_from_index (elf_hash_table (info)->dynobj, - abfd, - value); - overflowed_p = mips_elf_overflow_p (value, 16); - break; - } - - /* Fall through. */ - - case R_MIPS_CALL16: - case R_MIPS_GOT_DISP: - value = g; - overflowed_p = mips_elf_overflow_p (value, 16); - break; - - case R_MIPS_GPREL32: - value = (addend + symbol + gp0 - gp) & howto->dst_mask; - break; - - case R_MIPS_PC16: - value = mips_elf_sign_extend (addend, 16) + symbol - p; - value = (bfd_vma) ((bfd_signed_vma) value / 4); - overflowed_p = mips_elf_overflow_p (value, 16); - break; - - case R_MIPS_GOT_HI16: - case R_MIPS_CALL_HI16: - /* We're allowed to handle these two relocations identically. - The dynamic linker is allowed to handle the CALL relocations - differently by creating a lazy evaluation stub. */ - value = g; - value = mips_elf_high (value); - value &= howto->dst_mask; - break; - - case R_MIPS_GOT_LO16: - case R_MIPS_CALL_LO16: - value = g & howto->dst_mask; - break; - - case R_MIPS_GOT_PAGE: - value = mips_elf_got_page (abfd, info, symbol + addend, NULL); - if (value == (bfd_vma) -1) - return false; - value = mips_elf_got_offset_from_index (elf_hash_table (info)->dynobj, - abfd, - value); - overflowed_p = mips_elf_overflow_p (value, 16); - break; - - case R_MIPS_GOT_OFST: - mips_elf_got_page (abfd, info, symbol + addend, &value); - overflowed_p = mips_elf_overflow_p (value, 16); - break; - - case R_MIPS_SUB: - value = symbol - addend; - value &= howto->dst_mask; - break; - - case R_MIPS_HIGHER: - value = mips_elf_higher (addend + symbol); - value &= howto->dst_mask; - break; - - case R_MIPS_HIGHEST: - value = mips_elf_highest (addend + symbol); - value &= howto->dst_mask; - break; - - case R_MIPS_SCN_DISP: - value = symbol + addend - sec->output_offset; - value &= howto->dst_mask; - break; - - case R_MIPS_PJUMP: - case R_MIPS_JALR: - /* Both of these may be ignored. R_MIPS_JALR is an optimization - hint; we could improve performance by honoring that hint. */ - return bfd_reloc_continue; - - case R_MIPS_GNU_VTINHERIT: - case R_MIPS_GNU_VTENTRY: - /* We don't do anything with these at present. */ - return bfd_reloc_continue; - - default: - /* An unrecognized relocation type. */ - return bfd_reloc_notsupported; - } - - /* Store the VALUE for our caller. */ - *valuep = value; - return overflowed_p ? bfd_reloc_overflow : bfd_reloc_ok; -} - -/* Obtain the field relocated by RELOCATION. */ - -static bfd_vma -mips_elf_obtain_contents (howto, relocation, input_bfd, contents) - reloc_howto_type *howto; - const Elf_Internal_Rela *relocation; - bfd *input_bfd; - bfd_byte *contents; -{ - bfd_vma x; - bfd_byte *location = contents + relocation->r_offset; - - /* Obtain the bytes. */ - x = bfd_get (8 * bfd_get_reloc_size (howto), input_bfd, location); - - if ((ELF32_R_TYPE (relocation->r_info) == R_MIPS16_26 - || ELF32_R_TYPE (relocation->r_info) == R_MIPS16_GPREL) - && bfd_little_endian (input_bfd)) - /* The two 16-bit words will be reversed on a little-endian - system. See mips_elf_perform_relocation for more details. */ - x = (((x & 0xffff) << 16) | ((x & 0xffff0000) >> 16)); - - return x; -} - -/* It has been determined that the result of the RELOCATION is the - VALUE. Use HOWTO to place VALUE into the output file at the - appropriate position. The SECTION is the section to which the - relocation applies. If REQUIRE_JALX is true, then the opcode used - for the relocation must be either JAL or JALX, and it is - unconditionally converted to JALX. - - Returns false if anything goes wrong. */ - -static boolean -mips_elf_perform_relocation (info, howto, relocation, value, - input_bfd, input_section, - contents, require_jalx) - struct bfd_link_info *info; - reloc_howto_type *howto; - const Elf_Internal_Rela *relocation; - bfd_vma value; - bfd *input_bfd; - asection *input_section; - bfd_byte *contents; - boolean require_jalx; -{ - bfd_vma x; - bfd_byte *location; - int r_type = ELF32_R_TYPE (relocation->r_info); - - /* Figure out where the relocation is occurring. */ - location = contents + relocation->r_offset; - - /* Obtain the current value. */ - x = mips_elf_obtain_contents (howto, relocation, input_bfd, contents); - - /* Clear the field we are setting. */ - x &= ~howto->dst_mask; - - /* If this is the R_MIPS16_26 relocation, we must store the - value in a funny way. */ - if (r_type == R_MIPS16_26) - { - /* R_MIPS16_26 is used for the mips16 jal and jalx instructions. - Most mips16 instructions are 16 bits, but these instructions - are 32 bits. - - The format of these instructions is: - - +--------------+--------------------------------+ - ! JALX ! X! Imm 20:16 ! Imm 25:21 ! - +--------------+--------------------------------+ - ! Immediate 15:0 ! - +-----------------------------------------------+ - - JALX is the 5-bit value 00011. X is 0 for jal, 1 for jalx. - Note that the immediate value in the first word is swapped. - - When producing a relocateable object file, R_MIPS16_26 is - handled mostly like R_MIPS_26. In particular, the addend is - stored as a straight 26-bit value in a 32-bit instruction. - (gas makes life simpler for itself by never adjusting a - R_MIPS16_26 reloc to be against a section, so the addend is - always zero). However, the 32 bit instruction is stored as 2 - 16-bit values, rather than a single 32-bit value. In a - big-endian file, the result is the same; in a little-endian - file, the two 16-bit halves of the 32 bit value are swapped. - This is so that a disassembler can recognize the jal - instruction. - - When doing a final link, R_MIPS16_26 is treated as a 32 bit - instruction stored as two 16-bit values. The addend A is the - contents of the targ26 field. The calculation is the same as - R_MIPS_26. When storing the calculated value, reorder the - immediate value as shown above, and don't forget to store the - value as two 16-bit values. - - To put it in MIPS ABI terms, the relocation field is T-targ26-16, - defined as - - big-endian: - +--------+----------------------+ - | | | - | | targ26-16 | - |31 26|25 0| - +--------+----------------------+ - - little-endian: - +----------+------+-------------+ - | | | | - | sub1 | | sub2 | - |0 9|10 15|16 31| - +----------+--------------------+ - where targ26-16 is sub1 followed by sub2 (i.e., the addend field A is - ((sub1 << 16) | sub2)). - - When producing a relocateable object file, the calculation is - (((A < 2) | (P & 0xf0000000) + S) >> 2) - When producing a fully linked file, the calculation is - let R = (((A < 2) | (P & 0xf0000000) + S) >> 2) - ((R & 0x1f0000) << 5) | ((R & 0x3e00000) >> 5) | (R & 0xffff) */ - - if (!info->relocateable) - /* Shuffle the bits according to the formula above. */ - value = (((value & 0x1f0000) << 5) - | ((value & 0x3e00000) >> 5) - | (value & 0xffff)); - - } - else if (r_type == R_MIPS16_GPREL) - { - /* R_MIPS16_GPREL is used for GP-relative addressing in mips16 - mode. A typical instruction will have a format like this: - - +--------------+--------------------------------+ - ! EXTEND ! Imm 10:5 ! Imm 15:11 ! - +--------------+--------------------------------+ - ! Major ! rx ! ry ! Imm 4:0 ! - +--------------+--------------------------------+ - - EXTEND is the five bit value 11110. Major is the instruction - opcode. - - This is handled exactly like R_MIPS_GPREL16, except that the - addend is retrieved and stored as shown in this diagram; that - is, the Imm fields above replace the V-rel16 field. - - All we need to do here is shuffle the bits appropriately. As - above, the two 16-bit halves must be swapped on a - little-endian system. */ - value = (((value & 0x7e0) << 16) - | ((value & 0xf800) << 5) - | (value & 0x1f)); - } - - /* Set the field. */ - x |= (value & howto->dst_mask); - - /* If required, turn JAL into JALX. */ - if (require_jalx) - { - boolean ok; - bfd_vma opcode = x >> 26; - bfd_vma jalx_opcode; - - /* Check to see if the opcode is already JAL or JALX. */ - if (r_type == R_MIPS16_26) - { - ok = ((opcode == 0x6) || (opcode == 0x7)); - jalx_opcode = 0x7; - } - else - { - ok = ((opcode == 0x3) || (opcode == 0x1d)); - jalx_opcode = 0x1d; - } - - /* If the opcode is not JAL or JALX, there's a problem. */ - if (!ok) - { - (*_bfd_error_handler) - (_("%s: %s+0x%lx: jump to stub routine which is not jal"), - bfd_get_filename (input_bfd), - input_section->name, - (unsigned long) relocation->r_offset); - bfd_set_error (bfd_error_bad_value); - return false; - } - - /* Make this the JALX opcode. */ - x = (x & ~(0x3f << 26)) | (jalx_opcode << 26); - } - - /* Swap the high- and low-order 16 bits on little-endian systems - when doing a MIPS16 relocation. */ - if ((r_type == R_MIPS16_GPREL || r_type == R_MIPS16_26) - && bfd_little_endian (input_bfd)) - x = (((x & 0xffff) << 16) | ((x & 0xffff0000) >> 16)); - - /* Put the value into the output. */ - bfd_put (8 * bfd_get_reloc_size (howto), input_bfd, x, location); - return true; -} - -/* Returns true if SECTION is a MIPS16 stub section. */ - -static boolean -mips_elf_stub_section_p (abfd, section) - bfd *abfd ATTRIBUTE_UNUSED; - asection *section; -{ - const char *name = bfd_get_section_name (abfd, section); - - return (strncmp (name, FN_STUB, sizeof FN_STUB - 1) == 0 - || strncmp (name, CALL_STUB, sizeof CALL_STUB - 1) == 0 - || strncmp (name, CALL_FP_STUB, sizeof CALL_FP_STUB - 1) == 0); -} - -/* Relocate a MIPS ELF section. */ - -boolean -_bfd_mips_elf_relocate_section (output_bfd, info, input_bfd, input_section, - contents, relocs, local_syms, local_sections) - bfd *output_bfd; - struct bfd_link_info *info; - bfd *input_bfd; - asection *input_section; - bfd_byte *contents; - Elf_Internal_Rela *relocs; - Elf_Internal_Sym *local_syms; - asection **local_sections; -{ - Elf_Internal_Rela *rel; - const Elf_Internal_Rela *relend; - bfd_vma addend = 0; - boolean use_saved_addend_p = false; - struct elf_backend_data *bed; - - bed = get_elf_backend_data (output_bfd); - relend = relocs + input_section->reloc_count * bed->s->int_rels_per_ext_rel; - for (rel = relocs; rel < relend; ++rel) - { - const char *name; - bfd_vma value; - reloc_howto_type *howto; - boolean require_jalx; - /* True if the relocation is a RELA relocation, rather than a - REL relocation. */ - boolean rela_relocation_p = true; - int r_type = ELF32_R_TYPE (rel->r_info); - - /* Find the relocation howto for this relocation. */ - if (r_type == R_MIPS_64 && !ABI_64_P (output_bfd)) - { - /* Some 32-bit code uses R_MIPS_64. In particular, people use - 64-bit code, but make sure all their addresses are in the - lowermost or uppermost 32-bit section of the 64-bit address - space. Thus, when they use an R_MIPS_64 they mean what is - usually meant by R_MIPS_32, with the exception that the - stored value is sign-extended to 64 bits. */ - howto = elf_mips_howto_table + R_MIPS_32; - - /* On big-endian systems, we need to lie about the position - of the reloc. */ - if (bfd_big_endian (input_bfd)) - rel->r_offset += 4; - } - else - howto = mips_rtype_to_howto (r_type); - - if (!use_saved_addend_p) - { - Elf_Internal_Shdr *rel_hdr; - - /* If these relocations were originally of the REL variety, - we must pull the addend out of the field that will be - relocated. Otherwise, we simply use the contents of the - RELA relocation. To determine which flavor or relocation - this is, we depend on the fact that the INPUT_SECTION's - REL_HDR is read before its REL_HDR2. */ - rel_hdr = &elf_section_data (input_section)->rel_hdr; - if ((size_t) (rel - relocs) - >= (rel_hdr->sh_size / rel_hdr->sh_entsize - * bed->s->int_rels_per_ext_rel)) - rel_hdr = elf_section_data (input_section)->rel_hdr2; - if (rel_hdr->sh_entsize == MIPS_ELF_REL_SIZE (input_bfd)) - { - /* Note that this is a REL relocation. */ - rela_relocation_p = false; - - /* Get the addend, which is stored in the input file. */ - addend = mips_elf_obtain_contents (howto, - rel, - input_bfd, - contents); - addend &= howto->src_mask; - - /* For some kinds of relocations, the ADDEND is a - combination of the addend stored in two different - relocations. */ - if (r_type == R_MIPS_HI16 - || r_type == R_MIPS_GNU_REL_HI16 - || (r_type == R_MIPS_GOT16 - && mips_elf_local_relocation_p (input_bfd, rel, - local_sections))) - { - bfd_vma l; - const Elf_Internal_Rela *lo16_relocation; - reloc_howto_type *lo16_howto; - int lo; - - /* The combined value is the sum of the HI16 addend, - left-shifted by sixteen bits, and the LO16 - addend, sign extended. (Usually, the code does - a `lui' of the HI16 value, and then an `addiu' of - the LO16 value.) - - Scan ahead to find a matching LO16 relocation. */ - if (r_type == R_MIPS_GNU_REL_HI16) - lo = R_MIPS_GNU_REL_LO16; - else - lo = R_MIPS_LO16; - lo16_relocation - = mips_elf_next_relocation (lo, rel, relend); - if (lo16_relocation == NULL) - return false; - - /* Obtain the addend kept there. */ - lo16_howto = mips_rtype_to_howto (lo); - l = mips_elf_obtain_contents (lo16_howto, - lo16_relocation, - input_bfd, contents); - l &= lo16_howto->src_mask; - l = mips_elf_sign_extend (l, 16); - - addend <<= 16; - - /* Compute the combined addend. */ - addend += l; - } - else if (r_type == R_MIPS16_GPREL) - { - /* The addend is scrambled in the object file. See - mips_elf_perform_relocation for details on the - format. */ - addend = (((addend & 0x1f0000) >> 5) - | ((addend & 0x7e00000) >> 16) - | (addend & 0x1f)); - } - } - else - addend = rel->r_addend; - } - - if (info->relocateable) - { - Elf_Internal_Sym *sym; - unsigned long r_symndx; - - if (r_type == R_MIPS_64 && !ABI_64_P (output_bfd) - && bfd_big_endian (input_bfd)) - rel->r_offset -= 4; - - /* Since we're just relocating, all we need to do is copy - the relocations back out to the object file, unless - they're against a section symbol, in which case we need - to adjust by the section offset, or unless they're GP - relative in which case we need to adjust by the amount - that we're adjusting GP in this relocateable object. */ - - if (!mips_elf_local_relocation_p (input_bfd, rel, local_sections)) - /* There's nothing to do for non-local relocations. */ - continue; - - if (r_type == R_MIPS16_GPREL - || r_type == R_MIPS_GPREL16 - || r_type == R_MIPS_GPREL32 - || r_type == R_MIPS_LITERAL) - addend -= (_bfd_get_gp_value (output_bfd) - - _bfd_get_gp_value (input_bfd)); - else if (r_type == R_MIPS_26 || r_type == R_MIPS16_26 - || r_type == R_MIPS_GNU_REL16_S2) - /* The addend is stored without its two least - significant bits (which are always zero.) In a - non-relocateable link, calculate_relocation will do - this shift; here, we must do it ourselves. */ - addend <<= 2; - - r_symndx = ELF32_R_SYM (rel->r_info); - sym = local_syms + r_symndx; - if (ELF_ST_TYPE (sym->st_info) == STT_SECTION) - /* Adjust the addend appropriately. */ - addend += local_sections[r_symndx]->output_offset; - - /* If the relocation is for a R_MIPS_HI16 or R_MIPS_GOT16, - then we only want to write out the high-order 16 bits. - The subsequent R_MIPS_LO16 will handle the low-order bits. */ - if (r_type == R_MIPS_HI16 || r_type == R_MIPS_GOT16 - || r_type == R_MIPS_GNU_REL_HI16) - addend = mips_elf_high (addend); - /* If the relocation is for an R_MIPS_26 relocation, then - the two low-order bits are not stored in the object file; - they are implicitly zero. */ - else if (r_type == R_MIPS_26 || r_type == R_MIPS16_26 - || r_type == R_MIPS_GNU_REL16_S2) - addend >>= 2; - - if (rela_relocation_p) - /* If this is a RELA relocation, just update the addend. - We have to cast away constness for REL. */ - rel->r_addend = addend; - else - { - /* Otherwise, we have to write the value back out. Note - that we use the source mask, rather than the - destination mask because the place to which we are - writing will be source of the addend in the final - link. */ - addend &= howto->src_mask; - - if (r_type == R_MIPS_64 && !ABI_64_P (output_bfd)) - /* See the comment above about using R_MIPS_64 in the 32-bit - ABI. Here, we need to update the addend. It would be - possible to get away with just using the R_MIPS_32 reloc - but for endianness. */ - { - bfd_vma sign_bits; - bfd_vma low_bits; - bfd_vma high_bits; - - if (addend & 0x80000000u) - sign_bits = 0xffffffffu; - else - sign_bits = 0; - - /* If we don't know that we have a 64-bit type, - do two separate stores. */ - if (bfd_big_endian (input_bfd)) - { - /* Store the sign-bits (which are most significant) - first. */ - low_bits = sign_bits; - high_bits = addend; - } - else - { - low_bits = addend; - high_bits = sign_bits; - } - bfd_put_32 (input_bfd, low_bits, - contents + rel->r_offset); - bfd_put_32 (input_bfd, high_bits, - contents + rel->r_offset + 4); - continue; - } - - if (!mips_elf_perform_relocation (info, howto, rel, addend, - input_bfd, input_section, - contents, false)) - return false; - } - - /* Go on to the next relocation. */ - continue; - } - - /* In the N32 and 64-bit ABIs there may be multiple consecutive - relocations for the same offset. In that case we are - supposed to treat the output of each relocation as the addend - for the next. */ - if (rel + 1 < relend - && rel->r_offset == rel[1].r_offset - && ELF32_R_TYPE (rel[1].r_info) != R_MIPS_NONE) - use_saved_addend_p = true; - else - use_saved_addend_p = false; - - /* Figure out what value we are supposed to relocate. */ - switch (mips_elf_calculate_relocation (output_bfd, - input_bfd, - input_section, - info, - rel, - addend, - howto, - local_syms, - local_sections, - &value, - &name, - &require_jalx)) - { - case bfd_reloc_continue: - /* There's nothing to do. */ - continue; - - case bfd_reloc_undefined: - /* mips_elf_calculate_relocation already called the - undefined_symbol callback. There's no real point in - trying to perform the relocation at this point, so we - just skip ahead to the next relocation. */ - continue; - - case bfd_reloc_notsupported: - abort (); - break; - - case bfd_reloc_overflow: - if (use_saved_addend_p) - /* Ignore overflow until we reach the last relocation for - a given location. */ - ; - else - { - BFD_ASSERT (name != NULL); - if (! ((*info->callbacks->reloc_overflow) - (info, name, howto->name, (bfd_vma) 0, - input_bfd, input_section, rel->r_offset))) - return false; - } - break; - - case bfd_reloc_ok: - break; - - default: - abort (); - break; - } - - /* If we've got another relocation for the address, keep going - until we reach the last one. */ - if (use_saved_addend_p) - { - addend = value; - continue; - } - - if (r_type == R_MIPS_64 && !ABI_64_P (output_bfd)) - /* See the comment above about using R_MIPS_64 in the 32-bit - ABI. Until now, we've been using the HOWTO for R_MIPS_32; - that calculated the right value. Now, however, we - sign-extend the 32-bit result to 64-bits, and store it as a - 64-bit value. We are especially generous here in that we - go to extreme lengths to support this usage on systems with - only a 32-bit VMA. */ - { - bfd_vma sign_bits; - bfd_vma low_bits; - bfd_vma high_bits; - - if (value & 0x80000000u) - sign_bits = 0xffffffffu; - else - sign_bits = 0; - - /* If we don't know that we have a 64-bit type, - do two separate stores. */ - if (bfd_big_endian (input_bfd)) - { - /* Undo what we did above. */ - rel->r_offset -= 4; - /* Store the sign-bits (which are most significant) - first. */ - low_bits = sign_bits; - high_bits = value; - } - else - { - low_bits = value; - high_bits = sign_bits; - } - bfd_put_32 (input_bfd, low_bits, - contents + rel->r_offset); - bfd_put_32 (input_bfd, high_bits, - contents + rel->r_offset + 4); - continue; - } - - /* Actually perform the relocation. */ - if (!mips_elf_perform_relocation (info, howto, rel, value, input_bfd, - input_section, contents, - require_jalx)) - return false; - } - - return true; -} - -/* This hook function is called before the linker writes out a global - symbol. We mark symbols as small common if appropriate. This is - also where we undo the increment of the value for a mips16 symbol. */ - -/*ARGSIGNORED*/ -boolean -_bfd_mips_elf_link_output_symbol_hook (abfd, info, name, sym, input_sec) - bfd *abfd ATTRIBUTE_UNUSED; - struct bfd_link_info *info ATTRIBUTE_UNUSED; - const char *name ATTRIBUTE_UNUSED; - Elf_Internal_Sym *sym; - asection *input_sec; -{ - /* If we see a common symbol, which implies a relocatable link, then - if a symbol was small common in an input file, mark it as small - common in the output file. */ - if (sym->st_shndx == SHN_COMMON - && strcmp (input_sec->name, ".scommon") == 0) - sym->st_shndx = SHN_MIPS_SCOMMON; - - if (sym->st_other == STO_MIPS16 - && (sym->st_value & 1) != 0) - --sym->st_value; - - return true; -} - -/* Functions for the dynamic linker. */ - -/* The name of the dynamic interpreter. This is put in the .interp - section. */ - -#define ELF_DYNAMIC_INTERPRETER(abfd) \ - (ABI_N32_P (abfd) ? "/usr/lib32/libc.so.1" \ - : ABI_64_P (abfd) ? "/usr/lib64/libc.so.1" \ - : "/usr/lib/libc.so.1") - -/* Create dynamic sections when linking against a dynamic object. */ - -boolean -_bfd_mips_elf_create_dynamic_sections (abfd, info) - bfd *abfd; - struct bfd_link_info *info; -{ - struct elf_link_hash_entry *h; - flagword flags; - register asection *s; - const char * const *namep; - - flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY - | SEC_LINKER_CREATED | SEC_READONLY); - - /* Mips ABI requests the .dynamic section to be read only. */ - s = bfd_get_section_by_name (abfd, ".dynamic"); - if (s != NULL) - { - if (! bfd_set_section_flags (abfd, s, flags)) - return false; - } - - /* We need to create .got section. */ - if (! mips_elf_create_got_section (abfd, info)) - return false; - - /* Create the .msym section on IRIX6. It is used by the dynamic - linker to speed up dynamic relocations, and to avoid computing - the ELF hash for symbols. */ - if (IRIX_COMPAT (abfd) == ict_irix6 - && !mips_elf_create_msym_section (abfd)) - return false; - - /* Create .stub section. */ - if (bfd_get_section_by_name (abfd, - MIPS_ELF_STUB_SECTION_NAME (abfd)) == NULL) - { - s = bfd_make_section (abfd, MIPS_ELF_STUB_SECTION_NAME (abfd)); - if (s == NULL - || ! bfd_set_section_flags (abfd, s, flags | SEC_CODE) - || ! bfd_set_section_alignment (abfd, s, - MIPS_ELF_LOG_FILE_ALIGN (abfd))) - return false; - } - - if (IRIX_COMPAT (abfd) == ict_irix5 - && !info->shared - && bfd_get_section_by_name (abfd, ".rld_map") == NULL) - { - s = bfd_make_section (abfd, ".rld_map"); - if (s == NULL - || ! bfd_set_section_flags (abfd, s, flags & ~SEC_READONLY) - || ! bfd_set_section_alignment (abfd, s, - MIPS_ELF_LOG_FILE_ALIGN (abfd))) - return false; - } - - /* On IRIX5, we adjust add some additional symbols and change the - alignments of several sections. There is no ABI documentation - indicating that this is necessary on IRIX6, nor any evidence that - the linker takes such action. */ - if (IRIX_COMPAT (abfd) == ict_irix5) - { - for (namep = mips_elf_dynsym_rtproc_names; *namep != NULL; namep++) - { - h = NULL; - if (! (_bfd_generic_link_add_one_symbol - (info, abfd, *namep, BSF_GLOBAL, bfd_und_section_ptr, - (bfd_vma) 0, (const char *) NULL, false, - get_elf_backend_data (abfd)->collect, - (struct bfd_link_hash_entry **) &h))) - return false; - h->elf_link_hash_flags &=~ ELF_LINK_NON_ELF; - h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; - h->type = STT_SECTION; - - if (! bfd_elf32_link_record_dynamic_symbol (info, h)) - return false; - } - - /* We need to create a .compact_rel section. */ - if (! mips_elf_create_compact_rel_section (abfd, info)) - return false; - - /* Change aligments of some sections. */ - s = bfd_get_section_by_name (abfd, ".hash"); - if (s != NULL) - bfd_set_section_alignment (abfd, s, 4); - s = bfd_get_section_by_name (abfd, ".dynsym"); - if (s != NULL) - bfd_set_section_alignment (abfd, s, 4); - s = bfd_get_section_by_name (abfd, ".dynstr"); - if (s != NULL) - bfd_set_section_alignment (abfd, s, 4); - s = bfd_get_section_by_name (abfd, ".reginfo"); - if (s != NULL) - bfd_set_section_alignment (abfd, s, 4); - s = bfd_get_section_by_name (abfd, ".dynamic"); - if (s != NULL) - bfd_set_section_alignment (abfd, s, 4); - } - - if (!info->shared) - { - h = NULL; - if (! (_bfd_generic_link_add_one_symbol - (info, abfd, "_DYNAMIC_LINK", BSF_GLOBAL, bfd_abs_section_ptr, - (bfd_vma) 0, (const char *) NULL, false, - get_elf_backend_data (abfd)->collect, - (struct bfd_link_hash_entry **) &h))) - return false; - h->elf_link_hash_flags &=~ ELF_LINK_NON_ELF; - h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; - h->type = STT_SECTION; - - if (! bfd_elf32_link_record_dynamic_symbol (info, h)) - return false; - - if (! mips_elf_hash_table (info)->use_rld_obj_head) - { - /* __rld_map is a four byte word located in the .data section - and is filled in by the rtld to contain a pointer to - the _r_debug structure. Its symbol value will be set in - mips_elf_finish_dynamic_symbol. */ - s = bfd_get_section_by_name (abfd, ".rld_map"); - BFD_ASSERT (s != NULL); - - h = NULL; - if (! (_bfd_generic_link_add_one_symbol - (info, abfd, "__rld_map", BSF_GLOBAL, s, - (bfd_vma) 0, (const char *) NULL, false, - get_elf_backend_data (abfd)->collect, - (struct bfd_link_hash_entry **) &h))) - return false; - h->elf_link_hash_flags &=~ ELF_LINK_NON_ELF; - h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; - h->type = STT_OBJECT; - - if (! bfd_elf32_link_record_dynamic_symbol (info, h)) - return false; - } - } - - return true; -} - -/* Create the .compact_rel section. */ - -static boolean -mips_elf_create_compact_rel_section (abfd, info) - bfd *abfd; - struct bfd_link_info *info ATTRIBUTE_UNUSED; -{ - flagword flags; - register asection *s; - - if (bfd_get_section_by_name (abfd, ".compact_rel") == NULL) - { - flags = (SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_LINKER_CREATED - | SEC_READONLY); - - s = bfd_make_section (abfd, ".compact_rel"); - if (s == NULL - || ! bfd_set_section_flags (abfd, s, flags) - || ! bfd_set_section_alignment (abfd, s, - MIPS_ELF_LOG_FILE_ALIGN (abfd))) - return false; - - s->_raw_size = sizeof (Elf32_External_compact_rel); - } - - return true; -} - -/* Create the .got section to hold the global offset table. */ - -static boolean -mips_elf_create_got_section (abfd, info) - bfd *abfd; - struct bfd_link_info *info; -{ - flagword flags; - register asection *s; - struct elf_link_hash_entry *h; - struct mips_got_info *g; - - /* This function may be called more than once. */ - if (mips_elf_got_section (abfd)) - return true; - - flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY - | SEC_LINKER_CREATED); - - s = bfd_make_section (abfd, ".got"); - if (s == NULL - || ! bfd_set_section_flags (abfd, s, flags) - || ! bfd_set_section_alignment (abfd, s, 4)) - return false; - - /* Define the symbol _GLOBAL_OFFSET_TABLE_. We don't do this in the - linker script because we don't want to define the symbol if we - are not creating a global offset table. */ - h = NULL; - if (! (_bfd_generic_link_add_one_symbol - (info, abfd, "_GLOBAL_OFFSET_TABLE_", BSF_GLOBAL, s, - (bfd_vma) 0, (const char *) NULL, false, - get_elf_backend_data (abfd)->collect, - (struct bfd_link_hash_entry **) &h))) - return false; - h->elf_link_hash_flags &=~ ELF_LINK_NON_ELF; - h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; - h->type = STT_OBJECT; - - if (info->shared - && ! bfd_elf32_link_record_dynamic_symbol (info, h)) - return false; - - /* The first several global offset table entries are reserved. */ - s->_raw_size = MIPS_RESERVED_GOTNO * MIPS_ELF_GOT_SIZE (abfd); - - g = (struct mips_got_info *) bfd_alloc (abfd, - sizeof (struct mips_got_info)); - if (g == NULL) - return false; - g->global_gotsym = NULL; - g->local_gotno = MIPS_RESERVED_GOTNO; - g->assigned_gotno = MIPS_RESERVED_GOTNO; - if (elf_section_data (s) == NULL) - { - s->used_by_bfd = - (PTR) bfd_zalloc (abfd, sizeof (struct bfd_elf_section_data)); - if (elf_section_data (s) == NULL) - return false; - } - elf_section_data (s)->tdata = (PTR) g; - elf_section_data (s)->this_hdr.sh_flags - |= SHF_ALLOC | SHF_WRITE | SHF_MIPS_GPREL; - - return true; -} - -/* Returns the .msym section for ABFD, creating it if it does not - already exist. Returns NULL to indicate error. */ - -static asection * -mips_elf_create_msym_section (abfd) - bfd *abfd; -{ - asection *s; - - s = bfd_get_section_by_name (abfd, MIPS_ELF_MSYM_SECTION_NAME (abfd)); - if (!s) - { - s = bfd_make_section (abfd, MIPS_ELF_MSYM_SECTION_NAME (abfd)); - if (!s - || !bfd_set_section_flags (abfd, s, - SEC_ALLOC - | SEC_LOAD - | SEC_HAS_CONTENTS - | SEC_LINKER_CREATED - | SEC_READONLY) - || !bfd_set_section_alignment (abfd, s, - MIPS_ELF_LOG_FILE_ALIGN (abfd))) - return NULL; - } - - return s; -} - -/* Add room for N relocations to the .rel.dyn section in ABFD. */ - -static void -mips_elf_allocate_dynamic_relocations (abfd, n) - bfd *abfd; - unsigned int n; -{ - asection *s; - - s = bfd_get_section_by_name (abfd, MIPS_ELF_REL_DYN_SECTION_NAME (abfd)); - BFD_ASSERT (s != NULL); - - if (s->_raw_size == 0) - { - /* Make room for a null element. */ - s->_raw_size += MIPS_ELF_REL_SIZE (abfd); - ++s->reloc_count; - } - s->_raw_size += n * MIPS_ELF_REL_SIZE (abfd); -} - -/* Look through the relocs for a section during the first phase, and - allocate space in the global offset table. */ - -boolean -_bfd_mips_elf_check_relocs (abfd, info, sec, relocs) - bfd *abfd; - struct bfd_link_info *info; - asection *sec; - const Elf_Internal_Rela *relocs; -{ - const char *name; - bfd *dynobj; - Elf_Internal_Shdr *symtab_hdr; - struct elf_link_hash_entry **sym_hashes; - struct mips_got_info *g; - size_t extsymoff; - const Elf_Internal_Rela *rel; - const Elf_Internal_Rela *rel_end; - asection *sgot; - asection *sreloc; - struct elf_backend_data *bed; - - if (info->relocateable) - return true; - - dynobj = elf_hash_table (info)->dynobj; - symtab_hdr = &elf_tdata (abfd)->symtab_hdr; - sym_hashes = elf_sym_hashes (abfd); - extsymoff = (elf_bad_symtab (abfd)) ? 0 : symtab_hdr->sh_info; - - /* Check for the mips16 stub sections. */ - - name = bfd_get_section_name (abfd, sec); - if (strncmp (name, FN_STUB, sizeof FN_STUB - 1) == 0) - { - unsigned long r_symndx; - - /* Look at the relocation information to figure out which symbol - this is for. */ - - r_symndx = ELF32_R_SYM (relocs->r_info); - - if (r_symndx < extsymoff - || sym_hashes[r_symndx - extsymoff] == NULL) - { - asection *o; - - /* This stub is for a local symbol. This stub will only be - needed if there is some relocation in this BFD, other - than a 16 bit function call, which refers to this symbol. */ - for (o = abfd->sections; o != NULL; o = o->next) - { - Elf_Internal_Rela *sec_relocs; - const Elf_Internal_Rela *r, *rend; - - /* We can ignore stub sections when looking for relocs. */ - if ((o->flags & SEC_RELOC) == 0 - || o->reloc_count == 0 - || strncmp (bfd_get_section_name (abfd, o), FN_STUB, - sizeof FN_STUB - 1) == 0 - || strncmp (bfd_get_section_name (abfd, o), CALL_STUB, - sizeof CALL_STUB - 1) == 0 - || strncmp (bfd_get_section_name (abfd, o), CALL_FP_STUB, - sizeof CALL_FP_STUB - 1) == 0) - continue; - - sec_relocs = (_bfd_elf32_link_read_relocs - (abfd, o, (PTR) NULL, - (Elf_Internal_Rela *) NULL, - info->keep_memory)); - if (sec_relocs == NULL) - return false; - - rend = sec_relocs + o->reloc_count; - for (r = sec_relocs; r < rend; r++) - if (ELF32_R_SYM (r->r_info) == r_symndx - && ELF32_R_TYPE (r->r_info) != R_MIPS16_26) - break; - - if (! info->keep_memory) - free (sec_relocs); - - if (r < rend) - break; - } - - if (o == NULL) - { - /* There is no non-call reloc for this stub, so we do - not need it. Since this function is called before - the linker maps input sections to output sections, we - can easily discard it by setting the SEC_EXCLUDE - flag. */ - sec->flags |= SEC_EXCLUDE; - return true; - } - - /* Record this stub in an array of local symbol stubs for - this BFD. */ - if (elf_tdata (abfd)->local_stubs == NULL) - { - unsigned long symcount; - asection **n; - - if (elf_bad_symtab (abfd)) - symcount = symtab_hdr->sh_size / symtab_hdr->sh_entsize; - else - symcount = symtab_hdr->sh_info; - n = (asection **) bfd_zalloc (abfd, - symcount * sizeof (asection *)); - if (n == NULL) - return false; - elf_tdata (abfd)->local_stubs = n; - } - - elf_tdata (abfd)->local_stubs[r_symndx] = sec; - - /* We don't need to set mips16_stubs_seen in this case. - That flag is used to see whether we need to look through - the global symbol table for stubs. We don't need to set - it here, because we just have a local stub. */ - } - else - { - struct mips_elf_link_hash_entry *h; - - h = ((struct mips_elf_link_hash_entry *) - sym_hashes[r_symndx - extsymoff]); - - /* H is the symbol this stub is for. */ - - h->fn_stub = sec; - mips_elf_hash_table (info)->mips16_stubs_seen = true; - } - } - else if (strncmp (name, CALL_STUB, sizeof CALL_STUB - 1) == 0 - || strncmp (name, CALL_FP_STUB, sizeof CALL_FP_STUB - 1) == 0) - { - unsigned long r_symndx; - struct mips_elf_link_hash_entry *h; - asection **loc; - - /* Look at the relocation information to figure out which symbol - this is for. */ - - r_symndx = ELF32_R_SYM (relocs->r_info); - - if (r_symndx < extsymoff - || sym_hashes[r_symndx - extsymoff] == NULL) - { - /* This stub was actually built for a static symbol defined - in the same file. We assume that all static symbols in - mips16 code are themselves mips16, so we can simply - discard this stub. Since this function is called before - the linker maps input sections to output sections, we can - easily discard it by setting the SEC_EXCLUDE flag. */ - sec->flags |= SEC_EXCLUDE; - return true; - } - - h = ((struct mips_elf_link_hash_entry *) - sym_hashes[r_symndx - extsymoff]); - - /* H is the symbol this stub is for. */ - - if (strncmp (name, CALL_FP_STUB, sizeof CALL_FP_STUB - 1) == 0) - loc = &h->call_fp_stub; - else - loc = &h->call_stub; - - /* If we already have an appropriate stub for this function, we - don't need another one, so we can discard this one. Since - this function is called before the linker maps input sections - to output sections, we can easily discard it by setting the - SEC_EXCLUDE flag. We can also discard this section if we - happen to already know that this is a mips16 function; it is - not necessary to check this here, as it is checked later, but - it is slightly faster to check now. */ - if (*loc != NULL || h->root.other == STO_MIPS16) - { - sec->flags |= SEC_EXCLUDE; - return true; - } - - *loc = sec; - mips_elf_hash_table (info)->mips16_stubs_seen = true; - } - - if (dynobj == NULL) - { - sgot = NULL; - g = NULL; - } - else - { - sgot = mips_elf_got_section (dynobj); - if (sgot == NULL) - g = NULL; - else - { - BFD_ASSERT (elf_section_data (sgot) != NULL); - g = (struct mips_got_info *) elf_section_data (sgot)->tdata; - BFD_ASSERT (g != NULL); - } - } - - sreloc = NULL; - bed = get_elf_backend_data (abfd); - rel_end = relocs + sec->reloc_count * bed->s->int_rels_per_ext_rel; - for (rel = relocs; rel < rel_end; ++rel) - { - unsigned long r_symndx; - int r_type; - struct elf_link_hash_entry *h; - - r_symndx = ELF32_R_SYM (rel->r_info); - r_type = ELF32_R_TYPE (rel->r_info); - - if (r_symndx < extsymoff) - h = NULL; - else - { - h = sym_hashes[r_symndx - extsymoff]; - - /* This may be an indirect symbol created because of a version. */ - if (h != NULL) - { - while (h->root.type == bfd_link_hash_indirect) - h = (struct elf_link_hash_entry *) h->root.u.i.link; - } - } - - /* Some relocs require a global offset table. */ - if (dynobj == NULL || sgot == NULL) - { - switch (r_type) - { - case R_MIPS_GOT16: - case R_MIPS_CALL16: - case R_MIPS_CALL_HI16: - case R_MIPS_CALL_LO16: - case R_MIPS_GOT_HI16: - case R_MIPS_GOT_LO16: - case R_MIPS_GOT_PAGE: - case R_MIPS_GOT_OFST: - case R_MIPS_GOT_DISP: - if (dynobj == NULL) - elf_hash_table (info)->dynobj = dynobj = abfd; - if (! mips_elf_create_got_section (dynobj, info)) - return false; - g = mips_elf_got_info (dynobj, &sgot); - break; - - case R_MIPS_32: - case R_MIPS_REL32: - case R_MIPS_64: - if (dynobj == NULL - && (info->shared || h != NULL) - && (sec->flags & SEC_ALLOC) != 0) - elf_hash_table (info)->dynobj = dynobj = abfd; - break; - - default: - break; - } - } - - if (!h && (r_type == R_MIPS_CALL_LO16 - || r_type == R_MIPS_GOT_LO16 - || r_type == R_MIPS_GOT_DISP)) - { - /* We may need a local GOT entry for this relocation. We - don't count R_MIPS_GOT_PAGE because we can estimate the - maximum number of pages needed by looking at the size of - the segment. Similar comments apply to R_MIPS_GOT16. We - don't count R_MIPS_GOT_HI16, or R_MIPS_CALL_HI16 because - these are always followed by an R_MIPS_GOT_LO16 or - R_MIPS_CALL_LO16. - - This estimation is very conservative since we can merge - duplicate entries in the GOT. In order to be less - conservative, we could actually build the GOT here, - rather than in relocate_section. */ - g->local_gotno++; - sgot->_raw_size += MIPS_ELF_GOT_SIZE (dynobj); - } - - switch (r_type) - { - case R_MIPS_CALL16: - if (h == NULL) - { - (*_bfd_error_handler) - (_("%s: CALL16 reloc at 0x%lx not against global symbol"), - bfd_get_filename (abfd), (unsigned long) rel->r_offset); - bfd_set_error (bfd_error_bad_value); - return false; - } - /* Fall through. */ - - case R_MIPS_CALL_HI16: - case R_MIPS_CALL_LO16: - if (h != NULL) - { - /* This symbol requires a global offset table entry. */ - if (!mips_elf_record_global_got_symbol (h, info, g)) - return false; - - /* We need a stub, not a plt entry for the undefined - function. But we record it as if it needs plt. See - elf_adjust_dynamic_symbol in elflink.h. */ - h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; - h->type = STT_FUNC; - } - break; - - case R_MIPS_GOT16: - case R_MIPS_GOT_HI16: - case R_MIPS_GOT_LO16: - case R_MIPS_GOT_DISP: - /* This symbol requires a global offset table entry. */ - if (h && !mips_elf_record_global_got_symbol (h, info, g)) - return false; - break; - - case R_MIPS_32: - case R_MIPS_REL32: - case R_MIPS_64: - if ((info->shared || h != NULL) - && (sec->flags & SEC_ALLOC) != 0) - { - if (sreloc == NULL) - { - const char *name = MIPS_ELF_REL_DYN_SECTION_NAME (dynobj); - - sreloc = bfd_get_section_by_name (dynobj, name); - if (sreloc == NULL) - { - sreloc = bfd_make_section (dynobj, name); - if (sreloc == NULL - || ! bfd_set_section_flags (dynobj, sreloc, - (SEC_ALLOC - | SEC_LOAD - | SEC_HAS_CONTENTS - | SEC_IN_MEMORY - | SEC_LINKER_CREATED - | SEC_READONLY)) - || ! bfd_set_section_alignment (dynobj, sreloc, - 4)) - return false; - } - } - if (info->shared) - /* When creating a shared object, we must copy these - reloc types into the output file as R_MIPS_REL32 - relocs. We make room for this reloc in the - .rel.dyn reloc section. */ - mips_elf_allocate_dynamic_relocations (dynobj, 1); - else - { - struct mips_elf_link_hash_entry *hmips; - - /* We only need to copy this reloc if the symbol is - defined in a dynamic object. */ - hmips = (struct mips_elf_link_hash_entry *) h; - ++hmips->possibly_dynamic_relocs; - } - - /* Even though we don't directly need a GOT entry for - this symbol, a symbol must have a dynamic symbol - table index greater that DT_MIPS_GOTSYM if there are - dynamic relocations against it. */ - if (h != NULL - && !mips_elf_record_global_got_symbol (h, info, g)) - return false; - } - - if (SGI_COMPAT (dynobj)) - mips_elf_hash_table (info)->compact_rel_size += - sizeof (Elf32_External_crinfo); - break; - - case R_MIPS_26: - case R_MIPS_GPREL16: - case R_MIPS_LITERAL: - case R_MIPS_GPREL32: - if (SGI_COMPAT (dynobj)) - mips_elf_hash_table (info)->compact_rel_size += - sizeof (Elf32_External_crinfo); - break; - - /* This relocation describes the C++ object vtable hierarchy. - Reconstruct it for later use during GC. */ - case R_MIPS_GNU_VTINHERIT: - if (!_bfd_elf32_gc_record_vtinherit (abfd, sec, h, rel->r_offset)) - return false; - break; - - /* This relocation describes which C++ vtable entries are actually - used. Record for later use during GC. */ - case R_MIPS_GNU_VTENTRY: - if (!_bfd_elf32_gc_record_vtentry (abfd, sec, h, rel->r_offset)) - return false; - break; - - default: - break; - } - - /* If this reloc is not a 16 bit call, and it has a global - symbol, then we will need the fn_stub if there is one. - References from a stub section do not count. */ - if (h != NULL - && r_type != R_MIPS16_26 - && strncmp (bfd_get_section_name (abfd, sec), FN_STUB, - sizeof FN_STUB - 1) != 0 - && strncmp (bfd_get_section_name (abfd, sec), CALL_STUB, - sizeof CALL_STUB - 1) != 0 - && strncmp (bfd_get_section_name (abfd, sec), CALL_FP_STUB, - sizeof CALL_FP_STUB - 1) != 0) - { - struct mips_elf_link_hash_entry *mh; - - mh = (struct mips_elf_link_hash_entry *) h; - mh->need_fn_stub = true; - } - } - - return true; -} - -/* Return the section that should be marked against GC for a given - relocation. */ - -asection * -_bfd_mips_elf_gc_mark_hook (abfd, info, rel, h, sym) - bfd *abfd; - struct bfd_link_info *info ATTRIBUTE_UNUSED; - Elf_Internal_Rela *rel; - struct elf_link_hash_entry *h; - Elf_Internal_Sym *sym; -{ - /* ??? Do mips16 stub sections need to be handled special? */ - - if (h != NULL) - { - switch (ELF32_R_TYPE (rel->r_info)) - { - case R_MIPS_GNU_VTINHERIT: - case R_MIPS_GNU_VTENTRY: - break; - - default: - switch (h->root.type) - { - case bfd_link_hash_defined: - case bfd_link_hash_defweak: - return h->root.u.def.section; - - case bfd_link_hash_common: - return h->root.u.c.p->section; - - default: - break; - } - } - } - else - { - if (!(elf_bad_symtab (abfd) - && ELF_ST_BIND (sym->st_info) != STB_LOCAL) - && ! ((sym->st_shndx <= 0 || sym->st_shndx >= SHN_LORESERVE) - && sym->st_shndx != SHN_COMMON)) - { - return bfd_section_from_elf_index (abfd, sym->st_shndx); - } - } - - return NULL; -} - -/* Update the got entry reference counts for the section being removed. */ - -boolean -_bfd_mips_elf_gc_sweep_hook (abfd, info, sec, relocs) - bfd *abfd ATTRIBUTE_UNUSED; - struct bfd_link_info *info ATTRIBUTE_UNUSED; - asection *sec ATTRIBUTE_UNUSED; - const Elf_Internal_Rela *relocs ATTRIBUTE_UNUSED; -{ -#if 0 - Elf_Internal_Shdr *symtab_hdr; - struct elf_link_hash_entry **sym_hashes; - bfd_signed_vma *local_got_refcounts; - const Elf_Internal_Rela *rel, *relend; - unsigned long r_symndx; - struct elf_link_hash_entry *h; - - symtab_hdr = &elf_tdata (abfd)->symtab_hdr; - sym_hashes = elf_sym_hashes (abfd); - local_got_refcounts = elf_local_got_refcounts (abfd); - - relend = relocs + sec->reloc_count; - for (rel = relocs; rel < relend; rel++) - switch (ELF32_R_TYPE (rel->r_info)) - { - case R_MIPS_GOT16: - case R_MIPS_CALL16: - case R_MIPS_CALL_HI16: - case R_MIPS_CALL_LO16: - case R_MIPS_GOT_HI16: - case R_MIPS_GOT_LO16: - /* ??? It would seem that the existing MIPS code does no sort - of reference counting or whatnot on its GOT and PLT entries, - so it is not possible to garbage collect them at this time. */ - break; - - default: - break; - } -#endif - - return true; -} - - -/* Adjust a symbol defined by a dynamic object and referenced by a - regular object. The current definition is in some section of the - dynamic object, but we're not including those sections. We have to - change the definition to something the rest of the link can - understand. */ - -boolean -_bfd_mips_elf_adjust_dynamic_symbol (info, h) - struct bfd_link_info *info; - struct elf_link_hash_entry *h; -{ - bfd *dynobj; - struct mips_elf_link_hash_entry *hmips; - asection *s; - - dynobj = elf_hash_table (info)->dynobj; - - /* Make sure we know what is going on here. */ - BFD_ASSERT (dynobj != NULL - && ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) - || h->weakdef != NULL - || ((h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_DYNAMIC) != 0 - && (h->elf_link_hash_flags - & ELF_LINK_HASH_REF_REGULAR) != 0 - && (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0))); - - /* If this symbol is defined in a dynamic object, we need to copy - any R_MIPS_32 or R_MIPS_REL32 relocs against it into the output - file. */ - hmips = (struct mips_elf_link_hash_entry *) h; - if (! info->relocateable - && hmips->possibly_dynamic_relocs != 0 - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) - mips_elf_allocate_dynamic_relocations (dynobj, - hmips->possibly_dynamic_relocs); - - /* For a function, create a stub, if needed. */ - if (h->type == STT_FUNC - || (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0) - { - if (! elf_hash_table (info)->dynamic_sections_created) - return true; - - /* If this symbol is not defined in a regular file, then set - the symbol to the stub location. This is required to make - function pointers compare as equal between the normal - executable and the shared library. */ - if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) - { - /* We need .stub section. */ - s = bfd_get_section_by_name (dynobj, - MIPS_ELF_STUB_SECTION_NAME (dynobj)); - BFD_ASSERT (s != NULL); - - h->root.u.def.section = s; - h->root.u.def.value = s->_raw_size; - - /* XXX Write this stub address somewhere. */ - h->plt.offset = s->_raw_size; - - /* Make room for this stub code. */ - s->_raw_size += MIPS_FUNCTION_STUB_SIZE; - - /* The last half word of the stub will be filled with the index - of this symbol in .dynsym section. */ - return true; - } - } - - /* If this is a weak symbol, and there is a real definition, the - processor independent code will have arranged for us to see the - real definition first, and we can just use the same value. */ - if (h->weakdef != NULL) - { - BFD_ASSERT (h->weakdef->root.type == bfd_link_hash_defined - || h->weakdef->root.type == bfd_link_hash_defweak); - h->root.u.def.section = h->weakdef->root.u.def.section; - h->root.u.def.value = h->weakdef->root.u.def.value; - return true; - } - - /* This is a reference to a symbol defined by a dynamic object which - is not a function. */ - - return true; -} - -/* This function is called after all the input files have been read, - and the input sections have been assigned to output sections. We - check for any mips16 stub sections that we can discard. */ - -static boolean mips_elf_check_mips16_stubs - PARAMS ((struct mips_elf_link_hash_entry *, PTR)); - -boolean -_bfd_mips_elf_always_size_sections (output_bfd, info) - bfd *output_bfd; - struct bfd_link_info *info; -{ - asection *ri; - - /* The .reginfo section has a fixed size. */ - ri = bfd_get_section_by_name (output_bfd, ".reginfo"); - if (ri != NULL) - bfd_set_section_size (output_bfd, ri, sizeof (Elf32_External_RegInfo)); - - if (info->relocateable - || ! mips_elf_hash_table (info)->mips16_stubs_seen) - return true; - - mips_elf_link_hash_traverse (mips_elf_hash_table (info), - mips_elf_check_mips16_stubs, - (PTR) NULL); - - return true; -} - -/* Check the mips16 stubs for a particular symbol, and see if we can - discard them. */ - -/*ARGSUSED*/ -static boolean -mips_elf_check_mips16_stubs (h, data) - struct mips_elf_link_hash_entry *h; - PTR data ATTRIBUTE_UNUSED; -{ - if (h->fn_stub != NULL - && ! h->need_fn_stub) - { - /* We don't need the fn_stub; the only references to this symbol - are 16 bit calls. Clobber the size to 0 to prevent it from - being included in the link. */ - h->fn_stub->_raw_size = 0; - h->fn_stub->_cooked_size = 0; - h->fn_stub->flags &= ~ SEC_RELOC; - h->fn_stub->reloc_count = 0; - h->fn_stub->flags |= SEC_EXCLUDE; - } - - if (h->call_stub != NULL - && h->root.other == STO_MIPS16) - { - /* We don't need the call_stub; this is a 16 bit function, so - calls from other 16 bit functions are OK. Clobber the size - to 0 to prevent it from being included in the link. */ - h->call_stub->_raw_size = 0; - h->call_stub->_cooked_size = 0; - h->call_stub->flags &= ~ SEC_RELOC; - h->call_stub->reloc_count = 0; - h->call_stub->flags |= SEC_EXCLUDE; - } - - if (h->call_fp_stub != NULL - && h->root.other == STO_MIPS16) - { - /* We don't need the call_stub; this is a 16 bit function, so - calls from other 16 bit functions are OK. Clobber the size - to 0 to prevent it from being included in the link. */ - h->call_fp_stub->_raw_size = 0; - h->call_fp_stub->_cooked_size = 0; - h->call_fp_stub->flags &= ~ SEC_RELOC; - h->call_fp_stub->reloc_count = 0; - h->call_fp_stub->flags |= SEC_EXCLUDE; - } - - return true; -} - -/* Set the sizes of the dynamic sections. */ - -boolean -_bfd_mips_elf_size_dynamic_sections (output_bfd, info) - bfd *output_bfd; - struct bfd_link_info *info; -{ - bfd *dynobj; - asection *s; - boolean reltext; - struct mips_got_info *g = NULL; - - dynobj = elf_hash_table (info)->dynobj; - BFD_ASSERT (dynobj != NULL); - - if (elf_hash_table (info)->dynamic_sections_created) - { - /* Set the contents of the .interp section to the interpreter. */ - if (! info->shared) - { - s = bfd_get_section_by_name (dynobj, ".interp"); - BFD_ASSERT (s != NULL); - s->_raw_size - = strlen (ELF_DYNAMIC_INTERPRETER (output_bfd)) + 1; - s->contents - = (bfd_byte *) ELF_DYNAMIC_INTERPRETER (output_bfd); - } - } - - /* The check_relocs and adjust_dynamic_symbol entry points have - determined the sizes of the various dynamic sections. Allocate - memory for them. */ - reltext = false; - for (s = dynobj->sections; s != NULL; s = s->next) - { - const char *name; - boolean strip; - - /* It's OK to base decisions on the section name, because none - of the dynobj section names depend upon the input files. */ - name = bfd_get_section_name (dynobj, s); - - if ((s->flags & SEC_LINKER_CREATED) == 0) - continue; - - strip = false; - - if (strncmp (name, ".rel", 4) == 0) - { - if (s->_raw_size == 0) - { - /* We only strip the section if the output section name - has the same name. Otherwise, there might be several - input sections for this output section. FIXME: This - code is probably not needed these days anyhow, since - the linker now does not create empty output sections. */ - if (s->output_section != NULL - && strcmp (name, - bfd_get_section_name (s->output_section->owner, - s->output_section)) == 0) - strip = true; - } - else - { - const char *outname; - asection *target; - - /* If this relocation section applies to a read only - section, then we probably need a DT_TEXTREL entry. - If the relocation section is .rel.dyn, we always - assert a DT_TEXTREL entry rather than testing whether - there exists a relocation to a read only section or - not. */ - outname = bfd_get_section_name (output_bfd, - s->output_section); - target = bfd_get_section_by_name (output_bfd, outname + 4); - if ((target != NULL - && (target->flags & SEC_READONLY) != 0 - && (target->flags & SEC_ALLOC) != 0) - || strcmp (outname, - MIPS_ELF_REL_DYN_SECTION_NAME (output_bfd)) == 0) - reltext = true; - - /* We use the reloc_count field as a counter if we need - to copy relocs into the output file. */ - if (strcmp (name, - MIPS_ELF_REL_DYN_SECTION_NAME (output_bfd)) != 0) - s->reloc_count = 0; - } - } - else if (strncmp (name, ".got", 4) == 0) - { - int i; - bfd_size_type loadable_size = 0; - bfd_size_type local_gotno; - struct _bfd *sub; - - BFD_ASSERT (elf_section_data (s) != NULL); - g = (struct mips_got_info *) elf_section_data (s)->tdata; - BFD_ASSERT (g != NULL); - - /* Calculate the total loadable size of the output. That - will give us the maximum number of GOT_PAGE entries - required. */ - for (sub = info->input_bfds; sub; sub = sub->link_next) - { - asection *subsection; - - for (subsection = sub->sections; - subsection; - subsection = subsection->next) - { - if ((subsection->flags & SEC_ALLOC) == 0) - continue; - loadable_size += (subsection->_raw_size + 0xf) & ~0xf; - } - } - loadable_size += MIPS_FUNCTION_STUB_SIZE; - - /* Assume there are two loadable segments consisting of - contiguous sections. Is 5 enough? */ - local_gotno = (loadable_size >> 16) + 5; - if (IRIX_COMPAT (output_bfd) == ict_irix6) - /* It's possible we will need GOT_PAGE entries as well as - GOT16 entries. Often, these will be able to share GOT - entries, but not always. */ - local_gotno *= 2; - - g->local_gotno += local_gotno; - s->_raw_size += local_gotno * MIPS_ELF_GOT_SIZE (dynobj); - - /* There has to be a global GOT entry for every symbol with - a dynamic symbol table index of DT_MIPS_GOTSYM or - higher. Therefore, it make sense to put those symbols - that need GOT entries at the end of the symbol table. We - do that here. */ - if (!mips_elf_sort_hash_table (info, 1)) - return false; - - if (g->global_gotsym != NULL) - i = elf_hash_table (info)->dynsymcount - g->global_gotsym->dynindx; - else - /* If there are no global symbols, or none requiring - relocations, then GLOBAL_GOTSYM will be NULL. */ - i = 0; - g->global_gotno = i; - s->_raw_size += i * MIPS_ELF_GOT_SIZE (dynobj); - } - else if (strcmp (name, MIPS_ELF_STUB_SECTION_NAME (output_bfd)) == 0) - { - /* Irix rld assumes that the function stub isn't at the end - of .text section. So put a dummy. XXX */ - s->_raw_size += MIPS_FUNCTION_STUB_SIZE; - } - else if (! info->shared - && ! mips_elf_hash_table (info)->use_rld_obj_head - && strncmp (name, ".rld_map", 8) == 0) - { - /* We add a room for __rld_map. It will be filled in by the - rtld to contain a pointer to the _r_debug structure. */ - s->_raw_size += 4; - } - else if (SGI_COMPAT (output_bfd) - && strncmp (name, ".compact_rel", 12) == 0) - s->_raw_size += mips_elf_hash_table (info)->compact_rel_size; - else if (strcmp (name, MIPS_ELF_MSYM_SECTION_NAME (output_bfd)) - == 0) - s->_raw_size = (sizeof (Elf32_External_Msym) - * (elf_hash_table (info)->dynsymcount - + bfd_count_sections (output_bfd))); - else if (strncmp (name, ".init", 5) != 0) - { - /* It's not one of our sections, so don't allocate space. */ - continue; - } - - if (strip) - { - _bfd_strip_section_from_output (info, s); - continue; - } - - /* Allocate memory for the section contents. */ - s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->_raw_size); - if (s->contents == NULL && s->_raw_size != 0) - { - bfd_set_error (bfd_error_no_memory); - return false; - } - } - - if (elf_hash_table (info)->dynamic_sections_created) - { - /* Add some entries to the .dynamic section. We fill in the - values later, in elf_mips_finish_dynamic_sections, but we - must add the entries now so that we get the correct size for - the .dynamic section. The DT_DEBUG entry is filled in by the - dynamic linker and used by the debugger. */ - if (! info->shared) - { - if (SGI_COMPAT (output_bfd)) - { - /* SGI object has the equivalence of DT_DEBUG in the - DT_MIPS_RLD_MAP entry. */ - if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_RLD_MAP, 0)) - return false; - } - else - if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_DEBUG, 0)) - return false; - } - - if (reltext) - { - if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_TEXTREL, 0)) - return false; - } - - if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_PLTGOT, 0)) - return false; - - if (bfd_get_section_by_name (dynobj, - MIPS_ELF_REL_DYN_SECTION_NAME (dynobj))) - { - if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_REL, 0)) - return false; - - if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_RELSZ, 0)) - return false; - - if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_RELENT, 0)) - return false; - } - - if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_CONFLICTNO, 0)) - return false; - - if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_LIBLISTNO, 0)) - return false; - - if (bfd_get_section_by_name (dynobj, ".conflict") != NULL) - { - if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_CONFLICT, 0)) - return false; - - s = bfd_get_section_by_name (dynobj, ".liblist"); - BFD_ASSERT (s != NULL); - - if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_LIBLIST, 0)) - return false; - } - - if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_RLD_VERSION, 0)) - return false; - - if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_FLAGS, 0)) - return false; - -#if 0 - /* Time stamps in executable files are a bad idea. */ - if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_TIME_STAMP, 0)) - return false; -#endif - -#if 0 /* FIXME */ - if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_ICHECKSUM, 0)) - return false; -#endif - -#if 0 /* FIXME */ - if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_IVERSION, 0)) - return false; -#endif - - if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_BASE_ADDRESS, 0)) - return false; - - if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_LOCAL_GOTNO, 0)) - return false; - - if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_SYMTABNO, 0)) - return false; - - if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_UNREFEXTNO, 0)) - return false; - - if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_GOTSYM, 0)) - return false; - - if (IRIX_COMPAT (dynobj) == ict_irix5 - && ! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_HIPAGENO, 0)) - return false; - - if (IRIX_COMPAT (dynobj) == ict_irix6 - && (bfd_get_section_by_name - (dynobj, MIPS_ELF_OPTIONS_SECTION_NAME (dynobj))) - && !MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_OPTIONS, 0)) - return false; - - if (bfd_get_section_by_name (dynobj, - MIPS_ELF_MSYM_SECTION_NAME (dynobj)) - && !MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_MSYM, 0)) - return false; - } - - return true; -} - -/* If NAME is one of the special IRIX6 symbols defined by the linker, - adjust it appropriately now. */ - -static void -mips_elf_irix6_finish_dynamic_symbol (abfd, name, sym) - bfd *abfd ATTRIBUTE_UNUSED; - const char *name; - Elf_Internal_Sym *sym; -{ - /* The linker script takes care of providing names and values for - these, but we must place them into the right sections. */ - static const char* const text_section_symbols[] = { - "_ftext", - "_etext", - "__dso_displacement", - "__elf_header", - "__program_header_table", - NULL - }; - - static const char* const data_section_symbols[] = { - "_fdata", - "_edata", - "_end", - "_fbss", - NULL - }; - - const char* const *p; - int i; - - for (i = 0; i < 2; ++i) - for (p = (i == 0) ? text_section_symbols : data_section_symbols; - *p; - ++p) - if (strcmp (*p, name) == 0) - { - /* All of these symbols are given type STT_SECTION by the - IRIX6 linker. */ - sym->st_info = ELF_ST_INFO (STB_GLOBAL, STT_SECTION); - - /* The IRIX linker puts these symbols in special sections. */ - if (i == 0) - sym->st_shndx = SHN_MIPS_TEXT; - else - sym->st_shndx = SHN_MIPS_DATA; - - break; - } -} - -/* Finish up dynamic symbol handling. We set the contents of various - dynamic sections here. */ - -boolean -_bfd_mips_elf_finish_dynamic_symbol (output_bfd, info, h, sym) - bfd *output_bfd; - struct bfd_link_info *info; - struct elf_link_hash_entry *h; - Elf_Internal_Sym *sym; -{ - bfd *dynobj; - bfd_vma gval; - asection *sgot; - asection *smsym; - struct mips_got_info *g; - const char *name; - struct mips_elf_link_hash_entry *mh; - - dynobj = elf_hash_table (info)->dynobj; - gval = sym->st_value; - mh = (struct mips_elf_link_hash_entry *) h; - - if (h->plt.offset != (bfd_vma) -1) - { - asection *s; - bfd_byte *p; - bfd_byte stub[MIPS_FUNCTION_STUB_SIZE]; - - /* This symbol has a stub. Set it up. */ - - BFD_ASSERT (h->dynindx != -1); - - s = bfd_get_section_by_name (dynobj, - MIPS_ELF_STUB_SECTION_NAME (dynobj)); - BFD_ASSERT (s != NULL); - - /* Fill the stub. */ - p = stub; - bfd_put_32 (output_bfd, STUB_LW(output_bfd), p); - p += 4; - bfd_put_32 (output_bfd, STUB_MOVE, p); - p += 4; - - /* FIXME: Can h->dynindex be more than 64K? */ - if (h->dynindx & 0xffff0000) - return false; - - bfd_put_32 (output_bfd, STUB_JALR, p); - p += 4; - bfd_put_32 (output_bfd, STUB_LI16 + h->dynindx, p); - - BFD_ASSERT (h->plt.offset <= s->_raw_size); - memcpy (s->contents + h->plt.offset, stub, MIPS_FUNCTION_STUB_SIZE); - - /* Mark the symbol as undefined. plt.offset != -1 occurs - only for the referenced symbol. */ - sym->st_shndx = SHN_UNDEF; - - /* The run-time linker uses the st_value field of the symbol - to reset the global offset table entry for this external - to its stub address when unlinking a shared object. */ - gval = s->output_section->vma + s->output_offset + h->plt.offset; - sym->st_value = gval; - } - - BFD_ASSERT (h->dynindx != -1); - - sgot = mips_elf_got_section (dynobj); - BFD_ASSERT (sgot != NULL); - BFD_ASSERT (elf_section_data (sgot) != NULL); - g = (struct mips_got_info *) elf_section_data (sgot)->tdata; - BFD_ASSERT (g != NULL); - - /* Run through the global symbol table, creating GOT entries for all - the symbols that need them. */ - if (g->global_gotsym != NULL - && h->dynindx >= g->global_gotsym->dynindx) - { - bfd_vma offset; - bfd_vma value; - - if (sym->st_value) - value = sym->st_value; - else - /* For an entity defined in a shared object, this will be - NULL. (For functions in shared objects for - which we have created stubs, ST_VALUE will be non-NULL. - That's because such the functions are now no longer defined - in a shared object.) */ - value = h->root.u.def.value; - - offset = mips_elf_global_got_index (dynobj, h); - MIPS_ELF_PUT_WORD (output_bfd, value, sgot->contents + offset); - } - - /* Create a .msym entry, if appropriate. */ - smsym = bfd_get_section_by_name (dynobj, - MIPS_ELF_MSYM_SECTION_NAME (dynobj)); - if (smsym) - { - Elf32_Internal_Msym msym; - - msym.ms_hash_value = bfd_elf_hash (h->root.root.string); - /* It is undocumented what the `1' indicates, but IRIX6 uses - this value. */ - msym.ms_info = ELF32_MS_INFO (mh->min_dyn_reloc_index, 1); - bfd_mips_elf_swap_msym_out - (dynobj, &msym, - ((Elf32_External_Msym *) smsym->contents) + h->dynindx); - } - - /* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */ - name = h->root.root.string; - if (strcmp (name, "_DYNAMIC") == 0 - || strcmp (name, "_GLOBAL_OFFSET_TABLE_") == 0) - sym->st_shndx = SHN_ABS; - else if (strcmp (name, "_DYNAMIC_LINK") == 0) - { - sym->st_shndx = SHN_ABS; - sym->st_info = ELF_ST_INFO (STB_GLOBAL, STT_SECTION); - sym->st_value = 1; - } - else if (SGI_COMPAT (output_bfd)) - { - if (strcmp (name, "_gp_disp") == 0) - { - sym->st_shndx = SHN_ABS; - sym->st_info = ELF_ST_INFO (STB_GLOBAL, STT_SECTION); - sym->st_value = elf_gp (output_bfd); - } - else if (strcmp (name, mips_elf_dynsym_rtproc_names[0]) == 0 - || strcmp (name, mips_elf_dynsym_rtproc_names[1]) == 0) - { - sym->st_info = ELF_ST_INFO (STB_GLOBAL, STT_SECTION); - sym->st_other = STO_PROTECTED; - sym->st_value = 0; - sym->st_shndx = SHN_MIPS_DATA; - } - else if (strcmp (name, mips_elf_dynsym_rtproc_names[2]) == 0) - { - sym->st_info = ELF_ST_INFO (STB_GLOBAL, STT_SECTION); - sym->st_other = STO_PROTECTED; - sym->st_value = mips_elf_hash_table (info)->procedure_count; - sym->st_shndx = SHN_ABS; - } - else if (sym->st_shndx != SHN_UNDEF && sym->st_shndx != SHN_ABS) - { - if (h->type == STT_FUNC) - sym->st_shndx = SHN_MIPS_TEXT; - else if (h->type == STT_OBJECT) - sym->st_shndx = SHN_MIPS_DATA; - } - } - - /* Handle the IRIX6-specific symbols. */ - if (IRIX_COMPAT (output_bfd) == ict_irix6) - mips_elf_irix6_finish_dynamic_symbol (output_bfd, name, sym); - - if (SGI_COMPAT (output_bfd) - && ! info->shared) - { - if (! mips_elf_hash_table (info)->use_rld_obj_head - && strcmp (name, "__rld_map") == 0) - { - asection *s = bfd_get_section_by_name (dynobj, ".rld_map"); - BFD_ASSERT (s != NULL); - sym->st_value = s->output_section->vma + s->output_offset; - bfd_put_32 (output_bfd, (bfd_vma) 0, s->contents); - if (mips_elf_hash_table (info)->rld_value == 0) - mips_elf_hash_table (info)->rld_value = sym->st_value; - } - else if (mips_elf_hash_table (info)->use_rld_obj_head - && strcmp (name, "__rld_obj_head") == 0) - { - /* IRIX6 does not use a .rld_map section. */ - if (IRIX_COMPAT (output_bfd) == ict_irix5) - BFD_ASSERT (bfd_get_section_by_name (dynobj, ".rld_map") - != NULL); - mips_elf_hash_table (info)->rld_value = sym->st_value; - } - } - - /* If this is a mips16 symbol, force the value to be even. */ - if (sym->st_other == STO_MIPS16 - && (sym->st_value & 1) != 0) - --sym->st_value; - - return true; -} - -/* Finish up the dynamic sections. */ - -boolean -_bfd_mips_elf_finish_dynamic_sections (output_bfd, info) - bfd *output_bfd; - struct bfd_link_info *info; -{ - bfd *dynobj; - asection *sdyn; - asection *sgot; - struct mips_got_info *g; - - dynobj = elf_hash_table (info)->dynobj; - - sdyn = bfd_get_section_by_name (dynobj, ".dynamic"); - - sgot = mips_elf_got_section (dynobj); - if (sgot == NULL) - g = NULL; - else - { - BFD_ASSERT (elf_section_data (sgot) != NULL); - g = (struct mips_got_info *) elf_section_data (sgot)->tdata; - BFD_ASSERT (g != NULL); - } - - if (elf_hash_table (info)->dynamic_sections_created) - { - bfd_byte *b; - - BFD_ASSERT (sdyn != NULL); - BFD_ASSERT (g != NULL); - - for (b = sdyn->contents; - b < sdyn->contents + sdyn->_raw_size; - b += MIPS_ELF_DYN_SIZE (dynobj)) - { - Elf_Internal_Dyn dyn; - const char *name; - size_t elemsize; - asection *s; - boolean swap_out_p; - - /* Read in the current dynamic entry. */ - (*get_elf_backend_data (dynobj)->s->swap_dyn_in) (dynobj, b, &dyn); - - /* Assume that we're going to modify it and write it out. */ - swap_out_p = true; - - switch (dyn.d_tag) - { - case DT_RELENT: - s = (bfd_get_section_by_name - (dynobj, - MIPS_ELF_REL_DYN_SECTION_NAME (dynobj))); - BFD_ASSERT (s != NULL); - dyn.d_un.d_val = MIPS_ELF_REL_SIZE (dynobj); - break; - - case DT_STRSZ: - /* Rewrite DT_STRSZ. */ - dyn.d_un.d_val = - _bfd_stringtab_size (elf_hash_table (info)->dynstr); - break; - - case DT_PLTGOT: - name = ".got"; - goto get_vma; - case DT_MIPS_CONFLICT: - name = ".conflict"; - goto get_vma; - case DT_MIPS_LIBLIST: - name = ".liblist"; - get_vma: - s = bfd_get_section_by_name (output_bfd, name); - BFD_ASSERT (s != NULL); - dyn.d_un.d_ptr = s->vma; - break; - - case DT_MIPS_RLD_VERSION: - dyn.d_un.d_val = 1; /* XXX */ - break; - - case DT_MIPS_FLAGS: - dyn.d_un.d_val = RHF_NOTPOT; /* XXX */ - break; - - case DT_MIPS_CONFLICTNO: - name = ".conflict"; - elemsize = sizeof (Elf32_Conflict); - goto set_elemno; - - case DT_MIPS_LIBLISTNO: - name = ".liblist"; - elemsize = sizeof (Elf32_Lib); - set_elemno: - s = bfd_get_section_by_name (output_bfd, name); - if (s != NULL) - { - if (s->_cooked_size != 0) - dyn.d_un.d_val = s->_cooked_size / elemsize; - else - dyn.d_un.d_val = s->_raw_size / elemsize; - } - else - dyn.d_un.d_val = 0; - break; - - case DT_MIPS_TIME_STAMP: - time ((time_t *) &dyn.d_un.d_val); - break; - - case DT_MIPS_ICHECKSUM: - /* XXX FIXME: */ - swap_out_p = false; - break; - - case DT_MIPS_IVERSION: - /* XXX FIXME: */ - swap_out_p = false; - break; - - case DT_MIPS_BASE_ADDRESS: - s = output_bfd->sections; - BFD_ASSERT (s != NULL); - dyn.d_un.d_ptr = s->vma & ~(0xffff); - break; - - case DT_MIPS_LOCAL_GOTNO: - dyn.d_un.d_val = g->local_gotno; - break; - - case DT_MIPS_UNREFEXTNO: - /* The index into the dynamic symbol table which is the - entry of the first external symbol that is not - referenced within the same object. */ - dyn.d_un.d_val = bfd_count_sections (output_bfd) + 1; - break; - - case DT_MIPS_GOTSYM: - if (g->global_gotsym) - { - dyn.d_un.d_val = g->global_gotsym->dynindx; - break; - } - /* In case if we don't have global got symbols we default - to setting DT_MIPS_GOTSYM to the same value as - DT_MIPS_SYMTABNO, so we just fall through. */ - - case DT_MIPS_SYMTABNO: - name = ".dynsym"; - elemsize = MIPS_ELF_SYM_SIZE (output_bfd); - s = bfd_get_section_by_name (output_bfd, name); - BFD_ASSERT (s != NULL); - - if (s->_cooked_size != 0) - dyn.d_un.d_val = s->_cooked_size / elemsize; - else - dyn.d_un.d_val = s->_raw_size / elemsize; - break; - - case DT_MIPS_HIPAGENO: - dyn.d_un.d_val = g->local_gotno - MIPS_RESERVED_GOTNO; - break; - - case DT_MIPS_RLD_MAP: - dyn.d_un.d_ptr = mips_elf_hash_table (info)->rld_value; - break; - - case DT_MIPS_OPTIONS: - s = (bfd_get_section_by_name - (output_bfd, MIPS_ELF_OPTIONS_SECTION_NAME (output_bfd))); - dyn.d_un.d_ptr = s->vma; - break; - - case DT_MIPS_MSYM: - s = (bfd_get_section_by_name - (output_bfd, MIPS_ELF_MSYM_SECTION_NAME (output_bfd))); - dyn.d_un.d_ptr = s->vma; - break; - - default: - swap_out_p = false; - break; - } - - if (swap_out_p) - (*get_elf_backend_data (dynobj)->s->swap_dyn_out) - (dynobj, &dyn, b); - } - } - - /* The first entry of the global offset table will be filled at - runtime. The second entry will be used by some runtime loaders. - This isn't the case of Irix rld. */ - if (sgot != NULL && sgot->_raw_size > 0) - { - MIPS_ELF_PUT_WORD (output_bfd, (bfd_vma) 0, sgot->contents); - MIPS_ELF_PUT_WORD (output_bfd, (bfd_vma) 0x80000000, - sgot->contents + MIPS_ELF_GOT_SIZE (output_bfd)); - } - - if (sgot != NULL) - elf_section_data (sgot->output_section)->this_hdr.sh_entsize - = MIPS_ELF_GOT_SIZE (output_bfd); - - { - asection *smsym; - asection *s; - Elf32_compact_rel cpt; - - /* ??? The section symbols for the output sections were set up in - _bfd_elf_final_link. SGI sets the STT_NOTYPE attribute for these - symbols. Should we do so? */ - - smsym = bfd_get_section_by_name (dynobj, - MIPS_ELF_MSYM_SECTION_NAME (dynobj)); - if (smsym != NULL) - { - Elf32_Internal_Msym msym; - - msym.ms_hash_value = 0; - msym.ms_info = ELF32_MS_INFO (0, 1); - - for (s = output_bfd->sections; s != NULL; s = s->next) - { - long dynindx = elf_section_data (s)->dynindx; - - bfd_mips_elf_swap_msym_out - (output_bfd, &msym, - (((Elf32_External_Msym *) smsym->contents) - + dynindx)); - } - } - - if (SGI_COMPAT (output_bfd)) - { - /* Write .compact_rel section out. */ - s = bfd_get_section_by_name (dynobj, ".compact_rel"); - if (s != NULL) - { - cpt.id1 = 1; - cpt.num = s->reloc_count; - cpt.id2 = 2; - cpt.offset = (s->output_section->filepos - + sizeof (Elf32_External_compact_rel)); - cpt.reserved0 = 0; - cpt.reserved1 = 0; - bfd_elf32_swap_compact_rel_out (output_bfd, &cpt, - ((Elf32_External_compact_rel *) - s->contents)); - - /* Clean up a dummy stub function entry in .text. */ - s = bfd_get_section_by_name (dynobj, - MIPS_ELF_STUB_SECTION_NAME (dynobj)); - if (s != NULL) - { - file_ptr dummy_offset; - - BFD_ASSERT (s->_raw_size >= MIPS_FUNCTION_STUB_SIZE); - dummy_offset = s->_raw_size - MIPS_FUNCTION_STUB_SIZE; - memset (s->contents + dummy_offset, 0, - MIPS_FUNCTION_STUB_SIZE); - } - } - } - - /* Clean up a first relocation in .rel.dyn. */ - s = bfd_get_section_by_name (dynobj, - MIPS_ELF_REL_DYN_SECTION_NAME (dynobj)); - if (s != NULL && s->_raw_size > 0) - memset (s->contents, 0, MIPS_ELF_REL_SIZE (dynobj)); - } - - return true; -} - -/* This is almost identical to bfd_generic_get_... except that some - MIPS relocations need to be handled specially. Sigh. */ - -static bfd_byte * -elf32_mips_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 (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 mips */ - int gp_found; - bfd_vma gp = 0x12345678; /* initialize just to shut gcc up */ - - { - struct bfd_hash_entry *h; - struct bfd_link_hash_entry *lh; - /* Skip all this stuff if we aren't mixing formats. */ - if (abfd && input_bfd - && abfd->xvec == input_bfd->xvec) - lh = 0; - else - { - h = bfd_hash_lookup (&link_info->hash->table, "_gp", false, false); - lh = (struct bfd_link_hash_entry *) h; - } - lookup: - if (lh) - { - switch (lh->type) - { - case bfd_link_hash_undefined: - case bfd_link_hash_undefweak: - case bfd_link_hash_common: - gp_found = 0; - break; - case bfd_link_hash_defined: - case bfd_link_hash_defweak: - gp_found = 1; - gp = lh->u.def.value; - break; - case bfd_link_hash_indirect: - case bfd_link_hash_warning: - lh = lh->u.i.link; - /* @@FIXME ignoring warning for now */ - goto lookup; - case bfd_link_hash_new: - default: - abort (); - } - } - else - gp_found = 0; - } - /* end mips */ - for (parent = reloc_vector; *parent != (arelent *) NULL; - parent++) - { - char *error_message = (char *) NULL; - bfd_reloc_status_type r; - - /* Specific to MIPS: Deal with relocation types that require - knowing the gp of the output bfd. */ - asymbol *sym = *(*parent)->sym_ptr_ptr; - if (bfd_is_abs_section (sym->section) && abfd) - { - /* The special_function wouldn't get called anyways. */ - } - else if (!gp_found) - { - /* The gp isn't there; let the special function code - fall over on its own. */ - } - else if ((*parent)->howto->special_function - == _bfd_mips_elf_gprel16_reloc) - { - /* bypass special_function call */ - r = gprel16_with_gp (input_bfd, sym, *parent, input_section, - relocateable, (PTR) data, gp); - goto skip_bfd_perform_relocation; - } - /* end mips specific stuff */ - - r = bfd_perform_relocation (input_bfd, - *parent, - (PTR) data, - input_section, - relocateable ? abfd : (bfd *) NULL, - &error_message); - skip_bfd_perform_relocation: - - 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, - true))) - 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; -} -#define bfd_elf32_bfd_get_relocated_section_contents \ - elf32_mips_get_relocated_section_contents - -/* ECOFF swapping routines. These are used when dealing with the - .mdebug section, which is in the ECOFF debugging format. */ -static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap = -{ - /* Symbol table magic number. */ - magicSym, - /* Alignment of debugging information. E.g., 4. */ - 4, - /* Sizes of external symbolic information. */ - sizeof (struct hdr_ext), - sizeof (struct dnr_ext), - sizeof (struct pdr_ext), - sizeof (struct sym_ext), - sizeof (struct opt_ext), - sizeof (struct fdr_ext), - sizeof (struct rfd_ext), - sizeof (struct ext_ext), - /* Functions to swap in external symbolic data. */ - ecoff_swap_hdr_in, - ecoff_swap_dnr_in, - ecoff_swap_pdr_in, - ecoff_swap_sym_in, - ecoff_swap_opt_in, - ecoff_swap_fdr_in, - ecoff_swap_rfd_in, - ecoff_swap_ext_in, - _bfd_ecoff_swap_tir_in, - _bfd_ecoff_swap_rndx_in, - /* Functions to swap out external symbolic data. */ - ecoff_swap_hdr_out, - ecoff_swap_dnr_out, - ecoff_swap_pdr_out, - ecoff_swap_sym_out, - ecoff_swap_opt_out, - ecoff_swap_fdr_out, - ecoff_swap_rfd_out, - ecoff_swap_ext_out, - _bfd_ecoff_swap_tir_out, - _bfd_ecoff_swap_rndx_out, - /* Function to read in symbolic data. */ - _bfd_mips_elf_read_ecoff_info -}; - -#define TARGET_LITTLE_SYM bfd_elf32_littlemips_vec -#define TARGET_LITTLE_NAME "elf32-littlemips" -#define TARGET_BIG_SYM bfd_elf32_bigmips_vec -#define TARGET_BIG_NAME "elf32-bigmips" -#define ELF_ARCH bfd_arch_mips -#define ELF_MACHINE_CODE EM_MIPS - -/* The SVR4 MIPS ABI says that this should be 0x10000, but Irix 5 uses - a value of 0x1000, and we are compatible. */ -#define ELF_MAXPAGESIZE 0x1000 - -#define elf_backend_collect true -#define elf_backend_type_change_ok true -#define elf_backend_can_gc_sections true -#define elf_backend_sign_extend_vma true -#define elf_info_to_howto mips_info_to_howto_rela -#define elf_info_to_howto_rel mips_info_to_howto_rel -#define elf_backend_sym_is_global mips_elf_sym_is_global -#define elf_backend_object_p _bfd_mips_elf_object_p -#define elf_backend_section_from_shdr _bfd_mips_elf_section_from_shdr -#define elf_backend_fake_sections _bfd_mips_elf_fake_sections -#define elf_backend_section_from_bfd_section \ - _bfd_mips_elf_section_from_bfd_section -#define elf_backend_section_processing _bfd_mips_elf_section_processing -#define elf_backend_symbol_processing _bfd_mips_elf_symbol_processing -#define elf_backend_additional_program_headers \ - _bfd_mips_elf_additional_program_headers -#define elf_backend_modify_segment_map _bfd_mips_elf_modify_segment_map -#define elf_backend_final_write_processing \ - _bfd_mips_elf_final_write_processing -#define elf_backend_ecoff_debug_swap &mips_elf32_ecoff_debug_swap -#define elf_backend_add_symbol_hook _bfd_mips_elf_add_symbol_hook -#define elf_backend_create_dynamic_sections \ - _bfd_mips_elf_create_dynamic_sections -#define elf_backend_check_relocs _bfd_mips_elf_check_relocs -#define elf_backend_adjust_dynamic_symbol \ - _bfd_mips_elf_adjust_dynamic_symbol -#define elf_backend_always_size_sections \ - _bfd_mips_elf_always_size_sections -#define elf_backend_size_dynamic_sections \ - _bfd_mips_elf_size_dynamic_sections -#define elf_backend_relocate_section _bfd_mips_elf_relocate_section -#define elf_backend_link_output_symbol_hook \ - _bfd_mips_elf_link_output_symbol_hook -#define elf_backend_finish_dynamic_symbol \ - _bfd_mips_elf_finish_dynamic_symbol -#define elf_backend_finish_dynamic_sections \ - _bfd_mips_elf_finish_dynamic_sections -#define elf_backend_gc_mark_hook _bfd_mips_elf_gc_mark_hook -#define elf_backend_gc_sweep_hook _bfd_mips_elf_gc_sweep_hook - -#define elf_backend_got_header_size (4*MIPS_RESERVED_GOTNO) -#define elf_backend_plt_header_size 0 - -#define bfd_elf32_bfd_is_local_label_name \ - mips_elf_is_local_label_name -#define bfd_elf32_find_nearest_line _bfd_mips_elf_find_nearest_line -#define bfd_elf32_set_section_contents _bfd_mips_elf_set_section_contents -#define bfd_elf32_bfd_link_hash_table_create \ - _bfd_mips_elf_link_hash_table_create -#define bfd_elf32_bfd_final_link _bfd_mips_elf_final_link -#define bfd_elf32_bfd_copy_private_bfd_data \ - _bfd_mips_elf_copy_private_bfd_data -#define bfd_elf32_bfd_merge_private_bfd_data \ - _bfd_mips_elf_merge_private_bfd_data -#define bfd_elf32_bfd_set_private_flags _bfd_mips_elf_set_private_flags -#define bfd_elf32_bfd_print_private_bfd_data \ - _bfd_mips_elf_print_private_bfd_data -#include "elf32-target.h" diff --git a/contrib/binutils/bfd/elf32-sh.c b/contrib/binutils/bfd/elf32-sh.c deleted file mode 100644 index 71538036453e..000000000000 --- a/contrib/binutils/bfd/elf32-sh.c +++ /dev/null @@ -1,1909 +0,0 @@ -/* Hitachi SH specific support for 32-bit ELF - Copyright 1996, 1997, 1998 Free Software Foundation, Inc. - Contributed 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 "elf-bfd.h" - -static bfd_reloc_status_type sh_elf_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); -static bfd_reloc_status_type sh_elf_ignore_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); -static reloc_howto_type *sh_elf_reloc_type_lookup - PARAMS ((bfd *, bfd_reloc_code_real_type)); -static void sh_elf_info_to_howto - PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); -static boolean sh_elf_relax_section - PARAMS ((bfd *, asection *, struct bfd_link_info *, boolean *)); -static boolean sh_elf_relax_delete_bytes - PARAMS ((bfd *, asection *, bfd_vma, int)); -static boolean sh_elf_align_loads - PARAMS ((bfd *, asection *, Elf_Internal_Rela *, bfd_byte *, boolean *)); -static boolean sh_elf_swap_insns - PARAMS ((bfd *, asection *, PTR, bfd_byte *, bfd_vma)); -static boolean sh_elf_relocate_section - PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, - Elf_Internal_Rela *, Elf_Internal_Sym *, asection **)); -static bfd_byte *sh_elf_get_relocated_section_contents - PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, - bfd_byte *, boolean, asymbol **)); - -enum sh_reloc_type -{ - R_SH_NONE = 0, - R_SH_DIR32, - R_SH_REL32, - R_SH_DIR8WPN, - R_SH_IND12W, - R_SH_DIR8WPL, - R_SH_DIR8WPZ, - R_SH_DIR8BP, - R_SH_DIR8W, - R_SH_DIR8L, - FIRST_INVALID_RELOC, - LAST_INVALID_RELOC = 24, - /* The remaining relocs are a GNU extension used for relaxation. We - use the same constants as COFF uses, not that it really matters. */ - R_SH_SWITCH16 = 25, - R_SH_SWITCH32, - R_SH_USES, - R_SH_COUNT, - R_SH_ALIGN, - R_SH_CODE, - R_SH_DATA, - R_SH_LABEL, - R_SH_max -}; - -static reloc_howto_type sh_elf_howto_table[] = -{ - /* No relocation. */ - HOWTO (R_SH_NONE, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - sh_elf_reloc, /* special_function */ - "R_SH_NONE", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - false), /* pcrel_offset */ - - /* 32 bit absolute relocation. Setting partial_inplace to true and - src_mask to a non-zero value is similar to the COFF toolchain. */ - HOWTO (R_SH_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 */ - sh_elf_reloc, /* special_function */ - "R_SH_DIR32", /* name */ - true, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* 32 bit PC relative relocation. */ - HOWTO (R_SH_REL32, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - true, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - sh_elf_reloc, /* special_function */ - "R_SH_REL32", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0xffffffff, /* dst_mask */ - true), /* pcrel_offset */ - - /* 8 bit PC relative branch divided by 2. */ - HOWTO (R_SH_DIR8WPN, /* type */ - 1, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 8, /* bitsize */ - true, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - sh_elf_reloc, /* special_function */ - "R_SH_DIR8WPN", /* name */ - true, /* partial_inplace */ - 0xff, /* src_mask */ - 0xff, /* dst_mask */ - true), /* pcrel_offset */ - - /* 12 bit PC relative branch divided by 2. */ - HOWTO (R_SH_IND12W, /* type */ - 1, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 12, /* bitsize */ - true, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - sh_elf_reloc, /* special_function */ - "R_SH_IND12W", /* name */ - true, /* partial_inplace */ - 0xfff, /* src_mask */ - 0xfff, /* dst_mask */ - true), /* pcrel_offset */ - - /* 8 bit unsigned PC relative divided by 4. */ - HOWTO (R_SH_DIR8WPL, /* type */ - 2, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 8, /* bitsize */ - true, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_unsigned, /* complain_on_overflow */ - sh_elf_reloc, /* special_function */ - "R_SH_DIR8WPL", /* name */ - true, /* partial_inplace */ - 0xff, /* src_mask */ - 0xff, /* dst_mask */ - true), /* pcrel_offset */ - - /* 8 bit unsigned PC relative divided by 2. */ - HOWTO (R_SH_DIR8WPZ, /* type */ - 1, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 8, /* bitsize */ - true, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_unsigned, /* complain_on_overflow */ - sh_elf_reloc, /* special_function */ - "R_SH_DIR8WPZ", /* name */ - true, /* partial_inplace */ - 0xff, /* src_mask */ - 0xff, /* dst_mask */ - true), /* pcrel_offset */ - - /* 8 bit GBR relative. FIXME: This only makes sense if we have some - special symbol for the GBR relative area, and that is not - implemented. */ - HOWTO (R_SH_DIR8BP, /* type */ - 0, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 8, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_unsigned, /* complain_on_overflow */ - sh_elf_reloc, /* special_function */ - "R_SH_DIR8BP", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0xff, /* dst_mask */ - true), /* pcrel_offset */ - - /* 8 bit GBR relative divided by 2. FIXME: This only makes sense if - we have some special symbol for the GBR relative area, and that - is not implemented. */ - HOWTO (R_SH_DIR8W, /* type */ - 1, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 8, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_unsigned, /* complain_on_overflow */ - sh_elf_reloc, /* special_function */ - "R_SH_DIR8W", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0xff, /* dst_mask */ - true), /* pcrel_offset */ - - /* 8 bit GBR relative divided by 4. FIXME: This only makes sense if - we have some special symbol for the GBR relative area, and that - is not implemented. */ - HOWTO (R_SH_DIR8L, /* type */ - 2, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 8, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_unsigned, /* complain_on_overflow */ - sh_elf_reloc, /* special_function */ - "R_SH_DIR8L", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0xff, /* dst_mask */ - true), /* pcrel_offset */ - - { 10 }, - { 11 }, - { 12 }, - { 13 }, - { 14 }, - { 15 }, - { 16 }, - { 17 }, - { 18 }, - { 19 }, - { 20 }, - { 21 }, - { 22 }, - { 23 }, - { 24 }, - - /* The remaining relocs are a GNU extension used for relaxing. The - final pass of the linker never needs to do anything with any of - these relocs. Any required operations are handled by the - relaxation code. */ - - /* A 16 bit switch table entry. This is generated for an expression - such as ``.word L1 - L2''. The offset holds the difference - between the reloc address and L2. */ - HOWTO (R_SH_SWITCH16, /* type */ - 0, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_unsigned, /* complain_on_overflow */ - sh_elf_ignore_reloc, /* special_function */ - "R_SH_SWITCH16", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - true), /* pcrel_offset */ - - /* A 32 bit switch table entry. This is generated for an expression - such as ``.long L1 - L2''. The offset holds the difference - between the reloc address and L2. */ - HOWTO (R_SH_SWITCH32, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_unsigned, /* complain_on_overflow */ - sh_elf_ignore_reloc, /* special_function */ - "R_SH_SWITCH32", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - true), /* pcrel_offset */ - - /* Indicates a .uses pseudo-op. The compiler will generate .uses - pseudo-ops when it finds a function call which can be relaxed. - The offset field holds the PC relative offset to the instruction - which loads the register used in the function call. */ - HOWTO (R_SH_USES, /* type */ - 0, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_unsigned, /* complain_on_overflow */ - sh_elf_ignore_reloc, /* special_function */ - "R_SH_USES", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - true), /* pcrel_offset */ - - /* The assembler will generate this reloc for addresses referred to - by the register loads associated with USES relocs. The offset - field holds the number of times the address is referenced in the - object file. */ - HOWTO (R_SH_COUNT, /* type */ - 0, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_unsigned, /* complain_on_overflow */ - sh_elf_ignore_reloc, /* special_function */ - "R_SH_COUNT", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - true), /* pcrel_offset */ - - /* Indicates an alignment statement. The offset field is the power - of 2 to which subsequent portions of the object file must be - aligned. */ - HOWTO (R_SH_ALIGN, /* type */ - 0, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_unsigned, /* complain_on_overflow */ - sh_elf_ignore_reloc, /* special_function */ - "R_SH_ALIGN", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - true), /* pcrel_offset */ - - /* The assembler will generate this reloc before a block of - instructions. A section should be processed as assumining it - contains data, unless this reloc is seen. */ - HOWTO (R_SH_CODE, /* type */ - 0, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_unsigned, /* complain_on_overflow */ - sh_elf_ignore_reloc, /* special_function */ - "R_SH_CODE", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - true), /* pcrel_offset */ - - /* The assembler will generate this reloc after a block of - instructions when it sees data that is not instructions. */ - HOWTO (R_SH_DATA, /* type */ - 0, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_unsigned, /* complain_on_overflow */ - sh_elf_ignore_reloc, /* special_function */ - "R_SH_DATA", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - true), /* pcrel_offset */ - - /* The assembler generates this reloc for each label within a block - of instructions. This permits the linker to avoid swapping - instructions which are the targets of branches. */ - HOWTO (R_SH_LABEL, /* type */ - 0, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_unsigned, /* complain_on_overflow */ - sh_elf_ignore_reloc, /* special_function */ - "R_SH_LABEL", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - true) /* pcrel_offset */ -}; - -/* This function is used for normal relocs. This is like the COFF - function, and is almost certainly incorrect for other ELF targets. */ - -static bfd_reloc_status_type -sh_elf_reloc (abfd, reloc_entry, symbol_in, data, input_section, output_bfd, - error_message) - bfd *abfd; - arelent *reloc_entry; - asymbol *symbol_in; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message; -{ - unsigned long insn; - bfd_vma sym_value; - enum sh_reloc_type r_type; - bfd_vma addr = reloc_entry->address; - bfd_byte *hit_data = addr + (bfd_byte *) data; - - r_type = (enum sh_reloc_type) reloc_entry->howto->type; - - if (output_bfd != NULL) - { - /* Partial linking--do nothing. */ - reloc_entry->address += input_section->output_offset; - return bfd_reloc_ok; - } - - /* Almost all relocs have to do with relaxing. If any work must be - done for them, it has been done in sh_relax_section. */ - if (r_type != R_SH_DIR32 - && (r_type != R_SH_IND12W - || (symbol_in->flags & BSF_LOCAL) != 0)) - return bfd_reloc_ok; - - if (symbol_in != NULL - && bfd_is_und_section (symbol_in->section)) - return bfd_reloc_undefined; - - if (bfd_is_com_section (symbol_in->section)) - sym_value = 0; - else - sym_value = (symbol_in->value + - symbol_in->section->output_section->vma + - symbol_in->section->output_offset); - - switch (r_type) - { - case R_SH_DIR32: - insn = bfd_get_32 (abfd, hit_data); - insn += sym_value + reloc_entry->addend; - bfd_put_32 (abfd, insn, hit_data); - break; - case R_SH_IND12W: - insn = bfd_get_16 (abfd, hit_data); - sym_value += reloc_entry->addend; - sym_value -= (input_section->output_section->vma - + input_section->output_offset - + addr - + 4); - sym_value += (insn & 0xfff) << 1; - if (insn & 0x800) - sym_value -= 0x1000; - insn = (insn & 0xf000) | (sym_value & 0xfff); - bfd_put_16 (abfd, insn, hit_data); - if (sym_value < (bfd_vma) -0x1000 || sym_value >= 0x1000) - return bfd_reloc_overflow; - break; - default: - abort (); - break; - } - - return bfd_reloc_ok; -} - -/* This function is used for relocs which are only used for relaxing, - which the linker should otherwise ignore. */ - -static bfd_reloc_status_type -sh_elf_ignore_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 != NULL) - reloc_entry->address += input_section->output_offset; - return bfd_reloc_ok; -} - -/* This structure is used to map BFD reloc codes to SH ELF relocs. */ - -struct elf_reloc_map -{ - unsigned char bfd_reloc_val; - unsigned char elf_reloc_val; -}; - -/* An array mapping BFD reloc codes to SH ELF relocs. */ - -static const struct elf_reloc_map sh_reloc_map[] = -{ - { BFD_RELOC_NONE, R_SH_NONE }, - { BFD_RELOC_32, R_SH_DIR32 }, - { BFD_RELOC_CTOR, R_SH_DIR32 }, - { BFD_RELOC_32_PCREL, R_SH_REL32 }, - { BFD_RELOC_SH_PCDISP8BY2, R_SH_DIR8WPN }, - { BFD_RELOC_SH_PCDISP12BY2, R_SH_IND12W }, - { BFD_RELOC_SH_PCRELIMM8BY2, R_SH_DIR8WPZ }, - { BFD_RELOC_SH_PCRELIMM8BY4, R_SH_DIR8WPL }, - { BFD_RELOC_SH_SWITCH16, R_SH_SWITCH16 }, - { BFD_RELOC_SH_SWITCH32, R_SH_SWITCH32 }, - { BFD_RELOC_SH_USES, R_SH_USES }, - { BFD_RELOC_SH_COUNT, R_SH_COUNT }, - { BFD_RELOC_SH_ALIGN, R_SH_ALIGN }, - { BFD_RELOC_SH_CODE, R_SH_CODE }, - { BFD_RELOC_SH_DATA, R_SH_DATA }, - { BFD_RELOC_SH_LABEL, R_SH_LABEL } -}; - -/* Given a BFD reloc code, return the howto structure for the - corresponding SH ELf reloc. */ - -static reloc_howto_type * -sh_elf_reloc_type_lookup (abfd, code) - bfd *abfd; - bfd_reloc_code_real_type code; -{ - unsigned int i; - - for (i = 0; i < sizeof (sh_reloc_map) / sizeof (struct elf_reloc_map); i++) - { - if (sh_reloc_map[i].bfd_reloc_val == code) - return &sh_elf_howto_table[(int) sh_reloc_map[i].elf_reloc_val]; - } - - return NULL; -} - -/* Given an ELF reloc, fill in the howto field of a relent. */ - -static void -sh_elf_info_to_howto (abfd, cache_ptr, dst) - bfd *abfd; - arelent *cache_ptr; - Elf_Internal_Rela *dst; -{ - unsigned int r; - - r = ELF32_R_TYPE (dst->r_info); - - BFD_ASSERT (r < (unsigned int) R_SH_max); - BFD_ASSERT (r < FIRST_INVALID_RELOC || r > LAST_INVALID_RELOC); - - cache_ptr->howto = &sh_elf_howto_table[r]; -} - -/* This function handles relaxing for SH ELF. See the corresponding - function in coff-sh.c for a description of what this does. FIXME: - There is a lot of duplication here between this code and the COFF - specific code. The format of relocs and symbols is wound deeply - into this code, but it would still be better if the duplication - could be eliminated somehow. Note in particular that although both - functions use symbols like R_SH_CODE, those symbols have different - values; in coff-sh.c they come from include/coff/sh.h, whereas here - they come from enum sh_reloc_type in this file. */ - -static boolean -sh_elf_relax_section (abfd, sec, link_info, again) - bfd *abfd; - asection *sec; - struct bfd_link_info *link_info; - boolean *again; -{ - Elf_Internal_Shdr *symtab_hdr; - Elf_Internal_Rela *internal_relocs; - Elf_Internal_Rela *free_relocs = NULL; - boolean have_code; - Elf_Internal_Rela *irel, *irelend; - bfd_byte *contents = NULL; - bfd_byte *free_contents = NULL; - Elf32_External_Sym *extsyms = NULL; - Elf32_External_Sym *free_extsyms = NULL; - - *again = false; - - if (link_info->relocateable - || (sec->flags & SEC_RELOC) == 0 - || sec->reloc_count == 0) - return true; - - /* If this is the first time we have been called for this section, - initialize the cooked size. */ - if (sec->_cooked_size == 0) - sec->_cooked_size = sec->_raw_size; - - symtab_hdr = &elf_tdata (abfd)->symtab_hdr; - - internal_relocs = (_bfd_elf32_link_read_relocs - (abfd, sec, (PTR) NULL, (Elf_Internal_Rela *) NULL, - link_info->keep_memory)); - if (internal_relocs == NULL) - goto error_return; - if (! link_info->keep_memory) - free_relocs = internal_relocs; - - have_code = false; - - irelend = internal_relocs + sec->reloc_count; - for (irel = internal_relocs; irel < irelend; irel++) - { - bfd_vma laddr, paddr, symval; - unsigned short insn; - Elf_Internal_Rela *irelfn, *irelscan, *irelcount; - bfd_signed_vma foff; - - if (ELF32_R_TYPE (irel->r_info) == (int) R_SH_CODE) - have_code = true; - - if (ELF32_R_TYPE (irel->r_info) != (int) R_SH_USES) - continue; - - /* Get the section contents. */ - if (contents == NULL) - { - if (elf_section_data (sec)->this_hdr.contents != NULL) - contents = elf_section_data (sec)->this_hdr.contents; - else - { - contents = (bfd_byte *) bfd_malloc (sec->_raw_size); - if (contents == NULL) - goto error_return; - free_contents = contents; - - if (! bfd_get_section_contents (abfd, sec, contents, - (file_ptr) 0, sec->_raw_size)) - goto error_return; - } - } - - /* The r_addend field of the R_SH_USES reloc will point us to - the register load. The 4 is because the r_addend field is - computed as though it were a jump offset, which are based - from 4 bytes after the jump instruction. */ - laddr = irel->r_offset + 4 + irel->r_addend; - if (laddr >= sec->_raw_size) - { - (*_bfd_error_handler) ("%s: 0x%lx: warning: bad R_SH_USES offset", - bfd_get_filename (abfd), - (unsigned long) irel->r_offset); - continue; - } - insn = bfd_get_16 (abfd, contents + laddr); - - /* If the instruction is not mov.l NN,rN, we don't know what to - do. */ - if ((insn & 0xf000) != 0xd000) - { - ((*_bfd_error_handler) - ("%s: 0x%lx: warning: R_SH_USES points to unrecognized insn 0x%x", - bfd_get_filename (abfd), (unsigned long) irel->r_offset, insn)); - continue; - } - - /* Get the address from which the register is being loaded. The - displacement in the mov.l instruction is quadrupled. It is a - displacement from four bytes after the movl instruction, but, - before adding in the PC address, two least significant bits - of the PC are cleared. We assume that the section is aligned - on a four byte boundary. */ - paddr = insn & 0xff; - paddr *= 4; - paddr += (laddr + 4) &~ 3; - if (paddr >= sec->_raw_size) - { - ((*_bfd_error_handler) - ("%s: 0x%lx: warning: bad R_SH_USES load offset", - bfd_get_filename (abfd), (unsigned long) irel->r_offset)); - continue; - } - - /* Get the reloc for the address from which the register is - being loaded. This reloc will tell us which function is - actually being called. */ - for (irelfn = internal_relocs; irelfn < irelend; irelfn++) - if (irelfn->r_offset == paddr - && ELF32_R_TYPE (irelfn->r_info) == (int) R_SH_DIR32) - break; - if (irelfn >= irelend) - { - ((*_bfd_error_handler) - ("%s: 0x%lx: warning: could not find expected reloc", - bfd_get_filename (abfd), (unsigned long) paddr)); - continue; - } - - /* Read this BFD's symbols if we haven't done so already. */ - if (extsyms == NULL) - { - if (symtab_hdr->contents != NULL) - extsyms = (Elf32_External_Sym *) symtab_hdr->contents; - else - { - extsyms = ((Elf32_External_Sym *) - bfd_malloc (symtab_hdr->sh_size)); - if (extsyms == NULL) - goto error_return; - free_extsyms = extsyms; - if (bfd_seek (abfd, symtab_hdr->sh_offset, SEEK_SET) != 0 - || (bfd_read (extsyms, 1, symtab_hdr->sh_size, abfd) - != symtab_hdr->sh_size)) - goto error_return; - } - } - - /* Get the value of the symbol referred to by the reloc. */ - if (ELF32_R_SYM (irelfn->r_info) < symtab_hdr->sh_info) - { - Elf_Internal_Sym isym; - - /* A local symbol. */ - bfd_elf32_swap_symbol_in (abfd, - extsyms + ELF32_R_SYM (irelfn->r_info), - &isym); - - if (isym.st_shndx != _bfd_elf_section_from_bfd_section (abfd, sec)) - { - ((*_bfd_error_handler) - ("%s: 0x%lx: warning: symbol in unexpected section", - bfd_get_filename (abfd), (unsigned long) paddr)); - continue; - } - - symval = (isym.st_value - + sec->output_section->vma - + sec->output_offset); - } - else - { - unsigned long indx; - struct elf_link_hash_entry *h; - - indx = ELF32_R_SYM (irelfn->r_info) - symtab_hdr->sh_info; - h = elf_sym_hashes (abfd)[indx]; - BFD_ASSERT (h != NULL); - if (h->root.type != bfd_link_hash_defined - && h->root.type != bfd_link_hash_defweak) - { - /* This appears to be a reference to an undefined - symbol. Just ignore it--it will be caught by the - regular reloc processing. */ - continue; - } - - symval = (h->root.u.def.value - + h->root.u.def.section->output_section->vma - + h->root.u.def.section->output_offset); - } - - symval += bfd_get_32 (abfd, contents + paddr); - - /* See if this function call can be shortened. */ - foff = (symval - - (irel->r_offset - + sec->output_section->vma - + sec->output_offset - + 4)); - if (foff < -0x1000 || foff >= 0x1000) - { - /* After all that work, we can't shorten this function call. */ - continue; - } - - /* Shorten the function call. */ - - /* For simplicity of coding, we are going to modify the section - contents, the section relocs, and the BFD symbol table. We - must tell the rest of the code not to free up this - information. It would be possible to instead create a table - of changes which have to be made, as is done in coff-mips.c; - that would be more work, but would require less memory when - the linker is run. */ - - elf_section_data (sec)->relocs = internal_relocs; - free_relocs = NULL; - - elf_section_data (sec)->this_hdr.contents = contents; - free_contents = NULL; - - symtab_hdr->contents = (bfd_byte *) extsyms; - free_extsyms = NULL; - - /* Replace the jsr with a bsr. */ - - /* Change the R_SH_USES reloc into an R_SH_IND12W reloc, and - replace the jsr with a bsr. */ - irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irelfn->r_info), R_SH_IND12W); - if (ELF32_R_SYM (irelfn->r_info) < symtab_hdr->sh_info) - { - /* If this needs to be changed because of future relaxing, - it will be handled here like other internal IND12W - relocs. */ - bfd_put_16 (abfd, - 0xb000 | ((foff >> 1) & 0xfff), - contents + irel->r_offset); - } - else - { - /* We can't fully resolve this yet, because the external - symbol value may be changed by future relaxing. We let - the final link phase handle it. */ - bfd_put_16 (abfd, 0xb000, contents + irel->r_offset); - } - - /* See if there is another R_SH_USES reloc referring to the same - register load. */ - for (irelscan = internal_relocs; irelscan < irelend; irelscan++) - if (ELF32_R_TYPE (irelscan->r_info) == (int) R_SH_USES - && laddr == irelscan->r_offset + 4 + irelscan->r_addend) - break; - if (irelscan < irelend) - { - /* Some other function call depends upon this register load, - and we have not yet converted that function call. - Indeed, we may never be able to convert it. There is - nothing else we can do at this point. */ - continue; - } - - /* Look for a R_SH_COUNT reloc on the location where the - function address is stored. Do this before deleting any - bytes, to avoid confusion about the address. */ - for (irelcount = internal_relocs; irelcount < irelend; irelcount++) - if (irelcount->r_offset == paddr - && ELF32_R_TYPE (irelcount->r_info) == (int) R_SH_COUNT) - break; - - /* Delete the register load. */ - if (! sh_elf_relax_delete_bytes (abfd, sec, laddr, 2)) - goto error_return; - - /* That will change things, so, just in case it permits some - other function call to come within range, we should relax - again. Note that this is not required, and it may be slow. */ - *again = true; - - /* Now check whether we got a COUNT reloc. */ - if (irelcount >= irelend) - { - ((*_bfd_error_handler) - ("%s: 0x%lx: warning: could not find expected COUNT reloc", - bfd_get_filename (abfd), (unsigned long) paddr)); - continue; - } - - /* The number of uses is stored in the r_addend field. We've - just deleted one. */ - if (irelcount->r_addend == 0) - { - ((*_bfd_error_handler) ("%s: 0x%lx: warning: bad count", - bfd_get_filename (abfd), - (unsigned long) paddr)); - continue; - } - - --irelcount->r_addend; - - /* If there are no more uses, we can delete the address. Reload - the address from irelfn, in case it was changed by the - previous call to sh_elf_relax_delete_bytes. */ - if (irelcount->r_addend == 0) - { - if (! sh_elf_relax_delete_bytes (abfd, sec, irelfn->r_offset, 4)) - goto error_return; - } - - /* We've done all we can with that function call. */ - } - - /* Look for load and store instructions that we can align on four - byte boundaries. */ - if (have_code) - { - boolean swapped; - - /* Get the section contents. */ - if (contents == NULL) - { - if (elf_section_data (sec)->this_hdr.contents != NULL) - contents = elf_section_data (sec)->this_hdr.contents; - else - { - contents = (bfd_byte *) bfd_malloc (sec->_raw_size); - if (contents == NULL) - goto error_return; - free_contents = contents; - - if (! bfd_get_section_contents (abfd, sec, contents, - (file_ptr) 0, sec->_raw_size)) - goto error_return; - } - } - - if (! sh_elf_align_loads (abfd, sec, internal_relocs, contents, - &swapped)) - goto error_return; - - if (swapped) - { - elf_section_data (sec)->relocs = internal_relocs; - free_relocs = NULL; - - elf_section_data (sec)->this_hdr.contents = contents; - free_contents = NULL; - - symtab_hdr->contents = (bfd_byte *) extsyms; - free_extsyms = NULL; - } - } - - if (free_relocs != NULL) - { - free (free_relocs); - free_relocs = NULL; - } - - if (free_contents != NULL) - { - if (! link_info->keep_memory) - free (free_contents); - else - { - /* Cache the section contents for elf_link_input_bfd. */ - elf_section_data (sec)->this_hdr.contents = contents; - } - free_contents = NULL; - } - - if (free_extsyms != NULL) - { - if (! link_info->keep_memory) - free (free_extsyms); - else - { - /* Cache the symbols for elf_link_input_bfd. */ - symtab_hdr->contents = extsyms; - } - free_extsyms = NULL; - } - - return true; - - error_return: - if (free_relocs != NULL) - free (free_relocs); - if (free_contents != NULL) - free (free_contents); - if (free_extsyms != NULL) - free (free_extsyms); - return false; -} - -/* Delete some bytes from a section while relaxing. FIXME: There is a - lot of duplication between this function and sh_relax_delete_bytes - in coff-sh.c. */ - -static boolean -sh_elf_relax_delete_bytes (abfd, sec, addr, count) - bfd *abfd; - asection *sec; - bfd_vma addr; - int count; -{ - Elf_Internal_Shdr *symtab_hdr; - Elf32_External_Sym *extsyms; - int shndx, index; - bfd_byte *contents; - Elf_Internal_Rela *irel, *irelend; - Elf_Internal_Rela *irelalign; - bfd_vma toaddr; - Elf32_External_Sym *esym, *esymend; - struct elf_link_hash_entry *sym_hash; - asection *o; - - symtab_hdr = &elf_tdata (abfd)->symtab_hdr; - extsyms = (Elf32_External_Sym *) symtab_hdr->contents; - - shndx = _bfd_elf_section_from_bfd_section (abfd, sec); - - contents = elf_section_data (sec)->this_hdr.contents; - - /* The deletion must stop at the next ALIGN reloc for an aligment - power larger than the number of bytes we are deleting. */ - - irelalign = NULL; - toaddr = sec->_cooked_size; - - irel = elf_section_data (sec)->relocs; - irelend = irel + sec->reloc_count; - for (; irel < irelend; irel++) - { - if (ELF32_R_TYPE (irel->r_info) == (int) R_SH_ALIGN - && irel->r_offset > addr - && count < (1 << irel->r_addend)) - { - irelalign = irel; - toaddr = irel->r_offset; - break; - } - } - - /* Actually delete the bytes. */ - memmove (contents + addr, contents + addr + count, toaddr - addr - count); - if (irelalign == NULL) - sec->_cooked_size -= count; - else - { - int i; - -#define NOP_OPCODE (0x0009) - - BFD_ASSERT ((count & 1) == 0); - for (i = 0; i < count; i += 2) - bfd_put_16 (abfd, NOP_OPCODE, contents + toaddr - count + i); - } - - /* Adjust all the relocs. */ - for (irel = elf_section_data (sec)->relocs; irel < irelend; irel++) - { - bfd_vma nraddr, stop; - bfd_vma start = 0; - int insn = 0; - Elf_Internal_Sym sym; - int off, adjust, oinsn; - bfd_signed_vma voff = 0; - boolean overflow; - - /* Get the new reloc address. */ - nraddr = irel->r_offset; - if ((irel->r_offset > addr - && irel->r_offset < toaddr) - || (ELF32_R_TYPE (irel->r_info) == (int) R_SH_ALIGN - && irel->r_offset == toaddr)) - nraddr -= count; - - /* See if this reloc was for the bytes we have deleted, in which - case we no longer care about it. Don't delete relocs which - represent addresses, though. */ - if (irel->r_offset >= addr - && irel->r_offset < addr + count - && ELF32_R_TYPE (irel->r_info) != (int) R_SH_ALIGN - && ELF32_R_TYPE (irel->r_info) != (int) R_SH_CODE - && ELF32_R_TYPE (irel->r_info) != (int) R_SH_DATA - && ELF32_R_TYPE (irel->r_info) != (int) R_SH_LABEL) - irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), - (int) R_SH_NONE); - - /* If this is a PC relative reloc, see if the range it covers - includes the bytes we have deleted. */ - switch ((enum sh_reloc_type) ELF32_R_TYPE (irel->r_info)) - { - default: - break; - - case R_SH_DIR8WPN: - case R_SH_IND12W: - case R_SH_DIR8WPZ: - case R_SH_DIR8WPL: - start = irel->r_offset; - insn = bfd_get_16 (abfd, contents + nraddr); - break; - } - - switch ((enum sh_reloc_type) ELF32_R_TYPE (irel->r_info)) - { - default: - start = stop = addr; - break; - - case R_SH_DIR32: - /* If this reloc is against a symbol defined in this - section, and the symbol will not be adjusted below, we - must check the addend to see it will put the value in - range to be adjusted, and hence must be changed. */ - if (ELF32_R_SYM (irel->r_info) < symtab_hdr->sh_info) - { - bfd_elf32_swap_symbol_in (abfd, - extsyms + ELF32_R_SYM (irel->r_info), - &sym); - if (sym.st_shndx == shndx - && (sym.st_value <= addr - || sym.st_value >= toaddr)) - { - bfd_vma val; - - val = bfd_get_32 (abfd, contents + nraddr); - val += sym.st_value; - if (val >= addr && val < toaddr) - bfd_put_32 (abfd, val - count, contents + nraddr); - } - } - start = stop = addr; - break; - - case R_SH_DIR8WPN: - off = insn & 0xff; - if (off & 0x80) - off -= 0x100; - stop = (bfd_vma) ((bfd_signed_vma) start + 4 + off * 2); - break; - - case R_SH_IND12W: - if (ELF32_R_SYM (irel->r_info) >= symtab_hdr->sh_info) - start = stop = addr; - else - { - off = insn & 0xfff; - if (off & 0x800) - off -= 0x1000; - stop = (bfd_vma) ((bfd_signed_vma) start + 4 + off * 2); - } - break; - - case R_SH_DIR8WPZ: - off = insn & 0xff; - stop = start + 4 + off * 2; - break; - - case R_SH_DIR8WPL: - off = insn & 0xff; - stop = (start &~ (bfd_vma) 3) + 4 + off * 4; - break; - - case R_SH_SWITCH16: - case R_SH_SWITCH32: - /* These relocs types represent - .word L2-L1 - The r_offset field holds the difference between the reloc - address and L1. That is the start of the reloc, and - adding in the contents gives us the top. We must adjust - both the r_offset field and the section contents. */ - - start = irel->r_offset; - stop = (bfd_vma) ((bfd_signed_vma) start - (long) irel->r_addend); - - if (start > addr - && start < toaddr - && (stop <= addr || stop >= toaddr)) - irel->r_addend += count; - else if (stop > addr - && stop < toaddr - && (start <= addr || start >= toaddr)) - irel->r_addend -= count; - - start = stop; - - if (ELF32_R_TYPE (irel->r_info) == (int) R_SH_SWITCH16) - voff = bfd_get_signed_16 (abfd, contents + nraddr); - else - voff = bfd_get_signed_32 (abfd, contents + nraddr); - stop = (bfd_vma) ((bfd_signed_vma) start + voff); - - break; - - case R_SH_USES: - start = irel->r_offset; - stop = (bfd_vma) ((bfd_signed_vma) start - + (long) irel->r_addend - + 4); - break; - } - - if (start > addr - && start < toaddr - && (stop <= addr || stop >= toaddr)) - adjust = count; - else if (stop > addr - && stop < toaddr - && (start <= addr || start >= toaddr)) - adjust = - count; - else - adjust = 0; - - if (adjust != 0) - { - oinsn = insn; - overflow = false; - switch ((enum sh_reloc_type) ELF32_R_TYPE (irel->r_info)) - { - default: - abort (); - break; - - case R_SH_DIR8WPN: - case R_SH_DIR8WPZ: - insn += adjust / 2; - if ((oinsn & 0xff00) != (insn & 0xff00)) - overflow = true; - bfd_put_16 (abfd, insn, contents + nraddr); - break; - - case R_SH_IND12W: - insn += adjust / 2; - if ((oinsn & 0xf000) != (insn & 0xf000)) - overflow = true; - bfd_put_16 (abfd, insn, contents + nraddr); - break; - - case R_SH_DIR8WPL: - BFD_ASSERT (adjust == count || count >= 4); - if (count >= 4) - insn += adjust / 4; - else - { - if ((irel->r_offset & 3) == 0) - ++insn; - } - if ((oinsn & 0xff00) != (insn & 0xff00)) - overflow = true; - bfd_put_16 (abfd, insn, contents + nraddr); - break; - - case R_SH_SWITCH16: - voff += adjust; - if (voff < - 0x8000 || voff >= 0x8000) - overflow = true; - bfd_put_signed_16 (abfd, voff, contents + nraddr); - break; - - case R_SH_SWITCH32: - voff += adjust; - bfd_put_signed_32 (abfd, voff, contents + nraddr); - break; - - case R_SH_USES: - irel->r_addend += adjust; - break; - } - - if (overflow) - { - ((*_bfd_error_handler) - ("%s: 0x%lx: fatal: reloc overflow while relaxing", - bfd_get_filename (abfd), (unsigned long) irel->r_offset)); - bfd_set_error (bfd_error_bad_value); - return false; - } - } - - irel->r_offset = nraddr; - } - - /* Look through all the other sections. If there contain any IMM32 - relocs against internal symbols which we are not going to adjust - below, we may need to adjust the addends. */ - for (o = abfd->sections; o != NULL; o = o->next) - { - Elf_Internal_Rela *internal_relocs; - Elf_Internal_Rela *irelscan, *irelscanend; - bfd_byte *ocontents; - - if (o == sec - || (o->flags & SEC_RELOC) == 0 - || o->reloc_count == 0) - continue; - - /* We always cache the relocs. Perhaps, if info->keep_memory is - false, we should free them, if we are permitted to, when we - leave sh_coff_relax_section. */ - internal_relocs = (_bfd_elf32_link_read_relocs - (abfd, o, (PTR) NULL, (Elf_Internal_Rela *) NULL, - true)); - if (internal_relocs == NULL) - return false; - - ocontents = NULL; - irelscanend = internal_relocs + o->reloc_count; - for (irelscan = internal_relocs; irelscan < irelscanend; irelscan++) - { - Elf_Internal_Sym sym; - - if (ELF32_R_TYPE (irelscan->r_info) != (int) R_SH_DIR32) - continue; - - if (ELF32_R_SYM (irelscan->r_info) >= symtab_hdr->sh_info) - continue; - - bfd_elf32_swap_symbol_in (abfd, - extsyms + ELF32_R_SYM (irelscan->r_info), - &sym); - - if (sym.st_shndx == shndx - && (sym.st_value <= addr - || sym.st_value >= toaddr)) - { - bfd_vma val; - - if (ocontents == NULL) - { - if (elf_section_data (o)->this_hdr.contents != NULL) - ocontents = elf_section_data (o)->this_hdr.contents; - else - { - /* We always cache the section contents. - Perhaps, if info->keep_memory is false, we - should free them, if we are permitted to, - when we leave sh_coff_relax_section. */ - ocontents = (bfd_byte *) bfd_malloc (o->_raw_size); - if (ocontents == NULL) - return false; - if (! bfd_get_section_contents (abfd, o, ocontents, - (file_ptr) 0, - o->_raw_size)) - return false; - elf_section_data (o)->this_hdr.contents = ocontents; - } - } - - val = bfd_get_32 (abfd, ocontents + irelscan->r_offset); - val += sym.st_value; - if (val >= addr && val < toaddr) - bfd_put_32 (abfd, val - count, - ocontents + irelscan->r_offset); - } - } - } - - /* Adjust the local symbols defined in this section. */ - esym = extsyms; - esymend = esym + symtab_hdr->sh_info; - for (; esym < esymend; esym++) - { - Elf_Internal_Sym isym; - - bfd_elf32_swap_symbol_in (abfd, esym, &isym); - - if (isym.st_shndx == shndx - && isym.st_value > addr - && isym.st_value < toaddr) - { - isym.st_value -= count; - bfd_elf32_swap_symbol_out (abfd, &isym, esym); - } - } - - /* Now adjust the global symbols defined in this section. */ - esym = extsyms + symtab_hdr->sh_info; - esymend = extsyms + (symtab_hdr->sh_size / sizeof (Elf32_External_Sym)); - for (index = 0; esym < esymend; esym++, index++) - { - Elf_Internal_Sym isym; - - bfd_elf32_swap_symbol_in (abfd, esym, &isym); - sym_hash = elf_sym_hashes (abfd)[index]; - if (isym.st_shndx == shndx - && ((sym_hash)->root.type == bfd_link_hash_defined - || (sym_hash)->root.type == bfd_link_hash_defweak) - && (sym_hash)->root.u.def.section == sec - && (sym_hash)->root.u.def.value > addr - && (sym_hash)->root.u.def.value < toaddr) - { - (sym_hash)->root.u.def.value -= count; - } - } - - /* See if we can move the ALIGN reloc forward. We have adjusted - r_offset for it already. */ - if (irelalign != NULL) - { - bfd_vma alignto, alignaddr; - - alignto = BFD_ALIGN (toaddr, 1 << irelalign->r_addend); - alignaddr = BFD_ALIGN (irelalign->r_offset, - 1 << irelalign->r_addend); - if (alignto != alignaddr) - { - /* Tail recursion. */ - return sh_elf_relax_delete_bytes (abfd, sec, alignaddr, - alignto - alignaddr); - } - } - - return true; -} - -/* Look for loads and stores which we can align to four byte - boundaries. This is like sh_align_loads in coff-sh.c. */ - -static boolean -sh_elf_align_loads (abfd, sec, internal_relocs, contents, pswapped) - bfd *abfd; - asection *sec; - Elf_Internal_Rela *internal_relocs; - bfd_byte *contents; - boolean *pswapped; -{ - Elf_Internal_Rela *irel, *irelend; - bfd_vma *labels = NULL; - bfd_vma *label, *label_end; - - *pswapped = false; - - irelend = internal_relocs + sec->reloc_count; - - /* Get all the addresses with labels on them. */ - labels = (bfd_vma *) bfd_malloc (sec->reloc_count * sizeof (bfd_vma)); - if (labels == NULL) - goto error_return; - label_end = labels; - for (irel = internal_relocs; irel < irelend; irel++) - { - if (ELF32_R_TYPE (irel->r_info) == (int) R_SH_LABEL) - { - *label_end = irel->r_offset; - ++label_end; - } - } - - /* Note that the assembler currently always outputs relocs in - address order. If that ever changes, this code will need to sort - the label values and the relocs. */ - - label = labels; - - for (irel = internal_relocs; irel < irelend; irel++) - { - bfd_vma start, stop; - - if (ELF32_R_TYPE (irel->r_info) != (int) R_SH_CODE) - continue; - - start = irel->r_offset; - - for (irel++; irel < irelend; irel++) - if (ELF32_R_TYPE (irel->r_info) == (int) R_SH_DATA) - break; - if (irel < irelend) - stop = irel->r_offset; - else - stop = sec->_cooked_size; - - if (! _bfd_sh_align_load_span (abfd, sec, contents, sh_elf_swap_insns, - (PTR) internal_relocs, &label, - label_end, start, stop, pswapped)) - goto error_return; - } - - free (labels); - - return true; - - error_return: - if (labels != NULL) - free (labels); - return false; -} - -/* Swap two SH instructions. This is like sh_swap_insns in coff-sh.c. */ - -static boolean -sh_elf_swap_insns (abfd, sec, relocs, contents, addr) - bfd *abfd; - asection *sec; - PTR relocs; - bfd_byte *contents; - bfd_vma addr; -{ - Elf_Internal_Rela *internal_relocs = (Elf_Internal_Rela *) relocs; - unsigned short i1, i2; - Elf_Internal_Rela *irel, *irelend; - - /* Swap the instructions themselves. */ - i1 = bfd_get_16 (abfd, contents + addr); - i2 = bfd_get_16 (abfd, contents + addr + 2); - bfd_put_16 (abfd, i2, contents + addr); - bfd_put_16 (abfd, i1, contents + addr + 2); - - /* Adjust all reloc addresses. */ - irelend = internal_relocs + sec->reloc_count; - for (irel = internal_relocs; irel < irelend; irel++) - { - enum sh_reloc_type type; - int add; - - /* There are a few special types of relocs that we don't want to - adjust. These relocs do not apply to the instruction itself, - but are only associated with the address. */ - type = (enum sh_reloc_type) ELF32_R_TYPE (irel->r_info); - if (type == R_SH_ALIGN - || type == R_SH_CODE - || type == R_SH_DATA - || type == R_SH_LABEL) - continue; - - /* If an R_SH_USES reloc points to one of the addresses being - swapped, we must adjust it. It would be incorrect to do this - for a jump, though, since we want to execute both - instructions after the jump. (We have avoided swapping - around a label, so the jump will not wind up executing an - instruction it shouldn't). */ - if (type == R_SH_USES) - { - bfd_vma off; - - off = irel->r_offset + 4 + irel->r_addend; - if (off == addr) - irel->r_offset += 2; - else if (off == addr + 2) - irel->r_offset -= 2; - } - - if (irel->r_offset == addr) - { - irel->r_offset += 2; - add = -2; - } - else if (irel->r_offset == addr + 2) - { - irel->r_offset -= 2; - add = 2; - } - else - add = 0; - - if (add != 0) - { - bfd_byte *loc; - unsigned short insn, oinsn; - boolean overflow; - - loc = contents + irel->r_offset; - overflow = false; - switch (type) - { - default: - break; - - case R_SH_DIR8WPN: - case R_SH_DIR8WPZ: - insn = bfd_get_16 (abfd, loc); - oinsn = insn; - insn += add / 2; - if ((oinsn & 0xff00) != (insn & 0xff00)) - overflow = true; - bfd_put_16 (abfd, insn, loc); - break; - - case R_SH_IND12W: - insn = bfd_get_16 (abfd, loc); - oinsn = insn; - insn += add / 2; - if ((oinsn & 0xf000) != (insn & 0xf000)) - overflow = true; - bfd_put_16 (abfd, insn, loc); - break; - - case R_SH_DIR8WPL: - /* This reloc ignores the least significant 3 bits of - the program counter before adding in the offset. - This means that if ADDR is at an even address, the - swap will not affect the offset. If ADDR is an at an - odd address, then the instruction will be crossing a - four byte boundary, and must be adjusted. */ - if ((addr & 3) != 0) - { - insn = bfd_get_16 (abfd, loc); - oinsn = insn; - insn += add / 2; - if ((oinsn & 0xff00) != (insn & 0xff00)) - overflow = true; - bfd_put_16 (abfd, insn, loc); - } - - break; - } - - if (overflow) - { - ((*_bfd_error_handler) - ("%s: 0x%lx: fatal: reloc overflow while relaxing", - bfd_get_filename (abfd), (unsigned long) irel->r_offset)); - bfd_set_error (bfd_error_bad_value); - return false; - } - } - } - - return true; -} - -/* Relocate an SH ELF section. */ - -static boolean -sh_elf_relocate_section (output_bfd, info, input_bfd, input_section, - contents, relocs, local_syms, local_sections) - bfd *output_bfd; - struct bfd_link_info *info; - bfd *input_bfd; - asection *input_section; - bfd_byte *contents; - Elf_Internal_Rela *relocs; - Elf_Internal_Sym *local_syms; - asection **local_sections; -{ - Elf_Internal_Shdr *symtab_hdr; - struct elf_link_hash_entry **sym_hashes; - Elf_Internal_Rela *rel, *relend; - - symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; - sym_hashes = elf_sym_hashes (input_bfd); - - rel = relocs; - relend = relocs + input_section->reloc_count; - for (; rel < relend; rel++) - { - int r_type; - reloc_howto_type *howto; - unsigned long r_symndx; - Elf_Internal_Sym *sym; - asection *sec; - struct elf_link_hash_entry *h; - bfd_vma relocation; - bfd_reloc_status_type r; - - r_symndx = ELF32_R_SYM (rel->r_info); - - if (info->relocateable) - { - /* This is a relocateable link. We don't have to change - anything, unless the reloc is against a section symbol, - in which case we have to adjust according to where the - section symbol winds up in the output section. */ - if (r_symndx < symtab_hdr->sh_info) - { - sym = local_syms + r_symndx; - if (ELF_ST_TYPE (sym->st_info) == STT_SECTION) - { - sec = local_sections[r_symndx]; - rel->r_addend += sec->output_offset + sym->st_value; - } - } - - continue; - } - - r_type = ELF32_R_TYPE (rel->r_info); - - /* Many of the relocs are only used for relaxing, and are - handled entirely by the relaxation code. */ - if (r_type > (int) LAST_INVALID_RELOC) - continue; - - if (r_type < 0 - || r_type >= (int) FIRST_INVALID_RELOC) - { - bfd_set_error (bfd_error_bad_value); - return false; - } - - /* FIXME: This is certainly incorrect. However, it is how the - COFF linker works. */ - if (r_type != (int) R_SH_DIR32 - && r_type != (int) R_SH_IND12W) - continue; - - howto = sh_elf_howto_table + r_type; - - /* This is a final link. */ - h = NULL; - sym = NULL; - sec = NULL; - if (r_symndx < symtab_hdr->sh_info) - { - /* There is nothing to be done for an internal IND12W - relocation. FIXME: This is probably wrong, but it's how - the COFF relocations work. */ - if (r_type == (int) R_SH_IND12W) - continue; - sym = local_syms + r_symndx; - sec = local_sections[r_symndx]; - relocation = (sec->output_section->vma - + sec->output_offset - + sym->st_value); - } - else - { - h = sym_hashes[r_symndx - symtab_hdr->sh_info]; - while (h->root.type == bfd_link_hash_indirect - || h->root.type == bfd_link_hash_warning) - h = (struct elf_link_hash_entry *) h->root.u.i.link; - if (h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak) - { - sec = h->root.u.def.section; - relocation = (h->root.u.def.value - + sec->output_section->vma - + sec->output_offset); - } - else if (h->root.type == bfd_link_hash_undefweak) - relocation = 0; - else - { - if (! ((*info->callbacks->undefined_symbol) - (info, h->root.root.string, input_bfd, - input_section, rel->r_offset))) - return false; - relocation = 0; - } - } - - /* FIXME: This is how the COFF relocations work. */ - if (r_type == (int) R_SH_IND12W) - relocation -= 4; - - /* FIXME: We should use the addend, but the COFF relocations - don't. */ - r = _bfd_final_link_relocate (howto, input_bfd, input_section, - contents, rel->r_offset, - relocation, 0); - - if (r != bfd_reloc_ok) - { - switch (r) - { - default: - case bfd_reloc_outofrange: - abort (); - case bfd_reloc_overflow: - { - const char *name; - - if (h != NULL) - name = h->root.root.string; - else - { - name = (bfd_elf_string_from_elf_section - (input_bfd, symtab_hdr->sh_link, sym->st_name)); - if (name == NULL) - return false; - if (*name == '\0') - name = bfd_section_name (input_bfd, sec); - } - if (! ((*info->callbacks->reloc_overflow) - (info, name, howto->name, (bfd_vma) 0, - input_bfd, input_section, rel->r_offset))) - return false; - } - break; - } - } - } - - return true; -} - -/* This is a version of bfd_generic_get_relocated_section_contents - which uses sh_elf_relocate_section. */ - -static bfd_byte * -sh_elf_get_relocated_section_contents (output_bfd, link_info, link_order, - data, relocateable, symbols) - bfd *output_bfd; - struct bfd_link_info *link_info; - struct bfd_link_order *link_order; - bfd_byte *data; - boolean relocateable; - asymbol **symbols; -{ - Elf_Internal_Shdr *symtab_hdr; - asection *input_section = link_order->u.indirect.section; - bfd *input_bfd = input_section->owner; - asection **sections = NULL; - Elf_Internal_Rela *internal_relocs = NULL; - Elf32_External_Sym *external_syms = NULL; - Elf_Internal_Sym *internal_syms = NULL; - - /* We only need to handle the case of relaxing, or of having a - particular set of section contents, specially. */ - if (relocateable - || elf_section_data (input_section)->this_hdr.contents == NULL) - return bfd_generic_get_relocated_section_contents (output_bfd, link_info, - link_order, data, - relocateable, - symbols); - - symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; - - memcpy (data, elf_section_data (input_section)->this_hdr.contents, - input_section->_raw_size); - - if ((input_section->flags & SEC_RELOC) != 0 - && input_section->reloc_count > 0) - { - Elf_Internal_Sym *isymp; - asection **secpp; - Elf32_External_Sym *esym, *esymend; - - if (symtab_hdr->contents != NULL) - external_syms = (Elf32_External_Sym *) symtab_hdr->contents; - else - { - external_syms = ((Elf32_External_Sym *) - bfd_malloc (symtab_hdr->sh_info - * sizeof (Elf32_External_Sym))); - if (external_syms == NULL && symtab_hdr->sh_info > 0) - goto error_return; - if (bfd_seek (input_bfd, symtab_hdr->sh_offset, SEEK_SET) != 0 - || (bfd_read (external_syms, sizeof (Elf32_External_Sym), - symtab_hdr->sh_info, input_bfd) - != (symtab_hdr->sh_info * sizeof (Elf32_External_Sym)))) - goto error_return; - } - - internal_relocs = (_bfd_elf32_link_read_relocs - (input_bfd, input_section, (PTR) NULL, - (Elf_Internal_Rela *) NULL, false)); - if (internal_relocs == NULL) - goto error_return; - - internal_syms = ((Elf_Internal_Sym *) - bfd_malloc (symtab_hdr->sh_info - * sizeof (Elf_Internal_Sym))); - if (internal_syms == NULL && symtab_hdr->sh_info > 0) - goto error_return; - - sections = (asection **) bfd_malloc (symtab_hdr->sh_info - * sizeof (asection *)); - if (sections == NULL && symtab_hdr->sh_info > 0) - goto error_return; - - isymp = internal_syms; - secpp = sections; - esym = external_syms; - esymend = esym + symtab_hdr->sh_info; - for (; esym < esymend; ++esym, ++isymp, ++secpp) - { - asection *isec; - - bfd_elf32_swap_symbol_in (input_bfd, esym, isymp); - - if (isymp->st_shndx == SHN_UNDEF) - isec = bfd_und_section_ptr; - else if (isymp->st_shndx > 0 && isymp->st_shndx < SHN_LORESERVE) - isec = bfd_section_from_elf_index (input_bfd, isymp->st_shndx); - else if (isymp->st_shndx == SHN_ABS) - isec = bfd_abs_section_ptr; - else if (isymp->st_shndx == SHN_COMMON) - isec = bfd_com_section_ptr; - else - { - /* Who knows? */ - isec = NULL; - } - - *secpp = isec; - } - - if (! sh_elf_relocate_section (output_bfd, link_info, input_bfd, - input_section, data, internal_relocs, - internal_syms, sections)) - goto error_return; - - if (sections != NULL) - free (sections); - sections = NULL; - if (internal_syms != NULL) - free (internal_syms); - internal_syms = NULL; - if (external_syms != NULL && symtab_hdr->contents == NULL) - free (external_syms); - external_syms = NULL; - if (internal_relocs != elf_section_data (input_section)->relocs) - free (internal_relocs); - internal_relocs = NULL; - } - - return data; - - error_return: - if (internal_relocs != NULL - && internal_relocs != elf_section_data (input_section)->relocs) - free (internal_relocs); - if (external_syms != NULL && symtab_hdr->contents == NULL) - free (external_syms); - if (internal_syms != NULL) - free (internal_syms); - if (sections != NULL) - free (sections); - return NULL; -} - -#define TARGET_BIG_SYM bfd_elf32_sh_vec -#define TARGET_BIG_NAME "elf32-sh" -#define TARGET_LITTLE_SYM bfd_elf32_shl_vec -#define TARGET_LITTLE_NAME "elf32-shl" -#define ELF_ARCH bfd_arch_sh -#define ELF_MACHINE_CODE EM_SH -#define ELF_MAXPAGESIZE 0x1 - -#define elf_symbol_leading_char '_' - -#define bfd_elf32_bfd_reloc_type_lookup sh_elf_reloc_type_lookup -#define elf_info_to_howto sh_elf_info_to_howto -#define bfd_elf32_bfd_relax_section sh_elf_relax_section -#define elf_backend_relocate_section sh_elf_relocate_section -#define bfd_elf32_bfd_get_relocated_section_contents \ - sh_elf_get_relocated_section_contents - -#include "elf32-target.h" diff --git a/contrib/binutils/bfd/elf64-mips.c b/contrib/binutils/bfd/elf64-mips.c deleted file mode 100644 index 6fc0dcdf0e4b..000000000000 --- a/contrib/binutils/bfd/elf64-mips.c +++ /dev/null @@ -1,2190 +0,0 @@ -/* MIPS-specific support for 64-bit ELF - Copyright 1996, 1997, 1998, 1999 Free Software Foundation, Inc. - Ian Lance Taylor, Cygnus Support - Linker support added by Mark Mitchell, CodeSourcery, LLC. - <mark@codesourcery.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. */ - -/* This file supports the 64-bit MIPS ELF ABI. - - The MIPS 64-bit ELF ABI uses an unusual reloc format. This file - overrides the usual ELF reloc handling, and handles reading and - writing the relocations here. - - The MIPS 64-bit ELF ABI also uses an unusual archive map format. */ - -#include "bfd.h" -#include "sysdep.h" -#include "libbfd.h" -#include "aout/ar.h" -#include "bfdlink.h" -#include "genlink.h" -#include "elf-bfd.h" -#include "elf/mips.h" - -/* Get the ECOFF swapping routines. The 64-bit ABI is not supposed to - use ECOFF. However, we support it anyhow for an easier changeover. */ -#include "coff/sym.h" -#include "coff/symconst.h" -#include "coff/internal.h" -#include "coff/ecoff.h" -/* The 64 bit versions of the mdebug data structures are in alpha.h. */ -#include "coff/alpha.h" -#define ECOFF_64 -#include "ecoffswap.h" - -static void mips_elf64_swap_reloc_in - PARAMS ((bfd *, const Elf64_Mips_External_Rel *, - Elf64_Mips_Internal_Rel *)); -static void mips_elf64_swap_reloca_in - PARAMS ((bfd *, const Elf64_Mips_External_Rela *, - Elf64_Mips_Internal_Rela *)); -static void mips_elf64_swap_reloc_out - PARAMS ((bfd *, const Elf64_Mips_Internal_Rel *, - Elf64_Mips_External_Rel *)); -static void mips_elf64_swap_reloca_out - PARAMS ((bfd *, const Elf64_Mips_Internal_Rela *, - Elf64_Mips_External_Rela *)); -static void mips_elf64_be_swap_reloc_in - PARAMS ((bfd *, const bfd_byte *, Elf_Internal_Rel *)); -static void mips_elf64_be_swap_reloc_out - PARAMS ((bfd *, const Elf_Internal_Rel *, bfd_byte *)); -static void mips_elf64_be_swap_reloca_in - PARAMS ((bfd *, const bfd_byte *, Elf_Internal_Rela *)); -static void mips_elf64_be_swap_reloca_out - PARAMS ((bfd *, const Elf_Internal_Rela *, bfd_byte *)); -static reloc_howto_type *mips_elf64_reloc_type_lookup - PARAMS ((bfd *, bfd_reloc_code_real_type)); -static long mips_elf64_get_reloc_upper_bound PARAMS ((bfd *, asection *)); -static boolean mips_elf64_slurp_one_reloc_table - PARAMS ((bfd *, asection *, asymbol **, const Elf_Internal_Shdr *)); -static boolean mips_elf64_slurp_reloc_table - PARAMS ((bfd *, asection *, asymbol **, boolean)); -static void mips_elf64_write_relocs PARAMS ((bfd *, asection *, PTR)); -static boolean mips_elf64_slurp_armap PARAMS ((bfd *)); -static boolean mips_elf64_write_armap - PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int)); - -/* In case we're on a 32-bit machine, construct a 64-bit "-1" value - from smaller values. Start with zero, widen, *then* decrement. */ -#define MINUS_ONE (((bfd_vma)0) - 1) - -/* The number of local .got entries we reserve. */ -#define MIPS_RESERVED_GOTNO (2) - -/* The relocation table used for SHT_REL sections. */ - -static reloc_howto_type mips_elf64_howto_table_rel[] = -{ - /* No relocation. */ - HOWTO (R_MIPS_NONE, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_NONE", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - false), /* pcrel_offset */ - - /* 16 bit relocation. */ - HOWTO (R_MIPS_16, /* type */ - 0, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_16", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* 32 bit relocation. */ - HOWTO (R_MIPS_32, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_32", /* name */ - true, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* 32 bit symbol relative relocation. */ - HOWTO (R_MIPS_REL32, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_REL32", /* name */ - true, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* 26 bit branch address. */ - HOWTO (R_MIPS_26, /* type */ - 2, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 26, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - /* This needs complex overflow - detection, because the upper four - bits must match the PC. */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_26", /* name */ - true, /* partial_inplace */ - 0x3ffffff, /* src_mask */ - 0x3ffffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* High 16 bits of symbol value. */ - HOWTO (R_MIPS_HI16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - _bfd_mips_elf_hi16_reloc, /* special_function */ - "R_MIPS_HI16", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Low 16 bits of symbol value. */ - HOWTO (R_MIPS_LO16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - _bfd_mips_elf_lo16_reloc, /* special_function */ - "R_MIPS_LO16", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* GP relative reference. */ - HOWTO (R_MIPS_GPREL16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - _bfd_mips_elf_gprel16_reloc, /* special_function */ - "R_MIPS_GPREL16", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Reference to literal section. */ - HOWTO (R_MIPS_LITERAL, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - _bfd_mips_elf_gprel16_reloc, /* special_function */ - "R_MIPS_LITERAL", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Reference to global offset table. */ - HOWTO (R_MIPS_GOT16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - _bfd_mips_elf_got16_reloc, /* special_function */ - "R_MIPS_GOT16", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* 16 bit PC relative reference. */ - HOWTO (R_MIPS_PC16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - true, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_PC16", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* 16 bit call through global offset table. */ - /* FIXME: This is not handled correctly. */ - HOWTO (R_MIPS_CALL16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_CALL16", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* 32 bit GP relative reference. */ - HOWTO (R_MIPS_GPREL32, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - _bfd_mips_elf_gprel32_reloc, /* special_function */ - "R_MIPS_GPREL32", /* name */ - true, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - false), /* pcrel_offset */ - - { 13 }, - { 14 }, - { 15 }, - - /* A 5 bit shift field. */ - HOWTO (R_MIPS_SHIFT5, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 5, /* bitsize */ - false, /* pc_relative */ - 6, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_SHIFT5", /* name */ - true, /* partial_inplace */ - 0x000007c0, /* src_mask */ - 0x000007c0, /* dst_mask */ - false), /* pcrel_offset */ - - /* A 6 bit shift field. */ - /* FIXME: This is not handled correctly; a special function is - needed to put the most significant bit in the right place. */ - HOWTO (R_MIPS_SHIFT6, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 6, /* bitsize */ - false, /* pc_relative */ - 6, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_SHIFT6", /* name */ - true, /* partial_inplace */ - 0x000007c4, /* src_mask */ - 0x000007c4, /* dst_mask */ - false), /* pcrel_offset */ - - /* 64 bit relocation. */ - HOWTO (R_MIPS_64, /* type */ - 0, /* rightshift */ - 4, /* size (0 = byte, 1 = short, 2 = long) */ - 64, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_64", /* name */ - true, /* partial_inplace */ - MINUS_ONE, /* src_mask */ - MINUS_ONE, /* dst_mask */ - false), /* pcrel_offset */ - - /* Displacement in the global offset table. */ - /* FIXME: Not handled correctly. */ - HOWTO (R_MIPS_GOT_DISP, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_GOT_DISP", /* name */ - true, /* partial_inplace */ - 0x0000ffff, /* src_mask */ - 0x0000ffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Displacement to page pointer in the global offset table. */ - /* FIXME: Not handled correctly. */ - HOWTO (R_MIPS_GOT_PAGE, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_GOT_PAGE", /* name */ - true, /* partial_inplace */ - 0x0000ffff, /* src_mask */ - 0x0000ffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Offset from page pointer in the global offset table. */ - /* FIXME: Not handled correctly. */ - HOWTO (R_MIPS_GOT_OFST, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_GOT_OFST", /* name */ - true, /* partial_inplace */ - 0x0000ffff, /* src_mask */ - 0x0000ffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* High 16 bits of displacement in global offset table. */ - /* FIXME: Not handled correctly. */ - HOWTO (R_MIPS_GOT_HI16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_GOT_HI16", /* name */ - true, /* partial_inplace */ - 0x0000ffff, /* src_mask */ - 0x0000ffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Low 16 bits of displacement in global offset table. */ - /* FIXME: Not handled correctly. */ - HOWTO (R_MIPS_GOT_LO16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_GOT_LO16", /* name */ - true, /* partial_inplace */ - 0x0000ffff, /* src_mask */ - 0x0000ffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* 64 bit substraction. */ - /* FIXME: Not handled correctly. */ - HOWTO (R_MIPS_SUB, /* type */ - 0, /* rightshift */ - 4, /* size (0 = byte, 1 = short, 2 = long) */ - 64, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_SUB", /* name */ - true, /* partial_inplace */ - MINUS_ONE, /* src_mask */ - MINUS_ONE, /* dst_mask */ - false), /* pcrel_offset */ - - /* Insert the addend as an instruction. */ - /* FIXME: Not handled correctly. */ - HOWTO (R_MIPS_INSERT_A, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_INSERT_A", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - false), /* pcrel_offset */ - - /* Insert the addend as an instruction, and change all relocations - to refer to the old instruction at the address. */ - /* FIXME: Not handled correctly. */ - HOWTO (R_MIPS_INSERT_B, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_INSERT_B", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - false), /* pcrel_offset */ - - /* Delete a 32 bit instruction. */ - /* FIXME: Not handled correctly. */ - HOWTO (R_MIPS_DELETE, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_DELETE", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - false), /* pcrel_offset */ - - /* Get the higher value of a 64 bit addend. */ - /* FIXME: Not handled correctly. */ - HOWTO (R_MIPS_HIGHER, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_HIGHER", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Get the highest value of a 64 bit addend. */ - /* FIXME: Not handled correctly. */ - HOWTO (R_MIPS_HIGHEST, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_HIGHEST", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* High 16 bits of displacement in global offset table. */ - /* FIXME: Not handled correctly. */ - HOWTO (R_MIPS_CALL_HI16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_CALL_HI16", /* name */ - true, /* partial_inplace */ - 0x0000ffff, /* src_mask */ - 0x0000ffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Low 16 bits of displacement in global offset table. */ - /* FIXME: Not handled correctly. */ - HOWTO (R_MIPS_CALL_LO16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_CALL_LO16", /* name */ - true, /* partial_inplace */ - 0x0000ffff, /* src_mask */ - 0x0000ffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* I'm not sure what the remaining relocs are, but they are defined - on Irix 6. */ - - HOWTO (R_MIPS_SCN_DISP, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_SCN_DISP", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - false), /* pcrel_offset */ - - HOWTO (R_MIPS_REL16, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_REL16", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - false), /* pcrel_offset */ - - HOWTO (R_MIPS_ADD_IMMEDIATE, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_ADD_IMMEDIATE", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - false), /* pcrel_offset */ - - HOWTO (R_MIPS_PJUMP, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_PJUMP", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - false), /* pcrel_offset */ - - HOWTO (R_MIPS_RELGOT, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_RELGOT", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - false), /* pcrel_offset */ - - /* Protected jump conversion. This is an optimization hint. No - relocation is required for correctness. */ - HOWTO (R_MIPS_JALR, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_JALR", /* name */ - false, /* partial_inplace */ - 0x00000000, /* src_mask */ - 0x00000000, /* dst_mask */ - false), /* pcrel_offset */ -}; - -/* The relocation table used for SHT_RELA sections. */ - -static reloc_howto_type mips_elf64_howto_table_rela[] = -{ - /* No relocation. */ - HOWTO (R_MIPS_NONE, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_NONE", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - false), /* pcrel_offset */ - - /* 16 bit relocation. */ - HOWTO (R_MIPS_16, /* type */ - 0, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_16", /* name */ - true, /* partial_inplace */ - 0, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* 32 bit relocation. */ - HOWTO (R_MIPS_32, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_32", /* name */ - true, /* partial_inplace */ - 0, /* src_mask */ - 0xffffffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* 32 bit symbol relative relocation. */ - HOWTO (R_MIPS_REL32, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_REL32", /* name */ - true, /* partial_inplace */ - 0, /* src_mask */ - 0xffffffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* 26 bit branch address. */ - HOWTO (R_MIPS_26, /* type */ - 2, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 26, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - /* This needs complex overflow - detection, because the upper four - bits must match the PC. */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_26", /* name */ - true, /* partial_inplace */ - 0, /* src_mask */ - 0x3ffffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* High 16 bits of symbol value. */ - HOWTO (R_MIPS_HI16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_HI16", /* name */ - true, /* partial_inplace */ - 0, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Low 16 bits of symbol value. */ - HOWTO (R_MIPS_LO16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_LO16", /* name */ - true, /* partial_inplace */ - 0, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* GP relative reference. */ - HOWTO (R_MIPS_GPREL16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - _bfd_mips_elf_gprel16_reloc, /* special_function */ - "R_MIPS_GPREL16", /* name */ - true, /* partial_inplace */ - 0, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Reference to literal section. */ - HOWTO (R_MIPS_LITERAL, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - _bfd_mips_elf_gprel16_reloc, /* special_function */ - "R_MIPS_LITERAL", /* name */ - true, /* partial_inplace */ - 0, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Reference to global offset table. */ - /* FIXME: This is not handled correctly. */ - HOWTO (R_MIPS_GOT16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_GOT16", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* 16 bit PC relative reference. */ - HOWTO (R_MIPS_PC16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - true, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_PC16", /* name */ - true, /* partial_inplace */ - 0, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* 16 bit call through global offset table. */ - /* FIXME: This is not handled correctly. */ - HOWTO (R_MIPS_CALL16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_CALL16", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* 32 bit GP relative reference. */ - HOWTO (R_MIPS_GPREL32, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - _bfd_mips_elf_gprel32_reloc, /* special_function */ - "R_MIPS_GPREL32", /* name */ - true, /* partial_inplace */ - 0, /* src_mask */ - 0xffffffff, /* dst_mask */ - false), /* pcrel_offset */ - - { 13 }, - { 14 }, - { 15 }, - - /* A 5 bit shift field. */ - HOWTO (R_MIPS_SHIFT5, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 5, /* bitsize */ - false, /* pc_relative */ - 6, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_SHIFT5", /* name */ - true, /* partial_inplace */ - 0, /* src_mask */ - 0x000007c0, /* dst_mask */ - false), /* pcrel_offset */ - - /* A 6 bit shift field. */ - /* FIXME: This is not handled correctly; a special function is - needed to put the most significant bit in the right place. */ - HOWTO (R_MIPS_SHIFT6, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 6, /* bitsize */ - false, /* pc_relative */ - 6, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_SHIFT6", /* name */ - true, /* partial_inplace */ - 0, /* src_mask */ - 0x000007c4, /* dst_mask */ - false), /* pcrel_offset */ - - /* 64 bit relocation. */ - HOWTO (R_MIPS_64, /* type */ - 0, /* rightshift */ - 4, /* size (0 = byte, 1 = short, 2 = long) */ - 64, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_64", /* name */ - true, /* partial_inplace */ - 0, /* src_mask */ - MINUS_ONE, /* dst_mask */ - false), /* pcrel_offset */ - - /* Displacement in the global offset table. */ - /* FIXME: Not handled correctly. */ - HOWTO (R_MIPS_GOT_DISP, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_GOT_DISP", /* name */ - true, /* partial_inplace */ - 0, /* src_mask */ - 0x0000ffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Displacement to page pointer in the global offset table. */ - /* FIXME: Not handled correctly. */ - HOWTO (R_MIPS_GOT_PAGE, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_GOT_PAGE", /* name */ - true, /* partial_inplace */ - 0, /* src_mask */ - 0x0000ffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Offset from page pointer in the global offset table. */ - /* FIXME: Not handled correctly. */ - HOWTO (R_MIPS_GOT_OFST, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_GOT_OFST", /* name */ - true, /* partial_inplace */ - 0, /* src_mask */ - 0x0000ffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* High 16 bits of displacement in global offset table. */ - /* FIXME: Not handled correctly. */ - HOWTO (R_MIPS_GOT_HI16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_GOT_HI16", /* name */ - true, /* partial_inplace */ - 0, /* src_mask */ - 0x0000ffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Low 16 bits of displacement in global offset table. */ - /* FIXME: Not handled correctly. */ - HOWTO (R_MIPS_GOT_LO16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_GOT_LO16", /* name */ - true, /* partial_inplace */ - 0, /* src_mask */ - 0x0000ffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* 64 bit substraction. */ - /* FIXME: Not handled correctly. */ - HOWTO (R_MIPS_SUB, /* type */ - 0, /* rightshift */ - 4, /* size (0 = byte, 1 = short, 2 = long) */ - 64, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_SUB", /* name */ - true, /* partial_inplace */ - 0, /* src_mask */ - MINUS_ONE, /* dst_mask */ - false), /* pcrel_offset */ - - /* Insert the addend as an instruction. */ - /* FIXME: Not handled correctly. */ - HOWTO (R_MIPS_INSERT_A, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_INSERT_A", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - false), /* pcrel_offset */ - - /* Insert the addend as an instruction, and change all relocations - to refer to the old instruction at the address. */ - /* FIXME: Not handled correctly. */ - HOWTO (R_MIPS_INSERT_B, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_INSERT_B", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - false), /* pcrel_offset */ - - /* Delete a 32 bit instruction. */ - /* FIXME: Not handled correctly. */ - HOWTO (R_MIPS_DELETE, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_DELETE", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - false), /* pcrel_offset */ - - /* Get the higher value of a 64 bit addend. */ - /* FIXME: Not handled correctly. */ - HOWTO (R_MIPS_HIGHER, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_HIGHER", /* name */ - true, /* partial_inplace */ - 0, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Get the highest value of a 64 bit addend. */ - /* FIXME: Not handled correctly. */ - HOWTO (R_MIPS_HIGHEST, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_HIGHEST", /* name */ - true, /* partial_inplace */ - 0, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* High 16 bits of displacement in global offset table. */ - /* FIXME: Not handled correctly. */ - HOWTO (R_MIPS_CALL_HI16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_CALL_HI16", /* name */ - true, /* partial_inplace */ - 0, /* src_mask */ - 0x0000ffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Low 16 bits of displacement in global offset table. */ - /* FIXME: Not handled correctly. */ - HOWTO (R_MIPS_CALL_LO16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_CALL_LO16", /* name */ - true, /* partial_inplace */ - 0, /* src_mask */ - 0x0000ffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* I'm not sure what the remaining relocs are, but they are defined - on Irix 6. */ - - HOWTO (R_MIPS_SCN_DISP, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_SCN_DISP", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - false), /* pcrel_offset */ - - HOWTO (R_MIPS_REL16, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_REL16", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - false), /* pcrel_offset */ - - HOWTO (R_MIPS_ADD_IMMEDIATE, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_ADD_IMMEDIATE", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - false), /* pcrel_offset */ - - HOWTO (R_MIPS_PJUMP, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_PJUMP", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - false), /* pcrel_offset */ - - HOWTO (R_MIPS_RELGOT, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_RELGOT", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - false), /* pcrel_offset */ - - /* Protected jump conversion. This is an optimization hint. No - relocation is required for correctness. */ - HOWTO (R_MIPS_JALR, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_JALR", /* name */ - false, /* partial_inplace */ - 0x00000000, /* src_mask */ - 0x00000000, /* dst_mask */ - false), /* pcrel_offset */ -}; - -/* Swap in a MIPS 64-bit Rel reloc. */ - -static void -mips_elf64_swap_reloc_in (abfd, src, dst) - bfd *abfd; - const Elf64_Mips_External_Rel *src; - Elf64_Mips_Internal_Rel *dst; -{ - dst->r_offset = bfd_h_get_64 (abfd, (bfd_byte *) src->r_offset); - dst->r_sym = bfd_h_get_32 (abfd, (bfd_byte *) src->r_sym); - dst->r_ssym = bfd_h_get_8 (abfd, (bfd_byte *) src->r_ssym); - dst->r_type3 = bfd_h_get_8 (abfd, (bfd_byte *) src->r_type3); - dst->r_type2 = bfd_h_get_8 (abfd, (bfd_byte *) src->r_type2); - dst->r_type = bfd_h_get_8 (abfd, (bfd_byte *) src->r_type); -} - -/* Swap in a MIPS 64-bit Rela reloc. */ - -static void -mips_elf64_swap_reloca_in (abfd, src, dst) - bfd *abfd; - const Elf64_Mips_External_Rela *src; - Elf64_Mips_Internal_Rela *dst; -{ - dst->r_offset = bfd_h_get_64 (abfd, (bfd_byte *) src->r_offset); - dst->r_sym = bfd_h_get_32 (abfd, (bfd_byte *) src->r_sym); - dst->r_ssym = bfd_h_get_8 (abfd, (bfd_byte *) src->r_ssym); - dst->r_type3 = bfd_h_get_8 (abfd, (bfd_byte *) src->r_type3); - dst->r_type2 = bfd_h_get_8 (abfd, (bfd_byte *) src->r_type2); - dst->r_type = bfd_h_get_8 (abfd, (bfd_byte *) src->r_type); - dst->r_addend = bfd_h_get_signed_64 (abfd, (bfd_byte *) src->r_addend); -} - -/* Swap out a MIPS 64-bit Rel reloc. */ - -static void -mips_elf64_swap_reloc_out (abfd, src, dst) - bfd *abfd; - const Elf64_Mips_Internal_Rel *src; - Elf64_Mips_External_Rel *dst; -{ - bfd_h_put_64 (abfd, src->r_offset, (bfd_byte *) dst->r_offset); - bfd_h_put_32 (abfd, src->r_sym, (bfd_byte *) dst->r_sym); - bfd_h_put_8 (abfd, src->r_ssym, (bfd_byte *) dst->r_ssym); - bfd_h_put_8 (abfd, src->r_type3, (bfd_byte *) dst->r_type3); - bfd_h_put_8 (abfd, src->r_type2, (bfd_byte *) dst->r_type2); - bfd_h_put_8 (abfd, src->r_type, (bfd_byte *) dst->r_type); -} - -/* Swap out a MIPS 64-bit Rela reloc. */ - -static void -mips_elf64_swap_reloca_out (abfd, src, dst) - bfd *abfd; - const Elf64_Mips_Internal_Rela *src; - Elf64_Mips_External_Rela *dst; -{ - bfd_h_put_64 (abfd, src->r_offset, (bfd_byte *) dst->r_offset); - bfd_h_put_32 (abfd, src->r_sym, (bfd_byte *) dst->r_sym); - bfd_h_put_8 (abfd, src->r_ssym, (bfd_byte *) dst->r_ssym); - bfd_h_put_8 (abfd, src->r_type3, (bfd_byte *) dst->r_type3); - bfd_h_put_8 (abfd, src->r_type2, (bfd_byte *) dst->r_type2); - bfd_h_put_8 (abfd, src->r_type, (bfd_byte *) dst->r_type); - bfd_h_put_64 (abfd, src->r_addend, (bfd_byte *) dst->r_addend); -} - -/* Swap in a MIPS 64-bit Rel reloc. */ - -static void -mips_elf64_be_swap_reloc_in (abfd, src, dst) - bfd *abfd; - const bfd_byte *src; - Elf_Internal_Rel *dst; -{ - Elf64_Mips_Internal_Rel mirel; - - mips_elf64_swap_reloc_in (abfd, - (const Elf64_Mips_External_Rel *) src, - &mirel); - - dst[0].r_offset = mirel.r_offset; - dst[0].r_info = ELF32_R_INFO (mirel.r_sym, mirel.r_type); - dst[1].r_offset = mirel.r_offset; - dst[1].r_info = ELF32_R_INFO (mirel.r_ssym, mirel.r_type2); - dst[2].r_offset = mirel.r_offset; - dst[2].r_info = ELF32_R_INFO (STN_UNDEF, mirel.r_type3); -} - -/* Swap in a MIPS 64-bit Rela reloc. */ - -static void -mips_elf64_be_swap_reloca_in (abfd, src, dst) - bfd *abfd; - const bfd_byte *src; - Elf_Internal_Rela *dst; -{ - Elf64_Mips_Internal_Rela mirela; - - mips_elf64_swap_reloca_in (abfd, - (const Elf64_Mips_External_Rela *) src, - &mirela); - - dst[0].r_offset = mirela.r_offset; - dst[0].r_info = ELF32_R_INFO (mirela.r_sym, mirela.r_type); - dst[0].r_addend = mirela.r_addend; - dst[1].r_offset = mirela.r_offset; - dst[1].r_info = ELF32_R_INFO (mirela.r_ssym, mirela.r_type2); - dst[1].r_addend = 0; - dst[2].r_offset = mirela.r_offset; - dst[2].r_info = ELF32_R_INFO (STN_UNDEF, mirela.r_type3); - dst[2].r_addend = 0; -} - -/* Swap out a MIPS 64-bit Rel reloc. */ - -static void -mips_elf64_be_swap_reloc_out (abfd, src, dst) - bfd *abfd; - const Elf_Internal_Rel *src; - bfd_byte *dst; -{ - Elf64_Mips_Internal_Rel mirel; - - mirel.r_offset = src->r_offset; - mirel.r_type = ELF32_R_TYPE (src->r_info); - mirel.r_sym = ELF32_R_SYM (src->r_info); - mirel.r_type2 = R_MIPS_NONE; - mirel.r_ssym = STN_UNDEF; - mirel.r_type3 = R_MIPS_NONE; - - mips_elf64_swap_reloc_out (abfd, &mirel, - (Elf64_Mips_External_Rel *) dst); -} - -/* Swap out a MIPS 64-bit Rela reloc. */ - -static void -mips_elf64_be_swap_reloca_out (abfd, src, dst) - bfd *abfd; - const Elf_Internal_Rela *src; - bfd_byte *dst; -{ - Elf64_Mips_Internal_Rela mirela; - - mirela.r_offset = src->r_offset; - mirela.r_type = ELF32_R_TYPE (src->r_info); - mirela.r_addend = src->r_addend; - mirela.r_sym = ELF32_R_SYM (src->r_info); - mirela.r_type2 = R_MIPS_NONE; - mirela.r_ssym = STN_UNDEF; - mirela.r_type3 = R_MIPS_NONE; - - mips_elf64_swap_reloca_out (abfd, &mirela, - (Elf64_Mips_External_Rela *) dst); -} - -/* A mapping from BFD reloc types to MIPS ELF reloc types. */ - -struct elf_reloc_map -{ - bfd_reloc_code_real_type bfd_reloc_val; - enum elf_mips_reloc_type elf_reloc_val; -}; - -static CONST struct elf_reloc_map mips_reloc_map[] = -{ - { BFD_RELOC_NONE, R_MIPS_NONE, }, - { BFD_RELOC_16, R_MIPS_16 }, - { BFD_RELOC_32, R_MIPS_32 }, - { BFD_RELOC_64, R_MIPS_64 }, - { BFD_RELOC_CTOR, R_MIPS_64 }, - { BFD_RELOC_32_PCREL, R_MIPS_REL32 }, - { BFD_RELOC_MIPS_JMP, R_MIPS_26 }, - { BFD_RELOC_HI16_S, R_MIPS_HI16 }, - { BFD_RELOC_LO16, R_MIPS_LO16 }, - { BFD_RELOC_MIPS_GPREL, R_MIPS_GPREL16 }, - { BFD_RELOC_MIPS_LITERAL, R_MIPS_LITERAL }, - { BFD_RELOC_MIPS_GOT16, R_MIPS_GOT16 }, - { BFD_RELOC_16_PCREL, R_MIPS_PC16 }, - { BFD_RELOC_MIPS_CALL16, R_MIPS_CALL16 }, - { BFD_RELOC_MIPS_GPREL32, R_MIPS_GPREL32 }, - { BFD_RELOC_MIPS_GOT_HI16, R_MIPS_GOT_HI16 }, - { BFD_RELOC_MIPS_GOT_LO16, R_MIPS_GOT_LO16 }, - { BFD_RELOC_MIPS_CALL_HI16, R_MIPS_CALL_HI16 }, - { BFD_RELOC_MIPS_CALL_LO16, R_MIPS_CALL_LO16 }, - { BFD_RELOC_MIPS_SUB, R_MIPS_SUB }, - { BFD_RELOC_MIPS_GOT_PAGE, R_MIPS_GOT_PAGE }, - { BFD_RELOC_MIPS_GOT_OFST, R_MIPS_GOT_OFST }, - { BFD_RELOC_MIPS_GOT_DISP, R_MIPS_GOT_DISP } -}; - -/* Given a BFD reloc type, return a howto structure. */ - -static reloc_howto_type * -mips_elf64_reloc_type_lookup (abfd, code) - bfd *abfd; - bfd_reloc_code_real_type code; -{ - unsigned int i; - - for (i = 0; i < sizeof (mips_reloc_map) / sizeof (struct elf_reloc_map); i++) - { - if (mips_reloc_map[i].bfd_reloc_val == code) - { - int v; - - v = (int) mips_reloc_map[i].elf_reloc_val; - return &mips_elf64_howto_table_rel[v]; - } - } - - return NULL; -} - -/* Since each entry in an SHT_REL or SHT_RELA section can represent up - to three relocs, we must tell the user to allocate more space. */ - -static long -mips_elf64_get_reloc_upper_bound (abfd, sec) - bfd *abfd; - asection *sec; -{ - return (sec->reloc_count * 3 + 1) * sizeof (arelent *); -} - -/* Read the relocations from one reloc section. */ - -static boolean -mips_elf64_slurp_one_reloc_table (abfd, asect, symbols, rel_hdr) - bfd *abfd; - asection *asect; - asymbol **symbols; - const Elf_Internal_Shdr *rel_hdr; -{ - PTR allocated = NULL; - bfd_byte *native_relocs; - arelent *relents; - arelent *relent; - unsigned int count; - unsigned int i; - int entsize; - reloc_howto_type *howto_table; - - allocated = (PTR) bfd_malloc (rel_hdr->sh_size); - if (allocated == NULL) - goto error_return; - - if (bfd_seek (abfd, rel_hdr->sh_offset, SEEK_SET) != 0 - || (bfd_read (allocated, 1, rel_hdr->sh_size, abfd) != rel_hdr->sh_size)) - goto error_return; - - native_relocs = (bfd_byte *) allocated; - - relents = asect->relocation + asect->reloc_count; - - entsize = rel_hdr->sh_entsize; - BFD_ASSERT (entsize == sizeof (Elf64_Mips_External_Rel) - || entsize == sizeof (Elf64_Mips_External_Rela)); - - count = rel_hdr->sh_size / entsize; - - if (entsize == sizeof (Elf64_Mips_External_Rel)) - howto_table = mips_elf64_howto_table_rel; - else - howto_table = mips_elf64_howto_table_rela; - - relent = relents; - for (i = 0; i < count; i++, native_relocs += entsize) - { - Elf64_Mips_Internal_Rela rela; - boolean used_sym, used_ssym; - int ir; - - if (entsize == sizeof (Elf64_Mips_External_Rela)) - mips_elf64_swap_reloca_in (abfd, - (Elf64_Mips_External_Rela *) native_relocs, - &rela); - else - { - Elf64_Mips_Internal_Rel rel; - - mips_elf64_swap_reloc_in (abfd, - (Elf64_Mips_External_Rel *) native_relocs, - &rel); - rela.r_offset = rel.r_offset; - rela.r_sym = rel.r_sym; - rela.r_ssym = rel.r_ssym; - rela.r_type3 = rel.r_type3; - rela.r_type2 = rel.r_type2; - rela.r_type = rel.r_type; - rela.r_addend = 0; - } - - /* Each entry represents up to three actual relocations. */ - - used_sym = false; - used_ssym = false; - for (ir = 0; ir < 3; ir++) - { - enum elf_mips_reloc_type type; - - switch (ir) - { - default: - abort (); - case 0: - type = (enum elf_mips_reloc_type) rela.r_type; - break; - case 1: - type = (enum elf_mips_reloc_type) rela.r_type2; - break; - case 2: - type = (enum elf_mips_reloc_type) rela.r_type3; - break; - } - - if (type == R_MIPS_NONE) - { - /* There are no more relocations in this entry. If this - is the first entry, we need to generate a dummy - relocation so that the generic linker knows that - there has been a break in the sequence of relocations - applying to a particular address. */ - if (ir == 0) - { - relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; - if ((abfd->flags & (EXEC_P | DYNAMIC)) == 0) - relent->address = rela.r_offset; - else - relent->address = rela.r_offset - asect->vma; - relent->addend = 0; - relent->howto = &howto_table[(int) R_MIPS_NONE]; - ++relent; - } - break; - } - - /* Some types require symbols, whereas some do not. */ - switch (type) - { - case R_MIPS_NONE: - case R_MIPS_LITERAL: - case R_MIPS_INSERT_A: - case R_MIPS_INSERT_B: - case R_MIPS_DELETE: - relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; - break; - - default: - if (! used_sym) - { - if (rela.r_sym == 0) - relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; - else - { - asymbol **ps, *s; - - ps = symbols + rela.r_sym - 1; - s = *ps; - if ((s->flags & BSF_SECTION_SYM) == 0) - relent->sym_ptr_ptr = ps; - else - relent->sym_ptr_ptr = s->section->symbol_ptr_ptr; - } - - used_sym = true; - } - else if (! used_ssym) - { - switch (rela.r_ssym) - { - case RSS_UNDEF: - relent->sym_ptr_ptr = - bfd_abs_section_ptr->symbol_ptr_ptr; - break; - - case RSS_GP: - case RSS_GP0: - case RSS_LOC: - /* FIXME: I think these need to be handled using - special howto structures. */ - BFD_ASSERT (0); - break; - - default: - BFD_ASSERT (0); - break; - } - - used_ssym = true; - } - else - relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; - - break; - } - - /* The address of an ELF reloc is section relative for an - object file, and absolute for an executable file or - shared library. The address of a BFD reloc is always - section relative. */ - if ((abfd->flags & (EXEC_P | DYNAMIC)) == 0) - relent->address = rela.r_offset; - else - relent->address = rela.r_offset - asect->vma; - - relent->addend = rela.r_addend; - - relent->howto = &howto_table[(int) type]; - - ++relent; - } - } - - asect->reloc_count += relent - relents; - - if (allocated != NULL) - free (allocated); - - return true; - - error_return: - if (allocated != NULL) - free (allocated); - return false; -} - -/* Read the relocations. On Irix 6, there can be two reloc sections - associated with a single data section. */ - -static boolean -mips_elf64_slurp_reloc_table (abfd, asect, symbols, dynamic) - bfd *abfd; - asection *asect; - asymbol **symbols; - boolean dynamic; -{ - struct bfd_elf_section_data * const d = elf_section_data (asect); - - if (dynamic) - { - bfd_set_error (bfd_error_invalid_operation); - return false; - } - - if (asect->relocation != NULL - || (asect->flags & SEC_RELOC) == 0 - || asect->reloc_count == 0) - return true; - - /* Allocate space for 3 arelent structures for each Rel structure. */ - asect->relocation = ((arelent *) - bfd_alloc (abfd, - asect->reloc_count * 3 * sizeof (arelent))); - if (asect->relocation == NULL) - return false; - - /* The slurp_one_reloc_table routine increments reloc_count. */ - asect->reloc_count = 0; - - if (! mips_elf64_slurp_one_reloc_table (abfd, asect, symbols, &d->rel_hdr)) - return false; - if (d->rel_hdr2 != NULL) - { - if (! mips_elf64_slurp_one_reloc_table (abfd, asect, symbols, - d->rel_hdr2)) - return false; - } - - return true; -} - -/* Write out the relocations. */ - -static void -mips_elf64_write_relocs (abfd, sec, data) - bfd *abfd; - asection *sec; - PTR data; -{ - boolean *failedp = (boolean *) data; - unsigned int count; - Elf_Internal_Shdr *rela_hdr; - Elf64_Mips_External_Rela *ext_rela; - unsigned int idx; - asymbol *last_sym = 0; - int last_sym_idx = 0; - - /* If we have already failed, don't do anything. */ - if (*failedp) - return; - - if ((sec->flags & SEC_RELOC) == 0) - return; - - /* The linker backend writes the relocs out itself, and sets the - reloc_count field to zero to inhibit writing them here. Also, - sometimes the SEC_RELOC flag gets set even when there aren't any - relocs. */ - if (sec->reloc_count == 0) - return; - - /* We can combine up to three relocs that refer to the same address - if the latter relocs have no associated symbol. */ - count = 0; - for (idx = 0; idx < sec->reloc_count; idx++) - { - bfd_vma addr; - unsigned int i; - - ++count; - - addr = sec->orelocation[idx]->address; - for (i = 0; i < 2; i++) - { - arelent *r; - - if (idx + 1 >= sec->reloc_count) - break; - r = sec->orelocation[idx + 1]; - if (r->address != addr - || ! bfd_is_abs_section ((*r->sym_ptr_ptr)->section) - || (*r->sym_ptr_ptr)->value != 0) - break; - - /* We can merge the reloc at IDX + 1 with the reloc at IDX. */ - - ++idx; - } - } - - rela_hdr = &elf_section_data (sec)->rel_hdr; - - rela_hdr->sh_size = rela_hdr->sh_entsize * count; - rela_hdr->contents = (PTR) bfd_alloc (abfd, rela_hdr->sh_size); - if (rela_hdr->contents == NULL) - { - *failedp = true; - return; - } - - ext_rela = (Elf64_Mips_External_Rela *) rela_hdr->contents; - for (idx = 0; idx < sec->reloc_count; idx++, ext_rela++) - { - arelent *ptr; - Elf64_Mips_Internal_Rela int_rela; - asymbol *sym; - int n; - unsigned int i; - - ptr = sec->orelocation[idx]; - - /* The address of an ELF reloc is section relative for an object - file, and absolute for an executable file or shared library. - The address of a BFD reloc is always section relative. */ - if ((abfd->flags & (EXEC_P | DYNAMIC)) == 0) - int_rela.r_offset = ptr->address; - else - int_rela.r_offset = ptr->address + sec->vma; - - sym = *ptr->sym_ptr_ptr; - if (sym == last_sym) - n = last_sym_idx; - else - { - last_sym = sym; - n = _bfd_elf_symbol_from_bfd_symbol (abfd, &sym); - if (n < 0) - { - *failedp = true; - return; - } - last_sym_idx = n; - } - - int_rela.r_sym = n; - - int_rela.r_addend = ptr->addend; - - int_rela.r_ssym = RSS_UNDEF; - - if ((*ptr->sym_ptr_ptr)->the_bfd->xvec != abfd->xvec - && ! _bfd_elf_validate_reloc (abfd, ptr)) - { - *failedp = true; - return; - } - - int_rela.r_type = ptr->howto->type; - int_rela.r_type2 = (int) R_MIPS_NONE; - int_rela.r_type3 = (int) R_MIPS_NONE; - - for (i = 0; i < 2; i++) - { - arelent *r; - - if (idx + 1 >= sec->reloc_count) - break; - r = sec->orelocation[idx + 1]; - if (r->address != ptr->address - || ! bfd_is_abs_section ((*r->sym_ptr_ptr)->section) - || (*r->sym_ptr_ptr)->value != 0) - break; - - /* We can merge the reloc at IDX + 1 with the reloc at IDX. */ - - if (i == 0) - int_rela.r_type2 = r->howto->type; - else - int_rela.r_type3 = r->howto->type; - - ++idx; - } - - mips_elf64_swap_reloca_out (abfd, &int_rela, ext_rela); - } - - BFD_ASSERT (ext_rela - (Elf64_Mips_External_Rela *) rela_hdr->contents - == count); -} - -/* Irix 6 defines a brand new archive map format, so that they can - have archives more than 4 GB in size. */ - -/* Read an Irix 6 armap. */ - -static boolean -mips_elf64_slurp_armap (abfd) - bfd *abfd; -{ - struct artdata *ardata = bfd_ardata (abfd); - char nextname[17]; - file_ptr arhdrpos; - bfd_size_type i, parsed_size, nsymz, stringsize, carsym_size, ptrsize; - struct areltdata *mapdata; - bfd_byte int_buf[8]; - char *stringbase; - bfd_byte *raw_armap = NULL; - carsym *carsyms; - - ardata->symdefs = NULL; - - /* Get the name of the first element. */ - arhdrpos = bfd_tell (abfd); - 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; - - /* Archives with traditional armaps are still permitted. */ - if (strncmp (nextname, "/ ", 16) == 0) - return bfd_slurp_armap (abfd); - - if (strncmp (nextname, "/SYM64/ ", 16) != 0) - { - bfd_has_map (abfd) = false; - return true; - } - - mapdata = (struct areltdata *) _bfd_read_ar_hdr (abfd); - if (mapdata == NULL) - return false; - parsed_size = mapdata->parsed_size; - bfd_release (abfd, (PTR) mapdata); - - if (bfd_read (int_buf, 1, 8, abfd) != 8) - { - if (bfd_get_error () != bfd_error_system_call) - bfd_set_error (bfd_error_malformed_archive); - return false; - } - - nsymz = bfd_getb64 (int_buf); - stringsize = parsed_size - 8 * nsymz - 8; - - carsym_size = nsymz * sizeof (carsym); - ptrsize = 8 * 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; - - raw_armap = (bfd_byte *) bfd_alloc (abfd, ptrsize); - if (raw_armap == NULL) - goto error_return; - - if (bfd_read (raw_armap, 1, ptrsize, abfd) != ptrsize - || bfd_read (stringbase, 1, stringsize, abfd) != stringsize) - { - if (bfd_get_error () != bfd_error_system_call) - bfd_set_error (bfd_error_malformed_archive); - goto error_return; - } - - for (i = 0; i < nsymz; i++) - { - carsyms->file_offset = bfd_getb64 (raw_armap + i * 8); - carsyms->name = stringbase; - stringbase += strlen (stringbase) + 1; - ++carsyms; - } - *stringbase = '\0'; - - ardata->symdef_count = nsymz; - ardata->first_file_filepos = arhdrpos + sizeof (struct ar_hdr) + parsed_size; - - bfd_has_map (abfd) = true; - bfd_release (abfd, raw_armap); - - return true; - - error_return: - if (raw_armap != NULL) - bfd_release (abfd, raw_armap); - if (ardata->symdefs != NULL) - bfd_release (abfd, ardata->symdefs); - return false; -} - -/* Write out an Irix 6 armap. The Irix 6 tools are supposed to be - able to handle ordinary ELF armaps, but at least on Irix 6.2 the - linker crashes. */ - -static boolean -mips_elf64_write_armap (arch, elength, map, symbol_count, stridx) - bfd *arch; - unsigned int elength; - struct orl *map; - unsigned int symbol_count; - int stridx; -{ - unsigned int ranlibsize = (symbol_count * 8) + 8; - 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 padding; - bfd_byte buf[8]; - - padding = BFD_ALIGN (mapsize, 8) - mapsize; - mapsize += padding; - - /* 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)); - strcpy (hdr.ar_name, "/SYM64/"); - 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_putb64 (symbol_count, buf); - if (bfd_write (buf, 1, 8, arch) != 8) - return false; - - /* 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_putb64 (archive_member_file_ptr, buf); - if (bfd_write (buf, 1, 8, arch) != 8) - return false; - count++; - } - /* Add size of this archive entry */ - archive_member_file_ptr += (arelt_size (current) - + sizeof (struct ar_hdr)); - /* remember about 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 says that this should be padded to an 8 byte boundary. - However, the Irix 6.2 tools do not appear to do this. */ - while (padding != 0) - { - if (bfd_write ("", 1, 1, arch) != 1) - return false; - --padding; - } - - return true; -} - -/* ECOFF swapping routines. These are used when dealing with the - .mdebug section, which is in the ECOFF debugging format. */ -static const struct ecoff_debug_swap mips_elf64_ecoff_debug_swap = -{ - /* Symbol table magic number. */ - magicSym2, - /* Alignment of debugging information. E.g., 4. */ - 8, - /* Sizes of external symbolic information. */ - sizeof (struct hdr_ext), - sizeof (struct dnr_ext), - sizeof (struct pdr_ext), - sizeof (struct sym_ext), - sizeof (struct opt_ext), - sizeof (struct fdr_ext), - sizeof (struct rfd_ext), - sizeof (struct ext_ext), - /* Functions to swap in external symbolic data. */ - ecoff_swap_hdr_in, - ecoff_swap_dnr_in, - ecoff_swap_pdr_in, - ecoff_swap_sym_in, - ecoff_swap_opt_in, - ecoff_swap_fdr_in, - ecoff_swap_rfd_in, - ecoff_swap_ext_in, - _bfd_ecoff_swap_tir_in, - _bfd_ecoff_swap_rndx_in, - /* Functions to swap out external symbolic data. */ - ecoff_swap_hdr_out, - ecoff_swap_dnr_out, - ecoff_swap_pdr_out, - ecoff_swap_sym_out, - ecoff_swap_opt_out, - ecoff_swap_fdr_out, - ecoff_swap_rfd_out, - ecoff_swap_ext_out, - _bfd_ecoff_swap_tir_out, - _bfd_ecoff_swap_rndx_out, - /* Function to read in symbolic data. */ - _bfd_mips_elf_read_ecoff_info -}; - -/* Relocations in the 64 bit MIPS ELF ABI are more complex than in - standard ELF. This structure is used to redirect the relocation - handling routines. */ - -const struct elf_size_info mips_elf64_size_info = -{ - sizeof (Elf64_External_Ehdr), - sizeof (Elf64_External_Phdr), - sizeof (Elf64_External_Shdr), - sizeof (Elf64_Mips_External_Rel), - sizeof (Elf64_Mips_External_Rela), - sizeof (Elf64_External_Sym), - sizeof (Elf64_External_Dyn), - sizeof (Elf_External_Note), - 4, /* hash-table entry size */ - 3, /* internal relocations per external relocations */ - 64, /* arch_size */ - 8, /* file_align */ - ELFCLASS64, - EV_CURRENT, - bfd_elf64_write_out_phdrs, - bfd_elf64_write_shdrs_and_ehdr, - mips_elf64_write_relocs, - bfd_elf64_swap_symbol_out, - mips_elf64_slurp_reloc_table, - bfd_elf64_slurp_symbol_table, - bfd_elf64_swap_dyn_in, - bfd_elf64_swap_dyn_out, - mips_elf64_be_swap_reloc_in, - mips_elf64_be_swap_reloc_out, - mips_elf64_be_swap_reloca_in, - mips_elf64_be_swap_reloca_out -}; - -#define TARGET_LITTLE_SYM bfd_elf64_littlemips_vec -#define TARGET_LITTLE_NAME "elf64-littlemips" -#define TARGET_BIG_SYM bfd_elf64_bigmips_vec -#define TARGET_BIG_NAME "elf64-bigmips" -#define ELF_ARCH bfd_arch_mips -#define ELF_MACHINE_CODE EM_MIPS - -#define ELF_MAXPAGESIZE 0x1000 - -#define elf_backend_collect true -#define elf_backend_type_change_ok true -#define elf_backend_can_gc_sections true -#define elf_backend_size_info mips_elf64_size_info -#define elf_backend_object_p _bfd_mips_elf_object_p -#define elf_backend_section_from_shdr _bfd_mips_elf_section_from_shdr -#define elf_backend_fake_sections _bfd_mips_elf_fake_sections -#define elf_backend_section_from_bfd_section \ - _bfd_mips_elf_section_from_bfd_section -#define elf_backend_section_processing _bfd_mips_elf_section_processing -#define elf_backend_symbol_processing _bfd_mips_elf_symbol_processing -#define elf_backend_additional_program_headers \ - _bfd_mips_elf_additional_program_headers -#define elf_backend_modify_segment_map _bfd_mips_elf_modify_segment_map -#define elf_backend_final_write_processing \ - _bfd_mips_elf_final_write_processing -#define elf_backend_ecoff_debug_swap &mips_elf64_ecoff_debug_swap -#define elf_backend_add_symbol_hook _bfd_mips_elf_add_symbol_hook -#define elf_backend_create_dynamic_sections \ - _bfd_mips_elf_create_dynamic_sections -#define elf_backend_check_relocs _bfd_mips_elf_check_relocs -#define elf_backend_adjust_dynamic_symbol \ - _bfd_mips_elf_adjust_dynamic_symbol -#define elf_backend_always_size_sections \ - _bfd_mips_elf_always_size_sections -#define elf_backend_size_dynamic_sections \ - _bfd_mips_elf_size_dynamic_sections -#define elf_backend_relocate_section _bfd_mips_elf_relocate_section -#define elf_backend_link_output_symbol_hook \ - _bfd_mips_elf_link_output_symbol_hook -#define elf_backend_finish_dynamic_symbol \ - _bfd_mips_elf_finish_dynamic_symbol -#define elf_backend_finish_dynamic_sections \ - _bfd_mips_elf_finish_dynamic_sections -#define elf_backend_gc_mark_hook _bfd_mips_elf_gc_mark_hook -#define elf_backend_gc_sweep_hook _bfd_mips_elf_gc_sweep_hook -#define elf_backend_got_header_size (4*MIPS_RESERVED_GOTNO) -#define elf_backend_plt_header_size 0 -#define elf_backend_may_use_rel_p 1 - -/* We don't set bfd_elf64_bfd_is_local_label_name because the 32-bit - MIPS-specific function only applies to IRIX5, which had no 64-bit - ABI. */ -#define bfd_elf64_find_nearest_line _bfd_mips_elf_find_nearest_line -#define bfd_elf64_set_section_contents _bfd_mips_elf_set_section_contents -#define bfd_elf64_bfd_link_hash_table_create \ - _bfd_mips_elf_link_hash_table_create -#define bfd_elf64_bfd_final_link _bfd_mips_elf_final_link -#define bfd_elf64_bfd_copy_private_bfd_data \ - _bfd_mips_elf_copy_private_bfd_data -#define bfd_elf64_bfd_merge_private_bfd_data \ - _bfd_mips_elf_merge_private_bfd_data -#define bfd_elf64_bfd_set_private_flags _bfd_mips_elf_set_private_flags -#define bfd_elf64_bfd_print_private_bfd_data \ - _bfd_mips_elf_print_private_bfd_data - -#define bfd_elf64_get_reloc_upper_bound mips_elf64_get_reloc_upper_bound -#define bfd_elf64_bfd_reloc_type_lookup mips_elf64_reloc_type_lookup -#define bfd_elf64_archive_functions -#define bfd_elf64_archive_slurp_armap mips_elf64_slurp_armap -#define bfd_elf64_archive_slurp_extended_name_table \ - _bfd_archive_coff_slurp_extended_name_table -#define bfd_elf64_archive_construct_extended_name_table \ - _bfd_archive_coff_construct_extended_name_table -#define bfd_elf64_archive_truncate_arname \ - _bfd_archive_coff_truncate_arname -#define bfd_elf64_archive_write_armap mips_elf64_write_armap -#define bfd_elf64_archive_read_ar_hdr _bfd_archive_coff_read_ar_hdr -#define bfd_elf64_archive_openr_next_archived_file \ - _bfd_archive_coff_openr_next_archived_file -#define bfd_elf64_archive_get_elt_at_index \ - _bfd_archive_coff_get_elt_at_index -#define bfd_elf64_archive_generic_stat_arch_elt \ - _bfd_archive_coff_generic_stat_arch_elt -#define bfd_elf64_archive_update_armap_timestamp \ - _bfd_archive_coff_update_armap_timestamp - -#include "elf64-target.h" diff --git a/contrib/binutils/bfd/filemode.c b/contrib/binutils/bfd/filemode.c deleted file mode 100644 index 6f4596872ca8..000000000000 --- a/contrib/binutils/bfd/filemode.c +++ /dev/null @@ -1,194 +0,0 @@ -/* filemode.c -- make a string describing file modes - Copyright (C) 1985, 1990 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 <sys/types.h> -#include <sys/stat.h> - -void mode_string (); -static char ftypelet (); -static void rwx (); -static void setst (); - -/* filemodestring - fill in string STR with an ls-style ASCII - representation of the st_mode field of file stats block STATP. - 10 characters are stored in STR; no terminating null is added. - The characters stored in STR are: - - 0 File type. 'd' for directory, 'c' for character - special, 'b' for block special, 'm' for multiplex, - 'l' for symbolic link, 's' for socket, 'p' for fifo, - '-' for any other file type - - 1 'r' if the owner may read, '-' otherwise. - - 2 'w' if the owner may write, '-' otherwise. - - 3 'x' if the owner may execute, 's' if the file is - set-user-id, '-' otherwise. - 'S' if the file is set-user-id, but the execute - bit isn't set. - - 4 'r' if group members may read, '-' otherwise. - - 5 'w' if group members may write, '-' otherwise. - - 6 'x' if group members may execute, 's' if the file is - set-group-id, '-' otherwise. - 'S' if it is set-group-id but not executable. - - 7 'r' if any user may read, '-' otherwise. - - 8 'w' if any user may write, '-' otherwise. - - 9 'x' if any user may execute, 't' if the file is "sticky" - (will be retained in swap space after execution), '-' - otherwise. - 'T' if the file is sticky but not executable. */ - -void -filemodestring (statp, str) - struct stat *statp; - char *str; -{ - mode_string (statp->st_mode, str); -} - -/* Like filemodestring, but only the relevant part of the `struct stat' - is given as an argument. */ - -void -mode_string (mode, str) - unsigned short mode; - char *str; -{ - str[0] = ftypelet (mode); - rwx ((mode & 0700) << 0, &str[1]); - rwx ((mode & 0070) << 3, &str[4]); - rwx ((mode & 0007) << 6, &str[7]); - setst (mode, str); -} - -/* Return a character indicating the type of file described by - file mode BITS: - 'd' for directories - 'b' for block special files - 'c' for character special files - 'm' for multiplexor files - 'l' for symbolic links - 's' for sockets - 'p' for fifos - '-' for any other file type. */ - -static char -ftypelet (bits) - unsigned short bits; -{ - switch (bits & S_IFMT) - { - default: - return '-'; - case S_IFDIR: - return 'd'; -#ifdef S_IFLNK - case S_IFLNK: - return 'l'; -#endif -#ifdef S_IFCHR - case S_IFCHR: - return 'c'; -#endif -#ifdef S_IFBLK - case S_IFBLK: - return 'b'; -#endif -#ifdef S_IFMPC - case S_IFMPC: - case S_IFMPB: - return 'm'; -#endif -#ifdef S_IFSOCK - case S_IFSOCK: - return 's'; -#endif -#ifdef S_IFIFO -#if S_IFIFO != S_IFSOCK - case S_IFIFO: - return 'p'; -#endif -#endif -#ifdef S_IFNWK /* HP-UX */ - case S_IFNWK: - return 'n'; -#endif - } -} - -/* Look at read, write, and execute bits in BITS and set - flags in CHARS accordingly. */ - -static void -rwx (bits, chars) - unsigned short bits; - char *chars; -{ - chars[0] = (bits & S_IREAD) ? 'r' : '-'; - chars[1] = (bits & S_IWRITE) ? 'w' : '-'; - chars[2] = (bits & S_IEXEC) ? 'x' : '-'; -} - -/* Set the 's' and 't' flags in file attributes string CHARS, - according to the file mode BITS. */ - -static void -setst (bits, chars) - unsigned short bits; - char *chars; -{ -#ifdef S_ISUID - if (bits & S_ISUID) - { - if (chars[3] != 'x') - /* Set-uid, but not executable by owner. */ - chars[3] = 'S'; - else - chars[3] = 's'; - } -#endif -#ifdef S_ISGID - if (bits & S_ISGID) - { - if (chars[6] != 'x') - /* Set-gid, but not executable by group. */ - chars[6] = 'S'; - else - chars[6] = 's'; - } -#endif -#ifdef S_ISVTX - if (bits & S_ISVTX) - { - if (chars[9] != 'x') - /* Sticky, but not executable by others. */ - chars[9] = 'T'; - else - chars[9] = 't'; - } -#endif -} - - diff --git a/contrib/binutils/bfd/mipsbsd.c b/contrib/binutils/bfd/mipsbsd.c deleted file mode 100644 index 7a680fb38949..000000000000 --- a/contrib/binutils/bfd/mipsbsd.c +++ /dev/null @@ -1,474 +0,0 @@ -/* BFD backend for MIPS BSD (a.out) binaries. - Copyright (C) 1993, 94, 95, 97, 98, 1999 Free Software Foundation, Inc. - Written by Ralph Campbell. - -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 -/* #define ENTRY_CAN_BE_ZERO */ -#define N_HEADER_IN_TEXT(x) 1 -#define N_SHARED_LIB(x) 0 -#define N_TXTADDR(x) \ - (N_MAGIC(x) != ZMAGIC ? (x).a_entry : /* object file or NMAGIC */\ - TEXT_START_ADDR + EXEC_BYTES_SIZE /* no padding */\ - ) -#define N_DATADDR(x) (N_TXTADDR(x)+N_TXTSIZE(x)) -#define TEXT_START_ADDR 4096 -#define TARGET_PAGE_SIZE 4096 -#define SEGMENT_SIZE TARGET_PAGE_SIZE -#define DEFAULT_ARCH bfd_arch_mips -#define MACHTYPE_OK(mtype) ((mtype) == M_UNKNOWN \ - || (mtype) == M_MIPS1 || (mtype) == M_MIPS2) -#define MY_symbol_leading_char '\0' - -#define MY(OP) CAT(mipsbsd_,OP) - -#include "bfd.h" -#include "sysdep.h" -#include "libbfd.h" -#include "libaout.h" - -#define SET_ARCH_MACH(ABFD, EXEC) \ - MY(set_arch_mach)(ABFD, N_MACHTYPE (EXEC)); \ - MY(choose_reloc_size)(ABFD); -static void MY(set_arch_mach) PARAMS ((bfd *abfd, int machtype)); -static void MY(choose_reloc_size) PARAMS ((bfd *abfd)); - -#define MY_write_object_contents MY(write_object_contents) -static boolean MY(write_object_contents) PARAMS ((bfd *abfd)); - -/* We can't use MY(x) here because it leads to a recursive call to CAT - when expanded inside JUMP_TABLE. */ -#define MY_bfd_reloc_type_lookup mipsbsd_reloc_howto_type_lookup -#define MY_canonicalize_reloc mipsbsd_canonicalize_reloc - -#define MY_bfd_link_hash_table_create _bfd_generic_link_hash_table_create -#define MY_bfd_link_add_symbols _bfd_generic_link_add_symbols -#define MY_final_link_callback unused -#define MY_bfd_final_link _bfd_generic_final_link - -#define MY_backend_data &MY(backend_data) -#define MY_BFD_TARGET - -#include "aout-target.h" - -static void -MY(set_arch_mach) (abfd, machtype) - bfd *abfd; - int machtype; -{ - enum bfd_architecture arch; - long machine; - - /* Determine the architecture and machine type of the object file. */ - switch (machtype) { - - case M_MIPS1: - arch = bfd_arch_mips; - machine = 3000; - break; - - case M_MIPS2: - arch = bfd_arch_mips; - machine = 4000; - break; - - default: - arch = bfd_arch_obscure; - machine = 0; - break; - } - bfd_set_arch_mach(abfd, arch, machine); -} - -/* Determine the size of a relocation entry, based on the architecture */ -static void -MY(choose_reloc_size) (abfd) - bfd *abfd; -{ - switch (bfd_get_arch(abfd)) { - 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; - } -} - -/* Write an object file in BSD a.out format. - 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); - - /* Magic number, maestro, please! */ - switch (bfd_get_arch(abfd)) { - case bfd_arch_m68k: - switch (bfd_get_mach(abfd)) { - case bfd_mach_m68010: - N_SET_MACHTYPE(*execp, M_68010); - break; - default: - case bfd_mach_m68020: - N_SET_MACHTYPE(*execp, M_68020); - break; - } - break; - case bfd_arch_sparc: - N_SET_MACHTYPE(*execp, M_SPARC); - break; - case bfd_arch_i386: - N_SET_MACHTYPE(*execp, M_386); - break; - case bfd_arch_a29k: - N_SET_MACHTYPE(*execp, M_29K); - break; - case bfd_arch_mips: - switch (bfd_get_mach(abfd)) { - case 4000: - case 6000: - N_SET_MACHTYPE(*execp, M_MIPS2); - break; - default: - N_SET_MACHTYPE(*execp, M_MIPS1); - break; - } - break; - default: - N_SET_MACHTYPE(*execp, M_UNKNOWN); - } - - MY(choose_reloc_size)(abfd); - - WRITE_HEADERS(abfd, execp); - - return true; -} - -/* - * MIPS relocation types. - */ -#define MIPS_RELOC_32 0 -#define MIPS_RELOC_JMP 1 -#define MIPS_RELOC_WDISP16 2 -#define MIPS_RELOC_HI16 3 -#define MIPS_RELOC_HI16_S 4 -#define MIPS_RELOC_LO16 5 - -/* - * This is only called when performing a BFD_RELOC_MIPS_JMP relocation. - * The jump destination address is formed from the upper 4 bits of the - * "current" program counter concatenated with the jump instruction's - * 26 bit field and two trailing zeros. - * If the destination address is not in the same segment as the "current" - * program counter, then we need to signal an error. - */ -static bfd_reloc_status_type -mips_fix_jmp_addr (abfd,reloc_entry,symbol,data,input_section,output_bfd) - bfd *abfd ATTRIBUTE_UNUSED; - arelent *reloc_entry; - struct symbol_cache_entry *symbol; - PTR data ATTRIBUTE_UNUSED; - asection *input_section; - bfd *output_bfd; -{ - bfd_vma relocation, pc; - - /* If this is a partial relocation, just continue. */ - if (output_bfd != (bfd *)NULL) - return bfd_reloc_continue; - - /* If this is an undefined symbol, return error */ - if (bfd_is_und_section (symbol->section) - && (symbol->flags & BSF_WEAK) == 0) - return bfd_reloc_undefined; - - /* - * Work out which section the relocation is targetted at and the - * initial relocation command value. - */ - if (bfd_is_com_section (symbol->section)) - relocation = 0; - else - relocation = symbol->value; - - relocation += symbol->section->output_section->vma; - relocation += symbol->section->output_offset; - relocation += reloc_entry->addend; - - pc = input_section->output_section->vma + input_section->output_offset + - reloc_entry->address + 4; - - if ((relocation & 0xF0000000) != (pc & 0xF0000000)) - return bfd_reloc_overflow; - - return bfd_reloc_continue; -} - -/* - * This is only called when performing a BFD_RELOC_HI16_S relocation. - * We need to see if bit 15 is set in the result. If it is, we add - * 0x10000 and continue normally. This will compensate for the sign extension - * when the low bits are added at run time. - */ -static bfd_reloc_status_type -mips_fix_hi16_s PARAMS ((bfd *, arelent *, asymbol *, PTR, - asection *, bfd *, char **)); - -static bfd_reloc_status_type -mips_fix_hi16_s (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd ATTRIBUTE_UNUSED; - arelent *reloc_entry; - asymbol *symbol; - PTR data ATTRIBUTE_UNUSED; - asection *input_section ATTRIBUTE_UNUSED; - bfd *output_bfd; - char **error_message ATTRIBUTE_UNUSED; -{ - bfd_vma relocation; - - /* If this is a partial relocation, just continue. */ - if (output_bfd != (bfd *)NULL) - return bfd_reloc_continue; - - /* If this is an undefined symbol, return error */ - if (bfd_is_und_section (symbol->section) - && (symbol->flags & BSF_WEAK) == 0) - return bfd_reloc_undefined; - - /* - * Work out which section the relocation is targetted at and the - * initial relocation command value. - */ - if (bfd_is_com_section (symbol->section)) - relocation = 0; - else - relocation = symbol->value; - - relocation += symbol->section->output_section->vma; - relocation += symbol->section->output_offset; - relocation += reloc_entry->addend; - - if (relocation & 0x8000) - reloc_entry->addend += 0x10000; - - return bfd_reloc_continue; -} - -static reloc_howto_type mips_howto_table_ext[] = { - {MIPS_RELOC_32, 0, 2, 32, false, 0, complain_overflow_bitfield, 0, - "32", false, 0, 0xffffffff, false}, - {MIPS_RELOC_JMP, 2, 2, 26, false, 0, complain_overflow_dont, - mips_fix_jmp_addr, - "MIPS_JMP", false, 0, 0x03ffffff, false}, - {MIPS_RELOC_WDISP16, 2, 2, 16, true, 0, complain_overflow_signed, 0, - "WDISP16", false, 0, 0x0000ffff, false}, - {MIPS_RELOC_HI16, 16, 2, 16, false, 0, complain_overflow_bitfield, 0, - "HI16", false, 0, 0x0000ffff, false}, - {MIPS_RELOC_HI16_S, 16, 2, 16, false, 0, complain_overflow_bitfield, - mips_fix_hi16_s, - "HI16_S", false, 0, 0x0000ffff, false}, - {MIPS_RELOC_LO16, 0, 2, 16, false, 0, complain_overflow_dont, 0, - "LO16", false, 0, 0x0000ffff, false}, -}; - -static reloc_howto_type * -MY(reloc_howto_type_lookup) (abfd, code) - bfd *abfd; - bfd_reloc_code_real_type code; -{ - - if (bfd_get_arch (abfd) != bfd_arch_mips) - return 0; - - switch (code) - { - case BFD_RELOC_CTOR: - case BFD_RELOC_32: - return (&mips_howto_table_ext[MIPS_RELOC_32]); - case BFD_RELOC_MIPS_JMP: - return (&mips_howto_table_ext[MIPS_RELOC_JMP]); - case BFD_RELOC_16_PCREL_S2: - return (&mips_howto_table_ext[MIPS_RELOC_WDISP16]); - case BFD_RELOC_HI16: - return (&mips_howto_table_ext[MIPS_RELOC_HI16]); - case BFD_RELOC_HI16_S: - return (&mips_howto_table_ext[MIPS_RELOC_HI16_S]); - case BFD_RELOC_LO16: - return (&mips_howto_table_ext[MIPS_RELOC_LO16]); - default: - return 0; - } -} - -/* - * This is just like the standard aoutx.h version but we need to do our - * own mapping of external reloc type values to howto entries. - */ -long -MY(canonicalize_reloc)(abfd, section, relptr, symbols) - bfd *abfd; - sec_ptr section; - arelent **relptr; - asymbol **symbols; -{ - arelent *tblptr = section->relocation; - unsigned int count, c; - extern reloc_howto_type NAME(aout,ext_howto_table)[]; - - /* If we have already read in the relocation table, return the values. */ - 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; - } - *relptr = 0; - return section->reloc_count; - } - if (tblptr && section->reloc_count) { - for (count = 0; count++ < section->reloc_count;) - *relptr++ = tblptr++; - *relptr = 0; - return section->reloc_count; - } - - if (!NAME(aout,slurp_reloc_table)(abfd, section, symbols)) - return -1; - tblptr = section->relocation; - - /* fix up howto entries */ - for (count = 0; count++ < section->reloc_count;) - { - c = tblptr->howto - NAME(aout,ext_howto_table); - tblptr->howto = &mips_howto_table_ext[c]; - - *relptr++ = tblptr++; - } - *relptr = 0; - return section->reloc_count; -} - -static CONST struct aout_backend_data MY(backend_data) = { - 0, /* zmagic contiguous */ - 1, /* text incl header */ - 0, /* entry is text address */ - 0, /* exec_hdr_flags */ - TARGET_PAGE_SIZE, /* text vma */ - MY_set_sizes, - 0, /* text size includes exec header */ - 0, /* add_dynamic_symbols */ - 0, /* add_one_symbol */ - 0, /* link_dynamic_object */ - 0, /* write_dynamic_symbol */ - 0, /* check_dynamic_reloc */ - 0 /* finish_dynamic_link */ -}; - -extern const bfd_target aout_mips_big_vec; - -const bfd_target aout_mips_little_vec = -{ - "a.out-mips-little", /* name */ - bfd_target_aout_flavour, - BFD_ENDIAN_LITTLE, /* target byte order (little) */ - BFD_ENDIAN_LITTLE, /* target headers byte order (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 | SEC_CODE | SEC_DATA), - MY_symbol_leading_char, - ' ', /* 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 */ - {_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 (_bfd_nodynamic), - - & aout_mips_big_vec, - - (PTR) MY_backend_data -}; - -const bfd_target aout_mips_big_vec = -{ - "a.out-mips-big", /* name */ - bfd_target_aout_flavour, - BFD_ENDIAN_BIG, /* target byte order (big) */ - BFD_ENDIAN_BIG, /* target headers byte order (big) */ - (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 | SEC_CODE | SEC_DATA), - MY_symbol_leading_char, - ' ', /* ar_pad_char */ - 15, /* 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, 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 (_bfd_nodynamic), - - & aout_mips_little_vec, - - (PTR) MY_backend_data -}; diff --git a/contrib/binutils/bfd/pe-mips.c b/contrib/binutils/bfd/pe-mips.c deleted file mode 100644 index 9b89369b37b6..000000000000 --- a/contrib/binutils/bfd/pe-mips.c +++ /dev/null @@ -1,998 +0,0 @@ -/* BFD back-end for MIPS PE COFF files. - Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000 Free Software Foundation, Inc. - Modified from coff-i386.c by DJ Delorie, dj@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. */ - -#define COFF_WITH_PE -#define COFF_LONG_SECTION_NAMES -#define PCRELOFFSET true - -#include "bfd.h" -#include "sysdep.h" -#include "libbfd.h" - -#include "coff/mipspe.h" - -#include "coff/internal.h" - -#include "coff/pe.h" - -#include "libcoff.h" - -static bfd_reloc_status_type coff_mips_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); -static reloc_howto_type *coff_mips_rtype_to_howto - PARAMS ((bfd *, asection *, struct internal_reloc *, - struct coff_link_hash_entry *, struct internal_syment *, - - bfd_vma *)); -#if 0 -static void mips_ecoff_swap_reloc_in PARAMS ((bfd *, PTR, - struct internal_reloc *)); -static void mips_ecoff_swap_reloc_out PARAMS ((bfd *, - const struct internal_reloc *, - PTR)); -static void mips_adjust_reloc_in PARAMS ((bfd *, - const struct internal_reloc *, - arelent *)); -static void mips_adjust_reloc_out PARAMS ((bfd *, const arelent *, - struct internal_reloc *)); -#endif -#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 mips 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_mips_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd, - error_message) - bfd *abfd; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section ATTRIBUTE_UNUSED; - bfd *output_bfd; - char **error_message ATTRIBUTE_UNUSED; -{ - symvalue diff; - - if (output_bfd == (bfd *) NULL) - return bfd_reloc_continue; - - if (bfd_is_com_section (symbol->section)) - { -#ifndef COFF_WITH_PE - /* 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 - /* In PE mode, we do not offset the common symbol. */ - diff = reloc_entry->addend; -#endif - } - 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 0 - /* dj - handle it like any other reloc? */ - /* FIXME: How should this case be handled? */ - if (reloc_entry->howto->type == MIPS_R_RVA && diff != 0) - abort (); -#endif -#endif - -#define DOIT(x) \ - x = ((x & ~howto->dst_mask) | (((x & howto->src_mask) + (diff >> howto->rightshift)) & 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 ATTRIBUTE_UNUSED; - reloc_howto_type *howto; -{ - return ! howto->pc_relative && howto->type != MIPS_R_RVA; -} -#endif - -#ifndef PCRELOFFSET -#define PCRELOFFSET false -#endif - -static reloc_howto_type howto_table[] = -{ - /* Reloc type 0 is ignored. The reloc reading code ensures that - this is a reference to the .abs section, which will cause - bfd_perform_relocation to do nothing. */ - HOWTO (MIPS_R_ABSOLUTE, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 8, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - 0, /* special_function */ - "IGNORE", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - false), /* pcrel_offset */ - - /* A 16 bit reference to a symbol, normally from a data section. */ - HOWTO (MIPS_R_REFHALF, /* 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_mips_reloc, /* special_function */ - "REFHALF", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* A 32 bit reference to a symbol, normally from a data section. */ - HOWTO (MIPS_R_REFWORD, /* 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_mips_reloc, /* special_function */ - "REFWORD", /* name */ - true, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* A 26 bit absolute jump address. */ - HOWTO (MIPS_R_JMPADDR, /* type */ - 2, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 26, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - /* This needs complex overflow - detection, because the upper four - bits must match the PC. */ - coff_mips_reloc, /* special_function */ - "JMPADDR", /* name */ - true, /* partial_inplace */ - 0x3ffffff, /* src_mask */ - 0x3ffffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* The high 16 bits of a symbol value. Handled by the function - mips_refhi_reloc. */ - HOWTO (MIPS_R_REFHI, /* type */ - 16, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - coff_mips_reloc, /* special_function */ - "REFHI", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* The low 16 bits of a symbol value. */ - HOWTO (MIPS_R_REFLO, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - coff_mips_reloc, /* special_function */ - "REFLO", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* A reference to an offset from the gp register. Handled by the - function mips_gprel_reloc. */ - HOWTO (MIPS_R_GPREL, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - coff_mips_reloc, /* special_function */ - "GPREL", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* A reference to a literal using an offset from the gp register. - Handled by the function mips_gprel_reloc. */ - HOWTO (MIPS_R_LITERAL, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - coff_mips_reloc, /* special_function */ - "LITERAL", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - EMPTY_HOWTO (8), - EMPTY_HOWTO (9), - EMPTY_HOWTO (10), - EMPTY_HOWTO (11), - EMPTY_HOWTO (12), - EMPTY_HOWTO (13), - EMPTY_HOWTO (14), - EMPTY_HOWTO (15), - EMPTY_HOWTO (16), - EMPTY_HOWTO (17), - EMPTY_HOWTO (18), - EMPTY_HOWTO (19), - EMPTY_HOWTO (20), - EMPTY_HOWTO (21), - EMPTY_HOWTO (22), - EMPTY_HOWTO (23), - EMPTY_HOWTO (24), - EMPTY_HOWTO (25), - EMPTY_HOWTO (26), - EMPTY_HOWTO (27), - EMPTY_HOWTO (28), - EMPTY_HOWTO (29), - EMPTY_HOWTO (30), - EMPTY_HOWTO (31), - EMPTY_HOWTO (32), - EMPTY_HOWTO (33), - HOWTO (MIPS_R_RVA, /* 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_mips_reloc, /* special_function */ - "rva32", /* name */ - true, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - false), /* pcrel_offset */ - EMPTY_HOWTO (35), - EMPTY_HOWTO (36), - HOWTO (MIPS_R_PAIR, /* 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_mips_reloc, /* special_function */ - "PAIR", /* name */ - true, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - false), /* pcrel_offset */ -}; - -/* Turn a howto into a reloc nunmber */ - -#define SELECT_RELOC(x,howto) { x.r_type = howto->type; } -#define BADMAG(x) MIPSBADMAG(x) -#define MIPS 1 /* Customize coffcode.h */ - -#define RTYPE2HOWTO(cache_ptr, dst) \ - (cache_ptr)->howto = howto_table + (dst)->r_type; - -/* 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; \ - } - - -/* Convert an rtype to howto for the COFF backend linker. */ - -static reloc_howto_type * -coff_mips_rtype_to_howto (abfd, sec, rel, h, sym, addendp) - bfd *abfd ATTRIBUTE_UNUSED; - 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 relocation address. - If I link two versions with and without this section bypassed - and then do a binary comparison, the addresses which are - different can be looked up in the map. The case in which - this section has been bypassed has addresses which correspond - to values I can find in the map. */ - *addendp -= sym->n_value; -#endif - } - -#ifndef COFF_WITH_PE - /* 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; -#endif - -#ifdef COFF_WITH_PE - if (howto->pc_relative) - { - *addendp -= 4; - - /* If the symbol is defined, then the generic code is going to - add back the symbol value in order to cancel out an - adjustment it made to the addend. However, we set the addend - to 0 at the start of this function. We need to adjust here, - to avoid the adjustment the generic code will make. FIXME: - This is getting a bit hackish. */ - if (sym != NULL && sym->n_scnum != 0) - *addendp -= sym->n_value; - } - - if (rel->r_type == MIPS_R_RVA) - { - *addendp -= pe_data(sec->output_section->owner)->pe_opthdr.ImageBase; - } -#endif - - return howto; -} - -#define coff_rtype_to_howto coff_mips_rtype_to_howto - - -#define coff_bfd_reloc_type_lookup coff_mips_reloc_type_lookup - - - -/* Get the howto structure for a generic reloc type. */ - -static reloc_howto_type * -coff_mips_reloc_type_lookup (abfd, code) - bfd *abfd ATTRIBUTE_UNUSED; - bfd_reloc_code_real_type code; -{ - int mips_type; - - switch (code) - { - case BFD_RELOC_16: - mips_type = MIPS_R_REFHALF; - break; - case BFD_RELOC_32: - case BFD_RELOC_CTOR: - mips_type = MIPS_R_REFWORD; - break; - case BFD_RELOC_MIPS_JMP: - mips_type = MIPS_R_JMPADDR; - break; - case BFD_RELOC_HI16_S: - mips_type = MIPS_R_REFHI; - break; - case BFD_RELOC_LO16: - mips_type = MIPS_R_REFLO; - break; - case BFD_RELOC_MIPS_GPREL: - mips_type = MIPS_R_GPREL; - break; - case BFD_RELOC_MIPS_LITERAL: - mips_type = MIPS_R_LITERAL; - break; -/* FIXME? - case BFD_RELOC_16_PCREL_S2: - mips_type = MIPS_R_PCREL16; - break; - case BFD_RELOC_PCREL_HI16_S: - mips_type = MIPS_R_RELHI; - break; - case BFD_RELOC_PCREL_LO16: - mips_type = MIPS_R_RELLO; - break; - case BFD_RELOC_GPREL32: - mips_type = MIPS_R_SWITCH; - break; -*/ - case BFD_RELOC_RVA: - mips_type = MIPS_R_RVA; - break; - default: - return (reloc_howto_type *) NULL; - } - - return &howto_table[mips_type]; -} - -static void -mips_swap_reloc_in (abfd, src, dst) - bfd *abfd; - PTR src; - PTR dst; -{ - static struct internal_reloc pair_prev; - 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); - reloc_dst->r_type = bfd_h_get_16(abfd, (bfd_byte *) reloc_src->r_type); - reloc_dst->r_size = 0; - reloc_dst->r_extern = 0; - reloc_dst->r_offset = 0; - - switch (reloc_dst->r_type) - { - case MIPS_R_REFHI: - pair_prev = *reloc_dst; - break; - case MIPS_R_PAIR: - reloc_dst->r_offset = reloc_dst->r_symndx; - if (reloc_dst->r_offset & 0x8000) - reloc_dst->r_offset -= 0x10000; - /*printf("dj: pair offset is %08x\n", reloc_dst->r_offset);*/ - reloc_dst->r_symndx = pair_prev.r_symndx; - break; - } -} - -static unsigned int -mips_swap_reloc_out (abfd, src, dst) - bfd *abfd; - PTR src; - PTR dst; -{ - static int prev_offset = 1; - static bfd_vma prev_addr = 0; - struct internal_reloc *reloc_src = (struct internal_reloc *)src; - struct external_reloc *reloc_dst = (struct external_reloc *)dst; - - switch (reloc_src->r_type) - { - case MIPS_R_REFHI: - prev_addr = reloc_src->r_vaddr; - prev_offset = reloc_src->r_offset; - break; - case MIPS_R_REFLO: - if (reloc_src->r_vaddr == prev_addr) - { - /* FIXME: only slightly hackish. If we see a REFLO pointing to - the same address as a REFHI, we assume this is the matching - PAIR reloc and output it accordingly. The symndx is really - the low 16 bits of the addend */ - 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); - - bfd_h_put_16(abfd, MIPS_R_PAIR, (bfd_byte *) - reloc_dst->r_type); - return RELSZ; - } - break; - } - - 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); - - bfd_h_put_16(abfd, reloc_src->r_type, (bfd_byte *) - reloc_dst->r_type); - return RELSZ; -} - -#define coff_swap_reloc_in mips_swap_reloc_in -#define coff_swap_reloc_out mips_swap_reloc_out -#define NO_COFF_RELOCS - -static boolean -coff_pe_mips_relocate_section (output_bfd, info, input_bfd, - input_section, contents, relocs, syms, - sections) - 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; -{ - bfd_vma gp; - boolean gp_undefined; - size_t adjust; - struct internal_reloc *rel; - struct internal_reloc *rel_end; - unsigned int i; - boolean got_lo; - - if (info->relocateable) - { - (*_bfd_error_handler)(_("\ -%s: `ld -r' not supported with PE MIPS objects\n"), - bfd_get_filename (input_bfd)); - bfd_set_error (bfd_error_bad_value); - return false; - } - - BFD_ASSERT (input_bfd->xvec->byteorder - == output_bfd->xvec->byteorder); - -#if 0 - printf("dj: relocate %s(%s) %08x\n", - input_bfd->filename, input_section->name, - input_section->output_section->vma + input_section->output_offset); -#endif - - gp = _bfd_get_gp_value (output_bfd); - if (gp == 0) - gp_undefined = true; - else - gp_undefined = false; - - got_lo = false; - - adjust = 0; - - rel = relocs; - rel_end = rel + input_section->reloc_count; - for (i = 0; rel < rel_end; rel++, i++) - { - long symndx; - struct coff_link_hash_entry *h; - struct internal_syment *sym; - bfd_vma addend = 0; - bfd_vma val, tmp, targ, src, low; - reloc_howto_type *howto; - unsigned char *mem = contents + rel->r_vaddr; - - symndx = rel->r_symndx; - - if (symndx == -1) - { - h = NULL; - sym = NULL; - } - else - { - h = obj_coff_sym_hashes (input_bfd)[symndx]; - sym = syms + symndx; - } - - /* COFF treats common symbols in one of two ways. Either the - size of the symbol is included in the section contents, or it - is not. We assume that the size is not included, and force - the rtype_to_howto function to adjust the addend as needed. */ - - if (sym != NULL && sym->n_scnum != 0) - addend = - sym->n_value; - else - addend = 0; - - - howto = bfd_coff_rtype_to_howto (input_bfd, input_section, rel, h, - sym, &addend); - if (howto == NULL) - return false; - - /* If we are doing a relocateable link, then we can just ignore - a PC relative reloc that is pcrel_offset. It will already - have the correct value. If this is not a relocateable link, - then we should ignore the symbol value. */ - if (howto->pc_relative && howto->pcrel_offset) - { - if (info->relocateable) - continue; - if (sym != NULL && sym->n_scnum != 0) - addend += sym->n_value; - } - - val = 0; - - if (h == NULL) - { - asection *sec; - - if (symndx == -1) - { - sec = bfd_abs_section_ptr; - val = 0; - } - else - { - sec = sections[symndx]; - val = (sec->output_section->vma - + sec->output_offset - + sym->n_value); - if (! obj_pe (input_bfd)) - val -= sec->vma; - } - } - else - { - if (h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak) - { - asection *sec; - - sec = h->root.u.def.section; - val = (h->root.u.def.value - + sec->output_section->vma - + sec->output_offset); - } - - else if (! info->relocateable) - { - if (! ((*info->callbacks->undefined_symbol) - (info, h->root.root.string, input_bfd, input_section, - rel->r_vaddr - input_section->vma, true))) - return false; - } - } - - src = rel->r_vaddr + input_section->output_section->vma - + input_section->output_offset; -#if 0 - printf("dj: reloc %02x %-8s a=%08x/%08x(%08x) v=%08x+%08x %s\n", - rel->r_type, howto_table[rel->r_type].name, - src, rel->r_vaddr, *(unsigned long *)mem, val, rel->r_offset, - h?h->root.root.string:"(none)"); -#endif - - /* OK, at this point the following variables are set up: - src = VMA of the memory we're fixing up - mem = pointer to memory we're fixing up - val = VMA of what we need to refer to - */ - -#define UI(x) (*_bfd_error_handler)(_("%s: unimplemented %s\n"), \ - bfd_get_filename (input_bfd), x); \ - bfd_set_error (bfd_error_bad_value); - - switch (rel->r_type) - { - case MIPS_R_ABSOLUTE: - /* ignore these */ - break; - - case MIPS_R_REFHALF: - UI("refhalf"); - break; - - case MIPS_R_REFWORD: - tmp = bfd_get_32(input_bfd, mem); - /* printf("refword: src=%08x targ=%08x+%08x\n", src, tmp, val); */ - tmp += val; - bfd_put_32(input_bfd, tmp, mem); - break; - - case MIPS_R_JMPADDR: - tmp = bfd_get_32(input_bfd, mem); - targ = val + (tmp&0x03ffffff)*4; - if ((src & 0xf0000000) != (targ & 0xf0000000)) - { - (*_bfd_error_handler)(_("%s: jump too far away\n"), - bfd_get_filename (input_bfd)); - bfd_set_error (bfd_error_bad_value); - return false; - } - tmp &= 0xfc000000; - tmp |= (targ/4) & 0x3ffffff; - bfd_put_32(input_bfd, tmp, mem); - break; - - case MIPS_R_REFHI: - tmp = bfd_get_32(input_bfd, mem); - switch (rel[1].r_type) - { - case MIPS_R_PAIR: - /* MS PE object */ - targ = val + rel[1].r_offset + ((tmp & 0xffff) << 16); - break; - case MIPS_R_REFLO: - /* GNU COFF object */ - low = bfd_get_32(input_bfd, contents + rel[1].r_vaddr); - low &= 0xffff; - if (low & 0x8000) - low -= 0x10000; - targ = val + low + ((tmp & 0xffff) << 16); - break; - default: - (*_bfd_error_handler)(_("%s: bad pair/reflo after refhi\n"), - bfd_get_filename (input_bfd)); - bfd_set_error (bfd_error_bad_value); - return false; - } - tmp &= 0xffff0000; - tmp |= (targ >> 16) & 0xffff; - bfd_put_32(input_bfd, tmp, mem); - break; - - case MIPS_R_REFLO: - tmp = bfd_get_32(input_bfd, mem); - targ = val + (tmp & 0xffff); - /* printf("refword: src=%08x targ=%08x\n", src, targ); */ - tmp &= 0xffff0000; - tmp |= targ & 0xffff; - bfd_put_32(input_bfd, tmp, mem); - break; - - case MIPS_R_GPREL: - case MIPS_R_LITERAL: - UI("gprel"); - break; - - case MIPS_R_SECTION: - UI("section"); - break; - - case MIPS_R_SECREL: - UI("secrel"); - break; - - case MIPS_R_SECRELLO: - UI("secrello"); - break; - - case MIPS_R_SECRELHI: - UI("secrelhi"); - break; - - case MIPS_R_RVA: - tmp = bfd_get_32 (input_bfd, mem); - /* printf("rva: src=%08x targ=%08x+%08x\n", src, tmp, val); */ - tmp += val - - pe_data (input_section->output_section->owner)->pe_opthdr.ImageBase; - bfd_put_32 (input_bfd, tmp, mem); - break; - - case MIPS_R_PAIR: - /* ignore these */ - break; - } - } - - return true; -} - -#define coff_relocate_section coff_pe_mips_relocate_section - -#ifdef TARGET_UNDERSCORE - -/* If mips gcc uses underscores for symbol names, then it does not use - a leading dot for local labels, so if TARGET_UNDERSCORE is defined - we treat all symbols starting with L as local. */ - -static boolean coff_mips_is_local_label_name PARAMS ((bfd *, const char *)); - -static boolean -coff_mips_is_local_label_name (abfd, name) - bfd *abfd; - const char *name; -{ - if (name[0] == 'L') - return true; - - return _bfd_coff_is_local_label_name (abfd, name); -} - -#define coff_bfd_is_local_label_name coff_mips_is_local_label_name - -#endif /* TARGET_UNDERSCORE */ - -#define COFF_NO_HACK_SCNHDR_SIZE - -#include "coffcode.h" - -const bfd_target -#ifdef TARGET_SYM - TARGET_SYM = -#else - mipslpe_vec = -#endif -{ -#ifdef TARGET_NAME - TARGET_NAME, -#else - "pe-mips", /* 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), - -#ifndef COFF_WITH_PE - (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC /* section flags */ - | SEC_CODE | SEC_DATA), -#else - (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC /* section flags */ - | SEC_CODE | SEC_DATA - | SEC_LINK_ONCE | SEC_LINK_DUPLICATES), -#endif - -#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, coff_object_p, /* bfd_check_format */ - bfd_generic_archive_p, coff_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), - - NULL, - - COFF_SWAP_TABLE -}; diff --git a/contrib/binutils/bfd/sunos.c b/contrib/binutils/bfd/sunos.c deleted file mode 100644 index 45e0cba992a0..000000000000 --- a/contrib/binutils/bfd/sunos.c +++ /dev/null @@ -1,2918 +0,0 @@ -/* BFD backend for SunOS binaries. - Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 97, 1998 - 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 TARGETNAME "a.out-sunos-big" -#define MY(OP) CAT(sunos_big_,OP) - -#include "bfd.h" -#include "bfdlink.h" -#include "libaout.h" - -/* Static routines defined in this file. */ - -static boolean sunos_read_dynamic_info PARAMS ((bfd *)); -static long sunos_get_dynamic_symtab_upper_bound PARAMS ((bfd *)); -static boolean sunos_slurp_dynamic_symtab PARAMS ((bfd *)); -static long sunos_canonicalize_dynamic_symtab PARAMS ((bfd *, asymbol **)); -static long sunos_get_dynamic_reloc_upper_bound PARAMS ((bfd *)); -static long sunos_canonicalize_dynamic_reloc - PARAMS ((bfd *, arelent **, asymbol **)); -static struct bfd_hash_entry *sunos_link_hash_newfunc - PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); -static struct bfd_link_hash_table *sunos_link_hash_table_create - PARAMS ((bfd *)); -static boolean sunos_create_dynamic_sections - PARAMS ((bfd *, struct bfd_link_info *, boolean)); -static boolean sunos_add_dynamic_symbols - PARAMS ((bfd *, struct bfd_link_info *, struct external_nlist **, - bfd_size_type *, char **)); -static boolean sunos_add_one_symbol - PARAMS ((struct bfd_link_info *, bfd *, const char *, flagword, asection *, - bfd_vma, const char *, boolean, boolean, - struct bfd_link_hash_entry **)); -static boolean sunos_scan_relocs - PARAMS ((struct bfd_link_info *, bfd *, asection *, bfd_size_type)); -static boolean sunos_scan_std_relocs - PARAMS ((struct bfd_link_info *, bfd *, asection *, - const struct reloc_std_external *, bfd_size_type)); -static boolean sunos_scan_ext_relocs - PARAMS ((struct bfd_link_info *, bfd *, asection *, - const struct reloc_ext_external *, bfd_size_type)); -static boolean sunos_link_dynamic_object - PARAMS ((struct bfd_link_info *, bfd *)); -static boolean sunos_write_dynamic_symbol - PARAMS ((bfd *, struct bfd_link_info *, struct aout_link_hash_entry *)); -static boolean sunos_check_dynamic_reloc - PARAMS ((struct bfd_link_info *, bfd *, asection *, - struct aout_link_hash_entry *, PTR, bfd_byte *, boolean *, - bfd_vma *)); -static boolean sunos_finish_dynamic_link - PARAMS ((bfd *, struct bfd_link_info *)); - -#define MY_get_dynamic_symtab_upper_bound sunos_get_dynamic_symtab_upper_bound -#define MY_canonicalize_dynamic_symtab sunos_canonicalize_dynamic_symtab -#define MY_get_dynamic_reloc_upper_bound sunos_get_dynamic_reloc_upper_bound -#define MY_canonicalize_dynamic_reloc sunos_canonicalize_dynamic_reloc -#define MY_bfd_link_hash_table_create sunos_link_hash_table_create -#define MY_add_dynamic_symbols sunos_add_dynamic_symbols -#define MY_add_one_symbol sunos_add_one_symbol -#define MY_link_dynamic_object sunos_link_dynamic_object -#define MY_write_dynamic_symbol sunos_write_dynamic_symbol -#define MY_check_dynamic_reloc sunos_check_dynamic_reloc -#define MY_finish_dynamic_link sunos_finish_dynamic_link - -/* ??? Where should this go? */ -#define MACHTYPE_OK(mtype) \ - (((mtype) == M_SPARC && bfd_lookup_arch (bfd_arch_sparc, 0) != NULL) \ - || ((mtype) == M_SPARCLET \ - && bfd_lookup_arch (bfd_arch_sparc, bfd_mach_sparc_sparclet) != NULL) \ - || (((mtype) == M_UNKNOWN || (mtype) == M_68010 || (mtype) == M_68020) \ - && bfd_lookup_arch (bfd_arch_m68k, 0) != NULL)) - -/* Include the usual a.out support. */ -#include "aoutf1.h" - -/* SunOS shared library support. We store a pointer to this structure - in obj_aout_dynamic_info (abfd). */ - -struct sunos_dynamic_info -{ - /* Whether we found any dynamic information. */ - boolean valid; - /* Dynamic information. */ - struct internal_sun4_dynamic_link dyninfo; - /* Number of dynamic symbols. */ - unsigned long dynsym_count; - /* Read in nlists for dynamic symbols. */ - struct external_nlist *dynsym; - /* asymbol structures for dynamic symbols. */ - aout_symbol_type *canonical_dynsym; - /* Read in dynamic string table. */ - char *dynstr; - /* Number of dynamic relocs. */ - unsigned long dynrel_count; - /* Read in dynamic relocs. This may be reloc_std_external or - reloc_ext_external. */ - PTR dynrel; - /* arelent structures for dynamic relocs. */ - arelent *canonical_dynrel; -}; - -/* The hash table of dynamic symbols is composed of two word entries. - See include/aout/sun4.h for details. */ - -#define HASH_ENTRY_SIZE (2 * BYTES_IN_WORD) - -/* Read in the basic dynamic information. This locates the __DYNAMIC - structure and uses it to find the dynamic_link structure. It - creates and saves a sunos_dynamic_info structure. If it can't find - __DYNAMIC, it sets the valid field of the sunos_dynamic_info - structure to false to avoid doing this work again. */ - -static boolean -sunos_read_dynamic_info (abfd) - bfd *abfd; -{ - struct sunos_dynamic_info *info; - asection *dynsec; - bfd_vma dynoff; - struct external_sun4_dynamic dyninfo; - unsigned long dynver; - struct external_sun4_dynamic_link linkinfo; - - if (obj_aout_dynamic_info (abfd) != (PTR) NULL) - return true; - - if ((abfd->flags & DYNAMIC) == 0) - { - bfd_set_error (bfd_error_invalid_operation); - return false; - } - - info = ((struct sunos_dynamic_info *) - bfd_zalloc (abfd, sizeof (struct sunos_dynamic_info))); - if (!info) - return false; - info->valid = false; - info->dynsym = NULL; - info->dynstr = NULL; - info->canonical_dynsym = NULL; - info->dynrel = NULL; - info->canonical_dynrel = NULL; - obj_aout_dynamic_info (abfd) = (PTR) info; - - /* This code used to look for the __DYNAMIC symbol to locate the dynamic - linking information. - However this inhibits recovering the dynamic symbols from a - stripped object file, so blindly assume that the dynamic linking - information is located at the start of the data section. - We could verify this assumption later by looking through the dynamic - symbols for the __DYNAMIC symbol. */ - if ((abfd->flags & DYNAMIC) == 0) - return true; - if (! bfd_get_section_contents (abfd, obj_datasec (abfd), (PTR) &dyninfo, - (file_ptr) 0, sizeof dyninfo)) - return true; - - dynver = GET_WORD (abfd, dyninfo.ld_version); - if (dynver != 2 && dynver != 3) - return true; - - dynoff = GET_WORD (abfd, dyninfo.ld); - - /* dynoff is a virtual address. It is probably always in the .data - section, but this code should work even if it moves. */ - if (dynoff < bfd_get_section_vma (abfd, obj_datasec (abfd))) - dynsec = obj_textsec (abfd); - else - dynsec = obj_datasec (abfd); - dynoff -= bfd_get_section_vma (abfd, dynsec); - if (dynoff > bfd_section_size (abfd, dynsec)) - return true; - - /* This executable appears to be dynamically linked in a way that we - can understand. */ - if (! bfd_get_section_contents (abfd, dynsec, (PTR) &linkinfo, dynoff, - (bfd_size_type) sizeof linkinfo)) - return true; - - /* Swap in the dynamic link information. */ - info->dyninfo.ld_loaded = GET_WORD (abfd, linkinfo.ld_loaded); - info->dyninfo.ld_need = GET_WORD (abfd, linkinfo.ld_need); - info->dyninfo.ld_rules = GET_WORD (abfd, linkinfo.ld_rules); - info->dyninfo.ld_got = GET_WORD (abfd, linkinfo.ld_got); - info->dyninfo.ld_plt = GET_WORD (abfd, linkinfo.ld_plt); - info->dyninfo.ld_rel = GET_WORD (abfd, linkinfo.ld_rel); - info->dyninfo.ld_hash = GET_WORD (abfd, linkinfo.ld_hash); - info->dyninfo.ld_stab = GET_WORD (abfd, linkinfo.ld_stab); - info->dyninfo.ld_stab_hash = GET_WORD (abfd, linkinfo.ld_stab_hash); - info->dyninfo.ld_buckets = GET_WORD (abfd, linkinfo.ld_buckets); - info->dyninfo.ld_symbols = GET_WORD (abfd, linkinfo.ld_symbols); - info->dyninfo.ld_symb_size = GET_WORD (abfd, linkinfo.ld_symb_size); - info->dyninfo.ld_text = GET_WORD (abfd, linkinfo.ld_text); - info->dyninfo.ld_plt_sz = GET_WORD (abfd, linkinfo.ld_plt_sz); - - /* Reportedly the addresses need to be offset by the size of the - exec header in an NMAGIC file. */ - if (adata (abfd).magic == n_magic) - { - unsigned long exec_bytes_size = adata (abfd).exec_bytes_size; - - info->dyninfo.ld_need += exec_bytes_size; - info->dyninfo.ld_rules += exec_bytes_size; - info->dyninfo.ld_rel += exec_bytes_size; - info->dyninfo.ld_hash += exec_bytes_size; - info->dyninfo.ld_stab += exec_bytes_size; - info->dyninfo.ld_symbols += exec_bytes_size; - } - - /* The only way to get the size of the symbol information appears to - be to determine the distance between it and the string table. */ - info->dynsym_count = ((info->dyninfo.ld_symbols - info->dyninfo.ld_stab) - / EXTERNAL_NLIST_SIZE); - BFD_ASSERT (info->dynsym_count * EXTERNAL_NLIST_SIZE - == (unsigned long) (info->dyninfo.ld_symbols - - info->dyninfo.ld_stab)); - - /* Similarly, the relocs end at the hash table. */ - info->dynrel_count = ((info->dyninfo.ld_hash - info->dyninfo.ld_rel) - / obj_reloc_entry_size (abfd)); - BFD_ASSERT (info->dynrel_count * obj_reloc_entry_size (abfd) - == (unsigned long) (info->dyninfo.ld_hash - - info->dyninfo.ld_rel)); - - info->valid = true; - - return true; -} - -/* Return the amount of memory required for the dynamic symbols. */ - -static long -sunos_get_dynamic_symtab_upper_bound (abfd) - bfd *abfd; -{ - struct sunos_dynamic_info *info; - - if (! sunos_read_dynamic_info (abfd)) - return -1; - - info = (struct sunos_dynamic_info *) obj_aout_dynamic_info (abfd); - if (! info->valid) - { - bfd_set_error (bfd_error_no_symbols); - return -1; - } - - return (info->dynsym_count + 1) * sizeof (asymbol *); -} - -/* Read the external dynamic symbols. */ - -static boolean -sunos_slurp_dynamic_symtab (abfd) - bfd *abfd; -{ - struct sunos_dynamic_info *info; - - /* Get the general dynamic information. */ - if (obj_aout_dynamic_info (abfd) == NULL) - { - if (! sunos_read_dynamic_info (abfd)) - return false; - } - - info = (struct sunos_dynamic_info *) obj_aout_dynamic_info (abfd); - if (! info->valid) - { - bfd_set_error (bfd_error_no_symbols); - return false; - } - - /* Get the dynamic nlist structures. */ - if (info->dynsym == (struct external_nlist *) NULL) - { - info->dynsym = ((struct external_nlist *) - bfd_alloc (abfd, - (info->dynsym_count - * EXTERNAL_NLIST_SIZE))); - if (info->dynsym == NULL && info->dynsym_count != 0) - return false; - if (bfd_seek (abfd, info->dyninfo.ld_stab, SEEK_SET) != 0 - || (bfd_read ((PTR) info->dynsym, info->dynsym_count, - EXTERNAL_NLIST_SIZE, abfd) - != info->dynsym_count * EXTERNAL_NLIST_SIZE)) - { - if (info->dynsym != NULL) - { - bfd_release (abfd, info->dynsym); - info->dynsym = NULL; - } - return false; - } - } - - /* Get the dynamic strings. */ - if (info->dynstr == (char *) NULL) - { - info->dynstr = (char *) bfd_alloc (abfd, info->dyninfo.ld_symb_size); - if (info->dynstr == NULL && info->dyninfo.ld_symb_size != 0) - return false; - if (bfd_seek (abfd, info->dyninfo.ld_symbols, SEEK_SET) != 0 - || (bfd_read ((PTR) info->dynstr, 1, info->dyninfo.ld_symb_size, - abfd) - != info->dyninfo.ld_symb_size)) - { - if (info->dynstr != NULL) - { - bfd_release (abfd, info->dynstr); - info->dynstr = NULL; - } - return false; - } - } - - return true; -} - -/* Read in the dynamic symbols. */ - -static long -sunos_canonicalize_dynamic_symtab (abfd, storage) - bfd *abfd; - asymbol **storage; -{ - struct sunos_dynamic_info *info; - unsigned long i; - - if (! sunos_slurp_dynamic_symtab (abfd)) - return -1; - - info = (struct sunos_dynamic_info *) obj_aout_dynamic_info (abfd); - -#ifdef CHECK_DYNAMIC_HASH - /* Check my understanding of the dynamic hash table by making sure - that each symbol can be located in the hash table. */ - { - bfd_size_type table_size; - bfd_byte *table; - bfd_size_type i; - - if (info->dyninfo.ld_buckets > info->dynsym_count) - abort (); - table_size = info->dyninfo.ld_stab - info->dyninfo.ld_hash; - table = (bfd_byte *) bfd_malloc (table_size); - if (table == NULL && table_size != 0) - abort (); - if (bfd_seek (abfd, info->dyninfo.ld_hash, SEEK_SET) != 0 - || bfd_read ((PTR) table, 1, table_size, abfd) != table_size) - abort (); - for (i = 0; i < info->dynsym_count; i++) - { - unsigned char *name; - unsigned long hash; - - name = ((unsigned char *) info->dynstr - + GET_WORD (abfd, info->dynsym[i].e_strx)); - hash = 0; - while (*name != '\0') - hash = (hash << 1) + *name++; - hash &= 0x7fffffff; - hash %= info->dyninfo.ld_buckets; - while (GET_WORD (abfd, table + hash * HASH_ENTRY_SIZE) != i) - { - hash = GET_WORD (abfd, - table + hash * HASH_ENTRY_SIZE + BYTES_IN_WORD); - if (hash == 0 || hash >= table_size / HASH_ENTRY_SIZE) - abort (); - } - } - free (table); - } -#endif /* CHECK_DYNAMIC_HASH */ - - /* Get the asymbol structures corresponding to the dynamic nlist - structures. */ - if (info->canonical_dynsym == (aout_symbol_type *) NULL) - { - info->canonical_dynsym = ((aout_symbol_type *) - bfd_alloc (abfd, - (info->dynsym_count - * sizeof (aout_symbol_type)))); - if (info->canonical_dynsym == NULL && info->dynsym_count != 0) - return -1; - - if (! aout_32_translate_symbol_table (abfd, info->canonical_dynsym, - info->dynsym, info->dynsym_count, - info->dynstr, - info->dyninfo.ld_symb_size, - true)) - { - if (info->canonical_dynsym != NULL) - { - bfd_release (abfd, info->canonical_dynsym); - info->canonical_dynsym = NULL; - } - return -1; - } - } - - /* Return pointers to the dynamic asymbol structures. */ - for (i = 0; i < info->dynsym_count; i++) - *storage++ = (asymbol *) (info->canonical_dynsym + i); - *storage = NULL; - - return info->dynsym_count; -} - -/* Return the amount of memory required for the dynamic relocs. */ - -static long -sunos_get_dynamic_reloc_upper_bound (abfd) - bfd *abfd; -{ - struct sunos_dynamic_info *info; - - if (! sunos_read_dynamic_info (abfd)) - return -1; - - info = (struct sunos_dynamic_info *) obj_aout_dynamic_info (abfd); - if (! info->valid) - { - bfd_set_error (bfd_error_no_symbols); - return -1; - } - - return (info->dynrel_count + 1) * sizeof (arelent *); -} - -/* Read in the dynamic relocs. */ - -static long -sunos_canonicalize_dynamic_reloc (abfd, storage, syms) - bfd *abfd; - arelent **storage; - asymbol **syms; -{ - struct sunos_dynamic_info *info; - unsigned long i; - - /* Get the general dynamic information. */ - if (obj_aout_dynamic_info (abfd) == (PTR) NULL) - { - if (! sunos_read_dynamic_info (abfd)) - return -1; - } - - info = (struct sunos_dynamic_info *) obj_aout_dynamic_info (abfd); - if (! info->valid) - { - bfd_set_error (bfd_error_no_symbols); - return -1; - } - - /* Get the dynamic reloc information. */ - if (info->dynrel == NULL) - { - info->dynrel = (PTR) bfd_alloc (abfd, - (info->dynrel_count - * obj_reloc_entry_size (abfd))); - if (info->dynrel == NULL && info->dynrel_count != 0) - return -1; - if (bfd_seek (abfd, info->dyninfo.ld_rel, SEEK_SET) != 0 - || (bfd_read ((PTR) info->dynrel, info->dynrel_count, - obj_reloc_entry_size (abfd), abfd) - != info->dynrel_count * obj_reloc_entry_size (abfd))) - { - if (info->dynrel != NULL) - { - bfd_release (abfd, info->dynrel); - info->dynrel = NULL; - } - return -1; - } - } - - /* Get the arelent structures corresponding to the dynamic reloc - information. */ - if (info->canonical_dynrel == (arelent *) NULL) - { - arelent *to; - - info->canonical_dynrel = ((arelent *) - bfd_alloc (abfd, - (info->dynrel_count - * sizeof (arelent)))); - if (info->canonical_dynrel == NULL && info->dynrel_count != 0) - return -1; - - to = info->canonical_dynrel; - - if (obj_reloc_entry_size (abfd) == RELOC_EXT_SIZE) - { - register struct reloc_ext_external *p; - struct reloc_ext_external *pend; - - p = (struct reloc_ext_external *) info->dynrel; - pend = p + info->dynrel_count; - for (; p < pend; p++, to++) - NAME(aout,swap_ext_reloc_in) (abfd, p, to, syms, - info->dynsym_count); - } - else - { - register struct reloc_std_external *p; - struct reloc_std_external *pend; - - p = (struct reloc_std_external *) info->dynrel; - pend = p + info->dynrel_count; - for (; p < pend; p++, to++) - NAME(aout,swap_std_reloc_in) (abfd, p, to, syms, - info->dynsym_count); - } - } - - /* Return pointers to the dynamic arelent structures. */ - for (i = 0; i < info->dynrel_count; i++) - *storage++ = info->canonical_dynrel + i; - *storage = NULL; - - return info->dynrel_count; -} - -/* Code to handle linking of SunOS shared libraries. */ - -/* A SPARC procedure linkage table entry is 12 bytes. The first entry - in the table is a jump which is filled in by the runtime linker. - The remaining entries are branches back to the first entry, - followed by an index into the relocation table encoded to look like - a sethi of %g0. */ - -#define SPARC_PLT_ENTRY_SIZE (12) - -static const bfd_byte sparc_plt_first_entry[SPARC_PLT_ENTRY_SIZE] = -{ - /* sethi %hi(0),%g1; address filled in by runtime linker. */ - 0x3, 0, 0, 0, - /* jmp %g1; offset filled in by runtime linker. */ - 0x81, 0xc0, 0x60, 0, - /* nop */ - 0x1, 0, 0, 0 -}; - -/* save %sp, -96, %sp */ -#define SPARC_PLT_ENTRY_WORD0 0x9de3bfa0 -/* call; address filled in later. */ -#define SPARC_PLT_ENTRY_WORD1 0x40000000 -/* sethi; reloc index filled in later. */ -#define SPARC_PLT_ENTRY_WORD2 0x01000000 - -/* This sequence is used when for the jump table entry to a defined - symbol in a complete executable. It is used when linking PIC - compiled code which is not being put into a shared library. */ -/* sethi <address to be filled in later>, %g1 */ -#define SPARC_PLT_PIC_WORD0 0x03000000 -/* jmp %g1 + <address to be filled in later> */ -#define SPARC_PLT_PIC_WORD1 0x81c06000 -/* nop */ -#define SPARC_PLT_PIC_WORD2 0x01000000 - -/* An m68k procedure linkage table entry is 8 bytes. The first entry - in the table is a jump which is filled in the by the runtime - linker. The remaining entries are branches back to the first - entry, followed by a two byte index into the relocation table. */ - -#define M68K_PLT_ENTRY_SIZE (8) - -static const bfd_byte m68k_plt_first_entry[M68K_PLT_ENTRY_SIZE] = -{ - /* jmps @# */ - 0x4e, 0xf9, - /* Filled in by runtime linker with a magic address. */ - 0, 0, 0, 0, - /* Not used? */ - 0, 0 -}; - -/* bsrl */ -#define M68K_PLT_ENTRY_WORD0 (0x61ff) -/* Remaining words filled in later. */ - -/* An entry in the SunOS linker hash table. */ - -struct sunos_link_hash_entry -{ - struct aout_link_hash_entry root; - - /* If this is a dynamic symbol, this is its index into the dynamic - symbol table. This is initialized to -1. As the linker looks at - the input files, it changes this to -2 if it will be added to the - dynamic symbol table. After all the input files have been seen, - the linker will know whether to build a dynamic symbol table; if - it does build one, this becomes the index into the table. */ - long dynindx; - - /* If this is a dynamic symbol, this is the index of the name in the - dynamic symbol string table. */ - long dynstr_index; - - /* The offset into the global offset table used for this symbol. If - the symbol does not require a GOT entry, this is 0. */ - bfd_vma got_offset; - - /* The offset into the procedure linkage table used for this symbol. - If the symbol does not require a PLT entry, this is 0. */ - bfd_vma plt_offset; - - /* Some linker flags. */ - unsigned char flags; - /* Symbol is referenced by a regular object. */ -#define SUNOS_REF_REGULAR 01 - /* Symbol is defined by a regular object. */ -#define SUNOS_DEF_REGULAR 02 - /* Symbol is referenced by a dynamic object. */ -#define SUNOS_REF_DYNAMIC 04 - /* Symbol is defined by a dynamic object. */ -#define SUNOS_DEF_DYNAMIC 010 - /* Symbol is a constructor symbol in a regular object. */ -#define SUNOS_CONSTRUCTOR 020 -}; - -/* The SunOS linker hash table. */ - -struct sunos_link_hash_table -{ - struct aout_link_hash_table root; - - /* The object which holds the dynamic sections. */ - bfd *dynobj; - - /* Whether we have created the dynamic sections. */ - boolean dynamic_sections_created; - - /* Whether we need the dynamic sections. */ - boolean dynamic_sections_needed; - - /* Whether we need the .got table. */ - boolean got_needed; - - /* The number of dynamic symbols. */ - size_t dynsymcount; - - /* The number of buckets in the hash table. */ - size_t bucketcount; - - /* The list of dynamic objects needed by dynamic objects included in - the link. */ - struct bfd_link_needed_list *needed; - - /* The offset of __GLOBAL_OFFSET_TABLE_ into the .got section. */ - bfd_vma got_base; -}; - -/* Routine to create an entry in an SunOS link hash table. */ - -static struct bfd_hash_entry * -sunos_link_hash_newfunc (entry, table, string) - struct bfd_hash_entry *entry; - struct bfd_hash_table *table; - const char *string; -{ - struct sunos_link_hash_entry *ret = (struct sunos_link_hash_entry *) entry; - - /* Allocate the structure if it has not already been allocated by a - subclass. */ - if (ret == (struct sunos_link_hash_entry *) NULL) - ret = ((struct sunos_link_hash_entry *) - bfd_hash_allocate (table, sizeof (struct sunos_link_hash_entry))); - if (ret == (struct sunos_link_hash_entry *) NULL) - return (struct bfd_hash_entry *) ret; - - /* Call the allocation method of the superclass. */ - ret = ((struct sunos_link_hash_entry *) - NAME(aout,link_hash_newfunc) ((struct bfd_hash_entry *) ret, - table, string)); - if (ret != NULL) - { - /* Set local fields. */ - ret->dynindx = -1; - ret->dynstr_index = -1; - ret->got_offset = 0; - ret->plt_offset = 0; - ret->flags = 0; - } - - return (struct bfd_hash_entry *) ret; -} - -/* Create a SunOS link hash table. */ - -static struct bfd_link_hash_table * -sunos_link_hash_table_create (abfd) - bfd *abfd; -{ - struct sunos_link_hash_table *ret; - - ret = ((struct sunos_link_hash_table *) - bfd_alloc (abfd, sizeof (struct sunos_link_hash_table))); - if (ret == (struct sunos_link_hash_table *) NULL) - return (struct bfd_link_hash_table *) NULL; - if (! NAME(aout,link_hash_table_init) (&ret->root, abfd, - sunos_link_hash_newfunc)) - { - bfd_release (abfd, ret); - return (struct bfd_link_hash_table *) NULL; - } - - ret->dynobj = NULL; - ret->dynamic_sections_created = false; - ret->dynamic_sections_needed = false; - ret->got_needed = false; - ret->dynsymcount = 0; - ret->bucketcount = 0; - ret->needed = NULL; - ret->got_base = 0; - - return &ret->root.root; -} - -/* Look up an entry in an SunOS link hash table. */ - -#define sunos_link_hash_lookup(table, string, create, copy, follow) \ - ((struct sunos_link_hash_entry *) \ - aout_link_hash_lookup (&(table)->root, (string), (create), (copy),\ - (follow))) - -/* Traverse a SunOS link hash table. */ - -#define sunos_link_hash_traverse(table, func, info) \ - (aout_link_hash_traverse \ - (&(table)->root, \ - (boolean (*) PARAMS ((struct aout_link_hash_entry *, PTR))) (func), \ - (info))) - -/* Get the SunOS link hash table from the info structure. This is - just a cast. */ - -#define sunos_hash_table(p) ((struct sunos_link_hash_table *) ((p)->hash)) - -static boolean sunos_scan_dynamic_symbol - PARAMS ((struct sunos_link_hash_entry *, PTR)); - -/* Create the dynamic sections needed if we are linking against a - dynamic object, or if we are linking PIC compiled code. ABFD is a - bfd we can attach the dynamic sections to. The linker script will - look for these special sections names and put them in the right - place in the output file. See include/aout/sun4.h for more details - of the dynamic linking information. */ - -static boolean -sunos_create_dynamic_sections (abfd, info, needed) - bfd *abfd; - struct bfd_link_info *info; - boolean needed; -{ - asection *s; - - if (! sunos_hash_table (info)->dynamic_sections_created) - { - flagword flags; - - sunos_hash_table (info)->dynobj = abfd; - - flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY - | SEC_LINKER_CREATED); - - /* The .dynamic section holds the basic dynamic information: the - sun4_dynamic structure, the dynamic debugger information, and - the sun4_dynamic_link structure. */ - s = bfd_make_section (abfd, ".dynamic"); - if (s == NULL - || ! bfd_set_section_flags (abfd, s, flags) - || ! bfd_set_section_alignment (abfd, s, 2)) - return false; - - /* The .got section holds the global offset table. The address - is put in the ld_got field. */ - s = bfd_make_section (abfd, ".got"); - if (s == NULL - || ! bfd_set_section_flags (abfd, s, flags) - || ! bfd_set_section_alignment (abfd, s, 2)) - return false; - - /* The .plt section holds the procedure linkage table. The - address is put in the ld_plt field. */ - s = bfd_make_section (abfd, ".plt"); - if (s == NULL - || ! bfd_set_section_flags (abfd, s, flags | SEC_CODE) - || ! bfd_set_section_alignment (abfd, s, 2)) - return false; - - /* The .dynrel section holds the dynamic relocs. The address is - put in the ld_rel field. */ - s = bfd_make_section (abfd, ".dynrel"); - if (s == NULL - || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY) - || ! bfd_set_section_alignment (abfd, s, 2)) - return false; - - /* The .hash section holds the dynamic hash table. The address - is put in the ld_hash field. */ - s = bfd_make_section (abfd, ".hash"); - if (s == NULL - || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY) - || ! bfd_set_section_alignment (abfd, s, 2)) - return false; - - /* The .dynsym section holds the dynamic symbols. The address - is put in the ld_stab field. */ - s = bfd_make_section (abfd, ".dynsym"); - if (s == NULL - || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY) - || ! bfd_set_section_alignment (abfd, s, 2)) - return false; - - /* The .dynstr section holds the dynamic symbol string table. - The address is put in the ld_symbols field. */ - s = bfd_make_section (abfd, ".dynstr"); - if (s == NULL - || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY) - || ! bfd_set_section_alignment (abfd, s, 2)) - return false; - - sunos_hash_table (info)->dynamic_sections_created = true; - } - - if ((needed && ! sunos_hash_table (info)->dynamic_sections_needed) - || info->shared) - { - bfd *dynobj; - - dynobj = sunos_hash_table (info)->dynobj; - - s = bfd_get_section_by_name (dynobj, ".got"); - if (s->_raw_size == 0) - s->_raw_size = BYTES_IN_WORD; - - sunos_hash_table (info)->dynamic_sections_needed = true; - sunos_hash_table (info)->got_needed = true; - } - - return true; -} - -/* Add dynamic symbols during a link. This is called by the a.out - backend linker for each object it encounters. */ - -static boolean -sunos_add_dynamic_symbols (abfd, info, symsp, sym_countp, stringsp) - bfd *abfd; - struct bfd_link_info *info; - struct external_nlist **symsp; - bfd_size_type *sym_countp; - char **stringsp; -{ - asection *s; - bfd *dynobj; - struct sunos_dynamic_info *dinfo; - unsigned long need; - - /* Make sure we have all the required sections. */ - if (info->hash->creator == abfd->xvec) - { - if (! sunos_create_dynamic_sections (abfd, info, - (((abfd->flags & DYNAMIC) != 0 - && ! info->relocateable) - ? true - : false))) - return false; - } - - /* There is nothing else to do for a normal object. */ - if ((abfd->flags & DYNAMIC) == 0) - return true; - - dynobj = sunos_hash_table (info)->dynobj; - - /* We do not want to include the sections in a dynamic object in the - output file. We hack by simply clobbering the list of sections - in the BFD. This could be handled more cleanly by, say, a new - section flag; the existing SEC_NEVER_LOAD flag is not the one we - want, because that one still implies that the section takes up - space in the output file. If this is the first object we have - seen, we must preserve the dynamic sections we just created. */ - if (abfd != dynobj) - abfd->sections = NULL; - else - { - asection *s; - - for (s = abfd->sections; - (s->flags & SEC_LINKER_CREATED) == 0; - s = s->next) - ; - abfd->sections = s; - } - - /* The native linker seems to just ignore dynamic objects when -r is - used. */ - if (info->relocateable) - return true; - - /* There's no hope of using a dynamic object which does not exactly - match the format of the output file. */ - if (info->hash->creator != abfd->xvec) - { - bfd_set_error (bfd_error_invalid_operation); - return false; - } - - /* Make sure we have a .need and a .rules sections. These are only - needed if there really is a dynamic object in the link, so they - are not added by sunos_create_dynamic_sections. */ - if (bfd_get_section_by_name (dynobj, ".need") == NULL) - { - /* The .need section holds the list of names of shared objets - which must be included at runtime. The address of this - section is put in the ld_need field. */ - s = bfd_make_section (dynobj, ".need"); - if (s == NULL - || ! bfd_set_section_flags (dynobj, s, - (SEC_ALLOC - | SEC_LOAD - | SEC_HAS_CONTENTS - | SEC_IN_MEMORY - | SEC_READONLY)) - || ! bfd_set_section_alignment (dynobj, s, 2)) - return false; - } - - if (bfd_get_section_by_name (dynobj, ".rules") == NULL) - { - /* The .rules section holds the path to search for shared - objects. The address of this section is put in the ld_rules - field. */ - s = bfd_make_section (dynobj, ".rules"); - if (s == NULL - || ! bfd_set_section_flags (dynobj, s, - (SEC_ALLOC - | SEC_LOAD - | SEC_HAS_CONTENTS - | SEC_IN_MEMORY - | SEC_READONLY)) - || ! bfd_set_section_alignment (dynobj, s, 2)) - return false; - } - - /* Pick up the dynamic symbols and return them to the caller. */ - if (! sunos_slurp_dynamic_symtab (abfd)) - return false; - - dinfo = (struct sunos_dynamic_info *) obj_aout_dynamic_info (abfd); - *symsp = dinfo->dynsym; - *sym_countp = dinfo->dynsym_count; - *stringsp = dinfo->dynstr; - - /* Record information about any other objects needed by this one. */ - need = dinfo->dyninfo.ld_need; - while (need != 0) - { - bfd_byte buf[16]; - unsigned long name, flags; - unsigned short major_vno, minor_vno; - struct bfd_link_needed_list *needed, **pp; - char *namebuf, *p; - size_t alc; - bfd_byte b; - char *namecopy; - - if (bfd_seek (abfd, need, SEEK_SET) != 0 - || bfd_read (buf, 1, 16, abfd) != 16) - return false; - - /* For the format of an ld_need entry, see aout/sun4.h. We - should probably define structs for this manipulation. */ - - name = bfd_get_32 (abfd, buf); - flags = bfd_get_32 (abfd, buf + 4); - major_vno = (unsigned short)bfd_get_16 (abfd, buf + 8); - minor_vno = (unsigned short)bfd_get_16 (abfd, buf + 10); - need = bfd_get_32 (abfd, buf + 12); - - needed = ((struct bfd_link_needed_list *) - bfd_alloc (abfd, sizeof (struct bfd_link_needed_list))); - if (needed == NULL) - return false; - needed->by = abfd; - - /* We return the name as [-l]name[.maj][.min]. */ - alc = 30; - namebuf = (char *) bfd_malloc (alc + 1); - if (namebuf == NULL) - return false; - p = namebuf; - - if ((flags & 0x80000000) != 0) - { - *p++ = '-'; - *p++ = 'l'; - } - if (bfd_seek (abfd, name, SEEK_SET) != 0) - { - free (namebuf); - return false; - } - - do - { - if (bfd_read (&b, 1, 1, abfd) != 1) - { - free (namebuf); - return false; - } - - if ((size_t) (p - namebuf) >= alc) - { - char *n; - - alc *= 2; - n = (char *) bfd_realloc (namebuf, alc + 1); - if (n == NULL) - { - free (namebuf); - return false; - } - p = n + (p - namebuf); - namebuf = n; - } - - *p++ = b; - } - while (b != '\0'); - - if (major_vno == 0) - *p = '\0'; - else - { - char majbuf[30]; - char minbuf[30]; - - sprintf (majbuf, ".%d", major_vno); - if (minor_vno == 0) - minbuf[0] = '\0'; - else - sprintf (minbuf, ".%d", minor_vno); - - if ((p - namebuf) + strlen (majbuf) + strlen (minbuf) >= alc) - { - char *n; - - alc = (p - namebuf) + strlen (majbuf) + strlen (minbuf); - n = (char *) bfd_realloc (namebuf, alc + 1); - if (n == NULL) - { - free (namebuf); - return false; - } - p = n + (p - namebuf); - namebuf = n; - } - - strcpy (p, majbuf); - strcat (p, minbuf); - } - - namecopy = bfd_alloc (abfd, strlen (namebuf) + 1); - if (namecopy == NULL) - { - free (namebuf); - return false; - } - strcpy (namecopy, namebuf); - free (namebuf); - needed->name = namecopy; - - needed->next = NULL; - - for (pp = &sunos_hash_table (info)->needed; - *pp != NULL; - pp = &(*pp)->next) - ; - *pp = needed; - } - - return true; -} - -/* Function to add a single symbol to the linker hash table. This is - a wrapper around _bfd_generic_link_add_one_symbol which handles the - tweaking needed for dynamic linking support. */ - -static boolean -sunos_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; -{ - struct sunos_link_hash_entry *h; - int new_flag; - - if ((flags & (BSF_INDIRECT | BSF_WARNING | BSF_CONSTRUCTOR)) != 0 - || ! bfd_is_und_section (section)) - h = sunos_link_hash_lookup (sunos_hash_table (info), name, true, copy, - false); - else - h = ((struct sunos_link_hash_entry *) - bfd_wrapped_link_hash_lookup (abfd, info, name, true, copy, false)); - if (h == NULL) - return false; - - if (hashp != NULL) - *hashp = (struct bfd_link_hash_entry *) h; - - /* Treat a common symbol in a dynamic object as defined in the .bss - section of the dynamic object. We don't want to allocate space - for it in our process image. */ - if ((abfd->flags & DYNAMIC) != 0 - && bfd_is_com_section (section)) - section = obj_bsssec (abfd); - - if (! bfd_is_und_section (section) - && h->root.root.type != bfd_link_hash_new - && h->root.root.type != bfd_link_hash_undefined - && h->root.root.type != bfd_link_hash_defweak) - { - /* We are defining the symbol, and it is already defined. This - is a potential multiple definition error. */ - if ((abfd->flags & DYNAMIC) != 0) - { - /* The definition we are adding is from a dynamic object. - We do not want this new definition to override the - existing definition, so we pretend it is just a - reference. */ - section = bfd_und_section_ptr; - } - else if (h->root.root.type == bfd_link_hash_defined - && h->root.root.u.def.section->owner != NULL - && (h->root.root.u.def.section->owner->flags & DYNAMIC) != 0) - { - /* The existing definition is from a dynamic object. We - want to override it with the definition we just found. - Clobber the existing definition. */ - h->root.root.type = bfd_link_hash_undefined; - h->root.root.u.undef.abfd = h->root.root.u.def.section->owner; - } - else if (h->root.root.type == bfd_link_hash_common - && (h->root.root.u.c.p->section->owner->flags & DYNAMIC) != 0) - { - /* The existing definition is from a dynamic object. We - want to override it with the definition we just found. - Clobber the existing definition. We can't set it to new, - because it is on the undefined list. */ - h->root.root.type = bfd_link_hash_undefined; - h->root.root.u.undef.abfd = h->root.root.u.c.p->section->owner; - } - } - - if ((abfd->flags & DYNAMIC) != 0 - && abfd->xvec == info->hash->creator - && (h->flags & SUNOS_CONSTRUCTOR) != 0) - { - /* The existing symbol is a constructor symbol, and this symbol - is from a dynamic object. A constructor symbol is actually a - definition, although the type will be bfd_link_hash_undefined - at this point. We want to ignore the definition from the - dynamic object. */ - section = bfd_und_section_ptr; - } - else if ((flags & BSF_CONSTRUCTOR) != 0 - && (abfd->flags & DYNAMIC) == 0 - && h->root.root.type == bfd_link_hash_defined - && h->root.root.u.def.section->owner != NULL - && (h->root.root.u.def.section->owner->flags & DYNAMIC) != 0) - { - /* The existing symbol is defined by a dynamic object, and this - is a constructor symbol. As above, we want to force the use - of the constructor symbol from the regular object. */ - h->root.root.type = bfd_link_hash_new; - } - - /* Do the usual procedure for adding a symbol. */ - if (! _bfd_generic_link_add_one_symbol (info, abfd, name, flags, section, - value, string, copy, collect, - hashp)) - return false; - - if (abfd->xvec == info->hash->creator) - { - /* Set a flag in the hash table entry indicating the type of - reference or definition we just found. Keep a count of the - number of dynamic symbols we find. A dynamic symbol is one - which is referenced or defined by both a regular object and a - shared object. */ - if ((abfd->flags & DYNAMIC) == 0) - { - if (bfd_is_und_section (section)) - new_flag = SUNOS_REF_REGULAR; - else - new_flag = SUNOS_DEF_REGULAR; - } - else - { - if (bfd_is_und_section (section)) - new_flag = SUNOS_REF_DYNAMIC; - else - new_flag = SUNOS_DEF_DYNAMIC; - } - h->flags |= new_flag; - - if (h->dynindx == -1 - && (h->flags & (SUNOS_DEF_REGULAR | SUNOS_REF_REGULAR)) != 0) - { - ++sunos_hash_table (info)->dynsymcount; - h->dynindx = -2; - } - - if ((flags & BSF_CONSTRUCTOR) != 0 - && (abfd->flags & DYNAMIC) == 0) - h->flags |= SUNOS_CONSTRUCTOR; - } - - return true; -} - -/* Return the list of objects needed by BFD. */ - -/*ARGSUSED*/ -struct bfd_link_needed_list * -bfd_sunos_get_needed_list (abfd, info) - bfd *abfd; - struct bfd_link_info *info; -{ - if (info->hash->creator != &MY(vec)) - return NULL; - return sunos_hash_table (info)->needed; -} - -/* Record an assignment made to a symbol by a linker script. We need - this in case some dynamic object refers to this symbol. */ - -boolean -bfd_sunos_record_link_assignment (output_bfd, info, name) - bfd *output_bfd; - struct bfd_link_info *info; - const char *name; -{ - struct sunos_link_hash_entry *h; - - if (output_bfd->xvec != &MY(vec)) - return true; - - /* This is called after we have examined all the input objects. If - the symbol does not exist, it merely means that no object refers - to it, and we can just ignore it at this point. */ - h = sunos_link_hash_lookup (sunos_hash_table (info), name, - false, false, false); - if (h == NULL) - return true; - - /* In a shared library, the __DYNAMIC symbol does not appear in the - dynamic symbol table. */ - if (! info->shared || strcmp (name, "__DYNAMIC") != 0) - { - h->flags |= SUNOS_DEF_REGULAR; - - if (h->dynindx == -1) - { - ++sunos_hash_table (info)->dynsymcount; - h->dynindx = -2; - } - } - - return true; -} - -/* Set up the sizes and contents of the dynamic sections created in - sunos_add_dynamic_symbols. This is called by the SunOS linker - emulation before_allocation routine. We must set the sizes of the - sections before the linker sets the addresses of the various - sections. This unfortunately requires reading all the relocs so - that we can work out which ones need to become dynamic relocs. If - info->keep_memory is true, we keep the relocs in memory; otherwise, - we discard them, and will read them again later. */ - -boolean -bfd_sunos_size_dynamic_sections (output_bfd, info, sdynptr, sneedptr, - srulesptr) - bfd *output_bfd; - struct bfd_link_info *info; - asection **sdynptr; - asection **sneedptr; - asection **srulesptr; -{ - bfd *dynobj; - size_t dynsymcount; - struct sunos_link_hash_entry *h; - asection *s; - size_t bucketcount; - size_t hashalloc; - size_t i; - bfd *sub; - - *sdynptr = NULL; - *sneedptr = NULL; - *srulesptr = NULL; - - if (info->relocateable) - return true; - - if (output_bfd->xvec != &MY(vec)) - return true; - - /* Look through all the input BFD's and read their relocs. It would - be better if we didn't have to do this, but there is no other way - to determine the number of dynamic relocs we need, and, more - importantly, there is no other way to know which symbols should - get an entry in the procedure linkage table. */ - for (sub = info->input_bfds; sub != NULL; sub = sub->link_next) - { - if ((sub->flags & DYNAMIC) == 0 - && sub->xvec == output_bfd->xvec) - { - if (! sunos_scan_relocs (info, sub, obj_textsec (sub), - exec_hdr (sub)->a_trsize) - || ! sunos_scan_relocs (info, sub, obj_datasec (sub), - exec_hdr (sub)->a_drsize)) - return false; - } - } - - dynobj = sunos_hash_table (info)->dynobj; - dynsymcount = sunos_hash_table (info)->dynsymcount; - - /* If there were no dynamic objects in the link, and we don't need - to build a global offset table, there is nothing to do here. */ - if (! sunos_hash_table (info)->dynamic_sections_needed - && ! sunos_hash_table (info)->got_needed) - return true; - - /* If __GLOBAL_OFFSET_TABLE_ was mentioned, define it. */ - h = sunos_link_hash_lookup (sunos_hash_table (info), - "__GLOBAL_OFFSET_TABLE_", false, false, false); - if (h != NULL && (h->flags & SUNOS_REF_REGULAR) != 0) - { - h->flags |= SUNOS_DEF_REGULAR; - if (h->dynindx == -1) - { - ++sunos_hash_table (info)->dynsymcount; - h->dynindx = -2; - } - h->root.root.type = bfd_link_hash_defined; - h->root.root.u.def.section = bfd_get_section_by_name (dynobj, ".got"); - - /* If the .got section is more than 0x1000 bytes, we set - __GLOBAL_OFFSET_TABLE_ to be 0x1000 bytes into the section, - so that 13 bit relocations have a greater chance of working. */ - s = bfd_get_section_by_name (dynobj, ".got"); - BFD_ASSERT (s != NULL); - if (s->_raw_size >= 0x1000) - h->root.root.u.def.value = 0x1000; - else - h->root.root.u.def.value = 0; - - sunos_hash_table (info)->got_base = h->root.root.u.def.value; - } - - /* If there are any shared objects in the link, then we need to set - up the dynamic linking information. */ - if (sunos_hash_table (info)->dynamic_sections_needed) - { - *sdynptr = bfd_get_section_by_name (dynobj, ".dynamic"); - - /* The .dynamic section is always the same size. */ - s = *sdynptr; - BFD_ASSERT (s != NULL); - s->_raw_size = (sizeof (struct external_sun4_dynamic) - + EXTERNAL_SUN4_DYNAMIC_DEBUGGER_SIZE - + sizeof (struct external_sun4_dynamic_link)); - - /* Set the size of the .dynsym and .hash sections. We counted - the number of dynamic symbols as we read the input files. We - will build the dynamic symbol table (.dynsym) and the hash - table (.hash) when we build the final symbol table, because - until then we do not know the correct value to give the - symbols. We build the dynamic symbol string table (.dynstr) - in a traversal of the symbol table using - sunos_scan_dynamic_symbol. */ - s = bfd_get_section_by_name (dynobj, ".dynsym"); - BFD_ASSERT (s != NULL); - s->_raw_size = dynsymcount * sizeof (struct external_nlist); - s->contents = (bfd_byte *) bfd_alloc (output_bfd, s->_raw_size); - if (s->contents == NULL && s->_raw_size != 0) - return false; - - /* The number of buckets is just the number of symbols divided - by four. To compute the final size of the hash table, we - must actually compute the hash table. Normally we need - exactly as many entries in the hash table as there are - dynamic symbols, but if some of the buckets are not used we - will need additional entries. In the worst case, every - symbol will hash to the same bucket, and we will need - BUCKETCOUNT - 1 extra entries. */ - if (dynsymcount >= 4) - bucketcount = dynsymcount / 4; - else if (dynsymcount > 0) - bucketcount = dynsymcount; - else - bucketcount = 1; - s = bfd_get_section_by_name (dynobj, ".hash"); - BFD_ASSERT (s != NULL); - hashalloc = (dynsymcount + bucketcount - 1) * HASH_ENTRY_SIZE; - s->contents = (bfd_byte *) bfd_alloc (dynobj, hashalloc); - if (s->contents == NULL && dynsymcount > 0) - return false; - memset (s->contents, 0, hashalloc); - for (i = 0; i < bucketcount; i++) - PUT_WORD (output_bfd, (bfd_vma) -1, s->contents + i * HASH_ENTRY_SIZE); - s->_raw_size = bucketcount * HASH_ENTRY_SIZE; - - sunos_hash_table (info)->bucketcount = bucketcount; - - /* Scan all the symbols, place them in the dynamic symbol table, - and build the dynamic hash table. We reuse dynsymcount as a - counter for the number of symbols we have added so far. */ - sunos_hash_table (info)->dynsymcount = 0; - sunos_link_hash_traverse (sunos_hash_table (info), - sunos_scan_dynamic_symbol, - (PTR) info); - BFD_ASSERT (sunos_hash_table (info)->dynsymcount == dynsymcount); - - /* The SunOS native linker seems to align the total size of the - symbol strings to a multiple of 8. I don't know if this is - important, but it can't hurt much. */ - s = bfd_get_section_by_name (dynobj, ".dynstr"); - BFD_ASSERT (s != NULL); - if ((s->_raw_size & 7) != 0) - { - bfd_size_type add; - bfd_byte *contents; - - add = 8 - (s->_raw_size & 7); - contents = (bfd_byte *) bfd_realloc (s->contents, - (size_t) (s->_raw_size + add)); - if (contents == NULL) - return false; - memset (contents + s->_raw_size, 0, (size_t) add); - s->contents = contents; - s->_raw_size += add; - } - } - - /* Now that we have worked out the sizes of the procedure linkage - table and the dynamic relocs, allocate storage for them. */ - s = bfd_get_section_by_name (dynobj, ".plt"); - BFD_ASSERT (s != NULL); - if (s->_raw_size != 0) - { - s->contents = (bfd_byte *) bfd_alloc (dynobj, s->_raw_size); - if (s->contents == NULL) - return false; - - /* Fill in the first entry in the table. */ - switch (bfd_get_arch (dynobj)) - { - case bfd_arch_sparc: - memcpy (s->contents, sparc_plt_first_entry, SPARC_PLT_ENTRY_SIZE); - break; - - case bfd_arch_m68k: - memcpy (s->contents, m68k_plt_first_entry, M68K_PLT_ENTRY_SIZE); - break; - - default: - abort (); - } - } - - s = bfd_get_section_by_name (dynobj, ".dynrel"); - if (s->_raw_size != 0) - { - s->contents = (bfd_byte *) bfd_alloc (dynobj, s->_raw_size); - if (s->contents == NULL) - return false; - } - /* We use the reloc_count field to keep track of how many of the - relocs we have output so far. */ - s->reloc_count = 0; - - /* Make space for the global offset table. */ - s = bfd_get_section_by_name (dynobj, ".got"); - s->contents = (bfd_byte *) bfd_alloc (dynobj, s->_raw_size); - if (s->contents == NULL) - return false; - - *sneedptr = bfd_get_section_by_name (dynobj, ".need"); - *srulesptr = bfd_get_section_by_name (dynobj, ".rules"); - - return true; -} - -/* Scan the relocs for an input section. */ - -static boolean -sunos_scan_relocs (info, abfd, sec, rel_size) - struct bfd_link_info *info; - bfd *abfd; - asection *sec; - bfd_size_type rel_size; -{ - PTR relocs; - PTR free_relocs = NULL; - - if (rel_size == 0) - return true; - - if (! info->keep_memory) - relocs = free_relocs = bfd_malloc ((size_t) rel_size); - else - { - struct aout_section_data_struct *n; - - n = ((struct aout_section_data_struct *) - bfd_alloc (abfd, sizeof (struct aout_section_data_struct))); - if (n == NULL) - relocs = NULL; - else - { - set_aout_section_data (sec, n); - relocs = bfd_malloc ((size_t) rel_size); - aout_section_data (sec)->relocs = relocs; - } - } - if (relocs == NULL) - return false; - - if (bfd_seek (abfd, sec->rel_filepos, SEEK_SET) != 0 - || bfd_read (relocs, 1, rel_size, abfd) != rel_size) - goto error_return; - - if (obj_reloc_entry_size (abfd) == RELOC_STD_SIZE) - { - if (! sunos_scan_std_relocs (info, abfd, sec, - (struct reloc_std_external *) relocs, - rel_size)) - goto error_return; - } - else - { - if (! sunos_scan_ext_relocs (info, abfd, sec, - (struct reloc_ext_external *) relocs, - rel_size)) - goto error_return; - } - - if (free_relocs != NULL) - free (free_relocs); - - return true; - - error_return: - if (free_relocs != NULL) - free (free_relocs); - return false; -} - -/* Scan the relocs for an input section using standard relocs. We - need to figure out what to do for each reloc against a dynamic - symbol. If the symbol is in the .text section, an entry is made in - the procedure linkage table. Note that this will do the wrong - thing if the symbol is actually data; I don't think the Sun 3 - native linker handles this case correctly either. If the symbol is - not in the .text section, we must preserve the reloc as a dynamic - reloc. FIXME: We should also handle the PIC relocs here by - building global offset table entries. */ - -static boolean -sunos_scan_std_relocs (info, abfd, sec, relocs, rel_size) - struct bfd_link_info *info; - bfd *abfd; - asection *sec; - const struct reloc_std_external *relocs; - bfd_size_type rel_size; -{ - bfd *dynobj; - asection *splt = NULL; - asection *srel = NULL; - struct sunos_link_hash_entry **sym_hashes; - const struct reloc_std_external *rel, *relend; - - /* We only know how to handle m68k plt entries. */ - if (bfd_get_arch (abfd) != bfd_arch_m68k) - { - bfd_set_error (bfd_error_invalid_target); - return false; - } - - dynobj = NULL; - - sym_hashes = (struct sunos_link_hash_entry **) obj_aout_sym_hashes (abfd); - - relend = relocs + rel_size / RELOC_STD_SIZE; - for (rel = relocs; rel < relend; rel++) - { - int r_index; - struct sunos_link_hash_entry *h; - - /* We only want relocs against external symbols. */ - if (bfd_header_big_endian (abfd)) - { - if ((rel->r_type[0] & RELOC_STD_BITS_EXTERN_BIG) == 0) - continue; - } - else - { - if ((rel->r_type[0] & RELOC_STD_BITS_EXTERN_LITTLE) == 0) - continue; - } - - /* Get the symbol index. */ - if (bfd_header_big_endian (abfd)) - r_index = ((rel->r_index[0] << 16) - | (rel->r_index[1] << 8) - | rel->r_index[2]); - else - r_index = ((rel->r_index[2] << 16) - | (rel->r_index[1] << 8) - | rel->r_index[0]); - - /* Get the hash table entry. */ - h = sym_hashes[r_index]; - if (h == NULL) - { - /* This should not normally happen, but it will in any case - be caught in the relocation phase. */ - continue; - } - - /* At this point common symbols have already been allocated, so - we don't have to worry about them. We need to consider that - we may have already seen this symbol and marked it undefined; - if the symbol is really undefined, then SUNOS_DEF_DYNAMIC - will be zero. */ - if (h->root.root.type != bfd_link_hash_defined - && h->root.root.type != bfd_link_hash_defweak - && h->root.root.type != bfd_link_hash_undefined) - continue; - - if ((h->flags & SUNOS_DEF_DYNAMIC) == 0 - || (h->flags & SUNOS_DEF_REGULAR) != 0) - continue; - - if (dynobj == NULL) - { - asection *sgot; - - if (! sunos_create_dynamic_sections (abfd, info, false)) - return false; - dynobj = sunos_hash_table (info)->dynobj; - splt = bfd_get_section_by_name (dynobj, ".plt"); - srel = bfd_get_section_by_name (dynobj, ".dynrel"); - BFD_ASSERT (splt != NULL && srel != NULL); - - sgot = bfd_get_section_by_name (dynobj, ".got"); - BFD_ASSERT (sgot != NULL); - if (sgot->_raw_size == 0) - sgot->_raw_size = BYTES_IN_WORD; - sunos_hash_table (info)->got_needed = true; - } - - BFD_ASSERT ((h->flags & SUNOS_REF_REGULAR) != 0); - BFD_ASSERT (h->plt_offset != 0 - || ((h->root.root.type == bfd_link_hash_defined - || h->root.root.type == bfd_link_hash_defweak) - ? (h->root.root.u.def.section->owner->flags - & DYNAMIC) != 0 - : (h->root.root.u.undef.abfd->flags & DYNAMIC) != 0)); - - /* This reloc is against a symbol defined only by a dynamic - object. */ - - if (h->root.root.type == bfd_link_hash_undefined) - { - /* Presumably this symbol was marked as being undefined by - an earlier reloc. */ - srel->_raw_size += RELOC_STD_SIZE; - } - else if ((h->root.root.u.def.section->flags & SEC_CODE) == 0) - { - bfd *sub; - - /* This reloc is not in the .text section. It must be - copied into the dynamic relocs. We mark the symbol as - being undefined. */ - srel->_raw_size += RELOC_STD_SIZE; - sub = h->root.root.u.def.section->owner; - h->root.root.type = bfd_link_hash_undefined; - h->root.root.u.undef.abfd = sub; - } - else - { - /* This symbol is in the .text section. We must give it an - entry in the procedure linkage table, if we have not - already done so. We change the definition of the symbol - to the .plt section; this will cause relocs against it to - be handled correctly. */ - if (h->plt_offset == 0) - { - if (splt->_raw_size == 0) - splt->_raw_size = M68K_PLT_ENTRY_SIZE; - h->plt_offset = splt->_raw_size; - - if ((h->flags & SUNOS_DEF_REGULAR) == 0) - { - h->root.root.u.def.section = splt; - h->root.root.u.def.value = splt->_raw_size; - } - - splt->_raw_size += M68K_PLT_ENTRY_SIZE; - - /* We may also need a dynamic reloc entry. */ - if ((h->flags & SUNOS_DEF_REGULAR) == 0) - srel->_raw_size += RELOC_STD_SIZE; - } - } - } - - return true; -} - -/* Scan the relocs for an input section using extended relocs. We - need to figure out what to do for each reloc against a dynamic - symbol. If the reloc is a WDISP30, and the symbol is in the .text - section, an entry is made in the procedure linkage table. - Otherwise, we must preserve the reloc as a dynamic reloc. */ - -static boolean -sunos_scan_ext_relocs (info, abfd, sec, relocs, rel_size) - struct bfd_link_info *info; - bfd *abfd; - asection *sec; - const struct reloc_ext_external *relocs; - bfd_size_type rel_size; -{ - bfd *dynobj; - struct sunos_link_hash_entry **sym_hashes; - const struct reloc_ext_external *rel, *relend; - asection *splt = NULL; - asection *sgot = NULL; - asection *srel = NULL; - - /* We only know how to handle SPARC plt entries. */ - if (bfd_get_arch (abfd) != bfd_arch_sparc) - { - bfd_set_error (bfd_error_invalid_target); - return false; - } - - dynobj = NULL; - - sym_hashes = (struct sunos_link_hash_entry **) obj_aout_sym_hashes (abfd); - - relend = relocs + rel_size / RELOC_EXT_SIZE; - for (rel = relocs; rel < relend; rel++) - { - unsigned int r_index; - int r_extern; - int r_type; - struct sunos_link_hash_entry *h = NULL; - - /* Swap in the reloc information. */ - if (bfd_header_big_endian (abfd)) - { - 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); - } - - if (r_extern) - { - h = sym_hashes[r_index]; - if (h == NULL) - { - /* This should not normally happen, but it will in any - case be caught in the relocation phase. */ - continue; - } - } - - /* If this is a base relative reloc, we need to make an entry in - the .got section. */ - if (r_type == RELOC_BASE10 - || r_type == RELOC_BASE13 - || r_type == RELOC_BASE22) - { - if (dynobj == NULL) - { - if (! sunos_create_dynamic_sections (abfd, info, false)) - return false; - dynobj = sunos_hash_table (info)->dynobj; - splt = bfd_get_section_by_name (dynobj, ".plt"); - sgot = bfd_get_section_by_name (dynobj, ".got"); - srel = bfd_get_section_by_name (dynobj, ".dynrel"); - BFD_ASSERT (splt != NULL && sgot != NULL && srel != NULL); - - /* Make sure we have an initial entry in the .got table. */ - if (sgot->_raw_size == 0) - sgot->_raw_size = BYTES_IN_WORD; - sunos_hash_table (info)->got_needed = true; - } - - if (r_extern) - { - if (h->got_offset != 0) - continue; - - h->got_offset = sgot->_raw_size; - } - else - { - if (r_index >= bfd_get_symcount (abfd)) - { - /* This is abnormal, but should be caught in the - relocation phase. */ - continue; - } - - if (adata (abfd).local_got_offsets == NULL) - { - adata (abfd).local_got_offsets = - (bfd_vma *) bfd_zalloc (abfd, - (bfd_get_symcount (abfd) - * sizeof (bfd_vma))); - if (adata (abfd).local_got_offsets == NULL) - return false; - } - - if (adata (abfd).local_got_offsets[r_index] != 0) - continue; - - adata (abfd).local_got_offsets[r_index] = sgot->_raw_size; - } - - sgot->_raw_size += BYTES_IN_WORD; - - /* If we are making a shared library, or if the symbol is - defined by a dynamic object, we will need a dynamic reloc - entry. */ - if (info->shared - || (h != NULL - && (h->flags & SUNOS_DEF_DYNAMIC) != 0 - && (h->flags & SUNOS_DEF_REGULAR) == 0)) - srel->_raw_size += RELOC_EXT_SIZE; - - continue; - } - - /* Otherwise, we are only interested in relocs against symbols - defined in dynamic objects but not in regular objects. We - only need to consider relocs against external symbols. */ - if (! r_extern) - { - /* But, if we are creating a shared library, we need to - generate an absolute reloc. */ - if (info->shared) - { - if (dynobj == NULL) - { - if (! sunos_create_dynamic_sections (abfd, info, true)) - return false; - dynobj = sunos_hash_table (info)->dynobj; - splt = bfd_get_section_by_name (dynobj, ".plt"); - sgot = bfd_get_section_by_name (dynobj, ".got"); - srel = bfd_get_section_by_name (dynobj, ".dynrel"); - BFD_ASSERT (splt != NULL && sgot != NULL && srel != NULL); - } - - srel->_raw_size += RELOC_EXT_SIZE; - } - - continue; - } - - /* At this point common symbols have already been allocated, so - we don't have to worry about them. We need to consider that - we may have already seen this symbol and marked it undefined; - if the symbol is really undefined, then SUNOS_DEF_DYNAMIC - will be zero. */ - if (h->root.root.type != bfd_link_hash_defined - && h->root.root.type != bfd_link_hash_defweak - && h->root.root.type != bfd_link_hash_undefined) - continue; - - if (r_type != RELOC_JMP_TBL - && ! info->shared - && ((h->flags & SUNOS_DEF_DYNAMIC) == 0 - || (h->flags & SUNOS_DEF_REGULAR) != 0)) - continue; - - if (r_type == RELOC_JMP_TBL - && ! info->shared - && (h->flags & SUNOS_DEF_DYNAMIC) == 0 - && (h->flags & SUNOS_DEF_REGULAR) == 0) - { - /* This symbol is apparently undefined. Don't do anything - here; just let the relocation routine report an undefined - symbol. */ - continue; - } - - if (strcmp (h->root.root.root.string, "__GLOBAL_OFFSET_TABLE_") == 0) - continue; - - if (dynobj == NULL) - { - if (! sunos_create_dynamic_sections (abfd, info, false)) - return false; - dynobj = sunos_hash_table (info)->dynobj; - splt = bfd_get_section_by_name (dynobj, ".plt"); - sgot = bfd_get_section_by_name (dynobj, ".got"); - srel = bfd_get_section_by_name (dynobj, ".dynrel"); - BFD_ASSERT (splt != NULL && sgot != NULL && srel != NULL); - - /* Make sure we have an initial entry in the .got table. */ - if (sgot->_raw_size == 0) - sgot->_raw_size = BYTES_IN_WORD; - sunos_hash_table (info)->got_needed = true; - } - - BFD_ASSERT (r_type == RELOC_JMP_TBL - || info->shared - || (h->flags & SUNOS_REF_REGULAR) != 0); - BFD_ASSERT (r_type == RELOC_JMP_TBL - || info->shared - || h->plt_offset != 0 - || ((h->root.root.type == bfd_link_hash_defined - || h->root.root.type == bfd_link_hash_defweak) - ? (h->root.root.u.def.section->owner->flags - & DYNAMIC) != 0 - : (h->root.root.u.undef.abfd->flags & DYNAMIC) != 0)); - - /* This reloc is against a symbol defined only by a dynamic - object, or it is a jump table reloc from PIC compiled code. */ - - if (r_type != RELOC_JMP_TBL - && h->root.root.type == bfd_link_hash_undefined) - { - /* Presumably this symbol was marked as being undefined by - an earlier reloc. */ - srel->_raw_size += RELOC_EXT_SIZE; - } - else if (r_type != RELOC_JMP_TBL - && (h->root.root.u.def.section->flags & SEC_CODE) == 0) - { - bfd *sub; - - /* This reloc is not in the .text section. It must be - copied into the dynamic relocs. We mark the symbol as - being undefined. */ - srel->_raw_size += RELOC_EXT_SIZE; - if ((h->flags & SUNOS_DEF_REGULAR) == 0) - { - sub = h->root.root.u.def.section->owner; - h->root.root.type = bfd_link_hash_undefined; - h->root.root.u.undef.abfd = sub; - } - } - else - { - /* This symbol is in the .text section. We must give it an - entry in the procedure linkage table, if we have not - already done so. We change the definition of the symbol - to the .plt section; this will cause relocs against it to - be handled correctly. */ - if (h->plt_offset == 0) - { - if (splt->_raw_size == 0) - splt->_raw_size = SPARC_PLT_ENTRY_SIZE; - h->plt_offset = splt->_raw_size; - - if ((h->flags & SUNOS_DEF_REGULAR) == 0) - { - if (h->root.root.type == bfd_link_hash_undefined) - h->root.root.type = bfd_link_hash_defined; - h->root.root.u.def.section = splt; - h->root.root.u.def.value = splt->_raw_size; - } - - splt->_raw_size += SPARC_PLT_ENTRY_SIZE; - - /* We will also need a dynamic reloc entry, unless this - is a JMP_TBL reloc produced by linking PIC compiled - code, and we are not making a shared library. */ - if (info->shared || (h->flags & SUNOS_DEF_REGULAR) == 0) - srel->_raw_size += RELOC_EXT_SIZE; - } - - /* If we are creating a shared library, we need to copy over - any reloc other than a jump table reloc. */ - if (info->shared && r_type != RELOC_JMP_TBL) - srel->_raw_size += RELOC_EXT_SIZE; - } - } - - return true; -} - -/* Build the hash table of dynamic symbols, and to mark as written all - symbols from dynamic objects which we do not plan to write out. */ - -static boolean -sunos_scan_dynamic_symbol (h, data) - struct sunos_link_hash_entry *h; - PTR data; -{ - struct bfd_link_info *info = (struct bfd_link_info *) data; - - /* Set the written flag for symbols we do not want to write out as - part of the regular symbol table. This is all symbols which are - not defined in a regular object file. For some reason symbols - which are referenced by a regular object and defined by a dynamic - object do not seem to show up in the regular symbol table. It is - possible for a symbol to have only SUNOS_REF_REGULAR set here, it - is an undefined symbol which was turned into a common symbol - because it was found in an archive object which was not included - in the link. */ - if ((h->flags & SUNOS_DEF_REGULAR) == 0 - && (h->flags & SUNOS_DEF_DYNAMIC) != 0 - && strcmp (h->root.root.root.string, "__DYNAMIC") != 0) - h->root.written = true; - - /* If this symbol is defined by a dynamic object and referenced by a - regular object, see whether we gave it a reasonable value while - scanning the relocs. */ - - if ((h->flags & SUNOS_DEF_REGULAR) == 0 - && (h->flags & SUNOS_DEF_DYNAMIC) != 0 - && (h->flags & SUNOS_REF_REGULAR) != 0) - { - if ((h->root.root.type == bfd_link_hash_defined - || h->root.root.type == bfd_link_hash_defweak) - && ((h->root.root.u.def.section->owner->flags & DYNAMIC) != 0) - && h->root.root.u.def.section->output_section == NULL) - { - bfd *sub; - - /* This symbol is currently defined in a dynamic section - which is not being put into the output file. This - implies that there is no reloc against the symbol. I'm - not sure why this case would ever occur. In any case, we - change the symbol to be undefined. */ - sub = h->root.root.u.def.section->owner; - h->root.root.type = bfd_link_hash_undefined; - h->root.root.u.undef.abfd = sub; - } - } - - /* If this symbol is defined or referenced by a regular file, add it - to the dynamic symbols. */ - if ((h->flags & (SUNOS_DEF_REGULAR | SUNOS_REF_REGULAR)) != 0) - { - asection *s; - size_t len; - bfd_byte *contents; - unsigned char *name; - unsigned long hash; - bfd *dynobj; - - BFD_ASSERT (h->dynindx == -2); - - dynobj = sunos_hash_table (info)->dynobj; - - h->dynindx = sunos_hash_table (info)->dynsymcount; - ++sunos_hash_table (info)->dynsymcount; - - len = strlen (h->root.root.root.string); - - /* We don't bother to construct a BFD hash table for the strings - which are the names of the dynamic symbols. Using a hash - table for the regular symbols is beneficial, because the - regular symbols includes the debugging symbols, which have - long names and are often duplicated in several object files. - There are no debugging symbols in the dynamic symbols. */ - s = bfd_get_section_by_name (dynobj, ".dynstr"); - BFD_ASSERT (s != NULL); - contents = (bfd_byte *) bfd_realloc (s->contents, - s->_raw_size + len + 1); - if (contents == NULL) - return false; - s->contents = contents; - - h->dynstr_index = s->_raw_size; - strcpy ((char *) contents + s->_raw_size, h->root.root.root.string); - s->_raw_size += len + 1; - - /* Add it to the dynamic hash table. */ - name = (unsigned char *) h->root.root.root.string; - hash = 0; - while (*name != '\0') - hash = (hash << 1) + *name++; - hash &= 0x7fffffff; - hash %= sunos_hash_table (info)->bucketcount; - - s = bfd_get_section_by_name (dynobj, ".hash"); - BFD_ASSERT (s != NULL); - - if (GET_SWORD (dynobj, s->contents + hash * HASH_ENTRY_SIZE) == -1) - PUT_WORD (dynobj, h->dynindx, s->contents + hash * HASH_ENTRY_SIZE); - else - { - bfd_vma next; - - next = GET_WORD (dynobj, - (s->contents - + hash * HASH_ENTRY_SIZE - + BYTES_IN_WORD)); - PUT_WORD (dynobj, s->_raw_size / HASH_ENTRY_SIZE, - s->contents + hash * HASH_ENTRY_SIZE + BYTES_IN_WORD); - PUT_WORD (dynobj, h->dynindx, s->contents + s->_raw_size); - PUT_WORD (dynobj, next, s->contents + s->_raw_size + BYTES_IN_WORD); - s->_raw_size += HASH_ENTRY_SIZE; - } - } - - return true; -} - -/* Link a dynamic object. We actually don't have anything to do at - this point. This entry point exists to prevent the regular linker - code from doing anything with the object. */ - -/*ARGSUSED*/ -static boolean -sunos_link_dynamic_object (info, abfd) - struct bfd_link_info *info; - bfd *abfd; -{ - return true; -} - -/* Write out a dynamic symbol. This is called by the final traversal - over the symbol table. */ - -static boolean -sunos_write_dynamic_symbol (output_bfd, info, harg) - bfd *output_bfd; - struct bfd_link_info *info; - struct aout_link_hash_entry *harg; -{ - struct sunos_link_hash_entry *h = (struct sunos_link_hash_entry *) harg; - int type; - bfd_vma val; - asection *s; - struct external_nlist *outsym; - - /* If this symbol is in the procedure linkage table, fill in the - table entry. */ - if (h->plt_offset != 0) - { - bfd *dynobj; - asection *splt; - bfd_byte *p; - asection *s; - bfd_vma r_address; - - dynobj = sunos_hash_table (info)->dynobj; - splt = bfd_get_section_by_name (dynobj, ".plt"); - p = splt->contents + h->plt_offset; - - s = bfd_get_section_by_name (dynobj, ".dynrel"); - - r_address = (splt->output_section->vma - + splt->output_offset - + h->plt_offset); - - switch (bfd_get_arch (output_bfd)) - { - case bfd_arch_sparc: - if (info->shared || (h->flags & SUNOS_DEF_REGULAR) == 0) - { - bfd_put_32 (output_bfd, SPARC_PLT_ENTRY_WORD0, p); - bfd_put_32 (output_bfd, - (SPARC_PLT_ENTRY_WORD1 - + (((- (h->plt_offset + 4) >> 2) - & 0x3fffffff))), - p + 4); - bfd_put_32 (output_bfd, SPARC_PLT_ENTRY_WORD2 + s->reloc_count, - p + 8); - } - else - { - bfd_vma val; - - val = (h->root.root.u.def.section->output_section->vma - + h->root.root.u.def.section->output_offset - + h->root.root.u.def.value); - bfd_put_32 (output_bfd, - SPARC_PLT_PIC_WORD0 + ((val >> 10) & 0x3fffff), - p); - bfd_put_32 (output_bfd, - SPARC_PLT_PIC_WORD1 + (val & 0x3ff), - p + 4); - bfd_put_32 (output_bfd, SPARC_PLT_PIC_WORD2, p + 8); - } - break; - - case bfd_arch_m68k: - if (! info->shared && (h->flags & SUNOS_DEF_REGULAR) != 0) - abort (); - bfd_put_16 (output_bfd, M68K_PLT_ENTRY_WORD0, p); - bfd_put_32 (output_bfd, (- (h->plt_offset + 2)), p + 2); - bfd_put_16 (output_bfd, s->reloc_count, p + 6); - r_address += 2; - break; - - default: - abort (); - } - - /* We also need to add a jump table reloc, unless this is the - result of a JMP_TBL reloc from PIC compiled code. */ - if (info->shared || (h->flags & SUNOS_DEF_REGULAR) == 0) - { - BFD_ASSERT (h->dynindx >= 0); - BFD_ASSERT (s->reloc_count * obj_reloc_entry_size (dynobj) - < s->_raw_size); - p = s->contents + s->reloc_count * obj_reloc_entry_size (output_bfd); - if (obj_reloc_entry_size (output_bfd) == RELOC_STD_SIZE) - { - struct reloc_std_external *srel; - - srel = (struct reloc_std_external *) p; - PUT_WORD (output_bfd, r_address, srel->r_address); - if (bfd_header_big_endian (output_bfd)) - { - srel->r_index[0] = (bfd_byte)(h->dynindx >> 16); - srel->r_index[1] = (bfd_byte)(h->dynindx >> 8); - srel->r_index[2] = (bfd_byte)(h->dynindx); - srel->r_type[0] = (RELOC_STD_BITS_EXTERN_BIG - | RELOC_STD_BITS_JMPTABLE_BIG); - } - else - { - srel->r_index[2] = (bfd_byte)(h->dynindx >> 16); - srel->r_index[1] = (bfd_byte)(h->dynindx >> 8); - srel->r_index[0] = (bfd_byte)h->dynindx; - srel->r_type[0] = (RELOC_STD_BITS_EXTERN_LITTLE - | RELOC_STD_BITS_JMPTABLE_LITTLE); - } - } - else - { - struct reloc_ext_external *erel; - - erel = (struct reloc_ext_external *) p; - PUT_WORD (output_bfd, r_address, erel->r_address); - if (bfd_header_big_endian (output_bfd)) - { - erel->r_index[0] = (bfd_byte)(h->dynindx >> 16); - erel->r_index[1] = (bfd_byte)(h->dynindx >> 8); - erel->r_index[2] = (bfd_byte)h->dynindx; - erel->r_type[0] = - (RELOC_EXT_BITS_EXTERN_BIG - | (RELOC_JMP_SLOT << RELOC_EXT_BITS_TYPE_SH_BIG)); - } - else - { - erel->r_index[2] = (bfd_byte)(h->dynindx >> 16); - erel->r_index[1] = (bfd_byte)(h->dynindx >> 8); - erel->r_index[0] = (bfd_byte)h->dynindx; - erel->r_type[0] = - (RELOC_EXT_BITS_EXTERN_LITTLE - | (RELOC_JMP_SLOT << RELOC_EXT_BITS_TYPE_SH_LITTLE)); - } - PUT_WORD (output_bfd, (bfd_vma) 0, erel->r_addend); - } - - ++s->reloc_count; - } - } - - /* If this is not a dynamic symbol, we don't have to do anything - else. We only check this after handling the PLT entry, because - we can have a PLT entry for a nondynamic symbol when linking PIC - compiled code from a regular object. */ - if (h->dynindx < 0) - return true; - - switch (h->root.root.type) - { - default: - case bfd_link_hash_new: - abort (); - /* Avoid variable not initialized warnings. */ - 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; - asection *output_section; - - sec = h->root.root.u.def.section; - output_section = sec->output_section; - BFD_ASSERT (bfd_is_abs_section (output_section) - || output_section->owner == output_bfd); - if (h->plt_offset != 0 - && (h->flags & SUNOS_DEF_REGULAR) == 0) - { - type = N_UNDF | N_EXT; - val = 0; - } - else - { - if (output_section == obj_textsec (output_bfd)) - type = (h->root.root.type == bfd_link_hash_defined - ? N_TEXT - : N_WEAKT); - else if (output_section == obj_datasec (output_bfd)) - type = (h->root.root.type == bfd_link_hash_defined - ? N_DATA - : N_WEAKD); - else if (output_section == obj_bsssec (output_bfd)) - type = (h->root.root.type == bfd_link_hash_defined - ? N_BSS - : N_WEAKB); - else - type = (h->root.root.type == bfd_link_hash_defined - ? N_ABS - : N_WEAKA); - type |= N_EXT; - val = (h->root.root.u.def.value - + output_section->vma - + sec->output_offset); - } - } - break; - case bfd_link_hash_common: - type = N_UNDF | N_EXT; - val = h->root.root.u.c.size; - break; - case bfd_link_hash_undefweak: - type = N_WEAKU; - val = 0; - 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; - } - - s = bfd_get_section_by_name (sunos_hash_table (info)->dynobj, ".dynsym"); - BFD_ASSERT (s != NULL); - outsym = ((struct external_nlist *) - (s->contents + h->dynindx * EXTERNAL_NLIST_SIZE)); - - bfd_h_put_8 (output_bfd, type, outsym->e_type); - bfd_h_put_8 (output_bfd, 0, outsym->e_other); - - /* FIXME: The native linker doesn't use 0 for desc. It seems to use - one less than the desc value in the shared library, although that - seems unlikely. */ - bfd_h_put_16 (output_bfd, 0, outsym->e_desc); - - PUT_WORD (output_bfd, h->dynstr_index, outsym->e_strx); - PUT_WORD (output_bfd, val, outsym->e_value); - - return true; -} - -/* This is called for each reloc against an external symbol. If this - is a reloc which are are going to copy as a dynamic reloc, then - copy it over, and tell the caller to not bother processing this - reloc. */ - -/*ARGSUSED*/ -static boolean -sunos_check_dynamic_reloc (info, input_bfd, input_section, harg, reloc, - contents, skip, relocationp) - struct bfd_link_info *info; - bfd *input_bfd; - asection *input_section; - struct aout_link_hash_entry *harg; - PTR reloc; - bfd_byte *contents; - boolean *skip; - bfd_vma *relocationp; -{ - struct sunos_link_hash_entry *h = (struct sunos_link_hash_entry *) harg; - bfd *dynobj; - boolean baserel; - boolean jmptbl; - asection *s; - bfd_byte *p; - long indx; - - *skip = false; - - dynobj = sunos_hash_table (info)->dynobj; - - if (h != NULL && h->plt_offset != 0) - { - asection *splt; - - /* Redirect the relocation to the PLT entry. */ - splt = bfd_get_section_by_name (dynobj, ".plt"); - *relocationp = (splt->output_section->vma - + splt->output_offset - + h->plt_offset); - } - - if (obj_reloc_entry_size (input_bfd) == RELOC_STD_SIZE) - { - struct reloc_std_external *srel; - - srel = (struct reloc_std_external *) reloc; - if (bfd_header_big_endian (input_bfd)) - { - baserel = (0 != (srel->r_type[0] & RELOC_STD_BITS_BASEREL_BIG)); - jmptbl = (0 != (srel->r_type[0] & RELOC_STD_BITS_JMPTABLE_BIG)); - } - else - { - baserel = (0 != (srel->r_type[0] & RELOC_STD_BITS_BASEREL_LITTLE)); - jmptbl = (0 != (srel->r_type[0] & RELOC_STD_BITS_JMPTABLE_LITTLE)); - } - } - else - { - struct reloc_ext_external *erel; - int r_type; - - erel = (struct reloc_ext_external *) reloc; - if (bfd_header_big_endian (input_bfd)) - r_type = ((erel->r_type[0] & RELOC_EXT_BITS_TYPE_BIG) - >> RELOC_EXT_BITS_TYPE_SH_BIG); - else - r_type = ((erel->r_type[0] & RELOC_EXT_BITS_TYPE_LITTLE) - >> RELOC_EXT_BITS_TYPE_SH_LITTLE); - baserel = (r_type == RELOC_BASE10 - || r_type == RELOC_BASE13 - || r_type == RELOC_BASE22); - jmptbl = r_type == RELOC_JMP_TBL; - } - - if (baserel) - { - bfd_vma *got_offsetp; - asection *sgot; - - if (h != NULL) - got_offsetp = &h->got_offset; - else if (adata (input_bfd).local_got_offsets == NULL) - got_offsetp = NULL; - else - { - struct reloc_std_external *srel; - int r_index; - - srel = (struct reloc_std_external *) reloc; - if (obj_reloc_entry_size (input_bfd) == RELOC_STD_SIZE) - { - if (bfd_header_big_endian (input_bfd)) - r_index = ((srel->r_index[0] << 16) - | (srel->r_index[1] << 8) - | srel->r_index[2]); - else - r_index = ((srel->r_index[2] << 16) - | (srel->r_index[1] << 8) - | srel->r_index[0]); - } - else - { - struct reloc_ext_external *erel; - - erel = (struct reloc_ext_external *) reloc; - if (bfd_header_big_endian (input_bfd)) - r_index = ((erel->r_index[0] << 16) - | (erel->r_index[1] << 8) - | erel->r_index[2]); - else - r_index = ((erel->r_index[2] << 16) - | (erel->r_index[1] << 8) - | erel->r_index[0]); - } - - got_offsetp = adata (input_bfd).local_got_offsets + r_index; - } - - BFD_ASSERT (got_offsetp != NULL && *got_offsetp != 0); - - sgot = bfd_get_section_by_name (dynobj, ".got"); - - /* We set the least significant bit to indicate whether we have - already initialized the GOT entry. */ - if ((*got_offsetp & 1) == 0) - { - if (h == NULL - || (! info->shared - && ((h->flags & SUNOS_DEF_DYNAMIC) == 0 - || (h->flags & SUNOS_DEF_REGULAR) != 0))) - PUT_WORD (dynobj, *relocationp, sgot->contents + *got_offsetp); - else - PUT_WORD (dynobj, 0, sgot->contents + *got_offsetp); - - if (info->shared - || (h != NULL - && (h->flags & SUNOS_DEF_DYNAMIC) != 0 - && (h->flags & SUNOS_DEF_REGULAR) == 0)) - { - /* We need to create a GLOB_DAT or 32 reloc to tell the - dynamic linker to fill in this entry in the table. */ - - s = bfd_get_section_by_name (dynobj, ".dynrel"); - BFD_ASSERT (s != NULL); - BFD_ASSERT (s->reloc_count * obj_reloc_entry_size (dynobj) - < s->_raw_size); - - p = (s->contents - + s->reloc_count * obj_reloc_entry_size (dynobj)); - - if (h != NULL) - indx = h->dynindx; - else - indx = 0; - - if (obj_reloc_entry_size (dynobj) == RELOC_STD_SIZE) - { - struct reloc_std_external *srel; - - srel = (struct reloc_std_external *) p; - PUT_WORD (dynobj, - (*got_offsetp - + sgot->output_section->vma - + sgot->output_offset), - srel->r_address); - if (bfd_header_big_endian (dynobj)) - { - srel->r_index[0] = (bfd_byte)(indx >> 16); - srel->r_index[1] = (bfd_byte)(indx >> 8); - srel->r_index[2] = (bfd_byte)indx; - if (h == NULL) - srel->r_type[0] = 2 << RELOC_STD_BITS_LENGTH_SH_BIG; - else - srel->r_type[0] = - (RELOC_STD_BITS_EXTERN_BIG - | RELOC_STD_BITS_BASEREL_BIG - | RELOC_STD_BITS_RELATIVE_BIG - | (2 << RELOC_STD_BITS_LENGTH_SH_BIG)); - } - else - { - srel->r_index[2] = (bfd_byte)(indx >> 16); - srel->r_index[1] = (bfd_byte)(indx >> 8); - srel->r_index[0] = (bfd_byte)indx; - if (h == NULL) - srel->r_type[0] = 2 << RELOC_STD_BITS_LENGTH_SH_LITTLE; - else - srel->r_type[0] = - (RELOC_STD_BITS_EXTERN_LITTLE - | RELOC_STD_BITS_BASEREL_LITTLE - | RELOC_STD_BITS_RELATIVE_LITTLE - | (2 << RELOC_STD_BITS_LENGTH_SH_LITTLE)); - } - } - else - { - struct reloc_ext_external *erel; - - erel = (struct reloc_ext_external *) p; - PUT_WORD (dynobj, - (*got_offsetp - + sgot->output_section->vma - + sgot->output_offset), - erel->r_address); - if (bfd_header_big_endian (dynobj)) - { - erel->r_index[0] = (bfd_byte)(indx >> 16); - erel->r_index[1] = (bfd_byte)(indx >> 8); - erel->r_index[2] = (bfd_byte)indx; - if (h == NULL) - erel->r_type[0] = - RELOC_32 << RELOC_EXT_BITS_TYPE_SH_BIG; - else - erel->r_type[0] = - (RELOC_EXT_BITS_EXTERN_BIG - | (RELOC_GLOB_DAT << RELOC_EXT_BITS_TYPE_SH_BIG)); - } - else - { - erel->r_index[2] = (bfd_byte)(indx >> 16); - erel->r_index[1] = (bfd_byte)(indx >> 8); - erel->r_index[0] = (bfd_byte)indx; - if (h == NULL) - erel->r_type[0] = - RELOC_32 << RELOC_EXT_BITS_TYPE_SH_LITTLE; - else - erel->r_type[0] = - (RELOC_EXT_BITS_EXTERN_LITTLE - | (RELOC_GLOB_DAT - << RELOC_EXT_BITS_TYPE_SH_LITTLE)); - } - PUT_WORD (dynobj, 0, erel->r_addend); - } - - ++s->reloc_count; - } - - *got_offsetp |= 1; - } - - *relocationp = (sgot->vma - + (*got_offsetp &~ 1) - - sunos_hash_table (info)->got_base); - - /* There is nothing else to do for a base relative reloc. */ - return true; - } - - if (! sunos_hash_table (info)->dynamic_sections_needed) - return true; - if (! info->shared) - { - if (h == NULL - || h->dynindx == -1 - || h->root.root.type != bfd_link_hash_undefined - || (h->flags & SUNOS_DEF_REGULAR) != 0 - || (h->flags & SUNOS_DEF_DYNAMIC) == 0 - || (h->root.root.u.undef.abfd->flags & DYNAMIC) == 0) - return true; - } - else - { - if (h != NULL - && (h->dynindx == -1 - || jmptbl - || strcmp (h->root.root.root.string, - "__GLOBAL_OFFSET_TABLE_") == 0)) - return true; - } - - /* It looks like this is a reloc we are supposed to copy. */ - - s = bfd_get_section_by_name (dynobj, ".dynrel"); - BFD_ASSERT (s != NULL); - BFD_ASSERT (s->reloc_count * obj_reloc_entry_size (dynobj) < s->_raw_size); - - p = s->contents + s->reloc_count * obj_reloc_entry_size (dynobj); - - /* Copy the reloc over. */ - memcpy (p, reloc, obj_reloc_entry_size (dynobj)); - - if (h != NULL) - indx = h->dynindx; - else - indx = 0; - - /* Adjust the address and symbol index. */ - if (obj_reloc_entry_size (dynobj) == RELOC_STD_SIZE) - { - struct reloc_std_external *srel; - - srel = (struct reloc_std_external *) p; - PUT_WORD (dynobj, - (GET_WORD (dynobj, srel->r_address) - + input_section->output_section->vma - + input_section->output_offset), - srel->r_address); - if (bfd_header_big_endian (dynobj)) - { - srel->r_index[0] = (bfd_byte)(indx >> 16); - srel->r_index[1] = (bfd_byte)(indx >> 8); - srel->r_index[2] = (bfd_byte)indx; - } - else - { - srel->r_index[2] = (bfd_byte)(indx >> 16); - srel->r_index[1] = (bfd_byte)(indx >> 8); - srel->r_index[0] = (bfd_byte)indx; - } - } - else - { - struct reloc_ext_external *erel; - - erel = (struct reloc_ext_external *) p; - PUT_WORD (dynobj, - (GET_WORD (dynobj, erel->r_address) - + input_section->output_section->vma - + input_section->output_offset), - erel->r_address); - if (bfd_header_big_endian (dynobj)) - { - erel->r_index[0] = (bfd_byte)(indx >> 16); - erel->r_index[1] = (bfd_byte)(indx >> 8); - erel->r_index[2] = (bfd_byte)indx; - } - else - { - erel->r_index[2] = (bfd_byte)(indx >> 16); - erel->r_index[1] = (bfd_byte)(indx >> 8); - erel->r_index[0] = (bfd_byte)indx; - } - } - - ++s->reloc_count; - - if (h != NULL) - *skip = true; - - return true; -} - -/* Finish up the dynamic linking information. */ - -static boolean -sunos_finish_dynamic_link (abfd, info) - bfd *abfd; - struct bfd_link_info *info; -{ - bfd *dynobj; - asection *o; - asection *s; - asection *sdyn; - - if (! sunos_hash_table (info)->dynamic_sections_needed - && ! sunos_hash_table (info)->got_needed) - return true; - - dynobj = sunos_hash_table (info)->dynobj; - - sdyn = bfd_get_section_by_name (dynobj, ".dynamic"); - BFD_ASSERT (sdyn != NULL); - - /* Finish up the .need section. The linker emulation code filled it - in, but with offsets from the start of the section instead of - real addresses. Now that we know the section location, we can - fill in the final values. */ - s = bfd_get_section_by_name (dynobj, ".need"); - if (s != NULL && s->_raw_size != 0) - { - file_ptr filepos; - bfd_byte *p; - - filepos = s->output_section->filepos + s->output_offset; - p = s->contents; - while (1) - { - bfd_vma val; - - PUT_WORD (dynobj, GET_WORD (dynobj, p) + filepos, p); - val = GET_WORD (dynobj, p + 12); - if (val == 0) - break; - PUT_WORD (dynobj, val + filepos, p + 12); - p += 16; - } - } - - /* The first entry in the .got section is the address of the - dynamic information, unless this is a shared library. */ - s = bfd_get_section_by_name (dynobj, ".got"); - BFD_ASSERT (s != NULL); - if (info->shared || sdyn->_raw_size == 0) - PUT_WORD (dynobj, 0, s->contents); - else - PUT_WORD (dynobj, sdyn->output_section->vma + sdyn->output_offset, - s->contents); - - for (o = dynobj->sections; o != NULL; o = o->next) - { - if ((o->flags & SEC_HAS_CONTENTS) != 0 - && o->contents != NULL) - { - BFD_ASSERT (o->output_section != NULL - && o->output_section->owner == abfd); - if (! bfd_set_section_contents (abfd, o->output_section, - o->contents, o->output_offset, - o->_raw_size)) - return false; - } - } - - if (sdyn->_raw_size > 0) - { - struct external_sun4_dynamic esd; - struct external_sun4_dynamic_link esdl; - - /* Finish up the dynamic link information. */ - PUT_WORD (dynobj, (bfd_vma) 3, esd.ld_version); - PUT_WORD (dynobj, - sdyn->output_section->vma + sdyn->output_offset + sizeof esd, - esd.ldd); - PUT_WORD (dynobj, - (sdyn->output_section->vma - + sdyn->output_offset - + sizeof esd - + EXTERNAL_SUN4_DYNAMIC_DEBUGGER_SIZE), - esd.ld); - - if (! bfd_set_section_contents (abfd, sdyn->output_section, &esd, - sdyn->output_offset, sizeof esd)) - return false; - - PUT_WORD (dynobj, (bfd_vma) 0, esdl.ld_loaded); - - s = bfd_get_section_by_name (dynobj, ".need"); - if (s == NULL || s->_raw_size == 0) - PUT_WORD (dynobj, (bfd_vma) 0, esdl.ld_need); - else - PUT_WORD (dynobj, s->output_section->filepos + s->output_offset, - esdl.ld_need); - - s = bfd_get_section_by_name (dynobj, ".rules"); - if (s == NULL || s->_raw_size == 0) - PUT_WORD (dynobj, (bfd_vma) 0, esdl.ld_rules); - else - PUT_WORD (dynobj, s->output_section->filepos + s->output_offset, - esdl.ld_rules); - - s = bfd_get_section_by_name (dynobj, ".got"); - BFD_ASSERT (s != NULL); - PUT_WORD (dynobj, s->output_section->vma + s->output_offset, - esdl.ld_got); - - s = bfd_get_section_by_name (dynobj, ".plt"); - BFD_ASSERT (s != NULL); - PUT_WORD (dynobj, s->output_section->vma + s->output_offset, - esdl.ld_plt); - PUT_WORD (dynobj, s->_raw_size, esdl.ld_plt_sz); - - s = bfd_get_section_by_name (dynobj, ".dynrel"); - BFD_ASSERT (s != NULL); - BFD_ASSERT (s->reloc_count * obj_reloc_entry_size (dynobj) - == s->_raw_size); - PUT_WORD (dynobj, s->output_section->filepos + s->output_offset, - esdl.ld_rel); - - s = bfd_get_section_by_name (dynobj, ".hash"); - BFD_ASSERT (s != NULL); - PUT_WORD (dynobj, s->output_section->filepos + s->output_offset, - esdl.ld_hash); - - s = bfd_get_section_by_name (dynobj, ".dynsym"); - BFD_ASSERT (s != NULL); - PUT_WORD (dynobj, s->output_section->filepos + s->output_offset, - esdl.ld_stab); - - PUT_WORD (dynobj, (bfd_vma) 0, esdl.ld_stab_hash); - - PUT_WORD (dynobj, (bfd_vma) sunos_hash_table (info)->bucketcount, - esdl.ld_buckets); - - s = bfd_get_section_by_name (dynobj, ".dynstr"); - BFD_ASSERT (s != NULL); - PUT_WORD (dynobj, s->output_section->filepos + s->output_offset, - esdl.ld_symbols); - PUT_WORD (dynobj, s->_raw_size, esdl.ld_symb_size); - - /* The size of the text area is the size of the .text section - rounded up to a page boundary. FIXME: Should the page size be - conditional on something? */ - PUT_WORD (dynobj, - BFD_ALIGN (obj_textsec (abfd)->_raw_size, 0x2000), - esdl.ld_text); - - if (! bfd_set_section_contents (abfd, sdyn->output_section, &esdl, - (sdyn->output_offset - + sizeof esd - + EXTERNAL_SUN4_DYNAMIC_DEBUGGER_SIZE), - sizeof esdl)) - return false; - - abfd->flags |= DYNAMIC; - } - - return true; -} diff --git a/contrib/binutils/binutils/acconfig.h b/contrib/binutils/binutils/acconfig.h deleted file mode 100644 index c38c529c901c..000000000000 --- a/contrib/binutils/binutils/acconfig.h +++ /dev/null @@ -1,34 +0,0 @@ - -/* Name of package. */ -#undef PACKAGE - -/* Version of package. */ -#undef VERSION - -/* Configured target name. */ -#undef TARGET - -/* Whether strstr must be declared even if <string.h> is included. */ -#undef NEED_DECLARATION_STRSTR - -/* Whether fprintf must be declared even if <stdio.h> is included. */ -#undef NEED_DECLARATION_FPRINTF - -/* Whether sbrk must be declared even if <unistd.h> is included. */ -#undef NEED_DECLARATION_SBRK - -/* Whether getenv must be declared even if <stdlib.h> is included. */ -#undef NEED_DECLARATION_GETENV -@TOP@ - -/* Is the type time_t defined in <time.h>? */ -#undef HAVE_TIME_T_IN_TIME_H - -/* Is the type time_t defined in <sys/types.h>? */ -#undef HAVE_TIME_T_IN_TYPES_H - -/* Does <utime.h> define struct utimbuf? */ -#undef HAVE_GOOD_UTIME_H - -/* Do we need to use the b modifier when opening binary files? */ -#undef USE_BINARY_FOPEN diff --git a/contrib/binutils/binutils/dyn-string.c b/contrib/binutils/binutils/dyn-string.c deleted file mode 100644 index a16401827657..000000000000 --- a/contrib/binutils/binutils/dyn-string.c +++ /dev/null @@ -1,107 +0,0 @@ -/* An abstract string datatype. - Copyright (C) 1998 Free Software Foundation, Inc. - Contributed by Mark Mitchell (mark@markmitchell.com). - - 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 this program; if not, write to the Free Software - Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -/* This file lives in at least two places: binutils and gcc. - Don't change one without the other. */ - -#include "config.h" -#ifdef IN_GCC -#include "system.h" -#include "gansidecl.h" -#else -#include "ansidecl.h" -#endif -#include "dyn-string.h" - -extern char *xmalloc (); -extern char *xrealloc (); - -/* Create a new dynamic string capable of holding at least SPACE - characters, including the terminating NUL. If SPACE is 0, it - will be silently increased to 1. */ - -dyn_string_t -dyn_string_new (space) - int space; -{ - dyn_string_t result = (dyn_string_t) xmalloc (sizeof (struct dyn_string)); - - if (space == 0) - /* We need at least one byte in which to store the terminating - NUL. */ - space = 1; - - result->allocated = space; - result->s = (char*) xmalloc (space); - result->length = 0; - result->s[0] = '\0'; - - return result; -} - -/* Free the memory used by DS. */ - -void -dyn_string_delete (ds) - dyn_string_t ds; -{ - free (ds->s); - free (ds); -} - -/* Append the NUL-terminated string S to DS, resizing DS if - necessary. */ - -dyn_string_t -dyn_string_append (ds, s) - dyn_string_t ds; - char *s; -{ - int len = strlen (s); - dyn_string_resize (ds, ds->length + len + 1 /* '\0' */); - strcpy (ds->s + ds->length, s); - ds->length += len; - - return ds; -} - -/* Increase the capacity of DS so that it can hold at least SPACE - characters, including the terminating NUL. This function will not - (at present) reduce the capacity of DS. */ - -dyn_string_t -dyn_string_resize (ds, space) - dyn_string_t ds; - int space; -{ - int new_allocated = ds->allocated; - - while (space > new_allocated) - new_allocated *= 2; - - if (new_allocated != ds->allocated) - { - /* We actually need more space. */ - ds->allocated = new_allocated; - ds->s = (char*) xrealloc (ds->s, ds->allocated); - } - - return ds; -} diff --git a/contrib/binutils/binutils/dyn-string.h b/contrib/binutils/binutils/dyn-string.h deleted file mode 100644 index cbd25c347344..000000000000 --- a/contrib/binutils/binutils/dyn-string.h +++ /dev/null @@ -1,34 +0,0 @@ -/* An abstract string datatype. - Copyright (C) 1998 Free Software Foundation, Inc. - Contributed by Mark Mitchell (mark@markmitchell.com). - - 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 this program; if not, write to the Free Software - Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -/* This file lives in at least two places: binutils and gcc. - Don't change one without the other. */ - -typedef struct dyn_string -{ - int allocated; /* The amount of space allocated for the string. */ - int length; /* The actual length of the string. */ - char *s; /* The string itself, NUL-terminated. */ -}* dyn_string_t; - -extern dyn_string_t dyn_string_new PARAMS((int)); -extern void dyn_string_delete PARAMS((dyn_string_t)); -extern dyn_string_t dyn_string_append PARAMS((dyn_string_t, char*)); -extern dyn_string_t dyn_string_resize PARAMS((dyn_string_t, int)); diff --git a/contrib/binutils/etc/ChangeLog b/contrib/binutils/etc/ChangeLog deleted file mode 100644 index 0453a3e1339a..000000000000 --- a/contrib/binutils/etc/ChangeLog +++ /dev/null @@ -1,507 +0,0 @@ -1999-04-01 Jim Blandy <jimb@zwingli.cygnus.com> - - * add-log.el, add-log.vi: New files. - -Wed Jan 20 01:33:50 1999 Angela Marie Thomas (angela@cygnus.com) - - * comp-tools-verify: Remove some checks that are no longer valid. - -1998-12-03 Nick Clifton <nickc@cygnus.com> - - * targetdoc/fr30.texi: New document. - -Thu Oct 1 21:15:59 1998 Angela Marie Thomas (angela@cygnus.com) - - * comp-tools-fix, cross-tools-fix: Replace /usr/include - with ${FIXINCDIR}. - -Tue Aug 11 19:22:11 1998 Doug Evans <devans@canuck.cygnus.com> - - * make-rel-sym-tree (version): Update calculation. - -Fri Jun 12 21:34:01 1998 Ian Lance Taylor <ian@cygnus.com> - - * configure.texi: Various additions. - * Makefile.in (TEXI2HTML, DVIPS): New variables. - (standards.ps): New target. - (configure.dvi): Copy .tin files in as well. - (configure.ps, configure.html): New targets. - (clean): Remove configdev.jpg and configbuild.jpg. - * configdev.fig: New file. - * configdev.ein: New file (EPS version of configdev.fig). - * configdev.jin: New file (JPEG version of configdev.fig). - * configbuild.fig: New file. - * configbuild.ein: New file (EPS version of configbuild.fig). - * configbuild.jin: New file (JPEG version of configbuild.fig). - -Wed Jun 10 14:41:25 1998 Ian Lance Taylor <ian@cygnus.com> - - * configure.texi: New file. - * configdev.tin: New file. - * configbuild.tin: New file. - * Makefile.in (MAKEINFO): Use makeinfo from texinfo directory if - it exists. - (TEXI2DVI): Likewise for texi2dvi. - (INFOFILES): Add configure.info. - (DVIFILES): Add configure.dvi. - (info): Only build info files if the source files exist. - (install-info): Only install info files if they exist. - (dvi): Only build DVI files if the sources files exist. - (configure.info): New target. - (configure.dvi): New target. - (clean): Remove configdev and configbuild derived files. - - Remove obsolete documentation. - * intro.texi: Remove. - * install.texi: Remove. - * config-names.texi: Remove. - * screen1.eps: Remove. - * screen1.obj: Remove. - * screen2.eps: Remove. - * screen2.obj: Remove. - * Makefile.in: Remove references to the above. - -Thu May 21 14:34:51 1998 Nick Clifton <nickc@cygnus.com> - - * targetdoc/arm-interwork.texi: Add note about ignoring linker - warning message when using --support-old-code. - -Mon May 18 14:27:37 1998 Angela Marie Thomas (angela@cygnus.com) - - * Install.in, comp-tools-fix, comp-tools-verify, cross-tools-fix: - Use $GCCvn rather than substitute everywhere. - -Thu May 14 14:43:10 1998 Nick Clifton <nickc@cygnus.com> - - * targetdoc/arm-interwork.texi: Document dlltool support of - interworking. - -Thu May 7 16:49:38 1998 Jason Molenda (crash@bugshack.cygnus.com) - - * Install.in: Remove references to TCL_LIBRARY, TK_LIBRARY, - and GDBTK_FILENAME. - -Wed Apr 1 17:11:44 1998 Nick Clifton <nickc@cygnus.com> - - * targetdoc/arm-interwork.texi: Document ARM/thumb interworking. - -Tue Mar 31 15:28:20 1998 Ian Lance Taylor <ian@cygnus.com> - - * standards.texi, make-stds.texi: Update to current FSF versions. - * Makefile.in (standards.info): Depend upon make-std.texi. - -Tue Mar 24 16:13:26 1998 Stu Grossman <grossman@bhuna.cygnus.co.uk> - - * configure: Regenerate with autoconf 2.12.1 to fix shell issues - for NT native builds. - -Mon Mar 9 16:41:04 1998 Doug Evans <devans@canuck.cygnus.com> - - * make-rel-sym-tree (binprogs): Add objcopy. - -Tue Feb 24 18:11:58 1998 Doug Evans <devans@canuck.cygnus.com> - - * make-rel-sym-tree: as.new -> as-new, ld.new -> ld-new - nm.new -> nm-new. Make symlinks to crt*.o. - -Fri Nov 21 12:54:58 1997 Manfred Hollstein <manfred@s-direktnet.de> - - * Makefile.in: Add --no-split argument to avoid creating files - with names longer than 14 characters. - -Thu Sep 25 13:13:11 1997 Jason Molenda (crash@pern.cygnus.com) - - * intro.texi: Add closing ifset. - -Mon Sep 1 10:31:32 1997 Angela Marie Thomas (angela@cygnus.com) - - * Install.in: Move setting HOST and TARGET to the beginning - of the file for editing convenience. - -Mon Sep 1 10:28:37 1997 Angela Marie Thomas (angela@cygnus.com) - - * Install.in.: More friendly options/messages when extracting - from a file instead of a tape device. - -Tue Jun 17 15:50:23 1997 Angela Marie Thomas (angela@cygnus.com) - - * Install.in: Add /usr/bsd to PATH for Irix (home of compress) - -Thu Jun 12 13:47:00 1997 Angela Marie Thomas (angela@cygnus.com) - - * Install.in (show_exec_prefix_msg): fix quoting - -Wed Jun 4 15:31:43 1997 Jason Molenda (crash@godzilla.cygnus.co.jp) - - * rebuilding.texi: Removed. - -Sat May 24 18:02:20 1997 Angela Marie Thomas (angela@cygnus.com) - - * cross-tools-fix: Remove host check since it doesn't matter - for this case. - * Install.in (guess_system): clean up more unused hosts. - * Install.in, cross-tools-fix, comp-tools-fix, comp-tools-verify: - Hack for host check to not warn the user for certain cases. - -Fri May 23 23:46:10 1997 Angela Marie Thomas (angela@cygnus.com) - - * subst-strings: Remove a lot of unused code - * Install.in: Remove reference to TAPEdflt, use variables instead of - string substitution when able. - -Fri Apr 11 17:25:52 1997 Ian Lance Taylor <ian@cygnus.com> - - * configure.in: Change file named in AC_INIT to Makefile.in. - * configure: Rebuild. - -Fri Apr 11 18:12:42 1997 Jason Molenda (crash@godzilla.cygnus.co.jp) - - * Install.in (guess_system): Back out change to INSTALLHOST to - call all IRIX systems "mips-sgi-irix4" - - * Makefile.in: Remove references to configure.texi and cfg-paper.texi. - -Thu Apr 10 23:26:45 1997 Jason Molenda (crash@godzilla.cygnus.co.jp) - - * srctree.texi, emacs-relnotes.texi, cfg-paper.texi: Remove. - * Install.in: Remove Ultrix-specific hacks. - Update Cygnus phone numbers. - (guess_system): Remove some old systems (Ultrix, OSF1 v1 & 2, - m68k-HPUX, m68k SunOS, etc.) - (show_gnu_root_msg): Remove. - Removed all the remove option code. - -Thu Apr 10 23:23:33 1997 Jason Molenda (crash@godzilla.cygnus.co.jp) - - * configure.man, configure.texi: Remote. - -Mon Apr 7 18:15:00 1997 Brendan Kehoe <brendan@cygnus.com> - - * Fix the version string for OSF1 4.0 to recognize either - V4.* or X4.* - -Mon Apr 7 15:34:47 1997 Ian Lance Taylor <ian@cygnus.com> - - * standards.texi, make-stds.texi: Update to current FSF versions. - -Tue Nov 19 15:36:14 1996 Doug Evans <dje@canuck.cygnus.com> - - * make-rel-sym-tree: New file. - -Wed Oct 23 00:34:07 1996 Angela Marie Thomas (angela@cygnus.com) - - * Lots of patches from progressive... - * Install.in: restore DDOPTS for AIX 4.x - * Install.in, subst-strings: add case for DG Aviion - * subst-strings: fix typo in INSTALLdir var setting - * comp-tools-verify: set SHLIB_PATH for shared libs - * Install.in, subst-strings: add case for solaris2.5 - * Install.in: fix regression for hppa1.1 check - * comp-tools-fix: set LD_LIBRARY_PATH - * comp-tools-fix: If fixincludes fixes /usr/include/limits.h, - install it as syslimits.h. - -Wed Oct 16 19:20:42 1996 Michael Meissner <meissner@tiktok.cygnus.com> - - * Install.in (guess_system): Treat powerpc-ibm-aix4.1 the same as - rs6000-ibm-aix4.1, since the compiler now uses common mode by - default. - -Wed Oct 2 15:39:07 1996 Jason Molenda (crash@godzilla.cygnus.co.jp) - - * configure.in (AC_PROG_INSTALL): Added. - * Makefile.in (distclean): Remove config.cache. - -Wed Oct 2 14:33:58 1996 Jason Molenda (crash@godzilla.cygnus.co.jp) - - * configure.in: Switch to autoconf configure.in. - * configure: New. - * Makefile.in: Use autoconf-substituted values. - -Tue Jun 25 18:56:08 1996 Jason Molenda (crash@godzilla.cygnus.co.jp) - - * Makefile.in (datadir): Changed to $(prefix)/share. - -Fri Mar 29 11:38:01 1996 J.T. Conklin (jtc@lisa.cygnus.com) - - * configure.man: Changed to be recognized by catman -w on Solaris. - -Wed Dec 6 15:40:28 1995 Doug Evans <dje@canuck.cygnus.com> - - * comp-tools-fix (fixincludes): Define FIXPROTO_DEFINES from - .../install-tools/fixproto-defines. - -Sun Nov 12 19:31:27 1995 Jason Molenda (crash@phydeaux.cygnus.com) - - * comp-tools-verify (verify_cxx_initializers): delete argv, - argc declarations, add -static to compile line. - (verify_cxx_hello_world): delete argv, argc declarations, add - -static to compile line. - -Wed Sep 20 13:21:52 1995 Ian Lance Taylor <ian@cygnus.com> - - * Makefile.in (maintainer-clean): New target, synonym for - realclean. - -Mon Aug 28 17:25:49 1995 Jason Molenda (crash@phydeaux.cygnus.com) - - * Install.in (PATH): add /usr/ucb to $PATH (for SunOS 4.1.x). - -Tue Aug 15 21:51:58 1995 Jason Molenda (crash@phydeaux.cygnus.com) - - * Install.in (guess_system): Match OSF/1 v3.x as the same as - v2.x--v2.x binaries are upward compatible. - -Tue Aug 15 21:46:54 1995 Jason Molenda (crash@phydeaux.cygnus.com) - - * Install.in (guess_system): recognize HP 9000/800 systems as the - same as HP 9000/700 systems. - -Tue Aug 8 13:11:56 1995 Brendan Kehoe <brendan@lisa.cygnus.com> - - * Install.in: For emacs, run show_emacs_alternate_msg and exit. - (show_emacs_alternate_msg): New message saying how emacs can't be - installed in an alternate prefix. - -Thu Jun 8 00:42:56 1995 Angela Marie Thomas <angela@cirdan.cygnus.com> - - * subst-strings: change du commands to $BINDIR/. & $SRCDIR/. just - in case they are symlinks. - -Tue Apr 18 14:23:10 1995 J.T. Conklin <jtc@rtl.cygnus.com> - - * cdk-fix: Extracted table of targets that don't need their - headers fixed from gcc's configure script. - - * cdk-fix, cdk-verify: Use ${HOST} instead of ||HOSTstr|| - - * cdk-fix, cdk-verify: New files, install script fragments used - for Cygnus Developer's Kit. - - * Install.in (do_mkdir): New function. - - * Install.in: Added support for --with and --without options. - Changed so that tape commands are not run when extracting - from a file. - (do_mt): Changed to take only one argument. - -Wed Mar 29 11:16:38 1995 Jason Molenda (crash@phydeaux.cygnus.com) - - * Install.in: catch UNAME==alpha-dec-osf2.x and correct entry for - alpha-dec-osf1.x - -Fri Jan 27 12:04:29 1995 J.T. Conklin <jtc@rtl.cygnus.com> - - * subst-strings (mips-sgi-irix5): New entry in table. - -Thu Jan 19 12:15:44 1995 J.T. Conklin <jtc@rtl.cygnus.com> - - * Install.in: Major rewrite, bundle dependent code (for example, - fixincludes for comp-tools) will be inserted into the Install - script when it is generated. - -Tue Jan 17 16:51:32 1995 Ian Lance Taylor <ian@sanguine.cygnus.com> - - * Makefile.in (Makefile): Rebuild using $(SHELL). - -Thu Nov 3 19:30:33 1994 Ken Raeburn <raeburn@cujo.cygnus.com> - - * Makefile.in (install-info): Depend on info. - -Fri Aug 19 16:16:38 1994 Jason Molenda (crash@phydeaux.cygnus.com) - - * Install.in: set $FIX_HEADER so fixproto can find fix-header. - -Fri May 6 16:18:58 1994 Jason Molenda (crash@sendai.cygnus.com) - - * Makefile.in (install-info): add a semicolon in the if statement. - -Fri Apr 29 16:56:07 1994 David J. Mackenzie (djm@rtl.cygnus.com) - - * cfg-paper.texi: Update some outdated information. - - * Makefile.in (install-info): Pass file, not directory, as last - arg to INSTALL_DATA. - (uninstall): New target. - -Thu Apr 28 14:42:22 1994 David J. Mackenzie (djm@rtl.cygnus.com) - - * configure.texi: Comment out @smallbook. - - * Makefile.in: Define TEXI2DVI and TEXIDIR, and use the latter. - Remove info files in realclean, not clean, per coding standards. - Remove TeX output in clean. - -Tue Apr 26 17:18:03 1994 Jason Molenda (crash@sendai.cygnus.com) - - * Install.in: fixincludes output is actually put in fixincludes.log, - but echo'ed messages claim it is fixinc.log. This is the same - messages as I logged in March 4 1994, but for some reason we found - the change hadn't been done. I'll have to dig through the logs - and find out what I really did do that day. :) - -Mon Apr 25 20:28:19 1994 Jason Molenda (crash@sendai.cygnus.com) - - * Install.in: use eval to call do_mt() for Ultrix brokenness. - -Mon Apr 25 20:00:00 1994 Jason Molenda (crash@sendai.cygnus.com) - - * Install.in(do_mt): exit with error status 1 if # of parameters - != 3. - -Mon Apr 25 19:42:36 1994 Jason Molenda (crash@sendai.cygnus.com) - - * Install.in: lose TAPE_FORWARD and TAPE_REWIND, add do_mt() - to do all tape movement operations. Currently untested. Addresses - PR # 4886 from bull. - - * Install.in: add 1994 to the copyright thing. - -Fri Apr 22 19:05:13 1994 David J. Mackenzie (djm@rtl.cygnus.com) - - * standards.texi: Update from FSF. - -Fri Apr 22 15:46:10 1994 Jason Molenda (crash@cygnus.com) - - * Install.in: Add $DDOPTS, has ``bs=124b'' for all systems except - AIX (some versions of AIX don't understand bs=124b. Silly OS). - -Mon Apr 4 22:55:05 1994 Jason Molenda (crash@sendai.cygnus.com) - - * Install.in: null out $TOOLS before adding stuff to it - non-destructively. - -Wed Mar 30 21:45:35 1994 David J. Mackenzie (djm@rtl.cygnus.com) - - * standards.texi: Fix typo. - - * configure.texi, configure.man: Document --disable-. - -Mon Mar 28 13:22:15 1994 David J. Mackenzie (djm@rtl.cygnus.com) - - * standards.texi: Update from FSF. - -Sat Mar 26 09:21:44 1994 David J. Mackenzie (djm@rtl.cygnus.com) - - * standards.texi, make-stds.texi: Update from FSF. - -Fri Mar 25 22:59:45 1994 David J. Mackenzie (djm@rtl.cygnus.com) - - * configure.texi, configure.man: Document --enable-* options. - -Wed Mar 23 23:38:24 1994 Jason Molenda (crash@sendai.cygnus.com) - - * Install.in: set CPP to be gcc -E for fixincludes. - -Wed Mar 23 13:42:48 1994 Jason Molenda (crash@sendai.cygnus.com) - - * Install.in: set PATH to $PATH:/bin:/usr/bin so we can pick - up native tools even if the user doesn't have them in his - path. - - * Install.in: ``hppa-1.1-hp-hpux'' -> ``hppa1.1-hp-hpux''. - -Tue Mar 15 22:09:20 1994 Jason Molenda (crash@sendai.cygnus.com) - - * Install.in: TAPE_REWIND and TAPE_FORWARD variables for Unixunaware, - added switch statement to detect if system is Unixunaware. - -Fri Mar 4 12:10:30 1994 Jason Molenda (crash@sendai.cygnus.com) - - * Install.in: fixincludes output is actually put in fixincludes.log, - but echo'ed messages claim it is fixinc.log. - -Wed Nov 3 02:58:02 1993 Jeffrey Osier (jeffrey@thepub.cygnus.com) - - * subst-strings: output TEXBUNDLE for more install notes matching - * install-texi.in: PRMS info now exists - -Tue Oct 26 16:57:12 1993 K. Richard Pixley (rich@sendai.cygnus.com) - - * subst-strings: match solaris*. Also, add default case to catch - and error out for unrecognized systems. - -Thu Aug 19 18:21:31 1993 david d `zoo' zuhn (zoo@rtl.cygnus.com) - - * Install.in: handle the new fixproto work - -Mon Jul 19 12:05:41 1993 david d `zoo' zuhn (zoo@cirdan.cygnus.com) - - * Install.in: remove "MT=tctl" for AIX (not needed, and barely - worked anyway) - -Mon Jun 14 19:09:22 1993 Jeffrey Osier (jeffrey@cygnus.com) - - * subst-strings: changed HOST to recognize Solaris for install notes - -Thu Jun 10 16:01:25 1993 Jeffrey Osier (jeffrey@cygnus.com) - - * dos-inst.texi: new file. - -Wed Jun 9 19:23:59 1993 Jeffrey Osier (jeffrey@rtl.cygnus.com) - - * install-texi.in: added conditionals (nearly complete) - cleaned up - added support for other releases (not done) - -Wed Jun 9 15:53:58 1993 Jim Kingdon (kingdon@cygnus.com) - - * Makefile.in (install-info): Use INSTALL_DATA. - ({dist,real}clean): Also delete Makefile and config.status. - -Fri Jun 4 17:09:56 1993 Jeffrey Osier (jeffrey@cygnus.com) - - * subst-strings: added data for OS_STRING - - * subst-strings: added support for OS_STRING - -Thu Jun 3 00:37:01 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * Install.in: pull COPYING and COPYING.LIB off of the tape - -Tue Jun 1 16:52:08 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * subst-strings: replace RELEASE_DIR too - -Mon Mar 22 23:55:27 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * Makefile.in: add installcheck target - -Wed Mar 17 02:21:15 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * Install.in: fix 'source only' extraction bug where it looked for - the src dir under H-<host>/src instead of src; also remove stray - reference to EMACSHIBIN - -Mon Mar 15 01:25:45 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * make-stds.texi: added 'installcheck' to the standard targets - -Tue Mar 9 19:48:28 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * standards.texi: added INFO-DIR-ENTRY, updated version from the FSF - -Tue Feb 9 12:40:23 1993 Ian Lance Taylor (ian@cygnus.com) - - * Makefile.in (standards.info): Added -I$(srcdir) to find - make-stds.texi. - -Mon Feb 1 16:32:56 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * standards.texi: updated to latest FSF version, which includes: - - * make-stds.texi: new file - -Mon Nov 30 01:31:40 1992 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * install-texi.in, relnotes.texi, intro.texi: changed Cygnus phone - numbers from the old Palo Alto ones to the new Mtn. View numbers - -Mon Nov 16 16:50:43 1992 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * Makefile.in: define $(RM) to "rm -f" - -Sun Oct 11 16:05:48 1992 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * intro.texi: added INFO-DIR-ENTRY - diff --git a/contrib/binutils/etc/Makefile.in b/contrib/binutils/etc/Makefile.in deleted file mode 100644 index eedc8c9c1ac2..000000000000 --- a/contrib/binutils/etc/Makefile.in +++ /dev/null @@ -1,156 +0,0 @@ -# -# Makefile.in for etc -# - -prefix = @prefix@ -exec_prefix = @exec_prefix@ - -srcdir = @srcdir@ -VPATH = @srcdir@ - -bindir = @bindir@ -libdir = @libdir@ -tooldir = $(libdir) -datadir = @datadir@ - -mandir = @mandir@ -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 = @infodir@ - -SHELL = /bin/sh - -INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_DATA = @INSTALL_DATA@ - -MAKEINFO = `if [ -f ../texinfo/makeinfo/makeinfo ]; \ - then echo ../texinfo/makeinfo/makeinfo; \ - else echo makeinfo; fi` -TEXI2DVI = `if [ -f ../texinfo/util/texi2dvi ]; \ - then echo ../texinfo/util/texi2dvi; \ - else echo texi2dvi; fi` -TEXI2HTML = texi2html -DVIPS = dvips - -# Where to find texinfo.tex to format documentation with TeX. -TEXIDIR = $(srcdir)/../texinfo - -#### Host, target, and site specific Makefile fragments come in here. -### - -INFOFILES = standards.info configure.info -DVIFILES = standards.dvi configure.dvi - -all: - -install: - -uninstall: - -info: - for f in $(INFOFILES); do \ - if test -f $(srcdir)/`echo $$f | sed -e 's/.info$$/.texi/'`; then \ - if $(MAKE) "MAKEINFO=$(MAKEINFO)" $$f; then \ - true; \ - else \ - exit 1; \ - fi; \ - fi; \ - done - -install-info: info - $(SHELL) $(srcdir)/../mkinstalldirs $(infodir) - if test ! -f standards.info; then cd $(srcdir); fi; \ - if test -f standards.info; then \ - for i in standards.info*; do \ - $(INSTALL_DATA) $$i $(infodir)/$$i; \ - done; \ - fi - if test ! -f configure.info; then cd $(srcdir); fi; \ - if test -f configure.info; then \ - for i in configure.info*; do \ - $(INSTALL_DATA) $$i $(infodir)/$$i; \ - done; \ - fi - -dvi: - for f in $(DVIFILES); do \ - if test -f $(srcdir)/`echo $$f | sed -e 's/.dvi$$/.texi/'`; then \ - if $(MAKE) "TEXI2DVI=$(TEXI2DVI)" $$f; then \ - true; \ - else \ - exit 1; \ - fi; \ - fi; \ - done - -standards.info: $(srcdir)/standards.texi $(srcdir)/make-stds.texi - $(MAKEINFO) --no-split -I$(srcdir) -o standards.info $(srcdir)/standards.texi - -standards.dvi: $(srcdir)/standards.texi - TEXINPUTS=$(TEXIDIR):$$TEXINPUTS $(TEXI2DVI) $(srcdir)/standards.texi - -standards.ps: standards.dvi - $(DVIPS) standards.dvi -o standards.ps - -# makeinfo requires images to be in the current directory. -configure.info: $(srcdir)/configure.texi $(srcdir)/configdev.tin $(srcdir)/configbuild.tin - rm -f configdev.txt configbuild.txt - cp $(srcdir)/configdev.tin configdev.txt - cp $(srcdir)/configbuild.tin configbuild.txt - $(MAKEINFO) -I$(srcdir) -o configure.info $(srcdir)/configure.texi - rm -f configdev.txt configbuild.txt - -# texi2dvi wants both the .txt and the .eps files. -configure.dvi: $(srcdir)/configure.texi $(srcdir)/configdev.tin $(srcdir)/configbuild.tin $(srcdir)/configdev.ein $(srcdir)/configbuild.ein - rm -f configdev.txt configbuild.txt - cp $(srcdir)/configdev.tin configdev.txt - cp $(srcdir)/configbuild.tin configbuild.txt - rm -f configdev.eps configbuild.eps - cp $(srcdir)/configdev.ein configdev.eps - cp $(srcdir)/configbuild.ein configbuild.eps - TEXINPUTS=$(TEXIDIR):$$TEXINPUTS $(TEXI2DVI) $(srcdir)/configure.texi - rm -f configdev.txt configbuild.txt - rm -f configdev.eps configbuild.eps - -# dvips requires images to be in the current directory -configure.ps: configure.dvi $(srcdir)/configdev.ein $(srcdir)/configbuild.ein - rm -f configdev.eps configbuild.eps - cp $(srcdir)/configdev.ein configdev.eps - cp $(srcdir)/configbuild.ein configbuild.eps - $(DVIPS) configure.dvi -o configure.ps - rm -f configdev.eps configbuild.eps - -configure.html: $(srcdir)/configure.texi - $(TEXI2HTML) -split_chapter $(srcdir)/configure.texi - -clean: - rm -f *.aux *.cp *.cps *.dvi *.fn *.fns *.ky *.kys *.log - rm -f *.pg *.pgs *.toc *.tp *.tps *.vr *.vrs - rm -f configdev.txt configbuild.txt configdev.eps configbuild.eps - rm -f configdev.jpg configbuild.jpg - -mostlyclean: clean - -distclean: clean - rm -f Makefile config.status config.cache - -maintainer-clean realclean: distclean - rm -f *.info* - -Makefile: $(srcdir)/Makefile.in $(host_makefile_frag) $(target_makefile_frag) - $(SHELL) ./config.status - -## these last targets are for standards.texi conformance -dist: -check: -installcheck: -TAGS: diff --git a/contrib/binutils/etc/add-log.el b/contrib/binutils/etc/add-log.el deleted file mode 100644 index 60c88e8c9490..000000000000 --- a/contrib/binutils/etc/add-log.el +++ /dev/null @@ -1,573 +0,0 @@ -;;; ============ NOTE WELL! ============= -;;; -;;; You only need to use this file if you're using a version of Emacs -;;; prior to 20.1 to work on GDB. The only difference between this -;;; and the standard add-log.el provided with 19.34 is that it -;;; generates dates using the terser format used by Emacs 20. This is -;;; the format recommended for use in GDB ChangeLogs. -;;; -;;; To use this code, you should create a directory `~/elisp', save the code -;;; below in `~/elisp/add-log.el', and then put something like this in -;;; your `~/.emacs' file, to tell Emacs where to find it: -;;; -;;; (setq load-path -;;; (cons (expand-file-name "~/elisp") -;;; load-path)) -;;; -;;; If you want, you can also byte-compile it --- it'll run a little -;;; faster, and use a little less memory. (Not that those matter much for -;;; this file.) To do that, after you've saved the text as -;;; ~/elisp/add-log.el, bring it up in Emacs, and type -;;; -;;; C-u M-x byte-compile-file -;;; -;;; --- Jim Blandy - -;;; add-log.el --- change log maintenance commands for Emacs - -;; Copyright (C) 1985, 1986, 1988, 1993, 1994 Free Software Foundation, Inc. - -;; Keywords: maint - -;; This file is part of GNU Emacs. - -;; GNU Emacs is free software; you can redistribute 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 Emacs is distributed in the hope that it will be useful, -;; but WITHOUT 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 Emacs; see the file COPYING. If not, write to the -;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, -;; Boston, MA 02111-1307, USA. - -;;; Commentary: - -;; This facility is documented in the Emacs Manual. - -;;; Code: - -(defvar change-log-default-name nil - "*Name of a change log file for \\[add-change-log-entry].") - -(defvar add-log-current-defun-function nil - "\ -*If non-nil, function to guess name of current function from surrounding text. -\\[add-change-log-entry] calls this function (if nil, `add-log-current-defun' -instead) with no arguments. It returns a string or nil if it cannot guess.") - -;;;###autoload -(defvar add-log-full-name nil - "*Full name of user, for inclusion in ChangeLog daily headers. -This defaults to the value returned by the `user-full-name' function.") - -;;;###autoload -(defvar add-log-mailing-address nil - "*Electronic mail address of user, for inclusion in ChangeLog daily headers. -This defaults to the value of `user-mail-address'.") - -(defvar change-log-font-lock-keywords - '(("^[SMTWF].+" . font-lock-function-name-face) ; Date line. - ("^\t\\* \\([^ :\n]+\\)" 1 font-lock-comment-face) ; File name. - ("(\\([^)\n]+\\)):" 1 font-lock-keyword-face)) ; Function name. - "Additional expressions to highlight in Change Log mode.") - -(defvar change-log-mode-map nil - "Keymap for Change Log major mode.") -(if change-log-mode-map - nil - (setq change-log-mode-map (make-sparse-keymap)) - (define-key change-log-mode-map "\M-q" 'change-log-fill-paragraph)) - -(defun change-log-name () - (or change-log-default-name - (if (eq system-type 'vax-vms) - "$CHANGE_LOG$.TXT" - (if (or (eq system-type 'ms-dos) (eq system-type 'windows-nt)) - "changelo" - "ChangeLog")))) - -;;;###autoload -(defun prompt-for-change-log-name () - "Prompt for a change log name." - (let* ((default (change-log-name)) - (name (expand-file-name - (read-file-name (format "Log file (default %s): " default) - nil default)))) - ;; Handle something that is syntactically a directory name. - ;; Look for ChangeLog or whatever in that directory. - (if (string= (file-name-nondirectory name) "") - (expand-file-name (file-name-nondirectory default) - name) - ;; Handle specifying a file that is a directory. - (if (file-directory-p name) - (expand-file-name (file-name-nondirectory default) - (file-name-as-directory name)) - name)))) - -;;;###autoload -(defun find-change-log (&optional file-name) - "Find a change log file for \\[add-change-log-entry] and return the name. - -Optional arg FILE-NAME specifies the file to use. -If FILE-NAME is nil, use the value of `change-log-default-name'. -If 'change-log-default-name' is nil, behave as though it were 'ChangeLog' -\(or whatever we use on this operating system). - -If 'change-log-default-name' contains a leading directory component, then -simply find it in the current directory. Otherwise, search in the current -directory and its successive parents for a file so named. - -Once a file is found, `change-log-default-name' is set locally in the -current buffer to the complete file name." - ;; If user specified a file name or if this buffer knows which one to use, - ;; just use that. - (or file-name - (setq file-name (and change-log-default-name - (file-name-directory change-log-default-name) - change-log-default-name)) - (progn - ;; Chase links in the source file - ;; and use the change log in the dir where it points. - (setq file-name (or (and buffer-file-name - (file-name-directory - (file-chase-links buffer-file-name))) - default-directory)) - (if (file-directory-p file-name) - (setq file-name (expand-file-name (change-log-name) file-name))) - ;; Chase links before visiting the file. - ;; This makes it easier to use a single change log file - ;; for several related directories. - (setq file-name (file-chase-links file-name)) - (setq file-name (expand-file-name file-name)) - ;; Move up in the dir hierarchy till we find a change log file. - (let ((file1 file-name) - parent-dir) - (while (and (not (or (get-file-buffer file1) (file-exists-p file1))) - (progn (setq parent-dir - (file-name-directory - (directory-file-name - (file-name-directory file1)))) - ;; Give up if we are already at the root dir. - (not (string= (file-name-directory file1) - parent-dir)))) - ;; Move up to the parent dir and try again. - (setq file1 (expand-file-name - (file-name-nondirectory (change-log-name)) - parent-dir))) - ;; If we found a change log in a parent, use that. - (if (or (get-file-buffer file1) (file-exists-p file1)) - (setq file-name file1))))) - ;; Make a local variable in this buffer so we needn't search again. - (set (make-local-variable 'change-log-default-name) file-name) - file-name) - -;;;###autoload -(defun add-change-log-entry (&optional whoami file-name other-window new-entry) - "Find change log file and add an entry for today. -Optional arg (interactive prefix) non-nil means prompt for user name and site. -Second arg is file name of change log. If nil, uses `change-log-default-name'. -Third arg OTHER-WINDOW non-nil means visit in other window. -Fourth arg NEW-ENTRY non-nil means always create a new entry at the front; -never append to an existing entry." - (interactive (list current-prefix-arg - (prompt-for-change-log-name))) - (or add-log-full-name - (setq add-log-full-name (user-full-name))) - (or add-log-mailing-address - (setq add-log-mailing-address user-mail-address)) - (if whoami - (progn - (setq add-log-full-name (read-input "Full name: " add-log-full-name)) - ;; Note that some sites have room and phone number fields in - ;; full name which look silly when inserted. Rather than do - ;; anything about that here, let user give prefix argument so that - ;; s/he can edit the full name field in prompter if s/he wants. - (setq add-log-mailing-address - (read-input "Mailing address: " add-log-mailing-address)))) - (let ((defun (funcall (or add-log-current-defun-function - 'add-log-current-defun))) - paragraph-end entry) - - (setq file-name (expand-file-name (find-change-log file-name))) - - ;; Set ENTRY to the file name to use in the new entry. - (and buffer-file-name - ;; Never want to add a change log entry for the ChangeLog file itself. - (not (string= buffer-file-name file-name)) - (setq entry (if (string-match - (concat "^" (regexp-quote (file-name-directory - file-name))) - buffer-file-name) - (substring buffer-file-name (match-end 0)) - (file-name-nondirectory buffer-file-name)))) - - (if (and other-window (not (equal file-name buffer-file-name))) - (find-file-other-window file-name) - (find-file file-name)) - (or (eq major-mode 'change-log-mode) - (change-log-mode)) - (undo-boundary) - (goto-char (point-min)) - (let ((heading (format "%s %s <%s>" - (format-time-string "%Y-%m-%d") - add-log-full-name - add-log-mailing-address))) - (if (looking-at (regexp-quote heading)) - (forward-line 1) - (insert heading "\n\n"))) - - ;; Search only within the first paragraph. - (if (looking-at "\n*[^\n* \t]") - (skip-chars-forward "\n") - (forward-paragraph 1)) - (setq paragraph-end (point)) - (goto-char (point-min)) - - ;; Now insert the new line for this entry. - (cond ((re-search-forward "^\\s *\\*\\s *$" paragraph-end t) - ;; Put this file name into the existing empty entry. - (if entry - (insert entry))) - ((and (not new-entry) - (let (case-fold-search) - (re-search-forward - (concat (regexp-quote (concat "* " entry)) - ;; Don't accept `foo.bar' when - ;; looking for `foo': - "\\(\\s \\|[(),:]\\)") - paragraph-end t))) - ;; Add to the existing entry for the same file. - (re-search-forward "^\\s *$\\|^\\s \\*") - (goto-char (match-beginning 0)) - ;; Delete excess empty lines; make just 2. - (while (and (not (eobp)) (looking-at "^\\s *$")) - (delete-region (point) (save-excursion (forward-line 1) (point)))) - (insert "\n\n") - (forward-line -2) - (indent-relative-maybe)) - (t - ;; Make a new entry. - (forward-line 1) - (while (looking-at "\\sW") - (forward-line 1)) - (while (and (not (eobp)) (looking-at "^\\s *$")) - (delete-region (point) (save-excursion (forward-line 1) (point)))) - (insert "\n\n\n") - (forward-line -2) - (indent-to left-margin) - (insert "* " (or entry "")))) - ;; Now insert the function name, if we have one. - ;; Point is at the entry for this file, - ;; either at the end of the line or at the first blank line. - (if defun - (progn - ;; Make it easy to get rid of the function name. - (undo-boundary) - (insert (if (save-excursion - (beginning-of-line 1) - (looking-at "\\s *$")) - "" - " ") - "(" defun "): ")) - ;; No function name, so put in a colon unless we have just a star. - (if (not (save-excursion - (beginning-of-line 1) - (looking-at "\\s *\\(\\*\\s *\\)?$"))) - (insert ": "))))) - -;;;###autoload -(defun add-change-log-entry-other-window (&optional whoami file-name) - "Find change log file in other window and add an entry for today. -Optional arg (interactive prefix) non-nil means prompt for user name and site. -Second arg is file name of change log. \ -If nil, uses `change-log-default-name'." - (interactive (if current-prefix-arg - (list current-prefix-arg - (prompt-for-change-log-name)))) - (add-change-log-entry whoami file-name t)) -;;;###autoload (define-key ctl-x-4-map "a" 'add-change-log-entry-other-window) - -;;;###autoload -(defun change-log-mode () - "Major mode for editing change logs; like Indented Text Mode. -Prevents numeric backups and sets `left-margin' to 8 and `fill-column' to 74. -New log entries are usually made with \\[add-change-log-entry] or \\[add-change-log-entry-other-window]. -Each entry behaves as a paragraph, and the entries for one day as a page. -Runs `change-log-mode-hook'." - (interactive) - (kill-all-local-variables) - (indented-text-mode) - (setq major-mode 'change-log-mode - mode-name "Change Log" - left-margin 8 - fill-column 74 - indent-tabs-mode t - tab-width 8) - (use-local-map change-log-mode-map) - ;; Let each entry behave as one paragraph: - ;; We really do want "^" in paragraph-start below: it is only the lines that - ;; begin at column 0 (despite the left-margin of 8) that we are looking for. - (set (make-local-variable 'paragraph-start) "\\s *$\\|\f\\|^\\sw") - (set (make-local-variable 'paragraph-separate) "\\s *$\\|\f\\|^\\sw") - ;; Let all entries for one day behave as one page. - ;; Match null string on the date-line so that the date-line - ;; is grouped with what follows. - (set (make-local-variable 'page-delimiter) "^\\<\\|^\f") - (set (make-local-variable 'version-control) 'never) - (set (make-local-variable 'adaptive-fill-regexp) "\\s *") - (set (make-local-variable 'font-lock-defaults) - '(change-log-font-lock-keywords t)) - (run-hooks 'change-log-mode-hook)) - -;; It might be nice to have a general feature to replace this. The idea I -;; have is a variable giving a regexp matching text which should not be -;; moved from bol by filling. change-log-mode would set this to "^\\s *\\s(". -;; But I don't feel up to implementing that today. -(defun change-log-fill-paragraph (&optional justify) - "Fill the paragraph, but preserve open parentheses at beginning of lines. -Prefix arg means justify as well." - (interactive "P") - (let ((end (save-excursion (forward-paragraph) (point))) - (beg (save-excursion (backward-paragraph)(point))) - (paragraph-start (concat paragraph-start "\\|\\s *\\s("))) - (fill-region beg end justify))) - -(defvar add-log-current-defun-header-regexp - "^\\([A-Z][A-Z_ ]*[A-Z_]\\|[-_a-zA-Z]+\\)[ \t]*[:=]" - "*Heuristic regexp used by `add-log-current-defun' for unknown major modes.") - -;;;###autoload -(defun add-log-current-defun () - "Return name of function definition point is in, or nil. - -Understands C, Lisp, LaTeX (\"functions\" are chapters, sections, ...), -Texinfo (@node titles), Perl, and Fortran. - -Other modes are handled by a heuristic that looks in the 10K before -point for uppercase headings starting in the first column or -identifiers followed by `:' or `=', see variable -`add-log-current-defun-header-regexp'. - -Has a preference of looking backwards." - (condition-case nil - (save-excursion - (let ((location (point))) - (cond ((memq major-mode '(emacs-lisp-mode lisp-mode scheme-mode - lisp-interaction-mode)) - ;; If we are now precisely at the beginning of a defun, - ;; make sure beginning-of-defun finds that one - ;; rather than the previous one. - (or (eobp) (forward-char 1)) - (beginning-of-defun) - ;; Make sure we are really inside the defun found, not after it. - (if (and (looking-at "\\s(") - (progn (end-of-defun) - (< location (point))) - (progn (forward-sexp -1) - (>= location (point)))) - (progn - (if (looking-at "\\s(") - (forward-char 1)) - (forward-sexp 1) - (skip-chars-forward " '") - (buffer-substring (point) - (progn (forward-sexp 1) (point)))))) - ((and (memq major-mode '(c-mode c++-mode c++-c-mode objc-mode)) - (save-excursion (beginning-of-line) - ;; Use eq instead of = here to avoid - ;; error when at bob and char-after - ;; returns nil. - (while (eq (char-after (- (point) 2)) ?\\) - (forward-line -1)) - (looking-at "[ \t]*#[ \t]*define[ \t]"))) - ;; Handle a C macro definition. - (beginning-of-line) - (while (eq (char-after (- (point) 2)) ?\\) ;not =; note above - (forward-line -1)) - (search-forward "define") - (skip-chars-forward " \t") - (buffer-substring (point) - (progn (forward-sexp 1) (point)))) - ((memq major-mode '(c-mode c++-mode c++-c-mode objc-mode)) - (beginning-of-line) - ;; See if we are in the beginning part of a function, - ;; before the open brace. If so, advance forward. - (while (not (looking-at "{\\|\\(\\s *$\\)")) - (forward-line 1)) - (or (eobp) - (forward-char 1)) - (beginning-of-defun) - (if (progn (end-of-defun) - (< location (point))) - (progn - (backward-sexp 1) - (let (beg tem) - - (forward-line -1) - ;; Skip back over typedefs of arglist. - (while (and (not (bobp)) - (looking-at "[ \t\n]")) - (forward-line -1)) - ;; See if this is using the DEFUN macro used in Emacs, - ;; or the DEFUN macro used by the C library. - (if (condition-case nil - (and (save-excursion - (end-of-line) - (while (= (preceding-char) ?\\) - (end-of-line 2)) - (backward-sexp 1) - (beginning-of-line) - (setq tem (point)) - (looking-at "DEFUN\\b")) - (>= location tem)) - (error nil)) - (progn - (goto-char tem) - (down-list 1) - (if (= (char-after (point)) ?\") - (progn - (forward-sexp 1) - (skip-chars-forward " ,"))) - (buffer-substring (point) - (progn (forward-sexp 1) (point)))) - (if (looking-at "^[+-]") - (get-method-definition) - ;; Ordinary C function syntax. - (setq beg (point)) - (if (and (condition-case nil - ;; Protect against "Unbalanced parens" error. - (progn - (down-list 1) ; into arglist - (backward-up-list 1) - (skip-chars-backward " \t") - t) - (error nil)) - ;; Verify initial pos was after - ;; real start of function. - (save-excursion - (goto-char beg) - ;; For this purpose, include the line - ;; that has the decl keywords. This - ;; may also include some of the - ;; comments before the function. - (while (and (not (bobp)) - (save-excursion - (forward-line -1) - (looking-at "[^\n\f]"))) - (forward-line -1)) - (>= location (point))) - ;; Consistency check: going down and up - ;; shouldn't take us back before BEG. - (> (point) beg)) - (let (end middle) - ;; Don't include any final newline - ;; in the name we use. - (if (= (preceding-char) ?\n) - (forward-char -1)) - (setq end (point)) - (backward-sexp 1) - ;; Now find the right beginning of the name. - ;; Include certain keywords if they - ;; precede the name. - (setq middle (point)) - (forward-word -1) - ;; Ignore these subparts of a class decl - ;; and move back to the class name itself. - (while (looking-at "public \\|private ") - (skip-chars-backward " \t:") - (setq end (point)) - (backward-sexp 1) - (setq middle (point)) - (forward-word -1)) - (and (bolp) - (looking-at "struct \\|union \\|class ") - (setq middle (point))) - (buffer-substring middle end))))))))) - ((memq major-mode - '(TeX-mode plain-TeX-mode LaTeX-mode;; tex-mode.el - plain-tex-mode latex-mode;; cmutex.el - )) - (if (re-search-backward - "\\\\\\(sub\\)*\\(section\\|paragraph\\|chapter\\)" nil t) - (progn - (goto-char (match-beginning 0)) - (buffer-substring (1+ (point));; without initial backslash - (progn - (end-of-line) - (point)))))) - ((eq major-mode 'texinfo-mode) - (if (re-search-backward "^@node[ \t]+\\([^,\n]+\\)" nil t) - (buffer-substring (match-beginning 1) - (match-end 1)))) - ((eq major-mode 'perl-mode) - (if (re-search-backward "^sub[ \t]+\\([^ \t\n]+\\)" nil t) - (buffer-substring (match-beginning 1) - (match-end 1)))) - ((eq major-mode 'fortran-mode) - ;; must be inside function body for this to work - (beginning-of-fortran-subprogram) - (let ((case-fold-search t)) ; case-insensitive - ;; search for fortran subprogram start - (if (re-search-forward - "^[ \t]*\\(program\\|subroutine\\|function\ -\\|[ \ta-z0-9*]*[ \t]+function\\)" - nil t) - (progn - ;; move to EOL or before first left paren - (if (re-search-forward "[(\n]" nil t) - (progn (forward-char -1) - (skip-chars-backward " \t")) - (end-of-line)) - ;; Use the name preceding that. - (buffer-substring (point) - (progn (forward-sexp -1) - (point))))))) - (t - ;; If all else fails, try heuristics - (let (case-fold-search) - (end-of-line) - (if (re-search-backward add-log-current-defun-header-regexp - (- (point) 10000) - t) - (buffer-substring (match-beginning 1) - (match-end 1)))))))) - (error nil))) - -(defvar get-method-definition-md) - -;; Subroutine used within get-method-definition. -;; Add the last match in the buffer to the end of `md', -;; followed by the string END; move to the end of that match. -(defun get-method-definition-1 (end) - (setq get-method-definition-md - (concat get-method-definition-md - (buffer-substring (match-beginning 1) (match-end 1)) - end)) - (goto-char (match-end 0))) - -;; For objective C, return the method name if we are in a method. -(defun get-method-definition () - (let ((get-method-definition-md "[")) - (save-excursion - (if (re-search-backward "^@implementation\\s-*\\([A-Za-z_]*\\)" nil t) - (get-method-definition-1 " "))) - (save-excursion - (cond - ((re-search-forward "^\\([-+]\\)[ \t\n\f\r]*\\(([^)]*)\\)?\\s-*" nil t) - (get-method-definition-1 "") - (while (not (looking-at "[{;]")) - (looking-at - "\\([A-Za-z_]*:?\\)\\s-*\\(([^)]*)\\)?[A-Za-z_]*[ \t\n\f\r]*") - (get-method-definition-1 "")) - (concat get-method-definition-md "]")))))) - - -(provide 'add-log) - -;;; add-log.el ends here diff --git a/contrib/binutils/etc/add-log.vi b/contrib/binutils/etc/add-log.vi deleted file mode 100644 index efb8c77aa2b8..000000000000 --- a/contrib/binutils/etc/add-log.vi +++ /dev/null @@ -1,11 +0,0 @@ -Here is a vi macro to create entries in the recommended format for -GDB's ChangeLogs. - -map 1GO:r !date '+\%Y-\%m-\%d'2GA Jason Molenda (:r !whoamikJxA@:r !hostnameA)kJxkddjO
*
k$ - -It contains control and escape sequences, so don't just cut and paste it. -You'll need to change the "Jason Molenda" bit, of course. :-) Put this -in your $HOME/.exrc and when you type control-X in move-around-mode, -you'll have a changelog template inserted. - ---- Jason Molenda diff --git a/contrib/binutils/etc/cfg-paper.texi b/contrib/binutils/etc/cfg-paper.texi deleted file mode 100644 index bcfbb31e13f8..000000000000 --- a/contrib/binutils/etc/cfg-paper.texi +++ /dev/null @@ -1,717 +0,0 @@ -\input texinfo -@c %**start of header -@setfilename cfg-paper.info -@settitle On Configuring Development Tools -@c %**end of header -@setchapternewpage off - -@ifinfo -This document attempts to describe the general concepts behind -configuration of the @sc{gnu} Development Tools. -It also discusses common usage. - -Copyright (C) 1991, 1992, 1994 Cygnus Support -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, provided 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, -except that this permission notice may be stated in a translation approved -by Cygnus Support. -@end ifinfo - -@titlepage -@sp 10 -@title{On Configuring Development Tools} -@author{K. Richard Pixley, @code{rich@@cygnus.com}} -@author{Cygnus Support} -@page - -@vskip 0pt plus 1filll -Copyright @copyright{} 1991, 1992, 1994 Cygnus Support - -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, provided 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, -except that this permission notice may be stated in a translation approved -by Cygnus Support. -@end titlepage - -@ifinfo -@format -START-INFO-DIR-ENTRY -* configuration: (cfg-paper). Some theory on configuring source. -END-INFO-DIR-ENTRY -@end format -@end ifinfo - -@node top, Some Basic Terms, (dir), (dir) - -@ifinfo -This document attempts to describe the general concepts behind -configuration of the @sc{gnu} Development Tools. -It also discusses common usage. -@end ifinfo - -@menu -* Some Basic Terms:: Some Basic Terms -* Specifics.:: Specifics -* Building Development Environments:: Building Development Environments -* A Walk Through:: A Walk Through -* Final Notes:: Final Notes -* Index:: Index - - --- The Detailed Node Listing --- - -Some Basic Terms - -* Host Environments:: Host Environments -* Configuration Time Options:: Configuration Time Options - -A Walk Through - -* Native Development Environments:: Native Development Environments -* Emulation Environments:: Emulation Environments -* Simple Cross Environments:: Simple Cross Environments -* Crossing Into Targets:: Crossing Into Targets -* Canadian Cross:: Canadian Cross - -Final Notes - -* Hacking Configurations:: Hacking Configurations -@end menu - -@node Some Basic Terms, Specifics., top, top -@chapter Some Basic Terms - -There are a lot of terms that are frequently used when discussing -development tools. Most of the common terms have been used for many -different concepts such that their meanings have become ambiguous to the -point of being confusing. Typically, we only guess at their meanings -from context and we frequently guess wrong. - -This document uses very few terms by comparison. The intent is to make -the concepts as clear as possible in order to convey the usage and -intent of these tools. - -@emph{Programs} run on @emph{machines}. Programs are very nearly always -written in @emph{source}. Programs are @emph{built} from source. -@emph{Compilation} is a process that is frequently, but not always, used -when building programs. -@cindex Programs -@cindex Machines -@cindex Source -@cindex Building -@cindex Compilation - -@menu -* Host Environments:: Host Environments -* Configuration Time Options:: Configuration Time Options -@end menu - -@node Host Environments, Configuration Time Options, Some Basic Terms, Some Basic Terms -@section Host Environments - -@cindex host -In this document, the word @emph{host} refers to the environment in -which the source in question will be compiled. @emph{host} and -@emph{host name} have nothing to do with the proper name of your host, -like @emph{ucbvax}, @emph{prep.ai.mit.edu} or @emph{att.com}. Instead -they refer to things like @emph{sun4} and @emph{dec3100}. - -Forget for a moment that this particular directory of source is the -source for a development environment. Instead, pretend that it is the -source for a simpler, more mundane, application, say, a desk calculator. - -Source that can be compiled in more than one environment, generally -needs to be set up for each environment explicitly. Here we refer to -that process as configuration. That is, we configure the source for a -host. - -For example, if we wanted to configure our mythical desk calculator to -compile on a SparcStation, we might configure for host sun4. With our -configuration system: - -@example -cd desk-calculator ; ./configure sun4 -@end example - -@noindent -does the trick. @code{configure} is a shell script that sets up Makefiles, -subdirectories, and symbolic links appropriate for compiling the source -on a sun4. - -The @emph{host} environment does not necessarily refer to the machine on -which the tools are built. It is possible to provide a sun3 development -environment on a sun4. If we wanted to use a cross compiler on the sun4 -to build a program intended to be run on a sun3, we would configure the -source for sun3. - -@example -cd desk-calculator ; ./configure sun3 -@end example - -@noindent -The fact that we are actually building the program on a sun4 makes no -difference if the sun3 cross compiler presents an environment that looks -like a sun3 from the point of view of the desk calculator source code. -Specifically, the environment is a sun3 environment if the header files, -predefined symbols, and libraries appear as they do on a sun3. - -Nor does the host environment refer to the the machine on which the -program to be built will run. It is possible to provide a sun3 -emulation environment on a sun4 such that programs built in a sun3 -development environment actually run on the sun4. This technique is -often used within individual programs to remedy deficiencies in the host -operating system. For example, some operating systems do not provide -the @code{bcopy} function and so it is emulated using the -@code{memcpy} funtion. - -Host environment simply refers to the environment in which the program -will be built from the source. - - -@node Configuration Time Options, , Host Environments, Some Basic Terms -@section Configuration Time Options - -Many programs have compile time options. That is, features of the -program that are either compiled into the program or not based on a -choice made by the person who builds the program. We refer to these as -@emph{configuration options}. For example, our desk calculator might be -capable of being compiled into a program that either uses infix notation -or postfix as a configuration option. For a sun3, to choose infix you -might use: - -@example -./configure sun3 --enable-notation=infix -@end example - -@noindent -while for a sun4 with postfix you might use: - -@example -./configure sun4 --enable-notation=postfix -@end example - -If we wanted to build both at the same time, the intermediate pieces -used in the build process must be kept separate. - -@example -mkdir ../objdir.sun4 -(cd ../objdir.sun4 ; ../configure sun4 --enable-notation=postfix --srcdir=../src) -mkdir ../objdir.sun3 -(cd ../objdir.sun3 ; ../configure sun3 --enable-notation=infix --srcdir=../src) -@end example - -@noindent -will create subdirectories for the intermediate pieces of the sun4 and -sun3 configurations. This is necessary as previous systems were only -capable of one configuration at a time. Otherwise, a second -configuration would write over the first. We've chosen to retain this -behaviour so the obj directories and the @code{--srcdir} configuration -option are necessary to get the new behaviour. The order of the -arguments doesn't matter. There should be exactly one argument without -a leading @samp{-} and that argument will be assumed to be the host -name. - -From here on the examples will assume that you want to build the tools -@emph{in place} and won't show the @code{--srcdir} option, but remember -that it is available. - -In order to actually install the program, the configuration system needs -to know where you would like the program installed. The default -location is @file{/usr/local}. We refer to this location as -@code{$(prefix)}. All user visible programs will be installed in -@file{@code{$(prefix)}/bin}. All other programs and files will be -installed in a subdirectory of @file{@code{$(prefix)}/lib}. - -You can only change @code{$(prefix)} as a configuration time -option. - -@example -./configure sun4 --enable-notation=postfix --prefix=/local -@end example - -@noindent -Will configure the source such that: - -@example -make install -@end example - -@noindent -will put its programs in @file{/local/bin} and @file{/local/lib/gcc}. -If you change @code{$(prefix)} after building the source, you will need -to: - -@example -make clean -@end example - -@noindent -before the change will be propogated properly. This is because some -tools need to know the locations of other tools. - -With these concepts in mind, we can drop the desk calculator example and -move on to the application that resides in these directories, namely, -the source to a development environment. - -@node Specifics., Building Development Environments, Some Basic Terms, top -@chapter Specifics - -The @sc{gnu} Development Tools can be built on a wide variety of hosts. So, -of course, they must be configured. Like the last example, - -@example -./configure sun4 --prefix=/local -./configure sun3 --prefix=/local -@end example - -@noindent -will configure the source to be built in subdirectories, in order to -keep the intermediate pieces separate, and to be installed in -@file{/local}. - -When built with suitable development environments, these will be native -tools. We'll explain the term @emph{native} later. - -@node Building Development Environments, A Walk Through, Specifics., top -@chapter Building Development Environments - -@cindex Target - -The @sc{gnu} development tools can not only be built in a -number of host development environments, they can also be configured to -create a number of different development environments on each of those -hosts. We refer to a specific development environment created as a -@emph{target}. That is, the word @emph{target} refers to the development -environment produced by compiling this source and installing the -resulting programs. - -For the @sc{gnu} development tools, the default target is the -same as the host. That is, the development environment produced is -intended to be compatible with the environment used to build the tools. - -In the example above, we created two configurations, one for sun4 and -one for sun3. The first configuration is expecting to be built in a -sun4 development environment, to create a sun4 development environment. -It doesn't necessarily need to be built on a sun4 if a sun4 development -environment is available elsewhere. Likewise, if the available sun4 -development environment produces executables intended for something -other than sun4, then the development environment built from this sun4 -configuration will run on something other than a sun4. From the point -of view of the configuration system and the @sc{gnu} development tools -source, this doesn't matter. What matters is that they will be built in -a sun4 environment. - -Similarly, the second configuration given above is expecting to be built -in a sun3 development environment, to create a sun3 development -environment. - -The development environment produced is a configuration time option, -just like @code{$(prefix)}. - -@example -./configure sun4 --prefix=/local --target=sun3 -./configure sun3 --prefix=/local --target=sun4 -@end example - -In this example, like before, we create two configurations. The first -is intended to be built in a sun4 environment, in subdirectories, to be -installed in @file{/local}. The second is intended to be built in a -sun3 environment, in subdirectories, to be installed in @file{/local}. - -Unlike the previous example, the first configuration will produce a sun3 -development environment, perhaps even suitable for building the second -configuration. Likewise, the second configuration will produce a sun4 -development environment, perhaps even suitable for building the first -configuration. - -The development environment used to build these configurations will -determine the machines on which the resulting development environments -can be used. - - -@node A Walk Through, Final Notes, Building Development Environments, top -@chapter A Walk Through - - -@menu -* Native Development Environments:: Native Development Environments -* Emulation Environments:: Emulation Environments -* Simple Cross Environments:: Simple Cross Environments -* Crossing Into Targets:: Crossing Into Targets -* Canadian Cross:: Canadian Cross -@end menu - -@node Native Development Environments, Emulation Environments, A Walk Through, A Walk Through -@section Native Development Environments - -Let us assume for a moment that you have a sun4 and that with your sun4 -you received a development environment. This development environment is -intended to be run on your sun4 to build programs that can be run on -your sun4. You could, for instance, run this development environment on -your sun4 to build our example desk calculator program. You could then -run the desk calculator program on your sun4. - -@cindex Native -@cindex Foreign -The resulting desk calculator program is referred to as a @emph{native} -program. The development environment itself is composed of native -programs that, when run, build other native programs. Any other program -is referred to as @emph{foreign}. Programs intended for other machines are -foreign programs. - -This type of development environment, which is by far the most common, -is refered to as @emph{native}. That is, a native development environment -runs on some machine to build programs for that same machine. The -process of using a native development environment to build native -programs is called a @emph{native} build. - -@example -./configure sun4 -@end example - -@noindent -will configure this source such that when built in a sun4 development -environment, with a development environment that builds programs -intended to be run on sun4 machines, the programs built will be native -programs and the resulting development environment will be a native -development environment. - -The development system that came with your sun4 is one such environment. -Using it to build the @sc{gnu} Development Tools is a very common activity -and the resulting development environment is quite popular. - -@example -make all -@end example - -@noindent -will build the tools as configured and will assume that you want to use -the native development environment that came with your machine. - -@cindex Bootstrapping -@cindex Stage1 -Using a development environment to build a development environment is -called @emph{bootstrapping}. The release of the @sc{gnu} -Development Tools is capable of bootstrapping itself. This is a very -powerful feature that we'll return to later. For now, let's pretend -that you used the native development environment that came with your -sun4 to bootstrap the release and let's call the new -development environment @emph{stage1}. - -Why bother? Well, most people find that the @sc{gnu} development -environment builds programs that run faster and take up less space than -the native development environments that came with their machines. Some -people didn't get development environments with their machines and some -people just like using the @sc{gnu} tools better than using other tools. - -@cindex Stage2 -While you're at it, if the @sc{gnu} tools produce better programs, maybe you -should use them to build the @sc{gnu} tools. So let's -pretend that you do. Let's call the new development environment -@emph{stage2}. - -@cindex Stage3 -So far you've built a development environment, stage1, and you've used -stage1 to build a new, faster and smaller development environment, -stage2, but you haven't run any of the programs that the @sc{gnu} tools have -built. You really don't yet know if these tools work. Do you have any -programs built with the @sc{gnu} tools? Yes, you do. stage2. What does -that program do? It builds programs. Ok, do you have any source handy -to build into a program? Yes, you do. The @sc{gnu} tools themselves. In -fact, if you use stage2 to build the @sc{gnu} tools again the resulting -programs should be identical to stage2. Let's pretend that you do and -call the new development environment @emph{stage3}. - -@cindex Three stage boot -You've just completed what's called a @emph{three stage boot}. You now have -a small, fast, somewhat tested, development environment. - -@example -make bootstrap -@end example - -@noindent -will do a three stage boot across all tools and will compare stage2 to -stage3 and complain if they are not identical. - -Once built, - -@example -make install -@end example - -@noindent -will install the development environment in the default location, or in -@code{$(prefix)} if you specified an alternate when you configured. - -@cindex Cross -Any development environment that is not a native development environment -is refered to as a @emph{cross} development environment. There are many -different types of cross development environments but most fall into one -of three basic categories. - - -@node Emulation Environments, Simple Cross Environments, Native Development Environments, A Walk Through -@section Emulation Environments - -@cindex Emulation -The first category of cross development environment is called -@emph{emulation}. There are two primary types of emulation, but both -types result in programs that run on the native host. - -@cindex Software emulation -@cindex Software emulator -The first type is @emph{software emulation}. This form of cross -development environment involves a native program that when run on the -native host, is capable of interpreting, and in most aspects running, a -program intended for some other machine. This technique is typically -used when the other machine is either too expensive, too slow, too fast, -or not available, perhaps because it hasn't yet been built. The native, -interpreting program is called a @emph{software emulator}. - -The @sc{gnu} Development Tools do not currently include any software -emulators. Some do exist and the @sc{gnu} Development Tools can be -configured to create simple cross development environments for with -these emulators. More on this later. - -The second type of emulation is when source intended for some other -development environment is built into a program intended for the native -host. The concepts of operating system universes and hosted operating -systems are two such development environments. - -@node Simple Cross Environments, Crossing Into Targets, Emulation Environments, A Walk Through -@section Simple Cross Environments - -@example -./configure sun4 --target=a29k -@end example - -@noindent -will configure the tools such that when compiled in a sun4 development -environment the resulting development environment can be used to create -programs intended for an a29k. Again, this does not necessarily mean -that the new development environment can be run on a sun4. That would -depend on the development environment used to build these tools. - -Earlier you saw how to configure the tools to build a native development -environment, that is, a development environment that runs on your sun4 -and builds programs for your sun4. Let's pretend that you use stage3 to -build this simple cross configuration and let's call the new development -environment gcc-a29k. Remember that this is a native build. Gcc-a29k -is a collection of native programs intended to run on your sun4. That's -what stage3 builds, programs for your sun4. Gcc-a29k represents an a29k -development environment that builds programs intended to run on an a29k. -But, remember, gcc-a29k runs on your sun4. Programs built with gcc-a29k -will run on your sun4 only with the help of an appropriate software -emulator. - -@cindex Simple cross -@cindex Crossing to -Building gcc-a29k is also a bootstrap but of a slightly different sort. -We call gcc-a29k a @emph{simple cross} environment and using gcc-a29k to -build a program intended for a29k is called @emph{crossing to} a29k. -Simple cross environments are the second category of cross development -environments. - - -@node Crossing Into Targets, Canadian Cross, Simple Cross Environments, A Walk Through -@section Crossing Into Targets - -@example -./configure a29k --target=a29k -@end example - -@noindent -will configure the tools such that when compiled in an a29k development -environment, the resulting development environment can be used to create -programs intended for an a29k. Again, this does not necessarily mean -that the new development environment can be run on an a29k. That would -depend on the development environment used to build these tools. - -If you've been following along this walk through, then you've already -built an a29k environment, namely gcc-a29k. Let's pretend you use -gcc-a29k to build the current configuration. - -Gcc-a29k builds programs intended for the a29k so the new development -environment will be intended for use on an a29k. That is, this new gcc -consists of programs that are foreign to your sun4. They cannot be run -on your sun4. - -@cindex Crossing into -The process of building this configuration is a another bootstrap. This -bootstrap is also a cross to a29k. Because this type of build is both a -bootstrap and a cross to a29k, it is sometimes referred to as a -@emph{cross into} a29k. This new development environment isn't really a -cross development environment at all. It is intended to run on an a29k -to produce programs for an a29k. You'll remember that this makes it, by -definition, an a29k native compiler. @emph{Crossing into} has been -introduced here not because it is a type of cross development -environment, but because it is frequently mistaken as one. The process -is @emph{a cross} but the resulting development environment is a native -development environment. - -You could not have built this configuration with stage3, because stage3 -doesn't provide an a29k environment. Instead it provides a sun4 -environment. - -If you happen to have an a29k lying around, you could now use this fresh -development environment on the a29k to three-stage these tools all over -again. This process would look just like it did when we built the -native sun4 development environment because we would be building another -native development environment, this one on a29k. - - -@node Canadian Cross, , Crossing Into Targets, A Walk Through -@section Canadian Cross - -So far you've seen that our development environment source must be -configured for a specific host and for a specific target. You've also -seen that the resulting development environment depends on the -development environment used in the build process. - -When all four match identically, that is, the configured host, the -configured target, the environment presented by the development -environment used in the build, and the machine on which the resulting -development environment is intended to run, then the new development -environment will be a native development environment. - -When all four match except the configured host, then we can assume that -the development environment used in the build is some form of library -emulation. - -When all four match except for the configured target, then the resulting -development environment will be a simple cross development environment. - -When all four match except for the host on which the development -environment used in the build runs, the build process is a @emph{cross into} -and the resulting development environment will be native to some other -machine. - -Most of the other permutations do exist in some form, but only one more -is interesting to the current discussion. - -@example -./configure a29k --target=sun3 -@end example - -@noindent -will configure the tools such that when compiled in an a29k development -environment, the resulting development environment can be used to create -programs intended for a sun3. Again, this does not necessarily mean -that the new development environment can be run on an a29k. That would -depend on the development environment used to build these tools. - -If you are still following along, then you have two a29k development -environments, the native development environment that runs on a29k, and -the simple cross that runs on your sun4. If you use the a29k native -development environment on the a29k, you will be doing the same thing we -did a while back, namely building a simple cross from a29k to sun3. -Let's pretend that instead, you use gcc-a29k, the simple cross -development environment that runs on sun4 but produces programs for -a29k. - -The resulting development environment will run on a29k because that's -what gcc-a29k builds, a29k programs. This development environment will -produce programs for a sun3 because that is how it was configured. This -means that the resulting development environment is a simple cross. - -@cindex Canadian Cross -@cindex Three party cross -There really isn't a common name for this process because very few -development environments are capable of being configured this -extensively. For the sake of discussion, let's call this process a -@emph{Canadian cross}. It's a three party cross, Canada has a three -party system, hence Canadian Cross. - -@node Final Notes, Index, A Walk Through, top -@chapter Final Notes - -By @emph{configures}, I mean that links, Makefile, .gdbinit, and -config.status are built. Configuration is always done from the source -directory. - -@table @code - -@item ./configure @var{name} -configures this directory, perhaps recursively, for a single host+target -pair where the host and target are both @var{name}. If a previous -configuration existed, it will be overwritten. - -@item ./configure @var{hostname} --target=@var{targetname} -configures this directory, perhaps recursively, for a single host+target -pair where the host is @var{hostname} and target is @var{targetname}. -If a previous configuration existed, it will be overwritten. - -@end table - -@menu -* Hacking Configurations:: Hacking Configurations -@end menu - -@node Hacking Configurations, , Final Notes, Final Notes -@section Hacking Configurations - -The configure scripts essentially do three things, create subdirectories -if appropriate, build a @file{Makefile}, and create links to files, all -based on and tailored to, a specific host+target pair. The scripts also -create a @file{.gdbinit} if appropriate but this is not tailored. - -The Makefile is created by prepending some variable definitions to a -Makefile template called @file{Makefile.in} and then inserting host and -target specific Makefile fragments. The variables are set based on the -chosen host+target pair and build style, that is, if you use -@code{--srcdir} or not. The host and target specific Makefile may or may -not exist. - -@itemize @bullet - -@item -Makefiles can be edited directly, but those changes will eventually be -lost. Changes intended to be permanent for a specific host should be -made to the host specific Makefile fragment. This should be in -@file{./config/mh-@var{host}} if it exists. Changes intended to be -permanent for a specific target should be made to the target specific -Makefile fragment. This should be in @file{./config/mt-@var{target}} if -it exists. Changes intended to be permanent for the directory should be -made in @file{Makefile.in}. To propogate changes to any of these, -either use @code{make Makefile} or @code{./config.status} or -re-configure. - -@end itemize - -@page -@node Index, , Final Notes, top -@appendix Index - -@printindex cp - -@contents -@bye - -@c Local Variables: -@c fill-column: 72 -@c End: diff --git a/contrib/binutils/etc/configbuild.ein b/contrib/binutils/etc/configbuild.ein deleted file mode 100644 index 7a0e214f2d52..000000000000 --- a/contrib/binutils/etc/configbuild.ein +++ /dev/null @@ -1,149 +0,0 @@ -%!PS-Adobe-2.0 EPSF-2.0 -%%Title: configbuild.fig -%%Creator: fig2dev Version 3.1 Patchlevel 1 -%%CreationDate: Fri Jun 12 20:13:16 1998 -%%For: ian@tito.cygnus.com (Ian Lance Taylor) -%%Orientation: Portrait -%%BoundingBox: 0 0 322 173 -%%Pages: 0 -%%BeginSetup -%%IncludeFeature: *PageSize Letter -%%EndSetup -%%EndComments -/$F2psDict 200 dict def -$F2psDict begin -$F2psDict /mtrx matrix put -/col-1 {} def -/col0 {0.000 0.000 0.000 srgb} bind def -/col1 {0.000 0.000 1.000 srgb} bind def -/col2 {0.000 1.000 0.000 srgb} bind def -/col3 {0.000 1.000 1.000 srgb} bind def -/col4 {1.000 0.000 0.000 srgb} bind def -/col5 {1.000 0.000 1.000 srgb} bind def -/col6 {1.000 1.000 0.000 srgb} bind def -/col7 {1.000 1.000 1.000 srgb} bind def -/col8 {0.000 0.000 0.560 srgb} bind def -/col9 {0.000 0.000 0.690 srgb} bind def -/col10 {0.000 0.000 0.820 srgb} bind def -/col11 {0.530 0.810 1.000 srgb} bind def -/col12 {0.000 0.560 0.000 srgb} bind def -/col13 {0.000 0.690 0.000 srgb} bind def -/col14 {0.000 0.820 0.000 srgb} bind def -/col15 {0.000 0.560 0.560 srgb} bind def -/col16 {0.000 0.690 0.690 srgb} bind def -/col17 {0.000 0.820 0.820 srgb} bind def -/col18 {0.560 0.000 0.000 srgb} bind def -/col19 {0.690 0.000 0.000 srgb} bind def -/col20 {0.820 0.000 0.000 srgb} bind def -/col21 {0.560 0.000 0.560 srgb} bind def -/col22 {0.690 0.000 0.690 srgb} bind def -/col23 {0.820 0.000 0.820 srgb} bind def -/col24 {0.500 0.190 0.000 srgb} bind def -/col25 {0.630 0.250 0.000 srgb} bind def -/col26 {0.750 0.380 0.000 srgb} bind def -/col27 {1.000 0.500 0.500 srgb} bind def -/col28 {1.000 0.630 0.630 srgb} bind def -/col29 {1.000 0.750 0.750 srgb} bind def -/col30 {1.000 0.880 0.880 srgb} bind def -/col31 {1.000 0.840 0.000 srgb} bind def - -end -save --62.0 226.0 translate -1 -1 scale - -/clp {closepath} bind def -/ef {eofill} bind def -/gr {grestore} bind def -/gs {gsave} bind def -/l {lineto} bind def -/m {moveto} bind def -/n {newpath} bind def -/s {stroke} bind def -/slc {setlinecap} bind def -/slj {setlinejoin} bind def -/slw {setlinewidth} bind def -/srgb {setrgbcolor} bind def -/rot {rotate} bind def -/sc {scale} bind def -/tr {translate} bind def -/tnt {dup dup currentrgbcolor - 4 -2 roll dup 1 exch sub 3 -1 roll mul add - 4 -2 roll dup 1 exch sub 3 -1 roll mul add - 4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb} - bind def -/shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul - 4 -2 roll mul srgb} bind def -/$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def -/$F2psEnd {$F2psEnteredState restore end} def -%%EndProlog - -$F2psBegin -10 setmiterlimit - 0.06000 0.06000 sc -7.500 slw -% Polyline -n 1050 900 m 2100 900 l 2100 1425 l 1050 1425 l clp gs col-1 s gr -% Polyline -n 1500 1425 m 1500 2100 l gs col-1 s gr -n 1530.00 1980.00 m 1500.00 2100.00 l 1470.00 1980.00 l 1500.50 1980.50 l 1530.00 1980.00 l clp gs 0.00 setgray ef gr gs col-1 s gr -% Polyline -n 1500 2625 m 1500 3300 l gs col-1 s gr -n 1530.00 3180.00 m 1500.00 3300.00 l 1470.00 3180.00 l 1500.50 3180.50 l 1530.00 3180.00 l clp gs 0.00 setgray ef gr gs col-1 s gr -% Polyline -n 2925 900 m 3825 900 l 3825 1425 l 2925 1425 l clp gs col-1 s gr -% Polyline -n 1155 2100 m 1050 2100 1050 2520 105 arcto 4 {pop} repeat 1050 2625 2220 2625 105 arcto 4 {pop} repeat 2325 2625 2325 2205 105 arcto 4 {pop} repeat 2325 2100 1155 2100 105 arcto 4 {pop} repeat clp gs col-1 s gr -% Polyline -n 2850 2100 m 4125 2100 l 4125 2625 l 2850 2625 l clp gs col-1 s gr -% Polyline -n 3375 1425 m 3375 2100 l gs col-1 s gr -n 3405.00 1980.00 m 3375.00 2100.00 l 3345.00 1980.00 l 3375.50 1980.50 l 3405.00 1980.00 l clp gs 0.00 setgray ef gr gs col-1 s gr -% Polyline -n 5100 900 m 6300 900 l 6300 1350 l 5100 1350 l clp gs col-1 s gr -% Polyline -n 5625 1350 m 5625 2100 l gs col-1 s gr -n 5655.00 1980.00 m 5625.00 2100.00 l 5595.00 1980.00 l 5625.50 1980.50 l 5655.00 1980.00 l clp gs 0.00 setgray ef gr gs col-1 s gr -% Polyline -n 5205 2100 m 5100 2100 5100 2520 105 arcto 4 {pop} repeat 5100 2625 6270 2625 105 arcto 4 {pop} repeat 6375 2625 6375 2205 105 arcto 4 {pop} repeat 6375 2100 5205 2100 105 arcto 4 {pop} repeat clp gs col-1 s gr -% Polyline -n 5625 2625 m 5625 3300 l gs col-1 s gr -n 5655.00 3180.00 m 5625.00 3300.00 l 5595.00 3180.00 l 5625.50 3180.50 l 5655.00 3180.00 l clp gs 0.00 setgray ef gr gs col-1 s gr -% Polyline -n 5100 3300 m 6225 3300 l 6225 3750 l 5100 3750 l clp gs col-1 s gr -% Polyline - [1 50.0] 50.000000 setdash -n 2850 2400 m 2325 2400 l gs col-1 s gr [] 0 setdash -n 2445.00 2430.00 m 2325.00 2400.00 l 2445.00 2370.00 l 2445.50 2400.50 l 2445.00 2430.00 l clp gs 0.00 setgray ef gr gs col-1 s gr -% Polyline - [1 50.0] 50.000000 setdash -n 4125 2400 m 5100 2400 l gs col-1 s gr [] 0 setdash -n 4980.00 2370.00 m 5100.00 2400.00 l 4980.00 2430.00 l 4980.50 2400.50 l 4980.00 2370.00 l clp gs 0.00 setgray ef gr gs col-1 s gr -% Polyline -n 1050 3300 m 1950 3300 l 1950 3750 l 1050 3750 l clp gs col-1 s gr -/Times-Roman findfont 180.00 scalefont setfont -1200 1200 m -gs 1 -1 sc (config.in) col-1 show gr -/Times-Roman findfont 180.00 scalefont setfont -3000 1200 m -gs 1 -1 sc (configure) col-1 show gr -/Times-Roman findfont 180.00 scalefont setfont -3000 2400 m -gs 1 -1 sc (config.status) col-1 show gr -/Times-Roman findfont 180.00 scalefont setfont -1200 2400 m -gs 1 -1 sc (config.status) col-1 show gr -/Times-Roman findfont 180.00 scalefont setfont -1200 3600 m -gs 1 -1 sc (config.h) col-1 show gr -/Times-Roman findfont 180.00 scalefont setfont -5250 1200 m -gs 1 -1 sc (Makefile.in) col-1 show gr -/Times-Roman findfont 180.00 scalefont setfont -5250 2400 m -gs 1 -1 sc (config.status) col-1 show gr -/Times-Roman findfont 180.00 scalefont setfont -5250 3600 m -gs 1 -1 sc (Makefile) col-1 show gr -$F2psEnd -restore diff --git a/contrib/binutils/etc/configbuild.fig b/contrib/binutils/etc/configbuild.fig deleted file mode 100644 index 747592d3d623..000000000000 --- a/contrib/binutils/etc/configbuild.fig +++ /dev/null @@ -1,50 +0,0 @@ -#FIG 3.1 -Portrait -Center -Inches -1200 2 -2 2 0 1 -1 7 0 0 -1 0.000 0 0 0 0 0 5 - 1050 900 2100 900 2100 1425 1050 1425 1050 900 -2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 1500 1425 1500 2100 -2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 1500 2625 1500 3300 -2 2 0 1 -1 7 0 0 -1 0.000 0 0 0 0 0 5 - 2925 900 3825 900 3825 1425 2925 1425 2925 900 -2 4 0 1 -1 7 0 0 -1 0.000 0 0 7 0 0 5 - 2325 2625 2325 2100 1050 2100 1050 2625 2325 2625 -2 2 0 1 -1 7 0 0 -1 0.000 0 0 0 0 0 5 - 2850 2100 4125 2100 4125 2625 2850 2625 2850 2100 -2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 3375 1425 3375 2100 -2 2 0 1 -1 7 0 0 -1 0.000 0 0 0 0 0 5 - 5100 900 6300 900 6300 1350 5100 1350 5100 900 -2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 5625 1350 5625 2100 -2 4 0 1 -1 7 0 0 -1 0.000 0 0 7 0 0 5 - 6375 2625 6375 2100 5100 2100 5100 2625 6375 2625 -2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 5625 2625 5625 3300 -2 2 0 1 -1 7 0 0 -1 0.000 0 0 0 0 0 5 - 5100 3300 6225 3300 6225 3750 5100 3750 5100 3300 -2 1 2 1 -1 7 0 0 -1 3.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 2850 2400 2325 2400 -2 1 2 1 -1 7 0 0 -1 3.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 4125 2400 5100 2400 -2 2 0 1 -1 7 0 0 -1 0.000 0 0 0 0 0 5 - 1050 3300 1950 3300 1950 3750 1050 3750 1050 3300 -4 0 -1 0 0 0 12 0.0000000 4 180 645 1200 1200 config.in\001 -4 0 -1 0 0 0 12 0.0000000 4 180 705 3000 1200 configure\001 -4 0 -1 0 0 0 12 0.0000000 4 180 990 3000 2400 config.status\001 -4 0 -1 0 0 0 12 0.0000000 4 180 990 1200 2400 config.status\001 -4 0 -1 0 0 0 12 0.0000000 4 180 600 1200 3600 config.h\001 -4 0 -1 0 0 0 12 0.0000000 4 135 855 5250 1200 Makefile.in\001 -4 0 -1 0 0 0 12 0.0000000 4 180 990 5250 2400 config.status\001 -4 0 -1 0 0 0 12 0.0000000 4 135 675 5250 3600 Makefile\001 diff --git a/contrib/binutils/etc/configbuild.jin b/contrib/binutils/etc/configbuild.jin Binary files differdeleted file mode 100644 index 44cd9397aa16..000000000000 --- a/contrib/binutils/etc/configbuild.jin +++ /dev/null diff --git a/contrib/binutils/etc/configbuild.tin b/contrib/binutils/etc/configbuild.tin deleted file mode 100644 index cfdd6fe07437..000000000000 --- a/contrib/binutils/etc/configbuild.tin +++ /dev/null @@ -1,9 +0,0 @@ - config.in *configure* Makefile.in - | | | - | v | - | config.status | - | | | - *config.status*<======+==========>*config.status* - | | - v v - config.h Makefile diff --git a/contrib/binutils/etc/configdev.ein b/contrib/binutils/etc/configdev.ein deleted file mode 100644 index 7f837850d695..000000000000 --- a/contrib/binutils/etc/configdev.ein +++ /dev/null @@ -1,185 +0,0 @@ -%!PS-Adobe-2.0 EPSF-2.0 -%%Title: configdev.fig -%%Creator: fig2dev Version 3.1 Patchlevel 1 -%%CreationDate: Mon Jun 15 17:35:19 1998 -%%For: ian@tito.cygnus.com (Ian Lance Taylor) -%%Orientation: Portrait -%%BoundingBox: 0 0 344 317 -%%Pages: 0 -%%BeginSetup -%%IncludeFeature: *PageSize Letter -%%EndSetup -%%EndComments -/$F2psDict 200 dict def -$F2psDict begin -$F2psDict /mtrx matrix put -/col-1 {} def -/col0 {0.000 0.000 0.000 srgb} bind def -/col1 {0.000 0.000 1.000 srgb} bind def -/col2 {0.000 1.000 0.000 srgb} bind def -/col3 {0.000 1.000 1.000 srgb} bind def -/col4 {1.000 0.000 0.000 srgb} bind def -/col5 {1.000 0.000 1.000 srgb} bind def -/col6 {1.000 1.000 0.000 srgb} bind def -/col7 {1.000 1.000 1.000 srgb} bind def -/col8 {0.000 0.000 0.560 srgb} bind def -/col9 {0.000 0.000 0.690 srgb} bind def -/col10 {0.000 0.000 0.820 srgb} bind def -/col11 {0.530 0.810 1.000 srgb} bind def -/col12 {0.000 0.560 0.000 srgb} bind def -/col13 {0.000 0.690 0.000 srgb} bind def -/col14 {0.000 0.820 0.000 srgb} bind def -/col15 {0.000 0.560 0.560 srgb} bind def -/col16 {0.000 0.690 0.690 srgb} bind def -/col17 {0.000 0.820 0.820 srgb} bind def -/col18 {0.560 0.000 0.000 srgb} bind def -/col19 {0.690 0.000 0.000 srgb} bind def -/col20 {0.820 0.000 0.000 srgb} bind def -/col21 {0.560 0.000 0.560 srgb} bind def -/col22 {0.690 0.000 0.690 srgb} bind def -/col23 {0.820 0.000 0.820 srgb} bind def -/col24 {0.500 0.190 0.000 srgb} bind def -/col25 {0.630 0.250 0.000 srgb} bind def -/col26 {0.750 0.380 0.000 srgb} bind def -/col27 {1.000 0.500 0.500 srgb} bind def -/col28 {1.000 0.630 0.630 srgb} bind def -/col29 {1.000 0.750 0.750 srgb} bind def -/col30 {1.000 0.880 0.880 srgb} bind def -/col31 {1.000 0.840 0.000 srgb} bind def - -end -save --62.0 370.0 translate -1 -1 scale - -/clp {closepath} bind def -/ef {eofill} bind def -/gr {grestore} bind def -/gs {gsave} bind def -/l {lineto} bind def -/m {moveto} bind def -/n {newpath} bind def -/s {stroke} bind def -/slc {setlinecap} bind def -/slj {setlinejoin} bind def -/slw {setlinewidth} bind def -/srgb {setrgbcolor} bind def -/rot {rotate} bind def -/sc {scale} bind def -/tr {translate} bind def -/tnt {dup dup currentrgbcolor - 4 -2 roll dup 1 exch sub 3 -1 roll mul add - 4 -2 roll dup 1 exch sub 3 -1 roll mul add - 4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb} - bind def -/shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul - 4 -2 roll mul srgb} bind def -/$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def -/$F2psEnd {$F2psEnteredState restore end} def -%%EndProlog - -$F2psBegin -10 setmiterlimit - 0.06000 0.06000 sc -7.500 slw -% Polyline -n 1050 900 m 2100 900 l 2100 1425 l 1050 1425 l clp gs col-1 s gr -% Polyline -n 2925 900 m 3975 900 l 3975 1425 l 2925 1425 l clp gs col-1 s gr -% Polyline -n 5550 900 m 6750 900 l 6750 1350 l 5550 1350 l clp gs col-1 s gr -% Polyline -n 3750 1800 m 5025 1800 l 5025 2250 l 3750 2250 l clp gs col-1 s gr -% Polyline -n 1155 2100 m 1050 2100 1050 2520 105 arcto 4 {pop} repeat 1050 2625 2070 2625 105 arcto 4 {pop} repeat 2175 2625 2175 2205 105 arcto 4 {pop} repeat 2175 2100 1155 2100 105 arcto 4 {pop} repeat clp gs col-1 s gr -% Polyline -n 5550 3300 m 6675 3300 l 6675 3750 l 5550 3750 l clp gs col-1 s gr -% Polyline -n 5655 2100 m 5550 2100 5550 2520 105 arcto 4 {pop} repeat 5550 2625 6495 2625 105 arcto 4 {pop} repeat 6600 2625 6600 2205 105 arcto 4 {pop} repeat 6600 2100 5655 2100 105 arcto 4 {pop} repeat clp gs col-1 s gr -% Polyline -n 3750 3600 m 4875 3600 l 4875 4050 l 3750 4050 l clp gs col-1 s gr -% Polyline -n 3855 2700 m 3750 2700 3750 3045 105 arcto 4 {pop} repeat 3750 3150 4545 3150 105 arcto 4 {pop} repeat 4650 3150 4650 2805 105 arcto 4 {pop} repeat 4650 2700 3855 2700 105 arcto 4 {pop} repeat clp gs col-1 s gr -% Polyline -n 2850 5700 m 3750 5700 l 3750 6150 l 2850 6150 l clp gs col-1 s gr -% Polyline -n 3030 4800 m 2925 4800 2925 5145 105 arcto 4 {pop} repeat 2925 5250 3645 5250 105 arcto 4 {pop} repeat 3750 5250 3750 4905 105 arcto 4 {pop} repeat 3750 4800 3030 4800 105 arcto 4 {pop} repeat clp gs col-1 s gr -% Polyline -n 1500 1425 m 1500 2100 l gs col-1 s gr -n 1530.00 1980.00 m 1500.00 2100.00 l 1470.00 1980.00 l 1500.50 1980.50 l 1530.00 1980.00 l clp gs 0.00 setgray ef gr gs col-1 s gr -% Polyline -n 3300 1425 m 3300 4800 l gs col-1 s gr -n 3330.00 4680.00 m 3300.00 4800.00 l 3270.00 4680.00 l 3300.50 4680.50 l 3330.00 4680.00 l clp gs 0.00 setgray ef gr gs col-1 s gr -% Polyline -n 3300 1575 m 1875 1575 l 1875 2100 l gs col-1 s gr -n 1905.00 1980.00 m 1875.00 2100.00 l 1845.00 1980.00 l 1875.50 1980.50 l 1905.00 1980.00 l clp gs 0.00 setgray ef gr gs col-1 s gr -% Polyline -n 3300 1575 m 5700 1575 l 5700 2100 l gs col-1 s gr -n 5730.00 1980.00 m 5700.00 2100.00 l 5670.00 1980.00 l 5700.50 1980.50 l 5730.00 1980.00 l clp gs 0.00 setgray ef gr gs col-1 s gr -% Polyline -n 6225 1350 m 6225 2100 l gs col-1 s gr -n 6255.00 1980.00 m 6225.00 2100.00 l 6195.00 1980.00 l 6225.50 1980.50 l 6255.00 1980.00 l clp gs 0.00 setgray ef gr gs col-1 s gr -% Polyline -n 6075 2625 m 6075 3300 l gs col-1 s gr -n 6105.00 3180.00 m 6075.00 3300.00 l 6045.00 3180.00 l 6075.50 3180.50 l 6105.00 3180.00 l clp gs 0.00 setgray ef gr gs col-1 s gr -% Polyline -n 4200 2250 m 4200 2700 l gs col-1 s gr -n 4230.00 2580.00 m 4200.00 2700.00 l 4170.00 2580.00 l 4200.50 2580.50 l 4230.00 2580.00 l clp gs 0.00 setgray ef gr gs col-1 s gr -% Polyline -n 4200 3150 m 4200 3600 l gs col-1 s gr -n 4230.00 3480.00 m 4200.00 3600.00 l 4170.00 3480.00 l 4200.50 3480.50 l 4230.00 3480.00 l clp gs 0.00 setgray ef gr gs col-1 s gr -% Polyline -n 4200 4050 m 4200 4500 l 3675 4500 l 3675 4800 l gs col-1 s gr -n 3705.00 4680.00 m 3675.00 4800.00 l 3645.00 4680.00 l 3675.50 4680.50 l 3705.00 4680.00 l clp gs 0.00 setgray ef gr gs col-1 s gr -% Polyline -n 3375 5250 m 3375 5700 l gs col-1 s gr -n 3405.00 5580.00 m 3375.00 5700.00 l 3345.00 5580.00 l 3375.50 5580.50 l 3405.00 5580.00 l clp gs 0.00 setgray ef gr gs col-1 s gr -% Polyline -n 3300 2925 m 3750 2925 l gs col-1 s gr -n 3630.00 2895.00 m 3750.00 2925.00 l 3630.00 2955.00 l 3630.50 2925.50 l 3630.00 2895.00 l clp gs 0.00 setgray ef gr gs col-1 s gr -% Polyline -n 1500 2625 m 1500 3300 l gs col-1 s gr -n 1530.00 3180.00 m 1500.00 3300.00 l 1470.00 3180.00 l 1500.50 3180.50 l 1530.00 3180.00 l clp gs 0.00 setgray ef gr gs col-1 s gr -% Polyline -n 1050 3300 m 2100 3300 l 2100 3750 l 1050 3750 l clp gs col-1 s gr -% Polyline -n 4875 3825 m 5250 3825 l 5250 2400 l 5550 2400 l gs col-1 s gr -n 5430.00 2370.00 m 5550.00 2400.00 l 5430.00 2430.00 l 5430.50 2400.50 l 5430.00 2370.00 l clp gs 0.00 setgray ef gr gs col-1 s gr -/Times-Roman findfont 180.00 scalefont setfont -1200 1200 m -gs 1 -1 sc (acconfig.h) col-1 show gr -/Times-Roman findfont 180.00 scalefont setfont -3000 1200 m -gs 1 -1 sc (configure.in) col-1 show gr -/Times-Roman findfont 180.00 scalefont setfont -5700 1200 m -gs 1 -1 sc (Makefile.am) col-1 show gr -/Times-Roman findfont 180.00 scalefont setfont -3900 2100 m -gs 1 -1 sc (acinclude.m4) col-1 show gr -/Times-Roman findfont 180.00 scalefont setfont -1200 2400 m -gs 1 -1 sc (autoheader) col-1 show gr -/Times-Roman findfont 180.00 scalefont setfont -1200 3600 m -gs 1 -1 sc (config.in) col-1 show gr -/Times-Roman findfont 180.00 scalefont setfont -5700 3600 m -gs 1 -1 sc (Makefile.in) col-1 show gr -/Times-Roman findfont 180.00 scalefont setfont -5700 2400 m -gs 1 -1 sc (automake) col-1 show gr -/Times-Roman findfont 180.00 scalefont setfont -3900 3900 m -gs 1 -1 sc (aclocal.m4) col-1 show gr -/Times-Roman findfont 180.00 scalefont setfont -3900 3000 m -gs 1 -1 sc (aclocal) col-1 show gr -/Times-Roman findfont 180.00 scalefont setfont -3000 6000 m -gs 1 -1 sc (configure) col-1 show gr -/Times-Roman findfont 180.00 scalefont setfont -3000 5100 m -gs 1 -1 sc (autoconf) col-1 show gr -$F2psEnd -restore diff --git a/contrib/binutils/etc/configdev.fig b/contrib/binutils/etc/configdev.fig deleted file mode 100644 index 4d386ec4ff7a..000000000000 --- a/contrib/binutils/etc/configdev.fig +++ /dev/null @@ -1,80 +0,0 @@ -#FIG 3.1 -Portrait -Center -Inches -1200 2 -2 2 0 1 -1 7 0 0 -1 0.000 0 0 0 0 0 5 - 1050 900 2100 900 2100 1425 1050 1425 1050 900 -2 2 0 1 -1 7 0 0 -1 0.000 0 0 0 0 0 5 - 2925 900 3975 900 3975 1425 2925 1425 2925 900 -2 2 0 1 -1 7 0 0 -1 0.000 0 0 0 0 0 5 - 5550 900 6750 900 6750 1350 5550 1350 5550 900 -2 2 0 1 -1 7 0 0 -1 0.000 0 0 0 0 0 5 - 3750 1800 5025 1800 5025 2250 3750 2250 3750 1800 -2 4 0 1 -1 7 0 0 -1 0.000 0 0 7 0 0 5 - 2175 2625 2175 2100 1050 2100 1050 2625 2175 2625 -2 2 0 1 -1 7 0 0 -1 0.000 0 0 0 0 0 5 - 5550 3300 6675 3300 6675 3750 5550 3750 5550 3300 -2 4 0 1 -1 7 0 0 -1 0.000 0 0 7 0 0 5 - 6600 2625 6600 2100 5550 2100 5550 2625 6600 2625 -2 2 0 1 -1 7 0 0 -1 0.000 0 0 0 0 0 5 - 3750 3600 4875 3600 4875 4050 3750 4050 3750 3600 -2 4 0 1 -1 7 0 0 -1 0.000 0 0 7 0 0 5 - 4650 3150 4650 2700 3750 2700 3750 3150 4650 3150 -2 2 0 1 -1 7 0 0 -1 0.000 0 0 0 0 0 5 - 2850 5700 3750 5700 3750 6150 2850 6150 2850 5700 -2 4 0 1 -1 7 0 0 -1 0.000 0 0 7 0 0 5 - 3750 5250 3750 4800 2925 4800 2925 5250 3750 5250 -2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 1500 1425 1500 2100 -2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 3300 1425 3300 4800 -2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 3 - 1 1 1.00 60.00 120.00 - 3300 1575 1875 1575 1875 2100 -2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 3 - 1 1 1.00 60.00 120.00 - 3300 1575 5700 1575 5700 2100 -2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 6225 1350 6225 2100 -2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 6075 2625 6075 3300 -2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 4200 2250 4200 2700 -2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 4200 3150 4200 3600 -2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 4 - 1 1 1.00 60.00 120.00 - 4200 4050 4200 4500 3675 4500 3675 4800 -2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 3375 5250 3375 5700 -2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 3300 2925 3750 2925 -2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 1500 2625 1500 3300 -2 2 0 1 -1 7 0 0 -1 0.000 0 0 0 0 0 5 - 1050 3300 2100 3300 2100 3750 1050 3750 1050 3300 -2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 4 - 1 1 1.00 60.00 120.00 - 4875 3825 5250 3825 5250 2400 5550 2400 -4 0 -1 0 0 0 12 0.0000000 4 180 780 1200 1200 acconfig.h\001 -4 0 -1 0 0 0 12 0.0000000 4 180 885 3000 1200 configure.in\001 -4 0 -1 0 0 0 12 0.0000000 4 135 945 5700 1200 Makefile.am\001 -4 0 -1 0 0 0 12 0.0000000 4 135 990 3900 2100 acinclude.m4\001 -4 0 -1 0 0 0 12 0.0000000 4 135 840 1200 2400 autoheader\001 -4 0 -1 0 0 0 12 0.0000000 4 180 645 1200 3600 config.in\001 -4 0 -1 0 0 0 12 0.0000000 4 135 855 5700 3600 Makefile.in\001 -4 0 -1 0 0 0 12 0.0000000 4 135 735 5700 2400 automake\001 -4 0 -1 0 0 0 12 0.0000000 4 135 810 3900 3900 aclocal.m4\001 -4 0 -1 0 0 0 12 0.0000000 4 135 540 3900 3000 aclocal\001 -4 0 -1 0 0 0 12 0.0000000 4 180 705 3000 6000 configure\001 -4 0 -1 0 0 0 12 0.0000000 4 135 660 3000 5100 autoconf\001 diff --git a/contrib/binutils/etc/configdev.jin b/contrib/binutils/etc/configdev.jin Binary files differdeleted file mode 100644 index 9b11a71acd7d..000000000000 --- a/contrib/binutils/etc/configdev.jin +++ /dev/null diff --git a/contrib/binutils/etc/configdev.tin b/contrib/binutils/etc/configdev.tin deleted file mode 100644 index c9b6f34f4d79..000000000000 --- a/contrib/binutils/etc/configdev.tin +++ /dev/null @@ -1,17 +0,0 @@ - acconfig.h configure.in Makefile.am - | | | - | --------------+---------------------- | - | | | | | - v v | acinclude.m4 | | - *autoheader* | | v v - | | v --->*automake* - v |--->*aclocal* | | - config.in | | | v - | v | Makefile.in - | aclocal.m4--- - | | - v v - *autoconf* - | - v - configure diff --git a/contrib/binutils/etc/configure b/contrib/binutils/etc/configure deleted file mode 100755 index 101fcefecfcc..000000000000 --- a/contrib/binutils/etc/configure +++ /dev/null @@ -1,862 +0,0 @@ -#! /bin/sh - -# Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.12.1 -# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. -# -# This configure script is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. - -# Defaults: -ac_help= -ac_default_prefix=/usr/local -# Any additions from configure.in: - -# Initialize some variables set by options. -# The variables have the same names as the options, with -# dashes changed to underlines. -build=NONE -cache_file=./config.cache -exec_prefix=NONE -host=NONE -no_create= -nonopt=NONE -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -srcdir= -target=NONE -verbose= -x_includes=NONE -x_libraries=NONE -bindir='${exec_prefix}/bin' -sbindir='${exec_prefix}/sbin' -libexecdir='${exec_prefix}/libexec' -datadir='${prefix}/share' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -libdir='${exec_prefix}/lib' -includedir='${prefix}/include' -oldincludedir='/usr/include' -infodir='${prefix}/info' -mandir='${prefix}/man' - -# Initialize some other variables. -subdirs= -MFLAGS= MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} -# Maximum number of lines to put in a shell here document. -ac_max_here_lines=12 - -ac_prev= -for ac_option -do - - # If the previous option needs an argument, assign it. - if test -n "$ac_prev"; then - eval "$ac_prev=\$ac_option" - ac_prev= - continue - fi - - case "$ac_option" in - -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; - *) ac_optarg= ;; - esac - - # Accept the important Cygnus configure options, so we can diagnose typos. - - case "$ac_option" in - - -bindir | --bindir | --bindi | --bind | --bin | --bi) - ac_prev=bindir ;; - -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir="$ac_optarg" ;; - - -build | --build | --buil | --bui | --bu) - ac_prev=build ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build="$ac_optarg" ;; - - -cache-file | --cache-file | --cache-fil | --cache-fi \ - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) - ac_prev=cache_file ;; - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ - | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file="$ac_optarg" ;; - - -datadir | --datadir | --datadi | --datad | --data | --dat | --da) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ - | --da=*) - datadir="$ac_optarg" ;; - - -disable-* | --disable-*) - ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then - { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } - fi - ac_feature=`echo $ac_feature| sed 's/-/_/g'` - eval "enable_${ac_feature}=no" ;; - - -enable-* | --enable-*) - ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then - { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } - fi - ac_feature=`echo $ac_feature| sed 's/-/_/g'` - case "$ac_option" in - *=*) ;; - *) ac_optarg=yes ;; - esac - eval "enable_${ac_feature}='$ac_optarg'" ;; - - -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ - | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ - | --exec | --exe | --ex) - ac_prev=exec_prefix ;; - -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ - | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ - | --exec=* | --exe=* | --ex=*) - exec_prefix="$ac_optarg" ;; - - -gas | --gas | --ga | --g) - # Obsolete; use --with-gas. - with_gas=yes ;; - - -help | --help | --hel | --he) - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat << EOF -Usage: configure [options] [host] -Options: [defaults in brackets after descriptions] -Configuration: - --cache-file=FILE cache test results in FILE - --help print this message - --no-create do not create output files - --quiet, --silent do not print \`checking...' messages - --version print the version of autoconf that created configure -Directory and file names: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [same as prefix] - --bindir=DIR user executables in DIR [EPREFIX/bin] - --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] - --libexecdir=DIR program executables in DIR [EPREFIX/libexec] - --datadir=DIR read-only architecture-independent data in DIR - [PREFIX/share] - --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data in DIR - [PREFIX/com] - --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] - --libdir=DIR object code libraries in DIR [EPREFIX/lib] - --includedir=DIR C header files in DIR [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] - --infodir=DIR info documentation in DIR [PREFIX/info] - --mandir=DIR man documentation in DIR [PREFIX/man] - --srcdir=DIR find the sources in DIR [configure dir or ..] - --program-prefix=PREFIX prepend PREFIX to installed program names - --program-suffix=SUFFIX append SUFFIX to installed program names - --program-transform-name=PROGRAM - run sed PROGRAM on installed program names -EOF - cat << EOF -Host type: - --build=BUILD configure for building on BUILD [BUILD=HOST] - --host=HOST configure for HOST [guessed] - --target=TARGET configure for TARGET [TARGET=HOST] -Features and packages: - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --x-includes=DIR X include files are in DIR - --x-libraries=DIR X library files are in DIR -EOF - if test -n "$ac_help"; then - echo "--enable and --with options recognized:$ac_help" - fi - exit 0 ;; - - -host | --host | --hos | --ho) - ac_prev=host ;; - -host=* | --host=* | --hos=* | --ho=*) - host="$ac_optarg" ;; - - -includedir | --includedir | --includedi | --included | --include \ - | --includ | --inclu | --incl | --inc) - ac_prev=includedir ;; - -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ - | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir="$ac_optarg" ;; - - -infodir | --infodir | --infodi | --infod | --info | --inf) - ac_prev=infodir ;; - -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir="$ac_optarg" ;; - - -libdir | --libdir | --libdi | --libd) - ac_prev=libdir ;; - -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir="$ac_optarg" ;; - - -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ - | --libexe | --libex | --libe) - ac_prev=libexecdir ;; - -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ - | --libexe=* | --libex=* | --libe=*) - libexecdir="$ac_optarg" ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst \ - | --locals | --local | --loca | --loc | --lo) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* \ - | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) - localstatedir="$ac_optarg" ;; - - -mandir | --mandir | --mandi | --mand | --man | --ma | --m) - ac_prev=mandir ;; - -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir="$ac_optarg" ;; - - -nfp | --nfp | --nf) - # Obsolete; use --without-fp. - with_fp=no ;; - - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c) - no_create=yes ;; - - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) - no_recursion=yes ;; - - -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ - | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ - | --oldin | --oldi | --old | --ol | --o) - ac_prev=oldincludedir ;; - -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ - | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ - | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir="$ac_optarg" ;; - - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) - ac_prev=prefix ;; - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix="$ac_optarg" ;; - - -program-prefix | --program-prefix | --program-prefi | --program-pref \ - | --program-pre | --program-pr | --program-p) - ac_prev=program_prefix ;; - -program-prefix=* | --program-prefix=* | --program-prefi=* \ - | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix="$ac_optarg" ;; - - -program-suffix | --program-suffix | --program-suffi | --program-suff \ - | --program-suf | --program-su | --program-s) - ac_prev=program_suffix ;; - -program-suffix=* | --program-suffix=* | --program-suffi=* \ - | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix="$ac_optarg" ;; - - -program-transform-name | --program-transform-name \ - | --program-transform-nam | --program-transform-na \ - | --program-transform-n | --program-transform- \ - | --program-transform | --program-transfor \ - | --program-transfo | --program-transf \ - | --program-trans | --program-tran \ - | --progr-tra | --program-tr | --program-t) - ac_prev=program_transform_name ;; - -program-transform-name=* | --program-transform-name=* \ - | --program-transform-nam=* | --program-transform-na=* \ - | --program-transform-n=* | --program-transform-=* \ - | --program-transform=* | --program-transfor=* \ - | --program-transfo=* | --program-transf=* \ - | --program-trans=* | --program-tran=* \ - | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name="$ac_optarg" ;; - - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - silent=yes ;; - - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) - ac_prev=sbindir ;; - -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ - | --sbi=* | --sb=*) - sbindir="$ac_optarg" ;; - - -sharedstatedir | --sharedstatedir | --sharedstatedi \ - | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ - | --sharedst | --shareds | --shared | --share | --shar \ - | --sha | --sh) - ac_prev=sharedstatedir ;; - -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ - | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ - | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ - | --sha=* | --sh=*) - sharedstatedir="$ac_optarg" ;; - - -site | --site | --sit) - ac_prev=site ;; - -site=* | --site=* | --sit=*) - site="$ac_optarg" ;; - - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir="$ac_optarg" ;; - - -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ - | --syscon | --sysco | --sysc | --sys | --sy) - ac_prev=sysconfdir ;; - -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ - | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir="$ac_optarg" ;; - - -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target="$ac_optarg" ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 2.12.1" - exit 0 ;; - - -with-* | --with-*) - ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then - { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } - fi - ac_package=`echo $ac_package| sed 's/-/_/g'` - case "$ac_option" in - *=*) ;; - *) ac_optarg=yes ;; - esac - eval "with_${ac_package}='$ac_optarg'" ;; - - -without-* | --without-*) - ac_package=`echo $ac_option|sed -e 's/-*without-//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then - { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } - fi - ac_package=`echo $ac_package| sed 's/-/_/g'` - eval "with_${ac_package}=no" ;; - - --x) - # Obsolete; use --with-x. - with_x=yes ;; - - -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ - | --x-incl | --x-inc | --x-in | --x-i) - ac_prev=x_includes ;; - -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ - | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes="$ac_optarg" ;; - - -x-libraries | --x-libraries | --x-librarie | --x-librari \ - | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) - ac_prev=x_libraries ;; - -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ - | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries="$ac_optarg" ;; - - -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } - ;; - - *) - if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then - echo "configure: warning: $ac_option: invalid host type" 1>&2 - fi - if test "x$nonopt" != xNONE; then - { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } - fi - nonopt="$ac_option" - ;; - - esac -done - -if test -n "$ac_prev"; then - { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } -fi - -trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 - -# File descriptor usage: -# 0 standard input -# 1 file creation -# 2 errors and warnings -# 3 some systems may open it to /dev/tty -# 4 used on the Kubota Titan -# 6 checking for... messages and results -# 5 compiler messages saved in config.log -if test "$silent" = yes; then - exec 6>/dev/null -else - exec 6>&1 -fi -exec 5>./config.log - -echo "\ -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. -" 1>&5 - -# Strip out --no-create and --no-recursion so they do not pile up. -# Also quote any args containing shell metacharacters. -ac_configure_args= -for ac_arg -do - case "$ac_arg" in - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c) ;; - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) - ac_configure_args="$ac_configure_args '$ac_arg'" ;; - *) ac_configure_args="$ac_configure_args $ac_arg" ;; - esac -done - -# NLS nuisances. -# Only set these to C if already set. These must not be set unconditionally -# because not all systems understand e.g. LANG=C (notably SCO). -# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! -# Non-C LC_CTYPE values break the ctype check. -if test "${LANG+set}" = set; then LANG=C; export LANG; fi -if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi -if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi -if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi - -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -rf conftest* confdefs.h -# AIX cpp loses on an empty file, so make sure it contains at least a newline. -echo > confdefs.h - -# A filename unique to this package, relative to the directory that -# configure is in, which we can look for to find out if srcdir is correct. -ac_unique_file=Makefile.in - -# Find the source files, if location was not specified. -if test -z "$srcdir"; then - ac_srcdir_defaulted=yes - # Try the directory containing this script, then its parent. - ac_prog=$0 - ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` - test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. - srcdir=$ac_confdir - if test ! -r $srcdir/$ac_unique_file; then - srcdir=.. - fi -else - ac_srcdir_defaulted=no -fi -if test ! -r $srcdir/$ac_unique_file; then - if test "$ac_srcdir_defaulted" = yes; then - { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } - else - { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } - fi -fi -srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` - -# Prefer explicitly selected file to automatically selected ones. -if test -z "$CONFIG_SITE"; then - if test "x$prefix" != xNONE; then - CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" - else - CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" - fi -fi -for ac_site_file in $CONFIG_SITE; do - if test -r "$ac_site_file"; then - echo "loading site script $ac_site_file" - . "$ac_site_file" - fi -done - -if test -r "$cache_file"; then - echo "loading cache $cache_file" - . $cache_file -else - echo "creating cache $cache_file" - > $cache_file -fi - -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi - - - -ac_aux_dir= -for ac_dir in $srcdir $srcdir/.. $srcdir/../..; 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 $srcdir $srcdir/.. $srcdir/../.." 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. - -# Find a good install program. We prefer a C program (faster), -# so one script is as good as another. But avoid the broken or -# incompatible versions: -# SysV /etc/install, /usr/sbin/install -# SunOS /usr/etc/install -# IRIX /sbin/install -# AIX /bin/install -# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag -# AFS /usr/afsws/bin/install, which mishandles nonexistent args -# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" -# ./install, which can be erroneously created by make from ./install.sh. -echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:555: checking for a BSD compatible install" >&5 -if test -z "$INSTALL"; then -if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - # Account for people who put trailing slashes in PATH elements. - case "$ac_dir/" in - /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - # Don't use installbsd from OSF since it installs stuff as root - # by default. - for ac_prog in ginstall scoinst install; do - if test -f $ac_dir/$ac_prog; then - if test $ac_prog = install && - grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - : - else - ac_cv_path_install="$ac_dir/$ac_prog -c" - break 2 - fi - fi - done - ;; - esac - done - IFS="$ac_save_IFS" - -fi - if test "${ac_cv_path_install+set}" = set; then - INSTALL="$ac_cv_path_install" - else - # As a last resort, use the slow shell script. We don't cache a - # path for INSTALL within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the path is relative. - INSTALL="$ac_install_sh" - fi -fi -echo "$ac_t""$INSTALL" 1>&6 - -# Use test -z because SunOS4 sh mishandles braces in ${var-val}. -# It thinks the first close brace ends the variable substitution. -test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' - -test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' - - -trap '' 1 2 15 -cat > confcache <<\EOF -# This file is a shell script that caches the results of configure -# tests run on this system so they can be shared between configure -# scripts and configure runs. It is not useful on other systems. -# If it contains results you don't want to keep, you may remove or edit it. -# -# By default, configure uses ./config.cache as the cache file, -# creating it if it does not exist already. You can give configure -# the --cache-file=FILE option to use a different cache file; that is -# what configure does when it calls configure scripts in -# subdirectories, so they share the cache. -# Giving --cache-file=/dev/null disables caching, for debugging configure. -# config.status only pays attention to the cache file if you give it the -# --recheck option to rerun configure. -# -EOF -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, don't put newlines in cache variables' values. -# Ultrix sh set writes to stderr and can't be redirected directly, -# and sets the high bit in the cache file unless we assign to the vars. -(set) 2>&1 | - case `(ac_space=' '; set) 2>&1 | grep ac_space` in - *ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote substitution - # turns \\\\ into \\, and sed turns \\ into \). - sed -n \ - -e "s/'/'\\\\''/g" \ - -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" - ;; - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' - ;; - esac >> confcache -if cmp -s $cache_file confcache; then - : -else - if test -w $cache_file; then - echo "updating cache $cache_file" - cat confcache > $cache_file - else - echo "not updating unwritable cache $cache_file" - fi -fi -rm -f confcache - -trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 - -test "x$prefix" = xNONE && prefix=$ac_default_prefix -# Let make expand exec_prefix. -test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - -# Any assignment to VPATH causes Sun make to only execute -# the first set of double-colon rules, so remove it if not needed. -# If there is a colon in the path, we need to keep it. -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' -fi - -trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 - -# Transform confdefs.h into DEFS. -# Protect against shell expansion while executing Makefile rules. -# Protect against Makefile macro expansion. -cat > conftest.defs <<\EOF -s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g -s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g -s%\[%\\&%g -s%\]%\\&%g -s%\$%$$%g -EOF -DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` -rm -f conftest.defs - - -# Without the "./", some shells look in PATH for config.status. -: ${CONFIG_STATUS=./config.status} - -echo creating $CONFIG_STATUS -rm -f $CONFIG_STATUS -cat > $CONFIG_STATUS <<EOF -#! /bin/sh -# Generated automatically by configure. -# Run this file to recreate the current configuration. -# This directory was configured as follows, -# on host `(hostname || uname -n) 2>/dev/null | sed 1q`: -# -# $0 $ac_configure_args -# -# Compiler output produced by configure, useful for debugging -# configure, is in ./config.log if it exists. - -ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" -for ac_option -do - case "\$ac_option" in - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" - exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; - -version | --version | --versio | --versi | --vers | --ver | --ve | --v) - echo "$CONFIG_STATUS generated by autoconf version 2.12.1" - exit 0 ;; - -help | --help | --hel | --he | --h) - echo "\$ac_cs_usage"; exit 0 ;; - *) echo "\$ac_cs_usage"; exit 1 ;; - esac -done - -ac_given_srcdir=$srcdir -ac_given_INSTALL="$INSTALL" - -trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 -EOF -cat >> $CONFIG_STATUS <<EOF - -# Protect against being on the right side of a sed subst in config.status. -sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g; - s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF -$ac_vpsub -$extrasub -s%@SHELL@%$SHELL%g -s%@CFLAGS@%$CFLAGS%g -s%@CPPFLAGS@%$CPPFLAGS%g -s%@CXXFLAGS@%$CXXFLAGS%g -s%@DEFS@%$DEFS%g -s%@LDFLAGS@%$LDFLAGS%g -s%@LIBS@%$LIBS%g -s%@exec_prefix@%$exec_prefix%g -s%@prefix@%$prefix%g -s%@program_transform_name@%$program_transform_name%g -s%@bindir@%$bindir%g -s%@sbindir@%$sbindir%g -s%@libexecdir@%$libexecdir%g -s%@datadir@%$datadir%g -s%@sysconfdir@%$sysconfdir%g -s%@sharedstatedir@%$sharedstatedir%g -s%@localstatedir@%$localstatedir%g -s%@libdir@%$libdir%g -s%@includedir@%$includedir%g -s%@oldincludedir@%$oldincludedir%g -s%@infodir@%$infodir%g -s%@mandir@%$mandir%g -s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g -s%@INSTALL_DATA@%$INSTALL_DATA%g - -CEOF -EOF - -cat >> $CONFIG_STATUS <<\EOF - -# Split the substitutions into bite-sized pieces for seds with -# small command number limits, like on Digital OSF/1 and HP-UX. -ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. -ac_file=1 # Number of current file. -ac_beg=1 # First line for current file. -ac_end=$ac_max_sed_cmds # Line after last line for current file. -ac_more_lines=: -ac_sed_cmds="" -while $ac_more_lines; do - if test $ac_beg -gt 1; then - sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file - else - sed "${ac_end}q" conftest.subs > conftest.s$ac_file - fi - if test ! -s conftest.s$ac_file; then - ac_more_lines=false - rm -f conftest.s$ac_file - else - if test -z "$ac_sed_cmds"; then - ac_sed_cmds="sed -f conftest.s$ac_file" - else - ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" - fi - ac_file=`expr $ac_file + 1` - ac_beg=$ac_end - ac_end=`expr $ac_end + $ac_max_sed_cmds` - fi -done -if test -z "$ac_sed_cmds"; then - ac_sed_cmds=cat -fi -EOF - -cat >> $CONFIG_STATUS <<EOF - -CONFIG_FILES=\${CONFIG_FILES-"Makefile"} -EOF -cat >> $CONFIG_STATUS <<\EOF -for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case "$ac_file" in - *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` - ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; - *) ac_file_in="${ac_file}.in" ;; - esac - - # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. - - # Remove last slash and all that follows it. Not all systems have dirname. - ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` - if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then - # The file is in a subdirectory. - test ! -d "$ac_dir" && mkdir "$ac_dir" - ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" - # A "../" for each directory in $ac_dir_suffix. - ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` - else - ac_dir_suffix= ac_dots= - fi - - case "$ac_given_srcdir" in - .) srcdir=. - if test -z "$ac_dots"; then top_srcdir=. - else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; - /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; - *) # Relative path. - srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" - top_srcdir="$ac_dots$ac_given_srcdir" ;; - esac - - case "$ac_given_INSTALL" in - [/$]*) INSTALL="$ac_given_INSTALL" ;; - *) INSTALL="$ac_dots$ac_given_INSTALL" ;; - esac - - echo creating "$ac_file" - rm -f "$ac_file" - configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." - case "$ac_file" in - *Makefile*) ac_comsub="1i\\ -# $configure_input" ;; - *) ac_comsub= ;; - esac - - ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` - sed -e "$ac_comsub -s%@configure_input@%$configure_input%g -s%@srcdir@%$srcdir%g -s%@top_srcdir@%$top_srcdir%g -s%@INSTALL@%$INSTALL%g -" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file -fi; done -rm -f conftest.s* - -EOF -cat >> $CONFIG_STATUS <<EOF - -EOF -cat >> $CONFIG_STATUS <<\EOF - -exit 0 -EOF -chmod +x $CONFIG_STATUS -rm -fr confdefs* $ac_clean_files -test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 - diff --git a/contrib/binutils/etc/configure.in b/contrib/binutils/etc/configure.in deleted file mode 100644 index b785068009eb..000000000000 --- a/contrib/binutils/etc/configure.in +++ /dev/null @@ -1,7 +0,0 @@ -dnl Process this file with autoconf to produce a configure script. -AC_PREREQ(2.5) -AC_INIT(Makefile.in) - -AC_PROG_INSTALL - -AC_OUTPUT(Makefile) diff --git a/contrib/binutils/etc/configure.man b/contrib/binutils/etc/configure.man deleted file mode 100644 index a7699041a711..000000000000 --- a/contrib/binutils/etc/configure.man +++ /dev/null @@ -1,166 +0,0 @@ -.\" -*- nroff -*- -.\" Copyright (c) 1991, 1992, 1996 Cygnus Support -.\" written by K. Richard Pixley -.TH configure 1 "29 March 1996" "cygnus support" "Cygnus Support" -.de BP -.sp -.ti \-.2i -\(** -.. - -.SH NAME -configure \- prepare source code to be built - -.SH SYNOPSIS -configure HOST [--target=TARGET] [--srcdir=DIR] [--rm] - [--site=SITE] [--prefix=DIR] [--exec_prefix=DIR] - [--program_prefix=DIR] [--tmpdir=DIR] - [--with-PACKAGE[=YES/NO]] [--without-PACKAGE] - [--enable-FEATURE[=YES/NO]] [--disable-FEATURE] - [--norecursion] [--nfp] [-s] [-v] [-V | --version] [--help] - -.SH DESCRIPTION -.I configure -is a program used to prepare souce code to be built. It does this by -generating Makefiles and .gdbinit files, creating symlinks, recursing -in subdirectories, and some other miscellaneous file editing. - -.SH OPTIONS -.I configure -accepts the following options: - -.TP -.I \--target=TARGET -Requests that the sources be configured to target the -.I TARGET -machine. If no target is specified explicitly, the target is assumed -to be the same as the host. - -.TP -.I \--srcdir=DIR -tells configure to find the source in -.I DIR. -Object code is always built in the current directory, -.I `.'. - -.TP -.I \--rm -asks configure to remove a configuration rather than create one. - -.TP -.I \--site=SITE -asks configure to use any site-specific Makefile fragments for -.I SITE -when building Makefiles. - -.TP -.I \--prefix=DIR -sets the location in which to install files to -.I DIR. -The default is "/usr/local". - -.TP -.I \--exec_prefix=DIR -sets the root directory for host-dependent files to -.I DIR. -The default location is the value of -.I prefix. - -.TP -.I \--program_prefix=DIR -configures the source to install programs which have the same names as -common Unix programs, such as "make", in -.I DIR. -Also applies to programs which might be used for cross-compilation. - -.TP -.I \--tmpdir=DIR -sets the directory in which configure creates temporary files to -.I DIR. - -.TP -.I \--with-PACKAGE[=YES/NO] -sets a flag for the build to recognize that -.I PACKAGE -is explicitly present or not present. If -.I \=YES/NO -is nonexistent, the default is -.I YES. -.I \--without-PACKAGE -is equivalent to -.IR \--with-PACKAGE=no . - -.TP -.I \--enable-FEATURE[=YES/NO] -sets a flag for the build to recognize that -.I FEATURE -should be included or not included. If -.I \=YES/NO -is nonexistent, the default is -.I YES. -.I \--disable-FEATURE -is equivalent to -.IR --enable-FEATURE=no . - -.TP -.I \--norecursion -asks that only the current directory be configured. Normally -.I configure -recurs on subdirectories. - -.TP -.I \-nfp -Notifies -.I configure -that all of the specified hosts have -.I no floating point -units. - -.TP -.I \-s -used internally by configure to supress status messages on -subdirectory recursions. Override with -.I \-v - -.TP -.I \-v -verbose output. Asks that configure print status lines for each -directory configured. Normally, only the status lines for the current -directory are printed. - -.TP -.I \--version -.I \-V -prints -.I configure -version number. - -.TP -.I \-help -displays a brief usage summary. - - -.SH FILES -configure.in for each directory's individual needs -.br -Makefile.in Makefile template -.br -config.sub for parsing configuration names -.br -config.guess for guessing HOST when not specified -.br -config.status non-recursively rebuilds current directory - -.SH FILES -.ta \w'gmon.sum 'u -a.out the namelist and text space. -.br -gmon.out dynamic call graph and profile. -.br -gmon.sum summarized dynamic call graph and profile. - -.SH "SEE ALSO" -.RB "`\|" configure "\|'" -entry in -.B -info. diff --git a/contrib/binutils/etc/configure.texi b/contrib/binutils/etc/configure.texi deleted file mode 100644 index 91401671f925..000000000000 --- a/contrib/binutils/etc/configure.texi +++ /dev/null @@ -1,2644 +0,0 @@ -\input texinfo -@c %**start of header -@setfilename configure.info -@settitle The GNU configure and build system -@setchapternewpage off -@c %**end of header - -@dircategory GNU admin -@direntry -* configure: (configure). The GNU configure and build system -@end direntry - -@ifinfo -This file documents the GNU configure and build system. - -Copyright (C) 1998 Cygnus Solutions. - -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 - - -@end ignore -Permission is granted to copy and distribute modified versions of this -manual under the conditions for verbatim copying, provided 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, -except that this permission notice may be stated in a translation approved -by the Foundation. -@end ifinfo - -@titlepage -@title The GNU configure and build system -@author Ian Lance Taylor - -@page -@vskip 0pt plus 1filll -Copyright @copyright{} 1998 Cygnus Solutions - -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, provided 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, -except that this permission notice may be stated in a translation -approved by the Free Software Foundation. -@end titlepage - -@ifinfo -@node Top -@top GNU configure and build system - -The GNU configure and build system. - -@menu -* Introduction:: Introduction. -* Getting Started:: Getting Started. -* Files:: Files. -* Configuration Names:: Configuration Names. -* Cross Compilation Tools:: Cross Compilation Tools. -* Canadian Cross:: Canadian Cross. -* Cygnus Configure:: Cygnus Configure. -* Multilibs:: Multilibs. -* FAQ:: Frequently Asked Questions. -* Index:: Index. -@end menu - -@end ifinfo - -@node Introduction -@chapter Introduction - -This document describes the GNU configure and build systems. It -describes how autoconf, automake, libtool, and make fit together. It -also includes a discussion of the older Cygnus configure system. - -This document does not describe in detail how to use each of the tools; -see the respective manuals for that. Instead, it describes which files -the developer must write, which files are machine generated and how they -are generated, and where certain common problems should be addressed. - -@ifnothtml -This document draws on several sources, including the autoconf manual by -David MacKenzie (@pxref{Top, , autoconf overview, autoconf, Autoconf}), -the automake manual by David MacKenzie and Tom Tromey (@pxref{Top, , -automake overview, automake, GNU Automake}), the libtool manual by -Gordon Matzigkeit (@pxref{Top, , libtool overview, libtool, GNU -libtool}), and the Cygnus configure manual by K. Richard Pixley. -@end ifnothtml -@ifhtml -This document draws on several sources, including -@uref{http://www.delorie.com/gnu/docs/autoconf/autoconf_toc.html, the -autoconf manual} by David MacKenzie, -@uref{http://www.delorie.com/gnu/docs/automake/automake_toc.html, the -automake manual} by David MacKenzie and Tom Tromey, -@uref{http://www.delorie.com/gnu/docs/libtool/libtool_toc.html, the -libtool manual} by Gordon Matzigkeit, and the Cygnus configure manual by -K. Richard Pixley. -@end ifhtml - -@menu -* Goals:: Goals. -* Tools:: The tools. -* History:: History. -* Building:: Building. -@end menu - -@node Goals -@section Goals -@cindex goals - -The GNU configure and build system has two main goals. - -The first is to simplify the development of portable programs. The -system permits the developer to concentrate on writing the program, -simplifying many details of portability across Unix and even Windows -systems, and permitting the developer to describe how to build the -program using simple rules rather than complex Makefiles. - -The second is to simplify the building of programs distributed as source -code. All programs are built using a simple, standardized, two step -process. The program builder need not install any special tools in -order to build the program. - -@node Tools -@section Tools - -The GNU configure and build system is comprised of several different -tools. Program developers must build and install all of these tools. - -People who just want to build programs from distributed sources normally -do not need any special tools beyond a Unix shell, a make program, and a -C compiler. - -@table @asis -@item autoconf -provides a general portability framework, based on testing the features -of the host system at build time. -@item automake -a system for describing how to build a program, permitting the developer -to write a simplified @file{Makefile}. -@item libtool -a standardized approach to building shared libraries. -@item gettext -provides a framework for translation of text messages into other -languages; not really discussed in this document. -@item m4 -autoconf requires the GNU version of m4; the standard Unix m4 does not -suffice. -@item perl -automake requires perl. -@end table - -@node History -@section History -@cindex history - -This is a very brief and probably inaccurate history. - -As the number of Unix variants increased during the 1980s, it became -harder to write programs which could run on all variants. While it was -often possible to use @code{#ifdef} to identify particular systems, -developers frequently did not have access to every system, and the -characteristics of some systems changed from version to version. - -By 1992, at least three different approaches had been developed: -@itemize @bullet -@item -The Metaconfig program, by Larry Wall, Harlan Stenn, and Raphael -Manfredi. -@item -The Cygnus configure script, by K. Richard Pixley, and the gcc configure -script, by Richard Stallman. These use essentially the same approach, -and the developers communicated regularly. -@item -The autoconf program, by David MacKenzie. -@end itemize - -The Metaconfig program is still used for Perl and a few other programs. -It is part of the Dist package. I do not know if it is being developed. - -In 1994, David MacKenzie and others modified autoconf to incorporate all -the features of Cygnus configure. Since then, there has been a slow but -steady conversion of GNU programs from Cygnus configure to autoconf. gcc -has been converted, eliminating the gcc configure script. - -GNU autoconf was regularly maintained until late 1996. As of this -writing in June, 1998, it has no public maintainer. - -Most programs are built using the make program, which requires the -developer to write Makefiles describing how to build the programs. -Since most programs are built in pretty much the same way, this led to a -lot of duplication. - -The X Window system is built using the imake tool, which uses a database -of rules to eliminate the duplication. However, building a tool which -was developed using imake requires that the builder have imake -installed, violating one of the goals of the GNU system. - -The new BSD make provides a standard library of Makefile fragments, -which permits developers to write very simple Makefiles. However, this -requires that the builder install the new BSD make program. - -In 1994, David MacKenzie wrote the first version of automake, which -permitted writing a simple build description which was converted into a -Makefile which could be used by the standard make program. In 1995, Tom -Tromey completely rewrote automake in Perl, and he continues to enhance -it. - -Various free packages built libraries, and by around 1995 several -included support to build shared libraries on various platforms. -However, there was no consistent approach. In early 1996, Gordon -Matzigkeit began working on libtool, which provided a standardized -approach to building shared libraries. This was integrated into -automake from the start. - -The development of automake and libtool was driven by the GNITS project, -a group of GNU maintainers who designed standardized tools to help meet -the GNU coding standards. - -@node Building -@section Building - -Most readers of this document should already know how to build a tool by -running @samp{configure} and @samp{make}. This section may serve as a -quick introduction or reminder. - -Building a tool is normally as simple as running @samp{configure} -followed by @samp{make}. You should normally run @samp{configure} from -an empty directory, using some path to refer to the @samp{configure} -script in the source directory. The directory in which you run -@samp{configure} is called the @dfn{object directory}. - -In order to use a object directory which is different from the source -directory, you must be using the GNU version of @samp{make}, which has -the required @samp{VPATH} support. Despite this restriction, using a -different object directory is highly recommended: -@itemize @bullet -@item -It keeps the files generated during the build from cluttering up your -sources. -@item -It permits you to remove the built files by simply removing the entire -build directory. -@item -It permits you to build from the same sources with several sets of -configure options simultaneously. -@end itemize - -If you don't have GNU @samp{make}, you will have to run @samp{configure} -in the source directory. All GNU packages should support this; in -particular, GNU packages should not assume the presence of GNU -@samp{make}. - -After running @samp{configure}, you can build the tools by running -@samp{make}. - -To install the tools, run @samp{make install}. Installing the tools -will copy the programs and any required support files to the -@dfn{installation directory}. The location of the installation -directory is controlled by @samp{configure} options, as described below. - -In the Cygnus tree at present, the info files are built and installed as -a separate step. To build them, run @samp{make info}. To install them, -run @samp{make install-info}. - -All @samp{configure} scripts support a wide variety of options. The -most interesting ones are @samp{--with} and @samp{--enable} options -which are generally specific to particular tools. You can usually use -the @samp{--help} option to get a list of interesting options for a -particular configure script. - -The only generic options you are likely to use are the @samp{--prefix} -and @samp{--exec-prefix} options. These options are used to specify the -installation directory. - -The directory named by the @samp{--prefix} option will hold machine -independent files such as info files. - -The directory named by the @samp{--exec-prefix} option, which is -normally a subdirectory of the @samp{--prefix} directory, will hold -machine dependent files such as executables. - -The default for @samp{--prefix} is @file{/usr/local}. The default for -@samp{--exec-prefix} is the value used for @samp{--prefix}. - -The convention used in Cygnus releases is to use a @samp{--prefix} -option of @file{/usr/cygnus/@var{release}}, where @var{release} is the -name of the release, and to use a @samp{--exec-prefix} option of -@file{/usr/cygnus/@var{release}/H-@var{host}}, where @var{host} is the -configuration name of the host system (@pxref{Configuration Names}). - -Do not use either the source or the object directory as the installation -directory. That will just lead to confusion. - -@node Getting Started -@chapter Getting Started - -To start using the GNU configure and build system with your software -package, you must write three files, and you must run some tools to -manually generate additional files. - -@menu -* Write configure.in:: Write configure.in. -* Write Makefile.am:: Write Makefile.am. -* Write acconfig.h:: Write acconfig.h. -* Generate files:: Generate files. -* Getting Started Example:: Example. -@end menu - -@node Write configure.in -@section Write configure.in -@cindex @file{configure.in}, writing - -You must first write the file @file{configure.in}. This is an autoconf -input file, and the autoconf manual describes in detail what this file -should look like. - -You will write tests in your @file{configure.in} file to check for -conditions that may change from one system to another, such as the -presence of particular header files or functions. - -For example, not all systems support the @samp{gettimeofday} function. -If you want to use the @samp{gettimeofday} function when it is -available, and to use some other function when it is not, you would -check for this by putting @samp{AC_CHECK_FUNCS(gettimeofday)} in -@file{configure.in}. - -When the configure script is run at build time, this will arrange to -define the preprocessor macro @samp{HAVE_GETTIMEOFDAY} to the value 1 if -the @samp{gettimeofday} function is available, and to not define the -macro at all if the function is not available. Your code can then use -@samp{#ifdef} to test whether it is safe to call @samp{gettimeofday}. - -If you have an existing body of code, the @samp{autoscan} program may -help identify potential portability problems, and hence configure tests -that you will want to use. -@ifnothtml -@xref{Invoking autoscan, , , autoconf, the autoconf manual}. -@end ifnothtml -@ifhtml -See @uref{http://www.delorie.com/gnu/docs/autoconf/autoconf_4.html, the -autoscan documentation}. -@end ifhtml - -Another handy tool for an existing body of code is @samp{ifnames}. This -will show you all the preprocessor conditionals that the code already -uses. -@ifnothtml -@xref{Invoking ifnames, , , autoconf, the autoconf manual}. -@end ifnothtml -@ifhtml -See @uref{http://www.delorie.com/gnu/docs/autoconf/autoconf_5.html, the -ifnames documentation}. -@end ifhtml - -Besides the portability tests which are specific to your particular -package, every @file{configure.in} file should contain the following -macros. - -@table @samp -@item AC_INIT -@cindex @samp{AC_INIT} -This macro takes a single argument, which is the name of a file in your -package. For example, @samp{AC_INIT(foo.c)}. - -@item AC_PREREQ(@var{VERSION}) -@cindex @samp{AC_PREREQ} -This macro is optional. It may be used to indicate the version of -@samp{autoconf} that you are using. This will prevent users from -running an earlier version of @samp{autoconf} and perhaps getting an -invalid @file{configure} script. For example, @samp{AC_PREREQ(2.12)}. - -@item AM_INIT_AUTOMAKE -@cindex @samp{AM_INIT_AUTOMAKE} -This macro takes two arguments: the name of the package, and a version -number. For example, @samp{AM_INIT_AUTOMAKE(foo, 1.0)}. (This macro is -not needed if you are not using automake). - -@item AM_CONFIG_HEADER -@cindex @samp{AM_CONFIG_HEADER} -This macro names the header file which will hold the preprocessor macro -definitions at run time. Normally this should be @file{config.h}. Your -sources would then use @samp{#include "config.h"} to include it. - -This macro may optionally name the input file for that header file; by -default, this is @file{config.h.in}, but that file name works poorly on -DOS filesystems. Therefore, it is often better to name it explicitly as -@file{config.in}. - -This is what you should normally put in @file{configure.in}: -@example -AM_CONFIG_HEADER(config.h:config.in) -@end example - -@cindex @samp{AC_CONFIG_HEADER} -(If you are not using automake, use @samp{AC_CONFIG_HEADER} rather than -@samp{AM_CONFIG_HEADER}). - -@item AM_MAINTAINER_MODE -@cindex @samp{AM_MAINTAINER_MODE} -This macro always appears in Cygnus configure scripts. Other programs -may or may not use it. - -If this macro is used, the @samp{--enable-maintainer-mode} option is -required to enable automatic rebuilding of generated files used by the -configure system. This of course requires that developers be aware of, -and use, that option. - -If this macro is not used, then the generated files will always be -rebuilt automatically. This will cause problems if the wrong versions -of autoconf, automake, or others are in the builder's @samp{PATH}. - -(If you are not using automake, you do not need to use this macro). - -@item AC_EXEEXT -@cindex @samp{AC_EXEEXT} -@cindex @samp{AM_EXEEXT} -Either this macro or @samp{AM_EXEEXT} always appears in Cygnus configure -files. Other programs may or may not use one of them. - -This macro looks for the executable suffix used on the host system. On -Unix systems, this is the empty string. On Windows systems, this is -@samp{.exe}. This macro directs automake to use the executable suffix -as appropriate when creating programs. This macro does not take any -arguments. - -The @samp{AC_EXEEXT} form is new, and is part of a Cygnus patch to -autoconf to support compiling with Visual C++. Older programs use -@samp{AM_EXEEXT} instead. - -(Programs which do not use automake use neither @samp{AC_EXEEXT} nor -@samp{AM_EXEEXT}). - -@item AC_PROG_CC -@cindex @samp{AC_PROG_CC} -If you are writing C code, you will normally want to use this macro. It -locates the C compiler to use. It does not take any arguments. - -However, if this @file{configure.in} file is for a library which is to -be compiled by a cross compiler which may not fully work, then you will -not want to use @samp{AC_PROG_CC}. Instead, you will want to use a -variant which does not call the macro @samp{AC_PROG_CC_WORKS}. Examples -can be found in various @file{configure.in} files for libraries that are -compiled with cross compilers, such as libiberty or libgloss. This is -essentially a bug in autoconf, and there will probably be a better -workaround at some point. - -@item AC_PROG_CXX -@cindex @samp{AC_PROG_CXX} -If you are writing C++ code, you will want to use this macro. It -locates the C++ compiler to use. It does not take any arguments. The -same cross compiler comments apply as for @samp{AC_PROG_CC}. - -@item AM_PROG_LIBTOOL -@cindex @samp{AM_PROG_LIBTOOL} -If you want to build libraries, and you want to permit them to be -shared, or you want to link against libraries which were built using -libtool, then you will need this macro. This macro is required in order -to use libtool. - -@cindex @samp{AM_DISABLE_SHARED} -By default, this will cause all libraries to be built as shared -libraries. To prevent this--to change the default--use -@samp{AM_DISABLE_SHARED} before @samp{AM_PROG_LIBTOOL}. The configure -options @samp{--enable-shared} and @samp{--disable-shared} may be used -to override the default at build time. - -@item AC_DEFINE(_GNU_SOURCE) -@cindex @samp{_GNU_SOURCE} -GNU packages should normally include this line before any other feature -tests. This defines the macro @samp{_GNU_SOURCE} when compiling, which -directs the libc header files to provide the standard GNU system -interfaces including all GNU extensions. If this macro is not defined, -certain GNU extensions may not be available. - -@item AC_OUTPUT -@cindex @samp{AC_OUTPUT} -This macro takes a list of file names which the configure process should -produce. This is normally a list of one or more @file{Makefile} files -in different directories. If your package lives entirely in a single -directory, you would use simply @samp{AC_OUTPUT(Makefile)}. If you also -have, for example, a @file{lib} subdirectory, you would use -@samp{AC_OUTPUT(Makefile lib/Makefile)}. -@end table - -If you want to use locally defined macros in your @file{configure.in} -file, then you will need to write a @file{acinclude.m4} file which -defines them (if not using automake, this file is called -@file{aclocal.m4}). Alternatively, you can put separate macros in an -@file{m4} subdirectory, and put @samp{ACLOCAL_AMFLAGS = -I m4} in your -@file{Makefile.am} file so that the @samp{aclocal} program will be able -to find them. - -The different macro prefixes indicate which tool defines the macro. -Macros which start with @samp{AC_} are part of autoconf. Macros which -start with @samp{AM_} are provided by automake or libtool. - -@node Write Makefile.am -@section Write Makefile.am -@cindex @file{Makefile.am}, writing - -You must write the file @file{Makefile.am}. This is an automake input -file, and the automake manual describes in detail what this file should -look like. - -The automake commands in @file{Makefile.am} mostly look like variable -assignments in a @file{Makefile}. automake recognizes special variable -names, and automatically add make rules to the output as needed. - -There will be one @file{Makefile.am} file for each directory in your -package. For each directory with subdirectories, the @file{Makefile.am} -file should contain the line -@smallexample -SUBDIRS = @var{dir} @var{dir} @dots{} -@end smallexample -@noindent -where each @var{dir} is the name of a subdirectory. - -For each @file{Makefile.am}, there should be a corresponding -@file{Makefile} in the @samp{AC_OUTPUT} macro in @file{configure.in}. - -Every @file{Makefile.am} written at Cygnus should contain the line -@smallexample -AUTOMAKE_OPTIONS = cygnus -@end smallexample -@noindent -This puts automake into Cygnus mode. See the automake manual for -details. - -You may to include the version number of @samp{automake} that you are -using on the @samp{AUTOMAKE_OPTIONS} line. For example, -@smallexample -AUTOMAKE_OPTIONS = cygnus 1.3 -@end smallexample -@noindent -This will prevent users from running an earlier version of -@samp{automake} and perhaps getting an invalid @file{Makefile.in}. - -If your package builds a program, then in the directory where that -program is built you will normally want a line like -@smallexample -bin_PROGRAMS = @var{program} -@end smallexample -@noindent -where @var{program} is the name of the program. You will then want a -line like -@smallexample -@var{program}_SOURCES = @var{file} @var{file} @dots{} -@end smallexample -@noindent -where each @var{file} is the name of a source file to link into the -program (e.g., @samp{foo.c}). - -If your package builds a library, and you do not want the library to -ever be built as a shared library, then in the directory where that -library is built you will normally want a line like -@smallexample -lib_LIBRARIES = lib@var{name}.a -@end smallexample -@noindent -where @samp{lib@var{name}.a} is the name of the library. You will then -want a line like -@smallexample -lib@var{name}_a_SOURCES = @var{file} @var{file} @dots{} -@end smallexample -@noindent -where each @var{file} is the name of a source file to add to the -library. - -If your package builds a library, and you want to permit building the -library as a shared library, then in the directory where that library is -built you will normally want a line like -@smallexample -lib_LTLIBRARIES = lib@var{name}.la -@end smallexample -The use of @samp{LTLIBRARIES}, and the @samp{.la} extension, indicate a -library to be built using libtool. As usual, you will then want a line -like -@smallexample -lib@var{name}_la_SOURCES = @var{file} @var{file} @dots{} -@end smallexample - -The strings @samp{bin} and @samp{lib} that appear above in -@samp{bin_PROGRAMS} and @samp{lib_LIBRARIES} are not arbitrary. They -refer to particular directories, which may be set by the @samp{--bindir} -and @samp{--libdir} options to @file{configure}. If those options are -not used, the default values are based on the @samp{--prefix} or -@samp{--exec-prefix} options to @file{configure}. It is possible to use -other names if the program or library should be installed in some other -directory. - -The @file{Makefile.am} file may also contain almost anything that may -appear in a normal @file{Makefile}. automake also supports many other -special variables, as well as conditionals. - -See the automake manual for more information. - -@node Write acconfig.h -@section Write acconfig.h -@cindex @file{acconfig.h}, writing - -If you are generating a portability header file, (i.e., you are using -@samp{AM_CONFIG_HEADER} in @file{configure.in}), then you will have to -write a @file{acconfig.h} file. It will have to contain the following -lines. - -@smallexample -/* Name of package. */ -#undef PACKAGE - -/* Version of package. */ -#undef VERSION -@end smallexample - -This requirement is really a bug in the system, and the requirement may -be eliminated at some later date. - -The @file{acconfig.h} file will also similar comment and @samp{#undef} -lines for any unusual macros in the @file{configure.in} file, including -any macro which appears in a @samp{AC_DEFINE} macro. - -In particular, if you are writing a GNU package and therefore include -@samp{AC_DEFINE(_GNU_SOURCE)} in @file{configure.in} as suggested above, -you will need lines like this in @file{acconfig.h}: -@smallexample -/* Enable GNU extensions. */ -#undef _GNU_SOURCE -@end smallexample - -Normally the @samp{autoheader} program will inform you of any such -requirements by printing an error message when it is run. However, if -you do anything particular odd in your @file{configure.in} file, you -will have to make sure that the right entries appear in -@file{acconfig.h}, since otherwise the results of the tests may not be -available in the @file{config.h} file which your code will use. - -(Thee @samp{PACKAGE} and @samp{VERSION} lines are not required if you -are not using automake, and in that case you may not need a -@file{acconfig.h} file at all). - -@node Generate files -@section Generate files - -Once you have written @file{configure.in}, @file{Makefile.am}, -@file{acconfig.h}, and possibly @file{acinclude.m4}, you must use -autoconf and automake programs to produce the first versions of the -generated files. This is done by executing the following sequence of -commands. - -@smallexample -aclocal -autoconf -autoheader -automake -@end smallexample - -The @samp{aclocal} and @samp{automake} commands are part of the automake -package, and the @samp{autoconf} and @samp{autoheader} commands are part -of the autoconf package. - -If you are using a @file{m4} subdirectory for your macros, you will need -to use the @samp{-I m4} option when you run @samp{aclocal}. - -If you are not using the Cygnus tree, use the @samp{-a} option when -running @samp{automake} command in order to copy the required support -files into your source directory. - -If you are using libtool, you must build and install the libtool package -with the same @samp{--prefix} and @samp{--exec-prefix} options as you -used with the autoconf and automake packages. You must do this before -running any of the above commands. If you are not using the Cygnus -tree, you will need to run the @samp{libtoolize} program to copy the -libtool support files into your directory. - -Once you have managed to run these commands without getting any errors, -you should create a new empty directory, and run the @samp{configure} -script which will have been created by @samp{autoconf} with the -@samp{--enable-maintainer-mode} option. This will give you a set of -Makefiles which will include rules to automatically rebuild all the -generated files. - -After doing that, whenever you have changed some of the input files and -want to regenerated the other files, go to your object directory and run -@samp{make}. Doing this is more reliable than trying to rebuild the -files manually, because there are complex order dependencies and it is -easy to forget something. - -@node Getting Started Example -@section Example - -Let's consider a trivial example. - -Suppose we want to write a simple version of @samp{touch}. Our program, -which we will call @samp{poke}, will take a single file name argument, -and use the @samp{utime} system call to set the modification and access -times of the file to the current time. We want this program to be -highly portable. - -We'll first see what this looks like without using autoconf and -automake, and then see what it looks like with them. - -@menu -* Getting Started Example 1:: First Try. -* Getting Started Example 2:: Second Try. -* Getting Started Example 3:: Third Try. -* Generate Files in Example:: Generate Files. -@end menu - -@node Getting Started Example 1 -@subsection First Try - -Here is our first try at @samp{poke.c}. Note that we've written it -without ANSI/ISO C prototypes, since we want it to be highly portable. - -@example -#include <stdio.h> -#include <stdlib.h> -#include <sys/types.h> -#include <utime.h> - -int -main (argc, argv) - int argc; - char **argv; -@{ - if (argc != 2) - @{ - fprintf (stderr, "Usage: poke file\n"); - exit (1); - @} - - if (utime (argv[1], NULL) < 0) - @{ - perror ("utime"); - exit (1); - @} - - exit (0); -@} -@end example - -We also write a simple @file{Makefile}. - -@example -CC = gcc -CFLAGS = -g -O2 - -all: poke - -poke: poke.o - $(CC) -o poke $(CFLAGS) $(LDFLAGS) poke.o -@end example - -So far, so good. - -Unfortunately, there are a few problems. - -On older Unix systems derived from BSD 4.3, the @samp{utime} system call -does not accept a second argument of @samp{NULL}. On those systems, we -need to pass a pointer to @samp{struct utimbuf} structure. -Unfortunately, even older systems don't define that structure; on those -systems, we need to pass an array of two @samp{long} values. - -The header file @file{stdlib.h} was invented by ANSI C, and older -systems don't have a copy. We included it above to get a declaration of -@samp{exit}. - -We can find some of these portability problems by running -@samp{autoscan}, which will create a @file{configure.scan} file which we -can use as a prototype for our @file{configure.in} file. I won't show -the output, but it will notice the potential problems with @samp{utime} -and @file{stdlib.h}. - -In our @file{Makefile}, we don't provide any way to install the program. -This doesn't matter much for such a simple example, but a real program -will need an @samp{install} target. For that matter, we will also want -a @samp{clean} target. - -@node Getting Started Example 2 -@subsection Second Try - -Here is our second try at this program. - -We modify @file{poke.c} to use preprocessor macros to control what -features are available. (I've cheated a bit by using the same macro -names which autoconf will use). - -@example -#include <stdio.h> - -#ifdef STDC_HEADERS -#include <stdlib.h> -#endif - -#include <sys/types.h> - -#ifdef HAVE_UTIME_H -#include <utime.h> -#endif - -#ifndef HAVE_UTIME_NULL - -#include <time.h> - -#ifndef HAVE_STRUCT_UTIMBUF - -struct utimbuf -@{ - long actime; - long modtime; -@}; - -#endif - -static int -utime_now (file) - char *file; -@{ - struct utimbuf now; - - now.actime = now.modtime = time (NULL); - return utime (file, &now); -@} - -#define utime(f, p) utime_now (f) - -#endif /* HAVE_UTIME_NULL */ - -int -main (argc, argv) - int argc; - char **argv; -@{ - if (argc != 2) - @{ - fprintf (stderr, "Usage: poke file\n"); - exit (1); - @} - - if (utime (argv[1], NULL) < 0) - @{ - perror ("utime"); - exit (1); - @} - - exit (0); -@} -@end example - -Here is the associated @file{Makefile}. We've added support for the -preprocessor flags we use. We've also added @samp{install} and -@samp{clean} targets. - -@example -# Set this to your installation directory. -bindir = /usr/local/bin - -# Uncomment this if you have the standard ANSI/ISO C header files. -# STDC_HDRS = -DSTDC_HEADERS - -# Uncomment this if you have utime.h. -# UTIME_H = -DHAVE_UTIME_H - -# Uncomment this if utime (FILE, NULL) works on your system. -# UTIME_NULL = -DHAVE_UTIME_NULL - -# Uncomment this if struct utimbuf is defined in utime.h. -# UTIMBUF = -DHAVE_STRUCT_UTIMBUF - -CC = gcc -CFLAGS = -g -O2 - -ALL_CFLAGS = $(STDC_HDRS) $(UTIME_H) $(UTIME_NULL) $(UTIMBUF) $(CFLAGS) - -all: poke - -poke: poke.o - $(CC) -o poke $(ALL_CFLAGS) $(LDFLAGS) poke.o - -.c.o: - $(CC) -c $(ALL_CFLAGS) poke.c - -install: poke - cp poke $(bindir)/poke - -clean: - rm poke poke.o -@end example - -Some problems with this approach should be clear. - -Users who want to compile poke will have to know how @samp{utime} works -on their systems, so that they can uncomment the @file{Makefile} -correctly. - -The installation is done using @samp{cp}, but many systems have an -@samp{install} program which may be used, and which supports optional -features such as stripping debugging information out of the installed -binary. - -The use of @file{Makefile} variables like @samp{CC}, @samp{CFLAGS} and -@samp{LDFLAGS} follows the requirements of the GNU standards. This is -convenient for all packages, since it reduces surprises for users. -However, it is easy to get the details wrong, and wind up with a -slightly nonstandard distribution. - -@node Getting Started Example 3 -@subsection Third Try - -For our third try at this program, we will write a @file{configure.in} -script to discover the configuration features on the host system, rather -than requiring the user to edit the @file{Makefile}. We will also write -a @file{Makefile.am} rather than a @file{Makefile}. - -The only change to @file{poke.c} is to add a line at the start of the -file: -@smallexample -#include "config.h" -@end smallexample - -The new @file{configure.in} file is as follows. - -@example -AC_INIT(poke.c) -AM_INIT_AUTOMAKE(poke, 1.0) -AM_CONFIG_HEADER(config.h:config.in) -AC_PROG_CC -AC_HEADER_STDC -AC_CHECK_HEADERS(utime.h) -AC_EGREP_HEADER(utimbuf, utime.h, AC_DEFINE(HAVE_STRUCT_UTIMBUF)) -AC_FUNC_UTIME_NULL -AC_OUTPUT(Makefile) -@end example - -The first four macros in this file, and the last one, were described -above; see @ref{Write configure.in}. If we omit these macros, then when -we run @samp{automake} we will get a reminder that we need them. - -The other macros are standard autoconf macros. - -@table @samp -@item AC_HEADER_STDC -Check for standard C headers. -@item AC_CHECK_HEADERS -Check whether a particular header file exists. -@item AC_EGREP_HEADER -Check for a particular string in a particular header file, in this case -checking for @samp{utimbuf} in @file{utime.h}. -@item AC_FUNC_UTIME_NULL -Check whether @samp{utime} accepts a NULL second argument to set the -file change time to the current time. -@end table - -See the autoconf manual for a more complete description. - -The new @file{Makefile.am} file is as follows. Note how simple this is -compared to our earlier @file{Makefile}. - -@example -bin_PROGRAMS = poke - -poke_SOURCES = poke.c -@end example - -This means that we should build a single program name @samp{poke}. It -should be installed in the binary directory, which we called -@samp{bindir} earlier. The program @samp{poke} is built from the source -file @file{poke.c}. - -We must also write a @file{acconfig.h} file. Besides @samp{PACKAGE} and -@samp{VERSION}, which must be mentioned for all packages which use -automake, we must include @samp{HAVE_STRUCT_UTIMBUF}, since we mentioned -it in an @samp{AC_DEFINE}. - -@example -/* Name of package. */ -#undef PACKAGE - -/* Version of package. */ -#undef VERSION - -/* Whether utime.h defines struct utimbuf. */ -#undef HAVE_STRUCT_UTIMBUF -@end example - -@node Generate Files in Example -@subsection Generate Files - -We must now generate the other files, using the following commands. - -@smallexample -aclocal -autoconf -autoheader -automake -@end smallexample - -When we run @samp{autoheader}, it will remind us of any macros we forgot -to add to @file{acconfig.h}. - -When we run @samp{automake}, it will want to add some files to our -distribution. It will add them automatically if we use the -@samp{--add-missing} option. - -By default, @samp{automake} will run in GNU mode, which means that it -will want us to create certain additional files; as of this writing, it -will want @file{NEWS}, @file{README}, @file{AUTHORS}, and -@file{ChangeLog}, all of which are files which should appear in a -standard GNU distribution. We can either add those files, or run -@samp{automake} with the @samp{--foreign} option. - -Running these tools will generate the following files, all of which are -described in the next chapter. - -@itemize @bullet -@item -@file{aclocal.m4} -@item -@file{configure} -@item -@file{config.in} -@item -@file{Makefile.in} -@item -@file{stamp-h.in} -@end itemize - -@node Files -@chapter Files - -As was seen in the previous chapter, the GNU configure and build system -uses a number of different files. The developer must write a few files. -The others are generated by various tools. - -The system is rather flexible, and can be used in many different ways. -In describing the files that it uses, I will describe the common case, -and mention some other cases that may arise. - -@menu -* Developer Files:: Developer Files. -* Build Files:: Build Files. -* Support Files:: Support Files. -@end menu - -@node Developer Files -@section Developer Files - -This section describes the files written or generated by the developer -of a package. - -@menu -* Developer Files Picture:: Developer Files Picture. -* Written Developer Files:: Written Developer Files. -* Generated Developer Files:: Generated Developer Files. -@end menu - -@node Developer Files Picture -@subsection Developer Files Picture - -Here is a picture of the files which are written by the developer, the -generated files which would be included with a complete source -distribution, and the tools which create those files. -@ifinfo -The file names are plain text and the tool names are enclosed by -@samp{*} characters -@end ifinfo -@ifnotinfo -The file names are in rectangles with square corners and the tool names -are in rectangles with rounded corners -@end ifnotinfo -(e.g., @samp{autoheader} is the name of a tool, not the name of a file). - -@image{configdev} - -@node Written Developer Files -@subsection Written Developer Files - -The following files would be written by the developer. - -@table @file -@item configure.in -@cindex @file{configure.in} -This is the configuration script. This script contains invocations of -autoconf macros. It may also contain ordinary shell script code. This -file will contain feature tests for portability issues. The last thing -in the file will normally be an @samp{AC_OUTPUT} macro listing which -files to create when the builder runs the configure script. This file -is always required when using the GNU configure system. @xref{Write -configure.in}. - -@item Makefile.am -@cindex @file{Makefile.am} -This is the automake input file. It describes how the code should be -built. It consists of definitions of automake variables. It may also -contain ordinary Makefile targets. This file is only needed when using -automake (newer tools normally use automake, but there are still older -tools which have not been converted, in which the developer writes -@file{Makefile.in} directly). @xref{Write Makefile.am}. - -@item acconfig.h -@cindex @file{acconfig.h} -When the configure script creates a portability header file, by using -@samp{AM_CONFIG_HEADER} (or, if not using automake, -@samp{AC_CONFIG_HEADER}), this file is used to describe macros which are -not recognized by the @samp{autoheader} command. This is normally a -fairly uninteresting file, consisting of a collection of @samp{#undef} -lines with comments. Normally any call to @samp{AC_DEFINE} in -@file{configure.in} will require a line in this file. @xref{Write -acconfig.h}. - -@item acinclude.m4 -@cindex @file{acinclude.m4} -This file is not always required. It defines local autoconf macros. -These macros may then be used in @file{configure.in}. If you don't need -any local autoconf macros, then you don't need this file at all. In -fact, in general, you never need local autoconf macros, since you can -put everything in @file{configure.in}, but sometimes a local macro is -convenient. - -Newer tools may omit @file{acinclude.m4}, and instead use a -subdirectory, typically named @file{m4}, and define -@samp{ACLOCAL_AMFLAGS = -I m4} in @file{Makefile.am} to force -@samp{aclocal} to look there for macro definitions. The macro -definitions are then placed in separate files in that directory. - -The @file{acinclude.m4} file is only used when using automake; in older -tools, the developer writes @file{aclocal.m4} directly, if it is needed. -@end table - -@node Generated Developer Files -@subsection Generated Developer Files - -The following files would be generated by the developer. - -When using automake, these files are normally not generated manually -after the first time. Instead, the generated @file{Makefile} contains -rules to automatically rebuild the files as required. When -@samp{AM_MAINTAINER_MODE} is used in @file{configure.in} (the normal -case in Cygnus code), the automatic rebuilding rules will only be -defined if you configure using the @samp{--enable-maintainer-mode} -option. - -When using automatic rebuilding, it is important to ensure that all the -various tools have been built and installed on your @samp{PATH}. Using -automatic rebuilding is highly recommended, so much so that I'm not -going to explain what you have to do if you don't use it. - -@table @file -@item configure -@cindex @file{configure} -This is the configure script which will be run when building the -package. This is generated by @samp{autoconf} from @file{configure.in} -and @file{aclocal.m4}. This is a shell script. - -@item Makefile.in -@cindex @file{Makefile.in} -This is the file which the configure script will turn into the -@file{Makefile} at build time. This file is generated by -@samp{automake} from @file{Makefile.am}. If you aren't using automake, -you must write this file yourself. This file is pretty much a normal -@file{Makefile}, with some configure substitutions for certain -variables. - -@item aclocal.m4 -@cindex @file{aclocal.m4} -This file is created by the @samp{aclocal} program, based on the -contents of @file{configure.in} and @file{acinclude.m4} (or, as noted in -the description of @file{acinclude.m4} above, on the contents of an -@file{m4} subdirectory). This file contains definitions of autoconf -macros which @samp{autoconf} will use when generating the file -@file{configure}. These autoconf macros may be defined by you in -@file{acinclude.m4} or they may be defined by other packages such as -automake, libtool or gettext. If you aren't using automake, you will -normally write this file yourself; in that case, if @file{configure.in} -uses only standard autoconf macros, this file will not be needed at all. - -@item config.in -@cindex @file{config.in} -@cindex @file{config.h.in} -This file is created by @samp{autoheader} based on @file{acconfig.h} and -@file{configure.in}. At build time, the configure script will define -some of the macros in it to create @file{config.h}, which may then be -included by your program. This permits your C code to use preprocessor -conditionals to change its behaviour based on the characteristics of the -host system. This file may also be called @file{config.h.in}. - -@item stamp.h-in -@cindex @file{stamp-h.in} -This rather uninteresting file, which I omitted from the picture, is -generated by @samp{automake}. It always contains the string -@samp{timestamp}. It is used as a timestamp file indicating whether -@file{config.in} is up to date. Using a timestamp file means that -@file{config.in} can be marked as up to date without actually changing -its modification time. This is useful since @file{config.in} depends -upon @file{configure.in}, but it is easy to change @file{configure.in} -in a way which does not affect @file{config.in}. -@end table - -@node Build Files -@section Build Files - -This section describes the files which are created at configure and -build time. These are the files which somebody who builds the package -will see. - -Of course, the developer will also build the package. The distinction -between developer files and build files is not that the developer does -not see the build files, but that somebody who only builds the package -does not have to worry about the developer files. - -@menu -* Build Files Picture:: Build Files Picture. -* Build Files Description:: Build Files Description. -@end menu - -@node Build Files Picture -@subsection Build Files Picture - -Here is a picture of the files which will be created at build time. -@file{config.status} is both a created file and a shell script which is -run to create other files, and the picture attempts to show that. - -@image{configbuild} - -@node Build Files Description -@subsection Build Files Description - -This is a description of the files which are created at build time. - -@table @file -@item config.status -@cindex @file{config.status} -The first step in building a package is to run the @file{configure} -script. The @file{configure} script will create the file -@file{config.status}, which is itself a shell script. When you first -run @file{configure}, it will automatically run @file{config.status}. -An @file{Makefile} derived from an automake generated @file{Makefile.in} -will contain rules to automatically run @file{config.status} again when -necessary to recreate certain files if their inputs change. - -@item Makefile -@cindex @file{Makefile} -This is the file which make will read to build the program. The -@file{config.status} script will transform @file{Makefile.in} into -@file{Makefile}. - -@item config.h -@cindex @file{config.h} -This file defines C preprocessor macros which C code can use to adjust -its behaviour on different systems. The @file{config.status} script -will transform @file{config.in} into @file{config.h}. - -@item config.cache -@cindex @file{config.cache} -This file did not fit neatly into the picture, and I omitted it. It is -used by the @file{configure} script to cache results between runs. This -can be an important speedup. If you modify @file{configure.in} in such -a way that the results of old tests should change (perhaps you have -added a new library to @samp{LDFLAGS}), then you will have to remove -@file{config.cache} to force the tests to be rerun. - -The autoconf manual explains how to set up a site specific cache file. -This can speed up running @file{configure} scripts on your system. - -@item stamp.h -@cindex @file{stamp-h} -This file, which I omitted from the picture, is similar to -@file{stamp-h.in}. It is used as a timestamp file indicating whether -@file{config.h} is up to date. This is useful since @file{config.h} -depends upon @file{config.status}, but it is easy for -@file{config.status} to change in a way which does not affect -@file{config.h}. -@end table - -@node Support Files -@section Support Files - -The GNU configure and build system requires several support files to be -included with your distribution. You do not normally need to concern -yourself with these. If you are using the Cygnus tree, most are already -present. Otherwise, they will be installed with your source by -@samp{automake} (with the @samp{--add-missing} option) and -@samp{libtoolize}. - -You don't have to put the support files in the top level directory. You -can put them in a subdirectory, and use the @samp{AC_CONFIG_AUX_DIR} -macro in @file{configure.in} to tell @samp{automake} and the -@file{configure} script where they are. - -In this section, I describe the support files, so that you can know what -they are and why they are there. - -@table @file -@item ABOUT-NLS -Added by automake if you are using gettext. This is a documentation -file about the gettext project. -@item ansi2knr.c -Used by an automake generated @file{Makefile} if you put @samp{ansi2knr} -in @samp{AUTOMAKE_OPTIONS} in @file{Makefile.am}. This permits -compiling ANSI C code with a K&R C compiler. -@item ansi2knr.1 -The man page which goes with @file{ansi2knr.c}. -@item config.guess -A shell script which determines the configuration name for the system on -which it is run. -@item config.sub -A shell script which canonicalizes a configuration name entered by a -user. -@item elisp-comp -Used to compile Emacs LISP files. -@item install-sh -A shell script which installs a program. This is used if the configure -script can not find an install binary. -@item ltconfig -Used by libtool. This is a shell script which configures libtool for -the particular system on which it is used. -@item ltmain.sh -Used by libtool. This is the actual libtool script which is used, after -it is configured by @file{ltconfig} to build a library. -@item mdate-sh -A shell script used by an automake generated @file{Makefile} to pretty -print the modification time of a file. This is used to maintain version -numbers for texinfo files. -@item missing -A shell script used if some tool is missing entirely. This is used by -an automake generated @file{Makefile} to avoid certain sorts of -timestamp problems. -@item mkinstalldirs -A shell script which creates a directory, including all parent -directories. This is used by an automake generated @file{Makefile} -during installation. -@item texinfo.tex -Required if you have any texinfo files. This is used when converting -Texinfo files into DVI using @samp{texi2dvi} and @TeX{}. -@item ylwrap -A shell script used by an automake generated @file{Makefile} to run -programs like @samp{bison}, @samp{yacc}, @samp{flex}, and @samp{lex}. -These programs default to producing output files with a fixed name, and -the @file{ylwrap} script runs them in a subdirectory to avoid file name -conflicts when using a parallel make program. -@end table - -@node Configuration Names -@chapter Configuration Names -@cindex configuration names -@cindex configuration triplets -@cindex triplets -@cindex host names -@cindex host triplets -@cindex canonical system names -@cindex system names -@cindex system types - -The GNU configure system names all systems using a @dfn{configuration -name}. All such names used to be triplets (they may now contain four -parts in certain cases), and the term @dfn{configuration triplet} is -still seen. - -@menu -* Configuration Name Definition:: Configuration Name Definition. -* Using Configuration Names:: Using Configuration Names. -@end menu - -@node Configuration Name Definition -@section Configuration Name Definition - -This is a string of the form -@var{cpu}-@var{manufacturer}-@var{operating_system}. In some cases, -this is extended to a four part form: -@var{cpu}-@var{manufacturer}-@var{kernel}-@var{operating_system}. - -When using a configuration name in a configure option, it is normally -not necessary to specify an entire name. In particular, the -@var{manufacturer} field is often omitted, leading to strings such as -@samp{i386-linux} or @samp{sparc-sunos}. The shell script -@file{config.sub} will translate these shortened strings into the -canonical form. autoconf will arrange for @file{config.sub} to be run -automatically when it is needed. - -The fields of a configuration name are as follows: - -@table @var -@item cpu -The type of processor. This is typically something like @samp{i386} or -@samp{sparc}. More specific variants are used as well, such as -@samp{mipsel} to indicate a little endian MIPS processor. -@item manufacturer -A somewhat freeform field which indicates the manufacturer of the -system. This is often simply @samp{unknown}. Other common strings are -@samp{pc} for an IBM PC compatible system, or the name of a workstation -vendor, such as @samp{sun}. -@item operating_system -The name of the operating system which is run on the system. This will -be something like @samp{solaris2.5} or @samp{irix6.3}. There is no -particular restriction on the version number, and strings like -@samp{aix4.1.4.0} are seen. For an embedded system, which has no -operating system, this field normally indicates the type of object file -format, such as @samp{elf} or @samp{coff}. -@item kernel -This is used mainly for GNU/Linux. A typical GNU/Linux configuration -name is @samp{i586-pc-linux-gnulibc1}. In this case the kernel, -@samp{linux}, is separated from the operating system, @samp{gnulibc1}. -@end table - -The shell script @file{config.guess} will normally print the correct -configuration name for the system on which it is run. It does by -running @samp{uname} and by examining other characteristics of the -system. - -Because @file{config.guess} can normally determine the configuration -name for a machine, it is normally only necessary to specify a -configuration name when building a cross-compiler or when building using -a cross-compiler. - -@node Using Configuration Names -@section Using Configuration Names - -A configure script will sometimes have to make a decision based on a -configuration name. You will need to do this if you have to compile -code differently based on something which can not be tested using a -standard autoconf feature test. - -It is normally better to test for particular features, rather than to -test for a particular system. This is because as Unix evolves, -different systems copy features from one another. Even if you need to -determine whether the feature is supported based on a configuration -name, you should define a macro which describes the feature, rather than -defining a macro which describes the particular system you are on. - -Testing for a particular system is normally done using a case statement -in @file{configure.in}. The case statement might look something like -the following, assuming that @samp{host} is a shell variable holding a -canonical configuration name (which will be the case if -@file{configure.in} uses the @samp{AC_CANONICAL_HOST} or -@samp{AC_CANONICAL_SYSTEM} macro). - -@smallexample -case "$@{host@}" in -i[3456]86-*-linux-gnu*) do something ;; -sparc*-sun-solaris2.[56789]*) do something ;; -sparc*-sun-solaris*) do something ;; -mips*-*-elf*) do something ;; -esac -@end smallexample - -It is particularly important to use @samp{*} after the operating system -field, in order to match the version number which will be generated by -@file{config.guess}. - -In most cases you must be careful to match a range of processor types. -For most processor families, a trailing @samp{*} suffices, as in -@samp{mips*} above. For the i386 family, something along the lines of -@samp{i[3456]86} suffices at present. For the m68k family, you will -need something like @samp{m68*}. Of course, if you do not need to match -on the processor, it is simpler to just replace the entire field by a -@samp{*}, as in @samp{*-*-irix*}. - -@node Cross Compilation Tools -@chapter Cross Compilation Tools -@cindex cross tools - -The GNU configure and build system can be used to build @dfn{cross -compilation} tools. A cross compilation tool is a tool which runs on -one system and produces code which runs on another system. - -@menu -* Cross Compilation Concepts:: Cross Compilation Concepts. -* Host and Target:: Host and Target. -* Using the Host Type:: Using the Host Type. -* Specifying the Target:: Specifying the Target. -* Using the Target Type:: Using the Target Type. -* Cross Tools in the Cygnus Tree:: Cross Tools in the Cygnus Tree -@end menu - -@node Cross Compilation Concepts -@section Cross Compilation Concepts - -@cindex cross compiler -A compiler which produces programs which run on a different system is a -cross compilation compiler, or simply a @dfn{cross compiler}. -Similarly, we speak of cross assemblers, cross linkers, etc. - -In the normal case, a compiler produces code which runs on the same -system as the one on which the compiler runs. When it is necessary to -distinguish this case from the cross compilation case, such a compiler -is called a @dfn{native compiler}. Similarly, we speak of native -assemblers, etc. - -Although the debugger is not strictly speaking a compilation tool, it is -nevertheless meaningful to speak of a cross debugger: a debugger which -is used to debug code which runs on another system. Everything that is -said below about configuring cross compilation tools applies to the -debugger as well. - -@node Host and Target -@section Host and Target -@cindex host system -@cindex target system - -When building cross compilation tools, there are two different systems -involved: the system on which the tools will run, and the system for -which the tools generate code. - -The system on which the tools will run is called the @dfn{host} system. - -The system for which the tools generate code is called the @dfn{target} -system. - -For example, suppose you have a compiler which runs on a GNU/Linux -system and generates ELF programs for a MIPS embedded system. In this -case the GNU/Linux system is the host, and the MIPS ELF system is the -target. Such a compiler could be called a GNU/Linux cross MIPS ELF -compiler, or, equivalently, a @samp{i386-linux-gnu} cross -@samp{mips-elf} compiler. - -Naturally, most programs are not cross compilation tools. For those -programs, it does not make sense to speak of a target. It only makes -sense to speak of a target for tools like @samp{gcc} or the -@samp{binutils} which actually produce running code. For example, it -does not make sense to speak of the target of a tool like @samp{bison} -or @samp{make}. - -Most cross compilation tools can also serve as native tools. For a -native compilation tool, it is still meaningful to speak of a target. -For a native tool, the target is the same as the host. For example, for -a GNU/Linux native compiler, the host is GNU/Linux, and the target is -also GNU/Linux. - -@node Using the Host Type -@section Using the Host Type - -In almost all cases the host system is the system on which you run the -@samp{configure} script, and on which you build the tools (for the case -when they differ, @pxref{Canadian Cross}). - -@cindex @samp{AC_CANONICAL_HOST} -If your configure script needs to know the configuration name of the -host system, and the package is not a cross compilation tool and -therefore does not have a target, put @samp{AC_CANONICAL_HOST} in -@file{configure.in}. This macro will arrange to define a few shell -variables when the @samp{configure} script is run. - -@table @samp -@item host -The canonical configuration name of the host. This will normally be -determined by running the @file{config.guess} shell script, although the -user is permitted to override this by using an explicit @samp{--host} -option. -@item host_alias -In the unusual case that the user used an explicit @samp{--host} option, -this will be the argument to @samp{--host}. In the normal case, this -will be the same as the @samp{host} variable. -@item host_cpu -@itemx host_vendor -@itemx host_os -The first three parts of the canonical configuration name. -@end table - -The shell variables may be used by putting shell code in -@file{configure.in}. For an example, see @ref{Using Configuration -Names}. - -@node Specifying the Target -@section Specifying the Target - -By default, the @samp{configure} script will assume that the target is -the same as the host. This is the more common case; for example, it -leads to a native compiler rather than a cross compiler. - -@cindex @samp{--target} option -@cindex target option -@cindex configure target -If you want to build a cross compilation tool, you must specify the -target explicitly by using the @samp{--target} option when you run -@samp{configure}. The argument to @samp{--target} is the configuration -name of the system for which you wish to generate code. -@xref{Configuration Names}. - -For example, to build tools which generate code for a MIPS ELF embedded -system, you would use @samp{--target mips-elf}. - -@node Using the Target Type -@section Using the Target Type - -@cindex @samp{AC_CANONICAL_SYSTEM} -When writing @file{configure.in} for a cross compilation tool, you will -need to use information about the target. To do this, put -@samp{AC_CANONICAL_SYSTEM} in @file{configure.in}. - -@samp{AC_CANONICAL_SYSTEM} will look for a @samp{--target} option and -canonicalize it using the @file{config.sub} shell script. It will also -run @samp{AC_CANONICAL_HOST} (@pxref{Using the Host Type}). - -The target type will be recorded in the following shell variables. Note -that the host versions of these variables will also be defined by -@samp{AC_CANONICAL_HOST}. - -@table @samp -@item target -The canonical configuration name of the target. -@item target_alias -The argument to the @samp{--target} option. If the user did not specify -a @samp{--target} option, this will be the same as @samp{host_alias}. -@item target_cpu -@itemx target_vendor -@itemx target_os -The first three parts of the canonical target configuration name. -@end table - -Note that if @samp{host} and @samp{target} are the same string, you can -assume a native configuration. If they are different, you can assume a -cross configuration. - -It is arguably possible for @samp{host} and @samp{target} to represent -the same system, but for the strings to not be identical. For example, -if @samp{config.guess} returns @samp{sparc-sun-sunos4.1.4}, and somebody -configures with @samp{--target sparc-sun-sunos4.1}, then the slight -differences between the two versions of SunOS may be unimportant for -your tool. However, in the general case it can be quite difficult to -determine whether the differences between two configuration names are -significant or not. Therefore, by convention, if the user specifies a -@samp{--target} option without specifying a @samp{--host} option, it is -assumed that the user wants to configure a cross compilation tool. - -The variables @samp{target} and @samp{target_alias} should be handled -differently. - -In general, whenever the user may actually see a string, -@samp{target_alias} should be used. This includes anything which may -appear in the file system, such as a directory name or part of a tool -name. It also includes any tool output, unless it is clearly labelled -as the canonical target configuration name. This permits the user to -use the @samp{--target} option to specify how the tool will appear to -the outside world. - -On the other hand, when checking for characteristics of the target -system, @samp{target} should be used. This is because a wide variety of -@samp{--target} options may map into the same canonical configuration -name. You should not attempt to duplicate the canonicalization done by -@samp{config.sub} in your own code. - -By convention, cross tools are installed with a prefix of the argument -used with the @samp{--target} option, also known as @samp{target_alias} -(@pxref{Using the Target Type}). If the user does not use the -@samp{--target} option, and thus is building a native tool, no prefix is -used. - -For example, if gcc is configured with @samp{--target mips-elf}, then -the installed binary will be named @samp{mips-elf-gcc}. If gcc is -configured without a @samp{--target} option, then the installed binary -will be named @samp{gcc}. - -The autoconf macro @samp{AC_ARG_PROGRAM} will handle this for you. If -you are using automake, no more need be done; the programs will -automatically be installed with the correct prefixes. Otherwise, see -the autoconf documentation for @samp{AC_ARG_PROGRAM}. - -@node Cross Tools in the Cygnus Tree -@section Cross Tools in the Cygnus Tree - -The Cygnus tree is used for various packages including gdb, the GNU -binutils, and egcs. It is also, of course, used for Cygnus releases. - -In the Cygnus tree, the top level @file{configure} script uses the old -Cygnus configure system, not autoconf. The top level @file{Makefile.in} -is written to build packages based on what is in the source tree, and -supports building a large number of tools in a single -@samp{configure}/@samp{make} step. - -The Cygnus tree may be configured with a @samp{--target} option. The -@samp{--target} option applies recursively to every subdirectory, and -permits building an entire set of cross tools at once. - -@menu -* Host and Target Libraries:: Host and Target Libraries. -* Target Library Configure Scripts:: Target Library Configure Scripts. -* Make Targets in Cygnus Tree:: Make Targets in Cygnus Tree. -* Target libiberty:: Target libiberty -@end menu - -@node Host and Target Libraries -@subsection Host and Target Libraries - -The Cygnus tree distinguishes host libraries from target libraries. - -Host libraries are built with the compiler used to build the programs -which run on the host, which is called the host compiler. This includes -libraries such as @samp{bfd} and @samp{tcl}. These libraries are built -with the host compiler, and are linked into programs like the binutils -or gcc which run on the host. - -Target libraries are built with the target compiler. If gcc is present -in the source tree, then the target compiler is the gcc that is built -using the host compiler. Target libraries are libraries such as -@samp{newlib} and @samp{libstdc++}. These libraries are not linked into -the host programs, but are instead made available for use with programs -built with the target compiler. - -For the rest of this section, assume that gcc is present in the source -tree, so that it will be used to build the target libraries. - -There is a complication here. The configure process needs to know which -compiler you are going to use to build a tool; otherwise, the feature -tests will not work correctly. The Cygnus tree handles this by not -configuring the target libraries until the target compiler is built. In -order to permit everything to build using a single -@samp{configure}/@samp{make}, the configuration of the target libraries -is actually triggered during the make step. - -When the target libraries are configured, the @samp{--target} option is -not used. Instead, the @samp{--host} option is used with the argument -of the @samp{--target} option for the overall configuration. If no -@samp{--target} option was used for the overall configuration, the -@samp{--host} option will be passed with the output of the -@file{config.guess} shell script. Any @samp{--build} option is passed -down unchanged. - -This translation of configuration options is done because since the -target libraries are compiled with the target compiler, they are being -built in order to run on the target of the overall configuration. By -the definition of host, this means that their host system is the same as -the target system of the overall configuration. - -The same process is used for both a native configuration and a cross -configuration. Even when using a native configuration, the target -libraries will be configured and built using the newly built compiler. -This is particularly important for the C++ libraries, since there is no -reason to assume that the C++ compiler used to build the host tools (if -there even is one) uses the same ABI as the g++ compiler which will be -used to build the target libraries. - -There is one difference between a native configuration and a cross -configuration. In a native configuration, the target libraries are -normally configured and built as siblings of the host tools. In a cross -configuration, the target libraries are normally built in a subdirectory -whose name is the argument to @samp{--target}. This is mainly for -historical reasons. - -To summarize, running @samp{configure} in the Cygnus tree configures all -the host libraries and tools, but does not configure any of the target -libraries. Running @samp{make} then does the following steps: - -@itemize @bullet -@item -Build the host libraries. -@item -Build the host programs, including gcc. Note that we call gcc both a -host program (since it runs on the host) and a target compiler (since it -generates code for the target). -@item -Using the newly built target compiler, configure the target libraries. -@item -Build the target libraries. -@end itemize - -The steps need not be done in precisely this order, since they are -actually controlled by @file{Makefile} targets. - -@node Target Library Configure Scripts -@subsection Target Library Configure Scripts - -There are a few things you must know in order to write a configure -script for a target library. This is just a quick sketch, and beginners -shouldn't worry if they don't follow everything here. - -The target libraries are configured and built using a newly built target -compiler. There may not be any startup files or libraries for this -target compiler. In fact, those files will probably be built as part of -some target library, which naturally means that they will not exist when -your target library is configured. - -This means that the configure script for a target library may not use -any test which requires doing a link. This unfortunately includes many -useful autoconf macros, such as @samp{AC_CHECK_FUNCS}. autoconf macros -which do a compile but not a link, such as @samp{AC_CHECK_HEADERS}, may -be used. - -This is a severe restriction, but normally not a fatal one, as target -libraries can often assume the presence of other target libraries, and -thus know which functions will be available. - -As of this writing, the autoconf macro @samp{AC_PROG_CC} does a link to -make sure that the compiler works. This may fail in a target library, -so target libraries must use a different set of macros to locate the -compiler. See the @file{configure.in} file in a directory like -@file{libiberty} or @file{libgloss} for an example. - -As noted in the previous section, target libraries are sometimes built -in directories which are siblings to the host tools, and are sometimes -built in a subdirectory. The @samp{--with-target-subdir} configure -option will be passed when the library is configured. Its value will be -an empty string if the target library is a sibling. Its value will be -the name of the subdirectory if the target library is in a subdirectory. - -If the overall build is not a native build (i.e., the overall configure -used the @samp{--target} option), then the library will be configured -with the @samp{--with-cross-host} option. The value of this option will -be the host system of the overall build. Recall that the host system of -the library will be the target of the overall build. If the overall -build is a native build, the @samp{--with-cross-host} option will not be -used. - -A library which can be built both standalone and as a target library may -want to install itself into different directories depending upon the -case. When built standalone, or when built native, the library should -be installed in @samp{$(libdir)}. When built as a target library which -is not native, the library should be installed in @samp{$(tooldir)/lib}. -The @samp{--with-cross-host} option may be used to distinguish these -cases. - -This same test of @samp{--with-cross-host} may be used to see whether it -is OK to use link tests in the configure script. If the -@samp{--with-cross-host} option is not used, then the library is being -built either standalone or native, and a link should work. - -@node Make Targets in Cygnus Tree -@subsection Make Targets in Cygnus Tree - -The top level @file{Makefile} in the Cygnus tree defines targets for -every known subdirectory. - -For every subdirectory @var{dir} which holds a host library or program, -the @file{Makefile} target @samp{all-@var{dir}} will build that library -or program. - -There are dependencies among host tools. For example, building gcc -requires first building gas, because the gcc build process invokes the -target assembler. These dependencies are reflected in the top level -@file{Makefile}. - -For every subdirectory @var{dir} which holds a target library, the -@file{Makefile} target @samp{configure-target-@var{dir}} will configure -that library. The @file{Makefile} target @samp{all-target-@var{dir}} -will build that library. - -Every @samp{configure-target-@var{dir}} target depends upon -@samp{all-gcc}, since gcc, the target compiler, is required to configure -the tool. Every @samp{all-target-@var{dir}} target depends upon the -corresponding @samp{configure-target-@var{dir}} target. - -There are several other targets which may be of interest for each -directory: @samp{install-@var{dir}}, @samp{clean-@var{dir}}, and -@samp{check-@var{dir}}. There are also corresponding @samp{target} -versions of these for the target libraries , such as -@samp{install-target-@var{dir}}. - -@node Target libiberty -@subsection Target libiberty - -The @file{libiberty} subdirectory is currently a special case, in that -it is the only directory which is built both using the host compiler and -using the target compiler. - -This is because the files in @file{libiberty} are used when building the -host tools, and they are also incorporated into the @file{libstdc++} -target library as support code. - -This duality does not pose any particular difficulties. It means that -there are targets for both @samp{all-libiberty} and -@samp{all-target-libiberty}. - -In a native configuration, when target libraries are not built in a -subdirectory, the same objects are normally used as both the host build -and the target build. This is normally OK, since libiberty contains -only C code, and in a native configuration the results of the host -compiler and the target compiler are normally interoperable. - -Irix 6 is again an exception here, since the SGI native compiler -defaults to using the @samp{O32} ABI, and gcc defaults to using the -@samp{N32} ABI. On Irix 6, the target libraries are built in a -subdirectory even for a native configuration, avoiding this problem. - -There are currently no other libraries built for both the host and the -target, but there is no conceptual problem with adding more. - -@node Canadian Cross -@chapter Canadian Cross -@cindex canadian cross -@cindex building with a cross compiler -@cindex cross compiler, building with - -It is possible to use the GNU configure and build system to build a -program which will run on a system which is different from the system on -which the tools are built. In other words, it is possible to build -programs using a cross compiler. - -This is referred to as a @dfn{Canadian Cross}. - -@menu -* Canadian Cross Example:: Canadian Cross Example. -* Canadian Cross Concepts:: Canadian Cross Concepts. -* Build Cross Host Tools:: Build Cross Host Tools. -* Build and Host Options:: Build and Host Options. -* CCross not in Cygnus Tree:: Canadian Cross not in Cygnus Tree. -* CCross in Cygnus Tree:: Canadian Cross in Cygnus Tree. -* Supporting Canadian Cross:: Supporting Canadian Cross. -@end menu - -@node Canadian Cross Example -@section Canadian Cross Example - -Here is an example of a Canadian Cross. - -While running on a GNU/Linux, you can build a program which will run on -a Solaris system. You would use a GNU/Linux cross Solaris compiler to -build the program. - -Of course, you could not run the resulting program on your GNU/Linux -system. You would have to copy it over to a Solaris system before you -would run it. - -Of course, you could also simply build the programs on the Solaris -system in the first place. However, perhaps the Solaris system is not -available for some reason; perhaps you actually don't have one, but you -want to build the tools for somebody else to use. Or perhaps your -GNU/Linux system is much faster than your Solaris system. - -A Canadian Cross build is most frequently used when building programs to -run on a non-Unix system, such as DOS or Windows. It may be simpler to -configure and build on a Unix system than to support the configuration -machinery on a non-Unix system. - -@node Canadian Cross Concepts -@section Canadian Cross Concepts - -When building a Canadian Cross, there are at least two different systems -involved: the system on which the tools are being built, and the system -on which the tools will run. - -The system on which the tools are being built is called the @dfn{build} -system. - -The system on which the tools will run is called the host system. - -For example, if you are building a Solaris program on a GNU/Linux -system, as in the previous section, the build system would be GNU/Linux, -and the host system would be Solaris. - -It is, of course, possible to build a cross compiler using a Canadian -Cross (i.e., build a cross compiler using a cross compiler). In this -case, the system for which the resulting cross compiler generates code -is called the target system. (For a more complete discussion of host -and target systems, @pxref{Host and Target}). - -An example of building a cross compiler using a Canadian Cross would be -building a Windows cross MIPS ELF compiler on a GNU/Linux system. In -this case the build system would be GNU/Linux, the host system would be -Windows, and the target system would be MIPS ELF. - -The name Canadian Cross comes from the case when the build, host, and -target systems are all different. At the time that these issues were -all being hashed out, Canada had three national political parties. - -@node Build Cross Host Tools -@section Build Cross Host Tools - -In order to configure a program for a Canadian Cross build, you must -first build and install the set of cross tools you will use to build the -program. - -These tools will be build cross host tools. That is, they will run on -the build system, and will produce code that runs on the host system. - -It is easy to confuse the meaning of build and host here. Always -remember that the build system is where you are doing the build, and the -host system is where the resulting program will run. Therefore, you -need a build cross host compiler. - -In general, you must have a complete cross environment in order to do -the build. This normally means a cross compiler, cross assembler, and -so forth, as well as libraries and include files for the host system. - -@node Build and Host Options -@section Build and Host Options -@cindex configuring a canadian cross -@cindex canadian cross, configuring - -When you run @file{configure}, you must use both the @samp{--build} and -@samp{--host} options. - -@cindex @samp{--build} option -@cindex build option -@cindex configure build system -The @samp{--build} option is used to specify the configuration name of -the build system. This can normally be the result of running the -@file{config.guess} shell script, and it is reasonable to use -@samp{--build=`config.guess`}. - -@cindex @samp{--host} option -@cindex host option -@cindex configure host -The @samp{--host} option is used to specify the configuration name of -the host system. - -As we explained earlier, @file{config.guess} is used to set the default -value for the @samp{--host} option (@pxref{Using the Host Type}). We -can now see that since @file{config.guess} returns the type of system on -which it is run, it really identifies the build system. Since the host -system is normally the same as the build system (i.e., people do not -normally build using a cross compiler), it is reasonable to use the -result of @file{config.guess} as the default for the host system when -the @samp{--host} option is not used. - -It might seem that if the @samp{--host} option were used without the -@samp{--build} option that the configure script could run -@file{config.guess} to determine the build system, and presume a -Canadian Cross if the result of @file{config.guess} differed from the -@samp{--host} option. However, for historical reasons, some configure -scripts are routinely run using an explicit @samp{--host} option, rather -than using the default from @file{config.guess}. As noted earlier, it -is difficult or impossible to reliably compare configuration names -(@pxref{Using the Target Type}). Therefore, by convention, if the -@samp{--host} option is used, but the @samp{--build} option is not used, -then the build system defaults to the host system. - -@node CCross not in Cygnus Tree -@section Canadian Cross not in Cygnus Tree. - -If you are not using the Cygnus tree, you must explicitly specify the -cross tools which you want to use to build the program. This is done by -setting environment variables before running the @file{configure} -script. - -You must normally set at least the environment variables @samp{CC}, -@samp{AR}, and @samp{RANLIB} to the cross tools which you want to use to -build. - -For some programs, you must set additional cross tools as well, such as -@samp{AS}, @samp{LD}, or @samp{NM}. - -You would set these environment variables to the build cross tools which -you are going to use. - -For example, if you are building a Solaris program on a GNU/Linux -system, and your GNU/Linux cross Solaris compiler were named -@samp{solaris-gcc}, then you would set the environment variable -@samp{CC} to @samp{solaris-gcc}. - -@node CCross in Cygnus Tree -@section Canadian Cross in Cygnus Tree -@cindex canadian cross in cygnus tree - -This section describes configuring and building a Canadian Cross when -using the Cygnus tree. - -@menu -* Standard Cygnus CCross:: Building a Normal Program. -* Cross Cygnus CCross:: Building a Cross Program. -@end menu - -@node Standard Cygnus CCross -@subsection Building a Normal Program - -When configuring a Canadian Cross in the Cygnus tree, all the -appropriate environment variables are automatically set to -@samp{@var{host}-@var{tool}}, where @var{host} is the value used for the -@samp{--host} option, and @var{tool} is the name of the tool (e.g., -@samp{gcc}, @samp{as}, etc.). These tools must be on your @samp{PATH}. - -Adding a prefix of @var{host} will give the usual name for the build -cross host tools. To see this, consider that when these cross tools -were built, they were configured to run on the build system and to -produce code for the host system. That is, they were configured with a -@samp{--target} option that is the same as the system which we are now -calling the host. Recall that the default name for installed cross -tools uses the target system as a prefix (@pxref{Using the Target -Type}). Since that is the system which we are now calling the host, -@var{host} is the right prefix to use. - -For example, if you configure with @samp{--build=i386-linux-gnu} and -@samp{--host=solaris}, then the Cygnus tree will automatically default -to using the compiler @samp{solaris-gcc}. You must have previously -built and installed this compiler, probably by doing a build with no -@samp{--host} option and with a @samp{--target} option of -@samp{solaris}. - -@node Cross Cygnus CCross -@subsection Building a Cross Program - -There are additional considerations if you want to build a cross -compiler, rather than a native compiler, in the Cygnus tree using a -Canadian Cross. - -When you build a cross compiler using the Cygnus tree, then the target -libraries will normally be built with the newly built target compiler -(@pxref{Host and Target Libraries}). However, this will not work when -building with a Canadian Cross. This is because the newly built target -compiler will be a program which runs on the host system, and therefore -will not be able to run on the build system. - -Therefore, when building a cross compiler with the Cygnus tree, you must -first install a set of build cross target tools. These tools will be -used when building the target libraries. - -Note that this is not a requirement of a Canadian Cross in general. For -example, it would be possible to build just the host cross target tools -on the build system, to copy the tools to the host system, and to build -the target libraries on the host system. The requirement for build -cross target tools is imposed by the Cygnus tree, which expects to be -able to build both host programs and target libraries in a single -@samp{configure}/@samp{make} step. Because it builds these in a single -step, it expects to be able to build the target libraries on the build -system, which means that it must use a build cross target toolchain. - -For example, suppose you want to build a Windows cross MIPS ELF compiler -on a GNU/Linux system. You must have previously installed both a -GNU/Linux cross Windows compiler and a GNU/Linux cross MIPS ELF -compiler. - -In order to build the Windows (configuration name @samp{i386-cygwin32}) -cross MIPS ELF (configure name @samp{mips-elf}) compiler, you might -execute the following commands (long command lines are broken across -lines with a trailing backslash as a continuation character). - -@example -mkdir linux-x-cygwin32 -cd linux-x-cygwin32 -@var{srcdir}/configure --target i386-cygwin32 --prefix=@var{installdir} \ - --exec-prefix=@var{installdir}/H-i386-linux -make -make install -cd .. -mkdir linux-x-mips-elf -cd linux-x-mips-elf -@var{srcdir}/configure --target mips-elf --prefix=@var{installdir} \ - --exec-prefix=@var{installdir}/H-i386-linux -make -make install -cd .. -mkdir cygwin32-x-mips-elf -cd cygwin32-x-mips-elf -@var{srcdir}/configure --build=i386-linux-gnu --host=i386-cygwin32 \ - --target=mips-elf --prefix=@var{wininstalldir} \ - --exec-prefix=@var{wininstalldir}/H-i386-cygwin32 -make -make install -@end example - -You would then copy the contents of @var{wininstalldir} over to the -Windows machine, and run the resulting programs. - -@node Supporting Canadian Cross -@section Supporting Canadian Cross - -If you want to make it possible to build a program you are developing -using a Canadian Cross, you must take some care when writing your -configure and make rules. Simple cases will normally work correctly. -However, it is not hard to write configure and make tests which will -fail in a Canadian Cross. - -@menu -* CCross in Configure:: Supporting Canadian Cross in Configure Scripts. -* CCross in Make:: Supporting Canadian Cross in Makefiles. -@end menu - -@node CCross in Configure -@subsection Supporting Canadian Cross in Configure Scripts -@cindex canadian cross in configure - -In a @file{configure.in} file, after calling @samp{AC_PROG_CC}, you can -find out whether this is a Canadian Cross configure by examining the -shell variable @samp{cross_compiling}. In a Canadian Cross, which means -that the compiler is a cross compiler, @samp{cross_compiling} will be -@samp{yes}. In a normal configuration, @samp{cross_compiling} will be -@samp{no}. - -You ordinarily do not need to know the type of the build system in a -configure script. However, if you do need that information, you can get -it by using the macro @samp{AC_CANONICAL_SYSTEM}, the same macro that is -used to determine the target system. This macro will set the variables -@samp{build}, @samp{build_alias}, @samp{build_cpu}, @samp{build_vendor}, -and @samp{build_os}, which correspond to the similar @samp{target} and -@samp{host} variables, except that they describe the build system. - -When writing tests in @file{configure.in}, you must remember that you -want to test the host environment, not the build environment. - -Macros like @samp{AC_CHECK_FUNCS} which use the compiler will test the -host environment. That is because the tests will be done by running the -compiler, which is actually a build cross host compiler. If the -compiler can find the function, that means that the function is present -in the host environment. - -Tests like @samp{test -f /dev/ptyp0}, on the other hand, will test the -build environment. Remember that the configure script is running on the -build system, not the host system. If your configure scripts examines -files, those files will be on the build system. Whatever you determine -based on those files may or may not be the case on the host system. - -Most autoconf macros will work correctly for a Canadian Cross. The main -exception is @samp{AC_TRY_RUN}. This macro tries to compile and run a -test program. This will fail in a Canadian Cross, because the program -will be compiled for the host system, which means that it will not run -on the build system. - -The @samp{AC_TRY_RUN} macro provides an optional argument to tell the -configure script what to do in a Canadian Cross. If that argument is -not present, you will get a warning when you run @samp{autoconf}: -@smallexample -warning: AC_TRY_RUN called without default to allow cross compiling -@end smallexample -@noindent -This tells you that the resulting @file{configure} script will not work -with a Canadian Cross. - -In some cases while it may better to perform a test at configure time, -it is also possible to perform the test at run time. In such a case you -can use the cross compiling argument to @samp{AC_TRY_RUN} to tell your -program that the test could not be performed at configure time. - -There are a few other autoconf macros which will not work correctly with -a Canadian Cross: a partial list is @samp{AC_FUNC_GETPGRP}, -@samp{AC_FUNC_SETPGRP}, @samp{AC_FUNC_SETVBUF_REVERSED}, and -@samp{AC_SYS_RESTARTABLE_SYSCALLS}. The @samp{AC_CHECK_SIZEOF} macro is -generally not very useful with a Canadian Cross; it permits an optional -argument indicating the default size, but there is no way to know what -the correct default should be. - -@node CCross in Make -@subsection Supporting Canadian Cross in Makefiles. -@cindex canadian cross in makefile - -The main Canadian Cross issue in a @file{Makefile} arises when you want -to use a subsidiary program to generate code or data which you will then -include in your real program. - -If you compile this subsidiary program using @samp{$(CC)} in the usual -way, you will not be able to run it. This is because @samp{$(CC)} will -build a program for the host system, but the program is being built on -the build system. - -You must instead use a compiler for the build system, rather than the -host system. In the Cygnus tree, this make variable -@samp{$(CC_FOR_BUILD)} will hold a compiler for the build system. - -Note that you should not include @file{config.h} in a file you are -compiling with @samp{$(CC_FOR_BUILD)}. The @file{configure} script will -build @file{config.h} with information for the host system. However, -you are compiling the file using a compiler for the build system (a -native compiler). Subsidiary programs are normally simple filters which -do no user interaction, and it is normally possible to write them in a -highly portable fashion so that the absence of @file{config.h} is not -crucial. - -@cindex @samp{HOST_CC} -The gcc @file{Makefile.in} shows a complex situation in which certain -files, such as @file{rtl.c}, must be compiled into both subsidiary -programs run on the build system and into the final program. This -approach may be of interest for advanced build system hackers. Note -that the build system compiler is rather confusingly called -@samp{HOST_CC}. - -@node Cygnus Configure -@chapter Cygnus Configure -@cindex cygnus configure - -The Cygnus configure script predates autoconf. All of its interesting -features have been incorporated into autoconf. No new programs should -be written to use the Cygnus configure script. - -However, the Cygnus configure script is still used in a few places: at -the top of the Cygnus tree and in a few target libraries in the Cygnus -tree. Until those uses have been replaced with autoconf, some brief -notes are appropriate here. This is not complete documentation, but it -should be possible to use this as a guide while examining the scripts -themselves. - -@menu -* Cygnus Configure Basics:: Cygnus Configure Basics. -* Cygnus Configure in C++ Libraries:: Cygnus Configure in C++ Libraries. -@end menu - -@node Cygnus Configure Basics -@section Cygnus Configure Basics - -Cygnus configure does not use any generated files; there is no program -corresponding to @samp{autoconf}. Instead, there is a single shell -script named @samp{configure} which may be found at the top of the -Cygnus tree. This shell script was written by hand; it was not -generated by autoconf, and it is incorrect, and indeed harmful, to run -@samp{autoconf} in the top level of a Cygnus tree. - -Cygnus configure works in a particular directory by examining the file -@file{configure.in} in that directory. That file is broken into four -separate shell scripts. - -The first is the contents of @file{configure.in} up to a line that -starts with @samp{# per-host:}. This is the common part. - -The second is the rest of @file{configure.in} up to a line that starts -with @samp{# per-target:}. This is the per host part. - -The third is the rest of @file{configure.in} up to a line that starts -with @samp{# post-target:}. This is the per target part. - -The fourth is the remainder of @file{configure.in}. This is the post -target part. - -If any of these comment lines are missing, the corresponding shell -script is empty. - -Cygnus configure will first execute the common part. This must set the -shell variable @samp{srctrigger} to the name of a source file, to -confirm that Cygnus configure is looking at the right directory. This -may set the shell variables @samp{package_makefile_frag} and -@samp{package_makefile_rules_frag}. - -Cygnus configure will next set the @samp{build} and @samp{host} shell -variables, and execute the per host part. This may set the shell -variable @samp{host_makefile_frag}. - -Cygnus configure will next set the @samp{target} variable, and execute -the per target part. This may set the shell variable -@samp{target_makefile_frag}. - -Any of these scripts may set the @samp{subdirs} shell variable. This -variable is a list of subdirectories where a @file{Makefile.in} file may -be found. Cygnus configure will automatically look for a -@file{Makefile.in} file in the current directory. The @samp{subdirs} -shell variable is not normally used, and I believe that the only -directory which uses it at present is @file{newlib}. - -For each @file{Makefile.in}, Cygnus configure will automatically create -a @file{Makefile} by adding definitions for @samp{make} variables such -as @samp{host} and @samp{target}, and automatically editing the values -of @samp{make} variables such as @samp{prefix} if they are present. - -Also, if any of the @samp{makefile_frag} shell variables are set, Cygnus -configure will interpret them as file names relative to either the -working directory or the source directory, and will read the contents of -the file into the generated @file{Makefile}. The file contents will be -read in after the first line in @file{Makefile.in} which starts with -@samp{####}. - -These @file{Makefile} fragments are used to customize behaviour for a -particular host or target. They serve to select particular files to -compile, and to define particular preprocessor macros by providing -values for @samp{make} variables which are then used during compilation. -Cygnus configure, unlike autoconf, normally does not do feature tests, -and normally requires support to be added manually for each new host. - -The @file{Makefile} fragment support is similar to the autoconf -@samp{AC_SUBST_FILE} macro. - -After creating each @file{Makefile}, the post target script will be run -(i.e., it may be run several times). This script may further customize -the @file{Makefile}. When it is run, the shell variable @samp{Makefile} -will hold the name of the @file{Makefile}, including the appropriate -directory component. - -Like an autoconf generated @file{configure} script, Cygnus configure -will create a file named @file{config.status} which, when run, will -automatically recreate the configuration. The @file{config.status} file -will simply execute the Cygnus configure script again with the -appropriate arguments. - -Any of the parts of @file{configure.in} may set the shell variables -@samp{files} and @samp{links}. Cygnus configure will set up symlinks -from the names in @samp{links} to the files named in @samp{files}. This -is similar to the autoconf @samp{AC_LINK_FILES} macro. - -Finally, any of the parts of @file{configure.in} may set the shell -variable @samp{configdirs} to a set of subdirectories. If it is set, -Cygnus configure will recursively run the configure process in each -subdirectory. If the subdirectory uses Cygnus configure, it will -contain a @file{configure.in} file but no @file{configure} file, in -which case Cygnus configure will invoke itself recursively. If the -subdirectory has a @file{configure} file, Cygnus configure assumes that -it is an autoconf generated @file{configure} script, and simply invokes -it directly. - -@node Cygnus Configure in C++ Libraries -@section Cygnus Configure in C++ Libraries -@cindex @file{libstdc++} configure -@cindex @file{libio} configure -@cindex @file{libg++} configure - -The C++ library configure system, written by Per Bothner, deserves -special mention. It uses Cygnus configure, but it does feature testing -like that done by autoconf generated @file{configure} scripts. This -approach is used in the libraries @file{libio}, @file{libstdc++}, and -@file{libg++}. - -Most of the @file{Makefile} information is written out by the shell -script @file{libio/config.shared}. Each @file{configure.in} file sets -certain shell variables, and then invokes @file{config.shared} to create -two package @file{Makefile} fragments. These fragments are then -incorporated into the resulting @file{Makefile} by the Cygnus configure -script. - -The file @file{_G_config.h} is created in the @file{libio} object -directory by running the shell script @file{libio/gen-params}. This -shell script uses feature tests to define macros and typedefs in -@file{_G_config.h}. - -@node Multilibs -@chapter Multilibs -@cindex multilibs - -For some targets gcc may have different processor requirements depending -upon command line options. An obvious example is the -@samp{-msoft-float} option supported on several processors. This option -means that the floating point registers are not available, which means -that floating point operations must be done by calling an emulation -subroutine rather than by using machine instructions. - -For such options, gcc is often configured to compile target libraries -twice: once with @samp{-msoft-float} and once without. When gcc -compiles target libraries more than once, the resulting libraries are -called @dfn{multilibs}. - -Multilibs are not really part of the GNU configure and build system, but -we discuss them here since they require support in the @file{configure} -scripts and @file{Makefile}s used for target libraries. - -@menu -* Multilibs in gcc:: Multilibs in gcc. -* Multilibs in Target Libraries:: Multilibs in Target Libraries. -@end menu - -@node Multilibs in gcc -@section Multilibs in gcc - -In gcc, multilibs are defined by setting the variable -@samp{MULTILIB_OPTIONS} in the target @file{Makefile} fragment. Several -other @samp{MULTILIB} variables may also be defined there. @xref{Target -Fragment, , The Target Makefile Fragment, gcc, Using and Porting GNU -CC}. - -If you have built gcc, you can see what multilibs it uses by running it -with the @samp{-print-multi-lib} option. The output @samp{.;} means -that no multilibs are used. In general, the output is a sequence of -lines, one per multilib. The first part of each line, up to the -@samp{;}, is the name of the multilib directory. The second part is a -list of compiler options separated by @samp{@@} characters. - -Multilibs are built in a tree of directories. The top of the tree, -represented by @samp{.} in the list of multilib directories, is the -default library to use when no special compiler options are used. The -subdirectories of the tree hold versions of the library to use when -particular compiler options are used. - -@node Multilibs in Target Libraries -@section Multilibs in Target Libraries - -The target libraries in the Cygnus tree are automatically built with -multilibs. That means that each library is built multiple times. - -This default is set in the top level @file{configure.in} file, by adding -@samp{--enable-multilib} to the list of arguments passed to configure -when it is run for the target libraries (@pxref{Host and Target -Libraries}). - -Each target library uses the shell script @file{config-ml.in}, written -by Doug Evans, to prepare to build target libraries. This shell script -is invoked after the @file{Makefile} has been created by the -@file{configure} script. If multilibs are not enabled, it does nothing, -otherwise it modifies the @file{Makefile} to support multilibs. - -The @file{config-ml.in} script makes one copy of the @file{Makefile} for -each multilib in the appropriate subdirectory. When configuring in the -source directory (which is not recommended), it will build a symlink -tree of the sources in each subdirectory. - -The @file{config-ml.in} script sets several variables in the various -@file{Makefile}s. The @file{Makefile.in} must have definitions for -these variables already; @file{config-ml.in} simply changes the existing -values. The @file{Makefile} should use default values for these -variables which will do the right thing in the subdirectories. - -@table @samp -@item MULTISRCTOP -@file{config-ml.in} will set this to a sequence of @samp{../} strings, -where the number of strings is the number of multilib levels in the -source tree. The default value should be the empty string. -@item MULTIBUILDTOP -@file{config-ml.in} will set this to a sequence of @samp{../} strings, -where the number of strings is number of multilib levels in the object -directory. The default value should be the empty string. This will -differ from @samp{MULTISRCTOP} when configuring in the source tree -(which is not recommended). -@item MULTIDIRS -In the top level @file{Makefile} only, @file{config-ml.in} will set this -to the list of multilib subdirectories. The default value should be the -empty string. -@item MULTISUBDIR -@file{config-ml.in} will set this to the installed subdirectory name to -use for this subdirectory, with a leading @samp{/}. The default value -shold be the empty string. -@item MULTIDO -@itemx MULTICLEAN -In the top level @file{Makefile} only, @file{config-ml.in} will set -these variables to commands to use when doing a recursive make. These -variables should both default to the string @samp{true}, so that by -default nothing happens. -@end table - -All references to the parent of the source directory should use the -variable @samp{MULTISRCTOP}. Instead of writing @samp{$(srcdir)/..}, -you must write @samp{$(srcdir)/$(MULTISRCTOP)..}. - -Similarly, references to the parent of the object directory should use -the variable @samp{MULTIBUILDTOP}. - -In the installation target, the libraries should be installed in the -subdirectory @samp{MULTISUBDIR}. Instead of installing -@samp{$(libdir)/libfoo.a}, install -@samp{$(libdir)$(MULTISUBDIR)/libfoo.a}. - -The @file{config-ml.in} script also modifies the top level -@file{Makefile} to add @samp{multi-do} and @samp{multi-clean} targets -which are used when building multilibs. - -The default target of the @file{Makefile} should include the following -command: -@smallexample -@@$(MULTIDO) $(FLAGS_TO_PASS) DO=all multi-do -@end smallexample -@noindent -This assumes that @samp{$(FLAGS_TO_PASS)} is defined as a set of -variables to pass to a recursive invocation of @samp{make}. This will -build all the multilibs. Note that the default value of @samp{MULTIDO} -is @samp{true}, so by default this command will do nothing. It will -only do something in the top level @file{Makefile} if multilibs were -enabled. - -The @samp{install} target of the @file{Makefile} should include the -following command: -@smallexample -@@$(MULTIDO) $(FLAGS_TO_PASS) DO=install multi-do -@end smallexample - -In general, any operation, other than clean, which should be performed -on all the multilibs should use a @samp{$(MULTIDO)} line, setting the -variable @samp{DO} to the target of each recursive call to @samp{make}. - -The @samp{clean} targets (@samp{clean}, @samp{mostlyclean}, etc.) should -use @samp{$(MULTICLEAN)}. For example, the @samp{clean} target should -do this: -@smallexample -@@$(MULTICLEAN) DO=clean multi-clean -@end smallexample - -@node FAQ -@chapter Frequently Asked Questions - -@table @asis -@item Which do I run first, @samp{autoconf} or @samp{automake}? -Except when you first add autoconf or automake support to a package, you -shouldn't run either by hand. Instead, configure with the -@samp{--enable-maintainer-mode} option, and let @samp{make} take care of -it. - -@cindex undefined macros -@item @samp{autoconf} says something about undefined macros. -This means that you have macros in your @file{configure.in} which are -not defined by @samp{autoconf}. You may be using an old version of -@samp{autoconf}; try building and installing a newer one. Make sure the -newly installled @samp{autoconf} is first on your @samp{PATH}. Also, -see the next question. - -@cindex @samp{CY_GNU_GETTEXT} in @file{configure} -@cindex @samp{AM_PROG_LIBTOOL} in @file{configure} -@item My @file{configure} script has stuff like @samp{CY_GNU_GETTEXT} in it. -This means that you have macros in your @file{configure.in} which should -be defined in your @file{aclocal.m4} file, but aren't. This usually -means that @samp{aclocal} was not able to appropriate definitions of the -macros. Make sure that you have installed all the packages you need. -In particular, make sure that you have installed libtool (this is where -@samp{AM_PROG_LIBTOOL} is defined) and gettext (this is where -@samp{CY_GNU_GETTEXT} is defined, at least in the Cygnus version of -gettext). - -@cindex @file{Makefile}, garbage characters -@item My @file{Makefile} has @samp{@@} characters in it. -This may mean that you tried to use an autoconf substitution in your -@file{Makefile.in} without adding the appropriate @samp{AC_SUBST} call -to your @file{configure} script. Or it may just mean that you need to -rebuild @file{Makefile} in your build directory. To rebuild -@file{Makefile} from @file{Makefile.in}, run the shell script -@file{config.status} with no arguments. If you need to force -@file{configure} to run again, first run @samp{config.status --recheck}. -These runs are normally done automatically by @file{Makefile} targets, -but if your @file{Makefile} has gotten messed up you'll need to help -them along. - -@cindex @samp{config.status --recheck} -@item Why do I have to run both @samp{config.status --recheck} and @samp{config.status}? -Normally, you don't; they will be run automatically by @file{Makefile} -targets. If you do need to run them, use @samp{config.status --recheck} -to run the @file{configure} script again with the same arguments as the -first time you ran it. Use @samp{config.status} (with no arguments) to -regenerate all files (@file{Makefile}, @file{config.h}, etc.) based on -the results of the configure script. The two cases are separate because -it isn't always necessary to regenerate all the files after running -@samp{config.status --recheck}. The @file{Makefile} targets generated -by automake will use the environment variables @samp{CONFIG_FILES} and -@samp{CONFIG_HEADERS} to only regenerate files as they are needed. - -@item What is the Cygnus tree? -The Cygnus tree is used for various packages including gdb, the GNU -binutils, and egcs. It is also, of course, used for Cygnus releases. -It is the build system which was developed at Cygnus, using the Cygnus -configure script. It permits building many different packages with a -single configure and make. The configure scripts in the tree are being -converted to autoconf, but the general build structure remains intact. - -@item Why do I have to keep rebuilding and reinstalling the tools? -I know, it's a pain. Unfortunately, there are bugs in the tools -themselves which need to be fixed, and each time that happens everybody -who uses the tools need to reinstall new versions of them. I don't know -if there is going to be a clever fix until the tools stabilize. - -@item Why not just have a Cygnus tree @samp{make} target to update the tools? -The tools unfortunately need to be installed before they can be used. -That means that they must be built using an appropriate prefix, and it -seems unwise to assume that every configuration uses an appropriate -prefix. It might be possible to make them work in place, or it might be -possible to install them in some subdirectory; so far these approaches -have not been implemented. -@end table - -@node Index -@unnumbered Index - -@printindex cp - -@contents -@bye diff --git a/contrib/binutils/etc/make-stds.texi b/contrib/binutils/etc/make-stds.texi deleted file mode 100644 index 2149764b8e9c..000000000000 --- a/contrib/binutils/etc/make-stds.texi +++ /dev/null @@ -1,914 +0,0 @@ -@comment This file is included by both standards.texi and make.texinfo. -@comment It was broken out of standards.texi on 1/6/93 by roland. - -@node Makefile Conventions -@chapter Makefile Conventions -@comment standards.texi does not print an index, but make.texinfo does. -@cindex makefile, conventions for -@cindex conventions for makefiles -@cindex standards for makefiles - -This -@ifinfo -node -@end ifinfo -@iftex -@ifset CODESTD -section -@end ifset -@ifclear CODESTD -chapter -@end ifclear -@end iftex -describes conventions for writing the Makefiles for GNU programs. - -@menu -* Makefile Basics:: General Conventions for Makefiles -* Utilities in Makefiles:: Utilities in Makefiles -* Command Variables:: Variables for Specifying Commands -* Directory Variables:: Variables for Installation Directories -* Standard Targets:: Standard Targets for Users -* Install Command Categories:: Three categories of commands in the `install' - rule: normal, pre-install and post-install. -@end menu - -@node Makefile Basics -@section General Conventions for Makefiles - -Every Makefile should contain this line: - -@example -SHELL = /bin/sh -@end example - -@noindent -to avoid trouble on systems where the @code{SHELL} variable might be -inherited from the environment. (This is never a problem with GNU -@code{make}.) - -Different @code{make} programs have incompatible suffix lists and -implicit rules, and this sometimes creates confusion or misbehavior. So -it is a good idea to set the suffix list explicitly using only the -suffixes you need in the particular Makefile, like this: - -@example -.SUFFIXES: -.SUFFIXES: .c .o -@end example - -@noindent -The first line clears out the suffix list, the second introduces all -suffixes which may be subject to implicit rules in this Makefile. - -Don't assume that @file{.} is in the path for command execution. When -you need to run programs that are a part of your package during the -make, please make sure that it uses @file{./} if the program is built as -part of the make or @file{$(srcdir)/} if the file is an unchanging part -of the source code. Without one of these prefixes, the current search -path is used. - -The distinction between @file{./} (the @dfn{build directory}) and -@file{$(srcdir)/} (the @dfn{source directory}) is important because -users can build in a separate directory using the @samp{--srcdir} option -to @file{configure}. A rule of the form: - -@smallexample -foo.1 : foo.man sedscript - sed -e sedscript foo.man > foo.1 -@end smallexample - -@noindent -will fail when the build directory is not the source directory, because -@file{foo.man} and @file{sedscript} are in the the source directory. - -When using GNU @code{make}, relying on @samp{VPATH} to find the source -file will work in the case where there is a single dependency file, -since the @code{make} automatic variable @samp{$<} will represent the -source file wherever it is. (Many versions of @code{make} set @samp{$<} -only in implicit rules.) A Makefile target like - -@smallexample -foo.o : bar.c - $(CC) -I. -I$(srcdir) $(CFLAGS) -c bar.c -o foo.o -@end smallexample - -@noindent -should instead be written as - -@smallexample -foo.o : bar.c - $(CC) -I. -I$(srcdir) $(CFLAGS) -c $< -o $@@ -@end smallexample - -@noindent -in order to allow @samp{VPATH} to work correctly. When the target has -multiple dependencies, using an explicit @samp{$(srcdir)} is the easiest -way to make the rule work well. For example, the target above for -@file{foo.1} is best written as: - -@smallexample -foo.1 : foo.man sedscript - sed -e $(srcdir)/sedscript $(srcdir)/foo.man > $@@ -@end smallexample - -GNU distributions usually contain some files which are not source -files---for example, Info files, and the output from Autoconf, Automake, -Bison or Flex. Since these files normally appear in the source -directory, they should always appear in the source directory, not in the -build directory. So Makefile rules to update them should put the -updated files in the source directory. - -However, if a file does not appear in the distribution, then the -Makefile should not put it in the source directory, because building a -program in ordinary circumstances should not modify the source directory -in any way. - -Try to make the build and installation targets, at least (and all their -subtargets) work correctly with a parallel @code{make}. - -@node Utilities in Makefiles -@section Utilities in Makefiles - -Write the Makefile commands (and any shell scripts, such as -@code{configure}) to run in @code{sh}, not in @code{csh}. Don't use any -special features of @code{ksh} or @code{bash}. - -The @code{configure} script and the Makefile rules for building and -installation should not use any utilities directly except these: - -@c dd find -@c gunzip gzip md5sum -@c mkfifo mknod tee uname - -@example -cat cmp cp diff echo egrep expr false grep install-info -ln ls mkdir mv pwd rm rmdir sed sleep sort tar test touch true -@end example - -The compression program @code{gzip} can be used in the @code{dist} rule. - -Stick to the generally supported options for these programs. For -example, don't use @samp{mkdir -p}, convenient as it may be, because -most systems don't support it. - -It is a good idea to avoid creating symbolic links in makefiles, since a -few systems don't support them. - -The Makefile rules for building and installation can also use compilers -and related programs, but should do so via @code{make} variables so that the -user can substitute alternatives. Here are some of the programs we -mean: - -@example -ar bison cc flex install ld ldconfig lex -make makeinfo ranlib texi2dvi yacc -@end example - -Use the following @code{make} variables to run those programs: - -@example -$(AR) $(BISON) $(CC) $(FLEX) $(INSTALL) $(LD) $(LDCONFIG) $(LEX) -$(MAKE) $(MAKEINFO) $(RANLIB) $(TEXI2DVI) $(YACC) -@end example - -When you use @code{ranlib} or @code{ldconfig}, you should make sure -nothing bad happens if the system does not have the program in question. -Arrange to ignore an error from that command, and print a message before -the command to tell the user that failure of this command does not mean -a problem. (The Autoconf @samp{AC_PROG_RANLIB} macro can help with -this.) - -If you use symbolic links, you should implement a fallback for systems -that don't have symbolic links. - -Additional utilities that can be used via Make variables are: - -@example -chgrp chmod chown mknod -@end example - -It is ok to use other utilities in Makefile portions (or scripts) -intended only for particular systems where you know those utilities -exist. - -@node Command Variables -@section Variables for Specifying Commands - -Makefiles should provide variables for overriding certain commands, options, -and so on. - -In particular, you should run most utility programs via variables. -Thus, if you use Bison, have a variable named @code{BISON} whose default -value is set with @samp{BISON = bison}, and refer to it with -@code{$(BISON)} whenever you need to use Bison. - -File management utilities such as @code{ln}, @code{rm}, @code{mv}, and -so on, need not be referred to through variables in this way, since users -don't need to replace them with other programs. - -Each program-name variable should come with an options variable that is -used to supply options to the program. Append @samp{FLAGS} to the -program-name variable name to get the options variable name---for -example, @code{BISONFLAGS}. (The names @code{CFLAGS} for the C -compiler, @code{YFLAGS} for yacc, and @code{LFLAGS} for lex, are -exceptions to this rule, but we keep them because they are standard.) -Use @code{CPPFLAGS} in any compilation command that runs the -preprocessor, and use @code{LDFLAGS} in any compilation command that -does linking as well as in any direct use of @code{ld}. - -If there are C compiler options that @emph{must} be used for proper -compilation of certain files, do not include them in @code{CFLAGS}. -Users expect to be able to specify @code{CFLAGS} freely themselves. -Instead, arrange to pass the necessary options to the C compiler -independently of @code{CFLAGS}, by writing them explicitly in the -compilation commands or by defining an implicit rule, like this: - -@smallexample -CFLAGS = -g -ALL_CFLAGS = -I. $(CFLAGS) -.c.o: - $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $< -@end smallexample - -Do include the @samp{-g} option in @code{CFLAGS}, because that is not -@emph{required} for proper compilation. You can consider it a default -that is only recommended. If the package is set up so that it is -compiled with GCC by default, then you might as well include @samp{-O} -in the default value of @code{CFLAGS} as well. - -Put @code{CFLAGS} last in the compilation command, after other variables -containing compiler options, so the user can use @code{CFLAGS} to -override the others. - -@code{CFLAGS} should be used in every invocation of the C compiler, -both those which do compilation and those which do linking. - -Every Makefile should define the variable @code{INSTALL}, which is the -basic command for installing a file into the system. - -Every Makefile should also define the variables @code{INSTALL_PROGRAM} -and @code{INSTALL_DATA}. (The default for each of these should be -@code{$(INSTALL)}.) Then it should use those variables as the commands -for actual installation, for executables and nonexecutables -respectively. Use these variables as follows: - -@example -$(INSTALL_PROGRAM) foo $(bindir)/foo -$(INSTALL_DATA) libfoo.a $(libdir)/libfoo.a -@end example - -Optionally, you may prepend the value of @code{DESTDIR} to the target -filename. Doing this allows the installer to create a snapshot of the -installation to be copied onto the real target filesystem later. Do not -set the value of @code{DESTDIR} in your Makefile, and do not include it -in any installed files. With support for @code{DESTDIR}, the above -examples become: - -@example -$(INSTALL_PROGRAM) foo $(DESTDIR)$(bindir)/foo -$(INSTALL_DATA) libfoo.a $(DESTDIR)$(libdir)/libfoo.a -@end example - -@noindent -Always use a file name, not a directory name, as the second argument of -the installation commands. Use a separate command for each file to be -installed. - -@node Directory Variables -@section Variables for Installation Directories - -Installation directories should always be named by variables, so it is -easy to install in a nonstandard place. The standard names for these -variables are described below. They are based on a standard filesystem -layout; variants of it are used in SVR4, 4.4BSD, Linux, Ultrix v4, and -other modern operating systems. - -These two variables set the root for the installation. All the other -installation directories should be subdirectories of one of these two, -and nothing should be directly installed into these two directories. - -@table @samp -@item prefix -A prefix used in constructing the default values of the variables listed -below. The default value of @code{prefix} should be @file{/usr/local}. -When building the complete GNU system, the prefix will be empty and -@file{/usr} will be a symbolic link to @file{/}. -(If you are using Autoconf, write it as @samp{@@prefix@@}.) - -Running @samp{make install} with a different value of @code{prefix} -from the one used to build the program should @var{not} recompile -the program. - -@item exec_prefix -A prefix used in constructing the default values of some of the -variables listed below. The default value of @code{exec_prefix} should -be @code{$(prefix)}. -(If you are using Autoconf, write it as @samp{@@exec_prefix@@}.) - -Generally, @code{$(exec_prefix)} is used for directories that contain -machine-specific files (such as executables and subroutine libraries), -while @code{$(prefix)} is used directly for other directories. - -Running @samp{make install} with a different value of @code{exec_prefix} -from the one used to build the program should @var{not} recompile the -program. -@end table - -Executable programs are installed in one of the following directories. - -@table @samp -@item bindir -The directory for installing executable programs that users can run. -This should normally be @file{/usr/local/bin}, but write it as -@file{$(exec_prefix)/bin}. -(If you are using Autoconf, write it as @samp{@@bindir@@}.) - -@item sbindir -The directory for installing executable programs that can be run from -the shell, but are only generally useful to system administrators. This -should normally be @file{/usr/local/sbin}, but write it as -@file{$(exec_prefix)/sbin}. -(If you are using Autoconf, write it as @samp{@@sbindir@@}.) - -@item libexecdir -@comment This paragraph adjusted to avoid overfull hbox --roland 5jul94 -The directory for installing executable programs to be run by other -programs rather than by users. This directory should normally be -@file{/usr/local/libexec}, but write it as @file{$(exec_prefix)/libexec}. -(If you are using Autoconf, write it as @samp{@@libexecdir@@}.) -@end table - -Data files used by the program during its execution are divided into -categories in two ways. - -@itemize @bullet -@item -Some files are normally modified by programs; others are never normally -modified (though users may edit some of these). - -@item -Some files are architecture-independent and can be shared by all -machines at a site; some are architecture-dependent and can be shared -only by machines of the same kind and operating system; others may never -be shared between two machines. -@end itemize - -This makes for six different possibilities. However, we want to -discourage the use of architecture-dependent files, aside from object -files and libraries. It is much cleaner to make other data files -architecture-independent, and it is generally not hard. - -Therefore, here are the variables Makefiles should use to specify -directories: - -@table @samp -@item datadir -The directory for installing read-only architecture independent data -files. This should normally be @file{/usr/local/share}, but write it as -@file{$(prefix)/share}. -(If you are using Autoconf, write it as @samp{@@datadir@@}.) -As a special exception, see @file{$(infodir)} -and @file{$(includedir)} below. - -@item sysconfdir -The directory for installing read-only data files that pertain to a -single machine--that is to say, files for configuring a host. Mailer -and network configuration files, @file{/etc/passwd}, and so forth belong -here. All the files in this directory should be ordinary ASCII text -files. This directory should normally be @file{/usr/local/etc}, but -write it as @file{$(prefix)/etc}. -(If you are using Autoconf, write it as @samp{@@sysconfdir@@}.) - -Do not install executables here in this directory (they probably belong -in @file{$(libexecdir)} or @file{$(sbindir)}). Also do not install -files that are modified in the normal course of their use (programs -whose purpose is to change the configuration of the system excluded). -Those probably belong in @file{$(localstatedir)}. - -@item sharedstatedir -The directory for installing architecture-independent data files which -the programs modify while they run. This should normally be -@file{/usr/local/com}, but write it as @file{$(prefix)/com}. -(If you are using Autoconf, write it as @samp{@@sharedstatedir@@}.) - -@item localstatedir -The directory for installing data files which the programs modify while -they run, and that pertain to one specific machine. Users should never -need to modify files in this directory to configure the package's -operation; put such configuration information in separate files that go -in @file{$(datadir)} or @file{$(sysconfdir)}. @file{$(localstatedir)} -should normally be @file{/usr/local/var}, but write it as -@file{$(prefix)/var}. -(If you are using Autoconf, write it as @samp{@@localstatedir@@}.) - -@item libdir -The directory for object files and libraries of object code. Do not -install executables here, they probably ought to go in @file{$(libexecdir)} -instead. The value of @code{libdir} should normally be -@file{/usr/local/lib}, but write it as @file{$(exec_prefix)/lib}. -(If you are using Autoconf, write it as @samp{@@libdir@@}.) - -@item infodir -The directory for installing the Info files for this package. By -default, it should be @file{/usr/local/info}, but it should be written -as @file{$(prefix)/info}. -(If you are using Autoconf, write it as @samp{@@infodir@@}.) - -@item lispdir -The directory for installing any Emacs Lisp files in this package. By -default, it should be @file{/usr/local/share/emacs/site-lisp}, but it -should be written as @file{$(prefix)/share/emacs/site-lisp}. - -If you are using Autoconf, write the default as @samp{@@lispdir@@}. -In order to make @samp{@@lispdir@@} work, you need the following lines -in your @file{configure.in} file: - -@example -lispdir='$@{datadir@}/emacs/site-lisp' -AC_SUBST(lispdir) -@end example - -@item includedir -@c rewritten to avoid overfull hbox --roland -The directory for installing header files to be included by user -programs with the C @samp{#include} preprocessor directive. This -should normally be @file{/usr/local/include}, but write it as -@file{$(prefix)/include}. -(If you are using Autoconf, write it as @samp{@@includedir@@}.) - -Most compilers other than GCC do not look for header files in directory -@file{/usr/local/include}. So installing the header files this way is -only useful with GCC. Sometimes this is not a problem because some -libraries are only really intended to work with GCC. But some libraries -are intended to work with other compilers. They should install their -header files in two places, one specified by @code{includedir} and one -specified by @code{oldincludedir}. - -@item oldincludedir -The directory for installing @samp{#include} header files for use with -compilers other than GCC. This should normally be @file{/usr/include}. -(If you are using Autoconf, you can write it as @samp{@@oldincludedir@@}.) - -The Makefile commands should check whether the value of -@code{oldincludedir} is empty. If it is, they should not try to use -it; they should cancel the second installation of the header files. - -A package should not replace an existing header in this directory unless -the header came from the same package. Thus, if your Foo package -provides a header file @file{foo.h}, then it should install the header -file in the @code{oldincludedir} directory if either (1) there is no -@file{foo.h} there or (2) the @file{foo.h} that exists came from the Foo -package. - -To tell whether @file{foo.h} came from the Foo package, put a magic -string in the file---part of a comment---and @code{grep} for that string. -@end table - -Unix-style man pages are installed in one of the following: - -@table @samp -@item mandir -The top-level directory for installing the man pages (if any) for this -package. It will normally be @file{/usr/local/man}, but you should -write it as @file{$(prefix)/man}. -(If you are using Autoconf, write it as @samp{@@mandir@@}.) - -@item man1dir -The directory for installing section 1 man pages. Write it as -@file{$(mandir)/man1}. -@item man2dir -The directory for installing section 2 man pages. Write it as -@file{$(mandir)/man2} -@item @dots{} - -@strong{Don't make the primary documentation for any GNU software be a -man page. Write a manual in Texinfo instead. Man pages are just for -the sake of people running GNU software on Unix, which is a secondary -application only.} - -@item manext -The file name extension for the installed man page. This should contain -a period followed by the appropriate digit; it should normally be @samp{.1}. - -@item man1ext -The file name extension for installed section 1 man pages. -@item man2ext -The file name extension for installed section 2 man pages. -@item @dots{} -Use these names instead of @samp{manext} if the package needs to install man -pages in more than one section of the manual. -@end table - -And finally, you should set the following variable: - -@table @samp -@item srcdir -The directory for the sources being compiled. The value of this -variable is normally inserted by the @code{configure} shell script. -(If you are using Autconf, use @samp{srcdir = @@srcdir@@}.) -@end table - -For example: - -@smallexample -@c I have changed some of the comments here slightly to fix an overfull -@c hbox, so the make manual can format correctly. --roland -# Common prefix for installation directories. -# NOTE: This directory must exist when you start the install. -prefix = /usr/local -exec_prefix = $(prefix) -# Where to put the executable for the command `gcc'. -bindir = $(exec_prefix)/bin -# Where to put the directories used by the compiler. -libexecdir = $(exec_prefix)/libexec -# Where to put the Info files. -infodir = $(prefix)/info -@end smallexample - -If your program installs a large number of files into one of the -standard user-specified directories, it might be useful to group them -into a subdirectory particular to that program. If you do this, you -should write the @code{install} rule to create these subdirectories. - -Do not expect the user to include the subdirectory name in the value of -any of the variables listed above. The idea of having a uniform set of -variable names for installation directories is to enable the user to -specify the exact same values for several different GNU packages. In -order for this to be useful, all the packages must be designed so that -they will work sensibly when the user does so. - -@node Standard Targets -@section Standard Targets for Users - -All GNU programs should have the following targets in their Makefiles: - -@table @samp -@item all -Compile the entire program. This should be the default target. This -target need not rebuild any documentation files; Info files should -normally be included in the distribution, and DVI files should be made -only when explicitly asked for. - -By default, the Make rules should compile and link with @samp{-g}, so -that executable programs have debugging symbols. Users who don't mind -being helpless can strip the executables later if they wish. - -@item install -Compile the program and copy the executables, libraries, and so on to -the file names where they should reside for actual use. If there is a -simple test to verify that a program is properly installed, this target -should run that test. - -Do not strip executables when installing them. Devil-may-care users can -use the @code{install-strip} target to do that. - -If possible, write the @code{install} target rule so that it does not -modify anything in the directory where the program was built, provided -@samp{make all} has just been done. This is convenient for building the -program under one user name and installing it under another. - -The commands should create all the directories in which files are to be -installed, if they don't already exist. This includes the directories -specified as the values of the variables @code{prefix} and -@code{exec_prefix}, as well as all subdirectories that are needed. -One way to do this is by means of an @code{installdirs} target -as described below. - -Use @samp{-} before any command for installing a man page, so that -@code{make} will ignore any errors. This is in case there are systems -that don't have the Unix man page documentation system installed. - -The way to install Info files is to copy them into @file{$(infodir)} -with @code{$(INSTALL_DATA)} (@pxref{Command Variables}), and then run -the @code{install-info} program if it is present. @code{install-info} -is a program that edits the Info @file{dir} file to add or update the -menu entry for the given Info file; it is part of the Texinfo package. -Here is a sample rule to install an Info file: - -@comment This example has been carefully formatted for the Make manual. -@comment Please do not reformat it without talking to roland@gnu.ai.mit.edu. -@smallexample -$(DESTDIR)$(infodir)/foo.info: foo.info - $(POST_INSTALL) -# There may be a newer info file in . than in srcdir. - -if test -f foo.info; then d=.; \ - else d=$(srcdir); fi; \ - $(INSTALL_DATA) $$d/foo.info $(DESTDIR)$@@; \ -# Run install-info only if it exists. -# Use `if' instead of just prepending `-' to the -# line so we notice real errors from install-info. -# We use `$(SHELL) -c' because some shells do not -# fail gracefully when there is an unknown command. - if $(SHELL) -c 'install-info --version' \ - >/dev/null 2>&1; then \ - install-info --dir-file=$(DESTDIR)$(infodir)/dir \ - $(DESTDIR)$(infodir)/foo.info; \ - else true; fi -@end smallexample - -When writing the @code{install} target, you must classify all the -commands into three categories: normal ones, @dfn{pre-installation} -commands and @dfn{post-installation} commands. @xref{Install Command -Categories}. - -@item uninstall -Delete all the installed files---the copies that the @samp{install} -target creates. - -This rule should not modify the directories where compilation is done, -only the directories where files are installed. - -The uninstallation commands are divided into three categories, just like -the installation commands. @xref{Install Command Categories}. - -@item install-strip -Like @code{install}, but strip the executable files while installing -them. In many cases, the definition of this target can be very simple: - -@smallexample -install-strip: - $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' \ - install -@end smallexample - -Normally we do not recommend stripping an executable unless you are sure -the program has no bugs. However, it can be reasonable to install a -stripped executable for actual execution while saving the unstripped -executable elsewhere in case there is a bug. - -@comment The gratuitous blank line here is to make the table look better -@comment in the printed Make manual. Please leave it in. -@item clean - -Delete all files from the current directory that are normally created by -building the program. Don't delete the files that record the -configuration. Also preserve files that could be made by building, but -normally aren't because the distribution comes with them. - -Delete @file{.dvi} files here if they are not part of the distribution. - -@item distclean -Delete all files from the current directory that are created by -configuring or building the program. If you have unpacked the source -and built the program without creating any other files, @samp{make -distclean} should leave only the files that were in the distribution. - -@item mostlyclean -Like @samp{clean}, but may refrain from deleting a few files that people -normally don't want to recompile. For example, the @samp{mostlyclean} -target for GCC does not delete @file{libgcc.a}, because recompiling it -is rarely necessary and takes a lot of time. - -@item maintainer-clean -Delete almost everything from the current directory that can be -reconstructed with this Makefile. This typically includes everything -deleted by @code{distclean}, plus more: C source files produced by -Bison, tags tables, Info files, and so on. - -The reason we say ``almost everything'' is that running the command -@samp{make maintainer-clean} should not delete @file{configure} even if -@file{configure} can be remade using a rule in the Makefile. More generally, -@samp{make maintainer-clean} should not delete anything that needs to -exist in order to run @file{configure} and then begin to build the -program. This is the only exception; @code{maintainer-clean} should -delete everything else that can be rebuilt. - -The @samp{maintainer-clean} target is intended to be used by a maintainer of -the package, not by ordinary users. You may need special tools to -reconstruct some of the files that @samp{make maintainer-clean} deletes. -Since these files are normally included in the distribution, we don't -take care to make them easy to reconstruct. If you find you need to -unpack the full distribution again, don't blame us. - -To help make users aware of this, the commands for the special -@code{maintainer-clean} target should start with these two: - -@smallexample -@@echo 'This command is intended for maintainers to use; it' -@@echo 'deletes files that may need special tools to rebuild.' -@end smallexample - -@item TAGS -Update a tags table for this program. -@c ADR: how? - -@item info -Generate any Info files needed. The best way to write the rules is as -follows: - -@smallexample -info: foo.info - -foo.info: foo.texi chap1.texi chap2.texi - $(MAKEINFO) $(srcdir)/foo.texi -@end smallexample - -@noindent -You must define the variable @code{MAKEINFO} in the Makefile. It should -run the @code{makeinfo} program, which is part of the Texinfo -distribution. - -Normally a GNU distribution comes with Info files, and that means the -Info files are present in the source directory. Therefore, the Make -rule for an info file should update it in the source directory. When -users build the package, ordinarily Make will not update the Info files -because they will already be up to date. - -@item dvi -Generate DVI files for all Texinfo documentation. -For example: - -@smallexample -dvi: foo.dvi - -foo.dvi: foo.texi chap1.texi chap2.texi - $(TEXI2DVI) $(srcdir)/foo.texi -@end smallexample - -@noindent -You must define the variable @code{TEXI2DVI} in the Makefile. It should -run the program @code{texi2dvi}, which is part of the Texinfo -distribution.@footnote{@code{texi2dvi} uses @TeX{} to do the real work -of formatting. @TeX{} is not distributed with Texinfo.} Alternatively, -write just the dependencies, and allow GNU @code{make} to provide the command. - -@item dist -Create a distribution tar file for this program. The tar file should be -set up so that the file names in the tar file start with a subdirectory -name which is the name of the package it is a distribution for. This -name can include the version number. - -For example, the distribution tar file of GCC version 1.40 unpacks into -a subdirectory named @file{gcc-1.40}. - -The easiest way to do this is to create a subdirectory appropriately -named, use @code{ln} or @code{cp} to install the proper files in it, and -then @code{tar} that subdirectory. - -Compress the tar file file with @code{gzip}. For example, the actual -distribution file for GCC version 1.40 is called @file{gcc-1.40.tar.gz}. - -The @code{dist} target should explicitly depend on all non-source files -that are in the distribution, to make sure they are up to date in the -distribution. -@ifset CODESTD -@xref{Releases, , Making Releases}. -@end ifset -@ifclear CODESTD -@xref{Releases, , Making Releases, standards, GNU Coding Standards}. -@end ifclear - -@item check -Perform self-tests (if any). The user must build the program before -running the tests, but need not install the program; you should write -the self-tests so that they work when the program is built but not -installed. -@end table - -The following targets are suggested as conventional names, for programs -in which they are useful. - -@table @code -@item installcheck -Perform installation tests (if any). The user must build and install -the program before running the tests. You should not assume that -@file{$(bindir)} is in the search path. - -@item installdirs -It's useful to add a target named @samp{installdirs} to create the -directories where files are installed, and their parent directories. -There is a script called @file{mkinstalldirs} which is convenient for -this; you can find it in the Texinfo package. -@c It's in /gd/gnu/lib/mkinstalldirs. -You can use a rule like this: - -@comment This has been carefully formatted to look decent in the Make manual. -@comment Please be sure not to make it extend any further to the right.--roland -@smallexample -# Make sure all installation directories (e.g. $(bindir)) -# actually exist by making them if necessary. -installdirs: mkinstalldirs - $(srcdir)/mkinstalldirs $(bindir) $(datadir) \ - $(libdir) $(infodir) \ - $(mandir) -@end smallexample - -This rule should not modify the directories where compilation is done. -It should do nothing but create installation directories. -@end table - -@node Install Command Categories -@section Install Command Categories - -@cindex pre-installation commands -@cindex post-installation commands -When writing the @code{install} target, you must classify all the -commands into three categories: normal ones, @dfn{pre-installation} -commands and @dfn{post-installation} commands. - -Normal commands move files into their proper places, and set their -modes. They may not alter any files except the ones that come entirely -from the package they belong to. - -Pre-installation and post-installation commands may alter other files; -in particular, they can edit global configuration files or data bases. - -Pre-installation commands are typically executed before the normal -commands, and post-installation commands are typically run after the -normal commands. - -The most common use for a post-installation command is to run -@code{install-info}. This cannot be done with a normal command, since -it alters a file (the Info directory) which does not come entirely and -solely from the package being installed. It is a post-installation -command because it needs to be done after the normal command which -installs the package's Info files. - -Most programs don't need any pre-installation commands, but we have the -feature just in case it is needed. - -To classify the commands in the @code{install} rule into these three -categories, insert @dfn{category lines} among them. A category line -specifies the category for the commands that follow. - -A category line consists of a tab and a reference to a special Make -variable, plus an optional comment at the end. There are three -variables you can use, one for each category; the variable name -specifies the category. Category lines are no-ops in ordinary execution -because these three Make variables are normally undefined (and you -@emph{should not} define them in the makefile). - -Here are the three possible category lines, each with a comment that -explains what it means: - -@smallexample - $(PRE_INSTALL) # @r{Pre-install commands follow.} - $(POST_INSTALL) # @r{Post-install commands follow.} - $(NORMAL_INSTALL) # @r{Normal commands follow.} -@end smallexample - -If you don't use a category line at the beginning of the @code{install} -rule, all the commands are classified as normal until the first category -line. If you don't use any category lines, all the commands are -classified as normal. - -These are the category lines for @code{uninstall}: - -@smallexample - $(PRE_UNINSTALL) # @r{Pre-uninstall commands follow.} - $(POST_UNINSTALL) # @r{Post-uninstall commands follow.} - $(NORMAL_UNINSTALL) # @r{Normal commands follow.} -@end smallexample - -Typically, a pre-uninstall command would be used for deleting entries -from the Info directory. - -If the @code{install} or @code{uninstall} target has any dependencies -which act as subroutines of installation, then you should start -@emph{each} dependency's commands with a category line, and start the -main target's commands with a category line also. This way, you can -ensure that each command is placed in the right category regardless of -which of the dependencies actually run. - -Pre-installation and post-installation commands should not run any -programs except for these: - -@example -[ basename bash cat chgrp chmod chown cmp cp dd diff echo -egrep expand expr false fgrep find getopt grep gunzip gzip -hostname install install-info kill ldconfig ln ls md5sum -mkdir mkfifo mknod mv printenv pwd rm rmdir sed sort tee -test touch true uname xargs yes -@end example - -@cindex binary packages -The reason for distinguishing the commands in this way is for the sake -of making binary packages. Typically a binary package contains all the -executables and other files that need to be installed, and has its own -method of installing them---so it does not need to run the normal -installation commands. But installing the binary package does need to -execute the pre-installation and post-installation commands. - -Programs to build binary packages work by extracting the -pre-installation and post-installation commands. Here is one way of -extracting the pre-installation commands: - -@smallexample -make -n install -o all \ - PRE_INSTALL=pre-install \ - POST_INSTALL=post-install \ - NORMAL_INSTALL=normal-install \ - | gawk -f pre-install.awk -@end smallexample - -@noindent -where the file @file{pre-install.awk} could contain this: - -@smallexample -$0 ~ /^\t[ \t]*(normal_install|post_install)[ \t]*$/ @{on = 0@} -on @{print $0@} -$0 ~ /^\t[ \t]*pre_install[ \t]*$/ @{on = 1@} -@end smallexample - -The resulting file of pre-installation commands is executed as a shell -script as part of installing the binary package. diff --git a/contrib/binutils/etc/standards.texi b/contrib/binutils/etc/standards.texi deleted file mode 100644 index 910bf8b0479e..000000000000 --- a/contrib/binutils/etc/standards.texi +++ /dev/null @@ -1,3093 +0,0 @@ -\input texinfo @c -*-texinfo-*- -@c %**start of header -@setfilename standards.info -@settitle GNU Coding Standards -@c This date is automagically updated when you save this file: -@set lastupdate March 13, 1998 -@c %**end of header - -@ifinfo -@format -START-INFO-DIR-ENTRY -* Standards: (standards). GNU coding standards. -END-INFO-DIR-ENTRY -@end format -@end ifinfo - -@c @setchapternewpage odd -@setchapternewpage off - -@c This is used by a cross ref in make-stds.texi -@set CODESTD 1 -@iftex -@set CHAPTER chapter -@end iftex -@ifinfo -@set CHAPTER node -@end ifinfo - -@ifinfo -GNU Coding Standards -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998 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, provided 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, -except that this permission notice may be stated in a translation approved -by the Free Software Foundation. -@end ifinfo - -@titlepage -@title GNU Coding Standards -@author Richard Stallman -@author last updated @value{lastupdate} -@page - -@vskip 0pt plus 1filll -Copyright @copyright{} 1992, 1993, 1994, 1995, 1996, 1997, 1998 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, provided 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, -except that this permission notice may be stated in a translation approved -by the Free Software Foundation. -@end titlepage - -@ifinfo -@node Top, Preface, (dir), (dir) -@top Version - -Last updated @value{lastupdate}. -@end ifinfo - -@menu -* Preface:: About the GNU Coding Standards -* Intellectual Property:: Keeping Free Software Free -* Design Advice:: General Program Design -* Program Behavior:: Program Behavior for All Programs -* Writing C:: Making The Best Use of C -* Documentation:: Documenting Programs -* Managing Releases:: The Release Process -@end menu - -@node Preface -@chapter About the GNU Coding Standards - -The GNU Coding Standards were written by Richard Stallman and other GNU -Project volunteers. Their purpose is to make the GNU system clean, -consistent, and easy to install. This document can also be read as a -guide to writing portable, robust and reliable programs. It focuses on -programs written in C, but many of the rules and principles are useful -even if you write in another programming language. The rules often -state reasons for writing in a certain way. - -Corrections or suggestions for this document should be sent to -@email{gnu@@gnu.org}. If you make a suggestion, please include a -suggested new wording for it; our time is limited. We prefer a context -diff to the @file{standards.texi} or @file{make-stds.texi} files, but if -you don't have those files, please mail your suggestion anyway. - -This release of the GNU Coding Standards was last updated -@value{lastupdate}. - -@node Intellectual Property -@chapter Keeping Free Software Free - -This @value{CHAPTER} discusses how you can make sure that GNU software -remains unencumbered. - -@menu -* Reading Non-Free Code:: Referring to Proprietary Programs -* Contributions:: Accepting Contributions -@end menu - -@node Reading Non-Free Code -@section Referring to Proprietary Programs - -Don't in any circumstances refer to Unix source code for or during -your work on GNU! (Or to any other proprietary programs.) - -If you have a vague recollection of the internals of a Unix program, -this does not absolutely mean you can't write an imitation of it, but -do try to organize the imitation internally along different lines, -because this is likely to make the details of the Unix version -irrelevant and dissimilar to your results. - -For example, Unix utilities were generally optimized to minimize -memory use; if you go for speed instead, your program will be very -different. You could keep the entire input file in core and scan it -there instead of using stdio. Use a smarter algorithm discovered more -recently than the Unix program. Eliminate use of temporary files. Do -it in one pass instead of two (we did this in the assembler). - -Or, on the contrary, emphasize simplicity instead of speed. For some -applications, the speed of today's computers makes simpler algorithms -adequate. - -Or go for generality. For example, Unix programs often have static -tables or fixed-size strings, which make for arbitrary limits; use -dynamic allocation instead. Make sure your program handles NULs and -other funny characters in the input files. Add a programming language -for extensibility and write part of the program in that language. - -Or turn some parts of the program into independently usable libraries. -Or use a simple garbage collector instead of tracking precisely when -to free memory, or use a new GNU facility such as obstacks. - - -@node Contributions -@section Accepting Contributions - -If someone else sends you a piece of code to add to the program you are -working on, we need legal papers to use it---the same sort of legal -papers we will need to get from you. @emph{Each} significant -contributor to a program must sign some sort of legal papers in order -for us to have clear title to the program. The main author alone is not -enough. - -So, before adding in any contributions from other people, please tell -us, so we can arrange to get the papers. Then wait until we tell you -that we have received the signed papers, before you actually use the -contribution. - -This applies both before you release the program and afterward. If -you receive diffs to fix a bug, and they make significant changes, we -need legal papers for that change. - -This also applies to comments and documentation files. For copyright -law, comments and code are just text. Copyright applies to all kinds of -text, so we need legal papers for all kinds. - -You don't need papers for changes of a few lines here or there, since -they are not significant for copyright purposes. Also, you don't need -papers if all you get from the suggestion is some ideas, not actual code -which you use. For example, if you write a different solution to the -problem, you don't need to get papers. - -We know this is frustrating; it's frustrating for us as well. But if -you don't wait, you are going out on a limb---for example, what if the -contributor's employer won't sign a disclaimer? You might have to take -that code out again! - -The very worst thing is if you forget to tell us about the other -contributor. We could be very embarrassed in court some day as a -result. - -We have more detailed advice for maintainers of programs; if you have -reached the stage of actually maintaining a program for GNU (whether -released or not), please ask us for a copy. - -@node Design Advice -@chapter General Program Design - -This @value{CHAPTER} discusses some of the issues you should take into -account when designing your program. - -@menu -* Compatibility:: Compatibility with other implementations -* Using Extensions:: Using non-standard features -* ANSI C:: Using ANSI C features -* Source Language:: Using languages other than C -@end menu - -@node Compatibility -@section Compatibility with Other Implementations - -With occasional exceptions, utility programs and libraries for GNU -should be upward compatible with those in Berkeley Unix, and upward -compatible with @sc{ansi} C if @sc{ansi} C specifies their behavior, and -upward compatible with @sc{POSIX} if @sc{POSIX} specifies their -behavior. - -When these standards conflict, it is useful to offer compatibility -modes for each of them. - -@sc{ansi} C and @sc{POSIX} prohibit many kinds of extensions. Feel free -to make the extensions anyway, and include a @samp{--ansi}, -@samp{--posix}, or @samp{--compatible} option to turn them off. -However, if the extension has a significant chance of breaking any real -programs or scripts, then it is not really upward compatible. Try to -redesign its interface. - -Many GNU programs suppress extensions that conflict with POSIX if the -environment variable @code{POSIXLY_CORRECT} is defined (even if it is -defined with a null value). Please make your program recognize this -variable if appropriate. - -When a feature is used only by users (not by programs or command -files), and it is done poorly in Unix, feel free to replace it -completely with something totally different and better. (For example, -@code{vi} is replaced with Emacs.) But it is nice to offer a compatible -feature as well. (There is a free @code{vi} clone, so we offer it.) - -Additional useful features not in Berkeley Unix are welcome. - -@node Using Extensions -@section Using Non-standard Features - -Many GNU facilities that already exist support a number of convenient -extensions over the comparable Unix facilities. Whether to use these -extensions in implementing your program is a difficult question. - -On the one hand, using the extensions can make a cleaner program. -On the other hand, people will not be able to build the program -unless the other GNU tools are available. This might cause the -program to work on fewer kinds of machines. - -With some extensions, it might be easy to provide both alternatives. -For example, you can define functions with a ``keyword'' @code{INLINE} -and define that as a macro to expand into either @code{inline} or -nothing, depending on the compiler. - -In general, perhaps it is best not to use the extensions if you can -straightforwardly do without them, but to use the extensions if they -are a big improvement. - -An exception to this rule are the large, established programs (such as -Emacs) which run on a great variety of systems. Such programs would -be broken by use of GNU extensions. - -Another exception is for programs that are used as part of -compilation: anything that must be compiled with other compilers in -order to bootstrap the GNU compilation facilities. If these require -the GNU compiler, then no one can compile them without having them -installed already. That would be no good. - -@node ANSI C -@section @sc{ansi} C and pre-@sc{ansi} C - -Do not ever use the ``trigraph'' feature of @sc{ansi} C. - -@sc{ansi} C is widespread enough now that it is ok to write new programs -that use @sc{ansi} C features (and therefore will not work in -non-@sc{ansi} compilers). And if a program is already written in -@sc{ansi} C, there's no need to convert it to support non-@sc{ansi} -compilers. - -However, it is easy to support non-@sc{ansi} compilers in most programs, -so you might still consider doing so when you write a program. Instead -of writing function definitions in @sc{ansi} prototype form, - -@example -int -foo (int x, int y) -@dots{} -@end example - -@noindent -write the definition in pre-@sc{ansi} style like this, - -@example -int -foo (x, y) - int x, y; -@dots{} -@end example - -@noindent -and use a separate declaration to specify the argument prototype: - -@example -int foo (int, int); -@end example - -You need such a declaration anyway, in a header file, to get the benefit -of @sc{ansi} C prototypes in all the files where the function is called. -And once you have it, you lose nothing by writing the function -definition in the pre-@sc{ansi} style. - -If you don't know non-@sc{ansi} C, there's no need to learn it; just -write in @sc{ansi} C. - -@node Source Language -@section Using Languages Other Than C - -Using a language other than C is like using a non-standard feature: it -will cause trouble for users. Even if GCC supports the other language, -users may find it inconvenient to have to install the compiler for that -other language in order to build your program. For example, if you -write your program in C++, people will have to install the C++ compiler -in order to compile your program. Thus, it is better if you write in C. - -But there are three situations when there is no disadvantage in using -some other language: - -@itemize @bullet -@item -It is okay to use another language if your program contains an -interpreter for that language. - -For example, if your program links with GUILE, it is ok to write part of -the program in Scheme or another language supported by GUILE. - -@item -It is okay to use another language in a tool specifically intended for -use with that language. - -This is okay because the only people who want to build the tool will be -those who have installed the other language anyway. - -@item -If an application is of interest to a narrow community, then perhaps -it's not important if the application is inconvenient to install. -@end itemize - -C has one other advantage over C++ and other compiled languages: more -people know C, so more people will find it easy to read and modify the -program if it is written in C. - -@node Program Behavior -@chapter Program Behavior for All Programs - -This @value{CHAPTER} describes how to write robust software. It also -describes general standards for error messages, the command line interface, -and how libraries should behave. - -@menu -* Semantics:: Writing robust programs -* Libraries:: Library behavior -* Errors:: Formatting error messages -* User Interfaces:: Standards for command line interfaces -* Option Table:: Table of long options. -* Memory Usage:: When and how to care about memory needs -@end menu - -@node Semantics -@section Writing Robust Programs - -Avoid arbitrary limits on the length or number of @emph{any} data -structure, including file names, lines, files, and symbols, by allocating -all data structures dynamically. In most Unix utilities, ``long lines -are silently truncated''. This is not acceptable in a GNU utility. - -Utilities reading files should not drop NUL characters, or any other -nonprinting characters @emph{including those with codes above 0177}. The -only sensible exceptions would be utilities specifically intended for -interface to certain types of printers that can't handle those characters. - -Check every system call for an error return, unless you know you wish to -ignore errors. Include the system error text (from @code{perror} or -equivalent) in @emph{every} error message resulting from a failing -system call, as well as the name of the file if any and the name of the -utility. Just ``cannot open foo.c'' or ``stat failed'' is not -sufficient. - -Check every call to @code{malloc} or @code{realloc} to see if it -returned zero. Check @code{realloc} even if you are making the block -smaller; in a system that rounds block sizes to a power of 2, -@code{realloc} may get a different block if you ask for less space. - -In Unix, @code{realloc} can destroy the storage block if it returns -zero. GNU @code{realloc} does not have this bug: if it fails, the -original block is unchanged. Feel free to assume the bug is fixed. If -you wish to run your program on Unix, and wish to avoid lossage in this -case, you can use the GNU @code{malloc}. - -You must expect @code{free} to alter the contents of the block that was -freed. Anything you want to fetch from the block, you must fetch before -calling @code{free}. - -If @code{malloc} fails in a noninteractive program, make that a fatal -error. In an interactive program (one that reads commands from the -user), it is better to abort the command and return to the command -reader loop. This allows the user to kill other processes to free up -virtual memory, and then try the command again. - -Use @code{getopt_long} to decode arguments, unless the argument syntax -makes this unreasonable. - -When static storage is to be written in during program execution, use -explicit C code to initialize it. Reserve C initialized declarations -for data that will not be changed. -@c ADR: why? - -Try to avoid low-level interfaces to obscure Unix data structures (such -as file directories, utmp, or the layout of kernel memory), since these -are less likely to work compatibly. If you need to find all the files -in a directory, use @code{readdir} or some other high-level interface. -These will be supported compatibly by GNU. - -By default, the GNU system will provide the signal handling functions of -@sc{BSD} and of @sc{POSIX}. So GNU software should be written to use -these. - -In error checks that detect ``impossible'' conditions, just abort. -There is usually no point in printing any message. These checks -indicate the existence of bugs. Whoever wants to fix the bugs will have -to read the source code and run a debugger. So explain the problem with -comments in the source. The relevant data will be in variables, which -are easy to examine with the debugger, so there is no point moving them -elsewhere. - -Do not use a count of errors as the exit status for a program. -@emph{That does not work}, because exit status values are limited to 8 -bits (0 through 255). A single run of the program might have 256 -errors; if you try to return 256 as the exit status, the parent process -will see 0 as the status, and it will appear that the program succeeded. - -If you make temporary files, check the @code{TMPDIR} environment -variable; if that variable is defined, use the specified directory -instead of @file{/tmp}. - -@node Libraries -@section Library Behavior - -Try to make library functions reentrant. If they need to do dynamic -storage allocation, at least try to avoid any nonreentrancy aside from -that of @code{malloc} itself. - -Here are certain name conventions for libraries, to avoid name -conflicts. - -Choose a name prefix for the library, more than two characters long. -All external function and variable names should start with this -prefix. In addition, there should only be one of these in any given -library member. This usually means putting each one in a separate -source file. - -An exception can be made when two external symbols are always used -together, so that no reasonable program could use one without the -other; then they can both go in the same file. - -External symbols that are not documented entry points for the user -should have names beginning with @samp{_}. They should also contain -the chosen name prefix for the library, to prevent collisions with -other libraries. These can go in the same files with user entry -points if you like. - -Static functions and variables can be used as you like and need not -fit any naming convention. - -@node Errors -@section Formatting Error Messages - -Error messages from compilers should look like this: - -@example -@var{source-file-name}:@var{lineno}: @var{message} -@end example - -Error messages from other noninteractive programs should look like this: - -@example -@var{program}:@var{source-file-name}:@var{lineno}: @var{message} -@end example - -@noindent -when there is an appropriate source file, or like this: - -@example -@var{program}: @var{message} -@end example - -@noindent -when there is no relevant source file. - -In an interactive program (one that is reading commands from a -terminal), it is better not to include the program name in an error -message. The place to indicate which program is running is in the -prompt or with the screen layout. (When the same program runs with -input from a source other than a terminal, it is not interactive and -would do best to print error messages using the noninteractive style.) - -The string @var{message} should not begin with a capital letter when -it follows a program name and/or file name. Also, it should not end -with a period. - -Error messages from interactive programs, and other messages such as -usage messages, should start with a capital letter. But they should not -end with a period. - -@node User Interfaces -@section Standards for Command Line Interfaces - -Please don't make the behavior of a utility depend on the name used -to invoke it. It is useful sometimes to make a link to a utility -with a different name, and that should not change what it does. - -Instead, use a run time option or a compilation switch or both -to select among the alternate behaviors. - -Likewise, please don't make the behavior of the program depend on the -type of output device it is used with. Device independence is an -important principle of the system's design; do not compromise it -merely to save someone from typing an option now and then. - -If you think one behavior is most useful when the output is to a -terminal, and another is most useful when the output is a file or a -pipe, then it is usually best to make the default behavior the one that -is useful with output to a terminal, and have an option for the other -behavior. - -Compatibility requires certain programs to depend on the type of output -device. It would be disastrous if @code{ls} or @code{sh} did not do so -in the way all users expect. In some of these cases, we supplement the -program with a preferred alternate version that does not depend on the -output device type. For example, we provide a @code{dir} program much -like @code{ls} except that its default output format is always -multi-column format. - -It is a good idea to follow the @sc{POSIX} guidelines for the -command-line options of a program. The easiest way to do this is to use -@code{getopt} to parse them. Note that the GNU version of @code{getopt} -will normally permit options anywhere among the arguments unless the -special argument @samp{--} is used. This is not what @sc{POSIX} -specifies; it is a GNU extension. - -Please define long-named options that are equivalent to the -single-letter Unix-style options. We hope to make GNU more user -friendly this way. This is easy to do with the GNU function -@code{getopt_long}. - -One of the advantages of long-named options is that they can be -consistent from program to program. For example, users should be able -to expect the ``verbose'' option of any GNU program which has one, to be -spelled precisely @samp{--verbose}. To achieve this uniformity, look at -the table of common long-option names when you choose the option names -for your program (@pxref{Option Table}). - -It is usually a good idea for file names given as ordinary arguments to -be input files only; any output files would be specified using options -(preferably @samp{-o} or @samp{--output}). Even if you allow an output -file name as an ordinary argument for compatibility, try to provide an -option as another way to specify it. This will lead to more consistency -among GNU utilities, and fewer idiosyncracies for users to remember. - -All programs should support two standard options: @samp{--version} -and @samp{--help}. - -@table @code -@item --version -This option should direct the program to information about its name, -version, origin and legal status, all on standard output, and then exit -successfully. Other options and arguments should be ignored once this -is seen, and the program should not perform its normal function. - -The first line is meant to be easy for a program to parse; the version -number proper starts after the last space. In addition, it contains -the canonical name for this program, in this format: - -@example -GNU Emacs 19.30 -@end example - -@noindent -The program's name should be a constant string; @emph{don't} compute it -from @code{argv[0]}. The idea is to state the standard or canonical -name for the program, not its file name. There are other ways to find -out the precise file name where a command is found in @code{PATH}. - -If the program is a subsidiary part of a larger package, mention the -package name in parentheses, like this: - -@example -emacsserver (GNU Emacs) 19.30 -@end example - -@noindent -If the package has a version number which is different from this -program's version number, you can mention the package version number -just before the close-parenthesis. - -If you @strong{need} to mention the version numbers of libraries which -are distributed separately from the package which contains this program, -you can do so by printing an additional line of version info for each -library you want to mention. Use the same format for these lines as for -the first line. - -Please do not mention all of the libraries that the program uses ``just -for completeness''---that would produce a lot of unhelpful clutter. -Please mention library version numbers only if you find in practice that -they are very important to you in debugging. - -The following line, after the version number line or lines, should be a -copyright notice. If more than one copyright notice is called for, put -each on a separate line. - -Next should follow a brief statement that the program is free software, -and that users are free to copy and change it on certain conditions. If -the program is covered by the GNU GPL, say so here. Also mention that -there is no warranty, to the extent permitted by law. - -It is ok to finish the output with a list of the major authors of the -program, as a way of giving credit. - -Here's an example of output that follows these rules: - -@smallexample -GNU Emacs 19.34.5 -Copyright (C) 1996 Free Software Foundation, Inc. -GNU Emacs comes with NO WARRANTY, -to the extent permitted by law. -You may redistribute copies of GNU Emacs -under the terms of the GNU General Public License. -For more information about these matters, -see the files named COPYING. -@end smallexample - -You should adapt this to your program, of course, filling in the proper -year, copyright holder, name of program, and the references to -distribution terms, and changing the rest of the wording as necessary. - -This copyright notice only needs to mention the most recent year in -which changes were made---there's no need to list the years for previous -versions' changes. You don't have to mention the name of the program in -these notices, if that is inconvenient, since it appeared in the first -line. - -@item --help -This option should output brief documentation for how to invoke the -program, on standard output, then exit successfully. Other options and -arguments should be ignored once this is seen, and the program should -not perform its normal function. - -Near the end of the @samp{--help} option's output there should be a line -that says where to mail bug reports. It should have this format: - -@example -Report bugs to @var{mailing-address}. -@end example -@end table - -@node Option Table -@section Table of Long Options - -Here is a table of long options used by GNU programs. It is surely -incomplete, but we aim to list all the options that a new program might -want to be compatible with. If you use names not already in the table, -please send @email{gnu@@gnu.org} a list of them, with their -meanings, so we can update the table. - -@c Please leave newlines between items in this table; it's much easier -@c to update when it isn't completely squashed together and unreadable. -@c When there is more than one short option for a long option name, put -@c a semicolon between the lists of the programs that use them, not a -@c period. --friedman - -@table @samp -@item after-date -@samp{-N} in @code{tar}. - -@item all -@samp{-a} in @code{du}, @code{ls}, @code{nm}, @code{stty}, @code{uname}, -and @code{unexpand}. - -@item all-text -@samp{-a} in @code{diff}. - -@item almost-all -@samp{-A} in @code{ls}. - -@item append -@samp{-a} in @code{etags}, @code{tee}, @code{time}; -@samp{-r} in @code{tar}. - -@item archive -@samp{-a} in @code{cp}. - -@item archive-name -@samp{-n} in @code{shar}. - -@item arglength -@samp{-l} in @code{m4}. - -@item ascii -@samp{-a} in @code{diff}. - -@item assign -@samp{-v} in @code{gawk}. - -@item assume-new -@samp{-W} in Make. - -@item assume-old -@samp{-o} in Make. - -@item auto-check -@samp{-a} in @code{recode}. - -@item auto-pager -@samp{-a} in @code{wdiff}. - -@item auto-reference -@samp{-A} in @code{ptx}. - -@item avoid-wraps -@samp{-n} in @code{wdiff}. - -@item backward-search -@samp{-B} in @code{ctags}. - -@item basename -@samp{-f} in @code{shar}. - -@item batch -Used in GDB. - -@item baud -Used in GDB. - -@item before -@samp{-b} in @code{tac}. - -@item binary -@samp{-b} in @code{cpio} and @code{diff}. - -@item bits-per-code -@samp{-b} in @code{shar}. - -@item block-size -Used in @code{cpio} and @code{tar}. - -@item blocks -@samp{-b} in @code{head} and @code{tail}. - -@item break-file -@samp{-b} in @code{ptx}. - -@item brief -Used in various programs to make output shorter. - -@item bytes -@samp{-c} in @code{head}, @code{split}, and @code{tail}. - -@item c@t{++} -@samp{-C} in @code{etags}. - -@item catenate -@samp{-A} in @code{tar}. - -@item cd -Used in various programs to specify the directory to use. - -@item changes -@samp{-c} in @code{chgrp} and @code{chown}. - -@item classify -@samp{-F} in @code{ls}. - -@item colons -@samp{-c} in @code{recode}. - -@item command -@samp{-c} in @code{su}; -@samp{-x} in GDB. - -@item compare -@samp{-d} in @code{tar}. - -@item compat -Used in @code{gawk}. - -@item compress -@samp{-Z} in @code{tar} and @code{shar}. - -@item concatenate -@samp{-A} in @code{tar}. - -@item confirmation -@samp{-w} in @code{tar}. - -@item context -Used in @code{diff}. - -@item copyleft -@samp{-W copyleft} in @code{gawk}. - -@item copyright -@samp{-C} in @code{ptx}, @code{recode}, and @code{wdiff}; -@samp{-W copyright} in @code{gawk}. - -@item core -Used in GDB. - -@item count -@samp{-q} in @code{who}. - -@item count-links -@samp{-l} in @code{du}. - -@item create -Used in @code{tar} and @code{cpio}. - -@item cut-mark -@samp{-c} in @code{shar}. - -@item cxref -@samp{-x} in @code{ctags}. - -@item date -@samp{-d} in @code{touch}. - -@item debug -@samp{-d} in Make and @code{m4}; -@samp{-t} in Bison. - -@item define -@samp{-D} in @code{m4}. - -@item defines -@samp{-d} in Bison and @code{ctags}. - -@item delete -@samp{-D} in @code{tar}. - -@item dereference -@samp{-L} in @code{chgrp}, @code{chown}, @code{cpio}, @code{du}, -@code{ls}, and @code{tar}. - -@item dereference-args -@samp{-D} in @code{du}. - -@item diacritics -@samp{-d} in @code{recode}. - -@item dictionary-order -@samp{-d} in @code{look}. - -@item diff -@samp{-d} in @code{tar}. - -@item digits -@samp{-n} in @code{csplit}. - -@item directory -Specify the directory to use, in various programs. In @code{ls}, it -means to show directories themselves rather than their contents. In -@code{rm} and @code{ln}, it means to not treat links to directories -specially. - -@item discard-all -@samp{-x} in @code{strip}. - -@item discard-locals -@samp{-X} in @code{strip}. - -@item dry-run -@samp{-n} in Make. - -@item ed -@samp{-e} in @code{diff}. - -@item elide-empty-files -@samp{-z} in @code{csplit}. - -@item end-delete -@samp{-x} in @code{wdiff}. - -@item end-insert -@samp{-z} in @code{wdiff}. - -@item entire-new-file -@samp{-N} in @code{diff}. - -@item environment-overrides -@samp{-e} in Make. - -@item eof -@samp{-e} in @code{xargs}. - -@item epoch -Used in GDB. - -@item error-limit -Used in @code{makeinfo}. - -@item error-output -@samp{-o} in @code{m4}. - -@item escape -@samp{-b} in @code{ls}. - -@item exclude-from -@samp{-X} in @code{tar}. - -@item exec -Used in GDB. - -@item exit -@samp{-x} in @code{xargs}. - -@item exit-0 -@samp{-e} in @code{unshar}. - -@item expand-tabs -@samp{-t} in @code{diff}. - -@item expression -@samp{-e} in @code{sed}. - -@item extern-only -@samp{-g} in @code{nm}. - -@item extract -@samp{-i} in @code{cpio}; -@samp{-x} in @code{tar}. - -@item faces -@samp{-f} in @code{finger}. - -@item fast -@samp{-f} in @code{su}. - -@item fatal-warnings -@samp{-E} in @code{m4}. - -@item file -@samp{-f} in @code{info}, @code{gawk}, Make, @code{mt}, and @code{tar}; -@samp{-n} in @code{sed}; -@samp{-r} in @code{touch}. - -@item field-separator -@samp{-F} in @code{gawk}. - -@item file-prefix -@samp{-b} in Bison. - -@item file-type -@samp{-F} in @code{ls}. - -@item files-from -@samp{-T} in @code{tar}. - -@item fill-column -Used in @code{makeinfo}. - -@item flag-truncation -@samp{-F} in @code{ptx}. - -@item fixed-output-files -@samp{-y} in Bison. - -@item follow -@samp{-f} in @code{tail}. - -@item footnote-style -Used in @code{makeinfo}. - -@item force -@samp{-f} in @code{cp}, @code{ln}, @code{mv}, and @code{rm}. - -@item force-prefix -@samp{-F} in @code{shar}. - -@item format -Used in @code{ls}, @code{time}, and @code{ptx}. - -@item freeze-state -@samp{-F} in @code{m4}. - -@item fullname -Used in GDB. - -@item gap-size -@samp{-g} in @code{ptx}. - -@item get -@samp{-x} in @code{tar}. - -@item graphic -@samp{-i} in @code{ul}. - -@item graphics -@samp{-g} in @code{recode}. - -@item group -@samp{-g} in @code{install}. - -@item gzip -@samp{-z} in @code{tar} and @code{shar}. - -@item hashsize -@samp{-H} in @code{m4}. - -@item header -@samp{-h} in @code{objdump} and @code{recode} - -@item heading -@samp{-H} in @code{who}. - -@item help -Used to ask for brief usage information. - -@item here-delimiter -@samp{-d} in @code{shar}. - -@item hide-control-chars -@samp{-q} in @code{ls}. - -@item idle -@samp{-u} in @code{who}. - -@item ifdef -@samp{-D} in @code{diff}. - -@item ignore -@samp{-I} in @code{ls}; -@samp{-x} in @code{recode}. - -@item ignore-all-space -@samp{-w} in @code{diff}. - -@item ignore-backups -@samp{-B} in @code{ls}. - -@item ignore-blank-lines -@samp{-B} in @code{diff}. - -@item ignore-case -@samp{-f} in @code{look} and @code{ptx}; -@samp{-i} in @code{diff} and @code{wdiff}. - -@item ignore-errors -@samp{-i} in Make. - -@item ignore-file -@samp{-i} in @code{ptx}. - -@item ignore-indentation -@samp{-I} in @code{etags}. - -@item ignore-init-file -@samp{-f} in Oleo. - -@item ignore-interrupts -@samp{-i} in @code{tee}. - -@item ignore-matching-lines -@samp{-I} in @code{diff}. - -@item ignore-space-change -@samp{-b} in @code{diff}. - -@item ignore-zeros -@samp{-i} in @code{tar}. - -@item include -@samp{-i} in @code{etags}; -@samp{-I} in @code{m4}. - -@item include-dir -@samp{-I} in Make. - -@item incremental -@samp{-G} in @code{tar}. - -@item info -@samp{-i}, @samp{-l}, and @samp{-m} in Finger. - -@item initial -@samp{-i} in @code{expand}. - -@item initial-tab -@samp{-T} in @code{diff}. - -@item inode -@samp{-i} in @code{ls}. - -@item interactive -@samp{-i} in @code{cp}, @code{ln}, @code{mv}, @code{rm}; -@samp{-e} in @code{m4}; -@samp{-p} in @code{xargs}; -@samp{-w} in @code{tar}. - -@item intermix-type -@samp{-p} in @code{shar}. - -@item jobs -@samp{-j} in Make. - -@item just-print -@samp{-n} in Make. - -@item keep-going -@samp{-k} in Make. - -@item keep-files -@samp{-k} in @code{csplit}. - -@item kilobytes -@samp{-k} in @code{du} and @code{ls}. - -@item language -@samp{-l} in @code{etags}. - -@item less-mode -@samp{-l} in @code{wdiff}. - -@item level-for-gzip -@samp{-g} in @code{shar}. - -@item line-bytes -@samp{-C} in @code{split}. - -@item lines -Used in @code{split}, @code{head}, and @code{tail}. - -@item link -@samp{-l} in @code{cpio}. - -@item lint -@itemx lint-old -Used in @code{gawk}. - -@item list -@samp{-t} in @code{cpio}; -@samp{-l} in @code{recode}. - -@item list -@samp{-t} in @code{tar}. - -@item literal -@samp{-N} in @code{ls}. - -@item load-average -@samp{-l} in Make. - -@item login -Used in @code{su}. - -@item machine -No listing of which programs already use this; -someone should check to -see if any actually do, and tell @email{gnu@@gnu.org}. - -@item macro-name -@samp{-M} in @code{ptx}. - -@item mail -@samp{-m} in @code{hello} and @code{uname}. - -@item make-directories -@samp{-d} in @code{cpio}. - -@item makefile -@samp{-f} in Make. - -@item mapped -Used in GDB. - -@item max-args -@samp{-n} in @code{xargs}. - -@item max-chars -@samp{-n} in @code{xargs}. - -@item max-lines -@samp{-l} in @code{xargs}. - -@item max-load -@samp{-l} in Make. - -@item max-procs -@samp{-P} in @code{xargs}. - -@item mesg -@samp{-T} in @code{who}. - -@item message -@samp{-T} in @code{who}. - -@item minimal -@samp{-d} in @code{diff}. - -@item mixed-uuencode -@samp{-M} in @code{shar}. - -@item mode -@samp{-m} in @code{install}, @code{mkdir}, and @code{mkfifo}. - -@item modification-time -@samp{-m} in @code{tar}. - -@item multi-volume -@samp{-M} in @code{tar}. - -@item name-prefix -@samp{-a} in Bison. - -@item nesting-limit -@samp{-L} in @code{m4}. - -@item net-headers -@samp{-a} in @code{shar}. - -@item new-file -@samp{-W} in Make. - -@item no-builtin-rules -@samp{-r} in Make. - -@item no-character-count -@samp{-w} in @code{shar}. - -@item no-check-existing -@samp{-x} in @code{shar}. - -@item no-common -@samp{-3} in @code{wdiff}. - -@item no-create -@samp{-c} in @code{touch}. - -@item no-defines -@samp{-D} in @code{etags}. - -@item no-deleted -@samp{-1} in @code{wdiff}. - -@item no-dereference -@samp{-d} in @code{cp}. - -@item no-inserted -@samp{-2} in @code{wdiff}. - -@item no-keep-going -@samp{-S} in Make. - -@item no-lines -@samp{-l} in Bison. - -@item no-piping -@samp{-P} in @code{shar}. - -@item no-prof -@samp{-e} in @code{gprof}. - -@item no-regex -@samp{-R} in @code{etags}. - -@item no-sort -@samp{-p} in @code{nm}. - -@item no-split -Used in @code{makeinfo}. - -@item no-static -@samp{-a} in @code{gprof}. - -@item no-time -@samp{-E} in @code{gprof}. - -@item no-timestamp -@samp{-m} in @code{shar}. - -@item no-validate -Used in @code{makeinfo}. - -@item no-wait -Used in @code{emacsclient}. - -@item no-warn -Used in various programs to inhibit warnings. - -@item node -@samp{-n} in @code{info}. - -@item nodename -@samp{-n} in @code{uname}. - -@item nonmatching -@samp{-f} in @code{cpio}. - -@item nstuff -@samp{-n} in @code{objdump}. - -@item null -@samp{-0} in @code{xargs}. - -@item number -@samp{-n} in @code{cat}. - -@item number-nonblank -@samp{-b} in @code{cat}. - -@item numeric-sort -@samp{-n} in @code{nm}. - -@item numeric-uid-gid -@samp{-n} in @code{cpio} and @code{ls}. - -@item nx -Used in GDB. - -@item old-archive -@samp{-o} in @code{tar}. - -@item old-file -@samp{-o} in Make. - -@item one-file-system -@samp{-l} in @code{tar}, @code{cp}, and @code{du}. - -@item only-file -@samp{-o} in @code{ptx}. - -@item only-prof -@samp{-f} in @code{gprof}. - -@item only-time -@samp{-F} in @code{gprof}. - -@item output -In various programs, specify the output file name. - -@item output-prefix -@samp{-o} in @code{shar}. - -@item override -@samp{-o} in @code{rm}. - -@item overwrite -@samp{-c} in @code{unshar}. - -@item owner -@samp{-o} in @code{install}. - -@item paginate -@samp{-l} in @code{diff}. - -@item paragraph-indent -Used in @code{makeinfo}. - -@item parents -@samp{-p} in @code{mkdir} and @code{rmdir}. - -@item pass-all -@samp{-p} in @code{ul}. - -@item pass-through -@samp{-p} in @code{cpio}. - -@item port -@samp{-P} in @code{finger}. - -@item portability -@samp{-c} in @code{cpio} and @code{tar}. - -@item posix -Used in @code{gawk}. - -@item prefix-builtins -@samp{-P} in @code{m4}. - -@item prefix -@samp{-f} in @code{csplit}. - -@item preserve -Used in @code{tar} and @code{cp}. - -@item preserve-environment -@samp{-p} in @code{su}. - -@item preserve-modification-time -@samp{-m} in @code{cpio}. - -@item preserve-order -@samp{-s} in @code{tar}. - -@item preserve-permissions -@samp{-p} in @code{tar}. - -@item print -@samp{-l} in @code{diff}. - -@item print-chars -@samp{-L} in @code{cmp}. - -@item print-data-base -@samp{-p} in Make. - -@item print-directory -@samp{-w} in Make. - -@item print-file-name -@samp{-o} in @code{nm}. - -@item print-symdefs -@samp{-s} in @code{nm}. - -@item printer -@samp{-p} in @code{wdiff}. - -@item prompt -@samp{-p} in @code{ed}. - -@item query-user -@samp{-X} in @code{shar}. - -@item question -@samp{-q} in Make. - -@item quiet -Used in many programs to inhibit the usual output. @strong{Note:} every -program accepting @samp{--quiet} should accept @samp{--silent} as a -synonym. - -@item quiet-unshar -@samp{-Q} in @code{shar} - -@item quote-name -@samp{-Q} in @code{ls}. - -@item rcs -@samp{-n} in @code{diff}. - -@item re-interval -Used in @code{gawk}. - -@item read-full-blocks -@samp{-B} in @code{tar}. - -@item readnow -Used in GDB. - -@item recon -@samp{-n} in Make. - -@item record-number -@samp{-R} in @code{tar}. - -@item recursive -Used in @code{chgrp}, @code{chown}, @code{cp}, @code{ls}, @code{diff}, -and @code{rm}. - -@item reference-limit -Used in @code{makeinfo}. - -@item references -@samp{-r} in @code{ptx}. - -@item regex -@samp{-r} in @code{tac} and @code{etags}. - -@item release -@samp{-r} in @code{uname}. - -@item reload-state -@samp{-R} in @code{m4}. - -@item relocation -@samp{-r} in @code{objdump}. - -@item rename -@samp{-r} in @code{cpio}. - -@item replace -@samp{-i} in @code{xargs}. - -@item report-identical-files -@samp{-s} in @code{diff}. - -@item reset-access-time -@samp{-a} in @code{cpio}. - -@item reverse -@samp{-r} in @code{ls} and @code{nm}. - -@item reversed-ed -@samp{-f} in @code{diff}. - -@item right-side-defs -@samp{-R} in @code{ptx}. - -@item same-order -@samp{-s} in @code{tar}. - -@item same-permissions -@samp{-p} in @code{tar}. - -@item save -@samp{-g} in @code{stty}. - -@item se -Used in GDB. - -@item sentence-regexp -@samp{-S} in @code{ptx}. - -@item separate-dirs -@samp{-S} in @code{du}. - -@item separator -@samp{-s} in @code{tac}. - -@item sequence -Used by @code{recode} to chose files or pipes for sequencing passes. - -@item shell -@samp{-s} in @code{su}. - -@item show-all -@samp{-A} in @code{cat}. - -@item show-c-function -@samp{-p} in @code{diff}. - -@item show-ends -@samp{-E} in @code{cat}. - -@item show-function-line -@samp{-F} in @code{diff}. - -@item show-tabs -@samp{-T} in @code{cat}. - -@item silent -Used in many programs to inhibit the usual output. -@strong{Note:} every program accepting -@samp{--silent} should accept @samp{--quiet} as a synonym. - -@item size -@samp{-s} in @code{ls}. - -@item sort -Used in @code{ls}. - -@item source -@samp{-W source} in @code{gawk}. - -@item sparse -@samp{-S} in @code{tar}. - -@item speed-large-files -@samp{-H} in @code{diff}. - -@item split-at -@samp{-E} in @code{unshar}. - -@item split-size-limit -@samp{-L} in @code{shar}. - -@item squeeze-blank -@samp{-s} in @code{cat}. - -@item start-delete -@samp{-w} in @code{wdiff}. - -@item start-insert -@samp{-y} in @code{wdiff}. - -@item starting-file -Used in @code{tar} and @code{diff} to specify which file within -a directory to start processing with. - -@item statistics -@samp{-s} in @code{wdiff}. - -@item stdin-file-list -@samp{-S} in @code{shar}. - -@item stop -@samp{-S} in Make. - -@item strict -@samp{-s} in @code{recode}. - -@item strip -@samp{-s} in @code{install}. - -@item strip-all -@samp{-s} in @code{strip}. - -@item strip-debug -@samp{-S} in @code{strip}. - -@item submitter -@samp{-s} in @code{shar}. - -@item suffix -@samp{-S} in @code{cp}, @code{ln}, @code{mv}. - -@item suffix-format -@samp{-b} in @code{csplit}. - -@item sum -@samp{-s} in @code{gprof}. - -@item summarize -@samp{-s} in @code{du}. - -@item symbolic -@samp{-s} in @code{ln}. - -@item symbols -Used in GDB and @code{objdump}. - -@item synclines -@samp{-s} in @code{m4}. - -@item sysname -@samp{-s} in @code{uname}. - -@item tabs -@samp{-t} in @code{expand} and @code{unexpand}. - -@item tabsize -@samp{-T} in @code{ls}. - -@item terminal -@samp{-T} in @code{tput} and @code{ul}. -@samp{-t} in @code{wdiff}. - -@item text -@samp{-a} in @code{diff}. - -@item text-files -@samp{-T} in @code{shar}. - -@item time -Used in @code{ls} and @code{touch}. - -@item to-stdout -@samp{-O} in @code{tar}. - -@item total -@samp{-c} in @code{du}. - -@item touch -@samp{-t} in Make, @code{ranlib}, and @code{recode}. - -@item trace -@samp{-t} in @code{m4}. - -@item traditional -@samp{-t} in @code{hello}; -@samp{-W traditional} in @code{gawk}; -@samp{-G} in @code{ed}, @code{m4}, and @code{ptx}. - -@item tty -Used in GDB. - -@item typedefs -@samp{-t} in @code{ctags}. - -@item typedefs-and-c++ -@samp{-T} in @code{ctags}. - -@item typeset-mode -@samp{-t} in @code{ptx}. - -@item uncompress -@samp{-z} in @code{tar}. - -@item unconditional -@samp{-u} in @code{cpio}. - -@item undefine -@samp{-U} in @code{m4}. - -@item undefined-only -@samp{-u} in @code{nm}. - -@item update -@samp{-u} in @code{cp}, @code{ctags}, @code{mv}, @code{tar}. - -@item usage -Used in @code{gawk}; same as @samp{--help}. - -@item uuencode -@samp{-B} in @code{shar}. - -@item vanilla-operation -@samp{-V} in @code{shar}. - -@item verbose -Print more information about progress. Many programs support this. - -@item verify -@samp{-W} in @code{tar}. - -@item version -Print the version number. - -@item version-control -@samp{-V} in @code{cp}, @code{ln}, @code{mv}. - -@item vgrind -@samp{-v} in @code{ctags}. - -@item volume -@samp{-V} in @code{tar}. - -@item what-if -@samp{-W} in Make. - -@item whole-size-limit -@samp{-l} in @code{shar}. - -@item width -@samp{-w} in @code{ls} and @code{ptx}. - -@item word-regexp -@samp{-W} in @code{ptx}. - -@item writable -@samp{-T} in @code{who}. - -@item zeros -@samp{-z} in @code{gprof}. -@end table - -@node Memory Usage -@section Memory Usage - -If it typically uses just a few meg of memory, don't bother making any -effort to reduce memory usage. For example, if it is impractical for -other reasons to operate on files more than a few meg long, it is -reasonable to read entire input files into core to operate on them. - -However, for programs such as @code{cat} or @code{tail}, that can -usefully operate on very large files, it is important to avoid using a -technique that would artificially limit the size of files it can handle. -If a program works by lines and could be applied to arbitrary -user-supplied input files, it should keep only a line in memory, because -this is not very hard and users will want to be able to operate on input -files that are bigger than will fit in core all at once. - -If your program creates complicated data structures, just make them in -core and give a fatal error if @code{malloc} returns zero. - -@node Writing C -@chapter Making The Best Use of C - -This @value{CHAPTER} provides advice on how best to use the C language -when writing GNU software. - -@menu -* Formatting:: Formatting Your Source Code -* Comments:: Commenting Your Work -* Syntactic Conventions:: Clean Use of C Constructs -* Names:: Naming Variables and Functions -* System Portability:: Portability between different operating systems -* CPU Portability:: Supporting the range of CPU types -* System Functions:: Portability and ``standard'' library functions -* Internationalization:: Techniques for internationalization -* Mmap:: How you can safely use @code{mmap}. -@end menu - -@node Formatting -@section Formatting Your Source Code - -It is important to put the open-brace that starts the body of a C -function in column zero, and avoid putting any other open-brace or -open-parenthesis or open-bracket in column zero. Several tools look -for open-braces in column zero to find the beginnings of C functions. -These tools will not work on code not formatted that way. - -It is also important for function definitions to start the name of the -function in column zero. This helps people to search for function -definitions, and may also help certain tools recognize them. Thus, -the proper format is this: - -@example -static char * -concat (s1, s2) /* Name starts in column zero here */ - char *s1, *s2; -@{ /* Open brace in column zero here */ - @dots{} -@} -@end example - -@noindent -or, if you want to use @sc{ansi} C, format the definition like this: - -@example -static char * -concat (char *s1, char *s2) -@{ - @dots{} -@} -@end example - -In @sc{ansi} C, if the arguments don't fit nicely on one line, -split it like this: - -@example -int -lots_of_args (int an_integer, long a_long, short a_short, - double a_double, float a_float) -@dots{} -@end example - -For the body of the function, we prefer code formatted like this: - -@example -if (x < foo (y, z)) - haha = bar[4] + 5; -else - @{ - while (z) - @{ - haha += foo (z, z); - z--; - @} - return ++x + bar (); - @} -@end example - -We find it easier to read a program when it has spaces before the -open-parentheses and after the commas. Especially after the commas. - -When you split an expression into multiple lines, split it -before an operator, not after one. Here is the right way: - -@example -if (foo_this_is_long && bar > win (x, y, z) - && remaining_condition) -@end example - -Try to avoid having two operators of different precedence at the same -level of indentation. For example, don't write this: - -@example -mode = (inmode[j] == VOIDmode - || GET_MODE_SIZE (outmode[j]) > GET_MODE_SIZE (inmode[j]) - ? outmode[j] : inmode[j]); -@end example - -Instead, use extra parentheses so that the indentation shows the nesting: - -@example -mode = ((inmode[j] == VOIDmode - || (GET_MODE_SIZE (outmode[j]) > GET_MODE_SIZE (inmode[j]))) - ? outmode[j] : inmode[j]); -@end example - -Insert extra parentheses so that Emacs will indent the code properly. -For example, the following indentation looks nice if you do it by hand, -but Emacs would mess it up: - -@example -v = rup->ru_utime.tv_sec*1000 + rup->ru_utime.tv_usec/1000 - + rup->ru_stime.tv_sec*1000 + rup->ru_stime.tv_usec/1000; -@end example - -But adding a set of parentheses solves the problem: - -@example -v = (rup->ru_utime.tv_sec*1000 + rup->ru_utime.tv_usec/1000 - + rup->ru_stime.tv_sec*1000 + rup->ru_stime.tv_usec/1000); -@end example - -Format do-while statements like this: - -@example -do - @{ - a = foo (a); - @} -while (a > 0); -@end example - -Please use formfeed characters (control-L) to divide the program into -pages at logical places (but not within a function). It does not matter -just how long the pages are, since they do not have to fit on a printed -page. The formfeeds should appear alone on lines by themselves. - - -@node Comments -@section Commenting Your Work - -Every program should start with a comment saying briefly what it is for. -Example: @samp{fmt - filter for simple filling of text}. - -Please write the comments in a GNU program in English, because English -is the one language that nearly all programmers in all countries can -read. If you do not write English well, please write comments in -English as well as you can, then ask other people to help rewrite them. -If you can't write comments in English, please find someone to work with -you and translate your comments into English. - -Please put a comment on each function saying what the function does, -what sorts of arguments it gets, and what the possible values of -arguments mean and are used for. It is not necessary to duplicate in -words the meaning of the C argument declarations, if a C type is being -used in its customary fashion. If there is anything nonstandard about -its use (such as an argument of type @code{char *} which is really the -address of the second character of a string, not the first), or any -possible values that would not work the way one would expect (such as, -that strings containing newlines are not guaranteed to work), be sure -to say so. - -Also explain the significance of the return value, if there is one. - -Please put two spaces after the end of a sentence in your comments, so -that the Emacs sentence commands will work. Also, please write -complete sentences and capitalize the first word. If a lower-case -identifier comes at the beginning of a sentence, don't capitalize it! -Changing the spelling makes it a different identifier. If you don't -like starting a sentence with a lower case letter, write the sentence -differently (e.g., ``The identifier lower-case is @dots{}''). - -The comment on a function is much clearer if you use the argument -names to speak about the argument values. The variable name itself -should be lower case, but write it in upper case when you are speaking -about the value rather than the variable itself. Thus, ``the inode -number NODE_NUM'' rather than ``an inode''. - -There is usually no purpose in restating the name of the function in -the comment before it, because the reader can see that for himself. -There might be an exception when the comment is so long that the function -itself would be off the bottom of the screen. - -There should be a comment on each static variable as well, like this: - -@example -/* Nonzero means truncate lines in the display; - zero means continue them. */ -int truncate_lines; -@end example - -Every @samp{#endif} should have a comment, except in the case of short -conditionals (just a few lines) that are not nested. The comment should -state the condition of the conditional that is ending, @emph{including -its sense}. @samp{#else} should have a comment describing the condition -@emph{and sense} of the code that follows. For example: - -@example -@group -#ifdef foo - @dots{} -#else /* not foo */ - @dots{} -#endif /* not foo */ -@end group -@group -#ifdef foo - @dots{} -#endif /* foo */ -@end group -@end example - -@noindent -but, by contrast, write the comments this way for a @samp{#ifndef}: - -@example -@group -#ifndef foo - @dots{} -#else /* foo */ - @dots{} -#endif /* foo */ -@end group -@group -#ifndef foo - @dots{} -#endif /* not foo */ -@end group -@end example - -@node Syntactic Conventions -@section Clean Use of C Constructs - -Please explicitly declare all arguments to functions. -Don't omit them just because they are @code{int}s. - -Declarations of external functions and functions to appear later in the -source file should all go in one place near the beginning of the file -(somewhere before the first function definition in the file), or else -should go in a header file. Don't put @code{extern} declarations inside -functions. - -It used to be common practice to use the same local variables (with -names like @code{tem}) over and over for different values within one -function. Instead of doing this, it is better declare a separate local -variable for each distinct purpose, and give it a name which is -meaningful. This not only makes programs easier to understand, it also -facilitates optimization by good compilers. You can also move the -declaration of each local variable into the smallest scope that includes -all its uses. This makes the program even cleaner. - -Don't use local variables or parameters that shadow global identifiers. - -Don't declare multiple variables in one declaration that spans lines. -Start a new declaration on each line, instead. For example, instead -of this: - -@example -@group -int foo, - bar; -@end group -@end example - -@noindent -write either this: - -@example -int foo, bar; -@end example - -@noindent -or this: - -@example -int foo; -int bar; -@end example - -@noindent -(If they are global variables, each should have a comment preceding it -anyway.) - -When you have an @code{if}-@code{else} statement nested in another -@code{if} statement, always put braces around the @code{if}-@code{else}. -Thus, never write like this: - -@example -if (foo) - if (bar) - win (); - else - lose (); -@end example - -@noindent -always like this: - -@example -if (foo) - @{ - if (bar) - win (); - else - lose (); - @} -@end example - -If you have an @code{if} statement nested inside of an @code{else} -statement, either write @code{else if} on one line, like this, - -@example -if (foo) - @dots{} -else if (bar) - @dots{} -@end example - -@noindent -with its @code{then}-part indented like the preceding @code{then}-part, -or write the nested @code{if} within braces like this: - -@example -if (foo) - @dots{} -else - @{ - if (bar) - @dots{} - @} -@end example - -Don't declare both a structure tag and variables or typedefs in the -same declaration. Instead, declare the structure tag separately -and then use it to declare the variables or typedefs. - -Try to avoid assignments inside @code{if}-conditions. For example, -don't write this: - -@example -if ((foo = (char *) malloc (sizeof *foo)) == 0) - fatal ("virtual memory exhausted"); -@end example - -@noindent -instead, write this: - -@example -foo = (char *) malloc (sizeof *foo); -if (foo == 0) - fatal ("virtual memory exhausted"); -@end example - -Don't make the program ugly to placate @code{lint}. Please don't insert any -casts to @code{void}. Zero without a cast is perfectly fine as a null -pointer constant, except when calling a varargs function. - -@node Names -@section Naming Variables and Functions - -The names of global variables and functions in a program serve as -comments of a sort. So don't choose terse names---instead, look for -names that give useful information about the meaning of the variable or -function. In a GNU program, names should be English, like other -comments. - -Local variable names can be shorter, because they are used only within -one context, where (presumably) comments explain their purpose. - -Please use underscores to separate words in a name, so that the Emacs -word commands can be useful within them. Stick to lower case; reserve -upper case for macros and @code{enum} constants, and for name-prefixes -that follow a uniform convention. - -For example, you should use names like @code{ignore_space_change_flag}; -don't use names like @code{iCantReadThis}. - -Variables that indicate whether command-line options have been -specified should be named after the meaning of the option, not after -the option-letter. A comment should state both the exact meaning of -the option and its letter. For example, - -@example -@group -/* Ignore changes in horizontal whitespace (-b). */ -int ignore_space_change_flag; -@end group -@end example - -When you want to define names with constant integer values, use -@code{enum} rather than @samp{#define}. GDB knows about enumeration -constants. - -Use file names of 14 characters or less, to avoid creating gratuitous -problems on older System V systems. You can use the program -@code{doschk} to test for this. @code{doschk} also tests for potential -name conflicts if the files were loaded onto an MS-DOS file -system---something you may or may not care about. - -@node System Portability -@section Portability between System Types - -In the Unix world, ``portability'' refers to porting to different Unix -versions. For a GNU program, this kind of portability is desirable, but -not paramount. - -The primary purpose of GNU software is to run on top of the GNU kernel, -compiled with the GNU C compiler, on various types of @sc{cpu}. The -amount and kinds of variation among GNU systems on different @sc{cpu}s -will be comparable to the variation among Linux-based GNU systems or -among BSD systems today. So the kinds of portability that are absolutely -necessary are quite limited. - -But many users do run GNU software on non-GNU Unix or Unix-like systems. -So supporting a variety of Unix-like systems is desirable, although not -paramount. - -The easiest way to achieve portability to most Unix-like systems is to -use Autoconf. It's unlikely that your program needs to know more -information about the host platform than Autoconf can provide, simply -because most of the programs that need such knowledge have already been -written. - -Avoid using the format of semi-internal data bases (e.g., directories) -when there is a higher-level alternative (@code{readdir}). - -As for systems that are not like Unix, such as MSDOS, Windows, the -Macintosh, VMS, and MVS, supporting them is usually so much work that it -is better if you don't. - -The planned GNU kernel is not finished yet, but you can tell which -facilities it will provide by looking at the GNU C Library Manual. The -GNU kernel is based on Mach, so the features of Mach will also be -available. However, if you use Mach features, you'll probably have -trouble debugging your program today. - -@node CPU Portability -@section Portability between @sc{cpu}s - -Even GNU systems will differ because of differences among @sc{cpu} -types---for example, difference in byte ordering and alignment -requirements. It is absolutely essential to handle these differences. -However, don't make any effort to cater to the possibility that an -@code{int} will be less than 32 bits. We don't support 16-bit machines -in GNU. - -Don't assume that the address of an @code{int} object is also the -address of its least-significant byte. This is false on big-endian -machines. Thus, don't make the following mistake: - -@example -int c; -@dots{} -while ((c = getchar()) != EOF) - write(file_descriptor, &c, 1); -@end example - -When calling functions, you need not worry about the difference between -pointers of various types, or between pointers and integers. On most -machines, there's no difference anyway. As for the few machines where -there is a difference, all of them support @sc{ansi} C, so you can use -prototypes (conditionalized to be active only in @sc{ansi} C) to make -the code work on those systems. - -In certain cases, it is ok to pass integer and pointer arguments -indiscriminately to the same function, and use no prototype on any -system. For example, many GNU programs have error-reporting functions -that pass their arguments along to @code{printf} and friends: - -@example -error (s, a1, a2, a3) - char *s; - int a1, a2, a3; -@{ - fprintf (stderr, "error: "); - fprintf (stderr, s, a1, a2, a3); -@} -@end example - -@noindent -In practice, this works on all machines, and it is much simpler than any -``correct'' alternative. Be sure @emph{not} to use a prototype -for such functions. - -However, avoid casting pointers to integers unless you really need to. -These assumptions really reduce portability, and in most programs they -are easy to avoid. In the cases where casting pointers to integers is -essential---such as, a Lisp interpreter which stores type information as -well as an address in one word---it is ok to do so, but you'll have to -make explicit provisions to handle different word sizes. - -@node System Functions -@section Calling System Functions - -C implementations differ substantially. @sc{ansi} C reduces but does not -eliminate the incompatibilities; meanwhile, many users wish to compile -GNU software with pre-@sc{ansi} compilers. This chapter gives -recommendations for how to use the more or less standard C library -functions to avoid unnecessary loss of portability. - -@itemize @bullet -@item -Don't use the value of @code{sprintf}. It returns the number of -characters written on some systems, but not on all systems. - -@item -@code{main} should be declared to return type @code{int}. It should -terminate either by calling @code{exit} or by returning the integer -status code; make sure it cannot ever return an undefined value. - -@item -Don't declare system functions explicitly. - -Almost any declaration for a system function is wrong on some system. -To minimize conflicts, leave it to the system header files to declare -system functions. If the headers don't declare a function, let it -remain undeclared. - -While it may seem unclean to use a function without declaring it, in -practice this works fine for most system library functions on the -systems where this really happens; thus, the disadvantage is only -theoretical. By contrast, actual declarations have frequently caused -actual conflicts. - -@item -If you must declare a system function, don't specify the argument types. -Use an old-style declaration, not an @sc{ansi} prototype. The more you -specify about the function, the more likely a conflict. - -@item -In particular, don't unconditionally declare @code{malloc} or -@code{realloc}. - -Most GNU programs use those functions just once, in functions -conventionally named @code{xmalloc} and @code{xrealloc}. These -functions call @code{malloc} and @code{realloc}, respectively, and -check the results. - -Because @code{xmalloc} and @code{xrealloc} are defined in your program, -you can declare them in other files without any risk of type conflict. - -On most systems, @code{int} is the same length as a pointer; thus, the -calls to @code{malloc} and @code{realloc} work fine. For the few -exceptional systems (mostly 64-bit machines), you can use -@strong{conditionalized} declarations of @code{malloc} and -@code{realloc}---or put these declarations in configuration files -specific to those systems. - -@item -The string functions require special treatment. Some Unix systems have -a header file @file{string.h}; others have @file{strings.h}. Neither -file name is portable. There are two things you can do: use Autoconf to -figure out which file to include, or don't include either file. - -@item -If you don't include either strings file, you can't get declarations for -the string functions from the header file in the usual way. - -That causes less of a problem than you might think. The newer @sc{ansi} -string functions should be avoided anyway because many systems still -don't support them. The string functions you can use are these: - -@example -strcpy strncpy strcat strncat -strlen strcmp strncmp -strchr strrchr -@end example - -The copy and concatenate functions work fine without a declaration as -long as you don't use their values. Using their values without a -declaration fails on systems where the width of a pointer differs from -the width of @code{int}, and perhaps in other cases. It is trivial to -avoid using their values, so do that. - -The compare functions and @code{strlen} work fine without a declaration -on most systems, possibly all the ones that GNU software runs on. -You may find it necessary to declare them @strong{conditionally} on a -few systems. - -The search functions must be declared to return @code{char *}. Luckily, -there is no variation in the data type they return. But there is -variation in their names. Some systems give these functions the names -@code{index} and @code{rindex}; other systems use the names -@code{strchr} and @code{strrchr}. Some systems support both pairs of -names, but neither pair works on all systems. - -You should pick a single pair of names and use it throughout your -program. (Nowadays, it is better to choose @code{strchr} and -@code{strrchr} for new programs, since those are the standard @sc{ansi} -names.) Declare both of those names as functions returning @code{char -*}. On systems which don't support those names, define them as macros -in terms of the other pair. For example, here is what to put at the -beginning of your file (or in a header) if you want to use the names -@code{strchr} and @code{strrchr} throughout: - -@example -#ifndef HAVE_STRCHR -#define strchr index -#endif -#ifndef HAVE_STRRCHR -#define strrchr rindex -#endif - -char *strchr (); -char *strrchr (); -@end example -@end itemize - -Here we assume that @code{HAVE_STRCHR} and @code{HAVE_STRRCHR} are -macros defined in systems where the corresponding functions exist. -One way to get them properly defined is to use Autoconf. - -@node Internationalization -@section Internationalization - -GNU has a library called GNU gettext that makes it easy to translate the -messages in a program into various languages. You should use this -library in every program. Use English for the messages as they appear -in the program, and let gettext provide the way to translate them into -other languages. - -Using GNU gettext involves putting a call to the @code{gettext} macro -around each string that might need translation---like this: - -@example -printf (gettext ("Processing file `%s'...")); -@end example - -@noindent -This permits GNU gettext to replace the string @code{"Processing file -`%s'..."} with a translated version. - -Once a program uses gettext, please make a point of writing calls to -@code{gettext} when you add new strings that call for translation. - -Using GNU gettext in a package involves specifying a @dfn{text domain -name} for the package. The text domain name is used to separate the -translations for this package from the translations for other packages. -Normally, the text domain name should be the same as the name of the -package---for example, @samp{fileutils} for the GNU file utilities. - -To enable gettext to work well, avoid writing code that makes -assumptions about the structure of words or sentences. When you want -the precise text of a sentence to vary depending on the data, use two or -more alternative string constants each containing a complete sentences, -rather than inserting conditionalized words or phrases into a single -sentence framework. - -Here is an example of what not to do: - -@example -printf ("%d file%s processed", nfiles, - nfiles != 1 ? "s" : ""); -@end example - -@noindent -The problem with that example is that it assumes that plurals are made -by adding `s'. If you apply gettext to the format string, like this, - -@example -printf (gettext ("%d file%s processed"), nfiles, - nfiles != 1 ? "s" : ""); -@end example - -@noindent -the message can use different words, but it will still be forced to use -`s' for the plural. Here is a better way: - -@example -printf ((nfiles != 1 ? "%d files processed" - : "%d file processed"), - nfiles); -@end example - -@noindent -This way, you can apply gettext to each of the two strings -independently: - -@example -printf ((nfiles != 1 ? gettext ("%d files processed") - : gettext ("%d file processed")), - nfiles); -@end example - -@noindent -This can be any method of forming the plural of the word for ``file'', and -also handles languages that require agreement in the word for -``processed''. - -A similar problem appears at the level of sentence structure with this -code: - -@example -printf ("# Implicit rule search has%s been done.\n", - f->tried_implicit ? "" : " not"); -@end example - -@noindent -Adding @code{gettext} calls to this code cannot give correct results for -all languages, because negation in some languages requires adding words -at more than one place in the sentence. By contrast, adding -@code{gettext} calls does the job straightfowardly if the code starts -out like this: - -@example -printf (f->tried_implicit - ? "# Implicit rule search has been done.\n", - : "# Implicit rule search has not been done.\n"); -@end example - -@node Mmap -@section Mmap - -Don't assume that @code{mmap} either works on all files or fails -for all files. It may work on some files and fail on others. - -The proper way to use @code{mmap} is to try it on the specific file for -which you want to use it---and if @code{mmap} doesn't work, fall back on -doing the job in another way using @code{read} and @code{write}. - -The reason this precaution is needed is that the GNU kernel (the HURD) -provides a user-extensible file system, in which there can be many -different kinds of ``ordinary files.'' Many of them support -@code{mmap}, but some do not. It is important to make programs handle -all these kinds of files. - -@node Documentation -@chapter Documenting Programs - -@menu -* GNU Manuals:: Writing proper manuals. -* Manual Structure Details:: Specific structure conventions. -* NEWS File:: NEWS files supplement manuals. -* Change Logs:: Recording Changes -* Man Pages:: Man pages are secondary. -* Reading other Manuals:: How far you can go in learning - from other manuals. -@end menu - -@node GNU Manuals -@section GNU Manuals - -The preferred way to document part of the GNU system is to write a -manual in the Texinfo formatting language. See the Texinfo manual, -either the hardcopy, or the on-line version available through -@code{info} or the Emacs Info subsystem (@kbd{C-h i}). - -Programmers often find it most natural to structure the documentation -following the structure of the implementation, which they know. But -this structure is not necessarily good for explaining how to use the -program; it may be irrelevant and confusing for a user. - -At every level, from the sentences in a paragraph to the grouping of -topics into separate manuals, the right way to structure documentation -is according to the concepts and questions that a user will have in mind -when reading it. Sometimes this structure of ideas matches the -structure of the implementation of the software being documented---but -often they are different. Often the most important part of learning to -write good documentation is learning to notice when you are structuring -the documentation like the implementation, and think about better -alternatives. - -For example, each program in the GNU system probably ought to be -documented in one manual; but this does not mean each program should -have its own manual. That would be following the structure of the -implementation, rather than the structure that helps the user -understand. - -Instead, each manual should cover a coherent @emph{topic}. For example, -instead of a manual for @code{diff} and a manual for @code{diff3}, we -have one manual for ``comparison of files'' which covers both of those -programs, as well as @code{cmp}. By documenting these programs -together, we can make the whole subject clearer. - -The manual which discusses a program should document all of the -program's command-line options and all of its commands. It should give -examples of their use. But don't organize the manual as a list of -features. Instead, organize it logically, by subtopics. Address the -questions that a user will ask when thinking about the job that the -program does. - -In general, a GNU manual should serve both as tutorial and reference. -It should be set up for convenient access to each topic through Info, -and for reading straight through (appendixes aside). A GNU manual -should give a good introduction to a beginner reading through from the -start, and should also provide all the details that hackers want. - -That is not as hard as it first sounds. Arrange each chapter as a -logical breakdown of its topic, but order the sections, and write their -text, so that reading the chapter straight through makes sense. Do -likewise when structuring the book into chapters, and when structuring a -section into paragraphs. The watchword is, @emph{at each point, address -the most fundamental and important issue raised by the preceding text.} - -If necessary, add extra chapters at the beginning of the manual which -are purely tutorial and cover the basics of the subject. These provide -the framework for a beginner to understand the rest of the manual. The -Bison manual provides a good example of how to do this. - -Don't use Unix man pages as a model for how to write GNU documentation; -most of them are terse, badly structured, and give inadequate -explanation of the underlying concepts. (There are, of course -exceptions.) Also Unix man pages use a particular format which is -different from what we use in GNU manuals. - -Please do not use the term ``pathname'' that is used in Unix -documentation; use ``file name'' (two words) instead. We use the term -``path'' only for search paths, which are lists of file names. - -Please do not use the term ``illegal'' to refer to erroneous input to a -computer program. Please use ``invalid'' for this, and reserve the term -``illegal'' for violations of law. - -@node Manual Structure Details -@section Manual Structure Details - -The title page of the manual should state the version of the programs or -packages documented in the manual. The Top node of the manual should -also contain this information. If the manual is changing more -frequently than or independent of the program, also state a version -number for the manual in both of these places. - -Each program documented in the manual should should have a node named -@samp{@var{program} Invocation} or @samp{Invoking @var{program}}. This -node (together with its subnodes, if any) should describe the program's -command line arguments and how to run it (the sort of information people -would look in a man page for). Start with an @samp{@@example} -containing a template for all the options and arguments that the program -uses. - -Alternatively, put a menu item in some menu whose item name fits one of -the above patterns. This identifies the node which that item points to -as the node for this purpose, regardless of the node's actual name. - -There will be automatic features for specifying a program name and -quickly reading just this part of its manual. - -If one manual describes several programs, it should have such a node for -each program described. - -@node NEWS File -@section The NEWS File - -In addition to its manual, the package should have a file named -@file{NEWS} which contains a list of user-visible changes worth -mentioning. In each new release, add items to the front of the file and -identify the version they pertain to. Don't discard old items; leave -them in the file after the newer items. This way, a user upgrading from -any previous version can see what is new. - -If the @file{NEWS} file gets very long, move some of the older items -into a file named @file{ONEWS} and put a note at the end referring the -user to that file. - -@node Change Logs -@section Change Logs - -Keep a change log to describe all the changes made to program source -files. The purpose of this is so that people investigating bugs in the -future will know about the changes that might have introduced the bug. -Often a new bug can be found by looking at what was recently changed. -More importantly, change logs can help you eliminate conceptual -inconsistencies between different parts of a program, by giving you a -history of how the conflicting concepts arose and who they came from. - -@menu -* Change Log Concepts:: -* Style of Change Logs:: -* Simple Changes:: -* Conditional Changes:: -@end menu - -@node Change Log Concepts -@subsection Change Log Concepts - -You can think of the change log as a conceptual ``undo list'' which -explains how earlier versions were different from the current version. -People can see the current version; they don't need the change log -to tell them what is in it. What they want from a change log is a -clear explanation of how the earlier version differed. - -The change log file is normally called @file{ChangeLog} and covers an -entire directory. Each directory can have its own change log, or a -directory can use the change log of its parent directory--it's up to -you. - -Another alternative is to record change log information with a version -control system such as RCS or CVS. This can be converted automatically -to a @file{ChangeLog} file. - -There's no need to describe the full purpose of the changes or how they -work together. If you think that a change calls for explanation, you're -probably right. Please do explain it---but please put the explanation -in comments in the code, where people will see it whenever they see the -code. For example, ``New function'' is enough for the change log when -you add a function, because there should be a comment before the -function definition to explain what it does. - -However, sometimes it is useful to write one line to describe the -overall purpose of a batch of changes. - -The easiest way to add an entry to @file{ChangeLog} is with the Emacs -command @kbd{M-x add-change-log-entry}. An entry should have an -asterisk, the name of the changed file, and then in parentheses the name -of the changed functions, variables or whatever, followed by a colon. -Then describe the changes you made to that function or variable. - -@node Style of Change Logs -@subsection Style of Change Logs - -Here are some examples of change log entries: - -@example -* register.el (insert-register): Return nil. -(jump-to-register): Likewise. - -* sort.el (sort-subr): Return nil. - -* tex-mode.el (tex-bibtex-file, tex-file, tex-region): -Restart the tex shell if process is gone or stopped. -(tex-shell-running): New function. - -* expr.c (store_one_arg): Round size up for move_block_to_reg. -(expand_call): Round up when emitting USE insns. -* stmt.c (assign_parms): Round size up for move_block_from_reg. -@end example - -It's important to name the changed function or variable in full. Don't -abbreviate function or variable names, and don't combine them. -Subsequent maintainers will often search for a function name to find all -the change log entries that pertain to it; if you abbreviate the name, -they won't find it when they search. - -For example, some people are tempted to abbreviate groups of function -names by writing @samp{* register.el (@{insert,jump-to@}-register)}; -this is not a good idea, since searching for @code{jump-to-register} or -@code{insert-register} would not find that entry. - -Separate unrelated change log entries with blank lines. When two -entries represent parts of the same change, so that they work together, -then don't put blank lines between them. Then you can omit the file -name and the asterisk when successive entries are in the same file. - -@node Simple Changes -@subsection Simple Changes - -Certain simple kinds of changes don't need much detail in the change -log. - -When you change the calling sequence of a function in a simple fashion, -and you change all the callers of the function, there is no need to make -individual entries for all the callers that you changed. Just write in -the entry for the function being called, ``All callers changed.'' - -@example -* keyboard.c (Fcommand_execute): New arg SPECIAL. -All callers changed. -@end example - -When you change just comments or doc strings, it is enough to write an -entry for the file, without mentioning the functions. Just ``Doc -fixes'' is enough for the change log. - -There's no need to make change log entries for documentation files. -This is because documentation is not susceptible to bugs that are hard -to fix. Documentation does not consist of parts that must interact in a -precisely engineered fashion. To correct an error, you need not know -the history of the erroneous passage; it is enough to compare what the -documentation says with the way the program actually works. - -@node Conditional Changes -@subsection Conditional Changes - -C programs often contain compile-time @code{#if} conditionals. Many -changes are conditional; sometimes you add a new definition which is -entirely contained in a conditional. It is very useful to indicate in -the change log the conditions for which the change applies. - -Our convention for indicating conditional changes is to use square -brackets around the name of the condition. - -Here is a simple example, describing a change which is conditional but -does not have a function or entity name associated with it: - -@example -* xterm.c [SOLARIS2]: Include string.h. -@end example - -Here is an entry describing a new definition which is entirely -conditional. This new definition for the macro @code{FRAME_WINDOW_P} is -used only when @code{HAVE_X_WINDOWS} is defined: - -@example -* frame.h [HAVE_X_WINDOWS] (FRAME_WINDOW_P): Macro defined. -@end example - -Here is an entry for a change within the function @code{init_display}, -whose definition as a whole is unconditional, but the changes themselves -are contained in a @samp{#ifdef HAVE_LIBNCURSES} conditional: - -@example -* dispnew.c (init_display) [HAVE_LIBNCURSES]: If X, call tgetent. -@end example - -Here is an entry for a change that takes affect only when -a certain macro is @emph{not} defined: - -@example -(gethostname) [!HAVE_SOCKETS]: Replace with winsock version. -@end example - -@node Man Pages -@section Man Pages - -In the GNU project, man pages are secondary. It is not necessary or -expected for every GNU program to have a man page, but some of them do. -It's your choice whether to include a man page in your program. - -When you make this decision, consider that supporting a man page -requires continual effort each time the program is changed. The time -you spend on the man page is time taken away from more useful work. - -For a simple program which changes little, updating the man page may be -a small job. Then there is little reason not to include a man page, if -you have one. - -For a large program that changes a great deal, updating a man page may -be a substantial burden. If a user offers to donate a man page, you may -find this gift costly to accept. It may be better to refuse the man -page unless the same person agrees to take full responsibility for -maintaining it---so that you can wash your hands of it entirely. If -this volunteer later ceases to do the job, then don't feel obliged to -pick it up yourself; it may be better to withdraw the man page from the -distribution until someone else agrees to update it. - -When a program changes only a little, you may feel that the -discrepancies are small enough that the man page remains useful without -updating. If so, put a prominent note near the beginning of the man -page explaining that you don't maintain it and that the Texinfo manual -is more authoritative. The note should say how to access the Texinfo -documentation. - -@node Reading other Manuals -@section Reading other Manuals - -There may be non-free books or documentation files that describe the -program you are documenting. - -It is ok to use these documents for reference, just as the author of a -new algebra textbook can read other books on algebra. A large portion -of any non-fiction book consists of facts, in this case facts about how -a certain program works, and these facts are necessarily the same for -everyone who writes about the subject. But be careful not to copy your -outline structure, wording, tables or examples from preexisting non-free -documentation. Copying from free documentation may be ok; please check -with the FSF about the individual case. - -@node Managing Releases -@chapter The Release Process - -Making a release is more than just bundling up your source files in a -tar file and putting it up for FTP. You should set up your software so -that it can be configured to run on a variety of systems. Your Makefile -should conform to the GNU standards described below, and your directory -layout should also conform to the standards discussed below. Doing so -makes it easy to include your package into the larger framework of -all GNU software. - -@menu -* Configuration:: How Configuration Should Work -* Makefile Conventions:: Makefile Conventions -* Releases:: Making Releases -@end menu - -@node Configuration -@section How Configuration Should Work - -Each GNU distribution should come with a shell script named -@code{configure}. This script is given arguments which describe the -kind of machine and system you want to compile the program for. - -The @code{configure} script must record the configuration options so -that they affect compilation. - -One way to do this is to make a link from a standard name such as -@file{config.h} to the proper configuration file for the chosen system. -If you use this technique, the distribution should @emph{not} contain a -file named @file{config.h}. This is so that people won't be able to -build the program without configuring it first. - -Another thing that @code{configure} can do is to edit the Makefile. If -you do this, the distribution should @emph{not} contain a file named -@file{Makefile}. Instead, it should include a file @file{Makefile.in} which -contains the input used for editing. Once again, this is so that people -won't be able to build the program without configuring it first. - -If @code{configure} does write the @file{Makefile}, then @file{Makefile} -should have a target named @file{Makefile} which causes @code{configure} -to be rerun, setting up the same configuration that was set up last -time. The files that @code{configure} reads should be listed as -dependencies of @file{Makefile}. - -All the files which are output from the @code{configure} script should -have comments at the beginning explaining that they were generated -automatically using @code{configure}. This is so that users won't think -of trying to edit them by hand. - -The @code{configure} script should write a file named @file{config.status} -which describes which configuration options were specified when the -program was last configured. This file should be a shell script which, -if run, will recreate the same configuration. - -The @code{configure} script should accept an option of the form -@samp{--srcdir=@var{dirname}} to specify the directory where sources are found -(if it is not the current directory). This makes it possible to build -the program in a separate directory, so that the actual source directory -is not modified. - -If the user does not specify @samp{--srcdir}, then @code{configure} should -check both @file{.} and @file{..} to see if it can find the sources. If -it finds the sources in one of these places, it should use them from -there. Otherwise, it should report that it cannot find the sources, and -should exit with nonzero status. - -Usually the easy way to support @samp{--srcdir} is by editing a -definition of @code{VPATH} into the Makefile. Some rules may need to -refer explicitly to the specified source directory. To make this -possible, @code{configure} can add to the Makefile a variable named -@code{srcdir} whose value is precisely the specified directory. - -The @code{configure} script should also take an argument which specifies the -type of system to build the program for. This argument should look like -this: - -@example -@var{cpu}-@var{company}-@var{system} -@end example - -For example, a Sun 3 might be @samp{m68k-sun-sunos4.1}. - -The @code{configure} script needs to be able to decode all plausible -alternatives for how to describe a machine. Thus, @samp{sun3-sunos4.1} -would be a valid alias. For many programs, @samp{vax-dec-ultrix} would -be an alias for @samp{vax-dec-bsd}, simply because the differences -between Ultrix and @sc{BSD} are rarely noticeable, but a few programs -might need to distinguish them. -@c Real 4.4BSD now runs on some Suns. - -There is a shell script called @file{config.sub} that you can use -as a subroutine to validate system types and canonicalize aliases. - -Other options are permitted to specify in more detail the software -or hardware present on the machine, and include or exclude optional -parts of the package: - -@table @samp -@item --enable-@var{feature}@r{[}=@var{parameter}@r{]} -Configure the package to build and install an optional user-level -facility called @var{feature}. This allows users to choose which -optional features to include. Giving an optional @var{parameter} of -@samp{no} should omit @var{feature}, if it is built by default. - -No @samp{--enable} option should @strong{ever} cause one feature to -replace another. No @samp{--enable} option should ever substitute one -useful behavior for another useful behavior. The only proper use for -@samp{--enable} is for questions of whether to build part of the program -or exclude it. - -@item --with-@var{package} -@c @r{[}=@var{parameter}@r{]} -The package @var{package} will be installed, so configure this package -to work with @var{package}. - -@c Giving an optional @var{parameter} of -@c @samp{no} should omit @var{package}, if it is used by default. - -Possible values of @var{package} include -@samp{gnu-as} (or @samp{gas}), @samp{gnu-ld}, @samp{gnu-libc}, -@samp{gdb}, -@samp{x}, -and -@samp{x-toolkit}. - -Do not use a @samp{--with} option to specify the file name to use to -find certain files. That is outside the scope of what @samp{--with} -options are for. - -@item --nfp -The target machine has no floating point processor. - -@item --gas -The target machine assembler is GAS, the GNU assembler. -This is obsolete; users should use @samp{--with-gnu-as} instead. - -@item --x -The target machine has the X Window System installed. -This is obsolete; users should use @samp{--with-x} instead. -@end table - -All @code{configure} scripts should accept all of these ``detail'' -options, whether or not they make any difference to the particular -package at hand. In particular, they should accept any option that -starts with @samp{--with-} or @samp{--enable-}. This is so users will -be able to configure an entire GNU source tree at once with a single set -of options. - -You will note that the categories @samp{--with-} and @samp{--enable-} -are narrow: they @strong{do not} provide a place for any sort of option -you might think of. That is deliberate. We want to limit the possible -configuration options in GNU software. We do not want GNU programs to -have idiosyncratic configuration options. - -Packages that perform part of the compilation process may support cross-compilation. -In such a case, the host and target machines for the program may be -different. The @code{configure} script should normally treat the -specified type of system as both the host and the target, thus producing -a program which works for the same type of machine that it runs on. - -The way to build a cross-compiler, cross-assembler, or what have you, is -to specify the option @samp{--host=@var{hosttype}} when running -@code{configure}. This specifies the host system without changing the -type of target system. The syntax for @var{hosttype} is the same as -described above. - -Bootstrapping a cross-compiler requires compiling it on a machine other -than the host it will run on. Compilation packages accept a -configuration option @samp{--build=@var{hosttype}} for specifying the -configuration on which you will compile them, in case that is different -from the host. - -Programs for which cross-operation is not meaningful need not accept the -@samp{--host} option, because configuring an entire operating system for -cross-operation is not a meaningful thing. - -Some programs have ways of configuring themselves automatically. If -your program is set up to do this, your @code{configure} script can simply -ignore most of its arguments. - -@comment The makefile standards are in a separate file that is also -@comment included by make.texinfo. Done by roland@gnu.ai.mit.edu on 1/6/93. -@comment For this document, turn chapters into sections, etc. -@lowersections -@include make-stds.texi -@raisesections - -@node Releases -@section Making Releases - -Package the distribution of @code{Foo version 69.96} up in a gzipped tar -file with the name @file{foo-69.96.tar.gz}. It should unpack into a -subdirectory named @file{foo-69.96}. - -Building and installing the program should never modify any of the files -contained in the distribution. This means that all the files that form -part of the program in any way must be classified into @dfn{source -files} and @dfn{non-source files}. Source files are written by humans -and never changed automatically; non-source files are produced from -source files by programs under the control of the Makefile. - -Naturally, all the source files must be in the distribution. It is okay -to include non-source files in the distribution, provided they are -up-to-date and machine-independent, so that building the distribution -normally will never modify them. We commonly include non-source files -produced by Bison, @code{lex}, @TeX{}, and @code{makeinfo}; this helps avoid -unnecessary dependencies between our distributions, so that users can -install whichever packages they want to install. - -Non-source files that might actually be modified by building and -installing the program should @strong{never} be included in the -distribution. So if you do distribute non-source files, always make -sure they are up to date when you make a new distribution. - -Make sure that the directory into which the distribution unpacks (as -well as any subdirectories) are all world-writable (octal mode 777). -This is so that old versions of @code{tar} which preserve the -ownership and permissions of the files from the tar archive will be -able to extract all the files even if the user is unprivileged. - -Make sure that all the files in the distribution are world-readable. - -Make sure that no file name in the distribution is more than 14 -characters long. Likewise, no file created by building the program -should have a name longer than 14 characters. The reason for this is -that some systems adhere to a foolish interpretation of the POSIX -standard, and refuse to open a longer name, rather than truncating as -they did in the past. - -Don't include any symbolic links in the distribution itself. If the tar -file contains symbolic links, then people cannot even unpack it on -systems that don't support symbolic links. Also, don't use multiple -names for one file in different directories, because certain file -systems cannot handle this and that prevents unpacking the -distribution. - -Try to make sure that all the file names will be unique on MS-DOS. A -name on MS-DOS consists of up to 8 characters, optionally followed by a -period and up to three characters. MS-DOS will truncate extra -characters both before and after the period. Thus, -@file{foobarhacker.c} and @file{foobarhacker.o} are not ambiguous; they -are truncated to @file{foobarha.c} and @file{foobarha.o}, which are -distinct. - -Include in your distribution a copy of the @file{texinfo.tex} you used -to test print any @file{*.texinfo} or @file{*.texi} files. - -Likewise, if your program uses small GNU software packages like regex, -getopt, obstack, or termcap, include them in the distribution file. -Leaving them out would make the distribution file a little smaller at -the expense of possible inconvenience to a user who doesn't know what -other files to get. - -@contents - -@bye -Local variables: -update-date-leading-regexp: "@c This date is automagically updated when you save this file:\n@set lastupdate " -update-date-trailing-regexp: "" -eval: (load "/gd/gnuorg/update-date.el") -eval: (add-hook 'write-file-hooks 'update-date) -End: diff --git a/contrib/binutils/gas/acconfig.h b/contrib/binutils/gas/acconfig.h deleted file mode 100644 index c9c60025c757..000000000000 --- a/contrib/binutils/gas/acconfig.h +++ /dev/null @@ -1,79 +0,0 @@ -/* Name of package. */ -#undef PACKAGE - -/* Version of package. */ -#undef VERSION - -/* Should gas use high-level BFD interfaces? */ -#undef BFD_ASSEMBLER - -/* Some assert/preprocessor combinations are incapable of handling - certain kinds of constructs in the argument of assert. For example, - quoted strings (if requoting isn't done right) or newlines. */ -#undef BROKEN_ASSERT - -/* If we aren't doing cross-assembling, some operations can be optimized, - since byte orders and value sizes don't need to be adjusted. */ -#undef CROSS_COMPILE - -/* Some gas code wants to know these parameters. */ -#undef TARGET_ALIAS -#undef TARGET_CPU -#undef TARGET_CANONICAL -#undef TARGET_OS -#undef TARGET_VENDOR - -/* Sometimes the system header files don't declare strstr. */ -#undef NEED_DECLARATION_STRSTR - -/* Sometimes the system header files don't declare malloc and realloc. */ -#undef NEED_DECLARATION_MALLOC - -/* Sometimes the system header files don't declare free. */ -#undef NEED_DECLARATION_FREE - -/* Sometimes the system header files don't declare sbrk. */ -#undef NEED_DECLARATION_SBRK - -/* Sometimes errno.h doesn't declare errno itself. */ -#undef NEED_DECLARATION_ERRNO - -#undef MANY_SEGMENTS - -/* The configure script defines this for some targets based on the - target name used. It is not always defined. */ -#undef TARGET_BYTES_BIG_ENDIAN - -/* Needed only for some configurations that can produce multiple output - formats. */ -#undef DEFAULT_EMULATION -#undef EMULATIONS -#undef USE_EMULATIONS -#undef OBJ_MAYBE_AOUT -#undef OBJ_MAYBE_BOUT -#undef OBJ_MAYBE_COFF -#undef OBJ_MAYBE_ECOFF -#undef OBJ_MAYBE_ELF -#undef OBJ_MAYBE_GENERIC -#undef OBJ_MAYBE_HP300 -#undef OBJ_MAYBE_IEEE -#undef OBJ_MAYBE_SOM -#undef OBJ_MAYBE_VMS - -/* Used for some of the COFF configurations, when the COFF code needs - to select something based on the CPU type before it knows it... */ -#undef I386COFF -#undef M68KCOFF -#undef M88KCOFF - -/* Using cgen code? */ -#undef USING_CGEN - -/* Needed only for sparc configuration. */ -#undef DEFAULT_ARCH - -/* Needed only for PowerPC Solaris. */ -#undef TARGET_SOLARIS_COMMENT - -/* Needed only for SCO 5. */ -#undef SCO_ELF diff --git a/contrib/binutils/gas/cgen.c b/contrib/binutils/gas/cgen.c deleted file mode 100644 index e15e1b65346b..000000000000 --- a/contrib/binutils/gas/cgen.c +++ /dev/null @@ -1,664 +0,0 @@ -/* GAS interface for targets using CGEN: Cpu tools GENerator. - Copyright (C) 1996, 1997, 1998, 1999 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 2, 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. */ - -#include <setjmp.h> -#include "ansidecl.h" -#include "libiberty.h" -#include "bfd.h" -#include "symcat.h" -#include "cgen-desc.h" -#include "as.h" -#include "subsegs.h" -#include "cgen.h" - -/* Opcode table descriptor, must be set by md_begin. */ - -CGEN_CPU_DESC gas_cgen_cpu_desc; - -/* Callback to insert a register into the symbol table. - A target may choose to let GAS parse the registers. - ??? Not currently used. */ - -void -cgen_asm_record_register (name, number) - char * name; - int number; -{ - /* Use symbol_create here instead of symbol_new so we don't try to - output registers into the object file's symbol table. */ - symbol_table_insert (symbol_create (name, reg_section, - number, & zero_address_frag)); -} - -/* We need to keep a list of fixups. We can't simply generate them as - we go, because that would require us to first create the frag, and - that would screw up references to ``.''. - - This is used by cpu's with simple operands. It keeps knowledge of what - an `expressionS' is and what a `fixup' is out of CGEN which for the time - being is preferable. - - OPINDEX is the index in the operand table. - OPINFO is something the caller chooses to help in reloc determination. */ - -struct fixup -{ - int opindex; - int opinfo; - expressionS exp; -}; - -static struct fixup fixups [GAS_CGEN_MAX_FIXUPS]; -static int num_fixups; - -/* Prepare to parse an instruction. - ??? May wish to make this static and delete calls in md_assemble. */ - -void -gas_cgen_init_parse () -{ - num_fixups = 0; -} - -/* Queue a fixup. */ - -static void -queue_fixup (opindex, opinfo, expP) - int opindex; - expressionS * expP; -{ - /* We need to generate a fixup for this expression. */ - if (num_fixups >= GAS_CGEN_MAX_FIXUPS) - as_fatal (_("too many fixups")); - fixups[num_fixups].exp = * expP; - fixups[num_fixups].opindex = opindex; - fixups[num_fixups].opinfo = opinfo; - ++ num_fixups; -} - -/* The following three functions allow a backup of the fixup chain to be made, - and to have this backup be swapped with the current chain. This allows - certain ports, eg the m32r, to swap two instructions and swap their fixups - at the same time. */ -/* ??? I think with cgen_asm_finish_insn (or something else) there is no - more need for this. */ - -static struct fixup saved_fixups [GAS_CGEN_MAX_FIXUPS]; -static int saved_num_fixups; - -void -gas_cgen_save_fixups () -{ - saved_num_fixups = num_fixups; - - memcpy (saved_fixups, fixups, sizeof (fixups[0]) * num_fixups); - - num_fixups = 0; -} - -void -gas_cgen_restore_fixups () -{ - num_fixups = saved_num_fixups; - - memcpy (fixups, saved_fixups, sizeof (fixups[0]) * num_fixups); - - saved_num_fixups = 0; -} - -void -gas_cgen_swap_fixups () -{ - int tmp; - struct fixup tmp_fixup; - - if (num_fixups == 0) - { - gas_cgen_restore_fixups (); - } - else if (saved_num_fixups == 0) - { - gas_cgen_save_fixups (); - } - else - { - tmp = saved_num_fixups; - saved_num_fixups = num_fixups; - num_fixups = tmp; - - for (tmp = GAS_CGEN_MAX_FIXUPS; tmp--;) - { - tmp_fixup = saved_fixups [tmp]; - saved_fixups [tmp] = fixups [tmp]; - fixups [tmp] = tmp_fixup; - } - } -} - -/* Default routine to record a fixup. - This is a cover function to fix_new. - It exists because we record INSN with the fixup. - - FRAG and WHERE are their respective arguments to fix_new_exp. - LENGTH is in bits. - OPINFO is something the caller chooses to help in reloc determination. - - At this point we do not use a bfd_reloc_code_real_type for - operands residing in the insn, but instead just use the - operand index. This lets us easily handle fixups for any - operand type. We pick a BFD reloc type in md_apply_fix. */ - -fixS * -gas_cgen_record_fixup (frag, where, insn, length, operand, opinfo, symbol, offset) - fragS * frag; - int where; - const CGEN_INSN * insn; - int length; - const CGEN_OPERAND * operand; - int opinfo; - symbolS * symbol; - offsetT offset; -{ - fixS * fixP; - - /* It may seem strange to use operand->attrs and not insn->attrs here, - but it is the operand that has a pc relative relocation. */ - - fixP = fix_new (frag, where, length / 8, symbol, offset, - CGEN_OPERAND_ATTR_VALUE (operand, CGEN_OPERAND_PCREL_ADDR), - (bfd_reloc_code_real_type) - ((int) BFD_RELOC_UNUSED - + (int) operand->type)); - fixP->fx_cgen.insn = insn; - fixP->fx_cgen.opinfo = opinfo; - - return fixP; -} - -/* Default routine to record a fixup given an expression. - This is a cover function to fix_new_exp. - It exists because we record INSN with the fixup. - - FRAG and WHERE are their respective arguments to fix_new_exp. - LENGTH is in bits. - OPINFO is something the caller chooses to help in reloc determination. - - At this point we do not use a bfd_reloc_code_real_type for - operands residing in the insn, but instead just use the - operand index. This lets us easily handle fixups for any - operand type. We pick a BFD reloc type in md_apply_fix. */ - -fixS * -gas_cgen_record_fixup_exp (frag, where, insn, length, operand, opinfo, exp) - fragS * frag; - int where; - const CGEN_INSN * insn; - int length; - const CGEN_OPERAND * operand; - int opinfo; - expressionS * exp; -{ - fixS * fixP; - - /* It may seem strange to use operand->attrs and not insn->attrs here, - but it is the operand that has a pc relative relocation. */ - - fixP = fix_new_exp (frag, where, length / 8, exp, - CGEN_OPERAND_ATTR_VALUE (operand, CGEN_OPERAND_PCREL_ADDR), - (bfd_reloc_code_real_type) - ((int) BFD_RELOC_UNUSED - + (int) operand->type)); - fixP->fx_cgen.insn = insn; - fixP->fx_cgen.opinfo = opinfo; - - return fixP; -} - -/* Used for communication between the next two procedures. */ -static jmp_buf expr_jmp_buf; - -/* Callback for cgen interface. Parse the expression at *STRP. - The result is an error message or NULL for success (in which case - *STRP is advanced past the parsed text). - WANT is an indication of what the caller is looking for. - If WANT == CGEN_ASM_PARSE_INIT the caller is beginning to try to match - a table entry with the insn, reset the queued fixups counter. - An enum cgen_parse_operand_result is stored in RESULTP. - OPINDEX is the operand's table entry index. - OPINFO is something the caller chooses to help in reloc determination. - The resulting value is stored in VALUEP. */ - -const char * -gas_cgen_parse_operand (cd, want, strP, opindex, opinfo, resultP, valueP) - CGEN_CPU_DESC cd; - enum cgen_parse_operand_type want; - const char ** strP; - int opindex; - int opinfo; - enum cgen_parse_operand_result * resultP; - bfd_vma * valueP; -{ -#ifdef __STDC__ - /* These are volatile to survive the setjmp. */ - char * volatile hold; - enum cgen_parse_operand_result * volatile resultP_1; -#else - static char * hold; - static enum cgen_parse_operand_result * resultP_1; -#endif - const char * errmsg = NULL; - expressionS exp; - - if (want == CGEN_PARSE_OPERAND_INIT) - { - gas_cgen_init_parse (); - return NULL; - } - - resultP_1 = resultP; - hold = input_line_pointer; - input_line_pointer = (char *) * strP; - - /* We rely on md_operand to longjmp back to us. - This is done via gas_cgen_md_operand. */ - if (setjmp (expr_jmp_buf) != 0) - { - input_line_pointer = (char *) hold; - * resultP_1 = CGEN_PARSE_OPERAND_RESULT_ERROR; - return "illegal operand"; - } - - expression (& exp); - - * strP = input_line_pointer; - input_line_pointer = hold; - - /* FIXME: Need to check `want'. */ - - switch (exp.X_op) - { - case O_illegal : - errmsg = _("illegal operand"); - * resultP = CGEN_PARSE_OPERAND_RESULT_ERROR; - break; - case O_absent : - errmsg = _("missing operand"); - * resultP = CGEN_PARSE_OPERAND_RESULT_ERROR; - break; - case O_constant : - * valueP = exp.X_add_number; - * resultP = CGEN_PARSE_OPERAND_RESULT_NUMBER; - break; - case O_register : - * valueP = exp.X_add_number; - * resultP = CGEN_PARSE_OPERAND_RESULT_REGISTER; - break; - default : - queue_fixup (opindex, opinfo, & exp); - * valueP = 0; - * resultP = CGEN_PARSE_OPERAND_RESULT_QUEUED; - break; - } - - return errmsg; -} - -/* md_operand handler to catch unrecognized expressions and halt the - parsing process so the next entry can be tried. - - ??? This could be done differently by adding code to `expression'. */ - -void -gas_cgen_md_operand (expressionP) - expressionS * expressionP; -{ - longjmp (expr_jmp_buf, 1); -} - -/* Finish assembling instruction INSN. - BUF contains what we've built up so far. - LENGTH is the size of the insn in bits. - RELAX_P is non-zero if relaxable insns should be emitted as such. - Otherwise they're emitted in non-relaxable forms. - The "result" is stored in RESULT if non-NULL. */ - -void -gas_cgen_finish_insn (insn, buf, length, relax_p, result) - const CGEN_INSN * insn; - CGEN_INSN_BYTES_PTR buf; - unsigned int length; - int relax_p; - finished_insnS * result; -{ - int i; - int relax_operand; - char * f; - unsigned int byte_len = length / 8; - - /* ??? Target foo issues various warnings here, so one might want to provide - a hook here. However, our caller is defined in tc-foo.c so there - shouldn't be a need for a hook. */ - - /* Write out the instruction. - It is important to fetch enough space in one call to `frag_more'. - We use (f - frag_now->fr_literal) to compute where we are and we - don't want frag_now to change between calls. - - Relaxable instructions: We need to ensure we allocate enough - space for the largest insn. */ - - if (CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_RELAX)) - abort (); /* These currently shouldn't get here. */ - - /* Is there a relaxable insn with the relaxable operand needing a fixup? */ - - relax_operand = -1; - if (relax_p && CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_RELAXABLE)) - { - /* Scan the fixups for the operand affected by relaxing - (i.e. the branch address). */ - - for (i = 0; i < num_fixups; ++ i) - { - if (CGEN_OPERAND_ATTR_VALUE (cgen_operand_lookup_by_num (gas_cgen_cpu_desc, fixups[i].opindex), - CGEN_OPERAND_RELAX)) - { - relax_operand = i; - break; - } - } - } - - if (relax_operand != -1) - { - int max_len; - fragS * old_frag; - -#ifdef TC_CGEN_MAX_RELAX - max_len = TC_CGEN_MAX_RELAX (insn, byte_len); -#else - max_len = CGEN_MAX_INSN_SIZE; -#endif - /* Ensure variable part and fixed part are in same fragment. */ - /* FIXME: Having to do this seems like a hack. */ - frag_grow (max_len); - - /* Allocate space for the fixed part. */ - f = frag_more (byte_len); - - /* Create a relaxable fragment for this instruction. */ - old_frag = frag_now; - - frag_var (rs_machine_dependent, - max_len - byte_len /* max chars */, - 0 /* variable part already allocated */, - /* FIXME: When we machine generate the relax table, - machine generate a macro to compute subtype. */ - 1 /* subtype */, - fixups[relax_operand].exp.X_add_symbol, - fixups[relax_operand].exp.X_add_number, - f); - - /* Record the operand number with the fragment so md_convert_frag - can use gas_cgen_md_record_fixup to record the appropriate reloc. */ - old_frag->fr_cgen.insn = insn; - old_frag->fr_cgen.opindex = fixups[relax_operand].opindex; - old_frag->fr_cgen.opinfo = fixups[relax_operand].opinfo; - if (result) - result->frag = old_frag; - } - else - { - f = frag_more (byte_len); - if (result) - result->frag = frag_now; - } - - /* If we're recording insns as numbers (rather than a string of bytes), - target byte order handling is deferred until now. */ -#if CGEN_INT_INSN_P - cgen_put_insn_value (gas_cgen_cpu_desc, f, length, *buf); -#else - memcpy (f, buf, byte_len); -#endif - - /* Create any fixups. */ - for (i = 0; i < num_fixups; ++i) - { - fixS *fixP; - const CGEN_OPERAND *operand = - cgen_operand_lookup_by_num (gas_cgen_cpu_desc, fixups[i].opindex); - - /* Don't create fixups for these. That's done during relaxation. - We don't need to test for CGEN_INSN_RELAX as they can't get here - (see above). */ - if (relax_p - && CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_RELAXABLE) - && CGEN_OPERAND_ATTR_VALUE (operand, CGEN_OPERAND_RELAX)) - continue; - -#ifndef md_cgen_record_fixup_exp -#define md_cgen_record_fixup_exp gas_cgen_record_fixup_exp -#endif - - fixP = md_cgen_record_fixup_exp (frag_now, f - frag_now->fr_literal, - insn, length, operand, - fixups[i].opinfo, - & fixups[i].exp); - if (result) - result->fixups[i] = fixP; - } - - if (result) - { - result->num_fixups = num_fixups; - result->addr = f; - } -} - -/* Apply a fixup to the object code. This is called for all the - fixups we generated by the call to fix_new_exp, above. In the call - above we used a reloc code which was the largest legal reloc code - plus the operand index. Here we undo that to recover the operand - index. At this point all symbol values should be fully resolved, - and we attempt to completely resolve the reloc. If we can not do - that, we determine the correct reloc code and put it back in the fixup. */ - -/* FIXME: This function handles some of the fixups and bfd_install_relocation - handles the rest. bfd_install_relocation (or some other bfd function) - should handle them all. */ - -int -gas_cgen_md_apply_fix3 (fixP, valueP, seg) - fixS * fixP; - valueT * valueP; - segT seg; -{ - char * where = fixP->fx_frag->fr_literal + fixP->fx_where; - valueT value; - /* canonical name, since used a lot */ - CGEN_CPU_DESC cd = gas_cgen_cpu_desc; - - /* FIXME FIXME FIXME: The value we are passed in *valuep includes - the symbol values. Since we are using BFD_ASSEMBLER, if we are - doing this relocation the code in write.c is going to call - bfd_install_relocation, which is also going to use the symbol - value. That means that if the reloc is fully resolved we want to - use *valuep since bfd_install_relocation is not being used. - However, if the reloc is not fully resolved we do not want to use - *valuep, and must use fx_offset instead. However, if the reloc - is PC relative, we do want to use *valuep since it includes the - result of md_pcrel_from. This is confusing. */ - - if (fixP->fx_addsy == (symbolS *) NULL) - { - value = * valueP; - fixP->fx_done = 1; - } - else if (fixP->fx_pcrel) - value = * valueP; - else - { - value = fixP->fx_offset; - if (fixP->fx_subsy != (symbolS *) NULL) - { - if (S_GET_SEGMENT (fixP->fx_subsy) == absolute_section) - value -= S_GET_VALUE (fixP->fx_subsy); - else - { - /* We don't actually support subtracting a symbol. */ - as_bad_where (fixP->fx_file, fixP->fx_line, - _("expression too complex")); - } - } - } - - if ((int) fixP->fx_r_type >= (int) BFD_RELOC_UNUSED) - { - int opindex = (int) fixP->fx_r_type - (int) BFD_RELOC_UNUSED; - const CGEN_OPERAND *operand = cgen_operand_lookup_by_num (cd, opindex); - const char *errmsg; - bfd_reloc_code_real_type reloc_type; - CGEN_FIELDS *fields = alloca (CGEN_CPU_SIZEOF_FIELDS (cd)); - const CGEN_INSN *insn = fixP->fx_cgen.insn; - - /* If the reloc has been fully resolved finish the operand here. */ - /* FIXME: This duplicates the capabilities of code in BFD. */ - if (fixP->fx_done - /* FIXME: If partial_inplace isn't set bfd_install_relocation won't - finish the job. Testing for pcrel is a temporary hack. */ - || fixP->fx_pcrel) - { - CGEN_CPU_SET_FIELDS_BITSIZE (cd) (fields, CGEN_INSN_BITSIZE (insn)); - CGEN_CPU_SET_VMA_OPERAND (cd) (cd, opindex, fields, (bfd_vma) value); - -#if CGEN_INT_INSN_P - { - CGEN_INSN_INT insn_value = - cgen_get_insn_value (cd, where, CGEN_INSN_BITSIZE (insn)); - - /* ??? 0 is passed for `pc' */ - errmsg = CGEN_CPU_INSERT_OPERAND (cd) (cd, opindex, fields, - &insn_value, (bfd_vma) 0); - cgen_put_insn_value (cd, where, CGEN_INSN_BITSIZE (insn), - insn_value); - } -#else - /* ??? 0 is passed for `pc' */ - errmsg = CGEN_CPU_INSERT_OPERAND (cd) (cd, opindex, fields, where, - (bfd_vma) 0); -#endif - if (errmsg) - as_bad_where (fixP->fx_file, fixP->fx_line, "%s", errmsg); - } - - if (fixP->fx_done) - return 1; - - /* The operand isn't fully resolved. Determine a BFD reloc value - based on the operand information and leave it to - bfd_install_relocation. Note that this doesn't work when - partial_inplace == false. */ - - reloc_type = md_cgen_lookup_reloc (insn, operand, fixP); - if (reloc_type != BFD_RELOC_NONE) - { - fixP->fx_r_type = reloc_type; - } - else - { - as_bad_where (fixP->fx_file, fixP->fx_line, - _("unresolved expression that must be resolved")); - fixP->fx_done = 1; - return 1; - } - } - else if (fixP->fx_done) - { - /* We're finished with this fixup. Install it because - bfd_install_relocation won't be called to do it. */ - switch (fixP->fx_r_type) - { - case BFD_RELOC_8: - md_number_to_chars (where, value, 1); - break; - case BFD_RELOC_16: - md_number_to_chars (where, value, 2); - break; - case BFD_RELOC_32: - md_number_to_chars (where, value, 4); - break; - /* FIXME: later add support for 64 bits. */ - default: - as_bad_where (fixP->fx_file, fixP->fx_line, - _("internal error: can't install fix for reloc type %d (`%s')"), - fixP->fx_r_type, bfd_get_reloc_code_name (fixP->fx_r_type)); - break; - } - } - else - { - /* bfd_install_relocation will be called to finish things up. */ - } - - /* Tuck `value' away for use by tc_gen_reloc. - See the comment describing fx_addnumber in write.h. - This field is misnamed (or misused :-). */ - fixP->fx_addnumber = value; - - return 1; -} - -/* Translate internal representation of relocation info to BFD target format. - - FIXME: To what extent can we get all relevant targets to use this? */ - -arelent * -gas_cgen_tc_gen_reloc (section, fixP) - asection * section; - fixS * fixP; -{ - arelent * reloc; - - reloc = (arelent *) xmalloc (sizeof (arelent)); - - reloc->howto = bfd_reloc_type_lookup (stdoutput, fixP->fx_r_type); - if (reloc->howto == (reloc_howto_type *) NULL) - { - as_bad_where (fixP->fx_file, fixP->fx_line, - _("internal error: can't export reloc type %d (`%s')"), - fixP->fx_r_type, bfd_get_reloc_code_name (fixP->fx_r_type)); - return NULL; - } - - assert (!fixP->fx_pcrel == !reloc->howto->pc_relative); - - reloc->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *)); - *reloc->sym_ptr_ptr = symbol_get_bfdsym (fixP->fx_addsy); - - /* Use fx_offset for these cases */ - if ( fixP->fx_r_type == BFD_RELOC_VTABLE_ENTRY - || fixP->fx_r_type == BFD_RELOC_VTABLE_INHERIT) - reloc->addend = fixP->fx_offset; - else - reloc->addend = fixP->fx_addnumber; - - reloc->address = fixP->fx_frag->fr_address + fixP->fx_where; - return reloc; -} diff --git a/contrib/binutils/gas/cgen.h b/contrib/binutils/gas/cgen.h deleted file mode 100644 index 2bc1732247f9..000000000000 --- a/contrib/binutils/gas/cgen.h +++ /dev/null @@ -1,94 +0,0 @@ -/* GAS cgen support. - Copyright (C) 1998, 1999 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 2, 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. */ - -#ifndef GAS_CGEN_H -#define GAS_CGEN_H - -/* Opcode table handle. */ -extern CGEN_CPU_DESC gas_cgen_cpu_desc; - -/* Maximum number of fixups in an insn. - If you need to change this, allow target to override and do so there. */ -#define GAS_CGEN_MAX_FIXUPS 3 - -/* Struct defining result of gas_cgen_finish_insn. */ -typedef struct { - /* frag containing the insn */ - fragS * frag; - /* Address of insn in frag. */ - char * addr; - /* Number of fixups this insn has. */ - int num_fixups; - /* Array of fixups. */ - fixS * fixups[GAS_CGEN_MAX_FIXUPS]; -} finished_insnS; - -/* Callback for operand parsing. - The result is an error message or NULL for success. - The parsed value is stored in the bfd_vma *. */ -extern const char * gas_cgen_parse_operand - PARAMS ((CGEN_CPU_DESC, enum cgen_parse_operand_type, - const char **, int, int, enum cgen_parse_operand_result *, - bfd_vma *)); - -/* Call this from md_assemble to initialize the assembler callback. */ -extern void gas_cgen_init_parse PARAMS ((void)); - -extern void gas_cgen_save_fixups PARAMS ((void)); -extern void gas_cgen_restore_fixups PARAMS ((void)); -extern void gas_cgen_swap_fixups PARAMS ((void)); - -/* Add a register to the assembler's hash table. - This makes lets GAS parse registers for us. - ??? This isn't currently used, but it could be in the future. */ -extern void cgen_asm_record_register PARAMS ((char *, int)); - -/* After CGEN_SYM (assemble_insn) is done, this is called to - output the insn and record any fixups. */ -extern void gas_cgen_finish_insn PARAMS ((const CGEN_INSN *, - CGEN_INSN_BYTES_PTR, unsigned int, - int, finished_insnS *)); - -/* Record a fixup. */ -extern fixS * gas_cgen_record_fixup PARAMS ((fragS *, int, const CGEN_INSN *, - int, const CGEN_OPERAND *, int, - symbolS *, offsetT)); -extern fixS * gas_cgen_record_fixup_exp PARAMS ((fragS *, int, const CGEN_INSN *, - int, const CGEN_OPERAND *, int, - expressionS *)); - -/* md_apply_fix3 handler */ -extern int gas_cgen_md_apply_fix3 PARAMS ((fixS *, valueT *, segT)); - -/* tc_gen_reloc handler */ -extern arelent *gas_cgen_tc_gen_reloc PARAMS ((asection *, fixS *)); - -/* Target supplied routine to lookup a reloc. */ -extern bfd_reloc_code_real_type -md_cgen_lookup_reloc PARAMS ((const CGEN_INSN *, const CGEN_OPERAND *, - fixS *)); - -/* Optional target supplied routine to record a fixup for an expression. */ -extern fixS * -md_cgen_record_fixup_exp PARAMS ((fragS *, int, const CGEN_INSN *, int, - const CGEN_OPERAND *, int, - expressionS *)); - -#endif /* GAS_CGEN_H */ diff --git a/contrib/binutils/gas/conf.in b/contrib/binutils/gas/conf.in deleted file mode 100644 index d56807cd88d5..000000000000 --- a/contrib/binutils/gas/conf.in +++ /dev/null @@ -1,127 +0,0 @@ -/* conf.in. Generated automatically from configure.in by autoheader. */ - -/* Define if using alloca.c. */ -#undef C_ALLOCA - -/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems. - This function is required for alloca.c support on those systems. */ -#undef CRAY_STACKSEG_END - -/* Define if you have alloca, as a function or macro. */ -#undef HAVE_ALLOCA - -/* Define if you have <alloca.h> and it should be used (not on Ultrix). */ -#undef HAVE_ALLOCA_H - -/* Define as __inline if that's what the C compiler calls it. */ -#undef inline - -/* If using the C implementation of alloca, define if you know the - direction of stack growth for your system; otherwise it will be - automatically deduced at run-time. - STACK_DIRECTION > 0 => grows toward higher addresses - STACK_DIRECTION < 0 => grows toward lower addresses - STACK_DIRECTION = 0 => direction of growth unknown - */ -#undef STACK_DIRECTION - -/* Should gas use high-level BFD interfaces? */ -#undef BFD_ASSEMBLER - -/* Some assert/preprocessor combinations are incapable of handling - certain kinds of constructs in the argument of assert. For example, - quoted strings (if requoting isn't done right) or newlines. */ -#undef BROKEN_ASSERT - -/* If we aren't doing cross-assembling, some operations can be optimized, - since byte orders and value sizes don't need to be adjusted. */ -#undef CROSS_COMPILE - -/* Some gas code wants to know these parameters. */ -#undef TARGET_ALIAS -#undef TARGET_CPU -#undef TARGET_CANONICAL -#undef TARGET_OS -#undef TARGET_VENDOR - -/* Sometimes the system header files don't declare strstr. */ -#undef NEED_DECLARATION_STRSTR - -/* Sometimes the system header files don't declare malloc and realloc. */ -#undef NEED_DECLARATION_MALLOC - -/* Sometimes the system header files don't declare free. */ -#undef NEED_DECLARATION_FREE - -/* Sometimes the system header files don't declare sbrk. */ -#undef NEED_DECLARATION_SBRK - -/* Sometimes errno.h doesn't declare errno itself. */ -#undef NEED_DECLARATION_ERRNO - -#undef MANY_SEGMENTS - -/* Needed only for sparc configuration. */ -#undef SPARC_V9 -#undef SPARC_ARCH64 - -/* Defined if using CGEN. */ -#undef USING_CGEN - -/* Needed only for some configurations that can produce multiple output - formats. */ -#undef DEFAULT_EMULATION -#undef EMULATIONS -#undef USE_EMULATIONS -#undef OBJ_MAYBE_AOUT -#undef OBJ_MAYBE_BOUT -#undef OBJ_MAYBE_COFF -#undef OBJ_MAYBE_ECOFF -#undef OBJ_MAYBE_ELF -#undef OBJ_MAYBE_GENERIC -#undef OBJ_MAYBE_HP300 -#undef OBJ_MAYBE_IEEE -#undef OBJ_MAYBE_SOM -#undef OBJ_MAYBE_VMS - -/* Used for some of the COFF configurations, when the COFF code needs - to select something based on the CPU type before it knows it... */ -#undef I386COFF -#undef M68KCOFF -#undef M88KCOFF - -/* Define if you have the remove function. */ -#undef HAVE_REMOVE - -/* Define if you have the sbrk function. */ -#undef HAVE_SBRK - -/* Define if you have the unlink function. */ -#undef HAVE_UNLINK - -/* Define if you have the <errno.h> header file. */ -#undef HAVE_ERRNO_H - -/* Define if you have the <memory.h> header file. */ -#undef HAVE_MEMORY_H - -/* Define if you have the <stdarg.h> header file. */ -#undef HAVE_STDARG_H - -/* Define if you have the <stdlib.h> header file. */ -#undef HAVE_STDLIB_H - -/* Define if you have the <string.h> header file. */ -#undef HAVE_STRING_H - -/* Define if you have the <strings.h> header file. */ -#undef HAVE_STRINGS_H - -/* Define if you have the <sys/types.h> header file. */ -#undef HAVE_SYS_TYPES_H - -/* Define if you have the <unistd.h> header file. */ -#undef HAVE_UNISTD_H - -/* Define if you have the <varargs.h> header file. */ -#undef HAVE_VARARGS_H diff --git a/contrib/binutils/gas/config/atof-vax.c b/contrib/binutils/gas/config/atof-vax.c deleted file mode 100644 index 76ff0782868a..000000000000 --- a/contrib/binutils/gas/config/atof-vax.c +++ /dev/null @@ -1,518 +0,0 @@ -/* atof_vax.c - turn a Flonum into a VAX floating point number - Copyright (C) 1987, 1992, 93, 95, 97, 98, 1999 - 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 2, 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. */ - -#include "as.h" - -static int atof_vax_sizeof PARAMS ((int)); -static int next_bits PARAMS ((int)); -static void make_invalid_floating_point_number PARAMS ((LITTLENUM_TYPE *)); -static int what_kind_of_float PARAMS ((int, int *, long *)); -static char *atof_vax PARAMS ((char *, int, LITTLENUM_TYPE *)); - -/* Precision in LittleNums. */ -#define MAX_PRECISION (8) -#define H_PRECISION (8) -#define G_PRECISION (4) -#define D_PRECISION (4) -#define F_PRECISION (2) - -/* Length in LittleNums of guard bits. */ -#define GUARD (2) - -int flonum_gen2vax PARAMS ((int format_letter, FLONUM_TYPE * f, - LITTLENUM_TYPE * words)); - -/* Number of chars in flonum type 'letter'. */ -static int -atof_vax_sizeof (letter) - int letter; -{ - int return_value; - - /* - * Permitting uppercase letters is probably a bad idea. - * Please use only lower-cased letters in case the upper-cased - * ones become unsupported! - */ - switch (letter) - { - case 'f': - case 'F': - return_value = 4; - break; - - case 'd': - case 'D': - case 'g': - case 'G': - return_value = 8; - break; - - case 'h': - case 'H': - return_value = 16; - break; - - default: - return_value = 0; - break; - } - return (return_value); -} /* atof_vax_sizeof */ - -static const long mask[] = -{ - 0x00000000, - 0x00000001, - 0x00000003, - 0x00000007, - 0x0000000f, - 0x0000001f, - 0x0000003f, - 0x0000007f, - 0x000000ff, - 0x000001ff, - 0x000003ff, - 0x000007ff, - 0x00000fff, - 0x00001fff, - 0x00003fff, - 0x00007fff, - 0x0000ffff, - 0x0001ffff, - 0x0003ffff, - 0x0007ffff, - 0x000fffff, - 0x001fffff, - 0x003fffff, - 0x007fffff, - 0x00ffffff, - 0x01ffffff, - 0x03ffffff, - 0x07ffffff, - 0x0fffffff, - 0x1fffffff, - 0x3fffffff, - 0x7fffffff, - 0xffffffff -}; - - -/* Shared between flonum_gen2vax and next_bits */ -static int bits_left_in_littlenum; -static LITTLENUM_TYPE *littlenum_pointer; -static LITTLENUM_TYPE *littlenum_end; - -static int -next_bits (number_of_bits) - int number_of_bits; -{ - int return_value; - - if (littlenum_pointer < littlenum_end) - return 0; - if (number_of_bits >= bits_left_in_littlenum) - { - return_value = mask[bits_left_in_littlenum] & *littlenum_pointer; - number_of_bits -= bits_left_in_littlenum; - return_value <<= number_of_bits; - bits_left_in_littlenum = LITTLENUM_NUMBER_OF_BITS - number_of_bits; - littlenum_pointer--; - if (littlenum_pointer >= littlenum_end) - return_value |= ((*littlenum_pointer) >> (bits_left_in_littlenum)) & mask[number_of_bits]; - } - else - { - bits_left_in_littlenum -= number_of_bits; - return_value = mask[number_of_bits] & ((*littlenum_pointer) >> bits_left_in_littlenum); - } - return (return_value); -} - -static void -make_invalid_floating_point_number (words) - LITTLENUM_TYPE *words; -{ - *words = 0x8000; /* Floating Reserved Operand Code */ -} - -static int /* 0 means letter is OK. */ -what_kind_of_float (letter, precisionP, exponent_bitsP) - int letter; /* In: lowercase please. What kind of float? */ - int *precisionP; /* Number of 16-bit words in the float. */ - long *exponent_bitsP; /* Number of exponent bits. */ -{ - int retval; /* 0: OK. */ - - retval = 0; - switch (letter) - { - case 'f': - *precisionP = F_PRECISION; - *exponent_bitsP = 8; - break; - - case 'd': - *precisionP = D_PRECISION; - *exponent_bitsP = 8; - break; - - case 'g': - *precisionP = G_PRECISION; - *exponent_bitsP = 11; - break; - - case 'h': - *precisionP = H_PRECISION; - *exponent_bitsP = 15; - break; - - default: - retval = 69; - break; - } - return (retval); -} - -/***********************************************************************\ - * * - * Warning: this returns 16-bit LITTLENUMs, because that is * - * what the VAX thinks in. It is up to the caller to figure * - * out any alignment problems and to conspire for the bytes/word * - * to be emitted in the right order. Bigendians beware! * - * * - \***********************************************************************/ - -static char * /* Return pointer past text consumed. */ -atof_vax (str, what_kind, words) - char *str; /* Text to convert to binary. */ - int what_kind; /* 'd', 'f', 'g', 'h' */ - LITTLENUM_TYPE *words; /* Build the binary here. */ -{ - FLONUM_TYPE f; - LITTLENUM_TYPE bits[MAX_PRECISION + MAX_PRECISION + GUARD]; - /* Extra bits for zeroed low-order bits. */ - /* The 1st MAX_PRECISION are zeroed, */ - /* the last contain flonum bits. */ - char *return_value; - int precision; /* Number of 16-bit words in the format. */ - long exponent_bits; - - return_value = str; - f.low = bits + MAX_PRECISION; - f.high = NULL; - f.leader = NULL; - f.exponent = 0; - f.sign = '\0'; - - if (what_kind_of_float (what_kind, &precision, &exponent_bits)) - { - return_value = NULL; /* We lost. */ - make_invalid_floating_point_number (words); - } - - if (return_value) - { - memset (bits, '\0', sizeof (LITTLENUM_TYPE) * MAX_PRECISION); - - /* Use more LittleNums than seems */ - /* necessary: the highest flonum may have */ - /* 15 leading 0 bits, so could be useless. */ - f.high = f.low + precision - 1 + GUARD; - - if (atof_generic (&return_value, ".", "eE", &f)) - { - make_invalid_floating_point_number (words); - return_value = NULL; /* we lost */ - } - else - { - if (flonum_gen2vax (what_kind, &f, words)) - { - return_value = NULL; - } - } - } - return (return_value); -} /* atof_vax() */ - -/* - * In: a flonum, a vax floating point format. - * Out: a vax floating-point bit pattern. - */ - -int /* 0: OK. */ -flonum_gen2vax (format_letter, f, words) - int format_letter; /* One of 'd' 'f' 'g' 'h'. */ - FLONUM_TYPE *f; - LITTLENUM_TYPE *words; /* Deliver answer here. */ -{ - LITTLENUM_TYPE *lp; - int precision; - long exponent_bits; - int return_value; /* 0 == OK. */ - - return_value = what_kind_of_float (format_letter, &precision, &exponent_bits); - - if (return_value != 0) - { - make_invalid_floating_point_number (words); - } - else - { - if (f->low > f->leader) - { - /* 0.0e0 seen. */ - memset (words, '\0', sizeof (LITTLENUM_TYPE) * precision); - } - else - { - long exponent_1; - long exponent_2; - long exponent_3; - long exponent_4; - int exponent_skippage; - LITTLENUM_TYPE word1; - - /* JF: Deal with new Nan, +Inf and -Inf codes */ - if (f->sign != '-' && f->sign != '+') - { - make_invalid_floating_point_number (words); - return return_value; - } - /* - * All vaxen floating_point formats (so far) have: - * Bit 15 is sign bit. - * Bits 14:n are excess-whatever exponent. - * Bits n-1:0 (if any) are most significant bits of fraction. - * Bits 15:0 of the next word are the next most significant bits. - * And so on for each other word. - * - * All this to be compatible with a KF11?? (Which is still faster - * than lots of vaxen I can think of, but it also has higher - * maintenance costs ... sigh). - * - * So we need: number of bits of exponent, number of bits of - * mantissa. - */ - -#ifdef NEVER /******* This zeroing seems redundant - Dean 3may86 **********/ - /* - * No matter how few bits we got back from the atof() - * routine, add enough zero littlenums so the rest of the - * code won't run out of "significant" bits in the mantissa. - */ - { - LITTLENUM_TYPE *ltp; - for (ltp = f->leader + 1; - ltp <= f->low + precision; - ltp++) - { - *ltp = 0; - } - } -#endif - - bits_left_in_littlenum = LITTLENUM_NUMBER_OF_BITS; - littlenum_pointer = f->leader; - littlenum_end = f->low; - /* Seek (and forget) 1st significant bit */ - for (exponent_skippage = 0; - !next_bits (1); - exponent_skippage++);; - - exponent_1 = f->exponent + f->leader + 1 - f->low; - /* Radix LITTLENUM_RADIX, point just higher than f->leader. */ - exponent_2 = exponent_1 * LITTLENUM_NUMBER_OF_BITS; - /* Radix 2. */ - exponent_3 = exponent_2 - exponent_skippage; - /* Forget leading zeros, forget 1st bit. */ - exponent_4 = exponent_3 + (1 << (exponent_bits - 1)); - /* Offset exponent. */ - - if (exponent_4 & ~mask[exponent_bits]) - { - /* - * Exponent overflow. Lose immediately. - */ - - make_invalid_floating_point_number (words); - - /* - * We leave return_value alone: admit we read the - * number, but return a floating exception - * because we can't encode the number. - */ - } - else - { - lp = words; - - /* Word 1. Sign, exponent and perhaps high bits. */ - /* Assume 2's complement integers. */ - word1 = (((exponent_4 & mask[exponent_bits]) << (15 - exponent_bits)) - | ((f->sign == '+') ? 0 : 0x8000) - | next_bits (15 - exponent_bits)); - *lp++ = word1; - - /* The rest of the words are just mantissa bits. */ - for (; lp < words + precision; lp++) - { - *lp = next_bits (LITTLENUM_NUMBER_OF_BITS); - } - - if (next_bits (1)) - { - /* - * Since the NEXT bit is a 1, round UP the mantissa. - * The cunning design of these hidden-1 floats permits - * us to let the mantissa overflow into the exponent, and - * it 'does the right thing'. However, we lose if the - * highest-order bit of the lowest-order word flips. - * Is that clear? - */ - - unsigned long carry; - - /* - #if (sizeof(carry)) < ((sizeof(bits[0]) * BITS_PER_CHAR) + 2) - Please allow at least 1 more bit in carry than is in a LITTLENUM. - We need that extra bit to hold a carry during a LITTLENUM carry - propagation. Another extra bit (kept 0) will assure us that we - don't get a sticky sign bit after shifting right, and that - permits us to propagate the carry without any masking of bits. - #endif - */ - for (carry = 1, lp--; - carry && (lp >= words); - lp--) - { - carry = *lp + carry; - *lp = carry; - carry >>= LITTLENUM_NUMBER_OF_BITS; - } - - if ((word1 ^ *words) & (1 << (LITTLENUM_NUMBER_OF_BITS - 1))) - { - make_invalid_floating_point_number (words); - /* - * We leave return_value alone: admit we read the - * number, but return a floating exception - * because we can't encode the number. - */ - } - } /* if (we needed to round up) */ - } /* if (exponent overflow) */ - } /* if (0.0e0) */ - } /* if (float_type was OK) */ - return (return_value); -} /* flonum_gen2vax() */ - - -/* JF this used to be in vax.c but this looks like a better place for it */ - -/* - * md_atof() - * - * In: input_line_pointer->the 1st character of a floating-point - * number. - * 1 letter denoting the type of statement that wants a - * binary floating point number returned. - * Address of where to build floating point literal. - * Assumed to be 'big enough'. - * Address of where to return size of literal (in chars). - * - * Out: Input_line_pointer->of next char after floating number. - * Error message, or 0. - * Floating point literal. - * Number of chars we used for the literal. - */ - -#define MAXIMUM_NUMBER_OF_LITTLENUMS (8) /* For .hfloats. */ - -char * -md_atof (what_statement_type, literalP, sizeP) - int what_statement_type; - char *literalP; - int *sizeP; -{ - LITTLENUM_TYPE words[MAXIMUM_NUMBER_OF_LITTLENUMS]; - register char kind_of_float; - register int number_of_chars; - register LITTLENUM_TYPE *littlenumP; - - switch (what_statement_type) - { - case 'F': /* .float */ - case 'f': /* .ffloat */ - kind_of_float = 'f'; - break; - - case 'D': /* .double */ - case 'd': /* .dfloat */ - kind_of_float = 'd'; - break; - - case 'g': /* .gfloat */ - kind_of_float = 'g'; - break; - - case 'h': /* .hfloat */ - kind_of_float = 'h'; - break; - - default: - kind_of_float = 0; - break; - }; - - if (kind_of_float) - { - register LITTLENUM_TYPE *limit; - - input_line_pointer = atof_vax (input_line_pointer, - kind_of_float, - words); - /* - * The atof_vax() builds up 16-bit numbers. - * Since the assembler may not be running on - * a little-endian machine, be very careful about - * converting words to chars. - */ - number_of_chars = atof_vax_sizeof (kind_of_float); - know (number_of_chars <= MAXIMUM_NUMBER_OF_LITTLENUMS * sizeof (LITTLENUM_TYPE)); - limit = words + (number_of_chars / sizeof (LITTLENUM_TYPE)); - for (littlenumP = words; littlenumP < limit; littlenumP++) - { - md_number_to_chars (literalP, *littlenumP, sizeof (LITTLENUM_TYPE)); - literalP += sizeof (LITTLENUM_TYPE); - }; - } - else - { - number_of_chars = 0; - }; - - *sizeP = number_of_chars; - return kind_of_float ? NULL : _("Bad call to md_atof()"); -} - -/* end of atof-vax.c */ diff --git a/contrib/binutils/gas/config/i386coff.mt b/contrib/binutils/gas/config/i386coff.mt deleted file mode 100644 index efda83365181..000000000000 --- a/contrib/binutils/gas/config/i386coff.mt +++ /dev/null @@ -1 +0,0 @@ -TDEFINES=-DI386COFF diff --git a/contrib/binutils/gas/config/sco5.mt b/contrib/binutils/gas/config/sco5.mt deleted file mode 100644 index 8879320c4e1e..000000000000 --- a/contrib/binutils/gas/config/sco5.mt +++ /dev/null @@ -1 +0,0 @@ -TDEFINES=-DSCO_ELF diff --git a/contrib/binutils/gas/config/tc-arc.c b/contrib/binutils/gas/config/tc-arc.c deleted file mode 100644 index 3aafea364810..000000000000 --- a/contrib/binutils/gas/config/tc-arc.c +++ /dev/null @@ -1,1484 +0,0 @@ -/* tc-arc.c -- Assembler for the ARC - Copyright (C) 1994, 1995, 1997, 1998, 1999 Free Software Foundation, Inc. - Contributed by Doug Evans (dje@cygnus.com). - - 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 2, 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. */ - -#include <stdio.h> -#include <ctype.h> -#include "as.h" -#include "subsegs.h" -#include "opcode/arc.h" -#include "elf/arc.h" - -extern int arc_get_mach PARAMS ((char *)); - -static arc_insn arc_insert_operand PARAMS ((arc_insn, - const struct arc_operand *, int, - const struct arc_operand_value *, - offsetT, char *, unsigned int)); -static void arc_common PARAMS ((int)); -static void arc_cpu PARAMS ((int)); -/*static void arc_rename PARAMS ((int));*/ -static int get_arc_exp_reloc_type PARAMS ((int, int, expressionS *, - expressionS *)); - -const pseudo_typeS md_pseudo_table[] = -{ - { "align", s_align_bytes, 0 }, /* Defaulting is invalid (0) */ - { "common", arc_common, 0 }, -/*{ "hword", cons, 2 }, - already exists */ - { "word", cons, 4 }, -/*{ "xword", cons, 8 },*/ - { "cpu", arc_cpu, 0 }, -/*{ "rename", arc_rename, 0 },*/ - { NULL, 0, 0 }, -}; - -/* This array holds the chars that always start a comment. If the - pre-processor is disabled, these aren't very useful */ -const char comment_chars[] = "#;"; - -/* This array holds the chars that only start a comment at the beginning of - a line. If the line seems to have the form '# 123 filename' - .line and .file directives will appear in the pre-processed output */ -/* Note that input_file.c hand checks for '#' at the beginning of the - first line of the input file. This is because the compiler outputs - #NO_APP at the beginning of its output. */ -/* Also note that comments started like this one will always - work if '/' isn't otherwise defined. */ -const char line_comment_chars[] = "#"; - -const char line_separator_chars[] = ""; - -/* Chars that can be used to separate mant from exp in floating point nums */ -const char EXP_CHARS[] = "eE"; - -/* Chars that mean this number is a floating point constant */ -/* As in 0f12.456 */ -/* or 0d1.2345e12 */ -const char FLT_CHARS[] = "rRsSfFdD"; - -/* Byte order. */ -extern int target_big_endian; -const char *arc_target_format = DEFAULT_TARGET_FORMAT; -static int byte_order = DEFAULT_BYTE_ORDER; - -/* One of bfd_mach_arc_xxx. */ -static int arc_mach_type = bfd_mach_arc_base; - -/* Non-zero if the cpu type has been explicitly specified. */ -static int mach_type_specified_p = 0; - -/* Non-zero if opcode tables have been initialized. - A .cpu command must appear before any instructions. */ -static int cpu_tables_init_p = 0; - -static struct hash_control *arc_suffix_hash = NULL; - -const char *md_shortopts = ""; -struct option md_longopts[] = -{ -#define OPTION_EB (OPTION_MD_BASE + 0) - {"EB", no_argument, NULL, OPTION_EB}, -#define OPTION_EL (OPTION_MD_BASE + 1) - {"EL", no_argument, NULL, OPTION_EL}, - { NULL, no_argument, NULL, 0 } -}; -size_t md_longopts_size = sizeof (md_longopts); - -/* - * md_parse_option - * - * Invocation line includes a switch not recognized by the base assembler. - * See if it's a processor-specific option. - */ - -int -md_parse_option (c, arg) - int c; - char *arg; -{ - switch (c) - { - case OPTION_EB: - byte_order = BIG_ENDIAN; - arc_target_format = "elf32-bigarc"; - break; - case OPTION_EL: - byte_order = LITTLE_ENDIAN; - arc_target_format = "elf32-littlearc"; - break; - default: - return 0; - } - return 1; -} - -void -md_show_usage (stream) - FILE *stream; -{ - fprintf (stream, _("\ -ARC options:\n\ --EB generate big endian output\n\ --EL generate little endian output\n")); -} - -/* This function is called once, at assembler startup time. It should - set up all the tables, etc. that the MD part of the assembler will need. - Opcode selection is defered until later because we might see a .cpu - command. */ - -void -md_begin () -{ - /* The endianness can be chosen "at the factory". */ - target_big_endian = byte_order == BIG_ENDIAN; - - if (!bfd_set_arch_mach (stdoutput, bfd_arch_arc, arc_mach_type)) - as_warn (_("could not set architecture and machine")); - - /* Assume the base cpu. This call is necessary because we need to - initialize `arc_operand_map' which may be needed before we see the - first insn. */ - arc_opcode_init_tables (arc_get_opcode_mach (bfd_mach_arc_base, - target_big_endian)); -} - -/* Initialize the various opcode and operand tables. - MACH is one of bfd_mach_arc_xxx. */ - -static void -init_opcode_tables (mach) - int mach; -{ - register unsigned int i; - char *last; - - if ((arc_suffix_hash = hash_new ()) == NULL) - as_fatal (_("virtual memory exhausted")); - - if (!bfd_set_arch_mach (stdoutput, bfd_arch_arc, mach)) - as_warn (_("could not set architecture and machine")); - - /* This initializes a few things in arc-opc.c that we need. - This must be called before the various arc_xxx_supported fns. */ - arc_opcode_init_tables (arc_get_opcode_mach (mach, target_big_endian)); - - /* Only put the first entry of each equivalently named suffix in the - table. */ - last = ""; - for (i = 0; i < arc_suffixes_count; i++) - { - if (! arc_opval_supported (&arc_suffixes[i])) - continue; - if (strcmp (arc_suffixes[i].name, last) != 0) - hash_insert (arc_suffix_hash, arc_suffixes[i].name, (PTR) (arc_suffixes + i)); - last = arc_suffixes[i].name; - } - - /* Since registers don't have a prefix, we put them in the symbol table so - they can't be used as symbols. This also simplifies argument parsing as - we can let gas parse registers for us. The recorded register number is - the index in `arc_reg_names'. */ - for (i = 0; i < arc_reg_names_count; i++) - { - if (! arc_opval_supported (&arc_reg_names[i])) - continue; - /* Use symbol_create here instead of symbol_new so we don't try to - output registers into the object file's symbol table. */ - symbol_table_insert (symbol_create (arc_reg_names[i].name, reg_section, - i, &zero_address_frag)); - } - - /* Tell `s_cpu' it's too late. */ - cpu_tables_init_p = 1; -} - -/* Insert an operand value into an instruction. - If REG is non-NULL, it is a register number and ignore VAL. */ - -static arc_insn -arc_insert_operand (insn, operand, mods, reg, val, file, line) - arc_insn insn; - const struct arc_operand *operand; - int mods; - const struct arc_operand_value *reg; - offsetT val; - char *file; - unsigned int line; -{ - if (operand->bits != 32) - { - long min, max; - offsetT test; - - if ((operand->flags & ARC_OPERAND_SIGNED) != 0) - { - if ((operand->flags & ARC_OPERAND_SIGNOPT) != 0) - max = (1 << operand->bits) - 1; - else - max = (1 << (operand->bits - 1)) - 1; - min = - (1 << (operand->bits - 1)); - } - else - { - max = (1 << operand->bits) - 1; - min = 0; - } - - if ((operand->flags & ARC_OPERAND_NEGATIVE) != 0) - test = - val; - else - test = val; - - if (test < (offsetT) min || test > (offsetT) max) - { - const char *err = - _("operand out of range (%s not between %ld and %ld)"); - char buf[100]; - - sprint_value (buf, test); - if (file == (char *) NULL) - as_warn (err, buf, min, max); - else - as_warn_where (file, line, err, buf, min, max); - } - } - - if (operand->insert) - { - const char *errmsg; - - errmsg = NULL; - insn = (*operand->insert) (insn, operand, mods, reg, (long) val, &errmsg); - if (errmsg != (const char *) NULL) - as_warn (errmsg); - } - else - insn |= (((long) val & ((1 << operand->bits) - 1)) - << operand->shift); - - return insn; -} - -/* We need to keep a list of fixups. We can't simply generate them as - we go, because that would require us to first create the frag, and - that would screw up references to ``.''. */ - -struct arc_fixup -{ - /* index into `arc_operands' */ - int opindex; - expressionS exp; -}; - -#define MAX_FIXUPS 5 - -#define MAX_SUFFIXES 5 - -/* This routine is called for each instruction to be assembled. */ - -void -md_assemble (str) - char *str; -{ - const struct arc_opcode *opcode; - char *start; - arc_insn insn; - static int init_tables_p = 0; - - /* Opcode table initialization is deferred until here because we have to - wait for a possible .cpu command. */ - if (!init_tables_p) - { - init_opcode_tables (arc_mach_type); - init_tables_p = 1; - } - - /* Skip leading white space. */ - while (isspace (*str)) - str++; - - /* The instructions are stored in lists hashed by the first letter (though - we needn't care how they're hashed). Get the first in the list. */ - - opcode = arc_opcode_lookup_asm (str); - - /* Keep looking until we find a match. */ - - start = str; - for ( ; opcode != NULL; opcode = ARC_OPCODE_NEXT_ASM (opcode)) - { - int past_opcode_p, fc, num_suffixes; - char *syn; - struct arc_fixup fixups[MAX_FIXUPS]; - /* Used as a sanity check. If we need a limm reloc, make sure we ask - for an extra 4 bytes from frag_more. */ - int limm_reloc_p; - const struct arc_operand_value *insn_suffixes[MAX_SUFFIXES]; - - /* Is this opcode supported by the selected cpu? */ - if (! arc_opcode_supported (opcode)) - continue; - - /* Scan the syntax string. If it doesn't match, try the next one. */ - - arc_opcode_init_insert (); - insn = opcode->value; - fc = 0; - past_opcode_p = 0; - num_suffixes = 0; - limm_reloc_p = 0; - - /* We don't check for (*str != '\0') here because we want to parse - any trailing fake arguments in the syntax string. */ - for (str = start, syn = opcode->syntax; *syn != '\0'; ) - { - int mods; - const struct arc_operand *operand; - - /* Non operand chars must match exactly. */ - if (*syn != '%' || *++syn == '%') - { - /* Handle '+' specially as we want to allow "ld r0,[sp-4]". */ - /* ??? The syntax has changed to [sp,-4]. */ - if (0 && *syn == '+' && *str == '-') - { - /* Skip over syn's +, but leave str's - alone. - That makes the case identical to "ld r0,[sp+-4]". */ - ++syn; - } - else if (*str == *syn) - { - if (*syn == ' ') - past_opcode_p = 1; - ++syn; - ++str; - } - else - break; - continue; - } - - /* We have an operand. Pick out any modifiers. */ - mods = 0; - while (ARC_MOD_P (arc_operands[arc_operand_map[*syn]].flags)) - { - mods |= arc_operands[arc_operand_map[*syn]].flags & ARC_MOD_BITS; - ++syn; - } - operand = arc_operands + arc_operand_map[*syn]; - if (operand->fmt == 0) - as_fatal (_("unknown syntax format character `%c'"), *syn); - - if (operand->flags & ARC_OPERAND_FAKE) - { - const char *errmsg = NULL; - if (operand->insert) - { - insn = (*operand->insert) (insn, operand, mods, NULL, 0, &errmsg); - /* If we get an error, go on to try the next insn. */ - if (errmsg) - break; - } - ++syn; - } - /* Are we finished with suffixes? */ - else if (!past_opcode_p) - { - int found; - char c; - char *s,*t; - const struct arc_operand_value *suf,*suffix,*suffix_end; - - if (!(operand->flags & ARC_OPERAND_SUFFIX)) - abort (); - - /* If we're at a space in the input string, we want to skip the - remaining suffixes. There may be some fake ones though, so - just go on to try the next one. */ - if (*str == ' ') - { - ++syn; - continue; - } - - s = str; - if (mods & ARC_MOD_DOT) - { - if (*s != '.') - break; - ++s; - } - else - { - /* This can happen in "b.nd foo" and we're currently looking - for "%q" (ie: a condition code suffix). */ - if (*s == '.') - { - ++syn; - continue; - } - } - - /* Pick the suffix out and look it up via the hash table. */ - for (t = s; *t && isalpha (*t); ++t) - continue; - c = *t; - *t = '\0'; - suf = hash_find (arc_suffix_hash, s); - *t = c; - if (!suf) - { - /* This can happen in "blle foo" and we're currently using - the template "b%q%.n %j". The "bl" insn occurs later in - the table so "lle" isn't an illegal suffix. */ - break; - } - - /* Is it the right type? Note that the same character is used - several times, so we have to examine all of them. This is - relatively efficient as equivalent entries are kept - together. If it's not the right type, don't increment `str' - so we try the next one in the series. */ - found = 0; - suffix_end = arc_suffixes + arc_suffixes_count; - for (suffix = suf; - suffix < suffix_end && strcmp (suffix->name, suf->name) == 0; - ++suffix) - { - if (arc_operands[suffix->type].fmt == *syn) - { - /* Insert the suffix's value into the insn. */ - if (operand->insert) - insn = (*operand->insert) (insn, operand, - mods, NULL, suffix->value, - NULL); - else - insn |= suffix->value << operand->shift; - - str = t; - found = 1; - break; - } - } - ++syn; - if (!found) - ; /* Wrong type. Just go on to try next insn entry. */ - else - { - if (num_suffixes == MAX_SUFFIXES) - as_bad (_("too many suffixes")); - else - insn_suffixes[num_suffixes++] = suffix; - } - } - else - /* This is either a register or an expression of some kind. */ - { - char c; - char *hold; - const struct arc_operand_value *reg = NULL; - long value = 0; - expressionS exp; - - if (operand->flags & ARC_OPERAND_SUFFIX) - abort (); - - /* Is there anything left to parse? - We don't check for this at the top because we want to parse - any trailing fake arguments in the syntax string. */ - if (*str == '\0') - break; -#if 0 - /* Is this a syntax character? Eg: is there a '[' present when - there shouldn't be? */ - if (!isalnum (*str) - /* '.' as in ".LLC0" */ - && *str != '.' - /* '_' as in "_print" */ - && *str != '_' - /* '-' as in "[fp,-4]" */ - && *str != '-' - /* '%' as in "%ia(_func)" */ - && *str != '%') - break; -#endif - - /* Parse the operand. */ - hold = input_line_pointer; - input_line_pointer = str; - expression (&exp); - str = input_line_pointer; - input_line_pointer = hold; - - if (exp.X_op == O_illegal) - as_bad (_("illegal operand")); - else if (exp.X_op == O_absent) - as_bad (_("missing operand")); - else if (exp.X_op == O_constant) - { - value = exp.X_add_number; - } - else if (exp.X_op == O_register) - { - reg = arc_reg_names + exp.X_add_number; - } - else - { - /* We need to generate a fixup for this expression. */ - if (fc >= MAX_FIXUPS) - as_fatal (_("too many fixups")); - fixups[fc].exp = exp; - - /* If this is a register constant (IE: one whose - register value gets stored as 61-63) then this - must be a limm. We don't support shimm relocs. */ - /* ??? This bit could use some cleaning up. - Referencing the format chars like this goes - against style. */ -#define IS_REG_OPERAND(o) ((o) == 'a' || (o) == 'b' || (o) == 'c') - if (IS_REG_OPERAND (*syn)) - { - const char *junk; - - fixups[fc].opindex = arc_operand_map['L']; - limm_reloc_p = 1; - /* Tell insert_reg we need a limm. This is - needed because the value at this point is - zero, a shimm. */ - /* ??? We need a cleaner interface than this. */ - (*arc_operands[arc_operand_map['Q']].insert) - (insn, operand, mods, reg, 0L, &junk); - } - else - fixups[fc].opindex = arc_operand_map[*syn]; - ++fc; - value = 0; - } - - /* Insert the register or expression into the instruction. */ - if (operand->insert) - { - const char *errmsg = NULL; - insn = (*operand->insert) (insn, operand, mods, - reg, (long) value, &errmsg); -#if 0 - if (errmsg != (const char *) NULL) - as_warn (errmsg); -#endif - /* FIXME: We want to try shimm insns for limm ones. But if - the constant won't fit, we must go on to try the next - possibility. Where do we issue warnings for constants - that are too big then? At present, we'll flag the insn - as unrecognizable! Maybe have the "bad instruction" - error message include our `errmsg'? */ - if (errmsg != (const char *) NULL) - break; - } - else - insn |= (value & ((1 << operand->bits) - 1)) << operand->shift; - - ++syn; - } - } - - /* If we're at the end of the syntax string, we're done. */ - /* FIXME: try to move this to a separate function. */ - if (*syn == '\0') - { - int i; - char *f; - long limm, limm_p; - - /* For the moment we assume a valid `str' can only contain blanks - now. IE: We needn't try again with a longer version of the - insn and it is assumed that longer versions of insns appear - before shorter ones (eg: lsr r2,r3,1 vs lsr r2,r3). */ - - while (isspace (*str)) - ++str; - - if (*str != '\0') - as_bad (_("junk at end of line: `%s'"), str); - - /* Is there a limm value? */ - limm_p = arc_opcode_limm_p (&limm); - - /* Perform various error and warning tests. */ - - { - static int in_delay_slot_p = 0; - static int prev_insn_needs_cc_nop_p = 0; - /* delay slot type seen */ - int delay_slot_type = ARC_DELAY_NONE; - /* conditional execution flag seen */ - int conditional = 0; - /* 1 if condition codes are being set */ - int cc_set_p = 0; - /* 1 if conditional branch, including `b' "branch always" */ - int cond_branch_p = opcode->flags & ARC_OPCODE_COND_BRANCH; - int need_cc_nop_p = 0; - - for (i = 0; i < num_suffixes; ++i) - { - switch (arc_operands[insn_suffixes[i]->type].fmt) - { - case 'n' : - delay_slot_type = insn_suffixes[i]->value; - break; - case 'q' : - conditional = insn_suffixes[i]->value; - break; - case 'f' : - cc_set_p = 1; - break; - } - } - - /* Putting an insn with a limm value in a delay slot is supposed to - be legal, but let's warn the user anyway. Ditto for 8 byte - jumps with delay slots. */ - if (in_delay_slot_p && limm_p) - as_warn (_("8 byte instruction in delay slot")); - if (delay_slot_type != ARC_DELAY_NONE && limm_p) - as_warn (_("8 byte jump instruction with delay slot")); - in_delay_slot_p = (delay_slot_type != ARC_DELAY_NONE) && !limm_p; - - /* Warn when a conditional branch immediately follows a set of - the condition codes. Note that this needn't be done if the - insn that sets the condition codes uses a limm. */ - if (cond_branch_p && conditional != 0 /* 0 = "always" */ - && prev_insn_needs_cc_nop_p) - as_warn (_("conditional branch follows set of flags")); - prev_insn_needs_cc_nop_p = cc_set_p && !limm_p; - } - - /* Write out the instruction. - It is important to fetch enough space in one call to `frag_more'. - We use (f - frag_now->fr_literal) to compute where we are and we - don't want frag_now to change between calls. */ - if (limm_p) - { - f = frag_more (8); - md_number_to_chars (f, insn, 4); - md_number_to_chars (f + 4, limm, 4); - } - else if (limm_reloc_p) - { - /* We need a limm reloc, but the tables think we don't. */ - abort (); - } - else - { - f = frag_more (4); - md_number_to_chars (f, insn, 4); - } - - /* Create any fixups. */ - for (i = 0; i < fc; ++i) - { - int op_type, reloc_type; - expressionS exptmp; - const struct arc_operand *operand; - - /* Create a fixup for this operand. - At this point we do not use a bfd_reloc_code_real_type for - operands residing in the insn, but instead just use the - operand index. This lets us easily handle fixups for any - operand type, although that is admittedly not a very exciting - feature. We pick a BFD reloc type in md_apply_fix. - - Limm values (4 byte immediate "constants") must be treated - normally because they're not part of the actual insn word - and thus the insertion routines don't handle them. */ - - if (arc_operands[fixups[i].opindex].flags & ARC_OPERAND_LIMM) - { - op_type = fixups[i].opindex; - /* FIXME: can we add this data to the operand table? */ - if (op_type == arc_operand_map['L']) - reloc_type = BFD_RELOC_32; - else if (op_type == arc_operand_map['J']) - reloc_type = BFD_RELOC_ARC_B26; - else - abort (); - reloc_type = get_arc_exp_reloc_type (1, reloc_type, - &fixups[i].exp, - &exptmp); - } - else - { - op_type = get_arc_exp_reloc_type (0, fixups[i].opindex, - &fixups[i].exp, &exptmp); - reloc_type = op_type + (int) BFD_RELOC_UNUSED; - } - operand = &arc_operands[op_type]; - fix_new_exp (frag_now, - ((f - frag_now->fr_literal) - + (operand->flags & ARC_OPERAND_LIMM ? 4 : 0)), 4, - &exptmp, - (operand->flags & ARC_OPERAND_RELATIVE_BRANCH) != 0, - (bfd_reloc_code_real_type) reloc_type); - } - - /* All done. */ - return; - } - - /* Try the next entry. */ - } - - as_bad (_("bad instruction `%s'"), start); -} - -/* ??? This was copied from tc-sparc.c, I think. Is it necessary? */ - -static void -arc_common (ignore) - int ignore; -{ - char *name; - char c; - char *p; - int temp, size; - symbolS *symbolP; - - name = input_line_pointer; - c = get_symbol_end (); - /* just after name is now '\0' */ - p = input_line_pointer; - *p = c; - SKIP_WHITESPACE (); - if (*input_line_pointer != ',') - { - as_bad (_("expected comma after symbol-name")); - ignore_rest_of_line (); - return; - } - input_line_pointer++; /* skip ',' */ - if ((temp = get_absolute_expression ()) < 0) - { - as_bad (_(".COMMon length (%d.) <0! Ignored."), temp); - ignore_rest_of_line (); - return; - } - size = temp; - *p = 0; - symbolP = symbol_find_or_make (name); - *p = c; - if (S_IS_DEFINED (symbolP) && ! S_IS_COMMON (symbolP)) - { - as_bad (_("ignoring attempt to re-define symbol")); - ignore_rest_of_line (); - return; - } - if (S_GET_VALUE (symbolP) != 0) - { - if (S_GET_VALUE (symbolP) != size) - { - as_warn (_("Length of .comm \"%s\" is already %ld. Not changed to %d."), - S_GET_NAME (symbolP), (long) S_GET_VALUE (symbolP), size); - } - } - assert (symbol_get_frag (symbolP) == &zero_address_frag); - if (*input_line_pointer != ',') - { - as_bad (_("expected comma after common length")); - ignore_rest_of_line (); - return; - } - input_line_pointer++; - SKIP_WHITESPACE (); - if (*input_line_pointer != '"') - { - temp = get_absolute_expression (); - if (temp < 0) - { - temp = 0; - as_warn (_("Common alignment negative; 0 assumed")); - } - if (symbolP->local) - { - segT old_sec; - int old_subsec; - char *p; - int align; - - allocate_bss: - old_sec = now_seg; - old_subsec = now_subseg; - align = temp; - record_alignment (bss_section, align); - subseg_set (bss_section, 0); - if (align) - frag_align (align, 0, 0); - if (S_GET_SEGMENT (symbolP) == bss_section) - symbol_get_frag (symbolP)->fr_symbol = 0; - symbol_set_frag (symbolP, frag_now); - p = frag_var (rs_org, 1, 1, (relax_substateT) 0, symbolP, - (offsetT) size, (char *) 0); - *p = 0; - S_SET_SEGMENT (symbolP, bss_section); - S_CLEAR_EXTERNAL (symbolP); - subseg_set (old_sec, old_subsec); - } - else - { - allocate_common: - S_SET_VALUE (symbolP, (valueT) size); - S_SET_ALIGN (symbolP, temp); - S_SET_EXTERNAL (symbolP); - S_SET_SEGMENT (symbolP, bfd_com_section_ptr); - } - } - else - { - input_line_pointer++; - /* ??? Some say data, some say bss. */ - if (strncmp (input_line_pointer, ".bss\"", 5) - && strncmp (input_line_pointer, ".data\"", 6)) - { - input_line_pointer--; - goto bad_common_segment; - } - while (*input_line_pointer++ != '"') - ; - goto allocate_common; - } - demand_empty_rest_of_line (); - return; - - { - bad_common_segment: - p = input_line_pointer; - while (*p && *p != '\n') - p++; - c = *p; - *p = '\0'; - as_bad (_("bad .common segment %s"), input_line_pointer + 1); - *p = c; - input_line_pointer = p; - ignore_rest_of_line (); - return; - } -} - -/* Select the cpu we're assembling for. */ - -static void -arc_cpu (ignore) - int ignore; -{ - int mach; - char c; - char *cpu; - - /* If an instruction has already been seen, it's too late. */ - if (cpu_tables_init_p) - { - as_bad (_(".cpu command must appear before any instructions")); - ignore_rest_of_line (); - return; - } - - cpu = input_line_pointer; - c = get_symbol_end (); - mach = arc_get_mach (cpu); - *input_line_pointer = c; - if (mach == -1) - goto bad_cpu; - - demand_empty_rest_of_line (); - - /* The cpu may have been selected on the command line. - The choices must match. */ - /* ??? This was a command line option early on. It's gone now, but - leave this in. */ - if (mach_type_specified_p && mach != arc_mach_type) - as_bad (_(".cpu conflicts with previous value")); - else - { - arc_mach_type = mach; - mach_type_specified_p = 1; - if (!bfd_set_arch_mach (stdoutput, bfd_arch_arc, mach)) - as_warn (_("could not set architecture and machine")); - } - return; - - bad_cpu: - as_bad (_("bad .cpu op")); - ignore_rest_of_line (); -} - -#if 0 -/* The .rename pseudo-op. This is used by gcc to implement - -mmangle-cpu-libgcc. */ - -static void -arc_rename (ignore) - int ignore; -{ - char *name,*new; - char c; - symbolS *sym; - int len; - - name = input_line_pointer; - c = get_symbol_end (); - sym = symbol_find_or_make (name); - *input_line_pointer = c; - - if (*input_line_pointer != ',') - { - as_bad (_("missing rename string")); - ignore_rest_of_line (); - return; - } - ++input_line_pointer; - SKIP_WHITESPACE (); - - name = input_line_pointer; - c = get_symbol_end (); - if (*name == '\0') - { - *input_line_pointer = c; - as_bad (_("invalid symbol to rename to")); - ignore_rest_of_line (); - return; - } - new = (char *) xmalloc (strlen (name) + 1); - strcpy (new, name); - *input_line_pointer = c; - symbol_get_tc (sym)->real_name = new; - - demand_empty_rest_of_line (); -} -#endif - -/* Turn a string in input_line_pointer into a floating point constant of type - type, and store the appropriate bytes in *litP. The number of LITTLENUMS - emitted is stored in *sizeP. - An error message is returned, or NULL on OK. */ - -/* Equal to MAX_PRECISION in atof-ieee.c */ -#define MAX_LITTLENUMS 6 - -char * -md_atof (type, litP, sizeP) - char type; - char *litP; - int *sizeP; -{ - int prec; - LITTLENUM_TYPE words[MAX_LITTLENUMS]; - LITTLENUM_TYPE *wordP; - char *t; - char *atof_ieee (); - - switch (type) - { - case 'f': - case 'F': - prec = 2; - break; - - case 'd': - case 'D': - prec = 4; - break; - - default: - *sizeP = 0; - return _("bad call to md_atof"); - } - - t = atof_ieee (input_line_pointer, type, words); - if (t) - input_line_pointer = t; - *sizeP = prec * sizeof (LITTLENUM_TYPE); - for (wordP = words; prec--;) - { - md_number_to_chars (litP, (valueT) (*wordP++), sizeof (LITTLENUM_TYPE)); - litP += sizeof (LITTLENUM_TYPE); - } - - return NULL; -} - -/* Write a value out to the object file, using the appropriate - endianness. */ - -void -md_number_to_chars (buf, val, n) - char *buf; - valueT val; - int n; -{ - if (target_big_endian) - number_to_chars_bigendian (buf, val, n); - else - number_to_chars_littleendian (buf, val, n); -} - -/* Round up a section size to the appropriate boundary. */ - -valueT -md_section_align (segment, size) - segT segment; - valueT size; -{ - int align = bfd_get_section_alignment (stdoutput, segment); - - return ((size + (1 << align) - 1) & (-1 << align)); -} - -/* We don't have any form of relaxing. */ - -int -md_estimate_size_before_relax (fragp, seg) - fragS *fragp; - asection *seg; -{ - abort (); -} - -/* Convert a machine dependent frag. We never generate these. */ - -void -md_convert_frag (abfd, sec, fragp) - bfd *abfd; - asection *sec; - fragS *fragp; -{ - abort (); -} - -/* Parse an operand that is machine-specific. - - The ARC has a special %-op to adjust addresses so they're usable in - branches. The "st" is short for the STatus register. - ??? Later expand this to take a flags value too. - - ??? We can't create new expression types so we map the %-op's onto the - existing syntax. This means that the user could use the chosen syntax - to achieve the same effect. Perhaps put a special cookie in X_add_number - to mark the expression as special. */ - -void -md_operand (expressionP) - expressionS *expressionP; -{ - char *p = input_line_pointer; - - if (*p == '%' && strncmp (p, "%st(", 4) == 0) - { - input_line_pointer += 4; - expression (expressionP); - if (*input_line_pointer != ')') - { - as_bad (_("missing ')' in %-op")); - return; - } - ++input_line_pointer; - if (expressionP->X_op == O_symbol - && expressionP->X_add_number == 0 - /* I think this test is unnecessary but just as a sanity check... */ - && expressionP->X_op_symbol == NULL) - { - expressionS two; - - expressionP->X_op = O_right_shift; - two.X_op = O_constant; - two.X_add_symbol = two.X_op_symbol = NULL; - two.X_add_number = 2; - expressionP->X_op_symbol = make_expr_symbol (&two); - } - /* allow %st(sym1-sym2) */ - else if (expressionP->X_op == O_subtract - && expressionP->X_add_symbol != NULL - && expressionP->X_op_symbol != NULL - && expressionP->X_add_number == 0) - { - expressionS two; - - expressionP->X_add_symbol = make_expr_symbol (expressionP); - expressionP->X_op = O_right_shift; - two.X_op = O_constant; - two.X_add_symbol = two.X_op_symbol = NULL; - two.X_add_number = 2; - expressionP->X_op_symbol = make_expr_symbol (&two); - } - else - { - as_bad (_("expression too complex for %%st")); - return; - } - } -} - -/* We have no need to default values of symbols. - We could catch register names here, but that is handled by inserting - them all in the symbol table to begin with. */ - -symbolS * -md_undefined_symbol (name) - char *name; -{ - return 0; -} - -/* Functions concerning expressions. */ - -/* Parse a .byte, .word, etc. expression. - - Values for the status register are specified with %st(label). - `label' will be right shifted by 2. */ - -void -arc_parse_cons_expression (exp, nbytes) - expressionS *exp; - int nbytes; -{ - expr (0, exp); -} - -/* Record a fixup for a cons expression. */ - -void -arc_cons_fix_new (frag, where, nbytes, exp) - fragS *frag; - int where; - int nbytes; - expressionS *exp; -{ - if (nbytes == 4) - { - int reloc_type; - expressionS exptmp; - - /* This may be a special ARC reloc (eg: %st()). */ - reloc_type = get_arc_exp_reloc_type (1, BFD_RELOC_32, exp, &exptmp); - fix_new_exp (frag, where, nbytes, &exptmp, 0, reloc_type); - } - else - { - fix_new_exp (frag, where, nbytes, exp, 0, - nbytes == 2 ? BFD_RELOC_16 - : nbytes == 8 ? BFD_RELOC_64 - : BFD_RELOC_32); - } -} - -/* Functions concerning relocs. */ - -/* The location from which a PC relative jump should be calculated, - given a PC relative reloc. */ - -long -md_pcrel_from (fixP) - fixS *fixP; -{ - if (fixP->fx_addsy != (symbolS *) NULL - && ! S_IS_DEFINED (fixP->fx_addsy)) - { - /* The symbol is undefined. Let the linker figure it out. */ - return 0; - } - - /* Return the address of the delay slot. */ - return fixP->fx_frag->fr_address + fixP->fx_where + fixP->fx_size; -} - -/* Compute the reloc type of an expression. - The possibly modified expression is stored in EXPNEW. - - This is used to convert the expressions generated by the %-op's into - the appropriate operand type. It is called for both data in instructions - (operands) and data outside instructions (variables, debugging info, etc.). - - Currently supported %-ops: - - %st(symbol): represented as "symbol >> 2" - "st" is short for STatus as in the status register (pc) - - DEFAULT_TYPE is the type to use if no special processing is required. - - DATA_P is non-zero for data or limm values, zero for insn operands. - Remember that the opcode "insertion fns" cannot be used on data, they're - only for inserting operands into insns. They also can't be used for limm - values as the insertion routines don't handle limm values. When called for - insns we return fudged reloc types (real_value - BFD_RELOC_UNUSED). When - called for data or limm values we use real reloc types. */ - -static int -get_arc_exp_reloc_type (data_p, default_type, exp, expnew) - int data_p; - int default_type; - expressionS *exp; - expressionS *expnew; -{ - /* If the expression is "symbol >> 2" we must change it to just "symbol", - as fix_new_exp can't handle it. Similarily for (symbol - symbol) >> 2. - That's ok though. What's really going on here is that we're using - ">> 2" as a special syntax for specifying BFD_RELOC_ARC_B26. */ - - if (exp->X_op == O_right_shift - && exp->X_op_symbol != NULL - && symbol_constant_p (exp->X_op_symbol) - && S_GET_VALUE (exp->X_op_symbol) == 2 - && exp->X_add_number == 0) - { - if (exp->X_add_symbol != NULL - && (symbol_constant_p (exp->X_add_symbol) - || symbol_equated_p (exp->X_add_symbol))) - { - *expnew = *exp; - expnew->X_op = O_symbol; - expnew->X_op_symbol = NULL; - return data_p ? BFD_RELOC_ARC_B26 : arc_operand_map['J']; - } - else if (exp->X_add_symbol != NULL - && (symbol_get_value_expression (exp->X_add_symbol)->X_op - == O_subtract)) - { - *expnew = *symbol_get_value_expression (exp->X_add_symbol); - return data_p ? BFD_RELOC_ARC_B26 : arc_operand_map['J']; - } - } - - *expnew = *exp; - return default_type; -} - -/* Apply a fixup to the object code. This is called for all the - fixups we generated by the call to fix_new_exp, above. In the call - above we used a reloc code which was the largest legal reloc code - plus the operand index. Here we undo that to recover the operand - index. At this point all symbol values should be fully resolved, - and we attempt to completely resolve the reloc. If we can not do - that, we determine the correct reloc code and put it back in the fixup. */ - -int -md_apply_fix3 (fixP, valueP, seg) - fixS *fixP; - valueT *valueP; - segT seg; -{ - /*char *buf = fixP->fx_where + fixP->fx_frag->fr_literal;*/ - valueT value; - - /* FIXME FIXME FIXME: The value we are passed in *valueP includes - the symbol values. Since we are using BFD_ASSEMBLER, if we are - doing this relocation the code in write.c is going to call - bfd_perform_relocation, which is also going to use the symbol - value. That means that if the reloc is fully resolved we want to - use *valueP since bfd_perform_relocation is not being used. - However, if the reloc is not fully resolved we do not want to use - *valueP, and must use fx_offset instead. However, if the reloc - is PC relative, we do want to use *valueP since it includes the - result of md_pcrel_from. This is confusing. */ - - if (fixP->fx_addsy == (symbolS *) NULL) - { - value = *valueP; - fixP->fx_done = 1; - } - else if (fixP->fx_pcrel) - { - value = *valueP; - /* ELF relocations are against symbols. - If this symbol is in a different section then we need to leave it for - the linker to deal with. Unfortunately, md_pcrel_from can't tell, - so we have to undo it's effects here. */ - if (S_IS_DEFINED (fixP->fx_addsy) - && S_GET_SEGMENT (fixP->fx_addsy) != seg) - value += md_pcrel_from (fixP); - } - else - { - value = fixP->fx_offset; - if (fixP->fx_subsy != (symbolS *) NULL) - { - if (S_GET_SEGMENT (fixP->fx_subsy) == absolute_section) - value -= S_GET_VALUE (fixP->fx_subsy); - else - { - /* We can't actually support subtracting a symbol. */ - as_bad_where (fixP->fx_file, fixP->fx_line, - _("expression too complex")); - } - } - } - - if ((int) fixP->fx_r_type >= (int) BFD_RELOC_UNUSED) - { - int opindex; - const struct arc_operand *operand; - char *where; - arc_insn insn; - - opindex = (int) fixP->fx_r_type - (int) BFD_RELOC_UNUSED; - - operand = &arc_operands[opindex]; - - /* Fetch the instruction, insert the fully resolved operand - value, and stuff the instruction back again. */ - where = fixP->fx_frag->fr_literal + fixP->fx_where; - if (target_big_endian) - insn = bfd_getb32 ((unsigned char *) where); - else - insn = bfd_getl32 ((unsigned char *) where); - insn = arc_insert_operand (insn, operand, -1, NULL, (offsetT) value, - fixP->fx_file, fixP->fx_line); - if (target_big_endian) - bfd_putb32 ((bfd_vma) insn, (unsigned char *) where); - else - bfd_putl32 ((bfd_vma) insn, (unsigned char *) where); - - if (fixP->fx_done) - { - /* Nothing else to do here. */ - return 1; - } - - /* Determine a BFD reloc value based on the operand information. - We are only prepared to turn a few of the operands into relocs. - !!! Note that we can't handle limm values here. Since we're using - implicit addends the addend must be inserted into the instruction, - however, the opcode insertion routines currently do nothing with - limm values. */ - if (operand->fmt == 'B') - { - assert ((operand->flags & ARC_OPERAND_RELATIVE_BRANCH) != 0 - && operand->bits == 20 - && operand->shift == 7); - fixP->fx_r_type = BFD_RELOC_ARC_B22_PCREL; - } - else if (0 && operand->fmt == 'J') - { - assert ((operand->flags & ARC_OPERAND_ABSOLUTE_BRANCH) != 0 - && operand->bits == 24 - && operand->shift == 32); - fixP->fx_r_type = BFD_RELOC_ARC_B26; - } - else if (0 && operand->fmt == 'L') - { - assert ((operand->flags & ARC_OPERAND_LIMM) != 0 - && operand->bits == 32 - && operand->shift == 32); - fixP->fx_r_type = BFD_RELOC_32; - } - else - { - as_bad_where (fixP->fx_file, fixP->fx_line, - _("unresolved expression that must be resolved")); - fixP->fx_done = 1; - return 1; - } - } - else - { - switch (fixP->fx_r_type) - { - case BFD_RELOC_8: - md_number_to_chars (fixP->fx_frag->fr_literal + fixP->fx_where, - value, 1); - break; - case BFD_RELOC_16: - md_number_to_chars (fixP->fx_frag->fr_literal + fixP->fx_where, - value, 2); - break; - case BFD_RELOC_32: - md_number_to_chars (fixP->fx_frag->fr_literal + fixP->fx_where, - value, 4); - break; -#if 0 - case BFD_RELOC_64: - md_number_to_chars (fixP->fx_frag->fr_literal + fixP->fx_where, - value, 8); - break; -#endif - case BFD_RELOC_ARC_B26: - /* If !fixP->fx_done then `value' is an implicit addend. - We must shift it right by 2 in this case as well because the - linker performs the relocation and then adds this in (as opposed - to adding this in and then shifting right by 2). */ - value >>= 2; - md_number_to_chars (fixP->fx_frag->fr_literal + fixP->fx_where, - value, 4); - break; - default: - abort (); - } - } - - fixP->fx_addnumber = value; - - return 1; -} - -/* Translate internal representation of relocation info to BFD target - format. */ - -arelent * -tc_gen_reloc (section, fixP) - asection *section; - fixS *fixP; -{ - arelent *reloc; - - reloc = (arelent *) xmalloc (sizeof (arelent)); - - reloc->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *)); - *reloc->sym_ptr_ptr = symbol_get_bfdsym (fixP->fx_addsy); - reloc->address = fixP->fx_frag->fr_address + fixP->fx_where; - reloc->howto = bfd_reloc_type_lookup (stdoutput, fixP->fx_r_type); - if (reloc->howto == (reloc_howto_type *) NULL) - { - as_bad_where (fixP->fx_file, fixP->fx_line, - _("internal error: can't export reloc type %d (`%s')"), - fixP->fx_r_type, bfd_get_reloc_code_name (fixP->fx_r_type)); - return NULL; - } - - assert (!fixP->fx_pcrel == !reloc->howto->pc_relative); - - reloc->addend = fixP->fx_addnumber; - - return reloc; -} - -/* Frobbers. */ - -#if 0 -/* Set the real name if the .rename pseudo-op was used. - Return 1 if the symbol should not be included in the symbol table. */ - -int -arc_frob_symbol (sym) - symbolS *sym; -{ - if (symbol_get_tc (sym)->real_name != (char *) NULL) - S_SET_NAME (sym, symbol_get_tc (sym)->real_name); - - return 0; -} -#endif diff --git a/contrib/binutils/gas/config/tc-arc.h b/contrib/binutils/gas/config/tc-arc.h deleted file mode 100644 index 5066201e73bb..000000000000 --- a/contrib/binutils/gas/config/tc-arc.h +++ /dev/null @@ -1,71 +0,0 @@ -/* tc-arc.h - Macros and type defines for the ARC. - Copyright (C) 1994, 1995, 1997, 1999 Free Software Foundation, Inc. - Contributed by Doug Evans (dje@cygnus.com). - - 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 2, - 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. */ - -#define TC_ARC 1 - -#define TARGET_BYTES_BIG_ENDIAN 0 - -#define LOCAL_LABELS_FB 1 - -#define TARGET_ARCH bfd_arch_arc - -#define LITTLE_ENDIAN 1234 -#define BIG_ENDIAN 4321 - -/* The endianness of the target format may change based on command - line arguments. */ -extern const char *arc_target_format; -#define DEFAULT_TARGET_FORMAT "elf32-littlearc" -#define TARGET_FORMAT arc_target_format -#define DEFAULT_BYTE_ORDER LITTLE_ENDIAN - -#define WORKING_DOT_WORD - -#define LISTING_HEADER "ARC GAS " - -#define TC_HANDLES_FX_DONE - -#define MD_APPLY_FIX3 - -/* The ARC needs to parse reloc specifiers in .word. */ - -extern void arc_parse_cons_expression (); -#define TC_PARSE_CONS_EXPRESSION(EXP, NBYTES) \ -arc_parse_cons_expression (EXP, NBYTES) - -extern void arc_cons_fix_new (); -#define TC_CONS_FIX_NEW(FRAG, WHERE, NBYTES, EXP) \ -arc_cons_fix_new (FRAG, WHERE, NBYTES, EXP) - -#if 0 -/* Extra stuff that we need to keep track of for each symbol. */ -struct arc_tc_sy -{ - /* The real name, if the symbol was renamed. */ - char *real_name; -}; - -#define TC_SYMFIELD_TYPE struct arc_tc_sy - -/* Finish up the symbol. */ -extern int arc_frob_symbol PARAMS ((symbolS *)); -#define tc_frob_symbol(sym, punt) punt = arc_frob_symbol (sym) -#endif diff --git a/contrib/binutils/gas/config/tc-sh.c b/contrib/binutils/gas/config/tc-sh.c deleted file mode 100644 index eaa6146eea75..000000000000 --- a/contrib/binutils/gas/config/tc-sh.c +++ /dev/null @@ -1,2335 +0,0 @@ -/* tc-sh.c -- Assemble code for the Hitachi Super-H - Copyright (C) 1993, 94, 95, 96, 1997 Free Software Foundation. - - 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 2, 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. */ - -/* - Written By Steve Chamberlain - sac@cygnus.com - */ - -#include <stdio.h> -#include "as.h" -#include "bfd.h" -#include "subsegs.h" -#define DEFINE_TABLE -#include "opcodes/sh-opc.h" -#include <ctype.h> -const char comment_chars[] = "!"; -const char line_separator_chars[] = ";"; -const char line_comment_chars[] = "!#"; - -static void s_uses PARAMS ((int)); - -static void sh_count_relocs PARAMS ((bfd *, segT, PTR)); -static void sh_frob_section PARAMS ((bfd *, segT, PTR)); - -/* This table describes all the machine specific pseudo-ops the assembler - has to support. The fields are: - pseudo-op name without dot - function to call to execute this pseudo-op - Integer arg to pass to the function - */ - -void cons (); -void s_align_bytes (); -static void s_uacons PARAMS ((int)); - -int shl = 0; - -static void -little (ignore) - int ignore; -{ - shl = 1; - target_big_endian = 0; -} - -const pseudo_typeS md_pseudo_table[] = -{ - {"int", cons, 4}, - {"word", cons, 2}, - {"form", listing_psize, 0}, - {"little", little, 0}, - {"heading", listing_title, 0}, - {"import", s_ignore, 0}, - {"page", listing_eject, 0}, - {"program", s_ignore, 0}, - {"uses", s_uses, 0}, - {"uaword", s_uacons, 2}, - {"ualong", s_uacons, 4}, - {0, 0, 0} -}; - -/*int md_reloc_size; */ - -int sh_relax; /* set if -relax seen */ - -/* Whether -small was seen. */ - -int sh_small; - -const char EXP_CHARS[] = "eE"; - -/* Chars that mean this number is a floating point constant */ -/* As in 0f12.456 */ -/* or 0d1.2345e12 */ -const char FLT_CHARS[] = "rRsSfFdDxXpP"; - -#define C(a,b) ENCODE_RELAX(a,b) - -#define JREG 14 /* Register used as a temp when relaxing */ -#define ENCODE_RELAX(what,length) (((what) << 4) + (length)) -#define GET_WHAT(x) ((x>>4)) - -/* These are the two types of relaxable instrction */ -#define COND_JUMP 1 -#define UNCOND_JUMP 2 - -#define UNDEF_DISP 0 -#define COND8 1 -#define COND12 2 -#define COND32 3 -#define UNCOND12 1 -#define UNCOND32 2 -#define UNDEF_WORD_DISP 4 -#define END 5 - -#define UNCOND12 1 -#define UNCOND32 2 - -/* Branch displacements are from the address of the branch plus - four, thus all minimum and maximum values have 4 added to them. */ -#define COND8_F 258 -#define COND8_M -252 -#define COND8_LENGTH 2 - -/* There is one extra instruction before the branch, so we must add - two more bytes to account for it. */ -#define COND12_F 4100 -#define COND12_M -4090 -#define COND12_LENGTH 6 - -/* ??? The minimum and maximum values are wrong, but this does not matter - since this relocation type is not supported yet. */ -#define COND32_F (1<<30) -#define COND32_M -(1<<30) -#define COND32_LENGTH 14 - -#define UNCOND12_F 4098 -#define UNCOND12_M -4092 -#define UNCOND12_LENGTH 2 - -/* ??? The minimum and maximum values are wrong, but this does not matter - since this relocation type is not supported yet. */ -#define UNCOND32_F (1<<30) -#define UNCOND32_M -(1<<30) -#define UNCOND32_LENGTH 14 - -const relax_typeS md_relax_table[C (END, 0)] = { - { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, - { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, - - { 0 }, - /* C (COND_JUMP, COND8) */ - { COND8_F, COND8_M, COND8_LENGTH, C (COND_JUMP, COND12) }, - /* C (COND_JUMP, COND12) */ - { COND12_F, COND12_M, COND12_LENGTH, C (COND_JUMP, COND32), }, - /* C (COND_JUMP, COND32) */ - { COND32_F, COND32_M, COND32_LENGTH, 0, }, - { 0 }, { 0 }, { 0 }, { 0 }, - { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, - - { 0 }, - /* C (UNCOND_JUMP, UNCOND12) */ - { UNCOND12_F, UNCOND12_M, UNCOND12_LENGTH, C (UNCOND_JUMP, UNCOND32), }, - /* C (UNCOND_JUMP, UNCOND32) */ - { UNCOND32_F, UNCOND32_M, UNCOND32_LENGTH, 0, }, - { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, - { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, -}; - -static struct hash_control *opcode_hash_control; /* Opcode mnemonics */ - -/* - This function is called once, at assembler startup time. This should - set up all the tables, etc that the MD part of the assembler needs - */ - -void -md_begin () -{ - sh_opcode_info *opcode; - char *prev_name = ""; - - if (! shl) - target_big_endian = 1; - - opcode_hash_control = hash_new (); - - /* Insert unique names into hash table */ - for (opcode = sh_table; opcode->name; opcode++) - { - if (strcmp (prev_name, opcode->name)) - { - prev_name = opcode->name; - hash_insert (opcode_hash_control, opcode->name, (char *) opcode); - } - else - { - /* Make all the opcodes with the same name point to the same - string */ - opcode->name = prev_name; - } - } -} - -static int reg_m; -static int reg_n; -static int reg_b; - -static expressionS immediate; /* absolute expression */ - -typedef struct - { - sh_arg_type type; - int reg; - } - -sh_operand_info; - -/* try and parse a reg name, returns number of chars consumed */ -static int -parse_reg (src, mode, reg) - char *src; - int *mode; - int *reg; -{ - /* We use !isalnum for the next character after the register name, to - make sure that we won't accidentally recognize a symbol name such as - 'sram' as being a reference to the register 'sr'. */ - - if (src[0] == 'r') - { - if (src[1] >= '0' && src[1] <= '7' && strncmp(&src[2], "_bank", 5) == 0 - && ! isalnum (src[7])) - { - *mode = A_REG_B; - *reg = (src[1] - '0'); - return 7; - } - } - - if (src[0] == 'r') - { - if (src[1] == '1') - { - if (src[2] >= '0' && src[2] <= '5' && ! isalnum (src[3])) - { - *mode = A_REG_N; - *reg = 10 + src[2] - '0'; - return 3; - } - } - if (src[1] >= '0' && src[1] <= '9' && ! isalnum (src[2])) - { - *mode = A_REG_N; - *reg = (src[1] - '0'); - return 2; - } - } - - if (src[0] == 's' && src[1] == 's' && src[2] == 'r' && ! isalnum (src[3])) - { - *mode = A_SSR; - return 3; - } - - if (src[0] == 's' && src[1] == 'p' && src[2] == 'c' && ! isalnum (src[3])) - { - *mode = A_SPC; - return 3; - } - - if (src[0] == 's' && src[1] == 'g' && src[2] == 'r' && ! isalnum (src[3])) - { - *mode = A_SGR; - return 3; - } - - if (src[0] == 'd' && src[1] == 'b' && src[2] == 'r' && ! isalnum (src[3])) - { - *mode = A_DBR; - return 3; - } - - if (src[0] == 's' && src[1] == 'r' && ! isalnum (src[2])) - { - *mode = A_SR; - return 2; - } - - if (src[0] == 's' && src[1] == 'p' && ! isalnum (src[2])) - { - *mode = A_REG_N; - *reg = 15; - return 2; - } - - if (src[0] == 'p' && src[1] == 'r' && ! isalnum (src[2])) - { - *mode = A_PR; - return 2; - } - if (src[0] == 'p' && src[1] == 'c' && ! isalnum (src[2])) - { - *mode = A_DISP_PC; - return 2; - } - if (src[0] == 'g' && src[1] == 'b' && src[2] == 'r' && ! isalnum (src[3])) - { - *mode = A_GBR; - return 3; - } - if (src[0] == 'v' && src[1] == 'b' && src[2] == 'r' && ! isalnum (src[3])) - { - *mode = A_VBR; - return 3; - } - - if (src[0] == 'm' && src[1] == 'a' && src[2] == 'c' && ! isalnum (src[4])) - { - if (src[3] == 'l') - { - *mode = A_MACL; - return 4; - } - if (src[3] == 'h') - { - *mode = A_MACH; - return 4; - } - } - if (src[0] == 'f' && src[1] == 'r') - { - if (src[2] == '1') - { - if (src[3] >= '0' && src[3] <= '5' && ! isalnum (src[4])) - { - *mode = F_REG_N; - *reg = 10 + src[3] - '0'; - return 4; - } - } - if (src[2] >= '0' && src[2] <= '9' && ! isalnum (src[3])) - { - *mode = F_REG_N; - *reg = (src[2] - '0'); - return 3; - } - } - if (src[0] == 'd' && src[1] == 'r') - { - if (src[2] == '1') - { - if (src[3] >= '0' && src[3] <= '4' && ! ((src[3] - '0') & 1) - && ! isalnum (src[4])) - { - *mode = D_REG_N; - *reg = 10 + src[3] - '0'; - return 4; - } - } - if (src[2] >= '0' && src[2] <= '8' && ! ((src[2] - '0') & 1) - && ! isalnum (src[3])) - { - *mode = D_REG_N; - *reg = (src[2] - '0'); - return 3; - } - } - if (src[0] == 'x' && src[1] == 'd') - { - if (src[2] == '1') - { - if (src[3] >= '0' && src[3] <= '4' && ! ((src[3] - '0') & 1) - && ! isalnum (src[4])) - { - *mode = X_REG_N; - *reg = 11 + src[3] - '0'; - return 4; - } - } - if (src[2] >= '0' && src[2] <= '8' && ! ((src[2] - '0') & 1) - && ! isalnum (src[3])) - { - *mode = X_REG_N; - *reg = (src[2] - '0') + 1; - return 3; - } - } - if (src[0] == 'f' && src[1] == 'v') - { - if (src[2] == '1'&& src[3] == '2' && ! isalnum (src[4])) - { - *mode = V_REG_N; - *reg = 12; - return 4; - } - if ((src[2] == '0' || src[2] == '4' || src[2] == '8') && ! isalnum (src[3])) - { - *mode = V_REG_N; - *reg = (src[2] - '0'); - return 3; - } - } - if (src[0] == 'f' && src[1] == 'p' && src[2] == 'u' && src[3] == 'l' - && ! isalnum (src[4])) - { - *mode = FPUL_N; - return 4; - } - - if (src[0] == 'f' && src[1] == 'p' && src[2] == 's' && src[3] == 'c' - && src[4] == 'r' && ! isalnum (src[5])) - { - *mode = FPSCR_N; - return 5; - } - - if (src[0] == 'x' && src[1] == 'm' && src[2] == 't' && src[3] == 'r' - && src[4] == 'x' && ! isalnum (src[5])) - { - *mode = XMTRX_M4; - return 5; - } - - return 0; -} - -static symbolS *dot() -{ - const char *fake; - - /* JF: '.' is pseudo symbol with value of current location - in current segment. */ - fake = FAKE_LABEL_NAME; - return symbol_new (fake, - now_seg, - (valueT) frag_now_fix (), - frag_now); - -} - - -static -char * -parse_exp (s) - char *s; -{ - char *save; - char *new; - - save = input_line_pointer; - input_line_pointer = s; - expression (&immediate); - if (immediate.X_op == O_absent) - as_bad ("missing operand"); - new = input_line_pointer; - input_line_pointer = save; - return new; -} - - -/* The many forms of operand: - - Rn Register direct - @Rn Register indirect - @Rn+ Autoincrement - @-Rn Autodecrement - @(disp:4,Rn) - @(disp:8,GBR) - @(disp:8,PC) - - @(R0,Rn) - @(R0,GBR) - - disp:8 - disp:12 - #imm8 - pr, gbr, vbr, macl, mach - - */ - -static -char * -parse_at (src, op) - char *src; - sh_operand_info *op; -{ - int len; - int mode; - src++; - if (src[0] == '-') - { - /* Must be predecrement */ - src++; - - len = parse_reg (src, &mode, &(op->reg)); - if (mode != A_REG_N) - as_bad ("illegal register after @-"); - - op->type = A_DEC_N; - src += len; - } - else if (src[0] == '(') - { - /* Could be @(disp, rn), @(disp, gbr), @(disp, pc), @(r0, gbr) or - @(r0, rn) */ - src++; - len = parse_reg (src, &mode, &(op->reg)); - if (len && mode == A_REG_N) - { - src += len; - if (op->reg != 0) - { - as_bad ("must be @(r0,...)"); - } - if (src[0] == ',') - src++; - /* Now can be rn or gbr */ - len = parse_reg (src, &mode, &(op->reg)); - if (mode == A_GBR) - { - op->type = A_R0_GBR; - } - else if (mode == A_REG_N) - { - op->type = A_IND_R0_REG_N; - } - else - { - as_bad ("syntax error in @(r0,...)"); - } - } - else - { - /* Must be an @(disp,.. thing) */ - src = parse_exp (src); - if (src[0] == ',') - src++; - /* Now can be rn, gbr or pc */ - len = parse_reg (src, &mode, &op->reg); - if (len) - { - if (mode == A_REG_N) - { - op->type = A_DISP_REG_N; - } - else if (mode == A_GBR) - { - op->type = A_DISP_GBR; - } - else if (mode == A_DISP_PC) - { - /* Turn a plain @(4,pc) into @(.+4,pc) */ - if (immediate.X_op == O_constant) { - immediate.X_add_symbol = dot(); - immediate.X_op = O_symbol; - } - op->type = A_DISP_PC; - } - else - { - as_bad ("syntax error in @(disp,[Rn, gbr, pc])"); - } - } - else - { - as_bad ("syntax error in @(disp,[Rn, gbr, pc])"); - } - } - src += len; - if (src[0] != ')') - as_bad ("expecting )"); - else - src++; - } - else - { - src += parse_reg (src, &mode, &(op->reg)); - if (mode != A_REG_N) - { - as_bad ("illegal register after @"); - } - if (src[0] == '+') - { - op->type = A_INC_N; - src++; - } - else - { - op->type = A_IND_N; - } - } - return src; -} - -static void -get_operand (ptr, op) - char **ptr; - sh_operand_info *op; -{ - char *src = *ptr; - int mode = -1; - unsigned int len; - - if (src[0] == '#') - { - src++; - *ptr = parse_exp (src); - op->type = A_IMM; - return; - } - - else if (src[0] == '@') - { - *ptr = parse_at (src, op); - return; - } - len = parse_reg (src, &mode, &(op->reg)); - if (len) - { - *ptr = src + len; - op->type = mode; - return; - } - else - { - /* Not a reg, the only thing left is a displacement */ - *ptr = parse_exp (src); - op->type = A_DISP_PC; - return; - } -} - -static -char * -get_operands (info, args, operand) - sh_opcode_info *info; - char *args; - sh_operand_info *operand; - -{ - char *ptr = args; - if (info->arg[0]) - { - ptr++; - - get_operand (&ptr, operand + 0); - if (info->arg[1]) - { - if (*ptr == ',') - { - ptr++; - } - get_operand (&ptr, operand + 1); - if (info->arg[2]) - { - if (*ptr == ',') - { - ptr++; - } - get_operand (&ptr, operand + 2); - } - else - { - operand[2].type = 0; - } - } - else - { - operand[1].type = 0; - operand[2].type = 0; - } - } - else - { - operand[0].type = 0; - operand[1].type = 0; - operand[2].type = 0; - } - return ptr; -} - -/* Passed a pointer to a list of opcodes which use different - addressing modes, return the opcode which matches the opcodes - provided - */ - -static -sh_opcode_info * -get_specific (opcode, operands) - sh_opcode_info *opcode; - sh_operand_info *operands; -{ - sh_opcode_info *this_try = opcode; - char *name = opcode->name; - int n = 0; - while (opcode->name) - { - this_try = opcode++; - if (this_try->name != name) - { - /* We've looked so far down the table that we've run out of - opcodes with the same name */ - return 0; - } - /* look at both operands needed by the opcodes and provided by - the user - since an arg test will often fail on the same arg - again and again, we'll try and test the last failing arg the - first on each opcode try */ - - for (n = 0; this_try->arg[n]; n++) - { - sh_operand_info *user = operands + n; - sh_arg_type arg = this_try->arg[n]; - switch (arg) - { - case A_IMM: - case A_BDISP12: - case A_BDISP8: - case A_DISP_GBR: - case A_DISP_PC: - case A_MACH: - case A_PR: - case A_MACL: - if (user->type != arg) - goto fail; - break; - case A_R0: - /* opcode needs r0 */ - if (user->type != A_REG_N || user->reg != 0) - goto fail; - break; - case A_R0_GBR: - if (user->type != A_R0_GBR || user->reg != 0) - goto fail; - break; - case F_FR0: - if (user->type != F_REG_N || user->reg != 0) - goto fail; - break; - - case A_REG_N: - case A_INC_N: - case A_DEC_N: - case A_IND_N: - case A_IND_R0_REG_N: - case A_DISP_REG_N: - case F_REG_N: - case D_REG_N: - case X_REG_N: - case V_REG_N: - case FPUL_N: - case FPSCR_N: - /* Opcode needs rn */ - if (user->type != arg) - goto fail; - reg_n = user->reg; - break; - case FD_REG_N: - if (user->type != F_REG_N && user->type != D_REG_N) - goto fail; - reg_n = user->reg; - break; - case DX_REG_N: - if (user->type != D_REG_N && user->type != X_REG_N) - goto fail; - reg_n = user->reg; - break; - case A_GBR: - case A_SR: - case A_VBR: - case A_SSR: - case A_SPC: - case A_SGR: - case A_DBR: - if (user->type != arg) - goto fail; - break; - - case A_REG_B: - if (user->type != arg) - goto fail; - reg_b = user->reg; - break; - - case A_REG_M: - case A_INC_M: - case A_DEC_M: - case A_IND_M: - case A_IND_R0_REG_M: - case A_DISP_REG_M: - /* Opcode needs rn */ - if (user->type != arg - A_REG_M + A_REG_N) - goto fail; - reg_m = user->reg; - break; - - case F_REG_M: - case D_REG_M: - case X_REG_M: - case V_REG_M: - case FPUL_M: - case FPSCR_M: - /* Opcode needs rn */ - if (user->type != arg - F_REG_M + F_REG_N) - goto fail; - reg_m = user->reg; - break; - case DX_REG_M: - if (user->type != D_REG_N && user->type != X_REG_N) - goto fail; - reg_m = user->reg; - break; - case XMTRX_M4: - if (user->type != XMTRX_M4) - goto fail; - reg_m = 4; - break; - - default: - printf ("unhandled %d\n", arg); - goto fail; - } - } - return this_try; - fail:; - } - - return 0; -} - -int -check (operand, low, high) - expressionS *operand; - int low; - int high; -{ - if (operand->X_op != O_constant - || operand->X_add_number < low - || operand->X_add_number > high) - { - as_bad ("operand must be absolute in range %d..%d", low, high); - } - return operand->X_add_number; -} - - -static void -insert (where, how, pcrel) - char *where; - int how; - int pcrel; -{ - fix_new_exp (frag_now, - where - frag_now->fr_literal, - 2, - &immediate, - pcrel, - how); -} - -static void -build_relax (opcode) - sh_opcode_info *opcode; -{ - int high_byte = target_big_endian ? 0 : 1; - char *p; - - if (opcode->arg[0] == A_BDISP8) - { - p = frag_var (rs_machine_dependent, - md_relax_table[C (COND_JUMP, COND32)].rlx_length, - md_relax_table[C (COND_JUMP, COND8)].rlx_length, - C (COND_JUMP, 0), - immediate.X_add_symbol, - immediate.X_add_number, - 0); - p[high_byte] = (opcode->nibbles[0] << 4) | (opcode->nibbles[1]); - } - else if (opcode->arg[0] == A_BDISP12) - { - p = frag_var (rs_machine_dependent, - md_relax_table[C (UNCOND_JUMP, UNCOND32)].rlx_length, - md_relax_table[C (UNCOND_JUMP, UNCOND12)].rlx_length, - C (UNCOND_JUMP, 0), - immediate.X_add_symbol, - immediate.X_add_number, - 0); - p[high_byte] = (opcode->nibbles[0] << 4); - } - -} - -/* Now we know what sort of opcodes it is, lets build the bytes - - */ -static void -build_Mytes (opcode, operand) - sh_opcode_info *opcode; - sh_operand_info *operand; - -{ - int index; - char nbuf[4]; - char *output = frag_more (2); - int low_byte = target_big_endian ? 1 : 0; - nbuf[0] = 0; - nbuf[1] = 0; - nbuf[2] = 0; - nbuf[3] = 0; - - for (index = 0; index < 4; index++) - { - sh_nibble_type i = opcode->nibbles[index]; - if (i < 16) - { - nbuf[index] = i; - } - else - { - switch (i) - { - case REG_N: - nbuf[index] = reg_n; - break; - case REG_M: - nbuf[index] = reg_m; - break; - case REG_NM: - nbuf[index] = reg_n | (reg_m >> 2); - break; - case REG_B: - nbuf[index] = reg_b | 0x08; - break; - case DISP_4: - insert (output + low_byte, BFD_RELOC_SH_IMM4, 0); - break; - case IMM_4BY4: - insert (output + low_byte, BFD_RELOC_SH_IMM4BY4, 0); - break; - case IMM_4BY2: - insert (output + low_byte, BFD_RELOC_SH_IMM4BY2, 0); - break; - case IMM_4: - insert (output + low_byte, BFD_RELOC_SH_IMM4, 0); - break; - case IMM_8BY4: - insert (output + low_byte, BFD_RELOC_SH_IMM8BY4, 0); - break; - case IMM_8BY2: - insert (output + low_byte, BFD_RELOC_SH_IMM8BY2, 0); - break; - case IMM_8: - insert (output + low_byte, BFD_RELOC_SH_IMM8, 0); - break; - case PCRELIMM_8BY4: - insert (output, BFD_RELOC_SH_PCRELIMM8BY4, 1); - break; - case PCRELIMM_8BY2: - insert (output, BFD_RELOC_SH_PCRELIMM8BY2, 1); - break; - default: - printf ("failed for %d\n", i); - } - } - } - if (! target_big_endian) { - output[1] = (nbuf[0] << 4) | (nbuf[1]); - output[0] = (nbuf[2] << 4) | (nbuf[3]); - } - else { - output[0] = (nbuf[0] << 4) | (nbuf[1]); - output[1] = (nbuf[2] << 4) | (nbuf[3]); - } -} - -/* This is the guts of the machine-dependent assembler. STR points to a - machine dependent instruction. This function is supposed to emit - the frags/bytes it assembles to. - */ - -void -md_assemble (str) - char *str; -{ - unsigned char *op_start; - unsigned char *op_end; - sh_operand_info operand[3]; - sh_opcode_info *opcode; - char name[20]; - int nlen = 0; - /* Drop leading whitespace */ - while (*str == ' ') - str++; - - /* find the op code end */ - for (op_start = op_end = (unsigned char *) (str); - *op_end - && nlen < 20 - && !is_end_of_line[*op_end] && *op_end != ' '; - op_end++) - { - name[nlen] = op_start[nlen]; - nlen++; - } - name[nlen] = 0; - - if (nlen == 0) - { - as_bad ("can't find opcode "); - } - - opcode = (sh_opcode_info *) hash_find (opcode_hash_control, name); - - if (opcode == NULL) - { - as_bad ("unknown opcode"); - return; - } - - if (sh_relax - && ! seg_info (now_seg)->tc_segment_info_data.in_code) - { - /* Output a CODE reloc to tell the linker that the following - bytes are instructions, not data. */ - fix_new (frag_now, frag_now_fix (), 2, &abs_symbol, 0, 0, - BFD_RELOC_SH_CODE); - seg_info (now_seg)->tc_segment_info_data.in_code = 1; - } - - if (opcode->arg[0] == A_BDISP12 - || opcode->arg[0] == A_BDISP8) - { - parse_exp (op_end + 1); - build_relax (opcode); - } - else - { - if (opcode->arg[0] != A_END) - { - get_operands (opcode, op_end, operand); - } - opcode = get_specific (opcode, operand); - - if (opcode == 0) - { - /* Couldn't find an opcode which matched the operands */ - char *where = frag_more (2); - - where[0] = 0x0; - where[1] = 0x0; - as_bad ("invalid operands for opcode"); - return; - } - - build_Mytes (opcode, operand); - } - -} - -/* This routine is called each time a label definition is seen. It - emits a BFD_RELOC_SH_LABEL reloc if necessary. */ - -void -sh_frob_label () -{ - static fragS *last_label_frag; - static int last_label_offset; - - if (sh_relax - && seg_info (now_seg)->tc_segment_info_data.in_code) - { - int offset; - - offset = frag_now_fix (); - if (frag_now != last_label_frag - || offset != last_label_offset) - { - fix_new (frag_now, offset, 2, &abs_symbol, 0, 0, BFD_RELOC_SH_LABEL); - last_label_frag = frag_now; - last_label_offset = offset; - } - } -} - -/* This routine is called when the assembler is about to output some - data. It emits a BFD_RELOC_SH_DATA reloc if necessary. */ - -void -sh_flush_pending_output () -{ - if (sh_relax - && seg_info (now_seg)->tc_segment_info_data.in_code) - { - fix_new (frag_now, frag_now_fix (), 2, &abs_symbol, 0, 0, - BFD_RELOC_SH_DATA); - seg_info (now_seg)->tc_segment_info_data.in_code = 0; - } -} - -symbolS * -DEFUN (md_undefined_symbol, (name), - char *name) -{ - return 0; -} - -#ifdef OBJ_COFF - -void -DEFUN (tc_crawl_symbol_chain, (headers), - object_headers * headers) -{ - printf ("call to tc_crawl_symbol_chain \n"); -} - -void -DEFUN (tc_headers_hook, (headers), - object_headers * headers) -{ - printf ("call to tc_headers_hook \n"); -} - -#endif - -/* Various routines to kill one day */ -/* Equal to MAX_PRECISION in atof-ieee.c */ -#define MAX_LITTLENUMS 6 - -/* Turn a string in input_line_pointer into a floating point constant of type - type, and store the appropriate bytes in *litP. The number of LITTLENUMS - emitted is stored in *sizeP . An error message is returned, or NULL on OK. - */ -char * -md_atof (type, litP, sizeP) - int type; - char *litP; - int *sizeP; -{ - int prec; - LITTLENUM_TYPE words[4]; - char *t; - int i; - - switch (type) - { - case 'f': - prec = 2; - break; - - case 'd': - prec = 4; - break; - - default: - *sizeP = 0; - return "bad call to md_atof"; - } - - t = atof_ieee (input_line_pointer, type, words); - if (t) - input_line_pointer = t; - - *sizeP = prec * 2; - - if (! target_big_endian) - { - for (i = prec - 1; i >= 0; i--) - { - md_number_to_chars (litP, (valueT) words[i], 2); - litP += 2; - } - } - else - { - for (i = 0; i < prec; i++) - { - md_number_to_chars (litP, (valueT) words[i], 2); - litP += 2; - } - } - - return NULL; -} - -/* Handle the .uses pseudo-op. This pseudo-op is used just before a - call instruction. It refers to a label of the instruction which - loads the register which the call uses. We use it to generate a - special reloc for the linker. */ - -static void -s_uses (ignore) - int ignore; -{ - expressionS ex; - - if (! sh_relax) - as_warn (".uses pseudo-op seen when not relaxing"); - - expression (&ex); - - if (ex.X_op != O_symbol || ex.X_add_number != 0) - { - as_bad ("bad .uses format"); - ignore_rest_of_line (); - return; - } - - fix_new_exp (frag_now, frag_now_fix (), 2, &ex, 1, BFD_RELOC_SH_USES); - - demand_empty_rest_of_line (); -} - -CONST char *md_shortopts = ""; -struct option md_longopts[] = { - -#define OPTION_RELAX (OPTION_MD_BASE) -#define OPTION_LITTLE (OPTION_MD_BASE + 1) -#define OPTION_SMALL (OPTION_LITTLE + 1) - - {"relax", no_argument, NULL, OPTION_RELAX}, - {"little", no_argument, NULL, OPTION_LITTLE}, - {"small", no_argument, NULL, OPTION_SMALL}, - {NULL, no_argument, NULL, 0} -}; -size_t md_longopts_size = sizeof(md_longopts); - -int -md_parse_option (c, arg) - int c; - char *arg; -{ - switch (c) - { - case OPTION_RELAX: - sh_relax = 1; - break; - - case OPTION_LITTLE: - shl = 1; - target_big_endian = 0; - break; - - case OPTION_SMALL: - sh_small = 1; - break; - - default: - return 0; - } - - return 1; -} - -void -md_show_usage (stream) - FILE *stream; -{ - fprintf(stream, "\ -SH options:\n\ --little generate little endian code\n\ --relax alter jump instructions for long displacements\n\ --small align sections to 4 byte boundaries, not 16\n"); -} - -int md_short_jump_size; - -void -tc_Nout_fix_to_chars () -{ - printf ("call to tc_Nout_fix_to_chars \n"); - abort (); -} - -void -md_create_short_jump (ptr, from_Nddr, to_Nddr, frag, to_symbol) - char *ptr; - addressT from_Nddr; - addressT to_Nddr; - fragS *frag; - symbolS *to_symbol; -{ - as_fatal ("failed sanity check."); -} - -void -md_create_long_jump (ptr, from_Nddr, to_Nddr, frag, to_symbol) - char *ptr; - addressT from_Nddr, to_Nddr; - fragS *frag; - symbolS *to_symbol; -{ - as_fatal ("failed sanity check."); -} - -/* This struct is used to pass arguments to sh_count_relocs through - bfd_map_over_sections. */ - -struct sh_count_relocs -{ - /* Symbol we are looking for. */ - symbolS *sym; - /* Count of relocs found. */ - int count; -}; - -/* Count the number of fixups in a section which refer to a particular - symbol. When using BFD_ASSEMBLER, this is called via - bfd_map_over_sections. */ - -/*ARGSUSED*/ -static void -sh_count_relocs (abfd, sec, data) - bfd *abfd; - segT sec; - PTR data; -{ - struct sh_count_relocs *info = (struct sh_count_relocs *) data; - segment_info_type *seginfo; - symbolS *sym; - fixS *fix; - - seginfo = seg_info (sec); - if (seginfo == NULL) - return; - - sym = info->sym; - for (fix = seginfo->fix_root; fix != NULL; fix = fix->fx_next) - { - if (fix->fx_addsy == sym) - { - ++info->count; - fix->fx_tcbit = 1; - } - } -} - -/* Handle the count relocs for a particular section. When using - BFD_ASSEMBLER, this is called via bfd_map_over_sections. */ - -/*ARGSUSED*/ -static void -sh_frob_section (abfd, sec, ignore) - bfd *abfd; - segT sec; - PTR ignore; -{ - segment_info_type *seginfo; - fixS *fix; - - seginfo = seg_info (sec); - if (seginfo == NULL) - return; - - for (fix = seginfo->fix_root; fix != NULL; fix = fix->fx_next) - { - symbolS *sym; - bfd_vma val; - fixS *fscan; - struct sh_count_relocs info; - - if (fix->fx_r_type != BFD_RELOC_SH_USES) - continue; - - /* The BFD_RELOC_SH_USES reloc should refer to a defined local - symbol in the same section. */ - sym = fix->fx_addsy; - if (sym == NULL - || fix->fx_subsy != NULL - || fix->fx_addnumber != 0 - || S_GET_SEGMENT (sym) != sec -#if ! defined (BFD_ASSEMBLER) && defined (OBJ_COFF) - || S_GET_STORAGE_CLASS (sym) == C_EXT -#endif - || S_IS_EXTERNAL (sym)) - { - as_warn_where (fix->fx_file, fix->fx_line, - ".uses does not refer to a local symbol in the same section"); - continue; - } - - /* Look through the fixups again, this time looking for one - at the same location as sym. */ - val = S_GET_VALUE (sym); - for (fscan = seginfo->fix_root; - fscan != NULL; - fscan = fscan->fx_next) - if (val == fscan->fx_frag->fr_address + fscan->fx_where - && fscan->fx_r_type != BFD_RELOC_SH_ALIGN - && fscan->fx_r_type != BFD_RELOC_SH_CODE - && fscan->fx_r_type != BFD_RELOC_SH_DATA - && fscan->fx_r_type != BFD_RELOC_SH_LABEL) - break; - if (fscan == NULL) - { - as_warn_where (fix->fx_file, fix->fx_line, - "can't find fixup pointed to by .uses"); - continue; - } - - if (fscan->fx_tcbit) - { - /* We've already done this one. */ - continue; - } - - /* fscan should also be a fixup to a local symbol in the same - section. */ - sym = fscan->fx_addsy; - if (sym == NULL - || fscan->fx_subsy != NULL - || fscan->fx_addnumber != 0 - || S_GET_SEGMENT (sym) != sec -#if ! defined (BFD_ASSEMBLER) && defined (OBJ_COFF) - || S_GET_STORAGE_CLASS (sym) == C_EXT -#endif - || S_IS_EXTERNAL (sym)) - { - as_warn_where (fix->fx_file, fix->fx_line, - ".uses target does not refer to a local symbol in the same section"); - continue; - } - - /* Now we look through all the fixups of all the sections, - counting the number of times we find a reference to sym. */ - info.sym = sym; - info.count = 0; -#ifdef BFD_ASSEMBLER - bfd_map_over_sections (stdoutput, sh_count_relocs, (PTR) &info); -#else - { - int iscan; - - for (iscan = SEG_E0; iscan < SEG_UNKNOWN; iscan++) - sh_count_relocs ((bfd *) NULL, iscan, (PTR) &info); - } -#endif - - if (info.count < 1) - abort (); - - /* Generate a BFD_RELOC_SH_COUNT fixup at the location of sym. - We have already adjusted the value of sym to include the - fragment address, so we undo that adjustment here. */ - subseg_change (sec, 0); - fix_new (sym->sy_frag, S_GET_VALUE (sym) - sym->sy_frag->fr_address, - 4, &abs_symbol, info.count, 0, BFD_RELOC_SH_COUNT); - } -} - -/* This function is called after the symbol table has been completed, - but before the relocs or section contents have been written out. - If we have seen any .uses pseudo-ops, they point to an instruction - which loads a register with the address of a function. We look - through the fixups to find where the function address is being - loaded from. We then generate a COUNT reloc giving the number of - times that function address is referred to. The linker uses this - information when doing relaxing, to decide when it can eliminate - the stored function address entirely. */ - -void -sh_frob_file () -{ - if (! sh_relax) - return; - -#ifdef BFD_ASSEMBLER - bfd_map_over_sections (stdoutput, sh_frob_section, (PTR) NULL); -#else - { - int iseg; - - for (iseg = SEG_E0; iseg < SEG_UNKNOWN; iseg++) - sh_frob_section ((bfd *) NULL, iseg, (PTR) NULL); - } -#endif -} - -/* Called after relaxing. Set the correct sizes of the fragments, and - create relocs so that md_apply_fix will fill in the correct values. */ - -void -md_convert_frag (headers, seg, fragP) -#ifdef BFD_ASSEMBLER - bfd *headers; -#else - object_headers *headers; -#endif - segT seg; - fragS *fragP; -{ - int donerelax = 0; - - switch (fragP->fr_subtype) - { - case C (COND_JUMP, COND8): - subseg_change (seg, 0); - fix_new (fragP, fragP->fr_fix, 2, fragP->fr_symbol, fragP->fr_offset, - 1, BFD_RELOC_SH_PCDISP8BY2); - fragP->fr_fix += 2; - fragP->fr_var = 0; - break; - - case C (UNCOND_JUMP, UNCOND12): - subseg_change (seg, 0); - fix_new (fragP, fragP->fr_fix, 2, fragP->fr_symbol, fragP->fr_offset, - 1, BFD_RELOC_SH_PCDISP12BY2); - fragP->fr_fix += 2; - fragP->fr_var = 0; - break; - - case C (UNCOND_JUMP, UNCOND32): - case C (UNCOND_JUMP, UNDEF_WORD_DISP): - if (fragP->fr_symbol == NULL) - as_bad ("at 0x%lx, displacement overflows 12-bit field", - (unsigned long) fragP->fr_address); - else - as_bad ("at 0x%lx, displacement to %sdefined symbol %s overflows 12-bit field", - (unsigned long) fragP->fr_address, - S_IS_DEFINED (fragP->fr_symbol) ? "" : "un", - S_GET_NAME (fragP->fr_symbol)); - -#if 0 /* This code works, but generates poor code and the compiler - should never produce a sequence that requires it to be used. */ - - /* A jump wont fit in 12 bits, make code which looks like - bra foo - mov.w @(0, PC), r14 - .long disp - foo: bra @r14 - */ - int t = buffer[0] & 0x10; - - buffer[highbyte] = 0xa0; /* branch over move and disp */ - buffer[lowbyte] = 3; - buffer[highbyte+2] = 0xd0 | JREG; /* Build mov insn */ - buffer[lowbyte+2] = 0x00; - - buffer[highbyte+4] = 0; /* space for 32 bit jump disp */ - buffer[lowbyte+4] = 0; - buffer[highbyte+6] = 0; - buffer[lowbyte+6] = 0; - - buffer[highbyte+8] = 0x40 | JREG; /* Build jmp @JREG */ - buffer[lowbyte+8] = t ? 0xb : 0x2b; - - buffer[highbyte+10] = 0x20; /* build nop */ - buffer[lowbyte+10] = 0x0b; - - /* Make reloc for the long disp */ - fix_new (fragP, - fragP->fr_fix + 4, - 4, - fragP->fr_symbol, - fragP->fr_offset, - 0, - BFD_RELOC_32); - fragP->fr_fix += UNCOND32_LENGTH; - fragP->fr_var = 0; - donerelax = 1; -#endif - - break; - - case C (COND_JUMP, COND12): - /* A bcond won't fit, so turn it into a b!cond; bra disp; nop */ - { - unsigned char *buffer = - (unsigned char *) (fragP->fr_fix + fragP->fr_literal); - int highbyte = target_big_endian ? 0 : 1; - int lowbyte = target_big_endian ? 1 : 0; - - /* Toggle the true/false bit of the bcond. */ - buffer[highbyte] ^= 0x2; - - /* Build a relocation to six bytes farther on. */ - subseg_change (seg, 0); - fix_new (fragP, fragP->fr_fix, 2, -#ifdef BFD_ASSEMBLER - section_symbol (seg), -#else - seg_info (seg)->dot, -#endif - fragP->fr_address + fragP->fr_fix + 6, - 1, BFD_RELOC_SH_PCDISP8BY2); - - /* Set up a jump instruction. */ - buffer[highbyte + 2] = 0xa0; - buffer[lowbyte + 2] = 0; - fix_new (fragP, fragP->fr_fix + 2, 2, fragP->fr_symbol, - fragP->fr_offset, 1, BFD_RELOC_SH_PCDISP12BY2); - - /* Fill in a NOP instruction. */ - buffer[highbyte + 4] = 0x0; - buffer[lowbyte + 4] = 0x9; - - fragP->fr_fix += 6; - fragP->fr_var = 0; - donerelax = 1; - } - break; - - case C (COND_JUMP, COND32): - case C (COND_JUMP, UNDEF_WORD_DISP): - if (fragP->fr_symbol == NULL) - as_bad ("at 0x%lx, displacement overflows 8-bit field", - (unsigned long) fragP->fr_address); - else - as_bad ("at 0x%lx, displacement to %sdefined symbol %s overflows 8-bit field ", - (unsigned long) fragP->fr_address, - S_IS_DEFINED (fragP->fr_symbol) ? "" : "un", - S_GET_NAME (fragP->fr_symbol)); - -#if 0 /* This code works, but generates poor code, and the compiler - should never produce a sequence that requires it to be used. */ - - /* A bcond won't fit and it won't go into a 12 bit - displacement either, the code sequence looks like: - b!cond foop - mov.w @(n, PC), r14 - jmp @r14 - nop - .long where - foop: - */ - - buffer[0] ^= 0x2; /* Toggle T/F bit */ -#define JREG 14 - buffer[1] = 5; /* branch over mov, jump, nop and ptr */ - buffer[2] = 0xd0 | JREG; /* Build mov insn */ - buffer[3] = 0x2; - buffer[4] = 0x40 | JREG; /* Build jmp @JREG */ - buffer[5] = 0x0b; - buffer[6] = 0x20; /* build nop */ - buffer[7] = 0x0b; - buffer[8] = 0; /* space for 32 bit jump disp */ - buffer[9] = 0; - buffer[10] = 0; - buffer[11] = 0; - buffer[12] = 0; - buffer[13] = 0; - /* Make reloc for the long disp */ - fix_new (fragP, - fragP->fr_fix + 8, - 4, - fragP->fr_symbol, - fragP->fr_offset, - 0, - BFD_RELOC_32); - fragP->fr_fix += COND32_LENGTH; - fragP->fr_var = 0; - donerelax = 1; -#endif - - break; - - default: - abort (); - } - - if (donerelax && !sh_relax) - as_warn_where (fragP->fr_file, fragP->fr_line, - "overflow in branch to %s; converted into longer instruction sequence", - (fragP->fr_symbol != NULL - ? S_GET_NAME (fragP->fr_symbol) - : "")); -} - -valueT -DEFUN (md_section_align, (seg, size), - segT seg AND - valueT size) -{ -#ifdef BFD_ASSEMBLER -#ifdef OBJ_ELF - return size; -#else /* ! OBJ_ELF */ - return ((size + (1 << bfd_get_section_alignment (stdoutput, seg)) - 1) - & (-1 << bfd_get_section_alignment (stdoutput, seg))); -#endif /* ! OBJ_ELF */ -#else /* ! BFD_ASSEMBLER */ - return ((size + (1 << section_alignment[(int) seg]) - 1) - & (-1 << section_alignment[(int) seg])); -#endif /* ! BFD_ASSEMBLER */ -} - -/* This static variable is set by s_uacons to tell sh_cons_align that - the expession does not need to be aligned. */ - -static int sh_no_align_cons = 0; - -/* This handles the unaligned space allocation pseudo-ops, such as - .uaword. .uaword is just like .word, but the value does not need - to be aligned. */ - -static void -s_uacons (bytes) - int bytes; -{ - /* Tell sh_cons_align not to align this value. */ - sh_no_align_cons = 1; - cons (bytes); -} - -/* If a .word, et. al., pseud-op is seen, warn if the value is not - aligned correctly. Note that this can cause warnings to be issued - when assembling initialized structured which were declared with the - packed attribute. FIXME: Perhaps we should require an option to - enable this warning? */ - -void -sh_cons_align (nbytes) - int nbytes; -{ - int nalign; - char *p; - - if (sh_no_align_cons) - { - /* This is an unaligned pseudo-op. */ - sh_no_align_cons = 0; - return; - } - - nalign = 0; - while ((nbytes & 1) == 0) - { - ++nalign; - nbytes >>= 1; - } - - if (nalign == 0) - return; - - if (now_seg == absolute_section) - { - if ((abs_section_offset & ((1 << nalign) - 1)) != 0) - as_warn ("misaligned data"); - return; - } - - p = frag_var (rs_align_code, 1, 1, (relax_substateT) 0, - (symbolS *) NULL, (offsetT) nalign, (char *) NULL); - - record_alignment (now_seg, nalign); -} - -/* When relaxing, we need to output a reloc for any .align directive - that requests alignment to a four byte boundary or larger. This is - also where we check for misaligned data. */ - -void -sh_handle_align (frag) - fragS *frag; -{ - if (sh_relax - && frag->fr_type == rs_align - && frag->fr_address + frag->fr_fix > 0 - && frag->fr_offset > 1 - && now_seg != bss_section) - fix_new (frag, frag->fr_fix, 2, &abs_symbol, frag->fr_offset, 0, - BFD_RELOC_SH_ALIGN); - - if (frag->fr_type == rs_align_code - && frag->fr_next->fr_address - frag->fr_address - frag->fr_fix != 0) - as_warn_where (frag->fr_file, frag->fr_line, "misaligned data"); -} - -/* This macro decides whether a particular reloc is an entry in a - switch table. It is used when relaxing, because the linker needs - to know about all such entries so that it can adjust them if - necessary. */ - -#ifdef BFD_ASSEMBLER -#define SWITCH_TABLE_CONS(fix) (0) -#else -#define SWITCH_TABLE_CONS(fix) \ - ((fix)->fx_r_type == 0 \ - && ((fix)->fx_size == 2 \ - || (fix)->fx_size == 1 \ - || (fix)->fx_size == 4)) -#endif - -#define SWITCH_TABLE(fix) \ - ((fix)->fx_addsy != NULL \ - && (fix)->fx_subsy != NULL \ - && S_GET_SEGMENT ((fix)->fx_addsy) == text_section \ - && S_GET_SEGMENT ((fix)->fx_subsy) == text_section \ - && ((fix)->fx_r_type == BFD_RELOC_32 \ - || (fix)->fx_r_type == BFD_RELOC_16 \ - || (fix)->fx_r_type == BFD_RELOC_8 \ - || SWITCH_TABLE_CONS (fix))) - -/* See whether we need to force a relocation into the output file. - This is used to force out switch and PC relative relocations when - relaxing. */ - -int -sh_force_relocation (fix) - fixS *fix; -{ - if (! sh_relax) - return 0; - - return (fix->fx_pcrel - || SWITCH_TABLE (fix) - || fix->fx_r_type == BFD_RELOC_SH_COUNT - || fix->fx_r_type == BFD_RELOC_SH_ALIGN - || fix->fx_r_type == BFD_RELOC_SH_CODE - || fix->fx_r_type == BFD_RELOC_SH_DATA - || fix->fx_r_type == BFD_RELOC_SH_LABEL); -} - -/* Apply a fixup to the object file. */ - -#ifdef BFD_ASSEMBLER -int -md_apply_fix (fixP, valp) - fixS *fixP; - valueT *valp; -#else -void -md_apply_fix (fixP, val) - fixS *fixP; - long val; -#endif -{ - char *buf = fixP->fx_where + fixP->fx_frag->fr_literal; - int lowbyte = target_big_endian ? 1 : 0; - int highbyte = target_big_endian ? 0 : 1; -#ifdef BFD_ASSEMBLER - long val = *valp; -#endif - long max, min; - int shift; - -#ifndef BFD_ASSEMBLER - if (fixP->fx_r_type == 0) - { - if (fixP->fx_size == 2) - fixP->fx_r_type = BFD_RELOC_16; - else if (fixP->fx_size == 4) - fixP->fx_r_type = BFD_RELOC_32; - else if (fixP->fx_size == 1) - fixP->fx_r_type = BFD_RELOC_8; - else - abort (); - } -#endif - - max = min = 0; - shift = 0; - switch (fixP->fx_r_type) - { - case BFD_RELOC_SH_IMM4: - max = 0xf; - *buf = (*buf & 0xf0) | (val & 0xf); - break; - - case BFD_RELOC_SH_IMM4BY2: - max = 0xf; - shift = 1; - *buf = (*buf & 0xf0) | ((val >> 1) & 0xf); - break; - - case BFD_RELOC_SH_IMM4BY4: - max = 0xf; - shift = 2; - *buf = (*buf & 0xf0) | ((val >> 2) & 0xf); - break; - - case BFD_RELOC_SH_IMM8BY2: - max = 0xff; - shift = 1; - *buf = val >> 1; - break; - - case BFD_RELOC_SH_IMM8BY4: - max = 0xff; - shift = 2; - *buf = val >> 2; - break; - - case BFD_RELOC_8: - case BFD_RELOC_SH_IMM8: - /* Sometimes the 8 bit value is sign extended (e.g., add) and - sometimes it is not (e.g., and). We permit any 8 bit value. - Note that adding further restrictions may invalidate - reasonable looking assembly code, such as ``and -0x1,r0''. */ - max = 0xff; - min = - 0xff; - *buf++ = val; - break; - - case BFD_RELOC_SH_PCRELIMM8BY4: - /* The lower two bits of the PC are cleared before the - displacement is added in. We can assume that the destination - is on a 4 byte bounday. If this instruction is also on a 4 - byte boundary, then we want - (target - here) / 4 - and target - here is a multiple of 4. - Otherwise, we are on a 2 byte boundary, and we want - (target - (here - 2)) / 4 - and target - here is not a multiple of 4. Computing - (target - (here - 2)) / 4 == (target - here + 2) / 4 - works for both cases, since in the first case the addition of - 2 will be removed by the division. target - here is in the - variable val. */ - val = (val + 2) / 4; - if (val & ~0xff) - as_bad_where (fixP->fx_file, fixP->fx_line, "pcrel too far"); - buf[lowbyte] = val; - break; - - case BFD_RELOC_SH_PCRELIMM8BY2: - val /= 2; - if (val & ~0xff) - as_bad_where (fixP->fx_file, fixP->fx_line, "pcrel too far"); - buf[lowbyte] = val; - break; - - case BFD_RELOC_SH_PCDISP8BY2: - val /= 2; - if (val < -0x80 || val > 0x7f) - as_bad_where (fixP->fx_file, fixP->fx_line, "pcrel too far"); - buf[lowbyte] = val; - break; - - case BFD_RELOC_SH_PCDISP12BY2: - val /= 2; - if (val < -0x800 || val >= 0x7ff) - as_bad_where (fixP->fx_file, fixP->fx_line, "pcrel too far"); - buf[lowbyte] = val & 0xff; - buf[highbyte] |= (val >> 8) & 0xf; - break; - - case BFD_RELOC_32: - if (! target_big_endian) - { - *buf++ = val >> 0; - *buf++ = val >> 8; - *buf++ = val >> 16; - *buf++ = val >> 24; - } - else - { - *buf++ = val >> 24; - *buf++ = val >> 16; - *buf++ = val >> 8; - *buf++ = val >> 0; - } - break; - - case BFD_RELOC_16: - if (! target_big_endian) - { - *buf++ = val >> 0; - *buf++ = val >> 8; - } - else - { - *buf++ = val >> 8; - *buf++ = val >> 0; - } - break; - - case BFD_RELOC_SH_USES: - /* Pass the value into sh_coff_reloc_mangle. */ - fixP->fx_addnumber = val; - break; - - case BFD_RELOC_SH_COUNT: - case BFD_RELOC_SH_ALIGN: - case BFD_RELOC_SH_CODE: - case BFD_RELOC_SH_DATA: - case BFD_RELOC_SH_LABEL: - /* Nothing to do here. */ - break; - - default: - abort (); - } - - if (shift != 0) - { - if ((val & ((1 << shift) - 1)) != 0) - as_bad_where (fixP->fx_file, fixP->fx_line, "misaligned offset"); - if (val >= 0) - val >>= shift; - else - val = ((val >> shift) - | ((long) -1 & ~ ((long) -1 >> shift))); - } - if (max != 0 && (val < min || val > max)) - as_bad_where (fixP->fx_file, fixP->fx_line, "offset out of range"); - -#ifdef BFD_ASSEMBLER - return 0; -#endif -} - -int md_long_jump_size; - -/* Called just before address relaxation. Return the length - by which a fragment must grow to reach it's destination. */ - -int -md_estimate_size_before_relax (fragP, segment_type) - register fragS *fragP; - register segT segment_type; -{ - switch (fragP->fr_subtype) - { - case C (UNCOND_JUMP, UNDEF_DISP): - /* used to be a branch to somewhere which was unknown */ - if (!fragP->fr_symbol) - { - fragP->fr_subtype = C (UNCOND_JUMP, UNCOND12); - fragP->fr_var = md_relax_table[C (UNCOND_JUMP, UNCOND12)].rlx_length; - } - else if (S_GET_SEGMENT (fragP->fr_symbol) == segment_type) - { - fragP->fr_subtype = C (UNCOND_JUMP, UNCOND12); - fragP->fr_var = md_relax_table[C (UNCOND_JUMP, UNCOND12)].rlx_length; - } - else - { - fragP->fr_subtype = C (UNCOND_JUMP, UNDEF_WORD_DISP); - fragP->fr_var = md_relax_table[C (UNCOND_JUMP, UNCOND32)].rlx_length; - return md_relax_table[C (UNCOND_JUMP, UNCOND32)].rlx_length; - } - break; - - default: - abort (); - case C (COND_JUMP, UNDEF_DISP): - /* used to be a branch to somewhere which was unknown */ - if (fragP->fr_symbol - && S_GET_SEGMENT (fragP->fr_symbol) == segment_type) - { - /* Got a symbol and it's defined in this segment, become byte - sized - maybe it will fix up */ - fragP->fr_subtype = C (COND_JUMP, COND8); - fragP->fr_var = md_relax_table[C (COND_JUMP, COND8)].rlx_length; - } - else if (fragP->fr_symbol) - { - /* Its got a segment, but its not ours, so it will always be long */ - fragP->fr_subtype = C (COND_JUMP, UNDEF_WORD_DISP); - fragP->fr_var = md_relax_table[C (COND_JUMP, COND32)].rlx_length; - return md_relax_table[C (COND_JUMP, COND32)].rlx_length; - } - else - { - /* We know the abs value */ - fragP->fr_subtype = C (COND_JUMP, COND8); - fragP->fr_var = md_relax_table[C (COND_JUMP, COND8)].rlx_length; - } - - break; - } - return fragP->fr_var; -} - -/* Put number into target byte order */ - -void -md_number_to_chars (ptr, use, nbytes) - char *ptr; - valueT use; - int nbytes; -{ - if (! target_big_endian) - number_to_chars_littleendian (ptr, use, nbytes); - else - number_to_chars_bigendian (ptr, use, nbytes); -} - -long -md_pcrel_from (fixP) - fixS *fixP; -{ - return fixP->fx_size + fixP->fx_where + fixP->fx_frag->fr_address + 2; -} - -#ifdef OBJ_COFF - -int -tc_coff_sizemachdep (frag) - fragS *frag; -{ - return md_relax_table[frag->fr_subtype].rlx_length; -} - -#endif /* OBJ_COFF */ - -/* When we align the .text section, insert the correct NOP pattern. */ - -int -sh_do_align (n, fill, len, max) - int n; - const char *fill; - int len; - int max; -{ - if (fill == NULL -#ifdef BFD_ASSEMBLER - && (now_seg->flags & SEC_CODE) != 0 -#else - && now_seg != data_section - && now_seg != bss_section -#endif - && n > 1) - { - static const unsigned char big_nop_pattern[] = { 0x00, 0x09 }; - static const unsigned char little_nop_pattern[] = { 0x09, 0x00 }; - - /* First align to a 2 byte boundary, in case there is an odd - .byte. */ - frag_align (1, 0, 0); - if (target_big_endian) - frag_align_pattern (n, big_nop_pattern, sizeof big_nop_pattern, max); - else - frag_align_pattern (n, little_nop_pattern, sizeof little_nop_pattern, - max); - return 1; - } - - return 0; -} - -#ifndef BFD_ASSEMBLER -#ifdef OBJ_COFF - -/* Map BFD relocs to SH COFF relocs. */ - -struct reloc_map -{ - bfd_reloc_code_real_type bfd_reloc; - int sh_reloc; -}; - -static const struct reloc_map coff_reloc_map[] = -{ - { BFD_RELOC_32, R_SH_IMM32 }, - { BFD_RELOC_16, R_SH_IMM16 }, - { BFD_RELOC_8, R_SH_IMM8 }, - { BFD_RELOC_SH_PCDISP8BY2, R_SH_PCDISP8BY2 }, - { BFD_RELOC_SH_PCDISP12BY2, R_SH_PCDISP }, - { BFD_RELOC_SH_IMM4, R_SH_IMM4 }, - { BFD_RELOC_SH_IMM4BY2, R_SH_IMM4BY2 }, - { BFD_RELOC_SH_IMM4BY4, R_SH_IMM4BY4 }, - { BFD_RELOC_SH_IMM8, R_SH_IMM8 }, - { BFD_RELOC_SH_IMM8BY2, R_SH_IMM8BY2 }, - { BFD_RELOC_SH_IMM8BY4, R_SH_IMM8BY4 }, - { BFD_RELOC_SH_PCRELIMM8BY2, R_SH_PCRELIMM8BY2 }, - { BFD_RELOC_SH_PCRELIMM8BY4, R_SH_PCRELIMM8BY4 }, - { BFD_RELOC_8_PCREL, R_SH_SWITCH8 }, - { BFD_RELOC_SH_SWITCH16, R_SH_SWITCH16 }, - { BFD_RELOC_SH_SWITCH32, R_SH_SWITCH32 }, - { BFD_RELOC_SH_USES, R_SH_USES }, - { BFD_RELOC_SH_COUNT, R_SH_COUNT }, - { BFD_RELOC_SH_ALIGN, R_SH_ALIGN }, - { BFD_RELOC_SH_CODE, R_SH_CODE }, - { BFD_RELOC_SH_DATA, R_SH_DATA }, - { BFD_RELOC_SH_LABEL, R_SH_LABEL }, - { BFD_RELOC_UNUSED, 0 } -}; - -/* Adjust a reloc for the SH. This is similar to the generic code, - but does some minor tweaking. */ - -void -sh_coff_reloc_mangle (seg, fix, intr, paddr) - segment_info_type *seg; - fixS *fix; - struct internal_reloc *intr; - unsigned int paddr; -{ - symbolS *symbol_ptr = fix->fx_addsy; - symbolS *dot; - - intr->r_vaddr = paddr + fix->fx_frag->fr_address + fix->fx_where; - - if (! SWITCH_TABLE (fix)) - { - const struct reloc_map *rm; - - for (rm = coff_reloc_map; rm->bfd_reloc != BFD_RELOC_UNUSED; rm++) - if (rm->bfd_reloc == (bfd_reloc_code_real_type) fix->fx_r_type) - break; - if (rm->bfd_reloc == BFD_RELOC_UNUSED) - as_bad_where (fix->fx_file, fix->fx_line, - "Can not represent %s relocation in this object file format", - bfd_get_reloc_code_name (fix->fx_r_type)); - intr->r_type = rm->sh_reloc; - intr->r_offset = 0; - } - else - { - know (sh_relax); - - if (fix->fx_r_type == BFD_RELOC_16) - intr->r_type = R_SH_SWITCH16; - else if (fix->fx_r_type == BFD_RELOC_8) - intr->r_type = R_SH_SWITCH8; - else if (fix->fx_r_type == BFD_RELOC_32) - intr->r_type = R_SH_SWITCH32; - else - abort (); - - /* For a switch reloc, we set r_offset to the difference between - the reloc address and the subtrahend. When the linker is - doing relaxing, it can use the determine the starting and - ending points of the switch difference expression. */ - intr->r_offset = intr->r_vaddr - S_GET_VALUE (fix->fx_subsy); - } - - /* PC relative relocs are always against the current section. */ - if (symbol_ptr == NULL) - { - switch (fix->fx_r_type) - { - case BFD_RELOC_SH_PCRELIMM8BY2: - case BFD_RELOC_SH_PCRELIMM8BY4: - case BFD_RELOC_SH_PCDISP8BY2: - case BFD_RELOC_SH_PCDISP12BY2: - case BFD_RELOC_SH_USES: - symbol_ptr = seg->dot; - break; - default: - break; - } - } - - if (fix->fx_r_type == BFD_RELOC_SH_USES) - { - /* We can't store the offset in the object file, since this - reloc does not take up any space, so we store it in r_offset. - The fx_addnumber field was set in md_apply_fix. */ - intr->r_offset = fix->fx_addnumber; - } - else if (fix->fx_r_type == BFD_RELOC_SH_COUNT) - { - /* We can't store the count in the object file, since this reloc - does not take up any space, so we store it in r_offset. The - fx_offset field was set when the fixup was created in - sh_coff_frob_file. */ - intr->r_offset = fix->fx_offset; - /* This reloc is always absolute. */ - symbol_ptr = NULL; - } - else if (fix->fx_r_type == BFD_RELOC_SH_ALIGN) - { - /* Store the alignment in the r_offset field. */ - intr->r_offset = fix->fx_offset; - /* This reloc is always absolute. */ - symbol_ptr = NULL; - } - else if (fix->fx_r_type == BFD_RELOC_SH_CODE - || fix->fx_r_type == BFD_RELOC_SH_DATA - || fix->fx_r_type == BFD_RELOC_SH_LABEL) - { - /* These relocs are always absolute. */ - symbol_ptr = NULL; - } - - /* Turn the segment of the symbol into an offset. */ - if (symbol_ptr != NULL) - { - dot = segment_info[S_GET_SEGMENT (symbol_ptr)].dot; - if (dot != NULL) - intr->r_symndx = dot->sy_number; - else - intr->r_symndx = symbol_ptr->sy_number; - } - else - intr->r_symndx = -1; -} - -#endif /* OBJ_COFF */ -#endif /* ! BFD_ASSEMBLER */ - -#ifdef BFD_ASSEMBLER - -/* Create a reloc. */ - -arelent * -tc_gen_reloc (section, fixp) - asection *section; - fixS *fixp; -{ - arelent *rel; - bfd_reloc_code_real_type r_type; - - rel = (arelent *) xmalloc (sizeof (arelent)); - rel->sym_ptr_ptr = &fixp->fx_addsy->bsym; - rel->address = fixp->fx_frag->fr_address + fixp->fx_where; - - r_type = fixp->fx_r_type; - - if (SWITCH_TABLE (fixp)) - { - rel->addend = rel->address - S_GET_VALUE (fixp->fx_subsy); - if (r_type == BFD_RELOC_16) - r_type = BFD_RELOC_SH_SWITCH16; - else if (r_type == BFD_RELOC_8) - r_type = BFD_RELOC_8_PCREL; - else if (r_type == BFD_RELOC_32) - r_type = BFD_RELOC_SH_SWITCH32; - else - abort (); - } - else if (r_type == BFD_RELOC_SH_USES) - rel->addend = fixp->fx_addnumber; - else if (r_type == BFD_RELOC_SH_COUNT) - rel->addend = fixp->fx_offset; - else if (r_type == BFD_RELOC_SH_ALIGN) - rel->addend = fixp->fx_offset; - else if (fixp->fx_pcrel) - rel->addend = fixp->fx_addnumber; - else - rel->addend = 0; - - rel->howto = bfd_reloc_type_lookup (stdoutput, r_type); - if (rel->howto == NULL) - { - as_bad_where (fixp->fx_file, fixp->fx_line, - "Cannot represent relocation type %s", - bfd_get_reloc_code_name (r_type)); - /* Set howto to a garbage value so that we can keep going. */ - rel->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_32); - assert (rel->howto != NULL); - } - - return rel; -} - -#endif /* BFD_ASSEMBLER */ diff --git a/contrib/binutils/gas/config/tc-sh.h b/contrib/binutils/gas/config/tc-sh.h deleted file mode 100644 index a18029b020d6..000000000000 --- a/contrib/binutils/gas/config/tc-sh.h +++ /dev/null @@ -1,141 +0,0 @@ -/* This file is tc-sh.h - Copyright (C) 1993, 94, 95, 96, 1997 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 2, 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. */ - -#define TC_SH - -#define TARGET_BYTES_BIG_ENDIAN 0 - -#define TARGET_ARCH bfd_arch_sh - -/* Whether in little endian mode. */ -extern int shl; - -/* Whether -relax was used. */ -extern int sh_relax; - -/* Whether -small was used. */ -extern int sh_small; - -/* Don't try to break words. */ -#define WORKING_DOT_WORD - -/* We require .long, et. al., to be aligned correctly. */ -#define md_cons_align(nbytes) sh_cons_align (nbytes) -extern void sh_cons_align PARAMS ((int)); - -/* When relaxing, we need to generate relocations for alignment - directives. */ -#define HANDLE_ALIGN(frag) sh_handle_align (frag) -extern void sh_handle_align PARAMS ((fragS *)); - -/* We need to force out some relocations when relaxing. */ -#define TC_FORCE_RELOCATION(fix) sh_force_relocation (fix) -extern int sh_force_relocation (); - -#define IGNORE_NONSTANDARD_ESCAPES - -#define LISTING_HEADER (shl ? "Hitachi Super-H GAS Little Endian" : "Hitachi Super-H GAS Big Endian") - -#define md_operand(x) - -extern const struct relax_type md_relax_table[]; -#define TC_GENERIC_RELAX_TABLE md_relax_table - -/* We use a special alignment function to insert the correct nop - pattern. */ -extern int sh_do_align PARAMS ((int, const char *, int, int)); -#define md_do_align(n,fill,len,max,l) if (sh_do_align (n,fill,len,max)) goto l - -/* We record, for each section, whether we have most recently output a - CODE reloc or a DATA reloc. */ -struct sh_segment_info_type -{ - int in_code : 1; -}; -#define TC_SEGMENT_INFO_TYPE struct sh_segment_info_type - -/* We call a routine to emit a reloc for a label, so that the linker - can align loads and stores without crossing a label. */ -extern void sh_frob_label PARAMS ((void)); -#define tc_frob_label(sym) sh_frob_label () - -/* We call a routine to flush pending output in order to output a DATA - reloc when required. */ -extern void sh_flush_pending_output PARAMS ((void)); -#define md_flush_pending_output() sh_flush_pending_output () - -#ifdef BFD_ASSEMBLER -#define tc_frob_file_before_adjust sh_frob_file -#else -#define tc_frob_file sh_frob_file -#endif -extern void sh_frob_file PARAMS ((void)); - -#ifdef OBJ_COFF -/* COFF specific definitions. */ - -#define DO_NOT_STRIP 0 - -/* This macro translates between an internal fix and an coff reloc type */ -#define TC_COFF_FIX2RTYPE(fix) ((fix)->fx_r_type) - -#define BFD_ARCH TARGET_ARCH - -#define COFF_MAGIC (shl ? SH_ARCH_MAGIC_LITTLE : SH_ARCH_MAGIC_BIG) - -/* We need to write out relocs which have not been completed. */ -#define TC_COUNT_RELOC(fix) ((fix)->fx_addsy != NULL) - -#define TC_RELOC_MANGLE(seg, fix, int, paddr) \ - sh_coff_reloc_mangle ((seg), (fix), (int), (paddr)) -extern void sh_coff_reloc_mangle (); - -#define tc_coff_symbol_emit_hook(a) ; /* not used */ - -#define NEED_FX_R_TYPE 1 - -#define TC_KEEP_FX_OFFSET 1 - -#define TC_COFF_SIZEMACHDEP(frag) tc_coff_sizemachdep(frag) -extern int tc_coff_sizemachdep PARAMS ((fragS *)); - -/* We align most sections to a 16 byte boundary. */ -#define SUB_SEGMENT_ALIGN(SEG) \ - (strncmp (obj_segment_name (SEG), ".stabstr", 8) == 0 \ - ? 0 \ - : ((strncmp (obj_segment_name (SEG), ".stab", 5) == 0 \ - || strcmp (obj_segment_name (SEG), ".ctors") == 0 \ - || strcmp (obj_segment_name (SEG), ".dtors") == 0) \ - ? 2 \ - : (sh_small ? 2 : 4))) - -#endif /* OBJ_COFF */ - -#ifdef OBJ_ELF -/* ELF specific definitions. */ - -/* Whether or not the target is big endian */ -extern int target_big_endian; - -#define TARGET_FORMAT (shl ? "elf32-shl" : "elf32-sh") - -#endif /* OBJ_ELF */ - -/* end of tc-sh.h */ diff --git a/contrib/binutils/gas/config/te-multi.h b/contrib/binutils/gas/config/te-multi.h deleted file mode 100644 index b8eda4505fb7..000000000000 --- a/contrib/binutils/gas/config/te-multi.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * This file is te-generic.h and is intended to be a template for - * target environment specific header files. - * - * It is my intent that this file will evolve into a file suitable for config, - * compile, and copying as an aid for testing and porting. xoxorich. - */ - -/* Added these, because if we don't know what we're targetting we may - need an assembler version of libgcc, and that will use local - labels. */ -#define LOCAL_LABELS_DOLLAR 1 -#define LOCAL_LABELS_FB 1 - -/* these define interfaces */ -#ifdef OBJ_HEADER -#include OBJ_HEADER -#else -#include "obj-format.h" -#endif - -/* end of te-generic.h */ diff --git a/contrib/binutils/gas/doc/c-sh.texi b/contrib/binutils/gas/doc/c-sh.texi deleted file mode 100644 index e20f55437883..000000000000 --- a/contrib/binutils/gas/doc/c-sh.texi +++ /dev/null @@ -1,272 +0,0 @@ -@c Copyright (C) 1991, 92, 93, 94, 95, 1997 Free Software Foundation, Inc. -@c This is part of the GAS manual. -@c For copying conditions, see the file as.texinfo. -@page -@node SH-Dependent -@chapter Hitachi SH Dependent Features - -@cindex SH support -@menu -* SH Options:: Options -* SH Syntax:: Syntax -* SH Floating Point:: Floating Point -* SH Directives:: SH Machine Directives -* SH Opcodes:: Opcodes -@end menu - -@node SH Options -@section Options - -@cindex SH options (none) -@cindex options, SH (none) -@code{@value{AS}} has no additional command-line options for the Hitachi -SH family. - -@node SH Syntax -@section Syntax - -@menu -* SH-Chars:: Special Characters -* SH-Regs:: Register Names -* SH-Addressing:: Addressing Modes -@end menu - -@node SH-Chars -@subsection Special Characters - -@cindex line comment character, SH -@cindex SH line comment character -@samp{!} is the line comment character. - -@cindex line separator, SH -@cindex statement separator, SH -@cindex SH line separator -You can use @samp{;} instead of a newline to separate statements. - -@cindex symbol names, @samp{$} in -@cindex @code{$} in symbol names -Since @samp{$} has no special meaning, you may use it in symbol names. - -@node SH-Regs -@subsection Register Names - -@cindex SH registers -@cindex registers, SH -You can use the predefined symbols @samp{r0}, @samp{r1}, @samp{r2}, -@samp{r3}, @samp{r4}, @samp{r5}, @samp{r6}, @samp{r7}, @samp{r8}, -@samp{r9}, @samp{r10}, @samp{r11}, @samp{r12}, @samp{r13}, @samp{r14}, -and @samp{r15} to refer to the SH registers. - -The SH also has these control registers: - -@table @code -@item pr -procedure register (holds return address) - -@item pc -program counter - -@item mach -@itemx macl -high and low multiply accumulator registers - -@item sr -status register - -@item gbr -global base register - -@item vbr -vector base register (for interrupt vectors) -@end table - -@node SH-Addressing -@subsection Addressing Modes - -@cindex addressing modes, SH -@cindex SH addressing modes -@code{@value{AS}} understands the following addressing modes for the SH. -@code{R@var{n}} in the following refers to any of the numbered -registers, but @emph{not} the control registers. - -@table @code -@item R@var{n} -Register direct - -@item @@R@var{n} -Register indirect - -@item @@-R@var{n} -Register indirect with pre-decrement - -@item @@R@var{n}+ -Register indirect with post-increment - -@item @@(@var{disp}, R@var{n}) -Register indirect with displacement - -@item @@(R0, R@var{n}) -Register indexed - -@item @@(@var{disp}, GBR) -@code{GBR} offset - -@item @@(R0, GBR) -GBR indexed - -@item @var{addr} -@itemx @@(@var{disp}, PC) -PC relative address (for branch or for addressing memory). The -@code{@value{AS}} implementation allows you to use the simpler form -@var{addr} anywhere a PC relative address is called for; the alternate -form is supported for compatibility with other assemblers. - -@item #@var{imm} -Immediate data -@end table - -@node SH Floating Point -@section Floating Point - -@cindex floating point, SH (@sc{ieee}) -@cindex SH floating point (@sc{ieee}) -The SH family has no hardware floating point, but the @code{.float} -directive generates @sc{ieee} floating-point numbers for compatibility -with other development tools. - -@node SH Directives -@section SH Machine Directives - -@cindex SH machine directives -@cindex machine directives, SH -@cindex @code{uaword} directive, SH -@cindex @code{ualong} directive, SH - -@table @code -@item uaword -@itemx ualong -@code{@value{AS}} will issue a warning when a misaligned @code{.word} or -@code{.long} directive is used. You may use @code{.uaword} or -@code{.ualong} to indicate that the value is intentionally misaligned. -@end table - -@node SH Opcodes -@section Opcodes - -@cindex SH opcode summary -@cindex opcode summary, SH -@cindex mnemonics, SH -@cindex instruction summary, SH -For detailed information on the SH machine instruction set, see -@cite{SH-Microcomputer User's Manual} (Hitachi Micro Systems, Inc.). - -@code{@value{AS}} implements all the standard SH opcodes. No additional -pseudo-instructions are needed on this family. Note, however, that -because @code{@value{AS}} supports a simpler form of PC-relative -addressing, you may simply write (for example) - -@example -mov.l bar,r0 -@end example - -@noindent -where other assemblers might require an explicit displacement to -@code{bar} from the program counter: - -@example -mov.l @@(@var{disp}, PC) -@end example - -@ifset SMALL -@c this table, due to the multi-col faking and hardcoded order, looks silly -@c except in smallbook. See comments below "@set SMALL" near top of this file. - -Here is a summary of SH opcodes: - -@page -@smallexample -@i{Legend:} -Rn @r{a numbered register} -Rm @r{another numbered register} -#imm @r{immediate data} -disp @r{displacement} -disp8 @r{8-bit displacement} -disp12 @r{12-bit displacement} - -add #imm,Rn lds.l @@Rn+,PR -add Rm,Rn mac.w @@Rm+,@@Rn+ -addc Rm,Rn mov #imm,Rn -addv Rm,Rn mov Rm,Rn -and #imm,R0 mov.b Rm,@@(R0,Rn) -and Rm,Rn mov.b Rm,@@-Rn -and.b #imm,@@(R0,GBR) mov.b Rm,@@Rn -bf disp8 mov.b @@(disp,Rm),R0 -bra disp12 mov.b @@(disp,GBR),R0 -bsr disp12 mov.b @@(R0,Rm),Rn -bt disp8 mov.b @@Rm+,Rn -clrmac mov.b @@Rm,Rn -clrt mov.b R0,@@(disp,Rm) -cmp/eq #imm,R0 mov.b R0,@@(disp,GBR) -cmp/eq Rm,Rn mov.l Rm,@@(disp,Rn) -cmp/ge Rm,Rn mov.l Rm,@@(R0,Rn) -cmp/gt Rm,Rn mov.l Rm,@@-Rn -cmp/hi Rm,Rn mov.l Rm,@@Rn -cmp/hs Rm,Rn mov.l @@(disp,Rn),Rm -cmp/pl Rn mov.l @@(disp,GBR),R0 -cmp/pz Rn mov.l @@(disp,PC),Rn -cmp/str Rm,Rn mov.l @@(R0,Rm),Rn -div0s Rm,Rn mov.l @@Rm+,Rn -div0u mov.l @@Rm,Rn -div1 Rm,Rn mov.l R0,@@(disp,GBR) -exts.b Rm,Rn mov.w Rm,@@(R0,Rn) -exts.w Rm,Rn mov.w Rm,@@-Rn -extu.b Rm,Rn mov.w Rm,@@Rn -extu.w Rm,Rn mov.w @@(disp,Rm),R0 -jmp @@Rn mov.w @@(disp,GBR),R0 -jsr @@Rn mov.w @@(disp,PC),Rn -ldc Rn,GBR mov.w @@(R0,Rm),Rn -ldc Rn,SR mov.w @@Rm+,Rn -ldc Rn,VBR mov.w @@Rm,Rn -ldc.l @@Rn+,GBR mov.w R0,@@(disp,Rm) -ldc.l @@Rn+,SR mov.w R0,@@(disp,GBR) -ldc.l @@Rn+,VBR mova @@(disp,PC),R0 -lds Rn,MACH movt Rn -lds Rn,MACL muls Rm,Rn -lds Rn,PR mulu Rm,Rn -lds.l @@Rn+,MACH neg Rm,Rn -lds.l @@Rn+,MACL negc Rm,Rn -@page -nop stc VBR,Rn -not Rm,Rn stc.l GBR,@@-Rn -or #imm,R0 stc.l SR,@@-Rn -or Rm,Rn stc.l VBR,@@-Rn -or.b #imm,@@(R0,GBR) sts MACH,Rn -rotcl Rn sts MACL,Rn -rotcr Rn sts PR,Rn -rotl Rn sts.l MACH,@@-Rn -rotr Rn sts.l MACL,@@-Rn -rte sts.l PR,@@-Rn -rts sub Rm,Rn -sett subc Rm,Rn -shal Rn subv Rm,Rn -shar Rn swap.b Rm,Rn -shll Rn swap.w Rm,Rn -shll16 Rn tas.b @@Rn -shll2 Rn trapa #imm -shll8 Rn tst #imm,R0 -shlr Rn tst Rm,Rn -shlr16 Rn tst.b #imm,@@(R0,GBR) -shlr2 Rn xor #imm,R0 -shlr8 Rn xor Rm,Rn -sleep xor.b #imm,@@(R0,GBR) -stc GBR,Rn xtrct Rm,Rn -stc SR,Rn -@end smallexample -@end ifset - -@ifset Hitachi-all -@ifclear GENERIC -@raisesections -@end ifclear -@end ifset - diff --git a/contrib/binutils/include/aout/sun4.h b/contrib/binutils/include/aout/sun4.h deleted file mode 100644 index f42a0dd45988..000000000000 --- a/contrib/binutils/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 <sys/param.h> */ -/* 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 <address of first entry in procedure linkage table> - <reloc_number | 0x01000000> - 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/binutils/include/coff/sh.h b/contrib/binutils/include/coff/sh.h deleted file mode 100644 index f7271f210b82..000000000000 --- a/contrib/binutils/include/coff/sh.h +++ /dev/null @@ -1,307 +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 SH_ARCH_MAGIC_WINCE 0x01a2 /* Windows CE - little endian */ -#define SH_PE_MAGIC 0x010b - - -#define SHBADMAG(x) \ - (((x).f_magic!=SH_ARCH_MAGIC_BIG) && \ - ((x).f_magic!=SH_ARCH_MAGIC_WINCE) && \ - ((x).f_magic!=SH_ARCH_MAGIC_LITTLE)) - -#define FILHDR struct external_filehdr -#define FILHSZ 20 - - -/********************** 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 28 -#define AOUTSZ 28 - - - -/* 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 */ -}; - -/* - * names of "special" sections - */ -#define _TEXT ".text" -#define _DATA ".data" -#define _BSS ".bss" - - -#define SCNHDR struct external_scnhdr -#define SCNHSZ 40 - - -/********************** 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; -#ifdef COFF_WITH_PE - char l_lnno[2]; /* line number */ -#else - char l_lnno[4]; /* line number */ -#endif -}; - -#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 -#ifdef COFF_WITH_PE -#define LINESZ 6 -#undef GET_LINENO_LNNO -#define GET_LINENO_LNNO(abfd, ext) bfd_h_get_16(abfd, (bfd_byte *) (ext->l_lnno)); -#undef PUT_LINENO_LNNO -#define PUT_LINENO_LNNO(abfd,val, ext) bfd_h_put_16(abfd,val, (bfd_byte *) (ext->l_lnno)); -#else -#define LINESZ 8 -#endif - - -/********************** 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 */ - char x_checksum[4]; /* section COMDAT checksum */ - char x_associated[2]; /* COMDAT associated section index */ - char x_comdat[1]; /* COMDAT selection number */ - } 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 */ - -#ifndef COFF_WITH_PE -struct external_reloc { - char r_vaddr[4]; - char r_symndx[4]; - char r_offset[4]; - char r_type[2]; - char r_stuff[2]; -}; -#else -struct external_reloc { - char r_vaddr[4]; - char r_symndx[4]; - char r_type[2]; -}; -#endif - - -#define RELOC struct external_reloc -#ifdef COFF_WITH_PE -#define RELSZ 10 -#else -#define RELSZ 16 -#endif - -/* SH relocation types. Not all of these are actually used. */ - -#define R_SH_UNUSED 0 /* only used internally */ -#define R_SH_IMM32CE 2 /* 32 bit immediate for WinCE */ -#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_IMAGEBASE 16 /* Windows CE */ -#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_SWITCH8 33 /* 8 bit switch table entry */ -#define R_SH_SWITCH16 25 /* 16 bit switch table entry */ -#define R_SH_SWITCH32 26 /* 32 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 referenced 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 */ - -/* The CODE and DATA reloc types are used for aligning load and store - instructions. The assembler will generate a CODE reloc before a - block of instructions. It will generate a DATA reloc before data. - A section should be processed assuming it contains data, unless a - CODE reloc is seen. The only relevant pieces of information in the - CODE and DATA relocs are the section and the address. The symbol - and offset are meaningless. */ -#define R_SH_CODE 30 /* start of code */ -#define R_SH_DATA 31 /* start of data */ - -/* The LABEL reloc type is used for aligning load and store - instructions. The assembler will generate a LABEL reloc for each - label within a block of instructions. This permits the linker to - avoid swapping instructions which are the targets of branches. */ -#define R_SH_LABEL 32 /* label */ - -/* NB: R_SH_SWITCH8 is 33 */ diff --git a/contrib/binutils/include/elf/arm-oabi.h b/contrib/binutils/include/elf/arm-oabi.h deleted file mode 100644 index da5e7316eed6..000000000000 --- a/contrib/binutils/include/elf/arm-oabi.h +++ /dev/null @@ -1,88 +0,0 @@ -/* ARM ELF support for BFD. - Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc. - - This file is part of BFD, the Binary File Descriptor library. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#ifndef _ELF_ARM_H -#define _ELF_ARM_H - -#include "elf/reloc-macros.h" - -/* Processor specific flags for the ELF header e_flags field. */ -#define EF_ARM_RELEXEC 0x01 -#define EF_ARM_HASENTRY 0x02 -#define EF_INTERWORK 0x04 -#define EF_APCS_26 0x08 -#define EF_APCS_FLOAT 0x10 -#define EF_PIC 0x20 -#define EF_ALIGN8 0x40 /* 8-bit structure alignment is in use. */ -#define EF_NEW_ABI 0x80 -#define EF_OLD_ABI 0x100 - -/* Local aliases for some flags to match names used by COFF port. */ -#define F_INTERWORK EF_INTERWORK -#define F_APCS26 EF_APCS_26 -#define F_APCS_FLOAT EF_APCS_FLOAT -#define F_PIC EF_PIC - -/* Additional symbol types for Thumb. */ -#define STT_ARM_TFUNC STT_LOPROC /* A Thumb function. */ -#define STT_ARM_16BIT STT_HIPROC /* A Thumb label. */ - -/* ARM-specific values for sh_flags. */ -#define SHF_ENTRYSECT 0x10000000 /* Section contains an entry point. */ -#define SHF_COMDEF 0x80000000 /* Section may be multiply defined in the input to a link step. */ - -/* ARM-specific program header flags. */ -#define PF_ARM_SB 0x10000000 /* Segment contains the location addressed by the static base. */ - -/* Relocation types. */ -START_RELOC_NUMBERS (elf_arm_reloc_type) - RELOC_NUMBER (R_ARM_NONE, 0) - RELOC_NUMBER (R_ARM_PC24, 1) - RELOC_NUMBER (R_ARM_ABS32, 2) - RELOC_NUMBER (R_ARM_REL32, 3) - RELOC_NUMBER (R_ARM_ABS8, 4) - RELOC_NUMBER (R_ARM_ABS16, 5) - RELOC_NUMBER (R_ARM_ABS12, 6) - RELOC_NUMBER (R_ARM_THM_ABS5, 7) - RELOC_NUMBER (R_ARM_THM_PC22, 8) - RELOC_NUMBER (R_ARM_SBREL32, 9) - RELOC_NUMBER (R_ARM_AMP_VCALL9, 10) - RELOC_NUMBER (R_ARM_THM_PC11, 11) /* Cygnus extension to abi: Thumb unconditional branch. */ - RELOC_NUMBER (R_ARM_THM_PC9, 12) /* Cygnus extension to abi: Thumb conditional branch. */ - RELOC_NUMBER (R_ARM_GNU_VTINHERIT, 13) - RELOC_NUMBER (R_ARM_GNU_VTENTRY, 14) - RELOC_NUMBER (R_ARM_COPY, 20) /* Copy symbol at runtime. */ - RELOC_NUMBER (R_ARM_GLOB_DAT, 21) /* Create GOT entry. */ - RELOC_NUMBER (R_ARM_JUMP_SLOT, 22) /* Create PLT entry. */ - RELOC_NUMBER (R_ARM_RELATIVE, 23) /* Adjust by program base. */ - RELOC_NUMBER (R_ARM_GOTOFF, 24) /* 32 bit offset to GOT. */ - RELOC_NUMBER (R_ARM_GOTPC, 25) /* 32 bit PC relative offset to GOT. */ - RELOC_NUMBER (R_ARM_GOT32, 26) /* 32 bit GOT entry. */ - RELOC_NUMBER (R_ARM_PLT32, 27) /* 32 bit PLT address. */ - FAKE_RELOC (FIRST_INVALID_RELOC, 28) - FAKE_RELOC (LAST_INVALID_RELOC, 249) - RELOC_NUMBER (R_ARM_RSBREL32, 250) - RELOC_NUMBER (R_ARM_THM_RPC22, 251) - RELOC_NUMBER (R_ARM_RREL32, 252) - RELOC_NUMBER (R_ARM_RABS32, 253) - RELOC_NUMBER (R_ARM_RPC24, 254) - RELOC_NUMBER (R_ARM_RBASE, 255) -END_RELOC_NUMBERS - -#endif diff --git a/contrib/binutils/include/elf/po/Make-in b/contrib/binutils/include/elf/po/Make-in deleted file mode 100644 index 0552db1feef3..000000000000 --- a/contrib/binutils/include/elf/po/Make-in +++ /dev/null @@ -1,251 +0,0 @@ -# Makefile for program source directory in GNU NLS utilities package. -# Copyright (C) 1995, 1996, 1997 by Ulrich Drepper <drepper@gnu.ai.mit.edu> -# -# This file file be copied and used freely without restrictions. It can -# be used in projects which are not available under the GNU Public License -# but which still want to provide support for the GNU gettext functionality. -# Please note that the actual code is *not* freely available. - -PACKAGE = @PACKAGE@ -VERSION = @VERSION@ - -SHELL = /bin/sh -@SET_MAKE@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ - -prefix = @prefix@ -exec_prefix = @exec_prefix@ -datadir = $(prefix)/@DATADIRNAME@ -localedir = $(datadir)/locale -gnulocaledir = $(prefix)/share/locale -gettextsrcdir = $(prefix)/share/gettext/po -subdir = po - -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -MKINSTALLDIRS = @MKINSTALLDIRS@ - -CC = @CC@ -GENCAT = @GENCAT@ -GMSGFMT = PATH=../src:$$PATH @GMSGFMT@ -MSGFMT = @MSGFMT@ -XGETTEXT = PATH=../src:$$PATH @XGETTEXT@ -MSGMERGE = PATH=../src:$$PATH msgmerge - -DEFS = @DEFS@ -CFLAGS = @CFLAGS@ -CPPFLAGS = @CPPFLAGS@ - -INCLUDES = -I.. -I$(top_srcdir)/intl - -COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS) - -SOURCES = cat-id-tbl.c -POFILES = @POFILES@ -GMOFILES = @GMOFILES@ -DISTFILES = ChangeLog Makefile.in.in POTFILES.in $(PACKAGE).pot \ -stamp-cat-id $(POFILES) $(GMOFILES) $(SOURCES) - -POTFILES = \ - -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -INSTOBJEXT = @INSTOBJEXT@ - -.SUFFIXES: -.SUFFIXES: .c .o .po .pox .gmo .mo .msg .cat - -.c.o: - $(COMPILE) $< - -.po.pox: - $(MAKE) $(PACKAGE).pot - $(MSGMERGE) $< $(srcdir)/$(PACKAGE).pot -o $*.pox - -.po.mo: - $(MSGFMT) -o $@ $< - -.po.gmo: - file=$(srcdir)/`echo $* | sed 's,.*/,,'`.gmo \ - && rm -f $$file && $(GMSGFMT) -o $$file $< - -.po.cat: - sed -f ../intl/po2msg.sed < $< > $*.msg \ - && rm -f $@ && $(GENCAT) $@ $*.msg - - -all: all-@USE_NLS@ - -all-yes: $(CATALOGS) @MAINT@ $(PACKAGE).pot -all-no: - -$(srcdir)/$(PACKAGE).pot: $(POTFILES) - $(XGETTEXT) --default-domain=$(PACKAGE) --directory=$(top_srcdir) \ - --add-comments --keyword=_ --keyword=N_ \ - --files-from=$(srcdir)/POTFILES.in - rm -f $(srcdir)/$(PACKAGE).pot - mv $(PACKAGE).po $(srcdir)/$(PACKAGE).pot - -$(srcdir)/cat-id-tbl.c: stamp-cat-id; @: -$(srcdir)/stamp-cat-id: $(PACKAGE).pot - rm -f cat-id-tbl.tmp - sed -f ../intl/po2tbl.sed $(srcdir)/$(PACKAGE).pot \ - | sed -e "s/@PACKAGE NAME@/$(PACKAGE)/" > cat-id-tbl.tmp - if cmp -s cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; then \ - rm cat-id-tbl.tmp; \ - else \ - echo cat-id-tbl.c changed; \ - rm -f $(srcdir)/cat-id-tbl.c; \ - mv cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; \ - fi - cd $(srcdir) && rm -f stamp-cat-id && echo timestamp > stamp-cat-id - - -install: install-exec install-data -install-exec: -install-info: -install-data: install-data-@USE_NLS@ -install-data-no: all -install-data-yes: all - if test -r $(MKINSTALLDIRS); then \ - $(MKINSTALLDIRS) $(datadir); \ - else \ - $(top_srcdir)/mkinstalldirs $(datadir); \ - fi - @catalogs='$(CATALOGS)'; \ - for cat in $$catalogs; do \ - cat=`basename $$cat`; \ - case "$$cat" in \ - *.gmo) destdir=$(gnulocaledir);; \ - *) destdir=$(localedir);; \ - esac; \ - lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \ - dir=$$destdir/$$lang/LC_MESSAGES; \ - if test -r $(MKINSTALLDIRS); then \ - $(MKINSTALLDIRS) $$dir; \ - else \ - $(top_srcdir)/mkinstalldirs $$dir; \ - fi; \ - if test -r $$cat; then \ - $(INSTALL_DATA) $$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \ - echo "installing $$cat as $$dir/$(PACKAGE)$(INSTOBJEXT)"; \ - else \ - $(INSTALL_DATA) $(srcdir)/$$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \ - echo "installing $(srcdir)/$$cat as" \ - "$$dir/$(PACKAGE)$(INSTOBJEXT)"; \ - fi; \ - if test -r $$cat.m; then \ - $(INSTALL_DATA) $$cat.m $$dir/$(PACKAGE)$(INSTOBJEXT).m; \ - echo "installing $$cat.m as $$dir/$(PACKAGE)$(INSTOBJEXT).m"; \ - else \ - if test -r $(srcdir)/$$cat.m ; then \ - $(INSTALL_DATA) $(srcdir)/$$cat.m \ - $$dir/$(PACKAGE)$(INSTOBJEXT).m; \ - echo "installing $(srcdir)/$$cat as" \ - "$$dir/$(PACKAGE)$(INSTOBJEXT).m"; \ - else \ - true; \ - fi; \ - fi; \ - done - if test "$(PACKAGE)" = "gettext"; then \ - if test -r $(MKINSTALLDIRS); then \ - $(MKINSTALLDIRS) $(gettextsrcdir); \ - else \ - $(top_srcdir)/mkinstalldirs $(gettextsrcdir); \ - fi; \ - $(INSTALL_DATA) $(srcdir)/Makefile.in.in \ - $(gettextsrcdir)/Makefile.in.in; \ - else \ - : ; \ - fi - -# Define this as empty until I found a useful application. -installcheck: - -uninstall: - catalogs='$(CATALOGS)'; \ - for cat in $$catalogs; do \ - cat=`basename $$cat`; \ - lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \ - rm -f $(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \ - rm -f $(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \ - rm -f $(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \ - rm -f $(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \ - done - rm -f $(gettextsrcdir)/po-Makefile.in.in - -check: all - -cat-id-tbl.o: ../intl/libgettext.h - -dvi info tags TAGS ID: - -mostlyclean: - rm -f core core.* *.pox $(PACKAGE).po *.old.po cat-id-tbl.tmp - rm -fr *.o - -clean: mostlyclean - -distclean: clean - rm -f Makefile Makefile.in POTFILES *.mo *.msg *.cat *.cat.m - -maintainer-clean: distclean - @echo "This command is intended for maintainers to use;" - @echo "it deletes files that may require special tools to rebuild." - rm -f $(GMOFILES) - -distdir = ../$(PACKAGE)-$(VERSION)/$(subdir) -dist distdir: update-po $(DISTFILES) - dists="$(DISTFILES)"; \ - for file in $$dists; do \ - ln $(srcdir)/$$file $(distdir) 2> /dev/null \ - || cp -p $(srcdir)/$$file $(distdir); \ - done - -update-po: Makefile - $(MAKE) $(PACKAGE).pot - PATH=`pwd`/../src:$$PATH; \ - cd $(srcdir); \ - catalogs='$(CATALOGS)'; \ - for cat in $$catalogs; do \ - cat=`basename $$cat`; \ - lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \ - mv $$lang.po $$lang.old.po; \ - echo "$$lang:"; \ - if $(MSGMERGE) $$lang.old.po $(PACKAGE).pot -o $$lang.po; then \ - rm -f $$lang.old.po; \ - else \ - echo "msgmerge for $$cat failed!"; \ - rm -f $$lang.po; \ - mv $$lang.old.po $$lang.po; \ - fi; \ - done - -POTFILES: POTFILES.in - ( if test 'x$(srcdir)' != 'x.'; then \ - posrcprefix='$(top_srcdir)/'; \ - else \ - posrcprefix="../"; \ - fi; \ - rm -f $@-t $@ \ - && (sed -e '/^#/d' -e '/^[ ]*$$/d' \ - -e "s@.*@ $$posrcprefix& \\\\@" < $(srcdir)/$@.in \ - | sed -e '$$s/\\$$//') > $@-t \ - && chmod a-w $@-t \ - && mv $@-t $@ ) - -POTFILES.in: @MAINT@ ../Makefile - cd .. && $(MAKE) po/POTFILES.in - -Makefile: Make-in ../config.status POTFILES - cd .. \ - && CONFIG_FILES=$(subdir)/Makefile.in:$(subdir)/Make-in \ - CONFIG_HEADERS= $(SHELL) ./config.status - -# Tell versions [3.59,3.63) of GNU make not to export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/contrib/binutils/include/elf/po/POTFILES.in b/contrib/binutils/include/elf/po/POTFILES.in deleted file mode 100644 index a3a05867fb25..000000000000 --- a/contrib/binutils/include/elf/po/POTFILES.in +++ /dev/null @@ -1,55 +0,0 @@ -addr2line.c -ar.c -arsup.c -arsup.h -bucomm.c -bucomm.h -budbg.h -coffdump.c -coffgrok.c -coffgrok.h -debug.c -debug.c -debug.h -dlltool.c -dlltool.h -dllwrap.c -dyn-string.c -dyn-string.h -filemode.c -ieee.c -ieee.c -is-ranlib.c -is-strip.c -maybe-ranlib.c -maybe-strip.c -nlmconv.c -nlmconv.h -nm.c -not-ranlib.c -not-strip.c -objcopy.c -objdump.c -prdbg.c -rdcoff.c -rdcoff.c -rddbg.c -rddbg.c -readelf.c -rename.c -resbin.c -rescoff.c -resrc.c -resres.c -size.c -srconv.c -stabs.c -stabs.c -strings.c -sysdump.c -version.c -windres.c -windres.h -winduni.c -winduni.h -wrstabs.c diff --git a/contrib/binutils/include/elf/po/binutils.pot b/contrib/binutils/include/elf/po/binutils.pot deleted file mode 100644 index ed7ba0c4282b..000000000000 --- a/contrib/binutils/include/elf/po/binutils.pot +++ /dev/null @@ -1,3756 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR Free Software Foundation, Inc. -# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2000-04-05 14:09+0930\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" -"Language-Team: LANGUAGE <LL@li.org>\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=CHARSET\n" -"Content-Transfer-Encoding: ENCODING\n" - -#: addr2line.c:76 -#, c-format -msgid "" -"Usage: %s [-CfsHV] [-b bfdname] [--target=bfdname]\n" -" [-e executable] [--exe=executable] [--demangle]\n" -" [--basenames] [--functions] [addr addr ...]\n" -msgstr "" - -#: addr2line.c:83 ar.c:286 nlmconv.c:1141 nm.c:306 objcopy.c:358 objcopy.c:390 -#: objdump.c:277 readelf.c:1703 size.c:89 strings.c:512 windres.c:737 -#, c-format -msgid "Report bugs to %s\n" -msgstr "" - -#: addr2line.c:243 -#, c-format -msgid "%s: can not get addresses from archive" -msgstr "" - -#: ar.c:235 -#, c-format -msgid "no entry %s in archive\n" -msgstr "" - -#: ar.c:252 -#, c-format -msgid "" -"Usage: %s [-]{dmpqrstx}[abcfilNoPsSuvV] [member-name] [count] archive-file " -"file...\n" -msgstr "" - -#: ar.c:255 -#, c-format -msgid " %s -M [<mri-script]\n" -msgstr "" - -#: ar.c:256 -msgid " commands:\n" -msgstr "" - -#: ar.c:257 -msgid " d - delete file(s) from the archive\n" -msgstr "" - -#: ar.c:258 -msgid " m[ab] - move file(s) in the archive\n" -msgstr "" - -#: ar.c:259 -msgid " p - print file(s) found in the archive\n" -msgstr "" - -#: ar.c:260 -msgid " q[f] - quick append file(s) to the archive\n" -msgstr "" - -#: ar.c:261 -msgid "" -" r[ab][f][u] - replace existing or insert new file(s) into the archive\n" -msgstr "" - -#: ar.c:262 -msgid " t - display contents of archive\n" -msgstr "" - -#: ar.c:263 -msgid " x[o] - extract file(s) from the archive\n" -msgstr "" - -#: ar.c:264 -msgid " command specific modifiers:\n" -msgstr "" - -#: ar.c:265 -msgid " [a] - put file(s) after [member-name]\n" -msgstr "" - -#: ar.c:266 -msgid " [b] - put file(s) before [member-name] (same as [i])\n" -msgstr "" - -#: ar.c:267 -msgid " [N] - use instance [count] of name\n" -msgstr "" - -#: ar.c:268 -msgid " [f] - truncate inserted file names\n" -msgstr "" - -#: ar.c:269 -msgid " [P] - use full path names when matching\n" -msgstr "" - -#: ar.c:270 -msgid " [o] - preserve original dates\n" -msgstr "" - -#: ar.c:271 -msgid "" -" [u] - only replace files that are newer than current archive " -"contents\n" -msgstr "" - -#: ar.c:272 -msgid " generic modifiers:\n" -msgstr "" - -#: ar.c:273 -msgid " [c] - do not warn if the library had to be created\n" -msgstr "" - -#: ar.c:274 -msgid " [s] - create an archive index (cf. ranlib)\n" -msgstr "" - -#: ar.c:275 -msgid " [S] - do not build a symbol table\n" -msgstr "" - -#: ar.c:276 -msgid " [v] - be verbose\n" -msgstr "" - -#: ar.c:277 -msgid " [V] - display the version number\n" -msgstr "" - -#: ar.c:281 -#, c-format -msgid "Usage: %s [-vV] archive\n" -msgstr "" - -#: ar.c:466 -msgid "two different operation options specified" -msgstr "" - -#: ar.c:541 -#, c-format -msgid "%s: illegal option -- %c\n" -msgstr "" - -#: ar.c:573 -msgid "no operation specified" -msgstr "" - -#: ar.c:576 -msgid "`u' is only meaningful with the `r' option." -msgstr "" - -#: ar.c:586 -msgid "`N' is only meaningful with the `x' and 'd' options." -msgstr "" - -#: ar.c:589 -msgid "Value for `N' must be positive." -msgstr "" - -#: ar.c:672 -#, c-format -msgid "%s: internal error -- this option not implemented\n" -msgstr "" - -#: ar.c:790 ar.c:841 ar.c:1283 objcopy.c:1104 -#, c-format -msgid "internal stat error on %s" -msgstr "" - -#: ar.c:810 ar.c:878 -#, c-format -msgid "%s is not a valid archive" -msgstr "" - -#: ar.c:846 -#, c-format -msgid "stat returns negative size for %s" -msgstr "" - -#: ar.c:967 -#, c-format -msgid "%s is not an archive" -msgstr "" - -#: ar.c:974 -#, c-format -msgid "%s: creating %s\n" -msgstr "" - -#: ar.c:1181 -#, c-format -msgid "No member named `%s'\n" -msgstr "" - -#: ar.c:1233 -#, c-format -msgid "%s: no entry %s in archive %s!\n" -msgstr "" - -#: ar.c:1395 -#, c-format -msgid "%s: no archive map to update" -msgstr "" - -#: arsup.c:87 -#, c-format -msgid "No entry %s in archive.\n" -msgstr "" - -#: arsup.c:119 -#, c-format -msgid "Can't open file %s\n" -msgstr "" - -#: arsup.c:167 -#, c-format -msgid "%s: Can't open output archive %s\n" -msgstr "" - -#: arsup.c:179 -#, c-format -msgid "%s: Can't open input archive %s\n" -msgstr "" - -#: arsup.c:185 -#, c-format -msgid "%s: file %s is not an archive\n" -msgstr "" - -#: arsup.c:226 -#, c-format -msgid "%s: no output archive specified yet\n" -msgstr "" - -#: arsup.c:246 arsup.c:281 arsup.c:317 arsup.c:337 arsup.c:395 -#, c-format -msgid "%s: no open output archive\n" -msgstr "" - -#: arsup.c:254 arsup.c:355 arsup.c:375 -#, c-format -msgid "%s: can't open file %s\n" -msgstr "" - -#: arsup.c:302 arsup.c:371 arsup.c:450 -#, c-format -msgid "%s: can't find module file %s\n" -msgstr "" - -#: arsup.c:402 -#, c-format -msgid "Current open archive is %s\n" -msgstr "" - -#: arsup.c:429 -#, c-format -msgid "%s: no open archive\n" -msgstr "" - -#: bucomm.c:139 -#, c-format -msgid "can't set BFD default target to `%s': %s" -msgstr "" - -#: bucomm.c:151 -#, c-format -msgid "%s: Matching formats:" -msgstr "" - -#: bucomm.c:168 -msgid "Supported targets:" -msgstr "" - -#: bucomm.c:170 -#, c-format -msgid "%s: supported targets:" -msgstr "" - -#: bucomm.c:263 -#, c-format -msgid "%s: bad number: %s" -msgstr "" - -#: coffdump.c:94 -#, c-format -msgid "#lines %d " -msgstr "" - -#: coffdump.c:456 sysdump.c:719 -#, c-format -msgid "%s: Print a human readable interpretation of a SYSROFF object file\n" -msgstr "" - -#: coffdump.c:498 srconv.c:1940 sysdump.c:755 -#, c-format -msgid "GNU %s version %s\n" -msgstr "" - -#: coffdump.c:516 srconv.c:1977 sysdump.c:775 -#, c-format -msgid "%s: no input file specified\n" -msgstr "" - -#: debug.c:653 -msgid "debug_add_to_current_namespace: no current file" -msgstr "" - -#: debug.c:736 -msgid "debug_start_source: no debug_set_filename call" -msgstr "" - -#: debug.c:795 -msgid "debug_record_function: no debug_set_filename call" -msgstr "" - -#: debug.c:851 -msgid "debug_record_parameter: no current function" -msgstr "" - -#: debug.c:885 -msgid "debug_end_function: no current function" -msgstr "" - -#: debug.c:891 -msgid "debug_end_function: some blocks were not closed" -msgstr "" - -#: debug.c:921 -msgid "debug_start_block: no current block" -msgstr "" - -#: debug.c:959 -msgid "debug_end_block: no current block" -msgstr "" - -#: debug.c:966 -msgid "debug_end_block: attempt to close top level block" -msgstr "" - -#: debug.c:992 -msgid "debug_record_line: no current unit" -msgstr "" - -#. FIXME -#: debug.c:1046 -msgid "debug_start_common_block: not implemented" -msgstr "" - -#. FIXME -#: debug.c:1058 -msgid "debug_end_common_block: not implemented" -msgstr "" - -#. FIXME. -#: debug.c:1152 -msgid "debug_record_label not implemented" -msgstr "" - -#: debug.c:1178 -msgid "debug_record_variable: no current file" -msgstr "" - -#: debug.c:1194 -msgid "debug_record_variable: no current block" -msgstr "" - -#: debug.c:1764 -msgid "debug_make_undefined_type: unsupported kind" -msgstr "" - -#: debug.c:1970 -msgid "debug_name_type: no current file" -msgstr "" - -#: debug.c:2018 -msgid "debug_tag_type: no current file" -msgstr "" - -#: debug.c:2026 -msgid "debug_tag_type: extra tag attempted" -msgstr "" - -#: debug.c:2066 -#, c-format -msgid "Warning: changing type size from %d to %d\n" -msgstr "" - -#: debug.c:2090 -msgid "debug_find_named_type: no current compilation unit" -msgstr "" - -#: debug.c:2197 -#, c-format -msgid "debug_get_real_type: circular debug information for %s\n" -msgstr "" - -#: debug.c:2662 -msgid "debug_write_type: illegal type encountered" -msgstr "" - -#: dlltool.c:770 dlltool.c:794 dlltool.c:819 -#, c-format -msgid "Internal error: Unknown machine type: %d\n" -msgstr "" - -#: dlltool.c:856 -#, c-format -msgid "Can't open def file: %s" -msgstr "" - -#: dlltool.c:861 -#, c-format -msgid "Processing def file: %s" -msgstr "" - -#: dlltool.c:865 -msgid "Processed def file" -msgstr "" - -#: dlltool.c:890 -#, c-format -msgid "Syntax error in def file %s:%d\n" -msgstr "" - -#: dlltool.c:923 -#, c-format -msgid "NAME: %s base: %x" -msgstr "" - -#: dlltool.c:926 -msgid "Can't have LIBRARY and NAME\n" -msgstr "" - -#: dlltool.c:942 -#, c-format -msgid "LIBRARY: %s base: %x" -msgstr "" - -#: dlltool.c:945 -#, c-format -msgid "%s: Can't have LIBRARY and NAME\n" -msgstr "" - -#: dlltool.c:1200 resrc.c:271 -#, c-format -msgid "wait: %s" -msgstr "" - -#: dlltool.c:1205 resrc.c:276 -#, c-format -msgid "subprocess got fatal signal %d" -msgstr "" - -#: dlltool.c:1211 -#, c-format -msgid "%s exited with status %d\n" -msgstr "" - -#: dlltool.c:1243 -#, c-format -msgid "Sucking in info from %s section in %s\n" -msgstr "" - -#: dlltool.c:1367 -#, c-format -msgid "Excluding symbol: %s\n" -msgstr "" - -#: dlltool.c:1462 dlltool.c:1473 nm.c:904 nm.c:915 objdump.c:444 objdump.c:461 -#, c-format -msgid "%s: no symbols\n" -msgstr "" - -#. FIXME: we ought to read in and block out the base relocations -#: dlltool.c:1500 -#, c-format -msgid "Done reading %s\n" -msgstr "" - -#: dlltool.c:1511 -#, c-format -msgid "Unable to open object file: %s" -msgstr "" - -#: dlltool.c:1514 -#, c-format -msgid "Scanning object file %s" -msgstr "" - -#: dlltool.c:1529 -#, c-format -msgid "Cannot produce mcore-elf dll from archive file: %s" -msgstr "" - -#: dlltool.c:1621 -msgid "Adding exports to output file" -msgstr "" - -#: dlltool.c:1666 -msgid "Added exports to output file" -msgstr "" - -#: dlltool.c:1790 -#, c-format -msgid "Generating export file: %s\n" -msgstr "" - -#: dlltool.c:1795 -#, c-format -msgid "Unable to open temporary assembler file: %s" -msgstr "" - -#: dlltool.c:1798 -#, c-format -msgid "Opened temporary file: %s" -msgstr "" - -#: dlltool.c:2012 -msgid "Generated exports file" -msgstr "" - -#: dlltool.c:2267 -#, c-format -msgid "bfd_open failed open stub file: %s" -msgstr "" - -#: dlltool.c:2270 -#, c-format -msgid "Creating stub file: %s" -msgstr "" - -#: dlltool.c:2657 -#, c-format -msgid "failed to open temporary head file: %s" -msgstr "" - -#: dlltool.c:2716 -#, c-format -msgid "failed to open temporary tail file: %s" -msgstr "" - -#: dlltool.c:2784 -#, c-format -msgid "Can't open .lib file: %s" -msgstr "" - -#: dlltool.c:2787 -#, c-format -msgid "Creating library file: %s\n" -msgstr "" - -#: dlltool.c:2846 -#, c-format -msgid "cannot delete %s: %s\n" -msgstr "" - -#: dlltool.c:2850 -msgid "Created lib file" -msgstr "" - -#: dlltool.c:2955 -#, c-format -msgid "Warning, ignoring duplicate EXPORT %s %d,%d\n" -msgstr "" - -#: dlltool.c:2961 -#, c-format -msgid "Error, duplicate EXPORT with oridinals: %s" -msgstr "" - -#: dlltool.c:3088 -msgid "Processing definitions" -msgstr "" - -#: dlltool.c:3126 -msgid "Processed definitions" -msgstr "" - -#. xgetext:c-format -#: dlltool.c:3137 -#, c-format -msgid "Usage %s <options> <object-files>\n" -msgstr "" - -#. xgetext:c-format -#: dlltool.c:3139 -#, c-format -msgid "" -" -m --machine <machine> Create as DLL for <machine>. [default: %s]\n" -msgstr "" - -#: dlltool.c:3140 -msgid "" -" possible <machine>: arm[_interwork], i386, mcore[-elf]{-le|-be}, " -"ppc, thumb\n" -msgstr "" - -#: dlltool.c:3141 -msgid " -e --output-exp <outname> Generate an export file.\n" -msgstr "" - -#: dlltool.c:3142 -msgid " -l --output-lib <outname> Generate an interface library.\n" -msgstr "" - -#: dlltool.c:3143 -msgid " -a --add-indirect Add dll indirects to export file.\n" -msgstr "" - -#: dlltool.c:3144 -msgid "" -" -D --dllname <name> Name of input dll to put into interface lib.\n" -msgstr "" - -#: dlltool.c:3145 -msgid " -d --input-def <deffile> Name of .def file to be read in.\n" -msgstr "" - -#: dlltool.c:3146 -msgid " -z --output-def <deffile> Name of .def file to be created.\n" -msgstr "" - -#: dlltool.c:3147 -msgid " --export-all-symbols Export all symbols to .def\n" -msgstr "" - -#: dlltool.c:3148 -msgid " --no-export-all-symbols Only export listed symbols\n" -msgstr "" - -#: dlltool.c:3149 -msgid " --exclude-symbols <list> Don't export <list>\n" -msgstr "" - -#: dlltool.c:3150 -msgid " --no-default-excludes Clear default exclude symbols\n" -msgstr "" - -#: dlltool.c:3151 -msgid " -b --base-file <basefile> Read linker generated base file.\n" -msgstr "" - -#: dlltool.c:3152 -msgid " -x --no-idata4 Don't generate idata$4 section.\n" -msgstr "" - -#: dlltool.c:3153 -msgid " -c --no-idata5 Don't generate idata$5 section.\n" -msgstr "" - -#: dlltool.c:3154 -msgid "" -" -U --add-underscore Add underscores to symbols in interface " -"library.\n" -msgstr "" - -#: dlltool.c:3155 -msgid " -k --kill-at Kill @<n> from exported names.\n" -msgstr "" - -#: dlltool.c:3156 -msgid " -A --add-stdcall-alias Add aliases without @<n>.\n" -msgstr "" - -#: dlltool.c:3157 -msgid " -S --as <name> Use <name> for assembler.\n" -msgstr "" - -#: dlltool.c:3158 -msgid " -f --as-flags <flags> Pass <flags> to the assembler.\n" -msgstr "" - -#: dlltool.c:3159 -msgid "" -" -C --compat-implib Create backward compatible import library.\n" -msgstr "" - -#: dlltool.c:3160 -msgid "" -" -n --no-delete Keep temp files (repeat for extra " -"preservation).\n" -msgstr "" - -#: dlltool.c:3161 -msgid " -v --verbose Be verbose.\n" -msgstr "" - -#: dlltool.c:3162 -msgid " -V --version Display the program version.\n" -msgstr "" - -#: dlltool.c:3163 -msgid " -h --help Display this information.\n" -msgstr "" - -#: dlltool.c:3165 -msgid "" -" -M --mcore-elf <outname> Process mcore-elf object files into <outname>.\n" -msgstr "" - -#: dlltool.c:3166 -msgid " -L --linker <name> Use <name> as the linker.\n" -msgstr "" - -#: dlltool.c:3167 -msgid " -F --linker-flags <flags> Pass <flags> to the linker.\n" -msgstr "" - -#: dlltool.c:3311 -#, c-format -msgid "Unable to open base-file: %s" -msgstr "" - -#: dlltool.c:3340 -#, c-format -msgid "Machine '%s' not supported" -msgstr "" - -#: dlltool.c:3443 dllwrap.c:215 -#, c-format -msgid "Tried file: %s" -msgstr "" - -#: dlltool.c:3450 dllwrap.c:222 -#, c-format -msgid "Using file: %s" -msgstr "" - -#: ieee.c:316 -msgid "unexpected end of debugging information" -msgstr "" - -#: ieee.c:411 -msgid "invalid number" -msgstr "" - -#: ieee.c:470 -msgid "invalid string length" -msgstr "" - -#: ieee.c:527 ieee.c:568 -msgid "expression stack overflow" -msgstr "" - -#: ieee.c:547 -msgid "unsupported IEEE expression operator" -msgstr "" - -#: ieee.c:562 -msgid "unknown section" -msgstr "" - -#: ieee.c:583 -msgid "expression stack underflow" -msgstr "" - -#: ieee.c:597 -msgid "expression stack mismatch" -msgstr "" - -#: ieee.c:636 -msgid "unknown builtin type" -msgstr "" - -#: ieee.c:781 -msgid "BCD float type not supported" -msgstr "" - -#: ieee.c:927 -msgid "unexpected number" -msgstr "" - -#: ieee.c:934 -msgid "unexpected record type" -msgstr "" - -#: ieee.c:967 -msgid "blocks left on stack at end" -msgstr "" - -#: ieee.c:1232 -msgid "unknown BB type" -msgstr "" - -#: ieee.c:1241 -msgid "stack overflow" -msgstr "" - -#: ieee.c:1266 -msgid "stack underflow" -msgstr "" - -#: ieee.c:1380 ieee.c:1452 ieee.c:2151 -msgid "illegal variable index" -msgstr "" - -#: ieee.c:1430 -msgid "illegal type index" -msgstr "" - -#: ieee.c:1440 ieee.c:1477 -msgid "unknown TY code" -msgstr "" - -#: ieee.c:1459 -msgid "undefined variable in TY" -msgstr "" - -#. Pascal file name. FIXME. -#: ieee.c:1870 -msgid "Pascal file name not supported" -msgstr "" - -#: ieee.c:1918 -msgid "unsupported qualifer" -msgstr "" - -#: ieee.c:2189 -msgid "undefined variable in ATN" -msgstr "" - -#: ieee.c:2232 -msgid "unknown ATN type" -msgstr "" - -#. Reserved for FORTRAN common. -#: ieee.c:2354 -msgid "unsupported ATN11" -msgstr "" - -#. We have no way to record this information. FIXME. -#: ieee.c:2381 -msgid "unsupported ATN12" -msgstr "" - -#: ieee.c:2441 -msgid "unexpected string in C++ misc" -msgstr "" - -#: ieee.c:2454 -msgid "bad misc record" -msgstr "" - -#: ieee.c:2497 -msgid "unrecognized C++ misc record" -msgstr "" - -#: ieee.c:2614 -msgid "undefined C++ object" -msgstr "" - -#: ieee.c:2648 -msgid "unrecognized C++ object spec" -msgstr "" - -#: ieee.c:2684 -msgid "unsupported C++ object type" -msgstr "" - -#: ieee.c:2694 -msgid "C++ base class not defined" -msgstr "" - -#: ieee.c:2706 ieee.c:2811 -msgid "C++ object has no fields" -msgstr "" - -#: ieee.c:2725 -msgid "C++ base class not found in container" -msgstr "" - -#: ieee.c:2832 -msgid "C++ data member not found in container" -msgstr "" - -#: ieee.c:2873 ieee.c:3023 -msgid "unknown C++ visibility" -msgstr "" - -#: ieee.c:2907 -msgid "bad C++ field bit pos or size" -msgstr "" - -#: ieee.c:2999 -msgid "bad type for C++ method function" -msgstr "" - -#: ieee.c:3009 -msgid "no type information for C++ method function" -msgstr "" - -#: ieee.c:3048 -msgid "C++ static virtual method" -msgstr "" - -#: ieee.c:3143 -msgid "unrecognized C++ object overhead spec" -msgstr "" - -#: ieee.c:3182 -msgid "undefined C++ vtable" -msgstr "" - -#: ieee.c:3253 -msgid "C++ default values not in a function" -msgstr "" - -#: ieee.c:3293 -msgid "unrecognized C++ default type" -msgstr "" - -#: ieee.c:3324 -msgid "reference parameter is not a pointer" -msgstr "" - -#: ieee.c:3409 -msgid "unrecognized C++ reference type" -msgstr "" - -#: ieee.c:3491 -msgid "C++ reference not found" -msgstr "" - -#: ieee.c:3499 -msgid "C++ reference is not pointer" -msgstr "" - -#: ieee.c:3528 ieee.c:3536 -msgid "missing required ASN" -msgstr "" - -#: ieee.c:3566 ieee.c:3574 -msgid "missing required ATN65" -msgstr "" - -#: ieee.c:3588 -msgid "bad ATN65 record" -msgstr "" - -#: ieee.c:4235 -msgid "IEEE numeric overflow: 0x" -msgstr "" - -#: ieee.c:4281 -#, c-format -msgid "IEEE string length overflow: %u\n" -msgstr "" - -#: ieee.c:5315 -#, c-format -msgid "IEEE unsupported integer type size %u\n" -msgstr "" - -#: ieee.c:5351 -#, c-format -msgid "IEEE unsupported float type size %u\n" -msgstr "" - -#: ieee.c:5387 -#, c-format -msgid "IEEE unsupported complex type size %u\n" -msgstr "" - -#: nlmconv.c:275 srconv.c:1966 -#, c-format -msgid "%s: input and output files must be different\n" -msgstr "" - -#: nlmconv.c:325 -#, c-format -msgid "%s: input file named both on command line and with INPUT\n" -msgstr "" - -#: nlmconv.c:336 -#, c-format -msgid "%s: no input file\n" -msgstr "" - -#: nlmconv.c:366 -#, c-format -msgid "%s: no name for output file\n" -msgstr "" - -#: nlmconv.c:381 -#, c-format -msgid "%s: warning:input and output formats are not compatible\n" -msgstr "" - -#: nlmconv.c:411 -msgid "make .bss section" -msgstr "" - -#: nlmconv.c:420 -msgid "make .nlmsections section" -msgstr "" - -#: nlmconv.c:422 -msgid "set .nlmsections flags" -msgstr "" - -#: nlmconv.c:450 -msgid "set .bss vma" -msgstr "" - -#: nlmconv.c:457 -msgid "set .data size" -msgstr "" - -#: nlmconv.c:638 -#, c-format -msgid "%s: warning: symbol %s imported but not in import list\n" -msgstr "" - -#: nlmconv.c:658 -msgid "set start address" -msgstr "" - -#: nlmconv.c:707 -#, c-format -msgid "%s: warning: START procedure %s not defined\n" -msgstr "" - -#: nlmconv.c:710 -#, c-format -msgid "%s: warning: EXIT procedure %s not defined\n" -msgstr "" - -#: nlmconv.c:714 -#, c-format -msgid "%s: warning: CHECK procedure %s not defined\n" -msgstr "" - -#: nlmconv.c:736 nlmconv.c:928 -msgid "custom section" -msgstr "" - -#: nlmconv.c:757 nlmconv.c:960 -msgid "help section" -msgstr "" - -#: nlmconv.c:779 nlmconv.c:979 -msgid "message section" -msgstr "" - -#: nlmconv.c:795 nlmconv.c:1012 -msgid "module section" -msgstr "" - -#: nlmconv.c:815 nlmconv.c:1029 -msgid "rpc section" -msgstr "" - -#: nlmconv.c:852 -#, c-format -msgid "%s:%s: warning: shared libraries can not have uninitialized data\n" -msgstr "" - -#: nlmconv.c:873 nlmconv.c:1049 -msgid "shared section" -msgstr "" - -#: nlmconv.c:881 -#, c-format -msgid "%s: warning: No version number given\n" -msgstr "" - -#: nlmconv.c:922 nlmconv.c:954 nlmconv.c:973 nlmconv.c:1023 nlmconv.c:1043 -#, c-format -msgid "%s:%s: read: %s\n" -msgstr "" - -#: nlmconv.c:946 -#, c-format -msgid "%s: warning: MAP and FULLMAP are not supported; try ld -M\n" -msgstr "" - -#: nlmconv.c:1121 -#, c-format -msgid "%s: Convert an object file into a NetWare Loadable Module\n" -msgstr "" - -#: nlmconv.c:1133 -#, c-format -msgid "" -"Usage: %s [-dhV] [-I bfdname] [-O bfdname] [-T header-file] [-l linker]\n" -" [--input-target=bfdname] [--output-target=bfdname]\n" -" [--header-file=file] [--linker=linker] [--debug]\n" -" [--help] [--version]\n" -" [in-file [out-file]]\n" -msgstr "" - -#: nlmconv.c:1173 -#, c-format -msgid "%s: support not compiled in for %s\n" -msgstr "" - -#: nlmconv.c:1216 -msgid "make section" -msgstr "" - -#: nlmconv.c:1230 -msgid "set section size" -msgstr "" - -#: nlmconv.c:1236 -msgid "set section alignment" -msgstr "" - -#: nlmconv.c:1240 -msgid "set section flags" -msgstr "" - -#: nlmconv.c:1251 -msgid "set .nlmsections size" -msgstr "" - -#: nlmconv.c:1339 nlmconv.c:1347 nlmconv.c:1356 nlmconv.c:1361 -msgid "set .nlmsection contents" -msgstr "" - -#: nlmconv.c:1864 -msgid "stub section sizes" -msgstr "" - -#: nlmconv.c:1913 -msgid "writing stub" -msgstr "" - -#: nlmconv.c:2003 -#, c-format -msgid "%s: unresolved PC relative reloc against %s\n" -msgstr "" - -#: nlmconv.c:2068 -#, c-format -msgid "%s: overflow when adjusting relocation against %s\n" -msgstr "" - -#: nlmconv.c:2191 -#, c-format -msgid "%s: execution of %s failed: " -msgstr "" - -#: nlmconv.c:2206 -#, c-format -msgid "%s: Execution of %s failed\n" -msgstr "" - -#: nm.c:294 -#, c-format -msgid "" -"Usage: %s [-aABCDglnopPrsuvV] [-t radix] [--radix=radix] [--target=bfdname]\n" -" [--debug-syms] [--extern-only] [--print-armap] [--print-file-name]\n" -" [--numeric-sort] [--no-sort] [--reverse-sort] [--size-sort]\n" -" [--undefined-only] [--portability] [-f {bsd,sysv,posix}]\n" -" [--format={bsd,sysv,posix}] [--demangle] [--no-demangle] [--dynamic]\n" -" [--defined-only] [--line-numbers]\n" -" [--version] [--help]\n" -" [file...]\n" -msgstr "" - -#: nm.c:339 -#, c-format -msgid "%s: %s: invalid radix\n" -msgstr "" - -#: nm.c:365 -#, c-format -msgid "%s: %s: invalid output format\n" -msgstr "" - -#: nm.c:492 -#, c-format -msgid "%s: data size %ld\n" -msgstr "" - -#: nm.c:1283 -#, c-format -msgid "" -"\n" -"\n" -"Undefined symbols from %s:\n" -"\n" -msgstr "" - -#: nm.c:1285 -#, c-format -msgid "" -"\n" -"\n" -"Symbols from %s:\n" -"\n" -msgstr "" - -#: nm.c:1286 nm.c:1340 -msgid "" -"Name Value Class Type Size Line " -"Section\n" -"\n" -msgstr "" - -#: nm.c:1337 -#, c-format -msgid "" -"\n" -"\n" -"Undefined symbols from %s[%s]:\n" -"\n" -msgstr "" - -#: nm.c:1339 -#, c-format -msgid "" -"\n" -"\n" -"Symbols from %s[%s]:\n" -"\n" -msgstr "" - -#: nm.c:1510 -msgid "" -"\n" -"Archive index:\n" -msgstr "" - -#: objcopy.c:309 -#, c-format -msgid "Usage: %s <switches> in-file [out-file]\n" -msgstr "" - -#: objcopy.c:310 objcopy.c:368 -msgid " The switches are:\n" -msgstr "" - -#: objcopy.c:311 -msgid "" -" -I --input-target <bfdname> Assume input file is in format <bfdname>\n" -" -O --output-target <bfdname> Create an output file in format " -"<bfdname>\n" -" -F --target <bfdname> Set both input and output format to " -"<bfdname>\n" -" --debugging Convert debugging information, if " -"possible\n" -" -p --preserve-dates Copy modified/access timestamps to the " -"output\n" -" -j --only-section <name> Only copy section <name> into the output\n" -" -R --remove-section <name> Remove section <name> from the output\n" -" -S --strip-all Remove all symbol and relocation " -"information\n" -" -g --strip-debug Remove all debugging symbols\n" -" --strip-unneeded Remove all symbols not needed by " -"relocations\n" -" -N --strip-symbol <name> Do not copy symbol <name>\n" -" -K --keep-symbol <name> Only copy symbol <name>\n" -" -L --localize-symbol <name> Force symbol <name> to be marked as a " -"local\n" -" -W --weaken-symbol <name> Force symbol <name> to be marked as a " -"weak\n" -" --weaken Force all global symbols to be marked as " -"weak\n" -" -x --discard-all Remove all non-global symbols\n" -" -X --discard-locals Remove any compiler-generated symbols\n" -" -i --interleave <number> Only copy one out of every <number> " -"bytes\n" -" -b --byte <num> Select byte <num> in every interleaved " -"block\n" -" --gap-fill <val> Fill gaps between sections with <val>\n" -" --pad-to <addr> Pad the last section up to address " -"<addr>\n" -" --set-start <addr> Set the start address to <addr>\n" -" {--change-start|--adjust-start} <incr>\n" -" Add <incr> to the start address\n" -" {--change-addresses|--adjust-vma} <incr>\n" -" Add <incr> to LMA, VMA and start " -"addresses\n" -" {--change-section-address|--adjust-section-vma} <name>{=|+|-}<val>\n" -" Change LMA and VMA of section <name> by " -"<val>\n" -" --change-section-lma <name>{=|+|-}<val>\n" -" Change the LMA of section <name> by " -"<val>\n" -" --change-section-vma <name>{=|+|-}<val>\n" -" Change the VMA of section <name> by " -"<val>\n" -" {--[no-]change-warnings|--[no-]adjust-warnings}\n" -" Warn if a named section does not exist\n" -" --set-section-flags <name>=<flags>\n" -" Set section <name>'s properties to " -"<flags>\n" -" --add-section <name>=<file> Add section <name> found in <file> to " -"output\n" -" --change-leading-char Force output format's leading character " -"style\n" -" --remove-leading-char Remove leading character from global " -"symbols\n" -" --redefine-sym <old>=<new> Redefine symbol name <old> to <new>\n" -" -v --verbose List all object files modified\n" -" -V --version Display this program's version number\n" -" -h --help Display this output\n" -msgstr "" - -#: objcopy.c:367 -#, c-format -msgid "Usage: %s <switches> in-file(s)\n" -msgstr "" - -#: objcopy.c:369 -msgid "" -" -I --input-target <bfdname> Assume input file is in format <bfdname>\n" -" -O --output-target <bfdname> Create an output file in format " -"<bfdname>\n" -" -F --target <bfdname> Set both input and output format to " -"<bfdname>\n" -" -p --preserve-dates Copy modified/access timestamps to the " -"output\n" -" -R --remove-section <name> Remove section <name> from the output\n" -" -s --strip-all Remove all symbol and relocation " -"information\n" -" -g -S --strip-debug Remove all debugging symbols\n" -" --strip-unneeded Remove all symbols not needed by " -"relocations\n" -" -N --strip-symbol <name> Do not copy symbol <name>\n" -" -K --keep-symbol <name> Only copy symbol <name>\n" -" -x --discard-all Remove all non-global symbols\n" -" -X --discard-locals Remove any compiler-generated symbols\n" -" -v --verbose List all object files modified\n" -" -V --version Display this program's version number\n" -" -h --help Display this output\n" -" -o <file> Place stripped output into <file>\n" -msgstr "" - -#: objcopy.c:439 -#, c-format -msgid "unrecognized section flag `%s'" -msgstr "" - -#: objcopy.c:440 -#, c-format -msgid "supported flags: %s" -msgstr "" - -#: objcopy.c:692 -#, c-format -msgid "%s: Multiple redefinition of symbol \"%s\"" -msgstr "" - -#: objcopy.c:699 -#, c-format -msgid "%s: Symbol \"%s\" is target of more than one redefinition" -msgstr "" - -#: objcopy.c:753 -#, c-format -msgid "copy from %s(%s) to %s(%s)\n" -msgstr "" - -#: objcopy.c:772 -#, c-format -msgid "Warning: Output file cannot represent architecture %s" -msgstr "" - -#: objcopy.c:799 -#, c-format -msgid "can't create section `%s': %s" -msgstr "" - -#: objcopy.c:885 -#, c-format -msgid "Can't fill gap after %s: %s" -msgstr "" - -#: objcopy.c:910 -#, c-format -msgid "Can't add padding to %s: %s" -msgstr "" - -#: objcopy.c:1048 -#, c-format -msgid "%s: error copying private BFD data: %s" -msgstr "" - -#: objcopy.c:1082 -#, c-format -msgid "cannot mkdir %s for archive copying (error: %s)" -msgstr "" - -#: objcopy.c:1351 -#, c-format -msgid "%s: section `%s': error in %s: %s" -msgstr "" - -#: objcopy.c:1625 -#, c-format -msgid "%s: can't create debugging section: %s" -msgstr "" - -#: objcopy.c:1640 -#, c-format -msgid "%s: can't set debugging section contents: %s" -msgstr "" - -#: objcopy.c:1649 -#, c-format -msgid "%s: don't know how to write debugging information for %s" -msgstr "" - -#: objcopy.c:1754 -#, c-format -msgid "%s: cannot stat: %s" -msgstr "" - -#: objcopy.c:1804 -msgid "byte number must be non-negative" -msgstr "" - -#: objcopy.c:1810 -msgid "interleave must be positive" -msgstr "" - -#: objcopy.c:1830 objcopy.c:1838 -#, c-format -msgid "%s both copied and removed" -msgstr "" - -#: objcopy.c:1907 objcopy.c:1977 objcopy.c:2078 objcopy.c:2106 -#, c-format -msgid "bad format for %s" -msgstr "" - -#: objcopy.c:1910 -#, c-format -msgid "cannot stat: %s: %s" -msgstr "" - -#: objcopy.c:1928 -#, c-format -msgid "cannot open: %s: %s" -msgstr "" - -#: objcopy.c:1932 -#, c-format -msgid "%s: fread failed" -msgstr "" - -#: objcopy.c:2046 -#, c-format -msgid "Warning: truncating gap-fill from 0x%s to 0x%x" -msgstr "" - -#: objcopy.c:2140 -msgid "byte number must be less than interleave" -msgstr "" - -#: objcopy.c:2159 -#, c-format -msgid "Cannot stat: %s: %s" -msgstr "" - -#: objcopy.c:2199 objcopy.c:2213 -#, c-format -msgid "%s %s%c0x%s never used" -msgstr "" - -#: objdump.c:229 -#, c-format -msgid "Usage: %s <switches> file(s)\n" -msgstr "" - -#: objdump.c:230 -msgid " At least one of the following switches must be given:\n" -msgstr "" - -#: objdump.c:231 -msgid "" -" -a --archive-headers Display archive header information\n" -" -f --file-headers Display the contents of the overall file header\n" -" -p --private-headers Display object format specific file header " -"contents\n" -" -h --[section-]headers Display the contents of the section headers\n" -" -x --all-headers Display the contents of all headers\n" -" -d --disassemble Display assembler contents of executable " -"sections\n" -" -D --disassemble-all Display assembler contents of all sections\n" -" -S --source Intermix source code with disassembly\n" -" -s --full-contents Display the full contents of all sections " -"requested\n" -" -g --debugging Display debug information in object file\n" -" -G --stabs Display the STABS contents of an ELF format file\n" -" -t --syms Display the contents of the symbol table(s)\n" -" -T --dynamic-syms Display the contents of the dynamic symbol table\n" -" -r --reloc Display the relocation entries in the file\n" -" -R --dynamic-reloc Display the dynamic relocation entries in the " -"file\n" -" -V --version Display this program's version number\n" -" -i --info List object formats and architectures supported\n" -" -H --help Display this information\n" -msgstr "" - -#: objdump.c:253 -msgid "" -"\n" -" The following switches are optional:\n" -msgstr "" - -#: objdump.c:254 -msgid "" -" -b --target <bfdname> Specify the target object format as " -"<bfdname>\n" -" -m --architecture <machine> Specify the target architecture as " -"<machine>\n" -" -j --section <name> Only display information for section " -"<name>\n" -" -M --disassembler-options <o> Pass text <o> on to the disassembler\n" -" -EB --endian=big Assume big endian format when " -"disassembling\n" -" -EL --endian=little Assume little endian format when " -"disassembling\n" -" --file-start-context Include context from start of file (with " -"-S)\n" -" -l --line-numbers Include line numbers and filenames in " -"output\n" -" -C --demangle Decode mangled/processed symbol names\n" -" -w --wide Format output for more than 80 columns\n" -" -z --disassemble-zeroes Do not skip blocks of zeroes when " -"disassembling\n" -" --start-address <addr> Only process data whoes address is >= " -"<addr>\n" -" --stop-address <addr> Only process data whoes address is <= " -"<addr>\n" -" --prefix-addresses Print complete address alongside " -"disassembly\n" -" --[no-]show-raw-insn Display hex alongside symbolic disassembly\n" -" --adjust-vma <offset> Add <offset> to all displayed section " -"addresses\n" -"\n" -msgstr "" - -#: objdump.c:420 -msgid "Sections:\n" -msgstr "" - -#: objdump.c:423 -msgid "Idx Name Size VMA LMA File off Algn" -msgstr "" - -#: objdump.c:425 -msgid "" -"Idx Name Size VMA LMA File off " -"Algn" -msgstr "" - -#: objdump.c:429 -msgid " Flags" -msgstr "" - -#: objdump.c:479 -#, c-format -msgid "%s: %s: not a dynamic object\n" -msgstr "" - -#: objdump.c:496 -#, c-format -msgid "%s: %s: No dynamic symbols\n" -msgstr "" - -#: objdump.c:1200 -msgid "Out of virtual memory\n" -msgstr "" - -#: objdump.c:1611 -#, c-format -msgid "%s: Can't use supplied machine %s\n" -msgstr "" - -#: objdump.c:1632 -#, c-format -msgid "%s: Can't disassemble for architecture %s\n" -msgstr "" - -#: objdump.c:1709 -#, c-format -msgid "Disassembly of section %s:\n" -msgstr "" - -#: objdump.c:1883 -#, c-format -msgid "" -"No %s section present\n" -"\n" -msgstr "" - -#: objdump.c:1890 -#, c-format -msgid "%s: %s has no %s section\n" -msgstr "" - -#: objdump.c:1904 objdump.c:1916 -#, c-format -msgid "%s: Reading %s section of %s failed: %s\n" -msgstr "" - -#: objdump.c:1959 -#, c-format -msgid "" -"Contents of %s section:\n" -"\n" -msgstr "" - -#: objdump.c:2059 -#, c-format -msgid "architecture: %s, " -msgstr "" - -#: objdump.c:2062 -#, c-format -msgid "flags 0x%08x:\n" -msgstr "" - -#: objdump.c:2075 -msgid "" -"\n" -"start address 0x" -msgstr "" - -#: objdump.c:2107 -#, c-format -msgid "" -"\n" -"%s: file format %s\n" -msgstr "" - -#: objdump.c:2150 -#, c-format -msgid "%s: printing debugging information failed\n" -msgstr "" - -#: objdump.c:2227 -#, c-format -msgid "In archive %s:\n" -msgstr "" - -#: objdump.c:2279 -#, c-format -msgid "Contents of section %s:\n" -msgstr "" - -#: objdump.c:2788 -#, c-format -msgid "BFD header file version %s\n" -msgstr "" - -#: objdump.c:2861 -#, c-format -msgid "%s: unrecognized -E option\n" -msgstr "" - -#: objdump.c:2873 -#, c-format -msgid "%s: unrecognized --endian type `%s'\n" -msgstr "" - -#: rdcoff.c:204 -#, c-format -msgid "%s: parse_coff_type: Bad type code 0x%x\n" -msgstr "" - -#: rdcoff.c:423 rdcoff.c:531 rdcoff.c:712 -#, c-format -msgid "%s: bfd_coff_get_syment failed: %s\n" -msgstr "" - -#: rdcoff.c:439 rdcoff.c:732 -#, c-format -msgid "%s: bfd_coff_get_auxent failed: %s\n" -msgstr "" - -#: rdcoff.c:798 -#, c-format -msgid "%s: %ld: .bf without preceding function\n" -msgstr "" - -#: rdcoff.c:848 -#, c-format -msgid "%s: %ld: unexpected .ef\n" -msgstr "" - -#: rddbg.c:87 -#, c-format -msgid "%s: no recognized debugging information\n" -msgstr "" - -#: rddbg.c:410 -msgid "Last stabs entries before error:\n" -msgstr "" - -#: readelf.c:303 readelf.c:329 -#, c-format -msgid "%s: Error: " -msgstr "" - -#: readelf.c:315 readelf.c:344 -#, c-format -msgid "%s: Warning: " -msgstr "" - -#: readelf.c:394 readelf.c:532 -#, c-format -msgid "Unhandled data length: %d\n" -msgstr "" - -#: readelf.c:591 -msgid "Don't know about relocations on this machine architecture\n" -msgstr "" - -#: readelf.c:631 readelf.c:660 readelf.c:692 readelf.c:720 -msgid "out of memory parsing relocs" -msgstr "" - -#: readelf.c:738 -msgid "" -" Offset Info Type Symbol's Value Symbol's Name " -"Addend\n" -msgstr "" - -#: readelf.c:741 -msgid " Offset Info Type Symbol's Value Symbol's Name\n" -msgstr "" - -#: readelf.c:885 readelf.c:887 -#, c-format -msgid "unrecognised: %-7lx" -msgstr "" - -#: readelf.c:912 -#, c-format -msgid "<string table index %3ld>" -msgstr "" - -#: readelf.c:1119 -#, c-format -msgid "Processor Specific: %lx" -msgstr "" - -#: readelf.c:1138 -#, c-format -msgid "Operating System specific: %lx" -msgstr "" - -#: readelf.c:1141 readelf.c:1506 -#, c-format -msgid "<unknown>: %lx" -msgstr "" - -#: readelf.c:1155 -msgid "NONE (None)" -msgstr "" - -#: readelf.c:1156 -msgid "REL (Relocatable file)" -msgstr "" - -#: readelf.c:1157 -msgid "EXEC (Executable file)" -msgstr "" - -#: readelf.c:1158 -msgid "DYN (Shared object file)" -msgstr "" - -#: readelf.c:1159 -msgid "CORE (Core file)" -msgstr "" - -#: readelf.c:1163 -#, c-format -msgid "Processor Specific: (%x)" -msgstr "" - -#: readelf.c:1165 -#, c-format -msgid "OS Specific: (%x)" -msgstr "" - -#: readelf.c:1167 readelf.c:1244 readelf.c:1638 -#, c-format -msgid "<unknown>: %x" -msgstr "" - -#: readelf.c:1180 -msgid "None" -msgstr "" - -#: readelf.c:1676 -msgid "Usage: readelf {options} elf-file(s)\n" -msgstr "" - -#: readelf.c:1677 -msgid " Options are:\n" -msgstr "" - -#: readelf.c:1678 -msgid " -a or --all Equivalent to: -h -l -S -s -r -d -V -A -I\n" -msgstr "" - -#: readelf.c:1679 -msgid " -h or --file-header Display the ELF file header\n" -msgstr "" - -#: readelf.c:1680 -msgid " -l or --program-headers or --segments\n" -msgstr "" - -#: readelf.c:1681 -msgid " Display the program headers\n" -msgstr "" - -#: readelf.c:1682 -msgid " -S or --section-headers or --sections\n" -msgstr "" - -#: readelf.c:1683 -msgid " Display the sections' header\n" -msgstr "" - -#: readelf.c:1684 -msgid " -e or --headers Equivalent to: -h -l -S\n" -msgstr "" - -#: readelf.c:1685 -msgid " -s or --syms or --symbols Display the symbol table\n" -msgstr "" - -#: readelf.c:1686 -msgid " -n or --notes Display the core notes (if present)\n" -msgstr "" - -#: readelf.c:1687 -msgid " -r or --relocs Display the relocations (if present)\n" -msgstr "" - -#: readelf.c:1688 -msgid " -d or --dynamic Display the dynamic segment (if present)\n" -msgstr "" - -#: readelf.c:1689 -msgid " -V or --version-info Display the version sections (if present)\n" -msgstr "" - -#: readelf.c:1690 -msgid "" -" -A or --arch-specific Display architecture specific information (if " -"any).\n" -msgstr "" - -#: readelf.c:1691 -msgid "" -" -D or --use-dynamic Use the dynamic section info when displaying " -"symbols\n" -msgstr "" - -#: readelf.c:1692 -msgid " -x <number> or --hex-dump=<number>\n" -msgstr "" - -#: readelf.c:1693 -msgid " Dump the contents of section <number>\n" -msgstr "" - -#: readelf.c:1694 -msgid " -w[liapr] or --debug-dump[=line,=info,=abbrev,=pubnames,=ranges]\n" -msgstr "" - -#: readelf.c:1695 -msgid "" -" Display the contents of DWARF2 debug sections\n" -msgstr "" - -#: readelf.c:1697 -msgid " -i <number> or --instruction-dump=<number>\n" -msgstr "" - -#: readelf.c:1698 -msgid "" -" Disassemble the contents of section <number>\n" -msgstr "" - -#: readelf.c:1700 -msgid " -I or --histogram Display histogram of bucket list lengths\n" -msgstr "" - -#: readelf.c:1701 -msgid " -v or --version Display the version number of readelf\n" -msgstr "" - -#: readelf.c:1702 -msgid " -H or --help Display this information\n" -msgstr "" - -#: readelf.c:1720 -msgid "Out of memory allocating dump request table." -msgstr "" - -#: readelf.c:1855 -#, c-format -msgid "Unrecognised debug option '%s'\n" -msgstr "" - -#: readelf.c:1880 -#, c-format -msgid "Invalid option '-%c'\n" -msgstr "" - -#: readelf.c:1893 -msgid "Nothing to do.\n" -msgstr "" - -#: readelf.c:1906 readelf.c:1923 readelf.c:3493 -msgid "none" -msgstr "" - -#: readelf.c:1907 -msgid "ELF32" -msgstr "" - -#: readelf.c:1908 -msgid "ELF64" -msgstr "" - -#: readelf.c:1910 readelf.c:1927 readelf.c:1946 -#, c-format -msgid "<unknown: %x>" -msgstr "" - -#: readelf.c:1924 -msgid "2's complement, little endian" -msgstr "" - -#: readelf.c:1925 -msgid "2's complement, big endian" -msgstr "" - -#: readelf.c:1940 -msgid "UNIX - System V" -msgstr "" - -#: readelf.c:1941 -msgid "UNIX - HP-UX" -msgstr "" - -#: readelf.c:1942 -msgid "UNIX - Linux" -msgstr "" - -#: readelf.c:1943 -msgid "Standalone App" -msgstr "" - -#: readelf.c:1944 -msgid "ARM" -msgstr "" - -#: readelf.c:1961 -msgid "Not an ELF file - it has the wrong magic bytes at the start\n" -msgstr "" - -#: readelf.c:1969 -msgid "ELF Header:\n" -msgstr "" - -#: readelf.c:1970 -msgid " Magic: " -msgstr "" - -#: readelf.c:1974 -#, c-format -msgid " Class: %s\n" -msgstr "" - -#: readelf.c:1976 -#, c-format -msgid " Data: %s\n" -msgstr "" - -#: readelf.c:1978 -#, c-format -msgid " Version: %d %s\n" -msgstr "" - -#: readelf.c:1985 -#, c-format -msgid " OS/ABI: %s\n" -msgstr "" - -#: readelf.c:1987 -#, c-format -msgid " ABI Version: %d\n" -msgstr "" - -#: readelf.c:1989 -#, c-format -msgid " Type: %s\n" -msgstr "" - -#: readelf.c:1991 -#, c-format -msgid " Machine: %s\n" -msgstr "" - -#: readelf.c:1993 -#, c-format -msgid " Version: 0x%lx\n" -msgstr "" - -#: readelf.c:1996 -msgid " Entry point address: " -msgstr "" - -#: readelf.c:1998 -msgid "" -"\n" -" Start of program headers: " -msgstr "" - -#: readelf.c:2000 -msgid "" -" (bytes into file)\n" -" Start of section headers: " -msgstr "" - -#: readelf.c:2002 -msgid " (bytes into file)\n" -msgstr "" - -#: readelf.c:2004 -#, c-format -msgid " Flags: 0x%lx%s\n" -msgstr "" - -#: readelf.c:2007 -#, c-format -msgid " Size of this header: %ld (bytes)\n" -msgstr "" - -#: readelf.c:2009 -#, c-format -msgid " Size of program headers: %ld (bytes)\n" -msgstr "" - -#: readelf.c:2011 -#, c-format -msgid " Number of program headers: %ld\n" -msgstr "" - -#: readelf.c:2013 -#, c-format -msgid " Size of section headers: %ld (bytes)\n" -msgstr "" - -#: readelf.c:2015 -#, c-format -msgid " Number of section headers: %ld\n" -msgstr "" - -#: readelf.c:2017 -#, c-format -msgid " Section header string table index: %ld\n" -msgstr "" - -#: readelf.c:2102 -msgid "" -"\n" -"There are no program headers in this file.\n" -msgstr "" - -#: readelf.c:2108 -#, c-format -msgid "" -"\n" -"Elf file type is %s\n" -msgstr "" - -#: readelf.c:2109 -msgid "Entry point " -msgstr "" - -#: readelf.c:2111 -#, c-format -msgid "" -"\n" -"There are %d program headers, starting at offset " -msgstr "" - -#: readelf.c:2122 readelf.c:2298 readelf.c:2340 readelf.c:2383 readelf.c:2424 -#: readelf.c:2932 readelf.c:2973 readelf.c:3149 readelf.c:4111 readelf.c:4125 -#: readelf.c:7023 readelf.c:7063 -msgid "Out of memory\n" -msgstr "" - -#: readelf.c:2140 -#, c-format -msgid "" -"\n" -"Program Header%s:\n" -msgstr "" - -#: readelf.c:2144 -msgid "" -" Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align\n" -msgstr "" - -#: readelf.c:2148 -msgid " Type Offset VirtAddr PhysAddr\n" -msgstr "" - -#: readelf.c:2150 -msgid " FileSiz MemSiz Flags Align\n" -msgstr "" - -#: readelf.c:2208 -msgid "more than one dynamic segment\n" -msgstr "" - -#: readelf.c:2216 -msgid "Unable to find program interpreter name\n" -msgstr "" - -#: readelf.c:2223 -#, c-format -msgid "" -"\n" -" [Requesting program interpreter: %s]" -msgstr "" - -#: readelf.c:2241 -msgid "" -"\n" -" Section to Segment mapping:\n" -msgstr "" - -#: readelf.c:2242 -msgid " Segment Sections...\n" -msgstr "" - -#: readelf.c:2505 -msgid "" -"\n" -"There are no sections in this file.\n" -msgstr "" - -#: readelf.c:2511 -#, c-format -msgid "There are %d section headers, starting at offset 0x%lx:\n" -msgstr "" - -#: readelf.c:2551 -msgid "File contains multiple dynamic symbol tables\n" -msgstr "" - -#: readelf.c:2564 -msgid "File contains multiple dynamic string tables\n" -msgstr "" - -#: readelf.c:2591 -#, c-format -msgid "" -"\n" -"Section Header%s:\n" -msgstr "" - -#: readelf.c:2595 -msgid "" -" [Nr] Name Type Addr Off Size ES Flg Lk " -"Inf Al\n" -msgstr "" - -#: readelf.c:2598 -msgid " [Nr] Name Type Address Offset\n" -msgstr "" - -#: readelf.c:2599 -msgid " Size EntSize Flags Link Info Align\n" -msgstr "" - -#: readelf.c:2646 -msgid "" -"Key to Flags: W (write), A (alloc), X (execute), M (merge), S (strings)\n" -msgstr "" - -#: readelf.c:2647 -msgid "" -" I (info), L (link order), O (extra OS processing required)\n" -msgstr "" - -#: readelf.c:2648 -msgid " o (os specific), p (processor specific) x (unknown)\n" -msgstr "" - -#: readelf.c:2706 -#, c-format -msgid "" -"\n" -"Relocation section at offset 0x%lx contains %ld bytes:\n" -msgstr "" - -#: readelf.c:2713 -msgid "" -"\n" -"There are no dynamic relocations in this file.\n" -msgstr "" - -#: readelf.c:2741 -msgid "" -"\n" -"Relocation section " -msgstr "" - -#: readelf.c:2748 -#, c-format -msgid " at offset 0x%lx contains %lu entries:\n" -msgstr "" - -#: readelf.c:2776 -msgid "" -"\n" -"There are no relocations in this file.\n" -msgstr "" - -#: readelf.c:3026 -msgid "" -"\n" -"There is no dynamic segment in this file.\n" -msgstr "" - -#: readelf.c:3060 -msgid "Unable to seek to end of file!" -msgstr "" - -#: readelf.c:3069 -msgid "Unable to determine the number of symbols to load\n" -msgstr "" - -#: readelf.c:3099 -msgid "Unable to seek to end of file\n" -msgstr "" - -#: readelf.c:3105 -msgid "Unable to determine the length of the dynamic string table\n" -msgstr "" - -#: readelf.c:3166 -#, c-format -msgid "" -"\n" -"Dynamic segment at offset 0x%x contains %ld entries:\n" -msgstr "" - -#: readelf.c:3169 -msgid " Tag Type Name/Value\n" -msgstr "" - -#: readelf.c:3200 -msgid "Auxiliary library" -msgstr "" - -#: readelf.c:3202 -msgid "Filter library" -msgstr "" - -#: readelf.c:3218 readelf.c:3239 readelf.c:3265 -msgid "Flags:" -msgstr "" - -#: readelf.c:3220 readelf.c:3241 readelf.c:3267 -msgid " None\n" -msgstr "" - -#: readelf.c:3370 -#, c-format -msgid "Shared library: [%s]" -msgstr "" - -#: readelf.c:3373 -msgid " program interpreter" -msgstr "" - -#: readelf.c:3377 -#, c-format -msgid "Library soname: [%s]" -msgstr "" - -#: readelf.c:3381 -#, c-format -msgid "Library rpath: [%s]" -msgstr "" - -#: readelf.c:3442 -#, c-format -msgid "Not needed object: [%s]\n" -msgstr "" - -#: readelf.c:3539 -#, c-format -msgid "" -"\n" -"Version definition section '%s' contains %ld entries:\n" -msgstr "" - -#: readelf.c:3542 -msgid " Addr: 0x" -msgstr "" - -#: readelf.c:3544 readelf.c:3732 -#, c-format -msgid " Offset: %#08lx Link: %lx (%s)\n" -msgstr "" - -#: readelf.c:3574 -#, c-format -msgid " %#06x: Rev: %d Flags: %s" -msgstr "" - -#: readelf.c:3577 -#, c-format -msgid " Index: %d Cnt: %d " -msgstr "" - -#: readelf.c:3588 -#, c-format -msgid "Name: %s\n" -msgstr "" - -#: readelf.c:3590 -#, c-format -msgid "Name index: %ld\n" -msgstr "" - -#: readelf.c:3605 -#, c-format -msgid " %#06x: Parent %d: %s\n" -msgstr "" - -#: readelf.c:3608 -#, c-format -msgid " %#06x: Parent %d, name index: %ld\n" -msgstr "" - -#: readelf.c:3627 -#, c-format -msgid "" -"\n" -"Version needs section '%s' contains %ld entries:\n" -msgstr "" - -#: readelf.c:3630 -msgid " Addr: 0x" -msgstr "" - -#: readelf.c:3632 -#, c-format -msgid " Offset: %#08lx Link to section: %ld (%s)\n" -msgstr "" - -#: readelf.c:3658 -#, c-format -msgid " %#06x: Version: %d" -msgstr "" - -#: readelf.c:3661 -#, c-format -msgid " File: %s" -msgstr "" - -#: readelf.c:3663 -#, c-format -msgid " File: %lx" -msgstr "" - -#: readelf.c:3665 -#, c-format -msgid " Cnt: %d\n" -msgstr "" - -#: readelf.c:3683 -#, c-format -msgid " %#06x: Name: %s" -msgstr "" - -#: readelf.c:3686 -#, c-format -msgid " %#06x: Name index: %lx" -msgstr "" - -#: readelf.c:3689 -#, c-format -msgid " Flags: %s Version: %d\n" -msgstr "" - -#: readelf.c:3727 -#, c-format -msgid "" -"\n" -"Version symbols section '%s' contains %d entries:\n" -msgstr "" - -#: readelf.c:3730 -msgid " Addr: " -msgstr "" - -#: readelf.c:3760 -msgid " 0 (*local*) " -msgstr "" - -#: readelf.c:3764 -msgid " 1 (*global*) " -msgstr "" - -#: readelf.c:3986 -msgid "" -"\n" -"No version information found in this file.\n" -msgstr "" - -#: readelf.c:4004 readelf.c:4039 -#, c-format -msgid "<processor specific>: %d" -msgstr "" - -#: readelf.c:4006 readelf.c:4051 -#, c-format -msgid "<OS specific>: %d" -msgstr "" - -#: readelf.c:4008 readelf.c:4054 -#, c-format -msgid "<unknown>: %d" -msgstr "" - -#: readelf.c:4117 -msgid "Unable to read in dynamic data\n" -msgstr "" - -#: readelf.c:4159 -msgid "Unable to seek to start of dynamic information" -msgstr "" - -#: readelf.c:4165 -msgid "Failed to read in number of buckets\n" -msgstr "" - -#: readelf.c:4171 -msgid "Failed to read in number of chains\n" -msgstr "" - -#: readelf.c:4191 -msgid "" -"\n" -"Symbol table for image:\n" -msgstr "" - -#: readelf.c:4193 -msgid " Num Buc: Value Size Type Bind Vis Ndx Name\n" -msgstr "" - -#: readelf.c:4195 -msgid " Num Buc: Value Size Type Bind Vis Ndx Name\n" -msgstr "" - -#: readelf.c:4239 -#, c-format -msgid "" -"\n" -"Symbol table '%s' contains %lu entries:\n" -msgstr "" - -#: readelf.c:4243 -msgid " Num: Value Size Type Bind Vis Ndx Name\n" -msgstr "" - -#: readelf.c:4245 -msgid " Num: Value Size Type Bind Vis Ndx Name\n" -msgstr "" - -#: readelf.c:4354 -msgid "bad dynamic symbol" -msgstr "" - -#: readelf.c:4413 -msgid "" -"\n" -"Dynamic symbol information is not available for displaying symbols.\n" -msgstr "" - -#: readelf.c:4425 -#, c-format -msgid "" -"\n" -"Histogram for bucket list length (total of %d buckets):\n" -msgstr "" - -#: readelf.c:4427 -msgid " Length Number %% of total Coverage\n" -msgstr "" - -#: readelf.c:4432 readelf.c:4451 readelf.c:6704 readelf.c:6897 -msgid "Out of memory" -msgstr "" - -#: readelf.c:4500 -#, c-format -msgid "" -"\n" -"Dynamic info segment at offset 0x%lx contains %d entries:\n" -msgstr "" - -#: readelf.c:4503 -msgid " Num: Name BoundTo Flags\n" -msgstr "" - -#: readelf.c:4551 -#, c-format -msgid "" -"\n" -"Assembly dump of section %s\n" -msgstr "" - -#: readelf.c:4574 -#, c-format -msgid "" -"\n" -"Section '%s' has no data to dump.\n" -msgstr "" - -#: readelf.c:4579 -#, c-format -msgid "" -"\n" -"Hex dump of section '%s':\n" -msgstr "" - -#: readelf.c:4731 -msgid "badly formed extended line op encountered!" -msgstr "" - -#: readelf.c:4738 -#, c-format -msgid " Extended opcode %d: " -msgstr "" - -#: readelf.c:4743 -msgid "" -"End of Sequence\n" -"\n" -msgstr "" - -#: readelf.c:4749 -#, c-format -msgid "set Address to 0x%lx\n" -msgstr "" - -#: readelf.c:4754 -msgid " define new File Table entry\n" -msgstr "" - -#: readelf.c:4755 readelf.c:4877 -msgid " Entry\tDir\tTime\tSize\tName\n" -msgstr "" - -#: readelf.c:4757 -#, c-format -msgid " %d\t" -msgstr "" - -#: readelf.c:4760 readelf.c:4762 readelf.c:4764 readelf.c:4889 readelf.c:4891 -#: readelf.c:4893 -#, c-format -msgid "%lu\t" -msgstr "" - -#: readelf.c:4765 -#, c-format -msgid "" -"%s\n" -"\n" -msgstr "" - -#: readelf.c:4769 -#, c-format -msgid "UNKNOWN: length %d\n" -msgstr "" - -#: readelf.c:4795 -#, c-format -msgid "" -"\n" -"Dump of debug contents of section %s:\n" -"\n" -msgstr "" - -#: readelf.c:4807 -msgid "The line info appears to be corrupt - the section is too small\n" -msgstr "" - -#: readelf.c:4815 -msgid "Only DWARF version 2 line info is currently supported.\n" -msgstr "" - -#: readelf.c:4830 -#, c-format -msgid " Length: %ld\n" -msgstr "" - -#: readelf.c:4831 -#, c-format -msgid " DWARF Version: %d\n" -msgstr "" - -#: readelf.c:4832 -#, c-format -msgid " Prolgue Length: %d\n" -msgstr "" - -#: readelf.c:4833 -#, c-format -msgid " Minimum Instruction Length: %d\n" -msgstr "" - -#: readelf.c:4834 -#, c-format -msgid " Initial value of 'is_stmt': %d\n" -msgstr "" - -#: readelf.c:4835 -#, c-format -msgid " Line Base: %d\n" -msgstr "" - -#: readelf.c:4836 -#, c-format -msgid " Line Range: %d\n" -msgstr "" - -#: readelf.c:4837 -#, c-format -msgid " Opcode Base: %d\n" -msgstr "" - -#: readelf.c:4846 -msgid "" -"\n" -" Opcodes:\n" -msgstr "" - -#: readelf.c:4849 -#, c-format -msgid " Opcode %d has %d args\n" -msgstr "" - -#: readelf.c:4855 -msgid "" -"\n" -" The Directory Table is empty.\n" -msgstr "" - -#: readelf.c:4858 -msgid "" -"\n" -" The Directory Table:\n" -msgstr "" - -#: readelf.c:4862 -#, c-format -msgid " %s\n" -msgstr "" - -#: readelf.c:4873 -msgid "" -"\n" -" The File Name Table is empty.\n" -msgstr "" - -#: readelf.c:4876 -msgid "" -"\n" -" The File Name Table:\n" -msgstr "" - -#: readelf.c:4884 -#, c-format -msgid " %d\t" -msgstr "" - -#: readelf.c:4895 -#, c-format -msgid "%s\n" -msgstr "" - -#. Now display the statements. -#: readelf.c:4903 -msgid "" -"\n" -" Line Number Statements:\n" -msgstr "" - -#: readelf.c:4922 -msgid " Copy\n" -msgstr "" - -#: readelf.c:4929 -#, c-format -msgid " Advance PC by %d to %lx\n" -msgstr "" - -#: readelf.c:4937 -#, c-format -msgid " Advance Line by %d to %d\n" -msgstr "" - -#: readelf.c:4944 -#, c-format -msgid " Set File Name to entry %d in the File Name Table\n" -msgstr "" - -#: readelf.c:4952 -#, c-format -msgid " Set column to %d\n" -msgstr "" - -#: readelf.c:4959 -#, c-format -msgid " Set is_stmt to %d\n" -msgstr "" - -#: readelf.c:4964 -msgid " Set basic block\n" -msgstr "" - -#: readelf.c:4972 -#, c-format -msgid " Advance PC by constant %d to 0x%lx\n" -msgstr "" - -#: readelf.c:4980 -#, c-format -msgid " Advance PC by fixed size amount %d to 0x%lx\n" -msgstr "" - -#: readelf.c:4988 -#, c-format -msgid " Special opcode %d: advance Address by %d to 0x%lx" -msgstr "" - -#: readelf.c:4992 -#, c-format -msgid " and Line by %d to %d\n" -msgstr "" - -#: readelf.c:5015 readelf.c:5437 -#, c-format -msgid "" -"Contents of the %s section:\n" -"\n" -msgstr "" - -#: readelf.c:5034 -msgid "Only DWARF 2 pubnames are currently supported" -msgstr "" - -#: readelf.c:5038 -#, c-format -msgid " Length: %ld\n" -msgstr "" - -#: readelf.c:5040 -#, c-format -msgid " Version: %d\n" -msgstr "" - -#: readelf.c:5042 -#, c-format -msgid " Offset into .debug_info section: %ld\n" -msgstr "" - -#: readelf.c:5044 -#, c-format -msgid " Size of area in .debug_info section: %ld\n" -msgstr "" - -#: readelf.c:5047 -msgid "" -"\n" -" Offset\tName\n" -msgstr "" - -#: readelf.c:5129 -#, c-format -msgid "Unknown TAG value: %lx" -msgstr "" - -#: readelf.c:5224 -#, c-format -msgid "Unknown AT value: %lx" -msgstr "" - -#: readelf.c:5261 -#, c-format -msgid "Unknown FORM value: %lx" -msgstr "" - -#: readelf.c:5443 -msgid " Number TAG\n" -msgstr "" - -#: readelf.c:5449 -#, c-format -msgid " %ld %s [%s]\n" -msgstr "" - -#: readelf.c:5452 -msgid "has children" -msgstr "" - -#: readelf.c:5452 -msgid "no children" -msgstr "" - -#: readelf.c:5456 -#, c-format -msgid " %-18s %s\n" -msgstr "" - -#: readelf.c:5475 -#, c-format -msgid " %lu byte block: " -msgstr "" - -#: readelf.c:5939 -msgid "(User defined location op)" -msgstr "" - -#: readelf.c:5941 -msgid "(Unknown location op)" -msgstr "" - -#: readelf.c:6058 -#, c-format -msgid "Unable to handle FORM: %d" -msgstr "" - -#: readelf.c:6062 -#, c-format -msgid "Unrecognised form: %d" -msgstr "" - -#: readelf.c:6075 -msgid "(not inlined)" -msgstr "" - -#: readelf.c:6076 -msgid "(inlined)" -msgstr "" - -#: readelf.c:6077 -msgid "(declared as inline but ignored)" -msgstr "" - -#: readelf.c:6078 -msgid "(declared as inline and inlined)" -msgstr "" - -#: readelf.c:6079 -#, c-format -msgid " (Unknown inline attribute value: %lx)" -msgstr "" - -#: readelf.c:6209 readelf.c:6333 -#, c-format -msgid "" -"The section %s contains:\n" -"\n" -msgstr "" - -#: readelf.c:6231 -msgid "Only version 2 DWARF debug information is currently supported.\n" -msgstr "" - -#: readelf.c:6235 -msgid " Compilation Unit:\n" -msgstr "" - -#: readelf.c:6236 -#, c-format -msgid " Length: %ld\n" -msgstr "" - -#: readelf.c:6237 -#, c-format -msgid " Version: %d\n" -msgstr "" - -#: readelf.c:6238 -#, c-format -msgid " Abbrev Offset: %ld\n" -msgstr "" - -#: readelf.c:6239 -#, c-format -msgid " Pointer Size: %d\n" -msgstr "" - -#: readelf.c:6259 -msgid "Unable to locate .debug_abbrev section!\n" -msgstr "" - -#: readelf.c:6299 -#, c-format -msgid "Unable to locate entry %lu in the abbreviation table\n" -msgstr "" - -#: readelf.c:6304 -#, c-format -msgid " <%d><%x>: Abbrev Number: %lu (%s)\n" -msgstr "" - -#: readelf.c:6352 -#, c-format -msgid " Length: %ld\n" -msgstr "" - -#: readelf.c:6353 -#, c-format -msgid " Version: %d\n" -msgstr "" - -#: readelf.c:6354 -#, c-format -msgid " Offset into .debug_info: %lx\n" -msgstr "" - -#: readelf.c:6355 -#, c-format -msgid " Pointer Size: %d\n" -msgstr "" - -#: readelf.c:6356 -#, c-format -msgid " Segment Size: %d\n" -msgstr "" - -#: readelf.c:6358 -msgid "" -"\n" -" Address Length\n" -msgstr "" - -#: readelf.c:6399 -#, c-format -msgid "Displaying the debug contents of section %s is not yet supported.\n" -msgstr "" - -#: readelf.c:6461 -#, c-format -msgid "" -"\n" -"Section '%s' has no debugging data.\n" -msgstr "" - -#: readelf.c:6477 -#, c-format -msgid "Unrecognised debug section: %s\n" -msgstr "" - -#: readelf.c:6549 -msgid "Some sections were not dumped because they do not exist!\n" -msgstr "" - -#: readelf.c:6728 -#, c-format -msgid "" -"\n" -"Section '%s' contains %d entries:\n" -msgstr "" - -#: readelf.c:6890 -msgid "conflict list with without table" -msgstr "" - -#: readelf.c:6918 -#, c-format -msgid "" -"\n" -"Section '.conflict' contains %d entries:\n" -msgstr "" - -#: readelf.c:6919 -msgid " Num: Index Value Name" -msgstr "" - -#: readelf.c:6944 -msgid "NT_PRSTATUS (prstatus structure)" -msgstr "" - -#: readelf.c:6945 -msgid "NT_FPREGSET (floating point registers)" -msgstr "" - -#: readelf.c:6946 -msgid "NT_PRPSINFO (prpsinfo structure)" -msgstr "" - -#: readelf.c:6947 -msgid "NT_TASKSTRUCT (task structure)" -msgstr "" - -#: readelf.c:6948 -msgid "NT_PRXFPREG (user_xfpregs structure)" -msgstr "" - -#: readelf.c:6949 -msgid "NT_PSTATUS (pstatus structure)" -msgstr "" - -#: readelf.c:6950 -msgid "NT_FPREGS (floating point registers)" -msgstr "" - -#: readelf.c:6951 -msgid "NT_PSINFO (psinfo structure)" -msgstr "" - -#: readelf.c:6952 -msgid "NT_LWPSTATUS (lwpstatus_t structure)" -msgstr "" - -#: readelf.c:6953 -msgid "NT_LWPSINFO (lwpsinfo_t structure)" -msgstr "" - -#: readelf.c:6954 -msgid "NT_WIN32PSTATUS (win32_pstatus strcuture)" -msgstr "" - -#: readelf.c:6956 -#, c-format -msgid "Unknown note type: (0x%08x)" -msgstr "" - -#: readelf.c:6994 -#, c-format -msgid "" -"\n" -"Notes at offset 0x%08lx with length 0x%08lx:\n" -msgstr "" - -#: readelf.c:6997 -msgid " Owner\t\tData size\tDescription\n" -msgstr "" - -#: readelf.c:7108 -msgid "No note segments present in the core file.\n" -msgstr "" - -#: readelf.c:7186 -msgid "This instance of readelf has been built without support for a\n" -msgstr "" - -#: readelf.c:7187 -msgid "64 bit data type and so it cannot read 64 bit ELF files.\n" -msgstr "" - -#: readelf.c:7222 -#, c-format -msgid "Cannot stat input file %s.\n" -msgstr "" - -#: readelf.c:7229 -#, c-format -msgid "Input file %s not found.\n" -msgstr "" - -#: readelf.c:7235 -#, c-format -msgid "%s: Failed to read file header\n" -msgstr "" - -#: readelf.c:7249 -#, c-format -msgid "" -"\n" -"File: %s\n" -msgstr "" - -#: rename.c:131 -#, c-format -msgid "%s: cannot set time: %s" -msgstr "" - -#. We have to clean up here. -#: rename.c:170 rename.c:203 -#, c-format -msgid "%s: rename: %s" -msgstr "" - -#: rename.c:211 -#, c-format -msgid "%s: simple_copy: %s" -msgstr "" - -#: resbin.c:130 -#, c-format -msgid "%s: not enough binary data" -msgstr "" - -#: resbin.c:149 -msgid "null terminated unicode string" -msgstr "" - -#: resbin.c:179 resbin.c:185 -msgid "resource ID" -msgstr "" - -#: resbin.c:229 -msgid "cursor" -msgstr "" - -#: resbin.c:263 resbin.c:270 -msgid "menu header" -msgstr "" - -#: resbin.c:280 -msgid "menuex header" -msgstr "" - -#: resbin.c:284 -msgid "menuex offset" -msgstr "" - -#: resbin.c:291 -#, c-format -msgid "unsupported menu version %d" -msgstr "" - -#: resbin.c:319 resbin.c:334 resbin.c:400 -msgid "menuitem header" -msgstr "" - -#: resbin.c:430 -msgid "menuitem" -msgstr "" - -#: resbin.c:471 resbin.c:499 -msgid "dialog header" -msgstr "" - -#: resbin.c:489 -#, c-format -msgid "unexpected dialog signature %d" -msgstr "" - -#: resbin.c:531 -msgid "dialog font point size" -msgstr "" - -#: resbin.c:539 -msgid "dialogex font information" -msgstr "" - -#: resbin.c:564 resbin.c:582 -msgid "dialog control" -msgstr "" - -#: resbin.c:574 -msgid "dialogex control" -msgstr "" - -#: resbin.c:603 -msgid "dialog control end" -msgstr "" - -#: resbin.c:615 -msgid "dialog control data" -msgstr "" - -#: resbin.c:658 -msgid "stringtable string length" -msgstr "" - -#: resbin.c:668 -msgid "stringtable string" -msgstr "" - -#: resbin.c:701 -msgid "fontdir header" -msgstr "" - -#: resbin.c:714 -msgid "fontdir" -msgstr "" - -#: resbin.c:730 -msgid "fontdir device name" -msgstr "" - -#: resbin.c:736 -msgid "fontdir face name" -msgstr "" - -#: resbin.c:779 -msgid "accelerator" -msgstr "" - -#: resbin.c:843 -msgid "group cursor header" -msgstr "" - -#: resbin.c:847 -#, c-format -msgid "unexpected group cursor type %d" -msgstr "" - -#: resbin.c:862 -msgid "group cursor" -msgstr "" - -#: resbin.c:901 -msgid "group icon header" -msgstr "" - -#: resbin.c:905 -#, c-format -msgid "unexpected group icon type %d" -msgstr "" - -#: resbin.c:920 -msgid "group icon" -msgstr "" - -#: resbin.c:991 resbin.c:1210 -msgid "unexpected version string" -msgstr "" - -#: resbin.c:1025 -#, c-format -msgid "version length %d does not match resource length %lu" -msgstr "" - -#: resbin.c:1029 -#, c-format -msgid "unexpected version type %d" -msgstr "" - -#: resbin.c:1041 -#, c-format -msgid "unexpected fixed version information length %d" -msgstr "" - -#: resbin.c:1044 -msgid "fixed version info" -msgstr "" - -#: resbin.c:1048 -#, c-format -msgid "unexpected fixed version signature %lu" -msgstr "" - -#: resbin.c:1052 -#, c-format -msgid "unexpected fixed version info version %lu" -msgstr "" - -#: resbin.c:1081 -msgid "version var info" -msgstr "" - -#: resbin.c:1098 -#, c-format -msgid "unexpected stringfileinfo value length %d" -msgstr "" - -#: resbin.c:1108 -#, c-format -msgid "unexpected version stringtable value length %d" -msgstr "" - -#: resbin.c:1142 -#, c-format -msgid "unexpected version string length %d != %d + %d" -msgstr "" - -#: resbin.c:1153 -#, c-format -msgid "unexpected version string length %d < %d" -msgstr "" - -#: resbin.c:1170 -#, c-format -msgid "unexpected varfileinfo value length %d" -msgstr "" - -#: resbin.c:1189 -msgid "version varfileinfo" -msgstr "" - -#: resbin.c:1204 -#, c-format -msgid "unexpected version value length %d" -msgstr "" - -#: rescoff.c:128 -msgid "filename required for COFF input" -msgstr "" - -#: rescoff.c:145 -#, c-format -msgid "%s: %s: no resource section\n" -msgstr "" - -#: rescoff.c:154 -msgid "can't read resource section" -msgstr "" - -#: rescoff.c:180 -#, c-format -msgid "%s: %s: address out of bounds" -msgstr "" - -#: rescoff.c:199 -msgid "directory" -msgstr "" - -#: rescoff.c:227 -msgid "named directory entry" -msgstr "" - -#: rescoff.c:236 -msgid "directory entry name" -msgstr "" - -#: rescoff.c:256 -msgid "named subdirectory" -msgstr "" - -#: rescoff.c:264 -msgid "named resource" -msgstr "" - -#: rescoff.c:279 -msgid "ID directory entry" -msgstr "" - -#: rescoff.c:296 -msgid "ID subdirectory" -msgstr "" - -#: rescoff.c:304 -msgid "ID resource" -msgstr "" - -#: rescoff.c:330 -msgid "resource type unknown" -msgstr "" - -#: rescoff.c:333 -msgid "data entry" -msgstr "" - -#: rescoff.c:341 -msgid "resource data" -msgstr "" - -#: rescoff.c:346 -msgid "resource data size" -msgstr "" - -#: rescoff.c:441 -msgid "filename required for COFF output" -msgstr "" - -#: rescoff.c:740 -msgid "can't get BFD_RELOC_RVA relocation type" -msgstr "" - -#: resrc.c:240 resrc.c:312 -#, c-format -msgid "can't open temporary file `%s': %s" -msgstr "" - -#: resrc.c:246 -#, c-format -msgid "can't redirect stdout: `%s': %s" -msgstr "" - -#: resrc.c:262 -#, c-format -msgid "%s %s: %s" -msgstr "" - -#: resrc.c:283 -#, c-format -msgid "%s exited with status %d" -msgstr "" - -#: resrc.c:308 -#, c-format -msgid "can't execute `%s': %s" -msgstr "" - -#: resrc.c:317 -#, c-format -msgid "Using temporary file `%s' to read preprocessor output\n" -msgstr "" - -#: resrc.c:324 -#, c-format -msgid "can't popen `%s': %s" -msgstr "" - -#: resrc.c:326 -msgid "Using popen to read preprocessor output\n" -msgstr "" - -#: resrc.c:369 -#, c-format -msgid "Tried `%s'\n" -msgstr "" - -#: resrc.c:380 -#, c-format -msgid "Using `%s'\n" -msgstr "" - -#: resrc.c:544 -#, c-format -msgid "%s:%d: %s\n" -msgstr "" - -#: resrc.c:553 -#, c-format -msgid "%s: unexpected EOF" -msgstr "" - -#: resrc.c:610 -#, c-format -msgid "%s: read of %lu returned %lu" -msgstr "" - -#: resrc.c:652 resrc.c:883 resrc.c:1156 resrc.c:1310 -#, c-format -msgid "stat failed on bitmap file `%s': %s" -msgstr "" - -#: resrc.c:705 -#, c-format -msgid "cursor file `%s' does not contain cursor data" -msgstr "" - -#: resrc.c:737 resrc.c:1027 -#, c-format -msgid "%s: fseek to %lu failed: %s" -msgstr "" - -#: resrc.c:996 -#, c-format -msgid "icon file `%s' does not contain icon data" -msgstr "" - -#: resrc.c:1515 -#, c-format -msgid "can't open `%s' for output: %s" -msgstr "" - -#: size.c:79 -#, c-format -msgid "" -"Usage: %s [-ABdoxV] [--format=berkeley|sysv] [--radix=8|10|16]\n" -" [--target=bfdname] [--version] [--help] [file...]\n" -msgstr "" - -#: size.c:83 -msgid "default is --format=berkeley\n" -msgstr "" - -#: size.c:85 -msgid "default is --format=sysv\n" -msgstr "" - -#: size.c:139 -#, c-format -msgid "invalid argument to --format: %s\n" -msgstr "" - -#: size.c:166 -#, c-format -msgid "Invalid radix: %s\n" -msgstr "" - -#: srconv.c:1879 -#, c-format -msgid "Usage: %s [-dhVq] in-file [out-file]\n" -msgstr "" - -#: srconv.c:1886 -#, c-format -msgid "%s: Convert a COFF object file into a SYSROFF object file\n" -msgstr "" - -#: srconv.c:2024 -#, c-format -msgid "%s: unable to open output file %s\n" -msgstr "" - -#: stabs.c:349 stabs.c:1769 -msgid "numeric overflow" -msgstr "" - -#: stabs.c:360 -#, c-format -msgid "Bad stab: %s\n" -msgstr "" - -#: stabs.c:370 -#, c-format -msgid "Warning: %s: %s\n" -msgstr "" - -#: stabs.c:492 -msgid "N_LBRAC not within function\n" -msgstr "" - -#: stabs.c:531 -msgid "Too many N_RBRACs\n" -msgstr "" - -#: stabs.c:780 -msgid "unknown C++ encoded name" -msgstr "" - -#. Complain and keep going, so compilers can invent new -#. cross-reference types. -#: stabs.c:1306 -msgid "unrecognized cross reference type" -msgstr "" - -#. Does this actually ever happen? Is that why we are worrying -#. about dealing with it rather than just calling error_type? -#: stabs.c:1861 -msgid "missing index type" -msgstr "" - -#: stabs.c:2188 -msgid "unknown virtual character for baseclass" -msgstr "" - -#: stabs.c:2206 -msgid "unknown visibility character for baseclass" -msgstr "" - -#: stabs.c:2398 -msgid "unnamed $vb type" -msgstr "" - -#: stabs.c:2404 -msgid "unrecognized C++ abbreviation" -msgstr "" - -#: stabs.c:2484 -msgid "unknown visibility character for field" -msgstr "" - -#: stabs.c:2740 -msgid "const/volatile indicator missing" -msgstr "" - -#: stabs.c:2980 -#, c-format -msgid "No mangling for \"%s\"\n" -msgstr "" - -#: stabs.c:3293 -msgid "Undefined N_EXCL" -msgstr "" - -#: stabs.c:3381 -#, c-format -msgid "Type file number %d out of range\n" -msgstr "" - -#: stabs.c:3386 -#, c-format -msgid "Type index number %d out of range\n" -msgstr "" - -#: stabs.c:3473 -#, c-format -msgid "Unrecognized XCOFF type %d\n" -msgstr "" - -#: stabs.c:3772 -#, c-format -msgid "bad mangled name `%s'\n" -msgstr "" - -#: stabs.c:3868 -msgid "no argument types in mangled string\n" -msgstr "" - -#: strings.c:159 -#, c-format -msgid "%s: invalid number %s\n" -msgstr "" - -#: strings.c:494 -#, c-format -msgid "%s: invalid integer argument %s\n" -msgstr "" - -#: strings.c:505 -#, c-format -msgid "" -"Usage: %s [-afov] [-n min-len] [-min-len] [-t {o,x,d}] [-]\n" -" [--all] [--print-file-name] [--bytes=min-len] [--radix={o,x,d}]\n" -" [--target=bfdname] [--help] [--version] file...\n" -msgstr "" - -#: sysdump.c:712 -#, c-format -msgid "Usage: %s [-hV] in-file\n" -msgstr "" - -#: sysdump.c:783 -#, c-format -msgid "%s: cannot open input file %s\n" -msgstr "" - -#: version.c:39 -msgid "Copyright 1997, 1998, 1999 Free Software Foundation, Inc.\n" -msgstr "" - -#: version.c:40 -msgid "" -"This program is free software; you may redistribute it under the terms of\n" -"the GNU General Public License. This program has absolutely no warranty.\n" -msgstr "" - -#: windres.c:237 -#, c-format -msgid "can't open %s `%s': %s" -msgstr "" - -#: windres.c:416 -msgid ": expected to be a directory\n" -msgstr "" - -#: windres.c:428 -msgid ": expected to be a leaf\n" -msgstr "" - -#: windres.c:437 -#, c-format -msgid "%s: warning: " -msgstr "" - -#: windres.c:439 -msgid ": duplicate value\n" -msgstr "" - -#: windres.c:602 -#, c-format -msgid "%s: unknown format type `%s'\n" -msgstr "" - -#: windres.c:603 -#, c-format -msgid "%s: supported formats:" -msgstr "" - -#. Otherwise, we give up. -#: windres.c:690 -#, c-format -msgid "can not determine type of file `%s'; use the -I option" -msgstr "" - -#: windres.c:704 -#, c-format -msgid "Usage: %s [options] [input-file] [output-file]\n" -msgstr "" - -#: windres.c:706 -msgid "" -"Options:\n" -" -i FILE, --input FILE Name input file\n" -" -o FILE, --output FILE Name output file\n" -" -I FORMAT, --input-format FORMAT\n" -" Specify input format\n" -" -O FORMAT, --output-format FORMAT\n" -" Specify output format\n" -" -F TARGET, --target TARGET Specify COFF target\n" -" --preprocessor PROGRAM Program to use to preprocess rc file\n" -" --include-dir DIR Include directory when preprocessing rc file\n" -" -DSYM[=VAL], --define SYM[=VAL]\n" -" Define SYM when preprocessing rc file\n" -" -v Verbose - tells you what it's doing\n" -" --language VAL Set language when reading rc file\n" -" --use-temp-file Use a temporary file instead of popen to read\n" -" the preprocessor output\n" -" --no-use-temp-file Use popen (default)\n" -msgstr "" - -#: windres.c:725 -msgid " --yydebug Turn on parser debugging\n" -msgstr "" - -#: windres.c:728 -msgid "" -" --help Print this help message\n" -" --version Print version information\n" -msgstr "" - -#: windres.c:731 -msgid "" -"FORMAT is one of rc, res, or coff, and is deduced from the file name\n" -"extension if not specified. A single file name is an input file.\n" -"No input-file is stdin, default rc. No output-file is stdout, default rc.\n" -msgstr "" - -#: windres.c:980 -msgid "no resources" -msgstr "" - -#: wrstabs.c:366 wrstabs.c:2028 -#, c-format -msgid "string_hash_lookup failed: %s\n" -msgstr "" - -#: wrstabs.c:666 -#, c-format -msgid "stab_int_type: bad size %u\n" -msgstr "" - -#: wrstabs.c:1468 -#, c-format -msgid "%s: warning: unknown size for field `%s' in struct\n" -msgstr "" diff --git a/contrib/binutils/include/opcode/arc.h b/contrib/binutils/include/opcode/arc.h deleted file mode 100644 index a1e0ca152632..000000000000 --- a/contrib/binutils/include/opcode/arc.h +++ /dev/null @@ -1,274 +0,0 @@ -/* Opcode table for the ARC. - Copyright 1994, 1995, 1997 Free Software Foundation, Inc. - Contributed by Doug Evans (dje@cygnus.com). - -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. */ - -/* List of the various cpu types. - The tables currently use bit masks to say whether the instruction or - whatever is supported by a particular cpu. This lets us have one entry - apply to several cpus. - - This duplicates bfd_mach_arc_xxx. For now I wish to isolate this from bfd - and bfd from this. Also note that these numbers are bit values as we want - to allow for things available on more than one ARC (but not necessarily all - ARCs). */ - -/* The `base' cpu must be 0 (table entries are omitted for the base cpu). - The cpu type is treated independently of endianness. - The complete `mach' number includes endianness. - These values are internal to opcodes/bfd/binutils/gas. */ -#define ARC_MACH_BASE 0 -#define ARC_MACH_UNUSED1 1 -#define ARC_MACH_UNUSED2 2 -#define ARC_MACH_UNUSED4 4 -/* Additional cpu values can be inserted here and ARC_MACH_BIG moved down. */ -#define ARC_MACH_BIG 8 - -/* Mask of number of bits necessary to record cpu type. */ -#define ARC_MACH_CPU_MASK 7 -/* Mask of number of bits necessary to record cpu type + endianness. */ -#define ARC_MACH_MASK 15 - -/* Type to denote an ARC instruction (at least a 32 bit unsigned int). */ -typedef unsigned int arc_insn; - -struct arc_opcode { - char *syntax; /* syntax of insn */ - unsigned long mask, value; /* recognize insn if (op&mask)==value */ - int flags; /* various flag bits */ - -/* Values for `flags'. */ - -/* Return CPU number, given flag bits. */ -#define ARC_OPCODE_CPU(bits) ((bits) & ARC_MACH_CPU_MASK) -/* Return MACH number, given flag bits. */ -#define ARC_OPCODE_MACH(bits) ((bits) & ARC_MACH_MASK) -/* First opcode flag bit available after machine mask. */ -#define ARC_OPCODE_FLAG_START ((ARC_MACH_MASK + 1) << 0) -/* This insn is a conditional branch. */ -#define ARC_OPCODE_COND_BRANCH (ARC_OPCODE_FLAG_START) - - /* These values are used to optimize assembly and disassembly. Each insn is - on a list of related insns (same first letter for assembly, same insn code - for disassembly). */ - struct arc_opcode *next_asm; /* Next instruction to try during assembly. */ - struct arc_opcode *next_dis; /* Next instruction to try during disassembly. */ - - /* Macros to create the hash values for the lists. */ -#define ARC_HASH_OPCODE(string) \ - ((string)[0] >= 'a' && (string)[0] <= 'z' ? (string)[0] - 'a' : 26) -#define ARC_HASH_ICODE(insn) \ - ((unsigned int) (insn) >> 27) - - /* Macros to access `next_asm', `next_dis' so users needn't care about the - underlying mechanism. */ -#define ARC_OPCODE_NEXT_ASM(op) ((op)->next_asm) -#define ARC_OPCODE_NEXT_DIS(op) ((op)->next_dis) -}; - -struct arc_operand_value { - char *name; /* eg: "eq" */ - short value; /* eg: 1 */ - unsigned char type; /* index into `arc_operands' */ - unsigned char flags; /* various flag bits */ - -/* Values for `flags'. */ - -/* Return CPU number, given flag bits. */ -#define ARC_OPVAL_CPU(bits) ((bits) & ARC_MACH_CPU_MASK) -/* Return MACH number, given flag bits. */ -#define ARC_OPVAL_MACH(bits) ((bits) & ARC_MACH_MASK) -}; - -struct arc_operand { - /* One of the insn format chars. */ - unsigned char fmt; - - /* The number of bits in the operand (may be unused for a modifier). */ - unsigned char bits; - - /* How far the operand is left shifted in the instruction, or - the modifier's flag bit (may be unused for a modifier. */ - unsigned char shift; - - /* Various flag bits. */ - int flags; - -/* Values for `flags'. */ - -/* This operand is a suffix to the opcode. */ -#define ARC_OPERAND_SUFFIX 1 - -/* This operand is a relative branch displacement. The disassembler - prints these symbolically if possible. */ -#define ARC_OPERAND_RELATIVE_BRANCH 2 - -/* This operand is an absolute branch address. The disassembler - prints these symbolically if possible. */ -#define ARC_OPERAND_ABSOLUTE_BRANCH 4 - -/* This operand is an address. The disassembler - prints these symbolically if possible. */ -#define ARC_OPERAND_ADDRESS 8 - -/* This operand is a long immediate value. */ -#define ARC_OPERAND_LIMM 0x10 - -/* This operand takes signed values. */ -#define ARC_OPERAND_SIGNED 0x20 - -/* This operand takes signed values, but also accepts a full positive - range of values. That is, if bits is 16, it takes any value from - -0x8000 to 0xffff. */ -#define ARC_OPERAND_SIGNOPT 0x40 - -/* 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 ARC_OPERAND_NEGATIVE 0x80 - -/* This operand doesn't really exist. The program uses these operands - in special ways. */ -#define ARC_OPERAND_FAKE 0x100 - -/* Modifier values. */ -/* A dot is required before a suffix. Eg: .le */ -#define ARC_MOD_DOT 0x1000 - -/* A normal register is allowed (not used, but here for completeness). */ -#define ARC_MOD_REG 0x2000 - -/* An auxiliary register name is expected. */ -#define ARC_MOD_AUXREG 0x4000 - -/* Sum of all ARC_MOD_XXX bits. */ -#define ARC_MOD_BITS 0x7000 - -/* Non-zero if the operand type is really a modifier. */ -#define ARC_MOD_P(X) ((X) & ARC_MOD_BITS) - - /* 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 |= (p & ((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. - - REG is non-NULL when inserting a register value. */ - - arc_insn (*insert) PARAMS ((arc_insn insn, - const struct arc_operand *operand, int mods, - const struct arc_operand_value *reg, long value, - 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 & ARC_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. - - INSN is a pointer to an array of two `arc_insn's. The first element is - the insn, the second is the limm if present. - - Operands that have a printable form like registers and suffixes have - their struct arc_operand_value pointer stored in OPVAL. */ - - long (*extract) PARAMS ((arc_insn *insn, - const struct arc_operand *operand, - int mods, const struct arc_operand_value **opval, - int *invalid)); -}; - -/* Bits that say what version of cpu we have. - These should be passed to arc_init_opcode_tables. - At present, all there is is the cpu type. */ - -/* CPU number, given value passed to `arc_init_opcode_tables'. */ -#define ARC_HAVE_CPU(bits) ((bits) & ARC_MACH_CPU_MASK) -/* MACH number, given value passed to `arc_init_opcode_tables'. */ -#define ARC_HAVE_MACH(bits) ((bits) & ARC_MACH_MASK) - -/* Special register values: */ -#define ARC_REG_SHIMM_UPDATE 61 -#define ARC_REG_SHIMM 63 -#define ARC_REG_LIMM 62 - -/* Non-zero if REG is a constant marker. */ -#define ARC_REG_CONSTANT_P(REG) ((REG) >= 61) - -/* Positions and masks of various fields: */ -#define ARC_SHIFT_REGA 21 -#define ARC_SHIFT_REGB 15 -#define ARC_SHIFT_REGC 9 -#define ARC_MASK_REG 63 - -/* Delay slot types. */ -#define ARC_DELAY_NONE 0 /* no delay slot */ -#define ARC_DELAY_NORMAL 1 /* delay slot in both cases */ -#define ARC_DELAY_JUMP 2 /* delay slot only if branch taken */ - -/* Non-zero if X will fit in a signed 9 bit field. */ -#define ARC_SHIMM_CONST_P(x) ((long) (x) >= -256 && (long) (x) <= 255) - -extern const struct arc_operand arc_operands[]; -extern const int arc_operand_count; -extern /*const*/ struct arc_opcode arc_opcodes[]; -extern const int arc_opcodes_count; -extern const struct arc_operand_value arc_suffixes[]; -extern const int arc_suffixes_count; -extern const struct arc_operand_value arc_reg_names[]; -extern const int arc_reg_names_count; -extern unsigned char arc_operand_map[]; - -/* Utility fns in arc-opc.c. */ -int arc_get_opcode_mach PARAMS ((int, int)); -/* `arc_opcode_init_tables' must be called before `arc_xxx_supported'. */ -void arc_opcode_init_tables PARAMS ((int)); -void arc_opcode_init_insert PARAMS ((void)); -void arc_opcode_init_extract PARAMS ((void)); -const struct arc_opcode *arc_opcode_lookup_asm PARAMS ((const char *)); -const struct arc_opcode *arc_opcode_lookup_dis PARAMS ((unsigned int)); -int arc_opcode_limm_p PARAMS ((long *)); -const struct arc_operand_value *arc_opcode_lookup_suffix PARAMS ((const struct arc_operand *type, int value)); -int arc_opcode_supported PARAMS ((const struct arc_opcode *)); -int arc_opval_supported PARAMS ((const struct arc_operand_value *)); diff --git a/contrib/binutils/include/opcode/cgen.h b/contrib/binutils/include/opcode/cgen.h deleted file mode 100644 index 0cff7c826823..000000000000 --- a/contrib/binutils/include/opcode/cgen.h +++ /dev/null @@ -1,1399 +0,0 @@ -/* Header file for targets using CGEN: Cpu tools GENerator. - -Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc. - -This file is part of GDB, the GNU debugger, and the 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. */ - -#ifndef CGEN_H -#define CGEN_H - -/* ??? This file requires bfd.h but only to get bfd_vma. - Seems like an awful lot to require just to get such a fundamental type. - Perhaps the definition of bfd_vma can be moved outside of bfd.h. - Or perhaps one could duplicate its definition in another file. - Until such time, this file conditionally compiles definitions that require - bfd_vma using BFD_VERSION. */ - -/* Enums must be defined before they can be used. - Allow them to be used in struct definitions, even though the enum must - be defined elsewhere. - If CGEN_ARCH isn't defined, this file is being included by something other - than <arch>-desc.h. */ - -/* Prepend the arch name, defined in <arch>-desc.h, and _cgen_ to symbol S. - The lack of spaces in the arg list is important for non-stdc systems. - This file is included by <arch>-desc.h. - It can be included independently of <arch>-desc.h, in which case the arch - dependent portions will be declared as "unknown_cgen_foo". */ - -#ifndef CGEN_SYM -#define CGEN_SYM(s) CONCAT3 (unknown,_cgen_,s) -#endif - -/* This file contains the static (unchanging) pieces and as much other stuff - as we can reasonably put here. It's generally cleaner to put stuff here - rather than having it machine generated if possible. */ - -/* The assembler syntax is made up of expressions (duh...). - At the lowest level the values are mnemonics, register names, numbers, etc. - Above that are subexpressions, if any (an example might be the - "effective address" in m68k cpus). Subexpressions are wip. - At the second highest level are the insns themselves. Above that are - pseudo-insns, synthetic insns, and macros, if any. */ - -/* Lots of cpu's have a fixed insn size, or one which rarely changes, - and it's generally easier to handle these by treating the insn as an - integer type, rather than an array of characters. So we allow targets - to control this. When an integer type the value is in host byte order, - when an array of characters the value is in target byte order. */ - -typedef unsigned int CGEN_INSN_INT; -#if CGEN_INT_INSN_P -typedef CGEN_INSN_INT CGEN_INSN_BYTES; -typedef CGEN_INSN_INT *CGEN_INSN_BYTES_PTR; -#else -typedef unsigned char *CGEN_INSN_BYTES; -typedef unsigned char *CGEN_INSN_BYTES_PTR; -#endif - -#ifdef __GNUC__ -#define CGEN_INLINE __inline__ -#else -#define CGEN_INLINE -#endif - -enum cgen_endian -{ - CGEN_ENDIAN_UNKNOWN, - CGEN_ENDIAN_LITTLE, - CGEN_ENDIAN_BIG -}; - -/* Forward decl. */ - -typedef struct cgen_insn CGEN_INSN; - -/* Opaque pointer version for use by external world. */ - -typedef struct cgen_cpu_desc *CGEN_CPU_DESC; - -/* Attributes. - Attributes are used to describe various random things associated with - an object (ifield, hardware, operand, insn, whatever) and are specified - as name/value pairs. - Integer attributes computed at compile time are currently all that's - supported, though adding string attributes and run-time computation is - straightforward. Integer attribute values are always host int's - (signed or unsigned). For portability, this means 32 bits. - Integer attributes are further categorized as boolean, bitset, integer, - and enum types. Boolean attributes appear frequently enough that they're - recorded in one host int. This limits the maximum number of boolean - attributes to 32, though that's a *lot* of attributes. */ - -/* Type of attribute values. */ - -typedef int CGEN_ATTR_VALUE_TYPE; - -/* Struct to record attribute information. */ - -typedef struct -{ - /* Boolean attributes. */ - unsigned int bool; - /* Non-boolean integer attributes. */ - CGEN_ATTR_VALUE_TYPE nonbool[1]; -} CGEN_ATTR; - -/* Define a structure member for attributes with N non-boolean entries. - There is no maximum number of non-boolean attributes. - There is a maximum of 32 boolean attributes (since they are all recorded - in one host int). */ - -#define CGEN_ATTR_TYPE(n) \ -struct { unsigned int bool; \ - CGEN_ATTR_VALUE_TYPE nonbool[(n) ? (n) : 1]; } - -/* Return the boolean attributes. */ - -#define CGEN_ATTR_BOOLS(a) ((a)->bool) - -/* Non-boolean attribute numbers are offset by this much. */ - -#define CGEN_ATTR_NBOOL_OFFSET 32 - -/* Given a boolean attribute number, return its mask. */ - -#define CGEN_ATTR_MASK(attr) (1 << (attr)) - -/* Return the value of boolean attribute ATTR in ATTRS. */ - -#define CGEN_BOOL_ATTR(attrs, attr) ((CGEN_ATTR_MASK (attr) & (attrs)) != 0) - -/* Return value of attribute ATTR in ATTR_TABLE for OBJ. - OBJ is a pointer to the entity that has the attributes - (??? not used at present but is reserved for future purposes - eventually - the goal is to allow recording attributes in source form and computing - them lazily at runtime, not sure of the details yet). */ - -#define CGEN_ATTR_VALUE(obj, attr_table, attr) \ -((unsigned int) (attr) < CGEN_ATTR_NBOOL_OFFSET \ - ? ((CGEN_ATTR_BOOLS (attr_table) & CGEN_ATTR_MASK (attr)) != 0) \ - : ((attr_table)->nonbool[(attr) - CGEN_ATTR_NBOOL_OFFSET])) - -/* Attribute name/value tables. - These are used to assist parsing of descriptions at run-time. */ - -typedef struct -{ - const char * name; - CGEN_ATTR_VALUE_TYPE value; -} CGEN_ATTR_ENTRY; - -/* For each domain (ifld,hw,operand,insn), list of attributes. */ - -typedef struct -{ - const char * name; - const CGEN_ATTR_ENTRY * dfault; - const CGEN_ATTR_ENTRY * vals; -} CGEN_ATTR_TABLE; - -/* Instruction set variants. */ - -typedef struct { - const char *name; - - /* Default instruction size (in bits). - This is used by the assembler when it encounters an unknown insn. */ - unsigned int default_insn_bitsize; - - /* Base instruction size (in bits). - For non-LIW cpus this is generally the length of the smallest insn. - For LIW cpus its wip (work-in-progress). For the m32r its 32. */ - unsigned int base_insn_bitsize; - - /* Minimum/maximum instruction size (in bits). */ - unsigned int min_insn_bitsize; - unsigned int max_insn_bitsize; -} CGEN_ISA; - -/* Machine variants. */ - -typedef struct { - const char *name; - /* The argument to bfd_arch_info->scan. */ - const char *bfd_name; - /* one of enum mach_attr */ - int num; -} CGEN_MACH; - -/* Parse result (also extraction result). - - The result of parsing an insn is stored here. - To generate the actual insn, this is passed to the insert handler. - When printing an insn, the result of extraction is stored here. - To print the insn, this is passed to the print handler. - - It is machine generated so we don't define it here, - but we do need a forward decl for the handler fns. - - There is one member for each possible field in the insn. - The type depends on the field. - Also recorded here is the computed length of the insn for architectures - where it varies. -*/ - -typedef struct cgen_fields CGEN_FIELDS; - -/* Total length of the insn, as recorded in the `fields' struct. */ -/* ??? The field insert handler has lots of opportunities for optimization - if it ever gets inlined. On architectures where insns all have the same - size, may wish to detect that and make this macro a constant - to allow - further optimizations. */ - -#define CGEN_FIELDS_BITSIZE(fields) ((fields)->length) - -/* Extraction support for variable length insn sets. */ - -/* When disassembling we don't know the number of bytes to read at the start. - So the first CGEN_BASE_INSN_SIZE bytes are read at the start and the rest - are read when needed. This struct controls this. It is basically the - disassemble_info stuff, except that we provide a cache for values already - read (since bytes can typically be read several times to fetch multiple - operands that may be in them), and that extraction of fields is needed - in contexts other than disassembly. */ - -typedef struct { - /* A pointer to the disassemble_info struct. - We don't require dis-asm.h so we use PTR for the type here. - If NULL, BYTES is full of valid data (VALID == -1). */ - PTR dis_info; - /* Points to a working buffer of sufficient size. */ - unsigned char *insn_bytes; - /* Mask of bytes that are valid in INSN_BYTES. */ - unsigned int valid; -} CGEN_EXTRACT_INFO; - -/* Associated with each insn or expression is a set of "handlers" for - performing operations like parsing, printing, etc. These require a bfd_vma - value to be passed around but we don't want all applications to need bfd.h. - So this stuff is only provided if bfd.h has been included. */ - -/* Parse handler. - CD is a cpu table descriptor. - INSN is a pointer to a struct describing the insn being parsed. - STRP is a pointer to a pointer to the text being parsed. - FIELDS is a pointer to a cgen_fields struct in which the results are placed. - If the expression is successfully parsed, *STRP is updated. - If not it is left alone. - The result is NULL if success or an error message. */ -typedef const char * (cgen_parse_fn) - PARAMS ((CGEN_CPU_DESC, const CGEN_INSN *insn_, - const char **strp_, CGEN_FIELDS *fields_)); - -/* Insert handler. - CD is a cpu table descriptor. - INSN is a pointer to a struct describing the insn being parsed. - FIELDS is a pointer to a cgen_fields struct from which the values - are fetched. - INSNP is a pointer to a buffer in which to place the insn. - PC is the pc value of the insn. - The result is an error message or NULL if success. */ - -#ifdef BFD_VERSION -typedef const char * (cgen_insert_fn) - PARAMS ((CGEN_CPU_DESC, const CGEN_INSN *insn_, - CGEN_FIELDS *fields_, CGEN_INSN_BYTES_PTR insnp_, - bfd_vma pc_)); -#else -typedef const char * (cgen_insert_fn) (); -#endif - -/* Extract handler. - CD is a cpu table descriptor. - INSN is a pointer to a struct describing the insn being parsed. - The second argument is a pointer to a struct controlling extraction - (only used for variable length insns). - EX_INFO is a pointer to a struct for controlling reading of further - bytes for the insn. - BASE_INSN is the first CGEN_BASE_INSN_SIZE bytes (host order). - FIELDS is a pointer to a cgen_fields struct in which the results are placed. - PC is the pc value of the insn. - The result is the length of the insn in bits or zero if not recognized. */ - -#ifdef BFD_VERSION -typedef int (cgen_extract_fn) - PARAMS ((CGEN_CPU_DESC, const CGEN_INSN *insn_, - CGEN_EXTRACT_INFO *ex_info_, CGEN_INSN_INT base_insn_, - CGEN_FIELDS *fields_, bfd_vma pc_)); -#else -typedef int (cgen_extract_fn) (); -#endif - -/* Print handler. - CD is a cpu table descriptor. - INFO is a pointer to the disassembly info. - Eg: disassemble_info. It's defined as `PTR' so this file can be included - without dis-asm.h. - INSN is a pointer to a struct describing the insn being printed. - FIELDS is a pointer to a cgen_fields struct. - PC is the pc value of the insn. - LEN is the length of the insn, in bits. */ - -#ifdef BFD_VERSION -typedef void (cgen_print_fn) - PARAMS ((CGEN_CPU_DESC, PTR info_, const CGEN_INSN *insn_, - CGEN_FIELDS *fields_, bfd_vma pc_, int len_)); -#else -typedef void (cgen_print_fn) (); -#endif - -/* Parse/insert/extract/print handlers. - - Indices into the handler tables. - We could use pointers here instead, but 90% of them are generally identical - and that's a lot of redundant data. Making these unsigned char indices - into tables of pointers saves a bit of space. - Using indices also keeps assembler code out of the disassembler and - vice versa. */ - -struct cgen_opcode_handler -{ - unsigned char parse, insert, extract, print; -}; - -/* Assembler interface. - - The interface to the assembler is intended to be clean in the sense that - libopcodes.a is a standalone entity and could be used with any assembler. - Not that one would necessarily want to do that but rather that it helps - keep a clean interface. The interface will obviously be slanted towards - GAS, but at least it's a start. - ??? Note that one possible user of the assembler besides GAS is GDB. - - Parsing is controlled by the assembler which calls - CGEN_SYM (assemble_insn). If it can parse and build the entire insn - it doesn't call back to the assembler. If it needs/wants to call back - to the assembler, cgen_parse_operand_fn is called which can either - - - return a number to be inserted in the insn - - return a "register" value to be inserted - (the register might not be a register per pe) - - queue the argument and return a marker saying the expression has been - queued (eg: a fix-up) - - return an error message indicating the expression wasn't recognizable - - The result is an error message or NULL for success. - The parsed value is stored in the bfd_vma *. */ - -/* Values for indicating what the caller wants. */ - -enum cgen_parse_operand_type -{ - CGEN_PARSE_OPERAND_INIT, - CGEN_PARSE_OPERAND_INTEGER, - CGEN_PARSE_OPERAND_ADDRESS -}; - -/* Values for indicating what was parsed. */ - -enum cgen_parse_operand_result -{ - CGEN_PARSE_OPERAND_RESULT_NUMBER, - CGEN_PARSE_OPERAND_RESULT_REGISTER, - CGEN_PARSE_OPERAND_RESULT_QUEUED, - CGEN_PARSE_OPERAND_RESULT_ERROR -}; - -#ifdef BFD_VERSION /* Don't require bfd.h unnecessarily. */ -typedef const char * (cgen_parse_operand_fn) - PARAMS ((CGEN_CPU_DESC, - enum cgen_parse_operand_type, const char **, int, int, - enum cgen_parse_operand_result *, bfd_vma *)); -#else -typedef const char * (cgen_parse_operand_fn) (); -#endif - -/* Set the cgen_parse_operand_fn callback. */ - -extern void cgen_set_parse_operand_fn - PARAMS ((CGEN_CPU_DESC, cgen_parse_operand_fn)); - -/* Called before trying to match a table entry with the insn. */ - -extern void cgen_init_parse_operand PARAMS ((CGEN_CPU_DESC)); - -/* Operand values (keywords, integers, symbols, etc.) */ - -/* Types of assembler elements. */ - -enum cgen_asm_type -{ - CGEN_ASM_NONE, CGEN_ASM_KEYWORD, CGEN_ASM_MAX -}; - -#ifndef CGEN_ARCH -enum cgen_hw_type { CGEN_HW_MAX }; -#endif - -/* List of hardware elements. */ - -typedef struct -{ - char *name; - enum cgen_hw_type type; - /* There is currently no example where both index specs and value specs - are required, so for now both are clumped under "asm_data". */ - enum cgen_asm_type asm_type; - PTR asm_data; -#ifndef CGEN_HW_NBOOL_ATTRS -#define CGEN_HW_NBOOL_ATTRS 1 -#endif - CGEN_ATTR_TYPE (CGEN_HW_NBOOL_ATTRS) attrs; -#define CGEN_HW_ATTRS(hw) (&(hw)->attrs) -} CGEN_HW_ENTRY; - -/* Return value of attribute ATTR in HW. */ - -#define CGEN_HW_ATTR_VALUE(hw, attr) \ -CGEN_ATTR_VALUE ((hw), CGEN_HW_ATTRS (hw), (attr)) - -/* Table of hardware elements for selected mach, computed at runtime. - enum cgen_hw_type is an index into this table (specifically `entries'). */ - -typedef struct { - /* Pointer to null terminated table of all compiled in entries. */ - const CGEN_HW_ENTRY *init_entries; - unsigned int entry_size; /* since the attribute member is variable sized */ - /* Array of all entries, initial and run-time added. */ - const CGEN_HW_ENTRY **entries; - /* Number of elements in `entries'. */ - unsigned int num_entries; - /* For now, xrealloc is called each time a new entry is added at runtime. - ??? May wish to keep track of some slop to reduce the number of calls to - xrealloc, except that there's unlikely to be many and not expected to be - in speed critical code. */ -} CGEN_HW_TABLE; - -extern const CGEN_HW_ENTRY * cgen_hw_lookup_by_name - PARAMS ((CGEN_CPU_DESC, const char *)); -extern const CGEN_HW_ENTRY * cgen_hw_lookup_by_num - PARAMS ((CGEN_CPU_DESC, int)); - -/* This struct is used to describe things like register names, etc. */ - -typedef struct cgen_keyword_entry -{ - /* Name (as in register name). */ - char * name; - - /* Value (as in register number). - The value cannot be -1 as that is used to indicate "not found". - IDEA: Have "FUNCTION" attribute? [function is called to fetch value]. */ - int value; - - /* Attributes. - This should, but technically needn't, appear last. It is a variable sized - array in that one architecture may have 1 nonbool attribute and another - may have more. Having this last means the non-architecture specific code - needn't care. The goal is to eventually record - attributes in their raw form, evaluate them at run-time, and cache the - values, so this worry will go away anyway. */ - /* ??? Moving this last should be done by treating keywords like insn lists - and moving the `next' fields into a CGEN_KEYWORD_LIST struct. */ - /* FIXME: Not used yet. */ -#ifndef CGEN_KEYWORD_NBOOL_ATTRS -#define CGEN_KEYWORD_NBOOL_ATTRS 1 -#endif - CGEN_ATTR_TYPE (CGEN_KEYWORD_NBOOL_ATTRS) attrs; - - /* ??? Putting these here means compiled in entries can't be const. - Not a really big deal, but something to consider. */ - /* Next name hash table entry. */ - struct cgen_keyword_entry *next_name; - /* Next value hash table entry. */ - struct cgen_keyword_entry *next_value; -} CGEN_KEYWORD_ENTRY; - -/* Top level struct for describing a set of related keywords - (e.g. register names). - - This struct supports run-time entry of new values, and hashed lookups. */ - -typedef struct cgen_keyword -{ - /* Pointer to initial [compiled in] values. */ - CGEN_KEYWORD_ENTRY *init_entries; - - /* Number of entries in `init_entries'. */ - unsigned int num_init_entries; - - /* Hash table used for name lookup. */ - CGEN_KEYWORD_ENTRY **name_hash_table; - - /* Hash table used for value lookup. */ - CGEN_KEYWORD_ENTRY **value_hash_table; - - /* Number of entries in the hash_tables. */ - unsigned int hash_table_size; - - /* Pointer to null keyword "" entry if present. */ - const CGEN_KEYWORD_ENTRY *null_entry; -} CGEN_KEYWORD; - -/* Structure used for searching. */ - -typedef struct -{ - /* Table being searched. */ - const CGEN_KEYWORD *table; - - /* Specification of what is being searched for. */ - const char *spec; - - /* Current index in hash table. */ - unsigned int current_hash; - - /* Current element in current hash chain. */ - CGEN_KEYWORD_ENTRY *current_entry; -} CGEN_KEYWORD_SEARCH; - -/* Lookup a keyword from its name. */ - -const CGEN_KEYWORD_ENTRY *cgen_keyword_lookup_name - PARAMS ((CGEN_KEYWORD *, const char *)); - -/* Lookup a keyword from its value. */ - -const CGEN_KEYWORD_ENTRY *cgen_keyword_lookup_value - PARAMS ((CGEN_KEYWORD *, int)); - -/* Add a keyword. */ - -void cgen_keyword_add PARAMS ((CGEN_KEYWORD *, CGEN_KEYWORD_ENTRY *)); - -/* Keyword searching. - This can be used to retrieve every keyword, or a subset. */ - -CGEN_KEYWORD_SEARCH cgen_keyword_search_init - PARAMS ((CGEN_KEYWORD *, const char *)); -const CGEN_KEYWORD_ENTRY *cgen_keyword_search_next - PARAMS ((CGEN_KEYWORD_SEARCH *)); - -/* Operand value support routines. */ - -extern const char *cgen_parse_keyword - PARAMS ((CGEN_CPU_DESC, const char **, CGEN_KEYWORD *, long *)); -#ifdef BFD_VERSION /* Don't require bfd.h unnecessarily. */ -extern const char *cgen_parse_signed_integer - PARAMS ((CGEN_CPU_DESC, const char **, int, long *)); -extern const char *cgen_parse_unsigned_integer - PARAMS ((CGEN_CPU_DESC, const char **, int, unsigned long *)); -extern const char *cgen_parse_address - PARAMS ((CGEN_CPU_DESC, const char **, int, int, - enum cgen_parse_operand_result *, bfd_vma *)); -extern const char *cgen_validate_signed_integer - PARAMS ((long, long, long)); -extern const char *cgen_validate_unsigned_integer - PARAMS ((unsigned long, unsigned long, unsigned long)); -#endif - -/* Operand modes. */ - -/* ??? This duplicates the values in arch.h. Revisit. - These however need the CGEN_ prefix [as does everything in this file]. */ -/* ??? Targets may need to add their own modes so we may wish to move this - to <arch>-opc.h, or add a hook. */ - -enum cgen_mode { - CGEN_MODE_VOID, /* ??? rename simulator's VM to VOID? */ - CGEN_MODE_BI, CGEN_MODE_QI, CGEN_MODE_HI, CGEN_MODE_SI, CGEN_MODE_DI, - CGEN_MODE_UBI, CGEN_MODE_UQI, CGEN_MODE_UHI, CGEN_MODE_USI, CGEN_MODE_UDI, - CGEN_MODE_SF, CGEN_MODE_DF, CGEN_MODE_XF, CGEN_MODE_TF, - CGEN_MODE_TARGET_MAX, - CGEN_MODE_INT, CGEN_MODE_UINT, - CGEN_MODE_MAX -}; - -/* FIXME: Until simulator is updated. */ - -#define CGEN_MODE_VM CGEN_MODE_VOID - -/* Operands. */ - -#ifndef CGEN_ARCH -enum cgen_operand_type { CGEN_OPERAND_MAX }; -#endif - -/* "nil" indicator for the operand instance table */ -#define CGEN_OPERAND_NIL CGEN_OPERAND_MAX - -/* This struct defines each entry in the operand table. */ - -typedef struct -{ - /* Name as it appears in the syntax string. */ - char *name; - - /* Operand type. */ - enum cgen_operand_type type; - - /* The hardware element associated with this operand. */ - enum cgen_hw_type hw_type; - - /* FIXME: We don't yet record ifield definitions, which we should. - When we do it might make sense to delete start/length (since they will - be duplicated in the ifield's definition) and replace them with a - pointer to the ifield entry. */ - - /* Bit position. - This is just a hint, and may be unused in more complex operands. - May be unused for a modifier. */ - unsigned char start; - - /* The number of bits in the operand. - This is just a hint, and may be unused in more complex operands. - May be unused for a modifier. */ - unsigned char length; - -#if 0 /* ??? Interesting idea but relocs tend to get too complicated, - and ABI dependent, for simple table lookups to work. */ - /* Ideally this would be the internal (external?) reloc type. */ - int reloc_type; -#endif - - /* Attributes. - This should, but technically needn't, appear last. It is a variable sized - array in that one architecture may have 1 nonbool attribute and another - may have more. Having this last means the non-architecture specific code - needn't care, now or tomorrow. The goal is to eventually record - attributes in their raw form, evaluate them at run-time, and cache the - values, so this worry will go away anyway. */ -#ifndef CGEN_OPERAND_NBOOL_ATTRS -#define CGEN_OPERAND_NBOOL_ATTRS 1 -#endif - CGEN_ATTR_TYPE (CGEN_OPERAND_NBOOL_ATTRS) attrs; -#define CGEN_OPERAND_ATTRS(operand) (&(operand)->attrs) -} CGEN_OPERAND; - -/* Return value of attribute ATTR in OPERAND. */ - -#define CGEN_OPERAND_ATTR_VALUE(operand, attr) \ -CGEN_ATTR_VALUE ((operand), CGEN_OPERAND_ATTRS (operand), (attr)) - -/* Table of operands for selected mach/isa, computed at runtime. - enum cgen_operand_type is an index into this table (specifically - `entries'). */ - -typedef struct { - /* Pointer to null terminated table of all compiled in entries. */ - const CGEN_OPERAND *init_entries; - unsigned int entry_size; /* since the attribute member is variable sized */ - /* Array of all entries, initial and run-time added. */ - const CGEN_OPERAND **entries; - /* Number of elements in `entries'. */ - unsigned int num_entries; - /* For now, xrealloc is called each time a new entry is added at runtime. - ??? May wish to keep track of some slop to reduce the number of calls to - xrealloc, except that there's unlikely to be many and not expected to be - in speed critical code. */ -} CGEN_OPERAND_TABLE; - -extern const CGEN_OPERAND * cgen_operand_lookup_by_name - PARAMS ((CGEN_CPU_DESC, const char *)); -extern const CGEN_OPERAND * cgen_operand_lookup_by_num - PARAMS ((CGEN_CPU_DESC, int)); - -/* Instruction operand instances. - - For each instruction, a list of the hardware elements that are read and - written are recorded. */ - -/* The type of the instance. */ - -enum cgen_opinst_type { - /* End of table marker. */ - CGEN_OPINST_END = 0, - CGEN_OPINST_INPUT, CGEN_OPINST_OUTPUT -}; - -typedef struct -{ - /* Input or output indicator. */ - enum cgen_opinst_type type; - - /* Name of operand. */ - const char *name; - - /* The hardware element referenced. */ - enum cgen_hw_type hw_type; - - /* The mode in which the operand is being used. */ - enum cgen_mode mode; - - /* The operand table entry CGEN_OPERAND_NIL if there is none - (i.e. an explicit hardware reference). */ - enum cgen_operand_type op_type; - - /* If `operand' is "nil", the index (e.g. into array of registers). */ - int index; - - /* Attributes. - ??? This perhaps should be a real attribute struct but there's - no current need, so we save a bit of space and just have a set of - flags. The interface is such that this can easily be made attributes - should it prove useful. */ - unsigned int attrs; -#define CGEN_OPINST_ATTRS(opinst) ((opinst)->attrs) -/* Return value of attribute ATTR in OPINST. */ -#define CGEN_OPINST_ATTR(opinst, attr) \ -((CGEN_OPINST_ATTRS (opinst) & (attr)) != 0) -/* Operand is conditionally referenced (read/written). */ -#define CGEN_OPINST_COND_REF 1 -} CGEN_OPINST; - -/* Syntax string. - - Each insn format and subexpression has one of these. - - The syntax "string" consists of characters (n > 0 && n < 128), and operand - values (n >= 128), and is terminated by 0. Operand values are 128 + index - into the operand table. The operand table doesn't exist in C, per se, as - the data is recorded in the parse/insert/extract/print switch statements. */ - -#ifndef CGEN_MAX_SYNTAX_BYTES -#define CGEN_MAX_SYNTAX_BYTES 16 -#endif - -typedef struct -{ - unsigned char syntax[CGEN_MAX_SYNTAX_BYTES]; -} CGEN_SYNTAX; - -#define CGEN_SYNTAX_STRING(syn) (syn->syntax) -#define CGEN_SYNTAX_CHAR_P(c) ((c) < 128) -#define CGEN_SYNTAX_CHAR(c) (c) -#define CGEN_SYNTAX_FIELD(c) ((c) - 128) -#define CGEN_SYNTAX_MAKE_FIELD(c) ((c) + 128) - -/* ??? I can't currently think of any case where the mnemonic doesn't come - first [and if one ever doesn't building the hash tables will be tricky]. - However, we treat mnemonics as just another operand of the instruction. - A value of 1 means "this is where the mnemonic appears". 1 isn't - special other than it's a non-printable ASCII char. */ - -#define CGEN_SYNTAX_MNEMONIC 1 -#define CGEN_SYNTAX_MNEMONIC_P(ch) ((ch) == CGEN_SYNTAX_MNEMONIC) - -/* Instruction fields. - - ??? We currently don't allow adding fields at run-time. - Easy to fix when needed. */ - -typedef struct cgen_ifld { - /* Enum of ifield. */ - int num; -#define CGEN_IFLD_NUM(f) ((f)->num) - - /* Name of the field, distinguishes it from all other fields. */ - const char *name; -#define CGEN_IFLD_NAME(f) ((f)->name) - - /* Default offset, in bits, from the start of the insn to the word - containing the field. */ - int word_offset; -#define CGEN_IFLD_WORD_OFFSET(f) ((f)->word_offset) - - /* Default length of the word containing the field. */ - int word_size; -#define CGEN_IFLD_WORD_SIZE(f) ((f)->word_size) - - /* Default starting bit number. - Whether lsb=0 or msb=0 is determined by CGEN_INSN_LSB0_P. */ - int start; -#define CGEN_IFLD_START(f) ((f)->start) - - /* Length of the field, in bits. */ - int length; -#define CGEN_IFLD_LENGTH(f) ((f)->length) - -#ifndef CGEN_IFLD_NBOOL_ATTRS -#define CGEN_IFLD_NBOOL_ATTRS 1 -#endif - CGEN_ATTR_TYPE (CGEN_IFLD_NBOOL_ATTRS) attrs; -#define CGEN_IFLD_ATTRS(f) (&(f)->attrs) -} CGEN_IFLD; - -/* Return value of attribute ATTR in IFLD. */ -#define CGEN_IFLD_ATTR_VALUE(ifld, attr) \ -CGEN_ATTR_VALUE ((ifld), CGEN_IFLD_ATTRS (ifld), (attr)) - -/* Instruction data. */ - -/* Instruction formats. - - Instructions are grouped by format. Associated with an instruction is its - format. Each insn's opcode table entry contains a format table entry. - ??? There is usually very few formats compared with the number of insns, - so one can reduce the size of the opcode table by recording the format table - as a separate entity. Given that we currently don't, format table entries - are also distinguished by their operands. This increases the size of the - table, but reduces the number of tables. It's all minutiae anyway so it - doesn't really matter [at this point in time]. - - ??? Support for variable length ISA's is wip. */ - -/* Accompanying each iformat description is a list of its fields. */ - -typedef struct { - const CGEN_IFLD *ifld; -#define CGEN_IFMT_IFLD_IFLD(ii) ((ii)->ifld) -} CGEN_IFMT_IFLD; - -#ifndef CGEN_MAX_IFMT_OPERANDS -#define CGEN_MAX_IFMT_OPERANDS 1 -#endif - -typedef struct -{ - /* Length that MASK and VALUE have been calculated to - [VALUE is recorded elsewhere]. - Normally it is base_insn_bitsize. On [V]LIW architectures where the base - insn size may be larger than the size of an insn, this field is less than - base_insn_bitsize. */ - unsigned char mask_length; -#define CGEN_IFMT_MASK_LENGTH(ifmt) ((ifmt)->mask_length) - - /* Total length of instruction, in bits. */ - unsigned char length; -#define CGEN_IFMT_LENGTH(ifmt) ((ifmt)->length) - - /* Mask to apply to the first MASK_LENGTH bits. - Each insn's value is stored with the insn. - The first step in recognizing an insn for disassembly is - (opcode & mask) == value. */ - CGEN_INSN_INT mask; -#define CGEN_IFMT_MASK(ifmt) ((ifmt)->mask) - - /* Instruction fields. - +1 for trailing NULL. */ - CGEN_IFMT_IFLD iflds[CGEN_MAX_IFMT_OPERANDS + 1]; -#define CGEN_IFMT_IFLDS(ifmt) ((ifmt)->iflds) -} CGEN_IFMT; - -/* Instruction values. */ - -typedef struct -{ - /* The opcode portion of the base insn. */ - CGEN_INSN_INT base_value; - -#ifdef CGEN_MAX_EXTRA_OPCODE_OPERANDS - /* Extra opcode values beyond base_value. */ - unsigned long ifield_values[CGEN_MAX_EXTRA_OPCODE_OPERANDS]; -#endif -} CGEN_IVALUE; - -/* Instruction opcode table. - This contains the syntax and format data of an instruction. */ - -/* ??? Some ports already have an opcode table yet still need to use the rest - of what cgen_insn has. Plus keeping the opcode data with the operand - instance data can create a pretty big file. So we keep them separately. - Not sure this is a good idea in the long run. */ - -typedef struct -{ - /* Indices into parse/insert/extract/print handler tables. */ - struct cgen_opcode_handler handlers; -#define CGEN_OPCODE_HANDLERS(opc) (& (opc)->handlers) - - /* Syntax string. */ - CGEN_SYNTAX syntax; -#define CGEN_OPCODE_SYNTAX(opc) (& (opc)->syntax) - - /* Format entry. */ - const CGEN_IFMT *format; -#define CGEN_OPCODE_FORMAT(opc) ((opc)->format) -#define CGEN_OPCODE_MASK_BITSIZE(opc) CGEN_IFMT_MASK_LENGTH (CGEN_OPCODE_FORMAT (opc)) -#define CGEN_OPCODE_BITSIZE(opc) CGEN_IFMT_LENGTH (CGEN_OPCODE_FORMAT (opc)) -#define CGEN_OPCODE_IFLDS(opc) CGEN_IFMT_IFLDS (CGEN_OPCODE_FORMAT (opc)) - - /* Instruction opcode value. */ - CGEN_IVALUE value; -#define CGEN_OPCODE_VALUE(opc) (& (opc)->value) -#define CGEN_OPCODE_BASE_VALUE(opc) (CGEN_OPCODE_VALUE (opc)->base_value) -#define CGEN_OPCODE_BASE_MASK(opc) CGEN_IFMT_MASK (CGEN_OPCODE_FORMAT (opc)) -} CGEN_OPCODE; - -/* Instruction attributes. - This is made a published type as applications can cache a pointer to - the attributes for speed. */ - -#ifndef CGEN_INSN_NBOOL_ATTRS -#define CGEN_INSN_NBOOL_ATTRS 1 -#endif -typedef CGEN_ATTR_TYPE (CGEN_INSN_NBOOL_ATTRS) CGEN_INSN_ATTR_TYPE; - -/* Enum of architecture independent attributes. */ - -#ifndef CGEN_ARCH -/* ??? Numbers here are recorded in two places. */ -typedef enum cgen_insn_attr { - CGEN_INSN_ALIAS = 0 -} CGEN_INSN_ATTR; -#endif - -/* This struct defines each entry in the instruction table. */ - -typedef struct -{ - /* Each real instruction is enumerated. */ - /* ??? This may go away in time. */ - int num; -#define CGEN_INSN_NUM(insn) ((insn)->base->num) - - /* Name of entry (that distinguishes it from all other entries). */ - /* ??? If mnemonics have operands, try to print full mnemonic. */ - const char *name; -#define CGEN_INSN_NAME(insn) ((insn)->base->name) - - /* Mnemonic. This is used when parsing and printing the insn. - In the case of insns that have operands on the mnemonics, this is - only the constant part. E.g. for conditional execution of an `add' insn, - where the full mnemonic is addeq, addne, etc., and the condition is - treated as an operand, this is only "add". */ - const char *mnemonic; -#define CGEN_INSN_MNEMONIC(insn) ((insn)->base->mnemonic) - - /* Total length of instruction, in bits. */ - int bitsize; -#define CGEN_INSN_BITSIZE(insn) ((insn)->base->bitsize) - -#if 0 /* ??? Disabled for now as there is a problem with embedded newlines - and the table is already pretty big. Should perhaps be moved - to a file of its own. */ - /* Semantics, as RTL. */ - /* ??? Plain text or bytecodes? */ - /* ??? Note that the operand instance table could be computed at run-time - if we parse this and cache the results. Something to eventually do. */ - const char *rtx; -#define CGEN_INSN_RTX(insn) ((insn)->base->rtx) -#endif - - /* Attributes. - This must appear last. It is a variable sized array in that one - architecture may have 1 nonbool attribute and another may have more. - Having this last means the non-architecture specific code needn't - care. The goal is to eventually record attributes in their raw form, - evaluate them at run-time, and cache the values, so this worry will go - away anyway. */ - CGEN_INSN_ATTR_TYPE attrs; -#define CGEN_INSN_ATTRS(insn) (&(insn)->base->attrs) -/* Return value of attribute ATTR in INSN. */ -#define CGEN_INSN_ATTR_VALUE(insn, attr) \ -CGEN_ATTR_VALUE ((insn), CGEN_INSN_ATTRS (insn), (attr)) -} CGEN_IBASE; - -/* Return non-zero if INSN is the "invalid" insn marker. */ - -#define CGEN_INSN_INVALID_P(insn) (CGEN_INSN_MNEMONIC (insn) == 0) - -/* Main struct contain instruction information. - BASE is always present, the rest is present only if asked for. */ - -struct cgen_insn -{ - /* ??? May be of use to put a type indicator here. - Then this struct could different info for different classes of insns. */ - /* ??? A speedup can be had by moving `base' into this struct. - Maybe later. */ - const CGEN_IBASE *base; - const CGEN_OPCODE *opcode; - const CGEN_OPINST *opinst; -}; - -/* Instruction lists. - This is used for adding new entries and for creating the hash lists. */ - -typedef struct cgen_insn_list -{ - struct cgen_insn_list *next; - const CGEN_INSN *insn; -} CGEN_INSN_LIST; - -/* Table of instructions. */ - -typedef struct -{ - const CGEN_INSN *init_entries; - unsigned int entry_size; /* since the attribute member is variable sized */ - unsigned int num_init_entries; - CGEN_INSN_LIST *new_entries; -} CGEN_INSN_TABLE; - -/* Return number of instructions. This includes any added at run-time. */ - -extern int cgen_insn_count PARAMS ((CGEN_CPU_DESC)); -extern int cgen_macro_insn_count PARAMS ((CGEN_CPU_DESC)); - -/* Macros to access the other insn elements not recorded in CGEN_IBASE. */ - -/* Fetch INSN's operand instance table. */ -/* ??? Doesn't handle insns added at runtime. */ -#define CGEN_INSN_OPERANDS(insn) ((insn)->opinst) - -/* Return INSN's opcode table entry. */ -#define CGEN_INSN_OPCODE(insn) ((insn)->opcode) - -/* Return INSN's handler data. */ -#define CGEN_INSN_HANDLERS(insn) CGEN_OPCODE_HANDLERS (CGEN_INSN_OPCODE (insn)) - -/* Return INSN's syntax. */ -#define CGEN_INSN_SYNTAX(insn) CGEN_OPCODE_SYNTAX (CGEN_INSN_OPCODE (insn)) - -/* Return size of base mask in bits. */ -#define CGEN_INSN_MASK_BITSIZE(insn) \ - CGEN_OPCODE_MASK_BITSIZE (CGEN_INSN_OPCODE (insn)) - -/* Return mask of base part of INSN. */ -#define CGEN_INSN_BASE_MASK(insn) \ - CGEN_OPCODE_BASE_MASK (CGEN_INSN_OPCODE (insn)) - -/* Return value of base part of INSN. */ -#define CGEN_INSN_BASE_VALUE(insn) \ - CGEN_OPCODE_BASE_VALUE (CGEN_INSN_OPCODE (insn)) - -/* Standard way to test whether INSN is supported by MACH. - MACH is one of enum mach_attr. - The "|1" is because the base mach is always selected. */ -#define CGEN_INSN_MACH_HAS_P(insn, mach) \ -((CGEN_INSN_ATTR_VALUE ((insn), CGEN_INSN_MACH) & ((1 << (mach)) | 1)) != 0) - -/* Macro instructions. - Macro insns aren't real insns, they map to one or more real insns. - E.g. An architecture's "nop" insn may actually be an "mv r0,r0" or - some such. - - Macro insns can expand to nothing (e.g. a nop that is optimized away). - This is useful in multi-insn macros that build a constant in a register. - Of course this isn't the default behaviour and must be explicitly enabled. - - Assembly of macro-insns is relatively straightforward. Disassembly isn't. - However, disassembly of at least some kinds of macro insns is important - in order that the disassembled code preserve the readability of the original - insn. What is attempted here is to disassemble all "simple" macro-insns, - where "simple" is currently defined to mean "expands to one real insn". - - Simple macro-insns are handled specially. They are emitted as ALIAS's - of real insns. This simplifies their handling since there's usually more - of them than any other kind of macro-insn, and proper disassembly of them - falls out for free. */ - -/* For each macro-insn there may be multiple expansion possibilities, - depending on the arguments. This structure is accessed via the `data' - member of CGEN_INSN. */ - -typedef struct cgen_minsn_expansion { - /* Function to do the expansion. - If the expansion fails (e.g. "no match") NULL is returned. - Space for the expansion is obtained with malloc. - It is up to the caller to free it. */ - const char * (* fn) PARAMS ((const struct cgen_minsn_expansion *, - const char *, const char **, int *, - CGEN_OPERAND **)); -#define CGEN_MIEXPN_FN(ex) ((ex)->fn) - - /* Instruction(s) the macro expands to. - The format of STR is defined by FN. - It is typically the assembly code of the real insn, but it could also be - the original Scheme expression or a tokenized form of it (with FN being - an appropriate interpreter). */ - const char * str; -#define CGEN_MIEXPN_STR(ex) ((ex)->str) -} CGEN_MINSN_EXPANSION; - -/* Normal expander. - When supported, this function will convert the input string to another - string and the parser will be invoked recursively. The output string - may contain further macro invocations. */ - -extern const char * cgen_expand_macro_insn - PARAMS ((CGEN_CPU_DESC, const struct cgen_minsn_expansion *, - const char *, const char **, int *, CGEN_OPERAND **)); - -/* The assembler insn table is hashed based on some function of the mnemonic - (the actually hashing done is up to the target, but we provide a few - examples like the first letter or a function of the entire mnemonic). */ - -extern CGEN_INSN_LIST * cgen_asm_lookup_insn - PARAMS ((CGEN_CPU_DESC, const char *)); -#define CGEN_ASM_LOOKUP_INSN(cd, string) cgen_asm_lookup_insn ((cd), (string)) -#define CGEN_ASM_NEXT_INSN(insn) ((insn)->next) - -/* The disassembler insn table is hashed based on some function of machine - instruction (the actually hashing done is up to the target). */ - -extern CGEN_INSN_LIST * cgen_dis_lookup_insn - PARAMS ((CGEN_CPU_DESC, const char *, CGEN_INSN_INT)); -/* FIXME: delete these two */ -#define CGEN_DIS_LOOKUP_INSN(cd, buf, value) cgen_dis_lookup_insn ((cd), (buf), (value)) -#define CGEN_DIS_NEXT_INSN(insn) ((insn)->next) - -/* The CPU description. - A copy of this is created when the cpu table is "opened". - All global state information is recorded here. - Access macros are provided for "public" members. */ - -typedef struct cgen_cpu_desc -{ - /* Bitmap of selected machine(s) (a la BFD machine number). */ - int machs; - - /* Bitmap of selected isa(s). - ??? Simultaneous multiple isas might not make sense, but it's not (yet) - precluded. */ - int isas; - - /* Current endian. */ - enum cgen_endian endian; -#define CGEN_CPU_ENDIAN(cd) ((cd)->endian) - - /* Current insn endian. */ - enum cgen_endian insn_endian; -#define CGEN_CPU_INSN_ENDIAN(cd) ((cd)->insn_endian) - - /* Word size (in bits). */ - /* ??? Or maybe maximum word size - might we ever need to allow a cpu table - to be opened for both sparc32/sparc64? - ??? Another alternative is to create a table of selected machs and - lazily fetch the data from there. */ - unsigned int word_bitsize; - - /* Indicator if sizes are unknown. - This is used by default_insn_bitsize,base_insn_bitsize if there is a - difference between the selected isa's. */ -#define CGEN_SIZE_UNKNOWN 65535 - - /* Default instruction size (in bits). - This is used by the assembler when it encounters an unknown insn. */ - unsigned int default_insn_bitsize; - - /* Base instruction size (in bits). - For non-LIW cpus this is generally the length of the smallest insn. - For LIW cpus its wip (work-in-progress). For the m32r its 32. */ - unsigned int base_insn_bitsize; - - /* Minimum/maximum instruction size (in bits). */ - unsigned int min_insn_bitsize; - unsigned int max_insn_bitsize; - - /* Instruction set variants. */ - const CGEN_ISA *isa_table; - - /* Machine variants. */ - const CGEN_MACH *mach_table; - - /* Hardware elements. */ - CGEN_HW_TABLE hw_table; - - /* Instruction fields. */ - const CGEN_IFLD *ifld_table; - - /* Operands. */ - CGEN_OPERAND_TABLE operand_table; - - /* Main instruction table. */ - CGEN_INSN_TABLE insn_table; -#define CGEN_CPU_INSN_TABLE(cd) (& (cd)->insn_table) - - /* Macro instructions are defined separately and are combined with real - insns during hash table computation. */ - CGEN_INSN_TABLE macro_insn_table; - - /* Copy of CGEN_INT_INSN_P. */ - int int_insn_p; - - /* Called to rebuild the tables after something has changed. */ - void (*rebuild_tables) PARAMS ((CGEN_CPU_DESC)); - - /* Operand parser callback. */ - cgen_parse_operand_fn * parse_operand_fn; - - /* Parse/insert/extract/print cover fns for operands. */ - const char * (*parse_operand) - PARAMS ((CGEN_CPU_DESC, int opindex_, const char **, - CGEN_FIELDS *fields_)); -#ifdef BFD_VERSION - const char * (*insert_operand) - PARAMS ((CGEN_CPU_DESC, int opindex_, CGEN_FIELDS *fields_, - CGEN_INSN_BYTES_PTR, bfd_vma pc_)); - int (*extract_operand) - PARAMS ((CGEN_CPU_DESC, int opindex_, CGEN_EXTRACT_INFO *, CGEN_INSN_INT, - CGEN_FIELDS *fields_, bfd_vma pc_)); - void (*print_operand) - PARAMS ((CGEN_CPU_DESC, int opindex_, PTR info_, CGEN_FIELDS * fields_, - void const *attrs_, bfd_vma pc_, int length_)); -#else - const char * (*insert_operand) (); - int (*extract_operand) (); - void (*print_operand) (); -#endif -#define CGEN_CPU_PARSE_OPERAND(cd) ((cd)->parse_operand) -#define CGEN_CPU_INSERT_OPERAND(cd) ((cd)->insert_operand) -#define CGEN_CPU_EXTRACT_OPERAND(cd) ((cd)->extract_operand) -#define CGEN_CPU_PRINT_OPERAND(cd) ((cd)->print_operand) - - /* Size of CGEN_FIELDS struct. */ - unsigned int sizeof_fields; -#define CGEN_CPU_SIZEOF_FIELDS(cd) ((cd)->sizeof_fields) - - /* Set the bitsize field. */ - void (*set_fields_bitsize) PARAMS ((CGEN_FIELDS *fields_, int size_)); -#define CGEN_CPU_SET_FIELDS_BITSIZE(cd) ((cd)->set_fields_bitsize) - - /* CGEN_FIELDS accessors. */ - int (*get_int_operand) - PARAMS ((CGEN_CPU_DESC, int opindex_, const CGEN_FIELDS *fields_)); - void (*set_int_operand) - PARAMS ((CGEN_CPU_DESC, int opindex_, CGEN_FIELDS *fields_, int value_)); -#ifdef BFD_VERSION - bfd_vma (*get_vma_operand) - PARAMS ((CGEN_CPU_DESC, int opindex_, const CGEN_FIELDS *fields_)); - void (*set_vma_operand) - PARAMS ((CGEN_CPU_DESC, int opindex_, CGEN_FIELDS *fields_, bfd_vma value_)); -#else - long (*get_vma_operand) (); - void (*set_vma_operand) (); -#endif -#define CGEN_CPU_GET_INT_OPERAND(cd) ((cd)->get_int_operand) -#define CGEN_CPU_SET_INT_OPERAND(cd) ((cd)->set_int_operand) -#define CGEN_CPU_GET_VMA_OPERAND(cd) ((cd)->get_vma_operand) -#define CGEN_CPU_SET_VMA_OPERAND(cd) ((cd)->set_vma_operand) - - /* Instruction parse/insert/extract/print handlers. */ - /* FIXME: make these types uppercase. */ - cgen_parse_fn * const *parse_handlers; - cgen_insert_fn * const *insert_handlers; - cgen_extract_fn * const *extract_handlers; - cgen_print_fn * const *print_handlers; -#define CGEN_PARSE_FN(cd, insn) (cd->parse_handlers[(insn)->opcode->handlers.parse]) -#define CGEN_INSERT_FN(cd, insn) (cd->insert_handlers[(insn)->opcode->handlers.insert]) -#define CGEN_EXTRACT_FN(cd, insn) (cd->extract_handlers[(insn)->opcode->handlers.extract]) -#define CGEN_PRINT_FN(cd, insn) (cd->print_handlers[(insn)->opcode->handlers.print]) - - /* Return non-zero if insn should be added to hash table. */ - int (* asm_hash_p) PARAMS ((const CGEN_INSN *)); - - /* Assembler hash function. */ - unsigned int (* asm_hash) PARAMS ((const char *)); - - /* Number of entries in assembler hash table. */ - unsigned int asm_hash_size; - - /* Return non-zero if insn should be added to hash table. */ - int (* dis_hash_p) PARAMS ((const CGEN_INSN *)); - - /* Disassembler hash function. */ - unsigned int (* dis_hash) PARAMS ((const char *, CGEN_INSN_INT)); - - /* Number of entries in disassembler hash table. */ - unsigned int dis_hash_size; - - /* Assembler instruction hash table. */ - CGEN_INSN_LIST **asm_hash_table; - CGEN_INSN_LIST *asm_hash_table_entries; - - /* Disassembler instruction hash table. */ - CGEN_INSN_LIST **dis_hash_table; - CGEN_INSN_LIST *dis_hash_table_entries; - - /* This field could be turned into a bitfield if room for other flags is needed. */ - unsigned int signed_overflow_ok_p; - -} CGEN_CPU_TABLE; - -/* wip */ -#ifndef CGEN_WORD_ENDIAN -#define CGEN_WORD_ENDIAN(cd) CGEN_CPU_ENDIAN (cd) -#endif -#ifndef CGEN_INSN_WORD_ENDIAN -#define CGEN_INSN_WORD_ENDIAN(cd) CGEN_CPU_INSN_ENDIAN (cd) -#endif - -/* Prototypes of major functions. */ -/* FIXME: Move more CGEN_SYM-defined functions into CGEN_CPU_DESC. - Not the init fns though, as that would drag in things that mightn't be - used and might not even exist. */ - -/* Argument types to cpu_open. */ - -enum cgen_cpu_open_arg { - CGEN_CPU_OPEN_END, - /* Select instruction set(s), arg is bitmap or 0 meaning "unspecified". */ - CGEN_CPU_OPEN_ISAS, - /* Select machine(s), arg is bitmap or 0 meaning "unspecified". */ - CGEN_CPU_OPEN_MACHS, - /* Select machine, arg is mach's bfd name. - Multiple machines can be specified by repeated use. */ - CGEN_CPU_OPEN_BFDMACH, - /* Select endian, arg is CGEN_ENDIAN_*. */ - CGEN_CPU_OPEN_ENDIAN -}; - -/* Open a cpu descriptor table for use. - ??? We only support ISO C stdargs here, not K&R. - Laziness, plus experiment to see if anything requires K&R - eventually - K&R will no longer be supported - e.g. GDB is currently trying this. */ - -extern CGEN_CPU_DESC CGEN_SYM (cpu_open) (enum cgen_cpu_open_arg, ...); - -/* Cover fn to handle simple case. */ - -extern CGEN_CPU_DESC CGEN_SYM (cpu_open_1) PARAMS ((const char *mach_name_, - enum cgen_endian endian_)); - -/* Close it. */ - -extern void CGEN_SYM (cpu_close) PARAMS ((CGEN_CPU_DESC)); - -/* Initialize the opcode table for use. - Called by init_asm/init_dis. */ - -extern void CGEN_SYM (init_opcode_table) PARAMS ((CGEN_CPU_DESC cd_)); - -/* Initialize the ibld table for use. - Called by init_asm/init_dis. */ - -extern void CGEN_SYM (init_ibld_table) PARAMS ((CGEN_CPU_DESC cd_)); - -/* Initialize an cpu table for assembler or disassembler use. - These must be called immediately after cpu_open. */ - -extern void CGEN_SYM (init_asm) PARAMS ((CGEN_CPU_DESC)); -extern void CGEN_SYM (init_dis) PARAMS ((CGEN_CPU_DESC)); - -/* Initialize the operand instance table for use. */ - -extern void CGEN_SYM (init_opinst_table) PARAMS ((CGEN_CPU_DESC cd_)); - -/* Assemble an instruction. */ - -extern const CGEN_INSN * CGEN_SYM (assemble_insn) - PARAMS ((CGEN_CPU_DESC, const char *, CGEN_FIELDS *, - CGEN_INSN_BYTES_PTR, char **)); - -extern const CGEN_KEYWORD CGEN_SYM (operand_mach); -extern int CGEN_SYM (get_mach) PARAMS ((const char *)); - -/* Operand index computation. */ -extern const CGEN_INSN * cgen_lookup_insn - PARAMS ((CGEN_CPU_DESC, const CGEN_INSN * insn_, - CGEN_INSN_INT int_value_, unsigned char *bytes_value_, - int length_, CGEN_FIELDS *fields_, int alias_p_)); -extern void cgen_get_insn_operands - PARAMS ((CGEN_CPU_DESC, const CGEN_INSN * insn_, - const CGEN_FIELDS *fields_, int *indices_)); -extern const CGEN_INSN * cgen_lookup_get_insn_operands - PARAMS ((CGEN_CPU_DESC, const CGEN_INSN *insn_, - CGEN_INSN_INT int_value_, unsigned char *bytes_value_, - int length_, int *indices_, CGEN_FIELDS *fields_)); - -/* Cover fns to bfd_get/set. */ - -extern CGEN_INSN_INT cgen_get_insn_value - PARAMS ((CGEN_CPU_DESC, unsigned char *, int)); -extern void cgen_put_insn_value - PARAMS ((CGEN_CPU_DESC, unsigned char *, int, CGEN_INSN_INT)); - -/* Read in a cpu description file. - ??? For future concerns, including adding instructions to the assembler/ - disassembler at run-time. */ - -extern const char * cgen_read_cpu_file - PARAMS ((CGEN_CPU_DESC, const char * filename_)); - -/* Allow signed overflow of instruction fields. */ -extern void cgen_set_signed_overflow_ok PARAMS ((CGEN_CPU_DESC)); - -/* Generate an error message if a signed field in an instruction overflows. */ -extern void cgen_clear_signed_overflow_ok PARAMS ((CGEN_CPU_DESC)); - -/* Will an error message be generated if a signed field in an instruction overflows ? */ -extern unsigned int cgen_signed_overflow_ok_p PARAMS ((CGEN_CPU_DESC)); - -#endif /* CGEN_H */ diff --git a/contrib/binutils/include/opcode/mips.h b/contrib/binutils/include/opcode/mips.h deleted file mode 100644 index 68fe57a8aae2..000000000000 --- a/contrib/binutils/include/opcode/mips.h +++ /dev/null @@ -1,749 +0,0 @@ -/* mips.h. Mips opcode list for GDB, the GNU debugger. - Copyright 1993, 94, 95, 96, 1997 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. */ - -#ifndef _MIPS_H_ -#define _MIPS_H_ - -/* 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). An optional two-operand form of break/sdbbp - allows the lower ten bits to be set too. - - 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_CODE2 0x3ff -#define OP_SH_CODE2 6 -#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 -#define OP_SH_LOCC 8 /* FP condition code */ -#define OP_SH_HICC 18 /* FP condition code */ -#define OP_MASK_CC 0x7 -#define OP_SH_COP1NORM 25 /* Normal COP1 encoding */ -#define OP_MASK_COP1NORM 0x1 /* a single bit */ -#define OP_SH_COP1SPEC 21 /* COP1 encodings */ -#define OP_MASK_COP1SPEC 0xf -#define OP_MASK_COP1SCLR 0x4 -#define OP_MASK_COP1CMP 0x3 -#define OP_SH_COP1CMP 4 -#define OP_SH_FORMAT 21 /* FP short format field */ -#define OP_MASK_FORMAT 0x7 -#define OP_SH_TRUE 16 -#define OP_MASK_TRUE 0x1 -#define OP_SH_GE 17 -#define OP_MASK_GE 0x01 -#define OP_SH_UNSIGNED 16 -#define OP_MASK_UNSIGNED 0x1 -#define OP_SH_HINT 16 -#define OP_MASK_HINT 0x1f -#define OP_SH_MMI 0 /* Multimedia (parallel) op */ -#define OP_MASK_MMI 0x3f -#define OP_SH_MMISUB 6 -#define OP_MASK_MMISUB 0x1f -#define OP_MASK_PERFREG 0x1f /* Performance monitoring */ -#define OP_SH_PERFREG 1 - -/* 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 0. */ - 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; - /* A collection of bits describing the instruction sets of which this - instruction or macro is a member. */ - unsigned long membership; -}; - -/* 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) - "q" 10 bit extra breakpoint code (OP_*_CODE2) - "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) - "P" 5 bit performance-monitor register (OP_*_PERFREG) - - 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 - - Other: - "()" parens surrounding optional value - "," separates operands - - Characters used so far, for quick reference when adding more: - "<>()," - "ABCDEFGILMNSTRVW" - "abcdfhijklopqrstuvwxz" -*/ - -/* 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 -/* Instruction uses single precision floating point. */ -#define FP_S 0x10000000 -/* Instruction uses double precision floating point. */ -#define FP_D 0x20000000 -/* Instruction is part of the tx39's integer multiply family. */ -#define INSN_MULT 0x40000000 -/* Instruction synchronize shared memory. */ -#define INSN_SYNC 0x80000000 - -/* Instruction is actually a macro. It should be ignored by the - disassembler, and requires special treatment by the assembler. */ -#define INSN_MACRO 0xffffffff - - - - - -/* MIPS ISA field--CPU level at which insn is supported. */ -#define INSN_ISA 0x0000000F -/* An instruction which is not part of any basic MIPS ISA. - (ie it is a chip specific instruction) */ -#define INSN_NO_ISA 0x00000000 -/* MIPS ISA 1 instruction. */ -#define INSN_ISA1 0x00000001 -/* MIPS ISA 2 instruction (R6000 or R4000). */ -#define INSN_ISA2 0x00000002 -/* MIPS ISA 3 instruction (R4000). */ -#define INSN_ISA3 0x00000003 -/* MIPS ISA 4 instruction (R8000). */ -#define INSN_ISA4 0x00000004 -#define INSN_ISA5 0x00000005 - -/* Chip specific instructions. These are bitmasks. */ -/* MIPS R4650 instruction. */ -#define INSN_4650 0x00000010 -/* LSI R4010 instruction. */ -#define INSN_4010 0x00000020 -/* NEC VR4100 instruction. */ -#define INSN_4100 0x00000040 -/* Toshiba R3900 instruction. */ -#define INSN_3900 0x00000080 - -/* 32-bit code running on a ISA3+ CPU. */ -#define INSN_GP32 0x00001000 - -/* Test for membership in an ISA including chip specific ISAs. - INSN is pointer to an element of the opcode table; ISA is the - specified ISA to test against; and CPU is the CPU specific ISA - to test, or zero if no CPU specific ISA test is desired. - The gp32 arg is set when you need to force 32-bit register usage on - a machine with 64-bit registers; see the documentation under -mgp32 - in the MIPS gas docs. */ - -#define OPCODE_IS_MEMBER(insn,isa,cpu,gp32) \ - ((((insn)->membership & INSN_ISA) != 0 \ - && ((insn)->membership & INSN_ISA) <= isa \ - && ((insn)->membership & INSN_GP32 ? gp32 : 1)) \ - || (cpu == 4650 \ - && ((insn)->membership & INSN_4650) != 0) \ - || (cpu == 4010 \ - && ((insn)->membership & INSN_4010) != 0) \ - || ((cpu == 4100 \ - || cpu == 4111 \ - ) \ - && ((insn)->membership & INSN_4100) != 0) \ - || (cpu == 3900 \ - && ((insn)->membership & INSN_3900) != 0)) - -/* 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, - 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, - 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_DSUBU_I_2, - 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_SUBU_I_2, - 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, - M_COP0, - M_COP1, - M_COP2, - M_COP3, - M_NUM_MACROS -}; - - -/* 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 <register> instruction is short for jalr <register>). */ - -extern const struct mips_opcode mips_builtin_opcodes[]; -extern const int bfd_mips_num_builtin_opcodes; -extern struct mips_opcode *mips_opcodes; -extern int bfd_mips_num_opcodes; -#define NUMOPCODES bfd_mips_num_opcodes - - -/* The rest of this file adds definitions for the mips16 TinyRISC - processor. */ - -/* These are the bitmasks and shift counts used for the different - fields in the instruction formats. Other than OP, no masks are - provided for the fixed portions of an instruction, since they are - not needed. - - The I format uses IMM11. - - The RI format uses RX and IMM8. - - The RR format uses RX, and RY. - - The RRI format uses RX, RY, and IMM5. - - The RRR format uses RX, RY, and RZ. - - The RRI_A format uses RX, RY, and IMM4. - - The SHIFT format uses RX, RY, and SHAMT. - - The I8 format uses IMM8. - - The I8_MOVR32 format uses RY and REGR32. - - The IR_MOV32R format uses REG32R and MOV32Z. - - The I64 format uses IMM8. - - The RI64 format uses RY and IMM5. - */ - -#define MIPS16OP_MASK_OP 0x1f -#define MIPS16OP_SH_OP 11 -#define MIPS16OP_MASK_IMM11 0x7ff -#define MIPS16OP_SH_IMM11 0 -#define MIPS16OP_MASK_RX 0x7 -#define MIPS16OP_SH_RX 8 -#define MIPS16OP_MASK_IMM8 0xff -#define MIPS16OP_SH_IMM8 0 -#define MIPS16OP_MASK_RY 0x7 -#define MIPS16OP_SH_RY 5 -#define MIPS16OP_MASK_IMM5 0x1f -#define MIPS16OP_SH_IMM5 0 -#define MIPS16OP_MASK_RZ 0x7 -#define MIPS16OP_SH_RZ 2 -#define MIPS16OP_MASK_IMM4 0xf -#define MIPS16OP_SH_IMM4 0 -#define MIPS16OP_MASK_REGR32 0x1f -#define MIPS16OP_SH_REGR32 0 -#define MIPS16OP_MASK_REG32R 0x1f -#define MIPS16OP_SH_REG32R 3 -#define MIPS16OP_EXTRACT_REG32R(i) ((((i) >> 5) & 7) | ((i) & 0x18)) -#define MIPS16OP_MASK_MOVE32Z 0x7 -#define MIPS16OP_SH_MOVE32Z 0 -#define MIPS16OP_MASK_IMM6 0x3f -#define MIPS16OP_SH_IMM6 5 - -/* 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. - - "y" 3 bit register (MIPS16OP_*_RY) - "x" 3 bit register (MIPS16OP_*_RX) - "z" 3 bit register (MIPS16OP_*_RZ) - "Z" 3 bit register (MIPS16OP_*_MOVE32Z) - "v" 3 bit same register as source and destination (MIPS16OP_*_RX) - "w" 3 bit same register as source and destination (MIPS16OP_*_RY) - "0" zero register ($0) - "S" stack pointer ($sp or $29) - "P" program counter - "R" return address register ($ra or $31) - "X" 5 bit MIPS register (MIPS16OP_*_REGR32) - "Y" 5 bit MIPS register (MIPS16OP_*_REG32R) - "6" 6 bit unsigned break code (MIPS16OP_*_IMM6) - "a" 26 bit jump address - "e" 11 bit extension value - "l" register list for entry instruction - "L" register list for exit instruction - - The remaining codes may be extended. Except as otherwise noted, - the full extended operand is a 16 bit signed value. - "<" 3 bit unsigned shift count * 0 (MIPS16OP_*_RZ) (full 5 bit unsigned) - ">" 3 bit unsigned shift count * 0 (MIPS16OP_*_RX) (full 5 bit unsigned) - "[" 3 bit unsigned shift count * 0 (MIPS16OP_*_RZ) (full 6 bit unsigned) - "]" 3 bit unsigned shift count * 0 (MIPS16OP_*_RX) (full 6 bit unsigned) - "4" 4 bit signed immediate * 0 (MIPS16OP_*_IMM4) (full 15 bit signed) - "5" 5 bit unsigned immediate * 0 (MIPS16OP_*_IMM5) - "H" 5 bit unsigned immediate * 2 (MIPS16OP_*_IMM5) - "W" 5 bit unsigned immediate * 4 (MIPS16OP_*_IMM5) - "D" 5 bit unsigned immediate * 8 (MIPS16OP_*_IMM5) - "j" 5 bit signed immediate * 0 (MIPS16OP_*_IMM5) - "8" 8 bit unsigned immediate * 0 (MIPS16OP_*_IMM8) - "V" 8 bit unsigned immediate * 4 (MIPS16OP_*_IMM8) - "C" 8 bit unsigned immediate * 8 (MIPS16OP_*_IMM8) - "U" 8 bit unsigned immediate * 0 (MIPS16OP_*_IMM8) (full 16 bit unsigned) - "k" 8 bit signed immediate * 0 (MIPS16OP_*_IMM8) - "K" 8 bit signed immediate * 8 (MIPS16OP_*_IMM8) - "p" 8 bit conditional branch address (MIPS16OP_*_IMM8) - "q" 11 bit branch address (MIPS16OP_*_IMM11) - "A" 8 bit PC relative address * 4 (MIPS16OP_*_IMM8) - "B" 5 bit PC relative address * 8 (MIPS16OP_*_IMM5) - "E" 5 bit PC relative address * 4 (MIPS16OP_*_IMM5) - */ - -/* For the mips16, we use the same opcode table format and a few of - the same flags. However, most of the flags are different. */ - -/* Modifies the register in MIPS16OP_*_RX. */ -#define MIPS16_INSN_WRITE_X 0x00000001 -/* Modifies the register in MIPS16OP_*_RY. */ -#define MIPS16_INSN_WRITE_Y 0x00000002 -/* Modifies the register in MIPS16OP_*_RZ. */ -#define MIPS16_INSN_WRITE_Z 0x00000004 -/* Modifies the T ($24) register. */ -#define MIPS16_INSN_WRITE_T 0x00000008 -/* Modifies the SP ($29) register. */ -#define MIPS16_INSN_WRITE_SP 0x00000010 -/* Modifies the RA ($31) register. */ -#define MIPS16_INSN_WRITE_31 0x00000020 -/* Modifies the general purpose register in MIPS16OP_*_REG32R. */ -#define MIPS16_INSN_WRITE_GPR_Y 0x00000040 -/* Reads the register in MIPS16OP_*_RX. */ -#define MIPS16_INSN_READ_X 0x00000080 -/* Reads the register in MIPS16OP_*_RY. */ -#define MIPS16_INSN_READ_Y 0x00000100 -/* Reads the register in MIPS16OP_*_MOVE32Z. */ -#define MIPS16_INSN_READ_Z 0x00000200 -/* Reads the T ($24) register. */ -#define MIPS16_INSN_READ_T 0x00000400 -/* Reads the SP ($29) register. */ -#define MIPS16_INSN_READ_SP 0x00000800 -/* Reads the RA ($31) register. */ -#define MIPS16_INSN_READ_31 0x00001000 -/* Reads the program counter. */ -#define MIPS16_INSN_READ_PC 0x00002000 -/* Reads the general purpose register in MIPS16OP_*_REGR32. */ -#define MIPS16_INSN_READ_GPR_X 0x00004000 -/* Is a branch insn. */ -#define MIPS16_INSN_BRANCH 0x00010000 - -/* The following flags have the same value for the mips16 opcode - table: - INSN_UNCOND_BRANCH_DELAY - INSN_COND_BRANCH_DELAY - INSN_COND_BRANCH_LIKELY (never used) - INSN_READ_HI - INSN_READ_LO - INSN_WRITE_HI - INSN_WRITE_LO - INSN_TRAP - INSN_ISA3 - */ - -extern const struct mips_opcode mips16_opcodes[]; -extern const int bfd_mips16_num_opcodes; - -#endif /* _MIPS_H_ */ diff --git a/contrib/binutils/include/wait.h b/contrib/binutils/include/wait.h deleted file mode 100644 index fa3c9ccb1d7e..000000000000 --- a/contrib/binutils/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 - <sys/wait.h> 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/binutils/install.sh b/contrib/binutils/install.sh deleted file mode 100755 index 4b883b386de2..000000000000 --- a/contrib/binutils/install.sh +++ /dev/null @@ -1,247 +0,0 @@ -#!/bin/sh -# -# install - install a program, script, or datafile -# This comes from X11R5 (mit/util/scripts/install.sh). -# -# Copyright 1991 by the Massachusetts Institute of Technology -# -# Permission to use, copy, modify, distribute, and sell this software and its -# documentation for any purpose is hereby granted without fee, provided that -# the above copyright notice appear in all copies and that both that -# copyright notice and this permission notice appear in supporting -# documentation, and that the name of M.I.T. not be used in advertising or -# publicity pertaining to distribution of the software without specific, -# written prior permission. M.I.T. makes no representations about the -# suitability of this software for any purpose. It is provided "as is" -# without express or implied warranty. -# -# This script is compatible with the BSD install script, but was written -# from scratch. -# - - -# set DOITPROG to echo to test this script - -# Don't use :- since 4.3BSD and earlier shells don't like it. -doit="${DOITPROG-}" - - -# put in absolute paths if you don't have them in your path; or use env. vars. - -mvprog="${MVPROG-mv}" -cpprog="${CPPROG-cp}" -chmodprog="${CHMODPROG-chmod}" -chownprog="${CHOWNPROG-chown}" -chgrpprog="${CHGRPPROG-chgrp}" -stripprog="${STRIPPROG-strip}" -rmprog="${RMPROG-rm}" -mkdirprog="${MKDIRPROG-mkdir}" - -transformbasename="" -transform_arg="" -instcmd="$mvprog" -chmodcmd="$chmodprog 0755" -chowncmd="" -chgrpcmd="" -stripcmd="" -rmcmd="$rmprog -f" -mvcmd="$mvprog" -src="" -dst="" -dir_arg="" - -while [ x"$1" != x ]; do - case $1 in - -c) instcmd="$cpprog" - shift - continue;; - - -d) dir_arg=true - shift - continue;; - - -m) chmodcmd="$chmodprog $2" - shift - shift - continue;; - - -o) chowncmd="$chownprog $2" - shift - shift - continue;; - - -g) chgrpcmd="$chgrpprog $2" - shift - shift - continue;; - - -s) stripcmd="$stripprog" - shift - continue;; - - -t=*) transformarg=`echo $1 | sed 's/-t=//'` - shift - continue;; - - -b=*) transformbasename=`echo $1 | sed 's/-b=//'` - shift - continue;; - - *) if [ x"$src" = x ] - then - src=$1 - else - # this colon is to work around a 386BSD /bin/sh bug - : - dst=$1 - fi - shift - continue;; - esac -done - -if [ x"$src" = x ] -then - echo "install: no input file specified" - exit 1 -else - true -fi - -if [ x"$dir_arg" != x ]; then - dst=$src - src="" - - if [ -d $dst ]; then - instcmd=: - chmodcmd="" - else - instcmd=mkdir - fi -else - -# Waiting for this to be detected by the "$instcmd $src $dsttmp" command -# might cause directories to be created, which would be especially bad -# if $src (and thus $dsttmp) contains '*'. - - if [ -f $src -o -d $src ] - then - true - else - echo "install: $src does not exist" - exit 1 - fi - - if [ x"$dst" = x ] - then - echo "install: no destination specified" - exit 1 - else - true - fi - -# If destination is a directory, append the input filename; if your system -# does not like double slashes in filenames, you may need to add some logic - - if [ -d $dst ] - then - dst="$dst"/`basename $src` - else - true - fi -fi - -## this sed command emulates the dirname command -dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` - -# Make sure that the destination directory exists. -# this part is taken from Noah Friedman's mkinstalldirs script - -# Skip lots of stat calls in the usual case. -if [ ! -d "$dstdir" ]; then -defaultIFS=' -' -IFS="${IFS-${defaultIFS}}" - -oIFS="${IFS}" -# Some sh's can't handle IFS=/ for some reason. -IFS='%' -set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` -IFS="${oIFS}" - -pathcomp='' - -while [ $# -ne 0 ] ; do - pathcomp="${pathcomp}${1}" - shift - - if [ ! -d "${pathcomp}" ] ; - then - $mkdirprog "${pathcomp}" - else - true - fi - - pathcomp="${pathcomp}/" -done -fi - -if [ x"$dir_arg" != x ] -then - $doit $instcmd $dst && - - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi -else - -# If we're going to rename the final executable, determine the name now. - - if [ x"$transformarg" = x ] - then - dstfile=`basename $dst` - else - dstfile=`basename $dst $transformbasename | - sed $transformarg`$transformbasename - fi - -# don't allow the sed command to completely eliminate the filename - - if [ x"$dstfile" = x ] - then - dstfile=`basename $dst` - else - true - fi - -# Make a temp file name in the proper directory. - - dsttmp=$dstdir/#inst.$$# - -# Move or copy the file name to the temp name - - $doit $instcmd $src $dsttmp && - - trap "rm -f ${dsttmp}" 0 && - -# and set any options; do chmod last to preserve setuid bits - -# If any of these fail, we abort the whole thing. If we want to -# ignore errors from any of these, just make sure not to ignore -# errors from the above "$doit $instcmd $src $dsttmp" command. - - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && - -# Now rename the file to the real destination. - - $doit $rmcmd -f $dstdir/$dstfile && - $doit $mvcmd $dsttmp $dstdir/$dstfile - -fi && - - -exit 0 diff --git a/contrib/binutils/ld/acconfig.h b/contrib/binutils/ld/acconfig.h deleted file mode 100644 index c627d7faa97a..000000000000 --- a/contrib/binutils/ld/acconfig.h +++ /dev/null @@ -1,22 +0,0 @@ - -/* Name of package. */ -#undef PACKAGE - -/* Version of package. */ -#undef VERSION - -/* Whether strstr must be declared even if <string.h> is included. */ -#undef NEED_DECLARATION_STRSTR - -/* Whether free must be declared even if <stdlib.h> is included. */ -#undef NEED_DECLARATION_FREE - -/* Whether sbrk must be declared even if <unistd.h> is included. */ -#undef NEED_DECLARATION_SBRK - -/* Whether getenv must be declared even if <stdlib.h> is included. */ -#undef NEED_DECLARATION_GETENV -@TOP@ - -/* Do we need to use the b modifier when opening binary files? */ -#undef USE_BINARY_FOPEN diff --git a/contrib/binutils/ld/emulparams/arcelf.sh b/contrib/binutils/ld/emulparams/arcelf.sh deleted file mode 100644 index b1c9c1760cee..000000000000 --- a/contrib/binutils/ld/emulparams/arcelf.sh +++ /dev/null @@ -1,11 +0,0 @@ -SCRIPT_NAME=elf -OUTPUT_FORMAT="elf32-littlearc" -LITTLE_OUTPUT_FORMAT="elf32-littlearc" -BIG_OUTPUT_FORMAT="elf32-bigarc" -TEXT_START_ADDR=0x0 -MAXPAGESIZE=0x1000 -NONPAGED_TEXT_START_ADDR=0x0 -ARCH=arc -MACHINE= -ENTRY=start -#TEMPLATE_NAME=elf32 diff --git a/contrib/binutils/ld/emulparams/armelf_linux26.sh b/contrib/binutils/ld/emulparams/armelf_linux26.sh deleted file mode 100644 index 36d1b0ec5c7a..000000000000 --- a/contrib/binutils/ld/emulparams/armelf_linux26.sh +++ /dev/null @@ -1,20 +0,0 @@ -ARCH=arm -SCRIPT_NAME=elf -OUTPUT_FORMAT="elf32-littlearm" -BIG_OUTPUT_FORMAT="elf32-bigarm" -LITTLE_OUTPUT_FORMAT="elf32-littlearm" -MAXPAGESIZE=0x8000 -TEMPLATE_NAME=armelf -GENERATE_SHLIB_SCRIPT=yes - -DATA_START_SYMBOLS='__data_start = . ;'; -OTHER_BSS_SYMBOLS='__bss_start__ = .;' -OTHER_BSS_END_SYMBOLS='_bss_end__ = . ; __bss_end__ = . ; __end__ = . ;' - -# This needs to be high enough so that we can load ld.so below it, -# yet low enough to stay away from the mmap area at 0x01100000. -# Also, it is small enough so that relocs which are pointing -# at absolute 0 will still be fixed up. -# These values give us about 0.5MB for ld.so, 16.5MB for user -# programs, and 15MB for mmap which seems a reasonable compromise. -TEXT_START_ADDR=0x00080000 diff --git a/contrib/binutils/ld/emulparams/elf32bmip.sh b/contrib/binutils/ld/emulparams/elf32bmip.sh deleted file mode 100644 index 473c41169e00..000000000000 --- a/contrib/binutils/ld/emulparams/elf32bmip.sh +++ /dev/null @@ -1,30 +0,0 @@ -SCRIPT_NAME=elf -OUTPUT_FORMAT="elf32-bigmips" -BIG_OUTPUT_FORMAT="elf32-bigmips" -LITTLE_OUTPUT_FORMAT="elf32-littlemips" -TEXT_START_ADDR=0x0400000 -DATA_ADDR=0x10000000 -MAXPAGESIZE=0x40000 -NONPAGED_TEXT_START_ADDR=0x0400000 -SHLIB_TEXT_START_ADDR=0x5ffe0000 -TEXT_DYNAMIC= -INITIAL_READONLY_SECTIONS='.reginfo : { *(.reginfo) }' -OTHER_TEXT_SECTIONS='*(.mips16.fn.*) *(.mips16.call.*)' -OTHER_GOT_SYMBOLS=' - _gp = ALIGN(16) + 0x7ff0; -' -OTHER_GOT_SECTIONS=' - .lit8 : { *(.lit8) } - .lit4 : { *(.lit4) } -' -TEXT_START_SYMBOLS='_ftext = . ;' -DATA_START_SYMBOLS='_fdata = . ;' -OTHER_BSS_SYMBOLS='_fbss = .;' -OTHER_SECTIONS=' - .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) } - .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) } -' -ARCH=mips -MACHINE= -TEMPLATE_NAME=elf32 -GENERATE_SHLIB_SCRIPT=yes diff --git a/contrib/binutils/ld/emulparams/elf32bmipn32.sh b/contrib/binutils/ld/emulparams/elf32bmipn32.sh deleted file mode 100755 index 56f42a9b2964..000000000000 --- a/contrib/binutils/ld/emulparams/elf32bmipn32.sh +++ /dev/null @@ -1,75 +0,0 @@ -# This is an ELF platform. -SCRIPT_NAME=elf - -# Handle both big- and little-ended 32-bit MIPS objects. -ARCH=mips -OUTPUT_FORMAT="elf32-bigmips" -BIG_OUTPUT_FORMAT="elf32-bigmips" -LITTLE_OUTPUT_FORMAT="elf32-littlemips" - -TEMPLATE_NAME=elf32 - -TEXT_START_ADDR=0x10000000 -MAXPAGESIZE=0x100000 -ENTRY=__start - -# GOT-related settings. -OTHER_GOT_SYMBOLS=' - _gp = ALIGN(16) + 0x7ff0; -' -OTHER_GOT_SECTIONS=' - .lit8 : { *(.lit8) } - .lit4 : { *(.lit4) } - .srdata : { *(.srdata) } -' - -# Magic symbols. -TEXT_START_SYMBOLS='_ftext = . ;' -DATA_START_SYMBOLS='_fdata = . ;' -OTHER_BSS_SYMBOLS='_fbss = .;' -# IRIX6 defines these symbols. 0x34 is the size of the ELF header. -EXECUTABLE_SYMBOLS=" - __dso_displacement = 0; - __elf_header = ${TEXT_START_ADDR}; - __program_header_table = ${TEXT_START_ADDR} + 0x34; -" - -# There are often dynamic relocations against the .rodata section. -# Setting DT_TEXTREL in the .dynamic section does not convince the -# IRIX6 linker to permit relocations against the text segment. -# Following the IRIX linker, we simply put .rodata in the data -# segment. -WRITABLE_RODATA= - -OTHER_RELOCATING_SECTIONS=' - .MIPS.events.text : - { - *(.MIPS.events.text) - *(.MIPS.events.gnu.linkonce.t*) - } - .MIPS.content.text : - { - *(.MIPS.content.text) - *(.MIPS.content.gnu.linkonce.t*) - } - .MIPS.events.data : - { - *(.MIPS.events.data) - *(.MIPS.events.gnu.linkonce.d*) - } - .MIPS.content.data : - { - *(.MIPS.content.data) - *(.MIPS.content.gnu.linkonce.d*) - } - .MIPS.events.rodata : - { - *(.MIPS.events.rodata) - *(.MIPS.events.gnu.linkonce.r*) - } - .MIPS.content.rodata : - { - *(.MIPS.content.rodata) - *(.MIPS.content.gnu.linkonce.r*) - } -' diff --git a/contrib/binutils/ld/emulparams/elf32bsmip.sh b/contrib/binutils/ld/emulparams/elf32bsmip.sh deleted file mode 100755 index 09f130764370..000000000000 --- a/contrib/binutils/ld/emulparams/elf32bsmip.sh +++ /dev/null @@ -1,31 +0,0 @@ -SCRIPT_NAME=elf -OUTPUT_FORMAT="elf32-bigmips" -BIG_OUTPUT_FORMAT="elf32-bigmips" -LITTLE_OUTPUT_FORMAT="elf32-littlemips" -TEXT_START_ADDR=0x0400000 -DATA_ADDR=0x10000000 -MAXPAGESIZE=0x40000 -NONPAGED_TEXT_START_ADDR=0x0400000 -SHLIB_TEXT_START_ADDR=0x5ffe0000 -TEXT_DYNAMIC= -INITIAL_READONLY_SECTIONS='.reginfo : { *(.reginfo) }' -OTHER_TEXT_SECTIONS='*(.mips16.fn.*) *(.mips16.call.*)' -OTHER_GOT_SYMBOLS=' - _gp = ALIGN(16) + 0x7ff0; -' -OTHER_GOT_SECTIONS=' - .lit8 : { *(.lit8) } - .lit4 : { *(.lit4) } -' -TEXT_START_SYMBOLS='_ftext = . ;' -DATA_START_SYMBOLS='_fdata = . ;' -OTHER_BSS_SYMBOLS='_fbss = .;' -OTHER_SECTIONS=' - .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) } - .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) } -' -ARCH=mips -MACHINE= -TEMPLATE_NAME=elf32 -GENERATE_SHLIB_SCRIPT=yes -ENTRY=__start diff --git a/contrib/binutils/ld/emulparams/elf32ebmip.sh b/contrib/binutils/ld/emulparams/elf32ebmip.sh deleted file mode 100644 index 00ea8fd9c964..000000000000 --- a/contrib/binutils/ld/emulparams/elf32ebmip.sh +++ /dev/null @@ -1,28 +0,0 @@ -SCRIPT_NAME=elf -OUTPUT_FORMAT="elf32-bigmips" -BIG_OUTPUT_FORMAT="elf32-bigmips" -LITTLE_OUTPUT_FORMAT="elf32-littlemips" -TEXT_START_ADDR=0x0400000 -MAXPAGESIZE=0x40000 -NONPAGED_TEXT_START_ADDR=0x0400000 -SHLIB_TEXT_START_ADDR=0x5ffe0000 -OTHER_TEXT_SECTIONS='*(.mips16.fn.*) *(.mips16.call.*)' -OTHER_GOT_SYMBOLS=' - _gp = ALIGN(16) + 0x7ff0; -' -OTHER_GOT_SECTIONS=' - .lit8 : { *(.lit8) } - .lit4 : { *(.lit4) } -' -TEXT_START_SYMBOLS='_ftext = . ;' -DATA_START_SYMBOLS='_fdata = . ;' -OTHER_BSS_SYMBOLS='_fbss = .;' -OTHER_SECTIONS=' - .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) } - .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) } -' -ARCH=mips -MACHINE= -TEMPLATE_NAME=elf32 -GENERATE_SHLIB_SCRIPT=yes -EMBEDDED=yes diff --git a/contrib/binutils/ld/emulparams/elf32elmip.sh b/contrib/binutils/ld/emulparams/elf32elmip.sh deleted file mode 100644 index cf008c8f1173..000000000000 --- a/contrib/binutils/ld/emulparams/elf32elmip.sh +++ /dev/null @@ -1,28 +0,0 @@ -SCRIPT_NAME=elf -OUTPUT_FORMAT="elf32-littlemips" -BIG_OUTPUT_FORMAT="elf32-bigmips" -LITTLE_OUTPUT_FORMAT="elf32-littlemips" -TEXT_START_ADDR=0x0400000 -MAXPAGESIZE=0x40000 -NONPAGED_TEXT_START_ADDR=0x0400000 -SHLIB_TEXT_START_ADDR=0x5ffe0000 -OTHER_TEXT_SECTIONS='*(.mips16.fn.*) *(.mips16.call.*)' -OTHER_GOT_SYMBOLS=' - _gp = ALIGN(16) + 0x7ff0; -' -OTHER_GOT_SECTIONS=' - .lit8 : { *(.lit8) } - .lit4 : { *(.lit4) } -' -TEXT_START_SYMBOLS='_ftext = . ;' -DATA_START_SYMBOLS='_fdata = . ;' -OTHER_BSS_SYMBOLS='_fbss = .;' -OTHER_SECTIONS=' - .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) } - .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) } -' -ARCH=mips -MACHINE= -TEMPLATE_NAME=elf32 -GENERATE_SHLIB_SCRIPT=yes -EMBEDDED=yes diff --git a/contrib/binutils/ld/emulparams/elf32lmip.sh b/contrib/binutils/ld/emulparams/elf32lmip.sh deleted file mode 100644 index 23312f44acae..000000000000 --- a/contrib/binutils/ld/emulparams/elf32lmip.sh +++ /dev/null @@ -1,30 +0,0 @@ -SCRIPT_NAME=elf -OUTPUT_FORMAT="elf32-littlemips" -BIG_OUTPUT_FORMAT="elf32-bigmips" -LITTLE_OUTPUT_FORMAT="elf32-littlemips" -TEXT_START_ADDR=0x0400000 -DATA_ADDR=0x10000000 -MAXPAGESIZE=0x40000 -NONPAGED_TEXT_START_ADDR=0x0400000 -SHLIB_TEXT_START_ADDR=0x5ffe0000 -TEXT_DYNAMIC= -INITIAL_READONLY_SECTIONS='.reginfo : { *(.reginfo) }' -OTHER_TEXT_SECTIONS='*(.mips16.fn.*) *(.mips16.call.*)' -OTHER_GOT_SYMBOLS=' - _gp = ALIGN(16) + 0x7ff0; -' -OTHER_GOT_SECTIONS=' - .lit8 : { *(.lit8) } - .lit4 : { *(.lit4) } -' -TEXT_START_SYMBOLS='_ftext = . ;' -DATA_START_SYMBOLS='_fdata = . ;' -OTHER_BSS_SYMBOLS='_fbss = .;' -OTHER_SECTIONS=' - .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) } - .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) } -' -ARCH=mips -MACHINE= -TEMPLATE_NAME=elf32 -GENERATE_SHLIB_SCRIPT=yes diff --git a/contrib/binutils/ld/emulparams/elf32lsmip.sh b/contrib/binutils/ld/emulparams/elf32lsmip.sh deleted file mode 100755 index 4bdc8a10e698..000000000000 --- a/contrib/binutils/ld/emulparams/elf32lsmip.sh +++ /dev/null @@ -1,31 +0,0 @@ -SCRIPT_NAME=elf -OUTPUT_FORMAT="elf32-littlemips" -BIG_OUTPUT_FORMAT="elf32-bigmips" -LITTLE_OUTPUT_FORMAT="elf32-littlemips" -TEXT_START_ADDR=0x0400000 -DATA_ADDR=0x10000000 -MAXPAGESIZE=0x40000 -NONPAGED_TEXT_START_ADDR=0x0400000 -SHLIB_TEXT_START_ADDR=0x5ffe0000 -TEXT_DYNAMIC= -INITIAL_READONLY_SECTIONS='.reginfo : { *(.reginfo) }' -OTHER_TEXT_SECTIONS='*(.mips16.fn.*) *(.mips16.call.*)' -OTHER_GOT_SYMBOLS=' - _gp = ALIGN(16) + 0x7ff0; -' -OTHER_GOT_SECTIONS=' - .lit8 : { *(.lit8) } - .lit4 : { *(.lit4) } -' -TEXT_START_SYMBOLS='_ftext = . ;' -DATA_START_SYMBOLS='_fdata = . ;' -OTHER_BSS_SYMBOLS='_fbss = .;' -OTHER_SECTIONS=' - .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) } - .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) } -' -ARCH=mips -MACHINE= -TEMPLATE_NAME=elf32 -GENERATE_SHLIB_SCRIPT=yes -ENTRY=__start diff --git a/contrib/binutils/ld/emulparams/elf64bmip.sh b/contrib/binutils/ld/emulparams/elf64bmip.sh deleted file mode 100755 index a4852d53cf42..000000000000 --- a/contrib/binutils/ld/emulparams/elf64bmip.sh +++ /dev/null @@ -1,79 +0,0 @@ -# This is an ELF platform. -SCRIPT_NAME=elf - -# Handle both big- and little-ended 32-bit MIPS objects. -ARCH=mips -OUTPUT_FORMAT="elf64-bigmips" -BIG_OUTPUT_FORMAT="elf64-bigmips" -LITTLE_OUTPUT_FORMAT="elf64-littlemips" - -# Note that the elf32 template is used for 64-bit emulations as well -# as 32-bit emulations. -ELFSIZE=64 -TEMPLATE_NAME=elf32 - -TEXT_START_ADDR=0x10000000 -MAXPAGESIZE=0x100000 -ENTRY=__start - -# GOT-related settings. -OTHER_GOT_SYMBOLS=' - _gp = ALIGN(16) + 0x7ff0; -' -OTHER_GOT_SECTIONS=' - .lit8 : { *(.lit8) } - .lit4 : { *(.lit4) } - .srdata : { *(.srdata) } -' - -# Magic symbols. -TEXT_START_SYMBOLS='_ftext = . ;' -DATA_START_SYMBOLS='_fdata = . ;' -OTHER_BSS_SYMBOLS='_fbss = .;' -# IRIX6 defines these symbols. 0x40 is the size of the ELF header. -EXECUTABLE_SYMBOLS=" - __dso_displacement = 0; - __elf_header = ${TEXT_START_ADDR}; - __program_header_table = ${TEXT_START_ADDR} + 0x40; -" - -# There are often dynamic relocations against the .rodata section. -# Setting DT_TEXTREL in the .dynamic section does not convince the -# IRIX6 linker to permit relocations against the text segment. -# Following the IRIX linker, we simply put .rodata in the data -# segment. -WRITABLE_RODATA= - - -OTHER_RELOCATING_SECTIONS=' - .MIPS.events.text : - { - *(.MIPS.events.text) - *(.MIPS.events.gnu.linkonce.t*) - } - .MIPS.content.text : - { - *(.MIPS.content.text) - *(.MIPS.content.gnu.linkonce.t*) - } - .MIPS.events.data : - { - *(.MIPS.events.data) - *(.MIPS.events.gnu.linkonce.d*) - } - .MIPS.content.data : - { - *(.MIPS.content.data) - *(.MIPS.content.gnu.linkonce.d*) - } - .MIPS.events.rodata : - { - *(.MIPS.events.rodata) - *(.MIPS.events.gnu.linkonce.r*) - } - .MIPS.content.rodata : - { - *(.MIPS.content.rodata) - *(.MIPS.content.gnu.linkonce.r*) - } -' diff --git a/contrib/binutils/ld/emulparams/sh.sh b/contrib/binutils/ld/emulparams/sh.sh deleted file mode 100644 index 38844fb18ee0..000000000000 --- a/contrib/binutils/ld/emulparams/sh.sh +++ /dev/null @@ -1,5 +0,0 @@ -SCRIPT_NAME=sh -OUTPUT_FORMAT="coff-sh" -TEXT_START_ADDR=0x8000 -TARGET_PAGE_SIZE=128 -ARCH=sh diff --git a/contrib/binutils/ld/emulparams/shl.sh b/contrib/binutils/ld/emulparams/shl.sh deleted file mode 100644 index 360aac8905c1..000000000000 --- a/contrib/binutils/ld/emulparams/shl.sh +++ /dev/null @@ -1,5 +0,0 @@ -SCRIPT_NAME=sh -OUTPUT_FORMAT="coff-shl" -TEXT_START_ADDR=0x8000 -TARGET_PAGE_SIZE=128 -ARCH=sh diff --git a/contrib/binutils/ld/emulparams/shlelf.sh b/contrib/binutils/ld/emulparams/shlelf.sh deleted file mode 100755 index bb27f86af6cc..000000000000 --- a/contrib/binutils/ld/emulparams/shlelf.sh +++ /dev/null @@ -1,17 +0,0 @@ -SCRIPT_NAME=elf -OUTPUT_FORMAT="elf32-shl" -TEXT_START_ADDR=0x1000 -MAXPAGESIZE=128 -ARCH=sh -MACHINE= -TEMPLATE_NAME=elf32 -GENERATE_SHLIB_SCRIPT=yes -EMBEDDED=yes - -# These are for compatibility with the COFF toolchain. -ENTRY=start -CTOR_START='___ctors = .;' -CTOR_END='___ctors_end = .;' -DTOR_START='___dtors = .;' -DTOR_END='___dtors_end = .;' -OTHER_RELOCATING_SECTIONS='.stack 0x30000 : { _stack = .; *(.stack) }' diff --git a/contrib/binutils/ld/emultempl/stringify.sed b/contrib/binutils/ld/emultempl/stringify.sed deleted file mode 100644 index a526d3ffc4c5..000000000000 --- a/contrib/binutils/ld/emultempl/stringify.sed +++ /dev/null @@ -1,4 +0,0 @@ -s/["\\]/\\&/g -s/$/\\n\\/ -1 s/^/"/ -$ s/$/n"/ diff --git a/contrib/binutils/ld/scripttempl/elfppc.sc b/contrib/binutils/ld/scripttempl/elfppc.sc deleted file mode 100644 index ddab8f80f814..000000000000 --- a/contrib/binutils/ld/scripttempl/elfppc.sc +++ /dev/null @@ -1,288 +0,0 @@ -# -# Unusual variables checked by this code: -# NOP - two byte opcode for no-op (defaults to 0) -# DATA_ADDR - if end-of-text-plus-one-page isn't right for data start -# OTHER_READONLY_SECTIONS - other than .text .init .rodata ... -# (e.g., .PARISC.milli) -# OTHER_READWRITE_SECTIONS - other than .data .bss .ctors .sdata ... -# (e.g., .PARISC.global) -# OTHER_SECTIONS - at the end -# EXECUTABLE_SYMBOLS - symbols that must be defined for an -# executable (e.g., _DYNAMIC_LINK) -# TEXT_START_SYMBOLS - symbols that appear at the start of the -# .text section. -# DATA_START_SYMBOLS - symbols that appear at the start of the -# .data section. -# OTHER_BSS_SYMBOLS - symbols that appear at the start of the -# .bss section besides __bss_start. -# -# When adding sections, do note that the names of some sections are used -# when specifying the start address of the next. -# -test -z "$ENTRY" && ENTRY=_start -test -z "${BIG_OUTPUT_FORMAT}" && BIG_OUTPUT_FORMAT=${OUTPUT_FORMAT} -test -z "${LITTLE_OUTPUT_FORMAT}" && LITTLE_OUTPUT_FORMAT=${OUTPUT_FORMAT} -test "$LD_FLAG" = "N" && DATA_ADDR=. -SBSS2=".sbss2 ${RELOCATING-0} : { *(.sbss2) }" -SDATA2=".sdata2 ${RELOCATING-0} : { *(.sdata2) }" -INTERP=".interp ${RELOCATING-0} : { *(.interp) }" -PLT=".plt ${RELOCATING-0} : { *(.plt) }" -CTOR=".ctors ${CONSTRUCTING-0} : - { - ${CONSTRUCTING+${CTOR_START}} - /* gcc uses crtbegin.o to find the start of - the constructors, so we make sure it is - first. Because this is a wildcard, it - doesn't matter if the user does not - actually link against crtbegin.o; the - linker won't look for a file to match a - wildcard. The wildcard also means that it - doesn't matter which directory crtbegin.o - is in. */ - - KEEP (*crtbegin.o(.ctors)) - - /* We don't want to include the .ctor section from - from the crtend.o file until after the sorted ctors. - The .ctor section from the crtend file contains the - end of ctors marker and it must be last */ - - KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) - KEEP (*(SORT(.ctors.*))) - KEEP (*(.ctors)) - ${CONSTRUCTING+${CTOR_END}} - }" - -DTOR=" .dtors ${CONSTRUCTING-0} : - { - ${CONSTRUCTING+${DTOR_START}} - KEEP (*crtbegin.o(.dtors)) - KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) - KEEP (*(SORT(.dtors.*))) - KEEP (*(.dtors)) - ${CONSTRUCTING+${DTOR_END}} - }" - -cat <<EOF -OUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}", - "${LITTLE_OUTPUT_FORMAT}") -OUTPUT_ARCH(${ARCH}) -ENTRY(${ENTRY}) - -${RELOCATING+${LIB_SEARCH_DIRS}} -${RELOCATING+/* Do we need any of these for elf? - __DYNAMIC = 0; ${STACKZERO+${STACKZERO}} ${SHLIB_PATH+${SHLIB_PATH}} */} -${RELOCATING+${EXECUTABLE_SYMBOLS}} -${RELOCATING- /* For some reason, the Solaris linker makes bad executables - if gld -r is used and the intermediate file has sections starting - at non-zero addresses. Could be a Solaris ld bug, could be a GNU ld - bug. But for now assigning the zero vmas works. */} - -${RELOCATING+PROVIDE (__stack = 0);} -${RELOCATING+PROVIDE (___stack = 0);} -SECTIONS -{ - /* Read-only sections, merged into text segment: */ - ${CREATE_SHLIB-${RELOCATING+. = ${TEXT_START_ADDR} + SIZEOF_HEADERS;}} - ${CREATE_SHLIB+${RELOCATING+. = SIZEOF_HEADERS;}} - ${CREATE_SHLIB-${INTERP}} - .hash ${RELOCATING-0} : { *(.hash) } - .dynsym ${RELOCATING-0} : { *(.dynsym) } - .dynstr ${RELOCATING-0} : { *(.dynstr) } - .gnu.version ${RELOCATING-0} : { *(.gnu.version) } - .gnu.version_d ${RELOCATING-0} : { *(.gnu.version_d) } - .gnu.version_r ${RELOCATING-0} : { *(.gnu.version_r) } - .rela.text ${RELOCATING-0} : - { - *(.rela.text) - ${RELOCATING+*(.rela.text.*)} - ${RELOCATING+*(.rela.gnu.linkonce.t*)} - } - .rela.data ${RELOCATING-0} : - { - *(.rela.data) - ${RELOCATING+*(.rela.data.*)} - ${RELOCATING+*(.rela.gnu.linkonce.d*)} - } - .rela.rodata ${RELOCATING-0} : - { - *(.rela.rodata) - ${RELOCATING+*(.rela.rodata.*)} - ${RELOCATING+*(.rela.gnu.linkonce.r*)} - } - .rela.got ${RELOCATING-0} : { *(.rela.got) } - .rela.got1 ${RELOCATING-0} : { *(.rela.got1) } - .rela.got2 ${RELOCATING-0} : { *(.rela.got2) } - .rela.ctors ${RELOCATING-0} : { *(.rela.ctors) } - .rela.dtors ${RELOCATING-0} : { *(.rela.dtors) } - .rela.init ${RELOCATING-0} : { *(.rela.init) } - .rela.fini ${RELOCATING-0} : { *(.rela.fini) } - .rela.bss ${RELOCATING-0} : { *(.rela.bss) } - .rela.plt ${RELOCATING-0} : { *(.rela.plt) } - .rela.sdata ${RELOCATING-0} : { *(.rela.sdata) } - .rela.sbss ${RELOCATING-0} : { *(.rela.sbss) } - .rela.sdata2 ${RELOCATING-0} : { *(.rela.sdata2) } - .rela.sbss2 ${RELOCATING-0} : { *(.rela.sbss2) } - .text ${RELOCATING-0} : - { - ${RELOCATING+${TEXT_START_SYMBOLS}} - *(.text) - ${RELOCATING+*(.text.*)} - /* .gnu.warning sections are handled specially by elf32.em. */ - *(.gnu.warning) - ${RELOCATING+*(.gnu.linkonce.t*)} - } =${NOP-0} - .init ${RELOCATING-0} : { KEEP (*(.init)) } =${NOP-0} - .fini ${RELOCATING-0} : { KEEP (*(.fini)) } =${NOP-0} - .rodata ${RELOCATING-0} : - { - *(.rodata) - ${RELOCATING+*(.rodata.*)} - ${RELOCATING+*(.gnu.linkonce.r*)} - } - .rodata1 ${RELOCATING-0} : { *(.rodata1) } - ${RELOCATING+_etext = .;} - ${RELOCATING+PROVIDE (etext = .);} - ${RELOCATING+PROVIDE (__etext = .);} - ${CREATE_SHLIB-${SDATA2}} - ${CREATE_SHLIB-${SBSS2}} - ${RELOCATING+${OTHER_READONLY_SECTIONS}} - - /* Adjust the address for the data segment. We want to adjust up to - the same address within the page on the next page up. It would - be more correct to do this: - ${RELOCATING+. = ${DATA_ADDR-ALIGN(${MAXPAGESIZE}) + (ALIGN(8) & (${MAXPAGESIZE} - 1))};} - The current expression does not correctly handle the case of a - text segment ending precisely at the end of a page; it causes the - data segment to skip a page. The above expression does not have - this problem, but it will currently (2/95) cause BFD to allocate - a single segment, combining both text and data, for this case. - This will prevent the text segment from being shared among - multiple executions of the program; I think that is more - important than losing a page of the virtual address space (note - that no actual memory is lost; the page which is skipped can not - be referenced). */ - ${RELOCATING+. = ${DATA_ADDR- ALIGN(8) + ${MAXPAGESIZE}};} - - .data ${RELOCATING-0} : - { - ${RELOCATING+${DATA_START_SYMBOLS}} - *(.data) - ${RELOCATING+*(.data.*)} - ${RELOCATING+*(.gnu.linkonce.d*)} - ${CONSTRUCTING+CONSTRUCTORS} - } - .data1 ${RELOCATING-0} : { *(.data1) } - ${RELOCATING+${OTHER_READWRITE_SECTIONS}} - - .got1 ${RELOCATING-0} : { *(.got1) } - .dynamic ${RELOCATING-0} : { *(.dynamic) } - - /* Put .ctors and .dtors next to the .got2 section, so that the pointers - get relocated with -mrelocatable. Also put in the .fixup pointers. - The current compiler no longer needs this, but keep it around for 2.7.2 */ - - ${RELOCATING+PROVIDE (_GOT2_START_ = .);} - ${RELOCATING+PROVIDE (__GOT2_START_ = .);} - .got2 ${RELOCATING-0} : { *(.got2) } - - ${RELOCATING+PROVIDE (__CTOR_LIST__ = .);} - ${RELOCATING+PROVIDE (___CTOR_LIST__ = .);} - ${RELOCATING+${CTOR}} - ${RELOCATING+PROVIDE (__CTOR_END__ = .);} - ${RELOCATING+PROVIDE (___CTOR_END__ = .);} - - ${RELOCATING+PROVIDE (__DTOR_LIST__ = .);} - ${RELOCATING+PROVIDE (___DTOR_LIST__ = .);} - ${RELOCATING+${DTOR}} - ${RELOCATING+PROVIDE (__DTOR_END__ = .);} - ${RELOCATING+PROVIDE (___DTOR_END__ = .);} - - ${RELOCATING+PROVIDE (_FIXUP_START_ = .);} - ${RELOCATING+PROVIDE (__FIXUP_START_ = .);} - .fixup ${RELOCATING-0} : { *(.fixup) } - ${RELOCATING+PROVIDE (_FIXUP_END_ = .);} - ${RELOCATING+PROVIDE (__FIXUP_END_ = .);} - ${RELOCATING+PROVIDE (_GOT2_END_ = .);} - ${RELOCATING+PROVIDE (__GOT2_END_ = .);} - - ${RELOCATING+PROVIDE (_GOT_START_ = .);} - ${RELOCATING+PROVIDE (__GOT_START_ = .);} - .got ${RELOCATING-0} : { *(.got) } - .got.plt ${RELOCATING-0} : { *(.got.plt) } - ${CREATE_SHLIB+${SDATA2}} - ${CREATE_SHLIB+${SBSS2}} - ${RELOCATING+PROVIDE (_GOT_END_ = .);} - ${RELOCATING+PROVIDE (__GOT_END_ = .);} - - /* We want the small data sections together, so single-instruction offsets - can access them all, and initialized data all before uninitialized, so - we can shorten the on-disk segment size. */ - .sdata ${RELOCATING-0} : { *(.sdata) } - ${RELOCATING+_edata = .;} - ${RELOCATING+PROVIDE (edata = .);} - ${RELOCATING+PROVIDE (__edata = .);} - .sbss ${RELOCATING-0} : - { - ${RELOCATING+PROVIDE (__sbss_start = .);} - ${RELOCATING+PROVIDE (___sbss_start = .);} - *(.sbss) - *(.scommon) - *(.dynsbss) - ${RELOCATING+PROVIDE (__sbss_end = .);} - ${RELOCATING+PROVIDE (___sbss_end = .);} - } - ${PLT} - .bss ${RELOCATING-0} : - { - ${RELOCATING+${OTHER_BSS_SYMBOLS}} - ${RELOCATING+PROVIDE (__bss_start = .);} - ${RELOCATING+PROVIDE (___bss_start = .);} - *(.dynbss) - *(.bss) - *(COMMON) - } - ${RELOCATING+_end = . ;} - ${RELOCATING+PROVIDE (end = .);} - ${RELOCATING+PROVIDE (__end = .);} - - /* These are needed for ELF backends which have not yet been - converted to the new style linker. */ - .stab 0 : { *(.stab) } - .stabstr 0 : { *(.stabstr) } - - /* DWARF debug sections. - Symbols in the DWARF debugging sections are relative to the beginning - of the section so we begin them at 0. */ - - /* DWARF 1 */ - .debug 0 : { *(.debug) } - .line 0 : { *(.line) } - - /* GNU DWARF 1 extensions */ - .debug_srcinfo 0 : { *(.debug_srcinfo) } - .debug_sfnames 0 : { *(.debug_sfnames) } - - /* DWARF 1.1 and DWARF 2 */ - .debug_aranges 0 : { *(.debug_aranges) } - .debug_pubnames 0 : { *(.debug_pubnames) } - - /* DWARF 2 */ - .debug_info 0 : { *(.debug_info) } - .debug_abbrev 0 : { *(.debug_abbrev) } - .debug_line 0 : { *(.debug_line) } - .debug_frame 0 : { *(.debug_frame) } - .debug_str 0 : { *(.debug_str) } - .debug_loc 0 : { *(.debug_loc) } - .debug_macinfo 0 : { *(.debug_macinfo) } - - /* SGI/MIPS DWARF 2 extensions */ - .debug_weaknames 0 : { *(.debug_weaknames) } - .debug_funcnames 0 : { *(.debug_funcnames) } - .debug_typenames 0 : { *(.debug_typenames) } - .debug_varnames 0 : { *(.debug_varnames) } - - /* These must appear regardless of ${RELOCATING}. */ - ${OTHER_SECTIONS} -} -EOF diff --git a/contrib/binutils/ld/scripttempl/sh.sc b/contrib/binutils/ld/scripttempl/sh.sc deleted file mode 100644 index 036dd216db2f..000000000000 --- a/contrib/binutils/ld/scripttempl/sh.sc +++ /dev/null @@ -1,59 +0,0 @@ -TORS=".tors : - { - ___ctors = . ; - *(.ctors) - ___ctors_end = . ; - ___dtors = . ; - *(.dtors) - ___dtors_end = . ; - } > ram" - -cat <<EOF -OUTPUT_FORMAT("${OUTPUT_FORMAT}") -OUTPUT_ARCH(${ARCH}) - -MEMORY -{ - ram : o = 0x1000, l = 512k -} - -SECTIONS -{ - .text : - { - *(.text) - *(.strings) - ${RELOCATING+ _etext = . ; } - } ${RELOCATING+ > ram} - ${CONSTRUCTING+${TORS}} - .data : - { - *(.data) - ${RELOCATING+ _edata = . ; } - } ${RELOCATING+ > ram} - .bss : - { - ${RELOCATING+ _bss_start = . ; } - *(.bss) - *(COMMON) - ${RELOCATING+ _end = . ; } - } ${RELOCATING+ > ram} - .stack ${RELOCATING+ 0x30000 } : - { - ${RELOCATING+ _stack = . ; } - *(.stack) - } ${RELOCATING+ > ram} - .stab 0 ${RELOCATING+(NOLOAD)} : - { - *(.stab) - } - .stabstr 0 ${RELOCATING+(NOLOAD)} : - { - *(.stabstr) - } -} -EOF - - - - diff --git a/contrib/binutils/libiberty/acconfig.h b/contrib/binutils/libiberty/acconfig.h deleted file mode 100644 index f7c599df7ac6..000000000000 --- a/contrib/binutils/libiberty/acconfig.h +++ /dev/null @@ -1,11 +0,0 @@ -/* Define if you have the sys_errlist variable. */ -#undef HAVE_SYS_ERRLIST - -/* Define if you have the sys_nerr variable. */ -#undef HAVE_SYS_NERR - -/* Define if you have the sys_siglist variable. */ -#undef HAVE_SYS_SIGLIST - -/* Define if you have the strerror function. */ -#undef HAVE_STRERROR diff --git a/contrib/binutils/libiberty/alloca-botch.h b/contrib/binutils/libiberty/alloca-botch.h deleted file mode 100644 index c909573f58c6..000000000000 --- a/contrib/binutils/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/binutils/libiberty/alloca-norm.h b/contrib/binutils/libiberty/alloca-norm.h deleted file mode 100644 index bda4fc049adf..000000000000 --- a/contrib/binutils/libiberty/alloca-norm.h +++ /dev/null @@ -1,25 +0,0 @@ -/* "Normal" configuration for alloca. */ - -#ifdef __GNUC__ -#ifndef alloca -#define alloca __builtin_alloca -#endif -#else /* ! defined (__GNUC__) */ -#if defined (sparc) && defined (sun) -#include <alloca.h> -#ifdef __STDC__ -extern void *__builtin_alloca(); -#else /* ! defined (__STDC__) */ -extern char *__builtin_alloca(); /* Stupid include file doesn't declare it */ -#endif /* ! defined (__STDC__) */ -#else /* ! defined (sparc) || ! defined (sun) */ -#ifdef __STDC__ -PTR alloca (size_t); -#else /* ! defined (__STDC__) */ -PTR alloca (); /* must agree with functions.def */ -#endif /* ! defined (__STDC__) */ -#endif /* ! defined (sparc) || ! defined (sun) */ -#ifdef _WIN32 -#include <malloc.h> -#endif -#endif /* ! defined (__GNUC__) */ diff --git a/contrib/binutils/libiberty/config/mh-sysv b/contrib/binutils/libiberty/config/mh-sysv deleted file mode 100644 index eb102d550108..000000000000 --- a/contrib/binutils/libiberty/config/mh-sysv +++ /dev/null @@ -1 +0,0 @@ -RANLIB=true diff --git a/contrib/binutils/libiberty/config/mh-sysv4 b/contrib/binutils/libiberty/config/mh-sysv4 deleted file mode 100644 index 4d1aa3cd61d5..000000000000 --- a/contrib/binutils/libiberty/config/mh-sysv4 +++ /dev/null @@ -1,3 +0,0 @@ -HDEFINES = -DHAVE_SYSCONF -RANLIB=true -INSTALL = cp diff --git a/contrib/binutils/libiberty/config/mt-mingw32 b/contrib/binutils/libiberty/config/mt-mingw32 deleted file mode 100644 index 2fb17d783d03..000000000000 --- a/contrib/binutils/libiberty/config/mt-mingw32 +++ /dev/null @@ -1,27 +0,0 @@ -# Mingw32 target Makefile fragment. -# The autoconfiguration fails for a Mingw32 target, because of an -# incompatible definition of sys_errlist, which is imported from a DLL. -# Therefore, we compute the dependencies by hand. - -HDEFINES = -DNO_SYS_PARAM_H -DNO_SYS_FILE_H -CONFIG_H = mgconfig.h -NEEDED_LIST = mgneeded-list - -mgconfig.h: Makefile - if [ -f ../newlib/Makefile ]; then \ - $(MAKE) $(FLAGS_TO_PASS) xconfig.h; \ - cp xconfig.h mgconfig.h; \ - else \ - echo "#define NEED_sys_siglist 1" >>mgconfig.h; \ - echo "#define NEED_strsignal 1" >>mgconfig.h; \ - echo "#define NEED_psignal 1" >>mgconfig.h; \ - echo "#define NEED_basename 1" >>mgconfig.h; \ - fi - -mgneeded-list: Makefile - if [ -f ../newlib/Makefile ]; then \ - $(MAKE) $(FLAGS_TO_PASS) xneeded-list; \ - cp xneeded-list mgneeded-list; \ - else \ - echo getopt.o vasprintf.o >mgneeded-list; \ - fi diff --git a/contrib/binutils/libiberty/dummy.c b/contrib/binutils/libiberty/dummy.c deleted file mode 100644 index 08da647e30eb..000000000000 --- a/contrib/binutils/libiberty/dummy.c +++ /dev/null @@ -1,49 +0,0 @@ -#include <ansidecl.h> - -#ifdef __STDC__ -#include <stddef.h> -#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/binutils/libiberty/functions.def b/contrib/binutils/libiberty/functions.def deleted file mode 100644 index 0f13f107868e..000000000000 --- a/contrib/binutils/libiberty/functions.def +++ /dev/null @@ -1,70 +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(asprintf, int, (), NOTHING) -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 ) -DEF(vasprintf, int, (), NOTHING) - -/* List of global variables that we want to look for in the host - environment, and to generate an entry NEED_<variable> 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_<funcname> in config.h - if they are not found. */ - -DEFFUNC(strerror, char*, (errnoval), int errnoval) -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) -DEFFUNC(strsignal, const char *, (signo), int signo) diff --git a/contrib/binutils/opcodes/acconfig.h b/contrib/binutils/opcodes/acconfig.h deleted file mode 100644 index ef2f4966c1bd..000000000000 --- a/contrib/binutils/opcodes/acconfig.h +++ /dev/null @@ -1,6 +0,0 @@ - -/* Name of package. */ -#undef PACKAGE - -/* Version of package. */ -#undef VERSION diff --git a/contrib/binutils/opcodes/arc-dis.c b/contrib/binutils/opcodes/arc-dis.c deleted file mode 100644 index 03f13795275e..000000000000 --- a/contrib/binutils/opcodes/arc-dis.c +++ /dev/null @@ -1,268 +0,0 @@ -/* Instruction printing code for the ARC. - Copyright (C) 1994, 1995, 1997, 1998 Free Software Foundation, Inc. - Contributed by Doug Evans (dje@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. */ - -#include "sysdep.h" -#include "dis-asm.h" -#include "opcode/arc.h" -#include "elf-bfd.h" -#include "elf/arc.h" -#include "opintl.h" - -static int print_insn_arc_base_little PARAMS ((bfd_vma, disassemble_info *)); -static int print_insn_arc_base_big PARAMS ((bfd_vma, disassemble_info *)); - -static int print_insn PARAMS ((bfd_vma, disassemble_info *, int, int)); - -/* Print one instruction from PC on INFO->STREAM. - Return the size of the instruction (4 or 8 for the ARC). */ - -static int -print_insn (pc, info, mach, big_p) - bfd_vma pc; - disassemble_info *info; - int mach; - int big_p; -{ - const struct arc_opcode *opcode; - bfd_byte buffer[4]; - void *stream = info->stream; - fprintf_ftype func = info->fprintf_func; - int status; - /* First element is insn, second element is limm (if present). */ - arc_insn insn[2]; - int got_limm_p = 0; - static int initialized = 0; - static int current_mach = 0; - - if (!initialized || mach != current_mach) - { - initialized = 1; - current_mach = arc_get_opcode_mach (mach, big_p); - arc_opcode_init_tables (current_mach); - } - - status = (*info->read_memory_func) (pc, buffer, 4, info); - if (status != 0) - { - (*info->memory_error_func) (status, pc, info); - return -1; - } - if (big_p) - insn[0] = bfd_getb32 (buffer); - else - insn[0] = bfd_getl32 (buffer); - - (*func) (stream, "%08lx\t", insn[0]); - - /* The instructions are stored in lists hashed by the insn code - (though we needn't care how they're hashed). */ - - opcode = arc_opcode_lookup_dis (insn[0]); - for ( ; opcode != NULL; opcode = ARC_OPCODE_NEXT_DIS (opcode)) - { - char *syn; - int mods,invalid; - long value; - const struct arc_operand *operand; - const struct arc_operand_value *opval; - - /* Basic bit mask must be correct. */ - if ((insn[0] & opcode->mask) != opcode->value) - continue; - - /* Supported by this cpu? */ - if (! arc_opcode_supported (opcode)) - continue; - - /* Make two passes over the operands. First see if any of them - have extraction functions, and, if they do, make sure the - instruction is valid. */ - - arc_opcode_init_extract (); - invalid = 0; - - /* ??? Granted, this is slower than the `ppc' way. Maybe when this is - done it'll be clear what the right way to do this is. */ - /* Instructions like "add.f r0,r1,1" are tricky because the ".f" gets - printed first, but we don't know how to print it until we've processed - the regs. Since we're scanning all the args before printing the insn - anyways, it's actually quite easy. */ - - for (syn = opcode->syntax; *syn; ++syn) - { - int c; - - if (*syn != '%' || *++syn == '%') - continue; - mods = 0; - c = *syn; - while (ARC_MOD_P (arc_operands[arc_operand_map[c]].flags)) - { - mods |= arc_operands[arc_operand_map[c]].flags & ARC_MOD_BITS; - ++syn; - c = *syn; - } - operand = arc_operands + arc_operand_map[c]; - if (operand->extract) - (*operand->extract) (insn, operand, mods, - (const struct arc_operand_value **) NULL, - &invalid); - } - if (invalid) - continue; - - /* The instruction is valid. */ - - /* If we have an insn with a limm, fetch it now. Scanning the insns - twice lets us do this. */ - if (arc_opcode_limm_p (NULL)) - { - status = (*info->read_memory_func) (pc + 4, buffer, 4, info); - if (status != 0) - { - (*info->memory_error_func) (status, pc, info); - return -1; - } - if (big_p) - insn[1] = bfd_getb32 (buffer); - else - insn[1] = bfd_getl32 (buffer); - got_limm_p = 1; - } - - for (syn = opcode->syntax; *syn; ++syn) - { - int c; - - if (*syn != '%' || *++syn == '%') - { - (*func) (stream, "%c", *syn); - continue; - } - - /* We have an operand. Fetch any special modifiers. */ - mods = 0; - c = *syn; - while (ARC_MOD_P (arc_operands[arc_operand_map[c]].flags)) - { - mods |= arc_operands[arc_operand_map[c]].flags & ARC_MOD_BITS; - ++syn; - c = *syn; - } - operand = arc_operands + arc_operand_map[c]; - - /* Extract the value from the instruction. */ - opval = NULL; - if (operand->extract) - { - value = (*operand->extract) (insn, operand, mods, - &opval, (int *) NULL); - } - else - { - value = (insn[0] >> operand->shift) & ((1 << operand->bits) - 1); - if ((operand->flags & ARC_OPERAND_SIGNED) - && (value & (1 << (operand->bits - 1)))) - value -= 1 << operand->bits; - - /* If this is a suffix operand, set `opval'. */ - if (operand->flags & ARC_OPERAND_SUFFIX) - opval = arc_opcode_lookup_suffix (operand, value); - } - - /* Print the operand as directed by the flags. */ - if (operand->flags & ARC_OPERAND_FAKE) - ; /* nothing to do (??? at least not yet) */ - else if (operand->flags & ARC_OPERAND_SUFFIX) - { - /* Default suffixes aren't printed. Fortunately, they all have - zero values. Also, zero values for boolean suffixes are - represented by the absence of text. */ - - if (value != 0) - { - /* ??? OPVAL should have a value. If it doesn't just cope - as we want disassembly to be reasonably robust. - Also remember that several condition code values (16-31) - aren't defined yet. For these cases just print the - number suitably decorated. */ - if (opval) - (*func) (stream, "%s%s", - mods & ARC_MOD_DOT ? "." : "", - opval->name); - else - (*func) (stream, "%s%c%d", - mods & ARC_MOD_DOT ? "." : "", - operand->fmt, value); - } - } - else if (operand->flags & ARC_OPERAND_RELATIVE_BRANCH) - (*info->print_address_func) (pc + 4 + value, info); - /* ??? Not all cases of this are currently caught. */ - else if (operand->flags & ARC_OPERAND_ABSOLUTE_BRANCH) - (*info->print_address_func) ((bfd_vma) value & 0xffffffff, info); - else if (operand->flags & ARC_OPERAND_ADDRESS) - (*info->print_address_func) ((bfd_vma) value & 0xffffffff, info); - else if (opval) - /* Note that this case catches both normal and auxiliary regs. */ - (*func) (stream, "%s", opval->name); - else - (*func) (stream, "%ld", value); - } - - /* We have found and printed an instruction; return. */ - return got_limm_p ? 8 : 4; - } - - (*func) (stream, _("*unknown*")); - return 4; -} - -/* Given MACH, one of bfd_mach_arc_xxx, return the print_insn function to use. - This does things a non-standard way (the "standard" way would be to copy - this code into disassemble.c). Since there are more than a couple of - variants, hiding all this crud here seems cleaner. */ - -disassembler_ftype -arc_get_disassembler (mach, big_p) - int mach; - int big_p; -{ - switch (mach) - { - case bfd_mach_arc_base: - return big_p ? print_insn_arc_base_big : print_insn_arc_base_little; - } - return print_insn_arc_base_little; -} - -static int -print_insn_arc_base_little (pc, info) - bfd_vma pc; - disassemble_info *info; -{ - return print_insn (pc, info, bfd_mach_arc_base, 0); -} - -static int -print_insn_arc_base_big (pc, info) - bfd_vma pc; - disassemble_info *info; -{ - return print_insn (pc, info, bfd_mach_arc_base, 1); -} diff --git a/contrib/binutils/opcodes/arc-opc.c b/contrib/binutils/opcodes/arc-opc.c deleted file mode 100644 index f17ffc086fe9..000000000000 --- a/contrib/binutils/opcodes/arc-opc.c +++ /dev/null @@ -1,1131 +0,0 @@ -/* Opcode table for the ARC. - Copyright (c) 1994, 1995, 1997, 1998 Free Software Foundation, Inc. - Contributed by Doug Evans (dje@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, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#include <stdio.h> -#include "sysdep.h" -#include "opcode/arc.h" -#include "opintl.h" - -#ifndef NULL -#define NULL 0 -#endif - -#define INSERT_FN(fn) \ -static arc_insn fn PARAMS ((arc_insn, const struct arc_operand *, \ - int, const struct arc_operand_value *, long, \ - const char **)) -#define EXTRACT_FN(fn) \ -static long fn PARAMS ((arc_insn *, const struct arc_operand *, \ - int, const struct arc_operand_value **, int *)) - -INSERT_FN (insert_reg); -INSERT_FN (insert_shimmfinish); -INSERT_FN (insert_limmfinish); -INSERT_FN (insert_shimmoffset); -INSERT_FN (insert_shimmzero); -INSERT_FN (insert_flag); -INSERT_FN (insert_flagfinish); -INSERT_FN (insert_cond); -INSERT_FN (insert_forcelimm); -INSERT_FN (insert_reladdr); -INSERT_FN (insert_absaddr); -INSERT_FN (insert_unopmacro); - -EXTRACT_FN (extract_reg); -EXTRACT_FN (extract_flag); -EXTRACT_FN (extract_cond); -EXTRACT_FN (extract_reladdr); -EXTRACT_FN (extract_unopmacro); - -/* Various types of ARC operands, including insn suffixes. */ - -/* Insn format values: - - 'a' REGA register A field - 'b' REGB register B field - 'c' REGC register C field - 'S' SHIMMFINISH finish inserting a shimm value - 'L' LIMMFINISH finish inserting a limm value - 'd' SHIMMOFFSET shimm offset in ld,st insns - '0' SHIMMZERO 0 shimm value in ld,st insns - 'f' FLAG F flag - 'F' FLAGFINISH finish inserting the F flag - 'G' FLAGINSN insert F flag in "flag" insn - 'n' DELAY N field (nullify field) - 'q' COND condition code field - 'Q' FORCELIMM set `cond_p' to 1 to ensure a constant is a limm - 'B' BRANCH branch address (22 bit pc relative) - 'J' JUMP jump address (26 bit absolute) - 'z' SIZE1 size field in ld a,[b,c] - 'Z' SIZE10 size field in ld a,[b,shimm] - 'y' SIZE22 size field in st c,[b,shimm] - 'x' SIGN0 sign extend field ld a,[b,c] - 'X' SIGN9 sign extend field ld a,[b,shimm] - 'w' ADDRESS3 write-back field in ld a,[b,c] - 'W' ADDRESS12 write-back field in ld a,[b,shimm] - 'v' ADDRESS24 write-back field in st c,[b,shimm] - 'e' CACHEBYPASS5 cache bypass in ld a,[b,c] - 'E' CACHEBYPASS14 cache bypass in ld a,[b,shimm] - 'D' CACHEBYPASS26 cache bypass in st c,[b,shimm] - 'U' UNOPMACRO fake operand to copy REGB to REGC for unop macros - - The following modifiers may appear between the % and char (eg: %.f): - - '.' MODDOT '.' prefix must be present - 'r' REG generic register value, for register table - 'A' AUXREG auxiliary register in lr a,[b], sr c,[b] - - Fields are: - - CHAR BITS SHIFT FLAGS INSERT_FN EXTRACT_FN -*/ - -const struct arc_operand arc_operands[] = -{ -/* place holder (??? not sure if needed) */ -#define UNUSED 0 - { 0 }, - -/* register A or shimm/limm indicator */ -#define REGA (UNUSED + 1) - { 'a', 6, ARC_SHIFT_REGA, ARC_OPERAND_SIGNED, insert_reg, extract_reg }, - -/* register B or shimm/limm indicator */ -#define REGB (REGA + 1) - { 'b', 6, ARC_SHIFT_REGB, ARC_OPERAND_SIGNED, insert_reg, extract_reg }, - -/* register C or shimm/limm indicator */ -#define REGC (REGB + 1) - { 'c', 6, ARC_SHIFT_REGC, ARC_OPERAND_SIGNED, insert_reg, extract_reg }, - -/* fake operand used to insert shimm value into most instructions */ -#define SHIMMFINISH (REGC + 1) - { 'S', 9, 0, ARC_OPERAND_SIGNED + ARC_OPERAND_FAKE, insert_shimmfinish, 0 }, - -/* fake operand used to insert limm value into most instructions. */ -#define LIMMFINISH (SHIMMFINISH + 1) - { 'L', 32, 32, ARC_OPERAND_ADDRESS + ARC_OPERAND_LIMM + ARC_OPERAND_FAKE, insert_limmfinish, 0 }, - -/* shimm operand when there is no reg indicator (ld,st) */ -#define SHIMMOFFSET (LIMMFINISH + 1) - { 'd', 9, 0, ARC_OPERAND_SIGNED, insert_shimmoffset, 0 }, - -/* 0 shimm operand for ld,st insns */ -#define SHIMMZERO (SHIMMOFFSET + 1) - { '0', 9, 0, ARC_OPERAND_FAKE, insert_shimmzero, 0 }, - -/* flag update bit (insertion is defered until we know how) */ -#define FLAG (SHIMMZERO + 1) - { 'f', 1, 8, ARC_OPERAND_SUFFIX, insert_flag, extract_flag }, - -/* fake utility operand to finish 'f' suffix handling */ -#define FLAGFINISH (FLAG + 1) - { 'F', 1, 8, ARC_OPERAND_FAKE, insert_flagfinish, 0 }, - -/* fake utility operand to set the 'f' flag for the "flag" insn */ -#define FLAGINSN (FLAGFINISH + 1) - { 'G', 1, 8, ARC_OPERAND_FAKE, insert_flag, 0 }, - -/* branch delay types */ -#define DELAY (FLAGINSN + 1) - { 'n', 2, 5, ARC_OPERAND_SUFFIX }, - -/* conditions */ -#define COND (DELAY + 1) - { 'q', 5, 0, ARC_OPERAND_SUFFIX, insert_cond, extract_cond }, - -/* set `cond_p' to 1 to ensure a constant is treated as a limm */ -#define FORCELIMM (COND + 1) - { 'Q', 0, 0, ARC_OPERAND_FAKE, insert_forcelimm }, - -/* branch address; b, bl, and lp insns */ -#define BRANCH (FORCELIMM + 1) - { 'B', 20, 7, ARC_OPERAND_RELATIVE_BRANCH + ARC_OPERAND_SIGNED, insert_reladdr, extract_reladdr }, - -/* jump address; j insn (this is basically the same as 'L' except that the - value is right shifted by 2) */ -#define JUMP (BRANCH + 1) - { 'J', 24, 32, ARC_OPERAND_ABSOLUTE_BRANCH + ARC_OPERAND_LIMM + ARC_OPERAND_FAKE, insert_absaddr }, - -/* size field, stored in bit 1,2 */ -#define SIZE1 (JUMP + 1) - { 'z', 2, 1, ARC_OPERAND_SUFFIX }, - -/* size field, stored in bit 10,11 */ -#define SIZE10 (SIZE1 + 1) - { 'Z', 2, 10, ARC_OPERAND_SUFFIX, }, - -/* size field, stored in bit 22,23 */ -#define SIZE22 (SIZE10 + 1) - { 'y', 2, 22, ARC_OPERAND_SUFFIX, }, - -/* sign extend field, stored in bit 0 */ -#define SIGN0 (SIZE22 + 1) - { 'x', 1, 0, ARC_OPERAND_SUFFIX }, - -/* sign extend field, stored in bit 9 */ -#define SIGN9 (SIGN0 + 1) - { 'X', 1, 9, ARC_OPERAND_SUFFIX }, - -/* address write back, stored in bit 3 */ -#define ADDRESS3 (SIGN9 + 1) - { 'w', 1, 3, ARC_OPERAND_SUFFIX }, - -/* address write back, stored in bit 12 */ -#define ADDRESS12 (ADDRESS3 + 1) - { 'W', 1, 12, ARC_OPERAND_SUFFIX }, - -/* address write back, stored in bit 24 */ -#define ADDRESS24 (ADDRESS12 + 1) - { 'v', 1, 24, ARC_OPERAND_SUFFIX }, - -/* cache bypass, stored in bit 5 */ -#define CACHEBYPASS5 (ADDRESS24 + 1) - { 'e', 1, 5, ARC_OPERAND_SUFFIX }, - -/* cache bypass, stored in bit 14 */ -#define CACHEBYPASS14 (CACHEBYPASS5 + 1) - { 'E', 1, 14, ARC_OPERAND_SUFFIX }, - -/* cache bypass, stored in bit 26 */ -#define CACHEBYPASS26 (CACHEBYPASS14 + 1) - { 'D', 1, 26, ARC_OPERAND_SUFFIX }, - -/* unop macro, used to copy REGB to REGC */ -#define UNOPMACRO (CACHEBYPASS26 + 1) - { 'U', 6, ARC_SHIFT_REGC, ARC_OPERAND_FAKE, insert_unopmacro, extract_unopmacro }, - -/* '.' modifier ('.' required). */ -#define MODDOT (UNOPMACRO + 1) - { '.', 1, 0, ARC_MOD_DOT }, - -/* Dummy 'r' modifier for the register table. - It's called a "dummy" because there's no point in inserting an 'r' into all - the %a/%b/%c occurrences in the insn table. */ -#define REG (MODDOT + 1) - { 'r', 6, 0, ARC_MOD_REG }, - -/* Known auxiliary register modifier (stored in shimm field). */ -#define AUXREG (REG + 1) - { 'A', 9, 0, ARC_MOD_AUXREG }, - -/* end of list place holder */ - { 0 } -}; - -/* Given a format letter, yields the index into `arc_operands'. - eg: arc_operand_map['a'] = REGA. */ -unsigned char arc_operand_map[256]; - -#define I(x) (((x) & 31) << 27) -#define A(x) (((x) & ARC_MASK_REG) << ARC_SHIFT_REGA) -#define B(x) (((x) & ARC_MASK_REG) << ARC_SHIFT_REGB) -#define C(x) (((x) & ARC_MASK_REG) << ARC_SHIFT_REGC) -#define R(x,b,m) (((x) & (m)) << (b)) /* value X, mask M, at bit B */ - -/* ARC instructions. - - Longer versions of insns must appear before shorter ones (if gas sees - "lsr r2,r3,1" when it's parsing "lsr %a,%b" it will think the ",1" is - junk). This isn't necessary for `ld' because of the trailing ']'. - - Instructions that are really macros based on other insns must appear - before the real insn so they're chosen when disassembling. Eg: The `mov' - insn is really the `and' insn. - - This table is best viewed on a wide screen (161 columns). I'd prefer to - keep it this way. The rest of the file, however, should be viewable on an - 80 column terminal. */ - -/* ??? This table also includes macros: asl, lsl, and mov. The ppc port has - a more general facility for dealing with macros which could be used if - we need to. */ - -/* This table can't be `const' because members `next_asm' and `next_dis' are - computed at run-time. We could split this into two, but that doesn't seem - worth it. */ - -struct arc_opcode arc_opcodes[] = { - - /* Macros appear first. */ - /* "mov" is really an "and". */ - { "mov%.q%.f %a,%b%F%S%L%U", I(-1), I(12) }, - /* "asl" is really an "add". */ - { "asl%.q%.f %a,%b%F%S%L%U", I(-1), I(8) }, - /* "lsl" is really an "add". */ - { "lsl%.q%.f %a,%b%F%S%L%U", I(-1), I(8) }, - /* "nop" is really an "xor". */ - { "nop", 0xffffffff, 0x7fffffff }, - /* "rlc" is really an "adc". */ - { "rlc%.q%.f %a,%b%F%S%L%U", I(-1), I(9) }, - - /* The rest of these needn't be sorted, but it helps to find them if they are. */ - { "adc%.q%.f %a,%b,%c%F%S%L", I(-1), I(9) }, - { "add%.q%.f %a,%b,%c%F%S%L", I(-1), I(8) }, - { "and%.q%.f %a,%b,%c%F%S%L", I(-1), I(12) }, - { "asr%.q%.f %a,%b%F%S%L", I(-1)+C(-1), I(3)+C(1) }, - { "bic%.q%.f %a,%b,%c%F%S%L", I(-1), I(14) }, - { "b%q%.n %B", I(-1), I(4), ARC_OPCODE_COND_BRANCH }, - { "bl%q%.n %B", I(-1), I(5), ARC_OPCODE_COND_BRANCH }, - { "extb%.q%.f %a,%b%F%S%L", I(-1)+C(-1), I(3)+C(7) }, - { "extw%.q%.f %a,%b%F%S%L", I(-1)+C(-1), I(3)+C(8) }, - { "flag%.q %b%G%S%L", I(-1)+A(-1)+C(-1), I(3)+A(ARC_REG_SHIMM_UPDATE)+C(0) }, - /* %Q: force cond_p=1 --> no shimm values */ - /* ??? This insn allows an optional flags spec. */ - { "j%q%Q%.n%.f %b%J", I(-1)+A(-1)+C(-1)+R(-1,7,1), I(7)+A(0)+C(0)+R(0,7,1) }, - /* Put opcode 1 ld insns first so shimm gets prefered over limm. */ - /* "[%b]" is before "[%b,%d]" so 0 offsets don't get printed. */ - { "ld%Z%.X%.W%.E %0%a,[%b]%L", I(-1)+R(-1,13,1)+R(-1,0,511), I(1)+R(0,13,1)+R(0,0,511) }, - { "ld%Z%.X%.W%.E %a,[%b,%d]%S%L", I(-1)+R(-1,13,1), I(1)+R(0,13,1) }, - { "ld%z%.x%.w%.e%Q %a,[%b,%c]%L", I(-1)+R(-1,4,1)+R(-1,6,7), I(0)+R(0,4,1)+R(0,6,7) }, - { "lp%q%.n %B", I(-1), I(6), }, - { "lr %a,[%Ab]%S%L", I(-1)+C(-1), I(1)+C(0x10) }, - { "lsr%.q%.f %a,%b%F%S%L", I(-1)+C(-1), I(3)+C(2) }, - { "or%.q%.f %a,%b,%c%F%S%L", I(-1), I(13) }, - { "ror%.q%.f %a,%b%F%S%L", I(-1)+C(-1), I(3)+C(3) }, - { "rrc%.q%.f %a,%b%F%S%L", I(-1)+C(-1), I(3)+C(4) }, - { "sbc%.q%.f %a,%b,%c%F%S%L", I(-1), I(11) }, - { "sexb%.q%.f %a,%b%F%S%L", I(-1)+C(-1), I(3)+C(5) }, - { "sexw%.q%.f %a,%b%F%S%L", I(-1)+C(-1), I(3)+C(6) }, - { "sr %c,[%Ab]%S%L", I(-1)+A(-1), I(2)+A(0x10) }, - /* "[%b]" is before "[%b,%d]" so 0 offsets don't get printed. */ - { "st%y%.v%.D%Q %0%c,[%b]%L", I(-1)+R(-1,25,1)+R(-1,21,1)+R(-1,0,511), I(2)+R(0,25,1)+R(0,21,1)+R(0,0,511) }, - { "st%y%.v%.D %c,[%b,%d]%S%L", I(-1)+R(-1,25,1)+R(-1,21,1), I(2)+R(0,25,1)+R(0,21,1) }, - { "sub%.q%.f %a,%b,%c%F%S%L", I(-1), I(10) }, - { "xor%.q%.f %a,%b,%c%F%S%L", I(-1), I(15) } -}; -const int arc_opcodes_count = sizeof (arc_opcodes) / sizeof (arc_opcodes[0]); - -const struct arc_operand_value arc_reg_names[] = -{ - /* Sort this so that the first 61 entries are sequential. - IE: For each i (i<61), arc_reg_names[i].value == i. */ - - { "r0", 0, REG }, { "r1", 1, REG }, { "r2", 2, REG }, { "r3", 3, REG }, - { "r4", 4, REG }, { "r5", 5, REG }, { "r6", 6, REG }, { "r7", 7, REG }, - { "r8", 8, REG }, { "r9", 9, REG }, { "r10", 10, REG }, { "r11", 11, REG }, - { "r12", 12, REG }, { "r13", 13, REG }, { "r14", 14, REG }, { "r15", 15, REG }, - { "r16", 16, REG }, { "r17", 17, REG }, { "r18", 18, REG }, { "r19", 19, REG }, - { "r20", 20, REG }, { "r21", 21, REG }, { "r22", 22, REG }, { "r23", 23, REG }, - { "r24", 24, REG }, { "r25", 25, REG }, { "r26", 26, REG }, { "fp", 27, REG }, - { "sp", 28, REG }, { "ilink1", 29, REG }, { "ilink2", 30, REG }, { "blink", 31, REG }, - { "r32", 32, REG }, { "r33", 33, REG }, { "r34", 34, REG }, { "r35", 35, REG }, - { "r36", 36, REG }, { "r37", 37, REG }, { "r38", 38, REG }, { "r39", 39, REG }, - { "r40", 40, REG }, { "r41", 41, REG }, { "r42", 42, REG }, { "r43", 43, REG }, - { "r44", 44, REG }, { "r45", 45, REG }, { "r46", 46, REG }, { "r47", 47, REG }, - { "r48", 48, REG }, { "r49", 49, REG }, { "r50", 50, REG }, { "r51", 51, REG }, - { "r52", 52, REG }, { "r53", 53, REG }, { "r54", 54, REG }, { "r55", 55, REG }, - { "r56", 56, REG }, { "r57", 57, REG }, { "r58", 58, REG }, { "r59", 59, REG }, - { "lp_count", 60, REG }, - - /* I'd prefer to output these as "fp" and "sp" by default, but we still need - to recognize the canonical values. */ - { "r27", 27, REG }, { "r28", 28, REG }, - - /* Someone may wish to refer to these in this way, and it's probably a - good idea to reserve them as such anyway. */ - { "r29", 29, REG }, { "r30", 30, REG }, { "r31", 31, REG }, { "r60", 60, REG }, - - /* Standard auxiliary registers. */ - { "status", 0, AUXREG }, - { "semaphore", 1, AUXREG }, - { "lp_start", 2, AUXREG }, - { "lp_end", 3, AUXREG }, - { "identity", 4, AUXREG }, - { "debug", 5, AUXREG }, -}; -const int arc_reg_names_count = sizeof (arc_reg_names) / sizeof (arc_reg_names[0]); - -/* The suffix table. - Operands with the same name must be stored together. */ - -const struct arc_operand_value arc_suffixes[] = -{ - /* Entry 0 is special, default values aren't printed by the disassembler. */ - { "", 0, -1 }, - { "al", 0, COND }, - { "ra", 0, COND }, - { "eq", 1, COND }, - { "z", 1, COND }, - { "ne", 2, COND }, - { "nz", 2, COND }, - { "p", 3, COND }, - { "pl", 3, COND }, - { "n", 4, COND }, - { "mi", 4, COND }, - { "c", 5, COND }, - { "cs", 5, COND }, - { "lo", 5, COND }, - { "nc", 6, COND }, - { "cc", 6, COND }, - { "hs", 6, COND }, - { "v", 7, COND }, - { "vs", 7, COND }, - { "nv", 8, COND }, - { "vc", 8, COND }, - { "gt", 9, COND }, - { "ge", 10, COND }, - { "lt", 11, COND }, - { "le", 12, COND }, - { "hi", 13, COND }, - { "ls", 14, COND }, - { "pnz", 15, COND }, - { "f", 1, FLAG }, - { "nd", ARC_DELAY_NONE, DELAY }, - { "d", ARC_DELAY_NORMAL, DELAY }, - { "jd", ARC_DELAY_JUMP, DELAY }, -/*{ "b", 7, SIZEEXT },*/ -/*{ "b", 5, SIZESEX },*/ - { "b", 1, SIZE1 }, - { "b", 1, SIZE10 }, - { "b", 1, SIZE22 }, -/*{ "w", 8, SIZEEXT },*/ -/*{ "w", 6, SIZESEX },*/ - { "w", 2, SIZE1 }, - { "w", 2, SIZE10 }, - { "w", 2, SIZE22 }, - { "x", 1, SIGN0 }, - { "x", 1, SIGN9 }, - { "a", 1, ADDRESS3 }, - { "a", 1, ADDRESS12 }, - { "a", 1, ADDRESS24 }, - { "di", 1, CACHEBYPASS5 }, - { "di", 1, CACHEBYPASS14 }, - { "di", 1, CACHEBYPASS26 }, -}; -const int arc_suffixes_count = sizeof (arc_suffixes) / sizeof (arc_suffixes[0]); - -/* Indexed by first letter of opcode. Points to chain of opcodes with same - first letter. */ -static struct arc_opcode *opcode_map[26 + 1]; - -/* Indexed by insn code. Points to chain of opcodes with same insn code. */ -static struct arc_opcode *icode_map[32]; - -/* Configuration flags. */ - -/* Various ARC_HAVE_XXX bits. */ -static int cpu_type; - -/* Translate a bfd_mach_arc_xxx value to a ARC_MACH_XXX value. */ - -int -arc_get_opcode_mach (bfd_mach, big_p) - int bfd_mach, big_p; -{ - static int mach_type_map[] = - { - ARC_MACH_BASE - }; - - return mach_type_map[bfd_mach] | (big_p ? ARC_MACH_BIG : 0); -} - -/* Initialize any tables that need it. - Must be called once at start up (or when first needed). - - FLAGS is a set of bits that say what version of the cpu we have, - and in particular at least (one of) ARC_MACH_XXX. */ - -void -arc_opcode_init_tables (flags) - int flags; -{ - static int init_p = 0; - - cpu_type = flags; - - /* We may be intentionally called more than once (for example gdb will call - us each time the user switches cpu). These tables only need to be init'd - once though. */ - /* ??? We can remove the need for arc_opcode_supported by taking it into - account here, but I'm not sure I want to do that yet (if ever). */ - if (!init_p) - { - register int i,n; - - memset (arc_operand_map, 0, sizeof (arc_operand_map)); - n = sizeof (arc_operands) / sizeof (arc_operands[0]); - for (i = 0; i < n; ++i) - arc_operand_map[arc_operands[i].fmt] = i; - - memset (opcode_map, 0, sizeof (opcode_map)); - memset (icode_map, 0, sizeof (icode_map)); - /* Scan the table backwards so macros appear at the front. */ - for (i = arc_opcodes_count - 1; i >= 0; --i) - { - int opcode_hash = ARC_HASH_OPCODE (arc_opcodes[i].syntax); - int icode_hash = ARC_HASH_ICODE (arc_opcodes[i].value); - - arc_opcodes[i].next_asm = opcode_map[opcode_hash]; - opcode_map[opcode_hash] = &arc_opcodes[i]; - - arc_opcodes[i].next_dis = icode_map[icode_hash]; - icode_map[icode_hash] = &arc_opcodes[i]; - } - - init_p = 1; - } -} - -/* Return non-zero if OPCODE is supported on the specified cpu. - Cpu selection is made when calling `arc_opcode_init_tables'. */ - -int -arc_opcode_supported (opcode) - const struct arc_opcode *opcode; -{ - if (ARC_OPCODE_CPU (opcode->flags) == 0) - return 1; - if (ARC_OPCODE_CPU (opcode->flags) & ARC_HAVE_CPU (cpu_type)) - return 1; - return 0; -} - -/* Return non-zero if OPVAL is supported on the specified cpu. - Cpu selection is made when calling `arc_opcode_init_tables'. */ - -int -arc_opval_supported (opval) - const struct arc_operand_value *opval; -{ - if (ARC_OPVAL_CPU (opval->flags) == 0) - return 1; - if (ARC_OPVAL_CPU (opval->flags) & ARC_HAVE_CPU (cpu_type)) - return 1; - return 0; -} - -/* Return the first insn in the chain for assembling INSN. */ - -const struct arc_opcode * -arc_opcode_lookup_asm (insn) - const char *insn; -{ - return opcode_map[ARC_HASH_OPCODE (insn)]; -} - -/* Return the first insn in the chain for disassembling INSN. */ - -const struct arc_opcode * -arc_opcode_lookup_dis (insn) - unsigned int insn; -{ - return icode_map[ARC_HASH_ICODE (insn)]; -} - -/* Nonzero if we've seen an 'f' suffix (in certain insns). */ -static int flag_p; - -/* Nonzero if we've finished processing the 'f' suffix. */ -static int flagshimm_handled_p; - -/* Nonzero if we've seen a 'q' suffix (condition code). */ -static int cond_p; - -/* Nonzero if we've inserted a shimm. */ -static int shimm_p; - -/* The value of the shimm we inserted (each insn only gets one but it can - appear multiple times. */ -static int shimm; - -/* Nonzero if we've inserted a limm (during assembly) or seen a limm - (during disassembly). */ -static int limm_p; - -/* The value of the limm we inserted. Each insn only gets one but it can - appear multiple times. */ -static long limm; - -/* Insertion functions. */ - -/* Called by the assembler before parsing an instruction. */ - -void -arc_opcode_init_insert () -{ - flag_p = 0; - flagshimm_handled_p = 0; - cond_p = 0; - shimm_p = 0; - limm_p = 0; -} - -/* Called by the assembler to see if the insn has a limm operand. - Also called by the disassembler to see if the insn contains a limm. */ - -int -arc_opcode_limm_p (limmp) - long *limmp; -{ - if (limmp) - *limmp = limm; - return limm_p; -} - -/* Insert a value into a register field. - If REG is NULL, then this is actually a constant. - - We must also handle auxiliary registers for lr/sr insns. */ - -static arc_insn -insert_reg (insn, operand, mods, reg, value, errmsg) - arc_insn insn; - const struct arc_operand *operand; - int mods; - const struct arc_operand_value *reg; - long value; - const char **errmsg; -{ - static char buf[100]; - - if (reg == NULL) - { - /* We have a constant that also requires a value stored in a register - field. Handle these by updating the register field and saving the - value for later handling by either %S (shimm) or %L (limm). */ - - /* Try to use a shimm value before a limm one. */ - if (ARC_SHIMM_CONST_P (value) - /* If we've seen a conditional suffix we have to use a limm. */ - && !cond_p - /* If we already have a shimm value that is different than ours - we have to use a limm. */ - && (!shimm_p || shimm == value)) - { - int marker = flag_p ? ARC_REG_SHIMM_UPDATE : ARC_REG_SHIMM; - flagshimm_handled_p = 1; - shimm_p = 1; - shimm = value; - insn |= marker << operand->shift; - /* insn |= value & 511; - done later */ - } - /* We have to use a limm. If we've already seen one they must match. */ - else if (!limm_p || limm == value) - { - limm_p = 1; - limm = value; - insn |= ARC_REG_LIMM << operand->shift; - /* The constant is stored later. */ - } - else - { - *errmsg = _("unable to fit different valued constants into instruction"); - } - } - else - { - /* We have to handle both normal and auxiliary registers. */ - - if (reg->type == AUXREG) - { - if (!(mods & ARC_MOD_AUXREG)) - *errmsg = _("auxiliary register not allowed here"); - else - { - insn |= ARC_REG_SHIMM << operand->shift; - insn |= reg->value << arc_operands[reg->type].shift; - } - } - else - { - /* We should never get an invalid register number here. */ - if ((unsigned int) reg->value > 60) - { - /* xgettext:c-format */ - sprintf (buf, _("invalid register number `%d'"), reg->value); - *errmsg = buf; - } - else - insn |= reg->value << operand->shift; - } - } - - return insn; -} - -/* Called when we see an 'f' flag. */ - -static arc_insn -insert_flag (insn, operand, mods, reg, value, errmsg) - arc_insn insn; - const struct arc_operand *operand; - int mods; - const struct arc_operand_value *reg; - long value; - const char **errmsg; -{ - /* We can't store anything in the insn until we've parsed the registers. - Just record the fact that we've got this flag. `insert_reg' will use it - to store the correct value (ARC_REG_SHIMM_UPDATE or bit 0x100). */ - flag_p = 1; - - return insn; -} - -/* Called after completely building an insn to ensure the 'f' flag gets set - properly. This is needed because we don't know how to set this flag until - we've parsed the registers. */ - -static arc_insn -insert_flagfinish (insn, operand, mods, reg, value, errmsg) - arc_insn insn; - const struct arc_operand *operand; - int mods; - const struct arc_operand_value *reg; - long value; - const char **errmsg; -{ - if (flag_p && !flagshimm_handled_p) - { - if (shimm_p) - abort (); - flagshimm_handled_p = 1; - insn |= (1 << operand->shift); - } - return insn; -} - -/* Called when we see a conditional flag (eg: .eq). */ - -static arc_insn -insert_cond (insn, operand, mods, reg, value, errmsg) - arc_insn insn; - const struct arc_operand *operand; - int mods; - const struct arc_operand_value *reg; - long value; - const char **errmsg; -{ - cond_p = 1; - insn |= (value & ((1 << operand->bits) - 1)) << operand->shift; - return insn; -} - -/* Used in the "j" instruction to prevent constants from being interpreted as - shimm values (which the jump insn doesn't accept). This can also be used - to force the use of limm values in other situations (eg: ld r0,[foo] uses - this). - ??? The mechanism is sound. Access to it is a bit klunky right now. */ - -static arc_insn -insert_forcelimm (insn, operand, mods, reg, value, errmsg) - arc_insn insn; - const struct arc_operand *operand; - int mods; - const struct arc_operand_value *reg; - long value; - const char **errmsg; -{ - cond_p = 1; - return insn; -} - -/* Used in ld/st insns to handle the shimm offset field. */ - -static arc_insn -insert_shimmoffset (insn, operand, mods, reg, value, errmsg) - arc_insn insn; - const struct arc_operand *operand; - int mods; - const struct arc_operand_value *reg; - long value; - const char **errmsg; -{ - long minval, maxval; - static char buf[100]; - - if (reg != NULL) - { - *errmsg = "register appears where shimm value expected"; - } - else - { - /* This is *way* more general than necessary, but maybe some day it'll - be useful. */ - if (operand->flags & ARC_OPERAND_SIGNED) - { - minval = -(1 << (operand->bits - 1)); - maxval = (1 << (operand->bits - 1)) - 1; - } - else - { - minval = 0; - maxval = (1 << operand->bits) - 1; - } - if (value < minval || value > maxval) - { - /* xgettext:c-format */ - sprintf (buf, _("value won't fit in range %ld - %ld"), - minval, maxval); - *errmsg = buf; - } - else - insn |= (value & ((1 << operand->bits) - 1)) << operand->shift; - } - return insn; -} - -/* Used in ld/st insns when the shimm offset is 0. */ - -static arc_insn -insert_shimmzero (insn, operand, mods, reg, value, errmsg) - arc_insn insn; - const struct arc_operand *operand; - int mods; - const struct arc_operand_value *reg; - long value; - const char **errmsg; -{ - shimm_p = 1; - shimm = 0; - return insn; -} - -/* Called at the end of processing normal insns (eg: add) to insert a shimm - value (if present) into the insn. */ - -static arc_insn -insert_shimmfinish (insn, operand, mods, reg, value, errmsg) - arc_insn insn; - const struct arc_operand *operand; - int mods; - const struct arc_operand_value *reg; - long value; - const char **errmsg; -{ - if (shimm_p) - insn |= (shimm & ((1 << operand->bits) - 1)) << operand->shift; - return insn; -} - -/* Called at the end of processing normal insns (eg: add) to insert a limm - value (if present) into the insn. - - Note that this function is only intended to handle instructions (with 4 byte - immediate operands). It is not intended to handle data. */ - -/* ??? Actually, there's nothing for us to do as we can't call frag_more, the - caller must do that. The extract fns take a pointer to two words. The - insert fns could be converted and then we could do something useful, but - then the reloc handlers would have to know to work on the second word of - a 2 word quantity. That's too much so we don't handle them. */ - -static arc_insn -insert_limmfinish (insn, operand, mods, reg, value, errmsg) - arc_insn insn; - const struct arc_operand *operand; - int mods; - const struct arc_operand_value *reg; - long value; - const char **errmsg; -{ - if (limm_p) - ; /* nothing to do, gas does it */ - return insn; -} - -/* Called at the end of unary operand macros to copy the B field to C. */ - -static arc_insn -insert_unopmacro (insn, operand, mods, reg, value, errmsg) - arc_insn insn; - const struct arc_operand *operand; - int mods; - const struct arc_operand_value *reg; - long value; - const char **errmsg; -{ - insn |= ((insn >> ARC_SHIFT_REGB) & ARC_MASK_REG) << operand->shift; - return insn; -} - -/* Insert a relative address for a branch insn (b, bl, or lp). */ - -static arc_insn -insert_reladdr (insn, operand, mods, reg, value, errmsg) - arc_insn insn; - const struct arc_operand *operand; - int mods; - const struct arc_operand_value *reg; - long value; - const char **errmsg; -{ - if (value & 3) - *errmsg = _("branch address not on 4 byte boundary"); - insn |= ((value >> 2) & ((1 << operand->bits) - 1)) << operand->shift; - return insn; -} - -/* Insert a limm value as a 26 bit address right shifted 2 into the insn. - - Note that this function is only intended to handle instructions (with 4 byte - immediate operands). It is not intended to handle data. */ - -/* ??? Actually, there's nothing for us to do as we can't call frag_more, the - caller must do that. The extract fns take a pointer to two words. The - insert fns could be converted and then we could do something useful, but - then the reloc handlers would have to know to work on the second word of - a 2 word quantity. That's too much so we don't handle them. */ - -static arc_insn -insert_absaddr (insn, operand, mods, reg, value, errmsg) - arc_insn insn; - const struct arc_operand *operand; - int mods; - const struct arc_operand_value *reg; - long value; - const char **errmsg; -{ - if (limm_p) - ; /* nothing to do */ - return insn; -} - -/* Extraction functions. - - The suffix extraction functions' return value is redundant since it can be - obtained from (*OPVAL)->value. However, the boolean suffixes don't have - a suffix table entry for the "false" case, so values of zero must be - obtained from the return value (*OPVAL == NULL). */ - -static const struct arc_operand_value *lookup_register (int type, long regno); - -/* Called by the disassembler before printing an instruction. */ - -void -arc_opcode_init_extract () -{ - flag_p = 0; - flagshimm_handled_p = 0; - shimm_p = 0; - limm_p = 0; -} - -/* As we're extracting registers, keep an eye out for the 'f' indicator - (ARC_REG_SHIMM_UPDATE). If we find a register (not a constant marker, - like ARC_REG_SHIMM), set OPVAL so our caller will know this is a register. - - We must also handle auxiliary registers for lr/sr insns. They are just - constants with special names. */ - -static long -extract_reg (insn, operand, mods, opval, invalid) - arc_insn *insn; - const struct arc_operand *operand; - int mods; - const struct arc_operand_value **opval; - int *invalid; -{ - int regno; - long value; - - /* Get the register number. */ - regno = (insn[0] >> operand->shift) & ((1 << operand->bits) - 1); - - /* Is it a constant marker? */ - if (regno == ARC_REG_SHIMM) - { - value = insn[0] & 511; - if ((operand->flags & ARC_OPERAND_SIGNED) - && (value & 256)) - value -= 512; - flagshimm_handled_p = 1; - } - else if (regno == ARC_REG_SHIMM_UPDATE) - { - value = insn[0] & 511; - if ((operand->flags & ARC_OPERAND_SIGNED) - && (value & 256)) - value -= 512; - flag_p = 1; - flagshimm_handled_p = 1; - } - else if (regno == ARC_REG_LIMM) - { - value = insn[1]; - limm_p = 1; - } - /* It's a register, set OPVAL (that's the only way we distinguish registers - from constants here). */ - else - { - const struct arc_operand_value *reg = lookup_register (REG, regno); - - if (reg == NULL) - abort (); - if (opval != NULL) - *opval = reg; - value = regno; - } - - /* If this field takes an auxiliary register, see if it's a known one. */ - if ((mods & ARC_MOD_AUXREG) - && ARC_REG_CONSTANT_P (regno)) - { - const struct arc_operand_value *reg = lookup_register (AUXREG, value); - - /* This is really a constant, but tell the caller it has a special - name. */ - if (reg != NULL && opval != NULL) - *opval = reg; - } - - return value; -} - -/* Return the value of the "flag update" field for shimm insns. - This value is actually stored in the register field. */ - -static long -extract_flag (insn, operand, mods, opval, invalid) - arc_insn *insn; - const struct arc_operand *operand; - int mods; - const struct arc_operand_value **opval; - int *invalid; -{ - int f; - const struct arc_operand_value *val; - - if (flagshimm_handled_p) - f = flag_p != 0; - else - f = (insn[0] & (1 << operand->shift)) != 0; - - /* There is no text for zero values. */ - if (f == 0) - return 0; - - val = arc_opcode_lookup_suffix (operand, 1); - if (opval != NULL && val != NULL) - *opval = val; - return val->value; -} - -/* Extract the condition code (if it exists). - If we've seen a shimm value in this insn (meaning that the insn can't have - a condition code field), then we don't store anything in OPVAL and return - zero. */ - -static long -extract_cond (insn, operand, mods, opval, invalid) - arc_insn *insn; - const struct arc_operand *operand; - int mods; - const struct arc_operand_value **opval; - int *invalid; -{ - long cond; - const struct arc_operand_value *val; - - if (flagshimm_handled_p) - return 0; - - cond = (insn[0] >> operand->shift) & ((1 << operand->bits) - 1); - val = arc_opcode_lookup_suffix (operand, cond); - - /* Ignore NULL values of `val'. Several condition code values are - reserved for extensions. */ - if (opval != NULL && val != NULL) - *opval = val; - return cond; -} - -/* Extract a branch address. - We return the value as a real address (not right shifted by 2). */ - -static long -extract_reladdr (insn, operand, mods, opval, invalid) - arc_insn *insn; - const struct arc_operand *operand; - int mods; - const struct arc_operand_value **opval; - int *invalid; -{ - long addr; - - addr = (insn[0] >> operand->shift) & ((1 << operand->bits) - 1); - if ((operand->flags & ARC_OPERAND_SIGNED) - && (addr & (1 << (operand->bits - 1)))) - addr -= 1 << operand->bits; - - return addr << 2; -} - -/* The only thing this does is set the `invalid' flag if B != C. - This is needed because the "mov" macro appears before it's real insn "and" - and we don't want the disassembler to confuse them. */ - -static long -extract_unopmacro (insn, operand, mods, opval, invalid) - arc_insn *insn; - const struct arc_operand *operand; - int mods; - const struct arc_operand_value **opval; - int *invalid; -{ - /* This misses the case where B == ARC_REG_SHIMM_UPDATE && - C == ARC_REG_SHIMM (or vice versa). No big deal. Those insns will get - printed as "and"s. */ - if (((insn[0] >> ARC_SHIFT_REGB) & ARC_MASK_REG) - != ((insn[0] >> ARC_SHIFT_REGC) & ARC_MASK_REG)) - if (invalid != NULL) - *invalid = 1; - - return 0; -} - -/* Utility for the extraction functions to return the index into - `arc_suffixes'. */ - -const struct arc_operand_value * -arc_opcode_lookup_suffix (type, value) - const struct arc_operand *type; - int value; -{ - register const struct arc_operand_value *v,*end; - - /* ??? This is a little slow and can be speeded up. */ - - for (v = arc_suffixes, end = arc_suffixes + arc_suffixes_count; v < end; ++v) - if (type == &arc_operands[v->type] - && value == v->value) - return v; - return 0; -} - -static const struct arc_operand_value * -lookup_register (type, regno) - int type; - long regno; -{ - register const struct arc_operand_value *r,*end; - - if (type == REG) - return &arc_reg_names[regno]; - - /* ??? This is a little slow and can be speeded up. */ - - for (r = arc_reg_names, end = arc_reg_names + arc_reg_names_count; - r < end; ++r) - if (type == r->type && regno == r->value) - return r; - return 0; -} diff --git a/contrib/binutils/opcodes/cgen-asm.c b/contrib/binutils/opcodes/cgen-asm.c deleted file mode 100644 index 4ed69363a9db..000000000000 --- a/contrib/binutils/opcodes/cgen-asm.c +++ /dev/null @@ -1,359 +0,0 @@ -/* CGEN generic assembler support code. - - Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. - - This file is part of the GNU Binutils 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, 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 <stdio.h> -#include <ctype.h> -#include "ansidecl.h" -#include "libiberty.h" -#include "bfd.h" -#include "symcat.h" -#include "opcode/cgen.h" -#include "opintl.h" - -/* Set the cgen_parse_operand_fn callback. */ - -void -cgen_set_parse_operand_fn (cd, fn) - CGEN_CPU_DESC cd; - cgen_parse_operand_fn fn; -{ - cd->parse_operand_fn = fn; -} - -/* Called whenever starting to parse an insn. */ - -void -cgen_init_parse_operand (cd) - CGEN_CPU_DESC cd; -{ - /* This tells the callback to re-initialize. */ - (void) (* cd->parse_operand_fn) - (cd, CGEN_PARSE_OPERAND_INIT, NULL, 0, 0, NULL, NULL); -} - -/* Subroutine of build_asm_hash_table to add INSNS to the hash table. - - COUNT is the number of elements in INSNS. - ENTSIZE is sizeof (CGEN_IBASE) for the target. - ??? No longer used but leave in for now. - HTABLE points to the hash table. - HENTBUF is a pointer to sufficiently large buffer of hash entries. - The result is a pointer to the next entry to use. - - The table is scanned backwards as additions are made to the front of the - list and we want earlier ones to be prefered. */ - -static CGEN_INSN_LIST * -hash_insn_array (cd, insns, count, entsize, htable, hentbuf) - CGEN_CPU_DESC cd; - const CGEN_INSN *insns; - int count; - int entsize; - CGEN_INSN_LIST **htable; - CGEN_INSN_LIST *hentbuf; -{ - int i; - - for (i = count - 1; i >= 0; --i, ++hentbuf) - { - unsigned int hash; - const CGEN_INSN *insn = &insns[i]; - - if (! (* cd->asm_hash_p) (insn)) - continue; - hash = (* cd->asm_hash) (CGEN_INSN_MNEMONIC (insn)); - hentbuf->next = htable[hash]; - hentbuf->insn = insn; - htable[hash] = hentbuf; - } - - return hentbuf; -} - -/* Subroutine of build_asm_hash_table to add INSNS to the hash table. - This function is identical to hash_insn_array except the insns are - in a list. */ - -static CGEN_INSN_LIST * -hash_insn_list (cd, insns, htable, hentbuf) - CGEN_CPU_DESC cd; - const CGEN_INSN_LIST *insns; - CGEN_INSN_LIST **htable; - CGEN_INSN_LIST *hentbuf; -{ - const CGEN_INSN_LIST *ilist; - - for (ilist = insns; ilist != NULL; ilist = ilist->next, ++ hentbuf) - { - unsigned int hash; - - if (! (* cd->asm_hash_p) (ilist->insn)) - continue; - hash = (* cd->asm_hash) (CGEN_INSN_MNEMONIC (ilist->insn)); - hentbuf->next = htable[hash]; - hentbuf->insn = ilist->insn; - htable[hash] = hentbuf; - } - - return hentbuf; -} - -/* Build the assembler instruction hash table. */ - -static void -build_asm_hash_table (cd) - CGEN_CPU_DESC cd; -{ - int count = cgen_insn_count (cd) + cgen_macro_insn_count (cd); - CGEN_INSN_TABLE *insn_table = &cd->insn_table; - CGEN_INSN_TABLE *macro_insn_table = &cd->macro_insn_table; - unsigned int hash_size = cd->asm_hash_size; - CGEN_INSN_LIST *hash_entry_buf; - CGEN_INSN_LIST **asm_hash_table; - CGEN_INSN_LIST *asm_hash_table_entries; - - /* The space allocated for the hash table consists of two parts: - the hash table and the hash lists. */ - - asm_hash_table = (CGEN_INSN_LIST **) - xmalloc (hash_size * sizeof (CGEN_INSN_LIST *)); - memset (asm_hash_table, 0, hash_size * sizeof (CGEN_INSN_LIST *)); - asm_hash_table_entries = hash_entry_buf = (CGEN_INSN_LIST *) - xmalloc (count * sizeof (CGEN_INSN_LIST)); - - /* Add compiled in insns. - Don't include the first one as it is a reserved entry. */ - /* ??? It was the end of all hash chains, and also the special - "invalid insn" marker. May be able to do it differently now. */ - - hash_entry_buf = hash_insn_array (cd, - insn_table->init_entries + 1, - insn_table->num_init_entries - 1, - insn_table->entry_size, - asm_hash_table, hash_entry_buf); - - /* Add compiled in macro-insns. */ - - hash_entry_buf = hash_insn_array (cd, macro_insn_table->init_entries, - macro_insn_table->num_init_entries, - macro_insn_table->entry_size, - asm_hash_table, hash_entry_buf); - - /* Add runtime added insns. - Later added insns will be prefered over earlier ones. */ - - hash_entry_buf = hash_insn_list (cd, insn_table->new_entries, - asm_hash_table, hash_entry_buf); - - /* Add runtime added macro-insns. */ - - hash_insn_list (cd, macro_insn_table->new_entries, - asm_hash_table, hash_entry_buf); - - cd->asm_hash_table = asm_hash_table; - cd->asm_hash_table_entries = asm_hash_table_entries; -} - -/* Return the first entry in the hash list for INSN. */ - -CGEN_INSN_LIST * -cgen_asm_lookup_insn (cd, insn) - CGEN_CPU_DESC cd; - const char *insn; -{ - unsigned int hash; - - if (cd->asm_hash_table == NULL) - build_asm_hash_table (cd); - - hash = (* cd->asm_hash) (insn); - return cd->asm_hash_table[hash]; -} - -/* Keyword parser. - The result is NULL upon success or an error message. - If successful, *STRP is updated to point passed the keyword. - - ??? At present we have a static notion of how to pick out a keyword. - Later we can allow a target to customize this if necessary [say by - recording something in the keyword table]. */ - -const char * -cgen_parse_keyword (cd, strp, keyword_table, valuep) - CGEN_CPU_DESC cd; - const char **strp; - CGEN_KEYWORD *keyword_table; - long *valuep; -{ - const CGEN_KEYWORD_ENTRY *ke; - char buf[256]; - const char *p,*start; - - p = start = *strp; - - /* Allow any first character. - Note that this allows recognizing ",a" for the annul flag in sparc - even though "," is subsequently not a valid keyword char. */ - if (*p) - ++p; - - /* Now allow letters, digits, and _. */ - while (((p - start) < (int) sizeof (buf)) - && (isalnum ((unsigned char) *p) || *p == '_')) - ++p; - - if (p - start >= (int) sizeof (buf)) - return _("unrecognized keyword/register name"); - - memcpy (buf, start, p - start); - buf[p - start] = 0; - - ke = cgen_keyword_lookup_name (keyword_table, buf); - - if (ke != NULL) - { - *valuep = ke->value; - /* Don't advance pointer if we recognized the null keyword. */ - if (ke->name[0] != 0) - *strp = p; - return NULL; - } - - return "unrecognized keyword/register name"; -} - -/* Parse a small signed integer parser. - ??? VALUEP is not a bfd_vma * on purpose, though this is confusing. - Note that if the caller expects a bfd_vma result, it should call - cgen_parse_address. */ - -const char * -cgen_parse_signed_integer (cd, strp, opindex, valuep) - CGEN_CPU_DESC cd; - const char **strp; - int opindex; - long *valuep; -{ - bfd_vma value; - enum cgen_parse_operand_result result; - const char *errmsg; - - errmsg = (* cd->parse_operand_fn) - (cd, CGEN_PARSE_OPERAND_INTEGER, strp, opindex, BFD_RELOC_NONE, - &result, &value); - /* FIXME: Examine `result'. */ - if (!errmsg) - *valuep = value; - return errmsg; -} - -/* Parse a small unsigned integer parser. - ??? VALUEP is not a bfd_vma * on purpose, though this is confusing. - Note that if the caller expects a bfd_vma result, it should call - cgen_parse_address. */ - -const char * -cgen_parse_unsigned_integer (cd, strp, opindex, valuep) - CGEN_CPU_DESC cd; - const char **strp; - int opindex; - unsigned long *valuep; -{ - bfd_vma value; - enum cgen_parse_operand_result result; - const char *errmsg; - - errmsg = (* cd->parse_operand_fn) - (cd, CGEN_PARSE_OPERAND_INTEGER, strp, opindex, BFD_RELOC_NONE, - &result, &value); - /* FIXME: Examine `result'. */ - if (!errmsg) - *valuep = value; - return errmsg; -} - -/* Address parser. */ - -const char * -cgen_parse_address (cd, strp, opindex, opinfo, resultp, valuep) - CGEN_CPU_DESC cd; - const char **strp; - int opindex; - int opinfo; - enum cgen_parse_operand_result *resultp; - bfd_vma *valuep; -{ - bfd_vma value; - enum cgen_parse_operand_result result_type; - const char *errmsg; - - errmsg = (* cd->parse_operand_fn) - (cd, CGEN_PARSE_OPERAND_ADDRESS, strp, opindex, opinfo, - &result_type, &value); - /* FIXME: Examine `result'. */ - if (!errmsg) - { - if (resultp != NULL) - *resultp = result_type; - *valuep = value; - } - return errmsg; -} - -/* Signed integer validation routine. */ - -const char * -cgen_validate_signed_integer (value, min, max) - long value, min, max; -{ - if (value < min || value > max) - { - static char buf[100]; - - /* xgettext:c-format */ - sprintf (buf, _("operand out of range (%ld not between %ld and %ld)"), - value, min, max); - return buf; - } - - return NULL; -} - -/* Unsigned integer validation routine. - Supplying `min' here may seem unnecessary, but we also want to handle - cases where min != 0 (and max > LONG_MAX). */ - -const char * -cgen_validate_unsigned_integer (value, min, max) - unsigned long value, min, max; -{ - if (value < min || value > max) - { - static char buf[100]; - - /* xgettext:c-format */ - sprintf (buf, _("operand out of range (%lu not between %lu and %lu)"), - value, min, max); - return buf; - } - - return NULL; -} diff --git a/contrib/binutils/opcodes/cgen-dis.c b/contrib/binutils/opcodes/cgen-dis.c deleted file mode 100644 index 78b1cd90ed91..000000000000 --- a/contrib/binutils/opcodes/cgen-dis.c +++ /dev/null @@ -1,226 +0,0 @@ -/* CGEN generic disassembler support code. - - Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc. - - This file is part of the GNU Binutils 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, 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 <stdio.h> -#include "ansidecl.h" -#include "libiberty.h" -#include "bfd.h" -#include "symcat.h" -#include "opcode/cgen.h" - -/* Subroutine of build_dis_hash_table to add INSNS to the hash table. - - COUNT is the number of elements in INSNS. - ENTSIZE is sizeof (CGEN_IBASE) for the target. - ??? No longer used but leave in for now. - HTABLE points to the hash table. - HENTBUF is a pointer to sufficiently large buffer of hash entries. - The result is a pointer to the next entry to use. - - The table is scanned backwards as additions are made to the front of the - list and we want earlier ones to be prefered. */ - -static CGEN_INSN_LIST * -hash_insn_array (cd, insns, count, entsize, htable, hentbuf) - CGEN_CPU_DESC cd; - const CGEN_INSN * insns; - int count; - int entsize; - CGEN_INSN_LIST ** htable; - CGEN_INSN_LIST * hentbuf; -{ - int big_p = CGEN_CPU_ENDIAN (cd) == CGEN_ENDIAN_BIG; - int i; - - for (i = count - 1; i >= 0; --i, ++hentbuf) - { - unsigned int hash; - char buf [4]; - unsigned long value; - const CGEN_INSN *insn = &insns[i]; - - if (! (* cd->dis_hash_p) (insn)) - continue; - - /* We don't know whether the target uses the buffer or the base insn - to hash on, so set both up. */ - - value = CGEN_INSN_BASE_VALUE (insn); - switch (CGEN_INSN_MASK_BITSIZE (insn)) - { - case 8: - buf[0] = value; - break; - case 16: - if (big_p) - bfd_putb16 ((bfd_vma) value, buf); - else - bfd_putl16 ((bfd_vma) value, buf); - break; - case 32: - if (big_p) - bfd_putb32 ((bfd_vma) value, buf); - else - bfd_putl32 ((bfd_vma) value, buf); - break; - default: - abort (); - } - - hash = (* cd->dis_hash) (buf, value); - hentbuf->next = htable[hash]; - hentbuf->insn = insn; - htable[hash] = hentbuf; - } - - return hentbuf; -} - -/* Subroutine of build_dis_hash_table to add INSNS to the hash table. - This function is identical to hash_insn_array except the insns are - in a list. */ - -static CGEN_INSN_LIST * -hash_insn_list (cd, insns, htable, hentbuf) - CGEN_CPU_DESC cd; - const CGEN_INSN_LIST *insns; - CGEN_INSN_LIST **htable; - CGEN_INSN_LIST *hentbuf; -{ - int big_p = CGEN_CPU_ENDIAN (cd) == CGEN_ENDIAN_BIG; - const CGEN_INSN_LIST *ilist; - - for (ilist = insns; ilist != NULL; ilist = ilist->next, ++ hentbuf) - { - unsigned int hash; - char buf[4]; - unsigned long value; - - if (! (* cd->dis_hash_p) (ilist->insn)) - continue; - - /* We don't know whether the target uses the buffer or the base insn - to hash on, so set both up. */ - - value = CGEN_INSN_BASE_VALUE (ilist->insn); - switch (CGEN_INSN_MASK_BITSIZE (ilist->insn)) - { - case 8: - buf[0] = value; - break; - case 16: - if (big_p) - bfd_putb16 ((bfd_vma) value, buf); - else - bfd_putl16 ((bfd_vma) value, buf); - break; - case 32: - if (big_p) - bfd_putb32 ((bfd_vma) value, buf); - else - bfd_putl32 ((bfd_vma) value, buf); - break; - default: - abort (); - } - - hash = (* cd->dis_hash) (buf, value); - hentbuf->next = htable [hash]; - hentbuf->insn = ilist->insn; - htable [hash] = hentbuf; - } - - return hentbuf; -} - -/* Build the disassembler instruction hash table. */ - -static void -build_dis_hash_table (cd) - CGEN_CPU_DESC cd; -{ - int count = cgen_insn_count (cd) + cgen_macro_insn_count (cd); - CGEN_INSN_TABLE *insn_table = & cd->insn_table; - CGEN_INSN_TABLE *macro_insn_table = & cd->macro_insn_table; - unsigned int hash_size = cd->dis_hash_size; - CGEN_INSN_LIST *hash_entry_buf; - CGEN_INSN_LIST **dis_hash_table; - CGEN_INSN_LIST *dis_hash_table_entries; - - /* The space allocated for the hash table consists of two parts: - the hash table and the hash lists. */ - - dis_hash_table = (CGEN_INSN_LIST **) - xmalloc (hash_size * sizeof (CGEN_INSN_LIST *)); - memset (dis_hash_table, 0, hash_size * sizeof (CGEN_INSN_LIST *)); - dis_hash_table_entries = hash_entry_buf = (CGEN_INSN_LIST *) - xmalloc (count * sizeof (CGEN_INSN_LIST)); - - /* Add compiled in insns. - Don't include the first one as it is a reserved entry. */ - /* ??? It was the end of all hash chains, and also the special - "invalid insn" marker. May be able to do it differently now. */ - - hash_entry_buf = hash_insn_array (cd, - insn_table->init_entries + 1, - insn_table->num_init_entries - 1, - insn_table->entry_size, - dis_hash_table, hash_entry_buf); - - /* Add compiled in macro-insns. */ - - hash_entry_buf = hash_insn_array (cd, macro_insn_table->init_entries, - macro_insn_table->num_init_entries, - macro_insn_table->entry_size, - dis_hash_table, hash_entry_buf); - - /* Add runtime added insns. - Later added insns will be prefered over earlier ones. */ - - hash_entry_buf = hash_insn_list (cd, insn_table->new_entries, - dis_hash_table, hash_entry_buf); - - /* Add runtime added macro-insns. */ - - hash_insn_list (cd, macro_insn_table->new_entries, - dis_hash_table, hash_entry_buf); - - cd->dis_hash_table = dis_hash_table; - cd->dis_hash_table_entries = dis_hash_table_entries; -} - -/* Return the first entry in the hash list for INSN. */ - -CGEN_INSN_LIST * -cgen_dis_lookup_insn (cd, buf, value) - CGEN_CPU_DESC cd; - const char * buf; - CGEN_INSN_INT value; -{ - unsigned int hash; - - if (cd->dis_hash_table == NULL) - build_dis_hash_table (cd); - - hash = (* cd->dis_hash) (buf, value); - - return cd->dis_hash_table[hash]; -} diff --git a/contrib/binutils/opcodes/cgen-opc.c b/contrib/binutils/opcodes/cgen-opc.c deleted file mode 100644 index ede3adde1153..000000000000 --- a/contrib/binutils/opcodes/cgen-opc.c +++ /dev/null @@ -1,621 +0,0 @@ -/* CGEN generic opcode support. - - Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc. - - This file is part of the GNU Binutils 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, 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 <ctype.h> -#include <stdio.h> -#include "ansidecl.h" -#include "libiberty.h" -#include "bfd.h" -#include "symcat.h" -#include "opcode/cgen.h" - -static unsigned int hash_keyword_name - PARAMS ((const CGEN_KEYWORD *, const char *, int)); -static unsigned int hash_keyword_value - PARAMS ((const CGEN_KEYWORD *, unsigned int)); -static void build_keyword_hash_tables - PARAMS ((CGEN_KEYWORD *)); - -/* Return number of hash table entries to use for N elements. */ -#define KEYWORD_HASH_SIZE(n) ((n) <= 31 ? 17 : 31) - -/* Look up *NAMEP in the keyword table KT. - The result is the keyword entry or NULL if not found. */ - -const CGEN_KEYWORD_ENTRY * -cgen_keyword_lookup_name (kt, name) - CGEN_KEYWORD *kt; - const char *name; -{ - const CGEN_KEYWORD_ENTRY *ke; - const char *p,*n; - - if (kt->name_hash_table == NULL) - build_keyword_hash_tables (kt); - - ke = kt->name_hash_table[hash_keyword_name (kt, name, 0)]; - - /* We do case insensitive comparisons. - If that ever becomes a problem, add an attribute that denotes - "do case sensitive comparisons". */ - - while (ke != NULL) - { - n = name; - p = ke->name; - - while (*p - && (*p == *n - || (isalpha ((unsigned char) *p) - && (tolower ((unsigned char) *p) - == tolower ((unsigned char) *n))))) - ++n, ++p; - - if (!*p && !*n) - return ke; - - ke = ke->next_name; - } - - if (kt->null_entry) - return kt->null_entry; - return NULL; -} - -/* Look up VALUE in the keyword table KT. - The result is the keyword entry or NULL if not found. */ - -const CGEN_KEYWORD_ENTRY * -cgen_keyword_lookup_value (kt, value) - CGEN_KEYWORD *kt; - int value; -{ - const CGEN_KEYWORD_ENTRY *ke; - - if (kt->name_hash_table == NULL) - build_keyword_hash_tables (kt); - - ke = kt->value_hash_table[hash_keyword_value (kt, value)]; - - while (ke != NULL) - { - if (value == ke->value) - return ke; - ke = ke->next_value; - } - - return NULL; -} - -/* Add an entry to a keyword table. */ - -void -cgen_keyword_add (kt, ke) - CGEN_KEYWORD *kt; - CGEN_KEYWORD_ENTRY *ke; -{ - unsigned int hash; - - if (kt->name_hash_table == NULL) - build_keyword_hash_tables (kt); - - hash = hash_keyword_name (kt, ke->name, 0); - ke->next_name = kt->name_hash_table[hash]; - kt->name_hash_table[hash] = ke; - - hash = hash_keyword_value (kt, ke->value); - ke->next_value = kt->value_hash_table[hash]; - kt->value_hash_table[hash] = ke; - - if (ke->name[0] == 0) - kt->null_entry = ke; -} - -/* FIXME: Need function to return count of keywords. */ - -/* Initialize a keyword table search. - SPEC is a specification of what to search for. - A value of NULL means to find every keyword. - Currently NULL is the only acceptable value [further specification - deferred]. - The result is an opaque data item used to record the search status. - It is passed to each call to cgen_keyword_search_next. */ - -CGEN_KEYWORD_SEARCH -cgen_keyword_search_init (kt, spec) - CGEN_KEYWORD *kt; - const char *spec; -{ - CGEN_KEYWORD_SEARCH search; - - /* FIXME: Need to specify format of PARAMS. */ - if (spec != NULL) - abort (); - - if (kt->name_hash_table == NULL) - build_keyword_hash_tables (kt); - - search.table = kt; - search.spec = spec; - search.current_hash = 0; - search.current_entry = NULL; - return search; -} - -/* Return the next keyword specified by SEARCH. - The result is the next entry or NULL if there are no more. */ - -const CGEN_KEYWORD_ENTRY * -cgen_keyword_search_next (search) - CGEN_KEYWORD_SEARCH *search; -{ - /* Has search finished? */ - if (search->current_hash == search->table->hash_table_size) - return NULL; - - /* Search in progress? */ - if (search->current_entry != NULL - /* Anything left on this hash chain? */ - && search->current_entry->next_name != NULL) - { - search->current_entry = search->current_entry->next_name; - return search->current_entry; - } - - /* Move to next hash chain [unless we haven't started yet]. */ - if (search->current_entry != NULL) - ++search->current_hash; - - while (search->current_hash < search->table->hash_table_size) - { - search->current_entry = search->table->name_hash_table[search->current_hash]; - if (search->current_entry != NULL) - return search->current_entry; - ++search->current_hash; - } - - return NULL; -} - -/* Return first entry in hash chain for NAME. - If CASE_SENSITIVE_P is non-zero, return a case sensitive hash. */ - -static unsigned int -hash_keyword_name (kt, name, case_sensitive_p) - const CGEN_KEYWORD *kt; - const char *name; - int case_sensitive_p; -{ - unsigned int hash; - - if (case_sensitive_p) - for (hash = 0; *name; ++name) - hash = (hash * 97) + (unsigned char) *name; - else - for (hash = 0; *name; ++name) - hash = (hash * 97) + (unsigned char) tolower (*name); - return hash % kt->hash_table_size; -} - -/* Return first entry in hash chain for VALUE. */ - -static unsigned int -hash_keyword_value (kt, value) - const CGEN_KEYWORD *kt; - unsigned int value; -{ - return value % kt->hash_table_size; -} - -/* Build a keyword table's hash tables. - We probably needn't build the value hash table for the assembler when - we're using the disassembler, but we keep things simple. */ - -static void -build_keyword_hash_tables (kt) - CGEN_KEYWORD *kt; -{ - int i; - /* Use the number of compiled in entries as an estimate for the - typical sized table [not too many added at runtime]. */ - unsigned int size = KEYWORD_HASH_SIZE (kt->num_init_entries); - - kt->hash_table_size = size; - kt->name_hash_table = (CGEN_KEYWORD_ENTRY **) - xmalloc (size * sizeof (CGEN_KEYWORD_ENTRY *)); - memset (kt->name_hash_table, 0, size * sizeof (CGEN_KEYWORD_ENTRY *)); - kt->value_hash_table = (CGEN_KEYWORD_ENTRY **) - xmalloc (size * sizeof (CGEN_KEYWORD_ENTRY *)); - memset (kt->value_hash_table, 0, size * sizeof (CGEN_KEYWORD_ENTRY *)); - - /* The table is scanned backwards as we want keywords appearing earlier to - be prefered over later ones. */ - for (i = kt->num_init_entries - 1; i >= 0; --i) - cgen_keyword_add (kt, &kt->init_entries[i]); -} - -/* Hardware support. */ - -/* Lookup a hardware element by its name. - Returns NULL if NAME is not supported by the currently selected - mach/isa. */ - -const CGEN_HW_ENTRY * -cgen_hw_lookup_by_name (cd, name) - CGEN_CPU_DESC cd; - const char *name; -{ - int i; - const CGEN_HW_ENTRY **hw = cd->hw_table.entries; - - for (i = 0; i < cd->hw_table.num_entries; ++i) - if (hw[i] && strcmp (name, hw[i]->name) == 0) - return hw[i]; - - return NULL; -} - -/* Lookup a hardware element by its number. - Hardware elements are enumerated, however it may be possible to add some - at runtime, thus HWNUM is not an enum type but rather an int. - Returns NULL if HWNUM is not supported by the currently selected mach. */ - -const CGEN_HW_ENTRY * -cgen_hw_lookup_by_num (cd, hwnum) - CGEN_CPU_DESC cd; - int hwnum; -{ - int i; - const CGEN_HW_ENTRY **hw = cd->hw_table.entries; - - /* ??? This can be speeded up. */ - for (i = 0; i < cd->hw_table.num_entries; ++i) - if (hw[i] && hwnum == hw[i]->type) - return hw[i]; - - return NULL; -} - -/* Operand support. */ - -/* Lookup an operand by its name. - Returns NULL if NAME is not supported by the currently selected - mach/isa. */ - -const CGEN_OPERAND * -cgen_operand_lookup_by_name (cd, name) - CGEN_CPU_DESC cd; - const char *name; -{ - int i; - const CGEN_OPERAND **op = cd->operand_table.entries; - - for (i = 0; i < cd->operand_table.num_entries; ++i) - if (op[i] && strcmp (name, op[i]->name) == 0) - return op[i]; - - return NULL; -} - -/* Lookup an operand by its number. - Operands are enumerated, however it may be possible to add some - at runtime, thus OPNUM is not an enum type but rather an int. - Returns NULL if OPNUM is not supported by the currently selected - mach/isa. */ - -const CGEN_OPERAND * -cgen_operand_lookup_by_num (cd, opnum) - CGEN_CPU_DESC cd; - int opnum; -{ - return cd->operand_table.entries[opnum]; -} - -/* Instruction support. */ - -/* Return number of instructions. This includes any added at runtime. */ - -int -cgen_insn_count (cd) - CGEN_CPU_DESC cd; -{ - int count = cd->insn_table.num_init_entries; - CGEN_INSN_LIST *rt_insns = cd->insn_table.new_entries; - - for ( ; rt_insns != NULL; rt_insns = rt_insns->next) - ++count; - - return count; -} - -/* Return number of macro-instructions. - This includes any added at runtime. */ - -int -cgen_macro_insn_count (cd) - CGEN_CPU_DESC cd; -{ - int count = cd->macro_insn_table.num_init_entries; - CGEN_INSN_LIST *rt_insns = cd->macro_insn_table.new_entries; - - for ( ; rt_insns != NULL; rt_insns = rt_insns->next) - ++count; - - return count; -} - -/* Cover function to read and properly byteswap an insn value. */ - -CGEN_INSN_INT -cgen_get_insn_value (cd, buf, length) - CGEN_CPU_DESC cd; - unsigned char *buf; - int length; -{ - CGEN_INSN_INT value; - - switch (length) - { - case 8: - value = *buf; - break; - case 16: - if (cd->insn_endian == CGEN_ENDIAN_BIG) - value = bfd_getb16 (buf); - else - value = bfd_getl16 (buf); - break; - case 32: - if (cd->insn_endian == CGEN_ENDIAN_BIG) - value = bfd_getb32 (buf); - else - value = bfd_getl32 (buf); - break; - default: - abort (); - } - - return value; -} - -/* Cover function to store an insn value properly byteswapped. */ - -void -cgen_put_insn_value (cd, buf, length, value) - CGEN_CPU_DESC cd; - unsigned char *buf; - int length; - CGEN_INSN_INT value; -{ - switch (length) - { - case 8: - buf[0] = value; - break; - case 16: - if (cd->insn_endian == CGEN_ENDIAN_BIG) - bfd_putb16 (value, buf); - else - bfd_putl16 (value, buf); - break; - case 32: - if (cd->insn_endian == CGEN_ENDIAN_BIG) - bfd_putb32 (value, buf); - else - bfd_putl32 (value, buf); - break; - default: - abort (); - } -} - -/* Look up instruction INSN_*_VALUE and extract its fields. - INSN_INT_VALUE is used if CGEN_INT_INSN_P. - Otherwise INSN_BYTES_VALUE is used. - INSN, if non-null, is the insn table entry. - Otherwise INSN_*_VALUE is examined to compute it. - LENGTH is the bit length of INSN_*_VALUE if known, otherwise 0. - 0 is only valid if `insn == NULL && ! CGEN_INT_INSN_P'. - If INSN != NULL, LENGTH must be valid. - ALIAS_P is non-zero if alias insns are to be included in the search. - - The result is a pointer to the insn table entry, or NULL if the instruction - wasn't recognized. */ - -/* ??? Will need to be revisited for VLIW architectures. */ - -const CGEN_INSN * -cgen_lookup_insn (cd, insn, insn_int_value, insn_bytes_value, length, fields, - alias_p) - CGEN_CPU_DESC cd; - const CGEN_INSN *insn; - CGEN_INSN_INT insn_int_value; - /* ??? CGEN_INSN_BYTES would be a nice type name to use here. */ - unsigned char *insn_bytes_value; - int length; - CGEN_FIELDS *fields; - int alias_p; -{ - unsigned char *buf; - CGEN_INSN_INT base_insn; - CGEN_EXTRACT_INFO ex_info; - CGEN_EXTRACT_INFO *info; - - if (cd->int_insn_p) - { - info = NULL; - buf = (unsigned char *) alloca (cd->max_insn_bitsize / 8); - cgen_put_insn_value (cd, buf, length, insn_int_value); - base_insn = insn_int_value; - } - else - { - info = &ex_info; - ex_info.dis_info = NULL; - ex_info.insn_bytes = insn_bytes_value; - ex_info.valid = -1; - buf = insn_bytes_value; - base_insn = cgen_get_insn_value (cd, buf, length); - } - - if (!insn) - { - const CGEN_INSN_LIST *insn_list; - - /* The instructions are stored in hash lists. - Pick the first one and keep trying until we find the right one. */ - - insn_list = cgen_dis_lookup_insn (cd, buf, base_insn); - while (insn_list != NULL) - { - insn = insn_list->insn; - - if (alias_p - /* FIXME: Ensure ALIAS attribute always has same index. */ - || ! CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_ALIAS)) - { - /* Basic bit mask must be correct. */ - /* ??? May wish to allow target to defer this check until the - extract handler. */ - if ((base_insn & CGEN_INSN_BASE_MASK (insn)) - == CGEN_INSN_BASE_VALUE (insn)) - { - /* ??? 0 is passed for `pc' */ - int elength = CGEN_EXTRACT_FN (cd, insn) - (cd, insn, info, base_insn, fields, (bfd_vma) 0); - if (elength > 0) - { - /* sanity check */ - if (length != 0 && length != elength) - abort (); - return insn; - } - } - } - - insn_list = insn_list->next; - } - } - else - { - /* Sanity check: can't pass an alias insn if ! alias_p. */ - if (! alias_p - && CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_ALIAS)) - abort (); - /* Sanity check: length must be correct. */ - if (length != CGEN_INSN_BITSIZE (insn)) - abort (); - - /* ??? 0 is passed for `pc' */ - length = CGEN_EXTRACT_FN (cd, insn) - (cd, insn, info, base_insn, fields, (bfd_vma) 0); - /* Sanity check: must succeed. - Could relax this later if it ever proves useful. */ - if (length == 0) - abort (); - return insn; - } - - return NULL; -} - -/* Fill in the operand instances used by INSN whose operands are FIELDS. - INDICES is a pointer to a buffer of MAX_OPERAND_INSTANCES ints to be filled - in. */ - -void -cgen_get_insn_operands (cd, insn, fields, indices) - CGEN_CPU_DESC cd; - const CGEN_INSN *insn; - const CGEN_FIELDS *fields; - int *indices; -{ - const CGEN_OPINST *opinst; - int i; - - if (insn->opinst == NULL) - abort (); - for (i = 0, opinst = insn->opinst; opinst->type != CGEN_OPINST_END; ++i, ++opinst) - { - enum cgen_operand_type op_type = opinst->op_type; - if (op_type == CGEN_OPERAND_NIL) - indices[i] = opinst->index; - else - indices[i] = (*cd->get_int_operand) (cd, op_type, fields); - } -} - -/* Cover function to cgen_get_insn_operands when either INSN or FIELDS - isn't known. - The INSN, INSN_*_VALUE, and LENGTH arguments are passed to - cgen_lookup_insn unchanged. - INSN_INT_VALUE is used if CGEN_INT_INSN_P. - Otherwise INSN_BYTES_VALUE is used. - - The result is the insn table entry or NULL if the instruction wasn't - recognized. */ - -const CGEN_INSN * -cgen_lookup_get_insn_operands (cd, insn, insn_int_value, insn_bytes_value, - length, indices, fields) - CGEN_CPU_DESC cd; - const CGEN_INSN *insn; - CGEN_INSN_INT insn_int_value; - /* ??? CGEN_INSN_BYTES would be a nice type name to use here. */ - unsigned char *insn_bytes_value; - int length; - int *indices; - CGEN_FIELDS *fields; -{ - /* Pass non-zero for ALIAS_P only if INSN != NULL. - If INSN == NULL, we want a real insn. */ - insn = cgen_lookup_insn (cd, insn, insn_int_value, insn_bytes_value, - length, fields, insn != NULL); - if (! insn) - return NULL; - - cgen_get_insn_operands (cd, insn, fields, indices); - return insn; -} - -/* Allow signed overflow of instruction fields. */ -void -cgen_set_signed_overflow_ok (cd) - CGEN_CPU_DESC cd; -{ - cd->signed_overflow_ok_p = 1; -} - -/* Generate an error message if a signed field in an instruction overflows. */ -void -cgen_clear_signed_overflow_ok (cd) - CGEN_CPU_DESC cd; -{ - cd->signed_overflow_ok_p = 0; -} - -/* Will an error message be generated if a signed field in an instruction overflows ? */ -unsigned int -cgen_signed_overflow_ok_p (cd) - CGEN_CPU_DESC cd; -{ - return cd->signed_overflow_ok_p; -} diff --git a/contrib/binutils/opcodes/sh-dis.c b/contrib/binutils/opcodes/sh-dis.c deleted file mode 100644 index c4e960c24e8b..000000000000 --- a/contrib/binutils/opcodes/sh-dis.c +++ /dev/null @@ -1,734 +0,0 @@ -/* Disassemble SH instructions. - Copyright (C) 1993, 94, 95, 96, 97, 1998 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 <stdio.h> -#define STATIC_TABLE -#define DEFINE_TABLE - -#include "sh-opc.h" -#include "dis-asm.h" - -#define LITTLE_BIT 2 - -static void -print_movxy (op, rn, rm, fprintf_fn, stream) - sh_opcode_info *op; - int rn, rm; - fprintf_ftype fprintf_fn; - void *stream; -{ - int n; - - fprintf_fn (stream,"%s\t", op->name); - for (n = 0; n < 2; n++) - { - switch (op->arg[n]) - { - case A_IND_N: - fprintf_fn (stream, "@r%d", rn); - break; - case A_INC_N: - fprintf_fn (stream, "@r%d+", rn); - break; - case A_PMOD_N: - fprintf_fn (stream, "@r%d+r8", rn); - break; - case A_PMODY_N: - fprintf_fn (stream, "@r%d+r9", rn); - break; - case DSP_REG_M: - fprintf_fn (stream, "a%c", '0' + rm); - break; - case DSP_REG_X: - fprintf_fn (stream, "x%c", '0' + rm); - break; - case DSP_REG_Y: - fprintf_fn (stream, "y%c", '0' + rm); - break; - default: - abort (); - } - if (n == 0) - fprintf_fn (stream, ","); - } -} - -/* Print a double data transfer insn. INSN is just the lower three - nibbles of the insn, i.e. field a and the bit that indicates if - a parallel processing insn follows. - Return nonzero if a field b of a parallel processing insns follows. */ -static void -print_insn_ddt (insn, info) - int insn; - struct disassemble_info *info; -{ - fprintf_ftype fprintf_fn = info->fprintf_func; - void *stream = info->stream; - - /* If this is just a nop, make sure to emit something. */ - if (insn == 0x000) - fprintf_fn (stream, "nopx\tnopy"); - - /* If a parallel processing insn was printed before, - and we got a non-nop, emit a tab. */ - if ((insn & 0x800) && (insn & 0x3ff)) - fprintf_fn (stream, "\t"); - - /* Check if either the x or y part is invalid. */ - if (((insn & 0xc) == 0 && (insn & 0x2a0)) - || ((insn & 3) == 0 && (insn & 0x150))) - fprintf_fn (stream, ".word 0x%x", insn); - else - { - static sh_opcode_info *first_movx, *first_movy; - sh_opcode_info *opx, *opy; - int insn_x, insn_y; - - if (! first_movx) - { - for (first_movx = sh_table; first_movx->nibbles[1] != MOVX; ) - first_movx++; - for (first_movy = first_movx; first_movy->nibbles[1] != MOVY; ) - first_movy++; - } - insn_x = (insn >> 2) & 0xb; - if (insn_x) - { - for (opx = first_movx; opx->nibbles[2] != insn_x; ) opx++; - print_movxy (opx, ((insn >> 9) & 1) + 4, (insn >> 7) & 1, - fprintf_fn, stream); - } - insn_y = (insn & 3) | ((insn >> 1) & 8); - if (insn_y) - { - if (insn_x) - fprintf_fn (stream, "\t"); - for (opy = first_movy; opy->nibbles[2] != insn_y; ) opy++; - print_movxy (opy, ((insn >> 8) & 1) + 6, (insn >> 6) & 1, - fprintf_fn, stream); - } - } -} - -static void -print_dsp_reg (rm, fprintf_fn, stream) - int rm; - fprintf_ftype fprintf_fn; - void *stream; -{ - switch (rm) - { - case A_A1_NUM: - fprintf_fn (stream, "a1"); - break; - case A_A0_NUM: - fprintf_fn (stream, "a0"); - break; - case A_X0_NUM: - fprintf_fn (stream, "x0"); - break; - case A_X1_NUM: - fprintf_fn (stream, "x1"); - break; - case A_Y0_NUM: - fprintf_fn (stream, "y0"); - break; - case A_Y1_NUM: - fprintf_fn (stream, "y1"); - break; - case A_M0_NUM: - fprintf_fn (stream, "m0"); - break; - case A_A1G_NUM: - fprintf_fn (stream, "a1g"); - break; - case A_M1_NUM: - fprintf_fn (stream, "m1"); - break; - case A_A0G_NUM: - fprintf_fn (stream, "a0g"); - break; - default: - fprintf_fn (stream, "0x%x", rm); - break; - } -} - -static void -print_insn_ppi (field_b, info) - int field_b; - struct disassemble_info *info; -{ - static char *sx_tab[] = {"x0","x1","a0","a1"}; - static char *sy_tab[] = {"y0","y1","m0","m1"}; - fprintf_ftype fprintf_fn = info->fprintf_func; - void *stream = info->stream; - int nib1, nib2, nib3; - char *dc; - sh_opcode_info *op; - - if ((field_b & 0xe800) == 0) - { - fprintf_fn (stream, "psh%c\t#%d,", - field_b & 0x1000 ? 'a' : 'l', - (field_b >> 4) & 127); - print_dsp_reg (field_b & 0xf, fprintf_fn, stream); - return; - } - if ((field_b & 0xc000) == 0x4000 && (field_b & 0x3000) != 0x1000) - { - static char *du_tab[] = {"x0","y0","a0","a1"}; - static char *se_tab[] = {"x0","x1","y0","a1"}; - static char *sf_tab[] = {"y0","y1","x0","a1"}; - static char *sg_tab[] = {"m0","m1","a0","a1"}; - - if (field_b & 0x2000) - { - fprintf_fn (stream, "p%s %s,%s,%s\t", - (field_b & 0x1000) ? "add" : "sub", - sx_tab[(field_b >> 6) & 3], - sy_tab[(field_b >> 4) & 3], - du_tab[(field_b >> 0) & 3]); - } - fprintf_fn (stream, "pmuls%c%s,%s,%s", - field_b & 0x2000 ? ' ' : '\t', - se_tab[(field_b >> 10) & 3], - sf_tab[(field_b >> 8) & 3], - sg_tab[(field_b >> 2) & 3]); - return; - } - - nib1 = PPIC; - nib2 = field_b >> 12 & 0xf; - nib3 = field_b >> 8 & 0xf; - switch (nib3 & 0x3) - { - case 0: - dc = ""; - nib1 = PPI3; - break; - case 1: - dc = ""; - break; - case 2: - dc = "dct "; - nib3 -= 1; - break; - case 3: - dc = "dcf "; - nib3 -= 2; - break; - } - for (op = sh_table; op->name; op++) - { - if (op->nibbles[1] == nib1 - && op->nibbles[2] == nib2 - && op->nibbles[3] == nib3) - { - int n; - - fprintf_fn (stream, "%s%s\t", dc, op->name); - for (n = 0; n < 3 && op->arg[n] != A_END; n++) - { - if (n && op->arg[1] != A_END) - fprintf_fn (stream, ","); - switch (op->arg[n]) - { - case DSP_REG_N: - print_dsp_reg (field_b & 0xf, fprintf_fn, stream); - break; - case DSP_REG_X: - fprintf_fn (stream, sx_tab[(field_b >> 6) & 3]); - break; - case DSP_REG_Y: - fprintf_fn (stream, sy_tab[(field_b >> 4) & 3]); - break; - case A_MACH: - fprintf_fn (stream, "mach"); - break; - case A_MACL: - fprintf_fn (stream ,"macl"); - break; - default: - abort (); - } - } - return; - } - } - /* Not found. */ - fprintf_fn (stream, ".word 0x%x", field_b); -} - -static int -print_insn_shx (memaddr, info) - bfd_vma memaddr; - struct disassemble_info *info; -{ - fprintf_ftype fprintf_fn = info->fprintf_func; - void *stream = info->stream; - unsigned char insn[2]; - unsigned char nibs[4]; - int status; - bfd_vma relmask = ~ (bfd_vma) 0; - sh_opcode_info *op; - int target_arch; - - switch (info->mach) - { - case bfd_mach_sh: - target_arch = arch_sh1; - break; - case bfd_mach_sh2: - target_arch = arch_sh2; - break; - case bfd_mach_sh_dsp: - target_arch = arch_sh_dsp; - break; - case bfd_mach_sh3: - target_arch = arch_sh3; - break; - case bfd_mach_sh3_dsp: - target_arch = arch_sh3_dsp; - break; - case bfd_mach_sh3e: - target_arch = arch_sh3e; - break; - case bfd_mach_sh4: - target_arch = arch_sh4; - break; - default: - abort (); - } - - status = info->read_memory_func (memaddr, insn, 2, info); - - if (status != 0) - { - info->memory_error_func (status, memaddr, info); - return -1; - } - - if (info->flags & LITTLE_BIT) - { - nibs[0] = (insn[1] >> 4) & 0xf; - nibs[1] = insn[1] & 0xf; - - nibs[2] = (insn[0] >> 4) & 0xf; - nibs[3] = insn[0] & 0xf; - } - else - { - nibs[0] = (insn[0] >> 4) & 0xf; - nibs[1] = insn[0] & 0xf; - - nibs[2] = (insn[1] >> 4) & 0xf; - nibs[3] = insn[1] & 0xf; - } - - if (nibs[0] == 0xf && (nibs[1] & 4) == 0 && target_arch & arch_sh_dsp_up) - { - if (nibs[1] & 8) - { - int field_b; - - status = info->read_memory_func (memaddr + 2, insn, 2, info); - - if (status != 0) - { - info->memory_error_func (status, memaddr + 2, info); - return -1; - } - - if (info->flags & LITTLE_BIT) - field_b = insn[1] << 8 | insn[0]; - else - field_b = insn[0] << 8 | insn[1]; - - print_insn_ppi (field_b, info); - print_insn_ddt ((nibs[1] << 8) | (nibs[2] << 4) | nibs[3], info); - return 4; - } - print_insn_ddt ((nibs[1] << 8) | (nibs[2] << 4) | nibs[3], info); - return 2; - } - for (op = sh_table; op->name; op++) - { - int n; - int imm = 0; - int rn = 0; - int rm = 0; - int rb = 0; - int disp_pc; - bfd_vma disp_pc_addr = 0; - - if ((op->arch & target_arch) == 0) - goto fail; - for (n = 0; n < 4; n++) - { - int i = op->nibbles[n]; - - if (i < 16) - { - if (nibs[n] == i) - continue; - goto fail; - } - switch (i) - { - case BRANCH_8: - imm = (nibs[2] << 4) | (nibs[3]); - if (imm & 0x80) - imm |= ~0xff; - imm = ((char)imm) * 2 + 4 ; - goto ok; - case BRANCH_12: - imm = ((nibs[1]) << 8) | (nibs[2] << 4) | (nibs[3]); - if (imm & 0x800) - imm |= ~0xfff; - imm = imm * 2 + 4; - goto ok; - case IMM_4: - imm = nibs[3]; - goto ok; - case IMM_4BY2: - imm = nibs[3] <<1; - goto ok; - case IMM_4BY4: - imm = nibs[3] <<2; - goto ok; - case IMM_8: - imm = (nibs[2] << 4) | nibs[3]; - goto ok; - case PCRELIMM_8BY2: - imm = ((nibs[2] << 4) | nibs[3]) <<1; - relmask = ~ (bfd_vma) 1; - goto ok; - case PCRELIMM_8BY4: - imm = ((nibs[2] << 4) | nibs[3]) <<2; - relmask = ~ (bfd_vma) 3; - goto ok; - case IMM_8BY2: - imm = ((nibs[2] << 4) | nibs[3]) <<1; - goto ok; - case IMM_8BY4: - imm = ((nibs[2] << 4) | nibs[3]) <<2; - goto ok; - case DISP_8: - imm = (nibs[2] << 4) | (nibs[3]); - goto ok; - case DISP_4: - imm = nibs[3]; - goto ok; - case REG_N: - rn = nibs[n]; - break; - case REG_M: - rm = nibs[n]; - break; - case REG_NM: - rn = (nibs[n] & 0xc) >> 2; - rm = (nibs[n] & 0x3); - break; - case REG_B: - rb = nibs[n] & 0x07; - break; - case SDT_REG_N: - /* sh-dsp: single data transfer. */ - rn = nibs[n]; - if ((rn & 0xc) != 4) - goto fail; - rn = rn & 0x3; - rn |= (rn & 2) << 1; - break; - case PPI: - goto fail; - default: - abort(); - } - } - - ok: - fprintf_fn (stream,"%s\t", op->name); - disp_pc = 0; - for (n = 0; n < 3 && op->arg[n] != A_END; n++) - { - if (n && op->arg[1] != A_END) - fprintf_fn (stream, ","); - switch (op->arg[n]) - { - case A_IMM: - fprintf_fn (stream, "#%d", (char)(imm)); - break; - case A_R0: - fprintf_fn (stream, "r0"); - break; - case A_REG_N: - fprintf_fn (stream, "r%d", rn); - break; - case A_INC_N: - fprintf_fn (stream, "@r%d+", rn); - break; - case A_DEC_N: - fprintf_fn (stream, "@-r%d", rn); - break; - case A_IND_N: - fprintf_fn (stream, "@r%d", rn); - break; - case A_DISP_REG_N: - fprintf_fn (stream, "@(%d,r%d)", imm, rn); - break; - case A_PMOD_N: - fprintf_fn (stream, "@r%d+r8", rn); - break; - case A_REG_M: - fprintf_fn (stream, "r%d", rm); - break; - case A_INC_M: - fprintf_fn (stream, "@r%d+", rm); - break; - case A_DEC_M: - fprintf_fn (stream, "@-r%d", rm); - break; - case A_IND_M: - fprintf_fn (stream, "@r%d", rm); - break; - case A_DISP_REG_M: - fprintf_fn (stream, "@(%d,r%d)", imm, rm); - break; - case A_REG_B: - fprintf_fn (stream, "r%d_bank", rb); - break; - case A_DISP_PC: - disp_pc = 1; - disp_pc_addr = imm + 4 + (memaddr & relmask); - (*info->print_address_func) (disp_pc_addr, info); - break; - case A_IND_R0_REG_N: - fprintf_fn (stream, "@(r0,r%d)", rn); - break; - case A_IND_R0_REG_M: - fprintf_fn (stream, "@(r0,r%d)", rm); - break; - case A_DISP_GBR: - fprintf_fn (stream, "@(%d,gbr)",imm); - break; - case A_R0_GBR: - fprintf_fn (stream, "@(r0,gbr)"); - break; - case A_BDISP12: - case A_BDISP8: - (*info->print_address_func) (imm + memaddr, info); - break; - case A_SR: - fprintf_fn (stream, "sr"); - break; - case A_GBR: - fprintf_fn (stream, "gbr"); - break; - case A_VBR: - fprintf_fn (stream, "vbr"); - break; - case A_DSR: - fprintf_fn (stream, "dsr"); - break; - case A_MOD: - fprintf_fn (stream, "mod"); - break; - case A_RE: - fprintf_fn (stream, "re"); - break; - case A_RS: - fprintf_fn (stream, "rs"); - break; - case A_A0: - fprintf_fn (stream, "a0"); - break; - case A_X0: - fprintf_fn (stream, "x0"); - break; - case A_X1: - fprintf_fn (stream, "x1"); - break; - case A_Y0: - fprintf_fn (stream, "y0"); - break; - case A_Y1: - fprintf_fn (stream, "y1"); - break; - case DSP_REG_M: - print_dsp_reg (rm, fprintf_fn, stream); - break; - case A_SSR: - fprintf_fn (stream, "ssr"); - break; - case A_SPC: - fprintf_fn (stream, "spc"); - break; - case A_MACH: - fprintf_fn (stream, "mach"); - break; - case A_MACL: - fprintf_fn (stream ,"macl"); - break; - case A_PR: - fprintf_fn (stream, "pr"); - break; - case A_SGR: - fprintf_fn (stream, "sgr"); - break; - case A_DBR: - fprintf_fn (stream, "dbr"); - break; - case F_REG_N: - fprintf_fn (stream, "fr%d", rn); - break; - case F_REG_M: - fprintf_fn (stream, "fr%d", rm); - break; - case DX_REG_N: - if (rn & 1) - { - fprintf_fn (stream, "xd%d", rn & ~1); - break; - } - d_reg_n: - case D_REG_N: - fprintf_fn (stream, "dr%d", rn); - break; - case DX_REG_M: - if (rm & 1) - { - fprintf_fn (stream, "xd%d", rm & ~1); - break; - } - case D_REG_M: - fprintf_fn (stream, "dr%d", rm); - break; - case FPSCR_M: - case FPSCR_N: - fprintf_fn (stream, "fpscr"); - break; - case FPUL_M: - case FPUL_N: - fprintf_fn (stream, "fpul"); - break; - case F_FR0: - fprintf_fn (stream, "fr0"); - break; - case V_REG_N: - fprintf_fn (stream, "fv%d", rn*4); - break; - case V_REG_M: - fprintf_fn (stream, "fv%d", rm*4); - break; - case XMTRX_M4: - fprintf_fn (stream, "xmtrx"); - break; - default: - abort(); - } - } - -#if 0 - /* This code prints instructions in delay slots on the same line - as the instruction which needs the delay slots. This can be - confusing, since other disassembler don't work this way, and - it means that the instructions are not all in a line. So I - disabled it. Ian. */ - if (!(info->flags & 1) - && (op->name[0] == 'j' - || (op->name[0] == 'b' - && (op->name[1] == 'r' - || op->name[1] == 's')) - || (op->name[0] == 'r' && op->name[1] == 't') - || (op->name[0] == 'b' && op->name[2] == '.'))) - { - info->flags |= 1; - fprintf_fn (stream, "\t(slot "); - print_insn_shx (memaddr + 2, info); - info->flags &= ~1; - fprintf_fn (stream, ")"); - return 4; - } -#endif - - if (disp_pc && strcmp (op->name, "mova") != 0) - { - int size; - bfd_byte bytes[4]; - - if (relmask == ~ (bfd_vma) 1) - size = 2; - else - size = 4; - status = info->read_memory_func (disp_pc_addr, bytes, size, info); - if (status == 0) - { - unsigned int val; - - if (size == 2) - { - if ((info->flags & LITTLE_BIT) != 0) - val = bfd_getl16 (bytes); - else - val = bfd_getb16 (bytes); - } - else - { - if ((info->flags & LITTLE_BIT) != 0) - val = bfd_getl32 (bytes); - else - val = bfd_getb32 (bytes); - } - fprintf_fn (stream, "\t! 0x%x", val); - } - } - - return 2; - fail: - ; - - } - fprintf_fn (stream, ".word 0x%x%x%x%x", nibs[0], nibs[1], nibs[2], nibs[3]); - return 2; -} - -int -print_insn_shl (memaddr, info) - bfd_vma memaddr; - struct disassemble_info *info; -{ - int r; - - info->flags = LITTLE_BIT; - r = print_insn_shx (memaddr, info); - return r; -} - -int -print_insn_sh (memaddr, info) - bfd_vma memaddr; - struct disassemble_info *info; -{ - int r; - - info->flags = 0; - r = print_insn_shx (memaddr, info); - return r; -} diff --git a/contrib/binutils/opcodes/sh-opc.h b/contrib/binutils/opcodes/sh-opc.h deleted file mode 100644 index 38bfbcde4b62..000000000000 --- a/contrib/binutils/opcodes/sh-opc.h +++ /dev/null @@ -1,830 +0,0 @@ -/* Definitions for SH opcodes. - Copyright (C) 1993, 94, 95, 96, 1997 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. */ - -typedef enum { - HEX_0, - HEX_1, - HEX_2, - HEX_3, - HEX_4, - HEX_5, - HEX_6, - HEX_7, - HEX_8, - HEX_9, - HEX_A, - HEX_B, - HEX_C, - HEX_D, - HEX_E, - HEX_F, - REG_N, - REG_M, - SDT_REG_N, - REG_NM, - REG_B, - BRANCH_12, - BRANCH_8, - DISP_8, - DISP_4, - IMM_4, - IMM_4BY2, - IMM_4BY4, - PCRELIMM_8BY2, - PCRELIMM_8BY4, - IMM_8, - IMM_8BY2, - IMM_8BY4, - PPI, - NOPX, - NOPY, - MOVX, - MOVY, - PSH, - PMUL, - PPI3, - PDC, - PPIC -} sh_nibble_type; - -typedef enum { - A_END, - A_BDISP12, - A_BDISP8, - A_DEC_M, - A_DEC_N, - A_DISP_GBR, - A_DISP_PC, - A_DISP_REG_M, - A_DISP_REG_N, - A_GBR, - A_IMM, - A_INC_M, - A_INC_N, - A_IND_M, - A_IND_N, - A_PMOD_N, - A_PMODY_N, - A_IND_R0_REG_M, - A_IND_R0_REG_N, - A_MACH, - A_MACL, - A_PR, - A_R0, - A_R0_GBR, - A_REG_M, - A_REG_N, - A_REG_B, - A_SR, - A_VBR, - A_MOD, - A_RE, - A_RS, - A_DSR, - DSP_REG_M, - DSP_REG_N, - DSP_REG_X, - DSP_REG_Y, - DSP_REG_E, - DSP_REG_F, - DSP_REG_G, - A_A0, - A_X0, - A_X1, - A_Y0, - A_Y1, - A_SSR, - A_SPC, - A_SGR, - A_DBR, - F_REG_N, - F_REG_M, - D_REG_N, - D_REG_M, - X_REG_N, /* Only used for argument parsing */ - X_REG_M, /* Only used for argument parsing */ - DX_REG_N, - DX_REG_M, - V_REG_N, - V_REG_M, - XMTRX_M4, - F_FR0, - FPUL_N, - FPUL_M, - FPSCR_N, - FPSCR_M -} sh_arg_type; - -typedef enum { - A_A1_NUM = 5, - A_A0_NUM = 7, - A_X0_NUM, A_X1_NUM, A_Y0_NUM, A_Y1_NUM, - A_M0_NUM, A_A1G_NUM, A_M1_NUM, A_A0G_NUM -} sh_dsp_reg_nums; - -#define arch_sh1 0x0001 -#define arch_sh2 0x0002 -#define arch_sh3 0x0004 -#define arch_sh3e 0x0008 -#define arch_sh4 0x0010 -#define arch_sh_dsp 0x0100 -#define arch_sh3_dsp 0x0200 - -#define arch_sh1_up (arch_sh1 | arch_sh2_up) -#define arch_sh2_up (arch_sh2 | arch_sh3_up | arch_sh_dsp) -#define arch_sh3_up (arch_sh3 | arch_sh3e_up | arch_sh3_dsp) -#define arch_sh3e_up (arch_sh3e | arch_sh4_up) -#define arch_sh4_up arch_sh4 - -#define arch_sh_dsp_up (arch_sh_dsp | arch_sh3_dsp_up) -#define arch_sh3_dsp_up arch_sh3_dsp - -typedef struct { - char *name; - sh_arg_type arg[4]; - sh_nibble_type nibbles[4]; - int arch; -} sh_opcode_info; - -#ifdef DEFINE_TABLE - -sh_opcode_info sh_table[] = { - -/* 0111nnnni8*1.... add #<imm>,<REG_N> */{"add",{A_IMM,A_REG_N},{HEX_7,REG_N,IMM_8}, arch_sh1_up}, - -/* 0011nnnnmmmm1100 add <REG_M>,<REG_N> */{"add",{ A_REG_M,A_REG_N},{HEX_3,REG_N,REG_M,HEX_C}, arch_sh1_up}, - -/* 0011nnnnmmmm1110 addc <REG_M>,<REG_N>*/{"addc",{ A_REG_M,A_REG_N},{HEX_3,REG_N,REG_M,HEX_E}, arch_sh1_up}, - -/* 0011nnnnmmmm1111 addv <REG_M>,<REG_N>*/{"addv",{ A_REG_M,A_REG_N},{HEX_3,REG_N,REG_M,HEX_F}, arch_sh1_up}, - -/* 11001001i8*1.... and #<imm>,R0 */{"and",{A_IMM,A_R0},{HEX_C,HEX_9,IMM_8}, arch_sh1_up}, - -/* 0010nnnnmmmm1001 and <REG_M>,<REG_N> */{"and",{ A_REG_M,A_REG_N},{HEX_2,REG_N,REG_M,HEX_9}, arch_sh1_up}, - -/* 11001101i8*1.... and.b #<imm>,@(R0,GBR)*/{"and.b",{A_IMM,A_R0_GBR},{HEX_C,HEX_D,IMM_8}, arch_sh1_up}, - -/* 1010i12......... bra <bdisp12> */{"bra",{A_BDISP12},{HEX_A,BRANCH_12}, arch_sh1_up}, - -/* 1011i12......... bsr <bdisp12> */{"bsr",{A_BDISP12},{HEX_B,BRANCH_12}, arch_sh1_up}, - -/* 10001001i8p1.... bt <bdisp8> */{"bt",{A_BDISP8},{HEX_8,HEX_9,BRANCH_8}, arch_sh1_up}, - -/* 10001011i8p1.... bf <bdisp8> */{"bf",{A_BDISP8},{HEX_8,HEX_B,BRANCH_8}, arch_sh1_up}, - -/* 10001101i8p1.... bt.s <bdisp8> */{"bt.s",{A_BDISP8},{HEX_8,HEX_D,BRANCH_8}, arch_sh2_up}, - -/* 10001101i8p1.... bt/s <bdisp8> */{"bt/s",{A_BDISP8},{HEX_8,HEX_D,BRANCH_8}, arch_sh2_up}, - -/* 10001111i8p1.... bf.s <bdisp8> */{"bf.s",{A_BDISP8},{HEX_8,HEX_F,BRANCH_8}, arch_sh2_up}, - -/* 10001111i8p1.... bf/s <bdisp8> */{"bf/s",{A_BDISP8},{HEX_8,HEX_F,BRANCH_8}, arch_sh2_up}, - -/* 0000000000101000 clrmac */{"clrmac",{0},{HEX_0,HEX_0,HEX_2,HEX_8}, arch_sh1_up}, - -/* 0000000001001000 clrs */{"clrs",{0},{HEX_0,HEX_0,HEX_4,HEX_8}, arch_sh1_up}, - -/* 0000000000001000 clrt */{"clrt",{0},{HEX_0,HEX_0,HEX_0,HEX_8}, arch_sh1_up}, - -/* 10001000i8*1.... cmp/eq #<imm>,R0 */{"cmp/eq",{A_IMM,A_R0},{HEX_8,HEX_8,IMM_8}, arch_sh1_up}, - -/* 0011nnnnmmmm0000 cmp/eq <REG_M>,<REG_N>*/{"cmp/eq",{ A_REG_M,A_REG_N},{HEX_3,REG_N,REG_M,HEX_0}, arch_sh1_up}, - -/* 0011nnnnmmmm0011 cmp/ge <REG_M>,<REG_N>*/{"cmp/ge",{ A_REG_M,A_REG_N},{HEX_3,REG_N,REG_M,HEX_3}, arch_sh1_up}, - -/* 0011nnnnmmmm0111 cmp/gt <REG_M>,<REG_N>*/{"cmp/gt",{ A_REG_M,A_REG_N},{HEX_3,REG_N,REG_M,HEX_7}, arch_sh1_up}, - -/* 0011nnnnmmmm0110 cmp/hi <REG_M>,<REG_N>*/{"cmp/hi",{ A_REG_M,A_REG_N},{HEX_3,REG_N,REG_M,HEX_6}, arch_sh1_up}, - -/* 0011nnnnmmmm0010 cmp/hs <REG_M>,<REG_N>*/{"cmp/hs",{ A_REG_M,A_REG_N},{HEX_3,REG_N,REG_M,HEX_2}, arch_sh1_up}, - -/* 0100nnnn00010101 cmp/pl <REG_N> */{"cmp/pl",{A_REG_N},{HEX_4,REG_N,HEX_1,HEX_5}, arch_sh1_up}, - -/* 0100nnnn00010001 cmp/pz <REG_N> */{"cmp/pz",{A_REG_N},{HEX_4,REG_N,HEX_1,HEX_1}, arch_sh1_up}, - -/* 0010nnnnmmmm1100 cmp/str <REG_M>,<REG_N>*/{"cmp/str",{ A_REG_M,A_REG_N},{HEX_2,REG_N,REG_M,HEX_C}, arch_sh1_up}, - -/* 0010nnnnmmmm0111 div0s <REG_M>,<REG_N>*/{"div0s",{ A_REG_M,A_REG_N},{HEX_2,REG_N,REG_M,HEX_7}, arch_sh1_up}, - -/* 0000000000011001 div0u */{"div0u",{0},{HEX_0,HEX_0,HEX_1,HEX_9}, arch_sh1_up}, - -/* 0011nnnnmmmm0100 div1 <REG_M>,<REG_N>*/{"div1",{ A_REG_M,A_REG_N},{HEX_3,REG_N,REG_M,HEX_4}, arch_sh1_up}, - -/* 0110nnnnmmmm1110 exts.b <REG_M>,<REG_N>*/{"exts.b",{ A_REG_M,A_REG_N},{HEX_6,REG_N,REG_M,HEX_E}, arch_sh1_up}, - -/* 0110nnnnmmmm1111 exts.w <REG_M>,<REG_N>*/{"exts.w",{ A_REG_M,A_REG_N},{HEX_6,REG_N,REG_M,HEX_F}, arch_sh1_up}, - -/* 0110nnnnmmmm1100 extu.b <REG_M>,<REG_N>*/{"extu.b",{ A_REG_M,A_REG_N},{HEX_6,REG_N,REG_M,HEX_C}, arch_sh1_up}, - -/* 0110nnnnmmmm1101 extu.w <REG_M>,<REG_N>*/{"extu.w",{ A_REG_M,A_REG_N},{HEX_6,REG_N,REG_M,HEX_D}, arch_sh1_up}, - -/* 0100nnnn00101011 jmp @<REG_N> */{"jmp",{A_IND_N},{HEX_4,REG_N,HEX_2,HEX_B}, arch_sh1_up}, - -/* 0100nnnn00001011 jsr @<REG_N> */{"jsr",{A_IND_N},{HEX_4,REG_N,HEX_0,HEX_B}, arch_sh1_up}, - -/* 0100nnnn00001110 ldc <REG_N>,SR */{"ldc",{A_REG_N,A_SR},{HEX_4,REG_N,HEX_0,HEX_E}, arch_sh1_up}, - -/* 0100nnnn00011110 ldc <REG_N>,GBR */{"ldc",{A_REG_N,A_GBR},{HEX_4,REG_N,HEX_1,HEX_E}, arch_sh1_up}, - -/* 0100nnnn00101110 ldc <REG_N>,VBR */{"ldc",{A_REG_N,A_VBR},{HEX_4,REG_N,HEX_2,HEX_E}, arch_sh1_up}, - -/* 0100nnnn01011110 ldc <REG_N>,MOD */{"ldc",{A_REG_N,A_MOD},{HEX_4,REG_N,HEX_5,HEX_E}, arch_sh_dsp_up}, - -/* 0100nnnn01111110 ldc <REG_N>,RE */{"ldc",{A_REG_N,A_RE},{HEX_4,REG_N,HEX_7,HEX_E}, arch_sh_dsp_up}, - -/* 0100nnnn01101110 ldc <REG_N>,RS */{"ldc",{A_REG_N,A_RS},{HEX_4,REG_N,HEX_6,HEX_E}, arch_sh_dsp_up}, - -/* 0100nnnn00111110 ldc <REG_N>,SSR */{"ldc",{A_REG_N,A_SSR},{HEX_4,REG_N,HEX_3,HEX_E}, arch_sh3_up}, - -/* 0100nnnn01001110 ldc <REG_N>,SPC */{"ldc",{A_REG_N,A_SPC},{HEX_4,REG_N,HEX_4,HEX_E}, arch_sh3_up}, - -/* 0100nnnn11111010 ldc <REG_N>,DBR */{"ldc",{A_REG_N,A_DBR},{HEX_4,REG_N,HEX_F,HEX_A}, arch_sh4_up}, - -/* 0100nnnn1xxx1110 ldc <REG_N>,Rn_BANK */{"ldc",{A_REG_N,A_REG_B},{HEX_4,REG_N,REG_B,HEX_E}, arch_sh3_up}, - -/* 0100nnnn00000111 ldc.l @<REG_N>+,SR */{"ldc.l",{A_INC_N,A_SR},{HEX_4,REG_N,HEX_0,HEX_7}, arch_sh1_up}, - -/* 0100nnnn00010111 ldc.l @<REG_N>+,GBR */{"ldc.l",{A_INC_N,A_GBR},{HEX_4,REG_N,HEX_1,HEX_7}, arch_sh1_up}, - -/* 0100nnnn00100111 ldc.l @<REG_N>+,VBR */{"ldc.l",{A_INC_N,A_VBR},{HEX_4,REG_N,HEX_2,HEX_7}, arch_sh1_up}, - -/* 0100nnnn01010111 ldc.l @<REG_N>+,MOD */{"ldc.l",{A_INC_N,A_MOD},{HEX_4,REG_N,HEX_5,HEX_7}, arch_sh_dsp_up}, - -/* 0100nnnn01110111 ldc.l @<REG_N>+,RE */{"ldc.l",{A_INC_N,A_RE},{HEX_4,REG_N,HEX_7,HEX_7}, arch_sh_dsp_up}, - -/* 0100nnnn01100111 ldc.l @<REG_N>+,RS */{"ldc.l",{A_INC_N,A_RS},{HEX_4,REG_N,HEX_6,HEX_7}, arch_sh_dsp_up}, - -/* 0100nnnn00110111 ldc.l @<REG_N>+,SSR */{"ldc.l",{A_INC_N,A_SSR},{HEX_4,REG_N,HEX_3,HEX_7}, arch_sh3_up}, - -/* 0100nnnn01000111 ldc.l @<REG_N>+,SPC */{"ldc.l",{A_INC_N,A_SPC},{HEX_4,REG_N,HEX_4,HEX_7}, arch_sh3_up}, - -/* 0100nnnn11110110 ldc.l @<REG_N>+,DBR */{"ldc.l",{A_INC_N,A_DBR},{HEX_4,REG_N,HEX_F,HEX_6}, arch_sh4_up}, - -/* 0100nnnn1xxx0111 ldc.l <REG_N>,Rn_BANK */{"ldc.l",{A_INC_N,A_REG_B},{HEX_4,REG_N,REG_B,HEX_7}, arch_sh3_up}, - -/* 10001110i8p2.... ldre @(<disp>,PC) */{"ldre",{A_BDISP8},{HEX_8,HEX_E,BRANCH_8}, arch_sh_dsp_up}, - -/* 10001100i8p2.... ldrs @(<disp>,PC) */{"ldrs",{A_BDISP8},{HEX_8,HEX_C,BRANCH_8}, arch_sh_dsp_up}, - -/* 0100nnnn00001010 lds <REG_N>,MACH */{"lds",{A_REG_N,A_MACH},{HEX_4,REG_N,HEX_0,HEX_A}, arch_sh1_up}, - -/* 0100nnnn00011010 lds <REG_N>,MACL */{"lds",{A_REG_N,A_MACL},{HEX_4,REG_N,HEX_1,HEX_A}, arch_sh1_up}, - -/* 0100nnnn00101010 lds <REG_N>,PR */{"lds",{A_REG_N,A_PR},{HEX_4,REG_N,HEX_2,HEX_A}, arch_sh1_up}, - -/* 0100nnnn01101010 lds <REG_N>,DSR */{"lds",{A_REG_N,A_DSR},{HEX_4,REG_N,HEX_6,HEX_A}, arch_sh_dsp_up}, - -/* 0100nnnn01111010 lds <REG_N>,A0 */{"lds",{A_REG_N,A_A0},{HEX_4,REG_N,HEX_7,HEX_A}, arch_sh_dsp_up}, - -/* 0100nnnn10001010 lds <REG_N>,X0 */{"lds",{A_REG_N,A_X0},{HEX_4,REG_N,HEX_8,HEX_A}, arch_sh_dsp_up}, - -/* 0100nnnn10011010 lds <REG_N>,X1 */{"lds",{A_REG_N,A_X1},{HEX_4,REG_N,HEX_9,HEX_A}, arch_sh_dsp_up}, - -/* 0100nnnn10101010 lds <REG_N>,Y0 */{"lds",{A_REG_N,A_Y0},{HEX_4,REG_N,HEX_A,HEX_A}, arch_sh_dsp_up}, - -/* 0100nnnn10111010 lds <REG_N>,Y1 */{"lds",{A_REG_N,A_Y1},{HEX_4,REG_N,HEX_B,HEX_A}, arch_sh_dsp_up}, - -/* 0100nnnn01011010 lds <REG_N>,FPUL */{"lds",{A_REG_M,FPUL_N},{HEX_4,REG_M,HEX_5,HEX_A}, arch_sh3e_up}, - -/* 0100nnnn01101010 lds <REG_M>,FPSCR */{"lds",{A_REG_M,FPSCR_N},{HEX_4,REG_M,HEX_6,HEX_A}, arch_sh3e_up}, - -/* 0100nnnn00000110 lds.l @<REG_N>+,MACH*/{"lds.l",{A_INC_N,A_MACH},{HEX_4,REG_N,HEX_0,HEX_6}, arch_sh1_up}, - -/* 0100nnnn00010110 lds.l @<REG_N>+,MACL*/{"lds.l",{A_INC_N,A_MACL},{HEX_4,REG_N,HEX_1,HEX_6}, arch_sh1_up}, - -/* 0100nnnn00100110 lds.l @<REG_N>+,PR */{"lds.l",{A_INC_N,A_PR},{HEX_4,REG_N,HEX_2,HEX_6}, arch_sh1_up}, - -/* 0100nnnn01100110 lds.l @<REG_N>+,DSR */{"lds.l",{A_INC_N,A_DSR},{HEX_4,REG_N,HEX_6,HEX_6}, arch_sh_dsp_up}, - -/* 0100nnnn01110110 lds.l @<REG_N>+,A0 */{"lds.l",{A_INC_N,A_A0},{HEX_4,REG_N,HEX_7,HEX_6}, arch_sh_dsp_up}, - -/* 0100nnnn10000110 lds.l @<REG_N>+,X0 */{"lds.l",{A_INC_N,A_X0},{HEX_4,REG_N,HEX_8,HEX_6}, arch_sh_dsp_up}, - -/* 0100nnnn10010110 lds.l @<REG_N>+,X1 */{"lds.l",{A_INC_N,A_X1},{HEX_4,REG_N,HEX_9,HEX_6}, arch_sh_dsp_up}, - -/* 0100nnnn10100110 lds.l @<REG_N>+,Y0 */{"lds.l",{A_INC_N,A_Y0},{HEX_4,REG_N,HEX_A,HEX_6}, arch_sh_dsp_up}, - -/* 0100nnnn10110110 lds.l @<REG_N>+,Y1 */{"lds.l",{A_INC_N,A_Y1},{HEX_4,REG_N,HEX_B,HEX_6}, arch_sh_dsp_up}, - -/* 0100nnnn01010110 lds.l @<REG_M>+,FPUL*/{"lds.l",{A_INC_M,FPUL_N},{HEX_4,REG_M,HEX_5,HEX_6}, arch_sh3e_up}, - -/* 0100nnnn01100110 lds.l @<REG_M>+,FPSCR*/{"lds.l",{A_INC_M,FPSCR_N},{HEX_4,REG_M,HEX_6,HEX_6}, arch_sh3e_up}, - -/* 0000000000111000 ldtlb */{"ldtlb",{0},{HEX_0,HEX_0,HEX_3,HEX_8}, arch_sh3_up}, - -/* 0100nnnnmmmm1111 mac.w @<REG_M>+,@<REG_N>+*/{"mac.w",{A_INC_M,A_INC_N},{HEX_4,REG_N,REG_M,HEX_F}, arch_sh1_up}, - -/* 1110nnnni8*1.... mov #<imm>,<REG_N> */{"mov",{A_IMM,A_REG_N},{HEX_E,REG_N,IMM_8}, arch_sh1_up}, - -/* 0110nnnnmmmm0011 mov <REG_M>,<REG_N> */{"mov",{ A_REG_M,A_REG_N},{HEX_6,REG_N,REG_M,HEX_3}, arch_sh1_up}, - -/* 0000nnnnmmmm0100 mov.b <REG_M>,@(R0,<REG_N>)*/{"mov.b",{ A_REG_M,A_IND_R0_REG_N},{HEX_0,REG_N,REG_M,HEX_4}, arch_sh1_up}, - -/* 0010nnnnmmmm0100 mov.b <REG_M>,@-<REG_N>*/{"mov.b",{ A_REG_M,A_DEC_N},{HEX_2,REG_N,REG_M,HEX_4}, arch_sh1_up}, - -/* 0010nnnnmmmm0000 mov.b <REG_M>,@<REG_N>*/{"mov.b",{ A_REG_M,A_IND_N},{HEX_2,REG_N,REG_M,HEX_0}, arch_sh1_up}, - -/* 10000100mmmmi4*1 mov.b @(<disp>,<REG_M>),R0*/{"mov.b",{A_DISP_REG_M,A_R0},{HEX_8,HEX_4,REG_M,IMM_4}, arch_sh1_up}, - -/* 11000100i8*1.... mov.b @(<disp>,GBR),R0*/{"mov.b",{A_DISP_GBR,A_R0},{HEX_C,HEX_4,IMM_8}, arch_sh1_up}, - -/* 0000nnnnmmmm1100 mov.b @(R0,<REG_M>),<REG_N>*/{"mov.b",{A_IND_R0_REG_M,A_REG_N},{HEX_0,REG_N,REG_M,HEX_C}, arch_sh1_up}, - -/* 0110nnnnmmmm0100 mov.b @<REG_M>+,<REG_N>*/{"mov.b",{A_INC_M,A_REG_N},{HEX_6,REG_N,REG_M,HEX_4}, arch_sh1_up}, - -/* 0110nnnnmmmm0000 mov.b @<REG_M>,<REG_N>*/{"mov.b",{A_IND_M,A_REG_N},{HEX_6,REG_N,REG_M,HEX_0}, arch_sh1_up}, - -/* 10000000mmmmi4*1 mov.b R0,@(<disp>,<REG_M>)*/{"mov.b",{A_R0,A_DISP_REG_M},{HEX_8,HEX_0,REG_M,IMM_4}, arch_sh1_up}, - -/* 11000000i8*1.... mov.b R0,@(<disp>,GBR)*/{"mov.b",{A_R0,A_DISP_GBR},{HEX_C,HEX_0,IMM_8}, arch_sh1_up}, - -/* 0001nnnnmmmmi4*4 mov.l <REG_M>,@(<disp>,<REG_N>)*/{"mov.l",{ A_REG_M,A_DISP_REG_N},{HEX_1,REG_N,REG_M,IMM_4BY4}, arch_sh1_up}, - -/* 0000nnnnmmmm0110 mov.l <REG_M>,@(R0,<REG_N>)*/{"mov.l",{ A_REG_M,A_IND_R0_REG_N},{HEX_0,REG_N,REG_M,HEX_6}, arch_sh1_up}, - -/* 0010nnnnmmmm0110 mov.l <REG_M>,@-<REG_N>*/{"mov.l",{ A_REG_M,A_DEC_N},{HEX_2,REG_N,REG_M,HEX_6}, arch_sh1_up}, - -/* 0010nnnnmmmm0010 mov.l <REG_M>,@<REG_N>*/{"mov.l",{ A_REG_M,A_IND_N},{HEX_2,REG_N,REG_M,HEX_2}, arch_sh1_up}, - -/* 0101nnnnmmmmi4*4 mov.l @(<disp>,<REG_M>),<REG_N>*/{"mov.l",{A_DISP_REG_M,A_REG_N},{HEX_5,REG_N,REG_M,IMM_4BY4}, arch_sh1_up}, - -/* 11000110i8*4.... mov.l @(<disp>,GBR),R0*/{"mov.l",{A_DISP_GBR,A_R0},{HEX_C,HEX_6,IMM_8BY4}, arch_sh1_up}, - -/* 1101nnnni8p4.... mov.l @(<disp>,PC),<REG_N>*/{"mov.l",{A_DISP_PC,A_REG_N},{HEX_D,REG_N,PCRELIMM_8BY4}, arch_sh1_up}, - -/* 0000nnnnmmmm1110 mov.l @(R0,<REG_M>),<REG_N>*/{"mov.l",{A_IND_R0_REG_M,A_REG_N},{HEX_0,REG_N,REG_M,HEX_E}, arch_sh1_up}, - -/* 0110nnnnmmmm0110 mov.l @<REG_M>+,<REG_N>*/{"mov.l",{A_INC_M,A_REG_N},{HEX_6,REG_N,REG_M,HEX_6}, arch_sh1_up}, - -/* 0110nnnnmmmm0010 mov.l @<REG_M>,<REG_N>*/{"mov.l",{A_IND_M,A_REG_N},{HEX_6,REG_N,REG_M,HEX_2}, arch_sh1_up}, - -/* 11000010i8*4.... mov.l R0,@(<disp>,GBR)*/{"mov.l",{A_R0,A_DISP_GBR},{HEX_C,HEX_2,IMM_8BY4}, arch_sh1_up}, - -/* 0000nnnnmmmm0101 mov.w <REG_M>,@(R0,<REG_N>)*/{"mov.w",{ A_REG_M,A_IND_R0_REG_N},{HEX_0,REG_N,REG_M,HEX_5}, arch_sh1_up}, - -/* 0010nnnnmmmm0101 mov.w <REG_M>,@-<REG_N>*/{"mov.w",{ A_REG_M,A_DEC_N},{HEX_2,REG_N,REG_M,HEX_5}, arch_sh1_up}, - -/* 0010nnnnmmmm0001 mov.w <REG_M>,@<REG_N>*/{"mov.w",{ A_REG_M,A_IND_N},{HEX_2,REG_N,REG_M,HEX_1}, arch_sh1_up}, - -/* 10000101mmmmi4*2 mov.w @(<disp>,<REG_M>),R0*/{"mov.w",{A_DISP_REG_M,A_R0},{HEX_8,HEX_5,REG_M,IMM_4BY2}, arch_sh1_up}, - -/* 11000101i8*2.... mov.w @(<disp>,GBR),R0*/{"mov.w",{A_DISP_GBR,A_R0},{HEX_C,HEX_5,IMM_8BY2}, arch_sh1_up}, - -/* 1001nnnni8p2.... mov.w @(<disp>,PC),<REG_N>*/{"mov.w",{A_DISP_PC,A_REG_N},{HEX_9,REG_N,PCRELIMM_8BY2}, arch_sh1_up}, - -/* 0000nnnnmmmm1101 mov.w @(R0,<REG_M>),<REG_N>*/{"mov.w",{A_IND_R0_REG_M,A_REG_N},{HEX_0,REG_N,REG_M,HEX_D}, arch_sh1_up}, - -/* 0110nnnnmmmm0101 mov.w @<REG_M>+,<REG_N>*/{"mov.w",{A_INC_M,A_REG_N},{HEX_6,REG_N,REG_M,HEX_5}, arch_sh1_up}, - -/* 0110nnnnmmmm0001 mov.w @<REG_M>,<REG_N>*/{"mov.w",{A_IND_M,A_REG_N},{HEX_6,REG_N,REG_M,HEX_1}, arch_sh1_up}, - -/* 10000001mmmmi4*2 mov.w R0,@(<disp>,<REG_M>)*/{"mov.w",{A_R0,A_DISP_REG_M},{HEX_8,HEX_1,REG_M,IMM_4BY2}, arch_sh1_up}, - -/* 11000001i8*2.... mov.w R0,@(<disp>,GBR)*/{"mov.w",{A_R0,A_DISP_GBR},{HEX_C,HEX_1,IMM_8BY2}, arch_sh1_up}, - -/* 11000111i8p4.... mova @(<disp>,PC),R0*/{"mova",{A_DISP_PC,A_R0},{HEX_C,HEX_7,PCRELIMM_8BY4}, arch_sh1_up}, -/* 0000nnnn11000011 movca.l R0,@<REG_N> */{"movca.l",{A_R0,A_IND_N},{HEX_0,REG_N,HEX_C,HEX_3}, arch_sh4_up}, - - -/* 0000nnnn00101001 movt <REG_N> */{"movt",{A_REG_N},{HEX_0,REG_N,HEX_2,HEX_9}, arch_sh1_up}, - -/* 0010nnnnmmmm1111 muls.w <REG_M>,<REG_N>*/{"muls.w",{ A_REG_M,A_REG_N},{HEX_2,REG_N,REG_M,HEX_F}, arch_sh1_up}, -/* 0010nnnnmmmm1111 muls <REG_M>,<REG_N>*/{"muls",{ A_REG_M,A_REG_N},{HEX_2,REG_N,REG_M,HEX_F}, arch_sh1_up}, - -/* 0000nnnnmmmm0111 mul.l <REG_M>,<REG_N>*/{"mul.l",{ A_REG_M,A_REG_N},{HEX_0,REG_N,REG_M,HEX_7}, arch_sh2_up}, - -/* 0010nnnnmmmm1110 mulu.w <REG_M>,<REG_N>*/{"mulu.w",{ A_REG_M,A_REG_N},{HEX_2,REG_N,REG_M,HEX_E}, arch_sh1_up}, -/* 0010nnnnmmmm1110 mulu <REG_M>,<REG_N>*/{"mulu",{ A_REG_M,A_REG_N},{HEX_2,REG_N,REG_M,HEX_E}, arch_sh1_up}, - -/* 0110nnnnmmmm1011 neg <REG_M>,<REG_N> */{"neg",{ A_REG_M,A_REG_N},{HEX_6,REG_N,REG_M,HEX_B}, arch_sh1_up}, - -/* 0110nnnnmmmm1010 negc <REG_M>,<REG_N>*/{"negc",{ A_REG_M,A_REG_N},{HEX_6,REG_N,REG_M,HEX_A}, arch_sh1_up}, - -/* 0000000000001001 nop */{"nop",{0},{HEX_0,HEX_0,HEX_0,HEX_9}, arch_sh1_up}, - -/* 0110nnnnmmmm0111 not <REG_M>,<REG_N> */{"not",{ A_REG_M,A_REG_N},{HEX_6,REG_N,REG_M,HEX_7}, arch_sh1_up}, -/* 0000nnnn10010011 ocbi @<REG_N> */{"ocbi",{A_IND_N},{HEX_0,REG_N,HEX_9,HEX_3}, arch_sh4_up}, - -/* 0000nnnn10100011 ocbp @<REG_N> */{"ocbp",{A_IND_N},{HEX_0,REG_N,HEX_A,HEX_3}, arch_sh4_up}, - -/* 0000nnnn10110011 ocbwb @<REG_N> */{"ocbwb",{A_IND_N},{HEX_0,REG_N,HEX_B,HEX_3}, arch_sh4_up}, - - -/* 11001011i8*1.... or #<imm>,R0 */{"or",{A_IMM,A_R0},{HEX_C,HEX_B,IMM_8}, arch_sh1_up}, - -/* 0010nnnnmmmm1011 or <REG_M>,<REG_N> */{"or",{ A_REG_M,A_REG_N},{HEX_2,REG_N,REG_M,HEX_B}, arch_sh1_up}, - -/* 11001111i8*1.... or.b #<imm>,@(R0,GBR)*/{"or.b",{A_IMM,A_R0_GBR},{HEX_C,HEX_F,IMM_8}, arch_sh1_up}, - -/* 0000nnnn10000011 pref @<REG_N> */{"pref",{A_IND_N},{HEX_0,REG_N,HEX_8,HEX_3}, arch_sh4_up}, - -/* 0100nnnn00100100 rotcl <REG_N> */{"rotcl",{A_REG_N},{HEX_4,REG_N,HEX_2,HEX_4}, arch_sh1_up}, - -/* 0100nnnn00100101 rotcr <REG_N> */{"rotcr",{A_REG_N},{HEX_4,REG_N,HEX_2,HEX_5}, arch_sh1_up}, - -/* 0100nnnn00000100 rotl <REG_N> */{"rotl",{A_REG_N},{HEX_4,REG_N,HEX_0,HEX_4}, arch_sh1_up}, - -/* 0100nnnn00000101 rotr <REG_N> */{"rotr",{A_REG_N},{HEX_4,REG_N,HEX_0,HEX_5}, arch_sh1_up}, - -/* 0000000000101011 rte */{"rte",{0},{HEX_0,HEX_0,HEX_2,HEX_B}, arch_sh1_up}, - -/* 0000000000001011 rts */{"rts",{0},{HEX_0,HEX_0,HEX_0,HEX_B}, arch_sh1_up}, - -/* 0000000001011000 sets */{"sets",{0},{HEX_0,HEX_0,HEX_5,HEX_8}, arch_sh1_up}, -/* 0000000000011000 sett */{"sett",{0},{HEX_0,HEX_0,HEX_1,HEX_8}, arch_sh1_up}, - -/* 0100nnnn00010100 setrc <REG_N> */{"setrc",{A_REG_N},{HEX_4,REG_N,HEX_1,HEX_4}, arch_sh_dsp_up}, - -/* 10000010i8*1.... setrc #<imm> */{"setrc",{A_IMM},{HEX_8,HEX_2,IMM_8}, arch_sh_dsp_up}, - -/* 0100nnnnmmmm1100 shad <REG_M>,<REG_N>*/{"shad",{ A_REG_M,A_REG_N},{HEX_4,REG_N,REG_M,HEX_C}, arch_sh3_up}, - -/* 0100nnnnmmmm1101 shld <REG_M>,<REG_N>*/{"shld",{ A_REG_M,A_REG_N},{HEX_4,REG_N,REG_M,HEX_D}, arch_sh3_up}, - -/* 0100nnnn00100000 shal <REG_N> */{"shal",{A_REG_N},{HEX_4,REG_N,HEX_2,HEX_0}, arch_sh1_up}, - -/* 0100nnnn00100001 shar <REG_N> */{"shar",{A_REG_N},{HEX_4,REG_N,HEX_2,HEX_1}, arch_sh1_up}, - -/* 0100nnnn00000000 shll <REG_N> */{"shll",{A_REG_N},{HEX_4,REG_N,HEX_0,HEX_0}, arch_sh1_up}, - -/* 0100nnnn00101000 shll16 <REG_N> */{"shll16",{A_REG_N},{HEX_4,REG_N,HEX_2,HEX_8}, arch_sh1_up}, - -/* 0100nnnn00001000 shll2 <REG_N> */{"shll2",{A_REG_N},{HEX_4,REG_N,HEX_0,HEX_8}, arch_sh1_up}, - -/* 0100nnnn00011000 shll8 <REG_N> */{"shll8",{A_REG_N},{HEX_4,REG_N,HEX_1,HEX_8}, arch_sh1_up}, - -/* 0100nnnn00000001 shlr <REG_N> */{"shlr",{A_REG_N},{HEX_4,REG_N,HEX_0,HEX_1}, arch_sh1_up}, - -/* 0100nnnn00101001 shlr16 <REG_N> */{"shlr16",{A_REG_N},{HEX_4,REG_N,HEX_2,HEX_9}, arch_sh1_up}, - -/* 0100nnnn00001001 shlr2 <REG_N> */{"shlr2",{A_REG_N},{HEX_4,REG_N,HEX_0,HEX_9}, arch_sh1_up}, - -/* 0100nnnn00011001 shlr8 <REG_N> */{"shlr8",{A_REG_N},{HEX_4,REG_N,HEX_1,HEX_9}, arch_sh1_up}, - -/* 0000000000011011 sleep */{"sleep",{0},{HEX_0,HEX_0,HEX_1,HEX_B}, arch_sh1_up}, - -/* 0000nnnn00000010 stc SR,<REG_N> */{"stc",{A_SR,A_REG_N},{HEX_0,REG_N,HEX_0,HEX_2}, arch_sh1_up}, - -/* 0000nnnn00010010 stc GBR,<REG_N> */{"stc",{A_GBR,A_REG_N},{HEX_0,REG_N,HEX_1,HEX_2}, arch_sh1_up}, - -/* 0000nnnn00100010 stc VBR,<REG_N> */{"stc",{A_VBR,A_REG_N},{HEX_0,REG_N,HEX_2,HEX_2}, arch_sh1_up}, - -/* 0000nnnn01010010 stc MOD,<REG_N> */{"stc",{A_MOD,A_REG_N},{HEX_0,REG_N,HEX_5,HEX_2}, arch_sh_dsp_up}, - -/* 0000nnnn01110010 stc RE,<REG_N> */{"stc",{A_RE,A_REG_N},{HEX_0,REG_N,HEX_7,HEX_2}, arch_sh_dsp_up}, - -/* 0000nnnn01100010 stc RS,<REG_N> */{"stc",{A_RS,A_REG_N},{HEX_0,REG_N,HEX_6,HEX_2}, arch_sh_dsp_up}, - -/* 0000nnnn00110010 stc SSR,<REG_N> */{"stc",{A_SSR,A_REG_N},{HEX_0,REG_N,HEX_3,HEX_2}, arch_sh3_up}, - -/* 0000nnnn01000010 stc SPC,<REG_N> */{"stc",{A_SPC,A_REG_N},{HEX_0,REG_N,HEX_4,HEX_2}, arch_sh3_up}, - -/* 0000nnnn00111010 stc SGR,<REG_N> */{"stc",{A_SGR,A_REG_N},{HEX_0,REG_N,HEX_3,HEX_A}, arch_sh4_up}, - -/* 0000nnnn11111010 stc DBR,<REG_N> */{"stc",{A_DBR,A_REG_N},{HEX_0,REG_N,HEX_F,HEX_A}, arch_sh4_up}, - -/* 0000nnnn1xxx0010 stc Rn_BANK,<REG_N> */{"stc",{A_REG_B,A_REG_N},{HEX_0,REG_N,REG_B,HEX_2}, arch_sh3_up}, - -/* 0100nnnn00000011 stc.l SR,@-<REG_N> */{"stc.l",{A_SR,A_DEC_N},{HEX_4,REG_N,HEX_0,HEX_3}, arch_sh1_up}, - -/* 0100nnnn00100011 stc.l VBR,@-<REG_N> */{"stc.l",{A_VBR,A_DEC_N},{HEX_4,REG_N,HEX_2,HEX_3}, arch_sh1_up}, - -/* 0100nnnn01010011 stc.l MOD,@-<REG_N> */{"stc.l",{A_MOD,A_DEC_N},{HEX_4,REG_N,HEX_5,HEX_3}, arch_sh_dsp_up}, - -/* 0100nnnn01110011 stc.l RE,@-<REG_N> */{"stc.l",{A_RE,A_DEC_N},{HEX_4,REG_N,HEX_7,HEX_3}, arch_sh_dsp_up}, - -/* 0100nnnn01100011 stc.l RS,@-<REG_N> */{"stc.l",{A_RS,A_DEC_N},{HEX_4,REG_N,HEX_6,HEX_3}, arch_sh_dsp_up}, - -/* 0100nnnn00110011 stc.l SSR,@-<REG_N> */{"stc.l",{A_SSR,A_DEC_N},{HEX_4,REG_N,HEX_3,HEX_3}, arch_sh3_up}, - -/* 0100nnnn01000011 stc.l SPC,@-<REG_N> */{"stc.l",{A_SPC,A_DEC_N},{HEX_4,REG_N,HEX_4,HEX_3}, arch_sh3_up}, - -/* 0100nnnn00010011 stc.l GBR,@-<REG_N> */{"stc.l",{A_GBR,A_DEC_N},{HEX_4,REG_N,HEX_1,HEX_3}, arch_sh4_up}, - -/* 0100nnnn00110010 stc.l SGR,@-<REG_N> */{"stc.l",{A_SGR,A_DEC_N},{HEX_4,REG_N,HEX_3,HEX_2}, arch_sh4_up}, - -/* 0100nnnn11110010 stc.l DBR,@-<REG_N> */{"stc.l",{A_DBR,A_DEC_N},{HEX_4,REG_N,HEX_F,HEX_2}, arch_sh4_up}, - -/* 0100nnnn1xxx0011 stc.l Rn_BANK,@-<REG_N> */{"stc.l",{A_REG_B,A_DEC_N},{HEX_4,REG_N,REG_B,HEX_3}, arch_sh3_up}, - -/* 0000nnnn00001010 sts MACH,<REG_N> */{"sts",{A_MACH,A_REG_N},{HEX_0,REG_N,HEX_0,HEX_A}, arch_sh1_up}, - -/* 0000nnnn00011010 sts MACL,<REG_N> */{"sts",{A_MACL,A_REG_N},{HEX_0,REG_N,HEX_1,HEX_A}, arch_sh1_up}, - -/* 0000nnnn00101010 sts PR,<REG_N> */{"sts",{A_PR,A_REG_N},{HEX_0,REG_N,HEX_2,HEX_A}, arch_sh1_up}, - -/* 0000nnnn01101010 sts DSR,<REG_N> */{"sts",{A_DSR,A_REG_N},{HEX_0,REG_N,HEX_6,HEX_A}, arch_sh_dsp_up}, - -/* 0000nnnn01111010 sts A0,<REG_N> */{"sts",{A_A0,A_REG_N},{HEX_0,REG_N,HEX_7,HEX_A}, arch_sh_dsp_up}, - -/* 0000nnnn10001010 sts X0,<REG_N> */{"sts",{A_X0,A_REG_N},{HEX_0,REG_N,HEX_8,HEX_A}, arch_sh_dsp_up}, - -/* 0000nnnn10011010 sts X1,<REG_N> */{"sts",{A_X1,A_REG_N},{HEX_0,REG_N,HEX_9,HEX_A}, arch_sh_dsp_up}, - -/* 0000nnnn10101010 sts Y0,<REG_N> */{"sts",{A_Y0,A_REG_N},{HEX_0,REG_N,HEX_A,HEX_A}, arch_sh_dsp_up}, - -/* 0000nnnn10111010 sts Y1,<REG_N> */{"sts",{A_Y1,A_REG_N},{HEX_0,REG_N,HEX_B,HEX_A}, arch_sh_dsp_up}, - -/* 0000nnnn01011010 sts FPUL,<REG_N> */{"sts",{FPUL_M,A_REG_N},{HEX_0,REG_N,HEX_5,HEX_A}, arch_sh3e_up}, - -/* 0000nnnn01101010 sts FPSCR,<REG_N> */{"sts",{FPSCR_M,A_REG_N},{HEX_0,REG_N,HEX_6,HEX_A}, arch_sh3e_up}, - -/* 0100nnnn00000010 sts.l MACH,@-<REG_N>*/{"sts.l",{A_MACH,A_DEC_N},{HEX_4,REG_N,HEX_0,HEX_2}, arch_sh1_up}, - -/* 0100nnnn00010010 sts.l MACL,@-<REG_N>*/{"sts.l",{A_MACL,A_DEC_N},{HEX_4,REG_N,HEX_1,HEX_2}, arch_sh1_up}, - -/* 0100nnnn00100010 sts.l PR,@-<REG_N> */{"sts.l",{A_PR,A_DEC_N},{HEX_4,REG_N,HEX_2,HEX_2}, arch_sh1_up}, - -/* 0100nnnn01100110 sts.l DSR,@-<REG_N> */{"sts.l",{A_DSR,A_DEC_N},{HEX_4,REG_N,HEX_6,HEX_2}, arch_sh_dsp_up}, - -/* 0100nnnn01110110 sts.l A0,@-<REG_N> */{"sts.l",{A_A0,A_DEC_N},{HEX_4,REG_N,HEX_7,HEX_2}, arch_sh_dsp_up}, - -/* 0100nnnn10000110 sts.l X0,@-<REG_N> */{"sts.l",{A_X0,A_DEC_N},{HEX_4,REG_N,HEX_8,HEX_2}, arch_sh_dsp_up}, - -/* 0100nnnn10010110 sts.l X1,@-<REG_N> */{"sts.l",{A_X1,A_DEC_N},{HEX_4,REG_N,HEX_9,HEX_2}, arch_sh_dsp_up}, - -/* 0100nnnn10100110 sts.l Y0,@-<REG_N> */{"sts.l",{A_Y0,A_DEC_N},{HEX_4,REG_N,HEX_A,HEX_2}, arch_sh_dsp_up}, - -/* 0100nnnn10110110 sts.l Y1,@-<REG_N> */{"sts.l",{A_Y1,A_DEC_N},{HEX_4,REG_N,HEX_B,HEX_2}, arch_sh_dsp_up}, - -/* 0100nnnn01010010 sts.l FPUL,@-<REG_N>*/{"sts.l",{FPUL_M,A_DEC_N},{HEX_4,REG_N,HEX_5,HEX_2}, arch_sh3e_up}, - -/* 0100nnnn01100010 sts.l FPSCR,@-<REG_N>*/{"sts.l",{FPSCR_M,A_DEC_N},{HEX_4,REG_N,HEX_6,HEX_2}, arch_sh3e_up}, - -/* 0011nnnnmmmm1000 sub <REG_M>,<REG_N> */{"sub",{ A_REG_M,A_REG_N},{HEX_3,REG_N,REG_M,HEX_8}, arch_sh1_up}, - -/* 0011nnnnmmmm1010 subc <REG_M>,<REG_N>*/{"subc",{ A_REG_M,A_REG_N},{HEX_3,REG_N,REG_M,HEX_A}, arch_sh1_up}, - -/* 0011nnnnmmmm1011 subv <REG_M>,<REG_N>*/{"subv",{ A_REG_M,A_REG_N},{HEX_3,REG_N,REG_M,HEX_B}, arch_sh1_up}, - -/* 0110nnnnmmmm1000 swap.b <REG_M>,<REG_N>*/{"swap.b",{ A_REG_M,A_REG_N},{HEX_6,REG_N,REG_M,HEX_8}, arch_sh1_up}, - -/* 0110nnnnmmmm1001 swap.w <REG_M>,<REG_N>*/{"swap.w",{ A_REG_M,A_REG_N},{HEX_6,REG_N,REG_M,HEX_9}, arch_sh1_up}, - -/* 0100nnnn00011011 tas.b @<REG_N> */{"tas.b",{A_IND_N},{HEX_4,REG_N,HEX_1,HEX_B}, arch_sh1_up}, - -/* 11000011i8*1.... trapa #<imm> */{"trapa",{A_IMM},{HEX_C,HEX_3,IMM_8}, arch_sh1_up}, - -/* 11001000i8*1.... tst #<imm>,R0 */{"tst",{A_IMM,A_R0},{HEX_C,HEX_8,IMM_8}, arch_sh1_up}, - -/* 0010nnnnmmmm1000 tst <REG_M>,<REG_N> */{"tst",{ A_REG_M,A_REG_N},{HEX_2,REG_N,REG_M,HEX_8}, arch_sh1_up}, - -/* 11001100i8*1.... tst.b #<imm>,@(R0,GBR)*/{"tst.b",{A_IMM,A_R0_GBR},{HEX_C,HEX_C,IMM_8}, arch_sh1_up}, - -/* 11001010i8*1.... xor #<imm>,R0 */{"xor",{A_IMM,A_R0},{HEX_C,HEX_A,IMM_8}, arch_sh1_up}, - -/* 0010nnnnmmmm1010 xor <REG_M>,<REG_N> */{"xor",{ A_REG_M,A_REG_N},{HEX_2,REG_N,REG_M,HEX_A}, arch_sh1_up}, - -/* 11001110i8*1.... xor.b #<imm>,@(R0,GBR)*/{"xor.b",{A_IMM,A_R0_GBR},{HEX_C,HEX_E,IMM_8}, arch_sh1_up}, - -/* 0010nnnnmmmm1101 xtrct <REG_M>,<REG_N>*/{"xtrct",{ A_REG_M,A_REG_N},{HEX_2,REG_N,REG_M,HEX_D}, arch_sh1_up}, - -/* 0000nnnnmmmm0111 mul.l <REG_M>,<REG_N>*/{"mul.l",{ A_REG_M,A_REG_N},{HEX_0,REG_N,REG_M,HEX_7}, arch_sh1_up}, - -/* 0100nnnn00010000 dt <REG_N> */{"dt",{A_REG_N},{HEX_4,REG_N,HEX_1,HEX_0}, arch_sh2_up}, - -/* 0011nnnnmmmm1101 dmuls.l <REG_M>,<REG_N>*/{"dmuls.l",{ A_REG_M,A_REG_N},{HEX_3,REG_N,REG_M,HEX_D}, arch_sh2_up}, - -/* 0011nnnnmmmm0101 dmulu.l <REG_M>,<REG_N>*/{"dmulu.l",{ A_REG_M,A_REG_N},{HEX_3,REG_N,REG_M,HEX_5}, arch_sh2_up}, - -/* 0000nnnnmmmm1111 mac.l @<REG_M>+,@<REG_N>+*/{"mac.l",{A_INC_M,A_INC_N},{HEX_0,REG_N,REG_M,HEX_F}, arch_sh2_up}, - -/* 0000nnnn00100011 braf <REG_N> */{"braf",{A_REG_N},{HEX_0,REG_N,HEX_2,HEX_3}, arch_sh2_up}, - -/* 0000nnnn00000011 bsrf <REG_N> */{"bsrf",{A_REG_N},{HEX_0,REG_N,HEX_0,HEX_3}, arch_sh2_up}, - -/* 111101nnmmmm0000 movs.w @-<REG_N>,<DSP_REG_M> */ {"movs.w",{A_DEC_N,DSP_REG_M},{HEX_F,SDT_REG_N,REG_M,HEX_0}, arch_sh_dsp_up}, - -/* 111101nnmmmm0001 movs.w @<REG_N>,<DSP_REG_M> */ {"movs.w",{A_IND_N,DSP_REG_M},{HEX_F,SDT_REG_N,REG_M,HEX_1}, arch_sh_dsp_up}, - -/* 111101nnmmmm0010 movs.w @<REG_N>+,<DSP_REG_M> */ {"movs.w",{A_INC_N,DSP_REG_M},{HEX_F,SDT_REG_N,REG_M,HEX_2}, arch_sh_dsp_up}, - -/* 111101nnmmmm0011 movs.w @<REG_N>+r8,<DSP_REG_M> */ {"movs.w",{A_PMOD_N,DSP_REG_M},{HEX_F,SDT_REG_N,REG_M,HEX_3}, arch_sh_dsp_up}, - -/* 111101nnmmmm0100 movs.w <DSP_REG_M>,@-<REG_N> */ {"movs.w",{DSP_REG_M,A_DEC_N},{HEX_F,SDT_REG_N,REG_M,HEX_4}, arch_sh_dsp_up}, - -/* 111101nnmmmm0101 movs.w <DSP_REG_M>,@<REG_N> */ {"movs.w",{DSP_REG_M,A_IND_N},{HEX_F,SDT_REG_N,REG_M,HEX_5}, arch_sh_dsp_up}, - -/* 111101nnmmmm0110 movs.w <DSP_REG_M>,@<REG_N>+ */ {"movs.w",{DSP_REG_M,A_INC_N},{HEX_F,SDT_REG_N,REG_M,HEX_6}, arch_sh_dsp_up}, - -/* 111101nnmmmm0111 movs.w <DSP_REG_M>,@<REG_N>+r8 */ {"movs.w",{DSP_REG_M,A_PMOD_N},{HEX_F,SDT_REG_N,REG_M,HEX_7}, arch_sh_dsp_up}, - -/* 111101nnmmmm1000 movs.l @-<REG_N>,<DSP_REG_M> */ {"movs.l",{A_DEC_N,DSP_REG_M},{HEX_F,SDT_REG_N,REG_M,HEX_8}, arch_sh_dsp_up}, - -/* 111101nnmmmm1001 movs.l @<REG_N>,<DSP_REG_M> */ {"movs.l",{A_IND_N,DSP_REG_M},{HEX_F,SDT_REG_N,REG_M,HEX_9}, arch_sh_dsp_up}, - -/* 111101nnmmmm1010 movs.l @<REG_N>+,<DSP_REG_M> */ {"movs.l",{A_INC_N,DSP_REG_M},{HEX_F,SDT_REG_N,REG_M,HEX_A}, arch_sh_dsp_up}, - -/* 111101nnmmmm1011 movs.l @<REG_N>+r8,<DSP_REG_M> */ {"movs.l",{A_PMOD_N,DSP_REG_M},{HEX_F,SDT_REG_N,REG_M,HEX_B}, arch_sh_dsp_up}, - -/* 111101nnmmmm1100 movs.l <DSP_REG_M>,@-<REG_N> */ {"movs.l",{DSP_REG_M,A_DEC_N},{HEX_F,SDT_REG_N,REG_M,HEX_C}, arch_sh_dsp_up}, - -/* 111101nnmmmm1101 movs.l <DSP_REG_M>,@<REG_N> */ {"movs.l",{DSP_REG_M,A_IND_N},{HEX_F,SDT_REG_N,REG_M,HEX_D}, arch_sh_dsp_up}, - -/* 111101nnmmmm1110 movs.l <DSP_REG_M>,@<REG_N>+ */ {"movs.l",{DSP_REG_M,A_INC_N},{HEX_F,SDT_REG_N,REG_M,HEX_E}, arch_sh_dsp_up}, - -/* 111101nnmmmm1111 movs.l <DSP_REG_M>,@<REG_N>+r8 */ {"movs.l",{DSP_REG_M,A_PMOD_N},{HEX_F,SDT_REG_N,REG_M,HEX_F}, arch_sh_dsp_up}, - -/* 0*0*0*00** nopx */ {"nopx",{0},{PPI,NOPX}, arch_sh_dsp_up}, -/* *0*0*0**00 nopy */ {"nopy",{0},{PPI,NOPY}, arch_sh_dsp_up}, -/* n*m*0*01** movx.w @<REG_N>,<DSP_REG_X> */ {"movx.w",{A_IND_N,DSP_REG_X},{PPI,MOVX,HEX_1}, arch_sh_dsp_up}, -/* n*m*0*10** movx.w @<REG_N>+,<DSP_REG_X> */ {"movx.w",{A_INC_N,DSP_REG_X},{PPI,MOVX,HEX_2}, arch_sh_dsp_up}, -/* n*m*0*11** movx.w @<REG_N>+r8,<DSP_REG_X> */ {"movx.w",{A_PMOD_N,DSP_REG_X},{PPI,MOVX,HEX_3}, arch_sh_dsp_up}, -/* n*m*1*01** movx.w <DSP_REG_M>,@<REG_N> */ {"movx.w",{DSP_REG_M,A_IND_N},{PPI,MOVX,HEX_9}, arch_sh_dsp_up}, -/* n*m*1*10** movx.w <DSP_REG_M>,@<REG_N>+ */ {"movx.w",{DSP_REG_M,A_INC_N},{PPI,MOVX,HEX_A}, arch_sh_dsp_up}, -/* n*m*1*11** movx.w <DSP_REG_M>,@<REG_N>+r8 */ {"movx.w",{DSP_REG_M,A_PMOD_N},{PPI,MOVX,HEX_B}, arch_sh_dsp_up}, -/* *n*m*0**01 movy.w @<REG_N>,<DSP_REG_Y> */ {"movy.w",{A_IND_N,DSP_REG_Y},{PPI,MOVY,HEX_1}, arch_sh_dsp_up}, -/* *n*m*0**10 movy.w @<REG_N>+,<DSP_REG_Y> */ {"movy.w",{A_INC_N,DSP_REG_Y},{PPI,MOVY,HEX_2}, arch_sh_dsp_up}, -/* *n*m*0**11 movy.w @<REG_N>+r9,<DSP_REG_Y> */ {"movy.w",{A_PMODY_N,DSP_REG_Y},{PPI,MOVY,HEX_3}, arch_sh_dsp_up}, -/* *n*m*1**01 movy.w <DSP_REG_M>,@<REG_N> */ {"movy.w",{DSP_REG_M,A_IND_N},{PPI,MOVY,HEX_9}, arch_sh_dsp_up}, -/* *n*m*1**10 movy.w <DSP_REG_M>,@<REG_N>+ */ {"movy.w",{DSP_REG_M,A_INC_N},{PPI,MOVY,HEX_A}, arch_sh_dsp_up}, -/* *n*m*1**11 movy.w <DSP_REG_M>,@<REG_N>+r9 */ {"movy.w",{DSP_REG_M,A_PMODY_N},{PPI,MOVY,HEX_B}, arch_sh_dsp_up}, - -/* 01aaeeffxxyyggnn pmuls Se,Sf,Dg */ {"pmuls",{DSP_REG_E,DSP_REG_F,DSP_REG_G},{PPI,PMUL}, arch_sh_dsp_up}, -/* 10100000xxyynnnn psubc <DSP_REG_X>,<DSP_REG_Y>,<DSP_REG_N> */ -{"psubc",{DSP_REG_X,DSP_REG_Y,DSP_REG_N},{PPI,PPI3,HEX_A,HEX_0}, arch_sh_dsp_up}, -/* 10110000xxyynnnn paddc <DSP_REG_X>,<DSP_REG_Y>,<DSP_REG_N> */ -{"paddc",{DSP_REG_X,DSP_REG_Y,DSP_REG_N},{PPI,PPI3,HEX_B,HEX_0}, arch_sh_dsp_up}, -/* 10000100xxyynnnn pcmp <DSP_REG_X>,<DSP_REG_Y> */ -{"pcmp", {DSP_REG_X,DSP_REG_Y},{PPI,PPI3,HEX_8,HEX_4}, arch_sh_dsp_up}, -/* 10100100xxyynnnn pwsb <DSP_REG_X>,<DSP_REG_Y>,<DSP_REG_N> */ -{"pwsb", {DSP_REG_X,DSP_REG_Y,DSP_REG_N},{PPI,PPI3,HEX_A,HEX_4}, arch_sh_dsp_up}, -/* 10110100xxyynnnn pwad <DSP_REG_X>,<DSP_REG_Y>,<DSP_REG_N> */ -{"pwad", {DSP_REG_X,DSP_REG_Y,DSP_REG_N},{PPI,PPI3,HEX_B,HEX_4}, arch_sh_dsp_up}, -/* 10001000xxyynnnn pabs <DSP_REG_X>,<DSP_REG_N> */ -{"pabs", {DSP_REG_X,DSP_REG_N},{PPI,PPI3,HEX_8,HEX_8}, arch_sh_dsp_up}, -/* 10011000xxyynnnn prnd <DSP_REG_X>,<DSP_REG_N> */ -{"prnd", {DSP_REG_X,DSP_REG_N},{PPI,PPI3,HEX_9,HEX_8}, arch_sh_dsp_up}, -/* 10101000xxyynnnn pabs <DSP_REG_Y>,<DSP_REG_N> */ -{"pabs", {DSP_REG_Y,DSP_REG_N},{PPI,PPI3,HEX_A,HEX_8}, arch_sh_dsp_up}, -/* 10111000xxyynnnn prnd <DSP_REG_Y>,<DSP_REG_N> */ -{"prnd", {DSP_REG_Y,DSP_REG_N},{PPI,PPI3,HEX_B,HEX_8}, arch_sh_dsp_up}, - -{"dct",{0},{PPI,PDC,HEX_1}, arch_sh_dsp_up}, -{"dcf",{0},{PPI,PDC,HEX_2}, arch_sh_dsp_up}, - -/* 00000iiiiiiinnnn pshl #<imm>,<DSP_REG_N> */ {"pshl",{A_IMM,DSP_REG_N},{PPI,PSH,HEX_0}, arch_sh_dsp_up}, -/* 10000001xxyynnnn pshl <DSP_REG_X>,<DSP_REG_Y>,<DSP_REG_N> */ -{"pshl", {DSP_REG_X,DSP_REG_Y,DSP_REG_N},{PPI,PPIC,HEX_8,HEX_1}, arch_sh_dsp_up}, -/* 00010iiiiiiinnnn psha #<imm>,<DSP_REG_N> */ {"psha",{A_IMM,DSP_REG_N},{PPI,PSH,HEX_1}, arch_sh_dsp_up}, -/* 10010001xxyynnnn psha <DSP_REG_X>,<DSP_REG_Y>,<DSP_REG_N> */ -{"psha", {DSP_REG_X,DSP_REG_Y,DSP_REG_N},{PPI,PPIC,HEX_9,HEX_1}, arch_sh_dsp_up}, -/* 10100001xxyynnnn psub <DSP_REG_X>,<DSP_REG_Y>,<DSP_REG_N> */ -{"psub", {DSP_REG_X,DSP_REG_Y,DSP_REG_N},{PPI,PPIC,HEX_A,HEX_1}, arch_sh_dsp_up}, -/* 10110001xxyynnnn padd <DSP_REG_X>,<DSP_REG_Y>,<DSP_REG_N> */ -{"padd", {DSP_REG_X,DSP_REG_Y,DSP_REG_N},{PPI,PPIC,HEX_B,HEX_1}, arch_sh_dsp_up}, -/* 10010101xxyynnnn pand <DSP_REG_X>,<DSP_REG_Y>,<DSP_REG_N> */ -{"pand", {DSP_REG_X,DSP_REG_Y,DSP_REG_N},{PPI,PPIC,HEX_9,HEX_5}, arch_sh_dsp_up}, -/* 10100101xxyynnnn pxor <DSP_REG_X>,<DSP_REG_Y>,<DSP_REG_N> */ -{"pxor", {DSP_REG_X,DSP_REG_Y,DSP_REG_N},{PPI,PPIC,HEX_A,HEX_5}, arch_sh_dsp_up}, -/* 10110101xxyynnnn por <DSP_REG_X>,<DSP_REG_Y>,<DSP_REG_N> */ -{"por", {DSP_REG_X,DSP_REG_Y,DSP_REG_N},{PPI,PPIC,HEX_B,HEX_5}, arch_sh_dsp_up}, -/* 10001001xxyynnnn pdec <DSP_REG_X>,<DSP_REG_N> */ -{"pdec", {DSP_REG_X,DSP_REG_N},{PPI,PPIC,HEX_8,HEX_9}, arch_sh_dsp_up}, -/* 10011001xxyynnnn pinc <DSP_REG_X>,<DSP_REG_N> */ -{"pinc", {DSP_REG_X,DSP_REG_N},{PPI,PPIC,HEX_9,HEX_9}, arch_sh_dsp_up}, -/* 10101001xxyynnnn pdec <DSP_REG_Y>,<DSP_REG_N> */ -{"pdec", {DSP_REG_Y,DSP_REG_N},{PPI,PPIC,HEX_A,HEX_9}, arch_sh_dsp_up}, -/* 10111001xxyynnnn pinc <DSP_REG_Y>,<DSP_REG_N> */ -{"pinc", {DSP_REG_Y,DSP_REG_N},{PPI,PPIC,HEX_B,HEX_9}, arch_sh_dsp_up}, -/* 10001101xxyynnnn pclr <DSP_REG_N> */ -{"pclr", {DSP_REG_N},{PPI,PPIC,HEX_8,HEX_D}, arch_sh_dsp_up}, -/* 10011101xxyynnnn pdmsb <DSP_REG_X>,<DSP_REG_N> */ -{"pdmsb", {DSP_REG_X,DSP_REG_N},{PPI,PPIC,HEX_9,HEX_D}, arch_sh_dsp_up}, -/* 10111101xxyynnnn pdmsb <DSP_REG_Y>,<DSP_REG_N> */ -{"pdmsb", {DSP_REG_Y,DSP_REG_N},{PPI,PPIC,HEX_B,HEX_D}, arch_sh_dsp_up}, -/* 11001001xxyynnnn pneg <DSP_REG_X>,<DSP_REG_N> */ -{"pneg", {DSP_REG_X,DSP_REG_N},{PPI,PPIC,HEX_C,HEX_9}, arch_sh_dsp_up}, -/* 11011001xxyynnnn pcopy <DSP_REG_X>,<DSP_REG_N> */ -{"pcopy", {DSP_REG_X,DSP_REG_N},{PPI,PPIC,HEX_D,HEX_9}, arch_sh_dsp_up}, -/* 11101001xxyynnnn pneg <DSP_REG_Y>,<DSP_REG_N> */ -{"pneg", {DSP_REG_Y,DSP_REG_N},{PPI,PPIC,HEX_E,HEX_9}, arch_sh_dsp_up}, -/* 11111001xxyynnnn pcopy <DSP_REG_Y>,<DSP_REG_N> */ -{"pcopy", {DSP_REG_Y,DSP_REG_N},{PPI,PPIC,HEX_F,HEX_9}, arch_sh_dsp_up}, -/* 11001101xxyynnnn psts MACH,<DSP_REG_N> */ -{"psts", {A_MACH,DSP_REG_N},{PPI,PPIC,HEX_C,HEX_D}, arch_sh_dsp_up}, -/* 11011101xxyynnnn psts MACL,<DSP_REG_N> */ -{"psts", {A_MACL,DSP_REG_N},{PPI,PPIC,HEX_D,HEX_D}, arch_sh_dsp_up}, -/* 11101101xxyynnnn plds <DSP_REG_N>,MACH */ -{"plds", {DSP_REG_N,A_MACH},{PPI,PPIC,HEX_E,HEX_D}, arch_sh_dsp_up}, -/* 11111101xxyynnnn plds <DSP_REG_N>,MACL */ -{"plds", {DSP_REG_N,A_MACL},{PPI,PPIC,HEX_F,HEX_D}, arch_sh_dsp_up}, - -/* 1111nnnn01011101 fabs <F_REG_N> */{"fabs",{F_REG_N},{HEX_F,REG_N,HEX_5,HEX_D}, arch_sh3e_up}, -/* 1111nnnn01011101 fabs <D_REG_N> */{"fabs",{D_REG_N},{HEX_F,REG_N,HEX_5,HEX_D}, arch_sh4_up}, - -/* 1111nnnnmmmm0000 fadd <F_REG_M>,<F_REG_N>*/{"fadd",{F_REG_M,F_REG_N},{HEX_F,REG_N,REG_M,HEX_0}, arch_sh3e_up}, -/* 1111nnn0mmm00000 fadd <D_REG_M>,<D_REG_N>*/{"fadd",{D_REG_M,D_REG_N},{HEX_F,REG_N,REG_M,HEX_0}, arch_sh4_up}, - -/* 1111nnnnmmmm0100 fcmp/eq <F_REG_M>,<F_REG_N>*/{"fcmp/eq",{F_REG_M,F_REG_N},{HEX_F,REG_N,REG_M,HEX_4}, arch_sh3e_up}, -/* 1111nnn0mmm00100 fcmp/eq <D_REG_M>,<D_REG_N>*/{"fcmp/eq",{D_REG_M,D_REG_N},{HEX_F,REG_N,REG_M,HEX_4}, arch_sh4_up}, - -/* 1111nnnnmmmm0101 fcmp/gt <F_REG_M>,<F_REG_N>*/{"fcmp/gt",{F_REG_M,F_REG_N},{HEX_F,REG_N,REG_M,HEX_5}, arch_sh3e_up}, -/* 1111nnn0mmm00101 fcmp/gt <D_REG_M>,<D_REG_N>*/{"fcmp/gt",{D_REG_M,D_REG_N},{HEX_F,REG_N,REG_M,HEX_5}, arch_sh4_up}, - -/* 1111nnn010111101 fcnvds <D_REG_N>,FPUL*/{"fcnvds",{D_REG_N,FPUL_M},{HEX_F,REG_N,HEX_B,HEX_D}, arch_sh4_up}, - -/* 1111nnn010101101 fcnvsd FPUL,<D_REG_N>*/{"fcnvsd",{FPUL_M,D_REG_N},{HEX_F,REG_N,HEX_A,HEX_D}, arch_sh4_up}, - -/* 1111nnnnmmmm0011 fdiv <F_REG_M>,<F_REG_N>*/{"fdiv",{F_REG_M,F_REG_N},{HEX_F,REG_N,REG_M,HEX_3}, arch_sh3e_up}, -/* 1111nnn0mmm00011 fdiv <D_REG_M>,<D_REG_N>*/{"fdiv",{D_REG_M,D_REG_N},{HEX_F,REG_N,REG_M,HEX_3}, arch_sh4_up}, - -/* 1111nnmm11101101 fipr <V_REG_M>,<V_REG_N>*/{"fipr",{V_REG_M,V_REG_N},{HEX_F,REG_NM,HEX_E,HEX_D}, arch_sh4_up}, - -/* 1111nnnn10001101 fldi0 <F_REG_N> */{"fldi0",{F_REG_N},{HEX_F,REG_N,HEX_8,HEX_D}, arch_sh3e_up}, - -/* 1111nnnn10011101 fldi1 <F_REG_N> */{"fldi1",{F_REG_N},{HEX_F,REG_N,HEX_9,HEX_D}, arch_sh3e_up}, - -/* 1111nnnn00011101 flds <F_REG_N>,FPUL*/{"flds",{F_REG_N,FPUL_M},{HEX_F,REG_N,HEX_1,HEX_D}, arch_sh3e_up}, - -/* 1111nnnn00101101 float FPUL,<F_REG_N>*/{"float",{FPUL_M,F_REG_N},{HEX_F,REG_N,HEX_2,HEX_D}, arch_sh3e_up}, -/* 1111nnnn00101101 float FPUL,<D_REG_N>*/{"float",{FPUL_M,D_REG_N},{HEX_F,REG_N,HEX_2,HEX_D}, arch_sh4_up}, - -/* 1111nnnnmmmm1110 fmac FR0,<F_REG_M>,<F_REG_N>*/{"fmac",{F_FR0,F_REG_M,F_REG_N},{HEX_F,REG_N,REG_M,HEX_E}, arch_sh3e_up}, - -/* 1111nnnnmmmm1100 fmov <F_REG_M>,<F_REG_N>*/{"fmov",{F_REG_M,F_REG_N},{HEX_F,REG_N,REG_M,HEX_C}, arch_sh3e_up}, -/* 1111nnnnmmmm1100 fmov <DX_REG_M>,<DX_REG_N>*/{"fmov",{DX_REG_M,DX_REG_N},{HEX_F,REG_N,REG_M,HEX_C}, arch_sh4_up}, - -/* 1111nnnnmmmm1000 fmov @<REG_M>,<F_REG_N>*/{"fmov",{A_IND_M,F_REG_N},{HEX_F,REG_N,REG_M,HEX_8}, arch_sh3e_up}, -/* 1111nnnnmmmm1000 fmov @<REG_M>,<DX_REG_N>*/{"fmov",{A_IND_M,DX_REG_N},{HEX_F,REG_N,REG_M,HEX_8}, arch_sh4_up}, - -/* 1111nnnnmmmm1010 fmov <F_REG_M>,@<REG_N>*/{"fmov",{F_REG_M,A_IND_N},{HEX_F,REG_N,REG_M,HEX_A}, arch_sh3e_up}, -/* 1111nnnnmmmm1010 fmov <DX_REG_M>,@<REG_N>*/{"fmov",{DX_REG_M,A_IND_N},{HEX_F,REG_N,REG_M,HEX_A}, arch_sh4_up}, - -/* 1111nnnnmmmm1001 fmov @<REG_M>+,<F_REG_N>*/{"fmov",{A_INC_M,F_REG_N},{HEX_F,REG_N,REG_M,HEX_9}, arch_sh3e_up}, -/* 1111nnnnmmmm1001 fmov @<REG_M>+,<DX_REG_N>*/{"fmov",{A_INC_M,DX_REG_N},{HEX_F,REG_N,REG_M,HEX_9}, arch_sh4_up}, - -/* 1111nnnnmmmm1011 fmov <F_REG_M>,@-<REG_N>*/{"fmov",{F_REG_M,A_DEC_N},{HEX_F,REG_N,REG_M,HEX_B}, arch_sh3e_up}, -/* 1111nnnnmmmm1011 fmov <DX_REG_M>,@-<REG_N>*/{"fmov",{DX_REG_M,A_DEC_N},{HEX_F,REG_N,REG_M,HEX_B}, arch_sh4_up}, - -/* 1111nnnnmmmm0110 fmov @(R0,<REG_M>),<F_REG_N>*/{"fmov",{A_IND_R0_REG_M,F_REG_N},{HEX_F,REG_N,REG_M,HEX_6}, arch_sh3e_up}, -/* 1111nnnnmmmm0110 fmov @(R0,<REG_M>),<DX_REG_N>*/{"fmov",{A_IND_R0_REG_M,DX_REG_N},{HEX_F,REG_N,REG_M,HEX_6}, arch_sh4_up}, - -/* 1111nnnnmmmm0111 fmov <F_REG_M>,@(R0,<REG_N>)*/{"fmov",{F_REG_M,A_IND_R0_REG_N},{HEX_F,REG_N,REG_M,HEX_7}, arch_sh3e_up}, -/* 1111nnnnmmmm0111 fmov <DX_REG_M>,@(R0,<REG_N>)*/{"fmov",{DX_REG_M,A_IND_R0_REG_N},{HEX_F,REG_N,REG_M,HEX_7}, arch_sh4_up}, - -/* 1111nnnnmmmm1000 fmov.d @<REG_M>,<DX_REG_N>*/{"fmov.d",{A_IND_M,DX_REG_N},{HEX_F,REG_N,REG_M,HEX_8}, arch_sh4_up}, - -/* 1111nnnnmmmm1010 fmov.d <DX_REG_M>,@<REG_N>*/{"fmov.d",{DX_REG_M,A_IND_N},{HEX_F,REG_N,REG_M,HEX_A}, arch_sh4_up}, - -/* 1111nnnnmmmm1001 fmov.d @<REG_M>+,<DX_REG_N>*/{"fmov.d",{A_INC_M,DX_REG_N},{HEX_F,REG_N,REG_M,HEX_9}, arch_sh4_up}, - -/* 1111nnnnmmmm1011 fmov.d <DX_REG_M>,@-<REG_N>*/{"fmov.d",{DX_REG_M,A_DEC_N},{HEX_F,REG_N,REG_M,HEX_B}, arch_sh4_up}, - -/* 1111nnnnmmmm0110 fmov.d @(R0,<REG_M>),<DX_REG_N>*/{"fmov.d",{A_IND_R0_REG_M,DX_REG_N},{HEX_F,REG_N,REG_M,HEX_6}, arch_sh4_up}, - -/* 1111nnnnmmmm0111 fmov.d <DX_REG_M>,@(R0,<REG_N>)*/{"fmov.d",{DX_REG_M,A_IND_R0_REG_N},{HEX_F,REG_N,REG_M,HEX_7}, arch_sh4_up}, - -/* 1111nnnnmmmm1000 fmov.s @<REG_M>,<F_REG_N>*/{"fmov.s",{A_IND_M,F_REG_N},{HEX_F,REG_N,REG_M,HEX_8}, arch_sh3e_up}, - -/* 1111nnnnmmmm1010 fmov.s <F_REG_M>,@<REG_N>*/{"fmov.s",{F_REG_M,A_IND_N},{HEX_F,REG_N,REG_M,HEX_A}, arch_sh3e_up}, - -/* 1111nnnnmmmm1001 fmov.s @<REG_M>+,<F_REG_N>*/{"fmov.s",{A_INC_M,F_REG_N},{HEX_F,REG_N,REG_M,HEX_9}, arch_sh3e_up}, - -/* 1111nnnnmmmm1011 fmov.s <F_REG_M>,@-<REG_N>*/{"fmov.s",{F_REG_M,A_DEC_N},{HEX_F,REG_N,REG_M,HEX_B}, arch_sh3e_up}, - -/* 1111nnnnmmmm0110 fmov.s @(R0,<REG_M>),<F_REG_N>*/{"fmov.s",{A_IND_R0_REG_M,F_REG_N},{HEX_F,REG_N,REG_M,HEX_6}, arch_sh3e_up}, - -/* 1111nnnnmmmm0111 fmov.s <F_REG_M>,@(R0,<REG_N>)*/{"fmov.s",{F_REG_M,A_IND_R0_REG_N},{HEX_F,REG_N,REG_M,HEX_7}, arch_sh3e_up}, - -/* 1111nnnnmmmm0010 fmul <F_REG_M>,<F_REG_N>*/{"fmul",{F_REG_M,F_REG_N},{HEX_F,REG_N,REG_M,HEX_2}, arch_sh3e_up}, -/* 1111nnn0mmm00010 fmul <D_REG_M>,<D_REG_N>*/{"fmul",{D_REG_M,D_REG_N},{HEX_F,REG_N,REG_M,HEX_2}, arch_sh4_up}, - -/* 1111nnnn01001101 fneg <F_REG_N> */{"fneg",{F_REG_N},{HEX_F,REG_N,HEX_4,HEX_D}, arch_sh3e_up}, -/* 1111nnnn01001101 fneg <D_REG_N> */{"fneg",{D_REG_N},{HEX_F,REG_N,HEX_4,HEX_D}, arch_sh4_up}, - -/* 1111101111111101 frchg */{"frchg",{0},{HEX_F,HEX_B,HEX_F,HEX_D}, arch_sh4_up}, - -/* 1111001111111101 fschg */{"fschg",{0},{HEX_F,HEX_3,HEX_F,HEX_D}, arch_sh4_up}, - -/* 1111nnnn01101101 fsqrt <F_REG_N> */{"fsqrt",{F_REG_N},{HEX_F,REG_N,HEX_6,HEX_D}, arch_sh3e_up}, -/* 1111nnnn01101101 fsqrt <D_REG_N> */{"fsqrt",{D_REG_N},{HEX_F,REG_N,HEX_6,HEX_D}, arch_sh4_up}, - -/* 1111nnnn00001101 fsts FPUL,<F_REG_N>*/{"fsts",{FPUL_M,F_REG_N},{HEX_F,REG_N,HEX_0,HEX_D}, arch_sh3e_up}, - -/* 1111nnnnmmmm0001 fsub <F_REG_M>,<F_REG_N>*/{"fsub",{F_REG_M,F_REG_N},{HEX_F,REG_N,REG_M,HEX_1}, arch_sh3e_up}, -/* 1111nnn0mmm00001 fsub <D_REG_M>,<D_REG_N>*/{"fsub",{D_REG_M,D_REG_N},{HEX_F,REG_N,REG_M,HEX_1}, arch_sh4_up}, - -/* 1111nnnn00111101 ftrc <F_REG_N>,FPUL*/{"ftrc",{F_REG_N,FPUL_M},{HEX_F,REG_N,HEX_3,HEX_D}, arch_sh3e_up}, -/* 1111nnnn00111101 ftrc <D_REG_N>,FPUL*/{"ftrc",{D_REG_N,FPUL_M},{HEX_F,REG_N,HEX_3,HEX_D}, arch_sh4_up}, - -/* 1111nn0111111101 ftrv XMTRX_M4,<V_REG_n>*/{"ftrv",{XMTRX_M4,V_REG_N},{HEX_F,REG_NM,HEX_F,HEX_D}, arch_sh4_up}, - -{ 0 } -}; - -#endif |